oasis-editor 0.0.21 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2438,7 +2438,7 @@ function OasisEditorAppLazy(props = {}) {
2438
2438
  onCleanup(() => {
2439
2439
  cancelled = true;
2440
2440
  });
2441
- import("./OasisEditorApp-D-O4XHvu.js").then((m) => {
2441
+ import("./OasisEditorApp-BD3WQQO5.js").then((m) => {
2442
2442
  cancelled = true;
2443
2443
  setProgress(1);
2444
2444
  setTimeout(() => setApp(() => m.OasisEditorApp), 180);
@@ -14805,52 +14805,199 @@ function drawTable(ctx, table, tableSegment, state, originX, originY, contentWid
14805
14805
  });
14806
14806
  }
14807
14807
  }
14808
- const KAPPA = 0.5522847498307936;
14809
- function getPresetPathSegments(preset, x, y, width, height) {
14810
- const right = x + width;
14811
- const bottom = y + height;
14812
- const cx = x + width / 2;
14813
- const cy = y + height / 2;
14814
- switch (preset) {
14815
- case "roundRect":
14816
- return roundRectSegments(
14817
- x,
14818
- y,
14819
- width,
14820
- height,
14821
- Math.min(width, height) * 0.1
14822
- );
14823
- case "ellipse":
14824
- return ellipseSegments(cx, cy, width / 2, height / 2);
14825
- case "triangle":
14826
- return polygon([
14827
- [cx, y],
14828
- [right, bottom],
14829
- [x, bottom]
14830
- ]);
14831
- case "rtTriangle":
14832
- return polygon([
14833
- [x, y],
14834
- [x, bottom],
14835
- [right, bottom]
14836
- ]);
14837
- case "diamond":
14838
- return polygon([
14839
- [cx, y],
14840
- [right, cy],
14841
- [cx, bottom],
14842
- [x, cy]
14843
- ]);
14844
- case "rect":
14845
- default:
14846
- return polygon([
14847
- [x, y],
14848
- [right, y],
14849
- [right, bottom],
14850
- [x, bottom]
14851
- ]);
14852
- }
14808
+ const SUPPORTED_PRESET_GEOMETRIES = /* @__PURE__ */ new Set([
14809
+ "accentBorderCallout1",
14810
+ "accentBorderCallout2",
14811
+ "accentBorderCallout3",
14812
+ "accentCallout1",
14813
+ "accentCallout2",
14814
+ "accentCallout3",
14815
+ "actionButtonBackPrevious",
14816
+ "actionButtonBeginning",
14817
+ "actionButtonBlank",
14818
+ "actionButtonDocument",
14819
+ "actionButtonEnd",
14820
+ "actionButtonForwardNext",
14821
+ "actionButtonHelp",
14822
+ "actionButtonHome",
14823
+ "actionButtonInformation",
14824
+ "actionButtonMovie",
14825
+ "actionButtonReturn",
14826
+ "actionButtonSound",
14827
+ "arc",
14828
+ "bentArrow",
14829
+ "bentConnector2",
14830
+ "bentConnector3",
14831
+ "bentConnector4",
14832
+ "bentConnector5",
14833
+ "bentUpArrow",
14834
+ "bevel",
14835
+ "blockArc",
14836
+ "borderCallout1",
14837
+ "borderCallout2",
14838
+ "borderCallout3",
14839
+ "bracePair",
14840
+ "bracketPair",
14841
+ "callout1",
14842
+ "callout2",
14843
+ "callout3",
14844
+ "can",
14845
+ "chartPlus",
14846
+ "chartStar",
14847
+ "chartX",
14848
+ "chevron",
14849
+ "chord",
14850
+ "circularArrow",
14851
+ "cloud",
14852
+ "cloudCallout",
14853
+ "corner",
14854
+ "cornerTabs",
14855
+ "cube",
14856
+ "curvedConnector2",
14857
+ "curvedConnector3",
14858
+ "curvedConnector4",
14859
+ "curvedConnector5",
14860
+ "curvedDownArrow",
14861
+ "curvedLeftArrow",
14862
+ "curvedRightArrow",
14863
+ "curvedUpArrow",
14864
+ "decagon",
14865
+ "diagStripe",
14866
+ "diamond",
14867
+ "dodecagon",
14868
+ "donut",
14869
+ "doubleWave",
14870
+ "downArrow",
14871
+ "downArrowCallout",
14872
+ "ellipse",
14873
+ "ellipseRibbon",
14874
+ "ellipseRibbon2",
14875
+ "flowChartAlternateProcess",
14876
+ "flowChartCollate",
14877
+ "flowChartConnector",
14878
+ "flowChartDecision",
14879
+ "flowChartDelay",
14880
+ "flowChartDisplay",
14881
+ "flowChartDocument",
14882
+ "flowChartExtract",
14883
+ "flowChartInputOutput",
14884
+ "flowChartInternalStorage",
14885
+ "flowChartMagneticDisk",
14886
+ "flowChartMagneticDrum",
14887
+ "flowChartMagneticTape",
14888
+ "flowChartManualInput",
14889
+ "flowChartManualOperation",
14890
+ "flowChartMerge",
14891
+ "flowChartMultidocument",
14892
+ "flowChartOfflineStorage",
14893
+ "flowChartOffpageConnector",
14894
+ "flowChartOnlineStorage",
14895
+ "flowChartOr",
14896
+ "flowChartPredefinedProcess",
14897
+ "flowChartPreparation",
14898
+ "flowChartProcess",
14899
+ "flowChartPunchedCard",
14900
+ "flowChartPunchedTape",
14901
+ "flowChartSort",
14902
+ "flowChartSummingJunction",
14903
+ "flowChartTerminator",
14904
+ "foldedCorner",
14905
+ "frame",
14906
+ "funnel",
14907
+ "gear6",
14908
+ "gear9",
14909
+ "halfFrame",
14910
+ "heart",
14911
+ "heptagon",
14912
+ "hexagon",
14913
+ "homePlate",
14914
+ "horizontalScroll",
14915
+ "irregularSeal1",
14916
+ "irregularSeal2",
14917
+ "leftArrow",
14918
+ "leftArrowCallout",
14919
+ "leftBrace",
14920
+ "leftBracket",
14921
+ "leftCircularArrow",
14922
+ "leftRightArrow",
14923
+ "leftRightArrowCallout",
14924
+ "leftRightCircularArrow",
14925
+ "leftRightRibbon",
14926
+ "leftRightUpArrow",
14927
+ "leftUpArrow",
14928
+ "lightningBolt",
14929
+ "line",
14930
+ "lineInv",
14931
+ "mathDivide",
14932
+ "mathEqual",
14933
+ "mathMinus",
14934
+ "mathMultiply",
14935
+ "mathNotEqual",
14936
+ "mathPlus",
14937
+ "moon",
14938
+ "nonIsoscelesTrapezoid",
14939
+ "noSmoking",
14940
+ "notchedRightArrow",
14941
+ "octagon",
14942
+ "parallelogram",
14943
+ "pentagon",
14944
+ "pie",
14945
+ "pieWedge",
14946
+ "plaque",
14947
+ "plaqueTabs",
14948
+ "plus",
14949
+ "quadArrow",
14950
+ "quadArrowCallout",
14951
+ "rect",
14952
+ "ribbon",
14953
+ "ribbon2",
14954
+ "rightArrow",
14955
+ "rightArrowCallout",
14956
+ "rightBrace",
14957
+ "rightBracket",
14958
+ "round1Rect",
14959
+ "round2DiagRect",
14960
+ "round2SameRect",
14961
+ "roundRect",
14962
+ "rtTriangle",
14963
+ "smileyFace",
14964
+ "snip1Rect",
14965
+ "snip2DiagRect",
14966
+ "snip2SameRect",
14967
+ "snipRoundRect",
14968
+ "squareTabs",
14969
+ "star10",
14970
+ "star12",
14971
+ "star16",
14972
+ "star24",
14973
+ "star32",
14974
+ "star4",
14975
+ "star5",
14976
+ "star6",
14977
+ "star7",
14978
+ "star8",
14979
+ "straightConnector1",
14980
+ "stripedRightArrow",
14981
+ "sun",
14982
+ "swooshArrow",
14983
+ "teardrop",
14984
+ "trapezoid",
14985
+ "triangle",
14986
+ "upArrow",
14987
+ "upArrowCallout",
14988
+ "upDownArrow",
14989
+ "upDownArrowCallout",
14990
+ "uturnArrow",
14991
+ "verticalScroll",
14992
+ "wave",
14993
+ "wedgeEllipseCallout",
14994
+ "wedgeRectCallout",
14995
+ "wedgeRoundRectCallout"
14996
+ ]);
14997
+ function isPresetGeometrySupported(preset) {
14998
+ return Boolean(preset && SUPPORTED_PRESET_GEOMETRIES.has(preset));
14853
14999
  }
15000
+ const KAPPA = 0.5522847498307936;
14854
15001
  function polygon(points) {
14855
15002
  const segments = [];
14856
15003
  points.forEach(([px, py], index) => {
@@ -14861,6 +15008,14 @@ function polygon(points) {
14861
15008
  segments.push({ type: "close" });
14862
15009
  return segments;
14863
15010
  }
15011
+ function rectSegments(x, y, width, height) {
15012
+ return polygon([
15013
+ [x, y],
15014
+ [x + width, y],
15015
+ [x + width, y + height],
15016
+ [x, y + height]
15017
+ ]);
15018
+ }
14864
15019
  function ellipseSegments(cx, cy, rx, ry) {
14865
15020
  const ox = rx * KAPPA;
14866
15021
  const oy = ry * KAPPA;
@@ -14905,6 +15060,50 @@ function ellipseSegments(cx, cy, rx, ry) {
14905
15060
  { type: "close" }
14906
15061
  ];
14907
15062
  }
15063
+ function pointOnEllipse(cx, cy, rx, ry, degrees) {
15064
+ const radians = degrees * Math.PI / 180;
15065
+ return [cx + Math.cos(radians) * rx, cy + Math.sin(radians) * ry];
15066
+ }
15067
+ function arcSegments(cx, cy, rx, ry, start, end) {
15068
+ const steps = Math.max(4, Math.ceil(Math.abs(end - start) / 30));
15069
+ const points = Array.from(
15070
+ { length: steps + 1 },
15071
+ (_, index) => pointOnEllipse(cx, cy, rx, ry, start + (end - start) * index / steps)
15072
+ );
15073
+ return points.map(
15074
+ ([px, py], index) => index === 0 ? { type: "move", x: px, y: py } : { type: "line", x: px, y: py }
15075
+ );
15076
+ }
15077
+ function pieSegments(cx, cy, rx, ry, start, end) {
15078
+ return [
15079
+ { type: "move", x: cx, y: cy },
15080
+ ...arcSegments(cx, cy, rx, ry, start, end).slice(1),
15081
+ { type: "close" }
15082
+ ];
15083
+ }
15084
+ function regularPolygon(cx, cy, rx, ry, sides, startDegrees) {
15085
+ const points = Array.from(
15086
+ { length: sides },
15087
+ (_, index) => pointOnEllipse(cx, cy, rx, ry, startDegrees + 360 * index / sides)
15088
+ );
15089
+ return polygon(points);
15090
+ }
15091
+ function starPointCount(preset) {
15092
+ return Number.parseInt(preset.replace("star", ""), 10);
15093
+ }
15094
+ function starSegments(cx, cy, rx, ry, points, innerRatio = 0.45) {
15095
+ const vertices = Array.from({ length: points * 2 }, (_, index) => {
15096
+ const radius = index % 2 === 0 ? 1 : innerRatio;
15097
+ return pointOnEllipse(
15098
+ cx,
15099
+ cy,
15100
+ rx * radius,
15101
+ ry * radius,
15102
+ -90 + 180 * index / points
15103
+ );
15104
+ });
15105
+ return polygon(vertices);
15106
+ }
14908
15107
  function roundRectSegments(x, y, width, height, radius) {
14909
15108
  const r = Math.min(radius, width / 2, height / 2);
14910
15109
  const right = x + width;
@@ -14947,6 +15146,1163 @@ function roundRectSegments(x, y, width, height, radius) {
14947
15146
  { type: "close" }
14948
15147
  ];
14949
15148
  }
15149
+ function mixedRectSegments(x, y, width, height, tl, tr, br, bl) {
15150
+ return snipRoundRectLikeSegments(x, y, width, height, {
15151
+ tlRound: tl,
15152
+ trRound: tr,
15153
+ brRound: br,
15154
+ blRound: bl
15155
+ });
15156
+ }
15157
+ function snipRoundRectSegments(x, y, width, height) {
15158
+ return snipRoundRectLikeSegments(x, y, width, height, {
15159
+ tlSnip: true,
15160
+ brRound: true
15161
+ });
15162
+ }
15163
+ function snipRectSegments(x, y, width, height, tl, tr, br, bl) {
15164
+ return snipRoundRectLikeSegments(x, y, width, height, {
15165
+ tlSnip: tl,
15166
+ trSnip: tr,
15167
+ brSnip: br,
15168
+ blSnip: bl
15169
+ });
15170
+ }
15171
+ function snipRoundRectLikeSegments(x, y, width, height, corners) {
15172
+ const r = Math.min(width, height) * 0.16;
15173
+ const right = x + width;
15174
+ const bottom = y + height;
15175
+ const points = [
15176
+ [x + (corners.tlSnip || corners.tlRound ? r : 0), y],
15177
+ [right - (corners.trSnip || corners.trRound ? r : 0), y],
15178
+ [right, y + (corners.trSnip || corners.trRound ? r : 0)],
15179
+ [right, bottom - (corners.brSnip || corners.brRound ? r : 0)],
15180
+ [right - (corners.brSnip || corners.brRound ? r : 0), bottom],
15181
+ [x + (corners.blSnip || corners.blRound ? r : 0), bottom],
15182
+ [x, bottom - (corners.blSnip || corners.blRound ? r : 0)],
15183
+ [x, y + (corners.tlSnip || corners.tlRound ? r : 0)]
15184
+ ];
15185
+ return polygon(points);
15186
+ }
15187
+ function arrowSegments(key, x, y, width, height) {
15188
+ const right = x + width;
15189
+ const bottom = y + height;
15190
+ const cx = x + width / 2;
15191
+ const cy = y + height / 2;
15192
+ if (key === "upDownArrow")
15193
+ return polygon([
15194
+ [cx, y],
15195
+ [right, y + height * 0.28],
15196
+ [x + width * 0.62, y + height * 0.28],
15197
+ [x + width * 0.62, y + height * 0.72],
15198
+ [right, y + height * 0.72],
15199
+ [cx, bottom],
15200
+ [x, y + height * 0.72],
15201
+ [x + width * 0.38, y + height * 0.72],
15202
+ [x + width * 0.38, y + height * 0.28],
15203
+ [x, y + height * 0.28]
15204
+ ]);
15205
+ if (key === "leftRightArrow" || key === "leftRightUpArrow")
15206
+ return polygon([
15207
+ [x, cy],
15208
+ [x + width * 0.24, y],
15209
+ [x + width * 0.24, y + height * 0.32],
15210
+ [x + width * 0.76, y + height * 0.32],
15211
+ [x + width * 0.76, y],
15212
+ [right, cy],
15213
+ [x + width * 0.76, bottom],
15214
+ [x + width * 0.76, y + height * 0.68],
15215
+ [x + width * 0.24, y + height * 0.68],
15216
+ [x + width * 0.24, bottom]
15217
+ ]);
15218
+ if (key === "quadArrow")
15219
+ return starSegments(cx, cy, width * 0.5, height * 0.5, 4, 0.38);
15220
+ if (key === "leftArrow" || key === "leftCircularArrow")
15221
+ return polygon([
15222
+ [x, cy],
15223
+ [x + width * 0.38, y],
15224
+ [x + width * 0.38, y + height * 0.28],
15225
+ [right, y + height * 0.28],
15226
+ [right, y + height * 0.72],
15227
+ [x + width * 0.38, y + height * 0.72],
15228
+ [x + width * 0.38, bottom]
15229
+ ]);
15230
+ if (key === "upArrow" || key === "bentUpArrow" || key === "curvedUpArrow")
15231
+ return polygon([
15232
+ [cx, y],
15233
+ [right, y + height * 0.38],
15234
+ [x + width * 0.68, y + height * 0.38],
15235
+ [x + width * 0.68, bottom],
15236
+ [x + width * 0.32, bottom],
15237
+ [x + width * 0.32, y + height * 0.38],
15238
+ [x, y + height * 0.38]
15239
+ ]);
15240
+ if (key === "downArrow" || key === "curvedDownArrow")
15241
+ return polygon([
15242
+ [x + width * 0.32, y],
15243
+ [x + width * 0.68, y],
15244
+ [x + width * 0.68, y + height * 0.62],
15245
+ [right, y + height * 0.62],
15246
+ [cx, bottom],
15247
+ [x, y + height * 0.62],
15248
+ [x + width * 0.32, y + height * 0.62]
15249
+ ]);
15250
+ if (key === "circularArrow" || key === "leftRightCircularArrow")
15251
+ return blockArcSegments(cx, cy, width / 2, height / 2);
15252
+ if (key === "uturnArrow")
15253
+ return polygon([
15254
+ [x + width * 0.2, bottom],
15255
+ [x + width * 0.2, y + height * 0.35],
15256
+ [x + width * 0.62, y + height * 0.35],
15257
+ [x + width * 0.62, y],
15258
+ [right, y + height * 0.5],
15259
+ [x + width * 0.62, bottom],
15260
+ [x + width * 0.62, y + height * 0.65],
15261
+ [x + width * 0.38, y + height * 0.65],
15262
+ [x + width * 0.38, bottom]
15263
+ ]);
15264
+ if (key === "notchedRightArrow")
15265
+ return polygon([
15266
+ [x, y],
15267
+ [right - width * 0.28, y],
15268
+ [right, cy],
15269
+ [right - width * 0.28, bottom],
15270
+ [x, bottom],
15271
+ [x + width * 0.18, cy]
15272
+ ]);
15273
+ if (key === "stripedRightArrow")
15274
+ return polygon([
15275
+ [x + width * 0.16, y],
15276
+ [right - width * 0.28, y],
15277
+ [right, cy],
15278
+ [right - width * 0.28, bottom],
15279
+ [x + width * 0.16, bottom],
15280
+ [x + width * 0.34, cy]
15281
+ ]);
15282
+ return polygon([
15283
+ [x, y + height * 0.28],
15284
+ [right - width * 0.38, y + height * 0.28],
15285
+ [right - width * 0.38, y],
15286
+ [right, cy],
15287
+ [right - width * 0.38, bottom],
15288
+ [right - width * 0.38, y + height * 0.72],
15289
+ [x, y + height * 0.72]
15290
+ ]);
15291
+ }
15292
+ function calloutSegments(key, x, y, width, height) {
15293
+ if (key.startsWith("wedgeEllipse")) {
15294
+ return [
15295
+ ...ellipseSegments(
15296
+ x + width / 2,
15297
+ y + height / 2,
15298
+ width / 2,
15299
+ height * 0.42
15300
+ ),
15301
+ { type: "move", x: x + width * 0.55, y: y + height * 0.82 },
15302
+ { type: "line", x: x + width * 0.24, y: y + height },
15303
+ { type: "line", x: x + width * 0.45, y: y + height * 0.75 }
15304
+ ];
15305
+ }
15306
+ const r = key.startsWith("wedgeRound") ? Math.min(width, height) * 0.08 : 0;
15307
+ const body = r > 0 ? roundRectSegments(x, y, width, height * 0.82, r) : rectSegments(x, y, width, height * 0.82);
15308
+ return [
15309
+ ...body,
15310
+ { type: "move", x: x + width * 0.58, y: y + height * 0.82 },
15311
+ { type: "line", x: x + width * 0.26, y: y + height },
15312
+ { type: "line", x: x + width * 0.44, y: y + height * 0.82 },
15313
+ { type: "close" }
15314
+ ];
15315
+ }
15316
+ function connectorSegments(key, x, y, width, height) {
15317
+ const right = x + width;
15318
+ const bottom = y + height;
15319
+ if (key.startsWith("curved")) {
15320
+ return [
15321
+ { type: "move", x, y },
15322
+ {
15323
+ type: "cubic",
15324
+ x1: x + width * 0.7,
15325
+ y1: y,
15326
+ x2: x + width * 0.3,
15327
+ y2: bottom,
15328
+ x: right,
15329
+ y: bottom
15330
+ }
15331
+ ];
15332
+ }
15333
+ if (key === "bentConnector2")
15334
+ return [
15335
+ { type: "move", x, y },
15336
+ { type: "line", x: right, y: bottom }
15337
+ ];
15338
+ if (key === "bentConnector3")
15339
+ return [
15340
+ { type: "move", x, y },
15341
+ { type: "line", x: right, y },
15342
+ { type: "line", x: right, y: bottom }
15343
+ ];
15344
+ if (key === "bentConnector4")
15345
+ return [
15346
+ { type: "move", x, y },
15347
+ { type: "line", x: x + width * 0.5, y },
15348
+ { type: "line", x: x + width * 0.5, y: bottom },
15349
+ { type: "line", x: right, y: bottom }
15350
+ ];
15351
+ if (key === "bentConnector5")
15352
+ return [
15353
+ { type: "move", x, y },
15354
+ { type: "line", x: x + width * 0.34, y },
15355
+ { type: "line", x: x + width * 0.34, y: bottom },
15356
+ { type: "line", x: x + width * 0.66, y: bottom },
15357
+ { type: "line", x: x + width * 0.66, y },
15358
+ { type: "line", x: right, y }
15359
+ ];
15360
+ return [
15361
+ { type: "move", x, y },
15362
+ { type: "line", x: right, y: bottom }
15363
+ ];
15364
+ }
15365
+ function flowChartSegments(key, x, y, width, height, resolvePreset) {
15366
+ if (key.includes("Decision"))
15367
+ return resolvePreset("diamond", x, y, width, height);
15368
+ if (key.includes("Connector") || key.includes("SummingJunction") || key.includes("Or")) {
15369
+ return ellipseSegments(
15370
+ x + width / 2,
15371
+ y + height / 2,
15372
+ width / 2,
15373
+ height / 2
15374
+ );
15375
+ }
15376
+ if (key.includes("Terminator")) {
15377
+ return roundRectSegments(
15378
+ x,
15379
+ y,
15380
+ width,
15381
+ height,
15382
+ Math.min(width, height) * 0.28
15383
+ );
15384
+ }
15385
+ if (key.includes("Delay")) {
15386
+ return [
15387
+ ...rectSegments(x, y, width * 0.65, height).slice(0, -1),
15388
+ ...arcSegments(
15389
+ x + width * 0.65,
15390
+ y + height / 2,
15391
+ width * 0.35,
15392
+ height / 2,
15393
+ -90,
15394
+ 90
15395
+ ),
15396
+ { type: "close" }
15397
+ ];
15398
+ }
15399
+ if (key.includes("Document")) return waveBottomRect(x, y, width, height);
15400
+ if (key.includes("Data") || key.includes("InputOutput") || key.includes("ManualInput")) {
15401
+ return resolvePreset("parallelogram", x, y, width, height);
15402
+ }
15403
+ if (key.includes("Preparation")) {
15404
+ return resolvePreset("hexagon", x, y, width, height);
15405
+ }
15406
+ if (key.includes("OffpageConnector")) {
15407
+ return resolvePreset("homePlate", x, y, width, height);
15408
+ }
15409
+ if (key.includes("PunchedCard")) {
15410
+ return snipRectSegments(x, y, width, height, true, false, false, false);
15411
+ }
15412
+ if (key.includes("Magnetic")) return canSegments(x, y, width, height);
15413
+ if (key.includes("Collate")) {
15414
+ return polygon([
15415
+ [x, y],
15416
+ [x + width, y],
15417
+ [x, y + height],
15418
+ [x + width, y + height]
15419
+ ]);
15420
+ }
15421
+ if (key.includes("Sort"))
15422
+ return resolvePreset("diamond", x, y, width, height);
15423
+ return rectSegments(x, y, width, height);
15424
+ }
15425
+ function actionButtonSegments(key, x, y, width, height, resolvePreset) {
15426
+ const base = roundRectSegments(
15427
+ x,
15428
+ y,
15429
+ width,
15430
+ height,
15431
+ Math.min(width, height) * 0.08
15432
+ );
15433
+ if (key === "actionButtonBlank") return base;
15434
+ return [...base, ...symbolSegments(key, x, y, width, height, resolvePreset)];
15435
+ }
15436
+ function symbolSegments(key, x, y, width, height, resolvePreset) {
15437
+ const cx = x + width / 2;
15438
+ const cy = y + height / 2;
15439
+ if (key.includes("Home"))
15440
+ return polygon([
15441
+ [cx, y + height * 0.25],
15442
+ [x + width * 0.72, cy],
15443
+ [x + width * 0.72, y + height * 0.75],
15444
+ [x + width * 0.28, y + height * 0.75],
15445
+ [x + width * 0.28, cy]
15446
+ ]);
15447
+ if (key.includes("Help")) {
15448
+ return ellipseSegments(cx, cy, width * 0.12, height * 0.12);
15449
+ }
15450
+ if (key.includes("Information")) {
15451
+ return rectSegments(
15452
+ cx - width * 0.04,
15453
+ y + height * 0.34,
15454
+ width * 0.08,
15455
+ height * 0.38
15456
+ );
15457
+ }
15458
+ if (key.includes("Sound"))
15459
+ return polygon([
15460
+ [x + width * 0.3, cy],
15461
+ [x + width * 0.45, y + height * 0.35],
15462
+ [x + width * 0.45, y + height * 0.65]
15463
+ ]);
15464
+ if (key.includes("Back") || key.includes("Beginning") || key.includes("Return")) {
15465
+ return resolvePreset(
15466
+ "leftArrow",
15467
+ x + width * 0.28,
15468
+ y + height * 0.3,
15469
+ width * 0.45,
15470
+ height * 0.4
15471
+ );
15472
+ }
15473
+ return resolvePreset(
15474
+ "rightArrow",
15475
+ x + width * 0.28,
15476
+ y + height * 0.3,
15477
+ width * 0.45,
15478
+ height * 0.4
15479
+ );
15480
+ }
15481
+ function blockArcSegments(cx, cy, rx, ry) {
15482
+ const outer = arcSegments(cx, cy, rx, ry, -45, 250);
15483
+ const inner = arcSegments(cx, cy, rx * 0.58, ry * 0.58, 250, -45).reverse();
15484
+ return [...outer, ...inner.slice(1), { type: "close" }];
15485
+ }
15486
+ function plusSegments(x, y, width, height) {
15487
+ return polygon([
15488
+ [x + width * 0.38, y],
15489
+ [x + width * 0.62, y],
15490
+ [x + width * 0.62, y + height * 0.38],
15491
+ [x + width, y + height * 0.38],
15492
+ [x + width, y + height * 0.62],
15493
+ [x + width * 0.62, y + height * 0.62],
15494
+ [x + width * 0.62, y + height],
15495
+ [x + width * 0.38, y + height],
15496
+ [x + width * 0.38, y + height * 0.62],
15497
+ [x, y + height * 0.62],
15498
+ [x, y + height * 0.38],
15499
+ [x + width * 0.38, y + height * 0.38]
15500
+ ]);
15501
+ }
15502
+ function xSegments(x, y, width, height) {
15503
+ return polygon([
15504
+ [x + width * 0.18, y],
15505
+ [x + width * 0.5, y + height * 0.32],
15506
+ [x + width * 0.82, y],
15507
+ [x + width, y + height * 0.18],
15508
+ [x + width * 0.68, y + height * 0.5],
15509
+ [x + width, y + height * 0.82],
15510
+ [x + width * 0.82, y + height],
15511
+ [x + width * 0.5, y + height * 0.68],
15512
+ [x + width * 0.18, y + height],
15513
+ [x, y + height * 0.82],
15514
+ [x + width * 0.32, y + height * 0.5],
15515
+ [x, y + height * 0.18]
15516
+ ]);
15517
+ }
15518
+ function mathDivideSegments(x, y, width, height) {
15519
+ return [
15520
+ ...ellipseSegments(
15521
+ x + width / 2,
15522
+ y + height * 0.22,
15523
+ width * 0.07,
15524
+ height * 0.07
15525
+ ),
15526
+ ...rectSegments(
15527
+ x + width * 0.18,
15528
+ y + height * 0.46,
15529
+ width * 0.64,
15530
+ height * 0.08
15531
+ ),
15532
+ ...ellipseSegments(
15533
+ x + width / 2,
15534
+ y + height * 0.78,
15535
+ width * 0.07,
15536
+ height * 0.07
15537
+ )
15538
+ ];
15539
+ }
15540
+ function mathEqualSegments(x, y, width, height) {
15541
+ return [
15542
+ ...rectSegments(x, y + height * 0.3, width, height * 0.12),
15543
+ ...rectSegments(x, y + height * 0.58, width, height * 0.12)
15544
+ ];
15545
+ }
15546
+ function mathNotEqualSegments(x, y, width, height) {
15547
+ return [
15548
+ ...mathEqualSegments(x, y, width, height),
15549
+ ...polygon([
15550
+ [x + width * 0.62, y],
15551
+ [x + width * 0.74, y],
15552
+ [x + width * 0.38, y + height],
15553
+ [x + width * 0.26, y + height]
15554
+ ])
15555
+ ];
15556
+ }
15557
+ function heartSegments(x, y, width, height) {
15558
+ const cx = x + width / 2;
15559
+ return [
15560
+ { type: "move", x: cx, y: y + height * 0.9 },
15561
+ {
15562
+ type: "cubic",
15563
+ x1: x - width * 0.12,
15564
+ y1: y + height * 0.45,
15565
+ x2: x + width * 0.08,
15566
+ y2: y,
15567
+ x: cx,
15568
+ y: y + height * 0.28
15569
+ },
15570
+ {
15571
+ type: "cubic",
15572
+ x1: x + width * 0.92,
15573
+ y1: y,
15574
+ x2: x + width * 1.12,
15575
+ y2: y + height * 0.45,
15576
+ x: cx,
15577
+ y: y + height * 0.9
15578
+ },
15579
+ { type: "close" }
15580
+ ];
15581
+ }
15582
+ function cloudSegments(x, y, width, height) {
15583
+ return [
15584
+ ...ellipseSegments(
15585
+ x + width * 0.28,
15586
+ y + height * 0.58,
15587
+ width * 0.24,
15588
+ height * 0.23
15589
+ ),
15590
+ ...ellipseSegments(
15591
+ x + width * 0.48,
15592
+ y + height * 0.42,
15593
+ width * 0.28,
15594
+ height * 0.28
15595
+ ),
15596
+ ...ellipseSegments(
15597
+ x + width * 0.7,
15598
+ y + height * 0.58,
15599
+ width * 0.25,
15600
+ height * 0.24
15601
+ )
15602
+ ];
15603
+ }
15604
+ function moonSegments(x, y, width, height) {
15605
+ return [
15606
+ { type: "move", x: x + width * 0.68, y },
15607
+ {
15608
+ type: "cubic",
15609
+ x1: x + width * 0.22,
15610
+ y1: y + height * 0.06,
15611
+ x2: x + width * 0.18,
15612
+ y2: y + height * 0.94,
15613
+ x: x + width * 0.68,
15614
+ y: y + height
15615
+ },
15616
+ {
15617
+ type: "cubic",
15618
+ x1: x + width * 0.42,
15619
+ y1: y + height * 0.72,
15620
+ x2: x + width * 0.42,
15621
+ y2: y + height * 0.28,
15622
+ x: x + width * 0.68,
15623
+ y
15624
+ },
15625
+ { type: "close" }
15626
+ ];
15627
+ }
15628
+ function smileySegments(x, y, width, height) {
15629
+ return [
15630
+ ...ellipseSegments(x + width / 2, y + height / 2, width / 2, height / 2),
15631
+ ...ellipseSegments(
15632
+ x + width * 0.35,
15633
+ y + height * 0.38,
15634
+ width * 0.05,
15635
+ height * 0.05
15636
+ ),
15637
+ ...ellipseSegments(
15638
+ x + width * 0.65,
15639
+ y + height * 0.38,
15640
+ width * 0.05,
15641
+ height * 0.05
15642
+ ),
15643
+ ...arcSegments(
15644
+ x + width / 2,
15645
+ y + height * 0.52,
15646
+ width * 0.24,
15647
+ height * 0.18,
15648
+ 20,
15649
+ 160
15650
+ )
15651
+ ];
15652
+ }
15653
+ function teardropSegments(x, y, width, height) {
15654
+ return [
15655
+ { type: "move", x: x + width * 0.55, y },
15656
+ {
15657
+ type: "cubic",
15658
+ x1: x + width,
15659
+ y1: y + height * 0.22,
15660
+ x2: x + width * 0.95,
15661
+ y2: y + height,
15662
+ x: x + width * 0.35,
15663
+ y: y + height
15664
+ },
15665
+ {
15666
+ type: "cubic",
15667
+ x1: x - width * 0.1,
15668
+ y1: y + height * 0.66,
15669
+ x2: x + width * 0.16,
15670
+ y2: y + height * 0.12,
15671
+ x: x + width * 0.55,
15672
+ y
15673
+ },
15674
+ { type: "close" }
15675
+ ];
15676
+ }
15677
+ function noSmokingSegments(x, y, width, height) {
15678
+ return [
15679
+ ...ellipseSegments(x + width / 2, y + height / 2, width / 2, height / 2),
15680
+ ...polygon([
15681
+ [x + width * 0.18, y + height * 0.1],
15682
+ [x + width * 0.28, y],
15683
+ [x + width * 0.82, y + height * 0.9],
15684
+ [x + width * 0.72, y + height]
15685
+ ])
15686
+ ];
15687
+ }
15688
+ function donutSegments(cx, cy, rx, ry) {
15689
+ return [
15690
+ ...ellipseSegments(cx, cy, rx, ry),
15691
+ ...ellipseSegments(cx, cy, rx * 0.52, ry * 0.52)
15692
+ ];
15693
+ }
15694
+ function canSegments(x, y, width, height) {
15695
+ return [
15696
+ ...rectSegments(x, y + height * 0.14, width, height * 0.72),
15697
+ ...ellipseSegments(
15698
+ x + width / 2,
15699
+ y + height * 0.14,
15700
+ width / 2,
15701
+ height * 0.14
15702
+ ),
15703
+ ...arcSegments(
15704
+ x + width / 2,
15705
+ y + height * 0.86,
15706
+ width / 2,
15707
+ height * 0.14,
15708
+ 0,
15709
+ 180
15710
+ )
15711
+ ];
15712
+ }
15713
+ function cubeSegments(x, y, width, height) {
15714
+ return polygon([
15715
+ [x + width * 0.22, y],
15716
+ [x + width, y],
15717
+ [x + width, y + height * 0.78],
15718
+ [x + width * 0.78, y + height],
15719
+ [x, y + height],
15720
+ [x, y + height * 0.22]
15721
+ ]);
15722
+ }
15723
+ function bevelSegments(x, y, width, height) {
15724
+ const inset = Math.min(width, height) * 0.16;
15725
+ return polygon([
15726
+ [x + inset, y],
15727
+ [x + width - inset, y],
15728
+ [x + width, y + inset],
15729
+ [x + width, y + height - inset],
15730
+ [x + width - inset, y + height],
15731
+ [x + inset, y + height],
15732
+ [x, y + height - inset],
15733
+ [x, y + inset]
15734
+ ]);
15735
+ }
15736
+ function foldedCornerSegments(x, y, width, height) {
15737
+ return polygon([
15738
+ [x, y],
15739
+ [x + width * 0.78, y],
15740
+ [x + width, y + height * 0.22],
15741
+ [x + width, y + height],
15742
+ [x, y + height]
15743
+ ]);
15744
+ }
15745
+ function frameSegments(x, y, width, height) {
15746
+ return [
15747
+ ...rectSegments(x, y, width, height),
15748
+ ...rectSegments(
15749
+ x + width * 0.18,
15750
+ y + height * 0.18,
15751
+ width * 0.64,
15752
+ height * 0.64
15753
+ )
15754
+ ];
15755
+ }
15756
+ function halfFrameSegments(x, y, width, height) {
15757
+ return polygon([
15758
+ [x, y],
15759
+ [x + width, y],
15760
+ [x + width, y + height * 0.22],
15761
+ [x + width * 0.22, y + height * 0.22],
15762
+ [x + width * 0.22, y + height],
15763
+ [x, y + height]
15764
+ ]);
15765
+ }
15766
+ function cornerSegments(x, y, width, height) {
15767
+ return polygon([
15768
+ [x, y],
15769
+ [x + width, y],
15770
+ [x + width, y + height * 0.22],
15771
+ [x + width * 0.22, y + height * 0.22],
15772
+ [x + width * 0.22, y + height],
15773
+ [x, y + height]
15774
+ ]);
15775
+ }
15776
+ function plaqueSegments(x, y, width, height) {
15777
+ return polygon([
15778
+ [x + width * 0.18, y],
15779
+ [x + width * 0.82, y],
15780
+ [x + width, y + height * 0.18],
15781
+ [x + width, y + height * 0.82],
15782
+ [x + width * 0.82, y + height],
15783
+ [x + width * 0.18, y + height],
15784
+ [x, y + height * 0.82],
15785
+ [x, y + height * 0.18]
15786
+ ]);
15787
+ }
15788
+ function tabbedRectSegments(key, x, y, width, height) {
15789
+ const tab = Math.min(width, height) * 0.18;
15790
+ if (key === "cornerTabs")
15791
+ return polygon([
15792
+ [x, y + tab],
15793
+ [x + tab, y + tab],
15794
+ [x + tab, y],
15795
+ [x + width - tab, y],
15796
+ [x + width - tab, y + tab],
15797
+ [x + width, y + tab],
15798
+ [x + width, y + height - tab],
15799
+ [x + width - tab, y + height - tab],
15800
+ [x + width - tab, y + height],
15801
+ [x + tab, y + height],
15802
+ [x + tab, y + height - tab],
15803
+ [x, y + height - tab]
15804
+ ]);
15805
+ if (key === "plaqueTabs")
15806
+ return polygon([
15807
+ [x, y + tab],
15808
+ [x + width * 0.35, y + tab],
15809
+ [x + width * 0.35, y],
15810
+ [x + width * 0.65, y],
15811
+ [x + width * 0.65, y + tab],
15812
+ [x + width, y + tab],
15813
+ [x + width, y + height - tab],
15814
+ [x + width * 0.65, y + height - tab],
15815
+ [x + width * 0.65, y + height],
15816
+ [x + width * 0.35, y + height],
15817
+ [x + width * 0.35, y + height - tab],
15818
+ [x, y + height - tab]
15819
+ ]);
15820
+ return polygon([
15821
+ [x + tab, y],
15822
+ [x + width - tab, y],
15823
+ [x + width - tab, y + tab],
15824
+ [x + width, y + tab],
15825
+ [x + width, y + height - tab],
15826
+ [x + width - tab, y + height - tab],
15827
+ [x + width - tab, y + height],
15828
+ [x + tab, y + height],
15829
+ [x + tab, y + height - tab],
15830
+ [x, y + height - tab],
15831
+ [x, y + tab],
15832
+ [x + tab, y + tab]
15833
+ ]);
15834
+ }
15835
+ function braceSegments(key, x, y, width, height) {
15836
+ if (key === "rightBrace")
15837
+ return [
15838
+ { type: "move", x, y },
15839
+ {
15840
+ type: "cubic",
15841
+ x1: x + width,
15842
+ y1: y,
15843
+ x2: x,
15844
+ y2: y + height * 0.5,
15845
+ x: x + width,
15846
+ y: y + height * 0.5
15847
+ },
15848
+ {
15849
+ type: "cubic",
15850
+ x1: x,
15851
+ y1: y + height * 0.5,
15852
+ x2: x + width,
15853
+ y2: y + height,
15854
+ x,
15855
+ y: y + height
15856
+ }
15857
+ ];
15858
+ if (key === "bracePair")
15859
+ return [
15860
+ ...braceSegments("leftBrace", x, y, width * 0.45, height),
15861
+ ...braceSegments("rightBrace", x + width * 0.55, y, width * 0.45, height)
15862
+ ];
15863
+ return [
15864
+ { type: "move", x: x + width, y },
15865
+ {
15866
+ type: "cubic",
15867
+ x1: x,
15868
+ y1: y,
15869
+ x2: x + width,
15870
+ y2: y + height * 0.5,
15871
+ x,
15872
+ y: y + height * 0.5
15873
+ },
15874
+ {
15875
+ type: "cubic",
15876
+ x1: x + width,
15877
+ y1: y + height * 0.5,
15878
+ x2: x,
15879
+ y2: y + height,
15880
+ x: x + width,
15881
+ y: y + height
15882
+ }
15883
+ ];
15884
+ }
15885
+ function bracketSegments(key, x, y, width, height) {
15886
+ if (key === "rightBracket")
15887
+ return [
15888
+ { type: "move", x, y },
15889
+ { type: "line", x: x + width, y },
15890
+ { type: "line", x: x + width, y: y + height },
15891
+ { type: "line", x, y: y + height }
15892
+ ];
15893
+ if (key === "bracketPair")
15894
+ return [
15895
+ ...bracketSegments("leftBracket", x, y, width * 0.45, height),
15896
+ ...bracketSegments(
15897
+ "rightBracket",
15898
+ x + width * 0.55,
15899
+ y,
15900
+ width * 0.45,
15901
+ height
15902
+ )
15903
+ ];
15904
+ return [
15905
+ { type: "move", x: x + width, y },
15906
+ { type: "line", x, y },
15907
+ { type: "line", x, y: y + height },
15908
+ { type: "line", x: x + width, y: y + height }
15909
+ ];
15910
+ }
15911
+ function ribbonSegments(key, x, y, width, height) {
15912
+ const mid = y + height * 0.5;
15913
+ if (key.includes("Ellipse"))
15914
+ return [
15915
+ ...ellipseSegments(x + width / 2, mid, width * 0.42, height * 0.28),
15916
+ ...polygon([
15917
+ [x, mid],
15918
+ [x + width * 0.18, y + height * 0.3],
15919
+ [x + width * 0.18, y + height * 0.7]
15920
+ ]),
15921
+ ...polygon([
15922
+ [x + width, mid],
15923
+ [x + width * 0.82, y + height * 0.3],
15924
+ [x + width * 0.82, y + height * 0.7]
15925
+ ])
15926
+ ];
15927
+ return polygon([
15928
+ [x, y + height * 0.25],
15929
+ [x + width, y + height * 0.25],
15930
+ [x + width * 0.82, mid],
15931
+ [x + width, y + height * 0.75],
15932
+ [x, y + height * 0.75],
15933
+ [x + width * 0.18, mid]
15934
+ ]);
15935
+ }
15936
+ function scrollSegments(key, x, y, width, height) {
15937
+ if (key === "horizontalScroll")
15938
+ return [
15939
+ ...rectSegments(
15940
+ x + width * 0.1,
15941
+ y + height * 0.2,
15942
+ width * 0.8,
15943
+ height * 0.6
15944
+ ),
15945
+ ...ellipseSegments(
15946
+ x + width * 0.1,
15947
+ y + height * 0.5,
15948
+ width * 0.1,
15949
+ height * 0.3
15950
+ ),
15951
+ ...ellipseSegments(
15952
+ x + width * 0.9,
15953
+ y + height * 0.5,
15954
+ width * 0.1,
15955
+ height * 0.3
15956
+ )
15957
+ ];
15958
+ return [
15959
+ ...rectSegments(
15960
+ x + width * 0.2,
15961
+ y + height * 0.1,
15962
+ width * 0.6,
15963
+ height * 0.8
15964
+ ),
15965
+ ...ellipseSegments(
15966
+ x + width * 0.5,
15967
+ y + height * 0.1,
15968
+ width * 0.3,
15969
+ height * 0.1
15970
+ ),
15971
+ ...ellipseSegments(
15972
+ x + width * 0.5,
15973
+ y + height * 0.9,
15974
+ width * 0.3,
15975
+ height * 0.1
15976
+ )
15977
+ ];
15978
+ }
15979
+ function waveSegments(key, x, y, width, height) {
15980
+ const first = [
15981
+ { type: "move", x, y: y + height * 0.5 },
15982
+ {
15983
+ type: "cubic",
15984
+ x1: x + width * 0.25,
15985
+ y1: y,
15986
+ x2: x + width * 0.25,
15987
+ y2: y + height,
15988
+ x: x + width * 0.5,
15989
+ y: y + height * 0.5
15990
+ },
15991
+ {
15992
+ type: "cubic",
15993
+ x1: x + width * 0.75,
15994
+ y1: y,
15995
+ x2: x + width * 0.75,
15996
+ y2: y + height,
15997
+ x: x + width,
15998
+ y: y + height * 0.5
15999
+ }
16000
+ ];
16001
+ return key === "doubleWave" ? [
16002
+ ...first,
16003
+ ...first.map(
16004
+ (segment) => "y" in segment ? { ...segment, y: segment.y + height * 0.18 } : segment
16005
+ )
16006
+ ] : first;
16007
+ }
16008
+ function waveBottomRect(x, y, width, height) {
16009
+ return [
16010
+ { type: "move", x, y },
16011
+ { type: "line", x: x + width, y },
16012
+ { type: "line", x: x + width, y: y + height * 0.82 },
16013
+ {
16014
+ type: "cubic",
16015
+ x1: x + width * 0.75,
16016
+ y1: y + height,
16017
+ x2: x + width * 0.25,
16018
+ y2: y + height * 0.64,
16019
+ x,
16020
+ y: y + height * 0.82
16021
+ },
16022
+ { type: "close" }
16023
+ ];
16024
+ }
16025
+ function resolvePresetPathSegments(preset, x, y, width, height) {
16026
+ const right = x + width;
16027
+ const bottom = y + height;
16028
+ const cx = x + width / 2;
16029
+ const cy = y + height / 2;
16030
+ if (/Connector\d$/.test(preset) || preset === "straightConnector1") {
16031
+ return connectorSegments(preset, x, y, width, height);
16032
+ }
16033
+ if (/Callout\d$/.test(preset) || /Callout$/.test(preset)) {
16034
+ return calloutSegments(preset, x, y, width, height);
16035
+ }
16036
+ if (/Arrow/.test(preset) || preset === "swooshArrow") {
16037
+ return arrowSegments(preset, x, y, width, height);
16038
+ }
16039
+ if (/^star\d+$/.test(preset)) {
16040
+ return starSegments(
16041
+ cx,
16042
+ cy,
16043
+ width * 0.48,
16044
+ height * 0.48,
16045
+ starPointCount(preset)
16046
+ );
16047
+ }
16048
+ if (/^flowChart/.test(preset)) {
16049
+ return flowChartSegments(
16050
+ preset,
16051
+ x,
16052
+ y,
16053
+ width,
16054
+ height,
16055
+ resolvePresetPathSegments
16056
+ );
16057
+ }
16058
+ if (/^actionButton/.test(preset)) {
16059
+ return actionButtonSegments(
16060
+ preset,
16061
+ x,
16062
+ y,
16063
+ width,
16064
+ height,
16065
+ resolvePresetPathSegments
16066
+ );
16067
+ }
16068
+ switch (preset) {
16069
+ case "line":
16070
+ return [
16071
+ { type: "move", x, y },
16072
+ { type: "line", x: right, y: bottom }
16073
+ ];
16074
+ case "lineInv":
16075
+ return [
16076
+ { type: "move", x, y: bottom },
16077
+ { type: "line", x: right, y }
16078
+ ];
16079
+ case "arc":
16080
+ return arcSegments(cx, cy, width / 2, height / 2, 200, 340);
16081
+ case "blockArc":
16082
+ return blockArcSegments(cx, cy, width / 2, height / 2);
16083
+ case "chord":
16084
+ return [
16085
+ ...arcSegments(cx, cy, width / 2, height / 2, 210, 330),
16086
+ { type: "close" }
16087
+ ];
16088
+ case "pie":
16089
+ return pieSegments(cx, cy, width / 2, height / 2, -90, 45);
16090
+ case "pieWedge":
16091
+ return pieSegments(cx, cy, width / 2, height / 2, -35, 55);
16092
+ case "roundRect":
16093
+ return roundRectSegments(
16094
+ x,
16095
+ y,
16096
+ width,
16097
+ height,
16098
+ Math.min(width, height) * 0.12
16099
+ );
16100
+ case "round1Rect":
16101
+ return mixedRectSegments(x, y, width, height, true, false, false, false);
16102
+ case "round2SameRect":
16103
+ return mixedRectSegments(x, y, width, height, true, false, true, false);
16104
+ case "round2DiagRect":
16105
+ return mixedRectSegments(x, y, width, height, true, false, false, true);
16106
+ case "snipRoundRect":
16107
+ return snipRoundRectSegments(x, y, width, height);
16108
+ case "snip1Rect":
16109
+ return snipRectSegments(x, y, width, height, true, false, false, false);
16110
+ case "snip2SameRect":
16111
+ return snipRectSegments(x, y, width, height, true, true, false, false);
16112
+ case "snip2DiagRect":
16113
+ return snipRectSegments(x, y, width, height, true, false, true, false);
16114
+ case "ellipse":
16115
+ return ellipseSegments(cx, cy, width / 2, height / 2);
16116
+ case "triangle":
16117
+ return polygon([
16118
+ [cx, y],
16119
+ [right, bottom],
16120
+ [x, bottom]
16121
+ ]);
16122
+ case "rtTriangle":
16123
+ return polygon([
16124
+ [x, y],
16125
+ [x, bottom],
16126
+ [right, bottom]
16127
+ ]);
16128
+ case "diamond":
16129
+ return polygon([
16130
+ [cx, y],
16131
+ [right, cy],
16132
+ [cx, bottom],
16133
+ [x, cy]
16134
+ ]);
16135
+ case "parallelogram":
16136
+ return polygon([
16137
+ [x + width * 0.22, y],
16138
+ [right, y],
16139
+ [right - width * 0.22, bottom],
16140
+ [x, bottom]
16141
+ ]);
16142
+ case "trapezoid":
16143
+ return polygon([
16144
+ [x + width * 0.2, y],
16145
+ [right - width * 0.2, y],
16146
+ [right, bottom],
16147
+ [x, bottom]
16148
+ ]);
16149
+ case "nonIsoscelesTrapezoid":
16150
+ return polygon([
16151
+ [x + width * 0.08, y],
16152
+ [right - width * 0.28, y],
16153
+ [right, bottom],
16154
+ [x, bottom]
16155
+ ]);
16156
+ case "pentagon":
16157
+ return regularPolygon(cx, cy, width * 0.48, height * 0.48, 5, -90);
16158
+ case "hexagon":
16159
+ return regularPolygon(cx, cy, width * 0.48, height * 0.48, 6, 0);
16160
+ case "heptagon":
16161
+ return regularPolygon(cx, cy, width * 0.48, height * 0.48, 7, -90);
16162
+ case "octagon":
16163
+ return regularPolygon(cx, cy, width * 0.48, height * 0.48, 8, 22.5);
16164
+ case "decagon":
16165
+ return regularPolygon(cx, cy, width * 0.48, height * 0.48, 10, -90);
16166
+ case "dodecagon":
16167
+ return regularPolygon(cx, cy, width * 0.48, height * 0.48, 12, -90);
16168
+ case "homePlate":
16169
+ return polygon([
16170
+ [x, y],
16171
+ [right - width * 0.22, y],
16172
+ [right, cy],
16173
+ [right - width * 0.22, bottom],
16174
+ [x, bottom]
16175
+ ]);
16176
+ case "chevron":
16177
+ return polygon([
16178
+ [x, y],
16179
+ [right - width * 0.28, y],
16180
+ [right, cy],
16181
+ [right - width * 0.28, bottom],
16182
+ [x, bottom],
16183
+ [x + width * 0.28, cy]
16184
+ ]);
16185
+ case "heart":
16186
+ return heartSegments(x, y, width, height);
16187
+ case "cloud":
16188
+ return cloudSegments(x, y, width, height);
16189
+ case "sun":
16190
+ return starSegments(cx, cy, width * 0.48, height * 0.48, 16, 0.72);
16191
+ case "moon":
16192
+ return moonSegments(x, y, width, height);
16193
+ case "smileyFace":
16194
+ return smileySegments(x, y, width, height);
16195
+ case "lightningBolt":
16196
+ return polygon([
16197
+ [x + width * 0.58, y],
16198
+ [x + width * 0.28, y + height * 0.44],
16199
+ [x + width * 0.48, y + height * 0.44],
16200
+ [x + width * 0.36, bottom],
16201
+ [x + width * 0.74, y + height * 0.36],
16202
+ [x + width * 0.52, y + height * 0.36]
16203
+ ]);
16204
+ case "teardrop":
16205
+ return teardropSegments(x, y, width, height);
16206
+ case "noSmoking":
16207
+ return noSmokingSegments(x, y, width, height);
16208
+ case "donut":
16209
+ return donutSegments(cx, cy, width / 2, height / 2);
16210
+ case "can":
16211
+ return canSegments(x, y, width, height);
16212
+ case "cube":
16213
+ return cubeSegments(x, y, width, height);
16214
+ case "bevel":
16215
+ return bevelSegments(x, y, width, height);
16216
+ case "foldedCorner":
16217
+ return foldedCornerSegments(x, y, width, height);
16218
+ case "frame":
16219
+ return frameSegments(x, y, width, height);
16220
+ case "halfFrame":
16221
+ return halfFrameSegments(x, y, width, height);
16222
+ case "corner":
16223
+ return cornerSegments(x, y, width, height);
16224
+ case "diagStripe":
16225
+ return polygon([
16226
+ [x + width * 0.25, y],
16227
+ [right, y],
16228
+ [right - width * 0.25, bottom],
16229
+ [x, bottom]
16230
+ ]);
16231
+ case "plaque":
16232
+ return plaqueSegments(x, y, width, height);
16233
+ case "plaqueTabs":
16234
+ case "squareTabs":
16235
+ case "cornerTabs":
16236
+ return tabbedRectSegments(preset, x, y, width, height);
16237
+ case "irregularSeal1":
16238
+ return starSegments(cx, cy, width * 0.48, height * 0.48, 18, 0.78);
16239
+ case "irregularSeal2":
16240
+ return starSegments(cx, cy, width * 0.48, height * 0.48, 14, 0.68);
16241
+ case "gear6":
16242
+ return starSegments(cx, cy, width * 0.48, height * 0.48, 12, 0.76);
16243
+ case "gear9":
16244
+ return starSegments(cx, cy, width * 0.48, height * 0.48, 18, 0.76);
16245
+ case "funnel":
16246
+ return polygon([
16247
+ [x, y],
16248
+ [right, y],
16249
+ [x + width * 0.6, y + height * 0.56],
16250
+ [x + width * 0.6, bottom],
16251
+ [x + width * 0.4, bottom],
16252
+ [x + width * 0.4, y + height * 0.56]
16253
+ ]);
16254
+ case "leftBrace":
16255
+ case "rightBrace":
16256
+ case "bracePair":
16257
+ return braceSegments(preset, x, y, width, height);
16258
+ case "leftBracket":
16259
+ case "rightBracket":
16260
+ case "bracketPair":
16261
+ return bracketSegments(preset, x, y, width, height);
16262
+ case "mathPlus":
16263
+ return plusSegments(x, y, width, height);
16264
+ case "mathMinus":
16265
+ return polygon([
16266
+ [x, y + height * 0.42],
16267
+ [right, y + height * 0.42],
16268
+ [right, y + height * 0.58],
16269
+ [x, y + height * 0.58]
16270
+ ]);
16271
+ case "mathMultiply":
16272
+ return xSegments(x, y, width, height);
16273
+ case "mathDivide":
16274
+ return mathDivideSegments(x, y, width, height);
16275
+ case "mathEqual":
16276
+ return mathEqualSegments(x, y, width, height);
16277
+ case "mathNotEqual":
16278
+ return mathNotEqualSegments(x, y, width, height);
16279
+ case "chartPlus":
16280
+ return plusSegments(x, y, width, height);
16281
+ case "chartX":
16282
+ return xSegments(x, y, width, height);
16283
+ case "chartStar":
16284
+ return starSegments(cx, cy, width * 0.48, height * 0.48, 5);
16285
+ case "ribbon":
16286
+ case "ribbon2":
16287
+ case "ellipseRibbon":
16288
+ case "ellipseRibbon2":
16289
+ case "leftRightRibbon":
16290
+ return ribbonSegments(preset, x, y, width, height);
16291
+ case "verticalScroll":
16292
+ case "horizontalScroll":
16293
+ return scrollSegments(preset, x, y, width, height);
16294
+ case "wave":
16295
+ case "doubleWave":
16296
+ return waveSegments(preset, x, y, width, height);
16297
+ case "rect":
16298
+ default:
16299
+ return rectSegments(x, y, width, height);
16300
+ }
16301
+ }
16302
+ function getPresetPathSegments(preset, x, y, width, height) {
16303
+ const key = isPresetGeometrySupported(preset) ? preset : "rect";
16304
+ return resolvePresetPathSegments(key, x, y, width, height);
16305
+ }
14950
16306
  function buildPresetPath(preset, x, y, width, height) {
14951
16307
  const path = new Path2D();
14952
16308
  for (const segment of getPresetPathSegments(preset, x, y, width, height)) {
@@ -32066,10 +33422,6 @@ async function parseTextBox(drawing, parseNestedBlocks) {
32066
33422
  if (!wsp) {
32067
33423
  return void 0;
32068
33424
  }
32069
- const txbxContent = findElementDeep(wsp, "txbxContent");
32070
- if (!txbxContent) {
32071
- return void 0;
32072
- }
32073
33425
  const container = findDrawingContainer(drawing);
32074
33426
  const drawingBox = (container == null ? void 0 : container.element) ?? drawing;
32075
33427
  const extent = findElementDeep(drawingBox, "extent");
@@ -32079,7 +33431,8 @@ async function parseTextBox(drawing, parseNestedBlocks) {
32079
33431
  const name = docPr ? getAttributeValue(docPr, "name") : null;
32080
33432
  const alt = docPr ? getAttributeValue(docPr, "descr") ?? getAttributeValue(docPr, "title") : null;
32081
33433
  const floating = (container == null ? void 0 : container.kind) === "anchor" ? parseFloatingLayout(container.element) : void 0;
32082
- const blocks = parseNestedBlocks ? await parseNestedBlocks(txbxContent) : [];
33434
+ const txbxContent = findElementDeep(wsp, "txbxContent");
33435
+ const blocks = txbxContent && parseNestedBlocks ? await parseNestedBlocks(txbxContent) : [];
32083
33436
  const shape = parseTextBoxShape(wsp);
32084
33437
  const body = parseTextBoxBody(wsp);
32085
33438
  const rotation = parseTextBoxRotation(wsp);
@@ -34437,7 +35790,7 @@ function importDocxInWorker(buffer, options = {}) {
34437
35790
  const worker = new Worker(
34438
35791
  new URL(
34439
35792
  /* @vite-ignore */
34440
- "" + new URL("assets/importDocxWorker-D4P4_drI.js", import.meta.url).href,
35793
+ "" + new URL("assets/importDocxWorker-DcrboJNQ.js", import.meta.url).href,
34441
35794
  import.meta.url
34442
35795
  ),
34443
35796
  {