Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
package.dist.mermaid.min.js.map Maven / Gradle / Ivy
Go to download
Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.
{
"version": 3,
"sources": ["../../../node_modules/.pnpm/[email protected] /node_modules/dayjs/dayjs.min.js", "../src/logger.ts", "../../../node_modules/.pnpm/@[email protected] /node_modules/@iconify/utils/lib/icon/defaults.mjs", "../../../node_modules/.pnpm/@[email protected] /node_modules/@iconify/utils/lib/customisations/defaults.mjs", "../../../node_modules/.pnpm/@[email protected] /node_modules/@iconify/utils/lib/icon/name.mjs", "../../../node_modules/.pnpm/@[email protected] /node_modules/@iconify/utils/lib/icon/transformations.mjs", "../../../node_modules/.pnpm/@[email protected] /node_modules/@iconify/utils/lib/icon/merge.mjs", "../../../node_modules/.pnpm/@[email protected] /node_modules/@iconify/utils/lib/icon-set/tree.mjs", "../../../node_modules/.pnpm/@[email protected] /node_modules/@iconify/utils/lib/icon-set/get-icon.mjs", "../../../node_modules/.pnpm/@[email protected] /node_modules/@iconify/utils/lib/svg/size.mjs", "../../../node_modules/.pnpm/@[email protected] /node_modules/@iconify/utils/lib/svg/defs.mjs", "../../../node_modules/.pnpm/@[email protected] /node_modules/@iconify/utils/lib/svg/build.mjs", "../../../node_modules/.pnpm/@[email protected] /node_modules/@iconify/utils/lib/svg/id.mjs", "../../../node_modules/.pnpm/@[email protected] /node_modules/@iconify/utils/lib/svg/html.mjs", "../../../node_modules/.pnpm/[email protected] /node_modules/ms/index.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/debug/src/common.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/debug/src/browser.js", "../../../node_modules/.pnpm/@[email protected] /node_modules/@iconify/utils/lib/index.mjs", "../src/rendering-util/icons.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/ts-dedent/src/index.ts", "../src/diagram-api/regexes.ts", "../src/errors.ts", "../src/diagram-api/detectType.ts", "../src/diagrams/c4/parser/c4Diagram.jison", "../src/assignWithDepth.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/utils/channel.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/utils/lang.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/utils/unit.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/utils/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/constants.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/channels/type.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/channels/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/channels/reusable.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/color/hex.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/color/hsl.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/color/keyword.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/color/rgb.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/color/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/methods/change.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/methods/rgba.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/methods/channel.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/methods/luminance.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/methods/is_light.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/methods/is_dark.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/methods/adjust_channel.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/methods/lighten.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/methods/darken.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/methods/adjust.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/methods/mix.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/methods/invert.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/methods/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/khroma/dist/index.js", "../src/themes/erDiagram-oldHardcodedValues.ts", "../src/themes/theme-helpers.js", "../src/themes/theme-base.js", "../src/themes/theme-dark.js", "../src/themes/theme-default.js", "../src/themes/theme-forest.js", "../src/themes/theme-neutral.js", "../src/themes/index.js", "../src/schemas/config.schema.yaml", "../src/defaultConfig.ts", "../src/utils/sanitizeDirective.ts", "../src/config.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/dompurify/src/utils.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dompurify/src/tags.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dompurify/src/attrs.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dompurify/src/regexp.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dompurify/src/purify.js", "../../../node_modules/.pnpm/[email protected] /node_modules/katex/dist/katex.mjs", "../src/diagrams/common/common.ts", "../src/setupGraphViewbox.js", "../src/styles.ts", "../src/diagrams/common/commonDb.ts", "../src/diagram-api/diagramAPI.ts", "../src/diagrams/c4/c4Db.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-array/src/ascending.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-array/src/descending.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-array/src/bisector.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-array/src/number.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-array/src/bisect.js", "../../../node_modules/.pnpm/[email protected] /node_modules/internmap/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-array/src/ticks.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-array/src/max.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-array/src/min.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-array/src/range.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-array/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-axis/src/identity.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-axis/src/axis.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-axis/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-dispatch/src/dispatch.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-dispatch/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/namespaces.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/namespace.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/creator.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selector.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/select.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/array.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selectorAll.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/selectAll.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/matcher.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/selectChild.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/selectChildren.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/filter.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/sparse.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/enter.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/constant.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/data.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/exit.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/join.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/merge.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/order.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/sort.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/call.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/nodes.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/node.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/size.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/empty.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/each.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/attr.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/window.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/style.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/property.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/classed.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/text.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/html.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/raise.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/lower.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/append.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/insert.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/remove.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/clone.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/datum.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/on.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/dispatch.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/iterator.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/selection/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/select.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-selection/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-drag/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-color/src/define.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-color/src/color.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-color/src/math.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-color/src/lab.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-color/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-interpolate/src/basis.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-interpolate/src/basisClosed.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-interpolate/src/constant.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-interpolate/src/color.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-interpolate/src/rgb.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-interpolate/src/numberArray.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-interpolate/src/array.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-interpolate/src/date.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-interpolate/src/number.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-interpolate/src/object.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-interpolate/src/string.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-interpolate/src/value.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-interpolate/src/round.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-interpolate/src/transform/decompose.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-interpolate/src/transform/parse.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-interpolate/src/transform/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-interpolate/src/hcl.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-interpolate/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-timer/src/timer.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-timer/src/timeout.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-timer/src/index.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/transition/schedule.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/interrupt.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/selection/interrupt.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/transition/tween.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/transition/interpolate.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/transition/attr.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/transition/attrTween.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/transition/delay.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/transition/duration.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/transition/ease.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/transition/easeVarying.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/transition/filter.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/transition/merge.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/transition/on.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/transition/remove.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/transition/select.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/transition/selectAll.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/transition/selection.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/transition/style.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/transition/styleTween.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/transition/text.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/transition/textTween.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/transition/transition.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/transition/end.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/transition/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-ease/src/cubic.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-ease/src/index.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/selection/transition.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/selection/index.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/d3-transition/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-brush/src/constant.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-brush/src/event.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-brush/src/noevent.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-brush/src/brush.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-brush/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-path/src/path.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-path/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-chord/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-contour/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-delaunay/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-dsv/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-fetch/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-quadtree/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-force/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-format/src/formatDecimal.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-format/src/exponent.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-format/src/formatGroup.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-format/src/formatNumerals.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-format/src/formatSpecifier.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-format/src/formatTrim.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-format/src/formatPrefixAuto.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-format/src/formatRounded.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-format/src/formatTypes.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-format/src/identity.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-format/src/locale.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-format/src/defaultLocale.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-format/src/precisionFixed.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-format/src/precisionPrefix.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-format/src/precisionRound.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-format/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-geo/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-hierarchy/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-polygon/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-random/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-scale/src/init.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-scale/src/ordinal.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-scale/src/band.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-scale/src/constant.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-scale/src/number.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-scale/src/continuous.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-scale/src/tickFormat.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-scale/src/linear.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-scale/src/nice.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-time/src/interval.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-time/src/millisecond.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-time/src/second.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-time/src/minute.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-time/src/hour.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-time/src/day.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-time/src/week.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-time/src/month.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-time/src/year.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-time/src/ticks.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-time/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-time-format/src/locale.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-time-format/src/defaultLocale.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-time-format/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-scale/src/time.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-scale/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-scale-chromatic/src/colors.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-scale-chromatic/src/categorical/Tableau10.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-scale-chromatic/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/constant.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/math.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/path.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/arc.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/array.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/curve/linear.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/point.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/line.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/descending.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/identity.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/pie.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/curve/bump.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/noop.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/curve/basis.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/curve/basisClosed.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/curve/basisOpen.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/curve/bundle.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/curve/cardinal.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/curve/cardinalClosed.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/curve/cardinalOpen.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/curve/catmullRom.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/curve/catmullRomClosed.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/curve/catmullRomOpen.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/curve/linearClosed.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/curve/monotone.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/curve/natural.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/curve/step.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-zoom/src/constant.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-zoom/src/event.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-zoom/src/transform.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-zoom/src/noevent.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-zoom/src/zoom.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-zoom/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3/src/index.js", "../../../node_modules/.pnpm/@[email protected] /node_modules/@braintree/sanitize-url/dist/constants.js", "../../../node_modules/.pnpm/@[email protected] /node_modules/@braintree/sanitize-url/dist/index.js", "../src/diagrams/common/svgDrawCommon.ts", "../src/diagrams/c4/svgDraw.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_freeGlobal.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_root.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_Symbol.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_getRawTag.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_objectToString.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseGetTag.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/isObject.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/isFunction.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_coreJsData.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_isMasked.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_toSource.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseIsNative.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_getValue.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_getNative.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_nativeCreate.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_hashClear.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_hashDelete.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_hashGet.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_hashHas.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_hashSet.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_Hash.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_listCacheClear.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/eq.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_assocIndexOf.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_listCacheDelete.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_listCacheGet.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_listCacheHas.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_listCacheSet.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_ListCache.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_Map.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_mapCacheClear.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_isKeyable.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_getMapData.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_mapCacheDelete.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_mapCacheGet.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_mapCacheHas.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_mapCacheSet.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_MapCache.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/memoize.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_stackClear.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_stackDelete.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_stackGet.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_stackHas.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_stackSet.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_Stack.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_defineProperty.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseAssignValue.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_assignMergeValue.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_createBaseFor.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseFor.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_cloneBuffer.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_Uint8Array.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_cloneArrayBuffer.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_cloneTypedArray.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_copyArray.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseCreate.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_overArg.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_getPrototype.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_isPrototype.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_initCloneObject.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/isObjectLike.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseIsArguments.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/isArguments.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/isArray.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/isLength.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/isArrayLike.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/isArrayLikeObject.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/stubFalse.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/isBuffer.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/isPlainObject.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseIsTypedArray.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseUnary.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_nodeUtil.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/isTypedArray.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_safeGet.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_assignValue.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_copyObject.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseTimes.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_isIndex.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_arrayLikeKeys.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_nativeKeysIn.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseKeysIn.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/keysIn.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/toPlainObject.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseMergeDeep.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseMerge.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/identity.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_apply.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_overRest.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/constant.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseSetToString.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_shortOut.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_setToString.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseRest.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_isIterateeCall.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_createAssigner.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/merge.js", "../src/utils.ts", "../src/diagrams/c4/c4Renderer.js", "../src/diagrams/c4/styles.js", "../src/diagrams/c4/c4Diagram.ts", "../src/diagrams/flowchart/flowDb.ts", "../src/dagre-wrapper/blockArrowHelper.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/marked/src/defaults.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/marked/src/helpers.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/marked/src/Tokenizer.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/marked/src/rules.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/marked/src/Lexer.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/marked/src/Renderer.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/marked/src/TextRenderer.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/marked/src/Parser.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/marked/src/Hooks.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/marked/src/Instance.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/marked/src/marked.ts", "../src/rendering-util/handle-markdown-text.ts", "../src/rendering-util/splitText.ts", "../src/rendering-util/createText.ts", "../src/dagre-wrapper/createLabel.js", "../src/dagre-wrapper/intersect/intersect-node.js", "../src/dagre-wrapper/intersect/intersect-ellipse.js", "../src/dagre-wrapper/intersect/intersect-circle.js", "../src/dagre-wrapper/intersect/intersect-line.js", "../src/dagre-wrapper/intersect/intersect-polygon.js", "../src/dagre-wrapper/intersect/intersect-rect.js", "../src/dagre-wrapper/intersect/index.js", "../src/dagre-wrapper/shapes/util.js", "../src/dagre-wrapper/shapes/note.js", "../src/dagre-wrapper/nodes.js", "../src/rendering-util/insertElementsForSize.js", "../src/utils/subGraphTitleMargins.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/roughjs/bundled/rough.esm.js", "../src/rendering-util/rendering-elements/intersect/intersect-rect.js", "../src/rendering-util/rendering-elements/createLabel.js", "../src/rendering-util/rendering-elements/shapes/roundedRectPath.ts", "../src/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.ts", "../src/rendering-util/rendering-elements/clusters.js", "../src/utils/lineWithOffset.ts", "../src/rendering-util/rendering-elements/edgeMarker.ts", "../src/rendering-util/rendering-elements/edges.js", "../src/rendering-util/rendering-elements/markers.js", "../src/rendering-util/rendering-elements/shapes/util.js", "../src/rendering-util/rendering-elements/intersect/intersect-node.js", "../src/rendering-util/rendering-elements/intersect/intersect-ellipse.js", "../src/rendering-util/rendering-elements/intersect/intersect-circle.js", "../src/rendering-util/rendering-elements/intersect/intersect-line.js", "../src/rendering-util/rendering-elements/intersect/intersect-polygon.js", "../src/rendering-util/rendering-elements/intersect/index.js", "../src/rendering-util/rendering-elements/shapes/drawRect.ts", "../src/rendering-util/rendering-elements/shapes/state.ts", "../src/rendering-util/rendering-elements/shapes/roundedRect.ts", "../src/rendering-util/rendering-elements/shapes/squareRect.ts", "../src/rendering-util/rendering-elements/shapes/stateStart.ts", "../src/rendering-util/rendering-elements/shapes/stateEnd.ts", "../src/rendering-util/rendering-elements/shapes/forkJoin.ts", "../src/rendering-util/rendering-elements/shapes/choice.ts", "../src/rendering-util/rendering-elements/shapes/note.ts", "../src/rendering-util/rendering-elements/shapes/stadium.ts", "../src/rendering-util/rendering-elements/shapes/rectWithTitle.ts", "../src/rendering-util/rendering-elements/shapes/insertPolygonShape.ts", "../src/rendering-util/rendering-elements/shapes/subroutine.ts", "../src/rendering-util/rendering-elements/shapes/cylinder.ts", "../src/rendering-util/rendering-elements/shapes/circle.ts", "../src/rendering-util/rendering-elements/shapes/doubleCircle.ts", "../src/rendering-util/rendering-elements/shapes/rectLeftInvArrow.ts", "../src/rendering-util/rendering-elements/shapes/question.ts", "../src/rendering-util/rendering-elements/shapes/hexagon.ts", "../src/rendering-util/rendering-elements/shapes/leanRight.ts", "../src/rendering-util/rendering-elements/shapes/leanLeft.ts", "../src/rendering-util/rendering-elements/shapes/trapezoid.ts", "../src/rendering-util/rendering-elements/shapes/invertedTrapezoid.ts", "../src/rendering-util/rendering-elements/shapes/labelRect.ts", "../src/rendering-util/rendering-elements/nodes.js", "../src/internals.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/isSymbol.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_arrayMap.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseToString.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_trimmedEndIndex.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseTrim.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/toNumber.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/toFinite.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/toInteger.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_WeakMap.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/noop.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_arrayEach.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseFindIndex.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseIsNaN.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_strictIndexOf.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseIndexOf.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_arrayIncludes.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_nativeKeys.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseKeys.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/keys.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/assign.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_isKey.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_memoizeCapped.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_stringToPath.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/toString.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_castPath.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_toKey.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseGet.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/get.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_arrayPush.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_isFlattenable.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseFlatten.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/flatten.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_flatRest.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseSlice.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_hasUnicode.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_arrayReduce.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseAssign.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseAssignIn.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_arrayFilter.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/stubArray.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_getSymbols.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_copySymbols.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_getSymbolsIn.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_copySymbolsIn.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseGetAllKeys.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_getAllKeys.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_getAllKeysIn.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_DataView.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_Promise.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_Set.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_getTag.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_initCloneArray.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_cloneDataView.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_cloneRegExp.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_cloneSymbol.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_initCloneByTag.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseIsMap.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/isMap.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseIsSet.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/isSet.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseClone.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/clone.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/cloneDeep.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/compact.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_setCacheAdd.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_setCacheHas.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_SetCache.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_arraySome.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_cacheHas.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_equalArrays.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_mapToArray.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_setToArray.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_equalByTag.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_equalObjects.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseIsEqualDeep.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseIsEqual.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseIsMatch.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_isStrictComparable.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_getMatchData.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_matchesStrictComparable.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseMatches.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseHasIn.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_hasPath.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/hasIn.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseMatchesProperty.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseProperty.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_basePropertyDeep.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/property.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseIteratee.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_arrayAggregator.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseForOwn.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_createBaseEach.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseEach.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseAggregator.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_createAggregator.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/now.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/defaults.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_arrayIncludesWith.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseDifference.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/difference.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/last.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/drop.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/dropRight.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_castFunction.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/forEach.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/each.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_arrayEvery.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseEvery.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/every.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseFilter.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/filter.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_createFind.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/findIndex.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/find.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/head.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/first.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseMap.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/map.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/flatMap.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/forIn.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/forOwn.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/groupBy.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseGt.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseHas.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/has.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/isString.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseValues.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/values.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/includes.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/indexOf.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/isEmpty.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseIsRegExp.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/isRegExp.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/isUndefined.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseLt.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/mapValues.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseExtremum.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/max.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/min.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/minBy.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/negate.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseSet.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_basePickBy.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/pickBy.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseSortBy.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_compareAscending.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_compareMultiple.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseOrderBy.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_asciiSize.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_unicodeSize.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_stringSize.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_basePick.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/pick.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseRange.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_createRange.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/range.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseReduce.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/reduce.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/reject.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/size.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseSome.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/some.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/sortBy.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_createSet.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseUniq.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/union.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/uniq.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/uniqBy.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/uniqueId.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/_baseZipObject.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/zipObject.js", "../../../node_modules/.pnpm/[email protected] /node_modules/lodash-es/lodash.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/graphlib/graph.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/graphlib/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/data/list.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/greedy-fas.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/acyclic.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/util.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/add-border-segments.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/coordinate-system.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/normalize.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/rank/util.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/rank/feasible-tree.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/graphlib/alg/components.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/graphlib/data/priority-queue.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/graphlib/alg/dijkstra.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/graphlib/alg/dijkstra-all.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/graphlib/alg/tarjan.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/graphlib/alg/find-cycles.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/graphlib/alg/floyd-warshall.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/graphlib/alg/topsort.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/graphlib/alg/is-acyclic.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/graphlib/alg/dfs.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/graphlib/alg/postorder.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/graphlib/alg/preorder.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/graphlib/alg/prim.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/graphlib/alg/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/rank/network-simplex.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/rank/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/nesting-graph.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/order/add-subgraph-constraints.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/order/build-layer-graph.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/order/cross-count.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/order/init-order.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/order/barycenter.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/order/resolve-conflicts.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/order/sort.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/order/sort-subgraph.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/order/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/parent-dummy-chains.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/position/bk.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/position/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/layout.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/dagre/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dagre-d3-es/src/graphlib/json.js", "../src/rendering-util/layout-algorithms/dagre/mermaid-graphlib.js", "../src/rendering-util/layout-algorithms/dagre/index.js", "../src/rendering-util/render.ts", "../src/rendering-util/setupViewPortForSVG.ts", "../src/diagrams/flowchart/flowRenderer-v3-unified.ts", "../src/diagrams/flowchart/parser/flow.jison", "../src/diagrams/flowchart/styles.ts", "../src/diagrams/flowchart/flowDiagram.ts", "../src/diagrams/er/parser/erDiagram.jison", "../src/diagrams/er/erDb.js", "../src/diagrams/er/erMarkers.js", "../../../node_modules/.pnpm/[email protected] /node_modules/uuid/dist/esm-browser/regex.js", "../../../node_modules/.pnpm/[email protected] /node_modules/uuid/dist/esm-browser/validate.js", "../../../node_modules/.pnpm/[email protected] /node_modules/uuid/dist/esm-browser/stringify.js", "../../../node_modules/.pnpm/[email protected] /node_modules/uuid/dist/esm-browser/parse.js", "../../../node_modules/.pnpm/[email protected] /node_modules/uuid/dist/esm-browser/v35.js", "../../../node_modules/.pnpm/[email protected] /node_modules/uuid/dist/esm-browser/sha1.js", "../../../node_modules/.pnpm/[email protected] /node_modules/uuid/dist/esm-browser/v5.js", "../../../node_modules/.pnpm/[email protected] /node_modules/uuid/dist/esm-browser/index.js", "../src/diagrams/er/erRenderer.js", "../src/diagrams/er/styles.js", "../src/diagrams/er/erDiagram.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/syntax-tree.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/utils/stream.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/utils/cst-utils.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/utils/errors.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/languages/generated/ast.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/utils/ast-utils.ts", "../../../node_modules/.pnpm/@[email protected] /node_modules/@chevrotain/regexp-to-ast/src/utils.ts", "../../../node_modules/.pnpm/@[email protected] /node_modules/@chevrotain/regexp-to-ast/src/character-classes.ts", "../../../node_modules/.pnpm/@[email protected] /node_modules/@chevrotain/regexp-to-ast/src/regexp-parser.ts", "../../../node_modules/.pnpm/@[email protected] /node_modules/@chevrotain/regexp-to-ast/src/base-regexp-visitor.ts", "../../../node_modules/.pnpm/@[email protected] /node_modules/@chevrotain/regexp-to-ast/src/api.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/utils/regexp-utils.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/utils/grammar-utils.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/languages/grammar-config.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/version.ts", "../../../node_modules/.pnpm/@[email protected] /node_modules/@chevrotain/utils/src/print.ts", "../../../node_modules/.pnpm/@[email protected] /node_modules/@chevrotain/utils/src/timer.ts", "../../../node_modules/.pnpm/@[email protected] /node_modules/@chevrotain/utils/src/to-fast-properties.ts", "../../../node_modules/.pnpm/@[email protected] /node_modules/@chevrotain/utils/src/api.ts", "../../../node_modules/.pnpm/@[email protected] /node_modules/@chevrotain/gast/src/model.ts", "../../../node_modules/.pnpm/@[email protected] /node_modules/@chevrotain/gast/src/visitor.ts", "../../../node_modules/.pnpm/@[email protected] /node_modules/@chevrotain/gast/src/helpers.ts", "../../../node_modules/.pnpm/@[email protected] /node_modules/@chevrotain/gast/src/api.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/grammar/rest.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/grammar/first.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/constants.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/grammar/follow.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/scan/reg_exp_parser.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/scan/reg_exp.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/scan/lexer.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/scan/tokens.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/scan/lexer_errors_public.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/scan/lexer_public.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/scan/tokens_public.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/errors_public.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/grammar/resolver.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/grammar/interpreter.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/grammar/lookahead.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/grammar/checks.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/grammar/gast/gast_resolver_public.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/exceptions_public.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/parser/traits/recoverable.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/grammar/keys.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/grammar/llk_lookahead.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/parser/traits/looksahead.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/cst/cst.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/lang/lang_extensions.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/cst/cst_visitor.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/parser/traits/tree_builder.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/parser/traits/lexer_adapter.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/parser/traits/recognizer_api.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/parser/traits/recognizer_engine.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/parser/traits/error_handler.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/parser/traits/context_assist.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/parser/traits/gast_recorder.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/parser/traits/perf_tracer.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/parser/utils/apply_mixins.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/parse/parser/parser.ts", "../../../node_modules/.pnpm/@[email protected] /node_modules/@chevrotain/cst-dts-gen/src/model.ts", "../../../node_modules/.pnpm/@[email protected] /node_modules/@chevrotain/cst-dts-gen/src/generate.ts", "../../../node_modules/.pnpm/@[email protected] /node_modules/@chevrotain/cst-dts-gen/src/api.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/diagrams/render_public.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/chevrotain/src/api.ts", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/chevrotain-allstar/src/atn.ts", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/chevrotain-allstar/src/dfa.ts", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/chevrotain-allstar/src/all-star-lookahead.ts", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/chevrotain-allstar/src/index.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/vscode-languageserver-types/lib/esm/main.js", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/parser/cst-node-builder.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/parser/langium-parser.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/parser/parser-builder-base.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/parser/completion-parser-builder.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/parser/langium-parser-builder.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/parser/token-builder.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/parser/value-converter.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/vscode-jsonrpc/lib/common/ral.js", "../../../node_modules/.pnpm/[email protected] /node_modules/vscode-jsonrpc/lib/common/is.js", "../../../node_modules/.pnpm/[email protected] /node_modules/vscode-jsonrpc/lib/common/events.js", "../../../node_modules/.pnpm/[email protected] /node_modules/vscode-jsonrpc/lib/common/cancellation.js", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/utils/cancellation.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/utils/promise-utils.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/vscode-languageserver-textdocument/lib/esm/main.js", "../../../node_modules/.pnpm/[email protected] /node_modules/vscode-uri/lib/esm/webpack:/LIB/node_modules/path-browserify/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/vscode-uri/lib/esm/webpack:/LIB/webpack/bootstrap", "../../../node_modules/.pnpm/[email protected] /node_modules/vscode-uri/lib/esm/webpack:/LIB/webpack/runtime/define property getters", "../../../node_modules/.pnpm/[email protected] /node_modules/vscode-uri/lib/esm/webpack:/LIB/webpack/runtime/hasOwnProperty shorthand", "../../../node_modules/.pnpm/[email protected] /node_modules/vscode-uri/lib/esm/webpack:/LIB/webpack/runtime/make namespace object", "../../../node_modules/.pnpm/[email protected] /node_modules/vscode-uri/lib/esm/webpack:/LIB/src/platform.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/vscode-uri/lib/esm/webpack:/LIB/src/uri.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/vscode-uri/lib/esm/webpack:/LIB/src/utils.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/utils/uri-utils.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/workspace/documents.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/references/linker.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/references/name-provider.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/references/references.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/utils/collections.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/references/scope-computation.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/references/scope.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/utils/caching.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/references/scope-provider.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/serializer/json-serializer.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/service-registry.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/validation/validation-registry.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/validation/document-validator.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/workspace/ast-descriptions.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/workspace/ast-node-locator.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/workspace/configuration.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/utils/disposable.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/workspace/document-builder.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/workspace/index-manager.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/workspace/workspace-manager.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/parser/lexer.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/documentation/jsdoc.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/documentation/documentation-provider.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/documentation/comment-provider.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/utils/event.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/parser/async-parser.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/workspace/workspace-lock.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/serializer/hydrator.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/default-module.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/dependency-injection.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/services.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/documentation/index.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/languages/language-meta-data.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/languages/index.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/parser/parser-config.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/parser/index.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/references/index.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/serializer/index.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/workspace/file-system-provider.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/utils/grammar-loader.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/utils/index.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/validation/index.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/workspace/index.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/langium/src/index.ts", "../../parser/dist/chunks/mermaid-parser.core/chunk-Y27MQZ3U.mjs", "../../parser/dist/chunks/mermaid-parser.core/chunk-NCMFTTUW.mjs", "../../parser/dist/chunks/mermaid-parser.core/chunk-4YFB5VUC.mjs", "../../parser/dist/chunks/mermaid-parser.core/chunk-EQFLFMNE.mjs", "../../parser/dist/chunks/mermaid-parser.core/chunk-BI6EQKOQ.mjs", "../../parser/dist/chunks/mermaid-parser.core/chunk-FF7BQXOH.mjs", "../../parser/dist/chunks/mermaid-parser.core/info-46DW6VJ7.mjs", "../../parser/dist/chunks/mermaid-parser.core/packet-W2GHVCYJ.mjs", "../../parser/dist/chunks/mermaid-parser.core/pie-BEWT4RHE.mjs", "../../parser/dist/chunks/mermaid-parser.core/architecture-I3QFYML2.mjs", "../../parser/dist/chunks/mermaid-parser.core/gitGraph-YCYPL57B.mjs", "../../parser/dist/mermaid-parser.core.mjs", "../src/diagrams/common/populateCommonDb.ts", "../src/diagrams/git/gitGraphTypes.ts", "../src/utils/imperativeState.ts", "../src/diagrams/git/gitGraphAst.ts", "../src/diagrams/git/gitGraphParser.ts", "../src/diagrams/git/gitGraphRenderer.ts", "../src/diagrams/git/styles.js", "../src/diagrams/git/gitGraphDiagram.ts", "../src/diagrams/gantt/parser/gantt.jison", "../../../node_modules/.pnpm/[email protected] /node_modules/dayjs/plugin/isoWeek.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dayjs/plugin/customParseFormat.js", "../../../node_modules/.pnpm/[email protected] /node_modules/dayjs/plugin/advancedFormat.js", "../src/diagrams/gantt/ganttDb.js", "../src/diagrams/gantt/ganttRenderer.js", "../src/diagrams/gantt/styles.js", "../src/diagrams/gantt/ganttDiagram.ts", "../src/diagrams/info/infoParser.ts", "../package.json", "../src/diagrams/info/infoDb.ts", "../src/rendering-util/selectSvgElement.ts", "../src/diagrams/info/infoRenderer.ts", "../src/diagrams/info/infoDiagram.ts", "../src/diagrams/pie/pieDb.ts", "../src/diagrams/pie/pieParser.ts", "../src/diagrams/pie/pieStyles.ts", "../src/diagrams/pie/pieRenderer.ts", "../src/diagrams/pie/pieDiagram.ts", "../src/diagrams/quadrant-chart/parser/quadrant.jison", "../src/diagrams/quadrant-chart/quadrantBuilder.ts", "../src/diagrams/quadrant-chart/utils.ts", "../src/diagrams/quadrant-chart/quadrantDb.ts", "../src/diagrams/quadrant-chart/quadrantRenderer.ts", "../src/diagrams/quadrant-chart/quadrantDiagram.ts", "../src/diagrams/xychart/parser/xychart.jison", "../src/diagrams/xychart/chartBuilder/interfaces.ts", "../src/diagrams/xychart/chartBuilder/textDimensionCalculator.ts", "../src/diagrams/xychart/chartBuilder/components/axis/baseAxis.ts", "../src/diagrams/xychart/chartBuilder/components/axis/bandAxis.ts", "../src/diagrams/xychart/chartBuilder/components/axis/linearAxis.ts", "../src/diagrams/xychart/chartBuilder/components/axis/index.ts", "../src/diagrams/xychart/chartBuilder/components/chartTitle.ts", "../src/diagrams/xychart/chartBuilder/components/plot/linePlot.ts", "../src/diagrams/xychart/chartBuilder/components/plot/barPlot.ts", "../src/diagrams/xychart/chartBuilder/components/plot/index.ts", "../src/diagrams/xychart/chartBuilder/orchestrator.ts", "../src/diagrams/xychart/chartBuilder/index.ts", "../src/diagrams/xychart/xychartDb.ts", "../src/diagrams/xychart/xychartRenderer.ts", "../src/diagrams/xychart/xychartDiagram.ts", "../src/diagrams/requirement/parser/requirementDiagram.jison", "../src/diagrams/requirement/requirementDb.js", "../src/diagrams/requirement/styles.js", "../src/diagrams/requirement/requirementMarkers.js", "../src/diagrams/requirement/requirementRenderer.js", "../src/diagrams/requirement/requirementDiagram.ts", "../src/diagrams/sequence/parser/sequenceDiagram.jison", "../src/diagrams/sequence/sequenceDb.ts", "../src/diagrams/sequence/styles.js", "../src/diagrams/sequence/svgDraw.js", "../src/diagrams/sequence/sequenceRenderer.ts", "../src/diagrams/sequence/sequenceDiagram.ts", "../src/diagrams/class/parser/classDiagram.jison", "../src/diagrams/class/classTypes.ts", "../src/diagrams/class/classDb.ts", "../src/diagrams/class/styles.js", "../src/diagrams/class/svgDraw.js", "../src/diagrams/class/classRenderer.js", "../src/diagrams/class/classDiagram.ts", "../src/dagre-wrapper/markers.js", "../src/dagre-wrapper/mermaid-graphlib.js", "../src/dagre-wrapper/clusters.js", "../src/dagre-wrapper/edgeMarker.ts", "../src/dagre-wrapper/edges.js", "../src/dagre-wrapper/index.js", "../src/diagrams/class/classRenderer-v2.ts", "../src/diagrams/class/classDiagram-v2.ts", "../src/diagrams/state/parser/stateDiagram.jison", "../src/diagrams/state/stateCommon.ts", "../src/diagrams/state/dataFetcher.js", "../src/diagrams/state/stateRenderer-v3-unified.ts", "../src/diagrams/state/stateDb.js", "../src/diagrams/state/styles.js", "../src/diagrams/state/id-cache.js", "../src/diagrams/state/shapes.js", "../src/diagrams/state/stateRenderer.js", "../src/diagrams/state/stateDiagram.ts", "../src/diagrams/state/stateDiagram-v2.ts", "../src/diagrams/user-journey/parser/journey.jison", "../src/diagrams/user-journey/journeyDb.js", "../src/diagrams/user-journey/styles.js", "../src/diagrams/user-journey/svgDraw.js", "../src/diagrams/user-journey/journeyRenderer.ts", "../src/diagrams/user-journey/journeyDiagram.ts", "../src/diagrams/timeline/parser/timeline.jison", "../src/diagrams/timeline/timelineDb.js", "../src/diagrams/timeline/svgDraw.js", "../src/diagrams/timeline/timelineRenderer.ts", "../src/diagrams/timeline/styles.js", "../src/diagrams/timeline/timeline-definition.ts", "../src/diagrams/mindmap/parser/mindmap.jison", "../src/diagrams/mindmap/mindmapDb.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/cytoscape/dist/cytoscape.esm.mjs", "../../../node_modules/.pnpm/[email protected] /node_modules/layout-base/layout-base.js", "../../../node_modules/.pnpm/[email protected] /node_modules/cose-base/cose-base.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/cytoscape-cose-bilkent/cytoscape-cose-bilkent.js", "../src/diagrams/mindmap/svgDraw.ts", "../src/diagrams/mindmap/mindmapRenderer.ts", "../src/diagrams/mindmap/styles.ts", "../src/diagrams/mindmap/mindmap-definition.ts", "../src/diagrams/sankey/parser/sankey.jison", "../src/diagrams/sankey/sankeyDB.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-array/src/max.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-array/src/min.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-array/src/sum.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-array/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-sankey/src/align.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-sankey/src/constant.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-sankey/src/sankey.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-path/src/path.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-path/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/constant.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/point.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/array.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/link/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-shape/src/index.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-sankey/src/sankeyLinkHorizontal.js", "../../../node_modules/.pnpm/[email protected] /node_modules/d3-sankey/src/index.js", "../src/rendering-util/uid.ts", "../src/diagrams/sankey/sankeyRenderer.ts", "../src/diagrams/sankey/sankeyUtils.ts", "../src/diagrams/sankey/sankeyDiagram.ts", "../src/diagrams/packet/db.ts", "../src/diagrams/packet/parser.ts", "../src/diagrams/packet/renderer.ts", "../src/diagrams/packet/styles.ts", "../src/diagrams/packet/diagram.ts", "../src/diagrams/block/parser/block.jison", "../src/diagrams/block/blockDB.ts", "../src/diagrams/block/styles.ts", "../src/diagrams/block/layout.ts", "../src/diagrams/block/renderHelpers.ts", "../src/diagrams/block/blockRenderer.ts", "../src/diagrams/block/blockDiagram.ts", "../src/diagrams/architecture/architectureTypes.ts", "../src/diagrams/architecture/architectureDb.ts", "../src/diagrams/architecture/architectureParser.ts", "../src/diagrams/architecture/architectureStyles.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/layout-base/layout-base.js", "../../../node_modules/.pnpm/[email protected] /node_modules/cose-base/cose-base.js", "../../../node_modules/.pnpm/[email protected] [email protected] /node_modules/cytoscape-fcose/cytoscape-fcose.js", "../src/diagrams/architecture/architectureIcons.ts", "../src/diagrams/architecture/svgDraw.ts", "../src/diagrams/architecture/architectureRenderer.ts", "../src/diagrams/architecture/architectureDiagram.ts", "../src/mermaid.ts", "../src/diagrams/c4/c4Detector.ts", "../src/diagrams/flowchart/flowDetector.ts", "../src/diagrams/flowchart/flowDetector-v2.ts", "../src/diagrams/er/erDetector.ts", "../src/diagrams/git/gitGraphDetector.ts", "../src/diagrams/gantt/ganttDetector.ts", "../src/diagrams/info/infoDetector.ts", "../src/diagrams/pie/pieDetector.ts", "../src/diagrams/quadrant-chart/quadrantDetector.ts", "../src/diagrams/xychart/xychartDetector.ts", "../src/diagrams/requirement/requirementDetector.ts", "../src/diagrams/sequence/sequenceDetector.ts", "../src/diagrams/class/classDetector.ts", "../src/diagrams/class/classDetector-V2.ts", "../src/diagrams/state/stateDetector.ts", "../src/diagrams/state/stateDetector-V2.ts", "../src/diagrams/user-journey/journeyDetector.ts", "../src/diagrams/error/errorRenderer.ts", "../src/diagrams/error/errorDiagram.ts", "../src/diagrams/flowchart/elk/detector.ts", "../src/diagrams/timeline/detector.ts", "../src/diagrams/mindmap/detector.ts", "../src/diagrams/sankey/sankeyDetector.ts", "../src/diagrams/packet/detector.ts", "../src/diagrams/block/blockDetector.ts", "../src/diagrams/architecture/architectureDetector.ts", "../src/diagram-api/diagram-orchestration.ts", "../src/diagram-api/loadDiagram.ts", "../src/mermaidAPI.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/stylis/src/Enum.js", "../../../node_modules/.pnpm/[email protected] /node_modules/stylis/src/Utility.js", "../../../node_modules/.pnpm/[email protected] /node_modules/stylis/src/Tokenizer.js", "../../../node_modules/.pnpm/[email protected] /node_modules/stylis/src/Parser.js", "../../../node_modules/.pnpm/[email protected] /node_modules/stylis/src/Serializer.js", "../src/accessibility.ts", "../src/Diagram.ts", "../src/interactionDb.ts", "../src/diagram-api/comments.ts", "../src/diagram-api/frontmatter.ts", "../../../node_modules/.pnpm/[email protected] /node_modules/js-yaml/dist/js-yaml.mjs", "../src/preprocess.ts", "../src/utils/base64.ts"],
"sourcesContent": ["!function(t,e){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=e():\"function\"==typeof define&&define.amd?define(e):(t=\"undefined\"!=typeof globalThis?globalThis:t||self).dayjs=e()}(this,(function(){\"use strict\";var t=1e3,e=6e4,n=36e5,r=\"millisecond\",i=\"second\",s=\"minute\",u=\"hour\",a=\"day\",o=\"week\",c=\"month\",f=\"quarter\",h=\"year\",d=\"date\",l=\"Invalid Date\",$=/^(\\d{4})[-/]?(\\d{1,2})?[-/]?(\\d{0,2})[Tt\\s]*(\\d{1,2})?:?(\\d{1,2})?:?(\\d{1,2})?[.:]?(\\d+)?$/,y=/\\[([^\\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:\"en\",weekdays:\"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday\".split(\"_\"),months:\"January_February_March_April_May_June_July_August_September_October_November_December\".split(\"_\"),ordinal:function(t){var e=[\"th\",\"st\",\"nd\",\"rd\"],n=t%100;return\"[\"+t+(e[(n-20)%10]||e[n]||e[0])+\"]\"}},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:\"\"+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?\"+\":\"-\")+m(r,2,\"0\")+\":\"+m(i,2,\"0\")},m:function t(e,n){if(e.date()1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n=\"object\"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if(\"string\"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||\"0\").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return b},m.isValid=function(){return!(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t) = {\n trace: 0,\n debug: 1,\n info: 2,\n warn: 3,\n error: 4,\n fatal: 5,\n};\n\nexport const log: Record = {\n trace: (..._args: any[]) => {},\n debug: (..._args: any[]) => {},\n info: (..._args: any[]) => {},\n warn: (..._args: any[]) => {},\n error: (..._args: any[]) => {},\n fatal: (..._args: any[]) => {},\n};\n\n/**\n * Sets a log level\n *\n * @param level - The level to set the logging to. Default is `\"fatal\"`\n */\nexport const setLogLevel = function (level: keyof typeof LEVELS | number = 'fatal') {\n let numericLevel: number = LEVELS.fatal;\n if (typeof level === 'string') {\n if (level.toLowerCase() in LEVELS) {\n numericLevel = LEVELS[level];\n }\n } else if (typeof level === 'number') {\n numericLevel = level;\n }\n log.trace = () => {};\n log.debug = () => {};\n log.info = () => {};\n log.warn = () => {};\n log.error = () => {};\n log.fatal = () => {};\n\n if (numericLevel <= LEVELS.fatal) {\n log.fatal = console.error\n ? console.error.bind(console, format('FATAL'), 'color: orange')\n : console.log.bind(console, '\\x1b[35m', format('FATAL'));\n }\n if (numericLevel <= LEVELS.error) {\n log.error = console.error\n ? console.error.bind(console, format('ERROR'), 'color: orange')\n : console.log.bind(console, '\\x1b[31m', format('ERROR'));\n }\n if (numericLevel <= LEVELS.warn) {\n log.warn = console.warn\n ? console.warn.bind(console, format('WARN'), 'color: orange')\n : console.log.bind(console, `\\x1b[33m`, format('WARN'));\n }\n if (numericLevel <= LEVELS.info) {\n log.info = console.info\n ? console.info.bind(console, format('INFO'), 'color: lightblue')\n : console.log.bind(console, '\\x1b[34m', format('INFO'));\n }\n if (numericLevel <= LEVELS.debug) {\n log.debug = console.debug\n ? console.debug.bind(console, format('DEBUG'), 'color: lightgreen')\n : console.log.bind(console, '\\x1b[32m', format('DEBUG'));\n }\n if (numericLevel <= LEVELS.trace) {\n log.trace = console.debug\n ? console.debug.bind(console, format('TRACE'), 'color: lightgreen')\n : console.log.bind(console, '\\x1b[32m', format('TRACE'));\n }\n};\n\n/**\n * Returns a format with the timestamp and the log level\n *\n * @param level - The level for the log format\n * @returns The format with the timestamp and log level\n */\nconst format = (level: Uppercase): string => {\n const time = dayjs().format('ss.SSS');\n return `%c${time} : ${level} : `;\n};\n", "const defaultIconDimensions = Object.freeze(\n {\n left: 0,\n top: 0,\n width: 16,\n height: 16\n }\n);\nconst defaultIconTransformations = Object.freeze({\n rotate: 0,\n vFlip: false,\n hFlip: false\n});\nconst defaultIconProps = Object.freeze({\n ...defaultIconDimensions,\n ...defaultIconTransformations\n});\nconst defaultExtendedIconProps = Object.freeze({\n ...defaultIconProps,\n body: \"\",\n hidden: false\n});\n\nexport { defaultExtendedIconProps, defaultIconDimensions, defaultIconProps, defaultIconTransformations };\n", "import { defaultIconTransformations } from '../icon/defaults.mjs';\n\nconst defaultIconSizeCustomisations = Object.freeze({\n width: null,\n height: null\n});\nconst defaultIconCustomisations = Object.freeze({\n // Dimensions\n ...defaultIconSizeCustomisations,\n // Transformations\n ...defaultIconTransformations\n});\n\nexport { defaultIconCustomisations, defaultIconSizeCustomisations };\n", "const matchIconName = /^[a-z0-9]+(-[a-z0-9]+)*$/;\nconst stringToIcon = (value, validate, allowSimpleName, provider = \"\") => {\n const colonSeparated = value.split(\":\");\n if (value.slice(0, 1) === \"@\") {\n if (colonSeparated.length < 2 || colonSeparated.length > 3) {\n return null;\n }\n provider = colonSeparated.shift().slice(1);\n }\n if (colonSeparated.length > 3 || !colonSeparated.length) {\n return null;\n }\n if (colonSeparated.length > 1) {\n const name2 = colonSeparated.pop();\n const prefix = colonSeparated.pop();\n const result = {\n // Allow provider without '@': \"provider:prefix:name\"\n provider: colonSeparated.length > 0 ? colonSeparated[0] : provider,\n prefix,\n name: name2\n };\n return validate && !validateIconName(result) ? null : result;\n }\n const name = colonSeparated[0];\n const dashSeparated = name.split(\"-\");\n if (dashSeparated.length > 1) {\n const result = {\n provider,\n prefix: dashSeparated.shift(),\n name: dashSeparated.join(\"-\")\n };\n return validate && !validateIconName(result) ? null : result;\n }\n if (allowSimpleName && provider === \"\") {\n const result = {\n provider,\n prefix: \"\",\n name\n };\n return validate && !validateIconName(result, allowSimpleName) ? null : result;\n }\n return null;\n};\nconst validateIconName = (icon, allowSimpleName) => {\n if (!icon) {\n return false;\n }\n return !!((icon.provider === \"\" || icon.provider.match(matchIconName)) && (allowSimpleName && icon.prefix === \"\" || icon.prefix.match(matchIconName)) && icon.name.match(matchIconName));\n};\n\nexport { matchIconName, stringToIcon, validateIconName };\n", "function mergeIconTransformations(obj1, obj2) {\n const result = {};\n if (!obj1.hFlip !== !obj2.hFlip) {\n result.hFlip = true;\n }\n if (!obj1.vFlip !== !obj2.vFlip) {\n result.vFlip = true;\n }\n const rotate = ((obj1.rotate || 0) + (obj2.rotate || 0)) % 4;\n if (rotate) {\n result.rotate = rotate;\n }\n return result;\n}\n\nexport { mergeIconTransformations };\n", "import { defaultExtendedIconProps, defaultIconTransformations } from './defaults.mjs';\nimport { mergeIconTransformations } from './transformations.mjs';\n\nfunction mergeIconData(parent, child) {\n const result = mergeIconTransformations(parent, child);\n for (const key in defaultExtendedIconProps) {\n if (key in defaultIconTransformations) {\n if (key in parent && !(key in result)) {\n result[key] = defaultIconTransformations[key];\n }\n } else if (key in child) {\n result[key] = child[key];\n } else if (key in parent) {\n result[key] = parent[key];\n }\n }\n return result;\n}\n\nexport { mergeIconData };\n", "function getIconsTree(data, names) {\n const icons = data.icons;\n const aliases = data.aliases || /* @__PURE__ */ Object.create(null);\n const resolved = /* @__PURE__ */ Object.create(null);\n function resolve(name) {\n if (icons[name]) {\n return resolved[name] = [];\n }\n if (!(name in resolved)) {\n resolved[name] = null;\n const parent = aliases[name] && aliases[name].parent;\n const value = parent && resolve(parent);\n if (value) {\n resolved[name] = [parent].concat(value);\n }\n }\n return resolved[name];\n }\n (names || Object.keys(icons).concat(Object.keys(aliases))).forEach(resolve);\n return resolved;\n}\n\nexport { getIconsTree };\n", "import { mergeIconData } from '../icon/merge.mjs';\nimport { getIconsTree } from './tree.mjs';\nimport '../icon/defaults.mjs';\nimport '../icon/transformations.mjs';\n\nfunction internalGetIconData(data, name, tree) {\n const icons = data.icons;\n const aliases = data.aliases || /* @__PURE__ */ Object.create(null);\n let currentProps = {};\n function parse(name2) {\n currentProps = mergeIconData(\n icons[name2] || aliases[name2],\n currentProps\n );\n }\n parse(name);\n tree.forEach(parse);\n return mergeIconData(data, currentProps);\n}\nfunction getIconData(data, name) {\n if (data.icons[name]) {\n return internalGetIconData(data, name, []);\n }\n const tree = getIconsTree(data, [name])[name];\n return tree ? internalGetIconData(data, name, tree) : null;\n}\n\nexport { getIconData, internalGetIconData };\n", "const unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;\nconst unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;\nfunction calculateSize(size, ratio, precision) {\n if (ratio === 1) {\n return size;\n }\n precision = precision || 100;\n if (typeof size === \"number\") {\n return Math.ceil(size * ratio * precision) / precision;\n }\n if (typeof size !== \"string\") {\n return size;\n }\n const oldParts = size.split(unitsSplit);\n if (oldParts === null || !oldParts.length) {\n return size;\n }\n const newParts = [];\n let code = oldParts.shift();\n let isNumber = unitsTest.test(code);\n while (true) {\n if (isNumber) {\n const num = parseFloat(code);\n if (isNaN(num)) {\n newParts.push(code);\n } else {\n newParts.push(Math.ceil(num * ratio * precision) / precision);\n }\n } else {\n newParts.push(code);\n }\n code = oldParts.shift();\n if (code === void 0) {\n return newParts.join(\"\");\n }\n isNumber = !isNumber;\n }\n}\n\nexport { calculateSize };\n", "function splitSVGDefs(content, tag = \"defs\") {\n let defs = \"\";\n const index = content.indexOf(\"<\" + tag);\n while (index >= 0) {\n const start = content.indexOf(\">\", index);\n const end = content.indexOf(\"\" + tag);\n if (start === -1 || end === -1) {\n break;\n }\n const endEnd = content.indexOf(\">\", end);\n if (endEnd === -1) {\n break;\n }\n defs += content.slice(start + 1, end).trim();\n content = content.slice(0, index).trim() + content.slice(endEnd + 1);\n }\n return {\n defs,\n content\n };\n}\nfunction mergeDefsAndContent(defs, content) {\n return defs ? \"\" + defs + \" \" + content : content;\n}\nfunction wrapSVGContent(body, start, end) {\n const split = splitSVGDefs(body);\n return mergeDefsAndContent(split.defs, start + split.content + end);\n}\n\nexport { mergeDefsAndContent, splitSVGDefs, wrapSVGContent };\n", "import { defaultIconProps } from '../icon/defaults.mjs';\nimport { defaultIconCustomisations } from '../customisations/defaults.mjs';\nimport { calculateSize } from './size.mjs';\nimport { wrapSVGContent } from './defs.mjs';\n\nconst isUnsetKeyword = (value) => value === \"unset\" || value === \"undefined\" || value === \"none\";\nfunction iconToSVG(icon, customisations) {\n const fullIcon = {\n ...defaultIconProps,\n ...icon\n };\n const fullCustomisations = {\n ...defaultIconCustomisations,\n ...customisations\n };\n const box = {\n left: fullIcon.left,\n top: fullIcon.top,\n width: fullIcon.width,\n height: fullIcon.height\n };\n let body = fullIcon.body;\n [fullIcon, fullCustomisations].forEach((props) => {\n const transformations = [];\n const hFlip = props.hFlip;\n const vFlip = props.vFlip;\n let rotation = props.rotate;\n if (hFlip) {\n if (vFlip) {\n rotation += 2;\n } else {\n transformations.push(\n \"translate(\" + (box.width + box.left).toString() + \" \" + (0 - box.top).toString() + \")\"\n );\n transformations.push(\"scale(-1 1)\");\n box.top = box.left = 0;\n }\n } else if (vFlip) {\n transformations.push(\n \"translate(\" + (0 - box.left).toString() + \" \" + (box.height + box.top).toString() + \")\"\n );\n transformations.push(\"scale(1 -1)\");\n box.top = box.left = 0;\n }\n let tempValue;\n if (rotation < 0) {\n rotation -= Math.floor(rotation / 4) * 4;\n }\n rotation = rotation % 4;\n switch (rotation) {\n case 1:\n tempValue = box.height / 2 + box.top;\n transformations.unshift(\n \"rotate(90 \" + tempValue.toString() + \" \" + tempValue.toString() + \")\"\n );\n break;\n case 2:\n transformations.unshift(\n \"rotate(180 \" + (box.width / 2 + box.left).toString() + \" \" + (box.height / 2 + box.top).toString() + \")\"\n );\n break;\n case 3:\n tempValue = box.width / 2 + box.left;\n transformations.unshift(\n \"rotate(-90 \" + tempValue.toString() + \" \" + tempValue.toString() + \")\"\n );\n break;\n }\n if (rotation % 2 === 1) {\n if (box.left !== box.top) {\n tempValue = box.left;\n box.left = box.top;\n box.top = tempValue;\n }\n if (box.width !== box.height) {\n tempValue = box.width;\n box.width = box.height;\n box.height = tempValue;\n }\n }\n if (transformations.length) {\n body = wrapSVGContent(\n body,\n '',\n \" \"\n );\n }\n });\n const customisationsWidth = fullCustomisations.width;\n const customisationsHeight = fullCustomisations.height;\n const boxWidth = box.width;\n const boxHeight = box.height;\n let width;\n let height;\n if (customisationsWidth === null) {\n height = customisationsHeight === null ? \"1em\" : customisationsHeight === \"auto\" ? boxHeight : customisationsHeight;\n width = calculateSize(height, boxWidth / boxHeight);\n } else {\n width = customisationsWidth === \"auto\" ? boxWidth : customisationsWidth;\n height = customisationsHeight === null ? calculateSize(width, boxHeight / boxWidth) : customisationsHeight === \"auto\" ? boxHeight : customisationsHeight;\n }\n const attributes = {};\n const setAttr = (prop, value) => {\n if (!isUnsetKeyword(value)) {\n attributes[prop] = value.toString();\n }\n };\n setAttr(\"width\", width);\n setAttr(\"height\", height);\n const viewBox = [box.left, box.top, boxWidth, boxHeight];\n attributes.viewBox = viewBox.join(\" \");\n return {\n attributes,\n viewBox,\n body\n };\n}\n\nexport { iconToSVG, isUnsetKeyword };\n", "const regex = /\\sid=\"(\\S+)\"/g;\nconst randomPrefix = \"IconifyId\" + Date.now().toString(16) + (Math.random() * 16777216 | 0).toString(16);\nlet counter = 0;\nfunction replaceIDs(body, prefix = randomPrefix) {\n const ids = [];\n let match;\n while (match = regex.exec(body)) {\n ids.push(match[1]);\n }\n if (!ids.length) {\n return body;\n }\n const suffix = \"suffix\" + (Math.random() * 16777216 | Date.now()).toString(16);\n ids.forEach((id) => {\n const newID = typeof prefix === \"function\" ? prefix(id) : prefix + (counter++).toString();\n const escapedID = id.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n body = body.replace(\n // Allowed characters before id: [#;\"]\n // Allowed characters after id: [)\"], .[a-z]\n new RegExp('([#;\"])(' + escapedID + ')([\")]|\\\\.[a-z])', \"g\"),\n \"$1\" + newID + suffix + \"$3\"\n );\n });\n body = body.replace(new RegExp(suffix, \"g\"), \"\");\n return body;\n}\n\nexport { replaceIDs };\n", "function iconToHTML(body, attributes) {\n let renderAttribsHTML = body.indexOf(\"xlink:\") === -1 ? \"\" : ' xmlns:xlink=\"http://www.w3.org/1999/xlink\"';\n for (const attr in attributes) {\n renderAttribsHTML += \" \" + attr + '=\"' + attributes[attr] + '\"';\n }\n return '\" + body + \" \";\n}\n\nexport { iconToHTML };\n", "/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function(val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n", "\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = require('ms');\n\tcreateDebug.destroy = destroy;\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\t\tlet enableOverride = null;\n\t\tlet namespacesCache;\n\t\tlet enabledCache;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn '%';\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = createDebug.selectColor(namespace);\n\t\tdebug.extend = extend;\n\t\tdebug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.\n\n\t\tObject.defineProperty(debug, 'enabled', {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\tget: () => {\n\t\t\t\tif (enableOverride !== null) {\n\t\t\t\t\treturn enableOverride;\n\t\t\t\t}\n\t\t\t\tif (namespacesCache !== createDebug.namespaces) {\n\t\t\t\t\tnamespacesCache = createDebug.namespaces;\n\t\t\t\t\tenabledCache = createDebug.enabled(namespace);\n\t\t\t\t}\n\n\t\t\t\treturn enabledCache;\n\t\t\t},\n\t\t\tset: v => {\n\t\t\t\tenableOverride = v;\n\t\t\t}\n\t\t});\n\n\t\t// Env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\treturn debug;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\t\tcreateDebug.namespaces = namespaces;\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tlet i;\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n\t\tconst len = split.length;\n\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tif (!split[i]) {\n\t\t\t\t// ignore empty strings\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tnamespaces = split[i].replace(/\\*/g, '.*?');\n\n\t\t\tif (namespaces[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(new RegExp('^' + namespaces + '$'));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names.map(toNamespace),\n\t\t\t...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tif (name[name.length - 1] === '*') {\n\t\t\treturn true;\n\t\t}\n\n\t\tlet i;\n\t\tlet len;\n\n\t\tfor (i = 0, len = createDebug.skips.length; i < len; i++) {\n\t\t\tif (createDebug.skips[i].test(name)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 0, len = createDebug.names.length; i < len; i++) {\n\t\t\tif (createDebug.names[i].test(name)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Convert regexp to namespace\n\t*\n\t* @param {RegExp} regxep\n\t* @return {String} namespace\n\t* @api private\n\t*/\n\tfunction toNamespace(regexp) {\n\t\treturn regexp.toString()\n\t\t\t.substring(2, regexp.toString().length - 2)\n\t\t\t.replace(/\\.\\*\\?$/, '*');\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\t/**\n\t* XXX DO NOT USE. This is a temporary stub function.\n\t* XXX It WILL be removed in the next major release.\n\t*/\n\tfunction destroy() {\n\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n", "/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\nexports.destroy = (() => {\n\tlet warned = false;\n\n\treturn () => {\n\t\tif (!warned) {\n\t\t\twarned = true;\n\t\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t\t}\n\t};\n})();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\tlet m;\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/)) && parseInt(m[1], 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.debug()` when available.\n * No-op when `console.debug` is not a \"function\".\n * If `console.debug` is not available, falls back\n * to `console.log`.\n *\n * @api public\n */\nexports.log = console.debug || console.log || (() => {});\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug');\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n", "export { defaultIconCustomisations, defaultIconSizeCustomisations } from './customisations/defaults.mjs';\nexport { mergeCustomisations } from './customisations/merge.mjs';\nexport { toBoolean } from './customisations/bool.mjs';\nexport { flipFromString } from './customisations/flip.mjs';\nexport { rotateFromString } from './customisations/rotate.mjs';\nexport { matchIconName, stringToIcon, validateIconName } from './icon/name.mjs';\nexport { mergeIconData } from './icon/merge.mjs';\nexport { mergeIconTransformations } from './icon/transformations.mjs';\nexport { defaultExtendedIconProps, defaultIconDimensions, defaultIconProps, defaultIconTransformations } from './icon/defaults.mjs';\nexport { makeIconSquare } from './icon/square.mjs';\nexport { getIconsTree } from './icon-set/tree.mjs';\nexport { parseIconSet, parseIconSetAsync } from './icon-set/parse.mjs';\nexport { validateIconSet } from './icon-set/validate.mjs';\nexport { quicklyValidateIconSet } from './icon-set/validate-basic.mjs';\nexport { expandIconSet } from './icon-set/expand.mjs';\nexport { minifyIconSet } from './icon-set/minify.mjs';\nexport { getIcons } from './icon-set/get-icons.mjs';\nexport { getIconData } from './icon-set/get-icon.mjs';\nexport { convertIconSetInfo } from './icon-set/convert-info.mjs';\nexport { iconToSVG } from './svg/build.mjs';\nexport { mergeDefsAndContent, splitSVGDefs, wrapSVGContent } from './svg/defs.mjs';\nexport { replaceIDs } from './svg/id.mjs';\nexport { calculateSize } from './svg/size.mjs';\nexport { encodeSvgForCss } from './svg/encode-svg-for-css.mjs';\nexport { trimSVG } from './svg/trim.mjs';\nexport { prettifySVG } from './svg/pretty.mjs';\nexport { iconToHTML } from './svg/html.mjs';\nexport { svgToData, svgToURL } from './svg/url.mjs';\nexport { cleanUpInnerHTML } from './svg/inner-html.mjs';\nexport { getSVGViewBox } from './svg/viewbox.mjs';\nexport { buildParsedSVG, convertParsedSVG, parseSVGContent } from './svg/parse.mjs';\nexport { colorKeywords } from './colors/keywords.mjs';\nexport { colorToString, compareColors, stringToColor } from './colors/index.mjs';\nexport { getIconCSS, getIconContentCSS } from './css/icon.mjs';\nexport { getIconsCSS, getIconsContentCSS } from './css/icons.mjs';\nexport { mergeIconProps } from './loader/utils.mjs';\nexport { getCustomIcon } from './loader/custom.mjs';\nexport { searchForIcon } from './loader/modern.mjs';\nexport { loadIcon } from './loader/loader.mjs';\nexport { getEmojiSequenceFromString, getUnqualifiedEmojiSequence } from './emoji/cleanup.mjs';\nexport { convertEmojiSequenceToUTF16, convertEmojiSequenceToUTF32, getEmojiCodePoint, getEmojiUnicode, isUTF32SplitNumber, mergeUTF32Numbers, splitUTF32Number } from './emoji/convert.mjs';\nexport { getEmojiSequenceKeyword, getEmojiSequenceString, getEmojiUnicodeString } from './emoji/format.mjs';\nexport { parseEmojiTestFile } from './emoji/test/parse.mjs';\nexport { getQualifiedEmojiVariations } from './emoji/test/variations.mjs';\nexport { findMissingEmojis } from './emoji/test/missing.mjs';\nexport { createOptimisedRegex, createOptimisedRegexForEmojiSequences } from './emoji/regex/create.mjs';\nexport { prepareEmojiForIconSet, prepareEmojiForIconsList } from './emoji/parse.mjs';\nexport { findAndReplaceEmojisInText } from './emoji/replace/replace.mjs';\nexport { camelToKebab, camelize, pascalize, snakelize } from './misc/strings.mjs';\nexport { commonObjectProps, compareObjects, unmergeObjects } from './misc/objects.mjs';\nexport { sanitiseTitleAttribute } from './misc/title.mjs';\nimport './css/common.mjs';\nimport './css/format.mjs';\nimport 'debug';\nimport './emoji/data.mjs';\nimport './emoji/test/components.mjs';\nimport './emoji/regex/tree.mjs';\nimport './emoji/regex/base.mjs';\nimport './emoji/regex/numbers.mjs';\nimport './emoji/regex/similar.mjs';\nimport './emoji/test/similar.mjs';\nimport './emoji/test/name.mjs';\nimport './emoji/test/tree.mjs';\nimport './emoji/replace/find.mjs';\n", "import { log } from '$root/logger.js';\nimport type { ExtendedIconifyIcon, IconifyIcon, IconifyJSON } from '@iconify/types';\nimport type { IconifyIconCustomisations } from '@iconify/utils';\nimport { getIconData, iconToHTML, iconToSVG, replaceIDs, stringToIcon } from '@iconify/utils';\n\ninterface AsyncIconLoader {\n name: string;\n loader: () => Promise;\n}\n\ninterface SyncIconLoader {\n name: string;\n icons: IconifyJSON;\n}\n\nexport type IconLoader = AsyncIconLoader | SyncIconLoader;\n\nexport const unknownIcon: IconifyIcon = {\n body: '? ',\n height: 80,\n width: 80,\n};\n\nconst iconsStore = new Map();\nconst loaderStore = new Map();\n\nexport const registerIconPacks = (iconLoaders: IconLoader[]) => {\n for (const iconLoader of iconLoaders) {\n if (!iconLoader.name) {\n throw new Error(\n 'Invalid icon loader. Must have a \"name\" property with non-empty string value.'\n );\n }\n log.debug('Registering icon pack:', iconLoader.name);\n if ('loader' in iconLoader) {\n loaderStore.set(iconLoader.name, iconLoader.loader);\n } else if ('icons' in iconLoader) {\n iconsStore.set(iconLoader.name, iconLoader.icons);\n } else {\n log.error('Invalid icon loader:', iconLoader);\n throw new Error('Invalid icon loader. Must have either \"icons\" or \"loader\" property.');\n }\n }\n};\n\nconst getRegisteredIconData = async (iconName: string, fallbackPrefix?: string) => {\n const data = stringToIcon(iconName, true, fallbackPrefix !== undefined);\n if (!data) {\n throw new Error(`Invalid icon name: ${iconName}`);\n }\n const prefix = data.prefix || fallbackPrefix;\n if (!prefix) {\n throw new Error(`Icon name must contain a prefix: ${iconName}`);\n }\n let icons = iconsStore.get(prefix);\n if (!icons) {\n const loader = loaderStore.get(prefix);\n if (!loader) {\n throw new Error(`Icon set not found: ${data.prefix}`);\n }\n try {\n const loaded = await loader();\n icons = { ...loaded, prefix };\n iconsStore.set(prefix, icons);\n } catch (e) {\n log.error(e);\n throw new Error(`Failed to load icon set: ${data.prefix}`);\n }\n }\n const iconData = getIconData(icons, data.name);\n if (!iconData) {\n throw new Error(`Icon not found: ${iconName}`);\n }\n return iconData;\n};\n\nexport const isIconAvailable = async (iconName: string) => {\n try {\n await getRegisteredIconData(iconName);\n return true;\n } catch {\n return false;\n }\n};\n\nexport const getIconSVG = async (\n iconName: string,\n customisations?: IconifyIconCustomisations & { fallbackPrefix?: string }\n) => {\n let iconData: ExtendedIconifyIcon;\n try {\n iconData = await getRegisteredIconData(iconName, customisations?.fallbackPrefix);\n } catch (e) {\n log.error(e);\n iconData = unknownIcon;\n }\n const renderData = iconToSVG(iconData, customisations);\n const svg = iconToHTML(replaceIDs(renderData.body), renderData.attributes);\n return svg;\n};\n", "export function dedent(\n templ: TemplateStringsArray | string,\n ...values: unknown[]\n): string {\n let strings = Array.from(typeof templ === 'string' ? [templ] : templ);\n\n // 1. Remove trailing whitespace.\n strings[strings.length - 1] = strings[strings.length - 1].replace(\n /\\r?\\n([\\t ]*)$/,\n '',\n );\n\n // 2. Find all line breaks to determine the highest common indentation level.\n const indentLengths = strings.reduce((arr, str) => {\n const matches = str.match(/\\n([\\t ]+|(?!\\s).)/g);\n if (matches) {\n return arr.concat(\n matches.map((match) => match.match(/[\\t ]/g)?.length ?? 0),\n );\n }\n return arr;\n }, []);\n\n // 3. Remove the common indentation from all strings.\n if (indentLengths.length) {\n const pattern = new RegExp(`\\n[\\t ]{${Math.min(...indentLengths)}}`, 'g');\n\n strings = strings.map((str) => str.replace(pattern, '\\n'));\n }\n\n // 4. Remove leading whitespace.\n strings[0] = strings[0].replace(/^\\r?\\n/, '');\n\n // 5. Perform interpolation.\n let string = strings[0];\n\n values.forEach((value, i) => {\n // 5.1 Read current indentation level\n const endentations = string.match(/(?:^|\\n)( *)$/)\n const endentation = endentations ? endentations[1] : ''\n let indentedValue = value\n // 5.2 Add indentation to values with multiline strings\n if (typeof value === 'string' && value.includes('\\n')) {\n indentedValue = String(value)\n .split('\\n')\n .map((str, i) => {\n return i === 0 ? str : `${endentation}${str}`\n })\n .join('\\n');\n }\n\n string += indentedValue + strings[i + 1];\n });\n\n return string;\n}\n\nexport default dedent;\n", "// Match Jekyll-style front matter blocks (https://jekyllrb.com/docs/front-matter/).\n// Based on regex used by Jekyll: https://github.com/jekyll/jekyll/blob/6dd3cc21c40b98054851846425af06c64f9fb466/lib/jekyll/document.rb#L10\n// Note that JS doesn't support the \"\\A\" anchor, which means we can't use\n// multiline mode.\n// Relevant YAML spec: https://yaml.org/spec/1.2.2/#914-explicit-documents\nexport const frontMatterRegex = /^-{3}\\s*[\\n\\r](.*?)[\\n\\r]-{3}\\s*[\\n\\r]+/s;\n\nexport const directiveRegex =\n /%{2}{\\s*(?:(\\w+)\\s*:|(\\w+))\\s*(?:(\\w+)|((?:(?!}%{2}).|\\r?\\n)*))?\\s*(?:}%{2})?/gi;\n\nexport const anyCommentRegex = /\\s*%%.*\\n/gm;\n", "export class UnknownDiagramError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'UnknownDiagramError';\n }\n}\n", "import type { MermaidConfig } from '../config.type.js';\nimport { log } from '../logger.js';\nimport type {\n DetectorRecord,\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from './types.js';\nimport { anyCommentRegex, directiveRegex, frontMatterRegex } from './regexes.js';\nimport { UnknownDiagramError } from '../errors.js';\n\nexport const detectors: Record = {};\n\n/**\n * Detects the type of the graph text.\n *\n * Takes into consideration the possible existence of an `%%init` directive\n *\n * @param text - The text defining the graph. For example:\n *\n * ```mermaid\n * %%{initialize: {\"startOnLoad\": true, logLevel: \"fatal\" }}%%\n * graph LR\n * a-->b\n * b-->c\n * c-->d\n * d-->e\n * e-->f\n * f-->g\n * g-->h\n * ```\n *\n * @param config - The mermaid config.\n * @returns A graph definition key\n */\nexport const detectType = function (text: string, config?: MermaidConfig): string {\n text = text\n .replace(frontMatterRegex, '')\n .replace(directiveRegex, '')\n .replace(anyCommentRegex, '\\n');\n for (const [key, { detector }] of Object.entries(detectors)) {\n const diagram = detector(text, config);\n if (diagram) {\n return key;\n }\n }\n\n throw new UnknownDiagramError(\n `No diagram type detected matching given configuration for text: ${text}`\n );\n};\n\n/**\n * Registers lazy-loaded diagrams to Mermaid.\n *\n * The diagram function is loaded asynchronously, so that diagrams are only loaded\n * if the diagram is detected.\n *\n * @remarks\n * Please note that the order of diagram detectors is important.\n * The first detector to return `true` is the diagram that will be loaded\n * and used, so put more specific detectors at the beginning!\n *\n * @param diagrams - Diagrams to lazy load, and their detectors, in order of importance.\n */\nexport const registerLazyLoadedDiagrams = (...diagrams: ExternalDiagramDefinition[]) => {\n for (const { id, detector, loader } of diagrams) {\n addDetector(id, detector, loader);\n }\n};\n\nexport const addDetector = (key: string, detector: DiagramDetector, loader?: DiagramLoader) => {\n if (detectors[key]) {\n log.warn(`Detector with key ${key} already exists. Overwriting.`);\n }\n detectors[key] = { detector, loader };\n log.debug(`Detector with key ${key} added${loader ? ' with loader' : ''}`);\n};\n\nexport const getDiagramLoader = (key: string) => {\n return detectors[key].loader;\n};\n", "/* parser generated by jison 0.4.18 */\n/*\n Returns a Parser object of the following structure:\n\n Parser: {\n yy: {}\n }\n\n Parser.prototype: {\n yy: {},\n trace: function(),\n symbols_: {associative list: name ==> number},\n terminals_: {associative list: number ==> name},\n productions_: [...],\n performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),\n table: [...],\n defaultActions: {...},\n parseError: function(str, hash),\n parse: function(input),\n\n lexer: {\n EOF: 1,\n parseError: function(str, hash),\n setInput: function(input),\n input: function(),\n unput: function(str),\n more: function(),\n less: function(n),\n pastInput: function(),\n upcomingInput: function(),\n showPosition: function(),\n test_match: function(regex_match_array, rule_index),\n next: function(),\n lex: function(),\n begin: function(condition),\n popState: function(),\n _currentRules: function(),\n topState: function(),\n pushState: function(condition),\n\n options: {\n ranges: boolean (optional: true ==> token location info will include a .range[] member)\n flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)\n backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)\n },\n\n performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),\n rules: [...],\n conditions: {associative list: name ==> set},\n }\n }\n\n\n token location info (@$, _$, etc.): {\n first_line: n,\n last_line: n,\n first_column: n,\n last_column: n,\n range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)\n }\n\n\n the parseError function receives a 'hash' object with these members for lexer and parser errors: {\n text: (matched text)\n token: (the produced terminal token, if any)\n line: (yylineno)\n }\n while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {\n loc: (yylloc)\n expected: (string describing the set of expected tokens)\n recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)\n }\n*/\nvar parser = (function(){\nvar o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,24],$V1=[1,25],$V2=[1,26],$V3=[1,27],$V4=[1,28],$V5=[1,63],$V6=[1,64],$V7=[1,65],$V8=[1,66],$V9=[1,67],$Va=[1,68],$Vb=[1,69],$Vc=[1,29],$Vd=[1,30],$Ve=[1,31],$Vf=[1,32],$Vg=[1,33],$Vh=[1,34],$Vi=[1,35],$Vj=[1,36],$Vk=[1,37],$Vl=[1,38],$Vm=[1,39],$Vn=[1,40],$Vo=[1,41],$Vp=[1,42],$Vq=[1,43],$Vr=[1,44],$Vs=[1,45],$Vt=[1,46],$Vu=[1,47],$Vv=[1,48],$Vw=[1,50],$Vx=[1,51],$Vy=[1,52],$Vz=[1,53],$VA=[1,54],$VB=[1,55],$VC=[1,56],$VD=[1,57],$VE=[1,58],$VF=[1,59],$VG=[1,60],$VH=[14,42],$VI=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],$VJ=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],$VK=[1,82],$VL=[1,83],$VM=[1,84],$VN=[1,85],$VO=[12,14,42],$VP=[12,14,33,42],$VQ=[12,14,33,42,76,77,79,80],$VR=[12,33],$VS=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74];\nvar parser = {trace: function trace () { },\nyy: {},\nsymbols_: {\"error\":2,\"start\":3,\"mermaidDoc\":4,\"direction\":5,\"direction_tb\":6,\"direction_bt\":7,\"direction_rl\":8,\"direction_lr\":9,\"graphConfig\":10,\"C4_CONTEXT\":11,\"NEWLINE\":12,\"statements\":13,\"EOF\":14,\"C4_CONTAINER\":15,\"C4_COMPONENT\":16,\"C4_DYNAMIC\":17,\"C4_DEPLOYMENT\":18,\"otherStatements\":19,\"diagramStatements\":20,\"otherStatement\":21,\"title\":22,\"accDescription\":23,\"acc_title\":24,\"acc_title_value\":25,\"acc_descr\":26,\"acc_descr_value\":27,\"acc_descr_multiline_value\":28,\"boundaryStatement\":29,\"boundaryStartStatement\":30,\"boundaryStopStatement\":31,\"boundaryStart\":32,\"LBRACE\":33,\"ENTERPRISE_BOUNDARY\":34,\"attributes\":35,\"SYSTEM_BOUNDARY\":36,\"BOUNDARY\":37,\"CONTAINER_BOUNDARY\":38,\"NODE\":39,\"NODE_L\":40,\"NODE_R\":41,\"RBRACE\":42,\"diagramStatement\":43,\"PERSON\":44,\"PERSON_EXT\":45,\"SYSTEM\":46,\"SYSTEM_DB\":47,\"SYSTEM_QUEUE\":48,\"SYSTEM_EXT\":49,\"SYSTEM_EXT_DB\":50,\"SYSTEM_EXT_QUEUE\":51,\"CONTAINER\":52,\"CONTAINER_DB\":53,\"CONTAINER_QUEUE\":54,\"CONTAINER_EXT\":55,\"CONTAINER_EXT_DB\":56,\"CONTAINER_EXT_QUEUE\":57,\"COMPONENT\":58,\"COMPONENT_DB\":59,\"COMPONENT_QUEUE\":60,\"COMPONENT_EXT\":61,\"COMPONENT_EXT_DB\":62,\"COMPONENT_EXT_QUEUE\":63,\"REL\":64,\"BIREL\":65,\"REL_U\":66,\"REL_D\":67,\"REL_L\":68,\"REL_R\":69,\"REL_B\":70,\"REL_INDEX\":71,\"UPDATE_EL_STYLE\":72,\"UPDATE_REL_STYLE\":73,\"UPDATE_LAYOUT_CONFIG\":74,\"attribute\":75,\"STR\":76,\"STR_KEY\":77,\"STR_VALUE\":78,\"ATTRIBUTE\":79,\"ATTRIBUTE_EMPTY\":80,\"$accept\":0,\"$end\":1},\nterminals_: {2:\"error\",6:\"direction_tb\",7:\"direction_bt\",8:\"direction_rl\",9:\"direction_lr\",11:\"C4_CONTEXT\",12:\"NEWLINE\",14:\"EOF\",15:\"C4_CONTAINER\",16:\"C4_COMPONENT\",17:\"C4_DYNAMIC\",18:\"C4_DEPLOYMENT\",22:\"title\",23:\"accDescription\",24:\"acc_title\",25:\"acc_title_value\",26:\"acc_descr\",27:\"acc_descr_value\",28:\"acc_descr_multiline_value\",33:\"LBRACE\",34:\"ENTERPRISE_BOUNDARY\",36:\"SYSTEM_BOUNDARY\",37:\"BOUNDARY\",38:\"CONTAINER_BOUNDARY\",39:\"NODE\",40:\"NODE_L\",41:\"NODE_R\",42:\"RBRACE\",44:\"PERSON\",45:\"PERSON_EXT\",46:\"SYSTEM\",47:\"SYSTEM_DB\",48:\"SYSTEM_QUEUE\",49:\"SYSTEM_EXT\",50:\"SYSTEM_EXT_DB\",51:\"SYSTEM_EXT_QUEUE\",52:\"CONTAINER\",53:\"CONTAINER_DB\",54:\"CONTAINER_QUEUE\",55:\"CONTAINER_EXT\",56:\"CONTAINER_EXT_DB\",57:\"CONTAINER_EXT_QUEUE\",58:\"COMPONENT\",59:\"COMPONENT_DB\",60:\"COMPONENT_QUEUE\",61:\"COMPONENT_EXT\",62:\"COMPONENT_EXT_DB\",63:\"COMPONENT_EXT_QUEUE\",64:\"REL\",65:\"BIREL\",66:\"REL_U\",67:\"REL_D\",68:\"REL_L\",69:\"REL_R\",70:\"REL_B\",71:\"REL_INDEX\",72:\"UPDATE_EL_STYLE\",73:\"UPDATE_REL_STYLE\",74:\"UPDATE_LAYOUT_CONFIG\",76:\"STR\",77:\"STR_KEY\",78:\"STR_VALUE\",79:\"ATTRIBUTE\",80:\"ATTRIBUTE_EMPTY\"},\nproductions_: [0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],\nperformAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {\n/* this == yyval */\n\nvar $0 = $$.length - 1;\nswitch (yystate) {\ncase 3:\n yy.setDirection('TB');\nbreak;\ncase 4:\n yy.setDirection('BT');\nbreak;\ncase 5:\n yy.setDirection('RL');\nbreak;\ncase 6:\n yy.setDirection('LR');\nbreak;\ncase 8: case 9: case 10: case 11: case 12:\nyy.setC4Type($$[$0-3])\nbreak;\ncase 19:\nyy.setTitle($$[$0].substring(6));this.$=$$[$0].substring(6);\nbreak;\ncase 20:\nyy.setAccDescription($$[$0].substring(15));this.$=$$[$0].substring(15);\nbreak;\ncase 21:\n this.$=$$[$0].trim();yy.setTitle(this.$); \nbreak;\ncase 22: case 23:\n this.$=$$[$0].trim();yy.setAccDescription(this.$); \nbreak;\ncase 28:\n$$[$0].splice(2, 0, 'ENTERPRISE'); yy.addPersonOrSystemBoundary(...$$[$0]); this.$=$$[$0];\nbreak;\ncase 29:\n$$[$0].splice(2, 0, 'SYSTEM'); yy.addPersonOrSystemBoundary(...$$[$0]); this.$=$$[$0];\nbreak;\ncase 30:\nyy.addPersonOrSystemBoundary(...$$[$0]); this.$=$$[$0];\nbreak;\ncase 31:\n$$[$0].splice(2, 0, 'CONTAINER'); yy.addContainerBoundary(...$$[$0]); this.$=$$[$0];\nbreak;\ncase 32:\nyy.addDeploymentNode('node', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 33:\nyy.addDeploymentNode('nodeL', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 34:\nyy.addDeploymentNode('nodeR', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 35:\n yy.popBoundaryParseStack() \nbreak;\ncase 39:\nyy.addPersonOrSystem('person', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 40:\nyy.addPersonOrSystem('external_person', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 41:\nyy.addPersonOrSystem('system', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 42:\nyy.addPersonOrSystem('system_db', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 43:\nyy.addPersonOrSystem('system_queue', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 44:\nyy.addPersonOrSystem('external_system', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 45:\nyy.addPersonOrSystem('external_system_db', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 46:\nyy.addPersonOrSystem('external_system_queue', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 47:\nyy.addContainer('container', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 48:\nyy.addContainer('container_db', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 49:\nyy.addContainer('container_queue', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 50:\nyy.addContainer('external_container', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 51:\nyy.addContainer('external_container_db', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 52:\nyy.addContainer('external_container_queue', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 53:\nyy.addComponent('component', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 54:\nyy.addComponent('component_db', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 55:\nyy.addComponent('component_queue', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 56:\nyy.addComponent('external_component', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 57:\nyy.addComponent('external_component_db', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 58:\nyy.addComponent('external_component_queue', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 60:\nyy.addRel('rel', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 61:\nyy.addRel('birel', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 62:\nyy.addRel('rel_u', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 63:\nyy.addRel('rel_d', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 64:\nyy.addRel('rel_l', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 65:\nyy.addRel('rel_r', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 66:\nyy.addRel('rel_b', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 67:\n$$[$0].splice(0, 1); yy.addRel('rel', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 68:\nyy.updateElStyle('update_el_style', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 69:\nyy.updateRelStyle('update_rel_style', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 70:\nyy.updateLayoutConfig('update_layout_config', ...$$[$0]); this.$=$$[$0];\nbreak;\ncase 71:\n this.$ = [$$[$0]]; \nbreak;\ncase 72:\n $$[$0].unshift($$[$0-1]); this.$=$$[$0];\nbreak;\ncase 73: case 75:\n this.$ = $$[$0].trim(); \nbreak;\ncase 74:\n let kv={}; kv[$$[$0-1].trim()]=$$[$0].trim(); this.$=kv; \nbreak;\ncase 76:\n this.$ = \"\"; \nbreak;\n}\n},\ntable: [{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:$V0,23:$V1,24:$V2,26:$V3,28:$V4,29:49,30:61,32:62,34:$V5,36:$V6,37:$V7,38:$V8,39:$V9,40:$Va,41:$Vb,43:23,44:$Vc,45:$Vd,46:$Ve,47:$Vf,48:$Vg,49:$Vh,50:$Vi,51:$Vj,52:$Vk,53:$Vl,54:$Vm,55:$Vn,56:$Vo,57:$Vp,58:$Vq,59:$Vr,60:$Vs,61:$Vt,62:$Vu,63:$Vv,64:$Vw,65:$Vx,66:$Vy,67:$Vz,68:$VA,69:$VB,70:$VC,71:$VD,72:$VE,73:$VF,74:$VG},{13:70,19:20,20:21,21:22,22:$V0,23:$V1,24:$V2,26:$V3,28:$V4,29:49,30:61,32:62,34:$V5,36:$V6,37:$V7,38:$V8,39:$V9,40:$Va,41:$Vb,43:23,44:$Vc,45:$Vd,46:$Ve,47:$Vf,48:$Vg,49:$Vh,50:$Vi,51:$Vj,52:$Vk,53:$Vl,54:$Vm,55:$Vn,56:$Vo,57:$Vp,58:$Vq,59:$Vr,60:$Vs,61:$Vt,62:$Vu,63:$Vv,64:$Vw,65:$Vx,66:$Vy,67:$Vz,68:$VA,69:$VB,70:$VC,71:$VD,72:$VE,73:$VF,74:$VG},{13:71,19:20,20:21,21:22,22:$V0,23:$V1,24:$V2,26:$V3,28:$V4,29:49,30:61,32:62,34:$V5,36:$V6,37:$V7,38:$V8,39:$V9,40:$Va,41:$Vb,43:23,44:$Vc,45:$Vd,46:$Ve,47:$Vf,48:$Vg,49:$Vh,50:$Vi,51:$Vj,52:$Vk,53:$Vl,54:$Vm,55:$Vn,56:$Vo,57:$Vp,58:$Vq,59:$Vr,60:$Vs,61:$Vt,62:$Vu,63:$Vv,64:$Vw,65:$Vx,66:$Vy,67:$Vz,68:$VA,69:$VB,70:$VC,71:$VD,72:$VE,73:$VF,74:$VG},{13:72,19:20,20:21,21:22,22:$V0,23:$V1,24:$V2,26:$V3,28:$V4,29:49,30:61,32:62,34:$V5,36:$V6,37:$V7,38:$V8,39:$V9,40:$Va,41:$Vb,43:23,44:$Vc,45:$Vd,46:$Ve,47:$Vf,48:$Vg,49:$Vh,50:$Vi,51:$Vj,52:$Vk,53:$Vl,54:$Vm,55:$Vn,56:$Vo,57:$Vp,58:$Vq,59:$Vr,60:$Vs,61:$Vt,62:$Vu,63:$Vv,64:$Vw,65:$Vx,66:$Vy,67:$Vz,68:$VA,69:$VB,70:$VC,71:$VD,72:$VE,73:$VF,74:$VG},{13:73,19:20,20:21,21:22,22:$V0,23:$V1,24:$V2,26:$V3,28:$V4,29:49,30:61,32:62,34:$V5,36:$V6,37:$V7,38:$V8,39:$V9,40:$Va,41:$Vb,43:23,44:$Vc,45:$Vd,46:$Ve,47:$Vf,48:$Vg,49:$Vh,50:$Vi,51:$Vj,52:$Vk,53:$Vl,54:$Vm,55:$Vn,56:$Vo,57:$Vp,58:$Vq,59:$Vr,60:$Vs,61:$Vt,62:$Vu,63:$Vv,64:$Vw,65:$Vx,66:$Vy,67:$Vz,68:$VA,69:$VB,70:$VC,71:$VD,72:$VE,73:$VF,74:$VG},{14:[1,74]},o($VH,[2,13],{43:23,29:49,30:61,32:62,20:75,34:$V5,36:$V6,37:$V7,38:$V8,39:$V9,40:$Va,41:$Vb,44:$Vc,45:$Vd,46:$Ve,47:$Vf,48:$Vg,49:$Vh,50:$Vi,51:$Vj,52:$Vk,53:$Vl,54:$Vm,55:$Vn,56:$Vo,57:$Vp,58:$Vq,59:$Vr,60:$Vs,61:$Vt,62:$Vu,63:$Vv,64:$Vw,65:$Vx,66:$Vy,67:$Vz,68:$VA,69:$VB,70:$VC,71:$VD,72:$VE,73:$VF,74:$VG}),o($VH,[2,14]),o($VI,[2,16],{12:[1,76]}),o($VH,[2,36],{12:[1,77]}),o($VJ,[2,19]),o($VJ,[2,20]),{25:[1,78]},{27:[1,79]},o($VJ,[2,23]),{35:80,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:86,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:87,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:88,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:89,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:90,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:91,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:92,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:93,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:94,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:95,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:96,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:97,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:98,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:99,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:100,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:101,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:102,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:103,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:104,75:81,76:$VK,77:$VL,79:$VM,80:$VN},o($VO,[2,59]),{35:105,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:106,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:107,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:108,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:109,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:110,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:111,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:112,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:113,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:114,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:115,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{20:116,29:49,30:61,32:62,34:$V5,36:$V6,37:$V7,38:$V8,39:$V9,40:$Va,41:$Vb,43:23,44:$Vc,45:$Vd,46:$Ve,47:$Vf,48:$Vg,49:$Vh,50:$Vi,51:$Vj,52:$Vk,53:$Vl,54:$Vm,55:$Vn,56:$Vo,57:$Vp,58:$Vq,59:$Vr,60:$Vs,61:$Vt,62:$Vu,63:$Vv,64:$Vw,65:$Vx,66:$Vy,67:$Vz,68:$VA,69:$VB,70:$VC,71:$VD,72:$VE,73:$VF,74:$VG},{12:[1,118],33:[1,117]},{35:119,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:120,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:121,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:122,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:123,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:124,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{35:125,75:81,76:$VK,77:$VL,79:$VM,80:$VN},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},o($VH,[2,15]),o($VI,[2,17],{21:22,19:130,22:$V0,23:$V1,24:$V2,26:$V3,28:$V4}),o($VH,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:$V0,23:$V1,24:$V2,26:$V3,28:$V4,34:$V5,36:$V6,37:$V7,38:$V8,39:$V9,40:$Va,41:$Vb,44:$Vc,45:$Vd,46:$Ve,47:$Vf,48:$Vg,49:$Vh,50:$Vi,51:$Vj,52:$Vk,53:$Vl,54:$Vm,55:$Vn,56:$Vo,57:$Vp,58:$Vq,59:$Vr,60:$Vs,61:$Vt,62:$Vu,63:$Vv,64:$Vw,65:$Vx,66:$Vy,67:$Vz,68:$VA,69:$VB,70:$VC,71:$VD,72:$VE,73:$VF,74:$VG}),o($VJ,[2,21]),o($VJ,[2,22]),o($VO,[2,39]),o($VP,[2,71],{75:81,35:132,76:$VK,77:$VL,79:$VM,80:$VN}),o($VQ,[2,73]),{78:[1,133]},o($VQ,[2,75]),o($VQ,[2,76]),o($VO,[2,40]),o($VO,[2,41]),o($VO,[2,42]),o($VO,[2,43]),o($VO,[2,44]),o($VO,[2,45]),o($VO,[2,46]),o($VO,[2,47]),o($VO,[2,48]),o($VO,[2,49]),o($VO,[2,50]),o($VO,[2,51]),o($VO,[2,52]),o($VO,[2,53]),o($VO,[2,54]),o($VO,[2,55]),o($VO,[2,56]),o($VO,[2,57]),o($VO,[2,58]),o($VO,[2,60]),o($VO,[2,61]),o($VO,[2,62]),o($VO,[2,63]),o($VO,[2,64]),o($VO,[2,65]),o($VO,[2,66]),o($VO,[2,67]),o($VO,[2,68]),o($VO,[2,69]),o($VO,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},o($VR,[2,28]),o($VR,[2,29]),o($VR,[2,30]),o($VR,[2,31]),o($VR,[2,32]),o($VR,[2,33]),o($VR,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},o($VI,[2,18]),o($VH,[2,38]),o($VP,[2,72]),o($VQ,[2,74]),o($VO,[2,24]),o($VO,[2,35]),o($VS,[2,25]),o($VS,[2,26],{12:[1,138]}),o($VS,[2,27])],\ndefaultActions: {2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},\nparseError: function parseError (str, hash) {\n if (hash.recoverable) {\n this.trace(str);\n } else {\n var error = new Error(str);\n error.hash = hash;\n throw error;\n }\n},\nparse: function parse(input) {\n var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;\n var args = lstack.slice.call(arguments, 1);\n var lexer = Object.create(this.lexer);\n var sharedState = { yy: {} };\n for (var k in this.yy) {\n if (Object.prototype.hasOwnProperty.call(this.yy, k)) {\n sharedState.yy[k] = this.yy[k];\n }\n }\n lexer.setInput(input, sharedState.yy);\n sharedState.yy.lexer = lexer;\n sharedState.yy.parser = this;\n if (typeof lexer.yylloc == 'undefined') {\n lexer.yylloc = {};\n }\n var yyloc = lexer.yylloc;\n lstack.push(yyloc);\n var ranges = lexer.options && lexer.options.ranges;\n if (typeof sharedState.yy.parseError === 'function') {\n this.parseError = sharedState.yy.parseError;\n } else {\n this.parseError = Object.getPrototypeOf(this).parseError;\n }\n function popStack(n) {\n stack.length = stack.length - 2 * n;\n vstack.length = vstack.length - n;\n lstack.length = lstack.length - n;\n }\n function lex() {\n var token;\n token = tstack.pop() || lexer.lex() || EOF;\n if (typeof token !== 'number') {\n if (token instanceof Array) {\n tstack = token;\n token = tstack.pop();\n }\n token = self.symbols_[token] || token;\n }\n return token;\n }\n var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;\n while (true) {\n state = stack[stack.length - 1];\n if (this.defaultActions[state]) {\n action = this.defaultActions[state];\n } else {\n if (symbol === null || typeof symbol == 'undefined') {\n symbol = lex();\n }\n action = table[state] && table[state][symbol];\n }\n if (typeof action === 'undefined' || !action.length || !action[0]) {\n var errStr = '';\n expected = [];\n for (p in table[state]) {\n if (this.terminals_[p] && p > TERROR) {\n expected.push('\\'' + this.terminals_[p] + '\\'');\n }\n }\n if (lexer.showPosition) {\n errStr = 'Parse error on line ' + (yylineno + 1) + ':\\n' + lexer.showPosition() + '\\nExpecting ' + expected.join(', ') + ', got \\'' + (this.terminals_[symbol] || symbol) + '\\'';\n } else {\n errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\\'' + (this.terminals_[symbol] || symbol) + '\\'');\n }\n this.parseError(errStr, {\n text: lexer.match,\n token: this.terminals_[symbol] || symbol,\n line: lexer.yylineno,\n loc: yyloc,\n expected: expected\n });\n }\n if (action[0] instanceof Array && action.length > 1) {\n throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);\n }\n switch (action[0]) {\n case 1:\n stack.push(symbol);\n vstack.push(lexer.yytext);\n lstack.push(lexer.yylloc);\n stack.push(action[1]);\n symbol = null;\n if (!preErrorSymbol) {\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n if (recovering > 0) {\n recovering--;\n }\n } else {\n symbol = preErrorSymbol;\n preErrorSymbol = null;\n }\n break;\n case 2:\n len = this.productions_[action[1]][1];\n yyval.$ = vstack[vstack.length - len];\n yyval._$ = {\n first_line: lstack[lstack.length - (len || 1)].first_line,\n last_line: lstack[lstack.length - 1].last_line,\n first_column: lstack[lstack.length - (len || 1)].first_column,\n last_column: lstack[lstack.length - 1].last_column\n };\n if (ranges) {\n yyval._$.range = [\n lstack[lstack.length - (len || 1)].range[0],\n lstack[lstack.length - 1].range[1]\n ];\n }\n r = this.performAction.apply(yyval, [\n yytext,\n yyleng,\n yylineno,\n sharedState.yy,\n action[1],\n vstack,\n lstack\n ].concat(args));\n if (typeof r !== 'undefined') {\n return r;\n }\n if (len) {\n stack = stack.slice(0, -1 * len * 2);\n vstack = vstack.slice(0, -1 * len);\n lstack = lstack.slice(0, -1 * len);\n }\n stack.push(this.productions_[action[1]][0]);\n vstack.push(yyval.$);\n lstack.push(yyval._$);\n newState = table[stack[stack.length - 2]][stack[stack.length - 1]];\n stack.push(newState);\n break;\n case 3:\n return true;\n }\n }\n return true;\n}};\n/* generated by jison-lex 0.3.4 */\nvar lexer = (function(){\nvar lexer = ({\n\nEOF:1,\n\nparseError:function parseError(str, hash) {\n if (this.yy.parser) {\n this.yy.parser.parseError(str, hash);\n } else {\n throw new Error(str);\n }\n },\n\n// resets the lexer, sets new input\nsetInput:function (input, yy) {\n this.yy = yy || this.yy || {};\n this._input = input;\n this._more = this._backtrack = this.done = false;\n this.yylineno = this.yyleng = 0;\n this.yytext = this.matched = this.match = '';\n this.conditionStack = ['INITIAL'];\n this.yylloc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0\n };\n if (this.options.ranges) {\n this.yylloc.range = [0,0];\n }\n this.offset = 0;\n return this;\n },\n\n// consumes and returns one char from the input\ninput:function () {\n var ch = this._input[0];\n this.yytext += ch;\n this.yyleng++;\n this.offset++;\n this.match += ch;\n this.matched += ch;\n var lines = ch.match(/(?:\\r\\n?|\\n).*/g);\n if (lines) {\n this.yylineno++;\n this.yylloc.last_line++;\n } else {\n this.yylloc.last_column++;\n }\n if (this.options.ranges) {\n this.yylloc.range[1]++;\n }\n\n this._input = this._input.slice(1);\n return ch;\n },\n\n// unshifts one char (or a string) into the input\nunput:function (ch) {\n var len = ch.length;\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\n\n this._input = ch + this._input;\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\n //this.yyleng -= len;\n this.offset -= len;\n var oldLines = this.match.split(/(?:\\r\\n?|\\n)/g);\n this.match = this.match.substr(0, this.match.length - 1);\n this.matched = this.matched.substr(0, this.matched.length - 1);\n\n if (lines.length - 1) {\n this.yylineno -= lines.length - 1;\n }\n var r = this.yylloc.range;\n\n this.yylloc = {\n first_line: this.yylloc.first_line,\n last_line: this.yylineno + 1,\n first_column: this.yylloc.first_column,\n last_column: lines ?\n (lines.length === oldLines.length ? this.yylloc.first_column : 0)\n + oldLines[oldLines.length - lines.length].length - lines[0].length :\n this.yylloc.first_column - len\n };\n\n if (this.options.ranges) {\n this.yylloc.range = [r[0], r[0] + this.yyleng - len];\n }\n this.yyleng = this.yytext.length;\n return this;\n },\n\n// When called from action, caches matched text and appends it on next action\nmore:function () {\n this._more = true;\n return this;\n },\n\n// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.\nreject:function () {\n if (this.options.backtrack_lexer) {\n this._backtrack = true;\n } else {\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n' + this.showPosition(), {\n text: \"\",\n token: null,\n line: this.yylineno\n });\n\n }\n return this;\n },\n\n// retain first n characters of the match\nless:function (n) {\n this.unput(this.match.slice(n));\n },\n\n// displays already matched input, i.e. for error messages\npastInput:function () {\n var past = this.matched.substr(0, this.matched.length - this.match.length);\n return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\\n/g, \"\");\n },\n\n// displays upcoming input, i.e. for error messages\nupcomingInput:function () {\n var next = this.match;\n if (next.length < 20) {\n next += this._input.substr(0, 20-next.length);\n }\n return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\\n/g, \"\");\n },\n\n// displays the character position where the lexing error occurred, i.e. for error messages\nshowPosition:function () {\n var pre = this.pastInput();\n var c = new Array(pre.length + 1).join(\"-\");\n return pre + this.upcomingInput() + \"\\n\" + c + \"^\";\n },\n\n// test the lexed token: return FALSE when not a match, otherwise return token\ntest_match:function(match, indexed_rule) {\n var token,\n lines,\n backup;\n\n if (this.options.backtrack_lexer) {\n // save context\n backup = {\n yylineno: this.yylineno,\n yylloc: {\n first_line: this.yylloc.first_line,\n last_line: this.last_line,\n first_column: this.yylloc.first_column,\n last_column: this.yylloc.last_column\n },\n yytext: this.yytext,\n match: this.match,\n matches: this.matches,\n matched: this.matched,\n yyleng: this.yyleng,\n offset: this.offset,\n _more: this._more,\n _input: this._input,\n yy: this.yy,\n conditionStack: this.conditionStack.slice(0),\n done: this.done\n };\n if (this.options.ranges) {\n backup.yylloc.range = this.yylloc.range.slice(0);\n }\n }\n\n lines = match[0].match(/(?:\\r\\n?|\\n).*/g);\n if (lines) {\n this.yylineno += lines.length;\n }\n this.yylloc = {\n first_line: this.yylloc.last_line,\n last_line: this.yylineno + 1,\n first_column: this.yylloc.last_column,\n last_column: lines ?\n lines[lines.length - 1].length - lines[lines.length - 1].match(/\\r?\\n?/)[0].length :\n this.yylloc.last_column + match[0].length\n };\n this.yytext += match[0];\n this.match += match[0];\n this.matches = match;\n this.yyleng = this.yytext.length;\n if (this.options.ranges) {\n this.yylloc.range = [this.offset, this.offset += this.yyleng];\n }\n this._more = false;\n this._backtrack = false;\n this._input = this._input.slice(match[0].length);\n this.matched += match[0];\n token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);\n if (this.done && this._input) {\n this.done = false;\n }\n if (token) {\n return token;\n } else if (this._backtrack) {\n // recover context\n for (var k in backup) {\n this[k] = backup[k];\n }\n return false; // rule action called reject() implying the next rule should be tested instead.\n }\n return false;\n },\n\n// return next match in input\nnext:function () {\n if (this.done) {\n return this.EOF;\n }\n if (!this._input) {\n this.done = true;\n }\n\n var token,\n match,\n tempMatch,\n index;\n if (!this._more) {\n this.yytext = '';\n this.match = '';\n }\n var rules = this._currentRules();\n for (var i = 0; i < rules.length; i++) {\n tempMatch = this._input.match(this.rules[rules[i]]);\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\n match = tempMatch;\n index = i;\n if (this.options.backtrack_lexer) {\n token = this.test_match(tempMatch, rules[i]);\n if (token !== false) {\n return token;\n } else if (this._backtrack) {\n match = false;\n continue; // rule action called reject() implying a rule MISmatch.\n } else {\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n } else if (!this.options.flex) {\n break;\n }\n }\n }\n if (match) {\n token = this.test_match(match, rules[index]);\n if (token !== false) {\n return token;\n }\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n if (this._input === \"\") {\n return this.EOF;\n } else {\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\\n' + this.showPosition(), {\n text: \"\",\n token: null,\n line: this.yylineno\n });\n }\n },\n\n// return next match that has a token\nlex:function lex () {\n var r = this.next();\n if (r) {\n return r;\n } else {\n return this.lex();\n }\n },\n\n// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)\nbegin:function begin (condition) {\n this.conditionStack.push(condition);\n },\n\n// pop the previously active lexer condition state off the condition stack\npopState:function popState () {\n var n = this.conditionStack.length - 1;\n if (n > 0) {\n return this.conditionStack.pop();\n } else {\n return this.conditionStack[0];\n }\n },\n\n// produce the lexer rule set which is active for the currently active lexer condition state\n_currentRules:function _currentRules () {\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;\n } else {\n return this.conditions[\"INITIAL\"].rules;\n }\n },\n\n// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available\ntopState:function topState (n) {\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\n if (n >= 0) {\n return this.conditionStack[n];\n } else {\n return \"INITIAL\";\n }\n },\n\n// alias for begin(condition)\npushState:function pushState (condition) {\n this.begin(condition);\n },\n\n// return the number of states currently on the stack\nstateStackSize:function stateStackSize() {\n return this.conditionStack.length;\n },\noptions: {},\nperformAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {\nvar YYSTATE=YY_START;\nswitch($avoiding_name_collisions) {\ncase 0:return 6;\nbreak;\ncase 1:return 7;\nbreak;\ncase 2:return 8;\nbreak;\ncase 3:return 9;\nbreak;\ncase 4:return 22;\nbreak;\ncase 5:return 23;\nbreak;\ncase 6: this.begin(\"acc_title\");return 24; \nbreak;\ncase 7: this.popState(); return \"acc_title_value\"; \nbreak;\ncase 8: this.begin(\"acc_descr\");return 26; \nbreak;\ncase 9: this.popState(); return \"acc_descr_value\"; \nbreak;\ncase 10: this.begin(\"acc_descr_multiline\");\nbreak;\ncase 11: this.popState(); \nbreak;\ncase 12:return \"acc_descr_multiline_value\";\nbreak;\ncase 13:/* skip comments */\nbreak;\ncase 14:c /* skip comments */\nbreak;\ncase 15:return 12;\nbreak;\ncase 16:/* skip whitespace */\nbreak;\ncase 17:return 11;\nbreak;\ncase 18:return 15;\nbreak;\ncase 19:return 16;\nbreak;\ncase 20:return 17;\nbreak;\ncase 21:return 18;\nbreak;\ncase 22: this.begin(\"person_ext\"); return 45;\nbreak;\ncase 23: this.begin(\"person\"); return 44;\nbreak;\ncase 24: this.begin(\"system_ext_queue\"); return 51;\nbreak;\ncase 25: this.begin(\"system_ext_db\"); return 50;\nbreak;\ncase 26: this.begin(\"system_ext\"); return 49;\nbreak;\ncase 27: this.begin(\"system_queue\"); return 48;\nbreak;\ncase 28: this.begin(\"system_db\"); return 47;\nbreak;\ncase 29: this.begin(\"system\"); return 46;\nbreak;\ncase 30: this.begin(\"boundary\"); return 37;\nbreak;\ncase 31: this.begin(\"enterprise_boundary\"); return 34;\nbreak;\ncase 32: this.begin(\"system_boundary\"); return 36;\nbreak;\ncase 33: this.begin(\"container_ext_queue\"); return 57;\nbreak;\ncase 34: this.begin(\"container_ext_db\"); return 56;\nbreak;\ncase 35: this.begin(\"container_ext\"); return 55;\nbreak;\ncase 36: this.begin(\"container_queue\"); return 54;\nbreak;\ncase 37: this.begin(\"container_db\"); return 53;\nbreak;\ncase 38: this.begin(\"container\"); return 52;\nbreak;\ncase 39: this.begin(\"container_boundary\"); return 38;\nbreak;\ncase 40: this.begin(\"component_ext_queue\"); return 63;\nbreak;\ncase 41: this.begin(\"component_ext_db\"); return 62;\nbreak;\ncase 42: this.begin(\"component_ext\"); return 61;\nbreak;\ncase 43: this.begin(\"component_queue\"); return 60;\nbreak;\ncase 44: this.begin(\"component_db\"); return 59;\nbreak;\ncase 45: this.begin(\"component\"); return 58;\nbreak;\ncase 46: this.begin(\"node\"); return 39;\nbreak;\ncase 47: this.begin(\"node\"); return 39;\nbreak;\ncase 48: this.begin(\"node_l\"); return 40;\nbreak;\ncase 49: this.begin(\"node_r\"); return 41;\nbreak;\ncase 50: this.begin(\"rel\"); return 64;\nbreak;\ncase 51: this.begin(\"birel\"); return 65;\nbreak;\ncase 52: this.begin(\"rel_u\"); return 66;\nbreak;\ncase 53: this.begin(\"rel_u\"); return 66;\nbreak;\ncase 54: this.begin(\"rel_d\"); return 67;\nbreak;\ncase 55: this.begin(\"rel_d\"); return 67;\nbreak;\ncase 56: this.begin(\"rel_l\"); return 68;\nbreak;\ncase 57: this.begin(\"rel_l\"); return 68;\nbreak;\ncase 58: this.begin(\"rel_r\"); return 69;\nbreak;\ncase 59: this.begin(\"rel_r\"); return 69;\nbreak;\ncase 60: this.begin(\"rel_b\"); return 70;\nbreak;\ncase 61: this.begin(\"rel_index\"); return 71;\nbreak;\ncase 62: this.begin(\"update_el_style\"); return 72;\nbreak;\ncase 63: this.begin(\"update_rel_style\"); return 73;\nbreak;\ncase 64: this.begin(\"update_layout_config\"); return 74;\nbreak;\ncase 65:return \"EOF_IN_STRUCT\";\nbreak;\ncase 66: this.begin(\"attribute\"); return \"ATTRIBUTE_EMPTY\";\nbreak;\ncase 67: this.begin(\"attribute\"); \nbreak;\ncase 68: this.popState();this.popState();\nbreak;\ncase 69: return 80;\nbreak;\ncase 70: \nbreak;\ncase 71: return 80;\nbreak;\ncase 72: this.begin(\"string\");\nbreak;\ncase 73: this.popState(); \nbreak;\ncase 74: return \"STR\";\nbreak;\ncase 75: this.begin(\"string_kv\");\nbreak;\ncase 76: this.begin(\"string_kv_key\"); return \"STR_KEY\";\nbreak;\ncase 77: this.popState(); this.begin(\"string_kv_value\"); \nbreak;\ncase 78: return \"STR_VALUE\";\nbreak;\ncase 79: this.popState(); this.popState(); \nbreak;\ncase 80: return \"STR\";\nbreak;\ncase 81: /* this.begin(\"lbrace\"); */ return \"LBRACE\";\nbreak;\ncase 82: /* this.popState(); */ return \"RBRACE\";\nbreak;\ncase 83:return 'SPACE';\nbreak;\ncase 84:return 'EOL';\nbreak;\ncase 85:return 14;\nbreak;\n}\n},\nrules: [/^(?:.*direction\\s+TB[^\\n]*)/,/^(?:.*direction\\s+BT[^\\n]*)/,/^(?:.*direction\\s+RL[^\\n]*)/,/^(?:.*direction\\s+LR[^\\n]*)/,/^(?:title\\s[^#\\n;]+)/,/^(?:accDescription\\s[^#\\n;]+)/,/^(?:accTitle\\s*:\\s*)/,/^(?:(?!\\n||)*[^\\n]*)/,/^(?:accDescr\\s*:\\s*)/,/^(?:(?!\\n||)*[^\\n]*)/,/^(?:accDescr\\s*\\{\\s*)/,/^(?:[\\}])/,/^(?:[^\\}]*)/,/^(?:%%(?!\\{)*[^\\n]*(\\r?\\n?)+)/,/^(?:%%[^\\n]*(\\r?\\n)*)/,/^(?:\\s*(\\r?\\n)+)/,/^(?:\\s+)/,/^(?:C4Context\\b)/,/^(?:C4Container\\b)/,/^(?:C4Component\\b)/,/^(?:C4Dynamic\\b)/,/^(?:C4Deployment\\b)/,/^(?:Person_Ext\\b)/,/^(?:Person\\b)/,/^(?:SystemQueue_Ext\\b)/,/^(?:SystemDb_Ext\\b)/,/^(?:System_Ext\\b)/,/^(?:SystemQueue\\b)/,/^(?:SystemDb\\b)/,/^(?:System\\b)/,/^(?:Boundary\\b)/,/^(?:Enterprise_Boundary\\b)/,/^(?:System_Boundary\\b)/,/^(?:ContainerQueue_Ext\\b)/,/^(?:ContainerDb_Ext\\b)/,/^(?:Container_Ext\\b)/,/^(?:ContainerQueue\\b)/,/^(?:ContainerDb\\b)/,/^(?:Container\\b)/,/^(?:Container_Boundary\\b)/,/^(?:ComponentQueue_Ext\\b)/,/^(?:ComponentDb_Ext\\b)/,/^(?:Component_Ext\\b)/,/^(?:ComponentQueue\\b)/,/^(?:ComponentDb\\b)/,/^(?:Component\\b)/,/^(?:Deployment_Node\\b)/,/^(?:Node\\b)/,/^(?:Node_L\\b)/,/^(?:Node_R\\b)/,/^(?:Rel\\b)/,/^(?:BiRel\\b)/,/^(?:Rel_Up\\b)/,/^(?:Rel_U\\b)/,/^(?:Rel_Down\\b)/,/^(?:Rel_D\\b)/,/^(?:Rel_Left\\b)/,/^(?:Rel_L\\b)/,/^(?:Rel_Right\\b)/,/^(?:Rel_R\\b)/,/^(?:Rel_Back\\b)/,/^(?:RelIndex\\b)/,/^(?:UpdateElementStyle\\b)/,/^(?:UpdateRelStyle\\b)/,/^(?:UpdateLayoutConfig\\b)/,/^(?:$)/,/^(?:[(][ ]*[,])/,/^(?:[(])/,/^(?:[)])/,/^(?:,,)/,/^(?:,)/,/^(?:[ ]*[\"][\"])/,/^(?:[ ]*[\"])/,/^(?:[\"])/,/^(?:[^\"]*)/,/^(?:[ ]*[\\$])/,/^(?:[^=]*)/,/^(?:[=][ ]*[\"])/,/^(?:[^\"]+)/,/^(?:[\"])/,/^(?:[^,]+)/,/^(?:\\{)/,/^(?:\\})/,/^(?:[\\s]+)/,/^(?:[\\n\\r]+)/,/^(?:$)/],\nconditions: {\"acc_descr_multiline\":{\"rules\":[11,12],\"inclusive\":false},\"acc_descr\":{\"rules\":[9],\"inclusive\":false},\"acc_title\":{\"rules\":[7],\"inclusive\":false},\"string_kv_value\":{\"rules\":[78,79],\"inclusive\":false},\"string_kv_key\":{\"rules\":[77],\"inclusive\":false},\"string_kv\":{\"rules\":[76],\"inclusive\":false},\"string\":{\"rules\":[73,74],\"inclusive\":false},\"attribute\":{\"rules\":[68,69,70,71,72,75,80],\"inclusive\":false},\"update_layout_config\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"update_rel_style\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"update_el_style\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"rel_b\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"rel_r\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"rel_l\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"rel_d\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"rel_u\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"rel_bi\":{\"rules\":[],\"inclusive\":false},\"rel\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"node_r\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"node_l\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"node\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"index\":{\"rules\":[],\"inclusive\":false},\"rel_index\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"component_ext_queue\":{\"rules\":[],\"inclusive\":false},\"component_ext_db\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"component_ext\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"component_queue\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"component_db\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"component\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"container_boundary\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"container_ext_queue\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"container_ext_db\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"container_ext\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"container_queue\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"container_db\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"container\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"birel\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"system_boundary\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"enterprise_boundary\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"boundary\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"system_ext_queue\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"system_ext_db\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"system_ext\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"system_queue\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"system_db\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"system\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"person_ext\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"person\":{\"rules\":[65,66,67,68],\"inclusive\":false},\"INITIAL\":{\"rules\":[0,1,2,3,4,5,6,8,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,81,82,83,84,85],\"inclusive\":true}}\n});\nreturn lexer;\n})();\nparser.lexer = lexer;\nfunction Parser () {\n this.yy = {};\n}\nParser.prototype = parser;parser.Parser = Parser;\nreturn new Parser;\n})(); \n\tparser.parser = parser;\n\texport { parser };\n\texport default parser;\n\t", "/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * assignWithDepth Extends the functionality of {@link Object.assign} with the\n * ability to merge arbitrary-depth objects For each key in src with path `k` (recursively)\n * performs an Object.assign(dst[`k`], src[`k`]) with a slight change from the typical handling of\n * undefined for dst[`k`]: instead of raising an error, dst[`k`] is auto-initialized to `{}` and\n * effectively merged with src[`k`] Additionally, dissimilar types will not clobber unless the\n * config.clobber parameter === true. Example:\n *\n * ```\n * const config_0 = { foo: { bar: 'bar' }, bar: 'foo' };\n * const config_1 = { foo: 'foo', bar: 'bar' };\n * const result = assignWithDepth(config_0, config_1);\n * console.log(result);\n * //-> result: { foo: { bar: 'bar' }, bar: 'bar' }\n * ```\n *\n * Traditional Object.assign would have clobbered foo in config_0 with foo in config_1. If src is a\n * destructured array of objects and dst is not an array, assignWithDepth will apply each element\n * of src to dst in order.\n * @param dst - The destination of the merge\n * @param src - The source object(s) to merge into destination\n * @param config -\n * * depth: depth to traverse within src and dst for merging\n * * clobber: should dissimilar types clobber\n */\nconst assignWithDepth = (\n dst: any,\n src: any,\n { depth = 2, clobber = false }: { depth?: number; clobber?: boolean } = {}\n): any => {\n const config: { depth: number; clobber: boolean } = { depth, clobber };\n if (Array.isArray(src) && !Array.isArray(dst)) {\n src.forEach((s) => assignWithDepth(dst, s, config));\n return dst;\n } else if (Array.isArray(src) && Array.isArray(dst)) {\n src.forEach((s) => {\n if (!dst.includes(s)) {\n dst.push(s);\n }\n });\n return dst;\n }\n if (dst === undefined || depth <= 0) {\n if (dst !== undefined && dst !== null && typeof dst === 'object' && typeof src === 'object') {\n return Object.assign(dst, src);\n } else {\n return src;\n }\n }\n if (src !== undefined && typeof dst === 'object' && typeof src === 'object') {\n Object.keys(src).forEach((key) => {\n if (\n typeof src[key] === 'object' &&\n (dst[key] === undefined || typeof dst[key] === 'object')\n ) {\n if (dst[key] === undefined) {\n dst[key] = Array.isArray(src[key]) ? [] : {};\n }\n dst[key] = assignWithDepth(dst[key], src[key], { depth: depth - 1, clobber });\n } else if (clobber || (typeof dst[key] !== 'object' && typeof src[key] !== 'object')) {\n dst[key] = src[key];\n }\n });\n }\n return dst;\n};\n\nexport default assignWithDepth;\n", "/* IMPORT */\n/* MAIN */\nconst Channel = {\n /* CLAMP */\n min: {\n r: 0,\n g: 0,\n b: 0,\n s: 0,\n l: 0,\n a: 0\n },\n max: {\n r: 255,\n g: 255,\n b: 255,\n h: 360,\n s: 100,\n l: 100,\n a: 1\n },\n clamp: {\n r: (r) => r >= 255 ? 255 : (r < 0 ? 0 : r),\n g: (g) => g >= 255 ? 255 : (g < 0 ? 0 : g),\n b: (b) => b >= 255 ? 255 : (b < 0 ? 0 : b),\n h: (h) => h % 360,\n s: (s) => s >= 100 ? 100 : (s < 0 ? 0 : s),\n l: (l) => l >= 100 ? 100 : (l < 0 ? 0 : l),\n a: (a) => a >= 1 ? 1 : (a < 0 ? 0 : a)\n },\n /* CONVERSION */\n //SOURCE: https://planetcalc.com/7779\n toLinear: (c) => {\n const n = c / 255;\n return c > .03928 ? Math.pow(((n + .055) / 1.055), 2.4) : n / 12.92;\n },\n //SOURCE: https://gist.github.com/mjackson/5311256\n hue2rgb: (p, q, t) => {\n if (t < 0)\n t += 1;\n if (t > 1)\n t -= 1;\n if (t < 1 / 6)\n return p + (q - p) * 6 * t;\n if (t < 1 / 2)\n return q;\n if (t < 2 / 3)\n return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n },\n hsl2rgb: ({ h, s, l }, channel) => {\n if (!s)\n return l * 2.55; // Achromatic\n h /= 360;\n s /= 100;\n l /= 100;\n const q = (l < .5) ? l * (1 + s) : (l + s) - (l * s);\n const p = 2 * l - q;\n switch (channel) {\n case 'r': return Channel.hue2rgb(p, q, h + 1 / 3) * 255;\n case 'g': return Channel.hue2rgb(p, q, h) * 255;\n case 'b': return Channel.hue2rgb(p, q, h - 1 / 3) * 255;\n }\n },\n rgb2hsl: ({ r, g, b }, channel) => {\n r /= 255;\n g /= 255;\n b /= 255;\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const l = (max + min) / 2;\n if (channel === 'l')\n return l * 100;\n if (max === min)\n return 0; // Achromatic\n const d = max - min;\n const s = (l > .5) ? d / (2 - max - min) : d / (max + min);\n if (channel === 's')\n return s * 100;\n switch (max) {\n case r: return ((g - b) / d + (g < b ? 6 : 0)) * 60;\n case g: return ((b - r) / d + 2) * 60;\n case b: return ((r - g) / d + 4) * 60;\n default: return -1; //TSC: TypeScript is stupid and complains if there isn't this useless default statement\n }\n }\n};\n/* EXPORT */\nexport default Channel;\n", "/* MAIN */\nconst Lang = {\n /* API */\n clamp: (number, lower, upper) => {\n if (lower > upper)\n return Math.min(lower, Math.max(upper, number));\n return Math.min(upper, Math.max(lower, number));\n },\n round: (number) => {\n return Math.round(number * 10000000000) / 10000000000;\n }\n};\n/* EXPORT */\nexport default Lang;\n", "/* MAIN */\nconst Unit = {\n /* API */\n dec2hex: (dec) => {\n const hex = Math.round(dec).toString(16);\n return hex.length > 1 ? hex : `0${hex}`;\n }\n};\n/* EXPORT */\nexport default Unit;\n", "/* IMPORT */\nimport channel from './channel.js';\nimport lang from './lang.js';\nimport unit from './unit.js';\n/* MAIN */\nconst Utils = {\n channel,\n lang,\n unit\n};\n/* EXPORT */\nexport default Utils;\n", "/* IMPORT */\nimport _ from './utils/index.js';\n/* MAIN */\nconst DEC2HEX = {};\nfor (let i = 0; i <= 255; i++)\n DEC2HEX[i] = _.unit.dec2hex(i); // Populating dynamically, striking a balance between code size and performance\nconst TYPE = {\n ALL: 0,\n RGB: 1,\n HSL: 2\n};\n/* EXPORT */\nexport { DEC2HEX, TYPE };\n", "/* IMPORT */\nimport { TYPE } from '../constants.js';\n/* MAIN */\nclass Type {\n constructor() {\n /* VARIABLES */\n this.type = TYPE.ALL;\n }\n /* API */\n get() {\n return this.type;\n }\n set(type) {\n if (this.type && this.type !== type)\n throw new Error('Cannot change both RGB and HSL channels at the same time');\n this.type = type;\n }\n reset() {\n this.type = TYPE.ALL;\n }\n is(type) {\n return this.type === type;\n }\n}\n/* EXPORT */\nexport default Type;\n", "/* IMPORT */\nimport _ from '../utils/index.js';\nimport Type from './type.js';\nimport { TYPE } from '../constants.js';\n/* MAIN */\nclass Channels {\n /* CONSTRUCTOR */\n constructor(data, color) {\n this.color = color;\n this.changed = false;\n this.data = data; //TSC\n this.type = new Type();\n }\n /* API */\n set(data, color) {\n this.color = color;\n this.changed = false;\n this.data = data; //TSC\n this.type.type = TYPE.ALL;\n return this;\n }\n /* HELPERS */\n _ensureHSL() {\n const data = this.data;\n const { h, s, l } = data;\n if (h === undefined)\n data.h = _.channel.rgb2hsl(data, 'h');\n if (s === undefined)\n data.s = _.channel.rgb2hsl(data, 's');\n if (l === undefined)\n data.l = _.channel.rgb2hsl(data, 'l');\n }\n _ensureRGB() {\n const data = this.data;\n const { r, g, b } = data;\n if (r === undefined)\n data.r = _.channel.hsl2rgb(data, 'r');\n if (g === undefined)\n data.g = _.channel.hsl2rgb(data, 'g');\n if (b === undefined)\n data.b = _.channel.hsl2rgb(data, 'b');\n }\n /* GETTERS */\n get r() {\n const data = this.data;\n const r = data.r;\n if (!this.type.is(TYPE.HSL) && r !== undefined)\n return r;\n this._ensureHSL();\n return _.channel.hsl2rgb(data, 'r');\n }\n get g() {\n const data = this.data;\n const g = data.g;\n if (!this.type.is(TYPE.HSL) && g !== undefined)\n return g;\n this._ensureHSL();\n return _.channel.hsl2rgb(data, 'g');\n }\n get b() {\n const data = this.data;\n const b = data.b;\n if (!this.type.is(TYPE.HSL) && b !== undefined)\n return b;\n this._ensureHSL();\n return _.channel.hsl2rgb(data, 'b');\n }\n get h() {\n const data = this.data;\n const h = data.h;\n if (!this.type.is(TYPE.RGB) && h !== undefined)\n return h;\n this._ensureRGB();\n return _.channel.rgb2hsl(data, 'h');\n }\n get s() {\n const data = this.data;\n const s = data.s;\n if (!this.type.is(TYPE.RGB) && s !== undefined)\n return s;\n this._ensureRGB();\n return _.channel.rgb2hsl(data, 's');\n }\n get l() {\n const data = this.data;\n const l = data.l;\n if (!this.type.is(TYPE.RGB) && l !== undefined)\n return l;\n this._ensureRGB();\n return _.channel.rgb2hsl(data, 'l');\n }\n get a() {\n return this.data.a;\n }\n /* SETTERS */\n set r(r) {\n this.type.set(TYPE.RGB);\n this.changed = true;\n this.data.r = r;\n }\n set g(g) {\n this.type.set(TYPE.RGB);\n this.changed = true;\n this.data.g = g;\n }\n set b(b) {\n this.type.set(TYPE.RGB);\n this.changed = true;\n this.data.b = b;\n }\n set h(h) {\n this.type.set(TYPE.HSL);\n this.changed = true;\n this.data.h = h;\n }\n set s(s) {\n this.type.set(TYPE.HSL);\n this.changed = true;\n this.data.s = s;\n }\n set l(l) {\n this.type.set(TYPE.HSL);\n this.changed = true;\n this.data.l = l;\n }\n set a(a) {\n this.changed = true;\n this.data.a = a;\n }\n}\n/* EXPORT */\nexport default Channels;\n", "/* IMPORT */\nimport Channels from './/index.js';\n/* MAIN */\nconst channels = new Channels({ r: 0, g: 0, b: 0, a: 0 }, 'transparent');\n/* EXPORT */\nexport default channels;\n", "/* IMPORT */\nimport _ from '../utils/index.js';\nimport ChannelsReusable from '../channels/reusable.js';\nimport { DEC2HEX } from '../constants.js';\n/* MAIN */\nconst Hex = {\n /* VARIABLES */\n re: /^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,\n /* API */\n parse: (color) => {\n if (color.charCodeAt(0) !== 35)\n return; // '#'\n const match = color.match(Hex.re);\n if (!match)\n return;\n const hex = match[1];\n const dec = parseInt(hex, 16);\n const length = hex.length;\n const hasAlpha = length % 4 === 0;\n const isFullLength = length > 4;\n const multiplier = isFullLength ? 1 : 17;\n const bits = isFullLength ? 8 : 4;\n const bitsOffset = hasAlpha ? 0 : -1;\n const mask = isFullLength ? 255 : 15;\n return ChannelsReusable.set({\n r: ((dec >> (bits * (bitsOffset + 3))) & mask) * multiplier,\n g: ((dec >> (bits * (bitsOffset + 2))) & mask) * multiplier,\n b: ((dec >> (bits * (bitsOffset + 1))) & mask) * multiplier,\n a: hasAlpha ? (dec & mask) * multiplier / 255 : 1\n }, color);\n },\n stringify: (channels) => {\n const { r, g, b, a } = channels;\n if (a < 1) { // #RRGGBBAA\n return `#${DEC2HEX[Math.round(r)]}${DEC2HEX[Math.round(g)]}${DEC2HEX[Math.round(b)]}${DEC2HEX[Math.round(a * 255)]}`;\n }\n else { // #RRGGBB\n return `#${DEC2HEX[Math.round(r)]}${DEC2HEX[Math.round(g)]}${DEC2HEX[Math.round(b)]}`;\n }\n }\n};\n/* EXPORT */\nexport default Hex;\n", "/* IMPORT */\nimport _ from '../utils/index.js';\nimport ChannelsReusable from '../channels/reusable.js';\n/* MAIN */\nconst HSL = {\n /* VARIABLES */\n re: /^hsla?\\(\\s*?(-?(?:\\d+(?:\\.\\d+)?|(?:\\.\\d+))(?:e-?\\d+)?(?:deg|grad|rad|turn)?)\\s*?(?:,|\\s)\\s*?(-?(?:\\d+(?:\\.\\d+)?|(?:\\.\\d+))(?:e-?\\d+)?%)\\s*?(?:,|\\s)\\s*?(-?(?:\\d+(?:\\.\\d+)?|(?:\\.\\d+))(?:e-?\\d+)?%)(?:\\s*?(?:,|\\/)\\s*?\\+?(-?(?:\\d+(?:\\.\\d+)?|(?:\\.\\d+))(?:e-?\\d+)?(%)?))?\\s*?\\)$/i,\n hueRe: /^(.+?)(deg|grad|rad|turn)$/i,\n /* HELPERS */\n _hue2deg: (hue) => {\n const match = hue.match(HSL.hueRe);\n if (match) {\n const [, number, unit] = match;\n switch (unit) {\n case 'grad': return _.channel.clamp.h(parseFloat(number) * .9);\n case 'rad': return _.channel.clamp.h(parseFloat(number) * 180 / Math.PI);\n case 'turn': return _.channel.clamp.h(parseFloat(number) * 360);\n }\n }\n return _.channel.clamp.h(parseFloat(hue));\n },\n /* API */\n parse: (color) => {\n const charCode = color.charCodeAt(0);\n if (charCode !== 104 && charCode !== 72)\n return; // 'h'/'H'\n const match = color.match(HSL.re);\n if (!match)\n return;\n const [, h, s, l, a, isAlphaPercentage] = match;\n return ChannelsReusable.set({\n h: HSL._hue2deg(h),\n s: _.channel.clamp.s(parseFloat(s)),\n l: _.channel.clamp.l(parseFloat(l)),\n a: a ? _.channel.clamp.a(isAlphaPercentage ? parseFloat(a) / 100 : parseFloat(a)) : 1\n }, color);\n },\n stringify: (channels) => {\n const { h, s, l, a } = channels;\n if (a < 1) { // HSLA\n return `hsla(${_.lang.round(h)}, ${_.lang.round(s)}%, ${_.lang.round(l)}%, ${a})`;\n }\n else { // HSL\n return `hsl(${_.lang.round(h)}, ${_.lang.round(s)}%, ${_.lang.round(l)}%)`;\n }\n }\n};\n/* EXPORT */\nexport default HSL;\n", "/* IMPORT */\nimport Hex from './hex.js';\n/* MAIN */\nconst Keyword = {\n /* VARIABLES */\n colors: {\n aliceblue: '#f0f8ff',\n antiquewhite: '#faebd7',\n aqua: '#00ffff',\n aquamarine: '#7fffd4',\n azure: '#f0ffff',\n beige: '#f5f5dc',\n bisque: '#ffe4c4',\n black: '#000000',\n blanchedalmond: '#ffebcd',\n blue: '#0000ff',\n blueviolet: '#8a2be2',\n brown: '#a52a2a',\n burlywood: '#deb887',\n cadetblue: '#5f9ea0',\n chartreuse: '#7fff00',\n chocolate: '#d2691e',\n coral: '#ff7f50',\n cornflowerblue: '#6495ed',\n cornsilk: '#fff8dc',\n crimson: '#dc143c',\n cyanaqua: '#00ffff',\n darkblue: '#00008b',\n darkcyan: '#008b8b',\n darkgoldenrod: '#b8860b',\n darkgray: '#a9a9a9',\n darkgreen: '#006400',\n darkgrey: '#a9a9a9',\n darkkhaki: '#bdb76b',\n darkmagenta: '#8b008b',\n darkolivegreen: '#556b2f',\n darkorange: '#ff8c00',\n darkorchid: '#9932cc',\n darkred: '#8b0000',\n darksalmon: '#e9967a',\n darkseagreen: '#8fbc8f',\n darkslateblue: '#483d8b',\n darkslategray: '#2f4f4f',\n darkslategrey: '#2f4f4f',\n darkturquoise: '#00ced1',\n darkviolet: '#9400d3',\n deeppink: '#ff1493',\n deepskyblue: '#00bfff',\n dimgray: '#696969',\n dimgrey: '#696969',\n dodgerblue: '#1e90ff',\n firebrick: '#b22222',\n floralwhite: '#fffaf0',\n forestgreen: '#228b22',\n fuchsia: '#ff00ff',\n gainsboro: '#dcdcdc',\n ghostwhite: '#f8f8ff',\n gold: '#ffd700',\n goldenrod: '#daa520',\n gray: '#808080',\n green: '#008000',\n greenyellow: '#adff2f',\n grey: '#808080',\n honeydew: '#f0fff0',\n hotpink: '#ff69b4',\n indianred: '#cd5c5c',\n indigo: '#4b0082',\n ivory: '#fffff0',\n khaki: '#f0e68c',\n lavender: '#e6e6fa',\n lavenderblush: '#fff0f5',\n lawngreen: '#7cfc00',\n lemonchiffon: '#fffacd',\n lightblue: '#add8e6',\n lightcoral: '#f08080',\n lightcyan: '#e0ffff',\n lightgoldenrodyellow: '#fafad2',\n lightgray: '#d3d3d3',\n lightgreen: '#90ee90',\n lightgrey: '#d3d3d3',\n lightpink: '#ffb6c1',\n lightsalmon: '#ffa07a',\n lightseagreen: '#20b2aa',\n lightskyblue: '#87cefa',\n lightslategray: '#778899',\n lightslategrey: '#778899',\n lightsteelblue: '#b0c4de',\n lightyellow: '#ffffe0',\n lime: '#00ff00',\n limegreen: '#32cd32',\n linen: '#faf0e6',\n magenta: '#ff00ff',\n maroon: '#800000',\n mediumaquamarine: '#66cdaa',\n mediumblue: '#0000cd',\n mediumorchid: '#ba55d3',\n mediumpurple: '#9370db',\n mediumseagreen: '#3cb371',\n mediumslateblue: '#7b68ee',\n mediumspringgreen: '#00fa9a',\n mediumturquoise: '#48d1cc',\n mediumvioletred: '#c71585',\n midnightblue: '#191970',\n mintcream: '#f5fffa',\n mistyrose: '#ffe4e1',\n moccasin: '#ffe4b5',\n navajowhite: '#ffdead',\n navy: '#000080',\n oldlace: '#fdf5e6',\n olive: '#808000',\n olivedrab: '#6b8e23',\n orange: '#ffa500',\n orangered: '#ff4500',\n orchid: '#da70d6',\n palegoldenrod: '#eee8aa',\n palegreen: '#98fb98',\n paleturquoise: '#afeeee',\n palevioletred: '#db7093',\n papayawhip: '#ffefd5',\n peachpuff: '#ffdab9',\n peru: '#cd853f',\n pink: '#ffc0cb',\n plum: '#dda0dd',\n powderblue: '#b0e0e6',\n purple: '#800080',\n rebeccapurple: '#663399',\n red: '#ff0000',\n rosybrown: '#bc8f8f',\n royalblue: '#4169e1',\n saddlebrown: '#8b4513',\n salmon: '#fa8072',\n sandybrown: '#f4a460',\n seagreen: '#2e8b57',\n seashell: '#fff5ee',\n sienna: '#a0522d',\n silver: '#c0c0c0',\n skyblue: '#87ceeb',\n slateblue: '#6a5acd',\n slategray: '#708090',\n slategrey: '#708090',\n snow: '#fffafa',\n springgreen: '#00ff7f',\n tan: '#d2b48c',\n teal: '#008080',\n thistle: '#d8bfd8',\n transparent: '#00000000',\n turquoise: '#40e0d0',\n violet: '#ee82ee',\n wheat: '#f5deb3',\n white: '#ffffff',\n whitesmoke: '#f5f5f5',\n yellow: '#ffff00',\n yellowgreen: '#9acd32'\n },\n /* API */\n parse: (color) => {\n color = color.toLowerCase();\n const hex = Keyword.colors[color];\n if (!hex)\n return;\n return Hex.parse(hex);\n },\n stringify: (channels) => {\n const hex = Hex.stringify(channels);\n for (const name in Keyword.colors) {\n if (Keyword.colors[name] === hex)\n return name;\n }\n return;\n }\n};\n/* EXPORT */\nexport default Keyword;\n", "/* IMPORT */\nimport _ from '../utils/index.js';\nimport ChannelsReusable from '../channels/reusable.js';\n/* MAIN */\nconst RGB = {\n /* VARIABLES */\n re: /^rgba?\\(\\s*?(-?(?:\\d+(?:\\.\\d+)?|(?:\\.\\d+))(?:e\\d+)?(%?))\\s*?(?:,|\\s)\\s*?(-?(?:\\d+(?:\\.\\d+)?|(?:\\.\\d+))(?:e\\d+)?(%?))\\s*?(?:,|\\s)\\s*?(-?(?:\\d+(?:\\.\\d+)?|(?:\\.\\d+))(?:e\\d+)?(%?))(?:\\s*?(?:,|\\/)\\s*?\\+?(-?(?:\\d+(?:\\.\\d+)?|(?:\\.\\d+))(?:e\\d+)?(%?)))?\\s*?\\)$/i,\n /* API */\n parse: (color) => {\n const charCode = color.charCodeAt(0);\n if (charCode !== 114 && charCode !== 82)\n return; // 'r'/'R'\n const match = color.match(RGB.re);\n if (!match)\n return;\n const [, r, isRedPercentage, g, isGreenPercentage, b, isBluePercentage, a, isAlphaPercentage] = match;\n return ChannelsReusable.set({\n r: _.channel.clamp.r(isRedPercentage ? parseFloat(r) * 2.55 : parseFloat(r)),\n g: _.channel.clamp.g(isGreenPercentage ? parseFloat(g) * 2.55 : parseFloat(g)),\n b: _.channel.clamp.b(isBluePercentage ? parseFloat(b) * 2.55 : parseFloat(b)),\n a: a ? _.channel.clamp.a(isAlphaPercentage ? parseFloat(a) / 100 : parseFloat(a)) : 1\n }, color);\n },\n stringify: (channels) => {\n const { r, g, b, a } = channels;\n if (a < 1) { // RGBA\n return `rgba(${_.lang.round(r)}, ${_.lang.round(g)}, ${_.lang.round(b)}, ${_.lang.round(a)})`;\n }\n else { // RGB\n return `rgb(${_.lang.round(r)}, ${_.lang.round(g)}, ${_.lang.round(b)})`;\n }\n }\n};\n/* EXPORT */\nexport default RGB;\n", "/* IMPORT */\nimport _ from '../utils/index.js';\nimport Hex from './hex.js';\nimport HSL from './hsl.js';\nimport Keyword from './keyword.js';\nimport RGB from './rgb.js';\nimport { TYPE } from '../constants.js';\n/* MAIN */\nconst Color = {\n /* VARIABLES */\n format: {\n keyword: Keyword,\n hex: Hex,\n rgb: RGB,\n rgba: RGB,\n hsl: HSL,\n hsla: HSL\n },\n /* API */\n parse: (color) => {\n if (typeof color !== 'string')\n return color;\n const channels = Hex.parse(color) || RGB.parse(color) || HSL.parse(color) || Keyword.parse(color); // Color providers ordered with performance in mind\n if (channels)\n return channels;\n throw new Error(`Unsupported color format: \"${color}\"`);\n },\n stringify: (channels) => {\n // SASS returns a keyword if possible, but we avoid doing that as it's slower and doesn't really add any value\n if (!channels.changed && channels.color)\n return channels.color;\n if (channels.type.is(TYPE.HSL) || channels.data.r === undefined) {\n return HSL.stringify(channels);\n }\n else if (channels.a < 1 || !Number.isInteger(channels.r) || !Number.isInteger(channels.g) || !Number.isInteger(channels.b)) {\n return RGB.stringify(channels);\n }\n else {\n return Hex.stringify(channels);\n }\n }\n};\n/* EXPORT */\nexport default Color;\n", "/* IMPORT */\nimport _ from '../utils/index.js';\nimport Color from '../color/index.js';\n/* MAIN */\nconst change = (color, channels) => {\n const ch = Color.parse(color);\n for (const c in channels) {\n ch[c] = _.channel.clamp[c](channels[c]);\n }\n return Color.stringify(ch);\n};\n/* EXPORT */\nexport default change;\n", "/* IMPORT */\nimport _ from '../utils/index.js';\nimport ChannelsReusable from '../channels/reusable.js';\nimport Color from '../color/index.js';\nimport change from './change.js';\n/* MAIN */\nconst rgba = (r, g, b = 0, a = 1) => {\n if (typeof r !== 'number')\n return change(r, { a: g });\n const channels = ChannelsReusable.set({\n r: _.channel.clamp.r(r),\n g: _.channel.clamp.g(g),\n b: _.channel.clamp.b(b),\n a: _.channel.clamp.a(a)\n });\n return Color.stringify(channels);\n};\n/* EXPORT */\nexport default rgba;\n", "/* IMPORT */\nimport _ from '../utils/index.js';\nimport Color from '../color/index.js';\n/* MAIN */\nconst channel = (color, channel) => {\n return _.lang.round(Color.parse(color)[channel]);\n};\n/* EXPORT */\nexport default channel;\n", "/* IMPORT */\nimport _ from '../utils/index.js';\nimport Color from '../color/index.js';\n/* MAIN */\n//SOURCE: https://planetcalc.com/7779\nconst luminance = (color) => {\n const { r, g, b } = Color.parse(color);\n const luminance = .2126 * _.channel.toLinear(r) + .7152 * _.channel.toLinear(g) + .0722 * _.channel.toLinear(b);\n return _.lang.round(luminance);\n};\n/* EXPORT */\nexport default luminance;\n", "/* IMPORT */\nimport luminance from './luminance.js';\n/* MAIN */\nconst isLight = (color) => {\n return luminance(color) >= .5;\n};\n/* EXPORT */\nexport default isLight;\n", "/* IMPORT */\nimport isLight from './is_light.js';\n/* MAIN */\nconst isDark = (color) => {\n return !isLight(color);\n};\n/* EXPORT */\nexport default isDark;\n", "/* IMPORT */\nimport _ from '../utils/index.js';\nimport Color from '../color/index.js';\n/* MAIN */\nconst adjustChannel = (color, channel, amount) => {\n const channels = Color.parse(color);\n const amountCurrent = channels[channel];\n const amountNext = _.channel.clamp[channel](amountCurrent + amount);\n if (amountCurrent !== amountNext)\n channels[channel] = amountNext;\n return Color.stringify(channels);\n};\n/* EXPORT */\nexport default adjustChannel;\n", "/* IMPORT */\nimport adjustChannel from './adjust_channel.js';\n/* MAIN */\nconst lighten = (color, amount) => {\n return adjustChannel(color, 'l', amount);\n};\n/* EXPORT */\nexport default lighten;\n", "/* IMPORT */\nimport adjustChannel from './adjust_channel.js';\n/* MAIN */\nconst darken = (color, amount) => {\n return adjustChannel(color, 'l', -amount);\n};\n/* EXPORT */\nexport default darken;\n", "/* IMPORT */\nimport Color from '../color/index.js';\nimport change from './change.js';\n/* MAIN */\nconst adjust = (color, channels) => {\n const ch = Color.parse(color);\n const changes = {};\n for (const c in channels) {\n if (!channels[c])\n continue;\n changes[c] = ch[c] + channels[c];\n }\n return change(color, changes);\n};\n/* EXPORT */\nexport default adjust;\n", "/* IMPORT */\nimport Color from '../color/index.js';\nimport rgba from './rgba.js';\n/* MAIN */\n//SOURCE: https://github.com/sass/dart-sass/blob/7457d2e9e7e623d9844ffd037a070cf32d39c348/lib/src/functions/color.dart#L718-L756\nconst mix = (color1, color2, weight = 50) => {\n const { r: r1, g: g1, b: b1, a: a1 } = Color.parse(color1);\n const { r: r2, g: g2, b: b2, a: a2 } = Color.parse(color2);\n const weightScale = weight / 100;\n const weightNormalized = (weightScale * 2) - 1;\n const alphaDelta = a1 - a2;\n const weight1combined = ((weightNormalized * alphaDelta) === -1) ? weightNormalized : (weightNormalized + alphaDelta) / (1 + weightNormalized * alphaDelta);\n const weight1 = (weight1combined + 1) / 2;\n const weight2 = 1 - weight1;\n const r = (r1 * weight1) + (r2 * weight2);\n const g = (g1 * weight1) + (g2 * weight2);\n const b = (b1 * weight1) + (b2 * weight2);\n const a = (a1 * weightScale) + (a2 * (1 - weightScale));\n return rgba(r, g, b, a);\n};\n/* EXPORT */\nexport default mix;\n", "/* IMPORT */\nimport Color from '../color/index.js';\nimport mix from './mix.js';\n/* MAIN */\nconst invert = (color, weight = 100) => {\n const inverse = Color.parse(color);\n inverse.r = 255 - inverse.r;\n inverse.g = 255 - inverse.g;\n inverse.b = 255 - inverse.b;\n return mix(inverse, color, weight);\n};\n/* EXPORT */\nexport default invert;\n", "/* IMPORT */\nimport hex from './rgba.js'; // Alias\nimport rgb from './rgba.js'; // Alias\nimport rgba from './rgba.js';\nimport hsl from './hsla.js'; // Alias\nimport hsla from './hsla.js';\nimport toKeyword from './to_keyword.js';\nimport toHex from './to_hex.js';\nimport toRgba from './to_rgba.js';\nimport toHsla from './to_hsla.js';\nimport channel from './channel.js';\nimport red from './red.js';\nimport green from './green.js';\nimport blue from './blue.js';\nimport hue from './hue.js';\nimport saturation from './saturation.js';\nimport lightness from './lightness.js';\nimport alpha from './alpha.js';\nimport opacity from './alpha.js'; // Alias\nimport contrast from './contrast.js';\nimport luminance from './luminance.js';\nimport isDark from './is_dark.js';\nimport isLight from './is_light.js';\nimport isTransparent from './is_transparent.js';\nimport isValid from './is_valid.js';\nimport saturate from './saturate.js';\nimport desaturate from './desaturate.js';\nimport lighten from './lighten.js';\nimport darken from './darken.js';\nimport opacify from './opacify.js';\nimport fadeIn from './opacify.js'; // Alias\nimport transparentize from './transparentize.js';\nimport fadeOut from './transparentize.js'; // Alias\nimport complement from './complement.js';\nimport grayscale from './grayscale.js';\nimport adjust from './adjust.js';\nimport change from './change.js';\nimport invert from './invert.js';\nimport mix from './mix.js';\nimport scale from './scale.js';\n/* EXPORT */\nexport { \n/* CREATE */\nhex, rgb, rgba, hsl, hsla, \n/* CONVERT */\ntoKeyword, toHex, toRgba, toHsla, \n/* GET - CHANNEL */\nchannel, red, green, blue, hue, saturation, lightness, alpha, opacity, \n/* GET - MORE */\ncontrast, luminance, isDark, isLight, isTransparent, isValid, \n/* EDIT - CHANNEL */\nsaturate, desaturate, lighten, darken, opacify, fadeIn, transparentize, fadeOut, complement, grayscale, \n/* EDIT - MORE */\nadjust, change, invert, mix, scale };\n", "/* EXPORT */\nexport * from './methods/index.js';\n", "/**\n * Values that have been hardcoded in src/diagrams/er/styles.js. These can be used by\n * theme-_._ files to maintain display styles until themes, styles, renderers are revised. --\n * 2022-09-22\n */\nexport const oldAttributeBackgroundColorOdd = '#ffffff';\nexport const oldAttributeBackgroundColorEven = '#f2f2f2';\n", "import { adjust } from 'khroma';\n\nexport const mkBorder = (col, darkMode) =>\n darkMode ? adjust(col, { s: -40, l: 10 }) : adjust(col, { s: -40, l: -10 });\n", "import { adjust, darken, invert, isDark, lighten } from 'khroma';\nimport {\n oldAttributeBackgroundColorEven,\n oldAttributeBackgroundColorOdd,\n} from './erDiagram-oldHardcodedValues.js';\nimport { mkBorder } from './theme-helpers.js';\n\nclass Theme {\n constructor() {\n /** # Base variables */\n /**\n * - Background - used to know what the background color is of the diagram. This is used for\n * deducing colors for instance line color. Default value is #f4f4f4.\n */\n this.background = '#f4f4f4';\n\n this.primaryColor = '#fff4dd';\n\n this.noteBkgColor = '#fff5ad';\n this.noteTextColor = '#333';\n\n this.THEME_COLOR_LIMIT = 12;\n\n // dark\n\n this.fontFamily = '\"trebuchet ms\", verdana, arial, sans-serif';\n this.fontSize = '16px';\n }\n updateColors() {\n // The || is to make sure that if the variable has been defined by a user override that value is to be used\n\n /* Main */\n this.primaryTextColor = this.primaryTextColor || (this.darkMode ? '#eee' : '#333'); // invert(this.primaryColor);\n this.secondaryColor = this.secondaryColor || adjust(this.primaryColor, { h: -120 });\n this.tertiaryColor = this.tertiaryColor || adjust(this.primaryColor, { h: 180, l: 5 });\n\n this.primaryBorderColor = this.primaryBorderColor || mkBorder(this.primaryColor, this.darkMode);\n this.secondaryBorderColor =\n this.secondaryBorderColor || mkBorder(this.secondaryColor, this.darkMode);\n this.tertiaryBorderColor =\n this.tertiaryBorderColor || mkBorder(this.tertiaryColor, this.darkMode);\n this.noteBorderColor = this.noteBorderColor || mkBorder(this.noteBkgColor, this.darkMode);\n this.noteBkgColor = this.noteBkgColor || '#fff5ad';\n this.noteTextColor = this.noteTextColor || '#333';\n\n this.secondaryTextColor = this.secondaryTextColor || invert(this.secondaryColor);\n this.tertiaryTextColor = this.tertiaryTextColor || invert(this.tertiaryColor);\n this.lineColor = this.lineColor || invert(this.background);\n this.arrowheadColor = this.arrowheadColor || invert(this.background);\n this.textColor = this.textColor || this.primaryTextColor;\n\n // TODO: should this instead default to secondaryBorderColor?\n this.border2 = this.border2 || this.tertiaryBorderColor;\n\n /* Flowchart variables */\n this.nodeBkg = this.nodeBkg || this.primaryColor;\n this.mainBkg = this.mainBkg || this.primaryColor;\n this.nodeBorder = this.nodeBorder || this.primaryBorderColor;\n this.clusterBkg = this.clusterBkg || this.tertiaryColor;\n this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor;\n this.defaultLinkColor = this.defaultLinkColor || this.lineColor;\n this.titleColor = this.titleColor || this.tertiaryTextColor;\n this.edgeLabelBackground =\n this.edgeLabelBackground ||\n (this.darkMode ? darken(this.secondaryColor, 30) : this.secondaryColor);\n this.nodeTextColor = this.nodeTextColor || this.primaryTextColor;\n /* Sequence Diagram variables */\n\n // this.actorBorder = lighten(this.border1, 0.5);\n this.actorBorder = this.actorBorder || this.primaryBorderColor;\n this.actorBkg = this.actorBkg || this.mainBkg;\n this.actorTextColor = this.actorTextColor || this.primaryTextColor;\n this.actorLineColor = this.actorLineColor || this.actorBorder;\n this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg;\n this.signalColor = this.signalColor || this.textColor;\n this.signalTextColor = this.signalTextColor || this.textColor;\n this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder;\n this.labelTextColor = this.labelTextColor || this.actorTextColor;\n this.loopTextColor = this.loopTextColor || this.actorTextColor;\n this.activationBorderColor = this.activationBorderColor || darken(this.secondaryColor, 10);\n this.activationBkgColor = this.activationBkgColor || this.secondaryColor;\n this.sequenceNumberColor = this.sequenceNumberColor || invert(this.lineColor);\n\n /* Gantt chart variables */\n\n this.sectionBkgColor = this.sectionBkgColor || this.tertiaryColor;\n this.altSectionBkgColor = this.altSectionBkgColor || 'white';\n this.sectionBkgColor = this.sectionBkgColor || this.secondaryColor;\n this.sectionBkgColor2 = this.sectionBkgColor2 || this.primaryColor;\n this.excludeBkgColor = this.excludeBkgColor || '#eeeeee';\n this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor;\n this.taskBkgColor = this.taskBkgColor || this.primaryColor;\n this.activeTaskBorderColor = this.activeTaskBorderColor || this.primaryColor;\n this.activeTaskBkgColor = this.activeTaskBkgColor || lighten(this.primaryColor, 23);\n this.gridColor = this.gridColor || 'lightgrey';\n this.doneTaskBkgColor = this.doneTaskBkgColor || 'lightgrey';\n this.doneTaskBorderColor = this.doneTaskBorderColor || 'grey';\n this.critBorderColor = this.critBorderColor || '#ff8888';\n this.critBkgColor = this.critBkgColor || 'red';\n this.todayLineColor = this.todayLineColor || 'red';\n this.taskTextColor = this.taskTextColor || this.textColor;\n this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor;\n this.taskTextLightColor = this.taskTextLightColor || this.textColor;\n this.taskTextColor = this.taskTextColor || this.primaryTextColor;\n this.taskTextDarkColor = this.taskTextDarkColor || this.textColor;\n this.taskTextClickableColor = this.taskTextClickableColor || '#003163';\n\n /* Sequence Diagram variables */\n\n this.personBorder = this.personBorder || this.primaryBorderColor;\n this.personBkg = this.personBkg || this.mainBkg;\n\n /* state colors */\n this.transitionColor = this.transitionColor || this.lineColor;\n this.transitionLabelColor = this.transitionLabelColor || this.textColor;\n /* The color of the text tables of the states*/\n this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;\n\n this.stateBkg = this.stateBkg || this.mainBkg;\n this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;\n this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;\n this.altBackground = this.altBackground || this.tertiaryColor;\n this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;\n this.compositeBorder = this.compositeBorder || this.nodeBorder;\n this.innerEndBackground = this.nodeBorder;\n this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;\n this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;\n this.transitionColor = this.transitionColor || this.lineColor;\n this.specialStateColor = this.lineColor;\n\n /* Color Scale */\n /* Each color-set will have a background, a foreground and a border color */\n this.cScale0 = this.cScale0 || this.primaryColor;\n this.cScale1 = this.cScale1 || this.secondaryColor;\n this.cScale2 = this.cScale2 || this.tertiaryColor;\n this.cScale3 = this.cScale3 || adjust(this.primaryColor, { h: 30 });\n this.cScale4 = this.cScale4 || adjust(this.primaryColor, { h: 60 });\n this.cScale5 = this.cScale5 || adjust(this.primaryColor, { h: 90 });\n this.cScale6 = this.cScale6 || adjust(this.primaryColor, { h: 120 });\n this.cScale7 = this.cScale7 || adjust(this.primaryColor, { h: 150 });\n this.cScale8 = this.cScale8 || adjust(this.primaryColor, { h: 210, l: 150 });\n this.cScale9 = this.cScale9 || adjust(this.primaryColor, { h: 270 });\n this.cScale10 = this.cScale10 || adjust(this.primaryColor, { h: 300 });\n this.cScale11 = this.cScale11 || adjust(this.primaryColor, { h: 330 });\n if (this.darkMode) {\n for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {\n this['cScale' + i] = darken(this['cScale' + i], 75);\n }\n } else {\n for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {\n this['cScale' + i] = darken(this['cScale' + i], 25);\n }\n }\n\n // Setup the inverted color for the set\n for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {\n this['cScaleInv' + i] = this['cScaleInv' + i] || invert(this['cScale' + i]);\n }\n // Setup the peer color for the set, useful for borders\n for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {\n if (this.darkMode) {\n this['cScalePeer' + i] = this['cScalePeer' + i] || lighten(this['cScale' + i], 10);\n } else {\n this['cScalePeer' + i] = this['cScalePeer' + i] || darken(this['cScale' + i], 10);\n }\n }\n\n // Setup the label color for the set\n this.scaleLabelColor = this.scaleLabelColor || this.labelTextColor;\n\n for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {\n this['cScaleLabel' + i] = this['cScaleLabel' + i] || this.scaleLabelColor;\n }\n\n const multiplier = this.darkMode ? -4 : -1;\n for (let i = 0; i < 5; i++) {\n this['surface' + i] =\n this['surface' + i] ||\n adjust(this.mainBkg, { h: 180, s: -15, l: multiplier * (5 + i * 3) });\n this['surfacePeer' + i] =\n this['surfacePeer' + i] ||\n adjust(this.mainBkg, { h: 180, s: -15, l: multiplier * (8 + i * 3) });\n }\n\n /* class */\n this.classText = this.classText || this.textColor;\n\n /* user-journey */\n this.fillType0 = this.fillType0 || this.primaryColor;\n this.fillType1 = this.fillType1 || this.secondaryColor;\n this.fillType2 = this.fillType2 || adjust(this.primaryColor, { h: 64 });\n this.fillType3 = this.fillType3 || adjust(this.secondaryColor, { h: 64 });\n this.fillType4 = this.fillType4 || adjust(this.primaryColor, { h: -64 });\n this.fillType5 = this.fillType5 || adjust(this.secondaryColor, { h: -64 });\n this.fillType6 = this.fillType6 || adjust(this.primaryColor, { h: 128 });\n this.fillType7 = this.fillType7 || adjust(this.secondaryColor, { h: 128 });\n\n /* pie */\n this.pie1 = this.pie1 || this.primaryColor;\n this.pie2 = this.pie2 || this.secondaryColor;\n this.pie3 = this.pie3 || this.tertiaryColor;\n this.pie4 = this.pie4 || adjust(this.primaryColor, { l: -10 });\n this.pie5 = this.pie5 || adjust(this.secondaryColor, { l: -10 });\n this.pie6 = this.pie6 || adjust(this.tertiaryColor, { l: -10 });\n this.pie7 = this.pie7 || adjust(this.primaryColor, { h: +60, l: -10 });\n this.pie8 = this.pie8 || adjust(this.primaryColor, { h: -60, l: -10 });\n this.pie9 = this.pie9 || adjust(this.primaryColor, { h: 120, l: 0 });\n this.pie10 = this.pie10 || adjust(this.primaryColor, { h: +60, l: -20 });\n this.pie11 = this.pie11 || adjust(this.primaryColor, { h: -60, l: -20 });\n this.pie12 = this.pie12 || adjust(this.primaryColor, { h: 120, l: -10 });\n this.pieTitleTextSize = this.pieTitleTextSize || '25px';\n this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;\n this.pieSectionTextSize = this.pieSectionTextSize || '17px';\n this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;\n this.pieLegendTextSize = this.pieLegendTextSize || '17px';\n this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;\n this.pieStrokeColor = this.pieStrokeColor || 'black';\n this.pieStrokeWidth = this.pieStrokeWidth || '2px';\n this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || '2px';\n this.pieOuterStrokeColor = this.pieOuterStrokeColor || 'black';\n this.pieOpacity = this.pieOpacity || '0.7';\n\n /* architecture */\n this.archEdgeColor = this.archEdgeColor || '#777';\n this.archEdgeArrowColor = this.archEdgeArrowColor || '#777';\n this.archEdgeWidth = this.archEdgeWidth || '3';\n this.archGroupBorderColor = this.archGroupBorderColor || '#000';\n this.archGroupBorderWidth = this.archGroupBorderWidth || '2px';\n\n /* quadrant-graph */\n this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;\n this.quadrant2Fill = this.quadrant2Fill || adjust(this.primaryColor, { r: 5, g: 5, b: 5 });\n this.quadrant3Fill = this.quadrant3Fill || adjust(this.primaryColor, { r: 10, g: 10, b: 10 });\n this.quadrant4Fill = this.quadrant4Fill || adjust(this.primaryColor, { r: 15, g: 15, b: 15 });\n this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;\n this.quadrant2TextFill =\n this.quadrant2TextFill || adjust(this.primaryTextColor, { r: -5, g: -5, b: -5 });\n this.quadrant3TextFill =\n this.quadrant3TextFill || adjust(this.primaryTextColor, { r: -10, g: -10, b: -10 });\n this.quadrant4TextFill =\n this.quadrant4TextFill || adjust(this.primaryTextColor, { r: -15, g: -15, b: -15 });\n this.quadrantPointFill =\n this.quadrantPointFill || isDark(this.quadrant1Fill)\n ? lighten(this.quadrant1Fill)\n : darken(this.quadrant1Fill);\n this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;\n this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;\n this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;\n this.quadrantInternalBorderStrokeFill =\n this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;\n this.quadrantExternalBorderStrokeFill =\n this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;\n this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;\n\n /* xychart */\n this.xyChart = {\n backgroundColor: this.xyChart?.backgroundColor || this.background,\n titleColor: this.xyChart?.titleColor || this.primaryTextColor,\n xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor,\n xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor,\n xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor,\n xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor,\n yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor,\n yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor,\n yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor,\n yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor,\n plotColorPalette:\n this.xyChart?.plotColorPalette ||\n '#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0',\n };\n\n /* requirement-diagram */\n this.requirementBackground = this.requirementBackground || this.primaryColor;\n this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;\n this.requirementBorderSize = this.requirementBorderSize || '1';\n this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;\n this.relationColor = this.relationColor || this.lineColor;\n this.relationLabelBackground =\n this.relationLabelBackground ||\n (this.darkMode ? darken(this.secondaryColor, 30) : this.secondaryColor);\n this.relationLabelColor = this.relationLabelColor || this.actorTextColor;\n\n /* git */\n this.git0 = this.git0 || this.primaryColor;\n this.git1 = this.git1 || this.secondaryColor;\n this.git2 = this.git2 || this.tertiaryColor;\n this.git3 = this.git3 || adjust(this.primaryColor, { h: -30 });\n this.git4 = this.git4 || adjust(this.primaryColor, { h: -60 });\n this.git5 = this.git5 || adjust(this.primaryColor, { h: -90 });\n this.git6 = this.git6 || adjust(this.primaryColor, { h: +60 });\n this.git7 = this.git7 || adjust(this.primaryColor, { h: +120 });\n if (this.darkMode) {\n this.git0 = lighten(this.git0, 25);\n this.git1 = lighten(this.git1, 25);\n this.git2 = lighten(this.git2, 25);\n this.git3 = lighten(this.git3, 25);\n this.git4 = lighten(this.git4, 25);\n this.git5 = lighten(this.git5, 25);\n this.git6 = lighten(this.git6, 25);\n this.git7 = lighten(this.git7, 25);\n } else {\n this.git0 = darken(this.git0, 25);\n this.git1 = darken(this.git1, 25);\n this.git2 = darken(this.git2, 25);\n this.git3 = darken(this.git3, 25);\n this.git4 = darken(this.git4, 25);\n this.git5 = darken(this.git5, 25);\n this.git6 = darken(this.git6, 25);\n this.git7 = darken(this.git7, 25);\n }\n this.gitInv0 = this.gitInv0 || invert(this.git0);\n this.gitInv1 = this.gitInv1 || invert(this.git1);\n this.gitInv2 = this.gitInv2 || invert(this.git2);\n this.gitInv3 = this.gitInv3 || invert(this.git3);\n this.gitInv4 = this.gitInv4 || invert(this.git4);\n this.gitInv5 = this.gitInv5 || invert(this.git5);\n this.gitInv6 = this.gitInv6 || invert(this.git6);\n this.gitInv7 = this.gitInv7 || invert(this.git7);\n this.branchLabelColor =\n this.branchLabelColor || (this.darkMode ? 'black' : this.labelTextColor);\n this.gitBranchLabel0 = this.gitBranchLabel0 || this.branchLabelColor;\n this.gitBranchLabel1 = this.gitBranchLabel1 || this.branchLabelColor;\n this.gitBranchLabel2 = this.gitBranchLabel2 || this.branchLabelColor;\n this.gitBranchLabel3 = this.gitBranchLabel3 || this.branchLabelColor;\n this.gitBranchLabel4 = this.gitBranchLabel4 || this.branchLabelColor;\n this.gitBranchLabel5 = this.gitBranchLabel5 || this.branchLabelColor;\n this.gitBranchLabel6 = this.gitBranchLabel6 || this.branchLabelColor;\n this.gitBranchLabel7 = this.gitBranchLabel7 || this.branchLabelColor;\n\n this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;\n this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;\n this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;\n this.tagLabelFontSize = this.tagLabelFontSize || '10px';\n this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;\n this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;\n this.commitLabelFontSize = this.commitLabelFontSize || '10px';\n\n /* -------------------------------------------------- */\n /* EntityRelationship diagrams */\n\n this.attributeBackgroundColorOdd =\n this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;\n this.attributeBackgroundColorEven =\n this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;\n /* -------------------------------------------------- */\n }\n calculate(overrides) {\n if (typeof overrides !== 'object') {\n // Calculate colors form base colors\n this.updateColors();\n return;\n }\n\n const keys = Object.keys(overrides);\n\n // Copy values from overrides, this is mainly for base colors\n keys.forEach((k) => {\n this[k] = overrides[k];\n });\n\n // Calculate colors form base colors\n this.updateColors();\n // Copy values from overrides again in case of an override of derived value\n keys.forEach((k) => {\n this[k] = overrides[k];\n });\n }\n}\n\nexport const getThemeVariables = (userOverrides) => {\n const theme = new Theme();\n theme.calculate(userOverrides);\n return theme;\n};\n", "import { adjust, darken, invert, isDark, lighten, rgba } from 'khroma';\nimport { mkBorder } from './theme-helpers.js';\n\nclass Theme {\n constructor() {\n this.background = '#333';\n this.primaryColor = '#1f2020';\n this.secondaryColor = lighten(this.primaryColor, 16);\n this.tertiaryColor = adjust(this.primaryColor, { h: -160 });\n this.primaryBorderColor = invert(this.background);\n this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);\n this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);\n this.primaryTextColor = invert(this.primaryColor);\n this.secondaryTextColor = invert(this.secondaryColor);\n this.tertiaryTextColor = invert(this.tertiaryColor);\n this.lineColor = invert(this.background);\n this.textColor = invert(this.background);\n\n this.mainBkg = '#1f2020';\n this.secondBkg = 'calculated';\n this.mainContrastColor = 'lightgrey';\n this.darkTextColor = lighten(invert('#323D47'), 10);\n this.lineColor = 'calculated';\n this.border1 = '#ccc';\n this.border2 = rgba(255, 255, 255, 0.25);\n this.arrowheadColor = 'calculated';\n this.fontFamily = '\"trebuchet ms\", verdana, arial, sans-serif';\n this.fontSize = '16px';\n this.labelBackground = '#181818';\n this.textColor = '#ccc';\n this.THEME_COLOR_LIMIT = 12;\n\n /* Flowchart variables */\n this.nodeBkg = 'calculated';\n this.nodeBorder = 'calculated';\n this.clusterBkg = 'calculated';\n this.clusterBorder = 'calculated';\n this.defaultLinkColor = 'calculated';\n this.titleColor = '#F9FFFE';\n this.edgeLabelBackground = 'calculated';\n\n /* Sequence Diagram variables */\n\n this.actorBorder = 'calculated';\n this.actorBkg = 'calculated';\n this.actorTextColor = 'calculated';\n this.actorLineColor = 'calculated';\n this.signalColor = 'calculated';\n this.signalTextColor = 'calculated';\n this.labelBoxBkgColor = 'calculated';\n this.labelBoxBorderColor = 'calculated';\n this.labelTextColor = 'calculated';\n this.loopTextColor = 'calculated';\n this.noteBorderColor = 'calculated';\n this.noteBkgColor = '#fff5ad';\n this.noteTextColor = 'calculated';\n this.activationBorderColor = 'calculated';\n this.activationBkgColor = 'calculated';\n this.sequenceNumberColor = 'black';\n\n /* Gantt chart variables */\n\n this.sectionBkgColor = darken('#EAE8D9', 30);\n this.altSectionBkgColor = 'calculated';\n this.sectionBkgColor2 = '#EAE8D9';\n this.excludeBkgColor = darken(this.sectionBkgColor, 10);\n this.taskBorderColor = rgba(255, 255, 255, 70);\n this.taskBkgColor = 'calculated';\n this.taskTextColor = 'calculated';\n this.taskTextLightColor = 'calculated';\n this.taskTextOutsideColor = 'calculated';\n this.taskTextClickableColor = '#003163';\n this.activeTaskBorderColor = rgba(255, 255, 255, 50);\n this.activeTaskBkgColor = '#81B1DB';\n this.gridColor = 'calculated';\n this.doneTaskBkgColor = 'calculated';\n this.doneTaskBorderColor = 'grey';\n this.critBorderColor = '#E83737';\n this.critBkgColor = '#E83737';\n this.taskTextDarkColor = 'calculated';\n this.todayLineColor = '#DB5757';\n\n /* C4 Context Diagram variables */\n this.personBorder = this.primaryBorderColor;\n this.personBkg = this.mainBkg;\n\n /* Architecture Diagram variables */\n this.archEdgeColor = 'calculated';\n this.archEdgeArrowColor = 'calculated';\n this.archEdgeWidth = '3';\n this.archGroupBorderColor = this.primaryBorderColor;\n this.archGroupBorderWidth = '2px';\n\n /* state colors */\n this.labelColor = 'calculated';\n\n this.errorBkgColor = '#a44141';\n this.errorTextColor = '#ddd';\n }\n updateColors() {\n this.secondBkg = lighten(this.mainBkg, 16);\n this.lineColor = this.mainContrastColor;\n this.arrowheadColor = this.mainContrastColor;\n /* Flowchart variables */\n\n this.nodeBkg = this.mainBkg;\n this.nodeBorder = this.border1;\n this.clusterBkg = this.secondBkg;\n this.clusterBorder = this.border2;\n this.defaultLinkColor = this.lineColor;\n this.edgeLabelBackground = lighten(this.labelBackground, 25);\n\n /* Sequence Diagram variables */\n\n this.actorBorder = this.border1;\n this.actorBkg = this.mainBkg;\n this.actorTextColor = this.mainContrastColor;\n this.actorLineColor = this.actorBorder;\n this.signalColor = this.mainContrastColor;\n this.signalTextColor = this.mainContrastColor;\n this.labelBoxBkgColor = this.actorBkg;\n this.labelBoxBorderColor = this.actorBorder;\n this.labelTextColor = this.mainContrastColor;\n this.loopTextColor = this.mainContrastColor;\n this.noteBorderColor = this.secondaryBorderColor;\n this.noteBkgColor = this.secondBkg;\n this.noteTextColor = this.secondaryTextColor;\n this.activationBorderColor = this.border1;\n this.activationBkgColor = this.secondBkg;\n\n /* Gantt chart variables */\n\n this.altSectionBkgColor = this.background;\n this.taskBkgColor = lighten(this.mainBkg, 23);\n this.taskTextColor = this.darkTextColor;\n this.taskTextLightColor = this.mainContrastColor;\n this.taskTextOutsideColor = this.taskTextLightColor;\n this.gridColor = this.mainContrastColor;\n this.doneTaskBkgColor = this.mainContrastColor;\n this.taskTextDarkColor = this.darkTextColor;\n\n /* Architecture Diagram variables */\n this.archEdgeColor = this.lineColor;\n this.archEdgeArrowColor = this.lineColor;\n\n /* state colors */\n this.transitionColor = this.transitionColor || this.lineColor;\n this.transitionLabelColor = this.transitionLabelColor || this.textColor;\n this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;\n this.stateBkg = this.stateBkg || this.mainBkg;\n this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;\n this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;\n this.altBackground = this.altBackground || '#555';\n this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;\n this.compositeBorder = this.compositeBorder || this.nodeBorder;\n this.innerEndBackground = this.primaryBorderColor;\n this.specialStateColor = '#f4f4f4'; // this.lineColor;\n\n this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;\n this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;\n\n this.fillType0 = this.primaryColor;\n this.fillType1 = this.secondaryColor;\n this.fillType2 = adjust(this.primaryColor, { h: 64 });\n this.fillType3 = adjust(this.secondaryColor, { h: 64 });\n this.fillType4 = adjust(this.primaryColor, { h: -64 });\n this.fillType5 = adjust(this.secondaryColor, { h: -64 });\n this.fillType6 = adjust(this.primaryColor, { h: 128 });\n this.fillType7 = adjust(this.secondaryColor, { h: 128 });\n\n /* cScale */\n this.cScale1 = this.cScale1 || '#0b0000';\n this.cScale2 = this.cScale2 || '#4d1037';\n this.cScale3 = this.cScale3 || '#3f5258';\n this.cScale4 = this.cScale4 || '#4f2f1b';\n this.cScale5 = this.cScale5 || '#6e0a0a';\n this.cScale6 = this.cScale6 || '#3b0048';\n this.cScale7 = this.cScale7 || '#995a01';\n this.cScale8 = this.cScale8 || '#154706';\n this.cScale9 = this.cScale9 || '#161722';\n this.cScale10 = this.cScale10 || '#00296f';\n this.cScale11 = this.cScale11 || '#01629c';\n this.cScale12 = this.cScale12 || '#010029';\n\n /* Color Scale */\n /* Each color-set will have a background, a foreground and a border color */\n this.cScale0 = this.cScale0 || this.primaryColor;\n this.cScale1 = this.cScale1 || this.secondaryColor;\n this.cScale2 = this.cScale2 || this.tertiaryColor;\n this.cScale3 = this.cScale3 || adjust(this.primaryColor, { h: 30 });\n this.cScale4 = this.cScale4 || adjust(this.primaryColor, { h: 60 });\n this.cScale5 = this.cScale5 || adjust(this.primaryColor, { h: 90 });\n this.cScale6 = this.cScale6 || adjust(this.primaryColor, { h: 120 });\n this.cScale7 = this.cScale7 || adjust(this.primaryColor, { h: 150 });\n this.cScale8 = this.cScale8 || adjust(this.primaryColor, { h: 210 });\n this.cScale9 = this.cScale9 || adjust(this.primaryColor, { h: 270 });\n this.cScale10 = this.cScale10 || adjust(this.primaryColor, { h: 300 });\n this.cScale11 = this.cScale11 || adjust(this.primaryColor, { h: 330 });\n\n // Setup the inverted color for the set\n for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {\n this['cScaleInv' + i] = this['cScaleInv' + i] || invert(this['cScale' + i]);\n }\n // Setup the peer color for the set, useful for borders\n for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {\n this['cScalePeer' + i] = this['cScalePeer' + i] || lighten(this['cScale' + i], 10);\n }\n\n for (let i = 0; i < 5; i++) {\n this['surface' + i] =\n this['surface' + i] || adjust(this.mainBkg, { h: 30, s: -30, l: -(-10 + i * 4) });\n this['surfacePeer' + i] =\n this['surfacePeer' + i] || adjust(this.mainBkg, { h: 30, s: -30, l: -(-7 + i * 4) });\n }\n\n // Setup the label color for the set\n this.scaleLabelColor = this.scaleLabelColor || (this.darkMode ? 'black' : this.labelTextColor);\n\n for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {\n this['cScaleLabel' + i] = this['cScaleLabel' + i] || this.scaleLabelColor;\n }\n\n /* Pie diagram */\n for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {\n this['pie' + i] = this['cScale' + i];\n }\n this.pieTitleTextSize = this.pieTitleTextSize || '25px';\n this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;\n this.pieSectionTextSize = this.pieSectionTextSize || '17px';\n this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;\n this.pieLegendTextSize = this.pieLegendTextSize || '17px';\n this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;\n this.pieStrokeColor = this.pieStrokeColor || 'black';\n this.pieStrokeWidth = this.pieStrokeWidth || '2px';\n this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || '2px';\n this.pieOuterStrokeColor = this.pieOuterStrokeColor || 'black';\n this.pieOpacity = this.pieOpacity || '0.7';\n\n /* quadrant-graph */\n this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;\n this.quadrant2Fill = this.quadrant2Fill || adjust(this.primaryColor, { r: 5, g: 5, b: 5 });\n this.quadrant3Fill = this.quadrant3Fill || adjust(this.primaryColor, { r: 10, g: 10, b: 10 });\n this.quadrant4Fill = this.quadrant4Fill || adjust(this.primaryColor, { r: 15, g: 15, b: 15 });\n this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;\n this.quadrant2TextFill =\n this.quadrant2TextFill || adjust(this.primaryTextColor, { r: -5, g: -5, b: -5 });\n this.quadrant3TextFill =\n this.quadrant3TextFill || adjust(this.primaryTextColor, { r: -10, g: -10, b: -10 });\n this.quadrant4TextFill =\n this.quadrant4TextFill || adjust(this.primaryTextColor, { r: -15, g: -15, b: -15 });\n this.quadrantPointFill =\n this.quadrantPointFill || isDark(this.quadrant1Fill)\n ? lighten(this.quadrant1Fill)\n : darken(this.quadrant1Fill);\n this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;\n this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;\n this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;\n this.quadrantInternalBorderStrokeFill =\n this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;\n this.quadrantExternalBorderStrokeFill =\n this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;\n this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;\n\n /* xychart */\n this.xyChart = {\n backgroundColor: this.xyChart?.backgroundColor || this.background,\n titleColor: this.xyChart?.titleColor || this.primaryTextColor,\n xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor,\n xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor,\n xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor,\n xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor,\n yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor,\n yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor,\n yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor,\n yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor,\n plotColorPalette:\n this.xyChart?.plotColorPalette ||\n '#3498db,#2ecc71,#e74c3c,#f1c40f,#bdc3c7,#ffffff,#34495e,#9b59b6,#1abc9c,#e67e22',\n };\n\n this.packet = {\n startByteColor: this.primaryTextColor,\n endByteColor: this.primaryTextColor,\n labelColor: this.primaryTextColor,\n titleColor: this.primaryTextColor,\n blockStrokeColor: this.primaryTextColor,\n blockFillColor: this.background,\n };\n\n /* class */\n this.classText = this.primaryTextColor;\n\n /* requirement-diagram */\n this.requirementBackground = this.requirementBackground || this.primaryColor;\n this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;\n this.requirementBorderSize = this.requirementBorderSize || '1';\n this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;\n this.relationColor = this.relationColor || this.lineColor;\n this.relationLabelBackground =\n this.relationLabelBackground ||\n (this.darkMode ? darken(this.secondaryColor, 30) : this.secondaryColor);\n this.relationLabelColor = this.relationLabelColor || this.actorTextColor;\n\n /* git */\n this.git0 = lighten(this.secondaryColor, 20);\n this.git1 = lighten(this.pie2 || this.secondaryColor, 20);\n this.git2 = lighten(this.pie3 || this.tertiaryColor, 20);\n this.git3 = lighten(this.pie4 || adjust(this.primaryColor, { h: -30 }), 20);\n this.git4 = lighten(this.pie5 || adjust(this.primaryColor, { h: -60 }), 20);\n this.git5 = lighten(this.pie6 || adjust(this.primaryColor, { h: -90 }), 10);\n this.git6 = lighten(this.pie7 || adjust(this.primaryColor, { h: +60 }), 10);\n this.git7 = lighten(this.pie8 || adjust(this.primaryColor, { h: +120 }), 20);\n this.gitInv0 = this.gitInv0 || invert(this.git0);\n this.gitInv1 = this.gitInv1 || invert(this.git1);\n this.gitInv2 = this.gitInv2 || invert(this.git2);\n this.gitInv3 = this.gitInv3 || invert(this.git3);\n this.gitInv4 = this.gitInv4 || invert(this.git4);\n this.gitInv5 = this.gitInv5 || invert(this.git5);\n this.gitInv6 = this.gitInv6 || invert(this.git6);\n this.gitInv7 = this.gitInv7 || invert(this.git7);\n this.gitBranchLabel0 = this.gitBranchLabel0 || invert(this.labelTextColor);\n this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor;\n this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor;\n this.gitBranchLabel3 = this.gitBranchLabel3 || invert(this.labelTextColor);\n this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor;\n this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor;\n this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor;\n this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor;\n\n this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;\n this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;\n this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;\n this.tagLabelFontSize = this.tagLabelFontSize || '10px';\n this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;\n this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;\n this.commitLabelFontSize = this.commitLabelFontSize || '10px';\n\n /* -------------------------------------------------- */\n /* EntityRelationship diagrams */\n\n this.attributeBackgroundColorOdd =\n this.attributeBackgroundColorOdd || lighten(this.background, 12);\n this.attributeBackgroundColorEven =\n this.attributeBackgroundColorEven || lighten(this.background, 2);\n /* -------------------------------------------------- */\n\n this.nodeBorder = this.nodeBorder || '#999';\n }\n calculate(overrides) {\n if (typeof overrides !== 'object') {\n // Calculate colors form base colors\n this.updateColors();\n return;\n }\n\n const keys = Object.keys(overrides);\n\n // Copy values from overrides, this is mainly for base colors\n keys.forEach((k) => {\n this[k] = overrides[k];\n });\n\n // Calculate colors form base colors\n this.updateColors();\n // Copy values from overrides again in case of an override of derived value\n keys.forEach((k) => {\n this[k] = overrides[k];\n });\n }\n}\n\nexport const getThemeVariables = (userOverrides) => {\n const theme = new Theme();\n theme.calculate(userOverrides);\n return theme;\n};\n", "import { invert, lighten, rgba, adjust, darken, isDark } from 'khroma';\nimport { mkBorder } from './theme-helpers.js';\nimport {\n oldAttributeBackgroundColorEven,\n oldAttributeBackgroundColorOdd,\n} from './erDiagram-oldHardcodedValues.js';\n\nclass Theme {\n constructor() {\n /* Base variables */\n this.background = '#f4f4f4';\n this.primaryColor = '#ECECFF';\n\n this.secondaryColor = adjust(this.primaryColor, { h: 120 });\n this.secondaryColor = '#ffffde';\n this.tertiaryColor = adjust(this.primaryColor, { h: -160 });\n this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);\n this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);\n this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);\n // this.noteBorderColor = mkBorder(this.noteBkgColor, this.darkMode);\n\n this.primaryTextColor = invert(this.primaryColor);\n this.secondaryTextColor = invert(this.secondaryColor);\n this.tertiaryTextColor = invert(this.tertiaryColor);\n this.lineColor = invert(this.background);\n this.textColor = invert(this.background);\n\n this.background = 'white';\n this.mainBkg = '#ECECFF';\n this.secondBkg = '#ffffde';\n this.lineColor = '#333333';\n this.border1 = '#9370DB';\n this.border2 = '#aaaa33';\n this.arrowheadColor = '#333333';\n this.fontFamily = '\"trebuchet ms\", verdana, arial, sans-serif';\n this.fontSize = '16px';\n this.labelBackground = 'rgba(232,232,232, 0.8)';\n this.textColor = '#333';\n this.THEME_COLOR_LIMIT = 12;\n\n /* Flowchart variables */\n\n this.nodeBkg = 'calculated';\n this.nodeBorder = 'calculated';\n this.clusterBkg = 'calculated';\n this.clusterBorder = 'calculated';\n this.defaultLinkColor = 'calculated';\n this.titleColor = 'calculated';\n this.edgeLabelBackground = 'calculated';\n\n /* Sequence Diagram variables */\n\n this.actorBorder = 'calculated';\n this.actorBkg = 'calculated';\n this.actorTextColor = 'black';\n this.actorLineColor = 'calculated';\n this.signalColor = 'calculated';\n this.signalTextColor = 'calculated';\n this.labelBoxBkgColor = 'calculated';\n this.labelBoxBorderColor = 'calculated';\n this.labelTextColor = 'calculated';\n this.loopTextColor = 'calculated';\n this.noteBorderColor = 'calculated';\n this.noteBkgColor = '#fff5ad';\n this.noteTextColor = 'calculated';\n this.activationBorderColor = '#666';\n this.activationBkgColor = '#f4f4f4';\n this.sequenceNumberColor = 'white';\n\n /* Gantt chart variables */\n\n this.sectionBkgColor = 'calculated';\n this.altSectionBkgColor = 'calculated';\n this.sectionBkgColor2 = 'calculated';\n this.excludeBkgColor = '#eeeeee';\n this.taskBorderColor = 'calculated';\n this.taskBkgColor = 'calculated';\n this.taskTextLightColor = 'calculated';\n this.taskTextColor = this.taskTextLightColor;\n this.taskTextDarkColor = 'calculated';\n this.taskTextOutsideColor = this.taskTextDarkColor;\n this.taskTextClickableColor = 'calculated';\n this.activeTaskBorderColor = 'calculated';\n this.activeTaskBkgColor = 'calculated';\n this.gridColor = 'calculated';\n this.doneTaskBkgColor = 'calculated';\n this.doneTaskBorderColor = 'calculated';\n this.critBorderColor = 'calculated';\n this.critBkgColor = 'calculated';\n this.todayLineColor = 'calculated';\n\n this.sectionBkgColor = rgba(102, 102, 255, 0.49);\n this.altSectionBkgColor = 'white';\n this.sectionBkgColor2 = '#fff400';\n this.taskBorderColor = '#534fbc';\n this.taskBkgColor = '#8a90dd';\n this.taskTextLightColor = 'white';\n this.taskTextColor = 'calculated';\n this.taskTextDarkColor = 'black';\n this.taskTextOutsideColor = 'calculated';\n this.taskTextClickableColor = '#003163';\n this.activeTaskBorderColor = '#534fbc';\n this.activeTaskBkgColor = '#bfc7ff';\n this.gridColor = 'lightgrey';\n this.doneTaskBkgColor = 'lightgrey';\n this.doneTaskBorderColor = 'grey';\n this.critBorderColor = '#ff8888';\n this.critBkgColor = 'red';\n this.todayLineColor = 'red';\n\n /* C4 Context Diagram variables */\n this.personBorder = this.primaryBorderColor;\n this.personBkg = this.mainBkg;\n\n /* Architecture Diagram variables */\n this.archEdgeColor = 'calculated';\n this.archEdgeArrowColor = 'calculated';\n this.archEdgeWidth = '3';\n this.archGroupBorderColor = this.primaryBorderColor;\n this.archGroupBorderWidth = '2px';\n\n /* state colors */\n this.labelColor = 'black';\n this.errorBkgColor = '#552222';\n this.errorTextColor = '#552222';\n this.updateColors();\n }\n updateColors() {\n /* Color Scale */\n /* Each color-set will have a background, a foreground and a border color */\n\n this.cScale0 = this.cScale0 || this.primaryColor;\n this.cScale1 = this.cScale1 || this.secondaryColor;\n this.cScale2 = this.cScale2 || this.tertiaryColor;\n this.cScale3 = this.cScale3 || adjust(this.primaryColor, { h: 30 });\n this.cScale4 = this.cScale4 || adjust(this.primaryColor, { h: 60 });\n this.cScale5 = this.cScale5 || adjust(this.primaryColor, { h: 90 });\n this.cScale6 = this.cScale6 || adjust(this.primaryColor, { h: 120 });\n this.cScale7 = this.cScale7 || adjust(this.primaryColor, { h: 150 });\n this.cScale8 = this.cScale8 || adjust(this.primaryColor, { h: 210 });\n this.cScale9 = this.cScale9 || adjust(this.primaryColor, { h: 270 });\n this.cScale10 = this.cScale10 || adjust(this.primaryColor, { h: 300 });\n this.cScale11 = this.cScale11 || adjust(this.primaryColor, { h: 330 });\n this['cScalePeer' + 1] = this['cScalePeer' + 1] || darken(this.secondaryColor, 45);\n this['cScalePeer' + 2] = this['cScalePeer' + 2] || darken(this.tertiaryColor, 40);\n for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {\n // Setup the peer color for the set, useful for borders\n this['cScale' + i] = darken(this['cScale' + i], 10);\n this['cScalePeer' + i] = this['cScalePeer' + i] || darken(this['cScale' + i], 25);\n }\n // Setup the inverted color for the set\n for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {\n this['cScaleInv' + i] = this['cScaleInv' + i] || adjust(this['cScale' + i], { h: 180 });\n }\n\n for (let i = 0; i < 5; i++) {\n this['surface' + i] = this['surface' + i] || adjust(this.mainBkg, { h: 30, l: -(5 + i * 5) });\n this['surfacePeer' + i] =\n this['surfacePeer' + i] || adjust(this.mainBkg, { h: 30, l: -(7 + i * 5) });\n }\n // Setup the label color for the set\n this.scaleLabelColor =\n this.scaleLabelColor !== 'calculated' && this.scaleLabelColor\n ? this.scaleLabelColor\n : this.labelTextColor;\n\n if (this.labelTextColor !== 'calculated') {\n this.cScaleLabel0 = this.cScaleLabel0 || invert(this.labelTextColor);\n this.cScaleLabel3 = this.cScaleLabel3 || invert(this.labelTextColor);\n for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {\n this['cScaleLabel' + i] = this['cScaleLabel' + i] || this.labelTextColor;\n }\n }\n\n /* Flowchart variables */\n this.nodeBkg = this.mainBkg;\n this.nodeBorder = this.border1; // border 1\n this.clusterBkg = this.secondBkg;\n this.clusterBorder = this.border2;\n this.defaultLinkColor = this.lineColor;\n this.titleColor = this.textColor;\n this.edgeLabelBackground = this.labelBackground;\n\n /* Sequence Diagram variables */\n\n // this.actorBorder = lighten(this.border1, 0.5);\n this.actorBorder = lighten(this.border1, 23);\n this.actorBkg = this.mainBkg;\n this.labelBoxBkgColor = this.actorBkg;\n this.signalColor = this.textColor;\n this.signalTextColor = this.textColor;\n this.labelBoxBorderColor = this.actorBorder;\n this.labelTextColor = this.actorTextColor;\n this.loopTextColor = this.actorTextColor;\n this.noteBorderColor = this.border2;\n this.noteTextColor = this.actorTextColor;\n this.actorLineColor = this.actorBorder;\n\n /* Gantt chart variables */\n\n this.taskTextColor = this.taskTextLightColor;\n this.taskTextOutsideColor = this.taskTextDarkColor;\n\n /* Architecture Diagram variables */\n this.archEdgeColor = this.lineColor;\n this.archEdgeArrowColor = this.lineColor;\n\n /* state colors */\n this.transitionColor = this.transitionColor || this.lineColor;\n this.transitionLabelColor = this.transitionLabelColor || this.textColor;\n this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;\n\n this.stateBkg = this.stateBkg || this.mainBkg;\n this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;\n this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;\n this.altBackground = this.altBackground || '#f0f0f0';\n this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;\n this.compositeBorder = this.compositeBorder || this.nodeBorder;\n this.innerEndBackground = this.nodeBorder;\n this.specialStateColor = this.lineColor;\n\n this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;\n this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;\n this.transitionColor = this.transitionColor || this.lineColor;\n /* class */\n this.classText = this.primaryTextColor;\n /* journey */\n this.fillType0 = this.primaryColor;\n this.fillType1 = this.secondaryColor;\n this.fillType2 = adjust(this.primaryColor, { h: 64 });\n this.fillType3 = adjust(this.secondaryColor, { h: 64 });\n this.fillType4 = adjust(this.primaryColor, { h: -64 });\n this.fillType5 = adjust(this.secondaryColor, { h: -64 });\n this.fillType6 = adjust(this.primaryColor, { h: 128 });\n this.fillType7 = adjust(this.secondaryColor, { h: 128 });\n\n /* pie */\n this.pie1 = this.pie1 || this.primaryColor;\n this.pie2 = this.pie2 || this.secondaryColor;\n this.pie3 = this.pie3 || adjust(this.tertiaryColor, { l: -40 });\n this.pie4 = this.pie4 || adjust(this.primaryColor, { l: -10 });\n this.pie5 = this.pie5 || adjust(this.secondaryColor, { l: -30 });\n this.pie6 = this.pie6 || adjust(this.tertiaryColor, { l: -20 });\n this.pie7 = this.pie7 || adjust(this.primaryColor, { h: +60, l: -20 });\n this.pie8 = this.pie8 || adjust(this.primaryColor, { h: -60, l: -40 });\n this.pie9 = this.pie9 || adjust(this.primaryColor, { h: 120, l: -40 });\n this.pie10 = this.pie10 || adjust(this.primaryColor, { h: +60, l: -40 });\n this.pie11 = this.pie11 || adjust(this.primaryColor, { h: -90, l: -40 });\n this.pie12 = this.pie12 || adjust(this.primaryColor, { h: 120, l: -30 });\n this.pieTitleTextSize = this.pieTitleTextSize || '25px';\n this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;\n this.pieSectionTextSize = this.pieSectionTextSize || '17px';\n this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;\n this.pieLegendTextSize = this.pieLegendTextSize || '17px';\n this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;\n this.pieStrokeColor = this.pieStrokeColor || 'black';\n this.pieStrokeWidth = this.pieStrokeWidth || '2px';\n this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || '2px';\n this.pieOuterStrokeColor = this.pieOuterStrokeColor || 'black';\n this.pieOpacity = this.pieOpacity || '0.7';\n\n /* quadrant-graph */\n this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;\n this.quadrant2Fill = this.quadrant2Fill || adjust(this.primaryColor, { r: 5, g: 5, b: 5 });\n this.quadrant3Fill = this.quadrant3Fill || adjust(this.primaryColor, { r: 10, g: 10, b: 10 });\n this.quadrant4Fill = this.quadrant4Fill || adjust(this.primaryColor, { r: 15, g: 15, b: 15 });\n this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;\n this.quadrant2TextFill =\n this.quadrant2TextFill || adjust(this.primaryTextColor, { r: -5, g: -5, b: -5 });\n this.quadrant3TextFill =\n this.quadrant3TextFill || adjust(this.primaryTextColor, { r: -10, g: -10, b: -10 });\n this.quadrant4TextFill =\n this.quadrant4TextFill || adjust(this.primaryTextColor, { r: -15, g: -15, b: -15 });\n this.quadrantPointFill =\n this.quadrantPointFill || isDark(this.quadrant1Fill)\n ? lighten(this.quadrant1Fill)\n : darken(this.quadrant1Fill);\n this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;\n this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;\n this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;\n this.quadrantInternalBorderStrokeFill =\n this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;\n this.quadrantExternalBorderStrokeFill =\n this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;\n this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;\n\n /* xychart */\n this.xyChart = {\n backgroundColor: this.xyChart?.backgroundColor || this.background,\n titleColor: this.xyChart?.titleColor || this.primaryTextColor,\n xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor,\n xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor,\n xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor,\n xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor,\n yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor,\n yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor,\n yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor,\n yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor,\n plotColorPalette:\n this.xyChart?.plotColorPalette ||\n '#ECECFF,#8493A6,#FFC3A0,#DCDDE1,#B8E994,#D1A36F,#C3CDE6,#FFB6C1,#496078,#F8F3E3',\n };\n\n /* requirement-diagram */\n this.requirementBackground = this.requirementBackground || this.primaryColor;\n this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;\n this.requirementBorderSize = this.requirementBorderSize || '1';\n this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;\n this.relationColor = this.relationColor || this.lineColor;\n this.relationLabelBackground = this.relationLabelBackground || this.labelBackground;\n this.relationLabelColor = this.relationLabelColor || this.actorTextColor;\n\n /* git */\n this.git0 = this.git0 || this.primaryColor;\n this.git1 = this.git1 || this.secondaryColor;\n this.git2 = this.git2 || this.tertiaryColor;\n this.git3 = this.git3 || adjust(this.primaryColor, { h: -30 });\n this.git4 = this.git4 || adjust(this.primaryColor, { h: -60 });\n this.git5 = this.git5 || adjust(this.primaryColor, { h: -90 });\n this.git6 = this.git6 || adjust(this.primaryColor, { h: +60 });\n this.git7 = this.git7 || adjust(this.primaryColor, { h: +120 });\n if (this.darkMode) {\n this.git0 = lighten(this.git0, 25);\n this.git1 = lighten(this.git1, 25);\n this.git2 = lighten(this.git2, 25);\n this.git3 = lighten(this.git3, 25);\n this.git4 = lighten(this.git4, 25);\n this.git5 = lighten(this.git5, 25);\n this.git6 = lighten(this.git6, 25);\n this.git7 = lighten(this.git7, 25);\n } else {\n this.git0 = darken(this.git0, 25);\n this.git1 = darken(this.git1, 25);\n this.git2 = darken(this.git2, 25);\n this.git3 = darken(this.git3, 25);\n this.git4 = darken(this.git4, 25);\n this.git5 = darken(this.git5, 25);\n this.git6 = darken(this.git6, 25);\n this.git7 = darken(this.git7, 25);\n }\n this.gitInv0 = this.gitInv0 || darken(invert(this.git0), 25);\n this.gitInv1 = this.gitInv1 || invert(this.git1);\n this.gitInv2 = this.gitInv2 || invert(this.git2);\n this.gitInv3 = this.gitInv3 || invert(this.git3);\n this.gitInv4 = this.gitInv4 || invert(this.git4);\n this.gitInv5 = this.gitInv5 || invert(this.git5);\n this.gitInv6 = this.gitInv6 || invert(this.git6);\n this.gitInv7 = this.gitInv7 || invert(this.git7);\n this.gitBranchLabel0 = this.gitBranchLabel0 || invert(this.labelTextColor);\n this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor;\n this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor;\n this.gitBranchLabel3 = this.gitBranchLabel3 || invert(this.labelTextColor);\n this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor;\n this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor;\n this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor;\n this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor;\n\n this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;\n this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;\n this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;\n this.tagLabelFontSize = this.tagLabelFontSize || '10px';\n this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;\n this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;\n this.commitLabelFontSize = this.commitLabelFontSize || '10px';\n\n /* -------------------------------------------------- */\n /* EntityRelationship diagrams */\n\n this.attributeBackgroundColorOdd =\n this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;\n this.attributeBackgroundColorEven =\n this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;\n /* -------------------------------------------------- */\n }\n calculate(overrides) {\n if (typeof overrides !== 'object') {\n // Calculate colors form base colors\n this.updateColors();\n return;\n }\n\n const keys = Object.keys(overrides);\n\n // Copy values from overrides, this is mainly for base colors\n keys.forEach((k) => {\n this[k] = overrides[k];\n });\n\n // Calculate colors form base colors\n this.updateColors();\n // Copy values from overrides again in case of an override of derived value\n keys.forEach((k) => {\n this[k] = overrides[k];\n });\n }\n}\n\nexport const getThemeVariables = (userOverrides) => {\n const theme = new Theme();\n theme.calculate(userOverrides);\n return theme;\n};\n", "import { adjust, darken, invert, isDark, lighten } from 'khroma';\nimport {\n oldAttributeBackgroundColorEven,\n oldAttributeBackgroundColorOdd,\n} from './erDiagram-oldHardcodedValues.js';\nimport { mkBorder } from './theme-helpers.js';\n\nclass Theme {\n constructor() {\n /* Base vales */\n this.background = '#f4f4f4';\n this.primaryColor = '#cde498';\n this.secondaryColor = '#cdffb2';\n this.background = 'white';\n this.mainBkg = '#cde498';\n this.secondBkg = '#cdffb2';\n this.lineColor = 'green';\n this.border1 = '#13540c';\n this.border2 = '#6eaa49';\n this.arrowheadColor = 'green';\n this.fontFamily = '\"trebuchet ms\", verdana, arial, sans-serif';\n this.fontSize = '16px';\n\n this.tertiaryColor = lighten('#cde498', 10);\n this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);\n this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);\n this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);\n this.primaryTextColor = invert(this.primaryColor);\n this.secondaryTextColor = invert(this.secondaryColor);\n this.tertiaryTextColor = invert(this.primaryColor);\n this.lineColor = invert(this.background);\n this.textColor = invert(this.background);\n this.THEME_COLOR_LIMIT = 12;\n\n /* Flowchart variables */\n this.nodeBkg = 'calculated';\n this.nodeBorder = 'calculated';\n this.clusterBkg = 'calculated';\n this.clusterBorder = 'calculated';\n this.defaultLinkColor = 'calculated';\n this.titleColor = '#333';\n this.edgeLabelBackground = '#e8e8e8';\n\n /* Sequence Diagram variables */\n\n this.actorBorder = 'calculated';\n this.actorBkg = 'calculated';\n this.actorTextColor = 'black';\n this.actorLineColor = 'calculated';\n this.signalColor = '#333';\n this.signalTextColor = '#333';\n this.labelBoxBkgColor = 'calculated';\n this.labelBoxBorderColor = '#326932';\n this.labelTextColor = 'calculated';\n this.loopTextColor = 'calculated';\n this.noteBorderColor = 'calculated';\n this.noteBkgColor = '#fff5ad';\n this.noteTextColor = 'calculated';\n this.activationBorderColor = '#666';\n this.activationBkgColor = '#f4f4f4';\n this.sequenceNumberColor = 'white';\n\n /* Gantt chart variables */\n\n this.sectionBkgColor = '#6eaa49';\n this.altSectionBkgColor = 'white';\n this.sectionBkgColor2 = '#6eaa49';\n this.excludeBkgColor = '#eeeeee';\n this.taskBorderColor = 'calculated';\n this.taskBkgColor = '#487e3a';\n this.taskTextLightColor = 'white';\n this.taskTextColor = 'calculated';\n this.taskTextDarkColor = 'black';\n this.taskTextOutsideColor = 'calculated';\n this.taskTextClickableColor = '#003163';\n this.activeTaskBorderColor = 'calculated';\n this.activeTaskBkgColor = 'calculated';\n this.gridColor = 'lightgrey';\n this.doneTaskBkgColor = 'lightgrey';\n this.doneTaskBorderColor = 'grey';\n this.critBorderColor = '#ff8888';\n this.critBkgColor = 'red';\n this.todayLineColor = 'red';\n\n /* C4 Context Diagram variables */\n this.personBorder = this.primaryBorderColor;\n this.personBkg = this.mainBkg;\n\n /* Architecture Diagram variables */\n this.archEdgeColor = 'calculated';\n this.archEdgeArrowColor = 'calculated';\n this.archEdgeWidth = '3';\n this.archGroupBorderColor = this.primaryBorderColor;\n this.archGroupBorderWidth = '2px';\n\n /* state colors */\n this.labelColor = 'black';\n\n this.errorBkgColor = '#552222';\n this.errorTextColor = '#552222';\n }\n updateColors() {\n /* Sequence Diagram variables */\n this.actorBorder = darken(this.mainBkg, 20);\n this.actorBkg = this.mainBkg;\n this.labelBoxBkgColor = this.actorBkg;\n this.labelTextColor = this.actorTextColor;\n this.loopTextColor = this.actorTextColor;\n this.noteBorderColor = this.border2;\n this.noteTextColor = this.actorTextColor;\n this.actorLineColor = this.actorBorder;\n\n /* Each color-set will have a background, a foreground and a border color */\n this.cScale0 = this.cScale0 || this.primaryColor;\n this.cScale1 = this.cScale1 || this.secondaryColor;\n this.cScale2 = this.cScale2 || this.tertiaryColor;\n this.cScale3 = this.cScale3 || adjust(this.primaryColor, { h: 30 });\n this.cScale4 = this.cScale4 || adjust(this.primaryColor, { h: 60 });\n this.cScale5 = this.cScale5 || adjust(this.primaryColor, { h: 90 });\n this.cScale6 = this.cScale6 || adjust(this.primaryColor, { h: 120 });\n this.cScale7 = this.cScale7 || adjust(this.primaryColor, { h: 150 });\n this.cScale8 = this.cScale8 || adjust(this.primaryColor, { h: 210 });\n this.cScale9 = this.cScale9 || adjust(this.primaryColor, { h: 270 });\n this.cScale10 = this.cScale10 || adjust(this.primaryColor, { h: 300 });\n this.cScale11 = this.cScale11 || adjust(this.primaryColor, { h: 330 });\n this['cScalePeer' + 1] = this['cScalePeer' + 1] || darken(this.secondaryColor, 45);\n this['cScalePeer' + 2] = this['cScalePeer' + 2] || darken(this.tertiaryColor, 40);\n for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {\n // Setup the peer color for the set, useful for borders\n this['cScale' + i] = darken(this['cScale' + i], 10);\n this['cScalePeer' + i] = this['cScalePeer' + i] || darken(this['cScale' + i], 25);\n }\n\n // Setup the inverted color for the set\n for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {\n this['cScaleInv' + i] = this['cScaleInv' + i] || adjust(this['cScale' + i], { h: 180 });\n }\n\n // Setup the label color for the set\n this.scaleLabelColor =\n this.scaleLabelColor !== 'calculated' && this.scaleLabelColor\n ? this.scaleLabelColor\n : this.labelTextColor;\n\n for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {\n this['cScaleLabel' + i] = this['cScaleLabel' + i] || this.scaleLabelColor;\n }\n\n for (let i = 0; i < 5; i++) {\n this['surface' + i] =\n this['surface' + i] || adjust(this.mainBkg, { h: 30, s: -30, l: -(5 + i * 5) });\n this['surfacePeer' + i] =\n this['surfacePeer' + i] || adjust(this.mainBkg, { h: 30, s: -30, l: -(8 + i * 5) });\n }\n\n /* Flowchart variables */\n\n this.nodeBkg = this.mainBkg;\n this.nodeBorder = this.border1;\n this.clusterBkg = this.secondBkg;\n this.clusterBorder = this.border2;\n this.defaultLinkColor = this.lineColor;\n\n /* Gantt chart variables */\n\n this.taskBorderColor = this.border1;\n this.taskTextColor = this.taskTextLightColor;\n this.taskTextOutsideColor = this.taskTextDarkColor;\n this.activeTaskBorderColor = this.taskBorderColor;\n this.activeTaskBkgColor = this.mainBkg;\n\n /* Architecture Diagram variables */\n this.archEdgeColor = this.lineColor;\n this.archEdgeArrowColor = this.lineColor;\n\n /* state colors */\n this.transitionColor = this.transitionColor || this.lineColor;\n this.transitionLabelColor = this.transitionLabelColor || this.textColor;\n this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;\n\n this.stateBkg = this.stateBkg || this.mainBkg;\n this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;\n this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;\n this.altBackground = this.altBackground || '#f0f0f0';\n this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;\n this.compositeBorder = this.compositeBorder || this.nodeBorder;\n this.innerEndBackground = this.primaryBorderColor;\n this.specialStateColor = this.lineColor;\n\n this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;\n this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;\n this.transitionColor = this.transitionColor || this.lineColor;\n /* class */\n this.classText = this.primaryTextColor;\n /* journey */\n this.fillType0 = this.primaryColor;\n this.fillType1 = this.secondaryColor;\n this.fillType2 = adjust(this.primaryColor, { h: 64 });\n this.fillType3 = adjust(this.secondaryColor, { h: 64 });\n this.fillType4 = adjust(this.primaryColor, { h: -64 });\n this.fillType5 = adjust(this.secondaryColor, { h: -64 });\n this.fillType6 = adjust(this.primaryColor, { h: 128 });\n this.fillType7 = adjust(this.secondaryColor, { h: 128 });\n\n /* pie */\n this.pie1 = this.pie1 || this.primaryColor;\n this.pie2 = this.pie2 || this.secondaryColor;\n this.pie3 = this.pie3 || this.tertiaryColor;\n this.pie4 = this.pie4 || adjust(this.primaryColor, { l: -30 });\n this.pie5 = this.pie5 || adjust(this.secondaryColor, { l: -30 });\n this.pie6 = this.pie6 || adjust(this.tertiaryColor, { h: +40, l: -40 });\n this.pie7 = this.pie7 || adjust(this.primaryColor, { h: +60, l: -10 });\n this.pie8 = this.pie8 || adjust(this.primaryColor, { h: -60, l: -10 });\n this.pie9 = this.pie9 || adjust(this.primaryColor, { h: 120, l: 0 });\n this.pie10 = this.pie10 || adjust(this.primaryColor, { h: +60, l: -50 });\n this.pie11 = this.pie11 || adjust(this.primaryColor, { h: -60, l: -50 });\n this.pie12 = this.pie12 || adjust(this.primaryColor, { h: 120, l: -50 });\n this.pieTitleTextSize = this.pieTitleTextSize || '25px';\n this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;\n this.pieSectionTextSize = this.pieSectionTextSize || '17px';\n this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;\n this.pieLegendTextSize = this.pieLegendTextSize || '17px';\n this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;\n this.pieStrokeColor = this.pieStrokeColor || 'black';\n this.pieStrokeWidth = this.pieStrokeWidth || '2px';\n this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || '2px';\n this.pieOuterStrokeColor = this.pieOuterStrokeColor || 'black';\n this.pieOpacity = this.pieOpacity || '0.7';\n\n /* quadrant-graph */\n this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;\n this.quadrant2Fill = this.quadrant2Fill || adjust(this.primaryColor, { r: 5, g: 5, b: 5 });\n this.quadrant3Fill = this.quadrant3Fill || adjust(this.primaryColor, { r: 10, g: 10, b: 10 });\n this.quadrant4Fill = this.quadrant4Fill || adjust(this.primaryColor, { r: 15, g: 15, b: 15 });\n this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;\n this.quadrant2TextFill =\n this.quadrant2TextFill || adjust(this.primaryTextColor, { r: -5, g: -5, b: -5 });\n this.quadrant3TextFill =\n this.quadrant3TextFill || adjust(this.primaryTextColor, { r: -10, g: -10, b: -10 });\n this.quadrant4TextFill =\n this.quadrant4TextFill || adjust(this.primaryTextColor, { r: -15, g: -15, b: -15 });\n this.quadrantPointFill =\n this.quadrantPointFill || isDark(this.quadrant1Fill)\n ? lighten(this.quadrant1Fill)\n : darken(this.quadrant1Fill);\n this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;\n this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;\n this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;\n this.quadrantInternalBorderStrokeFill =\n this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;\n this.quadrantExternalBorderStrokeFill =\n this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;\n this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;\n\n this.packet = {\n startByteColor: this.primaryTextColor,\n endByteColor: this.primaryTextColor,\n labelColor: this.primaryTextColor,\n titleColor: this.primaryTextColor,\n blockStrokeColor: this.primaryTextColor,\n blockFillColor: this.mainBkg,\n };\n\n /* xychart */\n this.xyChart = {\n backgroundColor: this.xyChart?.backgroundColor || this.background,\n titleColor: this.xyChart?.titleColor || this.primaryTextColor,\n xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor,\n xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor,\n xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor,\n xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor,\n yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor,\n yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor,\n yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor,\n yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor,\n plotColorPalette:\n this.xyChart?.plotColorPalette ||\n '#CDE498,#FF6B6B,#A0D2DB,#D7BDE2,#F0F0F0,#FFC3A0,#7FD8BE,#FF9A8B,#FAF3E0,#FFF176',\n };\n\n /* requirement-diagram */\n this.requirementBackground = this.requirementBackground || this.primaryColor;\n this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;\n this.requirementBorderSize = this.requirementBorderSize || '1';\n this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;\n this.relationColor = this.relationColor || this.lineColor;\n this.relationLabelBackground = this.relationLabelBackground || this.edgeLabelBackground;\n this.relationLabelColor = this.relationLabelColor || this.actorTextColor;\n\n /* git */\n this.git0 = this.git0 || this.primaryColor;\n this.git1 = this.git1 || this.secondaryColor;\n this.git2 = this.git2 || this.tertiaryColor;\n this.git3 = this.git3 || adjust(this.primaryColor, { h: -30 });\n this.git4 = this.git4 || adjust(this.primaryColor, { h: -60 });\n this.git5 = this.git5 || adjust(this.primaryColor, { h: -90 });\n this.git6 = this.git6 || adjust(this.primaryColor, { h: +60 });\n this.git7 = this.git7 || adjust(this.primaryColor, { h: +120 });\n if (this.darkMode) {\n this.git0 = lighten(this.git0, 25);\n this.git1 = lighten(this.git1, 25);\n this.git2 = lighten(this.git2, 25);\n this.git3 = lighten(this.git3, 25);\n this.git4 = lighten(this.git4, 25);\n this.git5 = lighten(this.git5, 25);\n this.git6 = lighten(this.git6, 25);\n this.git7 = lighten(this.git7, 25);\n } else {\n this.git0 = darken(this.git0, 25);\n this.git1 = darken(this.git1, 25);\n this.git2 = darken(this.git2, 25);\n this.git3 = darken(this.git3, 25);\n this.git4 = darken(this.git4, 25);\n this.git5 = darken(this.git5, 25);\n this.git6 = darken(this.git6, 25);\n this.git7 = darken(this.git7, 25);\n }\n this.gitInv0 = this.gitInv0 || invert(this.git0);\n this.gitInv1 = this.gitInv1 || invert(this.git1);\n this.gitInv2 = this.gitInv2 || invert(this.git2);\n this.gitInv3 = this.gitInv3 || invert(this.git3);\n this.gitInv4 = this.gitInv4 || invert(this.git4);\n this.gitInv5 = this.gitInv5 || invert(this.git5);\n this.gitInv6 = this.gitInv6 || invert(this.git6);\n this.gitInv7 = this.gitInv7 || invert(this.git7);\n this.gitBranchLabel0 = this.gitBranchLabel0 || invert(this.labelTextColor);\n this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor;\n this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor;\n this.gitBranchLabel3 = this.gitBranchLabel3 || invert(this.labelTextColor);\n this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor;\n this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor;\n this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor;\n this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor;\n\n this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;\n this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;\n this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;\n this.tagLabelFontSize = this.tagLabelFontSize || '10px';\n this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;\n this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;\n this.commitLabelFontSize = this.commitLabelFontSize || '10px';\n\n /* -------------------------------------------------- */\n /* EntityRelationship diagrams */\n\n this.attributeBackgroundColorOdd =\n this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;\n this.attributeBackgroundColorEven =\n this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;\n /* -------------------------------------------------- */\n }\n calculate(overrides) {\n if (typeof overrides !== 'object') {\n // Calculate colors form base colors\n this.updateColors();\n return;\n }\n\n const keys = Object.keys(overrides);\n\n // Copy values from overrides, this is mainly for base colors\n keys.forEach((k) => {\n this[k] = overrides[k];\n });\n\n // Calculate colors form base colors\n this.updateColors();\n // Copy values from overrides again in case of an override of derived value\n keys.forEach((k) => {\n this[k] = overrides[k];\n });\n }\n}\n\nexport const getThemeVariables = (userOverrides) => {\n const theme = new Theme();\n theme.calculate(userOverrides);\n return theme;\n};\n", "import { invert, darken, lighten, adjust, isDark } from 'khroma';\nimport { mkBorder } from './theme-helpers.js';\nimport {\n oldAttributeBackgroundColorEven,\n oldAttributeBackgroundColorOdd,\n} from './erDiagram-oldHardcodedValues.js';\n\n// const Color = require ( 'khroma/dist/color' ).default\n// Color.format.hex.stringify(Color.parse('hsl(210, 66.6666666667%, 95%)')); // => \"#EAF2FB\"\n\nclass Theme {\n constructor() {\n this.primaryColor = '#eee';\n this.contrast = '#707070';\n this.secondaryColor = lighten(this.contrast, 55);\n this.background = '#ffffff';\n\n // this.secondaryColor = adjust(this.primaryColor, { h: 120 });\n this.tertiaryColor = adjust(this.primaryColor, { h: -160 });\n this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);\n this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);\n this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);\n // this.noteBorderColor = mkBorder(this.noteBkgColor, this.darkMode);\n\n this.primaryTextColor = invert(this.primaryColor);\n this.secondaryTextColor = invert(this.secondaryColor);\n this.tertiaryTextColor = invert(this.tertiaryColor);\n this.lineColor = invert(this.background);\n this.textColor = invert(this.background);\n\n // this.altBackground = lighten(this.contrast, 55);\n this.mainBkg = '#eee';\n this.secondBkg = 'calculated';\n this.lineColor = '#666';\n this.border1 = '#999';\n this.border2 = 'calculated';\n this.note = '#ffa';\n this.text = '#333';\n this.critical = '#d42';\n this.done = '#bbb';\n this.arrowheadColor = '#333333';\n this.fontFamily = '\"trebuchet ms\", verdana, arial, sans-serif';\n this.fontSize = '16px';\n this.THEME_COLOR_LIMIT = 12;\n\n /* Flowchart variables */\n\n this.nodeBkg = 'calculated';\n this.nodeBorder = 'calculated';\n this.clusterBkg = 'calculated';\n this.clusterBorder = 'calculated';\n this.defaultLinkColor = 'calculated';\n this.titleColor = 'calculated';\n this.edgeLabelBackground = 'white';\n\n /* Sequence Diagram variables */\n\n this.actorBorder = 'calculated';\n this.actorBkg = 'calculated';\n this.actorTextColor = 'calculated';\n this.actorLineColor = this.actorBorder;\n this.signalColor = 'calculated';\n this.signalTextColor = 'calculated';\n this.labelBoxBkgColor = 'calculated';\n this.labelBoxBorderColor = 'calculated';\n this.labelTextColor = 'calculated';\n this.loopTextColor = 'calculated';\n this.noteBorderColor = 'calculated';\n this.noteBkgColor = 'calculated';\n this.noteTextColor = 'calculated';\n this.activationBorderColor = '#666';\n this.activationBkgColor = '#f4f4f4';\n this.sequenceNumberColor = 'white';\n\n /* Gantt chart variables */\n\n this.sectionBkgColor = 'calculated';\n this.altSectionBkgColor = 'white';\n this.sectionBkgColor2 = 'calculated';\n this.excludeBkgColor = '#eeeeee';\n this.taskBorderColor = 'calculated';\n this.taskBkgColor = 'calculated';\n this.taskTextLightColor = 'white';\n this.taskTextColor = 'calculated';\n this.taskTextDarkColor = 'calculated';\n this.taskTextOutsideColor = 'calculated';\n this.taskTextClickableColor = '#003163';\n this.activeTaskBorderColor = 'calculated';\n this.activeTaskBkgColor = 'calculated';\n this.gridColor = 'calculated';\n this.doneTaskBkgColor = 'calculated';\n this.doneTaskBorderColor = 'calculated';\n this.critBkgColor = 'calculated';\n this.critBorderColor = 'calculated';\n this.todayLineColor = 'calculated';\n\n /* C4 Context Diagram variables */\n this.personBorder = this.primaryBorderColor;\n this.personBkg = this.mainBkg;\n\n /* Architecture Diagram variables */\n this.archEdgeColor = 'calculated';\n this.archEdgeArrowColor = 'calculated';\n this.archEdgeWidth = '3';\n this.archGroupBorderColor = this.primaryBorderColor;\n this.archGroupBorderWidth = '2px';\n\n /* state colors */\n this.labelColor = 'black';\n\n this.errorBkgColor = '#552222';\n this.errorTextColor = '#552222';\n }\n updateColors() {\n this.secondBkg = lighten(this.contrast, 55);\n this.border2 = this.contrast;\n\n /* Sequence Diagram variables */\n\n this.actorBorder = lighten(this.border1, 23);\n this.actorBkg = this.mainBkg;\n this.actorTextColor = this.text;\n this.actorLineColor = this.actorBorder;\n this.signalColor = this.text;\n this.signalTextColor = this.text;\n this.labelBoxBkgColor = this.actorBkg;\n this.labelBoxBorderColor = this.actorBorder;\n this.labelTextColor = this.text;\n this.loopTextColor = this.text;\n this.noteBorderColor = '#999';\n this.noteBkgColor = '#666';\n this.noteTextColor = '#fff';\n\n /* Color Scale */\n /* Each color-set will have a background, a foreground and a border color */\n\n this.cScale0 = this.cScale0 || '#555';\n this.cScale1 = this.cScale1 || '#F4F4F4';\n this.cScale2 = this.cScale2 || '#555';\n this.cScale3 = this.cScale3 || '#BBB';\n this.cScale4 = this.cScale4 || '#777';\n this.cScale5 = this.cScale5 || '#999';\n this.cScale6 = this.cScale6 || '#DDD';\n this.cScale7 = this.cScale7 || '#FFF';\n this.cScale8 = this.cScale8 || '#DDD';\n this.cScale9 = this.cScale9 || '#BBB';\n this.cScale10 = this.cScale10 || '#999';\n this.cScale11 = this.cScale11 || '#777';\n\n // Setup the inverted color for the set\n for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {\n this['cScaleInv' + i] = this['cScaleInv' + i] || invert(this['cScale' + i]);\n }\n // Setup the peer color for the set, useful for borders\n for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {\n if (this.darkMode) {\n this['cScalePeer' + i] = this['cScalePeer' + i] || lighten(this['cScale' + i], 10);\n } else {\n this['cScalePeer' + i] = this['cScalePeer' + i] || darken(this['cScale' + i], 10);\n }\n }\n\n // Setup the label color for the set\n this.scaleLabelColor = this.scaleLabelColor || (this.darkMode ? 'black' : this.labelTextColor);\n\n this.cScaleLabel0 = this.cScaleLabel0 || this.cScale1;\n this.cScaleLabel2 = this.cScaleLabel2 || this.cScale1;\n for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {\n this['cScaleLabel' + i] = this['cScaleLabel' + i] || this.scaleLabelColor;\n }\n\n for (let i = 0; i < 5; i++) {\n this['surface' + i] = this['surface' + i] || adjust(this.mainBkg, { l: -(5 + i * 5) });\n this['surfacePeer' + i] =\n this['surfacePeer' + i] || adjust(this.mainBkg, { l: -(8 + i * 5) });\n }\n\n /* Flowchart variables */\n\n this.nodeBkg = this.mainBkg;\n this.nodeBorder = this.border1;\n this.clusterBkg = this.secondBkg;\n this.clusterBorder = this.border2;\n this.defaultLinkColor = this.lineColor;\n this.titleColor = this.text;\n\n /* Gantt chart variables */\n\n this.sectionBkgColor = lighten(this.contrast, 30);\n this.sectionBkgColor2 = lighten(this.contrast, 30);\n\n this.taskBorderColor = darken(this.contrast, 10);\n\n this.taskBkgColor = this.contrast;\n this.taskTextColor = this.taskTextLightColor;\n this.taskTextDarkColor = this.text;\n this.taskTextOutsideColor = this.taskTextDarkColor;\n this.activeTaskBorderColor = this.taskBorderColor;\n this.activeTaskBkgColor = this.mainBkg;\n this.gridColor = lighten(this.border1, 30);\n\n this.doneTaskBkgColor = this.done;\n this.doneTaskBorderColor = this.lineColor;\n this.critBkgColor = this.critical;\n this.critBorderColor = darken(this.critBkgColor, 10);\n\n this.todayLineColor = this.critBkgColor;\n\n /* Architecture Diagram variables */\n this.archEdgeColor = this.lineColor;\n this.archEdgeArrowColor = this.lineColor;\n\n /* state colors */\n this.transitionColor = this.transitionColor || '#000';\n this.transitionLabelColor = this.transitionLabelColor || this.textColor;\n this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;\n\n this.stateBkg = this.stateBkg || this.mainBkg;\n this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;\n this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;\n this.altBackground = this.altBackground || '#f4f4f4';\n this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;\n this.stateBorder = this.stateBorder || '#000';\n this.innerEndBackground = this.primaryBorderColor;\n this.specialStateColor = '#222';\n\n this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;\n this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;\n\n /* class */\n this.classText = this.primaryTextColor;\n /* journey */\n this.fillType0 = this.primaryColor;\n this.fillType1 = this.secondaryColor;\n this.fillType2 = adjust(this.primaryColor, { h: 64 });\n this.fillType3 = adjust(this.secondaryColor, { h: 64 });\n this.fillType4 = adjust(this.primaryColor, { h: -64 });\n this.fillType5 = adjust(this.secondaryColor, { h: -64 });\n this.fillType6 = adjust(this.primaryColor, { h: 128 });\n this.fillType7 = adjust(this.secondaryColor, { h: 128 });\n\n // /* pie */\n /* Pie diagram */\n for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {\n this['pie' + i] = this['cScale' + i];\n }\n this.pie12 = this.pie0;\n this.pieTitleTextSize = this.pieTitleTextSize || '25px';\n this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;\n this.pieSectionTextSize = this.pieSectionTextSize || '17px';\n this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;\n this.pieLegendTextSize = this.pieLegendTextSize || '17px';\n this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;\n this.pieStrokeColor = this.pieStrokeColor || 'black';\n this.pieStrokeWidth = this.pieStrokeWidth || '2px';\n this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || '2px';\n this.pieOuterStrokeColor = this.pieOuterStrokeColor || 'black';\n this.pieOpacity = this.pieOpacity || '0.7';\n\n /* quadrant-graph */\n this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;\n this.quadrant2Fill = this.quadrant2Fill || adjust(this.primaryColor, { r: 5, g: 5, b: 5 });\n this.quadrant3Fill = this.quadrant3Fill || adjust(this.primaryColor, { r: 10, g: 10, b: 10 });\n this.quadrant4Fill = this.quadrant4Fill || adjust(this.primaryColor, { r: 15, g: 15, b: 15 });\n this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;\n this.quadrant2TextFill =\n this.quadrant2TextFill || adjust(this.primaryTextColor, { r: -5, g: -5, b: -5 });\n this.quadrant3TextFill =\n this.quadrant3TextFill || adjust(this.primaryTextColor, { r: -10, g: -10, b: -10 });\n this.quadrant4TextFill =\n this.quadrant4TextFill || adjust(this.primaryTextColor, { r: -15, g: -15, b: -15 });\n this.quadrantPointFill =\n this.quadrantPointFill || isDark(this.quadrant1Fill)\n ? lighten(this.quadrant1Fill)\n : darken(this.quadrant1Fill);\n this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;\n this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;\n this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;\n this.quadrantInternalBorderStrokeFill =\n this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;\n this.quadrantExternalBorderStrokeFill =\n this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;\n this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;\n\n /* xychart */\n this.xyChart = {\n backgroundColor: this.xyChart?.backgroundColor || this.background,\n titleColor: this.xyChart?.titleColor || this.primaryTextColor,\n xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor,\n xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor,\n xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor,\n xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor,\n yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor,\n yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor,\n yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor,\n yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor,\n plotColorPalette:\n this.xyChart?.plotColorPalette ||\n '#EEE,#6BB8E4,#8ACB88,#C7ACD6,#E8DCC2,#FFB2A8,#FFF380,#7E8D91,#FFD8B1,#FAF3E0',\n };\n\n /* requirement-diagram */\n this.requirementBackground = this.requirementBackground || this.primaryColor;\n this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;\n this.requirementBorderSize = this.requirementBorderSize || '1';\n this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;\n this.relationColor = this.relationColor || this.lineColor;\n this.relationLabelBackground = this.relationLabelBackground || this.edgeLabelBackground;\n this.relationLabelColor = this.relationLabelColor || this.actorTextColor;\n\n /* git */\n this.git0 = darken(this.pie1, 25) || this.primaryColor;\n this.git1 = this.pie2 || this.secondaryColor;\n this.git2 = this.pie3 || this.tertiaryColor;\n this.git3 = this.pie4 || adjust(this.primaryColor, { h: -30 });\n this.git4 = this.pie5 || adjust(this.primaryColor, { h: -60 });\n this.git5 = this.pie6 || adjust(this.primaryColor, { h: -90 });\n this.git6 = this.pie7 || adjust(this.primaryColor, { h: +60 });\n this.git7 = this.pie8 || adjust(this.primaryColor, { h: +120 });\n\n this.gitInv0 = this.gitInv0 || invert(this.git0);\n this.gitInv1 = this.gitInv1 || invert(this.git1);\n this.gitInv2 = this.gitInv2 || invert(this.git2);\n this.gitInv3 = this.gitInv3 || invert(this.git3);\n this.gitInv4 = this.gitInv4 || invert(this.git4);\n this.gitInv5 = this.gitInv5 || invert(this.git5);\n this.gitInv6 = this.gitInv6 || invert(this.git6);\n this.gitInv7 = this.gitInv7 || invert(this.git7);\n\n this.branchLabelColor = this.branchLabelColor || this.labelTextColor;\n this.gitBranchLabel0 = this.branchLabelColor;\n this.gitBranchLabel1 = 'white';\n this.gitBranchLabel2 = this.branchLabelColor;\n this.gitBranchLabel3 = 'white';\n this.gitBranchLabel4 = this.branchLabelColor;\n this.gitBranchLabel5 = this.branchLabelColor;\n this.gitBranchLabel6 = this.branchLabelColor;\n this.gitBranchLabel7 = this.branchLabelColor;\n\n this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;\n this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;\n this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;\n this.tagLabelFontSize = this.tagLabelFontSize || '10px';\n this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;\n this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;\n this.commitLabelFontSize = this.commitLabelFontSize || '10px';\n\n /* -------------------------------------------------- */\n /* EntityRelationship diagrams */\n\n this.attributeBackgroundColorOdd =\n this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;\n this.attributeBackgroundColorEven =\n this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;\n /* -------------------------------------------------- */\n }\n calculate(overrides) {\n if (typeof overrides !== 'object') {\n // Calculate colors form base colors\n this.updateColors();\n return;\n }\n\n const keys = Object.keys(overrides);\n\n // Copy values from overrides, this is mainly for base colors\n keys.forEach((k) => {\n this[k] = overrides[k];\n });\n\n // Calculate colors form base colors\n this.updateColors();\n // Copy values from overrides again in case of an override of derived value\n keys.forEach((k) => {\n this[k] = overrides[k];\n });\n }\n}\n\nexport const getThemeVariables = (userOverrides) => {\n const theme = new Theme();\n theme.calculate(userOverrides);\n return theme;\n};\n", "import { getThemeVariables as baseThemeVariables } from './theme-base.js';\nimport { getThemeVariables as darkThemeVariables } from './theme-dark.js';\nimport { getThemeVariables as defaultThemeVariables } from './theme-default.js';\nimport { getThemeVariables as forestThemeVariables } from './theme-forest.js';\nimport { getThemeVariables as neutralThemeVariables } from './theme-neutral.js';\n\nexport default {\n base: {\n getThemeVariables: baseThemeVariables,\n },\n dark: {\n getThemeVariables: darkThemeVariables,\n },\n default: {\n getThemeVariables: defaultThemeVariables,\n },\n forest: {\n getThemeVariables: forestThemeVariables,\n },\n neutral: {\n getThemeVariables: neutralThemeVariables,\n },\n};\n", "export default {\n \"flowchart\": {\n \"useMaxWidth\": true,\n \"titleTopMargin\": 25,\n \"subGraphTitleMargin\": {\n \"top\": 0,\n \"bottom\": 0\n },\n \"diagramPadding\": 8,\n \"htmlLabels\": true,\n \"nodeSpacing\": 50,\n \"rankSpacing\": 50,\n \"curve\": \"basis\",\n \"padding\": 15,\n \"defaultRenderer\": \"dagre-wrapper\",\n \"wrappingWidth\": 200\n },\n \"sequence\": {\n \"useMaxWidth\": true,\n \"hideUnusedParticipants\": false,\n \"activationWidth\": 10,\n \"diagramMarginX\": 50,\n \"diagramMarginY\": 10,\n \"actorMargin\": 50,\n \"width\": 150,\n \"height\": 65,\n \"boxMargin\": 10,\n \"boxTextMargin\": 5,\n \"noteMargin\": 10,\n \"messageMargin\": 35,\n \"messageAlign\": \"center\",\n \"mirrorActors\": true,\n \"forceMenus\": false,\n \"bottomMarginAdj\": 1,\n \"rightAngles\": false,\n \"showSequenceNumbers\": false,\n \"actorFontSize\": 14,\n \"actorFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"actorFontWeight\": 400,\n \"noteFontSize\": 14,\n \"noteFontFamily\": \"\\\"trebuchet ms\\\", verdana, arial, sans-serif\",\n \"noteFontWeight\": 400,\n \"noteAlign\": \"center\",\n \"messageFontSize\": 16,\n \"messageFontFamily\": \"\\\"trebuchet ms\\\", verdana, arial, sans-serif\",\n \"messageFontWeight\": 400,\n \"wrap\": false,\n \"wrapPadding\": 10,\n \"labelBoxWidth\": 50,\n \"labelBoxHeight\": 20\n },\n \"gantt\": {\n \"useMaxWidth\": true,\n \"titleTopMargin\": 25,\n \"barHeight\": 20,\n \"barGap\": 4,\n \"topPadding\": 50,\n \"rightPadding\": 75,\n \"leftPadding\": 75,\n \"gridLineStartPadding\": 35,\n \"fontSize\": 11,\n \"sectionFontSize\": 11,\n \"numberSectionStyles\": 4,\n \"axisFormat\": \"%Y-%m-%d\",\n \"topAxis\": false,\n \"displayMode\": \"\",\n \"weekday\": \"sunday\"\n },\n \"journey\": {\n \"useMaxWidth\": true,\n \"diagramMarginX\": 50,\n \"diagramMarginY\": 10,\n \"leftMargin\": 150,\n \"width\": 150,\n \"height\": 50,\n \"boxMargin\": 10,\n \"boxTextMargin\": 5,\n \"noteMargin\": 10,\n \"messageMargin\": 35,\n \"messageAlign\": \"center\",\n \"bottomMarginAdj\": 1,\n \"rightAngles\": false,\n \"taskFontSize\": 14,\n \"taskFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"taskMargin\": 50,\n \"activationWidth\": 10,\n \"textPlacement\": \"fo\",\n \"actorColours\": [\n \"#8FBC8F\",\n \"#7CFC00\",\n \"#00FFFF\",\n \"#20B2AA\",\n \"#B0E0E6\",\n \"#FFFFE0\"\n ],\n \"sectionFills\": [\n \"#191970\",\n \"#8B008B\",\n \"#4B0082\",\n \"#2F4F4F\",\n \"#800000\",\n \"#8B4513\",\n \"#00008B\"\n ],\n \"sectionColours\": [\n \"#fff\"\n ]\n },\n \"class\": {\n \"useMaxWidth\": true,\n \"titleTopMargin\": 25,\n \"arrowMarkerAbsolute\": false,\n \"dividerMargin\": 10,\n \"padding\": 5,\n \"textHeight\": 10,\n \"defaultRenderer\": \"dagre-wrapper\",\n \"htmlLabels\": false\n },\n \"state\": {\n \"useMaxWidth\": true,\n \"titleTopMargin\": 25,\n \"dividerMargin\": 10,\n \"sizeUnit\": 5,\n \"padding\": 8,\n \"textHeight\": 10,\n \"titleShift\": -15,\n \"noteMargin\": 10,\n \"forkWidth\": 70,\n \"forkHeight\": 7,\n \"miniPadding\": 2,\n \"fontSizeFactor\": 5.02,\n \"fontSize\": 24,\n \"labelHeight\": 16,\n \"edgeLengthFactor\": \"20\",\n \"compositTitleSize\": 35,\n \"radius\": 5,\n \"defaultRenderer\": \"dagre-wrapper\"\n },\n \"er\": {\n \"useMaxWidth\": true,\n \"titleTopMargin\": 25,\n \"diagramPadding\": 20,\n \"layoutDirection\": \"TB\",\n \"minEntityWidth\": 100,\n \"minEntityHeight\": 75,\n \"entityPadding\": 15,\n \"stroke\": \"gray\",\n \"fill\": \"honeydew\",\n \"fontSize\": 12\n },\n \"pie\": {\n \"useMaxWidth\": true,\n \"textPosition\": 0.75\n },\n \"quadrantChart\": {\n \"useMaxWidth\": true,\n \"chartWidth\": 500,\n \"chartHeight\": 500,\n \"titleFontSize\": 20,\n \"titlePadding\": 10,\n \"quadrantPadding\": 5,\n \"xAxisLabelPadding\": 5,\n \"yAxisLabelPadding\": 5,\n \"xAxisLabelFontSize\": 16,\n \"yAxisLabelFontSize\": 16,\n \"quadrantLabelFontSize\": 16,\n \"quadrantTextTopPadding\": 5,\n \"pointTextPadding\": 5,\n \"pointLabelFontSize\": 12,\n \"pointRadius\": 5,\n \"xAxisPosition\": \"top\",\n \"yAxisPosition\": \"left\",\n \"quadrantInternalBorderStrokeWidth\": 1,\n \"quadrantExternalBorderStrokeWidth\": 2\n },\n \"xyChart\": {\n \"useMaxWidth\": true,\n \"width\": 700,\n \"height\": 500,\n \"titleFontSize\": 20,\n \"titlePadding\": 10,\n \"showTitle\": true,\n \"xAxis\": {\n \"$ref\": \"#/$defs/XYChartAxisConfig\",\n \"showLabel\": true,\n \"labelFontSize\": 14,\n \"labelPadding\": 5,\n \"showTitle\": true,\n \"titleFontSize\": 16,\n \"titlePadding\": 5,\n \"showTick\": true,\n \"tickLength\": 5,\n \"tickWidth\": 2,\n \"showAxisLine\": true,\n \"axisLineWidth\": 2\n },\n \"yAxis\": {\n \"$ref\": \"#/$defs/XYChartAxisConfig\",\n \"showLabel\": true,\n \"labelFontSize\": 14,\n \"labelPadding\": 5,\n \"showTitle\": true,\n \"titleFontSize\": 16,\n \"titlePadding\": 5,\n \"showTick\": true,\n \"tickLength\": 5,\n \"tickWidth\": 2,\n \"showAxisLine\": true,\n \"axisLineWidth\": 2\n },\n \"chartOrientation\": \"vertical\",\n \"plotReservedSpacePercent\": 50\n },\n \"requirement\": {\n \"useMaxWidth\": true,\n \"rect_fill\": \"#f9f9f9\",\n \"text_color\": \"#333\",\n \"rect_border_size\": \"0.5px\",\n \"rect_border_color\": \"#bbb\",\n \"rect_min_width\": 200,\n \"rect_min_height\": 200,\n \"fontSize\": 14,\n \"rect_padding\": 10,\n \"line_height\": 20\n },\n \"mindmap\": {\n \"useMaxWidth\": true,\n \"padding\": 10,\n \"maxNodeWidth\": 200\n },\n \"timeline\": {\n \"useMaxWidth\": true,\n \"diagramMarginX\": 50,\n \"diagramMarginY\": 10,\n \"leftMargin\": 150,\n \"width\": 150,\n \"height\": 50,\n \"boxMargin\": 10,\n \"boxTextMargin\": 5,\n \"noteMargin\": 10,\n \"messageMargin\": 35,\n \"messageAlign\": \"center\",\n \"bottomMarginAdj\": 1,\n \"rightAngles\": false,\n \"taskFontSize\": 14,\n \"taskFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"taskMargin\": 50,\n \"activationWidth\": 10,\n \"textPlacement\": \"fo\",\n \"actorColours\": [\n \"#8FBC8F\",\n \"#7CFC00\",\n \"#00FFFF\",\n \"#20B2AA\",\n \"#B0E0E6\",\n \"#FFFFE0\"\n ],\n \"sectionFills\": [\n \"#191970\",\n \"#8B008B\",\n \"#4B0082\",\n \"#2F4F4F\",\n \"#800000\",\n \"#8B4513\",\n \"#00008B\"\n ],\n \"sectionColours\": [\n \"#fff\"\n ],\n \"disableMulticolor\": false\n },\n \"gitGraph\": {\n \"useMaxWidth\": true,\n \"titleTopMargin\": 25,\n \"diagramPadding\": 8,\n \"nodeLabel\": {\n \"width\": 75,\n \"height\": 100,\n \"x\": -25,\n \"y\": 0\n },\n \"mainBranchName\": \"main\",\n \"mainBranchOrder\": 0,\n \"showCommitLabel\": true,\n \"showBranches\": true,\n \"rotateCommitLabel\": true,\n \"parallelCommits\": false,\n \"arrowMarkerAbsolute\": false\n },\n \"c4\": {\n \"useMaxWidth\": true,\n \"diagramMarginX\": 50,\n \"diagramMarginY\": 10,\n \"c4ShapeMargin\": 50,\n \"c4ShapePadding\": 20,\n \"width\": 216,\n \"height\": 60,\n \"boxMargin\": 10,\n \"c4ShapeInRow\": 4,\n \"nextLinePaddingX\": 0,\n \"c4BoundaryInRow\": 2,\n \"personFontSize\": 14,\n \"personFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"personFontWeight\": \"normal\",\n \"external_personFontSize\": 14,\n \"external_personFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"external_personFontWeight\": \"normal\",\n \"systemFontSize\": 14,\n \"systemFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"systemFontWeight\": \"normal\",\n \"external_systemFontSize\": 14,\n \"external_systemFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"external_systemFontWeight\": \"normal\",\n \"system_dbFontSize\": 14,\n \"system_dbFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"system_dbFontWeight\": \"normal\",\n \"external_system_dbFontSize\": 14,\n \"external_system_dbFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"external_system_dbFontWeight\": \"normal\",\n \"system_queueFontSize\": 14,\n \"system_queueFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"system_queueFontWeight\": \"normal\",\n \"external_system_queueFontSize\": 14,\n \"external_system_queueFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"external_system_queueFontWeight\": \"normal\",\n \"boundaryFontSize\": 14,\n \"boundaryFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"boundaryFontWeight\": \"normal\",\n \"messageFontSize\": 12,\n \"messageFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"messageFontWeight\": \"normal\",\n \"containerFontSize\": 14,\n \"containerFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"containerFontWeight\": \"normal\",\n \"external_containerFontSize\": 14,\n \"external_containerFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"external_containerFontWeight\": \"normal\",\n \"container_dbFontSize\": 14,\n \"container_dbFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"container_dbFontWeight\": \"normal\",\n \"external_container_dbFontSize\": 14,\n \"external_container_dbFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"external_container_dbFontWeight\": \"normal\",\n \"container_queueFontSize\": 14,\n \"container_queueFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"container_queueFontWeight\": \"normal\",\n \"external_container_queueFontSize\": 14,\n \"external_container_queueFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"external_container_queueFontWeight\": \"normal\",\n \"componentFontSize\": 14,\n \"componentFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"componentFontWeight\": \"normal\",\n \"external_componentFontSize\": 14,\n \"external_componentFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"external_componentFontWeight\": \"normal\",\n \"component_dbFontSize\": 14,\n \"component_dbFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"component_dbFontWeight\": \"normal\",\n \"external_component_dbFontSize\": 14,\n \"external_component_dbFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"external_component_dbFontWeight\": \"normal\",\n \"component_queueFontSize\": 14,\n \"component_queueFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"component_queueFontWeight\": \"normal\",\n \"external_component_queueFontSize\": 14,\n \"external_component_queueFontFamily\": \"\\\"Open Sans\\\", sans-serif\",\n \"external_component_queueFontWeight\": \"normal\",\n \"wrap\": true,\n \"wrapPadding\": 10,\n \"person_bg_color\": \"#08427B\",\n \"person_border_color\": \"#073B6F\",\n \"external_person_bg_color\": \"#686868\",\n \"external_person_border_color\": \"#8A8A8A\",\n \"system_bg_color\": \"#1168BD\",\n \"system_border_color\": \"#3C7FC0\",\n \"system_db_bg_color\": \"#1168BD\",\n \"system_db_border_color\": \"#3C7FC0\",\n \"system_queue_bg_color\": \"#1168BD\",\n \"system_queue_border_color\": \"#3C7FC0\",\n \"external_system_bg_color\": \"#999999\",\n \"external_system_border_color\": \"#8A8A8A\",\n \"external_system_db_bg_color\": \"#999999\",\n \"external_system_db_border_color\": \"#8A8A8A\",\n \"external_system_queue_bg_color\": \"#999999\",\n \"external_system_queue_border_color\": \"#8A8A8A\",\n \"container_bg_color\": \"#438DD5\",\n \"container_border_color\": \"#3C7FC0\",\n \"container_db_bg_color\": \"#438DD5\",\n \"container_db_border_color\": \"#3C7FC0\",\n \"container_queue_bg_color\": \"#438DD5\",\n \"container_queue_border_color\": \"#3C7FC0\",\n \"external_container_bg_color\": \"#B3B3B3\",\n \"external_container_border_color\": \"#A6A6A6\",\n \"external_container_db_bg_color\": \"#B3B3B3\",\n \"external_container_db_border_color\": \"#A6A6A6\",\n \"external_container_queue_bg_color\": \"#B3B3B3\",\n \"external_container_queue_border_color\": \"#A6A6A6\",\n \"component_bg_color\": \"#85BBF0\",\n \"component_border_color\": \"#78A8D8\",\n \"component_db_bg_color\": \"#85BBF0\",\n \"component_db_border_color\": \"#78A8D8\",\n \"component_queue_bg_color\": \"#85BBF0\",\n \"component_queue_border_color\": \"#78A8D8\",\n \"external_component_bg_color\": \"#CCCCCC\",\n \"external_component_border_color\": \"#BFBFBF\",\n \"external_component_db_bg_color\": \"#CCCCCC\",\n \"external_component_db_border_color\": \"#BFBFBF\",\n \"external_component_queue_bg_color\": \"#CCCCCC\",\n \"external_component_queue_border_color\": \"#BFBFBF\"\n },\n \"sankey\": {\n \"useMaxWidth\": true,\n \"width\": 600,\n \"height\": 400,\n \"linkColor\": \"gradient\",\n \"nodeAlignment\": \"justify\",\n \"showValues\": true,\n \"prefix\": \"\",\n \"suffix\": \"\"\n },\n \"block\": {\n \"useMaxWidth\": true,\n \"padding\": 8\n },\n \"packet\": {\n \"useMaxWidth\": true,\n \"rowHeight\": 32,\n \"bitWidth\": 32,\n \"bitsPerRow\": 32,\n \"showBits\": true,\n \"paddingX\": 5,\n \"paddingY\": 5\n },\n \"architecture\": {\n \"useMaxWidth\": true,\n \"padding\": 40,\n \"iconSize\": 80,\n \"fontSize\": 16\n },\n \"theme\": \"default\",\n \"look\": \"classic\",\n \"handDrawnSeed\": 0,\n \"layout\": \"dagre\",\n \"maxTextSize\": 50000,\n \"maxEdges\": 500,\n \"darkMode\": false,\n \"fontFamily\": \"\\\"trebuchet ms\\\", verdana, arial, sans-serif;\",\n \"logLevel\": 5,\n \"securityLevel\": \"strict\",\n \"startOnLoad\": true,\n \"arrowMarkerAbsolute\": false,\n \"secure\": [\n \"secure\",\n \"securityLevel\",\n \"startOnLoad\",\n \"maxTextSize\",\n \"suppressErrorRendering\",\n \"maxEdges\"\n ],\n \"legacyMathML\": false,\n \"forceLegacyMathML\": false,\n \"deterministicIds\": false,\n \"fontSize\": 16,\n \"markdownAutoWrap\": true,\n \"suppressErrorRendering\": false\n};", "import type { RequiredDeep } from 'type-fest';\n\nimport theme from './themes/index.js';\nimport type { MermaidConfig } from './config.type.js';\n\n// Uses our custom Vite jsonSchemaPlugin to load only the default values from\n// our JSON Schema\n// @ts-expect-error This file is automatically generated via a custom Vite plugin\nimport defaultConfigJson from './schemas/config.schema.yaml?only-defaults=true';\n\n/**\n * Default mermaid configuration options.\n *\n * Please see the Mermaid config JSON Schema for the default JSON values.\n * Non-JSON JS default values are listed in this file, e.g. functions, or\n * `undefined` (explicitly set so that `configKeys` finds them).\n */\nconst config: RequiredDeep = {\n ...defaultConfigJson,\n // Set, even though they're `undefined` so that `configKeys` finds these keys\n // TODO: Should we replace these with `null` so that they can go in the JSON Schema?\n deterministicIDSeed: undefined,\n elk: {\n mergeEdges: false,\n nodePlacementStrategy: 'SIMPLE',\n },\n themeCSS: undefined,\n\n // add non-JSON default config values\n themeVariables: theme.default.getThemeVariables(),\n sequence: {\n ...defaultConfigJson.sequence,\n messageFont: function () {\n return {\n fontFamily: this.messageFontFamily,\n fontSize: this.messageFontSize,\n fontWeight: this.messageFontWeight,\n };\n },\n noteFont: function () {\n return {\n fontFamily: this.noteFontFamily,\n fontSize: this.noteFontSize,\n fontWeight: this.noteFontWeight,\n };\n },\n actorFont: function () {\n return {\n fontFamily: this.actorFontFamily,\n fontSize: this.actorFontSize,\n fontWeight: this.actorFontWeight,\n };\n },\n },\n gantt: {\n ...defaultConfigJson.gantt,\n tickInterval: undefined,\n useWidth: undefined, // can probably be removed since `configKeys` already includes this\n },\n c4: {\n ...defaultConfigJson.c4,\n useWidth: undefined,\n personFont: function () {\n return {\n fontFamily: this.personFontFamily,\n fontSize: this.personFontSize,\n fontWeight: this.personFontWeight,\n };\n },\n\n external_personFont: function () {\n return {\n fontFamily: this.external_personFontFamily,\n fontSize: this.external_personFontSize,\n fontWeight: this.external_personFontWeight,\n };\n },\n\n systemFont: function () {\n return {\n fontFamily: this.systemFontFamily,\n fontSize: this.systemFontSize,\n fontWeight: this.systemFontWeight,\n };\n },\n\n external_systemFont: function () {\n return {\n fontFamily: this.external_systemFontFamily,\n fontSize: this.external_systemFontSize,\n fontWeight: this.external_systemFontWeight,\n };\n },\n\n system_dbFont: function () {\n return {\n fontFamily: this.system_dbFontFamily,\n fontSize: this.system_dbFontSize,\n fontWeight: this.system_dbFontWeight,\n };\n },\n\n external_system_dbFont: function () {\n return {\n fontFamily: this.external_system_dbFontFamily,\n fontSize: this.external_system_dbFontSize,\n fontWeight: this.external_system_dbFontWeight,\n };\n },\n\n system_queueFont: function () {\n return {\n fontFamily: this.system_queueFontFamily,\n fontSize: this.system_queueFontSize,\n fontWeight: this.system_queueFontWeight,\n };\n },\n\n external_system_queueFont: function () {\n return {\n fontFamily: this.external_system_queueFontFamily,\n fontSize: this.external_system_queueFontSize,\n fontWeight: this.external_system_queueFontWeight,\n };\n },\n\n containerFont: function () {\n return {\n fontFamily: this.containerFontFamily,\n fontSize: this.containerFontSize,\n fontWeight: this.containerFontWeight,\n };\n },\n\n external_containerFont: function () {\n return {\n fontFamily: this.external_containerFontFamily,\n fontSize: this.external_containerFontSize,\n fontWeight: this.external_containerFontWeight,\n };\n },\n\n container_dbFont: function () {\n return {\n fontFamily: this.container_dbFontFamily,\n fontSize: this.container_dbFontSize,\n fontWeight: this.container_dbFontWeight,\n };\n },\n\n external_container_dbFont: function () {\n return {\n fontFamily: this.external_container_dbFontFamily,\n fontSize: this.external_container_dbFontSize,\n fontWeight: this.external_container_dbFontWeight,\n };\n },\n\n container_queueFont: function () {\n return {\n fontFamily: this.container_queueFontFamily,\n fontSize: this.container_queueFontSize,\n fontWeight: this.container_queueFontWeight,\n };\n },\n\n external_container_queueFont: function () {\n return {\n fontFamily: this.external_container_queueFontFamily,\n fontSize: this.external_container_queueFontSize,\n fontWeight: this.external_container_queueFontWeight,\n };\n },\n\n componentFont: function () {\n return {\n fontFamily: this.componentFontFamily,\n fontSize: this.componentFontSize,\n fontWeight: this.componentFontWeight,\n };\n },\n\n external_componentFont: function () {\n return {\n fontFamily: this.external_componentFontFamily,\n fontSize: this.external_componentFontSize,\n fontWeight: this.external_componentFontWeight,\n };\n },\n\n component_dbFont: function () {\n return {\n fontFamily: this.component_dbFontFamily,\n fontSize: this.component_dbFontSize,\n fontWeight: this.component_dbFontWeight,\n };\n },\n\n external_component_dbFont: function () {\n return {\n fontFamily: this.external_component_dbFontFamily,\n fontSize: this.external_component_dbFontSize,\n fontWeight: this.external_component_dbFontWeight,\n };\n },\n\n component_queueFont: function () {\n return {\n fontFamily: this.component_queueFontFamily,\n fontSize: this.component_queueFontSize,\n fontWeight: this.component_queueFontWeight,\n };\n },\n\n external_component_queueFont: function () {\n return {\n fontFamily: this.external_component_queueFontFamily,\n fontSize: this.external_component_queueFontSize,\n fontWeight: this.external_component_queueFontWeight,\n };\n },\n\n boundaryFont: function () {\n return {\n fontFamily: this.boundaryFontFamily,\n fontSize: this.boundaryFontSize,\n fontWeight: this.boundaryFontWeight,\n };\n },\n\n messageFont: function () {\n return {\n fontFamily: this.messageFontFamily,\n fontSize: this.messageFontSize,\n fontWeight: this.messageFontWeight,\n };\n },\n },\n pie: {\n ...defaultConfigJson.pie,\n useWidth: 984,\n },\n xyChart: {\n ...defaultConfigJson.xyChart,\n useWidth: undefined,\n },\n requirement: {\n ...defaultConfigJson.requirement,\n useWidth: undefined,\n },\n packet: {\n ...defaultConfigJson.packet,\n },\n};\n\nconst keyify = (obj: any, prefix = ''): string[] =>\n Object.keys(obj).reduce((res: string[], el): string[] => {\n if (Array.isArray(obj[el])) {\n return res;\n } else if (typeof obj[el] === 'object' && obj[el] !== null) {\n return [...res, prefix + el, ...keyify(obj[el], '')];\n }\n return [...res, prefix + el];\n }, []);\n\nexport const configKeys = new Set(keyify(config, ''));\nexport default config;\n", "import { configKeys } from '../defaultConfig.js';\nimport { log } from '../logger.js';\n\n/**\n * Sanitizes directive objects\n *\n * @param args - Directive's JSON\n */\nexport const sanitizeDirective = (args: any): void => {\n log.debug('sanitizeDirective called with', args);\n\n // Return if not an object\n if (typeof args !== 'object' || args == null) {\n return;\n }\n\n // Sanitize each element if an array\n if (Array.isArray(args)) {\n args.forEach((arg) => sanitizeDirective(arg));\n return;\n }\n\n // Sanitize each key if an object\n for (const key of Object.keys(args)) {\n log.debug('Checking key', key);\n if (\n key.startsWith('__') ||\n key.includes('proto') ||\n key.includes('constr') ||\n !configKeys.has(key) ||\n args[key] == null\n ) {\n log.debug('sanitize deleting key: ', key);\n delete args[key];\n continue;\n }\n\n // Recurse if an object\n if (typeof args[key] === 'object') {\n log.debug('sanitizing object', key);\n sanitizeDirective(args[key]);\n continue;\n }\n\n const cssMatchers = ['themeCSS', 'fontFamily', 'altFontFamily'];\n for (const cssKey of cssMatchers) {\n if (key.includes(cssKey)) {\n log.debug('sanitizing css option', key);\n args[key] = sanitizeCss(args[key]);\n }\n }\n }\n\n if (args.themeVariables) {\n for (const k of Object.keys(args.themeVariables)) {\n const val = args.themeVariables[k];\n if (val?.match && !val.match(/^[\\d \"#%(),.;A-Za-z]+$/)) {\n args.themeVariables[k] = '';\n }\n }\n }\n log.debug('After sanitization', args);\n};\n\nexport const sanitizeCss = (str: string): string => {\n let startCnt = 0;\n let endCnt = 0;\n\n for (const element of str) {\n if (startCnt < endCnt) {\n return '{ /* ERROR: Unbalanced CSS */ }';\n }\n if (element === '{') {\n startCnt++;\n } else if (element === '}') {\n endCnt++;\n }\n }\n if (startCnt !== endCnt) {\n return '{ /* ERROR: Unbalanced CSS */ }';\n }\n // Todo add more checks here\n return str;\n};\n", "import assignWithDepth from './assignWithDepth.js';\nimport { log } from './logger.js';\nimport theme from './themes/index.js';\nimport config from './defaultConfig.js';\nimport type { MermaidConfig } from './config.type.js';\nimport { sanitizeDirective } from './utils/sanitizeDirective.js';\n\nexport const defaultConfig: MermaidConfig = Object.freeze(config);\n\nlet siteConfig: MermaidConfig = assignWithDepth({}, defaultConfig);\nlet configFromInitialize: MermaidConfig;\nlet directives: MermaidConfig[] = [];\nlet currentConfig: MermaidConfig = assignWithDepth({}, defaultConfig);\n\nexport const updateCurrentConfig = (siteCfg: MermaidConfig, _directives: MermaidConfig[]) => {\n // start with config being the siteConfig\n let cfg: MermaidConfig = assignWithDepth({}, siteCfg);\n // let sCfg = assignWithDepth(defaultConfig, siteConfigDelta);\n\n // Join directives\n let sumOfDirectives: MermaidConfig = {};\n for (const d of _directives) {\n sanitize(d);\n // Apply the data from the directive where the overrides the themeVariables\n sumOfDirectives = assignWithDepth(sumOfDirectives, d);\n }\n\n cfg = assignWithDepth(cfg, sumOfDirectives);\n\n if (sumOfDirectives.theme && sumOfDirectives.theme in theme) {\n const tmpConfigFromInitialize = assignWithDepth({}, configFromInitialize);\n const themeVariables = assignWithDepth(\n tmpConfigFromInitialize.themeVariables || {},\n sumOfDirectives.themeVariables\n );\n if (cfg.theme && cfg.theme in theme) {\n cfg.themeVariables = theme[cfg.theme as keyof typeof theme].getThemeVariables(themeVariables);\n }\n }\n\n currentConfig = cfg;\n checkConfig(currentConfig);\n return currentConfig;\n};\n\n/**\n * ## setSiteConfig\n *\n * | Function | Description | Type | Values |\n * | ------------- | ------------------------------------- | ----------- | --------------------------------------- |\n * | setSiteConfig | Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array |\n *\n * **Notes:** Sets the siteConfig. The siteConfig is a protected configuration for repeat use. Calls\n * to reset() will reset the currentConfig to siteConfig. Calls to reset(configApi.defaultConfig)\n * will reset siteConfig and currentConfig to the defaultConfig Note: currentConfig is set in this\n * function _Default value: At default, will mirror Global Config_\n *\n * @param conf - The base currentConfig to use as siteConfig\n * @returns The new siteConfig\n */\nexport const setSiteConfig = (conf: MermaidConfig): MermaidConfig => {\n siteConfig = assignWithDepth({}, defaultConfig);\n siteConfig = assignWithDepth(siteConfig, conf);\n\n // @ts-ignore: TODO Fix ts errors\n if (conf.theme && theme[conf.theme]) {\n // @ts-ignore: TODO Fix ts errors\n siteConfig.themeVariables = theme[conf.theme].getThemeVariables(conf.themeVariables);\n }\n\n updateCurrentConfig(siteConfig, directives);\n return siteConfig;\n};\n\nexport const saveConfigFromInitialize = (conf: MermaidConfig): void => {\n configFromInitialize = assignWithDepth({}, conf);\n};\n\nexport const updateSiteConfig = (conf: MermaidConfig): MermaidConfig => {\n siteConfig = assignWithDepth(siteConfig, conf);\n updateCurrentConfig(siteConfig, directives);\n\n return siteConfig;\n};\n/**\n * ## getSiteConfig\n *\n * | Function | Description | Type | Values |\n * | ------------- | ------------------------------------------------- | ----------- | -------------------------------- |\n * | setSiteConfig | Returns the current siteConfig base configuration | Get Request | Returns Any Values in siteConfig |\n *\n * **Notes**: Returns **any** values in siteConfig.\n *\n * @returns The siteConfig\n */\nexport const getSiteConfig = (): MermaidConfig => {\n return assignWithDepth({}, siteConfig);\n};\n/**\n * ## setConfig\n *\n * | Function | Description | Type | Values |\n * | ------------- | ------------------------------------- | ----------- | --------------------------------------- |\n * | setSiteConfig | Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array |\n *\n * **Notes**: Sets the currentConfig. The parameter conf is sanitized based on the siteConfig.secure\n * keys. Any values found in conf with key found in siteConfig.secure will be replaced with the\n * corresponding siteConfig value.\n *\n * @param conf - The potential currentConfig\n * @returns The currentConfig merged with the sanitized conf\n */\nexport const setConfig = (conf: MermaidConfig): MermaidConfig => {\n checkConfig(conf);\n assignWithDepth(currentConfig, conf);\n\n return getConfig();\n};\n\n/**\n * ## getConfig\n *\n * | Function | Description | Type | Return Values |\n * | --------- | ------------------------- | ----------- | ------------------------------ |\n * | getConfig | Obtains the currentConfig | Get Request | Any Values from current Config |\n *\n * **Notes**: Avoid calling this function repeatedly. Instead, store the result in a variable and use it, and pass it down to function calls.\n *\n * @returns The currentConfig\n */\nexport const getConfig = (): MermaidConfig => {\n return assignWithDepth({}, currentConfig);\n};\n/**\n * ## sanitize\n *\n * | Function | Description | Type | Values |\n * | -------- | -------------------------------------- | ----------- | ------ |\n * | sanitize | Sets the siteConfig to desired values. | Put Request | None |\n *\n * Ensures options parameter does not attempt to override siteConfig secure keys **Notes**: modifies\n * options in-place\n *\n * @param options - The potential setConfig parameter\n */\nexport const sanitize = (options: any) => {\n if (!options) {\n return;\n }\n // Checking that options are not in the list of excluded options\n ['secure', ...(siteConfig.secure ?? [])].forEach((key) => {\n if (Object.hasOwn(options, key)) {\n // DO NOT attempt to print options[key] within `${}` as a malicious script\n // can exploit the logger's attempt to stringify the value and execute arbitrary code\n log.debug(`Denied attempt to modify a secure key ${key}`, options[key]);\n delete options[key];\n }\n });\n\n // Check that there no attempts of prototype pollution\n Object.keys(options).forEach((key) => {\n if (key.startsWith('__')) {\n delete options[key];\n }\n });\n // Check that there no attempts of xss, there should be no tags at all in the directive\n // blocking data urls as base64 urls can contain svg's with inline script tags\n Object.keys(options).forEach((key) => {\n if (\n typeof options[key] === 'string' &&\n (options[key].includes('<') ||\n options[key].includes('>') ||\n options[key].includes('url(data:'))\n ) {\n delete options[key];\n }\n if (typeof options[key] === 'object') {\n sanitize(options[key]);\n }\n });\n};\n\n/**\n * Pushes in a directive to the configuration\n *\n * @param directive - The directive to push in\n */\nexport const addDirective = (directive: MermaidConfig) => {\n sanitizeDirective(directive);\n\n // If the directive has a fontFamily, but no themeVariables, add the fontFamily to the themeVariables\n if (directive.fontFamily && !directive.themeVariables?.fontFamily) {\n directive.themeVariables = {\n ...directive.themeVariables,\n fontFamily: directive.fontFamily,\n };\n }\n\n directives.push(directive);\n updateCurrentConfig(siteConfig, directives);\n};\n\n/**\n * ## reset\n *\n * | Function | Description | Type | Required | Values |\n * | -------- | ---------------------------- | ----------- | -------- | ------ |\n * | reset | Resets currentConfig to conf | Put Request | Required | None |\n *\n * ## conf\n *\n * | Parameter | Description | Type | Required | Values |\n * | --------- | -------------------------------------------------------------- | ---------- | -------- | -------------------------------------------- |\n * | conf | base set of values, which currentConfig could be **reset** to. | Dictionary | Required | Any Values, with respect to the secure Array |\n *\n * **Notes**: (default: current siteConfig ) (optional, default `getSiteConfig()`)\n *\n * @param config - base set of values, which currentConfig could be **reset** to.\n * Defaults to the current siteConfig (e.g returned by {@link getSiteConfig}).\n */\nexport const reset = (config = siteConfig): void => {\n // Replace current config with siteConfig\n directives = [];\n updateCurrentConfig(config, directives);\n};\n\nconst ConfigWarning = {\n LAZY_LOAD_DEPRECATED:\n 'The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead.',\n} as const;\n\ntype ConfigWarningStrings = keyof typeof ConfigWarning;\nconst issuedWarnings: { [key in ConfigWarningStrings]?: boolean } = {};\nconst issueWarning = (warning: ConfigWarningStrings) => {\n if (issuedWarnings[warning]) {\n return;\n }\n log.warn(ConfigWarning[warning]);\n issuedWarnings[warning] = true;\n};\n\nconst checkConfig = (config: MermaidConfig) => {\n if (!config) {\n return;\n }\n // @ts-expect-error Properties were removed in v10. Warning should exist.\n if (config.lazyLoadedDiagrams || config.loadExternalDiagramsAtStartup) {\n issueWarning('LAZY_LOAD_DEPRECATED');\n }\n};\n", "const {\n entries,\n setPrototypeOf,\n isFrozen,\n getPrototypeOf,\n getOwnPropertyDescriptor,\n} = Object;\n\nlet { freeze, seal, create } = Object; // eslint-disable-line import/no-mutable-exports\nlet { apply, construct } = typeof Reflect !== 'undefined' && Reflect;\n\nif (!freeze) {\n freeze = function (x) {\n return x;\n };\n}\n\nif (!seal) {\n seal = function (x) {\n return x;\n };\n}\n\nif (!apply) {\n apply = function (fun, thisValue, args) {\n return fun.apply(thisValue, args);\n };\n}\n\nif (!construct) {\n construct = function (Func, args) {\n return new Func(...args);\n };\n}\n\nconst arrayForEach = unapply(Array.prototype.forEach);\nconst arrayIndexOf = unapply(Array.prototype.indexOf);\nconst arrayPop = unapply(Array.prototype.pop);\nconst arrayPush = unapply(Array.prototype.push);\nconst arraySlice = unapply(Array.prototype.slice);\n\nconst stringToLowerCase = unapply(String.prototype.toLowerCase);\nconst stringToString = unapply(String.prototype.toString);\nconst stringMatch = unapply(String.prototype.match);\nconst stringReplace = unapply(String.prototype.replace);\nconst stringIndexOf = unapply(String.prototype.indexOf);\nconst stringTrim = unapply(String.prototype.trim);\n\nconst objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);\n\nconst regExpTest = unapply(RegExp.prototype.test);\n\nconst typeErrorCreate = unconstruct(TypeError);\n\n/**\n * Creates a new function that calls the given function with a specified thisArg and arguments.\n *\n * @param {Function} func - The function to be wrapped and called.\n * @returns {Function} A new function that calls the given function with a specified thisArg and arguments.\n */\nfunction unapply(func) {\n return (thisArg, ...args) => apply(func, thisArg, args);\n}\n\n/**\n * Creates a new function that constructs an instance of the given constructor function with the provided arguments.\n *\n * @param {Function} func - The constructor function to be wrapped and called.\n * @returns {Function} A new function that constructs an instance of the given constructor function with the provided arguments.\n */\nfunction unconstruct(func) {\n return (...args) => construct(func, args);\n}\n\n/**\n * Add properties to a lookup table\n *\n * @param {Object} set - The set to which elements will be added.\n * @param {Array} array - The array containing elements to be added to the set.\n * @param {Function} transformCaseFunc - An optional function to transform the case of each element before adding to the set.\n * @returns {Object} The modified set with added elements.\n */\nfunction addToSet(set, array, transformCaseFunc = stringToLowerCase) {\n if (setPrototypeOf) {\n // Make 'in' and truthy checks like Boolean(set.constructor)\n // independent of any properties defined on Object.prototype.\n // Prevent prototype setters from intercepting set as a this value.\n setPrototypeOf(set, null);\n }\n\n let l = array.length;\n while (l--) {\n let element = array[l];\n if (typeof element === 'string') {\n const lcElement = transformCaseFunc(element);\n if (lcElement !== element) {\n // Config presets (e.g. tags.js, attrs.js) are immutable.\n if (!isFrozen(array)) {\n array[l] = lcElement;\n }\n\n element = lcElement;\n }\n }\n\n set[element] = true;\n }\n\n return set;\n}\n\n/**\n * Clean up an array to harden against CSPP\n *\n * @param {Array} array - The array to be cleaned.\n * @returns {Array} The cleaned version of the array\n */\nfunction cleanArray(array) {\n for (let index = 0; index < array.length; index++) {\n const isPropertyExist = objectHasOwnProperty(array, index);\n\n if (!isPropertyExist) {\n array[index] = null;\n }\n }\n\n return array;\n}\n\n/**\n * Shallow clone an object\n *\n * @param {Object} object - The object to be cloned.\n * @returns {Object} A new object that copies the original.\n */\nfunction clone(object) {\n const newObject = create(null);\n\n for (const [property, value] of entries(object)) {\n const isPropertyExist = objectHasOwnProperty(object, property);\n\n if (isPropertyExist) {\n if (Array.isArray(value)) {\n newObject[property] = cleanArray(value);\n } else if (\n value &&\n typeof value === 'object' &&\n value.constructor === Object\n ) {\n newObject[property] = clone(value);\n } else {\n newObject[property] = value;\n }\n }\n }\n\n return newObject;\n}\n\n/**\n * This method automatically checks if the prop is function or getter and behaves accordingly.\n *\n * @param {Object} object - The object to look up the getter function in its prototype chain.\n * @param {String} prop - The property name for which to find the getter function.\n * @returns {Function} The getter function found in the prototype chain or a fallback function.\n */\nfunction lookupGetter(object, prop) {\n while (object !== null) {\n const desc = getOwnPropertyDescriptor(object, prop);\n\n if (desc) {\n if (desc.get) {\n return unapply(desc.get);\n }\n\n if (typeof desc.value === 'function') {\n return unapply(desc.value);\n }\n }\n\n object = getPrototypeOf(object);\n }\n\n function fallbackValue() {\n return null;\n }\n\n return fallbackValue;\n}\n\nexport {\n // Array\n arrayForEach,\n arrayIndexOf,\n arrayPop,\n arrayPush,\n arraySlice,\n // Object\n entries,\n freeze,\n getPrototypeOf,\n getOwnPropertyDescriptor,\n isFrozen,\n setPrototypeOf,\n seal,\n clone,\n create,\n objectHasOwnProperty,\n // RegExp\n regExpTest,\n // String\n stringIndexOf,\n stringMatch,\n stringReplace,\n stringToLowerCase,\n stringToString,\n stringTrim,\n // Errors\n typeErrorCreate,\n // Other\n lookupGetter,\n addToSet,\n // Reflect\n unapply,\n unconstruct,\n};\n", "import { freeze } from './utils.js';\n\nexport const html = freeze([\n 'a',\n 'abbr',\n 'acronym',\n 'address',\n 'area',\n 'article',\n 'aside',\n 'audio',\n 'b',\n 'bdi',\n 'bdo',\n 'big',\n 'blink',\n 'blockquote',\n 'body',\n 'br',\n 'button',\n 'canvas',\n 'caption',\n 'center',\n 'cite',\n 'code',\n 'col',\n 'colgroup',\n 'content',\n 'data',\n 'datalist',\n 'dd',\n 'decorator',\n 'del',\n 'details',\n 'dfn',\n 'dialog',\n 'dir',\n 'div',\n 'dl',\n 'dt',\n 'element',\n 'em',\n 'fieldset',\n 'figcaption',\n 'figure',\n 'font',\n 'footer',\n 'form',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'head',\n 'header',\n 'hgroup',\n 'hr',\n 'html',\n 'i',\n 'img',\n 'input',\n 'ins',\n 'kbd',\n 'label',\n 'legend',\n 'li',\n 'main',\n 'map',\n 'mark',\n 'marquee',\n 'menu',\n 'menuitem',\n 'meter',\n 'nav',\n 'nobr',\n 'ol',\n 'optgroup',\n 'option',\n 'output',\n 'p',\n 'picture',\n 'pre',\n 'progress',\n 'q',\n 'rp',\n 'rt',\n 'ruby',\n 's',\n 'samp',\n 'section',\n 'select',\n 'shadow',\n 'small',\n 'source',\n 'spacer',\n 'span',\n 'strike',\n 'strong',\n 'style',\n 'sub',\n 'summary',\n 'sup',\n 'table',\n 'tbody',\n 'td',\n 'template',\n 'textarea',\n 'tfoot',\n 'th',\n 'thead',\n 'time',\n 'tr',\n 'track',\n 'tt',\n 'u',\n 'ul',\n 'var',\n 'video',\n 'wbr',\n]);\n\n// SVG\nexport const svg = freeze([\n 'svg',\n 'a',\n 'altglyph',\n 'altglyphdef',\n 'altglyphitem',\n 'animatecolor',\n 'animatemotion',\n 'animatetransform',\n 'circle',\n 'clippath',\n 'defs',\n 'desc',\n 'ellipse',\n 'filter',\n 'font',\n 'g',\n 'glyph',\n 'glyphref',\n 'hkern',\n 'image',\n 'line',\n 'lineargradient',\n 'marker',\n 'mask',\n 'metadata',\n 'mpath',\n 'path',\n 'pattern',\n 'polygon',\n 'polyline',\n 'radialgradient',\n 'rect',\n 'stop',\n 'style',\n 'switch',\n 'symbol',\n 'text',\n 'textpath',\n 'title',\n 'tref',\n 'tspan',\n 'view',\n 'vkern',\n]);\n\nexport const svgFilters = freeze([\n 'feBlend',\n 'feColorMatrix',\n 'feComponentTransfer',\n 'feComposite',\n 'feConvolveMatrix',\n 'feDiffuseLighting',\n 'feDisplacementMap',\n 'feDistantLight',\n 'feDropShadow',\n 'feFlood',\n 'feFuncA',\n 'feFuncB',\n 'feFuncG',\n 'feFuncR',\n 'feGaussianBlur',\n 'feImage',\n 'feMerge',\n 'feMergeNode',\n 'feMorphology',\n 'feOffset',\n 'fePointLight',\n 'feSpecularLighting',\n 'feSpotLight',\n 'feTile',\n 'feTurbulence',\n]);\n\n// List of SVG elements that are disallowed by default.\n// We still need to know them so that we can do namespace\n// checks properly in case one wants to add them to\n// allow-list.\nexport const svgDisallowed = freeze([\n 'animate',\n 'color-profile',\n 'cursor',\n 'discard',\n 'font-face',\n 'font-face-format',\n 'font-face-name',\n 'font-face-src',\n 'font-face-uri',\n 'foreignobject',\n 'hatch',\n 'hatchpath',\n 'mesh',\n 'meshgradient',\n 'meshpatch',\n 'meshrow',\n 'missing-glyph',\n 'script',\n 'set',\n 'solidcolor',\n 'unknown',\n 'use',\n]);\n\nexport const mathMl = freeze([\n 'math',\n 'menclose',\n 'merror',\n 'mfenced',\n 'mfrac',\n 'mglyph',\n 'mi',\n 'mlabeledtr',\n 'mmultiscripts',\n 'mn',\n 'mo',\n 'mover',\n 'mpadded',\n 'mphantom',\n 'mroot',\n 'mrow',\n 'ms',\n 'mspace',\n 'msqrt',\n 'mstyle',\n 'msub',\n 'msup',\n 'msubsup',\n 'mtable',\n 'mtd',\n 'mtext',\n 'mtr',\n 'munder',\n 'munderover',\n 'mprescripts',\n]);\n\n// Similarly to SVG, we want to know all MathML elements,\n// even those that we disallow by default.\nexport const mathMlDisallowed = freeze([\n 'maction',\n 'maligngroup',\n 'malignmark',\n 'mlongdiv',\n 'mscarries',\n 'mscarry',\n 'msgroup',\n 'mstack',\n 'msline',\n 'msrow',\n 'semantics',\n 'annotation',\n 'annotation-xml',\n 'mprescripts',\n 'none',\n]);\n\nexport const text = freeze(['#text']);\n", "import { freeze } from './utils.js';\n\nexport const html = freeze([\n 'accept',\n 'action',\n 'align',\n 'alt',\n 'autocapitalize',\n 'autocomplete',\n 'autopictureinpicture',\n 'autoplay',\n 'background',\n 'bgcolor',\n 'border',\n 'capture',\n 'cellpadding',\n 'cellspacing',\n 'checked',\n 'cite',\n 'class',\n 'clear',\n 'color',\n 'cols',\n 'colspan',\n 'controls',\n 'controlslist',\n 'coords',\n 'crossorigin',\n 'datetime',\n 'decoding',\n 'default',\n 'dir',\n 'disabled',\n 'disablepictureinpicture',\n 'disableremoteplayback',\n 'download',\n 'draggable',\n 'enctype',\n 'enterkeyhint',\n 'face',\n 'for',\n 'headers',\n 'height',\n 'hidden',\n 'high',\n 'href',\n 'hreflang',\n 'id',\n 'inputmode',\n 'integrity',\n 'ismap',\n 'kind',\n 'label',\n 'lang',\n 'list',\n 'loading',\n 'loop',\n 'low',\n 'max',\n 'maxlength',\n 'media',\n 'method',\n 'min',\n 'minlength',\n 'multiple',\n 'muted',\n 'name',\n 'nonce',\n 'noshade',\n 'novalidate',\n 'nowrap',\n 'open',\n 'optimum',\n 'pattern',\n 'placeholder',\n 'playsinline',\n 'popover',\n 'popovertarget',\n 'popovertargetaction',\n 'poster',\n 'preload',\n 'pubdate',\n 'radiogroup',\n 'readonly',\n 'rel',\n 'required',\n 'rev',\n 'reversed',\n 'role',\n 'rows',\n 'rowspan',\n 'spellcheck',\n 'scope',\n 'selected',\n 'shape',\n 'size',\n 'sizes',\n 'span',\n 'srclang',\n 'start',\n 'src',\n 'srcset',\n 'step',\n 'style',\n 'summary',\n 'tabindex',\n 'title',\n 'translate',\n 'type',\n 'usemap',\n 'valign',\n 'value',\n 'width',\n 'wrap',\n 'xmlns',\n 'slot',\n]);\n\nexport const svg = freeze([\n 'accent-height',\n 'accumulate',\n 'additive',\n 'alignment-baseline',\n 'ascent',\n 'attributename',\n 'attributetype',\n 'azimuth',\n 'basefrequency',\n 'baseline-shift',\n 'begin',\n 'bias',\n 'by',\n 'class',\n 'clip',\n 'clippathunits',\n 'clip-path',\n 'clip-rule',\n 'color',\n 'color-interpolation',\n 'color-interpolation-filters',\n 'color-profile',\n 'color-rendering',\n 'cx',\n 'cy',\n 'd',\n 'dx',\n 'dy',\n 'diffuseconstant',\n 'direction',\n 'display',\n 'divisor',\n 'dur',\n 'edgemode',\n 'elevation',\n 'end',\n 'fill',\n 'fill-opacity',\n 'fill-rule',\n 'filter',\n 'filterunits',\n 'flood-color',\n 'flood-opacity',\n 'font-family',\n 'font-size',\n 'font-size-adjust',\n 'font-stretch',\n 'font-style',\n 'font-variant',\n 'font-weight',\n 'fx',\n 'fy',\n 'g1',\n 'g2',\n 'glyph-name',\n 'glyphref',\n 'gradientunits',\n 'gradienttransform',\n 'height',\n 'href',\n 'id',\n 'image-rendering',\n 'in',\n 'in2',\n 'k',\n 'k1',\n 'k2',\n 'k3',\n 'k4',\n 'kerning',\n 'keypoints',\n 'keysplines',\n 'keytimes',\n 'lang',\n 'lengthadjust',\n 'letter-spacing',\n 'kernelmatrix',\n 'kernelunitlength',\n 'lighting-color',\n 'local',\n 'marker-end',\n 'marker-mid',\n 'marker-start',\n 'markerheight',\n 'markerunits',\n 'markerwidth',\n 'maskcontentunits',\n 'maskunits',\n 'max',\n 'mask',\n 'media',\n 'method',\n 'mode',\n 'min',\n 'name',\n 'numoctaves',\n 'offset',\n 'operator',\n 'opacity',\n 'order',\n 'orient',\n 'orientation',\n 'origin',\n 'overflow',\n 'paint-order',\n 'path',\n 'pathlength',\n 'patterncontentunits',\n 'patterntransform',\n 'patternunits',\n 'points',\n 'preservealpha',\n 'preserveaspectratio',\n 'primitiveunits',\n 'r',\n 'rx',\n 'ry',\n 'radius',\n 'refx',\n 'refy',\n 'repeatcount',\n 'repeatdur',\n 'restart',\n 'result',\n 'rotate',\n 'scale',\n 'seed',\n 'shape-rendering',\n 'specularconstant',\n 'specularexponent',\n 'spreadmethod',\n 'startoffset',\n 'stddeviation',\n 'stitchtiles',\n 'stop-color',\n 'stop-opacity',\n 'stroke-dasharray',\n 'stroke-dashoffset',\n 'stroke-linecap',\n 'stroke-linejoin',\n 'stroke-miterlimit',\n 'stroke-opacity',\n 'stroke',\n 'stroke-width',\n 'style',\n 'surfacescale',\n 'systemlanguage',\n 'tabindex',\n 'targetx',\n 'targety',\n 'transform',\n 'transform-origin',\n 'text-anchor',\n 'text-decoration',\n 'text-rendering',\n 'textlength',\n 'type',\n 'u1',\n 'u2',\n 'unicode',\n 'values',\n 'viewbox',\n 'visibility',\n 'version',\n 'vert-adv-y',\n 'vert-origin-x',\n 'vert-origin-y',\n 'width',\n 'word-spacing',\n 'wrap',\n 'writing-mode',\n 'xchannelselector',\n 'ychannelselector',\n 'x',\n 'x1',\n 'x2',\n 'xmlns',\n 'y',\n 'y1',\n 'y2',\n 'z',\n 'zoomandpan',\n]);\n\nexport const mathMl = freeze([\n 'accent',\n 'accentunder',\n 'align',\n 'bevelled',\n 'close',\n 'columnsalign',\n 'columnlines',\n 'columnspan',\n 'denomalign',\n 'depth',\n 'dir',\n 'display',\n 'displaystyle',\n 'encoding',\n 'fence',\n 'frame',\n 'height',\n 'href',\n 'id',\n 'largeop',\n 'length',\n 'linethickness',\n 'lspace',\n 'lquote',\n 'mathbackground',\n 'mathcolor',\n 'mathsize',\n 'mathvariant',\n 'maxsize',\n 'minsize',\n 'movablelimits',\n 'notation',\n 'numalign',\n 'open',\n 'rowalign',\n 'rowlines',\n 'rowspacing',\n 'rowspan',\n 'rspace',\n 'rquote',\n 'scriptlevel',\n 'scriptminsize',\n 'scriptsizemultiplier',\n 'selection',\n 'separator',\n 'separators',\n 'stretchy',\n 'subscriptshift',\n 'supscriptshift',\n 'symmetric',\n 'voffset',\n 'width',\n 'xmlns',\n]);\n\nexport const xml = freeze([\n 'xlink:href',\n 'xml:id',\n 'xlink:title',\n 'xml:space',\n 'xmlns:xlink',\n]);\n", "import { seal } from './utils.js';\n\n// eslint-disable-next-line unicorn/better-regex\nexport const MUSTACHE_EXPR = seal(/\\{\\{[\\w\\W]*|[\\w\\W]*\\}\\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode\nexport const ERB_EXPR = seal(/<%[\\w\\W]*|[\\w\\W]*%>/gm);\nexport const TMPLIT_EXPR = seal(/\\${[\\w\\W]*}/gm);\nexport const DATA_ATTR = seal(/^data-[\\-\\w.\\u00B7-\\uFFFF]/); // eslint-disable-line no-useless-escape\nexport const ARIA_ATTR = seal(/^aria-[\\-\\w]+$/); // eslint-disable-line no-useless-escape\nexport const IS_ALLOWED_URI = seal(\n /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i // eslint-disable-line no-useless-escape\n);\nexport const IS_SCRIPT_OR_DATA = seal(/^(?:\\w+script|data):/i);\nexport const ATTR_WHITESPACE = seal(\n /[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205F\\u3000]/g // eslint-disable-line no-control-regex\n);\nexport const DOCTYPE_NAME = seal(/^html$/i);\nexport const CUSTOM_ELEMENT = seal(/^[a-z][.\\w]*(-[.\\w]+)+$/i);\n", "import * as TAGS from './tags.js';\nimport * as ATTRS from './attrs.js';\nimport * as EXPRESSIONS from './regexp.js';\nimport {\n addToSet,\n clone,\n entries,\n freeze,\n arrayForEach,\n arrayPop,\n arrayPush,\n stringMatch,\n stringReplace,\n stringToLowerCase,\n stringToString,\n stringIndexOf,\n stringTrim,\n regExpTest,\n typeErrorCreate,\n lookupGetter,\n create,\n objectHasOwnProperty,\n} from './utils.js';\n\n// https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType\nconst NODE_TYPE = {\n element: 1,\n attribute: 2,\n text: 3,\n cdataSection: 4,\n entityReference: 5, // Deprecated\n entityNode: 6, // Deprecated\n progressingInstruction: 7,\n comment: 8,\n document: 9,\n documentType: 10,\n documentFragment: 11,\n notation: 12, // Deprecated\n};\n\nconst getGlobal = function () {\n return typeof window === 'undefined' ? null : window;\n};\n\n/**\n * Creates a no-op policy for internal use only.\n * Don't export this function outside this module!\n * @param {TrustedTypePolicyFactory} trustedTypes The policy factory.\n * @param {HTMLScriptElement} purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).\n * @return {TrustedTypePolicy} The policy created (or null, if Trusted Types\n * are not supported or creating the policy failed).\n */\nconst _createTrustedTypesPolicy = function (trustedTypes, purifyHostElement) {\n if (\n typeof trustedTypes !== 'object' ||\n typeof trustedTypes.createPolicy !== 'function'\n ) {\n return null;\n }\n\n // Allow the callers to control the unique policy name\n // by adding a data-tt-policy-suffix to the script element with the DOMPurify.\n // Policy creation with duplicate names throws in Trusted Types.\n let suffix = null;\n const ATTR_NAME = 'data-tt-policy-suffix';\n if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {\n suffix = purifyHostElement.getAttribute(ATTR_NAME);\n }\n\n const policyName = 'dompurify' + (suffix ? '#' + suffix : '');\n\n try {\n return trustedTypes.createPolicy(policyName, {\n createHTML(html) {\n return html;\n },\n createScriptURL(scriptUrl) {\n return scriptUrl;\n },\n });\n } catch (_) {\n // Policy creation failed (most likely another DOMPurify script has\n // already run). Skip creating the policy, as this will only cause errors\n // if TT are enforced.\n console.warn(\n 'TrustedTypes policy ' + policyName + ' could not be created.'\n );\n return null;\n }\n};\n\nfunction createDOMPurify(window = getGlobal()) {\n const DOMPurify = (root) => createDOMPurify(root);\n\n /**\n * Version label, exposed for easier checks\n * if DOMPurify is up to date or not\n */\n DOMPurify.version = VERSION;\n\n /**\n * Array of elements that DOMPurify removed during sanitation.\n * Empty if nothing was removed.\n */\n DOMPurify.removed = [];\n\n if (\n !window ||\n !window.document ||\n window.document.nodeType !== NODE_TYPE.document\n ) {\n // Not running in a browser, provide a factory function\n // so that you can pass your own Window\n DOMPurify.isSupported = false;\n\n return DOMPurify;\n }\n\n let { document } = window;\n\n const originalDocument = document;\n const currentScript = originalDocument.currentScript;\n const {\n DocumentFragment,\n HTMLTemplateElement,\n Node,\n Element,\n NodeFilter,\n NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,\n HTMLFormElement,\n DOMParser,\n trustedTypes,\n } = window;\n\n const ElementPrototype = Element.prototype;\n\n const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');\n const remove = lookupGetter(ElementPrototype, 'remove');\n const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');\n const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');\n const getParentNode = lookupGetter(ElementPrototype, 'parentNode');\n\n // As per issue #47, the web-components registry is inherited by a\n // new document created via createHTMLDocument. As per the spec\n // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)\n // a new empty registry is used when creating a template contents owner\n // document, so we use that as our parent document to ensure nothing\n // is inherited.\n if (typeof HTMLTemplateElement === 'function') {\n const template = document.createElement('template');\n if (template.content && template.content.ownerDocument) {\n document = template.content.ownerDocument;\n }\n }\n\n let trustedTypesPolicy;\n let emptyHTML = '';\n\n const {\n implementation,\n createNodeIterator,\n createDocumentFragment,\n getElementsByTagName,\n } = document;\n const { importNode } = originalDocument;\n\n let hooks = {};\n\n /**\n * Expose whether this browser supports running the full DOMPurify.\n */\n DOMPurify.isSupported =\n typeof entries === 'function' &&\n typeof getParentNode === 'function' &&\n implementation &&\n implementation.createHTMLDocument !== undefined;\n\n const {\n MUSTACHE_EXPR,\n ERB_EXPR,\n TMPLIT_EXPR,\n DATA_ATTR,\n ARIA_ATTR,\n IS_SCRIPT_OR_DATA,\n ATTR_WHITESPACE,\n CUSTOM_ELEMENT,\n } = EXPRESSIONS;\n\n let { IS_ALLOWED_URI } = EXPRESSIONS;\n\n /**\n * We consider the elements and attributes below to be safe. Ideally\n * don't add any new ones but feel free to remove unwanted ones.\n */\n\n /* allowed element names */\n let ALLOWED_TAGS = null;\n const DEFAULT_ALLOWED_TAGS = addToSet({}, [\n ...TAGS.html,\n ...TAGS.svg,\n ...TAGS.svgFilters,\n ...TAGS.mathMl,\n ...TAGS.text,\n ]);\n\n /* Allowed attribute names */\n let ALLOWED_ATTR = null;\n const DEFAULT_ALLOWED_ATTR = addToSet({}, [\n ...ATTRS.html,\n ...ATTRS.svg,\n ...ATTRS.mathMl,\n ...ATTRS.xml,\n ]);\n\n /*\n * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.\n * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)\n * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)\n * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.\n */\n let CUSTOM_ELEMENT_HANDLING = Object.seal(\n create(null, {\n tagNameCheck: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: null,\n },\n attributeNameCheck: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: null,\n },\n allowCustomizedBuiltInElements: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: false,\n },\n })\n );\n\n /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */\n let FORBID_TAGS = null;\n\n /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */\n let FORBID_ATTR = null;\n\n /* Decide if ARIA attributes are okay */\n let ALLOW_ARIA_ATTR = true;\n\n /* Decide if custom data attributes are okay */\n let ALLOW_DATA_ATTR = true;\n\n /* Decide if unknown protocols are okay */\n let ALLOW_UNKNOWN_PROTOCOLS = false;\n\n /* Decide if self-closing tags in attributes are allowed.\n * Usually removed due to a mXSS issue in jQuery 3.0 */\n let ALLOW_SELF_CLOSE_IN_ATTR = true;\n\n /* Output should be safe for common template engines.\n * This means, DOMPurify removes data attributes, mustaches and ERB\n */\n let SAFE_FOR_TEMPLATES = false;\n\n /* Output should be safe even for XML used within HTML and alike.\n * This means, DOMPurify removes comments when containing risky content.\n */\n let SAFE_FOR_XML = true;\n\n /* Decide if document with ... should be returned */\n let WHOLE_DOCUMENT = false;\n\n /* Track whether config is already set on this instance of DOMPurify. */\n let SET_CONFIG = false;\n\n /* Decide if all elements (e.g. style, script) must be children of\n * document.body. By default, browsers might move them to document.head */\n let FORCE_BODY = false;\n\n /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html\n * string (or a TrustedHTML object if Trusted Types are supported).\n * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead\n */\n let RETURN_DOM = false;\n\n /* Decide if a DOM `DocumentFragment` should be returned, instead of a html\n * string (or a TrustedHTML object if Trusted Types are supported) */\n let RETURN_DOM_FRAGMENT = false;\n\n /* Try to return a Trusted Type object instead of a string, return a string in\n * case Trusted Types are not supported */\n let RETURN_TRUSTED_TYPE = false;\n\n /* Output should be free from DOM clobbering attacks?\n * This sanitizes markups named with colliding, clobberable built-in DOM APIs.\n */\n let SANITIZE_DOM = true;\n\n /* Achieve full DOM Clobbering protection by isolating the namespace of named\n * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.\n *\n * HTML/DOM spec rules that enable DOM Clobbering:\n * - Named Access on Window (§7.3.3)\n * - DOM Tree Accessors (§3.1.5)\n * - Form Element Parent-Child Relations (§4.10.3)\n * - Iframe srcdoc / Nested WindowProxies (§4.8.5)\n * - HTMLCollection (§4.2.10.2)\n *\n * Namespace isolation is implemented by prefixing `id` and `name` attributes\n * with a constant string, i.e., `user-content-`\n */\n let SANITIZE_NAMED_PROPS = false;\n const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';\n\n /* Keep element content when removing element? */\n let KEEP_CONTENT = true;\n\n /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead\n * of importing it into a new Document and returning a sanitized copy */\n let IN_PLACE = false;\n\n /* Allow usage of profiles like html, svg and mathMl */\n let USE_PROFILES = {};\n\n /* Tags to ignore content of when KEEP_CONTENT is true */\n let FORBID_CONTENTS = null;\n const DEFAULT_FORBID_CONTENTS = addToSet({}, [\n 'annotation-xml',\n 'audio',\n 'colgroup',\n 'desc',\n 'foreignobject',\n 'head',\n 'iframe',\n 'math',\n 'mi',\n 'mn',\n 'mo',\n 'ms',\n 'mtext',\n 'noembed',\n 'noframes',\n 'noscript',\n 'plaintext',\n 'script',\n 'style',\n 'svg',\n 'template',\n 'thead',\n 'title',\n 'video',\n 'xmp',\n ]);\n\n /* Tags that are safe for data: URIs */\n let DATA_URI_TAGS = null;\n const DEFAULT_DATA_URI_TAGS = addToSet({}, [\n 'audio',\n 'video',\n 'img',\n 'source',\n 'image',\n 'track',\n ]);\n\n /* Attributes safe for values like \"javascript:\" */\n let URI_SAFE_ATTRIBUTES = null;\n const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, [\n 'alt',\n 'class',\n 'for',\n 'id',\n 'label',\n 'name',\n 'pattern',\n 'placeholder',\n 'role',\n 'summary',\n 'title',\n 'value',\n 'style',\n 'xmlns',\n ]);\n\n const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';\n const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\n const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\n /* Document namespace */\n let NAMESPACE = HTML_NAMESPACE;\n let IS_EMPTY_INPUT = false;\n\n /* Allowed XHTML+XML namespaces */\n let ALLOWED_NAMESPACES = null;\n const DEFAULT_ALLOWED_NAMESPACES = addToSet(\n {},\n [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE],\n stringToString\n );\n\n /* Parsing of strict XHTML documents */\n let PARSER_MEDIA_TYPE = null;\n const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];\n const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';\n let transformCaseFunc = null;\n\n /* Keep a reference to config to pass to hooks */\n let CONFIG = null;\n\n /* Ideally, do not touch anything below this line */\n /* ______________________________________________ */\n\n const formElement = document.createElement('form');\n\n const isRegexOrFunction = function (testValue) {\n return testValue instanceof RegExp || testValue instanceof Function;\n };\n\n /**\n * _parseConfig\n *\n * @param {Object} cfg optional config literal\n */\n // eslint-disable-next-line complexity\n const _parseConfig = function (cfg = {}) {\n if (CONFIG && CONFIG === cfg) {\n return;\n }\n\n /* Shield configuration object from tampering */\n if (!cfg || typeof cfg !== 'object') {\n cfg = {};\n }\n\n /* Shield configuration object from prototype pollution */\n cfg = clone(cfg);\n\n PARSER_MEDIA_TYPE =\n // eslint-disable-next-line unicorn/prefer-includes\n SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1\n ? DEFAULT_PARSER_MEDIA_TYPE\n : cfg.PARSER_MEDIA_TYPE;\n\n // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.\n transformCaseFunc =\n PARSER_MEDIA_TYPE === 'application/xhtml+xml'\n ? stringToString\n : stringToLowerCase;\n\n /* Set configuration parameters */\n ALLOWED_TAGS = objectHasOwnProperty(cfg, 'ALLOWED_TAGS')\n ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc)\n : DEFAULT_ALLOWED_TAGS;\n ALLOWED_ATTR = objectHasOwnProperty(cfg, 'ALLOWED_ATTR')\n ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc)\n : DEFAULT_ALLOWED_ATTR;\n ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, 'ALLOWED_NAMESPACES')\n ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString)\n : DEFAULT_ALLOWED_NAMESPACES;\n URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR')\n ? addToSet(\n clone(DEFAULT_URI_SAFE_ATTRIBUTES), // eslint-disable-line indent\n cfg.ADD_URI_SAFE_ATTR, // eslint-disable-line indent\n transformCaseFunc // eslint-disable-line indent\n ) // eslint-disable-line indent\n : DEFAULT_URI_SAFE_ATTRIBUTES;\n DATA_URI_TAGS = objectHasOwnProperty(cfg, 'ADD_DATA_URI_TAGS')\n ? addToSet(\n clone(DEFAULT_DATA_URI_TAGS), // eslint-disable-line indent\n cfg.ADD_DATA_URI_TAGS, // eslint-disable-line indent\n transformCaseFunc // eslint-disable-line indent\n ) // eslint-disable-line indent\n : DEFAULT_DATA_URI_TAGS;\n FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS')\n ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc)\n : DEFAULT_FORBID_CONTENTS;\n FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS')\n ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc)\n : {};\n FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR')\n ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc)\n : {};\n USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES')\n ? cfg.USE_PROFILES\n : false;\n ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true\n ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true\n ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false\n ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true\n SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false\n SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false; // Default true\n WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false\n RETURN_DOM = cfg.RETURN_DOM || false; // Default false\n RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false\n RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false\n FORCE_BODY = cfg.FORCE_BODY || false; // Default false\n SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true\n SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false\n KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true\n IN_PLACE = cfg.IN_PLACE || false; // Default false\n IS_ALLOWED_URI = cfg.ALLOWED_URI_REGEXP || EXPRESSIONS.IS_ALLOWED_URI;\n NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;\n CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};\n if (\n cfg.CUSTOM_ELEMENT_HANDLING &&\n isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)\n ) {\n CUSTOM_ELEMENT_HANDLING.tagNameCheck =\n cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;\n }\n\n if (\n cfg.CUSTOM_ELEMENT_HANDLING &&\n isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)\n ) {\n CUSTOM_ELEMENT_HANDLING.attributeNameCheck =\n cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;\n }\n\n if (\n cfg.CUSTOM_ELEMENT_HANDLING &&\n typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements ===\n 'boolean'\n ) {\n CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements =\n cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;\n }\n\n if (SAFE_FOR_TEMPLATES) {\n ALLOW_DATA_ATTR = false;\n }\n\n if (RETURN_DOM_FRAGMENT) {\n RETURN_DOM = true;\n }\n\n /* Parse profile info */\n if (USE_PROFILES) {\n ALLOWED_TAGS = addToSet({}, TAGS.text);\n ALLOWED_ATTR = [];\n if (USE_PROFILES.html === true) {\n addToSet(ALLOWED_TAGS, TAGS.html);\n addToSet(ALLOWED_ATTR, ATTRS.html);\n }\n\n if (USE_PROFILES.svg === true) {\n addToSet(ALLOWED_TAGS, TAGS.svg);\n addToSet(ALLOWED_ATTR, ATTRS.svg);\n addToSet(ALLOWED_ATTR, ATTRS.xml);\n }\n\n if (USE_PROFILES.svgFilters === true) {\n addToSet(ALLOWED_TAGS, TAGS.svgFilters);\n addToSet(ALLOWED_ATTR, ATTRS.svg);\n addToSet(ALLOWED_ATTR, ATTRS.xml);\n }\n\n if (USE_PROFILES.mathMl === true) {\n addToSet(ALLOWED_TAGS, TAGS.mathMl);\n addToSet(ALLOWED_ATTR, ATTRS.mathMl);\n addToSet(ALLOWED_ATTR, ATTRS.xml);\n }\n }\n\n /* Merge configuration parameters */\n if (cfg.ADD_TAGS) {\n if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {\n ALLOWED_TAGS = clone(ALLOWED_TAGS);\n }\n\n addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);\n }\n\n if (cfg.ADD_ATTR) {\n if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {\n ALLOWED_ATTR = clone(ALLOWED_ATTR);\n }\n\n addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);\n }\n\n if (cfg.ADD_URI_SAFE_ATTR) {\n addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);\n }\n\n if (cfg.FORBID_CONTENTS) {\n if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {\n FORBID_CONTENTS = clone(FORBID_CONTENTS);\n }\n\n addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);\n }\n\n /* Add #text in case KEEP_CONTENT is set to true */\n if (KEEP_CONTENT) {\n ALLOWED_TAGS['#text'] = true;\n }\n\n /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */\n if (WHOLE_DOCUMENT) {\n addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);\n }\n\n /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */\n if (ALLOWED_TAGS.table) {\n addToSet(ALLOWED_TAGS, ['tbody']);\n delete FORBID_TAGS.tbody;\n }\n\n if (cfg.TRUSTED_TYPES_POLICY) {\n if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {\n throw typeErrorCreate(\n 'TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.'\n );\n }\n\n if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {\n throw typeErrorCreate(\n 'TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.'\n );\n }\n\n // Overwrite existing TrustedTypes policy.\n trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;\n\n // Sign local variables required by `sanitize`.\n emptyHTML = trustedTypesPolicy.createHTML('');\n } else {\n // Uninitialized policy, attempt to initialize the internal dompurify policy.\n if (trustedTypesPolicy === undefined) {\n trustedTypesPolicy = _createTrustedTypesPolicy(\n trustedTypes,\n currentScript\n );\n }\n\n // If creating the internal policy succeeded sign internal variables.\n if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {\n emptyHTML = trustedTypesPolicy.createHTML('');\n }\n }\n\n // Prevent further manipulation of configuration.\n // Not available in IE8, Safari 5, etc.\n if (freeze) {\n freeze(cfg);\n }\n\n CONFIG = cfg;\n };\n\n const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, [\n 'mi',\n 'mo',\n 'mn',\n 'ms',\n 'mtext',\n ]);\n\n const HTML_INTEGRATION_POINTS = addToSet({}, [\n 'foreignobject',\n 'annotation-xml',\n ]);\n\n // Certain elements are allowed in both SVG and HTML\n // namespace. We need to specify them explicitly\n // so that they don't get erroneously deleted from\n // HTML namespace.\n const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, [\n 'title',\n 'style',\n 'font',\n 'a',\n 'script',\n ]);\n\n /* Keep track of all possible SVG and MathML tags\n * so that we can perform the namespace checks\n * correctly. */\n const ALL_SVG_TAGS = addToSet({}, [\n ...TAGS.svg,\n ...TAGS.svgFilters,\n ...TAGS.svgDisallowed,\n ]);\n const ALL_MATHML_TAGS = addToSet({}, [\n ...TAGS.mathMl,\n ...TAGS.mathMlDisallowed,\n ]);\n\n /**\n * @param {Element} element a DOM element whose namespace is being checked\n * @returns {boolean} Return false if the element has a\n * namespace that a spec-compliant parser would never\n * return. Return true otherwise.\n */\n const _checkValidNamespace = function (element) {\n let parent = getParentNode(element);\n\n // In JSDOM, if we're inside shadow DOM, then parentNode\n // can be null. We just simulate parent in this case.\n if (!parent || !parent.tagName) {\n parent = {\n namespaceURI: NAMESPACE,\n tagName: 'template',\n };\n }\n\n const tagName = stringToLowerCase(element.tagName);\n const parentTagName = stringToLowerCase(parent.tagName);\n\n if (!ALLOWED_NAMESPACES[element.namespaceURI]) {\n return false;\n }\n\n if (element.namespaceURI === SVG_NAMESPACE) {\n // The only way to switch from HTML namespace to SVG\n // is via . If it happens via any other tag, then\n // it should be killed.\n if (parent.namespaceURI === HTML_NAMESPACE) {\n return tagName === 'svg';\n }\n\n // The only way to switch from MathML to SVG is via`\n // svg if parent is either or MathML\n // text integration points.\n if (parent.namespaceURI === MATHML_NAMESPACE) {\n return (\n tagName === 'svg' &&\n (parentTagName === 'annotation-xml' ||\n MATHML_TEXT_INTEGRATION_POINTS[parentTagName])\n );\n }\n\n // We only allow elements that are defined in SVG\n // spec. All others are disallowed in SVG namespace.\n return Boolean(ALL_SVG_TAGS[tagName]);\n }\n\n if (element.namespaceURI === MATHML_NAMESPACE) {\n // The only way to switch from HTML namespace to MathML\n // is via . If it happens via any other tag, then\n // it should be killed.\n if (parent.namespaceURI === HTML_NAMESPACE) {\n return tagName === 'math';\n }\n\n // The only way to switch from SVG to MathML is via\n // and HTML integration points\n if (parent.namespaceURI === SVG_NAMESPACE) {\n return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];\n }\n\n // We only allow elements that are defined in MathML\n // spec. All others are disallowed in MathML namespace.\n return Boolean(ALL_MATHML_TAGS[tagName]);\n }\n\n if (element.namespaceURI === HTML_NAMESPACE) {\n // The only way to switch from SVG to HTML is via\n // HTML integration points, and from MathML to HTML\n // is via MathML text integration points\n if (\n parent.namespaceURI === SVG_NAMESPACE &&\n !HTML_INTEGRATION_POINTS[parentTagName]\n ) {\n return false;\n }\n\n if (\n parent.namespaceURI === MATHML_NAMESPACE &&\n !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]\n ) {\n return false;\n }\n\n // We disallow tags that are specific for MathML\n // or SVG and should never appear in HTML namespace\n return (\n !ALL_MATHML_TAGS[tagName] &&\n (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName])\n );\n }\n\n // For XHTML and XML documents that support custom namespaces\n if (\n PARSER_MEDIA_TYPE === 'application/xhtml+xml' &&\n ALLOWED_NAMESPACES[element.namespaceURI]\n ) {\n return true;\n }\n\n // The code should never reach this place (this means\n // that the element somehow got namespace that is not\n // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).\n // Return false just in case.\n return false;\n };\n\n /**\n * _forceRemove\n *\n * @param {Node} node a DOM node\n */\n const _forceRemove = function (node) {\n arrayPush(DOMPurify.removed, { element: node });\n\n try {\n // eslint-disable-next-line unicorn/prefer-dom-node-remove\n getParentNode(node).removeChild(node);\n } catch (_) {\n remove(node);\n }\n };\n\n /**\n * _removeAttribute\n *\n * @param {String} name an Attribute name\n * @param {Node} node a DOM node\n */\n const _removeAttribute = function (name, node) {\n try {\n arrayPush(DOMPurify.removed, {\n attribute: node.getAttributeNode(name),\n from: node,\n });\n } catch (_) {\n arrayPush(DOMPurify.removed, {\n attribute: null,\n from: node,\n });\n }\n\n node.removeAttribute(name);\n\n // We void attribute values for unremovable \"is\"\" attributes\n if (name === 'is' && !ALLOWED_ATTR[name]) {\n if (RETURN_DOM || RETURN_DOM_FRAGMENT) {\n try {\n _forceRemove(node);\n } catch (_) {}\n } else {\n try {\n node.setAttribute(name, '');\n } catch (_) {}\n }\n }\n };\n\n /**\n * _initDocument\n *\n * @param {String} dirty a string of dirty markup\n * @return {Document} a DOM, filled with the dirty markup\n */\n const _initDocument = function (dirty) {\n /* Create a HTML document */\n let doc = null;\n let leadingWhitespace = null;\n\n if (FORCE_BODY) {\n dirty = ' ' + dirty;\n } else {\n /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */\n const matches = stringMatch(dirty, /^[\\r\\n\\t ]+/);\n leadingWhitespace = matches && matches[0];\n }\n\n if (\n PARSER_MEDIA_TYPE === 'application/xhtml+xml' &&\n NAMESPACE === HTML_NAMESPACE\n ) {\n // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)\n dirty =\n '' +\n dirty +\n '';\n }\n\n const dirtyPayload = trustedTypesPolicy\n ? trustedTypesPolicy.createHTML(dirty)\n : dirty;\n /*\n * Use the DOMParser API by default, fallback later if needs be\n * DOMParser not work for svg when has multiple root element.\n */\n if (NAMESPACE === HTML_NAMESPACE) {\n try {\n doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);\n } catch (_) {}\n }\n\n /* Use createHTMLDocument in case DOMParser is not available */\n if (!doc || !doc.documentElement) {\n doc = implementation.createDocument(NAMESPACE, 'template', null);\n try {\n doc.documentElement.innerHTML = IS_EMPTY_INPUT\n ? emptyHTML\n : dirtyPayload;\n } catch (_) {\n // Syntax error if dirtyPayload is invalid xml\n }\n }\n\n const body = doc.body || doc.documentElement;\n\n if (dirty && leadingWhitespace) {\n body.insertBefore(\n document.createTextNode(leadingWhitespace),\n body.childNodes[0] || null\n );\n }\n\n /* Work on whole document or just its body */\n if (NAMESPACE === HTML_NAMESPACE) {\n return getElementsByTagName.call(\n doc,\n WHOLE_DOCUMENT ? 'html' : 'body'\n )[0];\n }\n\n return WHOLE_DOCUMENT ? doc.documentElement : body;\n };\n\n /**\n * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.\n *\n * @param {Node} root The root element or node to start traversing on.\n * @return {NodeIterator} The created NodeIterator\n */\n const _createNodeIterator = function (root) {\n return createNodeIterator.call(\n root.ownerDocument || root,\n root,\n // eslint-disable-next-line no-bitwise\n NodeFilter.SHOW_ELEMENT |\n NodeFilter.SHOW_COMMENT |\n NodeFilter.SHOW_TEXT |\n NodeFilter.SHOW_PROCESSING_INSTRUCTION |\n NodeFilter.SHOW_CDATA_SECTION,\n null\n );\n };\n\n /**\n * _isClobbered\n *\n * @param {Node} elm element to check for clobbering attacks\n * @return {Boolean} true if clobbered, false if safe\n */\n const _isClobbered = function (elm) {\n return (\n elm instanceof HTMLFormElement &&\n (typeof elm.nodeName !== 'string' ||\n typeof elm.textContent !== 'string' ||\n typeof elm.removeChild !== 'function' ||\n !(elm.attributes instanceof NamedNodeMap) ||\n typeof elm.removeAttribute !== 'function' ||\n typeof elm.setAttribute !== 'function' ||\n typeof elm.namespaceURI !== 'string' ||\n typeof elm.insertBefore !== 'function' ||\n typeof elm.hasChildNodes !== 'function')\n );\n };\n\n /**\n * Checks whether the given object is a DOM node.\n *\n * @param {Node} object object to check whether it's a DOM node\n * @return {Boolean} true is object is a DOM node\n */\n const _isNode = function (object) {\n return typeof Node === 'function' && object instanceof Node;\n };\n\n /**\n * _executeHook\n * Execute user configurable hooks\n *\n * @param {String} entryPoint Name of the hook's entry point\n * @param {Node} currentNode node to work on with the hook\n * @param {Object} data additional hook parameters\n */\n const _executeHook = function (entryPoint, currentNode, data) {\n if (!hooks[entryPoint]) {\n return;\n }\n\n arrayForEach(hooks[entryPoint], (hook) => {\n hook.call(DOMPurify, currentNode, data, CONFIG);\n });\n };\n\n /**\n * _sanitizeElements\n *\n * @protect nodeName\n * @protect textContent\n * @protect removeChild\n *\n * @param {Node} currentNode to check for permission to exist\n * @return {Boolean} true if node was killed, false if left alive\n */\n const _sanitizeElements = function (currentNode) {\n let content = null;\n\n /* Execute a hook if present */\n _executeHook('beforeSanitizeElements', currentNode, null);\n\n /* Check if element is clobbered or can clobber */\n if (_isClobbered(currentNode)) {\n _forceRemove(currentNode);\n return true;\n }\n\n /* Now let's check the element's type and name */\n const tagName = transformCaseFunc(currentNode.nodeName);\n\n /* Execute a hook if present */\n _executeHook('uponSanitizeElement', currentNode, {\n tagName,\n allowedTags: ALLOWED_TAGS,\n });\n\n /* Detect mXSS attempts abusing namespace confusion */\n if (\n currentNode.hasChildNodes() &&\n !_isNode(currentNode.firstElementChild) &&\n regExpTest(/<[/\\w]/g, currentNode.innerHTML) &&\n regExpTest(/<[/\\w]/g, currentNode.textContent)\n ) {\n _forceRemove(currentNode);\n return true;\n }\n\n /* Remove any occurrence of processing instructions */\n if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {\n _forceRemove(currentNode);\n return true;\n }\n\n /* Remove any kind of possibly harmful comments */\n if (\n SAFE_FOR_XML &&\n currentNode.nodeType === NODE_TYPE.comment &&\n regExpTest(/<[/\\w]/g, currentNode.data)\n ) {\n _forceRemove(currentNode);\n return true;\n }\n\n /* Remove element if anything forbids its presence */\n if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {\n /* Check if we have a custom element to handle */\n if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {\n if (\n CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp &&\n regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)\n ) {\n return false;\n }\n\n if (\n CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function &&\n CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)\n ) {\n return false;\n }\n }\n\n /* Keep content except for bad-listed elements */\n if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {\n const parentNode = getParentNode(currentNode) || currentNode.parentNode;\n const childNodes = getChildNodes(currentNode) || currentNode.childNodes;\n\n if (childNodes && parentNode) {\n const childCount = childNodes.length;\n\n for (let i = childCount - 1; i >= 0; --i) {\n const childClone = cloneNode(childNodes[i], true);\n childClone.__removalCount = (currentNode.__removalCount || 0) + 1;\n parentNode.insertBefore(childClone, getNextSibling(currentNode));\n }\n }\n }\n\n _forceRemove(currentNode);\n return true;\n }\n\n /* Check whether element has a valid namespace */\n if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {\n _forceRemove(currentNode);\n return true;\n }\n\n /* Make sure that older browsers don't get fallback-tag mXSS */\n if (\n (tagName === 'noscript' ||\n tagName === 'noembed' ||\n tagName === 'noframes') &&\n regExpTest(/<\\/no(script|embed|frames)/i, currentNode.innerHTML)\n ) {\n _forceRemove(currentNode);\n return true;\n }\n\n /* Sanitize element content to be template-safe */\n if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {\n /* Get the element's text content */\n content = currentNode.textContent;\n\n arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], (expr) => {\n content = stringReplace(content, expr, ' ');\n });\n\n if (currentNode.textContent !== content) {\n arrayPush(DOMPurify.removed, { element: currentNode.cloneNode() });\n currentNode.textContent = content;\n }\n }\n\n /* Execute a hook if present */\n _executeHook('afterSanitizeElements', currentNode, null);\n\n return false;\n };\n\n /**\n * _isValidAttribute\n *\n * @param {string} lcTag Lowercase tag name of containing element.\n * @param {string} lcName Lowercase attribute name.\n * @param {string} value Attribute value.\n * @return {Boolean} Returns true if `value` is valid, otherwise false.\n */\n // eslint-disable-next-line complexity\n const _isValidAttribute = function (lcTag, lcName, value) {\n /* Make sure attribute cannot clobber */\n if (\n SANITIZE_DOM &&\n (lcName === 'id' || lcName === 'name') &&\n (value in document || value in formElement)\n ) {\n return false;\n }\n\n /* Allow valid data-* attributes: At least one character after \"-\"\n (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)\n XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)\n We don't need to check the value; it's always URI safe. */\n if (\n ALLOW_DATA_ATTR &&\n !FORBID_ATTR[lcName] &&\n regExpTest(DATA_ATTR, lcName)\n ) {\n // This attribute is safe\n } else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) {\n // This attribute is safe\n /* Otherwise, check the name is permitted */\n } else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {\n if (\n // First condition does a very basic check if a) it's basically a valid custom element tagname AND\n // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck\n // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck\n (_isBasicCustomElement(lcTag) &&\n ((CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp &&\n regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag)) ||\n (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function &&\n CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag))) &&\n ((CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp &&\n regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName)) ||\n (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function &&\n CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)))) ||\n // Alternative, second condition checks if it's an `is`-attribute, AND\n // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck\n (lcName === 'is' &&\n CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements &&\n ((CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp &&\n regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value)) ||\n (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function &&\n CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))))\n ) {\n // If user has supplied a regexp or function in CUSTOM_ELEMENT_HANDLING.tagNameCheck, we need to also allow derived custom elements using the same tagName test.\n // Additionally, we need to allow attributes passing the CUSTOM_ELEMENT_HANDLING.attributeNameCheck user has configured, as custom elements can define these at their own discretion.\n } else {\n return false;\n }\n /* Check value is safe. First, is attr inert? If so, is safe */\n } else if (URI_SAFE_ATTRIBUTES[lcName]) {\n // This attribute is safe\n /* Check no script, data or unknown possibly unsafe URI\n unless we know URI values are safe for that attribute */\n } else if (\n regExpTest(IS_ALLOWED_URI, stringReplace(value, ATTR_WHITESPACE, ''))\n ) {\n // This attribute is safe\n /* Keep image data URIs alive if src/xlink:href is allowed */\n /* Further prevent gadget XSS for dynamically built script tags */\n } else if (\n (lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') &&\n lcTag !== 'script' &&\n stringIndexOf(value, 'data:') === 0 &&\n DATA_URI_TAGS[lcTag]\n ) {\n // This attribute is safe\n /* Allow unknown protocols: This provides support for links that\n are handled by protocol handlers which may be unknown ahead of\n time, e.g. fb:, spotify: */\n } else if (\n ALLOW_UNKNOWN_PROTOCOLS &&\n !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))\n ) {\n // This attribute is safe\n /* Check for binary attributes */\n } else if (value) {\n return false;\n } else {\n // Binary attributes are safe at this point\n /* Anything else, presume unsafe, do not add it back */\n }\n\n return true;\n };\n\n /**\n * _isBasicCustomElement\n * checks if at least one dash is included in tagName, and it's not the first char\n * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name\n *\n * @param {string} tagName name of the tag of the node to sanitize\n * @returns {boolean} Returns true if the tag name meets the basic criteria for a custom element, otherwise false.\n */\n const _isBasicCustomElement = function (tagName) {\n return tagName !== 'annotation-xml' && stringMatch(tagName, CUSTOM_ELEMENT);\n };\n\n /**\n * _sanitizeAttributes\n *\n * @protect attributes\n * @protect nodeName\n * @protect removeAttribute\n * @protect setAttribute\n *\n * @param {Node} currentNode to sanitize\n */\n const _sanitizeAttributes = function (currentNode) {\n /* Execute a hook if present */\n _executeHook('beforeSanitizeAttributes', currentNode, null);\n\n const { attributes } = currentNode;\n\n /* Check if we have attributes; if not we might have a text node */\n if (!attributes) {\n return;\n }\n\n const hookEvent = {\n attrName: '',\n attrValue: '',\n keepAttr: true,\n allowedAttributes: ALLOWED_ATTR,\n };\n let l = attributes.length;\n\n /* Go backwards over all attributes; safely remove bad ones */\n while (l--) {\n const attr = attributes[l];\n const { name, namespaceURI, value: attrValue } = attr;\n const lcName = transformCaseFunc(name);\n\n let value = name === 'value' ? attrValue : stringTrim(attrValue);\n\n /* Execute a hook if present */\n hookEvent.attrName = lcName;\n hookEvent.attrValue = value;\n hookEvent.keepAttr = true;\n hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set\n _executeHook('uponSanitizeAttribute', currentNode, hookEvent);\n value = hookEvent.attrValue;\n\n /* Work around a security issue with comments inside attributes */\n if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\\/(style|title)/i, value)) {\n _removeAttribute(name, currentNode);\n continue;\n }\n\n /* Did the hooks approve of the attribute? */\n if (hookEvent.forceKeepAttr) {\n continue;\n }\n\n /* Remove attribute */\n _removeAttribute(name, currentNode);\n\n /* Did the hooks approve of the attribute? */\n if (!hookEvent.keepAttr) {\n continue;\n }\n\n /* Work around a security issue in jQuery 3.0 */\n if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\\/>/i, value)) {\n _removeAttribute(name, currentNode);\n continue;\n }\n\n /* Sanitize attribute content to be template-safe */\n if (SAFE_FOR_TEMPLATES) {\n arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], (expr) => {\n value = stringReplace(value, expr, ' ');\n });\n }\n\n /* Is `value` valid for this attribute? */\n const lcTag = transformCaseFunc(currentNode.nodeName);\n if (!_isValidAttribute(lcTag, lcName, value)) {\n continue;\n }\n\n /* Full DOM Clobbering protection via namespace isolation,\n * Prefix id and name attributes with `user-content-`\n */\n if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {\n // Remove the attribute with this value\n _removeAttribute(name, currentNode);\n\n // Prefix the value and later re-create the attribute with the sanitized value\n value = SANITIZE_NAMED_PROPS_PREFIX + value;\n }\n\n /* Handle attributes that require Trusted Types */\n if (\n trustedTypesPolicy &&\n typeof trustedTypes === 'object' &&\n typeof trustedTypes.getAttributeType === 'function'\n ) {\n if (namespaceURI) {\n /* Namespaces are not yet supported, see https://bugs.chromium.org/p/chromium/issues/detail?id=1305293 */\n } else {\n switch (trustedTypes.getAttributeType(lcTag, lcName)) {\n case 'TrustedHTML': {\n value = trustedTypesPolicy.createHTML(value);\n break;\n }\n\n case 'TrustedScriptURL': {\n value = trustedTypesPolicy.createScriptURL(value);\n break;\n }\n\n default: {\n break;\n }\n }\n }\n }\n\n /* Handle invalid data-* attribute set by try-catching it */\n try {\n if (namespaceURI) {\n currentNode.setAttributeNS(namespaceURI, name, value);\n } else {\n /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. \"x-schema\". */\n currentNode.setAttribute(name, value);\n }\n\n if (_isClobbered(currentNode)) {\n _forceRemove(currentNode);\n } else {\n arrayPop(DOMPurify.removed);\n }\n } catch (_) {}\n }\n\n /* Execute a hook if present */\n _executeHook('afterSanitizeAttributes', currentNode, null);\n };\n\n /**\n * _sanitizeShadowDOM\n *\n * @param {DocumentFragment} fragment to iterate over recursively\n */\n const _sanitizeShadowDOM = function (fragment) {\n let shadowNode = null;\n const shadowIterator = _createNodeIterator(fragment);\n\n /* Execute a hook if present */\n _executeHook('beforeSanitizeShadowDOM', fragment, null);\n\n while ((shadowNode = shadowIterator.nextNode())) {\n /* Execute a hook if present */\n _executeHook('uponSanitizeShadowNode', shadowNode, null);\n\n /* Sanitize tags and elements */\n if (_sanitizeElements(shadowNode)) {\n continue;\n }\n\n /* Deep shadow DOM detected */\n if (shadowNode.content instanceof DocumentFragment) {\n _sanitizeShadowDOM(shadowNode.content);\n }\n\n /* Check attributes, sanitize if necessary */\n _sanitizeAttributes(shadowNode);\n }\n\n /* Execute a hook if present */\n _executeHook('afterSanitizeShadowDOM', fragment, null);\n };\n\n /**\n * Sanitize\n * Public method providing core sanitation functionality\n *\n * @param {String|Node} dirty string or DOM node\n * @param {Object} cfg object\n */\n // eslint-disable-next-line complexity\n DOMPurify.sanitize = function (dirty, cfg = {}) {\n let body = null;\n let importedNode = null;\n let currentNode = null;\n let returnNode = null;\n /* Make sure we have a string to sanitize.\n DO NOT return early, as this will return the wrong type if\n the user has requested a DOM object rather than a string */\n IS_EMPTY_INPUT = !dirty;\n if (IS_EMPTY_INPUT) {\n dirty = '';\n }\n\n /* Stringify, in case dirty is an object */\n if (typeof dirty !== 'string' && !_isNode(dirty)) {\n if (typeof dirty.toString === 'function') {\n dirty = dirty.toString();\n if (typeof dirty !== 'string') {\n throw typeErrorCreate('dirty is not a string, aborting');\n }\n } else {\n throw typeErrorCreate('toString is not a function');\n }\n }\n\n /* Return dirty HTML if DOMPurify cannot run */\n if (!DOMPurify.isSupported) {\n return dirty;\n }\n\n /* Assign config vars */\n if (!SET_CONFIG) {\n _parseConfig(cfg);\n }\n\n /* Clean up removed elements */\n DOMPurify.removed = [];\n\n /* Check if dirty is correctly typed for IN_PLACE */\n if (typeof dirty === 'string') {\n IN_PLACE = false;\n }\n\n if (IN_PLACE) {\n /* Do some early pre-sanitization to avoid unsafe root nodes */\n if (dirty.nodeName) {\n const tagName = transformCaseFunc(dirty.nodeName);\n if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {\n throw typeErrorCreate(\n 'root node is forbidden and cannot be sanitized in-place'\n );\n }\n }\n } else if (dirty instanceof Node) {\n /* If dirty is a DOM element, append to an empty document to avoid\n elements being stripped by the parser */\n body = _initDocument('');\n importedNode = body.ownerDocument.importNode(dirty, true);\n if (\n importedNode.nodeType === NODE_TYPE.element &&\n importedNode.nodeName === 'BODY'\n ) {\n /* Node is already a body, use as is */\n body = importedNode;\n } else if (importedNode.nodeName === 'HTML') {\n body = importedNode;\n } else {\n // eslint-disable-next-line unicorn/prefer-dom-node-append\n body.appendChild(importedNode);\n }\n } else {\n /* Exit directly if we have nothing to do */\n if (\n !RETURN_DOM &&\n !SAFE_FOR_TEMPLATES &&\n !WHOLE_DOCUMENT &&\n // eslint-disable-next-line unicorn/prefer-includes\n dirty.indexOf('<') === -1\n ) {\n return trustedTypesPolicy && RETURN_TRUSTED_TYPE\n ? trustedTypesPolicy.createHTML(dirty)\n : dirty;\n }\n\n /* Initialize the document to work on */\n body = _initDocument(dirty);\n\n /* Check we have a DOM node from the data */\n if (!body) {\n return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';\n }\n }\n\n /* Remove first element node (ours) if FORCE_BODY is set */\n if (body && FORCE_BODY) {\n _forceRemove(body.firstChild);\n }\n\n /* Get node iterator */\n const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);\n\n /* Now start iterating over the created document */\n while ((currentNode = nodeIterator.nextNode())) {\n /* Sanitize tags and elements */\n if (_sanitizeElements(currentNode)) {\n continue;\n }\n\n /* Shadow DOM detected, sanitize it */\n if (currentNode.content instanceof DocumentFragment) {\n _sanitizeShadowDOM(currentNode.content);\n }\n\n /* Check attributes, sanitize if necessary */\n _sanitizeAttributes(currentNode);\n }\n\n /* If we sanitized `dirty` in-place, return it. */\n if (IN_PLACE) {\n return dirty;\n }\n\n /* Return sanitized string or DOM */\n if (RETURN_DOM) {\n if (RETURN_DOM_FRAGMENT) {\n returnNode = createDocumentFragment.call(body.ownerDocument);\n\n while (body.firstChild) {\n // eslint-disable-next-line unicorn/prefer-dom-node-append\n returnNode.appendChild(body.firstChild);\n }\n } else {\n returnNode = body;\n }\n\n if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {\n /*\n AdoptNode() is not used because internal state is not reset\n (e.g. the past names map of a HTMLFormElement), this is safe\n in theory but we would rather not risk another attack vector.\n The state that is cloned by importNode() is explicitly defined\n by the specs.\n */\n returnNode = importNode.call(originalDocument, returnNode, true);\n }\n\n return returnNode;\n }\n\n let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;\n\n /* Serialize doctype if allowed */\n if (\n WHOLE_DOCUMENT &&\n ALLOWED_TAGS['!doctype'] &&\n body.ownerDocument &&\n body.ownerDocument.doctype &&\n body.ownerDocument.doctype.name &&\n regExpTest(EXPRESSIONS.DOCTYPE_NAME, body.ownerDocument.doctype.name)\n ) {\n serializedHTML =\n '\\n' + serializedHTML;\n }\n\n /* Sanitize final string template-safe */\n if (SAFE_FOR_TEMPLATES) {\n arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], (expr) => {\n serializedHTML = stringReplace(serializedHTML, expr, ' ');\n });\n }\n\n return trustedTypesPolicy && RETURN_TRUSTED_TYPE\n ? trustedTypesPolicy.createHTML(serializedHTML)\n : serializedHTML;\n };\n\n /**\n * Public method to set the configuration once\n * setConfig\n *\n * @param {Object} cfg configuration object\n */\n DOMPurify.setConfig = function (cfg = {}) {\n _parseConfig(cfg);\n SET_CONFIG = true;\n };\n\n /**\n * Public method to remove the configuration\n * clearConfig\n *\n */\n DOMPurify.clearConfig = function () {\n CONFIG = null;\n SET_CONFIG = false;\n };\n\n /**\n * Public method to check if an attribute value is valid.\n * Uses last set config, if any. Otherwise, uses config defaults.\n * isValidAttribute\n *\n * @param {String} tag Tag name of containing element.\n * @param {String} attr Attribute name.\n * @param {String} value Attribute value.\n * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.\n */\n DOMPurify.isValidAttribute = function (tag, attr, value) {\n /* Initialize shared config vars if necessary. */\n if (!CONFIG) {\n _parseConfig({});\n }\n\n const lcTag = transformCaseFunc(tag);\n const lcName = transformCaseFunc(attr);\n return _isValidAttribute(lcTag, lcName, value);\n };\n\n /**\n * AddHook\n * Public method to add DOMPurify hooks\n *\n * @param {String} entryPoint entry point for the hook to add\n * @param {Function} hookFunction function to execute\n */\n DOMPurify.addHook = function (entryPoint, hookFunction) {\n if (typeof hookFunction !== 'function') {\n return;\n }\n\n hooks[entryPoint] = hooks[entryPoint] || [];\n arrayPush(hooks[entryPoint], hookFunction);\n };\n\n /**\n * RemoveHook\n * Public method to remove a DOMPurify hook at a given entryPoint\n * (pops it from the stack of hooks if more are present)\n *\n * @param {String} entryPoint entry point for the hook to remove\n * @return {Function} removed(popped) hook\n */\n DOMPurify.removeHook = function (entryPoint) {\n if (hooks[entryPoint]) {\n return arrayPop(hooks[entryPoint]);\n }\n };\n\n /**\n * RemoveHooks\n * Public method to remove all DOMPurify hooks at a given entryPoint\n *\n * @param {String} entryPoint entry point for the hooks to remove\n */\n DOMPurify.removeHooks = function (entryPoint) {\n if (hooks[entryPoint]) {\n hooks[entryPoint] = [];\n }\n };\n\n /**\n * RemoveAllHooks\n * Public method to remove all DOMPurify hooks\n */\n DOMPurify.removeAllHooks = function () {\n hooks = {};\n };\n\n return DOMPurify;\n}\n\nexport default createDOMPurify();\n", "/**\n * Lexing or parsing positional information for error reporting.\n * This object is immutable.\n */\nclass SourceLocation {\n // The + prefix indicates that these fields aren't writeable\n // Lexer holding the input string.\n // Start offset, zero-based inclusive.\n // End offset, zero-based exclusive.\n constructor(lexer, start, end) {\n this.lexer = void 0;\n this.start = void 0;\n this.end = void 0;\n this.lexer = lexer;\n this.start = start;\n this.end = end;\n }\n /**\n * Merges two `SourceLocation`s from location providers, given they are\n * provided in order of appearance.\n * - Returns the first one's location if only the first is provided.\n * - Returns a merged range of the first and the last if both are provided\n * and their lexers match.\n * - Otherwise, returns null.\n */\n\n\n static range(first, second) {\n if (!second) {\n return first && first.loc;\n } else if (!first || !first.loc || !second.loc || first.loc.lexer !== second.loc.lexer) {\n return null;\n } else {\n return new SourceLocation(first.loc.lexer, first.loc.start, second.loc.end);\n }\n }\n\n}\n\n/**\n * Interface required to break circular dependency between Token, Lexer, and\n * ParseError.\n */\n\n/**\n * The resulting token returned from `lex`.\n *\n * It consists of the token text plus some position information.\n * The position information is essentially a range in an input string,\n * but instead of referencing the bare input string, we refer to the lexer.\n * That way it is possible to attach extra metadata to the input string,\n * like for example a file name or similar.\n *\n * The position information is optional, so it is OK to construct synthetic\n * tokens if appropriate. Not providing available position information may\n * lead to degraded error reporting, though.\n */\nclass Token {\n // don't expand the token\n // used in \\noexpand\n constructor(text, // the text of this token\n loc) {\n this.text = void 0;\n this.loc = void 0;\n this.noexpand = void 0;\n this.treatAsRelax = void 0;\n this.text = text;\n this.loc = loc;\n }\n /**\n * Given a pair of tokens (this and endToken), compute a `Token` encompassing\n * the whole input range enclosed by these two.\n */\n\n\n range(endToken, // last token of the range, inclusive\n text // the text of the newly constructed token\n ) {\n return new Token(text, SourceLocation.range(this, endToken));\n }\n\n}\n\n/**\n * This is the ParseError class, which is the main error thrown by KaTeX\n * functions when something has gone wrong. This is used to distinguish internal\n * errors from errors in the expression that the user provided.\n *\n * If possible, a caller should provide a Token or ParseNode with information\n * about where in the source string the problem occurred.\n */\nclass ParseError {\n // Error start position based on passed-in Token or ParseNode.\n // Length of affected text based on passed-in Token or ParseNode.\n // The underlying error message without any context added.\n constructor(message, // The error message\n token // An object providing position information\n ) {\n this.name = void 0;\n this.position = void 0;\n this.length = void 0;\n this.rawMessage = void 0;\n var error = \"KaTeX parse error: \" + message;\n var start;\n var end;\n var loc = token && token.loc;\n\n if (loc && loc.start <= loc.end) {\n // If we have the input and a position, make the error a bit fancier\n // Get the input\n var input = loc.lexer.input; // Prepend some information\n\n start = loc.start;\n end = loc.end;\n\n if (start === input.length) {\n error += \" at end of input: \";\n } else {\n error += \" at position \" + (start + 1) + \": \";\n } // Underline token in question using combining underscores\n\n\n var underlined = input.slice(start, end).replace(/[^]/g, \"$&\\u0332\"); // Extract some context from the input and add it to the error\n\n var left;\n\n if (start > 15) {\n left = \"\u2026\" + input.slice(start - 15, start);\n } else {\n left = input.slice(0, start);\n }\n\n var right;\n\n if (end + 15 < input.length) {\n right = input.slice(end, end + 15) + \"\u2026\";\n } else {\n right = input.slice(end);\n }\n\n error += left + underlined + right;\n } // Some hackery to make ParseError a prototype of Error\n // See http://stackoverflow.com/a/8460753\n // $FlowFixMe\n\n\n var self = new Error(error);\n self.name = \"ParseError\"; // $FlowFixMe\n\n self.__proto__ = ParseError.prototype;\n self.position = start;\n\n if (start != null && end != null) {\n self.length = end - start;\n }\n\n self.rawMessage = message;\n return self;\n }\n\n} // $FlowFixMe More hackery\n\n\nParseError.prototype.__proto__ = Error.prototype;\n\n/**\n * This file contains a list of utility functions which are useful in other\n * files.\n */\n\n/**\n * Return whether an element is contained in a list\n */\nvar contains = function contains(list, elem) {\n return list.indexOf(elem) !== -1;\n};\n/**\n * Provide a default value if a setting is undefined\n * NOTE: Couldn't use `T` as the output type due to facebook/flow#5022.\n */\n\n\nvar deflt = function deflt(setting, defaultIfUndefined) {\n return setting === undefined ? defaultIfUndefined : setting;\n}; // hyphenate and escape adapted from Facebook's React under Apache 2 license\n\n\nvar uppercase = /([A-Z])/g;\n\nvar hyphenate = function hyphenate(str) {\n return str.replace(uppercase, \"-$1\").toLowerCase();\n};\n\nvar ESCAPE_LOOKUP = {\n \"&\": \"&\",\n \">\": \">\",\n \"<\": \"<\",\n \"\\\"\": \""\",\n \"'\": \"'\"\n};\nvar ESCAPE_REGEX = /[&><\"']/g;\n/**\n * Escapes text to prevent scripting attacks.\n */\n\nfunction escape(text) {\n return String(text).replace(ESCAPE_REGEX, match => ESCAPE_LOOKUP[match]);\n}\n/**\n * Sometimes we want to pull out the innermost element of a group. In most\n * cases, this will just be the group itself, but when ordgroups and colors have\n * a single element, we want to pull that out.\n */\n\n\nvar getBaseElem = function getBaseElem(group) {\n if (group.type === \"ordgroup\") {\n if (group.body.length === 1) {\n return getBaseElem(group.body[0]);\n } else {\n return group;\n }\n } else if (group.type === \"color\") {\n if (group.body.length === 1) {\n return getBaseElem(group.body[0]);\n } else {\n return group;\n }\n } else if (group.type === \"font\") {\n return getBaseElem(group.body);\n } else {\n return group;\n }\n};\n/**\n * TeXbook algorithms often reference \"character boxes\", which are simply groups\n * with a single character in them. To decide if something is a character box,\n * we find its innermost group, and see if it is a single character.\n */\n\n\nvar isCharacterBox = function isCharacterBox(group) {\n var baseElem = getBaseElem(group); // These are all they types of groups which hold single characters\n\n return baseElem.type === \"mathord\" || baseElem.type === \"textord\" || baseElem.type === \"atom\";\n};\n\nvar assert = function assert(value) {\n if (!value) {\n throw new Error('Expected non-null, but got ' + String(value));\n }\n\n return value;\n};\n/**\n * Return the protocol of a URL, or \"_relative\" if the URL does not specify a\n * protocol (and thus is relative), or `null` if URL has invalid protocol\n * (so should be outright rejected).\n */\n\nvar protocolFromUrl = function protocolFromUrl(url) {\n // Check for possible leading protocol.\n // https://url.spec.whatwg.org/#url-parsing strips leading whitespace\n // (U+20) or C0 control (U+00-U+1F) characters.\n // eslint-disable-next-line no-control-regex\n var protocol = /^[\\x00-\\x20]*([^\\\\/#?]*?)(:|*58|*3a|&colon)/i.exec(url);\n\n if (!protocol) {\n return \"_relative\";\n } // Reject weird colons\n\n\n if (protocol[2] !== \":\") {\n return null;\n } // Reject invalid characters in scheme according to\n // https://datatracker.ietf.org/doc/html/rfc3986#section-3.1\n\n\n if (!/^[a-zA-Z][a-zA-Z0-9+\\-.]*$/.test(protocol[1])) {\n return null;\n } // Lowercase the protocol\n\n\n return protocol[1].toLowerCase();\n};\nvar utils = {\n contains,\n deflt,\n escape,\n hyphenate,\n getBaseElem,\n isCharacterBox,\n protocolFromUrl\n};\n\n/* eslint no-console:0 */\n// TODO: automatically generate documentation\n// TODO: check all properties on Settings exist\n// TODO: check the type of a property on Settings matches\nvar SETTINGS_SCHEMA = {\n displayMode: {\n type: \"boolean\",\n description: \"Render math in display mode, which puts the math in \" + \"display style (so \\\\int and \\\\sum are large, for example), and \" + \"centers the math on the page on its own line.\",\n cli: \"-d, --display-mode\"\n },\n output: {\n type: {\n enum: [\"htmlAndMathml\", \"html\", \"mathml\"]\n },\n description: \"Determines the markup language of the output.\",\n cli: \"-F, --format \"\n },\n leqno: {\n type: \"boolean\",\n description: \"Render display math in leqno style (left-justified tags).\"\n },\n fleqn: {\n type: \"boolean\",\n description: \"Render display math flush left.\"\n },\n throwOnError: {\n type: \"boolean\",\n default: true,\n cli: \"-t, --no-throw-on-error\",\n cliDescription: \"Render errors (in the color given by --error-color) ins\" + \"tead of throwing a ParseError exception when encountering an error.\"\n },\n errorColor: {\n type: \"string\",\n default: \"#cc0000\",\n cli: \"-c, --error-color \",\n cliDescription: \"A color string given in the format 'rgb' or 'rrggbb' \" + \"(no #). This option determines the color of errors rendered by the \" + \"-t option.\",\n cliProcessor: color => \"#\" + color\n },\n macros: {\n type: \"object\",\n cli: \"-m, --macro \",\n cliDescription: \"Define custom macro of the form '\\\\foo:expansion' (use \" + \"multiple -m arguments for multiple macros).\",\n cliDefault: [],\n cliProcessor: (def, defs) => {\n defs.push(def);\n return defs;\n }\n },\n minRuleThickness: {\n type: \"number\",\n description: \"Specifies a minimum thickness, in ems, for fraction lines,\" + \" `\\\\sqrt` top lines, `{array}` vertical lines, `\\\\hline`, \" + \"`\\\\hdashline`, `\\\\underline`, `\\\\overline`, and the borders of \" + \"`\\\\fbox`, `\\\\boxed`, and `\\\\fcolorbox`.\",\n processor: t => Math.max(0, t),\n cli: \"--min-rule-thickness \",\n cliProcessor: parseFloat\n },\n colorIsTextColor: {\n type: \"boolean\",\n description: \"Makes \\\\color behave like LaTeX's 2-argument \\\\textcolor, \" + \"instead of LaTeX's one-argument \\\\color mode change.\",\n cli: \"-b, --color-is-text-color\"\n },\n strict: {\n type: [{\n enum: [\"warn\", \"ignore\", \"error\"]\n }, \"boolean\", \"function\"],\n description: \"Turn on strict / LaTeX faithfulness mode, which throws an \" + \"error if the input uses features that are not supported by LaTeX.\",\n cli: \"-S, --strict\",\n cliDefault: false\n },\n trust: {\n type: [\"boolean\", \"function\"],\n description: \"Trust the input, enabling all HTML features such as \\\\url.\",\n cli: \"-T, --trust\"\n },\n maxSize: {\n type: \"number\",\n default: Infinity,\n description: \"If non-zero, all user-specified sizes, e.g. in \" + \"\\\\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, \" + \"elements and spaces can be arbitrarily large\",\n processor: s => Math.max(0, s),\n cli: \"-s, --max-size \",\n cliProcessor: parseInt\n },\n maxExpand: {\n type: \"number\",\n default: 1000,\n description: \"Limit the number of macro expansions to the specified \" + \"number, to prevent e.g. infinite macro loops. If set to Infinity, \" + \"the macro expander will try to fully expand as in LaTeX.\",\n processor: n => Math.max(0, n),\n cli: \"-e, --max-expand \",\n cliProcessor: n => n === \"Infinity\" ? Infinity : parseInt(n)\n },\n globalGroup: {\n type: \"boolean\",\n cli: false\n }\n};\n\nfunction getDefaultValue(schema) {\n if (schema.default) {\n return schema.default;\n }\n\n var type = schema.type;\n var defaultType = Array.isArray(type) ? type[0] : type;\n\n if (typeof defaultType !== 'string') {\n return defaultType.enum[0];\n }\n\n switch (defaultType) {\n case 'boolean':\n return false;\n\n case 'string':\n return '';\n\n case 'number':\n return 0;\n\n case 'object':\n return {};\n }\n}\n/**\n * The main Settings object\n *\n * The current options stored are:\n * - displayMode: Whether the expression should be typeset as inline math\n * (false, the default), meaning that the math starts in\n * \\textstyle and is placed in an inline-block); or as display\n * math (true), meaning that the math starts in \\displaystyle\n * and is placed in a block with vertical margin.\n */\n\n\nclass Settings {\n constructor(options) {\n this.displayMode = void 0;\n this.output = void 0;\n this.leqno = void 0;\n this.fleqn = void 0;\n this.throwOnError = void 0;\n this.errorColor = void 0;\n this.macros = void 0;\n this.minRuleThickness = void 0;\n this.colorIsTextColor = void 0;\n this.strict = void 0;\n this.trust = void 0;\n this.maxSize = void 0;\n this.maxExpand = void 0;\n this.globalGroup = void 0;\n // allow null options\n options = options || {};\n\n for (var prop in SETTINGS_SCHEMA) {\n if (SETTINGS_SCHEMA.hasOwnProperty(prop)) {\n // $FlowFixMe\n var schema = SETTINGS_SCHEMA[prop]; // TODO: validate options\n // $FlowFixMe\n\n this[prop] = options[prop] !== undefined ? schema.processor ? schema.processor(options[prop]) : options[prop] : getDefaultValue(schema);\n }\n }\n }\n /**\n * Report nonstrict (non-LaTeX-compatible) input.\n * Can safely not be called if `this.strict` is false in JavaScript.\n */\n\n\n reportNonstrict(errorCode, errorMsg, token) {\n var strict = this.strict;\n\n if (typeof strict === \"function\") {\n // Allow return value of strict function to be boolean or string\n // (or null/undefined, meaning no further processing).\n strict = strict(errorCode, errorMsg, token);\n }\n\n if (!strict || strict === \"ignore\") {\n return;\n } else if (strict === true || strict === \"error\") {\n throw new ParseError(\"LaTeX-incompatible input and strict mode is set to 'error': \" + (errorMsg + \" [\" + errorCode + \"]\"), token);\n } else if (strict === \"warn\") {\n typeof console !== \"undefined\" && console.warn(\"LaTeX-incompatible input and strict mode is set to 'warn': \" + (errorMsg + \" [\" + errorCode + \"]\"));\n } else {\n // won't happen in type-safe code\n typeof console !== \"undefined\" && console.warn(\"LaTeX-incompatible input and strict mode is set to \" + (\"unrecognized '\" + strict + \"': \" + errorMsg + \" [\" + errorCode + \"]\"));\n }\n }\n /**\n * Check whether to apply strict (LaTeX-adhering) behavior for unusual\n * input (like `\\\\`). Unlike `nonstrict`, will not throw an error;\n * instead, \"error\" translates to a return value of `true`, while \"ignore\"\n * translates to a return value of `false`. May still print a warning:\n * \"warn\" prints a warning and returns `false`.\n * This is for the second category of `errorCode`s listed in the README.\n */\n\n\n useStrictBehavior(errorCode, errorMsg, token) {\n var strict = this.strict;\n\n if (typeof strict === \"function\") {\n // Allow return value of strict function to be boolean or string\n // (or null/undefined, meaning no further processing).\n // But catch any exceptions thrown by function, treating them\n // like \"error\".\n try {\n strict = strict(errorCode, errorMsg, token);\n } catch (error) {\n strict = \"error\";\n }\n }\n\n if (!strict || strict === \"ignore\") {\n return false;\n } else if (strict === true || strict === \"error\") {\n return true;\n } else if (strict === \"warn\") {\n typeof console !== \"undefined\" && console.warn(\"LaTeX-incompatible input and strict mode is set to 'warn': \" + (errorMsg + \" [\" + errorCode + \"]\"));\n return false;\n } else {\n // won't happen in type-safe code\n typeof console !== \"undefined\" && console.warn(\"LaTeX-incompatible input and strict mode is set to \" + (\"unrecognized '\" + strict + \"': \" + errorMsg + \" [\" + errorCode + \"]\"));\n return false;\n }\n }\n /**\n * Check whether to test potentially dangerous input, and return\n * `true` (trusted) or `false` (untrusted). The sole argument `context`\n * should be an object with `command` field specifying the relevant LaTeX\n * command (as a string starting with `\\`), and any other arguments, etc.\n * If `context` has a `url` field, a `protocol` field will automatically\n * get added by this function (changing the specified object).\n */\n\n\n isTrusted(context) {\n if (context.url && !context.protocol) {\n var protocol = utils.protocolFromUrl(context.url);\n\n if (protocol == null) {\n return false;\n }\n\n context.protocol = protocol;\n }\n\n var trust = typeof this.trust === \"function\" ? this.trust(context) : this.trust;\n return Boolean(trust);\n }\n\n}\n\n/**\n * This file contains information and classes for the various kinds of styles\n * used in TeX. It provides a generic `Style` class, which holds information\n * about a specific style. It then provides instances of all the different kinds\n * of styles possible, and provides functions to move between them and get\n * information about them.\n */\n\n/**\n * The main style class. Contains a unique id for the style, a size (which is\n * the same for cramped and uncramped version of a style), and a cramped flag.\n */\nclass Style {\n constructor(id, size, cramped) {\n this.id = void 0;\n this.size = void 0;\n this.cramped = void 0;\n this.id = id;\n this.size = size;\n this.cramped = cramped;\n }\n /**\n * Get the style of a superscript given a base in the current style.\n */\n\n\n sup() {\n return styles[sup[this.id]];\n }\n /**\n * Get the style of a subscript given a base in the current style.\n */\n\n\n sub() {\n return styles[sub[this.id]];\n }\n /**\n * Get the style of a fraction numerator given the fraction in the current\n * style.\n */\n\n\n fracNum() {\n return styles[fracNum[this.id]];\n }\n /**\n * Get the style of a fraction denominator given the fraction in the current\n * style.\n */\n\n\n fracDen() {\n return styles[fracDen[this.id]];\n }\n /**\n * Get the cramped version of a style (in particular, cramping a cramped style\n * doesn't change the style).\n */\n\n\n cramp() {\n return styles[cramp[this.id]];\n }\n /**\n * Get a text or display version of this style.\n */\n\n\n text() {\n return styles[text$1[this.id]];\n }\n /**\n * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle)\n */\n\n\n isTight() {\n return this.size >= 2;\n }\n\n} // Export an interface for type checking, but don't expose the implementation.\n// This way, no more styles can be generated.\n\n\n// IDs of the different styles\nvar D = 0;\nvar Dc = 1;\nvar T = 2;\nvar Tc = 3;\nvar S = 4;\nvar Sc = 5;\nvar SS = 6;\nvar SSc = 7; // Instances of the different styles\n\nvar styles = [new Style(D, 0, false), new Style(Dc, 0, true), new Style(T, 1, false), new Style(Tc, 1, true), new Style(S, 2, false), new Style(Sc, 2, true), new Style(SS, 3, false), new Style(SSc, 3, true)]; // Lookup tables for switching from one style to another\n\nvar sup = [S, Sc, S, Sc, SS, SSc, SS, SSc];\nvar sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc];\nvar fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc];\nvar fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc];\nvar cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc];\nvar text$1 = [D, Dc, T, Tc, T, Tc, T, Tc]; // We only export some of the styles.\n\nvar Style$1 = {\n DISPLAY: styles[D],\n TEXT: styles[T],\n SCRIPT: styles[S],\n SCRIPTSCRIPT: styles[SS]\n};\n\n/*\n * This file defines the Unicode scripts and script families that we\n * support. To add new scripts or families, just add a new entry to the\n * scriptData array below. Adding scripts to the scriptData array allows\n * characters from that script to appear in \\text{} environments.\n */\n\n/**\n * Each script or script family has a name and an array of blocks.\n * Each block is an array of two numbers which specify the start and\n * end points (inclusive) of a block of Unicode codepoints.\n */\n\n/**\n * Unicode block data for the families of scripts we support in \\text{}.\n * Scripts only need to appear here if they do not have font metrics.\n */\nvar scriptData = [{\n // Latin characters beyond the Latin-1 characters we have metrics for.\n // Needed for Czech, Hungarian and Turkish text, for example.\n name: 'latin',\n blocks: [[0x0100, 0x024f], // Latin Extended-A and Latin Extended-B\n [0x0300, 0x036f] // Combining Diacritical marks\n ]\n}, {\n // The Cyrillic script used by Russian and related languages.\n // A Cyrillic subset used to be supported as explicitly defined\n // symbols in symbols.js\n name: 'cyrillic',\n blocks: [[0x0400, 0x04ff]]\n}, {\n // Armenian\n name: 'armenian',\n blocks: [[0x0530, 0x058F]]\n}, {\n // The Brahmic scripts of South and Southeast Asia\n // Devanagari (0900\u2013097F)\n // Bengali (0980\u201309FF)\n // Gurmukhi (0A00\u20130A7F)\n // Gujarati (0A80\u20130AFF)\n // Oriya (0B00\u20130B7F)\n // Tamil (0B80\u20130BFF)\n // Telugu (0C00\u20130C7F)\n // Kannada (0C80\u20130CFF)\n // Malayalam (0D00\u20130D7F)\n // Sinhala (0D80\u20130DFF)\n // Thai (0E00\u20130E7F)\n // Lao (0E80\u20130EFF)\n // Tibetan (0F00\u20130FFF)\n // Myanmar (1000\u2013109F)\n name: 'brahmic',\n blocks: [[0x0900, 0x109F]]\n}, {\n name: 'georgian',\n blocks: [[0x10A0, 0x10ff]]\n}, {\n // Chinese and Japanese.\n // The \"k\" in cjk is for Korean, but we've separated Korean out\n name: \"cjk\",\n blocks: [[0x3000, 0x30FF], // CJK symbols and punctuation, Hiragana, Katakana\n [0x4E00, 0x9FAF], // CJK ideograms\n [0xFF00, 0xFF60] // Fullwidth punctuation\n // TODO: add halfwidth Katakana and Romanji glyphs\n ]\n}, {\n // Korean\n name: 'hangul',\n blocks: [[0xAC00, 0xD7AF]]\n}];\n/**\n * Given a codepoint, return the name of the script or script family\n * it is from, or null if it is not part of a known block\n */\n\nfunction scriptFromCodepoint(codepoint) {\n for (var i = 0; i < scriptData.length; i++) {\n var script = scriptData[i];\n\n for (var _i = 0; _i < script.blocks.length; _i++) {\n var block = script.blocks[_i];\n\n if (codepoint >= block[0] && codepoint <= block[1]) {\n return script.name;\n }\n }\n }\n\n return null;\n}\n/**\n * A flattened version of all the supported blocks in a single array.\n * This is an optimization to make supportedCodepoint() fast.\n */\n\nvar allBlocks = [];\nscriptData.forEach(s => s.blocks.forEach(b => allBlocks.push(...b)));\n/**\n * Given a codepoint, return true if it falls within one of the\n * scripts or script families defined above and false otherwise.\n *\n * Micro benchmarks shows that this is faster than\n * /[\\u3000-\\u30FF\\u4E00-\\u9FAF\\uFF00-\\uFF60\\uAC00-\\uD7AF\\u0900-\\u109F]/.test()\n * in Firefox, Chrome and Node.\n */\n\nfunction supportedCodepoint(codepoint) {\n for (var i = 0; i < allBlocks.length; i += 2) {\n if (codepoint >= allBlocks[i] && codepoint <= allBlocks[i + 1]) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * This file provides support to domTree.js and delimiter.js.\n * It's a storehouse of path geometry for SVG images.\n */\n// In all paths below, the viewBox-to-em scale is 1000:1.\nvar hLinePad = 80; // padding above a sqrt vinculum. Prevents image cropping.\n// The vinculum of a \\sqrt can be made thicker by a KaTeX rendering option.\n// Think of variable extraVinculum as two detours in the SVG path.\n// The detour begins at the lower left of the area labeled extraVinculum below.\n// The detour proceeds one extraVinculum distance up and slightly to the right,\n// displacing the radiused corner between surd and vinculum. The radius is\n// traversed as usual, then the detour resumes. It goes right, to the end of\n// the very long vinculum, then down one extraVinculum distance,\n// after which it resumes regular path geometry for the radical.\n\n/* vinculum\n /\n /\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2190extraVinculum\n / \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u21900.04em (40 unit) std vinculum thickness\n / /\n / /\n / /\\\n / / surd\n*/\n\nvar sqrtMain = function sqrtMain(extraVinculum, hLinePad) {\n // sqrtMain path geometry is from glyph U221A in the font KaTeX Main\n return \"M95,\" + (622 + extraVinculum + hLinePad) + \"\\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\\nc69,-144,104.5,-217.7,106.5,-221\\nl\" + extraVinculum / 2.075 + \" -\" + extraVinculum + \"\\nc5.3,-9.3,12,-14,20,-14\\nH400000v\" + (40 + extraVinculum) + \"H845.2724\\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\\nM\" + (834 + extraVinculum) + \" \" + hLinePad + \"h400000v\" + (40 + extraVinculum) + \"h-400000z\";\n};\n\nvar sqrtSize1 = function sqrtSize1(extraVinculum, hLinePad) {\n // size1 is from glyph U221A in the font KaTeX_Size1-Regular\n return \"M263,\" + (601 + extraVinculum + hLinePad) + \"c0.7,0,18,39.7,52,119\\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\\nc340,-704.7,510.7,-1060.3,512,-1067\\nl\" + extraVinculum / 2.084 + \" -\" + extraVinculum + \"\\nc4.7,-7.3,11,-11,19,-11\\nH40000v\" + (40 + extraVinculum) + \"H1012.3\\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\\nM\" + (1001 + extraVinculum) + \" \" + hLinePad + \"h400000v\" + (40 + extraVinculum) + \"h-400000z\";\n};\n\nvar sqrtSize2 = function sqrtSize2(extraVinculum, hLinePad) {\n // size2 is from glyph U221A in the font KaTeX_Size2-Regular\n return \"M983 \" + (10 + extraVinculum + hLinePad) + \"\\nl\" + extraVinculum / 3.13 + \" -\" + extraVinculum + \"\\nc4,-6.7,10,-10,18,-10 H400000v\" + (40 + extraVinculum) + \"\\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\\nM\" + (1001 + extraVinculum) + \" \" + hLinePad + \"h400000v\" + (40 + extraVinculum) + \"h-400000z\";\n};\n\nvar sqrtSize3 = function sqrtSize3(extraVinculum, hLinePad) {\n // size3 is from glyph U221A in the font KaTeX_Size3-Regular\n return \"M424,\" + (2398 + extraVinculum + hLinePad) + \"\\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\\nl\" + extraVinculum / 4.223 + \" -\" + extraVinculum + \"c4,-6.7,10,-10,18,-10 H400000\\nv\" + (40 + extraVinculum) + \"H1014.6\\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\\nc-2,6,-10,9,-24,9\\nc-8,0,-12,-0.7,-12,-2z M\" + (1001 + extraVinculum) + \" \" + hLinePad + \"\\nh400000v\" + (40 + extraVinculum) + \"h-400000z\";\n};\n\nvar sqrtSize4 = function sqrtSize4(extraVinculum, hLinePad) {\n // size4 is from glyph U221A in the font KaTeX_Size4-Regular\n return \"M473,\" + (2713 + extraVinculum + hLinePad) + \"\\nc339.3,-1799.3,509.3,-2700,510,-2702 l\" + extraVinculum / 5.298 + \" -\" + extraVinculum + \"\\nc3.3,-7.3,9.3,-11,18,-11 H400000v\" + (40 + extraVinculum) + \"H1017.7\\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\\n606zM\" + (1001 + extraVinculum) + \" \" + hLinePad + \"h400000v\" + (40 + extraVinculum) + \"H1017.7z\";\n};\n\nvar phasePath = function phasePath(y) {\n var x = y / 2; // x coordinate at top of angle\n\n return \"M400000 \" + y + \" H0 L\" + x + \" 0 l65 45 L145 \" + (y - 80) + \" H400000z\";\n};\n\nvar sqrtTall = function sqrtTall(extraVinculum, hLinePad, viewBoxHeight) {\n // sqrtTall is from glyph U23B7 in the font KaTeX_Size4-Regular\n // One path edge has a variable length. It runs vertically from the vinculum\n // to a point near (14 units) the bottom of the surd. The vinculum\n // is normally 40 units thick. So the length of the line in question is:\n var vertSegment = viewBoxHeight - 54 - hLinePad - extraVinculum;\n return \"M702 \" + (extraVinculum + hLinePad) + \"H400000\" + (40 + extraVinculum) + \"\\nH742v\" + vertSegment + \"l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1\\nh-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170\\nc-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667\\n219 661 l218 661zM702 \" + hLinePad + \"H400000v\" + (40 + extraVinculum) + \"H742z\";\n};\n\nvar sqrtPath = function sqrtPath(size, extraVinculum, viewBoxHeight) {\n extraVinculum = 1000 * extraVinculum; // Convert from document ems to viewBox.\n\n var path = \"\";\n\n switch (size) {\n case \"sqrtMain\":\n path = sqrtMain(extraVinculum, hLinePad);\n break;\n\n case \"sqrtSize1\":\n path = sqrtSize1(extraVinculum, hLinePad);\n break;\n\n case \"sqrtSize2\":\n path = sqrtSize2(extraVinculum, hLinePad);\n break;\n\n case \"sqrtSize3\":\n path = sqrtSize3(extraVinculum, hLinePad);\n break;\n\n case \"sqrtSize4\":\n path = sqrtSize4(extraVinculum, hLinePad);\n break;\n\n case \"sqrtTall\":\n path = sqrtTall(extraVinculum, hLinePad, viewBoxHeight);\n }\n\n return path;\n};\nvar innerPath = function innerPath(name, height) {\n // The inner part of stretchy tall delimiters\n switch (name) {\n case \"\\u239c\":\n return \"M291 0 H417 V\" + height + \" H291z M291 0 H417 V\" + height + \" H291z\";\n\n case \"\\u2223\":\n return \"M145 0 H188 V\" + height + \" H145z M145 0 H188 V\" + height + \" H145z\";\n\n case \"\\u2225\":\n return \"M145 0 H188 V\" + height + \" H145z M145 0 H188 V\" + height + \" H145z\" + (\"M367 0 H410 V\" + height + \" H367z M367 0 H410 V\" + height + \" H367z\");\n\n case \"\\u239f\":\n return \"M457 0 H583 V\" + height + \" H457z M457 0 H583 V\" + height + \" H457z\";\n\n case \"\\u23a2\":\n return \"M319 0 H403 V\" + height + \" H319z M319 0 H403 V\" + height + \" H319z\";\n\n case \"\\u23a5\":\n return \"M263 0 H347 V\" + height + \" H263z M263 0 H347 V\" + height + \" H263z\";\n\n case \"\\u23aa\":\n return \"M384 0 H504 V\" + height + \" H384z M384 0 H504 V\" + height + \" H384z\";\n\n case \"\\u23d0\":\n return \"M312 0 H355 V\" + height + \" H312z M312 0 H355 V\" + height + \" H312z\";\n\n case \"\\u2016\":\n return \"M257 0 H300 V\" + height + \" H257z M257 0 H300 V\" + height + \" H257z\" + (\"M478 0 H521 V\" + height + \" H478z M478 0 H521 V\" + height + \" H478z\");\n\n default:\n return \"\";\n }\n};\nvar path = {\n // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main\n doubleleftarrow: \"M262 157\\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\\nm8 0v40h399730v-40zm0 194v40h399730v-40z\",\n // doublerightarrow is from glyph U+21D2 in font KaTeX Main\n doublerightarrow: \"M399738 392l\\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z\",\n // leftarrow is from glyph U+2190 in font KaTeX Main\n leftarrow: \"M400000 241H110l3-3c68.7-52.7 113.7-120\\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\\n l-3-3h399890zM100 241v40h399900v-40z\",\n // overbrace is from glyphs U+23A9/23A8/23A7 in font KaTeX_Size4-Regular\n leftbrace: \"M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z\",\n leftbraceunder: \"M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z\",\n // overgroup is from the MnSymbol package (public domain)\n leftgroup: \"M400000 80\\nH435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0\\n 435 0h399565z\",\n leftgroupunder: \"M400000 262\\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\\n 435 219h399565z\",\n // Harpoons are from glyph U+21BD in font KaTeX Main\n leftharpoon: \"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\\n-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5\\n-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7\\n-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z\",\n leftharpoonplus: \"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5\\n 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3\\n-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7\\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\\nm0 0v40h400000v-40z\",\n leftharpoondown: \"M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\\n 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667\\n-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z\",\n leftharpoondownplus: \"M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12\\n 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7\\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z\",\n // hook is from glyph U+21A9 in font KaTeX Main\n lefthook: \"M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\\n-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3\\n-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21\\n 71.5 23h399859zM103 281v-40h399897v40z\",\n leftlinesegment: \"M40 281 V428 H0 V94 H40 V241 H400000 v40z\\nM40 281 V428 H0 V94 H40 V241 H400000 v40z\",\n leftmapsto: \"M40 281 V448H0V74H40V241H400000v40z\\nM40 281 V448H0V74H40V241H400000v40z\",\n // tofrom is from glyph U+21C4 in font KaTeX AMS Regular\n leftToFrom: \"M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\\nc28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3\\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z\",\n longequal: \"M0 50 h400000 v40H0z m0 194h40000v40H0z\\nM0 50 h400000 v40H0z m0 194h40000v40H0z\",\n midbrace: \"M200428 334\\nc-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14\\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\\n 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11\\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z\",\n midbraceunder: \"M199572 214\\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z\",\n oiintSize1: \"M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z\",\n oiintSize2: \"M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\\nc0 110 84 276 504 276s502.4-166 502.4-276z\",\n oiiintSize1: \"M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z\",\n oiiintSize2: \"M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z\",\n rightarrow: \"M0 241v40h399891c-47.3 35.3-84 78-110 128\\n-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20\\n 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7\\n 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85\\n-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\\n 151.7 139 205zm0 0v40h399900v-40z\",\n rightbrace: \"M400000 542l\\n-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5\\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\\nc124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z\",\n rightbraceunder: \"M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z\",\n rightgroup: \"M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0\\n 3-1 3-3v-38c-76-158-257-219-435-219H0z\",\n rightgroupunder: \"M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18\\n 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z\",\n rightharpoon: \"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3\\n-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2\\n-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58\\n 69.2 92 94.5zm0 0v40h399900v-40z\",\n rightharpoonplus: \"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11\\n-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7\\n 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z\\nm0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z\",\n rightharpoondown: \"M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8\\n 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5\\n-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95\\n-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z\",\n rightharpoondownplus: \"M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8\\n 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3\\n 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3\\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\\nm0-194v40h400000v-40zm0 0v40h400000v-40z\",\n righthook: \"M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3\\n 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0\\n-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21\\n 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z\",\n rightlinesegment: \"M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z\",\n rightToFrom: \"M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23\\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\\n-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142\\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z\",\n // twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular\n twoheadleftarrow: \"M0 167c68 40\\n 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69\\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\\n 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z\",\n twoheadrightarrow: \"M400000 167\\nc-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3\\n 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42\\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z\",\n // tilde1 is a modified version of a glyph from the MnSymbol package\n tilde1: \"M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\\n-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0\\n 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0\\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\\n-68.267.847-113-73.952-191-73.952z\",\n // ditto tilde2, tilde3, & tilde4\n tilde2: \"M344 55.266c-142 0-300.638 81.316-311.5 86.418\\n-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9\\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\\nc1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751\\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z\",\n tilde3: \"M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\\n -338 0-409-156.573-744-156.573z\",\n tilde4: \"M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\\n -175.236-744-175.236z\",\n // vec is from glyph U+20D7 in font KaTeX Main\n vec: \"M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\\nc-16-25.333-24-45-24-59z\",\n // widehat1 is a modified version of a glyph from the MnSymbol package\n widehat1: \"M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\\nc-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z\",\n // ditto widehat2, widehat3, & widehat4\n widehat2: \"M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10\\n-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z\",\n widehat3: \"M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10\\n-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z\",\n widehat4: \"M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10\\n-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z\",\n // widecheck paths are all inverted versions of widehat\n widecheck1: \"M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z\",\n widecheck2: \"M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z\",\n widecheck3: \"M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z\",\n widecheck4: \"M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z\",\n // The next ten paths support reaction arrows from the mhchem package.\n // Arrows for \\ce{<-->} are offset from xAxis by 0.22ex, per mhchem in LaTeX\n // baraboveleftarrow is mostly from glyph U+2190 in font KaTeX Main\n baraboveleftarrow: \"M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z\",\n // rightarrowabovebar is mostly from glyph U+2192, KaTeX Main\n rightarrowabovebar: \"M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z\",\n // The short left harpoon has 0.5em (i.e. 500 units) kern on the left end.\n // Ref from mhchem.sty: \\rlap{\\raisebox{-.22ex}{$\\kern0.5em\n baraboveshortleftharpoon: \"M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z\",\n rightharpoonaboveshortbar: \"M0,241 l0,40c399126,0,399993,0,399993,0\\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z\",\n shortbaraboveleftharpoon: \"M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z\",\n shortrightharpoonabovebar: \"M53,241l0,40c398570,0,399437,0,399437,0\\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z\"\n};\nvar tallDelim = function tallDelim(label, midHeight) {\n switch (label) {\n case \"lbrack\":\n return \"M403 1759 V84 H666 V0 H319 V1759 v\" + midHeight + \" v1759 h347 v-84\\nH403z M403 1759 V0 H319 V1759 v\" + midHeight + \" v1759 h84z\";\n\n case \"rbrack\":\n return \"M347 1759 V0 H0 V84 H263 V1759 v\" + midHeight + \" v1759 H0 v84 H347z\\nM347 1759 V0 H263 V1759 v\" + midHeight + \" v1759 h84z\";\n\n case \"vert\":\n return \"M145 15 v585 v\" + midHeight + \" v585 c2.667,10,9.667,15,21,15\\nc10,0,16.667,-5,20,-15 v-585 v\" + -midHeight + \" v-585 c-2.667,-10,-9.667,-15,-21,-15\\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v\" + midHeight + \" v585 h43z\";\n\n case \"doublevert\":\n return \"M145 15 v585 v\" + midHeight + \" v585 c2.667,10,9.667,15,21,15\\nc10,0,16.667,-5,20,-15 v-585 v\" + -midHeight + \" v-585 c-2.667,-10,-9.667,-15,-21,-15\\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v\" + midHeight + \" v585 h43z\\nM367 15 v585 v\" + midHeight + \" v585 c2.667,10,9.667,15,21,15\\nc10,0,16.667,-5,20,-15 v-585 v\" + -midHeight + \" v-585 c-2.667,-10,-9.667,-15,-21,-15\\nc-10,0,-16.667,5,-20,15z M410 15 H367 v585 v\" + midHeight + \" v585 h43z\";\n\n case \"lfloor\":\n return \"M319 602 V0 H403 V602 v\" + midHeight + \" v1715 h263 v84 H319z\\nMM319 602 V0 H403 V602 v\" + midHeight + \" v1715 H319z\";\n\n case \"rfloor\":\n return \"M319 602 V0 H403 V602 v\" + midHeight + \" v1799 H0 v-84 H319z\\nMM319 602 V0 H403 V602 v\" + midHeight + \" v1715 H319z\";\n\n case \"lceil\":\n return \"M403 1759 V84 H666 V0 H319 V1759 v\" + midHeight + \" v602 h84z\\nM403 1759 V0 H319 V1759 v\" + midHeight + \" v602 h84z\";\n\n case \"rceil\":\n return \"M347 1759 V0 H0 V84 H263 V1759 v\" + midHeight + \" v602 h84z\\nM347 1759 V0 h-84 V1759 v\" + midHeight + \" v602 h84z\";\n\n case \"lparen\":\n return \"M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1\\nc-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,\\n-36,557 l0,\" + (midHeight + 84) + \"c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,\\n949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9\\nc0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,\\n-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189\\nl0,-\" + (midHeight + 92) + \"c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,\\n-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z\";\n\n case \"rparen\":\n return \"M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,\\n63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5\\nc11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,\" + (midHeight + 9) + \"\\nc-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664\\nc-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11\\nc0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17\\nc242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558\\nl0,-\" + (midHeight + 144) + \"c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,\\n-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z\";\n\n default:\n // We should not ever get here.\n throw new Error(\"Unknown stretchy delimiter.\");\n }\n};\n\n/**\n * This node represents a document fragment, which contains elements, but when\n * placed into the DOM doesn't have any representation itself. It only contains\n * children and doesn't have any DOM node properties.\n */\nclass DocumentFragment {\n // HtmlDomNode\n // Never used; needed for satisfying interface.\n constructor(children) {\n this.children = void 0;\n this.classes = void 0;\n this.height = void 0;\n this.depth = void 0;\n this.maxFontSize = void 0;\n this.style = void 0;\n this.children = children;\n this.classes = [];\n this.height = 0;\n this.depth = 0;\n this.maxFontSize = 0;\n this.style = {};\n }\n\n hasClass(className) {\n return utils.contains(this.classes, className);\n }\n /** Convert the fragment into a node. */\n\n\n toNode() {\n var frag = document.createDocumentFragment();\n\n for (var i = 0; i < this.children.length; i++) {\n frag.appendChild(this.children[i].toNode());\n }\n\n return frag;\n }\n /** Convert the fragment into HTML markup. */\n\n\n toMarkup() {\n var markup = \"\"; // Simply concatenate the markup for the children together.\n\n for (var i = 0; i < this.children.length; i++) {\n markup += this.children[i].toMarkup();\n }\n\n return markup;\n }\n /**\n * Converts the math node into a string, similar to innerText. Applies to\n * MathDomNode's only.\n */\n\n\n toText() {\n // To avoid this, we would subclass documentFragment separately for\n // MathML, but polyfills for subclassing is expensive per PR 1469.\n // $FlowFixMe: Only works for ChildType = MathDomNode.\n var toText = child => child.toText();\n\n return this.children.map(toText).join(\"\");\n }\n\n}\n\n// This file is GENERATED by buildMetrics.sh. DO NOT MODIFY.\nvar fontMetricsData = {\n \"AMS-Regular\": {\n \"32\": [0, 0, 0, 0, 0.25],\n \"65\": [0, 0.68889, 0, 0, 0.72222],\n \"66\": [0, 0.68889, 0, 0, 0.66667],\n \"67\": [0, 0.68889, 0, 0, 0.72222],\n \"68\": [0, 0.68889, 0, 0, 0.72222],\n \"69\": [0, 0.68889, 0, 0, 0.66667],\n \"70\": [0, 0.68889, 0, 0, 0.61111],\n \"71\": [0, 0.68889, 0, 0, 0.77778],\n \"72\": [0, 0.68889, 0, 0, 0.77778],\n \"73\": [0, 0.68889, 0, 0, 0.38889],\n \"74\": [0.16667, 0.68889, 0, 0, 0.5],\n \"75\": [0, 0.68889, 0, 0, 0.77778],\n \"76\": [0, 0.68889, 0, 0, 0.66667],\n \"77\": [0, 0.68889, 0, 0, 0.94445],\n \"78\": [0, 0.68889, 0, 0, 0.72222],\n \"79\": [0.16667, 0.68889, 0, 0, 0.77778],\n \"80\": [0, 0.68889, 0, 0, 0.61111],\n \"81\": [0.16667, 0.68889, 0, 0, 0.77778],\n \"82\": [0, 0.68889, 0, 0, 0.72222],\n \"83\": [0, 0.68889, 0, 0, 0.55556],\n \"84\": [0, 0.68889, 0, 0, 0.66667],\n \"85\": [0, 0.68889, 0, 0, 0.72222],\n \"86\": [0, 0.68889, 0, 0, 0.72222],\n \"87\": [0, 0.68889, 0, 0, 1.0],\n \"88\": [0, 0.68889, 0, 0, 0.72222],\n \"89\": [0, 0.68889, 0, 0, 0.72222],\n \"90\": [0, 0.68889, 0, 0, 0.66667],\n \"107\": [0, 0.68889, 0, 0, 0.55556],\n \"160\": [0, 0, 0, 0, 0.25],\n \"165\": [0, 0.675, 0.025, 0, 0.75],\n \"174\": [0.15559, 0.69224, 0, 0, 0.94666],\n \"240\": [0, 0.68889, 0, 0, 0.55556],\n \"295\": [0, 0.68889, 0, 0, 0.54028],\n \"710\": [0, 0.825, 0, 0, 2.33334],\n \"732\": [0, 0.9, 0, 0, 2.33334],\n \"770\": [0, 0.825, 0, 0, 2.33334],\n \"771\": [0, 0.9, 0, 0, 2.33334],\n \"989\": [0.08167, 0.58167, 0, 0, 0.77778],\n \"1008\": [0, 0.43056, 0.04028, 0, 0.66667],\n \"8245\": [0, 0.54986, 0, 0, 0.275],\n \"8463\": [0, 0.68889, 0, 0, 0.54028],\n \"8487\": [0, 0.68889, 0, 0, 0.72222],\n \"8498\": [0, 0.68889, 0, 0, 0.55556],\n \"8502\": [0, 0.68889, 0, 0, 0.66667],\n \"8503\": [0, 0.68889, 0, 0, 0.44445],\n \"8504\": [0, 0.68889, 0, 0, 0.66667],\n \"8513\": [0, 0.68889, 0, 0, 0.63889],\n \"8592\": [-0.03598, 0.46402, 0, 0, 0.5],\n \"8594\": [-0.03598, 0.46402, 0, 0, 0.5],\n \"8602\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8603\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8606\": [0.01354, 0.52239, 0, 0, 1.0],\n \"8608\": [0.01354, 0.52239, 0, 0, 1.0],\n \"8610\": [0.01354, 0.52239, 0, 0, 1.11111],\n \"8611\": [0.01354, 0.52239, 0, 0, 1.11111],\n \"8619\": [0, 0.54986, 0, 0, 1.0],\n \"8620\": [0, 0.54986, 0, 0, 1.0],\n \"8621\": [-0.13313, 0.37788, 0, 0, 1.38889],\n \"8622\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8624\": [0, 0.69224, 0, 0, 0.5],\n \"8625\": [0, 0.69224, 0, 0, 0.5],\n \"8630\": [0, 0.43056, 0, 0, 1.0],\n \"8631\": [0, 0.43056, 0, 0, 1.0],\n \"8634\": [0.08198, 0.58198, 0, 0, 0.77778],\n \"8635\": [0.08198, 0.58198, 0, 0, 0.77778],\n \"8638\": [0.19444, 0.69224, 0, 0, 0.41667],\n \"8639\": [0.19444, 0.69224, 0, 0, 0.41667],\n \"8642\": [0.19444, 0.69224, 0, 0, 0.41667],\n \"8643\": [0.19444, 0.69224, 0, 0, 0.41667],\n \"8644\": [0.1808, 0.675, 0, 0, 1.0],\n \"8646\": [0.1808, 0.675, 0, 0, 1.0],\n \"8647\": [0.1808, 0.675, 0, 0, 1.0],\n \"8648\": [0.19444, 0.69224, 0, 0, 0.83334],\n \"8649\": [0.1808, 0.675, 0, 0, 1.0],\n \"8650\": [0.19444, 0.69224, 0, 0, 0.83334],\n \"8651\": [0.01354, 0.52239, 0, 0, 1.0],\n \"8652\": [0.01354, 0.52239, 0, 0, 1.0],\n \"8653\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8654\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8655\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8666\": [0.13667, 0.63667, 0, 0, 1.0],\n \"8667\": [0.13667, 0.63667, 0, 0, 1.0],\n \"8669\": [-0.13313, 0.37788, 0, 0, 1.0],\n \"8672\": [-0.064, 0.437, 0, 0, 1.334],\n \"8674\": [-0.064, 0.437, 0, 0, 1.334],\n \"8705\": [0, 0.825, 0, 0, 0.5],\n \"8708\": [0, 0.68889, 0, 0, 0.55556],\n \"8709\": [0.08167, 0.58167, 0, 0, 0.77778],\n \"8717\": [0, 0.43056, 0, 0, 0.42917],\n \"8722\": [-0.03598, 0.46402, 0, 0, 0.5],\n \"8724\": [0.08198, 0.69224, 0, 0, 0.77778],\n \"8726\": [0.08167, 0.58167, 0, 0, 0.77778],\n \"8733\": [0, 0.69224, 0, 0, 0.77778],\n \"8736\": [0, 0.69224, 0, 0, 0.72222],\n \"8737\": [0, 0.69224, 0, 0, 0.72222],\n \"8738\": [0.03517, 0.52239, 0, 0, 0.72222],\n \"8739\": [0.08167, 0.58167, 0, 0, 0.22222],\n \"8740\": [0.25142, 0.74111, 0, 0, 0.27778],\n \"8741\": [0.08167, 0.58167, 0, 0, 0.38889],\n \"8742\": [0.25142, 0.74111, 0, 0, 0.5],\n \"8756\": [0, 0.69224, 0, 0, 0.66667],\n \"8757\": [0, 0.69224, 0, 0, 0.66667],\n \"8764\": [-0.13313, 0.36687, 0, 0, 0.77778],\n \"8765\": [-0.13313, 0.37788, 0, 0, 0.77778],\n \"8769\": [-0.13313, 0.36687, 0, 0, 0.77778],\n \"8770\": [-0.03625, 0.46375, 0, 0, 0.77778],\n \"8774\": [0.30274, 0.79383, 0, 0, 0.77778],\n \"8776\": [-0.01688, 0.48312, 0, 0, 0.77778],\n \"8778\": [0.08167, 0.58167, 0, 0, 0.77778],\n \"8782\": [0.06062, 0.54986, 0, 0, 0.77778],\n \"8783\": [0.06062, 0.54986, 0, 0, 0.77778],\n \"8785\": [0.08198, 0.58198, 0, 0, 0.77778],\n \"8786\": [0.08198, 0.58198, 0, 0, 0.77778],\n \"8787\": [0.08198, 0.58198, 0, 0, 0.77778],\n \"8790\": [0, 0.69224, 0, 0, 0.77778],\n \"8791\": [0.22958, 0.72958, 0, 0, 0.77778],\n \"8796\": [0.08198, 0.91667, 0, 0, 0.77778],\n \"8806\": [0.25583, 0.75583, 0, 0, 0.77778],\n \"8807\": [0.25583, 0.75583, 0, 0, 0.77778],\n \"8808\": [0.25142, 0.75726, 0, 0, 0.77778],\n \"8809\": [0.25142, 0.75726, 0, 0, 0.77778],\n \"8812\": [0.25583, 0.75583, 0, 0, 0.5],\n \"8814\": [0.20576, 0.70576, 0, 0, 0.77778],\n \"8815\": [0.20576, 0.70576, 0, 0, 0.77778],\n \"8816\": [0.30274, 0.79383, 0, 0, 0.77778],\n \"8817\": [0.30274, 0.79383, 0, 0, 0.77778],\n \"8818\": [0.22958, 0.72958, 0, 0, 0.77778],\n \"8819\": [0.22958, 0.72958, 0, 0, 0.77778],\n \"8822\": [0.1808, 0.675, 0, 0, 0.77778],\n \"8823\": [0.1808, 0.675, 0, 0, 0.77778],\n \"8828\": [0.13667, 0.63667, 0, 0, 0.77778],\n \"8829\": [0.13667, 0.63667, 0, 0, 0.77778],\n \"8830\": [0.22958, 0.72958, 0, 0, 0.77778],\n \"8831\": [0.22958, 0.72958, 0, 0, 0.77778],\n \"8832\": [0.20576, 0.70576, 0, 0, 0.77778],\n \"8833\": [0.20576, 0.70576, 0, 0, 0.77778],\n \"8840\": [0.30274, 0.79383, 0, 0, 0.77778],\n \"8841\": [0.30274, 0.79383, 0, 0, 0.77778],\n \"8842\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"8843\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"8847\": [0.03517, 0.54986, 0, 0, 0.77778],\n \"8848\": [0.03517, 0.54986, 0, 0, 0.77778],\n \"8858\": [0.08198, 0.58198, 0, 0, 0.77778],\n \"8859\": [0.08198, 0.58198, 0, 0, 0.77778],\n \"8861\": [0.08198, 0.58198, 0, 0, 0.77778],\n \"8862\": [0, 0.675, 0, 0, 0.77778],\n \"8863\": [0, 0.675, 0, 0, 0.77778],\n \"8864\": [0, 0.675, 0, 0, 0.77778],\n \"8865\": [0, 0.675, 0, 0, 0.77778],\n \"8872\": [0, 0.69224, 0, 0, 0.61111],\n \"8873\": [0, 0.69224, 0, 0, 0.72222],\n \"8874\": [0, 0.69224, 0, 0, 0.88889],\n \"8876\": [0, 0.68889, 0, 0, 0.61111],\n \"8877\": [0, 0.68889, 0, 0, 0.61111],\n \"8878\": [0, 0.68889, 0, 0, 0.72222],\n \"8879\": [0, 0.68889, 0, 0, 0.72222],\n \"8882\": [0.03517, 0.54986, 0, 0, 0.77778],\n \"8883\": [0.03517, 0.54986, 0, 0, 0.77778],\n \"8884\": [0.13667, 0.63667, 0, 0, 0.77778],\n \"8885\": [0.13667, 0.63667, 0, 0, 0.77778],\n \"8888\": [0, 0.54986, 0, 0, 1.11111],\n \"8890\": [0.19444, 0.43056, 0, 0, 0.55556],\n \"8891\": [0.19444, 0.69224, 0, 0, 0.61111],\n \"8892\": [0.19444, 0.69224, 0, 0, 0.61111],\n \"8901\": [0, 0.54986, 0, 0, 0.27778],\n \"8903\": [0.08167, 0.58167, 0, 0, 0.77778],\n \"8905\": [0.08167, 0.58167, 0, 0, 0.77778],\n \"8906\": [0.08167, 0.58167, 0, 0, 0.77778],\n \"8907\": [0, 0.69224, 0, 0, 0.77778],\n \"8908\": [0, 0.69224, 0, 0, 0.77778],\n \"8909\": [-0.03598, 0.46402, 0, 0, 0.77778],\n \"8910\": [0, 0.54986, 0, 0, 0.76042],\n \"8911\": [0, 0.54986, 0, 0, 0.76042],\n \"8912\": [0.03517, 0.54986, 0, 0, 0.77778],\n \"8913\": [0.03517, 0.54986, 0, 0, 0.77778],\n \"8914\": [0, 0.54986, 0, 0, 0.66667],\n \"8915\": [0, 0.54986, 0, 0, 0.66667],\n \"8916\": [0, 0.69224, 0, 0, 0.66667],\n \"8918\": [0.0391, 0.5391, 0, 0, 0.77778],\n \"8919\": [0.0391, 0.5391, 0, 0, 0.77778],\n \"8920\": [0.03517, 0.54986, 0, 0, 1.33334],\n \"8921\": [0.03517, 0.54986, 0, 0, 1.33334],\n \"8922\": [0.38569, 0.88569, 0, 0, 0.77778],\n \"8923\": [0.38569, 0.88569, 0, 0, 0.77778],\n \"8926\": [0.13667, 0.63667, 0, 0, 0.77778],\n \"8927\": [0.13667, 0.63667, 0, 0, 0.77778],\n \"8928\": [0.30274, 0.79383, 0, 0, 0.77778],\n \"8929\": [0.30274, 0.79383, 0, 0, 0.77778],\n \"8934\": [0.23222, 0.74111, 0, 0, 0.77778],\n \"8935\": [0.23222, 0.74111, 0, 0, 0.77778],\n \"8936\": [0.23222, 0.74111, 0, 0, 0.77778],\n \"8937\": [0.23222, 0.74111, 0, 0, 0.77778],\n \"8938\": [0.20576, 0.70576, 0, 0, 0.77778],\n \"8939\": [0.20576, 0.70576, 0, 0, 0.77778],\n \"8940\": [0.30274, 0.79383, 0, 0, 0.77778],\n \"8941\": [0.30274, 0.79383, 0, 0, 0.77778],\n \"8994\": [0.19444, 0.69224, 0, 0, 0.77778],\n \"8995\": [0.19444, 0.69224, 0, 0, 0.77778],\n \"9416\": [0.15559, 0.69224, 0, 0, 0.90222],\n \"9484\": [0, 0.69224, 0, 0, 0.5],\n \"9488\": [0, 0.69224, 0, 0, 0.5],\n \"9492\": [0, 0.37788, 0, 0, 0.5],\n \"9496\": [0, 0.37788, 0, 0, 0.5],\n \"9585\": [0.19444, 0.68889, 0, 0, 0.88889],\n \"9586\": [0.19444, 0.74111, 0, 0, 0.88889],\n \"9632\": [0, 0.675, 0, 0, 0.77778],\n \"9633\": [0, 0.675, 0, 0, 0.77778],\n \"9650\": [0, 0.54986, 0, 0, 0.72222],\n \"9651\": [0, 0.54986, 0, 0, 0.72222],\n \"9654\": [0.03517, 0.54986, 0, 0, 0.77778],\n \"9660\": [0, 0.54986, 0, 0, 0.72222],\n \"9661\": [0, 0.54986, 0, 0, 0.72222],\n \"9664\": [0.03517, 0.54986, 0, 0, 0.77778],\n \"9674\": [0.11111, 0.69224, 0, 0, 0.66667],\n \"9733\": [0.19444, 0.69224, 0, 0, 0.94445],\n \"10003\": [0, 0.69224, 0, 0, 0.83334],\n \"10016\": [0, 0.69224, 0, 0, 0.83334],\n \"10731\": [0.11111, 0.69224, 0, 0, 0.66667],\n \"10846\": [0.19444, 0.75583, 0, 0, 0.61111],\n \"10877\": [0.13667, 0.63667, 0, 0, 0.77778],\n \"10878\": [0.13667, 0.63667, 0, 0, 0.77778],\n \"10885\": [0.25583, 0.75583, 0, 0, 0.77778],\n \"10886\": [0.25583, 0.75583, 0, 0, 0.77778],\n \"10887\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"10888\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"10889\": [0.26167, 0.75726, 0, 0, 0.77778],\n \"10890\": [0.26167, 0.75726, 0, 0, 0.77778],\n \"10891\": [0.48256, 0.98256, 0, 0, 0.77778],\n \"10892\": [0.48256, 0.98256, 0, 0, 0.77778],\n \"10901\": [0.13667, 0.63667, 0, 0, 0.77778],\n \"10902\": [0.13667, 0.63667, 0, 0, 0.77778],\n \"10933\": [0.25142, 0.75726, 0, 0, 0.77778],\n \"10934\": [0.25142, 0.75726, 0, 0, 0.77778],\n \"10935\": [0.26167, 0.75726, 0, 0, 0.77778],\n \"10936\": [0.26167, 0.75726, 0, 0, 0.77778],\n \"10937\": [0.26167, 0.75726, 0, 0, 0.77778],\n \"10938\": [0.26167, 0.75726, 0, 0, 0.77778],\n \"10949\": [0.25583, 0.75583, 0, 0, 0.77778],\n \"10950\": [0.25583, 0.75583, 0, 0, 0.77778],\n \"10955\": [0.28481, 0.79383, 0, 0, 0.77778],\n \"10956\": [0.28481, 0.79383, 0, 0, 0.77778],\n \"57350\": [0.08167, 0.58167, 0, 0, 0.22222],\n \"57351\": [0.08167, 0.58167, 0, 0, 0.38889],\n \"57352\": [0.08167, 0.58167, 0, 0, 0.77778],\n \"57353\": [0, 0.43056, 0.04028, 0, 0.66667],\n \"57356\": [0.25142, 0.75726, 0, 0, 0.77778],\n \"57357\": [0.25142, 0.75726, 0, 0, 0.77778],\n \"57358\": [0.41951, 0.91951, 0, 0, 0.77778],\n \"57359\": [0.30274, 0.79383, 0, 0, 0.77778],\n \"57360\": [0.30274, 0.79383, 0, 0, 0.77778],\n \"57361\": [0.41951, 0.91951, 0, 0, 0.77778],\n \"57366\": [0.25142, 0.75726, 0, 0, 0.77778],\n \"57367\": [0.25142, 0.75726, 0, 0, 0.77778],\n \"57368\": [0.25142, 0.75726, 0, 0, 0.77778],\n \"57369\": [0.25142, 0.75726, 0, 0, 0.77778],\n \"57370\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"57371\": [0.13597, 0.63597, 0, 0, 0.77778]\n },\n \"Caligraphic-Regular\": {\n \"32\": [0, 0, 0, 0, 0.25],\n \"65\": [0, 0.68333, 0, 0.19445, 0.79847],\n \"66\": [0, 0.68333, 0.03041, 0.13889, 0.65681],\n \"67\": [0, 0.68333, 0.05834, 0.13889, 0.52653],\n \"68\": [0, 0.68333, 0.02778, 0.08334, 0.77139],\n \"69\": [0, 0.68333, 0.08944, 0.11111, 0.52778],\n \"70\": [0, 0.68333, 0.09931, 0.11111, 0.71875],\n \"71\": [0.09722, 0.68333, 0.0593, 0.11111, 0.59487],\n \"72\": [0, 0.68333, 0.00965, 0.11111, 0.84452],\n \"73\": [0, 0.68333, 0.07382, 0, 0.54452],\n \"74\": [0.09722, 0.68333, 0.18472, 0.16667, 0.67778],\n \"75\": [0, 0.68333, 0.01445, 0.05556, 0.76195],\n \"76\": [0, 0.68333, 0, 0.13889, 0.68972],\n \"77\": [0, 0.68333, 0, 0.13889, 1.2009],\n \"78\": [0, 0.68333, 0.14736, 0.08334, 0.82049],\n \"79\": [0, 0.68333, 0.02778, 0.11111, 0.79611],\n \"80\": [0, 0.68333, 0.08222, 0.08334, 0.69556],\n \"81\": [0.09722, 0.68333, 0, 0.11111, 0.81667],\n \"82\": [0, 0.68333, 0, 0.08334, 0.8475],\n \"83\": [0, 0.68333, 0.075, 0.13889, 0.60556],\n \"84\": [0, 0.68333, 0.25417, 0, 0.54464],\n \"85\": [0, 0.68333, 0.09931, 0.08334, 0.62583],\n \"86\": [0, 0.68333, 0.08222, 0, 0.61278],\n \"87\": [0, 0.68333, 0.08222, 0.08334, 0.98778],\n \"88\": [0, 0.68333, 0.14643, 0.13889, 0.7133],\n \"89\": [0.09722, 0.68333, 0.08222, 0.08334, 0.66834],\n \"90\": [0, 0.68333, 0.07944, 0.13889, 0.72473],\n \"160\": [0, 0, 0, 0, 0.25]\n },\n \"Fraktur-Regular\": {\n \"32\": [0, 0, 0, 0, 0.25],\n \"33\": [0, 0.69141, 0, 0, 0.29574],\n \"34\": [0, 0.69141, 0, 0, 0.21471],\n \"38\": [0, 0.69141, 0, 0, 0.73786],\n \"39\": [0, 0.69141, 0, 0, 0.21201],\n \"40\": [0.24982, 0.74947, 0, 0, 0.38865],\n \"41\": [0.24982, 0.74947, 0, 0, 0.38865],\n \"42\": [0, 0.62119, 0, 0, 0.27764],\n \"43\": [0.08319, 0.58283, 0, 0, 0.75623],\n \"44\": [0, 0.10803, 0, 0, 0.27764],\n \"45\": [0.08319, 0.58283, 0, 0, 0.75623],\n \"46\": [0, 0.10803, 0, 0, 0.27764],\n \"47\": [0.24982, 0.74947, 0, 0, 0.50181],\n \"48\": [0, 0.47534, 0, 0, 0.50181],\n \"49\": [0, 0.47534, 0, 0, 0.50181],\n \"50\": [0, 0.47534, 0, 0, 0.50181],\n \"51\": [0.18906, 0.47534, 0, 0, 0.50181],\n \"52\": [0.18906, 0.47534, 0, 0, 0.50181],\n \"53\": [0.18906, 0.47534, 0, 0, 0.50181],\n \"54\": [0, 0.69141, 0, 0, 0.50181],\n \"55\": [0.18906, 0.47534, 0, 0, 0.50181],\n \"56\": [0, 0.69141, 0, 0, 0.50181],\n \"57\": [0.18906, 0.47534, 0, 0, 0.50181],\n \"58\": [0, 0.47534, 0, 0, 0.21606],\n \"59\": [0.12604, 0.47534, 0, 0, 0.21606],\n \"61\": [-0.13099, 0.36866, 0, 0, 0.75623],\n \"63\": [0, 0.69141, 0, 0, 0.36245],\n \"65\": [0, 0.69141, 0, 0, 0.7176],\n \"66\": [0, 0.69141, 0, 0, 0.88397],\n \"67\": [0, 0.69141, 0, 0, 0.61254],\n \"68\": [0, 0.69141, 0, 0, 0.83158],\n \"69\": [0, 0.69141, 0, 0, 0.66278],\n \"70\": [0.12604, 0.69141, 0, 0, 0.61119],\n \"71\": [0, 0.69141, 0, 0, 0.78539],\n \"72\": [0.06302, 0.69141, 0, 0, 0.7203],\n \"73\": [0, 0.69141, 0, 0, 0.55448],\n \"74\": [0.12604, 0.69141, 0, 0, 0.55231],\n \"75\": [0, 0.69141, 0, 0, 0.66845],\n \"76\": [0, 0.69141, 0, 0, 0.66602],\n \"77\": [0, 0.69141, 0, 0, 1.04953],\n \"78\": [0, 0.69141, 0, 0, 0.83212],\n \"79\": [0, 0.69141, 0, 0, 0.82699],\n \"80\": [0.18906, 0.69141, 0, 0, 0.82753],\n \"81\": [0.03781, 0.69141, 0, 0, 0.82699],\n \"82\": [0, 0.69141, 0, 0, 0.82807],\n \"83\": [0, 0.69141, 0, 0, 0.82861],\n \"84\": [0, 0.69141, 0, 0, 0.66899],\n \"85\": [0, 0.69141, 0, 0, 0.64576],\n \"86\": [0, 0.69141, 0, 0, 0.83131],\n \"87\": [0, 0.69141, 0, 0, 1.04602],\n \"88\": [0, 0.69141, 0, 0, 0.71922],\n \"89\": [0.18906, 0.69141, 0, 0, 0.83293],\n \"90\": [0.12604, 0.69141, 0, 0, 0.60201],\n \"91\": [0.24982, 0.74947, 0, 0, 0.27764],\n \"93\": [0.24982, 0.74947, 0, 0, 0.27764],\n \"94\": [0, 0.69141, 0, 0, 0.49965],\n \"97\": [0, 0.47534, 0, 0, 0.50046],\n \"98\": [0, 0.69141, 0, 0, 0.51315],\n \"99\": [0, 0.47534, 0, 0, 0.38946],\n \"100\": [0, 0.62119, 0, 0, 0.49857],\n \"101\": [0, 0.47534, 0, 0, 0.40053],\n \"102\": [0.18906, 0.69141, 0, 0, 0.32626],\n \"103\": [0.18906, 0.47534, 0, 0, 0.5037],\n \"104\": [0.18906, 0.69141, 0, 0, 0.52126],\n \"105\": [0, 0.69141, 0, 0, 0.27899],\n \"106\": [0, 0.69141, 0, 0, 0.28088],\n \"107\": [0, 0.69141, 0, 0, 0.38946],\n \"108\": [0, 0.69141, 0, 0, 0.27953],\n \"109\": [0, 0.47534, 0, 0, 0.76676],\n \"110\": [0, 0.47534, 0, 0, 0.52666],\n \"111\": [0, 0.47534, 0, 0, 0.48885],\n \"112\": [0.18906, 0.52396, 0, 0, 0.50046],\n \"113\": [0.18906, 0.47534, 0, 0, 0.48912],\n \"114\": [0, 0.47534, 0, 0, 0.38919],\n \"115\": [0, 0.47534, 0, 0, 0.44266],\n \"116\": [0, 0.62119, 0, 0, 0.33301],\n \"117\": [0, 0.47534, 0, 0, 0.5172],\n \"118\": [0, 0.52396, 0, 0, 0.5118],\n \"119\": [0, 0.52396, 0, 0, 0.77351],\n \"120\": [0.18906, 0.47534, 0, 0, 0.38865],\n \"121\": [0.18906, 0.47534, 0, 0, 0.49884],\n \"122\": [0.18906, 0.47534, 0, 0, 0.39054],\n \"160\": [0, 0, 0, 0, 0.25],\n \"8216\": [0, 0.69141, 0, 0, 0.21471],\n \"8217\": [0, 0.69141, 0, 0, 0.21471],\n \"58112\": [0, 0.62119, 0, 0, 0.49749],\n \"58113\": [0, 0.62119, 0, 0, 0.4983],\n \"58114\": [0.18906, 0.69141, 0, 0, 0.33328],\n \"58115\": [0.18906, 0.69141, 0, 0, 0.32923],\n \"58116\": [0.18906, 0.47534, 0, 0, 0.50343],\n \"58117\": [0, 0.69141, 0, 0, 0.33301],\n \"58118\": [0, 0.62119, 0, 0, 0.33409],\n \"58119\": [0, 0.47534, 0, 0, 0.50073]\n },\n \"Main-Bold\": {\n \"32\": [0, 0, 0, 0, 0.25],\n \"33\": [0, 0.69444, 0, 0, 0.35],\n \"34\": [0, 0.69444, 0, 0, 0.60278],\n \"35\": [0.19444, 0.69444, 0, 0, 0.95833],\n \"36\": [0.05556, 0.75, 0, 0, 0.575],\n \"37\": [0.05556, 0.75, 0, 0, 0.95833],\n \"38\": [0, 0.69444, 0, 0, 0.89444],\n \"39\": [0, 0.69444, 0, 0, 0.31944],\n \"40\": [0.25, 0.75, 0, 0, 0.44722],\n \"41\": [0.25, 0.75, 0, 0, 0.44722],\n \"42\": [0, 0.75, 0, 0, 0.575],\n \"43\": [0.13333, 0.63333, 0, 0, 0.89444],\n \"44\": [0.19444, 0.15556, 0, 0, 0.31944],\n \"45\": [0, 0.44444, 0, 0, 0.38333],\n \"46\": [0, 0.15556, 0, 0, 0.31944],\n \"47\": [0.25, 0.75, 0, 0, 0.575],\n \"48\": [0, 0.64444, 0, 0, 0.575],\n \"49\": [0, 0.64444, 0, 0, 0.575],\n \"50\": [0, 0.64444, 0, 0, 0.575],\n \"51\": [0, 0.64444, 0, 0, 0.575],\n \"52\": [0, 0.64444, 0, 0, 0.575],\n \"53\": [0, 0.64444, 0, 0, 0.575],\n \"54\": [0, 0.64444, 0, 0, 0.575],\n \"55\": [0, 0.64444, 0, 0, 0.575],\n \"56\": [0, 0.64444, 0, 0, 0.575],\n \"57\": [0, 0.64444, 0, 0, 0.575],\n \"58\": [0, 0.44444, 0, 0, 0.31944],\n \"59\": [0.19444, 0.44444, 0, 0, 0.31944],\n \"60\": [0.08556, 0.58556, 0, 0, 0.89444],\n \"61\": [-0.10889, 0.39111, 0, 0, 0.89444],\n \"62\": [0.08556, 0.58556, 0, 0, 0.89444],\n \"63\": [0, 0.69444, 0, 0, 0.54305],\n \"64\": [0, 0.69444, 0, 0, 0.89444],\n \"65\": [0, 0.68611, 0, 0, 0.86944],\n \"66\": [0, 0.68611, 0, 0, 0.81805],\n \"67\": [0, 0.68611, 0, 0, 0.83055],\n \"68\": [0, 0.68611, 0, 0, 0.88194],\n \"69\": [0, 0.68611, 0, 0, 0.75555],\n \"70\": [0, 0.68611, 0, 0, 0.72361],\n \"71\": [0, 0.68611, 0, 0, 0.90416],\n \"72\": [0, 0.68611, 0, 0, 0.9],\n \"73\": [0, 0.68611, 0, 0, 0.43611],\n \"74\": [0, 0.68611, 0, 0, 0.59444],\n \"75\": [0, 0.68611, 0, 0, 0.90138],\n \"76\": [0, 0.68611, 0, 0, 0.69166],\n \"77\": [0, 0.68611, 0, 0, 1.09166],\n \"78\": [0, 0.68611, 0, 0, 0.9],\n \"79\": [0, 0.68611, 0, 0, 0.86388],\n \"80\": [0, 0.68611, 0, 0, 0.78611],\n \"81\": [0.19444, 0.68611, 0, 0, 0.86388],\n \"82\": [0, 0.68611, 0, 0, 0.8625],\n \"83\": [0, 0.68611, 0, 0, 0.63889],\n \"84\": [0, 0.68611, 0, 0, 0.8],\n \"85\": [0, 0.68611, 0, 0, 0.88472],\n \"86\": [0, 0.68611, 0.01597, 0, 0.86944],\n \"87\": [0, 0.68611, 0.01597, 0, 1.18888],\n \"88\": [0, 0.68611, 0, 0, 0.86944],\n \"89\": [0, 0.68611, 0.02875, 0, 0.86944],\n \"90\": [0, 0.68611, 0, 0, 0.70277],\n \"91\": [0.25, 0.75, 0, 0, 0.31944],\n \"92\": [0.25, 0.75, 0, 0, 0.575],\n \"93\": [0.25, 0.75, 0, 0, 0.31944],\n \"94\": [0, 0.69444, 0, 0, 0.575],\n \"95\": [0.31, 0.13444, 0.03194, 0, 0.575],\n \"97\": [0, 0.44444, 0, 0, 0.55902],\n \"98\": [0, 0.69444, 0, 0, 0.63889],\n \"99\": [0, 0.44444, 0, 0, 0.51111],\n \"100\": [0, 0.69444, 0, 0, 0.63889],\n \"101\": [0, 0.44444, 0, 0, 0.52708],\n \"102\": [0, 0.69444, 0.10903, 0, 0.35139],\n \"103\": [0.19444, 0.44444, 0.01597, 0, 0.575],\n \"104\": [0, 0.69444, 0, 0, 0.63889],\n \"105\": [0, 0.69444, 0, 0, 0.31944],\n \"106\": [0.19444, 0.69444, 0, 0, 0.35139],\n \"107\": [0, 0.69444, 0, 0, 0.60694],\n \"108\": [0, 0.69444, 0, 0, 0.31944],\n \"109\": [0, 0.44444, 0, 0, 0.95833],\n \"110\": [0, 0.44444, 0, 0, 0.63889],\n \"111\": [0, 0.44444, 0, 0, 0.575],\n \"112\": [0.19444, 0.44444, 0, 0, 0.63889],\n \"113\": [0.19444, 0.44444, 0, 0, 0.60694],\n \"114\": [0, 0.44444, 0, 0, 0.47361],\n \"115\": [0, 0.44444, 0, 0, 0.45361],\n \"116\": [0, 0.63492, 0, 0, 0.44722],\n \"117\": [0, 0.44444, 0, 0, 0.63889],\n \"118\": [0, 0.44444, 0.01597, 0, 0.60694],\n \"119\": [0, 0.44444, 0.01597, 0, 0.83055],\n \"120\": [0, 0.44444, 0, 0, 0.60694],\n \"121\": [0.19444, 0.44444, 0.01597, 0, 0.60694],\n \"122\": [0, 0.44444, 0, 0, 0.51111],\n \"123\": [0.25, 0.75, 0, 0, 0.575],\n \"124\": [0.25, 0.75, 0, 0, 0.31944],\n \"125\": [0.25, 0.75, 0, 0, 0.575],\n \"126\": [0.35, 0.34444, 0, 0, 0.575],\n \"160\": [0, 0, 0, 0, 0.25],\n \"163\": [0, 0.69444, 0, 0, 0.86853],\n \"168\": [0, 0.69444, 0, 0, 0.575],\n \"172\": [0, 0.44444, 0, 0, 0.76666],\n \"176\": [0, 0.69444, 0, 0, 0.86944],\n \"177\": [0.13333, 0.63333, 0, 0, 0.89444],\n \"184\": [0.17014, 0, 0, 0, 0.51111],\n \"198\": [0, 0.68611, 0, 0, 1.04166],\n \"215\": [0.13333, 0.63333, 0, 0, 0.89444],\n \"216\": [0.04861, 0.73472, 0, 0, 0.89444],\n \"223\": [0, 0.69444, 0, 0, 0.59722],\n \"230\": [0, 0.44444, 0, 0, 0.83055],\n \"247\": [0.13333, 0.63333, 0, 0, 0.89444],\n \"248\": [0.09722, 0.54167, 0, 0, 0.575],\n \"305\": [0, 0.44444, 0, 0, 0.31944],\n \"338\": [0, 0.68611, 0, 0, 1.16944],\n \"339\": [0, 0.44444, 0, 0, 0.89444],\n \"567\": [0.19444, 0.44444, 0, 0, 0.35139],\n \"710\": [0, 0.69444, 0, 0, 0.575],\n \"711\": [0, 0.63194, 0, 0, 0.575],\n \"713\": [0, 0.59611, 0, 0, 0.575],\n \"714\": [0, 0.69444, 0, 0, 0.575],\n \"715\": [0, 0.69444, 0, 0, 0.575],\n \"728\": [0, 0.69444, 0, 0, 0.575],\n \"729\": [0, 0.69444, 0, 0, 0.31944],\n \"730\": [0, 0.69444, 0, 0, 0.86944],\n \"732\": [0, 0.69444, 0, 0, 0.575],\n \"733\": [0, 0.69444, 0, 0, 0.575],\n \"915\": [0, 0.68611, 0, 0, 0.69166],\n \"916\": [0, 0.68611, 0, 0, 0.95833],\n \"920\": [0, 0.68611, 0, 0, 0.89444],\n \"923\": [0, 0.68611, 0, 0, 0.80555],\n \"926\": [0, 0.68611, 0, 0, 0.76666],\n \"928\": [0, 0.68611, 0, 0, 0.9],\n \"931\": [0, 0.68611, 0, 0, 0.83055],\n \"933\": [0, 0.68611, 0, 0, 0.89444],\n \"934\": [0, 0.68611, 0, 0, 0.83055],\n \"936\": [0, 0.68611, 0, 0, 0.89444],\n \"937\": [0, 0.68611, 0, 0, 0.83055],\n \"8211\": [0, 0.44444, 0.03194, 0, 0.575],\n \"8212\": [0, 0.44444, 0.03194, 0, 1.14999],\n \"8216\": [0, 0.69444, 0, 0, 0.31944],\n \"8217\": [0, 0.69444, 0, 0, 0.31944],\n \"8220\": [0, 0.69444, 0, 0, 0.60278],\n \"8221\": [0, 0.69444, 0, 0, 0.60278],\n \"8224\": [0.19444, 0.69444, 0, 0, 0.51111],\n \"8225\": [0.19444, 0.69444, 0, 0, 0.51111],\n \"8242\": [0, 0.55556, 0, 0, 0.34444],\n \"8407\": [0, 0.72444, 0.15486, 0, 0.575],\n \"8463\": [0, 0.69444, 0, 0, 0.66759],\n \"8465\": [0, 0.69444, 0, 0, 0.83055],\n \"8467\": [0, 0.69444, 0, 0, 0.47361],\n \"8472\": [0.19444, 0.44444, 0, 0, 0.74027],\n \"8476\": [0, 0.69444, 0, 0, 0.83055],\n \"8501\": [0, 0.69444, 0, 0, 0.70277],\n \"8592\": [-0.10889, 0.39111, 0, 0, 1.14999],\n \"8593\": [0.19444, 0.69444, 0, 0, 0.575],\n \"8594\": [-0.10889, 0.39111, 0, 0, 1.14999],\n \"8595\": [0.19444, 0.69444, 0, 0, 0.575],\n \"8596\": [-0.10889, 0.39111, 0, 0, 1.14999],\n \"8597\": [0.25, 0.75, 0, 0, 0.575],\n \"8598\": [0.19444, 0.69444, 0, 0, 1.14999],\n \"8599\": [0.19444, 0.69444, 0, 0, 1.14999],\n \"8600\": [0.19444, 0.69444, 0, 0, 1.14999],\n \"8601\": [0.19444, 0.69444, 0, 0, 1.14999],\n \"8636\": [-0.10889, 0.39111, 0, 0, 1.14999],\n \"8637\": [-0.10889, 0.39111, 0, 0, 1.14999],\n \"8640\": [-0.10889, 0.39111, 0, 0, 1.14999],\n \"8641\": [-0.10889, 0.39111, 0, 0, 1.14999],\n \"8656\": [-0.10889, 0.39111, 0, 0, 1.14999],\n \"8657\": [0.19444, 0.69444, 0, 0, 0.70277],\n \"8658\": [-0.10889, 0.39111, 0, 0, 1.14999],\n \"8659\": [0.19444, 0.69444, 0, 0, 0.70277],\n \"8660\": [-0.10889, 0.39111, 0, 0, 1.14999],\n \"8661\": [0.25, 0.75, 0, 0, 0.70277],\n \"8704\": [0, 0.69444, 0, 0, 0.63889],\n \"8706\": [0, 0.69444, 0.06389, 0, 0.62847],\n \"8707\": [0, 0.69444, 0, 0, 0.63889],\n \"8709\": [0.05556, 0.75, 0, 0, 0.575],\n \"8711\": [0, 0.68611, 0, 0, 0.95833],\n \"8712\": [0.08556, 0.58556, 0, 0, 0.76666],\n \"8715\": [0.08556, 0.58556, 0, 0, 0.76666],\n \"8722\": [0.13333, 0.63333, 0, 0, 0.89444],\n \"8723\": [0.13333, 0.63333, 0, 0, 0.89444],\n \"8725\": [0.25, 0.75, 0, 0, 0.575],\n \"8726\": [0.25, 0.75, 0, 0, 0.575],\n \"8727\": [-0.02778, 0.47222, 0, 0, 0.575],\n \"8728\": [-0.02639, 0.47361, 0, 0, 0.575],\n \"8729\": [-0.02639, 0.47361, 0, 0, 0.575],\n \"8730\": [0.18, 0.82, 0, 0, 0.95833],\n \"8733\": [0, 0.44444, 0, 0, 0.89444],\n \"8734\": [0, 0.44444, 0, 0, 1.14999],\n \"8736\": [0, 0.69224, 0, 0, 0.72222],\n \"8739\": [0.25, 0.75, 0, 0, 0.31944],\n \"8741\": [0.25, 0.75, 0, 0, 0.575],\n \"8743\": [0, 0.55556, 0, 0, 0.76666],\n \"8744\": [0, 0.55556, 0, 0, 0.76666],\n \"8745\": [0, 0.55556, 0, 0, 0.76666],\n \"8746\": [0, 0.55556, 0, 0, 0.76666],\n \"8747\": [0.19444, 0.69444, 0.12778, 0, 0.56875],\n \"8764\": [-0.10889, 0.39111, 0, 0, 0.89444],\n \"8768\": [0.19444, 0.69444, 0, 0, 0.31944],\n \"8771\": [0.00222, 0.50222, 0, 0, 0.89444],\n \"8773\": [0.027, 0.638, 0, 0, 0.894],\n \"8776\": [0.02444, 0.52444, 0, 0, 0.89444],\n \"8781\": [0.00222, 0.50222, 0, 0, 0.89444],\n \"8801\": [0.00222, 0.50222, 0, 0, 0.89444],\n \"8804\": [0.19667, 0.69667, 0, 0, 0.89444],\n \"8805\": [0.19667, 0.69667, 0, 0, 0.89444],\n \"8810\": [0.08556, 0.58556, 0, 0, 1.14999],\n \"8811\": [0.08556, 0.58556, 0, 0, 1.14999],\n \"8826\": [0.08556, 0.58556, 0, 0, 0.89444],\n \"8827\": [0.08556, 0.58556, 0, 0, 0.89444],\n \"8834\": [0.08556, 0.58556, 0, 0, 0.89444],\n \"8835\": [0.08556, 0.58556, 0, 0, 0.89444],\n \"8838\": [0.19667, 0.69667, 0, 0, 0.89444],\n \"8839\": [0.19667, 0.69667, 0, 0, 0.89444],\n \"8846\": [0, 0.55556, 0, 0, 0.76666],\n \"8849\": [0.19667, 0.69667, 0, 0, 0.89444],\n \"8850\": [0.19667, 0.69667, 0, 0, 0.89444],\n \"8851\": [0, 0.55556, 0, 0, 0.76666],\n \"8852\": [0, 0.55556, 0, 0, 0.76666],\n \"8853\": [0.13333, 0.63333, 0, 0, 0.89444],\n \"8854\": [0.13333, 0.63333, 0, 0, 0.89444],\n \"8855\": [0.13333, 0.63333, 0, 0, 0.89444],\n \"8856\": [0.13333, 0.63333, 0, 0, 0.89444],\n \"8857\": [0.13333, 0.63333, 0, 0, 0.89444],\n \"8866\": [0, 0.69444, 0, 0, 0.70277],\n \"8867\": [0, 0.69444, 0, 0, 0.70277],\n \"8868\": [0, 0.69444, 0, 0, 0.89444],\n \"8869\": [0, 0.69444, 0, 0, 0.89444],\n \"8900\": [-0.02639, 0.47361, 0, 0, 0.575],\n \"8901\": [-0.02639, 0.47361, 0, 0, 0.31944],\n \"8902\": [-0.02778, 0.47222, 0, 0, 0.575],\n \"8968\": [0.25, 0.75, 0, 0, 0.51111],\n \"8969\": [0.25, 0.75, 0, 0, 0.51111],\n \"8970\": [0.25, 0.75, 0, 0, 0.51111],\n \"8971\": [0.25, 0.75, 0, 0, 0.51111],\n \"8994\": [-0.13889, 0.36111, 0, 0, 1.14999],\n \"8995\": [-0.13889, 0.36111, 0, 0, 1.14999],\n \"9651\": [0.19444, 0.69444, 0, 0, 1.02222],\n \"9657\": [-0.02778, 0.47222, 0, 0, 0.575],\n \"9661\": [0.19444, 0.69444, 0, 0, 1.02222],\n \"9667\": [-0.02778, 0.47222, 0, 0, 0.575],\n \"9711\": [0.19444, 0.69444, 0, 0, 1.14999],\n \"9824\": [0.12963, 0.69444, 0, 0, 0.89444],\n \"9825\": [0.12963, 0.69444, 0, 0, 0.89444],\n \"9826\": [0.12963, 0.69444, 0, 0, 0.89444],\n \"9827\": [0.12963, 0.69444, 0, 0, 0.89444],\n \"9837\": [0, 0.75, 0, 0, 0.44722],\n \"9838\": [0.19444, 0.69444, 0, 0, 0.44722],\n \"9839\": [0.19444, 0.69444, 0, 0, 0.44722],\n \"10216\": [0.25, 0.75, 0, 0, 0.44722],\n \"10217\": [0.25, 0.75, 0, 0, 0.44722],\n \"10815\": [0, 0.68611, 0, 0, 0.9],\n \"10927\": [0.19667, 0.69667, 0, 0, 0.89444],\n \"10928\": [0.19667, 0.69667, 0, 0, 0.89444],\n \"57376\": [0.19444, 0.69444, 0, 0, 0]\n },\n \"Main-BoldItalic\": {\n \"32\": [0, 0, 0, 0, 0.25],\n \"33\": [0, 0.69444, 0.11417, 0, 0.38611],\n \"34\": [0, 0.69444, 0.07939, 0, 0.62055],\n \"35\": [0.19444, 0.69444, 0.06833, 0, 0.94444],\n \"37\": [0.05556, 0.75, 0.12861, 0, 0.94444],\n \"38\": [0, 0.69444, 0.08528, 0, 0.88555],\n \"39\": [0, 0.69444, 0.12945, 0, 0.35555],\n \"40\": [0.25, 0.75, 0.15806, 0, 0.47333],\n \"41\": [0.25, 0.75, 0.03306, 0, 0.47333],\n \"42\": [0, 0.75, 0.14333, 0, 0.59111],\n \"43\": [0.10333, 0.60333, 0.03306, 0, 0.88555],\n \"44\": [0.19444, 0.14722, 0, 0, 0.35555],\n \"45\": [0, 0.44444, 0.02611, 0, 0.41444],\n \"46\": [0, 0.14722, 0, 0, 0.35555],\n \"47\": [0.25, 0.75, 0.15806, 0, 0.59111],\n \"48\": [0, 0.64444, 0.13167, 0, 0.59111],\n \"49\": [0, 0.64444, 0.13167, 0, 0.59111],\n \"50\": [0, 0.64444, 0.13167, 0, 0.59111],\n \"51\": [0, 0.64444, 0.13167, 0, 0.59111],\n \"52\": [0.19444, 0.64444, 0.13167, 0, 0.59111],\n \"53\": [0, 0.64444, 0.13167, 0, 0.59111],\n \"54\": [0, 0.64444, 0.13167, 0, 0.59111],\n \"55\": [0.19444, 0.64444, 0.13167, 0, 0.59111],\n \"56\": [0, 0.64444, 0.13167, 0, 0.59111],\n \"57\": [0, 0.64444, 0.13167, 0, 0.59111],\n \"58\": [0, 0.44444, 0.06695, 0, 0.35555],\n \"59\": [0.19444, 0.44444, 0.06695, 0, 0.35555],\n \"61\": [-0.10889, 0.39111, 0.06833, 0, 0.88555],\n \"63\": [0, 0.69444, 0.11472, 0, 0.59111],\n \"64\": [0, 0.69444, 0.09208, 0, 0.88555],\n \"65\": [0, 0.68611, 0, 0, 0.86555],\n \"66\": [0, 0.68611, 0.0992, 0, 0.81666],\n \"67\": [0, 0.68611, 0.14208, 0, 0.82666],\n \"68\": [0, 0.68611, 0.09062, 0, 0.87555],\n \"69\": [0, 0.68611, 0.11431, 0, 0.75666],\n \"70\": [0, 0.68611, 0.12903, 0, 0.72722],\n \"71\": [0, 0.68611, 0.07347, 0, 0.89527],\n \"72\": [0, 0.68611, 0.17208, 0, 0.8961],\n \"73\": [0, 0.68611, 0.15681, 0, 0.47166],\n \"74\": [0, 0.68611, 0.145, 0, 0.61055],\n \"75\": [0, 0.68611, 0.14208, 0, 0.89499],\n \"76\": [0, 0.68611, 0, 0, 0.69777],\n \"77\": [0, 0.68611, 0.17208, 0, 1.07277],\n \"78\": [0, 0.68611, 0.17208, 0, 0.8961],\n \"79\": [0, 0.68611, 0.09062, 0, 0.85499],\n \"80\": [0, 0.68611, 0.0992, 0, 0.78721],\n \"81\": [0.19444, 0.68611, 0.09062, 0, 0.85499],\n \"82\": [0, 0.68611, 0.02559, 0, 0.85944],\n \"83\": [0, 0.68611, 0.11264, 0, 0.64999],\n \"84\": [0, 0.68611, 0.12903, 0, 0.7961],\n \"85\": [0, 0.68611, 0.17208, 0, 0.88083],\n \"86\": [0, 0.68611, 0.18625, 0, 0.86555],\n \"87\": [0, 0.68611, 0.18625, 0, 1.15999],\n \"88\": [0, 0.68611, 0.15681, 0, 0.86555],\n \"89\": [0, 0.68611, 0.19803, 0, 0.86555],\n \"90\": [0, 0.68611, 0.14208, 0, 0.70888],\n \"91\": [0.25, 0.75, 0.1875, 0, 0.35611],\n \"93\": [0.25, 0.75, 0.09972, 0, 0.35611],\n \"94\": [0, 0.69444, 0.06709, 0, 0.59111],\n \"95\": [0.31, 0.13444, 0.09811, 0, 0.59111],\n \"97\": [0, 0.44444, 0.09426, 0, 0.59111],\n \"98\": [0, 0.69444, 0.07861, 0, 0.53222],\n \"99\": [0, 0.44444, 0.05222, 0, 0.53222],\n \"100\": [0, 0.69444, 0.10861, 0, 0.59111],\n \"101\": [0, 0.44444, 0.085, 0, 0.53222],\n \"102\": [0.19444, 0.69444, 0.21778, 0, 0.4],\n \"103\": [0.19444, 0.44444, 0.105, 0, 0.53222],\n \"104\": [0, 0.69444, 0.09426, 0, 0.59111],\n \"105\": [0, 0.69326, 0.11387, 0, 0.35555],\n \"106\": [0.19444, 0.69326, 0.1672, 0, 0.35555],\n \"107\": [0, 0.69444, 0.11111, 0, 0.53222],\n \"108\": [0, 0.69444, 0.10861, 0, 0.29666],\n \"109\": [0, 0.44444, 0.09426, 0, 0.94444],\n \"110\": [0, 0.44444, 0.09426, 0, 0.64999],\n \"111\": [0, 0.44444, 0.07861, 0, 0.59111],\n \"112\": [0.19444, 0.44444, 0.07861, 0, 0.59111],\n \"113\": [0.19444, 0.44444, 0.105, 0, 0.53222],\n \"114\": [0, 0.44444, 0.11111, 0, 0.50167],\n \"115\": [0, 0.44444, 0.08167, 0, 0.48694],\n \"116\": [0, 0.63492, 0.09639, 0, 0.385],\n \"117\": [0, 0.44444, 0.09426, 0, 0.62055],\n \"118\": [0, 0.44444, 0.11111, 0, 0.53222],\n \"119\": [0, 0.44444, 0.11111, 0, 0.76777],\n \"120\": [0, 0.44444, 0.12583, 0, 0.56055],\n \"121\": [0.19444, 0.44444, 0.105, 0, 0.56166],\n \"122\": [0, 0.44444, 0.13889, 0, 0.49055],\n \"126\": [0.35, 0.34444, 0.11472, 0, 0.59111],\n \"160\": [0, 0, 0, 0, 0.25],\n \"168\": [0, 0.69444, 0.11473, 0, 0.59111],\n \"176\": [0, 0.69444, 0, 0, 0.94888],\n \"184\": [0.17014, 0, 0, 0, 0.53222],\n \"198\": [0, 0.68611, 0.11431, 0, 1.02277],\n \"216\": [0.04861, 0.73472, 0.09062, 0, 0.88555],\n \"223\": [0.19444, 0.69444, 0.09736, 0, 0.665],\n \"230\": [0, 0.44444, 0.085, 0, 0.82666],\n \"248\": [0.09722, 0.54167, 0.09458, 0, 0.59111],\n \"305\": [0, 0.44444, 0.09426, 0, 0.35555],\n \"338\": [0, 0.68611, 0.11431, 0, 1.14054],\n \"339\": [0, 0.44444, 0.085, 0, 0.82666],\n \"567\": [0.19444, 0.44444, 0.04611, 0, 0.385],\n \"710\": [0, 0.69444, 0.06709, 0, 0.59111],\n \"711\": [0, 0.63194, 0.08271, 0, 0.59111],\n \"713\": [0, 0.59444, 0.10444, 0, 0.59111],\n \"714\": [0, 0.69444, 0.08528, 0, 0.59111],\n \"715\": [0, 0.69444, 0, 0, 0.59111],\n \"728\": [0, 0.69444, 0.10333, 0, 0.59111],\n \"729\": [0, 0.69444, 0.12945, 0, 0.35555],\n \"730\": [0, 0.69444, 0, 0, 0.94888],\n \"732\": [0, 0.69444, 0.11472, 0, 0.59111],\n \"733\": [0, 0.69444, 0.11472, 0, 0.59111],\n \"915\": [0, 0.68611, 0.12903, 0, 0.69777],\n \"916\": [0, 0.68611, 0, 0, 0.94444],\n \"920\": [0, 0.68611, 0.09062, 0, 0.88555],\n \"923\": [0, 0.68611, 0, 0, 0.80666],\n \"926\": [0, 0.68611, 0.15092, 0, 0.76777],\n \"928\": [0, 0.68611, 0.17208, 0, 0.8961],\n \"931\": [0, 0.68611, 0.11431, 0, 0.82666],\n \"933\": [0, 0.68611, 0.10778, 0, 0.88555],\n \"934\": [0, 0.68611, 0.05632, 0, 0.82666],\n \"936\": [0, 0.68611, 0.10778, 0, 0.88555],\n \"937\": [0, 0.68611, 0.0992, 0, 0.82666],\n \"8211\": [0, 0.44444, 0.09811, 0, 0.59111],\n \"8212\": [0, 0.44444, 0.09811, 0, 1.18221],\n \"8216\": [0, 0.69444, 0.12945, 0, 0.35555],\n \"8217\": [0, 0.69444, 0.12945, 0, 0.35555],\n \"8220\": [0, 0.69444, 0.16772, 0, 0.62055],\n \"8221\": [0, 0.69444, 0.07939, 0, 0.62055]\n },\n \"Main-Italic\": {\n \"32\": [0, 0, 0, 0, 0.25],\n \"33\": [0, 0.69444, 0.12417, 0, 0.30667],\n \"34\": [0, 0.69444, 0.06961, 0, 0.51444],\n \"35\": [0.19444, 0.69444, 0.06616, 0, 0.81777],\n \"37\": [0.05556, 0.75, 0.13639, 0, 0.81777],\n \"38\": [0, 0.69444, 0.09694, 0, 0.76666],\n \"39\": [0, 0.69444, 0.12417, 0, 0.30667],\n \"40\": [0.25, 0.75, 0.16194, 0, 0.40889],\n \"41\": [0.25, 0.75, 0.03694, 0, 0.40889],\n \"42\": [0, 0.75, 0.14917, 0, 0.51111],\n \"43\": [0.05667, 0.56167, 0.03694, 0, 0.76666],\n \"44\": [0.19444, 0.10556, 0, 0, 0.30667],\n \"45\": [0, 0.43056, 0.02826, 0, 0.35778],\n \"46\": [0, 0.10556, 0, 0, 0.30667],\n \"47\": [0.25, 0.75, 0.16194, 0, 0.51111],\n \"48\": [0, 0.64444, 0.13556, 0, 0.51111],\n \"49\": [0, 0.64444, 0.13556, 0, 0.51111],\n \"50\": [0, 0.64444, 0.13556, 0, 0.51111],\n \"51\": [0, 0.64444, 0.13556, 0, 0.51111],\n \"52\": [0.19444, 0.64444, 0.13556, 0, 0.51111],\n \"53\": [0, 0.64444, 0.13556, 0, 0.51111],\n \"54\": [0, 0.64444, 0.13556, 0, 0.51111],\n \"55\": [0.19444, 0.64444, 0.13556, 0, 0.51111],\n \"56\": [0, 0.64444, 0.13556, 0, 0.51111],\n \"57\": [0, 0.64444, 0.13556, 0, 0.51111],\n \"58\": [0, 0.43056, 0.0582, 0, 0.30667],\n \"59\": [0.19444, 0.43056, 0.0582, 0, 0.30667],\n \"61\": [-0.13313, 0.36687, 0.06616, 0, 0.76666],\n \"63\": [0, 0.69444, 0.1225, 0, 0.51111],\n \"64\": [0, 0.69444, 0.09597, 0, 0.76666],\n \"65\": [0, 0.68333, 0, 0, 0.74333],\n \"66\": [0, 0.68333, 0.10257, 0, 0.70389],\n \"67\": [0, 0.68333, 0.14528, 0, 0.71555],\n \"68\": [0, 0.68333, 0.09403, 0, 0.755],\n \"69\": [0, 0.68333, 0.12028, 0, 0.67833],\n \"70\": [0, 0.68333, 0.13305, 0, 0.65277],\n \"71\": [0, 0.68333, 0.08722, 0, 0.77361],\n \"72\": [0, 0.68333, 0.16389, 0, 0.74333],\n \"73\": [0, 0.68333, 0.15806, 0, 0.38555],\n \"74\": [0, 0.68333, 0.14028, 0, 0.525],\n \"75\": [0, 0.68333, 0.14528, 0, 0.76888],\n \"76\": [0, 0.68333, 0, 0, 0.62722],\n \"77\": [0, 0.68333, 0.16389, 0, 0.89666],\n \"78\": [0, 0.68333, 0.16389, 0, 0.74333],\n \"79\": [0, 0.68333, 0.09403, 0, 0.76666],\n \"80\": [0, 0.68333, 0.10257, 0, 0.67833],\n \"81\": [0.19444, 0.68333, 0.09403, 0, 0.76666],\n \"82\": [0, 0.68333, 0.03868, 0, 0.72944],\n \"83\": [0, 0.68333, 0.11972, 0, 0.56222],\n \"84\": [0, 0.68333, 0.13305, 0, 0.71555],\n \"85\": [0, 0.68333, 0.16389, 0, 0.74333],\n \"86\": [0, 0.68333, 0.18361, 0, 0.74333],\n \"87\": [0, 0.68333, 0.18361, 0, 0.99888],\n \"88\": [0, 0.68333, 0.15806, 0, 0.74333],\n \"89\": [0, 0.68333, 0.19383, 0, 0.74333],\n \"90\": [0, 0.68333, 0.14528, 0, 0.61333],\n \"91\": [0.25, 0.75, 0.1875, 0, 0.30667],\n \"93\": [0.25, 0.75, 0.10528, 0, 0.30667],\n \"94\": [0, 0.69444, 0.06646, 0, 0.51111],\n \"95\": [0.31, 0.12056, 0.09208, 0, 0.51111],\n \"97\": [0, 0.43056, 0.07671, 0, 0.51111],\n \"98\": [0, 0.69444, 0.06312, 0, 0.46],\n \"99\": [0, 0.43056, 0.05653, 0, 0.46],\n \"100\": [0, 0.69444, 0.10333, 0, 0.51111],\n \"101\": [0, 0.43056, 0.07514, 0, 0.46],\n \"102\": [0.19444, 0.69444, 0.21194, 0, 0.30667],\n \"103\": [0.19444, 0.43056, 0.08847, 0, 0.46],\n \"104\": [0, 0.69444, 0.07671, 0, 0.51111],\n \"105\": [0, 0.65536, 0.1019, 0, 0.30667],\n \"106\": [0.19444, 0.65536, 0.14467, 0, 0.30667],\n \"107\": [0, 0.69444, 0.10764, 0, 0.46],\n \"108\": [0, 0.69444, 0.10333, 0, 0.25555],\n \"109\": [0, 0.43056, 0.07671, 0, 0.81777],\n \"110\": [0, 0.43056, 0.07671, 0, 0.56222],\n \"111\": [0, 0.43056, 0.06312, 0, 0.51111],\n \"112\": [0.19444, 0.43056, 0.06312, 0, 0.51111],\n \"113\": [0.19444, 0.43056, 0.08847, 0, 0.46],\n \"114\": [0, 0.43056, 0.10764, 0, 0.42166],\n \"115\": [0, 0.43056, 0.08208, 0, 0.40889],\n \"116\": [0, 0.61508, 0.09486, 0, 0.33222],\n \"117\": [0, 0.43056, 0.07671, 0, 0.53666],\n \"118\": [0, 0.43056, 0.10764, 0, 0.46],\n \"119\": [0, 0.43056, 0.10764, 0, 0.66444],\n \"120\": [0, 0.43056, 0.12042, 0, 0.46389],\n \"121\": [0.19444, 0.43056, 0.08847, 0, 0.48555],\n \"122\": [0, 0.43056, 0.12292, 0, 0.40889],\n \"126\": [0.35, 0.31786, 0.11585, 0, 0.51111],\n \"160\": [0, 0, 0, 0, 0.25],\n \"168\": [0, 0.66786, 0.10474, 0, 0.51111],\n \"176\": [0, 0.69444, 0, 0, 0.83129],\n \"184\": [0.17014, 0, 0, 0, 0.46],\n \"198\": [0, 0.68333, 0.12028, 0, 0.88277],\n \"216\": [0.04861, 0.73194, 0.09403, 0, 0.76666],\n \"223\": [0.19444, 0.69444, 0.10514, 0, 0.53666],\n \"230\": [0, 0.43056, 0.07514, 0, 0.71555],\n \"248\": [0.09722, 0.52778, 0.09194, 0, 0.51111],\n \"338\": [0, 0.68333, 0.12028, 0, 0.98499],\n \"339\": [0, 0.43056, 0.07514, 0, 0.71555],\n \"710\": [0, 0.69444, 0.06646, 0, 0.51111],\n \"711\": [0, 0.62847, 0.08295, 0, 0.51111],\n \"713\": [0, 0.56167, 0.10333, 0, 0.51111],\n \"714\": [0, 0.69444, 0.09694, 0, 0.51111],\n \"715\": [0, 0.69444, 0, 0, 0.51111],\n \"728\": [0, 0.69444, 0.10806, 0, 0.51111],\n \"729\": [0, 0.66786, 0.11752, 0, 0.30667],\n \"730\": [0, 0.69444, 0, 0, 0.83129],\n \"732\": [0, 0.66786, 0.11585, 0, 0.51111],\n \"733\": [0, 0.69444, 0.1225, 0, 0.51111],\n \"915\": [0, 0.68333, 0.13305, 0, 0.62722],\n \"916\": [0, 0.68333, 0, 0, 0.81777],\n \"920\": [0, 0.68333, 0.09403, 0, 0.76666],\n \"923\": [0, 0.68333, 0, 0, 0.69222],\n \"926\": [0, 0.68333, 0.15294, 0, 0.66444],\n \"928\": [0, 0.68333, 0.16389, 0, 0.74333],\n \"931\": [0, 0.68333, 0.12028, 0, 0.71555],\n \"933\": [0, 0.68333, 0.11111, 0, 0.76666],\n \"934\": [0, 0.68333, 0.05986, 0, 0.71555],\n \"936\": [0, 0.68333, 0.11111, 0, 0.76666],\n \"937\": [0, 0.68333, 0.10257, 0, 0.71555],\n \"8211\": [0, 0.43056, 0.09208, 0, 0.51111],\n \"8212\": [0, 0.43056, 0.09208, 0, 1.02222],\n \"8216\": [0, 0.69444, 0.12417, 0, 0.30667],\n \"8217\": [0, 0.69444, 0.12417, 0, 0.30667],\n \"8220\": [0, 0.69444, 0.1685, 0, 0.51444],\n \"8221\": [0, 0.69444, 0.06961, 0, 0.51444],\n \"8463\": [0, 0.68889, 0, 0, 0.54028]\n },\n \"Main-Regular\": {\n \"32\": [0, 0, 0, 0, 0.25],\n \"33\": [0, 0.69444, 0, 0, 0.27778],\n \"34\": [0, 0.69444, 0, 0, 0.5],\n \"35\": [0.19444, 0.69444, 0, 0, 0.83334],\n \"36\": [0.05556, 0.75, 0, 0, 0.5],\n \"37\": [0.05556, 0.75, 0, 0, 0.83334],\n \"38\": [0, 0.69444, 0, 0, 0.77778],\n \"39\": [0, 0.69444, 0, 0, 0.27778],\n \"40\": [0.25, 0.75, 0, 0, 0.38889],\n \"41\": [0.25, 0.75, 0, 0, 0.38889],\n \"42\": [0, 0.75, 0, 0, 0.5],\n \"43\": [0.08333, 0.58333, 0, 0, 0.77778],\n \"44\": [0.19444, 0.10556, 0, 0, 0.27778],\n \"45\": [0, 0.43056, 0, 0, 0.33333],\n \"46\": [0, 0.10556, 0, 0, 0.27778],\n \"47\": [0.25, 0.75, 0, 0, 0.5],\n \"48\": [0, 0.64444, 0, 0, 0.5],\n \"49\": [0, 0.64444, 0, 0, 0.5],\n \"50\": [0, 0.64444, 0, 0, 0.5],\n \"51\": [0, 0.64444, 0, 0, 0.5],\n \"52\": [0, 0.64444, 0, 0, 0.5],\n \"53\": [0, 0.64444, 0, 0, 0.5],\n \"54\": [0, 0.64444, 0, 0, 0.5],\n \"55\": [0, 0.64444, 0, 0, 0.5],\n \"56\": [0, 0.64444, 0, 0, 0.5],\n \"57\": [0, 0.64444, 0, 0, 0.5],\n \"58\": [0, 0.43056, 0, 0, 0.27778],\n \"59\": [0.19444, 0.43056, 0, 0, 0.27778],\n \"60\": [0.0391, 0.5391, 0, 0, 0.77778],\n \"61\": [-0.13313, 0.36687, 0, 0, 0.77778],\n \"62\": [0.0391, 0.5391, 0, 0, 0.77778],\n \"63\": [0, 0.69444, 0, 0, 0.47222],\n \"64\": [0, 0.69444, 0, 0, 0.77778],\n \"65\": [0, 0.68333, 0, 0, 0.75],\n \"66\": [0, 0.68333, 0, 0, 0.70834],\n \"67\": [0, 0.68333, 0, 0, 0.72222],\n \"68\": [0, 0.68333, 0, 0, 0.76389],\n \"69\": [0, 0.68333, 0, 0, 0.68056],\n \"70\": [0, 0.68333, 0, 0, 0.65278],\n \"71\": [0, 0.68333, 0, 0, 0.78472],\n \"72\": [0, 0.68333, 0, 0, 0.75],\n \"73\": [0, 0.68333, 0, 0, 0.36111],\n \"74\": [0, 0.68333, 0, 0, 0.51389],\n \"75\": [0, 0.68333, 0, 0, 0.77778],\n \"76\": [0, 0.68333, 0, 0, 0.625],\n \"77\": [0, 0.68333, 0, 0, 0.91667],\n \"78\": [0, 0.68333, 0, 0, 0.75],\n \"79\": [0, 0.68333, 0, 0, 0.77778],\n \"80\": [0, 0.68333, 0, 0, 0.68056],\n \"81\": [0.19444, 0.68333, 0, 0, 0.77778],\n \"82\": [0, 0.68333, 0, 0, 0.73611],\n \"83\": [0, 0.68333, 0, 0, 0.55556],\n \"84\": [0, 0.68333, 0, 0, 0.72222],\n \"85\": [0, 0.68333, 0, 0, 0.75],\n \"86\": [0, 0.68333, 0.01389, 0, 0.75],\n \"87\": [0, 0.68333, 0.01389, 0, 1.02778],\n \"88\": [0, 0.68333, 0, 0, 0.75],\n \"89\": [0, 0.68333, 0.025, 0, 0.75],\n \"90\": [0, 0.68333, 0, 0, 0.61111],\n \"91\": [0.25, 0.75, 0, 0, 0.27778],\n \"92\": [0.25, 0.75, 0, 0, 0.5],\n \"93\": [0.25, 0.75, 0, 0, 0.27778],\n \"94\": [0, 0.69444, 0, 0, 0.5],\n \"95\": [0.31, 0.12056, 0.02778, 0, 0.5],\n \"97\": [0, 0.43056, 0, 0, 0.5],\n \"98\": [0, 0.69444, 0, 0, 0.55556],\n \"99\": [0, 0.43056, 0, 0, 0.44445],\n \"100\": [0, 0.69444, 0, 0, 0.55556],\n \"101\": [0, 0.43056, 0, 0, 0.44445],\n \"102\": [0, 0.69444, 0.07778, 0, 0.30556],\n \"103\": [0.19444, 0.43056, 0.01389, 0, 0.5],\n \"104\": [0, 0.69444, 0, 0, 0.55556],\n \"105\": [0, 0.66786, 0, 0, 0.27778],\n \"106\": [0.19444, 0.66786, 0, 0, 0.30556],\n \"107\": [0, 0.69444, 0, 0, 0.52778],\n \"108\": [0, 0.69444, 0, 0, 0.27778],\n \"109\": [0, 0.43056, 0, 0, 0.83334],\n \"110\": [0, 0.43056, 0, 0, 0.55556],\n \"111\": [0, 0.43056, 0, 0, 0.5],\n \"112\": [0.19444, 0.43056, 0, 0, 0.55556],\n \"113\": [0.19444, 0.43056, 0, 0, 0.52778],\n \"114\": [0, 0.43056, 0, 0, 0.39167],\n \"115\": [0, 0.43056, 0, 0, 0.39445],\n \"116\": [0, 0.61508, 0, 0, 0.38889],\n \"117\": [0, 0.43056, 0, 0, 0.55556],\n \"118\": [0, 0.43056, 0.01389, 0, 0.52778],\n \"119\": [0, 0.43056, 0.01389, 0, 0.72222],\n \"120\": [0, 0.43056, 0, 0, 0.52778],\n \"121\": [0.19444, 0.43056, 0.01389, 0, 0.52778],\n \"122\": [0, 0.43056, 0, 0, 0.44445],\n \"123\": [0.25, 0.75, 0, 0, 0.5],\n \"124\": [0.25, 0.75, 0, 0, 0.27778],\n \"125\": [0.25, 0.75, 0, 0, 0.5],\n \"126\": [0.35, 0.31786, 0, 0, 0.5],\n \"160\": [0, 0, 0, 0, 0.25],\n \"163\": [0, 0.69444, 0, 0, 0.76909],\n \"167\": [0.19444, 0.69444, 0, 0, 0.44445],\n \"168\": [0, 0.66786, 0, 0, 0.5],\n \"172\": [0, 0.43056, 0, 0, 0.66667],\n \"176\": [0, 0.69444, 0, 0, 0.75],\n \"177\": [0.08333, 0.58333, 0, 0, 0.77778],\n \"182\": [0.19444, 0.69444, 0, 0, 0.61111],\n \"184\": [0.17014, 0, 0, 0, 0.44445],\n \"198\": [0, 0.68333, 0, 0, 0.90278],\n \"215\": [0.08333, 0.58333, 0, 0, 0.77778],\n \"216\": [0.04861, 0.73194, 0, 0, 0.77778],\n \"223\": [0, 0.69444, 0, 0, 0.5],\n \"230\": [0, 0.43056, 0, 0, 0.72222],\n \"247\": [0.08333, 0.58333, 0, 0, 0.77778],\n \"248\": [0.09722, 0.52778, 0, 0, 0.5],\n \"305\": [0, 0.43056, 0, 0, 0.27778],\n \"338\": [0, 0.68333, 0, 0, 1.01389],\n \"339\": [0, 0.43056, 0, 0, 0.77778],\n \"567\": [0.19444, 0.43056, 0, 0, 0.30556],\n \"710\": [0, 0.69444, 0, 0, 0.5],\n \"711\": [0, 0.62847, 0, 0, 0.5],\n \"713\": [0, 0.56778, 0, 0, 0.5],\n \"714\": [0, 0.69444, 0, 0, 0.5],\n \"715\": [0, 0.69444, 0, 0, 0.5],\n \"728\": [0, 0.69444, 0, 0, 0.5],\n \"729\": [0, 0.66786, 0, 0, 0.27778],\n \"730\": [0, 0.69444, 0, 0, 0.75],\n \"732\": [0, 0.66786, 0, 0, 0.5],\n \"733\": [0, 0.69444, 0, 0, 0.5],\n \"915\": [0, 0.68333, 0, 0, 0.625],\n \"916\": [0, 0.68333, 0, 0, 0.83334],\n \"920\": [0, 0.68333, 0, 0, 0.77778],\n \"923\": [0, 0.68333, 0, 0, 0.69445],\n \"926\": [0, 0.68333, 0, 0, 0.66667],\n \"928\": [0, 0.68333, 0, 0, 0.75],\n \"931\": [0, 0.68333, 0, 0, 0.72222],\n \"933\": [0, 0.68333, 0, 0, 0.77778],\n \"934\": [0, 0.68333, 0, 0, 0.72222],\n \"936\": [0, 0.68333, 0, 0, 0.77778],\n \"937\": [0, 0.68333, 0, 0, 0.72222],\n \"8211\": [0, 0.43056, 0.02778, 0, 0.5],\n \"8212\": [0, 0.43056, 0.02778, 0, 1.0],\n \"8216\": [0, 0.69444, 0, 0, 0.27778],\n \"8217\": [0, 0.69444, 0, 0, 0.27778],\n \"8220\": [0, 0.69444, 0, 0, 0.5],\n \"8221\": [0, 0.69444, 0, 0, 0.5],\n \"8224\": [0.19444, 0.69444, 0, 0, 0.44445],\n \"8225\": [0.19444, 0.69444, 0, 0, 0.44445],\n \"8230\": [0, 0.123, 0, 0, 1.172],\n \"8242\": [0, 0.55556, 0, 0, 0.275],\n \"8407\": [0, 0.71444, 0.15382, 0, 0.5],\n \"8463\": [0, 0.68889, 0, 0, 0.54028],\n \"8465\": [0, 0.69444, 0, 0, 0.72222],\n \"8467\": [0, 0.69444, 0, 0.11111, 0.41667],\n \"8472\": [0.19444, 0.43056, 0, 0.11111, 0.63646],\n \"8476\": [0, 0.69444, 0, 0, 0.72222],\n \"8501\": [0, 0.69444, 0, 0, 0.61111],\n \"8592\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8593\": [0.19444, 0.69444, 0, 0, 0.5],\n \"8594\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8595\": [0.19444, 0.69444, 0, 0, 0.5],\n \"8596\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8597\": [0.25, 0.75, 0, 0, 0.5],\n \"8598\": [0.19444, 0.69444, 0, 0, 1.0],\n \"8599\": [0.19444, 0.69444, 0, 0, 1.0],\n \"8600\": [0.19444, 0.69444, 0, 0, 1.0],\n \"8601\": [0.19444, 0.69444, 0, 0, 1.0],\n \"8614\": [0.011, 0.511, 0, 0, 1.0],\n \"8617\": [0.011, 0.511, 0, 0, 1.126],\n \"8618\": [0.011, 0.511, 0, 0, 1.126],\n \"8636\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8637\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8640\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8641\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8652\": [0.011, 0.671, 0, 0, 1.0],\n \"8656\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8657\": [0.19444, 0.69444, 0, 0, 0.61111],\n \"8658\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8659\": [0.19444, 0.69444, 0, 0, 0.61111],\n \"8660\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8661\": [0.25, 0.75, 0, 0, 0.61111],\n \"8704\": [0, 0.69444, 0, 0, 0.55556],\n \"8706\": [0, 0.69444, 0.05556, 0.08334, 0.5309],\n \"8707\": [0, 0.69444, 0, 0, 0.55556],\n \"8709\": [0.05556, 0.75, 0, 0, 0.5],\n \"8711\": [0, 0.68333, 0, 0, 0.83334],\n \"8712\": [0.0391, 0.5391, 0, 0, 0.66667],\n \"8715\": [0.0391, 0.5391, 0, 0, 0.66667],\n \"8722\": [0.08333, 0.58333, 0, 0, 0.77778],\n \"8723\": [0.08333, 0.58333, 0, 0, 0.77778],\n \"8725\": [0.25, 0.75, 0, 0, 0.5],\n \"8726\": [0.25, 0.75, 0, 0, 0.5],\n \"8727\": [-0.03472, 0.46528, 0, 0, 0.5],\n \"8728\": [-0.05555, 0.44445, 0, 0, 0.5],\n \"8729\": [-0.05555, 0.44445, 0, 0, 0.5],\n \"8730\": [0.2, 0.8, 0, 0, 0.83334],\n \"8733\": [0, 0.43056, 0, 0, 0.77778],\n \"8734\": [0, 0.43056, 0, 0, 1.0],\n \"8736\": [0, 0.69224, 0, 0, 0.72222],\n \"8739\": [0.25, 0.75, 0, 0, 0.27778],\n \"8741\": [0.25, 0.75, 0, 0, 0.5],\n \"8743\": [0, 0.55556, 0, 0, 0.66667],\n \"8744\": [0, 0.55556, 0, 0, 0.66667],\n \"8745\": [0, 0.55556, 0, 0, 0.66667],\n \"8746\": [0, 0.55556, 0, 0, 0.66667],\n \"8747\": [0.19444, 0.69444, 0.11111, 0, 0.41667],\n \"8764\": [-0.13313, 0.36687, 0, 0, 0.77778],\n \"8768\": [0.19444, 0.69444, 0, 0, 0.27778],\n \"8771\": [-0.03625, 0.46375, 0, 0, 0.77778],\n \"8773\": [-0.022, 0.589, 0, 0, 0.778],\n \"8776\": [-0.01688, 0.48312, 0, 0, 0.77778],\n \"8781\": [-0.03625, 0.46375, 0, 0, 0.77778],\n \"8784\": [-0.133, 0.673, 0, 0, 0.778],\n \"8801\": [-0.03625, 0.46375, 0, 0, 0.77778],\n \"8804\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"8805\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"8810\": [0.0391, 0.5391, 0, 0, 1.0],\n \"8811\": [0.0391, 0.5391, 0, 0, 1.0],\n \"8826\": [0.0391, 0.5391, 0, 0, 0.77778],\n \"8827\": [0.0391, 0.5391, 0, 0, 0.77778],\n \"8834\": [0.0391, 0.5391, 0, 0, 0.77778],\n \"8835\": [0.0391, 0.5391, 0, 0, 0.77778],\n \"8838\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"8839\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"8846\": [0, 0.55556, 0, 0, 0.66667],\n \"8849\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"8850\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"8851\": [0, 0.55556, 0, 0, 0.66667],\n \"8852\": [0, 0.55556, 0, 0, 0.66667],\n \"8853\": [0.08333, 0.58333, 0, 0, 0.77778],\n \"8854\": [0.08333, 0.58333, 0, 0, 0.77778],\n \"8855\": [0.08333, 0.58333, 0, 0, 0.77778],\n \"8856\": [0.08333, 0.58333, 0, 0, 0.77778],\n \"8857\": [0.08333, 0.58333, 0, 0, 0.77778],\n \"8866\": [0, 0.69444, 0, 0, 0.61111],\n \"8867\": [0, 0.69444, 0, 0, 0.61111],\n \"8868\": [0, 0.69444, 0, 0, 0.77778],\n \"8869\": [0, 0.69444, 0, 0, 0.77778],\n \"8872\": [0.249, 0.75, 0, 0, 0.867],\n \"8900\": [-0.05555, 0.44445, 0, 0, 0.5],\n \"8901\": [-0.05555, 0.44445, 0, 0, 0.27778],\n \"8902\": [-0.03472, 0.46528, 0, 0, 0.5],\n \"8904\": [0.005, 0.505, 0, 0, 0.9],\n \"8942\": [0.03, 0.903, 0, 0, 0.278],\n \"8943\": [-0.19, 0.313, 0, 0, 1.172],\n \"8945\": [-0.1, 0.823, 0, 0, 1.282],\n \"8968\": [0.25, 0.75, 0, 0, 0.44445],\n \"8969\": [0.25, 0.75, 0, 0, 0.44445],\n \"8970\": [0.25, 0.75, 0, 0, 0.44445],\n \"8971\": [0.25, 0.75, 0, 0, 0.44445],\n \"8994\": [-0.14236, 0.35764, 0, 0, 1.0],\n \"8995\": [-0.14236, 0.35764, 0, 0, 1.0],\n \"9136\": [0.244, 0.744, 0, 0, 0.412],\n \"9137\": [0.244, 0.745, 0, 0, 0.412],\n \"9651\": [0.19444, 0.69444, 0, 0, 0.88889],\n \"9657\": [-0.03472, 0.46528, 0, 0, 0.5],\n \"9661\": [0.19444, 0.69444, 0, 0, 0.88889],\n \"9667\": [-0.03472, 0.46528, 0, 0, 0.5],\n \"9711\": [0.19444, 0.69444, 0, 0, 1.0],\n \"9824\": [0.12963, 0.69444, 0, 0, 0.77778],\n \"9825\": [0.12963, 0.69444, 0, 0, 0.77778],\n \"9826\": [0.12963, 0.69444, 0, 0, 0.77778],\n \"9827\": [0.12963, 0.69444, 0, 0, 0.77778],\n \"9837\": [0, 0.75, 0, 0, 0.38889],\n \"9838\": [0.19444, 0.69444, 0, 0, 0.38889],\n \"9839\": [0.19444, 0.69444, 0, 0, 0.38889],\n \"10216\": [0.25, 0.75, 0, 0, 0.38889],\n \"10217\": [0.25, 0.75, 0, 0, 0.38889],\n \"10222\": [0.244, 0.744, 0, 0, 0.412],\n \"10223\": [0.244, 0.745, 0, 0, 0.412],\n \"10229\": [0.011, 0.511, 0, 0, 1.609],\n \"10230\": [0.011, 0.511, 0, 0, 1.638],\n \"10231\": [0.011, 0.511, 0, 0, 1.859],\n \"10232\": [0.024, 0.525, 0, 0, 1.609],\n \"10233\": [0.024, 0.525, 0, 0, 1.638],\n \"10234\": [0.024, 0.525, 0, 0, 1.858],\n \"10236\": [0.011, 0.511, 0, 0, 1.638],\n \"10815\": [0, 0.68333, 0, 0, 0.75],\n \"10927\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"10928\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"57376\": [0.19444, 0.69444, 0, 0, 0]\n },\n \"Math-BoldItalic\": {\n \"32\": [0, 0, 0, 0, 0.25],\n \"48\": [0, 0.44444, 0, 0, 0.575],\n \"49\": [0, 0.44444, 0, 0, 0.575],\n \"50\": [0, 0.44444, 0, 0, 0.575],\n \"51\": [0.19444, 0.44444, 0, 0, 0.575],\n \"52\": [0.19444, 0.44444, 0, 0, 0.575],\n \"53\": [0.19444, 0.44444, 0, 0, 0.575],\n \"54\": [0, 0.64444, 0, 0, 0.575],\n \"55\": [0.19444, 0.44444, 0, 0, 0.575],\n \"56\": [0, 0.64444, 0, 0, 0.575],\n \"57\": [0.19444, 0.44444, 0, 0, 0.575],\n \"65\": [0, 0.68611, 0, 0, 0.86944],\n \"66\": [0, 0.68611, 0.04835, 0, 0.8664],\n \"67\": [0, 0.68611, 0.06979, 0, 0.81694],\n \"68\": [0, 0.68611, 0.03194, 0, 0.93812],\n \"69\": [0, 0.68611, 0.05451, 0, 0.81007],\n \"70\": [0, 0.68611, 0.15972, 0, 0.68889],\n \"71\": [0, 0.68611, 0, 0, 0.88673],\n \"72\": [0, 0.68611, 0.08229, 0, 0.98229],\n \"73\": [0, 0.68611, 0.07778, 0, 0.51111],\n \"74\": [0, 0.68611, 0.10069, 0, 0.63125],\n \"75\": [0, 0.68611, 0.06979, 0, 0.97118],\n \"76\": [0, 0.68611, 0, 0, 0.75555],\n \"77\": [0, 0.68611, 0.11424, 0, 1.14201],\n \"78\": [0, 0.68611, 0.11424, 0, 0.95034],\n \"79\": [0, 0.68611, 0.03194, 0, 0.83666],\n \"80\": [0, 0.68611, 0.15972, 0, 0.72309],\n \"81\": [0.19444, 0.68611, 0, 0, 0.86861],\n \"82\": [0, 0.68611, 0.00421, 0, 0.87235],\n \"83\": [0, 0.68611, 0.05382, 0, 0.69271],\n \"84\": [0, 0.68611, 0.15972, 0, 0.63663],\n \"85\": [0, 0.68611, 0.11424, 0, 0.80027],\n \"86\": [0, 0.68611, 0.25555, 0, 0.67778],\n \"87\": [0, 0.68611, 0.15972, 0, 1.09305],\n \"88\": [0, 0.68611, 0.07778, 0, 0.94722],\n \"89\": [0, 0.68611, 0.25555, 0, 0.67458],\n \"90\": [0, 0.68611, 0.06979, 0, 0.77257],\n \"97\": [0, 0.44444, 0, 0, 0.63287],\n \"98\": [0, 0.69444, 0, 0, 0.52083],\n \"99\": [0, 0.44444, 0, 0, 0.51342],\n \"100\": [0, 0.69444, 0, 0, 0.60972],\n \"101\": [0, 0.44444, 0, 0, 0.55361],\n \"102\": [0.19444, 0.69444, 0.11042, 0, 0.56806],\n \"103\": [0.19444, 0.44444, 0.03704, 0, 0.5449],\n \"104\": [0, 0.69444, 0, 0, 0.66759],\n \"105\": [0, 0.69326, 0, 0, 0.4048],\n \"106\": [0.19444, 0.69326, 0.0622, 0, 0.47083],\n \"107\": [0, 0.69444, 0.01852, 0, 0.6037],\n \"108\": [0, 0.69444, 0.0088, 0, 0.34815],\n \"109\": [0, 0.44444, 0, 0, 1.0324],\n \"110\": [0, 0.44444, 0, 0, 0.71296],\n \"111\": [0, 0.44444, 0, 0, 0.58472],\n \"112\": [0.19444, 0.44444, 0, 0, 0.60092],\n \"113\": [0.19444, 0.44444, 0.03704, 0, 0.54213],\n \"114\": [0, 0.44444, 0.03194, 0, 0.5287],\n \"115\": [0, 0.44444, 0, 0, 0.53125],\n \"116\": [0, 0.63492, 0, 0, 0.41528],\n \"117\": [0, 0.44444, 0, 0, 0.68102],\n \"118\": [0, 0.44444, 0.03704, 0, 0.56666],\n \"119\": [0, 0.44444, 0.02778, 0, 0.83148],\n \"120\": [0, 0.44444, 0, 0, 0.65903],\n \"121\": [0.19444, 0.44444, 0.03704, 0, 0.59028],\n \"122\": [0, 0.44444, 0.04213, 0, 0.55509],\n \"160\": [0, 0, 0, 0, 0.25],\n \"915\": [0, 0.68611, 0.15972, 0, 0.65694],\n \"916\": [0, 0.68611, 0, 0, 0.95833],\n \"920\": [0, 0.68611, 0.03194, 0, 0.86722],\n \"923\": [0, 0.68611, 0, 0, 0.80555],\n \"926\": [0, 0.68611, 0.07458, 0, 0.84125],\n \"928\": [0, 0.68611, 0.08229, 0, 0.98229],\n \"931\": [0, 0.68611, 0.05451, 0, 0.88507],\n \"933\": [0, 0.68611, 0.15972, 0, 0.67083],\n \"934\": [0, 0.68611, 0, 0, 0.76666],\n \"936\": [0, 0.68611, 0.11653, 0, 0.71402],\n \"937\": [0, 0.68611, 0.04835, 0, 0.8789],\n \"945\": [0, 0.44444, 0, 0, 0.76064],\n \"946\": [0.19444, 0.69444, 0.03403, 0, 0.65972],\n \"947\": [0.19444, 0.44444, 0.06389, 0, 0.59003],\n \"948\": [0, 0.69444, 0.03819, 0, 0.52222],\n \"949\": [0, 0.44444, 0, 0, 0.52882],\n \"950\": [0.19444, 0.69444, 0.06215, 0, 0.50833],\n \"951\": [0.19444, 0.44444, 0.03704, 0, 0.6],\n \"952\": [0, 0.69444, 0.03194, 0, 0.5618],\n \"953\": [0, 0.44444, 0, 0, 0.41204],\n \"954\": [0, 0.44444, 0, 0, 0.66759],\n \"955\": [0, 0.69444, 0, 0, 0.67083],\n \"956\": [0.19444, 0.44444, 0, 0, 0.70787],\n \"957\": [0, 0.44444, 0.06898, 0, 0.57685],\n \"958\": [0.19444, 0.69444, 0.03021, 0, 0.50833],\n \"959\": [0, 0.44444, 0, 0, 0.58472],\n \"960\": [0, 0.44444, 0.03704, 0, 0.68241],\n \"961\": [0.19444, 0.44444, 0, 0, 0.6118],\n \"962\": [0.09722, 0.44444, 0.07917, 0, 0.42361],\n \"963\": [0, 0.44444, 0.03704, 0, 0.68588],\n \"964\": [0, 0.44444, 0.13472, 0, 0.52083],\n \"965\": [0, 0.44444, 0.03704, 0, 0.63055],\n \"966\": [0.19444, 0.44444, 0, 0, 0.74722],\n \"967\": [0.19444, 0.44444, 0, 0, 0.71805],\n \"968\": [0.19444, 0.69444, 0.03704, 0, 0.75833],\n \"969\": [0, 0.44444, 0.03704, 0, 0.71782],\n \"977\": [0, 0.69444, 0, 0, 0.69155],\n \"981\": [0.19444, 0.69444, 0, 0, 0.7125],\n \"982\": [0, 0.44444, 0.03194, 0, 0.975],\n \"1009\": [0.19444, 0.44444, 0, 0, 0.6118],\n \"1013\": [0, 0.44444, 0, 0, 0.48333],\n \"57649\": [0, 0.44444, 0, 0, 0.39352],\n \"57911\": [0.19444, 0.44444, 0, 0, 0.43889]\n },\n \"Math-Italic\": {\n \"32\": [0, 0, 0, 0, 0.25],\n \"48\": [0, 0.43056, 0, 0, 0.5],\n \"49\": [0, 0.43056, 0, 0, 0.5],\n \"50\": [0, 0.43056, 0, 0, 0.5],\n \"51\": [0.19444, 0.43056, 0, 0, 0.5],\n \"52\": [0.19444, 0.43056, 0, 0, 0.5],\n \"53\": [0.19444, 0.43056, 0, 0, 0.5],\n \"54\": [0, 0.64444, 0, 0, 0.5],\n \"55\": [0.19444, 0.43056, 0, 0, 0.5],\n \"56\": [0, 0.64444, 0, 0, 0.5],\n \"57\": [0.19444, 0.43056, 0, 0, 0.5],\n \"65\": [0, 0.68333, 0, 0.13889, 0.75],\n \"66\": [0, 0.68333, 0.05017, 0.08334, 0.75851],\n \"67\": [0, 0.68333, 0.07153, 0.08334, 0.71472],\n \"68\": [0, 0.68333, 0.02778, 0.05556, 0.82792],\n \"69\": [0, 0.68333, 0.05764, 0.08334, 0.7382],\n \"70\": [0, 0.68333, 0.13889, 0.08334, 0.64306],\n \"71\": [0, 0.68333, 0, 0.08334, 0.78625],\n \"72\": [0, 0.68333, 0.08125, 0.05556, 0.83125],\n \"73\": [0, 0.68333, 0.07847, 0.11111, 0.43958],\n \"74\": [0, 0.68333, 0.09618, 0.16667, 0.55451],\n \"75\": [0, 0.68333, 0.07153, 0.05556, 0.84931],\n \"76\": [0, 0.68333, 0, 0.02778, 0.68056],\n \"77\": [0, 0.68333, 0.10903, 0.08334, 0.97014],\n \"78\": [0, 0.68333, 0.10903, 0.08334, 0.80347],\n \"79\": [0, 0.68333, 0.02778, 0.08334, 0.76278],\n \"80\": [0, 0.68333, 0.13889, 0.08334, 0.64201],\n \"81\": [0.19444, 0.68333, 0, 0.08334, 0.79056],\n \"82\": [0, 0.68333, 0.00773, 0.08334, 0.75929],\n \"83\": [0, 0.68333, 0.05764, 0.08334, 0.6132],\n \"84\": [0, 0.68333, 0.13889, 0.08334, 0.58438],\n \"85\": [0, 0.68333, 0.10903, 0.02778, 0.68278],\n \"86\": [0, 0.68333, 0.22222, 0, 0.58333],\n \"87\": [0, 0.68333, 0.13889, 0, 0.94445],\n \"88\": [0, 0.68333, 0.07847, 0.08334, 0.82847],\n \"89\": [0, 0.68333, 0.22222, 0, 0.58056],\n \"90\": [0, 0.68333, 0.07153, 0.08334, 0.68264],\n \"97\": [0, 0.43056, 0, 0, 0.52859],\n \"98\": [0, 0.69444, 0, 0, 0.42917],\n \"99\": [0, 0.43056, 0, 0.05556, 0.43276],\n \"100\": [0, 0.69444, 0, 0.16667, 0.52049],\n \"101\": [0, 0.43056, 0, 0.05556, 0.46563],\n \"102\": [0.19444, 0.69444, 0.10764, 0.16667, 0.48959],\n \"103\": [0.19444, 0.43056, 0.03588, 0.02778, 0.47697],\n \"104\": [0, 0.69444, 0, 0, 0.57616],\n \"105\": [0, 0.65952, 0, 0, 0.34451],\n \"106\": [0.19444, 0.65952, 0.05724, 0, 0.41181],\n \"107\": [0, 0.69444, 0.03148, 0, 0.5206],\n \"108\": [0, 0.69444, 0.01968, 0.08334, 0.29838],\n \"109\": [0, 0.43056, 0, 0, 0.87801],\n \"110\": [0, 0.43056, 0, 0, 0.60023],\n \"111\": [0, 0.43056, 0, 0.05556, 0.48472],\n \"112\": [0.19444, 0.43056, 0, 0.08334, 0.50313],\n \"113\": [0.19444, 0.43056, 0.03588, 0.08334, 0.44641],\n \"114\": [0, 0.43056, 0.02778, 0.05556, 0.45116],\n \"115\": [0, 0.43056, 0, 0.05556, 0.46875],\n \"116\": [0, 0.61508, 0, 0.08334, 0.36111],\n \"117\": [0, 0.43056, 0, 0.02778, 0.57246],\n \"118\": [0, 0.43056, 0.03588, 0.02778, 0.48472],\n \"119\": [0, 0.43056, 0.02691, 0.08334, 0.71592],\n \"120\": [0, 0.43056, 0, 0.02778, 0.57153],\n \"121\": [0.19444, 0.43056, 0.03588, 0.05556, 0.49028],\n \"122\": [0, 0.43056, 0.04398, 0.05556, 0.46505],\n \"160\": [0, 0, 0, 0, 0.25],\n \"915\": [0, 0.68333, 0.13889, 0.08334, 0.61528],\n \"916\": [0, 0.68333, 0, 0.16667, 0.83334],\n \"920\": [0, 0.68333, 0.02778, 0.08334, 0.76278],\n \"923\": [0, 0.68333, 0, 0.16667, 0.69445],\n \"926\": [0, 0.68333, 0.07569, 0.08334, 0.74236],\n \"928\": [0, 0.68333, 0.08125, 0.05556, 0.83125],\n \"931\": [0, 0.68333, 0.05764, 0.08334, 0.77986],\n \"933\": [0, 0.68333, 0.13889, 0.05556, 0.58333],\n \"934\": [0, 0.68333, 0, 0.08334, 0.66667],\n \"936\": [0, 0.68333, 0.11, 0.05556, 0.61222],\n \"937\": [0, 0.68333, 0.05017, 0.08334, 0.7724],\n \"945\": [0, 0.43056, 0.0037, 0.02778, 0.6397],\n \"946\": [0.19444, 0.69444, 0.05278, 0.08334, 0.56563],\n \"947\": [0.19444, 0.43056, 0.05556, 0, 0.51773],\n \"948\": [0, 0.69444, 0.03785, 0.05556, 0.44444],\n \"949\": [0, 0.43056, 0, 0.08334, 0.46632],\n \"950\": [0.19444, 0.69444, 0.07378, 0.08334, 0.4375],\n \"951\": [0.19444, 0.43056, 0.03588, 0.05556, 0.49653],\n \"952\": [0, 0.69444, 0.02778, 0.08334, 0.46944],\n \"953\": [0, 0.43056, 0, 0.05556, 0.35394],\n \"954\": [0, 0.43056, 0, 0, 0.57616],\n \"955\": [0, 0.69444, 0, 0, 0.58334],\n \"956\": [0.19444, 0.43056, 0, 0.02778, 0.60255],\n \"957\": [0, 0.43056, 0.06366, 0.02778, 0.49398],\n \"958\": [0.19444, 0.69444, 0.04601, 0.11111, 0.4375],\n \"959\": [0, 0.43056, 0, 0.05556, 0.48472],\n \"960\": [0, 0.43056, 0.03588, 0, 0.57003],\n \"961\": [0.19444, 0.43056, 0, 0.08334, 0.51702],\n \"962\": [0.09722, 0.43056, 0.07986, 0.08334, 0.36285],\n \"963\": [0, 0.43056, 0.03588, 0, 0.57141],\n \"964\": [0, 0.43056, 0.1132, 0.02778, 0.43715],\n \"965\": [0, 0.43056, 0.03588, 0.02778, 0.54028],\n \"966\": [0.19444, 0.43056, 0, 0.08334, 0.65417],\n \"967\": [0.19444, 0.43056, 0, 0.05556, 0.62569],\n \"968\": [0.19444, 0.69444, 0.03588, 0.11111, 0.65139],\n \"969\": [0, 0.43056, 0.03588, 0, 0.62245],\n \"977\": [0, 0.69444, 0, 0.08334, 0.59144],\n \"981\": [0.19444, 0.69444, 0, 0.08334, 0.59583],\n \"982\": [0, 0.43056, 0.02778, 0, 0.82813],\n \"1009\": [0.19444, 0.43056, 0, 0.08334, 0.51702],\n \"1013\": [0, 0.43056, 0, 0.05556, 0.4059],\n \"57649\": [0, 0.43056, 0, 0.02778, 0.32246],\n \"57911\": [0.19444, 0.43056, 0, 0.08334, 0.38403]\n },\n \"SansSerif-Bold\": {\n \"32\": [0, 0, 0, 0, 0.25],\n \"33\": [0, 0.69444, 0, 0, 0.36667],\n \"34\": [0, 0.69444, 0, 0, 0.55834],\n \"35\": [0.19444, 0.69444, 0, 0, 0.91667],\n \"36\": [0.05556, 0.75, 0, 0, 0.55],\n \"37\": [0.05556, 0.75, 0, 0, 1.02912],\n \"38\": [0, 0.69444, 0, 0, 0.83056],\n \"39\": [0, 0.69444, 0, 0, 0.30556],\n \"40\": [0.25, 0.75, 0, 0, 0.42778],\n \"41\": [0.25, 0.75, 0, 0, 0.42778],\n \"42\": [0, 0.75, 0, 0, 0.55],\n \"43\": [0.11667, 0.61667, 0, 0, 0.85556],\n \"44\": [0.10556, 0.13056, 0, 0, 0.30556],\n \"45\": [0, 0.45833, 0, 0, 0.36667],\n \"46\": [0, 0.13056, 0, 0, 0.30556],\n \"47\": [0.25, 0.75, 0, 0, 0.55],\n \"48\": [0, 0.69444, 0, 0, 0.55],\n \"49\": [0, 0.69444, 0, 0, 0.55],\n \"50\": [0, 0.69444, 0, 0, 0.55],\n \"51\": [0, 0.69444, 0, 0, 0.55],\n \"52\": [0, 0.69444, 0, 0, 0.55],\n \"53\": [0, 0.69444, 0, 0, 0.55],\n \"54\": [0, 0.69444, 0, 0, 0.55],\n \"55\": [0, 0.69444, 0, 0, 0.55],\n \"56\": [0, 0.69444, 0, 0, 0.55],\n \"57\": [0, 0.69444, 0, 0, 0.55],\n \"58\": [0, 0.45833, 0, 0, 0.30556],\n \"59\": [0.10556, 0.45833, 0, 0, 0.30556],\n \"61\": [-0.09375, 0.40625, 0, 0, 0.85556],\n \"63\": [0, 0.69444, 0, 0, 0.51945],\n \"64\": [0, 0.69444, 0, 0, 0.73334],\n \"65\": [0, 0.69444, 0, 0, 0.73334],\n \"66\": [0, 0.69444, 0, 0, 0.73334],\n \"67\": [0, 0.69444, 0, 0, 0.70278],\n \"68\": [0, 0.69444, 0, 0, 0.79445],\n \"69\": [0, 0.69444, 0, 0, 0.64167],\n \"70\": [0, 0.69444, 0, 0, 0.61111],\n \"71\": [0, 0.69444, 0, 0, 0.73334],\n \"72\": [0, 0.69444, 0, 0, 0.79445],\n \"73\": [0, 0.69444, 0, 0, 0.33056],\n \"74\": [0, 0.69444, 0, 0, 0.51945],\n \"75\": [0, 0.69444, 0, 0, 0.76389],\n \"76\": [0, 0.69444, 0, 0, 0.58056],\n \"77\": [0, 0.69444, 0, 0, 0.97778],\n \"78\": [0, 0.69444, 0, 0, 0.79445],\n \"79\": [0, 0.69444, 0, 0, 0.79445],\n \"80\": [0, 0.69444, 0, 0, 0.70278],\n \"81\": [0.10556, 0.69444, 0, 0, 0.79445],\n \"82\": [0, 0.69444, 0, 0, 0.70278],\n \"83\": [0, 0.69444, 0, 0, 0.61111],\n \"84\": [0, 0.69444, 0, 0, 0.73334],\n \"85\": [0, 0.69444, 0, 0, 0.76389],\n \"86\": [0, 0.69444, 0.01528, 0, 0.73334],\n \"87\": [0, 0.69444, 0.01528, 0, 1.03889],\n \"88\": [0, 0.69444, 0, 0, 0.73334],\n \"89\": [0, 0.69444, 0.0275, 0, 0.73334],\n \"90\": [0, 0.69444, 0, 0, 0.67223],\n \"91\": [0.25, 0.75, 0, 0, 0.34306],\n \"93\": [0.25, 0.75, 0, 0, 0.34306],\n \"94\": [0, 0.69444, 0, 0, 0.55],\n \"95\": [0.35, 0.10833, 0.03056, 0, 0.55],\n \"97\": [0, 0.45833, 0, 0, 0.525],\n \"98\": [0, 0.69444, 0, 0, 0.56111],\n \"99\": [0, 0.45833, 0, 0, 0.48889],\n \"100\": [0, 0.69444, 0, 0, 0.56111],\n \"101\": [0, 0.45833, 0, 0, 0.51111],\n \"102\": [0, 0.69444, 0.07639, 0, 0.33611],\n \"103\": [0.19444, 0.45833, 0.01528, 0, 0.55],\n \"104\": [0, 0.69444, 0, 0, 0.56111],\n \"105\": [0, 0.69444, 0, 0, 0.25556],\n \"106\": [0.19444, 0.69444, 0, 0, 0.28611],\n \"107\": [0, 0.69444, 0, 0, 0.53056],\n \"108\": [0, 0.69444, 0, 0, 0.25556],\n \"109\": [0, 0.45833, 0, 0, 0.86667],\n \"110\": [0, 0.45833, 0, 0, 0.56111],\n \"111\": [0, 0.45833, 0, 0, 0.55],\n \"112\": [0.19444, 0.45833, 0, 0, 0.56111],\n \"113\": [0.19444, 0.45833, 0, 0, 0.56111],\n \"114\": [0, 0.45833, 0.01528, 0, 0.37222],\n \"115\": [0, 0.45833, 0, 0, 0.42167],\n \"116\": [0, 0.58929, 0, 0, 0.40417],\n \"117\": [0, 0.45833, 0, 0, 0.56111],\n \"118\": [0, 0.45833, 0.01528, 0, 0.5],\n \"119\": [0, 0.45833, 0.01528, 0, 0.74445],\n \"120\": [0, 0.45833, 0, 0, 0.5],\n \"121\": [0.19444, 0.45833, 0.01528, 0, 0.5],\n \"122\": [0, 0.45833, 0, 0, 0.47639],\n \"126\": [0.35, 0.34444, 0, 0, 0.55],\n \"160\": [0, 0, 0, 0, 0.25],\n \"168\": [0, 0.69444, 0, 0, 0.55],\n \"176\": [0, 0.69444, 0, 0, 0.73334],\n \"180\": [0, 0.69444, 0, 0, 0.55],\n \"184\": [0.17014, 0, 0, 0, 0.48889],\n \"305\": [0, 0.45833, 0, 0, 0.25556],\n \"567\": [0.19444, 0.45833, 0, 0, 0.28611],\n \"710\": [0, 0.69444, 0, 0, 0.55],\n \"711\": [0, 0.63542, 0, 0, 0.55],\n \"713\": [0, 0.63778, 0, 0, 0.55],\n \"728\": [0, 0.69444, 0, 0, 0.55],\n \"729\": [0, 0.69444, 0, 0, 0.30556],\n \"730\": [0, 0.69444, 0, 0, 0.73334],\n \"732\": [0, 0.69444, 0, 0, 0.55],\n \"733\": [0, 0.69444, 0, 0, 0.55],\n \"915\": [0, 0.69444, 0, 0, 0.58056],\n \"916\": [0, 0.69444, 0, 0, 0.91667],\n \"920\": [0, 0.69444, 0, 0, 0.85556],\n \"923\": [0, 0.69444, 0, 0, 0.67223],\n \"926\": [0, 0.69444, 0, 0, 0.73334],\n \"928\": [0, 0.69444, 0, 0, 0.79445],\n \"931\": [0, 0.69444, 0, 0, 0.79445],\n \"933\": [0, 0.69444, 0, 0, 0.85556],\n \"934\": [0, 0.69444, 0, 0, 0.79445],\n \"936\": [0, 0.69444, 0, 0, 0.85556],\n \"937\": [0, 0.69444, 0, 0, 0.79445],\n \"8211\": [0, 0.45833, 0.03056, 0, 0.55],\n \"8212\": [0, 0.45833, 0.03056, 0, 1.10001],\n \"8216\": [0, 0.69444, 0, 0, 0.30556],\n \"8217\": [0, 0.69444, 0, 0, 0.30556],\n \"8220\": [0, 0.69444, 0, 0, 0.55834],\n \"8221\": [0, 0.69444, 0, 0, 0.55834]\n },\n \"SansSerif-Italic\": {\n \"32\": [0, 0, 0, 0, 0.25],\n \"33\": [0, 0.69444, 0.05733, 0, 0.31945],\n \"34\": [0, 0.69444, 0.00316, 0, 0.5],\n \"35\": [0.19444, 0.69444, 0.05087, 0, 0.83334],\n \"36\": [0.05556, 0.75, 0.11156, 0, 0.5],\n \"37\": [0.05556, 0.75, 0.03126, 0, 0.83334],\n \"38\": [0, 0.69444, 0.03058, 0, 0.75834],\n \"39\": [0, 0.69444, 0.07816, 0, 0.27778],\n \"40\": [0.25, 0.75, 0.13164, 0, 0.38889],\n \"41\": [0.25, 0.75, 0.02536, 0, 0.38889],\n \"42\": [0, 0.75, 0.11775, 0, 0.5],\n \"43\": [0.08333, 0.58333, 0.02536, 0, 0.77778],\n \"44\": [0.125, 0.08333, 0, 0, 0.27778],\n \"45\": [0, 0.44444, 0.01946, 0, 0.33333],\n \"46\": [0, 0.08333, 0, 0, 0.27778],\n \"47\": [0.25, 0.75, 0.13164, 0, 0.5],\n \"48\": [0, 0.65556, 0.11156, 0, 0.5],\n \"49\": [0, 0.65556, 0.11156, 0, 0.5],\n \"50\": [0, 0.65556, 0.11156, 0, 0.5],\n \"51\": [0, 0.65556, 0.11156, 0, 0.5],\n \"52\": [0, 0.65556, 0.11156, 0, 0.5],\n \"53\": [0, 0.65556, 0.11156, 0, 0.5],\n \"54\": [0, 0.65556, 0.11156, 0, 0.5],\n \"55\": [0, 0.65556, 0.11156, 0, 0.5],\n \"56\": [0, 0.65556, 0.11156, 0, 0.5],\n \"57\": [0, 0.65556, 0.11156, 0, 0.5],\n \"58\": [0, 0.44444, 0.02502, 0, 0.27778],\n \"59\": [0.125, 0.44444, 0.02502, 0, 0.27778],\n \"61\": [-0.13, 0.37, 0.05087, 0, 0.77778],\n \"63\": [0, 0.69444, 0.11809, 0, 0.47222],\n \"64\": [0, 0.69444, 0.07555, 0, 0.66667],\n \"65\": [0, 0.69444, 0, 0, 0.66667],\n \"66\": [0, 0.69444, 0.08293, 0, 0.66667],\n \"67\": [0, 0.69444, 0.11983, 0, 0.63889],\n \"68\": [0, 0.69444, 0.07555, 0, 0.72223],\n \"69\": [0, 0.69444, 0.11983, 0, 0.59722],\n \"70\": [0, 0.69444, 0.13372, 0, 0.56945],\n \"71\": [0, 0.69444, 0.11983, 0, 0.66667],\n \"72\": [0, 0.69444, 0.08094, 0, 0.70834],\n \"73\": [0, 0.69444, 0.13372, 0, 0.27778],\n \"74\": [0, 0.69444, 0.08094, 0, 0.47222],\n \"75\": [0, 0.69444, 0.11983, 0, 0.69445],\n \"76\": [0, 0.69444, 0, 0, 0.54167],\n \"77\": [0, 0.69444, 0.08094, 0, 0.875],\n \"78\": [0, 0.69444, 0.08094, 0, 0.70834],\n \"79\": [0, 0.69444, 0.07555, 0, 0.73611],\n \"80\": [0, 0.69444, 0.08293, 0, 0.63889],\n \"81\": [0.125, 0.69444, 0.07555, 0, 0.73611],\n \"82\": [0, 0.69444, 0.08293, 0, 0.64584],\n \"83\": [0, 0.69444, 0.09205, 0, 0.55556],\n \"84\": [0, 0.69444, 0.13372, 0, 0.68056],\n \"85\": [0, 0.69444, 0.08094, 0, 0.6875],\n \"86\": [0, 0.69444, 0.1615, 0, 0.66667],\n \"87\": [0, 0.69444, 0.1615, 0, 0.94445],\n \"88\": [0, 0.69444, 0.13372, 0, 0.66667],\n \"89\": [0, 0.69444, 0.17261, 0, 0.66667],\n \"90\": [0, 0.69444, 0.11983, 0, 0.61111],\n \"91\": [0.25, 0.75, 0.15942, 0, 0.28889],\n \"93\": [0.25, 0.75, 0.08719, 0, 0.28889],\n \"94\": [0, 0.69444, 0.0799, 0, 0.5],\n \"95\": [0.35, 0.09444, 0.08616, 0, 0.5],\n \"97\": [0, 0.44444, 0.00981, 0, 0.48056],\n \"98\": [0, 0.69444, 0.03057, 0, 0.51667],\n \"99\": [0, 0.44444, 0.08336, 0, 0.44445],\n \"100\": [0, 0.69444, 0.09483, 0, 0.51667],\n \"101\": [0, 0.44444, 0.06778, 0, 0.44445],\n \"102\": [0, 0.69444, 0.21705, 0, 0.30556],\n \"103\": [0.19444, 0.44444, 0.10836, 0, 0.5],\n \"104\": [0, 0.69444, 0.01778, 0, 0.51667],\n \"105\": [0, 0.67937, 0.09718, 0, 0.23889],\n \"106\": [0.19444, 0.67937, 0.09162, 0, 0.26667],\n \"107\": [0, 0.69444, 0.08336, 0, 0.48889],\n \"108\": [0, 0.69444, 0.09483, 0, 0.23889],\n \"109\": [0, 0.44444, 0.01778, 0, 0.79445],\n \"110\": [0, 0.44444, 0.01778, 0, 0.51667],\n \"111\": [0, 0.44444, 0.06613, 0, 0.5],\n \"112\": [0.19444, 0.44444, 0.0389, 0, 0.51667],\n \"113\": [0.19444, 0.44444, 0.04169, 0, 0.51667],\n \"114\": [0, 0.44444, 0.10836, 0, 0.34167],\n \"115\": [0, 0.44444, 0.0778, 0, 0.38333],\n \"116\": [0, 0.57143, 0.07225, 0, 0.36111],\n \"117\": [0, 0.44444, 0.04169, 0, 0.51667],\n \"118\": [0, 0.44444, 0.10836, 0, 0.46111],\n \"119\": [0, 0.44444, 0.10836, 0, 0.68334],\n \"120\": [0, 0.44444, 0.09169, 0, 0.46111],\n \"121\": [0.19444, 0.44444, 0.10836, 0, 0.46111],\n \"122\": [0, 0.44444, 0.08752, 0, 0.43472],\n \"126\": [0.35, 0.32659, 0.08826, 0, 0.5],\n \"160\": [0, 0, 0, 0, 0.25],\n \"168\": [0, 0.67937, 0.06385, 0, 0.5],\n \"176\": [0, 0.69444, 0, 0, 0.73752],\n \"184\": [0.17014, 0, 0, 0, 0.44445],\n \"305\": [0, 0.44444, 0.04169, 0, 0.23889],\n \"567\": [0.19444, 0.44444, 0.04169, 0, 0.26667],\n \"710\": [0, 0.69444, 0.0799, 0, 0.5],\n \"711\": [0, 0.63194, 0.08432, 0, 0.5],\n \"713\": [0, 0.60889, 0.08776, 0, 0.5],\n \"714\": [0, 0.69444, 0.09205, 0, 0.5],\n \"715\": [0, 0.69444, 0, 0, 0.5],\n \"728\": [0, 0.69444, 0.09483, 0, 0.5],\n \"729\": [0, 0.67937, 0.07774, 0, 0.27778],\n \"730\": [0, 0.69444, 0, 0, 0.73752],\n \"732\": [0, 0.67659, 0.08826, 0, 0.5],\n \"733\": [0, 0.69444, 0.09205, 0, 0.5],\n \"915\": [0, 0.69444, 0.13372, 0, 0.54167],\n \"916\": [0, 0.69444, 0, 0, 0.83334],\n \"920\": [0, 0.69444, 0.07555, 0, 0.77778],\n \"923\": [0, 0.69444, 0, 0, 0.61111],\n \"926\": [0, 0.69444, 0.12816, 0, 0.66667],\n \"928\": [0, 0.69444, 0.08094, 0, 0.70834],\n \"931\": [0, 0.69444, 0.11983, 0, 0.72222],\n \"933\": [0, 0.69444, 0.09031, 0, 0.77778],\n \"934\": [0, 0.69444, 0.04603, 0, 0.72222],\n \"936\": [0, 0.69444, 0.09031, 0, 0.77778],\n \"937\": [0, 0.69444, 0.08293, 0, 0.72222],\n \"8211\": [0, 0.44444, 0.08616, 0, 0.5],\n \"8212\": [0, 0.44444, 0.08616, 0, 1.0],\n \"8216\": [0, 0.69444, 0.07816, 0, 0.27778],\n \"8217\": [0, 0.69444, 0.07816, 0, 0.27778],\n \"8220\": [0, 0.69444, 0.14205, 0, 0.5],\n \"8221\": [0, 0.69444, 0.00316, 0, 0.5]\n },\n \"SansSerif-Regular\": {\n \"32\": [0, 0, 0, 0, 0.25],\n \"33\": [0, 0.69444, 0, 0, 0.31945],\n \"34\": [0, 0.69444, 0, 0, 0.5],\n \"35\": [0.19444, 0.69444, 0, 0, 0.83334],\n \"36\": [0.05556, 0.75, 0, 0, 0.5],\n \"37\": [0.05556, 0.75, 0, 0, 0.83334],\n \"38\": [0, 0.69444, 0, 0, 0.75834],\n \"39\": [0, 0.69444, 0, 0, 0.27778],\n \"40\": [0.25, 0.75, 0, 0, 0.38889],\n \"41\": [0.25, 0.75, 0, 0, 0.38889],\n \"42\": [0, 0.75, 0, 0, 0.5],\n \"43\": [0.08333, 0.58333, 0, 0, 0.77778],\n \"44\": [0.125, 0.08333, 0, 0, 0.27778],\n \"45\": [0, 0.44444, 0, 0, 0.33333],\n \"46\": [0, 0.08333, 0, 0, 0.27778],\n \"47\": [0.25, 0.75, 0, 0, 0.5],\n \"48\": [0, 0.65556, 0, 0, 0.5],\n \"49\": [0, 0.65556, 0, 0, 0.5],\n \"50\": [0, 0.65556, 0, 0, 0.5],\n \"51\": [0, 0.65556, 0, 0, 0.5],\n \"52\": [0, 0.65556, 0, 0, 0.5],\n \"53\": [0, 0.65556, 0, 0, 0.5],\n \"54\": [0, 0.65556, 0, 0, 0.5],\n \"55\": [0, 0.65556, 0, 0, 0.5],\n \"56\": [0, 0.65556, 0, 0, 0.5],\n \"57\": [0, 0.65556, 0, 0, 0.5],\n \"58\": [0, 0.44444, 0, 0, 0.27778],\n \"59\": [0.125, 0.44444, 0, 0, 0.27778],\n \"61\": [-0.13, 0.37, 0, 0, 0.77778],\n \"63\": [0, 0.69444, 0, 0, 0.47222],\n \"64\": [0, 0.69444, 0, 0, 0.66667],\n \"65\": [0, 0.69444, 0, 0, 0.66667],\n \"66\": [0, 0.69444, 0, 0, 0.66667],\n \"67\": [0, 0.69444, 0, 0, 0.63889],\n \"68\": [0, 0.69444, 0, 0, 0.72223],\n \"69\": [0, 0.69444, 0, 0, 0.59722],\n \"70\": [0, 0.69444, 0, 0, 0.56945],\n \"71\": [0, 0.69444, 0, 0, 0.66667],\n \"72\": [0, 0.69444, 0, 0, 0.70834],\n \"73\": [0, 0.69444, 0, 0, 0.27778],\n \"74\": [0, 0.69444, 0, 0, 0.47222],\n \"75\": [0, 0.69444, 0, 0, 0.69445],\n \"76\": [0, 0.69444, 0, 0, 0.54167],\n \"77\": [0, 0.69444, 0, 0, 0.875],\n \"78\": [0, 0.69444, 0, 0, 0.70834],\n \"79\": [0, 0.69444, 0, 0, 0.73611],\n \"80\": [0, 0.69444, 0, 0, 0.63889],\n \"81\": [0.125, 0.69444, 0, 0, 0.73611],\n \"82\": [0, 0.69444, 0, 0, 0.64584],\n \"83\": [0, 0.69444, 0, 0, 0.55556],\n \"84\": [0, 0.69444, 0, 0, 0.68056],\n \"85\": [0, 0.69444, 0, 0, 0.6875],\n \"86\": [0, 0.69444, 0.01389, 0, 0.66667],\n \"87\": [0, 0.69444, 0.01389, 0, 0.94445],\n \"88\": [0, 0.69444, 0, 0, 0.66667],\n \"89\": [0, 0.69444, 0.025, 0, 0.66667],\n \"90\": [0, 0.69444, 0, 0, 0.61111],\n \"91\": [0.25, 0.75, 0, 0, 0.28889],\n \"93\": [0.25, 0.75, 0, 0, 0.28889],\n \"94\": [0, 0.69444, 0, 0, 0.5],\n \"95\": [0.35, 0.09444, 0.02778, 0, 0.5],\n \"97\": [0, 0.44444, 0, 0, 0.48056],\n \"98\": [0, 0.69444, 0, 0, 0.51667],\n \"99\": [0, 0.44444, 0, 0, 0.44445],\n \"100\": [0, 0.69444, 0, 0, 0.51667],\n \"101\": [0, 0.44444, 0, 0, 0.44445],\n \"102\": [0, 0.69444, 0.06944, 0, 0.30556],\n \"103\": [0.19444, 0.44444, 0.01389, 0, 0.5],\n \"104\": [0, 0.69444, 0, 0, 0.51667],\n \"105\": [0, 0.67937, 0, 0, 0.23889],\n \"106\": [0.19444, 0.67937, 0, 0, 0.26667],\n \"107\": [0, 0.69444, 0, 0, 0.48889],\n \"108\": [0, 0.69444, 0, 0, 0.23889],\n \"109\": [0, 0.44444, 0, 0, 0.79445],\n \"110\": [0, 0.44444, 0, 0, 0.51667],\n \"111\": [0, 0.44444, 0, 0, 0.5],\n \"112\": [0.19444, 0.44444, 0, 0, 0.51667],\n \"113\": [0.19444, 0.44444, 0, 0, 0.51667],\n \"114\": [0, 0.44444, 0.01389, 0, 0.34167],\n \"115\": [0, 0.44444, 0, 0, 0.38333],\n \"116\": [0, 0.57143, 0, 0, 0.36111],\n \"117\": [0, 0.44444, 0, 0, 0.51667],\n \"118\": [0, 0.44444, 0.01389, 0, 0.46111],\n \"119\": [0, 0.44444, 0.01389, 0, 0.68334],\n \"120\": [0, 0.44444, 0, 0, 0.46111],\n \"121\": [0.19444, 0.44444, 0.01389, 0, 0.46111],\n \"122\": [0, 0.44444, 0, 0, 0.43472],\n \"126\": [0.35, 0.32659, 0, 0, 0.5],\n \"160\": [0, 0, 0, 0, 0.25],\n \"168\": [0, 0.67937, 0, 0, 0.5],\n \"176\": [0, 0.69444, 0, 0, 0.66667],\n \"184\": [0.17014, 0, 0, 0, 0.44445],\n \"305\": [0, 0.44444, 0, 0, 0.23889],\n \"567\": [0.19444, 0.44444, 0, 0, 0.26667],\n \"710\": [0, 0.69444, 0, 0, 0.5],\n \"711\": [0, 0.63194, 0, 0, 0.5],\n \"713\": [0, 0.60889, 0, 0, 0.5],\n \"714\": [0, 0.69444, 0, 0, 0.5],\n \"715\": [0, 0.69444, 0, 0, 0.5],\n \"728\": [0, 0.69444, 0, 0, 0.5],\n \"729\": [0, 0.67937, 0, 0, 0.27778],\n \"730\": [0, 0.69444, 0, 0, 0.66667],\n \"732\": [0, 0.67659, 0, 0, 0.5],\n \"733\": [0, 0.69444, 0, 0, 0.5],\n \"915\": [0, 0.69444, 0, 0, 0.54167],\n \"916\": [0, 0.69444, 0, 0, 0.83334],\n \"920\": [0, 0.69444, 0, 0, 0.77778],\n \"923\": [0, 0.69444, 0, 0, 0.61111],\n \"926\": [0, 0.69444, 0, 0, 0.66667],\n \"928\": [0, 0.69444, 0, 0, 0.70834],\n \"931\": [0, 0.69444, 0, 0, 0.72222],\n \"933\": [0, 0.69444, 0, 0, 0.77778],\n \"934\": [0, 0.69444, 0, 0, 0.72222],\n \"936\": [0, 0.69444, 0, 0, 0.77778],\n \"937\": [0, 0.69444, 0, 0, 0.72222],\n \"8211\": [0, 0.44444, 0.02778, 0, 0.5],\n \"8212\": [0, 0.44444, 0.02778, 0, 1.0],\n \"8216\": [0, 0.69444, 0, 0, 0.27778],\n \"8217\": [0, 0.69444, 0, 0, 0.27778],\n \"8220\": [0, 0.69444, 0, 0, 0.5],\n \"8221\": [0, 0.69444, 0, 0, 0.5]\n },\n \"Script-Regular\": {\n \"32\": [0, 0, 0, 0, 0.25],\n \"65\": [0, 0.7, 0.22925, 0, 0.80253],\n \"66\": [0, 0.7, 0.04087, 0, 0.90757],\n \"67\": [0, 0.7, 0.1689, 0, 0.66619],\n \"68\": [0, 0.7, 0.09371, 0, 0.77443],\n \"69\": [0, 0.7, 0.18583, 0, 0.56162],\n \"70\": [0, 0.7, 0.13634, 0, 0.89544],\n \"71\": [0, 0.7, 0.17322, 0, 0.60961],\n \"72\": [0, 0.7, 0.29694, 0, 0.96919],\n \"73\": [0, 0.7, 0.19189, 0, 0.80907],\n \"74\": [0.27778, 0.7, 0.19189, 0, 1.05159],\n \"75\": [0, 0.7, 0.31259, 0, 0.91364],\n \"76\": [0, 0.7, 0.19189, 0, 0.87373],\n \"77\": [0, 0.7, 0.15981, 0, 1.08031],\n \"78\": [0, 0.7, 0.3525, 0, 0.9015],\n \"79\": [0, 0.7, 0.08078, 0, 0.73787],\n \"80\": [0, 0.7, 0.08078, 0, 1.01262],\n \"81\": [0, 0.7, 0.03305, 0, 0.88282],\n \"82\": [0, 0.7, 0.06259, 0, 0.85],\n \"83\": [0, 0.7, 0.19189, 0, 0.86767],\n \"84\": [0, 0.7, 0.29087, 0, 0.74697],\n \"85\": [0, 0.7, 0.25815, 0, 0.79996],\n \"86\": [0, 0.7, 0.27523, 0, 0.62204],\n \"87\": [0, 0.7, 0.27523, 0, 0.80532],\n \"88\": [0, 0.7, 0.26006, 0, 0.94445],\n \"89\": [0, 0.7, 0.2939, 0, 0.70961],\n \"90\": [0, 0.7, 0.24037, 0, 0.8212],\n \"160\": [0, 0, 0, 0, 0.25]\n },\n \"Size1-Regular\": {\n \"32\": [0, 0, 0, 0, 0.25],\n \"40\": [0.35001, 0.85, 0, 0, 0.45834],\n \"41\": [0.35001, 0.85, 0, 0, 0.45834],\n \"47\": [0.35001, 0.85, 0, 0, 0.57778],\n \"91\": [0.35001, 0.85, 0, 0, 0.41667],\n \"92\": [0.35001, 0.85, 0, 0, 0.57778],\n \"93\": [0.35001, 0.85, 0, 0, 0.41667],\n \"123\": [0.35001, 0.85, 0, 0, 0.58334],\n \"125\": [0.35001, 0.85, 0, 0, 0.58334],\n \"160\": [0, 0, 0, 0, 0.25],\n \"710\": [0, 0.72222, 0, 0, 0.55556],\n \"732\": [0, 0.72222, 0, 0, 0.55556],\n \"770\": [0, 0.72222, 0, 0, 0.55556],\n \"771\": [0, 0.72222, 0, 0, 0.55556],\n \"8214\": [-0.00099, 0.601, 0, 0, 0.77778],\n \"8593\": [1e-05, 0.6, 0, 0, 0.66667],\n \"8595\": [1e-05, 0.6, 0, 0, 0.66667],\n \"8657\": [1e-05, 0.6, 0, 0, 0.77778],\n \"8659\": [1e-05, 0.6, 0, 0, 0.77778],\n \"8719\": [0.25001, 0.75, 0, 0, 0.94445],\n \"8720\": [0.25001, 0.75, 0, 0, 0.94445],\n \"8721\": [0.25001, 0.75, 0, 0, 1.05556],\n \"8730\": [0.35001, 0.85, 0, 0, 1.0],\n \"8739\": [-0.00599, 0.606, 0, 0, 0.33333],\n \"8741\": [-0.00599, 0.606, 0, 0, 0.55556],\n \"8747\": [0.30612, 0.805, 0.19445, 0, 0.47222],\n \"8748\": [0.306, 0.805, 0.19445, 0, 0.47222],\n \"8749\": [0.306, 0.805, 0.19445, 0, 0.47222],\n \"8750\": [0.30612, 0.805, 0.19445, 0, 0.47222],\n \"8896\": [0.25001, 0.75, 0, 0, 0.83334],\n \"8897\": [0.25001, 0.75, 0, 0, 0.83334],\n \"8898\": [0.25001, 0.75, 0, 0, 0.83334],\n \"8899\": [0.25001, 0.75, 0, 0, 0.83334],\n \"8968\": [0.35001, 0.85, 0, 0, 0.47222],\n \"8969\": [0.35001, 0.85, 0, 0, 0.47222],\n \"8970\": [0.35001, 0.85, 0, 0, 0.47222],\n \"8971\": [0.35001, 0.85, 0, 0, 0.47222],\n \"9168\": [-0.00099, 0.601, 0, 0, 0.66667],\n \"10216\": [0.35001, 0.85, 0, 0, 0.47222],\n \"10217\": [0.35001, 0.85, 0, 0, 0.47222],\n \"10752\": [0.25001, 0.75, 0, 0, 1.11111],\n \"10753\": [0.25001, 0.75, 0, 0, 1.11111],\n \"10754\": [0.25001, 0.75, 0, 0, 1.11111],\n \"10756\": [0.25001, 0.75, 0, 0, 0.83334],\n \"10758\": [0.25001, 0.75, 0, 0, 0.83334]\n },\n \"Size2-Regular\": {\n \"32\": [0, 0, 0, 0, 0.25],\n \"40\": [0.65002, 1.15, 0, 0, 0.59722],\n \"41\": [0.65002, 1.15, 0, 0, 0.59722],\n \"47\": [0.65002, 1.15, 0, 0, 0.81111],\n \"91\": [0.65002, 1.15, 0, 0, 0.47222],\n \"92\": [0.65002, 1.15, 0, 0, 0.81111],\n \"93\": [0.65002, 1.15, 0, 0, 0.47222],\n \"123\": [0.65002, 1.15, 0, 0, 0.66667],\n \"125\": [0.65002, 1.15, 0, 0, 0.66667],\n \"160\": [0, 0, 0, 0, 0.25],\n \"710\": [0, 0.75, 0, 0, 1.0],\n \"732\": [0, 0.75, 0, 0, 1.0],\n \"770\": [0, 0.75, 0, 0, 1.0],\n \"771\": [0, 0.75, 0, 0, 1.0],\n \"8719\": [0.55001, 1.05, 0, 0, 1.27778],\n \"8720\": [0.55001, 1.05, 0, 0, 1.27778],\n \"8721\": [0.55001, 1.05, 0, 0, 1.44445],\n \"8730\": [0.65002, 1.15, 0, 0, 1.0],\n \"8747\": [0.86225, 1.36, 0.44445, 0, 0.55556],\n \"8748\": [0.862, 1.36, 0.44445, 0, 0.55556],\n \"8749\": [0.862, 1.36, 0.44445, 0, 0.55556],\n \"8750\": [0.86225, 1.36, 0.44445, 0, 0.55556],\n \"8896\": [0.55001, 1.05, 0, 0, 1.11111],\n \"8897\": [0.55001, 1.05, 0, 0, 1.11111],\n \"8898\": [0.55001, 1.05, 0, 0, 1.11111],\n \"8899\": [0.55001, 1.05, 0, 0, 1.11111],\n \"8968\": [0.65002, 1.15, 0, 0, 0.52778],\n \"8969\": [0.65002, 1.15, 0, 0, 0.52778],\n \"8970\": [0.65002, 1.15, 0, 0, 0.52778],\n \"8971\": [0.65002, 1.15, 0, 0, 0.52778],\n \"10216\": [0.65002, 1.15, 0, 0, 0.61111],\n \"10217\": [0.65002, 1.15, 0, 0, 0.61111],\n \"10752\": [0.55001, 1.05, 0, 0, 1.51112],\n \"10753\": [0.55001, 1.05, 0, 0, 1.51112],\n \"10754\": [0.55001, 1.05, 0, 0, 1.51112],\n \"10756\": [0.55001, 1.05, 0, 0, 1.11111],\n \"10758\": [0.55001, 1.05, 0, 0, 1.11111]\n },\n \"Size3-Regular\": {\n \"32\": [0, 0, 0, 0, 0.25],\n \"40\": [0.95003, 1.45, 0, 0, 0.73611],\n \"41\": [0.95003, 1.45, 0, 0, 0.73611],\n \"47\": [0.95003, 1.45, 0, 0, 1.04445],\n \"91\": [0.95003, 1.45, 0, 0, 0.52778],\n \"92\": [0.95003, 1.45, 0, 0, 1.04445],\n \"93\": [0.95003, 1.45, 0, 0, 0.52778],\n \"123\": [0.95003, 1.45, 0, 0, 0.75],\n \"125\": [0.95003, 1.45, 0, 0, 0.75],\n \"160\": [0, 0, 0, 0, 0.25],\n \"710\": [0, 0.75, 0, 0, 1.44445],\n \"732\": [0, 0.75, 0, 0, 1.44445],\n \"770\": [0, 0.75, 0, 0, 1.44445],\n \"771\": [0, 0.75, 0, 0, 1.44445],\n \"8730\": [0.95003, 1.45, 0, 0, 1.0],\n \"8968\": [0.95003, 1.45, 0, 0, 0.58334],\n \"8969\": [0.95003, 1.45, 0, 0, 0.58334],\n \"8970\": [0.95003, 1.45, 0, 0, 0.58334],\n \"8971\": [0.95003, 1.45, 0, 0, 0.58334],\n \"10216\": [0.95003, 1.45, 0, 0, 0.75],\n \"10217\": [0.95003, 1.45, 0, 0, 0.75]\n },\n \"Size4-Regular\": {\n \"32\": [0, 0, 0, 0, 0.25],\n \"40\": [1.25003, 1.75, 0, 0, 0.79167],\n \"41\": [1.25003, 1.75, 0, 0, 0.79167],\n \"47\": [1.25003, 1.75, 0, 0, 1.27778],\n \"91\": [1.25003, 1.75, 0, 0, 0.58334],\n \"92\": [1.25003, 1.75, 0, 0, 1.27778],\n \"93\": [1.25003, 1.75, 0, 0, 0.58334],\n \"123\": [1.25003, 1.75, 0, 0, 0.80556],\n \"125\": [1.25003, 1.75, 0, 0, 0.80556],\n \"160\": [0, 0, 0, 0, 0.25],\n \"710\": [0, 0.825, 0, 0, 1.8889],\n \"732\": [0, 0.825, 0, 0, 1.8889],\n \"770\": [0, 0.825, 0, 0, 1.8889],\n \"771\": [0, 0.825, 0, 0, 1.8889],\n \"8730\": [1.25003, 1.75, 0, 0, 1.0],\n \"8968\": [1.25003, 1.75, 0, 0, 0.63889],\n \"8969\": [1.25003, 1.75, 0, 0, 0.63889],\n \"8970\": [1.25003, 1.75, 0, 0, 0.63889],\n \"8971\": [1.25003, 1.75, 0, 0, 0.63889],\n \"9115\": [0.64502, 1.155, 0, 0, 0.875],\n \"9116\": [1e-05, 0.6, 0, 0, 0.875],\n \"9117\": [0.64502, 1.155, 0, 0, 0.875],\n \"9118\": [0.64502, 1.155, 0, 0, 0.875],\n \"9119\": [1e-05, 0.6, 0, 0, 0.875],\n \"9120\": [0.64502, 1.155, 0, 0, 0.875],\n \"9121\": [0.64502, 1.155, 0, 0, 0.66667],\n \"9122\": [-0.00099, 0.601, 0, 0, 0.66667],\n \"9123\": [0.64502, 1.155, 0, 0, 0.66667],\n \"9124\": [0.64502, 1.155, 0, 0, 0.66667],\n \"9125\": [-0.00099, 0.601, 0, 0, 0.66667],\n \"9126\": [0.64502, 1.155, 0, 0, 0.66667],\n \"9127\": [1e-05, 0.9, 0, 0, 0.88889],\n \"9128\": [0.65002, 1.15, 0, 0, 0.88889],\n \"9129\": [0.90001, 0, 0, 0, 0.88889],\n \"9130\": [0, 0.3, 0, 0, 0.88889],\n \"9131\": [1e-05, 0.9, 0, 0, 0.88889],\n \"9132\": [0.65002, 1.15, 0, 0, 0.88889],\n \"9133\": [0.90001, 0, 0, 0, 0.88889],\n \"9143\": [0.88502, 0.915, 0, 0, 1.05556],\n \"10216\": [1.25003, 1.75, 0, 0, 0.80556],\n \"10217\": [1.25003, 1.75, 0, 0, 0.80556],\n \"57344\": [-0.00499, 0.605, 0, 0, 1.05556],\n \"57345\": [-0.00499, 0.605, 0, 0, 1.05556],\n \"57680\": [0, 0.12, 0, 0, 0.45],\n \"57681\": [0, 0.12, 0, 0, 0.45],\n \"57682\": [0, 0.12, 0, 0, 0.45],\n \"57683\": [0, 0.12, 0, 0, 0.45]\n },\n \"Typewriter-Regular\": {\n \"32\": [0, 0, 0, 0, 0.525],\n \"33\": [0, 0.61111, 0, 0, 0.525],\n \"34\": [0, 0.61111, 0, 0, 0.525],\n \"35\": [0, 0.61111, 0, 0, 0.525],\n \"36\": [0.08333, 0.69444, 0, 0, 0.525],\n \"37\": [0.08333, 0.69444, 0, 0, 0.525],\n \"38\": [0, 0.61111, 0, 0, 0.525],\n \"39\": [0, 0.61111, 0, 0, 0.525],\n \"40\": [0.08333, 0.69444, 0, 0, 0.525],\n \"41\": [0.08333, 0.69444, 0, 0, 0.525],\n \"42\": [0, 0.52083, 0, 0, 0.525],\n \"43\": [-0.08056, 0.53055, 0, 0, 0.525],\n \"44\": [0.13889, 0.125, 0, 0, 0.525],\n \"45\": [-0.08056, 0.53055, 0, 0, 0.525],\n \"46\": [0, 0.125, 0, 0, 0.525],\n \"47\": [0.08333, 0.69444, 0, 0, 0.525],\n \"48\": [0, 0.61111, 0, 0, 0.525],\n \"49\": [0, 0.61111, 0, 0, 0.525],\n \"50\": [0, 0.61111, 0, 0, 0.525],\n \"51\": [0, 0.61111, 0, 0, 0.525],\n \"52\": [0, 0.61111, 0, 0, 0.525],\n \"53\": [0, 0.61111, 0, 0, 0.525],\n \"54\": [0, 0.61111, 0, 0, 0.525],\n \"55\": [0, 0.61111, 0, 0, 0.525],\n \"56\": [0, 0.61111, 0, 0, 0.525],\n \"57\": [0, 0.61111, 0, 0, 0.525],\n \"58\": [0, 0.43056, 0, 0, 0.525],\n \"59\": [0.13889, 0.43056, 0, 0, 0.525],\n \"60\": [-0.05556, 0.55556, 0, 0, 0.525],\n \"61\": [-0.19549, 0.41562, 0, 0, 0.525],\n \"62\": [-0.05556, 0.55556, 0, 0, 0.525],\n \"63\": [0, 0.61111, 0, 0, 0.525],\n \"64\": [0, 0.61111, 0, 0, 0.525],\n \"65\": [0, 0.61111, 0, 0, 0.525],\n \"66\": [0, 0.61111, 0, 0, 0.525],\n \"67\": [0, 0.61111, 0, 0, 0.525],\n \"68\": [0, 0.61111, 0, 0, 0.525],\n \"69\": [0, 0.61111, 0, 0, 0.525],\n \"70\": [0, 0.61111, 0, 0, 0.525],\n \"71\": [0, 0.61111, 0, 0, 0.525],\n \"72\": [0, 0.61111, 0, 0, 0.525],\n \"73\": [0, 0.61111, 0, 0, 0.525],\n \"74\": [0, 0.61111, 0, 0, 0.525],\n \"75\": [0, 0.61111, 0, 0, 0.525],\n \"76\": [0, 0.61111, 0, 0, 0.525],\n \"77\": [0, 0.61111, 0, 0, 0.525],\n \"78\": [0, 0.61111, 0, 0, 0.525],\n \"79\": [0, 0.61111, 0, 0, 0.525],\n \"80\": [0, 0.61111, 0, 0, 0.525],\n \"81\": [0.13889, 0.61111, 0, 0, 0.525],\n \"82\": [0, 0.61111, 0, 0, 0.525],\n \"83\": [0, 0.61111, 0, 0, 0.525],\n \"84\": [0, 0.61111, 0, 0, 0.525],\n \"85\": [0, 0.61111, 0, 0, 0.525],\n \"86\": [0, 0.61111, 0, 0, 0.525],\n \"87\": [0, 0.61111, 0, 0, 0.525],\n \"88\": [0, 0.61111, 0, 0, 0.525],\n \"89\": [0, 0.61111, 0, 0, 0.525],\n \"90\": [0, 0.61111, 0, 0, 0.525],\n \"91\": [0.08333, 0.69444, 0, 0, 0.525],\n \"92\": [0.08333, 0.69444, 0, 0, 0.525],\n \"93\": [0.08333, 0.69444, 0, 0, 0.525],\n \"94\": [0, 0.61111, 0, 0, 0.525],\n \"95\": [0.09514, 0, 0, 0, 0.525],\n \"96\": [0, 0.61111, 0, 0, 0.525],\n \"97\": [0, 0.43056, 0, 0, 0.525],\n \"98\": [0, 0.61111, 0, 0, 0.525],\n \"99\": [0, 0.43056, 0, 0, 0.525],\n \"100\": [0, 0.61111, 0, 0, 0.525],\n \"101\": [0, 0.43056, 0, 0, 0.525],\n \"102\": [0, 0.61111, 0, 0, 0.525],\n \"103\": [0.22222, 0.43056, 0, 0, 0.525],\n \"104\": [0, 0.61111, 0, 0, 0.525],\n \"105\": [0, 0.61111, 0, 0, 0.525],\n \"106\": [0.22222, 0.61111, 0, 0, 0.525],\n \"107\": [0, 0.61111, 0, 0, 0.525],\n \"108\": [0, 0.61111, 0, 0, 0.525],\n \"109\": [0, 0.43056, 0, 0, 0.525],\n \"110\": [0, 0.43056, 0, 0, 0.525],\n \"111\": [0, 0.43056, 0, 0, 0.525],\n \"112\": [0.22222, 0.43056, 0, 0, 0.525],\n \"113\": [0.22222, 0.43056, 0, 0, 0.525],\n \"114\": [0, 0.43056, 0, 0, 0.525],\n \"115\": [0, 0.43056, 0, 0, 0.525],\n \"116\": [0, 0.55358, 0, 0, 0.525],\n \"117\": [0, 0.43056, 0, 0, 0.525],\n \"118\": [0, 0.43056, 0, 0, 0.525],\n \"119\": [0, 0.43056, 0, 0, 0.525],\n \"120\": [0, 0.43056, 0, 0, 0.525],\n \"121\": [0.22222, 0.43056, 0, 0, 0.525],\n \"122\": [0, 0.43056, 0, 0, 0.525],\n \"123\": [0.08333, 0.69444, 0, 0, 0.525],\n \"124\": [0.08333, 0.69444, 0, 0, 0.525],\n \"125\": [0.08333, 0.69444, 0, 0, 0.525],\n \"126\": [0, 0.61111, 0, 0, 0.525],\n \"127\": [0, 0.61111, 0, 0, 0.525],\n \"160\": [0, 0, 0, 0, 0.525],\n \"176\": [0, 0.61111, 0, 0, 0.525],\n \"184\": [0.19445, 0, 0, 0, 0.525],\n \"305\": [0, 0.43056, 0, 0, 0.525],\n \"567\": [0.22222, 0.43056, 0, 0, 0.525],\n \"711\": [0, 0.56597, 0, 0, 0.525],\n \"713\": [0, 0.56555, 0, 0, 0.525],\n \"714\": [0, 0.61111, 0, 0, 0.525],\n \"715\": [0, 0.61111, 0, 0, 0.525],\n \"728\": [0, 0.61111, 0, 0, 0.525],\n \"730\": [0, 0.61111, 0, 0, 0.525],\n \"770\": [0, 0.61111, 0, 0, 0.525],\n \"771\": [0, 0.61111, 0, 0, 0.525],\n \"776\": [0, 0.61111, 0, 0, 0.525],\n \"915\": [0, 0.61111, 0, 0, 0.525],\n \"916\": [0, 0.61111, 0, 0, 0.525],\n \"920\": [0, 0.61111, 0, 0, 0.525],\n \"923\": [0, 0.61111, 0, 0, 0.525],\n \"926\": [0, 0.61111, 0, 0, 0.525],\n \"928\": [0, 0.61111, 0, 0, 0.525],\n \"931\": [0, 0.61111, 0, 0, 0.525],\n \"933\": [0, 0.61111, 0, 0, 0.525],\n \"934\": [0, 0.61111, 0, 0, 0.525],\n \"936\": [0, 0.61111, 0, 0, 0.525],\n \"937\": [0, 0.61111, 0, 0, 0.525],\n \"8216\": [0, 0.61111, 0, 0, 0.525],\n \"8217\": [0, 0.61111, 0, 0, 0.525],\n \"8242\": [0, 0.61111, 0, 0, 0.525],\n \"9251\": [0.11111, 0.21944, 0, 0, 0.525]\n }\n};\n\n/**\n * This file contains metrics regarding fonts and individual symbols. The sigma\n * and xi variables, as well as the metricMap map contain data extracted from\n * TeX, TeX font metrics, and the TTF files. These data are then exposed via the\n * `metrics` variable and the getCharacterMetrics function.\n */\n// In TeX, there are actually three sets of dimensions, one for each of\n// textstyle (size index 5 and higher: >=9pt), scriptstyle (size index 3 and 4:\n// 7-8pt), and scriptscriptstyle (size index 1 and 2: 5-6pt). These are\n// provided in the arrays below, in that order.\n//\n// The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5 respectively.\n// This was determined by running the following script:\n//\n// latex -interaction=nonstopmode \\\n// '\\documentclass{article}\\usepackage{amsmath}\\begin{document}' \\\n// '$a$ \\expandafter\\show\\the\\textfont2' \\\n// '\\expandafter\\show\\the\\scriptfont2' \\\n// '\\expandafter\\show\\the\\scriptscriptfont2' \\\n// '\\stop'\n//\n// The metrics themselves were retrieved using the following commands:\n//\n// tftopl cmsy10\n// tftopl cmsy7\n// tftopl cmsy5\n//\n// The output of each of these commands is quite lengthy. The only part we\n// care about is the FONTDIMEN section. Each value is measured in EMs.\nvar sigmasAndXis = {\n slant: [0.250, 0.250, 0.250],\n // sigma1\n space: [0.000, 0.000, 0.000],\n // sigma2\n stretch: [0.000, 0.000, 0.000],\n // sigma3\n shrink: [0.000, 0.000, 0.000],\n // sigma4\n xHeight: [0.431, 0.431, 0.431],\n // sigma5\n quad: [1.000, 1.171, 1.472],\n // sigma6\n extraSpace: [0.000, 0.000, 0.000],\n // sigma7\n num1: [0.677, 0.732, 0.925],\n // sigma8\n num2: [0.394, 0.384, 0.387],\n // sigma9\n num3: [0.444, 0.471, 0.504],\n // sigma10\n denom1: [0.686, 0.752, 1.025],\n // sigma11\n denom2: [0.345, 0.344, 0.532],\n // sigma12\n sup1: [0.413, 0.503, 0.504],\n // sigma13\n sup2: [0.363, 0.431, 0.404],\n // sigma14\n sup3: [0.289, 0.286, 0.294],\n // sigma15\n sub1: [0.150, 0.143, 0.200],\n // sigma16\n sub2: [0.247, 0.286, 0.400],\n // sigma17\n supDrop: [0.386, 0.353, 0.494],\n // sigma18\n subDrop: [0.050, 0.071, 0.100],\n // sigma19\n delim1: [2.390, 1.700, 1.980],\n // sigma20\n delim2: [1.010, 1.157, 1.420],\n // sigma21\n axisHeight: [0.250, 0.250, 0.250],\n // sigma22\n // These font metrics are extracted from TeX by using tftopl on cmex10.tfm;\n // they correspond to the font parameters of the extension fonts (family 3).\n // See the TeXbook, page 441. In AMSTeX, the extension fonts scale; to\n // match cmex7, we'd use cmex7.tfm values for script and scriptscript\n // values.\n defaultRuleThickness: [0.04, 0.049, 0.049],\n // xi8; cmex7: 0.049\n bigOpSpacing1: [0.111, 0.111, 0.111],\n // xi9\n bigOpSpacing2: [0.166, 0.166, 0.166],\n // xi10\n bigOpSpacing3: [0.2, 0.2, 0.2],\n // xi11\n bigOpSpacing4: [0.6, 0.611, 0.611],\n // xi12; cmex7: 0.611\n bigOpSpacing5: [0.1, 0.143, 0.143],\n // xi13; cmex7: 0.143\n // The \\sqrt rule width is taken from the height of the surd character.\n // Since we use the same font at all sizes, this thickness doesn't scale.\n sqrtRuleThickness: [0.04, 0.04, 0.04],\n // This value determines how large a pt is, for metrics which are defined\n // in terms of pts.\n // This value is also used in katex.scss; if you change it make sure the\n // values match.\n ptPerEm: [10.0, 10.0, 10.0],\n // The space between adjacent `|` columns in an array definition. From\n // `\\showthe\\doublerulesep` in LaTeX. Equals 2.0 / ptPerEm.\n doubleRuleSep: [0.2, 0.2, 0.2],\n // The width of separator lines in {array} environments. From\n // `\\showthe\\arrayrulewidth` in LaTeX. Equals 0.4 / ptPerEm.\n arrayRuleWidth: [0.04, 0.04, 0.04],\n // Two values from LaTeX source2e:\n fboxsep: [0.3, 0.3, 0.3],\n // 3 pt / ptPerEm\n fboxrule: [0.04, 0.04, 0.04] // 0.4 pt / ptPerEm\n\n}; // This map contains a mapping from font name and character code to character\n// should have Latin-1 and Cyrillic characters, but may not depending on the\n// operating system. The metrics do not account for extra height from the\n// accents. In the case of Cyrillic characters which have both ascenders and\n// descenders we prefer approximations with ascenders, primarily to prevent\n// the fraction bar or root line from intersecting the glyph.\n// TODO(kevinb) allow union of multiple glyph metrics for better accuracy.\n\nvar extraCharacterMap = {\n // Latin-1\n '\u00C5': 'A',\n '\u00D0': 'D',\n '\u00DE': 'o',\n '\u00E5': 'a',\n '\u00F0': 'd',\n '\u00FE': 'o',\n // Cyrillic\n '\u0410': 'A',\n '\u0411': 'B',\n '\u0412': 'B',\n '\u0413': 'F',\n '\u0414': 'A',\n '\u0415': 'E',\n '\u0416': 'K',\n '\u0417': '3',\n '\u0418': 'N',\n '\u0419': 'N',\n '\u041A': 'K',\n '\u041B': 'N',\n '\u041C': 'M',\n '\u041D': 'H',\n '\u041E': 'O',\n '\u041F': 'N',\n '\u0420': 'P',\n '\u0421': 'C',\n '\u0422': 'T',\n '\u0423': 'y',\n '\u0424': 'O',\n '\u0425': 'X',\n '\u0426': 'U',\n '\u0427': 'h',\n '\u0428': 'W',\n '\u0429': 'W',\n '\u042A': 'B',\n '\u042B': 'X',\n '\u042C': 'B',\n '\u042D': '3',\n '\u042E': 'X',\n '\u042F': 'R',\n '\u0430': 'a',\n '\u0431': 'b',\n '\u0432': 'a',\n '\u0433': 'r',\n '\u0434': 'y',\n '\u0435': 'e',\n '\u0436': 'm',\n '\u0437': 'e',\n '\u0438': 'n',\n '\u0439': 'n',\n '\u043A': 'n',\n '\u043B': 'n',\n '\u043C': 'm',\n '\u043D': 'n',\n '\u043E': 'o',\n '\u043F': 'n',\n '\u0440': 'p',\n '\u0441': 'c',\n '\u0442': 'o',\n '\u0443': 'y',\n '\u0444': 'b',\n '\u0445': 'x',\n '\u0446': 'n',\n '\u0447': 'n',\n '\u0448': 'w',\n '\u0449': 'w',\n '\u044A': 'a',\n '\u044B': 'm',\n '\u044C': 'a',\n '\u044D': 'e',\n '\u044E': 'm',\n '\u044F': 'r'\n};\n\n/**\n * This function adds new font metrics to default metricMap\n * It can also override existing metrics\n */\nfunction setFontMetrics(fontName, metrics) {\n fontMetricsData[fontName] = metrics;\n}\n/**\n * This function is a convenience function for looking up information in the\n * metricMap table. It takes a character as a string, and a font.\n *\n * Note: the `width` property may be undefined if fontMetricsData.js wasn't\n * built using `Make extended_metrics`.\n */\n\nfunction getCharacterMetrics(character, font, mode) {\n if (!fontMetricsData[font]) {\n throw new Error(\"Font metrics not found for font: \" + font + \".\");\n }\n\n var ch = character.charCodeAt(0);\n var metrics = fontMetricsData[font][ch];\n\n if (!metrics && character[0] in extraCharacterMap) {\n ch = extraCharacterMap[character[0]].charCodeAt(0);\n metrics = fontMetricsData[font][ch];\n }\n\n if (!metrics && mode === 'text') {\n // We don't typically have font metrics for Asian scripts.\n // But since we support them in text mode, we need to return\n // some sort of metrics.\n // So if the character is in a script we support but we\n // don't have metrics for it, just use the metrics for\n // the Latin capital letter M. This is close enough because\n // we (currently) only care about the height of the glyph\n // not its width.\n if (supportedCodepoint(ch)) {\n metrics = fontMetricsData[font][77]; // 77 is the charcode for 'M'\n }\n }\n\n if (metrics) {\n return {\n depth: metrics[0],\n height: metrics[1],\n italic: metrics[2],\n skew: metrics[3],\n width: metrics[4]\n };\n }\n}\nvar fontMetricsBySizeIndex = {};\n/**\n * Get the font metrics for a given size.\n */\n\nfunction getGlobalMetrics(size) {\n var sizeIndex;\n\n if (size >= 5) {\n sizeIndex = 0;\n } else if (size >= 3) {\n sizeIndex = 1;\n } else {\n sizeIndex = 2;\n }\n\n if (!fontMetricsBySizeIndex[sizeIndex]) {\n var metrics = fontMetricsBySizeIndex[sizeIndex] = {\n cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18\n };\n\n for (var key in sigmasAndXis) {\n if (sigmasAndXis.hasOwnProperty(key)) {\n metrics[key] = sigmasAndXis[key][sizeIndex];\n }\n }\n }\n\n return fontMetricsBySizeIndex[sizeIndex];\n}\n\n/**\n * This file contains information about the options that the Parser carries\n * around with it while parsing. Data is held in an `Options` object, and when\n * recursing, a new `Options` object can be created with the `.with*` and\n * `.reset` functions.\n */\nvar sizeStyleMap = [// Each element contains [textsize, scriptsize, scriptscriptsize].\n// The size mappings are taken from TeX with \\normalsize=10pt.\n[1, 1, 1], // size1: [5, 5, 5] \\tiny\n[2, 1, 1], // size2: [6, 5, 5]\n[3, 1, 1], // size3: [7, 5, 5] \\scriptsize\n[4, 2, 1], // size4: [8, 6, 5] \\footnotesize\n[5, 2, 1], // size5: [9, 6, 5] \\small\n[6, 3, 1], // size6: [10, 7, 5] \\normalsize\n[7, 4, 2], // size7: [12, 8, 6] \\large\n[8, 6, 3], // size8: [14.4, 10, 7] \\Large\n[9, 7, 6], // size9: [17.28, 12, 10] \\LARGE\n[10, 8, 7], // size10: [20.74, 14.4, 12] \\huge\n[11, 10, 9] // size11: [24.88, 20.74, 17.28] \\HUGE\n];\nvar sizeMultipliers = [// fontMetrics.js:getGlobalMetrics also uses size indexes, so if\n// you change size indexes, change that function.\n0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.44, 1.728, 2.074, 2.488];\n\nvar sizeAtStyle = function sizeAtStyle(size, style) {\n return style.size < 2 ? size : sizeStyleMap[size - 1][style.size - 1];\n}; // In these types, \"\" (empty string) means \"no change\".\n\n\n/**\n * This is the main options class. It contains the current style, size, color,\n * and font.\n *\n * Options objects should not be modified. To create a new Options with\n * different properties, call a `.having*` method.\n */\nclass Options {\n // A font family applies to a group of fonts (i.e. SansSerif), while a font\n // represents a specific font (i.e. SansSerif Bold).\n // See: https://tex.stackexchange.com/questions/22350/difference-between-textrm-and-mathrm\n\n /**\n * The base size index.\n */\n constructor(data) {\n this.style = void 0;\n this.color = void 0;\n this.size = void 0;\n this.textSize = void 0;\n this.phantom = void 0;\n this.font = void 0;\n this.fontFamily = void 0;\n this.fontWeight = void 0;\n this.fontShape = void 0;\n this.sizeMultiplier = void 0;\n this.maxSize = void 0;\n this.minRuleThickness = void 0;\n this._fontMetrics = void 0;\n this.style = data.style;\n this.color = data.color;\n this.size = data.size || Options.BASESIZE;\n this.textSize = data.textSize || this.size;\n this.phantom = !!data.phantom;\n this.font = data.font || \"\";\n this.fontFamily = data.fontFamily || \"\";\n this.fontWeight = data.fontWeight || '';\n this.fontShape = data.fontShape || '';\n this.sizeMultiplier = sizeMultipliers[this.size - 1];\n this.maxSize = data.maxSize;\n this.minRuleThickness = data.minRuleThickness;\n this._fontMetrics = undefined;\n }\n /**\n * Returns a new options object with the same properties as \"this\". Properties\n * from \"extension\" will be copied to the new options object.\n */\n\n\n extend(extension) {\n var data = {\n style: this.style,\n size: this.size,\n textSize: this.textSize,\n color: this.color,\n phantom: this.phantom,\n font: this.font,\n fontFamily: this.fontFamily,\n fontWeight: this.fontWeight,\n fontShape: this.fontShape,\n maxSize: this.maxSize,\n minRuleThickness: this.minRuleThickness\n };\n\n for (var key in extension) {\n if (extension.hasOwnProperty(key)) {\n data[key] = extension[key];\n }\n }\n\n return new Options(data);\n }\n /**\n * Return an options object with the given style. If `this.style === style`,\n * returns `this`.\n */\n\n\n havingStyle(style) {\n if (this.style === style) {\n return this;\n } else {\n return this.extend({\n style: style,\n size: sizeAtStyle(this.textSize, style)\n });\n }\n }\n /**\n * Return an options object with a cramped version of the current style. If\n * the current style is cramped, returns `this`.\n */\n\n\n havingCrampedStyle() {\n return this.havingStyle(this.style.cramp());\n }\n /**\n * Return an options object with the given size and in at least `\\textstyle`.\n * Returns `this` if appropriate.\n */\n\n\n havingSize(size) {\n if (this.size === size && this.textSize === size) {\n return this;\n } else {\n return this.extend({\n style: this.style.text(),\n size: size,\n textSize: size,\n sizeMultiplier: sizeMultipliers[size - 1]\n });\n }\n }\n /**\n * Like `this.havingSize(BASESIZE).havingStyle(style)`. If `style` is omitted,\n * changes to at least `\\textstyle`.\n */\n\n\n havingBaseStyle(style) {\n style = style || this.style.text();\n var wantSize = sizeAtStyle(Options.BASESIZE, style);\n\n if (this.size === wantSize && this.textSize === Options.BASESIZE && this.style === style) {\n return this;\n } else {\n return this.extend({\n style: style,\n size: wantSize\n });\n }\n }\n /**\n * Remove the effect of sizing changes such as \\Huge.\n * Keep the effect of the current style, such as \\scriptstyle.\n */\n\n\n havingBaseSizing() {\n var size;\n\n switch (this.style.id) {\n case 4:\n case 5:\n size = 3; // normalsize in scriptstyle\n\n break;\n\n case 6:\n case 7:\n size = 1; // normalsize in scriptscriptstyle\n\n break;\n\n default:\n size = 6;\n // normalsize in textstyle or displaystyle\n }\n\n return this.extend({\n style: this.style.text(),\n size: size\n });\n }\n /**\n * Create a new options object with the given color.\n */\n\n\n withColor(color) {\n return this.extend({\n color: color\n });\n }\n /**\n * Create a new options object with \"phantom\" set to true.\n */\n\n\n withPhantom() {\n return this.extend({\n phantom: true\n });\n }\n /**\n * Creates a new options object with the given math font or old text font.\n * @type {[type]}\n */\n\n\n withFont(font) {\n return this.extend({\n font\n });\n }\n /**\n * Create a new options objects with the given fontFamily.\n */\n\n\n withTextFontFamily(fontFamily) {\n return this.extend({\n fontFamily,\n font: \"\"\n });\n }\n /**\n * Creates a new options object with the given font weight\n */\n\n\n withTextFontWeight(fontWeight) {\n return this.extend({\n fontWeight,\n font: \"\"\n });\n }\n /**\n * Creates a new options object with the given font weight\n */\n\n\n withTextFontShape(fontShape) {\n return this.extend({\n fontShape,\n font: \"\"\n });\n }\n /**\n * Return the CSS sizing classes required to switch from enclosing options\n * `oldOptions` to `this`. Returns an array of classes.\n */\n\n\n sizingClasses(oldOptions) {\n if (oldOptions.size !== this.size) {\n return [\"sizing\", \"reset-size\" + oldOptions.size, \"size\" + this.size];\n } else {\n return [];\n }\n }\n /**\n * Return the CSS sizing classes required to switch to the base size. Like\n * `this.havingSize(BASESIZE).sizingClasses(this)`.\n */\n\n\n baseSizingClasses() {\n if (this.size !== Options.BASESIZE) {\n return [\"sizing\", \"reset-size\" + this.size, \"size\" + Options.BASESIZE];\n } else {\n return [];\n }\n }\n /**\n * Return the font metrics for this size.\n */\n\n\n fontMetrics() {\n if (!this._fontMetrics) {\n this._fontMetrics = getGlobalMetrics(this.size);\n }\n\n return this._fontMetrics;\n }\n /**\n * Gets the CSS color of the current options object\n */\n\n\n getColor() {\n if (this.phantom) {\n return \"transparent\";\n } else {\n return this.color;\n }\n }\n\n}\n\nOptions.BASESIZE = 6;\n\n/**\n * This file does conversion between units. In particular, it provides\n * calculateSize to convert other units into ems.\n */\n// Thus, multiplying a length by this number converts the length from units\n// into pts. Dividing the result by ptPerEm gives the number of ems\n// *assuming* a font size of ptPerEm (normal size, normal style).\n\nvar ptPerUnit = {\n // https://en.wikibooks.org/wiki/LaTeX/Lengths and\n // https://tex.stackexchange.com/a/8263\n \"pt\": 1,\n // TeX point\n \"mm\": 7227 / 2540,\n // millimeter\n \"cm\": 7227 / 254,\n // centimeter\n \"in\": 72.27,\n // inch\n \"bp\": 803 / 800,\n // big (PostScript) points\n \"pc\": 12,\n // pica\n \"dd\": 1238 / 1157,\n // didot\n \"cc\": 14856 / 1157,\n // cicero (12 didot)\n \"nd\": 685 / 642,\n // new didot\n \"nc\": 1370 / 107,\n // new cicero (12 new didot)\n \"sp\": 1 / 65536,\n // scaled point (TeX's internal smallest unit)\n // https://tex.stackexchange.com/a/41371\n \"px\": 803 / 800 // \\pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX\n\n}; // Dictionary of relative units, for fast validity testing.\n\nvar relativeUnit = {\n \"ex\": true,\n \"em\": true,\n \"mu\": true\n};\n\n/**\n * Determine whether the specified unit (either a string defining the unit\n * or a \"size\" parse node containing a unit field) is valid.\n */\nvar validUnit = function validUnit(unit) {\n if (typeof unit !== \"string\") {\n unit = unit.unit;\n }\n\n return unit in ptPerUnit || unit in relativeUnit || unit === \"ex\";\n};\n/*\n * Convert a \"size\" parse node (with numeric \"number\" and string \"unit\" fields,\n * as parsed by functions.js argType \"size\") into a CSS em value for the\n * current style/scale. `options` gives the current options.\n */\n\nvar calculateSize = function calculateSize(sizeValue, options) {\n var scale;\n\n if (sizeValue.unit in ptPerUnit) {\n // Absolute units\n scale = ptPerUnit[sizeValue.unit] // Convert unit to pt\n / options.fontMetrics().ptPerEm // Convert pt to CSS em\n / options.sizeMultiplier; // Unscale to make absolute units\n } else if (sizeValue.unit === \"mu\") {\n // `mu` units scale with scriptstyle/scriptscriptstyle.\n scale = options.fontMetrics().cssEmPerMu;\n } else {\n // Other relative units always refer to the *textstyle* font\n // in the current size.\n var unitOptions;\n\n if (options.style.isTight()) {\n // isTight() means current style is script/scriptscript.\n unitOptions = options.havingStyle(options.style.text());\n } else {\n unitOptions = options;\n } // TODO: In TeX these units are relative to the quad of the current\n // *text* font, e.g. cmr10. KaTeX instead uses values from the\n // comparably-sized *Computer Modern symbol* font. At 10pt, these\n // match. At 7pt and 5pt, they differ: cmr7=1.138894, cmsy7=1.170641;\n // cmr5=1.361133, cmsy5=1.472241. Consider $\\scriptsize a\\kern1emb$.\n // TeX \\showlists shows a kern of 1.13889 * fontsize;\n // KaTeX shows a kern of 1.171 * fontsize.\n\n\n if (sizeValue.unit === \"ex\") {\n scale = unitOptions.fontMetrics().xHeight;\n } else if (sizeValue.unit === \"em\") {\n scale = unitOptions.fontMetrics().quad;\n } else {\n throw new ParseError(\"Invalid unit: '\" + sizeValue.unit + \"'\");\n }\n\n if (unitOptions !== options) {\n scale *= unitOptions.sizeMultiplier / options.sizeMultiplier;\n }\n }\n\n return Math.min(sizeValue.number * scale, options.maxSize);\n};\n/**\n * Round `n` to 4 decimal places, or to the nearest 1/10,000th em. See\n * https://github.com/KaTeX/KaTeX/pull/2460.\n */\n\nvar makeEm = function makeEm(n) {\n return +n.toFixed(4) + \"em\";\n};\n\n/**\n * These objects store the data about the DOM nodes we create, as well as some\n * extra data. They can then be transformed into real DOM nodes with the\n * `toNode` function or HTML markup using `toMarkup`. They are useful for both\n * storing extra properties on the nodes, as well as providing a way to easily\n * work with the DOM.\n *\n * Similar functions for working with MathML nodes exist in mathMLTree.js.\n *\n * TODO: refactor `span` and `anchor` into common superclass when\n * target environments support class inheritance\n */\n\n/**\n * Create an HTML className based on a list of classes. In addition to joining\n * with spaces, we also remove empty classes.\n */\nvar createClass = function createClass(classes) {\n return classes.filter(cls => cls).join(\" \");\n};\n\nvar initNode = function initNode(classes, options, style) {\n this.classes = classes || [];\n this.attributes = {};\n this.height = 0;\n this.depth = 0;\n this.maxFontSize = 0;\n this.style = style || {};\n\n if (options) {\n if (options.style.isTight()) {\n this.classes.push(\"mtight\");\n }\n\n var color = options.getColor();\n\n if (color) {\n this.style.color = color;\n }\n }\n};\n/**\n * Convert into an HTML node\n */\n\n\nvar toNode = function toNode(tagName) {\n var node = document.createElement(tagName); // Apply the class\n\n node.className = createClass(this.classes); // Apply inline styles\n\n for (var style in this.style) {\n if (this.style.hasOwnProperty(style)) {\n // $FlowFixMe Flow doesn't seem to understand span.style's type.\n node.style[style] = this.style[style];\n }\n } // Apply attributes\n\n\n for (var attr in this.attributes) {\n if (this.attributes.hasOwnProperty(attr)) {\n node.setAttribute(attr, this.attributes[attr]);\n }\n } // Append the children, also as HTML nodes\n\n\n for (var i = 0; i < this.children.length; i++) {\n node.appendChild(this.children[i].toNode());\n }\n\n return node;\n};\n/**\n * Convert into an HTML markup string\n */\n\n\nvar toMarkup = function toMarkup(tagName) {\n var markup = \"<\" + tagName; // Add the class\n\n if (this.classes.length) {\n markup += \" class=\\\"\" + utils.escape(createClass(this.classes)) + \"\\\"\";\n }\n\n var styles = \"\"; // Add the styles, after hyphenation\n\n for (var style in this.style) {\n if (this.style.hasOwnProperty(style)) {\n styles += utils.hyphenate(style) + \":\" + this.style[style] + \";\";\n }\n }\n\n if (styles) {\n markup += \" style=\\\"\" + utils.escape(styles) + \"\\\"\";\n } // Add the attributes\n\n\n for (var attr in this.attributes) {\n if (this.attributes.hasOwnProperty(attr)) {\n markup += \" \" + attr + \"=\\\"\" + utils.escape(this.attributes[attr]) + \"\\\"\";\n }\n }\n\n markup += \">\"; // Add the markup of the children, also as markup\n\n for (var i = 0; i < this.children.length; i++) {\n markup += this.children[i].toMarkup();\n }\n\n markup += \"\" + tagName + \">\";\n return markup;\n}; // Making the type below exact with all optional fields doesn't work due to\n// - https://github.com/facebook/flow/issues/4582\n// - https://github.com/facebook/flow/issues/5688\n// However, since *all* fields are optional, $Shape<> works as suggested in 5688\n// above.\n// This type does not include all CSS properties. Additional properties should\n// be added as needed.\n\n\n/**\n * This node represents a span node, with a className, a list of children, and\n * an inline style. It also contains information about its height, depth, and\n * maxFontSize.\n *\n * Represents two types with different uses: SvgSpan to wrap an SVG and DomSpan\n * otherwise. This typesafety is important when HTML builders access a span's\n * children.\n */\nclass Span {\n constructor(classes, children, options, style) {\n this.children = void 0;\n this.attributes = void 0;\n this.classes = void 0;\n this.height = void 0;\n this.depth = void 0;\n this.width = void 0;\n this.maxFontSize = void 0;\n this.style = void 0;\n initNode.call(this, classes, options, style);\n this.children = children || [];\n }\n /**\n * Sets an arbitrary attribute on the span. Warning: use this wisely. Not\n * all browsers support attributes the same, and having too many custom\n * attributes is probably bad.\n */\n\n\n setAttribute(attribute, value) {\n this.attributes[attribute] = value;\n }\n\n hasClass(className) {\n return utils.contains(this.classes, className);\n }\n\n toNode() {\n return toNode.call(this, \"span\");\n }\n\n toMarkup() {\n return toMarkup.call(this, \"span\");\n }\n\n}\n/**\n * This node represents an anchor () element with a hyperlink. See `span`\n * for further details.\n */\n\nclass Anchor {\n constructor(href, classes, children, options) {\n this.children = void 0;\n this.attributes = void 0;\n this.classes = void 0;\n this.height = void 0;\n this.depth = void 0;\n this.maxFontSize = void 0;\n this.style = void 0;\n initNode.call(this, classes, options);\n this.children = children || [];\n this.setAttribute('href', href);\n }\n\n setAttribute(attribute, value) {\n this.attributes[attribute] = value;\n }\n\n hasClass(className) {\n return utils.contains(this.classes, className);\n }\n\n toNode() {\n return toNode.call(this, \"a\");\n }\n\n toMarkup() {\n return toMarkup.call(this, \"a\");\n }\n\n}\n/**\n * This node represents an image embed ( ) element.\n */\n\nclass Img {\n constructor(src, alt, style) {\n this.src = void 0;\n this.alt = void 0;\n this.classes = void 0;\n this.height = void 0;\n this.depth = void 0;\n this.maxFontSize = void 0;\n this.style = void 0;\n this.alt = alt;\n this.src = src;\n this.classes = [\"mord\"];\n this.style = style;\n }\n\n hasClass(className) {\n return utils.contains(this.classes, className);\n }\n\n toNode() {\n var node = document.createElement(\"img\");\n node.src = this.src;\n node.alt = this.alt;\n node.className = \"mord\"; // Apply inline styles\n\n for (var style in this.style) {\n if (this.style.hasOwnProperty(style)) {\n // $FlowFixMe\n node.style[style] = this.style[style];\n }\n }\n\n return node;\n }\n\n toMarkup() {\n var markup = \" \";\n return markup;\n }\n\n}\nvar iCombinations = {\n '\u00EE': '\\u0131\\u0302',\n '\u00EF': '\\u0131\\u0308',\n '\u00ED': '\\u0131\\u0301',\n // '\u012B': '\\u0131\\u0304', // enable when we add Extended Latin\n '\u00EC': '\\u0131\\u0300'\n};\n/**\n * A symbol node contains information about a single symbol. It either renders\n * to a single text node, or a span with a single text node in it, depending on\n * whether it has CSS classes, styles, or needs italic correction.\n */\n\nclass SymbolNode {\n constructor(text, height, depth, italic, skew, width, classes, style) {\n this.text = void 0;\n this.height = void 0;\n this.depth = void 0;\n this.italic = void 0;\n this.skew = void 0;\n this.width = void 0;\n this.maxFontSize = void 0;\n this.classes = void 0;\n this.style = void 0;\n this.text = text;\n this.height = height || 0;\n this.depth = depth || 0;\n this.italic = italic || 0;\n this.skew = skew || 0;\n this.width = width || 0;\n this.classes = classes || [];\n this.style = style || {};\n this.maxFontSize = 0; // Mark text from non-Latin scripts with specific classes so that we\n // can specify which fonts to use. This allows us to render these\n // characters with a serif font in situations where the browser would\n // either default to a sans serif or render a placeholder character.\n // We use CSS class names like cjk_fallback, hangul_fallback and\n // brahmic_fallback. See ./unicodeScripts.js for the set of possible\n // script names\n\n var script = scriptFromCodepoint(this.text.charCodeAt(0));\n\n if (script) {\n this.classes.push(script + \"_fallback\");\n }\n\n if (/[\u00EE\u00EF\u00ED\u00EC]/.test(this.text)) {\n // add \u012B when we add Extended Latin\n this.text = iCombinations[this.text];\n }\n }\n\n hasClass(className) {\n return utils.contains(this.classes, className);\n }\n /**\n * Creates a text node or span from a symbol node. Note that a span is only\n * created if it is needed.\n */\n\n\n toNode() {\n var node = document.createTextNode(this.text);\n var span = null;\n\n if (this.italic > 0) {\n span = document.createElement(\"span\");\n span.style.marginRight = makeEm(this.italic);\n }\n\n if (this.classes.length > 0) {\n span = span || document.createElement(\"span\");\n span.className = createClass(this.classes);\n }\n\n for (var style in this.style) {\n if (this.style.hasOwnProperty(style)) {\n span = span || document.createElement(\"span\"); // $FlowFixMe Flow doesn't seem to understand span.style's type.\n\n span.style[style] = this.style[style];\n }\n }\n\n if (span) {\n span.appendChild(node);\n return span;\n } else {\n return node;\n }\n }\n /**\n * Creates markup for a symbol node.\n */\n\n\n toMarkup() {\n // TODO(alpert): More duplication than I'd like from\n // span.prototype.toMarkup and symbolNode.prototype.toNode...\n var needsSpan = false;\n var markup = \" 0) {\n styles += \"margin-right:\" + this.italic + \"em;\";\n }\n\n for (var style in this.style) {\n if (this.style.hasOwnProperty(style)) {\n styles += utils.hyphenate(style) + \":\" + this.style[style] + \";\";\n }\n }\n\n if (styles) {\n needsSpan = true;\n markup += \" style=\\\"\" + utils.escape(styles) + \"\\\"\";\n }\n\n var escaped = utils.escape(this.text);\n\n if (needsSpan) {\n markup += \">\";\n markup += escaped;\n markup += \" \";\n return markup;\n } else {\n return escaped;\n }\n }\n\n}\n/**\n * SVG nodes are used to render stretchy wide elements.\n */\n\nclass SvgNode {\n constructor(children, attributes) {\n this.children = void 0;\n this.attributes = void 0;\n this.children = children || [];\n this.attributes = attributes || {};\n }\n\n toNode() {\n var svgNS = \"http://www.w3.org/2000/svg\";\n var node = document.createElementNS(svgNS, \"svg\"); // Apply attributes\n\n for (var attr in this.attributes) {\n if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {\n node.setAttribute(attr, this.attributes[attr]);\n }\n }\n\n for (var i = 0; i < this.children.length; i++) {\n node.appendChild(this.children[i].toNode());\n }\n\n return node;\n }\n\n toMarkup() {\n var markup = \"\";\n\n for (var i = 0; i < this.children.length; i++) {\n markup += this.children[i].toMarkup();\n }\n\n markup += \" \";\n return markup;\n }\n\n}\nclass PathNode {\n constructor(pathName, alternate) {\n this.pathName = void 0;\n this.alternate = void 0;\n this.pathName = pathName;\n this.alternate = alternate; // Used only for \\sqrt, \\phase, & tall delims\n }\n\n toNode() {\n var svgNS = \"http://www.w3.org/2000/svg\";\n var node = document.createElementNS(svgNS, \"path\");\n\n if (this.alternate) {\n node.setAttribute(\"d\", this.alternate);\n } else {\n node.setAttribute(\"d\", path[this.pathName]);\n }\n\n return node;\n }\n\n toMarkup() {\n if (this.alternate) {\n return \" \";\n } else {\n return \" \";\n }\n }\n\n}\nclass LineNode {\n constructor(attributes) {\n this.attributes = void 0;\n this.attributes = attributes || {};\n }\n\n toNode() {\n var svgNS = \"http://www.w3.org/2000/svg\";\n var node = document.createElementNS(svgNS, \"line\"); // Apply attributes\n\n for (var attr in this.attributes) {\n if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {\n node.setAttribute(attr, this.attributes[attr]);\n }\n }\n\n return node;\n }\n\n toMarkup() {\n var markup = \" \";\n return markup;\n }\n\n}\nfunction assertSymbolDomNode(group) {\n if (group instanceof SymbolNode) {\n return group;\n } else {\n throw new Error(\"Expected symbolNode but got \" + String(group) + \".\");\n }\n}\nfunction assertSpan(group) {\n if (group instanceof Span) {\n return group;\n } else {\n throw new Error(\"Expected span but got \" + String(group) + \".\");\n }\n}\n\n/**\n * This file holds a list of all no-argument functions and single-character\n * symbols (like 'a' or ';').\n *\n * For each of the symbols, there are three properties they can have:\n * - font (required): the font to be used for this symbol. Either \"main\" (the\n normal font), or \"ams\" (the ams fonts).\n * - group (required): the ParseNode group type the symbol should have (i.e.\n \"textord\", \"mathord\", etc).\n See https://github.com/KaTeX/KaTeX/wiki/Examining-TeX#group-types\n * - replace: the character that this symbol or function should be\n * replaced with (i.e. \"\\phi\" has a replace value of \"\\u03d5\", the phi\n * character in the main font).\n *\n * The outermost map in the table indicates what mode the symbols should be\n * accepted in (e.g. \"math\" or \"text\").\n */\n// Some of these have a \"-token\" suffix since these are also used as `ParseNode`\n// types for raw text tokens, and we want to avoid conflicts with higher-level\n// `ParseNode` types. These `ParseNode`s are constructed within `Parser` by\n// looking up the `symbols` map.\nvar ATOMS = {\n \"bin\": 1,\n \"close\": 1,\n \"inner\": 1,\n \"open\": 1,\n \"punct\": 1,\n \"rel\": 1\n};\nvar NON_ATOMS = {\n \"accent-token\": 1,\n \"mathord\": 1,\n \"op-token\": 1,\n \"spacing\": 1,\n \"textord\": 1\n};\nvar symbols = {\n \"math\": {},\n \"text\": {}\n};\n/** `acceptUnicodeChar = true` is only applicable if `replace` is set. */\n\nfunction defineSymbol(mode, font, group, replace, name, acceptUnicodeChar) {\n symbols[mode][name] = {\n font,\n group,\n replace\n };\n\n if (acceptUnicodeChar && replace) {\n symbols[mode][replace] = symbols[mode][name];\n }\n} // Some abbreviations for commonly used strings.\n// This helps minify the code, and also spotting typos using jshint.\n// modes:\n\nvar math = \"math\";\nvar text = \"text\"; // fonts:\n\nvar main = \"main\";\nvar ams = \"ams\"; // groups:\n\nvar accent = \"accent-token\";\nvar bin = \"bin\";\nvar close = \"close\";\nvar inner = \"inner\";\nvar mathord = \"mathord\";\nvar op = \"op-token\";\nvar open = \"open\";\nvar punct = \"punct\";\nvar rel = \"rel\";\nvar spacing = \"spacing\";\nvar textord = \"textord\"; // Now comes the symbol table\n// Relation Symbols\n\ndefineSymbol(math, main, rel, \"\\u2261\", \"\\\\equiv\", true);\ndefineSymbol(math, main, rel, \"\\u227a\", \"\\\\prec\", true);\ndefineSymbol(math, main, rel, \"\\u227b\", \"\\\\succ\", true);\ndefineSymbol(math, main, rel, \"\\u223c\", \"\\\\sim\", true);\ndefineSymbol(math, main, rel, \"\\u22a5\", \"\\\\perp\");\ndefineSymbol(math, main, rel, \"\\u2aaf\", \"\\\\preceq\", true);\ndefineSymbol(math, main, rel, \"\\u2ab0\", \"\\\\succeq\", true);\ndefineSymbol(math, main, rel, \"\\u2243\", \"\\\\simeq\", true);\ndefineSymbol(math, main, rel, \"\\u2223\", \"\\\\mid\", true);\ndefineSymbol(math, main, rel, \"\\u226a\", \"\\\\ll\", true);\ndefineSymbol(math, main, rel, \"\\u226b\", \"\\\\gg\", true);\ndefineSymbol(math, main, rel, \"\\u224d\", \"\\\\asymp\", true);\ndefineSymbol(math, main, rel, \"\\u2225\", \"\\\\parallel\");\ndefineSymbol(math, main, rel, \"\\u22c8\", \"\\\\bowtie\", true);\ndefineSymbol(math, main, rel, \"\\u2323\", \"\\\\smile\", true);\ndefineSymbol(math, main, rel, \"\\u2291\", \"\\\\sqsubseteq\", true);\ndefineSymbol(math, main, rel, \"\\u2292\", \"\\\\sqsupseteq\", true);\ndefineSymbol(math, main, rel, \"\\u2250\", \"\\\\doteq\", true);\ndefineSymbol(math, main, rel, \"\\u2322\", \"\\\\frown\", true);\ndefineSymbol(math, main, rel, \"\\u220b\", \"\\\\ni\", true);\ndefineSymbol(math, main, rel, \"\\u221d\", \"\\\\propto\", true);\ndefineSymbol(math, main, rel, \"\\u22a2\", \"\\\\vdash\", true);\ndefineSymbol(math, main, rel, \"\\u22a3\", \"\\\\dashv\", true);\ndefineSymbol(math, main, rel, \"\\u220b\", \"\\\\owns\"); // Punctuation\n\ndefineSymbol(math, main, punct, \"\\u002e\", \"\\\\ldotp\");\ndefineSymbol(math, main, punct, \"\\u22c5\", \"\\\\cdotp\"); // Misc Symbols\n\ndefineSymbol(math, main, textord, \"\\u0023\", \"\\\\#\");\ndefineSymbol(text, main, textord, \"\\u0023\", \"\\\\#\");\ndefineSymbol(math, main, textord, \"\\u0026\", \"\\\\&\");\ndefineSymbol(text, main, textord, \"\\u0026\", \"\\\\&\");\ndefineSymbol(math, main, textord, \"\\u2135\", \"\\\\aleph\", true);\ndefineSymbol(math, main, textord, \"\\u2200\", \"\\\\forall\", true);\ndefineSymbol(math, main, textord, \"\\u210f\", \"\\\\hbar\", true);\ndefineSymbol(math, main, textord, \"\\u2203\", \"\\\\exists\", true);\ndefineSymbol(math, main, textord, \"\\u2207\", \"\\\\nabla\", true);\ndefineSymbol(math, main, textord, \"\\u266d\", \"\\\\flat\", true);\ndefineSymbol(math, main, textord, \"\\u2113\", \"\\\\ell\", true);\ndefineSymbol(math, main, textord, \"\\u266e\", \"\\\\natural\", true);\ndefineSymbol(math, main, textord, \"\\u2663\", \"\\\\clubsuit\", true);\ndefineSymbol(math, main, textord, \"\\u2118\", \"\\\\wp\", true);\ndefineSymbol(math, main, textord, \"\\u266f\", \"\\\\sharp\", true);\ndefineSymbol(math, main, textord, \"\\u2662\", \"\\\\diamondsuit\", true);\ndefineSymbol(math, main, textord, \"\\u211c\", \"\\\\Re\", true);\ndefineSymbol(math, main, textord, \"\\u2661\", \"\\\\heartsuit\", true);\ndefineSymbol(math, main, textord, \"\\u2111\", \"\\\\Im\", true);\ndefineSymbol(math, main, textord, \"\\u2660\", \"\\\\spadesuit\", true);\ndefineSymbol(math, main, textord, \"\\u00a7\", \"\\\\S\", true);\ndefineSymbol(text, main, textord, \"\\u00a7\", \"\\\\S\");\ndefineSymbol(math, main, textord, \"\\u00b6\", \"\\\\P\", true);\ndefineSymbol(text, main, textord, \"\\u00b6\", \"\\\\P\"); // Math and Text\n\ndefineSymbol(math, main, textord, \"\\u2020\", \"\\\\dag\");\ndefineSymbol(text, main, textord, \"\\u2020\", \"\\\\dag\");\ndefineSymbol(text, main, textord, \"\\u2020\", \"\\\\textdagger\");\ndefineSymbol(math, main, textord, \"\\u2021\", \"\\\\ddag\");\ndefineSymbol(text, main, textord, \"\\u2021\", \"\\\\ddag\");\ndefineSymbol(text, main, textord, \"\\u2021\", \"\\\\textdaggerdbl\"); // Large Delimiters\n\ndefineSymbol(math, main, close, \"\\u23b1\", \"\\\\rmoustache\", true);\ndefineSymbol(math, main, open, \"\\u23b0\", \"\\\\lmoustache\", true);\ndefineSymbol(math, main, close, \"\\u27ef\", \"\\\\rgroup\", true);\ndefineSymbol(math, main, open, \"\\u27ee\", \"\\\\lgroup\", true); // Binary Operators\n\ndefineSymbol(math, main, bin, \"\\u2213\", \"\\\\mp\", true);\ndefineSymbol(math, main, bin, \"\\u2296\", \"\\\\ominus\", true);\ndefineSymbol(math, main, bin, \"\\u228e\", \"\\\\uplus\", true);\ndefineSymbol(math, main, bin, \"\\u2293\", \"\\\\sqcap\", true);\ndefineSymbol(math, main, bin, \"\\u2217\", \"\\\\ast\");\ndefineSymbol(math, main, bin, \"\\u2294\", \"\\\\sqcup\", true);\ndefineSymbol(math, main, bin, \"\\u25ef\", \"\\\\bigcirc\", true);\ndefineSymbol(math, main, bin, \"\\u2219\", \"\\\\bullet\", true);\ndefineSymbol(math, main, bin, \"\\u2021\", \"\\\\ddagger\");\ndefineSymbol(math, main, bin, \"\\u2240\", \"\\\\wr\", true);\ndefineSymbol(math, main, bin, \"\\u2a3f\", \"\\\\amalg\");\ndefineSymbol(math, main, bin, \"\\u0026\", \"\\\\And\"); // from amsmath\n// Arrow Symbols\n\ndefineSymbol(math, main, rel, \"\\u27f5\", \"\\\\longleftarrow\", true);\ndefineSymbol(math, main, rel, \"\\u21d0\", \"\\\\Leftarrow\", true);\ndefineSymbol(math, main, rel, \"\\u27f8\", \"\\\\Longleftarrow\", true);\ndefineSymbol(math, main, rel, \"\\u27f6\", \"\\\\longrightarrow\", true);\ndefineSymbol(math, main, rel, \"\\u21d2\", \"\\\\Rightarrow\", true);\ndefineSymbol(math, main, rel, \"\\u27f9\", \"\\\\Longrightarrow\", true);\ndefineSymbol(math, main, rel, \"\\u2194\", \"\\\\leftrightarrow\", true);\ndefineSymbol(math, main, rel, \"\\u27f7\", \"\\\\longleftrightarrow\", true);\ndefineSymbol(math, main, rel, \"\\u21d4\", \"\\\\Leftrightarrow\", true);\ndefineSymbol(math, main, rel, \"\\u27fa\", \"\\\\Longleftrightarrow\", true);\ndefineSymbol(math, main, rel, \"\\u21a6\", \"\\\\mapsto\", true);\ndefineSymbol(math, main, rel, \"\\u27fc\", \"\\\\longmapsto\", true);\ndefineSymbol(math, main, rel, \"\\u2197\", \"\\\\nearrow\", true);\ndefineSymbol(math, main, rel, \"\\u21a9\", \"\\\\hookleftarrow\", true);\ndefineSymbol(math, main, rel, \"\\u21aa\", \"\\\\hookrightarrow\", true);\ndefineSymbol(math, main, rel, \"\\u2198\", \"\\\\searrow\", true);\ndefineSymbol(math, main, rel, \"\\u21bc\", \"\\\\leftharpoonup\", true);\ndefineSymbol(math, main, rel, \"\\u21c0\", \"\\\\rightharpoonup\", true);\ndefineSymbol(math, main, rel, \"\\u2199\", \"\\\\swarrow\", true);\ndefineSymbol(math, main, rel, \"\\u21bd\", \"\\\\leftharpoondown\", true);\ndefineSymbol(math, main, rel, \"\\u21c1\", \"\\\\rightharpoondown\", true);\ndefineSymbol(math, main, rel, \"\\u2196\", \"\\\\nwarrow\", true);\ndefineSymbol(math, main, rel, \"\\u21cc\", \"\\\\rightleftharpoons\", true); // AMS Negated Binary Relations\n\ndefineSymbol(math, ams, rel, \"\\u226e\", \"\\\\nless\", true); // Symbol names preceded by \"@\" each have a corresponding macro.\n\ndefineSymbol(math, ams, rel, \"\\ue010\", \"\\\\@nleqslant\");\ndefineSymbol(math, ams, rel, \"\\ue011\", \"\\\\@nleqq\");\ndefineSymbol(math, ams, rel, \"\\u2a87\", \"\\\\lneq\", true);\ndefineSymbol(math, ams, rel, \"\\u2268\", \"\\\\lneqq\", true);\ndefineSymbol(math, ams, rel, \"\\ue00c\", \"\\\\@lvertneqq\");\ndefineSymbol(math, ams, rel, \"\\u22e6\", \"\\\\lnsim\", true);\ndefineSymbol(math, ams, rel, \"\\u2a89\", \"\\\\lnapprox\", true);\ndefineSymbol(math, ams, rel, \"\\u2280\", \"\\\\nprec\", true); // unicode-math maps \\u22e0 to \\npreccurlyeq. We'll use the AMS synonym.\n\ndefineSymbol(math, ams, rel, \"\\u22e0\", \"\\\\npreceq\", true);\ndefineSymbol(math, ams, rel, \"\\u22e8\", \"\\\\precnsim\", true);\ndefineSymbol(math, ams, rel, \"\\u2ab9\", \"\\\\precnapprox\", true);\ndefineSymbol(math, ams, rel, \"\\u2241\", \"\\\\nsim\", true);\ndefineSymbol(math, ams, rel, \"\\ue006\", \"\\\\@nshortmid\");\ndefineSymbol(math, ams, rel, \"\\u2224\", \"\\\\nmid\", true);\ndefineSymbol(math, ams, rel, \"\\u22ac\", \"\\\\nvdash\", true);\ndefineSymbol(math, ams, rel, \"\\u22ad\", \"\\\\nvDash\", true);\ndefineSymbol(math, ams, rel, \"\\u22ea\", \"\\\\ntriangleleft\");\ndefineSymbol(math, ams, rel, \"\\u22ec\", \"\\\\ntrianglelefteq\", true);\ndefineSymbol(math, ams, rel, \"\\u228a\", \"\\\\subsetneq\", true);\ndefineSymbol(math, ams, rel, \"\\ue01a\", \"\\\\@varsubsetneq\");\ndefineSymbol(math, ams, rel, \"\\u2acb\", \"\\\\subsetneqq\", true);\ndefineSymbol(math, ams, rel, \"\\ue017\", \"\\\\@varsubsetneqq\");\ndefineSymbol(math, ams, rel, \"\\u226f\", \"\\\\ngtr\", true);\ndefineSymbol(math, ams, rel, \"\\ue00f\", \"\\\\@ngeqslant\");\ndefineSymbol(math, ams, rel, \"\\ue00e\", \"\\\\@ngeqq\");\ndefineSymbol(math, ams, rel, \"\\u2a88\", \"\\\\gneq\", true);\ndefineSymbol(math, ams, rel, \"\\u2269\", \"\\\\gneqq\", true);\ndefineSymbol(math, ams, rel, \"\\ue00d\", \"\\\\@gvertneqq\");\ndefineSymbol(math, ams, rel, \"\\u22e7\", \"\\\\gnsim\", true);\ndefineSymbol(math, ams, rel, \"\\u2a8a\", \"\\\\gnapprox\", true);\ndefineSymbol(math, ams, rel, \"\\u2281\", \"\\\\nsucc\", true); // unicode-math maps \\u22e1 to \\nsucccurlyeq. We'll use the AMS synonym.\n\ndefineSymbol(math, ams, rel, \"\\u22e1\", \"\\\\nsucceq\", true);\ndefineSymbol(math, ams, rel, \"\\u22e9\", \"\\\\succnsim\", true);\ndefineSymbol(math, ams, rel, \"\\u2aba\", \"\\\\succnapprox\", true); // unicode-math maps \\u2246 to \\simneqq. We'll use the AMS synonym.\n\ndefineSymbol(math, ams, rel, \"\\u2246\", \"\\\\ncong\", true);\ndefineSymbol(math, ams, rel, \"\\ue007\", \"\\\\@nshortparallel\");\ndefineSymbol(math, ams, rel, \"\\u2226\", \"\\\\nparallel\", true);\ndefineSymbol(math, ams, rel, \"\\u22af\", \"\\\\nVDash\", true);\ndefineSymbol(math, ams, rel, \"\\u22eb\", \"\\\\ntriangleright\");\ndefineSymbol(math, ams, rel, \"\\u22ed\", \"\\\\ntrianglerighteq\", true);\ndefineSymbol(math, ams, rel, \"\\ue018\", \"\\\\@nsupseteqq\");\ndefineSymbol(math, ams, rel, \"\\u228b\", \"\\\\supsetneq\", true);\ndefineSymbol(math, ams, rel, \"\\ue01b\", \"\\\\@varsupsetneq\");\ndefineSymbol(math, ams, rel, \"\\u2acc\", \"\\\\supsetneqq\", true);\ndefineSymbol(math, ams, rel, \"\\ue019\", \"\\\\@varsupsetneqq\");\ndefineSymbol(math, ams, rel, \"\\u22ae\", \"\\\\nVdash\", true);\ndefineSymbol(math, ams, rel, \"\\u2ab5\", \"\\\\precneqq\", true);\ndefineSymbol(math, ams, rel, \"\\u2ab6\", \"\\\\succneqq\", true);\ndefineSymbol(math, ams, rel, \"\\ue016\", \"\\\\@nsubseteqq\");\ndefineSymbol(math, ams, bin, \"\\u22b4\", \"\\\\unlhd\");\ndefineSymbol(math, ams, bin, \"\\u22b5\", \"\\\\unrhd\"); // AMS Negated Arrows\n\ndefineSymbol(math, ams, rel, \"\\u219a\", \"\\\\nleftarrow\", true);\ndefineSymbol(math, ams, rel, \"\\u219b\", \"\\\\nrightarrow\", true);\ndefineSymbol(math, ams, rel, \"\\u21cd\", \"\\\\nLeftarrow\", true);\ndefineSymbol(math, ams, rel, \"\\u21cf\", \"\\\\nRightarrow\", true);\ndefineSymbol(math, ams, rel, \"\\u21ae\", \"\\\\nleftrightarrow\", true);\ndefineSymbol(math, ams, rel, \"\\u21ce\", \"\\\\nLeftrightarrow\", true); // AMS Misc\n\ndefineSymbol(math, ams, rel, \"\\u25b3\", \"\\\\vartriangle\");\ndefineSymbol(math, ams, textord, \"\\u210f\", \"\\\\hslash\");\ndefineSymbol(math, ams, textord, \"\\u25bd\", \"\\\\triangledown\");\ndefineSymbol(math, ams, textord, \"\\u25ca\", \"\\\\lozenge\");\ndefineSymbol(math, ams, textord, \"\\u24c8\", \"\\\\circledS\");\ndefineSymbol(math, ams, textord, \"\\u00ae\", \"\\\\circledR\");\ndefineSymbol(text, ams, textord, \"\\u00ae\", \"\\\\circledR\");\ndefineSymbol(math, ams, textord, \"\\u2221\", \"\\\\measuredangle\", true);\ndefineSymbol(math, ams, textord, \"\\u2204\", \"\\\\nexists\");\ndefineSymbol(math, ams, textord, \"\\u2127\", \"\\\\mho\");\ndefineSymbol(math, ams, textord, \"\\u2132\", \"\\\\Finv\", true);\ndefineSymbol(math, ams, textord, \"\\u2141\", \"\\\\Game\", true);\ndefineSymbol(math, ams, textord, \"\\u2035\", \"\\\\backprime\");\ndefineSymbol(math, ams, textord, \"\\u25b2\", \"\\\\blacktriangle\");\ndefineSymbol(math, ams, textord, \"\\u25bc\", \"\\\\blacktriangledown\");\ndefineSymbol(math, ams, textord, \"\\u25a0\", \"\\\\blacksquare\");\ndefineSymbol(math, ams, textord, \"\\u29eb\", \"\\\\blacklozenge\");\ndefineSymbol(math, ams, textord, \"\\u2605\", \"\\\\bigstar\");\ndefineSymbol(math, ams, textord, \"\\u2222\", \"\\\\sphericalangle\", true);\ndefineSymbol(math, ams, textord, \"\\u2201\", \"\\\\complement\", true); // unicode-math maps U+F0 to \\matheth. We map to AMS function \\eth\n\ndefineSymbol(math, ams, textord, \"\\u00f0\", \"\\\\eth\", true);\ndefineSymbol(text, main, textord, \"\\u00f0\", \"\\u00f0\");\ndefineSymbol(math, ams, textord, \"\\u2571\", \"\\\\diagup\");\ndefineSymbol(math, ams, textord, \"\\u2572\", \"\\\\diagdown\");\ndefineSymbol(math, ams, textord, \"\\u25a1\", \"\\\\square\");\ndefineSymbol(math, ams, textord, \"\\u25a1\", \"\\\\Box\");\ndefineSymbol(math, ams, textord, \"\\u25ca\", \"\\\\Diamond\"); // unicode-math maps U+A5 to \\mathyen. We map to AMS function \\yen\n\ndefineSymbol(math, ams, textord, \"\\u00a5\", \"\\\\yen\", true);\ndefineSymbol(text, ams, textord, \"\\u00a5\", \"\\\\yen\", true);\ndefineSymbol(math, ams, textord, \"\\u2713\", \"\\\\checkmark\", true);\ndefineSymbol(text, ams, textord, \"\\u2713\", \"\\\\checkmark\"); // AMS Hebrew\n\ndefineSymbol(math, ams, textord, \"\\u2136\", \"\\\\beth\", true);\ndefineSymbol(math, ams, textord, \"\\u2138\", \"\\\\daleth\", true);\ndefineSymbol(math, ams, textord, \"\\u2137\", \"\\\\gimel\", true); // AMS Greek\n\ndefineSymbol(math, ams, textord, \"\\u03dd\", \"\\\\digamma\", true);\ndefineSymbol(math, ams, textord, \"\\u03f0\", \"\\\\varkappa\"); // AMS Delimiters\n\ndefineSymbol(math, ams, open, \"\\u250c\", \"\\\\@ulcorner\", true);\ndefineSymbol(math, ams, close, \"\\u2510\", \"\\\\@urcorner\", true);\ndefineSymbol(math, ams, open, \"\\u2514\", \"\\\\@llcorner\", true);\ndefineSymbol(math, ams, close, \"\\u2518\", \"\\\\@lrcorner\", true); // AMS Binary Relations\n\ndefineSymbol(math, ams, rel, \"\\u2266\", \"\\\\leqq\", true);\ndefineSymbol(math, ams, rel, \"\\u2a7d\", \"\\\\leqslant\", true);\ndefineSymbol(math, ams, rel, \"\\u2a95\", \"\\\\eqslantless\", true);\ndefineSymbol(math, ams, rel, \"\\u2272\", \"\\\\lesssim\", true);\ndefineSymbol(math, ams, rel, \"\\u2a85\", \"\\\\lessapprox\", true);\ndefineSymbol(math, ams, rel, \"\\u224a\", \"\\\\approxeq\", true);\ndefineSymbol(math, ams, bin, \"\\u22d6\", \"\\\\lessdot\");\ndefineSymbol(math, ams, rel, \"\\u22d8\", \"\\\\lll\", true);\ndefineSymbol(math, ams, rel, \"\\u2276\", \"\\\\lessgtr\", true);\ndefineSymbol(math, ams, rel, \"\\u22da\", \"\\\\lesseqgtr\", true);\ndefineSymbol(math, ams, rel, \"\\u2a8b\", \"\\\\lesseqqgtr\", true);\ndefineSymbol(math, ams, rel, \"\\u2251\", \"\\\\doteqdot\");\ndefineSymbol(math, ams, rel, \"\\u2253\", \"\\\\risingdotseq\", true);\ndefineSymbol(math, ams, rel, \"\\u2252\", \"\\\\fallingdotseq\", true);\ndefineSymbol(math, ams, rel, \"\\u223d\", \"\\\\backsim\", true);\ndefineSymbol(math, ams, rel, \"\\u22cd\", \"\\\\backsimeq\", true);\ndefineSymbol(math, ams, rel, \"\\u2ac5\", \"\\\\subseteqq\", true);\ndefineSymbol(math, ams, rel, \"\\u22d0\", \"\\\\Subset\", true);\ndefineSymbol(math, ams, rel, \"\\u228f\", \"\\\\sqsubset\", true);\ndefineSymbol(math, ams, rel, \"\\u227c\", \"\\\\preccurlyeq\", true);\ndefineSymbol(math, ams, rel, \"\\u22de\", \"\\\\curlyeqprec\", true);\ndefineSymbol(math, ams, rel, \"\\u227e\", \"\\\\precsim\", true);\ndefineSymbol(math, ams, rel, \"\\u2ab7\", \"\\\\precapprox\", true);\ndefineSymbol(math, ams, rel, \"\\u22b2\", \"\\\\vartriangleleft\");\ndefineSymbol(math, ams, rel, \"\\u22b4\", \"\\\\trianglelefteq\");\ndefineSymbol(math, ams, rel, \"\\u22a8\", \"\\\\vDash\", true);\ndefineSymbol(math, ams, rel, \"\\u22aa\", \"\\\\Vvdash\", true);\ndefineSymbol(math, ams, rel, \"\\u2323\", \"\\\\smallsmile\");\ndefineSymbol(math, ams, rel, \"\\u2322\", \"\\\\smallfrown\");\ndefineSymbol(math, ams, rel, \"\\u224f\", \"\\\\bumpeq\", true);\ndefineSymbol(math, ams, rel, \"\\u224e\", \"\\\\Bumpeq\", true);\ndefineSymbol(math, ams, rel, \"\\u2267\", \"\\\\geqq\", true);\ndefineSymbol(math, ams, rel, \"\\u2a7e\", \"\\\\geqslant\", true);\ndefineSymbol(math, ams, rel, \"\\u2a96\", \"\\\\eqslantgtr\", true);\ndefineSymbol(math, ams, rel, \"\\u2273\", \"\\\\gtrsim\", true);\ndefineSymbol(math, ams, rel, \"\\u2a86\", \"\\\\gtrapprox\", true);\ndefineSymbol(math, ams, bin, \"\\u22d7\", \"\\\\gtrdot\");\ndefineSymbol(math, ams, rel, \"\\u22d9\", \"\\\\ggg\", true);\ndefineSymbol(math, ams, rel, \"\\u2277\", \"\\\\gtrless\", true);\ndefineSymbol(math, ams, rel, \"\\u22db\", \"\\\\gtreqless\", true);\ndefineSymbol(math, ams, rel, \"\\u2a8c\", \"\\\\gtreqqless\", true);\ndefineSymbol(math, ams, rel, \"\\u2256\", \"\\\\eqcirc\", true);\ndefineSymbol(math, ams, rel, \"\\u2257\", \"\\\\circeq\", true);\ndefineSymbol(math, ams, rel, \"\\u225c\", \"\\\\triangleq\", true);\ndefineSymbol(math, ams, rel, \"\\u223c\", \"\\\\thicksim\");\ndefineSymbol(math, ams, rel, \"\\u2248\", \"\\\\thickapprox\");\ndefineSymbol(math, ams, rel, \"\\u2ac6\", \"\\\\supseteqq\", true);\ndefineSymbol(math, ams, rel, \"\\u22d1\", \"\\\\Supset\", true);\ndefineSymbol(math, ams, rel, \"\\u2290\", \"\\\\sqsupset\", true);\ndefineSymbol(math, ams, rel, \"\\u227d\", \"\\\\succcurlyeq\", true);\ndefineSymbol(math, ams, rel, \"\\u22df\", \"\\\\curlyeqsucc\", true);\ndefineSymbol(math, ams, rel, \"\\u227f\", \"\\\\succsim\", true);\ndefineSymbol(math, ams, rel, \"\\u2ab8\", \"\\\\succapprox\", true);\ndefineSymbol(math, ams, rel, \"\\u22b3\", \"\\\\vartriangleright\");\ndefineSymbol(math, ams, rel, \"\\u22b5\", \"\\\\trianglerighteq\");\ndefineSymbol(math, ams, rel, \"\\u22a9\", \"\\\\Vdash\", true);\ndefineSymbol(math, ams, rel, \"\\u2223\", \"\\\\shortmid\");\ndefineSymbol(math, ams, rel, \"\\u2225\", \"\\\\shortparallel\");\ndefineSymbol(math, ams, rel, \"\\u226c\", \"\\\\between\", true);\ndefineSymbol(math, ams, rel, \"\\u22d4\", \"\\\\pitchfork\", true);\ndefineSymbol(math, ams, rel, \"\\u221d\", \"\\\\varpropto\");\ndefineSymbol(math, ams, rel, \"\\u25c0\", \"\\\\blacktriangleleft\"); // unicode-math says that \\therefore is a mathord atom.\n// We kept the amssymb atom type, which is rel.\n\ndefineSymbol(math, ams, rel, \"\\u2234\", \"\\\\therefore\", true);\ndefineSymbol(math, ams, rel, \"\\u220d\", \"\\\\backepsilon\");\ndefineSymbol(math, ams, rel, \"\\u25b6\", \"\\\\blacktriangleright\"); // unicode-math says that \\because is a mathord atom.\n// We kept the amssymb atom type, which is rel.\n\ndefineSymbol(math, ams, rel, \"\\u2235\", \"\\\\because\", true);\ndefineSymbol(math, ams, rel, \"\\u22d8\", \"\\\\llless\");\ndefineSymbol(math, ams, rel, \"\\u22d9\", \"\\\\gggtr\");\ndefineSymbol(math, ams, bin, \"\\u22b2\", \"\\\\lhd\");\ndefineSymbol(math, ams, bin, \"\\u22b3\", \"\\\\rhd\");\ndefineSymbol(math, ams, rel, \"\\u2242\", \"\\\\eqsim\", true);\ndefineSymbol(math, main, rel, \"\\u22c8\", \"\\\\Join\");\ndefineSymbol(math, ams, rel, \"\\u2251\", \"\\\\Doteq\", true); // AMS Binary Operators\n\ndefineSymbol(math, ams, bin, \"\\u2214\", \"\\\\dotplus\", true);\ndefineSymbol(math, ams, bin, \"\\u2216\", \"\\\\smallsetminus\");\ndefineSymbol(math, ams, bin, \"\\u22d2\", \"\\\\Cap\", true);\ndefineSymbol(math, ams, bin, \"\\u22d3\", \"\\\\Cup\", true);\ndefineSymbol(math, ams, bin, \"\\u2a5e\", \"\\\\doublebarwedge\", true);\ndefineSymbol(math, ams, bin, \"\\u229f\", \"\\\\boxminus\", true);\ndefineSymbol(math, ams, bin, \"\\u229e\", \"\\\\boxplus\", true);\ndefineSymbol(math, ams, bin, \"\\u22c7\", \"\\\\divideontimes\", true);\ndefineSymbol(math, ams, bin, \"\\u22c9\", \"\\\\ltimes\", true);\ndefineSymbol(math, ams, bin, \"\\u22ca\", \"\\\\rtimes\", true);\ndefineSymbol(math, ams, bin, \"\\u22cb\", \"\\\\leftthreetimes\", true);\ndefineSymbol(math, ams, bin, \"\\u22cc\", \"\\\\rightthreetimes\", true);\ndefineSymbol(math, ams, bin, \"\\u22cf\", \"\\\\curlywedge\", true);\ndefineSymbol(math, ams, bin, \"\\u22ce\", \"\\\\curlyvee\", true);\ndefineSymbol(math, ams, bin, \"\\u229d\", \"\\\\circleddash\", true);\ndefineSymbol(math, ams, bin, \"\\u229b\", \"\\\\circledast\", true);\ndefineSymbol(math, ams, bin, \"\\u22c5\", \"\\\\centerdot\");\ndefineSymbol(math, ams, bin, \"\\u22ba\", \"\\\\intercal\", true);\ndefineSymbol(math, ams, bin, \"\\u22d2\", \"\\\\doublecap\");\ndefineSymbol(math, ams, bin, \"\\u22d3\", \"\\\\doublecup\");\ndefineSymbol(math, ams, bin, \"\\u22a0\", \"\\\\boxtimes\", true); // AMS Arrows\n// Note: unicode-math maps \\u21e2 to their own function \\rightdasharrow.\n// We'll map it to AMS function \\dashrightarrow. It produces the same atom.\n\ndefineSymbol(math, ams, rel, \"\\u21e2\", \"\\\\dashrightarrow\", true); // unicode-math maps \\u21e0 to \\leftdasharrow. We'll use the AMS synonym.\n\ndefineSymbol(math, ams, rel, \"\\u21e0\", \"\\\\dashleftarrow\", true);\ndefineSymbol(math, ams, rel, \"\\u21c7\", \"\\\\leftleftarrows\", true);\ndefineSymbol(math, ams, rel, \"\\u21c6\", \"\\\\leftrightarrows\", true);\ndefineSymbol(math, ams, rel, \"\\u21da\", \"\\\\Lleftarrow\", true);\ndefineSymbol(math, ams, rel, \"\\u219e\", \"\\\\twoheadleftarrow\", true);\ndefineSymbol(math, ams, rel, \"\\u21a2\", \"\\\\leftarrowtail\", true);\ndefineSymbol(math, ams, rel, \"\\u21ab\", \"\\\\looparrowleft\", true);\ndefineSymbol(math, ams, rel, \"\\u21cb\", \"\\\\leftrightharpoons\", true);\ndefineSymbol(math, ams, rel, \"\\u21b6\", \"\\\\curvearrowleft\", true); // unicode-math maps \\u21ba to \\acwopencirclearrow. We'll use the AMS synonym.\n\ndefineSymbol(math, ams, rel, \"\\u21ba\", \"\\\\circlearrowleft\", true);\ndefineSymbol(math, ams, rel, \"\\u21b0\", \"\\\\Lsh\", true);\ndefineSymbol(math, ams, rel, \"\\u21c8\", \"\\\\upuparrows\", true);\ndefineSymbol(math, ams, rel, \"\\u21bf\", \"\\\\upharpoonleft\", true);\ndefineSymbol(math, ams, rel, \"\\u21c3\", \"\\\\downharpoonleft\", true);\ndefineSymbol(math, main, rel, \"\\u22b6\", \"\\\\origof\", true); // not in font\n\ndefineSymbol(math, main, rel, \"\\u22b7\", \"\\\\imageof\", true); // not in font\n\ndefineSymbol(math, ams, rel, \"\\u22b8\", \"\\\\multimap\", true);\ndefineSymbol(math, ams, rel, \"\\u21ad\", \"\\\\leftrightsquigarrow\", true);\ndefineSymbol(math, ams, rel, \"\\u21c9\", \"\\\\rightrightarrows\", true);\ndefineSymbol(math, ams, rel, \"\\u21c4\", \"\\\\rightleftarrows\", true);\ndefineSymbol(math, ams, rel, \"\\u21a0\", \"\\\\twoheadrightarrow\", true);\ndefineSymbol(math, ams, rel, \"\\u21a3\", \"\\\\rightarrowtail\", true);\ndefineSymbol(math, ams, rel, \"\\u21ac\", \"\\\\looparrowright\", true);\ndefineSymbol(math, ams, rel, \"\\u21b7\", \"\\\\curvearrowright\", true); // unicode-math maps \\u21bb to \\cwopencirclearrow. We'll use the AMS synonym.\n\ndefineSymbol(math, ams, rel, \"\\u21bb\", \"\\\\circlearrowright\", true);\ndefineSymbol(math, ams, rel, \"\\u21b1\", \"\\\\Rsh\", true);\ndefineSymbol(math, ams, rel, \"\\u21ca\", \"\\\\downdownarrows\", true);\ndefineSymbol(math, ams, rel, \"\\u21be\", \"\\\\upharpoonright\", true);\ndefineSymbol(math, ams, rel, \"\\u21c2\", \"\\\\downharpoonright\", true);\ndefineSymbol(math, ams, rel, \"\\u21dd\", \"\\\\rightsquigarrow\", true);\ndefineSymbol(math, ams, rel, \"\\u21dd\", \"\\\\leadsto\");\ndefineSymbol(math, ams, rel, \"\\u21db\", \"\\\\Rrightarrow\", true);\ndefineSymbol(math, ams, rel, \"\\u21be\", \"\\\\restriction\");\ndefineSymbol(math, main, textord, \"\\u2018\", \"`\");\ndefineSymbol(math, main, textord, \"$\", \"\\\\$\");\ndefineSymbol(text, main, textord, \"$\", \"\\\\$\");\ndefineSymbol(text, main, textord, \"$\", \"\\\\textdollar\");\ndefineSymbol(math, main, textord, \"%\", \"\\\\%\");\ndefineSymbol(text, main, textord, \"%\", \"\\\\%\");\ndefineSymbol(math, main, textord, \"_\", \"\\\\_\");\ndefineSymbol(text, main, textord, \"_\", \"\\\\_\");\ndefineSymbol(text, main, textord, \"_\", \"\\\\textunderscore\");\ndefineSymbol(math, main, textord, \"\\u2220\", \"\\\\angle\", true);\ndefineSymbol(math, main, textord, \"\\u221e\", \"\\\\infty\", true);\ndefineSymbol(math, main, textord, \"\\u2032\", \"\\\\prime\");\ndefineSymbol(math, main, textord, \"\\u25b3\", \"\\\\triangle\");\ndefineSymbol(math, main, textord, \"\\u0393\", \"\\\\Gamma\", true);\ndefineSymbol(math, main, textord, \"\\u0394\", \"\\\\Delta\", true);\ndefineSymbol(math, main, textord, \"\\u0398\", \"\\\\Theta\", true);\ndefineSymbol(math, main, textord, \"\\u039b\", \"\\\\Lambda\", true);\ndefineSymbol(math, main, textord, \"\\u039e\", \"\\\\Xi\", true);\ndefineSymbol(math, main, textord, \"\\u03a0\", \"\\\\Pi\", true);\ndefineSymbol(math, main, textord, \"\\u03a3\", \"\\\\Sigma\", true);\ndefineSymbol(math, main, textord, \"\\u03a5\", \"\\\\Upsilon\", true);\ndefineSymbol(math, main, textord, \"\\u03a6\", \"\\\\Phi\", true);\ndefineSymbol(math, main, textord, \"\\u03a8\", \"\\\\Psi\", true);\ndefineSymbol(math, main, textord, \"\\u03a9\", \"\\\\Omega\", true);\ndefineSymbol(math, main, textord, \"A\", \"\\u0391\");\ndefineSymbol(math, main, textord, \"B\", \"\\u0392\");\ndefineSymbol(math, main, textord, \"E\", \"\\u0395\");\ndefineSymbol(math, main, textord, \"Z\", \"\\u0396\");\ndefineSymbol(math, main, textord, \"H\", \"\\u0397\");\ndefineSymbol(math, main, textord, \"I\", \"\\u0399\");\ndefineSymbol(math, main, textord, \"K\", \"\\u039A\");\ndefineSymbol(math, main, textord, \"M\", \"\\u039C\");\ndefineSymbol(math, main, textord, \"N\", \"\\u039D\");\ndefineSymbol(math, main, textord, \"O\", \"\\u039F\");\ndefineSymbol(math, main, textord, \"P\", \"\\u03A1\");\ndefineSymbol(math, main, textord, \"T\", \"\\u03A4\");\ndefineSymbol(math, main, textord, \"X\", \"\\u03A7\");\ndefineSymbol(math, main, textord, \"\\u00ac\", \"\\\\neg\", true);\ndefineSymbol(math, main, textord, \"\\u00ac\", \"\\\\lnot\");\ndefineSymbol(math, main, textord, \"\\u22a4\", \"\\\\top\");\ndefineSymbol(math, main, textord, \"\\u22a5\", \"\\\\bot\");\ndefineSymbol(math, main, textord, \"\\u2205\", \"\\\\emptyset\");\ndefineSymbol(math, ams, textord, \"\\u2205\", \"\\\\varnothing\");\ndefineSymbol(math, main, mathord, \"\\u03b1\", \"\\\\alpha\", true);\ndefineSymbol(math, main, mathord, \"\\u03b2\", \"\\\\beta\", true);\ndefineSymbol(math, main, mathord, \"\\u03b3\", \"\\\\gamma\", true);\ndefineSymbol(math, main, mathord, \"\\u03b4\", \"\\\\delta\", true);\ndefineSymbol(math, main, mathord, \"\\u03f5\", \"\\\\epsilon\", true);\ndefineSymbol(math, main, mathord, \"\\u03b6\", \"\\\\zeta\", true);\ndefineSymbol(math, main, mathord, \"\\u03b7\", \"\\\\eta\", true);\ndefineSymbol(math, main, mathord, \"\\u03b8\", \"\\\\theta\", true);\ndefineSymbol(math, main, mathord, \"\\u03b9\", \"\\\\iota\", true);\ndefineSymbol(math, main, mathord, \"\\u03ba\", \"\\\\kappa\", true);\ndefineSymbol(math, main, mathord, \"\\u03bb\", \"\\\\lambda\", true);\ndefineSymbol(math, main, mathord, \"\\u03bc\", \"\\\\mu\", true);\ndefineSymbol(math, main, mathord, \"\\u03bd\", \"\\\\nu\", true);\ndefineSymbol(math, main, mathord, \"\\u03be\", \"\\\\xi\", true);\ndefineSymbol(math, main, mathord, \"\\u03bf\", \"\\\\omicron\", true);\ndefineSymbol(math, main, mathord, \"\\u03c0\", \"\\\\pi\", true);\ndefineSymbol(math, main, mathord, \"\\u03c1\", \"\\\\rho\", true);\ndefineSymbol(math, main, mathord, \"\\u03c3\", \"\\\\sigma\", true);\ndefineSymbol(math, main, mathord, \"\\u03c4\", \"\\\\tau\", true);\ndefineSymbol(math, main, mathord, \"\\u03c5\", \"\\\\upsilon\", true);\ndefineSymbol(math, main, mathord, \"\\u03d5\", \"\\\\phi\", true);\ndefineSymbol(math, main, mathord, \"\\u03c7\", \"\\\\chi\", true);\ndefineSymbol(math, main, mathord, \"\\u03c8\", \"\\\\psi\", true);\ndefineSymbol(math, main, mathord, \"\\u03c9\", \"\\\\omega\", true);\ndefineSymbol(math, main, mathord, \"\\u03b5\", \"\\\\varepsilon\", true);\ndefineSymbol(math, main, mathord, \"\\u03d1\", \"\\\\vartheta\", true);\ndefineSymbol(math, main, mathord, \"\\u03d6\", \"\\\\varpi\", true);\ndefineSymbol(math, main, mathord, \"\\u03f1\", \"\\\\varrho\", true);\ndefineSymbol(math, main, mathord, \"\\u03c2\", \"\\\\varsigma\", true);\ndefineSymbol(math, main, mathord, \"\\u03c6\", \"\\\\varphi\", true);\ndefineSymbol(math, main, bin, \"\\u2217\", \"*\", true);\ndefineSymbol(math, main, bin, \"+\", \"+\");\ndefineSymbol(math, main, bin, \"\\u2212\", \"-\", true);\ndefineSymbol(math, main, bin, \"\\u22c5\", \"\\\\cdot\", true);\ndefineSymbol(math, main, bin, \"\\u2218\", \"\\\\circ\", true);\ndefineSymbol(math, main, bin, \"\\u00f7\", \"\\\\div\", true);\ndefineSymbol(math, main, bin, \"\\u00b1\", \"\\\\pm\", true);\ndefineSymbol(math, main, bin, \"\\u00d7\", \"\\\\times\", true);\ndefineSymbol(math, main, bin, \"\\u2229\", \"\\\\cap\", true);\ndefineSymbol(math, main, bin, \"\\u222a\", \"\\\\cup\", true);\ndefineSymbol(math, main, bin, \"\\u2216\", \"\\\\setminus\", true);\ndefineSymbol(math, main, bin, \"\\u2227\", \"\\\\land\");\ndefineSymbol(math, main, bin, \"\\u2228\", \"\\\\lor\");\ndefineSymbol(math, main, bin, \"\\u2227\", \"\\\\wedge\", true);\ndefineSymbol(math, main, bin, \"\\u2228\", \"\\\\vee\", true);\ndefineSymbol(math, main, textord, \"\\u221a\", \"\\\\surd\");\ndefineSymbol(math, main, open, \"\\u27e8\", \"\\\\langle\", true);\ndefineSymbol(math, main, open, \"\\u2223\", \"\\\\lvert\");\ndefineSymbol(math, main, open, \"\\u2225\", \"\\\\lVert\");\ndefineSymbol(math, main, close, \"?\", \"?\");\ndefineSymbol(math, main, close, \"!\", \"!\");\ndefineSymbol(math, main, close, \"\\u27e9\", \"\\\\rangle\", true);\ndefineSymbol(math, main, close, \"\\u2223\", \"\\\\rvert\");\ndefineSymbol(math, main, close, \"\\u2225\", \"\\\\rVert\");\ndefineSymbol(math, main, rel, \"=\", \"=\");\ndefineSymbol(math, main, rel, \":\", \":\");\ndefineSymbol(math, main, rel, \"\\u2248\", \"\\\\approx\", true);\ndefineSymbol(math, main, rel, \"\\u2245\", \"\\\\cong\", true);\ndefineSymbol(math, main, rel, \"\\u2265\", \"\\\\ge\");\ndefineSymbol(math, main, rel, \"\\u2265\", \"\\\\geq\", true);\ndefineSymbol(math, main, rel, \"\\u2190\", \"\\\\gets\");\ndefineSymbol(math, main, rel, \">\", \"\\\\gt\", true);\ndefineSymbol(math, main, rel, \"\\u2208\", \"\\\\in\", true);\ndefineSymbol(math, main, rel, \"\\ue020\", \"\\\\@not\");\ndefineSymbol(math, main, rel, \"\\u2282\", \"\\\\subset\", true);\ndefineSymbol(math, main, rel, \"\\u2283\", \"\\\\supset\", true);\ndefineSymbol(math, main, rel, \"\\u2286\", \"\\\\subseteq\", true);\ndefineSymbol(math, main, rel, \"\\u2287\", \"\\\\supseteq\", true);\ndefineSymbol(math, ams, rel, \"\\u2288\", \"\\\\nsubseteq\", true);\ndefineSymbol(math, ams, rel, \"\\u2289\", \"\\\\nsupseteq\", true);\ndefineSymbol(math, main, rel, \"\\u22a8\", \"\\\\models\");\ndefineSymbol(math, main, rel, \"\\u2190\", \"\\\\leftarrow\", true);\ndefineSymbol(math, main, rel, \"\\u2264\", \"\\\\le\");\ndefineSymbol(math, main, rel, \"\\u2264\", \"\\\\leq\", true);\ndefineSymbol(math, main, rel, \"<\", \"\\\\lt\", true);\ndefineSymbol(math, main, rel, \"\\u2192\", \"\\\\rightarrow\", true);\ndefineSymbol(math, main, rel, \"\\u2192\", \"\\\\to\");\ndefineSymbol(math, ams, rel, \"\\u2271\", \"\\\\ngeq\", true);\ndefineSymbol(math, ams, rel, \"\\u2270\", \"\\\\nleq\", true);\ndefineSymbol(math, main, spacing, \"\\u00a0\", \"\\\\ \");\ndefineSymbol(math, main, spacing, \"\\u00a0\", \"\\\\space\"); // Ref: LaTeX Source 2e: \\DeclareRobustCommand{\\nobreakspace}{%\n\ndefineSymbol(math, main, spacing, \"\\u00a0\", \"\\\\nobreakspace\");\ndefineSymbol(text, main, spacing, \"\\u00a0\", \"\\\\ \");\ndefineSymbol(text, main, spacing, \"\\u00a0\", \" \");\ndefineSymbol(text, main, spacing, \"\\u00a0\", \"\\\\space\");\ndefineSymbol(text, main, spacing, \"\\u00a0\", \"\\\\nobreakspace\");\ndefineSymbol(math, main, spacing, null, \"\\\\nobreak\");\ndefineSymbol(math, main, spacing, null, \"\\\\allowbreak\");\ndefineSymbol(math, main, punct, \",\", \",\");\ndefineSymbol(math, main, punct, \";\", \";\");\ndefineSymbol(math, ams, bin, \"\\u22bc\", \"\\\\barwedge\", true);\ndefineSymbol(math, ams, bin, \"\\u22bb\", \"\\\\veebar\", true);\ndefineSymbol(math, main, bin, \"\\u2299\", \"\\\\odot\", true);\ndefineSymbol(math, main, bin, \"\\u2295\", \"\\\\oplus\", true);\ndefineSymbol(math, main, bin, \"\\u2297\", \"\\\\otimes\", true);\ndefineSymbol(math, main, textord, \"\\u2202\", \"\\\\partial\", true);\ndefineSymbol(math, main, bin, \"\\u2298\", \"\\\\oslash\", true);\ndefineSymbol(math, ams, bin, \"\\u229a\", \"\\\\circledcirc\", true);\ndefineSymbol(math, ams, bin, \"\\u22a1\", \"\\\\boxdot\", true);\ndefineSymbol(math, main, bin, \"\\u25b3\", \"\\\\bigtriangleup\");\ndefineSymbol(math, main, bin, \"\\u25bd\", \"\\\\bigtriangledown\");\ndefineSymbol(math, main, bin, \"\\u2020\", \"\\\\dagger\");\ndefineSymbol(math, main, bin, \"\\u22c4\", \"\\\\diamond\");\ndefineSymbol(math, main, bin, \"\\u22c6\", \"\\\\star\");\ndefineSymbol(math, main, bin, \"\\u25c3\", \"\\\\triangleleft\");\ndefineSymbol(math, main, bin, \"\\u25b9\", \"\\\\triangleright\");\ndefineSymbol(math, main, open, \"{\", \"\\\\{\");\ndefineSymbol(text, main, textord, \"{\", \"\\\\{\");\ndefineSymbol(text, main, textord, \"{\", \"\\\\textbraceleft\");\ndefineSymbol(math, main, close, \"}\", \"\\\\}\");\ndefineSymbol(text, main, textord, \"}\", \"\\\\}\");\ndefineSymbol(text, main, textord, \"}\", \"\\\\textbraceright\");\ndefineSymbol(math, main, open, \"{\", \"\\\\lbrace\");\ndefineSymbol(math, main, close, \"}\", \"\\\\rbrace\");\ndefineSymbol(math, main, open, \"[\", \"\\\\lbrack\", true);\ndefineSymbol(text, main, textord, \"[\", \"\\\\lbrack\", true);\ndefineSymbol(math, main, close, \"]\", \"\\\\rbrack\", true);\ndefineSymbol(text, main, textord, \"]\", \"\\\\rbrack\", true);\ndefineSymbol(math, main, open, \"(\", \"\\\\lparen\", true);\ndefineSymbol(math, main, close, \")\", \"\\\\rparen\", true);\ndefineSymbol(text, main, textord, \"<\", \"\\\\textless\", true); // in T1 fontenc\n\ndefineSymbol(text, main, textord, \">\", \"\\\\textgreater\", true); // in T1 fontenc\n\ndefineSymbol(math, main, open, \"\\u230a\", \"\\\\lfloor\", true);\ndefineSymbol(math, main, close, \"\\u230b\", \"\\\\rfloor\", true);\ndefineSymbol(math, main, open, \"\\u2308\", \"\\\\lceil\", true);\ndefineSymbol(math, main, close, \"\\u2309\", \"\\\\rceil\", true);\ndefineSymbol(math, main, textord, \"\\\\\", \"\\\\backslash\");\ndefineSymbol(math, main, textord, \"\\u2223\", \"|\");\ndefineSymbol(math, main, textord, \"\\u2223\", \"\\\\vert\");\ndefineSymbol(text, main, textord, \"|\", \"\\\\textbar\", true); // in T1 fontenc\n\ndefineSymbol(math, main, textord, \"\\u2225\", \"\\\\|\");\ndefineSymbol(math, main, textord, \"\\u2225\", \"\\\\Vert\");\ndefineSymbol(text, main, textord, \"\\u2225\", \"\\\\textbardbl\");\ndefineSymbol(text, main, textord, \"~\", \"\\\\textasciitilde\");\ndefineSymbol(text, main, textord, \"\\\\\", \"\\\\textbackslash\");\ndefineSymbol(text, main, textord, \"^\", \"\\\\textasciicircum\");\ndefineSymbol(math, main, rel, \"\\u2191\", \"\\\\uparrow\", true);\ndefineSymbol(math, main, rel, \"\\u21d1\", \"\\\\Uparrow\", true);\ndefineSymbol(math, main, rel, \"\\u2193\", \"\\\\downarrow\", true);\ndefineSymbol(math, main, rel, \"\\u21d3\", \"\\\\Downarrow\", true);\ndefineSymbol(math, main, rel, \"\\u2195\", \"\\\\updownarrow\", true);\ndefineSymbol(math, main, rel, \"\\u21d5\", \"\\\\Updownarrow\", true);\ndefineSymbol(math, main, op, \"\\u2210\", \"\\\\coprod\");\ndefineSymbol(math, main, op, \"\\u22c1\", \"\\\\bigvee\");\ndefineSymbol(math, main, op, \"\\u22c0\", \"\\\\bigwedge\");\ndefineSymbol(math, main, op, \"\\u2a04\", \"\\\\biguplus\");\ndefineSymbol(math, main, op, \"\\u22c2\", \"\\\\bigcap\");\ndefineSymbol(math, main, op, \"\\u22c3\", \"\\\\bigcup\");\ndefineSymbol(math, main, op, \"\\u222b\", \"\\\\int\");\ndefineSymbol(math, main, op, \"\\u222b\", \"\\\\intop\");\ndefineSymbol(math, main, op, \"\\u222c\", \"\\\\iint\");\ndefineSymbol(math, main, op, \"\\u222d\", \"\\\\iiint\");\ndefineSymbol(math, main, op, \"\\u220f\", \"\\\\prod\");\ndefineSymbol(math, main, op, \"\\u2211\", \"\\\\sum\");\ndefineSymbol(math, main, op, \"\\u2a02\", \"\\\\bigotimes\");\ndefineSymbol(math, main, op, \"\\u2a01\", \"\\\\bigoplus\");\ndefineSymbol(math, main, op, \"\\u2a00\", \"\\\\bigodot\");\ndefineSymbol(math, main, op, \"\\u222e\", \"\\\\oint\");\ndefineSymbol(math, main, op, \"\\u222f\", \"\\\\oiint\");\ndefineSymbol(math, main, op, \"\\u2230\", \"\\\\oiiint\");\ndefineSymbol(math, main, op, \"\\u2a06\", \"\\\\bigsqcup\");\ndefineSymbol(math, main, op, \"\\u222b\", \"\\\\smallint\");\ndefineSymbol(text, main, inner, \"\\u2026\", \"\\\\textellipsis\");\ndefineSymbol(math, main, inner, \"\\u2026\", \"\\\\mathellipsis\");\ndefineSymbol(text, main, inner, \"\\u2026\", \"\\\\ldots\", true);\ndefineSymbol(math, main, inner, \"\\u2026\", \"\\\\ldots\", true);\ndefineSymbol(math, main, inner, \"\\u22ef\", \"\\\\@cdots\", true);\ndefineSymbol(math, main, inner, \"\\u22f1\", \"\\\\ddots\", true);\ndefineSymbol(math, main, textord, \"\\u22ee\", \"\\\\varvdots\"); // \\vdots is a macro\n\ndefineSymbol(math, main, accent, \"\\u02ca\", \"\\\\acute\");\ndefineSymbol(math, main, accent, \"\\u02cb\", \"\\\\grave\");\ndefineSymbol(math, main, accent, \"\\u00a8\", \"\\\\ddot\");\ndefineSymbol(math, main, accent, \"\\u007e\", \"\\\\tilde\");\ndefineSymbol(math, main, accent, \"\\u02c9\", \"\\\\bar\");\ndefineSymbol(math, main, accent, \"\\u02d8\", \"\\\\breve\");\ndefineSymbol(math, main, accent, \"\\u02c7\", \"\\\\check\");\ndefineSymbol(math, main, accent, \"\\u005e\", \"\\\\hat\");\ndefineSymbol(math, main, accent, \"\\u20d7\", \"\\\\vec\");\ndefineSymbol(math, main, accent, \"\\u02d9\", \"\\\\dot\");\ndefineSymbol(math, main, accent, \"\\u02da\", \"\\\\mathring\"); // \\imath and \\jmath should be invariant to \\mathrm, \\mathbf, etc., so use PUA\n\ndefineSymbol(math, main, mathord, \"\\ue131\", \"\\\\@imath\");\ndefineSymbol(math, main, mathord, \"\\ue237\", \"\\\\@jmath\");\ndefineSymbol(math, main, textord, \"\\u0131\", \"\\u0131\");\ndefineSymbol(math, main, textord, \"\\u0237\", \"\\u0237\");\ndefineSymbol(text, main, textord, \"\\u0131\", \"\\\\i\", true);\ndefineSymbol(text, main, textord, \"\\u0237\", \"\\\\j\", true);\ndefineSymbol(text, main, textord, \"\\u00df\", \"\\\\ss\", true);\ndefineSymbol(text, main, textord, \"\\u00e6\", \"\\\\ae\", true);\ndefineSymbol(text, main, textord, \"\\u0153\", \"\\\\oe\", true);\ndefineSymbol(text, main, textord, \"\\u00f8\", \"\\\\o\", true);\ndefineSymbol(text, main, textord, \"\\u00c6\", \"\\\\AE\", true);\ndefineSymbol(text, main, textord, \"\\u0152\", \"\\\\OE\", true);\ndefineSymbol(text, main, textord, \"\\u00d8\", \"\\\\O\", true);\ndefineSymbol(text, main, accent, \"\\u02ca\", \"\\\\'\"); // acute\n\ndefineSymbol(text, main, accent, \"\\u02cb\", \"\\\\`\"); // grave\n\ndefineSymbol(text, main, accent, \"\\u02c6\", \"\\\\^\"); // circumflex\n\ndefineSymbol(text, main, accent, \"\\u02dc\", \"\\\\~\"); // tilde\n\ndefineSymbol(text, main, accent, \"\\u02c9\", \"\\\\=\"); // macron\n\ndefineSymbol(text, main, accent, \"\\u02d8\", \"\\\\u\"); // breve\n\ndefineSymbol(text, main, accent, \"\\u02d9\", \"\\\\.\"); // dot above\n\ndefineSymbol(text, main, accent, \"\\u00b8\", \"\\\\c\"); // cedilla\n\ndefineSymbol(text, main, accent, \"\\u02da\", \"\\\\r\"); // ring above\n\ndefineSymbol(text, main, accent, \"\\u02c7\", \"\\\\v\"); // caron\n\ndefineSymbol(text, main, accent, \"\\u00a8\", '\\\\\"'); // diaresis\n\ndefineSymbol(text, main, accent, \"\\u02dd\", \"\\\\H\"); // double acute\n\ndefineSymbol(text, main, accent, \"\\u25ef\", \"\\\\textcircled\"); // \\bigcirc glyph\n// These ligatures are detected and created in Parser.js's `formLigatures`.\n\nvar ligatures = {\n \"--\": true,\n \"---\": true,\n \"``\": true,\n \"''\": true\n};\ndefineSymbol(text, main, textord, \"\\u2013\", \"--\", true);\ndefineSymbol(text, main, textord, \"\\u2013\", \"\\\\textendash\");\ndefineSymbol(text, main, textord, \"\\u2014\", \"---\", true);\ndefineSymbol(text, main, textord, \"\\u2014\", \"\\\\textemdash\");\ndefineSymbol(text, main, textord, \"\\u2018\", \"`\", true);\ndefineSymbol(text, main, textord, \"\\u2018\", \"\\\\textquoteleft\");\ndefineSymbol(text, main, textord, \"\\u2019\", \"'\", true);\ndefineSymbol(text, main, textord, \"\\u2019\", \"\\\\textquoteright\");\ndefineSymbol(text, main, textord, \"\\u201c\", \"``\", true);\ndefineSymbol(text, main, textord, \"\\u201c\", \"\\\\textquotedblleft\");\ndefineSymbol(text, main, textord, \"\\u201d\", \"''\", true);\ndefineSymbol(text, main, textord, \"\\u201d\", \"\\\\textquotedblright\"); // \\degree from gensymb package\n\ndefineSymbol(math, main, textord, \"\\u00b0\", \"\\\\degree\", true);\ndefineSymbol(text, main, textord, \"\\u00b0\", \"\\\\degree\"); // \\textdegree from inputenc package\n\ndefineSymbol(text, main, textord, \"\\u00b0\", \"\\\\textdegree\", true); // TODO: In LaTeX, \\pounds can generate a different character in text and math\n// mode, but among our fonts, only Main-Regular defines this character \"163\".\n\ndefineSymbol(math, main, textord, \"\\u00a3\", \"\\\\pounds\");\ndefineSymbol(math, main, textord, \"\\u00a3\", \"\\\\mathsterling\", true);\ndefineSymbol(text, main, textord, \"\\u00a3\", \"\\\\pounds\");\ndefineSymbol(text, main, textord, \"\\u00a3\", \"\\\\textsterling\", true);\ndefineSymbol(math, ams, textord, \"\\u2720\", \"\\\\maltese\");\ndefineSymbol(text, ams, textord, \"\\u2720\", \"\\\\maltese\"); // There are lots of symbols which are the same, so we add them in afterwards.\n// All of these are textords in math mode\n\nvar mathTextSymbols = \"0123456789/@.\\\"\";\n\nfor (var i = 0; i < mathTextSymbols.length; i++) {\n var ch = mathTextSymbols.charAt(i);\n defineSymbol(math, main, textord, ch, ch);\n} // All of these are textords in text mode\n\n\nvar textSymbols = \"0123456789!@*()-=+\\\";:?/.,\";\n\nfor (var _i = 0; _i < textSymbols.length; _i++) {\n var _ch = textSymbols.charAt(_i);\n\n defineSymbol(text, main, textord, _ch, _ch);\n} // All of these are textords in text mode, and mathords in math mode\n\n\nvar letters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\";\n\nfor (var _i2 = 0; _i2 < letters.length; _i2++) {\n var _ch2 = letters.charAt(_i2);\n\n defineSymbol(math, main, mathord, _ch2, _ch2);\n defineSymbol(text, main, textord, _ch2, _ch2);\n} // Blackboard bold and script letters in Unicode range\n\n\ndefineSymbol(math, ams, textord, \"C\", \"\\u2102\"); // blackboard bold\n\ndefineSymbol(text, ams, textord, \"C\", \"\\u2102\");\ndefineSymbol(math, ams, textord, \"H\", \"\\u210D\");\ndefineSymbol(text, ams, textord, \"H\", \"\\u210D\");\ndefineSymbol(math, ams, textord, \"N\", \"\\u2115\");\ndefineSymbol(text, ams, textord, \"N\", \"\\u2115\");\ndefineSymbol(math, ams, textord, \"P\", \"\\u2119\");\ndefineSymbol(text, ams, textord, \"P\", \"\\u2119\");\ndefineSymbol(math, ams, textord, \"Q\", \"\\u211A\");\ndefineSymbol(text, ams, textord, \"Q\", \"\\u211A\");\ndefineSymbol(math, ams, textord, \"R\", \"\\u211D\");\ndefineSymbol(text, ams, textord, \"R\", \"\\u211D\");\ndefineSymbol(math, ams, textord, \"Z\", \"\\u2124\");\ndefineSymbol(text, ams, textord, \"Z\", \"\\u2124\");\ndefineSymbol(math, main, mathord, \"h\", \"\\u210E\"); // italic h, Planck constant\n\ndefineSymbol(text, main, mathord, \"h\", \"\\u210E\"); // The next loop loads wide (surrogate pair) characters.\n// We support some letters in the Unicode range U+1D400 to U+1D7FF,\n// Mathematical Alphanumeric Symbols.\n// Some editors do not deal well with wide characters. So don't write the\n// string into this file. Instead, create the string from the surrogate pair.\n\nvar wideChar = \"\";\n\nfor (var _i3 = 0; _i3 < letters.length; _i3++) {\n var _ch3 = letters.charAt(_i3); // The hex numbers in the next line are a surrogate pair.\n // 0xD835 is the high surrogate for all letters in the range we support.\n // 0xDC00 is the low surrogate for bold A.\n\n\n wideChar = String.fromCharCode(0xD835, 0xDC00 + _i3); // A-Z a-z bold\n\n defineSymbol(math, main, mathord, _ch3, wideChar);\n defineSymbol(text, main, textord, _ch3, wideChar);\n wideChar = String.fromCharCode(0xD835, 0xDC34 + _i3); // A-Z a-z italic\n\n defineSymbol(math, main, mathord, _ch3, wideChar);\n defineSymbol(text, main, textord, _ch3, wideChar);\n wideChar = String.fromCharCode(0xD835, 0xDC68 + _i3); // A-Z a-z bold italic\n\n defineSymbol(math, main, mathord, _ch3, wideChar);\n defineSymbol(text, main, textord, _ch3, wideChar);\n wideChar = String.fromCharCode(0xD835, 0xDD04 + _i3); // A-Z a-z Fraktur\n\n defineSymbol(math, main, mathord, _ch3, wideChar);\n defineSymbol(text, main, textord, _ch3, wideChar);\n wideChar = String.fromCharCode(0xD835, 0xDD6C + _i3); // A-Z a-z bold Fraktur\n\n defineSymbol(math, main, mathord, _ch3, wideChar);\n defineSymbol(text, main, textord, _ch3, wideChar);\n wideChar = String.fromCharCode(0xD835, 0xDDA0 + _i3); // A-Z a-z sans-serif\n\n defineSymbol(math, main, mathord, _ch3, wideChar);\n defineSymbol(text, main, textord, _ch3, wideChar);\n wideChar = String.fromCharCode(0xD835, 0xDDD4 + _i3); // A-Z a-z sans bold\n\n defineSymbol(math, main, mathord, _ch3, wideChar);\n defineSymbol(text, main, textord, _ch3, wideChar);\n wideChar = String.fromCharCode(0xD835, 0xDE08 + _i3); // A-Z a-z sans italic\n\n defineSymbol(math, main, mathord, _ch3, wideChar);\n defineSymbol(text, main, textord, _ch3, wideChar);\n wideChar = String.fromCharCode(0xD835, 0xDE70 + _i3); // A-Z a-z monospace\n\n defineSymbol(math, main, mathord, _ch3, wideChar);\n defineSymbol(text, main, textord, _ch3, wideChar);\n\n if (_i3 < 26) {\n // KaTeX fonts have only capital letters for blackboard bold and script.\n // See exception for k below.\n wideChar = String.fromCharCode(0xD835, 0xDD38 + _i3); // A-Z double struck\n\n defineSymbol(math, main, mathord, _ch3, wideChar);\n defineSymbol(text, main, textord, _ch3, wideChar);\n wideChar = String.fromCharCode(0xD835, 0xDC9C + _i3); // A-Z script\n\n defineSymbol(math, main, mathord, _ch3, wideChar);\n defineSymbol(text, main, textord, _ch3, wideChar);\n } // TODO: Add bold script when it is supported by a KaTeX font.\n\n} // \"k\" is the only double struck lower case letter in the KaTeX fonts.\n\n\nwideChar = String.fromCharCode(0xD835, 0xDD5C); // k double struck\n\ndefineSymbol(math, main, mathord, \"k\", wideChar);\ndefineSymbol(text, main, textord, \"k\", wideChar); // Next, some wide character numerals\n\nfor (var _i4 = 0; _i4 < 10; _i4++) {\n var _ch4 = _i4.toString();\n\n wideChar = String.fromCharCode(0xD835, 0xDFCE + _i4); // 0-9 bold\n\n defineSymbol(math, main, mathord, _ch4, wideChar);\n defineSymbol(text, main, textord, _ch4, wideChar);\n wideChar = String.fromCharCode(0xD835, 0xDFE2 + _i4); // 0-9 sans serif\n\n defineSymbol(math, main, mathord, _ch4, wideChar);\n defineSymbol(text, main, textord, _ch4, wideChar);\n wideChar = String.fromCharCode(0xD835, 0xDFEC + _i4); // 0-9 bold sans\n\n defineSymbol(math, main, mathord, _ch4, wideChar);\n defineSymbol(text, main, textord, _ch4, wideChar);\n wideChar = String.fromCharCode(0xD835, 0xDFF6 + _i4); // 0-9 monospace\n\n defineSymbol(math, main, mathord, _ch4, wideChar);\n defineSymbol(text, main, textord, _ch4, wideChar);\n} // We add these Latin-1 letters as symbols for backwards-compatibility,\n// but they are not actually in the font, nor are they supported by the\n// Unicode accent mechanism, so they fall back to Times font and look ugly.\n// TODO(edemaine): Fix this.\n\n\nvar extraLatin = \"\\u00d0\\u00de\\u00fe\";\n\nfor (var _i5 = 0; _i5 < extraLatin.length; _i5++) {\n var _ch5 = extraLatin.charAt(_i5);\n\n defineSymbol(math, main, mathord, _ch5, _ch5);\n defineSymbol(text, main, textord, _ch5, _ch5);\n}\n\n/**\n * This file provides support for Unicode range U+1D400 to U+1D7FF,\n * Mathematical Alphanumeric Symbols.\n *\n * Function wideCharacterFont takes a wide character as input and returns\n * the font information necessary to render it properly.\n */\n/**\n * Data below is from https://www.unicode.org/charts/PDF/U1D400.pdf\n * That document sorts characters into groups by font type, say bold or italic.\n *\n * In the arrays below, each subarray consists three elements:\n * * The CSS class of that group when in math mode.\n * * The CSS class of that group when in text mode.\n * * The font name, so that KaTeX can get font metrics.\n */\n\nvar wideLatinLetterData = [[\"mathbf\", \"textbf\", \"Main-Bold\"], // A-Z bold upright\n[\"mathbf\", \"textbf\", \"Main-Bold\"], // a-z bold upright\n[\"mathnormal\", \"textit\", \"Math-Italic\"], // A-Z italic\n[\"mathnormal\", \"textit\", \"Math-Italic\"], // a-z italic\n[\"boldsymbol\", \"boldsymbol\", \"Main-BoldItalic\"], // A-Z bold italic\n[\"boldsymbol\", \"boldsymbol\", \"Main-BoldItalic\"], // a-z bold italic\n// Map fancy A-Z letters to script, not calligraphic.\n// This aligns with unicode-math and math fonts (except Cambria Math).\n[\"mathscr\", \"textscr\", \"Script-Regular\"], // A-Z script\n[\"\", \"\", \"\"], // a-z script. No font\n[\"\", \"\", \"\"], // A-Z bold script. No font\n[\"\", \"\", \"\"], // a-z bold script. No font\n[\"mathfrak\", \"textfrak\", \"Fraktur-Regular\"], // A-Z Fraktur\n[\"mathfrak\", \"textfrak\", \"Fraktur-Regular\"], // a-z Fraktur\n[\"mathbb\", \"textbb\", \"AMS-Regular\"], // A-Z double-struck\n[\"mathbb\", \"textbb\", \"AMS-Regular\"], // k double-struck\n// Note that we are using a bold font, but font metrics for regular Fraktur.\n[\"mathboldfrak\", \"textboldfrak\", \"Fraktur-Regular\"], // A-Z bold Fraktur\n[\"mathboldfrak\", \"textboldfrak\", \"Fraktur-Regular\"], // a-z bold Fraktur\n[\"mathsf\", \"textsf\", \"SansSerif-Regular\"], // A-Z sans-serif\n[\"mathsf\", \"textsf\", \"SansSerif-Regular\"], // a-z sans-serif\n[\"mathboldsf\", \"textboldsf\", \"SansSerif-Bold\"], // A-Z bold sans-serif\n[\"mathboldsf\", \"textboldsf\", \"SansSerif-Bold\"], // a-z bold sans-serif\n[\"mathitsf\", \"textitsf\", \"SansSerif-Italic\"], // A-Z italic sans-serif\n[\"mathitsf\", \"textitsf\", \"SansSerif-Italic\"], // a-z italic sans-serif\n[\"\", \"\", \"\"], // A-Z bold italic sans. No font\n[\"\", \"\", \"\"], // a-z bold italic sans. No font\n[\"mathtt\", \"texttt\", \"Typewriter-Regular\"], // A-Z monospace\n[\"mathtt\", \"texttt\", \"Typewriter-Regular\"] // a-z monospace\n];\nvar wideNumeralData = [[\"mathbf\", \"textbf\", \"Main-Bold\"], // 0-9 bold\n[\"\", \"\", \"\"], // 0-9 double-struck. No KaTeX font.\n[\"mathsf\", \"textsf\", \"SansSerif-Regular\"], // 0-9 sans-serif\n[\"mathboldsf\", \"textboldsf\", \"SansSerif-Bold\"], // 0-9 bold sans-serif\n[\"mathtt\", \"texttt\", \"Typewriter-Regular\"] // 0-9 monospace\n];\nvar wideCharacterFont = function wideCharacterFont(wideChar, mode) {\n // IE doesn't support codePointAt(). So work with the surrogate pair.\n var H = wideChar.charCodeAt(0); // high surrogate\n\n var L = wideChar.charCodeAt(1); // low surrogate\n\n var codePoint = (H - 0xD800) * 0x400 + (L - 0xDC00) + 0x10000;\n var j = mode === \"math\" ? 0 : 1; // column index for CSS class.\n\n if (0x1D400 <= codePoint && codePoint < 0x1D6A4) {\n // wideLatinLetterData contains exactly 26 chars on each row.\n // So we can calculate the relevant row. No traverse necessary.\n var i = Math.floor((codePoint - 0x1D400) / 26);\n return [wideLatinLetterData[i][2], wideLatinLetterData[i][j]];\n } else if (0x1D7CE <= codePoint && codePoint <= 0x1D7FF) {\n // Numerals, ten per row.\n var _i = Math.floor((codePoint - 0x1D7CE) / 10);\n\n return [wideNumeralData[_i][2], wideNumeralData[_i][j]];\n } else if (codePoint === 0x1D6A5 || codePoint === 0x1D6A6) {\n // dotless i or j\n return [wideLatinLetterData[0][2], wideLatinLetterData[0][j]];\n } else if (0x1D6A6 < codePoint && codePoint < 0x1D7CE) {\n // Greek letters. Not supported, yet.\n return [\"\", \"\"];\n } else {\n // We don't support any wide characters outside 1D400\u20131D7FF.\n throw new ParseError(\"Unsupported character: \" + wideChar);\n }\n};\n\n/* eslint no-console:0 */\n\n/**\n * Looks up the given symbol in fontMetrics, after applying any symbol\n * replacements defined in symbol.js\n */\nvar lookupSymbol = function lookupSymbol(value, // TODO(#963): Use a union type for this.\nfontName, mode) {\n // Replace the value with its replaced value from symbol.js\n if (symbols[mode][value] && symbols[mode][value].replace) {\n value = symbols[mode][value].replace;\n }\n\n return {\n value: value,\n metrics: getCharacterMetrics(value, fontName, mode)\n };\n};\n/**\n * Makes a symbolNode after translation via the list of symbols in symbols.js.\n * Correctly pulls out metrics for the character, and optionally takes a list of\n * classes to be attached to the node.\n *\n * TODO: make argument order closer to makeSpan\n * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which\n * should if present come first in `classes`.\n * TODO(#953): Make `options` mandatory and always pass it in.\n */\n\n\nvar makeSymbol = function makeSymbol(value, fontName, mode, options, classes) {\n var lookup = lookupSymbol(value, fontName, mode);\n var metrics = lookup.metrics;\n value = lookup.value;\n var symbolNode;\n\n if (metrics) {\n var italic = metrics.italic;\n\n if (mode === \"text\" || options && options.font === \"mathit\") {\n italic = 0;\n }\n\n symbolNode = new SymbolNode(value, metrics.height, metrics.depth, italic, metrics.skew, metrics.width, classes);\n } else {\n // TODO(emily): Figure out a good way to only print this in development\n typeof console !== \"undefined\" && console.warn(\"No character metrics \" + (\"for '\" + value + \"' in style '\" + fontName + \"' and mode '\" + mode + \"'\"));\n symbolNode = new SymbolNode(value, 0, 0, 0, 0, 0, classes);\n }\n\n if (options) {\n symbolNode.maxFontSize = options.sizeMultiplier;\n\n if (options.style.isTight()) {\n symbolNode.classes.push(\"mtight\");\n }\n\n var color = options.getColor();\n\n if (color) {\n symbolNode.style.color = color;\n }\n }\n\n return symbolNode;\n};\n/**\n * Makes a symbol in Main-Regular or AMS-Regular.\n * Used for rel, bin, open, close, inner, and punct.\n */\n\n\nvar mathsym = function mathsym(value, mode, options, classes) {\n if (classes === void 0) {\n classes = [];\n }\n\n // Decide what font to render the symbol in by its entry in the symbols\n // table.\n // Have a special case for when the value = \\ because the \\ is used as a\n // textord in unsupported command errors but cannot be parsed as a regular\n // text ordinal and is therefore not present as a symbol in the symbols\n // table for text, as well as a special case for boldsymbol because it\n // can be used for bold + and -\n if (options.font === \"boldsymbol\" && lookupSymbol(value, \"Main-Bold\", mode).metrics) {\n return makeSymbol(value, \"Main-Bold\", mode, options, classes.concat([\"mathbf\"]));\n } else if (value === \"\\\\\" || symbols[mode][value].font === \"main\") {\n return makeSymbol(value, \"Main-Regular\", mode, options, classes);\n } else {\n return makeSymbol(value, \"AMS-Regular\", mode, options, classes.concat([\"amsrm\"]));\n }\n};\n/**\n * Determines which of the two font names (Main-Bold and Math-BoldItalic) and\n * corresponding style tags (mathbf or boldsymbol) to use for font \"boldsymbol\",\n * depending on the symbol. Use this function instead of fontMap for font\n * \"boldsymbol\".\n */\n\n\nvar boldsymbol = function boldsymbol(value, mode, options, classes, type) {\n if (type !== \"textord\" && lookupSymbol(value, \"Math-BoldItalic\", mode).metrics) {\n return {\n fontName: \"Math-BoldItalic\",\n fontClass: \"boldsymbol\"\n };\n } else {\n // Some glyphs do not exist in Math-BoldItalic so we need to use\n // Main-Bold instead.\n return {\n fontName: \"Main-Bold\",\n fontClass: \"mathbf\"\n };\n }\n};\n/**\n * Makes either a mathord or textord in the correct font and color.\n */\n\n\nvar makeOrd = function makeOrd(group, options, type) {\n var mode = group.mode;\n var text = group.text;\n var classes = [\"mord\"]; // Math mode or Old font (i.e. \\rm)\n\n var isFont = mode === \"math\" || mode === \"text\" && options.font;\n var fontOrFamily = isFont ? options.font : options.fontFamily;\n var wideFontName = \"\";\n var wideFontClass = \"\";\n\n if (text.charCodeAt(0) === 0xD835) {\n [wideFontName, wideFontClass] = wideCharacterFont(text, mode);\n }\n\n if (wideFontName.length > 0) {\n // surrogate pairs get special treatment\n return makeSymbol(text, wideFontName, mode, options, classes.concat(wideFontClass));\n } else if (fontOrFamily) {\n var fontName;\n var fontClasses;\n\n if (fontOrFamily === \"boldsymbol\") {\n var fontData = boldsymbol(text, mode, options, classes, type);\n fontName = fontData.fontName;\n fontClasses = [fontData.fontClass];\n } else if (isFont) {\n fontName = fontMap[fontOrFamily].fontName;\n fontClasses = [fontOrFamily];\n } else {\n fontName = retrieveTextFontName(fontOrFamily, options.fontWeight, options.fontShape);\n fontClasses = [fontOrFamily, options.fontWeight, options.fontShape];\n }\n\n if (lookupSymbol(text, fontName, mode).metrics) {\n return makeSymbol(text, fontName, mode, options, classes.concat(fontClasses));\n } else if (ligatures.hasOwnProperty(text) && fontName.slice(0, 10) === \"Typewriter\") {\n // Deconstruct ligatures in monospace fonts (\\texttt, \\tt).\n var parts = [];\n\n for (var i = 0; i < text.length; i++) {\n parts.push(makeSymbol(text[i], fontName, mode, options, classes.concat(fontClasses)));\n }\n\n return makeFragment(parts);\n }\n } // Makes a symbol in the default font for mathords and textords.\n\n\n if (type === \"mathord\") {\n return makeSymbol(text, \"Math-Italic\", mode, options, classes.concat([\"mathnormal\"]));\n } else if (type === \"textord\") {\n var font = symbols[mode][text] && symbols[mode][text].font;\n\n if (font === \"ams\") {\n var _fontName = retrieveTextFontName(\"amsrm\", options.fontWeight, options.fontShape);\n\n return makeSymbol(text, _fontName, mode, options, classes.concat(\"amsrm\", options.fontWeight, options.fontShape));\n } else if (font === \"main\" || !font) {\n var _fontName2 = retrieveTextFontName(\"textrm\", options.fontWeight, options.fontShape);\n\n return makeSymbol(text, _fontName2, mode, options, classes.concat(options.fontWeight, options.fontShape));\n } else {\n // fonts added by plugins\n var _fontName3 = retrieveTextFontName(font, options.fontWeight, options.fontShape); // We add font name as a css class\n\n\n return makeSymbol(text, _fontName3, mode, options, classes.concat(_fontName3, options.fontWeight, options.fontShape));\n }\n } else {\n throw new Error(\"unexpected type: \" + type + \" in makeOrd\");\n }\n};\n/**\n * Returns true if subsequent symbolNodes have the same classes, skew, maxFont,\n * and styles.\n */\n\n\nvar canCombine = (prev, next) => {\n if (createClass(prev.classes) !== createClass(next.classes) || prev.skew !== next.skew || prev.maxFontSize !== next.maxFontSize) {\n return false;\n } // If prev and next both are just \"mbin\"s or \"mord\"s we don't combine them\n // so that the proper spacing can be preserved.\n\n\n if (prev.classes.length === 1) {\n var cls = prev.classes[0];\n\n if (cls === \"mbin\" || cls === \"mord\") {\n return false;\n }\n }\n\n for (var style in prev.style) {\n if (prev.style.hasOwnProperty(style) && prev.style[style] !== next.style[style]) {\n return false;\n }\n }\n\n for (var _style in next.style) {\n if (next.style.hasOwnProperty(_style) && prev.style[_style] !== next.style[_style]) {\n return false;\n }\n }\n\n return true;\n};\n/**\n * Combine consecutive domTree.symbolNodes into a single symbolNode.\n * Note: this function mutates the argument.\n */\n\n\nvar tryCombineChars = chars => {\n for (var i = 0; i < chars.length - 1; i++) {\n var prev = chars[i];\n var next = chars[i + 1];\n\n if (prev instanceof SymbolNode && next instanceof SymbolNode && canCombine(prev, next)) {\n prev.text += next.text;\n prev.height = Math.max(prev.height, next.height);\n prev.depth = Math.max(prev.depth, next.depth); // Use the last character's italic correction since we use\n // it to add padding to the right of the span created from\n // the combined characters.\n\n prev.italic = next.italic;\n chars.splice(i + 1, 1);\n i--;\n }\n }\n\n return chars;\n};\n/**\n * Calculate the height, depth, and maxFontSize of an element based on its\n * children.\n */\n\n\nvar sizeElementFromChildren = function sizeElementFromChildren(elem) {\n var height = 0;\n var depth = 0;\n var maxFontSize = 0;\n\n for (var i = 0; i < elem.children.length; i++) {\n var child = elem.children[i];\n\n if (child.height > height) {\n height = child.height;\n }\n\n if (child.depth > depth) {\n depth = child.depth;\n }\n\n if (child.maxFontSize > maxFontSize) {\n maxFontSize = child.maxFontSize;\n }\n }\n\n elem.height = height;\n elem.depth = depth;\n elem.maxFontSize = maxFontSize;\n};\n/**\n * Makes a span with the given list of classes, list of children, and options.\n *\n * TODO(#953): Ensure that `options` is always provided (currently some call\n * sites don't pass it) and make the type below mandatory.\n * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which\n * should if present come first in `classes`.\n */\n\n\nvar makeSpan$2 = function makeSpan(classes, children, options, style) {\n var span = new Span(classes, children, options, style);\n sizeElementFromChildren(span);\n return span;\n}; // SVG one is simpler -- doesn't require height, depth, max-font setting.\n// This is also a separate method for typesafety.\n\n\nvar makeSvgSpan = (classes, children, options, style) => new Span(classes, children, options, style);\n\nvar makeLineSpan = function makeLineSpan(className, options, thickness) {\n var line = makeSpan$2([className], [], options);\n line.height = Math.max(thickness || options.fontMetrics().defaultRuleThickness, options.minRuleThickness);\n line.style.borderBottomWidth = makeEm(line.height);\n line.maxFontSize = 1.0;\n return line;\n};\n/**\n * Makes an anchor with the given href, list of classes, list of children,\n * and options.\n */\n\n\nvar makeAnchor = function makeAnchor(href, classes, children, options) {\n var anchor = new Anchor(href, classes, children, options);\n sizeElementFromChildren(anchor);\n return anchor;\n};\n/**\n * Makes a document fragment with the given list of children.\n */\n\n\nvar makeFragment = function makeFragment(children) {\n var fragment = new DocumentFragment(children);\n sizeElementFromChildren(fragment);\n return fragment;\n};\n/**\n * Wraps group in a span if it's a document fragment, allowing to apply classes\n * and styles\n */\n\n\nvar wrapFragment = function wrapFragment(group, options) {\n if (group instanceof DocumentFragment) {\n return makeSpan$2([], [group], options);\n }\n\n return group;\n}; // These are exact object types to catch typos in the names of the optional fields.\n\n\n// Computes the updated `children` list and the overall depth.\n//\n// This helper function for makeVList makes it easier to enforce type safety by\n// allowing early exits (returns) in the logic.\nvar getVListChildrenAndDepth = function getVListChildrenAndDepth(params) {\n if (params.positionType === \"individualShift\") {\n var oldChildren = params.children;\n var children = [oldChildren[0]]; // Add in kerns to the list of params.children to get each element to be\n // shifted to the correct specified shift\n\n var _depth = -oldChildren[0].shift - oldChildren[0].elem.depth;\n\n var currPos = _depth;\n\n for (var i = 1; i < oldChildren.length; i++) {\n var diff = -oldChildren[i].shift - currPos - oldChildren[i].elem.depth;\n var size = diff - (oldChildren[i - 1].elem.height + oldChildren[i - 1].elem.depth);\n currPos = currPos + diff;\n children.push({\n type: \"kern\",\n size\n });\n children.push(oldChildren[i]);\n }\n\n return {\n children,\n depth: _depth\n };\n }\n\n var depth;\n\n if (params.positionType === \"top\") {\n // We always start at the bottom, so calculate the bottom by adding up\n // all the sizes\n var bottom = params.positionData;\n\n for (var _i = 0; _i < params.children.length; _i++) {\n var child = params.children[_i];\n bottom -= child.type === \"kern\" ? child.size : child.elem.height + child.elem.depth;\n }\n\n depth = bottom;\n } else if (params.positionType === \"bottom\") {\n depth = -params.positionData;\n } else {\n var firstChild = params.children[0];\n\n if (firstChild.type !== \"elem\") {\n throw new Error('First child must have type \"elem\".');\n }\n\n if (params.positionType === \"shift\") {\n depth = -firstChild.elem.depth - params.positionData;\n } else if (params.positionType === \"firstBaseline\") {\n depth = -firstChild.elem.depth;\n } else {\n throw new Error(\"Invalid positionType \" + params.positionType + \".\");\n }\n }\n\n return {\n children: params.children,\n depth\n };\n};\n/**\n * Makes a vertical list by stacking elements and kerns on top of each other.\n * Allows for many different ways of specifying the positioning method.\n *\n * See VListParam documentation above.\n */\n\n\nvar makeVList = function makeVList(params, options) {\n var {\n children,\n depth\n } = getVListChildrenAndDepth(params); // Create a strut that is taller than any list item. The strut is added to\n // each item, where it will determine the item's baseline. Since it has\n // `overflow:hidden`, the strut's top edge will sit on the item's line box's\n // top edge and the strut's bottom edge will sit on the item's baseline,\n // with no additional line-height spacing. This allows the item baseline to\n // be positioned precisely without worrying about font ascent and\n // line-height.\n\n var pstrutSize = 0;\n\n for (var i = 0; i < children.length; i++) {\n var child = children[i];\n\n if (child.type === \"elem\") {\n var elem = child.elem;\n pstrutSize = Math.max(pstrutSize, elem.maxFontSize, elem.height);\n }\n }\n\n pstrutSize += 2;\n var pstrut = makeSpan$2([\"pstrut\"], []);\n pstrut.style.height = makeEm(pstrutSize); // Create a new list of actual children at the correct offsets\n\n var realChildren = [];\n var minPos = depth;\n var maxPos = depth;\n var currPos = depth;\n\n for (var _i2 = 0; _i2 < children.length; _i2++) {\n var _child = children[_i2];\n\n if (_child.type === \"kern\") {\n currPos += _child.size;\n } else {\n var _elem = _child.elem;\n var classes = _child.wrapperClasses || [];\n var style = _child.wrapperStyle || {};\n var childWrap = makeSpan$2(classes, [pstrut, _elem], undefined, style);\n childWrap.style.top = makeEm(-pstrutSize - currPos - _elem.depth);\n\n if (_child.marginLeft) {\n childWrap.style.marginLeft = _child.marginLeft;\n }\n\n if (_child.marginRight) {\n childWrap.style.marginRight = _child.marginRight;\n }\n\n realChildren.push(childWrap);\n currPos += _elem.height + _elem.depth;\n }\n\n minPos = Math.min(minPos, currPos);\n maxPos = Math.max(maxPos, currPos);\n } // The vlist contents go in a table-cell with `vertical-align:bottom`.\n // This cell's bottom edge will determine the containing table's baseline\n // without overly expanding the containing line-box.\n\n\n var vlist = makeSpan$2([\"vlist\"], realChildren);\n vlist.style.height = makeEm(maxPos); // A second row is used if necessary to represent the vlist's depth.\n\n var rows;\n\n if (minPos < 0) {\n // We will define depth in an empty span with display: table-cell.\n // It should render with the height that we define. But Chrome, in\n // contenteditable mode only, treats that span as if it contains some\n // text content. And that min-height over-rides our desired height.\n // So we put another empty span inside the depth strut span.\n var emptySpan = makeSpan$2([], []);\n var depthStrut = makeSpan$2([\"vlist\"], [emptySpan]);\n depthStrut.style.height = makeEm(-minPos); // Safari wants the first row to have inline content; otherwise it\n // puts the bottom of the *second* row on the baseline.\n\n var topStrut = makeSpan$2([\"vlist-s\"], [new SymbolNode(\"\\u200b\")]);\n rows = [makeSpan$2([\"vlist-r\"], [vlist, topStrut]), makeSpan$2([\"vlist-r\"], [depthStrut])];\n } else {\n rows = [makeSpan$2([\"vlist-r\"], [vlist])];\n }\n\n var vtable = makeSpan$2([\"vlist-t\"], rows);\n\n if (rows.length === 2) {\n vtable.classes.push(\"vlist-t2\");\n }\n\n vtable.height = maxPos;\n vtable.depth = -minPos;\n return vtable;\n}; // Glue is a concept from TeX which is a flexible space between elements in\n// either a vertical or horizontal list. In KaTeX, at least for now, it's\n// static space between elements in a horizontal layout.\n\n\nvar makeGlue = (measurement, options) => {\n // Make an empty span for the space\n var rule = makeSpan$2([\"mspace\"], [], options);\n var size = calculateSize(measurement, options);\n rule.style.marginRight = makeEm(size);\n return rule;\n}; // Takes font options, and returns the appropriate fontLookup name\n\n\nvar retrieveTextFontName = function retrieveTextFontName(fontFamily, fontWeight, fontShape) {\n var baseFontName = \"\";\n\n switch (fontFamily) {\n case \"amsrm\":\n baseFontName = \"AMS\";\n break;\n\n case \"textrm\":\n baseFontName = \"Main\";\n break;\n\n case \"textsf\":\n baseFontName = \"SansSerif\";\n break;\n\n case \"texttt\":\n baseFontName = \"Typewriter\";\n break;\n\n default:\n baseFontName = fontFamily;\n // use fonts added by a plugin\n }\n\n var fontStylesName;\n\n if (fontWeight === \"textbf\" && fontShape === \"textit\") {\n fontStylesName = \"BoldItalic\";\n } else if (fontWeight === \"textbf\") {\n fontStylesName = \"Bold\";\n } else if (fontWeight === \"textit\") {\n fontStylesName = \"Italic\";\n } else {\n fontStylesName = \"Regular\";\n }\n\n return baseFontName + \"-\" + fontStylesName;\n};\n/**\n * Maps TeX font commands to objects containing:\n * - variant: string used for \"mathvariant\" attribute in buildMathML.js\n * - fontName: the \"style\" parameter to fontMetrics.getCharacterMetrics\n */\n// A map between tex font commands an MathML mathvariant attribute values\n\n\nvar fontMap = {\n // styles\n \"mathbf\": {\n variant: \"bold\",\n fontName: \"Main-Bold\"\n },\n \"mathrm\": {\n variant: \"normal\",\n fontName: \"Main-Regular\"\n },\n \"textit\": {\n variant: \"italic\",\n fontName: \"Main-Italic\"\n },\n \"mathit\": {\n variant: \"italic\",\n fontName: \"Main-Italic\"\n },\n \"mathnormal\": {\n variant: \"italic\",\n fontName: \"Math-Italic\"\n },\n // \"boldsymbol\" is missing because they require the use of multiple fonts:\n // Math-BoldItalic and Main-Bold. This is handled by a special case in\n // makeOrd which ends up calling boldsymbol.\n // families\n \"mathbb\": {\n variant: \"double-struck\",\n fontName: \"AMS-Regular\"\n },\n \"mathcal\": {\n variant: \"script\",\n fontName: \"Caligraphic-Regular\"\n },\n \"mathfrak\": {\n variant: \"fraktur\",\n fontName: \"Fraktur-Regular\"\n },\n \"mathscr\": {\n variant: \"script\",\n fontName: \"Script-Regular\"\n },\n \"mathsf\": {\n variant: \"sans-serif\",\n fontName: \"SansSerif-Regular\"\n },\n \"mathtt\": {\n variant: \"monospace\",\n fontName: \"Typewriter-Regular\"\n }\n};\nvar svgData = {\n // path, width, height\n vec: [\"vec\", 0.471, 0.714],\n // values from the font glyph\n oiintSize1: [\"oiintSize1\", 0.957, 0.499],\n // oval to overlay the integrand\n oiintSize2: [\"oiintSize2\", 1.472, 0.659],\n oiiintSize1: [\"oiiintSize1\", 1.304, 0.499],\n oiiintSize2: [\"oiiintSize2\", 1.98, 0.659]\n};\n\nvar staticSvg = function staticSvg(value, options) {\n // Create a span with inline SVG for the element.\n var [pathName, width, height] = svgData[value];\n var path = new PathNode(pathName);\n var svgNode = new SvgNode([path], {\n \"width\": makeEm(width),\n \"height\": makeEm(height),\n // Override CSS rule `.katex svg { width: 100% }`\n \"style\": \"width:\" + makeEm(width),\n \"viewBox\": \"0 0 \" + 1000 * width + \" \" + 1000 * height,\n \"preserveAspectRatio\": \"xMinYMin\"\n });\n var span = makeSvgSpan([\"overlay\"], [svgNode], options);\n span.height = height;\n span.style.height = makeEm(height);\n span.style.width = makeEm(width);\n return span;\n};\n\nvar buildCommon = {\n fontMap,\n makeSymbol,\n mathsym,\n makeSpan: makeSpan$2,\n makeSvgSpan,\n makeLineSpan,\n makeAnchor,\n makeFragment,\n wrapFragment,\n makeVList,\n makeOrd,\n makeGlue,\n staticSvg,\n svgData,\n tryCombineChars\n};\n\n/**\n * Describes spaces between different classes of atoms.\n */\nvar thinspace = {\n number: 3,\n unit: \"mu\"\n};\nvar mediumspace = {\n number: 4,\n unit: \"mu\"\n};\nvar thickspace = {\n number: 5,\n unit: \"mu\"\n}; // Making the type below exact with all optional fields doesn't work due to\n// - https://github.com/facebook/flow/issues/4582\n// - https://github.com/facebook/flow/issues/5688\n// However, since *all* fields are optional, $Shape<> works as suggested in 5688\n// above.\n\n// Spacing relationships for display and text styles\nvar spacings = {\n mord: {\n mop: thinspace,\n mbin: mediumspace,\n mrel: thickspace,\n minner: thinspace\n },\n mop: {\n mord: thinspace,\n mop: thinspace,\n mrel: thickspace,\n minner: thinspace\n },\n mbin: {\n mord: mediumspace,\n mop: mediumspace,\n mopen: mediumspace,\n minner: mediumspace\n },\n mrel: {\n mord: thickspace,\n mop: thickspace,\n mopen: thickspace,\n minner: thickspace\n },\n mopen: {},\n mclose: {\n mop: thinspace,\n mbin: mediumspace,\n mrel: thickspace,\n minner: thinspace\n },\n mpunct: {\n mord: thinspace,\n mop: thinspace,\n mrel: thickspace,\n mopen: thinspace,\n mclose: thinspace,\n mpunct: thinspace,\n minner: thinspace\n },\n minner: {\n mord: thinspace,\n mop: thinspace,\n mbin: mediumspace,\n mrel: thickspace,\n mopen: thinspace,\n mpunct: thinspace,\n minner: thinspace\n }\n}; // Spacing relationships for script and scriptscript styles\n\nvar tightSpacings = {\n mord: {\n mop: thinspace\n },\n mop: {\n mord: thinspace,\n mop: thinspace\n },\n mbin: {},\n mrel: {},\n mopen: {},\n mclose: {\n mop: thinspace\n },\n mpunct: {},\n minner: {\n mop: thinspace\n }\n};\n\n/** Context provided to function handlers for error messages. */\n// Note: reverse the order of the return type union will cause a flow error.\n// See https://github.com/facebook/flow/issues/3663.\n// More general version of `HtmlBuilder` for nodes (e.g. \\sum, accent types)\n// whose presence impacts super/subscripting. In this case, ParseNode<\"supsub\">\n// delegates its HTML building to the HtmlBuilder corresponding to these nodes.\n\n/**\n * Final function spec for use at parse time.\n * This is almost identical to `FunctionPropSpec`, except it\n * 1. includes the function handler, and\n * 2. requires all arguments except argTypes.\n * It is generated by `defineFunction()` below.\n */\n\n/**\n * All registered functions.\n * `functions.js` just exports this same dictionary again and makes it public.\n * `Parser.js` requires this dictionary.\n */\nvar _functions = {};\n/**\n * All HTML builders. Should be only used in the `define*` and the `build*ML`\n * functions.\n */\n\nvar _htmlGroupBuilders = {};\n/**\n * All MathML builders. Should be only used in the `define*` and the `build*ML`\n * functions.\n */\n\nvar _mathmlGroupBuilders = {};\nfunction defineFunction(_ref) {\n var {\n type,\n names,\n props,\n handler,\n htmlBuilder,\n mathmlBuilder\n } = _ref;\n // Set default values of functions\n var data = {\n type,\n numArgs: props.numArgs,\n argTypes: props.argTypes,\n allowedInArgument: !!props.allowedInArgument,\n allowedInText: !!props.allowedInText,\n allowedInMath: props.allowedInMath === undefined ? true : props.allowedInMath,\n numOptionalArgs: props.numOptionalArgs || 0,\n infix: !!props.infix,\n primitive: !!props.primitive,\n handler: handler\n };\n\n for (var i = 0; i < names.length; ++i) {\n _functions[names[i]] = data;\n }\n\n if (type) {\n if (htmlBuilder) {\n _htmlGroupBuilders[type] = htmlBuilder;\n }\n\n if (mathmlBuilder) {\n _mathmlGroupBuilders[type] = mathmlBuilder;\n }\n }\n}\n/**\n * Use this to register only the HTML and MathML builders for a function (e.g.\n * if the function's ParseNode is generated in Parser.js rather than via a\n * stand-alone handler provided to `defineFunction`).\n */\n\nfunction defineFunctionBuilders(_ref2) {\n var {\n type,\n htmlBuilder,\n mathmlBuilder\n } = _ref2;\n defineFunction({\n type,\n names: [],\n props: {\n numArgs: 0\n },\n\n handler() {\n throw new Error('Should never be called.');\n },\n\n htmlBuilder,\n mathmlBuilder\n });\n}\nvar normalizeArgument = function normalizeArgument(arg) {\n return arg.type === \"ordgroup\" && arg.body.length === 1 ? arg.body[0] : arg;\n}; // Since the corresponding buildHTML/buildMathML function expects a\n// list of elements, we normalize for different kinds of arguments\n\nvar ordargument = function ordargument(arg) {\n return arg.type === \"ordgroup\" ? arg.body : [arg];\n};\n\n/**\n * This file does the main work of building a domTree structure from a parse\n * tree. The entry point is the `buildHTML` function, which takes a parse tree.\n * Then, the buildExpression, buildGroup, and various groupBuilders functions\n * are called, to produce a final HTML tree.\n */\nvar makeSpan$1 = buildCommon.makeSpan; // Binary atoms (first class `mbin`) change into ordinary atoms (`mord`)\n// depending on their surroundings. See TeXbook pg. 442-446, Rules 5 and 6,\n// and the text before Rule 19.\n\nvar binLeftCanceller = [\"leftmost\", \"mbin\", \"mopen\", \"mrel\", \"mop\", \"mpunct\"];\nvar binRightCanceller = [\"rightmost\", \"mrel\", \"mclose\", \"mpunct\"];\nvar styleMap$1 = {\n \"display\": Style$1.DISPLAY,\n \"text\": Style$1.TEXT,\n \"script\": Style$1.SCRIPT,\n \"scriptscript\": Style$1.SCRIPTSCRIPT\n};\nvar DomEnum = {\n mord: \"mord\",\n mop: \"mop\",\n mbin: \"mbin\",\n mrel: \"mrel\",\n mopen: \"mopen\",\n mclose: \"mclose\",\n mpunct: \"mpunct\",\n minner: \"minner\"\n};\n\n/**\n * Take a list of nodes, build them in order, and return a list of the built\n * nodes. documentFragments are flattened into their contents, so the\n * returned list contains no fragments. `isRealGroup` is true if `expression`\n * is a real group (no atoms will be added on either side), as opposed to\n * a partial group (e.g. one created by \\color). `surrounding` is an array\n * consisting type of nodes that will be added to the left and right.\n */\nvar buildExpression$1 = function buildExpression(expression, options, isRealGroup, surrounding) {\n if (surrounding === void 0) {\n surrounding = [null, null];\n }\n\n // Parse expressions into `groups`.\n var groups = [];\n\n for (var i = 0; i < expression.length; i++) {\n var output = buildGroup$1(expression[i], options);\n\n if (output instanceof DocumentFragment) {\n var children = output.children;\n groups.push(...children);\n } else {\n groups.push(output);\n }\n } // Combine consecutive domTree.symbolNodes into a single symbolNode.\n\n\n buildCommon.tryCombineChars(groups); // If `expression` is a partial group, let the parent handle spacings\n // to avoid processing groups multiple times.\n\n if (!isRealGroup) {\n return groups;\n }\n\n var glueOptions = options;\n\n if (expression.length === 1) {\n var node = expression[0];\n\n if (node.type === \"sizing\") {\n glueOptions = options.havingSize(node.size);\n } else if (node.type === \"styling\") {\n glueOptions = options.havingStyle(styleMap$1[node.style]);\n }\n } // Dummy spans for determining spacings between surrounding atoms.\n // If `expression` has no atoms on the left or right, class \"leftmost\"\n // or \"rightmost\", respectively, is used to indicate it.\n\n\n var dummyPrev = makeSpan$1([surrounding[0] || \"leftmost\"], [], options);\n var dummyNext = makeSpan$1([surrounding[1] || \"rightmost\"], [], options); // TODO: These code assumes that a node's math class is the first element\n // of its `classes` array. A later cleanup should ensure this, for\n // instance by changing the signature of `makeSpan`.\n // Before determining what spaces to insert, perform bin cancellation.\n // Binary operators change to ordinary symbols in some contexts.\n\n var isRoot = isRealGroup === \"root\";\n traverseNonSpaceNodes(groups, (node, prev) => {\n var prevType = prev.classes[0];\n var type = node.classes[0];\n\n if (prevType === \"mbin\" && utils.contains(binRightCanceller, type)) {\n prev.classes[0] = \"mord\";\n } else if (type === \"mbin\" && utils.contains(binLeftCanceller, prevType)) {\n node.classes[0] = \"mord\";\n }\n }, {\n node: dummyPrev\n }, dummyNext, isRoot);\n traverseNonSpaceNodes(groups, (node, prev) => {\n var prevType = getTypeOfDomTree(prev);\n var type = getTypeOfDomTree(node); // 'mtight' indicates that the node is script or scriptscript style.\n\n var space = prevType && type ? node.hasClass(\"mtight\") ? tightSpacings[prevType][type] : spacings[prevType][type] : null;\n\n if (space) {\n // Insert glue (spacing) after the `prev`.\n return buildCommon.makeGlue(space, glueOptions);\n }\n }, {\n node: dummyPrev\n }, dummyNext, isRoot);\n return groups;\n}; // Depth-first traverse non-space `nodes`, calling `callback` with the current and\n// previous node as arguments, optionally returning a node to insert after the\n// previous node. `prev` is an object with the previous node and `insertAfter`\n// function to insert after it. `next` is a node that will be added to the right.\n// Used for bin cancellation and inserting spacings.\n\nvar traverseNonSpaceNodes = function traverseNonSpaceNodes(nodes, callback, prev, next, isRoot) {\n if (next) {\n // temporarily append the right node, if exists\n nodes.push(next);\n }\n\n var i = 0;\n\n for (; i < nodes.length; i++) {\n var node = nodes[i];\n var partialGroup = checkPartialGroup(node);\n\n if (partialGroup) {\n // Recursive DFS\n // $FlowFixMe: make nodes a $ReadOnlyArray by returning a new array\n traverseNonSpaceNodes(partialGroup.children, callback, prev, null, isRoot);\n continue;\n } // Ignore explicit spaces (e.g., \\;, \\,) when determining what implicit\n // spacing should go between atoms of different classes\n\n\n var nonspace = !node.hasClass(\"mspace\");\n\n if (nonspace) {\n var result = callback(node, prev.node);\n\n if (result) {\n if (prev.insertAfter) {\n prev.insertAfter(result);\n } else {\n // insert at front\n nodes.unshift(result);\n i++;\n }\n }\n }\n\n if (nonspace) {\n prev.node = node;\n } else if (isRoot && node.hasClass(\"newline\")) {\n prev.node = makeSpan$1([\"leftmost\"]); // treat like beginning of line\n }\n\n prev.insertAfter = (index => n => {\n nodes.splice(index + 1, 0, n);\n i++;\n })(i);\n }\n\n if (next) {\n nodes.pop();\n }\n}; // Check if given node is a partial group, i.e., does not affect spacing around.\n\n\nvar checkPartialGroup = function checkPartialGroup(node) {\n if (node instanceof DocumentFragment || node instanceof Anchor || node instanceof Span && node.hasClass(\"enclosing\")) {\n return node;\n }\n\n return null;\n}; // Return the outermost node of a domTree.\n\n\nvar getOutermostNode = function getOutermostNode(node, side) {\n var partialGroup = checkPartialGroup(node);\n\n if (partialGroup) {\n var children = partialGroup.children;\n\n if (children.length) {\n if (side === \"right\") {\n return getOutermostNode(children[children.length - 1], \"right\");\n } else if (side === \"left\") {\n return getOutermostNode(children[0], \"left\");\n }\n }\n }\n\n return node;\n}; // Return math atom class (mclass) of a domTree.\n// If `side` is given, it will get the type of the outermost node at given side.\n\n\nvar getTypeOfDomTree = function getTypeOfDomTree(node, side) {\n if (!node) {\n return null;\n }\n\n if (side) {\n node = getOutermostNode(node, side);\n } // This makes a lot of assumptions as to where the type of atom\n // appears. We should do a better job of enforcing this.\n\n\n return DomEnum[node.classes[0]] || null;\n};\nvar makeNullDelimiter = function makeNullDelimiter(options, classes) {\n var moreClasses = [\"nulldelimiter\"].concat(options.baseSizingClasses());\n return makeSpan$1(classes.concat(moreClasses));\n};\n/**\n * buildGroup is the function that takes a group and calls the correct groupType\n * function for it. It also handles the interaction of size and style changes\n * between parents and children.\n */\n\nvar buildGroup$1 = function buildGroup(group, options, baseOptions) {\n if (!group) {\n return makeSpan$1();\n }\n\n if (_htmlGroupBuilders[group.type]) {\n // Call the groupBuilders function\n // $FlowFixMe\n var groupNode = _htmlGroupBuilders[group.type](group, options); // If the size changed between the parent and the current group, account\n // for that size difference.\n\n if (baseOptions && options.size !== baseOptions.size) {\n groupNode = makeSpan$1(options.sizingClasses(baseOptions), [groupNode], options);\n var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier;\n groupNode.height *= multiplier;\n groupNode.depth *= multiplier;\n }\n\n return groupNode;\n } else {\n throw new ParseError(\"Got group of unknown type: '\" + group.type + \"'\");\n }\n};\n/**\n * Combine an array of HTML DOM nodes (e.g., the output of `buildExpression`)\n * into an unbreakable HTML node of class .base, with proper struts to\n * guarantee correct vertical extent. `buildHTML` calls this repeatedly to\n * make up the entire expression as a sequence of unbreakable units.\n */\n\nfunction buildHTMLUnbreakable(children, options) {\n // Compute height and depth of this chunk.\n var body = makeSpan$1([\"base\"], children, options); // Add strut, which ensures that the top of the HTML element falls at\n // the height of the expression, and the bottom of the HTML element\n // falls at the depth of the expression.\n\n var strut = makeSpan$1([\"strut\"]);\n strut.style.height = makeEm(body.height + body.depth);\n\n if (body.depth) {\n strut.style.verticalAlign = makeEm(-body.depth);\n }\n\n body.children.unshift(strut);\n return body;\n}\n/**\n * Take an entire parse tree, and build it into an appropriate set of HTML\n * nodes.\n */\n\n\nfunction buildHTML(tree, options) {\n // Strip off outer tag wrapper for processing below.\n var tag = null;\n\n if (tree.length === 1 && tree[0].type === \"tag\") {\n tag = tree[0].tag;\n tree = tree[0].body;\n } // Build the expression contained in the tree\n\n\n var expression = buildExpression$1(tree, options, \"root\");\n var eqnNum;\n\n if (expression.length === 2 && expression[1].hasClass(\"tag\")) {\n // An environment with automatic equation numbers, e.g. {gather}.\n eqnNum = expression.pop();\n }\n\n var children = []; // Create one base node for each chunk between potential line breaks.\n // The TeXBook [p.173] says \"A formula will be broken only after a\n // relation symbol like $=$ or $<$ or $\\rightarrow$, or after a binary\n // operation symbol like $+$ or $-$ or $\\times$, where the relation or\n // binary operation is on the ``outer level'' of the formula (i.e., not\n // enclosed in {...} and not part of an \\over construction).\"\n\n var parts = [];\n\n for (var i = 0; i < expression.length; i++) {\n parts.push(expression[i]);\n\n if (expression[i].hasClass(\"mbin\") || expression[i].hasClass(\"mrel\") || expression[i].hasClass(\"allowbreak\")) {\n // Put any post-operator glue on same line as operator.\n // Watch for \\nobreak along the way, and stop at \\newline.\n var nobreak = false;\n\n while (i < expression.length - 1 && expression[i + 1].hasClass(\"mspace\") && !expression[i + 1].hasClass(\"newline\")) {\n i++;\n parts.push(expression[i]);\n\n if (expression[i].hasClass(\"nobreak\")) {\n nobreak = true;\n }\n } // Don't allow break if \\nobreak among the post-operator glue.\n\n\n if (!nobreak) {\n children.push(buildHTMLUnbreakable(parts, options));\n parts = [];\n }\n } else if (expression[i].hasClass(\"newline\")) {\n // Write the line except the newline\n parts.pop();\n\n if (parts.length > 0) {\n children.push(buildHTMLUnbreakable(parts, options));\n parts = [];\n } // Put the newline at the top level\n\n\n children.push(expression[i]);\n }\n }\n\n if (parts.length > 0) {\n children.push(buildHTMLUnbreakable(parts, options));\n } // Now, if there was a tag, build it too and append it as a final child.\n\n\n var tagChild;\n\n if (tag) {\n tagChild = buildHTMLUnbreakable(buildExpression$1(tag, options, true));\n tagChild.classes = [\"tag\"];\n children.push(tagChild);\n } else if (eqnNum) {\n children.push(eqnNum);\n }\n\n var htmlNode = makeSpan$1([\"katex-html\"], children);\n htmlNode.setAttribute(\"aria-hidden\", \"true\"); // Adjust the strut of the tag to be the maximum height of all children\n // (the height of the enclosing htmlNode) for proper vertical alignment.\n\n if (tagChild) {\n var strut = tagChild.children[0];\n strut.style.height = makeEm(htmlNode.height + htmlNode.depth);\n\n if (htmlNode.depth) {\n strut.style.verticalAlign = makeEm(-htmlNode.depth);\n }\n }\n\n return htmlNode;\n}\n\n/**\n * These objects store data about MathML nodes. This is the MathML equivalent\n * of the types in domTree.js. Since MathML handles its own rendering, and\n * since we're mainly using MathML to improve accessibility, we don't manage\n * any of the styling state that the plain DOM nodes do.\n *\n * The `toNode` and `toMarkup` functions work similarly to how they do in\n * domTree.js, creating namespaced DOM nodes and HTML text markup respectively.\n */\nfunction newDocumentFragment(children) {\n return new DocumentFragment(children);\n}\n/**\n * This node represents a general purpose MathML node of any type. The\n * constructor requires the type of node to create (for example, `\"mo\"` or\n * `\"mspace\"`, corresponding to `` and `` tags).\n */\n\nclass MathNode {\n constructor(type, children, classes) {\n this.type = void 0;\n this.attributes = void 0;\n this.children = void 0;\n this.classes = void 0;\n this.type = type;\n this.attributes = {};\n this.children = children || [];\n this.classes = classes || [];\n }\n /**\n * Sets an attribute on a MathML node. MathML depends on attributes to convey a\n * semantic content, so this is used heavily.\n */\n\n\n setAttribute(name, value) {\n this.attributes[name] = value;\n }\n /**\n * Gets an attribute on a MathML node.\n */\n\n\n getAttribute(name) {\n return this.attributes[name];\n }\n /**\n * Converts the math node into a MathML-namespaced DOM element.\n */\n\n\n toNode() {\n var node = document.createElementNS(\"http://www.w3.org/1998/Math/MathML\", this.type);\n\n for (var attr in this.attributes) {\n if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {\n node.setAttribute(attr, this.attributes[attr]);\n }\n }\n\n if (this.classes.length > 0) {\n node.className = createClass(this.classes);\n }\n\n for (var i = 0; i < this.children.length; i++) {\n node.appendChild(this.children[i].toNode());\n }\n\n return node;\n }\n /**\n * Converts the math node into an HTML markup string.\n */\n\n\n toMarkup() {\n var markup = \"<\" + this.type; // Add the attributes\n\n for (var attr in this.attributes) {\n if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {\n markup += \" \" + attr + \"=\\\"\";\n markup += utils.escape(this.attributes[attr]);\n markup += \"\\\"\";\n }\n }\n\n if (this.classes.length > 0) {\n markup += \" class =\\\"\" + utils.escape(createClass(this.classes)) + \"\\\"\";\n }\n\n markup += \">\";\n\n for (var i = 0; i < this.children.length; i++) {\n markup += this.children[i].toMarkup();\n }\n\n markup += \"\" + this.type + \">\";\n return markup;\n }\n /**\n * Converts the math node into a string, similar to innerText, but escaped.\n */\n\n\n toText() {\n return this.children.map(child => child.toText()).join(\"\");\n }\n\n}\n/**\n * This node represents a piece of text.\n */\n\nclass TextNode {\n constructor(text) {\n this.text = void 0;\n this.text = text;\n }\n /**\n * Converts the text node into a DOM text node.\n */\n\n\n toNode() {\n return document.createTextNode(this.text);\n }\n /**\n * Converts the text node into escaped HTML markup\n * (representing the text itself).\n */\n\n\n toMarkup() {\n return utils.escape(this.toText());\n }\n /**\n * Converts the text node into a string\n * (representing the text itself).\n */\n\n\n toText() {\n return this.text;\n }\n\n}\n/**\n * This node represents a space, but may render as or as text,\n * depending on the width.\n */\n\nclass SpaceNode {\n /**\n * Create a Space node with width given in CSS ems.\n */\n constructor(width) {\n this.width = void 0;\n this.character = void 0;\n this.width = width; // See https://www.w3.org/TR/2000/WD-MathML2-20000328/chapter6.html\n // for a table of space-like characters. We use Unicode\n // representations instead of &LongNames; as it's not clear how to\n // make the latter via document.createTextNode.\n\n if (width >= 0.05555 && width <= 0.05556) {\n this.character = \"\\u200a\"; //  \n } else if (width >= 0.1666 && width <= 0.1667) {\n this.character = \"\\u2009\"; //  \n } else if (width >= 0.2222 && width <= 0.2223) {\n this.character = \"\\u2005\"; //  \n } else if (width >= 0.2777 && width <= 0.2778) {\n this.character = \"\\u2005\\u200a\"; //   \n } else if (width >= -0.05556 && width <= -0.05555) {\n this.character = \"\\u200a\\u2063\"; // ​\n } else if (width >= -0.1667 && width <= -0.1666) {\n this.character = \"\\u2009\\u2063\"; // ​\n } else if (width >= -0.2223 && width <= -0.2222) {\n this.character = \"\\u205f\\u2063\"; // ​\n } else if (width >= -0.2778 && width <= -0.2777) {\n this.character = \"\\u2005\\u2063\"; // ​\n } else {\n this.character = null;\n }\n }\n /**\n * Converts the math node into a MathML-namespaced DOM element.\n */\n\n\n toNode() {\n if (this.character) {\n return document.createTextNode(this.character);\n } else {\n var node = document.createElementNS(\"http://www.w3.org/1998/Math/MathML\", \"mspace\");\n node.setAttribute(\"width\", makeEm(this.width));\n return node;\n }\n }\n /**\n * Converts the math node into an HTML markup string.\n */\n\n\n toMarkup() {\n if (this.character) {\n return \"\" + this.character + \" \";\n } else {\n return \" \";\n }\n }\n /**\n * Converts the math node into a string, similar to innerText.\n */\n\n\n toText() {\n if (this.character) {\n return this.character;\n } else {\n return \" \";\n }\n }\n\n}\n\nvar mathMLTree = {\n MathNode,\n TextNode,\n SpaceNode,\n newDocumentFragment\n};\n\n/**\n * This file converts a parse tree into a corresponding MathML tree. The main\n * entry point is the `buildMathML` function, which takes a parse tree from the\n * parser.\n */\n\n/**\n * Takes a symbol and converts it into a MathML text node after performing\n * optional replacement from symbols.js.\n */\nvar makeText = function makeText(text, mode, options) {\n if (symbols[mode][text] && symbols[mode][text].replace && text.charCodeAt(0) !== 0xD835 && !(ligatures.hasOwnProperty(text) && options && (options.fontFamily && options.fontFamily.slice(4, 6) === \"tt\" || options.font && options.font.slice(4, 6) === \"tt\"))) {\n text = symbols[mode][text].replace;\n }\n\n return new mathMLTree.TextNode(text);\n};\n/**\n * Wrap the given array of nodes in an node if needed, i.e.,\n * unless the array has length 1. Always returns a single node.\n */\n\nvar makeRow = function makeRow(body) {\n if (body.length === 1) {\n return body[0];\n } else {\n return new mathMLTree.MathNode(\"mrow\", body);\n }\n};\n/**\n * Returns the math variant as a string or null if none is required.\n */\n\nvar getVariant = function getVariant(group, options) {\n // Handle \\text... font specifiers as best we can.\n // MathML has a limited list of allowable mathvariant specifiers; see\n // https://www.w3.org/TR/MathML3/chapter3.html#presm.commatt\n if (options.fontFamily === \"texttt\") {\n return \"monospace\";\n } else if (options.fontFamily === \"textsf\") {\n if (options.fontShape === \"textit\" && options.fontWeight === \"textbf\") {\n return \"sans-serif-bold-italic\";\n } else if (options.fontShape === \"textit\") {\n return \"sans-serif-italic\";\n } else if (options.fontWeight === \"textbf\") {\n return \"bold-sans-serif\";\n } else {\n return \"sans-serif\";\n }\n } else if (options.fontShape === \"textit\" && options.fontWeight === \"textbf\") {\n return \"bold-italic\";\n } else if (options.fontShape === \"textit\") {\n return \"italic\";\n } else if (options.fontWeight === \"textbf\") {\n return \"bold\";\n }\n\n var font = options.font;\n\n if (!font || font === \"mathnormal\") {\n return null;\n }\n\n var mode = group.mode;\n\n if (font === \"mathit\") {\n return \"italic\";\n } else if (font === \"boldsymbol\") {\n return group.type === \"textord\" ? \"bold\" : \"bold-italic\";\n } else if (font === \"mathbf\") {\n return \"bold\";\n } else if (font === \"mathbb\") {\n return \"double-struck\";\n } else if (font === \"mathfrak\") {\n return \"fraktur\";\n } else if (font === \"mathscr\" || font === \"mathcal\") {\n // MathML makes no distinction between script and calligraphic\n return \"script\";\n } else if (font === \"mathsf\") {\n return \"sans-serif\";\n } else if (font === \"mathtt\") {\n return \"monospace\";\n }\n\n var text = group.text;\n\n if (utils.contains([\"\\\\imath\", \"\\\\jmath\"], text)) {\n return null;\n }\n\n if (symbols[mode][text] && symbols[mode][text].replace) {\n text = symbols[mode][text].replace;\n }\n\n var fontName = buildCommon.fontMap[font].fontName;\n\n if (getCharacterMetrics(text, fontName, mode)) {\n return buildCommon.fontMap[font].variant;\n }\n\n return null;\n};\n/**\n * Takes a list of nodes, builds them, and returns a list of the generated\n * MathML nodes. Also combine consecutive outputs into a single\n * tag.\n */\n\nvar buildExpression = function buildExpression(expression, options, isOrdgroup) {\n if (expression.length === 1) {\n var group = buildGroup(expression[0], options);\n\n if (isOrdgroup && group instanceof MathNode && group.type === \"mo\") {\n // When TeX writers want to suppress spacing on an operator,\n // they often put the operator by itself inside braces.\n group.setAttribute(\"lspace\", \"0em\");\n group.setAttribute(\"rspace\", \"0em\");\n }\n\n return [group];\n }\n\n var groups = [];\n var lastGroup;\n\n for (var i = 0; i < expression.length; i++) {\n var _group = buildGroup(expression[i], options);\n\n if (_group instanceof MathNode && lastGroup instanceof MathNode) {\n // Concatenate adjacent s\n if (_group.type === 'mtext' && lastGroup.type === 'mtext' && _group.getAttribute('mathvariant') === lastGroup.getAttribute('mathvariant')) {\n lastGroup.children.push(..._group.children);\n continue; // Concatenate adjacent s\n } else if (_group.type === 'mn' && lastGroup.type === 'mn') {\n lastGroup.children.push(..._group.children);\n continue; // Concatenate ... followed by . \n } else if (_group.type === 'mi' && _group.children.length === 1 && lastGroup.type === 'mn') {\n var child = _group.children[0];\n\n if (child instanceof TextNode && child.text === '.') {\n lastGroup.children.push(..._group.children);\n continue;\n }\n } else if (lastGroup.type === 'mi' && lastGroup.children.length === 1) {\n var lastChild = lastGroup.children[0];\n\n if (lastChild instanceof TextNode && lastChild.text === '\\u0338' && (_group.type === 'mo' || _group.type === 'mi' || _group.type === 'mn')) {\n var _child = _group.children[0];\n\n if (_child instanceof TextNode && _child.text.length > 0) {\n // Overlay with combining character long solidus\n _child.text = _child.text.slice(0, 1) + \"\\u0338\" + _child.text.slice(1);\n groups.pop();\n }\n }\n }\n }\n\n groups.push(_group);\n lastGroup = _group;\n }\n\n return groups;\n};\n/**\n * Equivalent to buildExpression, but wraps the elements in an \n * if there's more than one. Returns a single node instead of an array.\n */\n\nvar buildExpressionRow = function buildExpressionRow(expression, options, isOrdgroup) {\n return makeRow(buildExpression(expression, options, isOrdgroup));\n};\n/**\n * Takes a group from the parser and calls the appropriate groupBuilders function\n * on it to produce a MathML node.\n */\n\nvar buildGroup = function buildGroup(group, options) {\n if (!group) {\n return new mathMLTree.MathNode(\"mrow\");\n }\n\n if (_mathmlGroupBuilders[group.type]) {\n // Call the groupBuilders function\n // $FlowFixMe\n var result = _mathmlGroupBuilders[group.type](group, options); // $FlowFixMe\n\n return result;\n } else {\n throw new ParseError(\"Got group of unknown type: '\" + group.type + \"'\");\n }\n};\n/**\n * Takes a full parse tree and settings and builds a MathML representation of\n * it. In particular, we put the elements from building the parse tree into a\n * tag so we can also include that TeX source as an annotation.\n *\n * Note that we actually return a domTree element with a `` inside it so\n * we can do appropriate styling.\n */\n\nfunction buildMathML(tree, texExpression, options, isDisplayMode, forMathmlOnly) {\n var expression = buildExpression(tree, options); // TODO: Make a pass thru the MathML similar to buildHTML.traverseNonSpaceNodes\n // and add spacing nodes. This is necessary only adjacent to math operators\n // like \\sin or \\lim or to subsup elements that contain math operators.\n // MathML takes care of the other spacing issues.\n // Wrap up the expression in an mrow so it is presented in the semantics\n // tag correctly, unless it's a single or .\n\n var wrapper;\n\n if (expression.length === 1 && expression[0] instanceof MathNode && utils.contains([\"mrow\", \"mtable\"], expression[0].type)) {\n wrapper = expression[0];\n } else {\n wrapper = new mathMLTree.MathNode(\"mrow\", expression);\n } // Build a TeX annotation of the source\n\n\n var annotation = new mathMLTree.MathNode(\"annotation\", [new mathMLTree.TextNode(texExpression)]);\n annotation.setAttribute(\"encoding\", \"application/x-tex\");\n var semantics = new mathMLTree.MathNode(\"semantics\", [wrapper, annotation]);\n var math = new mathMLTree.MathNode(\"math\", [semantics]);\n math.setAttribute(\"xmlns\", \"http://www.w3.org/1998/Math/MathML\");\n\n if (isDisplayMode) {\n math.setAttribute(\"display\", \"block\");\n } // You can't style nodes, so we wrap the node in a span.\n // NOTE: The span class is not typed to have nodes as children, and\n // we don't want to make the children type more generic since the children\n // of span are expected to have more fields in `buildHtml` contexts.\n\n\n var wrapperClass = forMathmlOnly ? \"katex\" : \"katex-mathml\"; // $FlowFixMe\n\n return buildCommon.makeSpan([wrapperClass], [math]);\n}\n\nvar optionsFromSettings = function optionsFromSettings(settings) {\n return new Options({\n style: settings.displayMode ? Style$1.DISPLAY : Style$1.TEXT,\n maxSize: settings.maxSize,\n minRuleThickness: settings.minRuleThickness\n });\n};\n\nvar displayWrap = function displayWrap(node, settings) {\n if (settings.displayMode) {\n var classes = [\"katex-display\"];\n\n if (settings.leqno) {\n classes.push(\"leqno\");\n }\n\n if (settings.fleqn) {\n classes.push(\"fleqn\");\n }\n\n node = buildCommon.makeSpan(classes, [node]);\n }\n\n return node;\n};\n\nvar buildTree = function buildTree(tree, expression, settings) {\n var options = optionsFromSettings(settings);\n var katexNode;\n\n if (settings.output === \"mathml\") {\n return buildMathML(tree, expression, options, settings.displayMode, true);\n } else if (settings.output === \"html\") {\n var htmlNode = buildHTML(tree, options);\n katexNode = buildCommon.makeSpan([\"katex\"], [htmlNode]);\n } else {\n var mathMLNode = buildMathML(tree, expression, options, settings.displayMode, false);\n\n var _htmlNode = buildHTML(tree, options);\n\n katexNode = buildCommon.makeSpan([\"katex\"], [mathMLNode, _htmlNode]);\n }\n\n return displayWrap(katexNode, settings);\n};\nvar buildHTMLTree = function buildHTMLTree(tree, expression, settings) {\n var options = optionsFromSettings(settings);\n var htmlNode = buildHTML(tree, options);\n var katexNode = buildCommon.makeSpan([\"katex\"], [htmlNode]);\n return displayWrap(katexNode, settings);\n};\n\n/**\n * This file provides support to buildMathML.js and buildHTML.js\n * for stretchy wide elements rendered from SVG files\n * and other CSS trickery.\n */\nvar stretchyCodePoint = {\n widehat: \"^\",\n widecheck: \"\u02C7\",\n widetilde: \"~\",\n utilde: \"~\",\n overleftarrow: \"\\u2190\",\n underleftarrow: \"\\u2190\",\n xleftarrow: \"\\u2190\",\n overrightarrow: \"\\u2192\",\n underrightarrow: \"\\u2192\",\n xrightarrow: \"\\u2192\",\n underbrace: \"\\u23df\",\n overbrace: \"\\u23de\",\n overgroup: \"\\u23e0\",\n undergroup: \"\\u23e1\",\n overleftrightarrow: \"\\u2194\",\n underleftrightarrow: \"\\u2194\",\n xleftrightarrow: \"\\u2194\",\n Overrightarrow: \"\\u21d2\",\n xRightarrow: \"\\u21d2\",\n overleftharpoon: \"\\u21bc\",\n xleftharpoonup: \"\\u21bc\",\n overrightharpoon: \"\\u21c0\",\n xrightharpoonup: \"\\u21c0\",\n xLeftarrow: \"\\u21d0\",\n xLeftrightarrow: \"\\u21d4\",\n xhookleftarrow: \"\\u21a9\",\n xhookrightarrow: \"\\u21aa\",\n xmapsto: \"\\u21a6\",\n xrightharpoondown: \"\\u21c1\",\n xleftharpoondown: \"\\u21bd\",\n xrightleftharpoons: \"\\u21cc\",\n xleftrightharpoons: \"\\u21cb\",\n xtwoheadleftarrow: \"\\u219e\",\n xtwoheadrightarrow: \"\\u21a0\",\n xlongequal: \"=\",\n xtofrom: \"\\u21c4\",\n xrightleftarrows: \"\\u21c4\",\n xrightequilibrium: \"\\u21cc\",\n // Not a perfect match.\n xleftequilibrium: \"\\u21cb\",\n // None better available.\n \"\\\\cdrightarrow\": \"\\u2192\",\n \"\\\\cdleftarrow\": \"\\u2190\",\n \"\\\\cdlongequal\": \"=\"\n};\n\nvar mathMLnode = function mathMLnode(label) {\n var node = new mathMLTree.MathNode(\"mo\", [new mathMLTree.TextNode(stretchyCodePoint[label.replace(/^\\\\/, '')])]);\n node.setAttribute(\"stretchy\", \"true\");\n return node;\n}; // Many of the KaTeX SVG images have been adapted from glyphs in KaTeX fonts.\n// Copyright (c) 2009-2010, Design Science, Inc. ()\n// Copyright (c) 2014-2017 Khan Academy ()\n// Licensed under the SIL Open Font License, Version 1.1.\n// See \\nhttp://scripts.sil.org/OFL\n// Very Long SVGs\n// Many of the KaTeX stretchy wide elements use a long SVG image and an\n// overflow: hidden tactic to achieve a stretchy image while avoiding\n// distortion of arrowheads or brace corners.\n// The SVG typically contains a very long (400 em) arrow.\n// The SVG is in a container span that has overflow: hidden, so the span\n// acts like a window that exposes only part of the SVG.\n// The SVG always has a longer, thinner aspect ratio than the container span.\n// After the SVG fills 100% of the height of the container span,\n// there is a long arrow shaft left over. That left-over shaft is not shown.\n// Instead, it is sliced off because the span's CSS has overflow: hidden.\n// Thus, the reader sees an arrow that matches the subject matter width\n// without distortion.\n// Some functions, such as \\cancel, need to vary their aspect ratio. These\n// functions do not get the overflow SVG treatment.\n// Second Brush Stroke\n// Low resolution monitors struggle to display images in fine detail.\n// So browsers apply anti-aliasing. A long straight arrow shaft therefore\n// will sometimes appear as if it has a blurred edge.\n// To mitigate this, these SVG files contain a second \"brush-stroke\" on the\n// arrow shafts. That is, a second long thin rectangular SVG path has been\n// written directly on top of each arrow shaft. This reinforcement causes\n// some of the screen pixels to display as black instead of the anti-aliased\n// gray pixel that a single path would generate. So we get arrow shafts\n// whose edges appear to be sharper.\n// In the katexImagesData object just below, the dimensions all\n// correspond to path geometry inside the relevant SVG.\n// For example, \\overrightarrow uses the same arrowhead as glyph U+2192\n// from the KaTeX Main font. The scaling factor is 1000.\n// That is, inside the font, that arrowhead is 522 units tall, which\n// corresponds to 0.522 em inside the document.\n\n\nvar katexImagesData = {\n // path(s), minWidth, height, align\n overrightarrow: [[\"rightarrow\"], 0.888, 522, \"xMaxYMin\"],\n overleftarrow: [[\"leftarrow\"], 0.888, 522, \"xMinYMin\"],\n underrightarrow: [[\"rightarrow\"], 0.888, 522, \"xMaxYMin\"],\n underleftarrow: [[\"leftarrow\"], 0.888, 522, \"xMinYMin\"],\n xrightarrow: [[\"rightarrow\"], 1.469, 522, \"xMaxYMin\"],\n \"\\\\cdrightarrow\": [[\"rightarrow\"], 3.0, 522, \"xMaxYMin\"],\n // CD minwwidth2.5pc\n xleftarrow: [[\"leftarrow\"], 1.469, 522, \"xMinYMin\"],\n \"\\\\cdleftarrow\": [[\"leftarrow\"], 3.0, 522, \"xMinYMin\"],\n Overrightarrow: [[\"doublerightarrow\"], 0.888, 560, \"xMaxYMin\"],\n xRightarrow: [[\"doublerightarrow\"], 1.526, 560, \"xMaxYMin\"],\n xLeftarrow: [[\"doubleleftarrow\"], 1.526, 560, \"xMinYMin\"],\n overleftharpoon: [[\"leftharpoon\"], 0.888, 522, \"xMinYMin\"],\n xleftharpoonup: [[\"leftharpoon\"], 0.888, 522, \"xMinYMin\"],\n xleftharpoondown: [[\"leftharpoondown\"], 0.888, 522, \"xMinYMin\"],\n overrightharpoon: [[\"rightharpoon\"], 0.888, 522, \"xMaxYMin\"],\n xrightharpoonup: [[\"rightharpoon\"], 0.888, 522, \"xMaxYMin\"],\n xrightharpoondown: [[\"rightharpoondown\"], 0.888, 522, \"xMaxYMin\"],\n xlongequal: [[\"longequal\"], 0.888, 334, \"xMinYMin\"],\n \"\\\\cdlongequal\": [[\"longequal\"], 3.0, 334, \"xMinYMin\"],\n xtwoheadleftarrow: [[\"twoheadleftarrow\"], 0.888, 334, \"xMinYMin\"],\n xtwoheadrightarrow: [[\"twoheadrightarrow\"], 0.888, 334, \"xMaxYMin\"],\n overleftrightarrow: [[\"leftarrow\", \"rightarrow\"], 0.888, 522],\n overbrace: [[\"leftbrace\", \"midbrace\", \"rightbrace\"], 1.6, 548],\n underbrace: [[\"leftbraceunder\", \"midbraceunder\", \"rightbraceunder\"], 1.6, 548],\n underleftrightarrow: [[\"leftarrow\", \"rightarrow\"], 0.888, 522],\n xleftrightarrow: [[\"leftarrow\", \"rightarrow\"], 1.75, 522],\n xLeftrightarrow: [[\"doubleleftarrow\", \"doublerightarrow\"], 1.75, 560],\n xrightleftharpoons: [[\"leftharpoondownplus\", \"rightharpoonplus\"], 1.75, 716],\n xleftrightharpoons: [[\"leftharpoonplus\", \"rightharpoondownplus\"], 1.75, 716],\n xhookleftarrow: [[\"leftarrow\", \"righthook\"], 1.08, 522],\n xhookrightarrow: [[\"lefthook\", \"rightarrow\"], 1.08, 522],\n overlinesegment: [[\"leftlinesegment\", \"rightlinesegment\"], 0.888, 522],\n underlinesegment: [[\"leftlinesegment\", \"rightlinesegment\"], 0.888, 522],\n overgroup: [[\"leftgroup\", \"rightgroup\"], 0.888, 342],\n undergroup: [[\"leftgroupunder\", \"rightgroupunder\"], 0.888, 342],\n xmapsto: [[\"leftmapsto\", \"rightarrow\"], 1.5, 522],\n xtofrom: [[\"leftToFrom\", \"rightToFrom\"], 1.75, 528],\n // The next three arrows are from the mhchem package.\n // In mhchem.sty, min-length is 2.0em. But these arrows might appear in the\n // document as \\xrightarrow or \\xrightleftharpoons. Those have\n // min-length = 1.75em, so we set min-length on these next three to match.\n xrightleftarrows: [[\"baraboveleftarrow\", \"rightarrowabovebar\"], 1.75, 901],\n xrightequilibrium: [[\"baraboveshortleftharpoon\", \"rightharpoonaboveshortbar\"], 1.75, 716],\n xleftequilibrium: [[\"shortbaraboveleftharpoon\", \"shortrightharpoonabovebar\"], 1.75, 716]\n};\n\nvar groupLength = function groupLength(arg) {\n if (arg.type === \"ordgroup\") {\n return arg.body.length;\n } else {\n return 1;\n }\n};\n\nvar svgSpan = function svgSpan(group, options) {\n // Create a span with inline SVG for the element.\n function buildSvgSpan_() {\n var viewBoxWidth = 400000; // default\n\n var label = group.label.slice(1);\n\n if (utils.contains([\"widehat\", \"widecheck\", \"widetilde\", \"utilde\"], label)) {\n // Each type in the `if` statement corresponds to one of the ParseNode\n // types below. This narrowing is required to access `grp.base`.\n // $FlowFixMe\n var grp = group; // There are four SVG images available for each function.\n // Choose a taller image when there are more characters.\n\n var numChars = groupLength(grp.base);\n var viewBoxHeight;\n var pathName;\n\n var _height;\n\n if (numChars > 5) {\n if (label === \"widehat\" || label === \"widecheck\") {\n viewBoxHeight = 420;\n viewBoxWidth = 2364;\n _height = 0.42;\n pathName = label + \"4\";\n } else {\n viewBoxHeight = 312;\n viewBoxWidth = 2340;\n _height = 0.34;\n pathName = \"tilde4\";\n }\n } else {\n var imgIndex = [1, 1, 2, 2, 3, 3][numChars];\n\n if (label === \"widehat\" || label === \"widecheck\") {\n viewBoxWidth = [0, 1062, 2364, 2364, 2364][imgIndex];\n viewBoxHeight = [0, 239, 300, 360, 420][imgIndex];\n _height = [0, 0.24, 0.3, 0.3, 0.36, 0.42][imgIndex];\n pathName = label + imgIndex;\n } else {\n viewBoxWidth = [0, 600, 1033, 2339, 2340][imgIndex];\n viewBoxHeight = [0, 260, 286, 306, 312][imgIndex];\n _height = [0, 0.26, 0.286, 0.3, 0.306, 0.34][imgIndex];\n pathName = \"tilde\" + imgIndex;\n }\n }\n\n var path = new PathNode(pathName);\n var svgNode = new SvgNode([path], {\n \"width\": \"100%\",\n \"height\": makeEm(_height),\n \"viewBox\": \"0 0 \" + viewBoxWidth + \" \" + viewBoxHeight,\n \"preserveAspectRatio\": \"none\"\n });\n return {\n span: buildCommon.makeSvgSpan([], [svgNode], options),\n minWidth: 0,\n height: _height\n };\n } else {\n var spans = [];\n var data = katexImagesData[label];\n var [paths, _minWidth, _viewBoxHeight] = data;\n\n var _height2 = _viewBoxHeight / 1000;\n\n var numSvgChildren = paths.length;\n var widthClasses;\n var aligns;\n\n if (numSvgChildren === 1) {\n // $FlowFixMe: All these cases must be of the 4-tuple type.\n var align1 = data[3];\n widthClasses = [\"hide-tail\"];\n aligns = [align1];\n } else if (numSvgChildren === 2) {\n widthClasses = [\"halfarrow-left\", \"halfarrow-right\"];\n aligns = [\"xMinYMin\", \"xMaxYMin\"];\n } else if (numSvgChildren === 3) {\n widthClasses = [\"brace-left\", \"brace-center\", \"brace-right\"];\n aligns = [\"xMinYMin\", \"xMidYMin\", \"xMaxYMin\"];\n } else {\n throw new Error(\"Correct katexImagesData or update code here to support\\n \" + numSvgChildren + \" children.\");\n }\n\n for (var i = 0; i < numSvgChildren; i++) {\n var _path = new PathNode(paths[i]);\n\n var _svgNode = new SvgNode([_path], {\n \"width\": \"400em\",\n \"height\": makeEm(_height2),\n \"viewBox\": \"0 0 \" + viewBoxWidth + \" \" + _viewBoxHeight,\n \"preserveAspectRatio\": aligns[i] + \" slice\"\n });\n\n var _span = buildCommon.makeSvgSpan([widthClasses[i]], [_svgNode], options);\n\n if (numSvgChildren === 1) {\n return {\n span: _span,\n minWidth: _minWidth,\n height: _height2\n };\n } else {\n _span.style.height = makeEm(_height2);\n spans.push(_span);\n }\n }\n\n return {\n span: buildCommon.makeSpan([\"stretchy\"], spans, options),\n minWidth: _minWidth,\n height: _height2\n };\n }\n } // buildSvgSpan_()\n\n\n var {\n span,\n minWidth,\n height\n } = buildSvgSpan_(); // Note that we are returning span.depth = 0.\n // Any adjustments relative to the baseline must be done in buildHTML.\n\n span.height = height;\n span.style.height = makeEm(height);\n\n if (minWidth > 0) {\n span.style.minWidth = makeEm(minWidth);\n }\n\n return span;\n};\n\nvar encloseSpan = function encloseSpan(inner, label, topPad, bottomPad, options) {\n // Return an image span for \\cancel, \\bcancel, \\xcancel, \\fbox, or \\angl\n var img;\n var totalHeight = inner.height + inner.depth + topPad + bottomPad;\n\n if (/fbox|color|angl/.test(label)) {\n img = buildCommon.makeSpan([\"stretchy\", label], [], options);\n\n if (label === \"fbox\") {\n var color = options.color && options.getColor();\n\n if (color) {\n img.style.borderColor = color;\n }\n }\n } else {\n // \\cancel, \\bcancel, or \\xcancel\n // Since \\cancel's SVG is inline and it omits the viewBox attribute,\n // its stroke-width will not vary with span area.\n var lines = [];\n\n if (/^[bx]cancel$/.test(label)) {\n lines.push(new LineNode({\n \"x1\": \"0\",\n \"y1\": \"0\",\n \"x2\": \"100%\",\n \"y2\": \"100%\",\n \"stroke-width\": \"0.046em\"\n }));\n }\n\n if (/^x?cancel$/.test(label)) {\n lines.push(new LineNode({\n \"x1\": \"0\",\n \"y1\": \"100%\",\n \"x2\": \"100%\",\n \"y2\": \"0\",\n \"stroke-width\": \"0.046em\"\n }));\n }\n\n var svgNode = new SvgNode(lines, {\n \"width\": \"100%\",\n \"height\": makeEm(totalHeight)\n });\n img = buildCommon.makeSvgSpan([], [svgNode], options);\n }\n\n img.height = totalHeight;\n img.style.height = makeEm(totalHeight);\n return img;\n};\n\nvar stretchy = {\n encloseSpan,\n mathMLnode,\n svgSpan\n};\n\n/**\n * Asserts that the node is of the given type and returns it with stricter\n * typing. Throws if the node's type does not match.\n */\nfunction assertNodeType(node, type) {\n if (!node || node.type !== type) {\n throw new Error(\"Expected node of type \" + type + \", but got \" + (node ? \"node of type \" + node.type : String(node)));\n } // $FlowFixMe, >=0.125\n\n\n return node;\n}\n/**\n * Returns the node more strictly typed iff it is of the given type. Otherwise,\n * returns null.\n */\n\nfunction assertSymbolNodeType(node) {\n var typedNode = checkSymbolNodeType(node);\n\n if (!typedNode) {\n throw new Error(\"Expected node of symbol group type, but got \" + (node ? \"node of type \" + node.type : String(node)));\n }\n\n return typedNode;\n}\n/**\n * Returns the node more strictly typed iff it is of the given type. Otherwise,\n * returns null.\n */\n\nfunction checkSymbolNodeType(node) {\n if (node && (node.type === \"atom\" || NON_ATOMS.hasOwnProperty(node.type))) {\n // $FlowFixMe\n return node;\n }\n\n return null;\n}\n\n// NOTE: Unlike most `htmlBuilder`s, this one handles not only \"accent\", but\n// also \"supsub\" since an accent can affect super/subscripting.\nvar htmlBuilder$a = (grp, options) => {\n // Accents are handled in the TeXbook pg. 443, rule 12.\n var base;\n var group;\n var supSubGroup;\n\n if (grp && grp.type === \"supsub\") {\n // If our base is a character box, and we have superscripts and\n // subscripts, the supsub will defer to us. In particular, we want\n // to attach the superscripts and subscripts to the inner body (so\n // that the position of the superscripts and subscripts won't be\n // affected by the height of the accent). We accomplish this by\n // sticking the base of the accent into the base of the supsub, and\n // rendering that, while keeping track of where the accent is.\n // The real accent group is the base of the supsub group\n group = assertNodeType(grp.base, \"accent\"); // The character box is the base of the accent group\n\n base = group.base; // Stick the character box into the base of the supsub group\n\n grp.base = base; // Rerender the supsub group with its new base, and store that\n // result.\n\n supSubGroup = assertSpan(buildGroup$1(grp, options)); // reset original base\n\n grp.base = group;\n } else {\n group = assertNodeType(grp, \"accent\");\n base = group.base;\n } // Build the base group\n\n\n var body = buildGroup$1(base, options.havingCrampedStyle()); // Does the accent need to shift for the skew of a character?\n\n var mustShift = group.isShifty && utils.isCharacterBox(base); // Calculate the skew of the accent. This is based on the line \"If the\n // nucleus is not a single character, let s = 0; otherwise set s to the\n // kern amount for the nucleus followed by the \\skewchar of its font.\"\n // Note that our skew metrics are just the kern between each character\n // and the skewchar.\n\n var skew = 0;\n\n if (mustShift) {\n // If the base is a character box, then we want the skew of the\n // innermost character. To do that, we find the innermost character:\n var baseChar = utils.getBaseElem(base); // Then, we render its group to get the symbol inside it\n\n var baseGroup = buildGroup$1(baseChar, options.havingCrampedStyle()); // Finally, we pull the skew off of the symbol.\n\n skew = assertSymbolDomNode(baseGroup).skew; // Note that we now throw away baseGroup, because the layers we\n // removed with getBaseElem might contain things like \\color which\n // we can't get rid of.\n // TODO(emily): Find a better way to get the skew\n }\n\n var accentBelow = group.label === \"\\\\c\"; // calculate the amount of space between the body and the accent\n\n var clearance = accentBelow ? body.height + body.depth : Math.min(body.height, options.fontMetrics().xHeight); // Build the accent\n\n var accentBody;\n\n if (!group.isStretchy) {\n var accent;\n var width;\n\n if (group.label === \"\\\\vec\") {\n // Before version 0.9, \\vec used the combining font glyph U+20D7.\n // But browsers, especially Safari, are not consistent in how they\n // render combining characters when not preceded by a character.\n // So now we use an SVG.\n // If Safari reforms, we should consider reverting to the glyph.\n accent = buildCommon.staticSvg(\"vec\", options);\n width = buildCommon.svgData.vec[1];\n } else {\n accent = buildCommon.makeOrd({\n mode: group.mode,\n text: group.label\n }, options, \"textord\");\n accent = assertSymbolDomNode(accent); // Remove the italic correction of the accent, because it only serves to\n // shift the accent over to a place we don't want.\n\n accent.italic = 0;\n width = accent.width;\n\n if (accentBelow) {\n clearance += accent.depth;\n }\n }\n\n accentBody = buildCommon.makeSpan([\"accent-body\"], [accent]); // \"Full\" accents expand the width of the resulting symbol to be\n // at least the width of the accent, and overlap directly onto the\n // character without any vertical offset.\n\n var accentFull = group.label === \"\\\\textcircled\";\n\n if (accentFull) {\n accentBody.classes.push('accent-full');\n clearance = body.height;\n } // Shift the accent over by the skew.\n\n\n var left = skew; // CSS defines `.katex .accent .accent-body:not(.accent-full) { width: 0 }`\n // so that the accent doesn't contribute to the bounding box.\n // We need to shift the character by its width (effectively half\n // its width) to compensate.\n\n if (!accentFull) {\n left -= width / 2;\n }\n\n accentBody.style.left = makeEm(left); // \\textcircled uses the \\bigcirc glyph, so it needs some\n // vertical adjustment to match LaTeX.\n\n if (group.label === \"\\\\textcircled\") {\n accentBody.style.top = \".2em\";\n }\n\n accentBody = buildCommon.makeVList({\n positionType: \"firstBaseline\",\n children: [{\n type: \"elem\",\n elem: body\n }, {\n type: \"kern\",\n size: -clearance\n }, {\n type: \"elem\",\n elem: accentBody\n }]\n }, options);\n } else {\n accentBody = stretchy.svgSpan(group, options);\n accentBody = buildCommon.makeVList({\n positionType: \"firstBaseline\",\n children: [{\n type: \"elem\",\n elem: body\n }, {\n type: \"elem\",\n elem: accentBody,\n wrapperClasses: [\"svg-align\"],\n wrapperStyle: skew > 0 ? {\n width: \"calc(100% - \" + makeEm(2 * skew) + \")\",\n marginLeft: makeEm(2 * skew)\n } : undefined\n }]\n }, options);\n }\n\n var accentWrap = buildCommon.makeSpan([\"mord\", \"accent\"], [accentBody], options);\n\n if (supSubGroup) {\n // Here, we replace the \"base\" child of the supsub with our newly\n // generated accent.\n supSubGroup.children[0] = accentWrap; // Since we don't rerun the height calculation after replacing the\n // accent, we manually recalculate height.\n\n supSubGroup.height = Math.max(accentWrap.height, supSubGroup.height); // Accents should always be ords, even when their innards are not.\n\n supSubGroup.classes[0] = \"mord\";\n return supSubGroup;\n } else {\n return accentWrap;\n }\n};\n\nvar mathmlBuilder$9 = (group, options) => {\n var accentNode = group.isStretchy ? stretchy.mathMLnode(group.label) : new mathMLTree.MathNode(\"mo\", [makeText(group.label, group.mode)]);\n var node = new mathMLTree.MathNode(\"mover\", [buildGroup(group.base, options), accentNode]);\n node.setAttribute(\"accent\", \"true\");\n return node;\n};\n\nvar NON_STRETCHY_ACCENT_REGEX = new RegExp([\"\\\\acute\", \"\\\\grave\", \"\\\\ddot\", \"\\\\tilde\", \"\\\\bar\", \"\\\\breve\", \"\\\\check\", \"\\\\hat\", \"\\\\vec\", \"\\\\dot\", \"\\\\mathring\"].map(accent => \"\\\\\" + accent).join(\"|\")); // Accents\n\ndefineFunction({\n type: \"accent\",\n names: [\"\\\\acute\", \"\\\\grave\", \"\\\\ddot\", \"\\\\tilde\", \"\\\\bar\", \"\\\\breve\", \"\\\\check\", \"\\\\hat\", \"\\\\vec\", \"\\\\dot\", \"\\\\mathring\", \"\\\\widecheck\", \"\\\\widehat\", \"\\\\widetilde\", \"\\\\overrightarrow\", \"\\\\overleftarrow\", \"\\\\Overrightarrow\", \"\\\\overleftrightarrow\", \"\\\\overgroup\", \"\\\\overlinesegment\", \"\\\\overleftharpoon\", \"\\\\overrightharpoon\"],\n props: {\n numArgs: 1\n },\n handler: (context, args) => {\n var base = normalizeArgument(args[0]);\n var isStretchy = !NON_STRETCHY_ACCENT_REGEX.test(context.funcName);\n var isShifty = !isStretchy || context.funcName === \"\\\\widehat\" || context.funcName === \"\\\\widetilde\" || context.funcName === \"\\\\widecheck\";\n return {\n type: \"accent\",\n mode: context.parser.mode,\n label: context.funcName,\n isStretchy: isStretchy,\n isShifty: isShifty,\n base: base\n };\n },\n htmlBuilder: htmlBuilder$a,\n mathmlBuilder: mathmlBuilder$9\n}); // Text-mode accents\n\ndefineFunction({\n type: \"accent\",\n names: [\"\\\\'\", \"\\\\`\", \"\\\\^\", \"\\\\~\", \"\\\\=\", \"\\\\u\", \"\\\\.\", '\\\\\"', \"\\\\c\", \"\\\\r\", \"\\\\H\", \"\\\\v\", \"\\\\textcircled\"],\n props: {\n numArgs: 1,\n allowedInText: true,\n allowedInMath: true,\n // unless in strict mode\n argTypes: [\"primitive\"]\n },\n handler: (context, args) => {\n var base = args[0];\n var mode = context.parser.mode;\n\n if (mode === \"math\") {\n context.parser.settings.reportNonstrict(\"mathVsTextAccents\", \"LaTeX's accent \" + context.funcName + \" works only in text mode\");\n mode = \"text\";\n }\n\n return {\n type: \"accent\",\n mode: mode,\n label: context.funcName,\n isStretchy: false,\n isShifty: true,\n base: base\n };\n },\n htmlBuilder: htmlBuilder$a,\n mathmlBuilder: mathmlBuilder$9\n});\n\n// Horizontal overlap functions\ndefineFunction({\n type: \"accentUnder\",\n names: [\"\\\\underleftarrow\", \"\\\\underrightarrow\", \"\\\\underleftrightarrow\", \"\\\\undergroup\", \"\\\\underlinesegment\", \"\\\\utilde\"],\n props: {\n numArgs: 1\n },\n handler: (_ref, args) => {\n var {\n parser,\n funcName\n } = _ref;\n var base = args[0];\n return {\n type: \"accentUnder\",\n mode: parser.mode,\n label: funcName,\n base: base\n };\n },\n htmlBuilder: (group, options) => {\n // Treat under accents much like underlines.\n var innerGroup = buildGroup$1(group.base, options);\n var accentBody = stretchy.svgSpan(group, options);\n var kern = group.label === \"\\\\utilde\" ? 0.12 : 0; // Generate the vlist, with the appropriate kerns\n\n var vlist = buildCommon.makeVList({\n positionType: \"top\",\n positionData: innerGroup.height,\n children: [{\n type: \"elem\",\n elem: accentBody,\n wrapperClasses: [\"svg-align\"]\n }, {\n type: \"kern\",\n size: kern\n }, {\n type: \"elem\",\n elem: innerGroup\n }]\n }, options);\n return buildCommon.makeSpan([\"mord\", \"accentunder\"], [vlist], options);\n },\n mathmlBuilder: (group, options) => {\n var accentNode = stretchy.mathMLnode(group.label);\n var node = new mathMLTree.MathNode(\"munder\", [buildGroup(group.base, options), accentNode]);\n node.setAttribute(\"accentunder\", \"true\");\n return node;\n }\n});\n\n// Helper function\nvar paddedNode = group => {\n var node = new mathMLTree.MathNode(\"mpadded\", group ? [group] : []);\n node.setAttribute(\"width\", \"+0.6em\");\n node.setAttribute(\"lspace\", \"0.3em\");\n return node;\n}; // Stretchy arrows with an optional argument\n\n\ndefineFunction({\n type: \"xArrow\",\n names: [\"\\\\xleftarrow\", \"\\\\xrightarrow\", \"\\\\xLeftarrow\", \"\\\\xRightarrow\", \"\\\\xleftrightarrow\", \"\\\\xLeftrightarrow\", \"\\\\xhookleftarrow\", \"\\\\xhookrightarrow\", \"\\\\xmapsto\", \"\\\\xrightharpoondown\", \"\\\\xrightharpoonup\", \"\\\\xleftharpoondown\", \"\\\\xleftharpoonup\", \"\\\\xrightleftharpoons\", \"\\\\xleftrightharpoons\", \"\\\\xlongequal\", \"\\\\xtwoheadrightarrow\", \"\\\\xtwoheadleftarrow\", \"\\\\xtofrom\", // The next 3 functions are here to support the mhchem extension.\n // Direct use of these functions is discouraged and may break someday.\n \"\\\\xrightleftarrows\", \"\\\\xrightequilibrium\", \"\\\\xleftequilibrium\", // The next 3 functions are here only to support the {CD} environment.\n \"\\\\\\\\cdrightarrow\", \"\\\\\\\\cdleftarrow\", \"\\\\\\\\cdlongequal\"],\n props: {\n numArgs: 1,\n numOptionalArgs: 1\n },\n\n handler(_ref, args, optArgs) {\n var {\n parser,\n funcName\n } = _ref;\n return {\n type: \"xArrow\",\n mode: parser.mode,\n label: funcName,\n body: args[0],\n below: optArgs[0]\n };\n },\n\n // Flow is unable to correctly infer the type of `group`, even though it's\n // unambiguously determined from the passed-in `type` above.\n htmlBuilder(group, options) {\n var style = options.style; // Build the argument groups in the appropriate style.\n // Ref: amsmath.dtx: \\hbox{$\\scriptstyle\\mkern#3mu{#6}\\mkern#4mu$}%\n // Some groups can return document fragments. Handle those by wrapping\n // them in a span.\n\n var newOptions = options.havingStyle(style.sup());\n var upperGroup = buildCommon.wrapFragment(buildGroup$1(group.body, newOptions, options), options);\n var arrowPrefix = group.label.slice(0, 2) === \"\\\\x\" ? \"x\" : \"cd\";\n upperGroup.classes.push(arrowPrefix + \"-arrow-pad\");\n var lowerGroup;\n\n if (group.below) {\n // Build the lower group\n newOptions = options.havingStyle(style.sub());\n lowerGroup = buildCommon.wrapFragment(buildGroup$1(group.below, newOptions, options), options);\n lowerGroup.classes.push(arrowPrefix + \"-arrow-pad\");\n }\n\n var arrowBody = stretchy.svgSpan(group, options); // Re shift: Note that stretchy.svgSpan returned arrowBody.depth = 0.\n // The point we want on the math axis is at 0.5 * arrowBody.height.\n\n var arrowShift = -options.fontMetrics().axisHeight + 0.5 * arrowBody.height; // 2 mu kern. Ref: amsmath.dtx: #7\\if0#2\\else\\mkern#2mu\\fi\n\n var upperShift = -options.fontMetrics().axisHeight - 0.5 * arrowBody.height - 0.111; // 0.111 em = 2 mu\n\n if (upperGroup.depth > 0.25 || group.label === \"\\\\xleftequilibrium\") {\n upperShift -= upperGroup.depth; // shift up if depth encroaches\n } // Generate the vlist\n\n\n var vlist;\n\n if (lowerGroup) {\n var lowerShift = -options.fontMetrics().axisHeight + lowerGroup.height + 0.5 * arrowBody.height + 0.111;\n vlist = buildCommon.makeVList({\n positionType: \"individualShift\",\n children: [{\n type: \"elem\",\n elem: upperGroup,\n shift: upperShift\n }, {\n type: \"elem\",\n elem: arrowBody,\n shift: arrowShift\n }, {\n type: \"elem\",\n elem: lowerGroup,\n shift: lowerShift\n }]\n }, options);\n } else {\n vlist = buildCommon.makeVList({\n positionType: \"individualShift\",\n children: [{\n type: \"elem\",\n elem: upperGroup,\n shift: upperShift\n }, {\n type: \"elem\",\n elem: arrowBody,\n shift: arrowShift\n }]\n }, options);\n } // $FlowFixMe: Replace this with passing \"svg-align\" into makeVList.\n\n\n vlist.children[0].children[0].children[1].classes.push(\"svg-align\");\n return buildCommon.makeSpan([\"mrel\", \"x-arrow\"], [vlist], options);\n },\n\n mathmlBuilder(group, options) {\n var arrowNode = stretchy.mathMLnode(group.label);\n arrowNode.setAttribute(\"minsize\", group.label.charAt(0) === \"x\" ? \"1.75em\" : \"3.0em\");\n var node;\n\n if (group.body) {\n var upperNode = paddedNode(buildGroup(group.body, options));\n\n if (group.below) {\n var lowerNode = paddedNode(buildGroup(group.below, options));\n node = new mathMLTree.MathNode(\"munderover\", [arrowNode, lowerNode, upperNode]);\n } else {\n node = new mathMLTree.MathNode(\"mover\", [arrowNode, upperNode]);\n }\n } else if (group.below) {\n var _lowerNode = paddedNode(buildGroup(group.below, options));\n\n node = new mathMLTree.MathNode(\"munder\", [arrowNode, _lowerNode]);\n } else {\n // This should never happen.\n // Parser.js throws an error if there is no argument.\n node = paddedNode();\n node = new mathMLTree.MathNode(\"mover\", [arrowNode, node]);\n }\n\n return node;\n }\n\n});\n\nvar makeSpan = buildCommon.makeSpan;\n\nfunction htmlBuilder$9(group, options) {\n var elements = buildExpression$1(group.body, options, true);\n return makeSpan([group.mclass], elements, options);\n}\n\nfunction mathmlBuilder$8(group, options) {\n var node;\n var inner = buildExpression(group.body, options);\n\n if (group.mclass === \"minner\") {\n node = new mathMLTree.MathNode(\"mpadded\", inner);\n } else if (group.mclass === \"mord\") {\n if (group.isCharacterBox) {\n node = inner[0];\n node.type = \"mi\";\n } else {\n node = new mathMLTree.MathNode(\"mi\", inner);\n }\n } else {\n if (group.isCharacterBox) {\n node = inner[0];\n node.type = \"mo\";\n } else {\n node = new mathMLTree.MathNode(\"mo\", inner);\n } // Set spacing based on what is the most likely adjacent atom type.\n // See TeXbook p170.\n\n\n if (group.mclass === \"mbin\") {\n node.attributes.lspace = \"0.22em\"; // medium space\n\n node.attributes.rspace = \"0.22em\";\n } else if (group.mclass === \"mpunct\") {\n node.attributes.lspace = \"0em\";\n node.attributes.rspace = \"0.17em\"; // thinspace\n } else if (group.mclass === \"mopen\" || group.mclass === \"mclose\") {\n node.attributes.lspace = \"0em\";\n node.attributes.rspace = \"0em\";\n } else if (group.mclass === \"minner\") {\n node.attributes.lspace = \"0.0556em\"; // 1 mu is the most likely option\n\n node.attributes.width = \"+0.1111em\";\n } // MathML default space is 5/18 em, so needs no action.\n // Ref: https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mo\n\n }\n\n return node;\n} // Math class commands except \\mathop\n\n\ndefineFunction({\n type: \"mclass\",\n names: [\"\\\\mathord\", \"\\\\mathbin\", \"\\\\mathrel\", \"\\\\mathopen\", \"\\\\mathclose\", \"\\\\mathpunct\", \"\\\\mathinner\"],\n props: {\n numArgs: 1,\n primitive: true\n },\n\n handler(_ref, args) {\n var {\n parser,\n funcName\n } = _ref;\n var body = args[0];\n return {\n type: \"mclass\",\n mode: parser.mode,\n mclass: \"m\" + funcName.slice(5),\n // TODO(kevinb): don't prefix with 'm'\n body: ordargument(body),\n isCharacterBox: utils.isCharacterBox(body)\n };\n },\n\n htmlBuilder: htmlBuilder$9,\n mathmlBuilder: mathmlBuilder$8\n});\nvar binrelClass = arg => {\n // \\binrel@ spacing varies with (bin|rel|ord) of the atom in the argument.\n // (by rendering separately and with {}s before and after, and measuring\n // the change in spacing). We'll do roughly the same by detecting the\n // atom type directly.\n var atom = arg.type === \"ordgroup\" && arg.body.length ? arg.body[0] : arg;\n\n if (atom.type === \"atom\" && (atom.family === \"bin\" || atom.family === \"rel\")) {\n return \"m\" + atom.family;\n } else {\n return \"mord\";\n }\n}; // \\@binrel{x}{y} renders like y but as mbin/mrel/mord if x is mbin/mrel/mord.\n// This is equivalent to \\binrel@{x}\\binrel@@{y} in AMSTeX.\n\ndefineFunction({\n type: \"mclass\",\n names: [\"\\\\@binrel\"],\n props: {\n numArgs: 2\n },\n\n handler(_ref2, args) {\n var {\n parser\n } = _ref2;\n return {\n type: \"mclass\",\n mode: parser.mode,\n mclass: binrelClass(args[0]),\n body: ordargument(args[1]),\n isCharacterBox: utils.isCharacterBox(args[1])\n };\n }\n\n}); // Build a relation or stacked op by placing one symbol on top of another\n\ndefineFunction({\n type: \"mclass\",\n names: [\"\\\\stackrel\", \"\\\\overset\", \"\\\\underset\"],\n props: {\n numArgs: 2\n },\n\n handler(_ref3, args) {\n var {\n parser,\n funcName\n } = _ref3;\n var baseArg = args[1];\n var shiftedArg = args[0];\n var mclass;\n\n if (funcName !== \"\\\\stackrel\") {\n // LaTeX applies \\binrel spacing to \\overset and \\underset.\n mclass = binrelClass(baseArg);\n } else {\n mclass = \"mrel\"; // for \\stackrel\n }\n\n var baseOp = {\n type: \"op\",\n mode: baseArg.mode,\n limits: true,\n alwaysHandleSupSub: true,\n parentIsSupSub: false,\n symbol: false,\n suppressBaseShift: funcName !== \"\\\\stackrel\",\n body: ordargument(baseArg)\n };\n var supsub = {\n type: \"supsub\",\n mode: shiftedArg.mode,\n base: baseOp,\n sup: funcName === \"\\\\underset\" ? null : shiftedArg,\n sub: funcName === \"\\\\underset\" ? shiftedArg : null\n };\n return {\n type: \"mclass\",\n mode: parser.mode,\n mclass,\n body: [supsub],\n isCharacterBox: utils.isCharacterBox(supsub)\n };\n },\n\n htmlBuilder: htmlBuilder$9,\n mathmlBuilder: mathmlBuilder$8\n});\n\n// \\pmb is a simulation of bold font.\n// The version of \\pmb in ambsy.sty works by typesetting three copies\n// with small offsets. We use CSS text-shadow.\n// It's a hack. Not as good as a real bold font. Better than nothing.\ndefineFunction({\n type: \"pmb\",\n names: [\"\\\\pmb\"],\n props: {\n numArgs: 1,\n allowedInText: true\n },\n\n handler(_ref, args) {\n var {\n parser\n } = _ref;\n return {\n type: \"pmb\",\n mode: parser.mode,\n mclass: binrelClass(args[0]),\n body: ordargument(args[0])\n };\n },\n\n htmlBuilder(group, options) {\n var elements = buildExpression$1(group.body, options, true);\n var node = buildCommon.makeSpan([group.mclass], elements, options);\n node.style.textShadow = \"0.02em 0.01em 0.04px\";\n return node;\n },\n\n mathmlBuilder(group, style) {\n var inner = buildExpression(group.body, style); // Wrap with an element.\n\n var node = new mathMLTree.MathNode(\"mstyle\", inner);\n node.setAttribute(\"style\", \"text-shadow: 0.02em 0.01em 0.04px\");\n return node;\n }\n\n});\n\nvar cdArrowFunctionName = {\n \">\": \"\\\\\\\\cdrightarrow\",\n \"<\": \"\\\\\\\\cdleftarrow\",\n \"=\": \"\\\\\\\\cdlongequal\",\n \"A\": \"\\\\uparrow\",\n \"V\": \"\\\\downarrow\",\n \"|\": \"\\\\Vert\",\n \".\": \"no arrow\"\n};\n\nvar newCell = () => {\n // Create an empty cell, to be filled below with parse nodes.\n // The parseTree from this module must be constructed like the\n // one created by parseArray(), so an empty CD cell must\n // be a ParseNode<\"styling\">. And CD is always displaystyle.\n // So these values are fixed and flow can do implicit typing.\n return {\n type: \"styling\",\n body: [],\n mode: \"math\",\n style: \"display\"\n };\n};\n\nvar isStartOfArrow = node => {\n return node.type === \"textord\" && node.text === \"@\";\n};\n\nvar isLabelEnd = (node, endChar) => {\n return (node.type === \"mathord\" || node.type === \"atom\") && node.text === endChar;\n};\n\nfunction cdArrow(arrowChar, labels, parser) {\n // Return a parse tree of an arrow and its labels.\n // This acts in a way similar to a macro expansion.\n var funcName = cdArrowFunctionName[arrowChar];\n\n switch (funcName) {\n case \"\\\\\\\\cdrightarrow\":\n case \"\\\\\\\\cdleftarrow\":\n return parser.callFunction(funcName, [labels[0]], [labels[1]]);\n\n case \"\\\\uparrow\":\n case \"\\\\downarrow\":\n {\n var leftLabel = parser.callFunction(\"\\\\\\\\cdleft\", [labels[0]], []);\n var bareArrow = {\n type: \"atom\",\n text: funcName,\n mode: \"math\",\n family: \"rel\"\n };\n var sizedArrow = parser.callFunction(\"\\\\Big\", [bareArrow], []);\n var rightLabel = parser.callFunction(\"\\\\\\\\cdright\", [labels[1]], []);\n var arrowGroup = {\n type: \"ordgroup\",\n mode: \"math\",\n body: [leftLabel, sizedArrow, rightLabel]\n };\n return parser.callFunction(\"\\\\\\\\cdparent\", [arrowGroup], []);\n }\n\n case \"\\\\\\\\cdlongequal\":\n return parser.callFunction(\"\\\\\\\\cdlongequal\", [], []);\n\n case \"\\\\Vert\":\n {\n var arrow = {\n type: \"textord\",\n text: \"\\\\Vert\",\n mode: \"math\"\n };\n return parser.callFunction(\"\\\\Big\", [arrow], []);\n }\n\n default:\n return {\n type: \"textord\",\n text: \" \",\n mode: \"math\"\n };\n }\n}\n\nfunction parseCD(parser) {\n // Get the array's parse nodes with \\\\ temporarily mapped to \\cr.\n var parsedRows = [];\n parser.gullet.beginGroup();\n parser.gullet.macros.set(\"\\\\cr\", \"\\\\\\\\\\\\relax\");\n parser.gullet.beginGroup();\n\n while (true) {\n // eslint-disable-line no-constant-condition\n // Get the parse nodes for the next row.\n parsedRows.push(parser.parseExpression(false, \"\\\\\\\\\"));\n parser.gullet.endGroup();\n parser.gullet.beginGroup();\n var next = parser.fetch().text;\n\n if (next === \"&\" || next === \"\\\\\\\\\") {\n parser.consume();\n } else if (next === \"\\\\end\") {\n if (parsedRows[parsedRows.length - 1].length === 0) {\n parsedRows.pop(); // final row ended in \\\\\n }\n\n break;\n } else {\n throw new ParseError(\"Expected \\\\\\\\ or \\\\cr or \\\\end\", parser.nextToken);\n }\n }\n\n var row = [];\n var body = [row]; // Loop thru the parse nodes. Collect them into cells and arrows.\n\n for (var i = 0; i < parsedRows.length; i++) {\n // Start a new row.\n var rowNodes = parsedRows[i]; // Create the first cell.\n\n var cell = newCell();\n\n for (var j = 0; j < rowNodes.length; j++) {\n if (!isStartOfArrow(rowNodes[j])) {\n // If a parseNode is not an arrow, it goes into a cell.\n cell.body.push(rowNodes[j]);\n } else {\n // Parse node j is an \"@\", the start of an arrow.\n // Before starting on the arrow, push the cell into `row`.\n row.push(cell); // Now collect parseNodes into an arrow.\n // The character after \"@\" defines the arrow type.\n\n j += 1;\n var arrowChar = assertSymbolNodeType(rowNodes[j]).text; // Create two empty label nodes. We may or may not use them.\n\n var labels = new Array(2);\n labels[0] = {\n type: \"ordgroup\",\n mode: \"math\",\n body: []\n };\n labels[1] = {\n type: \"ordgroup\",\n mode: \"math\",\n body: []\n }; // Process the arrow.\n\n if (\"=|.\".indexOf(arrowChar) > -1) ; else if (\"<>AV\".indexOf(arrowChar) > -1) {\n // Four arrows, `@>>>`, `@<<<`, `@AAA`, and `@VVV`, each take\n // two optional labels. E.g. the right-point arrow syntax is\n // really: @>{optional label}>{optional label}>\n // Collect parseNodes into labels.\n for (var labelNum = 0; labelNum < 2; labelNum++) {\n var inLabel = true;\n\n for (var k = j + 1; k < rowNodes.length; k++) {\n if (isLabelEnd(rowNodes[k], arrowChar)) {\n inLabel = false;\n j = k;\n break;\n }\n\n if (isStartOfArrow(rowNodes[k])) {\n throw new ParseError(\"Missing a \" + arrowChar + \" character to complete a CD arrow.\", rowNodes[k]);\n }\n\n labels[labelNum].body.push(rowNodes[k]);\n }\n\n if (inLabel) {\n // isLabelEnd never returned a true.\n throw new ParseError(\"Missing a \" + arrowChar + \" character to complete a CD arrow.\", rowNodes[j]);\n }\n }\n } else {\n throw new ParseError(\"Expected one of \\\"<>AV=|.\\\" after @\", rowNodes[j]);\n } // Now join the arrow to its labels.\n\n\n var arrow = cdArrow(arrowChar, labels, parser); // Wrap the arrow in ParseNode<\"styling\">.\n // This is done to match parseArray() behavior.\n\n var wrappedArrow = {\n type: \"styling\",\n body: [arrow],\n mode: \"math\",\n style: \"display\" // CD is always displaystyle.\n\n };\n row.push(wrappedArrow); // In CD's syntax, cells are implicit. That is, everything that\n // is not an arrow gets collected into a cell. So create an empty\n // cell now. It will collect upcoming parseNodes.\n\n cell = newCell();\n }\n }\n\n if (i % 2 === 0) {\n // Even-numbered rows consist of: cell, arrow, cell, arrow, ... cell\n // The last cell is not yet pushed into `row`, so:\n row.push(cell);\n } else {\n // Odd-numbered rows consist of: vert arrow, empty cell, ... vert arrow\n // Remove the empty cell that was placed at the beginning of `row`.\n row.shift();\n }\n\n row = [];\n body.push(row);\n } // End row group\n\n\n parser.gullet.endGroup(); // End array group defining \\\\\n\n parser.gullet.endGroup(); // define column separation.\n\n var cols = new Array(body[0].length).fill({\n type: \"align\",\n align: \"c\",\n pregap: 0.25,\n // CD package sets \\enskip between columns.\n postgap: 0.25 // So pre and post each get half an \\enskip, i.e. 0.25em.\n\n });\n return {\n type: \"array\",\n mode: \"math\",\n body,\n arraystretch: 1,\n addJot: true,\n rowGaps: [null],\n cols,\n colSeparationType: \"CD\",\n hLinesBeforeRow: new Array(body.length + 1).fill([])\n };\n} // The functions below are not available for general use.\n// They are here only for internal use by the {CD} environment in placing labels\n// next to vertical arrows.\n// We don't need any such functions for horizontal arrows because we can reuse\n// the functionality that already exists for extensible arrows.\n\ndefineFunction({\n type: \"cdlabel\",\n names: [\"\\\\\\\\cdleft\", \"\\\\\\\\cdright\"],\n props: {\n numArgs: 1\n },\n\n handler(_ref, args) {\n var {\n parser,\n funcName\n } = _ref;\n return {\n type: \"cdlabel\",\n mode: parser.mode,\n side: funcName.slice(4),\n label: args[0]\n };\n },\n\n htmlBuilder(group, options) {\n var newOptions = options.havingStyle(options.style.sup());\n var label = buildCommon.wrapFragment(buildGroup$1(group.label, newOptions, options), options);\n label.classes.push(\"cd-label-\" + group.side);\n label.style.bottom = makeEm(0.8 - label.depth); // Zero out label height & depth, so vertical align of arrow is set\n // by the arrow height, not by the label.\n\n label.height = 0;\n label.depth = 0;\n return label;\n },\n\n mathmlBuilder(group, options) {\n var label = new mathMLTree.MathNode(\"mrow\", [buildGroup(group.label, options)]);\n label = new mathMLTree.MathNode(\"mpadded\", [label]);\n label.setAttribute(\"width\", \"0\");\n\n if (group.side === \"left\") {\n label.setAttribute(\"lspace\", \"-1width\");\n } // We have to guess at vertical alignment. We know the arrow is 1.8em tall,\n // But we don't know the height or depth of the label.\n\n\n label.setAttribute(\"voffset\", \"0.7em\");\n label = new mathMLTree.MathNode(\"mstyle\", [label]);\n label.setAttribute(\"displaystyle\", \"false\");\n label.setAttribute(\"scriptlevel\", \"1\");\n return label;\n }\n\n});\ndefineFunction({\n type: \"cdlabelparent\",\n names: [\"\\\\\\\\cdparent\"],\n props: {\n numArgs: 1\n },\n\n handler(_ref2, args) {\n var {\n parser\n } = _ref2;\n return {\n type: \"cdlabelparent\",\n mode: parser.mode,\n fragment: args[0]\n };\n },\n\n htmlBuilder(group, options) {\n // Wrap the vertical arrow and its labels.\n // The parent gets position: relative. The child gets position: absolute.\n // So CSS can locate the label correctly.\n var parent = buildCommon.wrapFragment(buildGroup$1(group.fragment, options), options);\n parent.classes.push(\"cd-vert-arrow\");\n return parent;\n },\n\n mathmlBuilder(group, options) {\n return new mathMLTree.MathNode(\"mrow\", [buildGroup(group.fragment, options)]);\n }\n\n});\n\n// {123} and converts into symbol with code 123. It is used by the *macro*\n// \\char defined in macros.js.\n\ndefineFunction({\n type: \"textord\",\n names: [\"\\\\@char\"],\n props: {\n numArgs: 1,\n allowedInText: true\n },\n\n handler(_ref, args) {\n var {\n parser\n } = _ref;\n var arg = assertNodeType(args[0], \"ordgroup\");\n var group = arg.body;\n var number = \"\";\n\n for (var i = 0; i < group.length; i++) {\n var node = assertNodeType(group[i], \"textord\");\n number += node.text;\n }\n\n var code = parseInt(number);\n var text;\n\n if (isNaN(code)) {\n throw new ParseError(\"\\\\@char has non-numeric argument \" + number); // If we drop IE support, the following code could be replaced with\n // text = String.fromCodePoint(code)\n } else if (code < 0 || code >= 0x10ffff) {\n throw new ParseError(\"\\\\@char with invalid code point \" + number);\n } else if (code <= 0xffff) {\n text = String.fromCharCode(code);\n } else {\n // Astral code point; split into surrogate halves\n code -= 0x10000;\n text = String.fromCharCode((code >> 10) + 0xd800, (code & 0x3ff) + 0xdc00);\n }\n\n return {\n type: \"textord\",\n mode: parser.mode,\n text: text\n };\n }\n\n});\n\nvar htmlBuilder$8 = (group, options) => {\n var elements = buildExpression$1(group.body, options.withColor(group.color), false); // \\color isn't supposed to affect the type of the elements it contains.\n // To accomplish this, we wrap the results in a fragment, so the inner\n // elements will be able to directly interact with their neighbors. For\n // example, `\\color{red}{2 +} 3` has the same spacing as `2 + 3`\n\n return buildCommon.makeFragment(elements);\n};\n\nvar mathmlBuilder$7 = (group, options) => {\n var inner = buildExpression(group.body, options.withColor(group.color));\n var node = new mathMLTree.MathNode(\"mstyle\", inner);\n node.setAttribute(\"mathcolor\", group.color);\n return node;\n};\n\ndefineFunction({\n type: \"color\",\n names: [\"\\\\textcolor\"],\n props: {\n numArgs: 2,\n allowedInText: true,\n argTypes: [\"color\", \"original\"]\n },\n\n handler(_ref, args) {\n var {\n parser\n } = _ref;\n var color = assertNodeType(args[0], \"color-token\").color;\n var body = args[1];\n return {\n type: \"color\",\n mode: parser.mode,\n color,\n body: ordargument(body)\n };\n },\n\n htmlBuilder: htmlBuilder$8,\n mathmlBuilder: mathmlBuilder$7\n});\ndefineFunction({\n type: \"color\",\n names: [\"\\\\color\"],\n props: {\n numArgs: 1,\n allowedInText: true,\n argTypes: [\"color\"]\n },\n\n handler(_ref2, args) {\n var {\n parser,\n breakOnTokenText\n } = _ref2;\n var color = assertNodeType(args[0], \"color-token\").color; // Set macro \\current@color in current namespace to store the current\n // color, mimicking the behavior of color.sty.\n // This is currently used just to correctly color a \\right\n // that follows a \\color command.\n\n parser.gullet.macros.set(\"\\\\current@color\", color); // Parse out the implicit body that should be colored.\n\n var body = parser.parseExpression(true, breakOnTokenText);\n return {\n type: \"color\",\n mode: parser.mode,\n color,\n body\n };\n },\n\n htmlBuilder: htmlBuilder$8,\n mathmlBuilder: mathmlBuilder$7\n});\n\n// Row breaks within tabular environments, and line breaks at top level\n\ndefineFunction({\n type: \"cr\",\n names: [\"\\\\\\\\\"],\n props: {\n numArgs: 0,\n numOptionalArgs: 0,\n allowedInText: true\n },\n\n handler(_ref, args, optArgs) {\n var {\n parser\n } = _ref;\n var size = parser.gullet.future().text === \"[\" ? parser.parseSizeGroup(true) : null;\n var newLine = !parser.settings.displayMode || !parser.settings.useStrictBehavior(\"newLineInDisplayMode\", \"In LaTeX, \\\\\\\\ or \\\\newline \" + \"does nothing in display mode\");\n return {\n type: \"cr\",\n mode: parser.mode,\n newLine,\n size: size && assertNodeType(size, \"size\").value\n };\n },\n\n // The following builders are called only at the top level,\n // not within tabular/array environments.\n htmlBuilder(group, options) {\n var span = buildCommon.makeSpan([\"mspace\"], [], options);\n\n if (group.newLine) {\n span.classes.push(\"newline\");\n\n if (group.size) {\n span.style.marginTop = makeEm(calculateSize(group.size, options));\n }\n }\n\n return span;\n },\n\n mathmlBuilder(group, options) {\n var node = new mathMLTree.MathNode(\"mspace\");\n\n if (group.newLine) {\n node.setAttribute(\"linebreak\", \"newline\");\n\n if (group.size) {\n node.setAttribute(\"height\", makeEm(calculateSize(group.size, options)));\n }\n }\n\n return node;\n }\n\n});\n\nvar globalMap = {\n \"\\\\global\": \"\\\\global\",\n \"\\\\long\": \"\\\\\\\\globallong\",\n \"\\\\\\\\globallong\": \"\\\\\\\\globallong\",\n \"\\\\def\": \"\\\\gdef\",\n \"\\\\gdef\": \"\\\\gdef\",\n \"\\\\edef\": \"\\\\xdef\",\n \"\\\\xdef\": \"\\\\xdef\",\n \"\\\\let\": \"\\\\\\\\globallet\",\n \"\\\\futurelet\": \"\\\\\\\\globalfuture\"\n};\n\nvar checkControlSequence = tok => {\n var name = tok.text;\n\n if (/^(?:[\\\\{}$^_]|EOF)$/.test(name)) {\n throw new ParseError(\"Expected a control sequence\", tok);\n }\n\n return name;\n};\n\nvar getRHS = parser => {\n var tok = parser.gullet.popToken();\n\n if (tok.text === \"=\") {\n // consume optional equals\n tok = parser.gullet.popToken();\n\n if (tok.text === \" \") {\n // consume one optional space\n tok = parser.gullet.popToken();\n }\n }\n\n return tok;\n};\n\nvar letCommand = (parser, name, tok, global) => {\n var macro = parser.gullet.macros.get(tok.text);\n\n if (macro == null) {\n // don't expand it later even if a macro with the same name is defined\n // e.g., \\let\\foo=\\frac \\def\\frac{\\relax} \\frac12\n tok.noexpand = true;\n macro = {\n tokens: [tok],\n numArgs: 0,\n // reproduce the same behavior in expansion\n unexpandable: !parser.gullet.isExpandable(tok.text)\n };\n }\n\n parser.gullet.macros.set(name, macro, global);\n}; // -> |\n// -> |\\global\n// -> |\n// -> \\global|\\long|\\outer\n\n\ndefineFunction({\n type: \"internal\",\n names: [\"\\\\global\", \"\\\\long\", \"\\\\\\\\globallong\" // can\u2019t be entered directly\n ],\n props: {\n numArgs: 0,\n allowedInText: true\n },\n\n handler(_ref) {\n var {\n parser,\n funcName\n } = _ref;\n parser.consumeSpaces();\n var token = parser.fetch();\n\n if (globalMap[token.text]) {\n // KaTeX doesn't have \\par, so ignore \\long\n if (funcName === \"\\\\global\" || funcName === \"\\\\\\\\globallong\") {\n token.text = globalMap[token.text];\n }\n\n return assertNodeType(parser.parseFunction(), \"internal\");\n }\n\n throw new ParseError(\"Invalid token after macro prefix\", token);\n }\n\n}); // Basic support for macro definitions: \\def, \\gdef, \\edef, \\xdef\n// -> \n// -> \\def|\\gdef|\\edef|\\xdef\n// -> \n\ndefineFunction({\n type: \"internal\",\n names: [\"\\\\def\", \"\\\\gdef\", \"\\\\edef\", \"\\\\xdef\"],\n props: {\n numArgs: 0,\n allowedInText: true,\n primitive: true\n },\n\n handler(_ref2) {\n var {\n parser,\n funcName\n } = _ref2;\n var tok = parser.gullet.popToken();\n var name = tok.text;\n\n if (/^(?:[\\\\{}$^_]|EOF)$/.test(name)) {\n throw new ParseError(\"Expected a control sequence\", tok);\n }\n\n var numArgs = 0;\n var insert;\n var delimiters = [[]]; // contains no braces\n\n while (parser.gullet.future().text !== \"{\") {\n tok = parser.gullet.popToken();\n\n if (tok.text === \"#\") {\n // If the very last character of the is #, so that\n // this # is immediately followed by {, TeX will behave as if the {\n // had been inserted at the right end of both the parameter text\n // and the replacement text.\n if (parser.gullet.future().text === \"{\") {\n insert = parser.gullet.future();\n delimiters[numArgs].push(\"{\");\n break;\n } // A parameter, the first appearance of # must be followed by 1,\n // the next by 2, and so on; up to nine #\u2019s are allowed\n\n\n tok = parser.gullet.popToken();\n\n if (!/^[1-9]$/.test(tok.text)) {\n throw new ParseError(\"Invalid argument number \\\"\" + tok.text + \"\\\"\");\n }\n\n if (parseInt(tok.text) !== numArgs + 1) {\n throw new ParseError(\"Argument number \\\"\" + tok.text + \"\\\" out of order\");\n }\n\n numArgs++;\n delimiters.push([]);\n } else if (tok.text === \"EOF\") {\n throw new ParseError(\"Expected a macro definition\");\n } else {\n delimiters[numArgs].push(tok.text);\n }\n } // replacement text, enclosed in '{' and '}' and properly nested\n\n\n var {\n tokens\n } = parser.gullet.consumeArg();\n\n if (insert) {\n tokens.unshift(insert);\n }\n\n if (funcName === \"\\\\edef\" || funcName === \"\\\\xdef\") {\n tokens = parser.gullet.expandTokens(tokens);\n tokens.reverse(); // to fit in with stack order\n } // Final arg is the expansion of the macro\n\n\n parser.gullet.macros.set(name, {\n tokens,\n numArgs,\n delimiters\n }, funcName === globalMap[funcName]);\n return {\n type: \"internal\",\n mode: parser.mode\n };\n }\n\n}); // -> \n// -> \\futurelet\n// | \\let\n// -> |=\n\ndefineFunction({\n type: \"internal\",\n names: [\"\\\\let\", \"\\\\\\\\globallet\" // can\u2019t be entered directly\n ],\n props: {\n numArgs: 0,\n allowedInText: true,\n primitive: true\n },\n\n handler(_ref3) {\n var {\n parser,\n funcName\n } = _ref3;\n var name = checkControlSequence(parser.gullet.popToken());\n parser.gullet.consumeSpaces();\n var tok = getRHS(parser);\n letCommand(parser, name, tok, funcName === \"\\\\\\\\globallet\");\n return {\n type: \"internal\",\n mode: parser.mode\n };\n }\n\n}); // ref: https://www.tug.org/TUGboat/tb09-3/tb22bechtolsheim.pdf\n\ndefineFunction({\n type: \"internal\",\n names: [\"\\\\futurelet\", \"\\\\\\\\globalfuture\" // can\u2019t be entered directly\n ],\n props: {\n numArgs: 0,\n allowedInText: true,\n primitive: true\n },\n\n handler(_ref4) {\n var {\n parser,\n funcName\n } = _ref4;\n var name = checkControlSequence(parser.gullet.popToken());\n var middle = parser.gullet.popToken();\n var tok = parser.gullet.popToken();\n letCommand(parser, name, tok, funcName === \"\\\\\\\\globalfuture\");\n parser.gullet.pushToken(tok);\n parser.gullet.pushToken(middle);\n return {\n type: \"internal\",\n mode: parser.mode\n };\n }\n\n});\n\n/**\n * This file deals with creating delimiters of various sizes. The TeXbook\n * discusses these routines on page 441-442, in the \"Another subroutine sets box\n * x to a specified variable delimiter\" paragraph.\n *\n * There are three main routines here. `makeSmallDelim` makes a delimiter in the\n * normal font, but in either text, script, or scriptscript style.\n * `makeLargeDelim` makes a delimiter in textstyle, but in one of the Size1,\n * Size2, Size3, or Size4 fonts. `makeStackedDelim` makes a delimiter out of\n * smaller pieces that are stacked on top of one another.\n *\n * The functions take a parameter `center`, which determines if the delimiter\n * should be centered around the axis.\n *\n * Then, there are three exposed functions. `sizedDelim` makes a delimiter in\n * one of the given sizes. This is used for things like `\\bigl`.\n * `customSizedDelim` makes a delimiter with a given total height+depth. It is\n * called in places like `\\sqrt`. `leftRightDelim` makes an appropriate\n * delimiter which surrounds an expression of a given height an depth. It is\n * used in `\\left` and `\\right`.\n */\n\n/**\n * Get the metrics for a given symbol and font, after transformation (i.e.\n * after following replacement from symbols.js)\n */\nvar getMetrics = function getMetrics(symbol, font, mode) {\n var replace = symbols.math[symbol] && symbols.math[symbol].replace;\n var metrics = getCharacterMetrics(replace || symbol, font, mode);\n\n if (!metrics) {\n throw new Error(\"Unsupported symbol \" + symbol + \" and font size \" + font + \".\");\n }\n\n return metrics;\n};\n/**\n * Puts a delimiter span in a given style, and adds appropriate height, depth,\n * and maxFontSizes.\n */\n\n\nvar styleWrap = function styleWrap(delim, toStyle, options, classes) {\n var newOptions = options.havingBaseStyle(toStyle);\n var span = buildCommon.makeSpan(classes.concat(newOptions.sizingClasses(options)), [delim], options);\n var delimSizeMultiplier = newOptions.sizeMultiplier / options.sizeMultiplier;\n span.height *= delimSizeMultiplier;\n span.depth *= delimSizeMultiplier;\n span.maxFontSize = newOptions.sizeMultiplier;\n return span;\n};\n\nvar centerSpan = function centerSpan(span, options, style) {\n var newOptions = options.havingBaseStyle(style);\n var shift = (1 - options.sizeMultiplier / newOptions.sizeMultiplier) * options.fontMetrics().axisHeight;\n span.classes.push(\"delimcenter\");\n span.style.top = makeEm(shift);\n span.height -= shift;\n span.depth += shift;\n};\n/**\n * Makes a small delimiter. This is a delimiter that comes in the Main-Regular\n * font, but is restyled to either be in textstyle, scriptstyle, or\n * scriptscriptstyle.\n */\n\n\nvar makeSmallDelim = function makeSmallDelim(delim, style, center, options, mode, classes) {\n var text = buildCommon.makeSymbol(delim, \"Main-Regular\", mode, options);\n var span = styleWrap(text, style, options, classes);\n\n if (center) {\n centerSpan(span, options, style);\n }\n\n return span;\n};\n/**\n * Builds a symbol in the given font size (note size is an integer)\n */\n\n\nvar mathrmSize = function mathrmSize(value, size, mode, options) {\n return buildCommon.makeSymbol(value, \"Size\" + size + \"-Regular\", mode, options);\n};\n/**\n * Makes a large delimiter. This is a delimiter that comes in the Size1, Size2,\n * Size3, or Size4 fonts. It is always rendered in textstyle.\n */\n\n\nvar makeLargeDelim = function makeLargeDelim(delim, size, center, options, mode, classes) {\n var inner = mathrmSize(delim, size, mode, options);\n var span = styleWrap(buildCommon.makeSpan([\"delimsizing\", \"size\" + size], [inner], options), Style$1.TEXT, options, classes);\n\n if (center) {\n centerSpan(span, options, Style$1.TEXT);\n }\n\n return span;\n};\n/**\n * Make a span from a font glyph with the given offset and in the given font.\n * This is used in makeStackedDelim to make the stacking pieces for the delimiter.\n */\n\n\nvar makeGlyphSpan = function makeGlyphSpan(symbol, font, mode) {\n var sizeClass; // Apply the correct CSS class to choose the right font.\n\n if (font === \"Size1-Regular\") {\n sizeClass = \"delim-size1\";\n } else\n /* if (font === \"Size4-Regular\") */\n {\n sizeClass = \"delim-size4\";\n }\n\n var corner = buildCommon.makeSpan([\"delimsizinginner\", sizeClass], [buildCommon.makeSpan([], [buildCommon.makeSymbol(symbol, font, mode)])]); // Since this will be passed into `makeVList` in the end, wrap the element\n // in the appropriate tag that VList uses.\n\n return {\n type: \"elem\",\n elem: corner\n };\n};\n\nvar makeInner = function makeInner(ch, height, options) {\n // Create a span with inline SVG for the inner part of a tall stacked delimiter.\n var width = fontMetricsData['Size4-Regular'][ch.charCodeAt(0)] ? fontMetricsData['Size4-Regular'][ch.charCodeAt(0)][4] : fontMetricsData['Size1-Regular'][ch.charCodeAt(0)][4];\n var path = new PathNode(\"inner\", innerPath(ch, Math.round(1000 * height)));\n var svgNode = new SvgNode([path], {\n \"width\": makeEm(width),\n \"height\": makeEm(height),\n // Override CSS rule `.katex svg { width: 100% }`\n \"style\": \"width:\" + makeEm(width),\n \"viewBox\": \"0 0 \" + 1000 * width + \" \" + Math.round(1000 * height),\n \"preserveAspectRatio\": \"xMinYMin\"\n });\n var span = buildCommon.makeSvgSpan([], [svgNode], options);\n span.height = height;\n span.style.height = makeEm(height);\n span.style.width = makeEm(width);\n return {\n type: \"elem\",\n elem: span\n };\n}; // Helpers for makeStackedDelim\n\n\nvar lapInEms = 0.008;\nvar lap = {\n type: \"kern\",\n size: -1 * lapInEms\n};\nvar verts = [\"|\", \"\\\\lvert\", \"\\\\rvert\", \"\\\\vert\"];\nvar doubleVerts = [\"\\\\|\", \"\\\\lVert\", \"\\\\rVert\", \"\\\\Vert\"];\n/**\n * Make a stacked delimiter out of a given delimiter, with the total height at\n * least `heightTotal`. This routine is mentioned on page 442 of the TeXbook.\n */\n\nvar makeStackedDelim = function makeStackedDelim(delim, heightTotal, center, options, mode, classes) {\n // There are four parts, the top, an optional middle, a repeated part, and a\n // bottom.\n var top;\n var middle;\n var repeat;\n var bottom;\n var svgLabel = \"\";\n var viewBoxWidth = 0;\n top = repeat = bottom = delim;\n middle = null; // Also keep track of what font the delimiters are in\n\n var font = \"Size1-Regular\"; // We set the parts and font based on the symbol. Note that we use\n // '\\u23d0' instead of '|' and '\\u2016' instead of '\\\\|' for the\n // repeats of the arrows\n\n if (delim === \"\\\\uparrow\") {\n repeat = bottom = \"\\u23d0\";\n } else if (delim === \"\\\\Uparrow\") {\n repeat = bottom = \"\\u2016\";\n } else if (delim === \"\\\\downarrow\") {\n top = repeat = \"\\u23d0\";\n } else if (delim === \"\\\\Downarrow\") {\n top = repeat = \"\\u2016\";\n } else if (delim === \"\\\\updownarrow\") {\n top = \"\\\\uparrow\";\n repeat = \"\\u23d0\";\n bottom = \"\\\\downarrow\";\n } else if (delim === \"\\\\Updownarrow\") {\n top = \"\\\\Uparrow\";\n repeat = \"\\u2016\";\n bottom = \"\\\\Downarrow\";\n } else if (utils.contains(verts, delim)) {\n repeat = \"\\u2223\";\n svgLabel = \"vert\";\n viewBoxWidth = 333;\n } else if (utils.contains(doubleVerts, delim)) {\n repeat = \"\\u2225\";\n svgLabel = \"doublevert\";\n viewBoxWidth = 556;\n } else if (delim === \"[\" || delim === \"\\\\lbrack\") {\n top = \"\\u23a1\";\n repeat = \"\\u23a2\";\n bottom = \"\\u23a3\";\n font = \"Size4-Regular\";\n svgLabel = \"lbrack\";\n viewBoxWidth = 667;\n } else if (delim === \"]\" || delim === \"\\\\rbrack\") {\n top = \"\\u23a4\";\n repeat = \"\\u23a5\";\n bottom = \"\\u23a6\";\n font = \"Size4-Regular\";\n svgLabel = \"rbrack\";\n viewBoxWidth = 667;\n } else if (delim === \"\\\\lfloor\" || delim === \"\\u230a\") {\n repeat = top = \"\\u23a2\";\n bottom = \"\\u23a3\";\n font = \"Size4-Regular\";\n svgLabel = \"lfloor\";\n viewBoxWidth = 667;\n } else if (delim === \"\\\\lceil\" || delim === \"\\u2308\") {\n top = \"\\u23a1\";\n repeat = bottom = \"\\u23a2\";\n font = \"Size4-Regular\";\n svgLabel = \"lceil\";\n viewBoxWidth = 667;\n } else if (delim === \"\\\\rfloor\" || delim === \"\\u230b\") {\n repeat = top = \"\\u23a5\";\n bottom = \"\\u23a6\";\n font = \"Size4-Regular\";\n svgLabel = \"rfloor\";\n viewBoxWidth = 667;\n } else if (delim === \"\\\\rceil\" || delim === \"\\u2309\") {\n top = \"\\u23a4\";\n repeat = bottom = \"\\u23a5\";\n font = \"Size4-Regular\";\n svgLabel = \"rceil\";\n viewBoxWidth = 667;\n } else if (delim === \"(\" || delim === \"\\\\lparen\") {\n top = \"\\u239b\";\n repeat = \"\\u239c\";\n bottom = \"\\u239d\";\n font = \"Size4-Regular\";\n svgLabel = \"lparen\";\n viewBoxWidth = 875;\n } else if (delim === \")\" || delim === \"\\\\rparen\") {\n top = \"\\u239e\";\n repeat = \"\\u239f\";\n bottom = \"\\u23a0\";\n font = \"Size4-Regular\";\n svgLabel = \"rparen\";\n viewBoxWidth = 875;\n } else if (delim === \"\\\\{\" || delim === \"\\\\lbrace\") {\n top = \"\\u23a7\";\n middle = \"\\u23a8\";\n bottom = \"\\u23a9\";\n repeat = \"\\u23aa\";\n font = \"Size4-Regular\";\n } else if (delim === \"\\\\}\" || delim === \"\\\\rbrace\") {\n top = \"\\u23ab\";\n middle = \"\\u23ac\";\n bottom = \"\\u23ad\";\n repeat = \"\\u23aa\";\n font = \"Size4-Regular\";\n } else if (delim === \"\\\\lgroup\" || delim === \"\\u27ee\") {\n top = \"\\u23a7\";\n bottom = \"\\u23a9\";\n repeat = \"\\u23aa\";\n font = \"Size4-Regular\";\n } else if (delim === \"\\\\rgroup\" || delim === \"\\u27ef\") {\n top = \"\\u23ab\";\n bottom = \"\\u23ad\";\n repeat = \"\\u23aa\";\n font = \"Size4-Regular\";\n } else if (delim === \"\\\\lmoustache\" || delim === \"\\u23b0\") {\n top = \"\\u23a7\";\n bottom = \"\\u23ad\";\n repeat = \"\\u23aa\";\n font = \"Size4-Regular\";\n } else if (delim === \"\\\\rmoustache\" || delim === \"\\u23b1\") {\n top = \"\\u23ab\";\n bottom = \"\\u23a9\";\n repeat = \"\\u23aa\";\n font = \"Size4-Regular\";\n } // Get the metrics of the four sections\n\n\n var topMetrics = getMetrics(top, font, mode);\n var topHeightTotal = topMetrics.height + topMetrics.depth;\n var repeatMetrics = getMetrics(repeat, font, mode);\n var repeatHeightTotal = repeatMetrics.height + repeatMetrics.depth;\n var bottomMetrics = getMetrics(bottom, font, mode);\n var bottomHeightTotal = bottomMetrics.height + bottomMetrics.depth;\n var middleHeightTotal = 0;\n var middleFactor = 1;\n\n if (middle !== null) {\n var middleMetrics = getMetrics(middle, font, mode);\n middleHeightTotal = middleMetrics.height + middleMetrics.depth;\n middleFactor = 2; // repeat symmetrically above and below middle\n } // Calculate the minimal height that the delimiter can have.\n // It is at least the size of the top, bottom, and optional middle combined.\n\n\n var minHeight = topHeightTotal + bottomHeightTotal + middleHeightTotal; // Compute the number of copies of the repeat symbol we will need\n\n var repeatCount = Math.max(0, Math.ceil((heightTotal - minHeight) / (middleFactor * repeatHeightTotal))); // Compute the total height of the delimiter including all the symbols\n\n var realHeightTotal = minHeight + repeatCount * middleFactor * repeatHeightTotal; // The center of the delimiter is placed at the center of the axis. Note\n // that in this context, \"center\" means that the delimiter should be\n // centered around the axis in the current style, while normally it is\n // centered around the axis in textstyle.\n\n var axisHeight = options.fontMetrics().axisHeight;\n\n if (center) {\n axisHeight *= options.sizeMultiplier;\n } // Calculate the depth\n\n\n var depth = realHeightTotal / 2 - axisHeight; // Now, we start building the pieces that will go into the vlist\n // Keep a list of the pieces of the stacked delimiter\n\n var stack = [];\n\n if (svgLabel.length > 0) {\n // Instead of stacking glyphs, create a single SVG.\n // This evades browser problems with imprecise positioning of spans.\n var midHeight = realHeightTotal - topHeightTotal - bottomHeightTotal;\n var viewBoxHeight = Math.round(realHeightTotal * 1000);\n var pathStr = tallDelim(svgLabel, Math.round(midHeight * 1000));\n var path = new PathNode(svgLabel, pathStr);\n var width = (viewBoxWidth / 1000).toFixed(3) + \"em\";\n var height = (viewBoxHeight / 1000).toFixed(3) + \"em\";\n var svg = new SvgNode([path], {\n \"width\": width,\n \"height\": height,\n \"viewBox\": \"0 0 \" + viewBoxWidth + \" \" + viewBoxHeight\n });\n var wrapper = buildCommon.makeSvgSpan([], [svg], options);\n wrapper.height = viewBoxHeight / 1000;\n wrapper.style.width = width;\n wrapper.style.height = height;\n stack.push({\n type: \"elem\",\n elem: wrapper\n });\n } else {\n // Stack glyphs\n // Start by adding the bottom symbol\n stack.push(makeGlyphSpan(bottom, font, mode));\n stack.push(lap); // overlap\n\n if (middle === null) {\n // The middle section will be an SVG. Make it an extra 0.016em tall.\n // We'll overlap by 0.008em at top and bottom.\n var innerHeight = realHeightTotal - topHeightTotal - bottomHeightTotal + 2 * lapInEms;\n stack.push(makeInner(repeat, innerHeight, options));\n } else {\n // When there is a middle bit, we need the middle part and two repeated\n // sections\n var _innerHeight = (realHeightTotal - topHeightTotal - bottomHeightTotal - middleHeightTotal) / 2 + 2 * lapInEms;\n\n stack.push(makeInner(repeat, _innerHeight, options)); // Now insert the middle of the brace.\n\n stack.push(lap);\n stack.push(makeGlyphSpan(middle, font, mode));\n stack.push(lap);\n stack.push(makeInner(repeat, _innerHeight, options));\n } // Add the top symbol\n\n\n stack.push(lap);\n stack.push(makeGlyphSpan(top, font, mode));\n } // Finally, build the vlist\n\n\n var newOptions = options.havingBaseStyle(Style$1.TEXT);\n var inner = buildCommon.makeVList({\n positionType: \"bottom\",\n positionData: depth,\n children: stack\n }, newOptions);\n return styleWrap(buildCommon.makeSpan([\"delimsizing\", \"mult\"], [inner], newOptions), Style$1.TEXT, options, classes);\n}; // All surds have 0.08em padding above the vinculum inside the SVG.\n// That keeps browser span height rounding error from pinching the line.\n\n\nvar vbPad = 80; // padding above the surd, measured inside the viewBox.\n\nvar emPad = 0.08; // padding, in ems, measured in the document.\n\nvar sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, extraVinculum, options) {\n var path = sqrtPath(sqrtName, extraVinculum, viewBoxHeight);\n var pathNode = new PathNode(sqrtName, path);\n var svg = new SvgNode([pathNode], {\n // Note: 1000:1 ratio of viewBox to document em width.\n \"width\": \"400em\",\n \"height\": makeEm(height),\n \"viewBox\": \"0 0 400000 \" + viewBoxHeight,\n \"preserveAspectRatio\": \"xMinYMin slice\"\n });\n return buildCommon.makeSvgSpan([\"hide-tail\"], [svg], options);\n};\n/**\n * Make a sqrt image of the given height,\n */\n\n\nvar makeSqrtImage = function makeSqrtImage(height, options) {\n // Define a newOptions that removes the effect of size changes such as \\Huge.\n // We don't pick different a height surd for \\Huge. For it, we scale up.\n var newOptions = options.havingBaseSizing(); // Pick the desired surd glyph from a sequence of surds.\n\n var delim = traverseSequence(\"\\\\surd\", height * newOptions.sizeMultiplier, stackLargeDelimiterSequence, newOptions);\n var sizeMultiplier = newOptions.sizeMultiplier; // default\n // The standard sqrt SVGs each have a 0.04em thick vinculum.\n // If Settings.minRuleThickness is larger than that, we add extraVinculum.\n\n var extraVinculum = Math.max(0, options.minRuleThickness - options.fontMetrics().sqrtRuleThickness); // Create a span containing an SVG image of a sqrt symbol.\n\n var span;\n var spanHeight = 0;\n var texHeight = 0;\n var viewBoxHeight = 0;\n var advanceWidth; // We create viewBoxes with 80 units of \"padding\" above each surd.\n // Then browser rounding error on the parent span height will not\n // encroach on the ink of the vinculum. But that padding is not\n // included in the TeX-like `height` used for calculation of\n // vertical alignment. So texHeight = span.height < span.style.height.\n\n if (delim.type === \"small\") {\n // Get an SVG that is derived from glyph U+221A in font KaTeX-Main.\n // 1000 unit normal glyph height.\n viewBoxHeight = 1000 + 1000 * extraVinculum + vbPad;\n\n if (height < 1.0) {\n sizeMultiplier = 1.0; // mimic a \\textfont radical\n } else if (height < 1.4) {\n sizeMultiplier = 0.7; // mimic a \\scriptfont radical\n }\n\n spanHeight = (1.0 + extraVinculum + emPad) / sizeMultiplier;\n texHeight = (1.00 + extraVinculum) / sizeMultiplier;\n span = sqrtSvg(\"sqrtMain\", spanHeight, viewBoxHeight, extraVinculum, options);\n span.style.minWidth = \"0.853em\";\n advanceWidth = 0.833 / sizeMultiplier; // from the font.\n } else if (delim.type === \"large\") {\n // These SVGs come from fonts: KaTeX_Size1, _Size2, etc.\n viewBoxHeight = (1000 + vbPad) * sizeToMaxHeight[delim.size];\n texHeight = (sizeToMaxHeight[delim.size] + extraVinculum) / sizeMultiplier;\n spanHeight = (sizeToMaxHeight[delim.size] + extraVinculum + emPad) / sizeMultiplier;\n span = sqrtSvg(\"sqrtSize\" + delim.size, spanHeight, viewBoxHeight, extraVinculum, options);\n span.style.minWidth = \"1.02em\";\n advanceWidth = 1.0 / sizeMultiplier; // 1.0 from the font.\n } else {\n // Tall sqrt. In TeX, this would be stacked using multiple glyphs.\n // We'll use a single SVG to accomplish the same thing.\n spanHeight = height + extraVinculum + emPad;\n texHeight = height + extraVinculum;\n viewBoxHeight = Math.floor(1000 * height + extraVinculum) + vbPad;\n span = sqrtSvg(\"sqrtTall\", spanHeight, viewBoxHeight, extraVinculum, options);\n span.style.minWidth = \"0.742em\";\n advanceWidth = 1.056;\n }\n\n span.height = texHeight;\n span.style.height = makeEm(spanHeight);\n return {\n span,\n advanceWidth,\n // Calculate the actual line width.\n // This actually should depend on the chosen font -- e.g. \\boldmath\n // should use the thicker surd symbols from e.g. KaTeX_Main-Bold, and\n // have thicker rules.\n ruleWidth: (options.fontMetrics().sqrtRuleThickness + extraVinculum) * sizeMultiplier\n };\n}; // There are three kinds of delimiters, delimiters that stack when they become\n// too large\n\n\nvar stackLargeDelimiters = [\"(\", \"\\\\lparen\", \")\", \"\\\\rparen\", \"[\", \"\\\\lbrack\", \"]\", \"\\\\rbrack\", \"\\\\{\", \"\\\\lbrace\", \"\\\\}\", \"\\\\rbrace\", \"\\\\lfloor\", \"\\\\rfloor\", \"\\u230a\", \"\\u230b\", \"\\\\lceil\", \"\\\\rceil\", \"\\u2308\", \"\\u2309\", \"\\\\surd\"]; // delimiters that always stack\n\nvar stackAlwaysDelimiters = [\"\\\\uparrow\", \"\\\\downarrow\", \"\\\\updownarrow\", \"\\\\Uparrow\", \"\\\\Downarrow\", \"\\\\Updownarrow\", \"|\", \"\\\\|\", \"\\\\vert\", \"\\\\Vert\", \"\\\\lvert\", \"\\\\rvert\", \"\\\\lVert\", \"\\\\rVert\", \"\\\\lgroup\", \"\\\\rgroup\", \"\\u27ee\", \"\\u27ef\", \"\\\\lmoustache\", \"\\\\rmoustache\", \"\\u23b0\", \"\\u23b1\"]; // and delimiters that never stack\n\nvar stackNeverDelimiters = [\"<\", \">\", \"\\\\langle\", \"\\\\rangle\", \"/\", \"\\\\backslash\", \"\\\\lt\", \"\\\\gt\"]; // Metrics of the different sizes. Found by looking at TeX's output of\n// $\\bigl| // \\Bigl| \\biggl| \\Biggl| \\showlists$\n// Used to create stacked delimiters of appropriate sizes in makeSizedDelim.\n\nvar sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3.0];\n/**\n * Used to create a delimiter of a specific size, where `size` is 1, 2, 3, or 4.\n */\n\nvar makeSizedDelim = function makeSizedDelim(delim, size, options, mode, classes) {\n // < and > turn into \\langle and \\rangle in delimiters\n if (delim === \"<\" || delim === \"\\\\lt\" || delim === \"\\u27e8\") {\n delim = \"\\\\langle\";\n } else if (delim === \">\" || delim === \"\\\\gt\" || delim === \"\\u27e9\") {\n delim = \"\\\\rangle\";\n } // Sized delimiters are never centered.\n\n\n if (utils.contains(stackLargeDelimiters, delim) || utils.contains(stackNeverDelimiters, delim)) {\n return makeLargeDelim(delim, size, false, options, mode, classes);\n } else if (utils.contains(stackAlwaysDelimiters, delim)) {\n return makeStackedDelim(delim, sizeToMaxHeight[size], false, options, mode, classes);\n } else {\n throw new ParseError(\"Illegal delimiter: '\" + delim + \"'\");\n }\n};\n/**\n * There are three different sequences of delimiter sizes that the delimiters\n * follow depending on the kind of delimiter. This is used when creating custom\n * sized delimiters to decide whether to create a small, large, or stacked\n * delimiter.\n *\n * In real TeX, these sequences aren't explicitly defined, but are instead\n * defined inside the font metrics. Since there are only three sequences that\n * are possible for the delimiters that TeX defines, it is easier to just encode\n * them explicitly here.\n */\n\n\n// Delimiters that never stack try small delimiters and large delimiters only\nvar stackNeverDelimiterSequence = [{\n type: \"small\",\n style: Style$1.SCRIPTSCRIPT\n}, {\n type: \"small\",\n style: Style$1.SCRIPT\n}, {\n type: \"small\",\n style: Style$1.TEXT\n}, {\n type: \"large\",\n size: 1\n}, {\n type: \"large\",\n size: 2\n}, {\n type: \"large\",\n size: 3\n}, {\n type: \"large\",\n size: 4\n}]; // Delimiters that always stack try the small delimiters first, then stack\n\nvar stackAlwaysDelimiterSequence = [{\n type: \"small\",\n style: Style$1.SCRIPTSCRIPT\n}, {\n type: \"small\",\n style: Style$1.SCRIPT\n}, {\n type: \"small\",\n style: Style$1.TEXT\n}, {\n type: \"stack\"\n}]; // Delimiters that stack when large try the small and then large delimiters, and\n// stack afterwards\n\nvar stackLargeDelimiterSequence = [{\n type: \"small\",\n style: Style$1.SCRIPTSCRIPT\n}, {\n type: \"small\",\n style: Style$1.SCRIPT\n}, {\n type: \"small\",\n style: Style$1.TEXT\n}, {\n type: \"large\",\n size: 1\n}, {\n type: \"large\",\n size: 2\n}, {\n type: \"large\",\n size: 3\n}, {\n type: \"large\",\n size: 4\n}, {\n type: \"stack\"\n}];\n/**\n * Get the font used in a delimiter based on what kind of delimiter it is.\n * TODO(#963) Use more specific font family return type once that is introduced.\n */\n\nvar delimTypeToFont = function delimTypeToFont(type) {\n if (type.type === \"small\") {\n return \"Main-Regular\";\n } else if (type.type === \"large\") {\n return \"Size\" + type.size + \"-Regular\";\n } else if (type.type === \"stack\") {\n return \"Size4-Regular\";\n } else {\n throw new Error(\"Add support for delim type '\" + type.type + \"' here.\");\n }\n};\n/**\n * Traverse a sequence of types of delimiters to decide what kind of delimiter\n * should be used to create a delimiter of the given height+depth.\n */\n\n\nvar traverseSequence = function traverseSequence(delim, height, sequence, options) {\n // Here, we choose the index we should start at in the sequences. In smaller\n // sizes (which correspond to larger numbers in style.size) we start earlier\n // in the sequence. Thus, scriptscript starts at index 3-3=0, script starts\n // at index 3-2=1, text starts at 3-1=2, and display starts at min(2,3-0)=2\n var start = Math.min(2, 3 - options.style.size);\n\n for (var i = start; i < sequence.length; i++) {\n if (sequence[i].type === \"stack\") {\n // This is always the last delimiter, so we just break the loop now.\n break;\n }\n\n var metrics = getMetrics(delim, delimTypeToFont(sequence[i]), \"math\");\n var heightDepth = metrics.height + metrics.depth; // Small delimiters are scaled down versions of the same font, so we\n // account for the style change size.\n\n if (sequence[i].type === \"small\") {\n var newOptions = options.havingBaseStyle(sequence[i].style);\n heightDepth *= newOptions.sizeMultiplier;\n } // Check if the delimiter at this size works for the given height.\n\n\n if (heightDepth > height) {\n return sequence[i];\n }\n } // If we reached the end of the sequence, return the last sequence element.\n\n\n return sequence[sequence.length - 1];\n};\n/**\n * Make a delimiter of a given height+depth, with optional centering. Here, we\n * traverse the sequences, and create a delimiter that the sequence tells us to.\n */\n\n\nvar makeCustomSizedDelim = function makeCustomSizedDelim(delim, height, center, options, mode, classes) {\n if (delim === \"<\" || delim === \"\\\\lt\" || delim === \"\\u27e8\") {\n delim = \"\\\\langle\";\n } else if (delim === \">\" || delim === \"\\\\gt\" || delim === \"\\u27e9\") {\n delim = \"\\\\rangle\";\n } // Decide what sequence to use\n\n\n var sequence;\n\n if (utils.contains(stackNeverDelimiters, delim)) {\n sequence = stackNeverDelimiterSequence;\n } else if (utils.contains(stackLargeDelimiters, delim)) {\n sequence = stackLargeDelimiterSequence;\n } else {\n sequence = stackAlwaysDelimiterSequence;\n } // Look through the sequence\n\n\n var delimType = traverseSequence(delim, height, sequence, options); // Get the delimiter from font glyphs.\n // Depending on the sequence element we decided on, call the\n // appropriate function.\n\n if (delimType.type === \"small\") {\n return makeSmallDelim(delim, delimType.style, center, options, mode, classes);\n } else if (delimType.type === \"large\") {\n return makeLargeDelim(delim, delimType.size, center, options, mode, classes);\n } else\n /* if (delimType.type === \"stack\") */\n {\n return makeStackedDelim(delim, height, center, options, mode, classes);\n }\n};\n/**\n * Make a delimiter for use with `\\left` and `\\right`, given a height and depth\n * of an expression that the delimiters surround.\n */\n\n\nvar makeLeftRightDelim = function makeLeftRightDelim(delim, height, depth, options, mode, classes) {\n // We always center \\left/\\right delimiters, so the axis is always shifted\n var axisHeight = options.fontMetrics().axisHeight * options.sizeMultiplier; // Taken from TeX source, tex.web, function make_left_right\n\n var delimiterFactor = 901;\n var delimiterExtend = 5.0 / options.fontMetrics().ptPerEm;\n var maxDistFromAxis = Math.max(height - axisHeight, depth + axisHeight);\n var totalHeight = Math.max( // In real TeX, calculations are done using integral values which are\n // 65536 per pt, or 655360 per em. So, the division here truncates in\n // TeX but doesn't here, producing different results. If we wanted to\n // exactly match TeX's calculation, we could do\n // Math.floor(655360 * maxDistFromAxis / 500) *\n // delimiterFactor / 655360\n // (To see the difference, compare\n // x^{x^{\\left(\\rule{0.1em}{0.68em}\\right)}}\n // in TeX and KaTeX)\n maxDistFromAxis / 500 * delimiterFactor, 2 * maxDistFromAxis - delimiterExtend); // Finally, we defer to `makeCustomSizedDelim` with our calculated total\n // height\n\n return makeCustomSizedDelim(delim, totalHeight, true, options, mode, classes);\n};\n\nvar delimiter = {\n sqrtImage: makeSqrtImage,\n sizedDelim: makeSizedDelim,\n sizeToMaxHeight: sizeToMaxHeight,\n customSizedDelim: makeCustomSizedDelim,\n leftRightDelim: makeLeftRightDelim\n};\n\n// Extra data needed for the delimiter handler down below\nvar delimiterSizes = {\n \"\\\\bigl\": {\n mclass: \"mopen\",\n size: 1\n },\n \"\\\\Bigl\": {\n mclass: \"mopen\",\n size: 2\n },\n \"\\\\biggl\": {\n mclass: \"mopen\",\n size: 3\n },\n \"\\\\Biggl\": {\n mclass: \"mopen\",\n size: 4\n },\n \"\\\\bigr\": {\n mclass: \"mclose\",\n size: 1\n },\n \"\\\\Bigr\": {\n mclass: \"mclose\",\n size: 2\n },\n \"\\\\biggr\": {\n mclass: \"mclose\",\n size: 3\n },\n \"\\\\Biggr\": {\n mclass: \"mclose\",\n size: 4\n },\n \"\\\\bigm\": {\n mclass: \"mrel\",\n size: 1\n },\n \"\\\\Bigm\": {\n mclass: \"mrel\",\n size: 2\n },\n \"\\\\biggm\": {\n mclass: \"mrel\",\n size: 3\n },\n \"\\\\Biggm\": {\n mclass: \"mrel\",\n size: 4\n },\n \"\\\\big\": {\n mclass: \"mord\",\n size: 1\n },\n \"\\\\Big\": {\n mclass: \"mord\",\n size: 2\n },\n \"\\\\bigg\": {\n mclass: \"mord\",\n size: 3\n },\n \"\\\\Bigg\": {\n mclass: \"mord\",\n size: 4\n }\n};\nvar delimiters = [\"(\", \"\\\\lparen\", \")\", \"\\\\rparen\", \"[\", \"\\\\lbrack\", \"]\", \"\\\\rbrack\", \"\\\\{\", \"\\\\lbrace\", \"\\\\}\", \"\\\\rbrace\", \"\\\\lfloor\", \"\\\\rfloor\", \"\\u230a\", \"\\u230b\", \"\\\\lceil\", \"\\\\rceil\", \"\\u2308\", \"\\u2309\", \"<\", \">\", \"\\\\langle\", \"\\u27e8\", \"\\\\rangle\", \"\\u27e9\", \"\\\\lt\", \"\\\\gt\", \"\\\\lvert\", \"\\\\rvert\", \"\\\\lVert\", \"\\\\rVert\", \"\\\\lgroup\", \"\\\\rgroup\", \"\\u27ee\", \"\\u27ef\", \"\\\\lmoustache\", \"\\\\rmoustache\", \"\\u23b0\", \"\\u23b1\", \"/\", \"\\\\backslash\", \"|\", \"\\\\vert\", \"\\\\|\", \"\\\\Vert\", \"\\\\uparrow\", \"\\\\Uparrow\", \"\\\\downarrow\", \"\\\\Downarrow\", \"\\\\updownarrow\", \"\\\\Updownarrow\", \".\"];\n\n// Delimiter functions\nfunction checkDelimiter(delim, context) {\n var symDelim = checkSymbolNodeType(delim);\n\n if (symDelim && utils.contains(delimiters, symDelim.text)) {\n return symDelim;\n } else if (symDelim) {\n throw new ParseError(\"Invalid delimiter '\" + symDelim.text + \"' after '\" + context.funcName + \"'\", delim);\n } else {\n throw new ParseError(\"Invalid delimiter type '\" + delim.type + \"'\", delim);\n }\n}\n\ndefineFunction({\n type: \"delimsizing\",\n names: [\"\\\\bigl\", \"\\\\Bigl\", \"\\\\biggl\", \"\\\\Biggl\", \"\\\\bigr\", \"\\\\Bigr\", \"\\\\biggr\", \"\\\\Biggr\", \"\\\\bigm\", \"\\\\Bigm\", \"\\\\biggm\", \"\\\\Biggm\", \"\\\\big\", \"\\\\Big\", \"\\\\bigg\", \"\\\\Bigg\"],\n props: {\n numArgs: 1,\n argTypes: [\"primitive\"]\n },\n handler: (context, args) => {\n var delim = checkDelimiter(args[0], context);\n return {\n type: \"delimsizing\",\n mode: context.parser.mode,\n size: delimiterSizes[context.funcName].size,\n mclass: delimiterSizes[context.funcName].mclass,\n delim: delim.text\n };\n },\n htmlBuilder: (group, options) => {\n if (group.delim === \".\") {\n // Empty delimiters still count as elements, even though they don't\n // show anything.\n return buildCommon.makeSpan([group.mclass]);\n } // Use delimiter.sizedDelim to generate the delimiter.\n\n\n return delimiter.sizedDelim(group.delim, group.size, options, group.mode, [group.mclass]);\n },\n mathmlBuilder: group => {\n var children = [];\n\n if (group.delim !== \".\") {\n children.push(makeText(group.delim, group.mode));\n }\n\n var node = new mathMLTree.MathNode(\"mo\", children);\n\n if (group.mclass === \"mopen\" || group.mclass === \"mclose\") {\n // Only some of the delimsizing functions act as fences, and they\n // return \"mopen\" or \"mclose\" mclass.\n node.setAttribute(\"fence\", \"true\");\n } else {\n // Explicitly disable fencing if it's not a fence, to override the\n // defaults.\n node.setAttribute(\"fence\", \"false\");\n }\n\n node.setAttribute(\"stretchy\", \"true\");\n var size = makeEm(delimiter.sizeToMaxHeight[group.size]);\n node.setAttribute(\"minsize\", size);\n node.setAttribute(\"maxsize\", size);\n return node;\n }\n});\n\nfunction assertParsed(group) {\n if (!group.body) {\n throw new Error(\"Bug: The leftright ParseNode wasn't fully parsed.\");\n }\n}\n\ndefineFunction({\n type: \"leftright-right\",\n names: [\"\\\\right\"],\n props: {\n numArgs: 1,\n primitive: true\n },\n handler: (context, args) => {\n // \\left case below triggers parsing of \\right in\n // `const right = parser.parseFunction();`\n // uses this return value.\n var color = context.parser.gullet.macros.get(\"\\\\current@color\");\n\n if (color && typeof color !== \"string\") {\n throw new ParseError(\"\\\\current@color set to non-string in \\\\right\");\n }\n\n return {\n type: \"leftright-right\",\n mode: context.parser.mode,\n delim: checkDelimiter(args[0], context).text,\n color // undefined if not set via \\color\n\n };\n }\n});\ndefineFunction({\n type: \"leftright\",\n names: [\"\\\\left\"],\n props: {\n numArgs: 1,\n primitive: true\n },\n handler: (context, args) => {\n var delim = checkDelimiter(args[0], context);\n var parser = context.parser; // Parse out the implicit body\n\n ++parser.leftrightDepth; // parseExpression stops before '\\\\right'\n\n var body = parser.parseExpression(false);\n --parser.leftrightDepth; // Check the next token\n\n parser.expect(\"\\\\right\", false);\n var right = assertNodeType(parser.parseFunction(), \"leftright-right\");\n return {\n type: \"leftright\",\n mode: parser.mode,\n body,\n left: delim.text,\n right: right.delim,\n rightColor: right.color\n };\n },\n htmlBuilder: (group, options) => {\n assertParsed(group); // Build the inner expression\n\n var inner = buildExpression$1(group.body, options, true, [\"mopen\", \"mclose\"]);\n var innerHeight = 0;\n var innerDepth = 0;\n var hadMiddle = false; // Calculate its height and depth\n\n for (var i = 0; i < inner.length; i++) {\n // Property `isMiddle` not defined on `span`. See comment in\n // \"middle\"'s htmlBuilder.\n // $FlowFixMe\n if (inner[i].isMiddle) {\n hadMiddle = true;\n } else {\n innerHeight = Math.max(inner[i].height, innerHeight);\n innerDepth = Math.max(inner[i].depth, innerDepth);\n }\n } // The size of delimiters is the same, regardless of what style we are\n // in. Thus, to correctly calculate the size of delimiter we need around\n // a group, we scale down the inner size based on the size.\n\n\n innerHeight *= options.sizeMultiplier;\n innerDepth *= options.sizeMultiplier;\n var leftDelim;\n\n if (group.left === \".\") {\n // Empty delimiters in \\left and \\right make null delimiter spaces.\n leftDelim = makeNullDelimiter(options, [\"mopen\"]);\n } else {\n // Otherwise, use leftRightDelim to generate the correct sized\n // delimiter.\n leftDelim = delimiter.leftRightDelim(group.left, innerHeight, innerDepth, options, group.mode, [\"mopen\"]);\n } // Add it to the beginning of the expression\n\n\n inner.unshift(leftDelim); // Handle middle delimiters\n\n if (hadMiddle) {\n for (var _i = 1; _i < inner.length; _i++) {\n var middleDelim = inner[_i]; // Property `isMiddle` not defined on `span`. See comment in\n // \"middle\"'s htmlBuilder.\n // $FlowFixMe\n\n var isMiddle = middleDelim.isMiddle;\n\n if (isMiddle) {\n // Apply the options that were active when \\middle was called\n inner[_i] = delimiter.leftRightDelim(isMiddle.delim, innerHeight, innerDepth, isMiddle.options, group.mode, []);\n }\n }\n }\n\n var rightDelim; // Same for the right delimiter, but using color specified by \\color\n\n if (group.right === \".\") {\n rightDelim = makeNullDelimiter(options, [\"mclose\"]);\n } else {\n var colorOptions = group.rightColor ? options.withColor(group.rightColor) : options;\n rightDelim = delimiter.leftRightDelim(group.right, innerHeight, innerDepth, colorOptions, group.mode, [\"mclose\"]);\n } // Add it to the end of the expression.\n\n\n inner.push(rightDelim);\n return buildCommon.makeSpan([\"minner\"], inner, options);\n },\n mathmlBuilder: (group, options) => {\n assertParsed(group);\n var inner = buildExpression(group.body, options);\n\n if (group.left !== \".\") {\n var leftNode = new mathMLTree.MathNode(\"mo\", [makeText(group.left, group.mode)]);\n leftNode.setAttribute(\"fence\", \"true\");\n inner.unshift(leftNode);\n }\n\n if (group.right !== \".\") {\n var rightNode = new mathMLTree.MathNode(\"mo\", [makeText(group.right, group.mode)]);\n rightNode.setAttribute(\"fence\", \"true\");\n\n if (group.rightColor) {\n rightNode.setAttribute(\"mathcolor\", group.rightColor);\n }\n\n inner.push(rightNode);\n }\n\n return makeRow(inner);\n }\n});\ndefineFunction({\n type: \"middle\",\n names: [\"\\\\middle\"],\n props: {\n numArgs: 1,\n primitive: true\n },\n handler: (context, args) => {\n var delim = checkDelimiter(args[0], context);\n\n if (!context.parser.leftrightDepth) {\n throw new ParseError(\"\\\\middle without preceding \\\\left\", delim);\n }\n\n return {\n type: \"middle\",\n mode: context.parser.mode,\n delim: delim.text\n };\n },\n htmlBuilder: (group, options) => {\n var middleDelim;\n\n if (group.delim === \".\") {\n middleDelim = makeNullDelimiter(options, []);\n } else {\n middleDelim = delimiter.sizedDelim(group.delim, 1, options, group.mode, []);\n var isMiddle = {\n delim: group.delim,\n options\n }; // Property `isMiddle` not defined on `span`. It is only used in\n // this file above.\n // TODO: Fix this violation of the `span` type and possibly rename\n // things since `isMiddle` sounds like a boolean, but is a struct.\n // $FlowFixMe\n\n middleDelim.isMiddle = isMiddle;\n }\n\n return middleDelim;\n },\n mathmlBuilder: (group, options) => {\n // A Firefox \\middle will stretch a character vertically only if it\n // is in the fence part of the operator dictionary at:\n // https://www.w3.org/TR/MathML3/appendixc.html.\n // So we need to avoid U+2223 and use plain \"|\" instead.\n var textNode = group.delim === \"\\\\vert\" || group.delim === \"|\" ? makeText(\"|\", \"text\") : makeText(group.delim, group.mode);\n var middleNode = new mathMLTree.MathNode(\"mo\", [textNode]);\n middleNode.setAttribute(\"fence\", \"true\"); // MathML gives 5/18em spacing to each element.\n // \\middle should get delimiter spacing instead.\n\n middleNode.setAttribute(\"lspace\", \"0.05em\");\n middleNode.setAttribute(\"rspace\", \"0.05em\");\n return middleNode;\n }\n});\n\nvar htmlBuilder$7 = (group, options) => {\n // \\cancel, \\bcancel, \\xcancel, \\sout, \\fbox, \\colorbox, \\fcolorbox, \\phase\n // Some groups can return document fragments. Handle those by wrapping\n // them in a span.\n var inner = buildCommon.wrapFragment(buildGroup$1(group.body, options), options);\n var label = group.label.slice(1);\n var scale = options.sizeMultiplier;\n var img;\n var imgShift = 0; // In the LaTeX cancel package, line geometry is slightly different\n // depending on whether the subject is wider than it is tall, or vice versa.\n // We don't know the width of a group, so as a proxy, we test if\n // the subject is a single character. This captures most of the\n // subjects that should get the \"tall\" treatment.\n\n var isSingleChar = utils.isCharacterBox(group.body);\n\n if (label === \"sout\") {\n img = buildCommon.makeSpan([\"stretchy\", \"sout\"]);\n img.height = options.fontMetrics().defaultRuleThickness / scale;\n imgShift = -0.5 * options.fontMetrics().xHeight;\n } else if (label === \"phase\") {\n // Set a couple of dimensions from the steinmetz package.\n var lineWeight = calculateSize({\n number: 0.6,\n unit: \"pt\"\n }, options);\n var clearance = calculateSize({\n number: 0.35,\n unit: \"ex\"\n }, options); // Prevent size changes like \\Huge from affecting line thickness\n\n var newOptions = options.havingBaseSizing();\n scale = scale / newOptions.sizeMultiplier;\n var angleHeight = inner.height + inner.depth + lineWeight + clearance; // Reserve a left pad for the angle.\n\n inner.style.paddingLeft = makeEm(angleHeight / 2 + lineWeight); // Create an SVG\n\n var viewBoxHeight = Math.floor(1000 * angleHeight * scale);\n var path = phasePath(viewBoxHeight);\n var svgNode = new SvgNode([new PathNode(\"phase\", path)], {\n \"width\": \"400em\",\n \"height\": makeEm(viewBoxHeight / 1000),\n \"viewBox\": \"0 0 400000 \" + viewBoxHeight,\n \"preserveAspectRatio\": \"xMinYMin slice\"\n }); // Wrap it in a span with overflow: hidden.\n\n img = buildCommon.makeSvgSpan([\"hide-tail\"], [svgNode], options);\n img.style.height = makeEm(angleHeight);\n imgShift = inner.depth + lineWeight + clearance;\n } else {\n // Add horizontal padding\n if (/cancel/.test(label)) {\n if (!isSingleChar) {\n inner.classes.push(\"cancel-pad\");\n }\n } else if (label === \"angl\") {\n inner.classes.push(\"anglpad\");\n } else {\n inner.classes.push(\"boxpad\");\n } // Add vertical padding\n\n\n var topPad = 0;\n var bottomPad = 0;\n var ruleThickness = 0; // ref: cancel package: \\advance\\totalheight2\\p@ % \"+2\"\n\n if (/box/.test(label)) {\n ruleThickness = Math.max(options.fontMetrics().fboxrule, // default\n options.minRuleThickness // User override.\n );\n topPad = options.fontMetrics().fboxsep + (label === \"colorbox\" ? 0 : ruleThickness);\n bottomPad = topPad;\n } else if (label === \"angl\") {\n ruleThickness = Math.max(options.fontMetrics().defaultRuleThickness, options.minRuleThickness);\n topPad = 4 * ruleThickness; // gap = 3 \u00D7 line, plus the line itself.\n\n bottomPad = Math.max(0, 0.25 - inner.depth);\n } else {\n topPad = isSingleChar ? 0.2 : 0;\n bottomPad = topPad;\n }\n\n img = stretchy.encloseSpan(inner, label, topPad, bottomPad, options);\n\n if (/fbox|boxed|fcolorbox/.test(label)) {\n img.style.borderStyle = \"solid\";\n img.style.borderWidth = makeEm(ruleThickness);\n } else if (label === \"angl\" && ruleThickness !== 0.049) {\n img.style.borderTopWidth = makeEm(ruleThickness);\n img.style.borderRightWidth = makeEm(ruleThickness);\n }\n\n imgShift = inner.depth + bottomPad;\n\n if (group.backgroundColor) {\n img.style.backgroundColor = group.backgroundColor;\n\n if (group.borderColor) {\n img.style.borderColor = group.borderColor;\n }\n }\n }\n\n var vlist;\n\n if (group.backgroundColor) {\n vlist = buildCommon.makeVList({\n positionType: \"individualShift\",\n children: [// Put the color background behind inner;\n {\n type: \"elem\",\n elem: img,\n shift: imgShift\n }, {\n type: \"elem\",\n elem: inner,\n shift: 0\n }]\n }, options);\n } else {\n var classes = /cancel|phase/.test(label) ? [\"svg-align\"] : [];\n vlist = buildCommon.makeVList({\n positionType: \"individualShift\",\n children: [// Write the \\cancel stroke on top of inner.\n {\n type: \"elem\",\n elem: inner,\n shift: 0\n }, {\n type: \"elem\",\n elem: img,\n shift: imgShift,\n wrapperClasses: classes\n }]\n }, options);\n }\n\n if (/cancel/.test(label)) {\n // The cancel package documentation says that cancel lines add their height\n // to the expression, but tests show that isn't how it actually works.\n vlist.height = inner.height;\n vlist.depth = inner.depth;\n }\n\n if (/cancel/.test(label) && !isSingleChar) {\n // cancel does not create horiz space for its line extension.\n return buildCommon.makeSpan([\"mord\", \"cancel-lap\"], [vlist], options);\n } else {\n return buildCommon.makeSpan([\"mord\"], [vlist], options);\n }\n};\n\nvar mathmlBuilder$6 = (group, options) => {\n var fboxsep = 0;\n var node = new mathMLTree.MathNode(group.label.indexOf(\"colorbox\") > -1 ? \"mpadded\" : \"menclose\", [buildGroup(group.body, options)]);\n\n switch (group.label) {\n case \"\\\\cancel\":\n node.setAttribute(\"notation\", \"updiagonalstrike\");\n break;\n\n case \"\\\\bcancel\":\n node.setAttribute(\"notation\", \"downdiagonalstrike\");\n break;\n\n case \"\\\\phase\":\n node.setAttribute(\"notation\", \"phasorangle\");\n break;\n\n case \"\\\\sout\":\n node.setAttribute(\"notation\", \"horizontalstrike\");\n break;\n\n case \"\\\\fbox\":\n node.setAttribute(\"notation\", \"box\");\n break;\n\n case \"\\\\angl\":\n node.setAttribute(\"notation\", \"actuarial\");\n break;\n\n case \"\\\\fcolorbox\":\n case \"\\\\colorbox\":\n // doesn't have a good notation option. So use \n // instead. Set some attributes that come included with .\n fboxsep = options.fontMetrics().fboxsep * options.fontMetrics().ptPerEm;\n node.setAttribute(\"width\", \"+\" + 2 * fboxsep + \"pt\");\n node.setAttribute(\"height\", \"+\" + 2 * fboxsep + \"pt\");\n node.setAttribute(\"lspace\", fboxsep + \"pt\"); //\n\n node.setAttribute(\"voffset\", fboxsep + \"pt\");\n\n if (group.label === \"\\\\fcolorbox\") {\n var thk = Math.max(options.fontMetrics().fboxrule, // default\n options.minRuleThickness // user override\n );\n node.setAttribute(\"style\", \"border: \" + thk + \"em solid \" + String(group.borderColor));\n }\n\n break;\n\n case \"\\\\xcancel\":\n node.setAttribute(\"notation\", \"updiagonalstrike downdiagonalstrike\");\n break;\n }\n\n if (group.backgroundColor) {\n node.setAttribute(\"mathbackground\", group.backgroundColor);\n }\n\n return node;\n};\n\ndefineFunction({\n type: \"enclose\",\n names: [\"\\\\colorbox\"],\n props: {\n numArgs: 2,\n allowedInText: true,\n argTypes: [\"color\", \"text\"]\n },\n\n handler(_ref, args, optArgs) {\n var {\n parser,\n funcName\n } = _ref;\n var color = assertNodeType(args[0], \"color-token\").color;\n var body = args[1];\n return {\n type: \"enclose\",\n mode: parser.mode,\n label: funcName,\n backgroundColor: color,\n body\n };\n },\n\n htmlBuilder: htmlBuilder$7,\n mathmlBuilder: mathmlBuilder$6\n});\ndefineFunction({\n type: \"enclose\",\n names: [\"\\\\fcolorbox\"],\n props: {\n numArgs: 3,\n allowedInText: true,\n argTypes: [\"color\", \"color\", \"text\"]\n },\n\n handler(_ref2, args, optArgs) {\n var {\n parser,\n funcName\n } = _ref2;\n var borderColor = assertNodeType(args[0], \"color-token\").color;\n var backgroundColor = assertNodeType(args[1], \"color-token\").color;\n var body = args[2];\n return {\n type: \"enclose\",\n mode: parser.mode,\n label: funcName,\n backgroundColor,\n borderColor,\n body\n };\n },\n\n htmlBuilder: htmlBuilder$7,\n mathmlBuilder: mathmlBuilder$6\n});\ndefineFunction({\n type: \"enclose\",\n names: [\"\\\\fbox\"],\n props: {\n numArgs: 1,\n argTypes: [\"hbox\"],\n allowedInText: true\n },\n\n handler(_ref3, args) {\n var {\n parser\n } = _ref3;\n return {\n type: \"enclose\",\n mode: parser.mode,\n label: \"\\\\fbox\",\n body: args[0]\n };\n }\n\n});\ndefineFunction({\n type: \"enclose\",\n names: [\"\\\\cancel\", \"\\\\bcancel\", \"\\\\xcancel\", \"\\\\sout\", \"\\\\phase\"],\n props: {\n numArgs: 1\n },\n\n handler(_ref4, args) {\n var {\n parser,\n funcName\n } = _ref4;\n var body = args[0];\n return {\n type: \"enclose\",\n mode: parser.mode,\n label: funcName,\n body\n };\n },\n\n htmlBuilder: htmlBuilder$7,\n mathmlBuilder: mathmlBuilder$6\n});\ndefineFunction({\n type: \"enclose\",\n names: [\"\\\\angl\"],\n props: {\n numArgs: 1,\n argTypes: [\"hbox\"],\n allowedInText: false\n },\n\n handler(_ref5, args) {\n var {\n parser\n } = _ref5;\n return {\n type: \"enclose\",\n mode: parser.mode,\n label: \"\\\\angl\",\n body: args[0]\n };\n }\n\n});\n\n/**\n * All registered environments.\n * `environments.js` exports this same dictionary again and makes it public.\n * `Parser.js` requires this dictionary via `environments.js`.\n */\nvar _environments = {};\nfunction defineEnvironment(_ref) {\n var {\n type,\n names,\n props,\n handler,\n htmlBuilder,\n mathmlBuilder\n } = _ref;\n // Set default values of environments.\n var data = {\n type,\n numArgs: props.numArgs || 0,\n allowedInText: false,\n numOptionalArgs: 0,\n handler\n };\n\n for (var i = 0; i < names.length; ++i) {\n // TODO: The value type of _environments should be a type union of all\n // possible `EnvSpec<>` possibilities instead of `EnvSpec<*>`, which is\n // an existential type.\n _environments[names[i]] = data;\n }\n\n if (htmlBuilder) {\n _htmlGroupBuilders[type] = htmlBuilder;\n }\n\n if (mathmlBuilder) {\n _mathmlGroupBuilders[type] = mathmlBuilder;\n }\n}\n\n/**\n * All registered global/built-in macros.\n * `macros.js` exports this same dictionary again and makes it public.\n * `Parser.js` requires this dictionary via `macros.js`.\n */\nvar _macros = {}; // This function might one day accept an additional argument and do more things.\n\nfunction defineMacro(name, body) {\n _macros[name] = body;\n}\n\n// Helper functions\nfunction getHLines(parser) {\n // Return an array. The array length = number of hlines.\n // Each element in the array tells if the line is dashed.\n var hlineInfo = [];\n parser.consumeSpaces();\n var nxt = parser.fetch().text;\n\n if (nxt === \"\\\\relax\") {\n // \\relax is an artifact of the \\cr macro below\n parser.consume();\n parser.consumeSpaces();\n nxt = parser.fetch().text;\n }\n\n while (nxt === \"\\\\hline\" || nxt === \"\\\\hdashline\") {\n parser.consume();\n hlineInfo.push(nxt === \"\\\\hdashline\");\n parser.consumeSpaces();\n nxt = parser.fetch().text;\n }\n\n return hlineInfo;\n}\n\nvar validateAmsEnvironmentContext = context => {\n var settings = context.parser.settings;\n\n if (!settings.displayMode) {\n throw new ParseError(\"{\" + context.envName + \"} can be used only in\" + \" display mode.\");\n }\n}; // autoTag (an argument to parseArray) can be one of three values:\n// * undefined: Regular (not-top-level) array; no tags on each row\n// * true: Automatic equation numbering, overridable by \\tag\n// * false: Tags allowed on each row, but no automatic numbering\n// This function *doesn't* work with the \"split\" environment name.\n\n\nfunction getAutoTag(name) {\n if (name.indexOf(\"ed\") === -1) {\n return name.indexOf(\"*\") === -1;\n } // return undefined;\n\n}\n/**\n * Parse the body of the environment, with rows delimited by \\\\ and\n * columns delimited by &, and create a nested list in row-major order\n * with one group per cell. If given an optional argument style\n * (\"text\", \"display\", etc.), then each cell is cast into that style.\n */\n\n\nfunction parseArray(parser, _ref, style) {\n var {\n hskipBeforeAndAfter,\n addJot,\n cols,\n arraystretch,\n colSeparationType,\n autoTag,\n singleRow,\n emptySingleRow,\n maxNumCols,\n leqno\n } = _ref;\n parser.gullet.beginGroup();\n\n if (!singleRow) {\n // \\cr is equivalent to \\\\ without the optional size argument (see below)\n // TODO: provide helpful error when \\cr is used outside array environment\n parser.gullet.macros.set(\"\\\\cr\", \"\\\\\\\\\\\\relax\");\n } // Get current arraystretch if it's not set by the environment\n\n\n if (!arraystretch) {\n var stretch = parser.gullet.expandMacroAsText(\"\\\\arraystretch\");\n\n if (stretch == null) {\n // Default \\arraystretch from lttab.dtx\n arraystretch = 1;\n } else {\n arraystretch = parseFloat(stretch);\n\n if (!arraystretch || arraystretch < 0) {\n throw new ParseError(\"Invalid \\\\arraystretch: \" + stretch);\n }\n }\n } // Start group for first cell\n\n\n parser.gullet.beginGroup();\n var row = [];\n var body = [row];\n var rowGaps = [];\n var hLinesBeforeRow = [];\n var tags = autoTag != null ? [] : undefined; // amsmath uses \\global\\@eqnswtrue and \\global\\@eqnswfalse to represent\n // whether this row should have an equation number. Simulate this with\n // a \\@eqnsw macro set to 1 or 0.\n\n function beginRow() {\n if (autoTag) {\n parser.gullet.macros.set(\"\\\\@eqnsw\", \"1\", true);\n }\n }\n\n function endRow() {\n if (tags) {\n if (parser.gullet.macros.get(\"\\\\df@tag\")) {\n tags.push(parser.subparse([new Token(\"\\\\df@tag\")]));\n parser.gullet.macros.set(\"\\\\df@tag\", undefined, true);\n } else {\n tags.push(Boolean(autoTag) && parser.gullet.macros.get(\"\\\\@eqnsw\") === \"1\");\n }\n }\n }\n\n beginRow(); // Test for \\hline at the top of the array.\n\n hLinesBeforeRow.push(getHLines(parser));\n\n while (true) {\n // eslint-disable-line no-constant-condition\n // Parse each cell in its own group (namespace)\n var cell = parser.parseExpression(false, singleRow ? \"\\\\end\" : \"\\\\\\\\\");\n parser.gullet.endGroup();\n parser.gullet.beginGroup();\n cell = {\n type: \"ordgroup\",\n mode: parser.mode,\n body: cell\n };\n\n if (style) {\n cell = {\n type: \"styling\",\n mode: parser.mode,\n style,\n body: [cell]\n };\n }\n\n row.push(cell);\n var next = parser.fetch().text;\n\n if (next === \"&\") {\n if (maxNumCols && row.length === maxNumCols) {\n if (singleRow || colSeparationType) {\n // {equation} or {split}\n throw new ParseError(\"Too many tab characters: &\", parser.nextToken);\n } else {\n // {array} environment\n parser.settings.reportNonstrict(\"textEnv\", \"Too few columns \" + \"specified in the {array} column argument.\");\n }\n }\n\n parser.consume();\n } else if (next === \"\\\\end\") {\n endRow(); // Arrays terminate newlines with `\\crcr` which consumes a `\\cr` if\n // the last line is empty. However, AMS environments keep the\n // empty row if it's the only one.\n // NOTE: Currently, `cell` is the last item added into `row`.\n\n if (row.length === 1 && cell.type === \"styling\" && cell.body[0].body.length === 0 && (body.length > 1 || !emptySingleRow)) {\n body.pop();\n }\n\n if (hLinesBeforeRow.length < body.length + 1) {\n hLinesBeforeRow.push([]);\n }\n\n break;\n } else if (next === \"\\\\\\\\\") {\n parser.consume();\n var size = void 0; // \\def\\Let@{\\let\\\\\\math@cr}\n // \\def\\math@cr{...\\math@cr@}\n // \\def\\math@cr@{\\new@ifnextchar[\\math@cr@@{\\math@cr@@[\\z@]}}\n // \\def\\math@cr@@[#1]{...\\math@cr@@@...}\n // \\def\\math@cr@@@{\\cr}\n\n if (parser.gullet.future().text !== \" \") {\n size = parser.parseSizeGroup(true);\n }\n\n rowGaps.push(size ? size.value : null);\n endRow(); // check for \\hline(s) following the row separator\n\n hLinesBeforeRow.push(getHLines(parser));\n row = [];\n body.push(row);\n beginRow();\n } else {\n throw new ParseError(\"Expected & or \\\\\\\\ or \\\\cr or \\\\end\", parser.nextToken);\n }\n } // End cell group\n\n\n parser.gullet.endGroup(); // End array group defining \\cr\n\n parser.gullet.endGroup();\n return {\n type: \"array\",\n mode: parser.mode,\n addJot,\n arraystretch,\n body,\n cols,\n rowGaps,\n hskipBeforeAndAfter,\n hLinesBeforeRow,\n colSeparationType,\n tags,\n leqno\n };\n} // Decides on a style for cells in an array according to whether the given\n// environment name starts with the letter 'd'.\n\n\nfunction dCellStyle(envName) {\n if (envName.slice(0, 1) === \"d\") {\n return \"display\";\n } else {\n return \"text\";\n }\n}\n\nvar htmlBuilder$6 = function htmlBuilder(group, options) {\n var r;\n var c;\n var nr = group.body.length;\n var hLinesBeforeRow = group.hLinesBeforeRow;\n var nc = 0;\n var body = new Array(nr);\n var hlines = [];\n var ruleThickness = Math.max( // From LaTeX \\showthe\\arrayrulewidth. Equals 0.04 em.\n options.fontMetrics().arrayRuleWidth, options.minRuleThickness // User override.\n ); // Horizontal spacing\n\n var pt = 1 / options.fontMetrics().ptPerEm;\n var arraycolsep = 5 * pt; // default value, i.e. \\arraycolsep in article.cls\n\n if (group.colSeparationType && group.colSeparationType === \"small\") {\n // We're in a {smallmatrix}. Default column space is \\thickspace,\n // i.e. 5/18em = 0.2778em, per amsmath.dtx for {smallmatrix}.\n // But that needs adjustment because LaTeX applies \\scriptstyle to the\n // entire array, including the colspace, but this function applies\n // \\scriptstyle only inside each element.\n var localMultiplier = options.havingStyle(Style$1.SCRIPT).sizeMultiplier;\n arraycolsep = 0.2778 * (localMultiplier / options.sizeMultiplier);\n } // Vertical spacing\n\n\n var baselineskip = group.colSeparationType === \"CD\" ? calculateSize({\n number: 3,\n unit: \"ex\"\n }, options) : 12 * pt; // see size10.clo\n // Default \\jot from ltmath.dtx\n // TODO(edemaine): allow overriding \\jot via \\setlength (#687)\n\n var jot = 3 * pt;\n var arrayskip = group.arraystretch * baselineskip;\n var arstrutHeight = 0.7 * arrayskip; // \\strutbox in ltfsstrc.dtx and\n\n var arstrutDepth = 0.3 * arrayskip; // \\@arstrutbox in lttab.dtx\n\n var totalHeight = 0; // Set a position for \\hline(s) at the top of the array, if any.\n\n function setHLinePos(hlinesInGap) {\n for (var i = 0; i < hlinesInGap.length; ++i) {\n if (i > 0) {\n totalHeight += 0.25;\n }\n\n hlines.push({\n pos: totalHeight,\n isDashed: hlinesInGap[i]\n });\n }\n }\n\n setHLinePos(hLinesBeforeRow[0]);\n\n for (r = 0; r < group.body.length; ++r) {\n var inrow = group.body[r];\n var height = arstrutHeight; // \\@array adds an \\@arstrut\n\n var depth = arstrutDepth; // to each tow (via the template)\n\n if (nc < inrow.length) {\n nc = inrow.length;\n }\n\n var outrow = new Array(inrow.length);\n\n for (c = 0; c < inrow.length; ++c) {\n var elt = buildGroup$1(inrow[c], options);\n\n if (depth < elt.depth) {\n depth = elt.depth;\n }\n\n if (height < elt.height) {\n height = elt.height;\n }\n\n outrow[c] = elt;\n }\n\n var rowGap = group.rowGaps[r];\n var gap = 0;\n\n if (rowGap) {\n gap = calculateSize(rowGap, options);\n\n if (gap > 0) {\n // \\@argarraycr\n gap += arstrutDepth;\n\n if (depth < gap) {\n depth = gap; // \\@xargarraycr\n }\n\n gap = 0;\n }\n } // In AMS multiline environments such as aligned and gathered, rows\n // correspond to lines that have additional \\jot added to the\n // \\baselineskip via \\openup.\n\n\n if (group.addJot) {\n depth += jot;\n }\n\n outrow.height = height;\n outrow.depth = depth;\n totalHeight += height;\n outrow.pos = totalHeight;\n totalHeight += depth + gap; // \\@yargarraycr\n\n body[r] = outrow; // Set a position for \\hline(s), if any.\n\n setHLinePos(hLinesBeforeRow[r + 1]);\n }\n\n var offset = totalHeight / 2 + options.fontMetrics().axisHeight;\n var colDescriptions = group.cols || [];\n var cols = [];\n var colSep;\n var colDescrNum;\n var tagSpans = [];\n\n if (group.tags && group.tags.some(tag => tag)) {\n // An environment with manual tags and/or automatic equation numbers.\n // Create node(s), the latter of which trigger CSS counter increment.\n for (r = 0; r < nr; ++r) {\n var rw = body[r];\n var shift = rw.pos - offset;\n var tag = group.tags[r];\n var tagSpan = void 0;\n\n if (tag === true) {\n // automatic numbering\n tagSpan = buildCommon.makeSpan([\"eqn-num\"], [], options);\n } else if (tag === false) {\n // \\nonumber/\\notag or starred environment\n tagSpan = buildCommon.makeSpan([], [], options);\n } else {\n // manual \\tag\n tagSpan = buildCommon.makeSpan([], buildExpression$1(tag, options, true), options);\n }\n\n tagSpan.depth = rw.depth;\n tagSpan.height = rw.height;\n tagSpans.push({\n type: \"elem\",\n elem: tagSpan,\n shift\n });\n }\n }\n\n for (c = 0, colDescrNum = 0; // Continue while either there are more columns or more column\n // descriptions, so trailing separators don't get lost.\n c < nc || colDescrNum < colDescriptions.length; ++c, ++colDescrNum) {\n var colDescr = colDescriptions[colDescrNum] || {};\n var firstSeparator = true;\n\n while (colDescr.type === \"separator\") {\n // If there is more than one separator in a row, add a space\n // between them.\n if (!firstSeparator) {\n colSep = buildCommon.makeSpan([\"arraycolsep\"], []);\n colSep.style.width = makeEm(options.fontMetrics().doubleRuleSep);\n cols.push(colSep);\n }\n\n if (colDescr.separator === \"|\" || colDescr.separator === \":\") {\n var lineType = colDescr.separator === \"|\" ? \"solid\" : \"dashed\";\n var separator = buildCommon.makeSpan([\"vertical-separator\"], [], options);\n separator.style.height = makeEm(totalHeight);\n separator.style.borderRightWidth = makeEm(ruleThickness);\n separator.style.borderRightStyle = lineType;\n separator.style.margin = \"0 \" + makeEm(-ruleThickness / 2);\n\n var _shift = totalHeight - offset;\n\n if (_shift) {\n separator.style.verticalAlign = makeEm(-_shift);\n }\n\n cols.push(separator);\n } else {\n throw new ParseError(\"Invalid separator type: \" + colDescr.separator);\n }\n\n colDescrNum++;\n colDescr = colDescriptions[colDescrNum] || {};\n firstSeparator = false;\n }\n\n if (c >= nc) {\n continue;\n }\n\n var sepwidth = void 0;\n\n if (c > 0 || group.hskipBeforeAndAfter) {\n sepwidth = utils.deflt(colDescr.pregap, arraycolsep);\n\n if (sepwidth !== 0) {\n colSep = buildCommon.makeSpan([\"arraycolsep\"], []);\n colSep.style.width = makeEm(sepwidth);\n cols.push(colSep);\n }\n }\n\n var col = [];\n\n for (r = 0; r < nr; ++r) {\n var row = body[r];\n var elem = row[c];\n\n if (!elem) {\n continue;\n }\n\n var _shift2 = row.pos - offset;\n\n elem.depth = row.depth;\n elem.height = row.height;\n col.push({\n type: \"elem\",\n elem: elem,\n shift: _shift2\n });\n }\n\n col = buildCommon.makeVList({\n positionType: \"individualShift\",\n children: col\n }, options);\n col = buildCommon.makeSpan([\"col-align-\" + (colDescr.align || \"c\")], [col]);\n cols.push(col);\n\n if (c < nc - 1 || group.hskipBeforeAndAfter) {\n sepwidth = utils.deflt(colDescr.postgap, arraycolsep);\n\n if (sepwidth !== 0) {\n colSep = buildCommon.makeSpan([\"arraycolsep\"], []);\n colSep.style.width = makeEm(sepwidth);\n cols.push(colSep);\n }\n }\n }\n\n body = buildCommon.makeSpan([\"mtable\"], cols); // Add \\hline(s), if any.\n\n if (hlines.length > 0) {\n var line = buildCommon.makeLineSpan(\"hline\", options, ruleThickness);\n var dashes = buildCommon.makeLineSpan(\"hdashline\", options, ruleThickness);\n var vListElems = [{\n type: \"elem\",\n elem: body,\n shift: 0\n }];\n\n while (hlines.length > 0) {\n var hline = hlines.pop();\n var lineShift = hline.pos - offset;\n\n if (hline.isDashed) {\n vListElems.push({\n type: \"elem\",\n elem: dashes,\n shift: lineShift\n });\n } else {\n vListElems.push({\n type: \"elem\",\n elem: line,\n shift: lineShift\n });\n }\n }\n\n body = buildCommon.makeVList({\n positionType: \"individualShift\",\n children: vListElems\n }, options);\n }\n\n if (tagSpans.length === 0) {\n return buildCommon.makeSpan([\"mord\"], [body], options);\n } else {\n var eqnNumCol = buildCommon.makeVList({\n positionType: \"individualShift\",\n children: tagSpans\n }, options);\n eqnNumCol = buildCommon.makeSpan([\"tag\"], [eqnNumCol], options);\n return buildCommon.makeFragment([body, eqnNumCol]);\n }\n};\n\nvar alignMap = {\n c: \"center \",\n l: \"left \",\n r: \"right \"\n};\n\nvar mathmlBuilder$5 = function mathmlBuilder(group, options) {\n var tbl = [];\n var glue = new mathMLTree.MathNode(\"mtd\", [], [\"mtr-glue\"]);\n var tag = new mathMLTree.MathNode(\"mtd\", [], [\"mml-eqn-num\"]);\n\n for (var i = 0; i < group.body.length; i++) {\n var rw = group.body[i];\n var row = [];\n\n for (var j = 0; j < rw.length; j++) {\n row.push(new mathMLTree.MathNode(\"mtd\", [buildGroup(rw[j], options)]));\n }\n\n if (group.tags && group.tags[i]) {\n row.unshift(glue);\n row.push(glue);\n\n if (group.leqno) {\n row.unshift(tag);\n } else {\n row.push(tag);\n }\n }\n\n tbl.push(new mathMLTree.MathNode(\"mtr\", row));\n }\n\n var table = new mathMLTree.MathNode(\"mtable\", tbl); // Set column alignment, row spacing, column spacing, and\n // array lines by setting attributes on the table element.\n // Set the row spacing. In MathML, we specify a gap distance.\n // We do not use rowGap[] because MathML automatically increases\n // cell height with the height/depth of the element content.\n // LaTeX \\arraystretch multiplies the row baseline-to-baseline distance.\n // We simulate this by adding (arraystretch - 1)em to the gap. This\n // does a reasonable job of adjusting arrays containing 1 em tall content.\n // The 0.16 and 0.09 values are found empirically. They produce an array\n // similar to LaTeX and in which content does not interfere with \\hlines.\n\n var gap = group.arraystretch === 0.5 ? 0.1 // {smallmatrix}, {subarray}\n : 0.16 + group.arraystretch - 1 + (group.addJot ? 0.09 : 0);\n table.setAttribute(\"rowspacing\", makeEm(gap)); // MathML table lines go only between cells.\n // To place a line on an edge we'll use , if necessary.\n\n var menclose = \"\";\n var align = \"\";\n\n if (group.cols && group.cols.length > 0) {\n // Find column alignment, column spacing, and vertical lines.\n var cols = group.cols;\n var columnLines = \"\";\n var prevTypeWasAlign = false;\n var iStart = 0;\n var iEnd = cols.length;\n\n if (cols[0].type === \"separator\") {\n menclose += \"top \";\n iStart = 1;\n }\n\n if (cols[cols.length - 1].type === \"separator\") {\n menclose += \"bottom \";\n iEnd -= 1;\n }\n\n for (var _i = iStart; _i < iEnd; _i++) {\n if (cols[_i].type === \"align\") {\n align += alignMap[cols[_i].align];\n\n if (prevTypeWasAlign) {\n columnLines += \"none \";\n }\n\n prevTypeWasAlign = true;\n } else if (cols[_i].type === \"separator\") {\n // MathML accepts only single lines between cells.\n // So we read only the first of consecutive separators.\n if (prevTypeWasAlign) {\n columnLines += cols[_i].separator === \"|\" ? \"solid \" : \"dashed \";\n prevTypeWasAlign = false;\n }\n }\n }\n\n table.setAttribute(\"columnalign\", align.trim());\n\n if (/[sd]/.test(columnLines)) {\n table.setAttribute(\"columnlines\", columnLines.trim());\n }\n } // Set column spacing.\n\n\n if (group.colSeparationType === \"align\") {\n var _cols = group.cols || [];\n\n var spacing = \"\";\n\n for (var _i2 = 1; _i2 < _cols.length; _i2++) {\n spacing += _i2 % 2 ? \"0em \" : \"1em \";\n }\n\n table.setAttribute(\"columnspacing\", spacing.trim());\n } else if (group.colSeparationType === \"alignat\" || group.colSeparationType === \"gather\") {\n table.setAttribute(\"columnspacing\", \"0em\");\n } else if (group.colSeparationType === \"small\") {\n table.setAttribute(\"columnspacing\", \"0.2778em\");\n } else if (group.colSeparationType === \"CD\") {\n table.setAttribute(\"columnspacing\", \"0.5em\");\n } else {\n table.setAttribute(\"columnspacing\", \"1em\");\n } // Address \\hline and \\hdashline\n\n\n var rowLines = \"\";\n var hlines = group.hLinesBeforeRow;\n menclose += hlines[0].length > 0 ? \"left \" : \"\";\n menclose += hlines[hlines.length - 1].length > 0 ? \"right \" : \"\";\n\n for (var _i3 = 1; _i3 < hlines.length - 1; _i3++) {\n rowLines += hlines[_i3].length === 0 ? \"none \" // MathML accepts only a single line between rows. Read one element.\n : hlines[_i3][0] ? \"dashed \" : \"solid \";\n }\n\n if (/[sd]/.test(rowLines)) {\n table.setAttribute(\"rowlines\", rowLines.trim());\n }\n\n if (menclose !== \"\") {\n table = new mathMLTree.MathNode(\"menclose\", [table]);\n table.setAttribute(\"notation\", menclose.trim());\n }\n\n if (group.arraystretch && group.arraystretch < 1) {\n // A small array. Wrap in scriptstyle so row gap is not too large.\n table = new mathMLTree.MathNode(\"mstyle\", [table]);\n table.setAttribute(\"scriptlevel\", \"1\");\n }\n\n return table;\n}; // Convenience function for align, align*, aligned, alignat, alignat*, alignedat.\n\n\nvar alignedHandler = function alignedHandler(context, args) {\n if (context.envName.indexOf(\"ed\") === -1) {\n validateAmsEnvironmentContext(context);\n }\n\n var cols = [];\n var separationType = context.envName.indexOf(\"at\") > -1 ? \"alignat\" : \"align\";\n var isSplit = context.envName === \"split\";\n var res = parseArray(context.parser, {\n cols,\n addJot: true,\n autoTag: isSplit ? undefined : getAutoTag(context.envName),\n emptySingleRow: true,\n colSeparationType: separationType,\n maxNumCols: isSplit ? 2 : undefined,\n leqno: context.parser.settings.leqno\n }, \"display\"); // Determining number of columns.\n // 1. If the first argument is given, we use it as a number of columns,\n // and makes sure that each row doesn't exceed that number.\n // 2. Otherwise, just count number of columns = maximum number\n // of cells in each row (\"aligned\" mode -- isAligned will be true).\n //\n // At the same time, prepend empty group {} at beginning of every second\n // cell in each row (starting with second cell) so that operators become\n // binary. This behavior is implemented in amsmath's \\start@aligned.\n\n var numMaths;\n var numCols = 0;\n var emptyGroup = {\n type: \"ordgroup\",\n mode: context.mode,\n body: []\n };\n\n if (args[0] && args[0].type === \"ordgroup\") {\n var arg0 = \"\";\n\n for (var i = 0; i < args[0].body.length; i++) {\n var textord = assertNodeType(args[0].body[i], \"textord\");\n arg0 += textord.text;\n }\n\n numMaths = Number(arg0);\n numCols = numMaths * 2;\n }\n\n var isAligned = !numCols;\n res.body.forEach(function (row) {\n for (var _i4 = 1; _i4 < row.length; _i4 += 2) {\n // Modify ordgroup node within styling node\n var styling = assertNodeType(row[_i4], \"styling\");\n var ordgroup = assertNodeType(styling.body[0], \"ordgroup\");\n ordgroup.body.unshift(emptyGroup);\n }\n\n if (!isAligned) {\n // Case 1\n var curMaths = row.length / 2;\n\n if (numMaths < curMaths) {\n throw new ParseError(\"Too many math in a row: \" + (\"expected \" + numMaths + \", but got \" + curMaths), row[0]);\n }\n } else if (numCols < row.length) {\n // Case 2\n numCols = row.length;\n }\n }); // Adjusting alignment.\n // In aligned mode, we add one \\qquad between columns;\n // otherwise we add nothing.\n\n for (var _i5 = 0; _i5 < numCols; ++_i5) {\n var align = \"r\";\n var pregap = 0;\n\n if (_i5 % 2 === 1) {\n align = \"l\";\n } else if (_i5 > 0 && isAligned) {\n // \"aligned\" mode.\n pregap = 1; // add one \\quad\n }\n\n cols[_i5] = {\n type: \"align\",\n align: align,\n pregap: pregap,\n postgap: 0\n };\n }\n\n res.colSeparationType = isAligned ? \"align\" : \"alignat\";\n return res;\n}; // Arrays are part of LaTeX, defined in lttab.dtx so its documentation\n// is part of the source2e.pdf file of LaTeX2e source documentation.\n// {darray} is an {array} environment where cells are set in \\displaystyle,\n// as defined in nccmath.sty.\n\n\ndefineEnvironment({\n type: \"array\",\n names: [\"array\", \"darray\"],\n props: {\n numArgs: 1\n },\n\n handler(context, args) {\n // Since no types are specified above, the two possibilities are\n // - The argument is wrapped in {} or [], in which case Parser's\n // parseGroup() returns an \"ordgroup\" wrapping some symbol node.\n // - The argument is a bare symbol node.\n var symNode = checkSymbolNodeType(args[0]);\n var colalign = symNode ? [args[0]] : assertNodeType(args[0], \"ordgroup\").body;\n var cols = colalign.map(function (nde) {\n var node = assertSymbolNodeType(nde);\n var ca = node.text;\n\n if (\"lcr\".indexOf(ca) !== -1) {\n return {\n type: \"align\",\n align: ca\n };\n } else if (ca === \"|\") {\n return {\n type: \"separator\",\n separator: \"|\"\n };\n } else if (ca === \":\") {\n return {\n type: \"separator\",\n separator: \":\"\n };\n }\n\n throw new ParseError(\"Unknown column alignment: \" + ca, nde);\n });\n var res = {\n cols,\n hskipBeforeAndAfter: true,\n // \\@preamble in lttab.dtx\n maxNumCols: cols.length\n };\n return parseArray(context.parser, res, dCellStyle(context.envName));\n },\n\n htmlBuilder: htmlBuilder$6,\n mathmlBuilder: mathmlBuilder$5\n}); // The matrix environments of amsmath builds on the array environment\n// of LaTeX, which is discussed above.\n// The mathtools package adds starred versions of the same environments.\n// These have an optional argument to choose left|center|right justification.\n\ndefineEnvironment({\n type: \"array\",\n names: [\"matrix\", \"pmatrix\", \"bmatrix\", \"Bmatrix\", \"vmatrix\", \"Vmatrix\", \"matrix*\", \"pmatrix*\", \"bmatrix*\", \"Bmatrix*\", \"vmatrix*\", \"Vmatrix*\"],\n props: {\n numArgs: 0\n },\n\n handler(context) {\n var delimiters = {\n \"matrix\": null,\n \"pmatrix\": [\"(\", \")\"],\n \"bmatrix\": [\"[\", \"]\"],\n \"Bmatrix\": [\"\\\\{\", \"\\\\}\"],\n \"vmatrix\": [\"|\", \"|\"],\n \"Vmatrix\": [\"\\\\Vert\", \"\\\\Vert\"]\n }[context.envName.replace(\"*\", \"\")]; // \\hskip -\\arraycolsep in amsmath\n\n var colAlign = \"c\";\n var payload = {\n hskipBeforeAndAfter: false,\n cols: [{\n type: \"align\",\n align: colAlign\n }]\n };\n\n if (context.envName.charAt(context.envName.length - 1) === \"*\") {\n // It's one of the mathtools starred functions.\n // Parse the optional alignment argument.\n var parser = context.parser;\n parser.consumeSpaces();\n\n if (parser.fetch().text === \"[\") {\n parser.consume();\n parser.consumeSpaces();\n colAlign = parser.fetch().text;\n\n if (\"lcr\".indexOf(colAlign) === -1) {\n throw new ParseError(\"Expected l or c or r\", parser.nextToken);\n }\n\n parser.consume();\n parser.consumeSpaces();\n parser.expect(\"]\");\n parser.consume();\n payload.cols = [{\n type: \"align\",\n align: colAlign\n }];\n }\n }\n\n var res = parseArray(context.parser, payload, dCellStyle(context.envName)); // Populate cols with the correct number of column alignment specs.\n\n var numCols = Math.max(0, ...res.body.map(row => row.length));\n res.cols = new Array(numCols).fill({\n type: \"align\",\n align: colAlign\n });\n return delimiters ? {\n type: \"leftright\",\n mode: context.mode,\n body: [res],\n left: delimiters[0],\n right: delimiters[1],\n rightColor: undefined // \\right uninfluenced by \\color in array\n\n } : res;\n },\n\n htmlBuilder: htmlBuilder$6,\n mathmlBuilder: mathmlBuilder$5\n});\ndefineEnvironment({\n type: \"array\",\n names: [\"smallmatrix\"],\n props: {\n numArgs: 0\n },\n\n handler(context) {\n var payload = {\n arraystretch: 0.5\n };\n var res = parseArray(context.parser, payload, \"script\");\n res.colSeparationType = \"small\";\n return res;\n },\n\n htmlBuilder: htmlBuilder$6,\n mathmlBuilder: mathmlBuilder$5\n});\ndefineEnvironment({\n type: \"array\",\n names: [\"subarray\"],\n props: {\n numArgs: 1\n },\n\n handler(context, args) {\n // Parsing of {subarray} is similar to {array}\n var symNode = checkSymbolNodeType(args[0]);\n var colalign = symNode ? [args[0]] : assertNodeType(args[0], \"ordgroup\").body;\n var cols = colalign.map(function (nde) {\n var node = assertSymbolNodeType(nde);\n var ca = node.text; // {subarray} only recognizes \"l\" & \"c\"\n\n if (\"lc\".indexOf(ca) !== -1) {\n return {\n type: \"align\",\n align: ca\n };\n }\n\n throw new ParseError(\"Unknown column alignment: \" + ca, nde);\n });\n\n if (cols.length > 1) {\n throw new ParseError(\"{subarray} can contain only one column\");\n }\n\n var res = {\n cols,\n hskipBeforeAndAfter: false,\n arraystretch: 0.5\n };\n res = parseArray(context.parser, res, \"script\");\n\n if (res.body.length > 0 && res.body[0].length > 1) {\n throw new ParseError(\"{subarray} can contain only one column\");\n }\n\n return res;\n },\n\n htmlBuilder: htmlBuilder$6,\n mathmlBuilder: mathmlBuilder$5\n}); // A cases environment (in amsmath.sty) is almost equivalent to\n// \\def\\arraystretch{1.2}%\n// \\left\\{\\begin{array}{@{}l@{\\quad}l@{}} \u2026 \\end{array}\\right.\n// {dcases} is a {cases} environment where cells are set in \\displaystyle,\n// as defined in mathtools.sty.\n// {rcases} is another mathtools environment. It's brace is on the right side.\n\ndefineEnvironment({\n type: \"array\",\n names: [\"cases\", \"dcases\", \"rcases\", \"drcases\"],\n props: {\n numArgs: 0\n },\n\n handler(context) {\n var payload = {\n arraystretch: 1.2,\n cols: [{\n type: \"align\",\n align: \"l\",\n pregap: 0,\n // TODO(kevinb) get the current style.\n // For now we use the metrics for TEXT style which is what we were\n // doing before. Before attempting to get the current style we\n // should look at TeX's behavior especially for \\over and matrices.\n postgap: 1.0\n /* 1em quad */\n\n }, {\n type: \"align\",\n align: \"l\",\n pregap: 0,\n postgap: 0\n }]\n };\n var res = parseArray(context.parser, payload, dCellStyle(context.envName));\n return {\n type: \"leftright\",\n mode: context.mode,\n body: [res],\n left: context.envName.indexOf(\"r\") > -1 ? \".\" : \"\\\\{\",\n right: context.envName.indexOf(\"r\") > -1 ? \"\\\\}\" : \".\",\n rightColor: undefined\n };\n },\n\n htmlBuilder: htmlBuilder$6,\n mathmlBuilder: mathmlBuilder$5\n}); // In the align environment, one uses ampersands, &, to specify number of\n// columns in each row, and to locate spacing between each column.\n// align gets automatic numbering. align* and aligned do not.\n// The alignedat environment can be used in math mode.\n// Note that we assume \\nomallineskiplimit to be zero,\n// so that \\strut@ is the same as \\strut.\n\ndefineEnvironment({\n type: \"array\",\n names: [\"align\", \"align*\", \"aligned\", \"split\"],\n props: {\n numArgs: 0\n },\n handler: alignedHandler,\n htmlBuilder: htmlBuilder$6,\n mathmlBuilder: mathmlBuilder$5\n}); // A gathered environment is like an array environment with one centered\n// column, but where rows are considered lines so get \\jot line spacing\n// and contents are set in \\displaystyle.\n\ndefineEnvironment({\n type: \"array\",\n names: [\"gathered\", \"gather\", \"gather*\"],\n props: {\n numArgs: 0\n },\n\n handler(context) {\n if (utils.contains([\"gather\", \"gather*\"], context.envName)) {\n validateAmsEnvironmentContext(context);\n }\n\n var res = {\n cols: [{\n type: \"align\",\n align: \"c\"\n }],\n addJot: true,\n colSeparationType: \"gather\",\n autoTag: getAutoTag(context.envName),\n emptySingleRow: true,\n leqno: context.parser.settings.leqno\n };\n return parseArray(context.parser, res, \"display\");\n },\n\n htmlBuilder: htmlBuilder$6,\n mathmlBuilder: mathmlBuilder$5\n}); // alignat environment is like an align environment, but one must explicitly\n// specify maximum number of columns in each row, and can adjust spacing between\n// each columns.\n\ndefineEnvironment({\n type: \"array\",\n names: [\"alignat\", \"alignat*\", \"alignedat\"],\n props: {\n numArgs: 1\n },\n handler: alignedHandler,\n htmlBuilder: htmlBuilder$6,\n mathmlBuilder: mathmlBuilder$5\n});\ndefineEnvironment({\n type: \"array\",\n names: [\"equation\", \"equation*\"],\n props: {\n numArgs: 0\n },\n\n handler(context) {\n validateAmsEnvironmentContext(context);\n var res = {\n autoTag: getAutoTag(context.envName),\n emptySingleRow: true,\n singleRow: true,\n maxNumCols: 1,\n leqno: context.parser.settings.leqno\n };\n return parseArray(context.parser, res, \"display\");\n },\n\n htmlBuilder: htmlBuilder$6,\n mathmlBuilder: mathmlBuilder$5\n});\ndefineEnvironment({\n type: \"array\",\n names: [\"CD\"],\n props: {\n numArgs: 0\n },\n\n handler(context) {\n validateAmsEnvironmentContext(context);\n return parseCD(context.parser);\n },\n\n htmlBuilder: htmlBuilder$6,\n mathmlBuilder: mathmlBuilder$5\n});\ndefineMacro(\"\\\\nonumber\", \"\\\\gdef\\\\@eqnsw{0}\");\ndefineMacro(\"\\\\notag\", \"\\\\nonumber\"); // Catch \\hline outside array environment\n\ndefineFunction({\n type: \"text\",\n // Doesn't matter what this is.\n names: [\"\\\\hline\", \"\\\\hdashline\"],\n props: {\n numArgs: 0,\n allowedInText: true,\n allowedInMath: true\n },\n\n handler(context, args) {\n throw new ParseError(context.funcName + \" valid only within array environment\");\n }\n\n});\n\nvar environments = _environments;\n\n// defineEnvironment definitions.\n\ndefineFunction({\n type: \"environment\",\n names: [\"\\\\begin\", \"\\\\end\"],\n props: {\n numArgs: 1,\n argTypes: [\"text\"]\n },\n\n handler(_ref, args) {\n var {\n parser,\n funcName\n } = _ref;\n var nameGroup = args[0];\n\n if (nameGroup.type !== \"ordgroup\") {\n throw new ParseError(\"Invalid environment name\", nameGroup);\n }\n\n var envName = \"\";\n\n for (var i = 0; i < nameGroup.body.length; ++i) {\n envName += assertNodeType(nameGroup.body[i], \"textord\").text;\n }\n\n if (funcName === \"\\\\begin\") {\n // begin...end is similar to left...right\n if (!environments.hasOwnProperty(envName)) {\n throw new ParseError(\"No such environment: \" + envName, nameGroup);\n } // Build the environment object. Arguments and other information will\n // be made available to the begin and end methods using properties.\n\n\n var env = environments[envName];\n var {\n args: _args,\n optArgs\n } = parser.parseArguments(\"\\\\begin{\" + envName + \"}\", env);\n var context = {\n mode: parser.mode,\n envName,\n parser\n };\n var result = env.handler(context, _args, optArgs);\n parser.expect(\"\\\\end\", false);\n var endNameToken = parser.nextToken;\n var end = assertNodeType(parser.parseFunction(), \"environment\");\n\n if (end.name !== envName) {\n throw new ParseError(\"Mismatch: \\\\begin{\" + envName + \"} matched by \\\\end{\" + end.name + \"}\", endNameToken);\n } // $FlowFixMe, \"environment\" handler returns an environment ParseNode\n\n\n return result;\n }\n\n return {\n type: \"environment\",\n mode: parser.mode,\n name: envName,\n nameGroup\n };\n }\n\n});\n\n// TODO(kevinb): implement \\\\sl and \\\\sc\n\nvar htmlBuilder$5 = (group, options) => {\n var font = group.font;\n var newOptions = options.withFont(font);\n return buildGroup$1(group.body, newOptions);\n};\n\nvar mathmlBuilder$4 = (group, options) => {\n var font = group.font;\n var newOptions = options.withFont(font);\n return buildGroup(group.body, newOptions);\n};\n\nvar fontAliases = {\n \"\\\\Bbb\": \"\\\\mathbb\",\n \"\\\\bold\": \"\\\\mathbf\",\n \"\\\\frak\": \"\\\\mathfrak\",\n \"\\\\bm\": \"\\\\boldsymbol\"\n};\ndefineFunction({\n type: \"font\",\n names: [// styles, except \\boldsymbol defined below\n \"\\\\mathrm\", \"\\\\mathit\", \"\\\\mathbf\", \"\\\\mathnormal\", // families\n \"\\\\mathbb\", \"\\\\mathcal\", \"\\\\mathfrak\", \"\\\\mathscr\", \"\\\\mathsf\", \"\\\\mathtt\", // aliases, except \\bm defined below\n \"\\\\Bbb\", \"\\\\bold\", \"\\\\frak\"],\n props: {\n numArgs: 1,\n allowedInArgument: true\n },\n handler: (_ref, args) => {\n var {\n parser,\n funcName\n } = _ref;\n var body = normalizeArgument(args[0]);\n var func = funcName;\n\n if (func in fontAliases) {\n func = fontAliases[func];\n }\n\n return {\n type: \"font\",\n mode: parser.mode,\n font: func.slice(1),\n body\n };\n },\n htmlBuilder: htmlBuilder$5,\n mathmlBuilder: mathmlBuilder$4\n});\ndefineFunction({\n type: \"mclass\",\n names: [\"\\\\boldsymbol\", \"\\\\bm\"],\n props: {\n numArgs: 1\n },\n handler: (_ref2, args) => {\n var {\n parser\n } = _ref2;\n var body = args[0];\n var isCharacterBox = utils.isCharacterBox(body); // amsbsy.sty's \\boldsymbol uses \\binrel spacing to inherit the\n // argument's bin|rel|ord status\n\n return {\n type: \"mclass\",\n mode: parser.mode,\n mclass: binrelClass(body),\n body: [{\n type: \"font\",\n mode: parser.mode,\n font: \"boldsymbol\",\n body\n }],\n isCharacterBox: isCharacterBox\n };\n }\n}); // Old font changing functions\n\ndefineFunction({\n type: \"font\",\n names: [\"\\\\rm\", \"\\\\sf\", \"\\\\tt\", \"\\\\bf\", \"\\\\it\", \"\\\\cal\"],\n props: {\n numArgs: 0,\n allowedInText: true\n },\n handler: (_ref3, args) => {\n var {\n parser,\n funcName,\n breakOnTokenText\n } = _ref3;\n var {\n mode\n } = parser;\n var body = parser.parseExpression(true, breakOnTokenText);\n var style = \"math\" + funcName.slice(1);\n return {\n type: \"font\",\n mode: mode,\n font: style,\n body: {\n type: \"ordgroup\",\n mode: parser.mode,\n body\n }\n };\n },\n htmlBuilder: htmlBuilder$5,\n mathmlBuilder: mathmlBuilder$4\n});\n\nvar adjustStyle = (size, originalStyle) => {\n // Figure out what style this fraction should be in based on the\n // function used\n var style = originalStyle;\n\n if (size === \"display\") {\n // Get display style as a default.\n // If incoming style is sub/sup, use style.text() to get correct size.\n style = style.id >= Style$1.SCRIPT.id ? style.text() : Style$1.DISPLAY;\n } else if (size === \"text\" && style.size === Style$1.DISPLAY.size) {\n // We're in a \\tfrac but incoming style is displaystyle, so:\n style = Style$1.TEXT;\n } else if (size === \"script\") {\n style = Style$1.SCRIPT;\n } else if (size === \"scriptscript\") {\n style = Style$1.SCRIPTSCRIPT;\n }\n\n return style;\n};\n\nvar htmlBuilder$4 = (group, options) => {\n // Fractions are handled in the TeXbook on pages 444-445, rules 15(a-e).\n var style = adjustStyle(group.size, options.style);\n var nstyle = style.fracNum();\n var dstyle = style.fracDen();\n var newOptions;\n newOptions = options.havingStyle(nstyle);\n var numerm = buildGroup$1(group.numer, newOptions, options);\n\n if (group.continued) {\n // \\cfrac inserts a \\strut into the numerator.\n // Get \\strut dimensions from TeXbook page 353.\n var hStrut = 8.5 / options.fontMetrics().ptPerEm;\n var dStrut = 3.5 / options.fontMetrics().ptPerEm;\n numerm.height = numerm.height < hStrut ? hStrut : numerm.height;\n numerm.depth = numerm.depth < dStrut ? dStrut : numerm.depth;\n }\n\n newOptions = options.havingStyle(dstyle);\n var denomm = buildGroup$1(group.denom, newOptions, options);\n var rule;\n var ruleWidth;\n var ruleSpacing;\n\n if (group.hasBarLine) {\n if (group.barSize) {\n ruleWidth = calculateSize(group.barSize, options);\n rule = buildCommon.makeLineSpan(\"frac-line\", options, ruleWidth);\n } else {\n rule = buildCommon.makeLineSpan(\"frac-line\", options);\n }\n\n ruleWidth = rule.height;\n ruleSpacing = rule.height;\n } else {\n rule = null;\n ruleWidth = 0;\n ruleSpacing = options.fontMetrics().defaultRuleThickness;\n } // Rule 15b\n\n\n var numShift;\n var clearance;\n var denomShift;\n\n if (style.size === Style$1.DISPLAY.size || group.size === \"display\") {\n numShift = options.fontMetrics().num1;\n\n if (ruleWidth > 0) {\n clearance = 3 * ruleSpacing;\n } else {\n clearance = 7 * ruleSpacing;\n }\n\n denomShift = options.fontMetrics().denom1;\n } else {\n if (ruleWidth > 0) {\n numShift = options.fontMetrics().num2;\n clearance = ruleSpacing;\n } else {\n numShift = options.fontMetrics().num3;\n clearance = 3 * ruleSpacing;\n }\n\n denomShift = options.fontMetrics().denom2;\n }\n\n var frac;\n\n if (!rule) {\n // Rule 15c\n var candidateClearance = numShift - numerm.depth - (denomm.height - denomShift);\n\n if (candidateClearance < clearance) {\n numShift += 0.5 * (clearance - candidateClearance);\n denomShift += 0.5 * (clearance - candidateClearance);\n }\n\n frac = buildCommon.makeVList({\n positionType: \"individualShift\",\n children: [{\n type: \"elem\",\n elem: denomm,\n shift: denomShift\n }, {\n type: \"elem\",\n elem: numerm,\n shift: -numShift\n }]\n }, options);\n } else {\n // Rule 15d\n var axisHeight = options.fontMetrics().axisHeight;\n\n if (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth) < clearance) {\n numShift += clearance - (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth));\n }\n\n if (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift) < clearance) {\n denomShift += clearance - (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift));\n }\n\n var midShift = -(axisHeight - 0.5 * ruleWidth);\n frac = buildCommon.makeVList({\n positionType: \"individualShift\",\n children: [{\n type: \"elem\",\n elem: denomm,\n shift: denomShift\n }, {\n type: \"elem\",\n elem: rule,\n shift: midShift\n }, {\n type: \"elem\",\n elem: numerm,\n shift: -numShift\n }]\n }, options);\n } // Since we manually change the style sometimes (with \\dfrac or \\tfrac),\n // account for the possible size change here.\n\n\n newOptions = options.havingStyle(style);\n frac.height *= newOptions.sizeMultiplier / options.sizeMultiplier;\n frac.depth *= newOptions.sizeMultiplier / options.sizeMultiplier; // Rule 15e\n\n var delimSize;\n\n if (style.size === Style$1.DISPLAY.size) {\n delimSize = options.fontMetrics().delim1;\n } else if (style.size === Style$1.SCRIPTSCRIPT.size) {\n delimSize = options.havingStyle(Style$1.SCRIPT).fontMetrics().delim2;\n } else {\n delimSize = options.fontMetrics().delim2;\n }\n\n var leftDelim;\n var rightDelim;\n\n if (group.leftDelim == null) {\n leftDelim = makeNullDelimiter(options, [\"mopen\"]);\n } else {\n leftDelim = delimiter.customSizedDelim(group.leftDelim, delimSize, true, options.havingStyle(style), group.mode, [\"mopen\"]);\n }\n\n if (group.continued) {\n rightDelim = buildCommon.makeSpan([]); // zero width for \\cfrac\n } else if (group.rightDelim == null) {\n rightDelim = makeNullDelimiter(options, [\"mclose\"]);\n } else {\n rightDelim = delimiter.customSizedDelim(group.rightDelim, delimSize, true, options.havingStyle(style), group.mode, [\"mclose\"]);\n }\n\n return buildCommon.makeSpan([\"mord\"].concat(newOptions.sizingClasses(options)), [leftDelim, buildCommon.makeSpan([\"mfrac\"], [frac]), rightDelim], options);\n};\n\nvar mathmlBuilder$3 = (group, options) => {\n var node = new mathMLTree.MathNode(\"mfrac\", [buildGroup(group.numer, options), buildGroup(group.denom, options)]);\n\n if (!group.hasBarLine) {\n node.setAttribute(\"linethickness\", \"0px\");\n } else if (group.barSize) {\n var ruleWidth = calculateSize(group.barSize, options);\n node.setAttribute(\"linethickness\", makeEm(ruleWidth));\n }\n\n var style = adjustStyle(group.size, options.style);\n\n if (style.size !== options.style.size) {\n node = new mathMLTree.MathNode(\"mstyle\", [node]);\n var isDisplay = style.size === Style$1.DISPLAY.size ? \"true\" : \"false\";\n node.setAttribute(\"displaystyle\", isDisplay);\n node.setAttribute(\"scriptlevel\", \"0\");\n }\n\n if (group.leftDelim != null || group.rightDelim != null) {\n var withDelims = [];\n\n if (group.leftDelim != null) {\n var leftOp = new mathMLTree.MathNode(\"mo\", [new mathMLTree.TextNode(group.leftDelim.replace(\"\\\\\", \"\"))]);\n leftOp.setAttribute(\"fence\", \"true\");\n withDelims.push(leftOp);\n }\n\n withDelims.push(node);\n\n if (group.rightDelim != null) {\n var rightOp = new mathMLTree.MathNode(\"mo\", [new mathMLTree.TextNode(group.rightDelim.replace(\"\\\\\", \"\"))]);\n rightOp.setAttribute(\"fence\", \"true\");\n withDelims.push(rightOp);\n }\n\n return makeRow(withDelims);\n }\n\n return node;\n};\n\ndefineFunction({\n type: \"genfrac\",\n names: [\"\\\\dfrac\", \"\\\\frac\", \"\\\\tfrac\", \"\\\\dbinom\", \"\\\\binom\", \"\\\\tbinom\", \"\\\\\\\\atopfrac\", // can\u2019t be entered directly\n \"\\\\\\\\bracefrac\", \"\\\\\\\\brackfrac\" // ditto\n ],\n props: {\n numArgs: 2,\n allowedInArgument: true\n },\n handler: (_ref, args) => {\n var {\n parser,\n funcName\n } = _ref;\n var numer = args[0];\n var denom = args[1];\n var hasBarLine;\n var leftDelim = null;\n var rightDelim = null;\n var size = \"auto\";\n\n switch (funcName) {\n case \"\\\\dfrac\":\n case \"\\\\frac\":\n case \"\\\\tfrac\":\n hasBarLine = true;\n break;\n\n case \"\\\\\\\\atopfrac\":\n hasBarLine = false;\n break;\n\n case \"\\\\dbinom\":\n case \"\\\\binom\":\n case \"\\\\tbinom\":\n hasBarLine = false;\n leftDelim = \"(\";\n rightDelim = \")\";\n break;\n\n case \"\\\\\\\\bracefrac\":\n hasBarLine = false;\n leftDelim = \"\\\\{\";\n rightDelim = \"\\\\}\";\n break;\n\n case \"\\\\\\\\brackfrac\":\n hasBarLine = false;\n leftDelim = \"[\";\n rightDelim = \"]\";\n break;\n\n default:\n throw new Error(\"Unrecognized genfrac command\");\n }\n\n switch (funcName) {\n case \"\\\\dfrac\":\n case \"\\\\dbinom\":\n size = \"display\";\n break;\n\n case \"\\\\tfrac\":\n case \"\\\\tbinom\":\n size = \"text\";\n break;\n }\n\n return {\n type: \"genfrac\",\n mode: parser.mode,\n continued: false,\n numer,\n denom,\n hasBarLine,\n leftDelim,\n rightDelim,\n size,\n barSize: null\n };\n },\n htmlBuilder: htmlBuilder$4,\n mathmlBuilder: mathmlBuilder$3\n});\ndefineFunction({\n type: \"genfrac\",\n names: [\"\\\\cfrac\"],\n props: {\n numArgs: 2\n },\n handler: (_ref2, args) => {\n var {\n parser,\n funcName\n } = _ref2;\n var numer = args[0];\n var denom = args[1];\n return {\n type: \"genfrac\",\n mode: parser.mode,\n continued: true,\n numer,\n denom,\n hasBarLine: true,\n leftDelim: null,\n rightDelim: null,\n size: \"display\",\n barSize: null\n };\n }\n}); // Infix generalized fractions -- these are not rendered directly, but replaced\n// immediately by one of the variants above.\n\ndefineFunction({\n type: \"infix\",\n names: [\"\\\\over\", \"\\\\choose\", \"\\\\atop\", \"\\\\brace\", \"\\\\brack\"],\n props: {\n numArgs: 0,\n infix: true\n },\n\n handler(_ref3) {\n var {\n parser,\n funcName,\n token\n } = _ref3;\n var replaceWith;\n\n switch (funcName) {\n case \"\\\\over\":\n replaceWith = \"\\\\frac\";\n break;\n\n case \"\\\\choose\":\n replaceWith = \"\\\\binom\";\n break;\n\n case \"\\\\atop\":\n replaceWith = \"\\\\\\\\atopfrac\";\n break;\n\n case \"\\\\brace\":\n replaceWith = \"\\\\\\\\bracefrac\";\n break;\n\n case \"\\\\brack\":\n replaceWith = \"\\\\\\\\brackfrac\";\n break;\n\n default:\n throw new Error(\"Unrecognized infix genfrac command\");\n }\n\n return {\n type: \"infix\",\n mode: parser.mode,\n replaceWith,\n token\n };\n }\n\n});\nvar stylArray = [\"display\", \"text\", \"script\", \"scriptscript\"];\n\nvar delimFromValue = function delimFromValue(delimString) {\n var delim = null;\n\n if (delimString.length > 0) {\n delim = delimString;\n delim = delim === \".\" ? null : delim;\n }\n\n return delim;\n};\n\ndefineFunction({\n type: \"genfrac\",\n names: [\"\\\\genfrac\"],\n props: {\n numArgs: 6,\n allowedInArgument: true,\n argTypes: [\"math\", \"math\", \"size\", \"text\", \"math\", \"math\"]\n },\n\n handler(_ref4, args) {\n var {\n parser\n } = _ref4;\n var numer = args[4];\n var denom = args[5]; // Look into the parse nodes to get the desired delimiters.\n\n var leftNode = normalizeArgument(args[0]);\n var leftDelim = leftNode.type === \"atom\" && leftNode.family === \"open\" ? delimFromValue(leftNode.text) : null;\n var rightNode = normalizeArgument(args[1]);\n var rightDelim = rightNode.type === \"atom\" && rightNode.family === \"close\" ? delimFromValue(rightNode.text) : null;\n var barNode = assertNodeType(args[2], \"size\");\n var hasBarLine;\n var barSize = null;\n\n if (barNode.isBlank) {\n // \\genfrac acts differently than \\above.\n // \\genfrac treats an empty size group as a signal to use a\n // standard bar size. \\above would see size = 0 and omit the bar.\n hasBarLine = true;\n } else {\n barSize = barNode.value;\n hasBarLine = barSize.number > 0;\n } // Find out if we want displaystyle, textstyle, etc.\n\n\n var size = \"auto\";\n var styl = args[3];\n\n if (styl.type === \"ordgroup\") {\n if (styl.body.length > 0) {\n var textOrd = assertNodeType(styl.body[0], \"textord\");\n size = stylArray[Number(textOrd.text)];\n }\n } else {\n styl = assertNodeType(styl, \"textord\");\n size = stylArray[Number(styl.text)];\n }\n\n return {\n type: \"genfrac\",\n mode: parser.mode,\n numer,\n denom,\n continued: false,\n hasBarLine,\n barSize,\n leftDelim,\n rightDelim,\n size\n };\n },\n\n htmlBuilder: htmlBuilder$4,\n mathmlBuilder: mathmlBuilder$3\n}); // \\above is an infix fraction that also defines a fraction bar size.\n\ndefineFunction({\n type: \"infix\",\n names: [\"\\\\above\"],\n props: {\n numArgs: 1,\n argTypes: [\"size\"],\n infix: true\n },\n\n handler(_ref5, args) {\n var {\n parser,\n funcName,\n token\n } = _ref5;\n return {\n type: \"infix\",\n mode: parser.mode,\n replaceWith: \"\\\\\\\\abovefrac\",\n size: assertNodeType(args[0], \"size\").value,\n token\n };\n }\n\n});\ndefineFunction({\n type: \"genfrac\",\n names: [\"\\\\\\\\abovefrac\"],\n props: {\n numArgs: 3,\n argTypes: [\"math\", \"size\", \"math\"]\n },\n handler: (_ref6, args) => {\n var {\n parser,\n funcName\n } = _ref6;\n var numer = args[0];\n var barSize = assert(assertNodeType(args[1], \"infix\").size);\n var denom = args[2];\n var hasBarLine = barSize.number > 0;\n return {\n type: \"genfrac\",\n mode: parser.mode,\n numer,\n denom,\n continued: false,\n hasBarLine,\n barSize,\n leftDelim: null,\n rightDelim: null,\n size: \"auto\"\n };\n },\n htmlBuilder: htmlBuilder$4,\n mathmlBuilder: mathmlBuilder$3\n});\n\n// NOTE: Unlike most `htmlBuilder`s, this one handles not only \"horizBrace\", but\n// also \"supsub\" since an over/underbrace can affect super/subscripting.\nvar htmlBuilder$3 = (grp, options) => {\n var style = options.style; // Pull out the `ParseNode<\"horizBrace\">` if `grp` is a \"supsub\" node.\n\n var supSubGroup;\n var group;\n\n if (grp.type === \"supsub\") {\n // Ref: LaTeX source2e: }}}}\\limits}\n // i.e. LaTeX treats the brace similar to an op and passes it\n // with \\limits, so we need to assign supsub style.\n supSubGroup = grp.sup ? buildGroup$1(grp.sup, options.havingStyle(style.sup()), options) : buildGroup$1(grp.sub, options.havingStyle(style.sub()), options);\n group = assertNodeType(grp.base, \"horizBrace\");\n } else {\n group = assertNodeType(grp, \"horizBrace\");\n } // Build the base group\n\n\n var body = buildGroup$1(group.base, options.havingBaseStyle(Style$1.DISPLAY)); // Create the stretchy element\n\n var braceBody = stretchy.svgSpan(group, options); // Generate the vlist, with the appropriate kerns \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n // This first vlist contains the content and the brace: equation\n\n var vlist;\n\n if (group.isOver) {\n vlist = buildCommon.makeVList({\n positionType: \"firstBaseline\",\n children: [{\n type: \"elem\",\n elem: body\n }, {\n type: \"kern\",\n size: 0.1\n }, {\n type: \"elem\",\n elem: braceBody\n }]\n }, options); // $FlowFixMe: Replace this with passing \"svg-align\" into makeVList.\n\n vlist.children[0].children[0].children[1].classes.push(\"svg-align\");\n } else {\n vlist = buildCommon.makeVList({\n positionType: \"bottom\",\n positionData: body.depth + 0.1 + braceBody.height,\n children: [{\n type: \"elem\",\n elem: braceBody\n }, {\n type: \"kern\",\n size: 0.1\n }, {\n type: \"elem\",\n elem: body\n }]\n }, options); // $FlowFixMe: Replace this with passing \"svg-align\" into makeVList.\n\n vlist.children[0].children[0].children[0].classes.push(\"svg-align\");\n }\n\n if (supSubGroup) {\n // To write the supsub, wrap the first vlist in another vlist:\n // They can't all go in the same vlist, because the note might be\n // wider than the equation. We want the equation to control the\n // brace width.\n // note long note long note\n // \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513 or \u250F\u2501\u2501\u2501\u2513 not \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n // equation eqn eqn\n var vSpan = buildCommon.makeSpan([\"mord\", group.isOver ? \"mover\" : \"munder\"], [vlist], options);\n\n if (group.isOver) {\n vlist = buildCommon.makeVList({\n positionType: \"firstBaseline\",\n children: [{\n type: \"elem\",\n elem: vSpan\n }, {\n type: \"kern\",\n size: 0.2\n }, {\n type: \"elem\",\n elem: supSubGroup\n }]\n }, options);\n } else {\n vlist = buildCommon.makeVList({\n positionType: \"bottom\",\n positionData: vSpan.depth + 0.2 + supSubGroup.height + supSubGroup.depth,\n children: [{\n type: \"elem\",\n elem: supSubGroup\n }, {\n type: \"kern\",\n size: 0.2\n }, {\n type: \"elem\",\n elem: vSpan\n }]\n }, options);\n }\n }\n\n return buildCommon.makeSpan([\"mord\", group.isOver ? \"mover\" : \"munder\"], [vlist], options);\n};\n\nvar mathmlBuilder$2 = (group, options) => {\n var accentNode = stretchy.mathMLnode(group.label);\n return new mathMLTree.MathNode(group.isOver ? \"mover\" : \"munder\", [buildGroup(group.base, options), accentNode]);\n}; // Horizontal stretchy braces\n\n\ndefineFunction({\n type: \"horizBrace\",\n names: [\"\\\\overbrace\", \"\\\\underbrace\"],\n props: {\n numArgs: 1\n },\n\n handler(_ref, args) {\n var {\n parser,\n funcName\n } = _ref;\n return {\n type: \"horizBrace\",\n mode: parser.mode,\n label: funcName,\n isOver: /^\\\\over/.test(funcName),\n base: args[0]\n };\n },\n\n htmlBuilder: htmlBuilder$3,\n mathmlBuilder: mathmlBuilder$2\n});\n\ndefineFunction({\n type: \"href\",\n names: [\"\\\\href\"],\n props: {\n numArgs: 2,\n argTypes: [\"url\", \"original\"],\n allowedInText: true\n },\n handler: (_ref, args) => {\n var {\n parser\n } = _ref;\n var body = args[1];\n var href = assertNodeType(args[0], \"url\").url;\n\n if (!parser.settings.isTrusted({\n command: \"\\\\href\",\n url: href\n })) {\n return parser.formatUnsupportedCmd(\"\\\\href\");\n }\n\n return {\n type: \"href\",\n mode: parser.mode,\n href,\n body: ordargument(body)\n };\n },\n htmlBuilder: (group, options) => {\n var elements = buildExpression$1(group.body, options, false);\n return buildCommon.makeAnchor(group.href, [], elements, options);\n },\n mathmlBuilder: (group, options) => {\n var math = buildExpressionRow(group.body, options);\n\n if (!(math instanceof MathNode)) {\n math = new MathNode(\"mrow\", [math]);\n }\n\n math.setAttribute(\"href\", group.href);\n return math;\n }\n});\ndefineFunction({\n type: \"href\",\n names: [\"\\\\url\"],\n props: {\n numArgs: 1,\n argTypes: [\"url\"],\n allowedInText: true\n },\n handler: (_ref2, args) => {\n var {\n parser\n } = _ref2;\n var href = assertNodeType(args[0], \"url\").url;\n\n if (!parser.settings.isTrusted({\n command: \"\\\\url\",\n url: href\n })) {\n return parser.formatUnsupportedCmd(\"\\\\url\");\n }\n\n var chars = [];\n\n for (var i = 0; i < href.length; i++) {\n var c = href[i];\n\n if (c === \"~\") {\n c = \"\\\\textasciitilde\";\n }\n\n chars.push({\n type: \"textord\",\n mode: \"text\",\n text: c\n });\n }\n\n var body = {\n type: \"text\",\n mode: parser.mode,\n font: \"\\\\texttt\",\n body: chars\n };\n return {\n type: \"href\",\n mode: parser.mode,\n href,\n body: ordargument(body)\n };\n }\n});\n\n// In LaTeX, \\vcenter can act only on a box, as in\n// \\vcenter{\\hbox{$\\frac{a+b}{\\dfrac{c}{d}}$}}\n// This function by itself doesn't do anything but prevent a soft line break.\n\ndefineFunction({\n type: \"hbox\",\n names: [\"\\\\hbox\"],\n props: {\n numArgs: 1,\n argTypes: [\"text\"],\n allowedInText: true,\n primitive: true\n },\n\n handler(_ref, args) {\n var {\n parser\n } = _ref;\n return {\n type: \"hbox\",\n mode: parser.mode,\n body: ordargument(args[0])\n };\n },\n\n htmlBuilder(group, options) {\n var elements = buildExpression$1(group.body, options, false);\n return buildCommon.makeFragment(elements);\n },\n\n mathmlBuilder(group, options) {\n return new mathMLTree.MathNode(\"mrow\", buildExpression(group.body, options));\n }\n\n});\n\ndefineFunction({\n type: \"html\",\n names: [\"\\\\htmlClass\", \"\\\\htmlId\", \"\\\\htmlStyle\", \"\\\\htmlData\"],\n props: {\n numArgs: 2,\n argTypes: [\"raw\", \"original\"],\n allowedInText: true\n },\n handler: (_ref, args) => {\n var {\n parser,\n funcName,\n token\n } = _ref;\n var value = assertNodeType(args[0], \"raw\").string;\n var body = args[1];\n\n if (parser.settings.strict) {\n parser.settings.reportNonstrict(\"htmlExtension\", \"HTML extension is disabled on strict mode\");\n }\n\n var trustContext;\n var attributes = {};\n\n switch (funcName) {\n case \"\\\\htmlClass\":\n attributes.class = value;\n trustContext = {\n command: \"\\\\htmlClass\",\n class: value\n };\n break;\n\n case \"\\\\htmlId\":\n attributes.id = value;\n trustContext = {\n command: \"\\\\htmlId\",\n id: value\n };\n break;\n\n case \"\\\\htmlStyle\":\n attributes.style = value;\n trustContext = {\n command: \"\\\\htmlStyle\",\n style: value\n };\n break;\n\n case \"\\\\htmlData\":\n {\n var data = value.split(\",\");\n\n for (var i = 0; i < data.length; i++) {\n var keyVal = data[i].split(\"=\");\n\n if (keyVal.length !== 2) {\n throw new ParseError(\"Error parsing key-value for \\\\htmlData\");\n }\n\n attributes[\"data-\" + keyVal[0].trim()] = keyVal[1].trim();\n }\n\n trustContext = {\n command: \"\\\\htmlData\",\n attributes\n };\n break;\n }\n\n default:\n throw new Error(\"Unrecognized html command\");\n }\n\n if (!parser.settings.isTrusted(trustContext)) {\n return parser.formatUnsupportedCmd(funcName);\n }\n\n return {\n type: \"html\",\n mode: parser.mode,\n attributes,\n body: ordargument(body)\n };\n },\n htmlBuilder: (group, options) => {\n var elements = buildExpression$1(group.body, options, false);\n var classes = [\"enclosing\"];\n\n if (group.attributes.class) {\n classes.push(...group.attributes.class.trim().split(/\\s+/));\n }\n\n var span = buildCommon.makeSpan(classes, elements, options);\n\n for (var attr in group.attributes) {\n if (attr !== \"class\" && group.attributes.hasOwnProperty(attr)) {\n span.setAttribute(attr, group.attributes[attr]);\n }\n }\n\n return span;\n },\n mathmlBuilder: (group, options) => {\n return buildExpressionRow(group.body, options);\n }\n});\n\ndefineFunction({\n type: \"htmlmathml\",\n names: [\"\\\\html@mathml\"],\n props: {\n numArgs: 2,\n allowedInText: true\n },\n handler: (_ref, args) => {\n var {\n parser\n } = _ref;\n return {\n type: \"htmlmathml\",\n mode: parser.mode,\n html: ordargument(args[0]),\n mathml: ordargument(args[1])\n };\n },\n htmlBuilder: (group, options) => {\n var elements = buildExpression$1(group.html, options, false);\n return buildCommon.makeFragment(elements);\n },\n mathmlBuilder: (group, options) => {\n return buildExpressionRow(group.mathml, options);\n }\n});\n\nvar sizeData = function sizeData(str) {\n if (/^[-+]? *(\\d+(\\.\\d*)?|\\.\\d+)$/.test(str)) {\n // str is a number with no unit specified.\n // default unit is bp, per graphix package.\n return {\n number: +str,\n unit: \"bp\"\n };\n } else {\n var match = /([-+]?) *(\\d+(?:\\.\\d*)?|\\.\\d+) *([a-z]{2})/.exec(str);\n\n if (!match) {\n throw new ParseError(\"Invalid size: '\" + str + \"' in \\\\includegraphics\");\n }\n\n var data = {\n number: +(match[1] + match[2]),\n // sign + magnitude, cast to number\n unit: match[3]\n };\n\n if (!validUnit(data)) {\n throw new ParseError(\"Invalid unit: '\" + data.unit + \"' in \\\\includegraphics.\");\n }\n\n return data;\n }\n};\n\ndefineFunction({\n type: \"includegraphics\",\n names: [\"\\\\includegraphics\"],\n props: {\n numArgs: 1,\n numOptionalArgs: 1,\n argTypes: [\"raw\", \"url\"],\n allowedInText: false\n },\n handler: (_ref, args, optArgs) => {\n var {\n parser\n } = _ref;\n var width = {\n number: 0,\n unit: \"em\"\n };\n var height = {\n number: 0.9,\n unit: \"em\"\n }; // sorta character sized.\n\n var totalheight = {\n number: 0,\n unit: \"em\"\n };\n var alt = \"\";\n\n if (optArgs[0]) {\n var attributeStr = assertNodeType(optArgs[0], \"raw\").string; // Parser.js does not parse key/value pairs. We get a string.\n\n var attributes = attributeStr.split(\",\");\n\n for (var i = 0; i < attributes.length; i++) {\n var keyVal = attributes[i].split(\"=\");\n\n if (keyVal.length === 2) {\n var str = keyVal[1].trim();\n\n switch (keyVal[0].trim()) {\n case \"alt\":\n alt = str;\n break;\n\n case \"width\":\n width = sizeData(str);\n break;\n\n case \"height\":\n height = sizeData(str);\n break;\n\n case \"totalheight\":\n totalheight = sizeData(str);\n break;\n\n default:\n throw new ParseError(\"Invalid key: '\" + keyVal[0] + \"' in \\\\includegraphics.\");\n }\n }\n }\n }\n\n var src = assertNodeType(args[0], \"url\").url;\n\n if (alt === \"\") {\n // No alt given. Use the file name. Strip away the path.\n alt = src;\n alt = alt.replace(/^.*[\\\\/]/, '');\n alt = alt.substring(0, alt.lastIndexOf('.'));\n }\n\n if (!parser.settings.isTrusted({\n command: \"\\\\includegraphics\",\n url: src\n })) {\n return parser.formatUnsupportedCmd(\"\\\\includegraphics\");\n }\n\n return {\n type: \"includegraphics\",\n mode: parser.mode,\n alt: alt,\n width: width,\n height: height,\n totalheight: totalheight,\n src: src\n };\n },\n htmlBuilder: (group, options) => {\n var height = calculateSize(group.height, options);\n var depth = 0;\n\n if (group.totalheight.number > 0) {\n depth = calculateSize(group.totalheight, options) - height;\n }\n\n var width = 0;\n\n if (group.width.number > 0) {\n width = calculateSize(group.width, options);\n }\n\n var style = {\n height: makeEm(height + depth)\n };\n\n if (width > 0) {\n style.width = makeEm(width);\n }\n\n if (depth > 0) {\n style.verticalAlign = makeEm(-depth);\n }\n\n var node = new Img(group.src, group.alt, style);\n node.height = height;\n node.depth = depth;\n return node;\n },\n mathmlBuilder: (group, options) => {\n var node = new mathMLTree.MathNode(\"mglyph\", []);\n node.setAttribute(\"alt\", group.alt);\n var height = calculateSize(group.height, options);\n var depth = 0;\n\n if (group.totalheight.number > 0) {\n depth = calculateSize(group.totalheight, options) - height;\n node.setAttribute(\"valign\", makeEm(-depth));\n }\n\n node.setAttribute(\"height\", makeEm(height + depth));\n\n if (group.width.number > 0) {\n var width = calculateSize(group.width, options);\n node.setAttribute(\"width\", makeEm(width));\n }\n\n node.setAttribute(\"src\", group.src);\n return node;\n }\n});\n\n// Horizontal spacing commands\n\ndefineFunction({\n type: \"kern\",\n names: [\"\\\\kern\", \"\\\\mkern\", \"\\\\hskip\", \"\\\\mskip\"],\n props: {\n numArgs: 1,\n argTypes: [\"size\"],\n primitive: true,\n allowedInText: true\n },\n\n handler(_ref, args) {\n var {\n parser,\n funcName\n } = _ref;\n var size = assertNodeType(args[0], \"size\");\n\n if (parser.settings.strict) {\n var mathFunction = funcName[1] === 'm'; // \\mkern, \\mskip\n\n var muUnit = size.value.unit === 'mu';\n\n if (mathFunction) {\n if (!muUnit) {\n parser.settings.reportNonstrict(\"mathVsTextUnits\", \"LaTeX's \" + funcName + \" supports only mu units, \" + (\"not \" + size.value.unit + \" units\"));\n }\n\n if (parser.mode !== \"math\") {\n parser.settings.reportNonstrict(\"mathVsTextUnits\", \"LaTeX's \" + funcName + \" works only in math mode\");\n }\n } else {\n // !mathFunction\n if (muUnit) {\n parser.settings.reportNonstrict(\"mathVsTextUnits\", \"LaTeX's \" + funcName + \" doesn't support mu units\");\n }\n }\n }\n\n return {\n type: \"kern\",\n mode: parser.mode,\n dimension: size.value\n };\n },\n\n htmlBuilder(group, options) {\n return buildCommon.makeGlue(group.dimension, options);\n },\n\n mathmlBuilder(group, options) {\n var dimension = calculateSize(group.dimension, options);\n return new mathMLTree.SpaceNode(dimension);\n }\n\n});\n\n// Horizontal overlap functions\ndefineFunction({\n type: \"lap\",\n names: [\"\\\\mathllap\", \"\\\\mathrlap\", \"\\\\mathclap\"],\n props: {\n numArgs: 1,\n allowedInText: true\n },\n handler: (_ref, args) => {\n var {\n parser,\n funcName\n } = _ref;\n var body = args[0];\n return {\n type: \"lap\",\n mode: parser.mode,\n alignment: funcName.slice(5),\n body\n };\n },\n htmlBuilder: (group, options) => {\n // mathllap, mathrlap, mathclap\n var inner;\n\n if (group.alignment === \"clap\") {\n // ref: https://www.math.lsu.edu/~aperlis/publications/mathclap/\n inner = buildCommon.makeSpan([], [buildGroup$1(group.body, options)]); // wrap, since CSS will center a .clap > .inner > span\n\n inner = buildCommon.makeSpan([\"inner\"], [inner], options);\n } else {\n inner = buildCommon.makeSpan([\"inner\"], [buildGroup$1(group.body, options)]);\n }\n\n var fix = buildCommon.makeSpan([\"fix\"], []);\n var node = buildCommon.makeSpan([group.alignment], [inner, fix], options); // At this point, we have correctly set horizontal alignment of the\n // two items involved in the lap.\n // Next, use a strut to set the height of the HTML bounding box.\n // Otherwise, a tall argument may be misplaced.\n // This code resolved issue #1153\n\n var strut = buildCommon.makeSpan([\"strut\"]);\n strut.style.height = makeEm(node.height + node.depth);\n\n if (node.depth) {\n strut.style.verticalAlign = makeEm(-node.depth);\n }\n\n node.children.unshift(strut); // Next, prevent vertical misplacement when next to something tall.\n // This code resolves issue #1234\n\n node = buildCommon.makeSpan([\"thinbox\"], [node], options);\n return buildCommon.makeSpan([\"mord\", \"vbox\"], [node], options);\n },\n mathmlBuilder: (group, options) => {\n // mathllap, mathrlap, mathclap\n var node = new mathMLTree.MathNode(\"mpadded\", [buildGroup(group.body, options)]);\n\n if (group.alignment !== \"rlap\") {\n var offset = group.alignment === \"llap\" ? \"-1\" : \"-0.5\";\n node.setAttribute(\"lspace\", offset + \"width\");\n }\n\n node.setAttribute(\"width\", \"0px\");\n return node;\n }\n});\n\ndefineFunction({\n type: \"styling\",\n names: [\"\\\\(\", \"$\"],\n props: {\n numArgs: 0,\n allowedInText: true,\n allowedInMath: false\n },\n\n handler(_ref, args) {\n var {\n funcName,\n parser\n } = _ref;\n var outerMode = parser.mode;\n parser.switchMode(\"math\");\n var close = funcName === \"\\\\(\" ? \"\\\\)\" : \"$\";\n var body = parser.parseExpression(false, close);\n parser.expect(close);\n parser.switchMode(outerMode);\n return {\n type: \"styling\",\n mode: parser.mode,\n style: \"text\",\n body\n };\n }\n\n}); // Check for extra closing math delimiters\n\ndefineFunction({\n type: \"text\",\n // Doesn't matter what this is.\n names: [\"\\\\)\", \"\\\\]\"],\n props: {\n numArgs: 0,\n allowedInText: true,\n allowedInMath: false\n },\n\n handler(context, args) {\n throw new ParseError(\"Mismatched \" + context.funcName);\n }\n\n});\n\nvar chooseMathStyle = (group, options) => {\n switch (options.style.size) {\n case Style$1.DISPLAY.size:\n return group.display;\n\n case Style$1.TEXT.size:\n return group.text;\n\n case Style$1.SCRIPT.size:\n return group.script;\n\n case Style$1.SCRIPTSCRIPT.size:\n return group.scriptscript;\n\n default:\n return group.text;\n }\n};\n\ndefineFunction({\n type: \"mathchoice\",\n names: [\"\\\\mathchoice\"],\n props: {\n numArgs: 4,\n primitive: true\n },\n handler: (_ref, args) => {\n var {\n parser\n } = _ref;\n return {\n type: \"mathchoice\",\n mode: parser.mode,\n display: ordargument(args[0]),\n text: ordargument(args[1]),\n script: ordargument(args[2]),\n scriptscript: ordargument(args[3])\n };\n },\n htmlBuilder: (group, options) => {\n var body = chooseMathStyle(group, options);\n var elements = buildExpression$1(body, options, false);\n return buildCommon.makeFragment(elements);\n },\n mathmlBuilder: (group, options) => {\n var body = chooseMathStyle(group, options);\n return buildExpressionRow(body, options);\n }\n});\n\nvar assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShift) => {\n base = buildCommon.makeSpan([], [base]);\n var subIsSingleCharacter = subGroup && utils.isCharacterBox(subGroup);\n var sub;\n var sup; // We manually have to handle the superscripts and subscripts. This,\n // aside from the kern calculations, is copied from supsub.\n\n if (supGroup) {\n var elem = buildGroup$1(supGroup, options.havingStyle(style.sup()), options);\n sup = {\n elem,\n kern: Math.max(options.fontMetrics().bigOpSpacing1, options.fontMetrics().bigOpSpacing3 - elem.depth)\n };\n }\n\n if (subGroup) {\n var _elem = buildGroup$1(subGroup, options.havingStyle(style.sub()), options);\n\n sub = {\n elem: _elem,\n kern: Math.max(options.fontMetrics().bigOpSpacing2, options.fontMetrics().bigOpSpacing4 - _elem.height)\n };\n } // Build the final group as a vlist of the possible subscript, base,\n // and possible superscript.\n\n\n var finalGroup;\n\n if (sup && sub) {\n var bottom = options.fontMetrics().bigOpSpacing5 + sub.elem.height + sub.elem.depth + sub.kern + base.depth + baseShift;\n finalGroup = buildCommon.makeVList({\n positionType: \"bottom\",\n positionData: bottom,\n children: [{\n type: \"kern\",\n size: options.fontMetrics().bigOpSpacing5\n }, {\n type: \"elem\",\n elem: sub.elem,\n marginLeft: makeEm(-slant)\n }, {\n type: \"kern\",\n size: sub.kern\n }, {\n type: \"elem\",\n elem: base\n }, {\n type: \"kern\",\n size: sup.kern\n }, {\n type: \"elem\",\n elem: sup.elem,\n marginLeft: makeEm(slant)\n }, {\n type: \"kern\",\n size: options.fontMetrics().bigOpSpacing5\n }]\n }, options);\n } else if (sub) {\n var top = base.height - baseShift; // Shift the limits by the slant of the symbol. Note\n // that we are supposed to shift the limits by 1/2 of the slant,\n // but since we are centering the limits adding a full slant of\n // margin will shift by 1/2 that.\n\n finalGroup = buildCommon.makeVList({\n positionType: \"top\",\n positionData: top,\n children: [{\n type: \"kern\",\n size: options.fontMetrics().bigOpSpacing5\n }, {\n type: \"elem\",\n elem: sub.elem,\n marginLeft: makeEm(-slant)\n }, {\n type: \"kern\",\n size: sub.kern\n }, {\n type: \"elem\",\n elem: base\n }]\n }, options);\n } else if (sup) {\n var _bottom = base.depth + baseShift;\n\n finalGroup = buildCommon.makeVList({\n positionType: \"bottom\",\n positionData: _bottom,\n children: [{\n type: \"elem\",\n elem: base\n }, {\n type: \"kern\",\n size: sup.kern\n }, {\n type: \"elem\",\n elem: sup.elem,\n marginLeft: makeEm(slant)\n }, {\n type: \"kern\",\n size: options.fontMetrics().bigOpSpacing5\n }]\n }, options);\n } else {\n // This case probably shouldn't occur (this would mean the\n // supsub was sending us a group with no superscript or\n // subscript) but be safe.\n return base;\n }\n\n var parts = [finalGroup];\n\n if (sub && slant !== 0 && !subIsSingleCharacter) {\n // A negative margin-left was applied to the lower limit.\n // Avoid an overlap by placing a spacer on the left on the group.\n var spacer = buildCommon.makeSpan([\"mspace\"], [], options);\n spacer.style.marginRight = makeEm(slant);\n parts.unshift(spacer);\n }\n\n return buildCommon.makeSpan([\"mop\", \"op-limits\"], parts, options);\n};\n\n// Limits, symbols\n// Most operators have a large successor symbol, but these don't.\nvar noSuccessor = [\"\\\\smallint\"]; // NOTE: Unlike most `htmlBuilder`s, this one handles not only \"op\", but also\n// \"supsub\" since some of them (like \\int) can affect super/subscripting.\n\nvar htmlBuilder$2 = (grp, options) => {\n // Operators are handled in the TeXbook pg. 443-444, rule 13(a).\n var supGroup;\n var subGroup;\n var hasLimits = false;\n var group;\n\n if (grp.type === \"supsub\") {\n // If we have limits, supsub will pass us its group to handle. Pull\n // out the superscript and subscript and set the group to the op in\n // its base.\n supGroup = grp.sup;\n subGroup = grp.sub;\n group = assertNodeType(grp.base, \"op\");\n hasLimits = true;\n } else {\n group = assertNodeType(grp, \"op\");\n }\n\n var style = options.style;\n var large = false;\n\n if (style.size === Style$1.DISPLAY.size && group.symbol && !utils.contains(noSuccessor, group.name)) {\n // Most symbol operators get larger in displaystyle (rule 13)\n large = true;\n }\n\n var base;\n\n if (group.symbol) {\n // If this is a symbol, create the symbol.\n var fontName = large ? \"Size2-Regular\" : \"Size1-Regular\";\n var stash = \"\";\n\n if (group.name === \"\\\\oiint\" || group.name === \"\\\\oiiint\") {\n // No font glyphs yet, so use a glyph w/o the oval.\n // TODO: When font glyphs are available, delete this code.\n stash = group.name.slice(1);\n group.name = stash === \"oiint\" ? \"\\\\iint\" : \"\\\\iiint\";\n }\n\n base = buildCommon.makeSymbol(group.name, fontName, \"math\", options, [\"mop\", \"op-symbol\", large ? \"large-op\" : \"small-op\"]);\n\n if (stash.length > 0) {\n // We're in \\oiint or \\oiiint. Overlay the oval.\n // TODO: When font glyphs are available, delete this code.\n var italic = base.italic;\n var oval = buildCommon.staticSvg(stash + \"Size\" + (large ? \"2\" : \"1\"), options);\n base = buildCommon.makeVList({\n positionType: \"individualShift\",\n children: [{\n type: \"elem\",\n elem: base,\n shift: 0\n }, {\n type: \"elem\",\n elem: oval,\n shift: large ? 0.08 : 0\n }]\n }, options);\n group.name = \"\\\\\" + stash;\n base.classes.unshift(\"mop\"); // $FlowFixMe\n\n base.italic = italic;\n }\n } else if (group.body) {\n // If this is a list, compose that list.\n var inner = buildExpression$1(group.body, options, true);\n\n if (inner.length === 1 && inner[0] instanceof SymbolNode) {\n base = inner[0];\n base.classes[0] = \"mop\"; // replace old mclass\n } else {\n base = buildCommon.makeSpan([\"mop\"], inner, options);\n }\n } else {\n // Otherwise, this is a text operator. Build the text from the\n // operator's name.\n var output = [];\n\n for (var i = 1; i < group.name.length; i++) {\n output.push(buildCommon.mathsym(group.name[i], group.mode, options));\n }\n\n base = buildCommon.makeSpan([\"mop\"], output, options);\n } // If content of op is a single symbol, shift it vertically.\n\n\n var baseShift = 0;\n var slant = 0;\n\n if ((base instanceof SymbolNode || group.name === \"\\\\oiint\" || group.name === \"\\\\oiiint\") && !group.suppressBaseShift) {\n // We suppress the shift of the base of \\overset and \\underset. Otherwise,\n // shift the symbol so its center lies on the axis (rule 13). It\n // appears that our fonts have the centers of the symbols already\n // almost on the axis, so these numbers are very small. Note we\n // don't actually apply this here, but instead it is used either in\n // the vlist creation or separately when there are no limits.\n baseShift = (base.height - base.depth) / 2 - options.fontMetrics().axisHeight; // The slant of the symbol is just its italic correction.\n // $FlowFixMe\n\n slant = base.italic;\n }\n\n if (hasLimits) {\n return assembleSupSub(base, supGroup, subGroup, options, style, slant, baseShift);\n } else {\n if (baseShift) {\n base.style.position = \"relative\";\n base.style.top = makeEm(baseShift);\n }\n\n return base;\n }\n};\n\nvar mathmlBuilder$1 = (group, options) => {\n var node;\n\n if (group.symbol) {\n // This is a symbol. Just add the symbol.\n node = new MathNode(\"mo\", [makeText(group.name, group.mode)]);\n\n if (utils.contains(noSuccessor, group.name)) {\n node.setAttribute(\"largeop\", \"false\");\n }\n } else if (group.body) {\n // This is an operator with children. Add them.\n node = new MathNode(\"mo\", buildExpression(group.body, options));\n } else {\n // This is a text operator. Add all of the characters from the\n // operator's name.\n node = new MathNode(\"mi\", [new TextNode(group.name.slice(1))]); // Append an ⁡ .\n // ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4\n\n var operator = new MathNode(\"mo\", [makeText(\"\\u2061\", \"text\")]);\n\n if (group.parentIsSupSub) {\n node = new MathNode(\"mrow\", [node, operator]);\n } else {\n node = newDocumentFragment([node, operator]);\n }\n }\n\n return node;\n};\n\nvar singleCharBigOps = {\n \"\\u220F\": \"\\\\prod\",\n \"\\u2210\": \"\\\\coprod\",\n \"\\u2211\": \"\\\\sum\",\n \"\\u22c0\": \"\\\\bigwedge\",\n \"\\u22c1\": \"\\\\bigvee\",\n \"\\u22c2\": \"\\\\bigcap\",\n \"\\u22c3\": \"\\\\bigcup\",\n \"\\u2a00\": \"\\\\bigodot\",\n \"\\u2a01\": \"\\\\bigoplus\",\n \"\\u2a02\": \"\\\\bigotimes\",\n \"\\u2a04\": \"\\\\biguplus\",\n \"\\u2a06\": \"\\\\bigsqcup\"\n};\ndefineFunction({\n type: \"op\",\n names: [\"\\\\coprod\", \"\\\\bigvee\", \"\\\\bigwedge\", \"\\\\biguplus\", \"\\\\bigcap\", \"\\\\bigcup\", \"\\\\intop\", \"\\\\prod\", \"\\\\sum\", \"\\\\bigotimes\", \"\\\\bigoplus\", \"\\\\bigodot\", \"\\\\bigsqcup\", \"\\\\smallint\", \"\\u220F\", \"\\u2210\", \"\\u2211\", \"\\u22c0\", \"\\u22c1\", \"\\u22c2\", \"\\u22c3\", \"\\u2a00\", \"\\u2a01\", \"\\u2a02\", \"\\u2a04\", \"\\u2a06\"],\n props: {\n numArgs: 0\n },\n handler: (_ref, args) => {\n var {\n parser,\n funcName\n } = _ref;\n var fName = funcName;\n\n if (fName.length === 1) {\n fName = singleCharBigOps[fName];\n }\n\n return {\n type: \"op\",\n mode: parser.mode,\n limits: true,\n parentIsSupSub: false,\n symbol: true,\n name: fName\n };\n },\n htmlBuilder: htmlBuilder$2,\n mathmlBuilder: mathmlBuilder$1\n}); // Note: calling defineFunction with a type that's already been defined only\n// works because the same htmlBuilder and mathmlBuilder are being used.\n\ndefineFunction({\n type: \"op\",\n names: [\"\\\\mathop\"],\n props: {\n numArgs: 1,\n primitive: true\n },\n handler: (_ref2, args) => {\n var {\n parser\n } = _ref2;\n var body = args[0];\n return {\n type: \"op\",\n mode: parser.mode,\n limits: false,\n parentIsSupSub: false,\n symbol: false,\n body: ordargument(body)\n };\n },\n htmlBuilder: htmlBuilder$2,\n mathmlBuilder: mathmlBuilder$1\n}); // There are 2 flags for operators; whether they produce limits in\n// displaystyle, and whether they are symbols and should grow in\n// displaystyle. These four groups cover the four possible choices.\n\nvar singleCharIntegrals = {\n \"\\u222b\": \"\\\\int\",\n \"\\u222c\": \"\\\\iint\",\n \"\\u222d\": \"\\\\iiint\",\n \"\\u222e\": \"\\\\oint\",\n \"\\u222f\": \"\\\\oiint\",\n \"\\u2230\": \"\\\\oiiint\"\n}; // No limits, not symbols\n\ndefineFunction({\n type: \"op\",\n names: [\"\\\\arcsin\", \"\\\\arccos\", \"\\\\arctan\", \"\\\\arctg\", \"\\\\arcctg\", \"\\\\arg\", \"\\\\ch\", \"\\\\cos\", \"\\\\cosec\", \"\\\\cosh\", \"\\\\cot\", \"\\\\cotg\", \"\\\\coth\", \"\\\\csc\", \"\\\\ctg\", \"\\\\cth\", \"\\\\deg\", \"\\\\dim\", \"\\\\exp\", \"\\\\hom\", \"\\\\ker\", \"\\\\lg\", \"\\\\ln\", \"\\\\log\", \"\\\\sec\", \"\\\\sin\", \"\\\\sinh\", \"\\\\sh\", \"\\\\tan\", \"\\\\tanh\", \"\\\\tg\", \"\\\\th\"],\n props: {\n numArgs: 0\n },\n\n handler(_ref3) {\n var {\n parser,\n funcName\n } = _ref3;\n return {\n type: \"op\",\n mode: parser.mode,\n limits: false,\n parentIsSupSub: false,\n symbol: false,\n name: funcName\n };\n },\n\n htmlBuilder: htmlBuilder$2,\n mathmlBuilder: mathmlBuilder$1\n}); // Limits, not symbols\n\ndefineFunction({\n type: \"op\",\n names: [\"\\\\det\", \"\\\\gcd\", \"\\\\inf\", \"\\\\lim\", \"\\\\max\", \"\\\\min\", \"\\\\Pr\", \"\\\\sup\"],\n props: {\n numArgs: 0\n },\n\n handler(_ref4) {\n var {\n parser,\n funcName\n } = _ref4;\n return {\n type: \"op\",\n mode: parser.mode,\n limits: true,\n parentIsSupSub: false,\n symbol: false,\n name: funcName\n };\n },\n\n htmlBuilder: htmlBuilder$2,\n mathmlBuilder: mathmlBuilder$1\n}); // No limits, symbols\n\ndefineFunction({\n type: \"op\",\n names: [\"\\\\int\", \"\\\\iint\", \"\\\\iiint\", \"\\\\oint\", \"\\\\oiint\", \"\\\\oiiint\", \"\\u222b\", \"\\u222c\", \"\\u222d\", \"\\u222e\", \"\\u222f\", \"\\u2230\"],\n props: {\n numArgs: 0\n },\n\n handler(_ref5) {\n var {\n parser,\n funcName\n } = _ref5;\n var fName = funcName;\n\n if (fName.length === 1) {\n fName = singleCharIntegrals[fName];\n }\n\n return {\n type: \"op\",\n mode: parser.mode,\n limits: false,\n parentIsSupSub: false,\n symbol: true,\n name: fName\n };\n },\n\n htmlBuilder: htmlBuilder$2,\n mathmlBuilder: mathmlBuilder$1\n});\n\n// NOTE: Unlike most `htmlBuilder`s, this one handles not only\n// \"operatorname\", but also \"supsub\" since \\operatorname* can\n// affect super/subscripting.\nvar htmlBuilder$1 = (grp, options) => {\n // Operators are handled in the TeXbook pg. 443-444, rule 13(a).\n var supGroup;\n var subGroup;\n var hasLimits = false;\n var group;\n\n if (grp.type === \"supsub\") {\n // If we have limits, supsub will pass us its group to handle. Pull\n // out the superscript and subscript and set the group to the op in\n // its base.\n supGroup = grp.sup;\n subGroup = grp.sub;\n group = assertNodeType(grp.base, \"operatorname\");\n hasLimits = true;\n } else {\n group = assertNodeType(grp, \"operatorname\");\n }\n\n var base;\n\n if (group.body.length > 0) {\n var body = group.body.map(child => {\n // $FlowFixMe: Check if the node has a string `text` property.\n var childText = child.text;\n\n if (typeof childText === \"string\") {\n return {\n type: \"textord\",\n mode: child.mode,\n text: childText\n };\n } else {\n return child;\n }\n }); // Consolidate function names into symbol characters.\n\n var expression = buildExpression$1(body, options.withFont(\"mathrm\"), true);\n\n for (var i = 0; i < expression.length; i++) {\n var child = expression[i];\n\n if (child instanceof SymbolNode) {\n // Per amsopn package,\n // change minus to hyphen and \\ast to asterisk\n child.text = child.text.replace(/\\u2212/, \"-\").replace(/\\u2217/, \"*\");\n }\n }\n\n base = buildCommon.makeSpan([\"mop\"], expression, options);\n } else {\n base = buildCommon.makeSpan([\"mop\"], [], options);\n }\n\n if (hasLimits) {\n return assembleSupSub(base, supGroup, subGroup, options, options.style, 0, 0);\n } else {\n return base;\n }\n};\n\nvar mathmlBuilder = (group, options) => {\n // The steps taken here are similar to the html version.\n var expression = buildExpression(group.body, options.withFont(\"mathrm\")); // Is expression a string or has it something like a fraction?\n\n var isAllString = true; // default\n\n for (var i = 0; i < expression.length; i++) {\n var node = expression[i];\n\n if (node instanceof mathMLTree.SpaceNode) ; else if (node instanceof mathMLTree.MathNode) {\n switch (node.type) {\n case \"mi\":\n case \"mn\":\n case \"ms\":\n case \"mspace\":\n case \"mtext\":\n break;\n // Do nothing yet.\n\n case \"mo\":\n {\n var child = node.children[0];\n\n if (node.children.length === 1 && child instanceof mathMLTree.TextNode) {\n child.text = child.text.replace(/\\u2212/, \"-\").replace(/\\u2217/, \"*\");\n } else {\n isAllString = false;\n }\n\n break;\n }\n\n default:\n isAllString = false;\n }\n } else {\n isAllString = false;\n }\n }\n\n if (isAllString) {\n // Write a single TextNode instead of multiple nested tags.\n var word = expression.map(node => node.toText()).join(\"\");\n expression = [new mathMLTree.TextNode(word)];\n }\n\n var identifier = new mathMLTree.MathNode(\"mi\", expression);\n identifier.setAttribute(\"mathvariant\", \"normal\"); // \\u2061 is the same as ⁡\n // ref: https://www.w3schools.com/charsets/ref_html_entities_a.asp\n\n var operator = new mathMLTree.MathNode(\"mo\", [makeText(\"\\u2061\", \"text\")]);\n\n if (group.parentIsSupSub) {\n return new mathMLTree.MathNode(\"mrow\", [identifier, operator]);\n } else {\n return mathMLTree.newDocumentFragment([identifier, operator]);\n }\n}; // \\operatorname\n// amsopn.dtx: \\mathop{#1\\kern\\z@\\operator@font#3}\\newmcodes@\n\n\ndefineFunction({\n type: \"operatorname\",\n names: [\"\\\\operatorname@\", \"\\\\operatornamewithlimits\"],\n props: {\n numArgs: 1\n },\n handler: (_ref, args) => {\n var {\n parser,\n funcName\n } = _ref;\n var body = args[0];\n return {\n type: \"operatorname\",\n mode: parser.mode,\n body: ordargument(body),\n alwaysHandleSupSub: funcName === \"\\\\operatornamewithlimits\",\n limits: false,\n parentIsSupSub: false\n };\n },\n htmlBuilder: htmlBuilder$1,\n mathmlBuilder\n});\ndefineMacro(\"\\\\operatorname\", \"\\\\@ifstar\\\\operatornamewithlimits\\\\operatorname@\");\n\ndefineFunctionBuilders({\n type: \"ordgroup\",\n\n htmlBuilder(group, options) {\n if (group.semisimple) {\n return buildCommon.makeFragment(buildExpression$1(group.body, options, false));\n }\n\n return buildCommon.makeSpan([\"mord\"], buildExpression$1(group.body, options, true), options);\n },\n\n mathmlBuilder(group, options) {\n return buildExpressionRow(group.body, options, true);\n }\n\n});\n\ndefineFunction({\n type: \"overline\",\n names: [\"\\\\overline\"],\n props: {\n numArgs: 1\n },\n\n handler(_ref, args) {\n var {\n parser\n } = _ref;\n var body = args[0];\n return {\n type: \"overline\",\n mode: parser.mode,\n body\n };\n },\n\n htmlBuilder(group, options) {\n // Overlines are handled in the TeXbook pg 443, Rule 9.\n // Build the inner group in the cramped style.\n var innerGroup = buildGroup$1(group.body, options.havingCrampedStyle()); // Create the line above the body\n\n var line = buildCommon.makeLineSpan(\"overline-line\", options); // Generate the vlist, with the appropriate kerns\n\n var defaultRuleThickness = options.fontMetrics().defaultRuleThickness;\n var vlist = buildCommon.makeVList({\n positionType: \"firstBaseline\",\n children: [{\n type: \"elem\",\n elem: innerGroup\n }, {\n type: \"kern\",\n size: 3 * defaultRuleThickness\n }, {\n type: \"elem\",\n elem: line\n }, {\n type: \"kern\",\n size: defaultRuleThickness\n }]\n }, options);\n return buildCommon.makeSpan([\"mord\", \"overline\"], [vlist], options);\n },\n\n mathmlBuilder(group, options) {\n var operator = new mathMLTree.MathNode(\"mo\", [new mathMLTree.TextNode(\"\\u203e\")]);\n operator.setAttribute(\"stretchy\", \"true\");\n var node = new mathMLTree.MathNode(\"mover\", [buildGroup(group.body, options), operator]);\n node.setAttribute(\"accent\", \"true\");\n return node;\n }\n\n});\n\ndefineFunction({\n type: \"phantom\",\n names: [\"\\\\phantom\"],\n props: {\n numArgs: 1,\n allowedInText: true\n },\n handler: (_ref, args) => {\n var {\n parser\n } = _ref;\n var body = args[0];\n return {\n type: \"phantom\",\n mode: parser.mode,\n body: ordargument(body)\n };\n },\n htmlBuilder: (group, options) => {\n var elements = buildExpression$1(group.body, options.withPhantom(), false); // \\phantom isn't supposed to affect the elements it contains.\n // See \"color\" for more details.\n\n return buildCommon.makeFragment(elements);\n },\n mathmlBuilder: (group, options) => {\n var inner = buildExpression(group.body, options);\n return new mathMLTree.MathNode(\"mphantom\", inner);\n }\n});\ndefineFunction({\n type: \"hphantom\",\n names: [\"\\\\hphantom\"],\n props: {\n numArgs: 1,\n allowedInText: true\n },\n handler: (_ref2, args) => {\n var {\n parser\n } = _ref2;\n var body = args[0];\n return {\n type: \"hphantom\",\n mode: parser.mode,\n body\n };\n },\n htmlBuilder: (group, options) => {\n var node = buildCommon.makeSpan([], [buildGroup$1(group.body, options.withPhantom())]);\n node.height = 0;\n node.depth = 0;\n\n if (node.children) {\n for (var i = 0; i < node.children.length; i++) {\n node.children[i].height = 0;\n node.children[i].depth = 0;\n }\n } // See smash for comment re: use of makeVList\n\n\n node = buildCommon.makeVList({\n positionType: \"firstBaseline\",\n children: [{\n type: \"elem\",\n elem: node\n }]\n }, options); // For spacing, TeX treats \\smash as a math group (same spacing as ord).\n\n return buildCommon.makeSpan([\"mord\"], [node], options);\n },\n mathmlBuilder: (group, options) => {\n var inner = buildExpression(ordargument(group.body), options);\n var phantom = new mathMLTree.MathNode(\"mphantom\", inner);\n var node = new mathMLTree.MathNode(\"mpadded\", [phantom]);\n node.setAttribute(\"height\", \"0px\");\n node.setAttribute(\"depth\", \"0px\");\n return node;\n }\n});\ndefineFunction({\n type: \"vphantom\",\n names: [\"\\\\vphantom\"],\n props: {\n numArgs: 1,\n allowedInText: true\n },\n handler: (_ref3, args) => {\n var {\n parser\n } = _ref3;\n var body = args[0];\n return {\n type: \"vphantom\",\n mode: parser.mode,\n body\n };\n },\n htmlBuilder: (group, options) => {\n var inner = buildCommon.makeSpan([\"inner\"], [buildGroup$1(group.body, options.withPhantom())]);\n var fix = buildCommon.makeSpan([\"fix\"], []);\n return buildCommon.makeSpan([\"mord\", \"rlap\"], [inner, fix], options);\n },\n mathmlBuilder: (group, options) => {\n var inner = buildExpression(ordargument(group.body), options);\n var phantom = new mathMLTree.MathNode(\"mphantom\", inner);\n var node = new mathMLTree.MathNode(\"mpadded\", [phantom]);\n node.setAttribute(\"width\", \"0px\");\n return node;\n }\n});\n\ndefineFunction({\n type: \"raisebox\",\n names: [\"\\\\raisebox\"],\n props: {\n numArgs: 2,\n argTypes: [\"size\", \"hbox\"],\n allowedInText: true\n },\n\n handler(_ref, args) {\n var {\n parser\n } = _ref;\n var amount = assertNodeType(args[0], \"size\").value;\n var body = args[1];\n return {\n type: \"raisebox\",\n mode: parser.mode,\n dy: amount,\n body\n };\n },\n\n htmlBuilder(group, options) {\n var body = buildGroup$1(group.body, options);\n var dy = calculateSize(group.dy, options);\n return buildCommon.makeVList({\n positionType: \"shift\",\n positionData: -dy,\n children: [{\n type: \"elem\",\n elem: body\n }]\n }, options);\n },\n\n mathmlBuilder(group, options) {\n var node = new mathMLTree.MathNode(\"mpadded\", [buildGroup(group.body, options)]);\n var dy = group.dy.number + group.dy.unit;\n node.setAttribute(\"voffset\", dy);\n return node;\n }\n\n});\n\ndefineFunction({\n type: \"internal\",\n names: [\"\\\\relax\"],\n props: {\n numArgs: 0,\n allowedInText: true\n },\n\n handler(_ref) {\n var {\n parser\n } = _ref;\n return {\n type: \"internal\",\n mode: parser.mode\n };\n }\n\n});\n\ndefineFunction({\n type: \"rule\",\n names: [\"\\\\rule\"],\n props: {\n numArgs: 2,\n numOptionalArgs: 1,\n argTypes: [\"size\", \"size\", \"size\"]\n },\n\n handler(_ref, args, optArgs) {\n var {\n parser\n } = _ref;\n var shift = optArgs[0];\n var width = assertNodeType(args[0], \"size\");\n var height = assertNodeType(args[1], \"size\");\n return {\n type: \"rule\",\n mode: parser.mode,\n shift: shift && assertNodeType(shift, \"size\").value,\n width: width.value,\n height: height.value\n };\n },\n\n htmlBuilder(group, options) {\n // Make an empty span for the rule\n var rule = buildCommon.makeSpan([\"mord\", \"rule\"], [], options); // Calculate the shift, width, and height of the rule, and account for units\n\n var width = calculateSize(group.width, options);\n var height = calculateSize(group.height, options);\n var shift = group.shift ? calculateSize(group.shift, options) : 0; // Style the rule to the right size\n\n rule.style.borderRightWidth = makeEm(width);\n rule.style.borderTopWidth = makeEm(height);\n rule.style.bottom = makeEm(shift); // Record the height and width\n\n rule.width = width;\n rule.height = height + shift;\n rule.depth = -shift; // Font size is the number large enough that the browser will\n // reserve at least `absHeight` space above the baseline.\n // The 1.125 factor was empirically determined\n\n rule.maxFontSize = height * 1.125 * options.sizeMultiplier;\n return rule;\n },\n\n mathmlBuilder(group, options) {\n var width = calculateSize(group.width, options);\n var height = calculateSize(group.height, options);\n var shift = group.shift ? calculateSize(group.shift, options) : 0;\n var color = options.color && options.getColor() || \"black\";\n var rule = new mathMLTree.MathNode(\"mspace\");\n rule.setAttribute(\"mathbackground\", color);\n rule.setAttribute(\"width\", makeEm(width));\n rule.setAttribute(\"height\", makeEm(height));\n var wrapper = new mathMLTree.MathNode(\"mpadded\", [rule]);\n\n if (shift >= 0) {\n wrapper.setAttribute(\"height\", makeEm(shift));\n } else {\n wrapper.setAttribute(\"height\", makeEm(shift));\n wrapper.setAttribute(\"depth\", makeEm(-shift));\n }\n\n wrapper.setAttribute(\"voffset\", makeEm(shift));\n return wrapper;\n }\n\n});\n\nfunction sizingGroup(value, options, baseOptions) {\n var inner = buildExpression$1(value, options, false);\n var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; // Add size-resetting classes to the inner list and set maxFontSize\n // manually. Handle nested size changes.\n\n for (var i = 0; i < inner.length; i++) {\n var pos = inner[i].classes.indexOf(\"sizing\");\n\n if (pos < 0) {\n Array.prototype.push.apply(inner[i].classes, options.sizingClasses(baseOptions));\n } else if (inner[i].classes[pos + 1] === \"reset-size\" + options.size) {\n // This is a nested size change: e.g., inner[i] is the \"b\" in\n // `\\Huge a \\small b`. Override the old size (the `reset-` class)\n // but not the new size.\n inner[i].classes[pos + 1] = \"reset-size\" + baseOptions.size;\n }\n\n inner[i].height *= multiplier;\n inner[i].depth *= multiplier;\n }\n\n return buildCommon.makeFragment(inner);\n}\nvar sizeFuncs = [\"\\\\tiny\", \"\\\\sixptsize\", \"\\\\scriptsize\", \"\\\\footnotesize\", \"\\\\small\", \"\\\\normalsize\", \"\\\\large\", \"\\\\Large\", \"\\\\LARGE\", \"\\\\huge\", \"\\\\Huge\"];\nvar htmlBuilder = (group, options) => {\n // Handle sizing operators like \\Huge. Real TeX doesn't actually allow\n // these functions inside of math expressions, so we do some special\n // handling.\n var newOptions = options.havingSize(group.size);\n return sizingGroup(group.body, newOptions, options);\n};\ndefineFunction({\n type: \"sizing\",\n names: sizeFuncs,\n props: {\n numArgs: 0,\n allowedInText: true\n },\n handler: (_ref, args) => {\n var {\n breakOnTokenText,\n funcName,\n parser\n } = _ref;\n var body = parser.parseExpression(false, breakOnTokenText);\n return {\n type: \"sizing\",\n mode: parser.mode,\n // Figure out what size to use based on the list of functions above\n size: sizeFuncs.indexOf(funcName) + 1,\n body\n };\n },\n htmlBuilder,\n mathmlBuilder: (group, options) => {\n var newOptions = options.havingSize(group.size);\n var inner = buildExpression(group.body, newOptions);\n var node = new mathMLTree.MathNode(\"mstyle\", inner); // TODO(emily): This doesn't produce the correct size for nested size\n // changes, because we don't keep state of what style we're currently\n // in, so we can't reset the size to normal before changing it. Now\n // that we're passing an options parameter we should be able to fix\n // this.\n\n node.setAttribute(\"mathsize\", makeEm(newOptions.sizeMultiplier));\n return node;\n }\n});\n\n// smash, with optional [tb], as in AMS\ndefineFunction({\n type: \"smash\",\n names: [\"\\\\smash\"],\n props: {\n numArgs: 1,\n numOptionalArgs: 1,\n allowedInText: true\n },\n handler: (_ref, args, optArgs) => {\n var {\n parser\n } = _ref;\n var smashHeight = false;\n var smashDepth = false;\n var tbArg = optArgs[0] && assertNodeType(optArgs[0], \"ordgroup\");\n\n if (tbArg) {\n // Optional [tb] argument is engaged.\n // ref: amsmath: \\renewcommand{\\smash}[1][tb]{%\n // def\\mb@t{\\ht}\\def\\mb@b{\\dp}\\def\\mb@tb{\\ht\\z@\\z@\\dp}%\n var letter = \"\";\n\n for (var i = 0; i < tbArg.body.length; ++i) {\n var node = tbArg.body[i]; // $FlowFixMe: Not every node type has a `text` property.\n\n letter = node.text;\n\n if (letter === \"t\") {\n smashHeight = true;\n } else if (letter === \"b\") {\n smashDepth = true;\n } else {\n smashHeight = false;\n smashDepth = false;\n break;\n }\n }\n } else {\n smashHeight = true;\n smashDepth = true;\n }\n\n var body = args[0];\n return {\n type: \"smash\",\n mode: parser.mode,\n body,\n smashHeight,\n smashDepth\n };\n },\n htmlBuilder: (group, options) => {\n var node = buildCommon.makeSpan([], [buildGroup$1(group.body, options)]);\n\n if (!group.smashHeight && !group.smashDepth) {\n return node;\n }\n\n if (group.smashHeight) {\n node.height = 0; // In order to influence makeVList, we have to reset the children.\n\n if (node.children) {\n for (var i = 0; i < node.children.length; i++) {\n node.children[i].height = 0;\n }\n }\n }\n\n if (group.smashDepth) {\n node.depth = 0;\n\n if (node.children) {\n for (var _i = 0; _i < node.children.length; _i++) {\n node.children[_i].depth = 0;\n }\n }\n } // At this point, we've reset the TeX-like height and depth values.\n // But the span still has an HTML line height.\n // makeVList applies \"display: table-cell\", which prevents the browser\n // from acting on that line height. So we'll call makeVList now.\n\n\n var smashedNode = buildCommon.makeVList({\n positionType: \"firstBaseline\",\n children: [{\n type: \"elem\",\n elem: node\n }]\n }, options); // For spacing, TeX treats \\hphantom as a math group (same spacing as ord).\n\n return buildCommon.makeSpan([\"mord\"], [smashedNode], options);\n },\n mathmlBuilder: (group, options) => {\n var node = new mathMLTree.MathNode(\"mpadded\", [buildGroup(group.body, options)]);\n\n if (group.smashHeight) {\n node.setAttribute(\"height\", \"0px\");\n }\n\n if (group.smashDepth) {\n node.setAttribute(\"depth\", \"0px\");\n }\n\n return node;\n }\n});\n\ndefineFunction({\n type: \"sqrt\",\n names: [\"\\\\sqrt\"],\n props: {\n numArgs: 1,\n numOptionalArgs: 1\n },\n\n handler(_ref, args, optArgs) {\n var {\n parser\n } = _ref;\n var index = optArgs[0];\n var body = args[0];\n return {\n type: \"sqrt\",\n mode: parser.mode,\n body,\n index\n };\n },\n\n htmlBuilder(group, options) {\n // Square roots are handled in the TeXbook pg. 443, Rule 11.\n // First, we do the same steps as in overline to build the inner group\n // and line\n var inner = buildGroup$1(group.body, options.havingCrampedStyle());\n\n if (inner.height === 0) {\n // Render a small surd.\n inner.height = options.fontMetrics().xHeight;\n } // Some groups can return document fragments. Handle those by wrapping\n // them in a span.\n\n\n inner = buildCommon.wrapFragment(inner, options); // Calculate the minimum size for the \\surd delimiter\n\n var metrics = options.fontMetrics();\n var theta = metrics.defaultRuleThickness;\n var phi = theta;\n\n if (options.style.id < Style$1.TEXT.id) {\n phi = options.fontMetrics().xHeight;\n } // Calculate the clearance between the body and line\n\n\n var lineClearance = theta + phi / 4;\n var minDelimiterHeight = inner.height + inner.depth + lineClearance + theta; // Create a sqrt SVG of the required minimum size\n\n var {\n span: img,\n ruleWidth,\n advanceWidth\n } = delimiter.sqrtImage(minDelimiterHeight, options);\n var delimDepth = img.height - ruleWidth; // Adjust the clearance based on the delimiter size\n\n if (delimDepth > inner.height + inner.depth + lineClearance) {\n lineClearance = (lineClearance + delimDepth - inner.height - inner.depth) / 2;\n } // Shift the sqrt image\n\n\n var imgShift = img.height - inner.height - lineClearance - ruleWidth;\n inner.style.paddingLeft = makeEm(advanceWidth); // Overlay the image and the argument.\n\n var body = buildCommon.makeVList({\n positionType: \"firstBaseline\",\n children: [{\n type: \"elem\",\n elem: inner,\n wrapperClasses: [\"svg-align\"]\n }, {\n type: \"kern\",\n size: -(inner.height + imgShift)\n }, {\n type: \"elem\",\n elem: img\n }, {\n type: \"kern\",\n size: ruleWidth\n }]\n }, options);\n\n if (!group.index) {\n return buildCommon.makeSpan([\"mord\", \"sqrt\"], [body], options);\n } else {\n // Handle the optional root index\n // The index is always in scriptscript style\n var newOptions = options.havingStyle(Style$1.SCRIPTSCRIPT);\n var rootm = buildGroup$1(group.index, newOptions, options); // The amount the index is shifted by. This is taken from the TeX\n // source, in the definition of `\\r@@t`.\n\n var toShift = 0.6 * (body.height - body.depth); // Build a VList with the superscript shifted up correctly\n\n var rootVList = buildCommon.makeVList({\n positionType: \"shift\",\n positionData: -toShift,\n children: [{\n type: \"elem\",\n elem: rootm\n }]\n }, options); // Add a class surrounding it so we can add on the appropriate\n // kerning\n\n var rootVListWrap = buildCommon.makeSpan([\"root\"], [rootVList]);\n return buildCommon.makeSpan([\"mord\", \"sqrt\"], [rootVListWrap, body], options);\n }\n },\n\n mathmlBuilder(group, options) {\n var {\n body,\n index\n } = group;\n return index ? new mathMLTree.MathNode(\"mroot\", [buildGroup(body, options), buildGroup(index, options)]) : new mathMLTree.MathNode(\"msqrt\", [buildGroup(body, options)]);\n }\n\n});\n\nvar styleMap = {\n \"display\": Style$1.DISPLAY,\n \"text\": Style$1.TEXT,\n \"script\": Style$1.SCRIPT,\n \"scriptscript\": Style$1.SCRIPTSCRIPT\n};\ndefineFunction({\n type: \"styling\",\n names: [\"\\\\displaystyle\", \"\\\\textstyle\", \"\\\\scriptstyle\", \"\\\\scriptscriptstyle\"],\n props: {\n numArgs: 0,\n allowedInText: true,\n primitive: true\n },\n\n handler(_ref, args) {\n var {\n breakOnTokenText,\n funcName,\n parser\n } = _ref;\n // parse out the implicit body\n var body = parser.parseExpression(true, breakOnTokenText); // TODO: Refactor to avoid duplicating styleMap in multiple places (e.g.\n // here and in buildHTML and de-dupe the enumeration of all the styles).\n // $FlowFixMe: The names above exactly match the styles.\n\n var style = funcName.slice(1, funcName.length - 5);\n return {\n type: \"styling\",\n mode: parser.mode,\n // Figure out what style to use by pulling out the style from\n // the function name\n style,\n body\n };\n },\n\n htmlBuilder(group, options) {\n // Style changes are handled in the TeXbook on pg. 442, Rule 3.\n var newStyle = styleMap[group.style];\n var newOptions = options.havingStyle(newStyle).withFont('');\n return sizingGroup(group.body, newOptions, options);\n },\n\n mathmlBuilder(group, options) {\n // Figure out what style we're changing to.\n var newStyle = styleMap[group.style];\n var newOptions = options.havingStyle(newStyle);\n var inner = buildExpression(group.body, newOptions);\n var node = new mathMLTree.MathNode(\"mstyle\", inner);\n var styleAttributes = {\n \"display\": [\"0\", \"true\"],\n \"text\": [\"0\", \"false\"],\n \"script\": [\"1\", \"false\"],\n \"scriptscript\": [\"2\", \"false\"]\n };\n var attr = styleAttributes[group.style];\n node.setAttribute(\"scriptlevel\", attr[0]);\n node.setAttribute(\"displaystyle\", attr[1]);\n return node;\n }\n\n});\n\n/**\n * Sometimes, groups perform special rules when they have superscripts or\n * subscripts attached to them. This function lets the `supsub` group know that\n * Sometimes, groups perform special rules when they have superscripts or\n * its inner element should handle the superscripts and subscripts instead of\n * handling them itself.\n */\nvar htmlBuilderDelegate = function htmlBuilderDelegate(group, options) {\n var base = group.base;\n\n if (!base) {\n return null;\n } else if (base.type === \"op\") {\n // Operators handle supsubs differently when they have limits\n // (e.g. `\\displaystyle\\sum_2^3`)\n var delegate = base.limits && (options.style.size === Style$1.DISPLAY.size || base.alwaysHandleSupSub);\n return delegate ? htmlBuilder$2 : null;\n } else if (base.type === \"operatorname\") {\n var _delegate = base.alwaysHandleSupSub && (options.style.size === Style$1.DISPLAY.size || base.limits);\n\n return _delegate ? htmlBuilder$1 : null;\n } else if (base.type === \"accent\") {\n return utils.isCharacterBox(base.base) ? htmlBuilder$a : null;\n } else if (base.type === \"horizBrace\") {\n var isSup = !group.sub;\n return isSup === base.isOver ? htmlBuilder$3 : null;\n } else {\n return null;\n }\n}; // Super scripts and subscripts, whose precise placement can depend on other\n// functions that precede them.\n\n\ndefineFunctionBuilders({\n type: \"supsub\",\n\n htmlBuilder(group, options) {\n // Superscript and subscripts are handled in the TeXbook on page\n // 445-446, rules 18(a-f).\n // Here is where we defer to the inner group if it should handle\n // superscripts and subscripts itself.\n var builderDelegate = htmlBuilderDelegate(group, options);\n\n if (builderDelegate) {\n return builderDelegate(group, options);\n }\n\n var {\n base: valueBase,\n sup: valueSup,\n sub: valueSub\n } = group;\n var base = buildGroup$1(valueBase, options);\n var supm;\n var subm;\n var metrics = options.fontMetrics(); // Rule 18a\n\n var supShift = 0;\n var subShift = 0;\n var isCharacterBox = valueBase && utils.isCharacterBox(valueBase);\n\n if (valueSup) {\n var newOptions = options.havingStyle(options.style.sup());\n supm = buildGroup$1(valueSup, newOptions, options);\n\n if (!isCharacterBox) {\n supShift = base.height - newOptions.fontMetrics().supDrop * newOptions.sizeMultiplier / options.sizeMultiplier;\n }\n }\n\n if (valueSub) {\n var _newOptions = options.havingStyle(options.style.sub());\n\n subm = buildGroup$1(valueSub, _newOptions, options);\n\n if (!isCharacterBox) {\n subShift = base.depth + _newOptions.fontMetrics().subDrop * _newOptions.sizeMultiplier / options.sizeMultiplier;\n }\n } // Rule 18c\n\n\n var minSupShift;\n\n if (options.style === Style$1.DISPLAY) {\n minSupShift = metrics.sup1;\n } else if (options.style.cramped) {\n minSupShift = metrics.sup3;\n } else {\n minSupShift = metrics.sup2;\n } // scriptspace is a font-size-independent size, so scale it\n // appropriately for use as the marginRight.\n\n\n var multiplier = options.sizeMultiplier;\n var marginRight = makeEm(0.5 / metrics.ptPerEm / multiplier);\n var marginLeft = null;\n\n if (subm) {\n // Subscripts shouldn't be shifted by the base's italic correction.\n // Account for that by shifting the subscript back the appropriate\n // amount. Note we only do this when the base is a single symbol.\n var isOiint = group.base && group.base.type === \"op\" && group.base.name && (group.base.name === \"\\\\oiint\" || group.base.name === \"\\\\oiiint\");\n\n if (base instanceof SymbolNode || isOiint) {\n // $FlowFixMe\n marginLeft = makeEm(-base.italic);\n }\n }\n\n var supsub;\n\n if (supm && subm) {\n supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight);\n subShift = Math.max(subShift, metrics.sub2);\n var ruleWidth = metrics.defaultRuleThickness; // Rule 18e\n\n var maxWidth = 4 * ruleWidth;\n\n if (supShift - supm.depth - (subm.height - subShift) < maxWidth) {\n subShift = maxWidth - (supShift - supm.depth) + subm.height;\n var psi = 0.8 * metrics.xHeight - (supShift - supm.depth);\n\n if (psi > 0) {\n supShift += psi;\n subShift -= psi;\n }\n }\n\n var vlistElem = [{\n type: \"elem\",\n elem: subm,\n shift: subShift,\n marginRight,\n marginLeft\n }, {\n type: \"elem\",\n elem: supm,\n shift: -supShift,\n marginRight\n }];\n supsub = buildCommon.makeVList({\n positionType: \"individualShift\",\n children: vlistElem\n }, options);\n } else if (subm) {\n // Rule 18b\n subShift = Math.max(subShift, metrics.sub1, subm.height - 0.8 * metrics.xHeight);\n var _vlistElem = [{\n type: \"elem\",\n elem: subm,\n marginLeft,\n marginRight\n }];\n supsub = buildCommon.makeVList({\n positionType: \"shift\",\n positionData: subShift,\n children: _vlistElem\n }, options);\n } else if (supm) {\n // Rule 18c, d\n supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight);\n supsub = buildCommon.makeVList({\n positionType: \"shift\",\n positionData: -supShift,\n children: [{\n type: \"elem\",\n elem: supm,\n marginRight\n }]\n }, options);\n } else {\n throw new Error(\"supsub must have either sup or sub.\");\n } // Wrap the supsub vlist in a span.msupsub to reset text-align.\n\n\n var mclass = getTypeOfDomTree(base, \"right\") || \"mord\";\n return buildCommon.makeSpan([mclass], [base, buildCommon.makeSpan([\"msupsub\"], [supsub])], options);\n },\n\n mathmlBuilder(group, options) {\n // Is the inner group a relevant horizonal brace?\n var isBrace = false;\n var isOver;\n var isSup;\n\n if (group.base && group.base.type === \"horizBrace\") {\n isSup = !!group.sup;\n\n if (isSup === group.base.isOver) {\n isBrace = true;\n isOver = group.base.isOver;\n }\n }\n\n if (group.base && (group.base.type === \"op\" || group.base.type === \"operatorname\")) {\n group.base.parentIsSupSub = true;\n }\n\n var children = [buildGroup(group.base, options)];\n\n if (group.sub) {\n children.push(buildGroup(group.sub, options));\n }\n\n if (group.sup) {\n children.push(buildGroup(group.sup, options));\n }\n\n var nodeType;\n\n if (isBrace) {\n nodeType = isOver ? \"mover\" : \"munder\";\n } else if (!group.sub) {\n var base = group.base;\n\n if (base && base.type === \"op\" && base.limits && (options.style === Style$1.DISPLAY || base.alwaysHandleSupSub)) {\n nodeType = \"mover\";\n } else if (base && base.type === \"operatorname\" && base.alwaysHandleSupSub && (base.limits || options.style === Style$1.DISPLAY)) {\n nodeType = \"mover\";\n } else {\n nodeType = \"msup\";\n }\n } else if (!group.sup) {\n var _base = group.base;\n\n if (_base && _base.type === \"op\" && _base.limits && (options.style === Style$1.DISPLAY || _base.alwaysHandleSupSub)) {\n nodeType = \"munder\";\n } else if (_base && _base.type === \"operatorname\" && _base.alwaysHandleSupSub && (_base.limits || options.style === Style$1.DISPLAY)) {\n nodeType = \"munder\";\n } else {\n nodeType = \"msub\";\n }\n } else {\n var _base2 = group.base;\n\n if (_base2 && _base2.type === \"op\" && _base2.limits && options.style === Style$1.DISPLAY) {\n nodeType = \"munderover\";\n } else if (_base2 && _base2.type === \"operatorname\" && _base2.alwaysHandleSupSub && (options.style === Style$1.DISPLAY || _base2.limits)) {\n nodeType = \"munderover\";\n } else {\n nodeType = \"msubsup\";\n }\n }\n\n return new mathMLTree.MathNode(nodeType, children);\n }\n\n});\n\ndefineFunctionBuilders({\n type: \"atom\",\n\n htmlBuilder(group, options) {\n return buildCommon.mathsym(group.text, group.mode, options, [\"m\" + group.family]);\n },\n\n mathmlBuilder(group, options) {\n var node = new mathMLTree.MathNode(\"mo\", [makeText(group.text, group.mode)]);\n\n if (group.family === \"bin\") {\n var variant = getVariant(group, options);\n\n if (variant === \"bold-italic\") {\n node.setAttribute(\"mathvariant\", variant);\n }\n } else if (group.family === \"punct\") {\n node.setAttribute(\"separator\", \"true\");\n } else if (group.family === \"open\" || group.family === \"close\") {\n // Delims built here should not stretch vertically.\n // See delimsizing.js for stretchy delims.\n node.setAttribute(\"stretchy\", \"false\");\n }\n\n return node;\n }\n\n});\n\n// \"mathord\" and \"textord\" ParseNodes created in Parser.js from symbol Groups in\n// src/symbols.js.\nvar defaultVariant = {\n \"mi\": \"italic\",\n \"mn\": \"normal\",\n \"mtext\": \"normal\"\n};\ndefineFunctionBuilders({\n type: \"mathord\",\n\n htmlBuilder(group, options) {\n return buildCommon.makeOrd(group, options, \"mathord\");\n },\n\n mathmlBuilder(group, options) {\n var node = new mathMLTree.MathNode(\"mi\", [makeText(group.text, group.mode, options)]);\n var variant = getVariant(group, options) || \"italic\";\n\n if (variant !== defaultVariant[node.type]) {\n node.setAttribute(\"mathvariant\", variant);\n }\n\n return node;\n }\n\n});\ndefineFunctionBuilders({\n type: \"textord\",\n\n htmlBuilder(group, options) {\n return buildCommon.makeOrd(group, options, \"textord\");\n },\n\n mathmlBuilder(group, options) {\n var text = makeText(group.text, group.mode, options);\n var variant = getVariant(group, options) || \"normal\";\n var node;\n\n if (group.mode === 'text') {\n node = new mathMLTree.MathNode(\"mtext\", [text]);\n } else if (/[0-9]/.test(group.text)) {\n node = new mathMLTree.MathNode(\"mn\", [text]);\n } else if (group.text === \"\\\\prime\") {\n node = new mathMLTree.MathNode(\"mo\", [text]);\n } else {\n node = new mathMLTree.MathNode(\"mi\", [text]);\n }\n\n if (variant !== defaultVariant[node.type]) {\n node.setAttribute(\"mathvariant\", variant);\n }\n\n return node;\n }\n\n});\n\nvar cssSpace = {\n \"\\\\nobreak\": \"nobreak\",\n \"\\\\allowbreak\": \"allowbreak\"\n}; // A lookup table to determine whether a spacing function/symbol should be\n// treated like a regular space character. If a symbol or command is a key\n// in this table, then it should be a regular space character. Furthermore,\n// the associated value may have a `className` specifying an extra CSS class\n// to add to the created `span`.\n\nvar regularSpace = {\n \" \": {},\n \"\\\\ \": {},\n \"~\": {\n className: \"nobreak\"\n },\n \"\\\\space\": {},\n \"\\\\nobreakspace\": {\n className: \"nobreak\"\n }\n}; // ParseNode<\"spacing\"> created in Parser.js from the \"spacing\" symbol Groups in\n// src/symbols.js.\n\ndefineFunctionBuilders({\n type: \"spacing\",\n\n htmlBuilder(group, options) {\n if (regularSpace.hasOwnProperty(group.text)) {\n var className = regularSpace[group.text].className || \"\"; // Spaces are generated by adding an actual space. Each of these\n // things has an entry in the symbols table, so these will be turned\n // into appropriate outputs.\n\n if (group.mode === \"text\") {\n var ord = buildCommon.makeOrd(group, options, \"textord\");\n ord.classes.push(className);\n return ord;\n } else {\n return buildCommon.makeSpan([\"mspace\", className], [buildCommon.mathsym(group.text, group.mode, options)], options);\n }\n } else if (cssSpace.hasOwnProperty(group.text)) {\n // Spaces based on just a CSS class.\n return buildCommon.makeSpan([\"mspace\", cssSpace[group.text]], [], options);\n } else {\n throw new ParseError(\"Unknown type of space \\\"\" + group.text + \"\\\"\");\n }\n },\n\n mathmlBuilder(group, options) {\n var node;\n\n if (regularSpace.hasOwnProperty(group.text)) {\n node = new mathMLTree.MathNode(\"mtext\", [new mathMLTree.TextNode(\"\\u00a0\")]);\n } else if (cssSpace.hasOwnProperty(group.text)) {\n // CSS-based MathML spaces (\\nobreak, \\allowbreak) are ignored\n return new mathMLTree.MathNode(\"mspace\");\n } else {\n throw new ParseError(\"Unknown type of space \\\"\" + group.text + \"\\\"\");\n }\n\n return node;\n }\n\n});\n\nvar pad = () => {\n var padNode = new mathMLTree.MathNode(\"mtd\", []);\n padNode.setAttribute(\"width\", \"50%\");\n return padNode;\n};\n\ndefineFunctionBuilders({\n type: \"tag\",\n\n mathmlBuilder(group, options) {\n var table = new mathMLTree.MathNode(\"mtable\", [new mathMLTree.MathNode(\"mtr\", [pad(), new mathMLTree.MathNode(\"mtd\", [buildExpressionRow(group.body, options)]), pad(), new mathMLTree.MathNode(\"mtd\", [buildExpressionRow(group.tag, options)])])]);\n table.setAttribute(\"width\", \"100%\");\n return table; // TODO: Left-aligned tags.\n // Currently, the group and options passed here do not contain\n // enough info to set tag alignment. `leqno` is in Settings but it is\n // not passed to Options. On the HTML side, leqno is\n // set by a CSS class applied in buildTree.js. That would have worked\n // in MathML if browsers supported . Since they don't, we\n // need to rewrite the way this function is called.\n }\n\n});\n\nvar textFontFamilies = {\n \"\\\\text\": undefined,\n \"\\\\textrm\": \"textrm\",\n \"\\\\textsf\": \"textsf\",\n \"\\\\texttt\": \"texttt\",\n \"\\\\textnormal\": \"textrm\"\n};\nvar textFontWeights = {\n \"\\\\textbf\": \"textbf\",\n \"\\\\textmd\": \"textmd\"\n};\nvar textFontShapes = {\n \"\\\\textit\": \"textit\",\n \"\\\\textup\": \"textup\"\n};\n\nvar optionsWithFont = (group, options) => {\n var font = group.font; // Checks if the argument is a font family or a font style.\n\n if (!font) {\n return options;\n } else if (textFontFamilies[font]) {\n return options.withTextFontFamily(textFontFamilies[font]);\n } else if (textFontWeights[font]) {\n return options.withTextFontWeight(textFontWeights[font]);\n } else if (font === \"\\\\emph\") {\n return options.fontShape === \"textit\" ? options.withTextFontShape(\"textup\") : options.withTextFontShape(\"textit\");\n }\n\n return options.withTextFontShape(textFontShapes[font]);\n};\n\ndefineFunction({\n type: \"text\",\n names: [// Font families\n \"\\\\text\", \"\\\\textrm\", \"\\\\textsf\", \"\\\\texttt\", \"\\\\textnormal\", // Font weights\n \"\\\\textbf\", \"\\\\textmd\", // Font Shapes\n \"\\\\textit\", \"\\\\textup\", \"\\\\emph\"],\n props: {\n numArgs: 1,\n argTypes: [\"text\"],\n allowedInArgument: true,\n allowedInText: true\n },\n\n handler(_ref, args) {\n var {\n parser,\n funcName\n } = _ref;\n var body = args[0];\n return {\n type: \"text\",\n mode: parser.mode,\n body: ordargument(body),\n font: funcName\n };\n },\n\n htmlBuilder(group, options) {\n var newOptions = optionsWithFont(group, options);\n var inner = buildExpression$1(group.body, newOptions, true);\n return buildCommon.makeSpan([\"mord\", \"text\"], inner, newOptions);\n },\n\n mathmlBuilder(group, options) {\n var newOptions = optionsWithFont(group, options);\n return buildExpressionRow(group.body, newOptions);\n }\n\n});\n\ndefineFunction({\n type: \"underline\",\n names: [\"\\\\underline\"],\n props: {\n numArgs: 1,\n allowedInText: true\n },\n\n handler(_ref, args) {\n var {\n parser\n } = _ref;\n return {\n type: \"underline\",\n mode: parser.mode,\n body: args[0]\n };\n },\n\n htmlBuilder(group, options) {\n // Underlines are handled in the TeXbook pg 443, Rule 10.\n // Build the inner group.\n var innerGroup = buildGroup$1(group.body, options); // Create the line to go below the body\n\n var line = buildCommon.makeLineSpan(\"underline-line\", options); // Generate the vlist, with the appropriate kerns\n\n var defaultRuleThickness = options.fontMetrics().defaultRuleThickness;\n var vlist = buildCommon.makeVList({\n positionType: \"top\",\n positionData: innerGroup.height,\n children: [{\n type: \"kern\",\n size: defaultRuleThickness\n }, {\n type: \"elem\",\n elem: line\n }, {\n type: \"kern\",\n size: 3 * defaultRuleThickness\n }, {\n type: \"elem\",\n elem: innerGroup\n }]\n }, options);\n return buildCommon.makeSpan([\"mord\", \"underline\"], [vlist], options);\n },\n\n mathmlBuilder(group, options) {\n var operator = new mathMLTree.MathNode(\"mo\", [new mathMLTree.TextNode(\"\\u203e\")]);\n operator.setAttribute(\"stretchy\", \"true\");\n var node = new mathMLTree.MathNode(\"munder\", [buildGroup(group.body, options), operator]);\n node.setAttribute(\"accentunder\", \"true\");\n return node;\n }\n\n});\n\ndefineFunction({\n type: \"vcenter\",\n names: [\"\\\\vcenter\"],\n props: {\n numArgs: 1,\n argTypes: [\"original\"],\n // In LaTeX, \\vcenter can act only on a box.\n allowedInText: false\n },\n\n handler(_ref, args) {\n var {\n parser\n } = _ref;\n return {\n type: \"vcenter\",\n mode: parser.mode,\n body: args[0]\n };\n },\n\n htmlBuilder(group, options) {\n var body = buildGroup$1(group.body, options);\n var axisHeight = options.fontMetrics().axisHeight;\n var dy = 0.5 * (body.height - axisHeight - (body.depth + axisHeight));\n return buildCommon.makeVList({\n positionType: \"shift\",\n positionData: dy,\n children: [{\n type: \"elem\",\n elem: body\n }]\n }, options);\n },\n\n mathmlBuilder(group, options) {\n // There is no way to do this in MathML.\n // Write a class as a breadcrumb in case some post-processor wants\n // to perform a vcenter adjustment.\n return new mathMLTree.MathNode(\"mpadded\", [buildGroup(group.body, options)], [\"vcenter\"]);\n }\n\n});\n\ndefineFunction({\n type: \"verb\",\n names: [\"\\\\verb\"],\n props: {\n numArgs: 0,\n allowedInText: true\n },\n\n handler(context, args, optArgs) {\n // \\verb and \\verb* are dealt with directly in Parser.js.\n // If we end up here, it's because of a failure to match the two delimiters\n // in the regex in Lexer.js. LaTeX raises the following error when \\verb is\n // terminated by end of line (or file).\n throw new ParseError(\"\\\\verb ended by end of line instead of matching delimiter\");\n },\n\n htmlBuilder(group, options) {\n var text = makeVerb(group);\n var body = []; // \\verb enters text mode and therefore is sized like \\textstyle\n\n var newOptions = options.havingStyle(options.style.text());\n\n for (var i = 0; i < text.length; i++) {\n var c = text[i];\n\n if (c === '~') {\n c = '\\\\textasciitilde';\n }\n\n body.push(buildCommon.makeSymbol(c, \"Typewriter-Regular\", group.mode, newOptions, [\"mord\", \"texttt\"]));\n }\n\n return buildCommon.makeSpan([\"mord\", \"text\"].concat(newOptions.sizingClasses(options)), buildCommon.tryCombineChars(body), newOptions);\n },\n\n mathmlBuilder(group, options) {\n var text = new mathMLTree.TextNode(makeVerb(group));\n var node = new mathMLTree.MathNode(\"mtext\", [text]);\n node.setAttribute(\"mathvariant\", \"monospace\");\n return node;\n }\n\n});\n/**\n * Converts verb group into body string.\n *\n * \\verb* replaces each space with an open box \\u2423\n * \\verb replaces each space with a no-break space \\xA0\n */\n\nvar makeVerb = group => group.body.replace(/ /g, group.star ? '\\u2423' : '\\xA0');\n\n/** Include this to ensure that all functions are defined. */\nvar functions = _functions;\n\n/**\n * The Lexer class handles tokenizing the input in various ways. Since our\n * parser expects us to be able to backtrack, the lexer allows lexing from any\n * given starting point.\n *\n * Its main exposed function is the `lex` function, which takes a position to\n * lex from and a type of token to lex. It defers to the appropriate `_innerLex`\n * function.\n *\n * The various `_innerLex` functions perform the actual lexing of different\n * kinds.\n */\n\n/* The following tokenRegex\n * - matches typical whitespace (but not NBSP etc.) using its first group\n * - does not match any control character \\x00-\\x1f except whitespace\n * - does not match a bare backslash\n * - matches any ASCII character except those just mentioned\n * - does not match the BMP private use area \\uE000-\\uF8FF\n * - does not match bare surrogate code units\n * - matches any BMP character except for those just described\n * - matches any valid Unicode surrogate pair\n * - matches a backslash followed by one or more whitespace characters\n * - matches a backslash followed by one or more letters then whitespace\n * - matches a backslash followed by any BMP character\n * Capturing groups:\n * [1] regular whitespace\n * [2] backslash followed by whitespace\n * [3] anything else, which may include:\n * [4] left character of \\verb*\n * [5] left character of \\verb\n * [6] backslash followed by word, excluding any trailing whitespace\n * Just because the Lexer matches something doesn't mean it's valid input:\n * If there is no matching function or symbol definition, the Parser will\n * still reject the input.\n */\nvar spaceRegexString = \"[ \\r\\n\\t]\";\nvar controlWordRegexString = \"\\\\\\\\[a-zA-Z@]+\";\nvar controlSymbolRegexString = \"\\\\\\\\[^\\uD800-\\uDFFF]\";\nvar controlWordWhitespaceRegexString = \"(\" + controlWordRegexString + \")\" + spaceRegexString + \"*\";\nvar controlSpaceRegexString = \"\\\\\\\\(\\n|[ \\r\\t]+\\n?)[ \\r\\t]*\";\nvar combiningDiacriticalMarkString = \"[\\u0300-\\u036f]\";\nvar combiningDiacriticalMarksEndRegex = new RegExp(combiningDiacriticalMarkString + \"+$\");\nvar tokenRegexString = \"(\" + spaceRegexString + \"+)|\" + ( // whitespace\ncontrolSpaceRegexString + \"|\") + // \\whitespace\n\"([!-\\\\[\\\\]-\\u2027\\u202A-\\uD7FF\\uF900-\\uFFFF]\" + ( // single codepoint\ncombiningDiacriticalMarkString + \"*\") + // ...plus accents\n\"|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]\" + ( // surrogate pair\ncombiningDiacriticalMarkString + \"*\") + // ...plus accents\n\"|\\\\\\\\verb\\\\*([^]).*?\\\\4\" + // \\verb*\n\"|\\\\\\\\verb([^*a-zA-Z]).*?\\\\5\" + ( // \\verb unstarred\n\"|\" + controlWordWhitespaceRegexString) + ( // \\macroName + spaces\n\"|\" + controlSymbolRegexString + \")\"); // \\\\, \\', etc.\n\n/** Main Lexer class */\n\nclass Lexer {\n // Category codes. The lexer only supports comment characters (14) for now.\n // MacroExpander additionally distinguishes active (13).\n constructor(input, settings) {\n this.input = void 0;\n this.settings = void 0;\n this.tokenRegex = void 0;\n this.catcodes = void 0;\n // Separate accents from characters\n this.input = input;\n this.settings = settings;\n this.tokenRegex = new RegExp(tokenRegexString, 'g');\n this.catcodes = {\n \"%\": 14,\n // comment character\n \"~\": 13 // active character\n\n };\n }\n\n setCatcode(char, code) {\n this.catcodes[char] = code;\n }\n /**\n * This function lexes a single token.\n */\n\n\n lex() {\n var input = this.input;\n var pos = this.tokenRegex.lastIndex;\n\n if (pos === input.length) {\n return new Token(\"EOF\", new SourceLocation(this, pos, pos));\n }\n\n var match = this.tokenRegex.exec(input);\n\n if (match === null || match.index !== pos) {\n throw new ParseError(\"Unexpected character: '\" + input[pos] + \"'\", new Token(input[pos], new SourceLocation(this, pos, pos + 1)));\n }\n\n var text = match[6] || match[3] || (match[2] ? \"\\\\ \" : \" \");\n\n if (this.catcodes[text] === 14) {\n // comment character\n var nlIndex = input.indexOf('\\n', this.tokenRegex.lastIndex);\n\n if (nlIndex === -1) {\n this.tokenRegex.lastIndex = input.length; // EOF\n\n this.settings.reportNonstrict(\"commentAtEnd\", \"% comment has no terminating newline; LaTeX would \" + \"fail because of commenting the end of math mode (e.g. $)\");\n } else {\n this.tokenRegex.lastIndex = nlIndex + 1;\n }\n\n return this.lex();\n }\n\n return new Token(text, new SourceLocation(this, pos, this.tokenRegex.lastIndex));\n }\n\n}\n\n/**\n * A `Namespace` refers to a space of nameable things like macros or lengths,\n * which can be `set` either globally or local to a nested group, using an\n * undo stack similar to how TeX implements this functionality.\n * Performance-wise, `get` and local `set` take constant time, while global\n * `set` takes time proportional to the depth of group nesting.\n */\nclass Namespace {\n /**\n * Both arguments are optional. The first argument is an object of\n * built-in mappings which never change. The second argument is an object\n * of initial (global-level) mappings, which will constantly change\n * according to any global/top-level `set`s done.\n */\n constructor(builtins, globalMacros) {\n if (builtins === void 0) {\n builtins = {};\n }\n\n if (globalMacros === void 0) {\n globalMacros = {};\n }\n\n this.current = void 0;\n this.builtins = void 0;\n this.undefStack = void 0;\n this.current = globalMacros;\n this.builtins = builtins;\n this.undefStack = [];\n }\n /**\n * Start a new nested group, affecting future local `set`s.\n */\n\n\n beginGroup() {\n this.undefStack.push({});\n }\n /**\n * End current nested group, restoring values before the group began.\n */\n\n\n endGroup() {\n if (this.undefStack.length === 0) {\n throw new ParseError(\"Unbalanced namespace destruction: attempt \" + \"to pop global namespace; please report this as a bug\");\n }\n\n var undefs = this.undefStack.pop();\n\n for (var undef in undefs) {\n if (undefs.hasOwnProperty(undef)) {\n if (undefs[undef] == null) {\n delete this.current[undef];\n } else {\n this.current[undef] = undefs[undef];\n }\n }\n }\n }\n /**\n * Ends all currently nested groups (if any), restoring values before the\n * groups began. Useful in case of an error in the middle of parsing.\n */\n\n\n endGroups() {\n while (this.undefStack.length > 0) {\n this.endGroup();\n }\n }\n /**\n * Detect whether `name` has a definition. Equivalent to\n * `get(name) != null`.\n */\n\n\n has(name) {\n return this.current.hasOwnProperty(name) || this.builtins.hasOwnProperty(name);\n }\n /**\n * Get the current value of a name, or `undefined` if there is no value.\n *\n * Note: Do not use `if (namespace.get(...))` to detect whether a macro\n * is defined, as the definition may be the empty string which evaluates\n * to `false` in JavaScript. Use `if (namespace.get(...) != null)` or\n * `if (namespace.has(...))`.\n */\n\n\n get(name) {\n if (this.current.hasOwnProperty(name)) {\n return this.current[name];\n } else {\n return this.builtins[name];\n }\n }\n /**\n * Set the current value of a name, and optionally set it globally too.\n * Local set() sets the current value and (when appropriate) adds an undo\n * operation to the undo stack. Global set() may change the undo\n * operation at every level, so takes time linear in their number.\n * A value of undefined means to delete existing definitions.\n */\n\n\n set(name, value, global) {\n if (global === void 0) {\n global = false;\n }\n\n if (global) {\n // Global set is equivalent to setting in all groups. Simulate this\n // by destroying any undos currently scheduled for this name,\n // and adding an undo with the *new* value (in case it later gets\n // locally reset within this environment).\n for (var i = 0; i < this.undefStack.length; i++) {\n delete this.undefStack[i][name];\n }\n\n if (this.undefStack.length > 0) {\n this.undefStack[this.undefStack.length - 1][name] = value;\n }\n } else {\n // Undo this set at end of this group (possibly to `undefined`),\n // unless an undo is already in place, in which case that older\n // value is the correct one.\n var top = this.undefStack[this.undefStack.length - 1];\n\n if (top && !top.hasOwnProperty(name)) {\n top[name] = this.current[name];\n }\n }\n\n if (value == null) {\n delete this.current[name];\n } else {\n this.current[name] = value;\n }\n }\n\n}\n\n/**\n * Predefined macros for KaTeX.\n * This can be used to define some commands in terms of others.\n */\nvar macros = _macros;\n// macro tools\n\ndefineMacro(\"\\\\noexpand\", function (context) {\n // The expansion is the token itself; but that token is interpreted\n // as if its meaning were \u2018\\relax\u2019 if it is a control sequence that\n // would ordinarily be expanded by TeX\u2019s expansion rules.\n var t = context.popToken();\n\n if (context.isExpandable(t.text)) {\n t.noexpand = true;\n t.treatAsRelax = true;\n }\n\n return {\n tokens: [t],\n numArgs: 0\n };\n});\ndefineMacro(\"\\\\expandafter\", function (context) {\n // TeX first reads the token that comes immediately after \\expandafter,\n // without expanding it; let\u2019s call this token t. Then TeX reads the\n // token that comes after t (and possibly more tokens, if that token\n // has an argument), replacing it by its expansion. Finally TeX puts\n // t back in front of that expansion.\n var t = context.popToken();\n context.expandOnce(true); // expand only an expandable token\n\n return {\n tokens: [t],\n numArgs: 0\n };\n}); // LaTeX's \\@firstoftwo{#1}{#2} expands to #1, skipping #2\n// TeX source: \\long\\def\\@firstoftwo#1#2{#1}\n\ndefineMacro(\"\\\\@firstoftwo\", function (context) {\n var args = context.consumeArgs(2);\n return {\n tokens: args[0],\n numArgs: 0\n };\n}); // LaTeX's \\@secondoftwo{#1}{#2} expands to #2, skipping #1\n// TeX source: \\long\\def\\@secondoftwo#1#2{#2}\n\ndefineMacro(\"\\\\@secondoftwo\", function (context) {\n var args = context.consumeArgs(2);\n return {\n tokens: args[1],\n numArgs: 0\n };\n}); // LaTeX's \\@ifnextchar{#1}{#2}{#3} looks ahead to the next (unexpanded)\n// symbol that isn't a space, consuming any spaces but not consuming the\n// first nonspace character. If that nonspace character matches #1, then\n// the macro expands to #2; otherwise, it expands to #3.\n\ndefineMacro(\"\\\\@ifnextchar\", function (context) {\n var args = context.consumeArgs(3); // symbol, if, else\n\n context.consumeSpaces();\n var nextToken = context.future();\n\n if (args[0].length === 1 && args[0][0].text === nextToken.text) {\n return {\n tokens: args[1],\n numArgs: 0\n };\n } else {\n return {\n tokens: args[2],\n numArgs: 0\n };\n }\n}); // LaTeX's \\@ifstar{#1}{#2} looks ahead to the next (unexpanded) symbol.\n// If it is `*`, then it consumes the symbol, and the macro expands to #1;\n// otherwise, the macro expands to #2 (without consuming the symbol).\n// TeX source: \\def\\@ifstar#1{\\@ifnextchar *{\\@firstoftwo{#1}}}\n\ndefineMacro(\"\\\\@ifstar\", \"\\\\@ifnextchar *{\\\\@firstoftwo{#1}}\"); // LaTeX's \\TextOrMath{#1}{#2} expands to #1 in text mode, #2 in math mode\n\ndefineMacro(\"\\\\TextOrMath\", function (context) {\n var args = context.consumeArgs(2);\n\n if (context.mode === 'text') {\n return {\n tokens: args[0],\n numArgs: 0\n };\n } else {\n return {\n tokens: args[1],\n numArgs: 0\n };\n }\n}); // Lookup table for parsing numbers in base 8 through 16\n\nvar digitToNumber = {\n \"0\": 0,\n \"1\": 1,\n \"2\": 2,\n \"3\": 3,\n \"4\": 4,\n \"5\": 5,\n \"6\": 6,\n \"7\": 7,\n \"8\": 8,\n \"9\": 9,\n \"a\": 10,\n \"A\": 10,\n \"b\": 11,\n \"B\": 11,\n \"c\": 12,\n \"C\": 12,\n \"d\": 13,\n \"D\": 13,\n \"e\": 14,\n \"E\": 14,\n \"f\": 15,\n \"F\": 15\n}; // TeX \\char makes a literal character (catcode 12) using the following forms:\n// (see The TeXBook, p. 43)\n// \\char123 -- decimal\n// \\char'123 -- octal\n// \\char\"123 -- hex\n// \\char`x -- character that can be written (i.e. isn't active)\n// \\char`\\x -- character that cannot be written (e.g. %)\n// These all refer to characters from the font, so we turn them into special\n// calls to a function \\@char dealt with in the Parser.\n\ndefineMacro(\"\\\\char\", function (context) {\n var token = context.popToken();\n var base;\n var number = '';\n\n if (token.text === \"'\") {\n base = 8;\n token = context.popToken();\n } else if (token.text === '\"') {\n base = 16;\n token = context.popToken();\n } else if (token.text === \"`\") {\n token = context.popToken();\n\n if (token.text[0] === \"\\\\\") {\n number = token.text.charCodeAt(1);\n } else if (token.text === \"EOF\") {\n throw new ParseError(\"\\\\char` missing argument\");\n } else {\n number = token.text.charCodeAt(0);\n }\n } else {\n base = 10;\n }\n\n if (base) {\n // Parse a number in the given base, starting with first `token`.\n number = digitToNumber[token.text];\n\n if (number == null || number >= base) {\n throw new ParseError(\"Invalid base-\" + base + \" digit \" + token.text);\n }\n\n var digit;\n\n while ((digit = digitToNumber[context.future().text]) != null && digit < base) {\n number *= base;\n number += digit;\n context.popToken();\n }\n }\n\n return \"\\\\@char{\" + number + \"}\";\n}); // \\newcommand{\\macro}[args]{definition}\n// \\renewcommand{\\macro}[args]{definition}\n// TODO: Optional arguments: \\newcommand{\\macro}[args][default]{definition}\n\nvar newcommand = (context, existsOK, nonexistsOK) => {\n var arg = context.consumeArg().tokens;\n\n if (arg.length !== 1) {\n throw new ParseError(\"\\\\newcommand's first argument must be a macro name\");\n }\n\n var name = arg[0].text;\n var exists = context.isDefined(name);\n\n if (exists && !existsOK) {\n throw new ParseError(\"\\\\newcommand{\" + name + \"} attempting to redefine \" + (name + \"; use \\\\renewcommand\"));\n }\n\n if (!exists && !nonexistsOK) {\n throw new ParseError(\"\\\\renewcommand{\" + name + \"} when command \" + name + \" \" + \"does not yet exist; use \\\\newcommand\");\n }\n\n var numArgs = 0;\n arg = context.consumeArg().tokens;\n\n if (arg.length === 1 && arg[0].text === \"[\") {\n var argText = '';\n var token = context.expandNextToken();\n\n while (token.text !== \"]\" && token.text !== \"EOF\") {\n // TODO: Should properly expand arg, e.g., ignore {}s\n argText += token.text;\n token = context.expandNextToken();\n }\n\n if (!argText.match(/^\\s*[0-9]+\\s*$/)) {\n throw new ParseError(\"Invalid number of arguments: \" + argText);\n }\n\n numArgs = parseInt(argText);\n arg = context.consumeArg().tokens;\n } // Final arg is the expansion of the macro\n\n\n context.macros.set(name, {\n tokens: arg,\n numArgs\n });\n return '';\n};\n\ndefineMacro(\"\\\\newcommand\", context => newcommand(context, false, true));\ndefineMacro(\"\\\\renewcommand\", context => newcommand(context, true, false));\ndefineMacro(\"\\\\providecommand\", context => newcommand(context, true, true)); // terminal (console) tools\n\ndefineMacro(\"\\\\message\", context => {\n var arg = context.consumeArgs(1)[0]; // eslint-disable-next-line no-console\n\n console.log(arg.reverse().map(token => token.text).join(\"\"));\n return '';\n});\ndefineMacro(\"\\\\errmessage\", context => {\n var arg = context.consumeArgs(1)[0]; // eslint-disable-next-line no-console\n\n console.error(arg.reverse().map(token => token.text).join(\"\"));\n return '';\n});\ndefineMacro(\"\\\\show\", context => {\n var tok = context.popToken();\n var name = tok.text; // eslint-disable-next-line no-console\n\n console.log(tok, context.macros.get(name), functions[name], symbols.math[name], symbols.text[name]);\n return '';\n}); //////////////////////////////////////////////////////////////////////\n// Grouping\n// \\let\\bgroup={ \\let\\egroup=}\n\ndefineMacro(\"\\\\bgroup\", \"{\");\ndefineMacro(\"\\\\egroup\", \"}\"); // Symbols from latex.ltx:\n// \\def~{\\nobreakspace{}}\n// \\def\\lq{`}\n// \\def\\rq{'}\n// \\def \\aa {\\r a}\n// \\def \\AA {\\r A}\n\ndefineMacro(\"~\", \"\\\\nobreakspace\");\ndefineMacro(\"\\\\lq\", \"`\");\ndefineMacro(\"\\\\rq\", \"'\");\ndefineMacro(\"\\\\aa\", \"\\\\r a\");\ndefineMacro(\"\\\\AA\", \"\\\\r A\"); // Copyright (C) and registered (R) symbols. Use raw symbol in MathML.\n// \\DeclareTextCommandDefault{\\textcopyright}{\\textcircled{c}}\n// \\DeclareTextCommandDefault{\\textregistered}{\\textcircled{%\n// \\check@mathfonts\\fontsize\\sf@size\\z@\\math@fontsfalse\\selectfont R}}\n// \\DeclareRobustCommand{\\copyright}{%\n// \\ifmmode{\\nfss@text{\\textcopyright}}\\else\\textcopyright\\fi}\n\ndefineMacro(\"\\\\textcopyright\", \"\\\\html@mathml{\\\\textcircled{c}}{\\\\char`\u00A9}\");\ndefineMacro(\"\\\\copyright\", \"\\\\TextOrMath{\\\\textcopyright}{\\\\text{\\\\textcopyright}}\");\ndefineMacro(\"\\\\textregistered\", \"\\\\html@mathml{\\\\textcircled{\\\\scriptsize R}}{\\\\char`\u00AE}\"); // Characters omitted from Unicode range 1D400\u20131D7FF\n\ndefineMacro(\"\\u212C\", \"\\\\mathscr{B}\"); // script\n\ndefineMacro(\"\\u2130\", \"\\\\mathscr{E}\");\ndefineMacro(\"\\u2131\", \"\\\\mathscr{F}\");\ndefineMacro(\"\\u210B\", \"\\\\mathscr{H}\");\ndefineMacro(\"\\u2110\", \"\\\\mathscr{I}\");\ndefineMacro(\"\\u2112\", \"\\\\mathscr{L}\");\ndefineMacro(\"\\u2133\", \"\\\\mathscr{M}\");\ndefineMacro(\"\\u211B\", \"\\\\mathscr{R}\");\ndefineMacro(\"\\u212D\", \"\\\\mathfrak{C}\"); // Fraktur\n\ndefineMacro(\"\\u210C\", \"\\\\mathfrak{H}\");\ndefineMacro(\"\\u2128\", \"\\\\mathfrak{Z}\"); // Define \\Bbbk with a macro that works in both HTML and MathML.\n\ndefineMacro(\"\\\\Bbbk\", \"\\\\Bbb{k}\"); // Unicode middle dot\n// The KaTeX fonts do not contain U+00B7. Instead, \\cdotp displays\n// the dot at U+22C5 and gives it punct spacing.\n\ndefineMacro(\"\\u00b7\", \"\\\\cdotp\"); // \\llap and \\rlap render their contents in text mode\n\ndefineMacro(\"\\\\llap\", \"\\\\mathllap{\\\\textrm{#1}}\");\ndefineMacro(\"\\\\rlap\", \"\\\\mathrlap{\\\\textrm{#1}}\");\ndefineMacro(\"\\\\clap\", \"\\\\mathclap{\\\\textrm{#1}}\"); // \\mathstrut from the TeXbook, p 360\n\ndefineMacro(\"\\\\mathstrut\", \"\\\\vphantom{(}\"); // \\underbar from TeXbook p 353\n\ndefineMacro(\"\\\\underbar\", \"\\\\underline{\\\\text{#1}}\"); // \\not is defined by base/fontmath.ltx via\n// \\DeclareMathSymbol{\\not}{\\mathrel}{symbols}{\"36}\n// It's thus treated like a \\mathrel, but defined by a symbol that has zero\n// width but extends to the right. We use \\rlap to get that spacing.\n// For MathML we write U+0338 here. buildMathML.js will then do the overlay.\n\ndefineMacro(\"\\\\not\", '\\\\html@mathml{\\\\mathrel{\\\\mathrlap\\\\@not}}{\\\\char\"338}'); // Negated symbols from base/fontmath.ltx:\n// \\def\\neq{\\not=} \\let\\ne=\\neq\n// \\DeclareRobustCommand\n// \\notin{\\mathrel{\\m@th\\mathpalette\\c@ncel\\in}}\n// \\def\\c@ncel#1#2{\\m@th\\ooalign{$\\hfil#1\\mkern1mu/\\hfil$\\crcr$#1#2$}}\n\ndefineMacro(\"\\\\neq\", \"\\\\html@mathml{\\\\mathrel{\\\\not=}}{\\\\mathrel{\\\\char`\u2260}}\");\ndefineMacro(\"\\\\ne\", \"\\\\neq\");\ndefineMacro(\"\\u2260\", \"\\\\neq\");\ndefineMacro(\"\\\\notin\", \"\\\\html@mathml{\\\\mathrel{{\\\\in}\\\\mathllap{/\\\\mskip1mu}}}\" + \"{\\\\mathrel{\\\\char`\u2209}}\");\ndefineMacro(\"\\u2209\", \"\\\\notin\"); // Unicode stacked relations\n\ndefineMacro(\"\\u2258\", \"\\\\html@mathml{\" + \"\\\\mathrel{=\\\\kern{-1em}\\\\raisebox{0.4em}{$\\\\scriptsize\\\\frown$}}\" + \"}{\\\\mathrel{\\\\char`\\u2258}}\");\ndefineMacro(\"\\u2259\", \"\\\\html@mathml{\\\\stackrel{\\\\tiny\\\\wedge}{=}}{\\\\mathrel{\\\\char`\\u2258}}\");\ndefineMacro(\"\\u225A\", \"\\\\html@mathml{\\\\stackrel{\\\\tiny\\\\vee}{=}}{\\\\mathrel{\\\\char`\\u225A}}\");\ndefineMacro(\"\\u225B\", \"\\\\html@mathml{\\\\stackrel{\\\\scriptsize\\\\star}{=}}\" + \"{\\\\mathrel{\\\\char`\\u225B}}\");\ndefineMacro(\"\\u225D\", \"\\\\html@mathml{\\\\stackrel{\\\\tiny\\\\mathrm{def}}{=}}\" + \"{\\\\mathrel{\\\\char`\\u225D}}\");\ndefineMacro(\"\\u225E\", \"\\\\html@mathml{\\\\stackrel{\\\\tiny\\\\mathrm{m}}{=}}\" + \"{\\\\mathrel{\\\\char`\\u225E}}\");\ndefineMacro(\"\\u225F\", \"\\\\html@mathml{\\\\stackrel{\\\\tiny?}{=}}{\\\\mathrel{\\\\char`\\u225F}}\"); // Misc Unicode\n\ndefineMacro(\"\\u27C2\", \"\\\\perp\");\ndefineMacro(\"\\u203C\", \"\\\\mathclose{!\\\\mkern-0.8mu!}\");\ndefineMacro(\"\\u220C\", \"\\\\notni\");\ndefineMacro(\"\\u231C\", \"\\\\ulcorner\");\ndefineMacro(\"\\u231D\", \"\\\\urcorner\");\ndefineMacro(\"\\u231E\", \"\\\\llcorner\");\ndefineMacro(\"\\u231F\", \"\\\\lrcorner\");\ndefineMacro(\"\\u00A9\", \"\\\\copyright\");\ndefineMacro(\"\\u00AE\", \"\\\\textregistered\");\ndefineMacro(\"\\uFE0F\", \"\\\\textregistered\"); // The KaTeX fonts have corners at codepoints that don't match Unicode.\n// For MathML purposes, use the Unicode code point.\n\ndefineMacro(\"\\\\ulcorner\", \"\\\\html@mathml{\\\\@ulcorner}{\\\\mathop{\\\\char\\\"231c}}\");\ndefineMacro(\"\\\\urcorner\", \"\\\\html@mathml{\\\\@urcorner}{\\\\mathop{\\\\char\\\"231d}}\");\ndefineMacro(\"\\\\llcorner\", \"\\\\html@mathml{\\\\@llcorner}{\\\\mathop{\\\\char\\\"231e}}\");\ndefineMacro(\"\\\\lrcorner\", \"\\\\html@mathml{\\\\@lrcorner}{\\\\mathop{\\\\char\\\"231f}}\"); //////////////////////////////////////////////////////////////////////\n// LaTeX_2\u03B5\n// \\vdots{\\vbox{\\baselineskip4\\p@ \\lineskiplimit\\z@\n// \\kern6\\p@\\hbox{.}\\hbox{.}\\hbox{.}}}\n// We'll call \\varvdots, which gets a glyph from symbols.js.\n// The zero-width rule gets us an equivalent to the vertical 6pt kern.\n\ndefineMacro(\"\\\\vdots\", \"\\\\mathord{\\\\varvdots\\\\rule{0pt}{15pt}}\");\ndefineMacro(\"\\u22ee\", \"\\\\vdots\"); //////////////////////////////////////////////////////////////////////\n// amsmath.sty\n// http://mirrors.concertpass.com/tex-archive/macros/latex/required/amsmath/amsmath.pdf\n// Italic Greek capital letters. AMS defines these with \\DeclareMathSymbol,\n// but they are equivalent to \\mathit{\\Letter}.\n\ndefineMacro(\"\\\\varGamma\", \"\\\\mathit{\\\\Gamma}\");\ndefineMacro(\"\\\\varDelta\", \"\\\\mathit{\\\\Delta}\");\ndefineMacro(\"\\\\varTheta\", \"\\\\mathit{\\\\Theta}\");\ndefineMacro(\"\\\\varLambda\", \"\\\\mathit{\\\\Lambda}\");\ndefineMacro(\"\\\\varXi\", \"\\\\mathit{\\\\Xi}\");\ndefineMacro(\"\\\\varPi\", \"\\\\mathit{\\\\Pi}\");\ndefineMacro(\"\\\\varSigma\", \"\\\\mathit{\\\\Sigma}\");\ndefineMacro(\"\\\\varUpsilon\", \"\\\\mathit{\\\\Upsilon}\");\ndefineMacro(\"\\\\varPhi\", \"\\\\mathit{\\\\Phi}\");\ndefineMacro(\"\\\\varPsi\", \"\\\\mathit{\\\\Psi}\");\ndefineMacro(\"\\\\varOmega\", \"\\\\mathit{\\\\Omega}\"); //\\newcommand{\\substack}[1]{\\subarray{c}#1\\endsubarray}\n\ndefineMacro(\"\\\\substack\", \"\\\\begin{subarray}{c}#1\\\\end{subarray}\"); // \\renewcommand{\\colon}{\\nobreak\\mskip2mu\\mathpunct{}\\nonscript\n// \\mkern-\\thinmuskip{:}\\mskip6muplus1mu\\relax}\n\ndefineMacro(\"\\\\colon\", \"\\\\nobreak\\\\mskip2mu\\\\mathpunct{}\" + \"\\\\mathchoice{\\\\mkern-3mu}{\\\\mkern-3mu}{}{}{:}\\\\mskip6mu\\\\relax\"); // \\newcommand{\\boxed}[1]{\\fbox{\\m@th$\\displaystyle#1$}}\n\ndefineMacro(\"\\\\boxed\", \"\\\\fbox{$\\\\displaystyle{#1}$}\"); // \\def\\iff{\\DOTSB\\;\\Longleftrightarrow\\;}\n// \\def\\implies{\\DOTSB\\;\\Longrightarrow\\;}\n// \\def\\impliedby{\\DOTSB\\;\\Longleftarrow\\;}\n\ndefineMacro(\"\\\\iff\", \"\\\\DOTSB\\\\;\\\\Longleftrightarrow\\\\;\");\ndefineMacro(\"\\\\implies\", \"\\\\DOTSB\\\\;\\\\Longrightarrow\\\\;\");\ndefineMacro(\"\\\\impliedby\", \"\\\\DOTSB\\\\;\\\\Longleftarrow\\\\;\"); // AMSMath's automatic \\dots, based on \\mdots@@ macro.\n\nvar dotsByToken = {\n ',': '\\\\dotsc',\n '\\\\not': '\\\\dotsb',\n // \\keybin@ checks for the following:\n '+': '\\\\dotsb',\n '=': '\\\\dotsb',\n '<': '\\\\dotsb',\n '>': '\\\\dotsb',\n '-': '\\\\dotsb',\n '*': '\\\\dotsb',\n ':': '\\\\dotsb',\n // Symbols whose definition starts with \\DOTSB:\n '\\\\DOTSB': '\\\\dotsb',\n '\\\\coprod': '\\\\dotsb',\n '\\\\bigvee': '\\\\dotsb',\n '\\\\bigwedge': '\\\\dotsb',\n '\\\\biguplus': '\\\\dotsb',\n '\\\\bigcap': '\\\\dotsb',\n '\\\\bigcup': '\\\\dotsb',\n '\\\\prod': '\\\\dotsb',\n '\\\\sum': '\\\\dotsb',\n '\\\\bigotimes': '\\\\dotsb',\n '\\\\bigoplus': '\\\\dotsb',\n '\\\\bigodot': '\\\\dotsb',\n '\\\\bigsqcup': '\\\\dotsb',\n '\\\\And': '\\\\dotsb',\n '\\\\longrightarrow': '\\\\dotsb',\n '\\\\Longrightarrow': '\\\\dotsb',\n '\\\\longleftarrow': '\\\\dotsb',\n '\\\\Longleftarrow': '\\\\dotsb',\n '\\\\longleftrightarrow': '\\\\dotsb',\n '\\\\Longleftrightarrow': '\\\\dotsb',\n '\\\\mapsto': '\\\\dotsb',\n '\\\\longmapsto': '\\\\dotsb',\n '\\\\hookrightarrow': '\\\\dotsb',\n '\\\\doteq': '\\\\dotsb',\n // Symbols whose definition starts with \\mathbin:\n '\\\\mathbin': '\\\\dotsb',\n // Symbols whose definition starts with \\mathrel:\n '\\\\mathrel': '\\\\dotsb',\n '\\\\relbar': '\\\\dotsb',\n '\\\\Relbar': '\\\\dotsb',\n '\\\\xrightarrow': '\\\\dotsb',\n '\\\\xleftarrow': '\\\\dotsb',\n // Symbols whose definition starts with \\DOTSI:\n '\\\\DOTSI': '\\\\dotsi',\n '\\\\int': '\\\\dotsi',\n '\\\\oint': '\\\\dotsi',\n '\\\\iint': '\\\\dotsi',\n '\\\\iiint': '\\\\dotsi',\n '\\\\iiiint': '\\\\dotsi',\n '\\\\idotsint': '\\\\dotsi',\n // Symbols whose definition starts with \\DOTSX:\n '\\\\DOTSX': '\\\\dotsx'\n};\ndefineMacro(\"\\\\dots\", function (context) {\n // TODO: If used in text mode, should expand to \\textellipsis.\n // However, in KaTeX, \\textellipsis and \\ldots behave the same\n // (in text mode), and it's unlikely we'd see any of the math commands\n // that affect the behavior of \\dots when in text mode. So fine for now\n // (until we support \\ifmmode ... \\else ... \\fi).\n var thedots = '\\\\dotso';\n var next = context.expandAfterFuture().text;\n\n if (next in dotsByToken) {\n thedots = dotsByToken[next];\n } else if (next.slice(0, 4) === '\\\\not') {\n thedots = '\\\\dotsb';\n } else if (next in symbols.math) {\n if (utils.contains(['bin', 'rel'], symbols.math[next].group)) {\n thedots = '\\\\dotsb';\n }\n }\n\n return thedots;\n});\nvar spaceAfterDots = {\n // \\rightdelim@ checks for the following:\n ')': true,\n ']': true,\n '\\\\rbrack': true,\n '\\\\}': true,\n '\\\\rbrace': true,\n '\\\\rangle': true,\n '\\\\rceil': true,\n '\\\\rfloor': true,\n '\\\\rgroup': true,\n '\\\\rmoustache': true,\n '\\\\right': true,\n '\\\\bigr': true,\n '\\\\biggr': true,\n '\\\\Bigr': true,\n '\\\\Biggr': true,\n // \\extra@ also tests for the following:\n '$': true,\n // \\extrap@ checks for the following:\n ';': true,\n '.': true,\n ',': true\n};\ndefineMacro(\"\\\\dotso\", function (context) {\n var next = context.future().text;\n\n if (next in spaceAfterDots) {\n return \"\\\\ldots\\\\,\";\n } else {\n return \"\\\\ldots\";\n }\n});\ndefineMacro(\"\\\\dotsc\", function (context) {\n var next = context.future().text; // \\dotsc uses \\extra@ but not \\extrap@, instead specially checking for\n // ';' and '.', but doesn't check for ','.\n\n if (next in spaceAfterDots && next !== ',') {\n return \"\\\\ldots\\\\,\";\n } else {\n return \"\\\\ldots\";\n }\n});\ndefineMacro(\"\\\\cdots\", function (context) {\n var next = context.future().text;\n\n if (next in spaceAfterDots) {\n return \"\\\\@cdots\\\\,\";\n } else {\n return \"\\\\@cdots\";\n }\n});\ndefineMacro(\"\\\\dotsb\", \"\\\\cdots\");\ndefineMacro(\"\\\\dotsm\", \"\\\\cdots\");\ndefineMacro(\"\\\\dotsi\", \"\\\\!\\\\cdots\"); // amsmath doesn't actually define \\dotsx, but \\dots followed by a macro\n// starting with \\DOTSX implies \\dotso, and then \\extra@ detects this case\n// and forces the added `\\,`.\n\ndefineMacro(\"\\\\dotsx\", \"\\\\ldots\\\\,\"); // \\let\\DOTSI\\relax\n// \\let\\DOTSB\\relax\n// \\let\\DOTSX\\relax\n\ndefineMacro(\"\\\\DOTSI\", \"\\\\relax\");\ndefineMacro(\"\\\\DOTSB\", \"\\\\relax\");\ndefineMacro(\"\\\\DOTSX\", \"\\\\relax\"); // Spacing, based on amsmath.sty's override of LaTeX defaults\n// \\DeclareRobustCommand{\\tmspace}[3]{%\n// \\ifmmode\\mskip#1#2\\else\\kern#1#3\\fi\\relax}\n\ndefineMacro(\"\\\\tmspace\", \"\\\\TextOrMath{\\\\kern#1#3}{\\\\mskip#1#2}\\\\relax\"); // \\renewcommand{\\,}{\\tmspace+\\thinmuskip{.1667em}}\n// TODO: math mode should use \\thinmuskip\n\ndefineMacro(\"\\\\,\", \"\\\\tmspace+{3mu}{.1667em}\"); // \\let\\thinspace\\,\n\ndefineMacro(\"\\\\thinspace\", \"\\\\,\"); // \\def\\>{\\mskip\\medmuskip}\n// \\renewcommand{\\:}{\\tmspace+\\medmuskip{.2222em}}\n// TODO: \\> and math mode of \\: should use \\medmuskip = 4mu plus 2mu minus 4mu\n\ndefineMacro(\"\\\\>\", \"\\\\mskip{4mu}\");\ndefineMacro(\"\\\\:\", \"\\\\tmspace+{4mu}{.2222em}\"); // \\let\\medspace\\:\n\ndefineMacro(\"\\\\medspace\", \"\\\\:\"); // \\renewcommand{\\;}{\\tmspace+\\thickmuskip{.2777em}}\n// TODO: math mode should use \\thickmuskip = 5mu plus 5mu\n\ndefineMacro(\"\\\\;\", \"\\\\tmspace+{5mu}{.2777em}\"); // \\let\\thickspace\\;\n\ndefineMacro(\"\\\\thickspace\", \"\\\\;\"); // \\renewcommand{\\!}{\\tmspace-\\thinmuskip{.1667em}}\n// TODO: math mode should use \\thinmuskip\n\ndefineMacro(\"\\\\!\", \"\\\\tmspace-{3mu}{.1667em}\"); // \\let\\negthinspace\\!\n\ndefineMacro(\"\\\\negthinspace\", \"\\\\!\"); // \\newcommand{\\negmedspace}{\\tmspace-\\medmuskip{.2222em}}\n// TODO: math mode should use \\medmuskip\n\ndefineMacro(\"\\\\negmedspace\", \"\\\\tmspace-{4mu}{.2222em}\"); // \\newcommand{\\negthickspace}{\\tmspace-\\thickmuskip{.2777em}}\n// TODO: math mode should use \\thickmuskip\n\ndefineMacro(\"\\\\negthickspace\", \"\\\\tmspace-{5mu}{.277em}\"); // \\def\\enspace{\\kern.5em }\n\ndefineMacro(\"\\\\enspace\", \"\\\\kern.5em \"); // \\def\\enskip{\\hskip.5em\\relax}\n\ndefineMacro(\"\\\\enskip\", \"\\\\hskip.5em\\\\relax\"); // \\def\\quad{\\hskip1em\\relax}\n\ndefineMacro(\"\\\\quad\", \"\\\\hskip1em\\\\relax\"); // \\def\\qquad{\\hskip2em\\relax}\n\ndefineMacro(\"\\\\qquad\", \"\\\\hskip2em\\\\relax\"); // \\tag@in@display form of \\tag\n\ndefineMacro(\"\\\\tag\", \"\\\\@ifstar\\\\tag@literal\\\\tag@paren\");\ndefineMacro(\"\\\\tag@paren\", \"\\\\tag@literal{({#1})}\");\ndefineMacro(\"\\\\tag@literal\", context => {\n if (context.macros.get(\"\\\\df@tag\")) {\n throw new ParseError(\"Multiple \\\\tag\");\n }\n\n return \"\\\\gdef\\\\df@tag{\\\\text{#1}}\";\n}); // \\renewcommand{\\bmod}{\\nonscript\\mskip-\\medmuskip\\mkern5mu\\mathbin\n// {\\operator@font mod}\\penalty900\n// \\mkern5mu\\nonscript\\mskip-\\medmuskip}\n// \\newcommand{\\pod}[1]{\\allowbreak\n// \\if@display\\mkern18mu\\else\\mkern8mu\\fi(#1)}\n// \\renewcommand{\\pmod}[1]{\\pod{{\\operator@font mod}\\mkern6mu#1}}\n// \\newcommand{\\mod}[1]{\\allowbreak\\if@display\\mkern18mu\n// \\else\\mkern12mu\\fi{\\operator@font mod}\\,\\,#1}\n// TODO: math mode should use \\medmuskip = 4mu plus 2mu minus 4mu\n\ndefineMacro(\"\\\\bmod\", \"\\\\mathchoice{\\\\mskip1mu}{\\\\mskip1mu}{\\\\mskip5mu}{\\\\mskip5mu}\" + \"\\\\mathbin{\\\\rm mod}\" + \"\\\\mathchoice{\\\\mskip1mu}{\\\\mskip1mu}{\\\\mskip5mu}{\\\\mskip5mu}\");\ndefineMacro(\"\\\\pod\", \"\\\\allowbreak\" + \"\\\\mathchoice{\\\\mkern18mu}{\\\\mkern8mu}{\\\\mkern8mu}{\\\\mkern8mu}(#1)\");\ndefineMacro(\"\\\\pmod\", \"\\\\pod{{\\\\rm mod}\\\\mkern6mu#1}\");\ndefineMacro(\"\\\\mod\", \"\\\\allowbreak\" + \"\\\\mathchoice{\\\\mkern18mu}{\\\\mkern12mu}{\\\\mkern12mu}{\\\\mkern12mu}\" + \"{\\\\rm mod}\\\\,\\\\,#1\"); //////////////////////////////////////////////////////////////////////\n// LaTeX source2e\n// \\expandafter\\let\\expandafter\\@normalcr\n// \\csname\\expandafter\\@gobble\\string\\\\ \\endcsname\n// \\DeclareRobustCommand\\newline{\\@normalcr\\relax}\n\ndefineMacro(\"\\\\newline\", \"\\\\\\\\\\\\relax\"); // \\def\\TeX{T\\kern-.1667em\\lower.5ex\\hbox{E}\\kern-.125emX\\@}\n// TODO: Doesn't normally work in math mode because \\@ fails. KaTeX doesn't\n// support \\@ yet, so that's omitted, and we add \\text so that the result\n// doesn't look funny in math mode.\n\ndefineMacro(\"\\\\TeX\", \"\\\\textrm{\\\\html@mathml{\" + \"T\\\\kern-.1667em\\\\raisebox{-.5ex}{E}\\\\kern-.125emX\" + \"}{TeX}}\"); // \\DeclareRobustCommand{\\LaTeX}{L\\kern-.36em%\n// {\\sbox\\z@ T%\n// \\vbox to\\ht\\z@{\\hbox{\\check@mathfonts\n// \\fontsize\\sf@size\\z@\n// \\math@fontsfalse\\selectfont\n// A}%\n// \\vss}%\n// }%\n// \\kern-.15em%\n// \\TeX}\n// This code aligns the top of the A with the T (from the perspective of TeX's\n// boxes, though visually the A appears to extend above slightly).\n// We compute the corresponding \\raisebox when A is rendered in \\normalsize\n// \\scriptstyle, which has a scale factor of 0.7 (see Options.js).\n\nvar latexRaiseA = makeEm(fontMetricsData['Main-Regular'][\"T\".charCodeAt(0)][1] - 0.7 * fontMetricsData['Main-Regular'][\"A\".charCodeAt(0)][1]);\ndefineMacro(\"\\\\LaTeX\", \"\\\\textrm{\\\\html@mathml{\" + (\"L\\\\kern-.36em\\\\raisebox{\" + latexRaiseA + \"}{\\\\scriptstyle A}\") + \"\\\\kern-.15em\\\\TeX}{LaTeX}}\"); // New KaTeX logo based on tweaking LaTeX logo\n\ndefineMacro(\"\\\\KaTeX\", \"\\\\textrm{\\\\html@mathml{\" + (\"K\\\\kern-.17em\\\\raisebox{\" + latexRaiseA + \"}{\\\\scriptstyle A}\") + \"\\\\kern-.15em\\\\TeX}{KaTeX}}\"); // \\DeclareRobustCommand\\hspace{\\@ifstar\\@hspacer\\@hspace}\n// \\def\\@hspace#1{\\hskip #1\\relax}\n// \\def\\@hspacer#1{\\vrule \\@width\\z@\\nobreak\n// \\hskip #1\\hskip \\z@skip}\n\ndefineMacro(\"\\\\hspace\", \"\\\\@ifstar\\\\@hspacer\\\\@hspace\");\ndefineMacro(\"\\\\@hspace\", \"\\\\hskip #1\\\\relax\");\ndefineMacro(\"\\\\@hspacer\", \"\\\\rule{0pt}{0pt}\\\\hskip #1\\\\relax\"); //////////////////////////////////////////////////////////////////////\n// mathtools.sty\n//\\providecommand\\ordinarycolon{:}\n\ndefineMacro(\"\\\\ordinarycolon\", \":\"); //\\def\\vcentcolon{\\mathrel{\\mathop\\ordinarycolon}}\n//TODO(edemaine): Not yet centered. Fix via \\raisebox or #726\n\ndefineMacro(\"\\\\vcentcolon\", \"\\\\mathrel{\\\\mathop\\\\ordinarycolon}\"); // \\providecommand*\\dblcolon{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}\n\ndefineMacro(\"\\\\dblcolon\", \"\\\\html@mathml{\" + \"\\\\mathrel{\\\\vcentcolon\\\\mathrel{\\\\mkern-.9mu}\\\\vcentcolon}}\" + \"{\\\\mathop{\\\\char\\\"2237}}\"); // \\providecommand*\\coloneqq{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}\n\ndefineMacro(\"\\\\coloneqq\", \"\\\\html@mathml{\" + \"\\\\mathrel{\\\\vcentcolon\\\\mathrel{\\\\mkern-1.2mu}=}}\" + \"{\\\\mathop{\\\\char\\\"2254}}\"); // \u2254\n// \\providecommand*\\Coloneqq{\\dblcolon\\mathrel{\\mkern-1.2mu}=}\n\ndefineMacro(\"\\\\Coloneqq\", \"\\\\html@mathml{\" + \"\\\\mathrel{\\\\dblcolon\\\\mathrel{\\\\mkern-1.2mu}=}}\" + \"{\\\\mathop{\\\\char\\\"2237\\\\char\\\"3d}}\"); // \\providecommand*\\coloneq{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}\n\ndefineMacro(\"\\\\coloneq\", \"\\\\html@mathml{\" + \"\\\\mathrel{\\\\vcentcolon\\\\mathrel{\\\\mkern-1.2mu}\\\\mathrel{-}}}\" + \"{\\\\mathop{\\\\char\\\"3a\\\\char\\\"2212}}\"); // \\providecommand*\\Coloneq{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}\n\ndefineMacro(\"\\\\Coloneq\", \"\\\\html@mathml{\" + \"\\\\mathrel{\\\\dblcolon\\\\mathrel{\\\\mkern-1.2mu}\\\\mathrel{-}}}\" + \"{\\\\mathop{\\\\char\\\"2237\\\\char\\\"2212}}\"); // \\providecommand*\\eqqcolon{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}\n\ndefineMacro(\"\\\\eqqcolon\", \"\\\\html@mathml{\" + \"\\\\mathrel{=\\\\mathrel{\\\\mkern-1.2mu}\\\\vcentcolon}}\" + \"{\\\\mathop{\\\\char\\\"2255}}\"); // \u2255\n// \\providecommand*\\Eqqcolon{=\\mathrel{\\mkern-1.2mu}\\dblcolon}\n\ndefineMacro(\"\\\\Eqqcolon\", \"\\\\html@mathml{\" + \"\\\\mathrel{=\\\\mathrel{\\\\mkern-1.2mu}\\\\dblcolon}}\" + \"{\\\\mathop{\\\\char\\\"3d\\\\char\\\"2237}}\"); // \\providecommand*\\eqcolon{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}\n\ndefineMacro(\"\\\\eqcolon\", \"\\\\html@mathml{\" + \"\\\\mathrel{\\\\mathrel{-}\\\\mathrel{\\\\mkern-1.2mu}\\\\vcentcolon}}\" + \"{\\\\mathop{\\\\char\\\"2239}}\"); // \\providecommand*\\Eqcolon{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}\n\ndefineMacro(\"\\\\Eqcolon\", \"\\\\html@mathml{\" + \"\\\\mathrel{\\\\mathrel{-}\\\\mathrel{\\\\mkern-1.2mu}\\\\dblcolon}}\" + \"{\\\\mathop{\\\\char\\\"2212\\\\char\\\"2237}}\"); // \\providecommand*\\colonapprox{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}\n\ndefineMacro(\"\\\\colonapprox\", \"\\\\html@mathml{\" + \"\\\\mathrel{\\\\vcentcolon\\\\mathrel{\\\\mkern-1.2mu}\\\\approx}}\" + \"{\\\\mathop{\\\\char\\\"3a\\\\char\\\"2248}}\"); // \\providecommand*\\Colonapprox{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}\n\ndefineMacro(\"\\\\Colonapprox\", \"\\\\html@mathml{\" + \"\\\\mathrel{\\\\dblcolon\\\\mathrel{\\\\mkern-1.2mu}\\\\approx}}\" + \"{\\\\mathop{\\\\char\\\"2237\\\\char\\\"2248}}\"); // \\providecommand*\\colonsim{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}\n\ndefineMacro(\"\\\\colonsim\", \"\\\\html@mathml{\" + \"\\\\mathrel{\\\\vcentcolon\\\\mathrel{\\\\mkern-1.2mu}\\\\sim}}\" + \"{\\\\mathop{\\\\char\\\"3a\\\\char\\\"223c}}\"); // \\providecommand*\\Colonsim{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}\n\ndefineMacro(\"\\\\Colonsim\", \"\\\\html@mathml{\" + \"\\\\mathrel{\\\\dblcolon\\\\mathrel{\\\\mkern-1.2mu}\\\\sim}}\" + \"{\\\\mathop{\\\\char\\\"2237\\\\char\\\"223c}}\"); // Some Unicode characters are implemented with macros to mathtools functions.\n\ndefineMacro(\"\\u2237\", \"\\\\dblcolon\"); // ::\n\ndefineMacro(\"\\u2239\", \"\\\\eqcolon\"); // -:\n\ndefineMacro(\"\\u2254\", \"\\\\coloneqq\"); // :=\n\ndefineMacro(\"\\u2255\", \"\\\\eqqcolon\"); // =:\n\ndefineMacro(\"\\u2A74\", \"\\\\Coloneqq\"); // ::=\n//////////////////////////////////////////////////////////////////////\n// colonequals.sty\n// Alternate names for mathtools's macros:\n\ndefineMacro(\"\\\\ratio\", \"\\\\vcentcolon\");\ndefineMacro(\"\\\\coloncolon\", \"\\\\dblcolon\");\ndefineMacro(\"\\\\colonequals\", \"\\\\coloneqq\");\ndefineMacro(\"\\\\coloncolonequals\", \"\\\\Coloneqq\");\ndefineMacro(\"\\\\equalscolon\", \"\\\\eqqcolon\");\ndefineMacro(\"\\\\equalscoloncolon\", \"\\\\Eqqcolon\");\ndefineMacro(\"\\\\colonminus\", \"\\\\coloneq\");\ndefineMacro(\"\\\\coloncolonminus\", \"\\\\Coloneq\");\ndefineMacro(\"\\\\minuscolon\", \"\\\\eqcolon\");\ndefineMacro(\"\\\\minuscoloncolon\", \"\\\\Eqcolon\"); // \\colonapprox name is same in mathtools and colonequals.\n\ndefineMacro(\"\\\\coloncolonapprox\", \"\\\\Colonapprox\"); // \\colonsim name is same in mathtools and colonequals.\n\ndefineMacro(\"\\\\coloncolonsim\", \"\\\\Colonsim\"); // Additional macros, implemented by analogy with mathtools definitions:\n\ndefineMacro(\"\\\\simcolon\", \"\\\\mathrel{\\\\sim\\\\mathrel{\\\\mkern-1.2mu}\\\\vcentcolon}\");\ndefineMacro(\"\\\\simcoloncolon\", \"\\\\mathrel{\\\\sim\\\\mathrel{\\\\mkern-1.2mu}\\\\dblcolon}\");\ndefineMacro(\"\\\\approxcolon\", \"\\\\mathrel{\\\\approx\\\\mathrel{\\\\mkern-1.2mu}\\\\vcentcolon}\");\ndefineMacro(\"\\\\approxcoloncolon\", \"\\\\mathrel{\\\\approx\\\\mathrel{\\\\mkern-1.2mu}\\\\dblcolon}\"); // Present in newtxmath, pxfonts and txfonts\n\ndefineMacro(\"\\\\notni\", \"\\\\html@mathml{\\\\not\\\\ni}{\\\\mathrel{\\\\char`\\u220C}}\");\ndefineMacro(\"\\\\limsup\", \"\\\\DOTSB\\\\operatorname*{lim\\\\,sup}\");\ndefineMacro(\"\\\\liminf\", \"\\\\DOTSB\\\\operatorname*{lim\\\\,inf}\"); //////////////////////////////////////////////////////////////////////\n// From amsopn.sty\n\ndefineMacro(\"\\\\injlim\", \"\\\\DOTSB\\\\operatorname*{inj\\\\,lim}\");\ndefineMacro(\"\\\\projlim\", \"\\\\DOTSB\\\\operatorname*{proj\\\\,lim}\");\ndefineMacro(\"\\\\varlimsup\", \"\\\\DOTSB\\\\operatorname*{\\\\overline{lim}}\");\ndefineMacro(\"\\\\varliminf\", \"\\\\DOTSB\\\\operatorname*{\\\\underline{lim}}\");\ndefineMacro(\"\\\\varinjlim\", \"\\\\DOTSB\\\\operatorname*{\\\\underrightarrow{lim}}\");\ndefineMacro(\"\\\\varprojlim\", \"\\\\DOTSB\\\\operatorname*{\\\\underleftarrow{lim}}\"); //////////////////////////////////////////////////////////////////////\n// MathML alternates for KaTeX glyphs in the Unicode private area\n\ndefineMacro(\"\\\\gvertneqq\", \"\\\\html@mathml{\\\\@gvertneqq}{\\u2269}\");\ndefineMacro(\"\\\\lvertneqq\", \"\\\\html@mathml{\\\\@lvertneqq}{\\u2268}\");\ndefineMacro(\"\\\\ngeqq\", \"\\\\html@mathml{\\\\@ngeqq}{\\u2271}\");\ndefineMacro(\"\\\\ngeqslant\", \"\\\\html@mathml{\\\\@ngeqslant}{\\u2271}\");\ndefineMacro(\"\\\\nleqq\", \"\\\\html@mathml{\\\\@nleqq}{\\u2270}\");\ndefineMacro(\"\\\\nleqslant\", \"\\\\html@mathml{\\\\@nleqslant}{\\u2270}\");\ndefineMacro(\"\\\\nshortmid\", \"\\\\html@mathml{\\\\@nshortmid}{\u2224}\");\ndefineMacro(\"\\\\nshortparallel\", \"\\\\html@mathml{\\\\@nshortparallel}{\u2226}\");\ndefineMacro(\"\\\\nsubseteqq\", \"\\\\html@mathml{\\\\@nsubseteqq}{\\u2288}\");\ndefineMacro(\"\\\\nsupseteqq\", \"\\\\html@mathml{\\\\@nsupseteqq}{\\u2289}\");\ndefineMacro(\"\\\\varsubsetneq\", \"\\\\html@mathml{\\\\@varsubsetneq}{\u228A}\");\ndefineMacro(\"\\\\varsubsetneqq\", \"\\\\html@mathml{\\\\@varsubsetneqq}{\u2ACB}\");\ndefineMacro(\"\\\\varsupsetneq\", \"\\\\html@mathml{\\\\@varsupsetneq}{\u228B}\");\ndefineMacro(\"\\\\varsupsetneqq\", \"\\\\html@mathml{\\\\@varsupsetneqq}{\u2ACC}\");\ndefineMacro(\"\\\\imath\", \"\\\\html@mathml{\\\\@imath}{\\u0131}\");\ndefineMacro(\"\\\\jmath\", \"\\\\html@mathml{\\\\@jmath}{\\u0237}\"); //////////////////////////////////////////////////////////////////////\n// stmaryrd and semantic\n// The stmaryrd and semantic packages render the next four items by calling a\n// glyph. Those glyphs do not exist in the KaTeX fonts. Hence the macros.\n\ndefineMacro(\"\\\\llbracket\", \"\\\\html@mathml{\" + \"\\\\mathopen{[\\\\mkern-3.2mu[}}\" + \"{\\\\mathopen{\\\\char`\\u27e6}}\");\ndefineMacro(\"\\\\rrbracket\", \"\\\\html@mathml{\" + \"\\\\mathclose{]\\\\mkern-3.2mu]}}\" + \"{\\\\mathclose{\\\\char`\\u27e7}}\");\ndefineMacro(\"\\u27e6\", \"\\\\llbracket\"); // blackboard bold [\n\ndefineMacro(\"\\u27e7\", \"\\\\rrbracket\"); // blackboard bold ]\n\ndefineMacro(\"\\\\lBrace\", \"\\\\html@mathml{\" + \"\\\\mathopen{\\\\{\\\\mkern-3.2mu[}}\" + \"{\\\\mathopen{\\\\char`\\u2983}}\");\ndefineMacro(\"\\\\rBrace\", \"\\\\html@mathml{\" + \"\\\\mathclose{]\\\\mkern-3.2mu\\\\}}}\" + \"{\\\\mathclose{\\\\char`\\u2984}}\");\ndefineMacro(\"\\u2983\", \"\\\\lBrace\"); // blackboard bold {\n\ndefineMacro(\"\\u2984\", \"\\\\rBrace\"); // blackboard bold }\n// TODO: Create variable sized versions of the last two items. I believe that\n// will require new font glyphs.\n// The stmaryrd function `\\minuso` provides a \"Plimsoll\" symbol that\n// superimposes the characters \\circ and \\mathminus. Used in chemistry.\n\ndefineMacro(\"\\\\minuso\", \"\\\\mathbin{\\\\html@mathml{\" + \"{\\\\mathrlap{\\\\mathchoice{\\\\kern{0.145em}}{\\\\kern{0.145em}}\" + \"{\\\\kern{0.1015em}}{\\\\kern{0.0725em}}\\\\circ}{-}}}\" + \"{\\\\char`\u29B5}}\");\ndefineMacro(\"\u29B5\", \"\\\\minuso\"); //////////////////////////////////////////////////////////////////////\n// texvc.sty\n// The texvc package contains macros available in mediawiki pages.\n// We omit the functions deprecated at\n// https://en.wikipedia.org/wiki/Help:Displaying_a_formula#Deprecated_syntax\n// We also omit texvc's \\O, which conflicts with \\text{\\O}\n\ndefineMacro(\"\\\\darr\", \"\\\\downarrow\");\ndefineMacro(\"\\\\dArr\", \"\\\\Downarrow\");\ndefineMacro(\"\\\\Darr\", \"\\\\Downarrow\");\ndefineMacro(\"\\\\lang\", \"\\\\langle\");\ndefineMacro(\"\\\\rang\", \"\\\\rangle\");\ndefineMacro(\"\\\\uarr\", \"\\\\uparrow\");\ndefineMacro(\"\\\\uArr\", \"\\\\Uparrow\");\ndefineMacro(\"\\\\Uarr\", \"\\\\Uparrow\");\ndefineMacro(\"\\\\N\", \"\\\\mathbb{N}\");\ndefineMacro(\"\\\\R\", \"\\\\mathbb{R}\");\ndefineMacro(\"\\\\Z\", \"\\\\mathbb{Z}\");\ndefineMacro(\"\\\\alef\", \"\\\\aleph\");\ndefineMacro(\"\\\\alefsym\", \"\\\\aleph\");\ndefineMacro(\"\\\\Alpha\", \"\\\\mathrm{A}\");\ndefineMacro(\"\\\\Beta\", \"\\\\mathrm{B}\");\ndefineMacro(\"\\\\bull\", \"\\\\bullet\");\ndefineMacro(\"\\\\Chi\", \"\\\\mathrm{X}\");\ndefineMacro(\"\\\\clubs\", \"\\\\clubsuit\");\ndefineMacro(\"\\\\cnums\", \"\\\\mathbb{C}\");\ndefineMacro(\"\\\\Complex\", \"\\\\mathbb{C}\");\ndefineMacro(\"\\\\Dagger\", \"\\\\ddagger\");\ndefineMacro(\"\\\\diamonds\", \"\\\\diamondsuit\");\ndefineMacro(\"\\\\empty\", \"\\\\emptyset\");\ndefineMacro(\"\\\\Epsilon\", \"\\\\mathrm{E}\");\ndefineMacro(\"\\\\Eta\", \"\\\\mathrm{H}\");\ndefineMacro(\"\\\\exist\", \"\\\\exists\");\ndefineMacro(\"\\\\harr\", \"\\\\leftrightarrow\");\ndefineMacro(\"\\\\hArr\", \"\\\\Leftrightarrow\");\ndefineMacro(\"\\\\Harr\", \"\\\\Leftrightarrow\");\ndefineMacro(\"\\\\hearts\", \"\\\\heartsuit\");\ndefineMacro(\"\\\\image\", \"\\\\Im\");\ndefineMacro(\"\\\\infin\", \"\\\\infty\");\ndefineMacro(\"\\\\Iota\", \"\\\\mathrm{I}\");\ndefineMacro(\"\\\\isin\", \"\\\\in\");\ndefineMacro(\"\\\\Kappa\", \"\\\\mathrm{K}\");\ndefineMacro(\"\\\\larr\", \"\\\\leftarrow\");\ndefineMacro(\"\\\\lArr\", \"\\\\Leftarrow\");\ndefineMacro(\"\\\\Larr\", \"\\\\Leftarrow\");\ndefineMacro(\"\\\\lrarr\", \"\\\\leftrightarrow\");\ndefineMacro(\"\\\\lrArr\", \"\\\\Leftrightarrow\");\ndefineMacro(\"\\\\Lrarr\", \"\\\\Leftrightarrow\");\ndefineMacro(\"\\\\Mu\", \"\\\\mathrm{M}\");\ndefineMacro(\"\\\\natnums\", \"\\\\mathbb{N}\");\ndefineMacro(\"\\\\Nu\", \"\\\\mathrm{N}\");\ndefineMacro(\"\\\\Omicron\", \"\\\\mathrm{O}\");\ndefineMacro(\"\\\\plusmn\", \"\\\\pm\");\ndefineMacro(\"\\\\rarr\", \"\\\\rightarrow\");\ndefineMacro(\"\\\\rArr\", \"\\\\Rightarrow\");\ndefineMacro(\"\\\\Rarr\", \"\\\\Rightarrow\");\ndefineMacro(\"\\\\real\", \"\\\\Re\");\ndefineMacro(\"\\\\reals\", \"\\\\mathbb{R}\");\ndefineMacro(\"\\\\Reals\", \"\\\\mathbb{R}\");\ndefineMacro(\"\\\\Rho\", \"\\\\mathrm{P}\");\ndefineMacro(\"\\\\sdot\", \"\\\\cdot\");\ndefineMacro(\"\\\\sect\", \"\\\\S\");\ndefineMacro(\"\\\\spades\", \"\\\\spadesuit\");\ndefineMacro(\"\\\\sub\", \"\\\\subset\");\ndefineMacro(\"\\\\sube\", \"\\\\subseteq\");\ndefineMacro(\"\\\\supe\", \"\\\\supseteq\");\ndefineMacro(\"\\\\Tau\", \"\\\\mathrm{T}\");\ndefineMacro(\"\\\\thetasym\", \"\\\\vartheta\"); // TODO: defineMacro(\"\\\\varcoppa\", \"\\\\\\mbox{\\\\coppa}\");\n\ndefineMacro(\"\\\\weierp\", \"\\\\wp\");\ndefineMacro(\"\\\\Zeta\", \"\\\\mathrm{Z}\"); //////////////////////////////////////////////////////////////////////\n// statmath.sty\n// https://ctan.math.illinois.edu/macros/latex/contrib/statmath/statmath.pdf\n\ndefineMacro(\"\\\\argmin\", \"\\\\DOTSB\\\\operatorname*{arg\\\\,min}\");\ndefineMacro(\"\\\\argmax\", \"\\\\DOTSB\\\\operatorname*{arg\\\\,max}\");\ndefineMacro(\"\\\\plim\", \"\\\\DOTSB\\\\mathop{\\\\operatorname{plim}}\\\\limits\"); //////////////////////////////////////////////////////////////////////\n// braket.sty\n// http://ctan.math.washington.edu/tex-archive/macros/latex/contrib/braket/braket.pdf\n\ndefineMacro(\"\\\\bra\", \"\\\\mathinner{\\\\langle{#1}|}\");\ndefineMacro(\"\\\\ket\", \"\\\\mathinner{|{#1}\\\\rangle}\");\ndefineMacro(\"\\\\braket\", \"\\\\mathinner{\\\\langle{#1}\\\\rangle}\");\ndefineMacro(\"\\\\Bra\", \"\\\\left\\\\langle#1\\\\right|\");\ndefineMacro(\"\\\\Ket\", \"\\\\left|#1\\\\right\\\\rangle\");\n\nvar braketHelper = one => context => {\n var left = context.consumeArg().tokens;\n var middle = context.consumeArg().tokens;\n var middleDouble = context.consumeArg().tokens;\n var right = context.consumeArg().tokens;\n var oldMiddle = context.macros.get(\"|\");\n var oldMiddleDouble = context.macros.get(\"\\\\|\");\n context.macros.beginGroup();\n\n var midMacro = double => context => {\n if (one) {\n // Only modify the first instance of | or \\|\n context.macros.set(\"|\", oldMiddle);\n\n if (middleDouble.length) {\n context.macros.set(\"\\\\|\", oldMiddleDouble);\n }\n }\n\n var doubled = double;\n\n if (!double && middleDouble.length) {\n // Mimic \\@ifnextchar\n var nextToken = context.future();\n\n if (nextToken.text === \"|\") {\n context.popToken();\n doubled = true;\n }\n }\n\n return {\n tokens: doubled ? middleDouble : middle,\n numArgs: 0\n };\n };\n\n context.macros.set(\"|\", midMacro(false));\n\n if (middleDouble.length) {\n context.macros.set(\"\\\\|\", midMacro(true));\n }\n\n var arg = context.consumeArg().tokens;\n var expanded = context.expandTokens([...right, ...arg, ...left // reversed\n ]);\n context.macros.endGroup();\n return {\n tokens: expanded.reverse(),\n numArgs: 0\n };\n};\n\ndefineMacro(\"\\\\bra@ket\", braketHelper(false));\ndefineMacro(\"\\\\bra@set\", braketHelper(true));\ndefineMacro(\"\\\\Braket\", \"\\\\bra@ket{\\\\left\\\\langle}\" + \"{\\\\,\\\\middle\\\\vert\\\\,}{\\\\,\\\\middle\\\\vert\\\\,}{\\\\right\\\\rangle}\");\ndefineMacro(\"\\\\Set\", \"\\\\bra@set{\\\\left\\\\{\\\\:}\" + \"{\\\\;\\\\middle\\\\vert\\\\;}{\\\\;\\\\middle\\\\Vert\\\\;}{\\\\:\\\\right\\\\}}\");\ndefineMacro(\"\\\\set\", \"\\\\bra@set{\\\\{\\\\,}{\\\\mid}{}{\\\\,\\\\}}\"); // has no support for special || or \\|\n//////////////////////////////////////////////////////////////////////\n// actuarialangle.dtx\n\ndefineMacro(\"\\\\angln\", \"{\\\\angl n}\"); // Custom Khan Academy colors, should be moved to an optional package\n\ndefineMacro(\"\\\\blue\", \"\\\\textcolor{##6495ed}{#1}\");\ndefineMacro(\"\\\\orange\", \"\\\\textcolor{##ffa500}{#1}\");\ndefineMacro(\"\\\\pink\", \"\\\\textcolor{##ff00af}{#1}\");\ndefineMacro(\"\\\\red\", \"\\\\textcolor{##df0030}{#1}\");\ndefineMacro(\"\\\\green\", \"\\\\textcolor{##28ae7b}{#1}\");\ndefineMacro(\"\\\\gray\", \"\\\\textcolor{gray}{#1}\");\ndefineMacro(\"\\\\purple\", \"\\\\textcolor{##9d38bd}{#1}\");\ndefineMacro(\"\\\\blueA\", \"\\\\textcolor{##ccfaff}{#1}\");\ndefineMacro(\"\\\\blueB\", \"\\\\textcolor{##80f6ff}{#1}\");\ndefineMacro(\"\\\\blueC\", \"\\\\textcolor{##63d9ea}{#1}\");\ndefineMacro(\"\\\\blueD\", \"\\\\textcolor{##11accd}{#1}\");\ndefineMacro(\"\\\\blueE\", \"\\\\textcolor{##0c7f99}{#1}\");\ndefineMacro(\"\\\\tealA\", \"\\\\textcolor{##94fff5}{#1}\");\ndefineMacro(\"\\\\tealB\", \"\\\\textcolor{##26edd5}{#1}\");\ndefineMacro(\"\\\\tealC\", \"\\\\textcolor{##01d1c1}{#1}\");\ndefineMacro(\"\\\\tealD\", \"\\\\textcolor{##01a995}{#1}\");\ndefineMacro(\"\\\\tealE\", \"\\\\textcolor{##208170}{#1}\");\ndefineMacro(\"\\\\greenA\", \"\\\\textcolor{##b6ffb0}{#1}\");\ndefineMacro(\"\\\\greenB\", \"\\\\textcolor{##8af281}{#1}\");\ndefineMacro(\"\\\\greenC\", \"\\\\textcolor{##74cf70}{#1}\");\ndefineMacro(\"\\\\greenD\", \"\\\\textcolor{##1fab54}{#1}\");\ndefineMacro(\"\\\\greenE\", \"\\\\textcolor{##0d923f}{#1}\");\ndefineMacro(\"\\\\goldA\", \"\\\\textcolor{##ffd0a9}{#1}\");\ndefineMacro(\"\\\\goldB\", \"\\\\textcolor{##ffbb71}{#1}\");\ndefineMacro(\"\\\\goldC\", \"\\\\textcolor{##ff9c39}{#1}\");\ndefineMacro(\"\\\\goldD\", \"\\\\textcolor{##e07d10}{#1}\");\ndefineMacro(\"\\\\goldE\", \"\\\\textcolor{##a75a05}{#1}\");\ndefineMacro(\"\\\\redA\", \"\\\\textcolor{##fca9a9}{#1}\");\ndefineMacro(\"\\\\redB\", \"\\\\textcolor{##ff8482}{#1}\");\ndefineMacro(\"\\\\redC\", \"\\\\textcolor{##f9685d}{#1}\");\ndefineMacro(\"\\\\redD\", \"\\\\textcolor{##e84d39}{#1}\");\ndefineMacro(\"\\\\redE\", \"\\\\textcolor{##bc2612}{#1}\");\ndefineMacro(\"\\\\maroonA\", \"\\\\textcolor{##ffbde0}{#1}\");\ndefineMacro(\"\\\\maroonB\", \"\\\\textcolor{##ff92c6}{#1}\");\ndefineMacro(\"\\\\maroonC\", \"\\\\textcolor{##ed5fa6}{#1}\");\ndefineMacro(\"\\\\maroonD\", \"\\\\textcolor{##ca337c}{#1}\");\ndefineMacro(\"\\\\maroonE\", \"\\\\textcolor{##9e034e}{#1}\");\ndefineMacro(\"\\\\purpleA\", \"\\\\textcolor{##ddd7ff}{#1}\");\ndefineMacro(\"\\\\purpleB\", \"\\\\textcolor{##c6b9fc}{#1}\");\ndefineMacro(\"\\\\purpleC\", \"\\\\textcolor{##aa87ff}{#1}\");\ndefineMacro(\"\\\\purpleD\", \"\\\\textcolor{##7854ab}{#1}\");\ndefineMacro(\"\\\\purpleE\", \"\\\\textcolor{##543b78}{#1}\");\ndefineMacro(\"\\\\mintA\", \"\\\\textcolor{##f5f9e8}{#1}\");\ndefineMacro(\"\\\\mintB\", \"\\\\textcolor{##edf2df}{#1}\");\ndefineMacro(\"\\\\mintC\", \"\\\\textcolor{##e0e5cc}{#1}\");\ndefineMacro(\"\\\\grayA\", \"\\\\textcolor{##f6f7f7}{#1}\");\ndefineMacro(\"\\\\grayB\", \"\\\\textcolor{##f0f1f2}{#1}\");\ndefineMacro(\"\\\\grayC\", \"\\\\textcolor{##e3e5e6}{#1}\");\ndefineMacro(\"\\\\grayD\", \"\\\\textcolor{##d6d8da}{#1}\");\ndefineMacro(\"\\\\grayE\", \"\\\\textcolor{##babec2}{#1}\");\ndefineMacro(\"\\\\grayF\", \"\\\\textcolor{##888d93}{#1}\");\ndefineMacro(\"\\\\grayG\", \"\\\\textcolor{##626569}{#1}\");\ndefineMacro(\"\\\\grayH\", \"\\\\textcolor{##3b3e40}{#1}\");\ndefineMacro(\"\\\\grayI\", \"\\\\textcolor{##21242c}{#1}\");\ndefineMacro(\"\\\\kaBlue\", \"\\\\textcolor{##314453}{#1}\");\ndefineMacro(\"\\\\kaGreen\", \"\\\\textcolor{##71B307}{#1}\");\n\n/**\n * This file contains the \u201Cgullet\u201D where macros are expanded\n * until only non-macro tokens remain.\n */\n// List of commands that act like macros but aren't defined as a macro,\n// function, or symbol. Used in `isDefined`.\nvar implicitCommands = {\n \"^\": true,\n // Parser.js\n \"_\": true,\n // Parser.js\n \"\\\\limits\": true,\n // Parser.js\n \"\\\\nolimits\": true // Parser.js\n\n};\nclass MacroExpander {\n constructor(input, settings, mode) {\n this.settings = void 0;\n this.expansionCount = void 0;\n this.lexer = void 0;\n this.macros = void 0;\n this.stack = void 0;\n this.mode = void 0;\n this.settings = settings;\n this.expansionCount = 0;\n this.feed(input); // Make new global namespace\n\n this.macros = new Namespace(macros, settings.macros);\n this.mode = mode;\n this.stack = []; // contains tokens in REVERSE order\n }\n /**\n * Feed a new input string to the same MacroExpander\n * (with existing macros etc.).\n */\n\n\n feed(input) {\n this.lexer = new Lexer(input, this.settings);\n }\n /**\n * Switches between \"text\" and \"math\" modes.\n */\n\n\n switchMode(newMode) {\n this.mode = newMode;\n }\n /**\n * Start a new group nesting within all namespaces.\n */\n\n\n beginGroup() {\n this.macros.beginGroup();\n }\n /**\n * End current group nesting within all namespaces.\n */\n\n\n endGroup() {\n this.macros.endGroup();\n }\n /**\n * Ends all currently nested groups (if any), restoring values before the\n * groups began. Useful in case of an error in the middle of parsing.\n */\n\n\n endGroups() {\n this.macros.endGroups();\n }\n /**\n * Returns the topmost token on the stack, without expanding it.\n * Similar in behavior to TeX's `\\futurelet`.\n */\n\n\n future() {\n if (this.stack.length === 0) {\n this.pushToken(this.lexer.lex());\n }\n\n return this.stack[this.stack.length - 1];\n }\n /**\n * Remove and return the next unexpanded token.\n */\n\n\n popToken() {\n this.future(); // ensure non-empty stack\n\n return this.stack.pop();\n }\n /**\n * Add a given token to the token stack. In particular, this get be used\n * to put back a token returned from one of the other methods.\n */\n\n\n pushToken(token) {\n this.stack.push(token);\n }\n /**\n * Append an array of tokens to the token stack.\n */\n\n\n pushTokens(tokens) {\n this.stack.push(...tokens);\n }\n /**\n * Find an macro argument without expanding tokens and append the array of\n * tokens to the token stack. Uses Token as a container for the result.\n */\n\n\n scanArgument(isOptional) {\n var start;\n var end;\n var tokens;\n\n if (isOptional) {\n this.consumeSpaces(); // \\@ifnextchar gobbles any space following it\n\n if (this.future().text !== \"[\") {\n return null;\n }\n\n start = this.popToken(); // don't include [ in tokens\n\n ({\n tokens,\n end\n } = this.consumeArg([\"]\"]));\n } else {\n ({\n tokens,\n start,\n end\n } = this.consumeArg());\n } // indicate the end of an argument\n\n\n this.pushToken(new Token(\"EOF\", end.loc));\n this.pushTokens(tokens);\n return start.range(end, \"\");\n }\n /**\n * Consume all following space tokens, without expansion.\n */\n\n\n consumeSpaces() {\n for (;;) {\n var token = this.future();\n\n if (token.text === \" \") {\n this.stack.pop();\n } else {\n break;\n }\n }\n }\n /**\n * Consume an argument from the token stream, and return the resulting array\n * of tokens and start/end token.\n */\n\n\n consumeArg(delims) {\n // The argument for a delimited parameter is the shortest (possibly\n // empty) sequence of tokens with properly nested {...} groups that is\n // followed ... by this particular list of non-parameter tokens.\n // The argument for an undelimited parameter is the next nonblank\n // token, unless that token is \u2018{\u2019, when the argument will be the\n // entire {...} group that follows.\n var tokens = [];\n var isDelimited = delims && delims.length > 0;\n\n if (!isDelimited) {\n // Ignore spaces between arguments. As the TeXbook says:\n // \"After you have said \u2018\\def\\row#1#2{...}\u2019, you are allowed to\n // put spaces between the arguments (e.g., \u2018\\row x n\u2019), because\n // TeX doesn\u2019t use single spaces as undelimited arguments.\"\n this.consumeSpaces();\n }\n\n var start = this.future();\n var tok;\n var depth = 0;\n var match = 0;\n\n do {\n tok = this.popToken();\n tokens.push(tok);\n\n if (tok.text === \"{\") {\n ++depth;\n } else if (tok.text === \"}\") {\n --depth;\n\n if (depth === -1) {\n throw new ParseError(\"Extra }\", tok);\n }\n } else if (tok.text === \"EOF\") {\n throw new ParseError(\"Unexpected end of input in a macro argument\" + \", expected '\" + (delims && isDelimited ? delims[match] : \"}\") + \"'\", tok);\n }\n\n if (delims && isDelimited) {\n if ((depth === 0 || depth === 1 && delims[match] === \"{\") && tok.text === delims[match]) {\n ++match;\n\n if (match === delims.length) {\n // don't include delims in tokens\n tokens.splice(-match, match);\n break;\n }\n } else {\n match = 0;\n }\n }\n } while (depth !== 0 || isDelimited); // If the argument found ... has the form \u2018{}\u2019,\n // ... the outermost braces enclosing the argument are removed\n\n\n if (start.text === \"{\" && tokens[tokens.length - 1].text === \"}\") {\n tokens.pop();\n tokens.shift();\n }\n\n tokens.reverse(); // to fit in with stack order\n\n return {\n tokens,\n start,\n end: tok\n };\n }\n /**\n * Consume the specified number of (delimited) arguments from the token\n * stream and return the resulting array of arguments.\n */\n\n\n consumeArgs(numArgs, delimiters) {\n if (delimiters) {\n if (delimiters.length !== numArgs + 1) {\n throw new ParseError(\"The length of delimiters doesn't match the number of args!\");\n }\n\n var delims = delimiters[0];\n\n for (var i = 0; i < delims.length; i++) {\n var tok = this.popToken();\n\n if (delims[i] !== tok.text) {\n throw new ParseError(\"Use of the macro doesn't match its definition\", tok);\n }\n }\n }\n\n var args = [];\n\n for (var _i = 0; _i < numArgs; _i++) {\n args.push(this.consumeArg(delimiters && delimiters[_i + 1]).tokens);\n }\n\n return args;\n }\n /**\n * Increment `expansionCount` by the specified amount.\n * Throw an error if it exceeds `maxExpand`.\n */\n\n\n countExpansion(amount) {\n this.expansionCount += amount;\n\n if (this.expansionCount > this.settings.maxExpand) {\n throw new ParseError(\"Too many expansions: infinite loop or \" + \"need to increase maxExpand setting\");\n }\n }\n /**\n * Expand the next token only once if possible.\n *\n * If the token is expanded, the resulting tokens will be pushed onto\n * the stack in reverse order, and the number of such tokens will be\n * returned. This number might be zero or positive.\n *\n * If not, the return value is `false`, and the next token remains at the\n * top of the stack.\n *\n * In either case, the next token will be on the top of the stack,\n * or the stack will be empty (in case of empty expansion\n * and no other tokens).\n *\n * Used to implement `expandAfterFuture` and `expandNextToken`.\n *\n * If expandableOnly, only expandable tokens are expanded and\n * an undefined control sequence results in an error.\n */\n\n\n expandOnce(expandableOnly) {\n var topToken = this.popToken();\n var name = topToken.text;\n var expansion = !topToken.noexpand ? this._getExpansion(name) : null;\n\n if (expansion == null || expandableOnly && expansion.unexpandable) {\n if (expandableOnly && expansion == null && name[0] === \"\\\\\" && !this.isDefined(name)) {\n throw new ParseError(\"Undefined control sequence: \" + name);\n }\n\n this.pushToken(topToken);\n return false;\n }\n\n this.countExpansion(1);\n var tokens = expansion.tokens;\n var args = this.consumeArgs(expansion.numArgs, expansion.delimiters);\n\n if (expansion.numArgs) {\n // paste arguments in place of the placeholders\n tokens = tokens.slice(); // make a shallow copy\n\n for (var i = tokens.length - 1; i >= 0; --i) {\n var tok = tokens[i];\n\n if (tok.text === \"#\") {\n if (i === 0) {\n throw new ParseError(\"Incomplete placeholder at end of macro body\", tok);\n }\n\n tok = tokens[--i]; // next token on stack\n\n if (tok.text === \"#\") {\n // ## \u2192 #\n tokens.splice(i + 1, 1); // drop first #\n } else if (/^[1-9]$/.test(tok.text)) {\n // replace the placeholder with the indicated argument\n tokens.splice(i, 2, ...args[+tok.text - 1]);\n } else {\n throw new ParseError(\"Not a valid argument number\", tok);\n }\n }\n }\n } // Concatenate expansion onto top of stack.\n\n\n this.pushTokens(tokens);\n return tokens.length;\n }\n /**\n * Expand the next token only once (if possible), and return the resulting\n * top token on the stack (without removing anything from the stack).\n * Similar in behavior to TeX's `\\expandafter\\futurelet`.\n * Equivalent to expandOnce() followed by future().\n */\n\n\n expandAfterFuture() {\n this.expandOnce();\n return this.future();\n }\n /**\n * Recursively expand first token, then return first non-expandable token.\n */\n\n\n expandNextToken() {\n for (;;) {\n if (this.expandOnce() === false) {\n // fully expanded\n var token = this.stack.pop(); // the token after \\noexpand is interpreted as if its meaning\n // were \u2018\\relax\u2019\n\n if (token.treatAsRelax) {\n token.text = \"\\\\relax\";\n }\n\n return token;\n }\n } // Flow unable to figure out that this pathway is impossible.\n // https://github.com/facebook/flow/issues/4808\n\n\n throw new Error(); // eslint-disable-line no-unreachable\n }\n /**\n * Fully expand the given macro name and return the resulting list of\n * tokens, or return `undefined` if no such macro is defined.\n */\n\n\n expandMacro(name) {\n return this.macros.has(name) ? this.expandTokens([new Token(name)]) : undefined;\n }\n /**\n * Fully expand the given token stream and return the resulting list of\n * tokens. Note that the input tokens are in reverse order, but the\n * output tokens are in forward order.\n */\n\n\n expandTokens(tokens) {\n var output = [];\n var oldStackLength = this.stack.length;\n this.pushTokens(tokens);\n\n while (this.stack.length > oldStackLength) {\n // Expand only expandable tokens\n if (this.expandOnce(true) === false) {\n // fully expanded\n var token = this.stack.pop();\n\n if (token.treatAsRelax) {\n // the expansion of \\noexpand is the token itself\n token.noexpand = false;\n token.treatAsRelax = false;\n }\n\n output.push(token);\n }\n } // Count all of these tokens as additional expansions, to prevent\n // exponential blowup from linearly many \\edef's.\n\n\n this.countExpansion(output.length);\n return output;\n }\n /**\n * Fully expand the given macro name and return the result as a string,\n * or return `undefined` if no such macro is defined.\n */\n\n\n expandMacroAsText(name) {\n var tokens = this.expandMacro(name);\n\n if (tokens) {\n return tokens.map(token => token.text).join(\"\");\n } else {\n return tokens;\n }\n }\n /**\n * Returns the expanded macro as a reversed array of tokens and a macro\n * argument count. Or returns `null` if no such macro.\n */\n\n\n _getExpansion(name) {\n var definition = this.macros.get(name);\n\n if (definition == null) {\n // mainly checking for undefined here\n return definition;\n } // If a single character has an associated catcode other than 13\n // (active character), then don't expand it.\n\n\n if (name.length === 1) {\n var catcode = this.lexer.catcodes[name];\n\n if (catcode != null && catcode !== 13) {\n return;\n }\n }\n\n var expansion = typeof definition === \"function\" ? definition(this) : definition;\n\n if (typeof expansion === \"string\") {\n var numArgs = 0;\n\n if (expansion.indexOf(\"#\") !== -1) {\n var stripped = expansion.replace(/##/g, \"\");\n\n while (stripped.indexOf(\"#\" + (numArgs + 1)) !== -1) {\n ++numArgs;\n }\n }\n\n var bodyLexer = new Lexer(expansion, this.settings);\n var tokens = [];\n var tok = bodyLexer.lex();\n\n while (tok.text !== \"EOF\") {\n tokens.push(tok);\n tok = bodyLexer.lex();\n }\n\n tokens.reverse(); // to fit in with stack using push and pop\n\n var expanded = {\n tokens,\n numArgs\n };\n return expanded;\n }\n\n return expansion;\n }\n /**\n * Determine whether a command is currently \"defined\" (has some\n * functionality), meaning that it's a macro (in the current group),\n * a function, a symbol, or one of the special commands listed in\n * `implicitCommands`.\n */\n\n\n isDefined(name) {\n return this.macros.has(name) || functions.hasOwnProperty(name) || symbols.math.hasOwnProperty(name) || symbols.text.hasOwnProperty(name) || implicitCommands.hasOwnProperty(name);\n }\n /**\n * Determine whether a command is expandable.\n */\n\n\n isExpandable(name) {\n var macro = this.macros.get(name);\n return macro != null ? typeof macro === \"string\" || typeof macro === \"function\" || !macro.unexpandable : functions.hasOwnProperty(name) && !functions[name].primitive;\n }\n\n}\n\n// Helpers for Parser.js handling of Unicode (sub|super)script characters.\nvar unicodeSubRegEx = /^[\u208A\u208B\u208C\u208D\u208E\u2080\u2081\u2082\u2083\u2084\u2085\u2086\u2087\u2088\u2089\u2090\u2091\u2095\u1D62\u2C7C\u2096\u2097\u2098\u2099\u2092\u209A\u1D63\u209B\u209C\u1D64\u1D65\u2093\u1D66\u1D67\u1D68\u1D69\u1D6A]/;\nvar uSubsAndSups = Object.freeze({\n '\u208A': '+',\n '\u208B': '-',\n '\u208C': '=',\n '\u208D': '(',\n '\u208E': ')',\n '\u2080': '0',\n '\u2081': '1',\n '\u2082': '2',\n '\u2083': '3',\n '\u2084': '4',\n '\u2085': '5',\n '\u2086': '6',\n '\u2087': '7',\n '\u2088': '8',\n '\u2089': '9',\n '\\u2090': 'a',\n '\\u2091': 'e',\n '\\u2095': 'h',\n '\\u1D62': 'i',\n '\\u2C7C': 'j',\n '\\u2096': 'k',\n '\\u2097': 'l',\n '\\u2098': 'm',\n '\\u2099': 'n',\n '\\u2092': 'o',\n '\\u209A': 'p',\n '\\u1D63': 'r',\n '\\u209B': 's',\n '\\u209C': 't',\n '\\u1D64': 'u',\n '\\u1D65': 'v',\n '\\u2093': 'x',\n '\\u1D66': '\u03B2',\n '\\u1D67': '\u03B3',\n '\\u1D68': '\u03C1',\n '\\u1D69': '\\u03d5',\n '\\u1D6A': '\u03C7',\n '\u207A': '+',\n '\u207B': '-',\n '\u207C': '=',\n '\u207D': '(',\n '\u207E': ')',\n '\u2070': '0',\n '\u00B9': '1',\n '\u00B2': '2',\n '\u00B3': '3',\n '\u2074': '4',\n '\u2075': '5',\n '\u2076': '6',\n '\u2077': '7',\n '\u2078': '8',\n '\u2079': '9',\n '\\u1D2C': 'A',\n '\\u1D2E': 'B',\n '\\u1D30': 'D',\n '\\u1D31': 'E',\n '\\u1D33': 'G',\n '\\u1D34': 'H',\n '\\u1D35': 'I',\n '\\u1D36': 'J',\n '\\u1D37': 'K',\n '\\u1D38': 'L',\n '\\u1D39': 'M',\n '\\u1D3A': 'N',\n '\\u1D3C': 'O',\n '\\u1D3E': 'P',\n '\\u1D3F': 'R',\n '\\u1D40': 'T',\n '\\u1D41': 'U',\n '\\u2C7D': 'V',\n '\\u1D42': 'W',\n '\\u1D43': 'a',\n '\\u1D47': 'b',\n '\\u1D9C': 'c',\n '\\u1D48': 'd',\n '\\u1D49': 'e',\n '\\u1DA0': 'f',\n '\\u1D4D': 'g',\n '\\u02B0': 'h',\n '\\u2071': 'i',\n '\\u02B2': 'j',\n '\\u1D4F': 'k',\n '\\u02E1': 'l',\n '\\u1D50': 'm',\n '\\u207F': 'n',\n '\\u1D52': 'o',\n '\\u1D56': 'p',\n '\\u02B3': 'r',\n '\\u02E2': 's',\n '\\u1D57': 't',\n '\\u1D58': 'u',\n '\\u1D5B': 'v',\n '\\u02B7': 'w',\n '\\u02E3': 'x',\n '\\u02B8': 'y',\n '\\u1DBB': 'z',\n '\\u1D5D': '\u03B2',\n '\\u1D5E': '\u03B3',\n '\\u1D5F': '\u03B4',\n '\\u1D60': '\\u03d5',\n '\\u1D61': '\u03C7',\n '\\u1DBF': '\u03B8'\n});\n\n/* eslint no-constant-condition:0 */\n\nvar unicodeAccents = {\n \"\u0301\": {\n \"text\": \"\\\\'\",\n \"math\": \"\\\\acute\"\n },\n \"\u0300\": {\n \"text\": \"\\\\`\",\n \"math\": \"\\\\grave\"\n },\n \"\u0308\": {\n \"text\": \"\\\\\\\"\",\n \"math\": \"\\\\ddot\"\n },\n \"\u0303\": {\n \"text\": \"\\\\~\",\n \"math\": \"\\\\tilde\"\n },\n \"\u0304\": {\n \"text\": \"\\\\=\",\n \"math\": \"\\\\bar\"\n },\n \"\u0306\": {\n \"text\": \"\\\\u\",\n \"math\": \"\\\\breve\"\n },\n \"\u030C\": {\n \"text\": \"\\\\v\",\n \"math\": \"\\\\check\"\n },\n \"\u0302\": {\n \"text\": \"\\\\^\",\n \"math\": \"\\\\hat\"\n },\n \"\u0307\": {\n \"text\": \"\\\\.\",\n \"math\": \"\\\\dot\"\n },\n \"\u030A\": {\n \"text\": \"\\\\r\",\n \"math\": \"\\\\mathring\"\n },\n \"\u030B\": {\n \"text\": \"\\\\H\"\n },\n \"\u0327\": {\n \"text\": \"\\\\c\"\n }\n};\nvar unicodeSymbols = {\n \"\u00E1\": \"a\u0301\",\n \"\u00E0\": \"a\u0300\",\n \"\u00E4\": \"a\u0308\",\n \"\u01DF\": \"a\u0308\u0304\",\n \"\u00E3\": \"a\u0303\",\n \"\u0101\": \"a\u0304\",\n \"\u0103\": \"a\u0306\",\n \"\u1EAF\": \"a\u0306\u0301\",\n \"\u1EB1\": \"a\u0306\u0300\",\n \"\u1EB5\": \"a\u0306\u0303\",\n \"\u01CE\": \"a\u030C\",\n \"\u00E2\": \"a\u0302\",\n \"\u1EA5\": \"a\u0302\u0301\",\n \"\u1EA7\": \"a\u0302\u0300\",\n \"\u1EAB\": \"a\u0302\u0303\",\n \"\u0227\": \"a\u0307\",\n \"\u01E1\": \"a\u0307\u0304\",\n \"\u00E5\": \"a\u030A\",\n \"\u01FB\": \"a\u030A\u0301\",\n \"\u1E03\": \"b\u0307\",\n \"\u0107\": \"c\u0301\",\n \"\u1E09\": \"c\u0327\u0301\",\n \"\u010D\": \"c\u030C\",\n \"\u0109\": \"c\u0302\",\n \"\u010B\": \"c\u0307\",\n \"\u00E7\": \"c\u0327\",\n \"\u010F\": \"d\u030C\",\n \"\u1E0B\": \"d\u0307\",\n \"\u1E11\": \"d\u0327\",\n \"\u00E9\": \"e\u0301\",\n \"\u00E8\": \"e\u0300\",\n \"\u00EB\": \"e\u0308\",\n \"\u1EBD\": \"e\u0303\",\n \"\u0113\": \"e\u0304\",\n \"\u1E17\": \"e\u0304\u0301\",\n \"\u1E15\": \"e\u0304\u0300\",\n \"\u0115\": \"e\u0306\",\n \"\u1E1D\": \"e\u0327\u0306\",\n \"\u011B\": \"e\u030C\",\n \"\u00EA\": \"e\u0302\",\n \"\u1EBF\": \"e\u0302\u0301\",\n \"\u1EC1\": \"e\u0302\u0300\",\n \"\u1EC5\": \"e\u0302\u0303\",\n \"\u0117\": \"e\u0307\",\n \"\u0229\": \"e\u0327\",\n \"\u1E1F\": \"f\u0307\",\n \"\u01F5\": \"g\u0301\",\n \"\u1E21\": \"g\u0304\",\n \"\u011F\": \"g\u0306\",\n \"\u01E7\": \"g\u030C\",\n \"\u011D\": \"g\u0302\",\n \"\u0121\": \"g\u0307\",\n \"\u0123\": \"g\u0327\",\n \"\u1E27\": \"h\u0308\",\n \"\u021F\": \"h\u030C\",\n \"\u0125\": \"h\u0302\",\n \"\u1E23\": \"h\u0307\",\n \"\u1E29\": \"h\u0327\",\n \"\u00ED\": \"i\u0301\",\n \"\u00EC\": \"i\u0300\",\n \"\u00EF\": \"i\u0308\",\n \"\u1E2F\": \"i\u0308\u0301\",\n \"\u0129\": \"i\u0303\",\n \"\u012B\": \"i\u0304\",\n \"\u012D\": \"i\u0306\",\n \"\u01D0\": \"i\u030C\",\n \"\u00EE\": \"i\u0302\",\n \"\u01F0\": \"j\u030C\",\n \"\u0135\": \"j\u0302\",\n \"\u1E31\": \"k\u0301\",\n \"\u01E9\": \"k\u030C\",\n \"\u0137\": \"k\u0327\",\n \"\u013A\": \"l\u0301\",\n \"\u013E\": \"l\u030C\",\n \"\u013C\": \"l\u0327\",\n \"\u1E3F\": \"m\u0301\",\n \"\u1E41\": \"m\u0307\",\n \"\u0144\": \"n\u0301\",\n \"\u01F9\": \"n\u0300\",\n \"\u00F1\": \"n\u0303\",\n \"\u0148\": \"n\u030C\",\n \"\u1E45\": \"n\u0307\",\n \"\u0146\": \"n\u0327\",\n \"\u00F3\": \"o\u0301\",\n \"\u00F2\": \"o\u0300\",\n \"\u00F6\": \"o\u0308\",\n \"\u022B\": \"o\u0308\u0304\",\n \"\u00F5\": \"o\u0303\",\n \"\u1E4D\": \"o\u0303\u0301\",\n \"\u1E4F\": \"o\u0303\u0308\",\n \"\u022D\": \"o\u0303\u0304\",\n \"\u014D\": \"o\u0304\",\n \"\u1E53\": \"o\u0304\u0301\",\n \"\u1E51\": \"o\u0304\u0300\",\n \"\u014F\": \"o\u0306\",\n \"\u01D2\": \"o\u030C\",\n \"\u00F4\": \"o\u0302\",\n \"\u1ED1\": \"o\u0302\u0301\",\n \"\u1ED3\": \"o\u0302\u0300\",\n \"\u1ED7\": \"o\u0302\u0303\",\n \"\u022F\": \"o\u0307\",\n \"\u0231\": \"o\u0307\u0304\",\n \"\u0151\": \"o\u030B\",\n \"\u1E55\": \"p\u0301\",\n \"\u1E57\": \"p\u0307\",\n \"\u0155\": \"r\u0301\",\n \"\u0159\": \"r\u030C\",\n \"\u1E59\": \"r\u0307\",\n \"\u0157\": \"r\u0327\",\n \"\u015B\": \"s\u0301\",\n \"\u1E65\": \"s\u0301\u0307\",\n \"\u0161\": \"s\u030C\",\n \"\u1E67\": \"s\u030C\u0307\",\n \"\u015D\": \"s\u0302\",\n \"\u1E61\": \"s\u0307\",\n \"\u015F\": \"s\u0327\",\n \"\u1E97\": \"t\u0308\",\n \"\u0165\": \"t\u030C\",\n \"\u1E6B\": \"t\u0307\",\n \"\u0163\": \"t\u0327\",\n \"\u00FA\": \"u\u0301\",\n \"\u00F9\": \"u\u0300\",\n \"\u00FC\": \"u\u0308\",\n \"\u01D8\": \"u\u0308\u0301\",\n \"\u01DC\": \"u\u0308\u0300\",\n \"\u01D6\": \"u\u0308\u0304\",\n \"\u01DA\": \"u\u0308\u030C\",\n \"\u0169\": \"u\u0303\",\n \"\u1E79\": \"u\u0303\u0301\",\n \"\u016B\": \"u\u0304\",\n \"\u1E7B\": \"u\u0304\u0308\",\n \"\u016D\": \"u\u0306\",\n \"\u01D4\": \"u\u030C\",\n \"\u00FB\": \"u\u0302\",\n \"\u016F\": \"u\u030A\",\n \"\u0171\": \"u\u030B\",\n \"\u1E7D\": \"v\u0303\",\n \"\u1E83\": \"w\u0301\",\n \"\u1E81\": \"w\u0300\",\n \"\u1E85\": \"w\u0308\",\n \"\u0175\": \"w\u0302\",\n \"\u1E87\": \"w\u0307\",\n \"\u1E98\": \"w\u030A\",\n \"\u1E8D\": \"x\u0308\",\n \"\u1E8B\": \"x\u0307\",\n \"\u00FD\": \"y\u0301\",\n \"\u1EF3\": \"y\u0300\",\n \"\u00FF\": \"y\u0308\",\n \"\u1EF9\": \"y\u0303\",\n \"\u0233\": \"y\u0304\",\n \"\u0177\": \"y\u0302\",\n \"\u1E8F\": \"y\u0307\",\n \"\u1E99\": \"y\u030A\",\n \"\u017A\": \"z\u0301\",\n \"\u017E\": \"z\u030C\",\n \"\u1E91\": \"z\u0302\",\n \"\u017C\": \"z\u0307\",\n \"\u00C1\": \"A\u0301\",\n \"\u00C0\": \"A\u0300\",\n \"\u00C4\": \"A\u0308\",\n \"\u01DE\": \"A\u0308\u0304\",\n \"\u00C3\": \"A\u0303\",\n \"\u0100\": \"A\u0304\",\n \"\u0102\": \"A\u0306\",\n \"\u1EAE\": \"A\u0306\u0301\",\n \"\u1EB0\": \"A\u0306\u0300\",\n \"\u1EB4\": \"A\u0306\u0303\",\n \"\u01CD\": \"A\u030C\",\n \"\u00C2\": \"A\u0302\",\n \"\u1EA4\": \"A\u0302\u0301\",\n \"\u1EA6\": \"A\u0302\u0300\",\n \"\u1EAA\": \"A\u0302\u0303\",\n \"\u0226\": \"A\u0307\",\n \"\u01E0\": \"A\u0307\u0304\",\n \"\u00C5\": \"A\u030A\",\n \"\u01FA\": \"A\u030A\u0301\",\n \"\u1E02\": \"B\u0307\",\n \"\u0106\": \"C\u0301\",\n \"\u1E08\": \"C\u0327\u0301\",\n \"\u010C\": \"C\u030C\",\n \"\u0108\": \"C\u0302\",\n \"\u010A\": \"C\u0307\",\n \"\u00C7\": \"C\u0327\",\n \"\u010E\": \"D\u030C\",\n \"\u1E0A\": \"D\u0307\",\n \"\u1E10\": \"D\u0327\",\n \"\u00C9\": \"E\u0301\",\n \"\u00C8\": \"E\u0300\",\n \"\u00CB\": \"E\u0308\",\n \"\u1EBC\": \"E\u0303\",\n \"\u0112\": \"E\u0304\",\n \"\u1E16\": \"E\u0304\u0301\",\n \"\u1E14\": \"E\u0304\u0300\",\n \"\u0114\": \"E\u0306\",\n \"\u1E1C\": \"E\u0327\u0306\",\n \"\u011A\": \"E\u030C\",\n \"\u00CA\": \"E\u0302\",\n \"\u1EBE\": \"E\u0302\u0301\",\n \"\u1EC0\": \"E\u0302\u0300\",\n \"\u1EC4\": \"E\u0302\u0303\",\n \"\u0116\": \"E\u0307\",\n \"\u0228\": \"E\u0327\",\n \"\u1E1E\": \"F\u0307\",\n \"\u01F4\": \"G\u0301\",\n \"\u1E20\": \"G\u0304\",\n \"\u011E\": \"G\u0306\",\n \"\u01E6\": \"G\u030C\",\n \"\u011C\": \"G\u0302\",\n \"\u0120\": \"G\u0307\",\n \"\u0122\": \"G\u0327\",\n \"\u1E26\": \"H\u0308\",\n \"\u021E\": \"H\u030C\",\n \"\u0124\": \"H\u0302\",\n \"\u1E22\": \"H\u0307\",\n \"\u1E28\": \"H\u0327\",\n \"\u00CD\": \"I\u0301\",\n \"\u00CC\": \"I\u0300\",\n \"\u00CF\": \"I\u0308\",\n \"\u1E2E\": \"I\u0308\u0301\",\n \"\u0128\": \"I\u0303\",\n \"\u012A\": \"I\u0304\",\n \"\u012C\": \"I\u0306\",\n \"\u01CF\": \"I\u030C\",\n \"\u00CE\": \"I\u0302\",\n \"\u0130\": \"I\u0307\",\n \"\u0134\": \"J\u0302\",\n \"\u1E30\": \"K\u0301\",\n \"\u01E8\": \"K\u030C\",\n \"\u0136\": \"K\u0327\",\n \"\u0139\": \"L\u0301\",\n \"\u013D\": \"L\u030C\",\n \"\u013B\": \"L\u0327\",\n \"\u1E3E\": \"M\u0301\",\n \"\u1E40\": \"M\u0307\",\n \"\u0143\": \"N\u0301\",\n \"\u01F8\": \"N\u0300\",\n \"\u00D1\": \"N\u0303\",\n \"\u0147\": \"N\u030C\",\n \"\u1E44\": \"N\u0307\",\n \"\u0145\": \"N\u0327\",\n \"\u00D3\": \"O\u0301\",\n \"\u00D2\": \"O\u0300\",\n \"\u00D6\": \"O\u0308\",\n \"\u022A\": \"O\u0308\u0304\",\n \"\u00D5\": \"O\u0303\",\n \"\u1E4C\": \"O\u0303\u0301\",\n \"\u1E4E\": \"O\u0303\u0308\",\n \"\u022C\": \"O\u0303\u0304\",\n \"\u014C\": \"O\u0304\",\n \"\u1E52\": \"O\u0304\u0301\",\n \"\u1E50\": \"O\u0304\u0300\",\n \"\u014E\": \"O\u0306\",\n \"\u01D1\": \"O\u030C\",\n \"\u00D4\": \"O\u0302\",\n \"\u1ED0\": \"O\u0302\u0301\",\n \"\u1ED2\": \"O\u0302\u0300\",\n \"\u1ED6\": \"O\u0302\u0303\",\n \"\u022E\": \"O\u0307\",\n \"\u0230\": \"O\u0307\u0304\",\n \"\u0150\": \"O\u030B\",\n \"\u1E54\": \"P\u0301\",\n \"\u1E56\": \"P\u0307\",\n \"\u0154\": \"R\u0301\",\n \"\u0158\": \"R\u030C\",\n \"\u1E58\": \"R\u0307\",\n \"\u0156\": \"R\u0327\",\n \"\u015A\": \"S\u0301\",\n \"\u1E64\": \"S\u0301\u0307\",\n \"\u0160\": \"S\u030C\",\n \"\u1E66\": \"S\u030C\u0307\",\n \"\u015C\": \"S\u0302\",\n \"\u1E60\": \"S\u0307\",\n \"\u015E\": \"S\u0327\",\n \"\u0164\": \"T\u030C\",\n \"\u1E6A\": \"T\u0307\",\n \"\u0162\": \"T\u0327\",\n \"\u00DA\": \"U\u0301\",\n \"\u00D9\": \"U\u0300\",\n \"\u00DC\": \"U\u0308\",\n \"\u01D7\": \"U\u0308\u0301\",\n \"\u01DB\": \"U\u0308\u0300\",\n \"\u01D5\": \"U\u0308\u0304\",\n \"\u01D9\": \"U\u0308\u030C\",\n \"\u0168\": \"U\u0303\",\n \"\u1E78\": \"U\u0303\u0301\",\n \"\u016A\": \"U\u0304\",\n \"\u1E7A\": \"U\u0304\u0308\",\n \"\u016C\": \"U\u0306\",\n \"\u01D3\": \"U\u030C\",\n \"\u00DB\": \"U\u0302\",\n \"\u016E\": \"U\u030A\",\n \"\u0170\": \"U\u030B\",\n \"\u1E7C\": \"V\u0303\",\n \"\u1E82\": \"W\u0301\",\n \"\u1E80\": \"W\u0300\",\n \"\u1E84\": \"W\u0308\",\n \"\u0174\": \"W\u0302\",\n \"\u1E86\": \"W\u0307\",\n \"\u1E8C\": \"X\u0308\",\n \"\u1E8A\": \"X\u0307\",\n \"\u00DD\": \"Y\u0301\",\n \"\u1EF2\": \"Y\u0300\",\n \"\u0178\": \"Y\u0308\",\n \"\u1EF8\": \"Y\u0303\",\n \"\u0232\": \"Y\u0304\",\n \"\u0176\": \"Y\u0302\",\n \"\u1E8E\": \"Y\u0307\",\n \"\u0179\": \"Z\u0301\",\n \"\u017D\": \"Z\u030C\",\n \"\u1E90\": \"Z\u0302\",\n \"\u017B\": \"Z\u0307\",\n \"\u03AC\": \"\u03B1\u0301\",\n \"\u1F70\": \"\u03B1\u0300\",\n \"\u1FB1\": \"\u03B1\u0304\",\n \"\u1FB0\": \"\u03B1\u0306\",\n \"\u03AD\": \"\u03B5\u0301\",\n \"\u1F72\": \"\u03B5\u0300\",\n \"\u03AE\": \"\u03B7\u0301\",\n \"\u1F74\": \"\u03B7\u0300\",\n \"\u03AF\": \"\u03B9\u0301\",\n \"\u1F76\": \"\u03B9\u0300\",\n \"\u03CA\": \"\u03B9\u0308\",\n \"\u0390\": \"\u03B9\u0308\u0301\",\n \"\u1FD2\": \"\u03B9\u0308\u0300\",\n \"\u1FD1\": \"\u03B9\u0304\",\n \"\u1FD0\": \"\u03B9\u0306\",\n \"\u03CC\": \"\u03BF\u0301\",\n \"\u1F78\": \"\u03BF\u0300\",\n \"\u03CD\": \"\u03C5\u0301\",\n \"\u1F7A\": \"\u03C5\u0300\",\n \"\u03CB\": \"\u03C5\u0308\",\n \"\u03B0\": \"\u03C5\u0308\u0301\",\n \"\u1FE2\": \"\u03C5\u0308\u0300\",\n \"\u1FE1\": \"\u03C5\u0304\",\n \"\u1FE0\": \"\u03C5\u0306\",\n \"\u03CE\": \"\u03C9\u0301\",\n \"\u1F7C\": \"\u03C9\u0300\",\n \"\u038E\": \"\u03A5\u0301\",\n \"\u1FEA\": \"\u03A5\u0300\",\n \"\u03AB\": \"\u03A5\u0308\",\n \"\u1FE9\": \"\u03A5\u0304\",\n \"\u1FE8\": \"\u03A5\u0306\",\n \"\u038F\": \"\u03A9\u0301\",\n \"\u1FFA\": \"\u03A9\u0300\"\n};\n\n/**\n * This file contains the parser used to parse out a TeX expression from the\n * input. Since TeX isn't context-free, standard parsers don't work particularly\n * well.\n *\n * The strategy of this parser is as such:\n *\n * The main functions (the `.parse...` ones) take a position in the current\n * parse string to parse tokens from. The lexer (found in Lexer.js, stored at\n * this.gullet.lexer) also supports pulling out tokens at arbitrary places. When\n * individual tokens are needed at a position, the lexer is called to pull out a\n * token, which is then used.\n *\n * The parser has a property called \"mode\" indicating the mode that\n * the parser is currently in. Currently it has to be one of \"math\" or\n * \"text\", which denotes whether the current environment is a math-y\n * one or a text-y one (e.g. inside \\text). Currently, this serves to\n * limit the functions which can be used in text mode.\n *\n * The main functions then return an object which contains the useful data that\n * was parsed at its given point, and a new position at the end of the parsed\n * data. The main functions can call each other and continue the parsing by\n * using the returned position as a new starting point.\n *\n * There are also extra `.handle...` functions, which pull out some reused\n * functionality into self-contained functions.\n *\n * The functions return ParseNodes.\n */\nclass Parser {\n constructor(input, settings) {\n this.mode = void 0;\n this.gullet = void 0;\n this.settings = void 0;\n this.leftrightDepth = void 0;\n this.nextToken = void 0;\n // Start in math mode\n this.mode = \"math\"; // Create a new macro expander (gullet) and (indirectly via that) also a\n // new lexer (mouth) for this parser (stomach, in the language of TeX)\n\n this.gullet = new MacroExpander(input, settings, this.mode); // Store the settings for use in parsing\n\n this.settings = settings; // Count leftright depth (for \\middle errors)\n\n this.leftrightDepth = 0;\n }\n /**\n * Checks a result to make sure it has the right type, and throws an\n * appropriate error otherwise.\n */\n\n\n expect(text, consume) {\n if (consume === void 0) {\n consume = true;\n }\n\n if (this.fetch().text !== text) {\n throw new ParseError(\"Expected '\" + text + \"', got '\" + this.fetch().text + \"'\", this.fetch());\n }\n\n if (consume) {\n this.consume();\n }\n }\n /**\n * Discards the current lookahead token, considering it consumed.\n */\n\n\n consume() {\n this.nextToken = null;\n }\n /**\n * Return the current lookahead token, or if there isn't one (at the\n * beginning, or if the previous lookahead token was consume()d),\n * fetch the next token as the new lookahead token and return it.\n */\n\n\n fetch() {\n if (this.nextToken == null) {\n this.nextToken = this.gullet.expandNextToken();\n }\n\n return this.nextToken;\n }\n /**\n * Switches between \"text\" and \"math\" modes.\n */\n\n\n switchMode(newMode) {\n this.mode = newMode;\n this.gullet.switchMode(newMode);\n }\n /**\n * Main parsing function, which parses an entire input.\n */\n\n\n parse() {\n if (!this.settings.globalGroup) {\n // Create a group namespace for the math expression.\n // (LaTeX creates a new group for every $...$, $$...$$, \\[...\\].)\n this.gullet.beginGroup();\n } // Use old \\color behavior (same as LaTeX's \\textcolor) if requested.\n // We do this within the group for the math expression, so it doesn't\n // pollute settings.macros.\n\n\n if (this.settings.colorIsTextColor) {\n this.gullet.macros.set(\"\\\\color\", \"\\\\textcolor\");\n }\n\n try {\n // Try to parse the input\n var parse = this.parseExpression(false); // If we succeeded, make sure there's an EOF at the end\n\n this.expect(\"EOF\"); // End the group namespace for the expression\n\n if (!this.settings.globalGroup) {\n this.gullet.endGroup();\n }\n\n return parse; // Close any leftover groups in case of a parse error.\n } finally {\n this.gullet.endGroups();\n }\n }\n /**\n * Fully parse a separate sequence of tokens as a separate job.\n * Tokens should be specified in reverse order, as in a MacroDefinition.\n */\n\n\n subparse(tokens) {\n // Save the next token from the current job.\n var oldToken = this.nextToken;\n this.consume(); // Run the new job, terminating it with an excess '}'\n\n this.gullet.pushToken(new Token(\"}\"));\n this.gullet.pushTokens(tokens);\n var parse = this.parseExpression(false);\n this.expect(\"}\"); // Restore the next token from the current job.\n\n this.nextToken = oldToken;\n return parse;\n }\n\n /**\n * Parses an \"expression\", which is a list of atoms.\n *\n * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This\n * happens when functions have higher precedence han infix\n * nodes in implicit parses.\n *\n * `breakOnTokenText`: The text of the token that the expression should end\n * with, or `null` if something else should end the\n * expression.\n */\n parseExpression(breakOnInfix, breakOnTokenText) {\n var body = []; // Keep adding atoms to the body until we can't parse any more atoms (either\n // we reached the end, a }, or a \\right)\n\n while (true) {\n // Ignore spaces in math mode\n if (this.mode === \"math\") {\n this.consumeSpaces();\n }\n\n var lex = this.fetch();\n\n if (Parser.endOfExpression.indexOf(lex.text) !== -1) {\n break;\n }\n\n if (breakOnTokenText && lex.text === breakOnTokenText) {\n break;\n }\n\n if (breakOnInfix && functions[lex.text] && functions[lex.text].infix) {\n break;\n }\n\n var atom = this.parseAtom(breakOnTokenText);\n\n if (!atom) {\n break;\n } else if (atom.type === \"internal\") {\n continue;\n }\n\n body.push(atom);\n }\n\n if (this.mode === \"text\") {\n this.formLigatures(body);\n }\n\n return this.handleInfixNodes(body);\n }\n /**\n * Rewrites infix operators such as \\over with corresponding commands such\n * as \\frac.\n *\n * There can only be one infix operator per group. If there's more than one\n * then the expression is ambiguous. This can be resolved by adding {}.\n */\n\n\n handleInfixNodes(body) {\n var overIndex = -1;\n var funcName;\n\n for (var i = 0; i < body.length; i++) {\n if (body[i].type === \"infix\") {\n if (overIndex !== -1) {\n throw new ParseError(\"only one infix operator per group\", body[i].token);\n }\n\n overIndex = i;\n funcName = body[i].replaceWith;\n }\n }\n\n if (overIndex !== -1 && funcName) {\n var numerNode;\n var denomNode;\n var numerBody = body.slice(0, overIndex);\n var denomBody = body.slice(overIndex + 1);\n\n if (numerBody.length === 1 && numerBody[0].type === \"ordgroup\") {\n numerNode = numerBody[0];\n } else {\n numerNode = {\n type: \"ordgroup\",\n mode: this.mode,\n body: numerBody\n };\n }\n\n if (denomBody.length === 1 && denomBody[0].type === \"ordgroup\") {\n denomNode = denomBody[0];\n } else {\n denomNode = {\n type: \"ordgroup\",\n mode: this.mode,\n body: denomBody\n };\n }\n\n var node;\n\n if (funcName === \"\\\\\\\\abovefrac\") {\n node = this.callFunction(funcName, [numerNode, body[overIndex], denomNode], []);\n } else {\n node = this.callFunction(funcName, [numerNode, denomNode], []);\n }\n\n return [node];\n } else {\n return body;\n }\n }\n /**\n * Handle a subscript or superscript with nice errors.\n */\n\n\n handleSupSubscript(name // For error reporting.\n ) {\n var symbolToken = this.fetch();\n var symbol = symbolToken.text;\n this.consume();\n this.consumeSpaces(); // ignore spaces before sup/subscript argument\n\n var group = this.parseGroup(name);\n\n if (!group) {\n throw new ParseError(\"Expected group after '\" + symbol + \"'\", symbolToken);\n }\n\n return group;\n }\n /**\n * Converts the textual input of an unsupported command into a text node\n * contained within a color node whose color is determined by errorColor\n */\n\n\n formatUnsupportedCmd(text) {\n var textordArray = [];\n\n for (var i = 0; i < text.length; i++) {\n textordArray.push({\n type: \"textord\",\n mode: \"text\",\n text: text[i]\n });\n }\n\n var textNode = {\n type: \"text\",\n mode: this.mode,\n body: textordArray\n };\n var colorNode = {\n type: \"color\",\n mode: this.mode,\n color: this.settings.errorColor,\n body: [textNode]\n };\n return colorNode;\n }\n /**\n * Parses a group with optional super/subscripts.\n */\n\n\n parseAtom(breakOnTokenText) {\n // The body of an atom is an implicit group, so that things like\n // \\left(x\\right)^2 work correctly.\n var base = this.parseGroup(\"atom\", breakOnTokenText); // In text mode, we don't have superscripts or subscripts\n\n if (this.mode === \"text\") {\n return base;\n } // Note that base may be empty (i.e. null) at this point.\n\n\n var superscript;\n var subscript;\n\n while (true) {\n // Guaranteed in math mode, so eat any spaces first.\n this.consumeSpaces(); // Lex the first token\n\n var lex = this.fetch();\n\n if (lex.text === \"\\\\limits\" || lex.text === \"\\\\nolimits\") {\n // We got a limit control\n if (base && base.type === \"op\") {\n var limits = lex.text === \"\\\\limits\";\n base.limits = limits;\n base.alwaysHandleSupSub = true;\n } else if (base && base.type === \"operatorname\") {\n if (base.alwaysHandleSupSub) {\n base.limits = lex.text === \"\\\\limits\";\n }\n } else {\n throw new ParseError(\"Limit controls must follow a math operator\", lex);\n }\n\n this.consume();\n } else if (lex.text === \"^\") {\n // We got a superscript start\n if (superscript) {\n throw new ParseError(\"Double superscript\", lex);\n }\n\n superscript = this.handleSupSubscript(\"superscript\");\n } else if (lex.text === \"_\") {\n // We got a subscript start\n if (subscript) {\n throw new ParseError(\"Double subscript\", lex);\n }\n\n subscript = this.handleSupSubscript(\"subscript\");\n } else if (lex.text === \"'\") {\n // We got a prime\n if (superscript) {\n throw new ParseError(\"Double superscript\", lex);\n }\n\n var prime = {\n type: \"textord\",\n mode: this.mode,\n text: \"\\\\prime\"\n }; // Many primes can be grouped together, so we handle this here\n\n var primes = [prime];\n this.consume(); // Keep lexing tokens until we get something that's not a prime\n\n while (this.fetch().text === \"'\") {\n // For each one, add another prime to the list\n primes.push(prime);\n this.consume();\n } // If there's a superscript following the primes, combine that\n // superscript in with the primes.\n\n\n if (this.fetch().text === \"^\") {\n primes.push(this.handleSupSubscript(\"superscript\"));\n } // Put everything into an ordgroup as the superscript\n\n\n superscript = {\n type: \"ordgroup\",\n mode: this.mode,\n body: primes\n };\n } else if (uSubsAndSups[lex.text]) {\n // A Unicode subscript or superscript character.\n // We treat these similarly to the unicode-math package.\n // So we render a string of Unicode (sub|super)scripts the\n // same as a (sub|super)script of regular characters.\n var isSub = unicodeSubRegEx.test(lex.text);\n var subsupTokens = [];\n subsupTokens.push(new Token(uSubsAndSups[lex.text]));\n this.consume(); // Continue fetching tokens to fill out the string.\n\n while (true) {\n var token = this.fetch().text;\n\n if (!uSubsAndSups[token]) {\n break;\n }\n\n if (unicodeSubRegEx.test(token) !== isSub) {\n break;\n }\n\n subsupTokens.unshift(new Token(uSubsAndSups[token]));\n this.consume();\n } // Now create a (sub|super)script.\n\n\n var body = this.subparse(subsupTokens);\n\n if (isSub) {\n subscript = {\n type: \"ordgroup\",\n mode: \"math\",\n body\n };\n } else {\n superscript = {\n type: \"ordgroup\",\n mode: \"math\",\n body\n };\n }\n } else {\n // If it wasn't ^, _, or ', stop parsing super/subscripts\n break;\n }\n } // Base must be set if superscript or subscript are set per logic above,\n // but need to check here for type check to pass.\n\n\n if (superscript || subscript) {\n // If we got either a superscript or subscript, create a supsub\n return {\n type: \"supsub\",\n mode: this.mode,\n base: base,\n sup: superscript,\n sub: subscript\n };\n } else {\n // Otherwise return the original body\n return base;\n }\n }\n /**\n * Parses an entire function, including its base and all of its arguments.\n */\n\n\n parseFunction(breakOnTokenText, name // For determining its context\n ) {\n var token = this.fetch();\n var func = token.text;\n var funcData = functions[func];\n\n if (!funcData) {\n return null;\n }\n\n this.consume(); // consume command token\n\n if (name && name !== \"atom\" && !funcData.allowedInArgument) {\n throw new ParseError(\"Got function '\" + func + \"' with no arguments\" + (name ? \" as \" + name : \"\"), token);\n } else if (this.mode === \"text\" && !funcData.allowedInText) {\n throw new ParseError(\"Can't use function '\" + func + \"' in text mode\", token);\n } else if (this.mode === \"math\" && funcData.allowedInMath === false) {\n throw new ParseError(\"Can't use function '\" + func + \"' in math mode\", token);\n }\n\n var {\n args,\n optArgs\n } = this.parseArguments(func, funcData);\n return this.callFunction(func, args, optArgs, token, breakOnTokenText);\n }\n /**\n * Call a function handler with a suitable context and arguments.\n */\n\n\n callFunction(name, args, optArgs, token, breakOnTokenText) {\n var context = {\n funcName: name,\n parser: this,\n token,\n breakOnTokenText\n };\n var func = functions[name];\n\n if (func && func.handler) {\n return func.handler(context, args, optArgs);\n } else {\n throw new ParseError(\"No function handler for \" + name);\n }\n }\n /**\n * Parses the arguments of a function or environment\n */\n\n\n parseArguments(func, // Should look like \"\\name\" or \"\\begin{name}\".\n funcData) {\n var totalArgs = funcData.numArgs + funcData.numOptionalArgs;\n\n if (totalArgs === 0) {\n return {\n args: [],\n optArgs: []\n };\n }\n\n var args = [];\n var optArgs = [];\n\n for (var i = 0; i < totalArgs; i++) {\n var argType = funcData.argTypes && funcData.argTypes[i];\n var isOptional = i < funcData.numOptionalArgs;\n\n if (funcData.primitive && argType == null || // \\sqrt expands into primitive if optional argument doesn't exist\n funcData.type === \"sqrt\" && i === 1 && optArgs[0] == null) {\n argType = \"primitive\";\n }\n\n var arg = this.parseGroupOfType(\"argument to '\" + func + \"'\", argType, isOptional);\n\n if (isOptional) {\n optArgs.push(arg);\n } else if (arg != null) {\n args.push(arg);\n } else {\n // should be unreachable\n throw new ParseError(\"Null argument, please report this as a bug\");\n }\n }\n\n return {\n args,\n optArgs\n };\n }\n /**\n * Parses a group when the mode is changing.\n */\n\n\n parseGroupOfType(name, type, optional) {\n switch (type) {\n case \"color\":\n return this.parseColorGroup(optional);\n\n case \"size\":\n return this.parseSizeGroup(optional);\n\n case \"url\":\n return this.parseUrlGroup(optional);\n\n case \"math\":\n case \"text\":\n return this.parseArgumentGroup(optional, type);\n\n case \"hbox\":\n {\n // hbox argument type wraps the argument in the equivalent of\n // \\hbox, which is like \\text but switching to \\textstyle size.\n var group = this.parseArgumentGroup(optional, \"text\");\n return group != null ? {\n type: \"styling\",\n mode: group.mode,\n body: [group],\n style: \"text\" // simulate \\textstyle\n\n } : null;\n }\n\n case \"raw\":\n {\n var token = this.parseStringGroup(\"raw\", optional);\n return token != null ? {\n type: \"raw\",\n mode: \"text\",\n string: token.text\n } : null;\n }\n\n case \"primitive\":\n {\n if (optional) {\n throw new ParseError(\"A primitive argument cannot be optional\");\n }\n\n var _group = this.parseGroup(name);\n\n if (_group == null) {\n throw new ParseError(\"Expected group as \" + name, this.fetch());\n }\n\n return _group;\n }\n\n case \"original\":\n case null:\n case undefined:\n return this.parseArgumentGroup(optional);\n\n default:\n throw new ParseError(\"Unknown group type as \" + name, this.fetch());\n }\n }\n /**\n * Discard any space tokens, fetching the next non-space token.\n */\n\n\n consumeSpaces() {\n while (this.fetch().text === \" \") {\n this.consume();\n }\n }\n /**\n * Parses a group, essentially returning the string formed by the\n * brace-enclosed tokens plus some position information.\n */\n\n\n parseStringGroup(modeName, // Used to describe the mode in error messages.\n optional) {\n var argToken = this.gullet.scanArgument(optional);\n\n if (argToken == null) {\n return null;\n }\n\n var str = \"\";\n var nextToken;\n\n while ((nextToken = this.fetch()).text !== \"EOF\") {\n str += nextToken.text;\n this.consume();\n }\n\n this.consume(); // consume the end of the argument\n\n argToken.text = str;\n return argToken;\n }\n /**\n * Parses a regex-delimited group: the largest sequence of tokens\n * whose concatenated strings match `regex`. Returns the string\n * formed by the tokens plus some position information.\n */\n\n\n parseRegexGroup(regex, modeName // Used to describe the mode in error messages.\n ) {\n var firstToken = this.fetch();\n var lastToken = firstToken;\n var str = \"\";\n var nextToken;\n\n while ((nextToken = this.fetch()).text !== \"EOF\" && regex.test(str + nextToken.text)) {\n lastToken = nextToken;\n str += lastToken.text;\n this.consume();\n }\n\n if (str === \"\") {\n throw new ParseError(\"Invalid \" + modeName + \": '\" + firstToken.text + \"'\", firstToken);\n }\n\n return firstToken.range(lastToken, str);\n }\n /**\n * Parses a color description.\n */\n\n\n parseColorGroup(optional) {\n var res = this.parseStringGroup(\"color\", optional);\n\n if (res == null) {\n return null;\n }\n\n var match = /^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(res.text);\n\n if (!match) {\n throw new ParseError(\"Invalid color: '\" + res.text + \"'\", res);\n }\n\n var color = match[0];\n\n if (/^[0-9a-f]{6}$/i.test(color)) {\n // We allow a 6-digit HTML color spec without a leading \"#\".\n // This follows the xcolor package's HTML color model.\n // Predefined color names are all missed by this RegEx pattern.\n color = \"#\" + color;\n }\n\n return {\n type: \"color-token\",\n mode: this.mode,\n color\n };\n }\n /**\n * Parses a size specification, consisting of magnitude and unit.\n */\n\n\n parseSizeGroup(optional) {\n var res;\n var isBlank = false; // don't expand before parseStringGroup\n\n this.gullet.consumeSpaces();\n\n if (!optional && this.gullet.future().text !== \"{\") {\n res = this.parseRegexGroup(/^[-+]? *(?:$|\\d+|\\d+\\.\\d*|\\.\\d*) *[a-z]{0,2} *$/, \"size\");\n } else {\n res = this.parseStringGroup(\"size\", optional);\n }\n\n if (!res) {\n return null;\n }\n\n if (!optional && res.text.length === 0) {\n // Because we've tested for what is !optional, this block won't\n // affect \\kern, \\hspace, etc. It will capture the mandatory arguments\n // to \\genfrac and \\above.\n res.text = \"0pt\"; // Enable \\above{}\n\n isBlank = true; // This is here specifically for \\genfrac\n }\n\n var match = /([-+]?) *(\\d+(?:\\.\\d*)?|\\.\\d+) *([a-z]{2})/.exec(res.text);\n\n if (!match) {\n throw new ParseError(\"Invalid size: '\" + res.text + \"'\", res);\n }\n\n var data = {\n number: +(match[1] + match[2]),\n // sign + magnitude, cast to number\n unit: match[3]\n };\n\n if (!validUnit(data)) {\n throw new ParseError(\"Invalid unit: '\" + data.unit + \"'\", res);\n }\n\n return {\n type: \"size\",\n mode: this.mode,\n value: data,\n isBlank\n };\n }\n /**\n * Parses an URL, checking escaped letters and allowed protocols,\n * and setting the catcode of % as an active character (as in \\hyperref).\n */\n\n\n parseUrlGroup(optional) {\n this.gullet.lexer.setCatcode(\"%\", 13); // active character\n\n this.gullet.lexer.setCatcode(\"~\", 12); // other character\n\n var res = this.parseStringGroup(\"url\", optional);\n this.gullet.lexer.setCatcode(\"%\", 14); // comment character\n\n this.gullet.lexer.setCatcode(\"~\", 13); // active character\n\n if (res == null) {\n return null;\n } // hyperref package allows backslashes alone in href, but doesn't\n // generate valid links in such cases; we interpret this as\n // \"undefined\" behaviour, and keep them as-is. Some browser will\n // replace backslashes with forward slashes.\n\n\n var url = res.text.replace(/\\\\([#$%&~_^{}])/g, '$1');\n return {\n type: \"url\",\n mode: this.mode,\n url\n };\n }\n /**\n * Parses an argument with the mode specified.\n */\n\n\n parseArgumentGroup(optional, mode) {\n var argToken = this.gullet.scanArgument(optional);\n\n if (argToken == null) {\n return null;\n }\n\n var outerMode = this.mode;\n\n if (mode) {\n // Switch to specified mode\n this.switchMode(mode);\n }\n\n this.gullet.beginGroup();\n var expression = this.parseExpression(false, \"EOF\"); // TODO: find an alternative way to denote the end\n\n this.expect(\"EOF\"); // expect the end of the argument\n\n this.gullet.endGroup();\n var result = {\n type: \"ordgroup\",\n mode: this.mode,\n loc: argToken.loc,\n body: expression\n };\n\n if (mode) {\n // Switch mode back\n this.switchMode(outerMode);\n }\n\n return result;\n }\n /**\n * Parses an ordinary group, which is either a single nucleus (like \"x\")\n * or an expression in braces (like \"{x+y}\") or an implicit group, a group\n * that starts at the current position, and ends right before a higher explicit\n * group ends, or at EOF.\n */\n\n\n parseGroup(name, // For error reporting.\n breakOnTokenText) {\n var firstToken = this.fetch();\n var text = firstToken.text;\n var result; // Try to parse an open brace or \\begingroup\n\n if (text === \"{\" || text === \"\\\\begingroup\") {\n this.consume();\n var groupEnd = text === \"{\" ? \"}\" : \"\\\\endgroup\";\n this.gullet.beginGroup(); // If we get a brace, parse an expression\n\n var expression = this.parseExpression(false, groupEnd);\n var lastToken = this.fetch();\n this.expect(groupEnd); // Check that we got a matching closing brace\n\n this.gullet.endGroup();\n result = {\n type: \"ordgroup\",\n mode: this.mode,\n loc: SourceLocation.range(firstToken, lastToken),\n body: expression,\n // A group formed by \\begingroup...\\endgroup is a semi-simple group\n // which doesn't affect spacing in math mode, i.e., is transparent.\n // https://tex.stackexchange.com/questions/1930/when-should-one-\n // use-begingroup-instead-of-bgroup\n semisimple: text === \"\\\\begingroup\" || undefined\n };\n } else {\n // If there exists a function with this name, parse the function.\n // Otherwise, just return a nucleus\n result = this.parseFunction(breakOnTokenText, name) || this.parseSymbol();\n\n if (result == null && text[0] === \"\\\\\" && !implicitCommands.hasOwnProperty(text)) {\n if (this.settings.throwOnError) {\n throw new ParseError(\"Undefined control sequence: \" + text, firstToken);\n }\n\n result = this.formatUnsupportedCmd(text);\n this.consume();\n }\n }\n\n return result;\n }\n /**\n * Form ligature-like combinations of characters for text mode.\n * This includes inputs like \"--\", \"---\", \"``\" and \"''\".\n * The result will simply replace multiple textord nodes with a single\n * character in each value by a single textord node having multiple\n * characters in its value. The representation is still ASCII source.\n * The group will be modified in place.\n */\n\n\n formLigatures(group) {\n var n = group.length - 1;\n\n for (var i = 0; i < n; ++i) {\n var a = group[i]; // $FlowFixMe: Not every node type has a `text` property.\n\n var v = a.text;\n\n if (v === \"-\" && group[i + 1].text === \"-\") {\n if (i + 1 < n && group[i + 2].text === \"-\") {\n group.splice(i, 3, {\n type: \"textord\",\n mode: \"text\",\n loc: SourceLocation.range(a, group[i + 2]),\n text: \"---\"\n });\n n -= 2;\n } else {\n group.splice(i, 2, {\n type: \"textord\",\n mode: \"text\",\n loc: SourceLocation.range(a, group[i + 1]),\n text: \"--\"\n });\n n -= 1;\n }\n }\n\n if ((v === \"'\" || v === \"`\") && group[i + 1].text === v) {\n group.splice(i, 2, {\n type: \"textord\",\n mode: \"text\",\n loc: SourceLocation.range(a, group[i + 1]),\n text: v + v\n });\n n -= 1;\n }\n }\n }\n /**\n * Parse a single symbol out of the string. Here, we handle single character\n * symbols and special functions like \\verb.\n */\n\n\n parseSymbol() {\n var nucleus = this.fetch();\n var text = nucleus.text;\n\n if (/^\\\\verb[^a-zA-Z]/.test(text)) {\n this.consume();\n var arg = text.slice(5);\n var star = arg.charAt(0) === \"*\";\n\n if (star) {\n arg = arg.slice(1);\n } // Lexer's tokenRegex is constructed to always have matching\n // first/last characters.\n\n\n if (arg.length < 2 || arg.charAt(0) !== arg.slice(-1)) {\n throw new ParseError(\"\\\\verb assertion failed --\\n please report what input caused this bug\");\n }\n\n arg = arg.slice(1, -1); // remove first and last char\n\n return {\n type: \"verb\",\n mode: \"text\",\n body: arg,\n star\n };\n } // At this point, we should have a symbol, possibly with accents.\n // First expand any accented base symbol according to unicodeSymbols.\n\n\n if (unicodeSymbols.hasOwnProperty(text[0]) && !symbols[this.mode][text[0]]) {\n // This behavior is not strict (XeTeX-compatible) in math mode.\n if (this.settings.strict && this.mode === \"math\") {\n this.settings.reportNonstrict(\"unicodeTextInMathMode\", \"Accented Unicode text character \\\"\" + text[0] + \"\\\" used in \" + \"math mode\", nucleus);\n }\n\n text = unicodeSymbols[text[0]] + text.slice(1);\n } // Strip off any combining characters\n\n\n var match = combiningDiacriticalMarksEndRegex.exec(text);\n\n if (match) {\n text = text.substring(0, match.index);\n\n if (text === 'i') {\n text = '\\u0131'; // dotless i, in math and text mode\n } else if (text === 'j') {\n text = '\\u0237'; // dotless j, in math and text mode\n }\n } // Recognize base symbol\n\n\n var symbol;\n\n if (symbols[this.mode][text]) {\n if (this.settings.strict && this.mode === 'math' && extraLatin.indexOf(text) >= 0) {\n this.settings.reportNonstrict(\"unicodeTextInMathMode\", \"Latin-1/Unicode text character \\\"\" + text[0] + \"\\\" used in \" + \"math mode\", nucleus);\n }\n\n var group = symbols[this.mode][text].group;\n var loc = SourceLocation.range(nucleus);\n var s;\n\n if (ATOMS.hasOwnProperty(group)) {\n // $FlowFixMe\n var family = group;\n s = {\n type: \"atom\",\n mode: this.mode,\n family,\n loc,\n text\n };\n } else {\n // $FlowFixMe\n s = {\n type: group,\n mode: this.mode,\n loc,\n text\n };\n } // $FlowFixMe\n\n\n symbol = s;\n } else if (text.charCodeAt(0) >= 0x80) {\n // no symbol for e.g. ^\n if (this.settings.strict) {\n if (!supportedCodepoint(text.charCodeAt(0))) {\n this.settings.reportNonstrict(\"unknownSymbol\", \"Unrecognized Unicode character \\\"\" + text[0] + \"\\\"\" + (\" (\" + text.charCodeAt(0) + \")\"), nucleus);\n } else if (this.mode === \"math\") {\n this.settings.reportNonstrict(\"unicodeTextInMathMode\", \"Unicode text character \\\"\" + text[0] + \"\\\" used in math mode\", nucleus);\n }\n } // All nonmathematical Unicode characters are rendered as if they\n // are in text mode (wrapped in \\text) because that's what it\n // takes to render them in LaTeX. Setting `mode: this.mode` is\n // another natural choice (the user requested math mode), but\n // this makes it more difficult for getCharacterMetrics() to\n // distinguish Unicode characters without metrics and those for\n // which we want to simulate the letter M.\n\n\n symbol = {\n type: \"textord\",\n mode: \"text\",\n loc: SourceLocation.range(nucleus),\n text\n };\n } else {\n return null; // EOF, ^, _, {, }, etc.\n }\n\n this.consume(); // Transform combining characters into accents\n\n if (match) {\n for (var i = 0; i < match[0].length; i++) {\n var accent = match[0][i];\n\n if (!unicodeAccents[accent]) {\n throw new ParseError(\"Unknown accent ' \" + accent + \"'\", nucleus);\n }\n\n var command = unicodeAccents[accent][this.mode] || unicodeAccents[accent].text;\n\n if (!command) {\n throw new ParseError(\"Accent \" + accent + \" unsupported in \" + this.mode + \" mode\", nucleus);\n }\n\n symbol = {\n type: \"accent\",\n mode: this.mode,\n loc: SourceLocation.range(nucleus),\n label: command,\n isStretchy: false,\n isShifty: true,\n // $FlowFixMe\n base: symbol\n };\n }\n } // $FlowFixMe\n\n\n return symbol;\n }\n\n}\nParser.endOfExpression = [\"}\", \"\\\\endgroup\", \"\\\\end\", \"\\\\right\", \"&\"];\n\n/**\n * Provides a single function for parsing an expression using a Parser\n * TODO(emily): Remove this\n */\n\n/**\n * Parses an expression using a Parser, then returns the parsed result.\n */\nvar parseTree = function parseTree(toParse, settings) {\n if (!(typeof toParse === 'string' || toParse instanceof String)) {\n throw new TypeError('KaTeX can only parse string typed expression');\n }\n\n var parser = new Parser(toParse, settings); // Blank out any \\df@tag to avoid spurious \"Duplicate \\tag\" errors\n\n delete parser.gullet.macros.current[\"\\\\df@tag\"];\n var tree = parser.parse(); // Prevent a color definition from persisting between calls to katex.render().\n\n delete parser.gullet.macros.current[\"\\\\current@color\"];\n delete parser.gullet.macros.current[\"\\\\color\"]; // If the input used \\tag, it will set the \\df@tag macro to the tag.\n // In this case, we separately parse the tag and wrap the tree.\n\n if (parser.gullet.macros.get(\"\\\\df@tag\")) {\n if (!settings.displayMode) {\n throw new ParseError(\"\\\\tag works only in display equations\");\n }\n\n tree = [{\n type: \"tag\",\n mode: \"text\",\n body: tree,\n tag: parser.subparse([new Token(\"\\\\df@tag\")])\n }];\n }\n\n return tree;\n};\n\n/* eslint no-console:0 */\n\n/**\n * Parse and build an expression, and place that expression in the DOM node\n * given.\n */\nvar render = function render(expression, baseNode, options) {\n baseNode.textContent = \"\";\n var node = renderToDomTree(expression, options).toNode();\n baseNode.appendChild(node);\n}; // KaTeX's styles don't work properly in quirks mode. Print out an error, and\n// disable rendering.\n\n\nif (typeof document !== \"undefined\") {\n if (document.compatMode !== \"CSS1Compat\") {\n typeof console !== \"undefined\" && console.warn(\"Warning: KaTeX doesn't work in quirks mode. Make sure your \" + \"website has a suitable doctype.\");\n\n render = function render() {\n throw new ParseError(\"KaTeX doesn't work in quirks mode.\");\n };\n }\n}\n/**\n * Parse and build an expression, and return the markup for that.\n */\n\n\nvar renderToString = function renderToString(expression, options) {\n var markup = renderToDomTree(expression, options).toMarkup();\n return markup;\n};\n/**\n * Parse an expression and return the parse tree.\n */\n\n\nvar generateParseTree = function generateParseTree(expression, options) {\n var settings = new Settings(options);\n return parseTree(expression, settings);\n};\n/**\n * If the given error is a KaTeX ParseError and options.throwOnError is false,\n * renders the invalid LaTeX as a span with hover title giving the KaTeX\n * error message. Otherwise, simply throws the error.\n */\n\n\nvar renderError = function renderError(error, expression, options) {\n if (options.throwOnError || !(error instanceof ParseError)) {\n throw error;\n }\n\n var node = buildCommon.makeSpan([\"katex-error\"], [new SymbolNode(expression)]);\n node.setAttribute(\"title\", error.toString());\n node.setAttribute(\"style\", \"color:\" + options.errorColor);\n return node;\n};\n/**\n * Generates and returns the katex build tree. This is used for advanced\n * use cases (like rendering to custom output).\n */\n\n\nvar renderToDomTree = function renderToDomTree(expression, options) {\n var settings = new Settings(options);\n\n try {\n var tree = parseTree(expression, settings);\n return buildTree(tree, expression, settings);\n } catch (error) {\n return renderError(error, expression, settings);\n }\n};\n/**\n * Generates and returns the katex build tree, with just HTML (no MathML).\n * This is used for advanced use cases (like rendering to custom output).\n */\n\n\nvar renderToHTMLTree = function renderToHTMLTree(expression, options) {\n var settings = new Settings(options);\n\n try {\n var tree = parseTree(expression, settings);\n return buildHTMLTree(tree, expression, settings);\n } catch (error) {\n return renderError(error, expression, settings);\n }\n};\n\nvar katex = {\n /**\n * Current KaTeX version\n */\n version: \"0.16.11\",\n\n /**\n * Renders the given LaTeX into an HTML+MathML combination, and adds\n * it as a child to the specified DOM node.\n */\n render,\n\n /**\n * Renders the given LaTeX into an HTML+MathML combination string,\n * for sending to the client.\n */\n renderToString,\n\n /**\n * KaTeX error, usually during parsing.\n */\n ParseError,\n\n /**\n * The shema of Settings\n */\n SETTINGS_SCHEMA,\n\n /**\n * Parses the given LaTeX into KaTeX's internal parse tree structure,\n * without rendering to HTML or MathML.\n *\n * NOTE: This method is not currently recommended for public use.\n * The internal tree representation is unstable and is very likely\n * to change. Use at your own risk.\n */\n __parse: generateParseTree,\n\n /**\n * Renders the given LaTeX into an HTML+MathML internal DOM tree\n * representation, without flattening that representation to a string.\n *\n * NOTE: This method is not currently recommended for public use.\n * The internal tree representation is unstable and is very likely\n * to change. Use at your own risk.\n */\n __renderToDomTree: renderToDomTree,\n\n /**\n * Renders the given LaTeX into an HTML internal DOM tree representation,\n * without MathML and without flattening that representation to a string.\n *\n * NOTE: This method is not currently recommended for public use.\n * The internal tree representation is unstable and is very likely\n * to change. Use at your own risk.\n */\n __renderToHTMLTree: renderToHTMLTree,\n\n /**\n * extends internal font metrics object with a new object\n * each key in the new object represents a font name\n */\n __setFontMetrics: setFontMetrics,\n\n /**\n * adds a new symbol to builtin symbols table\n */\n __defineSymbol: defineSymbol,\n\n /**\n * adds a new function to builtin function list,\n * which directly produce parse tree elements\n * and have their own html/mathml builders\n */\n __defineFunction: defineFunction,\n\n /**\n * adds a new macro to builtin macro list\n */\n __defineMacro: defineMacro,\n\n /**\n * Expose the dom tree node types, which can be useful for type checking nodes.\n *\n * NOTE: This method is not currently recommended for public use.\n * The internal tree representation is unstable and is very likely\n * to change. Use at your own risk.\n */\n __domTree: {\n Span,\n Anchor,\n SymbolNode,\n SvgNode,\n PathNode,\n LineNode\n }\n};\n\nexport { katex as default };\n", "import DOMPurify from 'dompurify';\nimport type { MermaidConfig } from '../../config.type.js';\n\n// Remove and ignore br:s\nexport const lineBreakRegex = / /gi;\n\n/**\n * Gets the rows of lines in a string\n *\n * @param s - The string to check the lines for\n * @returns The rows in that string\n */\nexport const getRows = (s?: string): string[] => {\n if (!s) {\n return [''];\n }\n const str = breakToPlaceholder(s).replace(/\\\\n/g, '#br#');\n return str.split('#br#');\n};\n\nconst setupDompurifyHooksIfNotSetup = (() => {\n let setup = false;\n\n return () => {\n if (!setup) {\n setupDompurifyHooks();\n setup = true;\n }\n };\n})();\n\nfunction setupDompurifyHooks() {\n const TEMPORARY_ATTRIBUTE = 'data-temp-href-target';\n\n DOMPurify.addHook('beforeSanitizeAttributes', (node: Element) => {\n if (node.tagName === 'A' && node.hasAttribute('target')) {\n node.setAttribute(TEMPORARY_ATTRIBUTE, node.getAttribute('target') ?? '');\n }\n });\n\n DOMPurify.addHook('afterSanitizeAttributes', (node: Element) => {\n if (node.tagName === 'A' && node.hasAttribute(TEMPORARY_ATTRIBUTE)) {\n node.setAttribute('target', node.getAttribute(TEMPORARY_ATTRIBUTE) ?? '');\n node.removeAttribute(TEMPORARY_ATTRIBUTE);\n if (node.getAttribute('target') === '_blank') {\n node.setAttribute('rel', 'noopener');\n }\n }\n });\n}\n\n/**\n * Removes script tags from a text\n *\n * @param txt - The text to sanitize\n * @returns The safer text\n */\nexport const removeScript = (txt: string): string => {\n setupDompurifyHooksIfNotSetup();\n\n const sanitizedText = DOMPurify.sanitize(txt);\n\n return sanitizedText;\n};\n\nconst sanitizeMore = (text: string, config: MermaidConfig) => {\n if (config.flowchart?.htmlLabels !== false) {\n const level = config.securityLevel;\n if (level === 'antiscript' || level === 'strict') {\n text = removeScript(text);\n } else if (level !== 'loose') {\n text = breakToPlaceholder(text);\n text = text.replace(//g, '>');\n text = text.replace(/=/g, '=');\n text = placeholderToBreak(text);\n }\n }\n return text;\n};\n\nexport const sanitizeText = (text: string, config: MermaidConfig): string => {\n if (!text) {\n return text;\n }\n if (config.dompurifyConfig) {\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n text = DOMPurify.sanitize(sanitizeMore(text, config), config.dompurifyConfig).toString();\n } else {\n text = DOMPurify.sanitize(sanitizeMore(text, config), {\n FORBID_TAGS: ['style'],\n }).toString();\n }\n return text;\n};\n\nexport const sanitizeTextOrArray = (\n a: string | string[] | string[][],\n config: MermaidConfig\n): string | string[] => {\n if (typeof a === 'string') {\n return sanitizeText(a, config);\n }\n // TODO: Refactor to avoid flat.\n return a.flat().map((x: string) => sanitizeText(x, config));\n};\n\n/**\n * Whether or not a text has any line breaks\n *\n * @param text - The text to test\n * @returns Whether or not the text has breaks\n */\nexport const hasBreaks = (text: string): boolean => {\n return lineBreakRegex.test(text);\n};\n\n/**\n * Splits on tags\n *\n * @param text - Text to split\n * @returns List of lines as strings\n */\nexport const splitBreaks = (text: string): string[] => {\n return text.split(lineBreakRegex);\n};\n\n/**\n * Converts placeholders to line breaks in HTML\n *\n * @param s - HTML with placeholders\n * @returns HTML with breaks instead of placeholders\n */\nconst placeholderToBreak = (s: string): string => {\n return s.replace(/#br#/g, ' ');\n};\n\n/**\n * Opposite of `placeholderToBreak`, converts breaks to placeholders\n *\n * @param s - HTML string\n * @returns String with placeholders\n */\nconst breakToPlaceholder = (s: string): string => {\n return s.replace(lineBreakRegex, '#br#');\n};\n\n/**\n * Gets the current URL\n *\n * @param useAbsolute - Whether to return the absolute URL or not\n * @returns The current URL\n */\nconst getUrl = (useAbsolute: boolean): string => {\n let url = '';\n if (useAbsolute) {\n url =\n window.location.protocol +\n '//' +\n window.location.host +\n window.location.pathname +\n window.location.search;\n url = url.replaceAll(/\\(/g, '\\\\(');\n url = url.replaceAll(/\\)/g, '\\\\)');\n }\n\n return url;\n};\n\n/**\n * Converts a string/boolean into a boolean\n *\n * @param val - String or boolean to convert\n * @returns The result from the input\n */\nexport const evaluate = (val?: string | boolean): boolean =>\n val === false || ['false', 'null', '0'].includes(String(val).trim().toLowerCase()) ? false : true;\n\n/**\n * Wrapper around Math.max which removes non-numeric values\n * Returns the larger of a set of supplied numeric expressions.\n * @param values - Numeric expressions to be evaluated\n * @returns The smaller value\n */\nexport const getMax = function (...values: number[]): number {\n const newValues: number[] = values.filter((value) => {\n return !isNaN(value);\n });\n return Math.max(...newValues);\n};\n\n/**\n * Wrapper around Math.min which removes non-numeric values\n * Returns the smaller of a set of supplied numeric expressions.\n * @param values - Numeric expressions to be evaluated\n * @returns The smaller value\n */\nexport const getMin = function (...values: number[]): number {\n const newValues: number[] = values.filter((value) => {\n return !isNaN(value);\n });\n return Math.min(...newValues);\n};\n\n/**\n * Makes generics in typescript syntax\n *\n * @example\n * Array of array of strings in typescript syntax\n *\n * ```js\n * // returns \"Array>\"\n * parseGenericTypes('Array~Array~string~~');\n * ```\n * @param text - The text to convert\n * @returns The converted string\n */\nexport const parseGenericTypes = function (input: string): string {\n const inputSets = input.split(/(,)/);\n const output = [];\n\n for (let i = 0; i < inputSets.length; i++) {\n let thisSet = inputSets[i];\n\n // if the original input included a value such as \"~K, V~\"\", these will be split into\n // an array of [\"~K\",\",\",\" V~\"].\n // This means that on each call of processSet, there will only be 1 ~ present\n // To account for this, if we encounter a \",\", we are checking the previous and next sets in the array\n // to see if they contain matching ~'s\n // in which case we are assuming that they should be rejoined and sent to be processed\n if (thisSet === ',' && i > 0 && i + 1 < inputSets.length) {\n const previousSet = inputSets[i - 1];\n const nextSet = inputSets[i + 1];\n\n if (shouldCombineSets(previousSet, nextSet)) {\n thisSet = previousSet + ',' + nextSet;\n i++; // Move the index forward to skip the next iteration since we're combining sets\n output.pop();\n }\n }\n\n output.push(processSet(thisSet));\n }\n\n return output.join('');\n};\n\nexport const countOccurrence = (string: string, substring: string): number => {\n return Math.max(0, string.split(substring).length - 1);\n};\n\nconst shouldCombineSets = (previousSet: string, nextSet: string): boolean => {\n const prevCount = countOccurrence(previousSet, '~');\n const nextCount = countOccurrence(nextSet, '~');\n\n return prevCount === 1 && nextCount === 1;\n};\n\nconst processSet = (input: string): string => {\n const tildeCount = countOccurrence(input, '~');\n let hasStartingTilde = false;\n\n if (tildeCount <= 1) {\n return input;\n }\n\n // If there is an odd number of tildes, and the input starts with a tilde, we need to remove it and add it back in later\n if (tildeCount % 2 !== 0 && input.startsWith('~')) {\n input = input.substring(1);\n hasStartingTilde = true;\n }\n\n const chars = [...input];\n\n let first = chars.indexOf('~');\n let last = chars.lastIndexOf('~');\n\n while (first !== -1 && last !== -1 && first !== last) {\n chars[first] = '<';\n chars[last] = '>';\n\n first = chars.indexOf('~');\n last = chars.lastIndexOf('~');\n }\n\n // Add the starting tilde back in if we removed it\n if (hasStartingTilde) {\n chars.unshift('~');\n }\n\n return chars.join('');\n};\n\n// TODO: find a better method for detecting support. This interface was added in the MathML 4 spec.\n// Firefox versions between [4,71] (0.47%) and Safari versions between [5,13.4] (0.17%) don't have this interface implemented but MathML is supported\nexport const isMathMLSupported = () => window.MathMLElement !== undefined;\n\nexport const katexRegex = /\\$\\$(.*)\\$\\$/g;\n\n/**\n * Whether or not a text has KaTeX delimiters\n *\n * @param text - The text to test\n * @returns Whether or not the text has KaTeX delimiters\n */\nexport const hasKatex = (text: string): boolean => (text.match(katexRegex)?.length ?? 0) > 0;\n\n/**\n * Computes the minimum dimensions needed to display a div containing MathML\n *\n * @param text - The text to test\n * @param config - Configuration for Mermaid\n * @returns Object containing \\{width, height\\}\n */\nexport const calculateMathMLDimensions = async (text: string, config: MermaidConfig) => {\n text = await renderKatex(text, config);\n const divElem = document.createElement('div');\n divElem.innerHTML = text;\n divElem.id = 'katex-temp';\n divElem.style.visibility = 'hidden';\n divElem.style.position = 'absolute';\n divElem.style.top = '0';\n const body = document.querySelector('body');\n body?.insertAdjacentElement('beforeend', divElem);\n const dim = { width: divElem.clientWidth, height: divElem.clientHeight };\n divElem.remove();\n return dim;\n};\n\n/**\n * Attempts to render and return the KaTeX portion of a string with MathML\n *\n * @param text - The text to test\n * @param config - Configuration for Mermaid\n * @returns String containing MathML if KaTeX is supported, or an error message if it is not and stylesheets aren't present\n */\nexport const renderKatex = async (text: string, config: MermaidConfig): Promise => {\n if (!hasKatex(text)) {\n return text;\n }\n\n if (!(isMathMLSupported() || config.legacyMathML || config.forceLegacyMathML)) {\n return text.replace(katexRegex, 'MathML is unsupported in this environment.');\n }\n\n const { default: katex } = await import('katex');\n const outputMode =\n config.forceLegacyMathML || (!isMathMLSupported() && config.legacyMathML)\n ? 'htmlAndMathml'\n : 'mathml';\n return text\n .split(lineBreakRegex)\n .map((line) =>\n hasKatex(line)\n ? `${line}
`\n : `${line}
`\n )\n .join('')\n .replace(katexRegex, (_, c) =>\n katex\n .renderToString(c, {\n throwOnError: true,\n displayMode: true,\n output: outputMode,\n })\n .replace(/\\n/g, ' ')\n .replace(//g, '')\n );\n};\n\nexport default {\n getRows,\n sanitizeText,\n sanitizeTextOrArray,\n hasBreaks,\n splitBreaks,\n lineBreakRegex,\n removeScript,\n getUrl,\n evaluate,\n getMax,\n getMin,\n};\n", "import { log } from './logger.js';\n\n/**\n * Applies d3 attributes\n *\n * @param {any} d3Elem D3 Element to apply the attributes onto\n * @param {[string, string][]} attrs Object.keys equivalent format of key to value mapping of attributes\n */\nconst d3Attrs = function (d3Elem, attrs) {\n for (let attr of attrs) {\n d3Elem.attr(attr[0], attr[1]);\n }\n};\n\n/**\n * Gives attributes for an SVG's size given arguments\n *\n * @param {number} height The height of the SVG\n * @param {number} width The width of the SVG\n * @param {boolean} useMaxWidth Whether or not to use max-width and set width to 100%\n * @returns {Map<'height' | 'width' | 'style', string>} Attributes for the SVG\n */\nexport const calculateSvgSizeAttrs = function (height, width, useMaxWidth) {\n let attrs = new Map();\n if (useMaxWidth) {\n attrs.set('width', '100%');\n attrs.set('style', `max-width: ${width}px;`);\n } else {\n attrs.set('height', height);\n attrs.set('width', width);\n }\n return attrs;\n};\n\n/**\n * Applies attributes from `calculateSvgSizeAttrs`\n *\n * @param {import('./diagram-api/types.js').SVG} svgElem The SVG Element to configure\n * @param {number} height The height of the SVG\n * @param {number} width The width of the SVG\n * @param {boolean} useMaxWidth Whether or not to use max-width and set width to 100%\n */\nexport const configureSvgSize = function (svgElem, height, width, useMaxWidth) {\n const attrs = calculateSvgSizeAttrs(height, width, useMaxWidth);\n d3Attrs(svgElem, attrs);\n};\n\n// TODO v11: Remove the graph parameter. It is not used.\nexport const setupGraphViewbox = function (graph, svgElem, padding, useMaxWidth) {\n const svgBounds = svgElem.node().getBBox();\n const sWidth = svgBounds.width;\n const sHeight = svgBounds.height;\n\n log.info(`SVG bounds: ${sWidth}x${sHeight}`, svgBounds);\n\n let width = 0;\n let height = 0;\n log.info(`Graph bounds: ${width}x${height}`, graph);\n\n width = sWidth + padding * 2;\n height = sHeight + padding * 2;\n\n log.info(`Calculated bounds: ${width}x${height}`);\n configureSvgSize(svgElem, height, width, useMaxWidth);\n\n // Ensure the viewBox includes the whole svgBounds area with extra space for padding\n const vBox = `${svgBounds.x - padding} ${svgBounds.y - padding} ${\n svgBounds.width + 2 * padding\n } ${svgBounds.height + 2 * padding}`;\n\n svgElem.attr('viewBox', vBox);\n};\n", "import type { FlowChartStyleOptions } from './diagrams/flowchart/styles.js';\nimport { log } from './logger.js';\nimport type { DiagramStylesProvider } from './diagram-api/types.js';\n\nconst themes: Record = {};\n\nconst getStyles = (\n type: string,\n userStyles: string,\n options: {\n fontFamily: string;\n fontSize: string;\n textColor: string;\n errorBkgColor: string;\n errorTextColor: string;\n lineColor: string;\n } & FlowChartStyleOptions\n) => {\n let diagramStyles = '';\n if (type in themes && themes[type]) {\n diagramStyles = themes[type](options);\n } else {\n log.warn(`No theme found for ${type}`);\n }\n return ` & {\n font-family: ${options.fontFamily};\n font-size: ${options.fontSize};\n fill: ${options.textColor}\n }\n\n /* Classes common for multiple diagrams */\n\n & .error-icon {\n fill: ${options.errorBkgColor};\n }\n & .error-text {\n fill: ${options.errorTextColor};\n stroke: ${options.errorTextColor};\n }\n\n & .edge-thickness-normal {\n stroke-width: 1px;\n }\n & .edge-thickness-thick {\n stroke-width: 3.5px\n }\n & .edge-pattern-solid {\n stroke-dasharray: 0;\n }\n & .edge-thickness-invisible {\n stroke-width: 0;\n fill: none;\n }\n & .edge-pattern-dashed{\n stroke-dasharray: 3;\n }\n .edge-pattern-dotted {\n stroke-dasharray: 2;\n }\n\n & .marker {\n fill: ${options.lineColor};\n stroke: ${options.lineColor};\n }\n & .marker.cross {\n stroke: ${options.lineColor};\n }\n\n & svg {\n font-family: ${options.fontFamily};\n font-size: ${options.fontSize};\n }\n & p {\n margin: 0\n }\n\n ${diagramStyles}\n\n ${userStyles}\n`;\n};\n\nexport const addStylesForDiagram = (type: string, diagramTheme?: DiagramStylesProvider): void => {\n if (diagramTheme !== undefined) {\n themes[type] = diagramTheme;\n }\n};\n\nexport default getStyles;\n", "import { sanitizeText as _sanitizeText } from './common.js';\nimport { getConfig } from '../../config.js';\n\nlet accTitle = '';\nlet diagramTitle = '';\nlet accDescription = '';\n\nconst sanitizeText = (txt: string): string => _sanitizeText(txt, getConfig());\n\nexport const clear = (): void => {\n accTitle = '';\n accDescription = '';\n diagramTitle = '';\n};\n\nexport const setAccTitle = (txt: string): void => {\n accTitle = sanitizeText(txt).replace(/^\\s+/g, '');\n};\n\nexport const getAccTitle = (): string => accTitle;\n\nexport const setAccDescription = (txt: string): void => {\n accDescription = sanitizeText(txt).replace(/\\n\\s+/g, '\\n');\n};\n\nexport const getAccDescription = (): string => accDescription;\n\nexport const setDiagramTitle = (txt: string): void => {\n diagramTitle = sanitizeText(txt);\n};\n\nexport const getDiagramTitle = (): string => diagramTitle;\n", "import { addDetector } from './detectType.js';\nimport { log as _log, setLogLevel as _setLogLevel } from '../logger.js';\nimport {\n getConfig as _getConfig,\n setConfig as _setConfig,\n defaultConfig as _defaultConfig,\n setSiteConfig as _setSiteConfig,\n} from '../config.js';\nimport { sanitizeText as _sanitizeText } from '../diagrams/common/common.js';\nimport { setupGraphViewbox as _setupGraphViewbox } from '../setupGraphViewbox.js';\nimport { addStylesForDiagram } from '../styles.js';\nimport type { DiagramDefinition, DiagramDetector } from './types.js';\nimport * as _commonDb from '../diagrams/common/commonDb.js';\n\n/*\n Packaging and exposing resources for external diagrams so that they can import\n diagramAPI and have access to select parts of mermaid common code required to\n create diagrams working like the internal diagrams.\n*/\nexport const log = _log;\nexport const setLogLevel = _setLogLevel;\nexport const getConfig = _getConfig;\nexport const setConfig = _setConfig;\nexport const defaultConfig = _defaultConfig;\nexport const setSiteConfig = _setSiteConfig;\nexport const sanitizeText = (text: string) => _sanitizeText(text, getConfig());\nexport const setupGraphViewbox = _setupGraphViewbox;\nexport const getCommonDb = () => {\n return _commonDb;\n};\n\nconst diagrams: Record = {};\nexport type Detectors = Record;\n\n/**\n * Registers the given diagram with Mermaid.\n *\n * Can be used for third-party custom diagrams.\n *\n * @param id - A unique ID for the given diagram.\n * @param diagram - The diagram definition.\n * @param detector - Function that returns `true` if a given mermaid text is this diagram definition.\n */\nexport const registerDiagram = (\n id: string,\n diagram: DiagramDefinition,\n detector?: DiagramDetector\n) => {\n if (diagrams[id]) {\n log.warn(`Diagram with id ${id} already registered. Overwriting.`);\n }\n diagrams[id] = diagram;\n if (detector) {\n addDetector(id, detector);\n }\n addStylesForDiagram(id, diagram.styles);\n\n diagram.injectUtils?.(\n log,\n setLogLevel,\n getConfig,\n sanitizeText,\n setupGraphViewbox,\n getCommonDb(),\n () => {\n // parseDirective is removed in https://github.com/mermaid-js/mermaid/pull/4759.\n // This is a no-op for legacy support.\n }\n );\n};\n\nexport const getDiagram = (name: string): DiagramDefinition => {\n if (name in diagrams) {\n return diagrams[name];\n }\n throw new DiagramNotFoundError(name);\n};\n\nexport class DiagramNotFoundError extends Error {\n constructor(name: string) {\n super(`Diagram ${name} not found.`);\n }\n}\n", "import { getConfig } from '../../diagram-api/diagramAPI.js';\nimport { sanitizeText } from '../common/common.js';\nimport {\n setAccTitle,\n getAccTitle,\n getAccDescription,\n setAccDescription,\n} from '../common/commonDb.js';\n\nlet c4ShapeArray = [];\nlet boundaryParseStack = [''];\nlet currentBoundaryParse = 'global';\nlet parentBoundaryParse = '';\nlet boundaries = [\n {\n alias: 'global',\n label: { text: 'global' },\n type: { text: 'global' },\n tags: null,\n link: null,\n parentBoundary: '',\n },\n];\nlet rels = [];\nlet title = '';\nlet wrapEnabled = false;\nlet c4ShapeInRow = 4;\nlet c4BoundaryInRow = 2;\nvar c4Type;\n\nexport const getC4Type = function () {\n return c4Type;\n};\n\nexport const setC4Type = function (c4TypeParam) {\n let sanitizedText = sanitizeText(c4TypeParam, getConfig());\n c4Type = sanitizedText;\n};\n\n//type, from, to, label, ?techn, ?descr, ?sprite, ?tags, $link\nexport const addRel = function (type, from, to, label, techn, descr, sprite, tags, link) {\n // Don't allow label nulling\n if (\n type === undefined ||\n type === null ||\n from === undefined ||\n from === null ||\n to === undefined ||\n to === null ||\n label === undefined ||\n label === null\n ) {\n return;\n }\n\n let rel = {};\n const old = rels.find((rel) => rel.from === from && rel.to === to);\n if (old) {\n rel = old;\n } else {\n rels.push(rel);\n }\n\n rel.type = type;\n rel.from = from;\n rel.to = to;\n rel.label = { text: label };\n\n if (techn === undefined || techn === null) {\n rel.techn = { text: '' };\n } else {\n if (typeof techn === 'object') {\n let [key, value] = Object.entries(techn)[0];\n rel[key] = { text: value };\n } else {\n rel.techn = { text: techn };\n }\n }\n\n if (descr === undefined || descr === null) {\n rel.descr = { text: '' };\n } else {\n if (typeof descr === 'object') {\n let [key, value] = Object.entries(descr)[0];\n rel[key] = { text: value };\n } else {\n rel.descr = { text: descr };\n }\n }\n\n if (typeof sprite === 'object') {\n let [key, value] = Object.entries(sprite)[0];\n rel[key] = value;\n } else {\n rel.sprite = sprite;\n }\n if (typeof tags === 'object') {\n let [key, value] = Object.entries(tags)[0];\n rel[key] = value;\n } else {\n rel.tags = tags;\n }\n if (typeof link === 'object') {\n let [key, value] = Object.entries(link)[0];\n rel[key] = value;\n } else {\n rel.link = link;\n }\n rel.wrap = autoWrap();\n};\n\n//type, alias, label, ?descr, ?sprite, ?tags, $link\nexport const addPersonOrSystem = function (typeC4Shape, alias, label, descr, sprite, tags, link) {\n // Don't allow label nulling\n if (alias === null || label === null) {\n return;\n }\n\n let personOrSystem = {};\n const old = c4ShapeArray.find((personOrSystem) => personOrSystem.alias === alias);\n if (old && alias === old.alias) {\n personOrSystem = old;\n } else {\n personOrSystem.alias = alias;\n c4ShapeArray.push(personOrSystem);\n }\n\n // Don't allow null labels, either\n if (label === undefined || label === null) {\n personOrSystem.label = { text: '' };\n } else {\n personOrSystem.label = { text: label };\n }\n\n if (descr === undefined || descr === null) {\n personOrSystem.descr = { text: '' };\n } else {\n if (typeof descr === 'object') {\n let [key, value] = Object.entries(descr)[0];\n personOrSystem[key] = { text: value };\n } else {\n personOrSystem.descr = { text: descr };\n }\n }\n\n if (typeof sprite === 'object') {\n let [key, value] = Object.entries(sprite)[0];\n personOrSystem[key] = value;\n } else {\n personOrSystem.sprite = sprite;\n }\n if (typeof tags === 'object') {\n let [key, value] = Object.entries(tags)[0];\n personOrSystem[key] = value;\n } else {\n personOrSystem.tags = tags;\n }\n if (typeof link === 'object') {\n let [key, value] = Object.entries(link)[0];\n personOrSystem[key] = value;\n } else {\n personOrSystem.link = link;\n }\n personOrSystem.typeC4Shape = { text: typeC4Shape };\n personOrSystem.parentBoundary = currentBoundaryParse;\n personOrSystem.wrap = autoWrap();\n};\n\n//type, alias, label, ?techn, ?descr ?sprite, ?tags, $link\nexport const addContainer = function (typeC4Shape, alias, label, techn, descr, sprite, tags, link) {\n // Don't allow label nulling\n if (alias === null || label === null) {\n return;\n }\n\n let container = {};\n const old = c4ShapeArray.find((container) => container.alias === alias);\n if (old && alias === old.alias) {\n container = old;\n } else {\n container.alias = alias;\n c4ShapeArray.push(container);\n }\n\n // Don't allow null labels, either\n if (label === undefined || label === null) {\n container.label = { text: '' };\n } else {\n container.label = { text: label };\n }\n\n if (techn === undefined || techn === null) {\n container.techn = { text: '' };\n } else {\n if (typeof techn === 'object') {\n let [key, value] = Object.entries(techn)[0];\n container[key] = { text: value };\n } else {\n container.techn = { text: techn };\n }\n }\n\n if (descr === undefined || descr === null) {\n container.descr = { text: '' };\n } else {\n if (typeof descr === 'object') {\n let [key, value] = Object.entries(descr)[0];\n container[key] = { text: value };\n } else {\n container.descr = { text: descr };\n }\n }\n\n if (typeof sprite === 'object') {\n let [key, value] = Object.entries(sprite)[0];\n container[key] = value;\n } else {\n container.sprite = sprite;\n }\n if (typeof tags === 'object') {\n let [key, value] = Object.entries(tags)[0];\n container[key] = value;\n } else {\n container.tags = tags;\n }\n if (typeof link === 'object') {\n let [key, value] = Object.entries(link)[0];\n container[key] = value;\n } else {\n container.link = link;\n }\n container.wrap = autoWrap();\n container.typeC4Shape = { text: typeC4Shape };\n container.parentBoundary = currentBoundaryParse;\n};\n\n//type, alias, label, ?techn, ?descr ?sprite, ?tags, $link\nexport const addComponent = function (typeC4Shape, alias, label, techn, descr, sprite, tags, link) {\n // Don't allow label nulling\n if (alias === null || label === null) {\n return;\n }\n\n let component = {};\n const old = c4ShapeArray.find((component) => component.alias === alias);\n if (old && alias === old.alias) {\n component = old;\n } else {\n component.alias = alias;\n c4ShapeArray.push(component);\n }\n\n // Don't allow null labels, either\n if (label === undefined || label === null) {\n component.label = { text: '' };\n } else {\n component.label = { text: label };\n }\n\n if (techn === undefined || techn === null) {\n component.techn = { text: '' };\n } else {\n if (typeof techn === 'object') {\n let [key, value] = Object.entries(techn)[0];\n component[key] = { text: value };\n } else {\n component.techn = { text: techn };\n }\n }\n\n if (descr === undefined || descr === null) {\n component.descr = { text: '' };\n } else {\n if (typeof descr === 'object') {\n let [key, value] = Object.entries(descr)[0];\n component[key] = { text: value };\n } else {\n component.descr = { text: descr };\n }\n }\n\n if (typeof sprite === 'object') {\n let [key, value] = Object.entries(sprite)[0];\n component[key] = value;\n } else {\n component.sprite = sprite;\n }\n if (typeof tags === 'object') {\n let [key, value] = Object.entries(tags)[0];\n component[key] = value;\n } else {\n component.tags = tags;\n }\n if (typeof link === 'object') {\n let [key, value] = Object.entries(link)[0];\n component[key] = value;\n } else {\n component.link = link;\n }\n component.wrap = autoWrap();\n component.typeC4Shape = { text: typeC4Shape };\n component.parentBoundary = currentBoundaryParse;\n};\n\n//alias, label, ?type, ?tags, $link\nexport const addPersonOrSystemBoundary = function (alias, label, type, tags, link) {\n // if (parentBoundary === null) return;\n\n // Don't allow label nulling\n if (alias === null || label === null) {\n return;\n }\n\n let boundary = {};\n const old = boundaries.find((boundary) => boundary.alias === alias);\n if (old && alias === old.alias) {\n boundary = old;\n } else {\n boundary.alias = alias;\n boundaries.push(boundary);\n }\n\n // Don't allow null labels, either\n if (label === undefined || label === null) {\n boundary.label = { text: '' };\n } else {\n boundary.label = { text: label };\n }\n\n if (type === undefined || type === null) {\n boundary.type = { text: 'system' };\n } else {\n if (typeof type === 'object') {\n let [key, value] = Object.entries(type)[0];\n boundary[key] = { text: value };\n } else {\n boundary.type = { text: type };\n }\n }\n\n if (typeof tags === 'object') {\n let [key, value] = Object.entries(tags)[0];\n boundary[key] = value;\n } else {\n boundary.tags = tags;\n }\n if (typeof link === 'object') {\n let [key, value] = Object.entries(link)[0];\n boundary[key] = value;\n } else {\n boundary.link = link;\n }\n boundary.parentBoundary = currentBoundaryParse;\n boundary.wrap = autoWrap();\n\n parentBoundaryParse = currentBoundaryParse;\n currentBoundaryParse = alias;\n boundaryParseStack.push(parentBoundaryParse);\n};\n\n//alias, label, ?type, ?tags, $link\nexport const addContainerBoundary = function (alias, label, type, tags, link) {\n // if (parentBoundary === null) return;\n\n // Don't allow label nulling\n if (alias === null || label === null) {\n return;\n }\n\n let boundary = {};\n const old = boundaries.find((boundary) => boundary.alias === alias);\n if (old && alias === old.alias) {\n boundary = old;\n } else {\n boundary.alias = alias;\n boundaries.push(boundary);\n }\n\n // Don't allow null labels, either\n if (label === undefined || label === null) {\n boundary.label = { text: '' };\n } else {\n boundary.label = { text: label };\n }\n\n if (type === undefined || type === null) {\n boundary.type = { text: 'container' };\n } else {\n if (typeof type === 'object') {\n let [key, value] = Object.entries(type)[0];\n boundary[key] = { text: value };\n } else {\n boundary.type = { text: type };\n }\n }\n\n if (typeof tags === 'object') {\n let [key, value] = Object.entries(tags)[0];\n boundary[key] = value;\n } else {\n boundary.tags = tags;\n }\n if (typeof link === 'object') {\n let [key, value] = Object.entries(link)[0];\n boundary[key] = value;\n } else {\n boundary.link = link;\n }\n boundary.parentBoundary = currentBoundaryParse;\n boundary.wrap = autoWrap();\n\n parentBoundaryParse = currentBoundaryParse;\n currentBoundaryParse = alias;\n boundaryParseStack.push(parentBoundaryParse);\n};\n\n//alias, label, ?type, ?descr, ?sprite, ?tags, $link\nexport const addDeploymentNode = function (\n nodeType,\n alias,\n label,\n type,\n descr,\n sprite,\n tags,\n link\n) {\n // if (parentBoundary === null) return;\n\n // Don't allow label nulling\n if (alias === null || label === null) {\n return;\n }\n\n let boundary = {};\n const old = boundaries.find((boundary) => boundary.alias === alias);\n if (old && alias === old.alias) {\n boundary = old;\n } else {\n boundary.alias = alias;\n boundaries.push(boundary);\n }\n\n // Don't allow null labels, either\n if (label === undefined || label === null) {\n boundary.label = { text: '' };\n } else {\n boundary.label = { text: label };\n }\n\n if (type === undefined || type === null) {\n boundary.type = { text: 'node' };\n } else {\n if (typeof type === 'object') {\n let [key, value] = Object.entries(type)[0];\n boundary[key] = { text: value };\n } else {\n boundary.type = { text: type };\n }\n }\n\n if (descr === undefined || descr === null) {\n boundary.descr = { text: '' };\n } else {\n if (typeof descr === 'object') {\n let [key, value] = Object.entries(descr)[0];\n boundary[key] = { text: value };\n } else {\n boundary.descr = { text: descr };\n }\n }\n\n if (typeof tags === 'object') {\n let [key, value] = Object.entries(tags)[0];\n boundary[key] = value;\n } else {\n boundary.tags = tags;\n }\n if (typeof link === 'object') {\n let [key, value] = Object.entries(link)[0];\n boundary[key] = value;\n } else {\n boundary.link = link;\n }\n boundary.nodeType = nodeType;\n boundary.parentBoundary = currentBoundaryParse;\n boundary.wrap = autoWrap();\n\n parentBoundaryParse = currentBoundaryParse;\n currentBoundaryParse = alias;\n boundaryParseStack.push(parentBoundaryParse);\n};\n\nexport const popBoundaryParseStack = function () {\n currentBoundaryParse = parentBoundaryParse;\n boundaryParseStack.pop();\n parentBoundaryParse = boundaryParseStack.pop();\n boundaryParseStack.push(parentBoundaryParse);\n};\n\n//elementName, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?techn, ?legendText, ?legendSprite\nexport const updateElStyle = function (\n typeC4Shape,\n elementName,\n bgColor,\n fontColor,\n borderColor,\n shadowing,\n shape,\n sprite,\n techn,\n legendText,\n legendSprite\n) {\n let old = c4ShapeArray.find((element) => element.alias === elementName);\n if (old === undefined) {\n old = boundaries.find((element) => element.alias === elementName);\n if (old === undefined) {\n return;\n }\n }\n if (bgColor !== undefined && bgColor !== null) {\n if (typeof bgColor === 'object') {\n let [key, value] = Object.entries(bgColor)[0];\n old[key] = value;\n } else {\n old.bgColor = bgColor;\n }\n }\n if (fontColor !== undefined && fontColor !== null) {\n if (typeof fontColor === 'object') {\n let [key, value] = Object.entries(fontColor)[0];\n old[key] = value;\n } else {\n old.fontColor = fontColor;\n }\n }\n if (borderColor !== undefined && borderColor !== null) {\n if (typeof borderColor === 'object') {\n let [key, value] = Object.entries(borderColor)[0];\n old[key] = value;\n } else {\n old.borderColor = borderColor;\n }\n }\n if (shadowing !== undefined && shadowing !== null) {\n if (typeof shadowing === 'object') {\n let [key, value] = Object.entries(shadowing)[0];\n old[key] = value;\n } else {\n old.shadowing = shadowing;\n }\n }\n if (shape !== undefined && shape !== null) {\n if (typeof shape === 'object') {\n let [key, value] = Object.entries(shape)[0];\n old[key] = value;\n } else {\n old.shape = shape;\n }\n }\n if (sprite !== undefined && sprite !== null) {\n if (typeof sprite === 'object') {\n let [key, value] = Object.entries(sprite)[0];\n old[key] = value;\n } else {\n old.sprite = sprite;\n }\n }\n if (techn !== undefined && techn !== null) {\n if (typeof techn === 'object') {\n let [key, value] = Object.entries(techn)[0];\n old[key] = value;\n } else {\n old.techn = techn;\n }\n }\n if (legendText !== undefined && legendText !== null) {\n if (typeof legendText === 'object') {\n let [key, value] = Object.entries(legendText)[0];\n old[key] = value;\n } else {\n old.legendText = legendText;\n }\n }\n if (legendSprite !== undefined && legendSprite !== null) {\n if (typeof legendSprite === 'object') {\n let [key, value] = Object.entries(legendSprite)[0];\n old[key] = value;\n } else {\n old.legendSprite = legendSprite;\n }\n }\n};\n\n//textColor, lineColor, ?offsetX, ?offsetY\nexport const updateRelStyle = function (\n typeC4Shape,\n from,\n to,\n textColor,\n lineColor,\n offsetX,\n offsetY\n) {\n const old = rels.find((rel) => rel.from === from && rel.to === to);\n if (old === undefined) {\n return;\n }\n if (textColor !== undefined && textColor !== null) {\n if (typeof textColor === 'object') {\n let [key, value] = Object.entries(textColor)[0];\n old[key] = value;\n } else {\n old.textColor = textColor;\n }\n }\n if (lineColor !== undefined && lineColor !== null) {\n if (typeof lineColor === 'object') {\n let [key, value] = Object.entries(lineColor)[0];\n old[key] = value;\n } else {\n old.lineColor = lineColor;\n }\n }\n if (offsetX !== undefined && offsetX !== null) {\n if (typeof offsetX === 'object') {\n let [key, value] = Object.entries(offsetX)[0];\n old[key] = parseInt(value);\n } else {\n old.offsetX = parseInt(offsetX);\n }\n }\n if (offsetY !== undefined && offsetY !== null) {\n if (typeof offsetY === 'object') {\n let [key, value] = Object.entries(offsetY)[0];\n old[key] = parseInt(value);\n } else {\n old.offsetY = parseInt(offsetY);\n }\n }\n};\n\n//?c4ShapeInRow, ?c4BoundaryInRow\nexport const updateLayoutConfig = function (typeC4Shape, c4ShapeInRowParam, c4BoundaryInRowParam) {\n let c4ShapeInRowValue = c4ShapeInRow;\n let c4BoundaryInRowValue = c4BoundaryInRow;\n\n if (typeof c4ShapeInRowParam === 'object') {\n const value = Object.values(c4ShapeInRowParam)[0];\n c4ShapeInRowValue = parseInt(value);\n } else {\n c4ShapeInRowValue = parseInt(c4ShapeInRowParam);\n }\n if (typeof c4BoundaryInRowParam === 'object') {\n const value = Object.values(c4BoundaryInRowParam)[0];\n c4BoundaryInRowValue = parseInt(value);\n } else {\n c4BoundaryInRowValue = parseInt(c4BoundaryInRowParam);\n }\n\n if (c4ShapeInRowValue >= 1) {\n c4ShapeInRow = c4ShapeInRowValue;\n }\n if (c4BoundaryInRowValue >= 1) {\n c4BoundaryInRow = c4BoundaryInRowValue;\n }\n};\n\nexport const getC4ShapeInRow = function () {\n return c4ShapeInRow;\n};\nexport const getC4BoundaryInRow = function () {\n return c4BoundaryInRow;\n};\nexport const getCurrentBoundaryParse = function () {\n return currentBoundaryParse;\n};\n\nexport const getParentBoundaryParse = function () {\n return parentBoundaryParse;\n};\n\nexport const getC4ShapeArray = function (parentBoundary) {\n if (parentBoundary === undefined || parentBoundary === null) {\n return c4ShapeArray;\n } else {\n return c4ShapeArray.filter((personOrSystem) => {\n return personOrSystem.parentBoundary === parentBoundary;\n });\n }\n};\nexport const getC4Shape = function (alias) {\n return c4ShapeArray.find((personOrSystem) => personOrSystem.alias === alias);\n};\nexport const getC4ShapeKeys = function (parentBoundary) {\n return Object.keys(getC4ShapeArray(parentBoundary));\n};\n\nexport const getBoundaries = function (parentBoundary) {\n if (parentBoundary === undefined || parentBoundary === null) {\n return boundaries;\n } else {\n return boundaries.filter((boundary) => boundary.parentBoundary === parentBoundary);\n }\n};\n\n/**\n * @deprecated Use {@link getBoundaries} instead\n */\nexport const getBoundarys = getBoundaries;\n\nexport const getRels = function () {\n return rels;\n};\n\nexport const getTitle = function () {\n return title;\n};\n\nexport const setWrap = function (wrapSetting) {\n wrapEnabled = wrapSetting;\n};\n\nexport const autoWrap = function () {\n return wrapEnabled;\n};\n\nexport const clear = function () {\n c4ShapeArray = [];\n boundaries = [\n {\n alias: 'global',\n label: { text: 'global' },\n type: { text: 'global' },\n tags: null,\n link: null,\n parentBoundary: '',\n },\n ];\n parentBoundaryParse = '';\n currentBoundaryParse = 'global';\n boundaryParseStack = [''];\n rels = [];\n\n boundaryParseStack = [''];\n title = '';\n wrapEnabled = false;\n c4ShapeInRow = 4;\n c4BoundaryInRow = 2;\n};\n\nexport const LINETYPE = {\n SOLID: 0,\n DOTTED: 1,\n NOTE: 2,\n SOLID_CROSS: 3,\n DOTTED_CROSS: 4,\n SOLID_OPEN: 5,\n DOTTED_OPEN: 6,\n LOOP_START: 10,\n LOOP_END: 11,\n ALT_START: 12,\n ALT_ELSE: 13,\n ALT_END: 14,\n OPT_START: 15,\n OPT_END: 16,\n ACTIVE_START: 17,\n ACTIVE_END: 18,\n PAR_START: 19,\n PAR_AND: 20,\n PAR_END: 21,\n RECT_START: 22,\n RECT_END: 23,\n SOLID_POINT: 24,\n DOTTED_POINT: 25,\n};\n\nexport const ARROWTYPE = {\n FILLED: 0,\n OPEN: 1,\n};\n\nexport const PLACEMENT = {\n LEFTOF: 0,\n RIGHTOF: 1,\n OVER: 2,\n};\n\nexport const setTitle = function (txt) {\n let sanitizedText = sanitizeText(txt, getConfig());\n title = sanitizedText;\n};\n\nexport default {\n addPersonOrSystem,\n addPersonOrSystemBoundary,\n addContainer,\n addContainerBoundary,\n addComponent,\n addDeploymentNode,\n popBoundaryParseStack,\n addRel,\n updateElStyle,\n updateRelStyle,\n updateLayoutConfig,\n autoWrap,\n setWrap,\n getC4ShapeArray,\n getC4Shape,\n getC4ShapeKeys,\n getBoundaries,\n getBoundarys,\n getCurrentBoundaryParse,\n getParentBoundaryParse,\n getRels,\n getTitle,\n getC4Type,\n getC4ShapeInRow,\n getC4BoundaryInRow,\n setAccTitle,\n getAccTitle,\n getAccDescription,\n setAccDescription,\n getConfig: () => getConfig().c4,\n clear,\n LINETYPE,\n ARROWTYPE,\n PLACEMENT,\n setTitle,\n setC4Type,\n // apply,\n};\n", "export default function ascending(a, b) {\n return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n", "export default function descending(a, b) {\n return a == null || b == null ? NaN\n : b < a ? -1\n : b > a ? 1\n : b >= a ? 0\n : NaN;\n}\n", "import ascending from \"./ascending.js\";\nimport descending from \"./descending.js\";\n\nexport default function bisector(f) {\n let compare1, compare2, delta;\n\n // If an accessor is specified, promote it to a comparator. In this case we\n // can test whether the search value is (self-) comparable. We can\u2019t do this\n // for a comparator (except for specific, known comparators) because we can\u2019t\n // tell if the comparator is symmetric, and an asymmetric comparator can\u2019t be\n // used to test whether a single value is comparable.\n if (f.length !== 2) {\n compare1 = ascending;\n compare2 = (d, x) => ascending(f(d), x);\n delta = (d, x) => f(d) - x;\n } else {\n compare1 = f === ascending || f === descending ? f : zero;\n compare2 = f;\n delta = f;\n }\n\n function left(a, x, lo = 0, hi = a.length) {\n if (lo < hi) {\n if (compare1(x, x) !== 0) return hi;\n do {\n const mid = (lo + hi) >>> 1;\n if (compare2(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n } while (lo < hi);\n }\n return lo;\n }\n\n function right(a, x, lo = 0, hi = a.length) {\n if (lo < hi) {\n if (compare1(x, x) !== 0) return hi;\n do {\n const mid = (lo + hi) >>> 1;\n if (compare2(a[mid], x) <= 0) lo = mid + 1;\n else hi = mid;\n } while (lo < hi);\n }\n return lo;\n }\n\n function center(a, x, lo = 0, hi = a.length) {\n const i = left(a, x, lo, hi - 1);\n return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;\n }\n\n return {left, center, right};\n}\n\nfunction zero() {\n return 0;\n}\n", "export default function number(x) {\n return x === null ? NaN : +x;\n}\n\nexport function* numbers(values, valueof) {\n if (valueof === undefined) {\n for (let value of values) {\n if (value != null && (value = +value) >= value) {\n yield value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {\n yield value;\n }\n }\n }\n}\n", "import ascending from \"./ascending.js\";\nimport bisector from \"./bisector.js\";\nimport number from \"./number.js\";\n\nconst ascendingBisect = bisector(ascending);\nexport const bisectRight = ascendingBisect.right;\nexport const bisectLeft = ascendingBisect.left;\nexport const bisectCenter = bisector(number).center;\nexport default bisectRight;\n", "export class InternMap extends Map {\n constructor(entries, key = keyof) {\n super();\n Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});\n if (entries != null) for (const [key, value] of entries) this.set(key, value);\n }\n get(key) {\n return super.get(intern_get(this, key));\n }\n has(key) {\n return super.has(intern_get(this, key));\n }\n set(key, value) {\n return super.set(intern_set(this, key), value);\n }\n delete(key) {\n return super.delete(intern_delete(this, key));\n }\n}\n\nexport class InternSet extends Set {\n constructor(values, key = keyof) {\n super();\n Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});\n if (values != null) for (const value of values) this.add(value);\n }\n has(value) {\n return super.has(intern_get(this, value));\n }\n add(value) {\n return super.add(intern_set(this, value));\n }\n delete(value) {\n return super.delete(intern_delete(this, value));\n }\n}\n\nfunction intern_get({_intern, _key}, value) {\n const key = _key(value);\n return _intern.has(key) ? _intern.get(key) : value;\n}\n\nfunction intern_set({_intern, _key}, value) {\n const key = _key(value);\n if (_intern.has(key)) return _intern.get(key);\n _intern.set(key, value);\n return value;\n}\n\nfunction intern_delete({_intern, _key}, value) {\n const key = _key(value);\n if (_intern.has(key)) {\n value = _intern.get(key);\n _intern.delete(key);\n }\n return value;\n}\n\nfunction keyof(value) {\n return value !== null && typeof value === \"object\" ? value.valueOf() : value;\n}\n", "const e10 = Math.sqrt(50),\n e5 = Math.sqrt(10),\n e2 = Math.sqrt(2);\n\nfunction tickSpec(start, stop, count) {\n const step = (stop - start) / Math.max(0, count),\n power = Math.floor(Math.log10(step)),\n error = step / Math.pow(10, power),\n factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1;\n let i1, i2, inc;\n if (power < 0) {\n inc = Math.pow(10, -power) / factor;\n i1 = Math.round(start * inc);\n i2 = Math.round(stop * inc);\n if (i1 / inc < start) ++i1;\n if (i2 / inc > stop) --i2;\n inc = -inc;\n } else {\n inc = Math.pow(10, power) * factor;\n i1 = Math.round(start / inc);\n i2 = Math.round(stop / inc);\n if (i1 * inc < start) ++i1;\n if (i2 * inc > stop) --i2;\n }\n if (i2 < i1 && 0.5 <= count && count < 2) return tickSpec(start, stop, count * 2);\n return [i1, i2, inc];\n}\n\nexport default function ticks(start, stop, count) {\n stop = +stop, start = +start, count = +count;\n if (!(count > 0)) return [];\n if (start === stop) return [start];\n const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count);\n if (!(i2 >= i1)) return [];\n const n = i2 - i1 + 1, ticks = new Array(n);\n if (reverse) {\n if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) / -inc;\n else for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) * inc;\n } else {\n if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) / -inc;\n else for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) * inc;\n }\n return ticks;\n}\n\nexport function tickIncrement(start, stop, count) {\n stop = +stop, start = +start, count = +count;\n return tickSpec(start, stop, count)[2];\n}\n\nexport function tickStep(start, stop, count) {\n stop = +stop, start = +start, count = +count;\n const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count);\n return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);\n}\n", "export default function max(values, valueof) {\n let max;\n if (valueof === undefined) {\n for (const value of values) {\n if (value != null\n && (max < value || (max === undefined && value >= value))) {\n max = value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null\n && (max < value || (max === undefined && value >= value))) {\n max = value;\n }\n }\n }\n return max;\n}\n", "export default function min(values, valueof) {\n let min;\n if (valueof === undefined) {\n for (const value of values) {\n if (value != null\n && (min > value || (min === undefined && value >= value))) {\n min = value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null\n && (min > value || (min === undefined && value >= value))) {\n min = value;\n }\n }\n }\n return min;\n}\n", "export default function range(start, stop, step) {\n start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;\n\n var i = -1,\n n = Math.max(0, Math.ceil((stop - start) / step)) | 0,\n range = new Array(n);\n\n while (++i < n) {\n range[i] = start + i * step;\n }\n\n return range;\n}\n", "export {default as bisect, bisectRight, bisectLeft, bisectCenter} from \"./bisect.js\";\nexport {default as ascending} from \"./ascending.js\";\nexport {default as bisector} from \"./bisector.js\";\nexport {blur, blur2, blurImage} from \"./blur.js\";\nexport {default as count} from \"./count.js\";\nexport {default as cross} from \"./cross.js\";\nexport {default as cumsum} from \"./cumsum.js\";\nexport {default as descending} from \"./descending.js\";\nexport {default as deviation} from \"./deviation.js\";\nexport {default as extent} from \"./extent.js\";\nexport {Adder, fsum, fcumsum} from \"./fsum.js\";\nexport {default as group, flatGroup, flatRollup, groups, index, indexes, rollup, rollups} from \"./group.js\";\nexport {default as groupSort} from \"./groupSort.js\";\nexport {default as bin, default as histogram} from \"./bin.js\"; // Deprecated; use bin.\nexport {default as thresholdFreedmanDiaconis} from \"./threshold/freedmanDiaconis.js\";\nexport {default as thresholdScott} from \"./threshold/scott.js\";\nexport {default as thresholdSturges} from \"./threshold/sturges.js\";\nexport {default as max} from \"./max.js\";\nexport {default as maxIndex} from \"./maxIndex.js\";\nexport {default as mean} from \"./mean.js\";\nexport {default as median, medianIndex} from \"./median.js\";\nexport {default as merge} from \"./merge.js\";\nexport {default as min} from \"./min.js\";\nexport {default as minIndex} from \"./minIndex.js\";\nexport {default as mode} from \"./mode.js\";\nexport {default as nice} from \"./nice.js\";\nexport {default as pairs} from \"./pairs.js\";\nexport {default as permute} from \"./permute.js\";\nexport {default as quantile, quantileIndex, quantileSorted} from \"./quantile.js\";\nexport {default as quickselect} from \"./quickselect.js\";\nexport {default as range} from \"./range.js\";\nexport {default as rank} from \"./rank.js\";\nexport {default as least} from \"./least.js\";\nexport {default as leastIndex} from \"./leastIndex.js\";\nexport {default as greatest} from \"./greatest.js\";\nexport {default as greatestIndex} from \"./greatestIndex.js\";\nexport {default as scan} from \"./scan.js\"; // Deprecated; use leastIndex.\nexport {default as shuffle, shuffler} from \"./shuffle.js\";\nexport {default as sum} from \"./sum.js\";\nexport {default as ticks, tickIncrement, tickStep} from \"./ticks.js\";\nexport {default as transpose} from \"./transpose.js\";\nexport {default as variance} from \"./variance.js\";\nexport {default as zip} from \"./zip.js\";\nexport {default as every} from \"./every.js\";\nexport {default as some} from \"./some.js\";\nexport {default as filter} from \"./filter.js\";\nexport {default as map} from \"./map.js\";\nexport {default as reduce} from \"./reduce.js\";\nexport {default as reverse} from \"./reverse.js\";\nexport {default as sort} from \"./sort.js\";\nexport {default as difference} from \"./difference.js\";\nexport {default as disjoint} from \"./disjoint.js\";\nexport {default as intersection} from \"./intersection.js\";\nexport {default as subset} from \"./subset.js\";\nexport {default as superset} from \"./superset.js\";\nexport {default as union} from \"./union.js\";\nexport {InternMap, InternSet} from \"internmap\";\n", "export default function(x) {\n return x;\n}\n", "import identity from \"./identity.js\";\n\nvar top = 1,\n right = 2,\n bottom = 3,\n left = 4,\n epsilon = 1e-6;\n\nfunction translateX(x) {\n return \"translate(\" + x + \",0)\";\n}\n\nfunction translateY(y) {\n return \"translate(0,\" + y + \")\";\n}\n\nfunction number(scale) {\n return d => +scale(d);\n}\n\nfunction center(scale, offset) {\n offset = Math.max(0, scale.bandwidth() - offset * 2) / 2;\n if (scale.round()) offset = Math.round(offset);\n return d => +scale(d) + offset;\n}\n\nfunction entering() {\n return !this.__axis;\n}\n\nfunction axis(orient, scale) {\n var tickArguments = [],\n tickValues = null,\n tickFormat = null,\n tickSizeInner = 6,\n tickSizeOuter = 6,\n tickPadding = 3,\n offset = typeof window !== \"undefined\" && window.devicePixelRatio > 1 ? 0 : 0.5,\n k = orient === top || orient === left ? -1 : 1,\n x = orient === left || orient === right ? \"x\" : \"y\",\n transform = orient === top || orient === bottom ? translateX : translateY;\n\n function axis(context) {\n var values = tickValues == null ? (scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain()) : tickValues,\n format = tickFormat == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : identity) : tickFormat,\n spacing = Math.max(tickSizeInner, 0) + tickPadding,\n range = scale.range(),\n range0 = +range[0] + offset,\n range1 = +range[range.length - 1] + offset,\n position = (scale.bandwidth ? center : number)(scale.copy(), offset),\n selection = context.selection ? context.selection() : context,\n path = selection.selectAll(\".domain\").data([null]),\n tick = selection.selectAll(\".tick\").data(values, scale).order(),\n tickExit = tick.exit(),\n tickEnter = tick.enter().append(\"g\").attr(\"class\", \"tick\"),\n line = tick.select(\"line\"),\n text = tick.select(\"text\");\n\n path = path.merge(path.enter().insert(\"path\", \".tick\")\n .attr(\"class\", \"domain\")\n .attr(\"stroke\", \"currentColor\"));\n\n tick = tick.merge(tickEnter);\n\n line = line.merge(tickEnter.append(\"line\")\n .attr(\"stroke\", \"currentColor\")\n .attr(x + \"2\", k * tickSizeInner));\n\n text = text.merge(tickEnter.append(\"text\")\n .attr(\"fill\", \"currentColor\")\n .attr(x, k * spacing)\n .attr(\"dy\", orient === top ? \"0em\" : orient === bottom ? \"0.71em\" : \"0.32em\"));\n\n if (context !== selection) {\n path = path.transition(context);\n tick = tick.transition(context);\n line = line.transition(context);\n text = text.transition(context);\n\n tickExit = tickExit.transition(context)\n .attr(\"opacity\", epsilon)\n .attr(\"transform\", function(d) { return isFinite(d = position(d)) ? transform(d + offset) : this.getAttribute(\"transform\"); });\n\n tickEnter\n .attr(\"opacity\", epsilon)\n .attr(\"transform\", function(d) { var p = this.parentNode.__axis; return transform((p && isFinite(p = p(d)) ? p : position(d)) + offset); });\n }\n\n tickExit.remove();\n\n path\n .attr(\"d\", orient === left || orient === right\n ? (tickSizeOuter ? \"M\" + k * tickSizeOuter + \",\" + range0 + \"H\" + offset + \"V\" + range1 + \"H\" + k * tickSizeOuter : \"M\" + offset + \",\" + range0 + \"V\" + range1)\n : (tickSizeOuter ? \"M\" + range0 + \",\" + k * tickSizeOuter + \"V\" + offset + \"H\" + range1 + \"V\" + k * tickSizeOuter : \"M\" + range0 + \",\" + offset + \"H\" + range1));\n\n tick\n .attr(\"opacity\", 1)\n .attr(\"transform\", function(d) { return transform(position(d) + offset); });\n\n line\n .attr(x + \"2\", k * tickSizeInner);\n\n text\n .attr(x, k * spacing)\n .text(format);\n\n selection.filter(entering)\n .attr(\"fill\", \"none\")\n .attr(\"font-size\", 10)\n .attr(\"font-family\", \"sans-serif\")\n .attr(\"text-anchor\", orient === right ? \"start\" : orient === left ? \"end\" : \"middle\");\n\n selection\n .each(function() { this.__axis = position; });\n }\n\n axis.scale = function(_) {\n return arguments.length ? (scale = _, axis) : scale;\n };\n\n axis.ticks = function() {\n return tickArguments = Array.from(arguments), axis;\n };\n\n axis.tickArguments = function(_) {\n return arguments.length ? (tickArguments = _ == null ? [] : Array.from(_), axis) : tickArguments.slice();\n };\n\n axis.tickValues = function(_) {\n return arguments.length ? (tickValues = _ == null ? null : Array.from(_), axis) : tickValues && tickValues.slice();\n };\n\n axis.tickFormat = function(_) {\n return arguments.length ? (tickFormat = _, axis) : tickFormat;\n };\n\n axis.tickSize = function(_) {\n return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis) : tickSizeInner;\n };\n\n axis.tickSizeInner = function(_) {\n return arguments.length ? (tickSizeInner = +_, axis) : tickSizeInner;\n };\n\n axis.tickSizeOuter = function(_) {\n return arguments.length ? (tickSizeOuter = +_, axis) : tickSizeOuter;\n };\n\n axis.tickPadding = function(_) {\n return arguments.length ? (tickPadding = +_, axis) : tickPadding;\n };\n\n axis.offset = function(_) {\n return arguments.length ? (offset = +_, axis) : offset;\n };\n\n return axis;\n}\n\nexport function axisTop(scale) {\n return axis(top, scale);\n}\n\nexport function axisRight(scale) {\n return axis(right, scale);\n}\n\nexport function axisBottom(scale) {\n return axis(bottom, scale);\n}\n\nexport function axisLeft(scale) {\n return axis(left, scale);\n}\n", "export {\n axisTop,\n axisRight,\n axisBottom,\n axisLeft\n} from \"./axis.js\";\n", "var noop = {value: () => {}};\n\nfunction dispatch() {\n for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {\n if (!(t = arguments[i] + \"\") || (t in _) || /[\\s.]/.test(t)) throw new Error(\"illegal type: \" + t);\n _[t] = [];\n }\n return new Dispatch(_);\n}\n\nfunction Dispatch(_) {\n this._ = _;\n}\n\nfunction parseTypenames(typenames, types) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n if (t && !types.hasOwnProperty(t)) throw new Error(\"unknown type: \" + t);\n return {type: t, name: name};\n });\n}\n\nDispatch.prototype = dispatch.prototype = {\n constructor: Dispatch,\n on: function(typename, callback) {\n var _ = this._,\n T = parseTypenames(typename + \"\", _),\n t,\n i = -1,\n n = T.length;\n\n // If no callback was specified, return the callback of the given type and name.\n if (arguments.length < 2) {\n while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;\n return;\n }\n\n // If a type was specified, set the callback for the given type and name.\n // Otherwise, if a null callback was specified, remove callbacks of the given name.\n if (callback != null && typeof callback !== \"function\") throw new Error(\"invalid callback: \" + callback);\n while (++i < n) {\n if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);\n else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null);\n }\n\n return this;\n },\n copy: function() {\n var copy = {}, _ = this._;\n for (var t in _) copy[t] = _[t].slice();\n return new Dispatch(copy);\n },\n call: function(type, that) {\n if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n },\n apply: function(type, that, args) {\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n }\n};\n\nfunction get(type, name) {\n for (var i = 0, n = type.length, c; i < n; ++i) {\n if ((c = type[i]).name === name) {\n return c.value;\n }\n }\n}\n\nfunction set(type, name, callback) {\n for (var i = 0, n = type.length; i < n; ++i) {\n if (type[i].name === name) {\n type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));\n break;\n }\n }\n if (callback != null) type.push({name: name, value: callback});\n return type;\n}\n\nexport default dispatch;\n", "export {default as dispatch} from \"./dispatch.js\";\n", "export var xhtml = \"http://www.w3.org/1999/xhtml\";\n\nexport default {\n svg: \"http://www.w3.org/2000/svg\",\n xhtml: xhtml,\n xlink: \"http://www.w3.org/1999/xlink\",\n xml: \"http://www.w3.org/XML/1998/namespace\",\n xmlns: \"http://www.w3.org/2000/xmlns/\"\n};\n", "import namespaces from \"./namespaces.js\";\n\nexport default function(name) {\n var prefix = name += \"\", i = prefix.indexOf(\":\");\n if (i >= 0 && (prefix = name.slice(0, i)) !== \"xmlns\") name = name.slice(i + 1);\n return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name; // eslint-disable-line no-prototype-builtins\n}\n", "import namespace from \"./namespace.js\";\nimport {xhtml} from \"./namespaces.js\";\n\nfunction creatorInherit(name) {\n return function() {\n var document = this.ownerDocument,\n uri = this.namespaceURI;\n return uri === xhtml && document.documentElement.namespaceURI === xhtml\n ? document.createElement(name)\n : document.createElementNS(uri, name);\n };\n}\n\nfunction creatorFixed(fullname) {\n return function() {\n return this.ownerDocument.createElementNS(fullname.space, fullname.local);\n };\n}\n\nexport default function(name) {\n var fullname = namespace(name);\n return (fullname.local\n ? creatorFixed\n : creatorInherit)(fullname);\n}\n", "function none() {}\n\nexport default function(selector) {\n return selector == null ? none : function() {\n return this.querySelector(selector);\n };\n}\n", "import {Selection} from \"./index.js\";\nimport selector from \"../selector.js\";\n\nexport default function(select) {\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n", "// Given something array like (or null), returns something that is strictly an\n// array. This is used to ensure that array-like objects passed to d3.selectAll\n// or selection.selectAll are converted into proper arrays when creating a\n// selection; we don\u2019t ever want to create a selection backed by a live\n// HTMLCollection or NodeList. However, note that selection.selectAll will use a\n// static NodeList as a group, since it safely derived from querySelectorAll.\nexport default function array(x) {\n return x == null ? [] : Array.isArray(x) ? x : Array.from(x);\n}\n", "function empty() {\n return [];\n}\n\nexport default function(selector) {\n return selector == null ? empty : function() {\n return this.querySelectorAll(selector);\n };\n}\n", "import {Selection} from \"./index.js\";\nimport array from \"../array.js\";\nimport selectorAll from \"../selectorAll.js\";\n\nfunction arrayAll(select) {\n return function() {\n return array(select.apply(this, arguments));\n };\n}\n\nexport default function(select) {\n if (typeof select === \"function\") select = arrayAll(select);\n else select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n subgroups.push(select.call(node, node.__data__, i, group));\n parents.push(node);\n }\n }\n }\n\n return new Selection(subgroups, parents);\n}\n", "export default function(selector) {\n return function() {\n return this.matches(selector);\n };\n}\n\nexport function childMatcher(selector) {\n return function(node) {\n return node.matches(selector);\n };\n}\n\n", "import {childMatcher} from \"../matcher.js\";\n\nvar find = Array.prototype.find;\n\nfunction childFind(match) {\n return function() {\n return find.call(this.children, match);\n };\n}\n\nfunction childFirst() {\n return this.firstElementChild;\n}\n\nexport default function(match) {\n return this.select(match == null ? childFirst\n : childFind(typeof match === \"function\" ? match : childMatcher(match)));\n}\n", "import {childMatcher} from \"../matcher.js\";\n\nvar filter = Array.prototype.filter;\n\nfunction children() {\n return Array.from(this.children);\n}\n\nfunction childrenFilter(match) {\n return function() {\n return filter.call(this.children, match);\n };\n}\n\nexport default function(match) {\n return this.selectAll(match == null ? children\n : childrenFilter(typeof match === \"function\" ? match : childMatcher(match)));\n}\n", "import {Selection} from \"./index.js\";\nimport matcher from \"../matcher.js\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n", "export default function(update) {\n return new Array(update.length);\n}\n", "import sparse from \"./sparse.js\";\nimport {Selection} from \"./index.js\";\n\nexport default function() {\n return new Selection(this._enter || this._groups.map(sparse), this._parents);\n}\n\nexport function EnterNode(parent, datum) {\n this.ownerDocument = parent.ownerDocument;\n this.namespaceURI = parent.namespaceURI;\n this._next = null;\n this._parent = parent;\n this.__data__ = datum;\n}\n\nEnterNode.prototype = {\n constructor: EnterNode,\n appendChild: function(child) { return this._parent.insertBefore(child, this._next); },\n insertBefore: function(child, next) { return this._parent.insertBefore(child, next); },\n querySelector: function(selector) { return this._parent.querySelector(selector); },\n querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }\n};\n", "export default function(x) {\n return function() {\n return x;\n };\n}\n", "import {Selection} from \"./index.js\";\nimport {EnterNode} from \"./enter.js\";\nimport constant from \"../constant.js\";\n\nfunction bindIndex(parent, group, enter, update, exit, data) {\n var i = 0,\n node,\n groupLength = group.length,\n dataLength = data.length;\n\n // Put any non-null nodes that fit into update.\n // Put any null nodes into enter.\n // Put any remaining data into enter.\n for (; i < dataLength; ++i) {\n if (node = group[i]) {\n node.__data__ = data[i];\n update[i] = node;\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Put any non-null nodes that don\u2019t fit into exit.\n for (; i < groupLength; ++i) {\n if (node = group[i]) {\n exit[i] = node;\n }\n }\n}\n\nfunction bindKey(parent, group, enter, update, exit, data, key) {\n var i,\n node,\n nodeByKeyValue = new Map,\n groupLength = group.length,\n dataLength = data.length,\n keyValues = new Array(groupLength),\n keyValue;\n\n // Compute the key for each node.\n // If multiple nodes have the same key, the duplicates are added to exit.\n for (i = 0; i < groupLength; ++i) {\n if (node = group[i]) {\n keyValues[i] = keyValue = key.call(node, node.__data__, i, group) + \"\";\n if (nodeByKeyValue.has(keyValue)) {\n exit[i] = node;\n } else {\n nodeByKeyValue.set(keyValue, node);\n }\n }\n }\n\n // Compute the key for each datum.\n // If there a node associated with this key, join and add it to update.\n // If there is not (or the key is a duplicate), add it to enter.\n for (i = 0; i < dataLength; ++i) {\n keyValue = key.call(parent, data[i], i, data) + \"\";\n if (node = nodeByKeyValue.get(keyValue)) {\n update[i] = node;\n node.__data__ = data[i];\n nodeByKeyValue.delete(keyValue);\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Add any remaining nodes that were not bound to data to exit.\n for (i = 0; i < groupLength; ++i) {\n if ((node = group[i]) && (nodeByKeyValue.get(keyValues[i]) === node)) {\n exit[i] = node;\n }\n }\n}\n\nfunction datum(node) {\n return node.__data__;\n}\n\nexport default function(value, key) {\n if (!arguments.length) return Array.from(this, datum);\n\n var bind = key ? bindKey : bindIndex,\n parents = this._parents,\n groups = this._groups;\n\n if (typeof value !== \"function\") value = constant(value);\n\n for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {\n var parent = parents[j],\n group = groups[j],\n groupLength = group.length,\n data = arraylike(value.call(parent, parent && parent.__data__, j, parents)),\n dataLength = data.length,\n enterGroup = enter[j] = new Array(dataLength),\n updateGroup = update[j] = new Array(dataLength),\n exitGroup = exit[j] = new Array(groupLength);\n\n bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);\n\n // Now connect the enter nodes to their following update node, such that\n // appendChild can insert the materialized enter node before this node,\n // rather than at the end of the parent node.\n for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {\n if (previous = enterGroup[i0]) {\n if (i0 >= i1) i1 = i0 + 1;\n while (!(next = updateGroup[i1]) && ++i1 < dataLength);\n previous._next = next || null;\n }\n }\n }\n\n update = new Selection(update, parents);\n update._enter = enter;\n update._exit = exit;\n return update;\n}\n\n// Given some data, this returns an array-like view of it: an object that\n// exposes a length property and allows numeric indexing. Note that unlike\n// selectAll, this isn\u2019t worried about \u201Clive\u201D collections because the resulting\n// array will only be used briefly while data is being bound. (It is possible to\n// cause the data to change while iterating by using a key function, but please\n// don\u2019t; we\u2019d rather avoid a gratuitous copy.)\nfunction arraylike(data) {\n return typeof data === \"object\" && \"length\" in data\n ? data // Array, TypedArray, NodeList, array-like\n : Array.from(data); // Map, Set, iterable, string, or anything else\n}\n", "import sparse from \"./sparse.js\";\nimport {Selection} from \"./index.js\";\n\nexport default function() {\n return new Selection(this._exit || this._groups.map(sparse), this._parents);\n}\n", "export default function(onenter, onupdate, onexit) {\n var enter = this.enter(), update = this, exit = this.exit();\n if (typeof onenter === \"function\") {\n enter = onenter(enter);\n if (enter) enter = enter.selection();\n } else {\n enter = enter.append(onenter + \"\");\n }\n if (onupdate != null) {\n update = onupdate(update);\n if (update) update = update.selection();\n }\n if (onexit == null) exit.remove(); else onexit(exit);\n return enter && update ? enter.merge(update).order() : update;\n}\n", "import {Selection} from \"./index.js\";\n\nexport default function(context) {\n var selection = context.selection ? context.selection() : context;\n\n for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Selection(merges, this._parents);\n}\n", "export default function() {\n\n for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {\n for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {\n if (node = group[i]) {\n if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);\n next = node;\n }\n }\n }\n\n return this;\n}\n", "import {Selection} from \"./index.js\";\n\nexport default function(compare) {\n if (!compare) compare = ascending;\n\n function compareNode(a, b) {\n return a && b ? compare(a.__data__, b.__data__) : !a - !b;\n }\n\n for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n sortgroup[i] = node;\n }\n }\n sortgroup.sort(compareNode);\n }\n\n return new Selection(sortgroups, this._parents).order();\n}\n\nfunction ascending(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n", "export default function() {\n var callback = arguments[0];\n arguments[0] = this;\n callback.apply(null, arguments);\n return this;\n}\n", "export default function() {\n return Array.from(this);\n}\n", "export default function() {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {\n var node = group[i];\n if (node) return node;\n }\n }\n\n return null;\n}\n", "export default function() {\n let size = 0;\n for (const node of this) ++size; // eslint-disable-line no-unused-vars\n return size;\n}\n", "export default function() {\n return !this.node();\n}\n", "export default function(callback) {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) callback.call(node, node.__data__, i, group);\n }\n }\n\n return this;\n}\n", "import namespace from \"../namespace.js\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, value) {\n return function() {\n this.setAttribute(name, value);\n };\n}\n\nfunction attrConstantNS(fullname, value) {\n return function() {\n this.setAttributeNS(fullname.space, fullname.local, value);\n };\n}\n\nfunction attrFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttribute(name);\n else this.setAttribute(name, v);\n };\n}\n\nfunction attrFunctionNS(fullname, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttributeNS(fullname.space, fullname.local);\n else this.setAttributeNS(fullname.space, fullname.local, v);\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name);\n\n if (arguments.length < 2) {\n var node = this.node();\n return fullname.local\n ? node.getAttributeNS(fullname.space, fullname.local)\n : node.getAttribute(fullname);\n }\n\n return this.each((value == null\n ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)\n : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));\n}\n", "export default function(node) {\n return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node\n || (node.document && node) // node is a Window\n || node.defaultView; // node is a Document\n}\n", "import defaultView from \"../window.js\";\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, value, priority) {\n return function() {\n this.style.setProperty(name, value, priority);\n };\n}\n\nfunction styleFunction(name, value, priority) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.style.removeProperty(name);\n else this.style.setProperty(name, v, priority);\n };\n}\n\nexport default function(name, value, priority) {\n return arguments.length > 1\n ? this.each((value == null\n ? styleRemove : typeof value === \"function\"\n ? styleFunction\n : styleConstant)(name, value, priority == null ? \"\" : priority))\n : styleValue(this.node(), name);\n}\n\nexport function styleValue(node, name) {\n return node.style.getPropertyValue(name)\n || defaultView(node).getComputedStyle(node, null).getPropertyValue(name);\n}\n", "function propertyRemove(name) {\n return function() {\n delete this[name];\n };\n}\n\nfunction propertyConstant(name, value) {\n return function() {\n this[name] = value;\n };\n}\n\nfunction propertyFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) delete this[name];\n else this[name] = v;\n };\n}\n\nexport default function(name, value) {\n return arguments.length > 1\n ? this.each((value == null\n ? propertyRemove : typeof value === \"function\"\n ? propertyFunction\n : propertyConstant)(name, value))\n : this.node()[name];\n}\n", "function classArray(string) {\n return string.trim().split(/^|\\s+/);\n}\n\nfunction classList(node) {\n return node.classList || new ClassList(node);\n}\n\nfunction ClassList(node) {\n this._node = node;\n this._names = classArray(node.getAttribute(\"class\") || \"\");\n}\n\nClassList.prototype = {\n add: function(name) {\n var i = this._names.indexOf(name);\n if (i < 0) {\n this._names.push(name);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n remove: function(name) {\n var i = this._names.indexOf(name);\n if (i >= 0) {\n this._names.splice(i, 1);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n contains: function(name) {\n return this._names.indexOf(name) >= 0;\n }\n};\n\nfunction classedAdd(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.add(names[i]);\n}\n\nfunction classedRemove(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.remove(names[i]);\n}\n\nfunction classedTrue(names) {\n return function() {\n classedAdd(this, names);\n };\n}\n\nfunction classedFalse(names) {\n return function() {\n classedRemove(this, names);\n };\n}\n\nfunction classedFunction(names, value) {\n return function() {\n (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);\n };\n}\n\nexport default function(name, value) {\n var names = classArray(name + \"\");\n\n if (arguments.length < 2) {\n var list = classList(this.node()), i = -1, n = names.length;\n while (++i < n) if (!list.contains(names[i])) return false;\n return true;\n }\n\n return this.each((typeof value === \"function\"\n ? classedFunction : value\n ? classedTrue\n : classedFalse)(names, value));\n}\n", "function textRemove() {\n this.textContent = \"\";\n}\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.textContent = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? textRemove : (typeof value === \"function\"\n ? textFunction\n : textConstant)(value))\n : this.node().textContent;\n}\n", "function htmlRemove() {\n this.innerHTML = \"\";\n}\n\nfunction htmlConstant(value) {\n return function() {\n this.innerHTML = value;\n };\n}\n\nfunction htmlFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.innerHTML = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? htmlRemove : (typeof value === \"function\"\n ? htmlFunction\n : htmlConstant)(value))\n : this.node().innerHTML;\n}\n", "function raise() {\n if (this.nextSibling) this.parentNode.appendChild(this);\n}\n\nexport default function() {\n return this.each(raise);\n}\n", "function lower() {\n if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);\n}\n\nexport default function() {\n return this.each(lower);\n}\n", "import creator from \"../creator.js\";\n\nexport default function(name) {\n var create = typeof name === \"function\" ? name : creator(name);\n return this.select(function() {\n return this.appendChild(create.apply(this, arguments));\n });\n}\n", "import creator from \"../creator.js\";\nimport selector from \"../selector.js\";\n\nfunction constantNull() {\n return null;\n}\n\nexport default function(name, before) {\n var create = typeof name === \"function\" ? name : creator(name),\n select = before == null ? constantNull : typeof before === \"function\" ? before : selector(before);\n return this.select(function() {\n return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);\n });\n}\n", "function remove() {\n var parent = this.parentNode;\n if (parent) parent.removeChild(this);\n}\n\nexport default function() {\n return this.each(remove);\n}\n", "function selection_cloneShallow() {\n var clone = this.cloneNode(false), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nfunction selection_cloneDeep() {\n var clone = this.cloneNode(true), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nexport default function(deep) {\n return this.select(deep ? selection_cloneDeep : selection_cloneShallow);\n}\n", "export default function(value) {\n return arguments.length\n ? this.property(\"__data__\", value)\n : this.node().__data__;\n}\n", "function contextListener(listener) {\n return function(event) {\n listener.call(this, event, this.__data__);\n };\n}\n\nfunction parseTypenames(typenames) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n return {type: t, name: name};\n });\n}\n\nfunction onRemove(typename) {\n return function() {\n var on = this.__on;\n if (!on) return;\n for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {\n if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n } else {\n on[++i] = o;\n }\n }\n if (++i) on.length = i;\n else delete this.__on;\n };\n}\n\nfunction onAdd(typename, value, options) {\n return function() {\n var on = this.__on, o, listener = contextListener(value);\n if (on) for (var j = 0, m = on.length; j < m; ++j) {\n if ((o = on[j]).type === typename.type && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n this.addEventListener(o.type, o.listener = listener, o.options = options);\n o.value = value;\n return;\n }\n }\n this.addEventListener(typename.type, listener, options);\n o = {type: typename.type, name: typename.name, value: value, listener: listener, options: options};\n if (!on) this.__on = [o];\n else on.push(o);\n };\n}\n\nexport default function(typename, value, options) {\n var typenames = parseTypenames(typename + \"\"), i, n = typenames.length, t;\n\n if (arguments.length < 2) {\n var on = this.node().__on;\n if (on) for (var j = 0, m = on.length, o; j < m; ++j) {\n for (i = 0, o = on[j]; i < n; ++i) {\n if ((t = typenames[i]).type === o.type && t.name === o.name) {\n return o.value;\n }\n }\n }\n return;\n }\n\n on = value ? onAdd : onRemove;\n for (i = 0; i < n; ++i) this.each(on(typenames[i], value, options));\n return this;\n}\n", "import defaultView from \"../window.js\";\n\nfunction dispatchEvent(node, type, params) {\n var window = defaultView(node),\n event = window.CustomEvent;\n\n if (typeof event === \"function\") {\n event = new event(type, params);\n } else {\n event = window.document.createEvent(\"Event\");\n if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;\n else event.initEvent(type, false, false);\n }\n\n node.dispatchEvent(event);\n}\n\nfunction dispatchConstant(type, params) {\n return function() {\n return dispatchEvent(this, type, params);\n };\n}\n\nfunction dispatchFunction(type, params) {\n return function() {\n return dispatchEvent(this, type, params.apply(this, arguments));\n };\n}\n\nexport default function(type, params) {\n return this.each((typeof params === \"function\"\n ? dispatchFunction\n : dispatchConstant)(type, params));\n}\n", "export default function*() {\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) yield node;\n }\n }\n}\n", "import selection_select from \"./select.js\";\nimport selection_selectAll from \"./selectAll.js\";\nimport selection_selectChild from \"./selectChild.js\";\nimport selection_selectChildren from \"./selectChildren.js\";\nimport selection_filter from \"./filter.js\";\nimport selection_data from \"./data.js\";\nimport selection_enter from \"./enter.js\";\nimport selection_exit from \"./exit.js\";\nimport selection_join from \"./join.js\";\nimport selection_merge from \"./merge.js\";\nimport selection_order from \"./order.js\";\nimport selection_sort from \"./sort.js\";\nimport selection_call from \"./call.js\";\nimport selection_nodes from \"./nodes.js\";\nimport selection_node from \"./node.js\";\nimport selection_size from \"./size.js\";\nimport selection_empty from \"./empty.js\";\nimport selection_each from \"./each.js\";\nimport selection_attr from \"./attr.js\";\nimport selection_style from \"./style.js\";\nimport selection_property from \"./property.js\";\nimport selection_classed from \"./classed.js\";\nimport selection_text from \"./text.js\";\nimport selection_html from \"./html.js\";\nimport selection_raise from \"./raise.js\";\nimport selection_lower from \"./lower.js\";\nimport selection_append from \"./append.js\";\nimport selection_insert from \"./insert.js\";\nimport selection_remove from \"./remove.js\";\nimport selection_clone from \"./clone.js\";\nimport selection_datum from \"./datum.js\";\nimport selection_on from \"./on.js\";\nimport selection_dispatch from \"./dispatch.js\";\nimport selection_iterator from \"./iterator.js\";\n\nexport var root = [null];\n\nexport function Selection(groups, parents) {\n this._groups = groups;\n this._parents = parents;\n}\n\nfunction selection() {\n return new Selection([[document.documentElement]], root);\n}\n\nfunction selection_selection() {\n return this;\n}\n\nSelection.prototype = selection.prototype = {\n constructor: Selection,\n select: selection_select,\n selectAll: selection_selectAll,\n selectChild: selection_selectChild,\n selectChildren: selection_selectChildren,\n filter: selection_filter,\n data: selection_data,\n enter: selection_enter,\n exit: selection_exit,\n join: selection_join,\n merge: selection_merge,\n selection: selection_selection,\n order: selection_order,\n sort: selection_sort,\n call: selection_call,\n nodes: selection_nodes,\n node: selection_node,\n size: selection_size,\n empty: selection_empty,\n each: selection_each,\n attr: selection_attr,\n style: selection_style,\n property: selection_property,\n classed: selection_classed,\n text: selection_text,\n html: selection_html,\n raise: selection_raise,\n lower: selection_lower,\n append: selection_append,\n insert: selection_insert,\n remove: selection_remove,\n clone: selection_clone,\n datum: selection_datum,\n on: selection_on,\n dispatch: selection_dispatch,\n [Symbol.iterator]: selection_iterator\n};\n\nexport default selection;\n", "import {Selection, root} from \"./selection/index.js\";\n\nexport default function(selector) {\n return typeof selector === \"string\"\n ? new Selection([[document.querySelector(selector)]], [document.documentElement])\n : new Selection([[selector]], root);\n}\n", "export {default as create} from \"./create.js\";\nexport {default as creator} from \"./creator.js\";\nexport {default as local} from \"./local.js\";\nexport {default as matcher} from \"./matcher.js\";\nexport {default as namespace} from \"./namespace.js\";\nexport {default as namespaces} from \"./namespaces.js\";\nexport {default as pointer} from \"./pointer.js\";\nexport {default as pointers} from \"./pointers.js\";\nexport {default as select} from \"./select.js\";\nexport {default as selectAll} from \"./selectAll.js\";\nexport {default as selection} from \"./selection/index.js\";\nexport {default as selector} from \"./selector.js\";\nexport {default as selectorAll} from \"./selectorAll.js\";\nexport {styleValue as style} from \"./selection/style.js\";\nexport {default as window} from \"./window.js\";\n", "export {default as drag} from \"./drag.js\";\nexport {default as dragDisable, yesdrag as dragEnable} from \"./nodrag.js\";\n", "export default function(constructor, factory, prototype) {\n constructor.prototype = factory.prototype = prototype;\n prototype.constructor = constructor;\n}\n\nexport function extend(parent, definition) {\n var prototype = Object.create(parent.prototype);\n for (var key in definition) prototype[key] = definition[key];\n return prototype;\n}\n", "import define, {extend} from \"./define.js\";\n\nexport function Color() {}\n\nexport var darker = 0.7;\nexport var brighter = 1 / darker;\n\nvar reI = \"\\\\s*([+-]?\\\\d+)\\\\s*\",\n reN = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)\\\\s*\",\n reP = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)%\\\\s*\",\n reHex = /^#([0-9a-f]{3,8})$/,\n reRgbInteger = new RegExp(`^rgb\\\\(${reI},${reI},${reI}\\\\)$`),\n reRgbPercent = new RegExp(`^rgb\\\\(${reP},${reP},${reP}\\\\)$`),\n reRgbaInteger = new RegExp(`^rgba\\\\(${reI},${reI},${reI},${reN}\\\\)$`),\n reRgbaPercent = new RegExp(`^rgba\\\\(${reP},${reP},${reP},${reN}\\\\)$`),\n reHslPercent = new RegExp(`^hsl\\\\(${reN},${reP},${reP}\\\\)$`),\n reHslaPercent = new RegExp(`^hsla\\\\(${reN},${reP},${reP},${reN}\\\\)$`);\n\nvar named = {\n aliceblue: 0xf0f8ff,\n antiquewhite: 0xfaebd7,\n aqua: 0x00ffff,\n aquamarine: 0x7fffd4,\n azure: 0xf0ffff,\n beige: 0xf5f5dc,\n bisque: 0xffe4c4,\n black: 0x000000,\n blanchedalmond: 0xffebcd,\n blue: 0x0000ff,\n blueviolet: 0x8a2be2,\n brown: 0xa52a2a,\n burlywood: 0xdeb887,\n cadetblue: 0x5f9ea0,\n chartreuse: 0x7fff00,\n chocolate: 0xd2691e,\n coral: 0xff7f50,\n cornflowerblue: 0x6495ed,\n cornsilk: 0xfff8dc,\n crimson: 0xdc143c,\n cyan: 0x00ffff,\n darkblue: 0x00008b,\n darkcyan: 0x008b8b,\n darkgoldenrod: 0xb8860b,\n darkgray: 0xa9a9a9,\n darkgreen: 0x006400,\n darkgrey: 0xa9a9a9,\n darkkhaki: 0xbdb76b,\n darkmagenta: 0x8b008b,\n darkolivegreen: 0x556b2f,\n darkorange: 0xff8c00,\n darkorchid: 0x9932cc,\n darkred: 0x8b0000,\n darksalmon: 0xe9967a,\n darkseagreen: 0x8fbc8f,\n darkslateblue: 0x483d8b,\n darkslategray: 0x2f4f4f,\n darkslategrey: 0x2f4f4f,\n darkturquoise: 0x00ced1,\n darkviolet: 0x9400d3,\n deeppink: 0xff1493,\n deepskyblue: 0x00bfff,\n dimgray: 0x696969,\n dimgrey: 0x696969,\n dodgerblue: 0x1e90ff,\n firebrick: 0xb22222,\n floralwhite: 0xfffaf0,\n forestgreen: 0x228b22,\n fuchsia: 0xff00ff,\n gainsboro: 0xdcdcdc,\n ghostwhite: 0xf8f8ff,\n gold: 0xffd700,\n goldenrod: 0xdaa520,\n gray: 0x808080,\n green: 0x008000,\n greenyellow: 0xadff2f,\n grey: 0x808080,\n honeydew: 0xf0fff0,\n hotpink: 0xff69b4,\n indianred: 0xcd5c5c,\n indigo: 0x4b0082,\n ivory: 0xfffff0,\n khaki: 0xf0e68c,\n lavender: 0xe6e6fa,\n lavenderblush: 0xfff0f5,\n lawngreen: 0x7cfc00,\n lemonchiffon: 0xfffacd,\n lightblue: 0xadd8e6,\n lightcoral: 0xf08080,\n lightcyan: 0xe0ffff,\n lightgoldenrodyellow: 0xfafad2,\n lightgray: 0xd3d3d3,\n lightgreen: 0x90ee90,\n lightgrey: 0xd3d3d3,\n lightpink: 0xffb6c1,\n lightsalmon: 0xffa07a,\n lightseagreen: 0x20b2aa,\n lightskyblue: 0x87cefa,\n lightslategray: 0x778899,\n lightslategrey: 0x778899,\n lightsteelblue: 0xb0c4de,\n lightyellow: 0xffffe0,\n lime: 0x00ff00,\n limegreen: 0x32cd32,\n linen: 0xfaf0e6,\n magenta: 0xff00ff,\n maroon: 0x800000,\n mediumaquamarine: 0x66cdaa,\n mediumblue: 0x0000cd,\n mediumorchid: 0xba55d3,\n mediumpurple: 0x9370db,\n mediumseagreen: 0x3cb371,\n mediumslateblue: 0x7b68ee,\n mediumspringgreen: 0x00fa9a,\n mediumturquoise: 0x48d1cc,\n mediumvioletred: 0xc71585,\n midnightblue: 0x191970,\n mintcream: 0xf5fffa,\n mistyrose: 0xffe4e1,\n moccasin: 0xffe4b5,\n navajowhite: 0xffdead,\n navy: 0x000080,\n oldlace: 0xfdf5e6,\n olive: 0x808000,\n olivedrab: 0x6b8e23,\n orange: 0xffa500,\n orangered: 0xff4500,\n orchid: 0xda70d6,\n palegoldenrod: 0xeee8aa,\n palegreen: 0x98fb98,\n paleturquoise: 0xafeeee,\n palevioletred: 0xdb7093,\n papayawhip: 0xffefd5,\n peachpuff: 0xffdab9,\n peru: 0xcd853f,\n pink: 0xffc0cb,\n plum: 0xdda0dd,\n powderblue: 0xb0e0e6,\n purple: 0x800080,\n rebeccapurple: 0x663399,\n red: 0xff0000,\n rosybrown: 0xbc8f8f,\n royalblue: 0x4169e1,\n saddlebrown: 0x8b4513,\n salmon: 0xfa8072,\n sandybrown: 0xf4a460,\n seagreen: 0x2e8b57,\n seashell: 0xfff5ee,\n sienna: 0xa0522d,\n silver: 0xc0c0c0,\n skyblue: 0x87ceeb,\n slateblue: 0x6a5acd,\n slategray: 0x708090,\n slategrey: 0x708090,\n snow: 0xfffafa,\n springgreen: 0x00ff7f,\n steelblue: 0x4682b4,\n tan: 0xd2b48c,\n teal: 0x008080,\n thistle: 0xd8bfd8,\n tomato: 0xff6347,\n turquoise: 0x40e0d0,\n violet: 0xee82ee,\n wheat: 0xf5deb3,\n white: 0xffffff,\n whitesmoke: 0xf5f5f5,\n yellow: 0xffff00,\n yellowgreen: 0x9acd32\n};\n\ndefine(Color, color, {\n copy(channels) {\n return Object.assign(new this.constructor, this, channels);\n },\n displayable() {\n return this.rgb().displayable();\n },\n hex: color_formatHex, // Deprecated! Use color.formatHex.\n formatHex: color_formatHex,\n formatHex8: color_formatHex8,\n formatHsl: color_formatHsl,\n formatRgb: color_formatRgb,\n toString: color_formatRgb\n});\n\nfunction color_formatHex() {\n return this.rgb().formatHex();\n}\n\nfunction color_formatHex8() {\n return this.rgb().formatHex8();\n}\n\nfunction color_formatHsl() {\n return hslConvert(this).formatHsl();\n}\n\nfunction color_formatRgb() {\n return this.rgb().formatRgb();\n}\n\nexport default function color(format) {\n var m, l;\n format = (format + \"\").trim().toLowerCase();\n return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000\n : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00\n : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000\n : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000\n : null) // invalid hex\n : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)\n : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)\n : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)\n : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)\n : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)\n : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)\n : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins\n : format === \"transparent\" ? new Rgb(NaN, NaN, NaN, 0)\n : null;\n}\n\nfunction rgbn(n) {\n return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);\n}\n\nfunction rgba(r, g, b, a) {\n if (a <= 0) r = g = b = NaN;\n return new Rgb(r, g, b, a);\n}\n\nexport function rgbConvert(o) {\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Rgb;\n o = o.rgb();\n return new Rgb(o.r, o.g, o.b, o.opacity);\n}\n\nexport function rgb(r, g, b, opacity) {\n return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);\n}\n\nexport function Rgb(r, g, b, opacity) {\n this.r = +r;\n this.g = +g;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Rgb, rgb, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n rgb() {\n return this;\n },\n clamp() {\n return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));\n },\n displayable() {\n return (-0.5 <= this.r && this.r < 255.5)\n && (-0.5 <= this.g && this.g < 255.5)\n && (-0.5 <= this.b && this.b < 255.5)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n hex: rgb_formatHex, // Deprecated! Use color.formatHex.\n formatHex: rgb_formatHex,\n formatHex8: rgb_formatHex8,\n formatRgb: rgb_formatRgb,\n toString: rgb_formatRgb\n}));\n\nfunction rgb_formatHex() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;\n}\n\nfunction rgb_formatHex8() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;\n}\n\nfunction rgb_formatRgb() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"rgb(\" : \"rgba(\"}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? \")\" : `, ${a})`}`;\n}\n\nfunction clampa(opacity) {\n return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));\n}\n\nfunction clampi(value) {\n return Math.max(0, Math.min(255, Math.round(value) || 0));\n}\n\nfunction hex(value) {\n value = clampi(value);\n return (value < 16 ? \"0\" : \"\") + value.toString(16);\n}\n\nfunction hsla(h, s, l, a) {\n if (a <= 0) h = s = l = NaN;\n else if (l <= 0 || l >= 1) h = s = NaN;\n else if (s <= 0) h = NaN;\n return new Hsl(h, s, l, a);\n}\n\nexport function hslConvert(o) {\n if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Hsl;\n if (o instanceof Hsl) return o;\n o = o.rgb();\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n h = NaN,\n s = max - min,\n l = (max + min) / 2;\n if (s) {\n if (r === max) h = (g - b) / s + (g < b) * 6;\n else if (g === max) h = (b - r) / s + 2;\n else h = (r - g) / s + 4;\n s /= l < 0.5 ? max + min : 2 - max - min;\n h *= 60;\n } else {\n s = l > 0 && l < 1 ? 0 : h;\n }\n return new Hsl(h, s, l, o.opacity);\n}\n\nexport function hsl(h, s, l, opacity) {\n return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);\n}\n\nfunction Hsl(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Hsl, hsl, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n rgb() {\n var h = this.h % 360 + (this.h < 0) * 360,\n s = isNaN(h) || isNaN(this.s) ? 0 : this.s,\n l = this.l,\n m2 = l + (l < 0.5 ? l : 1 - l) * s,\n m1 = 2 * l - m2;\n return new Rgb(\n hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),\n hsl2rgb(h, m1, m2),\n hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),\n this.opacity\n );\n },\n clamp() {\n return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));\n },\n displayable() {\n return (0 <= this.s && this.s <= 1 || isNaN(this.s))\n && (0 <= this.l && this.l <= 1)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n formatHsl() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"hsl(\" : \"hsla(\"}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? \")\" : `, ${a})`}`;\n }\n}));\n\nfunction clamph(value) {\n value = (value || 0) % 360;\n return value < 0 ? value + 360 : value;\n}\n\nfunction clampt(value) {\n return Math.max(0, Math.min(1, value || 0));\n}\n\n/* From FvD 13.37, CSS Color Module Level 3 */\nfunction hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60\n : h < 180 ? m2\n : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60\n : m1) * 255;\n}\n", "export const radians = Math.PI / 180;\nexport const degrees = 180 / Math.PI;\n", "import define, {extend} from \"./define.js\";\nimport {Color, rgbConvert, Rgb} from \"./color.js\";\nimport {degrees, radians} from \"./math.js\";\n\n// https://observablehq.com/@mbostock/lab-and-rgb\nconst K = 18,\n Xn = 0.96422,\n Yn = 1,\n Zn = 0.82521,\n t0 = 4 / 29,\n t1 = 6 / 29,\n t2 = 3 * t1 * t1,\n t3 = t1 * t1 * t1;\n\nfunction labConvert(o) {\n if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);\n if (o instanceof Hcl) return hcl2lab(o);\n if (!(o instanceof Rgb)) o = rgbConvert(o);\n var r = rgb2lrgb(o.r),\n g = rgb2lrgb(o.g),\n b = rgb2lrgb(o.b),\n y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;\n if (r === g && g === b) x = z = y; else {\n x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);\n z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);\n }\n return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);\n}\n\nexport function gray(l, opacity) {\n return new Lab(l, 0, 0, opacity == null ? 1 : opacity);\n}\n\nexport default function lab(l, a, b, opacity) {\n return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);\n}\n\nexport function Lab(l, a, b, opacity) {\n this.l = +l;\n this.a = +a;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Lab, lab, extend(Color, {\n brighter(k) {\n return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);\n },\n darker(k) {\n return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);\n },\n rgb() {\n var y = (this.l + 16) / 116,\n x = isNaN(this.a) ? y : y + this.a / 500,\n z = isNaN(this.b) ? y : y - this.b / 200;\n x = Xn * lab2xyz(x);\n y = Yn * lab2xyz(y);\n z = Zn * lab2xyz(z);\n return new Rgb(\n lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z),\n lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z),\n lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z),\n this.opacity\n );\n }\n}));\n\nfunction xyz2lab(t) {\n return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;\n}\n\nfunction lab2xyz(t) {\n return t > t1 ? t * t * t : t2 * (t - t0);\n}\n\nfunction lrgb2rgb(x) {\n return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);\n}\n\nfunction rgb2lrgb(x) {\n return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);\n}\n\nfunction hclConvert(o) {\n if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);\n if (!(o instanceof Lab)) o = labConvert(o);\n if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);\n var h = Math.atan2(o.b, o.a) * degrees;\n return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);\n}\n\nexport function lch(l, c, h, opacity) {\n return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity);\n}\n\nexport function hcl(h, c, l, opacity) {\n return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);\n}\n\nexport function Hcl(h, c, l, opacity) {\n this.h = +h;\n this.c = +c;\n this.l = +l;\n this.opacity = +opacity;\n}\n\nfunction hcl2lab(o) {\n if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);\n var h = o.h * radians;\n return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);\n}\n\ndefine(Hcl, hcl, extend(Color, {\n brighter(k) {\n return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);\n },\n darker(k) {\n return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);\n },\n rgb() {\n return hcl2lab(this).rgb();\n }\n}));\n", "export {default as color, rgb, hsl} from \"./color.js\";\nexport {default as lab, hcl, lch, gray} from \"./lab.js\";\nexport {default as cubehelix} from \"./cubehelix.js\";\n", "export function basis(t1, v0, v1, v2, v3) {\n var t2 = t1 * t1, t3 = t2 * t1;\n return ((1 - 3 * t1 + 3 * t2 - t3) * v0\n + (4 - 6 * t2 + 3 * t3) * v1\n + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2\n + t3 * v3) / 6;\n}\n\nexport default function(values) {\n var n = values.length - 1;\n return function(t) {\n var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),\n v1 = values[i],\n v2 = values[i + 1],\n v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,\n v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n}\n", "import {basis} from \"./basis.js\";\n\nexport default function(values) {\n var n = values.length;\n return function(t) {\n var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),\n v0 = values[(i + n - 1) % n],\n v1 = values[i % n],\n v2 = values[(i + 1) % n],\n v3 = values[(i + 2) % n];\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n}\n", "export default x => () => x;\n", "import constant from \"./constant.js\";\n\nfunction linear(a, d) {\n return function(t) {\n return a + t * d;\n };\n}\n\nfunction exponential(a, b, y) {\n return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {\n return Math.pow(a + t * b, y);\n };\n}\n\nexport function hue(a, b) {\n var d = b - a;\n return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a);\n}\n\nexport function gamma(y) {\n return (y = +y) === 1 ? nogamma : function(a, b) {\n return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);\n };\n}\n\nexport default function nogamma(a, b) {\n var d = b - a;\n return d ? linear(a, d) : constant(isNaN(a) ? b : a);\n}\n", "import {rgb as colorRgb} from \"d3-color\";\nimport basis from \"./basis.js\";\nimport basisClosed from \"./basisClosed.js\";\nimport nogamma, {gamma} from \"./color.js\";\n\nexport default (function rgbGamma(y) {\n var color = gamma(y);\n\n function rgb(start, end) {\n var r = color((start = colorRgb(start)).r, (end = colorRgb(end)).r),\n g = color(start.g, end.g),\n b = color(start.b, end.b),\n opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.r = r(t);\n start.g = g(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n rgb.gamma = rgbGamma;\n\n return rgb;\n})(1);\n\nfunction rgbSpline(spline) {\n return function(colors) {\n var n = colors.length,\n r = new Array(n),\n g = new Array(n),\n b = new Array(n),\n i, color;\n for (i = 0; i < n; ++i) {\n color = colorRgb(colors[i]);\n r[i] = color.r || 0;\n g[i] = color.g || 0;\n b[i] = color.b || 0;\n }\n r = spline(r);\n g = spline(g);\n b = spline(b);\n color.opacity = 1;\n return function(t) {\n color.r = r(t);\n color.g = g(t);\n color.b = b(t);\n return color + \"\";\n };\n };\n}\n\nexport var rgbBasis = rgbSpline(basis);\nexport var rgbBasisClosed = rgbSpline(basisClosed);\n", "export default function(a, b) {\n if (!b) b = [];\n var n = a ? Math.min(b.length, a.length) : 0,\n c = b.slice(),\n i;\n return function(t) {\n for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;\n return c;\n };\n}\n\nexport function isNumberArray(x) {\n return ArrayBuffer.isView(x) && !(x instanceof DataView);\n}\n", "import value from \"./value.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n return (isNumberArray(b) ? numberArray : genericArray)(a, b);\n}\n\nexport function genericArray(a, b) {\n var nb = b ? b.length : 0,\n na = a ? Math.min(nb, a.length) : 0,\n x = new Array(na),\n c = new Array(nb),\n i;\n\n for (i = 0; i < na; ++i) x[i] = value(a[i], b[i]);\n for (; i < nb; ++i) c[i] = b[i];\n\n return function(t) {\n for (i = 0; i < na; ++i) c[i] = x[i](t);\n return c;\n };\n}\n", "export default function(a, b) {\n var d = new Date;\n return a = +a, b = +b, function(t) {\n return d.setTime(a * (1 - t) + b * t), d;\n };\n}\n", "export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return a * (1 - t) + b * t;\n };\n}\n", "import value from \"./value.js\";\n\nexport default function(a, b) {\n var i = {},\n c = {},\n k;\n\n if (a === null || typeof a !== \"object\") a = {};\n if (b === null || typeof b !== \"object\") b = {};\n\n for (k in b) {\n if (k in a) {\n i[k] = value(a[k], b[k]);\n } else {\n c[k] = b[k];\n }\n }\n\n return function(t) {\n for (k in i) c[k] = i[k](t);\n return c;\n };\n}\n", "import number from \"./number.js\";\n\nvar reA = /[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g,\n reB = new RegExp(reA.source, \"g\");\n\nfunction zero(b) {\n return function() {\n return b;\n };\n}\n\nfunction one(b) {\n return function(t) {\n return b(t) + \"\";\n };\n}\n\nexport default function(a, b) {\n var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b\n am, // current match in a\n bm, // current match in b\n bs, // string preceding current number in b, if any\n i = -1, // index in s\n s = [], // string constants and placeholders\n q = []; // number interpolators\n\n // Coerce inputs to strings.\n a = a + \"\", b = b + \"\";\n\n // Interpolate pairs of numbers in a & b.\n while ((am = reA.exec(a))\n && (bm = reB.exec(b))) {\n if ((bs = bm.index) > bi) { // a string precedes the next number in b\n bs = b.slice(bi, bs);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match\n if (s[i]) s[i] += bm; // coalesce with previous string\n else s[++i] = bm;\n } else { // interpolate non-matching numbers\n s[++i] = null;\n q.push({i: i, x: number(am, bm)});\n }\n bi = reB.lastIndex;\n }\n\n // Add remains of b.\n if (bi < b.length) {\n bs = b.slice(bi);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n\n // Special optimization for only a single match.\n // Otherwise, interpolate each of the numbers and rejoin the string.\n return s.length < 2 ? (q[0]\n ? one(q[0].x)\n : zero(b))\n : (b = q.length, function(t) {\n for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n });\n}\n", "import {color} from \"d3-color\";\nimport rgb from \"./rgb.js\";\nimport {genericArray} from \"./array.js\";\nimport date from \"./date.js\";\nimport number from \"./number.js\";\nimport object from \"./object.js\";\nimport string from \"./string.js\";\nimport constant from \"./constant.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n var t = typeof b, c;\n return b == null || t === \"boolean\" ? constant(b)\n : (t === \"number\" ? number\n : t === \"string\" ? ((c = color(b)) ? (b = c, rgb) : string)\n : b instanceof color ? rgb\n : b instanceof Date ? date\n : isNumberArray(b) ? numberArray\n : Array.isArray(b) ? genericArray\n : typeof b.valueOf !== \"function\" && typeof b.toString !== \"function\" || isNaN(b) ? object\n : number)(a, b);\n}\n", "export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return Math.round(a * (1 - t) + b * t);\n };\n}\n", "var degrees = 180 / Math.PI;\n\nexport var identity = {\n translateX: 0,\n translateY: 0,\n rotate: 0,\n skewX: 0,\n scaleX: 1,\n scaleY: 1\n};\n\nexport default function(a, b, c, d, e, f) {\n var scaleX, scaleY, skewX;\n if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;\n if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;\n if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;\n if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;\n return {\n translateX: e,\n translateY: f,\n rotate: Math.atan2(b, a) * degrees,\n skewX: Math.atan(skewX) * degrees,\n scaleX: scaleX,\n scaleY: scaleY\n };\n}\n", "import decompose, {identity} from \"./decompose.js\";\n\nvar svgNode;\n\n/* eslint-disable no-undef */\nexport function parseCss(value) {\n const m = new (typeof DOMMatrix === \"function\" ? DOMMatrix : WebKitCSSMatrix)(value + \"\");\n return m.isIdentity ? identity : decompose(m.a, m.b, m.c, m.d, m.e, m.f);\n}\n\nexport function parseSvg(value) {\n if (value == null) return identity;\n if (!svgNode) svgNode = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\n svgNode.setAttribute(\"transform\", value);\n if (!(value = svgNode.transform.baseVal.consolidate())) return identity;\n value = value.matrix;\n return decompose(value.a, value.b, value.c, value.d, value.e, value.f);\n}\n", "import number from \"../number.js\";\nimport {parseCss, parseSvg} from \"./parse.js\";\n\nfunction interpolateTransform(parse, pxComma, pxParen, degParen) {\n\n function pop(s) {\n return s.length ? s.pop() + \" \" : \"\";\n }\n\n function translate(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(\"translate(\", null, pxComma, null, pxParen);\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb || yb) {\n s.push(\"translate(\" + xb + pxComma + yb + pxParen);\n }\n }\n\n function rotate(a, b, s, q) {\n if (a !== b) {\n if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path\n q.push({i: s.push(pop(s) + \"rotate(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"rotate(\" + b + degParen);\n }\n }\n\n function skewX(a, b, s, q) {\n if (a !== b) {\n q.push({i: s.push(pop(s) + \"skewX(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"skewX(\" + b + degParen);\n }\n }\n\n function scale(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(pop(s) + \"scale(\", null, \",\", null, \")\");\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb !== 1 || yb !== 1) {\n s.push(pop(s) + \"scale(\" + xb + \",\" + yb + \")\");\n }\n }\n\n return function(a, b) {\n var s = [], // string constants and placeholders\n q = []; // number interpolators\n a = parse(a), b = parse(b);\n translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);\n rotate(a.rotate, b.rotate, s, q);\n skewX(a.skewX, b.skewX, s, q);\n scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);\n a = b = null; // gc\n return function(t) {\n var i = -1, n = q.length, o;\n while (++i < n) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n };\n };\n}\n\nexport var interpolateTransformCss = interpolateTransform(parseCss, \"px, \", \"px)\", \"deg)\");\nexport var interpolateTransformSvg = interpolateTransform(parseSvg, \", \", \")\", \")\");\n", "import {hcl as colorHcl} from \"d3-color\";\nimport color, {hue} from \"./color.js\";\n\nfunction hcl(hue) {\n return function(start, end) {\n var h = hue((start = colorHcl(start)).h, (end = colorHcl(end)).h),\n c = color(start.c, end.c),\n l = color(start.l, end.l),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.c = c(t);\n start.l = l(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n}\n\nexport default hcl(hue);\nexport var hclLong = hcl(color);\n", "export {default as interpolate} from \"./value.js\";\nexport {default as interpolateArray} from \"./array.js\";\nexport {default as interpolateBasis} from \"./basis.js\";\nexport {default as interpolateBasisClosed} from \"./basisClosed.js\";\nexport {default as interpolateDate} from \"./date.js\";\nexport {default as interpolateDiscrete} from \"./discrete.js\";\nexport {default as interpolateHue} from \"./hue.js\";\nexport {default as interpolateNumber} from \"./number.js\";\nexport {default as interpolateNumberArray} from \"./numberArray.js\";\nexport {default as interpolateObject} from \"./object.js\";\nexport {default as interpolateRound} from \"./round.js\";\nexport {default as interpolateString} from \"./string.js\";\nexport {interpolateTransformCss, interpolateTransformSvg} from \"./transform/index.js\";\nexport {default as interpolateZoom} from \"./zoom.js\";\nexport {default as interpolateRgb, rgbBasis as interpolateRgbBasis, rgbBasisClosed as interpolateRgbBasisClosed} from \"./rgb.js\";\nexport {default as interpolateHsl, hslLong as interpolateHslLong} from \"./hsl.js\";\nexport {default as interpolateLab} from \"./lab.js\";\nexport {default as interpolateHcl, hclLong as interpolateHclLong} from \"./hcl.js\";\nexport {default as interpolateCubehelix, cubehelixLong as interpolateCubehelixLong} from \"./cubehelix.js\";\nexport {default as piecewise} from \"./piecewise.js\";\nexport {default as quantize} from \"./quantize.js\";\n", "var frame = 0, // is an animation frame pending?\n timeout = 0, // is a timeout pending?\n interval = 0, // are any timers active?\n pokeDelay = 1000, // how frequently we check for clock skew\n taskHead,\n taskTail,\n clockLast = 0,\n clockNow = 0,\n clockSkew = 0,\n clock = typeof performance === \"object\" && performance.now ? performance : Date,\n setFrame = typeof window === \"object\" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };\n\nexport function now() {\n return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);\n}\n\nfunction clearNow() {\n clockNow = 0;\n}\n\nexport function Timer() {\n this._call =\n this._time =\n this._next = null;\n}\n\nTimer.prototype = timer.prototype = {\n constructor: Timer,\n restart: function(callback, delay, time) {\n if (typeof callback !== \"function\") throw new TypeError(\"callback is not a function\");\n time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);\n if (!this._next && taskTail !== this) {\n if (taskTail) taskTail._next = this;\n else taskHead = this;\n taskTail = this;\n }\n this._call = callback;\n this._time = time;\n sleep();\n },\n stop: function() {\n if (this._call) {\n this._call = null;\n this._time = Infinity;\n sleep();\n }\n }\n};\n\nexport function timer(callback, delay, time) {\n var t = new Timer;\n t.restart(callback, delay, time);\n return t;\n}\n\nexport function timerFlush() {\n now(); // Get the current time, if not already set.\n ++frame; // Pretend we\u2019ve set an alarm, if we haven\u2019t already.\n var t = taskHead, e;\n while (t) {\n if ((e = clockNow - t._time) >= 0) t._call.call(undefined, e);\n t = t._next;\n }\n --frame;\n}\n\nfunction wake() {\n clockNow = (clockLast = clock.now()) + clockSkew;\n frame = timeout = 0;\n try {\n timerFlush();\n } finally {\n frame = 0;\n nap();\n clockNow = 0;\n }\n}\n\nfunction poke() {\n var now = clock.now(), delay = now - clockLast;\n if (delay > pokeDelay) clockSkew -= delay, clockLast = now;\n}\n\nfunction nap() {\n var t0, t1 = taskHead, t2, time = Infinity;\n while (t1) {\n if (t1._call) {\n if (time > t1._time) time = t1._time;\n t0 = t1, t1 = t1._next;\n } else {\n t2 = t1._next, t1._next = null;\n t1 = t0 ? t0._next = t2 : taskHead = t2;\n }\n }\n taskTail = t0;\n sleep(time);\n}\n\nfunction sleep(time) {\n if (frame) return; // Soonest alarm already set, or will be.\n if (timeout) timeout = clearTimeout(timeout);\n var delay = time - clockNow; // Strictly less than if we recomputed clockNow.\n if (delay > 24) {\n if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);\n if (interval) interval = clearInterval(interval);\n } else {\n if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);\n frame = 1, setFrame(wake);\n }\n}\n", "import {Timer} from \"./timer.js\";\n\nexport default function(callback, delay, time) {\n var t = new Timer;\n delay = delay == null ? 0 : +delay;\n t.restart(elapsed => {\n t.stop();\n callback(elapsed + delay);\n }, delay, time);\n return t;\n}\n", "export {\n now,\n timer,\n timerFlush\n} from \"./timer.js\";\n\nexport {\n default as timeout\n} from \"./timeout.js\";\n\nexport {\n default as interval\n} from \"./interval.js\";\n", "import {dispatch} from \"d3-dispatch\";\nimport {timer, timeout} from \"d3-timer\";\n\nvar emptyOn = dispatch(\"start\", \"end\", \"cancel\", \"interrupt\");\nvar emptyTween = [];\n\nexport var CREATED = 0;\nexport var SCHEDULED = 1;\nexport var STARTING = 2;\nexport var STARTED = 3;\nexport var RUNNING = 4;\nexport var ENDING = 5;\nexport var ENDED = 6;\n\nexport default function(node, name, id, index, group, timing) {\n var schedules = node.__transition;\n if (!schedules) node.__transition = {};\n else if (id in schedules) return;\n create(node, id, {\n name: name,\n index: index, // For context during callback.\n group: group, // For context during callback.\n on: emptyOn,\n tween: emptyTween,\n time: timing.time,\n delay: timing.delay,\n duration: timing.duration,\n ease: timing.ease,\n timer: null,\n state: CREATED\n });\n}\n\nexport function init(node, id) {\n var schedule = get(node, id);\n if (schedule.state > CREATED) throw new Error(\"too late; already scheduled\");\n return schedule;\n}\n\nexport function set(node, id) {\n var schedule = get(node, id);\n if (schedule.state > STARTED) throw new Error(\"too late; already running\");\n return schedule;\n}\n\nexport function get(node, id) {\n var schedule = node.__transition;\n if (!schedule || !(schedule = schedule[id])) throw new Error(\"transition not found\");\n return schedule;\n}\n\nfunction create(node, id, self) {\n var schedules = node.__transition,\n tween;\n\n // Initialize the self timer when the transition is created.\n // Note the actual delay is not known until the first callback!\n schedules[id] = self;\n self.timer = timer(schedule, 0, self.time);\n\n function schedule(elapsed) {\n self.state = SCHEDULED;\n self.timer.restart(start, self.delay, self.time);\n\n // If the elapsed delay is less than our first sleep, start immediately.\n if (self.delay <= elapsed) start(elapsed - self.delay);\n }\n\n function start(elapsed) {\n var i, j, n, o;\n\n // If the state is not SCHEDULED, then we previously errored on start.\n if (self.state !== SCHEDULED) return stop();\n\n for (i in schedules) {\n o = schedules[i];\n if (o.name !== self.name) continue;\n\n // While this element already has a starting transition during this frame,\n // defer starting an interrupting transition until that transition has a\n // chance to tick (and possibly end); see d3/d3-transition#54!\n if (o.state === STARTED) return timeout(start);\n\n // Interrupt the active transition, if any.\n if (o.state === RUNNING) {\n o.state = ENDED;\n o.timer.stop();\n o.on.call(\"interrupt\", node, node.__data__, o.index, o.group);\n delete schedules[i];\n }\n\n // Cancel any pre-empted transitions.\n else if (+i < id) {\n o.state = ENDED;\n o.timer.stop();\n o.on.call(\"cancel\", node, node.__data__, o.index, o.group);\n delete schedules[i];\n }\n }\n\n // Defer the first tick to end of the current frame; see d3/d3#1576.\n // Note the transition may be canceled after start and before the first tick!\n // Note this must be scheduled before the start event; see d3/d3-transition#16!\n // Assuming this is successful, subsequent callbacks go straight to tick.\n timeout(function() {\n if (self.state === STARTED) {\n self.state = RUNNING;\n self.timer.restart(tick, self.delay, self.time);\n tick(elapsed);\n }\n });\n\n // Dispatch the start event.\n // Note this must be done before the tween are initialized.\n self.state = STARTING;\n self.on.call(\"start\", node, node.__data__, self.index, self.group);\n if (self.state !== STARTING) return; // interrupted\n self.state = STARTED;\n\n // Initialize the tween, deleting null tween.\n tween = new Array(n = self.tween.length);\n for (i = 0, j = -1; i < n; ++i) {\n if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {\n tween[++j] = o;\n }\n }\n tween.length = j + 1;\n }\n\n function tick(elapsed) {\n var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1),\n i = -1,\n n = tween.length;\n\n while (++i < n) {\n tween[i].call(node, t);\n }\n\n // Dispatch the end event.\n if (self.state === ENDING) {\n self.on.call(\"end\", node, node.__data__, self.index, self.group);\n stop();\n }\n }\n\n function stop() {\n self.state = ENDED;\n self.timer.stop();\n delete schedules[id];\n for (var i in schedules) return; // eslint-disable-line no-unused-vars\n delete node.__transition;\n }\n}\n", "import {STARTING, ENDING, ENDED} from \"./transition/schedule.js\";\n\nexport default function(node, name) {\n var schedules = node.__transition,\n schedule,\n active,\n empty = true,\n i;\n\n if (!schedules) return;\n\n name = name == null ? null : name + \"\";\n\n for (i in schedules) {\n if ((schedule = schedules[i]).name !== name) { empty = false; continue; }\n active = schedule.state > STARTING && schedule.state < ENDING;\n schedule.state = ENDED;\n schedule.timer.stop();\n schedule.on.call(active ? \"interrupt\" : \"cancel\", node, node.__data__, schedule.index, schedule.group);\n delete schedules[i];\n }\n\n if (empty) delete node.__transition;\n}\n", "import interrupt from \"../interrupt.js\";\n\nexport default function(name) {\n return this.each(function() {\n interrupt(this, name);\n });\n}\n", "import {get, set} from \"./schedule.js\";\n\nfunction tweenRemove(id, name) {\n var tween0, tween1;\n return function() {\n var schedule = set(this, id),\n tween = schedule.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we\u2019re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = tween0 = tween;\n for (var i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1 = tween1.slice();\n tween1.splice(i, 1);\n break;\n }\n }\n }\n\n schedule.tween = tween1;\n };\n}\n\nfunction tweenFunction(id, name, value) {\n var tween0, tween1;\n if (typeof value !== \"function\") throw new Error;\n return function() {\n var schedule = set(this, id),\n tween = schedule.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we\u2019re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = (tween0 = tween).slice();\n for (var t = {name: name, value: value}, i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1[i] = t;\n break;\n }\n }\n if (i === n) tween1.push(t);\n }\n\n schedule.tween = tween1;\n };\n}\n\nexport default function(name, value) {\n var id = this._id;\n\n name += \"\";\n\n if (arguments.length < 2) {\n var tween = get(this.node(), id).tween;\n for (var i = 0, n = tween.length, t; i < n; ++i) {\n if ((t = tween[i]).name === name) {\n return t.value;\n }\n }\n return null;\n }\n\n return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));\n}\n\nexport function tweenValue(transition, name, value) {\n var id = transition._id;\n\n transition.each(function() {\n var schedule = set(this, id);\n (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);\n });\n\n return function(node) {\n return get(node, id).value[name];\n };\n}\n", "import {color} from \"d3-color\";\nimport {interpolateNumber, interpolateRgb, interpolateString} from \"d3-interpolate\";\n\nexport default function(a, b) {\n var c;\n return (typeof b === \"number\" ? interpolateNumber\n : b instanceof color ? interpolateRgb\n : (c = color(b)) ? (b = c, interpolateRgb)\n : interpolateString)(a, b);\n}\n", "import {interpolateTransformSvg as interpolateTransform} from \"d3-interpolate\";\nimport {namespace} from \"d3-selection\";\nimport {tweenValue} from \"./tween.js\";\nimport interpolate from \"./interpolate.js\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = this.getAttribute(name);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction attrConstantNS(fullname, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = this.getAttributeNS(fullname.space, fullname.local);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction attrFunction(name, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0, value1 = value(this), string1;\n if (value1 == null) return void this.removeAttribute(name);\n string0 = this.getAttribute(name);\n string1 = value1 + \"\";\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nfunction attrFunctionNS(fullname, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0, value1 = value(this), string1;\n if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);\n string0 = this.getAttributeNS(fullname.space, fullname.local);\n string1 = value1 + \"\";\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name), i = fullname === \"transform\" ? interpolateTransform : interpolate;\n return this.attrTween(name, typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)(fullname, i, tweenValue(this, \"attr.\" + name, value))\n : value == null ? (fullname.local ? attrRemoveNS : attrRemove)(fullname)\n : (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value));\n}\n", "import {namespace} from \"d3-selection\";\n\nfunction attrInterpolate(name, i) {\n return function(t) {\n this.setAttribute(name, i.call(this, t));\n };\n}\n\nfunction attrInterpolateNS(fullname, i) {\n return function(t) {\n this.setAttributeNS(fullname.space, fullname.local, i.call(this, t));\n };\n}\n\nfunction attrTweenNS(fullname, value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && attrInterpolateNS(fullname, i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nfunction attrTween(name, value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && attrInterpolate(name, i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(name, value) {\n var key = \"attr.\" + name;\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n var fullname = namespace(name);\n return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));\n}\n", "import {get, init} from \"./schedule.js\";\n\nfunction delayFunction(id, value) {\n return function() {\n init(this, id).delay = +value.apply(this, arguments);\n };\n}\n\nfunction delayConstant(id, value) {\n return value = +value, function() {\n init(this, id).delay = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? delayFunction\n : delayConstant)(id, value))\n : get(this.node(), id).delay;\n}\n", "import {get, set} from \"./schedule.js\";\n\nfunction durationFunction(id, value) {\n return function() {\n set(this, id).duration = +value.apply(this, arguments);\n };\n}\n\nfunction durationConstant(id, value) {\n return value = +value, function() {\n set(this, id).duration = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? durationFunction\n : durationConstant)(id, value))\n : get(this.node(), id).duration;\n}\n", "import {get, set} from \"./schedule.js\";\n\nfunction easeConstant(id, value) {\n if (typeof value !== \"function\") throw new Error;\n return function() {\n set(this, id).ease = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each(easeConstant(id, value))\n : get(this.node(), id).ease;\n}\n", "import {set} from \"./schedule.js\";\n\nfunction easeVarying(id, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (typeof v !== \"function\") throw new Error;\n set(this, id).ease = v;\n };\n}\n\nexport default function(value) {\n if (typeof value !== \"function\") throw new Error;\n return this.each(easeVarying(this._id, value));\n}\n", "import {matcher} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Transition(subgroups, this._parents, this._name, this._id);\n}\n", "import {Transition} from \"./index.js\";\n\nexport default function(transition) {\n if (transition._id !== this._id) throw new Error;\n\n for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Transition(merges, this._parents, this._name, this._id);\n}\n", "import {get, set, init} from \"./schedule.js\";\n\nfunction start(name) {\n return (name + \"\").trim().split(/^|\\s+/).every(function(t) {\n var i = t.indexOf(\".\");\n if (i >= 0) t = t.slice(0, i);\n return !t || t === \"start\";\n });\n}\n\nfunction onFunction(id, name, listener) {\n var on0, on1, sit = start(name) ? init : set;\n return function() {\n var schedule = sit(this, id),\n on = schedule.on;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we\u2019re done!\n // Otherwise, copy-on-write.\n if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);\n\n schedule.on = on1;\n };\n}\n\nexport default function(name, listener) {\n var id = this._id;\n\n return arguments.length < 2\n ? get(this.node(), id).on.on(name)\n : this.each(onFunction(id, name, listener));\n}\n", "function removeFunction(id) {\n return function() {\n var parent = this.parentNode;\n for (var i in this.__transition) if (+i !== id) return;\n if (parent) parent.removeChild(this);\n };\n}\n\nexport default function() {\n return this.on(\"end.remove\", removeFunction(this._id));\n}\n", "import {selector} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n schedule(subgroup[i], name, id, i, subgroup, get(node, id));\n }\n }\n }\n\n return new Transition(subgroups, this._parents, name, id);\n}\n", "import {selectorAll} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n for (var children = select.call(node, node.__data__, i, group), child, inherit = get(node, id), k = 0, l = children.length; k < l; ++k) {\n if (child = children[k]) {\n schedule(child, name, id, k, children, inherit);\n }\n }\n subgroups.push(children);\n parents.push(node);\n }\n }\n }\n\n return new Transition(subgroups, parents, name, id);\n}\n", "import {selection} from \"d3-selection\";\n\nvar Selection = selection.prototype.constructor;\n\nexport default function() {\n return new Selection(this._groups, this._parents);\n}\n", "import {interpolateTransformCss as interpolateTransform} from \"d3-interpolate\";\nimport {style} from \"d3-selection\";\nimport {set} from \"./schedule.js\";\nimport {tweenValue} from \"./tween.js\";\nimport interpolate from \"./interpolate.js\";\n\nfunction styleNull(name, interpolate) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0 = style(this, name),\n string1 = (this.style.removeProperty(name), style(this, name));\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, string10 = string1);\n };\n}\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = style(this, name);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction styleFunction(name, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0 = style(this, name),\n value1 = value(this),\n string1 = value1 + \"\";\n if (value1 == null) string1 = value1 = (this.style.removeProperty(name), style(this, name));\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nfunction styleMaybeRemove(id, name) {\n var on0, on1, listener0, key = \"style.\" + name, event = \"end.\" + key, remove;\n return function() {\n var schedule = set(this, id),\n on = schedule.on,\n listener = schedule.value[key] == null ? remove || (remove = styleRemove(name)) : undefined;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we\u2019re done!\n // Otherwise, copy-on-write.\n if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener);\n\n schedule.on = on1;\n };\n}\n\nexport default function(name, value, priority) {\n var i = (name += \"\") === \"transform\" ? interpolateTransform : interpolate;\n return value == null ? this\n .styleTween(name, styleNull(name, i))\n .on(\"end.style.\" + name, styleRemove(name))\n : typeof value === \"function\" ? this\n .styleTween(name, styleFunction(name, i, tweenValue(this, \"style.\" + name, value)))\n .each(styleMaybeRemove(this._id, name))\n : this\n .styleTween(name, styleConstant(name, i, value), priority)\n .on(\"end.style.\" + name, null);\n}\n", "function styleInterpolate(name, i, priority) {\n return function(t) {\n this.style.setProperty(name, i.call(this, t), priority);\n };\n}\n\nfunction styleTween(name, value, priority) {\n var t, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t = (i0 = i) && styleInterpolate(name, i, priority);\n return t;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(name, value, priority) {\n var key = \"style.\" + (name += \"\");\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n return this.tween(key, styleTween(name, value, priority == null ? \"\" : priority));\n}\n", "import {tweenValue} from \"./tween.js\";\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var value1 = value(this);\n this.textContent = value1 == null ? \"\" : value1;\n };\n}\n\nexport default function(value) {\n return this.tween(\"text\", typeof value === \"function\"\n ? textFunction(tweenValue(this, \"text\", value))\n : textConstant(value == null ? \"\" : value + \"\"));\n}\n", "function textInterpolate(i) {\n return function(t) {\n this.textContent = i.call(this, t);\n };\n}\n\nfunction textTween(value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && textInterpolate(i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(value) {\n var key = \"text\";\n if (arguments.length < 1) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n return this.tween(key, textTween(value));\n}\n", "import {Transition, newId} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function() {\n var name = this._name,\n id0 = this._id,\n id1 = newId();\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n var inherit = get(node, id0);\n schedule(node, name, id1, i, group, {\n time: inherit.time + inherit.delay + inherit.duration,\n delay: 0,\n duration: inherit.duration,\n ease: inherit.ease\n });\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id1);\n}\n", "import {set} from \"./schedule.js\";\n\nexport default function() {\n var on0, on1, that = this, id = that._id, size = that.size();\n return new Promise(function(resolve, reject) {\n var cancel = {value: reject},\n end = {value: function() { if (--size === 0) resolve(); }};\n\n that.each(function() {\n var schedule = set(this, id),\n on = schedule.on;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we\u2019re done!\n // Otherwise, copy-on-write.\n if (on !== on0) {\n on1 = (on0 = on).copy();\n on1._.cancel.push(cancel);\n on1._.interrupt.push(cancel);\n on1._.end.push(end);\n }\n\n schedule.on = on1;\n });\n\n // The selection was empty, resolve end immediately\n if (size === 0) resolve();\n });\n}\n", "import {selection} from \"d3-selection\";\nimport transition_attr from \"./attr.js\";\nimport transition_attrTween from \"./attrTween.js\";\nimport transition_delay from \"./delay.js\";\nimport transition_duration from \"./duration.js\";\nimport transition_ease from \"./ease.js\";\nimport transition_easeVarying from \"./easeVarying.js\";\nimport transition_filter from \"./filter.js\";\nimport transition_merge from \"./merge.js\";\nimport transition_on from \"./on.js\";\nimport transition_remove from \"./remove.js\";\nimport transition_select from \"./select.js\";\nimport transition_selectAll from \"./selectAll.js\";\nimport transition_selection from \"./selection.js\";\nimport transition_style from \"./style.js\";\nimport transition_styleTween from \"./styleTween.js\";\nimport transition_text from \"./text.js\";\nimport transition_textTween from \"./textTween.js\";\nimport transition_transition from \"./transition.js\";\nimport transition_tween from \"./tween.js\";\nimport transition_end from \"./end.js\";\n\nvar id = 0;\n\nexport function Transition(groups, parents, name, id) {\n this._groups = groups;\n this._parents = parents;\n this._name = name;\n this._id = id;\n}\n\nexport default function transition(name) {\n return selection().transition(name);\n}\n\nexport function newId() {\n return ++id;\n}\n\nvar selection_prototype = selection.prototype;\n\nTransition.prototype = transition.prototype = {\n constructor: Transition,\n select: transition_select,\n selectAll: transition_selectAll,\n selectChild: selection_prototype.selectChild,\n selectChildren: selection_prototype.selectChildren,\n filter: transition_filter,\n merge: transition_merge,\n selection: transition_selection,\n transition: transition_transition,\n call: selection_prototype.call,\n nodes: selection_prototype.nodes,\n node: selection_prototype.node,\n size: selection_prototype.size,\n empty: selection_prototype.empty,\n each: selection_prototype.each,\n on: transition_on,\n attr: transition_attr,\n attrTween: transition_attrTween,\n style: transition_style,\n styleTween: transition_styleTween,\n text: transition_text,\n textTween: transition_textTween,\n remove: transition_remove,\n tween: transition_tween,\n delay: transition_delay,\n duration: transition_duration,\n ease: transition_ease,\n easeVarying: transition_easeVarying,\n end: transition_end,\n [Symbol.iterator]: selection_prototype[Symbol.iterator]\n};\n", "export function cubicIn(t) {\n return t * t * t;\n}\n\nexport function cubicOut(t) {\n return --t * t * t + 1;\n}\n\nexport function cubicInOut(t) {\n return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;\n}\n", "export {\n linear as easeLinear\n} from \"./linear.js\";\n\nexport {\n quadInOut as easeQuad,\n quadIn as easeQuadIn,\n quadOut as easeQuadOut,\n quadInOut as easeQuadInOut\n} from \"./quad.js\";\n\nexport {\n cubicInOut as easeCubic,\n cubicIn as easeCubicIn,\n cubicOut as easeCubicOut,\n cubicInOut as easeCubicInOut\n} from \"./cubic.js\";\n\nexport {\n polyInOut as easePoly,\n polyIn as easePolyIn,\n polyOut as easePolyOut,\n polyInOut as easePolyInOut\n} from \"./poly.js\";\n\nexport {\n sinInOut as easeSin,\n sinIn as easeSinIn,\n sinOut as easeSinOut,\n sinInOut as easeSinInOut\n} from \"./sin.js\";\n\nexport {\n expInOut as easeExp,\n expIn as easeExpIn,\n expOut as easeExpOut,\n expInOut as easeExpInOut\n} from \"./exp.js\";\n\nexport {\n circleInOut as easeCircle,\n circleIn as easeCircleIn,\n circleOut as easeCircleOut,\n circleInOut as easeCircleInOut\n} from \"./circle.js\";\n\nexport {\n bounceOut as easeBounce,\n bounceIn as easeBounceIn,\n bounceOut as easeBounceOut,\n bounceInOut as easeBounceInOut\n} from \"./bounce.js\";\n\nexport {\n backInOut as easeBack,\n backIn as easeBackIn,\n backOut as easeBackOut,\n backInOut as easeBackInOut\n} from \"./back.js\";\n\nexport {\n elasticOut as easeElastic,\n elasticIn as easeElasticIn,\n elasticOut as easeElasticOut,\n elasticInOut as easeElasticInOut\n} from \"./elastic.js\";\n", "import {Transition, newId} from \"../transition/index.js\";\nimport schedule from \"../transition/schedule.js\";\nimport {easeCubicInOut} from \"d3-ease\";\nimport {now} from \"d3-timer\";\n\nvar defaultTiming = {\n time: null, // Set on use.\n delay: 0,\n duration: 250,\n ease: easeCubicInOut\n};\n\nfunction inherit(node, id) {\n var timing;\n while (!(timing = node.__transition) || !(timing = timing[id])) {\n if (!(node = node.parentNode)) {\n throw new Error(`transition ${id} not found`);\n }\n }\n return timing;\n}\n\nexport default function(name) {\n var id,\n timing;\n\n if (name instanceof Transition) {\n id = name._id, name = name._name;\n } else {\n id = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + \"\";\n }\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n schedule(node, name, id, i, group, timing || inherit(node, id));\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id);\n}\n", "import {selection} from \"d3-selection\";\nimport selection_interrupt from \"./interrupt.js\";\nimport selection_transition from \"./transition.js\";\n\nselection.prototype.interrupt = selection_interrupt;\nselection.prototype.transition = selection_transition;\n", "import \"./selection/index.js\";\nexport {default as transition} from \"./transition/index.js\";\nexport {default as active} from \"./active.js\";\nexport {default as interrupt} from \"./interrupt.js\";\n", "export default x => () => x;\n", "export default function BrushEvent(type, {\n sourceEvent,\n target,\n selection,\n mode,\n dispatch\n}) {\n Object.defineProperties(this, {\n type: {value: type, enumerable: true, configurable: true},\n sourceEvent: {value: sourceEvent, enumerable: true, configurable: true},\n target: {value: target, enumerable: true, configurable: true},\n selection: {value: selection, enumerable: true, configurable: true},\n mode: {value: mode, enumerable: true, configurable: true},\n _: {value: dispatch}\n });\n}\n", "export function nopropagation(event) {\n event.stopImmediatePropagation();\n}\n\nexport default function(event) {\n event.preventDefault();\n event.stopImmediatePropagation();\n}\n", "import {dispatch} from \"d3-dispatch\";\nimport {dragDisable, dragEnable} from \"d3-drag\";\nimport {interpolate} from \"d3-interpolate\";\nimport {pointer, select} from \"d3-selection\";\nimport {interrupt} from \"d3-transition\";\nimport constant from \"./constant.js\";\nimport BrushEvent from \"./event.js\";\nimport noevent, {nopropagation} from \"./noevent.js\";\n\nvar MODE_DRAG = {name: \"drag\"},\n MODE_SPACE = {name: \"space\"},\n MODE_HANDLE = {name: \"handle\"},\n MODE_CENTER = {name: \"center\"};\n\nconst {abs, max, min} = Math;\n\nfunction number1(e) {\n return [+e[0], +e[1]];\n}\n\nfunction number2(e) {\n return [number1(e[0]), number1(e[1])];\n}\n\nvar X = {\n name: \"x\",\n handles: [\"w\", \"e\"].map(type),\n input: function(x, e) { return x == null ? null : [[+x[0], e[0][1]], [+x[1], e[1][1]]]; },\n output: function(xy) { return xy && [xy[0][0], xy[1][0]]; }\n};\n\nvar Y = {\n name: \"y\",\n handles: [\"n\", \"s\"].map(type),\n input: function(y, e) { return y == null ? null : [[e[0][0], +y[0]], [e[1][0], +y[1]]]; },\n output: function(xy) { return xy && [xy[0][1], xy[1][1]]; }\n};\n\nvar XY = {\n name: \"xy\",\n handles: [\"n\", \"w\", \"e\", \"s\", \"nw\", \"ne\", \"sw\", \"se\"].map(type),\n input: function(xy) { return xy == null ? null : number2(xy); },\n output: function(xy) { return xy; }\n};\n\nvar cursors = {\n overlay: \"crosshair\",\n selection: \"move\",\n n: \"ns-resize\",\n e: \"ew-resize\",\n s: \"ns-resize\",\n w: \"ew-resize\",\n nw: \"nwse-resize\",\n ne: \"nesw-resize\",\n se: \"nwse-resize\",\n sw: \"nesw-resize\"\n};\n\nvar flipX = {\n e: \"w\",\n w: \"e\",\n nw: \"ne\",\n ne: \"nw\",\n se: \"sw\",\n sw: \"se\"\n};\n\nvar flipY = {\n n: \"s\",\n s: \"n\",\n nw: \"sw\",\n ne: \"se\",\n se: \"ne\",\n sw: \"nw\"\n};\n\nvar signsX = {\n overlay: +1,\n selection: +1,\n n: null,\n e: +1,\n s: null,\n w: -1,\n nw: -1,\n ne: +1,\n se: +1,\n sw: -1\n};\n\nvar signsY = {\n overlay: +1,\n selection: +1,\n n: -1,\n e: null,\n s: +1,\n w: null,\n nw: -1,\n ne: -1,\n se: +1,\n sw: +1\n};\n\nfunction type(t) {\n return {type: t};\n}\n\n// Ignore right-click, since that should open the context menu.\nfunction defaultFilter(event) {\n return !event.ctrlKey && !event.button;\n}\n\nfunction defaultExtent() {\n var svg = this.ownerSVGElement || this;\n if (svg.hasAttribute(\"viewBox\")) {\n svg = svg.viewBox.baseVal;\n return [[svg.x, svg.y], [svg.x + svg.width, svg.y + svg.height]];\n }\n return [[0, 0], [svg.width.baseVal.value, svg.height.baseVal.value]];\n}\n\nfunction defaultTouchable() {\n return navigator.maxTouchPoints || (\"ontouchstart\" in this);\n}\n\n// Like d3.local, but with the name \u201C__brush\u201D rather than auto-generated.\nfunction local(node) {\n while (!node.__brush) if (!(node = node.parentNode)) return;\n return node.__brush;\n}\n\nfunction empty(extent) {\n return extent[0][0] === extent[1][0]\n || extent[0][1] === extent[1][1];\n}\n\nexport function brushSelection(node) {\n var state = node.__brush;\n return state ? state.dim.output(state.selection) : null;\n}\n\nexport function brushX() {\n return brush(X);\n}\n\nexport function brushY() {\n return brush(Y);\n}\n\nexport default function() {\n return brush(XY);\n}\n\nfunction brush(dim) {\n var extent = defaultExtent,\n filter = defaultFilter,\n touchable = defaultTouchable,\n keys = true,\n listeners = dispatch(\"start\", \"brush\", \"end\"),\n handleSize = 6,\n touchending;\n\n function brush(group) {\n var overlay = group\n .property(\"__brush\", initialize)\n .selectAll(\".overlay\")\n .data([type(\"overlay\")]);\n\n overlay.enter().append(\"rect\")\n .attr(\"class\", \"overlay\")\n .attr(\"pointer-events\", \"all\")\n .attr(\"cursor\", cursors.overlay)\n .merge(overlay)\n .each(function() {\n var extent = local(this).extent;\n select(this)\n .attr(\"x\", extent[0][0])\n .attr(\"y\", extent[0][1])\n .attr(\"width\", extent[1][0] - extent[0][0])\n .attr(\"height\", extent[1][1] - extent[0][1]);\n });\n\n group.selectAll(\".selection\")\n .data([type(\"selection\")])\n .enter().append(\"rect\")\n .attr(\"class\", \"selection\")\n .attr(\"cursor\", cursors.selection)\n .attr(\"fill\", \"#777\")\n .attr(\"fill-opacity\", 0.3)\n .attr(\"stroke\", \"#fff\")\n .attr(\"shape-rendering\", \"crispEdges\");\n\n var handle = group.selectAll(\".handle\")\n .data(dim.handles, function(d) { return d.type; });\n\n handle.exit().remove();\n\n handle.enter().append(\"rect\")\n .attr(\"class\", function(d) { return \"handle handle--\" + d.type; })\n .attr(\"cursor\", function(d) { return cursors[d.type]; });\n\n group\n .each(redraw)\n .attr(\"fill\", \"none\")\n .attr(\"pointer-events\", \"all\")\n .on(\"mousedown.brush\", started)\n .filter(touchable)\n .on(\"touchstart.brush\", started)\n .on(\"touchmove.brush\", touchmoved)\n .on(\"touchend.brush touchcancel.brush\", touchended)\n .style(\"touch-action\", \"none\")\n .style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\");\n }\n\n brush.move = function(group, selection, event) {\n if (group.tween) {\n group\n .on(\"start.brush\", function(event) { emitter(this, arguments).beforestart().start(event); })\n .on(\"interrupt.brush end.brush\", function(event) { emitter(this, arguments).end(event); })\n .tween(\"brush\", function() {\n var that = this,\n state = that.__brush,\n emit = emitter(that, arguments),\n selection0 = state.selection,\n selection1 = dim.input(typeof selection === \"function\" ? selection.apply(this, arguments) : selection, state.extent),\n i = interpolate(selection0, selection1);\n\n function tween(t) {\n state.selection = t === 1 && selection1 === null ? null : i(t);\n redraw.call(that);\n emit.brush();\n }\n\n return selection0 !== null && selection1 !== null ? tween : tween(1);\n });\n } else {\n group\n .each(function() {\n var that = this,\n args = arguments,\n state = that.__brush,\n selection1 = dim.input(typeof selection === \"function\" ? selection.apply(that, args) : selection, state.extent),\n emit = emitter(that, args).beforestart();\n\n interrupt(that);\n state.selection = selection1 === null ? null : selection1;\n redraw.call(that);\n emit.start(event).brush(event).end(event);\n });\n }\n };\n\n brush.clear = function(group, event) {\n brush.move(group, null, event);\n };\n\n function redraw() {\n var group = select(this),\n selection = local(this).selection;\n\n if (selection) {\n group.selectAll(\".selection\")\n .style(\"display\", null)\n .attr(\"x\", selection[0][0])\n .attr(\"y\", selection[0][1])\n .attr(\"width\", selection[1][0] - selection[0][0])\n .attr(\"height\", selection[1][1] - selection[0][1]);\n\n group.selectAll(\".handle\")\n .style(\"display\", null)\n .attr(\"x\", function(d) { return d.type[d.type.length - 1] === \"e\" ? selection[1][0] - handleSize / 2 : selection[0][0] - handleSize / 2; })\n .attr(\"y\", function(d) { return d.type[0] === \"s\" ? selection[1][1] - handleSize / 2 : selection[0][1] - handleSize / 2; })\n .attr(\"width\", function(d) { return d.type === \"n\" || d.type === \"s\" ? selection[1][0] - selection[0][0] + handleSize : handleSize; })\n .attr(\"height\", function(d) { return d.type === \"e\" || d.type === \"w\" ? selection[1][1] - selection[0][1] + handleSize : handleSize; });\n }\n\n else {\n group.selectAll(\".selection,.handle\")\n .style(\"display\", \"none\")\n .attr(\"x\", null)\n .attr(\"y\", null)\n .attr(\"width\", null)\n .attr(\"height\", null);\n }\n }\n\n function emitter(that, args, clean) {\n var emit = that.__brush.emitter;\n return emit && (!clean || !emit.clean) ? emit : new Emitter(that, args, clean);\n }\n\n function Emitter(that, args, clean) {\n this.that = that;\n this.args = args;\n this.state = that.__brush;\n this.active = 0;\n this.clean = clean;\n }\n\n Emitter.prototype = {\n beforestart: function() {\n if (++this.active === 1) this.state.emitter = this, this.starting = true;\n return this;\n },\n start: function(event, mode) {\n if (this.starting) this.starting = false, this.emit(\"start\", event, mode);\n else this.emit(\"brush\", event);\n return this;\n },\n brush: function(event, mode) {\n this.emit(\"brush\", event, mode);\n return this;\n },\n end: function(event, mode) {\n if (--this.active === 0) delete this.state.emitter, this.emit(\"end\", event, mode);\n return this;\n },\n emit: function(type, event, mode) {\n var d = select(this.that).datum();\n listeners.call(\n type,\n this.that,\n new BrushEvent(type, {\n sourceEvent: event,\n target: brush,\n selection: dim.output(this.state.selection),\n mode,\n dispatch: listeners\n }),\n d\n );\n }\n };\n\n function started(event) {\n if (touchending && !event.touches) return;\n if (!filter.apply(this, arguments)) return;\n\n var that = this,\n type = event.target.__data__.type,\n mode = (keys && event.metaKey ? type = \"overlay\" : type) === \"selection\" ? MODE_DRAG : (keys && event.altKey ? MODE_CENTER : MODE_HANDLE),\n signX = dim === Y ? null : signsX[type],\n signY = dim === X ? null : signsY[type],\n state = local(that),\n extent = state.extent,\n selection = state.selection,\n W = extent[0][0], w0, w1,\n N = extent[0][1], n0, n1,\n E = extent[1][0], e0, e1,\n S = extent[1][1], s0, s1,\n dx = 0,\n dy = 0,\n moving,\n shifting = signX && signY && keys && event.shiftKey,\n lockX,\n lockY,\n points = Array.from(event.touches || [event], t => {\n const i = t.identifier;\n t = pointer(t, that);\n t.point0 = t.slice();\n t.identifier = i;\n return t;\n });\n\n interrupt(that);\n var emit = emitter(that, arguments, true).beforestart();\n\n if (type === \"overlay\") {\n if (selection) moving = true;\n const pts = [points[0], points[1] || points[0]];\n state.selection = selection = [[\n w0 = dim === Y ? W : min(pts[0][0], pts[1][0]),\n n0 = dim === X ? N : min(pts[0][1], pts[1][1])\n ], [\n e0 = dim === Y ? E : max(pts[0][0], pts[1][0]),\n s0 = dim === X ? S : max(pts[0][1], pts[1][1])\n ]];\n if (points.length > 1) move(event);\n } else {\n w0 = selection[0][0];\n n0 = selection[0][1];\n e0 = selection[1][0];\n s0 = selection[1][1];\n }\n\n w1 = w0;\n n1 = n0;\n e1 = e0;\n s1 = s0;\n\n var group = select(that)\n .attr(\"pointer-events\", \"none\");\n\n var overlay = group.selectAll(\".overlay\")\n .attr(\"cursor\", cursors[type]);\n\n if (event.touches) {\n emit.moved = moved;\n emit.ended = ended;\n } else {\n var view = select(event.view)\n .on(\"mousemove.brush\", moved, true)\n .on(\"mouseup.brush\", ended, true);\n if (keys) view\n .on(\"keydown.brush\", keydowned, true)\n .on(\"keyup.brush\", keyupped, true)\n\n dragDisable(event.view);\n }\n\n redraw.call(that);\n emit.start(event, mode.name);\n\n function moved(event) {\n for (const p of event.changedTouches || [event]) {\n for (const d of points)\n if (d.identifier === p.identifier) d.cur = pointer(p, that);\n }\n if (shifting && !lockX && !lockY && points.length === 1) {\n const point = points[0];\n if (abs(point.cur[0] - point[0]) > abs(point.cur[1] - point[1]))\n lockY = true;\n else\n lockX = true;\n }\n for (const point of points)\n if (point.cur) point[0] = point.cur[0], point[1] = point.cur[1];\n moving = true;\n noevent(event);\n move(event);\n }\n\n function move(event) {\n const point = points[0], point0 = point.point0;\n var t;\n\n dx = point[0] - point0[0];\n dy = point[1] - point0[1];\n\n switch (mode) {\n case MODE_SPACE:\n case MODE_DRAG: {\n if (signX) dx = max(W - w0, min(E - e0, dx)), w1 = w0 + dx, e1 = e0 + dx;\n if (signY) dy = max(N - n0, min(S - s0, dy)), n1 = n0 + dy, s1 = s0 + dy;\n break;\n }\n case MODE_HANDLE: {\n if (points[1]) {\n if (signX) w1 = max(W, min(E, points[0][0])), e1 = max(W, min(E, points[1][0])), signX = 1;\n if (signY) n1 = max(N, min(S, points[0][1])), s1 = max(N, min(S, points[1][1])), signY = 1;\n } else {\n if (signX < 0) dx = max(W - w0, min(E - w0, dx)), w1 = w0 + dx, e1 = e0;\n else if (signX > 0) dx = max(W - e0, min(E - e0, dx)), w1 = w0, e1 = e0 + dx;\n if (signY < 0) dy = max(N - n0, min(S - n0, dy)), n1 = n0 + dy, s1 = s0;\n else if (signY > 0) dy = max(N - s0, min(S - s0, dy)), n1 = n0, s1 = s0 + dy;\n }\n break;\n }\n case MODE_CENTER: {\n if (signX) w1 = max(W, min(E, w0 - dx * signX)), e1 = max(W, min(E, e0 + dx * signX));\n if (signY) n1 = max(N, min(S, n0 - dy * signY)), s1 = max(N, min(S, s0 + dy * signY));\n break;\n }\n }\n\n if (e1 < w1) {\n signX *= -1;\n t = w0, w0 = e0, e0 = t;\n t = w1, w1 = e1, e1 = t;\n if (type in flipX) overlay.attr(\"cursor\", cursors[type = flipX[type]]);\n }\n\n if (s1 < n1) {\n signY *= -1;\n t = n0, n0 = s0, s0 = t;\n t = n1, n1 = s1, s1 = t;\n if (type in flipY) overlay.attr(\"cursor\", cursors[type = flipY[type]]);\n }\n\n if (state.selection) selection = state.selection; // May be set by brush.move!\n if (lockX) w1 = selection[0][0], e1 = selection[1][0];\n if (lockY) n1 = selection[0][1], s1 = selection[1][1];\n\n if (selection[0][0] !== w1\n || selection[0][1] !== n1\n || selection[1][0] !== e1\n || selection[1][1] !== s1) {\n state.selection = [[w1, n1], [e1, s1]];\n redraw.call(that);\n emit.brush(event, mode.name);\n }\n }\n\n function ended(event) {\n nopropagation(event);\n if (event.touches) {\n if (event.touches.length) return;\n if (touchending) clearTimeout(touchending);\n touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!\n } else {\n dragEnable(event.view, moving);\n view.on(\"keydown.brush keyup.brush mousemove.brush mouseup.brush\", null);\n }\n group.attr(\"pointer-events\", \"all\");\n overlay.attr(\"cursor\", cursors.overlay);\n if (state.selection) selection = state.selection; // May be set by brush.move (on start)!\n if (empty(selection)) state.selection = null, redraw.call(that);\n emit.end(event, mode.name);\n }\n\n function keydowned(event) {\n switch (event.keyCode) {\n case 16: { // SHIFT\n shifting = signX && signY;\n break;\n }\n case 18: { // ALT\n if (mode === MODE_HANDLE) {\n if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;\n if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;\n mode = MODE_CENTER;\n move(event);\n }\n break;\n }\n case 32: { // SPACE; takes priority over ALT\n if (mode === MODE_HANDLE || mode === MODE_CENTER) {\n if (signX < 0) e0 = e1 - dx; else if (signX > 0) w0 = w1 - dx;\n if (signY < 0) s0 = s1 - dy; else if (signY > 0) n0 = n1 - dy;\n mode = MODE_SPACE;\n overlay.attr(\"cursor\", cursors.selection);\n move(event);\n }\n break;\n }\n default: return;\n }\n noevent(event);\n }\n\n function keyupped(event) {\n switch (event.keyCode) {\n case 16: { // SHIFT\n if (shifting) {\n lockX = lockY = shifting = false;\n move(event);\n }\n break;\n }\n case 18: { // ALT\n if (mode === MODE_CENTER) {\n if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;\n if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;\n mode = MODE_HANDLE;\n move(event);\n }\n break;\n }\n case 32: { // SPACE\n if (mode === MODE_SPACE) {\n if (event.altKey) {\n if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;\n if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;\n mode = MODE_CENTER;\n } else {\n if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;\n if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;\n mode = MODE_HANDLE;\n }\n overlay.attr(\"cursor\", cursors[type]);\n move(event);\n }\n break;\n }\n default: return;\n }\n noevent(event);\n }\n }\n\n function touchmoved(event) {\n emitter(this, arguments).moved(event);\n }\n\n function touchended(event) {\n emitter(this, arguments).ended(event);\n }\n\n function initialize() {\n var state = this.__brush || {selection: null};\n state.extent = number2(extent.apply(this, arguments));\n state.dim = dim;\n return state;\n }\n\n brush.extent = function(_) {\n return arguments.length ? (extent = typeof _ === \"function\" ? _ : constant(number2(_)), brush) : extent;\n };\n\n brush.filter = function(_) {\n return arguments.length ? (filter = typeof _ === \"function\" ? _ : constant(!!_), brush) : filter;\n };\n\n brush.touchable = function(_) {\n return arguments.length ? (touchable = typeof _ === \"function\" ? _ : constant(!!_), brush) : touchable;\n };\n\n brush.handleSize = function(_) {\n return arguments.length ? (handleSize = +_, brush) : handleSize;\n };\n\n brush.keyModifiers = function(_) {\n return arguments.length ? (keys = !!_, brush) : keys;\n };\n\n brush.on = function() {\n var value = listeners.on.apply(listeners, arguments);\n return value === listeners ? brush : value;\n };\n\n return brush;\n}\n", "export {\n default as brush,\n brushX,\n brushY,\n brushSelection\n} from \"./brush.js\";\n", "const pi = Math.PI,\n tau = 2 * pi,\n epsilon = 1e-6,\n tauEpsilon = tau - epsilon;\n\nfunction append(strings) {\n this._ += strings[0];\n for (let i = 1, n = strings.length; i < n; ++i) {\n this._ += arguments[i] + strings[i];\n }\n}\n\nfunction appendRound(digits) {\n let d = Math.floor(digits);\n if (!(d >= 0)) throw new Error(`invalid digits: ${digits}`);\n if (d > 15) return append;\n const k = 10 ** d;\n return function(strings) {\n this._ += strings[0];\n for (let i = 1, n = strings.length; i < n; ++i) {\n this._ += Math.round(arguments[i] * k) / k + strings[i];\n }\n };\n}\n\nexport class Path {\n constructor(digits) {\n this._x0 = this._y0 = // start of current subpath\n this._x1 = this._y1 = null; // end of current subpath\n this._ = \"\";\n this._append = digits == null ? append : appendRound(digits);\n }\n moveTo(x, y) {\n this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`;\n }\n closePath() {\n if (this._x1 !== null) {\n this._x1 = this._x0, this._y1 = this._y0;\n this._append`Z`;\n }\n }\n lineTo(x, y) {\n this._append`L${this._x1 = +x},${this._y1 = +y}`;\n }\n quadraticCurveTo(x1, y1, x, y) {\n this._append`Q${+x1},${+y1},${this._x1 = +x},${this._y1 = +y}`;\n }\n bezierCurveTo(x1, y1, x2, y2, x, y) {\n this._append`C${+x1},${+y1},${+x2},${+y2},${this._x1 = +x},${this._y1 = +y}`;\n }\n arcTo(x1, y1, x2, y2, r) {\n x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(`negative radius: ${r}`);\n\n let x0 = this._x1,\n y0 = this._y1,\n x21 = x2 - x1,\n y21 = y2 - y1,\n x01 = x0 - x1,\n y01 = y0 - y1,\n l01_2 = x01 * x01 + y01 * y01;\n\n // Is this path empty? Move to (x1,y1).\n if (this._x1 === null) {\n this._append`M${this._x1 = x1},${this._y1 = y1}`;\n }\n\n // Or, is (x1,y1) coincident with (x0,y0)? Do nothing.\n else if (!(l01_2 > epsilon));\n\n // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?\n // Equivalently, is (x1,y1) coincident with (x2,y2)?\n // Or, is the radius zero? Line to (x1,y1).\n else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {\n this._append`L${this._x1 = x1},${this._y1 = y1}`;\n }\n\n // Otherwise, draw an arc!\n else {\n let x20 = x2 - x0,\n y20 = y2 - y0,\n l21_2 = x21 * x21 + y21 * y21,\n l20_2 = x20 * x20 + y20 * y20,\n l21 = Math.sqrt(l21_2),\n l01 = Math.sqrt(l01_2),\n l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),\n t01 = l / l01,\n t21 = l / l21;\n\n // If the start tangent is not coincident with (x0,y0), line to.\n if (Math.abs(t01 - 1) > epsilon) {\n this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`;\n }\n\n this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`;\n }\n }\n arc(x, y, r, a0, a1, ccw) {\n x = +x, y = +y, r = +r, ccw = !!ccw;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(`negative radius: ${r}`);\n\n let dx = r * Math.cos(a0),\n dy = r * Math.sin(a0),\n x0 = x + dx,\n y0 = y + dy,\n cw = 1 ^ ccw,\n da = ccw ? a0 - a1 : a1 - a0;\n\n // Is this path empty? Move to (x0,y0).\n if (this._x1 === null) {\n this._append`M${x0},${y0}`;\n }\n\n // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).\n else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {\n this._append`L${x0},${y0}`;\n }\n\n // Is this arc empty? We\u2019re done.\n if (!r) return;\n\n // Does the angle go the wrong way? Flip the direction.\n if (da < 0) da = da % tau + tau;\n\n // Is this a complete circle? Draw two arcs to complete the circle.\n if (da > tauEpsilon) {\n this._append`A${r},${r},0,1,${cw},${x - dx},${y - dy}A${r},${r},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`;\n }\n\n // Is this arc non-empty? Draw an arc!\n else if (da > epsilon) {\n this._append`A${r},${r},0,${+(da >= pi)},${cw},${this._x1 = x + r * Math.cos(a1)},${this._y1 = y + r * Math.sin(a1)}`;\n }\n }\n rect(x, y, w, h) {\n this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${w = +w}v${+h}h${-w}Z`;\n }\n toString() {\n return this._;\n }\n}\n\nexport function path() {\n return new Path;\n}\n\n// Allow instanceof d3.path\npath.prototype = Path.prototype;\n\nexport function pathRound(digits = 3) {\n return new Path(+digits);\n}\n", "export {Path, path, pathRound} from \"./path.js\";\n", "export {default as chord, chordTranspose, chordDirected} from \"./chord.js\";\nexport {default as ribbon, ribbonArrow} from \"./ribbon.js\";\n", "export {default as contours} from \"./contours.js\";\nexport {default as contourDensity} from \"./density.js\";\n", "export {default as Delaunay} from \"./delaunay.js\";\nexport {default as Voronoi} from \"./voronoi.js\";\n", "export {default as dsvFormat} from \"./dsv.js\";\nexport {csvParse, csvParseRows, csvFormat, csvFormatBody, csvFormatRows, csvFormatRow, csvFormatValue} from \"./csv.js\";\nexport {tsvParse, tsvParseRows, tsvFormat, tsvFormatBody, tsvFormatRows, tsvFormatRow, tsvFormatValue} from \"./tsv.js\";\nexport {default as autoType} from \"./autoType.js\";\n", "export {default as blob} from \"./blob.js\";\nexport {default as buffer} from \"./buffer.js\";\nexport {default as dsv, csv, tsv} from \"./dsv.js\";\nexport {default as image} from \"./image.js\";\nexport {default as json} from \"./json.js\";\nexport {default as text} from \"./text.js\";\nexport {default as xml, html, svg} from \"./xml.js\";\n", "export {default as quadtree} from \"./quadtree.js\";\n", "export {default as forceCenter} from \"./center.js\";\nexport {default as forceCollide} from \"./collide.js\";\nexport {default as forceLink} from \"./link.js\";\nexport {default as forceManyBody} from \"./manyBody.js\";\nexport {default as forceRadial} from \"./radial.js\";\nexport {default as forceSimulation} from \"./simulation.js\";\nexport {default as forceX} from \"./x.js\";\nexport {default as forceY} from \"./y.js\";\n", "export default function(x) {\n return Math.abs(x = Math.round(x)) >= 1e21\n ? x.toLocaleString(\"en\").replace(/,/g, \"\")\n : x.toString(10);\n}\n\n// Computes the decimal coefficient and exponent of the specified number x with\n// significant digits p, where x is positive and p is in [1, 21] or undefined.\n// For example, formatDecimalParts(1.23) returns [\"123\", 0].\nexport function formatDecimalParts(x, p) {\n if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf(\"e\")) < 0) return null; // NaN, \u00B1Infinity\n var i, coefficient = x.slice(0, i);\n\n // The string returned by toExponential either has the form \\d\\.\\d+e[-+]\\d+\n // (e.g., 1.2e+3) or the form \\de[-+]\\d+ (e.g., 1e+3).\n return [\n coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,\n +x.slice(i + 1)\n ];\n}\n", "import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport default function(x) {\n return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;\n}\n", "export default function(grouping, thousands) {\n return function(value, width) {\n var i = value.length,\n t = [],\n j = 0,\n g = grouping[0],\n length = 0;\n\n while (i > 0 && g > 0) {\n if (length + g + 1 > width) g = Math.max(1, width - length);\n t.push(value.substring(i -= g, i + g));\n if ((length += g + 1) > width) break;\n g = grouping[j = (j + 1) % grouping.length];\n }\n\n return t.reverse().join(thousands);\n };\n}\n", "export default function(numerals) {\n return function(value) {\n return value.replace(/[0-9]/g, function(i) {\n return numerals[+i];\n });\n };\n}\n", "// [[fill]align][sign][symbol][0][width][,][.precision][~][type]\nvar re = /^(?:(.)?([<>=^]))?([+\\-( ])?([$#])?(0)?(\\d+)?(,)?(\\.\\d+)?(~)?([a-z%])?$/i;\n\nexport default function formatSpecifier(specifier) {\n if (!(match = re.exec(specifier))) throw new Error(\"invalid format: \" + specifier);\n var match;\n return new FormatSpecifier({\n fill: match[1],\n align: match[2],\n sign: match[3],\n symbol: match[4],\n zero: match[5],\n width: match[6],\n comma: match[7],\n precision: match[8] && match[8].slice(1),\n trim: match[9],\n type: match[10]\n });\n}\n\nformatSpecifier.prototype = FormatSpecifier.prototype; // instanceof\n\nexport function FormatSpecifier(specifier) {\n this.fill = specifier.fill === undefined ? \" \" : specifier.fill + \"\";\n this.align = specifier.align === undefined ? \">\" : specifier.align + \"\";\n this.sign = specifier.sign === undefined ? \"-\" : specifier.sign + \"\";\n this.symbol = specifier.symbol === undefined ? \"\" : specifier.symbol + \"\";\n this.zero = !!specifier.zero;\n this.width = specifier.width === undefined ? undefined : +specifier.width;\n this.comma = !!specifier.comma;\n this.precision = specifier.precision === undefined ? undefined : +specifier.precision;\n this.trim = !!specifier.trim;\n this.type = specifier.type === undefined ? \"\" : specifier.type + \"\";\n}\n\nFormatSpecifier.prototype.toString = function() {\n return this.fill\n + this.align\n + this.sign\n + this.symbol\n + (this.zero ? \"0\" : \"\")\n + (this.width === undefined ? \"\" : Math.max(1, this.width | 0))\n + (this.comma ? \",\" : \"\")\n + (this.precision === undefined ? \"\" : \".\" + Math.max(0, this.precision | 0))\n + (this.trim ? \"~\" : \"\")\n + this.type;\n};\n", "// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.\nexport default function(s) {\n out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {\n switch (s[i]) {\n case \".\": i0 = i1 = i; break;\n case \"0\": if (i0 === 0) i0 = i; i1 = i; break;\n default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break;\n }\n }\n return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;\n}\n", "import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport var prefixExponent;\n\nexport default function(x, p) {\n var d = formatDecimalParts(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1],\n i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,\n n = coefficient.length;\n return i === n ? coefficient\n : i > n ? coefficient + new Array(i - n + 1).join(\"0\")\n : i > 0 ? coefficient.slice(0, i) + \".\" + coefficient.slice(i)\n : \"0.\" + new Array(1 - i).join(\"0\") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y!\n}\n", "import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport default function(x, p) {\n var d = formatDecimalParts(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1];\n return exponent < 0 ? \"0.\" + new Array(-exponent).join(\"0\") + coefficient\n : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + \".\" + coefficient.slice(exponent + 1)\n : coefficient + new Array(exponent - coefficient.length + 2).join(\"0\");\n}\n", "import formatDecimal from \"./formatDecimal.js\";\nimport formatPrefixAuto from \"./formatPrefixAuto.js\";\nimport formatRounded from \"./formatRounded.js\";\n\nexport default {\n \"%\": (x, p) => (x * 100).toFixed(p),\n \"b\": (x) => Math.round(x).toString(2),\n \"c\": (x) => x + \"\",\n \"d\": formatDecimal,\n \"e\": (x, p) => x.toExponential(p),\n \"f\": (x, p) => x.toFixed(p),\n \"g\": (x, p) => x.toPrecision(p),\n \"o\": (x) => Math.round(x).toString(8),\n \"p\": (x, p) => formatRounded(x * 100, p),\n \"r\": formatRounded,\n \"s\": formatPrefixAuto,\n \"X\": (x) => Math.round(x).toString(16).toUpperCase(),\n \"x\": (x) => Math.round(x).toString(16)\n};\n", "export default function(x) {\n return x;\n}\n", "import exponent from \"./exponent.js\";\nimport formatGroup from \"./formatGroup.js\";\nimport formatNumerals from \"./formatNumerals.js\";\nimport formatSpecifier from \"./formatSpecifier.js\";\nimport formatTrim from \"./formatTrim.js\";\nimport formatTypes from \"./formatTypes.js\";\nimport {prefixExponent} from \"./formatPrefixAuto.js\";\nimport identity from \"./identity.js\";\n\nvar map = Array.prototype.map,\n prefixes = [\"y\",\"z\",\"a\",\"f\",\"p\",\"n\",\"\u00B5\",\"m\",\"\",\"k\",\"M\",\"G\",\"T\",\"P\",\"E\",\"Z\",\"Y\"];\n\nexport default function(locale) {\n var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + \"\"),\n currencyPrefix = locale.currency === undefined ? \"\" : locale.currency[0] + \"\",\n currencySuffix = locale.currency === undefined ? \"\" : locale.currency[1] + \"\",\n decimal = locale.decimal === undefined ? \".\" : locale.decimal + \"\",\n numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)),\n percent = locale.percent === undefined ? \"%\" : locale.percent + \"\",\n minus = locale.minus === undefined ? \"\u2212\" : locale.minus + \"\",\n nan = locale.nan === undefined ? \"NaN\" : locale.nan + \"\";\n\n function newFormat(specifier) {\n specifier = formatSpecifier(specifier);\n\n var fill = specifier.fill,\n align = specifier.align,\n sign = specifier.sign,\n symbol = specifier.symbol,\n zero = specifier.zero,\n width = specifier.width,\n comma = specifier.comma,\n precision = specifier.precision,\n trim = specifier.trim,\n type = specifier.type;\n\n // The \"n\" type is an alias for \",g\".\n if (type === \"n\") comma = true, type = \"g\";\n\n // The \"\" type, and any invalid type, is an alias for \".12~g\".\n else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = \"g\";\n\n // If zero fill is specified, padding goes after sign and before digits.\n if (zero || (fill === \"0\" && align === \"=\")) zero = true, fill = \"0\", align = \"=\";\n\n // Compute the prefix and suffix.\n // For SI-prefix, the suffix is lazily computed.\n var prefix = symbol === \"$\" ? currencyPrefix : symbol === \"#\" && /[boxX]/.test(type) ? \"0\" + type.toLowerCase() : \"\",\n suffix = symbol === \"$\" ? currencySuffix : /[%p]/.test(type) ? percent : \"\";\n\n // What format function should we use?\n // Is this an integer type?\n // Can this type generate exponential notation?\n var formatType = formatTypes[type],\n maybeSuffix = /[defgprs%]/.test(type);\n\n // Set the default precision if not specified,\n // or clamp the specified precision to the supported range.\n // For significant precision, it must be in [1, 21].\n // For fixed precision, it must be in [0, 20].\n precision = precision === undefined ? 6\n : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))\n : Math.max(0, Math.min(20, precision));\n\n function format(value) {\n var valuePrefix = prefix,\n valueSuffix = suffix,\n i, n, c;\n\n if (type === \"c\") {\n valueSuffix = formatType(value) + valueSuffix;\n value = \"\";\n } else {\n value = +value;\n\n // Determine the sign. -0 is not less than 0, but 1 / -0 is!\n var valueNegative = value < 0 || 1 / value < 0;\n\n // Perform the initial formatting.\n value = isNaN(value) ? nan : formatType(Math.abs(value), precision);\n\n // Trim insignificant zeros.\n if (trim) value = formatTrim(value);\n\n // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.\n if (valueNegative && +value === 0 && sign !== \"+\") valueNegative = false;\n\n // Compute the prefix and suffix.\n valuePrefix = (valueNegative ? (sign === \"(\" ? sign : minus) : sign === \"-\" || sign === \"(\" ? \"\" : sign) + valuePrefix;\n valueSuffix = (type === \"s\" ? prefixes[8 + prefixExponent / 3] : \"\") + valueSuffix + (valueNegative && sign === \"(\" ? \")\" : \"\");\n\n // Break the formatted value into the integer \u201Cvalue\u201D part that can be\n // grouped, and fractional or exponential \u201Csuffix\u201D part that is not.\n if (maybeSuffix) {\n i = -1, n = value.length;\n while (++i < n) {\n if (c = value.charCodeAt(i), 48 > c || c > 57) {\n valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;\n value = value.slice(0, i);\n break;\n }\n }\n }\n }\n\n // If the fill character is not \"0\", grouping is applied before padding.\n if (comma && !zero) value = group(value, Infinity);\n\n // Compute the padding.\n var length = valuePrefix.length + value.length + valueSuffix.length,\n padding = length < width ? new Array(width - length + 1).join(fill) : \"\";\n\n // If the fill character is \"0\", grouping is applied after padding.\n if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = \"\";\n\n // Reconstruct the final output based on the desired alignment.\n switch (align) {\n case \"<\": value = valuePrefix + value + valueSuffix + padding; break;\n case \"=\": value = valuePrefix + padding + value + valueSuffix; break;\n case \"^\": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;\n default: value = padding + valuePrefix + value + valueSuffix; break;\n }\n\n return numerals(value);\n }\n\n format.toString = function() {\n return specifier + \"\";\n };\n\n return format;\n }\n\n function formatPrefix(specifier, value) {\n var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = \"f\", specifier)),\n e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,\n k = Math.pow(10, -e),\n prefix = prefixes[8 + e / 3];\n return function(value) {\n return f(k * value) + prefix;\n };\n }\n\n return {\n format: newFormat,\n formatPrefix: formatPrefix\n };\n}\n", "import formatLocale from \"./locale.js\";\n\nvar locale;\nexport var format;\nexport var formatPrefix;\n\ndefaultLocale({\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"]\n});\n\nexport default function defaultLocale(definition) {\n locale = formatLocale(definition);\n format = locale.format;\n formatPrefix = locale.formatPrefix;\n return locale;\n}\n", "import exponent from \"./exponent.js\";\n\nexport default function(step) {\n return Math.max(0, -exponent(Math.abs(step)));\n}\n", "import exponent from \"./exponent.js\";\n\nexport default function(step, value) {\n return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));\n}\n", "import exponent from \"./exponent.js\";\n\nexport default function(step, max) {\n step = Math.abs(step), max = Math.abs(max) - step;\n return Math.max(0, exponent(max) - exponent(step)) + 1;\n}\n", "export {default as formatDefaultLocale, format, formatPrefix} from \"./defaultLocale.js\";\nexport {default as formatLocale} from \"./locale.js\";\nexport {default as formatSpecifier, FormatSpecifier} from \"./formatSpecifier.js\";\nexport {default as precisionFixed} from \"./precisionFixed.js\";\nexport {default as precisionPrefix} from \"./precisionPrefix.js\";\nexport {default as precisionRound} from \"./precisionRound.js\";\n", "export {default as geoArea} from \"./area.js\";\nexport {default as geoBounds} from \"./bounds.js\";\nexport {default as geoCentroid} from \"./centroid.js\";\nexport {default as geoCircle} from \"./circle.js\";\nexport {default as geoClipAntimeridian} from \"./clip/antimeridian.js\";\nexport {default as geoClipCircle} from \"./clip/circle.js\";\nexport {default as geoClipExtent} from \"./clip/extent.js\"; // DEPRECATED! Use d3.geoIdentity().clipExtent(\u2026).\nexport {default as geoClipRectangle} from \"./clip/rectangle.js\";\nexport {default as geoContains} from \"./contains.js\";\nexport {default as geoDistance} from \"./distance.js\";\nexport {default as geoGraticule, graticule10 as geoGraticule10} from \"./graticule.js\";\nexport {default as geoInterpolate} from \"./interpolate.js\";\nexport {default as geoLength} from \"./length.js\";\nexport {default as geoPath} from \"./path/index.js\";\nexport {default as geoAlbers} from \"./projection/albers.js\";\nexport {default as geoAlbersUsa} from \"./projection/albersUsa.js\";\nexport {default as geoAzimuthalEqualArea, azimuthalEqualAreaRaw as geoAzimuthalEqualAreaRaw} from \"./projection/azimuthalEqualArea.js\";\nexport {default as geoAzimuthalEquidistant, azimuthalEquidistantRaw as geoAzimuthalEquidistantRaw} from \"./projection/azimuthalEquidistant.js\";\nexport {default as geoConicConformal, conicConformalRaw as geoConicConformalRaw} from \"./projection/conicConformal.js\";\nexport {default as geoConicEqualArea, conicEqualAreaRaw as geoConicEqualAreaRaw} from \"./projection/conicEqualArea.js\";\nexport {default as geoConicEquidistant, conicEquidistantRaw as geoConicEquidistantRaw} from \"./projection/conicEquidistant.js\";\nexport {default as geoEqualEarth, equalEarthRaw as geoEqualEarthRaw} from \"./projection/equalEarth.js\";\nexport {default as geoEquirectangular, equirectangularRaw as geoEquirectangularRaw} from \"./projection/equirectangular.js\";\nexport {default as geoGnomonic, gnomonicRaw as geoGnomonicRaw} from \"./projection/gnomonic.js\";\nexport {default as geoIdentity} from \"./projection/identity.js\";\nexport {default as geoProjection, projectionMutator as geoProjectionMutator} from \"./projection/index.js\";\nexport {default as geoMercator, mercatorRaw as geoMercatorRaw} from \"./projection/mercator.js\";\nexport {default as geoNaturalEarth1, naturalEarth1Raw as geoNaturalEarth1Raw} from \"./projection/naturalEarth1.js\";\nexport {default as geoOrthographic, orthographicRaw as geoOrthographicRaw} from \"./projection/orthographic.js\";\nexport {default as geoStereographic, stereographicRaw as geoStereographicRaw} from \"./projection/stereographic.js\";\nexport {default as geoTransverseMercator, transverseMercatorRaw as geoTransverseMercatorRaw} from \"./projection/transverseMercator.js\";\nexport {default as geoRotation} from \"./rotation.js\";\nexport {default as geoStream} from \"./stream.js\";\nexport {default as geoTransform} from \"./transform.js\";\n", "export {default as cluster} from \"./cluster.js\";\nexport {default as hierarchy, Node} from \"./hierarchy/index.js\";\nexport {default as pack} from \"./pack/index.js\";\nexport {default as packSiblings} from \"./pack/siblings.js\";\nexport {default as packEnclose} from \"./pack/enclose.js\";\nexport {default as partition} from \"./partition.js\";\nexport {default as stratify} from \"./stratify.js\";\nexport {default as tree} from \"./tree.js\";\nexport {default as treemap} from \"./treemap/index.js\";\nexport {default as treemapBinary} from \"./treemap/binary.js\";\nexport {default as treemapDice} from \"./treemap/dice.js\";\nexport {default as treemapSlice} from \"./treemap/slice.js\";\nexport {default as treemapSliceDice} from \"./treemap/sliceDice.js\";\nexport {default as treemapSquarify} from \"./treemap/squarify.js\";\nexport {default as treemapResquarify} from \"./treemap/resquarify.js\";\n", "export {default as polygonArea} from \"./area.js\";\nexport {default as polygonCentroid} from \"./centroid.js\";\nexport {default as polygonHull} from \"./hull.js\";\nexport {default as polygonContains} from \"./contains.js\";\nexport {default as polygonLength} from \"./length.js\";\n", "export {default as randomUniform} from \"./uniform.js\";\nexport {default as randomInt} from \"./int.js\";\nexport {default as randomNormal} from \"./normal.js\";\nexport {default as randomLogNormal} from \"./logNormal.js\";\nexport {default as randomBates} from \"./bates.js\";\nexport {default as randomIrwinHall} from \"./irwinHall.js\";\nexport {default as randomExponential} from \"./exponential.js\";\nexport {default as randomPareto} from \"./pareto.js\";\nexport {default as randomBernoulli} from \"./bernoulli.js\";\nexport {default as randomGeometric} from \"./geometric.js\";\nexport {default as randomBinomial} from \"./binomial.js\";\nexport {default as randomGamma} from \"./gamma.js\";\nexport {default as randomBeta} from \"./beta.js\";\nexport {default as randomWeibull} from \"./weibull.js\";\nexport {default as randomCauchy} from \"./cauchy.js\";\nexport {default as randomLogistic} from \"./logistic.js\";\nexport {default as randomPoisson} from \"./poisson.js\";\nexport {default as randomLcg} from \"./lcg.js\";\n", "export function initRange(domain, range) {\n switch (arguments.length) {\n case 0: break;\n case 1: this.range(domain); break;\n default: this.range(range).domain(domain); break;\n }\n return this;\n}\n\nexport function initInterpolator(domain, interpolator) {\n switch (arguments.length) {\n case 0: break;\n case 1: {\n if (typeof domain === \"function\") this.interpolator(domain);\n else this.range(domain);\n break;\n }\n default: {\n this.domain(domain);\n if (typeof interpolator === \"function\") this.interpolator(interpolator);\n else this.range(interpolator);\n break;\n }\n }\n return this;\n}\n", "import {InternMap} from \"d3-array\";\nimport {initRange} from \"./init.js\";\n\nexport const implicit = Symbol(\"implicit\");\n\nexport default function ordinal() {\n var index = new InternMap(),\n domain = [],\n range = [],\n unknown = implicit;\n\n function scale(d) {\n let i = index.get(d);\n if (i === undefined) {\n if (unknown !== implicit) return unknown;\n index.set(d, i = domain.push(d) - 1);\n }\n return range[i % range.length];\n }\n\n scale.domain = function(_) {\n if (!arguments.length) return domain.slice();\n domain = [], index = new InternMap();\n for (const value of _) {\n if (index.has(value)) continue;\n index.set(value, domain.push(value) - 1);\n }\n return scale;\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), scale) : range.slice();\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.copy = function() {\n return ordinal(domain, range).unknown(unknown);\n };\n\n initRange.apply(scale, arguments);\n\n return scale;\n}\n", "import {range as sequence} from \"d3-array\";\nimport {initRange} from \"./init.js\";\nimport ordinal from \"./ordinal.js\";\n\nexport default function band() {\n var scale = ordinal().unknown(undefined),\n domain = scale.domain,\n ordinalRange = scale.range,\n r0 = 0,\n r1 = 1,\n step,\n bandwidth,\n round = false,\n paddingInner = 0,\n paddingOuter = 0,\n align = 0.5;\n\n delete scale.unknown;\n\n function rescale() {\n var n = domain().length,\n reverse = r1 < r0,\n start = reverse ? r1 : r0,\n stop = reverse ? r0 : r1;\n step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2);\n if (round) step = Math.floor(step);\n start += (stop - start - step * (n - paddingInner)) * align;\n bandwidth = step * (1 - paddingInner);\n if (round) start = Math.round(start), bandwidth = Math.round(bandwidth);\n var values = sequence(n).map(function(i) { return start + step * i; });\n return ordinalRange(reverse ? values.reverse() : values);\n }\n\n scale.domain = function(_) {\n return arguments.length ? (domain(_), rescale()) : domain();\n };\n\n scale.range = function(_) {\n return arguments.length ? ([r0, r1] = _, r0 = +r0, r1 = +r1, rescale()) : [r0, r1];\n };\n\n scale.rangeRound = function(_) {\n return [r0, r1] = _, r0 = +r0, r1 = +r1, round = true, rescale();\n };\n\n scale.bandwidth = function() {\n return bandwidth;\n };\n\n scale.step = function() {\n return step;\n };\n\n scale.round = function(_) {\n return arguments.length ? (round = !!_, rescale()) : round;\n };\n\n scale.padding = function(_) {\n return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner;\n };\n\n scale.paddingInner = function(_) {\n return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner;\n };\n\n scale.paddingOuter = function(_) {\n return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter;\n };\n\n scale.align = function(_) {\n return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;\n };\n\n scale.copy = function() {\n return band(domain(), [r0, r1])\n .round(round)\n .paddingInner(paddingInner)\n .paddingOuter(paddingOuter)\n .align(align);\n };\n\n return initRange.apply(rescale(), arguments);\n}\n\nfunction pointish(scale) {\n var copy = scale.copy;\n\n scale.padding = scale.paddingOuter;\n delete scale.paddingInner;\n delete scale.paddingOuter;\n\n scale.copy = function() {\n return pointish(copy());\n };\n\n return scale;\n}\n\nexport function point() {\n return pointish(band.apply(null, arguments).paddingInner(1));\n}\n", "export default function constants(x) {\n return function() {\n return x;\n };\n}\n", "export default function number(x) {\n return +x;\n}\n", "import {bisect} from \"d3-array\";\nimport {interpolate as interpolateValue, interpolateNumber, interpolateRound} from \"d3-interpolate\";\nimport constant from \"./constant.js\";\nimport number from \"./number.js\";\n\nvar unit = [0, 1];\n\nexport function identity(x) {\n return x;\n}\n\nfunction normalize(a, b) {\n return (b -= (a = +a))\n ? function(x) { return (x - a) / b; }\n : constant(isNaN(b) ? NaN : 0.5);\n}\n\nfunction clamper(a, b) {\n var t;\n if (a > b) t = a, a = b, b = t;\n return function(x) { return Math.max(a, Math.min(b, x)); };\n}\n\n// normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].\n// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].\nfunction bimap(domain, range, interpolate) {\n var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];\n if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);\n else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);\n return function(x) { return r0(d0(x)); };\n}\n\nfunction polymap(domain, range, interpolate) {\n var j = Math.min(domain.length, range.length) - 1,\n d = new Array(j),\n r = new Array(j),\n i = -1;\n\n // Reverse descending domains.\n if (domain[j] < domain[0]) {\n domain = domain.slice().reverse();\n range = range.slice().reverse();\n }\n\n while (++i < j) {\n d[i] = normalize(domain[i], domain[i + 1]);\n r[i] = interpolate(range[i], range[i + 1]);\n }\n\n return function(x) {\n var i = bisect(domain, x, 1, j) - 1;\n return r[i](d[i](x));\n };\n}\n\nexport function copy(source, target) {\n return target\n .domain(source.domain())\n .range(source.range())\n .interpolate(source.interpolate())\n .clamp(source.clamp())\n .unknown(source.unknown());\n}\n\nexport function transformer() {\n var domain = unit,\n range = unit,\n interpolate = interpolateValue,\n transform,\n untransform,\n unknown,\n clamp = identity,\n piecewise,\n output,\n input;\n\n function rescale() {\n var n = Math.min(domain.length, range.length);\n if (clamp !== identity) clamp = clamper(domain[0], domain[n - 1]);\n piecewise = n > 2 ? polymap : bimap;\n output = input = null;\n return scale;\n }\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x)));\n }\n\n scale.invert = function(y) {\n return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y)));\n };\n\n scale.domain = function(_) {\n return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), rescale()) : range.slice();\n };\n\n scale.rangeRound = function(_) {\n return range = Array.from(_), interpolate = interpolateRound, rescale();\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = _ ? true : identity, rescale()) : clamp !== identity;\n };\n\n scale.interpolate = function(_) {\n return arguments.length ? (interpolate = _, rescale()) : interpolate;\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n return function(t, u) {\n transform = t, untransform = u;\n return rescale();\n };\n}\n\nexport default function continuous() {\n return transformer()(identity, identity);\n}\n", "import {tickStep} from \"d3-array\";\nimport {format, formatPrefix, formatSpecifier, precisionFixed, precisionPrefix, precisionRound} from \"d3-format\";\n\nexport default function tickFormat(start, stop, count, specifier) {\n var step = tickStep(start, stop, count),\n precision;\n specifier = formatSpecifier(specifier == null ? \",f\" : specifier);\n switch (specifier.type) {\n case \"s\": {\n var value = Math.max(Math.abs(start), Math.abs(stop));\n if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;\n return formatPrefix(specifier, value);\n }\n case \"\":\n case \"e\":\n case \"g\":\n case \"p\":\n case \"r\": {\n if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === \"e\");\n break;\n }\n case \"f\":\n case \"%\": {\n if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === \"%\") * 2;\n break;\n }\n }\n return format(specifier);\n}\n", "import {ticks, tickIncrement} from \"d3-array\";\nimport continuous, {copy} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\nimport tickFormat from \"./tickFormat.js\";\n\nexport function linearish(scale) {\n var domain = scale.domain;\n\n scale.ticks = function(count) {\n var d = domain();\n return ticks(d[0], d[d.length - 1], count == null ? 10 : count);\n };\n\n scale.tickFormat = function(count, specifier) {\n var d = domain();\n return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);\n };\n\n scale.nice = function(count) {\n if (count == null) count = 10;\n\n var d = domain();\n var i0 = 0;\n var i1 = d.length - 1;\n var start = d[i0];\n var stop = d[i1];\n var prestep;\n var step;\n var maxIter = 10;\n\n if (stop < start) {\n step = start, start = stop, stop = step;\n step = i0, i0 = i1, i1 = step;\n }\n \n while (maxIter-- > 0) {\n step = tickIncrement(start, stop, count);\n if (step === prestep) {\n d[i0] = start\n d[i1] = stop\n return domain(d);\n } else if (step > 0) {\n start = Math.floor(start / step) * step;\n stop = Math.ceil(stop / step) * step;\n } else if (step < 0) {\n start = Math.ceil(start * step) / step;\n stop = Math.floor(stop * step) / step;\n } else {\n break;\n }\n prestep = step;\n }\n\n return scale;\n };\n\n return scale;\n}\n\nexport default function linear() {\n var scale = continuous();\n\n scale.copy = function() {\n return copy(scale, linear());\n };\n\n initRange.apply(scale, arguments);\n\n return linearish(scale);\n}\n", "export default function nice(domain, interval) {\n domain = domain.slice();\n\n var i0 = 0,\n i1 = domain.length - 1,\n x0 = domain[i0],\n x1 = domain[i1],\n t;\n\n if (x1 < x0) {\n t = i0, i0 = i1, i1 = t;\n t = x0, x0 = x1, x1 = t;\n }\n\n domain[i0] = interval.floor(x0);\n domain[i1] = interval.ceil(x1);\n return domain;\n}\n", "const t0 = new Date, t1 = new Date;\n\nexport function timeInterval(floori, offseti, count, field) {\n\n function interval(date) {\n return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date;\n }\n\n interval.floor = (date) => {\n return floori(date = new Date(+date)), date;\n };\n\n interval.ceil = (date) => {\n return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;\n };\n\n interval.round = (date) => {\n const d0 = interval(date), d1 = interval.ceil(date);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.offset = (date, step) => {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = (start, stop, step) => {\n const range = [];\n start = interval.ceil(start);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n let previous;\n do range.push(previous = new Date(+start)), offseti(start, step), floori(start);\n while (previous < start && start < stop);\n return range;\n };\n\n interval.filter = (test) => {\n return timeInterval((date) => {\n if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);\n }, (date, step) => {\n if (date >= date) {\n if (step < 0) while (++step <= 0) {\n while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty\n } else while (--step >= 0) {\n while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty\n }\n }\n });\n };\n\n if (count) {\n interval.count = (start, end) => {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n interval.every = (step) => {\n step = Math.floor(step);\n return !isFinite(step) || !(step > 0) ? null\n : !(step > 1) ? interval\n : interval.filter(field\n ? (d) => field(d) % step === 0\n : (d) => interval.count(0, d) % step === 0);\n };\n }\n\n return interval;\n}\n", "import {timeInterval} from \"./interval.js\";\n\nexport const millisecond = timeInterval(() => {\n // noop\n}, (date, step) => {\n date.setTime(+date + step);\n}, (start, end) => {\n return end - start;\n});\n\n// An optimized implementation for this simple case.\nmillisecond.every = (k) => {\n k = Math.floor(k);\n if (!isFinite(k) || !(k > 0)) return null;\n if (!(k > 1)) return millisecond;\n return timeInterval((date) => {\n date.setTime(Math.floor(date / k) * k);\n }, (date, step) => {\n date.setTime(+date + step * k);\n }, (start, end) => {\n return (end - start) / k;\n });\n};\n\nexport const milliseconds = millisecond.range;\n", "import {timeInterval} from \"./interval.js\";\nimport {durationSecond} from \"./duration.js\";\n\nexport const second = timeInterval((date) => {\n date.setTime(date - date.getMilliseconds());\n}, (date, step) => {\n date.setTime(+date + step * durationSecond);\n}, (start, end) => {\n return (end - start) / durationSecond;\n}, (date) => {\n return date.getUTCSeconds();\n});\n\nexport const seconds = second.range;\n", "import {timeInterval} from \"./interval.js\";\nimport {durationMinute, durationSecond} from \"./duration.js\";\n\nexport const timeMinute = timeInterval((date) => {\n date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond);\n}, (date, step) => {\n date.setTime(+date + step * durationMinute);\n}, (start, end) => {\n return (end - start) / durationMinute;\n}, (date) => {\n return date.getMinutes();\n});\n\nexport const timeMinutes = timeMinute.range;\n\nexport const utcMinute = timeInterval((date) => {\n date.setUTCSeconds(0, 0);\n}, (date, step) => {\n date.setTime(+date + step * durationMinute);\n}, (start, end) => {\n return (end - start) / durationMinute;\n}, (date) => {\n return date.getUTCMinutes();\n});\n\nexport const utcMinutes = utcMinute.range;\n", "import {timeInterval} from \"./interval.js\";\nimport {durationHour, durationMinute, durationSecond} from \"./duration.js\";\n\nexport const timeHour = timeInterval((date) => {\n date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute);\n}, (date, step) => {\n date.setTime(+date + step * durationHour);\n}, (start, end) => {\n return (end - start) / durationHour;\n}, (date) => {\n return date.getHours();\n});\n\nexport const timeHours = timeHour.range;\n\nexport const utcHour = timeInterval((date) => {\n date.setUTCMinutes(0, 0, 0);\n}, (date, step) => {\n date.setTime(+date + step * durationHour);\n}, (start, end) => {\n return (end - start) / durationHour;\n}, (date) => {\n return date.getUTCHours();\n});\n\nexport const utcHours = utcHour.range;\n", "import {timeInterval} from \"./interval.js\";\nimport {durationDay, durationMinute} from \"./duration.js\";\n\nexport const timeDay = timeInterval(\n date => date.setHours(0, 0, 0, 0),\n (date, step) => date.setDate(date.getDate() + step),\n (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay,\n date => date.getDate() - 1\n);\n\nexport const timeDays = timeDay.range;\n\nexport const utcDay = timeInterval((date) => {\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCDate(date.getUTCDate() + step);\n}, (start, end) => {\n return (end - start) / durationDay;\n}, (date) => {\n return date.getUTCDate() - 1;\n});\n\nexport const utcDays = utcDay.range;\n\nexport const unixDay = timeInterval((date) => {\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCDate(date.getUTCDate() + step);\n}, (start, end) => {\n return (end - start) / durationDay;\n}, (date) => {\n return Math.floor(date / durationDay);\n});\n\nexport const unixDays = unixDay.range;\n", "import {timeInterval} from \"./interval.js\";\nimport {durationMinute, durationWeek} from \"./duration.js\";\n\nfunction timeWeekday(i) {\n return timeInterval((date) => {\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n date.setHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setDate(date.getDate() + step * 7);\n }, (start, end) => {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;\n });\n}\n\nexport const timeSunday = timeWeekday(0);\nexport const timeMonday = timeWeekday(1);\nexport const timeTuesday = timeWeekday(2);\nexport const timeWednesday = timeWeekday(3);\nexport const timeThursday = timeWeekday(4);\nexport const timeFriday = timeWeekday(5);\nexport const timeSaturday = timeWeekday(6);\n\nexport const timeSundays = timeSunday.range;\nexport const timeMondays = timeMonday.range;\nexport const timeTuesdays = timeTuesday.range;\nexport const timeWednesdays = timeWednesday.range;\nexport const timeThursdays = timeThursday.range;\nexport const timeFridays = timeFriday.range;\nexport const timeSaturdays = timeSaturday.range;\n\nfunction utcWeekday(i) {\n return timeInterval((date) => {\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n date.setUTCHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, (start, end) => {\n return (end - start) / durationWeek;\n });\n}\n\nexport const utcSunday = utcWeekday(0);\nexport const utcMonday = utcWeekday(1);\nexport const utcTuesday = utcWeekday(2);\nexport const utcWednesday = utcWeekday(3);\nexport const utcThursday = utcWeekday(4);\nexport const utcFriday = utcWeekday(5);\nexport const utcSaturday = utcWeekday(6);\n\nexport const utcSundays = utcSunday.range;\nexport const utcMondays = utcMonday.range;\nexport const utcTuesdays = utcTuesday.range;\nexport const utcWednesdays = utcWednesday.range;\nexport const utcThursdays = utcThursday.range;\nexport const utcFridays = utcFriday.range;\nexport const utcSaturdays = utcSaturday.range;\n", "import {timeInterval} from \"./interval.js\";\n\nexport const timeMonth = timeInterval((date) => {\n date.setDate(1);\n date.setHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setMonth(date.getMonth() + step);\n}, (start, end) => {\n return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;\n}, (date) => {\n return date.getMonth();\n});\n\nexport const timeMonths = timeMonth.range;\n\nexport const utcMonth = timeInterval((date) => {\n date.setUTCDate(1);\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCMonth(date.getUTCMonth() + step);\n}, (start, end) => {\n return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;\n}, (date) => {\n return date.getUTCMonth();\n});\n\nexport const utcMonths = utcMonth.range;\n", "import {timeInterval} from \"./interval.js\";\n\nexport const timeYear = timeInterval((date) => {\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setFullYear(date.getFullYear() + step);\n}, (start, end) => {\n return end.getFullYear() - start.getFullYear();\n}, (date) => {\n return date.getFullYear();\n});\n\n// An optimized implementation for this simple case.\ntimeYear.every = (k) => {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {\n date.setFullYear(Math.floor(date.getFullYear() / k) * k);\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setFullYear(date.getFullYear() + step * k);\n });\n};\n\nexport const timeYears = timeYear.range;\n\nexport const utcYear = timeInterval((date) => {\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n}, (start, end) => {\n return end.getUTCFullYear() - start.getUTCFullYear();\n}, (date) => {\n return date.getUTCFullYear();\n});\n\n// An optimized implementation for this simple case.\nutcYear.every = (k) => {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {\n date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setUTCFullYear(date.getUTCFullYear() + step * k);\n });\n};\n\nexport const utcYears = utcYear.range;\n", "import {bisector, tickStep} from \"d3-array\";\nimport {durationDay, durationHour, durationMinute, durationMonth, durationSecond, durationWeek, durationYear} from \"./duration.js\";\nimport {millisecond} from \"./millisecond.js\";\nimport {second} from \"./second.js\";\nimport {timeMinute, utcMinute} from \"./minute.js\";\nimport {timeHour, utcHour} from \"./hour.js\";\nimport {timeDay, unixDay} from \"./day.js\";\nimport {timeSunday, utcSunday} from \"./week.js\";\nimport {timeMonth, utcMonth} from \"./month.js\";\nimport {timeYear, utcYear} from \"./year.js\";\n\nfunction ticker(year, month, week, day, hour, minute) {\n\n const tickIntervals = [\n [second, 1, durationSecond],\n [second, 5, 5 * durationSecond],\n [second, 15, 15 * durationSecond],\n [second, 30, 30 * durationSecond],\n [minute, 1, durationMinute],\n [minute, 5, 5 * durationMinute],\n [minute, 15, 15 * durationMinute],\n [minute, 30, 30 * durationMinute],\n [ hour, 1, durationHour ],\n [ hour, 3, 3 * durationHour ],\n [ hour, 6, 6 * durationHour ],\n [ hour, 12, 12 * durationHour ],\n [ day, 1, durationDay ],\n [ day, 2, 2 * durationDay ],\n [ week, 1, durationWeek ],\n [ month, 1, durationMonth ],\n [ month, 3, 3 * durationMonth ],\n [ year, 1, durationYear ]\n ];\n\n function ticks(start, stop, count) {\n const reverse = stop < start;\n if (reverse) [start, stop] = [stop, start];\n const interval = count && typeof count.range === \"function\" ? count : tickInterval(start, stop, count);\n const ticks = interval ? interval.range(start, +stop + 1) : []; // inclusive stop\n return reverse ? ticks.reverse() : ticks;\n }\n\n function tickInterval(start, stop, count) {\n const target = Math.abs(stop - start) / count;\n const i = bisector(([,, step]) => step).right(tickIntervals, target);\n if (i === tickIntervals.length) return year.every(tickStep(start / durationYear, stop / durationYear, count));\n if (i === 0) return millisecond.every(Math.max(tickStep(start, stop, count), 1));\n const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];\n return t.every(step);\n }\n\n return [ticks, tickInterval];\n}\n\nconst [utcTicks, utcTickInterval] = ticker(utcYear, utcMonth, utcSunday, unixDay, utcHour, utcMinute);\nconst [timeTicks, timeTickInterval] = ticker(timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute);\n\nexport {utcTicks, utcTickInterval, timeTicks, timeTickInterval};\n", "export {\n timeInterval\n} from \"./interval.js\";\n\nexport {\n millisecond as utcMillisecond,\n milliseconds as utcMilliseconds,\n millisecond as timeMillisecond,\n milliseconds as timeMilliseconds\n} from \"./millisecond.js\";\n\nexport {\n second as utcSecond,\n seconds as utcSeconds,\n second as timeSecond,\n seconds as timeSeconds\n} from \"./second.js\";\n\nexport {\n timeMinute,\n timeMinutes,\n utcMinute,\n utcMinutes\n} from \"./minute.js\";\n\nexport {\n timeHour,\n timeHours,\n utcHour,\n utcHours\n} from \"./hour.js\";\n\nexport {\n timeDay,\n timeDays,\n utcDay,\n utcDays,\n unixDay,\n unixDays\n} from \"./day.js\";\n\nexport {\n timeSunday as timeWeek,\n timeSundays as timeWeeks,\n timeSunday,\n timeSundays,\n timeMonday,\n timeMondays,\n timeTuesday,\n timeTuesdays,\n timeWednesday,\n timeWednesdays,\n timeThursday,\n timeThursdays,\n timeFriday,\n timeFridays,\n timeSaturday,\n timeSaturdays,\n utcSunday as utcWeek,\n utcSundays as utcWeeks,\n utcSunday,\n utcSundays,\n utcMonday,\n utcMondays,\n utcTuesday,\n utcTuesdays,\n utcWednesday,\n utcWednesdays,\n utcThursday,\n utcThursdays,\n utcFriday,\n utcFridays,\n utcSaturday,\n utcSaturdays\n} from \"./week.js\";\n\nexport {\n timeMonth,\n timeMonths,\n utcMonth,\n utcMonths\n} from \"./month.js\";\n\nexport {\n timeYear,\n timeYears,\n utcYear,\n utcYears\n} from \"./year.js\";\n\nexport {\n utcTicks,\n utcTickInterval,\n timeTicks,\n timeTickInterval\n} from \"./ticks.js\";\n", "import {\n timeDay,\n timeSunday,\n timeMonday,\n timeThursday,\n timeYear,\n utcDay,\n utcSunday,\n utcMonday,\n utcThursday,\n utcYear\n} from \"d3-time\";\n\nfunction localDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);\n date.setFullYear(d.y);\n return date;\n }\n return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);\n}\n\nfunction utcDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));\n date.setUTCFullYear(d.y);\n return date;\n }\n return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));\n}\n\nfunction newDate(y, m, d) {\n return {y: y, m: m, d: d, H: 0, M: 0, S: 0, L: 0};\n}\n\nexport default function formatLocale(locale) {\n var locale_dateTime = locale.dateTime,\n locale_date = locale.date,\n locale_time = locale.time,\n locale_periods = locale.periods,\n locale_weekdays = locale.days,\n locale_shortWeekdays = locale.shortDays,\n locale_months = locale.months,\n locale_shortMonths = locale.shortMonths;\n\n var periodRe = formatRe(locale_periods),\n periodLookup = formatLookup(locale_periods),\n weekdayRe = formatRe(locale_weekdays),\n weekdayLookup = formatLookup(locale_weekdays),\n shortWeekdayRe = formatRe(locale_shortWeekdays),\n shortWeekdayLookup = formatLookup(locale_shortWeekdays),\n monthRe = formatRe(locale_months),\n monthLookup = formatLookup(locale_months),\n shortMonthRe = formatRe(locale_shortMonths),\n shortMonthLookup = formatLookup(locale_shortMonths);\n\n var formats = {\n \"a\": formatShortWeekday,\n \"A\": formatWeekday,\n \"b\": formatShortMonth,\n \"B\": formatMonth,\n \"c\": null,\n \"d\": formatDayOfMonth,\n \"e\": formatDayOfMonth,\n \"f\": formatMicroseconds,\n \"g\": formatYearISO,\n \"G\": formatFullYearISO,\n \"H\": formatHour24,\n \"I\": formatHour12,\n \"j\": formatDayOfYear,\n \"L\": formatMilliseconds,\n \"m\": formatMonthNumber,\n \"M\": formatMinutes,\n \"p\": formatPeriod,\n \"q\": formatQuarter,\n \"Q\": formatUnixTimestamp,\n \"s\": formatUnixTimestampSeconds,\n \"S\": formatSeconds,\n \"u\": formatWeekdayNumberMonday,\n \"U\": formatWeekNumberSunday,\n \"V\": formatWeekNumberISO,\n \"w\": formatWeekdayNumberSunday,\n \"W\": formatWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatYear,\n \"Y\": formatFullYear,\n \"Z\": formatZone,\n \"%\": formatLiteralPercent\n };\n\n var utcFormats = {\n \"a\": formatUTCShortWeekday,\n \"A\": formatUTCWeekday,\n \"b\": formatUTCShortMonth,\n \"B\": formatUTCMonth,\n \"c\": null,\n \"d\": formatUTCDayOfMonth,\n \"e\": formatUTCDayOfMonth,\n \"f\": formatUTCMicroseconds,\n \"g\": formatUTCYearISO,\n \"G\": formatUTCFullYearISO,\n \"H\": formatUTCHour24,\n \"I\": formatUTCHour12,\n \"j\": formatUTCDayOfYear,\n \"L\": formatUTCMilliseconds,\n \"m\": formatUTCMonthNumber,\n \"M\": formatUTCMinutes,\n \"p\": formatUTCPeriod,\n \"q\": formatUTCQuarter,\n \"Q\": formatUnixTimestamp,\n \"s\": formatUnixTimestampSeconds,\n \"S\": formatUTCSeconds,\n \"u\": formatUTCWeekdayNumberMonday,\n \"U\": formatUTCWeekNumberSunday,\n \"V\": formatUTCWeekNumberISO,\n \"w\": formatUTCWeekdayNumberSunday,\n \"W\": formatUTCWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatUTCYear,\n \"Y\": formatUTCFullYear,\n \"Z\": formatUTCZone,\n \"%\": formatLiteralPercent\n };\n\n var parses = {\n \"a\": parseShortWeekday,\n \"A\": parseWeekday,\n \"b\": parseShortMonth,\n \"B\": parseMonth,\n \"c\": parseLocaleDateTime,\n \"d\": parseDayOfMonth,\n \"e\": parseDayOfMonth,\n \"f\": parseMicroseconds,\n \"g\": parseYear,\n \"G\": parseFullYear,\n \"H\": parseHour24,\n \"I\": parseHour24,\n \"j\": parseDayOfYear,\n \"L\": parseMilliseconds,\n \"m\": parseMonthNumber,\n \"M\": parseMinutes,\n \"p\": parsePeriod,\n \"q\": parseQuarter,\n \"Q\": parseUnixTimestamp,\n \"s\": parseUnixTimestampSeconds,\n \"S\": parseSeconds,\n \"u\": parseWeekdayNumberMonday,\n \"U\": parseWeekNumberSunday,\n \"V\": parseWeekNumberISO,\n \"w\": parseWeekdayNumberSunday,\n \"W\": parseWeekNumberMonday,\n \"x\": parseLocaleDate,\n \"X\": parseLocaleTime,\n \"y\": parseYear,\n \"Y\": parseFullYear,\n \"Z\": parseZone,\n \"%\": parseLiteralPercent\n };\n\n // These recursive directive definitions must be deferred.\n formats.x = newFormat(locale_date, formats);\n formats.X = newFormat(locale_time, formats);\n formats.c = newFormat(locale_dateTime, formats);\n utcFormats.x = newFormat(locale_date, utcFormats);\n utcFormats.X = newFormat(locale_time, utcFormats);\n utcFormats.c = newFormat(locale_dateTime, utcFormats);\n\n function newFormat(specifier, formats) {\n return function(date) {\n var string = [],\n i = -1,\n j = 0,\n n = specifier.length,\n c,\n pad,\n format;\n\n if (!(date instanceof Date)) date = new Date(+date);\n\n while (++i < n) {\n if (specifier.charCodeAt(i) === 37) {\n string.push(specifier.slice(j, i));\n if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);\n else pad = c === \"e\" ? \" \" : \"0\";\n if (format = formats[c]) c = format(date, pad);\n string.push(c);\n j = i + 1;\n }\n }\n\n string.push(specifier.slice(j, i));\n return string.join(\"\");\n };\n }\n\n function newParse(specifier, Z) {\n return function(string) {\n var d = newDate(1900, undefined, 1),\n i = parseSpecifier(d, specifier, string += \"\", 0),\n week, day;\n if (i != string.length) return null;\n\n // If a UNIX timestamp is specified, return it.\n if (\"Q\" in d) return new Date(d.Q);\n if (\"s\" in d) return new Date(d.s * 1000 + (\"L\" in d ? d.L : 0));\n\n // If this is utcParse, never use the local timezone.\n if (Z && !(\"Z\" in d)) d.Z = 0;\n\n // The am-pm flag is 0 for AM, and 1 for PM.\n if (\"p\" in d) d.H = d.H % 12 + d.p * 12;\n\n // If the month was not specified, inherit from the quarter.\n if (d.m === undefined) d.m = \"q\" in d ? d.q : 0;\n\n // Convert day-of-week and week-of-year to day-of-year.\n if (\"V\" in d) {\n if (d.V < 1 || d.V > 53) return null;\n if (!(\"w\" in d)) d.w = 1;\n if (\"Z\" in d) {\n week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay();\n week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week);\n week = utcDay.offset(week, (d.V - 1) * 7);\n d.y = week.getUTCFullYear();\n d.m = week.getUTCMonth();\n d.d = week.getUTCDate() + (d.w + 6) % 7;\n } else {\n week = localDate(newDate(d.y, 0, 1)), day = week.getDay();\n week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week);\n week = timeDay.offset(week, (d.V - 1) * 7);\n d.y = week.getFullYear();\n d.m = week.getMonth();\n d.d = week.getDate() + (d.w + 6) % 7;\n }\n } else if (\"W\" in d || \"U\" in d) {\n if (!(\"w\" in d)) d.w = \"u\" in d ? d.u % 7 : \"W\" in d ? 1 : 0;\n day = \"Z\" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay();\n d.m = 0;\n d.d = \"W\" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7;\n }\n\n // If a time zone is specified, all fields are interpreted as UTC and then\n // offset according to the specified time zone.\n if (\"Z\" in d) {\n d.H += d.Z / 100 | 0;\n d.M += d.Z % 100;\n return utcDate(d);\n }\n\n // Otherwise, all fields are in local time.\n return localDate(d);\n };\n }\n\n function parseSpecifier(d, specifier, string, j) {\n var i = 0,\n n = specifier.length,\n m = string.length,\n c,\n parse;\n\n while (i < n) {\n if (j >= m) return -1;\n c = specifier.charCodeAt(i++);\n if (c === 37) {\n c = specifier.charAt(i++);\n parse = parses[c in pads ? specifier.charAt(i++) : c];\n if (!parse || ((j = parse(d, string, j)) < 0)) return -1;\n } else if (c != string.charCodeAt(j++)) {\n return -1;\n }\n }\n\n return j;\n }\n\n function parsePeriod(d, string, i) {\n var n = periodRe.exec(string.slice(i));\n return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseShortWeekday(d, string, i) {\n var n = shortWeekdayRe.exec(string.slice(i));\n return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseWeekday(d, string, i) {\n var n = weekdayRe.exec(string.slice(i));\n return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseShortMonth(d, string, i) {\n var n = shortMonthRe.exec(string.slice(i));\n return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseMonth(d, string, i) {\n var n = monthRe.exec(string.slice(i));\n return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseLocaleDateTime(d, string, i) {\n return parseSpecifier(d, locale_dateTime, string, i);\n }\n\n function parseLocaleDate(d, string, i) {\n return parseSpecifier(d, locale_date, string, i);\n }\n\n function parseLocaleTime(d, string, i) {\n return parseSpecifier(d, locale_time, string, i);\n }\n\n function formatShortWeekday(d) {\n return locale_shortWeekdays[d.getDay()];\n }\n\n function formatWeekday(d) {\n return locale_weekdays[d.getDay()];\n }\n\n function formatShortMonth(d) {\n return locale_shortMonths[d.getMonth()];\n }\n\n function formatMonth(d) {\n return locale_months[d.getMonth()];\n }\n\n function formatPeriod(d) {\n return locale_periods[+(d.getHours() >= 12)];\n }\n\n function formatQuarter(d) {\n return 1 + ~~(d.getMonth() / 3);\n }\n\n function formatUTCShortWeekday(d) {\n return locale_shortWeekdays[d.getUTCDay()];\n }\n\n function formatUTCWeekday(d) {\n return locale_weekdays[d.getUTCDay()];\n }\n\n function formatUTCShortMonth(d) {\n return locale_shortMonths[d.getUTCMonth()];\n }\n\n function formatUTCMonth(d) {\n return locale_months[d.getUTCMonth()];\n }\n\n function formatUTCPeriod(d) {\n return locale_periods[+(d.getUTCHours() >= 12)];\n }\n\n function formatUTCQuarter(d) {\n return 1 + ~~(d.getUTCMonth() / 3);\n }\n\n return {\n format: function(specifier) {\n var f = newFormat(specifier += \"\", formats);\n f.toString = function() { return specifier; };\n return f;\n },\n parse: function(specifier) {\n var p = newParse(specifier += \"\", false);\n p.toString = function() { return specifier; };\n return p;\n },\n utcFormat: function(specifier) {\n var f = newFormat(specifier += \"\", utcFormats);\n f.toString = function() { return specifier; };\n return f;\n },\n utcParse: function(specifier) {\n var p = newParse(specifier += \"\", true);\n p.toString = function() { return specifier; };\n return p;\n }\n };\n}\n\nvar pads = {\"-\": \"\", \"_\": \" \", \"0\": \"0\"},\n numberRe = /^\\s*\\d+/, // note: ignores next directive\n percentRe = /^%/,\n requoteRe = /[\\\\^$*+?|[\\]().{}]/g;\n\nfunction pad(value, fill, width) {\n var sign = value < 0 ? \"-\" : \"\",\n string = (sign ? -value : value) + \"\",\n length = string.length;\n return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);\n}\n\nfunction requote(s) {\n return s.replace(requoteRe, \"\\\\$&\");\n}\n\nfunction formatRe(names) {\n return new RegExp(\"^(?:\" + names.map(requote).join(\"|\") + \")\", \"i\");\n}\n\nfunction formatLookup(names) {\n return new Map(names.map((name, i) => [name.toLowerCase(), i]));\n}\n\nfunction parseWeekdayNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.w = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekdayNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.u = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.U = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberISO(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.V = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.W = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseFullYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 4));\n return n ? (d.y = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;\n}\n\nfunction parseZone(d, string, i) {\n var n = /^(Z)|([+-]\\d\\d)(?::?(\\d\\d))?/.exec(string.slice(i, i + 6));\n return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || \"00\")), i + n[0].length) : -1;\n}\n\nfunction parseQuarter(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1;\n}\n\nfunction parseMonthNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.m = n[0] - 1, i + n[0].length) : -1;\n}\n\nfunction parseDayOfMonth(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.d = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseDayOfYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseHour24(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.H = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMinutes(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.M = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.S = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMilliseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.L = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMicroseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 6));\n return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1;\n}\n\nfunction parseLiteralPercent(d, string, i) {\n var n = percentRe.exec(string.slice(i, i + 1));\n return n ? i + n[0].length : -1;\n}\n\nfunction parseUnixTimestamp(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.Q = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseUnixTimestampSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.s = +n[0], i + n[0].length) : -1;\n}\n\nfunction formatDayOfMonth(d, p) {\n return pad(d.getDate(), p, 2);\n}\n\nfunction formatHour24(d, p) {\n return pad(d.getHours(), p, 2);\n}\n\nfunction formatHour12(d, p) {\n return pad(d.getHours() % 12 || 12, p, 2);\n}\n\nfunction formatDayOfYear(d, p) {\n return pad(1 + timeDay.count(timeYear(d), d), p, 3);\n}\n\nfunction formatMilliseconds(d, p) {\n return pad(d.getMilliseconds(), p, 3);\n}\n\nfunction formatMicroseconds(d, p) {\n return formatMilliseconds(d, p) + \"000\";\n}\n\nfunction formatMonthNumber(d, p) {\n return pad(d.getMonth() + 1, p, 2);\n}\n\nfunction formatMinutes(d, p) {\n return pad(d.getMinutes(), p, 2);\n}\n\nfunction formatSeconds(d, p) {\n return pad(d.getSeconds(), p, 2);\n}\n\nfunction formatWeekdayNumberMonday(d) {\n var day = d.getDay();\n return day === 0 ? 7 : day;\n}\n\nfunction formatWeekNumberSunday(d, p) {\n return pad(timeSunday.count(timeYear(d) - 1, d), p, 2);\n}\n\nfunction dISO(d) {\n var day = d.getDay();\n return (day >= 4 || day === 0) ? timeThursday(d) : timeThursday.ceil(d);\n}\n\nfunction formatWeekNumberISO(d, p) {\n d = dISO(d);\n return pad(timeThursday.count(timeYear(d), d) + (timeYear(d).getDay() === 4), p, 2);\n}\n\nfunction formatWeekdayNumberSunday(d) {\n return d.getDay();\n}\n\nfunction formatWeekNumberMonday(d, p) {\n return pad(timeMonday.count(timeYear(d) - 1, d), p, 2);\n}\n\nfunction formatYear(d, p) {\n return pad(d.getFullYear() % 100, p, 2);\n}\n\nfunction formatYearISO(d, p) {\n d = dISO(d);\n return pad(d.getFullYear() % 100, p, 2);\n}\n\nfunction formatFullYear(d, p) {\n return pad(d.getFullYear() % 10000, p, 4);\n}\n\nfunction formatFullYearISO(d, p) {\n var day = d.getDay();\n d = (day >= 4 || day === 0) ? timeThursday(d) : timeThursday.ceil(d);\n return pad(d.getFullYear() % 10000, p, 4);\n}\n\nfunction formatZone(d) {\n var z = d.getTimezoneOffset();\n return (z > 0 ? \"-\" : (z *= -1, \"+\"))\n + pad(z / 60 | 0, \"0\", 2)\n + pad(z % 60, \"0\", 2);\n}\n\nfunction formatUTCDayOfMonth(d, p) {\n return pad(d.getUTCDate(), p, 2);\n}\n\nfunction formatUTCHour24(d, p) {\n return pad(d.getUTCHours(), p, 2);\n}\n\nfunction formatUTCHour12(d, p) {\n return pad(d.getUTCHours() % 12 || 12, p, 2);\n}\n\nfunction formatUTCDayOfYear(d, p) {\n return pad(1 + utcDay.count(utcYear(d), d), p, 3);\n}\n\nfunction formatUTCMilliseconds(d, p) {\n return pad(d.getUTCMilliseconds(), p, 3);\n}\n\nfunction formatUTCMicroseconds(d, p) {\n return formatUTCMilliseconds(d, p) + \"000\";\n}\n\nfunction formatUTCMonthNumber(d, p) {\n return pad(d.getUTCMonth() + 1, p, 2);\n}\n\nfunction formatUTCMinutes(d, p) {\n return pad(d.getUTCMinutes(), p, 2);\n}\n\nfunction formatUTCSeconds(d, p) {\n return pad(d.getUTCSeconds(), p, 2);\n}\n\nfunction formatUTCWeekdayNumberMonday(d) {\n var dow = d.getUTCDay();\n return dow === 0 ? 7 : dow;\n}\n\nfunction formatUTCWeekNumberSunday(d, p) {\n return pad(utcSunday.count(utcYear(d) - 1, d), p, 2);\n}\n\nfunction UTCdISO(d) {\n var day = d.getUTCDay();\n return (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);\n}\n\nfunction formatUTCWeekNumberISO(d, p) {\n d = UTCdISO(d);\n return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2);\n}\n\nfunction formatUTCWeekdayNumberSunday(d) {\n return d.getUTCDay();\n}\n\nfunction formatUTCWeekNumberMonday(d, p) {\n return pad(utcMonday.count(utcYear(d) - 1, d), p, 2);\n}\n\nfunction formatUTCYear(d, p) {\n return pad(d.getUTCFullYear() % 100, p, 2);\n}\n\nfunction formatUTCYearISO(d, p) {\n d = UTCdISO(d);\n return pad(d.getUTCFullYear() % 100, p, 2);\n}\n\nfunction formatUTCFullYear(d, p) {\n return pad(d.getUTCFullYear() % 10000, p, 4);\n}\n\nfunction formatUTCFullYearISO(d, p) {\n var day = d.getUTCDay();\n d = (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);\n return pad(d.getUTCFullYear() % 10000, p, 4);\n}\n\nfunction formatUTCZone() {\n return \"+0000\";\n}\n\nfunction formatLiteralPercent() {\n return \"%\";\n}\n\nfunction formatUnixTimestamp(d) {\n return +d;\n}\n\nfunction formatUnixTimestampSeconds(d) {\n return Math.floor(+d / 1000);\n}\n", "import formatLocale from \"./locale.js\";\n\nvar locale;\nexport var timeFormat;\nexport var timeParse;\nexport var utcFormat;\nexport var utcParse;\n\ndefaultLocale({\n dateTime: \"%x, %X\",\n date: \"%-m/%-d/%Y\",\n time: \"%-I:%M:%S %p\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n});\n\nexport default function defaultLocale(definition) {\n locale = formatLocale(definition);\n timeFormat = locale.format;\n timeParse = locale.parse;\n utcFormat = locale.utcFormat;\n utcParse = locale.utcParse;\n return locale;\n}\n", "export {default as timeFormatDefaultLocale, timeFormat, timeParse, utcFormat, utcParse} from \"./defaultLocale.js\";\nexport {default as timeFormatLocale} from \"./locale.js\";\nexport {default as isoFormat} from \"./isoFormat.js\";\nexport {default as isoParse} from \"./isoParse.js\";\n", "import {timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeTicks, timeTickInterval} from \"d3-time\";\nimport {timeFormat} from \"d3-time-format\";\nimport continuous, {copy} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\nimport nice from \"./nice.js\";\n\nfunction date(t) {\n return new Date(t);\n}\n\nfunction number(t) {\n return t instanceof Date ? +t : +new Date(+t);\n}\n\nexport function calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format) {\n var scale = continuous(),\n invert = scale.invert,\n domain = scale.domain;\n\n var formatMillisecond = format(\".%L\"),\n formatSecond = format(\":%S\"),\n formatMinute = format(\"%I:%M\"),\n formatHour = format(\"%I %p\"),\n formatDay = format(\"%a %d\"),\n formatWeek = format(\"%b %d\"),\n formatMonth = format(\"%B\"),\n formatYear = format(\"%Y\");\n\n function tickFormat(date) {\n return (second(date) < date ? formatMillisecond\n : minute(date) < date ? formatSecond\n : hour(date) < date ? formatMinute\n : day(date) < date ? formatHour\n : month(date) < date ? (week(date) < date ? formatDay : formatWeek)\n : year(date) < date ? formatMonth\n : formatYear)(date);\n }\n\n scale.invert = function(y) {\n return new Date(invert(y));\n };\n\n scale.domain = function(_) {\n return arguments.length ? domain(Array.from(_, number)) : domain().map(date);\n };\n\n scale.ticks = function(interval) {\n var d = domain();\n return ticks(d[0], d[d.length - 1], interval == null ? 10 : interval);\n };\n\n scale.tickFormat = function(count, specifier) {\n return specifier == null ? tickFormat : format(specifier);\n };\n\n scale.nice = function(interval) {\n var d = domain();\n if (!interval || typeof interval.range !== \"function\") interval = tickInterval(d[0], d[d.length - 1], interval == null ? 10 : interval);\n return interval ? domain(nice(d, interval)) : scale;\n };\n\n scale.copy = function() {\n return copy(scale, calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format));\n };\n\n return scale;\n}\n\nexport default function time() {\n return initRange.apply(calendar(timeTicks, timeTickInterval, timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments);\n}\n", "export {\n default as scaleBand,\n point as scalePoint\n} from \"./band.js\";\n\nexport {\n default as scaleIdentity\n} from \"./identity.js\";\n\nexport {\n default as scaleLinear\n} from \"./linear.js\";\n\nexport {\n default as scaleLog\n} from \"./log.js\";\n\nexport {\n default as scaleSymlog\n} from \"./symlog.js\";\n\nexport {\n default as scaleOrdinal,\n implicit as scaleImplicit\n} from \"./ordinal.js\";\n\nexport {\n default as scalePow,\n sqrt as scaleSqrt\n} from \"./pow.js\";\n\nexport {\n default as scaleRadial\n} from \"./radial.js\";\n\nexport {\n default as scaleQuantile\n} from \"./quantile.js\";\n\nexport {\n default as scaleQuantize\n} from \"./quantize.js\";\n\nexport {\n default as scaleThreshold\n} from \"./threshold.js\";\n\nexport {\n default as scaleTime\n} from \"./time.js\";\n\nexport {\n default as scaleUtc\n} from \"./utcTime.js\";\n\nexport {\n default as scaleSequential,\n sequentialLog as scaleSequentialLog,\n sequentialPow as scaleSequentialPow,\n sequentialSqrt as scaleSequentialSqrt,\n sequentialSymlog as scaleSequentialSymlog\n} from \"./sequential.js\";\n\nexport {\n default as scaleSequentialQuantile\n} from \"./sequentialQuantile.js\";\n\nexport {\n default as scaleDiverging,\n divergingLog as scaleDivergingLog,\n divergingPow as scaleDivergingPow,\n divergingSqrt as scaleDivergingSqrt,\n divergingSymlog as scaleDivergingSymlog\n} from \"./diverging.js\";\n\nexport {\n default as tickFormat\n} from \"./tickFormat.js\";\n", "export default function(specifier) {\n var n = specifier.length / 6 | 0, colors = new Array(n), i = 0;\n while (i < n) colors[i] = \"#\" + specifier.slice(i * 6, ++i * 6);\n return colors;\n}\n", "import colors from \"../colors.js\";\n\nexport default colors(\"4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab\");\n", "export {default as schemeCategory10} from \"./categorical/category10.js\";\nexport {default as schemeAccent} from \"./categorical/Accent.js\";\nexport {default as schemeDark2} from \"./categorical/Dark2.js\";\nexport {default as schemeObservable10} from \"./categorical/observable10.js\";\nexport {default as schemePaired} from \"./categorical/Paired.js\";\nexport {default as schemePastel1} from \"./categorical/Pastel1.js\";\nexport {default as schemePastel2} from \"./categorical/Pastel2.js\";\nexport {default as schemeSet1} from \"./categorical/Set1.js\";\nexport {default as schemeSet2} from \"./categorical/Set2.js\";\nexport {default as schemeSet3} from \"./categorical/Set3.js\";\nexport {default as schemeTableau10} from \"./categorical/Tableau10.js\";\nexport {default as interpolateBrBG, scheme as schemeBrBG} from \"./diverging/BrBG.js\";\nexport {default as interpolatePRGn, scheme as schemePRGn} from \"./diverging/PRGn.js\";\nexport {default as interpolatePiYG, scheme as schemePiYG} from \"./diverging/PiYG.js\";\nexport {default as interpolatePuOr, scheme as schemePuOr} from \"./diverging/PuOr.js\";\nexport {default as interpolateRdBu, scheme as schemeRdBu} from \"./diverging/RdBu.js\";\nexport {default as interpolateRdGy, scheme as schemeRdGy} from \"./diverging/RdGy.js\";\nexport {default as interpolateRdYlBu, scheme as schemeRdYlBu} from \"./diverging/RdYlBu.js\";\nexport {default as interpolateRdYlGn, scheme as schemeRdYlGn} from \"./diverging/RdYlGn.js\";\nexport {default as interpolateSpectral, scheme as schemeSpectral} from \"./diverging/Spectral.js\";\nexport {default as interpolateBuGn, scheme as schemeBuGn} from \"./sequential-multi/BuGn.js\";\nexport {default as interpolateBuPu, scheme as schemeBuPu} from \"./sequential-multi/BuPu.js\";\nexport {default as interpolateGnBu, scheme as schemeGnBu} from \"./sequential-multi/GnBu.js\";\nexport {default as interpolateOrRd, scheme as schemeOrRd} from \"./sequential-multi/OrRd.js\";\nexport {default as interpolatePuBuGn, scheme as schemePuBuGn} from \"./sequential-multi/PuBuGn.js\";\nexport {default as interpolatePuBu, scheme as schemePuBu} from \"./sequential-multi/PuBu.js\";\nexport {default as interpolatePuRd, scheme as schemePuRd} from \"./sequential-multi/PuRd.js\";\nexport {default as interpolateRdPu, scheme as schemeRdPu} from \"./sequential-multi/RdPu.js\";\nexport {default as interpolateYlGnBu, scheme as schemeYlGnBu} from \"./sequential-multi/YlGnBu.js\";\nexport {default as interpolateYlGn, scheme as schemeYlGn} from \"./sequential-multi/YlGn.js\";\nexport {default as interpolateYlOrBr, scheme as schemeYlOrBr} from \"./sequential-multi/YlOrBr.js\";\nexport {default as interpolateYlOrRd, scheme as schemeYlOrRd} from \"./sequential-multi/YlOrRd.js\";\nexport {default as interpolateBlues, scheme as schemeBlues} from \"./sequential-single/Blues.js\";\nexport {default as interpolateGreens, scheme as schemeGreens} from \"./sequential-single/Greens.js\";\nexport {default as interpolateGreys, scheme as schemeGreys} from \"./sequential-single/Greys.js\";\nexport {default as interpolatePurples, scheme as schemePurples} from \"./sequential-single/Purples.js\";\nexport {default as interpolateReds, scheme as schemeReds} from \"./sequential-single/Reds.js\";\nexport {default as interpolateOranges, scheme as schemeOranges} from \"./sequential-single/Oranges.js\";\nexport {default as interpolateCividis} from \"./sequential-multi/cividis.js\";\nexport {default as interpolateCubehelixDefault} from \"./sequential-multi/cubehelix.js\";\nexport {default as interpolateRainbow, warm as interpolateWarm, cool as interpolateCool} from \"./sequential-multi/rainbow.js\";\nexport {default as interpolateSinebow} from \"./sequential-multi/sinebow.js\";\nexport {default as interpolateTurbo} from \"./sequential-multi/turbo.js\";\nexport {default as interpolateViridis, magma as interpolateMagma, inferno as interpolateInferno, plasma as interpolatePlasma} from \"./sequential-multi/viridis.js\";\n", "export default function(x) {\n return function constant() {\n return x;\n };\n}\n", "export const abs = Math.abs;\nexport const atan2 = Math.atan2;\nexport const cos = Math.cos;\nexport const max = Math.max;\nexport const min = Math.min;\nexport const sin = Math.sin;\nexport const sqrt = Math.sqrt;\n\nexport const epsilon = 1e-12;\nexport const pi = Math.PI;\nexport const halfPi = pi / 2;\nexport const tau = 2 * pi;\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n", "import {Path} from \"d3-path\";\n\nexport function withPath(shape) {\n let digits = 3;\n\n shape.digits = function(_) {\n if (!arguments.length) return digits;\n if (_ == null) {\n digits = null;\n } else {\n const d = Math.floor(_);\n if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);\n digits = d;\n }\n return shape;\n };\n\n return () => new Path(digits);\n}\n", "import constant from \"./constant.js\";\nimport {abs, acos, asin, atan2, cos, epsilon, halfPi, max, min, pi, sin, sqrt, tau} from \"./math.js\";\nimport {withPath} from \"./path.js\";\n\nfunction arcInnerRadius(d) {\n return d.innerRadius;\n}\n\nfunction arcOuterRadius(d) {\n return d.outerRadius;\n}\n\nfunction arcStartAngle(d) {\n return d.startAngle;\n}\n\nfunction arcEndAngle(d) {\n return d.endAngle;\n}\n\nfunction arcPadAngle(d) {\n return d && d.padAngle; // Note: optional!\n}\n\nfunction intersect(x0, y0, x1, y1, x2, y2, x3, y3) {\n var x10 = x1 - x0, y10 = y1 - y0,\n x32 = x3 - x2, y32 = y3 - y2,\n t = y32 * x10 - x32 * y10;\n if (t * t < epsilon) return;\n t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;\n return [x0 + t * x10, y0 + t * y10];\n}\n\n// Compute perpendicular offset line of length rc.\n// http://mathworld.wolfram.com/Circle-LineIntersection.html\nfunction cornerTangents(x0, y0, x1, y1, r1, rc, cw) {\n var x01 = x0 - x1,\n y01 = y0 - y1,\n lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01),\n ox = lo * y01,\n oy = -lo * x01,\n x11 = x0 + ox,\n y11 = y0 + oy,\n x10 = x1 + ox,\n y10 = y1 + oy,\n x00 = (x11 + x10) / 2,\n y00 = (y11 + y10) / 2,\n dx = x10 - x11,\n dy = y10 - y11,\n d2 = dx * dx + dy * dy,\n r = r1 - rc,\n D = x11 * y10 - x10 * y11,\n d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)),\n cx0 = (D * dy - dx * d) / d2,\n cy0 = (-D * dx - dy * d) / d2,\n cx1 = (D * dy + dx * d) / d2,\n cy1 = (-D * dx + dy * d) / d2,\n dx0 = cx0 - x00,\n dy0 = cy0 - y00,\n dx1 = cx1 - x00,\n dy1 = cy1 - y00;\n\n // Pick the closer of the two intersection points.\n // TODO Is there a faster way to determine which intersection to use?\n if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;\n\n return {\n cx: cx0,\n cy: cy0,\n x01: -ox,\n y01: -oy,\n x11: cx0 * (r1 / r - 1),\n y11: cy0 * (r1 / r - 1)\n };\n}\n\nexport default function() {\n var innerRadius = arcInnerRadius,\n outerRadius = arcOuterRadius,\n cornerRadius = constant(0),\n padRadius = null,\n startAngle = arcStartAngle,\n endAngle = arcEndAngle,\n padAngle = arcPadAngle,\n context = null,\n path = withPath(arc);\n\n function arc() {\n var buffer,\n r,\n r0 = +innerRadius.apply(this, arguments),\n r1 = +outerRadius.apply(this, arguments),\n a0 = startAngle.apply(this, arguments) - halfPi,\n a1 = endAngle.apply(this, arguments) - halfPi,\n da = abs(a1 - a0),\n cw = a1 > a0;\n\n if (!context) context = buffer = path();\n\n // Ensure that the outer radius is always larger than the inner radius.\n if (r1 < r0) r = r1, r1 = r0, r0 = r;\n\n // Is it a point?\n if (!(r1 > epsilon)) context.moveTo(0, 0);\n\n // Or is it a circle or annulus?\n else if (da > tau - epsilon) {\n context.moveTo(r1 * cos(a0), r1 * sin(a0));\n context.arc(0, 0, r1, a0, a1, !cw);\n if (r0 > epsilon) {\n context.moveTo(r0 * cos(a1), r0 * sin(a1));\n context.arc(0, 0, r0, a1, a0, cw);\n }\n }\n\n // Or is it a circular or annular sector?\n else {\n var a01 = a0,\n a11 = a1,\n a00 = a0,\n a10 = a1,\n da0 = da,\n da1 = da,\n ap = padAngle.apply(this, arguments) / 2,\n rp = (ap > epsilon) && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)),\n rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),\n rc0 = rc,\n rc1 = rc,\n t0,\n t1;\n\n // Apply padding? Note that since r1 \u2265 r0, da1 \u2265 da0.\n if (rp > epsilon) {\n var p0 = asin(rp / r0 * sin(ap)),\n p1 = asin(rp / r1 * sin(ap));\n if ((da0 -= p0 * 2) > epsilon) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0;\n else da0 = 0, a00 = a10 = (a0 + a1) / 2;\n if ((da1 -= p1 * 2) > epsilon) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1;\n else da1 = 0, a01 = a11 = (a0 + a1) / 2;\n }\n\n var x01 = r1 * cos(a01),\n y01 = r1 * sin(a01),\n x10 = r0 * cos(a10),\n y10 = r0 * sin(a10);\n\n // Apply rounded corners?\n if (rc > epsilon) {\n var x11 = r1 * cos(a11),\n y11 = r1 * sin(a11),\n x00 = r0 * cos(a00),\n y00 = r0 * sin(a00),\n oc;\n\n // Restrict the corner radius according to the sector angle. If this\n // intersection fails, it\u2019s probably because the arc is too small, so\n // disable the corner radius entirely.\n if (da < pi) {\n if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) {\n var ax = x01 - oc[0],\n ay = y01 - oc[1],\n bx = x11 - oc[0],\n by = y11 - oc[1],\n kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2),\n lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);\n rc0 = min(rc, (r0 - lc) / (kc - 1));\n rc1 = min(rc, (r1 - lc) / (kc + 1));\n } else {\n rc0 = rc1 = 0;\n }\n }\n }\n\n // Is the sector collapsed to a line?\n if (!(da1 > epsilon)) context.moveTo(x01, y01);\n\n // Does the sector\u2019s outer ring have rounded corners?\n else if (rc1 > epsilon) {\n t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);\n t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);\n\n context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);\n\n // Have the corners merged?\n if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);\n\n // Otherwise, draw the two corners and the ring.\n else {\n context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);\n context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);\n context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);\n }\n }\n\n // Or is the outer ring just a circular arc?\n else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);\n\n // Is there no inner ring, and it\u2019s a circular sector?\n // Or perhaps it\u2019s an annular sector collapsed due to padding?\n if (!(r0 > epsilon) || !(da0 > epsilon)) context.lineTo(x10, y10);\n\n // Does the sector\u2019s inner ring (or point) have rounded corners?\n else if (rc0 > epsilon) {\n t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);\n t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);\n\n context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);\n\n // Have the corners merged?\n if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);\n\n // Otherwise, draw the two corners and the ring.\n else {\n context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);\n context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);\n context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);\n }\n }\n\n // Or is the inner ring just a circular arc?\n else context.arc(0, 0, r0, a10, a00, cw);\n }\n\n context.closePath();\n\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n arc.centroid = function() {\n var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2,\n a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;\n return [cos(a) * r, sin(a) * r];\n };\n\n arc.innerRadius = function(_) {\n return arguments.length ? (innerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : innerRadius;\n };\n\n arc.outerRadius = function(_) {\n return arguments.length ? (outerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : outerRadius;\n };\n\n arc.cornerRadius = function(_) {\n return arguments.length ? (cornerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : cornerRadius;\n };\n\n arc.padRadius = function(_) {\n return arguments.length ? (padRadius = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), arc) : padRadius;\n };\n\n arc.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : startAngle;\n };\n\n arc.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : endAngle;\n };\n\n arc.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : padAngle;\n };\n\n arc.context = function(_) {\n return arguments.length ? ((context = _ == null ? null : _), arc) : context;\n };\n\n return arc;\n}\n", "export var slice = Array.prototype.slice;\n\nexport default function(x) {\n return typeof x === \"object\" && \"length\" in x\n ? x // Array, TypedArray, NodeList, array-like\n : Array.from(x); // Map, Set, iterable, string, or anything else\n}\n", "function Linear(context) {\n this._context = context;\n}\n\nLinear.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; // falls through\n default: this._context.lineTo(x, y); break;\n }\n }\n};\n\nexport default function(context) {\n return new Linear(context);\n}\n", "export function x(p) {\n return p[0];\n}\n\nexport function y(p) {\n return p[1];\n}\n", "import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport curveLinear from \"./curve/linear.js\";\nimport {withPath} from \"./path.js\";\nimport {x as pointX, y as pointY} from \"./point.js\";\n\nexport default function(x, y) {\n var defined = constant(true),\n context = null,\n curve = curveLinear,\n output = null,\n path = withPath(line);\n\n x = typeof x === \"function\" ? x : (x === undefined) ? pointX : constant(x);\n y = typeof y === \"function\" ? y : (y === undefined) ? pointY : constant(y);\n\n function line(data) {\n var i,\n n = (data = array(data)).length,\n d,\n defined0 = false,\n buffer;\n\n if (context == null) output = curve(buffer = path());\n\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) output.lineStart();\n else output.lineEnd();\n }\n if (defined0) output.point(+x(d, i, data), +y(d, i, data));\n }\n\n if (buffer) return output = null, buffer + \"\" || null;\n }\n\n line.x = function(_) {\n return arguments.length ? (x = typeof _ === \"function\" ? _ : constant(+_), line) : x;\n };\n\n line.y = function(_) {\n return arguments.length ? (y = typeof _ === \"function\" ? _ : constant(+_), line) : y;\n };\n\n line.defined = function(_) {\n return arguments.length ? (defined = typeof _ === \"function\" ? _ : constant(!!_), line) : defined;\n };\n\n line.curve = function(_) {\n return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve;\n };\n\n line.context = function(_) {\n return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context;\n };\n\n return line;\n}\n", "export default function(a, b) {\n return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;\n}\n", "export default function(d) {\n return d;\n}\n", "import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport descending from \"./descending.js\";\nimport identity from \"./identity.js\";\nimport {tau} from \"./math.js\";\n\nexport default function() {\n var value = identity,\n sortValues = descending,\n sort = null,\n startAngle = constant(0),\n endAngle = constant(tau),\n padAngle = constant(0);\n\n function pie(data) {\n var i,\n n = (data = array(data)).length,\n j,\n k,\n sum = 0,\n index = new Array(n),\n arcs = new Array(n),\n a0 = +startAngle.apply(this, arguments),\n da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)),\n a1,\n p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)),\n pa = p * (da < 0 ? -1 : 1),\n v;\n\n for (i = 0; i < n; ++i) {\n if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {\n sum += v;\n }\n }\n\n // Optionally sort the arcs by previously-computed values or by data.\n if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); });\n else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); });\n\n // Compute the arcs! They are stored in the original data's order.\n for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {\n j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {\n data: data[j],\n index: i,\n value: v,\n startAngle: a0,\n endAngle: a1,\n padAngle: p\n };\n }\n\n return arcs;\n }\n\n pie.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant(+_), pie) : value;\n };\n\n pie.sortValues = function(_) {\n return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;\n };\n\n pie.sort = function(_) {\n return arguments.length ? (sort = _, sortValues = null, pie) : sort;\n };\n\n pie.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : startAngle;\n };\n\n pie.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : endAngle;\n };\n\n pie.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : padAngle;\n };\n\n return pie;\n}\n", "import pointRadial from \"../pointRadial.js\";\n\nclass Bump {\n constructor(context, x) {\n this._context = context;\n this._x = x;\n }\n areaStart() {\n this._line = 0;\n }\n areaEnd() {\n this._line = NaN;\n }\n lineStart() {\n this._point = 0;\n }\n lineEnd() {\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n }\n point(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: {\n this._point = 1;\n if (this._line) this._context.lineTo(x, y);\n else this._context.moveTo(x, y);\n break;\n }\n case 1: this._point = 2; // falls through\n default: {\n if (this._x) this._context.bezierCurveTo(this._x0 = (this._x0 + x) / 2, this._y0, this._x0, y, x, y);\n else this._context.bezierCurveTo(this._x0, this._y0 = (this._y0 + y) / 2, x, this._y0, x, y);\n break;\n }\n }\n this._x0 = x, this._y0 = y;\n }\n}\n\nclass BumpRadial {\n constructor(context) {\n this._context = context;\n }\n lineStart() {\n this._point = 0;\n }\n lineEnd() {}\n point(x, y) {\n x = +x, y = +y;\n if (this._point === 0) {\n this._point = 1;\n } else {\n const p0 = pointRadial(this._x0, this._y0);\n const p1 = pointRadial(this._x0, this._y0 = (this._y0 + y) / 2);\n const p2 = pointRadial(x, this._y0);\n const p3 = pointRadial(x, y);\n this._context.moveTo(...p0);\n this._context.bezierCurveTo(...p1, ...p2, ...p3);\n }\n this._x0 = x, this._y0 = y;\n }\n}\n\nexport function bumpX(context) {\n return new Bump(context, true);\n}\n\nexport function bumpY(context) {\n return new Bump(context, false);\n}\n\nexport function bumpRadial(context) {\n return new BumpRadial(context);\n}\n", "export default function() {}\n", "export function point(that, x, y) {\n that._context.bezierCurveTo(\n (2 * that._x0 + that._x1) / 3,\n (2 * that._y0 + that._y1) / 3,\n (that._x0 + 2 * that._x1) / 3,\n (that._y0 + 2 * that._y1) / 3,\n (that._x0 + 4 * that._x1 + x) / 6,\n (that._y0 + 4 * that._y1 + y) / 6\n );\n}\n\nexport function Basis(context) {\n this._context = context;\n}\n\nBasis.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 3: point(this, this._x1, this._y1); // falls through\n case 2: this._context.lineTo(this._x1, this._y1); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nexport default function(context) {\n return new Basis(context);\n}\n", "import noop from \"../noop.js\";\nimport {point} from \"./basis.js\";\n\nfunction BasisClosed(context) {\n this._context = context;\n}\n\nBasisClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x2, this._y2);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3);\n this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x2, this._y2);\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._x2 = x, this._y2 = y; break;\n case 1: this._point = 2; this._x3 = x, this._y3 = y; break;\n case 2: this._point = 3; this._x4 = x, this._y4 = y; this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); break;\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nexport default function(context) {\n return new BasisClosed(context);\n}\n", "import {point} from \"./basis.js\";\n\nfunction BasisOpen(context) {\n this._context = context;\n}\n\nBasisOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); break;\n case 3: this._point = 4; // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nexport default function(context) {\n return new BasisOpen(context);\n}\n", "import {Basis} from \"./basis.js\";\n\nfunction Bundle(context, beta) {\n this._basis = new Basis(context);\n this._beta = beta;\n}\n\nBundle.prototype = {\n lineStart: function() {\n this._x = [];\n this._y = [];\n this._basis.lineStart();\n },\n lineEnd: function() {\n var x = this._x,\n y = this._y,\n j = x.length - 1;\n\n if (j > 0) {\n var x0 = x[0],\n y0 = y[0],\n dx = x[j] - x0,\n dy = y[j] - y0,\n i = -1,\n t;\n\n while (++i <= j) {\n t = i / j;\n this._basis.point(\n this._beta * x[i] + (1 - this._beta) * (x0 + t * dx),\n this._beta * y[i] + (1 - this._beta) * (y0 + t * dy)\n );\n }\n }\n\n this._x = this._y = null;\n this._basis.lineEnd();\n },\n point: function(x, y) {\n this._x.push(+x);\n this._y.push(+y);\n }\n};\n\nexport default (function custom(beta) {\n\n function bundle(context) {\n return beta === 1 ? new Basis(context) : new Bundle(context, beta);\n }\n\n bundle.beta = function(beta) {\n return custom(+beta);\n };\n\n return bundle;\n})(0.85);\n", "export function point(that, x, y) {\n that._context.bezierCurveTo(\n that._x1 + that._k * (that._x2 - that._x0),\n that._y1 + that._k * (that._y2 - that._y0),\n that._x2 + that._k * (that._x1 - x),\n that._y2 + that._k * (that._y1 - y),\n that._x2,\n that._y2\n );\n}\n\nexport function Cardinal(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinal.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x2, this._y2); break;\n case 3: point(this, this._x1, this._y1); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; this._x1 = x, this._y1 = y; break;\n case 2: this._point = 3; // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new Cardinal(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n", "import noop from \"../noop.js\";\nimport {point} from \"./cardinal.js\";\n\nexport function CardinalClosed(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinalClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.lineTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n this.point(this._x5, this._y5);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new CardinalClosed(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n", "import {point} from \"./cardinal.js\";\n\nexport function CardinalOpen(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinalOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;\n case 3: this._point = 4; // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new CardinalOpen(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n", "import {epsilon} from \"../math.js\";\nimport {Cardinal} from \"./cardinal.js\";\n\nexport function point(that, x, y) {\n var x1 = that._x1,\n y1 = that._y1,\n x2 = that._x2,\n y2 = that._y2;\n\n if (that._l01_a > epsilon) {\n var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a,\n n = 3 * that._l01_a * (that._l01_a + that._l12_a);\n x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n;\n y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n;\n }\n\n if (that._l23_a > epsilon) {\n var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a,\n m = 3 * that._l23_a * (that._l23_a + that._l12_a);\n x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m;\n y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m;\n }\n\n that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2);\n}\n\nfunction CatmullRom(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRom.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x2, this._y2); break;\n case 3: this.point(this._x2, this._y2); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; // falls through\n default: point(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(alpha) {\n\n function catmullRom(context) {\n return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0);\n }\n\n catmullRom.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom;\n})(0.5);\n", "import {CardinalClosed} from \"./cardinalClosed.js\";\nimport noop from \"../noop.js\";\nimport {point} from \"./catmullRom.js\";\n\nfunction CatmullRomClosed(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRomClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.lineTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n this.point(this._x5, this._y5);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n default: point(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(alpha) {\n\n function catmullRom(context) {\n return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0);\n }\n\n catmullRom.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom;\n})(0.5);\n", "import {CardinalOpen} from \"./cardinalOpen.js\";\nimport {point} from \"./catmullRom.js\";\n\nfunction CatmullRomOpen(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRomOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;\n case 3: this._point = 4; // falls through\n default: point(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(alpha) {\n\n function catmullRom(context) {\n return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0);\n }\n\n catmullRom.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom;\n})(0.5);\n", "import noop from \"../noop.js\";\n\nfunction LinearClosed(context) {\n this._context = context;\n}\n\nLinearClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._point) this._context.closePath();\n },\n point: function(x, y) {\n x = +x, y = +y;\n if (this._point) this._context.lineTo(x, y);\n else this._point = 1, this._context.moveTo(x, y);\n }\n};\n\nexport default function(context) {\n return new LinearClosed(context);\n}\n", "function sign(x) {\n return x < 0 ? -1 : 1;\n}\n\n// Calculate the slopes of the tangents (Hermite-type interpolation) based on\n// the following paper: Steffen, M. 1990. A Simple Method for Monotonic\n// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO.\n// NOV(II), P. 443, 1990.\nfunction slope3(that, x2, y2) {\n var h0 = that._x1 - that._x0,\n h1 = x2 - that._x1,\n s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0),\n s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0),\n p = (s0 * h1 + s1 * h0) / (h0 + h1);\n return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;\n}\n\n// Calculate a one-sided slope.\nfunction slope2(that, t) {\n var h = that._x1 - that._x0;\n return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;\n}\n\n// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations\n// \"you can express cubic Hermite interpolation in terms of cubic B\u00E9zier curves\n// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1\".\nfunction point(that, t0, t1) {\n var x0 = that._x0,\n y0 = that._y0,\n x1 = that._x1,\n y1 = that._y1,\n dx = (x1 - x0) / 3;\n that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);\n}\n\nfunction MonotoneX(context) {\n this._context = context;\n}\n\nMonotoneX.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 =\n this._t0 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x1, this._y1); break;\n case 3: point(this, this._t0, slope2(this, this._t0)); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n var t1 = NaN;\n\n x = +x, y = +y;\n if (x === this._x1 && y === this._y1) return; // Ignore coincident points.\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; point(this, slope2(this, t1 = slope3(this, x, y)), t1); break;\n default: point(this, this._t0, t1 = slope3(this, x, y)); break;\n }\n\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n this._t0 = t1;\n }\n}\n\nfunction MonotoneY(context) {\n this._context = new ReflectContext(context);\n}\n\n(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) {\n MonotoneX.prototype.point.call(this, y, x);\n};\n\nfunction ReflectContext(context) {\n this._context = context;\n}\n\nReflectContext.prototype = {\n moveTo: function(x, y) { this._context.moveTo(y, x); },\n closePath: function() { this._context.closePath(); },\n lineTo: function(x, y) { this._context.lineTo(y, x); },\n bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._context.bezierCurveTo(y1, x1, y2, x2, y, x); }\n};\n\nexport function monotoneX(context) {\n return new MonotoneX(context);\n}\n\nexport function monotoneY(context) {\n return new MonotoneY(context);\n}\n", "function Natural(context) {\n this._context = context;\n}\n\nNatural.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x = [];\n this._y = [];\n },\n lineEnd: function() {\n var x = this._x,\n y = this._y,\n n = x.length;\n\n if (n) {\n this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]);\n if (n === 2) {\n this._context.lineTo(x[1], y[1]);\n } else {\n var px = controlPoints(x),\n py = controlPoints(y);\n for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) {\n this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]);\n }\n }\n }\n\n if (this._line || (this._line !== 0 && n === 1)) this._context.closePath();\n this._line = 1 - this._line;\n this._x = this._y = null;\n },\n point: function(x, y) {\n this._x.push(+x);\n this._y.push(+y);\n }\n};\n\n// See https://www.particleincell.com/2012/bezier-splines/ for derivation.\nfunction controlPoints(x) {\n var i,\n n = x.length - 1,\n m,\n a = new Array(n),\n b = new Array(n),\n r = new Array(n);\n a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1];\n for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1];\n a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n];\n for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1];\n a[n - 1] = r[n - 1] / b[n - 1];\n for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i];\n b[n - 1] = (x[n] + a[n - 1]) / 2;\n for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1];\n return [a, b];\n}\n\nexport default function(context) {\n return new Natural(context);\n}\n", "function Step(context, t) {\n this._context = context;\n this._t = t;\n}\n\nStep.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x = this._y = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y);\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; // falls through\n default: {\n if (this._t <= 0) {\n this._context.lineTo(this._x, y);\n this._context.lineTo(x, y);\n } else {\n var x1 = this._x * (1 - this._t) + x * this._t;\n this._context.lineTo(x1, this._y);\n this._context.lineTo(x1, y);\n }\n break;\n }\n }\n this._x = x, this._y = y;\n }\n};\n\nexport default function(context) {\n return new Step(context, 0.5);\n}\n\nexport function stepBefore(context) {\n return new Step(context, 0);\n}\n\nexport function stepAfter(context) {\n return new Step(context, 1);\n}\n", "export {default as arc} from \"./arc.js\";\nexport {default as area} from \"./area.js\";\nexport {default as line} from \"./line.js\";\nexport {default as pie} from \"./pie.js\";\nexport {default as areaRadial, default as radialArea} from \"./areaRadial.js\"; // Note: radialArea is deprecated!\nexport {default as lineRadial, default as radialLine} from \"./lineRadial.js\"; // Note: radialLine is deprecated!\nexport {default as pointRadial} from \"./pointRadial.js\";\nexport {link, linkHorizontal, linkVertical, linkRadial} from \"./link.js\";\n\nexport {default as symbol, symbolsStroke, symbolsFill, symbolsFill as symbols} from \"./symbol.js\";\nexport {default as symbolAsterisk} from \"./symbol/asterisk.js\";\nexport {default as symbolCircle} from \"./symbol/circle.js\";\nexport {default as symbolCross} from \"./symbol/cross.js\";\nexport {default as symbolDiamond} from \"./symbol/diamond.js\";\nexport {default as symbolDiamond2} from \"./symbol/diamond2.js\";\nexport {default as symbolPlus} from \"./symbol/plus.js\";\nexport {default as symbolSquare} from \"./symbol/square.js\";\nexport {default as symbolSquare2} from \"./symbol/square2.js\";\nexport {default as symbolStar} from \"./symbol/star.js\";\nexport {default as symbolTriangle} from \"./symbol/triangle.js\";\nexport {default as symbolTriangle2} from \"./symbol/triangle2.js\";\nexport {default as symbolWye} from \"./symbol/wye.js\";\nexport {default as symbolTimes, default as symbolX} from \"./symbol/times.js\";\n\nexport {default as curveBasisClosed} from \"./curve/basisClosed.js\";\nexport {default as curveBasisOpen} from \"./curve/basisOpen.js\";\nexport {default as curveBasis} from \"./curve/basis.js\";\nexport {bumpX as curveBumpX, bumpY as curveBumpY} from \"./curve/bump.js\";\nexport {default as curveBundle} from \"./curve/bundle.js\";\nexport {default as curveCardinalClosed} from \"./curve/cardinalClosed.js\";\nexport {default as curveCardinalOpen} from \"./curve/cardinalOpen.js\";\nexport {default as curveCardinal} from \"./curve/cardinal.js\";\nexport {default as curveCatmullRomClosed} from \"./curve/catmullRomClosed.js\";\nexport {default as curveCatmullRomOpen} from \"./curve/catmullRomOpen.js\";\nexport {default as curveCatmullRom} from \"./curve/catmullRom.js\";\nexport {default as curveLinearClosed} from \"./curve/linearClosed.js\";\nexport {default as curveLinear} from \"./curve/linear.js\";\nexport {monotoneX as curveMonotoneX, monotoneY as curveMonotoneY} from \"./curve/monotone.js\";\nexport {default as curveNatural} from \"./curve/natural.js\";\nexport {default as curveStep, stepAfter as curveStepAfter, stepBefore as curveStepBefore} from \"./curve/step.js\";\n\nexport {default as stack} from \"./stack.js\";\nexport {default as stackOffsetExpand} from \"./offset/expand.js\";\nexport {default as stackOffsetDiverging} from \"./offset/diverging.js\";\nexport {default as stackOffsetNone} from \"./offset/none.js\";\nexport {default as stackOffsetSilhouette} from \"./offset/silhouette.js\";\nexport {default as stackOffsetWiggle} from \"./offset/wiggle.js\";\nexport {default as stackOrderAppearance} from \"./order/appearance.js\";\nexport {default as stackOrderAscending} from \"./order/ascending.js\";\nexport {default as stackOrderDescending} from \"./order/descending.js\";\nexport {default as stackOrderInsideOut} from \"./order/insideOut.js\";\nexport {default as stackOrderNone} from \"./order/none.js\";\nexport {default as stackOrderReverse} from \"./order/reverse.js\";\n", "export default x => () => x;\n", "export default function ZoomEvent(type, {\n sourceEvent,\n target,\n transform,\n dispatch\n}) {\n Object.defineProperties(this, {\n type: {value: type, enumerable: true, configurable: true},\n sourceEvent: {value: sourceEvent, enumerable: true, configurable: true},\n target: {value: target, enumerable: true, configurable: true},\n transform: {value: transform, enumerable: true, configurable: true},\n _: {value: dispatch}\n });\n}\n", "export function Transform(k, x, y) {\n this.k = k;\n this.x = x;\n this.y = y;\n}\n\nTransform.prototype = {\n constructor: Transform,\n scale: function(k) {\n return k === 1 ? this : new Transform(this.k * k, this.x, this.y);\n },\n translate: function(x, y) {\n return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);\n },\n apply: function(point) {\n return [point[0] * this.k + this.x, point[1] * this.k + this.y];\n },\n applyX: function(x) {\n return x * this.k + this.x;\n },\n applyY: function(y) {\n return y * this.k + this.y;\n },\n invert: function(location) {\n return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];\n },\n invertX: function(x) {\n return (x - this.x) / this.k;\n },\n invertY: function(y) {\n return (y - this.y) / this.k;\n },\n rescaleX: function(x) {\n return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));\n },\n rescaleY: function(y) {\n return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));\n },\n toString: function() {\n return \"translate(\" + this.x + \",\" + this.y + \") scale(\" + this.k + \")\";\n }\n};\n\nexport var identity = new Transform(1, 0, 0);\n\ntransform.prototype = Transform.prototype;\n\nexport default function transform(node) {\n while (!node.__zoom) if (!(node = node.parentNode)) return identity;\n return node.__zoom;\n}\n", "export function nopropagation(event) {\n event.stopImmediatePropagation();\n}\n\nexport default function(event) {\n event.preventDefault();\n event.stopImmediatePropagation();\n}\n", "import {dispatch} from \"d3-dispatch\";\nimport {dragDisable, dragEnable} from \"d3-drag\";\nimport {interpolateZoom} from \"d3-interpolate\";\nimport {select, pointer} from \"d3-selection\";\nimport {interrupt} from \"d3-transition\";\nimport constant from \"./constant.js\";\nimport ZoomEvent from \"./event.js\";\nimport {Transform, identity} from \"./transform.js\";\nimport noevent, {nopropagation} from \"./noevent.js\";\n\n// Ignore right-click, since that should open the context menu.\n// except for pinch-to-zoom, which is sent as a wheel+ctrlKey event\nfunction defaultFilter(event) {\n return (!event.ctrlKey || event.type === 'wheel') && !event.button;\n}\n\nfunction defaultExtent() {\n var e = this;\n if (e instanceof SVGElement) {\n e = e.ownerSVGElement || e;\n if (e.hasAttribute(\"viewBox\")) {\n e = e.viewBox.baseVal;\n return [[e.x, e.y], [e.x + e.width, e.y + e.height]];\n }\n return [[0, 0], [e.width.baseVal.value, e.height.baseVal.value]];\n }\n return [[0, 0], [e.clientWidth, e.clientHeight]];\n}\n\nfunction defaultTransform() {\n return this.__zoom || identity;\n}\n\nfunction defaultWheelDelta(event) {\n return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 0.002) * (event.ctrlKey ? 10 : 1);\n}\n\nfunction defaultTouchable() {\n return navigator.maxTouchPoints || (\"ontouchstart\" in this);\n}\n\nfunction defaultConstrain(transform, extent, translateExtent) {\n var dx0 = transform.invertX(extent[0][0]) - translateExtent[0][0],\n dx1 = transform.invertX(extent[1][0]) - translateExtent[1][0],\n dy0 = transform.invertY(extent[0][1]) - translateExtent[0][1],\n dy1 = transform.invertY(extent[1][1]) - translateExtent[1][1];\n return transform.translate(\n dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),\n dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)\n );\n}\n\nexport default function() {\n var filter = defaultFilter,\n extent = defaultExtent,\n constrain = defaultConstrain,\n wheelDelta = defaultWheelDelta,\n touchable = defaultTouchable,\n scaleExtent = [0, Infinity],\n translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]],\n duration = 250,\n interpolate = interpolateZoom,\n listeners = dispatch(\"start\", \"zoom\", \"end\"),\n touchstarting,\n touchfirst,\n touchending,\n touchDelay = 500,\n wheelDelay = 150,\n clickDistance2 = 0,\n tapDistance = 10;\n\n function zoom(selection) {\n selection\n .property(\"__zoom\", defaultTransform)\n .on(\"wheel.zoom\", wheeled, {passive: false})\n .on(\"mousedown.zoom\", mousedowned)\n .on(\"dblclick.zoom\", dblclicked)\n .filter(touchable)\n .on(\"touchstart.zoom\", touchstarted)\n .on(\"touchmove.zoom\", touchmoved)\n .on(\"touchend.zoom touchcancel.zoom\", touchended)\n .style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\");\n }\n\n zoom.transform = function(collection, transform, point, event) {\n var selection = collection.selection ? collection.selection() : collection;\n selection.property(\"__zoom\", defaultTransform);\n if (collection !== selection) {\n schedule(collection, transform, point, event);\n } else {\n selection.interrupt().each(function() {\n gesture(this, arguments)\n .event(event)\n .start()\n .zoom(null, typeof transform === \"function\" ? transform.apply(this, arguments) : transform)\n .end();\n });\n }\n };\n\n zoom.scaleBy = function(selection, k, p, event) {\n zoom.scaleTo(selection, function() {\n var k0 = this.__zoom.k,\n k1 = typeof k === \"function\" ? k.apply(this, arguments) : k;\n return k0 * k1;\n }, p, event);\n };\n\n zoom.scaleTo = function(selection, k, p, event) {\n zoom.transform(selection, function() {\n var e = extent.apply(this, arguments),\n t0 = this.__zoom,\n p0 = p == null ? centroid(e) : typeof p === \"function\" ? p.apply(this, arguments) : p,\n p1 = t0.invert(p0),\n k1 = typeof k === \"function\" ? k.apply(this, arguments) : k;\n return constrain(translate(scale(t0, k1), p0, p1), e, translateExtent);\n }, p, event);\n };\n\n zoom.translateBy = function(selection, x, y, event) {\n zoom.transform(selection, function() {\n return constrain(this.__zoom.translate(\n typeof x === \"function\" ? x.apply(this, arguments) : x,\n typeof y === \"function\" ? y.apply(this, arguments) : y\n ), extent.apply(this, arguments), translateExtent);\n }, null, event);\n };\n\n zoom.translateTo = function(selection, x, y, p, event) {\n zoom.transform(selection, function() {\n var e = extent.apply(this, arguments),\n t = this.__zoom,\n p0 = p == null ? centroid(e) : typeof p === \"function\" ? p.apply(this, arguments) : p;\n return constrain(identity.translate(p0[0], p0[1]).scale(t.k).translate(\n typeof x === \"function\" ? -x.apply(this, arguments) : -x,\n typeof y === \"function\" ? -y.apply(this, arguments) : -y\n ), e, translateExtent);\n }, p, event);\n };\n\n function scale(transform, k) {\n k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k));\n return k === transform.k ? transform : new Transform(k, transform.x, transform.y);\n }\n\n function translate(transform, p0, p1) {\n var x = p0[0] - p1[0] * transform.k, y = p0[1] - p1[1] * transform.k;\n return x === transform.x && y === transform.y ? transform : new Transform(transform.k, x, y);\n }\n\n function centroid(extent) {\n return [(+extent[0][0] + +extent[1][0]) / 2, (+extent[0][1] + +extent[1][1]) / 2];\n }\n\n function schedule(transition, transform, point, event) {\n transition\n .on(\"start.zoom\", function() { gesture(this, arguments).event(event).start(); })\n .on(\"interrupt.zoom end.zoom\", function() { gesture(this, arguments).event(event).end(); })\n .tween(\"zoom\", function() {\n var that = this,\n args = arguments,\n g = gesture(that, args).event(event),\n e = extent.apply(that, args),\n p = point == null ? centroid(e) : typeof point === \"function\" ? point.apply(that, args) : point,\n w = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]),\n a = that.__zoom,\n b = typeof transform === \"function\" ? transform.apply(that, args) : transform,\n i = interpolate(a.invert(p).concat(w / a.k), b.invert(p).concat(w / b.k));\n return function(t) {\n if (t === 1) t = b; // Avoid rounding error on end.\n else { var l = i(t), k = w / l[2]; t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k); }\n g.zoom(null, t);\n };\n });\n }\n\n function gesture(that, args, clean) {\n return (!clean && that.__zooming) || new Gesture(that, args);\n }\n\n function Gesture(that, args) {\n this.that = that;\n this.args = args;\n this.active = 0;\n this.sourceEvent = null;\n this.extent = extent.apply(that, args);\n this.taps = 0;\n }\n\n Gesture.prototype = {\n event: function(event) {\n if (event) this.sourceEvent = event;\n return this;\n },\n start: function() {\n if (++this.active === 1) {\n this.that.__zooming = this;\n this.emit(\"start\");\n }\n return this;\n },\n zoom: function(key, transform) {\n if (this.mouse && key !== \"mouse\") this.mouse[1] = transform.invert(this.mouse[0]);\n if (this.touch0 && key !== \"touch\") this.touch0[1] = transform.invert(this.touch0[0]);\n if (this.touch1 && key !== \"touch\") this.touch1[1] = transform.invert(this.touch1[0]);\n this.that.__zoom = transform;\n this.emit(\"zoom\");\n return this;\n },\n end: function() {\n if (--this.active === 0) {\n delete this.that.__zooming;\n this.emit(\"end\");\n }\n return this;\n },\n emit: function(type) {\n var d = select(this.that).datum();\n listeners.call(\n type,\n this.that,\n new ZoomEvent(type, {\n sourceEvent: this.sourceEvent,\n target: zoom,\n type,\n transform: this.that.__zoom,\n dispatch: listeners\n }),\n d\n );\n }\n };\n\n function wheeled(event, ...args) {\n if (!filter.apply(this, arguments)) return;\n var g = gesture(this, args).event(event),\n t = this.__zoom,\n k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta.apply(this, arguments)))),\n p = pointer(event);\n\n // If the mouse is in the same location as before, reuse it.\n // If there were recent wheel events, reset the wheel idle timeout.\n if (g.wheel) {\n if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) {\n g.mouse[1] = t.invert(g.mouse[0] = p);\n }\n clearTimeout(g.wheel);\n }\n\n // If this wheel event won\u2019t trigger a transform change, ignore it.\n else if (t.k === k) return;\n\n // Otherwise, capture the mouse point and location at the start.\n else {\n g.mouse = [p, t.invert(p)];\n interrupt(this);\n g.start();\n }\n\n noevent(event);\n g.wheel = setTimeout(wheelidled, wheelDelay);\n g.zoom(\"mouse\", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));\n\n function wheelidled() {\n g.wheel = null;\n g.end();\n }\n }\n\n function mousedowned(event, ...args) {\n if (touchending || !filter.apply(this, arguments)) return;\n var currentTarget = event.currentTarget,\n g = gesture(this, args, true).event(event),\n v = select(event.view).on(\"mousemove.zoom\", mousemoved, true).on(\"mouseup.zoom\", mouseupped, true),\n p = pointer(event, currentTarget),\n x0 = event.clientX,\n y0 = event.clientY;\n\n dragDisable(event.view);\n nopropagation(event);\n g.mouse = [p, this.__zoom.invert(p)];\n interrupt(this);\n g.start();\n\n function mousemoved(event) {\n noevent(event);\n if (!g.moved) {\n var dx = event.clientX - x0, dy = event.clientY - y0;\n g.moved = dx * dx + dy * dy > clickDistance2;\n }\n g.event(event)\n .zoom(\"mouse\", constrain(translate(g.that.__zoom, g.mouse[0] = pointer(event, currentTarget), g.mouse[1]), g.extent, translateExtent));\n }\n\n function mouseupped(event) {\n v.on(\"mousemove.zoom mouseup.zoom\", null);\n dragEnable(event.view, g.moved);\n noevent(event);\n g.event(event).end();\n }\n }\n\n function dblclicked(event, ...args) {\n if (!filter.apply(this, arguments)) return;\n var t0 = this.__zoom,\n p0 = pointer(event.changedTouches ? event.changedTouches[0] : event, this),\n p1 = t0.invert(p0),\n k1 = t0.k * (event.shiftKey ? 0.5 : 2),\n t1 = constrain(translate(scale(t0, k1), p0, p1), extent.apply(this, args), translateExtent);\n\n noevent(event);\n if (duration > 0) select(this).transition().duration(duration).call(schedule, t1, p0, event);\n else select(this).call(zoom.transform, t1, p0, event);\n }\n\n function touchstarted(event, ...args) {\n if (!filter.apply(this, arguments)) return;\n var touches = event.touches,\n n = touches.length,\n g = gesture(this, args, event.changedTouches.length === n).event(event),\n started, i, t, p;\n\n nopropagation(event);\n for (i = 0; i < n; ++i) {\n t = touches[i], p = pointer(t, this);\n p = [p, this.__zoom.invert(p), t.identifier];\n if (!g.touch0) g.touch0 = p, started = true, g.taps = 1 + !!touchstarting;\n else if (!g.touch1 && g.touch0[2] !== p[2]) g.touch1 = p, g.taps = 0;\n }\n\n if (touchstarting) touchstarting = clearTimeout(touchstarting);\n\n if (started) {\n if (g.taps < 2) touchfirst = p[0], touchstarting = setTimeout(function() { touchstarting = null; }, touchDelay);\n interrupt(this);\n g.start();\n }\n }\n\n function touchmoved(event, ...args) {\n if (!this.__zooming) return;\n var g = gesture(this, args).event(event),\n touches = event.changedTouches,\n n = touches.length, i, t, p, l;\n\n noevent(event);\n for (i = 0; i < n; ++i) {\n t = touches[i], p = pointer(t, this);\n if (g.touch0 && g.touch0[2] === t.identifier) g.touch0[0] = p;\n else if (g.touch1 && g.touch1[2] === t.identifier) g.touch1[0] = p;\n }\n t = g.that.__zoom;\n if (g.touch1) {\n var p0 = g.touch0[0], l0 = g.touch0[1],\n p1 = g.touch1[0], l1 = g.touch1[1],\n dp = (dp = p1[0] - p0[0]) * dp + (dp = p1[1] - p0[1]) * dp,\n dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl;\n t = scale(t, Math.sqrt(dp / dl));\n p = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2];\n l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];\n }\n else if (g.touch0) p = g.touch0[0], l = g.touch0[1];\n else return;\n\n g.zoom(\"touch\", constrain(translate(t, p, l), g.extent, translateExtent));\n }\n\n function touchended(event, ...args) {\n if (!this.__zooming) return;\n var g = gesture(this, args).event(event),\n touches = event.changedTouches,\n n = touches.length, i, t;\n\n nopropagation(event);\n if (touchending) clearTimeout(touchending);\n touchending = setTimeout(function() { touchending = null; }, touchDelay);\n for (i = 0; i < n; ++i) {\n t = touches[i];\n if (g.touch0 && g.touch0[2] === t.identifier) delete g.touch0;\n else if (g.touch1 && g.touch1[2] === t.identifier) delete g.touch1;\n }\n if (g.touch1 && !g.touch0) g.touch0 = g.touch1, delete g.touch1;\n if (g.touch0) g.touch0[1] = this.__zoom.invert(g.touch0[0]);\n else {\n g.end();\n // If this was a dbltap, reroute to the (optional) dblclick.zoom handler.\n if (g.taps === 2) {\n t = pointer(t, this);\n if (Math.hypot(touchfirst[0] - t[0], touchfirst[1] - t[1]) < tapDistance) {\n var p = select(this).on(\"dblclick.zoom\");\n if (p) p.apply(this, arguments);\n }\n }\n }\n }\n\n zoom.wheelDelta = function(_) {\n return arguments.length ? (wheelDelta = typeof _ === \"function\" ? _ : constant(+_), zoom) : wheelDelta;\n };\n\n zoom.filter = function(_) {\n return arguments.length ? (filter = typeof _ === \"function\" ? _ : constant(!!_), zoom) : filter;\n };\n\n zoom.touchable = function(_) {\n return arguments.length ? (touchable = typeof _ === \"function\" ? _ : constant(!!_), zoom) : touchable;\n };\n\n zoom.extent = function(_) {\n return arguments.length ? (extent = typeof _ === \"function\" ? _ : constant([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;\n };\n\n zoom.scaleExtent = function(_) {\n return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom) : [scaleExtent[0], scaleExtent[1]];\n };\n\n zoom.translateExtent = function(_) {\n return arguments.length ? (translateExtent[0][0] = +_[0][0], translateExtent[1][0] = +_[1][0], translateExtent[0][1] = +_[0][1], translateExtent[1][1] = +_[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];\n };\n\n zoom.constrain = function(_) {\n return arguments.length ? (constrain = _, zoom) : constrain;\n };\n\n zoom.duration = function(_) {\n return arguments.length ? (duration = +_, zoom) : duration;\n };\n\n zoom.interpolate = function(_) {\n return arguments.length ? (interpolate = _, zoom) : interpolate;\n };\n\n zoom.on = function() {\n var value = listeners.on.apply(listeners, arguments);\n return value === listeners ? zoom : value;\n };\n\n zoom.clickDistance = function(_) {\n return arguments.length ? (clickDistance2 = (_ = +_) * _, zoom) : Math.sqrt(clickDistance2);\n };\n\n zoom.tapDistance = function(_) {\n return arguments.length ? (tapDistance = +_, zoom) : tapDistance;\n };\n\n return zoom;\n}\n", "export {default as zoom} from \"./zoom.js\";\nexport {default as zoomTransform, identity as zoomIdentity, Transform as ZoomTransform} from \"./transform.js\";\n", "export * from \"d3-array\";\nexport * from \"d3-axis\";\nexport * from \"d3-brush\";\nexport * from \"d3-chord\";\nexport * from \"d3-color\";\nexport * from \"d3-contour\";\nexport * from \"d3-delaunay\";\nexport * from \"d3-dispatch\";\nexport * from \"d3-drag\";\nexport * from \"d3-dsv\";\nexport * from \"d3-ease\";\nexport * from \"d3-fetch\";\nexport * from \"d3-force\";\nexport * from \"d3-format\";\nexport * from \"d3-geo\";\nexport * from \"d3-hierarchy\";\nexport * from \"d3-interpolate\";\nexport * from \"d3-path\";\nexport * from \"d3-polygon\";\nexport * from \"d3-quadtree\";\nexport * from \"d3-random\";\nexport * from \"d3-scale\";\nexport * from \"d3-scale-chromatic\";\nexport * from \"d3-selection\";\nexport * from \"d3-shape\";\nexport * from \"d3-time\";\nexport * from \"d3-time-format\";\nexport * from \"d3-timer\";\nexport * from \"d3-transition\";\nexport * from \"d3-zoom\";\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.BLANK_URL = exports.relativeFirstCharacters = exports.whitespaceEscapeCharsRegex = exports.urlSchemeRegex = exports.ctrlCharactersRegex = exports.htmlCtrlEntityRegex = exports.htmlEntitiesRegex = exports.invalidProtocolRegex = void 0;\nexports.invalidProtocolRegex = /^([^\\w]*)(javascript|data|vbscript)/im;\nexports.htmlEntitiesRegex = /(\\w+)(^\\w|;)?/g;\nexports.htmlCtrlEntityRegex = /&(newline|tab);/gi;\nexports.ctrlCharactersRegex = /[\\u0000-\\u001F\\u007F-\\u009F\\u2000-\\u200D\\uFEFF]/gim;\nexports.urlSchemeRegex = /^.+(:|:)/gim;\nexports.whitespaceEscapeCharsRegex = /(\\\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g;\nexports.relativeFirstCharacters = [\".\", \"/\"];\nexports.BLANK_URL = \"about:blank\";\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.sanitizeUrl = void 0;\nvar constants_1 = require(\"./constants\");\nfunction isRelativeUrlWithoutProtocol(url) {\n return constants_1.relativeFirstCharacters.indexOf(url[0]) > -1;\n}\nfunction decodeHtmlCharacters(str) {\n var removedNullByte = str.replace(constants_1.ctrlCharactersRegex, \"\");\n return removedNullByte.replace(constants_1.htmlEntitiesRegex, function (match, dec) {\n return String.fromCharCode(dec);\n });\n}\nfunction isValidUrl(url) {\n return URL.canParse(url);\n}\nfunction decodeURI(uri) {\n try {\n return decodeURIComponent(uri);\n }\n catch (e) {\n // Ignoring error\n // It is possible that the URI contains a `%` not associated\n // with URI/URL-encoding.\n return uri;\n }\n}\nfunction sanitizeUrl(url) {\n if (!url) {\n return constants_1.BLANK_URL;\n }\n var charsToDecode;\n var decodedUrl = decodeURI(url.trim());\n do {\n decodedUrl = decodeHtmlCharacters(decodedUrl)\n .replace(constants_1.htmlCtrlEntityRegex, \"\")\n .replace(constants_1.ctrlCharactersRegex, \"\")\n .replace(constants_1.whitespaceEscapeCharsRegex, \"\")\n .trim();\n decodedUrl = decodeURI(decodedUrl);\n charsToDecode =\n decodedUrl.match(constants_1.ctrlCharactersRegex) ||\n decodedUrl.match(constants_1.htmlEntitiesRegex) ||\n decodedUrl.match(constants_1.htmlCtrlEntityRegex) ||\n decodedUrl.match(constants_1.whitespaceEscapeCharsRegex);\n } while (charsToDecode && charsToDecode.length > 0);\n var sanitizedUrl = decodedUrl;\n if (!sanitizedUrl) {\n return constants_1.BLANK_URL;\n }\n if (isRelativeUrlWithoutProtocol(sanitizedUrl)) {\n return sanitizedUrl;\n }\n // Remove any leading whitespace before checking the URL scheme\n var trimmedUrl = sanitizedUrl.trimStart();\n var urlSchemeParseResults = trimmedUrl.match(constants_1.urlSchemeRegex);\n if (!urlSchemeParseResults) {\n return sanitizedUrl;\n }\n var urlScheme = urlSchemeParseResults[0].toLowerCase().trim();\n if (constants_1.invalidProtocolRegex.test(urlScheme)) {\n return constants_1.BLANK_URL;\n }\n var backSanitized = trimmedUrl.replace(/\\\\/g, \"/\");\n // Handle special cases for mailto: and custom deep-link protocols\n if (urlScheme === \"mailto:\" || urlScheme.includes(\"://\")) {\n return backSanitized;\n }\n // For http and https URLs, perform additional validation\n if (urlScheme === \"http:\" || urlScheme === \"https:\") {\n if (!isValidUrl(backSanitized)) {\n return constants_1.BLANK_URL;\n }\n var url_1 = new URL(backSanitized);\n url_1.protocol = url_1.protocol.toLowerCase();\n url_1.hostname = url_1.hostname.toLowerCase();\n return url_1.toString();\n }\n return backSanitized;\n}\nexports.sanitizeUrl = sanitizeUrl;\n", "import { sanitizeUrl } from '@braintree/sanitize-url';\nimport type { SVG, SVGGroup } from '../../diagram-api/types.js';\nimport { lineBreakRegex } from './common.js';\nimport type {\n Bound,\n D3ImageElement,\n D3RectElement,\n D3TSpanElement,\n D3TextElement,\n D3UseElement,\n RectData,\n TextData,\n TextObject,\n} from './commonTypes.js';\n\nexport const drawRect = (element: SVG | SVGGroup, rectData: RectData): D3RectElement => {\n const rectElement: D3RectElement = element.append('rect');\n rectElement.attr('x', rectData.x);\n rectElement.attr('y', rectData.y);\n rectElement.attr('fill', rectData.fill);\n rectElement.attr('stroke', rectData.stroke);\n rectElement.attr('width', rectData.width);\n rectElement.attr('height', rectData.height);\n if (rectData.name) {\n rectElement.attr('name', rectData.name);\n }\n if (rectData.rx) {\n rectElement.attr('rx', rectData.rx);\n }\n if (rectData.ry) {\n rectElement.attr('ry', rectData.ry);\n }\n\n if (rectData.attrs !== undefined) {\n for (const attrKey in rectData.attrs) {\n rectElement.attr(attrKey, rectData.attrs[attrKey]);\n }\n }\n\n if (rectData.class) {\n rectElement.attr('class', rectData.class);\n }\n\n return rectElement;\n};\n\n/**\n * Draws a background rectangle\n *\n * @param element - Diagram (reference for bounds)\n * @param bounds - Shape of the rectangle\n */\nexport const drawBackgroundRect = (element: SVG | SVGGroup, bounds: Bound): void => {\n const rectData: RectData = {\n x: bounds.startx,\n y: bounds.starty,\n width: bounds.stopx - bounds.startx,\n height: bounds.stopy - bounds.starty,\n fill: bounds.fill,\n stroke: bounds.stroke,\n class: 'rect',\n };\n const rectElement: D3RectElement = drawRect(element, rectData);\n rectElement.lower();\n};\n\nexport const drawText = (element: SVG | SVGGroup, textData: TextData): D3TextElement => {\n const nText: string = textData.text.replace(lineBreakRegex, ' ');\n\n const textElem: D3TextElement = element.append('text');\n textElem.attr('x', textData.x);\n textElem.attr('y', textData.y);\n textElem.attr('class', 'legend');\n\n textElem.style('text-anchor', textData.anchor);\n if (textData.class) {\n textElem.attr('class', textData.class);\n }\n\n const tspan: D3TSpanElement = textElem.append('tspan');\n tspan.attr('x', textData.x + textData.textMargin * 2);\n tspan.text(nText);\n\n return textElem;\n};\n\nexport const drawImage = (elem: SVG | SVGGroup, x: number, y: number, link: string): void => {\n const imageElement: D3ImageElement = elem.append('image');\n imageElement.attr('x', x);\n imageElement.attr('y', y);\n const sanitizedLink: string = sanitizeUrl(link);\n imageElement.attr('xlink:href', sanitizedLink);\n};\n\nexport const drawEmbeddedImage = (\n element: SVG | SVGGroup,\n x: number,\n y: number,\n link: string\n): void => {\n const imageElement: D3UseElement = element.append('use');\n imageElement.attr('x', x);\n imageElement.attr('y', y);\n const sanitizedLink: string = sanitizeUrl(link);\n imageElement.attr('xlink:href', `#${sanitizedLink}`);\n};\n\nexport const getNoteRect = (): RectData => {\n const noteRectData: RectData = {\n x: 0,\n y: 0,\n width: 100,\n height: 100,\n fill: '#EDF2AE',\n stroke: '#666',\n anchor: 'start',\n rx: 0,\n ry: 0,\n };\n return noteRectData;\n};\n\nexport const getTextObj = (): TextObject => {\n const testObject: TextObject = {\n x: 0,\n y: 0,\n width: 100,\n height: 100,\n 'text-anchor': 'start',\n style: '#666',\n textMargin: 0,\n rx: 0,\n ry: 0,\n tspan: true,\n };\n return testObject;\n};\n", "import common from '../common/common.js';\nimport * as svgDrawCommon from '../common/svgDrawCommon.js';\nimport { sanitizeUrl } from '@braintree/sanitize-url';\n\nexport const drawRect = function (elem, rectData) {\n return svgDrawCommon.drawRect(elem, rectData);\n};\n\nexport const drawImage = function (elem, width, height, x, y, link) {\n const imageElem = elem.append('image');\n imageElem.attr('width', width);\n imageElem.attr('height', height);\n imageElem.attr('x', x);\n imageElem.attr('y', y);\n let sanitizedLink = link.startsWith('data:image/png;base64') ? link : sanitizeUrl(link);\n imageElem.attr('xlink:href', sanitizedLink);\n};\n\nexport const drawRels = (elem, rels, conf) => {\n const relsElem = elem.append('g');\n let i = 0;\n for (let rel of rels) {\n let textColor = rel.textColor ? rel.textColor : '#444444';\n let strokeColor = rel.lineColor ? rel.lineColor : '#444444';\n let offsetX = rel.offsetX ? parseInt(rel.offsetX) : 0;\n let offsetY = rel.offsetY ? parseInt(rel.offsetY) : 0;\n\n let url = '';\n if (i === 0) {\n let line = relsElem.append('line');\n line.attr('x1', rel.startPoint.x);\n line.attr('y1', rel.startPoint.y);\n line.attr('x2', rel.endPoint.x);\n line.attr('y2', rel.endPoint.y);\n\n line.attr('stroke-width', '1');\n line.attr('stroke', strokeColor);\n line.style('fill', 'none');\n if (rel.type !== 'rel_b') {\n line.attr('marker-end', 'url(' + url + '#arrowhead)');\n }\n if (rel.type === 'birel' || rel.type === 'rel_b') {\n line.attr('marker-start', 'url(' + url + '#arrowend)');\n }\n i = -1;\n } else {\n let line = relsElem.append('path');\n line\n .attr('fill', 'none')\n .attr('stroke-width', '1')\n .attr('stroke', strokeColor)\n .attr(\n 'd',\n 'Mstartx,starty Qcontrolx,controly stopx,stopy '\n .replaceAll('startx', rel.startPoint.x)\n .replaceAll('starty', rel.startPoint.y)\n .replaceAll(\n 'controlx',\n rel.startPoint.x +\n (rel.endPoint.x - rel.startPoint.x) / 2 -\n (rel.endPoint.x - rel.startPoint.x) / 4\n )\n .replaceAll('controly', rel.startPoint.y + (rel.endPoint.y - rel.startPoint.y) / 2)\n .replaceAll('stopx', rel.endPoint.x)\n .replaceAll('stopy', rel.endPoint.y)\n );\n if (rel.type !== 'rel_b') {\n line.attr('marker-end', 'url(' + url + '#arrowhead)');\n }\n if (rel.type === 'birel' || rel.type === 'rel_b') {\n line.attr('marker-start', 'url(' + url + '#arrowend)');\n }\n }\n\n let messageConf = conf.messageFont();\n _drawTextCandidateFunc(conf)(\n rel.label.text,\n relsElem,\n Math.min(rel.startPoint.x, rel.endPoint.x) +\n Math.abs(rel.endPoint.x - rel.startPoint.x) / 2 +\n offsetX,\n Math.min(rel.startPoint.y, rel.endPoint.y) +\n Math.abs(rel.endPoint.y - rel.startPoint.y) / 2 +\n offsetY,\n rel.label.width,\n rel.label.height,\n { fill: textColor },\n messageConf\n );\n\n if (rel.techn && rel.techn.text !== '') {\n messageConf = conf.messageFont();\n _drawTextCandidateFunc(conf)(\n '[' + rel.techn.text + ']',\n relsElem,\n Math.min(rel.startPoint.x, rel.endPoint.x) +\n Math.abs(rel.endPoint.x - rel.startPoint.x) / 2 +\n offsetX,\n Math.min(rel.startPoint.y, rel.endPoint.y) +\n Math.abs(rel.endPoint.y - rel.startPoint.y) / 2 +\n conf.messageFontSize +\n 5 +\n offsetY,\n Math.max(rel.label.width, rel.techn.width),\n rel.techn.height,\n { fill: textColor, 'font-style': 'italic' },\n messageConf\n );\n }\n }\n};\n\n/**\n * Draws an boundary in the diagram\n *\n * @param {any} elem - The diagram we'll draw to.\n * @param {any} boundary - The boundary to draw.\n * @param {any} conf - DrawText implementation discriminator object\n */\nconst drawBoundary = function (elem, boundary, conf) {\n const boundaryElem = elem.append('g');\n\n let fillColor = boundary.bgColor ? boundary.bgColor : 'none';\n let strokeColor = boundary.borderColor ? boundary.borderColor : '#444444';\n let fontColor = boundary.fontColor ? boundary.fontColor : 'black';\n\n let attrsValue = { 'stroke-width': 1.0, 'stroke-dasharray': '7.0,7.0' };\n if (boundary.nodeType) {\n attrsValue = { 'stroke-width': 1.0 };\n }\n let rectData = {\n x: boundary.x,\n y: boundary.y,\n fill: fillColor,\n stroke: strokeColor,\n width: boundary.width,\n height: boundary.height,\n rx: 2.5,\n ry: 2.5,\n attrs: attrsValue,\n };\n\n drawRect(boundaryElem, rectData);\n\n // draw label\n let boundaryConf = conf.boundaryFont();\n boundaryConf.fontWeight = 'bold';\n boundaryConf.fontSize = boundaryConf.fontSize + 2;\n boundaryConf.fontColor = fontColor;\n _drawTextCandidateFunc(conf)(\n boundary.label.text,\n boundaryElem,\n boundary.x,\n boundary.y + boundary.label.Y,\n boundary.width,\n boundary.height,\n { fill: '#444444' },\n boundaryConf\n );\n\n // draw type\n if (boundary.type && boundary.type.text !== '') {\n boundaryConf = conf.boundaryFont();\n boundaryConf.fontColor = fontColor;\n _drawTextCandidateFunc(conf)(\n boundary.type.text,\n boundaryElem,\n boundary.x,\n boundary.y + boundary.type.Y,\n boundary.width,\n boundary.height,\n { fill: '#444444' },\n boundaryConf\n );\n }\n\n // draw descr\n if (boundary.descr && boundary.descr.text !== '') {\n boundaryConf = conf.boundaryFont();\n boundaryConf.fontSize = boundaryConf.fontSize - 2;\n boundaryConf.fontColor = fontColor;\n _drawTextCandidateFunc(conf)(\n boundary.descr.text,\n boundaryElem,\n boundary.x,\n boundary.y + boundary.descr.Y,\n boundary.width,\n boundary.height,\n { fill: '#444444' },\n boundaryConf\n );\n }\n};\n\nexport const drawC4Shape = function (elem, c4Shape, conf) {\n let fillColor = c4Shape.bgColor ? c4Shape.bgColor : conf[c4Shape.typeC4Shape.text + '_bg_color'];\n let strokeColor = c4Shape.borderColor\n ? c4Shape.borderColor\n : conf[c4Shape.typeC4Shape.text + '_border_color'];\n let fontColor = c4Shape.fontColor ? c4Shape.fontColor : '#FFFFFF';\n\n let personImg =\n 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=';\n switch (c4Shape.typeC4Shape.text) {\n case 'person':\n personImg =\n 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=';\n break;\n case 'external_person':\n personImg =\n 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAB6ElEQVR4Xu2YLY+EMBCG9+dWr0aj0Wg0Go1Go0+j8Xdv2uTCvv1gpt0ebHKPuhDaeW4605Z9mJvx4AdXUyTUdd08z+u6flmWZRnHsWkafk9DptAwDPu+f0eAYtu2PEaGWuj5fCIZrBAC2eLBAnRCsEkkxmeaJp7iDJ2QMDdHsLg8SxKFEJaAo8lAXnmuOFIhTMpxxKATebo4UiFknuNo4OniSIXQyRxEA3YsnjGCVEjVXD7yLUAqxBGUyPv/Y4W2beMgGuS7kVQIBycH0fD+oi5pezQETxdHKmQKGk1eQEYldK+jw5GxPfZ9z7Mk0Qnhf1W1m3w//EUn5BDmSZsbR44QQLBEqrBHqOrmSKaQAxdnLArCrxZcM7A7ZKs4ioRq8LFC+NpC3WCBJsvpVw5edm9iEXFuyNfxXAgSwfrFQ1c0iNda8AdejvUgnktOtJQQxmcfFzGglc5WVCj7oDgFqU18boeFSs52CUh8LE8BIVQDT1ABrB0HtgSEYlX5doJnCwv9TXocKCaKbnwhdDKPq4lf3SwU3HLq4V/+WYhHVMa/3b4IlfyikAduCkcBc7mQ3/z/Qq/cTuikhkzB12Ae/mcJC9U+Vo8Ej1gWAtgbeGgFsAMHr50BIWOLCbezvhpBFUdY6EJuJ/QDW0XoMX60zZ0AAAAASUVORK5CYII=';\n break;\n }\n\n const c4ShapeElem = elem.append('g');\n c4ShapeElem.attr('class', 'person-man');\n\n // \n // draw rect of c4Shape\n const rect = svgDrawCommon.getNoteRect();\n\n switch (c4Shape.typeC4Shape.text) {\n case 'person':\n case 'external_person':\n case 'system':\n case 'external_system':\n case 'container':\n case 'external_container':\n case 'component':\n case 'external_component':\n rect.x = c4Shape.x;\n rect.y = c4Shape.y;\n rect.fill = fillColor;\n rect.width = c4Shape.width;\n rect.height = c4Shape.height;\n rect.stroke = strokeColor;\n rect.rx = 2.5;\n rect.ry = 2.5;\n rect.attrs = { 'stroke-width': 0.5 };\n drawRect(c4ShapeElem, rect);\n break;\n case 'system_db':\n case 'external_system_db':\n case 'container_db':\n case 'external_container_db':\n case 'component_db':\n case 'external_component_db':\n c4ShapeElem\n .append('path')\n .attr('fill', fillColor)\n .attr('stroke-width', '0.5')\n .attr('stroke', strokeColor)\n .attr(\n 'd',\n 'Mstartx,startyc0,-10 half,-10 half,-10c0,0 half,0 half,10l0,heightc0,10 -half,10 -half,10c0,0 -half,0 -half,-10l0,-height'\n .replaceAll('startx', c4Shape.x)\n .replaceAll('starty', c4Shape.y)\n .replaceAll('half', c4Shape.width / 2)\n .replaceAll('height', c4Shape.height)\n );\n c4ShapeElem\n .append('path')\n .attr('fill', 'none')\n .attr('stroke-width', '0.5')\n .attr('stroke', strokeColor)\n .attr(\n 'd',\n 'Mstartx,startyc0,10 half,10 half,10c0,0 half,0 half,-10'\n .replaceAll('startx', c4Shape.x)\n .replaceAll('starty', c4Shape.y)\n .replaceAll('half', c4Shape.width / 2)\n );\n break;\n case 'system_queue':\n case 'external_system_queue':\n case 'container_queue':\n case 'external_container_queue':\n case 'component_queue':\n case 'external_component_queue':\n c4ShapeElem\n .append('path')\n .attr('fill', fillColor)\n .attr('stroke-width', '0.5')\n .attr('stroke', strokeColor)\n .attr(\n 'd',\n 'Mstartx,startylwidth,0c5,0 5,half 5,halfc0,0 0,half -5,halfl-width,0c-5,0 -5,-half -5,-halfc0,0 0,-half 5,-half'\n .replaceAll('startx', c4Shape.x)\n .replaceAll('starty', c4Shape.y)\n .replaceAll('width', c4Shape.width)\n .replaceAll('half', c4Shape.height / 2)\n );\n c4ShapeElem\n .append('path')\n .attr('fill', 'none')\n .attr('stroke-width', '0.5')\n .attr('stroke', strokeColor)\n .attr(\n 'd',\n 'Mstartx,startyc-5,0 -5,half -5,halfc0,half 5,half 5,half'\n .replaceAll('startx', c4Shape.x + c4Shape.width)\n .replaceAll('starty', c4Shape.y)\n .replaceAll('half', c4Shape.height / 2)\n );\n break;\n }\n\n // draw type of c4Shape\n let c4ShapeFontConf = getC4ShapeFont(conf, c4Shape.typeC4Shape.text);\n c4ShapeElem\n .append('text')\n .attr('fill', fontColor)\n .attr('font-family', c4ShapeFontConf.fontFamily)\n .attr('font-size', c4ShapeFontConf.fontSize - 2)\n .attr('font-style', 'italic')\n .attr('lengthAdjust', 'spacing')\n .attr('textLength', c4Shape.typeC4Shape.width)\n .attr('x', c4Shape.x + c4Shape.width / 2 - c4Shape.typeC4Shape.width / 2)\n .attr('y', c4Shape.y + c4Shape.typeC4Shape.Y)\n .text('<<' + c4Shape.typeC4Shape.text + '>>');\n\n // draw image/sprite\n switch (c4Shape.typeC4Shape.text) {\n case 'person':\n case 'external_person':\n drawImage(\n c4ShapeElem,\n 48,\n 48,\n c4Shape.x + c4Shape.width / 2 - 24,\n c4Shape.y + c4Shape.image.Y,\n personImg\n );\n break;\n }\n\n // draw label\n let textFontConf = conf[c4Shape.typeC4Shape.text + 'Font']();\n textFontConf.fontWeight = 'bold';\n textFontConf.fontSize = textFontConf.fontSize + 2;\n textFontConf.fontColor = fontColor;\n _drawTextCandidateFunc(conf)(\n c4Shape.label.text,\n c4ShapeElem,\n c4Shape.x,\n c4Shape.y + c4Shape.label.Y,\n c4Shape.width,\n c4Shape.height,\n { fill: fontColor },\n textFontConf\n );\n\n // draw techn/type\n textFontConf = conf[c4Shape.typeC4Shape.text + 'Font']();\n textFontConf.fontColor = fontColor;\n\n if (c4Shape.techn && c4Shape.techn?.text !== '') {\n _drawTextCandidateFunc(conf)(\n c4Shape.techn.text,\n c4ShapeElem,\n c4Shape.x,\n c4Shape.y + c4Shape.techn.Y,\n c4Shape.width,\n c4Shape.height,\n { fill: fontColor, 'font-style': 'italic' },\n textFontConf\n );\n } else if (c4Shape.type && c4Shape.type.text !== '') {\n _drawTextCandidateFunc(conf)(\n c4Shape.type.text,\n c4ShapeElem,\n c4Shape.x,\n c4Shape.y + c4Shape.type.Y,\n c4Shape.width,\n c4Shape.height,\n { fill: fontColor, 'font-style': 'italic' },\n textFontConf\n );\n }\n\n // draw descr\n if (c4Shape.descr && c4Shape.descr.text !== '') {\n textFontConf = conf.personFont();\n textFontConf.fontColor = fontColor;\n _drawTextCandidateFunc(conf)(\n c4Shape.descr.text,\n c4ShapeElem,\n c4Shape.x,\n c4Shape.y + c4Shape.descr.Y,\n c4Shape.width,\n c4Shape.height,\n { fill: fontColor },\n textFontConf\n );\n }\n\n return c4Shape.height;\n};\n\nexport const insertDatabaseIcon = function (elem) {\n elem\n .append('defs')\n .append('symbol')\n .attr('id', 'database')\n .attr('fill-rule', 'evenodd')\n .attr('clip-rule', 'evenodd')\n .append('path')\n .attr('transform', 'scale(.5)')\n .attr(\n 'd',\n 'M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z'\n );\n};\n\nexport const insertComputerIcon = function (elem) {\n elem\n .append('defs')\n .append('symbol')\n .attr('id', 'computer')\n .attr('width', '24')\n .attr('height', '24')\n .append('path')\n .attr('transform', 'scale(.5)')\n .attr(\n 'd',\n 'M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z'\n );\n};\n\nexport const insertClockIcon = function (elem) {\n elem\n .append('defs')\n .append('symbol')\n .attr('id', 'clock')\n .attr('width', '24')\n .attr('height', '24')\n .append('path')\n .attr('transform', 'scale(.5)')\n .attr(\n 'd',\n 'M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z'\n );\n};\n\n/**\n * Setup arrow head and define the marker. The result is appended to the svg.\n *\n * @param elem\n */\nexport const insertArrowHead = function (elem) {\n elem\n .append('defs')\n .append('marker')\n .attr('id', 'arrowhead')\n .attr('refX', 9)\n .attr('refY', 5)\n .attr('markerUnits', 'userSpaceOnUse')\n .attr('markerWidth', 12)\n .attr('markerHeight', 12)\n .attr('orient', 'auto')\n .append('path')\n .attr('d', 'M 0 0 L 10 5 L 0 10 z'); // this is actual shape for arrowhead\n};\n\nexport const insertArrowEnd = function (elem) {\n elem\n .append('defs')\n .append('marker')\n .attr('id', 'arrowend')\n .attr('refX', 1)\n .attr('refY', 5)\n .attr('markerUnits', 'userSpaceOnUse')\n .attr('markerWidth', 12)\n .attr('markerHeight', 12)\n .attr('orient', 'auto')\n .append('path')\n .attr('d', 'M 10 0 L 0 5 L 10 10 z'); // this is actual shape for arrowhead\n};\n\n/**\n * Setup arrow head and define the marker. The result is appended to the svg.\n *\n * @param {any} elem\n */\nexport const insertArrowFilledHead = function (elem) {\n elem\n .append('defs')\n .append('marker')\n .attr('id', 'filled-head')\n .attr('refX', 18)\n .attr('refY', 7)\n .attr('markerWidth', 20)\n .attr('markerHeight', 28)\n .attr('orient', 'auto')\n .append('path')\n .attr('d', 'M 18,7 L9,13 L14,7 L9,1 Z');\n};\n\n/**\n * Setup node number. The result is appended to the svg.\n *\n * @param {any} elem\n */\nexport const insertDynamicNumber = function (elem) {\n elem\n .append('defs')\n .append('marker')\n .attr('id', 'sequencenumber')\n .attr('refX', 15)\n .attr('refY', 15)\n .attr('markerWidth', 60)\n .attr('markerHeight', 40)\n .attr('orient', 'auto')\n .append('circle')\n .attr('cx', 15)\n .attr('cy', 15)\n .attr('r', 6);\n // .style(\"fill\", '#f00');\n};\n\n/**\n * Setup arrow head and define the marker. The result is appended to the svg.\n *\n * @param {any} elem\n */\nexport const insertArrowCrossHead = function (elem) {\n const defs = elem.append('defs');\n const marker = defs\n .append('marker')\n .attr('id', 'crosshead')\n .attr('markerWidth', 15)\n .attr('markerHeight', 8)\n .attr('orient', 'auto')\n .attr('refX', 16)\n .attr('refY', 4);\n\n // The arrow\n marker\n .append('path')\n .attr('fill', 'black')\n .attr('stroke', '#000000')\n .style('stroke-dasharray', '0, 0')\n .attr('stroke-width', '1px')\n .attr('d', 'M 9,2 V 6 L16,4 Z');\n\n // The cross\n marker\n .append('path')\n .attr('fill', 'none')\n .attr('stroke', '#000000')\n .style('stroke-dasharray', '0, 0')\n .attr('stroke-width', '1px')\n .attr('d', 'M 0,1 L 6,7 M 6,1 L 0,7');\n // this is actual shape for arrowhead\n};\n\nconst getC4ShapeFont = (cnf, typeC4Shape) => {\n return {\n fontFamily: cnf[typeC4Shape + 'FontFamily'],\n fontSize: cnf[typeC4Shape + 'FontSize'],\n fontWeight: cnf[typeC4Shape + 'FontWeight'],\n };\n};\n\nconst _drawTextCandidateFunc = (function () {\n /**\n * @param {any} content\n * @param {any} g\n * @param {any} x\n * @param {any} y\n * @param {any} width\n * @param {any} height\n * @param {any} textAttrs\n */\n function byText(content, g, x, y, width, height, textAttrs) {\n const text = g\n .append('text')\n .attr('x', x + width / 2)\n .attr('y', y + height / 2 + 5)\n .style('text-anchor', 'middle')\n .text(content);\n _setTextAttrs(text, textAttrs);\n }\n\n /**\n * @param {any} content\n * @param {any} g\n * @param {any} x\n * @param {any} y\n * @param {any} width\n * @param {any} height\n * @param {any} textAttrs\n * @param {any} conf\n */\n function byTspan(content, g, x, y, width, height, textAttrs, conf) {\n const { fontSize, fontFamily, fontWeight } = conf;\n\n const lines = content.split(common.lineBreakRegex);\n for (let i = 0; i < lines.length; i++) {\n const dy = i * fontSize - (fontSize * (lines.length - 1)) / 2;\n const text = g\n .append('text')\n .attr('x', x + width / 2)\n .attr('y', y)\n .style('text-anchor', 'middle')\n .attr('dominant-baseline', 'middle')\n .style('font-size', fontSize)\n .style('font-weight', fontWeight)\n .style('font-family', fontFamily);\n text\n .append('tspan')\n // .attr('x', x + width / 2)\n .attr('dy', dy)\n .text(lines[i])\n // .attr('y', y + height / 2)\n .attr('alignment-baseline', 'mathematical');\n\n _setTextAttrs(text, textAttrs);\n }\n }\n\n /**\n * @param {any} content\n * @param {any} g\n * @param {any} x\n * @param {any} y\n * @param {any} width\n * @param {any} height\n * @param {any} textAttrs\n * @param {any} conf\n */\n function byFo(content, g, x, y, width, height, textAttrs, conf) {\n const s = g.append('switch');\n const f = s\n .append('foreignObject')\n .attr('x', x)\n .attr('y', y)\n .attr('width', width)\n .attr('height', height);\n\n const text = f\n .append('xhtml:div')\n .style('display', 'table')\n .style('height', '100%')\n .style('width', '100%');\n\n text\n .append('div')\n .style('display', 'table-cell')\n .style('text-align', 'center')\n .style('vertical-align', 'middle')\n .text(content);\n\n byTspan(content, s, x, y, width, height, textAttrs, conf);\n _setTextAttrs(text, textAttrs);\n }\n\n /**\n * @param {any} toText\n * @param {any} fromTextAttrsDict\n */\n function _setTextAttrs(toText, fromTextAttrsDict) {\n for (const key in fromTextAttrsDict) {\n if (fromTextAttrsDict.hasOwnProperty(key)) {\n toText.attr(key, fromTextAttrsDict[key]);\n }\n }\n }\n\n return function (conf) {\n return conf.textPlacement === 'fo' ? byFo : conf.textPlacement === 'old' ? byText : byTspan;\n };\n})();\n\nexport default {\n drawRect,\n drawBoundary,\n drawC4Shape,\n drawRels,\n drawImage,\n insertArrowHead,\n insertArrowEnd,\n insertArrowFilledHead,\n insertDynamicNumber,\n insertArrowCrossHead,\n insertDatabaseIcon,\n insertComputerIcon,\n insertClockIcon,\n};\n\n// cspell:ignoreRegExp /'Mstartx.*/g\n", "/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n", "import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n", "import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n", "import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n", "/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n", "import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n", "/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nexport default isObject;\n", "import baseGetTag from './_baseGetTag.js';\nimport isObject from './isObject.js';\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nexport default isFunction;\n", "import root from './_root.js';\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\nexport default coreJsData;\n", "import coreJsData from './_coreJsData.js';\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\nexport default isMasked;\n", "/** Used for built-in method references. */\nvar funcProto = Function.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\nexport default toSource;\n", "import isFunction from './isFunction.js';\nimport isMasked from './_isMasked.js';\nimport isObject from './isObject.js';\nimport toSource from './_toSource.js';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\nexport default baseIsNative;\n", "/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\nexport default getValue;\n", "import baseIsNative from './_baseIsNative.js';\nimport getValue from './_getValue.js';\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\nexport default getNative;\n", "import getNative from './_getNative.js';\n\n/* Built-in method references that are verified to be native. */\nvar nativeCreate = getNative(Object, 'create');\n\nexport default nativeCreate;\n", "import nativeCreate from './_nativeCreate.js';\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\nexport default hashClear;\n", "/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\nexport default hashDelete;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\nexport default hashGet;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\nexport default hashHas;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\nexport default hashSet;\n", "import hashClear from './_hashClear.js';\nimport hashDelete from './_hashDelete.js';\nimport hashGet from './_hashGet.js';\nimport hashHas from './_hashHas.js';\nimport hashSet from './_hashSet.js';\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\nexport default Hash;\n", "/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\nexport default listCacheClear;\n", "/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nexport default eq;\n", "import eq from './eq.js';\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nexport default assocIndexOf;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype;\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\nexport default listCacheDelete;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\nexport default listCacheGet;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\nexport default listCacheHas;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\nexport default listCacheSet;\n", "import listCacheClear from './_listCacheClear.js';\nimport listCacheDelete from './_listCacheDelete.js';\nimport listCacheGet from './_listCacheGet.js';\nimport listCacheHas from './_listCacheHas.js';\nimport listCacheSet from './_listCacheSet.js';\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\nexport default ListCache;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map');\n\nexport default Map;\n", "import Hash from './_Hash.js';\nimport ListCache from './_ListCache.js';\nimport Map from './_Map.js';\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\nexport default mapCacheClear;\n", "/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\nexport default isKeyable;\n", "import isKeyable from './_isKeyable.js';\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\nexport default getMapData;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\nexport default mapCacheDelete;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\nexport default mapCacheGet;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\nexport default mapCacheHas;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\nexport default mapCacheSet;\n", "import mapCacheClear from './_mapCacheClear.js';\nimport mapCacheDelete from './_mapCacheDelete.js';\nimport mapCacheGet from './_mapCacheGet.js';\nimport mapCacheHas from './_mapCacheHas.js';\nimport mapCacheSet from './_mapCacheSet.js';\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\nexport default MapCache;\n", "import MapCache from './_MapCache.js';\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `clear`, `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\nfunction memoize(func, resolver) {\n if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result) || cache;\n return result;\n };\n memoized.cache = new (memoize.Cache || MapCache);\n return memoized;\n}\n\n// Expose `MapCache`.\nmemoize.Cache = MapCache;\n\nexport default memoize;\n", "import ListCache from './_ListCache.js';\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\nexport default stackClear;\n", "/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\nexport default stackDelete;\n", "/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\nexport default stackGet;\n", "/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\nexport default stackHas;\n", "import ListCache from './_ListCache.js';\nimport Map from './_Map.js';\nimport MapCache from './_MapCache.js';\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\nexport default stackSet;\n", "import ListCache from './_ListCache.js';\nimport stackClear from './_stackClear.js';\nimport stackDelete from './_stackDelete.js';\nimport stackGet from './_stackGet.js';\nimport stackHas from './_stackHas.js';\nimport stackSet from './_stackSet.js';\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\nexport default Stack;\n", "import getNative from './_getNative.js';\n\nvar defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n}());\n\nexport default defineProperty;\n", "import defineProperty from './_defineProperty.js';\n\n/**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n}\n\nexport default baseAssignValue;\n", "import baseAssignValue from './_baseAssignValue.js';\nimport eq from './eq.js';\n\n/**\n * This function is like `assignValue` except that it doesn't assign\n * `undefined` values.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignMergeValue(object, key, value) {\n if ((value !== undefined && !eq(object[key], value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\nexport default assignMergeValue;\n", "/**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\nexport default createBaseFor;\n", "import createBaseFor from './_createBaseFor.js';\n\n/**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\nexport default baseFor;\n", "import root from './_root.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;\n\n/**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\nfunction cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var length = buffer.length,\n result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);\n\n buffer.copy(result);\n return result;\n}\n\nexport default cloneBuffer;\n", "import root from './_root.js';\n\n/** Built-in value references. */\nvar Uint8Array = root.Uint8Array;\n\nexport default Uint8Array;\n", "import Uint8Array from './_Uint8Array.js';\n\n/**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\nfunction cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n}\n\nexport default cloneArrayBuffer;\n", "import cloneArrayBuffer from './_cloneArrayBuffer.js';\n\n/**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\nfunction cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n}\n\nexport default cloneTypedArray;\n", "/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\nexport default copyArray;\n", "import isObject from './isObject.js';\n\n/** Built-in value references. */\nvar objectCreate = Object.create;\n\n/**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\nvar baseCreate = (function() {\n function object() {}\n return function(proto) {\n if (!isObject(proto)) {\n return {};\n }\n if (objectCreate) {\n return objectCreate(proto);\n }\n object.prototype = proto;\n var result = new object;\n object.prototype = undefined;\n return result;\n };\n}());\n\nexport default baseCreate;\n", "/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nexport default overArg;\n", "import overArg from './_overArg.js';\n\n/** Built-in value references. */\nvar getPrototype = overArg(Object.getPrototypeOf, Object);\n\nexport default getPrototype;\n", "/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\nexport default isPrototype;\n", "import baseCreate from './_baseCreate.js';\nimport getPrototype from './_getPrototype.js';\nimport isPrototype from './_isPrototype.js';\n\n/**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n}\n\nexport default initCloneObject;\n", "/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n", "import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\nexport default baseIsArguments;\n", "import baseIsArguments from './_baseIsArguments.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\nexport default isArguments;\n", "/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nexport default isArray;\n", "/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nexport default isLength;\n", "import isFunction from './isFunction.js';\nimport isLength from './isLength.js';\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\nexport default isArrayLike;\n", "import isArrayLike from './isArrayLike.js';\nimport isObjectLike from './isObjectLike.js';\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\nexport default isArrayLikeObject;\n", "/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nexport default stubFalse;\n", "import root from './_root.js';\nimport stubFalse from './stubFalse.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\nexport default isBuffer;\n", "import baseGetTag from './_baseGetTag.js';\nimport getPrototype from './_getPrototype.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\nexport default isPlainObject;\n", "import baseGetTag from './_baseGetTag.js';\nimport isLength from './isLength.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\nexport default baseIsTypedArray;\n", "/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\nexport default baseUnary;\n", "import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\nexport default nodeUtil;\n", "import baseIsTypedArray from './_baseIsTypedArray.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\nexport default isTypedArray;\n", "/**\n * Gets the value at `key`, unless `key` is \"__proto__\" or \"constructor\".\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction safeGet(object, key) {\n if (key === 'constructor' && typeof object[key] === 'function') {\n return;\n }\n\n if (key == '__proto__') {\n return;\n }\n\n return object[key];\n}\n\nexport default safeGet;\n", "import baseAssignValue from './_baseAssignValue.js';\nimport eq from './eq.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\nexport default assignValue;\n", "import assignValue from './_assignValue.js';\nimport baseAssignValue from './_baseAssignValue.js';\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n if (newValue === undefined) {\n newValue = source[key];\n }\n if (isNew) {\n baseAssignValue(object, key, newValue);\n } else {\n assignValue(object, key, newValue);\n }\n }\n return object;\n}\n\nexport default copyObject;\n", "/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\nexport default baseTimes;\n", "/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\nexport default isIndex;\n", "import baseTimes from './_baseTimes.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isIndex from './_isIndex.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default arrayLikeKeys;\n", "/**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default nativeKeysIn;\n", "import isObject from './isObject.js';\nimport isPrototype from './_isPrototype.js';\nimport nativeKeysIn from './_nativeKeysIn.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default baseKeysIn;\n", "import arrayLikeKeys from './_arrayLikeKeys.js';\nimport baseKeysIn from './_baseKeysIn.js';\nimport isArrayLike from './isArrayLike.js';\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n}\n\nexport default keysIn;\n", "import copyObject from './_copyObject.js';\nimport keysIn from './keysIn.js';\n\n/**\n * Converts `value` to a plain object flattening inherited enumerable string\n * keyed properties of `value` to own properties of the plain object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Object} Returns the converted plain object.\n * @example\n *\n * function Foo() {\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.assign({ 'a': 1 }, new Foo);\n * // => { 'a': 1, 'b': 2 }\n *\n * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n * // => { 'a': 1, 'b': 2, 'c': 3 }\n */\nfunction toPlainObject(value) {\n return copyObject(value, keysIn(value));\n}\n\nexport default toPlainObject;\n", "import assignMergeValue from './_assignMergeValue.js';\nimport cloneBuffer from './_cloneBuffer.js';\nimport cloneTypedArray from './_cloneTypedArray.js';\nimport copyArray from './_copyArray.js';\nimport initCloneObject from './_initCloneObject.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\nimport isArrayLikeObject from './isArrayLikeObject.js';\nimport isBuffer from './isBuffer.js';\nimport isFunction from './isFunction.js';\nimport isObject from './isObject.js';\nimport isPlainObject from './isPlainObject.js';\nimport isTypedArray from './isTypedArray.js';\nimport safeGet from './_safeGet.js';\nimport toPlainObject from './toPlainObject.js';\n\n/**\n * A specialized version of `baseMerge` for arrays and objects which performs\n * deep merges and tracks traversed objects enabling objects with circular\n * references to be merged.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {string} key The key of the value to merge.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} mergeFunc The function to merge values.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\nfunction baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {\n var objValue = safeGet(object, key),\n srcValue = safeGet(source, key),\n stacked = stack.get(srcValue);\n\n if (stacked) {\n assignMergeValue(object, key, stacked);\n return;\n }\n var newValue = customizer\n ? customizer(objValue, srcValue, (key + ''), object, source, stack)\n : undefined;\n\n var isCommon = newValue === undefined;\n\n if (isCommon) {\n var isArr = isArray(srcValue),\n isBuff = !isArr && isBuffer(srcValue),\n isTyped = !isArr && !isBuff && isTypedArray(srcValue);\n\n newValue = srcValue;\n if (isArr || isBuff || isTyped) {\n if (isArray(objValue)) {\n newValue = objValue;\n }\n else if (isArrayLikeObject(objValue)) {\n newValue = copyArray(objValue);\n }\n else if (isBuff) {\n isCommon = false;\n newValue = cloneBuffer(srcValue, true);\n }\n else if (isTyped) {\n isCommon = false;\n newValue = cloneTypedArray(srcValue, true);\n }\n else {\n newValue = [];\n }\n }\n else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n newValue = objValue;\n if (isArguments(objValue)) {\n newValue = toPlainObject(objValue);\n }\n else if (!isObject(objValue) || isFunction(objValue)) {\n newValue = initCloneObject(srcValue);\n }\n }\n else {\n isCommon = false;\n }\n }\n if (isCommon) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n stack.set(srcValue, newValue);\n mergeFunc(newValue, srcValue, srcIndex, customizer, stack);\n stack['delete'](srcValue);\n }\n assignMergeValue(object, key, newValue);\n}\n\nexport default baseMergeDeep;\n", "import Stack from './_Stack.js';\nimport assignMergeValue from './_assignMergeValue.js';\nimport baseFor from './_baseFor.js';\nimport baseMergeDeep from './_baseMergeDeep.js';\nimport isObject from './isObject.js';\nimport keysIn from './keysIn.js';\nimport safeGet from './_safeGet.js';\n\n/**\n * The base implementation of `_.merge` without support for multiple sources.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\nfunction baseMerge(object, source, srcIndex, customizer, stack) {\n if (object === source) {\n return;\n }\n baseFor(source, function(srcValue, key) {\n stack || (stack = new Stack);\n if (isObject(srcValue)) {\n baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);\n }\n else {\n var newValue = customizer\n ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)\n : undefined;\n\n if (newValue === undefined) {\n newValue = srcValue;\n }\n assignMergeValue(object, key, newValue);\n }\n }, keysIn);\n}\n\nexport default baseMerge;\n", "/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\nexport default identity;\n", "/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\nexport default apply;\n", "import apply from './_apply.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\nfunction overRest(func, start, transform) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return apply(func, this, otherArgs);\n };\n}\n\nexport default overRest;\n", "/**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\nfunction constant(value) {\n return function() {\n return value;\n };\n}\n\nexport default constant;\n", "import constant from './constant.js';\nimport defineProperty from './_defineProperty.js';\nimport identity from './identity.js';\n\n/**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar baseSetToString = !defineProperty ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n};\n\nexport default baseSetToString;\n", "/** Used to detect hot functions by number of calls within a span of milliseconds. */\nvar HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeNow = Date.now;\n\n/**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\nfunction shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined, arguments);\n };\n}\n\nexport default shortOut;\n", "import baseSetToString from './_baseSetToString.js';\nimport shortOut from './_shortOut.js';\n\n/**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar setToString = shortOut(baseSetToString);\n\nexport default setToString;\n", "import identity from './identity.js';\nimport overRest from './_overRest.js';\nimport setToString from './_setToString.js';\n\n/**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\nfunction baseRest(func, start) {\n return setToString(overRest(func, start, identity), func + '');\n}\n\nexport default baseRest;\n", "import eq from './eq.js';\nimport isArrayLike from './isArrayLike.js';\nimport isIndex from './_isIndex.js';\nimport isObject from './isObject.js';\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\nexport default isIterateeCall;\n", "import baseRest from './_baseRest.js';\nimport isIterateeCall from './_isIterateeCall.js';\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\nexport default createAssigner;\n", "import baseMerge from './_baseMerge.js';\nimport createAssigner from './_createAssigner.js';\n\n/**\n * This method is like `_.assign` except that it recursively merges own and\n * inherited enumerable string keyed properties of source objects into the\n * destination object. Source properties that resolve to `undefined` are\n * skipped if a destination value exists. Array and plain object properties\n * are merged recursively. Other objects and value types are overridden by\n * assignment. Source objects are applied from left to right. Subsequent\n * sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {\n * 'a': [{ 'b': 2 }, { 'd': 4 }]\n * };\n *\n * var other = {\n * 'a': [{ 'c': 3 }, { 'e': 5 }]\n * };\n *\n * _.merge(object, other);\n * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }\n */\nvar merge = createAssigner(function(object, source, srcIndex) {\n baseMerge(object, source, srcIndex);\n});\n\nexport default merge;\n", "import { sanitizeUrl } from '@braintree/sanitize-url';\nimport type { CurveFactory } from 'd3';\nimport {\n curveBasis,\n curveBasisClosed,\n curveBasisOpen,\n curveBumpX,\n curveBumpY,\n curveBundle,\n curveCardinalClosed,\n curveCardinalOpen,\n curveCardinal,\n curveCatmullRomClosed,\n curveCatmullRomOpen,\n curveCatmullRom,\n curveLinear,\n curveLinearClosed,\n curveMonotoneX,\n curveMonotoneY,\n curveNatural,\n curveStep,\n curveStepAfter,\n curveStepBefore,\n select,\n} from 'd3';\nimport common from './diagrams/common/common.js';\nimport { sanitizeDirective } from './utils/sanitizeDirective.js';\nimport { log } from './logger.js';\nimport { detectType } from './diagram-api/detectType.js';\nimport assignWithDepth from './assignWithDepth.js';\nimport type { MermaidConfig } from './config.type.js';\nimport memoize from 'lodash-es/memoize.js';\nimport merge from 'lodash-es/merge.js';\nimport { directiveRegex } from './diagram-api/regexes.js';\nimport type { D3Element, Point, TextDimensionConfig, TextDimensions } from './types.js';\n\nexport const ZERO_WIDTH_SPACE = '\\u200b';\n\n// Effectively an enum of the supported curve types, accessible by name\nconst d3CurveTypes = {\n curveBasis: curveBasis,\n curveBasisClosed: curveBasisClosed,\n curveBasisOpen: curveBasisOpen,\n curveBumpX: curveBumpX,\n curveBumpY: curveBumpY,\n curveBundle: curveBundle,\n curveCardinalClosed: curveCardinalClosed,\n curveCardinalOpen: curveCardinalOpen,\n curveCardinal: curveCardinal,\n curveCatmullRomClosed: curveCatmullRomClosed,\n curveCatmullRomOpen: curveCatmullRomOpen,\n curveCatmullRom: curveCatmullRom,\n curveLinear: curveLinear,\n curveLinearClosed: curveLinearClosed,\n curveMonotoneX: curveMonotoneX,\n curveMonotoneY: curveMonotoneY,\n curveNatural: curveNatural,\n curveStep: curveStep,\n curveStepAfter: curveStepAfter,\n curveStepBefore: curveStepBefore,\n} as const;\n\nconst directiveWithoutOpen =\n /\\s*(?:(\\w+)(?=:):|(\\w+))\\s*(?:(\\w+)|((?:(?!}%{2}).|\\r?\\n)*))?\\s*(?:}%{2})?/gi;\n/**\n * Detects the init config object from the text\n *\n * @param text - The text defining the graph. For example:\n *\n * ```mermaid\n * %%{init: {\"theme\": \"debug\", \"logLevel\": 1 }}%%\n * graph LR\n * a-->b\n * b-->c\n * c-->d\n * d-->e\n * e-->f\n * f-->g\n * g-->h\n * ```\n *\n * Or\n *\n * ```mermaid\n * %%{initialize: {\"theme\": \"dark\", logLevel: \"debug\" }}%%\n * graph LR\n * a-->b\n * b-->c\n * c-->d\n * d-->e\n * e-->f\n * f-->g\n * g-->h\n * ```\n *\n * @param config - Optional mermaid configuration object.\n * @returns The json object representing the init passed to mermaid.initialize()\n */\nexport const detectInit = function (\n text: string,\n config?: MermaidConfig\n): MermaidConfig | undefined {\n const inits = detectDirective(text, /(?:init\\b)|(?:initialize\\b)/);\n let results: MermaidConfig & { config?: unknown } = {};\n\n if (Array.isArray(inits)) {\n const args = inits.map((init) => init.args);\n sanitizeDirective(args);\n results = assignWithDepth(results, [...args]);\n } else {\n results = inits.args as MermaidConfig;\n }\n\n if (!results) {\n return;\n }\n\n let type = detectType(text, config);\n\n // Move the `config` value to appropriate diagram type value\n const prop = 'config';\n if (results[prop] !== undefined) {\n if (type === 'flowchart-v2') {\n type = 'flowchart';\n }\n results[type as keyof MermaidConfig] = results[prop];\n delete results[prop];\n }\n\n return results;\n};\n\ninterface Directive {\n type?: string;\n args?: unknown;\n}\n/**\n * Detects the directive from the text.\n *\n * Text can be single line or multiline. If type is null or omitted,\n * the first directive encountered in text will be returned\n *\n * ```mermaid\n * graph LR\n * %%{someDirective}%%\n * a-->b\n * b-->c\n * c-->d\n * d-->e\n * e-->f\n * f-->g\n * g-->h\n * ```\n *\n * @param text - The text defining the graph\n * @param type - The directive to return (default: `null`)\n * @returns An object or Array representing the directive(s) matched by the input type.\n * If a single directive was found, that directive object will be returned.\n */\nexport const detectDirective = function (\n text: string,\n type: string | RegExp | null = null\n): Directive | Directive[] {\n try {\n const commentWithoutDirectives = new RegExp(\n `[%]{2}(?![{]${directiveWithoutOpen.source})(?=[}][%]{2}).*\\n`,\n 'ig'\n );\n text = text.trim().replace(commentWithoutDirectives, '').replace(/'/gm, '\"');\n log.debug(\n `Detecting diagram directive${type !== null ? ' type:' + type : ''} based on the text:${text}`\n );\n let match: RegExpExecArray | null;\n const result: Directive[] = [];\n while ((match = directiveRegex.exec(text)) !== null) {\n // This is necessary to avoid infinite loops with zero-width matches\n if (match.index === directiveRegex.lastIndex) {\n directiveRegex.lastIndex++;\n }\n if ((match && !type) || (type && match[1]?.match(type)) || (type && match[2]?.match(type))) {\n const type = match[1] ? match[1] : match[2];\n const args = match[3] ? match[3].trim() : match[4] ? JSON.parse(match[4].trim()) : null;\n result.push({ type, args });\n }\n }\n if (result.length === 0) {\n return { type: text, args: null };\n }\n\n return result.length === 1 ? result[0] : result;\n } catch (error) {\n log.error(\n `ERROR: ${\n (error as Error).message\n } - Unable to parse directive type: '${type}' based on the text: '${text}'`\n );\n return { type: undefined, args: null };\n }\n};\n\nexport const removeDirectives = function (text: string): string {\n return text.replace(directiveRegex, '');\n};\n\n/**\n * Detects whether a substring in present in a given array\n *\n * @param str - The substring to detect\n * @param arr - The array to search\n * @returns The array index containing the substring or -1 if not present\n */\nexport const isSubstringInArray = function (str: string, arr: string[]): number {\n for (const [i, element] of arr.entries()) {\n if (element.match(str)) {\n return i;\n }\n }\n return -1;\n};\n\n/**\n * Returns a d3 curve given a curve name\n *\n * @param interpolate - The interpolation name\n * @param defaultCurve - The default curve to return\n * @returns The curve factory to use\n */\nexport function interpolateToCurve(\n interpolate: string | undefined,\n defaultCurve: CurveFactory\n): CurveFactory {\n if (!interpolate) {\n return defaultCurve;\n }\n const curveName = `curve${interpolate.charAt(0).toUpperCase() + interpolate.slice(1)}`;\n\n // @ts-ignore TODO: Fix issue with curve type\n return d3CurveTypes[curveName as keyof typeof d3CurveTypes] ?? defaultCurve;\n}\n\n/**\n * Formats a URL string\n *\n * @param linkStr - String of the URL\n * @param config - Configuration passed to MermaidJS\n * @returns The formatted URL or `undefined`.\n */\nexport function formatUrl(linkStr: string, config: MermaidConfig): string | undefined {\n const url = linkStr.trim();\n\n if (!url) {\n return undefined;\n }\n\n if (config.securityLevel !== 'loose') {\n return sanitizeUrl(url);\n }\n\n return url;\n}\n\n/**\n * Runs a function\n *\n * @param functionName - A dot separated path to the function relative to the `window`\n * @param params - Parameters to pass to the function\n */\nexport const runFunc = (functionName: string, ...params: unknown[]) => {\n const arrPaths = functionName.split('.');\n\n const len = arrPaths.length - 1;\n const fnName = arrPaths[len];\n\n let obj = window;\n for (let i = 0; i < len; i++) {\n obj = obj[arrPaths[i] as keyof typeof obj];\n if (!obj) {\n log.error(`Function name: ${functionName} not found in window`);\n return;\n }\n }\n\n obj[fnName as keyof typeof obj](...params);\n};\n\n/**\n * Finds the distance between two points using the Distance Formula\n *\n * @param p1 - The first point\n * @param p2 - The second point\n * @returns The distance between the two points.\n */\nfunction distance(p1?: Point, p2?: Point): number {\n if (!p1 || !p2) {\n return 0;\n }\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n}\n\n/**\n * TODO: Give this a description\n *\n * @param points - List of points\n */\nfunction traverseEdge(points: Point[]): Point {\n let prevPoint: Point | undefined;\n let totalDistance = 0;\n\n points.forEach((point) => {\n totalDistance += distance(point, prevPoint);\n prevPoint = point;\n });\n\n // Traverse half of total distance along points\n const remainingDistance = totalDistance / 2;\n return calculatePoint(points, remainingDistance);\n}\n\n/**\n * {@inheritdoc traverseEdge}\n */\nfunction calcLabelPosition(points: Point[]): Point {\n if (points.length === 1) {\n return points[0];\n }\n return traverseEdge(points);\n}\n\nexport const roundNumber = (num: number, precision = 2) => {\n const factor = Math.pow(10, precision);\n return Math.round(num * factor) / factor;\n};\n\nexport const calculatePoint = (points: Point[], distanceToTraverse: number): Point => {\n let prevPoint: Point | undefined = undefined;\n let remainingDistance = distanceToTraverse;\n for (const point of points) {\n if (prevPoint) {\n const vectorDistance = distance(point, prevPoint);\n if (vectorDistance < remainingDistance) {\n remainingDistance -= vectorDistance;\n } else {\n // The point is remainingDistance from prevPoint in the vector between prevPoint and point\n // Calculate the coordinates\n const distanceRatio = remainingDistance / vectorDistance;\n if (distanceRatio <= 0) {\n return prevPoint;\n }\n if (distanceRatio >= 1) {\n return { x: point.x, y: point.y };\n }\n if (distanceRatio > 0 && distanceRatio < 1) {\n return {\n x: roundNumber((1 - distanceRatio) * prevPoint.x + distanceRatio * point.x, 5),\n y: roundNumber((1 - distanceRatio) * prevPoint.y + distanceRatio * point.y, 5),\n };\n }\n }\n }\n prevPoint = point;\n }\n throw new Error('Could not find a suitable point for the given distance');\n};\n\nconst calcCardinalityPosition = (\n isRelationTypePresent: boolean,\n points: Point[],\n initialPosition: Point\n) => {\n log.info(`our points ${JSON.stringify(points)}`);\n if (points[0] !== initialPosition) {\n points = points.reverse();\n }\n // Traverse only 25 total distance along points to find cardinality point\n const distanceToCardinalityPoint = 25;\n const center = calculatePoint(points, distanceToCardinalityPoint);\n // if relation is present (Arrows will be added), change cardinality point off-set distance (d)\n const d = isRelationTypePresent ? 10 : 5;\n //Calculate Angle for x and y axis\n const angle = Math.atan2(points[0].y - center.y, points[0].x - center.x);\n const cardinalityPosition = { x: 0, y: 0 };\n //Calculation cardinality position using angle, center point on the line/curve but perpendicular and with offset-distance\n cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2;\n cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2;\n return cardinalityPosition;\n};\n\n/**\n * Calculates the terminal label position.\n *\n * @param terminalMarkerSize - Terminal marker size.\n * @param position - Position of label relative to points.\n * @param _points - Array of points.\n * @returns - The `cardinalityPosition`.\n */\nfunction calcTerminalLabelPosition(\n terminalMarkerSize: number,\n position: 'start_left' | 'start_right' | 'end_left' | 'end_right',\n _points: Point[]\n): Point {\n const points = structuredClone(_points);\n log.info('our points', points);\n if (position !== 'start_left' && position !== 'start_right') {\n points.reverse();\n }\n\n // Traverse only 25 total distance along points to find cardinality point\n const distanceToCardinalityPoint = 25 + terminalMarkerSize;\n const center = calculatePoint(points, distanceToCardinalityPoint);\n\n // if relation is present (Arrows will be added), change cardinality point off-set distance (d)\n const d = 10 + terminalMarkerSize * 0.5;\n //Calculate Angle for x and y axis\n const angle = Math.atan2(points[0].y - center.y, points[0].x - center.x);\n\n const cardinalityPosition: Point = { x: 0, y: 0 };\n //Calculation cardinality position using angle, center point on the line/curve but perpendicular and with offset-distance\n\n if (position === 'start_left') {\n cardinalityPosition.x = Math.sin(angle + Math.PI) * d + (points[0].x + center.x) / 2;\n cardinalityPosition.y = -Math.cos(angle + Math.PI) * d + (points[0].y + center.y) / 2;\n } else if (position === 'end_right') {\n cardinalityPosition.x = Math.sin(angle - Math.PI) * d + (points[0].x + center.x) / 2 - 5;\n cardinalityPosition.y = -Math.cos(angle - Math.PI) * d + (points[0].y + center.y) / 2 - 5;\n } else if (position === 'end_left') {\n cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2 - 5;\n cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2 - 5;\n } else {\n cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2;\n cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2;\n }\n return cardinalityPosition;\n}\n\n/**\n * Gets styles from an array of declarations\n *\n * @param arr - Declarations\n * @returns The styles grouped as strings\n */\nexport function getStylesFromArray(arr: string[]): { style: string; labelStyle: string } {\n let style = '';\n let labelStyle = '';\n\n for (const element of arr) {\n if (element !== undefined) {\n // add text properties to label style definition\n if (element.startsWith('color:') || element.startsWith('text-align:')) {\n labelStyle = labelStyle + element + ';';\n } else {\n style = style + element + ';';\n }\n }\n }\n\n return { style, labelStyle };\n}\n\nlet cnt = 0;\nexport const generateId = () => {\n cnt++;\n return 'id-' + Math.random().toString(36).substr(2, 12) + '-' + cnt;\n};\n\n/**\n * Generates a random hexadecimal id of the given length.\n *\n * @param length - Length of string.\n * @returns The generated string.\n */\nfunction makeRandomHex(length: number): string {\n let result = '';\n const characters = '0123456789abcdef';\n const charactersLength = characters.length;\n for (let i = 0; i < length; i++) {\n result += characters.charAt(Math.floor(Math.random() * charactersLength));\n }\n return result;\n}\n\nexport const random = (options: { length: number }) => {\n return makeRandomHex(options.length);\n};\n\nexport const getTextObj = function () {\n return {\n x: 0,\n y: 0,\n fill: undefined,\n anchor: 'start',\n style: '#666',\n width: 100,\n height: 100,\n textMargin: 0,\n rx: 0,\n ry: 0,\n valign: undefined,\n text: '',\n };\n};\n\n/**\n * Adds text to an element\n *\n * @param elem - SVG Element to add text to\n * @param textData - Text options.\n * @returns Text element with given styling and content\n */\nexport const drawSimpleText = function (\n elem: SVGElement,\n textData: {\n text: string;\n x: number;\n y: number;\n anchor: 'start' | 'middle' | 'end';\n fontFamily: string;\n fontSize: string | number;\n fontWeight: string | number;\n fill: string;\n class: string | undefined;\n textMargin: number;\n }\n): SVGTextElement {\n // Remove and ignore br:s\n const nText = textData.text.replace(common.lineBreakRegex, ' ');\n\n const [, _fontSizePx] = parseFontSize(textData.fontSize);\n\n const textElem = elem.append('text') as any;\n textElem.attr('x', textData.x);\n textElem.attr('y', textData.y);\n textElem.style('text-anchor', textData.anchor);\n textElem.style('font-family', textData.fontFamily);\n textElem.style('font-size', _fontSizePx);\n textElem.style('font-weight', textData.fontWeight);\n textElem.attr('fill', textData.fill);\n\n if (textData.class !== undefined) {\n textElem.attr('class', textData.class);\n }\n\n const span = textElem.append('tspan');\n span.attr('x', textData.x + textData.textMargin * 2);\n span.attr('fill', textData.fill);\n span.text(nText);\n\n return textElem;\n};\n\ninterface WrapLabelConfig {\n fontSize: number;\n fontFamily: string;\n fontWeight: number;\n joinWith: string;\n}\n\nexport const wrapLabel: (label: string, maxWidth: number, config: WrapLabelConfig) => string =\n memoize(\n (label: string, maxWidth: number, config: WrapLabelConfig): string => {\n if (!label) {\n return label;\n }\n config = Object.assign(\n { fontSize: 12, fontWeight: 400, fontFamily: 'Arial', joinWith: ' ' },\n config\n );\n if (common.lineBreakRegex.test(label)) {\n return label;\n }\n const words = label.split(' ').filter(Boolean);\n const completedLines: string[] = [];\n let nextLine = '';\n words.forEach((word, index) => {\n const wordLength = calculateTextWidth(`${word} `, config);\n const nextLineLength = calculateTextWidth(nextLine, config);\n if (wordLength > maxWidth) {\n const { hyphenatedStrings, remainingWord } = breakString(word, maxWidth, '-', config);\n completedLines.push(nextLine, ...hyphenatedStrings);\n nextLine = remainingWord;\n } else if (nextLineLength + wordLength >= maxWidth) {\n completedLines.push(nextLine);\n nextLine = word;\n } else {\n nextLine = [nextLine, word].filter(Boolean).join(' ');\n }\n const currentWord = index + 1;\n const isLastWord = currentWord === words.length;\n if (isLastWord) {\n completedLines.push(nextLine);\n }\n });\n return completedLines.filter((line) => line !== '').join(config.joinWith);\n },\n (label, maxWidth, config) =>\n `${label}${maxWidth}${config.fontSize}${config.fontWeight}${config.fontFamily}${config.joinWith}`\n );\n\ninterface BreakStringOutput {\n hyphenatedStrings: string[];\n remainingWord: string;\n}\n\nconst breakString: (\n word: string,\n maxWidth: number,\n hyphenCharacter: string,\n config: WrapLabelConfig\n) => BreakStringOutput = memoize(\n (\n word: string,\n maxWidth: number,\n hyphenCharacter = '-',\n config: WrapLabelConfig\n ): BreakStringOutput => {\n config = Object.assign(\n { fontSize: 12, fontWeight: 400, fontFamily: 'Arial', margin: 0 },\n config\n );\n const characters = [...word];\n const lines: string[] = [];\n let currentLine = '';\n characters.forEach((character, index) => {\n const nextLine = `${currentLine}${character}`;\n const lineWidth = calculateTextWidth(nextLine, config);\n if (lineWidth >= maxWidth) {\n const currentCharacter = index + 1;\n const isLastLine = characters.length === currentCharacter;\n const hyphenatedNextLine = `${nextLine}${hyphenCharacter}`;\n lines.push(isLastLine ? nextLine : hyphenatedNextLine);\n currentLine = '';\n } else {\n currentLine = nextLine;\n }\n });\n return { hyphenatedStrings: lines, remainingWord: currentLine };\n },\n (word, maxWidth, hyphenCharacter = '-', config) =>\n `${word}${maxWidth}${hyphenCharacter}${config.fontSize}${config.fontWeight}${config.fontFamily}`\n);\n\n/**\n * This calculates the text's height, taking into account the wrap breaks and both the statically\n * configured height, width, and the length of the text (in pixels).\n *\n * If the wrapped text text has greater height, we extend the height, so it's value won't overflow.\n *\n * @param text - The text to measure\n * @param config - The config for fontSize, fontFamily, and fontWeight all impacting the\n * resulting size\n * @returns The height for the given text\n */\nexport function calculateTextHeight(\n text: Parameters[0],\n config: Parameters[1]\n): ReturnType['height'] {\n return calculateTextDimensions(text, config).height;\n}\n\n/**\n * This calculates the width of the given text, font size and family.\n *\n * @param text - The text to calculate the width of\n * @param config - The config for fontSize, fontFamily, and fontWeight all impacting the\n * resulting size\n * @returns The width for the given text\n */\nexport function calculateTextWidth(\n text: Parameters[0],\n config: Parameters[1]\n): ReturnType['width'] {\n return calculateTextDimensions(text, config).width;\n}\n\n/**\n * This calculates the dimensions of the given text, font size, font family, font weight, and\n * margins.\n *\n * @param text - The text to calculate the width of\n * @param config - The config for fontSize, fontFamily, fontWeight, and margin all impacting\n * the resulting size\n * @returns The dimensions for the given text\n */\nexport const calculateTextDimensions: (\n text: string,\n config: TextDimensionConfig\n) => TextDimensions = memoize(\n (text: string, config: TextDimensionConfig): TextDimensions => {\n const { fontSize = 12, fontFamily = 'Arial', fontWeight = 400 } = config;\n if (!text) {\n return { width: 0, height: 0 };\n }\n\n const [, _fontSizePx] = parseFontSize(fontSize);\n\n // We can't really know if the user supplied font family will render on the user agent;\n // thus, we'll take the max width between the user supplied font family, and a default\n // of sans-serif.\n const fontFamilies = ['sans-serif', fontFamily];\n const lines = text.split(common.lineBreakRegex);\n const dims = [];\n\n const body = select('body');\n // We don't want to leak DOM elements - if a removal operation isn't available\n // for any reason, do not continue.\n if (!body.remove) {\n return { width: 0, height: 0, lineHeight: 0 };\n }\n\n const g = body.append('svg');\n\n for (const fontFamily of fontFamilies) {\n let cHeight = 0;\n const dim = { width: 0, height: 0, lineHeight: 0 };\n for (const line of lines) {\n const textObj = getTextObj();\n textObj.text = line || ZERO_WIDTH_SPACE;\n // @ts-ignore TODO: Fix D3 types\n const textElem = drawSimpleText(g, textObj)\n // @ts-ignore TODO: Fix D3 types\n .style('font-size', _fontSizePx)\n .style('font-weight', fontWeight)\n .style('font-family', fontFamily);\n\n const bBox = (textElem._groups || textElem)[0][0].getBBox();\n if (bBox.width === 0 && bBox.height === 0) {\n throw new Error('svg element not in render tree');\n }\n dim.width = Math.round(Math.max(dim.width, bBox.width));\n cHeight = Math.round(bBox.height);\n dim.height += cHeight;\n dim.lineHeight = Math.round(Math.max(dim.lineHeight, cHeight));\n }\n dims.push(dim);\n }\n\n g.remove();\n\n const index =\n isNaN(dims[1].height) ||\n isNaN(dims[1].width) ||\n isNaN(dims[1].lineHeight) ||\n (dims[0].height > dims[1].height &&\n dims[0].width > dims[1].width &&\n dims[0].lineHeight > dims[1].lineHeight)\n ? 0\n : 1;\n return dims[index];\n },\n (text, config) => `${text}${config.fontSize}${config.fontWeight}${config.fontFamily}`\n);\n\nexport class InitIDGenerator {\n private count = 0;\n public next: () => number;\n constructor(deterministic = false, seed?: string) {\n // TODO: Seed is only used for length?\n // v11: Use the actual value of seed string to generate an initial value for count.\n this.count = seed ? seed.length : 0;\n this.next = deterministic ? () => this.count++ : () => Date.now();\n }\n}\n\nlet decoder: HTMLDivElement;\n\n/**\n * Decodes HTML, source: {@link https://github.com/shrpne/entity-decode/blob/v2.0.1/browser.js}\n *\n * @param html - HTML as a string\n * @returns Unescaped HTML\n */\nexport const entityDecode = function (html: string): string {\n decoder = decoder || document.createElement('div');\n // Escape HTML before decoding for HTML Entities\n html = escape(html).replace(/%26/g, '&').replace(/%23/g, '#').replace(/%3B/g, ';');\n decoder.innerHTML = html;\n\n return unescape(decoder.textContent!);\n};\n\nexport interface DetailedError {\n str: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n hash: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n error?: any;\n message?: string;\n}\n\n/** @param error - The error to check */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function isDetailedError(error: any): error is DetailedError {\n return 'str' in error;\n}\n\n/** @param error - The error to convert to an error message */\nexport function getErrorMessage(error: unknown): string {\n if (error instanceof Error) {\n return error.message;\n }\n return String(error);\n}\n\n/**\n * Appends element with the given title and css class.\n *\n * @param parent - d3 svg object to append title to\n * @param cssClass - CSS class for the element containing the title\n * @param titleTopMargin - Margin in pixels between title and rest of the graph\n * @param title - The title. If empty, returns immediately.\n */\nexport const insertTitle = (\n parent: D3Element,\n cssClass: string,\n titleTopMargin: number,\n title?: string\n): void => {\n if (!title) {\n return;\n }\n const bounds = parent.node()?.getBBox();\n if (!bounds) {\n return;\n }\n parent\n .append('text')\n .text(title)\n .attr('x', bounds.x + bounds.width / 2)\n .attr('y', -titleTopMargin)\n .attr('class', cssClass);\n};\n\n/**\n * Parses a raw fontSize configuration value into a number and string value.\n *\n * @param fontSize - a string or number font size configuration value\n *\n * @returns parsed number and string style font size values, or nulls if a number value can't\n * be parsed from an input string.\n */\nexport const parseFontSize = (fontSize: string | number | undefined): [number?, string?] => {\n // if the font size is a number, assume a px string representation\n if (typeof fontSize === 'number') {\n return [fontSize, fontSize + 'px'];\n }\n\n const fontSizeNumber = parseInt(fontSize ?? '', 10);\n if (Number.isNaN(fontSizeNumber)) {\n // if a number value can't be parsed, return null for both values\n return [undefined, undefined];\n } else if (fontSize === String(fontSizeNumber)) {\n // if a string input doesn't contain any units, assume px units\n return [fontSizeNumber, fontSize + 'px'];\n } else {\n return [fontSizeNumber, fontSize];\n }\n};\n\nexport function cleanAndMerge(defaultData: T, data?: Partial): T {\n return merge({}, defaultData, data);\n}\n\nexport default {\n assignWithDepth,\n wrapLabel,\n calculateTextHeight,\n calculateTextWidth,\n calculateTextDimensions,\n cleanAndMerge,\n detectInit,\n detectDirective,\n isSubstringInArray,\n interpolateToCurve,\n calcLabelPosition,\n calcCardinalityPosition,\n calcTerminalLabelPosition,\n formatUrl,\n getStylesFromArray,\n generateId,\n random,\n runFunc,\n entityDecode,\n insertTitle,\n parseFontSize,\n InitIDGenerator,\n};\n\n/**\n * @param text - text to be encoded\n * @returns\n */\nexport const encodeEntities = function (text: string): string {\n let txt = text;\n\n txt = txt.replace(/style.*:\\S*#.*;/g, function (s): string {\n return s.substring(0, s.length - 1);\n });\n txt = txt.replace(/classDef.*:\\S*#.*;/g, function (s): string {\n return s.substring(0, s.length - 1);\n });\n\n txt = txt.replace(/#\\w+;/g, function (s) {\n const innerTxt = s.substring(1, s.length - 1);\n\n const isInt = /^\\+?\\d+$/.test(innerTxt);\n if (isInt) {\n return '\uFB02\u00B0\u00B0' + innerTxt + '\u00B6\u00DF';\n } else {\n return '\uFB02\u00B0' + innerTxt + '\u00B6\u00DF';\n }\n });\n\n return txt;\n};\n\n/**\n *\n * @param text - text to be decoded\n * @returns\n */\nexport const decodeEntities = function (text: string): string {\n return text.replace(/\uFB02\u00B0\u00B0/g, '').replace(/\uFB02\u00B0/g, '&').replace(/\u00B6\u00DF/g, ';');\n};\n\nexport const isString = (value: unknown): value is string => {\n return typeof value === 'string';\n};\n\nexport const getEdgeId = (\n from: string,\n to: string,\n {\n counter = 0,\n prefix,\n suffix,\n }: {\n counter?: number;\n prefix?: string;\n suffix?: string;\n }\n) => {\n return `${prefix ? `${prefix}_` : ''}${from}_${to}_${counter}${suffix ? `_${suffix}` : ''}`;\n};\n", "import { select } from 'd3';\nimport svgDraw from './svgDraw.js';\nimport { log } from '../../logger.js';\nimport { parser } from './parser/c4Diagram.jison';\nimport common from '../common/common.js';\nimport c4Db from './c4Db.js';\nimport { getConfig } from '../../diagram-api/diagramAPI.js';\nimport assignWithDepth from '../../assignWithDepth.js';\nimport { wrapLabel, calculateTextWidth, calculateTextHeight } from '../../utils.js';\nimport { configureSvgSize } from '../../setupGraphViewbox.js';\n\nlet globalBoundaryMaxX = 0,\n globalBoundaryMaxY = 0;\n\nlet c4ShapeInRow = 4;\nlet c4BoundaryInRow = 2;\n\nparser.yy = c4Db;\n\nlet conf = {};\n\nclass Bounds {\n constructor(diagObj) {\n this.name = '';\n this.data = {};\n this.data.startx = undefined;\n this.data.stopx = undefined;\n this.data.starty = undefined;\n this.data.stopy = undefined;\n this.data.widthLimit = undefined;\n\n this.nextData = {};\n this.nextData.startx = undefined;\n this.nextData.stopx = undefined;\n this.nextData.starty = undefined;\n this.nextData.stopy = undefined;\n this.nextData.cnt = 0;\n\n setConf(diagObj.db.getConfig());\n }\n\n setData(startx, stopx, starty, stopy) {\n this.nextData.startx = this.data.startx = startx;\n this.nextData.stopx = this.data.stopx = stopx;\n this.nextData.starty = this.data.starty = starty;\n this.nextData.stopy = this.data.stopy = stopy;\n }\n\n updateVal(obj, key, val, fun) {\n if (obj[key] === undefined) {\n obj[key] = val;\n } else {\n obj[key] = fun(val, obj[key]);\n }\n }\n\n insert(c4Shape) {\n this.nextData.cnt = this.nextData.cnt + 1;\n let _startx =\n this.nextData.startx === this.nextData.stopx\n ? this.nextData.stopx + c4Shape.margin\n : this.nextData.stopx + c4Shape.margin * 2;\n let _stopx = _startx + c4Shape.width;\n let _starty = this.nextData.starty + c4Shape.margin * 2;\n let _stopy = _starty + c4Shape.height;\n if (\n _startx >= this.data.widthLimit ||\n _stopx >= this.data.widthLimit ||\n this.nextData.cnt > c4ShapeInRow\n ) {\n _startx = this.nextData.startx + c4Shape.margin + conf.nextLinePaddingX;\n _starty = this.nextData.stopy + c4Shape.margin * 2;\n\n this.nextData.stopx = _stopx = _startx + c4Shape.width;\n this.nextData.starty = this.nextData.stopy;\n this.nextData.stopy = _stopy = _starty + c4Shape.height;\n this.nextData.cnt = 1;\n }\n\n c4Shape.x = _startx;\n c4Shape.y = _starty;\n\n this.updateVal(this.data, 'startx', _startx, Math.min);\n this.updateVal(this.data, 'starty', _starty, Math.min);\n this.updateVal(this.data, 'stopx', _stopx, Math.max);\n this.updateVal(this.data, 'stopy', _stopy, Math.max);\n\n this.updateVal(this.nextData, 'startx', _startx, Math.min);\n this.updateVal(this.nextData, 'starty', _starty, Math.min);\n this.updateVal(this.nextData, 'stopx', _stopx, Math.max);\n this.updateVal(this.nextData, 'stopy', _stopy, Math.max);\n }\n\n init(diagObj) {\n this.name = '';\n this.data = {\n startx: undefined,\n stopx: undefined,\n starty: undefined,\n stopy: undefined,\n widthLimit: undefined,\n };\n this.nextData = {\n startx: undefined,\n stopx: undefined,\n starty: undefined,\n stopy: undefined,\n cnt: 0,\n };\n setConf(diagObj.db.getConfig());\n }\n\n bumpLastMargin(margin) {\n this.data.stopx += margin;\n this.data.stopy += margin;\n }\n}\n\nexport const setConf = function (cnf) {\n assignWithDepth(conf, cnf);\n\n if (cnf.fontFamily) {\n conf.personFontFamily = conf.systemFontFamily = conf.messageFontFamily = cnf.fontFamily;\n }\n if (cnf.fontSize) {\n conf.personFontSize = conf.systemFontSize = conf.messageFontSize = cnf.fontSize;\n }\n if (cnf.fontWeight) {\n conf.personFontWeight = conf.systemFontWeight = conf.messageFontWeight = cnf.fontWeight;\n }\n};\n\nconst c4ShapeFont = (cnf, typeC4Shape) => {\n return {\n fontFamily: cnf[typeC4Shape + 'FontFamily'],\n fontSize: cnf[typeC4Shape + 'FontSize'],\n fontWeight: cnf[typeC4Shape + 'FontWeight'],\n };\n};\n\nconst boundaryFont = (cnf) => {\n return {\n fontFamily: cnf.boundaryFontFamily,\n fontSize: cnf.boundaryFontSize,\n fontWeight: cnf.boundaryFontWeight,\n };\n};\n\nconst messageFont = (cnf) => {\n return {\n fontFamily: cnf.messageFontFamily,\n fontSize: cnf.messageFontSize,\n fontWeight: cnf.messageFontWeight,\n };\n};\n\n/**\n * @param textType\n * @param c4Shape\n * @param c4ShapeTextWrap\n * @param textConf\n * @param textLimitWidth\n */\nfunction calcC4ShapeTextWH(textType, c4Shape, c4ShapeTextWrap, textConf, textLimitWidth) {\n if (!c4Shape[textType].width) {\n if (c4ShapeTextWrap) {\n c4Shape[textType].text = wrapLabel(c4Shape[textType].text, textLimitWidth, textConf);\n c4Shape[textType].textLines = c4Shape[textType].text.split(common.lineBreakRegex).length;\n // c4Shape[textType].width = calculateTextWidth(c4Shape[textType].text, textConf);\n c4Shape[textType].width = textLimitWidth;\n // c4Shape[textType].height = c4Shape[textType].textLines * textConf.fontSize;\n c4Shape[textType].height = calculateTextHeight(c4Shape[textType].text, textConf);\n } else {\n let lines = c4Shape[textType].text.split(common.lineBreakRegex);\n c4Shape[textType].textLines = lines.length;\n let lineHeight = 0;\n c4Shape[textType].height = 0;\n c4Shape[textType].width = 0;\n for (const line of lines) {\n c4Shape[textType].width = Math.max(\n calculateTextWidth(line, textConf),\n c4Shape[textType].width\n );\n lineHeight = calculateTextHeight(line, textConf);\n c4Shape[textType].height = c4Shape[textType].height + lineHeight;\n }\n // c4Shapes[textType].height = c4Shapes[textType].textLines * textConf.fontSize;\n }\n }\n}\n\nexport const drawBoundary = function (diagram, boundary, bounds) {\n boundary.x = bounds.data.startx;\n boundary.y = bounds.data.starty;\n boundary.width = bounds.data.stopx - bounds.data.startx;\n boundary.height = bounds.data.stopy - bounds.data.starty;\n\n boundary.label.y = conf.c4ShapeMargin - 35;\n\n let boundaryTextWrap = boundary.wrap && conf.wrap;\n let boundaryLabelConf = boundaryFont(conf);\n boundaryLabelConf.fontSize = boundaryLabelConf.fontSize + 2;\n boundaryLabelConf.fontWeight = 'bold';\n let textLimitWidth = calculateTextWidth(boundary.label.text, boundaryLabelConf);\n calcC4ShapeTextWH('label', boundary, boundaryTextWrap, boundaryLabelConf, textLimitWidth);\n\n svgDraw.drawBoundary(diagram, boundary, conf);\n};\n\nexport const drawC4ShapeArray = function (currentBounds, diagram, c4ShapeArray, c4ShapeKeys) {\n // Upper Y is relative point\n let Y = 0;\n // Draw the c4ShapeArray\n for (const c4ShapeKey of c4ShapeKeys) {\n Y = 0;\n const c4Shape = c4ShapeArray[c4ShapeKey];\n\n // calc c4 shape type width and height\n\n let c4ShapeTypeConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text);\n c4ShapeTypeConf.fontSize = c4ShapeTypeConf.fontSize - 2;\n c4Shape.typeC4Shape.width = calculateTextWidth(\n '\u00AB' + c4Shape.typeC4Shape.text + '\u00BB',\n c4ShapeTypeConf\n );\n c4Shape.typeC4Shape.height = c4ShapeTypeConf.fontSize + 2;\n c4Shape.typeC4Shape.Y = conf.c4ShapePadding;\n Y = c4Shape.typeC4Shape.Y + c4Shape.typeC4Shape.height - 4;\n\n // set image width and height c4Shape.x + c4Shape.width / 2 - 24, c4Shape.y + 28\n // let imageWidth = 0,\n // imageHeight = 0,\n // imageY = 0;\n //\n c4Shape.image = { width: 0, height: 0, Y: 0 };\n switch (c4Shape.typeC4Shape.text) {\n case 'person':\n case 'external_person':\n c4Shape.image.width = 48;\n c4Shape.image.height = 48;\n c4Shape.image.Y = Y;\n Y = c4Shape.image.Y + c4Shape.image.height;\n break;\n }\n if (c4Shape.sprite) {\n c4Shape.image.width = 48;\n c4Shape.image.height = 48;\n c4Shape.image.Y = Y;\n Y = c4Shape.image.Y + c4Shape.image.height;\n }\n\n // Y = conf.c4ShapePadding + c4Shape.image.height;\n\n let c4ShapeTextWrap = c4Shape.wrap && conf.wrap;\n let textLimitWidth = conf.width - conf.c4ShapePadding * 2;\n\n let c4ShapeLabelConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text);\n c4ShapeLabelConf.fontSize = c4ShapeLabelConf.fontSize + 2;\n c4ShapeLabelConf.fontWeight = 'bold';\n calcC4ShapeTextWH('label', c4Shape, c4ShapeTextWrap, c4ShapeLabelConf, textLimitWidth);\n c4Shape.label.Y = Y + 8;\n Y = c4Shape.label.Y + c4Shape.label.height;\n\n if (c4Shape.type && c4Shape.type.text !== '') {\n c4Shape.type.text = '[' + c4Shape.type.text + ']';\n let c4ShapeTypeConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text);\n calcC4ShapeTextWH('type', c4Shape, c4ShapeTextWrap, c4ShapeTypeConf, textLimitWidth);\n c4Shape.type.Y = Y + 5;\n Y = c4Shape.type.Y + c4Shape.type.height;\n } else if (c4Shape.techn && c4Shape.techn.text !== '') {\n c4Shape.techn.text = '[' + c4Shape.techn.text + ']';\n let c4ShapeTechnConf = c4ShapeFont(conf, c4Shape.techn.text);\n calcC4ShapeTextWH('techn', c4Shape, c4ShapeTextWrap, c4ShapeTechnConf, textLimitWidth);\n c4Shape.techn.Y = Y + 5;\n Y = c4Shape.techn.Y + c4Shape.techn.height;\n }\n\n let rectHeight = Y;\n let rectWidth = c4Shape.label.width;\n\n if (c4Shape.descr && c4Shape.descr.text !== '') {\n let c4ShapeDescrConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text);\n calcC4ShapeTextWH('descr', c4Shape, c4ShapeTextWrap, c4ShapeDescrConf, textLimitWidth);\n c4Shape.descr.Y = Y + 20;\n Y = c4Shape.descr.Y + c4Shape.descr.height;\n\n rectWidth = Math.max(c4Shape.label.width, c4Shape.descr.width);\n rectHeight = Y - c4Shape.descr.textLines * 5;\n }\n\n rectWidth = rectWidth + conf.c4ShapePadding;\n // let rectHeight =\n\n c4Shape.width = Math.max(c4Shape.width || conf.width, rectWidth, conf.width);\n c4Shape.height = Math.max(c4Shape.height || conf.height, rectHeight, conf.height);\n c4Shape.margin = c4Shape.margin || conf.c4ShapeMargin;\n\n currentBounds.insert(c4Shape);\n\n svgDraw.drawC4Shape(diagram, c4Shape, conf);\n }\n\n currentBounds.bumpLastMargin(conf.c4ShapeMargin);\n};\n\nclass Point {\n constructor(x, y) {\n this.x = x;\n this.y = y;\n }\n}\n\n/* * *\n * Get the intersection of the line between the center point of a rectangle and a point outside the rectangle.\n * Algorithm idea.\n * Using a point outside the rectangle as the coordinate origin, the graph is divided into four quadrants, and each quadrant is divided into two cases, with separate treatment on the coordinate axes\n * 1. The case of coordinate axes.\n * 1. The case of the negative x-axis\n * 2. The case of the positive x-axis\n * 3. The case of the positive y-axis\n * 4. The negative y-axis case\n * 2. Quadrant cases.\n * 2.1. first quadrant: the case where the line intersects the left side of the rectangle; the case where it intersects the lower side of the rectangle\n * 2.2. second quadrant: the case where the line intersects the right side of the rectangle; the case where it intersects the lower edge of the rectangle\n * 2.3. third quadrant: the case where the line intersects the right side of the rectangle; the case where it intersects the upper edge of the rectangle\n * 2.4. fourth quadrant: the case where the line intersects the left side of the rectangle; the case where it intersects the upper side of the rectangle\n *\n */\nlet getIntersectPoint = function (fromNode, endPoint) {\n let x1 = fromNode.x;\n\n let y1 = fromNode.y;\n\n let x2 = endPoint.x;\n\n let y2 = endPoint.y;\n\n let fromCenterX = x1 + fromNode.width / 2;\n\n let fromCenterY = y1 + fromNode.height / 2;\n\n let dx = Math.abs(x1 - x2);\n\n let dy = Math.abs(y1 - y2);\n\n let tanDYX = dy / dx;\n\n let fromDYX = fromNode.height / fromNode.width;\n\n let returnPoint = null;\n\n if (y1 == y2 && x1 < x2) {\n returnPoint = new Point(x1 + fromNode.width, fromCenterY);\n } else if (y1 == y2 && x1 > x2) {\n returnPoint = new Point(x1, fromCenterY);\n } else if (x1 == x2 && y1 < y2) {\n returnPoint = new Point(fromCenterX, y1 + fromNode.height);\n } else if (x1 == x2 && y1 > y2) {\n returnPoint = new Point(fromCenterX, y1);\n }\n\n if (x1 > x2 && y1 < y2) {\n if (fromDYX >= tanDYX) {\n returnPoint = new Point(x1, fromCenterY + (tanDYX * fromNode.width) / 2);\n } else {\n returnPoint = new Point(\n fromCenterX - ((dx / dy) * fromNode.height) / 2,\n y1 + fromNode.height\n );\n }\n } else if (x1 < x2 && y1 < y2) {\n //\n if (fromDYX >= tanDYX) {\n returnPoint = new Point(x1 + fromNode.width, fromCenterY + (tanDYX * fromNode.width) / 2);\n } else {\n returnPoint = new Point(\n fromCenterX + ((dx / dy) * fromNode.height) / 2,\n y1 + fromNode.height\n );\n }\n } else if (x1 < x2 && y1 > y2) {\n if (fromDYX >= tanDYX) {\n returnPoint = new Point(x1 + fromNode.width, fromCenterY - (tanDYX * fromNode.width) / 2);\n } else {\n returnPoint = new Point(fromCenterX + ((fromNode.height / 2) * dx) / dy, y1);\n }\n } else if (x1 > x2 && y1 > y2) {\n if (fromDYX >= tanDYX) {\n returnPoint = new Point(x1, fromCenterY - (fromNode.width / 2) * tanDYX);\n } else {\n returnPoint = new Point(fromCenterX - ((fromNode.height / 2) * dx) / dy, y1);\n }\n }\n return returnPoint;\n};\n\nlet getIntersectPoints = function (fromNode, endNode) {\n let endIntersectPoint = { x: 0, y: 0 };\n endIntersectPoint.x = endNode.x + endNode.width / 2;\n endIntersectPoint.y = endNode.y + endNode.height / 2;\n let startPoint = getIntersectPoint(fromNode, endIntersectPoint);\n\n endIntersectPoint.x = fromNode.x + fromNode.width / 2;\n endIntersectPoint.y = fromNode.y + fromNode.height / 2;\n let endPoint = getIntersectPoint(endNode, endIntersectPoint);\n return { startPoint: startPoint, endPoint: endPoint };\n};\n\nexport const drawRels = function (diagram, rels, getC4ShapeObj, diagObj) {\n let i = 0;\n for (let rel of rels) {\n i = i + 1;\n let relTextWrap = rel.wrap && conf.wrap;\n let relConf = messageFont(conf);\n let diagramType = diagObj.db.getC4Type();\n if (diagramType === 'C4Dynamic') {\n rel.label.text = i + ': ' + rel.label.text;\n }\n let textLimitWidth = calculateTextWidth(rel.label.text, relConf);\n calcC4ShapeTextWH('label', rel, relTextWrap, relConf, textLimitWidth);\n\n if (rel.techn && rel.techn.text !== '') {\n textLimitWidth = calculateTextWidth(rel.techn.text, relConf);\n calcC4ShapeTextWH('techn', rel, relTextWrap, relConf, textLimitWidth);\n }\n\n if (rel.descr && rel.descr.text !== '') {\n textLimitWidth = calculateTextWidth(rel.descr.text, relConf);\n calcC4ShapeTextWH('descr', rel, relTextWrap, relConf, textLimitWidth);\n }\n\n let fromNode = getC4ShapeObj(rel.from);\n let endNode = getC4ShapeObj(rel.to);\n let points = getIntersectPoints(fromNode, endNode);\n rel.startPoint = points.startPoint;\n rel.endPoint = points.endPoint;\n }\n svgDraw.drawRels(diagram, rels, conf);\n};\n\n/**\n * @param diagram\n * @param parentBoundaryAlias\n * @param parentBounds\n * @param currentBoundaries\n * @param diagObj\n */\nfunction drawInsideBoundary(\n diagram,\n parentBoundaryAlias,\n parentBounds,\n currentBoundaries,\n diagObj\n) {\n let currentBounds = new Bounds(diagObj);\n // Calculate the width limit of the boundary. label/type \u7684\u957F\u5EA6\uFF0C\n currentBounds.data.widthLimit =\n parentBounds.data.widthLimit / Math.min(c4BoundaryInRow, currentBoundaries.length);\n // Math.min(\n // conf.width * conf.c4ShapeInRow + conf.c4ShapeMargin * conf.c4ShapeInRow * 2,\n // parentBounds.data.widthLimit / Math.min(conf.c4BoundaryInRow, currentBoundaries.length)\n // );\n for (let [i, currentBoundary] of currentBoundaries.entries()) {\n let Y = 0;\n currentBoundary.image = { width: 0, height: 0, Y: 0 };\n if (currentBoundary.sprite) {\n currentBoundary.image.width = 48;\n currentBoundary.image.height = 48;\n currentBoundary.image.Y = Y;\n Y = currentBoundary.image.Y + currentBoundary.image.height;\n }\n\n let currentBoundaryTextWrap = currentBoundary.wrap && conf.wrap;\n\n let currentBoundaryLabelConf = boundaryFont(conf);\n currentBoundaryLabelConf.fontSize = currentBoundaryLabelConf.fontSize + 2;\n currentBoundaryLabelConf.fontWeight = 'bold';\n calcC4ShapeTextWH(\n 'label',\n currentBoundary,\n currentBoundaryTextWrap,\n currentBoundaryLabelConf,\n currentBounds.data.widthLimit\n );\n currentBoundary.label.Y = Y + 8;\n Y = currentBoundary.label.Y + currentBoundary.label.height;\n\n if (currentBoundary.type && currentBoundary.type.text !== '') {\n currentBoundary.type.text = '[' + currentBoundary.type.text + ']';\n let currentBoundaryTypeConf = boundaryFont(conf);\n calcC4ShapeTextWH(\n 'type',\n currentBoundary,\n currentBoundaryTextWrap,\n currentBoundaryTypeConf,\n currentBounds.data.widthLimit\n );\n currentBoundary.type.Y = Y + 5;\n Y = currentBoundary.type.Y + currentBoundary.type.height;\n }\n\n if (currentBoundary.descr && currentBoundary.descr.text !== '') {\n let currentBoundaryDescrConf = boundaryFont(conf);\n currentBoundaryDescrConf.fontSize = currentBoundaryDescrConf.fontSize - 2;\n calcC4ShapeTextWH(\n 'descr',\n currentBoundary,\n currentBoundaryTextWrap,\n currentBoundaryDescrConf,\n currentBounds.data.widthLimit\n );\n currentBoundary.descr.Y = Y + 20;\n Y = currentBoundary.descr.Y + currentBoundary.descr.height;\n }\n\n if (i == 0 || i % c4BoundaryInRow === 0) {\n // Calculate the drawing start point of the currentBoundaries.\n let _x = parentBounds.data.startx + conf.diagramMarginX;\n let _y = parentBounds.data.stopy + conf.diagramMarginY + Y;\n\n currentBounds.setData(_x, _x, _y, _y);\n } else {\n // Calculate the drawing start point of the currentBoundaries.\n let _x =\n currentBounds.data.stopx !== currentBounds.data.startx\n ? currentBounds.data.stopx + conf.diagramMarginX\n : currentBounds.data.startx;\n let _y = currentBounds.data.starty;\n\n currentBounds.setData(_x, _x, _y, _y);\n }\n currentBounds.name = currentBoundary.alias;\n let currentPersonOrSystemArray = diagObj.db.getC4ShapeArray(currentBoundary.alias);\n let currentPersonOrSystemKeys = diagObj.db.getC4ShapeKeys(currentBoundary.alias);\n\n if (currentPersonOrSystemKeys.length > 0) {\n drawC4ShapeArray(\n currentBounds,\n diagram,\n currentPersonOrSystemArray,\n currentPersonOrSystemKeys\n );\n }\n parentBoundaryAlias = currentBoundary.alias;\n let nextCurrentBoundaries = diagObj.db.getBoundarys(parentBoundaryAlias);\n\n if (nextCurrentBoundaries.length > 0) {\n // draw boundary inside currentBoundary\n drawInsideBoundary(\n diagram,\n parentBoundaryAlias,\n currentBounds,\n nextCurrentBoundaries,\n diagObj\n );\n }\n // draw boundary\n if (currentBoundary.alias !== 'global') {\n drawBoundary(diagram, currentBoundary, currentBounds);\n }\n parentBounds.data.stopy = Math.max(\n currentBounds.data.stopy + conf.c4ShapeMargin,\n parentBounds.data.stopy\n );\n parentBounds.data.stopx = Math.max(\n currentBounds.data.stopx + conf.c4ShapeMargin,\n parentBounds.data.stopx\n );\n globalBoundaryMaxX = Math.max(globalBoundaryMaxX, parentBounds.data.stopx);\n globalBoundaryMaxY = Math.max(globalBoundaryMaxY, parentBounds.data.stopy);\n }\n}\n\n/**\n * Draws a sequenceDiagram in the tag with id: id based on the graph definition in text.\n *\n * @param {any} _text\n * @param {any} id\n * @param {any} _version\n * @param diagObj\n */\nexport const draw = function (_text, id, _version, diagObj) {\n conf = getConfig().c4;\n const securityLevel = getConfig().securityLevel;\n // Handle root and Document for when rendering in sandbox mode\n let sandboxElement;\n if (securityLevel === 'sandbox') {\n sandboxElement = select('#i' + id);\n }\n const root =\n securityLevel === 'sandbox'\n ? select(sandboxElement.nodes()[0].contentDocument.body)\n : select('body');\n\n let db = diagObj.db;\n\n diagObj.db.setWrap(conf.wrap);\n\n c4ShapeInRow = db.getC4ShapeInRow();\n c4BoundaryInRow = db.getC4BoundaryInRow();\n\n log.debug(`C:${JSON.stringify(conf, null, 2)}`);\n\n const diagram =\n securityLevel === 'sandbox' ? root.select(`[id=\"${id}\"]`) : select(`[id=\"${id}\"]`);\n\n svgDraw.insertComputerIcon(diagram);\n svgDraw.insertDatabaseIcon(diagram);\n svgDraw.insertClockIcon(diagram);\n\n let screenBounds = new Bounds(diagObj);\n\n screenBounds.setData(\n conf.diagramMarginX,\n conf.diagramMarginX,\n conf.diagramMarginY,\n conf.diagramMarginY\n );\n\n screenBounds.data.widthLimit = screen.availWidth;\n globalBoundaryMaxX = conf.diagramMarginX;\n globalBoundaryMaxY = conf.diagramMarginY;\n\n const title = diagObj.db.getTitle();\n let currentBoundaries = diagObj.db.getBoundarys('');\n // switch (c4type) {\n // case 'C4Context':\n drawInsideBoundary(diagram, '', screenBounds, currentBoundaries, diagObj);\n // break;\n // }\n\n // The arrow head definition is attached to the svg once\n svgDraw.insertArrowHead(diagram);\n svgDraw.insertArrowEnd(diagram);\n svgDraw.insertArrowCrossHead(diagram);\n svgDraw.insertArrowFilledHead(diagram);\n\n drawRels(diagram, diagObj.db.getRels(), diagObj.db.getC4Shape, diagObj);\n\n screenBounds.data.stopx = globalBoundaryMaxX;\n screenBounds.data.stopy = globalBoundaryMaxY;\n\n const box = screenBounds.data;\n\n // Make sure the height of the diagram supports long menus.\n let boxHeight = box.stopy - box.starty;\n\n let height = boxHeight + 2 * conf.diagramMarginY;\n\n // Make sure the width of the diagram supports wide menus.\n let boxWidth = box.stopx - box.startx;\n const width = boxWidth + 2 * conf.diagramMarginX;\n\n if (title) {\n diagram\n .append('text')\n .text(title)\n .attr('x', (box.stopx - box.startx) / 2 - 4 * conf.diagramMarginX)\n .attr('y', box.starty + conf.diagramMarginY);\n }\n\n configureSvgSize(diagram, height, width, conf.useMaxWidth);\n\n const extraVertForTitle = title ? 60 : 0;\n diagram.attr(\n 'viewBox',\n box.startx -\n conf.diagramMarginX +\n ' -' +\n (conf.diagramMarginY + extraVertForTitle) +\n ' ' +\n width +\n ' ' +\n (height + extraVertForTitle)\n );\n\n log.debug(`models:`, box);\n};\n\nexport default {\n drawPersonOrSystemArray: drawC4ShapeArray,\n drawBoundary,\n setConf,\n draw,\n};\n", "const getStyles = (options) =>\n `.person {\n stroke: ${options.personBorder};\n fill: ${options.personBkg};\n }\n`;\n\nexport default getStyles;\n", "// @ts-ignore: JISON doesn't support types\nimport parser from './parser/c4Diagram.jison';\nimport db from './c4Db.js';\nimport renderer from './c4Renderer.js';\nimport styles from './styles.js';\nimport type { MermaidConfig } from '../../config.type.js';\nimport type { DiagramDefinition } from '../../diagram-api/types.js';\n\nexport const diagram: DiagramDefinition = {\n parser,\n db,\n renderer,\n styles,\n init: ({ c4, wrap }: MermaidConfig) => {\n renderer.setConf(c4);\n db.setWrap(wrap);\n },\n};\n", "import { select } from 'd3';\nimport utils, { getEdgeId } from '../../utils.js';\nimport { getConfig, defaultConfig } from '../../diagram-api/diagramAPI.js';\nimport common from '../common/common.js';\nimport type { Node, Edge } from '../../rendering-util/types.js';\nimport { log } from '../../logger.js';\nimport {\n setAccTitle,\n getAccTitle,\n getAccDescription,\n setAccDescription,\n clear as commonClear,\n setDiagramTitle,\n getDiagramTitle,\n} from '../common/commonDb.js';\nimport type { FlowVertex, FlowClass, FlowSubGraph, FlowText, FlowEdge, FlowLink } from './types.js';\n\nconst MERMAID_DOM_ID_PREFIX = 'flowchart-';\nlet vertexCounter = 0;\nlet config = getConfig();\nlet vertices = new Map();\nlet edges: FlowEdge[] & { defaultInterpolate?: string; defaultStyle?: string[] } = [];\nlet classes = new Map();\nlet subGraphs: FlowSubGraph[] = [];\nlet subGraphLookup = new Map();\nlet tooltips = new Map();\nlet subCount = 0;\nlet firstGraphFlag = true;\nlet direction: string;\n\nlet version: string; // As in graph\n\n// Functions to be run after graph rendering\nlet funs: ((element: Element) => void)[] = []; // cspell:ignore funs\n\nconst sanitizeText = (txt: string) => common.sanitizeText(txt, config);\n\n/**\n * Function to lookup domId from id in the graph definition.\n *\n * @param id - id of the node\n */\nexport const lookUpDomId = function (id: string) {\n for (const vertex of vertices.values()) {\n if (vertex.id === id) {\n return vertex.domId;\n }\n }\n return id;\n};\n\n/**\n * Function called by parser when a node definition has been found\n *\n */\nexport const addVertex = function (\n id: string,\n textObj: FlowText,\n type: 'group',\n style: string[],\n classes: string[],\n dir: string,\n props = {}\n) {\n if (!id || id.trim().length === 0) {\n return;\n }\n let txt;\n\n let vertex = vertices.get(id);\n if (vertex === undefined) {\n vertex = {\n id,\n labelType: 'text',\n domId: MERMAID_DOM_ID_PREFIX + id + '-' + vertexCounter,\n styles: [],\n classes: [],\n };\n vertices.set(id, vertex);\n }\n vertexCounter++;\n\n if (textObj !== undefined) {\n config = getConfig();\n txt = sanitizeText(textObj.text.trim());\n vertex.labelType = textObj.type;\n // strip quotes if string starts and ends with a quote\n if (txt.startsWith('\"') && txt.endsWith('\"')) {\n txt = txt.substring(1, txt.length - 1);\n }\n vertex.text = txt;\n } else {\n if (vertex.text === undefined) {\n vertex.text = id;\n }\n }\n if (type !== undefined) {\n vertex.type = type;\n }\n if (style !== undefined && style !== null) {\n style.forEach(function (s) {\n vertex.styles.push(s);\n });\n }\n if (classes !== undefined && classes !== null) {\n classes.forEach(function (s) {\n vertex.classes.push(s);\n });\n }\n if (dir !== undefined) {\n vertex.dir = dir;\n }\n if (vertex.props === undefined) {\n vertex.props = props;\n } else if (props !== undefined) {\n Object.assign(vertex.props, props);\n }\n};\n\n/**\n * Function called by parser when a link/edge definition has been found\n *\n */\nexport const addSingleLink = function (_start: string, _end: string, type: any) {\n const start = _start;\n const end = _end;\n\n const edge: FlowEdge = { start: start, end: end, type: undefined, text: '', labelType: 'text' };\n log.info('abc78 Got edge...', edge);\n const linkTextObj = type.text;\n\n if (linkTextObj !== undefined) {\n edge.text = sanitizeText(linkTextObj.text.trim());\n\n // strip quotes if string starts and ends with a quote\n if (edge.text.startsWith('\"') && edge.text.endsWith('\"')) {\n edge.text = edge.text.substring(1, edge.text.length - 1);\n }\n edge.labelType = linkTextObj.type;\n }\n\n if (type !== undefined) {\n edge.type = type.type;\n edge.stroke = type.stroke;\n edge.length = type.length > 10 ? 10 : type.length;\n }\n\n if (edges.length < (config.maxEdges ?? 500)) {\n log.info('Pushing edge...');\n edges.push(edge);\n } else {\n throw new Error(\n `Edge limit exceeded. ${edges.length} edges found, but the limit is ${config.maxEdges}.\n\nInitialize mermaid with maxEdges set to a higher number to allow more edges.\nYou cannot set this config via configuration inside the diagram as it is a secure config.\nYou have to call mermaid.initialize.`\n );\n }\n};\n\nexport const addLink = function (_start: string[], _end: string[], type: unknown) {\n log.info('addLink', _start, _end, type);\n for (const start of _start) {\n for (const end of _end) {\n addSingleLink(start, end, type);\n }\n }\n};\n\n/**\n * Updates a link's line interpolation algorithm\n *\n */\nexport const updateLinkInterpolate = function (\n positions: ('default' | number)[],\n interpolate: string\n) {\n positions.forEach(function (pos) {\n if (pos === 'default') {\n edges.defaultInterpolate = interpolate;\n } else {\n edges[pos].interpolate = interpolate;\n }\n });\n};\n\n/**\n * Updates a link with a style\n *\n */\nexport const updateLink = function (positions: ('default' | number)[], style: string[]) {\n positions.forEach(function (pos) {\n if (typeof pos === 'number' && pos >= edges.length) {\n throw new Error(\n `The index ${pos} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${\n edges.length - 1\n }. (Help: Ensure that the index is within the range of existing edges.)`\n );\n }\n if (pos === 'default') {\n edges.defaultStyle = style;\n } else {\n // if (utils.isSubstringInArray('fill', style) === -1) {\n // style.push('fill:none');\n // }\n edges[pos].style = style;\n // if edges[pos].style does have fill not set, set it to none\n if (\n (edges[pos]?.style?.length ?? 0) > 0 &&\n !edges[pos]?.style?.some((s) => s?.startsWith('fill'))\n ) {\n edges[pos]?.style?.push('fill:none');\n }\n }\n });\n};\n\nexport const addClass = function (ids: string, style: string[]) {\n ids.split(',').forEach(function (id) {\n let classNode = classes.get(id);\n if (classNode === undefined) {\n classNode = { id, styles: [], textStyles: [] };\n classes.set(id, classNode);\n }\n\n if (style !== undefined && style !== null) {\n style.forEach(function (s) {\n if (/color/.exec(s)) {\n const newStyle = s.replace('fill', 'bgFill'); // .replace('color', 'fill');\n classNode.textStyles.push(newStyle);\n }\n classNode.styles.push(s);\n });\n }\n });\n};\n\n/**\n * Called by parser when a graph definition is found, stores the direction of the chart.\n *\n */\nexport const setDirection = function (dir: string) {\n direction = dir;\n if (/.*/.exec(direction)) {\n direction = 'LR';\n }\n if (/.*v/.exec(direction)) {\n direction = 'TB';\n }\n if (direction === 'TD') {\n direction = 'TB';\n }\n};\n\n/**\n * Called by parser when a special node is found, e.g. a clickable element.\n *\n * @param ids - Comma separated list of ids\n * @param className - Class to add\n */\nexport const setClass = function (ids: string, className: string) {\n for (const id of ids.split(',')) {\n const vertex = vertices.get(id);\n if (vertex) {\n vertex.classes.push(className);\n }\n const subGraph = subGraphLookup.get(id);\n if (subGraph) {\n subGraph.classes.push(className);\n }\n }\n};\n\nconst setTooltip = function (ids: string, tooltip: string) {\n if (tooltip === undefined) {\n return;\n }\n tooltip = sanitizeText(tooltip);\n for (const id of ids.split(',')) {\n tooltips.set(version === 'gen-1' ? lookUpDomId(id) : id, tooltip);\n }\n};\n\nconst setClickFun = function (id: string, functionName: string, functionArgs: string) {\n const domId = lookUpDomId(id);\n // if (_id[0].match(/\\d/)) id = MERMAID_DOM_ID_PREFIX + id;\n if (getConfig().securityLevel !== 'loose') {\n return;\n }\n if (functionName === undefined) {\n return;\n }\n let argList: string[] = [];\n if (typeof functionArgs === 'string') {\n /* Splits functionArgs by ',', ignoring all ',' in double quoted strings */\n argList = functionArgs.split(/,(?=(?:(?:[^\"]*\"){2})*[^\"]*$)/);\n for (let i = 0; i < argList.length; i++) {\n let item = argList[i].trim();\n /* Removes all double quotes at the start and end of an argument */\n /* This preserves all starting and ending whitespace inside */\n if (item.startsWith('\"') && item.endsWith('\"')) {\n item = item.substr(1, item.length - 2);\n }\n argList[i] = item;\n }\n }\n\n /* if no arguments passed into callback, default to passing in id */\n if (argList.length === 0) {\n argList.push(id);\n }\n\n const vertex = vertices.get(id);\n if (vertex) {\n vertex.haveCallback = true;\n funs.push(function () {\n const elem = document.querySelector(`[id=\"${domId}\"]`);\n if (elem !== null) {\n elem.addEventListener(\n 'click',\n function () {\n utils.runFunc(functionName, ...argList);\n },\n false\n );\n }\n });\n }\n};\n\n/**\n * Called by parser when a link is found. Adds the URL to the vertex data.\n *\n * @param ids - Comma separated list of ids\n * @param linkStr - URL to create a link for\n * @param target - Target attribute for the link\n */\nexport const setLink = function (ids: string, linkStr: string, target: string) {\n ids.split(',').forEach(function (id) {\n const vertex = vertices.get(id);\n if (vertex !== undefined) {\n vertex.link = utils.formatUrl(linkStr, config);\n vertex.linkTarget = target;\n }\n });\n setClass(ids, 'clickable');\n};\n\nexport const getTooltip = function (id: string) {\n return tooltips.get(id);\n};\n\n/**\n * Called by parser when a click definition is found. Registers an event handler.\n *\n * @param ids - Comma separated list of ids\n * @param functionName - Function to be called on click\n * @param functionArgs - Arguments to be passed to the function\n */\nexport const setClickEvent = function (ids: string, functionName: string, functionArgs: string) {\n ids.split(',').forEach(function (id) {\n setClickFun(id, functionName, functionArgs);\n });\n setClass(ids, 'clickable');\n};\n\nexport const bindFunctions = function (element: Element) {\n funs.forEach(function (fun) {\n fun(element);\n });\n};\nexport const getDirection = function () {\n return direction.trim();\n};\n/**\n * Retrieval function for fetching the found nodes after parsing has completed.\n *\n */\nexport const getVertices = function () {\n return vertices;\n};\n\n/**\n * Retrieval function for fetching the found links after parsing has completed.\n *\n */\nexport const getEdges = function () {\n return edges;\n};\n\n/**\n * Retrieval function for fetching the found class definitions after parsing has completed.\n *\n */\nexport const getClasses = function () {\n return classes;\n};\n\nconst setupToolTips = function (element: Element) {\n let tooltipElem = select('.mermaidTooltip');\n // @ts-ignore TODO: fix this\n if ((tooltipElem._groups || tooltipElem)[0][0] === null) {\n // @ts-ignore TODO: fix this\n tooltipElem = select('body').append('div').attr('class', 'mermaidTooltip').style('opacity', 0);\n }\n\n const svg = select(element).select('svg');\n\n const nodes = svg.selectAll('g.node');\n nodes\n .on('mouseover', function () {\n const el = select(this);\n const title = el.attr('title');\n\n // Don't try to draw a tooltip if no data is provided\n if (title === null) {\n return;\n }\n const rect = (this as Element)?.getBoundingClientRect();\n\n // @ts-ignore TODO: fix this\n tooltipElem.transition().duration(200).style('opacity', '.9');\n tooltipElem\n .text(el.attr('title'))\n .style('left', window.scrollX + rect.left + (rect.right - rect.left) / 2 + 'px')\n .style('top', window.scrollY + rect.bottom + 'px');\n tooltipElem.html(tooltipElem.html().replace(/<br\\/>/g, ' '));\n el.classed('hover', true);\n })\n .on('mouseout', function () {\n // @ts-ignore TODO: fix this\n tooltipElem.transition().duration(500).style('opacity', 0);\n const el = select(this);\n el.classed('hover', false);\n });\n};\nfuns.push(setupToolTips);\n\n/**\n * Clears the internal graph db so that a new graph can be parsed.\n *\n */\nexport const clear = function (ver = 'gen-1') {\n vertices = new Map();\n classes = new Map();\n edges = [];\n funs = [setupToolTips];\n subGraphs = [];\n subGraphLookup = new Map();\n subCount = 0;\n tooltips = new Map();\n firstGraphFlag = true;\n version = ver;\n config = getConfig();\n commonClear();\n};\n\nexport const setGen = (ver: string) => {\n version = ver || 'gen-2';\n};\n\nexport const defaultStyle = function () {\n return 'fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;';\n};\n\nexport const addSubGraph = function (\n _id: { text: string },\n list: string[],\n _title: { text: string; type: string }\n) {\n let id: string | undefined = _id.text.trim();\n let title = _title.text;\n if (_id === _title && /\\s/.exec(_title.text)) {\n id = undefined;\n }\n\n function uniq(a: any[]) {\n const prims: any = { boolean: {}, number: {}, string: {} };\n const objs: any[] = [];\n\n let dir; // = undefined; direction.trim();\n const nodeList = a.filter(function (item) {\n const type = typeof item;\n if (item.stmt && item.stmt === 'dir') {\n dir = item.value;\n return false;\n }\n if (item.trim() === '') {\n return false;\n }\n if (type in prims) {\n return prims[type].hasOwnProperty(item) ? false : (prims[type][item] = true);\n } else {\n return objs.includes(item) ? false : objs.push(item);\n }\n });\n return { nodeList, dir };\n }\n\n const { nodeList, dir } = uniq(list.flat());\n if (version === 'gen-1') {\n for (let i = 0; i < nodeList.length; i++) {\n nodeList[i] = lookUpDomId(nodeList[i]);\n }\n }\n\n id = id ?? 'subGraph' + subCount;\n title = title || '';\n title = sanitizeText(title);\n subCount = subCount + 1;\n const subGraph = {\n id: id,\n nodes: nodeList,\n title: title.trim(),\n classes: [],\n dir,\n labelType: _title.type,\n };\n\n log.info('Adding', subGraph.id, subGraph.nodes, subGraph.dir);\n\n // Remove the members in the new subgraph if they already belong to another subgraph\n subGraph.nodes = makeUniq(subGraph, subGraphs).nodes;\n subGraphs.push(subGraph);\n subGraphLookup.set(id, subGraph);\n return id;\n};\n\nconst getPosForId = function (id: string) {\n for (const [i, subGraph] of subGraphs.entries()) {\n if (subGraph.id === id) {\n return i;\n }\n }\n return -1;\n};\nlet secCount = -1;\nconst posCrossRef: number[] = [];\nconst indexNodes2 = function (id: string, pos: number): { result: boolean; count: number } {\n const nodes = subGraphs[pos].nodes;\n secCount = secCount + 1;\n if (secCount > 2000) {\n return {\n result: false,\n count: 0,\n };\n }\n posCrossRef[secCount] = pos;\n // Check if match\n if (subGraphs[pos].id === id) {\n return {\n result: true,\n count: 0,\n };\n }\n\n let count = 0;\n let posCount = 1;\n while (count < nodes.length) {\n const childPos = getPosForId(nodes[count]);\n // Ignore regular nodes (pos will be -1)\n if (childPos >= 0) {\n const res = indexNodes2(id, childPos);\n if (res.result) {\n return {\n result: true,\n count: posCount + res.count,\n };\n } else {\n posCount = posCount + res.count;\n }\n }\n count = count + 1;\n }\n\n return {\n result: false,\n count: posCount,\n };\n};\n\nexport const getDepthFirstPos = function (pos: number) {\n return posCrossRef[pos];\n};\nexport const indexNodes = function () {\n secCount = -1;\n if (subGraphs.length > 0) {\n indexNodes2('none', subGraphs.length - 1);\n }\n};\n\nexport const getSubGraphs = function () {\n return subGraphs;\n};\n\nexport const firstGraph = () => {\n if (firstGraphFlag) {\n firstGraphFlag = false;\n return true;\n }\n return false;\n};\n\nconst destructStartLink = (_str: string): FlowLink => {\n let str = _str.trim();\n let type = 'arrow_open';\n\n switch (str[0]) {\n case '<':\n type = 'arrow_point';\n str = str.slice(1);\n break;\n case 'x':\n type = 'arrow_cross';\n str = str.slice(1);\n break;\n case 'o':\n type = 'arrow_circle';\n str = str.slice(1);\n break;\n }\n\n let stroke = 'normal';\n\n if (str.includes('=')) {\n stroke = 'thick';\n }\n\n if (str.includes('.')) {\n stroke = 'dotted';\n }\n\n return { type, stroke };\n};\n\nconst countChar = (char: string, str: string) => {\n const length = str.length;\n let count = 0;\n for (let i = 0; i < length; ++i) {\n if (str[i] === char) {\n ++count;\n }\n }\n return count;\n};\n\nconst destructEndLink = (_str: string) => {\n const str = _str.trim();\n let line = str.slice(0, -1);\n let type = 'arrow_open';\n\n switch (str.slice(-1)) {\n case 'x':\n type = 'arrow_cross';\n if (str.startsWith('x')) {\n type = 'double_' + type;\n line = line.slice(1);\n }\n break;\n case '>':\n type = 'arrow_point';\n if (str.startsWith('<')) {\n type = 'double_' + type;\n line = line.slice(1);\n }\n break;\n case 'o':\n type = 'arrow_circle';\n if (str.startsWith('o')) {\n type = 'double_' + type;\n line = line.slice(1);\n }\n break;\n }\n\n let stroke = 'normal';\n let length = line.length - 1;\n\n if (line.startsWith('=')) {\n stroke = 'thick';\n }\n\n if (line.startsWith('~')) {\n stroke = 'invisible';\n }\n\n const dots = countChar('.', line);\n\n if (dots) {\n stroke = 'dotted';\n length = dots;\n }\n\n return { type, stroke, length };\n};\n\nexport const destructLink = (_str: string, _startStr: string) => {\n const info = destructEndLink(_str);\n let startInfo;\n if (_startStr) {\n startInfo = destructStartLink(_startStr);\n\n if (startInfo.stroke !== info.stroke) {\n return { type: 'INVALID', stroke: 'INVALID' };\n }\n\n if (startInfo.type === 'arrow_open') {\n // -- xyz --> - take arrow type from ending\n startInfo.type = info.type;\n } else {\n // x-- xyz --> - not supported\n if (startInfo.type !== info.type) {\n return { type: 'INVALID', stroke: 'INVALID' };\n }\n\n startInfo.type = 'double_' + startInfo.type;\n }\n\n if (startInfo.type === 'double_arrow') {\n startInfo.type = 'double_arrow_point';\n }\n\n startInfo.length = info.length;\n return startInfo;\n }\n\n return info;\n};\n\n// Todo optimizer this by caching existing nodes\nconst exists = (allSgs: FlowSubGraph[], _id: string) => {\n for (const sg of allSgs) {\n if (sg.nodes.includes(_id)) {\n return true;\n }\n }\n return false;\n};\n/**\n * Deletes an id from all subgraphs\n *\n */\nconst makeUniq = (sg: FlowSubGraph, allSubgraphs: FlowSubGraph[]) => {\n const res: string[] = [];\n sg.nodes.forEach((_id, pos) => {\n if (!exists(allSubgraphs, _id)) {\n res.push(sg.nodes[pos]);\n }\n });\n return { nodes: res };\n};\n\nexport const lex = {\n firstGraph,\n};\n\nconst getTypeFromVertex = (vertex: FlowVertex) => {\n if (vertex.type === 'square') {\n return 'squareRect';\n }\n if (vertex.type === 'round') {\n return 'roundedRect';\n }\n\n return vertex.type ?? 'squareRect';\n};\n\nconst findNode = (nodes: Node[], id: string) => nodes.find((node) => node.id === id);\nconst destructEdgeType = (type: string | undefined) => {\n let arrowTypeStart = 'none';\n let arrowTypeEnd = 'arrow_point';\n switch (type) {\n case 'arrow_point':\n case 'arrow_circle':\n case 'arrow_cross':\n arrowTypeEnd = type;\n break;\n\n case 'double_arrow_point':\n case 'double_arrow_circle':\n case 'double_arrow_cross':\n arrowTypeStart = type.replace('double_', '');\n arrowTypeEnd = arrowTypeStart;\n break;\n }\n return { arrowTypeStart, arrowTypeEnd };\n};\n\nconst addNodeFromVertex = (\n vertex: FlowVertex,\n nodes: Node[],\n parentDB: Map,\n subGraphDB: Map,\n config: any,\n look: string\n) => {\n const parentId = parentDB.get(vertex.id);\n const isGroup = subGraphDB.get(vertex.id) ?? false;\n\n const node = findNode(nodes, vertex.id);\n if (node) {\n node.cssStyles = vertex.styles;\n node.cssCompiledStyles = getCompiledStyles(vertex.classes);\n node.cssClasses = vertex.classes.join(' ');\n } else {\n nodes.push({\n id: vertex.id,\n label: vertex.text,\n labelStyle: '',\n parentId,\n padding: config.flowchart?.padding || 8,\n cssStyles: vertex.styles,\n cssCompiledStyles: getCompiledStyles(['default', 'node', ...vertex.classes]),\n cssClasses: 'default ' + vertex.classes.join(' '),\n shape: getTypeFromVertex(vertex),\n dir: vertex.dir,\n domId: vertex.domId,\n isGroup,\n look,\n link: vertex.link,\n linkTarget: vertex.linkTarget,\n tooltip: getTooltip(vertex.id),\n });\n }\n};\n\nfunction getCompiledStyles(classDefs: string[]) {\n let compiledStyles: string[] = [];\n for (const customClass of classDefs) {\n const cssClass = classes.get(customClass);\n if (cssClass?.styles) {\n compiledStyles = [...compiledStyles, ...(cssClass.styles ?? [])].map((s) => s.trim());\n }\n if (cssClass?.textStyles) {\n compiledStyles = [...compiledStyles, ...(cssClass.textStyles ?? [])].map((s) => s.trim());\n }\n }\n return compiledStyles;\n}\n\nexport const getData = () => {\n const config = getConfig();\n const nodes: Node[] = [];\n const edges: Edge[] = [];\n\n const subGraphs = getSubGraphs();\n const parentDB = new Map();\n const subGraphDB = new Map();\n\n // Setup the subgraph data for adding nodes\n for (let i = subGraphs.length - 1; i >= 0; i--) {\n const subGraph = subGraphs[i];\n if (subGraph.nodes.length > 0) {\n subGraphDB.set(subGraph.id, true);\n }\n for (const id of subGraph.nodes) {\n parentDB.set(id, subGraph.id);\n }\n }\n\n // Data is setup, add the nodes\n for (let i = subGraphs.length - 1; i >= 0; i--) {\n const subGraph = subGraphs[i];\n nodes.push({\n id: subGraph.id,\n label: subGraph.title,\n labelStyle: '',\n parentId: parentDB.get(subGraph.id),\n padding: 8,\n cssCompiledStyles: getCompiledStyles(subGraph.classes),\n cssClasses: subGraph.classes.join(' '),\n shape: 'rect',\n dir: subGraph.dir,\n isGroup: true,\n look: config.look,\n });\n }\n\n const n = getVertices();\n n.forEach((vertex) => {\n addNodeFromVertex(vertex, nodes, parentDB, subGraphDB, config, config.look || 'classic');\n });\n\n const e = getEdges();\n e.forEach((rawEdge, index) => {\n const { arrowTypeStart, arrowTypeEnd } = destructEdgeType(rawEdge.type);\n const styles = [...(e.defaultStyle ?? [])];\n\n if (rawEdge.style) {\n styles.push(...rawEdge.style);\n }\n const edge: Edge = {\n id: getEdgeId(rawEdge.start, rawEdge.end, { counter: index, prefix: 'L' }),\n start: rawEdge.start,\n end: rawEdge.end,\n type: rawEdge.type ?? 'normal',\n label: rawEdge.text,\n labelpos: 'c',\n thickness: rawEdge.stroke,\n minlen: rawEdge.length,\n classes:\n rawEdge?.stroke === 'invisible'\n ? ''\n : 'edge-thickness-normal edge-pattern-solid flowchart-link',\n arrowTypeStart: rawEdge?.stroke === 'invisible' ? 'none' : arrowTypeStart,\n arrowTypeEnd: rawEdge?.stroke === 'invisible' ? 'none' : arrowTypeEnd,\n arrowheadStyle: 'fill: #333',\n labelStyle: styles,\n style: styles,\n pattern: rawEdge.stroke,\n look: config.look,\n };\n edges.push(edge);\n });\n\n return { nodes, edges, other: {}, config };\n};\n\nexport default {\n defaultConfig: () => defaultConfig.flowchart,\n setAccTitle,\n getAccTitle,\n getAccDescription,\n getData,\n setAccDescription,\n addVertex,\n lookUpDomId,\n addLink,\n updateLinkInterpolate,\n updateLink,\n addClass,\n setDirection,\n setClass,\n setTooltip,\n getTooltip,\n setClickEvent,\n setLink,\n bindFunctions,\n getDirection,\n getVertices,\n getEdges,\n getClasses,\n clear,\n setGen,\n defaultStyle,\n addSubGraph,\n getDepthFirstPos,\n indexNodes,\n getSubGraphs,\n destructLink,\n lex,\n exists,\n makeUniq,\n setDiagramTitle,\n getDiagramTitle,\n};\n", "import type { Direction } from '../../src/diagrams/block/blockTypes.js';\n\nconst expandAndDeduplicateDirections = (directions: Direction[]) => {\n const uniqueDirections = new Set();\n\n for (const direction of directions) {\n switch (direction) {\n case 'x':\n uniqueDirections.add('right');\n uniqueDirections.add('left');\n break;\n case 'y':\n uniqueDirections.add('up');\n uniqueDirections.add('down');\n break;\n default:\n uniqueDirections.add(direction);\n break;\n }\n }\n\n return uniqueDirections;\n};\nexport const getArrowPoints = (\n duplicatedDirections: Direction[],\n bbox: { width: number; height: number },\n node: any\n) => {\n // Expand and deduplicate the provided directions.\n // for instance: x, right => right, left\n const directions = expandAndDeduplicateDirections(duplicatedDirections);\n\n // Factor to divide height for some calculations.\n const f = 2;\n\n // Calculated height of the bounding box, accounting for node padding.\n const height = bbox.height + 2 * node.padding;\n // Midpoint calculation based on height.\n const midpoint = height / f;\n // Calculated width of the bounding box, accounting for additional width and node padding.\n const width = bbox.width + 2 * midpoint + node.padding;\n // Padding to use, half of the node padding.\n const padding = node.padding / 2;\n\n if (\n directions.has('right') &&\n directions.has('left') &&\n directions.has('up') &&\n directions.has('down')\n ) {\n // SQUARE\n return [\n // Bottom\n { x: 0, y: 0 },\n { x: midpoint, y: 0 },\n { x: width / 2, y: 2 * padding },\n { x: width - midpoint, y: 0 },\n { x: width, y: 0 },\n\n // Right\n { x: width, y: -height / 3 },\n { x: width + 2 * padding, y: -height / 2 },\n { x: width, y: (-2 * height) / 3 },\n { x: width, y: -height },\n\n // Top\n { x: width - midpoint, y: -height },\n { x: width / 2, y: -height - 2 * padding },\n { x: midpoint, y: -height },\n\n // Left\n { x: 0, y: -height },\n { x: 0, y: (-2 * height) / 3 },\n { x: -2 * padding, y: -height / 2 },\n { x: 0, y: -height / 3 },\n ];\n }\n if (directions.has('right') && directions.has('left') && directions.has('up')) {\n // RECTANGLE_VERTICAL (Top Open)\n return [\n { x: midpoint, y: 0 },\n { x: width - midpoint, y: 0 },\n { x: width, y: -height / 2 },\n { x: width - midpoint, y: -height },\n { x: midpoint, y: -height },\n { x: 0, y: -height / 2 },\n ];\n }\n if (directions.has('right') && directions.has('left') && directions.has('down')) {\n // RECTANGLE_VERTICAL (Bottom Open)\n return [\n { x: 0, y: 0 },\n { x: midpoint, y: -height },\n { x: width - midpoint, y: -height },\n { x: width, y: 0 },\n ];\n }\n if (directions.has('right') && directions.has('up') && directions.has('down')) {\n // RECTANGLE_HORIZONTAL (Right Open)\n return [\n { x: 0, y: 0 },\n { x: width, y: -midpoint },\n { x: width, y: -height + midpoint },\n { x: 0, y: -height },\n ];\n }\n if (directions.has('left') && directions.has('up') && directions.has('down')) {\n // RECTANGLE_HORIZONTAL (Left Open)\n return [\n { x: width, y: 0 },\n { x: 0, y: -midpoint },\n { x: 0, y: -height + midpoint },\n { x: width, y: -height },\n ];\n }\n if (directions.has('right') && directions.has('left')) {\n // HORIZONTAL_LINE\n return [\n { x: midpoint, y: 0 },\n { x: midpoint, y: -padding },\n { x: width - midpoint, y: -padding },\n { x: width - midpoint, y: 0 },\n { x: width, y: -height / 2 },\n { x: width - midpoint, y: -height },\n { x: width - midpoint, y: -height + padding },\n { x: midpoint, y: -height + padding },\n { x: midpoint, y: -height },\n { x: 0, y: -height / 2 },\n ];\n }\n if (directions.has('up') && directions.has('down')) {\n // VERTICAL_LINE\n return [\n // Bottom center\n { x: width / 2, y: 0 },\n // Left pont of bottom arrow\n { x: 0, y: -padding },\n { x: midpoint, y: -padding },\n // Left top over vertical section\n { x: midpoint, y: -height + padding },\n { x: 0, y: -height + padding },\n // Top of arrow\n { x: width / 2, y: -height },\n { x: width, y: -height + padding },\n // Top of right vertical bar\n { x: width - midpoint, y: -height + padding },\n { x: width - midpoint, y: -padding },\n { x: width, y: -padding },\n ];\n }\n if (directions.has('right') && directions.has('up')) {\n // ANGLE_RT\n return [\n { x: 0, y: 0 },\n { x: width, y: -midpoint },\n { x: 0, y: -height },\n ];\n }\n if (directions.has('right') && directions.has('down')) {\n // ANGLE_RB\n return [\n { x: 0, y: 0 },\n { x: width, y: 0 },\n { x: 0, y: -height },\n ];\n }\n if (directions.has('left') && directions.has('up')) {\n // ANGLE_LT\n return [\n { x: width, y: 0 },\n { x: 0, y: -midpoint },\n { x: width, y: -height },\n ];\n }\n if (directions.has('left') && directions.has('down')) {\n // ANGLE_LB\n return [\n { x: width, y: 0 },\n { x: 0, y: 0 },\n { x: width, y: -height },\n ];\n }\n if (directions.has('right')) {\n // ARROW_RIGHT\n return [\n { x: midpoint, y: -padding },\n { x: midpoint, y: -padding },\n { x: width - midpoint, y: -padding },\n { x: width - midpoint, y: 0 },\n { x: width, y: -height / 2 },\n { x: width - midpoint, y: -height },\n { x: width - midpoint, y: -height + padding },\n // top left corner of arrow\n { x: midpoint, y: -height + padding },\n { x: midpoint, y: -height + padding },\n ];\n }\n if (directions.has('left')) {\n // ARROW_LEFT\n return [\n { x: midpoint, y: 0 },\n { x: midpoint, y: -padding },\n // Two points, the right corners\n { x: width - midpoint, y: -padding },\n { x: width - midpoint, y: -height + padding },\n { x: midpoint, y: -height + padding },\n { x: midpoint, y: -height },\n { x: 0, y: -height / 2 },\n ];\n }\n if (directions.has('up')) {\n // ARROW_TOP\n return [\n // Bottom center\n { x: midpoint, y: -padding },\n // Left top over vertical section\n { x: midpoint, y: -height + padding },\n { x: 0, y: -height + padding },\n // Top of arrow\n { x: width / 2, y: -height },\n { x: width, y: -height + padding },\n // Top of right vertical bar\n { x: width - midpoint, y: -height + padding },\n { x: width - midpoint, y: -padding },\n ];\n }\n if (directions.has('down')) {\n // ARROW_BOTTOM\n return [\n // Bottom center\n { x: width / 2, y: 0 },\n // Left pont of bottom arrow\n { x: 0, y: -padding },\n { x: midpoint, y: -padding },\n // Left top over vertical section\n { x: midpoint, y: -height + padding },\n { x: width - midpoint, y: -height + padding },\n { x: width - midpoint, y: -padding },\n { x: width, y: -padding },\n ];\n }\n\n // POINT\n return [{ x: 0, y: 0 }];\n};\n", "/**\n * Gets the original marked default options.\n */\nexport function _getDefaults() {\n return {\n async: false,\n breaks: false,\n extensions: null,\n gfm: true,\n hooks: null,\n pedantic: false,\n renderer: null,\n silent: false,\n tokenizer: null,\n walkTokens: null,\n };\n}\nexport let _defaults = _getDefaults();\nexport function changeDefaults(newDefaults) {\n _defaults = newDefaults;\n}\n", "/**\n * Helpers\n */\nconst escapeTest = /[&<>\"']/;\nconst escapeReplace = new RegExp(escapeTest.source, 'g');\nconst escapeTestNoEncode = /[<>\"']|&(?!(#\\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\\w+);)/;\nconst escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, 'g');\nconst escapeReplacements = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": ''',\n};\nconst getEscapeReplacement = (ch) => escapeReplacements[ch];\nexport function escape(html, encode) {\n if (encode) {\n if (escapeTest.test(html)) {\n return html.replace(escapeReplace, getEscapeReplacement);\n }\n }\n else {\n if (escapeTestNoEncode.test(html)) {\n return html.replace(escapeReplaceNoEncode, getEscapeReplacement);\n }\n }\n return html;\n}\nconst unescapeTest = /&(#(?:\\d+)|(?:#x[0-9A-Fa-f]+)|(?:\\w+));?/ig;\nexport function unescape(html) {\n // explicitly match decimal, hex, and named HTML entities\n return html.replace(unescapeTest, (_, n) => {\n n = n.toLowerCase();\n if (n === 'colon')\n return ':';\n if (n.charAt(0) === '#') {\n return n.charAt(1) === 'x'\n ? String.fromCharCode(parseInt(n.substring(2), 16))\n : String.fromCharCode(+n.substring(1));\n }\n return '';\n });\n}\nconst caret = /(^|[^\\[])\\^/g;\nexport function edit(regex, opt) {\n let source = typeof regex === 'string' ? regex : regex.source;\n opt = opt || '';\n const obj = {\n replace: (name, val) => {\n let valSource = typeof val === 'string' ? val : val.source;\n valSource = valSource.replace(caret, '$1');\n source = source.replace(name, valSource);\n return obj;\n },\n getRegex: () => {\n return new RegExp(source, opt);\n },\n };\n return obj;\n}\nexport function cleanUrl(href) {\n try {\n href = encodeURI(href).replace(/%25/g, '%');\n }\n catch {\n return null;\n }\n return href;\n}\nexport const noopTest = { exec: () => null };\nexport function splitCells(tableRow, count) {\n // ensure that every cell-delimiting pipe has a space\n // before it to distinguish it from an escaped pipe\n const row = tableRow.replace(/\\|/g, (match, offset, str) => {\n let escaped = false;\n let curr = offset;\n while (--curr >= 0 && str[curr] === '\\\\')\n escaped = !escaped;\n if (escaped) {\n // odd number of slashes means | is escaped\n // so we leave it alone\n return '|';\n }\n else {\n // add space before unescaped |\n return ' |';\n }\n }), cells = row.split(/ \\|/);\n let i = 0;\n // First/last cell in a row cannot be empty if it has no leading/trailing pipe\n if (!cells[0].trim()) {\n cells.shift();\n }\n if (cells.length > 0 && !cells[cells.length - 1].trim()) {\n cells.pop();\n }\n if (count) {\n if (cells.length > count) {\n cells.splice(count);\n }\n else {\n while (cells.length < count)\n cells.push('');\n }\n }\n for (; i < cells.length; i++) {\n // leading or trailing whitespace is ignored per the gfm spec\n cells[i] = cells[i].trim().replace(/\\\\\\|/g, '|');\n }\n return cells;\n}\n/**\n * Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').\n * /c*$/ is vulnerable to REDOS.\n *\n * @param str\n * @param c\n * @param invert Remove suffix of non-c chars instead. Default falsey.\n */\nexport function rtrim(str, c, invert) {\n const l = str.length;\n if (l === 0) {\n return '';\n }\n // Length of suffix matching the invert condition.\n let suffLen = 0;\n // Step left until we fail to match the invert condition.\n while (suffLen < l) {\n const currChar = str.charAt(l - suffLen - 1);\n if (currChar === c && !invert) {\n suffLen++;\n }\n else if (currChar !== c && invert) {\n suffLen++;\n }\n else {\n break;\n }\n }\n return str.slice(0, l - suffLen);\n}\nexport function findClosingBracket(str, b) {\n if (str.indexOf(b[1]) === -1) {\n return -1;\n }\n let level = 0;\n for (let i = 0; i < str.length; i++) {\n if (str[i] === '\\\\') {\n i++;\n }\n else if (str[i] === b[0]) {\n level++;\n }\n else if (str[i] === b[1]) {\n level--;\n if (level < 0) {\n return i;\n }\n }\n }\n return -1;\n}\n", "import { _defaults } from './defaults.ts';\nimport { rtrim, splitCells, escape, findClosingBracket, } from './helpers.ts';\nfunction outputLink(cap, link, raw, lexer) {\n const href = link.href;\n const title = link.title ? escape(link.title) : null;\n const text = cap[1].replace(/\\\\([\\[\\]])/g, '$1');\n if (cap[0].charAt(0) !== '!') {\n lexer.state.inLink = true;\n const token = {\n type: 'link',\n raw,\n href,\n title,\n text,\n tokens: lexer.inlineTokens(text),\n };\n lexer.state.inLink = false;\n return token;\n }\n return {\n type: 'image',\n raw,\n href,\n title,\n text: escape(text),\n };\n}\nfunction indentCodeCompensation(raw, text) {\n const matchIndentToCode = raw.match(/^(\\s+)(?:```)/);\n if (matchIndentToCode === null) {\n return text;\n }\n const indentToCode = matchIndentToCode[1];\n return text\n .split('\\n')\n .map(node => {\n const matchIndentInNode = node.match(/^\\s+/);\n if (matchIndentInNode === null) {\n return node;\n }\n const [indentInNode] = matchIndentInNode;\n if (indentInNode.length >= indentToCode.length) {\n return node.slice(indentToCode.length);\n }\n return node;\n })\n .join('\\n');\n}\n/**\n * Tokenizer\n */\nexport class _Tokenizer {\n options;\n rules; // set by the lexer\n lexer; // set by the lexer\n constructor(options) {\n this.options = options || _defaults;\n }\n space(src) {\n const cap = this.rules.block.newline.exec(src);\n if (cap && cap[0].length > 0) {\n return {\n type: 'space',\n raw: cap[0],\n };\n }\n }\n code(src) {\n const cap = this.rules.block.code.exec(src);\n if (cap) {\n const text = cap[0].replace(/^ {1,4}/gm, '');\n return {\n type: 'code',\n raw: cap[0],\n codeBlockStyle: 'indented',\n text: !this.options.pedantic\n ? rtrim(text, '\\n')\n : text,\n };\n }\n }\n fences(src) {\n const cap = this.rules.block.fences.exec(src);\n if (cap) {\n const raw = cap[0];\n const text = indentCodeCompensation(raw, cap[3] || '');\n return {\n type: 'code',\n raw,\n lang: cap[2] ? cap[2].trim().replace(this.rules.inline.anyPunctuation, '$1') : cap[2],\n text,\n };\n }\n }\n heading(src) {\n const cap = this.rules.block.heading.exec(src);\n if (cap) {\n let text = cap[2].trim();\n // remove trailing #s\n if (/#$/.test(text)) {\n const trimmed = rtrim(text, '#');\n if (this.options.pedantic) {\n text = trimmed.trim();\n }\n else if (!trimmed || / $/.test(trimmed)) {\n // CommonMark requires space before trailing #s\n text = trimmed.trim();\n }\n }\n return {\n type: 'heading',\n raw: cap[0],\n depth: cap[1].length,\n text,\n tokens: this.lexer.inline(text),\n };\n }\n }\n hr(src) {\n const cap = this.rules.block.hr.exec(src);\n if (cap) {\n return {\n type: 'hr',\n raw: rtrim(cap[0], '\\n'),\n };\n }\n }\n blockquote(src) {\n const cap = this.rules.block.blockquote.exec(src);\n if (cap) {\n let lines = rtrim(cap[0], '\\n').split('\\n');\n let raw = '';\n let text = '';\n const tokens = [];\n while (lines.length > 0) {\n let inBlockquote = false;\n const currentLines = [];\n let i;\n for (i = 0; i < lines.length; i++) {\n // get lines up to a continuation\n if (/^ {0,3}>/.test(lines[i])) {\n currentLines.push(lines[i]);\n inBlockquote = true;\n }\n else if (!inBlockquote) {\n currentLines.push(lines[i]);\n }\n else {\n break;\n }\n }\n lines = lines.slice(i);\n const currentRaw = currentLines.join('\\n');\n const currentText = currentRaw\n // precede setext continuation with 4 spaces so it isn't a setext\n .replace(/\\n {0,3}((?:=+|-+) *)(?=\\n|$)/g, '\\n $1')\n .replace(/^ {0,3}>[ \\t]?/gm, '');\n raw = raw ? `${raw}\\n${currentRaw}` : currentRaw;\n text = text ? `${text}\\n${currentText}` : currentText;\n // parse blockquote lines as top level tokens\n // merge paragraphs if this is a continuation\n const top = this.lexer.state.top;\n this.lexer.state.top = true;\n this.lexer.blockTokens(currentText, tokens, true);\n this.lexer.state.top = top;\n // if there is no continuation then we are done\n if (lines.length === 0) {\n break;\n }\n const lastToken = tokens[tokens.length - 1];\n if (lastToken?.type === 'code') {\n // blockquote continuation cannot be preceded by a code block\n break;\n }\n else if (lastToken?.type === 'blockquote') {\n // include continuation in nested blockquote\n const oldToken = lastToken;\n const newText = oldToken.raw + '\\n' + lines.join('\\n');\n const newToken = this.blockquote(newText);\n tokens[tokens.length - 1] = newToken;\n raw = raw.substring(0, raw.length - oldToken.raw.length) + newToken.raw;\n text = text.substring(0, text.length - oldToken.text.length) + newToken.text;\n break;\n }\n else if (lastToken?.type === 'list') {\n // include continuation in nested list\n const oldToken = lastToken;\n const newText = oldToken.raw + '\\n' + lines.join('\\n');\n const newToken = this.list(newText);\n tokens[tokens.length - 1] = newToken;\n raw = raw.substring(0, raw.length - lastToken.raw.length) + newToken.raw;\n text = text.substring(0, text.length - oldToken.raw.length) + newToken.raw;\n lines = newText.substring(tokens[tokens.length - 1].raw.length).split('\\n');\n continue;\n }\n }\n return {\n type: 'blockquote',\n raw,\n tokens,\n text,\n };\n }\n }\n list(src) {\n let cap = this.rules.block.list.exec(src);\n if (cap) {\n let bull = cap[1].trim();\n const isordered = bull.length > 1;\n const list = {\n type: 'list',\n raw: '',\n ordered: isordered,\n start: isordered ? +bull.slice(0, -1) : '',\n loose: false,\n items: [],\n };\n bull = isordered ? `\\\\d{1,9}\\\\${bull.slice(-1)}` : `\\\\${bull}`;\n if (this.options.pedantic) {\n bull = isordered ? bull : '[*+-]';\n }\n // Get next list item\n const itemRegex = new RegExp(`^( {0,3}${bull})((?:[\\t ][^\\\\n]*)?(?:\\\\n|$))`);\n let endsWithBlankLine = false;\n // Check if current bullet point can start a new List Item\n while (src) {\n let endEarly = false;\n let raw = '';\n let itemContents = '';\n if (!(cap = itemRegex.exec(src))) {\n break;\n }\n if (this.rules.block.hr.test(src)) { // End list if bullet was actually HR (possibly move into itemRegex?)\n break;\n }\n raw = cap[0];\n src = src.substring(raw.length);\n let line = cap[2].split('\\n', 1)[0].replace(/^\\t+/, (t) => ' '.repeat(3 * t.length));\n let nextLine = src.split('\\n', 1)[0];\n let blankLine = !line.trim();\n let indent = 0;\n if (this.options.pedantic) {\n indent = 2;\n itemContents = line.trimStart();\n }\n else if (blankLine) {\n indent = cap[1].length + 1;\n }\n else {\n indent = cap[2].search(/[^ ]/); // Find first non-space char\n indent = indent > 4 ? 1 : indent; // Treat indented code blocks (> 4 spaces) as having only 1 indent\n itemContents = line.slice(indent);\n indent += cap[1].length;\n }\n if (blankLine && /^ *$/.test(nextLine)) { // Items begin with at most one blank line\n raw += nextLine + '\\n';\n src = src.substring(nextLine.length + 1);\n endEarly = true;\n }\n if (!endEarly) {\n const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\\\d{1,9}[.)])((?:[ \\t][^\\\\n]*)?(?:\\\\n|$))`);\n const hrRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\\\* *){3,})(?:\\\\n+|$)`);\n const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\\`\\`\\`|~~~)`);\n const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`);\n // Check if following lines should be included in List Item\n while (src) {\n const rawLine = src.split('\\n', 1)[0];\n nextLine = rawLine;\n // Re-align to follow commonmark nesting rules\n if (this.options.pedantic) {\n nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, ' ');\n }\n // End list item if found code fences\n if (fencesBeginRegex.test(nextLine)) {\n break;\n }\n // End list item if found start of new heading\n if (headingBeginRegex.test(nextLine)) {\n break;\n }\n // End list item if found start of new bullet\n if (nextBulletRegex.test(nextLine)) {\n break;\n }\n // Horizontal rule found\n if (hrRegex.test(src)) {\n break;\n }\n if (nextLine.search(/[^ ]/) >= indent || !nextLine.trim()) { // Dedent if possible\n itemContents += '\\n' + nextLine.slice(indent);\n }\n else {\n // not enough indentation\n if (blankLine) {\n break;\n }\n // paragraph continuation unless last line was a different block level element\n if (line.search(/[^ ]/) >= 4) { // indented code block\n break;\n }\n if (fencesBeginRegex.test(line)) {\n break;\n }\n if (headingBeginRegex.test(line)) {\n break;\n }\n if (hrRegex.test(line)) {\n break;\n }\n itemContents += '\\n' + nextLine;\n }\n if (!blankLine && !nextLine.trim()) { // Check if current line is blank\n blankLine = true;\n }\n raw += rawLine + '\\n';\n src = src.substring(rawLine.length + 1);\n line = nextLine.slice(indent);\n }\n }\n if (!list.loose) {\n // If the previous item ended with a blank line, the list is loose\n if (endsWithBlankLine) {\n list.loose = true;\n }\n else if (/\\n *\\n *$/.test(raw)) {\n endsWithBlankLine = true;\n }\n }\n let istask = null;\n let ischecked;\n // Check for task list items\n if (this.options.gfm) {\n istask = /^\\[[ xX]\\] /.exec(itemContents);\n if (istask) {\n ischecked = istask[0] !== '[ ] ';\n itemContents = itemContents.replace(/^\\[[ xX]\\] +/, '');\n }\n }\n list.items.push({\n type: 'list_item',\n raw,\n task: !!istask,\n checked: ischecked,\n loose: false,\n text: itemContents,\n tokens: [],\n });\n list.raw += raw;\n }\n // Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic\n list.items[list.items.length - 1].raw = list.items[list.items.length - 1].raw.trimEnd();\n list.items[list.items.length - 1].text = list.items[list.items.length - 1].text.trimEnd();\n list.raw = list.raw.trimEnd();\n // Item child tokens handled here at end because we needed to have the final item to trim it first\n for (let i = 0; i < list.items.length; i++) {\n this.lexer.state.top = false;\n list.items[i].tokens = this.lexer.blockTokens(list.items[i].text, []);\n if (!list.loose) {\n // Check if list should be loose\n const spacers = list.items[i].tokens.filter(t => t.type === 'space');\n const hasMultipleLineBreaks = spacers.length > 0 && spacers.some(t => /\\n.*\\n/.test(t.raw));\n list.loose = hasMultipleLineBreaks;\n }\n }\n // Set all items to loose if list is loose\n if (list.loose) {\n for (let i = 0; i < list.items.length; i++) {\n list.items[i].loose = true;\n }\n }\n return list;\n }\n }\n html(src) {\n const cap = this.rules.block.html.exec(src);\n if (cap) {\n const token = {\n type: 'html',\n block: true,\n raw: cap[0],\n pre: cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style',\n text: cap[0],\n };\n return token;\n }\n }\n def(src) {\n const cap = this.rules.block.def.exec(src);\n if (cap) {\n const tag = cap[1].toLowerCase().replace(/\\s+/g, ' ');\n const href = cap[2] ? cap[2].replace(/^<(.*)>$/, '$1').replace(this.rules.inline.anyPunctuation, '$1') : '';\n const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline.anyPunctuation, '$1') : cap[3];\n return {\n type: 'def',\n tag,\n raw: cap[0],\n href,\n title,\n };\n }\n }\n table(src) {\n const cap = this.rules.block.table.exec(src);\n if (!cap) {\n return;\n }\n if (!/[:|]/.test(cap[2])) {\n // delimiter row must have a pipe (|) or colon (:) otherwise it is a setext heading\n return;\n }\n const headers = splitCells(cap[1]);\n const aligns = cap[2].replace(/^\\||\\| *$/g, '').split('|');\n const rows = cap[3] && cap[3].trim() ? cap[3].replace(/\\n[ \\t]*$/, '').split('\\n') : [];\n const item = {\n type: 'table',\n raw: cap[0],\n header: [],\n align: [],\n rows: [],\n };\n if (headers.length !== aligns.length) {\n // header and align columns must be equal, rows can be different.\n return;\n }\n for (const align of aligns) {\n if (/^ *-+: *$/.test(align)) {\n item.align.push('right');\n }\n else if (/^ *:-+: *$/.test(align)) {\n item.align.push('center');\n }\n else if (/^ *:-+ *$/.test(align)) {\n item.align.push('left');\n }\n else {\n item.align.push(null);\n }\n }\n for (let i = 0; i < headers.length; i++) {\n item.header.push({\n text: headers[i],\n tokens: this.lexer.inline(headers[i]),\n header: true,\n align: item.align[i],\n });\n }\n for (const row of rows) {\n item.rows.push(splitCells(row, item.header.length).map((cell, i) => {\n return {\n text: cell,\n tokens: this.lexer.inline(cell),\n header: false,\n align: item.align[i],\n };\n }));\n }\n return item;\n }\n lheading(src) {\n const cap = this.rules.block.lheading.exec(src);\n if (cap) {\n return {\n type: 'heading',\n raw: cap[0],\n depth: cap[2].charAt(0) === '=' ? 1 : 2,\n text: cap[1],\n tokens: this.lexer.inline(cap[1]),\n };\n }\n }\n paragraph(src) {\n const cap = this.rules.block.paragraph.exec(src);\n if (cap) {\n const text = cap[1].charAt(cap[1].length - 1) === '\\n'\n ? cap[1].slice(0, -1)\n : cap[1];\n return {\n type: 'paragraph',\n raw: cap[0],\n text,\n tokens: this.lexer.inline(text),\n };\n }\n }\n text(src) {\n const cap = this.rules.block.text.exec(src);\n if (cap) {\n return {\n type: 'text',\n raw: cap[0],\n text: cap[0],\n tokens: this.lexer.inline(cap[0]),\n };\n }\n }\n escape(src) {\n const cap = this.rules.inline.escape.exec(src);\n if (cap) {\n return {\n type: 'escape',\n raw: cap[0],\n text: escape(cap[1]),\n };\n }\n }\n tag(src) {\n const cap = this.rules.inline.tag.exec(src);\n if (cap) {\n if (!this.lexer.state.inLink && /^/i.test(cap[0])) {\n this.lexer.state.inLink = false;\n }\n if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\\s|>)/i.test(cap[0])) {\n this.lexer.state.inRawBlock = true;\n }\n else if (this.lexer.state.inRawBlock && /^<\\/(pre|code|kbd|script)(\\s|>)/i.test(cap[0])) {\n this.lexer.state.inRawBlock = false;\n }\n return {\n type: 'html',\n raw: cap[0],\n inLink: this.lexer.state.inLink,\n inRawBlock: this.lexer.state.inRawBlock,\n block: false,\n text: cap[0],\n };\n }\n }\n link(src) {\n const cap = this.rules.inline.link.exec(src);\n if (cap) {\n const trimmedUrl = cap[2].trim();\n if (!this.options.pedantic && /^$/.test(trimmedUrl))) {\n return;\n }\n // ending angle bracket cannot be escaped\n const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\\\');\n if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {\n return;\n }\n }\n else {\n // find closing parenthesis\n const lastParenIndex = findClosingBracket(cap[2], '()');\n if (lastParenIndex > -1) {\n const start = cap[0].indexOf('!') === 0 ? 5 : 4;\n const linkLen = start + cap[1].length + lastParenIndex;\n cap[2] = cap[2].substring(0, lastParenIndex);\n cap[0] = cap[0].substring(0, linkLen).trim();\n cap[3] = '';\n }\n }\n let href = cap[2];\n let title = '';\n if (this.options.pedantic) {\n // split pedantic href and title\n const link = /^([^'\"]*[^\\s])\\s+(['\"])(.*)\\2/.exec(href);\n if (link) {\n href = link[1];\n title = link[3];\n }\n }\n else {\n title = cap[3] ? cap[3].slice(1, -1) : '';\n }\n href = href.trim();\n if (/^$/.test(trimmedUrl))) {\n // pedantic allows starting angle bracket without ending angle bracket\n href = href.slice(1);\n }\n else {\n href = href.slice(1, -1);\n }\n }\n return outputLink(cap, {\n href: href ? href.replace(this.rules.inline.anyPunctuation, '$1') : href,\n title: title ? title.replace(this.rules.inline.anyPunctuation, '$1') : title,\n }, cap[0], this.lexer);\n }\n }\n reflink(src, links) {\n let cap;\n if ((cap = this.rules.inline.reflink.exec(src))\n || (cap = this.rules.inline.nolink.exec(src))) {\n const linkString = (cap[2] || cap[1]).replace(/\\s+/g, ' ');\n const link = links[linkString.toLowerCase()];\n if (!link) {\n const text = cap[0].charAt(0);\n return {\n type: 'text',\n raw: text,\n text,\n };\n }\n return outputLink(cap, link, cap[0], this.lexer);\n }\n }\n emStrong(src, maskedSrc, prevChar = '') {\n let match = this.rules.inline.emStrongLDelim.exec(src);\n if (!match)\n return;\n // _ can't be between two alphanumerics. \\p{L}\\p{N} includes non-english alphabet/numbers as well\n if (match[3] && prevChar.match(/[\\p{L}\\p{N}]/u))\n return;\n const nextChar = match[1] || match[2] || '';\n if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {\n // unicode Regex counts emoji as 1 char; spread into array for proper count (used multiple times below)\n const lLength = [...match[0]].length - 1;\n let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;\n const endReg = match[0][0] === '*' ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;\n endReg.lastIndex = 0;\n // Clip maskedSrc to same section of string as src (move to lexer?)\n maskedSrc = maskedSrc.slice(-1 * src.length + lLength);\n while ((match = endReg.exec(maskedSrc)) != null) {\n rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];\n if (!rDelim)\n continue; // skip single * in __abc*abc__\n rLength = [...rDelim].length;\n if (match[3] || match[4]) { // found another Left Delim\n delimTotal += rLength;\n continue;\n }\n else if (match[5] || match[6]) { // either Left or Right Delim\n if (lLength % 3 && !((lLength + rLength) % 3)) {\n midDelimTotal += rLength;\n continue; // CommonMark Emphasis Rules 9-10\n }\n }\n delimTotal -= rLength;\n if (delimTotal > 0)\n continue; // Haven't found enough closing delimiters\n // Remove extra characters. *a*** -> *a*\n rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);\n // char length can be >1 for unicode characters;\n const lastCharLength = [...match[0]][0].length;\n const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);\n // Create `em` if smallest delimiter has odd char count. *a***\n if (Math.min(lLength, rLength) % 2) {\n const text = raw.slice(1, -1);\n return {\n type: 'em',\n raw,\n text,\n tokens: this.lexer.inlineTokens(text),\n };\n }\n // Create 'strong' if smallest delimiter has even char count. **a***\n const text = raw.slice(2, -2);\n return {\n type: 'strong',\n raw,\n text,\n tokens: this.lexer.inlineTokens(text),\n };\n }\n }\n }\n codespan(src) {\n const cap = this.rules.inline.code.exec(src);\n if (cap) {\n let text = cap[2].replace(/\\n/g, ' ');\n const hasNonSpaceChars = /[^ ]/.test(text);\n const hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);\n if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {\n text = text.substring(1, text.length - 1);\n }\n text = escape(text, true);\n return {\n type: 'codespan',\n raw: cap[0],\n text,\n };\n }\n }\n br(src) {\n const cap = this.rules.inline.br.exec(src);\n if (cap) {\n return {\n type: 'br',\n raw: cap[0],\n };\n }\n }\n del(src) {\n const cap = this.rules.inline.del.exec(src);\n if (cap) {\n return {\n type: 'del',\n raw: cap[0],\n text: cap[2],\n tokens: this.lexer.inlineTokens(cap[2]),\n };\n }\n }\n autolink(src) {\n const cap = this.rules.inline.autolink.exec(src);\n if (cap) {\n let text, href;\n if (cap[2] === '@') {\n text = escape(cap[1]);\n href = 'mailto:' + text;\n }\n else {\n text = escape(cap[1]);\n href = text;\n }\n return {\n type: 'link',\n raw: cap[0],\n text,\n href,\n tokens: [\n {\n type: 'text',\n raw: text,\n text,\n },\n ],\n };\n }\n }\n url(src) {\n let cap;\n if (cap = this.rules.inline.url.exec(src)) {\n let text, href;\n if (cap[2] === '@') {\n text = escape(cap[0]);\n href = 'mailto:' + text;\n }\n else {\n // do extended autolink path validation\n let prevCapZero;\n do {\n prevCapZero = cap[0];\n cap[0] = this.rules.inline._backpedal.exec(cap[0])?.[0] ?? '';\n } while (prevCapZero !== cap[0]);\n text = escape(cap[0]);\n if (cap[1] === 'www.') {\n href = 'http://' + cap[0];\n }\n else {\n href = cap[0];\n }\n }\n return {\n type: 'link',\n raw: cap[0],\n text,\n href,\n tokens: [\n {\n type: 'text',\n raw: text,\n text,\n },\n ],\n };\n }\n }\n inlineText(src) {\n const cap = this.rules.inline.text.exec(src);\n if (cap) {\n let text;\n if (this.lexer.state.inRawBlock) {\n text = cap[0];\n }\n else {\n text = escape(cap[0]);\n }\n return {\n type: 'text',\n raw: cap[0],\n text,\n };\n }\n }\n}\n", "import { edit, noopTest, } from './helpers.ts';\n/**\n * Block-Level Grammar\n */\nconst newline = /^(?: *(?:\\n|$))+/;\nconst blockCode = /^( {4}[^\\n]+(?:\\n(?: *(?:\\n|$))*)?)+/;\nconst fences = /^ {0,3}(`{3,}(?=[^`\\n]*(?:\\n|$))|~{3,})([^\\n]*)(?:\\n|$)(?:|([\\s\\S]*?)(?:\\n|$))(?: {0,3}\\1[~`]* *(?=\\n|$)|$)/;\nconst hr = /^ {0,3}((?:-[\\t ]*){3,}|(?:_[ \\t]*){3,}|(?:\\*[ \\t]*){3,})(?:\\n+|$)/;\nconst heading = /^ {0,3}(#{1,6})(?=\\s|$)(.*)(?:\\n+|$)/;\nconst bullet = /(?:[*+-]|\\d{1,9}[.)])/;\nconst lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\\n(?!\\s*?\\n|bull |blockCode|fences|blockquote|heading|html))+?)\\n {0,3}(=+|-+) *(?:\\n+|$)/)\n .replace(/bull/g, bullet) // lists can interrupt\n .replace(/blockCode/g, / {4}/) // indented code blocks can interrupt\n .replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/) // fenced code blocks can interrupt\n .replace(/blockquote/g, / {0,3}>/) // blockquote can interrupt\n .replace(/heading/g, / {0,3}#{1,6}/) // ATX heading can interrupt\n .replace(/html/g, / {0,3}<[^\\n>]+>\\n/) // block html can interrupt\n .getRegex();\nconst _paragraph = /^([^\\n]+(?:\\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\\n)[^\\n]+)*)/;\nconst blockText = /^[^\\n]+/;\nconst _blockLabel = /(?!\\s*\\])(?:\\\\.|[^\\[\\]\\\\])+/;\nconst def = edit(/^ {0,3}\\[(label)\\]: *(?:\\n *)?([^<\\s][^\\s]*|<.*?>)(?:(?: +(?:\\n *)?| *\\n *)(title))? *(?:\\n+|$)/)\n .replace('label', _blockLabel)\n .replace('title', /(?:\"(?:\\\\\"?|[^\"\\\\])*\"|'[^'\\n]*(?:\\n[^'\\n]+)*\\n?'|\\([^()]*\\))/)\n .getRegex();\nconst list = edit(/^( {0,3}bull)([ \\t][^\\n]+?)?(?:\\n|$)/)\n .replace(/bull/g, bullet)\n .getRegex();\nconst _tag = 'address|article|aside|base|basefont|blockquote|body|caption'\n + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption'\n + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe'\n + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option'\n + '|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title'\n + '|tr|track|ul';\nconst _comment = /|$))/;\nconst html = edit('^ {0,3}(?:' // optional indentation\n + '<(script|pre|style|textarea)[\\\\s>][\\\\s\\\\S]*?(?:\\\\1>[^\\\\n]*\\\\n+|$)' // (1)\n + '|comment[^\\\\n]*(\\\\n+|$)' // (2)\n + '|<\\\\?[\\\\s\\\\S]*?(?:\\\\?>\\\\n*|$)' // (3)\n + '|\\\\n*|$)' // (4)\n + '|\\\\n*|$)' // (5)\n + '|?(tag)(?: +|\\\\n|/?>)[\\\\s\\\\S]*?(?:(?:\\\\n *)+\\\\n|$)' // (6)\n + '|<(?!script|pre|style|textarea)([a-z][\\\\w-]*)(?:attribute)*? */?>(?=[ \\\\t]*(?:\\\\n|$))[\\\\s\\\\S]*?(?:(?:\\\\n *)+\\\\n|$)' // (7) open tag\n + '|(?!script|pre|style|textarea)[a-z][\\\\w-]*\\\\s*>(?=[ \\\\t]*(?:\\\\n|$))[\\\\s\\\\S]*?(?:(?:\\\\n *)+\\\\n|$)' // (7) closing tag\n + ')', 'i')\n .replace('comment', _comment)\n .replace('tag', _tag)\n .replace('attribute', / +[a-zA-Z:_][\\w.:-]*(?: *= *\"[^\"\\n]*\"| *= *'[^'\\n]*'| *= *[^\\s\"'=<>`]+)?/)\n .getRegex();\nconst paragraph = edit(_paragraph)\n .replace('hr', hr)\n .replace('heading', ' {0,3}#{1,6}(?:\\\\s|$)')\n .replace('|lheading', '') // setext headings don't interrupt commonmark paragraphs\n .replace('|table', '')\n .replace('blockquote', ' {0,3}>')\n .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\\\n]*\\\\n)|~{3,})[^\\\\n]*\\\\n')\n .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt\n .replace('html', '?(?:tag)(?: +|\\\\n|/?>)|<(?:script|pre|style|textarea|!--)')\n .replace('tag', _tag) // pars can be interrupted by type (6) html blocks\n .getRegex();\nconst blockquote = edit(/^( {0,3}> ?(paragraph|[^\\n]*)(?:\\n|$))+/)\n .replace('paragraph', paragraph)\n .getRegex();\n/**\n * Normal Block Grammar\n */\nconst blockNormal = {\n blockquote,\n code: blockCode,\n def,\n fences,\n heading,\n hr,\n html,\n lheading,\n list,\n newline,\n paragraph,\n table: noopTest,\n text: blockText,\n};\n/**\n * GFM Block Grammar\n */\nconst gfmTable = edit('^ *([^\\\\n ].*)\\\\n' // Header\n + ' {0,3}((?:\\\\| *)?:?-+:? *(?:\\\\| *:?-+:? *)*(?:\\\\| *)?)' // Align\n + '(?:\\\\n((?:(?! *\\\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\\\n|$))*)\\\\n*|$)') // Cells\n .replace('hr', hr)\n .replace('heading', ' {0,3}#{1,6}(?:\\\\s|$)')\n .replace('blockquote', ' {0,3}>')\n .replace('code', ' {4}[^\\\\n]')\n .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\\\n]*\\\\n)|~{3,})[^\\\\n]*\\\\n')\n .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt\n .replace('html', '?(?:tag)(?: +|\\\\n|/?>)|<(?:script|pre|style|textarea|!--)')\n .replace('tag', _tag) // tables can be interrupted by type (6) html blocks\n .getRegex();\nconst blockGfm = {\n ...blockNormal,\n table: gfmTable,\n paragraph: edit(_paragraph)\n .replace('hr', hr)\n .replace('heading', ' {0,3}#{1,6}(?:\\\\s|$)')\n .replace('|lheading', '') // setext headings don't interrupt commonmark paragraphs\n .replace('table', gfmTable) // interrupt paragraphs with table\n .replace('blockquote', ' {0,3}>')\n .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\\\n]*\\\\n)|~{3,})[^\\\\n]*\\\\n')\n .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt\n .replace('html', '?(?:tag)(?: +|\\\\n|/?>)|<(?:script|pre|style|textarea|!--)')\n .replace('tag', _tag) // pars can be interrupted by type (6) html blocks\n .getRegex(),\n};\n/**\n * Pedantic grammar (original John Gruber's loose markdown specification)\n */\nconst blockPedantic = {\n ...blockNormal,\n html: edit('^ *(?:comment *(?:\\\\n|\\\\s*$)'\n + '|<(tag)[\\\\s\\\\S]+?\\\\1> *(?:\\\\n{2,}|\\\\s*$)' // closed tag\n + '| \\\\s]*)*?/?> *(?:\\\\n{2,}|\\\\s*$))')\n .replace('comment', _comment)\n .replace(/tag/g, '(?!(?:'\n + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub'\n + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)'\n + '\\\\b)\\\\w+(?!:|[^\\\\w\\\\s@]*@)\\\\b')\n .getRegex(),\n def: /^ *\\[([^\\]]+)\\]: *([^\\s>]+)>?(?: +([\"(][^\\n]+[\")]))? *(?:\\n+|$)/,\n heading: /^(#{1,6})(.*)(?:\\n+|$)/,\n fences: noopTest, // fences not supported\n lheading: /^(.+?)\\n {0,3}(=+|-+) *(?:\\n+|$)/,\n paragraph: edit(_paragraph)\n .replace('hr', hr)\n .replace('heading', ' *#{1,6} *[^\\n]')\n .replace('lheading', lheading)\n .replace('|table', '')\n .replace('blockquote', ' {0,3}>')\n .replace('|fences', '')\n .replace('|list', '')\n .replace('|html', '')\n .replace('|tag', '')\n .getRegex(),\n};\n/**\n * Inline-Level Grammar\n */\nconst escape = /^\\\\([!\"#$%&'()*+,\\-./:;<=>?@\\[\\]\\\\^_`{|}~])/;\nconst inlineCode = /^(`+)([^`]|[^`][\\s\\S]*?[^`])\\1(?!`)/;\nconst br = /^( {2,}|\\\\)\\n(?!\\s*$)/;\nconst inlineText = /^(`+|[^`])(?:(?= {2,}\\n)|[\\s\\S]*?(?:(?=[\\\\\nconst blockSkip = /\\[[^[\\]]*?\\]\\([^\\(\\)]*?\\)|`[^`]*?`|<[^<>]*?>/g;\nconst emStrongLDelim = edit(/^(?:\\*+(?:((?!\\*)[punct])|[^\\s*]))|^_+(?:((?!_)[punct])|([^\\s_]))/, 'u')\n .replace(/punct/g, _punctuation)\n .getRegex();\nconst emStrongRDelimAst = edit('^[^_*]*?__[^_*]*?\\\\*[^_*]*?(?=__)' // Skip orphan inside strong\n + '|[^*]+(?=[^*])' // Consume to delim\n + '|(?!\\\\*)[punct](\\\\*+)(?=[\\\\s]|$)' // (1) #*** can only be a Right Delimiter\n + '|[^punct\\\\s](\\\\*+)(?!\\\\*)(?=[punct\\\\s]|$)' // (2) a***#, a*** can only be a Right Delimiter\n + '|(?!\\\\*)[punct\\\\s](\\\\*+)(?=[^punct\\\\s])' // (3) #***a, ***a can only be Left Delimiter\n + '|[\\\\s](\\\\*+)(?!\\\\*)(?=[punct])' // (4) ***# can only be Left Delimiter\n + '|(?!\\\\*)[punct](\\\\*+)(?!\\\\*)(?=[punct])' // (5) #***# can be either Left or Right Delimiter\n + '|[^punct\\\\s](\\\\*+)(?=[^punct\\\\s])', 'gu') // (6) a***a can be either Left or Right Delimiter\n .replace(/punct/g, _punctuation)\n .getRegex();\n// (6) Not allowed for _\nconst emStrongRDelimUnd = edit('^[^_*]*?\\\\*\\\\*[^_*]*?_[^_*]*?(?=\\\\*\\\\*)' // Skip orphan inside strong\n + '|[^_]+(?=[^_])' // Consume to delim\n + '|(?!_)[punct](_+)(?=[\\\\s]|$)' // (1) #___ can only be a Right Delimiter\n + '|[^punct\\\\s](_+)(?!_)(?=[punct\\\\s]|$)' // (2) a___#, a___ can only be a Right Delimiter\n + '|(?!_)[punct\\\\s](_+)(?=[^punct\\\\s])' // (3) #___a, ___a can only be Left Delimiter\n + '|[\\\\s](_+)(?!_)(?=[punct])' // (4) ___# can only be Left Delimiter\n + '|(?!_)[punct](_+)(?!_)(?=[punct])', 'gu') // (5) #___# can be either Left or Right Delimiter\n .replace(/punct/g, _punctuation)\n .getRegex();\nconst anyPunctuation = edit(/\\\\([punct])/, 'gu')\n .replace(/punct/g, _punctuation)\n .getRegex();\nconst autolink = edit(/^<(scheme:[^\\s\\x00-\\x1f<>]*|email)>/)\n .replace('scheme', /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/)\n .replace('email', /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/)\n .getRegex();\nconst _inlineComment = edit(_comment).replace('(?:-->|$)', '-->').getRegex();\nconst tag = edit('^comment'\n + '|^[a-zA-Z][\\\\w:-]*\\\\s*>' // self-closing tag\n + '|^<[a-zA-Z][\\\\w-]*(?:attribute)*?\\\\s*/?>' // open tag\n + '|^<\\\\?[\\\\s\\\\S]*?\\\\?>' // processing instruction, e.g. \n + '|^' // declaration, e.g. \n + '|^') // CDATA section\n .replace('comment', _inlineComment)\n .replace('attribute', /\\s+[a-zA-Z:_][\\w.:-]*(?:\\s*=\\s*\"[^\"]*\"|\\s*=\\s*'[^']*'|\\s*=\\s*[^\\s\"'=<>`]+)?/)\n .getRegex();\nconst _inlineLabel = /(?:\\[(?:\\\\.|[^\\[\\]\\\\])*\\]|\\\\.|`[^`]*`|[^\\[\\]\\\\`])*?/;\nconst link = edit(/^!?\\[(label)\\]\\(\\s*(href)(?:\\s+(title))?\\s*\\)/)\n .replace('label', _inlineLabel)\n .replace('href', /<(?:\\\\.|[^\\n<>\\\\])+>|[^\\s\\x00-\\x1f]*/)\n .replace('title', /\"(?:\\\\\"?|[^\"\\\\])*\"|'(?:\\\\'?|[^'\\\\])*'|\\((?:\\\\\\)?|[^)\\\\])*\\)/)\n .getRegex();\nconst reflink = edit(/^!?\\[(label)\\]\\[(ref)\\]/)\n .replace('label', _inlineLabel)\n .replace('ref', _blockLabel)\n .getRegex();\nconst nolink = edit(/^!?\\[(ref)\\](?:\\[\\])?/)\n .replace('ref', _blockLabel)\n .getRegex();\nconst reflinkSearch = edit('reflink|nolink(?!\\\\()', 'g')\n .replace('reflink', reflink)\n .replace('nolink', nolink)\n .getRegex();\n/**\n * Normal Inline Grammar\n */\nconst inlineNormal = {\n _backpedal: noopTest, // only used for GFM url\n anyPunctuation,\n autolink,\n blockSkip,\n br,\n code: inlineCode,\n del: noopTest,\n emStrongLDelim,\n emStrongRDelimAst,\n emStrongRDelimUnd,\n escape,\n link,\n nolink,\n punctuation,\n reflink,\n reflinkSearch,\n tag,\n text: inlineText,\n url: noopTest,\n};\n/**\n * Pedantic Inline Grammar\n */\nconst inlinePedantic = {\n ...inlineNormal,\n link: edit(/^!?\\[(label)\\]\\((.*?)\\)/)\n .replace('label', _inlineLabel)\n .getRegex(),\n reflink: edit(/^!?\\[(label)\\]\\s*\\[([^\\]]*)\\]/)\n .replace('label', _inlineLabel)\n .getRegex(),\n};\n/**\n * GFM Inline Grammar\n */\nconst inlineGfm = {\n ...inlineNormal,\n escape: edit(escape).replace('])', '~|])').getRegex(),\n url: edit(/^((?:ftp|https?):\\/\\/|www\\.)(?:[a-zA-Z0-9\\-]+\\.?)+[^\\s<]*|^email/, 'i')\n .replace('email', /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/)\n .getRegex(),\n _backpedal: /(?:[^?!.,:;*_'\"~()&]+|\\([^)]*\\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'\"~)]+(?!$))+/,\n del: /^(~~?)(?=[^\\s~])([\\s\\S]*?[^\\s~])\\1(?=[^~]|$)/,\n text: /^([`~]+|[^`~])(?:(?= {2,}\\n)|(?=[a-zA-Z0-9.!#$%&'*+\\/=?_`{\\|}~-]+@)|[\\s\\S]*?(?:(?=[\\\\ {\n return leading + ' '.repeat(tabs.length);\n });\n }\n let token;\n let lastToken;\n let cutSrc;\n while (src) {\n if (this.options.extensions\n && this.options.extensions.block\n && this.options.extensions.block.some((extTokenizer) => {\n if (token = extTokenizer.call({ lexer: this }, src, tokens)) {\n src = src.substring(token.raw.length);\n tokens.push(token);\n return true;\n }\n return false;\n })) {\n continue;\n }\n // newline\n if (token = this.tokenizer.space(src)) {\n src = src.substring(token.raw.length);\n if (token.raw.length === 1 && tokens.length > 0) {\n // if there's a single \\n as a spacer, it's terminating the last line,\n // so move it there so that we don't get unnecessary paragraph tags\n tokens[tokens.length - 1].raw += '\\n';\n }\n else {\n tokens.push(token);\n }\n continue;\n }\n // code\n if (token = this.tokenizer.code(src)) {\n src = src.substring(token.raw.length);\n lastToken = tokens[tokens.length - 1];\n // An indented code block cannot interrupt a paragraph.\n if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {\n lastToken.raw += '\\n' + token.raw;\n lastToken.text += '\\n' + token.text;\n this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;\n }\n else {\n tokens.push(token);\n }\n continue;\n }\n // fences\n if (token = this.tokenizer.fences(src)) {\n src = src.substring(token.raw.length);\n tokens.push(token);\n continue;\n }\n // heading\n if (token = this.tokenizer.heading(src)) {\n src = src.substring(token.raw.length);\n tokens.push(token);\n continue;\n }\n // hr\n if (token = this.tokenizer.hr(src)) {\n src = src.substring(token.raw.length);\n tokens.push(token);\n continue;\n }\n // blockquote\n if (token = this.tokenizer.blockquote(src)) {\n src = src.substring(token.raw.length);\n tokens.push(token);\n continue;\n }\n // list\n if (token = this.tokenizer.list(src)) {\n src = src.substring(token.raw.length);\n tokens.push(token);\n continue;\n }\n // html\n if (token = this.tokenizer.html(src)) {\n src = src.substring(token.raw.length);\n tokens.push(token);\n continue;\n }\n // def\n if (token = this.tokenizer.def(src)) {\n src = src.substring(token.raw.length);\n lastToken = tokens[tokens.length - 1];\n if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {\n lastToken.raw += '\\n' + token.raw;\n lastToken.text += '\\n' + token.raw;\n this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;\n }\n else if (!this.tokens.links[token.tag]) {\n this.tokens.links[token.tag] = {\n href: token.href,\n title: token.title,\n };\n }\n continue;\n }\n // table (gfm)\n if (token = this.tokenizer.table(src)) {\n src = src.substring(token.raw.length);\n tokens.push(token);\n continue;\n }\n // lheading\n if (token = this.tokenizer.lheading(src)) {\n src = src.substring(token.raw.length);\n tokens.push(token);\n continue;\n }\n // top-level paragraph\n // prevent paragraph consuming extensions by clipping 'src' to extension start\n cutSrc = src;\n if (this.options.extensions && this.options.extensions.startBlock) {\n let startIndex = Infinity;\n const tempSrc = src.slice(1);\n let tempStart;\n this.options.extensions.startBlock.forEach((getStartIndex) => {\n tempStart = getStartIndex.call({ lexer: this }, tempSrc);\n if (typeof tempStart === 'number' && tempStart >= 0) {\n startIndex = Math.min(startIndex, tempStart);\n }\n });\n if (startIndex < Infinity && startIndex >= 0) {\n cutSrc = src.substring(0, startIndex + 1);\n }\n }\n if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {\n lastToken = tokens[tokens.length - 1];\n if (lastParagraphClipped && lastToken?.type === 'paragraph') {\n lastToken.raw += '\\n' + token.raw;\n lastToken.text += '\\n' + token.text;\n this.inlineQueue.pop();\n this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;\n }\n else {\n tokens.push(token);\n }\n lastParagraphClipped = (cutSrc.length !== src.length);\n src = src.substring(token.raw.length);\n continue;\n }\n // text\n if (token = this.tokenizer.text(src)) {\n src = src.substring(token.raw.length);\n lastToken = tokens[tokens.length - 1];\n if (lastToken && lastToken.type === 'text') {\n lastToken.raw += '\\n' + token.raw;\n lastToken.text += '\\n' + token.text;\n this.inlineQueue.pop();\n this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;\n }\n else {\n tokens.push(token);\n }\n continue;\n }\n if (src) {\n const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);\n if (this.options.silent) {\n console.error(errMsg);\n break;\n }\n else {\n throw new Error(errMsg);\n }\n }\n }\n this.state.top = true;\n return tokens;\n }\n inline(src, tokens = []) {\n this.inlineQueue.push({ src, tokens });\n return tokens;\n }\n /**\n * Lexing/Compiling\n */\n inlineTokens(src, tokens = []) {\n let token, lastToken, cutSrc;\n // String with links masked to avoid interference with em and strong\n let maskedSrc = src;\n let match;\n let keepPrevChar, prevChar;\n // Mask out reflinks\n if (this.tokens.links) {\n const links = Object.keys(this.tokens.links);\n if (links.length > 0) {\n while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {\n if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {\n maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);\n }\n }\n }\n }\n // Mask out other blocks\n while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {\n maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);\n }\n // Mask out escaped characters\n while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {\n maskedSrc = maskedSrc.slice(0, match.index) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);\n }\n while (src) {\n if (!keepPrevChar) {\n prevChar = '';\n }\n keepPrevChar = false;\n // extensions\n if (this.options.extensions\n && this.options.extensions.inline\n && this.options.extensions.inline.some((extTokenizer) => {\n if (token = extTokenizer.call({ lexer: this }, src, tokens)) {\n src = src.substring(token.raw.length);\n tokens.push(token);\n return true;\n }\n return false;\n })) {\n continue;\n }\n // escape\n if (token = this.tokenizer.escape(src)) {\n src = src.substring(token.raw.length);\n tokens.push(token);\n continue;\n }\n // tag\n if (token = this.tokenizer.tag(src)) {\n src = src.substring(token.raw.length);\n lastToken = tokens[tokens.length - 1];\n if (lastToken && token.type === 'text' && lastToken.type === 'text') {\n lastToken.raw += token.raw;\n lastToken.text += token.text;\n }\n else {\n tokens.push(token);\n }\n continue;\n }\n // link\n if (token = this.tokenizer.link(src)) {\n src = src.substring(token.raw.length);\n tokens.push(token);\n continue;\n }\n // reflink, nolink\n if (token = this.tokenizer.reflink(src, this.tokens.links)) {\n src = src.substring(token.raw.length);\n lastToken = tokens[tokens.length - 1];\n if (lastToken && token.type === 'text' && lastToken.type === 'text') {\n lastToken.raw += token.raw;\n lastToken.text += token.text;\n }\n else {\n tokens.push(token);\n }\n continue;\n }\n // em & strong\n if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {\n src = src.substring(token.raw.length);\n tokens.push(token);\n continue;\n }\n // code\n if (token = this.tokenizer.codespan(src)) {\n src = src.substring(token.raw.length);\n tokens.push(token);\n continue;\n }\n // br\n if (token = this.tokenizer.br(src)) {\n src = src.substring(token.raw.length);\n tokens.push(token);\n continue;\n }\n // del (gfm)\n if (token = this.tokenizer.del(src)) {\n src = src.substring(token.raw.length);\n tokens.push(token);\n continue;\n }\n // autolink\n if (token = this.tokenizer.autolink(src)) {\n src = src.substring(token.raw.length);\n tokens.push(token);\n continue;\n }\n // url (gfm)\n if (!this.state.inLink && (token = this.tokenizer.url(src))) {\n src = src.substring(token.raw.length);\n tokens.push(token);\n continue;\n }\n // text\n // prevent inlineText consuming extensions by clipping 'src' to extension start\n cutSrc = src;\n if (this.options.extensions && this.options.extensions.startInline) {\n let startIndex = Infinity;\n const tempSrc = src.slice(1);\n let tempStart;\n this.options.extensions.startInline.forEach((getStartIndex) => {\n tempStart = getStartIndex.call({ lexer: this }, tempSrc);\n if (typeof tempStart === 'number' && tempStart >= 0) {\n startIndex = Math.min(startIndex, tempStart);\n }\n });\n if (startIndex < Infinity && startIndex >= 0) {\n cutSrc = src.substring(0, startIndex + 1);\n }\n }\n if (token = this.tokenizer.inlineText(cutSrc)) {\n src = src.substring(token.raw.length);\n if (token.raw.slice(-1) !== '_') { // Track prevChar before string of ____ started\n prevChar = token.raw.slice(-1);\n }\n keepPrevChar = true;\n lastToken = tokens[tokens.length - 1];\n if (lastToken && lastToken.type === 'text') {\n lastToken.raw += token.raw;\n lastToken.text += token.text;\n }\n else {\n tokens.push(token);\n }\n continue;\n }\n if (src) {\n const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);\n if (this.options.silent) {\n console.error(errMsg);\n break;\n }\n else {\n throw new Error(errMsg);\n }\n }\n }\n return tokens;\n }\n}\n", "import { _defaults } from './defaults.ts';\nimport { cleanUrl, escape, } from './helpers.ts';\n/**\n * Renderer\n */\nexport class _Renderer {\n options;\n parser; // set by the parser\n constructor(options) {\n this.options = options || _defaults;\n }\n space(token) {\n return '';\n }\n code({ text, lang, escaped }) {\n const langString = (lang || '').match(/^\\S*/)?.[0];\n const code = text.replace(/\\n$/, '') + '\\n';\n if (!langString) {\n return ''\n + (escaped ? code : escape(code, true))\n + '
\\n';\n }\n return ''\n + (escaped ? code : escape(code, true))\n + '
\\n';\n }\n blockquote({ tokens }) {\n const body = this.parser.parse(tokens);\n return `\\n${body} \\n`;\n }\n html({ text }) {\n return text;\n }\n heading({ tokens, depth }) {\n return `${this.parser.parseInline(tokens)} \\n`;\n }\n hr(token) {\n return ' \\n';\n }\n list(token) {\n const ordered = token.ordered;\n const start = token.start;\n let body = '';\n for (let j = 0; j < token.items.length; j++) {\n const item = token.items[j];\n body += this.listitem(item);\n }\n const type = ordered ? 'ol' : 'ul';\n const startAttr = (ordered && start !== 1) ? (' start=\"' + start + '\"') : '';\n return '<' + type + startAttr + '>\\n' + body + '' + type + '>\\n';\n }\n listitem(item) {\n let itemBody = '';\n if (item.task) {\n const checkbox = this.checkbox({ checked: !!item.checked });\n if (item.loose) {\n if (item.tokens.length > 0 && item.tokens[0].type === 'paragraph') {\n item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;\n if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {\n item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;\n }\n }\n else {\n item.tokens.unshift({\n type: 'text',\n raw: checkbox + ' ',\n text: checkbox + ' ',\n });\n }\n }\n else {\n itemBody += checkbox + ' ';\n }\n }\n itemBody += this.parser.parse(item.tokens, !!item.loose);\n return `${itemBody} \\n`;\n }\n checkbox({ checked }) {\n return ' ';\n }\n paragraph({ tokens }) {\n return `${this.parser.parseInline(tokens)}
\\n`;\n }\n table(token) {\n let header = '';\n // header\n let cell = '';\n for (let j = 0; j < token.header.length; j++) {\n cell += this.tablecell(token.header[j]);\n }\n header += this.tablerow({ text: cell });\n let body = '';\n for (let j = 0; j < token.rows.length; j++) {\n const row = token.rows[j];\n cell = '';\n for (let k = 0; k < row.length; k++) {\n cell += this.tablecell(row[k]);\n }\n body += this.tablerow({ text: cell });\n }\n if (body)\n body = `${body} `;\n return ' \\n'\n + '\\n'\n + header\n + ' \\n'\n + body\n + '
\\n';\n }\n tablerow({ text }) {\n return `\\n${text} \\n`;\n }\n tablecell(token) {\n const content = this.parser.parseInline(token.tokens);\n const type = token.header ? 'th' : 'td';\n const tag = token.align\n ? `<${type} align=\"${token.align}\">`\n : `<${type}>`;\n return tag + content + `${type}>\\n`;\n }\n /**\n * span level renderer\n */\n strong({ tokens }) {\n return `${this.parser.parseInline(tokens)} `;\n }\n em({ tokens }) {\n return `${this.parser.parseInline(tokens)} `;\n }\n codespan({ text }) {\n return `${text}
`;\n }\n br(token) {\n return ' ';\n }\n del({ tokens }) {\n return `${this.parser.parseInline(tokens)}`;\n }\n link({ href, title, tokens }) {\n const text = this.parser.parseInline(tokens);\n const cleanHref = cleanUrl(href);\n if (cleanHref === null) {\n return text;\n }\n href = cleanHref;\n let out = '' + text + ' ';\n return out;\n }\n image({ href, title, text }) {\n const cleanHref = cleanUrl(href);\n if (cleanHref === null) {\n return text;\n }\n href = cleanHref;\n let out = ` ';\n return out;\n }\n text(token) {\n return 'tokens' in token && token.tokens ? this.parser.parseInline(token.tokens) : token.text;\n }\n}\n", "/**\n * TextRenderer\n * returns only the textual part of the token\n */\nexport class _TextRenderer {\n // no need for block level renderers\n strong({ text }) {\n return text;\n }\n em({ text }) {\n return text;\n }\n codespan({ text }) {\n return text;\n }\n del({ text }) {\n return text;\n }\n html({ text }) {\n return text;\n }\n text({ text }) {\n return text;\n }\n link({ text }) {\n return '' + text;\n }\n image({ text }) {\n return '' + text;\n }\n br() {\n return '';\n }\n}\n", "import { _Renderer } from './Renderer.ts';\nimport { _TextRenderer } from './TextRenderer.ts';\nimport { _defaults } from './defaults.ts';\n/**\n * Parsing & Compiling\n */\nexport class _Parser {\n options;\n renderer;\n textRenderer;\n constructor(options) {\n this.options = options || _defaults;\n this.options.renderer = this.options.renderer || new _Renderer();\n this.renderer = this.options.renderer;\n this.renderer.options = this.options;\n this.renderer.parser = this;\n this.textRenderer = new _TextRenderer();\n }\n /**\n * Static Parse Method\n */\n static parse(tokens, options) {\n const parser = new _Parser(options);\n return parser.parse(tokens);\n }\n /**\n * Static Parse Inline Method\n */\n static parseInline(tokens, options) {\n const parser = new _Parser(options);\n return parser.parseInline(tokens);\n }\n /**\n * Parse Loop\n */\n parse(tokens, top = true) {\n let out = '';\n for (let i = 0; i < tokens.length; i++) {\n const anyToken = tokens[i];\n // Run any renderer extensions\n if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[anyToken.type]) {\n const genericToken = anyToken;\n const ret = this.options.extensions.renderers[genericToken.type].call({ parser: this }, genericToken);\n if (ret !== false || !['space', 'hr', 'heading', 'code', 'table', 'blockquote', 'list', 'html', 'paragraph', 'text'].includes(genericToken.type)) {\n out += ret || '';\n continue;\n }\n }\n const token = anyToken;\n switch (token.type) {\n case 'space': {\n out += this.renderer.space(token);\n continue;\n }\n case 'hr': {\n out += this.renderer.hr(token);\n continue;\n }\n case 'heading': {\n out += this.renderer.heading(token);\n continue;\n }\n case 'code': {\n out += this.renderer.code(token);\n continue;\n }\n case 'table': {\n out += this.renderer.table(token);\n continue;\n }\n case 'blockquote': {\n out += this.renderer.blockquote(token);\n continue;\n }\n case 'list': {\n out += this.renderer.list(token);\n continue;\n }\n case 'html': {\n out += this.renderer.html(token);\n continue;\n }\n case 'paragraph': {\n out += this.renderer.paragraph(token);\n continue;\n }\n case 'text': {\n let textToken = token;\n let body = this.renderer.text(textToken);\n while (i + 1 < tokens.length && tokens[i + 1].type === 'text') {\n textToken = tokens[++i];\n body += '\\n' + this.renderer.text(textToken);\n }\n if (top) {\n out += this.renderer.paragraph({\n type: 'paragraph',\n raw: body,\n text: body,\n tokens: [{ type: 'text', raw: body, text: body }],\n });\n }\n else {\n out += body;\n }\n continue;\n }\n default: {\n const errMsg = 'Token with \"' + token.type + '\" type was not found.';\n if (this.options.silent) {\n console.error(errMsg);\n return '';\n }\n else {\n throw new Error(errMsg);\n }\n }\n }\n }\n return out;\n }\n /**\n * Parse Inline Tokens\n */\n parseInline(tokens, renderer) {\n renderer = renderer || this.renderer;\n let out = '';\n for (let i = 0; i < tokens.length; i++) {\n const anyToken = tokens[i];\n // Run any renderer extensions\n if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[anyToken.type]) {\n const ret = this.options.extensions.renderers[anyToken.type].call({ parser: this }, anyToken);\n if (ret !== false || !['escape', 'html', 'link', 'image', 'strong', 'em', 'codespan', 'br', 'del', 'text'].includes(anyToken.type)) {\n out += ret || '';\n continue;\n }\n }\n const token = anyToken;\n switch (token.type) {\n case 'escape': {\n out += renderer.text(token);\n break;\n }\n case 'html': {\n out += renderer.html(token);\n break;\n }\n case 'link': {\n out += renderer.link(token);\n break;\n }\n case 'image': {\n out += renderer.image(token);\n break;\n }\n case 'strong': {\n out += renderer.strong(token);\n break;\n }\n case 'em': {\n out += renderer.em(token);\n break;\n }\n case 'codespan': {\n out += renderer.codespan(token);\n break;\n }\n case 'br': {\n out += renderer.br(token);\n break;\n }\n case 'del': {\n out += renderer.del(token);\n break;\n }\n case 'text': {\n out += renderer.text(token);\n break;\n }\n default: {\n const errMsg = 'Token with \"' + token.type + '\" type was not found.';\n if (this.options.silent) {\n console.error(errMsg);\n return '';\n }\n else {\n throw new Error(errMsg);\n }\n }\n }\n }\n return out;\n }\n}\n", "import { _defaults } from './defaults.ts';\nexport class _Hooks {\n options;\n constructor(options) {\n this.options = options || _defaults;\n }\n static passThroughHooks = new Set([\n 'preprocess',\n 'postprocess',\n 'processAllTokens',\n ]);\n /**\n * Process markdown before marked\n */\n preprocess(markdown) {\n return markdown;\n }\n /**\n * Process HTML after marked is finished\n */\n postprocess(html) {\n return html;\n }\n /**\n * Process all tokens before walk tokens\n */\n processAllTokens(tokens) {\n return tokens;\n }\n}\n", "import { _getDefaults } from './defaults.ts';\nimport { _Lexer } from './Lexer.ts';\nimport { _Parser } from './Parser.ts';\nimport { _Hooks } from './Hooks.ts';\nimport { _Renderer } from './Renderer.ts';\nimport { _Tokenizer } from './Tokenizer.ts';\nimport { _TextRenderer } from './TextRenderer.ts';\nimport { escape, unescape, } from './helpers.ts';\nexport class Marked {\n defaults = _getDefaults();\n options = this.setOptions;\n parse = this.#parseMarkdown(_Lexer.lex, _Parser.parse);\n parseInline = this.#parseMarkdown(_Lexer.lexInline, _Parser.parseInline);\n Parser = _Parser;\n Renderer = _Renderer;\n TextRenderer = _TextRenderer;\n Lexer = _Lexer;\n Tokenizer = _Tokenizer;\n Hooks = _Hooks;\n constructor(...args) {\n this.use(...args);\n }\n /**\n * Run callback for every token\n */\n walkTokens(tokens, callback) {\n let values = [];\n for (const token of tokens) {\n values = values.concat(callback.call(this, token));\n switch (token.type) {\n case 'table': {\n const tableToken = token;\n for (const cell of tableToken.header) {\n values = values.concat(this.walkTokens(cell.tokens, callback));\n }\n for (const row of tableToken.rows) {\n for (const cell of row) {\n values = values.concat(this.walkTokens(cell.tokens, callback));\n }\n }\n break;\n }\n case 'list': {\n const listToken = token;\n values = values.concat(this.walkTokens(listToken.items, callback));\n break;\n }\n default: {\n const genericToken = token;\n if (this.defaults.extensions?.childTokens?.[genericToken.type]) {\n this.defaults.extensions.childTokens[genericToken.type].forEach((childTokens) => {\n const tokens = genericToken[childTokens].flat(Infinity);\n values = values.concat(this.walkTokens(tokens, callback));\n });\n }\n else if (genericToken.tokens) {\n values = values.concat(this.walkTokens(genericToken.tokens, callback));\n }\n }\n }\n }\n return values;\n }\n use(...args) {\n const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} };\n args.forEach((pack) => {\n // copy options to new object\n const opts = { ...pack };\n // set async to true if it was set to true before\n opts.async = this.defaults.async || opts.async || false;\n // ==-- Parse \"addon\" extensions --== //\n if (pack.extensions) {\n pack.extensions.forEach((ext) => {\n if (!ext.name) {\n throw new Error('extension name required');\n }\n if ('renderer' in ext) { // Renderer extensions\n const prevRenderer = extensions.renderers[ext.name];\n if (prevRenderer) {\n // Replace extension with func to run new extension but fall back if false\n extensions.renderers[ext.name] = function (...args) {\n let ret = ext.renderer.apply(this, args);\n if (ret === false) {\n ret = prevRenderer.apply(this, args);\n }\n return ret;\n };\n }\n else {\n extensions.renderers[ext.name] = ext.renderer;\n }\n }\n if ('tokenizer' in ext) { // Tokenizer Extensions\n if (!ext.level || (ext.level !== 'block' && ext.level !== 'inline')) {\n throw new Error(\"extension level must be 'block' or 'inline'\");\n }\n const extLevel = extensions[ext.level];\n if (extLevel) {\n extLevel.unshift(ext.tokenizer);\n }\n else {\n extensions[ext.level] = [ext.tokenizer];\n }\n if (ext.start) { // Function to check for start of token\n if (ext.level === 'block') {\n if (extensions.startBlock) {\n extensions.startBlock.push(ext.start);\n }\n else {\n extensions.startBlock = [ext.start];\n }\n }\n else if (ext.level === 'inline') {\n if (extensions.startInline) {\n extensions.startInline.push(ext.start);\n }\n else {\n extensions.startInline = [ext.start];\n }\n }\n }\n }\n if ('childTokens' in ext && ext.childTokens) { // Child tokens to be visited by walkTokens\n extensions.childTokens[ext.name] = ext.childTokens;\n }\n });\n opts.extensions = extensions;\n }\n // ==-- Parse \"overwrite\" extensions --== //\n if (pack.renderer) {\n const renderer = this.defaults.renderer || new _Renderer(this.defaults);\n for (const prop in pack.renderer) {\n if (!(prop in renderer)) {\n throw new Error(`renderer '${prop}' does not exist`);\n }\n if (['options', 'parser'].includes(prop)) {\n // ignore options property\n continue;\n }\n const rendererProp = prop;\n let rendererFunc = pack.renderer[rendererProp];\n if (!pack.useNewRenderer) {\n // TODO: Remove this in next major version\n rendererFunc = this.#convertRendererFunction(rendererFunc, rendererProp, renderer);\n }\n const prevRenderer = renderer[rendererProp];\n // Replace renderer with func to run extension, but fall back if false\n renderer[rendererProp] = (...args) => {\n let ret = rendererFunc.apply(renderer, args);\n if (ret === false) {\n ret = prevRenderer.apply(renderer, args);\n }\n return ret || '';\n };\n }\n opts.renderer = renderer;\n }\n if (pack.tokenizer) {\n const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);\n for (const prop in pack.tokenizer) {\n if (!(prop in tokenizer)) {\n throw new Error(`tokenizer '${prop}' does not exist`);\n }\n if (['options', 'rules', 'lexer'].includes(prop)) {\n // ignore options, rules, and lexer properties\n continue;\n }\n const tokenizerProp = prop;\n const tokenizerFunc = pack.tokenizer[tokenizerProp];\n const prevTokenizer = tokenizer[tokenizerProp];\n // Replace tokenizer with func to run extension, but fall back if false\n // @ts-expect-error cannot type tokenizer function dynamically\n tokenizer[tokenizerProp] = (...args) => {\n let ret = tokenizerFunc.apply(tokenizer, args);\n if (ret === false) {\n ret = prevTokenizer.apply(tokenizer, args);\n }\n return ret;\n };\n }\n opts.tokenizer = tokenizer;\n }\n // ==-- Parse Hooks extensions --== //\n if (pack.hooks) {\n const hooks = this.defaults.hooks || new _Hooks();\n for (const prop in pack.hooks) {\n if (!(prop in hooks)) {\n throw new Error(`hook '${prop}' does not exist`);\n }\n if (prop === 'options') {\n // ignore options property\n continue;\n }\n const hooksProp = prop;\n const hooksFunc = pack.hooks[hooksProp];\n const prevHook = hooks[hooksProp];\n if (_Hooks.passThroughHooks.has(prop)) {\n // @ts-expect-error cannot type hook function dynamically\n hooks[hooksProp] = (arg) => {\n if (this.defaults.async) {\n return Promise.resolve(hooksFunc.call(hooks, arg)).then(ret => {\n return prevHook.call(hooks, ret);\n });\n }\n const ret = hooksFunc.call(hooks, arg);\n return prevHook.call(hooks, ret);\n };\n }\n else {\n // @ts-expect-error cannot type hook function dynamically\n hooks[hooksProp] = (...args) => {\n let ret = hooksFunc.apply(hooks, args);\n if (ret === false) {\n ret = prevHook.apply(hooks, args);\n }\n return ret;\n };\n }\n }\n opts.hooks = hooks;\n }\n // ==-- Parse WalkTokens extensions --== //\n if (pack.walkTokens) {\n const walkTokens = this.defaults.walkTokens;\n const packWalktokens = pack.walkTokens;\n opts.walkTokens = function (token) {\n let values = [];\n values.push(packWalktokens.call(this, token));\n if (walkTokens) {\n values = values.concat(walkTokens.call(this, token));\n }\n return values;\n };\n }\n this.defaults = { ...this.defaults, ...opts };\n });\n return this;\n }\n // TODO: Remove this in next major release\n #convertRendererFunction(func, prop, renderer) {\n switch (prop) {\n case 'heading':\n return function (token) {\n if (!token.type || token.type !== prop) {\n // @ts-ignore\n // eslint-disable-next-line prefer-rest-params\n return func.apply(this, arguments);\n }\n return func.call(this, renderer.parser.parseInline(token.tokens), token.depth, unescape(renderer.parser.parseInline(token.tokens, renderer.parser.textRenderer)));\n };\n case 'code':\n return function (token) {\n if (!token.type || token.type !== prop) {\n // @ts-ignore\n // eslint-disable-next-line prefer-rest-params\n return func.apply(this, arguments);\n }\n return func.call(this, token.text, token.lang, !!token.escaped);\n };\n case 'table':\n return function (token) {\n if (!token.type || token.type !== prop) {\n // @ts-ignore\n // eslint-disable-next-line prefer-rest-params\n return func.apply(this, arguments);\n }\n let header = '';\n // header\n let cell = '';\n for (let j = 0; j < token.header.length; j++) {\n cell += this.tablecell({\n text: token.header[j].text,\n tokens: token.header[j].tokens,\n header: true,\n align: token.align[j],\n });\n }\n header += this.tablerow({ text: cell });\n let body = '';\n for (let j = 0; j < token.rows.length; j++) {\n const row = token.rows[j];\n cell = '';\n for (let k = 0; k < row.length; k++) {\n cell += this.tablecell({\n text: row[k].text,\n tokens: row[k].tokens,\n header: false,\n align: token.align[k],\n });\n }\n body += this.tablerow({ text: cell });\n }\n return func.call(this, header, body);\n };\n case 'blockquote':\n return function (token) {\n if (!token.type || token.type !== prop) {\n // @ts-ignore\n // eslint-disable-next-line prefer-rest-params\n return func.apply(this, arguments);\n }\n const body = this.parser.parse(token.tokens);\n return func.call(this, body);\n };\n case 'list':\n return function (token) {\n if (!token.type || token.type !== prop) {\n // @ts-ignore\n // eslint-disable-next-line prefer-rest-params\n return func.apply(this, arguments);\n }\n const ordered = token.ordered;\n const start = token.start;\n const loose = token.loose;\n let body = '';\n for (let j = 0; j < token.items.length; j++) {\n const item = token.items[j];\n const checked = item.checked;\n const task = item.task;\n let itemBody = '';\n if (item.task) {\n const checkbox = this.checkbox({ checked: !!checked });\n if (loose) {\n if (item.tokens.length > 0 && item.tokens[0].type === 'paragraph') {\n item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;\n if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {\n item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;\n }\n }\n else {\n item.tokens.unshift({\n type: 'text',\n text: checkbox + ' ',\n });\n }\n }\n else {\n itemBody += checkbox + ' ';\n }\n }\n itemBody += this.parser.parse(item.tokens, loose);\n body += this.listitem({\n type: 'list_item',\n raw: itemBody,\n text: itemBody,\n task,\n checked: !!checked,\n loose,\n tokens: item.tokens,\n });\n }\n return func.call(this, body, ordered, start);\n };\n case 'html':\n return function (token) {\n if (!token.type || token.type !== prop) {\n // @ts-ignore\n // eslint-disable-next-line prefer-rest-params\n return func.apply(this, arguments);\n }\n return func.call(this, token.text, token.block);\n };\n case 'paragraph':\n return function (token) {\n if (!token.type || token.type !== prop) {\n // @ts-ignore\n // eslint-disable-next-line prefer-rest-params\n return func.apply(this, arguments);\n }\n return func.call(this, this.parser.parseInline(token.tokens));\n };\n case 'escape':\n return function (token) {\n if (!token.type || token.type !== prop) {\n // @ts-ignore\n // eslint-disable-next-line prefer-rest-params\n return func.apply(this, arguments);\n }\n return func.call(this, token.text);\n };\n case 'link':\n return function (token) {\n if (!token.type || token.type !== prop) {\n // @ts-ignore\n // eslint-disable-next-line prefer-rest-params\n return func.apply(this, arguments);\n }\n return func.call(this, token.href, token.title, this.parser.parseInline(token.tokens));\n };\n case 'image':\n return function (token) {\n if (!token.type || token.type !== prop) {\n // @ts-ignore\n // eslint-disable-next-line prefer-rest-params\n return func.apply(this, arguments);\n }\n return func.call(this, token.href, token.title, token.text);\n };\n case 'strong':\n return function (token) {\n if (!token.type || token.type !== prop) {\n // @ts-ignore\n // eslint-disable-next-line prefer-rest-params\n return func.apply(this, arguments);\n }\n return func.call(this, this.parser.parseInline(token.tokens));\n };\n case 'em':\n return function (token) {\n if (!token.type || token.type !== prop) {\n // @ts-ignore\n // eslint-disable-next-line prefer-rest-params\n return func.apply(this, arguments);\n }\n return func.call(this, this.parser.parseInline(token.tokens));\n };\n case 'codespan':\n return function (token) {\n if (!token.type || token.type !== prop) {\n // @ts-ignore\n // eslint-disable-next-line prefer-rest-params\n return func.apply(this, arguments);\n }\n return func.call(this, token.text);\n };\n case 'del':\n return function (token) {\n if (!token.type || token.type !== prop) {\n // @ts-ignore\n // eslint-disable-next-line prefer-rest-params\n return func.apply(this, arguments);\n }\n return func.call(this, this.parser.parseInline(token.tokens));\n };\n case 'text':\n return function (token) {\n if (!token.type || token.type !== prop) {\n // @ts-ignore\n // eslint-disable-next-line prefer-rest-params\n return func.apply(this, arguments);\n }\n return func.call(this, token.text);\n };\n default:\n // do nothing\n }\n return func;\n }\n setOptions(opt) {\n this.defaults = { ...this.defaults, ...opt };\n return this;\n }\n lexer(src, options) {\n return _Lexer.lex(src, options ?? this.defaults);\n }\n parser(tokens, options) {\n return _Parser.parse(tokens, options ?? this.defaults);\n }\n #parseMarkdown(lexer, parser) {\n return (src, options) => {\n const origOpt = { ...options };\n const opt = { ...this.defaults, ...origOpt };\n // Show warning if an extension set async to true but the parse was called with async: false\n if (this.defaults.async === true && origOpt.async === false) {\n if (!opt.silent) {\n console.warn('marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored.');\n }\n opt.async = true;\n }\n const throwError = this.#onError(!!opt.silent, !!opt.async);\n // throw error in case of non string input\n if (typeof src === 'undefined' || src === null) {\n return throwError(new Error('marked(): input parameter is undefined or null'));\n }\n if (typeof src !== 'string') {\n return throwError(new Error('marked(): input parameter is of type '\n + Object.prototype.toString.call(src) + ', string expected'));\n }\n if (opt.hooks) {\n opt.hooks.options = opt;\n }\n if (opt.async) {\n return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src)\n .then(src => lexer(src, opt))\n .then(tokens => opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens)\n .then(tokens => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens)\n .then(tokens => parser(tokens, opt))\n .then(html => opt.hooks ? opt.hooks.postprocess(html) : html)\n .catch(throwError);\n }\n try {\n if (opt.hooks) {\n src = opt.hooks.preprocess(src);\n }\n let tokens = lexer(src, opt);\n if (opt.hooks) {\n tokens = opt.hooks.processAllTokens(tokens);\n }\n if (opt.walkTokens) {\n this.walkTokens(tokens, opt.walkTokens);\n }\n let html = parser(tokens, opt);\n if (opt.hooks) {\n html = opt.hooks.postprocess(html);\n }\n return html;\n }\n catch (e) {\n return throwError(e);\n }\n };\n }\n #onError(silent, async) {\n return (e) => {\n e.message += '\\nPlease report this to https://github.com/markedjs/marked.';\n if (silent) {\n const msg = 'An error occurred:
'\n + escape(e.message + '', true)\n + ' ';\n if (async) {\n return Promise.resolve(msg);\n }\n return msg;\n }\n if (async) {\n return Promise.reject(e);\n }\n throw e;\n };\n }\n}\n", "import { _Lexer } from './Lexer.ts';\nimport { _Parser } from './Parser.ts';\nimport { _Tokenizer } from './Tokenizer.ts';\nimport { _Renderer } from './Renderer.ts';\nimport { _TextRenderer } from './TextRenderer.ts';\nimport { _Hooks } from './Hooks.ts';\nimport { Marked } from './Instance.ts';\nimport { _getDefaults, changeDefaults, _defaults, } from './defaults.ts';\nconst markedInstance = new Marked();\nexport function marked(src, opt) {\n return markedInstance.parse(src, opt);\n}\n/**\n * Sets the default options.\n *\n * @param options Hash of options\n */\nmarked.options =\n marked.setOptions = function (options) {\n markedInstance.setOptions(options);\n marked.defaults = markedInstance.defaults;\n changeDefaults(marked.defaults);\n return marked;\n };\n/**\n * Gets the original marked default options.\n */\nmarked.getDefaults = _getDefaults;\nmarked.defaults = _defaults;\n/**\n * Use Extension\n */\nmarked.use = function (...args) {\n markedInstance.use(...args);\n marked.defaults = markedInstance.defaults;\n changeDefaults(marked.defaults);\n return marked;\n};\n/**\n * Run callback for every token\n */\nmarked.walkTokens = function (tokens, callback) {\n return markedInstance.walkTokens(tokens, callback);\n};\n/**\n * Compiles markdown to HTML without enclosing `p` tag.\n *\n * @param src String of markdown source to be compiled\n * @param options Hash of options\n * @return String of compiled HTML\n */\nmarked.parseInline = markedInstance.parseInline;\n/**\n * Expose\n */\nmarked.Parser = _Parser;\nmarked.parser = _Parser.parse;\nmarked.Renderer = _Renderer;\nmarked.TextRenderer = _TextRenderer;\nmarked.Lexer = _Lexer;\nmarked.lexer = _Lexer.lex;\nmarked.Tokenizer = _Tokenizer;\nmarked.Hooks = _Hooks;\nmarked.parse = marked;\nexport const options = marked.options;\nexport const setOptions = marked.setOptions;\nexport const use = marked.use;\nexport const walkTokens = marked.walkTokens;\nexport const parseInline = marked.parseInline;\nexport const parse = marked;\nexport const parser = _Parser.parse;\nexport const lexer = _Lexer.lex;\nexport { _defaults as defaults, _getDefaults as getDefaults } from './defaults.ts';\nexport { _Lexer as Lexer } from './Lexer.ts';\nexport { _Parser as Parser } from './Parser.ts';\nexport { _Tokenizer as Tokenizer } from './Tokenizer.ts';\nexport { _Renderer as Renderer } from './Renderer.ts';\nexport { _TextRenderer as TextRenderer } from './TextRenderer.ts';\nexport { _Hooks as Hooks } from './Hooks.ts';\nexport { Marked } from './Instance.ts';\n", "import type { MarkedToken, Token } from 'marked';\nimport { marked } from 'marked';\nimport { dedent } from 'ts-dedent';\nimport type { MarkdownLine, MarkdownWordType } from './types.js';\nimport type { MermaidConfig } from '../config.type.js';\n\n/**\n * @param markdown - markdown to process\n * @returns processed markdown\n */\nfunction preprocessMarkdown(markdown: string, { markdownAutoWrap }: MermaidConfig): string {\n //Replace with \\n\n const withoutBR = markdown.replace(/ /g, '\\n');\n // Replace multiple newlines with a single newline\n const withoutMultipleNewlines = withoutBR.replace(/\\n{2,}/g, '\\n');\n // Remove extra spaces at the beginning of each line\n const withoutExtraSpaces = dedent(withoutMultipleNewlines);\n if (markdownAutoWrap === false) {\n return withoutExtraSpaces.replace(/ /g, ' ');\n }\n return withoutExtraSpaces;\n}\n\n/**\n * @param markdown - markdown to split into lines\n */\nexport function markdownToLines(markdown: string, config: MermaidConfig = {}): MarkdownLine[] {\n const preprocessedMarkdown = preprocessMarkdown(markdown, config);\n const nodes = marked.lexer(preprocessedMarkdown);\n const lines: MarkdownLine[] = [[]];\n let currentLine = 0;\n\n function processNode(node: MarkedToken, parentType: MarkdownWordType = 'normal') {\n if (node.type === 'text') {\n const textLines = node.text.split('\\n');\n textLines.forEach((textLine, index) => {\n if (index !== 0) {\n currentLine++;\n lines.push([]);\n }\n textLine.split(' ').forEach((word) => {\n if (word) {\n lines[currentLine].push({ content: word, type: parentType });\n }\n });\n });\n } else if (node.type === 'strong' || node.type === 'em') {\n node.tokens.forEach((contentNode) => {\n processNode(contentNode as MarkedToken, node.type);\n });\n } else if (node.type === 'html') {\n lines[currentLine].push({ content: node.text, type: 'normal' });\n }\n }\n\n nodes.forEach((treeNode) => {\n if (treeNode.type === 'paragraph') {\n treeNode.tokens?.forEach((contentNode) => {\n processNode(contentNode as MarkedToken);\n });\n } else if (treeNode.type === 'html') {\n lines[currentLine].push({ content: treeNode.text, type: 'normal' });\n }\n });\n\n return lines;\n}\n\nexport function markdownToHTML(markdown: string, { markdownAutoWrap }: MermaidConfig = {}) {\n const nodes = marked.lexer(markdown);\n\n function output(node: Token): string {\n if (node.type === 'text') {\n if (markdownAutoWrap === false) {\n return node.text.replace(/\\n */g, ' ').replace(/ /g, ' ');\n }\n return node.text.replace(/\\n */g, ' ');\n } else if (node.type === 'strong') {\n return `${node.tokens?.map(output).join('')} `;\n } else if (node.type === 'em') {\n return `${node.tokens?.map(output).join('')} `;\n } else if (node.type === 'paragraph') {\n return `${node.tokens?.map(output).join('')}
`;\n } else if (node.type === 'space') {\n return '';\n } else if (node.type === 'html') {\n return `${node.text}`;\n }\n return `Unsupported markdown: ${node.type}`;\n }\n\n return nodes.map(output).join('');\n}\n", "import type { CheckFitFunction, MarkdownLine, MarkdownWord, MarkdownWordType } from './types.js';\n\n/**\n * Splits a string into graphemes if available, otherwise characters.\n */\nexport function splitTextToChars(text: string): string[] {\n if (Intl.Segmenter) {\n return [...new Intl.Segmenter().segment(text)].map((s) => s.segment);\n }\n return [...text];\n}\n\n/**\n * Splits a string into words by using `Intl.Segmenter` if available, or splitting by ' '.\n * `Intl.Segmenter` uses the default locale, which might be different across browsers.\n */\nexport function splitLineToWords(text: string): string[] {\n if (Intl.Segmenter) {\n return [...new Intl.Segmenter(undefined, { granularity: 'word' }).segment(text)].map(\n (s) => s.segment\n );\n }\n // Split by ' ' removes the ' 's from the result.\n const words = text.split(' ');\n // Add the ' 's back to the result.\n const wordsWithSpaces = words.flatMap((s) => [s, ' ']).filter((s) => s);\n // Remove last space.\n wordsWithSpaces.pop();\n return wordsWithSpaces;\n}\n\n/**\n * Splits a word into two parts, the first part fits the width and the remaining part.\n * @param checkFit - Function to check if word fits\n * @param word - Word to split\n * @returns [first part of word that fits, rest of word]\n */\nexport function splitWordToFitWidth(\n checkFit: CheckFitFunction,\n word: MarkdownWord\n): [MarkdownWord, MarkdownWord] {\n const characters = splitTextToChars(word.content);\n return splitWordToFitWidthRecursion(checkFit, [], characters, word.type);\n}\n\nfunction splitWordToFitWidthRecursion(\n checkFit: CheckFitFunction,\n usedChars: string[],\n remainingChars: string[],\n type: MarkdownWordType\n): [MarkdownWord, MarkdownWord] {\n if (remainingChars.length === 0) {\n return [\n { content: usedChars.join(''), type },\n { content: '', type },\n ];\n }\n const [nextChar, ...rest] = remainingChars;\n const newWord = [...usedChars, nextChar];\n if (checkFit([{ content: newWord.join(''), type }])) {\n return splitWordToFitWidthRecursion(checkFit, newWord, rest, type);\n }\n if (usedChars.length === 0 && nextChar) {\n // If the first character does not fit, split it anyway\n usedChars.push(nextChar);\n remainingChars.shift();\n }\n return [\n { content: usedChars.join(''), type },\n { content: remainingChars.join(''), type },\n ];\n}\n\n/**\n * Splits a line into multiple lines that satisfy the checkFit function.\n * @param line - Line to split\n * @param checkFit - Function to check if line fits\n * @returns Array of lines that fit\n */\nexport function splitLineToFitWidth(\n line: MarkdownLine,\n checkFit: CheckFitFunction\n): MarkdownLine[] {\n if (line.some(({ content }) => content.includes('\\n'))) {\n throw new Error('splitLineToFitWidth does not support newlines in the line');\n }\n return splitLineToFitWidthRecursion(line, checkFit);\n}\n\nfunction splitLineToFitWidthRecursion(\n words: MarkdownWord[],\n checkFit: CheckFitFunction,\n lines: MarkdownLine[] = [],\n newLine: MarkdownLine = []\n): MarkdownLine[] {\n // Return if there is nothing left to split\n if (words.length === 0) {\n // If there is a new line, add it to the lines\n if (newLine.length > 0) {\n lines.push(newLine);\n }\n return lines.length > 0 ? lines : [];\n }\n let joiner = '';\n if (words[0].content === ' ') {\n joiner = ' ';\n words.shift();\n }\n const nextWord: MarkdownWord = words.shift() ?? { content: ' ', type: 'normal' };\n const lineWithNextWord: MarkdownLine = [...newLine];\n if (joiner !== '') {\n lineWithNextWord.push({ content: joiner, type: 'normal' });\n }\n lineWithNextWord.push(nextWord);\n\n if (checkFit(lineWithNextWord)) {\n // nextWord fits, so we can add it to the new line and continue\n return splitLineToFitWidthRecursion(words, checkFit, lines, lineWithNextWord);\n }\n\n // nextWord doesn't fit, so we need to split it\n if (newLine.length > 0) {\n // There was text in newLine, so add it to lines and push nextWord back into words.\n lines.push(newLine);\n words.unshift(nextWord);\n } else if (nextWord.content) {\n // There was no text in newLine, so we need to split nextWord\n const [line, rest] = splitWordToFitWidth(checkFit, nextWord);\n lines.push([line]);\n if (rest.content) {\n words.unshift(rest);\n }\n }\n return splitLineToFitWidthRecursion(words, checkFit, lines);\n}\n", "/* eslint-disable @typescript-eslint/no-explicit-any */\n// @ts-nocheck TODO: Fix types\nimport { getConfig } from '$root/diagram-api/diagramAPI.js';\nimport common, { hasKatex, renderKatex } from '$root/diagrams/common/common.js';\nimport { select } from 'd3';\nimport type { MermaidConfig } from '../config.type.js';\nimport type { SVGGroup } from '../diagram-api/types.js';\nimport type { D3TSpanElement, D3TextElement } from '../diagrams/common/commonTypes.js';\nimport { log } from '../logger.js';\nimport { markdownToHTML, markdownToLines } from '../rendering-util/handle-markdown-text.js';\nimport { decodeEntities } from '../utils.js';\nimport { splitLineToFitWidth } from './splitText.js';\nimport type { MarkdownLine, MarkdownWord } from './types.js';\n\nfunction applyStyle(dom, styleFn) {\n if (styleFn) {\n dom.attr('style', styleFn);\n }\n}\n\nasync function addHtmlSpan(element, node, width, classes, addBackground = false) {\n const fo = element.append('foreignObject');\n const div = fo.append('xhtml:div');\n let label = node.label;\n if (node.label && hasKatex(node.label)) {\n label = await renderKatex(node.label.replace(common.lineBreakRegex, '\\n'), getConfig());\n }\n const labelClass = node.isNode ? 'nodeLabel' : 'edgeLabel';\n const span = div.append('span');\n span.html(label);\n applyStyle(span, node.labelStyle);\n span.attr('class', `${labelClass} ${classes}`);\n\n applyStyle(div, node.labelStyle);\n div.style('display', 'table-cell');\n div.style('white-space', 'nowrap');\n div.style('line-height', '1.5');\n div.style('max-width', width + 'px');\n div.style('text-align', 'center');\n div.attr('xmlns', 'http://www.w3.org/1999/xhtml');\n if (addBackground) {\n div.attr('class', 'labelBkg');\n }\n\n let bbox = div.node().getBoundingClientRect();\n if (bbox.width === width) {\n div.style('display', 'table');\n div.style('white-space', 'break-spaces');\n div.style('width', width + 'px');\n bbox = div.node().getBoundingClientRect();\n }\n\n // fo.style('width', bbox.width);\n // fo.style('height', bbox.height);\n\n return fo.node();\n}\n\n/**\n * Creates a tspan element with the specified attributes for text positioning.\n *\n * @param textElement - The parent text element to append the tspan element.\n * @param lineIndex - The index of the current line in the structuredText array.\n * @param lineHeight - The line height value for the text.\n * @returns The created tspan element.\n */\nfunction createTspan(textElement: any, lineIndex: number, lineHeight: number) {\n return textElement\n .append('tspan')\n .attr('class', 'text-outer-tspan')\n .attr('x', 0)\n .attr('y', lineIndex * lineHeight - 0.1 + 'em')\n .attr('dy', lineHeight + 'em');\n}\n\nfunction computeWidthOfText(parentNode: any, lineHeight: number, line: MarkdownLine): number {\n const testElement = parentNode.append('text');\n const testSpan = createTspan(testElement, 1, lineHeight);\n updateTextContentAndStyles(testSpan, line);\n const textLength = testSpan.node().getComputedTextLength();\n testElement.remove();\n return textLength;\n}\n\nexport function computeDimensionOfText(\n parentNode: SVGGroup,\n lineHeight: number,\n text: string\n): DOMRect | undefined {\n const testElement: D3TextElement = parentNode.append('text');\n const testSpan: D3TSpanElement = createTspan(testElement, 1, lineHeight);\n updateTextContentAndStyles(testSpan, [{ content: text, type: 'normal' }]);\n const textDimension: DOMRect | undefined = testSpan.node()?.getBoundingClientRect();\n if (textDimension) {\n testElement.remove();\n }\n return textDimension;\n}\n\n/**\n * Creates a formatted text element by breaking lines and applying styles based on\n * the given structuredText.\n *\n * @param width - The maximum allowed width of the text.\n * @param g - The parent group element to append the formatted text.\n * @param structuredText - The structured text data to format.\n * @param addBackground - Whether to add a background to the text.\n */\nfunction createFormattedText(\n width: number,\n g: any,\n structuredText: MarkdownWord[][],\n addBackground = false\n) {\n const lineHeight = 1.1;\n const labelGroup = g.append('g');\n const bkg = labelGroup.insert('rect').attr('class', 'background').attr('style', 'stroke: none');\n const textElement = labelGroup.append('text').attr('y', '-10.1');\n let lineIndex = 0;\n for (const line of structuredText) {\n /**\n * Preprocess raw string content of line data\n * Creating an array of strings pre-split to satisfy width limit\n */\n const checkWidth = (line: MarkdownLine) =>\n computeWidthOfText(labelGroup, lineHeight, line) <= width;\n const linesUnderWidth = checkWidth(line) ? [line] : splitLineToFitWidth(line, checkWidth);\n /** Add each prepared line as a tspan to the parent node */\n for (const preparedLine of linesUnderWidth) {\n const tspan = createTspan(textElement, lineIndex, lineHeight);\n updateTextContentAndStyles(tspan, preparedLine);\n lineIndex++;\n }\n }\n if (addBackground) {\n const bbox = textElement.node().getBBox();\n const padding = 2;\n bkg\n .attr('x', -padding)\n .attr('y', -padding)\n .attr('width', bbox.width + 2 * padding)\n .attr('height', bbox.height + 2 * padding);\n\n return labelGroup.node();\n } else {\n return textElement.node();\n }\n}\n\n/**\n * Updates the text content and styles of the given tspan element based on the\n * provided wrappedLine data.\n *\n * @param tspan - The tspan element to update.\n * @param wrappedLine - The line data to apply to the tspan element.\n */\nfunction updateTextContentAndStyles(tspan: any, wrappedLine: MarkdownWord[]) {\n tspan.text('');\n\n wrappedLine.forEach((word, index) => {\n const innerTspan = tspan\n .append('tspan')\n .attr('font-style', word.type === 'em' ? 'italic' : 'normal')\n .attr('class', 'text-inner-tspan')\n .attr('font-weight', word.type === 'strong' ? 'bold' : 'normal');\n if (index === 0) {\n innerTspan.text(word.content);\n } else {\n // TODO: check what joiner to use.\n innerTspan.text(' ' + word.content);\n }\n });\n}\n\n/**\n * Convert fontawesome labels into fontawesome icons by using a regex pattern\n * @param text - The raw string to convert\n * @returns string with fontawesome icons as i tags\n */\nexport function replaceIconSubstring(text: string) {\n // The letters 'bklrs' stand for possible endings of the fontawesome prefix (e.g. 'fab' for brands, 'fak' for fa-kit) // cspell: disable-line\n return text.replace(\n /fa[bklrs]?:fa-[\\w-]+/g, // cspell: disable-line\n (s) => ` `\n );\n}\n\n// Note when using from flowcharts converting the API isNode means classes should be set accordingly. When using htmlLabels => to sett classes to'nodeLabel' when isNode=true otherwise 'edgeLabel'\n// When not using htmlLabels => to set classes to 'title-row' when isTitle=true otherwise 'title-row'\nexport const createText = async (\n el,\n text = '',\n {\n style = '',\n isTitle = false,\n classes = '',\n useHtmlLabels = true,\n isNode = true,\n width = 200,\n addSvgBackground = false,\n } = {},\n config: MermaidConfig\n) => {\n log.info(\n 'XYZ createText',\n text,\n style,\n isTitle,\n classes,\n useHtmlLabels,\n isNode,\n 'addSvgBackground: ',\n addSvgBackground\n );\n if (useHtmlLabels) {\n // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?\n\n const htmlText = markdownToHTML(text, config);\n const decodedReplacedText = replaceIconSubstring(decodeEntities(htmlText));\n\n //for Katex the text could contain escaped characters, \\\\relax that should be transformed to \\relax\n const inputForKatex = text.replace(/\\\\\\\\/g, '\\\\');\n\n const node = {\n isNode,\n label: hasKatex(text) ? inputForKatex : decodedReplacedText,\n labelStyle: style.replace('fill:', 'color:'),\n };\n const vertexNode = await addHtmlSpan(el, node, width, classes, addSvgBackground);\n return vertexNode;\n } else {\n //sometimes the user might add br tags with 1 or more spaces in between, so we need to replace them with \n const sanitizeBR = text.replace(/ /g, ' ');\n const structuredText = markdownToLines(sanitizeBR.replace(' ', ' '), config);\n const svgLabel = createFormattedText(\n width,\n el,\n structuredText,\n text ? addSvgBackground : false\n );\n if (isNode) {\n if (/stroke:/.exec(style)) {\n style = style.replace('stroke:', 'lineColor:');\n }\n\n const nodeLabelTextStyle = style\n .replace(/stroke:[^;]+;?/g, '')\n .replace(/stroke-width:[^;]+;?/g, '')\n .replace(/fill:[^;]+;?/g, '')\n .replace(/color:/g, 'fill:');\n select(svgLabel).attr('style', nodeLabelTextStyle);\n // svgLabel.setAttribute('style', style);\n } else {\n //On style, assume `stroke`, `stroke-width` are used for edge path, so remove them\n // remove `fill`\n // use `background` as `fill` for label rect,\n\n const edgeLabelRectStyle = style\n .replace(/stroke:[^;]+;?/g, '')\n .replace(/stroke-width:[^;]+;?/g, '')\n .replace(/fill:[^;]+;?/g, '')\n .replace(/background:/g, 'fill:');\n select(svgLabel)\n .select('rect')\n .attr('style', edgeLabelRectStyle.replace(/background:/g, 'fill:'));\n\n // for text, update fill color with `color`\n const edgeLabelTextStyle = style\n .replace(/stroke:[^;]+;?/g, '')\n .replace(/stroke-width:[^;]+;?/g, '')\n .replace(/fill:[^;]+;?/g, '')\n .replace(/color:/g, 'fill:');\n select(svgLabel).select('text').attr('style', edgeLabelTextStyle);\n }\n return svgLabel;\n }\n};\n", "import { select } from 'd3';\nimport { log } from '../logger.js';\nimport { getConfig } from '../diagram-api/diagramAPI.js';\nimport { evaluate } from '../diagrams/common/common.js';\nimport { decodeEntities } from '../utils.js';\nimport { replaceIconSubstring } from '../rendering-util/createText.js';\n\n/**\n * @param dom\n * @param styleFn\n */\nfunction applyStyle(dom, styleFn) {\n if (styleFn) {\n dom.attr('style', styleFn);\n }\n}\n\n/**\n * @param {any} node\n * @returns {SVGForeignObjectElement} Node\n */\nfunction addHtmlLabel(node) {\n const fo = select(document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject'));\n const div = fo.append('xhtml:div');\n\n const label = node.label;\n const labelClass = node.isNode ? 'nodeLabel' : 'edgeLabel';\n const span = div.append('span');\n span.html(label);\n applyStyle(span, node.labelStyle);\n span.attr('class', labelClass);\n\n applyStyle(div, node.labelStyle);\n div.style('display', 'inline-block');\n // Fix for firefox\n div.style('white-space', 'nowrap');\n div.attr('xmlns', 'http://www.w3.org/1999/xhtml');\n return fo.node();\n}\n/**\n * @param _vertexText\n * @param style\n * @param isTitle\n * @param isNode\n * @deprecated svg-util/createText instead\n */\nconst createLabel = (_vertexText, style, isTitle, isNode) => {\n let vertexText = _vertexText || '';\n if (typeof vertexText === 'object') {\n vertexText = vertexText[0];\n }\n if (evaluate(getConfig().flowchart.htmlLabels)) {\n // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?\n vertexText = vertexText.replace(/\\\\n|\\n/g, ' ');\n log.debug('vertexText' + vertexText);\n const node = {\n isNode,\n label: replaceIconSubstring(decodeEntities(vertexText)),\n labelStyle: style.replace('fill:', 'color:'),\n };\n let vertexNode = addHtmlLabel(node);\n // vertexNode.parentNode.removeChild(vertexNode);\n return vertexNode;\n } else {\n const svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');\n svgLabel.setAttribute('style', style.replace('color:', 'fill:'));\n let rows = [];\n if (typeof vertexText === 'string') {\n rows = vertexText.split(/\\\\n|\\n| /gi);\n } else if (Array.isArray(vertexText)) {\n rows = vertexText;\n } else {\n rows = [];\n }\n\n for (const row of rows) {\n const tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');\n tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');\n tspan.setAttribute('dy', '1em');\n tspan.setAttribute('x', '0');\n if (isTitle) {\n tspan.setAttribute('class', 'title-row');\n } else {\n tspan.setAttribute('class', 'row');\n }\n tspan.textContent = row.trim();\n svgLabel.appendChild(tspan);\n }\n return svgLabel;\n }\n};\n\nexport default createLabel;\n", "/**\n * @param node\n * @param point\n */\nfunction intersectNode(node, point) {\n // console.info('Intersect Node');\n return node.intersect(point);\n}\n\nexport default intersectNode;\n", "/**\n * @param node\n * @param rx\n * @param ry\n * @param point\n */\nfunction intersectEllipse(node, rx, ry, point) {\n // Formulae from: https://mathworld.wolfram.com/Ellipse-LineIntersection.html\n\n var cx = node.x;\n var cy = node.y;\n\n var px = cx - point.x;\n var py = cy - point.y;\n\n var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px);\n\n var dx = Math.abs((rx * ry * px) / det);\n if (point.x < cx) {\n dx = -dx;\n }\n var dy = Math.abs((rx * ry * py) / det);\n if (point.y < cy) {\n dy = -dy;\n }\n\n return { x: cx + dx, y: cy + dy };\n}\n\nexport default intersectEllipse;\n", "import intersectEllipse from './intersect-ellipse.js';\n\n/**\n * @param node\n * @param rx\n * @param point\n */\nfunction intersectCircle(node, rx, point) {\n return intersectEllipse(node, rx, rx, point);\n}\n\nexport default intersectCircle;\n", "/**\n * Returns the point at which two lines, p and q, intersect or returns undefined if they do not intersect.\n *\n * @param p1\n * @param p2\n * @param q1\n * @param q2\n */\nfunction intersectLine(p1, p2, q1, q2) {\n // Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994,\n // p7 and p473.\n\n var a1, a2, b1, b2, c1, c2;\n var r1, r2, r3, r4;\n var denom, offset, num;\n var x, y;\n\n // Compute a1, b1, c1, where line joining points 1 and 2 is F(x,y) = a1 x +\n // b1 y + c1 = 0.\n a1 = p2.y - p1.y;\n b1 = p1.x - p2.x;\n c1 = p2.x * p1.y - p1.x * p2.y;\n\n // Compute r3 and r4.\n r3 = a1 * q1.x + b1 * q1.y + c1;\n r4 = a1 * q2.x + b1 * q2.y + c1;\n\n // Check signs of r3 and r4. If both point 3 and point 4 lie on\n // same side of line 1, the line segments do not intersect.\n if (r3 !== 0 && r4 !== 0 && sameSign(r3, r4)) {\n return /*DON'T_INTERSECT*/;\n }\n\n // Compute a2, b2, c2 where line joining points 3 and 4 is G(x,y) = a2 x + b2 y + c2 = 0\n a2 = q2.y - q1.y;\n b2 = q1.x - q2.x;\n c2 = q2.x * q1.y - q1.x * q2.y;\n\n // Compute r1 and r2\n r1 = a2 * p1.x + b2 * p1.y + c2;\n r2 = a2 * p2.x + b2 * p2.y + c2;\n\n // Check signs of r1 and r2. If both point 1 and point 2 lie\n // on same side of second line segment, the line segments do\n // not intersect.\n if (r1 !== 0 && r2 !== 0 && sameSign(r1, r2)) {\n return /*DON'T_INTERSECT*/;\n }\n\n // Line segments intersect: compute intersection point.\n denom = a1 * b2 - a2 * b1;\n if (denom === 0) {\n return /*COLLINEAR*/;\n }\n\n offset = Math.abs(denom / 2);\n\n // The denom/2 is to get rounding instead of truncating. It\n // is added or subtracted to the numerator, depending upon the\n // sign of the numerator.\n num = b1 * c2 - b2 * c1;\n x = num < 0 ? (num - offset) / denom : (num + offset) / denom;\n\n num = a2 * c1 - a1 * c2;\n y = num < 0 ? (num - offset) / denom : (num + offset) / denom;\n\n return { x: x, y: y };\n}\n\n/**\n * @param r1\n * @param r2\n */\nfunction sameSign(r1, r2) {\n return r1 * r2 > 0;\n}\n\nexport default intersectLine;\n", "/* eslint \"no-console\": off */\n\nimport intersectLine from './intersect-line.js';\n\nexport default intersectPolygon;\n\n/**\n * Returns the point ({x, y}) at which the point argument intersects with the node argument assuming\n * that it has the shape specified by polygon.\n *\n * @param node\n * @param polyPoints\n * @param point\n */\nfunction intersectPolygon(node, polyPoints, point) {\n var x1 = node.x;\n var y1 = node.y;\n\n var intersections = [];\n\n var minX = Number.POSITIVE_INFINITY;\n var minY = Number.POSITIVE_INFINITY;\n if (typeof polyPoints.forEach === 'function') {\n polyPoints.forEach(function (entry) {\n minX = Math.min(minX, entry.x);\n minY = Math.min(minY, entry.y);\n });\n } else {\n minX = Math.min(minX, polyPoints.x);\n minY = Math.min(minY, polyPoints.y);\n }\n\n var left = x1 - node.width / 2 - minX;\n var top = y1 - node.height / 2 - minY;\n\n for (var i = 0; i < polyPoints.length; i++) {\n var p1 = polyPoints[i];\n var p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0];\n var intersect = intersectLine(\n node,\n point,\n { x: left + p1.x, y: top + p1.y },\n { x: left + p2.x, y: top + p2.y }\n );\n if (intersect) {\n intersections.push(intersect);\n }\n }\n\n if (!intersections.length) {\n // console.log('NO INTERSECTION FOUND, RETURN NODE CENTER', node);\n return node;\n }\n\n if (intersections.length > 1) {\n // More intersections, find the one nearest to edge end point\n intersections.sort(function (p, q) {\n var pdx = p.x - point.x;\n var pdy = p.y - point.y;\n var distp = Math.sqrt(pdx * pdx + pdy * pdy);\n\n var qdx = q.x - point.x;\n var qdy = q.y - point.y;\n var distq = Math.sqrt(qdx * qdx + qdy * qdy);\n\n return distp < distq ? -1 : distp === distq ? 0 : 1;\n });\n }\n return intersections[0];\n}\n", "const intersectRect = (node, point) => {\n var x = node.x;\n var y = node.y;\n\n // Rectangle intersection algorithm from:\n // https://math.stackexchange.com/questions/108113/find-edge-between-two-boxes\n var dx = point.x - x;\n var dy = point.y - y;\n var w = node.width / 2;\n var h = node.height / 2;\n\n var sx, sy;\n if (Math.abs(dy) * w > Math.abs(dx) * h) {\n // Intersection is top or bottom of rect.\n if (dy < 0) {\n h = -h;\n }\n sx = dy === 0 ? 0 : (h * dx) / dy;\n sy = h;\n } else {\n // Intersection is left or right of rect.\n if (dx < 0) {\n w = -w;\n }\n sx = w;\n sy = dx === 0 ? 0 : (w * dy) / dx;\n }\n\n return { x: x + sx, y: y + sy };\n};\n\nexport default intersectRect;\n", "/*\n * Borrowed with love from dagre-d3. Many thanks to cpettitt!\n */\n\nimport node from './intersect-node.js';\nimport circle from './intersect-circle.js';\nimport ellipse from './intersect-ellipse.js';\nimport polygon from './intersect-polygon.js';\nimport rect from './intersect-rect.js';\n\nexport default {\n node,\n circle,\n ellipse,\n polygon,\n rect,\n};\n", "import createLabel from '../createLabel.js';\nimport { createText } from '../../rendering-util/createText.js';\nimport { getConfig } from '../../diagram-api/diagramAPI.js';\nimport { select } from 'd3';\nimport { evaluate, sanitizeText } from '../../diagrams/common/common.js';\nimport { decodeEntities } from '../../utils.js';\n\nexport const labelHelper = async (parent, node, _classes, isNode) => {\n const config = getConfig();\n let classes;\n const useHtmlLabels = node.useHtmlLabels || evaluate(config.flowchart.htmlLabels);\n if (!_classes) {\n classes = 'node default';\n } else {\n classes = _classes;\n }\n\n // Add outer g element\n const shapeSvg = parent\n .insert('g')\n .attr('class', classes)\n .attr('id', node.domId || node.id);\n\n // Create the label and insert it after the rect\n const label = shapeSvg.insert('g').attr('class', 'label').attr('style', node.labelStyle);\n\n // Replace labelText with default value if undefined\n let labelText;\n if (node.labelText === undefined) {\n labelText = '';\n } else {\n labelText = typeof node.labelText === 'string' ? node.labelText : node.labelText[0];\n }\n\n const textNode = label.node();\n let text;\n if (node.labelType === 'markdown') {\n // text = textNode;\n text = createText(\n label,\n sanitizeText(decodeEntities(labelText), config),\n {\n useHtmlLabels,\n width: node.width || config.flowchart.wrappingWidth,\n classes: 'markdown-node-label',\n },\n config\n );\n } else {\n text = textNode.appendChild(\n createLabel(sanitizeText(decodeEntities(labelText), config), node.labelStyle, false, isNode)\n );\n }\n // Get the size of the label\n let bbox = text.getBBox();\n const halfPadding = node.padding / 2;\n\n if (evaluate(config.flowchart.htmlLabels)) {\n const div = text.children[0];\n const dv = select(text);\n\n // if there are images, need to wait for them to load before getting the bounding box\n const images = div.getElementsByTagName('img');\n if (images) {\n const noImgText = labelText.replace(/ ]*>/g, '').trim() === '';\n\n await Promise.all(\n [...images].map(\n (img) =>\n new Promise((res) => {\n /**\n *\n */\n function setupImage() {\n img.style.display = 'flex';\n img.style.flexDirection = 'column';\n\n if (noImgText) {\n // default size if no text\n const bodyFontSize = config.fontSize\n ? config.fontSize\n : window.getComputedStyle(document.body).fontSize;\n const enlargingFactor = 5;\n const width = parseInt(bodyFontSize, 10) * enlargingFactor + 'px';\n img.style.minWidth = width;\n img.style.maxWidth = width;\n } else {\n img.style.width = '100%';\n }\n res(img);\n }\n setTimeout(() => {\n if (img.complete) {\n setupImage();\n }\n });\n img.addEventListener('error', setupImage);\n img.addEventListener('load', setupImage);\n })\n )\n );\n }\n\n bbox = div.getBoundingClientRect();\n dv.attr('width', bbox.width);\n dv.attr('height', bbox.height);\n }\n\n // Center the label\n if (useHtmlLabels) {\n label.attr('transform', 'translate(' + -bbox.width / 2 + ', ' + -bbox.height / 2 + ')');\n } else {\n label.attr('transform', 'translate(' + 0 + ', ' + -bbox.height / 2 + ')');\n }\n if (node.centerLabel) {\n label.attr('transform', 'translate(' + -bbox.width / 2 + ', ' + -bbox.height / 2 + ')');\n }\n label.insert('rect', ':first-child');\n\n return { shapeSvg, bbox, halfPadding, label };\n};\n\nexport const updateNodeBounds = (node, element) => {\n const bbox = element.node().getBBox();\n node.width = bbox.width;\n node.height = bbox.height;\n};\n\n/**\n * @param parent\n * @param w\n * @param h\n * @param points\n */\nexport function insertPolygonShape(parent, w, h, points) {\n return parent\n .insert('polygon', ':first-child')\n .attr(\n 'points',\n points\n .map(function (d) {\n return d.x + ',' + d.y;\n })\n .join(' ')\n )\n .attr('class', 'label-container')\n .attr('transform', 'translate(' + -w / 2 + ',' + h / 2 + ')');\n}\n", "import { updateNodeBounds, labelHelper } from './util.js';\nimport { log } from '../../logger.js';\nimport { getConfig } from '../../diagram-api/diagramAPI.js';\nimport intersect from '../intersect/index.js';\n\nconst note = async (parent, node) => {\n const useHtmlLabels = node.useHtmlLabels || getConfig().flowchart.htmlLabels;\n if (!useHtmlLabels) {\n node.centerLabel = true;\n }\n const { shapeSvg, bbox, halfPadding } = await labelHelper(\n parent,\n node,\n 'node ' + node.classes,\n true\n );\n\n log.info('Classes = ', node.classes);\n // add the rect\n const rect = shapeSvg.insert('rect', ':first-child');\n\n rect\n .attr('rx', node.rx)\n .attr('ry', node.ry)\n .attr('x', -bbox.width / 2 - halfPadding)\n .attr('y', -bbox.height / 2 - halfPadding)\n .attr('width', bbox.width + node.padding)\n .attr('height', bbox.height + node.padding);\n\n updateNodeBounds(node, rect);\n\n node.intersect = function (point) {\n return intersect.rect(node, point);\n };\n\n return shapeSvg;\n};\n\nexport default note;\n", "import { select } from 'd3';\nimport { getConfig } from '../diagram-api/diagramAPI.js';\nimport { evaluate } from '../diagrams/common/common.js';\nimport { log } from '../logger.js';\nimport { getArrowPoints } from './blockArrowHelper.js';\nimport createLabel from './createLabel.js';\nimport intersect from './intersect/index.js';\nimport note from './shapes/note.js';\nimport { insertPolygonShape, labelHelper, updateNodeBounds } from './shapes/util.js';\n\nconst formatClass = (str) => {\n if (str) {\n return ' ' + str;\n }\n return '';\n};\nconst getClassesFromNode = (node, otherClasses) => {\n return `${otherClasses ? otherClasses : 'node default'}${formatClass(node.classes)} ${formatClass(\n node.class\n )}`;\n};\n\nconst question = async (parent, node) => {\n const { shapeSvg, bbox } = await labelHelper(\n parent,\n node,\n getClassesFromNode(node, undefined),\n true\n );\n\n const w = bbox.width + node.padding;\n const h = bbox.height + node.padding;\n const s = w + h;\n\n const points = [\n { x: s / 2, y: 0 },\n { x: s, y: -s / 2 },\n { x: s / 2, y: -s },\n { x: 0, y: -s / 2 },\n ];\n\n log.info('Question main (Circle)');\n\n const questionElem = insertPolygonShape(shapeSvg, s, s, points);\n questionElem.attr('style', node.style);\n updateNodeBounds(node, questionElem);\n\n node.intersect = function (point) {\n log.warn('Intersect called');\n return intersect.polygon(node, points, point);\n };\n\n return shapeSvg;\n};\n\nconst choice = (parent, node) => {\n const shapeSvg = parent\n .insert('g')\n .attr('class', 'node default')\n .attr('id', node.domId || node.id);\n\n const s = 28;\n const points = [\n { x: 0, y: s / 2 },\n { x: s / 2, y: 0 },\n { x: 0, y: -s / 2 },\n { x: -s / 2, y: 0 },\n ];\n\n const choice = shapeSvg.insert('polygon', ':first-child').attr(\n 'points',\n points\n .map(function (d) {\n return d.x + ',' + d.y;\n })\n .join(' ')\n );\n // center the circle around its coordinate\n choice.attr('class', 'state-start').attr('r', 7).attr('width', 28).attr('height', 28);\n node.width = 28;\n node.height = 28;\n\n node.intersect = function (point) {\n return intersect.circle(node, 14, point);\n };\n\n return shapeSvg;\n};\n\nconst hexagon = async (parent, node) => {\n const { shapeSvg, bbox } = await labelHelper(\n parent,\n node,\n getClassesFromNode(node, undefined),\n true\n );\n\n const f = 4;\n const h = bbox.height + node.padding;\n const m = h / f;\n const w = bbox.width + 2 * m + node.padding;\n const points = [\n { x: m, y: 0 },\n { x: w - m, y: 0 },\n { x: w, y: -h / 2 },\n { x: w - m, y: -h },\n { x: m, y: -h },\n { x: 0, y: -h / 2 },\n ];\n\n const hex = insertPolygonShape(shapeSvg, w, h, points);\n hex.attr('style', node.style);\n updateNodeBounds(node, hex);\n\n node.intersect = function (point) {\n return intersect.polygon(node, points, point);\n };\n\n return shapeSvg;\n};\n\nconst block_arrow = async (parent, node) => {\n const { shapeSvg, bbox } = await labelHelper(parent, node, undefined, true);\n\n const f = 2;\n const h = bbox.height + 2 * node.padding;\n const m = h / f;\n const w = bbox.width + 2 * m + node.padding;\n\n const points = getArrowPoints(node.directions, bbox, node);\n\n const blockArrow = insertPolygonShape(shapeSvg, w, h, points);\n blockArrow.attr('style', node.style);\n updateNodeBounds(node, blockArrow);\n\n node.intersect = function (point) {\n return intersect.polygon(node, points, point);\n };\n\n return shapeSvg;\n};\n\nconst rect_left_inv_arrow = async (parent, node) => {\n const { shapeSvg, bbox } = await labelHelper(\n parent,\n node,\n getClassesFromNode(node, undefined),\n true\n );\n\n const w = bbox.width + node.padding;\n const h = bbox.height + node.padding;\n const points = [\n { x: -h / 2, y: 0 },\n { x: w, y: 0 },\n { x: w, y: -h },\n { x: -h / 2, y: -h },\n { x: 0, y: -h / 2 },\n ];\n\n const el = insertPolygonShape(shapeSvg, w, h, points);\n el.attr('style', node.style);\n\n node.width = w + h;\n node.height = h;\n\n node.intersect = function (point) {\n return intersect.polygon(node, points, point);\n };\n\n return shapeSvg;\n};\n\nconst lean_right = async (parent, node) => {\n const { shapeSvg, bbox } = await labelHelper(parent, node, getClassesFromNode(node), true);\n\n const w = bbox.width + node.padding;\n const h = bbox.height + node.padding;\n const points = [\n { x: (-2 * h) / 6, y: 0 },\n { x: w - h / 6, y: 0 },\n { x: w + (2 * h) / 6, y: -h },\n { x: h / 6, y: -h },\n ];\n\n const el = insertPolygonShape(shapeSvg, w, h, points);\n el.attr('style', node.style);\n updateNodeBounds(node, el);\n\n node.intersect = function (point) {\n return intersect.polygon(node, points, point);\n };\n\n return shapeSvg;\n};\n\nconst lean_left = async (parent, node) => {\n const { shapeSvg, bbox } = await labelHelper(\n parent,\n node,\n getClassesFromNode(node, undefined),\n true\n );\n\n const w = bbox.width + node.padding;\n const h = bbox.height + node.padding;\n const points = [\n { x: (2 * h) / 6, y: 0 },\n { x: w + h / 6, y: 0 },\n { x: w - (2 * h) / 6, y: -h },\n { x: -h / 6, y: -h },\n ];\n\n const el = insertPolygonShape(shapeSvg, w, h, points);\n el.attr('style', node.style);\n updateNodeBounds(node, el);\n\n node.intersect = function (point) {\n return intersect.polygon(node, points, point);\n };\n\n return shapeSvg;\n};\n\nconst trapezoid = async (parent, node) => {\n const { shapeSvg, bbox } = await labelHelper(\n parent,\n node,\n getClassesFromNode(node, undefined),\n true\n );\n\n const w = bbox.width + node.padding;\n const h = bbox.height + node.padding;\n const points = [\n { x: (-2 * h) / 6, y: 0 },\n { x: w + (2 * h) / 6, y: 0 },\n { x: w - h / 6, y: -h },\n { x: h / 6, y: -h },\n ];\n\n const el = insertPolygonShape(shapeSvg, w, h, points);\n el.attr('style', node.style);\n updateNodeBounds(node, el);\n\n node.intersect = function (point) {\n return intersect.polygon(node, points, point);\n };\n\n return shapeSvg;\n};\n\nconst inv_trapezoid = async (parent, node) => {\n const { shapeSvg, bbox } = await labelHelper(\n parent,\n node,\n getClassesFromNode(node, undefined),\n true\n );\n\n const w = bbox.width + node.padding;\n const h = bbox.height + node.padding;\n const points = [\n { x: h / 6, y: 0 },\n { x: w - h / 6, y: 0 },\n { x: w + (2 * h) / 6, y: -h },\n { x: (-2 * h) / 6, y: -h },\n ];\n\n const el = insertPolygonShape(shapeSvg, w, h, points);\n el.attr('style', node.style);\n updateNodeBounds(node, el);\n\n node.intersect = function (point) {\n return intersect.polygon(node, points, point);\n };\n\n return shapeSvg;\n};\n\nconst rect_right_inv_arrow = async (parent, node) => {\n const { shapeSvg, bbox } = await labelHelper(\n parent,\n node,\n getClassesFromNode(node, undefined),\n true\n );\n\n const w = bbox.width + node.padding;\n const h = bbox.height + node.padding;\n const points = [\n { x: 0, y: 0 },\n { x: w + h / 2, y: 0 },\n { x: w, y: -h / 2 },\n { x: w + h / 2, y: -h },\n { x: 0, y: -h },\n ];\n\n const el = insertPolygonShape(shapeSvg, w, h, points);\n el.attr('style', node.style);\n updateNodeBounds(node, el);\n\n node.intersect = function (point) {\n return intersect.polygon(node, points, point);\n };\n\n return shapeSvg;\n};\n\nconst cylinder = async (parent, node) => {\n const { shapeSvg, bbox } = await labelHelper(\n parent,\n node,\n getClassesFromNode(node, undefined),\n true\n );\n\n const w = bbox.width + node.padding;\n const rx = w / 2;\n const ry = rx / (2.5 + w / 50);\n const h = bbox.height + ry + node.padding;\n\n const shape =\n 'M 0,' +\n ry +\n ' a ' +\n rx +\n ',' +\n ry +\n ' 0,0,0 ' +\n w +\n ' 0 a ' +\n rx +\n ',' +\n ry +\n ' 0,0,0 ' +\n -w +\n ' 0 l 0,' +\n h +\n ' a ' +\n rx +\n ',' +\n ry +\n ' 0,0,0 ' +\n w +\n ' 0 l 0,' +\n -h;\n\n const el = shapeSvg\n .attr('label-offset-y', ry)\n .insert('path', ':first-child')\n .attr('style', node.style)\n .attr('d', shape)\n .attr('transform', 'translate(' + -w / 2 + ',' + -(h / 2 + ry) + ')');\n\n updateNodeBounds(node, el);\n\n node.intersect = function (point) {\n const pos = intersect.rect(node, point);\n const x = pos.x - node.x;\n\n if (\n rx != 0 &&\n (Math.abs(x) < node.width / 2 ||\n (Math.abs(x) == node.width / 2 && Math.abs(pos.y - node.y) > node.height / 2 - ry))\n ) {\n // ellipsis equation: x*x / a*a + y*y / b*b = 1\n // solve for y to get adjusted value for pos.y\n let y = ry * ry * (1 - (x * x) / (rx * rx));\n if (y != 0) {\n y = Math.sqrt(y);\n }\n y = ry - y;\n if (point.y - node.y > 0) {\n y = -y;\n }\n\n pos.y += y;\n }\n\n return pos;\n };\n\n return shapeSvg;\n};\n\nconst rect = async (parent, node) => {\n const { shapeSvg, bbox, halfPadding } = await labelHelper(\n parent,\n node,\n 'node ' + node.classes + ' ' + node.class,\n true\n );\n\n // add the rect\n const rect = shapeSvg.insert('rect', ':first-child');\n\n // console.log('Rect node:', node, 'bbox:', bbox, 'halfPadding:', halfPadding, 'node.padding:', node.padding);\n // const totalWidth = bbox.width + node.padding * 2;\n // const totalHeight = bbox.height + node.padding * 2;\n const totalWidth = node.positioned ? node.width : bbox.width + node.padding;\n const totalHeight = node.positioned ? node.height : bbox.height + node.padding;\n const x = node.positioned ? -totalWidth / 2 : -bbox.width / 2 - halfPadding;\n const y = node.positioned ? -totalHeight / 2 : -bbox.height / 2 - halfPadding;\n rect\n .attr('class', 'basic label-container')\n .attr('style', node.style)\n .attr('rx', node.rx)\n .attr('ry', node.ry)\n .attr('x', x)\n .attr('y', y)\n .attr('width', totalWidth)\n .attr('height', totalHeight);\n\n if (node.props) {\n const propKeys = new Set(Object.keys(node.props));\n if (node.props.borders) {\n applyNodePropertyBorders(rect, node.props.borders, totalWidth, totalHeight);\n propKeys.delete('borders');\n }\n propKeys.forEach((propKey) => {\n log.warn(`Unknown node property ${propKey}`);\n });\n }\n\n updateNodeBounds(node, rect);\n\n node.intersect = function (point) {\n return intersect.rect(node, point);\n };\n\n return shapeSvg;\n};\n\nconst composite = async (parent, node) => {\n const { shapeSvg, bbox, halfPadding } = await labelHelper(\n parent,\n node,\n 'node ' + node.classes,\n true\n );\n\n // add the rect\n const rect = shapeSvg.insert('rect', ':first-child');\n\n // const totalWidth = bbox.width + node.padding * 2;\n // const totalHeight = bbox.height + node.padding * 2;\n const totalWidth = node.positioned ? node.width : bbox.width + node.padding;\n const totalHeight = node.positioned ? node.height : bbox.height + node.padding;\n const x = node.positioned ? -totalWidth / 2 : -bbox.width / 2 - halfPadding;\n const y = node.positioned ? -totalHeight / 2 : -bbox.height / 2 - halfPadding;\n rect\n .attr('class', 'basic cluster composite label-container')\n .attr('style', node.style)\n .attr('rx', node.rx)\n .attr('ry', node.ry)\n .attr('x', x)\n .attr('y', y)\n .attr('width', totalWidth)\n .attr('height', totalHeight);\n\n if (node.props) {\n const propKeys = new Set(Object.keys(node.props));\n if (node.props.borders) {\n applyNodePropertyBorders(rect, node.props.borders, totalWidth, totalHeight);\n propKeys.delete('borders');\n }\n propKeys.forEach((propKey) => {\n log.warn(`Unknown node property ${propKey}`);\n });\n }\n\n updateNodeBounds(node, rect);\n\n node.intersect = function (point) {\n return intersect.rect(node, point);\n };\n\n return shapeSvg;\n};\n\nconst labelRect = async (parent, node) => {\n const { shapeSvg } = await labelHelper(parent, node, 'label', true);\n\n log.trace('Classes = ', node.class);\n // add the rect\n const rect = shapeSvg.insert('rect', ':first-child');\n\n // Hide the rect we are only after the label\n const totalWidth = 0;\n const totalHeight = 0;\n rect.attr('width', totalWidth).attr('height', totalHeight);\n shapeSvg.attr('class', 'label edgeLabel');\n\n if (node.props) {\n const propKeys = new Set(Object.keys(node.props));\n if (node.props.borders) {\n applyNodePropertyBorders(rect, node.props.borders, totalWidth, totalHeight);\n propKeys.delete('borders');\n }\n propKeys.forEach((propKey) => {\n log.warn(`Unknown node property ${propKey}`);\n });\n }\n\n updateNodeBounds(node, rect);\n\n node.intersect = function (point) {\n return intersect.rect(node, point);\n };\n\n return shapeSvg;\n};\n\n/**\n * @param rect\n * @param borders\n * @param totalWidth\n * @param totalHeight\n */\nfunction applyNodePropertyBorders(rect, borders, totalWidth, totalHeight) {\n const strokeDashArray = [];\n const addBorder = (length) => {\n strokeDashArray.push(length, 0);\n };\n const skipBorder = (length) => {\n strokeDashArray.push(0, length);\n };\n if (borders.includes('t')) {\n log.debug('add top border');\n addBorder(totalWidth);\n } else {\n skipBorder(totalWidth);\n }\n if (borders.includes('r')) {\n log.debug('add right border');\n addBorder(totalHeight);\n } else {\n skipBorder(totalHeight);\n }\n if (borders.includes('b')) {\n log.debug('add bottom border');\n addBorder(totalWidth);\n } else {\n skipBorder(totalWidth);\n }\n if (borders.includes('l')) {\n log.debug('add left border');\n addBorder(totalHeight);\n } else {\n skipBorder(totalHeight);\n }\n rect.attr('stroke-dasharray', strokeDashArray.join(' '));\n}\n\nconst rectWithTitle = (parent, node) => {\n // const { shapeSvg, bbox, halfPadding } = labelHelper(parent, node, 'node ' + node.classes);\n\n let classes;\n if (!node.classes) {\n classes = 'node default';\n } else {\n classes = 'node ' + node.classes;\n }\n // Add outer g element\n const shapeSvg = parent\n .insert('g')\n .attr('class', classes)\n .attr('id', node.domId || node.id);\n\n // Create the title label and insert it after the rect\n const rect = shapeSvg.insert('rect', ':first-child');\n // const innerRect = shapeSvg.insert('rect');\n const innerLine = shapeSvg.insert('line');\n\n const label = shapeSvg.insert('g').attr('class', 'label');\n\n const text2 = node.labelText.flat ? node.labelText.flat() : node.labelText;\n // const text2 = typeof text2prim === 'object' ? text2prim[0] : text2prim;\n\n let title = '';\n if (typeof text2 === 'object') {\n title = text2[0];\n } else {\n title = text2;\n }\n log.info('Label text abc79', title, text2, typeof text2 === 'object');\n\n const text = label.node().appendChild(createLabel(title, node.labelStyle, true, true));\n let bbox = { width: 0, height: 0 };\n if (evaluate(getConfig().flowchart.htmlLabels)) {\n const div = text.children[0];\n const dv = select(text);\n bbox = div.getBoundingClientRect();\n dv.attr('width', bbox.width);\n dv.attr('height', bbox.height);\n }\n log.info('Text 2', text2);\n const textRows = text2.slice(1, text2.length);\n let titleBox = text.getBBox();\n const descr = label\n .node()\n .appendChild(\n createLabel(textRows.join ? textRows.join(' ') : textRows, node.labelStyle, true, true)\n );\n\n if (evaluate(getConfig().flowchart.htmlLabels)) {\n const div = descr.children[0];\n const dv = select(descr);\n bbox = div.getBoundingClientRect();\n dv.attr('width', bbox.width);\n dv.attr('height', bbox.height);\n }\n // bbox = label.getBBox();\n // log.info(descr);\n const halfPadding = node.padding / 2;\n select(descr).attr(\n 'transform',\n 'translate( ' +\n // (titleBox.width - bbox.width) / 2 +\n (bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) +\n ', ' +\n (titleBox.height + halfPadding + 5) +\n ')'\n );\n select(text).attr(\n 'transform',\n 'translate( ' +\n // (titleBox.width - bbox.width) / 2 +\n (bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) +\n ', ' +\n 0 +\n ')'\n );\n // Get the size of the label\n\n // Bounding box for title and text\n bbox = label.node().getBBox();\n\n // Center the label\n label.attr(\n 'transform',\n 'translate(' + -bbox.width / 2 + ', ' + (-bbox.height / 2 - halfPadding + 3) + ')'\n );\n\n rect\n .attr('class', 'outer title-state')\n .attr('x', -bbox.width / 2 - halfPadding)\n .attr('y', -bbox.height / 2 - halfPadding)\n .attr('width', bbox.width + node.padding)\n .attr('height', bbox.height + node.padding);\n\n innerLine\n .attr('class', 'divider')\n .attr('x1', -bbox.width / 2 - halfPadding)\n .attr('x2', bbox.width / 2 + halfPadding)\n .attr('y1', -bbox.height / 2 - halfPadding + titleBox.height + halfPadding)\n .attr('y2', -bbox.height / 2 - halfPadding + titleBox.height + halfPadding);\n\n updateNodeBounds(node, rect);\n\n node.intersect = function (point) {\n return intersect.rect(node, point);\n };\n\n return shapeSvg;\n};\n\nconst stadium = async (parent, node) => {\n const { shapeSvg, bbox } = await labelHelper(\n parent,\n node,\n getClassesFromNode(node, undefined),\n true\n );\n\n const h = bbox.height + node.padding;\n const w = bbox.width + h / 4 + node.padding;\n\n // add the rect\n const rect = shapeSvg\n .insert('rect', ':first-child')\n .attr('style', node.style)\n .attr('rx', h / 2)\n .attr('ry', h / 2)\n .attr('x', -w / 2)\n .attr('y', -h / 2)\n .attr('width', w)\n .attr('height', h);\n\n updateNodeBounds(node, rect);\n\n node.intersect = function (point) {\n return intersect.rect(node, point);\n };\n\n return shapeSvg;\n};\n\nconst circle = async (parent, node) => {\n const { shapeSvg, bbox, halfPadding } = await labelHelper(\n parent,\n node,\n getClassesFromNode(node, undefined),\n true\n );\n const circle = shapeSvg.insert('circle', ':first-child');\n\n // center the circle around its coordinate\n circle\n .attr('style', node.style)\n .attr('rx', node.rx)\n .attr('ry', node.ry)\n .attr('r', bbox.width / 2 + halfPadding)\n .attr('width', bbox.width + node.padding)\n .attr('height', bbox.height + node.padding);\n\n log.info('Circle main');\n\n updateNodeBounds(node, circle);\n\n node.intersect = function (point) {\n log.info('Circle intersect', node, bbox.width / 2 + halfPadding, point);\n return intersect.circle(node, bbox.width / 2 + halfPadding, point);\n };\n\n return shapeSvg;\n};\n\nconst doublecircle = async (parent, node) => {\n const { shapeSvg, bbox, halfPadding } = await labelHelper(\n parent,\n node,\n getClassesFromNode(node, undefined),\n true\n );\n const gap = 5;\n const circleGroup = shapeSvg.insert('g', ':first-child');\n const outerCircle = circleGroup.insert('circle');\n const innerCircle = circleGroup.insert('circle');\n\n circleGroup.attr('class', node.class);\n\n // center the circle around its coordinate\n outerCircle\n .attr('style', node.style)\n .attr('rx', node.rx)\n .attr('ry', node.ry)\n .attr('r', bbox.width / 2 + halfPadding + gap)\n .attr('width', bbox.width + node.padding + gap * 2)\n .attr('height', bbox.height + node.padding + gap * 2);\n\n innerCircle\n .attr('style', node.style)\n .attr('rx', node.rx)\n .attr('ry', node.ry)\n .attr('r', bbox.width / 2 + halfPadding)\n .attr('width', bbox.width + node.padding)\n .attr('height', bbox.height + node.padding);\n\n log.info('DoubleCircle main');\n\n updateNodeBounds(node, outerCircle);\n\n node.intersect = function (point) {\n log.info('DoubleCircle intersect', node, bbox.width / 2 + halfPadding + gap, point);\n return intersect.circle(node, bbox.width / 2 + halfPadding + gap, point);\n };\n\n return shapeSvg;\n};\n\nconst subroutine = async (parent, node) => {\n const { shapeSvg, bbox } = await labelHelper(\n parent,\n node,\n getClassesFromNode(node, undefined),\n true\n );\n\n const w = bbox.width + node.padding;\n const h = bbox.height + node.padding;\n const points = [\n { x: 0, y: 0 },\n { x: w, y: 0 },\n { x: w, y: -h },\n { x: 0, y: -h },\n { x: 0, y: 0 },\n { x: -8, y: 0 },\n { x: w + 8, y: 0 },\n { x: w + 8, y: -h },\n { x: -8, y: -h },\n { x: -8, y: 0 },\n ];\n\n const el = insertPolygonShape(shapeSvg, w, h, points);\n el.attr('style', node.style);\n updateNodeBounds(node, el);\n\n node.intersect = function (point) {\n return intersect.polygon(node, points, point);\n };\n\n return shapeSvg;\n};\n\nconst start = (parent, node) => {\n const shapeSvg = parent\n .insert('g')\n .attr('class', 'node default')\n .attr('id', node.domId || node.id);\n const circle = shapeSvg.insert('circle', ':first-child');\n\n // center the circle around its coordinate\n circle.attr('class', 'state-start').attr('r', 7).attr('width', 14).attr('height', 14);\n\n updateNodeBounds(node, circle);\n\n node.intersect = function (point) {\n return intersect.circle(node, 7, point);\n };\n\n return shapeSvg;\n};\n\nconst forkJoin = (parent, node, dir) => {\n const shapeSvg = parent\n .insert('g')\n .attr('class', 'node default')\n .attr('id', node.domId || node.id);\n\n let width = 70;\n let height = 10;\n\n if (dir === 'LR') {\n width = 10;\n height = 70;\n }\n\n const shape = shapeSvg\n .append('rect')\n .attr('x', (-1 * width) / 2)\n .attr('y', (-1 * height) / 2)\n .attr('width', width)\n .attr('height', height)\n .attr('class', 'fork-join');\n\n updateNodeBounds(node, shape);\n node.height = node.height + node.padding / 2;\n node.width = node.width + node.padding / 2;\n node.intersect = function (point) {\n return intersect.rect(node, point);\n };\n\n return shapeSvg;\n};\n\nconst end = (parent, node) => {\n const shapeSvg = parent\n .insert('g')\n .attr('class', 'node default')\n .attr('id', node.domId || node.id);\n const innerCircle = shapeSvg.insert('circle', ':first-child');\n const circle = shapeSvg.insert('circle', ':first-child');\n\n circle.attr('class', 'state-start').attr('r', 7).attr('width', 14).attr('height', 14);\n\n innerCircle.attr('class', 'state-end').attr('r', 5).attr('width', 10).attr('height', 10);\n\n updateNodeBounds(node, circle);\n\n node.intersect = function (point) {\n return intersect.circle(node, 7, point);\n };\n\n return shapeSvg;\n};\n\nconst class_box = (parent, node) => {\n const halfPadding = node.padding / 2;\n const rowPadding = 4;\n const lineHeight = 8;\n\n let classes;\n if (!node.classes) {\n classes = 'node default';\n } else {\n classes = 'node ' + node.classes;\n }\n // Add outer g element\n const shapeSvg = parent\n .insert('g')\n .attr('class', classes)\n .attr('id', node.domId || node.id);\n\n // Create the title label and insert it after the rect\n const rect = shapeSvg.insert('rect', ':first-child');\n const topLine = shapeSvg.insert('line');\n const bottomLine = shapeSvg.insert('line');\n let maxWidth = 0;\n let maxHeight = rowPadding;\n\n const labelContainer = shapeSvg.insert('g').attr('class', 'label');\n let verticalPos = 0;\n const hasInterface = node.classData.annotations?.[0];\n\n // 1. Create the labels\n const interfaceLabelText = node.classData.annotations[0]\n ? '\u00AB' + node.classData.annotations[0] + '\u00BB'\n : '';\n const interfaceLabel = labelContainer\n .node()\n .appendChild(createLabel(interfaceLabelText, node.labelStyle, true, true));\n let interfaceBBox = interfaceLabel.getBBox();\n if (evaluate(getConfig().flowchart.htmlLabels)) {\n const div = interfaceLabel.children[0];\n const dv = select(interfaceLabel);\n interfaceBBox = div.getBoundingClientRect();\n dv.attr('width', interfaceBBox.width);\n dv.attr('height', interfaceBBox.height);\n }\n if (node.classData.annotations[0]) {\n maxHeight += interfaceBBox.height + rowPadding;\n maxWidth += interfaceBBox.width;\n }\n\n let classTitleString = node.classData.label;\n\n if (node.classData.type !== undefined && node.classData.type !== '') {\n if (getConfig().flowchart.htmlLabels) {\n classTitleString += '<' + node.classData.type + '>';\n } else {\n classTitleString += '<' + node.classData.type + '>';\n }\n }\n const classTitleLabel = labelContainer\n .node()\n .appendChild(createLabel(classTitleString, node.labelStyle, true, true));\n select(classTitleLabel).attr('class', 'classTitle');\n let classTitleBBox = classTitleLabel.getBBox();\n if (evaluate(getConfig().flowchart.htmlLabels)) {\n const div = classTitleLabel.children[0];\n const dv = select(classTitleLabel);\n classTitleBBox = div.getBoundingClientRect();\n dv.attr('width', classTitleBBox.width);\n dv.attr('height', classTitleBBox.height);\n }\n maxHeight += classTitleBBox.height + rowPadding;\n if (classTitleBBox.width > maxWidth) {\n maxWidth = classTitleBBox.width;\n }\n const classAttributes = [];\n node.classData.members.forEach((member) => {\n const parsedInfo = member.getDisplayDetails();\n let parsedText = parsedInfo.displayText;\n if (getConfig().flowchart.htmlLabels) {\n parsedText = parsedText.replace(//g, '>');\n }\n const lbl = labelContainer\n .node()\n .appendChild(\n createLabel(\n parsedText,\n parsedInfo.cssStyle ? parsedInfo.cssStyle : node.labelStyle,\n true,\n true\n )\n );\n let bbox = lbl.getBBox();\n if (evaluate(getConfig().flowchart.htmlLabels)) {\n const div = lbl.children[0];\n const dv = select(lbl);\n bbox = div.getBoundingClientRect();\n dv.attr('width', bbox.width);\n dv.attr('height', bbox.height);\n }\n if (bbox.width > maxWidth) {\n maxWidth = bbox.width;\n }\n maxHeight += bbox.height + rowPadding;\n classAttributes.push(lbl);\n });\n\n maxHeight += lineHeight;\n\n const classMethods = [];\n node.classData.methods.forEach((member) => {\n const parsedInfo = member.getDisplayDetails();\n let displayText = parsedInfo.displayText;\n if (getConfig().flowchart.htmlLabels) {\n displayText = displayText.replace(//g, '>');\n }\n const lbl = labelContainer\n .node()\n .appendChild(\n createLabel(\n displayText,\n parsedInfo.cssStyle ? parsedInfo.cssStyle : node.labelStyle,\n true,\n true\n )\n );\n let bbox = lbl.getBBox();\n if (evaluate(getConfig().flowchart.htmlLabels)) {\n const div = lbl.children[0];\n const dv = select(lbl);\n bbox = div.getBoundingClientRect();\n dv.attr('width', bbox.width);\n dv.attr('height', bbox.height);\n }\n if (bbox.width > maxWidth) {\n maxWidth = bbox.width;\n }\n maxHeight += bbox.height + rowPadding;\n\n classMethods.push(lbl);\n });\n\n maxHeight += lineHeight;\n\n // 2. Position the labels\n\n // position the interface label\n if (hasInterface) {\n let diffX = (maxWidth - interfaceBBox.width) / 2;\n select(interfaceLabel).attr(\n 'transform',\n 'translate( ' + ((-1 * maxWidth) / 2 + diffX) + ', ' + (-1 * maxHeight) / 2 + ')'\n );\n verticalPos = interfaceBBox.height + rowPadding;\n }\n // Position the class title label\n let diffX = (maxWidth - classTitleBBox.width) / 2;\n select(classTitleLabel).attr(\n 'transform',\n 'translate( ' +\n ((-1 * maxWidth) / 2 + diffX) +\n ', ' +\n ((-1 * maxHeight) / 2 + verticalPos) +\n ')'\n );\n verticalPos += classTitleBBox.height + rowPadding;\n\n topLine\n .attr('class', 'divider')\n .attr('x1', -maxWidth / 2 - halfPadding)\n .attr('x2', maxWidth / 2 + halfPadding)\n .attr('y1', -maxHeight / 2 - halfPadding + lineHeight + verticalPos)\n .attr('y2', -maxHeight / 2 - halfPadding + lineHeight + verticalPos);\n\n verticalPos += lineHeight;\n\n classAttributes.forEach((lbl) => {\n select(lbl).attr(\n 'transform',\n 'translate( ' +\n -maxWidth / 2 +\n ', ' +\n ((-1 * maxHeight) / 2 + verticalPos + lineHeight / 2) +\n ')'\n );\n //get the height of the bounding box of each member if exists\n const memberBBox = lbl?.getBBox();\n verticalPos += (memberBBox?.height ?? 0) + rowPadding;\n });\n\n verticalPos += lineHeight;\n bottomLine\n .attr('class', 'divider')\n .attr('x1', -maxWidth / 2 - halfPadding)\n .attr('x2', maxWidth / 2 + halfPadding)\n .attr('y1', -maxHeight / 2 - halfPadding + lineHeight + verticalPos)\n .attr('y2', -maxHeight / 2 - halfPadding + lineHeight + verticalPos);\n\n verticalPos += lineHeight;\n\n classMethods.forEach((lbl) => {\n select(lbl).attr(\n 'transform',\n 'translate( ' + -maxWidth / 2 + ', ' + ((-1 * maxHeight) / 2 + verticalPos) + ')'\n );\n const memberBBox = lbl?.getBBox();\n verticalPos += (memberBBox?.height ?? 0) + rowPadding;\n });\n\n rect\n .attr('style', node.style)\n .attr('class', 'outer title-state')\n .attr('x', -maxWidth / 2 - halfPadding)\n .attr('y', -(maxHeight / 2) - halfPadding)\n .attr('width', maxWidth + node.padding)\n .attr('height', maxHeight + node.padding);\n\n updateNodeBounds(node, rect);\n\n node.intersect = function (point) {\n return intersect.rect(node, point);\n };\n\n return shapeSvg;\n};\n\nconst shapes = {\n rhombus: question,\n composite,\n question,\n rect,\n labelRect,\n rectWithTitle,\n choice,\n circle,\n doublecircle,\n stadium,\n hexagon,\n block_arrow,\n rect_left_inv_arrow,\n lean_right,\n lean_left,\n trapezoid,\n inv_trapezoid,\n rect_right_inv_arrow,\n cylinder,\n start,\n end,\n note,\n subroutine,\n fork: forkJoin,\n join: forkJoin,\n class_box,\n};\n\nlet nodeElems = {};\n\nexport const insertNode = async (elem, node, dir) => {\n let newEl;\n let el;\n\n // Add link when appropriate\n if (node.link) {\n let target;\n if (getConfig().securityLevel === 'sandbox') {\n target = '_top';\n } else if (node.linkTarget) {\n target = node.linkTarget || '_blank';\n }\n newEl = elem.insert('svg:a').attr('xlink:href', node.link).attr('target', target);\n el = await shapes[node.shape](newEl, node, dir);\n } else {\n el = await shapes[node.shape](elem, node, dir);\n newEl = el;\n }\n if (node.tooltip) {\n el.attr('title', node.tooltip);\n }\n if (node.class) {\n el.attr('class', 'node default ' + node.class);\n }\n\n nodeElems[node.id] = newEl;\n\n if (node.haveCallback) {\n nodeElems[node.id].attr('class', nodeElems[node.id].attr('class') + ' clickable');\n }\n return newEl;\n};\nexport const setNodeElem = (elem, node) => {\n nodeElems[node.id] = elem;\n};\nexport const clear = () => {\n nodeElems = {};\n};\n\nexport const positionNode = (node) => {\n const el = nodeElems[node.id];\n log.trace(\n 'Transforming node',\n node.diff,\n node,\n 'translate(' + (node.x - node.width / 2 - 5) + ', ' + node.width / 2 + ')'\n );\n const padding = 8;\n const diff = node.diff || 0;\n if (node.clusterNode) {\n el.attr(\n 'transform',\n 'translate(' +\n (node.x + diff - node.width / 2) +\n ', ' +\n (node.y - node.height / 2 - padding) +\n ')'\n );\n } else {\n el.attr('transform', 'translate(' + node.x + ', ' + node.y + ')');\n }\n return diff;\n};\n", "import { select } from 'd3';\nimport { insertNode } from '../dagre-wrapper/nodes.js';\n\nexport const getDiagramElement = (id, securityLevel) => {\n let sandboxElement;\n if (securityLevel === 'sandbox') {\n sandboxElement = select('#i' + id);\n }\n const root =\n securityLevel === 'sandbox'\n ? select(sandboxElement.nodes()[0].contentDocument.body)\n : select('body');\n\n const svg = root.select(`[id=\"${id}\"]`);\n\n // Run the renderer. This is what draws the final graph.\n\n return svg;\n};\n\nexport function insertElementsForSize(el, data) {\n const nodesElem = el.insert('g').attr('class', 'nodes');\n el.insert('g').attr('class', 'edges');\n data.nodes.forEach(async (item) => {\n item.shape = 'rect';\n await insertNode(nodesElem, {\n ...item,\n class: 'default flowchart-label',\n labelStyle: '',\n x: 0,\n y: 0,\n width: 100,\n rx: 0,\n ry: 0,\n height: 100,\n shape: 'rect',\n padding: 8,\n });\n // Create a new DOM element\n // const element = document.createElement('div');\n\n // // Set the content of the element to the name of the item\n // element.textContent = item.name;\n\n // // Set the size of the element to the size of the item\n // element.style.width = `${item.size}px`;\n // element.style.height = `${item.size}px`;\n\n // Append the element to the body of the document\n // document.body.appendChild(element);\n });\n}\n", "import type { FlowchartDiagramConfig } from '../config.type.js';\n\nexport const getSubGraphTitleMargins = ({\n flowchart,\n}: {\n flowchart: FlowchartDiagramConfig;\n}): {\n subGraphTitleTopMargin: number;\n subGraphTitleBottomMargin: number;\n subGraphTitleTotalMargin: number;\n} => {\n const subGraphTitleTopMargin = flowchart?.subGraphTitleMargin?.top ?? 0;\n const subGraphTitleBottomMargin = flowchart?.subGraphTitleMargin?.bottom ?? 0;\n const subGraphTitleTotalMargin = subGraphTitleTopMargin + subGraphTitleBottomMargin;\n\n return {\n subGraphTitleTopMargin,\n subGraphTitleBottomMargin,\n subGraphTitleTotalMargin,\n };\n};\n", "function t(t,e,s){if(t&&t.length){const[n,o]=e,a=Math.PI/180*s,h=Math.cos(a),r=Math.sin(a);for(const e of t){const[t,s]=e;e[0]=(t-n)*h-(s-o)*r+n,e[1]=(t-n)*r+(s-o)*h+o}}}function e(t,e){return t[0]===e[0]&&t[1]===e[1]}function s(s,n,o,a=1){const h=o,r=Math.max(n,.1),i=s[0]&&s[0][0]&&\"number\"==typeof s[0][0]?[s]:s,c=[0,0];if(h)for(const e of i)t(e,c,h);const l=function(t,s,n){const o=[];for(const s of t){const t=[...s];e(t[0],t[t.length-1])||t.push([t[0][0],t[0][1]]),t.length>2&&o.push(t)}const a=[];s=Math.max(s,.1);const h=[];for(const t of o)for(let e=0;et.ymine.ymin?1:t.xe.x?1:t.ymax===e.ymax?0:(t.ymax-e.ymax)/Math.abs(t.ymax-e.ymax))),!h.length)return a;let r=[],i=h[0].ymin,c=0;for(;r.length||h.length;){if(h.length){let t=-1;for(let e=0;ei);e++)t=e;h.splice(0,t+1).forEach((t=>{r.push({s:i,edge:t})}))}if(r=r.filter((t=>!(t.edge.ymax<=i))),r.sort(((t,e)=>t.edge.x===e.edge.x?0:(t.edge.x-e.edge.x)/Math.abs(t.edge.x-e.edge.x))),(1!==n||c%s==0)&&r.length>1)for(let t=0;t=r.length)break;const s=r[t].edge,n=r[e].edge;a.push([[Math.round(s.x),i],[Math.round(n.x),i]])}i+=n,r.forEach((t=>{t.edge.x=t.edge.x+n*t.edge.islope})),c++}return a}(i,r,a);if(h){for(const e of i)t(e,c,-h);!function(e,s,n){const o=[];e.forEach((t=>o.push(...t))),t(o,s,n)}(l,c,-h)}return l}function n(t,e){var n;const o=e.hachureAngle+90;let a=e.hachureGap;a<0&&(a=4*e.strokeWidth),a=Math.round(Math.max(a,.1));let h=1;return e.roughness>=1&&((null===(n=e.randomizer)||void 0===n?void 0:n.next())||Math.random())>.7&&(h=a),s(t,a,o,h||1)}class o{constructor(t){this.helper=t}fillPolygons(t,e){return this._fillPolygons(t,e)}_fillPolygons(t,e){const s=n(t,e);return{type:\"fillSketch\",ops:this.renderLines(s,e)}}renderLines(t,e){const s=[];for(const n of t)s.push(...this.helper.doubleLineOps(n[0][0],n[0][1],n[1][0],n[1][1],e));return s}}function a(t){const e=t[0],s=t[1];return Math.sqrt(Math.pow(e[0]-s[0],2)+Math.pow(e[1]-s[1],2))}class h extends o{fillPolygons(t,e){let s=e.hachureGap;s<0&&(s=4*e.strokeWidth),s=Math.max(s,.1);const o=n(t,Object.assign({},e,{hachureGap:s})),h=Math.PI/180*e.hachureAngle,r=[],i=.5*s*Math.cos(h),c=.5*s*Math.sin(h);for(const[t,e]of o)a([t,e])&&r.push([[t[0]-i,t[1]+c],[...e]],[[t[0]+i,t[1]-c],[...e]]);return{type:\"fillSketch\",ops:this.renderLines(r,e)}}}class r extends o{fillPolygons(t,e){const s=this._fillPolygons(t,e),n=Object.assign({},e,{hachureAngle:e.hachureAngle+90}),o=this._fillPolygons(t,n);return s.ops=s.ops.concat(o.ops),s}}class i{constructor(t){this.helper=t}fillPolygons(t,e){const s=n(t,e=Object.assign({},e,{hachureAngle:0}));return this.dotsOnLines(s,e)}dotsOnLines(t,e){const s=[];let n=e.hachureGap;n<0&&(n=4*e.strokeWidth),n=Math.max(n,.1);let o=e.fillWeight;o<0&&(o=e.strokeWidth/2);const h=n/4;for(const r of t){const t=a(r),i=t/n,c=Math.ceil(i)-1,l=t-c*n,u=(r[0][0]+r[1][0])/2-n/4,p=Math.min(r[0][1],r[1][1]);for(let t=0;t{const h=a(t),r=Math.floor(h/(s+n)),i=(h+n-r*(s+n))/2;let c=t[0],l=t[1];c[0]>l[0]&&(c=t[1],l=t[0]);const u=Math.atan((l[1]-c[1])/(l[0]-c[0]));for(let t=0;t{const o=a(t),h=Math.round(o/(2*e));let r=t[0],i=t[1];r[0]>i[0]&&(r=t[1],i=t[0]);const c=Math.atan((i[1]-r[1])/(i[0]-r[0]));for(let t=0;tn%2?t+s:t+e));a.push({key:\"C\",data:t}),e=t[4],s=t[5];break}case\"Q\":a.push({key:\"Q\",data:[...r]}),e=r[2],s=r[3];break;case\"q\":{const t=r.map(((t,n)=>n%2?t+s:t+e));a.push({key:\"Q\",data:t}),e=t[2],s=t[3];break}case\"A\":a.push({key:\"A\",data:[...r]}),e=r[5],s=r[6];break;case\"a\":e+=r[5],s+=r[6],a.push({key:\"A\",data:[r[0],r[1],r[2],r[3],r[4],e,s]});break;case\"H\":a.push({key:\"H\",data:[...r]}),e=r[0];break;case\"h\":e+=r[0],a.push({key:\"H\",data:[e]});break;case\"V\":a.push({key:\"V\",data:[...r]}),s=r[0];break;case\"v\":s+=r[0],a.push({key:\"V\",data:[s]});break;case\"S\":a.push({key:\"S\",data:[...r]}),e=r[2],s=r[3];break;case\"s\":{const t=r.map(((t,n)=>n%2?t+s:t+e));a.push({key:\"S\",data:t}),e=t[2],s=t[3];break}case\"T\":a.push({key:\"T\",data:[...r]}),e=r[0],s=r[1];break;case\"t\":e+=r[0],s+=r[1],a.push({key:\"T\",data:[e,s]});break;case\"Z\":case\"z\":a.push({key:\"Z\",data:[]}),e=n,s=o}return a}function m(t){const e=[];let s=\"\",n=0,o=0,a=0,h=0,r=0,i=0;for(const{key:c,data:l}of t){switch(c){case\"M\":e.push({key:\"M\",data:[...l]}),[n,o]=l,[a,h]=l;break;case\"C\":e.push({key:\"C\",data:[...l]}),n=l[4],o=l[5],r=l[2],i=l[3];break;case\"L\":e.push({key:\"L\",data:[...l]}),[n,o]=l;break;case\"H\":n=l[0],e.push({key:\"L\",data:[n,o]});break;case\"V\":o=l[0],e.push({key:\"L\",data:[n,o]});break;case\"S\":{let t=0,a=0;\"C\"===s||\"S\"===s?(t=n+(n-r),a=o+(o-i)):(t=n,a=o),e.push({key:\"C\",data:[t,a,...l]}),r=l[0],i=l[1],n=l[2],o=l[3];break}case\"T\":{const[t,a]=l;let h=0,c=0;\"Q\"===s||\"T\"===s?(h=n+(n-r),c=o+(o-i)):(h=n,c=o);const u=n+2*(h-n)/3,p=o+2*(c-o)/3,f=t+2*(h-t)/3,d=a+2*(c-a)/3;e.push({key:\"C\",data:[u,p,f,d,t,a]}),r=h,i=c,n=t,o=a;break}case\"Q\":{const[t,s,a,h]=l,c=n+2*(t-n)/3,u=o+2*(s-o)/3,p=a+2*(t-a)/3,f=h+2*(s-h)/3;e.push({key:\"C\",data:[c,u,p,f,a,h]}),r=t,i=s,n=a,o=h;break}case\"A\":{const t=Math.abs(l[0]),s=Math.abs(l[1]),a=l[2],h=l[3],r=l[4],i=l[5],c=l[6];if(0===t||0===s)e.push({key:\"C\",data:[n,o,i,c,i,c]}),n=i,o=c;else if(n!==i||o!==c){x(n,o,i,c,t,s,a,h,r).forEach((function(t){e.push({key:\"C\",data:t})})),n=i,o=c}break}case\"Z\":e.push({key:\"Z\",data:[]}),n=a,o=h}s=c}return e}function w(t,e,s){return[t*Math.cos(s)-e*Math.sin(s),t*Math.sin(s)+e*Math.cos(s)]}function x(t,e,s,n,o,a,h,r,i,c){const l=(u=h,Math.PI*u/180);var u;let p=[],f=0,d=0,g=0,M=0;if(c)[f,d,g,M]=c;else{[t,e]=w(t,e,-l),[s,n]=w(s,n,-l);const h=(t-s)/2,c=(e-n)/2;let u=h*h/(o*o)+c*c/(a*a);u>1&&(u=Math.sqrt(u),o*=u,a*=u);const p=o*o,k=a*a,b=p*k-p*c*c-k*h*h,y=p*c*c+k*h*h,m=(r===i?-1:1)*Math.sqrt(Math.abs(b/y));g=m*o*c/a+(t+s)/2,M=m*-a*h/o+(e+n)/2,f=Math.asin(parseFloat(((e-M)/a).toFixed(9))),d=Math.asin(parseFloat(((n-M)/a).toFixed(9))),td&&(f-=2*Math.PI),!i&&d>f&&(d-=2*Math.PI)}let k=d-f;if(Math.abs(k)>120*Math.PI/180){const t=d,e=s,r=n;d=i&&d>f?f+120*Math.PI/180*1:f+120*Math.PI/180*-1,p=x(s=g+o*Math.cos(d),n=M+a*Math.sin(d),e,r,o,a,h,0,i,[d,t,g,M])}k=d-f;const b=Math.cos(f),y=Math.sin(f),m=Math.cos(d),P=Math.sin(d),v=Math.tan(k/4),S=4/3*o*v,O=4/3*a*v,L=[t,e],T=[t+S*y,e-O*b],D=[s+S*P,n-O*m],A=[s,n];if(T[0]=2*L[0]-T[0],T[1]=2*L[1]-T[1],c)return[T,D,A].concat(p);{p=[T,D,A].concat(p);const t=[];for(let e=0;e2){const o=[];for(let e=0;e2*Math.PI&&(f=0,d=2*Math.PI);const g=2*Math.PI/i.curveStepCount,M=Math.min(g/2,(d-f)/2),k=V(M,c,l,u,p,f,d,1,i);if(!i.disableMultiStroke){const t=V(M,c,l,u,p,f,d,1.5,i);k.push(...t)}return h&&(r?k.push(...$(c,l,c+u*Math.cos(f),l+p*Math.sin(f),i),...$(c,l,c+u*Math.cos(d),l+p*Math.sin(d),i)):k.push({op:\"lineTo\",data:[c,l]},{op:\"lineTo\",data:[c+u*Math.cos(f),l+p*Math.sin(f)]})),{type:\"path\",ops:k}}function _(t,e){const s=m(y(b(t))),n=[];let o=[0,0],a=[0,0];for(const{key:t,data:h}of s)switch(t){case\"M\":a=[h[0],h[1]],o=[h[0],h[1]];break;case\"L\":n.push(...$(a[0],a[1],h[0],h[1],e)),a=[h[0],h[1]];break;case\"C\":{const[t,s,o,r,i,c]=h;n.push(...Z(t,s,o,r,i,c,a,e)),a=[i,c];break}case\"Z\":n.push(...$(a[0],a[1],o[0],o[1],e)),a=[o[0],o[1]]}return{type:\"path\",ops:n}}function I(t,e){const s=[];for(const n of t)if(n.length){const t=e.maxRandomnessOffset||0,o=n.length;if(o>2){s.push({op:\"move\",data:[n[0][0]+G(t,e),n[0][1]+G(t,e)]});for(let a=1;a500?.4:-.0016668*i+1.233334;let l=o.maxRandomnessOffset||0;l*l*100>r&&(l=i/10);const u=l/2,p=.2+.2*W(o);let f=o.bowing*o.maxRandomnessOffset*(n-e)/200,d=o.bowing*o.maxRandomnessOffset*(t-s)/200;f=G(f,o,c),d=G(d,o,c);const g=[],M=()=>G(u,o,c),k=()=>G(l,o,c),b=o.preserveVertices;return a&&(h?g.push({op:\"move\",data:[t+(b?0:M()),e+(b?0:M())]}):g.push({op:\"move\",data:[t+(b?0:G(l,o,c)),e+(b?0:G(l,o,c))]})),h?g.push({op:\"bcurveTo\",data:[f+t+(s-t)*p+M(),d+e+(n-e)*p+M(),f+t+2*(s-t)*p+M(),d+e+2*(n-e)*p+M(),s+(b?0:M()),n+(b?0:M())]}):g.push({op:\"bcurveTo\",data:[f+t+(s-t)*p+k(),d+e+(n-e)*p+k(),f+t+2*(s-t)*p+k(),d+e+2*(n-e)*p+k(),s+(b?0:k()),n+(b?0:k())]}),g}function j(t,e,s){if(!t.length)return[];const n=[];n.push([t[0][0]+G(e,s),t[0][1]+G(e,s)]),n.push([t[0][0]+G(e,s),t[0][1]+G(e,s)]);for(let o=1;o3){const a=[],h=1-s.curveTightness;o.push({op:\"move\",data:[t[1][0],t[1][1]]});for(let e=1;e+21&&o.push(s)}else o.push(s);o.push(t[e+3])}else{const n=.5,a=t[e+0],h=t[e+1],r=t[e+2],i=t[e+3],c=J(a,h,n),l=J(h,r,n),u=J(r,i,n),p=J(c,l,n),f=J(l,u,n),d=J(p,f,n);K([a,c,p,d],0,s,o),K([d,f,u,i],0,s,o)}var a,h;return o}function U(t,e){return X(t,0,t.length,e)}function X(t,e,s,n,o){const a=o||[],h=t[e],r=t[s-1];let i=0,c=1;for(let n=e+1;ni&&(i=e,c=n)}return Math.sqrt(i)>n?(X(t,e,c+1,n,a),X(t,c,s,n,a)):(a.length||a.push(h),a.push(r)),a}function Y(t,e=.15,s){const n=[],o=(t.length-1)/3;for(let s=0;s0?X(n,0,n.length,s):n}const tt=\"none\";class et{constructor(t){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:\"#000\",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:\"hachure\",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=t||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(Math.random()*2**31)}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,e,s){return{shape:t,sets:e||[],options:s||this.defaultOptions}}line(t,e,s,n,o){const a=this._o(o);return this._d(\"line\",[v(t,e,s,n,a)],a)}rectangle(t,e,s,n,o){const a=this._o(o),h=[],r=O(t,e,s,n,a);if(a.fill){const o=[[t,e],[t+s,e],[t+s,e+n],[t,e+n]];\"solid\"===a.fillStyle?h.push(I([o],a)):h.push(C([o],a))}return a.stroke!==tt&&h.push(r),this._d(\"rectangle\",h,a)}ellipse(t,e,s,n,o){const a=this._o(o),h=[],r=T(s,n,a),i=D(t,e,a,r);if(a.fill)if(\"solid\"===a.fillStyle){const s=D(t,e,a,r).opset;s.type=\"fillPath\",h.push(s)}else h.push(C([i.estimatedPoints],a));return a.stroke!==tt&&h.push(i.opset),this._d(\"ellipse\",h,a)}circle(t,e,s,n){const o=this.ellipse(t,e,s,s,n);return o.shape=\"circle\",o}linearPath(t,e){const s=this._o(e);return this._d(\"linearPath\",[S(t,!1,s)],s)}arc(t,e,s,n,o,a,h=!1,r){const i=this._o(r),c=[],l=A(t,e,s,n,o,a,h,!0,i);if(h&&i.fill)if(\"solid\"===i.fillStyle){const h=Object.assign({},i);h.disableMultiStroke=!0;const r=A(t,e,s,n,o,a,!0,!1,h);r.type=\"fillPath\",c.push(r)}else c.push(function(t,e,s,n,o,a,h){const r=t,i=e;let c=Math.abs(s/2),l=Math.abs(n/2);c+=G(.01*c,h),l+=G(.01*l,h);let u=o,p=a;for(;u<0;)u+=2*Math.PI,p+=2*Math.PI;p-u>2*Math.PI&&(u=0,p=2*Math.PI);const f=(p-u)/h.curveStepCount,d=[];for(let t=u;t<=p;t+=f)d.push([r+c*Math.cos(t),i+l*Math.sin(t)]);return d.push([r+c*Math.cos(p),i+l*Math.sin(p)]),d.push([r,i]),C([d],h)}(t,e,s,n,o,a,i));return i.stroke!==tt&&c.push(l),this._d(\"arc\",c,i)}curve(t,e){const s=this._o(e),n=[],o=L(t,s);if(s.fill&&s.fill!==tt)if(\"solid\"===s.fillStyle){const e=L(t,Object.assign(Object.assign({},s),{disableMultiStroke:!0,roughness:s.roughness?s.roughness+s.fillShapeRoughnessGain:0}));n.push({type:\"fillPath\",ops:this._mergedShape(e.ops)})}else{const e=[],o=t;if(o.length){const t=\"number\"==typeof o[0][0]?[o]:o;for(const n of t)n.length<3?e.push(...n):3===n.length?e.push(...Y(H([n[0],n[0],n[1],n[2]]),10,(1+s.roughness)/2)):e.push(...Y(H(n),10,(1+s.roughness)/2))}e.length&&n.push(C([e],s))}return s.stroke!==tt&&n.push(o),this._d(\"curve\",n,s)}polygon(t,e){const s=this._o(e),n=[],o=S(t,!0,s);return s.fill&&(\"solid\"===s.fillStyle?n.push(I([t],s)):n.push(C([t],s))),s.stroke!==tt&&n.push(o),this._d(\"polygon\",n,s)}path(t,e){const s=this._o(e),n=[];if(!t)return this._d(\"path\",n,s);t=(t||\"\").replace(/\\n/g,\" \").replace(/(-\\s)/g,\"-\").replace(\"/(ss)/g\",\" \");const o=s.fill&&\"transparent\"!==s.fill&&s.fill!==tt,a=s.stroke!==tt,h=!!(s.simplification&&s.simplification<1),r=function(t,e,s){const n=m(y(b(t))),o=[];let a=[],h=[0,0],r=[];const i=()=>{r.length>=4&&a.push(...Y(r,e)),r=[]},c=()=>{i(),a.length&&(o.push(a),a=[])};for(const{key:t,data:e}of n)switch(t){case\"M\":c(),h=[e[0],e[1]],a.push(h);break;case\"L\":i(),a.push([e[0],e[1]]);break;case\"C\":if(!r.length){const t=a.length?a[a.length-1]:h;r.push([t[0],t[1]])}r.push([e[0],e[1]]),r.push([e[2],e[3]]),r.push([e[4],e[5]]);break;case\"Z\":i(),a.push([h[0],h[1]])}if(c(),!s)return o;const l=[];for(const t of o){const e=U(t,s);e.length&&l.push(e)}return l}(t,1,h?4-4*(s.simplification||1):(1+s.roughness)/2),i=_(t,s);if(o)if(\"solid\"===s.fillStyle)if(1===r.length){const e=_(t,Object.assign(Object.assign({},s),{disableMultiStroke:!0,roughness:s.roughness?s.roughness+s.fillShapeRoughnessGain:0}));n.push({type:\"fillPath\",ops:this._mergedShape(e.ops)})}else n.push(I(r,s));else n.push(C(r,s));return a&&(h?r.forEach((t=>{n.push(S(t,!1,s))})):n.push(i)),this._d(\"path\",n,s)}opsToPath(t,e){let s=\"\";for(const n of t.ops){const t=\"number\"==typeof e&&e>=0?n.data.map((t=>+t.toFixed(e))):n.data;switch(n.op){case\"move\":s+=`M${t[0]} ${t[1]} `;break;case\"bcurveTo\":s+=`C${t[0]} ${t[1]}, ${t[2]} ${t[3]}, ${t[4]} ${t[5]} `;break;case\"lineTo\":s+=`L${t[0]} ${t[1]} `}}return s.trim()}toPaths(t){const e=t.sets||[],s=t.options||this.defaultOptions,n=[];for(const t of e){let e=null;switch(t.type){case\"path\":e={d:this.opsToPath(t),stroke:s.stroke,strokeWidth:s.strokeWidth,fill:tt};break;case\"fillPath\":e={d:this.opsToPath(t),stroke:tt,strokeWidth:0,fill:s.fill||tt};break;case\"fillSketch\":e=this.fillSketch(t,s)}e&&n.push(e)}return n}fillSketch(t,e){let s=e.fillWeight;return s<0&&(s=e.strokeWidth/2),{d:this.opsToPath(t),stroke:e.fill||tt,strokeWidth:s,fill:tt}}_mergedShape(t){return t.filter(((t,e)=>0===e||\"move\"!==t.op))}}class st{constructor(t,e){this.canvas=t,this.ctx=this.canvas.getContext(\"2d\"),this.gen=new et(e)}draw(t){const e=t.sets||[],s=t.options||this.getDefaultOptions(),n=this.ctx,o=t.options.fixedDecimalPlaceDigits;for(const a of e)switch(a.type){case\"path\":n.save(),n.strokeStyle=\"none\"===s.stroke?\"transparent\":s.stroke,n.lineWidth=s.strokeWidth,s.strokeLineDash&&n.setLineDash(s.strokeLineDash),s.strokeLineDashOffset&&(n.lineDashOffset=s.strokeLineDashOffset),this._drawToContext(n,a,o),n.restore();break;case\"fillPath\":{n.save(),n.fillStyle=s.fill||\"\";const e=\"curve\"===t.shape||\"polygon\"===t.shape||\"path\"===t.shape?\"evenodd\":\"nonzero\";this._drawToContext(n,a,o,e),n.restore();break}case\"fillSketch\":this.fillSketch(n,a,s)}}fillSketch(t,e,s){let n=s.fillWeight;n<0&&(n=s.strokeWidth/2),t.save(),s.fillLineDash&&t.setLineDash(s.fillLineDash),s.fillLineDashOffset&&(t.lineDashOffset=s.fillLineDashOffset),t.strokeStyle=s.fill||\"\",t.lineWidth=n,this._drawToContext(t,e,s.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,e,s,n=\"nonzero\"){t.beginPath();for(const n of e.ops){const e=\"number\"==typeof s&&s>=0?n.data.map((t=>+t.toFixed(s))):n.data;switch(n.op){case\"move\":t.moveTo(e[0],e[1]);break;case\"bcurveTo\":t.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]);break;case\"lineTo\":t.lineTo(e[0],e[1])}}\"fillPath\"===e.type?t.fill(n):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,e,s,n,o){const a=this.gen.line(t,e,s,n,o);return this.draw(a),a}rectangle(t,e,s,n,o){const a=this.gen.rectangle(t,e,s,n,o);return this.draw(a),a}ellipse(t,e,s,n,o){const a=this.gen.ellipse(t,e,s,n,o);return this.draw(a),a}circle(t,e,s,n){const o=this.gen.circle(t,e,s,n);return this.draw(o),o}linearPath(t,e){const s=this.gen.linearPath(t,e);return this.draw(s),s}polygon(t,e){const s=this.gen.polygon(t,e);return this.draw(s),s}arc(t,e,s,n,o,a,h=!1,r){const i=this.gen.arc(t,e,s,n,o,a,h,r);return this.draw(i),i}curve(t,e){const s=this.gen.curve(t,e);return this.draw(s),s}path(t,e){const s=this.gen.path(t,e);return this.draw(s),s}}const nt=\"http://www.w3.org/2000/svg\";class ot{constructor(t,e){this.svg=t,this.gen=new et(e)}draw(t){const e=t.sets||[],s=t.options||this.getDefaultOptions(),n=this.svg.ownerDocument||window.document,o=n.createElementNS(nt,\"g\"),a=t.options.fixedDecimalPlaceDigits;for(const h of e){let e=null;switch(h.type){case\"path\":e=n.createElementNS(nt,\"path\"),e.setAttribute(\"d\",this.opsToPath(h,a)),e.setAttribute(\"stroke\",s.stroke),e.setAttribute(\"stroke-width\",s.strokeWidth+\"\"),e.setAttribute(\"fill\",\"none\"),s.strokeLineDash&&e.setAttribute(\"stroke-dasharray\",s.strokeLineDash.join(\" \").trim()),s.strokeLineDashOffset&&e.setAttribute(\"stroke-dashoffset\",`${s.strokeLineDashOffset}`);break;case\"fillPath\":e=n.createElementNS(nt,\"path\"),e.setAttribute(\"d\",this.opsToPath(h,a)),e.setAttribute(\"stroke\",\"none\"),e.setAttribute(\"stroke-width\",\"0\"),e.setAttribute(\"fill\",s.fill||\"\"),\"curve\"!==t.shape&&\"polygon\"!==t.shape||e.setAttribute(\"fill-rule\",\"evenodd\");break;case\"fillSketch\":e=this.fillSketch(n,h,s)}e&&o.appendChild(e)}return o}fillSketch(t,e,s){let n=s.fillWeight;n<0&&(n=s.strokeWidth/2);const o=t.createElementNS(nt,\"path\");return o.setAttribute(\"d\",this.opsToPath(e,s.fixedDecimalPlaceDigits)),o.setAttribute(\"stroke\",s.fill||\"\"),o.setAttribute(\"stroke-width\",n+\"\"),o.setAttribute(\"fill\",\"none\"),s.fillLineDash&&o.setAttribute(\"stroke-dasharray\",s.fillLineDash.join(\" \").trim()),s.fillLineDashOffset&&o.setAttribute(\"stroke-dashoffset\",`${s.fillLineDashOffset}`),o}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,e){return this.gen.opsToPath(t,e)}line(t,e,s,n,o){const a=this.gen.line(t,e,s,n,o);return this.draw(a)}rectangle(t,e,s,n,o){const a=this.gen.rectangle(t,e,s,n,o);return this.draw(a)}ellipse(t,e,s,n,o){const a=this.gen.ellipse(t,e,s,n,o);return this.draw(a)}circle(t,e,s,n){const o=this.gen.circle(t,e,s,n);return this.draw(o)}linearPath(t,e){const s=this.gen.linearPath(t,e);return this.draw(s)}polygon(t,e){const s=this.gen.polygon(t,e);return this.draw(s)}arc(t,e,s,n,o,a,h=!1,r){const i=this.gen.arc(t,e,s,n,o,a,h,r);return this.draw(i)}curve(t,e){const s=this.gen.curve(t,e);return this.draw(s)}path(t,e){const s=this.gen.path(t,e);return this.draw(s)}}var at={canvas:(t,e)=>new st(t,e),svg:(t,e)=>new ot(t,e),generator:t=>new et(t),newSeed:()=>et.newSeed()};export{at as default};\n", "const intersectRect = (node, point) => {\n var x = node.x;\n var y = node.y;\n\n // Rectangle intersection algorithm from:\n // https://math.stackexchange.com/questions/108113/find-edge-between-two-boxes\n var dx = point.x - x;\n var dy = point.y - y;\n var w = node.width / 2;\n var h = node.height / 2;\n\n var sx, sy;\n if (Math.abs(dy) * w > Math.abs(dx) * h) {\n // Intersection is top or bottom of rect.\n if (dy < 0) {\n h = -h;\n }\n sx = dy === 0 ? 0 : (h * dx) / dy;\n sy = h;\n } else {\n // Intersection is left or right of rect.\n if (dx < 0) {\n w = -w;\n }\n sx = w;\n sy = dx === 0 ? 0 : (w * dy) / dx;\n }\n\n return { x: x + sx, y: y + sy };\n};\n\nexport default intersectRect;\n", "import { select } from 'd3';\nimport { log } from '$root/logger.js';\nimport { getConfig } from '$root/diagram-api/diagramAPI.js';\nimport common, { evaluate, renderKatex, hasKatex } from '$root/diagrams/common/common.js';\nimport { decodeEntities } from '$root/utils.js';\n\n/**\n * @param dom\n * @param styleFn\n */\nfunction applyStyle(dom, styleFn) {\n if (styleFn) {\n dom.attr('style', styleFn);\n }\n}\n\n/**\n * @param {any} node\n * @returns {Promise} Node\n */\nasync function addHtmlLabel(node) {\n const fo = select(document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject'));\n const div = fo.append('xhtml:div');\n\n let label = node.label;\n if (node.label && hasKatex(node.label)) {\n label = await renderKatex(node.label.replace(common.lineBreakRegex, '\\n'), getConfig());\n }\n const labelClass = node.isNode ? 'nodeLabel' : 'edgeLabel';\n div.html(\n '' +\n label +\n ' '\n );\n\n applyStyle(div, node.labelStyle);\n div.style('display', 'inline-block');\n div.style('padding-right', '1px');\n // Fix for firefox\n div.style('white-space', 'nowrap');\n div.attr('xmlns', 'http://www.w3.org/1999/xhtml');\n return fo.node();\n}\n/**\n * @param _vertexText\n * @param style\n * @param isTitle\n * @param isNode\n * @deprecated svg-util/createText instead\n */\nconst createLabel = async (_vertexText, style, isTitle, isNode) => {\n let vertexText = _vertexText || '';\n if (typeof vertexText === 'object') {\n vertexText = vertexText[0];\n }\n\n if (evaluate(getConfig().flowchart.htmlLabels)) {\n // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?\n vertexText = vertexText.replace(/\\\\n|\\n/g, ' ');\n log.info('vertexText' + vertexText);\n const node = {\n isNode,\n label: decodeEntities(vertexText).replace(\n /fa[blrs]?:fa-[\\w-]+/g,\n (s) => ` `\n ),\n labelStyle: style ? style.replace('fill:', 'color:') : style,\n };\n let vertexNode = await addHtmlLabel(node);\n // vertexNode.parentNode.removeChild(vertexNode);\n return vertexNode;\n } else {\n const svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');\n svgLabel.setAttribute('style', style.replace('color:', 'fill:'));\n let rows = [];\n if (typeof vertexText === 'string') {\n rows = vertexText.split(/\\\\n|\\n| /gi);\n } else if (Array.isArray(vertexText)) {\n rows = vertexText;\n } else {\n rows = [];\n }\n\n for (const row of rows) {\n const tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');\n tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');\n tspan.setAttribute('dy', '1em');\n tspan.setAttribute('x', '0');\n if (isTitle) {\n tspan.setAttribute('class', 'title-row');\n } else {\n tspan.setAttribute('class', 'row');\n }\n tspan.textContent = row.trim();\n svgLabel.appendChild(tspan);\n }\n return svgLabel;\n }\n};\n\nexport default createLabel;\n", "export const createRoundedRectPathD = (\n x: number,\n y: number,\n totalWidth: number,\n totalHeight: number,\n radius: number\n) =>\n [\n 'M',\n x + radius,\n y, // Move to the first point\n 'H',\n x + totalWidth - radius, // Draw horizontal line to the beginning of the right corner\n 'A',\n radius,\n radius,\n 0,\n 0,\n 1,\n x + totalWidth,\n y + radius, // Draw arc to the right top corner\n 'V',\n y + totalHeight - radius, // Draw vertical line down to the beginning of the right bottom corner\n 'A',\n radius,\n radius,\n 0,\n 0,\n 1,\n x + totalWidth - radius,\n y + totalHeight, // Draw arc to the right bottom corner\n 'H',\n x + radius, // Draw horizontal line to the beginning of the left bottom corner\n 'A',\n radius,\n radius,\n 0,\n 0,\n 1,\n x,\n y + totalHeight - radius, // Draw arc to the left bottom corner\n 'V',\n y + radius, // Draw vertical line up to the beginning of the left top corner\n 'A',\n radius,\n radius,\n 0,\n 0,\n 1,\n x + radius,\n y, // Draw arc to the left top corner\n 'Z', // Close the path\n ].join(' ');\n", "import { getConfig } from '$root/diagram-api/diagramAPI.js';\nimport type { Node } from '$root/rendering-util/types.d.ts';\n\n// Striped fill like start or fork nodes in state diagrams\nexport const solidStateFill = (color: string) => {\n const { handDrawnSeed } = getConfig();\n return {\n fill: color,\n hachureAngle: 120, // angle of hachure,\n hachureGap: 4,\n fillWeight: 2,\n roughness: 0.7,\n stroke: color,\n seed: handDrawnSeed,\n };\n};\n\nexport const compileStyles = (node: Node) => {\n // node.cssCompiledStyles is an array of strings in the form of 'key: value' where jey is the css property and value is the value\n // the array is the styles of node node from the classes it is using\n // node.cssStyles is an array of styles directly set on the node\n // concat the arrays and remove duplicates such that the values from node.cssStyles are used if there are duplicates\n const stylesMap = styles2Map([...(node.cssCompiledStyles || []), ...(node.cssStyles || [])]);\n return { stylesMap, stylesArray: [...stylesMap] };\n};\n\nexport const styles2Map = (styles: string[]) => {\n const styleMap = new Map();\n styles.forEach((style) => {\n const [key, value] = style.split(':');\n styleMap.set(key.trim(), value?.trim());\n });\n return styleMap;\n};\n\nexport const styles2String = (node: Node) => {\n const { stylesArray } = compileStyles(node);\n const labelStyles: string[] = [];\n const nodeStyles: string[] = [];\n const borderStyles: string[] = [];\n const backgroundStyles: string[] = [];\n\n stylesArray.forEach((style) => {\n const key = style[0];\n if (\n key === 'color' ||\n key === 'font-size' ||\n key === 'font-family' ||\n key === 'font-weight' ||\n key === 'font-style' ||\n key === 'text-decoration' ||\n key === 'text-align' ||\n key === 'text-transform' ||\n key === 'line-height' ||\n key === 'letter-spacing' ||\n key === 'word-spacing' ||\n key === 'text-shadow' ||\n key === 'text-overflow' ||\n key === 'white-space' ||\n key === 'word-wrap' ||\n key === 'word-break' ||\n key === 'overflow-wrap' ||\n key === 'hyphens'\n ) {\n labelStyles.push(style.join(':') + ' !important');\n } else {\n nodeStyles.push(style.join(':') + ' !important');\n if (key.includes('stroke')) {\n borderStyles.push(style.join(':') + ' !important');\n }\n if (key === 'fill') {\n backgroundStyles.push(style.join(':') + ' !important');\n }\n }\n });\n\n return {\n labelStyles: labelStyles.join(';'),\n nodeStyles: nodeStyles.join(';'),\n stylesArray,\n borderStyles,\n backgroundStyles,\n };\n};\n\n// Striped fill like start or fork nodes in state diagrams\n// TODO remove any\nexport const userNodeOverrides = (node: Node, options: any) => {\n const { themeVariables, handDrawnSeed } = getConfig();\n const { nodeBorder, mainBkg } = themeVariables;\n const { stylesMap } = compileStyles(node);\n\n // index the style array to a map object\n const result = Object.assign(\n {\n roughness: 0.7,\n fill: stylesMap.get('fill') || mainBkg,\n fillStyle: 'hachure', // solid fill\n fillWeight: 4,\n stroke: stylesMap.get('stroke') || nodeBorder,\n seed: handDrawnSeed,\n strokeWidth: 1.3,\n },\n options\n );\n return result;\n};\n", "import { getConfig } from '$root/diagram-api/diagramAPI.js';\nimport { evaluate } from '$root/diagrams/common/common.js';\nimport { log } from '$root/logger.js';\nimport { getSubGraphTitleMargins } from '$root/utils/subGraphTitleMargins.js';\nimport { select } from 'd3';\nimport rough from 'roughjs';\nimport { createText } from '../createText.ts';\nimport intersectRect from '../rendering-elements/intersect/intersect-rect.js';\nimport createLabel from './createLabel.js';\nimport { createRoundedRectPathD } from './shapes/roundedRectPath.ts';\nimport {\n styles2String,\n userNodeOverrides,\n} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';\n\nconst rect = async (parent, node) => {\n log.info('Creating subgraph rect for ', node.id, node);\n const siteConfig = getConfig();\n const { themeVariables, handDrawnSeed } = siteConfig;\n const { clusterBkg, clusterBorder } = themeVariables;\n\n const { labelStyles, nodeStyles, borderStyles, backgroundStyles } = styles2String(node);\n\n // Add outer g element\n const shapeSvg = parent\n .insert('g')\n .attr('class', 'cluster ' + node.cssClasses)\n .attr('id', node.id)\n .attr('data-look', node.look);\n\n const useHtmlLabels = evaluate(siteConfig.flowchart.htmlLabels);\n\n // Create the label and insert it after the rect\n const labelEl = shapeSvg.insert('g').attr('class', 'cluster-label ');\n\n const text = await createText(labelEl, node.label, {\n style: node.labelStyle,\n useHtmlLabels,\n isNode: true,\n });\n\n // Get the size of the label\n let bbox = text.getBBox();\n\n if (evaluate(siteConfig.flowchart.htmlLabels)) {\n const div = text.children[0];\n const dv = select(text);\n bbox = div.getBoundingClientRect();\n dv.attr('width', bbox.width);\n dv.attr('height', bbox.height);\n }\n\n const width = node.width <= bbox.width + node.padding ? bbox.width + node.padding : node.width;\n if (node.width <= bbox.width + node.padding) {\n node.diff = (width - node.width) / 2 - node.padding;\n } else {\n node.diff = -node.padding;\n }\n\n const height = node.height;\n const x = node.x - width / 2;\n const y = node.y - height / 2;\n\n log.trace('Data ', node, JSON.stringify(node));\n let rect;\n if (node.look === 'handDrawn') {\n // @ts-ignore TODO: Fix rough typings\n const rc = rough.svg(shapeSvg);\n const options = userNodeOverrides(node, {\n roughness: 0.7,\n fill: clusterBkg,\n // fill: 'red',\n stroke: clusterBorder,\n fillWeight: 3,\n seed: handDrawnSeed,\n });\n const roughNode = rc.path(createRoundedRectPathD(x, y, width, height, 0), options);\n rect = shapeSvg.insert(() => {\n log.debug('Rough node insert CXC', roughNode);\n return roughNode;\n }, ':first-child');\n // Should we affect the options instead of doing this?\n rect.select('path:nth-child(2)').attr('style', borderStyles.join(';'));\n rect.select('path').attr('style', backgroundStyles.join(';').replace('fill', 'stroke'));\n } else {\n // add the rect\n rect = shapeSvg.insert('rect', ':first-child');\n // center the rect around its coordinate\n rect\n .attr('style', nodeStyles)\n .attr('rx', node.rx)\n .attr('ry', node.ry)\n .attr('x', x)\n .attr('y', y)\n .attr('width', width)\n .attr('height', height);\n }\n const { subGraphTitleTopMargin } = getSubGraphTitleMargins(siteConfig);\n labelEl.attr(\n 'transform',\n // This puts the label on top of the box instead of inside it\n `translate(${node.x - bbox.width / 2}, ${node.y - node.height / 2 + subGraphTitleTopMargin})`\n );\n\n if (labelStyles) {\n const span = labelEl.select('span');\n if (span) {\n span.attr('style', labelStyles);\n }\n }\n // Center the label\n\n const rectBox = rect.node().getBBox();\n node.offsetX = 0;\n node.width = rectBox.width;\n node.height = rectBox.height;\n // Used by layout engine to position subgraph in parent\n node.offsetY = bbox.height - node.padding / 2;\n\n node.intersect = function (point) {\n return intersectRect(node, point);\n };\n\n return { cluster: shapeSvg, labelBBox: bbox };\n};\n\n/**\n * Non visible cluster where the note is group with its\n *\n * @param {any} parent\n * @param {any} node\n * @returns {any} ShapeSvg\n */\nconst noteGroup = (parent, node) => {\n // Add outer g element\n const shapeSvg = parent.insert('g').attr('class', 'note-cluster').attr('id', node.id);\n\n // add the rect\n const rect = shapeSvg.insert('rect', ':first-child');\n\n const padding = 0 * node.padding;\n const halfPadding = padding / 2;\n\n // center the rect around its coordinate\n rect\n .attr('rx', node.rx)\n .attr('ry', node.ry)\n .attr('x', node.x - node.width / 2 - halfPadding)\n .attr('y', node.y - node.height / 2 - halfPadding)\n .attr('width', node.width + padding)\n .attr('height', node.height + padding)\n .attr('fill', 'none');\n\n const rectBox = rect.node().getBBox();\n node.width = rectBox.width;\n node.height = rectBox.height;\n\n node.intersect = function (point) {\n return intersectRect(node, point);\n };\n\n return { cluster: shapeSvg, labelBBox: { width: 0, height: 0 } };\n};\n\nconst roundedWithTitle = async (parent, node) => {\n const siteConfig = getConfig();\n\n const { themeVariables, handDrawnSeed } = siteConfig;\n const { altBackground, compositeBackground, compositeTitleBackground, nodeBorder } =\n themeVariables;\n\n // Add outer g element\n const shapeSvg = parent\n .insert('g')\n .attr('class', node.cssClasses)\n .attr('id', node.id)\n .attr('data-id', node.id)\n .attr('data-look', node.look);\n\n // add the rect\n const outerRectG = shapeSvg.insert('g', ':first-child');\n\n // Create the label and insert it after the rect\n const label = shapeSvg.insert('g').attr('class', 'cluster-label');\n let innerRect = shapeSvg.append('rect');\n\n const text = label\n .node()\n .appendChild(await createLabel(node.label, node.labelStyle, undefined, true));\n\n // Get the size of the label\n let bbox = text.getBBox();\n\n if (evaluate(siteConfig.flowchart.htmlLabels)) {\n const div = text.children[0];\n const dv = select(text);\n bbox = div.getBoundingClientRect();\n dv.attr('width', bbox.width);\n dv.attr('height', bbox.height);\n }\n\n // Rounded With Title\n const padding = 0 * node.padding;\n const halfPadding = padding / 2;\n\n const width =\n (node.width <= bbox.width + node.padding ? bbox.width + node.padding : node.width) + padding;\n if (node.width <= bbox.width + node.padding) {\n node.diff = (width - node.width) / 2 - node.padding;\n } else {\n node.diff = -node.padding;\n }\n\n const height = node.height + padding;\n // const height = node.height + padding;\n const innerHeight = node.height + padding - bbox.height - 6;\n const x = node.x - width / 2;\n const y = node.y - height / 2;\n node.width = width;\n const innerY = node.y - node.height / 2 - halfPadding + bbox.height + 2;\n\n // add the rect\n let rect;\n if (node.look === 'handDrawn') {\n const isAlt = node.cssClasses.includes('statediagram-cluster-alt');\n const rc = rough.svg(shapeSvg);\n const roughOuterNode =\n node.rx || node.ry\n ? rc.path(createRoundedRectPathD(x, y, width, height, 10), {\n roughness: 0.7,\n fill: compositeTitleBackground,\n fillStyle: 'solid',\n stroke: nodeBorder,\n seed: handDrawnSeed,\n })\n : rc.rectangle(x, y, width, height, { seed: handDrawnSeed });\n\n rect = shapeSvg.insert(() => roughOuterNode, ':first-child');\n const roughInnerNode = rc.rectangle(x, innerY, width, innerHeight, {\n fill: isAlt ? altBackground : compositeBackground,\n fillStyle: isAlt ? 'hachure' : 'solid',\n stroke: nodeBorder,\n seed: handDrawnSeed,\n });\n\n rect = shapeSvg.insert(() => roughOuterNode, ':first-child');\n innerRect = shapeSvg.insert(() => roughInnerNode);\n } else {\n rect = outerRectG.insert('rect', ':first-child');\n const outerRectClass = 'outer';\n\n // center the rect around its coordinate\n rect\n .attr('class', outerRectClass)\n .attr('x', x)\n .attr('y', y)\n .attr('width', width)\n .attr('height', height)\n .attr('data-look', node.look);\n innerRect\n .attr('class', 'inner')\n .attr('x', x)\n .attr('y', innerY)\n .attr('width', width)\n .attr('height', innerHeight);\n }\n\n label.attr(\n 'transform',\n `translate(${node.x - bbox.width / 2}, ${y + 1 - (evaluate(siteConfig.flowchart.htmlLabels) ? 0 : 3)})`\n );\n\n const rectBox = rect.node().getBBox();\n node.height = rectBox.height;\n node.offsetX = 0;\n // Used by layout engine to position subgraph in parent\n node.offsetY = bbox.height - node.padding / 2;\n node.labelBBox = bbox;\n\n node.intersect = function (point) {\n return intersectRect(node, point);\n };\n\n return { cluster: shapeSvg, labelBBox: bbox };\n};\nconst divider = (parent, node) => {\n const siteConfig = getConfig();\n\n const { themeVariables, handDrawnSeed } = siteConfig;\n const { nodeBorder } = themeVariables;\n\n // Add outer g element\n const shapeSvg = parent\n .insert('g')\n .attr('class', node.cssClasses)\n .attr('id', node.id)\n .attr('data-look', node.look);\n\n // add the rect\n const outerRectG = shapeSvg.insert('g', ':first-child');\n\n const padding = 0 * node.padding;\n\n const width = node.width + padding;\n\n node.diff = -node.padding;\n\n const height = node.height + padding;\n // const height = node.height + padding;\n const x = node.x - width / 2;\n const y = node.y - height / 2;\n node.width = width;\n\n // add the rect\n let rect;\n if (node.look === 'handDrawn') {\n const rc = rough.svg(shapeSvg);\n const roughOuterNode = rc.rectangle(x, y, width, height, {\n fill: 'lightgrey',\n roughness: 0.5,\n strokeLineDash: [5],\n stroke: nodeBorder,\n seed: handDrawnSeed,\n });\n\n rect = shapeSvg.insert(() => roughOuterNode, ':first-child');\n } else {\n rect = outerRectG.insert('rect', ':first-child');\n const outerRectClass = 'divider';\n\n // center the rect around its coordinate\n rect\n .attr('class', outerRectClass)\n .attr('x', x)\n .attr('y', y)\n .attr('width', width)\n .attr('height', height)\n .attr('data-look', node.look);\n }\n\n const rectBox = rect.node().getBBox();\n node.height = rectBox.height;\n node.offsetX = 0;\n // Used by layout engine to position subgraph in parent\n node.offsetY = 0;\n\n node.intersect = function (point) {\n return intersectRect(node, point);\n };\n\n return { cluster: shapeSvg, labelBBox: {} };\n};\n\nconst squareRect = rect;\nconst shapes = {\n rect,\n squareRect,\n roundedWithTitle,\n noteGroup,\n divider,\n};\n\nlet clusterElems = new Map();\n\nexport const insertCluster = async (elem, node) => {\n const shape = node.shape || 'rect';\n const cluster = await shapes[shape](elem, node);\n clusterElems.set(node.id, cluster);\n return cluster;\n};\n\nexport const getClusterTitleWidth = (elem, node) => {\n const label = createLabel(node.label, node.labelStyle, undefined, true);\n elem.node().appendChild(label);\n const width = label.getBBox().width;\n elem.node().removeChild(label);\n return width;\n};\n\nexport const clear = () => {\n clusterElems = new Map();\n};\n\nexport const positionCluster = (node) => {\n log.info(\n 'Position cluster (' +\n node.id +\n ', ' +\n node.x +\n ', ' +\n node.y +\n ') (' +\n node?.width +\n ', ' +\n node?.height +\n ')',\n clusterElems.get(node.id)\n );\n const el = clusterElems.get(node.id);\n el.cluster.attr('transform', 'translate(' + node.x + ', ' + node.y + ')');\n};\n", "import type { EdgeData, Point } from '../types.js';\n\n// We need to draw the lines a bit shorter to avoid drawing\n// under any transparent markers.\n// The offsets are calculated from the markers' dimensions.\nconst markerOffsets = {\n aggregation: 18,\n extension: 18,\n composition: 18,\n dependency: 6,\n lollipop: 13.5,\n arrow_point: 4,\n} as const;\n\n/**\n * Calculate the deltas and angle between two points\n * @param point1 - First point\n * @param point2 - Second point\n * @returns The angle, deltaX and deltaY\n */\nfunction calculateDeltaAndAngle(\n point1?: Point | [number, number],\n point2?: Point | [number, number]\n): { angle: number; deltaX: number; deltaY: number } {\n if (point1 === undefined || point2 === undefined) {\n return { angle: 0, deltaX: 0, deltaY: 0 };\n }\n point1 = pointTransformer(point1);\n point2 = pointTransformer(point2);\n const [x1, y1] = [point1.x, point1.y];\n const [x2, y2] = [point2.x, point2.y];\n const deltaX = x2 - x1;\n const deltaY = y2 - y1;\n return { angle: Math.atan(deltaY / deltaX), deltaX, deltaY };\n}\n\nconst pointTransformer = (data: Point | [number, number]) => {\n if (Array.isArray(data)) {\n return { x: data[0], y: data[1] };\n }\n return data;\n};\n\nexport const getLineFunctionsWithOffset = (\n edge: Pick\n) => {\n return {\n x: function (\n this: void,\n d: Point | [number, number],\n i: number,\n data: (Point | [number, number])[]\n ) {\n let offset = 0;\n if (i === 0 && Object.hasOwn(markerOffsets, edge.arrowTypeStart)) {\n // Handle first point\n // Calculate the angle and delta between the first two points\n const { angle, deltaX } = calculateDeltaAndAngle(data[0], data[1]);\n // Calculate the offset based on the angle and the marker's dimensions\n offset =\n markerOffsets[edge.arrowTypeStart as keyof typeof markerOffsets] *\n Math.cos(angle) *\n (deltaX >= 0 ? 1 : -1);\n } else if (i === data.length - 1 && Object.hasOwn(markerOffsets, edge.arrowTypeEnd)) {\n // Handle last point\n // Calculate the angle and delta between the last two points\n const { angle, deltaX } = calculateDeltaAndAngle(\n data[data.length - 1],\n data[data.length - 2]\n );\n offset =\n markerOffsets[edge.arrowTypeEnd as keyof typeof markerOffsets] *\n Math.cos(angle) *\n (deltaX >= 0 ? 1 : -1);\n }\n return pointTransformer(d).x + offset;\n },\n y: function (\n this: void,\n d: Point | [number, number],\n i: number,\n data: (Point | [number, number])[]\n ) {\n // Same handling as X above\n let offset = 0;\n if (i === 0 && Object.hasOwn(markerOffsets, edge.arrowTypeStart)) {\n const { angle, deltaY } = calculateDeltaAndAngle(data[0], data[1]);\n offset =\n markerOffsets[edge.arrowTypeStart as keyof typeof markerOffsets] *\n Math.abs(Math.sin(angle)) *\n (deltaY >= 0 ? 1 : -1);\n } else if (i === data.length - 1 && Object.hasOwn(markerOffsets, edge.arrowTypeEnd)) {\n const { angle, deltaY } = calculateDeltaAndAngle(\n data[data.length - 1],\n data[data.length - 2]\n );\n offset =\n markerOffsets[edge.arrowTypeEnd as keyof typeof markerOffsets] *\n Math.abs(Math.sin(angle)) *\n (deltaY >= 0 ? 1 : -1);\n }\n return pointTransformer(d).y + offset;\n },\n };\n};\n\nif (import.meta.vitest) {\n const { it, expect, describe } = import.meta.vitest;\n describe('calculateDeltaAndAngle', () => {\n it('should calculate the angle and deltas between two points', () => {\n expect(calculateDeltaAndAngle([0, 0], [0, 1])).toStrictEqual({\n angle: 1.5707963267948966,\n deltaX: 0,\n deltaY: 1,\n });\n expect(calculateDeltaAndAngle([1, 0], [0, -1])).toStrictEqual({\n angle: 0.7853981633974483,\n deltaX: -1,\n deltaY: -1,\n });\n expect(calculateDeltaAndAngle({ x: 1, y: 0 }, [0, -1])).toStrictEqual({\n angle: 0.7853981633974483,\n deltaX: -1,\n deltaY: -1,\n });\n expect(calculateDeltaAndAngle({ x: 1, y: 0 }, { x: 1, y: 0 })).toStrictEqual({\n angle: NaN,\n deltaX: 0,\n deltaY: 0,\n });\n });\n\n it('should calculate the angle and deltas if one point in undefined', () => {\n expect(calculateDeltaAndAngle(undefined, [0, 1])).toStrictEqual({\n angle: 0,\n deltaX: 0,\n deltaY: 0,\n });\n expect(calculateDeltaAndAngle([0, 1], undefined)).toStrictEqual({\n angle: 0,\n deltaX: 0,\n deltaY: 0,\n });\n });\n });\n}\n", "import type { SVG } from '$root/diagram-api/types.js';\nimport { log } from '$root/logger.js';\nimport type { EdgeData } from '$root/types.js';\n/**\n * Adds SVG markers to a path element based on the arrow types specified in the edge.\n *\n * @param svgPath - The SVG path element to add markers to.\n * @param edge - The edge data object containing the arrow types.\n * @param url - The URL of the SVG marker definitions.\n * @param id - The ID prefix for the SVG marker definitions.\n * @param diagramType - The type of diagram being rendered.\n */\nexport const addEdgeMarkers = (\n svgPath: SVG,\n edge: Pick,\n url: string,\n id: string,\n diagramType: string\n) => {\n if (edge.arrowTypeStart) {\n addEdgeMarker(svgPath, 'start', edge.arrowTypeStart, url, id, diagramType);\n }\n if (edge.arrowTypeEnd) {\n addEdgeMarker(svgPath, 'end', edge.arrowTypeEnd, url, id, diagramType);\n }\n};\n\nconst arrowTypesMap = {\n arrow_cross: 'cross',\n arrow_point: 'point',\n arrow_barb: 'barb',\n arrow_circle: 'circle',\n aggregation: 'aggregation',\n extension: 'extension',\n composition: 'composition',\n dependency: 'dependency',\n lollipop: 'lollipop',\n} as const;\n\nconst addEdgeMarker = (\n svgPath: SVG,\n position: 'start' | 'end',\n arrowType: string,\n url: string,\n id: string,\n diagramType: string\n) => {\n const endMarkerType = arrowTypesMap[arrowType as keyof typeof arrowTypesMap];\n\n if (!endMarkerType) {\n log.warn(`Unknown arrow type: ${arrowType}`);\n return; // unknown arrow type, ignore\n }\n\n const suffix = position === 'start' ? 'Start' : 'End';\n svgPath.attr(`marker-${position}`, `url(${url}#${id}_${diagramType}-${endMarkerType}${suffix})`);\n};\n", "import { getConfig } from '$root/diagram-api/diagramAPI.js';\nimport { evaluate } from '$root/diagrams/common/common.js';\nimport { log } from '$root/logger.js';\nimport { createText } from '$root/rendering-util/createText.ts';\nimport utils from '$root/utils.js';\nimport { getLineFunctionsWithOffset } from '$root/utils/lineWithOffset.js';\nimport { getSubGraphTitleMargins } from '$root/utils/subGraphTitleMargins.js';\nimport { curveBasis, line, select } from 'd3';\nimport rough from 'roughjs';\nimport createLabel from './createLabel.js';\nimport { addEdgeMarkers } from './edgeMarker.ts';\n\nconst edgeLabels = new Map();\nconst terminalLabels = new Map();\n\nexport const clear = () => {\n edgeLabels.clear();\n terminalLabels.clear();\n};\n\nexport const getLabelStyles = (styleArray) => {\n let styles = styleArray ? styleArray.reduce((acc, style) => acc + ';' + style, '') : '';\n return styles;\n};\n\nexport const insertEdgeLabel = async (elem, edge) => {\n let useHtmlLabels = evaluate(getConfig().flowchart.htmlLabels);\n\n const labelElement = await createText(elem, edge.label, {\n style: getLabelStyles(edge.labelStyle),\n useHtmlLabels,\n addSvgBackground: true,\n isNode: false,\n });\n log.info('abc82', edge, edge.labelType);\n\n // Create outer g, edgeLabel, this will be positioned after graph layout\n const edgeLabel = elem.insert('g').attr('class', 'edgeLabel');\n\n // Create inner g, label, this will be positioned now for centering the text\n const label = edgeLabel.insert('g').attr('class', 'label');\n label.node().appendChild(labelElement);\n\n // Center the label\n let bbox = labelElement.getBBox();\n if (useHtmlLabels) {\n const div = labelElement.children[0];\n const dv = select(labelElement);\n bbox = div.getBoundingClientRect();\n dv.attr('width', bbox.width);\n dv.attr('height', bbox.height);\n }\n label.attr('transform', 'translate(' + -bbox.width / 2 + ', ' + -bbox.height / 2 + ')');\n\n // Make element accessible by id for positioning\n edgeLabels.set(edge.id, edgeLabel);\n\n // Update the abstract data of the edge with the new information about its width and height\n edge.width = bbox.width;\n edge.height = bbox.height;\n\n let fo;\n if (edge.startLabelLeft) {\n // Create the actual text element\n const startLabelElement = await createLabel(\n edge.startLabelLeft,\n getLabelStyles(edge.labelStyle)\n );\n const startEdgeLabelLeft = elem.insert('g').attr('class', 'edgeTerminals');\n const inner = startEdgeLabelLeft.insert('g').attr('class', 'inner');\n fo = inner.node().appendChild(startLabelElement);\n const slBox = startLabelElement.getBBox();\n inner.attr('transform', 'translate(' + -slBox.width / 2 + ', ' + -slBox.height / 2 + ')');\n if (!terminalLabels.get(edge.id)) {\n terminalLabels.set(edge.id, {});\n }\n terminalLabels.get(edge.id).startLeft = startEdgeLabelLeft;\n setTerminalWidth(fo, edge.startLabelLeft);\n }\n if (edge.startLabelRight) {\n // Create the actual text element\n const startLabelElement = await createLabel(\n edge.startLabelRight,\n getLabelStyles(edge.labelStyle)\n );\n const startEdgeLabelRight = elem.insert('g').attr('class', 'edgeTerminals');\n const inner = startEdgeLabelRight.insert('g').attr('class', 'inner');\n fo = startEdgeLabelRight.node().appendChild(startLabelElement);\n inner.node().appendChild(startLabelElement);\n const slBox = startLabelElement.getBBox();\n inner.attr('transform', 'translate(' + -slBox.width / 2 + ', ' + -slBox.height / 2 + ')');\n\n if (!terminalLabels.get(edge.id)) {\n terminalLabels.set(edge.id, {});\n }\n terminalLabels.get(edge.id).startRight = startEdgeLabelRight;\n setTerminalWidth(fo, edge.startLabelRight);\n }\n if (edge.endLabelLeft) {\n // Create the actual text element\n const endLabelElement = await createLabel(edge.endLabelLeft, getLabelStyles(edge.labelStyle));\n const endEdgeLabelLeft = elem.insert('g').attr('class', 'edgeTerminals');\n const inner = endEdgeLabelLeft.insert('g').attr('class', 'inner');\n fo = inner.node().appendChild(endLabelElement);\n const slBox = endLabelElement.getBBox();\n inner.attr('transform', 'translate(' + -slBox.width / 2 + ', ' + -slBox.height / 2 + ')');\n\n endEdgeLabelLeft.node().appendChild(endLabelElement);\n\n if (!terminalLabels.get(edge.id)) {\n terminalLabels.set(edge.id, {});\n }\n terminalLabels.get(edge.id).endLeft = endEdgeLabelLeft;\n setTerminalWidth(fo, edge.endLabelLeft);\n }\n if (edge.endLabelRight) {\n // Create the actual text element\n const endLabelElement = await createLabel(edge.endLabelRight, getLabelStyles(edge.labelStyle));\n const endEdgeLabelRight = elem.insert('g').attr('class', 'edgeTerminals');\n const inner = endEdgeLabelRight.insert('g').attr('class', 'inner');\n\n fo = inner.node().appendChild(endLabelElement);\n const slBox = endLabelElement.getBBox();\n inner.attr('transform', 'translate(' + -slBox.width / 2 + ', ' + -slBox.height / 2 + ')');\n\n endEdgeLabelRight.node().appendChild(endLabelElement);\n if (!terminalLabels.get(edge.id)) {\n terminalLabels.set(edge.id, {});\n }\n terminalLabels.get(edge.id).endRight = endEdgeLabelRight;\n setTerminalWidth(fo, edge.endLabelRight);\n }\n return labelElement;\n};\n\n/**\n * @param {any} fo\n * @param {any} value\n */\nfunction setTerminalWidth(fo, value) {\n if (getConfig().flowchart.htmlLabels && fo) {\n fo.style.width = value.length * 9 + 'px';\n fo.style.height = '12px';\n }\n}\n\nexport const positionEdgeLabel = (edge, paths) => {\n log.debug('Moving label abc88 ', edge.id, edge.label, edgeLabels.get(edge.id), paths);\n let path = paths.updatedPath ? paths.updatedPath : paths.originalPath;\n const siteConfig = getConfig();\n const { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig);\n if (edge.label) {\n const el = edgeLabels.get(edge.id);\n let x = edge.x;\n let y = edge.y;\n if (path) {\n const pos = utils.calcLabelPosition(path);\n log.debug(\n 'Moving label ' + edge.label + ' from (',\n x,\n ',',\n y,\n ') to (',\n pos.x,\n ',',\n pos.y,\n ') abc88'\n );\n if (paths.updatedPath) {\n x = pos.x;\n y = pos.y;\n }\n }\n el.attr('transform', `translate(${x}, ${y + subGraphTitleTotalMargin / 2})`);\n }\n\n if (edge.startLabelLeft) {\n const el = terminalLabels.get(edge.id).startLeft;\n let x = edge.x;\n let y = edge.y;\n if (path) {\n const pos = utils.calcTerminalLabelPosition(edge.arrowTypeStart ? 10 : 0, 'start_left', path);\n x = pos.x;\n y = pos.y;\n }\n el.attr('transform', `translate(${x}, ${y})`);\n }\n if (edge.startLabelRight) {\n const el = terminalLabels.get(edge.id).startRight;\n let x = edge.x;\n let y = edge.y;\n if (path) {\n const pos = utils.calcTerminalLabelPosition(\n edge.arrowTypeStart ? 10 : 0,\n 'start_right',\n path\n );\n x = pos.x;\n y = pos.y;\n }\n el.attr('transform', `translate(${x}, ${y})`);\n }\n if (edge.endLabelLeft) {\n const el = terminalLabels.get(edge.id).endLeft;\n let x = edge.x;\n let y = edge.y;\n if (path) {\n const pos = utils.calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, 'end_left', path);\n x = pos.x;\n y = pos.y;\n }\n el.attr('transform', `translate(${x}, ${y})`);\n }\n if (edge.endLabelRight) {\n const el = terminalLabels.get(edge.id).endRight;\n let x = edge.x;\n let y = edge.y;\n if (path) {\n const pos = utils.calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, 'end_right', path);\n x = pos.x;\n y = pos.y;\n }\n el.attr('transform', `translate(${x}, ${y})`);\n }\n};\n\nconst outsideNode = (node, point) => {\n const x = node.x;\n const y = node.y;\n const dx = Math.abs(point.x - x);\n const dy = Math.abs(point.y - y);\n const w = node.width / 2;\n const h = node.height / 2;\n return dx >= w || dy >= h;\n};\n\nexport const intersection = (node, outsidePoint, insidePoint) => {\n log.debug(`intersection calc abc89:\n outsidePoint: ${JSON.stringify(outsidePoint)}\n insidePoint : ${JSON.stringify(insidePoint)}\n node : x:${node.x} y:${node.y} w:${node.width} h:${node.height}`);\n const x = node.x;\n const y = node.y;\n\n const dx = Math.abs(x - insidePoint.x);\n const w = node.width / 2;\n let r = insidePoint.x < outsidePoint.x ? w - dx : w + dx;\n const h = node.height / 2;\n\n const Q = Math.abs(outsidePoint.y - insidePoint.y);\n const R = Math.abs(outsidePoint.x - insidePoint.x);\n\n if (Math.abs(y - outsidePoint.y) * w > Math.abs(x - outsidePoint.x) * h) {\n // Intersection is top or bottom of rect.\n let q = insidePoint.y < outsidePoint.y ? outsidePoint.y - h - y : y - h - outsidePoint.y;\n r = (R * q) / Q;\n const res = {\n x: insidePoint.x < outsidePoint.x ? insidePoint.x + r : insidePoint.x - R + r,\n y: insidePoint.y < outsidePoint.y ? insidePoint.y + Q - q : insidePoint.y - Q + q,\n };\n\n if (r === 0) {\n res.x = outsidePoint.x;\n res.y = outsidePoint.y;\n }\n if (R === 0) {\n res.x = outsidePoint.x;\n }\n if (Q === 0) {\n res.y = outsidePoint.y;\n }\n\n log.debug(`abc89 top/bottom calc, Q ${Q}, q ${q}, R ${R}, r ${r}`, res);\n\n return res;\n } else {\n // Intersection on sides of rect\n if (insidePoint.x < outsidePoint.x) {\n r = outsidePoint.x - w - x;\n } else {\n r = x - w - outsidePoint.x;\n }\n let q = (Q * r) / R;\n let _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : insidePoint.x - R + r;\n let _y = insidePoint.y < outsidePoint.y ? insidePoint.y + q : insidePoint.y - q;\n log.debug(`sides calc abc89, Q ${Q}, q ${q}, R ${R}, r ${r}`, { _x, _y });\n if (r === 0) {\n _x = outsidePoint.x;\n _y = outsidePoint.y;\n }\n if (R === 0) {\n _x = outsidePoint.x;\n }\n if (Q === 0) {\n _y = outsidePoint.y;\n }\n\n return { x: _x, y: _y };\n }\n};\n\nconst cutPathAtIntersect = (_points, boundaryNode) => {\n log.warn('abc88 cutPathAtIntersect', _points, boundaryNode);\n let points = [];\n let lastPointOutside = _points[0];\n let isInside = false;\n _points.forEach((point) => {\n log.info('abc88 checking point', point, boundaryNode);\n\n if (!outsideNode(boundaryNode, point) && !isInside) {\n const inter = intersection(boundaryNode, lastPointOutside, point);\n log.debug('abc88 inside', point, lastPointOutside, inter);\n log.debug('abc88 intersection', inter, boundaryNode);\n\n let pointPresent = false;\n points.forEach((p) => {\n pointPresent = pointPresent || (p.x === inter.x && p.y === inter.y);\n });\n\n if (!points.some((e) => e.x === inter.x && e.y === inter.y)) {\n points.push(inter);\n } else {\n log.warn('abc88 no intersect', inter, points);\n }\n isInside = true;\n } else {\n log.warn('abc88 outside', point, lastPointOutside);\n lastPointOutside = point;\n if (!isInside) {\n points.push(point);\n }\n }\n });\n log.debug('returning points', points);\n return points;\n};\n\nfunction extractCornerPoints(points) {\n const cornerPoints = [];\n const cornerPointPositions = [];\n for (let i = 1; i < points.length - 1; i++) {\n const prev = points[i - 1];\n const curr = points[i];\n const next = points[i + 1];\n if (\n prev.x === curr.x &&\n curr.y === next.y &&\n Math.abs(curr.x - next.x) > 5 &&\n Math.abs(curr.y - prev.y) > 5\n ) {\n cornerPoints.push(curr);\n cornerPointPositions.push(i);\n } else if (\n prev.y === curr.y &&\n curr.x === next.x &&\n Math.abs(curr.x - prev.x) > 5 &&\n Math.abs(curr.y - next.y) > 5\n ) {\n cornerPoints.push(curr);\n cornerPointPositions.push(i);\n }\n }\n return { cornerPoints, cornerPointPositions };\n}\n\nconst findAdjacentPoint = function (pointA, pointB, distance) {\n const xDiff = pointB.x - pointA.x;\n const yDiff = pointB.y - pointA.y;\n const length = Math.sqrt(xDiff * xDiff + yDiff * yDiff);\n const ratio = distance / length;\n return { x: pointB.x - ratio * xDiff, y: pointB.y - ratio * yDiff };\n};\n\nconst fixCorners = function (lineData) {\n const { cornerPointPositions } = extractCornerPoints(lineData);\n const newLineData = [];\n for (let i = 0; i < lineData.length; i++) {\n if (cornerPointPositions.includes(i)) {\n const prevPoint = lineData[i - 1];\n const nextPoint = lineData[i + 1];\n const cornerPoint = lineData[i];\n\n const newPrevPoint = findAdjacentPoint(prevPoint, cornerPoint, 5);\n const newNextPoint = findAdjacentPoint(nextPoint, cornerPoint, 5);\n\n const xDiff = newNextPoint.x - newPrevPoint.x;\n const yDiff = newNextPoint.y - newPrevPoint.y;\n newLineData.push(newPrevPoint);\n\n const a = Math.sqrt(2) * 2;\n let newCornerPoint = { x: cornerPoint.x, y: cornerPoint.y };\n if (Math.abs(nextPoint.x - prevPoint.x) > 10 && Math.abs(nextPoint.y - prevPoint.y) >= 10) {\n log.debug(\n 'Corner point fixing',\n Math.abs(nextPoint.x - prevPoint.x),\n Math.abs(nextPoint.y - prevPoint.y)\n );\n const r = 5;\n if (cornerPoint.x === newPrevPoint.x) {\n newCornerPoint = {\n x: xDiff < 0 ? newPrevPoint.x - r + a : newPrevPoint.x + r - a,\n y: yDiff < 0 ? newPrevPoint.y - a : newPrevPoint.y + a,\n };\n } else {\n newCornerPoint = {\n x: xDiff < 0 ? newPrevPoint.x - a : newPrevPoint.x + a,\n y: yDiff < 0 ? newPrevPoint.y - r + a : newPrevPoint.y + r - a,\n };\n }\n } else {\n log.debug(\n 'Corner point skipping fixing',\n Math.abs(nextPoint.x - prevPoint.x),\n Math.abs(nextPoint.y - prevPoint.y)\n );\n }\n newLineData.push(newCornerPoint, newNextPoint);\n } else {\n newLineData.push(lineData[i]);\n }\n }\n return newLineData;\n};\n\nexport const insertEdge = function (elem, edge, clusterDb, diagramType, startNode, endNode, id) {\n const { handDrawnSeed } = getConfig();\n let points = edge.points;\n let pointsHasChanged = false;\n const tail = startNode;\n var head = endNode;\n\n if (head.intersect && tail.intersect) {\n points = points.slice(1, edge.points.length - 1);\n points.unshift(tail.intersect(points[0]));\n log.debug(\n 'Last point APA12',\n edge.start,\n '-->',\n edge.end,\n points[points.length - 1],\n head,\n head.intersect(points[points.length - 1])\n );\n points.push(head.intersect(points[points.length - 1]));\n }\n if (edge.toCluster) {\n log.info('to cluster abc88', clusterDb.get(edge.toCluster));\n points = cutPathAtIntersect(edge.points, clusterDb.get(edge.toCluster).node);\n\n pointsHasChanged = true;\n }\n\n if (edge.fromCluster) {\n log.debug(\n 'from cluster abc88',\n clusterDb.get(edge.fromCluster),\n JSON.stringify(points, null, 2)\n );\n points = cutPathAtIntersect(points.reverse(), clusterDb.get(edge.fromCluster).node).reverse();\n\n pointsHasChanged = true;\n }\n\n let lineData = points.filter((p) => !Number.isNaN(p.y));\n lineData = fixCorners(lineData);\n let lastPoint = lineData[lineData.length - 1];\n if (lineData.length > 1) {\n lastPoint = lineData[lineData.length - 1];\n const secondLastPoint = lineData[lineData.length - 2];\n const diffX = (lastPoint.x - secondLastPoint.x) / 2;\n const diffY = (lastPoint.y - secondLastPoint.y) / 2;\n const midPoint = { x: secondLastPoint.x + diffX, y: secondLastPoint.y + diffY };\n lineData.splice(-1, 0, midPoint);\n }\n let curve = curveBasis;\n if (edge.curve) {\n curve = edge.curve;\n }\n\n const { x, y } = getLineFunctionsWithOffset(edge);\n const lineFunction = line().x(x).y(y).curve(curve);\n\n let strokeClasses;\n switch (edge.thickness) {\n case 'normal':\n strokeClasses = 'edge-thickness-normal';\n break;\n case 'thick':\n strokeClasses = 'edge-thickness-thick';\n break;\n case 'invisible':\n strokeClasses = 'edge-thickness-invisible';\n break;\n default:\n strokeClasses = 'edge-thickness-normal';\n }\n switch (edge.pattern) {\n case 'solid':\n strokeClasses += ' edge-pattern-solid';\n break;\n case 'dotted':\n strokeClasses += ' edge-pattern-dotted';\n break;\n case 'dashed':\n strokeClasses += ' edge-pattern-dashed';\n break;\n default:\n strokeClasses += ' edge-pattern-solid';\n }\n let svgPath;\n let linePath = lineFunction(lineData);\n const edgeStyles = Array.isArray(edge.style) ? edge.style : [edge.style];\n if (edge.look === 'handDrawn') {\n const rc = rough.svg(elem);\n Object.assign([], lineData);\n\n const svgPathNode = rc.path(linePath, {\n roughness: 0.3,\n seed: handDrawnSeed,\n });\n\n strokeClasses += ' transition';\n\n svgPath = select(svgPathNode)\n .select('path')\n .attr('id', edge.id)\n .attr('class', ' ' + strokeClasses + (edge.classes ? ' ' + edge.classes : ''))\n .attr('style', edgeStyles ? edgeStyles.reduce((acc, style) => acc + ';' + style, '') : '');\n let d = svgPath.attr('d');\n svgPath.attr('d', d);\n elem.node().appendChild(svgPath.node());\n } else {\n svgPath = elem\n .append('path')\n .attr('d', linePath)\n .attr('id', edge.id)\n .attr('class', ' ' + strokeClasses + (edge.classes ? ' ' + edge.classes : ''))\n .attr('style', edgeStyles ? edgeStyles.reduce((acc, style) => acc + ';' + style, '') : '');\n }\n\n // DEBUG code, DO NOT REMOVE\n // adds a red circle at each edge coordinate\n // cornerPoints.forEach((point) => {\n // elem\n // .append('circle')\n // .style('stroke', 'blue')\n // .style('fill', 'blue')\n // .attr('r', 3)\n // .attr('cx', point.x)\n // .attr('cy', point.y);\n // });\n // lineData.forEach((point) => {\n // elem\n // .append('circle')\n // .style('stroke', 'blue')\n // .style('fill', 'blue')\n // .attr('r', 3)\n // .attr('cx', point.x)\n // .attr('cy', point.y);\n // });\n\n let url = '';\n if (getConfig().flowchart.arrowMarkerAbsolute || getConfig().state.arrowMarkerAbsolute) {\n url =\n window.location.protocol +\n '//' +\n window.location.host +\n window.location.pathname +\n window.location.search;\n url = url.replace(/\\(/g, '\\\\(').replace(/\\)/g, '\\\\)');\n }\n log.info('arrowTypeStart', edge.arrowTypeStart);\n log.info('arrowTypeEnd', edge.arrowTypeEnd);\n\n addEdgeMarkers(svgPath, edge, url, id, diagramType);\n\n let paths = {};\n if (pointsHasChanged) {\n paths.updatedPath = points;\n }\n paths.originalPath = edge.points;\n return paths;\n};\n", "/** Setup arrow head and define the marker. The result is appended to the svg. */\nimport { log } from '$root/logger.js';\n\n// Only add the number of markers that the diagram needs\nconst insertMarkers = (elem, markerArray, type, id) => {\n markerArray.forEach((markerName) => {\n markers[markerName](elem, type, id);\n });\n};\n\nconst extension = (elem, type, id) => {\n log.trace('Making markers for ', id);\n elem\n .append('defs')\n .append('marker')\n .attr('id', id + '_' + type + '-extensionStart')\n .attr('class', 'marker extension ' + type)\n .attr('refX', 18)\n .attr('refY', 7)\n .attr('markerWidth', 190)\n .attr('markerHeight', 240)\n .attr('orient', 'auto')\n .append('path')\n .attr('d', 'M 1,7 L18,13 V 1 Z');\n\n elem\n .append('defs')\n .append('marker')\n .attr('id', id + '_' + type + '-extensionEnd')\n .attr('class', 'marker extension ' + type)\n .attr('refX', 1)\n .attr('refY', 7)\n .attr('markerWidth', 20)\n .attr('markerHeight', 28)\n .attr('orient', 'auto')\n .append('path')\n .attr('d', 'M 1,1 V 13 L18,7 Z'); // this is actual shape for arrowhead\n};\n\nconst composition = (elem, type, id) => {\n elem\n .append('defs')\n .append('marker')\n .attr('id', id + '_' + type + '-compositionStart')\n .attr('class', 'marker composition ' + type)\n .attr('refX', 18)\n .attr('refY', 7)\n .attr('markerWidth', 190)\n .attr('markerHeight', 240)\n .attr('orient', 'auto')\n .append('path')\n .attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');\n\n elem\n .append('defs')\n .append('marker')\n .attr('id', id + '_' + type + '-compositionEnd')\n .attr('class', 'marker composition ' + type)\n .attr('refX', 1)\n .attr('refY', 7)\n .attr('markerWidth', 20)\n .attr('markerHeight', 28)\n .attr('orient', 'auto')\n .append('path')\n .attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');\n};\nconst aggregation = (elem, type, id) => {\n elem\n .append('defs')\n .append('marker')\n .attr('id', id + '_' + type + '-aggregationStart')\n .attr('class', 'marker aggregation ' + type)\n .attr('refX', 18)\n .attr('refY', 7)\n .attr('markerWidth', 190)\n .attr('markerHeight', 240)\n .attr('orient', 'auto')\n .append('path')\n .attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');\n\n elem\n .append('defs')\n .append('marker')\n .attr('id', id + '_' + type + '-aggregationEnd')\n .attr('class', 'marker aggregation ' + type)\n .attr('refX', 1)\n .attr('refY', 7)\n .attr('markerWidth', 20)\n .attr('markerHeight', 28)\n .attr('orient', 'auto')\n .append('path')\n .attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');\n};\nconst dependency = (elem, type, id) => {\n elem\n .append('defs')\n .append('marker')\n .attr('id', id + '_' + type + '-dependencyStart')\n .attr('class', 'marker dependency ' + type)\n .attr('refX', 6)\n .attr('refY', 7)\n .attr('markerWidth', 190)\n .attr('markerHeight', 240)\n .attr('orient', 'auto')\n .append('path')\n .attr('d', 'M 5,7 L9,13 L1,7 L9,1 Z');\n\n elem\n .append('defs')\n .append('marker')\n .attr('id', id + '_' + type + '-dependencyEnd')\n .attr('class', 'marker dependency ' + type)\n .attr('refX', 13)\n .attr('refY', 7)\n .attr('markerWidth', 20)\n .attr('markerHeight', 28)\n .attr('orient', 'auto')\n .append('path')\n .attr('d', 'M 18,7 L9,13 L14,7 L9,1 Z');\n};\nconst lollipop = (elem, type, id) => {\n elem\n .append('defs')\n .append('marker')\n .attr('id', id + '_' + type + '-lollipopStart')\n .attr('class', 'marker lollipop ' + type)\n .attr('refX', 13)\n .attr('refY', 7)\n .attr('markerWidth', 190)\n .attr('markerHeight', 240)\n .attr('orient', 'auto')\n .append('circle')\n .attr('stroke', 'black')\n .attr('fill', 'transparent')\n .attr('cx', 7)\n .attr('cy', 7)\n .attr('r', 6);\n\n elem\n .append('defs')\n .append('marker')\n .attr('id', id + '_' + type + '-lollipopEnd')\n .attr('class', 'marker lollipop ' + type)\n .attr('refX', 1)\n .attr('refY', 7)\n .attr('markerWidth', 190)\n .attr('markerHeight', 240)\n .attr('orient', 'auto')\n .append('circle')\n .attr('stroke', 'black')\n .attr('fill', 'transparent')\n .attr('cx', 7)\n .attr('cy', 7)\n .attr('r', 6);\n};\nconst point = (elem, type, id) => {\n elem\n .append('marker')\n .attr('id', id + '_' + type + '-pointEnd')\n .attr('class', 'marker ' + type)\n .attr('viewBox', '0 0 10 10')\n .attr('refX', 5)\n .attr('refY', 5)\n .attr('markerUnits', 'userSpaceOnUse')\n .attr('markerWidth', 8)\n .attr('markerHeight', 8)\n .attr('orient', 'auto')\n .append('path')\n .attr('d', 'M 0 0 L 10 5 L 0 10 z')\n .attr('class', 'arrowMarkerPath')\n .style('stroke-width', 1)\n .style('stroke-dasharray', '1,0');\n elem\n .append('marker')\n .attr('id', id + '_' + type + '-pointStart')\n .attr('class', 'marker ' + type)\n .attr('viewBox', '0 0 10 10')\n .attr('refX', 4.5)\n .attr('refY', 5)\n .attr('markerUnits', 'userSpaceOnUse')\n .attr('markerWidth', 8)\n .attr('markerHeight', 8)\n .attr('orient', 'auto')\n .append('path')\n .attr('d', 'M 0 5 L 10 10 L 10 0 z')\n .attr('class', 'arrowMarkerPath')\n .style('stroke-width', 1)\n .style('stroke-dasharray', '1,0');\n};\nconst circle = (elem, type, id) => {\n elem\n .append('marker')\n .attr('id', id + '_' + type + '-circleEnd')\n .attr('class', 'marker ' + type)\n .attr('viewBox', '0 0 10 10')\n .attr('refX', 11)\n .attr('refY', 5)\n .attr('markerUnits', 'userSpaceOnUse')\n .attr('markerWidth', 11)\n .attr('markerHeight', 11)\n .attr('orient', 'auto')\n .append('circle')\n .attr('cx', '5')\n .attr('cy', '5')\n .attr('r', '5')\n .attr('class', 'arrowMarkerPath')\n .style('stroke-width', 1)\n .style('stroke-dasharray', '1,0');\n\n elem\n .append('marker')\n .attr('id', id + '_' + type + '-circleStart')\n .attr('class', 'marker ' + type)\n .attr('viewBox', '0 0 10 10')\n .attr('refX', -1)\n .attr('refY', 5)\n .attr('markerUnits', 'userSpaceOnUse')\n .attr('markerWidth', 11)\n .attr('markerHeight', 11)\n .attr('orient', 'auto')\n .append('circle')\n .attr('cx', '5')\n .attr('cy', '5')\n .attr('r', '5')\n .attr('class', 'arrowMarkerPath')\n .style('stroke-width', 1)\n .style('stroke-dasharray', '1,0');\n};\nconst cross = (elem, type, id) => {\n elem\n .append('marker')\n .attr('id', id + '_' + type + '-crossEnd')\n .attr('class', 'marker cross ' + type)\n .attr('viewBox', '0 0 11 11')\n .attr('refX', 12)\n .attr('refY', 5.2)\n .attr('markerUnits', 'userSpaceOnUse')\n .attr('markerWidth', 11)\n .attr('markerHeight', 11)\n .attr('orient', 'auto')\n .append('path')\n // .attr('stroke', 'black')\n .attr('d', 'M 1,1 l 9,9 M 10,1 l -9,9')\n .attr('class', 'arrowMarkerPath')\n .style('stroke-width', 2)\n .style('stroke-dasharray', '1,0');\n\n elem\n .append('marker')\n .attr('id', id + '_' + type + '-crossStart')\n .attr('class', 'marker cross ' + type)\n .attr('viewBox', '0 0 11 11')\n .attr('refX', -1)\n .attr('refY', 5.2)\n .attr('markerUnits', 'userSpaceOnUse')\n .attr('markerWidth', 11)\n .attr('markerHeight', 11)\n .attr('orient', 'auto')\n .append('path')\n // .attr('stroke', 'black')\n .attr('d', 'M 1,1 l 9,9 M 10,1 l -9,9')\n .attr('class', 'arrowMarkerPath')\n .style('stroke-width', 2)\n .style('stroke-dasharray', '1,0');\n};\nconst barb = (elem, type, id) => {\n elem\n .append('defs')\n .append('marker')\n .attr('id', id + '_' + type + '-barbEnd')\n .attr('refX', 19)\n .attr('refY', 7)\n .attr('markerWidth', 20)\n .attr('markerHeight', 14)\n .attr('markerUnits', 'userSpaceOnUse')\n .attr('orient', 'auto')\n .append('path')\n .attr('d', 'M 19,7 L9,13 L14,7 L9,1 Z');\n};\n\n// TODO rename the class diagram markers to something shape descriptive and semantic free\nconst markers = {\n extension,\n composition,\n aggregation,\n dependency,\n lollipop,\n point,\n circle,\n cross,\n barb,\n};\nexport default insertMarkers;\n", "import { createText } from '$root/rendering-util/createText.ts';\nimport { getConfig } from '$root/diagram-api/diagramAPI.js';\nimport { select } from 'd3';\nimport { evaluate, sanitizeText } from '$root/diagrams/common/common.js';\nimport { decodeEntities } from '$root/utils.js';\n\nexport const labelHelper = async (parent, node, _classes) => {\n let cssClasses;\n const useHtmlLabels = node.useHtmlLabels || evaluate(getConfig().flowchart.htmlLabels);\n if (!_classes) {\n cssClasses = 'node default';\n } else {\n cssClasses = _classes;\n }\n\n // Add outer g element\n const shapeSvg = parent\n .insert('g')\n .attr('class', cssClasses)\n .attr('id', node.domId || node.id);\n\n // Create the label and insert it after the rect\n const labelEl = shapeSvg.insert('g').attr('class', 'label').attr('style', node.labelStyle);\n\n // Replace label with default value if undefined\n let label;\n if (node.label === undefined) {\n label = '';\n } else {\n label = typeof node.label === 'string' ? node.label : node.label[0];\n }\n\n let text;\n text = await createText(labelEl, sanitizeText(decodeEntities(label), getConfig()), {\n useHtmlLabels,\n width: node.width || getConfig().flowchart.wrappingWidth,\n cssClasses: 'markdown-node-label',\n style: node.labelStyle,\n });\n // Get the size of the label\n let bbox = text.getBBox();\n const halfPadding = node.padding / 2;\n\n if (evaluate(getConfig().flowchart.htmlLabels)) {\n const div = text.children[0];\n const dv = select(text);\n\n // if there are images, need to wait for them to load before getting the bounding box\n const images = div.getElementsByTagName('img');\n if (images) {\n const noImgText = label.replace(/ ]*>/g, '').trim() === '';\n\n await Promise.all(\n [...images].map(\n (img) =>\n new Promise((res) => {\n /**\n *\n */\n function setupImage() {\n img.style.display = 'flex';\n img.style.flexDirection = 'column';\n\n if (noImgText) {\n // default size if no text\n const bodyFontSize = getConfig().fontSize\n ? getConfig().fontSize\n : window.getComputedStyle(document.body).fontSize;\n const enlargingFactor = 5;\n const width = parseInt(bodyFontSize, 10) * enlargingFactor + 'px';\n img.style.minWidth = width;\n img.style.maxWidth = width;\n } else {\n img.style.width = '100%';\n }\n res(img);\n }\n setTimeout(() => {\n if (img.complete) {\n setupImage();\n }\n });\n img.addEventListener('error', setupImage);\n img.addEventListener('load', setupImage);\n })\n )\n );\n }\n\n bbox = div.getBoundingClientRect();\n dv.attr('width', bbox.width);\n dv.attr('height', bbox.height);\n }\n\n // Center the label\n if (useHtmlLabels) {\n labelEl.attr('transform', 'translate(' + -bbox.width / 2 + ', ' + -bbox.height / 2 + ')');\n } else {\n labelEl.attr('transform', 'translate(' + 0 + ', ' + -bbox.height / 2 + ')');\n }\n if (node.centerLabel) {\n labelEl.attr('transform', 'translate(' + -bbox.width / 2 + ', ' + -bbox.height / 2 + ')');\n }\n labelEl.insert('rect', ':first-child');\n return { shapeSvg, bbox, halfPadding, label: labelEl };\n};\n\nexport const updateNodeBounds = (node, element) => {\n const bbox = element.node().getBBox();\n node.width = bbox.width;\n node.height = bbox.height;\n};\n\n/**\n * @param parent\n * @param w\n * @param h\n * @param points\n */\nexport function insertPolygonShape(parent, w, h, points) {\n return parent\n .insert('polygon', ':first-child')\n .attr(\n 'points',\n points\n .map(function (d) {\n return d.x + ',' + d.y;\n })\n .join(' ')\n )\n .attr('class', 'label-container')\n .attr('transform', 'translate(' + -w / 2 + ',' + h / 2 + ')');\n}\n\nexport const getNodeClasses = (node, extra) =>\n (node.look === 'handDrawn' ? 'rough-node' : 'node') + ' ' + node.cssClasses + ' ' + (extra || '');\n", "function intersectNode(node, point) {\n return node.intersect(point);\n}\n\nexport default intersectNode;\n", "function intersectEllipse(node, rx, ry, point) {\n // Formulae from: https://mathworld.wolfram.com/Ellipse-LineIntersection.html\n\n var cx = node.x;\n var cy = node.y;\n\n var px = cx - point.x;\n var py = cy - point.y;\n\n var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px);\n\n var dx = Math.abs((rx * ry * px) / det);\n if (point.x < cx) {\n dx = -dx;\n }\n var dy = Math.abs((rx * ry * py) / det);\n if (point.y < cy) {\n dy = -dy;\n }\n\n return { x: cx + dx, y: cy + dy };\n}\n\nexport default intersectEllipse;\n", "import intersectEllipse from './intersect-ellipse.js';\n\nfunction intersectCircle(node, rx, point) {\n return intersectEllipse(node, rx, rx, point);\n}\n\nexport default intersectCircle;\n", "/**\n * Returns the point at which two lines, p and q, intersect or returns undefined if they do not intersect.\n */\nfunction intersectLine(p1, p2, q1, q2) {\n // Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994,\n // p7 and p473.\n\n var a1, a2, b1, b2, c1, c2;\n var r1, r2, r3, r4;\n var denom, offset, num;\n var x, y;\n\n // Compute a1, b1, c1, where line joining points 1 and 2 is F(x,y) = a1 x +\n // b1 y + c1 = 0.\n a1 = p2.y - p1.y;\n b1 = p1.x - p2.x;\n c1 = p2.x * p1.y - p1.x * p2.y;\n\n // Compute r3 and r4.\n r3 = a1 * q1.x + b1 * q1.y + c1;\n r4 = a1 * q2.x + b1 * q2.y + c1;\n\n // Check signs of r3 and r4. If both point 3 and point 4 lie on\n // same side of line 1, the line segments do not intersect.\n if (r3 !== 0 && r4 !== 0 && sameSign(r3, r4)) {\n return /*DON'T_INTERSECT*/;\n }\n\n // Compute a2, b2, c2 where line joining points 3 and 4 is G(x,y) = a2 x + b2 y + c2 = 0\n a2 = q2.y - q1.y;\n b2 = q1.x - q2.x;\n c2 = q2.x * q1.y - q1.x * q2.y;\n\n // Compute r1 and r2\n r1 = a2 * p1.x + b2 * p1.y + c2;\n r2 = a2 * p2.x + b2 * p2.y + c2;\n\n // Check signs of r1 and r2. If both point 1 and point 2 lie\n // on same side of second line segment, the line segments do\n // not intersect.\n if (r1 !== 0 && r2 !== 0 && sameSign(r1, r2)) {\n return /*DON'T_INTERSECT*/;\n }\n\n // Line segments intersect: compute intersection point.\n denom = a1 * b2 - a2 * b1;\n if (denom === 0) {\n return /*COLLINEAR*/;\n }\n\n offset = Math.abs(denom / 2);\n\n // The denom/2 is to get rounding instead of truncating. It\n // is added or subtracted to the numerator, depending upon the\n // sign of the numerator.\n num = b1 * c2 - b2 * c1;\n x = num < 0 ? (num - offset) / denom : (num + offset) / denom;\n\n num = a2 * c1 - a1 * c2;\n y = num < 0 ? (num - offset) / denom : (num + offset) / denom;\n\n return { x: x, y: y };\n}\n\nfunction sameSign(r1, r2) {\n return r1 * r2 > 0;\n}\n\nexport default intersectLine;\n", "import intersectLine from './intersect-line.js';\n\n/**\n * Returns the point ({x, y}) at which the point argument intersects with the node argument assuming\n * that it has the shape specified by polygon.\n */\nfunction intersectPolygon(node, polyPoints, point) {\n let x1 = node.x;\n let y1 = node.y;\n\n let intersections = [];\n\n let minX = Number.POSITIVE_INFINITY;\n let minY = Number.POSITIVE_INFINITY;\n if (typeof polyPoints.forEach === 'function') {\n polyPoints.forEach(function (entry) {\n minX = Math.min(minX, entry.x);\n minY = Math.min(minY, entry.y);\n });\n } else {\n minX = Math.min(minX, polyPoints.x);\n minY = Math.min(minY, polyPoints.y);\n }\n\n let left = x1 - node.width / 2 - minX;\n let top = y1 - node.height / 2 - minY;\n\n for (let i = 0; i < polyPoints.length; i++) {\n let p1 = polyPoints[i];\n let p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0];\n let intersect = intersectLine(\n node,\n point,\n { x: left + p1.x, y: top + p1.y },\n { x: left + p2.x, y: top + p2.y }\n );\n if (intersect) {\n intersections.push(intersect);\n }\n }\n\n if (!intersections.length) {\n return node;\n }\n\n if (intersections.length > 1) {\n // More intersections, find the one nearest to edge end point\n intersections.sort(function (p, q) {\n let pdx = p.x - point.x;\n let pdy = p.y - point.y;\n let distp = Math.sqrt(pdx * pdx + pdy * pdy);\n\n let qdx = q.x - point.x;\n let qdy = q.y - point.y;\n let distq = Math.sqrt(qdx * qdx + qdy * qdy);\n\n return distp < distq ? -1 : distp === distq ? 0 : 1;\n });\n }\n return intersections[0];\n}\n\nexport default intersectPolygon;\n", "/*\n * Borrowed with love from from dagre-d3. Many thanks to cpettitt!\n */\n\nimport node from './intersect-node.js';\nimport circle from './intersect-circle.js';\nimport ellipse from './intersect-ellipse.js';\nimport polygon from './intersect-polygon.js';\nimport rect from './intersect-rect.js';\n\nexport default {\n node,\n circle,\n ellipse,\n polygon,\n rect,\n};\n", "import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';\nimport intersect from '../intersect/index.js';\nimport type { Node, RectOptions } from '$root/rendering-util/types.d.ts';\nimport { createRoundedRectPathD } from './roundedRectPath.js';\nimport {\n userNodeOverrides,\n styles2String,\n} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';\nimport rough from 'roughjs';\n\nexport const drawRect = async (parent: SVGAElement, node: Node, options: RectOptions) => {\n const { labelStyles, nodeStyles } = styles2String(node);\n node.labelStyle = labelStyles;\n // console.log('IPI labelStyles:', labelStyles);\n const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));\n\n const totalWidth = Math.max(bbox.width + options.labelPaddingX * 2, node?.width || 0);\n const totalHeight = Math.max(bbox.height + options.labelPaddingY * 2, node?.height || 0);\n const x = -totalWidth / 2;\n const y = -totalHeight / 2;\n\n // log.info('IPI node = ', node);\n\n let rect;\n let { rx, ry } = node;\n const { cssStyles } = node;\n\n //use options rx, ry overrides if present\n if (options?.rx && options.ry) {\n rx = options.rx;\n ry = options.ry;\n }\n\n if (node.look === 'handDrawn') {\n // @ts-ignore TODO: Fix rough typings\n const rc = rough.svg(shapeSvg);\n const options = userNodeOverrides(node, {});\n\n const roughNode =\n rx || ry\n ? rc.path(createRoundedRectPathD(x, y, totalWidth, totalHeight, rx || 0), options)\n : rc.rectangle(x, y, totalWidth, totalHeight, options);\n\n rect = shapeSvg.insert(() => roughNode, ':first-child');\n rect.attr('class', 'basic label-container').attr('style', cssStyles);\n } else {\n rect = shapeSvg.insert('rect', ':first-child');\n\n rect\n .attr('class', 'basic label-container')\n .attr('style', nodeStyles)\n .attr('rx', rx)\n .attr('data-id', 'abc')\n .attr('data-et', 'node')\n .attr('ry', ry)\n .attr('x', x)\n .attr('y', y)\n .attr('width', totalWidth)\n .attr('height', totalHeight);\n }\n\n updateNodeBounds(node, rect);\n\n node.intersect = function (point) {\n return intersect.rect(node, point);\n };\n\n return shapeSvg;\n};\n", "import type { Node, RectOptions } from '$root/rendering-util/types.d.ts';\nimport { drawRect } from './drawRect.js';\n\nexport const state = async (parent: SVGAElement, node: Node) => {\n const options = {\n rx: 5,\n ry: 5,\n classes: 'flowchart-node',\n } as RectOptions;\n return drawRect(parent, node, options);\n};\n", "import type { Node, RectOptions } from '$root/rendering-util/types.d.ts';\nimport { drawRect } from './drawRect.js';\n\nexport const roundedRect = async (parent: SVGAElement, node: Node) => {\n const options = {\n rx: 5,\n ry: 5,\n classes: '',\n labelPaddingX: (node?.padding || 0) * 1,\n labelPaddingY: (node?.padding || 0) * 1,\n } as RectOptions;\n\n return drawRect(parent, node, options);\n};\n", "import type { Node, RectOptions } from '$root/rendering-util/types.d.ts';\nimport { drawRect } from './drawRect.js';\n\nexport const squareRect = async (parent: SVGAElement, node: Node) => {\n const options = {\n rx: 0,\n ry: 0,\n classes: '',\n labelPaddingX: (node?.padding || 0) * 2,\n labelPaddingY: (node?.padding || 0) * 1,\n } as RectOptions;\n return drawRect(parent, node, options);\n};\n", "import { updateNodeBounds } from './util.js';\nimport intersect from '../intersect/index.js';\nimport type { Node } from '$root/rendering-util/types.d.ts';\nimport type { SVG } from '$root/diagram-api/types.js';\nimport rough from 'roughjs';\nimport { solidStateFill } from './handDrawnShapeStyles.js';\nimport { getConfig } from '$root/diagram-api/diagramAPI.js';\n\nexport const stateStart = (parent: SVG, node: Node) => {\n const { themeVariables } = getConfig();\n const { lineColor } = themeVariables;\n\n const shapeSvg = parent\n .insert('g')\n .attr('class', 'node default')\n .attr('id', node.domId || node.id);\n\n let circle;\n if (node.look === 'handDrawn') {\n // @ts-ignore TODO: Fix rough typings\n const rc = rough.svg(shapeSvg);\n const roughNode = rc.circle(0, 0, 14, solidStateFill(lineColor));\n circle = shapeSvg.insert(() => roughNode);\n } else {\n circle = shapeSvg.insert('circle', ':first-child');\n }\n\n // center the circle around its coordinate\n // @ts-ignore TODO: Fix typings\n circle.attr('class', 'state-start').attr('r', 7).attr('width', 14).attr('height', 14);\n\n updateNodeBounds(node, circle);\n\n node.intersect = function (point) {\n return intersect.circle(node, 7, point);\n };\n\n return shapeSvg;\n};\n", "import { updateNodeBounds } from './util.js';\nimport intersect from '../intersect/index.js';\nimport type { Node } from '$root/rendering-util/types.d.ts';\nimport type { SVG } from '$root/diagram-api/types.js';\nimport rough from 'roughjs';\nimport { solidStateFill } from './handDrawnShapeStyles.js';\nimport { getConfig } from '$root/diagram-api/diagramAPI.js';\n\nexport const stateEnd = (parent: SVG, node: Node) => {\n const { themeVariables } = getConfig();\n const { lineColor } = themeVariables;\n const shapeSvg = parent\n .insert('g')\n .attr('class', 'node default')\n .attr('id', node.domId || node.id);\n\n let circle;\n let innerCircle;\n if (node.look === 'handDrawn') {\n // @ts-ignore TODO: Fix rough typings\n const rc = rough.svg(shapeSvg);\n const roughNode = rc.circle(0, 0, 14, { ...solidStateFill(lineColor), roughness: 0.5 });\n const roughInnerNode = rc.circle(0, 0, 5, { ...solidStateFill(lineColor), fillStyle: 'solid' });\n circle = shapeSvg.insert(() => roughNode);\n innerCircle = shapeSvg.insert(() => roughInnerNode);\n } else {\n innerCircle = shapeSvg.insert('circle', ':first-child');\n circle = shapeSvg.insert('circle', ':first-child');\n\n circle.attr('class', 'state-start').attr('r', 7).attr('width', 14).attr('height', 14);\n\n innerCircle.attr('class', 'state-end').attr('r', 5).attr('width', 10).attr('height', 10);\n }\n\n updateNodeBounds(node, circle);\n\n node.intersect = function (point) {\n return intersect.circle(node, 7, point);\n };\n\n return shapeSvg;\n};\n", "import { updateNodeBounds } from './util.js';\nimport intersect from '../intersect/index.js';\nimport type { Node } from '$root/rendering-util/types.d.ts';\nimport type { SVG } from '$root/diagram-api/types.js';\nimport rough from 'roughjs';\nimport { solidStateFill } from './handDrawnShapeStyles.js';\nimport { getConfig } from '$root/diagram-api/diagramAPI.js';\n\nexport const forkJoin = (parent: SVG, node: Node, dir: string) => {\n const { themeVariables } = getConfig();\n const { lineColor } = themeVariables;\n const shapeSvg = parent\n .insert('g')\n .attr('class', 'node default')\n .attr('id', node.domId || node.id);\n\n let width = 70;\n let height = 10;\n\n if (dir === 'LR') {\n width = 10;\n height = 70;\n }\n const x = (-1 * width) / 2;\n const y = (-1 * height) / 2;\n\n let shape;\n if (node.look === 'handDrawn') {\n // @ts-ignore TODO: Fix rough typings\n const rc = rough.svg(shapeSvg);\n const roughNode = rc.rectangle(x, y, width, height, solidStateFill(lineColor));\n shape = shapeSvg.insert(() => roughNode);\n } else {\n shape = shapeSvg\n .append('rect')\n .attr('x', x)\n .attr('y', y)\n .attr('width', width)\n .attr('height', height)\n .attr('class', 'fork-join');\n }\n\n updateNodeBounds(node, shape);\n let nodeHeight = 0;\n let nodeWidth = 0;\n let nodePadding = 10;\n if (node.height) {\n nodeHeight = node.height;\n }\n if (node.width) {\n nodeWidth = node.width;\n }\n\n if (node.padding) {\n nodePadding = node.padding;\n }\n\n node.height = nodeHeight + nodePadding / 2;\n node.width = nodeWidth + nodePadding / 2;\n node.intersect = function (point) {\n return intersect.rect(node, point);\n };\n\n return shapeSvg;\n};\n", "import intersect from '../intersect/index.js';\nimport type { Node } from '$root/rendering-util/types.d.ts';\nimport type { SVG } from '$root/diagram-api/types.js';\n// @ts-ignore TODO: Fix rough typings\nimport rough from 'roughjs';\nimport { solidStateFill, styles2String } from './handDrawnShapeStyles.js';\nimport { getConfig } from '$root/diagram-api/diagramAPI.js';\n\nexport const choice = (parent: SVG, node: Node) => {\n const { labelStyles, nodeStyles } = styles2String(node);\n node.labelStyle = labelStyles;\n const { themeVariables } = getConfig();\n const { lineColor } = themeVariables;\n const shapeSvg = parent\n .insert('g')\n .attr('class', 'node default')\n .attr('id', node.domId || node.id);\n\n const s = 28;\n const points = [\n { x: 0, y: s / 2 },\n { x: s / 2, y: 0 },\n { x: 0, y: -s / 2 },\n { x: -s / 2, y: 0 },\n ];\n\n let choice;\n if (node.look === 'handDrawn') {\n // @ts-ignore TODO: Fix rough typings\n const rc = rough.svg(shapeSvg);\n const pointArr = points.map(function (d) {\n return [d.x, d.y];\n });\n const roughNode = rc.polygon(pointArr, solidStateFill(lineColor));\n choice = shapeSvg.insert(() => roughNode);\n } else {\n choice = shapeSvg.insert('polygon', ':first-child').attr(\n 'points',\n points\n .map(function (d) {\n return d.x + ',' + d.y;\n })\n .join(' ')\n );\n }\n\n // center the circle around its coordinate\n choice\n .attr('class', 'state-start')\n // @ts-ignore TODO: Fix rough typings\n .attr('r', 7)\n .attr('width', 28)\n .attr('height', 28)\n .attr('style', nodeStyles);\n\n node.width = 28;\n node.height = 28;\n\n node.intersect = function (point) {\n return intersect.circle(node, 14, point);\n };\n\n return shapeSvg;\n};\n", "import { log } from '$root/logger.js';\nimport { labelHelper, updateNodeBounds } from './util.js';\nimport intersect from '../intersect/index.js';\nimport { getConfig } from '$root/diagram-api/diagramAPI.js';\nimport type { Node } from '$root/rendering-util/types.d.ts';\nimport rough from 'roughjs';\n\nexport const note = async (parent: SVGAElement, node: Node) => {\n const { themeVariables, handDrawnSeed } = getConfig();\n const { noteBorderColor, noteBkgColor } = themeVariables;\n\n const useHtmlLabels = node.useHtmlLabels;\n if (!useHtmlLabels) {\n node.centerLabel = true;\n }\n const { shapeSvg, bbox } = await labelHelper(parent, node, 'node ' + node.cssClasses);\n\n log.info('Classes = ', node.cssClasses);\n const { cssStyles } = node;\n let rect;\n const totalWidth = bbox.width + node.padding;\n const totalHeight = bbox.height + node.padding;\n const x = -totalWidth / 2;\n const y = -totalHeight / 2;\n\n if (node.look === 'handDrawn') {\n // add the rect\n // @ts-ignore TODO: Fix rough typings\n const rc = rough.svg(shapeSvg);\n const roughNode = rc.rectangle(x, y, totalWidth, totalHeight, {\n roughness: 0.7,\n fill: noteBkgColor,\n fillWeight: 3,\n seed: handDrawnSeed,\n // fillStyle: 'solid', // solid fill'\n stroke: noteBorderColor,\n });\n\n rect = shapeSvg.insert(() => roughNode, ':first-child');\n rect.attr('class', 'basic label-container').attr('style', cssStyles);\n } else {\n rect = shapeSvg.insert('rect', ':first-child');\n rect\n .attr('rx', node.rx)\n .attr('ry', node.ry)\n .attr('x', x)\n .attr('y', y)\n .attr('width', totalWidth)\n .attr('height', totalHeight);\n }\n\n updateNodeBounds(node, rect);\n\n node.intersect = function (point) {\n return intersect.rect(node, point);\n };\n\n return shapeSvg;\n};\n", "import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';\nimport intersect from '../intersect/index.js';\nimport type { Node } from '$root/rendering-util/types.d.ts';\nimport {\n styles2String,\n userNodeOverrides,\n} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';\nimport rough from 'roughjs';\nimport { createRoundedRectPathD } from './roundedRectPath.js';\n\nexport const createStadiumPathD = (\n x: number,\n y: number,\n totalWidth: number,\n totalHeight: number\n) => {\n const radius = totalHeight / 2;\n return [\n 'M',\n x + radius,\n y, // Move to the start of the top-left arc\n 'H',\n x + totalWidth - radius, // Draw horizontal line to the start of the top-right arc\n 'A',\n radius,\n radius,\n 0,\n 0,\n 1,\n x + totalWidth,\n y + radius, // Draw top-right arc\n 'H',\n x, // Draw horizontal line to the start of the bottom-right arc\n 'A',\n radius,\n radius,\n 0,\n 0,\n 1,\n x + totalWidth - radius,\n y + totalHeight, // Draw bottom-right arc\n 'H',\n x + radius, // Draw horizontal line to the start of the bottom-left arc\n 'A',\n radius,\n radius,\n 0,\n 0,\n 1,\n x,\n y + radius, // Draw bottom-left arc\n 'Z', // Close the path\n ].join(' ');\n};\n\nexport const stadium = async (parent: SVGAElement, node: Node) => {\n const { labelStyles, nodeStyles } = styles2String(node);\n node.labelStyle = labelStyles;\n const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));\n\n const h = bbox.height + node.padding;\n const w = bbox.width + h / 4 + node.padding;\n\n let rect;\n const { cssStyles } = node;\n if (node.look === 'handDrawn') {\n // @ts-ignore - rough is not typed\n const rc = rough.svg(shapeSvg);\n const options = userNodeOverrides(node, {});\n\n const pathData = createRoundedRectPathD(-w / 2, -h / 2, w, h, h / 2);\n const roughNode = rc.path(pathData, options);\n\n rect = shapeSvg.insert(() => roughNode, ':first-child');\n rect.attr('class', 'basic label-container').attr('style', cssStyles);\n } else {\n rect = shapeSvg.insert('rect', ':first-child');\n\n rect\n .attr('class', 'basic label-container')\n .attr('style', nodeStyles)\n .attr('rx', h / 2)\n .attr('ry', h / 2)\n .attr('x', -w / 2)\n .attr('y', -h / 2)\n .attr('width', w)\n .attr('height', h);\n }\n\n updateNodeBounds(node, rect);\n\n node.intersect = function (point) {\n return intersect.rect(node, point);\n };\n\n return shapeSvg;\n};\n", "import type { Node } from '$root/rendering-util/types.d.ts';\nimport { select } from 'd3';\nimport { evaluate } from '$root/diagrams/common/common.js';\nimport { updateNodeBounds } from './util.js';\nimport createLabel from '../createLabel.js';\nimport intersect from '../intersect/index.js';\nimport {\n styles2String,\n userNodeOverrides,\n} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';\nimport rough from 'roughjs';\nimport { getConfig } from '$root/diagram-api/diagramAPI.js';\nimport { createRoundedRectPathD } from './roundedRectPath.js';\nimport { log } from '$root/logger.js';\n\nexport const rectWithTitle = async (parent: SVGElement, node: Node) => {\n const { labelStyles, nodeStyles } = styles2String(node);\n node.labelStyle = labelStyles;\n let classes;\n if (!node.cssClasses) {\n classes = 'node default';\n } else {\n classes = 'node ' + node.cssClasses;\n }\n\n // Add outer g element\n const shapeSvg = parent\n // @ts-ignore - d3 typings are not correct\n .insert('g')\n .attr('class', classes)\n .attr('id', node.domId || node.id);\n\n // Create the title label and insert it after the rect\n const g = shapeSvg.insert('g');\n\n const label = shapeSvg.insert('g').attr('class', 'label').attr('style', nodeStyles);\n\n const description = node.description;\n\n const title = node.label;\n\n const text = label.node().appendChild(await createLabel(title, node.labelStyle, true, true));\n let bbox = { width: 0, height: 0 };\n if (evaluate(getConfig()?.flowchart?.htmlLabels)) {\n const div = text.children[0];\n const dv = select(text);\n bbox = div.getBoundingClientRect();\n dv.attr('width', bbox.width);\n dv.attr('height', bbox.height);\n }\n log.info('Text 2', description);\n const textRows = description || [];\n const titleBox = text.getBBox();\n const descr = label\n .node()\n .appendChild(\n await createLabel(\n textRows.join ? textRows.join(' ') : textRows,\n node.labelStyle,\n true,\n true\n )\n );\n\n //if (evaluate(getConfig()?.flowchart?.htmlLabels)) {\n const div = descr.children[0];\n const dv = select(descr);\n bbox = div.getBoundingClientRect();\n dv.attr('width', bbox.width);\n dv.attr('height', bbox.height);\n // }\n\n const halfPadding = (node.padding || 0) / 2;\n select(descr).attr(\n 'transform',\n 'translate( ' +\n (bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) +\n ', ' +\n (titleBox.height + halfPadding + 5) +\n ')'\n );\n select(text).attr(\n 'transform',\n 'translate( ' +\n (bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) +\n ', ' +\n 0 +\n ')'\n );\n // Get the size of the label\n\n // Bounding box for title and text\n bbox = label.node().getBBox();\n\n // Center the label\n label.attr(\n 'transform',\n 'translate(' + -bbox.width / 2 + ', ' + (-bbox.height / 2 - halfPadding + 3) + ')'\n );\n\n const totalWidth = bbox.width + (node.padding || 0);\n const totalHeight = bbox.height + (node.padding || 0);\n const x = -bbox.width / 2 - halfPadding;\n const y = -bbox.height / 2 - halfPadding;\n let rect;\n let innerLine;\n if (node.look === 'handDrawn') {\n // @ts-ignore No typings for rough\n const rc = rough.svg(shapeSvg);\n const options = userNodeOverrides(node, {});\n const roughNode = rc.path(\n createRoundedRectPathD(x, y, totalWidth, totalHeight, node.rx || 0),\n options\n );\n\n const roughLine = rc.line(\n -bbox.width / 2 - halfPadding,\n -bbox.height / 2 - halfPadding + titleBox.height + halfPadding,\n bbox.width / 2 + halfPadding,\n -bbox.height / 2 - halfPadding + titleBox.height + halfPadding,\n options\n );\n\n innerLine = shapeSvg.insert(() => {\n log.debug('Rough node insert CXC', roughNode);\n return roughLine;\n }, ':first-child');\n rect = shapeSvg.insert(() => {\n log.debug('Rough node insert CXC', roughNode);\n return roughNode;\n }, ':first-child');\n } else {\n rect = g.insert('rect', ':first-child');\n innerLine = g.insert('line');\n rect\n .attr('class', 'outer title-state')\n .attr('style', nodeStyles)\n .attr('x', -bbox.width / 2 - halfPadding)\n .attr('y', -bbox.height / 2 - halfPadding)\n .attr('width', bbox.width + (node.padding || 0))\n .attr('height', bbox.height + (node.padding || 0));\n\n innerLine\n .attr('class', 'divider')\n .attr('x1', -bbox.width / 2 - halfPadding)\n .attr('x2', bbox.width / 2 + halfPadding)\n .attr('y1', -bbox.height / 2 - halfPadding + titleBox.height + halfPadding)\n .attr('y2', -bbox.height / 2 - halfPadding + titleBox.height + halfPadding);\n }\n updateNodeBounds(node, rect);\n\n node.intersect = function (point) {\n return intersect.rect(node, point);\n };\n\n return shapeSvg;\n};\n", "export function insertPolygonShape(\n parent: any,\n w: number,\n h: number,\n points: { x: number; y: number }[]\n) {\n return parent\n .insert('polygon', ':first-child')\n .attr(\n 'points',\n points\n .map(function (d) {\n return d.x + ',' + d.y;\n })\n .join(' ')\n )\n .attr('class', 'label-container')\n .attr('transform', 'translate(' + -w / 2 + ',' + h / 2 + ')');\n}\n", "import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';\nimport intersect from '../intersect/index.js';\nimport type { Node } from '$root/rendering-util/types.d.ts';\nimport {\n styles2String,\n userNodeOverrides,\n} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';\nimport rough from 'roughjs';\nimport { insertPolygonShape } from './insertPolygonShape.js';\n\nexport const createSubroutinePathD = (\n x: number,\n y: number,\n width: number,\n height: number\n): string => {\n const offset = 8;\n return [\n `M${x - offset},${y}`,\n `H${x + width + offset}`,\n `V${y + height}`,\n `H${x - offset}`,\n `V${y}`,\n 'M',\n x,\n y,\n 'H',\n x + width,\n 'V',\n y + height,\n 'H',\n x,\n 'Z',\n ].join(' ');\n};\n\nexport const subroutine = async (parent: SVGAElement, node: Node) => {\n const { labelStyles, nodeStyles } = styles2String(node);\n node.labelStyle = labelStyles;\n const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));\n const halfPadding = (node?.padding || 0) / 2;\n const w = bbox.width + node.padding;\n const h = bbox.height + node.padding;\n const x = -bbox.width / 2 - halfPadding;\n const y = -bbox.height / 2 - halfPadding;\n\n const points = [\n { x: 0, y: 0 },\n { x: w, y: 0 },\n { x: w, y: -h },\n { x: 0, y: -h },\n { x: 0, y: 0 },\n { x: -8, y: 0 },\n { x: w + 8, y: 0 },\n { x: w + 8, y: -h },\n { x: -8, y: -h },\n { x: -8, y: 0 },\n ];\n\n if (node.look === 'handDrawn') {\n // @ts-ignore - rough is not typed\n const rc = rough.svg(shapeSvg);\n const options = userNodeOverrides(node, {});\n\n const roughNode = rc.rectangle(x - 8, y, w + 16, h, options);\n const l1 = rc.line(x, y, x, y + h, options);\n const l2 = rc.line(x + w, y, x + w, y + h, options);\n\n shapeSvg.insert(() => l1, ':first-child');\n shapeSvg.insert(() => l2, ':first-child');\n const rect = shapeSvg.insert(() => roughNode, ':first-child');\n const { cssStyles } = node;\n rect.attr('class', 'basic label-container').attr('style', cssStyles);\n updateNodeBounds(node, rect);\n } else {\n const el = insertPolygonShape(shapeSvg, w, h, points);\n if (nodeStyles) {\n el.attr('style', nodeStyles);\n }\n updateNodeBounds(node, el);\n }\n\n node.intersect = function (point) {\n return intersect.polygon(node, points, point);\n };\n\n return shapeSvg;\n};\n\nexport default subroutine;\n", "import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';\nimport intersect from '../intersect/index.js';\nimport type { Node } from '$root/rendering-util/types.d.ts';\nimport {\n styles2String,\n userNodeOverrides,\n} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';\nimport rough from 'roughjs';\n\nexport const createCylinderPathD = (\n x: number,\n y: number,\n width: number,\n height: number,\n rx: number,\n ry: number\n): string => {\n return [\n `M${x},${y + ry}`,\n `a${rx},${ry} 0,0,0 ${width},0`,\n `a${rx},${ry} 0,0,0 ${-width},0`,\n `l0,${height}`,\n `a${rx},${ry} 0,0,0 ${width},0`,\n `l0,${-height}`,\n ].join(' ');\n};\nexport const createOuterCylinderPathD = (\n x: number,\n y: number,\n width: number,\n height: number,\n rx: number,\n ry: number\n): string => {\n return [\n `M${x},${y + ry}`,\n `M${x + width},${y + ry}`,\n `a${rx},${ry} 0,0,0 ${-width},0`,\n `l0,${height}`,\n `a${rx},${ry} 0,0,0 ${width},0`,\n `l0,${-height}`,\n ].join(' ');\n};\nexport const createInnerCylinderPathD = (\n x: number,\n y: number,\n width: number,\n height: number,\n rx: number,\n ry: number\n): string => {\n return [`M${x - width / 2},${-height / 2}`, `a${rx},${ry} 0,0,0 ${width},0`].join(' ');\n};\nexport const cylinder = async (parent: SVGAElement, node: Node) => {\n const { labelStyles, nodeStyles } = styles2String(node);\n node.labelStyle = labelStyles;\n const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));\n const w = bbox.width + node.padding;\n const rx = w / 2;\n const ry = rx / (2.5 + w / 50);\n const h = bbox.height + ry + node.padding;\n\n let cylinder: d3.Selection;\n const { cssStyles } = node;\n\n if (node.look === 'handDrawn') {\n // @ts-ignore - rough is not typed\n const rc = rough.svg(shapeSvg);\n const outerPathData = createOuterCylinderPathD(0, 0, w, h, rx, ry);\n const innerPathData = createInnerCylinderPathD(0, ry, w, h, rx, ry);\n const outerNode = rc.path(outerPathData, userNodeOverrides(node, {}));\n const innerLine = rc.path(innerPathData, userNodeOverrides(node, { fill: 'none' }));\n\n cylinder = shapeSvg.insert(() => innerLine, ':first-child');\n cylinder = shapeSvg.insert(() => outerNode, ':first-child');\n cylinder.attr('class', 'basic label-container');\n if (cssStyles) {\n cylinder.attr('style', cssStyles);\n }\n } else {\n const pathData = createCylinderPathD(0, 0, w, h, rx, ry);\n cylinder = shapeSvg\n .insert('path', ':first-child')\n .attr('d', pathData)\n .attr('class', 'basic label-container')\n .attr('style', cssStyles)\n .attr('style', nodeStyles);\n }\n\n cylinder.attr('label-offset-y', ry);\n cylinder.attr('transform', `translate(${-w / 2}, ${-(h / 2 + ry)})`);\n\n updateNodeBounds(node, cylinder);\n\n node.intersect = function (point) {\n const pos = intersect.rect(node, point);\n const x = pos.x - (node.x ?? 0);\n\n if (\n rx != 0 &&\n (Math.abs(x) < (node.width ?? 0) / 2 ||\n (Math.abs(x) == (node.width ?? 0) / 2 &&\n Math.abs(pos.y - (node.y ?? 0)) > (node.height ?? 0) / 2 - ry))\n ) {\n let y = ry * ry * (1 - (x * x) / (rx * rx));\n if (y > 0) {\n y = Math.sqrt(y);\n }\n y = ry - y;\n if (point.y - (node.y ?? 0) > 0) {\n y = -y;\n }\n\n pos.y += y;\n }\n\n return pos;\n };\n\n return shapeSvg;\n};\n", "import { log } from '$root/logger.js';\nimport { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';\nimport intersect from '../intersect/index.js';\nimport type { Node } from '$root/rendering-util/types.d.ts';\nimport {\n styles2String,\n userNodeOverrides,\n} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';\nimport rough from 'roughjs';\n\nexport const circle = async (parent: SVGAElement, node: Node): Promise => {\n const { labelStyles, nodeStyles } = styles2String(node);\n node.labelStyle = labelStyles;\n const { shapeSvg, bbox, halfPadding } = await labelHelper(parent, node, getNodeClasses(node));\n\n const radius = bbox.width / 2 + halfPadding;\n let circleElem;\n const { cssStyles } = node;\n\n if (node.look === 'handDrawn') {\n // @ts-ignore - rough is not typed\n const rc = rough.svg(shapeSvg);\n const options = userNodeOverrides(node, {});\n const roughNode = rc.circle(0, 0, radius * 2, options);\n\n circleElem = shapeSvg.insert(() => roughNode, ':first-child');\n circleElem.attr('class', 'basic label-container').attr('style', cssStyles);\n } else {\n circleElem = shapeSvg\n .insert('circle', ':first-child')\n .attr('class', 'basic label-container')\n .attr('style', nodeStyles)\n .attr('r', radius)\n .attr('cx', 0)\n .attr('cy', 0);\n }\n\n updateNodeBounds(node, circleElem);\n\n node.intersect = function (point) {\n log.info('Circle intersect', node, radius, point);\n return intersect.circle(node, radius, point);\n };\n\n return shapeSvg;\n};\n", "import { log } from '$root/logger.js';\nimport { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';\nimport intersect from '../intersect/index.js';\nimport type { Node } from '$root/rendering-util/types.d.ts';\nimport {\n styles2String,\n userNodeOverrides,\n} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';\nimport rough from 'roughjs';\n\nexport const doublecircle = async (parent: SVGAElement, node: Node): Promise => {\n const { labelStyles, nodeStyles } = styles2String(node);\n node.labelStyle = labelStyles;\n const { shapeSvg, bbox, halfPadding } = await labelHelper(parent, node, getNodeClasses(node));\n const gap = 5;\n const outerRadius = bbox.width / 2 + halfPadding + gap;\n const innerRadius = bbox.width / 2 + halfPadding;\n\n let circleGroup;\n const { cssStyles } = node;\n\n if (node.look === 'handDrawn') {\n // @ts-ignore - rough is not typed\n const rc = rough.svg(shapeSvg);\n const outerOptions = userNodeOverrides(node, { roughness: 0.2, strokeWidth: 2.5 });\n\n const innerOptions = userNodeOverrides(node, { roughness: 0.2, strokeWidth: 1.5 });\n const outerRoughNode = rc.circle(0, 0, outerRadius * 2, outerOptions);\n const innerRoughNode = rc.circle(0, 0, innerRadius * 2, innerOptions);\n\n circleGroup = shapeSvg.insert('g', ':first-child');\n // circleGroup = circleGroup.insert(() => outerRoughNode, ':first-child');\n circleGroup.attr('class', node.cssClasses).attr('style', cssStyles);\n\n circleGroup.node()?.appendChild(outerRoughNode);\n circleGroup.node()?.appendChild(innerRoughNode);\n } else {\n circleGroup = shapeSvg.insert('g', ':first-child');\n\n const outerCircle = circleGroup.insert('circle', ':first-child');\n const innerCircle = circleGroup.insert('circle');\n circleGroup.attr('class', 'basic label-container').attr('style', nodeStyles);\n\n outerCircle\n .attr('class', 'outer-circle')\n .attr('style', nodeStyles)\n .attr('r', outerRadius)\n .attr('cx', 0)\n .attr('cy', 0);\n\n innerCircle\n .attr('class', 'inner-circle')\n .attr('style', nodeStyles)\n .attr('r', innerRadius)\n .attr('cx', 0)\n .attr('cy', 0);\n }\n\n updateNodeBounds(node, circleGroup);\n\n node.intersect = function (point) {\n log.info('DoubleCircle intersect', node, outerRadius, point);\n return intersect.circle(node, outerRadius, point);\n };\n\n return shapeSvg;\n};\n", "import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';\nimport intersect from '../intersect/index.js';\nimport type { Node } from '$root/rendering-util/types.d.ts';\nimport {\n styles2String,\n userNodeOverrides,\n} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';\nimport rough from 'roughjs';\nimport { insertPolygonShape } from './insertPolygonShape.js';\n\nexport const createPolygonPathD = (x: number, y: number, width: number, height: number): string => {\n return [\n `M${x - height / 2},${y}`,\n `L${x + width},${y}`,\n `L${x + width},${y - height}`,\n `L${x - height / 2},${y - height}`,\n `L${x},${y - height / 2}`,\n 'Z',\n ].join(' ');\n};\n\nexport const rect_left_inv_arrow = async (\n parent: SVGAElement,\n node: Node\n): Promise => {\n const { labelStyles, nodeStyles } = styles2String(node);\n node.labelStyle = labelStyles;\n const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));\n\n const w = bbox.width + node.padding;\n const h = bbox.height + node.padding;\n const points = [\n { x: -h / 2, y: 0 },\n { x: w, y: 0 },\n { x: w, y: -h },\n { x: -h / 2, y: -h },\n { x: 0, y: -h / 2 },\n ];\n\n let polygon;\n const { cssStyles } = node;\n\n if (node.look === 'handDrawn') {\n // @ts-ignore - rough is not typed\n const rc = rough.svg(shapeSvg);\n const options = userNodeOverrides(node, {});\n const pathData = createPolygonPathD(0, 0, w, h);\n const roughNode = rc.path(pathData, options);\n\n polygon = shapeSvg\n .insert(() => roughNode, ':first-child')\n .attr('transform', `translate(${-w / 2}, ${h / 2})`);\n if (cssStyles) {\n polygon.attr('style', cssStyles);\n }\n } else {\n polygon = insertPolygonShape(shapeSvg, w, h, points);\n }\n\n if (nodeStyles) {\n polygon.attr('style', nodeStyles);\n }\n node.width = w + h;\n node.height = h;\n\n updateNodeBounds(node, polygon);\n\n node.intersect = function (point) {\n return intersect.polygon(node, points, point);\n };\n\n return shapeSvg;\n};\n", "import { log } from '$root/logger.js';\nimport { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';\nimport intersect from '../intersect/index.js';\nimport type { Node } from '$root/rendering-util/types.d.ts';\nimport {\n styles2String,\n userNodeOverrides,\n} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';\nimport rough from 'roughjs';\nimport { insertPolygonShape } from './insertPolygonShape.js';\n\nexport const createDecisionBoxPathD = (x: number, y: number, size: number): string => {\n return [\n `M${x + size / 2},${y}`,\n `L${x + size},${y - size / 2}`,\n `L${x + size / 2},${y - size}`,\n `L${x},${y - size / 2}`,\n 'Z',\n ].join(' ');\n};\n\nexport const question = async (parent: SVGAElement, node: Node): Promise => {\n const { labelStyles, nodeStyles } = styles2String(node);\n node.labelStyle = labelStyles;\n const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));\n\n const w = bbox.width + node.padding;\n const h = bbox.height + node.padding;\n const s = w + h;\n\n const points = [\n { x: s / 2, y: 0 },\n { x: s, y: -s / 2 },\n { x: s / 2, y: -s },\n { x: 0, y: -s / 2 },\n ];\n\n let polygon: d3.Selection;\n const { cssStyles } = node;\n\n if (node.look === 'handDrawn') {\n // @ts-ignore - rough is not typed\n const rc = rough.svg(shapeSvg);\n const options = userNodeOverrides(node, {});\n const pathData = createDecisionBoxPathD(0, 0, s);\n const roughNode = rc.path(pathData, options);\n\n polygon = shapeSvg\n .insert(() => roughNode, ':first-child')\n .attr('transform', `translate(${-s / 2}, ${s / 2})`);\n\n if (cssStyles) {\n polygon.attr('style', cssStyles);\n }\n } else {\n polygon = insertPolygonShape(shapeSvg, s, s, points);\n }\n\n if (nodeStyles) {\n polygon.attr('style', nodeStyles);\n }\n\n updateNodeBounds(node, polygon);\n\n node.intersect = function (point) {\n log.debug(\n 'APA12 Intersect called SPLIT\\npoint:',\n point,\n '\\nnode:\\n',\n node,\n '\\nres:',\n intersect.polygon(node, points, point)\n );\n return intersect.polygon(node, points, point);\n };\n\n return shapeSvg;\n};\n", "import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';\nimport intersect from '../intersect/index.js';\nimport type { Node } from '$root/rendering-util/types.d.ts';\nimport {\n styles2String,\n userNodeOverrides,\n} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';\nimport rough from 'roughjs';\n\nimport { insertPolygonShape } from './insertPolygonShape.js';\n\nexport const createHexagonPathD = (\n x: number,\n y: number,\n width: number,\n height: number,\n m: number\n): string => {\n return [\n `M${x + m},${y}`,\n `L${x + width - m},${y}`,\n `L${x + width},${y - height / 2}`,\n `L${x + width - m},${y - height}`,\n `L${x + m},${y - height}`,\n `L${x},${y - height / 2}`,\n 'Z',\n ].join(' ');\n};\n\nexport const hexagon = async (parent: SVGAElement, node: Node): Promise => {\n const { labelStyles, nodeStyles } = styles2String(node);\n node.labelStyle = labelStyles;\n const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));\n\n const f = 4;\n const h = bbox.height + node.padding;\n const m = h / f;\n const w = bbox.width + 2 * m + node.padding;\n const points = [\n { x: m, y: 0 },\n { x: w - m, y: 0 },\n { x: w, y: -h / 2 },\n { x: w - m, y: -h },\n { x: m, y: -h },\n { x: 0, y: -h / 2 },\n ];\n\n let polygon: d3.Selection;\n const { cssStyles } = node;\n\n if (node.look === 'handDrawn') {\n // @ts-ignore - rough is not typed\n const rc = rough.svg(shapeSvg);\n const options = userNodeOverrides(node, {});\n const pathData = createHexagonPathD(0, 0, w, h, m);\n const roughNode = rc.path(pathData, options);\n\n polygon = shapeSvg\n .insert(() => roughNode, ':first-child')\n .attr('transform', `translate(${-w / 2}, ${h / 2})`);\n\n if (cssStyles) {\n polygon.attr('style', cssStyles);\n }\n } else {\n polygon = insertPolygonShape(shapeSvg, w, h, points);\n }\n\n if (nodeStyles) {\n polygon.attr('style', nodeStyles);\n }\n\n node.width = w;\n node.height = h;\n\n updateNodeBounds(node, polygon);\n\n node.intersect = function (point) {\n return intersect.polygon(node, points, point);\n };\n\n return shapeSvg;\n};\n", "import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';\nimport intersect from '../intersect/index.js';\nimport type { Node } from '$root/rendering-util/types.d.ts';\nimport {\n styles2String,\n userNodeOverrides,\n} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';\nimport rough from 'roughjs';\nimport { insertPolygonShape } from './insertPolygonShape.js';\n\nexport const createLeanRightPathD = (\n x: number,\n y: number,\n width: number,\n height: number\n): string => {\n return [\n `M${x - (2 * height) / 6},${y}`,\n `L${x + width - height / 6},${y}`,\n `L${x + width + (2 * height) / 6},${y - height}`,\n `L${x + height / 6},${y - height}`,\n 'Z',\n ].join(' ');\n};\n\nexport const lean_right = async (parent: SVGAElement, node: Node): Promise => {\n const { labelStyles, nodeStyles } = styles2String(node);\n node.labelStyle = labelStyles;\n const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));\n\n const w = bbox.width + node.padding;\n const h = bbox.height + node.padding;\n const points = [\n { x: (-2 * h) / 6, y: 0 },\n { x: w - h / 6, y: 0 },\n { x: w + (2 * h) / 6, y: -h },\n { x: h / 6, y: -h },\n ];\n\n let polygon: d3.Selection;\n const { cssStyles } = node;\n\n if (node.look === 'handDrawn') {\n // @ts-ignore - rough is not typed\n const rc = rough.svg(shapeSvg);\n const options = userNodeOverrides(node, {});\n const pathData = createLeanRightPathD(0, 0, w, h);\n const roughNode = rc.path(pathData, options);\n\n polygon = shapeSvg\n .insert(() => roughNode, ':first-child')\n .attr('transform', `translate(${-w / 2}, ${h / 2})`);\n\n if (cssStyles) {\n polygon.attr('style', cssStyles);\n }\n } else {\n polygon = insertPolygonShape(shapeSvg, w, h, points);\n }\n\n if (nodeStyles) {\n polygon.attr('style', nodeStyles);\n }\n\n node.width = w;\n node.height = h;\n\n updateNodeBounds(node, polygon);\n\n node.intersect = function (point) {\n return intersect.polygon(node, points, point);\n };\n\n return shapeSvg;\n};\n", "import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';\nimport intersect from '../intersect/index.js';\nimport type { Node } from '$root/rendering-util/types.d.ts';\nimport {\n styles2String,\n userNodeOverrides,\n} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';\nimport rough from 'roughjs';\nimport { insertPolygonShape } from './insertPolygonShape.js';\n\nexport const createLeanLeftPathD = (\n x: number,\n y: number,\n width: number,\n height: number\n): string => {\n return [\n `M${x + (2 * height) / 6},${y}`,\n `L${x + width + height / 6},${y}`,\n `L${x + width - (2 * height) / 6},${y - height}`,\n `L${x - height / 6},${y - height}`,\n 'Z',\n ].join(' ');\n};\n\nexport const lean_left = async (parent: SVGAElement, node: Node): Promise => {\n const { labelStyles, nodeStyles } = styles2String(node);\n node.labelStyle = labelStyles;\n const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));\n\n const w = bbox.width + node.padding;\n const h = bbox.height + node.padding;\n const points = [\n { x: (2 * h) / 6, y: 0 },\n { x: w + h / 6, y: 0 },\n { x: w - (2 * h) / 6, y: -h },\n { x: -h / 6, y: -h },\n ];\n\n let polygon: d3.Selection;\n const { cssStyles } = node;\n\n if (node.look === 'handDrawn') {\n // @ts-ignore - rough is not typed\n const rc = rough.svg(shapeSvg);\n const options = userNodeOverrides(node, {});\n const pathData = createLeanLeftPathD(0, 0, w, h);\n const roughNode = rc.path(pathData, options);\n\n polygon = shapeSvg\n .insert(() => roughNode, ':first-child')\n .attr('transform', `translate(${-w / 2}, ${h / 2})`);\n\n if (cssStyles) {\n polygon.attr('style', cssStyles);\n }\n } else {\n polygon = insertPolygonShape(shapeSvg, w, h, points);\n }\n\n if (nodeStyles) {\n polygon.attr('style', nodeStyles);\n }\n\n node.width = w;\n node.height = h;\n\n updateNodeBounds(node, polygon);\n\n node.intersect = function (point) {\n return intersect.polygon(node, points, point);\n };\n\n return shapeSvg;\n};\n", "import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';\nimport intersect from '../intersect/index.js';\nimport type { Node } from '$root/rendering-util/types.d.ts';\nimport {\n styles2String,\n userNodeOverrides,\n} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';\nimport rough from 'roughjs';\nimport { insertPolygonShape } from './insertPolygonShape.js';\n\nexport const createTrapezoidPathD = (\n x: number,\n y: number,\n width: number,\n height: number\n): string => {\n return [\n `M${x - (2 * height) / 6},${y}`,\n `L${x + width + (2 * height) / 6},${y}`,\n `L${x + width - height / 6},${y - height}`,\n `L${x + height / 6},${y - height}`,\n 'Z',\n ].join(' ');\n};\n\nexport const trapezoid = async (parent: SVGAElement, node: Node): Promise => {\n const { labelStyles, nodeStyles } = styles2String(node);\n node.labelStyle = labelStyles;\n const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));\n\n const w = bbox.width + node.padding;\n const h = bbox.height + node.padding;\n const points = [\n { x: (-2 * h) / 6, y: 0 },\n { x: w + (2 * h) / 6, y: 0 },\n { x: w - h / 6, y: -h },\n { x: h / 6, y: -h },\n ];\n\n let polygon: d3.Selection;\n const { cssStyles } = node;\n\n if (node.look === 'handDrawn') {\n // @ts-ignore - rough is not typed\n const rc = rough.svg(shapeSvg);\n const options = userNodeOverrides(node, {});\n const pathData = createTrapezoidPathD(0, 0, w, h);\n const roughNode = rc.path(pathData, options);\n\n polygon = shapeSvg\n .insert(() => roughNode, ':first-child')\n .attr('transform', `translate(${-w / 2}, ${h / 2})`);\n\n if (cssStyles) {\n polygon.attr('style', cssStyles);\n }\n } else {\n polygon = insertPolygonShape(shapeSvg, w, h, points);\n }\n\n if (nodeStyles) {\n polygon.attr('style', nodeStyles);\n }\n\n node.width = w;\n node.height = h;\n\n updateNodeBounds(node, polygon);\n\n node.intersect = function (point) {\n return intersect.polygon(node, points, point);\n };\n\n return shapeSvg;\n};\n", "import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';\nimport intersect from '../intersect/index.js';\nimport type { Node } from '$root/rendering-util/types.d.ts';\nimport {\n styles2String,\n userNodeOverrides,\n} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';\nimport rough from 'roughjs';\nimport { insertPolygonShape } from './insertPolygonShape.js';\n\nexport const createInvertedTrapezoidPathD = (\n x: number,\n y: number,\n width: number,\n height: number\n): string => {\n return [\n `M${x + height / 6},${y}`,\n `L${x + width - height / 6},${y}`,\n `L${x + width + (2 * height) / 6},${y - height}`,\n `L${x - (2 * height) / 6},${y - height}`,\n 'Z',\n ].join(' ');\n};\n\nexport const inv_trapezoid = async (parent: SVGAElement, node: Node): Promise => {\n const { labelStyles, nodeStyles } = styles2String(node);\n node.labelStyle = labelStyles;\n const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));\n\n const w = bbox.width + node.padding;\n const h = bbox.height + node.padding;\n const points = [\n { x: h / 6, y: 0 },\n { x: w - h / 6, y: 0 },\n { x: w + (2 * h) / 6, y: -h },\n { x: (-2 * h) / 6, y: -h },\n ];\n\n let polygon: d3.Selection;\n const { cssStyles } = node;\n\n if (node.look === 'handDrawn') {\n // @ts-ignore - rough is not typed\n const rc = rough.svg(shapeSvg);\n const options = userNodeOverrides(node, {});\n const pathData = createInvertedTrapezoidPathD(0, 0, w, h);\n const roughNode = rc.path(pathData, options);\n\n polygon = shapeSvg\n .insert(() => roughNode, ':first-child')\n .attr('transform', `translate(${-w / 2}, ${h / 2})`);\n\n if (cssStyles) {\n polygon.attr('style', cssStyles);\n }\n } else {\n polygon = insertPolygonShape(shapeSvg, w, h, points);\n }\n\n if (nodeStyles) {\n polygon.attr('style', nodeStyles);\n }\n\n node.width = w;\n node.height = h;\n\n updateNodeBounds(node, polygon);\n\n node.intersect = function (point) {\n return intersect.polygon(node, points, point);\n };\n\n return shapeSvg;\n};\n", "import type { Node, RectOptions } from '$root/rendering-util/types.d.ts';\nimport { drawRect } from './drawRect.js';\nimport { labelHelper, updateNodeBounds } from './util.js';\nimport intersect from '../intersect/index.js';\n\nexport const roundedRect = async (parent: SVGAElement, node: Node) => {\n const options = {\n rx: 5,\n ry: 5,\n classes: '',\n labelPaddingX: (node?.padding || 0) * 1,\n labelPaddingY: (node?.padding || 0) * 1,\n } as RectOptions;\n\n return drawRect(parent, node, options);\n};\n\nexport const labelRect = async (parent: SVGElement, node: Node) => {\n const { shapeSvg } = await labelHelper(parent, node, 'label');\n\n // log.trace('Classes = ', node.class);\n // add the rect\n const rect = shapeSvg.insert('rect', ':first-child');\n\n // Hide the rect we are only after the label\n const totalWidth = 0.1;\n const totalHeight = 0.1;\n rect.attr('width', totalWidth).attr('height', totalHeight);\n shapeSvg.attr('class', 'label edgeLabel');\n\n // if (node.props) {\n // const propKeys = new Set(Object.keys(node.props));\n // if (node.props.borders) {\n // applyNodePropertyBorders(rect, node.borders, totalWidth, totalHeight);\n // propKeys.delete('borders');\n // }\n // propKeys.forEach((propKey) => {\n // log.warn(`Unknown node property ${propKey}`);\n // });\n // }\n\n updateNodeBounds(node, rect);\n // node.width = 1;\n // node.height = 1;\n\n node.intersect = function (point) {\n return intersect.rect(node, point);\n };\n\n return shapeSvg;\n};\n", "import { log } from '$root/logger.js';\nimport { state } from './shapes/state.ts';\nimport { roundedRect } from './shapes/roundedRect.ts';\nimport { squareRect } from './shapes/squareRect.ts';\nimport { stateStart } from './shapes/stateStart.ts';\nimport { stateEnd } from './shapes/stateEnd.ts';\nimport { forkJoin } from './shapes/forkJoin.ts';\nimport { choice } from './shapes/choice.ts';\nimport { note } from './shapes/note.ts';\nimport { stadium } from './shapes/stadium.js';\nimport { rectWithTitle } from './shapes/rectWithTitle.js';\nimport { getConfig } from '$root/diagram-api/diagramAPI.js';\nimport { subroutine } from './shapes/subroutine.js';\nimport { cylinder } from './shapes/cylinder.js';\nimport { circle } from './shapes/circle.js';\nimport { doublecircle } from './shapes/doubleCircle.js';\nimport { rect_left_inv_arrow } from './shapes/rectLeftInvArrow.js';\nimport { question } from './shapes/question.js';\nimport { hexagon } from './shapes/hexagon.js';\nimport { lean_right } from './shapes/leanRight.js';\nimport { lean_left } from './shapes/leanLeft.js';\nimport { trapezoid } from './shapes/trapezoid.js';\nimport { inv_trapezoid } from './shapes/invertedTrapezoid.js';\nimport { labelRect } from './shapes/labelRect.js';\n\nconst shapes = {\n state,\n stateStart,\n stateEnd,\n fork: forkJoin,\n join: forkJoin,\n choice,\n note,\n roundedRect,\n rectWithTitle,\n squareRect,\n stadium,\n subroutine,\n cylinder,\n circle,\n doublecircle,\n odd: rect_left_inv_arrow,\n diamond: question,\n hexagon,\n lean_right,\n lean_left,\n trapezoid,\n inv_trapezoid,\n labelRect,\n};\n\nconst nodeElems = new Map();\n\nexport const insertNode = async (elem, node, dir) => {\n let newEl;\n let el;\n\n //special check for rect shape (with or without rounded corners)\n if (node.shape === 'rect') {\n if (node.rx && node.ry) {\n node.shape = 'roundedRect';\n } else {\n node.shape = 'squareRect';\n }\n }\n\n // Add link when appropriate\n if (node.link) {\n let target;\n if (getConfig().securityLevel === 'sandbox') {\n target = '_top';\n } else if (node.linkTarget) {\n target = node.linkTarget || '_blank';\n }\n newEl = elem.insert('svg:a').attr('xlink:href', node.link).attr('target', target);\n el = await shapes[node.shape](newEl, node, dir);\n } else {\n el = await shapes[node.shape](elem, node, dir);\n newEl = el;\n }\n if (node.tooltip) {\n el.attr('title', node.tooltip);\n }\n\n nodeElems.set(node.id, newEl);\n\n if (node.haveCallback) {\n nodeElems.get(node.id).attr('class', nodeElems.get(node.id).attr('class') + ' clickable');\n }\n return newEl;\n};\nexport const setNodeElem = (elem, node) => {\n nodeElems.set(node.id, elem);\n};\nexport const clear = () => {\n nodeElems.clear();\n};\n\nexport const positionNode = (node) => {\n const el = nodeElems.get(node.id);\n log.trace(\n 'Transforming node',\n node.diff,\n node,\n 'translate(' + (node.x - node.width / 2 - 5) + ', ' + node.width / 2 + ')'\n );\n const padding = 8;\n const diff = node.diff || 0;\n if (node.clusterNode) {\n el.attr(\n 'transform',\n 'translate(' +\n (node.x + diff - node.width / 2) +\n ', ' +\n (node.y - node.height / 2 - padding) +\n ')'\n );\n } else {\n el.attr('transform', 'translate(' + node.x + ', ' + node.y + ')');\n }\n return diff;\n};\n", "import { getConfig } from './config.js';\nimport common from './diagrams/common/common.js';\nimport { log } from './logger.js';\nimport { insertCluster } from './rendering-util/rendering-elements/clusters.js';\nimport {\n insertEdge,\n insertEdgeLabel,\n positionEdgeLabel,\n} from './rendering-util/rendering-elements/edges.js';\nimport insertMarkers from './rendering-util/rendering-elements/markers.js';\nimport { insertNode } from './rendering-util/rendering-elements/nodes.js';\nimport { labelHelper } from './rendering-util/rendering-elements/shapes/util.js';\nimport { interpolateToCurve } from './utils.js';\n\n/**\n * Internal helpers for mermaid\n * @deprecated - This should not be used by external packages, as the definitions will change without notice.\n */\nexport const internalHelpers = {\n common,\n getConfig,\n insertCluster,\n insertEdge,\n insertEdgeLabel,\n insertMarkers,\n insertNode,\n interpolateToCurve,\n labelHelper,\n log,\n positionEdgeLabel,\n};\n\nexport type InternalHelpers = typeof internalHelpers;\n", "import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nexport default isSymbol;\n", "/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nexport default arrayMap;\n", "import Symbol from './_Symbol.js';\nimport arrayMap from './_arrayMap.js';\nimport isArray from './isArray.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n/**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nexport default baseToString;\n", "/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nexport default trimmedEndIndex;\n", "import trimmedEndIndex from './_trimmedEndIndex.js';\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nexport default baseTrim;\n", "import baseTrim from './_baseTrim.js';\nimport isObject from './isObject.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nexport default toNumber;\n", "import toNumber from './toNumber.js';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0,\n MAX_INTEGER = 1.7976931348623157e+308;\n\n/**\n * Converts `value` to a finite number.\n *\n * @static\n * @memberOf _\n * @since 4.12.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted number.\n * @example\n *\n * _.toFinite(3.2);\n * // => 3.2\n *\n * _.toFinite(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toFinite(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toFinite('3.2');\n * // => 3.2\n */\nfunction toFinite(value) {\n if (!value) {\n return value === 0 ? value : 0;\n }\n value = toNumber(value);\n if (value === INFINITY || value === -INFINITY) {\n var sign = (value < 0 ? -1 : 1);\n return sign * MAX_INTEGER;\n }\n return value === value ? value : 0;\n}\n\nexport default toFinite;\n", "import toFinite from './toFinite.js';\n\n/**\n * Converts `value` to an integer.\n *\n * **Note:** This method is loosely based on\n * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3.2);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3.2');\n * // => 3\n */\nfunction toInteger(value) {\n var result = toFinite(value),\n remainder = result % 1;\n\n return result === result ? (remainder ? result - remainder : result) : 0;\n}\n\nexport default toInteger;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar WeakMap = getNative(root, 'WeakMap');\n\nexport default WeakMap;\n", "/**\n * This method returns `undefined`.\n *\n * @static\n * @memberOf _\n * @since 2.3.0\n * @category Util\n * @example\n *\n * _.times(2, _.noop);\n * // => [undefined, undefined]\n */\nfunction noop() {\n // No operation performed.\n}\n\nexport default noop;\n", "/**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\nfunction arrayEach(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n}\n\nexport default arrayEach;\n", "/**\n * The base implementation of `_.findIndex` and `_.findLastIndex` without\n * support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} predicate The function invoked per iteration.\n * @param {number} fromIndex The index to search from.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction baseFindIndex(array, predicate, fromIndex, fromRight) {\n var length = array.length,\n index = fromIndex + (fromRight ? 1 : -1);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (predicate(array[index], index, array)) {\n return index;\n }\n }\n return -1;\n}\n\nexport default baseFindIndex;\n", "/**\n * The base implementation of `_.isNaN` without support for number objects.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\n */\nfunction baseIsNaN(value) {\n return value !== value;\n}\n\nexport default baseIsNaN;\n", "/**\n * A specialized version of `_.indexOf` which performs strict equality\n * comparisons of values, i.e. `===`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction strictIndexOf(array, value, fromIndex) {\n var index = fromIndex - 1,\n length = array.length;\n\n while (++index < length) {\n if (array[index] === value) {\n return index;\n }\n }\n return -1;\n}\n\nexport default strictIndexOf;\n", "import baseFindIndex from './_baseFindIndex.js';\nimport baseIsNaN from './_baseIsNaN.js';\nimport strictIndexOf from './_strictIndexOf.js';\n\n/**\n * The base implementation of `_.indexOf` without `fromIndex` bounds checks.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction baseIndexOf(array, value, fromIndex) {\n return value === value\n ? strictIndexOf(array, value, fromIndex)\n : baseFindIndex(array, baseIsNaN, fromIndex);\n}\n\nexport default baseIndexOf;\n", "import baseIndexOf from './_baseIndexOf.js';\n\n/**\n * A specialized version of `_.includes` for arrays without support for\n * specifying an index to search from.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\nfunction arrayIncludes(array, value) {\n var length = array == null ? 0 : array.length;\n return !!length && baseIndexOf(array, value, 0) > -1;\n}\n\nexport default arrayIncludes;\n", "import overArg from './_overArg.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nexport default nativeKeys;\n", "import isPrototype from './_isPrototype.js';\nimport nativeKeys from './_nativeKeys.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default baseKeys;\n", "import arrayLikeKeys from './_arrayLikeKeys.js';\nimport baseKeys from './_baseKeys.js';\nimport isArrayLike from './isArrayLike.js';\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nexport default keys;\n", "import assignValue from './_assignValue.js';\nimport copyObject from './_copyObject.js';\nimport createAssigner from './_createAssigner.js';\nimport isArrayLike from './isArrayLike.js';\nimport isPrototype from './_isPrototype.js';\nimport keys from './keys.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Assigns own enumerable string keyed properties of source objects to the\n * destination object. Source objects are applied from left to right.\n * Subsequent sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object` and is loosely based on\n * [`Object.assign`](https://mdn.io/Object/assign).\n *\n * @static\n * @memberOf _\n * @since 0.10.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.assignIn\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * function Bar() {\n * this.c = 3;\n * }\n *\n * Foo.prototype.b = 2;\n * Bar.prototype.d = 4;\n *\n * _.assign({ 'a': 0 }, new Foo, new Bar);\n * // => { 'a': 1, 'c': 3 }\n */\nvar assign = createAssigner(function(object, source) {\n if (isPrototype(source) || isArrayLike(source)) {\n copyObject(source, keys(source), object);\n return;\n }\n for (var key in source) {\n if (hasOwnProperty.call(source, key)) {\n assignValue(object, key, source[key]);\n }\n }\n});\n\nexport default assign;\n", "import isArray from './isArray.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used to match property names within property paths. */\nvar reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/;\n\n/**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\nfunction isKey(value, object) {\n if (isArray(value)) {\n return false;\n }\n var type = typeof value;\n if (type == 'number' || type == 'symbol' || type == 'boolean' ||\n value == null || isSymbol(value)) {\n return true;\n }\n return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\n (object != null && value in Object(object));\n}\n\nexport default isKey;\n", "import memoize from './memoize.js';\n\n/** Used as the maximum memoize cache size. */\nvar MAX_MEMOIZE_SIZE = 500;\n\n/**\n * A specialized version of `_.memoize` which clears the memoized function's\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\nfunction memoizeCapped(func) {\n var result = memoize(func, function(key) {\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear();\n }\n return key;\n });\n\n var cache = result.cache;\n return result;\n}\n\nexport default memoizeCapped;\n", "import memoizeCapped from './_memoizeCapped.js';\n\n/** Used to match property names within property paths. */\nvar rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g;\n\n/** Used to match backslashes in property paths. */\nvar reEscapeChar = /\\\\(\\\\)?/g;\n\n/**\n * Converts `string` to a property path array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\nvar stringToPath = memoizeCapped(function(string) {\n var result = [];\n if (string.charCodeAt(0) === 46 /* . */) {\n result.push('');\n }\n string.replace(rePropName, function(match, number, quote, subString) {\n result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n});\n\nexport default stringToPath;\n", "import baseToString from './_baseToString.js';\n\n/**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n return value == null ? '' : baseToString(value);\n}\n\nexport default toString;\n", "import isArray from './isArray.js';\nimport isKey from './_isKey.js';\nimport stringToPath from './_stringToPath.js';\nimport toString from './toString.js';\n\n/**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\nfunction castPath(value, object) {\n if (isArray(value)) {\n return value;\n }\n return isKey(value, object) ? [value] : stringToPath(toString(value));\n}\n\nexport default castPath;\n", "import isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n */\nfunction toKey(value) {\n if (typeof value == 'string' || isSymbol(value)) {\n return value;\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nexport default toKey;\n", "import castPath from './_castPath.js';\nimport toKey from './_toKey.js';\n\n/**\n * The base implementation of `_.get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\nfunction baseGet(object, path) {\n path = castPath(path, object);\n\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[toKey(path[index++])];\n }\n return (index && index == length) ? object : undefined;\n}\n\nexport default baseGet;\n", "import baseGet from './_baseGet.js';\n\n/**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\nfunction get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, path);\n return result === undefined ? defaultValue : result;\n}\n\nexport default get;\n", "/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\nexport default arrayPush;\n", "import Symbol from './_Symbol.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\n\n/** Built-in value references. */\nvar spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;\n\n/**\n * Checks if `value` is a flattenable `arguments` object or array.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.\n */\nfunction isFlattenable(value) {\n return isArray(value) || isArguments(value) ||\n !!(spreadableSymbol && value && value[spreadableSymbol]);\n}\n\nexport default isFlattenable;\n", "import arrayPush from './_arrayPush.js';\nimport isFlattenable from './_isFlattenable.js';\n\n/**\n * The base implementation of `_.flatten` with support for restricting flattening.\n *\n * @private\n * @param {Array} array The array to flatten.\n * @param {number} depth The maximum recursion depth.\n * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.\n * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.\n * @param {Array} [result=[]] The initial result value.\n * @returns {Array} Returns the new flattened array.\n */\nfunction baseFlatten(array, depth, predicate, isStrict, result) {\n var index = -1,\n length = array.length;\n\n predicate || (predicate = isFlattenable);\n result || (result = []);\n\n while (++index < length) {\n var value = array[index];\n if (depth > 0 && predicate(value)) {\n if (depth > 1) {\n // Recursively flatten arrays (susceptible to call stack limits).\n baseFlatten(value, depth - 1, predicate, isStrict, result);\n } else {\n arrayPush(result, value);\n }\n } else if (!isStrict) {\n result[result.length] = value;\n }\n }\n return result;\n}\n\nexport default baseFlatten;\n", "import baseFlatten from './_baseFlatten.js';\n\n/**\n * Flattens `array` a single level deep.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flatten([1, [2, [3, [4]], 5]]);\n * // => [1, 2, [3, [4]], 5]\n */\nfunction flatten(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseFlatten(array, 1) : [];\n}\n\nexport default flatten;\n", "import flatten from './flatten.js';\nimport overRest from './_overRest.js';\nimport setToString from './_setToString.js';\n\n/**\n * A specialized version of `baseRest` which flattens the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @returns {Function} Returns the new function.\n */\nfunction flatRest(func) {\n return setToString(overRest(func, undefined, flatten), func + '');\n}\n\nexport default flatRest;\n", "/**\n * The base implementation of `_.slice` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\nfunction baseSlice(array, start, end) {\n var index = -1,\n length = array.length;\n\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = end > length ? length : end;\n if (end < 0) {\n end += length;\n }\n length = start > end ? 0 : ((end - start) >>> 0);\n start >>>= 0;\n\n var result = Array(length);\n while (++index < length) {\n result[index] = array[index + start];\n }\n return result;\n}\n\nexport default baseSlice;\n", "/** Used to compose unicode character classes. */\nvar rsAstralRange = '\\\\ud800-\\\\udfff',\n rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,\n rsVarRange = '\\\\ufe0e\\\\ufe0f';\n\n/** Used to compose unicode capture groups. */\nvar rsZWJ = '\\\\u200d';\n\n/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */\nvar reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');\n\n/**\n * Checks if `string` contains Unicode symbols.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {boolean} Returns `true` if a symbol is found, else `false`.\n */\nfunction hasUnicode(string) {\n return reHasUnicode.test(string);\n}\n\nexport default hasUnicode;\n", "/**\n * A specialized version of `_.reduce` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the first element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\nfunction arrayReduce(array, iteratee, accumulator, initAccum) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n if (initAccum && length) {\n accumulator = array[++index];\n }\n while (++index < length) {\n accumulator = iteratee(accumulator, array[index], index, array);\n }\n return accumulator;\n}\n\nexport default arrayReduce;\n", "import copyObject from './_copyObject.js';\nimport keys from './keys.js';\n\n/**\n * The base implementation of `_.assign` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssign(object, source) {\n return object && copyObject(source, keys(source), object);\n}\n\nexport default baseAssign;\n", "import copyObject from './_copyObject.js';\nimport keysIn from './keysIn.js';\n\n/**\n * The base implementation of `_.assignIn` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssignIn(object, source) {\n return object && copyObject(source, keysIn(source), object);\n}\n\nexport default baseAssignIn;\n", "/**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nexport default arrayFilter;\n", "/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\nexport default stubArray;\n", "import arrayFilter from './_arrayFilter.js';\nimport stubArray from './stubArray.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n};\n\nexport default getSymbols;\n", "import copyObject from './_copyObject.js';\nimport getSymbols from './_getSymbols.js';\n\n/**\n * Copies own symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbols(source, object) {\n return copyObject(source, getSymbols(source), object);\n}\n\nexport default copySymbols;\n", "import arrayPush from './_arrayPush.js';\nimport getPrototype from './_getPrototype.js';\nimport getSymbols from './_getSymbols.js';\nimport stubArray from './stubArray.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own and inherited enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {\n var result = [];\n while (object) {\n arrayPush(result, getSymbols(object));\n object = getPrototype(object);\n }\n return result;\n};\n\nexport default getSymbolsIn;\n", "import copyObject from './_copyObject.js';\nimport getSymbolsIn from './_getSymbolsIn.js';\n\n/**\n * Copies own and inherited symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbolsIn(source, object) {\n return copyObject(source, getSymbolsIn(source), object);\n}\n\nexport default copySymbolsIn;\n", "import arrayPush from './_arrayPush.js';\nimport isArray from './isArray.js';\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\nexport default baseGetAllKeys;\n", "import baseGetAllKeys from './_baseGetAllKeys.js';\nimport getSymbols from './_getSymbols.js';\nimport keys from './keys.js';\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\nexport default getAllKeys;\n", "import baseGetAllKeys from './_baseGetAllKeys.js';\nimport getSymbolsIn from './_getSymbolsIn.js';\nimport keysIn from './keysIn.js';\n\n/**\n * Creates an array of own and inherited enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeysIn(object) {\n return baseGetAllKeys(object, keysIn, getSymbolsIn);\n}\n\nexport default getAllKeysIn;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView');\n\nexport default DataView;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Promise = getNative(root, 'Promise');\n\nexport default Promise;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Set = getNative(root, 'Set');\n\nexport default Set;\n", "import DataView from './_DataView.js';\nimport Map from './_Map.js';\nimport Promise from './_Promise.js';\nimport Set from './_Set.js';\nimport WeakMap from './_WeakMap.js';\nimport baseGetTag from './_baseGetTag.js';\nimport toSource from './_toSource.js';\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n setTag = '[object Set]',\n weakMapTag = '[object WeakMap]';\n\nvar dataViewTag = '[object DataView]';\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\nexport default getTag;\n", "/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\nfunction initCloneArray(array) {\n var length = array.length,\n result = new array.constructor(length);\n\n // Add properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n}\n\nexport default initCloneArray;\n", "import cloneArrayBuffer from './_cloneArrayBuffer.js';\n\n/**\n * Creates a clone of `dataView`.\n *\n * @private\n * @param {Object} dataView The data view to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned data view.\n */\nfunction cloneDataView(dataView, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;\n return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);\n}\n\nexport default cloneDataView;\n", "/** Used to match `RegExp` flags from their coerced string values. */\nvar reFlags = /\\w*$/;\n\n/**\n * Creates a clone of `regexp`.\n *\n * @private\n * @param {Object} regexp The regexp to clone.\n * @returns {Object} Returns the cloned regexp.\n */\nfunction cloneRegExp(regexp) {\n var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));\n result.lastIndex = regexp.lastIndex;\n return result;\n}\n\nexport default cloneRegExp;\n", "import Symbol from './_Symbol.js';\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * Creates a clone of the `symbol` object.\n *\n * @private\n * @param {Object} symbol The symbol object to clone.\n * @returns {Object} Returns the cloned symbol object.\n */\nfunction cloneSymbol(symbol) {\n return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};\n}\n\nexport default cloneSymbol;\n", "import cloneArrayBuffer from './_cloneArrayBuffer.js';\nimport cloneDataView from './_cloneDataView.js';\nimport cloneRegExp from './_cloneRegExp.js';\nimport cloneSymbol from './_cloneSymbol.js';\nimport cloneTypedArray from './_cloneTypedArray.js';\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneByTag(object, tag, isDeep) {\n var Ctor = object.constructor;\n switch (tag) {\n case arrayBufferTag:\n return cloneArrayBuffer(object);\n\n case boolTag:\n case dateTag:\n return new Ctor(+object);\n\n case dataViewTag:\n return cloneDataView(object, isDeep);\n\n case float32Tag: case float64Tag:\n case int8Tag: case int16Tag: case int32Tag:\n case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n return cloneTypedArray(object, isDeep);\n\n case mapTag:\n return new Ctor;\n\n case numberTag:\n case stringTag:\n return new Ctor(object);\n\n case regexpTag:\n return cloneRegExp(object);\n\n case setTag:\n return new Ctor;\n\n case symbolTag:\n return cloneSymbol(object);\n }\n}\n\nexport default initCloneByTag;\n", "import getTag from './_getTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]';\n\n/**\n * The base implementation of `_.isMap` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n */\nfunction baseIsMap(value) {\n return isObjectLike(value) && getTag(value) == mapTag;\n}\n\nexport default baseIsMap;\n", "import baseIsMap from './_baseIsMap.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsMap = nodeUtil && nodeUtil.isMap;\n\n/**\n * Checks if `value` is classified as a `Map` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n * @example\n *\n * _.isMap(new Map);\n * // => true\n *\n * _.isMap(new WeakMap);\n * // => false\n */\nvar isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;\n\nexport default isMap;\n", "import getTag from './_getTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar setTag = '[object Set]';\n\n/**\n * The base implementation of `_.isSet` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n */\nfunction baseIsSet(value) {\n return isObjectLike(value) && getTag(value) == setTag;\n}\n\nexport default baseIsSet;\n", "import baseIsSet from './_baseIsSet.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsSet = nodeUtil && nodeUtil.isSet;\n\n/**\n * Checks if `value` is classified as a `Set` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n * @example\n *\n * _.isSet(new Set);\n * // => true\n *\n * _.isSet(new WeakSet);\n * // => false\n */\nvar isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;\n\nexport default isSet;\n", "import Stack from './_Stack.js';\nimport arrayEach from './_arrayEach.js';\nimport assignValue from './_assignValue.js';\nimport baseAssign from './_baseAssign.js';\nimport baseAssignIn from './_baseAssignIn.js';\nimport cloneBuffer from './_cloneBuffer.js';\nimport copyArray from './_copyArray.js';\nimport copySymbols from './_copySymbols.js';\nimport copySymbolsIn from './_copySymbolsIn.js';\nimport getAllKeys from './_getAllKeys.js';\nimport getAllKeysIn from './_getAllKeysIn.js';\nimport getTag from './_getTag.js';\nimport initCloneArray from './_initCloneArray.js';\nimport initCloneByTag from './_initCloneByTag.js';\nimport initCloneObject from './_initCloneObject.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isMap from './isMap.js';\nimport isObject from './isObject.js';\nimport isSet from './isSet.js';\nimport keys from './keys.js';\nimport keysIn from './keysIn.js';\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG = 1,\n CLONE_FLAT_FLAG = 2,\n CLONE_SYMBOLS_FLAG = 4;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values supported by `_.clone`. */\nvar cloneableTags = {};\ncloneableTags[argsTag] = cloneableTags[arrayTag] =\ncloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =\ncloneableTags[boolTag] = cloneableTags[dateTag] =\ncloneableTags[float32Tag] = cloneableTags[float64Tag] =\ncloneableTags[int8Tag] = cloneableTags[int16Tag] =\ncloneableTags[int32Tag] = cloneableTags[mapTag] =\ncloneableTags[numberTag] = cloneableTags[objectTag] =\ncloneableTags[regexpTag] = cloneableTags[setTag] =\ncloneableTags[stringTag] = cloneableTags[symbolTag] =\ncloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\ncloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\ncloneableTags[errorTag] = cloneableTags[funcTag] =\ncloneableTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n * traversed objects.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Deep clone\n * 2 - Flatten inherited properties\n * 4 - Clone symbols\n * @param {Function} [customizer] The function to customize cloning.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The parent object of `value`.\n * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n * @returns {*} Returns the cloned value.\n */\nfunction baseClone(value, bitmask, customizer, key, object, stack) {\n var result,\n isDeep = bitmask & CLONE_DEEP_FLAG,\n isFlat = bitmask & CLONE_FLAT_FLAG,\n isFull = bitmask & CLONE_SYMBOLS_FLAG;\n\n if (customizer) {\n result = object ? customizer(value, key, object, stack) : customizer(value);\n }\n if (result !== undefined) {\n return result;\n }\n if (!isObject(value)) {\n return value;\n }\n var isArr = isArray(value);\n if (isArr) {\n result = initCloneArray(value);\n if (!isDeep) {\n return copyArray(value, result);\n }\n } else {\n var tag = getTag(value),\n isFunc = tag == funcTag || tag == genTag;\n\n if (isBuffer(value)) {\n return cloneBuffer(value, isDeep);\n }\n if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n result = (isFlat || isFunc) ? {} : initCloneObject(value);\n if (!isDeep) {\n return isFlat\n ? copySymbolsIn(value, baseAssignIn(result, value))\n : copySymbols(value, baseAssign(result, value));\n }\n } else {\n if (!cloneableTags[tag]) {\n return object ? value : {};\n }\n result = initCloneByTag(value, tag, isDeep);\n }\n }\n // Check for circular references and return its corresponding clone.\n stack || (stack = new Stack);\n var stacked = stack.get(value);\n if (stacked) {\n return stacked;\n }\n stack.set(value, result);\n\n if (isSet(value)) {\n value.forEach(function(subValue) {\n result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));\n });\n } else if (isMap(value)) {\n value.forEach(function(subValue, key) {\n result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n }\n\n var keysFunc = isFull\n ? (isFlat ? getAllKeysIn : getAllKeys)\n : (isFlat ? keysIn : keys);\n\n var props = isArr ? undefined : keysFunc(value);\n arrayEach(props || value, function(subValue, key) {\n if (props) {\n key = subValue;\n subValue = value[key];\n }\n // Recursively populate clone (susceptible to call stack limits).\n assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n return result;\n}\n\nexport default baseClone;\n", "import baseClone from './_baseClone.js';\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_SYMBOLS_FLAG = 4;\n\n/**\n * Creates a shallow clone of `value`.\n *\n * **Note:** This method is loosely based on the\n * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)\n * and supports cloning arrays, array buffers, booleans, date objects, maps,\n * numbers, `Object` objects, regexes, sets, strings, symbols, and typed\n * arrays. The own enumerable properties of `arguments` objects are cloned\n * as plain objects. An empty object is returned for uncloneable values such\n * as error objects, functions, DOM nodes, and WeakMaps.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to clone.\n * @returns {*} Returns the cloned value.\n * @see _.cloneDeep\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var shallow = _.clone(objects);\n * console.log(shallow[0] === objects[0]);\n * // => true\n */\nfunction clone(value) {\n return baseClone(value, CLONE_SYMBOLS_FLAG);\n}\n\nexport default clone;\n", "import baseClone from './_baseClone.js';\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG = 1,\n CLONE_SYMBOLS_FLAG = 4;\n\n/**\n * This method is like `_.clone` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @returns {*} Returns the deep cloned value.\n * @see _.clone\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var deep = _.cloneDeep(objects);\n * console.log(deep[0] === objects[0]);\n * // => false\n */\nfunction cloneDeep(value) {\n return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);\n}\n\nexport default cloneDeep;\n", "/**\n * Creates an array with all falsey values removed. The values `false`, `null`,\n * `0`, `\"\"`, `undefined`, and `NaN` are falsey.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to compact.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.compact([0, 1, false, 2, '', 3]);\n * // => [1, 2, 3]\n */\nfunction compact(array) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (value) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nexport default compact;\n", "/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Adds `value` to the array cache.\n *\n * @private\n * @name add\n * @memberOf SetCache\n * @alias push\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache instance.\n */\nfunction setCacheAdd(value) {\n this.__data__.set(value, HASH_UNDEFINED);\n return this;\n}\n\nexport default setCacheAdd;\n", "/**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\nfunction setCacheHas(value) {\n return this.__data__.has(value);\n}\n\nexport default setCacheHas;\n", "import MapCache from './_MapCache.js';\nimport setCacheAdd from './_setCacheAdd.js';\nimport setCacheHas from './_setCacheHas.js';\n\n/**\n *\n * Creates an array cache object to store unique values.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\nfunction SetCache(values) {\n var index = -1,\n length = values == null ? 0 : values.length;\n\n this.__data__ = new MapCache;\n while (++index < length) {\n this.add(values[index]);\n }\n}\n\n// Add methods to `SetCache`.\nSetCache.prototype.add = SetCache.prototype.push = setCacheAdd;\nSetCache.prototype.has = setCacheHas;\n\nexport default SetCache;\n", "/**\n * A specialized version of `_.some` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\nfunction arraySome(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n}\n\nexport default arraySome;\n", "/**\n * Checks if a `cache` value for `key` exists.\n *\n * @private\n * @param {Object} cache The cache to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction cacheHas(cache, key) {\n return cache.has(key);\n}\n\nexport default cacheHas;\n", "import SetCache from './_SetCache.js';\nimport arraySome from './_arraySome.js';\nimport cacheHas from './_cacheHas.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `array` and `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\nfunction equalArrays(array, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n return false;\n }\n // Check that cyclic values are equal.\n var arrStacked = stack.get(array);\n var othStacked = stack.get(other);\n if (arrStacked && othStacked) {\n return arrStacked == other && othStacked == array;\n }\n var index = -1,\n result = true,\n seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;\n\n stack.set(array, other);\n stack.set(other, array);\n\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, arrValue, index, other, array, stack)\n : customizer(arrValue, othValue, index, array, other, stack);\n }\n if (compared !== undefined) {\n if (compared) {\n continue;\n }\n result = false;\n break;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (seen) {\n if (!arraySome(other, function(othValue, othIndex) {\n if (!cacheHas(seen, othIndex) &&\n (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {\n return seen.push(othIndex);\n }\n })) {\n result = false;\n break;\n }\n } else if (!(\n arrValue === othValue ||\n equalFunc(arrValue, othValue, bitmask, customizer, stack)\n )) {\n result = false;\n break;\n }\n }\n stack['delete'](array);\n stack['delete'](other);\n return result;\n}\n\nexport default equalArrays;\n", "/**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\nfunction mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n}\n\nexport default mapToArray;\n", "/**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\nfunction setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n}\n\nexport default setToArray;\n", "import Symbol from './_Symbol.js';\nimport Uint8Array from './_Uint8Array.js';\nimport eq from './eq.js';\nimport equalArrays from './_equalArrays.js';\nimport mapToArray from './_mapToArray.js';\nimport setToArray from './_setToArray.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]';\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {\n switch (tag) {\n case dataViewTag:\n if ((object.byteLength != other.byteLength) ||\n (object.byteOffset != other.byteOffset)) {\n return false;\n }\n object = object.buffer;\n other = other.buffer;\n\n case arrayBufferTag:\n if ((object.byteLength != other.byteLength) ||\n !equalFunc(new Uint8Array(object), new Uint8Array(other))) {\n return false;\n }\n return true;\n\n case boolTag:\n case dateTag:\n case numberTag:\n // Coerce booleans to `1` or `0` and dates to milliseconds.\n // Invalid dates are coerced to `NaN`.\n return eq(+object, +other);\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings, primitives and objects,\n // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring\n // for more details.\n return object == (other + '');\n\n case mapTag:\n var convert = mapToArray;\n\n case setTag:\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG;\n convert || (convert = setToArray);\n\n if (object.size != other.size && !isPartial) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked) {\n return stacked == other;\n }\n bitmask |= COMPARE_UNORDERED_FLAG;\n\n // Recursively compare objects (susceptible to call stack limits).\n stack.set(object, other);\n var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);\n stack['delete'](object);\n return result;\n\n case symbolTag:\n if (symbolValueOf) {\n return symbolValueOf.call(object) == symbolValueOf.call(other);\n }\n }\n return false;\n}\n\nexport default equalByTag;\n", "import getAllKeys from './_getAllKeys.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1;\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalObjects(object, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n objProps = getAllKeys(object),\n objLength = objProps.length,\n othProps = getAllKeys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isPartial) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n // Check that cyclic values are equal.\n var objStacked = stack.get(object);\n var othStacked = stack.get(other);\n if (objStacked && othStacked) {\n return objStacked == other && othStacked == object;\n }\n var result = true;\n stack.set(object, other);\n stack.set(other, object);\n\n var skipCtor = isPartial;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, objValue, key, other, object, stack)\n : customizer(objValue, othValue, key, object, other, stack);\n }\n // Recursively compare objects (susceptible to call stack limits).\n if (!(compared === undefined\n ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))\n : compared\n )) {\n result = false;\n break;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (result && !skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n result = false;\n }\n }\n stack['delete'](object);\n stack['delete'](other);\n return result;\n}\n\nexport default equalObjects;\n", "import Stack from './_Stack.js';\nimport equalArrays from './_equalArrays.js';\nimport equalByTag from './_equalByTag.js';\nimport equalObjects from './_equalObjects.js';\nimport getTag from './_getTag.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = objIsArr ? arrayTag : getTag(object),\n othTag = othIsArr ? arrayTag : getTag(other);\n\n objTag = objTag == argsTag ? objectTag : objTag;\n othTag = othTag == argsTag ? objectTag : othTag;\n\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && isBuffer(object)) {\n if (!isBuffer(other)) {\n return false;\n }\n objIsArr = true;\n objIsObj = false;\n }\n if (isSameTag && !objIsObj) {\n stack || (stack = new Stack);\n return (objIsArr || isTypedArray(object))\n ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)\n : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);\n }\n if (!(bitmask & COMPARE_PARTIAL_FLAG)) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n var objUnwrapped = objIsWrapped ? object.value() : object,\n othUnwrapped = othIsWrapped ? other.value() : other;\n\n stack || (stack = new Stack);\n return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);\n }\n }\n if (!isSameTag) {\n return false;\n }\n stack || (stack = new Stack);\n return equalObjects(object, other, bitmask, customizer, equalFunc, stack);\n}\n\nexport default baseIsEqualDeep;\n", "import baseIsEqualDeep from './_baseIsEqualDeep.js';\nimport isObjectLike from './isObjectLike.js';\n\n/**\n * The base implementation of `_.isEqual` which supports partial comparisons\n * and tracks traversed objects.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Unordered comparison\n * 2 - Partial comparison\n * @param {Function} [customizer] The function to customize comparisons.\n * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\nfunction baseIsEqual(value, other, bitmask, customizer, stack) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);\n}\n\nexport default baseIsEqual;\n", "import Stack from './_Stack.js';\nimport baseIsEqual from './_baseIsEqual.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * The base implementation of `_.isMatch` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @param {Array} matchData The property names, values, and compare flags to match.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n */\nfunction baseIsMatch(object, source, matchData, customizer) {\n var index = matchData.length,\n length = index,\n noCustomizer = !customizer;\n\n if (object == null) {\n return !length;\n }\n object = Object(object);\n while (index--) {\n var data = matchData[index];\n if ((noCustomizer && data[2])\n ? data[1] !== object[data[0]]\n : !(data[0] in object)\n ) {\n return false;\n }\n }\n while (++index < length) {\n data = matchData[index];\n var key = data[0],\n objValue = object[key],\n srcValue = data[1];\n\n if (noCustomizer && data[2]) {\n if (objValue === undefined && !(key in object)) {\n return false;\n }\n } else {\n var stack = new Stack;\n if (customizer) {\n var result = customizer(objValue, srcValue, key, object, source, stack);\n }\n if (!(result === undefined\n ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)\n : result\n )) {\n return false;\n }\n }\n }\n return true;\n}\n\nexport default baseIsMatch;\n", "import isObject from './isObject.js';\n\n/**\n * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` if suitable for strict\n * equality comparisons, else `false`.\n */\nfunction isStrictComparable(value) {\n return value === value && !isObject(value);\n}\n\nexport default isStrictComparable;\n", "import isStrictComparable from './_isStrictComparable.js';\nimport keys from './keys.js';\n\n/**\n * Gets the property names, values, and compare flags of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the match data of `object`.\n */\nfunction getMatchData(object) {\n var result = keys(object),\n length = result.length;\n\n while (length--) {\n var key = result[length],\n value = object[key];\n\n result[length] = [key, value, isStrictComparable(value)];\n }\n return result;\n}\n\nexport default getMatchData;\n", "/**\n * A specialized version of `matchesProperty` for source values suitable\n * for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\nfunction matchesStrictComparable(key, srcValue) {\n return function(object) {\n if (object == null) {\n return false;\n }\n return object[key] === srcValue &&\n (srcValue !== undefined || (key in Object(object)));\n };\n}\n\nexport default matchesStrictComparable;\n", "import baseIsMatch from './_baseIsMatch.js';\nimport getMatchData from './_getMatchData.js';\nimport matchesStrictComparable from './_matchesStrictComparable.js';\n\n/**\n * The base implementation of `_.matches` which doesn't clone `source`.\n *\n * @private\n * @param {Object} source The object of property values to match.\n * @returns {Function} Returns the new spec function.\n */\nfunction baseMatches(source) {\n var matchData = getMatchData(source);\n if (matchData.length == 1 && matchData[0][2]) {\n return matchesStrictComparable(matchData[0][0], matchData[0][1]);\n }\n return function(object) {\n return object === source || baseIsMatch(object, source, matchData);\n };\n}\n\nexport default baseMatches;\n", "/**\n * The base implementation of `_.hasIn` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\nfunction baseHasIn(object, key) {\n return object != null && key in Object(object);\n}\n\nexport default baseHasIn;\n", "import castPath from './_castPath.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\nimport isIndex from './_isIndex.js';\nimport isLength from './isLength.js';\nimport toKey from './_toKey.js';\n\n/**\n * Checks if `path` exists on `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @param {Function} hasFunc The function to check properties.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n */\nfunction hasPath(object, path, hasFunc) {\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n result = false;\n\n while (++index < length) {\n var key = toKey(path[index]);\n if (!(result = object != null && hasFunc(object, key))) {\n break;\n }\n object = object[key];\n }\n if (result || ++index != length) {\n return result;\n }\n length = object == null ? 0 : object.length;\n return !!length && isLength(length) && isIndex(key, length) &&\n (isArray(object) || isArguments(object));\n}\n\nexport default hasPath;\n", "import baseHasIn from './_baseHasIn.js';\nimport hasPath from './_hasPath.js';\n\n/**\n * Checks if `path` is a direct or inherited property of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.hasIn(object, 'a');\n * // => true\n *\n * _.hasIn(object, 'a.b');\n * // => true\n *\n * _.hasIn(object, ['a', 'b']);\n * // => true\n *\n * _.hasIn(object, 'b');\n * // => false\n */\nfunction hasIn(object, path) {\n return object != null && hasPath(object, path, baseHasIn);\n}\n\nexport default hasIn;\n", "import baseIsEqual from './_baseIsEqual.js';\nimport get from './get.js';\nimport hasIn from './hasIn.js';\nimport isKey from './_isKey.js';\nimport isStrictComparable from './_isStrictComparable.js';\nimport matchesStrictComparable from './_matchesStrictComparable.js';\nimport toKey from './_toKey.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.\n *\n * @private\n * @param {string} path The path of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\nfunction baseMatchesProperty(path, srcValue) {\n if (isKey(path) && isStrictComparable(srcValue)) {\n return matchesStrictComparable(toKey(path), srcValue);\n }\n return function(object) {\n var objValue = get(object, path);\n return (objValue === undefined && objValue === srcValue)\n ? hasIn(object, path)\n : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);\n };\n}\n\nexport default baseMatchesProperty;\n", "/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\nfunction baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n}\n\nexport default baseProperty;\n", "import baseGet from './_baseGet.js';\n\n/**\n * A specialized version of `baseProperty` which supports deep paths.\n *\n * @private\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\nfunction basePropertyDeep(path) {\n return function(object) {\n return baseGet(object, path);\n };\n}\n\nexport default basePropertyDeep;\n", "import baseProperty from './_baseProperty.js';\nimport basePropertyDeep from './_basePropertyDeep.js';\nimport isKey from './_isKey.js';\nimport toKey from './_toKey.js';\n\n/**\n * Creates a function that returns the value at `path` of a given object.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n * @example\n *\n * var objects = [\n * { 'a': { 'b': 2 } },\n * { 'a': { 'b': 1 } }\n * ];\n *\n * _.map(objects, _.property('a.b'));\n * // => [2, 1]\n *\n * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');\n * // => [1, 2]\n */\nfunction property(path) {\n return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);\n}\n\nexport default property;\n", "import baseMatches from './_baseMatches.js';\nimport baseMatchesProperty from './_baseMatchesProperty.js';\nimport identity from './identity.js';\nimport isArray from './isArray.js';\nimport property from './property.js';\n\n/**\n * The base implementation of `_.iteratee`.\n *\n * @private\n * @param {*} [value=_.identity] The value to convert to an iteratee.\n * @returns {Function} Returns the iteratee.\n */\nfunction baseIteratee(value) {\n // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.\n // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.\n if (typeof value == 'function') {\n return value;\n }\n if (value == null) {\n return identity;\n }\n if (typeof value == 'object') {\n return isArray(value)\n ? baseMatchesProperty(value[0], value[1])\n : baseMatches(value);\n }\n return property(value);\n}\n\nexport default baseIteratee;\n", "/**\n * A specialized version of `baseAggregator` for arrays.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\nfunction arrayAggregator(array, setter, iteratee, accumulator) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n var value = array[index];\n setter(accumulator, value, iteratee(value), array);\n }\n return accumulator;\n}\n\nexport default arrayAggregator;\n", "import baseFor from './_baseFor.js';\nimport keys from './keys.js';\n\n/**\n * The base implementation of `_.forOwn` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\nfunction baseForOwn(object, iteratee) {\n return object && baseFor(object, iteratee, keys);\n}\n\nexport default baseForOwn;\n", "import isArrayLike from './isArrayLike.js';\n\n/**\n * Creates a `baseEach` or `baseEachRight` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseEach(eachFunc, fromRight) {\n return function(collection, iteratee) {\n if (collection == null) {\n return collection;\n }\n if (!isArrayLike(collection)) {\n return eachFunc(collection, iteratee);\n }\n var length = collection.length,\n index = fromRight ? length : -1,\n iterable = Object(collection);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (iteratee(iterable[index], index, iterable) === false) {\n break;\n }\n }\n return collection;\n };\n}\n\nexport default createBaseEach;\n", "import baseForOwn from './_baseForOwn.js';\nimport createBaseEach from './_createBaseEach.js';\n\n/**\n * The base implementation of `_.forEach` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n */\nvar baseEach = createBaseEach(baseForOwn);\n\nexport default baseEach;\n", "import baseEach from './_baseEach.js';\n\n/**\n * Aggregates elements of `collection` on `accumulator` with keys transformed\n * by `iteratee` and values set by `setter`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\nfunction baseAggregator(collection, setter, iteratee, accumulator) {\n baseEach(collection, function(value, key, collection) {\n setter(accumulator, value, iteratee(value), collection);\n });\n return accumulator;\n}\n\nexport default baseAggregator;\n", "import arrayAggregator from './_arrayAggregator.js';\nimport baseAggregator from './_baseAggregator.js';\nimport baseIteratee from './_baseIteratee.js';\nimport isArray from './isArray.js';\n\n/**\n * Creates a function like `_.groupBy`.\n *\n * @private\n * @param {Function} setter The function to set accumulator values.\n * @param {Function} [initializer] The accumulator object initializer.\n * @returns {Function} Returns the new aggregator function.\n */\nfunction createAggregator(setter, initializer) {\n return function(collection, iteratee) {\n var func = isArray(collection) ? arrayAggregator : baseAggregator,\n accumulator = initializer ? initializer() : {};\n\n return func(collection, setter, baseIteratee(iteratee, 2), accumulator);\n };\n}\n\nexport default createAggregator;\n", "import root from './_root.js';\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nexport default now;\n", "import baseRest from './_baseRest.js';\nimport eq from './eq.js';\nimport isIterateeCall from './_isIterateeCall.js';\nimport keysIn from './keysIn.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Assigns own and inherited enumerable string keyed properties of source\n * objects to the destination object for all destination properties that\n * resolve to `undefined`. Source objects are applied from left to right.\n * Once a property is set, additional values of the same property are ignored.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.defaultsDeep\n * @example\n *\n * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\nvar defaults = baseRest(function(object, sources) {\n object = Object(object);\n\n var index = -1;\n var length = sources.length;\n var guard = length > 2 ? sources[2] : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n length = 1;\n }\n\n while (++index < length) {\n var source = sources[index];\n var props = keysIn(source);\n var propsIndex = -1;\n var propsLength = props.length;\n\n while (++propsIndex < propsLength) {\n var key = props[propsIndex];\n var value = object[key];\n\n if (value === undefined ||\n (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {\n object[key] = source[key];\n }\n }\n }\n\n return object;\n});\n\nexport default defaults;\n", "/**\n * This function is like `arrayIncludes` except that it accepts a comparator.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @param {Function} comparator The comparator invoked per element.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\nfunction arrayIncludesWith(array, value, comparator) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (comparator(value, array[index])) {\n return true;\n }\n }\n return false;\n}\n\nexport default arrayIncludesWith;\n", "import SetCache from './_SetCache.js';\nimport arrayIncludes from './_arrayIncludes.js';\nimport arrayIncludesWith from './_arrayIncludesWith.js';\nimport arrayMap from './_arrayMap.js';\nimport baseUnary from './_baseUnary.js';\nimport cacheHas from './_cacheHas.js';\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * The base implementation of methods like `_.difference` without support\n * for excluding multiple arrays or iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Array} values The values to exclude.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n */\nfunction baseDifference(array, values, iteratee, comparator) {\n var index = -1,\n includes = arrayIncludes,\n isCommon = true,\n length = array.length,\n result = [],\n valuesLength = values.length;\n\n if (!length) {\n return result;\n }\n if (iteratee) {\n values = arrayMap(values, baseUnary(iteratee));\n }\n if (comparator) {\n includes = arrayIncludesWith;\n isCommon = false;\n }\n else if (values.length >= LARGE_ARRAY_SIZE) {\n includes = cacheHas;\n isCommon = false;\n values = new SetCache(values);\n }\n outer:\n while (++index < length) {\n var value = array[index],\n computed = iteratee == null ? value : iteratee(value);\n\n value = (comparator || value !== 0) ? value : 0;\n if (isCommon && computed === computed) {\n var valuesIndex = valuesLength;\n while (valuesIndex--) {\n if (values[valuesIndex] === computed) {\n continue outer;\n }\n }\n result.push(value);\n }\n else if (!includes(values, computed, comparator)) {\n result.push(value);\n }\n }\n return result;\n}\n\nexport default baseDifference;\n", "import baseDifference from './_baseDifference.js';\nimport baseFlatten from './_baseFlatten.js';\nimport baseRest from './_baseRest.js';\nimport isArrayLikeObject from './isArrayLikeObject.js';\n\n/**\n * Creates an array of `array` values not included in the other given arrays\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons. The order and references of result values are\n * determined by the first array.\n *\n * **Note:** Unlike `_.pullAll`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...Array} [values] The values to exclude.\n * @returns {Array} Returns the new array of filtered values.\n * @see _.without, _.xor\n * @example\n *\n * _.difference([2, 1], [2, 3]);\n * // => [1]\n */\nvar difference = baseRest(function(array, values) {\n return isArrayLikeObject(array)\n ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))\n : [];\n});\n\nexport default difference;\n", "/**\n * Gets the last element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the last element of `array`.\n * @example\n *\n * _.last([1, 2, 3]);\n * // => 3\n */\nfunction last(array) {\n var length = array == null ? 0 : array.length;\n return length ? array[length - 1] : undefined;\n}\n\nexport default last;\n", "import baseSlice from './_baseSlice.js';\nimport toInteger from './toInteger.js';\n\n/**\n * Creates a slice of `array` with `n` elements dropped from the beginning.\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to drop.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.drop([1, 2, 3]);\n * // => [2, 3]\n *\n * _.drop([1, 2, 3], 2);\n * // => [3]\n *\n * _.drop([1, 2, 3], 5);\n * // => []\n *\n * _.drop([1, 2, 3], 0);\n * // => [1, 2, 3]\n */\nfunction drop(array, n, guard) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n n = (guard || n === undefined) ? 1 : toInteger(n);\n return baseSlice(array, n < 0 ? 0 : n, length);\n}\n\nexport default drop;\n", "import baseSlice from './_baseSlice.js';\nimport toInteger from './toInteger.js';\n\n/**\n * Creates a slice of `array` with `n` elements dropped from the end.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to drop.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.dropRight([1, 2, 3]);\n * // => [1, 2]\n *\n * _.dropRight([1, 2, 3], 2);\n * // => [1]\n *\n * _.dropRight([1, 2, 3], 5);\n * // => []\n *\n * _.dropRight([1, 2, 3], 0);\n * // => [1, 2, 3]\n */\nfunction dropRight(array, n, guard) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n n = (guard || n === undefined) ? 1 : toInteger(n);\n n = length - n;\n return baseSlice(array, 0, n < 0 ? 0 : n);\n}\n\nexport default dropRight;\n", "import identity from './identity.js';\n\n/**\n * Casts `value` to `identity` if it's not a function.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {Function} Returns cast function.\n */\nfunction castFunction(value) {\n return typeof value == 'function' ? value : identity;\n}\n\nexport default castFunction;\n", "import arrayEach from './_arrayEach.js';\nimport baseEach from './_baseEach.js';\nimport castFunction from './_castFunction.js';\nimport isArray from './isArray.js';\n\n/**\n * Iterates over elements of `collection` and invokes `iteratee` for each element.\n * The iteratee is invoked with three arguments: (value, index|key, collection).\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * **Note:** As with other \"Collections\" methods, objects with a \"length\"\n * property are iterated like arrays. To avoid this behavior use `_.forIn`\n * or `_.forOwn` for object iteration.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @alias each\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n * @see _.forEachRight\n * @example\n *\n * _.forEach([1, 2], function(value) {\n * console.log(value);\n * });\n * // => Logs `1` then `2`.\n *\n * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a' then 'b' (iteration order is not guaranteed).\n */\nfunction forEach(collection, iteratee) {\n var func = isArray(collection) ? arrayEach : baseEach;\n return func(collection, castFunction(iteratee));\n}\n\nexport default forEach;\n", "export { default } from './forEach.js'\n", "/**\n * A specialized version of `_.every` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n */\nfunction arrayEvery(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (!predicate(array[index], index, array)) {\n return false;\n }\n }\n return true;\n}\n\nexport default arrayEvery;\n", "import baseEach from './_baseEach.js';\n\n/**\n * The base implementation of `_.every` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`\n */\nfunction baseEvery(collection, predicate) {\n var result = true;\n baseEach(collection, function(value, index, collection) {\n result = !!predicate(value, index, collection);\n return result;\n });\n return result;\n}\n\nexport default baseEvery;\n", "import arrayEvery from './_arrayEvery.js';\nimport baseEvery from './_baseEvery.js';\nimport baseIteratee from './_baseIteratee.js';\nimport isArray from './isArray.js';\nimport isIterateeCall from './_isIterateeCall.js';\n\n/**\n * Checks if `predicate` returns truthy for **all** elements of `collection`.\n * Iteration is stopped once `predicate` returns falsey. The predicate is\n * invoked with three arguments: (value, index|key, collection).\n *\n * **Note:** This method returns `true` for\n * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because\n * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of\n * elements of empty collections.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n * @example\n *\n * _.every([true, 1, null, 'yes'], Boolean);\n * // => false\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * // The `_.matches` iteratee shorthand.\n * _.every(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.every(users, ['active', false]);\n * // => true\n *\n * // The `_.property` iteratee shorthand.\n * _.every(users, 'active');\n * // => false\n */\nfunction every(collection, predicate, guard) {\n var func = isArray(collection) ? arrayEvery : baseEvery;\n if (guard && isIterateeCall(collection, predicate, guard)) {\n predicate = undefined;\n }\n return func(collection, baseIteratee(predicate, 3));\n}\n\nexport default every;\n", "import baseEach from './_baseEach.js';\n\n/**\n * The base implementation of `_.filter` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction baseFilter(collection, predicate) {\n var result = [];\n baseEach(collection, function(value, index, collection) {\n if (predicate(value, index, collection)) {\n result.push(value);\n }\n });\n return result;\n}\n\nexport default baseFilter;\n", "import arrayFilter from './_arrayFilter.js';\nimport baseFilter from './_baseFilter.js';\nimport baseIteratee from './_baseIteratee.js';\nimport isArray from './isArray.js';\n\n/**\n * Iterates over elements of `collection`, returning an array of all elements\n * `predicate` returns truthy for. The predicate is invoked with three\n * arguments: (value, index|key, collection).\n *\n * **Note:** Unlike `_.remove`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n * @see _.reject\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * _.filter(users, function(o) { return !o.active; });\n * // => objects for ['fred']\n *\n * // The `_.matches` iteratee shorthand.\n * _.filter(users, { 'age': 36, 'active': true });\n * // => objects for ['barney']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.filter(users, ['active', false]);\n * // => objects for ['fred']\n *\n * // The `_.property` iteratee shorthand.\n * _.filter(users, 'active');\n * // => objects for ['barney']\n *\n * // Combining several predicates using `_.overEvery` or `_.overSome`.\n * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));\n * // => objects for ['fred', 'barney']\n */\nfunction filter(collection, predicate) {\n var func = isArray(collection) ? arrayFilter : baseFilter;\n return func(collection, baseIteratee(predicate, 3));\n}\n\nexport default filter;\n", "import baseIteratee from './_baseIteratee.js';\nimport isArrayLike from './isArrayLike.js';\nimport keys from './keys.js';\n\n/**\n * Creates a `_.find` or `_.findLast` function.\n *\n * @private\n * @param {Function} findIndexFunc The function to find the collection index.\n * @returns {Function} Returns the new find function.\n */\nfunction createFind(findIndexFunc) {\n return function(collection, predicate, fromIndex) {\n var iterable = Object(collection);\n if (!isArrayLike(collection)) {\n var iteratee = baseIteratee(predicate, 3);\n collection = keys(collection);\n predicate = function(key) { return iteratee(iterable[key], key, iterable); };\n }\n var index = findIndexFunc(collection, predicate, fromIndex);\n return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;\n };\n}\n\nexport default createFind;\n", "import baseFindIndex from './_baseFindIndex.js';\nimport baseIteratee from './_baseIteratee.js';\nimport toInteger from './toInteger.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * This method is like `_.find` except that it returns the index of the first\n * element `predicate` returns truthy for instead of the element itself.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {number} Returns the index of the found element, else `-1`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * _.findIndex(users, function(o) { return o.user == 'barney'; });\n * // => 0\n *\n * // The `_.matches` iteratee shorthand.\n * _.findIndex(users, { 'user': 'fred', 'active': false });\n * // => 1\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findIndex(users, ['active', false]);\n * // => 0\n *\n * // The `_.property` iteratee shorthand.\n * _.findIndex(users, 'active');\n * // => 2\n */\nfunction findIndex(array, predicate, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = fromIndex == null ? 0 : toInteger(fromIndex);\n if (index < 0) {\n index = nativeMax(length + index, 0);\n }\n return baseFindIndex(array, baseIteratee(predicate, 3), index);\n}\n\nexport default findIndex;\n", "import createFind from './_createFind.js';\nimport findIndex from './findIndex.js';\n\n/**\n * Iterates over elements of `collection`, returning the first element\n * `predicate` returns truthy for. The predicate is invoked with three\n * arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false },\n * { 'user': 'pebbles', 'age': 1, 'active': true }\n * ];\n *\n * _.find(users, function(o) { return o.age < 40; });\n * // => object for 'barney'\n *\n * // The `_.matches` iteratee shorthand.\n * _.find(users, { 'age': 1, 'active': true });\n * // => object for 'pebbles'\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.find(users, ['active', false]);\n * // => object for 'fred'\n *\n * // The `_.property` iteratee shorthand.\n * _.find(users, 'active');\n * // => object for 'barney'\n */\nvar find = createFind(findIndex);\n\nexport default find;\n", "/**\n * Gets the first element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @alias first\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the first element of `array`.\n * @example\n *\n * _.head([1, 2, 3]);\n * // => 1\n *\n * _.head([]);\n * // => undefined\n */\nfunction head(array) {\n return (array && array.length) ? array[0] : undefined;\n}\n\nexport default head;\n", "export { default } from './head.js'\n", "import baseEach from './_baseEach.js';\nimport isArrayLike from './isArrayLike.js';\n\n/**\n * The base implementation of `_.map` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction baseMap(collection, iteratee) {\n var index = -1,\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value, key, collection) {\n result[++index] = iteratee(value, key, collection);\n });\n return result;\n}\n\nexport default baseMap;\n", "import arrayMap from './_arrayMap.js';\nimport baseIteratee from './_baseIteratee.js';\nimport baseMap from './_baseMap.js';\nimport isArray from './isArray.js';\n\n/**\n * Creates an array of values by running each element in `collection` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.\n *\n * The guarded methods are:\n * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,\n * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,\n * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,\n * `template`, `trim`, `trimEnd`, `trimStart`, and `words`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * _.map([4, 8], square);\n * // => [16, 64]\n *\n * _.map({ 'a': 4, 'b': 8 }, square);\n * // => [16, 64] (iteration order is not guaranteed)\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * // The `_.property` iteratee shorthand.\n * _.map(users, 'user');\n * // => ['barney', 'fred']\n */\nfunction map(collection, iteratee) {\n var func = isArray(collection) ? arrayMap : baseMap;\n return func(collection, baseIteratee(iteratee, 3));\n}\n\nexport default map;\n", "import baseFlatten from './_baseFlatten.js';\nimport map from './map.js';\n\n/**\n * Creates a flattened array of values by running each element in `collection`\n * thru `iteratee` and flattening the mapped results. The iteratee is invoked\n * with three arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * function duplicate(n) {\n * return [n, n];\n * }\n *\n * _.flatMap([1, 2], duplicate);\n * // => [1, 1, 2, 2]\n */\nfunction flatMap(collection, iteratee) {\n return baseFlatten(map(collection, iteratee), 1);\n}\n\nexport default flatMap;\n", "import baseFor from './_baseFor.js';\nimport castFunction from './_castFunction.js';\nimport keysIn from './keysIn.js';\n\n/**\n * Iterates over own and inherited enumerable string keyed properties of an\n * object and invokes `iteratee` for each property. The iteratee is invoked\n * with three arguments: (value, key, object). Iteratee functions may exit\n * iteration early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @since 0.3.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forInRight\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forIn(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).\n */\nfunction forIn(object, iteratee) {\n return object == null\n ? object\n : baseFor(object, castFunction(iteratee), keysIn);\n}\n\nexport default forIn;\n", "import baseForOwn from './_baseForOwn.js';\nimport castFunction from './_castFunction.js';\n\n/**\n * Iterates over own enumerable string keyed properties of an object and\n * invokes `iteratee` for each property. The iteratee is invoked with three\n * arguments: (value, key, object). Iteratee functions may exit iteration\n * early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @since 0.3.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forOwnRight\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forOwn(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a' then 'b' (iteration order is not guaranteed).\n */\nfunction forOwn(object, iteratee) {\n return object && baseForOwn(object, castFunction(iteratee));\n}\n\nexport default forOwn;\n", "import baseAssignValue from './_baseAssignValue.js';\nimport createAggregator from './_createAggregator.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` thru `iteratee`. The order of grouped values\n * is determined by the order they occur in `collection`. The corresponding\n * value of each key is an array of elements responsible for generating the\n * key. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee to transform keys.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * _.groupBy([6.1, 4.2, 6.3], Math.floor);\n * // => { '4': [4.2], '6': [6.1, 6.3] }\n *\n * // The `_.property` iteratee shorthand.\n * _.groupBy(['one', 'two', 'three'], 'length');\n * // => { '3': ['one', 'two'], '5': ['three'] }\n */\nvar groupBy = createAggregator(function(result, value, key) {\n if (hasOwnProperty.call(result, key)) {\n result[key].push(value);\n } else {\n baseAssignValue(result, key, [value]);\n }\n});\n\nexport default groupBy;\n", "/**\n * The base implementation of `_.gt` which doesn't coerce arguments.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is greater than `other`,\n * else `false`.\n */\nfunction baseGt(value, other) {\n return value > other;\n}\n\nexport default baseGt;\n", "/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.has` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\nfunction baseHas(object, key) {\n return object != null && hasOwnProperty.call(object, key);\n}\n\nexport default baseHas;\n", "import baseHas from './_baseHas.js';\nimport hasPath from './_hasPath.js';\n\n/**\n * Checks if `path` is a direct property of `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = { 'a': { 'b': 2 } };\n * var other = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.has(object, 'a');\n * // => true\n *\n * _.has(object, 'a.b');\n * // => true\n *\n * _.has(object, ['a', 'b']);\n * // => true\n *\n * _.has(other, 'a');\n * // => false\n */\nfunction has(object, path) {\n return object != null && hasPath(object, path, baseHas);\n}\n\nexport default has;\n", "import baseGetTag from './_baseGetTag.js';\nimport isArray from './isArray.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar stringTag = '[object String]';\n\n/**\n * Checks if `value` is classified as a `String` primitive or object.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a string, else `false`.\n * @example\n *\n * _.isString('abc');\n * // => true\n *\n * _.isString(1);\n * // => false\n */\nfunction isString(value) {\n return typeof value == 'string' ||\n (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);\n}\n\nexport default isString;\n", "import arrayMap from './_arrayMap.js';\n\n/**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\nfunction baseValues(object, props) {\n return arrayMap(props, function(key) {\n return object[key];\n });\n}\n\nexport default baseValues;\n", "import baseValues from './_baseValues.js';\nimport keys from './keys.js';\n\n/**\n * Creates an array of the own enumerable string keyed property values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.values(new Foo);\n * // => [1, 2] (iteration order is not guaranteed)\n *\n * _.values('hi');\n * // => ['h', 'i']\n */\nfunction values(object) {\n return object == null ? [] : baseValues(object, keys(object));\n}\n\nexport default values;\n", "import baseIndexOf from './_baseIndexOf.js';\nimport isArrayLike from './isArrayLike.js';\nimport isString from './isString.js';\nimport toInteger from './toInteger.js';\nimport values from './values.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Checks if `value` is in `collection`. If `collection` is a string, it's\n * checked for a substring of `value`, otherwise\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * is used for equality comparisons. If `fromIndex` is negative, it's used as\n * the offset from the end of `collection`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object|string} collection The collection to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=0] The index to search from.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.\n * @returns {boolean} Returns `true` if `value` is found, else `false`.\n * @example\n *\n * _.includes([1, 2, 3], 1);\n * // => true\n *\n * _.includes([1, 2, 3], 1, 2);\n * // => false\n *\n * _.includes({ 'a': 1, 'b': 2 }, 1);\n * // => true\n *\n * _.includes('abcd', 'bc');\n * // => true\n */\nfunction includes(collection, value, fromIndex, guard) {\n collection = isArrayLike(collection) ? collection : values(collection);\n fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;\n\n var length = collection.length;\n if (fromIndex < 0) {\n fromIndex = nativeMax(length + fromIndex, 0);\n }\n return isString(collection)\n ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)\n : (!!length && baseIndexOf(collection, value, fromIndex) > -1);\n}\n\nexport default includes;\n", "import baseIndexOf from './_baseIndexOf.js';\nimport toInteger from './toInteger.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Gets the index at which the first occurrence of `value` is found in `array`\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons. If `fromIndex` is negative, it's used as the\n * offset from the end of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.indexOf([1, 2, 1, 2], 2);\n * // => 1\n *\n * // Search from the `fromIndex`.\n * _.indexOf([1, 2, 1, 2], 2, 2);\n * // => 3\n */\nfunction indexOf(array, value, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = fromIndex == null ? 0 : toInteger(fromIndex);\n if (index < 0) {\n index = nativeMax(length + index, 0);\n }\n return baseIndexOf(array, value, index);\n}\n\nexport default indexOf;\n", "import baseKeys from './_baseKeys.js';\nimport getTag from './_getTag.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\nimport isArrayLike from './isArrayLike.js';\nimport isBuffer from './isBuffer.js';\nimport isPrototype from './_isPrototype.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n setTag = '[object Set]';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if `value` is an empty object, collection, map, or set.\n *\n * Objects are considered empty if they have no own enumerable string keyed\n * properties.\n *\n * Array-like values such as `arguments` objects, arrays, buffers, strings, or\n * jQuery-like collections are considered empty if they have a `length` of `0`.\n * Similarly, maps and sets are considered empty if they have a `size` of `0`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is empty, else `false`.\n * @example\n *\n * _.isEmpty(null);\n * // => true\n *\n * _.isEmpty(true);\n * // => true\n *\n * _.isEmpty(1);\n * // => true\n *\n * _.isEmpty([1, 2, 3]);\n * // => false\n *\n * _.isEmpty({ 'a': 1 });\n * // => false\n */\nfunction isEmpty(value) {\n if (value == null) {\n return true;\n }\n if (isArrayLike(value) &&\n (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||\n isBuffer(value) || isTypedArray(value) || isArguments(value))) {\n return !value.length;\n }\n var tag = getTag(value);\n if (tag == mapTag || tag == setTag) {\n return !value.size;\n }\n if (isPrototype(value)) {\n return !baseKeys(value).length;\n }\n for (var key in value) {\n if (hasOwnProperty.call(value, key)) {\n return false;\n }\n }\n return true;\n}\n\nexport default isEmpty;\n", "import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar regexpTag = '[object RegExp]';\n\n/**\n * The base implementation of `_.isRegExp` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.\n */\nfunction baseIsRegExp(value) {\n return isObjectLike(value) && baseGetTag(value) == regexpTag;\n}\n\nexport default baseIsRegExp;\n", "import baseIsRegExp from './_baseIsRegExp.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsRegExp = nodeUtil && nodeUtil.isRegExp;\n\n/**\n * Checks if `value` is classified as a `RegExp` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.\n * @example\n *\n * _.isRegExp(/abc/);\n * // => true\n *\n * _.isRegExp('/abc/');\n * // => false\n */\nvar isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;\n\nexport default isRegExp;\n", "/**\n * Checks if `value` is `undefined`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.\n * @example\n *\n * _.isUndefined(void 0);\n * // => true\n *\n * _.isUndefined(null);\n * // => false\n */\nfunction isUndefined(value) {\n return value === undefined;\n}\n\nexport default isUndefined;\n", "/**\n * The base implementation of `_.lt` which doesn't coerce arguments.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than `other`,\n * else `false`.\n */\nfunction baseLt(value, other) {\n return value < other;\n}\n\nexport default baseLt;\n", "import baseAssignValue from './_baseAssignValue.js';\nimport baseForOwn from './_baseForOwn.js';\nimport baseIteratee from './_baseIteratee.js';\n\n/**\n * Creates an object with the same keys as `object` and values generated\n * by running each own enumerable string keyed property of `object` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, key, object).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns the new mapped object.\n * @see _.mapKeys\n * @example\n *\n * var users = {\n * 'fred': { 'user': 'fred', 'age': 40 },\n * 'pebbles': { 'user': 'pebbles', 'age': 1 }\n * };\n *\n * _.mapValues(users, function(o) { return o.age; });\n * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\n *\n * // The `_.property` iteratee shorthand.\n * _.mapValues(users, 'age');\n * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\n */\nfunction mapValues(object, iteratee) {\n var result = {};\n iteratee = baseIteratee(iteratee, 3);\n\n baseForOwn(object, function(value, key, object) {\n baseAssignValue(result, key, iteratee(value, key, object));\n });\n return result;\n}\n\nexport default mapValues;\n", "import isSymbol from './isSymbol.js';\n\n/**\n * The base implementation of methods like `_.max` and `_.min` which accepts a\n * `comparator` to determine the extremum value.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The iteratee invoked per iteration.\n * @param {Function} comparator The comparator used to compare values.\n * @returns {*} Returns the extremum value.\n */\nfunction baseExtremum(array, iteratee, comparator) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n var value = array[index],\n current = iteratee(value);\n\n if (current != null && (computed === undefined\n ? (current === current && !isSymbol(current))\n : comparator(current, computed)\n )) {\n var computed = current,\n result = value;\n }\n }\n return result;\n}\n\nexport default baseExtremum;\n", "import baseExtremum from './_baseExtremum.js';\nimport baseGt from './_baseGt.js';\nimport identity from './identity.js';\n\n/**\n * Computes the maximum value of `array`. If `array` is empty or falsey,\n * `undefined` is returned.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Math\n * @param {Array} array The array to iterate over.\n * @returns {*} Returns the maximum value.\n * @example\n *\n * _.max([4, 2, 8, 6]);\n * // => 8\n *\n * _.max([]);\n * // => undefined\n */\nfunction max(array) {\n return (array && array.length)\n ? baseExtremum(array, identity, baseGt)\n : undefined;\n}\n\nexport default max;\n", "import baseExtremum from './_baseExtremum.js';\nimport baseLt from './_baseLt.js';\nimport identity from './identity.js';\n\n/**\n * Computes the minimum value of `array`. If `array` is empty or falsey,\n * `undefined` is returned.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Math\n * @param {Array} array The array to iterate over.\n * @returns {*} Returns the minimum value.\n * @example\n *\n * _.min([4, 2, 8, 6]);\n * // => 2\n *\n * _.min([]);\n * // => undefined\n */\nfunction min(array) {\n return (array && array.length)\n ? baseExtremum(array, identity, baseLt)\n : undefined;\n}\n\nexport default min;\n", "import baseExtremum from './_baseExtremum.js';\nimport baseIteratee from './_baseIteratee.js';\nimport baseLt from './_baseLt.js';\n\n/**\n * This method is like `_.min` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the criterion by which\n * the value is ranked. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Math\n * @param {Array} array The array to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {*} Returns the minimum value.\n * @example\n *\n * var objects = [{ 'n': 1 }, { 'n': 2 }];\n *\n * _.minBy(objects, function(o) { return o.n; });\n * // => { 'n': 1 }\n *\n * // The `_.property` iteratee shorthand.\n * _.minBy(objects, 'n');\n * // => { 'n': 1 }\n */\nfunction minBy(array, iteratee) {\n return (array && array.length)\n ? baseExtremum(array, baseIteratee(iteratee, 2), baseLt)\n : undefined;\n}\n\nexport default minBy;\n", "/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a function that negates the result of the predicate `func`. The\n * `func` predicate is invoked with the `this` binding and arguments of the\n * created function.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {Function} predicate The predicate to negate.\n * @returns {Function} Returns the new negated function.\n * @example\n *\n * function isEven(n) {\n * return n % 2 == 0;\n * }\n *\n * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));\n * // => [1, 3, 5]\n */\nfunction negate(predicate) {\n if (typeof predicate != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n return function() {\n var args = arguments;\n switch (args.length) {\n case 0: return !predicate.call(this);\n case 1: return !predicate.call(this, args[0]);\n case 2: return !predicate.call(this, args[0], args[1]);\n case 3: return !predicate.call(this, args[0], args[1], args[2]);\n }\n return !predicate.apply(this, args);\n };\n}\n\nexport default negate;\n", "import assignValue from './_assignValue.js';\nimport castPath from './_castPath.js';\nimport isIndex from './_isIndex.js';\nimport isObject from './isObject.js';\nimport toKey from './_toKey.js';\n\n/**\n * The base implementation of `_.set`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @param {Function} [customizer] The function to customize path creation.\n * @returns {Object} Returns `object`.\n */\nfunction baseSet(object, path, value, customizer) {\n if (!isObject(object)) {\n return object;\n }\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n lastIndex = length - 1,\n nested = object;\n\n while (nested != null && ++index < length) {\n var key = toKey(path[index]),\n newValue = value;\n\n if (key === '__proto__' || key === 'constructor' || key === 'prototype') {\n return object;\n }\n\n if (index != lastIndex) {\n var objValue = nested[key];\n newValue = customizer ? customizer(objValue, key, nested) : undefined;\n if (newValue === undefined) {\n newValue = isObject(objValue)\n ? objValue\n : (isIndex(path[index + 1]) ? [] : {});\n }\n }\n assignValue(nested, key, newValue);\n nested = nested[key];\n }\n return object;\n}\n\nexport default baseSet;\n", "import baseGet from './_baseGet.js';\nimport baseSet from './_baseSet.js';\nimport castPath from './_castPath.js';\n\n/**\n * The base implementation of `_.pickBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @param {Function} predicate The function invoked per property.\n * @returns {Object} Returns the new object.\n */\nfunction basePickBy(object, paths, predicate) {\n var index = -1,\n length = paths.length,\n result = {};\n\n while (++index < length) {\n var path = paths[index],\n value = baseGet(object, path);\n\n if (predicate(value, path)) {\n baseSet(result, castPath(path, object), value);\n }\n }\n return result;\n}\n\nexport default basePickBy;\n", "import arrayMap from './_arrayMap.js';\nimport baseIteratee from './_baseIteratee.js';\nimport basePickBy from './_basePickBy.js';\nimport getAllKeysIn from './_getAllKeysIn.js';\n\n/**\n * Creates an object composed of the `object` properties `predicate` returns\n * truthy for. The predicate is invoked with two arguments: (value, key).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The source object.\n * @param {Function} [predicate=_.identity] The function invoked per property.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.pickBy(object, _.isNumber);\n * // => { 'a': 1, 'c': 3 }\n */\nfunction pickBy(object, predicate) {\n if (object == null) {\n return {};\n }\n var props = arrayMap(getAllKeysIn(object), function(prop) {\n return [prop];\n });\n predicate = baseIteratee(predicate);\n return basePickBy(object, props, function(value, path) {\n return predicate(value, path[0]);\n });\n}\n\nexport default pickBy;\n", "/**\n * The base implementation of `_.sortBy` which uses `comparer` to define the\n * sort order of `array` and replaces criteria objects with their corresponding\n * values.\n *\n * @private\n * @param {Array} array The array to sort.\n * @param {Function} comparer The function to define sort order.\n * @returns {Array} Returns `array`.\n */\nfunction baseSortBy(array, comparer) {\n var length = array.length;\n\n array.sort(comparer);\n while (length--) {\n array[length] = array[length].value;\n }\n return array;\n}\n\nexport default baseSortBy;\n", "import isSymbol from './isSymbol.js';\n\n/**\n * Compares values to sort them in ascending order.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {number} Returns the sort order indicator for `value`.\n */\nfunction compareAscending(value, other) {\n if (value !== other) {\n var valIsDefined = value !== undefined,\n valIsNull = value === null,\n valIsReflexive = value === value,\n valIsSymbol = isSymbol(value);\n\n var othIsDefined = other !== undefined,\n othIsNull = other === null,\n othIsReflexive = other === other,\n othIsSymbol = isSymbol(other);\n\n if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||\n (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||\n (valIsNull && othIsDefined && othIsReflexive) ||\n (!valIsDefined && othIsReflexive) ||\n !valIsReflexive) {\n return 1;\n }\n if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||\n (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||\n (othIsNull && valIsDefined && valIsReflexive) ||\n (!othIsDefined && valIsReflexive) ||\n !othIsReflexive) {\n return -1;\n }\n }\n return 0;\n}\n\nexport default compareAscending;\n", "import compareAscending from './_compareAscending.js';\n\n/**\n * Used by `_.orderBy` to compare multiple properties of a value to another\n * and stable sort them.\n *\n * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,\n * specify an order of \"desc\" for descending or \"asc\" for ascending sort order\n * of corresponding values.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {boolean[]|string[]} orders The order to sort by for each property.\n * @returns {number} Returns the sort order indicator for `object`.\n */\nfunction compareMultiple(object, other, orders) {\n var index = -1,\n objCriteria = object.criteria,\n othCriteria = other.criteria,\n length = objCriteria.length,\n ordersLength = orders.length;\n\n while (++index < length) {\n var result = compareAscending(objCriteria[index], othCriteria[index]);\n if (result) {\n if (index >= ordersLength) {\n return result;\n }\n var order = orders[index];\n return result * (order == 'desc' ? -1 : 1);\n }\n }\n // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications\n // that causes it, under certain circumstances, to provide the same value for\n // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247\n // for more details.\n //\n // This also ensures a stable sort in V8 and other engines.\n // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.\n return object.index - other.index;\n}\n\nexport default compareMultiple;\n", "import arrayMap from './_arrayMap.js';\nimport baseGet from './_baseGet.js';\nimport baseIteratee from './_baseIteratee.js';\nimport baseMap from './_baseMap.js';\nimport baseSortBy from './_baseSortBy.js';\nimport baseUnary from './_baseUnary.js';\nimport compareMultiple from './_compareMultiple.js';\nimport identity from './identity.js';\nimport isArray from './isArray.js';\n\n/**\n * The base implementation of `_.orderBy` without param guards.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.\n * @param {string[]} orders The sort orders of `iteratees`.\n * @returns {Array} Returns the new sorted array.\n */\nfunction baseOrderBy(collection, iteratees, orders) {\n if (iteratees.length) {\n iteratees = arrayMap(iteratees, function(iteratee) {\n if (isArray(iteratee)) {\n return function(value) {\n return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);\n }\n }\n return iteratee;\n });\n } else {\n iteratees = [identity];\n }\n\n var index = -1;\n iteratees = arrayMap(iteratees, baseUnary(baseIteratee));\n\n var result = baseMap(collection, function(value, key, collection) {\n var criteria = arrayMap(iteratees, function(iteratee) {\n return iteratee(value);\n });\n return { 'criteria': criteria, 'index': ++index, 'value': value };\n });\n\n return baseSortBy(result, function(object, other) {\n return compareMultiple(object, other, orders);\n });\n}\n\nexport default baseOrderBy;\n", "import baseProperty from './_baseProperty.js';\n\n/**\n * Gets the size of an ASCII `string`.\n *\n * @private\n * @param {string} string The string inspect.\n * @returns {number} Returns the string size.\n */\nvar asciiSize = baseProperty('length');\n\nexport default asciiSize;\n", "/** Used to compose unicode character classes. */\nvar rsAstralRange = '\\\\ud800-\\\\udfff',\n rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,\n rsVarRange = '\\\\ufe0e\\\\ufe0f';\n\n/** Used to compose unicode capture groups. */\nvar rsAstral = '[' + rsAstralRange + ']',\n rsCombo = '[' + rsComboRange + ']',\n rsFitz = '\\\\ud83c[\\\\udffb-\\\\udfff]',\n rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',\n rsNonAstral = '[^' + rsAstralRange + ']',\n rsRegional = '(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}',\n rsSurrPair = '[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]',\n rsZWJ = '\\\\u200d';\n\n/** Used to compose unicode regexes. */\nvar reOptMod = rsModifier + '?',\n rsOptVar = '[' + rsVarRange + ']?',\n rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',\n rsSeq = rsOptVar + reOptMod + rsOptJoin,\n rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';\n\n/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */\nvar reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');\n\n/**\n * Gets the size of a Unicode `string`.\n *\n * @private\n * @param {string} string The string inspect.\n * @returns {number} Returns the string size.\n */\nfunction unicodeSize(string) {\n var result = reUnicode.lastIndex = 0;\n while (reUnicode.test(string)) {\n ++result;\n }\n return result;\n}\n\nexport default unicodeSize;\n", "import asciiSize from './_asciiSize.js';\nimport hasUnicode from './_hasUnicode.js';\nimport unicodeSize from './_unicodeSize.js';\n\n/**\n * Gets the number of symbols in `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the string size.\n */\nfunction stringSize(string) {\n return hasUnicode(string)\n ? unicodeSize(string)\n : asciiSize(string);\n}\n\nexport default stringSize;\n", "import basePickBy from './_basePickBy.js';\nimport hasIn from './hasIn.js';\n\n/**\n * The base implementation of `_.pick` without support for individual\n * property identifiers.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @returns {Object} Returns the new object.\n */\nfunction basePick(object, paths) {\n return basePickBy(object, paths, function(value, path) {\n return hasIn(object, path);\n });\n}\n\nexport default basePick;\n", "import basePick from './_basePick.js';\nimport flatRest from './_flatRest.js';\n\n/**\n * Creates an object composed of the picked `object` properties.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The source object.\n * @param {...(string|string[])} [paths] The property paths to pick.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.pick(object, ['a', 'c']);\n * // => { 'a': 1, 'c': 3 }\n */\nvar pick = flatRest(function(object, paths) {\n return object == null ? {} : basePick(object, paths);\n});\n\nexport default pick;\n", "/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeCeil = Math.ceil,\n nativeMax = Math.max;\n\n/**\n * The base implementation of `_.range` and `_.rangeRight` which doesn't\n * coerce arguments.\n *\n * @private\n * @param {number} start The start of the range.\n * @param {number} end The end of the range.\n * @param {number} step The value to increment or decrement by.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Array} Returns the range of numbers.\n */\nfunction baseRange(start, end, step, fromRight) {\n var index = -1,\n length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),\n result = Array(length);\n\n while (length--) {\n result[fromRight ? length : ++index] = start;\n start += step;\n }\n return result;\n}\n\nexport default baseRange;\n", "import baseRange from './_baseRange.js';\nimport isIterateeCall from './_isIterateeCall.js';\nimport toFinite from './toFinite.js';\n\n/**\n * Creates a `_.range` or `_.rangeRight` function.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new range function.\n */\nfunction createRange(fromRight) {\n return function(start, end, step) {\n if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {\n end = step = undefined;\n }\n // Ensure the sign of `-0` is preserved.\n start = toFinite(start);\n if (end === undefined) {\n end = start;\n start = 0;\n } else {\n end = toFinite(end);\n }\n step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);\n return baseRange(start, end, step, fromRight);\n };\n}\n\nexport default createRange;\n", "import createRange from './_createRange.js';\n\n/**\n * Creates an array of numbers (positive and/or negative) progressing from\n * `start` up to, but not including, `end`. A step of `-1` is used if a negative\n * `start` is specified without an `end` or `step`. If `end` is not specified,\n * it's set to `start` with `start` then set to `0`.\n *\n * **Note:** JavaScript follows the IEEE-754 standard for resolving\n * floating-point values which can produce unexpected results.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {number} [start=0] The start of the range.\n * @param {number} end The end of the range.\n * @param {number} [step=1] The value to increment or decrement by.\n * @returns {Array} Returns the range of numbers.\n * @see _.inRange, _.rangeRight\n * @example\n *\n * _.range(4);\n * // => [0, 1, 2, 3]\n *\n * _.range(-4);\n * // => [0, -1, -2, -3]\n *\n * _.range(1, 5);\n * // => [1, 2, 3, 4]\n *\n * _.range(0, 20, 5);\n * // => [0, 5, 10, 15]\n *\n * _.range(0, -4, -1);\n * // => [0, -1, -2, -3]\n *\n * _.range(1, 4, 0);\n * // => [1, 1, 1]\n *\n * _.range(0);\n * // => []\n */\nvar range = createRange();\n\nexport default range;\n", "/**\n * The base implementation of `_.reduce` and `_.reduceRight`, without support\n * for iteratee shorthands, which iterates over `collection` using `eachFunc`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} accumulator The initial value.\n * @param {boolean} initAccum Specify using the first or last element of\n * `collection` as the initial value.\n * @param {Function} eachFunc The function to iterate over `collection`.\n * @returns {*} Returns the accumulated value.\n */\nfunction baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {\n eachFunc(collection, function(value, index, collection) {\n accumulator = initAccum\n ? (initAccum = false, value)\n : iteratee(accumulator, value, index, collection);\n });\n return accumulator;\n}\n\nexport default baseReduce;\n", "import arrayReduce from './_arrayReduce.js';\nimport baseEach from './_baseEach.js';\nimport baseIteratee from './_baseIteratee.js';\nimport baseReduce from './_baseReduce.js';\nimport isArray from './isArray.js';\n\n/**\n * Reduces `collection` to a value which is the accumulated result of running\n * each element in `collection` thru `iteratee`, where each successive\n * invocation is supplied the return value of the previous. If `accumulator`\n * is not given, the first element of `collection` is used as the initial\n * value. The iteratee is invoked with four arguments:\n * (accumulator, value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.reduce`, `_.reduceRight`, and `_.transform`.\n *\n * The guarded methods are:\n * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,\n * and `sortBy`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @returns {*} Returns the accumulated value.\n * @see _.reduceRight\n * @example\n *\n * _.reduce([1, 2], function(sum, n) {\n * return sum + n;\n * }, 0);\n * // => 3\n *\n * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {\n * (result[value] || (result[value] = [])).push(key);\n * return result;\n * }, {});\n * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)\n */\nfunction reduce(collection, iteratee, accumulator) {\n var func = isArray(collection) ? arrayReduce : baseReduce,\n initAccum = arguments.length < 3;\n\n return func(collection, baseIteratee(iteratee, 4), accumulator, initAccum, baseEach);\n}\n\nexport default reduce;\n", "import arrayFilter from './_arrayFilter.js';\nimport baseFilter from './_baseFilter.js';\nimport baseIteratee from './_baseIteratee.js';\nimport isArray from './isArray.js';\nimport negate from './negate.js';\n\n/**\n * The opposite of `_.filter`; this method returns the elements of `collection`\n * that `predicate` does **not** return truthy for.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n * @see _.filter\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': true }\n * ];\n *\n * _.reject(users, function(o) { return !o.active; });\n * // => objects for ['fred']\n *\n * // The `_.matches` iteratee shorthand.\n * _.reject(users, { 'age': 40, 'active': true });\n * // => objects for ['barney']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.reject(users, ['active', false]);\n * // => objects for ['fred']\n *\n * // The `_.property` iteratee shorthand.\n * _.reject(users, 'active');\n * // => objects for ['barney']\n */\nfunction reject(collection, predicate) {\n var func = isArray(collection) ? arrayFilter : baseFilter;\n return func(collection, negate(baseIteratee(predicate, 3)));\n}\n\nexport default reject;\n", "import baseKeys from './_baseKeys.js';\nimport getTag from './_getTag.js';\nimport isArrayLike from './isArrayLike.js';\nimport isString from './isString.js';\nimport stringSize from './_stringSize.js';\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n setTag = '[object Set]';\n\n/**\n * Gets the size of `collection` by returning its length for array-like\n * values or the number of own enumerable string keyed properties for objects.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object|string} collection The collection to inspect.\n * @returns {number} Returns the collection size.\n * @example\n *\n * _.size([1, 2, 3]);\n * // => 3\n *\n * _.size({ 'a': 1, 'b': 2 });\n * // => 2\n *\n * _.size('pebbles');\n * // => 7\n */\nfunction size(collection) {\n if (collection == null) {\n return 0;\n }\n if (isArrayLike(collection)) {\n return isString(collection) ? stringSize(collection) : collection.length;\n }\n var tag = getTag(collection);\n if (tag == mapTag || tag == setTag) {\n return collection.size;\n }\n return baseKeys(collection).length;\n}\n\nexport default size;\n", "import baseEach from './_baseEach.js';\n\n/**\n * The base implementation of `_.some` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\nfunction baseSome(collection, predicate) {\n var result;\n\n baseEach(collection, function(value, index, collection) {\n result = predicate(value, index, collection);\n return !result;\n });\n return !!result;\n}\n\nexport default baseSome;\n", "import arraySome from './_arraySome.js';\nimport baseIteratee from './_baseIteratee.js';\nimport baseSome from './_baseSome.js';\nimport isArray from './isArray.js';\nimport isIterateeCall from './_isIterateeCall.js';\n\n/**\n * Checks if `predicate` returns truthy for **any** element of `collection`.\n * Iteration is stopped once `predicate` returns truthy. The predicate is\n * invoked with three arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n * @example\n *\n * _.some([null, 0, 'yes', false], Boolean);\n * // => true\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false }\n * ];\n *\n * // The `_.matches` iteratee shorthand.\n * _.some(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.some(users, ['active', false]);\n * // => true\n *\n * // The `_.property` iteratee shorthand.\n * _.some(users, 'active');\n * // => true\n */\nfunction some(collection, predicate, guard) {\n var func = isArray(collection) ? arraySome : baseSome;\n if (guard && isIterateeCall(collection, predicate, guard)) {\n predicate = undefined;\n }\n return func(collection, baseIteratee(predicate, 3));\n}\n\nexport default some;\n", "import baseFlatten from './_baseFlatten.js';\nimport baseOrderBy from './_baseOrderBy.js';\nimport baseRest from './_baseRest.js';\nimport isIterateeCall from './_isIterateeCall.js';\n\n/**\n * Creates an array of elements, sorted in ascending order by the results of\n * running each element in a collection thru each iteratee. This method\n * performs a stable sort, that is, it preserves the original sort order of\n * equal elements. The iteratees are invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {...(Function|Function[])} [iteratees=[_.identity]]\n * The iteratees to sort by.\n * @returns {Array} Returns the new sorted array.\n * @example\n *\n * var users = [\n * { 'user': 'fred', 'age': 48 },\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 30 },\n * { 'user': 'barney', 'age': 34 }\n * ];\n *\n * _.sortBy(users, [function(o) { return o.user; }]);\n * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]\n *\n * _.sortBy(users, ['user', 'age']);\n * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]\n */\nvar sortBy = baseRest(function(collection, iteratees) {\n if (collection == null) {\n return [];\n }\n var length = iteratees.length;\n if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {\n iteratees = [];\n } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {\n iteratees = [iteratees[0]];\n }\n return baseOrderBy(collection, baseFlatten(iteratees, 1), []);\n});\n\nexport default sortBy;\n", "import Set from './_Set.js';\nimport noop from './noop.js';\nimport setToArray from './_setToArray.js';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/**\n * Creates a set object of `values`.\n *\n * @private\n * @param {Array} values The values to add to the set.\n * @returns {Object} Returns the new set.\n */\nvar createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {\n return new Set(values);\n};\n\nexport default createSet;\n", "import SetCache from './_SetCache.js';\nimport arrayIncludes from './_arrayIncludes.js';\nimport arrayIncludesWith from './_arrayIncludesWith.js';\nimport cacheHas from './_cacheHas.js';\nimport createSet from './_createSet.js';\nimport setToArray from './_setToArray.js';\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * The base implementation of `_.uniqBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n */\nfunction baseUniq(array, iteratee, comparator) {\n var index = -1,\n includes = arrayIncludes,\n length = array.length,\n isCommon = true,\n result = [],\n seen = result;\n\n if (comparator) {\n isCommon = false;\n includes = arrayIncludesWith;\n }\n else if (length >= LARGE_ARRAY_SIZE) {\n var set = iteratee ? null : createSet(array);\n if (set) {\n return setToArray(set);\n }\n isCommon = false;\n includes = cacheHas;\n seen = new SetCache;\n }\n else {\n seen = iteratee ? [] : result;\n }\n outer:\n while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value) : value;\n\n value = (comparator || value !== 0) ? value : 0;\n if (isCommon && computed === computed) {\n var seenIndex = seen.length;\n while (seenIndex--) {\n if (seen[seenIndex] === computed) {\n continue outer;\n }\n }\n if (iteratee) {\n seen.push(computed);\n }\n result.push(value);\n }\n else if (!includes(seen, computed, comparator)) {\n if (seen !== result) {\n seen.push(computed);\n }\n result.push(value);\n }\n }\n return result;\n}\n\nexport default baseUniq;\n", "import baseFlatten from './_baseFlatten.js';\nimport baseRest from './_baseRest.js';\nimport baseUniq from './_baseUniq.js';\nimport isArrayLikeObject from './isArrayLikeObject.js';\n\n/**\n * Creates an array of unique values, in order, from all given arrays using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of combined values.\n * @example\n *\n * _.union([2], [1, 2]);\n * // => [2, 1]\n */\nvar union = baseRest(function(arrays) {\n return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));\n});\n\nexport default union;\n", "import baseUniq from './_baseUniq.js';\n\n/**\n * Creates a duplicate-free version of an array, using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons, in which only the first occurrence of each element\n * is kept. The order of result values is determined by the order they occur\n * in the array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.uniq([2, 1, 2]);\n * // => [2, 1]\n */\nfunction uniq(array) {\n return (array && array.length) ? baseUniq(array) : [];\n}\n\nexport default uniq;\n", "import baseIteratee from './_baseIteratee.js';\nimport baseUniq from './_baseUniq.js';\n\n/**\n * This method is like `_.uniq` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the criterion by which\n * uniqueness is computed. The order of result values is determined by the\n * order they occur in the array. The iteratee is invoked with one argument:\n * (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.uniqBy([2.1, 1.2, 2.3], Math.floor);\n * // => [2.1, 1.2]\n *\n * // The `_.property` iteratee shorthand.\n * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 1 }, { 'x': 2 }]\n */\nfunction uniqBy(array, iteratee) {\n return (array && array.length) ? baseUniq(array, baseIteratee(iteratee, 2)) : [];\n}\n\nexport default uniqBy;\n", "import toString from './toString.js';\n\n/** Used to generate unique IDs. */\nvar idCounter = 0;\n\n/**\n * Generates a unique ID. If `prefix` is given, the ID is appended to it.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {string} [prefix=''] The value to prefix the ID with.\n * @returns {string} Returns the unique ID.\n * @example\n *\n * _.uniqueId('contact_');\n * // => 'contact_104'\n *\n * _.uniqueId();\n * // => '105'\n */\nfunction uniqueId(prefix) {\n var id = ++idCounter;\n return toString(prefix) + id;\n}\n\nexport default uniqueId;\n", "/**\n * This base implementation of `_.zipObject` which assigns values using `assignFunc`.\n *\n * @private\n * @param {Array} props The property identifiers.\n * @param {Array} values The property values.\n * @param {Function} assignFunc The function to assign values.\n * @returns {Object} Returns the new object.\n */\nfunction baseZipObject(props, values, assignFunc) {\n var index = -1,\n length = props.length,\n valsLength = values.length,\n result = {};\n\n while (++index < length) {\n var value = index < valsLength ? values[index] : undefined;\n assignFunc(result, props[index], value);\n }\n return result;\n}\n\nexport default baseZipObject;\n", "import assignValue from './_assignValue.js';\nimport baseZipObject from './_baseZipObject.js';\n\n/**\n * This method is like `_.fromPairs` except that it accepts two arrays,\n * one of property identifiers and one of corresponding values.\n *\n * @static\n * @memberOf _\n * @since 0.4.0\n * @category Array\n * @param {Array} [props=[]] The property identifiers.\n * @param {Array} [values=[]] The property values.\n * @returns {Object} Returns the new object.\n * @example\n *\n * _.zipObject(['a', 'b'], [1, 2]);\n * // => { 'a': 1, 'b': 2 }\n */\nfunction zipObject(props, values) {\n return baseZipObject(props || [], values || [], assignValue);\n}\n\nexport default zipObject;\n", "/**\n * @license\n * Lodash (Custom Build) \n * Build: `lodash modularize exports=\"es\" -o ./`\n * Copyright OpenJS Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\nexport { default as add } from './add.js';\nexport { default as after } from './after.js';\nexport { default as ary } from './ary.js';\nexport { default as assign } from './assign.js';\nexport { default as assignIn } from './assignIn.js';\nexport { default as assignInWith } from './assignInWith.js';\nexport { default as assignWith } from './assignWith.js';\nexport { default as at } from './at.js';\nexport { default as attempt } from './attempt.js';\nexport { default as before } from './before.js';\nexport { default as bind } from './bind.js';\nexport { default as bindAll } from './bindAll.js';\nexport { default as bindKey } from './bindKey.js';\nexport { default as camelCase } from './camelCase.js';\nexport { default as capitalize } from './capitalize.js';\nexport { default as castArray } from './castArray.js';\nexport { default as ceil } from './ceil.js';\nexport { default as chain } from './chain.js';\nexport { default as chunk } from './chunk.js';\nexport { default as clamp } from './clamp.js';\nexport { default as clone } from './clone.js';\nexport { default as cloneDeep } from './cloneDeep.js';\nexport { default as cloneDeepWith } from './cloneDeepWith.js';\nexport { default as cloneWith } from './cloneWith.js';\nexport { default as commit } from './commit.js';\nexport { default as compact } from './compact.js';\nexport { default as concat } from './concat.js';\nexport { default as cond } from './cond.js';\nexport { default as conforms } from './conforms.js';\nexport { default as conformsTo } from './conformsTo.js';\nexport { default as constant } from './constant.js';\nexport { default as countBy } from './countBy.js';\nexport { default as create } from './create.js';\nexport { default as curry } from './curry.js';\nexport { default as curryRight } from './curryRight.js';\nexport { default as debounce } from './debounce.js';\nexport { default as deburr } from './deburr.js';\nexport { default as defaultTo } from './defaultTo.js';\nexport { default as defaults } from './defaults.js';\nexport { default as defaultsDeep } from './defaultsDeep.js';\nexport { default as defer } from './defer.js';\nexport { default as delay } from './delay.js';\nexport { default as difference } from './difference.js';\nexport { default as differenceBy } from './differenceBy.js';\nexport { default as differenceWith } from './differenceWith.js';\nexport { default as divide } from './divide.js';\nexport { default as drop } from './drop.js';\nexport { default as dropRight } from './dropRight.js';\nexport { default as dropRightWhile } from './dropRightWhile.js';\nexport { default as dropWhile } from './dropWhile.js';\nexport { default as each } from './each.js';\nexport { default as eachRight } from './eachRight.js';\nexport { default as endsWith } from './endsWith.js';\nexport { default as entries } from './entries.js';\nexport { default as entriesIn } from './entriesIn.js';\nexport { default as eq } from './eq.js';\nexport { default as escape } from './escape.js';\nexport { default as escapeRegExp } from './escapeRegExp.js';\nexport { default as every } from './every.js';\nexport { default as extend } from './extend.js';\nexport { default as extendWith } from './extendWith.js';\nexport { default as fill } from './fill.js';\nexport { default as filter } from './filter.js';\nexport { default as find } from './find.js';\nexport { default as findIndex } from './findIndex.js';\nexport { default as findKey } from './findKey.js';\nexport { default as findLast } from './findLast.js';\nexport { default as findLastIndex } from './findLastIndex.js';\nexport { default as findLastKey } from './findLastKey.js';\nexport { default as first } from './first.js';\nexport { default as flatMap } from './flatMap.js';\nexport { default as flatMapDeep } from './flatMapDeep.js';\nexport { default as flatMapDepth } from './flatMapDepth.js';\nexport { default as flatten } from './flatten.js';\nexport { default as flattenDeep } from './flattenDeep.js';\nexport { default as flattenDepth } from './flattenDepth.js';\nexport { default as flip } from './flip.js';\nexport { default as floor } from './floor.js';\nexport { default as flow } from './flow.js';\nexport { default as flowRight } from './flowRight.js';\nexport { default as forEach } from './forEach.js';\nexport { default as forEachRight } from './forEachRight.js';\nexport { default as forIn } from './forIn.js';\nexport { default as forInRight } from './forInRight.js';\nexport { default as forOwn } from './forOwn.js';\nexport { default as forOwnRight } from './forOwnRight.js';\nexport { default as fromPairs } from './fromPairs.js';\nexport { default as functions } from './functions.js';\nexport { default as functionsIn } from './functionsIn.js';\nexport { default as get } from './get.js';\nexport { default as groupBy } from './groupBy.js';\nexport { default as gt } from './gt.js';\nexport { default as gte } from './gte.js';\nexport { default as has } from './has.js';\nexport { default as hasIn } from './hasIn.js';\nexport { default as head } from './head.js';\nexport { default as identity } from './identity.js';\nexport { default as inRange } from './inRange.js';\nexport { default as includes } from './includes.js';\nexport { default as indexOf } from './indexOf.js';\nexport { default as initial } from './initial.js';\nexport { default as intersection } from './intersection.js';\nexport { default as intersectionBy } from './intersectionBy.js';\nexport { default as intersectionWith } from './intersectionWith.js';\nexport { default as invert } from './invert.js';\nexport { default as invertBy } from './invertBy.js';\nexport { default as invoke } from './invoke.js';\nexport { default as invokeMap } from './invokeMap.js';\nexport { default as isArguments } from './isArguments.js';\nexport { default as isArray } from './isArray.js';\nexport { default as isArrayBuffer } from './isArrayBuffer.js';\nexport { default as isArrayLike } from './isArrayLike.js';\nexport { default as isArrayLikeObject } from './isArrayLikeObject.js';\nexport { default as isBoolean } from './isBoolean.js';\nexport { default as isBuffer } from './isBuffer.js';\nexport { default as isDate } from './isDate.js';\nexport { default as isElement } from './isElement.js';\nexport { default as isEmpty } from './isEmpty.js';\nexport { default as isEqual } from './isEqual.js';\nexport { default as isEqualWith } from './isEqualWith.js';\nexport { default as isError } from './isError.js';\nexport { default as isFinite } from './isFinite.js';\nexport { default as isFunction } from './isFunction.js';\nexport { default as isInteger } from './isInteger.js';\nexport { default as isLength } from './isLength.js';\nexport { default as isMap } from './isMap.js';\nexport { default as isMatch } from './isMatch.js';\nexport { default as isMatchWith } from './isMatchWith.js';\nexport { default as isNaN } from './isNaN.js';\nexport { default as isNative } from './isNative.js';\nexport { default as isNil } from './isNil.js';\nexport { default as isNull } from './isNull.js';\nexport { default as isNumber } from './isNumber.js';\nexport { default as isObject } from './isObject.js';\nexport { default as isObjectLike } from './isObjectLike.js';\nexport { default as isPlainObject } from './isPlainObject.js';\nexport { default as isRegExp } from './isRegExp.js';\nexport { default as isSafeInteger } from './isSafeInteger.js';\nexport { default as isSet } from './isSet.js';\nexport { default as isString } from './isString.js';\nexport { default as isSymbol } from './isSymbol.js';\nexport { default as isTypedArray } from './isTypedArray.js';\nexport { default as isUndefined } from './isUndefined.js';\nexport { default as isWeakMap } from './isWeakMap.js';\nexport { default as isWeakSet } from './isWeakSet.js';\nexport { default as iteratee } from './iteratee.js';\nexport { default as join } from './join.js';\nexport { default as kebabCase } from './kebabCase.js';\nexport { default as keyBy } from './keyBy.js';\nexport { default as keys } from './keys.js';\nexport { default as keysIn } from './keysIn.js';\nexport { default as last } from './last.js';\nexport { default as lastIndexOf } from './lastIndexOf.js';\nexport { default as lodash } from './wrapperLodash.js';\nexport { default as lowerCase } from './lowerCase.js';\nexport { default as lowerFirst } from './lowerFirst.js';\nexport { default as lt } from './lt.js';\nexport { default as lte } from './lte.js';\nexport { default as map } from './map.js';\nexport { default as mapKeys } from './mapKeys.js';\nexport { default as mapValues } from './mapValues.js';\nexport { default as matches } from './matches.js';\nexport { default as matchesProperty } from './matchesProperty.js';\nexport { default as max } from './max.js';\nexport { default as maxBy } from './maxBy.js';\nexport { default as mean } from './mean.js';\nexport { default as meanBy } from './meanBy.js';\nexport { default as memoize } from './memoize.js';\nexport { default as merge } from './merge.js';\nexport { default as mergeWith } from './mergeWith.js';\nexport { default as method } from './method.js';\nexport { default as methodOf } from './methodOf.js';\nexport { default as min } from './min.js';\nexport { default as minBy } from './minBy.js';\nexport { default as mixin } from './mixin.js';\nexport { default as multiply } from './multiply.js';\nexport { default as negate } from './negate.js';\nexport { default as next } from './next.js';\nexport { default as noop } from './noop.js';\nexport { default as now } from './now.js';\nexport { default as nth } from './nth.js';\nexport { default as nthArg } from './nthArg.js';\nexport { default as omit } from './omit.js';\nexport { default as omitBy } from './omitBy.js';\nexport { default as once } from './once.js';\nexport { default as orderBy } from './orderBy.js';\nexport { default as over } from './over.js';\nexport { default as overArgs } from './overArgs.js';\nexport { default as overEvery } from './overEvery.js';\nexport { default as overSome } from './overSome.js';\nexport { default as pad } from './pad.js';\nexport { default as padEnd } from './padEnd.js';\nexport { default as padStart } from './padStart.js';\nexport { default as parseInt } from './parseInt.js';\nexport { default as partial } from './partial.js';\nexport { default as partialRight } from './partialRight.js';\nexport { default as partition } from './partition.js';\nexport { default as pick } from './pick.js';\nexport { default as pickBy } from './pickBy.js';\nexport { default as plant } from './plant.js';\nexport { default as property } from './property.js';\nexport { default as propertyOf } from './propertyOf.js';\nexport { default as pull } from './pull.js';\nexport { default as pullAll } from './pullAll.js';\nexport { default as pullAllBy } from './pullAllBy.js';\nexport { default as pullAllWith } from './pullAllWith.js';\nexport { default as pullAt } from './pullAt.js';\nexport { default as random } from './random.js';\nexport { default as range } from './range.js';\nexport { default as rangeRight } from './rangeRight.js';\nexport { default as rearg } from './rearg.js';\nexport { default as reduce } from './reduce.js';\nexport { default as reduceRight } from './reduceRight.js';\nexport { default as reject } from './reject.js';\nexport { default as remove } from './remove.js';\nexport { default as repeat } from './repeat.js';\nexport { default as replace } from './replace.js';\nexport { default as rest } from './rest.js';\nexport { default as result } from './result.js';\nexport { default as reverse } from './reverse.js';\nexport { default as round } from './round.js';\nexport { default as sample } from './sample.js';\nexport { default as sampleSize } from './sampleSize.js';\nexport { default as set } from './set.js';\nexport { default as setWith } from './setWith.js';\nexport { default as shuffle } from './shuffle.js';\nexport { default as size } from './size.js';\nexport { default as slice } from './slice.js';\nexport { default as snakeCase } from './snakeCase.js';\nexport { default as some } from './some.js';\nexport { default as sortBy } from './sortBy.js';\nexport { default as sortedIndex } from './sortedIndex.js';\nexport { default as sortedIndexBy } from './sortedIndexBy.js';\nexport { default as sortedIndexOf } from './sortedIndexOf.js';\nexport { default as sortedLastIndex } from './sortedLastIndex.js';\nexport { default as sortedLastIndexBy } from './sortedLastIndexBy.js';\nexport { default as sortedLastIndexOf } from './sortedLastIndexOf.js';\nexport { default as sortedUniq } from './sortedUniq.js';\nexport { default as sortedUniqBy } from './sortedUniqBy.js';\nexport { default as split } from './split.js';\nexport { default as spread } from './spread.js';\nexport { default as startCase } from './startCase.js';\nexport { default as startsWith } from './startsWith.js';\nexport { default as stubArray } from './stubArray.js';\nexport { default as stubFalse } from './stubFalse.js';\nexport { default as stubObject } from './stubObject.js';\nexport { default as stubString } from './stubString.js';\nexport { default as stubTrue } from './stubTrue.js';\nexport { default as subtract } from './subtract.js';\nexport { default as sum } from './sum.js';\nexport { default as sumBy } from './sumBy.js';\nexport { default as tail } from './tail.js';\nexport { default as take } from './take.js';\nexport { default as takeRight } from './takeRight.js';\nexport { default as takeRightWhile } from './takeRightWhile.js';\nexport { default as takeWhile } from './takeWhile.js';\nexport { default as tap } from './tap.js';\nexport { default as template } from './template.js';\nexport { default as templateSettings } from './templateSettings.js';\nexport { default as throttle } from './throttle.js';\nexport { default as thru } from './thru.js';\nexport { default as times } from './times.js';\nexport { default as toArray } from './toArray.js';\nexport { default as toFinite } from './toFinite.js';\nexport { default as toInteger } from './toInteger.js';\nexport { default as toIterator } from './toIterator.js';\nexport { default as toJSON } from './toJSON.js';\nexport { default as toLength } from './toLength.js';\nexport { default as toLower } from './toLower.js';\nexport { default as toNumber } from './toNumber.js';\nexport { default as toPairs } from './toPairs.js';\nexport { default as toPairsIn } from './toPairsIn.js';\nexport { default as toPath } from './toPath.js';\nexport { default as toPlainObject } from './toPlainObject.js';\nexport { default as toSafeInteger } from './toSafeInteger.js';\nexport { default as toString } from './toString.js';\nexport { default as toUpper } from './toUpper.js';\nexport { default as transform } from './transform.js';\nexport { default as trim } from './trim.js';\nexport { default as trimEnd } from './trimEnd.js';\nexport { default as trimStart } from './trimStart.js';\nexport { default as truncate } from './truncate.js';\nexport { default as unary } from './unary.js';\nexport { default as unescape } from './unescape.js';\nexport { default as union } from './union.js';\nexport { default as unionBy } from './unionBy.js';\nexport { default as unionWith } from './unionWith.js';\nexport { default as uniq } from './uniq.js';\nexport { default as uniqBy } from './uniqBy.js';\nexport { default as uniqWith } from './uniqWith.js';\nexport { default as uniqueId } from './uniqueId.js';\nexport { default as unset } from './unset.js';\nexport { default as unzip } from './unzip.js';\nexport { default as unzipWith } from './unzipWith.js';\nexport { default as update } from './update.js';\nexport { default as updateWith } from './updateWith.js';\nexport { default as upperCase } from './upperCase.js';\nexport { default as upperFirst } from './upperFirst.js';\nexport { default as value } from './value.js';\nexport { default as valueOf } from './valueOf.js';\nexport { default as values } from './values.js';\nexport { default as valuesIn } from './valuesIn.js';\nexport { default as without } from './without.js';\nexport { default as words } from './words.js';\nexport { default as wrap } from './wrap.js';\nexport { default as wrapperAt } from './wrapperAt.js';\nexport { default as wrapperChain } from './wrapperChain.js';\nexport { default as wrapperCommit } from './commit.js';\nexport { default as wrapperLodash } from './wrapperLodash.js';\nexport { default as wrapperNext } from './next.js';\nexport { default as wrapperPlant } from './plant.js';\nexport { default as wrapperReverse } from './wrapperReverse.js';\nexport { default as wrapperToIterator } from './toIterator.js';\nexport { default as wrapperValue } from './wrapperValue.js';\nexport { default as xor } from './xor.js';\nexport { default as xorBy } from './xorBy.js';\nexport { default as xorWith } from './xorWith.js';\nexport { default as zip } from './zip.js';\nexport { default as zipObject } from './zipObject.js';\nexport { default as zipObjectDeep } from './zipObjectDeep.js';\nexport { default as zipWith } from './zipWith.js';\nexport { default } from './lodash.default.js';\n", "import * as _ from 'lodash-es';\n\nvar DEFAULT_EDGE_NAME = '\\x00';\nvar GRAPH_NODE = '\\x00';\nvar EDGE_KEY_DELIM = '\\x01';\n\n// Implementation notes:\n//\n// * Node id query functions should return string ids for the nodes\n// * Edge id query functions should return an \"edgeObj\", edge object, that is\n// composed of enough information to uniquely identify an edge: {v, w, name}.\n// * Internally we use an \"edgeId\", a stringified form of the edgeObj, to\n// reference edges. This is because we need a performant way to look these\n// edges up and, object properties, which have string keys, are the closest\n// we're going to get to a performant hashtable in JavaScript.\n\n// Implementation notes:\n//\n// * Node id query functions should return string ids for the nodes\n// * Edge id query functions should return an \"edgeObj\", edge object, that is\n// composed of enough information to uniquely identify an edge: {v, w, name}.\n// * Internally we use an \"edgeId\", a stringified form of the edgeObj, to\n// reference edges. This is because we need a performant way to look these\n// edges up and, object properties, which have string keys, are the closest\n// we're going to get to a performant hashtable in JavaScript.\nexport class Graph {\n constructor(opts = {}) {\n this._isDirected = _.has(opts, 'directed') ? opts.directed : true;\n this._isMultigraph = _.has(opts, 'multigraph') ? opts.multigraph : false;\n this._isCompound = _.has(opts, 'compound') ? opts.compound : false;\n\n // Label for the graph itself\n this._label = undefined;\n\n // Defaults to be set when creating a new node\n this._defaultNodeLabelFn = _.constant(undefined);\n\n // Defaults to be set when creating a new edge\n this._defaultEdgeLabelFn = _.constant(undefined);\n\n // v -> label\n this._nodes = {};\n\n if (this._isCompound) {\n // v -> parent\n this._parent = {};\n\n // v -> children\n this._children = {};\n this._children[GRAPH_NODE] = {};\n }\n\n // v -> edgeObj\n this._in = {};\n\n // u -> v -> Number\n this._preds = {};\n\n // v -> edgeObj\n this._out = {};\n\n // v -> w -> Number\n this._sucs = {};\n\n // e -> edgeObj\n this._edgeObjs = {};\n\n // e -> label\n this._edgeLabels = {};\n }\n /* === Graph functions ========= */\n isDirected() {\n return this._isDirected;\n }\n isMultigraph() {\n return this._isMultigraph;\n }\n isCompound() {\n return this._isCompound;\n }\n setGraph(label) {\n this._label = label;\n return this;\n }\n graph() {\n return this._label;\n }\n /* === Node functions ========== */\n setDefaultNodeLabel(newDefault) {\n if (!_.isFunction(newDefault)) {\n newDefault = _.constant(newDefault);\n }\n this._defaultNodeLabelFn = newDefault;\n return this;\n }\n nodeCount() {\n return this._nodeCount;\n }\n nodes() {\n return _.keys(this._nodes);\n }\n sources() {\n var self = this;\n return _.filter(this.nodes(), function (v) {\n return _.isEmpty(self._in[v]);\n });\n }\n sinks() {\n var self = this;\n return _.filter(this.nodes(), function (v) {\n return _.isEmpty(self._out[v]);\n });\n }\n setNodes(vs, value) {\n var args = arguments;\n var self = this;\n _.each(vs, function (v) {\n if (args.length > 1) {\n self.setNode(v, value);\n } else {\n self.setNode(v);\n }\n });\n return this;\n }\n setNode(v, value) {\n if (_.has(this._nodes, v)) {\n if (arguments.length > 1) {\n this._nodes[v] = value;\n }\n return this;\n }\n\n // @ts-expect-error\n this._nodes[v] = arguments.length > 1 ? value : this._defaultNodeLabelFn(v);\n if (this._isCompound) {\n this._parent[v] = GRAPH_NODE;\n this._children[v] = {};\n this._children[GRAPH_NODE][v] = true;\n }\n this._in[v] = {};\n this._preds[v] = {};\n this._out[v] = {};\n this._sucs[v] = {};\n ++this._nodeCount;\n return this;\n }\n node(v) {\n return this._nodes[v];\n }\n hasNode(v) {\n return _.has(this._nodes, v);\n }\n removeNode(v) {\n var self = this;\n if (_.has(this._nodes, v)) {\n var removeEdge = function (e) {\n self.removeEdge(self._edgeObjs[e]);\n };\n delete this._nodes[v];\n if (this._isCompound) {\n this._removeFromParentsChildList(v);\n delete this._parent[v];\n _.each(this.children(v), function (child) {\n self.setParent(child);\n });\n delete this._children[v];\n }\n _.each(_.keys(this._in[v]), removeEdge);\n delete this._in[v];\n delete this._preds[v];\n _.each(_.keys(this._out[v]), removeEdge);\n delete this._out[v];\n delete this._sucs[v];\n --this._nodeCount;\n }\n return this;\n }\n setParent(v, parent) {\n if (!this._isCompound) {\n throw new Error('Cannot set parent in a non-compound graph');\n }\n\n if (_.isUndefined(parent)) {\n parent = GRAPH_NODE;\n } else {\n // Coerce parent to string\n parent += '';\n for (var ancestor = parent; !_.isUndefined(ancestor); ancestor = this.parent(ancestor)) {\n if (ancestor === v) {\n throw new Error('Setting ' + parent + ' as parent of ' + v + ' would create a cycle');\n }\n }\n\n this.setNode(parent);\n }\n\n this.setNode(v);\n this._removeFromParentsChildList(v);\n this._parent[v] = parent;\n this._children[parent][v] = true;\n return this;\n }\n _removeFromParentsChildList(v) {\n delete this._children[this._parent[v]][v];\n }\n parent(v) {\n if (this._isCompound) {\n var parent = this._parent[v];\n if (parent !== GRAPH_NODE) {\n return parent;\n }\n }\n }\n children(v) {\n if (_.isUndefined(v)) {\n v = GRAPH_NODE;\n }\n\n if (this._isCompound) {\n var children = this._children[v];\n if (children) {\n return _.keys(children);\n }\n } else if (v === GRAPH_NODE) {\n return this.nodes();\n } else if (this.hasNode(v)) {\n return [];\n }\n }\n predecessors(v) {\n var predsV = this._preds[v];\n if (predsV) {\n return _.keys(predsV);\n }\n }\n successors(v) {\n var sucsV = this._sucs[v];\n if (sucsV) {\n return _.keys(sucsV);\n }\n }\n neighbors(v) {\n var preds = this.predecessors(v);\n if (preds) {\n return _.union(preds, this.successors(v));\n }\n }\n isLeaf(v) {\n var neighbors;\n if (this.isDirected()) {\n neighbors = this.successors(v);\n } else {\n neighbors = this.neighbors(v);\n }\n return neighbors.length === 0;\n }\n filterNodes(filter) {\n // @ts-expect-error\n var copy = new this.constructor({\n directed: this._isDirected,\n multigraph: this._isMultigraph,\n compound: this._isCompound,\n });\n\n copy.setGraph(this.graph());\n\n var self = this;\n _.each(this._nodes, function (value, v) {\n if (filter(v)) {\n copy.setNode(v, value);\n }\n });\n\n _.each(this._edgeObjs, function (e) {\n // @ts-expect-error\n if (copy.hasNode(e.v) && copy.hasNode(e.w)) {\n copy.setEdge(e, self.edge(e));\n }\n });\n\n var parents = {};\n function findParent(v) {\n var parent = self.parent(v);\n if (parent === undefined || copy.hasNode(parent)) {\n parents[v] = parent;\n return parent;\n } else if (parent in parents) {\n return parents[parent];\n } else {\n return findParent(parent);\n }\n }\n\n if (this._isCompound) {\n _.each(copy.nodes(), function (v) {\n copy.setParent(v, findParent(v));\n });\n }\n\n return copy;\n }\n /* === Edge functions ========== */\n setDefaultEdgeLabel(newDefault) {\n if (!_.isFunction(newDefault)) {\n newDefault = _.constant(newDefault);\n }\n this._defaultEdgeLabelFn = newDefault;\n return this;\n }\n edgeCount() {\n return this._edgeCount;\n }\n edges() {\n return _.values(this._edgeObjs);\n }\n setPath(vs, value) {\n var self = this;\n var args = arguments;\n _.reduce(vs, function (v, w) {\n if (args.length > 1) {\n self.setEdge(v, w, value);\n } else {\n self.setEdge(v, w);\n }\n return w;\n });\n return this;\n }\n /*\n * setEdge(v, w, [value, [name]])\n * setEdge({ v, w, [name] }, [value])\n */\n setEdge() {\n var v, w, name, value;\n var valueSpecified = false;\n var arg0 = arguments[0];\n\n if (typeof arg0 === 'object' && arg0 !== null && 'v' in arg0) {\n v = arg0.v;\n w = arg0.w;\n name = arg0.name;\n if (arguments.length === 2) {\n value = arguments[1];\n valueSpecified = true;\n }\n } else {\n v = arg0;\n w = arguments[1];\n name = arguments[3];\n if (arguments.length > 2) {\n value = arguments[2];\n valueSpecified = true;\n }\n }\n\n v = '' + v;\n w = '' + w;\n if (!_.isUndefined(name)) {\n name = '' + name;\n }\n\n var e = edgeArgsToId(this._isDirected, v, w, name);\n if (_.has(this._edgeLabels, e)) {\n if (valueSpecified) {\n this._edgeLabels[e] = value;\n }\n return this;\n }\n\n if (!_.isUndefined(name) && !this._isMultigraph) {\n throw new Error('Cannot set a named edge when isMultigraph = false');\n }\n\n // It didn't exist, so we need to create it.\n // First ensure the nodes exist.\n this.setNode(v);\n this.setNode(w);\n\n // @ts-expect-error\n this._edgeLabels[e] = valueSpecified ? value : this._defaultEdgeLabelFn(v, w, name);\n\n var edgeObj = edgeArgsToObj(this._isDirected, v, w, name);\n // Ensure we add undirected edges in a consistent way.\n v = edgeObj.v;\n w = edgeObj.w;\n\n Object.freeze(edgeObj);\n this._edgeObjs[e] = edgeObj;\n incrementOrInitEntry(this._preds[w], v);\n incrementOrInitEntry(this._sucs[v], w);\n this._in[w][e] = edgeObj;\n this._out[v][e] = edgeObj;\n this._edgeCount++;\n return this;\n }\n edge(v, w, name) {\n var e =\n arguments.length === 1\n ? edgeObjToId(this._isDirected, arguments[0])\n : edgeArgsToId(this._isDirected, v, w, name);\n return this._edgeLabels[e];\n }\n hasEdge(v, w, name) {\n var e =\n arguments.length === 1\n ? edgeObjToId(this._isDirected, arguments[0])\n : edgeArgsToId(this._isDirected, v, w, name);\n return _.has(this._edgeLabels, e);\n }\n removeEdge(v, w, name) {\n var e =\n arguments.length === 1\n ? edgeObjToId(this._isDirected, arguments[0])\n : edgeArgsToId(this._isDirected, v, w, name);\n var edge = this._edgeObjs[e];\n if (edge) {\n v = edge.v;\n w = edge.w;\n delete this._edgeLabels[e];\n delete this._edgeObjs[e];\n decrementOrRemoveEntry(this._preds[w], v);\n decrementOrRemoveEntry(this._sucs[v], w);\n delete this._in[w][e];\n delete this._out[v][e];\n this._edgeCount--;\n }\n return this;\n }\n inEdges(v, u) {\n var inV = this._in[v];\n if (inV) {\n var edges = _.values(inV);\n if (!u) {\n return edges;\n }\n return _.filter(edges, function (edge) {\n return edge.v === u;\n });\n }\n }\n outEdges(v, w) {\n var outV = this._out[v];\n if (outV) {\n var edges = _.values(outV);\n if (!w) {\n return edges;\n }\n return _.filter(edges, function (edge) {\n return edge.w === w;\n });\n }\n }\n nodeEdges(v, w) {\n var inEdges = this.inEdges(v, w);\n if (inEdges) {\n return inEdges.concat(this.outEdges(v, w));\n }\n }\n}\n\n/* Number of nodes in the graph. Should only be changed by the implementation. */\nGraph.prototype._nodeCount = 0;\n\n/* Number of edges in the graph. Should only be changed by the implementation. */\nGraph.prototype._edgeCount = 0;\n\nfunction incrementOrInitEntry(map, k) {\n if (map[k]) {\n map[k]++;\n } else {\n map[k] = 1;\n }\n}\n\nfunction decrementOrRemoveEntry(map, k) {\n if (!--map[k]) {\n delete map[k];\n }\n}\n\nfunction edgeArgsToId(isDirected, v_, w_, name) {\n var v = '' + v_;\n var w = '' + w_;\n if (!isDirected && v > w) {\n var tmp = v;\n v = w;\n w = tmp;\n }\n return v + EDGE_KEY_DELIM + w + EDGE_KEY_DELIM + (_.isUndefined(name) ? DEFAULT_EDGE_NAME : name);\n}\n\nfunction edgeArgsToObj(isDirected, v_, w_, name) {\n var v = '' + v_;\n var w = '' + w_;\n if (!isDirected && v > w) {\n var tmp = v;\n v = w;\n w = tmp;\n }\n var edgeObj = { v: v, w: w };\n if (name) {\n edgeObj.name = name;\n }\n return edgeObj;\n}\n\nfunction edgeObjToId(isDirected, edgeObj) {\n return edgeArgsToId(isDirected, edgeObj.v, edgeObj.w, edgeObj.name);\n}\n", "// Includes only the \"core\" of graphlib\n\nimport { Graph } from './graph.js';\n\nconst version = '2.1.9-pre';\n\nexport { Graph, version };\n", "/*\n * Simple doubly linked list implementation derived from Cormen, et al.,\n * \"Introduction to Algorithms\".\n */\n\nexport { List };\n\nclass List {\n constructor() {\n var sentinel = {};\n sentinel._next = sentinel._prev = sentinel;\n this._sentinel = sentinel;\n }\n dequeue() {\n var sentinel = this._sentinel;\n var entry = sentinel._prev;\n if (entry !== sentinel) {\n unlink(entry);\n return entry;\n }\n }\n enqueue(entry) {\n var sentinel = this._sentinel;\n if (entry._prev && entry._next) {\n unlink(entry);\n }\n entry._next = sentinel._next;\n sentinel._next._prev = entry;\n sentinel._next = entry;\n entry._prev = sentinel;\n }\n toString() {\n var strs = [];\n var sentinel = this._sentinel;\n var curr = sentinel._prev;\n while (curr !== sentinel) {\n strs.push(JSON.stringify(curr, filterOutLinks));\n curr = curr._prev;\n }\n return '[' + strs.join(', ') + ']';\n }\n}\n\nfunction unlink(entry) {\n entry._prev._next = entry._next;\n entry._next._prev = entry._prev;\n delete entry._next;\n delete entry._prev;\n}\n\nfunction filterOutLinks(k, v) {\n if (k !== '_next' && k !== '_prev') {\n return v;\n }\n}\n", "import * as _ from 'lodash-es';\nimport { Graph } from '../graphlib/index.js';\nimport { List } from './data/list.js';\n\n/*\n * A greedy heuristic for finding a feedback arc set for a graph. A feedback\n * arc set is a set of edges that can be removed to make a graph acyclic.\n * The algorithm comes from: P. Eades, X. Lin, and W. F. Smyth, \"A fast and\n * effective heuristic for the feedback arc set problem.\" This implementation\n * adjusts that from the paper to allow for weighted edges.\n */\nexport { greedyFAS };\n\nvar DEFAULT_WEIGHT_FN = _.constant(1);\n\nfunction greedyFAS(g, weightFn) {\n if (g.nodeCount() <= 1) {\n return [];\n }\n var state = buildState(g, weightFn || DEFAULT_WEIGHT_FN);\n var results = doGreedyFAS(state.graph, state.buckets, state.zeroIdx);\n\n // Expand multi-edges\n return _.flatten(\n _.map(results, function (e) {\n return g.outEdges(e.v, e.w);\n })\n );\n}\n\nfunction doGreedyFAS(g, buckets, zeroIdx) {\n var results = [];\n var sources = buckets[buckets.length - 1];\n var sinks = buckets[0];\n\n var entry;\n while (g.nodeCount()) {\n while ((entry = sinks.dequeue())) {\n removeNode(g, buckets, zeroIdx, entry);\n }\n while ((entry = sources.dequeue())) {\n removeNode(g, buckets, zeroIdx, entry);\n }\n if (g.nodeCount()) {\n for (var i = buckets.length - 2; i > 0; --i) {\n entry = buckets[i].dequeue();\n if (entry) {\n results = results.concat(removeNode(g, buckets, zeroIdx, entry, true));\n break;\n }\n }\n }\n }\n\n return results;\n}\n\nfunction removeNode(g, buckets, zeroIdx, entry, collectPredecessors) {\n var results = collectPredecessors ? [] : undefined;\n\n _.forEach(g.inEdges(entry.v), function (edge) {\n var weight = g.edge(edge);\n var uEntry = g.node(edge.v);\n\n if (collectPredecessors) {\n results.push({ v: edge.v, w: edge.w });\n }\n\n uEntry.out -= weight;\n assignBucket(buckets, zeroIdx, uEntry);\n });\n\n _.forEach(g.outEdges(entry.v), function (edge) {\n var weight = g.edge(edge);\n var w = edge.w;\n var wEntry = g.node(w);\n wEntry['in'] -= weight;\n assignBucket(buckets, zeroIdx, wEntry);\n });\n\n g.removeNode(entry.v);\n\n return results;\n}\n\nfunction buildState(g, weightFn) {\n var fasGraph = new Graph();\n var maxIn = 0;\n var maxOut = 0;\n\n _.forEach(g.nodes(), function (v) {\n fasGraph.setNode(v, { v: v, in: 0, out: 0 });\n });\n\n // Aggregate weights on nodes, but also sum the weights across multi-edges\n // into a single edge for the fasGraph.\n _.forEach(g.edges(), function (e) {\n var prevWeight = fasGraph.edge(e.v, e.w) || 0;\n var weight = weightFn(e);\n var edgeWeight = prevWeight + weight;\n fasGraph.setEdge(e.v, e.w, edgeWeight);\n maxOut = Math.max(maxOut, (fasGraph.node(e.v).out += weight));\n maxIn = Math.max(maxIn, (fasGraph.node(e.w)['in'] += weight));\n });\n\n var buckets = _.range(maxOut + maxIn + 3).map(function () {\n return new List();\n });\n var zeroIdx = maxIn + 1;\n\n _.forEach(fasGraph.nodes(), function (v) {\n assignBucket(buckets, zeroIdx, fasGraph.node(v));\n });\n\n return { graph: fasGraph, buckets: buckets, zeroIdx: zeroIdx };\n}\n\nfunction assignBucket(buckets, zeroIdx, entry) {\n if (!entry.out) {\n buckets[0].enqueue(entry);\n } else if (!entry['in']) {\n buckets[buckets.length - 1].enqueue(entry);\n } else {\n buckets[entry.out - entry['in'] + zeroIdx].enqueue(entry);\n }\n}\n", "import * as _ from 'lodash-es';\nimport { greedyFAS } from './greedy-fas.js';\n\nexport { run, undo };\n\nfunction run(g) {\n var fas = g.graph().acyclicer === 'greedy' ? greedyFAS(g, weightFn(g)) : dfsFAS(g);\n _.forEach(fas, function (e) {\n var label = g.edge(e);\n g.removeEdge(e);\n label.forwardName = e.name;\n label.reversed = true;\n g.setEdge(e.w, e.v, label, _.uniqueId('rev'));\n });\n\n function weightFn(g) {\n return function (e) {\n return g.edge(e).weight;\n };\n }\n}\n\nfunction dfsFAS(g) {\n var fas = [];\n var stack = {};\n var visited = {};\n\n function dfs(v) {\n if (_.has(visited, v)) {\n return;\n }\n visited[v] = true;\n stack[v] = true;\n _.forEach(g.outEdges(v), function (e) {\n if (_.has(stack, e.w)) {\n fas.push(e);\n } else {\n dfs(e.w);\n }\n });\n delete stack[v];\n }\n\n _.forEach(g.nodes(), dfs);\n return fas;\n}\n\nfunction undo(g) {\n _.forEach(g.edges(), function (e) {\n var label = g.edge(e);\n if (label.reversed) {\n g.removeEdge(e);\n\n var forwardName = label.forwardName;\n delete label.reversed;\n delete label.forwardName;\n g.setEdge(e.w, e.v, label, forwardName);\n }\n });\n}\n", "import * as _ from 'lodash-es';\nimport { Graph } from '../graphlib/index.js';\n\nexport {\n addDummyNode,\n simplify,\n asNonCompoundGraph,\n successorWeights,\n predecessorWeights,\n intersectRect,\n buildLayerMatrix,\n normalizeRanks,\n removeEmptyRanks,\n addBorderNode,\n maxRank,\n partition,\n time,\n notime,\n};\n\n/*\n * Adds a dummy node to the graph and return v.\n */\nfunction addDummyNode(g, type, attrs, name) {\n var v;\n do {\n v = _.uniqueId(name);\n } while (g.hasNode(v));\n\n attrs.dummy = type;\n g.setNode(v, attrs);\n return v;\n}\n\n/*\n * Returns a new graph with only simple edges. Handles aggregation of data\n * associated with multi-edges.\n */\nfunction simplify(g) {\n var simplified = new Graph().setGraph(g.graph());\n _.forEach(g.nodes(), function (v) {\n simplified.setNode(v, g.node(v));\n });\n _.forEach(g.edges(), function (e) {\n var simpleLabel = simplified.edge(e.v, e.w) || { weight: 0, minlen: 1 };\n var label = g.edge(e);\n simplified.setEdge(e.v, e.w, {\n weight: simpleLabel.weight + label.weight,\n minlen: Math.max(simpleLabel.minlen, label.minlen),\n });\n });\n return simplified;\n}\n\nfunction asNonCompoundGraph(g) {\n var simplified = new Graph({ multigraph: g.isMultigraph() }).setGraph(g.graph());\n _.forEach(g.nodes(), function (v) {\n if (!g.children(v).length) {\n simplified.setNode(v, g.node(v));\n }\n });\n _.forEach(g.edges(), function (e) {\n simplified.setEdge(e, g.edge(e));\n });\n return simplified;\n}\n\nfunction successorWeights(g) {\n var weightMap = _.map(g.nodes(), function (v) {\n var sucs = {};\n _.forEach(g.outEdges(v), function (e) {\n sucs[e.w] = (sucs[e.w] || 0) + g.edge(e).weight;\n });\n return sucs;\n });\n return _.zipObject(g.nodes(), weightMap);\n}\n\nfunction predecessorWeights(g) {\n var weightMap = _.map(g.nodes(), function (v) {\n var preds = {};\n _.forEach(g.inEdges(v), function (e) {\n preds[e.v] = (preds[e.v] || 0) + g.edge(e).weight;\n });\n return preds;\n });\n return _.zipObject(g.nodes(), weightMap);\n}\n\n/*\n * Finds where a line starting at point ({x, y}) would intersect a rectangle\n * ({x, y, width, height}) if it were pointing at the rectangle's center.\n */\nfunction intersectRect(rect, point) {\n var x = rect.x;\n var y = rect.y;\n\n // Rectangle intersection algorithm from:\n // http://math.stackexchange.com/questions/108113/find-edge-between-two-boxes\n var dx = point.x - x;\n var dy = point.y - y;\n var w = rect.width / 2;\n var h = rect.height / 2;\n\n if (!dx && !dy) {\n throw new Error('Not possible to find intersection inside of the rectangle');\n }\n\n var sx, sy;\n if (Math.abs(dy) * w > Math.abs(dx) * h) {\n // Intersection is top or bottom of rect.\n if (dy < 0) {\n h = -h;\n }\n sx = (h * dx) / dy;\n sy = h;\n } else {\n // Intersection is left or right of rect.\n if (dx < 0) {\n w = -w;\n }\n sx = w;\n sy = (w * dy) / dx;\n }\n\n return { x: x + sx, y: y + sy };\n}\n\n/*\n * Given a DAG with each node assigned \"rank\" and \"order\" properties, this\n * function will produce a matrix with the ids of each node.\n */\nfunction buildLayerMatrix(g) {\n var layering = _.map(_.range(maxRank(g) + 1), function () {\n return [];\n });\n _.forEach(g.nodes(), function (v) {\n var node = g.node(v);\n var rank = node.rank;\n if (!_.isUndefined(rank)) {\n layering[rank][node.order] = v;\n }\n });\n return layering;\n}\n\n/*\n * Adjusts the ranks for all nodes in the graph such that all nodes v have\n * rank(v) >= 0 and at least one node w has rank(w) = 0.\n */\nfunction normalizeRanks(g) {\n var min = _.min(\n _.map(g.nodes(), function (v) {\n return g.node(v).rank;\n })\n );\n _.forEach(g.nodes(), function (v) {\n var node = g.node(v);\n if (_.has(node, 'rank')) {\n node.rank -= min;\n }\n });\n}\n\nfunction removeEmptyRanks(g) {\n // Ranks may not start at 0, so we need to offset them\n var offset = _.min(\n _.map(g.nodes(), function (v) {\n return g.node(v).rank;\n })\n );\n\n var layers = [];\n _.forEach(g.nodes(), function (v) {\n var rank = g.node(v).rank - offset;\n if (!layers[rank]) {\n layers[rank] = [];\n }\n layers[rank].push(v);\n });\n\n var delta = 0;\n var nodeRankFactor = g.graph().nodeRankFactor;\n _.forEach(layers, function (vs, i) {\n if (_.isUndefined(vs) && i % nodeRankFactor !== 0) {\n --delta;\n } else if (delta) {\n _.forEach(vs, function (v) {\n g.node(v).rank += delta;\n });\n }\n });\n}\n\nfunction addBorderNode(g, prefix, rank, order) {\n var node = {\n width: 0,\n height: 0,\n };\n if (arguments.length >= 4) {\n node.rank = rank;\n node.order = order;\n }\n return addDummyNode(g, 'border', node, prefix);\n}\n\nfunction maxRank(g) {\n return _.max(\n _.map(g.nodes(), function (v) {\n var rank = g.node(v).rank;\n if (!_.isUndefined(rank)) {\n return rank;\n }\n })\n );\n}\n\n/*\n * Partition a collection into two groups: `lhs` and `rhs`. If the supplied\n * function returns true for an entry it goes into `lhs`. Otherwise it goes\n * into `rhs.\n */\nfunction partition(collection, fn) {\n var result = { lhs: [], rhs: [] };\n _.forEach(collection, function (value) {\n if (fn(value)) {\n result.lhs.push(value);\n } else {\n result.rhs.push(value);\n }\n });\n return result;\n}\n\n/*\n * Returns a new function that wraps `fn` with a timer. The wrapper logs the\n * time it takes to execute the function.\n */\nfunction time(name, fn) {\n var start = _.now();\n try {\n return fn();\n } finally {\n console.log(name + ' time: ' + (_.now() - start) + 'ms');\n }\n}\n\nfunction notime(name, fn) {\n return fn();\n}\n", "import * as _ from 'lodash-es';\nimport * as util from './util.js';\n\nexport { addBorderSegments };\n\nfunction addBorderSegments(g) {\n function dfs(v) {\n var children = g.children(v);\n var node = g.node(v);\n if (children.length) {\n _.forEach(children, dfs);\n }\n\n if (_.has(node, 'minRank')) {\n node.borderLeft = [];\n node.borderRight = [];\n for (var rank = node.minRank, maxRank = node.maxRank + 1; rank < maxRank; ++rank) {\n addBorderNode(g, 'borderLeft', '_bl', v, node, rank);\n addBorderNode(g, 'borderRight', '_br', v, node, rank);\n }\n }\n }\n\n _.forEach(g.children(), dfs);\n}\n\nfunction addBorderNode(g, prop, prefix, sg, sgNode, rank) {\n var label = { width: 0, height: 0, rank: rank, borderType: prop };\n var prev = sgNode[prop][rank - 1];\n var curr = util.addDummyNode(g, 'border', label, prefix);\n sgNode[prop][rank] = curr;\n g.setParent(curr, sg);\n if (prev) {\n g.setEdge(prev, curr, { weight: 1 });\n }\n}\n", "import * as _ from 'lodash-es';\n\nexport { adjust, undo };\n\nfunction adjust(g) {\n var rankDir = g.graph().rankdir.toLowerCase();\n if (rankDir === 'lr' || rankDir === 'rl') {\n swapWidthHeight(g);\n }\n}\n\nfunction undo(g) {\n var rankDir = g.graph().rankdir.toLowerCase();\n if (rankDir === 'bt' || rankDir === 'rl') {\n reverseY(g);\n }\n\n if (rankDir === 'lr' || rankDir === 'rl') {\n swapXY(g);\n swapWidthHeight(g);\n }\n}\n\nfunction swapWidthHeight(g) {\n _.forEach(g.nodes(), function (v) {\n swapWidthHeightOne(g.node(v));\n });\n _.forEach(g.edges(), function (e) {\n swapWidthHeightOne(g.edge(e));\n });\n}\n\nfunction swapWidthHeightOne(attrs) {\n var w = attrs.width;\n attrs.width = attrs.height;\n attrs.height = w;\n}\n\nfunction reverseY(g) {\n _.forEach(g.nodes(), function (v) {\n reverseYOne(g.node(v));\n });\n\n _.forEach(g.edges(), function (e) {\n var edge = g.edge(e);\n _.forEach(edge.points, reverseYOne);\n if (_.has(edge, 'y')) {\n reverseYOne(edge);\n }\n });\n}\n\nfunction reverseYOne(attrs) {\n attrs.y = -attrs.y;\n}\n\nfunction swapXY(g) {\n _.forEach(g.nodes(), function (v) {\n swapXYOne(g.node(v));\n });\n\n _.forEach(g.edges(), function (e) {\n var edge = g.edge(e);\n _.forEach(edge.points, swapXYOne);\n if (_.has(edge, 'x')) {\n swapXYOne(edge);\n }\n });\n}\n\nfunction swapXYOne(attrs) {\n var x = attrs.x;\n attrs.x = attrs.y;\n attrs.y = x;\n}\n", "import * as _ from 'lodash-es';\nimport * as util from './util.js';\n\nexport { run, undo };\n\n/*\n * Breaks any long edges in the graph into short segments that span 1 layer\n * each. This operation is undoable with the denormalize function.\n *\n * Pre-conditions:\n *\n * 1. The input graph is a DAG.\n * 2. Each node in the graph has a \"rank\" property.\n *\n * Post-condition:\n *\n * 1. All edges in the graph have a length of 1.\n * 2. Dummy nodes are added where edges have been split into segments.\n * 3. The graph is augmented with a \"dummyChains\" attribute which contains\n * the first dummy in each chain of dummy nodes produced.\n */\nfunction run(g) {\n g.graph().dummyChains = [];\n _.forEach(g.edges(), function (edge) {\n normalizeEdge(g, edge);\n });\n}\n\nfunction normalizeEdge(g, e) {\n var v = e.v;\n var vRank = g.node(v).rank;\n var w = e.w;\n var wRank = g.node(w).rank;\n var name = e.name;\n var edgeLabel = g.edge(e);\n var labelRank = edgeLabel.labelRank;\n\n if (wRank === vRank + 1) return;\n\n g.removeEdge(e);\n\n var dummy, attrs, i;\n for (i = 0, ++vRank; vRank < wRank; ++i, ++vRank) {\n edgeLabel.points = [];\n attrs = {\n width: 0,\n height: 0,\n edgeLabel: edgeLabel,\n edgeObj: e,\n rank: vRank,\n };\n dummy = util.addDummyNode(g, 'edge', attrs, '_d');\n if (vRank === labelRank) {\n attrs.width = edgeLabel.width;\n attrs.height = edgeLabel.height;\n // @ts-expect-error\n attrs.dummy = 'edge-label';\n // @ts-expect-error\n attrs.labelpos = edgeLabel.labelpos;\n }\n g.setEdge(v, dummy, { weight: edgeLabel.weight }, name);\n if (i === 0) {\n g.graph().dummyChains.push(dummy);\n }\n v = dummy;\n }\n\n g.setEdge(v, w, { weight: edgeLabel.weight }, name);\n}\n\nfunction undo(g) {\n _.forEach(g.graph().dummyChains, function (v) {\n var node = g.node(v);\n var origLabel = node.edgeLabel;\n var w;\n g.setEdge(node.edgeObj, origLabel);\n while (node.dummy) {\n w = g.successors(v)[0];\n g.removeNode(v);\n origLabel.points.push({ x: node.x, y: node.y });\n if (node.dummy === 'edge-label') {\n origLabel.x = node.x;\n origLabel.y = node.y;\n origLabel.width = node.width;\n origLabel.height = node.height;\n }\n v = w;\n node = g.node(v);\n }\n });\n}\n", "import * as _ from 'lodash-es';\n\nexport { longestPath, slack };\n\n/*\n * Initializes ranks for the input graph using the longest path algorithm. This\n * algorithm scales well and is fast in practice, it yields rather poor\n * solutions. Nodes are pushed to the lowest layer possible, leaving the bottom\n * ranks wide and leaving edges longer than necessary. However, due to its\n * speed, this algorithm is good for getting an initial ranking that can be fed\n * into other algorithms.\n *\n * This algorithm does not normalize layers because it will be used by other\n * algorithms in most cases. If using this algorithm directly, be sure to\n * run normalize at the end.\n *\n * Pre-conditions:\n *\n * 1. Input graph is a DAG.\n * 2. Input graph node labels can be assigned properties.\n *\n * Post-conditions:\n *\n * 1. Each node will be assign an (unnormalized) \"rank\" property.\n */\nfunction longestPath(g) {\n var visited = {};\n\n function dfs(v) {\n var label = g.node(v);\n if (_.has(visited, v)) {\n return label.rank;\n }\n visited[v] = true;\n\n var rank = _.min(\n _.map(g.outEdges(v), function (e) {\n return dfs(e.w) - g.edge(e).minlen;\n })\n );\n\n if (\n rank === Number.POSITIVE_INFINITY || // return value of _.map([]) for Lodash 3\n rank === undefined || // return value of _.map([]) for Lodash 4\n rank === null\n ) {\n // return value of _.map([null])\n rank = 0;\n }\n\n return (label.rank = rank);\n }\n\n _.forEach(g.sources(), dfs);\n}\n\n/*\n * Returns the amount of slack for the given edge. The slack is defined as the\n * difference between the length of the edge and its minimum length.\n */\nfunction slack(g, e) {\n return g.node(e.w).rank - g.node(e.v).rank - g.edge(e).minlen;\n}\n", "import * as _ from 'lodash-es';\nimport { Graph } from '../../graphlib/index.js';\nimport { slack } from './util.js';\n\nexport { feasibleTree };\n\n/*\n * Constructs a spanning tree with tight edges and adjusted the input node's\n * ranks to achieve this. A tight edge is one that is has a length that matches\n * its \"minlen\" attribute.\n *\n * The basic structure for this function is derived from Gansner, et al., \"A\n * Technique for Drawing Directed Graphs.\"\n *\n * Pre-conditions:\n *\n * 1. Graph must be a DAG.\n * 2. Graph must be connected.\n * 3. Graph must have at least one node.\n * 5. Graph nodes must have been previously assigned a \"rank\" property that\n * respects the \"minlen\" property of incident edges.\n * 6. Graph edges must have a \"minlen\" property.\n *\n * Post-conditions:\n *\n * - Graph nodes will have their rank adjusted to ensure that all edges are\n * tight.\n *\n * Returns a tree (undirected graph) that is constructed using only \"tight\"\n * edges.\n */\nfunction feasibleTree(g) {\n var t = new Graph({ directed: false });\n\n // Choose arbitrary node from which to start our tree\n var start = g.nodes()[0];\n var size = g.nodeCount();\n t.setNode(start, {});\n\n var edge, delta;\n while (tightTree(t, g) < size) {\n edge = findMinSlackEdge(t, g);\n delta = t.hasNode(edge.v) ? slack(g, edge) : -slack(g, edge);\n shiftRanks(t, g, delta);\n }\n\n return t;\n}\n\n/*\n * Finds a maximal tree of tight edges and returns the number of nodes in the\n * tree.\n */\nfunction tightTree(t, g) {\n function dfs(v) {\n _.forEach(g.nodeEdges(v), function (e) {\n var edgeV = e.v,\n w = v === edgeV ? e.w : edgeV;\n if (!t.hasNode(w) && !slack(g, e)) {\n t.setNode(w, {});\n t.setEdge(v, w, {});\n dfs(w);\n }\n });\n }\n\n _.forEach(t.nodes(), dfs);\n return t.nodeCount();\n}\n\n/*\n * Finds the edge with the smallest slack that is incident on tree and returns\n * it.\n */\nfunction findMinSlackEdge(t, g) {\n return _.minBy(g.edges(), function (e) {\n if (t.hasNode(e.v) !== t.hasNode(e.w)) {\n return slack(g, e);\n }\n });\n}\n\nfunction shiftRanks(t, g, delta) {\n _.forEach(t.nodes(), function (v) {\n g.node(v).rank += delta;\n });\n}\n", "import * as _ from 'lodash-es';\n\nexport { components };\n\nfunction components(g) {\n var visited = {};\n var cmpts = [];\n var cmpt;\n\n function dfs(v) {\n if (_.has(visited, v)) return;\n visited[v] = true;\n cmpt.push(v);\n _.each(g.successors(v), dfs);\n _.each(g.predecessors(v), dfs);\n }\n\n _.each(g.nodes(), function (v) {\n cmpt = [];\n dfs(v);\n if (cmpt.length) {\n cmpts.push(cmpt);\n }\n });\n\n return cmpts;\n}\n", "import * as _ from 'lodash-es';\n\nexport { PriorityQueue };\n\n/**\n * A min-priority queue data structure. This algorithm is derived from Cormen,\n * et al., \"Introduction to Algorithms\". The basic idea of a min-priority\n * queue is that you can efficiently (in O(1) time) get the smallest key in\n * the queue. Adding and removing elements takes O(log n) time. A key can\n * have its priority decreased in O(log n) time.\n */\nclass PriorityQueue {\n constructor() {\n this._arr = [];\n this._keyIndices = {};\n }\n /**\n * Returns the number of elements in the queue. Takes `O(1)` time.\n */\n size() {\n return this._arr.length;\n }\n /**\n * Returns the keys that are in the queue. Takes `O(n)` time.\n */\n keys() {\n return this._arr.map(function (x) {\n return x.key;\n });\n }\n /**\n * Returns `true` if **key** is in the queue and `false` if not.\n */\n has(key) {\n return _.has(this._keyIndices, key);\n }\n /**\n * Returns the priority for **key**. If **key** is not present in the queue\n * then this function returns `undefined`. Takes `O(1)` time.\n *\n * @param {Object} key\n */\n priority(key) {\n var index = this._keyIndices[key];\n if (index !== undefined) {\n return this._arr[index].priority;\n }\n }\n /**\n * Returns the key for the minimum element in this queue. If the queue is\n * empty this function throws an Error. Takes `O(1)` time.\n */\n min() {\n if (this.size() === 0) {\n throw new Error('Queue underflow');\n }\n return this._arr[0].key;\n }\n /**\n * Inserts a new key into the priority queue. If the key already exists in\n * the queue this function returns `false`; otherwise it will return `true`.\n * Takes `O(n)` time.\n *\n * @param {Object} key the key to add\n * @param {Number} priority the initial priority for the key\n */\n add(key, priority) {\n var keyIndices = this._keyIndices;\n key = String(key);\n if (!_.has(keyIndices, key)) {\n var arr = this._arr;\n var index = arr.length;\n keyIndices[key] = index;\n arr.push({ key: key, priority: priority });\n this._decrease(index);\n return true;\n }\n return false;\n }\n /**\n * Removes and returns the smallest key in the queue. Takes `O(log n)` time.\n */\n removeMin() {\n this._swap(0, this._arr.length - 1);\n var min = this._arr.pop();\n delete this._keyIndices[min.key];\n this._heapify(0);\n return min.key;\n }\n /**\n * Decreases the priority for **key** to **priority**. If the new priority is\n * greater than the previous priority, this function will throw an Error.\n *\n * @param {Object} key the key for which to raise priority\n * @param {Number} priority the new priority for the key\n */\n decrease(key, priority) {\n var index = this._keyIndices[key];\n if (priority > this._arr[index].priority) {\n throw new Error(\n 'New priority is greater than current priority. ' +\n 'Key: ' +\n key +\n ' Old: ' +\n this._arr[index].priority +\n ' New: ' +\n priority\n );\n }\n this._arr[index].priority = priority;\n this._decrease(index);\n }\n _heapify(i) {\n var arr = this._arr;\n var l = 2 * i;\n var r = l + 1;\n var largest = i;\n if (l < arr.length) {\n largest = arr[l].priority < arr[largest].priority ? l : largest;\n if (r < arr.length) {\n largest = arr[r].priority < arr[largest].priority ? r : largest;\n }\n if (largest !== i) {\n this._swap(i, largest);\n this._heapify(largest);\n }\n }\n }\n _decrease(index) {\n var arr = this._arr;\n var priority = arr[index].priority;\n var parent;\n while (index !== 0) {\n parent = index >> 1;\n if (arr[parent].priority < priority) {\n break;\n }\n this._swap(index, parent);\n index = parent;\n }\n }\n _swap(i, j) {\n var arr = this._arr;\n var keyIndices = this._keyIndices;\n var origArrI = arr[i];\n var origArrJ = arr[j];\n arr[i] = origArrJ;\n arr[j] = origArrI;\n keyIndices[origArrJ.key] = i;\n keyIndices[origArrI.key] = j;\n }\n}\n", "import * as _ from 'lodash-es';\nimport { PriorityQueue } from '../data/priority-queue.js';\n\nexport { dijkstra };\n\nvar DEFAULT_WEIGHT_FUNC = _.constant(1);\n\nfunction dijkstra(g, source, weightFn, edgeFn) {\n return runDijkstra(\n g,\n String(source),\n weightFn || DEFAULT_WEIGHT_FUNC,\n edgeFn ||\n function (v) {\n return g.outEdges(v);\n }\n );\n}\n\nfunction runDijkstra(g, source, weightFn, edgeFn) {\n var results = {};\n var pq = new PriorityQueue();\n var v, vEntry;\n\n var updateNeighbors = function (edge) {\n var w = edge.v !== v ? edge.v : edge.w;\n var wEntry = results[w];\n var weight = weightFn(edge);\n var distance = vEntry.distance + weight;\n\n if (weight < 0) {\n throw new Error(\n 'dijkstra does not allow negative edge weights. ' +\n 'Bad edge: ' +\n edge +\n ' Weight: ' +\n weight\n );\n }\n\n if (distance < wEntry.distance) {\n wEntry.distance = distance;\n wEntry.predecessor = v;\n pq.decrease(w, distance);\n }\n };\n\n g.nodes().forEach(function (v) {\n var distance = v === source ? 0 : Number.POSITIVE_INFINITY;\n results[v] = { distance: distance };\n pq.add(v, distance);\n });\n\n while (pq.size() > 0) {\n v = pq.removeMin();\n vEntry = results[v];\n if (vEntry.distance === Number.POSITIVE_INFINITY) {\n break;\n }\n\n edgeFn(v).forEach(updateNeighbors);\n }\n\n return results;\n}\n", "import * as _ from 'lodash-es';\nimport { dijkstra } from './dijkstra.js';\n\nexport { dijkstraAll };\n\nfunction dijkstraAll(g, weightFunc, edgeFunc) {\n return _.transform(\n g.nodes(),\n function (acc, v) {\n acc[v] = dijkstra(g, v, weightFunc, edgeFunc);\n },\n {}\n );\n}\n", "import * as _ from 'lodash-es';\n\nexport { tarjan };\n\nfunction tarjan(g) {\n var index = 0;\n var stack = [];\n var visited = {}; // node id -> { onStack, lowlink, index }\n var results = [];\n\n function dfs(v) {\n var entry = (visited[v] = {\n onStack: true,\n lowlink: index,\n index: index++,\n });\n stack.push(v);\n\n g.successors(v).forEach(function (w) {\n if (!_.has(visited, w)) {\n dfs(w);\n entry.lowlink = Math.min(entry.lowlink, visited[w].lowlink);\n } else if (visited[w].onStack) {\n entry.lowlink = Math.min(entry.lowlink, visited[w].index);\n }\n });\n\n if (entry.lowlink === entry.index) {\n var cmpt = [];\n var w;\n do {\n w = stack.pop();\n visited[w].onStack = false;\n cmpt.push(w);\n } while (v !== w);\n results.push(cmpt);\n }\n }\n\n g.nodes().forEach(function (v) {\n if (!_.has(visited, v)) {\n dfs(v);\n }\n });\n\n return results;\n}\n", "import * as _ from 'lodash-es';\nimport { tarjan } from './tarjan.js';\n\nexport { findCycles };\n\nfunction findCycles(g) {\n return _.filter(tarjan(g), function (cmpt) {\n return cmpt.length > 1 || (cmpt.length === 1 && g.hasEdge(cmpt[0], cmpt[0]));\n });\n}\n", "import * as _ from 'lodash-es';\n\nexport { floydWarshall };\n\nvar DEFAULT_WEIGHT_FUNC = _.constant(1);\n\nfunction floydWarshall(g, weightFn, edgeFn) {\n return runFloydWarshall(\n g,\n weightFn || DEFAULT_WEIGHT_FUNC,\n edgeFn ||\n function (v) {\n return g.outEdges(v);\n }\n );\n}\n\nfunction runFloydWarshall(g, weightFn, edgeFn) {\n var results = {};\n var nodes = g.nodes();\n\n nodes.forEach(function (v) {\n results[v] = {};\n results[v][v] = { distance: 0 };\n nodes.forEach(function (w) {\n if (v !== w) {\n results[v][w] = { distance: Number.POSITIVE_INFINITY };\n }\n });\n edgeFn(v).forEach(function (edge) {\n var w = edge.v === v ? edge.w : edge.v;\n var d = weightFn(edge);\n results[v][w] = { distance: d, predecessor: v };\n });\n });\n\n nodes.forEach(function (k) {\n var rowK = results[k];\n nodes.forEach(function (i) {\n var rowI = results[i];\n nodes.forEach(function (j) {\n var ik = rowI[k];\n var kj = rowK[j];\n var ij = rowI[j];\n var altDistance = ik.distance + kj.distance;\n if (altDistance < ij.distance) {\n ij.distance = altDistance;\n ij.predecessor = kj.predecessor;\n }\n });\n });\n });\n\n return results;\n}\n", "import * as _ from 'lodash-es';\n\nexport { topsort, CycleException };\n\ntopsort.CycleException = CycleException;\n\nfunction topsort(g) {\n var visited = {};\n var stack = {};\n var results = [];\n\n function visit(node) {\n if (_.has(stack, node)) {\n throw new CycleException();\n }\n\n if (!_.has(visited, node)) {\n stack[node] = true;\n visited[node] = true;\n _.each(g.predecessors(node), visit);\n delete stack[node];\n results.push(node);\n }\n }\n\n _.each(g.sinks(), visit);\n\n if (_.size(visited) !== g.nodeCount()) {\n throw new CycleException();\n }\n\n return results;\n}\n\nfunction CycleException() {}\nCycleException.prototype = new Error(); // must be an instance of Error to pass testing\n", "import { topsort, CycleException } from './topsort.js';\n\nexport { isAcyclic };\n\nfunction isAcyclic(g) {\n try {\n topsort(g);\n } catch (e) {\n if (e instanceof CycleException) {\n return false;\n }\n throw e;\n }\n return true;\n}\n", "import * as _ from 'lodash-es';\n\nexport { dfs };\n\n/*\n * A helper that preforms a pre- or post-order traversal on the input graph\n * and returns the nodes in the order they were visited. If the graph is\n * undirected then this algorithm will navigate using neighbors. If the graph\n * is directed then this algorithm will navigate using successors.\n *\n * Order must be one of \"pre\" or \"post\".\n */\nfunction dfs(g, vs, order) {\n if (!_.isArray(vs)) {\n vs = [vs];\n }\n\n var navigation = (g.isDirected() ? g.successors : g.neighbors).bind(g);\n\n var acc = [];\n var visited = {};\n _.each(vs, function (v) {\n if (!g.hasNode(v)) {\n throw new Error('Graph does not have node: ' + v);\n }\n\n doDfs(g, v, order === 'post', visited, navigation, acc);\n });\n return acc;\n}\n\nfunction doDfs(g, v, postorder, visited, navigation, acc) {\n if (!_.has(visited, v)) {\n visited[v] = true;\n\n if (!postorder) {\n acc.push(v);\n }\n _.each(navigation(v), function (w) {\n doDfs(g, w, postorder, visited, navigation, acc);\n });\n if (postorder) {\n acc.push(v);\n }\n }\n}\n", "import { dfs } from './dfs.js';\n\nexport { postorder };\n\nfunction postorder(g, vs) {\n return dfs(g, vs, 'post');\n}\n", "import { dfs } from './dfs.js';\n\nexport { preorder };\n\nfunction preorder(g, vs) {\n return dfs(g, vs, 'pre');\n}\n", "import * as _ from 'lodash-es';\nimport { PriorityQueue } from '../data/priority-queue.js';\nimport { Graph } from '../graph.js';\n\nexport { prim };\n\nfunction prim(g, weightFunc) {\n var result = new Graph();\n var parents = {};\n var pq = new PriorityQueue();\n var v;\n\n function updateNeighbors(edge) {\n var w = edge.v === v ? edge.w : edge.v;\n var pri = pq.priority(w);\n if (pri !== undefined) {\n var edgeWeight = weightFunc(edge);\n if (edgeWeight < pri) {\n parents[w] = v;\n pq.decrease(w, edgeWeight);\n }\n }\n }\n\n if (g.nodeCount() === 0) {\n return result;\n }\n\n _.each(g.nodes(), function (v) {\n pq.add(v, Number.POSITIVE_INFINITY);\n result.setNode(v);\n });\n\n // Start from an arbitrary node\n pq.decrease(g.nodes()[0], 0);\n\n var init = false;\n while (pq.size() > 0) {\n v = pq.removeMin();\n if (_.has(parents, v)) {\n result.setEdge(v, parents[v]);\n } else if (init) {\n throw new Error('Input graph is not connected: ' + g);\n } else {\n init = true;\n }\n\n g.nodeEdges(v).forEach(updateNeighbors);\n }\n\n return result;\n}\n", "import { components } from './components.js';\nimport { dijkstra } from './dijkstra.js';\nimport { dijkstraAll } from './dijkstra-all.js';\nimport { findCycles } from './find-cycles.js';\nimport { floydWarshall } from './floyd-warshall.js';\nimport { isAcyclic } from './is-acyclic.js';\nimport { postorder } from './postorder.js';\nimport { preorder } from './preorder.js';\nimport { prim } from './prim.js';\nimport { tarjan } from './tarjan.js';\nimport { topsort } from './topsort.js';\n\nexport {\n components,\n dijkstra,\n dijkstraAll,\n findCycles,\n floydWarshall,\n isAcyclic,\n postorder,\n preorder,\n prim,\n tarjan,\n topsort,\n};\n", "import * as _ from 'lodash-es';\nimport * as alg from '../../graphlib/alg/index.js';\nimport { simplify } from '../util.js';\nimport { feasibleTree } from './feasible-tree.js';\nimport { longestPath, slack } from './util.js';\n\nexport { networkSimplex };\n\n// Expose some internals for testing purposes\nnetworkSimplex.initLowLimValues = initLowLimValues;\nnetworkSimplex.initCutValues = initCutValues;\nnetworkSimplex.calcCutValue = calcCutValue;\nnetworkSimplex.leaveEdge = leaveEdge;\nnetworkSimplex.enterEdge = enterEdge;\nnetworkSimplex.exchangeEdges = exchangeEdges;\n\n/*\n * The network simplex algorithm assigns ranks to each node in the input graph\n * and iteratively improves the ranking to reduce the length of edges.\n *\n * Preconditions:\n *\n * 1. The input graph must be a DAG.\n * 2. All nodes in the graph must have an object value.\n * 3. All edges in the graph must have \"minlen\" and \"weight\" attributes.\n *\n * Postconditions:\n *\n * 1. All nodes in the graph will have an assigned \"rank\" attribute that has\n * been optimized by the network simplex algorithm. Ranks start at 0.\n *\n *\n * A rough sketch of the algorithm is as follows:\n *\n * 1. Assign initial ranks to each node. We use the longest path algorithm,\n * which assigns ranks to the lowest position possible. In general this\n * leads to very wide bottom ranks and unnecessarily long edges.\n * 2. Construct a feasible tight tree. A tight tree is one such that all\n * edges in the tree have no slack (difference between length of edge\n * and minlen for the edge). This by itself greatly improves the assigned\n * rankings by shorting edges.\n * 3. Iteratively find edges that have negative cut values. Generally a\n * negative cut value indicates that the edge could be removed and a new\n * tree edge could be added to produce a more compact graph.\n *\n * Much of the algorithms here are derived from Gansner, et al., \"A Technique\n * for Drawing Directed Graphs.\" The structure of the file roughly follows the\n * structure of the overall algorithm.\n */\nfunction networkSimplex(g) {\n g = simplify(g);\n longestPath(g);\n var t = feasibleTree(g);\n initLowLimValues(t);\n initCutValues(t, g);\n\n var e, f;\n while ((e = leaveEdge(t))) {\n f = enterEdge(t, g, e);\n exchangeEdges(t, g, e, f);\n }\n}\n\n/*\n * Initializes cut values for all edges in the tree.\n */\nfunction initCutValues(t, g) {\n var vs = alg.postorder(t, t.nodes());\n vs = vs.slice(0, vs.length - 1);\n _.forEach(vs, function (v) {\n assignCutValue(t, g, v);\n });\n}\n\nfunction assignCutValue(t, g, child) {\n var childLab = t.node(child);\n var parent = childLab.parent;\n t.edge(child, parent).cutvalue = calcCutValue(t, g, child);\n}\n\n/*\n * Given the tight tree, its graph, and a child in the graph calculate and\n * return the cut value for the edge between the child and its parent.\n */\nfunction calcCutValue(t, g, child) {\n var childLab = t.node(child);\n var parent = childLab.parent;\n // True if the child is on the tail end of the edge in the directed graph\n var childIsTail = true;\n // The graph's view of the tree edge we're inspecting\n var graphEdge = g.edge(child, parent);\n // The accumulated cut value for the edge between this node and its parent\n var cutValue = 0;\n\n if (!graphEdge) {\n childIsTail = false;\n graphEdge = g.edge(parent, child);\n }\n\n cutValue = graphEdge.weight;\n\n _.forEach(g.nodeEdges(child), function (e) {\n var isOutEdge = e.v === child,\n other = isOutEdge ? e.w : e.v;\n\n if (other !== parent) {\n var pointsToHead = isOutEdge === childIsTail,\n otherWeight = g.edge(e).weight;\n\n cutValue += pointsToHead ? otherWeight : -otherWeight;\n if (isTreeEdge(t, child, other)) {\n var otherCutValue = t.edge(child, other).cutvalue;\n cutValue += pointsToHead ? -otherCutValue : otherCutValue;\n }\n }\n });\n\n return cutValue;\n}\n\nfunction initLowLimValues(tree, root) {\n if (arguments.length < 2) {\n root = tree.nodes()[0];\n }\n dfsAssignLowLim(tree, {}, 1, root);\n}\n\nfunction dfsAssignLowLim(tree, visited, nextLim, v, parent) {\n var low = nextLim;\n var label = tree.node(v);\n\n visited[v] = true;\n _.forEach(tree.neighbors(v), function (w) {\n if (!_.has(visited, w)) {\n nextLim = dfsAssignLowLim(tree, visited, nextLim, w, v);\n }\n });\n\n label.low = low;\n label.lim = nextLim++;\n if (parent) {\n label.parent = parent;\n } else {\n // TODO should be able to remove this when we incrementally update low lim\n delete label.parent;\n }\n\n return nextLim;\n}\n\nfunction leaveEdge(tree) {\n return _.find(tree.edges(), function (e) {\n return tree.edge(e).cutvalue < 0;\n });\n}\n\nfunction enterEdge(t, g, edge) {\n var v = edge.v;\n var w = edge.w;\n\n // For the rest of this function we assume that v is the tail and w is the\n // head, so if we don't have this edge in the graph we should flip it to\n // match the correct orientation.\n if (!g.hasEdge(v, w)) {\n v = edge.w;\n w = edge.v;\n }\n\n var vLabel = t.node(v);\n var wLabel = t.node(w);\n var tailLabel = vLabel;\n var flip = false;\n\n // If the root is in the tail of the edge then we need to flip the logic that\n // checks for the head and tail nodes in the candidates function below.\n if (vLabel.lim > wLabel.lim) {\n tailLabel = wLabel;\n flip = true;\n }\n\n var candidates = _.filter(g.edges(), function (edge) {\n return (\n flip === isDescendant(t, t.node(edge.v), tailLabel) &&\n flip !== isDescendant(t, t.node(edge.w), tailLabel)\n );\n });\n\n return _.minBy(candidates, function (edge) {\n return slack(g, edge);\n });\n}\n\nfunction exchangeEdges(t, g, e, f) {\n var v = e.v;\n var w = e.w;\n t.removeEdge(v, w);\n t.setEdge(f.v, f.w, {});\n initLowLimValues(t);\n initCutValues(t, g);\n updateRanks(t, g);\n}\n\nfunction updateRanks(t, g) {\n var root = _.find(t.nodes(), function (v) {\n return !g.node(v).parent;\n });\n var vs = alg.preorder(t, root);\n vs = vs.slice(1);\n _.forEach(vs, function (v) {\n var parent = t.node(v).parent,\n edge = g.edge(v, parent),\n flipped = false;\n\n if (!edge) {\n edge = g.edge(parent, v);\n flipped = true;\n }\n\n g.node(v).rank = g.node(parent).rank + (flipped ? edge.minlen : -edge.minlen);\n });\n}\n\n/*\n * Returns true if the edge is in the tree.\n */\nfunction isTreeEdge(tree, u, v) {\n return tree.hasEdge(u, v);\n}\n\n/*\n * Returns true if the specified node is descendant of the root node per the\n * assigned low and lim attributes in the tree.\n */\nfunction isDescendant(tree, vLabel, rootLabel) {\n return rootLabel.low <= vLabel.lim && vLabel.lim <= rootLabel.lim;\n}\n", "import { feasibleTree } from './feasible-tree.js';\nimport { networkSimplex } from './network-simplex.js';\nimport { longestPath } from './util.js';\n\nexport { rank };\n\n/*\n * Assigns a rank to each node in the input graph that respects the \"minlen\"\n * constraint specified on edges between nodes.\n *\n * This basic structure is derived from Gansner, et al., \"A Technique for\n * Drawing Directed Graphs.\"\n *\n * Pre-conditions:\n *\n * 1. Graph must be a connected DAG\n * 2. Graph nodes must be objects\n * 3. Graph edges must have \"weight\" and \"minlen\" attributes\n *\n * Post-conditions:\n *\n * 1. Graph nodes will have a \"rank\" attribute based on the results of the\n * algorithm. Ranks can start at any index (including negative), we'll\n * fix them up later.\n */\nfunction rank(g) {\n switch (g.graph().ranker) {\n case 'network-simplex':\n networkSimplexRanker(g);\n break;\n case 'tight-tree':\n tightTreeRanker(g);\n break;\n case 'longest-path':\n longestPathRanker(g);\n break;\n default:\n networkSimplexRanker(g);\n }\n}\n\n// A fast and simple ranker, but results are far from optimal.\nvar longestPathRanker = longestPath;\n\nfunction tightTreeRanker(g) {\n longestPath(g);\n feasibleTree(g);\n}\n\nfunction networkSimplexRanker(g) {\n networkSimplex(g);\n}\n", "import * as _ from 'lodash-es';\nimport * as util from './util.js';\n\nexport { run, cleanup };\n\n/*\n * A nesting graph creates dummy nodes for the tops and bottoms of subgraphs,\n * adds appropriate edges to ensure that all cluster nodes are placed between\n * these boundries, and ensures that the graph is connected.\n *\n * In addition we ensure, through the use of the minlen property, that nodes\n * and subgraph border nodes to not end up on the same rank.\n *\n * Preconditions:\n *\n * 1. Input graph is a DAG\n * 2. Nodes in the input graph has a minlen attribute\n *\n * Postconditions:\n *\n * 1. Input graph is connected.\n * 2. Dummy nodes are added for the tops and bottoms of subgraphs.\n * 3. The minlen attribute for nodes is adjusted to ensure nodes do not\n * get placed on the same rank as subgraph border nodes.\n *\n * The nesting graph idea comes from Sander, \"Layout of Compound Directed\n * Graphs.\"\n */\nfunction run(g) {\n var root = util.addDummyNode(g, 'root', {}, '_root');\n var depths = treeDepths(g);\n var height = _.max(_.values(depths)) - 1; // Note: depths is an Object not an array\n var nodeSep = 2 * height + 1;\n\n g.graph().nestingRoot = root;\n\n // Multiply minlen by nodeSep to align nodes on non-border ranks.\n _.forEach(g.edges(), function (e) {\n g.edge(e).minlen *= nodeSep;\n });\n\n // Calculate a weight that is sufficient to keep subgraphs vertically compact\n var weight = sumWeights(g) + 1;\n\n // Create border nodes and link them up\n _.forEach(g.children(), function (child) {\n dfs(g, root, nodeSep, weight, height, depths, child);\n });\n\n // Save the multiplier for node layers for later removal of empty border\n // layers.\n g.graph().nodeRankFactor = nodeSep;\n}\n\nfunction dfs(g, root, nodeSep, weight, height, depths, v) {\n var children = g.children(v);\n if (!children.length) {\n if (v !== root) {\n g.setEdge(root, v, { weight: 0, minlen: nodeSep });\n }\n return;\n }\n\n var top = util.addBorderNode(g, '_bt');\n var bottom = util.addBorderNode(g, '_bb');\n var label = g.node(v);\n\n g.setParent(top, v);\n label.borderTop = top;\n g.setParent(bottom, v);\n label.borderBottom = bottom;\n\n _.forEach(children, function (child) {\n dfs(g, root, nodeSep, weight, height, depths, child);\n\n var childNode = g.node(child);\n var childTop = childNode.borderTop ? childNode.borderTop : child;\n var childBottom = childNode.borderBottom ? childNode.borderBottom : child;\n var thisWeight = childNode.borderTop ? weight : 2 * weight;\n var minlen = childTop !== childBottom ? 1 : height - depths[v] + 1;\n\n g.setEdge(top, childTop, {\n weight: thisWeight,\n minlen: minlen,\n nestingEdge: true,\n });\n\n g.setEdge(childBottom, bottom, {\n weight: thisWeight,\n minlen: minlen,\n nestingEdge: true,\n });\n });\n\n if (!g.parent(v)) {\n g.setEdge(root, top, { weight: 0, minlen: height + depths[v] });\n }\n}\n\nfunction treeDepths(g) {\n var depths = {};\n function dfs(v, depth) {\n var children = g.children(v);\n if (children && children.length) {\n _.forEach(children, function (child) {\n dfs(child, depth + 1);\n });\n }\n depths[v] = depth;\n }\n _.forEach(g.children(), function (v) {\n dfs(v, 1);\n });\n return depths;\n}\n\nfunction sumWeights(g) {\n return _.reduce(\n g.edges(),\n function (acc, e) {\n return acc + g.edge(e).weight;\n },\n 0\n );\n}\n\nfunction cleanup(g) {\n var graphLabel = g.graph();\n g.removeNode(graphLabel.nestingRoot);\n delete graphLabel.nestingRoot;\n _.forEach(g.edges(), function (e) {\n var edge = g.edge(e);\n if (edge.nestingEdge) {\n g.removeEdge(e);\n }\n });\n}\n", "import * as _ from 'lodash-es';\n\nexport { addSubgraphConstraints };\n\nfunction addSubgraphConstraints(g, cg, vs) {\n var prev = {},\n rootPrev;\n\n _.forEach(vs, function (v) {\n var child = g.parent(v),\n parent,\n prevChild;\n while (child) {\n parent = g.parent(child);\n if (parent) {\n prevChild = prev[parent];\n prev[parent] = child;\n } else {\n prevChild = rootPrev;\n rootPrev = child;\n }\n if (prevChild && prevChild !== child) {\n cg.setEdge(prevChild, child);\n return;\n }\n child = parent;\n }\n });\n\n /*\n function dfs(v) {\n var children = v ? g.children(v) : g.children();\n if (children.length) {\n var min = Number.POSITIVE_INFINITY,\n subgraphs = [];\n _.each(children, function(child) {\n var childMin = dfs(child);\n if (g.children(child).length) {\n subgraphs.push({ v: child, order: childMin });\n }\n min = Math.min(min, childMin);\n });\n _.reduce(_.sortBy(subgraphs, \"order\"), function(prev, curr) {\n cg.setEdge(prev.v, curr.v);\n return curr;\n });\n return min;\n }\n return g.node(v).order;\n }\n dfs(undefined);\n */\n}\n", "import * as _ from 'lodash-es';\nimport { Graph } from '../../graphlib/index.js';\n\nexport { buildLayerGraph };\n\n/*\n * Constructs a graph that can be used to sort a layer of nodes. The graph will\n * contain all base and subgraph nodes from the request layer in their original\n * hierarchy and any edges that are incident on these nodes and are of the type\n * requested by the \"relationship\" parameter.\n *\n * Nodes from the requested rank that do not have parents are assigned a root\n * node in the output graph, which is set in the root graph attribute. This\n * makes it easy to walk the hierarchy of movable nodes during ordering.\n *\n * Pre-conditions:\n *\n * 1. Input graph is a DAG\n * 2. Base nodes in the input graph have a rank attribute\n * 3. Subgraph nodes in the input graph has minRank and maxRank attributes\n * 4. Edges have an assigned weight\n *\n * Post-conditions:\n *\n * 1. Output graph has all nodes in the movable rank with preserved\n * hierarchy.\n * 2. Root nodes in the movable layer are made children of the node\n * indicated by the root attribute of the graph.\n * 3. Non-movable nodes incident on movable nodes, selected by the\n * relationship parameter, are included in the graph (without hierarchy).\n * 4. Edges incident on movable nodes, selected by the relationship\n * parameter, are added to the output graph.\n * 5. The weights for copied edges are aggregated as need, since the output\n * graph is not a multi-graph.\n */\nfunction buildLayerGraph(g, rank, relationship) {\n var root = createRootNode(g),\n result = new Graph({ compound: true })\n .setGraph({ root: root })\n .setDefaultNodeLabel(function (v) {\n return g.node(v);\n });\n\n _.forEach(g.nodes(), function (v) {\n var node = g.node(v),\n parent = g.parent(v);\n\n if (node.rank === rank || (node.minRank <= rank && rank <= node.maxRank)) {\n result.setNode(v);\n result.setParent(v, parent || root);\n\n // This assumes we have only short edges!\n _.forEach(g[relationship](v), function (e) {\n var u = e.v === v ? e.w : e.v,\n edge = result.edge(u, v),\n weight = !_.isUndefined(edge) ? edge.weight : 0;\n result.setEdge(u, v, { weight: g.edge(e).weight + weight });\n });\n\n if (_.has(node, 'minRank')) {\n result.setNode(v, {\n borderLeft: node.borderLeft[rank],\n borderRight: node.borderRight[rank],\n });\n }\n }\n });\n\n return result;\n}\n\nfunction createRootNode(g) {\n var v;\n while (g.hasNode((v = _.uniqueId('_root'))));\n return v;\n}\n", "import * as _ from 'lodash-es';\n\nexport { crossCount };\n\n/*\n * A function that takes a layering (an array of layers, each with an array of\n * ordererd nodes) and a graph and returns a weighted crossing count.\n *\n * Pre-conditions:\n *\n * 1. Input graph must be simple (not a multigraph), directed, and include\n * only simple edges.\n * 2. Edges in the input graph must have assigned weights.\n *\n * Post-conditions:\n *\n * 1. The graph and layering matrix are left unchanged.\n *\n * This algorithm is derived from Barth, et al., \"Bilayer Cross Counting.\"\n */\nfunction crossCount(g, layering) {\n var cc = 0;\n for (var i = 1; i < layering.length; ++i) {\n cc += twoLayerCrossCount(g, layering[i - 1], layering[i]);\n }\n return cc;\n}\n\nfunction twoLayerCrossCount(g, northLayer, southLayer) {\n // Sort all of the edges between the north and south layers by their position\n // in the north layer and then the south. Map these edges to the position of\n // their head in the south layer.\n var southPos = _.zipObject(\n southLayer,\n _.map(southLayer, function (v, i) {\n return i;\n })\n );\n var southEntries = _.flatten(\n _.map(northLayer, function (v) {\n return _.sortBy(\n _.map(g.outEdges(v), function (e) {\n return { pos: southPos[e.w], weight: g.edge(e).weight };\n }),\n 'pos'\n );\n })\n );\n\n // Build the accumulator tree\n var firstIndex = 1;\n while (firstIndex < southLayer.length) firstIndex <<= 1;\n var treeSize = 2 * firstIndex - 1;\n firstIndex -= 1;\n var tree = _.map(new Array(treeSize), function () {\n return 0;\n });\n\n // Calculate the weighted crossings\n var cc = 0;\n _.forEach(\n // @ts-expect-error\n southEntries.forEach(function (entry) {\n var index = entry.pos + firstIndex;\n tree[index] += entry.weight;\n var weightSum = 0;\n // @ts-expect-error\n while (index > 0) {\n // @ts-expect-error\n if (index % 2) {\n weightSum += tree[index + 1];\n }\n // @ts-expect-error\n index = (index - 1) >> 1;\n tree[index] += entry.weight;\n }\n cc += entry.weight * weightSum;\n })\n );\n\n return cc;\n}\n", "import * as _ from 'lodash-es';\n\nexport { initOrder };\n\n/*\n * Assigns an initial order value for each node by performing a DFS search\n * starting from nodes in the first rank. Nodes are assigned an order in their\n * rank as they are first visited.\n *\n * This approach comes from Gansner, et al., \"A Technique for Drawing Directed\n * Graphs.\"\n *\n * Returns a layering matrix with an array per layer and each layer sorted by\n * the order of its nodes.\n */\nfunction initOrder(g) {\n var visited = {};\n var simpleNodes = _.filter(g.nodes(), function (v) {\n return !g.children(v).length;\n });\n var maxRank = _.max(\n _.map(simpleNodes, function (v) {\n return g.node(v).rank;\n })\n );\n var layers = _.map(_.range(maxRank + 1), function () {\n return [];\n });\n\n function dfs(v) {\n if (_.has(visited, v)) return;\n visited[v] = true;\n var node = g.node(v);\n layers[node.rank].push(v);\n _.forEach(g.successors(v), dfs);\n }\n\n var orderedVs = _.sortBy(simpleNodes, function (v) {\n return g.node(v).rank;\n });\n _.forEach(orderedVs, dfs);\n\n return layers;\n}\n", "import * as _ from 'lodash-es';\n\nexport { barycenter };\n\nfunction barycenter(g, movable) {\n return _.map(movable, function (v) {\n var inV = g.inEdges(v);\n if (!inV.length) {\n return { v: v };\n } else {\n var result = _.reduce(\n inV,\n function (acc, e) {\n var edge = g.edge(e),\n nodeU = g.node(e.v);\n return {\n sum: acc.sum + edge.weight * nodeU.order,\n weight: acc.weight + edge.weight,\n };\n },\n { sum: 0, weight: 0 }\n );\n\n return {\n v: v,\n barycenter: result.sum / result.weight,\n weight: result.weight,\n };\n }\n });\n}\n", "import * as _ from 'lodash-es';\n\nexport { resolveConflicts };\n\n/*\n * Given a list of entries of the form {v, barycenter, weight} and a\n * constraint graph this function will resolve any conflicts between the\n * constraint graph and the barycenters for the entries. If the barycenters for\n * an entry would violate a constraint in the constraint graph then we coalesce\n * the nodes in the conflict into a new node that respects the contraint and\n * aggregates barycenter and weight information.\n *\n * This implementation is based on the description in Forster, \"A Fast and\n * Simple Hueristic for Constrained Two-Level Crossing Reduction,\" thought it\n * differs in some specific details.\n *\n * Pre-conditions:\n *\n * 1. Each entry has the form {v, barycenter, weight}, or if the node has\n * no barycenter, then {v}.\n *\n * Returns:\n *\n * A new list of entries of the form {vs, i, barycenter, weight}. The list\n * `vs` may either be a singleton or it may be an aggregation of nodes\n * ordered such that they do not violate constraints from the constraint\n * graph. The property `i` is the lowest original index of any of the\n * elements in `vs`.\n */\nfunction resolveConflicts(entries, cg) {\n var mappedEntries = {};\n _.forEach(entries, function (entry, i) {\n var tmp = (mappedEntries[entry.v] = {\n indegree: 0,\n in: [],\n out: [],\n vs: [entry.v],\n i: i,\n });\n if (!_.isUndefined(entry.barycenter)) {\n // @ts-expect-error\n tmp.barycenter = entry.barycenter;\n // @ts-expect-error\n tmp.weight = entry.weight;\n }\n });\n\n _.forEach(cg.edges(), function (e) {\n var entryV = mappedEntries[e.v];\n var entryW = mappedEntries[e.w];\n if (!_.isUndefined(entryV) && !_.isUndefined(entryW)) {\n entryW.indegree++;\n entryV.out.push(mappedEntries[e.w]);\n }\n });\n\n var sourceSet = _.filter(mappedEntries, function (entry) {\n // @ts-expect-error\n return !entry.indegree;\n });\n\n return doResolveConflicts(sourceSet);\n}\n\nfunction doResolveConflicts(sourceSet) {\n var entries = [];\n\n function handleIn(vEntry) {\n return function (uEntry) {\n if (uEntry.merged) {\n return;\n }\n if (\n _.isUndefined(uEntry.barycenter) ||\n _.isUndefined(vEntry.barycenter) ||\n uEntry.barycenter >= vEntry.barycenter\n ) {\n mergeEntries(vEntry, uEntry);\n }\n };\n }\n\n function handleOut(vEntry) {\n return function (wEntry) {\n wEntry['in'].push(vEntry);\n if (--wEntry.indegree === 0) {\n sourceSet.push(wEntry);\n }\n };\n }\n\n while (sourceSet.length) {\n var entry = sourceSet.pop();\n entries.push(entry);\n _.forEach(entry['in'].reverse(), handleIn(entry));\n _.forEach(entry.out, handleOut(entry));\n }\n\n return _.map(\n _.filter(entries, function (entry) {\n return !entry.merged;\n }),\n function (entry) {\n return _.pick(entry, ['vs', 'i', 'barycenter', 'weight']);\n }\n );\n}\n\nfunction mergeEntries(target, source) {\n var sum = 0;\n var weight = 0;\n\n if (target.weight) {\n sum += target.barycenter * target.weight;\n weight += target.weight;\n }\n\n if (source.weight) {\n sum += source.barycenter * source.weight;\n weight += source.weight;\n }\n\n target.vs = source.vs.concat(target.vs);\n target.barycenter = sum / weight;\n target.weight = weight;\n target.i = Math.min(source.i, target.i);\n source.merged = true;\n}\n", "import * as _ from 'lodash-es';\nimport * as util from '../util.js';\n\nexport { sort };\n\nfunction sort(entries, biasRight) {\n var parts = util.partition(entries, function (entry) {\n return _.has(entry, 'barycenter');\n });\n var sortable = parts.lhs,\n unsortable = _.sortBy(parts.rhs, function (entry) {\n return -entry.i;\n }),\n vs = [],\n sum = 0,\n weight = 0,\n vsIndex = 0;\n\n sortable.sort(compareWithBias(!!biasRight));\n\n vsIndex = consumeUnsortable(vs, unsortable, vsIndex);\n\n _.forEach(sortable, function (entry) {\n vsIndex += entry.vs.length;\n vs.push(entry.vs);\n sum += entry.barycenter * entry.weight;\n weight += entry.weight;\n vsIndex = consumeUnsortable(vs, unsortable, vsIndex);\n });\n\n var result = { vs: _.flatten(vs) };\n if (weight) {\n result.barycenter = sum / weight;\n result.weight = weight;\n }\n return result;\n}\n\nfunction consumeUnsortable(vs, unsortable, index) {\n var last;\n while (unsortable.length && (last = _.last(unsortable)).i <= index) {\n unsortable.pop();\n vs.push(last.vs);\n index++;\n }\n return index;\n}\n\nfunction compareWithBias(bias) {\n return function (entryV, entryW) {\n if (entryV.barycenter < entryW.barycenter) {\n return -1;\n } else if (entryV.barycenter > entryW.barycenter) {\n return 1;\n }\n\n return !bias ? entryV.i - entryW.i : entryW.i - entryV.i;\n };\n}\n", "import * as _ from 'lodash-es';\nimport { barycenter } from './barycenter.js';\nimport { resolveConflicts } from './resolve-conflicts.js';\nimport { sort } from './sort.js';\n\nexport { sortSubgraph };\n\nfunction sortSubgraph(g, v, cg, biasRight) {\n var movable = g.children(v);\n var node = g.node(v);\n var bl = node ? node.borderLeft : undefined;\n var br = node ? node.borderRight : undefined;\n var subgraphs = {};\n\n if (bl) {\n movable = _.filter(movable, function (w) {\n return w !== bl && w !== br;\n });\n }\n\n var barycenters = barycenter(g, movable);\n _.forEach(barycenters, function (entry) {\n if (g.children(entry.v).length) {\n var subgraphResult = sortSubgraph(g, entry.v, cg, biasRight);\n subgraphs[entry.v] = subgraphResult;\n if (_.has(subgraphResult, 'barycenter')) {\n mergeBarycenters(entry, subgraphResult);\n }\n }\n });\n\n var entries = resolveConflicts(barycenters, cg);\n expandSubgraphs(entries, subgraphs);\n\n var result = sort(entries, biasRight);\n\n if (bl) {\n result.vs = _.flatten([bl, result.vs, br]);\n if (g.predecessors(bl).length) {\n var blPred = g.node(g.predecessors(bl)[0]),\n brPred = g.node(g.predecessors(br)[0]);\n if (!_.has(result, 'barycenter')) {\n result.barycenter = 0;\n result.weight = 0;\n }\n result.barycenter =\n (result.barycenter * result.weight + blPred.order + brPred.order) / (result.weight + 2);\n result.weight += 2;\n }\n }\n\n return result;\n}\n\nfunction expandSubgraphs(entries, subgraphs) {\n _.forEach(entries, function (entry) {\n entry.vs = _.flatten(\n entry.vs.map(function (v) {\n if (subgraphs[v]) {\n return subgraphs[v].vs;\n }\n return v;\n })\n );\n });\n}\n\nfunction mergeBarycenters(target, other) {\n if (!_.isUndefined(target.barycenter)) {\n target.barycenter =\n (target.barycenter * target.weight + other.barycenter * other.weight) /\n (target.weight + other.weight);\n target.weight += other.weight;\n } else {\n target.barycenter = other.barycenter;\n target.weight = other.weight;\n }\n}\n", "import * as _ from 'lodash-es';\nimport { Graph } from '../../graphlib/index.js';\nimport * as util from '../util.js';\nimport { addSubgraphConstraints } from './add-subgraph-constraints.js';\nimport { buildLayerGraph } from './build-layer-graph.js';\nimport { crossCount } from './cross-count.js';\nimport { initOrder } from './init-order.js';\nimport { sortSubgraph } from './sort-subgraph.js';\n\nexport { order };\n\n/*\n * Applies heuristics to minimize edge crossings in the graph and sets the best\n * order solution as an order attribute on each node.\n *\n * Pre-conditions:\n *\n * 1. Graph must be DAG\n * 2. Graph nodes must be objects with a \"rank\" attribute\n * 3. Graph edges must have the \"weight\" attribute\n *\n * Post-conditions:\n *\n * 1. Graph nodes will have an \"order\" attribute based on the results of the\n * algorithm.\n */\nfunction order(g) {\n var maxRank = util.maxRank(g),\n downLayerGraphs = buildLayerGraphs(g, _.range(1, maxRank + 1), 'inEdges'),\n upLayerGraphs = buildLayerGraphs(g, _.range(maxRank - 1, -1, -1), 'outEdges');\n\n var layering = initOrder(g);\n assignOrder(g, layering);\n\n var bestCC = Number.POSITIVE_INFINITY,\n best;\n\n for (var i = 0, lastBest = 0; lastBest < 4; ++i, ++lastBest) {\n sweepLayerGraphs(i % 2 ? downLayerGraphs : upLayerGraphs, i % 4 >= 2);\n\n layering = util.buildLayerMatrix(g);\n var cc = crossCount(g, layering);\n if (cc < bestCC) {\n lastBest = 0;\n best = _.cloneDeep(layering);\n bestCC = cc;\n }\n }\n\n assignOrder(g, best);\n}\n\nfunction buildLayerGraphs(g, ranks, relationship) {\n return _.map(ranks, function (rank) {\n return buildLayerGraph(g, rank, relationship);\n });\n}\n\nfunction sweepLayerGraphs(layerGraphs, biasRight) {\n var cg = new Graph();\n _.forEach(layerGraphs, function (lg) {\n var root = lg.graph().root;\n var sorted = sortSubgraph(lg, root, cg, biasRight);\n _.forEach(sorted.vs, function (v, i) {\n lg.node(v).order = i;\n });\n addSubgraphConstraints(lg, cg, sorted.vs);\n });\n}\n\nfunction assignOrder(g, layering) {\n _.forEach(layering, function (layer) {\n _.forEach(layer, function (v, i) {\n g.node(v).order = i;\n });\n });\n}\n", "import * as _ from 'lodash-es';\n\nexport { parentDummyChains };\n\nfunction parentDummyChains(g) {\n var postorderNums = postorder(g);\n\n _.forEach(g.graph().dummyChains, function (v) {\n var node = g.node(v);\n var edgeObj = node.edgeObj;\n var pathData = findPath(g, postorderNums, edgeObj.v, edgeObj.w);\n var path = pathData.path;\n var lca = pathData.lca;\n var pathIdx = 0;\n var pathV = path[pathIdx];\n var ascending = true;\n\n while (v !== edgeObj.w) {\n node = g.node(v);\n\n if (ascending) {\n while ((pathV = path[pathIdx]) !== lca && g.node(pathV).maxRank < node.rank) {\n pathIdx++;\n }\n\n if (pathV === lca) {\n ascending = false;\n }\n }\n\n if (!ascending) {\n while (\n pathIdx < path.length - 1 &&\n g.node((pathV = path[pathIdx + 1])).minRank <= node.rank\n ) {\n pathIdx++;\n }\n pathV = path[pathIdx];\n }\n\n g.setParent(v, pathV);\n v = g.successors(v)[0];\n }\n });\n}\n\n// Find a path from v to w through the lowest common ancestor (LCA). Return the\n// full path and the LCA.\nfunction findPath(g, postorderNums, v, w) {\n var vPath = [];\n var wPath = [];\n var low = Math.min(postorderNums[v].low, postorderNums[w].low);\n var lim = Math.max(postorderNums[v].lim, postorderNums[w].lim);\n var parent;\n var lca;\n\n // Traverse up from v to find the LCA\n parent = v;\n do {\n parent = g.parent(parent);\n vPath.push(parent);\n } while (parent && (postorderNums[parent].low > low || lim > postorderNums[parent].lim));\n lca = parent;\n\n // Traverse from w to LCA\n parent = w;\n while ((parent = g.parent(parent)) !== lca) {\n wPath.push(parent);\n }\n\n return { path: vPath.concat(wPath.reverse()), lca: lca };\n}\n\nfunction postorder(g) {\n var result = {};\n var lim = 0;\n\n function dfs(v) {\n var low = lim;\n _.forEach(g.children(v), dfs);\n result[v] = { low: low, lim: lim++ };\n }\n _.forEach(g.children(), dfs);\n\n return result;\n}\n", "import * as _ from 'lodash-es';\nimport { Graph } from '../../graphlib/index.js';\nimport * as util from '../util.js';\n\n/*\n * This module provides coordinate assignment based on Brandes and K\u00F6pf, \"Fast\n * and Simple Horizontal Coordinate Assignment.\"\n */\n\nexport {\n positionX,\n findType1Conflicts,\n findType2Conflicts,\n addConflict,\n hasConflict,\n verticalAlignment,\n horizontalCompaction,\n alignCoordinates,\n findSmallestWidthAlignment,\n balance,\n};\n\n/*\n * Marks all edges in the graph with a type-1 conflict with the \"type1Conflict\"\n * property. A type-1 conflict is one where a non-inner segment crosses an\n * inner segment. An inner segment is an edge with both incident nodes marked\n * with the \"dummy\" property.\n *\n * This algorithm scans layer by layer, starting with the second, for type-1\n * conflicts between the current layer and the previous layer. For each layer\n * it scans the nodes from left to right until it reaches one that is incident\n * on an inner segment. It then scans predecessors to determine if they have\n * edges that cross that inner segment. At the end a final scan is done for all\n * nodes on the current rank to see if they cross the last visited inner\n * segment.\n *\n * This algorithm (safely) assumes that a dummy node will only be incident on a\n * single node in the layers being scanned.\n */\nfunction findType1Conflicts(g, layering) {\n var conflicts = {};\n\n function visitLayer(prevLayer, layer) {\n var // last visited node in the previous layer that is incident on an inner\n // segment.\n k0 = 0,\n // Tracks the last node in this layer scanned for crossings with a type-1\n // segment.\n scanPos = 0,\n prevLayerLength = prevLayer.length,\n lastNode = _.last(layer);\n\n _.forEach(layer, function (v, i) {\n var w = findOtherInnerSegmentNode(g, v),\n k1 = w ? g.node(w).order : prevLayerLength;\n\n if (w || v === lastNode) {\n _.forEach(layer.slice(scanPos, i + 1), function (scanNode) {\n _.forEach(g.predecessors(scanNode), function (u) {\n var uLabel = g.node(u),\n uPos = uLabel.order;\n if ((uPos < k0 || k1 < uPos) && !(uLabel.dummy && g.node(scanNode).dummy)) {\n addConflict(conflicts, u, scanNode);\n }\n });\n });\n // @ts-expect-error\n scanPos = i + 1;\n k0 = k1;\n }\n });\n\n return layer;\n }\n\n _.reduce(layering, visitLayer);\n return conflicts;\n}\n\nfunction findType2Conflicts(g, layering) {\n var conflicts = {};\n\n function scan(south, southPos, southEnd, prevNorthBorder, nextNorthBorder) {\n var v;\n _.forEach(_.range(southPos, southEnd), function (i) {\n v = south[i];\n if (g.node(v).dummy) {\n _.forEach(g.predecessors(v), function (u) {\n var uNode = g.node(u);\n if (uNode.dummy && (uNode.order < prevNorthBorder || uNode.order > nextNorthBorder)) {\n addConflict(conflicts, u, v);\n }\n });\n }\n });\n }\n\n function visitLayer(north, south) {\n var prevNorthPos = -1,\n nextNorthPos,\n southPos = 0;\n\n _.forEach(south, function (v, southLookahead) {\n if (g.node(v).dummy === 'border') {\n var predecessors = g.predecessors(v);\n if (predecessors.length) {\n nextNorthPos = g.node(predecessors[0]).order;\n scan(south, southPos, southLookahead, prevNorthPos, nextNorthPos);\n // @ts-expect-error\n southPos = southLookahead;\n prevNorthPos = nextNorthPos;\n }\n }\n scan(south, southPos, south.length, nextNorthPos, north.length);\n });\n\n return south;\n }\n\n _.reduce(layering, visitLayer);\n return conflicts;\n}\n\nfunction findOtherInnerSegmentNode(g, v) {\n if (g.node(v).dummy) {\n return _.find(g.predecessors(v), function (u) {\n return g.node(u).dummy;\n });\n }\n}\n\nfunction addConflict(conflicts, v, w) {\n if (v > w) {\n var tmp = v;\n v = w;\n w = tmp;\n }\n\n var conflictsV = conflicts[v];\n if (!conflictsV) {\n conflicts[v] = conflictsV = {};\n }\n conflictsV[w] = true;\n}\n\nfunction hasConflict(conflicts, v, w) {\n if (v > w) {\n var tmp = v;\n v = w;\n w = tmp;\n }\n return _.has(conflicts[v], w);\n}\n\n/*\n * Try to align nodes into vertical \"blocks\" where possible. This algorithm\n * attempts to align a node with one of its median neighbors. If the edge\n * connecting a neighbor is a type-1 conflict then we ignore that possibility.\n * If a previous node has already formed a block with a node after the node\n * we're trying to form a block with, we also ignore that possibility - our\n * blocks would be split in that scenario.\n */\nfunction verticalAlignment(g, layering, conflicts, neighborFn) {\n var root = {},\n align = {},\n pos = {};\n\n // We cache the position here based on the layering because the graph and\n // layering may be out of sync. The layering matrix is manipulated to\n // generate different extreme alignments.\n _.forEach(layering, function (layer) {\n _.forEach(layer, function (v, order) {\n root[v] = v;\n align[v] = v;\n pos[v] = order;\n });\n });\n\n _.forEach(layering, function (layer) {\n var prevIdx = -1;\n _.forEach(layer, function (v) {\n var ws = neighborFn(v);\n if (ws.length) {\n ws = _.sortBy(ws, function (w) {\n return pos[w];\n });\n var mp = (ws.length - 1) / 2;\n for (var i = Math.floor(mp), il = Math.ceil(mp); i <= il; ++i) {\n var w = ws[i];\n if (align[v] === v && prevIdx < pos[w] && !hasConflict(conflicts, v, w)) {\n align[w] = v;\n align[v] = root[v] = root[w];\n prevIdx = pos[w];\n }\n }\n }\n });\n });\n\n return { root: root, align: align };\n}\n\nfunction horizontalCompaction(g, layering, root, align, reverseSep) {\n // This portion of the algorithm differs from BK due to a number of problems.\n // Instead of their algorithm we construct a new block graph and do two\n // sweeps. The first sweep places blocks with the smallest possible\n // coordinates. The second sweep removes unused space by moving blocks to the\n // greatest coordinates without violating separation.\n var xs = {},\n blockG = buildBlockGraph(g, layering, root, reverseSep),\n borderType = reverseSep ? 'borderLeft' : 'borderRight';\n\n function iterate(setXsFunc, nextNodesFunc) {\n var stack = blockG.nodes();\n var elem = stack.pop();\n var visited = {};\n while (elem) {\n if (visited[elem]) {\n setXsFunc(elem);\n } else {\n visited[elem] = true;\n stack.push(elem);\n stack = stack.concat(nextNodesFunc(elem));\n }\n\n elem = stack.pop();\n }\n }\n\n // First pass, assign smallest coordinates\n function pass1(elem) {\n xs[elem] = blockG.inEdges(elem).reduce(function (acc, e) {\n return Math.max(acc, xs[e.v] + blockG.edge(e));\n }, 0);\n }\n\n // Second pass, assign greatest coordinates\n function pass2(elem) {\n var min = blockG.outEdges(elem).reduce(function (acc, e) {\n return Math.min(acc, xs[e.w] - blockG.edge(e));\n }, Number.POSITIVE_INFINITY);\n\n var node = g.node(elem);\n if (min !== Number.POSITIVE_INFINITY && node.borderType !== borderType) {\n xs[elem] = Math.max(xs[elem], min);\n }\n }\n\n iterate(pass1, blockG.predecessors.bind(blockG));\n iterate(pass2, blockG.successors.bind(blockG));\n\n // Assign x coordinates to all nodes\n _.forEach(align, function (v) {\n xs[v] = xs[root[v]];\n });\n\n return xs;\n}\n\nfunction buildBlockGraph(g, layering, root, reverseSep) {\n var blockGraph = new Graph(),\n graphLabel = g.graph(),\n sepFn = sep(graphLabel.nodesep, graphLabel.edgesep, reverseSep);\n\n _.forEach(layering, function (layer) {\n var u;\n _.forEach(layer, function (v) {\n var vRoot = root[v];\n blockGraph.setNode(vRoot);\n if (u) {\n var uRoot = root[u],\n prevMax = blockGraph.edge(uRoot, vRoot);\n blockGraph.setEdge(uRoot, vRoot, Math.max(sepFn(g, v, u), prevMax || 0));\n }\n u = v;\n });\n });\n\n return blockGraph;\n}\n\n/*\n * Returns the alignment that has the smallest width of the given alignments.\n */\nfunction findSmallestWidthAlignment(g, xss) {\n return _.minBy(_.values(xss), function (xs) {\n var max = Number.NEGATIVE_INFINITY;\n var min = Number.POSITIVE_INFINITY;\n\n _.forIn(xs, function (x, v) {\n var halfWidth = width(g, v) / 2;\n\n max = Math.max(x + halfWidth, max);\n min = Math.min(x - halfWidth, min);\n });\n\n return max - min;\n });\n}\n\n/*\n * Align the coordinates of each of the layout alignments such that\n * left-biased alignments have their minimum coordinate at the same point as\n * the minimum coordinate of the smallest width alignment and right-biased\n * alignments have their maximum coordinate at the same point as the maximum\n * coordinate of the smallest width alignment.\n */\nfunction alignCoordinates(xss, alignTo) {\n var alignToVals = _.values(alignTo),\n alignToMin = _.min(alignToVals),\n alignToMax = _.max(alignToVals);\n\n _.forEach(['u', 'd'], function (vert) {\n _.forEach(['l', 'r'], function (horiz) {\n var alignment = vert + horiz,\n xs = xss[alignment],\n delta;\n if (xs === alignTo) return;\n\n var xsVals = _.values(xs);\n delta = horiz === 'l' ? alignToMin - _.min(xsVals) : alignToMax - _.max(xsVals);\n\n if (delta) {\n xss[alignment] = _.mapValues(xs, function (x) {\n return x + delta;\n });\n }\n });\n });\n}\n\nfunction balance(xss, align) {\n return _.mapValues(xss.ul, function (ignore, v) {\n if (align) {\n return xss[align.toLowerCase()][v];\n } else {\n var xs = _.sortBy(_.map(xss, v));\n return (xs[1] + xs[2]) / 2;\n }\n });\n}\n\nfunction positionX(g) {\n var layering = util.buildLayerMatrix(g);\n var conflicts = _.merge(findType1Conflicts(g, layering), findType2Conflicts(g, layering));\n\n var xss = {};\n var adjustedLayering;\n _.forEach(['u', 'd'], function (vert) {\n adjustedLayering = vert === 'u' ? layering : _.values(layering).reverse();\n _.forEach(['l', 'r'], function (horiz) {\n if (horiz === 'r') {\n adjustedLayering = _.map(adjustedLayering, function (inner) {\n return _.values(inner).reverse();\n });\n }\n\n var neighborFn = (vert === 'u' ? g.predecessors : g.successors).bind(g);\n var align = verticalAlignment(g, adjustedLayering, conflicts, neighborFn);\n var xs = horizontalCompaction(g, adjustedLayering, align.root, align.align, horiz === 'r');\n if (horiz === 'r') {\n xs = _.mapValues(xs, function (x) {\n return -x;\n });\n }\n xss[vert + horiz] = xs;\n });\n });\n\n var smallestWidth = findSmallestWidthAlignment(g, xss);\n alignCoordinates(xss, smallestWidth);\n return balance(xss, g.graph().align);\n}\n\nfunction sep(nodeSep, edgeSep, reverseSep) {\n return function (g, v, w) {\n var vLabel = g.node(v);\n var wLabel = g.node(w);\n var sum = 0;\n var delta;\n\n sum += vLabel.width / 2;\n if (_.has(vLabel, 'labelpos')) {\n switch (vLabel.labelpos.toLowerCase()) {\n case 'l':\n delta = -vLabel.width / 2;\n break;\n case 'r':\n delta = vLabel.width / 2;\n break;\n }\n }\n if (delta) {\n sum += reverseSep ? delta : -delta;\n }\n delta = 0;\n\n sum += (vLabel.dummy ? edgeSep : nodeSep) / 2;\n sum += (wLabel.dummy ? edgeSep : nodeSep) / 2;\n\n sum += wLabel.width / 2;\n if (_.has(wLabel, 'labelpos')) {\n switch (wLabel.labelpos.toLowerCase()) {\n case 'l':\n delta = wLabel.width / 2;\n break;\n case 'r':\n delta = -wLabel.width / 2;\n break;\n }\n }\n if (delta) {\n sum += reverseSep ? delta : -delta;\n }\n delta = 0;\n\n return sum;\n };\n}\n\nfunction width(g, v) {\n return g.node(v).width;\n}\n", "import * as _ from 'lodash-es';\nimport * as util from '../util.js';\nimport { positionX } from './bk.js';\n\nexport { position };\n\nfunction position(g) {\n g = util.asNonCompoundGraph(g);\n\n positionY(g);\n _.forOwn(positionX(g), function (x, v) {\n g.node(v).x = x;\n });\n}\n\nfunction positionY(g) {\n var layering = util.buildLayerMatrix(g);\n var rankSep = g.graph().ranksep;\n var prevY = 0;\n _.forEach(layering, function (layer) {\n var maxHeight = _.max(\n _.map(layer, function (v) {\n return g.node(v).height;\n })\n );\n _.forEach(layer, function (v) {\n g.node(v).y = prevY + maxHeight / 2;\n });\n prevY += maxHeight + rankSep;\n });\n}\n", "import * as _ from 'lodash-es';\nimport { Graph } from '../graphlib/index.js';\nimport { addBorderSegments } from './add-border-segments.js';\nimport * as coordinateSystem from './coordinate-system.js';\nimport * as acyclic from './acyclic.js';\nimport * as normalize from './normalize.js';\nimport { rank } from './rank/index.js';\nimport * as nestingGraph from './nesting-graph.js';\nimport { order } from './order/index.js';\nimport { parentDummyChains } from './parent-dummy-chains.js';\nimport { position } from './position/index.js';\nimport * as util from './util.js';\n\nexport { layout };\n\nfunction layout(g, opts) {\n var time = opts && opts.debugTiming ? util.time : util.notime;\n time('layout', function () {\n var layoutGraph = time(' buildLayoutGraph', function () {\n return buildLayoutGraph(g);\n });\n time(' runLayout', function () {\n runLayout(layoutGraph, time);\n });\n time(' updateInputGraph', function () {\n updateInputGraph(g, layoutGraph);\n });\n });\n}\n\nfunction runLayout(g, time) {\n time(' makeSpaceForEdgeLabels', function () {\n makeSpaceForEdgeLabels(g);\n });\n time(' removeSelfEdges', function () {\n removeSelfEdges(g);\n });\n time(' acyclic', function () {\n acyclic.run(g);\n });\n time(' nestingGraph.run', function () {\n nestingGraph.run(g);\n });\n time(' rank', function () {\n rank(util.asNonCompoundGraph(g));\n });\n time(' injectEdgeLabelProxies', function () {\n injectEdgeLabelProxies(g);\n });\n time(' removeEmptyRanks', function () {\n util.removeEmptyRanks(g);\n });\n time(' nestingGraph.cleanup', function () {\n nestingGraph.cleanup(g);\n });\n time(' normalizeRanks', function () {\n util.normalizeRanks(g);\n });\n time(' assignRankMinMax', function () {\n assignRankMinMax(g);\n });\n time(' removeEdgeLabelProxies', function () {\n removeEdgeLabelProxies(g);\n });\n time(' normalize.run', function () {\n normalize.run(g);\n });\n time(' parentDummyChains', function () {\n parentDummyChains(g);\n });\n time(' addBorderSegments', function () {\n addBorderSegments(g);\n });\n time(' order', function () {\n order(g);\n });\n time(' insertSelfEdges', function () {\n insertSelfEdges(g);\n });\n time(' adjustCoordinateSystem', function () {\n coordinateSystem.adjust(g);\n });\n time(' position', function () {\n position(g);\n });\n time(' positionSelfEdges', function () {\n positionSelfEdges(g);\n });\n time(' removeBorderNodes', function () {\n removeBorderNodes(g);\n });\n time(' normalize.undo', function () {\n normalize.undo(g);\n });\n time(' fixupEdgeLabelCoords', function () {\n fixupEdgeLabelCoords(g);\n });\n time(' undoCoordinateSystem', function () {\n coordinateSystem.undo(g);\n });\n time(' translateGraph', function () {\n translateGraph(g);\n });\n time(' assignNodeIntersects', function () {\n assignNodeIntersects(g);\n });\n time(' reversePoints', function () {\n reversePointsForReversedEdges(g);\n });\n time(' acyclic.undo', function () {\n acyclic.undo(g);\n });\n}\n\n/*\n * Copies final layout information from the layout graph back to the input\n * graph. This process only copies whitelisted attributes from the layout graph\n * to the input graph, so it serves as a good place to determine what\n * attributes can influence layout.\n */\nfunction updateInputGraph(inputGraph, layoutGraph) {\n _.forEach(inputGraph.nodes(), function (v) {\n var inputLabel = inputGraph.node(v);\n var layoutLabel = layoutGraph.node(v);\n\n if (inputLabel) {\n inputLabel.x = layoutLabel.x;\n inputLabel.y = layoutLabel.y;\n\n if (layoutGraph.children(v).length) {\n inputLabel.width = layoutLabel.width;\n inputLabel.height = layoutLabel.height;\n }\n }\n });\n\n _.forEach(inputGraph.edges(), function (e) {\n var inputLabel = inputGraph.edge(e);\n var layoutLabel = layoutGraph.edge(e);\n\n inputLabel.points = layoutLabel.points;\n if (_.has(layoutLabel, 'x')) {\n inputLabel.x = layoutLabel.x;\n inputLabel.y = layoutLabel.y;\n }\n });\n\n inputGraph.graph().width = layoutGraph.graph().width;\n inputGraph.graph().height = layoutGraph.graph().height;\n}\n\nvar graphNumAttrs = ['nodesep', 'edgesep', 'ranksep', 'marginx', 'marginy'];\nvar graphDefaults = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: 'tb' };\nvar graphAttrs = ['acyclicer', 'ranker', 'rankdir', 'align'];\nvar nodeNumAttrs = ['width', 'height'];\nvar nodeDefaults = { width: 0, height: 0 };\nvar edgeNumAttrs = ['minlen', 'weight', 'width', 'height', 'labeloffset'];\nvar edgeDefaults = {\n minlen: 1,\n weight: 1,\n width: 0,\n height: 0,\n labeloffset: 10,\n labelpos: 'r',\n};\nvar edgeAttrs = ['labelpos'];\n\n/*\n * Constructs a new graph from the input graph, which can be used for layout.\n * This process copies only whitelisted attributes from the input graph to the\n * layout graph. Thus this function serves as a good place to determine what\n * attributes can influence layout.\n */\nfunction buildLayoutGraph(inputGraph) {\n var g = new Graph({ multigraph: true, compound: true });\n var graph = canonicalize(inputGraph.graph());\n\n g.setGraph(\n _.merge({}, graphDefaults, selectNumberAttrs(graph, graphNumAttrs), _.pick(graph, graphAttrs))\n );\n\n _.forEach(inputGraph.nodes(), function (v) {\n var node = canonicalize(inputGraph.node(v));\n g.setNode(v, _.defaults(selectNumberAttrs(node, nodeNumAttrs), nodeDefaults));\n g.setParent(v, inputGraph.parent(v));\n });\n\n _.forEach(inputGraph.edges(), function (e) {\n var edge = canonicalize(inputGraph.edge(e));\n g.setEdge(\n e,\n _.merge({}, edgeDefaults, selectNumberAttrs(edge, edgeNumAttrs), _.pick(edge, edgeAttrs))\n );\n });\n\n return g;\n}\n\n/*\n * This idea comes from the Gansner paper: to account for edge labels in our\n * layout we split each rank in half by doubling minlen and halving ranksep.\n * Then we can place labels at these mid-points between nodes.\n *\n * We also add some minimal padding to the width to push the label for the edge\n * away from the edge itself a bit.\n */\nfunction makeSpaceForEdgeLabels(g) {\n var graph = g.graph();\n graph.ranksep /= 2;\n _.forEach(g.edges(), function (e) {\n var edge = g.edge(e);\n edge.minlen *= 2;\n if (edge.labelpos.toLowerCase() !== 'c') {\n if (graph.rankdir === 'TB' || graph.rankdir === 'BT') {\n edge.width += edge.labeloffset;\n } else {\n edge.height += edge.labeloffset;\n }\n }\n });\n}\n\n/*\n * Creates temporary dummy nodes that capture the rank in which each edge's\n * label is going to, if it has one of non-zero width and height. We do this\n * so that we can safely remove empty ranks while preserving balance for the\n * label's position.\n */\nfunction injectEdgeLabelProxies(g) {\n _.forEach(g.edges(), function (e) {\n var edge = g.edge(e);\n if (edge.width && edge.height) {\n var v = g.node(e.v);\n var w = g.node(e.w);\n var label = { rank: (w.rank - v.rank) / 2 + v.rank, e: e };\n util.addDummyNode(g, 'edge-proxy', label, '_ep');\n }\n });\n}\n\nfunction assignRankMinMax(g) {\n var maxRank = 0;\n _.forEach(g.nodes(), function (v) {\n var node = g.node(v);\n if (node.borderTop) {\n node.minRank = g.node(node.borderTop).rank;\n node.maxRank = g.node(node.borderBottom).rank;\n // @ts-expect-error\n maxRank = _.max(maxRank, node.maxRank);\n }\n });\n g.graph().maxRank = maxRank;\n}\n\nfunction removeEdgeLabelProxies(g) {\n _.forEach(g.nodes(), function (v) {\n var node = g.node(v);\n if (node.dummy === 'edge-proxy') {\n g.edge(node.e).labelRank = node.rank;\n g.removeNode(v);\n }\n });\n}\n\nfunction translateGraph(g) {\n var minX = Number.POSITIVE_INFINITY;\n var maxX = 0;\n var minY = Number.POSITIVE_INFINITY;\n var maxY = 0;\n var graphLabel = g.graph();\n var marginX = graphLabel.marginx || 0;\n var marginY = graphLabel.marginy || 0;\n\n function getExtremes(attrs) {\n var x = attrs.x;\n var y = attrs.y;\n var w = attrs.width;\n var h = attrs.height;\n minX = Math.min(minX, x - w / 2);\n maxX = Math.max(maxX, x + w / 2);\n minY = Math.min(minY, y - h / 2);\n maxY = Math.max(maxY, y + h / 2);\n }\n\n _.forEach(g.nodes(), function (v) {\n getExtremes(g.node(v));\n });\n _.forEach(g.edges(), function (e) {\n var edge = g.edge(e);\n if (_.has(edge, 'x')) {\n getExtremes(edge);\n }\n });\n\n minX -= marginX;\n minY -= marginY;\n\n _.forEach(g.nodes(), function (v) {\n var node = g.node(v);\n node.x -= minX;\n node.y -= minY;\n });\n\n _.forEach(g.edges(), function (e) {\n var edge = g.edge(e);\n _.forEach(edge.points, function (p) {\n p.x -= minX;\n p.y -= minY;\n });\n if (_.has(edge, 'x')) {\n edge.x -= minX;\n }\n if (_.has(edge, 'y')) {\n edge.y -= minY;\n }\n });\n\n graphLabel.width = maxX - minX + marginX;\n graphLabel.height = maxY - minY + marginY;\n}\n\nfunction assignNodeIntersects(g) {\n _.forEach(g.edges(), function (e) {\n var edge = g.edge(e);\n var nodeV = g.node(e.v);\n var nodeW = g.node(e.w);\n var p1, p2;\n if (!edge.points) {\n edge.points = [];\n p1 = nodeW;\n p2 = nodeV;\n } else {\n p1 = edge.points[0];\n p2 = edge.points[edge.points.length - 1];\n }\n edge.points.unshift(util.intersectRect(nodeV, p1));\n edge.points.push(util.intersectRect(nodeW, p2));\n });\n}\n\nfunction fixupEdgeLabelCoords(g) {\n _.forEach(g.edges(), function (e) {\n var edge = g.edge(e);\n if (_.has(edge, 'x')) {\n if (edge.labelpos === 'l' || edge.labelpos === 'r') {\n edge.width -= edge.labeloffset;\n }\n switch (edge.labelpos) {\n case 'l':\n edge.x -= edge.width / 2 + edge.labeloffset;\n break;\n case 'r':\n edge.x += edge.width / 2 + edge.labeloffset;\n break;\n }\n }\n });\n}\n\nfunction reversePointsForReversedEdges(g) {\n _.forEach(g.edges(), function (e) {\n var edge = g.edge(e);\n if (edge.reversed) {\n edge.points.reverse();\n }\n });\n}\n\nfunction removeBorderNodes(g) {\n _.forEach(g.nodes(), function (v) {\n if (g.children(v).length) {\n var node = g.node(v);\n var t = g.node(node.borderTop);\n var b = g.node(node.borderBottom);\n var l = g.node(_.last(node.borderLeft));\n var r = g.node(_.last(node.borderRight));\n\n node.width = Math.abs(r.x - l.x);\n node.height = Math.abs(b.y - t.y);\n node.x = l.x + node.width / 2;\n node.y = t.y + node.height / 2;\n }\n });\n\n _.forEach(g.nodes(), function (v) {\n if (g.node(v).dummy === 'border') {\n g.removeNode(v);\n }\n });\n}\n\nfunction removeSelfEdges(g) {\n _.forEach(g.edges(), function (e) {\n if (e.v === e.w) {\n var node = g.node(e.v);\n if (!node.selfEdges) {\n node.selfEdges = [];\n }\n node.selfEdges.push({ e: e, label: g.edge(e) });\n g.removeEdge(e);\n }\n });\n}\n\nfunction insertSelfEdges(g) {\n var layers = util.buildLayerMatrix(g);\n _.forEach(layers, function (layer) {\n var orderShift = 0;\n _.forEach(layer, function (v, i) {\n var node = g.node(v);\n node.order = i + orderShift;\n _.forEach(node.selfEdges, function (selfEdge) {\n util.addDummyNode(\n g,\n 'selfedge',\n {\n width: selfEdge.label.width,\n height: selfEdge.label.height,\n rank: node.rank,\n order: i + ++orderShift,\n e: selfEdge.e,\n label: selfEdge.label,\n },\n '_se'\n );\n });\n delete node.selfEdges;\n });\n });\n}\n\nfunction positionSelfEdges(g) {\n _.forEach(g.nodes(), function (v) {\n var node = g.node(v);\n if (node.dummy === 'selfedge') {\n var selfNode = g.node(node.e.v);\n var x = selfNode.x + selfNode.width / 2;\n var y = selfNode.y;\n var dx = node.x - x;\n var dy = selfNode.height / 2;\n g.setEdge(node.e, node.label);\n g.removeNode(v);\n node.label.points = [\n { x: x + (2 * dx) / 3, y: y - dy },\n { x: x + (5 * dx) / 6, y: y - dy },\n { x: x + dx, y: y },\n { x: x + (5 * dx) / 6, y: y + dy },\n { x: x + (2 * dx) / 3, y: y + dy },\n ];\n node.label.x = node.x;\n node.label.y = node.y;\n }\n });\n}\n\nfunction selectNumberAttrs(obj, attrs) {\n return _.mapValues(_.pick(obj, attrs), Number);\n}\n\nfunction canonicalize(attrs) {\n var newAttrs = {};\n _.forEach(attrs, function (v, k) {\n newAttrs[k.toLowerCase()] = v;\n });\n return newAttrs;\n}\n", "import * as acyclic from './acyclic.js';\nimport { layout } from './layout.js';\nimport * as normalize from './normalize.js';\nimport { rank } from './rank/index.js';\n\nexport { acyclic, normalize, rank, layout };\n", "import * as _ from 'lodash-es';\nimport { Graph } from './graph.js';\n\nexport { write, read };\n\nfunction write(g) {\n var json = {\n options: {\n directed: g.isDirected(),\n multigraph: g.isMultigraph(),\n compound: g.isCompound(),\n },\n nodes: writeNodes(g),\n edges: writeEdges(g),\n };\n if (!_.isUndefined(g.graph())) {\n json.value = _.clone(g.graph());\n }\n return json;\n}\n\nfunction writeNodes(g) {\n return _.map(g.nodes(), function (v) {\n var nodeValue = g.node(v);\n var parent = g.parent(v);\n var node = { v: v };\n if (!_.isUndefined(nodeValue)) {\n node.value = nodeValue;\n }\n if (!_.isUndefined(parent)) {\n node.parent = parent;\n }\n return node;\n });\n}\n\nfunction writeEdges(g) {\n return _.map(g.edges(), function (e) {\n var edgeValue = g.edge(e);\n var edge = { v: e.v, w: e.w };\n if (!_.isUndefined(e.name)) {\n edge.name = e.name;\n }\n if (!_.isUndefined(edgeValue)) {\n edge.value = edgeValue;\n }\n return edge;\n });\n}\n\nfunction read(json) {\n var g = new Graph(json.options).setGraph(json.value);\n _.each(json.nodes, function (entry) {\n g.setNode(entry.v, entry.value);\n if (entry.parent) {\n g.setParent(entry.v, entry.parent);\n }\n });\n _.each(json.edges, function (entry) {\n g.setEdge({ v: entry.v, w: entry.w, name: entry.name }, entry.value);\n });\n return g;\n}\n", "/** Decorates with functions required by mermaids dagre-wrapper. */\nimport { log } from '$root/logger.js';\nimport * as graphlib from 'dagre-d3-es/src/graphlib/index.js';\nimport * as graphlibJson from 'dagre-d3-es/src/graphlib/json.js';\n\nexport let clusterDb = new Map();\nlet descendants = new Map();\nlet parents = new Map();\n\nexport const clear = () => {\n descendants.clear();\n parents.clear();\n clusterDb.clear();\n};\n\nconst isDescendant = (id, ancestorId) => {\n const ancestorDescendants = descendants.get(ancestorId) || [];\n log.trace('In isDescendant', ancestorId, ' ', id, ' = ', ancestorDescendants.includes(id));\n return ancestorDescendants.includes(id);\n};\n\nconst edgeInCluster = (edge, clusterId) => {\n const clusterDescendants = descendants.get(clusterId) || [];\n log.info('Descendants of ', clusterId, ' is ', clusterDescendants);\n log.info('Edge is ', edge);\n if (edge.v === clusterId || edge.w === clusterId) {\n return false;\n }\n\n if (!clusterDescendants) {\n log.debug('Tilt, ', clusterId, ',not in descendants');\n return false;\n }\n\n return (\n clusterDescendants.includes(edge.v) ||\n isDescendant(edge.v, clusterId) ||\n isDescendant(edge.w, clusterId) ||\n clusterDescendants.includes(edge.w)\n );\n};\n\nconst copy = (clusterId, graph, newGraph, rootId) => {\n log.warn(\n 'Copying children of ',\n clusterId,\n 'root',\n rootId,\n 'data',\n graph.node(clusterId),\n rootId\n );\n const nodes = graph.children(clusterId) || [];\n\n if (clusterId !== rootId) {\n nodes.push(clusterId);\n }\n\n log.warn('Copying (nodes) clusterId', clusterId, 'nodes', nodes);\n\n nodes.forEach((node) => {\n if (graph.children(node).length > 0) {\n copy(node, graph, newGraph, rootId);\n } else {\n const data = graph.node(node);\n log.info('cp ', node, ' to ', rootId, ' with parent ', clusterId);\n newGraph.setNode(node, data);\n if (rootId !== graph.parent(node)) {\n log.warn('Setting parent', node, graph.parent(node));\n newGraph.setParent(node, graph.parent(node));\n }\n\n if (clusterId !== rootId && node !== clusterId) {\n log.debug('Setting parent', node, clusterId);\n newGraph.setParent(node, clusterId);\n } else {\n log.info('In copy ', clusterId, 'root', rootId, 'data', graph.node(clusterId), rootId);\n log.debug(\n 'Not Setting parent for node=',\n node,\n 'cluster!==rootId',\n clusterId !== rootId,\n 'node!==clusterId',\n node !== clusterId\n );\n }\n const edges = graph.edges(node);\n log.debug('Copying Edges', edges);\n edges.forEach((edge) => {\n log.info('Edge', edge);\n const data = graph.edge(edge.v, edge.w, edge.name);\n log.info('Edge data', data, rootId);\n try {\n if (edgeInCluster(edge, rootId)) {\n log.info('Copying as ', edge.v, edge.w, data, edge.name);\n newGraph.setEdge(edge.v, edge.w, data, edge.name);\n log.info('newGraph edges ', newGraph.edges(), newGraph.edge(newGraph.edges()[0]));\n } else {\n log.info(\n 'Skipping copy of edge ',\n edge.v,\n '-->',\n edge.w,\n ' rootId: ',\n rootId,\n ' clusterId:',\n clusterId\n );\n }\n } catch (e) {\n log.error(e);\n }\n });\n }\n log.debug('Removing node', node);\n graph.removeNode(node);\n });\n};\n\nexport const extractDescendants = (id, graph) => {\n const children = graph.children(id);\n let res = [...children];\n\n for (const child of children) {\n parents.set(child, id);\n res = [...res, ...extractDescendants(child, graph)];\n }\n\n return res;\n};\n\nexport const validate = (graph) => {\n const edges = graph.edges();\n log.trace('Edges: ', edges);\n for (const edge of edges) {\n if (graph.children(edge.v).length > 0) {\n log.trace('The node ', edge.v, ' is part of and edge even though it has children');\n return false;\n }\n if (graph.children(edge.w).length > 0) {\n log.trace('The node ', edge.w, ' is part of and edge even though it has children');\n return false;\n }\n }\n return true;\n};\n\nconst findCommonEdges = (graph, id1, id2) => {\n const edges1 = graph.edges().filter((edge) => edge.v === id1 || edge.w === id1);\n const edges2 = graph.edges().filter((edge) => edge.v === id2 || edge.w === id2);\n const edges1Prim = edges1.map((edge) => {\n return { v: edge.v === id1 ? id2 : edge.v, w: edge.w === id1 ? id1 : edge.w };\n });\n const edges2Prim = edges2.map((edge) => {\n return { v: edge.v, w: edge.w };\n });\n const result = edges1Prim.filter((edgeIn1) => {\n return edges2Prim.some((edge) => edgeIn1.v === edge.v && edgeIn1.w === edge.w);\n });\n\n return result;\n};\n\nexport const findNonClusterChild = (id, graph, clusterId) => {\n const children = graph.children(id);\n log.trace('Searching children of id ', id, children);\n if (children.length < 1) {\n return id;\n }\n let reserve;\n for (const child of children) {\n const _id = findNonClusterChild(child, graph, clusterId);\n\n const commonEdges = findCommonEdges(graph, clusterId, _id);\n\n if (_id) {\n if (commonEdges.length > 0) {\n reserve = _id;\n } else {\n return _id;\n }\n }\n }\n return reserve;\n};\n\nconst getAnchorId = (id) => {\n if (!clusterDb.has(id)) {\n return id;\n }\n if (!clusterDb.get(id).externalConnections) {\n return id;\n }\n\n if (clusterDb.has(id)) {\n return clusterDb.get(id).id;\n }\n return id;\n};\n\nexport const adjustClustersAndEdges = (graph, depth) => {\n if (!graph || depth > 10) {\n log.debug('Opting out, no graph ');\n return;\n } else {\n log.debug('Opting in, graph ');\n }\n\n graph.nodes().forEach(function (id) {\n const children = graph.children(id);\n if (children.length > 0) {\n log.warn(\n 'Cluster identified',\n id,\n ' Replacement id in edges: ',\n findNonClusterChild(id, graph, id)\n );\n descendants.set(id, extractDescendants(id, graph));\n clusterDb.set(id, { id: findNonClusterChild(id, graph, id), clusterData: graph.node(id) });\n }\n });\n\n graph.nodes().forEach(function (id) {\n const children = graph.children(id);\n const edges = graph.edges();\n if (children.length > 0) {\n log.debug('Cluster identified', id, descendants);\n edges.forEach((edge) => {\n const d1 = isDescendant(edge.v, id);\n const d2 = isDescendant(edge.w, id);\n\n if (d1 ^ d2) {\n log.warn('Edge: ', edge, ' leaves cluster ', id);\n log.warn('Descendants of XXX ', id, ': ', descendants.get(id));\n clusterDb.get(id).externalConnections = true;\n }\n });\n } else {\n log.debug('Not a cluster ', id, descendants);\n }\n });\n\n for (let id of clusterDb.keys()) {\n const nonClusterChild = clusterDb.get(id).id;\n const parent = graph.parent(nonClusterChild);\n\n if (parent !== id && clusterDb.has(parent) && !clusterDb.get(parent).externalConnections) {\n clusterDb.get(id).id = parent;\n }\n }\n\n graph.edges().forEach(function (e) {\n const edge = graph.edge(e);\n log.warn('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e));\n log.warn('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(graph.edge(e)));\n\n let v = e.v;\n let w = e.w;\n log.warn(\n 'Fix XXX',\n clusterDb,\n 'ids:',\n e.v,\n e.w,\n 'Translating: ',\n clusterDb.get(e.v),\n ' --- ',\n clusterDb.get(e.w)\n );\n if (clusterDb.get(e.v) || clusterDb.get(e.w)) {\n log.warn('Fixing and trying - removing XXX', e.v, e.w, e.name);\n v = getAnchorId(e.v);\n w = getAnchorId(e.w);\n graph.removeEdge(e.v, e.w, e.name);\n if (v !== e.v) {\n const parent = graph.parent(v);\n clusterDb.get(parent).externalConnections = true;\n edge.fromCluster = e.v;\n }\n if (w !== e.w) {\n const parent = graph.parent(w);\n clusterDb.get(parent).externalConnections = true;\n edge.toCluster = e.w;\n }\n log.warn('Fix Replacing with XXX', v, w, e.name);\n graph.setEdge(v, w, edge, e.name);\n }\n });\n log.warn('Adjusted Graph', graphlibJson.write(graph));\n extractor(graph, 0);\n\n log.trace(clusterDb);\n};\n\nexport const extractor = (graph, depth) => {\n log.warn('extractor - ', depth, graphlibJson.write(graph), graph.children('D'));\n if (depth > 10) {\n log.error('Bailing out');\n return;\n }\n let nodes = graph.nodes();\n let hasChildren = false;\n for (const node of nodes) {\n const children = graph.children(node);\n hasChildren = hasChildren || children.length > 0;\n }\n\n if (!hasChildren) {\n log.debug('Done, no node has children', graph.nodes());\n return;\n }\n log.debug('Nodes = ', nodes, depth);\n for (const node of nodes) {\n log.debug(\n 'Extracting node',\n node,\n clusterDb,\n clusterDb.has(node) && !clusterDb.get(node).externalConnections,\n !graph.parent(node),\n graph.node(node),\n graph.children('D'),\n ' Depth ',\n depth\n );\n if (!clusterDb.has(node)) {\n log.debug('Not a cluster', node, depth);\n } else if (\n !clusterDb.get(node).externalConnections &&\n graph.children(node) &&\n graph.children(node).length > 0\n ) {\n log.warn(\n 'Cluster without external connections, without a parent and with children',\n node,\n depth\n );\n\n const graphSettings = graph.graph();\n let dir = graphSettings.rankdir === 'TB' ? 'LR' : 'TB';\n if (clusterDb.get(node)?.clusterData?.dir) {\n dir = clusterDb.get(node).clusterData.dir;\n log.warn('Fixing dir', clusterDb.get(node).clusterData.dir, dir);\n }\n\n const clusterGraph = new graphlib.Graph({\n multigraph: true,\n compound: true,\n })\n .setGraph({\n rankdir: dir,\n nodesep: 50,\n ranksep: 50,\n marginx: 8,\n marginy: 8,\n })\n .setDefaultEdgeLabel(function () {\n return {};\n });\n\n log.warn('Old graph before copy', graphlibJson.write(graph));\n copy(node, graph, clusterGraph, node);\n graph.setNode(node, {\n clusterNode: true,\n id: node,\n clusterData: clusterDb.get(node).clusterData,\n label: clusterDb.get(node).label,\n graph: clusterGraph,\n });\n log.warn('New graph after copy node: (', node, ')', graphlibJson.write(clusterGraph));\n log.debug('Old graph after copy', graphlibJson.write(graph));\n } else {\n log.warn(\n 'Cluster ** ',\n node,\n ' **not meeting the criteria !externalConnections:',\n !clusterDb.get(node).externalConnections,\n ' no parent: ',\n !graph.parent(node),\n ' children ',\n graph.children(node) && graph.children(node).length > 0,\n graph.children('D'),\n depth\n );\n log.debug(clusterDb);\n }\n }\n\n nodes = graph.nodes();\n log.warn('New list of nodes', nodes);\n for (const node of nodes) {\n const data = graph.node(node);\n log.warn(' Now next level', node, data);\n if (data?.clusterNode) {\n extractor(data.graph, depth + 1);\n }\n }\n};\n\nconst sorter = (graph, nodes) => {\n if (nodes.length === 0) {\n return [];\n }\n let result = Object.assign([], nodes);\n nodes.forEach((node) => {\n const children = graph.children(node);\n const sorted = sorter(graph, children);\n result = [...result, ...sorted];\n });\n\n return result;\n};\n\nexport const sortNodesByHierarchy = (graph) => sorter(graph, graph.children());\n", "import { layout as dagreLayout } from 'dagre-d3-es/src/dagre/index.js';\nimport * as graphlibJson from 'dagre-d3-es/src/graphlib/json.js';\nimport * as graphlib from 'dagre-d3-es/src/graphlib/index.js';\nimport insertMarkers from '../../rendering-elements/markers.js';\nimport { updateNodeBounds } from '../../rendering-elements/shapes/util.js';\nimport {\n clear as clearGraphlib,\n clusterDb,\n adjustClustersAndEdges,\n findNonClusterChild,\n sortNodesByHierarchy,\n} from './mermaid-graphlib.js';\nimport {\n insertNode,\n positionNode,\n clear as clearNodes,\n setNodeElem,\n} from '../../rendering-elements/nodes.js';\nimport { insertCluster, clear as clearClusters } from '../../rendering-elements/clusters.js';\nimport {\n insertEdgeLabel,\n positionEdgeLabel,\n insertEdge,\n clear as clearEdges,\n} from '../../rendering-elements/edges.js';\nimport { log } from '$root/logger.js';\nimport { getSubGraphTitleMargins } from '../../../utils/subGraphTitleMargins.js';\nimport { getConfig } from '../../../diagram-api/diagramAPI.js';\n\nconst recursiveRender = async (_elem, graph, diagramType, id, parentCluster, siteConfig) => {\n log.warn('Graph in recursive render:XAX', graphlibJson.write(graph), parentCluster);\n const dir = graph.graph().rankdir;\n log.trace('Dir in recursive render - dir:', dir);\n\n const elem = _elem.insert('g').attr('class', 'root');\n if (!graph.nodes()) {\n log.info('No nodes found for', graph);\n } else {\n log.info('Recursive render XXX', graph.nodes());\n }\n if (graph.edges().length > 0) {\n log.info('Recursive edges', graph.edge(graph.edges()[0]));\n }\n const clusters = elem.insert('g').attr('class', 'clusters');\n const edgePaths = elem.insert('g').attr('class', 'edgePaths');\n const edgeLabels = elem.insert('g').attr('class', 'edgeLabels');\n const nodes = elem.insert('g').attr('class', 'nodes');\n\n // Insert nodes, this will insert them into the dom and each node will get a size. The size is updated\n // to the abstract node and is later used by dagre for the layout\n await Promise.all(\n graph.nodes().map(async function (v) {\n const node = graph.node(v);\n if (parentCluster !== undefined) {\n const data = JSON.parse(JSON.stringify(parentCluster.clusterData));\n // data.clusterPositioning = true;\n log.trace(\n 'Setting data for parent cluster XXX\\n Node.id = ',\n v,\n '\\n data=',\n data.height,\n '\\nParent cluster',\n parentCluster.height\n );\n graph.setNode(parentCluster.id, data);\n if (!graph.parent(v)) {\n log.trace('Setting parent', v, parentCluster.id);\n graph.setParent(v, parentCluster.id, data);\n }\n }\n log.info('(Insert) Node XXX' + v + ': ' + JSON.stringify(graph.node(v)));\n if (node?.clusterNode) {\n // const children = graph.children(v);\n log.info('Cluster identified XBX', v, node.width, graph.node(v));\n\n // `node.graph.setGraph` applies the graph configurations such as nodeSpacing to subgraphs as without this the default values would be used\n // We override only the `ranksep` and `nodesep` configurations to allow for setting subgraph spacing while avoiding overriding other properties\n const { ranksep, nodesep } = graph.graph();\n node.graph.setGraph({\n ...node.graph.graph(),\n ranksep: ranksep + 25,\n nodesep,\n });\n\n // \"o\" will contain the full cluster not just the children\n const o = await recursiveRender(\n nodes,\n node.graph,\n diagramType,\n id,\n graph.node(v),\n siteConfig\n );\n const newEl = o.elem;\n updateNodeBounds(node, newEl);\n // node.height = o.diff;\n node.diff = o.diff || 0;\n log.info(\n 'New compound node after recursive render XAX',\n v,\n 'width',\n // node,\n node.width,\n 'height',\n node.height\n // node.x,\n // node.y\n );\n setNodeElem(newEl, node);\n } else {\n if (graph.children(v).length > 0) {\n // This is a cluster but not to be rendered recursively\n // Render as before\n log.trace(\n 'Cluster - the non recursive path XBX',\n v,\n node.id,\n node,\n node.width,\n 'Graph:',\n graph\n );\n log.trace(findNonClusterChild(node.id, graph));\n clusterDb.set(node.id, { id: findNonClusterChild(node.id, graph), node });\n // insertCluster(clusters, graph.node(v));\n } else {\n log.trace('Node - the non recursive path XAX', v, nodes, graph.node(v), dir);\n await insertNode(nodes, graph.node(v), dir);\n }\n }\n })\n );\n\n const processEdges = async () => {\n const edgePromises = graph.edges().map(async function (e) {\n const edge = graph.edge(e.v, e.w, e.name);\n log.info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e));\n log.info('Edge ' + e.v + ' -> ' + e.w + ': ', e, ' ', JSON.stringify(graph.edge(e)));\n\n // Check if link is either from or to a cluster\n log.info(\n 'Fix',\n clusterDb,\n 'ids:',\n e.v,\n e.w,\n 'Translating: ',\n clusterDb.get(e.v),\n clusterDb.get(e.w)\n );\n await insertEdgeLabel(edgeLabels, edge);\n });\n\n await Promise.all(edgePromises);\n };\n\n await processEdges();\n\n log.info('Graph before layout:', JSON.stringify(graphlibJson.write(graph)));\n\n log.info('############################################# XXX');\n log.info('### Layout ### XXX');\n log.info('############################################# XXX');\n\n dagreLayout(graph);\n\n log.info('Graph after layout:', JSON.stringify(graphlibJson.write(graph)));\n // Move the nodes to the correct place\n let diff = 0;\n let { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig);\n await Promise.all(\n sortNodesByHierarchy(graph).map(async function (v) {\n const node = graph.node(v);\n log.info(\n 'Position XBX => ' + v + ': (' + node.x,\n ',' + node.y,\n ') width: ',\n node.width,\n ' height: ',\n node.height\n );\n if (node?.clusterNode) {\n // Adjust for padding when on root level\n node.y += subGraphTitleTotalMargin;\n\n log.info(\n 'A tainted cluster node XBX1',\n v,\n node.id,\n node.width,\n node.height,\n node.x,\n node.y,\n graph.parent(v)\n );\n clusterDb.get(node.id).node = node;\n positionNode(node);\n } else {\n // A tainted cluster node\n if (graph.children(v).length > 0) {\n log.info(\n 'A pure cluster node XBX1',\n v,\n node.id,\n node.x,\n node.y,\n node.width,\n node.height,\n graph.parent(v)\n );\n node.height += subGraphTitleTotalMargin;\n graph.node(node.parentId);\n const halfPadding = node?.padding / 2 || 0;\n const labelHeight = node?.labelBBox?.height || 0;\n const offsetY = labelHeight - halfPadding || 0;\n log.debug('OffsetY', offsetY, 'labelHeight', labelHeight, 'halfPadding', halfPadding);\n await insertCluster(clusters, node);\n\n // A cluster in the non-recursive way\n clusterDb.get(node.id).node = node;\n } else {\n // Regular node\n const parent = graph.node(node.parentId);\n node.y += subGraphTitleTotalMargin / 2;\n log.info(\n 'A regular node XBX1 - using the padding',\n node.id,\n 'parent',\n node.parentId,\n node.width,\n node.height,\n node.x,\n node.y,\n 'offsetY',\n node.offsetY,\n 'parent',\n parent,\n parent?.offsetY,\n node\n );\n\n positionNode(node);\n }\n }\n })\n );\n\n // Move the edge labels to the correct place after layout\n graph.edges().forEach(function (e) {\n const edge = graph.edge(e);\n log.info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(edge), edge);\n\n edge.points.forEach((point) => (point.y += subGraphTitleTotalMargin / 2));\n const startNode = graph.node(e.v);\n var endNode = graph.node(e.w);\n const paths = insertEdge(edgePaths, edge, clusterDb, diagramType, startNode, endNode, id);\n positionEdgeLabel(edge, paths);\n });\n\n graph.nodes().forEach(function (v) {\n const n = graph.node(v);\n log.info(v, n.type, n.diff);\n if (n.isGroup) {\n diff = n.diff;\n }\n });\n log.warn('Returning from recursive render XAX', elem, diff);\n return { elem, diff };\n};\n\nexport const render = async (data4Layout, svg) => {\n const graph = new graphlib.Graph({\n multigraph: true,\n compound: true,\n })\n .setGraph({\n rankdir: data4Layout.direction,\n nodesep:\n data4Layout.config?.nodeSpacing ||\n data4Layout.config?.flowchart?.nodeSpacing ||\n data4Layout.nodeSpacing,\n ranksep:\n data4Layout.config?.rankSpacing ||\n data4Layout.config?.flowchart?.rankSpacing ||\n data4Layout.rankSpacing,\n marginx: 8,\n marginy: 8,\n })\n .setDefaultEdgeLabel(function () {\n return {};\n });\n const element = svg.select('g');\n insertMarkers(element, data4Layout.markers, data4Layout.type, data4Layout.diagramId);\n clearNodes();\n clearEdges();\n clearClusters();\n clearGraphlib();\n\n data4Layout.nodes.forEach((node) => {\n graph.setNode(node.id, { ...node });\n if (node.parentId) {\n graph.setParent(node.id, node.parentId);\n }\n });\n\n log.debug('Edges:', data4Layout.edges);\n data4Layout.edges.forEach((edge) => {\n // Handle self-loops\n if (edge.start === edge.end) {\n const nodeId = edge.start;\n const specialId1 = nodeId + '---' + nodeId + '---1';\n const specialId2 = nodeId + '---' + nodeId + '---2';\n const node = graph.node(nodeId);\n graph.setNode(specialId1, {\n domId: specialId1,\n id: specialId1,\n parentId: node.parentId,\n labelStyle: '',\n label: '',\n padding: 0,\n shape: 'labelRect',\n // shape: 'rect',\n style: '',\n width: 10,\n height: 10,\n });\n graph.setParent(specialId1, node.parentId);\n graph.setNode(specialId2, {\n domId: specialId2,\n id: specialId2,\n parentId: node.parentId,\n labelStyle: '',\n padding: 0,\n // shape: 'rect',\n shape: 'labelRect',\n label: '',\n style: '',\n width: 10,\n height: 10,\n });\n graph.setParent(specialId2, node.parentId);\n\n const edge1 = structuredClone(edge);\n const edgeMid = structuredClone(edge);\n const edge2 = structuredClone(edge);\n edge1.label = '';\n edge1.arrowTypeEnd = 'none';\n edge1.id = nodeId + '-cyclic-special-1';\n edgeMid.arrowTypeEnd = 'none';\n edgeMid.id = nodeId + '-cyclic-special-mid';\n edge2.label = '';\n if (node.isGroup) {\n edge1.fromCluster = nodeId;\n edge2.toCluster = nodeId;\n }\n edge2.id = nodeId + '-cyclic-special-2';\n graph.setEdge(nodeId, specialId1, edge1, nodeId + '-cyclic-special-0');\n graph.setEdge(specialId1, specialId2, edgeMid, nodeId + '-cyclic-special-1');\n graph.setEdge(specialId2, nodeId, edge2, nodeId + '-cyc;\n}\n\nexport type LayoutLoader = () => Promise;\nexport interface LayoutLoaderDefinition {\n name: string;\n loader: LayoutLoader;\n algorithm?: string;\n}\n\nconst layoutAlgorithms: Record = {};\n\nexport const registerLayoutLoaders = (loaders: LayoutLoaderDefinition[]) => {\n for (const loader of loaders) {\n layoutAlgorithms[loader.name] = loader;\n }\n};\n\n// TODO: Should we load dagre without lazy loading?\nconst registerDefaultLayoutLoaders = () => {\n registerLayoutLoaders([\n {\n name: 'dagre',\n loader: async () => await import('./layout-algorithms/dagre/index.js'),\n },\n ]);\n};\n\nregisterDefaultLayoutLoaders();\n\nexport const render = async (data4Layout: LayoutData, svg: SVG) => {\n if (!(data4Layout.layoutAlgorithm in layoutAlgorithms)) {\n throw new Error(`Unknown layout algorithm: ${data4Layout.layoutAlgorithm}`);\n }\n\n const layoutDefinition = layoutAlgorithms[data4Layout.layoutAlgorithm];\n const layoutRenderer = await layoutDefinition.loader();\n return layoutRenderer.render(data4Layout, svg, internalHelpers, {\n algorithm: layoutDefinition.algorithm,\n });\n};\n\n/**\n * Get the registered layout algorithm. If the algorithm is not registered, use the fallback algorithm.\n */\nexport const getRegisteredLayoutAlgorithm = (algorithm = '', { fallback = 'dagre' } = {}) => {\n if (algorithm in layoutAlgorithms) {\n return algorithm;\n }\n if (fallback in layoutAlgorithms) {\n log.warn(`Layout algorithm ${algorithm} is not registered. Using ${fallback} as fallback.`);\n return fallback;\n }\n throw new Error(`Both layout algorithms ${algorithm} and ${fallback} are not registered.`);\n};\n", "import { configureSvgSize } from '$root/setupGraphViewbox.js';\nimport type { SVG } from '$root/diagram-api/types.js';\nimport { log } from '$root/logger.js';\n\nexport const setupViewPortForSVG = (\n svg: SVG,\n padding: number,\n cssDiagram: string,\n useMaxWidth: boolean\n) => {\n // Initialize the SVG element and set the diagram class\n svg.attr('class', cssDiagram);\n\n // Calculate the dimensions and position with padding\n const { width, height, x, y } = calculateDimensionsWithPadding(svg, padding);\n\n // Configure the size and aspect ratio of the SVG\n configureSvgSize(svg, height, width, useMaxWidth);\n\n // Update the viewBox to ensure all content is visible with padding\n const viewBox = createViewBox(x, y, width, height, padding);\n svg.attr('viewBox', viewBox);\n\n // Log the viewBox configuration for debugging\n log.debug(`viewBox configured: ${viewBox} with padding: ${padding}`);\n};\n\nconst calculateDimensionsWithPadding = (svg: SVG, padding: number) => {\n const bounds = svg.node()?.getBBox() || { width: 0, height: 0, x: 0, y: 0 };\n return {\n width: bounds.width + padding * 2,\n height: bounds.height + padding * 2,\n x: bounds.x,\n y: bounds.y,\n };\n};\n\nconst createViewBox = (x: number, y: number, width: number, height: number, padding: number) => {\n return `${x - padding} ${y - padding} ${width} ${height}`;\n};\n", "import { select } from 'd3';\nimport { getConfig } from '../../diagram-api/diagramAPI.js';\nimport type { DiagramStyleClassDef } from '../../diagram-api/types.js';\nimport { log } from '../../logger.js';\nimport { getDiagramElement } from '../../rendering-util/insertElementsForSize.js';\nimport { getRegisteredLayoutAlgorithm, render } from '../../rendering-util/render.js';\nimport { setupViewPortForSVG } from '../../rendering-util/setupViewPortForSVG.js';\nimport type { LayoutData } from '../../rendering-util/types.js';\nimport utils from '../../utils.js';\nimport { getDirection } from './flowDb.js';\n\nexport const getClasses = function (\n text: string,\n diagramObj: any\n): Map {\n return diagramObj.db.getClasses();\n};\n\nexport const draw = async function (text: string, id: string, _version: string, diag: any) {\n log.info('REF0:');\n log.info('Drawing state diagram (v2)', id);\n const { securityLevel, flowchart: conf, layout } = getConfig();\n\n // Handle root and document for when rendering in sandbox mode\n let sandboxElement;\n if (securityLevel === 'sandbox') {\n sandboxElement = select('#i' + id);\n }\n\n // @ts-ignore - document is always available\n const doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document;\n\n // The getData method provided in all supported diagrams is used to extract the data from the parsed structure\n // into the Layout data format\n log.debug('Before getData: ');\n const data4Layout = diag.db.getData() as LayoutData;\n log.debug('Data: ', data4Layout);\n // Create the root SVG\n const svg = getDiagramElement(id, securityLevel);\n const direction = getDirection();\n\n data4Layout.type = diag.type;\n data4Layout.layoutAlgorithm = getRegisteredLayoutAlgorithm(layout);\n if (data4Layout.layoutAlgorithm === 'dagre' && layout === 'elk') {\n log.warn(\n 'flowchart-elk was moved to an external package in Mermaid v11. Please refer [release notes](https://github.com/mermaid-js/mermaid/releases/tag/v11.0.0) for more details. This diagram will be rendered using `dagre` layout as a fallback.'\n );\n }\n data4Layout.direction = direction;\n data4Layout.nodeSpacing = conf?.nodeSpacing || 50;\n data4Layout.rankSpacing = conf?.rankSpacing || 50;\n data4Layout.markers = ['point', 'circle', 'cross'];\n\n data4Layout.diagramId = id;\n log.debug('REF1:', data4Layout);\n await render(data4Layout, svg);\n const padding = data4Layout.config.flowchart?.diagramPadding ?? 8;\n utils.insertTitle(\n svg,\n 'flowchartTitleText',\n conf?.titleTopMargin || 0,\n diag.db.getDiagramTitle()\n );\n setupViewPortForSVG(svg, padding, 'flowchart', conf?.useMaxWidth || false);\n\n // If node has a link, wrap it in an anchor SVG object.\n for (const vertex of data4Layout.nodes) {\n const node = select(`#${id} [id=\"${vertex.id}\"]`);\n if (!node || !vertex.link) {\n continue;\n }\n const link = doc.createElementNS('http://www.w3.org/2000/svg', 'a');\n link.setAttributeNS('http://www.w3.org/2000/svg', 'class', vertex.cssClasses);\n link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener');\n if (securityLevel === 'sandbox') {\n link.setAttributeNS('http://www.w3.org/2000/svg', 'target', '_top');\n } else if (vertex.linkTarget) {\n link.setAttributeNS('http://www.w3.org/2000/svg', 'target', vertex.linkTarget);\n }\n\n const linkNode = node.insert(function () {\n return link;\n }, ':first-child');\n\n const shape = node.select('.label-container');\n if (shape) {\n linkNode.append(function () {\n return shape.node();\n });\n }\n\n const label = node.select('.label');\n if (label) {\n linkNode.append(function () {\n return label.node();\n });\n }\n }\n};\n\nexport default {\n getClasses,\n draw,\n};\n", "/* parser generated by jison 0.4.18 */\n/*\n Returns a Parser object of the following structure:\n\n Parser: {\n yy: {}\n }\n\n Parser.prototype: {\n yy: {},\n trace: function(),\n symbols_: {associative list: name ==> number},\n terminals_: {associative list: number ==> name},\n productions_: [...],\n performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),\n table: [...],\n defaultActions: {...},\n parseError: function(str, hash),\n parse: function(input),\n\n lexer: {\n EOF: 1,\n parseError: function(str, hash),\n setInput: function(input),\n input: function(),\n unput: function(str),\n more: function(),\n less: function(n),\n pastInput: function(),\n upcomingInput: function(),\n showPosition: function(),\n test_match: function(regex_match_array, rule_index),\n next: function(),\n lex: function(),\n begin: function(condition),\n popState: function(),\n _currentRules: function(),\n topState: function(),\n pushState: function(condition),\n\n options: {\n ranges: boolean (optional: true ==> token location info will include a .range[] member)\n flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)\n backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)\n },\n\n performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),\n rules: [...],\n conditions: {associative list: name ==> set},\n }\n }\n\n\n token location info (@$, _$, etc.): {\n first_line: n,\n last_line: n,\n first_column: n,\n last_column: n,\n range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)\n }\n\n\n the parseError function receives a 'hash' object with these members for lexer and parser errors: {\n text: (matched text)\n token: (the produced terminal token, if any)\n line: (yylineno)\n }\n while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {\n loc: (yylloc)\n expected: (string describing the set of expected tokens)\n recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)\n }\n*/\nvar parser = (function(){\nvar o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,4],$V1=[1,3],$V2=[1,5],$V3=[1,8,9,10,11,27,34,36,38,42,58,81,82,83,84,85,86,99,102,103,106,108,111,112,113,118,119,120,121],$V4=[2,2],$V5=[1,13],$V6=[1,14],$V7=[1,15],$V8=[1,16],$V9=[1,23],$Va=[1,25],$Vb=[1,26],$Vc=[1,27],$Vd=[1,49],$Ve=[1,48],$Vf=[1,29],$Vg=[1,30],$Vh=[1,31],$Vi=[1,32],$Vj=[1,33],$Vk=[1,44],$Vl=[1,46],$Vm=[1,42],$Vn=[1,47],$Vo=[1,43],$Vp=[1,50],$Vq=[1,45],$Vr=[1,51],$Vs=[1,52],$Vt=[1,34],$Vu=[1,35],$Vv=[1,36],$Vw=[1,37],$Vx=[1,57],$Vy=[1,8,9,10,11,27,32,34,36,38,42,58,81,82,83,84,85,86,99,102,103,106,108,111,112,113,118,119,120,121],$Vz=[1,61],$VA=[1,60],$VB=[1,62],$VC=[8,9,11,73,75],$VD=[1,88],$VE=[1,93],$VF=[1,92],$VG=[1,89],$VH=[1,85],$VI=[1,91],$VJ=[1,87],$VK=[1,94],$VL=[1,90],$VM=[1,95],$VN=[1,86],$VO=[8,9,10,11,73,75],$VP=[8,9,10,11,44,73,75],$VQ=[8,9,10,11,29,42,44,46,48,50,52,54,56,58,61,63,65,66,68,73,75,86,99,102,103,106,108,111,112,113],$VR=[8,9,11,42,58,73,75,86,99,102,103,106,108,111,112,113],$VS=[42,58,86,99,102,103,106,108,111,112,113],$VT=[1,121],$VU=[1,120],$VV=[1,128],$VW=[1,142],$VX=[1,143],$VY=[1,144],$VZ=[1,145],$V_=[1,130],$V$=[1,132],$V01=[1,136],$V11=[1,137],$V21=[1,138],$V31=[1,139],$V41=[1,140],$V51=[1,141],$V61=[1,146],$V71=[1,147],$V81=[1,126],$V91=[1,127],$Va1=[1,134],$Vb1=[1,129],$Vc1=[1,133],$Vd1=[1,131],$Ve1=[8,9,10,11,27,32,34,36,38,42,58,81,82,83,84,85,86,99,102,103,106,108,111,112,113,118,119,120,121],$Vf1=[1,149],$Vg1=[8,9,11],$Vh1=[8,9,10,11,14,42,58,86,102,103,106,108,111,112,113],$Vi1=[1,169],$Vj1=[1,165],$Vk1=[1,166],$Vl1=[1,170],$Vm1=[1,167],$Vn1=[1,168],$Vo1=[75,113,116],$Vp1=[8,9,10,11,12,14,27,29,32,42,58,73,81,82,83,84,85,86,87,102,106,108,111,112,113],$Vq1=[10,103],$Vr1=[31,47,49,51,53,55,60,62,64,65,67,69,113,114,115],$Vs1=[1,235],$Vt1=[1,233],$Vu1=[1,237],$Vv1=[1,231],$Vw1=[1,232],$Vx1=[1,234],$Vy1=[1,236],$Vz1=[1,238],$VA1=[1,255],$VB1=[8,9,11,103],$VC1=[8,9,10,11,58,81,102,103,106,107,108,109];\nvar parser = {trace: function trace () { },\nyy: {},\nsymbols_: {\"error\":2,\"start\":3,\"graphConfig\":4,\"document\":5,\"line\":6,\"statement\":7,\"SEMI\":8,\"NEWLINE\":9,\"SPACE\":10,\"EOF\":11,\"GRAPH\":12,\"NODIR\":13,\"DIR\":14,\"FirstStmtSeparator\":15,\"ending\":16,\"endToken\":17,\"spaceList\":18,\"spaceListNewline\":19,\"vertexStatement\":20,\"separator\":21,\"styleStatement\":22,\"linkStyleStatement\":23,\"classDefStatement\":24,\"classStatement\":25,\"clickStatement\":26,\"subgraph\":27,\"textNoTags\":28,\"SQS\":29,\"text\":30,\"SQE\":31,\"end\":32,\"direction\":33,\"acc_title\":34,\"acc_title_value\":35,\"acc_descr\":36,\"acc_descr_value\":37,\"acc_descr_multiline_value\":38,\"link\":39,\"node\":40,\"styledVertex\":41,\"AMP\":42,\"vertex\":43,\"STYLE_SEPARATOR\":44,\"idString\":45,\"DOUBLECIRCLESTART\":46,\"DOUBLECIRCLEEND\":47,\"PS\":48,\"PE\":49,\"(-\":50,\"-)\":51,\"STADIUMSTART\":52,\"STADIUMEND\":53,\"SUBROUTINESTART\":54,\"SUBROUTINEEND\":55,\"VERTEX_WITH_PROPS_START\":56,\"NODE_STRING[field]\":57,\"COLON\":58,\"NODE_STRING[value]\":59,\"PIPE\":60,\"CYLINDERSTART\":61,\"CYLINDEREND\":62,\"DIAMOND_START\":63,\"DIAMOND_STOP\":64,\"TAGEND\":65,\"TRAPSTART\":66,\"TRAPEND\":67,\"INVTRAPSTART\":68,\"INVTRAPEND\":69,\"linkStatement\":70,\"arrowText\":71,\"TESTSTR\":72,\"START_LINK\":73,\"edgeText\":74,\"LINK\":75,\"edgeTextToken\":76,\"STR\":77,\"MD_STR\":78,\"textToken\":79,\"keywords\":80,\"STYLE\":81,\"LINKSTYLE\":82,\"CLASSDEF\":83,\"CLASS\":84,\"CLICK\":85,\"DOWN\":86,\"UP\":87,\"textNoTagsToken\":88,\"stylesOpt\":89,\"idString[vertex]\":90,\"idString[class]\":91,\"CALLBACKNAME\":92,\"CALLBACKARGS\":93,\"HREF\":94,\"LINK_TARGET\":95,\"STR[link]\":96,\"STR[tooltip]\":97,\"alphaNum\":98,\"DEFAULT\":99,\"numList\":100,\"INTERPOLATE\":101,\"NUM\":102,\"COMMA\":103,\"style\":104,\"styleComponent\":105,\"NODE_STRING\":106,\"UNIT\":107,\"BRKT\":108,\"PCT\":109,\"idStringToken\":110,\"MINUS\":111,\"MULT\":112,\"UNICODE_TEXT\":113,\"TEXT\":114,\"TAGSTART\":115,\"EDGE_TEXT\":116,\"alphaNumToken\":117,\"direction_tb\":118,\"direction_bt\":119,\"direction_rl\":120,\"direction_lr\":121,\"$accept\":0,\"$end\":1},\nterminals_: {2:\"error\",8:\"SEMI\",9:\"NEWLINE\",10:\"SPACE\",11:\"EOF\",12:\"GRAPH\",13:\"NODIR\",14:\"DIR\",27:\"subgraph\",29:\"SQS\",31:\"SQE\",32:\"end\",34:\"acc_title\",35:\"acc_title_value\",36:\"acc_descr\",37:\"acc_descr_value\",38:\"acc_descr_multiline_value\",42:\"AMP\",44:\"STYLE_SEPARATOR\",46:\"DOUBLECIRCLESTART\",47:\"DOUBLECIRCLEEND\",48:\"PS\",49:\"PE\",50:\"(-\",51:\"-)\",52:\"STADIUMSTART\",53:\"STADIUMEND\",54:\"SUBROUTINESTART\",55:\"SUBROUTINEEND\",56:\"VERTEX_WITH_PROPS_START\",57:\"NODE_STRING[field]\",58:\"COLON\",59:\"NODE_STRING[value]\",60:\"PIPE\",61:\"CYLINDERSTART\",62:\"CYLINDEREND\",63:\"DIAMOND_START\",64:\"DIAMOND_STOP\",65:\"TAGEND\",66:\"TRAPSTART\",67:\"TRAPEND\",68:\"INVTRAPSTART\",69:\"INVTRAPEND\",72:\"TESTSTR\",73:\"START_LINK\",75:\"LINK\",77:\"STR\",78:\"MD_STR\",81:\"STYLE\",82:\"LINKSTYLE\",83:\"CLASSDEF\",84:\"CLASS\",85:\"CLICK\",86:\"DOWN\",87:\"UP\",90:\"idString[vertex]\",91:\"idString[class]\",92:\"CALLBACKNAME\",93:\"CALLBACKARGS\",94:\"HREF\",95:\"LINK_TARGET\",96:\"STR[link]\",97:\"STR[tooltip]\",99:\"DEFAULT\",101:\"INTERPOLATE\",102:\"NUM\",103:\"COMMA\",106:\"NODE_STRING\",107:\"UNIT\",108:\"BRKT\",109:\"PCT\",111:\"MINUS\",112:\"MULT\",113:\"UNICODE_TEXT\",114:\"TEXT\",115:\"TAGSTART\",116:\"EDGE_TEXT\",118:\"direction_tb\",119:\"direction_bt\",120:\"direction_rl\",121:\"direction_lr\"},\nproductions_: [0,[3,2],[5,0],[5,2],[6,1],[6,1],[6,1],[6,1],[6,1],[4,2],[4,2],[4,2],[4,3],[16,2],[16,1],[17,1],[17,1],[17,1],[15,1],[15,1],[15,2],[19,2],[19,2],[19,1],[19,1],[18,2],[18,1],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,9],[7,6],[7,4],[7,1],[7,2],[7,2],[7,1],[21,1],[21,1],[21,1],[20,3],[20,4],[20,2],[20,1],[40,1],[40,5],[41,1],[41,3],[43,4],[43,4],[43,6],[43,4],[43,4],[43,4],[43,8],[43,4],[43,4],[43,4],[43,6],[43,4],[43,4],[43,4],[43,4],[43,4],[43,1],[39,2],[39,3],[39,3],[39,1],[39,3],[74,1],[74,2],[74,1],[74,1],[70,1],[71,3],[30,1],[30,2],[30,1],[30,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[80,1],[28,1],[28,2],[28,1],[28,1],[24,5],[25,5],[26,2],[26,4],[26,3],[26,5],[26,3],[26,5],[26,5],[26,7],[26,2],[26,4],[26,2],[26,4],[26,4],[26,6],[22,5],[23,5],[23,5],[23,9],[23,9],[23,7],[23,7],[100,1],[100,3],[89,1],[89,3],[104,1],[104,2],[105,1],[105,1],[105,1],[105,1],[105,1],[105,1],[105,1],[105,1],[110,1],[110,1],[110,1],[110,1],[110,1],[110,1],[110,1],[110,1],[110,1],[110,1],[110,1],[79,1],[79,1],[79,1],[79,1],[88,1],[88,1],[88,1],[88,1],[88,1],[88,1],[88,1],[88,1],[88,1],[88,1],[88,1],[76,1],[76,1],[117,1],[117,1],[117,1],[117,1],[117,1],[117,1],[117,1],[117,1],[117,1],[117,1],[117,1],[45,1],[45,2],[98,1],[98,2],[33,1],[33,1],[33,1],[33,1]],\nperformAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {\n/* this == yyval */\n\nvar $0 = $$.length - 1;\nswitch (yystate) {\ncase 2:\n this.$ = [];\nbreak;\ncase 3:\n\n\t if(!Array.isArray($$[$0]) || $$[$0].length > 0){\n\t $$[$0-1].push($$[$0]);\n\t }\n\t this.$=$$[$0-1];\nbreak;\ncase 4: case 176:\nthis.$=$$[$0];\nbreak;\ncase 11:\n yy.setDirection('TB');this.$ = 'TB';\nbreak;\ncase 12:\n yy.setDirection($$[$0-1]);this.$ = $$[$0-1];\nbreak;\ncase 27:\n /* console.warn('finat vs', $$[$0-1].nodes); */ this.$=$$[$0-1].nodes\nbreak;\ncase 28: case 29: case 30: case 31: case 32:\nthis.$=[];\nbreak;\ncase 33:\nthis.$=yy.addSubGraph($$[$0-6],$$[$0-1],$$[$0-4]);\nbreak;\ncase 34:\nthis.$=yy.addSubGraph($$[$0-3],$$[$0-1],$$[$0-3]);\nbreak;\ncase 35:\nthis.$=yy.addSubGraph(undefined,$$[$0-1],undefined);\nbreak;\ncase 37:\n this.$=$$[$0].trim();yy.setAccTitle(this.$); \nbreak;\ncase 38: case 39:\n this.$=$$[$0].trim();yy.setAccDescription(this.$); \nbreak;\ncase 43:\n /* console.warn('vs',$$[$0-2].stmt,$$[$0]); */ yy.addLink($$[$0-2].stmt,$$[$0],$$[$0-1]); this.$ = { stmt: $$[$0], nodes: $$[$0].concat($$[$0-2].nodes) } \nbreak;\ncase 44:\n /* console.warn('vs',$$[$0-3].stmt,$$[$0-1]); */ yy.addLink($$[$0-3].stmt,$$[$0-1],$$[$0-2]); this.$ = { stmt: $$[$0-1], nodes: $$[$0-1].concat($$[$0-3].nodes) } \nbreak;\ncase 45:\n/*console.warn('noda', $$[$0-1]);*/ this.$ = {stmt: $$[$0-1], nodes:$$[$0-1] }\nbreak;\ncase 46:\n /*console.warn('noda', $$[$0]);*/ this.$ = {stmt: $$[$0], nodes:$$[$0] }\nbreak;\ncase 47:\n /* console.warn('nod', $$[$0]); */ this.$ = [$$[$0]];\nbreak;\ncase 48:\n this.$ = $$[$0-4].concat($$[$0]); /* console.warn('pip', $$[$0-4][0], $$[$0], this.$); */ \nbreak;\ncase 49:\n /* console.warn('nod', $$[$0]); */ this.$ = $$[$0];\nbreak;\ncase 50:\nthis.$ = $$[$0-2];yy.setClass($$[$0-2],$$[$0])\nbreak;\ncase 51:\nthis.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'square');\nbreak;\ncase 52:\nthis.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'doublecircle');\nbreak;\ncase 53:\nthis.$ = $$[$0-5];yy.addVertex($$[$0-5],$$[$0-2],'circle');\nbreak;\ncase 54:\nthis.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'ellipse');\nbreak;\ncase 55:\nthis.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'stadium');\nbreak;\ncase 56:\nthis.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'subroutine');\nbreak;\ncase 57:\nthis.$ = $$[$0-7];yy.addVertex($$[$0-7],$$[$0-1],'rect',undefined,undefined,undefined, Object.fromEntries([[$$[$0-5], $$[$0-3]]]));\nbreak;\ncase 58:\nthis.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'cylinder');\nbreak;\ncase 59:\nthis.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'round');\nbreak;\ncase 60:\nthis.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'diamond');\nbreak;\ncase 61:\nthis.$ = $$[$0-5];yy.addVertex($$[$0-5],$$[$0-2],'hexagon');\nbreak;\ncase 62:\nthis.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'odd');\nbreak;\ncase 63:\nthis.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'trapezoid');\nbreak;\ncase 64:\nthis.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'inv_trapezoid');\nbreak;\ncase 65:\nthis.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'lean_right');\nbreak;\ncase 66:\nthis.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'lean_left');\nbreak;\ncase 67:\n /*console.warn('h: ', $$[$0]);*/this.$ = $$[$0];yy.addVertex($$[$0]);\nbreak;\ncase 68:\n$$[$0-1].text = $$[$0];this.$ = $$[$0-1];\nbreak;\ncase 69: case 70:\n$$[$0-2].text = $$[$0-1];this.$ = $$[$0-2];\nbreak;\ncase 71:\nthis.$ = $$[$0];\nbreak;\ncase 72:\nvar inf = yy.destructLink($$[$0], $$[$0-2]); this.$ = {\"type\":inf.type,\"stroke\":inf.stroke,\"length\":inf.length,\"text\":$$[$0-1]};\nbreak;\ncase 73:\nthis.$={text:$$[$0], type:'text'};\nbreak;\ncase 74:\nthis.$={text:$$[$0-1].text+''+$$[$0], type:$$[$0-1].type};\nbreak;\ncase 75:\nthis.$={text: $$[$0], type: 'string'};\nbreak;\ncase 76:\nthis.$={text:$$[$0], type:'markdown'};\nbreak;\ncase 77:\nvar inf = yy.destructLink($$[$0]);this.$ = {\"type\":inf.type,\"stroke\":inf.stroke,\"length\":inf.length};\nbreak;\ncase 78:\nthis.$ = $$[$0-1];\nbreak;\ncase 79:\n this.$={text:$$[$0], type: 'text'};\nbreak;\ncase 80:\n this.$={text:$$[$0-1].text+''+$$[$0], type: $$[$0-1].type};\nbreak;\ncase 81:\n this.$ = {text: $$[$0], type: 'string'};\nbreak;\ncase 82: case 97:\n this.$={text: $$[$0], type: 'markdown'};\nbreak;\ncase 94:\nthis.$={text:$$[$0], type: 'text'};\nbreak;\ncase 95:\nthis.$={text:$$[$0-1].text+''+$$[$0], type: $$[$0-1].type};\nbreak;\ncase 96:\n this.$={text: $$[$0], type: 'text'};\nbreak;\ncase 98:\nthis.$ = $$[$0-4];yy.addClass($$[$0-2],$$[$0]);\nbreak;\ncase 99:\nthis.$ = $$[$0-4];yy.setClass($$[$0-2], $$[$0]);\nbreak;\ncase 100: case 108:\nthis.$ = $$[$0-1];yy.setClickEvent($$[$0-1], $$[$0]);\nbreak;\ncase 101: case 109:\nthis.$ = $$[$0-3];yy.setClickEvent($$[$0-3], $$[$0-2]);yy.setTooltip($$[$0-3], $$[$0]);\nbreak;\ncase 102:\nthis.$ = $$[$0-2];yy.setClickEvent($$[$0-2], $$[$0-1], $$[$0]);\nbreak;\ncase 103:\nthis.$ = $$[$0-4];yy.setClickEvent($$[$0-4], $$[$0-3], $$[$0-2]);yy.setTooltip($$[$0-4], $$[$0]);\nbreak;\ncase 104:\nthis.$ = $$[$0-2];yy.setLink($$[$0-2], $$[$0]);\nbreak;\ncase 105:\nthis.$ = $$[$0-4];yy.setLink($$[$0-4], $$[$0-2]);yy.setTooltip($$[$0-4], $$[$0]);\nbreak;\ncase 106:\nthis.$ = $$[$0-4];yy.setLink($$[$0-4], $$[$0-2], $$[$0]);\nbreak;\ncase 107:\nthis.$ = $$[$0-6];yy.setLink($$[$0-6], $$[$0-4], $$[$0]);yy.setTooltip($$[$0-6], $$[$0-2]);\nbreak;\ncase 110:\nthis.$ = $$[$0-1];yy.setLink($$[$0-1], $$[$0]);\nbreak;\ncase 111:\nthis.$ = $$[$0-3];yy.setLink($$[$0-3], $$[$0-2]);yy.setTooltip($$[$0-3], $$[$0]);\nbreak;\ncase 112:\nthis.$ = $$[$0-3];yy.setLink($$[$0-3], $$[$0-2], $$[$0]);\nbreak;\ncase 113:\nthis.$ = $$[$0-5];yy.setLink($$[$0-5], $$[$0-4], $$[$0]);yy.setTooltip($$[$0-5], $$[$0-2]);\nbreak;\ncase 114:\nthis.$ = $$[$0-4];yy.addVertex($$[$0-2],undefined,undefined,$$[$0]);\nbreak;\ncase 115:\nthis.$ = $$[$0-4];yy.updateLink([$$[$0-2]],$$[$0]);\nbreak;\ncase 116:\nthis.$ = $$[$0-4];yy.updateLink($$[$0-2],$$[$0]);\nbreak;\ncase 117:\nthis.$ = $$[$0-8];yy.updateLinkInterpolate([$$[$0-6]],$$[$0-2]);yy.updateLink([$$[$0-6]],$$[$0]);\nbreak;\ncase 118:\nthis.$ = $$[$0-8];yy.updateLinkInterpolate($$[$0-6],$$[$0-2]);yy.updateLink($$[$0-6],$$[$0]);\nbreak;\ncase 119:\nthis.$ = $$[$0-6];yy.updateLinkInterpolate([$$[$0-4]],$$[$0]);\nbreak;\ncase 120:\nthis.$ = $$[$0-6];yy.updateLinkInterpolate($$[$0-4],$$[$0]);\nbreak;\ncase 121: case 123:\nthis.$ = [$$[$0]]\nbreak;\ncase 122: case 124:\n$$[$0-2].push($$[$0]);this.$ = $$[$0-2];\nbreak;\ncase 126:\nthis.$ = $$[$0-1] + $$[$0];\nbreak;\ncase 174:\nthis.$=$$[$0]\nbreak;\ncase 175:\nthis.$=$$[$0-1]+''+$$[$0]\nbreak;\ncase 177:\nthis.$=$$[$0-1]+''+$$[$0];\nbreak;\ncase 178:\n this.$={stmt:'dir', value:'TB'};\nbreak;\ncase 179:\n this.$={stmt:'dir', value:'BT'};\nbreak;\ncase 180:\n this.$={stmt:'dir', value:'RL'};\nbreak;\ncase 181:\n this.$={stmt:'dir', value:'LR'};\nbreak;\n}\n},\ntable: [{3:1,4:2,9:$V0,10:$V1,12:$V2},{1:[3]},o($V3,$V4,{5:6}),{4:7,9:$V0,10:$V1,12:$V2},{4:8,9:$V0,10:$V1,12:$V2},{13:[1,9],14:[1,10]},{1:[2,1],6:11,7:12,8:$V5,9:$V6,10:$V7,11:$V8,20:17,22:18,23:19,24:20,25:21,26:22,27:$V9,33:24,34:$Va,36:$Vb,38:$Vc,40:28,41:38,42:$Vd,43:39,45:40,58:$Ve,81:$Vf,82:$Vg,83:$Vh,84:$Vi,85:$Vj,86:$Vk,99:$Vl,102:$Vm,103:$Vn,106:$Vo,108:$Vp,110:41,111:$Vq,112:$Vr,113:$Vs,118:$Vt,119:$Vu,120:$Vv,121:$Vw},o($V3,[2,9]),o($V3,[2,10]),o($V3,[2,11]),{8:[1,54],9:[1,55],10:$Vx,15:53,18:56},o($Vy,[2,3]),o($Vy,[2,4]),o($Vy,[2,5]),o($Vy,[2,6]),o($Vy,[2,7]),o($Vy,[2,8]),{8:$Vz,9:$VA,11:$VB,21:58,39:59,70:63,73:[1,64],75:[1,65]},{8:$Vz,9:$VA,11:$VB,21:66},{8:$Vz,9:$VA,11:$VB,21:67},{8:$Vz,9:$VA,11:$VB,21:68},{8:$Vz,9:$VA,11:$VB,21:69},{8:$Vz,9:$VA,11:$VB,21:70},{8:$Vz,9:$VA,10:[1,71],11:$VB,21:72},o($Vy,[2,36]),{35:[1,73]},{37:[1,74]},o($Vy,[2,39]),o($VC,[2,46],{18:75,10:$Vx}),{10:[1,76]},{10:[1,77]},{10:[1,78]},{10:[1,79]},{14:$VD,42:$VE,58:$VF,77:[1,83],86:$VG,92:[1,80],94:[1,81],98:82,102:$VH,103:$VI,106:$VJ,108:$VK,111:$VL,112:$VM,113:$VN,117:84},o($Vy,[2,178]),o($Vy,[2,179]),o($Vy,[2,180]),o($Vy,[2,181]),o($VO,[2,47]),o($VO,[2,49],{44:[1,96]}),o($VP,[2,67],{110:109,29:[1,97],42:$Vd,46:[1,98],48:[1,99],50:[1,100],52:[1,101],54:[1,102],56:[1,103],58:$Ve,61:[1,104],63:[1,105],65:[1,106],66:[1,107],68:[1,108],86:$Vk,99:$Vl,102:$Vm,103:$Vn,106:$Vo,108:$Vp,111:$Vq,112:$Vr,113:$Vs}),o($VQ,[2,174]),o($VQ,[2,135]),o($VQ,[2,136]),o($VQ,[2,137]),o($VQ,[2,138]),o($VQ,[2,139]),o($VQ,[2,140]),o($VQ,[2,141]),o($VQ,[2,142]),o($VQ,[2,143]),o($VQ,[2,144]),o($VQ,[2,145]),o($V3,[2,12]),o($V3,[2,18]),o($V3,[2,19]),{9:[1,110]},o($VR,[2,26],{18:111,10:$Vx}),o($Vy,[2,27]),{40:112,41:38,42:$Vd,43:39,45:40,58:$Ve,86:$Vk,99:$Vl,102:$Vm,103:$Vn,106:$Vo,108:$Vp,110:41,111:$Vq,112:$Vr,113:$Vs},o($Vy,[2,40]),o($Vy,[2,41]),o($Vy,[2,42]),o($VS,[2,71],{71:113,60:[1,115],72:[1,114]}),{74:116,76:117,77:[1,118],78:[1,119],113:$VT,116:$VU},o([42,58,60,72,86,99,102,103,106,108,111,112,113],[2,77]),o($Vy,[2,28]),o($Vy,[2,29]),o($Vy,[2,30]),o($Vy,[2,31]),o($Vy,[2,32]),{10:$VV,12:$VW,14:$VX,27:$VY,28:122,32:$VZ,42:$V_,58:$V$,73:$V01,77:[1,124],78:[1,125],80:135,81:$V11,82:$V21,83:$V31,84:$V41,85:$V51,86:$V61,87:$V71,88:123,102:$V81,106:$V91,108:$Va1,111:$Vb1,112:$Vc1,113:$Vd1},o($Ve1,$V4,{5:148}),o($Vy,[2,37]),o($Vy,[2,38]),o($VC,[2,45],{42:$Vf1}),{42:$Vd,45:150,58:$Ve,86:$Vk,99:$Vl,102:$Vm,103:$Vn,106:$Vo,108:$Vp,110:41,111:$Vq,112:$Vr,113:$Vs},{99:[1,151],100:152,102:[1,153]},{42:$Vd,45:154,58:$Ve,86:$Vk,99:$Vl,102:$Vm,103:$Vn,106:$Vo,108:$Vp,110:41,111:$Vq,112:$Vr,113:$Vs},{42:$Vd,45:155,58:$Ve,86:$Vk,99:$Vl,102:$Vm,103:$Vn,106:$Vo,108:$Vp,110:41,111:$Vq,112:$Vr,113:$Vs},o($Vg1,[2,100],{10:[1,156],93:[1,157]}),{77:[1,158]},o($Vg1,[2,108],{117:160,10:[1,159],14:$VD,42:$VE,58:$VF,86:$VG,102:$VH,103:$VI,106:$VJ,108:$VK,111:$VL,112:$VM,113:$VN}),o($Vg1,[2,110],{10:[1,161]}),o($Vh1,[2,176]),o($Vh1,[2,163]),o($Vh1,[2,164]),o($Vh1,[2,165]),o($Vh1,[2,166]),o($Vh1,[2,167]),o($Vh1,[2,168]),o($Vh1,[2,169]),o($Vh1,[2,170]),o($Vh1,[2,171]),o($Vh1,[2,172]),o($Vh1,[2,173]),{42:$Vd,45:162,58:$Ve,86:$Vk,99:$Vl,102:$Vm,103:$Vn,106:$Vo,108:$Vp,110:41,111:$Vq,112:$Vr,113:$Vs},{30:163,65:$Vi1,77:$Vj1,78:$Vk1,79:164,113:$Vl1,114:$Vm1,115:$Vn1},{30:171,65:$Vi1,77:$Vj1,78:$Vk1,79:164,113:$Vl1,114:$Vm1,115:$Vn1},{30:173,48:[1,172],65:$Vi1,77:$Vj1,78:$Vk1,79:164,113:$Vl1,114:$Vm1,115:$Vn1},{30:174,65:$Vi1,77:$Vj1,78:$Vk1,79:164,113:$Vl1,114:$Vm1,115:$Vn1},{30:175,65:$Vi1,77:$Vj1,78:$Vk1,79:164,113:$Vl1,114:$Vm1,115:$Vn1},{30:176,65:$Vi1,77:$Vj1,78:$Vk1,79:164,113:$Vl1,114:$Vm1,115:$Vn1},{106:[1,177]},{30:178,65:$Vi1,77:$Vj1,78:$Vk1,79:164,113:$Vl1,114:$Vm1,115:$Vn1},{30:179,63:[1,180],65:$Vi1,77:$Vj1,78:$Vk1,79:164,113:$Vl1,114:$Vm1,115:$Vn1},{30:181,65:$Vi1,77:$Vj1,78:$Vk1,79:164,113:$Vl1,114:$Vm1,115:$Vn1},{30:182,65:$Vi1,77:$Vj1,78:$Vk1,79:164,113:$Vl1,114:$Vm1,115:$Vn1},{30:183,65:$Vi1,77:$Vj1,78:$Vk1,79:164,113:$Vl1,114:$Vm1,115:$Vn1},o($VQ,[2,175]),o($V3,[2,20]),o($VR,[2,25]),o($VC,[2,43],{18:184,10:$Vx}),o($VS,[2,68],{10:[1,185]}),{10:[1,186]},{30:187,65:$Vi1,77:$Vj1,78:$Vk1,79:164,113:$Vl1,114:$Vm1,115:$Vn1},{75:[1,188],76:189,113:$VT,116:$VU},o($Vo1,[2,73]),o($Vo1,[2,75]),o($Vo1,[2,76]),o($Vo1,[2,161]),o($Vo1,[2,162]),{8:$Vz,9:$VA,10:$VV,11:$VB,12:$VW,14:$VX,21:191,27:$VY,29:[1,190],32:$VZ,42:$V_,58:$V$,73:$V01,80:135,81:$V11,82:$V21,83:$V31,84:$V41,85:$V51,86:$V61,87:$V71,88:192,102:$V81,106:$V91,108:$Va1,111:$Vb1,112:$Vc1,113:$Vd1},o($Vp1,[2,94]),o($Vp1,[2,96]),o($Vp1,[2,97]),o($Vp1,[2,150]),o($Vp1,[2,151]),o($Vp1,[2,152]),o($Vp1,[2,153]),o($Vp1,[2,154]),o($Vp1,[2,155]),o($Vp1,[2,156]),o($Vp1,[2,157]),o($Vp1,[2,158]),o($Vp1,[2,159]),o($Vp1,[2,160]),o($Vp1,[2,83]),o($Vp1,[2,84]),o($Vp1,[2,85]),o($Vp1,[2,86]),o($Vp1,[2,87]),o($Vp1,[2,88]),o($Vp1,[2,89]),o($Vp1,[2,90]),o($Vp1,[2,91]),o($Vp1,[2,92]),o($Vp1,[2,93]),{6:11,7:12,8:$V5,9:$V6,10:$V7,11:$V8,20:17,22:18,23:19,24:20,25:21,26:22,27:$V9,32:[1,193],33:24,34:$Va,36:$Vb,38:$Vc,40:28,41:38,42:$Vd,43:39,45:40,58:$Ve,81:$Vf,82:$Vg,83:$Vh,84:$Vi,85:$Vj,86:$Vk,99:$Vl,102:$Vm,103:$Vn,106:$Vo,108:$Vp,110:41,111:$Vq,112:$Vr,113:$Vs,118:$Vt,119:$Vu,120:$Vv,121:$Vw},{10:$Vx,18:194},{10:[1,195],42:$Vd,58:$Ve,86:$Vk,99:$Vl,102:$Vm,103:$Vn,106:$Vo,108:$Vp,110:109,111:$Vq,112:$Vr,113:$Vs},{10:[1,196]},{10:[1,197],103:[1,198]},o($Vq1,[2,121]),{10:[1,199],42:$Vd,58:$Ve,86:$Vk,99:$Vl,102:$Vm,103:$Vn,106:$Vo,108:$Vp,110:109,111:$Vq,112:$Vr,113:$Vs},{10:[1,200],42:$Vd,58:$Ve,86:$Vk,99:$Vl,102:$Vm,103:$Vn,106:$Vo,108:$Vp,110:109,111:$Vq,112:$Vr,113:$Vs},{77:[1,201]},o($Vg1,[2,102],{10:[1,202]}),o($Vg1,[2,104],{10:[1,203]}),{77:[1,204]},o($Vh1,[2,177]),{77:[1,205],95:[1,206]},o($VO,[2,50],{110:109,42:$Vd,58:$Ve,86:$Vk,99:$Vl,102:$Vm,103:$Vn,106:$Vo,108:$Vp,111:$Vq,112:$Vr,113:$Vs}),{31:[1,207],65:$Vi1,79:208,113:$Vl1,114:$Vm1,115:$Vn1},o($Vr1,[2,79]),o($Vr1,[2,81]),o($Vr1,[2,82]),o($Vr1,[2,146]),o($Vr1,[2,147]),o($Vr1,[2,148]),o($Vr1,[2,149]),{47:[1,209],65:$Vi1,79:208,113:$Vl1,114:$Vm1,115:$Vn1},{30:210,65:$Vi1,77:$Vj1,78:$Vk1,79:164,113:$Vl1,114:$Vm1,115:$Vn1},{49:[1,211],65:$Vi1,79:208,113:$Vl1,114:$Vm1,115:$Vn1},{51:[1,212],65:$Vi1,79:208,113:$Vl1,114:$Vm1,115:$Vn1},{53:[1,213],65:$Vi1,79:208,113:$Vl1,114:$Vm1,115:$Vn1},{55:[1,214],65:$Vi1,79:208,113:$Vl1,114:$Vm1,115:$Vn1},{58:[1,215]},{62:[1,216],65:$Vi1,79:208,113:$Vl1,114:$Vm1,115:$Vn1},{64:[1,217],65:$Vi1,79:208,113:$Vl1,114:$Vm1,115:$Vn1},{30:218,65:$Vi1,77:$Vj1,78:$Vk1,79:164,113:$Vl1,114:$Vm1,115:$Vn1},{31:[1,219],65:$Vi1,79:208,113:$Vl1,114:$Vm1,115:$Vn1},{65:$Vi1,67:[1,220],69:[1,221],79:208,113:$Vl1,114:$Vm1,115:$Vn1},{65:$Vi1,67:[1,223],69:[1,222],79:208,113:$Vl1,114:$Vm1,115:$Vn1},o($VC,[2,44],{42:$Vf1}),o($VS,[2,70]),o($VS,[2,69]),{60:[1,224],65:$Vi1,79:208,113:$Vl1,114:$Vm1,115:$Vn1},o($VS,[2,72]),o($Vo1,[2,74]),{30:225,65:$Vi1,77:$Vj1,78:$Vk1,79:164,113:$Vl1,114:$Vm1,115:$Vn1},o($Ve1,$V4,{5:226}),o($Vp1,[2,95]),o($Vy,[2,35]),{41:227,42:$Vd,43:39,45:40,58:$Ve,86:$Vk,99:$Vl,102:$Vm,103:$Vn,106:$Vo,108:$Vp,110:41,111:$Vq,112:$Vr,113:$Vs},{10:$Vs1,58:$Vt1,81:$Vu1,89:228,102:$Vv1,104:229,105:230,106:$Vw1,107:$Vx1,108:$Vy1,109:$Vz1},{10:$Vs1,58:$Vt1,81:$Vu1,89:239,101:[1,240],102:$Vv1,104:229,105:230,106:$Vw1,107:$Vx1,108:$Vy1,109:$Vz1},{10:$Vs1,58:$Vt1,81:$Vu1,89:241,101:[1,242],102:$Vv1,104:229,105:230,106:$Vw1,107:$Vx1,108:$Vy1,109:$Vz1},{102:[1,243]},{10:$Vs1,58:$Vt1,81:$Vu1,89:244,102:$Vv1,104:229,105:230,106:$Vw1,107:$Vx1,108:$Vy1,109:$Vz1},{42:$Vd,45:245,58:$Ve,86:$Vk,99:$Vl,102:$Vm,103:$Vn,106:$Vo,108:$Vp,110:41,111:$Vq,112:$Vr,113:$Vs},o($Vg1,[2,101]),{77:[1,246]},{77:[1,247],95:[1,248]},o($Vg1,[2,109]),o($Vg1,[2,111],{10:[1,249]}),o($Vg1,[2,112]),o($VP,[2,51]),o($Vr1,[2,80]),o($VP,[2,52]),{49:[1,250],65:$Vi1,79:208,113:$Vl1,114:$Vm1,115:$Vn1},o($VP,[2,59]),o($VP,[2,54]),o($VP,[2,55]),o($VP,[2,56]),{106:[1,251]},o($VP,[2,58]),o($VP,[2,60]),{64:[1,252],65:$Vi1,79:208,113:$Vl1,114:$Vm1,115:$Vn1},o($VP,[2,62]),o($VP,[2,63]),o($VP,[2,65]),o($VP,[2,64]),o($VP,[2,66]),o([10,42,58,86,99,102,103,106,108,111,112,113],[2,78]),{31:[1,253],65:$Vi1,79:208,113:$Vl1,114:$Vm1,115:$Vn1},{6:11,7:12,8:$V5,9:$V6,10:$V7,11:$V8,20:17,22:18,23:19,24:20,25:21,26:22,27:$V9,32:[1,254],33:24,34:$Va,36:$Vb,38:$Vc,40:28,41:38,42:$Vd,43:39,45:40,58:$Ve,81:$Vf,82:$Vg,83:$Vh,84:$Vi,85:$Vj,86:$Vk,99:$Vl,102:$Vm,103:$Vn,106:$Vo,108:$Vp,110:41,111:$Vq,112:$Vr,113:$Vs,118:$Vt,119:$Vu,120:$Vv,121:$Vw},o($VO,[2,48]),o($Vg1,[2,114],{103:$VA1}),o($VB1,[2,123],{105:256,10:$Vs1,58:$Vt1,81:$Vu1,102:$Vv1,106:$Vw1,107:$Vx1,108:$Vy1,109:$Vz1}),o($VC1,[2,125]),o($VC1,[2,127]),o($VC1,[2,128]),o($VC1,[2,129]),o($VC1,[2,130]),o($VC1,[2,131]),o($VC1,[2,132]),o($VC1,[2,133]),o($VC1,[2,134]),o($Vg1,[2,115],{103:$VA1}),{10:[1,257]},o($Vg1,[2,116],{103:$VA1}),{10:[1,258]},o($Vq1,[2,122]),o($Vg1,[2,98],{103:$VA1}),o($Vg1,[2,99],{110:109,42:$Vd,58:$Ve,86:$Vk,99:$Vl,102:$Vm,103:$Vn,106:$Vo,108:$Vp,111:$Vq,112:$Vr,113:$Vs}),o($Vg1,[2,103]),o($Vg1,[2,105],{10:[1,259]}),o($Vg1,[2,106]),{95:[1,260]},{49:[1,261]},{60:[1,262]},{64:[1,263]},{8:$Vz,9:$VA,11:$VB,21:264},o($Vy,[2,34]),{10:$Vs1,58:$Vt1,81:$Vu1,102:$Vv1,104:265,105:230,106:$Vw1,107:$Vx1,108:$Vy1,109:$Vz1},o($VC1,[2,126]),{14:$VD,42:$VE,58:$VF,86:$VG,98:266,102:$VH,103:$VI,106:$VJ,108:$VK,111:$VL,112:$VM,113:$VN,117:84},{14:$VD,42:$VE,58:$VF,86:$VG,98:267,102:$VH,103:$VI,106:$VJ,108:$VK,111:$VL,112:$VM,113:$VN,117:84},{95:[1,268]},o($Vg1,[2,113]),o($VP,[2,53]),{30:269,65:$Vi1,77:$Vj1,78:$Vk1,79:164,113:$Vl1,114:$Vm1,115:$Vn1},o($VP,[2,61]),o($Ve1,$V4,{5:270}),o($VB1,[2,124],{105:256,10:$Vs1,58:$Vt1,81:$Vu1,102:$Vv1,106:$Vw1,107:$Vx1,108:$Vy1,109:$Vz1}),o($Vg1,[2,119],{117:160,10:[1,271],14:$VD,42:$VE,58:$VF,86:$VG,102:$VH,103:$VI,106:$VJ,108:$VK,111:$VL,112:$VM,113:$VN}),o($Vg1,[2,120],{117:160,10:[1,272],14:$VD,42:$VE,58:$VF,86:$VG,102:$VH,103:$VI,106:$VJ,108:$VK,111:$VL,112:$VM,113:$VN}),o($Vg1,[2,107]),{31:[1,273],65:$Vi1,79:208,113:$Vl1,114:$Vm1,115:$Vn1},{6:11,7:12,8:$V5,9:$V6,10:$V7,11:$V8,20:17,22:18,23:19,24:20,25:21,26:22,27:$V9,32:[1,274],33:24,34:$Va,36:$Vb,38:$Vc,40:28,41:38,42:$Vd,43:39,45:40,58:$Ve,81:$Vf,82:$Vg,83:$Vh,84:$Vi,85:$Vj,86:$Vk,99:$Vl,102:$Vm,103:$Vn,106:$Vo,108:$Vp,110:41,111:$Vq,112:$Vr,113:$Vs,118:$Vt,119:$Vu,120:$Vv,121:$Vw},{10:$Vs1,58:$Vt1,81:$Vu1,89:275,102:$Vv1,104:229,105:230,106:$Vw1,107:$Vx1,108:$Vy1,109:$Vz1},{10:$Vs1,58:$Vt1,81:$Vu1,89:276,102:$Vv1,104:229,105:230,106:$Vw1,107:$Vx1,108:$Vy1,109:$Vz1},o($VP,[2,57]),o($Vy,[2,33]),o($Vg1,[2,117],{103:$VA1}),o($Vg1,[2,118],{103:$VA1})],\ndefaultActions: {},\nparseError: function parseError (str, hash) {\n if (hash.recoverable) {\n this.trace(str);\n } else {\n var error = new Error(str);\n error.hash = hash;\n throw error;\n }\n},\nparse: function parse(input) {\n var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;\n var args = lstack.slice.call(arguments, 1);\n var lexer = Object.create(this.lexer);\n var sharedState = { yy: {} };\n for (var k in this.yy) {\n if (Object.prototype.hasOwnProperty.call(this.yy, k)) {\n sharedState.yy[k] = this.yy[k];\n }\n }\n lexer.setInput(input, sharedState.yy);\n sharedState.yy.lexer = lexer;\n sharedState.yy.parser = this;\n if (typeof lexer.yylloc == 'undefined') {\n lexer.yylloc = {};\n }\n var yyloc = lexer.yylloc;\n lstack.push(yyloc);\n var ranges = lexer.options && lexer.options.ranges;\n if (typeof sharedState.yy.parseError === 'function') {\n this.parseError = sharedState.yy.parseError;\n } else {\n this.parseError = Object.getPrototypeOf(this).parseError;\n }\n function popStack(n) {\n stack.length = stack.length - 2 * n;\n vstack.length = vstack.length - n;\n lstack.length = lstack.length - n;\n }\n function lex() {\n var token;\n token = tstack.pop() || lexer.lex() || EOF;\n if (typeof token !== 'number') {\n if (token instanceof Array) {\n tstack = token;\n token = tstack.pop();\n }\n token = self.symbols_[token] || token;\n }\n return token;\n }\n var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;\n while (true) {\n state = stack[stack.length - 1];\n if (this.defaultActions[state]) {\n action = this.defaultActions[state];\n } else {\n if (symbol === null || typeof symbol == 'undefined') {\n symbol = lex();\n }\n action = table[state] && table[state][symbol];\n }\n if (typeof action === 'undefined' || !action.length || !action[0]) {\n var errStr = '';\n expected = [];\n for (p in table[state]) {\n if (this.terminals_[p] && p > TERROR) {\n expected.push('\\'' + this.terminals_[p] + '\\'');\n }\n }\n if (lexer.showPosition) {\n errStr = 'Parse error on line ' + (yylineno + 1) + ':\\n' + lexer.showPosition() + '\\nExpecting ' + expected.join(', ') + ', got \\'' + (this.terminals_[symbol] || symbol) + '\\'';\n } else {\n errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\\'' + (this.terminals_[symbol] || symbol) + '\\'');\n }\n this.parseError(errStr, {\n text: lexer.match,\n token: this.terminals_[symbol] || symbol,\n line: lexer.yylineno,\n loc: yyloc,\n expected: expected\n });\n }\n if (action[0] instanceof Array && action.length > 1) {\n throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);\n }\n switch (action[0]) {\n case 1:\n stack.push(symbol);\n vstack.push(lexer.yytext);\n lstack.push(lexer.yylloc);\n stack.push(action[1]);\n symbol = null;\n if (!preErrorSymbol) {\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n if (recovering > 0) {\n recovering--;\n }\n } else {\n symbol = preErrorSymbol;\n preErrorSymbol = null;\n }\n break;\n case 2:\n len = this.productions_[action[1]][1];\n yyval.$ = vstack[vstack.length - len];\n yyval._$ = {\n first_line: lstack[lstack.length - (len || 1)].first_line,\n last_line: lstack[lstack.length - 1].last_line,\n first_column: lstack[lstack.length - (len || 1)].first_column,\n last_column: lstack[lstack.length - 1].last_column\n };\n if (ranges) {\n yyval._$.range = [\n lstack[lstack.length - (len || 1)].range[0],\n lstack[lstack.length - 1].range[1]\n ];\n }\n r = this.performAction.apply(yyval, [\n yytext,\n yyleng,\n yylineno,\n sharedState.yy,\n action[1],\n vstack,\n lstack\n ].concat(args));\n if (typeof r !== 'undefined') {\n return r;\n }\n if (len) {\n stack = stack.slice(0, -1 * len * 2);\n vstack = vstack.slice(0, -1 * len);\n lstack = lstack.slice(0, -1 * len);\n }\n stack.push(this.productions_[action[1]][0]);\n vstack.push(yyval.$);\n lstack.push(yyval._$);\n newState = table[stack[stack.length - 2]][stack[stack.length - 1]];\n stack.push(newState);\n break;\n case 3:\n return true;\n }\n }\n return true;\n}};\n\n/* generated by jison-lex 0.3.4 */\nvar lexer = (function(){\nvar lexer = ({\n\nEOF:1,\n\nparseError:function parseError(str, hash) {\n if (this.yy.parser) {\n this.yy.parser.parseError(str, hash);\n } else {\n throw new Error(str);\n }\n },\n\n// resets the lexer, sets new input\nsetInput:function (input, yy) {\n this.yy = yy || this.yy || {};\n this._input = input;\n this._more = this._backtrack = this.done = false;\n this.yylineno = this.yyleng = 0;\n this.yytext = this.matched = this.match = '';\n this.conditionStack = ['INITIAL'];\n this.yylloc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0\n };\n if (this.options.ranges) {\n this.yylloc.range = [0,0];\n }\n this.offset = 0;\n return this;\n },\n\n// consumes and returns one char from the input\ninput:function () {\n var ch = this._input[0];\n this.yytext += ch;\n this.yyleng++;\n this.offset++;\n this.match += ch;\n this.matched += ch;\n var lines = ch.match(/(?:\\r\\n?|\\n).*/g);\n if (lines) {\n this.yylineno++;\n this.yylloc.last_line++;\n } else {\n this.yylloc.last_column++;\n }\n if (this.options.ranges) {\n this.yylloc.range[1]++;\n }\n\n this._input = this._input.slice(1);\n return ch;\n },\n\n// unshifts one char (or a string) into the input\nunput:function (ch) {\n var len = ch.length;\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\n\n this._input = ch + this._input;\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\n //this.yyleng -= len;\n this.offset -= len;\n var oldLines = this.match.split(/(?:\\r\\n?|\\n)/g);\n this.match = this.match.substr(0, this.match.length - 1);\n this.matched = this.matched.substr(0, this.matched.length - 1);\n\n if (lines.length - 1) {\n this.yylineno -= lines.length - 1;\n }\n var r = this.yylloc.range;\n\n this.yylloc = {\n first_line: this.yylloc.first_line,\n last_line: this.yylineno + 1,\n first_column: this.yylloc.first_column,\n last_column: lines ?\n (lines.length === oldLines.length ? this.yylloc.first_column : 0)\n + oldLines[oldLines.length - lines.length].length - lines[0].length :\n this.yylloc.first_column - len\n };\n\n if (this.options.ranges) {\n this.yylloc.range = [r[0], r[0] + this.yyleng - len];\n }\n this.yyleng = this.yytext.length;\n return this;\n },\n\n// When called from action, caches matched text and appends it on next action\nmore:function () {\n this._more = true;\n return this;\n },\n\n// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.\nreject:function () {\n if (this.options.backtrack_lexer) {\n this._backtrack = true;\n } else {\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n' + this.showPosition(), {\n text: \"\",\n token: null,\n line: this.yylineno\n });\n\n }\n return this;\n },\n\n// retain first n characters of the match\nless:function (n) {\n this.unput(this.match.slice(n));\n },\n\n// displays already matched input, i.e. for error messages\npastInput:function () {\n var past = this.matched.substr(0, this.matched.length - this.match.length);\n return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\\n/g, \"\");\n },\n\n// displays upcoming input, i.e. for error messages\nupcomingInput:function () {\n var next = this.match;\n if (next.length < 20) {\n next += this._input.substr(0, 20-next.length);\n }\n return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\\n/g, \"\");\n },\n\n// displays the character position where the lexing error occurred, i.e. for error messages\nshowPosition:function () {\n var pre = this.pastInput();\n var c = new Array(pre.length + 1).join(\"-\");\n return pre + this.upcomingInput() + \"\\n\" + c + \"^\";\n },\n\n// test the lexed token: return FALSE when not a match, otherwise return token\ntest_match:function(match, indexed_rule) {\n var token,\n lines,\n backup;\n\n if (this.options.backtrack_lexer) {\n // save context\n backup = {\n yylineno: this.yylineno,\n yylloc: {\n first_line: this.yylloc.first_line,\n last_line: this.last_line,\n first_column: this.yylloc.first_column,\n last_column: this.yylloc.last_column\n },\n yytext: this.yytext,\n match: this.match,\n matches: this.matches,\n matched: this.matched,\n yyleng: this.yyleng,\n offset: this.offset,\n _more: this._more,\n _input: this._input,\n yy: this.yy,\n conditionStack: this.conditionStack.slice(0),\n done: this.done\n };\n if (this.options.ranges) {\n backup.yylloc.range = this.yylloc.range.slice(0);\n }\n }\n\n lines = match[0].match(/(?:\\r\\n?|\\n).*/g);\n if (lines) {\n this.yylineno += lines.length;\n }\n this.yylloc = {\n first_line: this.yylloc.last_line,\n last_line: this.yylineno + 1,\n first_column: this.yylloc.last_column,\n last_column: lines ?\n lines[lines.length - 1].length - lines[lines.length - 1].match(/\\r?\\n?/)[0].length :\n this.yylloc.last_column + match[0].length\n };\n this.yytext += match[0];\n this.match += match[0];\n this.matches = match;\n this.yyleng = this.yytext.length;\n if (this.options.ranges) {\n this.yylloc.range = [this.offset, this.offset += this.yyleng];\n }\n this._more = false;\n this._backtrack = false;\n this._input = this._input.slice(match[0].length);\n this.matched += match[0];\n token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);\n if (this.done && this._input) {\n this.done = false;\n }\n if (token) {\n return token;\n } else if (this._backtrack) {\n // recover context\n for (var k in backup) {\n this[k] = backup[k];\n }\n return false; // rule action called reject() implying the next rule should be tested instead.\n }\n return false;\n },\n\n// return next match in input\nnext:function () {\n if (this.done) {\n return this.EOF;\n }\n if (!this._input) {\n this.done = true;\n }\n\n var token,\n match,\n tempMatch,\n index;\n if (!this._more) {\n this.yytext = '';\n this.match = '';\n }\n var rules = this._currentRules();\n for (var i = 0; i < rules.length; i++) {\n tempMatch = this._input.match(this.rules[rules[i]]);\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\n match = tempMatch;\n index = i;\n if (this.options.backtrack_lexer) {\n token = this.test_match(tempMatch, rules[i]);\n if (token !== false) {\n return token;\n } else if (this._backtrack) {\n match = false;\n continue; // rule action called reject() implying a rule MISmatch.\n } else {\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n } else if (!this.options.flex) {\n break;\n }\n }\n }\n if (match) {\n token = this.test_match(match, rules[index]);\n if (token !== false) {\n return token;\n }\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n if (this._input === \"\") {\n return this.EOF;\n } else {\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\\n' + this.showPosition(), {\n text: \"\",\n token: null,\n line: this.yylineno\n });\n }\n },\n\n// return next match that has a token\nlex:function lex () {\n var r = this.next();\n if (r) {\n return r;\n } else {\n return this.lex();\n }\n },\n\n// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)\nbegin:function begin (condition) {\n this.conditionStack.push(condition);\n },\n\n// pop the previously active lexer condition state off the condition stack\npopState:function popState () {\n var n = this.conditionStack.length - 1;\n if (n > 0) {\n return this.conditionStack.pop();\n } else {\n return this.conditionStack[0];\n }\n },\n\n// produce the lexer rule set which is active for the currently active lexer condition state\n_currentRules:function _currentRules () {\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;\n } else {\n return this.conditions[\"INITIAL\"].rules;\n }\n },\n\n// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available\ntopState:function topState (n) {\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\n if (n >= 0) {\n return this.conditionStack[n];\n } else {\n return \"INITIAL\";\n }\n },\n\n// alias for begin(condition)\npushState:function pushState (condition) {\n this.begin(condition);\n },\n\n// return the number of states currently on the stack\nstateStackSize:function stateStackSize() {\n return this.conditionStack.length;\n },\noptions: {},\nperformAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {\nvar YYSTATE=YY_START;\nswitch($avoiding_name_collisions) {\ncase 0: this.begin(\"acc_title\");return 34; \nbreak;\ncase 1: this.popState(); return \"acc_title_value\"; \nbreak;\ncase 2: this.begin(\"acc_descr\");return 36; \nbreak;\ncase 3: this.popState(); return \"acc_descr_value\"; \nbreak;\ncase 4: this.begin(\"acc_descr_multiline\");\nbreak;\ncase 5: this.popState(); \nbreak;\ncase 6:return \"acc_descr_multiline_value\";\nbreak;\ncase 7:this.begin(\"callbackname\");\nbreak;\ncase 8:this.popState();\nbreak;\ncase 9:this.popState(); this.begin(\"callbackargs\");\nbreak;\ncase 10:return 92;\nbreak;\ncase 11:this.popState();\nbreak;\ncase 12:return 93;\nbreak;\ncase 13: return \"MD_STR\";\nbreak;\ncase 14: this.popState();\nbreak;\ncase 15: this.begin(\"md_string\");\nbreak;\ncase 16:return \"STR\";\nbreak;\ncase 17:this.popState();\nbreak;\ncase 18:this.pushState(\"string\");\nbreak;\ncase 19:return 81;\nbreak;\ncase 20:return 99;\nbreak;\ncase 21:return 82;\nbreak;\ncase 22:return 101;\nbreak;\ncase 23:return 83;\nbreak;\ncase 24:return 84;\nbreak;\ncase 25:return 94;\nbreak;\ncase 26:this.begin(\"click\");\nbreak;\ncase 27:this.popState();\nbreak;\ncase 28:return 85;\nbreak;\ncase 29:if(yy.lex.firstGraph()){this.begin(\"dir\");} return 12;\nbreak;\ncase 30:if(yy.lex.firstGraph()){this.begin(\"dir\");} return 12;\nbreak;\ncase 31:if(yy.lex.firstGraph()){this.begin(\"dir\");} return 12;\nbreak;\ncase 32:return 27;\nbreak;\ncase 33:return 32;\nbreak;\ncase 34:return 95;\nbreak;\ncase 35:return 95;\nbreak;\ncase 36:return 95;\nbreak;\ncase 37:return 95;\nbreak;\ncase 38: this.popState(); return 13; \nbreak;\ncase 39: this.popState(); return 14; \nbreak;\ncase 40: this.popState(); return 14; \nbreak;\ncase 41: this.popState(); return 14; \nbreak;\ncase 42: this.popState(); return 14; \nbreak;\ncase 43: this.popState(); return 14; \nbreak;\ncase 44: this.popState(); return 14; \nbreak;\ncase 45: this.popState(); return 14; \nbreak;\ncase 46: this.popState(); return 14; \nbreak;\ncase 47: this.popState(); return 14; \nbreak;\ncase 48: this.popState(); return 14; \nbreak;\ncase 49:return 118;\nbreak;\ncase 50:return 119;\nbreak;\ncase 51:return 120;\nbreak;\ncase 52:return 121;\nbreak;\ncase 53:return 102;\nbreak;\ncase 54:return 108;\nbreak;\ncase 55:return 44;\nbreak;\ncase 56:return 58;\nbreak;\ncase 57:return 42;\nbreak;\ncase 58:return 8;\nbreak;\ncase 59:return 103;\nbreak;\ncase 60:return 112;\nbreak;\ncase 61: this.popState(); return 75; \nbreak;\ncase 62: this.pushState(\"edgeText\"); return 73; \nbreak;\ncase 63:return 116;\nbreak;\ncase 64: this.popState(); return 75; \nbreak;\ncase 65: this.pushState(\"thickEdgeText\"); return 73; \nbreak;\ncase 66:return 116;\nbreak;\ncase 67: this.popState(); return 75; \nbreak;\ncase 68: this.pushState(\"dottedEdgeText\"); return 73; \nbreak;\ncase 69:return 116;\nbreak;\ncase 70:return 75;\nbreak;\ncase 71: this.popState(); return 51; \nbreak;\ncase 72:return \"TEXT\"\nbreak;\ncase 73: this.pushState(\"ellipseText\"); return 50; \nbreak;\ncase 74: this.popState(); return 53; \nbreak;\ncase 75: this.pushState(\"text\"); return 52; \nbreak;\ncase 76: this.popState(); return 55; \nbreak;\ncase 77: this.pushState(\"text\"); return 54; \nbreak;\ncase 78: return 56; \nbreak;\ncase 79: this.pushState(\"text\"); return 65; \nbreak;\ncase 80: this.popState(); return 62; \nbreak;\ncase 81: this.pushState(\"text\") ;return 61; \nbreak;\ncase 82: this.popState(); return 47; \nbreak;\ncase 83: this.pushState(\"text\"); return 46; \nbreak;\ncase 84: this.popState(); return 67; \nbreak;\ncase 85: this.popState(); return 69; \nbreak;\ncase 86:return 114;\nbreak;\ncase 87: this.pushState(\"trapText\"); return 66; \nbreak;\ncase 88: this.pushState(\"trapText\"); return 68; \nbreak;\ncase 89:return 115;\nbreak;\ncase 90:return 65;\nbreak;\ncase 91:return 87;\nbreak;\ncase 92:return 'SEP';\nbreak;\ncase 93:return 86;\nbreak;\ncase 94:return 112;\nbreak;\ncase 95:return 108;\nbreak;\ncase 96:return 42;\nbreak;\ncase 97:return 106;\nbreak;\ncase 98:return 111\nbreak;\ncase 99:return 113;\nbreak;\ncase 100: this.popState(); return 60; \nbreak;\ncase 101: this.pushState(\"text\"); return 60; \nbreak;\ncase 102: this.popState(); return 49; \nbreak;\ncase 103: this.pushState(\"text\"); return 48; \nbreak;\ncase 104: this.popState(); return 31; \nbreak;\ncase 105: this.pushState(\"text\"); return 29; \nbreak;\ncase 106: this.popState(); return 64 \nbreak;\ncase 107: this.pushState(\"text\"); return 63 \nbreak;\ncase 108:return \"TEXT\";\nbreak;\ncase 109:return 'QUOTE';\nbreak;\ncase 110:return 9;\nbreak;\ncase 111:return 10;\nbreak;\ncase 112:return 11;\nbreak;\n}\n},\nrules: [/^(?:accTitle\\s*:\\s*)/,/^(?:(?!\\n||)*[^\\n]*)/,/^(?:accDescr\\s*:\\s*)/,/^(?:(?!\\n||)*[^\\n]*)/,/^(?:accDescr\\s*\\{\\s*)/,/^(?:[\\}])/,/^(?:[^\\}]*)/,/^(?:call[\\s]+)/,/^(?:\\([\\s]*\\))/,/^(?:\\()/,/^(?:[^(]*)/,/^(?:\\))/,/^(?:[^)]*)/,/^(?:[^`\"]+)/,/^(?:[`][\"])/,/^(?:[\"][`])/,/^(?:[^\"]+)/,/^(?:[\"])/,/^(?:[\"])/,/^(?:style\\b)/,/^(?:default\\b)/,/^(?:linkStyle\\b)/,/^(?:interpolate\\b)/,/^(?:classDef\\b)/,/^(?:class\\b)/,/^(?:href[\\s])/,/^(?:click[\\s]+)/,/^(?:[\\s\\n])/,/^(?:[^\\s\\n]*)/,/^(?:flowchart-elk\\b)/,/^(?:graph\\b)/,/^(?:flowchart\\b)/,/^(?:subgraph\\b)/,/^(?:end\\b\\s*)/,/^(?:_self\\b)/,/^(?:_blank\\b)/,/^(?:_parent\\b)/,/^(?:_top\\b)/,/^(?:(\\r?\\n)*\\s*\\n)/,/^(?:\\s*LR\\b)/,/^(?:\\s*RL\\b)/,/^(?:\\s*TB\\b)/,/^(?:\\s*BT\\b)/,/^(?:\\s*TD\\b)/,/^(?:\\s*BR\\b)/,/^(?:\\s*<)/,/^(?:\\s*>)/,/^(?:\\s*\\^)/,/^(?:\\s*v\\b)/,/^(?:.*direction\\s+TB[^\\n]*)/,/^(?:.*direction\\s+BT[^\\n]*)/,/^(?:.*direction\\s+RL[^\\n]*)/,/^(?:.*direction\\s+LR[^\\n]*)/,/^(?:[0-9]+)/,/^(?:#)/,/^(?::::)/,/^(?::)/,/^(?:&)/,/^(?:;)/,/^(?:,)/,/^(?:\\*)/,/^(?:\\s*[xo<]?--+[-xo>]\\s*)/,/^(?:\\s*[xo<]?--\\s*)/,/^(?:[^-]|-(?!-)+)/,/^(?:\\s*[xo<]?==+[=xo>]\\s*)/,/^(?:\\s*[xo<]?==\\s*)/,/^(?:[^=]|=(?!))/,/^(?:\\s*[xo<]?-?\\.+-[xo>]?\\s*)/,/^(?:\\s*[xo<]?-\\.\\s*)/,/^(?:[^\\.]|\\.(?!))/,/^(?:\\s*~~[\\~]+\\s*)/,/^(?:[-/\\)][\\)])/,/^(?:[^\\(\\)\\[\\]\\{\\}]|!\\)+)/,/^(?:\\(-)/,/^(?:\\]\\))/,/^(?:\\(\\[)/,/^(?:\\]\\])/,/^(?:\\[\\[)/,/^(?:\\[\\|)/,/^(?:>)/,/^(?:\\)\\])/,/^(?:\\[\\()/,/^(?:\\)\\)\\))/,/^(?:\\(\\(\\()/,/^(?:[\\\\(?=\\])][\\]])/,/^(?:\\/(?=\\])\\])/,/^(?:\\/(?!\\])|\\\\(?!\\])|[^\\\\\\[\\]\\(\\)\\{\\}\\/]+)/,/^(?:\\[\\/)/,/^(?:\\[\\\\)/,/^(?:<)/,/^(?:>)/,/^(?:\\^)/,/^(?:\\\\\\|)/,/^(?:v\\b)/,/^(?:\\*)/,/^(?:#)/,/^(?:&)/,/^(?:([A-Za-z0-9!\"\\#$%&'*+\\.`?\\\\_\\/]|-(?=[^\\>\\-\\.])|(?!))+)/,/^(?:-)/,/^(?:[\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6]|[\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377]|[\\u037A-\\u037D\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5]|[\\u03F7-\\u0481\\u048A-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA]|[\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE]|[\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA]|[\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0]|[\\u08A2-\\u08AC\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0977]|[\\u0979-\\u097F\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2]|[\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A]|[\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39]|[\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8]|[\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C]|[\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C]|[\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99]|[\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0]|[\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C3D]|[\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3]|[\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10]|[\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1]|[\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81]|[\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3]|[\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6]|[\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A]|[\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081]|[\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D]|[\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0]|[\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310]|[\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C]|[\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u1700-\\u170C\\u170E-\\u1711]|[\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7]|[\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191C]|[\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16]|[\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF]|[\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC]|[\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D]|[\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D]|[\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3]|[\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F]|[\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128]|[\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183\\u2184]|[\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3]|[\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6]|[\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE]|[\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005\\u3006\\u3031-\\u3035\\u303B\\u303C]|[\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D]|[\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC]|[\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B]|[\\uA640-\\uA66E\\uA67F-\\uA697\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788]|[\\uA78B-\\uA78E\\uA790-\\uA793\\uA7A0-\\uA7AA\\uA7F8-\\uA801\\uA803-\\uA805]|[\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB]|[\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uAA00-\\uAA28]|[\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA80-\\uAAAF\\uAAB1\\uAAB5]|[\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4]|[\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E]|[\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D]|[\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36]|[\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D]|[\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC]|[\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF]|[\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC])/,/^(?:\\|)/,/^(?:\\|)/,/^(?:\\))/,/^(?:\\()/,/^(?:\\])/,/^(?:\\[)/,/^(?:(\\}))/,/^(?:\\{)/,/^(?:[^\\[\\]\\(\\)\\{\\}\\|\\\"]+)/,/^(?:\")/,/^(?:(\\r?\\n)+)/,/^(?:\\s)/,/^(?:$)/],\nconditions: {\"callbackargs\":{\"rules\":[11,12,15,18,70,73,75,77,81,83,87,88,101,103,105,107],\"inclusive\":false},\"callbackname\":{\"rules\":[8,9,10,15,18,70,73,75,77,81,83,87,88,101,103,105,107],\"inclusive\":false},\"href\":{\"rules\":[15,18,70,73,75,77,81,83,87,88,101,103,105,107],\"inclusive\":false},\"click\":{\"rules\":[15,18,27,28,70,73,75,77,81,83,87,88,101,103,105,107],\"inclusive\":false},\"dottedEdgeText\":{\"rules\":[15,18,67,69,70,73,75,77,81,83,87,88,101,103,105,107],\"inclusive\":false},\"thickEdgeText\":{\"rules\":[15,18,64,66,70,73,75,77,81,83,87,88,101,103,105,107],\"inclusive\":false},\"edgeText\":{\"rules\":[15,18,61,63,70,73,75,77,81,83,87,88,101,103,105,107],\"inclusive\":false},\"trapText\":{\"rules\":[15,18,70,73,75,77,81,83,84,85,86,87,88,101,103,105,107],\"inclusive\":false},\"ellipseText\":{\"rules\":[15,18,70,71,72,73,75,77,81,83,87,88,101,103,105,107],\"inclusive\":false},\"text\":{\"rules\":[15,18,70,73,74,75,76,77,80,81,82,83,87,88,100,101,102,103,104,105,106,107,108],\"inclusive\":false},\"vertex\":{\"rules\":[15,18,70,73,75,77,81,83,87,88,101,103,105,107],\"inclusive\":false},\"dir\":{\"rules\":[15,18,38,39,40,41,42,43,44,45,46,47,48,70,73,75,77,81,83,87,88,101,103,105,107],\"inclusive\":false},\"acc_descr_multiline\":{\"rules\":[5,6,15,18,70,73,75,77,81,83,87,88,101,103,105,107],\"inclusive\":false},\"acc_descr\":{\"rules\":[3,15,18,70,73,75,77,81,83,87,88,101,103,105,107],\"inclusive\":false},\"acc_title\":{\"rules\":[1,15,18,70,73,75,77,81,83,87,88,101,103,105,107],\"inclusive\":false},\"md_string\":{\"rules\":[13,14,15,18,70,73,75,77,81,83,87,88,101,103,105,107],\"inclusive\":false},\"string\":{\"rules\":[15,16,17,18,70,73,75,77,81,83,87,88,101,103,105,107],\"inclusive\":false},\"INITIAL\":{\"rules\":[0,2,4,7,15,18,19,20,21,22,23,24,25,26,29,30,31,32,33,34,35,36,37,49,50,51,52,53,54,55,56,57,58,59,60,61,62,64,65,67,68,70,73,75,77,78,79,81,83,87,88,89,90,91,92,93,94,95,96,97,98,99,101,103,105,107,109,110,111,112],\"inclusive\":true}}\n});\nreturn lexer;\n})();\nparser.lexer = lexer;\nfunction Parser () {\n this.yy = {};\n}\nParser.prototype = parser;parser.Parser = Parser;\nreturn new Parser;\n})(); \n\tparser.parser = parser;\n\texport { parser };\n\texport default parser;\n\t", "// import khroma from 'khroma';\nimport * as khroma from 'khroma';\n\n/** Returns the styles given options */\nexport interface FlowChartStyleOptions {\n arrowheadColor: string;\n border2: string;\n clusterBkg: string;\n clusterBorder: string;\n edgeLabelBackground: string;\n fontFamily: string;\n lineColor: string;\n mainBkg: string;\n nodeBorder: string;\n nodeTextColor: string;\n tertiaryColor: string;\n textColor: string;\n titleColor: string;\n}\n\nconst fade = (color: string, opacity: number) => {\n // @ts-ignore TODO: incorrect types from khroma\n const channel = khroma.channel;\n\n const r = channel(color, 'r');\n const g = channel(color, 'g');\n const b = channel(color, 'b');\n\n // @ts-ignore incorrect types from khroma\n return khroma.rgba(r, g, b, opacity);\n};\n\nconst getStyles = (options: FlowChartStyleOptions) =>\n `.label {\n font-family: ${options.fontFamily};\n color: ${options.nodeTextColor || options.textColor};\n }\n .cluster-label text {\n fill: ${options.titleColor};\n }\n .cluster-label span {\n color: ${options.titleColor};\n }\n .cluster-label span p {\n background-color: transparent;\n }\n\n .label text,span {\n fill: ${options.nodeTextColor || options.textColor};\n color: ${options.nodeTextColor || options.textColor};\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ${options.mainBkg};\n stroke: ${options.nodeBorder};\n stroke-width: 1px;\n }\n .rough-node .label text , .node .label text {\n text-anchor: middle;\n }\n // .flowchart-label .text-outer-tspan {\n // text-anchor: middle;\n // }\n // .flowchart-label .text-inner-tspan {\n // text-anchor: start;\n // }\n\n .node .katex path {\n fill: #000;\n stroke: #000;\n stroke-width: 1px;\n }\n\n .node .label {\n text-align: center;\n }\n .node.clickable {\n cursor: pointer;\n }\n\n .arrowheadPath {\n fill: ${options.arrowheadColor};\n }\n\n .edgePath .path {\n stroke: ${options.lineColor};\n stroke-width: 2.0px;\n }\n\n .flowchart-link {\n stroke: ${options.lineColor};\n fill: none;\n }\n\n .edgeLabel {\n background-color: ${options.edgeLabelBackground};\n p {\n background-color: ${options.edgeLabelBackground};\n }\n rect {\n opacity: 0.5;\n background-color: ${options.edgeLabelBackground};\n fill: ${options.edgeLabelBackground};\n }\n text-align: center;\n }\n\n /* For html labels only */\n .labelBkg {\n background-color: ${fade(options.edgeLabelBackground, 0.5)};\n // background-color:\n }\n\n .cluster rect {\n fill: ${options.clusterBkg};\n stroke: ${options.clusterBorder};\n stroke-width: 1px;\n }\n\n .cluster text {\n fill: ${options.titleColor};\n }\n\n .cluster span {\n color: ${options.titleColor};\n }\n /* .cluster div {\n color: ${options.titleColor};\n } */\n\n div.mermaidTooltip {\n position: absolute;\n text-align: center;\n max-width: 200px;\n padding: 2px;\n font-family: ${options.fontFamily};\n font-size: 12px;\n background: ${options.tertiaryColor};\n border: 1px solid ${options.border2};\n border-radius: 2px;\n pointer-events: none;\n z-index: 100;\n }\n\n .flowchartTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${options.textColor};\n }\n`;\n\nexport default getStyles;\n", "import type { MermaidConfig } from '../../config.type.js';\nimport { setConfig } from '../../diagram-api/diagramAPI.js';\nimport flowDb from './flowDb.js';\nimport renderer from './flowRenderer-v3-unified.js';\n// @ts-ignore: JISON doesn't support types\nimport flowParser from './parser/flow.jison';\nimport flowStyles from './styles.js';\n\nexport const diagram = {\n parser: flowParser,\n db: flowDb,\n renderer,\n styles: flowStyles,\n init: (cnf: MermaidConfig) => {\n if (!cnf.flowchart) {\n cnf.flowchart = {};\n }\n if (cnf.layout) {\n setConfig({ layout: cnf.layout });\n }\n cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;\n setConfig({ flowchart: { arrowMarkerAbsolute: cnf.arrowMarkerAbsolute } });\n flowDb.clear();\n flowDb.setGen('gen-2');\n },\n};\n", "/* parser generated by jison 0.4.18 */\n/*\n Returns a Parser object of the following structure:\n\n Parser: {\n yy: {}\n }\n\n Parser.prototype: {\n yy: {},\n trace: function(),\n symbols_: {associative list: name ==> number},\n terminals_: {associative list: number ==> name},\n productions_: [...],\n performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),\n table: [...],\n defaultActions: {...},\n parseError: function(str, hash),\n parse: function(input),\n\n lexer: {\n EOF: 1,\n parseError: function(str, hash),\n setInput: function(input),\n input: function(),\n unput: function(str),\n more: function(),\n less: function(n),\n pastInput: function(),\n upcomingInput: function(),\n showPosition: function(),\n test_match: function(regex_match_array, rule_index),\n next: function(),\n lex: function(),\n begin: function(condition),\n popState: function(),\n _currentRules: function(),\n topState: function(),\n pushState: function(condition),\n\n options: {\n ranges: boolean (optional: true ==> token location info will include a .range[] member)\n flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)\n backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)\n },\n\n performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),\n rules: [...],\n conditions: {associative list: name ==> set},\n }\n }\n\n\n token location info (@$, _$, etc.): {\n first_line: n,\n last_line: n,\n first_column: n,\n last_column: n,\n range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)\n }\n\n\n the parseError function receives a 'hash' object with these members for lexer and parser errors: {\n text: (matched text)\n token: (the produced terminal token, if any)\n line: (yylineno)\n }\n while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {\n loc: (yylloc)\n expected: (string describing the set of expected tokens)\n recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)\n }\n*/\nvar parser = (function(){\nvar o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[6,8,10,20,22,24,26,27,28],$V1=[1,10],$V2=[1,11],$V3=[1,12],$V4=[1,13],$V5=[1,14],$V6=[1,15],$V7=[1,21],$V8=[1,22],$V9=[1,23],$Va=[1,24],$Vb=[1,25],$Vc=[6,8,10,13,15,18,19,20,22,24,26,27,28,41,42,43,44,45],$Vd=[1,34],$Ve=[27,28,46,47],$Vf=[41,42,43,44,45],$Vg=[17,34],$Vh=[1,54],$Vi=[1,53],$Vj=[17,34,36,38];\nvar parser = {trace: function trace () { },\nyy: {},\nsymbols_: {\"error\":2,\"start\":3,\"ER_DIAGRAM\":4,\"document\":5,\"EOF\":6,\"line\":7,\"SPACE\":8,\"statement\":9,\"NEWLINE\":10,\"entityName\":11,\"relSpec\":12,\":\":13,\"role\":14,\"BLOCK_START\":15,\"attributes\":16,\"BLOCK_STOP\":17,\"SQS\":18,\"SQE\":19,\"title\":20,\"title_value\":21,\"acc_title\":22,\"acc_title_value\":23,\"acc_descr\":24,\"acc_descr_value\":25,\"acc_descr_multiline_value\":26,\"ALPHANUM\":27,\"ENTITY_NAME\":28,\"attribute\":29,\"attributeType\":30,\"attributeName\":31,\"attributeKeyTypeList\":32,\"attributeComment\":33,\"ATTRIBUTE_WORD\":34,\"attributeKeyType\":35,\"COMMA\":36,\"ATTRIBUTE_KEY\":37,\"COMMENT\":38,\"cardinality\":39,\"relType\":40,\"ZERO_OR_ONE\":41,\"ZERO_OR_MORE\":42,\"ONE_OR_MORE\":43,\"ONLY_ONE\":44,\"MD_PARENT\":45,\"NON_IDENTIFYING\":46,\"IDENTIFYING\":47,\"WORD\":48,\"$accept\":0,\"$end\":1},\nterminals_: {2:\"error\",4:\"ER_DIAGRAM\",6:\"EOF\",8:\"SPACE\",10:\"NEWLINE\",13:\":\",15:\"BLOCK_START\",17:\"BLOCK_STOP\",18:\"SQS\",19:\"SQE\",20:\"title\",21:\"title_value\",22:\"acc_title\",23:\"acc_title_value\",24:\"acc_descr\",25:\"acc_descr_value\",26:\"acc_descr_multiline_value\",27:\"ALPHANUM\",28:\"ENTITY_NAME\",34:\"ATTRIBUTE_WORD\",36:\"COMMA\",37:\"ATTRIBUTE_KEY\",38:\"COMMENT\",41:\"ZERO_OR_ONE\",42:\"ZERO_OR_MORE\",43:\"ONE_OR_MORE\",44:\"ONLY_ONE\",45:\"MD_PARENT\",46:\"NON_IDENTIFYING\",47:\"IDENTIFYING\",48:\"WORD\"},\nproductions_: [0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,5],[9,4],[9,3],[9,1],[9,7],[9,6],[9,4],[9,2],[9,2],[9,2],[9,1],[11,1],[11,1],[16,1],[16,2],[29,2],[29,3],[29,3],[29,4],[30,1],[31,1],[32,1],[32,3],[35,1],[33,1],[12,3],[39,1],[39,1],[39,1],[39,1],[39,1],[40,1],[40,1],[14,1],[14,1],[14,1]],\nperformAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {\n/* this == yyval */\n\nvar $0 = $$.length - 1;\nswitch (yystate) {\ncase 1:\n /*console.log('finished parsing');*/ \nbreak;\ncase 2:\n this.$ = [] \nbreak;\ncase 3:\n$$[$0-1].push($$[$0]);this.$ = $$[$0-1]\nbreak;\ncase 4: case 5:\n this.$ = $$[$0] \nbreak;\ncase 6: case 7:\n this.$=[];\nbreak;\ncase 8:\n\n yy.addEntity($$[$0-4]);\n yy.addEntity($$[$0-2]);\n yy.addRelationship($$[$0-4], $$[$0], $$[$0-2], $$[$0-3]);\n \nbreak;\ncase 9:\n\n yy.addEntity($$[$0-3]);\n yy.addAttributes($$[$0-3], $$[$0-1]);\n \nbreak;\ncase 10:\n yy.addEntity($$[$0-2]); \nbreak;\ncase 11:\n yy.addEntity($$[$0]); \nbreak;\ncase 12:\n\n yy.addEntity($$[$0-6], $$[$0-4]);\n yy.addAttributes($$[$0-6], $$[$0-1]);\n \nbreak;\ncase 13:\n yy.addEntity($$[$0-5], $$[$0-3]); \nbreak;\ncase 14:\n yy.addEntity($$[$0-3], $$[$0-1]); \nbreak;\ncase 15: case 16:\n this.$=$$[$0].trim();yy.setAccTitle(this.$); \nbreak;\ncase 17: case 18:\n this.$=$$[$0].trim();yy.setAccDescription(this.$); \nbreak;\ncase 19: case 43:\n this.$ = $$[$0]; \nbreak;\ncase 20: case 41: case 42:\n this.$ = $$[$0].replace(/\"/g, ''); \nbreak;\ncase 21: case 29:\n this.$ = [$$[$0]]; \nbreak;\ncase 22:\n $$[$0].push($$[$0-1]); this.$=$$[$0]; \nbreak;\ncase 23:\n this.$ = { attributeType: $$[$0-1], attributeName: $$[$0] }; \nbreak;\ncase 24:\n this.$ = { attributeType: $$[$0-2], attributeName: $$[$0-1], attributeKeyTypeList: $$[$0] }; \nbreak;\ncase 25:\n this.$ = { attributeType: $$[$0-2], attributeName: $$[$0-1], attributeComment: $$[$0] }; \nbreak;\ncase 26:\n this.$ = { attributeType: $$[$0-3], attributeName: $$[$0-2], attributeKeyTypeList: $$[$0-1], attributeComment: $$[$0] }; \nbreak;\ncase 27: case 28: case 31:\n this.$=$$[$0]; \nbreak;\ncase 30:\n $$[$0-2].push($$[$0]); this.$ = $$[$0-2]; \nbreak;\ncase 32:\n this.$=$$[$0].replace(/\"/g, ''); \nbreak;\ncase 33:\n\n this.$ = { cardA: $$[$0], relType: $$[$0-1], cardB: $$[$0-2] };\n /*console.log('relSpec: ' + $$[$0] + $$[$0-1] + $$[$0-2]);*/\n \nbreak;\ncase 34:\n this.$ = yy.Cardinality.ZERO_OR_ONE; \nbreak;\ncase 35:\n this.$ = yy.Cardinality.ZERO_OR_MORE; \nbreak;\ncase 36:\n this.$ = yy.Cardinality.ONE_OR_MORE; \nbreak;\ncase 37:\n this.$ = yy.Cardinality.ONLY_ONE; \nbreak;\ncase 38:\n this.$ = yy.Cardinality.MD_PARENT; \nbreak;\ncase 39:\n this.$ = yy.Identification.NON_IDENTIFYING; \nbreak;\ncase 40:\n this.$ = yy.Identification.IDENTIFYING; \nbreak;\n}\n},\ntable: [{3:1,4:[1,2]},{1:[3]},o($V0,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:9,20:$V1,22:$V2,24:$V3,26:$V4,27:$V5,28:$V6},o($V0,[2,7],{1:[2,1]}),o($V0,[2,3]),{9:16,11:9,20:$V1,22:$V2,24:$V3,26:$V4,27:$V5,28:$V6},o($V0,[2,5]),o($V0,[2,6]),o($V0,[2,11],{12:17,39:20,15:[1,18],18:[1,19],41:$V7,42:$V8,43:$V9,44:$Va,45:$Vb}),{21:[1,26]},{23:[1,27]},{25:[1,28]},o($V0,[2,18]),o($Vc,[2,19]),o($Vc,[2,20]),o($V0,[2,4]),{11:29,27:$V5,28:$V6},{16:30,17:[1,31],29:32,30:33,34:$Vd},{11:35,27:$V5,28:$V6},{40:36,46:[1,37],47:[1,38]},o($Ve,[2,34]),o($Ve,[2,35]),o($Ve,[2,36]),o($Ve,[2,37]),o($Ve,[2,38]),o($V0,[2,15]),o($V0,[2,16]),o($V0,[2,17]),{13:[1,39]},{17:[1,40]},o($V0,[2,10]),{16:41,17:[2,21],29:32,30:33,34:$Vd},{31:42,34:[1,43]},{34:[2,27]},{19:[1,44]},{39:45,41:$V7,42:$V8,43:$V9,44:$Va,45:$Vb},o($Vf,[2,39]),o($Vf,[2,40]),{14:46,27:[1,49],28:[1,48],48:[1,47]},o($V0,[2,9]),{17:[2,22]},o($Vg,[2,23],{32:50,33:51,35:52,37:$Vh,38:$Vi}),o([17,34,37,38],[2,28]),o($V0,[2,14],{15:[1,55]}),o([27,28],[2,33]),o($V0,[2,8]),o($V0,[2,41]),o($V0,[2,42]),o($V0,[2,43]),o($Vg,[2,24],{33:56,36:[1,57],38:$Vi}),o($Vg,[2,25]),o($Vj,[2,29]),o($Vg,[2,32]),o($Vj,[2,31]),{16:58,17:[1,59],29:32,30:33,34:$Vd},o($Vg,[2,26]),{35:60,37:$Vh},{17:[1,61]},o($V0,[2,13]),o($Vj,[2,30]),o($V0,[2,12])],\ndefaultActions: {34:[2,27],41:[2,22]},\nparseError: function parseError (str, hash) {\n if (hash.recoverable) {\n this.trace(str);\n } else {\n var error = new Error(str);\n error.hash = hash;\n throw error;\n }\n},\nparse: function parse(input) {\n var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;\n var args = lstack.slice.call(arguments, 1);\n var lexer = Object.create(this.lexer);\n var sharedState = { yy: {} };\n for (var k in this.yy) {\n if (Object.prototype.hasOwnProperty.call(this.yy, k)) {\n sharedState.yy[k] = this.yy[k];\n }\n }\n lexer.setInput(input, sharedState.yy);\n sharedState.yy.lexer = lexer;\n sharedState.yy.parser = this;\n if (typeof lexer.yylloc == 'undefined') {\n lexer.yylloc = {};\n }\n var yyloc = lexer.yylloc;\n lstack.push(yyloc);\n var ranges = lexer.options && lexer.options.ranges;\n if (typeof sharedState.yy.parseError === 'function') {\n this.parseError = sharedState.yy.parseError;\n } else {\n this.parseError = Object.getPrototypeOf(this).parseError;\n }\n function popStack(n) {\n stack.length = stack.length - 2 * n;\n vstack.length = vstack.length - n;\n lstack.length = lstack.length - n;\n }\n function lex() {\n var token;\n token = tstack.pop() || lexer.lex() || EOF;\n if (typeof token !== 'number') {\n if (token instanceof Array) {\n tstack = token;\n token = tstack.pop();\n }\n token = self.symbols_[token] || token;\n }\n return token;\n }\n var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;\n while (true) {\n state = stack[stack.length - 1];\n if (this.defaultActions[state]) {\n action = this.defaultActions[state];\n } else {\n if (symbol === null || typeof symbol == 'undefined') {\n symbol = lex();\n }\n action = table[state] && table[state][symbol];\n }\n if (typeof action === 'undefined' || !action.length || !action[0]) {\n var errStr = '';\n expected = [];\n for (p in table[state]) {\n if (this.terminals_[p] && p > TERROR) {\n expected.push('\\'' + this.terminals_[p] + '\\'');\n }\n }\n if (lexer.showPosition) {\n errStr = 'Parse error on line ' + (yylineno + 1) + ':\\n' + lexer.showPosition() + '\\nExpecting ' + expected.join(', ') + ', got \\'' + (this.terminals_[symbol] || symbol) + '\\'';\n } else {\n errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\\'' + (this.terminals_[symbol] || symbol) + '\\'');\n }\n this.parseError(errStr, {\n text: lexer.match,\n token: this.terminals_[symbol] || symbol,\n line: lexer.yylineno,\n loc: yyloc,\n expected: expected\n });\n }\n if (action[0] instanceof Array && action.length > 1) {\n throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);\n }\n switch (action[0]) {\n case 1:\n stack.push(symbol);\n vstack.push(lexer.yytext);\n lstack.push(lexer.yylloc);\n stack.push(action[1]);\n symbol = null;\n if (!preErrorSymbol) {\n yyleng = lexer.yyleng;\n yytext = lexer.yytext;\n yylineno = lexer.yylineno;\n yyloc = lexer.yylloc;\n if (recovering > 0) {\n recovering--;\n }\n } else {\n symbol = preErrorSymbol;\n preErrorSymbol = null;\n }\n break;\n case 2:\n len = this.productions_[action[1]][1];\n yyval.$ = vstack[vstack.length - len];\n yyval._$ = {\n first_line: lstack[lstack.length - (len || 1)].first_line,\n last_line: lstack[lstack.length - 1].last_line,\n first_column: lstack[lstack.length - (len || 1)].first_column,\n last_column: lstack[lstack.length - 1].last_column\n };\n if (ranges) {\n yyval._$.range = [\n lstack[lstack.length - (len || 1)].range[0],\n lstack[lstack.length - 1].range[1]\n ];\n }\n r = this.performAction.apply(yyval, [\n yytext,\n yyleng,\n yylineno,\n sharedState.yy,\n action[1],\n vstack,\n lstack\n ].concat(args));\n if (typeof r !== 'undefined') {\n return r;\n }\n if (len) {\n stack = stack.slice(0, -1 * len * 2);\n vstack = vstack.slice(0, -1 * len);\n lstack = lstack.slice(0, -1 * len);\n }\n stack.push(this.productions_[action[1]][0]);\n vstack.push(yyval.$);\n lstack.push(yyval._$);\n newState = table[stack[stack.length - 2]][stack[stack.length - 1]];\n stack.push(newState);\n break;\n case 3:\n return true;\n }\n }\n return true;\n}};\n\n/* generated by jison-lex 0.3.4 */\nvar lexer = (function(){\nvar lexer = ({\n\nEOF:1,\n\nparseError:function parseError(str, hash) {\n if (this.yy.parser) {\n this.yy.parser.parseError(str, hash);\n } else {\n throw new Error(str);\n }\n },\n\n// resets the lexer, sets new input\nsetInput:function (input, yy) {\n this.yy = yy || this.yy || {};\n this._input = input;\n this._more = this._backtrack = this.done = false;\n this.yylineno = this.yyleng = 0;\n this.yytext = this.matched = this.match = '';\n this.conditionStack = ['INITIAL'];\n this.yylloc = {\n first_line: 1,\n first_column: 0,\n last_line: 1,\n last_column: 0\n };\n if (this.options.ranges) {\n this.yylloc.range = [0,0];\n }\n this.offset = 0;\n return this;\n },\n\n// consumes and returns one char from the input\ninput:function () {\n var ch = this._input[0];\n this.yytext += ch;\n this.yyleng++;\n this.offset++;\n this.match += ch;\n this.matched += ch;\n var lines = ch.match(/(?:\\r\\n?|\\n).*/g);\n if (lines) {\n this.yylineno++;\n this.yylloc.last_line++;\n } else {\n this.yylloc.last_column++;\n }\n if (this.options.ranges) {\n this.yylloc.range[1]++;\n }\n\n this._input = this._input.slice(1);\n return ch;\n },\n\n// unshifts one char (or a string) into the input\nunput:function (ch) {\n var len = ch.length;\n var lines = ch.split(/(?:\\r\\n?|\\n)/g);\n\n this._input = ch + this._input;\n this.yytext = this.yytext.substr(0, this.yytext.length - len);\n //this.yyleng -= len;\n this.offset -= len;\n var oldLines = this.match.split(/(?:\\r\\n?|\\n)/g);\n this.match = this.match.substr(0, this.match.length - 1);\n this.matched = this.matched.substr(0, this.matched.length - 1);\n\n if (lines.length - 1) {\n this.yylineno -= lines.length - 1;\n }\n var r = this.yylloc.range;\n\n this.yylloc = {\n first_line: this.yylloc.first_line,\n last_line: this.yylineno + 1,\n first_column: this.yylloc.first_column,\n last_column: lines ?\n (lines.length === oldLines.length ? this.yylloc.first_column : 0)\n + oldLines[oldLines.length - lines.length].length - lines[0].length :\n this.yylloc.first_column - len\n };\n\n if (this.options.ranges) {\n this.yylloc.range = [r[0], r[0] + this.yyleng - len];\n }\n this.yyleng = this.yytext.length;\n return this;\n },\n\n// When called from action, caches matched text and appends it on next action\nmore:function () {\n this._more = true;\n return this;\n },\n\n// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.\nreject:function () {\n if (this.options.backtrack_lexer) {\n this._backtrack = true;\n } else {\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n' + this.showPosition(), {\n text: \"\",\n token: null,\n line: this.yylineno\n });\n\n }\n return this;\n },\n\n// retain first n characters of the match\nless:function (n) {\n this.unput(this.match.slice(n));\n },\n\n// displays already matched input, i.e. for error messages\npastInput:function () {\n var past = this.matched.substr(0, this.matched.length - this.match.length);\n return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\\n/g, \"\");\n },\n\n// displays upcoming input, i.e. for error messages\nupcomingInput:function () {\n var next = this.match;\n if (next.length < 20) {\n next += this._input.substr(0, 20-next.length);\n }\n return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\\n/g, \"\");\n },\n\n// displays the character position where the lexing error occurred, i.e. for error messages\nshowPosition:function () {\n var pre = this.pastInput();\n var c = new Array(pre.length + 1).join(\"-\");\n return pre + this.upcomingInput() + \"\\n\" + c + \"^\";\n },\n\n// test the lexed token: return FALSE when not a match, otherwise return token\ntest_match:function(match, indexed_rule) {\n var token,\n lines,\n backup;\n\n if (this.options.backtrack_lexer) {\n // save context\n backup = {\n yylineno: this.yylineno,\n yylloc: {\n first_line: this.yylloc.first_line,\n last_line: this.last_line,\n first_column: this.yylloc.first_column,\n last_column: this.yylloc.last_column\n },\n yytext: this.yytext,\n match: this.match,\n matches: this.matches,\n matched: this.matched,\n yyleng: this.yyleng,\n offset: this.offset,\n _more: this._more,\n _input: this._input,\n yy: this.yy,\n conditionStack: this.conditionStack.slice(0),\n done: this.done\n };\n if (this.options.ranges) {\n backup.yylloc.range = this.yylloc.range.slice(0);\n }\n }\n\n lines = match[0].match(/(?:\\r\\n?|\\n).*/g);\n if (lines) {\n this.yylineno += lines.length;\n }\n this.yylloc = {\n first_line: this.yylloc.last_line,\n last_line: this.yylineno + 1,\n first_column: this.yylloc.last_column,\n last_column: lines ?\n lines[lines.length - 1].length - lines[lines.length - 1].match(/\\r?\\n?/)[0].length :\n this.yylloc.last_column + match[0].length\n };\n this.yytext += match[0];\n this.match += match[0];\n this.matches = match;\n this.yyleng = this.yytext.length;\n if (this.options.ranges) {\n this.yylloc.range = [this.offset, this.offset += this.yyleng];\n }\n this._more = false;\n this._backtrack = false;\n this._input = this._input.slice(match[0].length);\n this.matched += match[0];\n token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);\n if (this.done && this._input) {\n this.done = false;\n }\n if (token) {\n return token;\n } else if (this._backtrack) {\n // recover context\n for (var k in backup) {\n this[k] = backup[k];\n }\n return false; // rule action called reject() implying the next rule should be tested instead.\n }\n return false;\n },\n\n// return next match in input\nnext:function () {\n if (this.done) {\n return this.EOF;\n }\n if (!this._input) {\n this.done = true;\n }\n\n var token,\n match,\n tempMatch,\n index;\n if (!this._more) {\n this.yytext = '';\n this.match = '';\n }\n var rules = this._currentRules();\n for (var i = 0; i < rules.length; i++) {\n tempMatch = this._input.match(this.rules[rules[i]]);\n if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {\n match = tempMatch;\n index = i;\n if (this.options.backtrack_lexer) {\n token = this.test_match(tempMatch, rules[i]);\n if (token !== false) {\n return token;\n } else if (this._backtrack) {\n match = false;\n continue; // rule action called reject() implying a rule MISmatch.\n } else {\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n } else if (!this.options.flex) {\n break;\n }\n }\n }\n if (match) {\n token = this.test_match(match, rules[index]);\n if (token !== false) {\n return token;\n }\n // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)\n return false;\n }\n if (this._input === \"\") {\n return this.EOF;\n } else {\n return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\\n' + this.showPosition(), {\n text: \"\",\n token: null,\n line: this.yylineno\n });\n }\n },\n\n// return next match that has a token\nlex:function lex () {\n var r = this.next();\n if (r) {\n return r;\n } else {\n return this.lex();\n }\n },\n\n// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)\nbegin:function begin (condition) {\n this.conditionStack.push(condition);\n },\n\n// pop the previously active lexer condition state off the condition stack\npopState:function popState () {\n var n = this.conditionStack.length - 1;\n if (n > 0) {\n return this.conditionStack.pop();\n } else {\n return this.conditionStack[0];\n }\n },\n\n// produce the lexer rule set which is active for the currently active lexer condition state\n_currentRules:function _currentRules () {\n if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {\n return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;\n } else {\n return this.conditions[\"INITIAL\"].rules;\n }\n },\n\n// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available\ntopState:function topState (n) {\n n = this.conditionStack.length - 1 - Math.abs(n || 0);\n if (n >= 0) {\n return this.conditionStack[n];\n } else {\n return \"INITIAL\";\n }\n },\n\n// alias for begin(condition)\npushState:function pushState (condition) {\n this.begin(condition);\n },\n\n// return the number of states currently on the stack\nstateStackSize:function stateStackSize() {\n return this.conditionStack.length;\n },\noptions: {\"case-insensitive\":true},\nperformAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {\nvar YYSTATE=YY_START;\nswitch($avoiding_name_collisions) {\ncase 0: this.begin(\"acc_title\");return 22; \nbreak;\ncase 1: this.popState(); return \"acc_title_value\"; \nbreak;\ncase 2: this.begin(\"acc_descr\");return 24; \nbreak;\ncase 3: this.popState(); return \"acc_descr_value\"; \nbreak;\ncase 4: this.begin(\"acc_descr_multiline\");\nbreak;\ncase 5: this.popState(); \nbreak;\ncase 6:return \"acc_descr_multiline_value\";\nbreak;\ncase 7:return 10;\nbreak;\ncase 8:/* skip whitespace */\nbreak;\ncase 9:return 8;\nbreak;\ncase 10:return 28;\nbreak;\ncase 11:return 48;\nbreak;\ncase 12:return 4;\nbreak;\ncase 13: this.begin(\"block\"); return 15; \nbreak;\ncase 14:return 36;\nbreak;\ncase 15:/* skip whitespace in block */\nbreak;\ncase 16:return 37\nbreak;\ncase 17:return 34;\nbreak;\ncase 18:return 34\nbreak;\ncase 19:return 38;\nbreak;\ncase 20:/* nothing */\nbreak;\ncase 21: this.popState(); return 17; \nbreak;\ncase 22:return yy_.yytext[0];\nbreak;\ncase 23:return 18;\nbreak;\ncase 24:return 19;\nbreak;\ncase 25:return 41;\nbreak;\ncase 26:return 43;\nbreak;\ncase 27:return 43;\nbreak;\ncase 28:return 43;\nbreak;\ncase 29:return 41;\nbreak;\ncase 30:return 41;\nbreak;\ncase 31:return 42;\nbreak;\ncase 32:return 42;\nbreak;\ncase 33:return 42;\nbreak;\ncase 34:return 42;\nbreak;\ncase 35:return 42;\nbreak;\ncase 36:return 43;\nbreak;\ncase 37:return 42;\nbreak;\ncase 38:return 43;\nbreak;\ncase 39:return 44;\nbreak;\ncase 40:return 44;\nbreak;\ncase 41:return 44;\nbreak;\ncase 42:return 44;\nbreak;\ncase 43:return 41;\nbreak;\ncase 44:return 42;\nbreak;\ncase 45:return 43;\nbreak;\ncase 46:return 45;\nbreak;\ncase 47:return 46;\nbreak;\ncase 48:return 47;\nbreak;\ncase 49:return 47;\nbreak;\ncase 50:return 46;\nbreak;\ncase 51:return 46;\nbreak;\ncase 52:return 46;\nbreak;\ncase 53:return 27;\nbreak;\ncase 54:return yy_.yytext[0];\nbreak;\ncase 55:return 6;\nbreak;\n}\n},\nrules: [/^(?:accTitle\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*\\{\\s*)/i,/^(?:[\\}])/i,/^(?:[^\\}]*)/i,/^(?:[\\n]+)/i,/^(?:\\s+)/i,/^(?:[\\s]+)/i,/^(?:\"[^\"%\\r\\n\\v\\b\\\\]+\")/i,/^(?:\"[^\"]*\")/i,/^(?:erDiagram\\b)/i,/^(?:\\{)/i,/^(?:,)/i,/^(?:\\s+)/i,/^(?:\\b((?:PK)|(?:FK)|(?:UK))\\b)/i,/^(?:(.*?)[~](.*?)*[~])/i,/^(?:[\\*A-Za-z_][A-Za-z0-9\\-_\\[\\]\\(\\)]*)/i,/^(?:\"[^\"]*\")/i,/^(?:[\\n]+)/i,/^(?:\\})/i,/^(?:.)/i,/^(?:\\[)/i,/^(?:\\])/i,/^(?:one or zero\\b)/i,/^(?:one or more\\b)/i,/^(?:one or many\\b)/i,/^(?:1\\+)/i,/^(?:\\|o\\b)/i,/^(?:zero or one\\b)/i,/^(?:zero or more\\b)/i,/^(?:zero or many\\b)/i,/^(?:0\\+)/i,/^(?:\\}o\\b)/i,/^(?:many\\(0\\))/i,/^(?:many\\(1\\))/i,/^(?:many\\b)/i,/^(?:\\}\\|)/i,/^(?:one\\b)/i,/^(?:only one\\b)/i,/^(?:1\\b)/i,/^(?:\\|\\|)/i,/^(?:o\\|)/i,/^(?:o\\{)/i,/^(?:\\|\\{)/i,/^(?:\\s*u\\b)/i,/^(?:\\.\\.)/i,/^(?:--)/i,/^(?:to\\b)/i,/^(?:optionally to\\b)/i,/^(?:\\.-)/i,/^(?:-\\.)/i,/^(?:[A-Za-z_][A-Za-z0-9\\-_]*)/i,/^(?:.)/i,/^(?:$)/i],\nconditions: {\"acc_descr_multiline\":{\"rules\":[5,6],\"inclusive\":false},\"acc_descr\":{\"rules\":[3],\"inclusive\":false},\"acc_title\":{\"rules\":[1],\"inclusive\":false},\"block\":{\"rules\":[14,15,16,17,18,19,20,21,22],\"inclusive\":false},\"INITIAL\":{\"rules\":[0,2,4,7,8,9,10,11,12,13,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55],\"inclusive\":true}}\n});\nreturn lexer;\n})();\nparser.lexer = lexer;\nfunction Parser () {\n this.yy = {};\n}\nParser.prototype = parser;parser.Parser = Parser;\nreturn new Parser;\n})(); \n\tparser.parser = parser;\n\texport { parser };\n\texport default parser;\n\t", "import { log } from '../../logger.js';\nimport { getConfig } from '../../diagram-api/diagramAPI.js';\n\nimport {\n setAccTitle,\n getAccTitle,\n getAccDescription,\n setAccDescription,\n clear as commonClear,\n setDiagramTitle,\n getDiagramTitle,\n} from '../common/commonDb.js';\n\nlet entities = new Map();\nlet relationships = [];\n\nconst Cardinality = {\n ZERO_OR_ONE: 'ZERO_OR_ONE',\n ZERO_OR_MORE: 'ZERO_OR_MORE',\n ONE_OR_MORE: 'ONE_OR_MORE',\n ONLY_ONE: 'ONLY_ONE',\n MD_PARENT: 'MD_PARENT',\n};\n\nconst Identification = {\n NON_IDENTIFYING: 'NON_IDENTIFYING',\n IDENTIFYING: 'IDENTIFYING',\n};\n/**\n * Add entity\n * @param {string} name - The name of the entity\n * @param {string | undefined} alias - The alias of the entity\n */\nconst addEntity = function (name, alias = undefined) {\n if (!entities.has(name)) {\n entities.set(name, { attributes: [], alias });\n log.info('Added new entity :', name);\n } else if (!entities.get(name).alias && alias) {\n entities.get(name).alias = alias;\n log.info(`Add alias '${alias}' to entity '${name}'`);\n }\n\n return entities.get(name);\n};\n\nconst getEntities = () => entities;\n\nconst addAttributes = function (entityName, attribs) {\n let entity = addEntity(entityName); // May do nothing (if entity has already been added)\n\n // Process attribs in reverse order due to effect of recursive construction (last attribute is first)\n let i;\n for (i = attribs.length - 1; i >= 0; i--) {\n entity.attributes.push(attribs[i]);\n log.debug('Added attribute ', attribs[i].attributeName);\n }\n};\n\n/**\n * Add a relationship\n *\n * @param entA The first entity in the relationship\n * @param rolA The role played by the first entity in relation to the second\n * @param entB The second entity in the relationship\n * @param rSpec The details of the relationship between the two entities\n */\nconst addRelationship = function (entA, rolA, entB, rSpec) {\n let rel = {\n entityA: entA,\n roleA: rolA,\n entityB: entB,\n relSpec: rSpec,\n };\n\n relationships.push(rel);\n log.debug('Added new relationship :', rel);\n};\n\nconst getRelationships = () => relationships;\n\nconst clear = function () {\n entities = new Map();\n relationships = [];\n commonClear();\n};\n\nexport default {\n Cardinality,\n Identification,\n getConfig: () => getConfig().er,\n addEntity,\n addAttributes,\n getEntities,\n addRelationship,\n getRelationships,\n clear,\n setAccTitle,\n getAccTitle,\n setAccDescription,\n getAccDescription,\n setDiagramTitle,\n getDiagramTitle,\n};\n", "const ERMarkers = {\n ONLY_ONE_START: 'ONLY_ONE_START',\n ONLY_ONE_END: 'ONLY_ONE_END',\n ZERO_OR_ONE_START: 'ZERO_OR_ONE_START',\n ZERO_OR_ONE_END: 'ZERO_OR_ONE_END',\n ONE_OR_MORE_START: 'ONE_OR_MORE_START',\n ONE_OR_MORE_END: 'ONE_OR_MORE_END',\n ZERO_OR_MORE_START: 'ZERO_OR_MORE_START',\n ZERO_OR_MORE_END: 'ZERO_OR_MORE_END',\n MD_PARENT_END: 'MD_PARENT_END',\n MD_PARENT_START: 'MD_PARENT_START',\n};\n\n/**\n * Put the markers into the svg DOM for later use with edge paths\n *\n * @param elem\n * @param conf\n */\nconst insertMarkers = function (elem, conf) {\n let marker;\n\n elem\n .append('defs')\n .append('marker')\n .attr('id', ERMarkers.MD_PARENT_START)\n .attr('refX', 0)\n .attr('refY', 7)\n .attr('markerWidth', 190)\n .attr('markerHeight', 240)\n .attr('orient', 'auto')\n .append('path')\n .attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');\n\n elem\n .append('defs')\n .append('marker')\n .attr('id', ERMarkers.MD_PARENT_END)\n .attr('refX', 19)\n .attr('refY', 7)\n .attr('markerWidth', 20)\n .attr('markerHeight', 28)\n .attr('orient', 'auto')\n .append('path')\n .attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');\n\n elem\n .append('defs')\n .append('marker')\n .attr('id', ERMarkers.ONLY_ONE_START)\n .attr('refX', 0)\n .attr('refY', 9)\n .attr('markerWidth', 18)\n .attr('markerHeight', 18)\n .attr('orient', 'auto')\n .append('path')\n .attr('stroke', conf.stroke)\n .attr('fill', 'none')\n .attr('d', 'M9,0 L9,18 M15,0 L15,18');\n\n elem\n .append('defs')\n .append('marker')\n .attr('id', ERMarkers.ONLY_ONE_END)\n .attr('refX', 18)\n .attr('refY', 9)\n .attr('markerWidth', 18)\n .attr('markerHeight', 18)\n .attr('orient', 'auto')\n .append('path')\n .attr('stroke', conf.stroke)\n .attr('fill', 'none')\n .attr('d', 'M3,0 L3,18 M9,0 L9,18');\n\n marker = elem\n .append('defs')\n .append('marker')\n .attr('id', ERMarkers.ZERO_OR_ONE_START)\n .attr('refX', 0)\n .attr('refY', 9)\n .attr('markerWidth', 30)\n .attr('markerHeight', 18)\n .attr('orient', 'auto');\n marker\n .append('circle')\n .attr('stroke', conf.stroke)\n .attr('fill', 'white')\n .attr('cx', 21)\n .attr('cy', 9)\n .attr('r', 6);\n marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M9,0 L9,18');\n\n marker = elem\n .append('defs')\n .append('marker')\n .attr('id', ERMarkers.ZERO_OR_ONE_END)\n .attr('refX', 30)\n .attr('refY', 9)\n .attr('markerWidth', 30)\n .attr('markerHeight', 18)\n .attr('orient', 'auto');\n marker\n .append('circle')\n .attr('stroke', conf.stroke)\n .attr('fill', 'white')\n .attr('cx', 9)\n .attr('cy', 9)\n .attr('r', 6);\n marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M21,0 L21,18');\n\n elem\n .append('defs')\n .append('marker')\n .attr('id', ERMarkers.ONE_OR_MORE_START)\n .attr('refX', 18)\n .attr('refY', 18)\n .attr('markerWidth', 45)\n .attr('markerHeight', 36)\n .attr('orient', 'auto')\n .append('path')\n .attr('stroke', conf.stroke)\n .attr('fill', 'none')\n .attr('d', 'M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27');\n\n elem\n .append('defs')\n .append('marker')\n .attr('id', ERMarkers.ONE_OR_MORE_END)\n .attr('refX', 27)\n .attr('refY', 18)\n .attr('markerWidth', 45)\n .attr('markerHeight', 36)\n .attr('orient', 'auto')\n .append('path')\n .attr('stroke', conf.stroke)\n .attr('fill', 'none')\n .attr('d', 'M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18');\n\n marker = elem\n .append('defs')\n .append('marker')\n .attr('id', ERMarkers.ZERO_OR_MORE_START)\n .attr('refX', 18)\n .attr('refY', 18)\n .attr('markerWidth', 57)\n .attr('markerHeight', 36)\n .attr('orient', 'auto');\n marker\n .append('circle')\n .attr('stroke', conf.stroke)\n .attr('fill', 'white')\n .attr('cx', 48)\n .attr('cy', 18)\n .attr('r', 6);\n marker\n .append('path')\n .attr('stroke', conf.stroke)\n .attr('fill', 'none')\n .attr('d', 'M0,18 Q18,0 36,18 Q18,36 0,18');\n\n marker = elem\n .append('defs')\n .append('marker')\n .attr('id', ERMarkers.ZERO_OR_MORE_END)\n .attr('refX', 39)\n .attr('refY', 18)\n .attr('markerWidth', 57)\n .attr('markerHeight', 36)\n .attr('orient', 'auto');\n marker\n .append('circle')\n .attr('stroke', conf.stroke)\n .attr('fill', 'white')\n .attr('cx', 9)\n .attr('cy', 18)\n .attr('r', 6);\n marker\n .append('path')\n .attr('stroke', conf.stroke)\n .attr('fill', 'none')\n .attr('d', 'M21,18 Q39,0 57,18 Q39,36 21,18');\n\n return;\n};\n\nexport default {\n ERMarkers,\n insertMarkers,\n};\n", "export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;", "import REGEX from './regex.js';\n\nfunction validate(uuid) {\n return typeof uuid === 'string' && REGEX.test(uuid);\n}\n\nexport default validate;", "import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;", "import validate from './validate.js';\n\nfunction parse(uuid) {\n if (!validate(uuid)) {\n throw TypeError('Invalid UUID');\n }\n\n let v;\n const arr = new Uint8Array(16); // Parse ########-....-....-....-............\n\n arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;\n arr[1] = v >>> 16 & 0xff;\n arr[2] = v >>> 8 & 0xff;\n arr[3] = v & 0xff; // Parse ........-####-....-....-............\n\n arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;\n arr[5] = v & 0xff; // Parse ........-....-####-....-............\n\n arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;\n arr[7] = v & 0xff; // Parse ........-....-....-####-............\n\n arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;\n arr[9] = v & 0xff; // Parse ........-....-....-....-############\n // (Use \"/\" to avoid 32-bit truncation when bit-shifting high-order bytes)\n\n arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;\n arr[11] = v / 0x100000000 & 0xff;\n arr[12] = v >>> 24 & 0xff;\n arr[13] = v >>> 16 & 0xff;\n arr[14] = v >>> 8 & 0xff;\n arr[15] = v & 0xff;\n return arr;\n}\n\nexport default parse;", "import { unsafeStringify } from './stringify.js';\nimport parse from './parse.js';\n\nfunction stringToBytes(str) {\n str = unescape(encodeURIComponent(str)); // UTF8 escape\n\n const bytes = [];\n\n for (let i = 0; i < str.length; ++i) {\n bytes.push(str.charCodeAt(i));\n }\n\n return bytes;\n}\n\nexport const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';\nexport const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';\nexport default function v35(name, version, hashfunc) {\n function generateUUID(value, namespace, buf, offset) {\n var _namespace;\n\n if (typeof value === 'string') {\n value = stringToBytes(value);\n }\n\n if (typeof namespace === 'string') {\n namespace = parse(namespace);\n }\n\n if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {\n throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');\n } // Compute hash of namespace and value, Per 4.3\n // Future: Use spread syntax when supported on all platforms, e.g. `bytes =\n // hashfunc([...namespace, ... value])`\n\n\n let bytes = new Uint8Array(16 + value.length);\n bytes.set(namespace);\n bytes.set(value, namespace.length);\n bytes = hashfunc(bytes);\n bytes[6] = bytes[6] & 0x0f | version;\n bytes[8] = bytes[8] & 0x3f | 0x80;\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = bytes[i];\n }\n\n return buf;\n }\n\n return unsafeStringify(bytes);\n } // Function#name is not settable on some platforms (#270)\n\n\n try {\n generateUUID.name = name; // eslint-disable-next-line no-empty\n } catch (err) {} // For CommonJS default export support\n\n\n generateUUID.DNS = DNS;\n generateUUID.URL = URL;\n return generateUUID;\n}", "// Adapted from Chris Veness' SHA1 code at\n// http://www.movable-type.co.uk/scripts/sha1.html\nfunction f(s, x, y, z) {\n switch (s) {\n case 0:\n return x & y ^ ~x & z;\n\n case 1:\n return x ^ y ^ z;\n\n case 2:\n return x & y ^ x & z ^ y & z;\n\n case 3:\n return x ^ y ^ z;\n }\n}\n\nfunction ROTL(x, n) {\n return x << n | x >>> 32 - n;\n}\n\nfunction sha1(bytes) {\n const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];\n const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];\n\n if (typeof bytes === 'string') {\n const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape\n\n bytes = [];\n\n for (let i = 0; i < msg.length; ++i) {\n bytes.push(msg.charCodeAt(i));\n }\n } else if (!Array.isArray(bytes)) {\n // Convert Array-like to Array\n bytes = Array.prototype.slice.call(bytes);\n }\n\n bytes.push(0x80);\n const l = bytes.length / 4 + 2;\n const N = Math.ceil(l / 16);\n const M = new Array(N);\n\n for (let i = 0; i < N; ++i) {\n const arr = new Uint32Array(16);\n\n for (let j = 0; j < 16; ++j) {\n arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3];\n }\n\n M[i] = arr;\n }\n\n M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);\n M[N - 1][14] = Math.floor(M[N - 1][14]);\n M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;\n\n for (let i = 0; i < N; ++i) {\n const W = new Uint32Array(80);\n\n for (let t = 0; t < 16; ++t) {\n W[t] = M[i][t];\n }\n\n for (let t = 16; t < 80; ++t) {\n W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);\n }\n\n let a = H[0];\n let b = H[1];\n let c = H[2];\n let d = H[3];\n let e = H[4];\n\n for (let t = 0; t < 80; ++t) {\n const s = Math.floor(t / 20);\n const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;\n e = d;\n d = c;\n c = ROTL(b, 30) >>> 0;\n b = a;\n a = T;\n }\n\n H[0] = H[0] + a >>> 0;\n H[1] = H[1] + b >>> 0;\n H[2] = H[2] + c >>> 0;\n H[3] = H[3] + d >>> 0;\n H[4] = H[4] + e >>> 0;\n }\n\n return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];\n}\n\nexport default sha1;", "import v35 from './v35.js';\nimport sha1 from './sha1.js';\nconst v5 = v35('v5', 0x50, sha1);\nexport default v5;", "export { default as v1 } from './v1.js';\nexport { default as v3 } from './v3.js';\nexport { default as v4 } from './v4.js';\nexport { default as v5 } from './v5.js';\nexport { default as NIL } from './nil.js';\nexport { default as version } from './version.js';\nexport { default as validate } from './validate.js';\nexport { default as stringify } from './stringify.js';\nexport { default as parse } from './parse.js';", "import * as graphlib from 'dagre-d3-es/src/graphlib/index.js';\nimport { line, curveBasis, select } from 'd3';\nimport { layout as dagreLayout } from 'dagre-d3-es/src/dagre/index.js';\nimport { getConfig } from '../../diagram-api/diagramAPI.js';\nimport { log } from '../../logger.js';\nimport utils from '../../utils.js';\nimport erMarkers from './erMarkers.js';\nimport { configureSvgSize } from '../../setupGraphViewbox.js';\nimport { parseGenericTypes } from '../common/common.js';\nimport { v5 as uuid5 } from 'uuid';\n\n/** Regex used to remove chars from the entity name so the result can be used in an id */\nconst BAD_ID_CHARS_REGEXP = /[^\\dA-Za-z](\\W)*/g;\n\n// Configuration\nlet conf = {};\n\n// Map so we can look up the id of an entity based on the name\nlet entityNameIds = new Map();\n\n/**\n * Allows the top-level API module to inject config specific to this renderer, storing it in the\n * local conf object. Note that generic config still needs to be retrieved using getConfig()\n * imported from the config module\n *\n * @param cnf\n */\nexport const setConf = function (cnf) {\n const keys = Object.keys(cnf);\n for (const key of keys) {\n conf[key] = cnf[key];\n }\n};\n\n/**\n * Draw attributes for an entity\n *\n * @param groupNode The svg group node for the entity\n * @param entityTextNode The svg node for the entity label text\n * @param attributes An array of attributes defined for the entity (each attribute has a type and a\n * name)\n * @returns {object} The bounding box of the entity, after attributes have been added. The bounding\n * box has a .width and .height\n */\nconst drawAttributes = (groupNode, entityTextNode, attributes) => {\n const heightPadding = conf.entityPadding / 3; // Padding internal to attribute boxes\n const widthPadding = conf.entityPadding / 3; // Ditto\n const attrFontSize = conf.fontSize * 0.85;\n const labelBBox = entityTextNode.node().getBBox();\n const attributeNodes = []; // Intermediate storage for attribute nodes created so that we can do a second pass\n let hasKeyType = false;\n let hasComment = false;\n let maxTypeWidth = 0;\n let maxNameWidth = 0;\n let maxKeyWidth = 0;\n let maxCommentWidth = 0;\n let cumulativeHeight = labelBBox.height + heightPadding * 2;\n let attrNum = 1;\n\n // Check to see if any of the attributes has a key or a comment\n attributes.forEach((item) => {\n if (item.attributeKeyTypeList !== undefined && item.attributeKeyTypeList.length > 0) {\n hasKeyType = true;\n }\n\n if (item.attributeComment !== undefined) {\n hasComment = true;\n }\n });\n\n attributes.forEach((item) => {\n const attrPrefix = `${entityTextNode.node().id}-attr-${attrNum}`;\n let nodeHeight = 0;\n\n const attributeType = parseGenericTypes(item.attributeType);\n\n // Add a text node for the attribute type\n const typeNode = groupNode\n .append('text')\n .classed('er entityLabel', true)\n .attr('id', `${attrPrefix}-type`)\n .attr('x', 0)\n .attr('y', 0)\n .style('dominant-baseline', 'middle')\n .style('text-anchor', 'left')\n .style('font-family', getConfig().fontFamily)\n .style('font-size', attrFontSize + 'px')\n .text(attributeType);\n\n // Add a text node for the attribute name\n const nameNode = groupNode\n .append('text')\n .classed('er entityLabel', true)\n .attr('id', `${attrPrefix}-name`)\n .attr('x', 0)\n .attr('y', 0)\n .style('dominant-baseline', 'middle')\n .style('text-anchor', 'left')\n .style('font-family', getConfig().fontFamily)\n .style('font-size', attrFontSize + 'px')\n .text(item.attributeName);\n\n const attributeNode = {};\n attributeNode.tn = typeNode;\n attributeNode.nn = nameNode;\n\n const typeBBox = typeNode.node().getBBox();\n const nameBBox = nameNode.node().getBBox();\n maxTypeWidth = Math.max(maxTypeWidth, typeBBox.width);\n maxNameWidth = Math.max(maxNameWidth, nameBBox.width);\n\n nodeHeight = Math.max(typeBBox.height, nameBBox.height);\n\n if (hasKeyType) {\n const keyTypeNodeText =\n item.attributeKeyTypeList !== undefined ? item.attributeKeyTypeList.join(',') : '';\n\n const keyTypeNode = groupNode\n .append('text')\n .classed('er entityLabel', true)\n .attr('id', `${attrPrefix}-key`)\n .attr('x', 0)\n .attr('y', 0)\n .style('dominant-baseline', 'middle')\n .style('text-anchor', 'left')\n .style('font-family', getConfig().fontFamily)\n .style('font-size', attrFontSize + 'px')\n .text(keyTypeNodeText);\n\n attributeNode.kn = keyTypeNode;\n const keyTypeBBox = keyTypeNode.node().getBBox();\n maxKeyWidth = Math.max(maxKeyWidth, keyTypeBBox.width);\n nodeHeight = Math.max(nodeHeight, keyTypeBBox.height);\n }\n\n if (hasComment) {\n const commentNode = groupNode\n .append('text')\n .classed('er entityLabel', true)\n .attr('id', `${attrPrefix}-comment`)\n .attr('x', 0)\n .attr('y', 0)\n .style('dominant-baseline', 'middle')\n .style('text-anchor', 'left')\n .style('font-family', getConfig().fontFamily)\n .style('font-size', attrFontSize + 'px')\n .text(item.attributeComment || '');\n\n attributeNode.cn = commentNode;\n const commentNodeBBox = commentNode.node().getBBox();\n maxCommentWidth = Math.max(maxCommentWidth, commentNodeBBox.width);\n nodeHeight = Math.max(nodeHeight, commentNodeBBox.height);\n }\n\n attributeNode.height = nodeHeight;\n // Keep a reference to the nodes so that we can iterate through them later\n attributeNodes.push(attributeNode);\n cumulativeHeight += nodeHeight + heightPadding * 2;\n attrNum += 1;\n });\n\n let widthPaddingFactor = 4;\n if (hasKeyType) {\n widthPaddingFactor += 2;\n }\n if (hasComment) {\n widthPaddingFactor += 2;\n }\n\n const maxWidth = maxTypeWidth + maxNameWidth + maxKeyWidth + maxCommentWidth;\n\n // Calculate the new bounding box of the overall entity, now that attributes have been added\n const bBox = {\n width: Math.max(\n conf.minEntityWidth,\n Math.max(\n labelBBox.width + conf.entityPadding * 2,\n maxWidth + widthPadding * widthPaddingFactor\n )\n ),\n height:\n attributes.length > 0\n ? cumulativeHeight\n : Math.max(conf.minEntityHeight, labelBBox.height + conf.entityPadding * 2),\n };\n\n if (attributes.length > 0) {\n // There might be some spare width for padding out attributes if the entity name is very long\n const spareColumnWidth = Math.max(\n 0,\n (bBox.width - maxWidth - widthPadding * widthPaddingFactor) / (widthPaddingFactor / 2)\n );\n\n // Position the entity label near the top of the entity bounding box\n entityTextNode.attr(\n 'transform',\n 'translate(' + bBox.width / 2 + ',' + (heightPadding + labelBBox.height / 2) + ')'\n );\n\n // Add rectangular boxes for the attribute types/names\n let heightOffset = labelBBox.height + heightPadding * 2; // Start at the bottom of the entity label\n let attribStyle = 'attributeBoxOdd'; // We will flip the style on alternate rows to achieve a banded effect\n\n attributeNodes.forEach((attributeNode) => {\n // Calculate the alignment y coordinate for the type/name of the attribute\n const alignY = heightOffset + heightPadding + attributeNode.height / 2;\n\n // Position the type attribute\n attributeNode.tn.attr('transform', 'translate(' + widthPadding + ',' + alignY + ')');\n\n // TODO Handle spareWidth in attr('width')\n // Insert a rectangle for the type\n const typeRect = groupNode\n .insert('rect', '#' + attributeNode.tn.node().id)\n .classed(`er ${attribStyle}`, true)\n .attr('x', 0)\n .attr('y', heightOffset)\n .attr('width', maxTypeWidth + widthPadding * 2 + spareColumnWidth)\n .attr('height', attributeNode.height + heightPadding * 2);\n\n const nameXOffset = parseFloat(typeRect.attr('x')) + parseFloat(typeRect.attr('width'));\n\n // Position the name attribute\n attributeNode.nn.attr(\n 'transform',\n 'translate(' + (nameXOffset + widthPadding) + ',' + alignY + ')'\n );\n\n // Insert a rectangle for the name\n const nameRect = groupNode\n .insert('rect', '#' + attributeNode.nn.node().id)\n .classed(`er ${attribStyle}`, true)\n .attr('x', nameXOffset)\n .attr('y', heightOffset)\n .attr('width', maxNameWidth + widthPadding * 2 + spareColumnWidth)\n .attr('height', attributeNode.height + heightPadding * 2);\n\n let keyTypeAndCommentXOffset =\n parseFloat(nameRect.attr('x')) + parseFloat(nameRect.attr('width'));\n\n if (hasKeyType) {\n // Position the key type attribute\n attributeNode.kn.attr(\n 'transform',\n 'translate(' + (keyTypeAndCommentXOffset + widthPadding) + ',' + alignY + ')'\n );\n\n // Insert a rectangle for the key type\n const keyTypeRect = groupNode\n .insert('rect', '#' + attributeNode.kn.node().id)\n .classed(`er ${attribStyle}`, true)\n .attr('x', keyTypeAndCommentXOffset)\n .attr('y', heightOffset)\n .attr('width', maxKeyWidth + widthPadding * 2 + spareColumnWidth)\n .attr('height', attributeNode.height + heightPadding * 2);\n\n keyTypeAndCommentXOffset =\n parseFloat(keyTypeRect.attr('x')) + parseFloat(keyTypeRect.attr('width'));\n }\n\n if (hasComment) {\n // Position the comment attribute\n attributeNode.cn.attr(\n 'transform',\n 'translate(' + (keyTypeAndCommentXOffset + widthPadding) + ',' + alignY + ')'\n );\n\n // Insert a rectangle for the comment\n groupNode\n .insert('rect', '#' + attributeNode.cn.node().id)\n .classed(`er ${attribStyle}`, 'true')\n .attr('x', keyTypeAndCommentXOffset)\n .attr('y', heightOffset)\n .attr('width', maxCommentWidth + widthPadding * 2 + spareColumnWidth)\n .attr('height', attributeNode.height + heightPadding * 2);\n }\n\n // Increment the height offset to move to the next row\n heightOffset += attributeNode.height + heightPadding * 2;\n\n // Flip the attribute style for row banding\n attribStyle = attribStyle === 'attributeBoxOdd' ? 'attributeBoxEven' : 'attributeBoxOdd';\n });\n } else {\n // Ensure the entity box is a decent size without any attributes\n bBox.height = Math.max(conf.minEntityHeight, cumulativeHeight);\n\n // Position the entity label in the middle of the box\n entityTextNode.attr('transform', 'translate(' + bBox.width / 2 + ',' + bBox.height / 2 + ')');\n }\n\n return bBox;\n};\n\n/**\n * Use D3 to construct the svg elements for the entities\n *\n * @param svgNode The svg node that contains the diagram\n * @param {Map} entities The entities to be drawn\n * @param graph The graph that contains the vertex and edge definitions post-layout\n * @returns {object} The first entity that was inserted\n */\nconst drawEntities = function (svgNode, entities, graph) {\n const keys = [...entities.keys()];\n let firstOne;\n\n keys.forEach(function (entityName) {\n const entityId = generateId(entityName, 'entity');\n entityNameIds.set(entityName, entityId);\n\n // Create a group for each entity\n const groupNode = svgNode.append('g').attr('id', entityId);\n\n firstOne = firstOne === undefined ? entityId : firstOne;\n\n // Label the entity - this is done first so that we can get the bounding box\n // which then determines the size of the rectangle\n const textId = 'text-' + entityId;\n const textNode = groupNode\n .append('text')\n .classed('er entityLabel', true)\n .attr('id', textId)\n .attr('x', 0)\n .attr('y', 0)\n .style('dominant-baseline', 'middle')\n .style('text-anchor', 'middle')\n .style('font-family', getConfig().fontFamily)\n .style('font-size', conf.fontSize + 'px')\n .text(entities.get(entityName).alias ?? entityName);\n\n const { width: entityWidth, height: entityHeight } = drawAttributes(\n groupNode,\n textNode,\n entities.get(entityName).attributes\n );\n\n // Draw the rectangle - insert it before the text so that the text is not obscured\n const rectNode = groupNode\n .insert('rect', '#' + textId)\n .classed('er entityBox', true)\n .attr('x', 0)\n .attr('y', 0)\n .attr('width', entityWidth)\n .attr('height', entityHeight);\n\n const rectBBox = rectNode.node().getBBox();\n\n // Add the entity to the graph using the entityId\n graph.setNode(entityId, {\n width: rectBBox.width,\n height: rectBBox.height,\n shape: 'rect',\n id: entityId,\n });\n });\n return firstOne;\n}; // drawEntities\n\nconst adjustEntities = function (svgNode, graph) {\n graph.nodes().forEach(function (v) {\n if (v !== undefined && graph.node(v) !== undefined) {\n svgNode\n .select('#' + v)\n .attr(\n 'transform',\n 'translate(' +\n (graph.node(v).x - graph.node(v).width / 2) +\n ',' +\n (graph.node(v).y - graph.node(v).height / 2) +\n ' )'\n );\n }\n });\n};\n\n/**\n * Construct a name for an edge based on the names of the 2 entities and the role (relationship)\n * between them. Remove any spaces from it\n *\n * @param rel - A (parsed) relationship (e.g. one of the objects in the list returned by\n * erDb.getRelationships)\n * @returns {string}\n */\nconst getEdgeName = function (rel) {\n return (rel.entityA + rel.roleA + rel.entityB).replace(/\\s/g, '');\n};\n\n/**\n * Add each relationship to the graph\n *\n * @param relationships The relationships to be added\n * @param g The graph\n * @returns {Array} The array of relationships\n */\nconst addRelationships = function (relationships, g) {\n relationships.forEach(function (r) {\n g.setEdge(\n entityNameIds.get(r.entityA),\n entityNameIds.get(r.entityB),\n { relationship: r },\n getEdgeName(r)\n );\n });\n return relationships;\n}; // addRelationships\n\nlet relCnt = 0;\n/**\n * Draw a relationship using edge information from the graph\n *\n * @param svg The svg node\n * @param rel The relationship to draw in the svg\n * @param g The graph containing the edge information\n * @param insert The insertion point in the svg DOM (because relationships have markers that need to\n * sit 'behind' opaque entity boxes)\n * @param diagObj\n */\nconst drawRelationshipFromLayout = function (svg, rel, g, insert, diagObj) {\n relCnt++;\n\n // Find the edge relating to this relationship\n const edge = g.edge(\n entityNameIds.get(rel.entityA),\n entityNameIds.get(rel.entityB),\n getEdgeName(rel)\n );\n\n // Get a function that will generate the line path\n const lineFunction = line()\n .x(function (d) {\n return d.x;\n })\n .y(function (d) {\n return d.y;\n })\n .curve(curveBasis);\n\n // Insert the line at the right place\n const svgPath = svg\n .insert('path', '#' + insert)\n .classed('er relationshipLine', true)\n .attr('d', lineFunction(edge.points))\n .style('stroke', conf.stroke)\n .style('fill', 'none');\n\n // ...and with dashes if necessary\n if (rel.relSpec.relType === diagObj.db.Identification.NON_IDENTIFYING) {\n svgPath.attr('stroke-dasharray', '8,8');\n }\n\n // TODO: Understand this better\n let url = '';\n if (conf.arrowMarkerAbsolute) {\n url =\n window.location.protocol +\n '//' +\n window.location.host +\n window.location.pathname +\n window.location.search;\n url = url.replace(/\\(/g, '\\\\(');\n url = url.replace(/\\)/g, '\\\\)');\n }\n\n // Decide which start and end markers it needs. It may be possible to be more concise here\n // by reversing a start marker to make an end marker...but this will do for now\n\n // Note that the 'A' entity's marker is at the end of the relationship and the 'B' entity's marker is at the start\n switch (rel.relSpec.cardA) {\n case diagObj.db.Cardinality.ZERO_OR_ONE:\n svgPath.attr('marker-end', 'url(' + url + '#' + erMarkers.ERMarkers.ZERO_OR_ONE_END + ')');\n break;\n case diagObj.db.Cardinality.ZERO_OR_MORE:\n svgPath.attr('marker-end', 'url(' + url + '#' + erMarkers.ERMarkers.ZERO_OR_MORE_END + ')');\n break;\n case diagObj.db.Cardinality.ONE_OR_MORE:\n svgPath.attr('marker-end', 'url(' + url + '#' + erMarkers.ERMarkers.ONE_OR_MORE_END + ')');\n break;\n case diagObj.db.Cardinality.ONLY_ONE:\n svgPath.attr('marker-end', 'url(' + url + '#' + erMarkers.ERMarkers.ONLY_ONE_END + ')');\n break;\n case diagObj.db.Cardinality.MD_PARENT:\n svgPath.attr('marker-end', 'url(' + url + '#' + erMarkers.ERMarkers.MD_PARENT_END + ')');\n break;\n }\n\n switch (rel.relSpec.cardB) {\n case diagObj.db.Cardinality.ZERO_OR_ONE:\n svgPath.attr(\n 'marker-start',\n 'url(' + url + '#' + erMarkers.ERMarkers.ZERO_OR_ONE_START + ')'\n );\n break;\n case diagObj.db.Cardinality.ZERO_OR_MORE:\n svgPath.attr(\n 'marker-start',\n 'url(' + url + '#' + erMarkers.ERMarkers.ZERO_OR_MORE_START + ')'\n );\n break;\n case diagObj.db.Cardinality.ONE_OR_MORE:\n svgPath.attr(\n 'marker-start',\n 'url(' + url + '#' + erMarkers.ERMarkers.ONE_OR_MORE_START + ')'\n );\n break;\n case diagObj.db.Cardinality.ONLY_ONE:\n svgPath.attr('marker-start', 'url(' + url + '#' + erMarkers.ERMarkers.ONLY_ONE_START + ')');\n break;\n case diagObj.db.Cardinality.MD_PARENT:\n svgPath.attr('marker-start', 'url(' + url + '#' + erMarkers.ERMarkers.MD_PARENT_START + ')');\n break;\n }\n\n // Now label the relationship\n\n // Find the half-way point\n const len = svgPath.node().getTotalLength();\n const labelPoint = svgPath.node().getPointAtLength(len * 0.5);\n\n // Append a text node containing the label\n const labelId = 'rel' + relCnt;\n\n const labelText = rel.roleA.split(/ /g);\n\n const labelNode = svg\n .append('text')\n .classed('er relationshipLabel', true)\n .attr('id', labelId)\n .attr('x', labelPoint.x)\n .attr('y', labelPoint.y)\n .style('text-anchor', 'middle')\n .style('dominant-baseline', 'middle')\n .style('font-family', getConfig().fontFamily)\n .style('font-size', conf.fontSize + 'px');\n\n if (labelText.length == 1) {\n labelNode.text(rel.roleA);\n } else {\n const firstShift = -(labelText.length - 1) * 0.5;\n labelText.forEach((txt, i) => {\n labelNode\n .append('tspan')\n .attr('x', labelPoint.x)\n .attr('dy', `${i === 0 ? firstShift : 1}em`)\n .text(txt);\n });\n }\n\n // Figure out how big the opaque 'container' rectangle needs to be\n const labelBBox = labelNode.node().getBBox();\n\n // Insert the opaque rectangle before the text label\n svg\n .insert('rect', '#' + labelId)\n .classed('er relationshipLabelBox', true)\n .attr('x', labelPoint.x - labelBBox.width / 2)\n .attr('y', labelPoint.y - labelBBox.height / 2)\n .attr('width', labelBBox.width)\n .attr('height', labelBBox.height);\n};\n\n/**\n * Draw en E-R diagram in the tag with id: id based on the text definition of the diagram\n *\n * @param text The text of the diagram\n * @param id The unique id of the DOM node that contains the diagram\n * @param _version\n * @param diagObj\n */\nexport const draw = function (text, id, _version, diagObj) {\n conf = getConfig().er;\n log.info('Drawing ER diagram');\n const securityLevel = getConfig().securityLevel;\n // Handle root and Document for when rendering in sandbox mode\n let sandboxElement;\n if (securityLevel === 'sandbox') {\n sandboxElement = select('#i' + id);\n }\n const root =\n securityLevel === 'sandbox'\n ? select(sandboxElement.nodes()[0].contentDocument.body)\n : select('body');\n // const doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document;\n\n // Get a reference to the svg node that contains the text\n const svg = root.select(`[id='${id}']`);\n\n // Add cardinality marker definitions to the svg\n erMarkers.insertMarkers(svg, conf);\n\n // Now we have to construct the diagram in a specific way:\n // ---\n // 1. Create all the entities in the svg node at 0,0, but with the correct dimensions (allowing for text content)\n // 2. Make sure they are all added to the graph\n // 3. Add all the edges (relationships) to the graph as well\n // 4. Let dagre do its magic to lay out the graph. This assigns:\n // - the centre coordinates for each node, bearing in mind the dimensions and edge relationships\n // - the path coordinates for each edge\n // But it has no impact on the svg child nodes - the diagram remains with every entity rooted at 0,0\n // 5. Now assign a transform to each entity in the svg node so that it gets drawn in the correct place, as determined by\n // its centre point, which is obtained from the graph, and it's width and height\n // 6. And finally, create all the edges in the svg node using information from the graph\n // ---\n\n // Create the graph\n let g;\n\n // TODO: Explore directed vs undirected graphs, and how the layout is affected\n // An E-R diagram could be said to be undirected, but there is merit in setting\n // the direction from parent to child in a one-to-many as this influences graphlib to\n // put the parent above the child (does it?), which is intuitive. Most relationships\n // in ER diagrams are one-to-many.\n g = new graphlib.Graph({\n multigraph: true,\n directed: true,\n compound: false,\n })\n .setGraph({\n rankdir: conf.layoutDirection,\n marginx: 20,\n marginy: 20,\n nodesep: 100,\n edgesep: 100,\n ranksep: 100,\n })\n .setDefaultEdgeLabel(function () {\n return {};\n });\n\n // Draw the entities (at 0,0), returning the first svg node that got\n // inserted - this represents the insertion point for relationship paths\n const firstEntity = drawEntities(svg, diagObj.db.getEntities(), g);\n\n // TODO: externalize the addition of entities to the graph - it's a bit 'buried' in the above\n\n // Add all the relationships to the graph\n const relationships = addRelationships(diagObj.db.getRelationships(), g);\n\n dagreLayout(g); // Node and edge positions will be updated\n\n // Adjust the positions of the entities so that they adhere to the layout\n adjustEntities(svg, g);\n\n // Draw the relationships\n relationships.forEach(function (rel) {\n drawRelationshipFromLayout(svg, rel, g, firstEntity, diagObj);\n });\n\n const padding = conf.diagramPadding;\n\n utils.insertTitle(svg, 'entityTitleText', conf.titleTopMargin, diagObj.db.getDiagramTitle());\n\n const svgBounds = svg.node().getBBox();\n const width = svgBounds.width + padding * 2;\n const height = svgBounds.height + padding * 2;\n\n configureSvgSize(svg, height, width, conf.useMaxWidth);\n\n svg.attr('viewBox', `${svgBounds.x - padding} ${svgBounds.y - padding} ${width} ${height}`);\n}; // draw\n\n/**\n * UUID namespace for ER diagram IDs\n *\n * This can be generated via running:\n *\n * ```js\n * const { v5: uuid5 } = await import('uuid');\n * uuid5(\n * 'https://mermaid-js.github.io/mermaid/syntax/entityRelationshipDiagram.html',\n * uuid5.URL\n * );\n * ```\n */\nconst MERMAID_ERDIAGRAM_UUID = '28e9f9db-3c8d-5aa5-9faf-44286ae5937c';\n\n/**\n * Return a unique id based on the given string. Start with the prefix, then a hyphen, then the\n * simplified str, then a hyphen, then a unique uuid based on the str. (Hyphens are only included if needed.)\n * Although the official XML standard for ids says that many more characters are valid in the id,\n * this keeps things simple by accepting only A-Za-z0-9.\n *\n * @param {string} str Given string to use as the basis for the id. Default is `''`\n * @param {string} prefix String to put at the start, followed by '-'. Default is `''`\n * @returns {string}\n * @see https://www.w3.org/TR/xml/#NT-Name\n */\nexport function generateId(str = '', prefix = '') {\n const simplifiedStr = str.replace(BAD_ID_CHARS_REGEXP, '');\n // we use `uuid v5` so that UUIDs are consistent given a string.\n return `${strWithHyphen(prefix)}${strWithHyphen(simplifiedStr)}${uuid5(\n str,\n MERMAID_ERDIAGRAM_UUID\n )}`;\n}\n\n/**\n * Append a hyphen to a string only if the string isn't empty\n *\n * @param {string} str\n * @returns {string}\n * @todo This could be moved into a string utility file/class.\n */\nfunction strWithHyphen(str = '') {\n return str.length > 0 ? `${str}-` : '';\n}\n\nexport default {\n setConf,\n draw,\n};\n", "const getStyles = (options) =>\n `\n .entityBox {\n fill: ${options.mainBkg};\n stroke: ${options.nodeBorder};\n }\n\n .attributeBoxOdd {\n fill: ${options.attributeBackgroundColorOdd};\n stroke: ${options.nodeBorder};\n }\n\n .attributeBoxEven {\n fill: ${options.attributeBackgroundColorEven};\n stroke: ${options.nodeBorder};\n }\n\n .relationshipLabelBox {\n fill: ${options.tertiaryColor};\n opacity: 0.7;\n background-color: ${options.tertiaryColor};\n rect {\n opacity: 0.5;\n }\n }\n\n .relationshipLine {\n stroke: ${options.lineColor};\n }\n\n .entityTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${options.textColor};\n } \n #MD_PARENT_START {\n fill: #f5f5f5 !important;\n stroke: ${options.lineColor} !important;\n stroke-width: 1;\n }\n #MD_PARENT_END {\n fill: #f5f5f5 !important;\n stroke: ${options.lineColor} !important;\n stroke-width: 1;\n }\n \n`;\n\nexport default getStyles;\n", "// @ts-ignore: TODO: Fix ts errors\nimport erParser from './parser/erDiagram.jison';\nimport erDb from './erDb.js';\nimport erRenderer from './erRenderer.js';\nimport erStyles from './styles.js';\n\nexport const diagram = {\n parser: erParser,\n db: erDb,\n renderer: erRenderer,\n styles: erStyles,\n};\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { TokenType } from 'chevrotain';\nimport type { URI } from './utils/uri-utils.js';\nimport type { AbstractElement } from './languages/generated/ast.js';\nimport type { DocumentSegment, LangiumDocument } from './workspace/documents.js';\n\n/**\n * A node in the Abstract Syntax Tree (AST).\n */\nexport interface AstNode {\n /** Every AST node has a type corresponding to what was specified in the grammar declaration. */\n readonly $type: string;\n /** The container node in the AST; every node except the root node has a container. */\n readonly $container?: AstNode;\n /** The property of the `$container` node that contains this node. This is either a direct reference or an array. */\n readonly $containerProperty?: string;\n /** In case `$containerProperty` is an array, the array index is stored here. */\n readonly $containerIndex?: number;\n /** The Concrete Syntax Tree (CST) node of the text range from which this node was parsed. */\n readonly $cstNode?: CstNode;\n /** The document containing the AST; only the root node has a direct reference to the document. */\n readonly $document?: LangiumDocument;\n}\n\nexport function isAstNode(obj: unknown): obj is AstNode {\n return typeof obj === 'object' && obj !== null && typeof (obj as AstNode).$type === 'string';\n}\n\nexport interface GenericAstNode extends AstNode {\n [key: string]: unknown\n}\n\ntype SpecificNodeProperties = keyof Omit;\n\n/**\n * The property names of a given AST node type.\n */\nexport type Properties = SpecificNodeProperties extends never ? string : SpecificNodeProperties\n\n/**\n * A cross-reference in the AST. Cross-references may or may not be successfully resolved.\n */\nexport interface Reference {\n /**\n * The target AST node of this reference. Accessing this property may trigger cross-reference\n * resolution by the `Linker` in case it has not been done yet. If the reference cannot be resolved,\n * the value is `undefined`.\n */\n readonly ref?: T;\n\n /** If any problem occurred while resolving the reference, it is described by this property. */\n readonly error?: LinkingError;\n /** The CST node from which the reference was parsed */\n readonly $refNode?: CstNode;\n /** The actual text used to look up in the surrounding scope */\n readonly $refText: string;\n /** The node description for the AstNode returned by `ref` */\n readonly $nodeDescription?: AstNodeDescription;\n}\n\nexport function isReference(obj: unknown): obj is Reference {\n return typeof obj === 'object' && obj !== null && typeof (obj as Reference).$refText === 'string';\n}\n\nexport type ResolvedReference = Reference & {\n readonly ref: T;\n}\n\n/**\n * A description of an AST node is used when constructing scopes and looking up cross-reference targets.\n */\nexport interface AstNodeDescription {\n /** The target node; should be present only for local references (linking to the same document). */\n node?: AstNode;\n /**\n * The document segment that represents the range of the name of the AST node.\n */\n nameSegment?: DocumentSegment;\n /**\n * The document segment that represents the full range of the AST node.\n */\n selectionSegment?: DocumentSegment;\n /** `$type` property value of the AST node */\n type: string;\n /** Name of the AST node; this is usually determined by the `NameProvider` service. */\n name: string;\n /** URI to the document containing the AST node */\n documentUri: URI;\n /** Navigation path inside the document */\n path: string;\n}\n\nexport function isAstNodeDescription(obj: unknown): obj is AstNodeDescription {\n return typeof obj === 'object' && obj !== null\n && typeof (obj as AstNodeDescription).name === 'string'\n && typeof (obj as AstNodeDescription).type === 'string'\n && typeof (obj as AstNodeDescription).path === 'string';\n}\n\n/**\n * Information about a cross-reference. This is used when traversing references in an AST or to describe\n * unresolved references.\n */\nexport interface ReferenceInfo {\n reference: Reference\n container: AstNode\n property: string\n index?: number\n}\n\n/**\n * Used to collect information when the `Linker` service fails to resolve a cross-reference.\n */\nexport interface LinkingError extends ReferenceInfo {\n message: string;\n targetDescription?: AstNodeDescription;\n}\n\nexport function isLinkingError(obj: unknown): obj is LinkingError {\n return typeof obj === 'object' && obj !== null\n && isAstNode((obj as LinkingError).container)\n && isReference((obj as LinkingError).reference)\n && typeof (obj as LinkingError).message === 'string';\n}\n\n/**\n * Service used for generic access to the structure of the AST. This service is shared between\n * all involved languages, so it operates on the superset of types of these languages.\n */\nexport interface AstReflection {\n getAllTypes(): string[]\n getAllSubTypes(type: string): string[]\n getReferenceType(refInfo: ReferenceInfo): string\n getTypeMetaData(type: string): TypeMetaData\n isInstance(node: unknown, type: string): boolean\n isSubtype(subtype: string, supertype: string): boolean\n}\n\n/**\n * An abstract implementation of the {@link AstReflection} interface.\n * Serves to cache subtype computation results to improve performance throughout different parts of Langium.\n */\nexport abstract class AbstractAstReflection implements AstReflection {\n\n protected subtypes: Record> = {};\n protected allSubtypes: Record = {};\n\n abstract getAllTypes(): string[];\n abstract getReferenceType(refInfo: ReferenceInfo): string;\n abstract getTypeMetaData(type: string): TypeMetaData;\n protected abstract computeIsSubtype(subtype: string, supertype: string): boolean;\n\n isInstance(node: unknown, type: string): boolean {\n return isAstNode(node) && this.isSubtype(node.$type, type);\n }\n\n isSubtype(subtype: string, supertype: string): boolean {\n if (subtype === supertype) {\n return true;\n }\n let nested = this.subtypes[subtype];\n if (!nested) {\n nested = this.subtypes[subtype] = {};\n }\n const existing = nested[supertype];\n if (existing !== undefined) {\n return existing;\n } else {\n const result = this.computeIsSubtype(subtype, supertype);\n nested[supertype] = result;\n return result;\n }\n }\n\n getAllSubTypes(type: string): string[] {\n const existing = this.allSubtypes[type];\n if (existing) {\n return existing;\n } else {\n const allTypes = this.getAllTypes();\n const types: string[] = [];\n for (const possibleSubType of allTypes) {\n if (this.isSubtype(possibleSubType, type)) {\n types.push(possibleSubType);\n }\n }\n this.allSubtypes[type] = types;\n return types;\n }\n }\n}\n\n/**\n * Represents runtime meta data about a meta model type.\n */\nexport interface TypeMetaData {\n /** The name of this meta model type. Corresponds to the `AstNode.$type` value. */\n name: string\n /** A list of properties. They can contain default values for their respective property in the AST. */\n properties: TypeProperty[]\n}\n\n/**\n * Describes the meta data of a property of an AST node.\n *\n * The optional `defaultValue` indicates that the property is mandatory in the AST node.\n * For example, if an AST node contains an array, but no elements of this array have been parsed, we still expect an empty array instead of `undefined`.\n */\nexport interface TypeProperty {\n name: string\n defaultValue?: PropertyType\n}\n\n/**\n * Represents a default value for an AST property.\n */\nexport type PropertyType = number | string | boolean | PropertyType[];\n\n/**\n * A node in the Concrete Syntax Tree (CST).\n */\nexport interface CstNode extends DocumentSegment {\n /** The container node in the CST */\n readonly container?: CompositeCstNode;\n /** @deprecated use `container` instead. */\n readonly parent?: CompositeCstNode;\n /** The actual text */\n readonly text: string;\n /** The root CST node */\n readonly root: RootCstNode;\n /** The grammar element from which this node was parsed */\n readonly grammarSource: AbstractElement;\n /** @deprecated use `grammarSource` instead. */\n readonly feature: AbstractElement;\n /** The AST node created from this CST node */\n readonly astNode: AstNode;\n /** @deprecated use `astNode` instead. */\n readonly element: AstNode;\n /** Whether the token is hidden, i.e. not explicitly part of the containing grammar rule */\n readonly hidden: boolean;\n}\n\n/**\n * A composite CST node contains other nodes, but no directly associated token.\n */\nexport interface CompositeCstNode extends CstNode {\n readonly content: CstNode[];\n /** @deprecated use `content` instead. */\n readonly children: CstNode[];\n}\n\nexport function isCompositeCstNode(node: unknown): node is CompositeCstNode {\n return typeof node === 'object' && node !== null && Array.isArray((node as CompositeCstNode).content);\n}\n\n/**\n * A leaf CST node corresponds to a token in the input token stream.\n */\nexport interface LeafCstNode extends CstNode {\n readonly tokenType: TokenType;\n}\n\nexport function isLeafCstNode(node: unknown): node is LeafCstNode {\n return typeof node === 'object' && node !== null && typeof (node as LeafCstNode).tokenType === 'object';\n}\n\nexport interface RootCstNode extends CompositeCstNode {\n readonly fullText: string\n}\n\nexport function isRootCstNode(node: unknown): node is RootCstNode {\n return isCompositeCstNode(node) && typeof (node as RootCstNode).fullText === 'string';\n}\n\n/**\n * Returns a type to have only properties names (!) of a type T whose property value is of a certain type K.\n */\ntype ExtractKeysOfValueType = { [I in keyof T]: T[I] extends K ? I : never }[keyof T];\n\n/**\n * Returns the property names (!) of an AstNode that are cross-references.\n * Meant to be used during cross-reference resolution in combination with `assertUnreachable(context.property)`.\n */\nexport type CrossReferencesOfAstNodeType = (\n ExtractKeysOfValueType\n | ExtractKeysOfValueType|undefined>\n// eslint-disable-next-line @typescript-eslint/ban-types\n) & {};\n\n/**\n * Represents the enumeration-like type, that lists all AstNode types of your grammar.\n */\nexport type AstTypeList = Record;\n\n/**\n * Returns all types that contain cross-references, A is meant to be the interface `XXXAstType` fromm your generated `ast.ts` file.\n * Meant to be used during cross-reference resolution in combination with `assertUnreachable(context.container)`.\n */\nexport type AstNodeTypesWithCrossReferences> = {\n [T in keyof A]: CrossReferencesOfAstNodeType extends never ? never : A[T]\n}[keyof A];\n\nexport type Mutable = {\n -readonly [P in keyof T]: T[P]\n};\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\n/**\n * A stream is a read-only sequence of values. While the contents of an array can be accessed\n * both sequentially and randomly (via index), a stream allows only sequential access.\n *\n * The advantage of this is that a stream can be evaluated lazily, so it does not require\n * to store intermediate values. This can boost performance when a large sequence is\n * processed via filtering, mapping etc. and accessed at most once. However, lazy\n * evaluation means that all processing is repeated when you access the sequence multiple\n * times; in such a case, it may be better to store the resulting sequence into an array.\n */\nexport interface Stream extends Iterable {\n\n /**\n * Returns an iterator for this stream. This is the same as calling the `Symbol.iterator` function property.\n */\n iterator(): IterableIterator;\n\n /**\n * Determines whether this stream contains no elements.\n */\n isEmpty(): boolean;\n\n /**\n * Determines the number of elements in this stream.\n */\n count(): number;\n\n /**\n * Collects all elements of this stream into an array.\n */\n toArray(): T[];\n\n /**\n * Collects all elements of this stream into a Set.\n */\n toSet(): Set;\n\n /**\n * Collects all elements of this stream into a Map, applying the provided functions to determine keys and values.\n *\n * @param keyFn The function to derive map keys. If omitted, the stream elements are used as keys.\n * @param valueFn The function to derive map values. If omitted, the stream elements are used as values.\n */\n toMap(keyFn?: (e: T) => K, valueFn?: (e: T) => V): Map;\n\n /**\n * Returns a string representation of a stream.\n */\n toString(): string;\n\n /**\n * Combines two streams by returning a new stream that yields all elements of this stream and the other stream.\n *\n * @param other Stream to be concatenated with this one.\n */\n concat(other: Iterable): Stream;\n\n /**\n * Adds all elements of the stream into a string, separated by the specified separator string.\n *\n * @param separator A string used to separate one element of the stream from the next in the resulting string.\n * If omitted, the steam elements are separated with a comma.\n */\n join(separator?: string): string\n\n /**\n * Returns the index of the first occurrence of a value in the stream, or -1 if it is not present.\n *\n * @param searchElement The value to locate in the array.\n * @param fromIndex The stream index at which to begin the search. If fromIndex is omitted, the search\n * starts at index 0.\n */\n indexOf(searchElement: T, fromIndex?: number): number;\n\n /**\n * Determines whether all members of the stream satisfy the specified test.\n *\n * @param predicate This method calls the predicate function for each element in the stream until the\n * predicate returns a value which is coercible to the Boolean value `false`, or until the end\n * of the stream.\n */\n every(predicate: (value: T) => value is S): this is Stream;\n every(predicate: (value: T) => unknown): boolean;\n\n /**\n * Determines whether any member of the stream satisfies the specified test.\n *\n * @param predicate This method calls the predicate function for each element in the stream until the\n * predicate returns a value which is coercible to the Boolean value `true`, or until the end\n * of the stream.\n */\n some(predicate: (value: T) => unknown): boolean;\n\n /**\n * Performs the specified action for each element in the stream.\n *\n * @param callbackfn Function called once for each element in the stream.\n */\n forEach(callbackfn: (value: T, index: number) => void): void;\n\n /**\n * Returns a stream that yields the results of calling the specified callback function on each element\n * of the stream. The function is called when the resulting stream elements are actually accessed, so\n * accessing the resulting stream multiple times means the function is also called multiple times for\n * each element of the stream.\n *\n * @param callbackfn Lazily evaluated function mapping stream elements.\n */\n map(callbackfn: (value: T) => U): Stream;\n\n /**\n * Returns the elements of the stream that meet the condition specified in a callback function.\n * The function is called when the resulting stream elements are actually accessed, so accessing the\n * resulting stream multiple times means the function is also called multiple times for each element\n * of the stream.\n *\n * @param predicate Lazily evaluated function checking a condition on stream elements.\n */\n filter(predicate: (value: T) => value is S): Stream;\n filter(predicate: (value: T) => unknown): Stream;\n\n /**\n * Returns the elements of the stream that are _non-nullable_, which means they are neither `undefined`\n * nor `null`.\n */\n nonNullable(): Stream>;\n\n /**\n * Calls the specified callback function for all elements in the stream. The return value of the\n * callback function is the accumulated result, and is provided as an argument in the next call to\n * the callback function.\n *\n * @param callbackfn This method calls the function once for each element in the stream, providing\n * the previous and current values of the reduction.\n * @param initialValue If specified, `initialValue` is used as the initial value to start the\n * accumulation. The first call to the function provides this value as an argument instead\n * of a stream value.\n */\n reduce(callbackfn: (previousValue: T, currentValue: T) => T): T | undefined;\n reduce(callbackfn: (previousValue: U, currentValue: T) => U, initialValue: U): U;\n\n /**\n * Calls the specified callback function for all elements in the stream, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n *\n * @param callbackfn This method calls the function once for each element in the stream, providing\n * the previous and current values of the reduction.\n * @param initialValue If specified, `initialValue` is used as the initial value to start the\n * accumulation. The first call to the function provides this value as an argument instead\n * of an array value.\n */\n reduceRight(callbackfn: (previousValue: T, currentValue: T) => T): T | undefined;\n reduceRight(callbackfn: (previousValue: U, currentValue: T) => U, initialValue: U): U;\n\n /**\n * Returns the value of the first element in the stream that meets the condition, or `undefined`\n * if there is no such element.\n *\n * @param predicate This method calls `predicate` once for each element of the stream, in ascending\n * order, until it finds one where `predicate` returns a value which is coercible to the\n * Boolean value `true`.\n */\n find(predicate: (value: T) => value is S): S | undefined;\n find(predicate: (value: T) => unknown): T | undefined;\n\n /**\n * Returns the index of the first element in the stream that meets the condition, or `-1`\n * if there is no such element.\n *\n * @param predicate This method calls `predicate` once for each element of the stream, in ascending\n * order, until it finds one where `predicate` returns a value which is coercible to the\n * Boolean value `true`.\n */\n findIndex(predicate: (value: T) => unknown): number;\n\n /**\n * Determines whether the stream includes a certain element, returning `true` or `false` as appropriate.\n *\n * @param searchElement The element to search for.\n */\n includes(searchElement: T): boolean;\n\n /**\n * Calls a defined callback function on each element of the stream and then flattens the result into\n * a new stream. This is identical to a `map` followed by `flat` with depth 1.\n *\n * @param callbackfn Lazily evaluated function mapping stream elements.\n */\n flatMap(callbackfn: (value: T) => U | Iterable): Stream;\n\n /**\n * Returns a new stream with all sub-stream or sub-array elements concatenated into it recursively up\n * to the specified depth.\n *\n * @param depth The maximum recursion depth. Defaults to 1.\n */\n flat(depth?: D): FlatStream;\n\n /**\n * Returns the first element in the stream, or `undefined` if the stream is empty.\n */\n head(): T | undefined;\n\n /**\n * Returns a stream that skips the first `skipCount` elements from this stream.\n *\n * @param skipCount The number of elements to skip. If this is larger than the number of elements in\n * the stream, an empty stream is returned. Defaults to 1.\n */\n tail(skipCount?: number): Stream;\n\n /**\n * Returns a stream consisting of the elements of this stream, truncated to be no longer than `maxSize`\n * in length.\n *\n * @param maxSize The number of elements the stream should be limited to\n */\n limit(maxSize: number): Stream;\n\n /**\n * Returns a stream containing only the distinct elements from this stream.\n * Equality is determined with the same rules as a standard `Set`.\n *\n * @param by A function returning the key used to check equality with a previous stream element.\n * If omitted, the stream elements themselves are used for comparison.\n */\n distinct(by?: (element: T) => Key): Stream;\n\n /**\n * Returns a stream that contains all elements that don't exist in the {@link other} iterable.\n * Equality is determined with the same rules as a standard `Set`.\n * @param other The elements that should be exluded from this stream.\n * @param key A function returning the key used to check quality.\n * If omitted, the stream elements themselves are used for comparison.\n */\n exclude(other: Iterable, key?: (element: T) => Key): Stream;\n\n}\n\nexport type FlatStream = {\n 'done': Stream,\n 'recur': T extends Iterable\n ? FlatStream>\n : Stream\n}[Depth extends 0 ? 'done' : 'recur'];\n\nexport type MinusOne = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][N];\n\n/**\n * The default implementation of `Stream` works with two input functions:\n * - The first function creates the initial state of an iteration.\n * - The second function gets the current state as argument and returns an `IteratorResult`.\n */\nexport class StreamImpl implements Stream {\n protected readonly startFn: () => S;\n protected readonly nextFn: (state: S) => IteratorResult;\n\n constructor(startFn: () => S, nextFn: (state: S) => IteratorResult) {\n this.startFn = startFn;\n this.nextFn = nextFn;\n }\n\n iterator(): IterableIterator {\n const iterator = {\n state: this.startFn(),\n next: () => this.nextFn(iterator.state),\n [Symbol.iterator]: () => iterator\n };\n return iterator;\n }\n\n [Symbol.iterator](): Iterator {\n return this.iterator();\n }\n\n isEmpty(): boolean {\n const iterator = this.iterator();\n return Boolean(iterator.next().done);\n }\n\n count(): number {\n const iterator = this.iterator();\n let count = 0;\n let next = iterator.next();\n while (!next.done) {\n count++;\n next = iterator.next();\n }\n return count;\n }\n\n toArray(): T[] {\n const result: T[] = [];\n const iterator = this.iterator();\n let next: IteratorResult;\n do {\n next = iterator.next();\n if (next.value !== undefined) {\n result.push(next.value);\n }\n } while (!next.done);\n return result;\n }\n\n toSet(): Set {\n return new Set(this);\n }\n\n toMap(keyFn?: (e: T) => K, valueFn?: (e: T) => V): Map {\n const entryStream = this.map(element => <[K, V]>[\n keyFn ? keyFn(element) : element,\n valueFn ? valueFn(element) : element\n ]);\n return new Map(entryStream);\n }\n\n toString(): string {\n return this.join();\n }\n\n concat(other: Iterable): Stream {\n const iterator = other[Symbol.iterator]();\n return new StreamImpl<{ first: S, firstDone: boolean }, T | T2>(\n () => ({ first: this.startFn(), firstDone: false }),\n state => {\n let result: IteratorResult;\n if (!state.firstDone) {\n do {\n result = this.nextFn(state.first);\n if (!result.done) {\n return result;\n }\n } while (!result.done);\n state.firstDone = true;\n }\n do {\n result = iterator.next();\n if (!result.done) {\n return result;\n }\n } while (!result.done);\n return DONE_RESULT;\n }\n );\n }\n\n join(separator = ','): string {\n const iterator = this.iterator();\n let value = '';\n let result: IteratorResult;\n let addSeparator = false;\n do {\n result = iterator.next();\n if (!result.done) {\n if (addSeparator) {\n value += separator;\n }\n value += toString(result.value);\n }\n addSeparator = true;\n } while (!result.done);\n return value;\n }\n\n indexOf(searchElement: T, fromIndex = 0): number {\n const iterator = this.iterator();\n let index = 0;\n let next = iterator.next();\n while (!next.done) {\n if (index >= fromIndex && next.value === searchElement) {\n return index;\n }\n next = iterator.next();\n index++;\n }\n return -1;\n }\n\n // In the following definition the '& this' part in the return type is important\n // _and_ the order within 'Stream & this' is crucial!\n // Otherwise Typescript would infer the type of 'this' as 'StreamImpl & Stream'\n // (or ' & Stream') and usages like\n // ```\n // const stream = new StreamImpl(...);\n // ... stream.every() & stream....\n // ```\n // cannot benefit from '', as Typescript would priorize the signatures\n // of 'StreamImpl' (i.e. those of 'Stream') over those of 'Stream'.\n // With the order of 'Stream & this' the signatures of 'Stream' get precedence.\n every(predicate: (value: T) => value is U): this is Stream & this;\n every(predicate: (value: T) => unknown): boolean;\n every(predicate: (value: T) => unknown): boolean {\n const iterator = this.iterator();\n let next = iterator.next();\n while (!next.done) {\n if (!predicate(next.value)) {\n return false;\n }\n next = iterator.next();\n }\n return true;\n }\n\n some(predicate: (value: T) => unknown): boolean {\n const iterator = this.iterator();\n let next = iterator.next();\n while (!next.done) {\n if (predicate(next.value)) {\n return true;\n }\n next = iterator.next();\n }\n return false;\n }\n\n forEach(callbackfn: (value: T, index: number) => void): void {\n const iterator = this.iterator();\n let index = 0;\n let next = iterator.next();\n while (!next.done) {\n callbackfn(next.value, index);\n next = iterator.next();\n index++;\n }\n }\n\n map(callbackfn: (value: T) => U): Stream {\n return new StreamImpl(\n this.startFn,\n (state) => {\n const { done, value } = this.nextFn(state);\n if (done) {\n return DONE_RESULT;\n } else {\n return { done: false, value: callbackfn(value) };\n }\n }\n );\n }\n\n // for remarks on the return type definition refer to 'every(...)'\n filter(predicate: (value: T) => value is U): Stream & this;\n filter(predicate: (value: T) => unknown): Stream & this;\n filter(predicate: (value: T) => unknown): Stream {\n return new StreamImpl(\n this.startFn,\n state => {\n let result: IteratorResult;\n do {\n result = this.nextFn(state);\n if (!result.done && predicate(result.value)) {\n return result;\n }\n } while (!result.done);\n return DONE_RESULT;\n }\n );\n }\n\n nonNullable(): Stream> {\n return this.filter(e => e !== undefined && e !== null) as Stream>;\n }\n\n reduce(callbackfn: (previousValue: T, currentValue: T) => T): T | undefined;\n reduce