@floless/app 0.98.0 → 0.99.0

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.
@@ -41030,15 +41030,15 @@ var require_escape_html = __commonJS({
41030
41030
  var require_dist5 = __commonJS({
41031
41031
  "node_modules/@lukeed/ms/dist/index.js"(exports2) {
41032
41032
  var RGX = /^(-?(?:\d+)?\.?\d+) *(m(?:illiseconds?|s(?:ecs?)?))?(s(?:ec(?:onds?|s)?)?)?(m(?:in(?:utes?|s)?)?)?(h(?:ours?|rs?)?)?(d(?:ays?)?)?(w(?:eeks?|ks?)?)?(y(?:ears?|rs?)?)?$/;
41033
- var SEC = 1e3;
41034
- var MIN = SEC * 60;
41033
+ var SEC2 = 1e3;
41034
+ var MIN = SEC2 * 60;
41035
41035
  var HOUR = MIN * 60;
41036
41036
  var DAY = HOUR * 24;
41037
41037
  var YEAR = DAY * 365.25;
41038
41038
  function parse(val) {
41039
41039
  var num4, arr = val.toLowerCase().match(RGX);
41040
41040
  if (arr != null && (num4 = parseFloat(arr[1]))) {
41041
- if (arr[3] != null) return num4 * SEC;
41041
+ if (arr[3] != null) return num4 * SEC2;
41042
41042
  if (arr[4] != null) return num4 * MIN;
41043
41043
  if (arr[5] != null) return num4 * HOUR;
41044
41044
  if (arr[6] != null) return num4 * DAY;
@@ -41053,8 +41053,8 @@ var require_dist5 = __commonJS({
41053
41053
  }
41054
41054
  function format(num4, long) {
41055
41055
  var pfx = num4 < 0 ? "-" : "", abs = num4 < 0 ? -num4 : num4;
41056
- if (abs < SEC) return num4 + (long ? " ms" : "ms");
41057
- if (abs < MIN) return fmt(abs / SEC, pfx, "second", long);
41056
+ if (abs < SEC2) return num4 + (long ? " ms" : "ms");
41057
+ if (abs < MIN) return fmt(abs / SEC2, pfx, "second", long);
41058
41058
  if (abs < HOUR) return fmt(abs / MIN, pfx, "minute", long);
41059
41059
  if (abs < DAY) return fmt(abs / HOUR, pfx, "hour", long);
41060
41060
  if (abs < YEAR) return fmt(abs / DAY, pfx, "day", long);
@@ -53106,7 +53106,7 @@ function appVersion() {
53106
53106
  return resolveVersion({
53107
53107
  isSea: isSea2(),
53108
53108
  sqVersionXml: readSqVersionXml(),
53109
- define: true ? "0.98.0" : void 0,
53109
+ define: true ? "0.99.0" : void 0,
53110
53110
  pkgVersion: readPkgVersion()
53111
53111
  });
53112
53112
  }
@@ -53116,7 +53116,7 @@ function resolveChannel(s) {
53116
53116
  return "dev";
53117
53117
  }
53118
53118
  function appChannel() {
53119
- return resolveChannel({ isSea: isSea2(), define: true ? "0.98.0" : void 0 });
53119
+ return resolveChannel({ isSea: isSea2(), define: true ? "0.99.0" : void 0 });
53120
53120
  }
53121
53121
 
53122
53122
  // workflow-update.ts
@@ -53480,6 +53480,60 @@ function extractSavedPath(events) {
53480
53480
  // aisc-shapes.json
53481
53481
  var aisc_shapes_default = { "C10X15.3": 2.6, C10X20: 2.74, C10X25: 2.89, C10X30: 3.03, "C12X20.7": 2.94, C12X25: 3.05, C12X30: 3.17, "C15X33.9": 3.4, C15X40: 3.52, C15X50: 3.72, "C3X3.5": 1.37, "C3X4.1": 1.41, C3X5: 1.5, C3X6: 1.6, "C4X4.5": 1.52, "C4X5.4": 1.58, "C4X6.25": 1.65, "C4X7.25": 1.72, "C5X6.7": 1.75, C5X9: 1.89, "C6X10.5": 2.03, C6X13: 2.16, "C6X8.2": 1.92, "C7X12.25": 2.19, "C7X14.75": 2.3, "C7X9.8": 2.09, "C8X11.5": 2.26, "C8X13.75": 2.34, "C8X18.75": 2.53, "C9X13.4": 2.43, C9X15: 2.49, C9X20: 2.65, HP10X42: 10.1, HP10X57: 10.2, HP12X53: 12, HP12X63: 12.1, HP12X74: 12.2, HP12X84: 12.3, HP12X89: 12.3, HP14X102: 14.8, HP14X117: 14.9, HP14X73: 14.6, HP14X89: 14.7, HP16X101: 15.8, HP16X121: 15.9, HP16X141: 16, HP16X162: 16.1, HP16X183: 16.3, HP16X88: 15.7, HP18X135: 17.8, HP18X157: 17.9, HP18X181: 18, HP18X204: 18.1, HP8X36: 8.16, "M10X7.5": 2.69, M10X8: 2.69, M10X9: 2.69, "M12.5X11.6": 3.5, "M12.5X12.4": 3.75, M12X10: 3.25, "M12X10.8": 3.07, "M12X11.8": 3.07, "M3X2.9": 2.25, "M4X3.2": 2.25, "M4X3.45": 2.25, "M4X4.08": 2.25, M4X6: 3.8, "M5X18.9": 5, "M6X3.7": 2, "M6X4.4": 1.84, "M8X6.2": 2.28, "M8X6.5": 2.28, MC10X22: 3.32, MC10X25: 3.41, "MC10X28.5": 3.95, "MC10X33.6": 4.1, "MC10X41.1": 4.32, "MC10X6.5": 1.17, "MC10X8.4": 1.5, "MC12X10.6": 1.5, "MC12X14.3": 2.12, MC12X31: 3.67, MC12X35: 3.77, MC12X40: 3.89, MC12X45: 4.01, MC12X50: 4.14, "MC13X31.8": 4, MC13X35: 4.07, MC13X40: 4.19, MC13X50: 4.41, "MC18X42.7": 3.95, "MC18X45.8": 4, "MC18X51.9": 4.1, MC18X58: 4.2, "MC3X7.1": 1.94, "MC4X13.8": 2.5, MC6X12: 2.5, "MC6X15.1": 2.94, "MC6X15.3": 3.5, "MC6X16.3": 3, MC6X18: 3.5, "MC6X6.5": 1.85, MC6X7: 1.88, "MC7X19.1": 3.45, "MC7X22.7": 3.6, "MC8X18.7": 2.98, MC8X20: 3.03, "MC8X21.4": 3.45, "MC8X22.8": 3.5, "MC8X8.5": 1.87, "MC9X23.9": 3.45, "MC9X25.4": 3.5, "MT2.5X9.45": 5, MT2X3: 3.8, "MT3X1.85": 2, "MT3X2.2": 1.84, "MT4X3.1": 2.28, "MT4X3.25": 2.28, "MT5X3.75": 2.69, MT5X4: 2.69, "MT5X4.5": 2.69, "MT6.25X5.8": 3.5, "MT6.25X6.2": 3.75, MT6X5: 3.25, "MT6X5.4": 3.07, "MT6X5.9": 3.07, "S10X25.4": 4.66, S10X35: 4.94, "S12X31.8": 5, S12X35: 5.08, "S12X40.8": 5.25, S12X50: 5.48, "S15X42.9": 5.5, S15X50: 5.64, "S18X54.7": 6, S18X70: 6.25, S20X66: 6.26, S20X75: 6.39, S20X86: 7.06, S20X96: 7.2, S24X100: 7.25, S24X106: 7.87, S24X121: 8.05, S24X80: 7, S24X90: 7.13, "S3X5.7": 2.33, "S3X7.5": 2.51, "S4X7.7": 2.66, "S4X9.5": 2.8, S5X10: 3, "S6X12.5": 3.33, "S6X17.25": 3.57, "S8X18.4": 4, S8X23: 4.17, "ST1.5X2.85": 2.33, "ST1.5X3.75": 2.51, ST10X33: 6.26, "ST10X37.5": 6.39, ST10X43: 7.06, ST10X48: 7.2, ST12X40: 7, ST12X45: 7.13, ST12X50: 7.25, ST12X53: 7.87, "ST12X60.5": 8.05, "ST2.5X5": 3, "ST2X3.85": 2.66, "ST2X4.75": 2.8, "ST3X6.25": 3.33, "ST3X8.6": 3.57, "ST4X11.5": 4.17, "ST4X9.2": 4, "ST5X12.7": 4.66, "ST5X17.5": 4.94, "ST6X15.9": 5, "ST6X17.5": 5.08, "ST6X20.4": 5.25, ST6X25: 5.48, "ST7.5X21.45": 5.5, "ST7.5X25": 5.64, "ST9X27.35": 6, ST9X35: 6.25, W10X100: 10.3, W10X112: 10.4, W10X12: 3.96, W10X15: 4, W10X17: 4.01, W10X19: 4.02, W10X22: 5.75, W10X26: 5.77, W10X30: 5.81, W10X33: 7.96, W10X39: 7.99, W10X45: 8.02, W10X49: 10, W10X54: 10, W10X60: 10.1, W10X68: 10.1, W10X77: 10.2, W10X88: 10.3, W12X106: 12.2, W12X120: 12.3, W12X136: 12.4, W12X14: 3.97, W12X152: 12.5, W12X16: 3.99, W12X170: 12.6, W12X19: 4.01, W12X190: 12.7, W12X210: 12.8, W12X22: 4.03, W12X230: 12.9, W12X252: 13, W12X26: 6.49, W12X279: 13.1, W12X30: 6.52, W12X305: 13.2, W12X336: 13.4, W12X35: 6.56, W12X40: 8.01, W12X45: 8.05, W12X50: 8.08, W12X53: 10, W12X58: 10, W12X65: 12, W12X72: 12, W12X79: 12.1, W12X87: 12.1, W12X96: 12.2, W14X109: 14.6, W14X120: 14.7, W14X132: 14.7, W14X145: 15.5, W14X159: 15.6, W14X176: 15.7, W14X193: 15.7, W14X211: 15.8, W14X22: 5, W14X233: 15.9, W14X257: 16, W14X26: 5.03, W14X283: 16.1, W14X30: 6.73, W14X311: 16.2, W14X34: 6.75, W14X342: 16.4, W14X370: 16.5, W14X38: 6.77, W14X398: 16.6, W14X426: 16.7, W14X43: 8, W14X455: 16.8, W14X48: 8.03, W14X500: 17, W14X53: 8.06, W14X550: 17.2, W14X605: 17.4, W14X61: 10, W14X665: 17.7, W14X68: 10, W14X730: 17.9, W14X74: 10.1, W14X808: 18.6, W14X82: 10.1, W14X873: 18.8, W14X90: 14.5, W14X99: 14.6, W16X100: 10.4, W16X26: 5.5, W16X31: 5.53, W16X36: 6.99, W16X40: 7, W16X45: 7.04, W16X50: 7.07, W16X57: 7.12, W16X67: 10.2, W16X77: 10.3, W16X89: 10.4, W18X106: 11.2, W18X119: 11.3, W18X130: 11.2, W18X143: 11.2, W18X158: 11.3, W18X175: 11.4, W18X192: 11.5, W18X211: 11.6, W18X234: 11.7, W18X258: 11.8, W18X283: 11.9, W18X311: 12, W18X35: 6, W18X40: 6.02, W18X46: 6.06, W18X50: 7.5, W18X55: 7.53, W18X60: 7.56, W18X65: 7.59, W18X71: 7.64, W18X76: 11, W18X86: 11.1, W18X97: 11.1, W21X101: 12.3, W21X111: 12.3, W21X122: 12.4, W21X132: 12.4, W21X147: 12.5, W21X166: 12.4, W21X182: 12.5, W21X201: 12.6, W21X223: 12.7, W21X248: 12.8, W21X275: 12.9, W21X44: 6.5, W21X48: 8.14, W21X50: 6.53, W21X55: 8.22, W21X57: 6.56, W21X62: 8.24, W21X68: 8.27, W21X73: 8.3, W21X83: 8.36, W21X93: 8.42, W24X103: 9, W24X104: 12.8, W24X117: 12.8, W24X131: 12.9, W24X146: 12.9, W24X162: 13, W24X176: 12.9, W24X192: 13, W24X207: 13, W24X229: 13.1, W24X250: 13.2, W24X279: 13.3, W24X306: 13.4, W24X335: 13.5, W24X370: 13.7, W24X55: 7.01, W24X62: 7.04, W24X68: 8.97, W24X76: 8.99, W24X84: 9.02, W24X94: 9.07, W27X102: 10, W27X114: 10.1, W27X129: 10, W27X146: 14, W27X161: 14, W27X178: 14.1, W27X194: 14, W27X217: 14.1, W27X235: 14.2, W27X258: 14.3, W27X281: 14.4, W27X307: 14.4, W27X336: 14.6, W27X368: 14.7, W27X539: 15.3, W27X84: 10, W27X94: 10, W30X108: 10.5, W30X116: 10.5, W30X124: 10.5, W30X132: 10.5, W30X148: 10.5, W30X173: 15, W30X191: 15, W30X211: 15.1, W30X235: 15.1, W30X261: 15.2, W30X292: 15.3, W30X326: 15.4, W30X357: 15.5, W30X391: 15.6, W30X90: 10.4, W30X99: 10.5, W33X118: 11.5, W33X130: 11.5, W33X141: 11.5, W33X152: 11.6, W33X169: 11.5, W33X201: 15.7, W33X221: 15.8, W33X241: 15.9, W33X263: 15.8, W33X291: 15.9, W33X318: 16, W33X354: 16.1, W33X387: 16.2, W36X135: 12, W36X150: 12, W36X160: 12, W36X170: 12, W36X182: 12.1, W36X194: 12.1, W36X210: 12.2, W36X231: 16.5, W36X232: 12.1, W36X247: 16.5, W36X256: 12.2, W36X262: 16.6, W36X282: 16.6, W36X302: 16.7, W36X330: 16.6, W36X361: 16.7, W36X395: 16.8, W36X441: 17, W36X487: 17.1, W36X529: 17.2, W36X652: 17.6, W36X723: 17.8, W36X802: 18, W36X853: 18.2, W36X925: 18.6, W40X149: 11.8, W40X167: 11.8, W40X183: 11.8, W40X199: 15.8, W40X211: 11.8, W40X215: 15.8, W40X235: 11.9, W40X249: 15.8, W40X264: 11.9, W40X277: 15.8, W40X278: 12, W40X294: 12, W40X297: 15.8, W40X324: 15.9, W40X327: 12.1, W40X331: 12.2, W40X362: 16, W40X372: 16.1, W40X392: 12.4, W40X397: 16.1, W40X431: 16.2, W40X503: 16.4, W40X593: 16.7, W40X655: 16.9, W44X230: 15.8, W44X262: 15.8, W44X290: 15.8, W44X335: 15.9, W4X13: 4.06, W5X16: 5, W5X19: 5.03, W6X12: 4, W6X15: 5.99, W6X16: 4.03, W6X20: 6.02, W6X25: 6.08, "W6X8.5": 3.94, W6X9: 3.94, W8X10: 3.94, W8X13: 4, W8X15: 4.02, W8X18: 5.25, W8X21: 5.27, W8X24: 6.5, W8X28: 6.54, W8X31: 8, W8X35: 8.02, W8X40: 8.07, W8X48: 8.11, W8X58: 8.22, W8X67: 8.28, "WT10.5X100.5": 12.6, "WT10.5X111.5": 12.7, "WT10.5X124": 12.8, "WT10.5X137.5": 12.9, "WT10.5X22": 6.5, "WT10.5X24": 8.14, "WT10.5X25": 6.53, "WT10.5X27.5": 8.22, "WT10.5X28.5": 6.56, "WT10.5X31": 8.24, "WT10.5X34": 8.27, "WT10.5X36.5": 8.3, "WT10.5X41.5": 8.36, "WT10.5X46.5": 8.42, "WT10.5X50.5": 12.3, "WT10.5X55.5": 12.3, "WT10.5X61": 12.4, "WT10.5X66": 12.4, "WT10.5X73.5": 12.5, "WT10.5X83": 12.4, "WT10.5X91": 12.5, "WT12X103.5": 13, "WT12X114.5": 13.1, WT12X125: 13.2, "WT12X139.5": 13.3, WT12X153: 13.4, "WT12X167.5": 13.5, WT12X185: 13.7, "WT12X27.5": 7.01, WT12X31: 7.04, WT12X34: 8.97, WT12X38: 8.99, WT12X42: 9.02, WT12X47: 9.07, "WT12X51.5": 9, WT12X52: 12.8, "WT12X58.5": 12.8, "WT12X65.5": 12.9, WT12X73: 12.9, WT12X81: 13, WT12X88: 12.9, WT12X96: 13, "WT13.5X108.5": 14.1, "WT13.5X117.5": 14.2, "WT13.5X129": 14.3, "WT13.5X140.5": 14.4, "WT13.5X153.5": 14.4, "WT13.5X168": 14.6, "WT13.5X184": 14.7, "WT13.5X269.5": 15.3, "WT13.5X42": 10, "WT13.5X47": 10, "WT13.5X51": 10, "WT13.5X57": 10.1, "WT13.5X64.5": 10, "WT13.5X73": 14, "WT13.5X80.5": 14, "WT13.5X89": 14.1, "WT13.5X97": 14, "WT15X105.5": 15.1, "WT15X117.5": 15.1, "WT15X130.5": 15.2, WT15X146: 15.3, WT15X163: 15.4, "WT15X178.5": 15.5, "WT15X195.5": 15.6, WT15X45: 10.4, "WT15X49.5": 10.5, WT15X54: 10.5, WT15X58: 10.5, WT15X62: 10.5, WT15X66: 10.5, WT15X74: 10.5, "WT15X86.5": 15, "WT15X95.5": 15, "WT16.5X100.5": 15.7, "WT16.5X110.5": 15.8, "WT16.5X120.5": 15.9, "WT16.5X131.5": 15.8, "WT16.5X145.5": 15.9, "WT16.5X159": 16, "WT16.5X177": 16.1, "WT16.5X193.5": 16.2, "WT16.5X59": 11.5, "WT16.5X65": 11.5, "WT16.5X70.5": 11.5, "WT16.5X76": 11.6, "WT16.5X84.5": 11.5, WT18X105: 12.2, "WT18X115.5": 16.5, WT18X116: 12.1, "WT18X123.5": 16.5, WT18X128: 12.2, WT18X131: 16.6, WT18X141: 16.6, WT18X151: 16.7, WT18X165: 16.6, "WT18X180.5": 16.7, "WT18X197.5": 16.8, "WT18X220.5": 17, "WT18X243.5": 17.1, "WT18X264.5": 17.2, WT18X326: 17.6, "WT18X361.5": 17.8, WT18X401: 18, "WT18X426.5": 18.2, "WT18X462.5": 18.6, "WT18X67.5": 12, WT18X75: 12, WT18X80: 12, WT18X85: 12, WT18X91: 12.1, WT18X97: 12.1, "WT2.5X8": 5, "WT2.5X9.5": 5.03, "WT20X105.5": 11.8, "WT20X107.5": 15.8, "WT20X117.5": 11.9, "WT20X124.5": 15.8, WT20X132: 11.9, "WT20X138.5": 15.8, WT20X139: 12, WT20X147: 12, "WT20X148.5": 15.8, WT20X162: 15.9, "WT20X163.5": 12.1, "WT20X165.5": 12.2, WT20X181: 16, WT20X186: 16.1, WT20X196: 12.4, "WT20X198.5": 16.1, "WT20X215.5": 16.2, "WT20X251.5": 16.4, "WT20X296.5": 16.7, "WT20X327.5": 16.9, "WT20X74.5": 11.8, "WT20X83.5": 11.8, "WT20X91.5": 11.8, "WT20X99.5": 15.8, WT22X115: 15.8, WT22X131: 15.8, WT22X145: 15.8, "WT22X167.5": 15.9, "WT2X6.5": 4.06, WT3X10: 6.02, "WT3X12.5": 6.08, "WT3X4.25": 3.94, "WT3X4.5": 3.94, WT3X6: 4, "WT3X7.5": 5.99, WT3X8: 4.03, "WT4X10.5": 5.27, WT4X12: 6.5, WT4X14: 6.54, "WT4X15.5": 8, "WT4X17.5": 8.02, WT4X20: 8.07, WT4X24: 8.11, WT4X29: 8.22, "WT4X33.5": 8.28, WT4X5: 3.94, "WT4X6.5": 4, "WT4X7.5": 4.02, WT4X9: 5.25, WT5X11: 5.75, WT5X13: 5.77, WT5X15: 5.81, "WT5X16.5": 7.96, "WT5X19.5": 7.99, "WT5X22.5": 8.02, "WT5X24.5": 10, WT5X27: 10, WT5X30: 10.1, WT5X34: 10.1, "WT5X38.5": 10.2, WT5X44: 10.3, WT5X50: 10.3, WT5X56: 10.4, WT5X6: 3.96, "WT5X7.5": 4, "WT5X8.5": 4.01, "WT5X9.5": 4.02, WT6X105: 12.8, WT6X11: 4.03, WT6X115: 12.9, WT6X126: 13, WT6X13: 6.49, "WT6X139.5": 13.1, WT6X15: 6.52, "WT6X152.5": 13.2, WT6X168: 13.4, "WT6X17.5": 6.56, WT6X20: 8.01, "WT6X22.5": 8.05, WT6X25: 8.08, "WT6X26.5": 10, WT6X29: 10, "WT6X32.5": 12, WT6X36: 12, "WT6X39.5": 12.1, "WT6X43.5": 12.1, WT6X48: 12.2, WT6X53: 12.2, WT6X60: 12.3, WT6X68: 12.4, WT6X7: 3.97, WT6X76: 12.5, WT6X8: 3.99, WT6X85: 12.6, "WT6X9.5": 4.01, WT6X95: 12.7, "WT7X105.5": 15.8, WT7X11: 5, "WT7X116.5": 15.9, "WT7X128.5": 16, WT7X13: 5.03, "WT7X141.5": 16.1, WT7X15: 6.73, "WT7X155.5": 16.2, WT7X17: 6.75, WT7X171: 16.4, WT7X185: 16.5, WT7X19: 6.77, WT7X199: 16.6, "WT7X21.5": 8, WT7X213: 16.7, "WT7X227.5": 16.8, WT7X24: 8.03, WT7X250: 17, "WT7X26.5": 8.06, WT7X275: 17.2, "WT7X30.5": 10, "WT7X302.5": 17.4, "WT7X332.5": 17.7, WT7X34: 10, WT7X365: 17.9, WT7X37: 10.1, WT7X404: 18.6, WT7X41: 10.1, "WT7X436.5": 18.8, WT7X45: 14.5, "WT7X49.5": 14.6, "WT7X54.5": 14.6, WT7X60: 14.7, WT7X66: 14.7, "WT7X72.5": 15.5, "WT7X79.5": 15.6, WT7X88: 15.7, "WT7X96.5": 15.7, WT8X13: 5.5, "WT8X15.5": 5.53, WT8X18: 6.99, WT8X20: 7, "WT8X22.5": 7.04, WT8X25: 7.07, "WT8X28.5": 7.12, "WT8X33.5": 10.2, "WT8X38.5": 10.3, "WT8X44.5": 10.4, WT8X50: 10.4, "WT9X105.5": 11.6, WT9X117: 11.7, WT9X129: 11.8, "WT9X141.5": 11.9, "WT9X155.5": 12, "WT9X17.5": 6, WT9X20: 6.02, WT9X23: 6.06, WT9X25: 7.5, "WT9X27.5": 7.53, WT9X30: 7.56, "WT9X32.5": 7.59, "WT9X35.5": 7.64, WT9X38: 11, WT9X43: 11.1, "WT9X48.5": 11.1, WT9X53: 11.2, "WT9X59.5": 11.3, WT9X65: 11.2, "WT9X71.5": 11.2, WT9X79: 11.3, "WT9X87.5": 11.4, WT9X96: 11.5 };
53482
53482
 
53483
+ // aisc-sections.json
53484
+ var aisc_sections_default = { _comment: "AISC v15 section dims in INCHES for I/channel/tee shapes: [depth d, width bf, web tw, flange tf]. Generated from steel-detailer-us/rules/aisc-shapes-v15.json. Used for ACTUAL section depth (2D+3D+IFC) and the IFC parametric profile web/flange thickness.", "C10X15.3": [10, 2.6, 0.24, 0.436], C10X20: [10, 2.74, 0.379, 0.436], C10X25: [10, 2.89, 0.526, 0.436], C10X30: [10, 3.03, 0.673, 0.436], "C12X20.7": [12, 2.94, 0.282, 0.501], C12X25: [12, 3.05, 0.387, 0.501], C12X30: [12, 3.17, 0.51, 0.501], "C15X33.9": [15, 3.4, 0.4, 0.65], C15X40: [15, 3.52, 0.52, 0.65], C15X50: [15, 3.72, 0.716, 0.65], "C3X3.5": [3, 1.37, 0.132, 0.273], "C3X4.1": [3, 1.41, 0.17, 0.273], C3X5: [3, 1.5, 0.258, 0.273], C3X6: [3, 1.6, 0.356, 0.273], "C4X4.5": [4, 1.52, 0.125, 0.296], "C4X5.4": [4, 1.58, 0.184, 0.296], "C4X6.25": [4, 1.65, 0.247, 0.296], "C4X7.25": [4, 1.72, 0.321, 0.296], "C5X6.7": [5, 1.75, 0.19, 0.32], C5X9: [5, 1.89, 0.325, 0.32], "C6X10.5": [6, 2.03, 0.314, 0.343], C6X13: [6, 2.16, 0.437, 0.343], "C6X8.2": [6, 1.92, 0.2, 0.343], "C7X12.25": [7, 2.19, 0.314, 0.366], "C7X14.75": [7, 2.3, 0.419, 0.366], "C7X9.8": [7, 2.09, 0.21, 0.366], "C8X11.5": [8, 2.26, 0.22, 0.39], "C8X13.75": [8, 2.34, 0.303, 0.39], "C8X18.75": [8, 2.53, 0.487, 0.39], "C9X13.4": [9, 2.43, 0.233, 0.413], C9X15: [9, 2.49, 0.285, 0.413], C9X20: [9, 2.65, 0.448, 0.413], HP10X42: [9.7, 10.1, 0.415, 0.42], HP10X57: [9.99, 10.2, 0.565, 0.565], HP12X53: [11.8, 12, 0.435, 0.435], HP12X63: [11.9, 12.1, 0.515, 0.515], HP12X74: [12.1, 12.2, 0.605, 0.61], HP12X84: [12.3, 12.3, 0.685, 0.685], HP12X89: [12.4, 12.3, 0.72, 0.72], HP14X102: [14, 14.8, 0.705, 0.705], HP14X117: [14.2, 14.9, 0.805, 0.805], HP14X73: [13.6, 14.6, 0.505, 0.505], HP14X89: [13.8, 14.7, 0.615, 0.615], HP16X101: [15.5, 15.8, 0.625, 0.625], HP16X121: [15.8, 15.9, 0.75, 0.75], HP16X141: [16, 16, 0.875, 0.875], HP16X162: [16.3, 16.1, 1, 1], HP16X183: [16.5, 16.3, 1.13, 1.13], HP16X88: [15.3, 15.7, 0.54, 0.54], HP18X135: [17.5, 17.8, 0.75, 0.75], HP18X157: [17.7, 17.9, 0.87, 0.87], HP18X181: [18, 18, 1, 1], HP18X204: [18.3, 18.1, 1.13, 1.13], HP8X36: [8.02, 8.16, 0.445, 0.445], "M10X7.5": [9.99, 2.69, 0.13, 0.173], M10X8: [9.95, 2.69, 0.141, 0.182], M10X9: [10, 2.69, 0.157, 0.206], "M12.5X11.6": [12.5, 3.5, 0.155, 0.211], "M12.5X12.4": [12.5, 3.75, 0.155, 0.228], M12X10: [12, 3.25, 0.149, 0.18], "M12X10.8": [12, 3.07, 0.16, 0.21], "M12X11.8": [12, 3.07, 0.177, 0.225], "M3X2.9": [3, 2.25, 0.09, 0.13], "M4X3.2": [4, 2.25, 0.092, 0.13], "M4X3.45": [4, 2.25, 0.092, 0.13], "M4X4.08": [4, 2.25, 0.115, 0.17], M4X6: [3.8, 3.8, 0.13, 0.16], "M5X18.9": [5, 5, 0.316, 0.416], "M6X3.7": [5.92, 2, 0.098, 0.129], "M6X4.4": [6, 1.84, 0.114, 0.171], "M8X6.2": [8, 2.28, 0.129, 0.177], "M8X6.5": [8, 2.28, 0.135, 0.189], MC10X22: [10, 3.32, 0.29, 0.575], MC10X25: [10, 3.41, 0.38, 0.575], "MC10X28.5": [10, 3.95, 0.425, 0.575], "MC10X33.6": [10, 4.1, 0.575, 0.575], "MC10X41.1": [10, 4.32, 0.796, 0.575], "MC10X6.5": [10, 1.17, 0.152, 0.202], "MC10X8.4": [10, 1.5, 0.17, 0.28], "MC12X10.6": [12, 1.5, 0.19, 0.309], "MC12X14.3": [12, 2.12, 0.25, 0.313], MC12X31: [12, 3.67, 0.37, 0.7], MC12X35: [12, 3.77, 0.465, 0.7], MC12X40: [12, 3.89, 0.59, 0.7], MC12X45: [12, 4.01, 0.71, 0.7], MC12X50: [12, 4.14, 0.835, 0.7], "MC13X31.8": [13, 4, 0.375, 0.61], MC13X35: [13, 4.07, 0.447, 0.61], MC13X40: [13, 4.19, 0.56, 0.61], MC13X50: [13, 4.41, 0.787, 0.61], "MC18X42.7": [18, 3.95, 0.45, 0.625], "MC18X45.8": [18, 4, 0.5, 0.625], "MC18X51.9": [18, 4.1, 0.6, 0.625], MC18X58: [18, 4.2, 0.7, 0.625], "MC3X7.1": [3, 1.94, 0.312, 0.351], "MC4X13.8": [4, 2.5, 0.5, 0.5], MC6X12: [6, 2.5, 0.31, 0.375], "MC6X15.1": [6, 2.94, 0.316, 0.475], "MC6X15.3": [6, 3.5, 0.34, 0.385], "MC6X16.3": [6, 3, 0.375, 0.475], MC6X18: [6, 3.5, 0.379, 0.475], "MC6X6.5": [6, 1.85, 0.155, 0.291], MC6X7: [6, 1.88, 0.179, 0.291], "MC7X19.1": [7, 3.45, 0.352, 0.5], "MC7X22.7": [7, 3.6, 0.503, 0.5], "MC8X18.7": [8, 2.98, 0.353, 0.5], MC8X20: [8, 3.03, 0.4, 0.5], "MC8X21.4": [8, 3.45, 0.375, 0.525], "MC8X22.8": [8, 3.5, 0.427, 0.525], "MC8X8.5": [8, 1.87, 0.179, 0.311], "MC9X23.9": [9, 3.45, 0.4, 0.55], "MC9X25.4": [9, 3.5, 0.45, 0.55], "MT2.5X9.45": [2.5, 5, 0.316, 0.416], MT2X3: [1.9, 3.8, 0.13, 0.16], "MT3X1.85": [2.96, 2, 0.098, 0.129], "MT3X2.2": [3, 1.84, 0.114, 0.171], "MT4X3.1": [4, 2.28, 0.129, 0.177], "MT4X3.25": [4, 2.28, 0.135, 0.189], "MT5X3.75": [5, 2.69, 0.13, 0.173], MT5X4: [4.98, 2.69, 0.141, 0.182], "MT5X4.5": [5, 2.69, 0.157, 0.206], "MT6.25X5.8": [6.25, 3.5, 0.155, 0.211], "MT6.25X6.2": [6.27, 3.75, 0.155, 0.228], MT6X5: [5.99, 3.25, 0.149, 0.18], "MT6X5.4": [5.99, 3.07, 0.16, 0.21], "MT6X5.9": [6, 3.07, 0.177, 0.225], "S10X25.4": [10, 4.66, 0.311, 0.491], S10X35: [10, 4.94, 0.594, 0.491], "S12X31.8": [12, 5, 0.35, 0.544], S12X35: [12, 5.08, 0.428, 0.544], "S12X40.8": [12, 5.25, 0.462, 0.659], S12X50: [12, 5.48, 0.687, 0.659], "S15X42.9": [15, 5.5, 0.411, 0.622], S15X50: [15, 5.64, 0.55, 0.622], "S18X54.7": [18, 6, 0.461, 0.691], S18X70: [18, 6.25, 0.711, 0.691], S20X66: [20, 6.26, 0.505, 0.795], S20X75: [20, 6.39, 0.635, 0.795], S20X86: [20.3, 7.06, 0.66, 0.92], S20X96: [20.3, 7.2, 0.8, 0.92], S24X100: [24, 7.25, 0.745, 0.87], S24X106: [24.5, 7.87, 0.62, 1.09], S24X121: [24.5, 8.05, 0.8, 1.09], S24X80: [24, 7, 0.5, 0.87], S24X90: [24, 7.13, 0.625, 0.87], "S3X5.7": [3, 2.33, 0.17, 0.26], "S3X7.5": [3, 2.51, 0.349, 0.26], "S4X7.7": [4, 2.66, 0.193, 0.293], "S4X9.5": [4, 2.8, 0.326, 0.293], S5X10: [5, 3, 0.214, 0.326], "S6X12.5": [6, 3.33, 0.232, 0.359], "S6X17.25": [6, 3.57, 0.465, 0.359], "S8X18.4": [8, 4, 0.271, 0.425], S8X23: [8, 4.17, 0.441, 0.425], "ST1.5X2.85": [1.5, 2.33, 0.17, 0.26], "ST1.5X3.75": [1.5, 2.51, 0.349, 0.26], ST10X33: [10, 6.26, 0.505, 0.795], "ST10X37.5": [10, 6.39, 0.635, 0.795], ST10X43: [10.2, 7.06, 0.66, 0.92], ST10X48: [10.2, 7.2, 0.8, 0.92], ST12X40: [12, 7, 0.5, 0.87], ST12X45: [12, 7.13, 0.625, 0.87], ST12X50: [12, 7.25, 0.745, 0.87], ST12X53: [12.3, 7.87, 0.62, 1.09], "ST12X60.5": [12.3, 8.05, 0.8, 1.09], "ST2.5X5": [2.5, 3, 0.214, 0.326], "ST2X3.85": [2, 2.66, 0.193, 0.293], "ST2X4.75": [2, 2.8, 0.326, 0.293], "ST3X6.25": [3, 3.33, 0.232, 0.359], "ST3X8.6": [3, 3.57, 0.465, 0.359], "ST4X11.5": [4, 4.17, 0.441, 0.425], "ST4X9.2": [4, 4, 0.271, 0.425], "ST5X12.7": [5, 4.66, 0.311, 0.491], "ST5X17.5": [5, 4.94, 0.594, 0.491], "ST6X15.9": [6, 5, 0.35, 0.544], "ST6X17.5": [6, 5.08, 0.428, 0.544], "ST6X20.4": [6, 5.25, 0.462, 0.659], ST6X25: [6, 5.48, 0.687, 0.659], "ST7.5X21.45": [7.5, 5.5, 0.411, 0.622], "ST7.5X25": [7.5, 5.64, 0.55, 0.622], "ST9X27.35": [9, 6, 0.461, 0.691], ST9X35: [9, 6.25, 0.711, 0.691], W10X100: [11.1, 10.3, 0.68, 1.12], W10X112: [11.4, 10.4, 0.755, 1.25], W10X12: [9.87, 3.96, 0.19, 0.21], W10X15: [9.99, 4, 0.23, 0.27], W10X17: [10.1, 4.01, 0.24, 0.33], W10X19: [10.2, 4.02, 0.25, 0.395], W10X22: [10.2, 5.75, 0.24, 0.36], W10X26: [10.3, 5.77, 0.26, 0.44], W10X30: [10.5, 5.81, 0.3, 0.51], W10X33: [9.73, 7.96, 0.29, 0.435], W10X39: [9.92, 7.99, 0.315, 0.53], W10X45: [10.1, 8.02, 0.35, 0.62], W10X49: [10, 10, 0.34, 0.56], W10X54: [10.1, 10, 0.37, 0.615], W10X60: [10.2, 10.1, 0.42, 0.68], W10X68: [10.4, 10.1, 0.47, 0.77], W10X77: [10.6, 10.2, 0.53, 0.87], W10X88: [10.8, 10.3, 0.605, 0.99], W12X106: [12.9, 12.2, 0.61, 0.99], W12X120: [13.1, 12.3, 0.71, 1.11], W12X136: [13.4, 12.4, 0.79, 1.25], W12X14: [11.9, 3.97, 0.2, 0.225], W12X152: [13.7, 12.5, 0.87, 1.4], W12X16: [12, 3.99, 0.22, 0.265], W12X170: [14, 12.6, 0.96, 1.56], W12X19: [12.2, 4.01, 0.235, 0.35], W12X190: [14.4, 12.7, 1.06, 1.74], W12X210: [14.7, 12.8, 1.18, 1.9], W12X22: [12.3, 4.03, 0.26, 0.425], W12X230: [15.1, 12.9, 1.29, 2.07], W12X252: [15.4, 13, 1.4, 2.25], W12X26: [12.2, 6.49, 0.23, 0.38], W12X279: [15.9, 13.1, 1.53, 2.47], W12X30: [12.3, 6.52, 0.26, 0.44], W12X305: [16.3, 13.2, 1.63, 2.71], W12X336: [16.8, 13.4, 1.78, 2.96], W12X35: [12.5, 6.56, 0.3, 0.52], W12X40: [11.9, 8.01, 0.295, 0.515], W12X45: [12.1, 8.05, 0.335, 0.575], W12X50: [12.2, 8.08, 0.37, 0.64], W12X53: [12.1, 10, 0.345, 0.575], W12X58: [12.2, 10, 0.36, 0.64], W12X65: [12.1, 12, 0.39, 0.605], W12X72: [12.3, 12, 0.43, 0.67], W12X79: [12.4, 12.1, 0.47, 0.735], W12X87: [12.5, 12.1, 0.515, 0.81], W12X96: [12.7, 12.2, 0.55, 0.9], W14X109: [14.3, 14.6, 0.525, 0.86], W14X120: [14.5, 14.7, 0.59, 0.94], W14X132: [14.7, 14.7, 0.645, 1.03], W14X145: [14.8, 15.5, 0.68, 1.09], W14X159: [15, 15.6, 0.745, 1.19], W14X176: [15.2, 15.7, 0.83, 1.31], W14X193: [15.5, 15.7, 0.89, 1.44], W14X211: [15.7, 15.8, 0.98, 1.56], W14X22: [13.7, 5, 0.23, 0.335], W14X233: [16, 15.9, 1.07, 1.72], W14X257: [16.4, 16, 1.18, 1.89], W14X26: [13.9, 5.03, 0.255, 0.42], W14X283: [16.7, 16.1, 1.29, 2.07], W14X30: [13.8, 6.73, 0.27, 0.385], W14X311: [17.1, 16.2, 1.41, 2.26], W14X34: [14, 6.75, 0.285, 0.455], W14X342: [17.5, 16.4, 1.54, 2.47], W14X370: [17.9, 16.5, 1.66, 2.66], W14X38: [14.1, 6.77, 0.31, 0.515], W14X398: [18.3, 16.6, 1.77, 2.85], W14X426: [18.7, 16.7, 1.88, 3.04], W14X43: [13.7, 8, 0.305, 0.53], W14X455: [19, 16.8, 2.02, 3.21], W14X48: [13.8, 8.03, 0.34, 0.595], W14X500: [19.6, 17, 2.19, 3.5], W14X53: [13.9, 8.06, 0.37, 0.66], W14X550: [20.2, 17.2, 2.38, 3.82], W14X605: [20.9, 17.4, 2.6, 4.16], W14X61: [13.9, 10, 0.375, 0.645], W14X665: [21.6, 17.7, 2.83, 4.52], W14X68: [14, 10, 0.415, 0.72], W14X730: [22.4, 17.9, 3.07, 4.91], W14X74: [14.2, 10.1, 0.45, 0.785], W14X808: [22.8, 18.6, 3.74, 5.12], W14X82: [14.3, 10.1, 0.51, 0.855], W14X873: [23.6, 18.8, 3.94, 5.51], W14X90: [14, 14.5, 0.44, 0.71], W14X99: [14.2, 14.6, 0.485, 0.78], W16X100: [17, 10.4, 0.585, 0.985], W16X26: [15.7, 5.5, 0.25, 0.345], W16X31: [15.9, 5.53, 0.275, 0.44], W16X36: [15.9, 6.99, 0.295, 0.43], W16X40: [16, 7, 0.305, 0.505], W16X45: [16.1, 7.04, 0.345, 0.565], W16X50: [16.3, 7.07, 0.38, 0.63], W16X57: [16.4, 7.12, 0.43, 0.715], W16X67: [16.3, 10.2, 0.395, 0.665], W16X77: [16.5, 10.3, 0.455, 0.76], W16X89: [16.8, 10.4, 0.525, 0.875], W18X106: [18.7, 11.2, 0.59, 0.94], W18X119: [19, 11.3, 0.655, 1.06], W18X130: [19.3, 11.2, 0.67, 1.2], W18X143: [19.5, 11.2, 0.73, 1.32], W18X158: [19.7, 11.3, 0.81, 1.44], W18X175: [20, 11.4, 0.89, 1.59], W18X192: [20.4, 11.5, 0.96, 1.75], W18X211: [20.7, 11.6, 1.06, 1.91], W18X234: [21.1, 11.7, 1.16, 2.11], W18X258: [21.5, 11.8, 1.28, 2.3], W18X283: [21.9, 11.9, 1.4, 2.5], W18X311: [22.3, 12, 1.52, 2.74], W18X35: [17.7, 6, 0.3, 0.425], W18X40: [17.9, 6.02, 0.315, 0.525], W18X46: [18.1, 6.06, 0.36, 0.605], W18X50: [18, 7.5, 0.355, 0.57], W18X55: [18.1, 7.53, 0.39, 0.63], W18X60: [18.2, 7.56, 0.415, 0.695], W18X65: [18.4, 7.59, 0.45, 0.75], W18X71: [18.5, 7.64, 0.495, 0.81], W18X76: [18.2, 11, 0.425, 0.68], W18X86: [18.4, 11.1, 0.48, 0.77], W18X97: [18.6, 11.1, 0.535, 0.87], W21X101: [21.4, 12.3, 0.5, 0.8], W21X111: [21.5, 12.3, 0.55, 0.875], W21X122: [21.7, 12.4, 0.6, 0.96], W21X132: [21.8, 12.4, 0.65, 1.04], W21X147: [22.1, 12.5, 0.72, 1.15], W21X166: [22.5, 12.4, 0.75, 1.36], W21X182: [22.7, 12.5, 0.83, 1.48], W21X201: [23, 12.6, 0.91, 1.63], W21X223: [23.4, 12.7, 1, 1.79], W21X248: [23.7, 12.8, 1.1, 1.99], W21X275: [24.1, 12.9, 1.22, 2.19], W21X44: [20.7, 6.5, 0.35, 0.45], W21X48: [20.6, 8.14, 0.35, 0.43], W21X50: [20.8, 6.53, 0.38, 0.535], W21X55: [20.8, 8.22, 0.375, 0.522], W21X57: [21.1, 6.56, 0.405, 0.65], W21X62: [21, 8.24, 0.4, 0.615], W21X68: [21.1, 8.27, 0.43, 0.685], W21X73: [21.2, 8.3, 0.455, 0.74], W21X83: [21.4, 8.36, 0.515, 0.835], W21X93: [21.6, 8.42, 0.58, 0.93], W24X103: [24.5, 9, 0.55, 0.98], W24X104: [24.1, 12.8, 0.5, 0.75], W24X117: [24.3, 12.8, 0.55, 0.85], W24X131: [24.5, 12.9, 0.605, 0.96], W24X146: [24.7, 12.9, 0.65, 1.09], W24X162: [25, 13, 0.705, 1.22], W24X176: [25.2, 12.9, 0.75, 1.34], W24X192: [25.5, 13, 0.81, 1.46], W24X207: [25.7, 13, 0.87, 1.57], W24X229: [26, 13.1, 0.96, 1.73], W24X250: [26.3, 13.2, 1.04, 1.89], W24X279: [26.7, 13.3, 1.16, 2.09], W24X306: [27.1, 13.4, 1.26, 2.28], W24X335: [27.5, 13.5, 1.38, 2.48], W24X370: [28, 13.7, 1.52, 2.72], W24X55: [23.6, 7.01, 0.395, 0.505], W24X62: [23.7, 7.04, 0.43, 0.59], W24X68: [23.7, 8.97, 0.415, 0.585], W24X76: [23.9, 8.99, 0.44, 0.68], W24X84: [24.1, 9.02, 0.47, 0.77], W24X94: [24.3, 9.07, 0.515, 0.875], W27X102: [27.1, 10, 0.515, 0.83], W27X114: [27.3, 10.1, 0.57, 0.93], W27X129: [27.6, 10, 0.61, 1.1], W27X146: [27.4, 14, 0.605, 0.975], W27X161: [27.6, 14, 0.66, 1.08], W27X178: [27.8, 14.1, 0.725, 1.19], W27X194: [28.1, 14, 0.75, 1.34], W27X217: [28.4, 14.1, 0.83, 1.5], W27X235: [28.7, 14.2, 0.91, 1.61], W27X258: [29, 14.3, 0.98, 1.77], W27X281: [29.3, 14.4, 1.06, 1.93], W27X307: [29.6, 14.4, 1.16, 2.09], W27X336: [30, 14.6, 1.26, 2.28], W27X368: [30.4, 14.7, 1.38, 2.48], W27X539: [32.5, 15.3, 1.97, 3.54], W27X84: [26.7, 10, 0.46, 0.64], W27X94: [26.9, 10, 0.49, 0.745], W30X108: [29.8, 10.5, 0.545, 0.76], W30X116: [30, 10.5, 0.565, 0.85], W30X124: [30.2, 10.5, 0.585, 0.93], W30X132: [30.3, 10.5, 0.615, 1], W30X148: [30.7, 10.5, 0.65, 1.18], W30X173: [30.4, 15, 0.655, 1.07], W30X191: [30.7, 15, 0.71, 1.19], W30X211: [30.9, 15.1, 0.775, 1.32], W30X235: [31.3, 15.1, 0.83, 1.5], W30X261: [31.6, 15.2, 0.93, 1.65], W30X292: [32, 15.3, 1.02, 1.85], W30X326: [32.4, 15.4, 1.14, 2.05], W30X357: [32.8, 15.5, 1.24, 2.24], W30X391: [33.2, 15.6, 1.36, 2.44], W30X90: [29.5, 10.4, 0.47, 0.61], W30X99: [29.7, 10.5, 0.52, 0.67], W33X118: [32.9, 11.5, 0.55, 0.74], W33X130: [33.1, 11.5, 0.58, 0.855], W33X141: [33.3, 11.5, 0.605, 0.96], W33X152: [33.5, 11.6, 0.635, 1.06], W33X169: [33.8, 11.5, 0.67, 1.22], W33X201: [33.7, 15.7, 0.715, 1.15], W33X221: [33.9, 15.8, 0.775, 1.28], W33X241: [34.2, 15.9, 0.83, 1.4], W33X263: [34.5, 15.8, 0.87, 1.57], W33X291: [34.8, 15.9, 0.96, 1.73], W33X318: [35.2, 16, 1.04, 1.89], W33X354: [35.6, 16.1, 1.16, 2.09], W33X387: [36, 16.2, 1.26, 2.28], W36X135: [35.6, 12, 0.6, 0.79], W36X150: [35.9, 12, 0.625, 0.94], W36X160: [36, 12, 0.65, 1.02], W36X170: [36.2, 12, 0.68, 1.1], W36X182: [36.3, 12.1, 0.725, 1.18], W36X194: [36.5, 12.1, 0.765, 1.26], W36X210: [36.7, 12.2, 0.83, 1.36], W36X231: [36.5, 16.5, 0.76, 1.26], W36X232: [37.1, 12.1, 0.87, 1.57], W36X247: [36.7, 16.5, 0.8, 1.35], W36X256: [37.4, 12.2, 0.96, 1.73], W36X262: [36.9, 16.6, 0.84, 1.44], W36X282: [37.1, 16.6, 0.885, 1.57], W36X302: [37.3, 16.7, 0.945, 1.68], W36X330: [37.7, 16.6, 1.02, 1.85], W36X361: [38, 16.7, 1.12, 2.01], W36X395: [38.4, 16.8, 1.22, 2.2], W36X441: [38.9, 17, 1.36, 2.44], W36X487: [39.3, 17.1, 1.5, 2.68], W36X529: [39.8, 17.2, 1.61, 2.91], W36X652: [41.1, 17.6, 1.97, 3.54], W36X723: [41.8, 17.8, 2.17, 3.9], W36X802: [42.6, 18, 2.38, 4.29], W36X853: [43.1, 18.2, 2.52, 4.53], W36X925: [43.1, 18.6, 3.02, 4.53], W40X149: [38.2, 11.8, 0.63, 0.83], W40X167: [38.6, 11.8, 0.65, 1.03], W40X183: [39, 11.8, 0.65, 1.2], W40X199: [38.7, 15.8, 0.65, 1.07], W40X211: [39.4, 11.8, 0.75, 1.42], W40X215: [39, 15.8, 0.65, 1.22], W40X235: [39.7, 11.9, 0.83, 1.58], W40X249: [39.4, 15.8, 0.75, 1.42], W40X264: [40, 11.9, 0.96, 1.73], W40X277: [39.7, 15.8, 0.83, 1.58], W40X278: [40.2, 12, 1.03, 1.81], W40X294: [40.4, 12, 1.06, 1.93], W40X297: [39.8, 15.8, 0.93, 1.65], W40X324: [40.2, 15.9, 1, 1.81], W40X327: [40.8, 12.1, 1.18, 2.13], W40X331: [40.8, 12.2, 1.22, 2.13], W40X362: [40.6, 16, 1.12, 2.01], W40X372: [40.6, 16.1, 1.16, 2.05], W40X392: [41.6, 12.4, 1.42, 2.52], W40X397: [41, 16.1, 1.22, 2.2], W40X431: [41.3, 16.2, 1.34, 2.36], W40X503: [42.1, 16.4, 1.54, 2.76], W40X593: [43, 16.7, 1.79, 3.23], W40X655: [43.6, 16.9, 1.97, 3.54], W44X230: [42.9, 15.8, 0.71, 1.22], W44X262: [43.3, 15.8, 0.785, 1.42], W44X290: [43.6, 15.8, 0.865, 1.58], W44X335: [44, 15.9, 1.03, 1.77], W4X13: [4.16, 4.06, 0.28, 0.345], W5X16: [5.01, 5, 0.24, 0.36], W5X19: [5.15, 5.03, 0.27, 0.43], W6X12: [6.03, 4, 0.23, 0.28], W6X15: [5.99, 5.99, 0.23, 0.26], W6X16: [6.28, 4.03, 0.26, 0.405], W6X20: [6.2, 6.02, 0.26, 0.365], W6X25: [6.38, 6.08, 0.32, 0.455], "W6X8.5": [5.83, 3.94, 0.17, 0.195], W6X9: [5.9, 3.94, 0.17, 0.215], W8X10: [7.89, 3.94, 0.17, 0.205], W8X13: [7.99, 4, 0.23, 0.255], W8X15: [8.11, 4.02, 0.245, 0.315], W8X18: [8.14, 5.25, 0.23, 0.33], W8X21: [8.28, 5.27, 0.25, 0.4], W8X24: [7.93, 6.5, 0.245, 0.4], W8X28: [8.06, 6.54, 0.285, 0.465], W8X31: [8, 8, 0.285, 0.435], W8X35: [8.12, 8.02, 0.31, 0.495], W8X40: [8.25, 8.07, 0.36, 0.56], W8X48: [8.5, 8.11, 0.4, 0.685], W8X58: [8.75, 8.22, 0.51, 0.81], W8X67: [9, 8.28, 0.57, 0.935], "WT10.5X100.5": [11.5, 12.6, 0.91, 1.63], "WT10.5X111.5": [11.7, 12.7, 1, 1.79], "WT10.5X124": [11.9, 12.8, 1.1, 1.99], "WT10.5X137.5": [12.1, 12.9, 1.22, 2.19], "WT10.5X22": [10.3, 6.5, 0.35, 0.45], "WT10.5X24": [10.3, 8.14, 0.35, 0.43], "WT10.5X25": [10.4, 6.53, 0.38, 0.535], "WT10.5X27.5": [10.4, 8.22, 0.375, 0.522], "WT10.5X28.5": [10.5, 6.56, 0.405, 0.65], "WT10.5X31": [10.5, 8.24, 0.4, 0.615], "WT10.5X34": [10.6, 8.27, 0.43, 0.685], "WT10.5X36.5": [10.6, 8.3, 0.455, 0.74], "WT10.5X41.5": [10.7, 8.36, 0.515, 0.835], "WT10.5X46.5": [10.8, 8.42, 0.58, 0.93], "WT10.5X50.5": [10.7, 12.3, 0.5, 0.8], "WT10.5X55.5": [10.8, 12.3, 0.55, 0.875], "WT10.5X61": [10.8, 12.4, 0.6, 0.96], "WT10.5X66": [10.9, 12.4, 0.65, 1.04], "WT10.5X73.5": [11, 12.5, 0.72, 1.15], "WT10.5X83": [11.2, 12.4, 0.75, 1.36], "WT10.5X91": [11.4, 12.5, 0.83, 1.48], "WT12X103.5": [12.9, 13, 0.87, 1.57], "WT12X114.5": [13, 13.1, 0.96, 1.73], WT12X125: [13.2, 13.2, 1.04, 1.89], "WT12X139.5": [13.4, 13.3, 1.16, 2.09], WT12X153: [13.6, 13.4, 1.26, 2.28], "WT12X167.5": [13.8, 13.5, 1.38, 2.48], WT12X185: [14, 13.7, 1.52, 2.72], "WT12X27.5": [11.8, 7.01, 0.395, 0.505], WT12X31: [11.9, 7.04, 0.43, 0.59], WT12X34: [11.9, 8.97, 0.415, 0.585], WT12X38: [12, 8.99, 0.44, 0.68], WT12X42: [12.1, 9.02, 0.47, 0.77], WT12X47: [12.2, 9.07, 0.515, 0.875], "WT12X51.5": [12.3, 9, 0.55, 0.98], WT12X52: [12, 12.8, 0.5, 0.75], "WT12X58.5": [12.1, 12.8, 0.55, 0.85], "WT12X65.5": [12.2, 12.9, 0.605, 0.96], WT12X73: [12.4, 12.9, 0.65, 1.09], WT12X81: [12.5, 13, 0.705, 1.22], WT12X88: [12.6, 12.9, 0.75, 1.34], WT12X96: [12.7, 13, 0.81, 1.46], "WT13.5X108.5": [14.2, 14.1, 0.83, 1.5], "WT13.5X117.5": [14.3, 14.2, 0.91, 1.61], "WT13.5X129": [14.5, 14.3, 0.98, 1.77], "WT13.5X140.5": [14.6, 14.4, 1.06, 1.93], "WT13.5X153.5": [14.8, 14.4, 1.16, 2.09], "WT13.5X168": [15, 14.6, 1.26, 2.28], "WT13.5X184": [15.2, 14.7, 1.38, 2.48], "WT13.5X269.5": [16.3, 15.3, 1.97, 3.54], "WT13.5X42": [13.4, 10, 0.46, 0.64], "WT13.5X47": [13.5, 10, 0.49, 0.745], "WT13.5X51": [13.5, 10, 0.515, 0.83], "WT13.5X57": [13.6, 10.1, 0.57, 0.93], "WT13.5X64.5": [13.8, 10, 0.61, 1.1], "WT13.5X73": [13.7, 14, 0.605, 0.975], "WT13.5X80.5": [13.8, 14, 0.66, 1.08], "WT13.5X89": [13.9, 14.1, 0.725, 1.19], "WT13.5X97": [14.1, 14, 0.75, 1.34], "WT15X105.5": [15.5, 15.1, 0.775, 1.32], "WT15X117.5": [15.7, 15.1, 0.83, 1.5], "WT15X130.5": [15.8, 15.2, 0.93, 1.65], WT15X146: [16, 15.3, 1.02, 1.85], WT15X163: [16.2, 15.4, 1.14, 2.05], "WT15X178.5": [16.4, 15.5, 1.24, 2.24], "WT15X195.5": [16.6, 15.6, 1.36, 2.44], WT15X45: [14.8, 10.4, 0.47, 0.61], "WT15X49.5": [14.8, 10.5, 0.52, 0.67], WT15X54: [14.9, 10.5, 0.545, 0.76], WT15X58: [15, 10.5, 0.565, 0.85], WT15X62: [15.1, 10.5, 0.585, 0.93], WT15X66: [15.2, 10.5, 0.615, 1], WT15X74: [15.3, 10.5, 0.65, 1.18], "WT15X86.5": [15.2, 15, 0.655, 1.07], "WT15X95.5": [15.3, 15, 0.71, 1.19], "WT16.5X100.5": [16.8, 15.7, 0.715, 1.15], "WT16.5X110.5": [17, 15.8, 0.775, 1.28], "WT16.5X120.5": [17.1, 15.9, 0.83, 1.4], "WT16.5X131.5": [17.3, 15.8, 0.87, 1.57], "WT16.5X145.5": [17.4, 15.9, 0.96, 1.73], "WT16.5X159": [17.6, 16, 1.04, 1.89], "WT16.5X177": [17.8, 16.1, 1.16, 2.09], "WT16.5X193.5": [18, 16.2, 1.26, 2.28], "WT16.5X59": [16.4, 11.5, 0.55, 0.74], "WT16.5X65": [16.5, 11.5, 0.58, 0.855], "WT16.5X70.5": [16.7, 11.5, 0.605, 0.96], "WT16.5X76": [16.7, 11.6, 0.635, 1.06], "WT16.5X84.5": [16.9, 11.5, 0.67, 1.22], WT18X105: [18.3, 12.2, 0.83, 1.36], "WT18X115.5": [18.2, 16.5, 0.76, 1.26], WT18X116: [18.6, 12.1, 0.87, 1.57], "WT18X123.5": [18.3, 16.5, 0.8, 1.35], WT18X128: [18.7, 12.2, 0.96, 1.73], WT18X131: [18.4, 16.6, 0.84, 1.44], WT18X141: [18.6, 16.6, 0.885, 1.57], WT18X151: [18.7, 16.7, 0.945, 1.68], WT18X165: [18.8, 16.6, 1.02, 1.85], "WT18X180.5": [19, 16.7, 1.12, 2.01], "WT18X197.5": [19.2, 16.8, 1.22, 2.2], "WT18X220.5": [19.4, 17, 1.36, 2.44], "WT18X243.5": [19.7, 17.1, 1.5, 2.68], "WT18X264.5": [19.9, 17.2, 1.61, 2.91], WT18X326: [20.5, 17.6, 1.97, 3.54], "WT18X361.5": [20.9, 17.8, 2.17, 3.9], WT18X401: [21.3, 18, 2.38, 4.29], "WT18X426.5": [21.6, 18.2, 2.52, 4.53], "WT18X462.5": [21.6, 18.6, 3.02, 4.53], "WT18X67.5": [17.8, 12, 0.6, 0.79], WT18X75: [17.9, 12, 0.625, 0.94], WT18X80: [18, 12, 0.65, 1.02], WT18X85: [18.1, 12, 0.68, 1.1], WT18X91: [18.2, 12.1, 0.725, 1.18], WT18X97: [18.2, 12.1, 0.765, 1.26], "WT2.5X8": [2.51, 5, 0.24, 0.36], "WT2.5X9.5": [2.58, 5.03, 0.27, 0.43], "WT20X105.5": [19.7, 11.8, 0.75, 1.42], "WT20X107.5": [19.5, 15.8, 0.65, 1.22], "WT20X117.5": [19.8, 11.9, 0.83, 1.58], "WT20X124.5": [19.7, 15.8, 0.75, 1.42], WT20X132: [20, 11.9, 0.96, 1.73], "WT20X138.5": [19.8, 15.8, 0.83, 1.58], WT20X139: [20.1, 12, 1.03, 1.81], WT20X147: [20.2, 12, 1.06, 1.93], "WT20X148.5": [19.9, 15.8, 0.93, 1.65], WT20X162: [20.1, 15.9, 1, 1.81], "WT20X163.5": [20.4, 12.1, 1.18, 2.13], "WT20X165.5": [20.4, 12.2, 1.22, 2.13], WT20X181: [20.3, 16, 1.12, 2.01], WT20X186: [20.3, 16.1, 1.16, 2.05], WT20X196: [20.8, 12.4, 1.42, 2.52], "WT20X198.5": [20.5, 16.1, 1.22, 2.2], "WT20X215.5": [20.6, 16.2, 1.34, 2.36], "WT20X251.5": [21, 16.4, 1.54, 2.76], "WT20X296.5": [21.5, 16.7, 1.79, 3.23], "WT20X327.5": [21.8, 16.9, 1.97, 3.54], "WT20X74.5": [19.1, 11.8, 0.63, 0.83], "WT20X83.5": [19.3, 11.8, 0.65, 1.03], "WT20X91.5": [19.5, 11.8, 0.65, 1.2], "WT20X99.5": [19.3, 15.8, 0.65, 1.07], WT22X115: [21.5, 15.8, 0.71, 1.22], WT22X131: [21.7, 15.8, 0.785, 1.42], WT22X145: [21.8, 15.8, 0.865, 1.58], "WT22X167.5": [22, 15.9, 1.03, 1.77], "WT2X6.5": [2.08, 4.06, 0.28, 0.345], WT3X10: [3.1, 6.02, 0.26, 0.365], "WT3X12.5": [3.19, 6.08, 0.32, 0.455], "WT3X4.25": [2.92, 3.94, 0.17, 0.195], "WT3X4.5": [2.95, 3.94, 0.17, 0.215], WT3X6: [3.02, 4, 0.23, 0.28], "WT3X7.5": [3, 5.99, 0.23, 0.26], WT3X8: [3.14, 4.03, 0.26, 0.405], "WT4X10.5": [4.14, 5.27, 0.25, 0.4], WT4X12: [3.97, 6.5, 0.245, 0.4], WT4X14: [4.03, 6.54, 0.285, 0.465], "WT4X15.5": [4, 8, 0.285, 0.435], "WT4X17.5": [4.06, 8.02, 0.31, 0.495], WT4X20: [4.13, 8.07, 0.36, 0.56], WT4X24: [4.25, 8.11, 0.4, 0.685], WT4X29: [4.38, 8.22, 0.51, 0.81], "WT4X33.5": [4.5, 8.28, 0.57, 0.935], WT4X5: [3.95, 3.94, 0.17, 0.205], "WT4X6.5": [4, 4, 0.23, 0.255], "WT4X7.5": [4.06, 4.02, 0.245, 0.315], WT4X9: [4.07, 5.25, 0.23, 0.33], WT5X11: [5.09, 5.75, 0.24, 0.36], WT5X13: [5.17, 5.77, 0.26, 0.44], WT5X15: [5.24, 5.81, 0.3, 0.51], "WT5X16.5": [4.87, 7.96, 0.29, 0.435], "WT5X19.5": [4.96, 7.99, 0.315, 0.53], "WT5X22.5": [5.05, 8.02, 0.35, 0.62], "WT5X24.5": [4.99, 10, 0.34, 0.56], WT5X27: [5.05, 10, 0.37, 0.615], WT5X30: [5.11, 10.1, 0.42, 0.68], WT5X34: [5.2, 10.1, 0.47, 0.77], "WT5X38.5": [5.3, 10.2, 0.53, 0.87], WT5X44: [5.42, 10.3, 0.605, 0.99], WT5X50: [5.55, 10.3, 0.68, 1.12], WT5X56: [5.68, 10.4, 0.755, 1.25], WT5X6: [4.94, 3.96, 0.19, 0.21], "WT5X7.5": [5, 4, 0.23, 0.27], "WT5X8.5": [5.06, 4.01, 0.24, 0.33], "WT5X9.5": [5.12, 4.02, 0.25, 0.395], WT6X105: [7.36, 12.8, 1.18, 1.9], WT6X11: [6.16, 4.03, 0.26, 0.425], WT6X115: [7.53, 12.9, 1.29, 2.07], WT6X126: [7.71, 13, 1.4, 2.25], WT6X13: [6.11, 6.49, 0.23, 0.38], "WT6X139.5": [7.93, 13.1, 1.53, 2.47], WT6X15: [6.17, 6.52, 0.26, 0.44], "WT6X152.5": [8.16, 13.2, 1.63, 2.71], WT6X168: [8.41, 13.4, 1.78, 2.96], "WT6X17.5": [6.25, 6.56, 0.3, 0.52], WT6X20: [5.97, 8.01, 0.295, 0.515], "WT6X22.5": [6.03, 8.05, 0.335, 0.575], WT6X25: [6.1, 8.08, 0.37, 0.64], "WT6X26.5": [6.03, 10, 0.345, 0.575], WT6X29: [6.1, 10, 0.36, 0.64], "WT6X32.5": [6.06, 12, 0.39, 0.605], WT6X36: [6.13, 12, 0.43, 0.67], "WT6X39.5": [6.19, 12.1, 0.47, 0.735], "WT6X43.5": [6.27, 12.1, 0.515, 0.81], WT6X48: [6.36, 12.2, 0.55, 0.9], WT6X53: [6.45, 12.2, 0.61, 0.99], WT6X60: [6.56, 12.3, 0.71, 1.11], WT6X68: [6.71, 12.4, 0.79, 1.25], WT6X7: [5.96, 3.97, 0.2, 0.225], WT6X76: [6.86, 12.5, 0.87, 1.4], WT6X8: [6, 3.99, 0.22, 0.265], WT6X85: [7.02, 12.6, 0.96, 1.56], "WT6X9.5": [6.08, 4.01, 0.235, 0.35], WT6X95: [7.19, 12.7, 1.06, 1.74], "WT7X105.5": [7.86, 15.8, 0.98, 1.56], WT7X11: [6.87, 5, 0.23, 0.335], "WT7X116.5": [8.02, 15.9, 1.07, 1.72], "WT7X128.5": [8.19, 16, 1.18, 1.89], WT7X13: [6.96, 5.03, 0.255, 0.42], "WT7X141.5": [8.37, 16.1, 1.29, 2.07], WT7X15: [6.92, 6.73, 0.27, 0.385], "WT7X155.5": [8.56, 16.2, 1.41, 2.26], WT7X17: [6.99, 6.75, 0.285, 0.455], WT7X171: [8.77, 16.4, 1.54, 2.47], WT7X185: [8.96, 16.5, 1.66, 2.66], WT7X19: [7.05, 6.77, 0.31, 0.515], WT7X199: [9.15, 16.6, 1.77, 2.85], "WT7X21.5": [6.83, 8, 0.305, 0.53], WT7X213: [9.34, 16.7, 1.88, 3.04], "WT7X227.5": [9.51, 16.8, 2.02, 3.21], WT7X24: [6.9, 8.03, 0.34, 0.595], WT7X250: [9.8, 17, 2.19, 3.5], "WT7X26.5": [6.96, 8.06, 0.37, 0.66], WT7X275: [10.1, 17.2, 2.38, 3.82], "WT7X30.5": [6.95, 10, 0.375, 0.645], "WT7X302.5": [10.5, 17.4, 2.6, 4.16], "WT7X332.5": [10.8, 17.7, 2.83, 4.52], WT7X34: [7.02, 10, 0.415, 0.72], WT7X365: [11.2, 17.9, 3.07, 4.91], WT7X37: [7.09, 10.1, 0.45, 0.785], WT7X404: [11.4, 18.6, 3.74, 5.12], WT7X41: [7.16, 10.1, 0.51, 0.855], "WT7X436.5": [11.8, 18.8, 3.94, 5.51], WT7X45: [7.01, 14.5, 0.44, 0.71], "WT7X49.5": [7.08, 14.6, 0.485, 0.78], "WT7X54.5": [7.16, 14.6, 0.525, 0.86], WT7X60: [7.24, 14.7, 0.59, 0.94], WT7X66: [7.33, 14.7, 0.645, 1.03], "WT7X72.5": [7.39, 15.5, 0.68, 1.09], "WT7X79.5": [7.49, 15.6, 0.745, 1.19], WT7X88: [7.61, 15.7, 0.83, 1.31], "WT7X96.5": [7.74, 15.7, 0.89, 1.44], WT8X13: [7.85, 5.5, 0.25, 0.345], "WT8X15.5": [7.94, 5.53, 0.275, 0.44], WT8X18: [7.93, 6.99, 0.295, 0.43], WT8X20: [8.01, 7, 0.305, 0.505], "WT8X22.5": [8.07, 7.04, 0.345, 0.565], WT8X25: [8.13, 7.07, 0.38, 0.63], "WT8X28.5": [8.22, 7.12, 0.43, 0.715], "WT8X33.5": [8.17, 10.2, 0.395, 0.665], "WT8X38.5": [8.26, 10.3, 0.455, 0.76], "WT8X44.5": [8.38, 10.4, 0.525, 0.875], WT8X50: [8.49, 10.4, 0.585, 0.985], "WT9X105.5": [10.3, 11.6, 1.06, 1.91], WT9X117: [10.5, 11.7, 1.16, 2.11], WT9X129: [10.7, 11.8, 1.28, 2.3], "WT9X141.5": [10.9, 11.9, 1.4, 2.5], "WT9X155.5": [11.2, 12, 1.52, 2.74], "WT9X17.5": [8.85, 6, 0.3, 0.425], WT9X20: [8.95, 6.02, 0.315, 0.525], WT9X23: [9.03, 6.06, 0.36, 0.605], WT9X25: [9, 7.5, 0.355, 0.57], "WT9X27.5": [9.06, 7.53, 0.39, 0.63], WT9X30: [9.12, 7.56, 0.415, 0.695], "WT9X32.5": [9.18, 7.59, 0.45, 0.75], "WT9X35.5": [9.24, 7.64, 0.495, 0.81], WT9X38: [9.11, 11, 0.425, 0.68], WT9X43: [9.2, 11.1, 0.48, 0.77], "WT9X48.5": [9.3, 11.1, 0.535, 0.87], WT9X53: [9.37, 11.2, 0.59, 0.94], "WT9X59.5": [9.49, 11.3, 0.655, 1.06], WT9X65: [9.63, 11.2, 0.67, 1.2], "WT9X71.5": [9.75, 11.2, 0.73, 1.32], WT9X79: [9.86, 11.3, 0.81, 1.44], "WT9X87.5": [10, 11.4, 0.89, 1.59], WT9X96: [10.2, 11.5, 0.96, 1.75] };
53485
+
53486
+ // aisc-sections.ts
53487
+ var IN_TO_MM = 25.4;
53488
+ var SEC = Object.fromEntries(
53489
+ Object.entries(aisc_sections_default).filter(
53490
+ ([k, v]) => !k.startsWith("_") && Array.isArray(v)
53491
+ )
53492
+ );
53493
+ function sectionDimsIn(designation) {
53494
+ const row = SEC[designation.trim().toUpperCase().replace(/\s+/g, "")];
53495
+ return row ? { d: row[0], bf: row[1] } : void 0;
53496
+ }
53497
+ var SECTION_DIMS_IN = Object.fromEntries(
53498
+ Object.entries(SEC).map(([k, v]) => [k, [v[0], v[1]]])
53499
+ );
53500
+ function parseDim(tok) {
53501
+ const s = tok.trim();
53502
+ let m = s.match(/^(\d+)\s+(\d+)\/(\d+)$/);
53503
+ if (m) return Number(m[1]) + Number(m[2]) / Number(m[3]);
53504
+ m = s.match(/^(\d+)\/(\d+)$/);
53505
+ if (m) return Number(m[1]) / Number(m[2]);
53506
+ const d = Number.parseFloat(s);
53507
+ return Number.isFinite(d) ? d : null;
53508
+ }
53509
+ function xsectionFor(profile, dims) {
53510
+ const rect = { shape: "rect", w: dims.w, d: dims.d };
53511
+ const raw = (profile ?? "").trim().toUpperCase().replace(/×/g, "X");
53512
+ if (!raw) return rect;
53513
+ const key = raw.replace(/\s+/g, "");
53514
+ const m = raw.match(/^([A-Z]+)\s*(.+)$/);
53515
+ if (!m) return rect;
53516
+ const prefix = m[1];
53517
+ const toks = m[2].split("X").map(parseDim);
53518
+ const twtf = SEC[key];
53519
+ if (/^(W|S|M|HP)$/.test(prefix)) {
53520
+ return twtf ? { shape: "i", d: dims.d, bf: dims.w, tw: twtf[2] * IN_TO_MM, tf: twtf[3] * IN_TO_MM } : rect;
53521
+ }
53522
+ if (/^(C|MC)$/.test(prefix)) {
53523
+ return twtf ? { shape: "channel", d: dims.d, bf: dims.w, tw: twtf[2] * IN_TO_MM, tf: twtf[3] * IN_TO_MM } : rect;
53524
+ }
53525
+ if (prefix === "L" && toks.length >= 3 && toks[2] != null && toks[2] > 0) {
53526
+ return { shape: "angle", d: dims.d, b: dims.w, t: toks[2] * IN_TO_MM };
53527
+ }
53528
+ if ((prefix === "HSS" || prefix === "TUBE") && toks.length >= 3 && toks[2] != null && toks[2] > 0) {
53529
+ return { shape: "rhs", d: dims.d, b: dims.w, t: toks[2] * IN_TO_MM };
53530
+ }
53531
+ if (prefix === "HSS" && toks.length === 2 && toks[1] != null && toks[1] > 0) {
53532
+ return { shape: "chs", od: dims.d, t: toks[1] * IN_TO_MM };
53533
+ }
53534
+ return rect;
53535
+ }
53536
+
53483
53537
  // index.ts
53484
53538
  var import_node_crypto12 = require("node:crypto");
53485
53539
 
@@ -56084,1372 +56138,1410 @@ function columnLengthFt(col, planDefaultTos) {
56084
56138
  return Number.isFinite(ft) ? ft : null;
56085
56139
  }
56086
56140
 
56087
- // bom-format.ts
56088
- var round1 = (n) => Math.round(n * 10) / 10;
56089
- function contractToBom(contractInput) {
56090
- const c = contractInput ?? {};
56091
- const weights = c.weights ?? {};
56092
- const agg = /* @__PURE__ */ new Map();
56093
- for (const plan of c.plans ?? []) {
56094
- const ptPerFt = typeof plan.pt_per_ft === "number" && plan.pt_per_ft > 0 ? plan.pt_per_ft : 12;
56095
- const defaultTos = plan.default_tos ?? 0;
56096
- for (const m of plan.members ?? []) {
56097
- const profile = m.profile;
56098
- if (!profile) continue;
56099
- const plf = weights[profile];
56100
- if (plf == null) continue;
56101
- let lenFt;
56102
- if (m.role === "column") {
56103
- const l = columnLengthFt(m.col, defaultTos);
56104
- if (l == null) continue;
56105
- lenFt = l;
56106
- if (!(lenFt > 0)) continue;
56107
- } else {
56108
- const l = memberLengthFt(m.wp, m.ends, ptPerFt, defaultTos);
56109
- if (l == null) continue;
56110
- lenFt = l;
56111
- }
56112
- const g = agg.get(profile) ?? { qty: 0, lenFt: 0, plf };
56113
- g.qty += 1;
56114
- g.lenFt += lenFt;
56115
- agg.set(profile, g);
56116
- }
56117
- }
56118
- const rows = [...agg.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([profile, g]) => ({
56119
- Profile: profile,
56120
- Qty: g.qty,
56121
- "Length (ft)": round1(g.lenFt),
56122
- "lb/ft": g.plf,
56123
- "Weight (lb)": Math.round(g.lenFt * g.plf)
56124
- }));
56125
- const totalLb = rows.reduce((t, r) => t + r["Weight (lb)"], 0);
56126
- const totalQty = rows.reduce((t, r) => t + r.Qty, 0);
56127
- const totalLenFt = round1(rows.reduce((t, r) => t + r["Length (ft)"], 0));
56128
- const totalTons = round1(totalLb / 2e3);
56129
- rows.push({
56130
- Profile: "TOTAL",
56131
- Qty: totalQty,
56132
- "Length (ft)": totalLenFt,
56133
- "lb/ft": "",
56134
- "Weight (lb)": totalLb
56135
- });
56136
- return {
56137
- title: `Bill of Materials \u2014 ${totalTons} tons (${totalLb.toLocaleString("en-US")} lb)`,
56138
- columns: ["Profile", "Qty", "Length (ft)", "lb/ft", "Weight (lb)"],
56139
- rows,
56140
- totalLb,
56141
- totalTons
56142
- };
56141
+ // steel-joints.ts
56142
+ var GROUPS = {
56143
+ "base-plate": { key: "base-plate", label: "Base plates", color: "#6b7a8d" },
56144
+ // darkest plate grey
56145
+ "washer-plate": { key: "washer-plate", label: "Washer plates", color: "#9aafc3" },
56146
+ "anchor-plate": { key: "anchor-plate", label: "Anchor plates", color: "#8293a6" },
56147
+ // embedded bearing plate at the rod's anchored end — mid steel-grey, between base + washer plate
56148
+ anchor: { key: "anchor", label: "Anchor rods", color: "#b0c4d8" },
56149
+ // cool zinc-grey
56150
+ nut: { key: "nut", label: "Nuts", color: "#7a8a9e" },
56151
+ washer: { key: "washer", label: "Washers", color: "#dde4ed" },
56152
+ // lightest zinc
56153
+ weld: { key: "weld", label: "Welds", color: "#f97316" },
56154
+ // weld orange (heat) — off the UI error-red
56155
+ // Shear-plate kit — same muted steel band; the fin plate a touch lighter than the base plate so the
56156
+ // two connection types are tellable apart in a mixed model, bolts on the zinc fastener grey.
56157
+ "shear-plate": { key: "shear-plate", label: "Shear plates", color: "#7d8ba0" },
56158
+ bolt: { key: "bolt", label: "Bolts", color: "#b0c4d8" },
56159
+ // cool zinc-grey (matches the anchor fasteners)
56160
+ stiffener: { key: "stiffener", label: "Stiffeners", color: "#9aafc3" },
56161
+ cope: { key: "cope", label: "Copes", color: "#c2703a" },
56162
+ // a muted cut/burn amber — the removed corner (subtractive; rendered as the notch, not a swatch mesh)
56163
+ // Imported (custom) connection — one neutral steel band for the whole opaque assembly, so it reads
56164
+ // as a single imported unit (not scattered across the recipe-part legend rows). Roles (plate/bolt/
56165
+ // weld) are kept on each part's meta for labels, but share this one legend group + colour.
56166
+ custom: { key: "custom", label: "Imported connections", color: "#8a97a8" }
56167
+ };
56168
+ var EMBED = 1;
56169
+ function num(params, key, def) {
56170
+ const v = params?.[key];
56171
+ return typeof v === "number" && isFinite(v) ? v : def;
56143
56172
  }
56144
-
56145
- // steel-diff.ts
56146
- var NUL = String.fromCharCode(0);
56147
- var asArray = (v) => Array.isArray(v) ? v : [];
56148
- var str = (v) => typeof v === "string" ? v : "";
56149
- var normProfile = (v) => str(v).trim().toUpperCase().replace(/\s+/g, "");
56150
- var num = (v) => typeof v === "number" && isFinite(v) ? v : null;
56151
- var MOVE_TOL_FT = 0.5;
56152
- function collect(contract) {
56153
- const byKey = /* @__PURE__ */ new Map();
56154
- const dup = /* @__PURE__ */ new Set();
56155
- const idSheets = /* @__PURE__ */ new Map();
56156
- const c = contract ?? {};
56157
- for (const plan of asArray(c.plans)) {
56158
- const sheet = str(plan?.sheet);
56159
- const rawPpf = plan?.pt_per_ft;
56160
- const hasScale = typeof rawPpf === "number" && rawPpf > 0;
56161
- const ptPerFt = hasScale ? rawPpf : 12;
56162
- for (const m of asArray(plan?.members)) {
56163
- const id = str(m?.id);
56164
- if (!id) continue;
56165
- const key = sheet + NUL + id;
56166
- (idSheets.get(id) ?? idSheets.set(id, /* @__PURE__ */ new Set()).get(id)).add(sheet);
56167
- if (byKey.has(key)) {
56168
- dup.add(key);
56169
- continue;
56170
- }
56171
- byKey.set(key, {
56172
- key,
56173
- id,
56174
- sheet,
56175
- mark: str(m?.mark) || void 0,
56176
- profile: str(m?.profile),
56177
- role: str(m?.role) || "beam",
56178
- ptPerFt,
56179
- hasScale,
56180
- wp: asArray(m?.wp).map((p) => asArray(p).map((x) => fin(x))),
56181
- // finite-guarded (no NaN) — consistent with num() elsewhere
56182
- ends: asArray(m?.ends),
56183
- col: m?.col ?? {},
56184
- material: str(m?.material)
56185
- });
56186
- }
56187
- }
56188
- return { byKey, dupKeys: [...dup], idSheets };
56173
+ function pos(params, key, def) {
56174
+ const v = num(params, key, def);
56175
+ return v > 0 ? v : def;
56189
56176
  }
56190
- var refOf = (m) => ({ key: m.key, id: m.id, sheet: m.sheet, ...m.mark ? { mark: m.mark } : {}, profile: m.profile, role: m.role });
56191
- var fin = (v) => {
56192
- const n = Number(v);
56193
- return isFinite(n) ? n : 0;
56194
- };
56195
- var dist = (p, q) => Math.hypot((p[0] ?? 0) - (q[0] ?? 0), (p[1] ?? 0) - (q[1] ?? 0));
56196
- var ftPt = (p, ppf) => [fin(p?.[0]) / ppf, fin(p?.[1]) / ppf];
56197
- function beamMoveFeet(a, b) {
56198
- const af0 = ftPt(a.wp[0], a.ptPerFt), af1 = ftPt(a.wp[1] ?? a.wp[0], a.ptPerFt);
56199
- const bf0 = ftPt(b.wp[0], b.ptPerFt), bf1 = ftPt(b.wp[1] ?? b.wp[0], b.ptPerFt);
56200
- const aligned = Math.max(dist(af0, bf0), dist(af1, bf1));
56201
- const flipped = Math.max(dist(af0, bf1), dist(af1, bf0));
56202
- return flipped < aligned ? { feet: flipped, flipped: true } : { feet: aligned, flipped: false };
56177
+ function intMin1(params, key, def) {
56178
+ return Math.max(1, Math.round(num(params, key, def)));
56203
56179
  }
56204
- function elevMoveFeet(a, b) {
56205
- let ft = 0;
56206
- const at = num(a.col?.tos), bt = num(b.col?.tos);
56207
- if (at != null && bt != null) ft = Math.max(ft, Math.abs(at - bt) / 12);
56208
- const ab = num(a.col?.bos), bb = num(b.col?.bos);
56209
- if (ab != null && bb != null) ft = Math.max(ft, Math.abs(ab - bb) / 12);
56210
- for (let i = 0; i < 2; i++) {
56211
- const ea = num(a.ends?.[i]?.tos), eb = num(b.ends?.[i]?.tos);
56212
- if (ea != null && eb != null) ft = Math.max(ft, Math.abs(ea - eb) / 12);
56213
- }
56214
- return ft;
56180
+ function finite3(a) {
56181
+ return Array.isArray(a) && a.length >= 3 && a.every((n) => typeof n === "number" && isFinite(n));
56215
56182
  }
56216
- var stable = (o) => {
56217
- if (Array.isArray(o)) return "[" + o.map(stable).join(",") + "]";
56218
- if (o && typeof o === "object") return "{" + Object.keys(o).sort().map((k) => k + ":" + stable(o[k])).join(",") + "}";
56219
- return JSON.stringify(o) ?? "null";
56220
- };
56221
- function connIdentity(ref, lib) {
56222
- const conn = str(ref?.conn).trim();
56223
- if (conn && lib.has(conn)) {
56224
- const r = lib.get(conn);
56225
- return `${str(r?.type)}/${str(r?.detail)}`;
56226
- }
56227
- return str(ref?.detail).trim() || str(ref?.note).trim() || "";
56183
+ function spread(n, half) {
56184
+ if (n <= 1) return [0];
56185
+ return Array.from({ length: n }, (_, i) => -half + 2 * half * i / (n - 1));
56228
56186
  }
56229
- function jointsSummary(a, b) {
56230
- const kind = (sig) => sig.split("@")[0] ?? "";
56231
- const setA = new Set(a), setB = new Set(b);
56232
- const gone = a.filter((x) => !setB.has(x));
56233
- const got = b.filter((x) => !setA.has(x));
56234
- const gk = gone.length ? kind(gone[0] ?? "") : "";
56235
- const tk = got.length ? kind(got[0] ?? "") : "";
56236
- if (gone.length && got.length && gk === tk) return `${tk || "connection"} params changed`;
56237
- if (got.length) return `${tk || "connection"} added`;
56238
- if (gone.length) return `${gk || "connection"} removed`;
56239
- return "connection changed";
56187
+ function profileKind(profile) {
56188
+ const p = (profile || "").toUpperCase().trim();
56189
+ if (/^(W|M|S|HP|UC|UB|UKC|UKB|IPE|HE)/.test(p)) return "I";
56190
+ if (/^(C|MC|PFC)/.test(p)) return "C";
56191
+ if (/^L/.test(p)) return "L";
56192
+ if (/^(HSS|PIPE|TS|SHS|RHS|CHS|TUBE|HSQ)/.test(p)) return "TUBE";
56193
+ return "BOX";
56240
56194
  }
56241
- function indexJoints(contract, lib) {
56242
- const idx = /* @__PURE__ */ new Map();
56243
- for (const j of asArray(contract?.joints)) {
56244
- const sig = `${str(j?.kind)}@${str(j?.at)}:${connIdentity(j, lib)}:${stable(j?.params)}:${stable(asArray(j?.secondaries).map(str).sort())}:${stable(j?.place)}`;
56245
- for (const ref of [str(j?.main), ...asArray(j?.secondaries).map(str)].filter(Boolean)) {
56246
- const arr = idx.get(ref);
56247
- if (arr) arr.push(sig);
56248
- else idx.set(ref, [sig]);
56195
+ function profileOutline(profile, w, d) {
56196
+ const hw = w / 2, hd = d / 2;
56197
+ switch (profileKind(profile)) {
56198
+ case "I": {
56199
+ const tf = Math.min(d * 0.5, Math.max(d * 0.1, 6)), tw = Math.min(w * 0.5, Math.max(w * 0.1, 5));
56200
+ return [
56201
+ [-hw, -hd],
56202
+ [hw, -hd],
56203
+ [hw, -hd + tf],
56204
+ [tw / 2, -hd + tf],
56205
+ [tw / 2, hd - tf],
56206
+ [hw, hd - tf],
56207
+ [hw, hd],
56208
+ [-hw, hd],
56209
+ [-hw, hd - tf],
56210
+ [-tw / 2, hd - tf],
56211
+ [-tw / 2, -hd + tf],
56212
+ [-hw, -hd + tf]
56213
+ ];
56214
+ }
56215
+ case "C": {
56216
+ const tf = Math.max(d * 0.1, 5), tw = Math.max(w * 0.12, 5);
56217
+ return [[-hw, -hd], [hw, -hd], [hw, -hd + tf], [-hw + tw, -hd + tf], [-hw + tw, hd - tf], [hw, hd - tf], [hw, hd], [-hw, hd]];
56218
+ }
56219
+ case "L": {
56220
+ const t = Math.max(Math.min(w, d) * 0.18, 5);
56221
+ return [[-hw, -hd], [hw, -hd], [hw, -hd + t], [-hw + t, -hd + t], [-hw + t, hd], [-hw, hd]];
56249
56222
  }
56223
+ default:
56224
+ return [[-hw, -hd], [hw, -hd], [hw, hd], [-hw, hd]];
56250
56225
  }
56251
- for (const sigs of idx.values()) sigs.sort();
56252
- return idx;
56253
56226
  }
56254
- function diffContracts(from, to) {
56255
- const A = collect(from);
56256
- const B = collect(to);
56257
- const dupKeys = [.../* @__PURE__ */ new Set([...A.dupKeys, ...B.dupKeys])];
56258
- const ambiguous = new Set(dupKeys);
56259
- const libA = new Map(asArray(from?.connections).map((r) => [str(r?.id), r]));
56260
- const libB = new Map(asArray(to?.connections).map((r) => [str(r?.id), r]));
56261
- const jointsA = indexJoints(from, libA);
56262
- const jointsB = indexJoints(to, libB);
56263
- const ambiguousJoints = /* @__PURE__ */ new Set();
56264
- const flagAmbiguousJoints = (contract, idSheets) => {
56265
- for (const j of asArray(contract?.joints)) {
56266
- const refs = [str(j?.main), ...asArray(j?.secondaries).map(str)].filter(Boolean);
56267
- if (refs.some((r) => (idSheets.get(r)?.size ?? 0) > 1)) ambiguousJoints.add(str(j?.id));
56268
- }
56269
- };
56270
- flagAmbiguousJoints(from, A.idSheets);
56271
- flagAmbiguousJoints(to, B.idSheets);
56272
- const added = [];
56273
- const removed = [];
56274
- for (const [key, b] of B.byKey) if (!A.byKey.has(key)) added.push(refOf(b));
56275
- for (const [key, a] of A.byKey) if (!B.byKey.has(key)) removed.push(refOf(a));
56276
- const resized = [];
56277
- const material = [];
56278
- const moved = [];
56279
- const connections = [];
56280
- let unchanged = 0;
56281
- let anyScaleUnknown = false;
56282
- for (const [key, a] of A.byKey) {
56283
- const b = B.byKey.get(key);
56284
- if (!b || ambiguous.has(key)) continue;
56285
- let changed = false;
56286
- if (normProfile(a.profile) !== normProfile(b.profile)) {
56287
- resized.push({ ref: refOf(b), from: a.profile, to: b.profile });
56288
- changed = true;
56289
- }
56290
- if (a.material.trim().toUpperCase() !== b.material.trim().toUpperCase() && (a.material || b.material)) {
56291
- material.push({ ref: refOf(b), from: a.material, to: b.material });
56292
- changed = true;
56293
- }
56294
- const planMove = a.wp.length && b.wp.length ? beamMoveFeet(a, b) : { feet: 0, flipped: false };
56295
- const feet = Math.max(planMove.feet, elevMoveFeet(a, b));
56296
- if (feet > MOVE_TOL_FT) {
56297
- const scaleUnknown = !a.hasScale || !b.hasScale;
56298
- moved.push({ ref: refOf(b), feet: Math.round(feet * 10) / 10, ...scaleUnknown ? { scaleUnknown: true } : {} });
56299
- if (scaleUnknown) anyScaleUnknown = true;
56300
- changed = true;
56301
- }
56302
- const eA = [connIdentity(a.ends?.[0], libA), connIdentity(a.ends?.[1], libA)];
56303
- const eB = [connIdentity(b.ends?.[0], libB), connIdentity(b.ends?.[1], libB)];
56304
- const [eB0, eB1] = planMove.flipped ? [eB[1], eB[0]] : [eB[0], eB[1]];
56305
- const parts = [];
56306
- if (eA[0] !== eB0) parts.push(`end 1: ${eA[0] || "none"} \u2192 ${eB0 || "none"}`);
56307
- if (eA[1] !== eB1) parts.push(`end 2: ${eA[1] || "none"} \u2192 ${eB1 || "none"}`);
56308
- const cA = connIdentity(a.col, libA), cB = connIdentity(b.col, libB);
56309
- if (cA !== cB) parts.push(`column: ${cA || "none"} \u2192 ${cB || "none"}`);
56310
- if (!((A.idSheets.get(a.id)?.size ?? 0) > 1 || (B.idSheets.get(b.id)?.size ?? 0) > 1)) {
56311
- const jA = jointsA.get(a.id) ?? [];
56312
- const jB = jointsB.get(b.id) ?? [];
56313
- if (stable(jA) !== stable(jB)) parts.push(jointsSummary(jA, jB));
56314
- }
56315
- if (parts.length) {
56316
- connections.push({ ref: refOf(b), summary: parts.join("; ") });
56317
- changed = true;
56227
+ function expandBasePlate(joint, col) {
56228
+ const p = joint.params;
56229
+ const base = col.from[2] <= col.to[2] ? col.from : col.to;
56230
+ const [bx, by, bz] = base;
56231
+ const { w, d } = col.dims;
56232
+ const thickness = pos(p, "thickness", 25);
56233
+ const margin = Math.max(0, num(p, "margin", 75));
56234
+ const width = pos(p, "plateWidth", Math.max(w, d) + 2 * margin);
56235
+ const depth = pos(p, "plateDepth", Math.max(w, d) + 2 * margin);
56236
+ const boltDia = pos(p, "boltDia", 24);
56237
+ const clearance = num(p, "holeClearance", 6);
56238
+ const edge = num(p, "edgeDist", Math.max(1.5 * boltDia, 40));
56239
+ const cols = intMin1(p, "boltCols", 2);
56240
+ const rows = intMin1(p, "boltRows", 2);
56241
+ const weldLeg = num(p, "weldLeg", 8);
56242
+ const projBelow = num(p, "projBelow", Math.max(220, 9 * boltDia));
56243
+ const embedment = Math.max(0, num(p, "embedment", 0));
56244
+ const grout = Math.max(0, num(p, "grout", 0));
56245
+ const nutH = pos(p, "nutHeight", 0.8 * boltDia);
56246
+ const nutAF = pos(p, "nutAcrossFlats", 1.6 * boltDia);
56247
+ const wpSide = pos(p, "washerPlateSide", 2.5 * boltDia);
56248
+ const wpThick = pos(p, "washerPlateThickness", Math.max(0.35 * boltDia, 8));
56249
+ const washerOD = pos(p, "washerOuter", 2 * boltDia);
56250
+ const washerID = boltDia + 3;
56251
+ const washerH = pos(p, "washerThickness", Math.max(0.25 * boltDia, 4));
56252
+ const levelingNut = p?.["levelingNut"] !== false;
56253
+ const anchorPlate = p?.["anchorPlate"] !== false;
56254
+ const apSide = pos(p, "anchorPlateSide", 3.3 * boltDia);
56255
+ const apThick = pos(p, "anchorPlateThickness", Math.max(0.6 * boltDia, 20));
56256
+ const bottomNut = p?.["bottomNut"] !== false;
56257
+ const rodProj = pos(p, "anchorRodProjection", 25.4 / 4);
56258
+ const SEAT = 0.5;
56259
+ const rodBelow = Math.max(embedment > 0 ? grout + embedment : projBelow, rodProj + nutH + apThick + SEAT);
56260
+ const plateTop = bz + EMBED, plateBottom = plateTop - thickness;
56261
+ const us = spread(cols, Math.max(0, width / 2 - edge));
56262
+ const vs = spread(rows, Math.max(0, depth / 2 - edge));
56263
+ const holes = [];
56264
+ const kit = [];
56265
+ const wpBot = plateTop + SEAT, wpTop = wpBot + wpThick, washerTop = wpTop + washerH, fnTop = washerTop + nutH;
56266
+ const rodTopZ = fnTop + 0.4 * boltDia, rodBotZ = plateBottom - rodBelow;
56267
+ const concreteTopZ = plateBottom - (embedment > 0 ? grout : 0);
56268
+ let k = 0;
56269
+ for (const v of vs) {
56270
+ for (const u of us) {
56271
+ const ax = bx + u, ay = by + v, jid = joint.id;
56272
+ holes.push({ u, v, d: boltDia + clearance });
56273
+ kit.push(
56274
+ { id: `${jid}:rod${k}`, group: "anchor", kind: "rod", from: [ax, ay, rodBotZ], to: [ax, ay, rodTopZ], d: boltDia, meta: { label: `Anchor rod \u2300${boltDia}` } },
56275
+ { id: `${jid}:wp${k}`, group: "washer-plate", kind: "plate", center: [ax, ay, wpBot + wpThick / 2], uDir: [1, 0, 0], vDir: [0, 1, 0], width: wpSide, depth: wpSide, thickness: wpThick, holes: [{ u: 0, v: 0, d: boltDia + 2 }], meta: { label: `Washer plate ${Math.round(wpSide)}\xD7${Math.round(wpSide)}\xD7${Math.round(wpThick)}` } },
56276
+ { id: `${jid}:wsh${k}`, group: "washer", kind: "washer", from: [ax, ay, wpTop], to: [ax, ay, washerTop], dOuter: washerOD, dInner: washerID, meta: { label: `Washer \u2300${Math.round(washerOD)}` } },
56277
+ { id: `${jid}:fn${k}`, group: "nut", kind: "nut", from: [ax, ay, washerTop], to: [ax, ay, fnTop], acrossFlats: nutAF, meta: { label: `Nut M${boltDia}` } }
56278
+ );
56279
+ if (levelingNut) kit.push({ id: `${jid}:ln${k}`, group: "nut", kind: "nut", from: [ax, ay, plateBottom - SEAT - nutH], to: [ax, ay, plateBottom - SEAT], acrossFlats: nutAF, meta: { label: `Leveling nut M${boltDia}` } });
56280
+ const nutBotZ = rodBotZ + rodProj;
56281
+ if (bottomNut) kit.push({ id: `${jid}:fnb${k}`, group: "nut", kind: "nut", from: [ax, ay, nutBotZ], to: [ax, ay, nutBotZ + nutH], acrossFlats: nutAF, meta: { label: `Anchor nut M${boltDia}` } });
56282
+ const apBotZ = nutBotZ + (bottomNut ? nutH : 0);
56283
+ if (anchorPlate) kit.push({ id: `${jid}:ap${k}`, group: "anchor-plate", kind: "plate", center: [ax, ay, apBotZ + apThick / 2], uDir: [1, 0, 0], vDir: [0, 1, 0], width: apSide, depth: apSide, thickness: apThick, holes: [{ u: 0, v: 0, d: boltDia + 2 }], meta: { label: `Anchor plate ${Math.round(apSide)}\xD7${Math.round(apSide)}\xD7${Math.round(apThick)}` } });
56284
+ k++;
56318
56285
  }
56319
- if (!changed) unchanged++;
56320
56286
  }
56321
- const keysA = A.byKey.size;
56322
- const keysB = B.byKey.size;
56323
- let shared = 0;
56324
- for (const k of A.byKey.keys()) if (B.byKey.has(k)) shared++;
56325
- const smaller = Math.min(keysA, keysB);
56326
- const identityNotPreserved = keysA >= 5 && keysB >= 5 && smaller > 0 && shared / smaller < 0.1;
56327
- const bom = (x) => {
56328
- try {
56329
- return contractToBom(x);
56330
- } catch {
56331
- return { totalLb: 0, totalTons: 0 };
56287
+ const plate = {
56288
+ id: `${joint.id}:plate`,
56289
+ group: "base-plate",
56290
+ kind: "plate",
56291
+ center: [bx, by, plateBottom + thickness / 2],
56292
+ // plate top seats the column (= bz + EMBED); body hangs below
56293
+ uDir: [1, 0, 0],
56294
+ vDir: [0, 1, 0],
56295
+ width,
56296
+ depth,
56297
+ thickness,
56298
+ holes,
56299
+ meta: {
56300
+ label: `Base plate ${Math.round(width)}\xD7${Math.round(depth)}\xD7${Math.round(thickness)}`,
56301
+ // anchor depth for the view's PROJ/GROUT/EMBED overlay + the rod inspector. projection is above B.O.
56302
+ // plate; the grout pad sits B.O. plate → T.O. concrete; embedment is INTO the concrete (T.O. concrete → rod bottom).
56303
+ anchor: { rodTopZ, rodBotZ, plateBotZ: plateBottom, concreteTopZ, projMm: rodTopZ - plateBottom, groutMm: plateBottom - concreteTopZ, embedMm: concreteTopZ - rodBotZ, embedSet: embedment > 0 }
56332
56304
  }
56333
56305
  };
56334
- const fromBom = bom(from);
56335
- const toBom = bom(to);
56336
- const netLb = toBom.totalLb - fromBom.totalLb;
56337
- const warnings = {
56338
- ...identityNotPreserved ? { identityNotPreserved: true } : {},
56339
- ...dupKeys.length ? { duplicateKeys: dupKeys } : {},
56340
- ...ambiguousJoints.size ? { ambiguousJoints: [...ambiguousJoints] } : {},
56341
- ...anyScaleUnknown ? { scaleUnknown: true } : {}
56342
- };
56343
- return {
56344
- from: 0,
56345
- to: 0,
56346
- tonnage: {
56347
- fromLb: fromBom.totalLb,
56348
- toLb: toBom.totalLb,
56349
- netLb,
56350
- fromTons: fromBom.totalTons,
56351
- toTons: toBom.totalTons,
56352
- netTons: Math.round(netLb / 2e3 * 10) / 10
56353
- },
56354
- added,
56355
- removed,
56356
- resized,
56357
- moved,
56358
- material,
56359
- connections,
56360
- unchanged,
56361
- warnings
56306
+ const axisSign = col.to[2] < col.from[2] ? -1 : 1;
56307
+ const rollRad = (col.rot || 0) * Math.PI * axisSign / 180;
56308
+ const cosR = Math.cos(rollRad), sinR = Math.sin(rollRad);
56309
+ const weld = {
56310
+ id: `${joint.id}:weld`,
56311
+ group: "weld",
56312
+ kind: "weld",
56313
+ path: profileOutline(col.profile, w, d).map(([u, vv]) => [bx + (u * cosR - vv * sinR), by + (u * sinR + vv * cosR), bz]),
56314
+ leg: weldLeg,
56315
+ meta: { label: `Fillet ${weldLeg}` }
56362
56316
  };
56317
+ return [plate, ...kit, weld];
56363
56318
  }
56364
-
56365
- // version-diff.ts
56366
- function appSupportsDiff(app) {
56367
- return app === "steel-model";
56319
+ function webHalfThk(profile, w) {
56320
+ return profileKind(profile) === "I" ? Math.min(w * 0.5, Math.max(w * 0.1, 5)) / 2 : 0;
56368
56321
  }
56369
- function computeVersionDiff(id, n, base) {
56370
- if (!Number.isInteger(n) || n < 1) return { code: 400, body: { ok: false, error: "n must be a positive integer version number" } };
56371
- const head = listVersions(id)[0]?.n ?? 0;
56372
- if (head === 0) return { code: 404, body: { ok: false, error: "no versions for this project" } };
56373
- const to = readVersionSkeleton(id, n);
56374
- if (to == null) return { code: 404, body: { ok: false, error: `version v${n} not found` } };
56375
- if (n === 1) {
56376
- const empty = diffContracts({}, to);
56377
- return {
56378
- code: 200,
56379
- body: { ok: true, diff: { ...empty, from: 0, to: 1, firstVersion: true, added: [], tonnage: { fromLb: 0, toLb: 0, netLb: 0, fromTons: 0, toTons: 0, netTons: 0 } } }
56380
- };
56322
+ function distPointSeg(p, a, b) {
56323
+ const abx = b[0] - a[0], aby = b[1] - a[1], abz = b[2] - a[2];
56324
+ const apx = p[0] - a[0], apy = p[1] - a[1], apz = p[2] - a[2];
56325
+ const len2 = abx * abx + aby * aby + abz * abz;
56326
+ const t = len2 > 1e-9 ? Math.max(0, Math.min(1, (apx * abx + apy * aby + apz * abz) / len2)) : 0;
56327
+ return Math.hypot(apx - t * abx, apy - t * aby, apz - t * abz);
56328
+ }
56329
+ function unitDir(a, b) {
56330
+ const dx = b[0] - a[0], dy = b[1] - a[1], dz = b[2] - a[2];
56331
+ const L = Math.hypot(dx, dy, dz);
56332
+ return L > 1e-9 ? [dx / L, dy / L, dz / L] : null;
56333
+ }
56334
+ function inferSupport(beam, end, memberGeo) {
56335
+ const bd = unitDir(beam.from, beam.to);
56336
+ let best, bestD = Infinity;
56337
+ for (const m of memberGeo.values()) {
56338
+ if (m.id === beam.id || m.isBrace || !finite3(m.from) || !finite3(m.to)) continue;
56339
+ const md = unitDir(m.from, m.to);
56340
+ if (bd && md && Math.abs(bd[0] * md[0] + bd[1] * md[1] + bd[2] * md[2]) > 0.966) continue;
56341
+ const d = distPointSeg(end, m.from, m.to);
56342
+ if (d < bestD) {
56343
+ bestD = d;
56344
+ best = m;
56345
+ }
56381
56346
  }
56382
- const b = base ?? n - 1;
56383
- if (!Number.isInteger(b) || b < 1 || b >= n) return { code: 400, body: { ok: false, error: `base must be an integer in 1..${n - 1}` } };
56384
- const from = readVersionSkeleton(id, b);
56385
- if (from == null) return { code: 404, body: { ok: false, error: `base version v${b} not found` } };
56386
- const diff = diffContracts(from, to);
56387
- diff.from = b;
56388
- diff.to = n;
56389
- return { code: 200, body: { ok: true, diff } };
56347
+ return best && bestD <= Math.max(best.dims.w, best.dims.d) ? best : void 0;
56390
56348
  }
56391
-
56392
- // project-sources-store.ts
56393
- var import_node_crypto10 = require("node:crypto");
56394
- var import_node_fs27 = require("node:fs");
56395
- var import_node_path24 = require("node:path");
56396
- var sourcesDir = (id) => (0, import_node_path24.join)(projectDir(id), "sources");
56397
- var safeExt = (ext) => typeof ext === "string" && /^[a-z0-9]{1,8}$/i.test(ext) ? ext.toLowerCase() : "bin";
56398
- function writeAtomic2(path, buf) {
56399
- const tmp = `${path}.${process.pid}.tmp`;
56400
- (0, import_node_fs27.writeFileSync)(tmp, buf);
56401
- (0, import_node_fs27.renameSync)(tmp, path);
56349
+ function flangeThk(profile, d) {
56350
+ return profileKind(profile) === "I" ? Math.min(d * 0.5, Math.max(d * 0.1, 6)) : d / 2;
56402
56351
  }
56403
- function saveSource(id, file) {
56404
- (0, import_node_fs27.mkdirSync)(sourcesDir(id), { recursive: true });
56405
- const sha2562 = (0, import_node_crypto10.createHash)("sha256").update(file.buf).digest("hex");
56406
- const ext = safeExt(file.ext);
56407
- const p = (0, import_node_path24.join)(sourcesDir(id), `${sha2562}.${ext}`);
56408
- if (!(0, import_node_fs27.existsSync)(p)) writeAtomic2(p, file.buf);
56409
- return { name: String(file.name), sha256: sha2562, ext, bytes: file.buf.length };
56352
+ var clamp = (x, lo, hi) => Math.max(lo, Math.min(hi, x));
56353
+ function supportWorkZAt(support, pt) {
56354
+ const a = support.from, b = support.to;
56355
+ const dx = b[0] - a[0], dy = b[1] - a[1];
56356
+ const len2 = dx * dx + dy * dy;
56357
+ if (!(len2 > 1e-9)) return a[2];
56358
+ const t = clamp(((pt[0] - a[0]) * dx + (pt[1] - a[1]) * dy) / len2, 0, 1);
56359
+ return a[2] + (b[2] - a[2]) * t;
56410
56360
  }
56411
-
56412
- // contract-bake.ts
56413
- var import_node_fs28 = require("node:fs");
56414
- var import_yaml6 = __toESM(require_dist6(), 1);
56415
- function bakeContractIntoApp(sourcePath, contract) {
56416
- const doc = (0, import_yaml6.parseDocument)((0, import_node_fs28.readFileSync)(sourcePath, "utf8"));
56417
- if (doc.errors.length > 0) {
56418
- throw new Error(`contract bake: source is not valid YAML: ${doc.errors[0]?.message ?? "parse error"}`);
56419
- }
56420
- const seq = doc.get("nodes");
56421
- const items = (0, import_yaml6.isSeq)(seq) ? seq.items : [];
56422
- const nodeOf = (it) => (0, import_yaml6.isMap)(it) ? it.toJSON() : null;
56423
- let idx = items.findIndex((it) => nodeOf(it)?.config?.contract === contract.type);
56424
- if (idx < 0) idx = items.findIndex((it) => nodeOf(it)?.agent === "steel-takeoff-us");
56425
- if (idx < 0) throw new Error("no contract-emitting node to bake the contract into");
56426
- doc.setIn(["nodes", idx, "config", "contract"], contract.type);
56427
- const baked = { ...contract };
56428
- delete baked.dims3d;
56429
- delete baked.detail_placements;
56430
- delete baked.prop_labels;
56431
- delete baked.member_styles;
56432
- if (Array.isArray(contract.plans)) {
56433
- baked.plans = contract.plans.map((p) => {
56434
- if (p && typeof p === "object") {
56435
- const clone = { ...p };
56436
- delete clone.dims;
56437
- return clone;
56438
- }
56439
- return p;
56440
- });
56441
- }
56442
- const stripPageRaster = (p) => {
56443
- if (p && typeof p === "object") {
56444
- const page = { ...p };
56445
- delete page.bg_b64;
56446
- return page;
56447
- }
56448
- return p;
56449
- };
56450
- const filter = baked.filter;
56451
- if (filter && typeof filter === "object") {
56452
- const next = { ...filter };
56453
- if (filter.page) next.page = stripPageRaster(filter.page);
56454
- if (Array.isArray(filter.sheets)) {
56455
- next.sheets = filter.sheets.map(
56456
- (s) => s && typeof s === "object" ? { ...s, page: stripPageRaster(s.page) } : s
56361
+ function beamCopes(beam, support, at, params) {
56362
+ if (!support || !finite3(support.from) || !finite3(support.to) || !support.dims || !(support.dims.d > 0) || !(support.dims.w > 0)) return {};
56363
+ if (!finite3(beam.from) || !finite3(beam.to) || !beam.dims || !(beam.dims.d > 0) || !(beam.dims.w > 0)) return {};
56364
+ if (profileKind(support.profile) !== "I") return {};
56365
+ const endPt = at === "end1" ? beam.to : beam.from;
56366
+ const gap = Math.max(0, num(params, "clearance", 12.7));
56367
+ const beamMidZ = endPt[2] + (typeof beam.posOffset === "number" && isFinite(beam.posOffset) ? beam.posOffset : 0);
56368
+ const beamTopZ = beamMidZ + beam.dims.d / 2, beamBotZ = beamMidZ - beam.dims.d / 2;
56369
+ const supMidZ = supportWorkZAt(support, endPt) + (typeof support.posOffset === "number" && isFinite(support.posOffset) ? support.posOffset : 0);
56370
+ const supTopZ = supMidZ + support.dims.d / 2, supBotZ = supMidZ - support.dims.d / 2;
56371
+ const tfS = flangeThk(support.profile, support.dims.d);
56372
+ const kClear = Math.max(0, num(params, "copeKClear", 12.7));
56373
+ const minLen = Math.max(0, num(params, "copeMinLength", 31.75));
56374
+ const kBand = tfS + kClear;
56375
+ const webLo = supBotZ + kBand, webHi = supTopZ - kBand;
56376
+ if (!(webLo < webHi && beamTopZ > webLo && beamBotZ < webHi)) return {};
56377
+ const length = Math.max(support.dims.w / 2 + gap, minLen);
56378
+ const out = {};
56379
+ if (beamTopZ > webHi) out.top = { depth: clamp(beamTopZ - (webHi - gap), 0, beam.dims.d), length };
56380
+ if (beamBotZ < webLo) out.bottom = { depth: clamp(webLo + gap - beamBotZ, 0, beam.dims.d), length };
56381
+ return out;
56382
+ }
56383
+ var IN = 25.4;
56384
+ function aiscBoltLength(gripMm, diaMm) {
56385
+ const Q = IN / 4;
56386
+ const raw = gripMm + diaMm + Q;
56387
+ const step = raw > 5 * IN ? 2 * Q : Q;
56388
+ return Math.ceil((raw - 1e-6) / step) * step;
56389
+ }
56390
+ function expandShearPlate(joint, beam, support) {
56391
+ const p = joint.params;
56392
+ const atEnd1 = joint.at === "end1";
56393
+ const endPt = atEnd1 ? beam.to : beam.from;
56394
+ const farPt = atEnd1 ? beam.from : beam.to;
56395
+ let ux = farPt[0] - endPt[0], uy = farPt[1] - endPt[1];
56396
+ const hLen = Math.hypot(ux, uy);
56397
+ if (!(hLen > 1e-6)) return [];
56398
+ ux /= hLen;
56399
+ uy /= hLen;
56400
+ const uDir = [ux, uy, 0];
56401
+ const vDir = [0, 0, 1];
56402
+ const nDir = [uy, -ux, 0];
56403
+ const posOff = typeof beam.posOffset === "number" && isFinite(beam.posOffset) ? beam.posOffset : 0;
56404
+ const webZ = endPt[2] + posOff;
56405
+ const P = (u, v, n) => [
56406
+ endPt[0] + uDir[0] * u + nDir[0] * n,
56407
+ endPt[1] + uDir[1] * u + nDir[1] * n,
56408
+ webZ + v
56409
+ ];
56410
+ const thickness = pos(p, "plateThickness", 10);
56411
+ const width = pos(p, "plateWidth", 120);
56412
+ const boltDia = pos(p, "boltDia", 20);
56413
+ const cols = intMin1(p, "boltCols", 1);
56414
+ const rows = intMin1(p, "boltRows", 3);
56415
+ const pitch = pos(p, "boltPitch", 70);
56416
+ const colPitch = pos(p, "boltColPitch", pitch);
56417
+ const holeClr = num(p, "holeClearance", 2);
56418
+ const edge = Math.max(0, num(p, "edgeDist", Math.max(1.5 * boltDia, 30)));
56419
+ const weldLeg = num(p, "weldLeg", 6);
56420
+ const clearance = Math.max(0, num(p, "clearance", 12.7));
56421
+ const stiffener = p?.["stiffener"] === true;
56422
+ const height = pos(p, "plateHeight", (rows - 1) * pitch + 2 * edge);
56423
+ const twHalf = webHalfThk(beam.profile, beam.dims.w);
56424
+ const webSide = num(p, "webSide", 1) >= 0 ? 1 : -1;
56425
+ const pOff = webSide * (twHalf + thickness / 2);
56426
+ const u0 = support ? webHalfThk(support.profile, support.dims.w) : 0;
56427
+ const edgeV = Math.min(edge, height * 0.4);
56428
+ const pV = rows > 1 ? Math.min(pitch, Math.max(0, height - 2 * edgeV) / (rows - 1)) : 0;
56429
+ const vOffs = Array.from({ length: rows }, (_, i) => (i - (rows - 1) / 2) * pV);
56430
+ const edgeU = Math.min(edge, width * 0.4);
56431
+ const regHi = Math.max(edgeU, width - edgeU);
56432
+ const regLo = Math.min(clearance + edgeU, regHi);
56433
+ const cU = (regLo + regHi) / 2;
56434
+ const pU = cols > 1 ? Math.min(colPitch, (regHi - regLo) / (cols - 1)) : 0;
56435
+ const uOffs = Array.from({ length: cols }, (_, j) => cU + (j - (cols - 1) / 2) * pU);
56436
+ const nutH = 0.8 * boltDia, nutAF = 1.6 * boltDia;
56437
+ const plateOuterN = webSide * (twHalf + thickness);
56438
+ const webFarN = -webSide * twHalf;
56439
+ const headTipN = plateOuterN + webSide * nutH;
56440
+ const nutTipN = webFarN - webSide * nutH;
56441
+ const grade = p?.["boltGrade"] === "A490" ? "A490" : "A325";
56442
+ const grip = thickness + 2 * twHalf;
56443
+ const boltLen = aiscBoltLength(grip, boltDia);
56444
+ const callout = `\u2300${Math.round(boltDia)} ${grade} \xD7 ${Math.round(boltLen)}`;
56445
+ const holes = [];
56446
+ const bolts = [];
56447
+ let k = 0;
56448
+ for (const v of vOffs) {
56449
+ for (const u of uOffs) {
56450
+ const jid = joint.id;
56451
+ holes.push({ u: u - width / 2, v, d: boltDia + holeClr });
56452
+ bolts.push(
56453
+ // the shank = the AISC bolt LENGTH, from under the head (plate outer face) into the connection
56454
+ { id: `${jid}:bolt${k}`, group: "bolt", kind: "rod", from: P(u0 + u, v, plateOuterN), to: P(u0 + u, v, plateOuterN - webSide * boltLen), d: boltDia, meta: { label: `Bolt ${callout}` } },
56455
+ { id: `${jid}:head${k}`, group: "nut", kind: "nut", from: P(u0 + u, v, plateOuterN), to: P(u0 + u, v, headTipN), acrossFlats: nutAF, meta: { label: `Bolt head ${callout}` } },
56456
+ { id: `${jid}:nut${k}`, group: "nut", kind: "nut", from: P(u0 + u, v, webFarN), to: P(u0 + u, v, nutTipN), acrossFlats: nutAF, meta: { label: `Bolt nut ${callout}` } }
56457
56457
  );
56458
+ k++;
56458
56459
  }
56459
- baked.filter = next;
56460
56460
  }
56461
- if (Array.isArray(baked.sheets)) {
56462
- baked.sheets = baked.sheets.map(
56463
- (s) => s && typeof s === "object" ? { ...s, page: stripPageRaster(s.page) } : s
56464
- );
56461
+ const plate = {
56462
+ id: `${joint.id}:plate`,
56463
+ group: "shear-plate",
56464
+ kind: "plate",
56465
+ center: P(u0 + width / 2, 0, pOff),
56466
+ uDir,
56467
+ vDir,
56468
+ // welded edge at the support web FACE (u0); lapped on the webSide face; cantilevered +uDir toward the beam
56469
+ width,
56470
+ depth: height,
56471
+ thickness,
56472
+ holes,
56473
+ meta: { label: `Shear plate ${Math.round(width)}\xD7${Math.round(height)}\xD7${Math.round(thickness)}` }
56474
+ };
56475
+ const weldSide = p?.["weldSide"] === "near" || p?.["weldSide"] === "far" ? p["weldSide"] : "both";
56476
+ const nOuter = pOff + webSide * thickness / 2;
56477
+ const nInner = pOff - webSide * thickness / 2;
56478
+ const faceWeld = (suffix, n) => ({
56479
+ id: `${joint.id}:${suffix}`,
56480
+ group: "weld",
56481
+ kind: "weld",
56482
+ closed: false,
56483
+ path: [P(u0, -height / 2, n), P(u0, height / 2, n)],
56484
+ leg: weldLeg,
56485
+ // at the support web FACE
56486
+ meta: { label: `Fillet ${weldLeg} (${weldSide === "both" ? "both sides" : weldSide + " side"})` }
56487
+ });
56488
+ const welds = [];
56489
+ if (weldSide !== "far") welds.push(faceWeld("weld", nOuter));
56490
+ if (weldSide !== "near") welds.push(faceWeld("weld2", nInner));
56491
+ const parts = [plate, ...bolts, ...welds];
56492
+ if (stiffener) {
56493
+ if (support && support.role === "beam" && !support.isBrace && finite3(support.from) && finite3(support.to) && support.dims && support.dims.d > 0 && support.dims.w > 0) {
56494
+ const supPosOff = typeof support.posOffset === "number" && isFinite(support.posOffset) ? support.posOffset : 0;
56495
+ const twGirder = webHalfThk(support.profile, support.dims.w) * 2;
56496
+ const stiffH = support.dims.d * 0.9;
56497
+ const stiffW = Math.max(support.dims.w / 2 - twGirder / 2, thickness * 2);
56498
+ const girderCentZ = endPt[2] + supPosOff;
56499
+ const cu = -(twGirder / 2 + stiffW / 2);
56500
+ const center = [endPt[0] + uDir[0] * cu, endPt[1] + uDir[1] * cu, girderCentZ];
56501
+ parts.push({ id: `${joint.id}:stiff`, group: "stiffener", kind: "plate", center, uDir, vDir, width: stiffW, depth: stiffH, thickness, holes: [], meta: { label: `Stiffener ${Math.round(stiffW)}\xD7${Math.round(stiffH)}\xD7${Math.round(thickness)}` } });
56502
+ const wfx = endPt[0] - uDir[0] * (twGirder / 2), wfy = endPt[1] - uDir[1] * (twGirder / 2);
56503
+ parts.push({ id: `${joint.id}:stiffweld`, group: "weld", kind: "weld", closed: false, path: [[wfx, wfy, girderCentZ - stiffH / 2], [wfx, wfy, girderCentZ + stiffH / 2]], leg: weldLeg, meta: { label: `Fillet ${weldLeg}` } });
56504
+ } else {
56505
+ const oppOff = -webSide * (twHalf + thickness / 2);
56506
+ parts.push({ id: `${joint.id}:stiff`, group: "stiffener", kind: "plate", center: P(u0 + width / 2, 0, oppOff), uDir, vDir, width, depth: height, thickness, holes: [], meta: { label: `Stiffener ${Math.round(width)}\xD7${Math.round(height)}\xD7${Math.round(thickness)}` } });
56507
+ parts.push({ id: `${joint.id}:stiffweld`, group: "weld", kind: "weld", closed: false, path: [P(u0, -height / 2, oppOff), P(u0, height / 2, oppOff)], leg: weldLeg, meta: { label: `Fillet ${weldLeg}` } });
56508
+ }
56465
56509
  }
56466
- doc.setIn(["nodes", idx, "config", "takeoff"], baked);
56467
- (0, import_node_fs28.writeFileSync)(sourcePath, doc.toString());
56510
+ const cope = beamCopes(beam, support, joint.at ?? "end0", p);
56511
+ const copeRadius = pos(p, "copeRadius", 12.7);
56512
+ const MIN_COPE = 1;
56513
+ const pushCope = (side, dec) => {
56514
+ if (!(dec.depth > MIN_COPE)) return;
56515
+ const lenU = dec.length + clearance;
56516
+ const vC = side === "top" ? beam.dims.d / 2 - dec.depth / 2 : -beam.dims.d / 2 + dec.depth / 2;
56517
+ parts.push({
56518
+ id: `${joint.id}:cope-${side}`,
56519
+ group: "cope",
56520
+ kind: "cut",
56521
+ member: beam.id,
56522
+ center: P(lenU / 2, vC, 0),
56523
+ uDir,
56524
+ vDir,
56525
+ width: lenU,
56526
+ depth: dec.depth,
56527
+ thickness: beam.dims.w + 2,
56528
+ radius: copeRadius,
56529
+ reentrantV: side === "top" ? -1 : 1,
56530
+ // web side = toward the beam centroid (top cope below, bottom above)
56531
+ meta: { label: `${side === "top" ? "Top" : "Bottom"} cope ${Math.round(dec.length)}\xD7${Math.round(dec.depth)}` }
56532
+ });
56533
+ };
56534
+ if (cope.top) pushCope("top", cope.top);
56535
+ if (cope.bottom) pushCope("bottom", cope.bottom);
56536
+ return parts;
56468
56537
  }
56469
-
56470
- // vectorize.ts
56471
- function assignIds(items, prefix) {
56472
- const used = /* @__PURE__ */ new Set();
56473
- const keep = items.map((it) => {
56474
- if (it.id && !used.has(it.id)) {
56475
- used.add(it.id);
56476
- return true;
56538
+ function expandCustom(joint) {
56539
+ const place = finite3(joint.place) ? joint.place : [0, 0, 0];
56540
+ const [dx, dy, dz] = place;
56541
+ const out = [];
56542
+ (joint.geometry ?? []).forEach((g, i) => {
56543
+ if (!g || !Array.isArray(g.positions) || !Array.isArray(g.indices)) return;
56544
+ if (g.positions.length < 9 || g.indices.length < 3 || g.positions.length % 3 !== 0) return;
56545
+ const positions = new Array(g.positions.length);
56546
+ for (let k = 0; k < g.positions.length; k += 3) {
56547
+ positions[k] = g.positions[k] + dx;
56548
+ positions[k + 1] = g.positions[k + 1] + dy;
56549
+ positions[k + 2] = g.positions[k + 2] + dz;
56477
56550
  }
56478
- return false;
56551
+ const role = typeof g.role === "string" ? g.role : void 0;
56552
+ const label = role ? role.charAt(0).toUpperCase() + role.slice(1) : "Imported part";
56553
+ out.push({ id: `${joint.id}:${g.id || `m${i}`}`, group: "custom", kind: "mesh", positions, indices: g.indices.slice(), meta: { label, role } });
56479
56554
  });
56480
- let counter = 0;
56481
- const nextId = () => {
56482
- let id;
56483
- do {
56484
- counter += 1;
56485
- id = `${prefix}${counter}`;
56486
- } while (used.has(id));
56487
- used.add(id);
56488
- return id;
56489
- };
56490
- return items.map((it, i) => keep[i] ? it : { ...it, id: nextId() });
56491
- }
56492
- function geomKey(el, index) {
56493
- const layer = el.layer ?? "";
56494
- if (el.kind === "text") {
56495
- const pos2 = el.origin ? el.origin.join(",") : (el.bbox ?? []).join(",");
56496
- return `text|${layer}|${el.text ?? ""}|${pos2}`;
56497
- }
56498
- if (el.d) return `${el.kind}|${layer}|${el.d}`;
56499
- if (el.pts) return `${el.kind}|${layer}|${el.pts.map((p) => p.join(",")).join(" ")}`;
56500
- return `nogeom|${index}`;
56555
+ return out;
56501
56556
  }
56502
- function dedupeElements(elements) {
56503
- const seen = /* @__PURE__ */ new Set();
56504
- const out = [];
56505
- elements.forEach((el, i) => {
56506
- const key = geomKey(el, i);
56507
- if (seen.has(key)) return;
56508
- seen.add(key);
56509
- out.push(el);
56510
- });
56511
- return out;
56512
- }
56513
- function snapEndpoints(elements, tol = 1) {
56514
- const reps = [];
56515
- const tol2 = tol * tol;
56516
- const snap = (p) => {
56517
- for (const r of reps) {
56518
- const dx = p[0] - r[0];
56519
- const dy = p[1] - r[1];
56520
- if (dx * dx + dy * dy <= tol2) return r;
56557
+ function expandJoints(joints, memberGeo) {
56558
+ const elements = [];
56559
+ const skipped = [];
56560
+ const usedGroups = /* @__PURE__ */ new Set();
56561
+ (joints ?? []).forEach((j, i) => {
56562
+ if (!j || !j.id) {
56563
+ skipped.push(`joint#${i}`);
56564
+ return;
56521
56565
  }
56522
- const rep = [p[0], p[1]];
56523
- reps.push(rep);
56524
- return rep;
56525
- };
56526
- return elements.map((el) => {
56527
- if (!el.pts || el.pts.length === 0) return el;
56528
- const pts = el.pts.map((p) => {
56529
- const s = snap(p);
56530
- return [s[0], s[1]];
56531
- });
56532
- return { ...el, pts };
56533
- });
56534
- }
56535
- function deriveLayers(elements, existing) {
56536
- const onByName = /* @__PURE__ */ new Map();
56537
- for (const l of existing ?? []) if (l && l.name && l.on != null) onByName.set(l.name, l.on);
56538
- const counts = /* @__PURE__ */ new Map();
56539
- for (const el of elements) {
56540
- if (!el.layer) continue;
56541
- counts.set(el.layer, (counts.get(el.layer) ?? 0) + 1);
56542
- }
56543
- return [...counts.entries()].map(([name, count]) => onByName.has(name) ? { name, count, on: onByName.get(name) } : { name, count }).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
56544
- }
56545
- function pickSheet(contract, sheetId) {
56546
- const sheets = contract.sheets ?? [];
56547
- if (sheetId) return sheets.find((s) => s.id === sheetId);
56548
- const active = contract.active ?? 0;
56549
- return sheets[active] ?? sheets[0];
56550
- }
56551
- function escAttr(s) {
56552
- return s.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
56553
- }
56554
- function escText(s) {
56555
- return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
56556
- }
56557
- function num2(v, fallback) {
56558
- const n = typeof v === "number" ? v : Number(v);
56559
- return Number.isFinite(n) ? n : fallback;
56560
- }
56561
- function ptsToPath(pts) {
56562
- if (!pts || pts.length < 2) return "";
56563
- return pts.map((p, i) => `${i === 0 ? "M" : "L"}${num2(p[0], 0)} ${num2(p[1], 0)}`).join(" ");
56564
- }
56565
- function contractToSvg(contract, sheetId) {
56566
- const sheet = pickSheet(contract, sheetId);
56567
- if (!sheet) return '<svg xmlns="http://www.w3.org/2000/svg"></svg>';
56568
- const w = num2(sheet.page?.w, 100);
56569
- const h = num2(sheet.page?.h, 100);
56570
- const parts = [];
56571
- for (const el of sheet.elements) {
56572
- if (el.kind === "text") {
56573
- if (!el.text) continue;
56574
- const bbox = el.bbox;
56575
- const ox = num2(el.origin?.[0] ?? bbox?.[0], 0);
56576
- const oy = num2(el.origin?.[1] ?? bbox?.[3] ?? bbox?.[1], 0);
56577
- const fs2 = el.size != null ? num2(el.size, 4) : num2(el.w, 1) * 6;
56578
- const font = el.font ? ` font-family="${escAttr(el.font)}"` : "";
56579
- const ang = num2(el.angle, 0);
56580
- const rot = ang ? ` transform="rotate(${ang} ${ox} ${oy})"` : "";
56581
- parts.push(
56582
- `<text x="${ox}" y="${oy}" font-size="${fs2}" fill="${escAttr(el.color ?? "#94a3b8")}"${font}${rot}>${escText(el.text)}</text>`
56583
- );
56584
- continue;
56566
+ if (j.kind === "custom") {
56567
+ const parts = expandCustom(j);
56568
+ if (!parts.length) {
56569
+ skipped.push(j.id);
56570
+ return;
56571
+ }
56572
+ for (const part of parts) {
56573
+ part.conn = j.id;
56574
+ part.connKind = j.kind;
56575
+ elements.push(part);
56576
+ usedGroups.add(part.group);
56577
+ }
56578
+ } else if (j.kind === "base-plate") {
56579
+ const col = j.main ? memberGeo.get(j.main) : void 0;
56580
+ if (!col || col.role !== "column") {
56581
+ skipped.push(j.id);
56582
+ return;
56583
+ }
56584
+ if (!finite3(col.from) || !finite3(col.to) || !col.dims || !(col.dims.w > 0) || !(col.dims.d > 0)) {
56585
+ skipped.push(j.id);
56586
+ return;
56587
+ }
56588
+ for (const part of expandBasePlate(j, col)) {
56589
+ part.conn = j.id;
56590
+ part.connKind = j.kind;
56591
+ elements.push(part);
56592
+ usedGroups.add(part.group);
56593
+ }
56594
+ } else if (j.kind === "shear-plate") {
56595
+ const beam = j.main ? memberGeo.get(j.main) : void 0;
56596
+ if (!beam || beam.role !== "beam" || beam.isBrace) {
56597
+ skipped.push(j.id);
56598
+ return;
56599
+ }
56600
+ if (!finite3(beam.from) || !finite3(beam.to) || !beam.dims || !(beam.dims.w > 0) || !(beam.dims.d > 0)) {
56601
+ skipped.push(j.id);
56602
+ return;
56603
+ }
56604
+ let support = j.secondaries && j.secondaries[0] ? memberGeo.get(j.secondaries[0]) : void 0;
56605
+ if (support && support.isBrace) support = void 0;
56606
+ if (!support) support = inferSupport(beam, j.at === "end1" ? beam.to : beam.from, memberGeo);
56607
+ const parts = expandShearPlate(j, beam, support);
56608
+ if (!parts.length) {
56609
+ skipped.push(j.id);
56610
+ return;
56611
+ }
56612
+ for (const part of parts) {
56613
+ part.conn = j.id;
56614
+ part.connKind = j.kind;
56615
+ elements.push(part);
56616
+ if (part.kind !== "cut") usedGroups.add(part.group);
56617
+ }
56618
+ } else {
56619
+ skipped.push(j.id);
56585
56620
  }
56586
- const d = el.d || ptsToPath(el.pts);
56587
- if (!d) continue;
56588
- const sw = num2(el.w, 1);
56589
- const dash = el.dashed ? ` stroke-dasharray="${sw * 3} ${sw * 2}"` : "";
56590
- parts.push(
56591
- `<path d="${escAttr(d)}" fill="none" stroke="${escAttr(el.color ?? "#e2e8f0")}" stroke-width="${sw}"${dash}/>`
56592
- );
56593
- }
56594
- return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${w} ${h}" width="${w}" height="${h}">${parts.join("")}</svg>`;
56595
- }
56596
- function postProcess(contract, opts = {}) {
56597
- const snapTol = opts.snapTol ?? 1;
56598
- const sheets = (contract.sheets ?? []).map((sheet, i) => {
56599
- let elements = sheet.elements ?? [];
56600
- elements = snapEndpoints(elements, snapTol);
56601
- elements = dedupeElements(elements);
56602
- elements = assignIds(elements, "e");
56603
- const layers = deriveLayers(elements, sheet.layers);
56604
- const id = sheet.id ?? `s${i + 1}`;
56605
- const groups = sheet.groups ? assignIds(sheet.groups, "g") : void 0;
56606
- return { ...sheet, id, elements, layers, ...groups ? { groups } : {} };
56607
56621
  });
56608
- const datums = contract.datums ? assignIds(contract.datums, "dt") : void 0;
56609
- const links = contract.links ? assignIds(contract.links, "lk") : void 0;
56610
- return {
56611
- ...contract,
56612
- type: "drawing.vector/v1",
56613
- sheets,
56614
- ...datums ? { datums } : {},
56615
- ...links ? { links } : {}
56616
- };
56622
+ const groups = [...usedGroups].map((k) => GROUPS[k]);
56623
+ return { elements, groups, skipped };
56617
56624
  }
56618
56625
 
56619
- // views-to-scene.ts
56620
- function mapper(sheet) {
56621
- const t = sheet.transform;
56622
- if (!t || typeof t.scale !== "number" || !(t.scale > 0)) return null;
56623
- const s = t.scale;
56624
- const [ox, oy] = t.origin ?? [0, 0];
56625
- const rot = (t.rotation ?? 0) * Math.PI / 180;
56626
- const cos = Math.cos(rot);
56627
- const sin = Math.sin(rot);
56628
- return (p) => {
56629
- const dx = p[0] - ox;
56630
- const dy = p[1] - oy;
56631
- const rx = dx * cos - dy * sin;
56632
- const ry = dx * sin + dy * cos;
56633
- return [rx * s + 0, -ry * s + 0];
56634
- };
56635
- }
56636
- function uprightHorizontal(sheet) {
56637
- const dir = sheet.view?.dir ?? "+y";
56638
- if (dir === "+y") return { axis: "x", sign: 1 };
56639
- if (dir === "-y") return { axis: "x", sign: -1 };
56640
- if (dir === "+x") return { axis: "y", sign: -1 };
56641
- if (dir === "-x") return { axis: "y", sign: 1 };
56642
- return null;
56643
- }
56644
- function elevationZExtent(sheet, g) {
56645
- const map = mapper(sheet);
56646
- if (!map) return null;
56647
- const pts = collectDisplayPoints(g, sheet);
56648
- if (pts.length === 0) return null;
56649
- let lo = Infinity;
56650
- let hi = -Infinity;
56651
- for (const p of pts) {
56652
- const z = map(p)[1];
56653
- if (z < lo) lo = z;
56654
- if (z > hi) hi = z;
56655
- }
56656
- return lo <= hi ? [lo, hi] : null;
56626
+ // contract-to-scene.ts
56627
+ var BF_IN = aisc_shapes_default;
56628
+ var canonProfile = (s) => (s ?? "").trim().toUpperCase().replace(/×/g, "X").replace(/\s*X\s*/g, "X").replace(/^([A-Z]+)\s+/, "$1");
56629
+ var FT_TO_MM = 304.8;
56630
+ var IN_TO_MM2 = 25.4;
56631
+ var memberIsBrace = (m) => typeof m.memberType === "string" && m.memberType.trim().toLowerCase() === "brace";
56632
+ function depthPosition(explicit, dzMm, horizMm, isVerticalBrace = false) {
56633
+ if (explicit === "top" || explicit === "middle" || explicit === "bottom") return explicit;
56634
+ if (isVerticalBrace) return "middle";
56635
+ return dzMm > horizMm * 0.5774 ? "middle" : "top";
56657
56636
  }
56658
- function worldInterval(sheet, g, component, sign = 1) {
56659
- const map = mapper(sheet);
56660
- if (!map) return null;
56661
- const pts = collectDisplayPoints(g, sheet);
56662
- if (pts.length === 0) return null;
56663
- let lo = Infinity;
56664
- let hi = -Infinity;
56665
- for (const p of pts) {
56666
- const v = map(p)[component] * sign;
56667
- if (v < lo) lo = v;
56668
- if (v > hi) hi = v;
56637
+ function profileDimsIn(profile) {
56638
+ if (!profile) return null;
56639
+ const p = profile.trim().toUpperCase().replace(/×/g, "X");
56640
+ if (p === "" || /(^|[^A-Z])MF($|[^A-Z])/.test(p)) return null;
56641
+ const m = p.match(/^([A-Z]+)\s*(.+)$/);
56642
+ if (!m) return null;
56643
+ const prefix = m[1];
56644
+ const nums = m[2].split("X").map(parseDim).filter((n) => n != null);
56645
+ if (nums.length === 0) return null;
56646
+ if ((prefix === "HSS" || prefix === "TUBE" || prefix === "L") && nums.length >= 3) {
56647
+ return { d: nums[0], w: nums[1], approx: false };
56669
56648
  }
56670
- return lo <= hi ? [lo, hi] : null;
56671
- }
56672
- function collectDisplayPoints(g, sheet) {
56673
- if (g.footprint && g.footprint.length) return g.footprint;
56674
- if (g.axis && g.axis.length === 2) return g.axis;
56675
- const ids = new Set(g.elementIds ?? []);
56676
- const pts = [];
56677
- for (const el of sheet.elements ?? []) {
56678
- if (!el.id || !ids.has(el.id)) continue;
56679
- if (el.pts) pts.push(...el.pts);
56680
- else if (el.bbox && el.bbox.length === 4) {
56681
- pts.push([el.bbox[0], el.bbox[1]], [el.bbox[2], el.bbox[3]]);
56682
- }
56649
+ if (prefix === "HSS" || prefix === "PIPE") {
56650
+ const dia = nums[0];
56651
+ return { d: dia, w: dia, approx: false };
56683
56652
  }
56684
- return pts;
56685
- }
56686
- function resolveDatum(v, datums, axis) {
56687
- if (typeof v === "number") return v;
56688
- if (typeof v === "string") {
56689
- const d = datums.find((x) => x.id === v);
56690
- return d && (d.axis ?? "z") === axis ? d.value : null;
56653
+ if (/^(W|S|M|HP|C|MC|WT|ST|MT)$/.test(prefix)) {
56654
+ const actual = sectionDimsIn(p);
56655
+ if (actual) return { d: actual.d, w: actual.bf, approx: false };
56656
+ const d = nums[0];
56657
+ const bf = BF_IN[p.replace(/\s+/g, "")];
56658
+ if (bf !== void 0) return { d, w: bf, approx: false };
56659
+ const ratio = prefix === "C" || prefix === "MC" ? 0.28 : 0.42;
56660
+ return { d, w: d * ratio, approx: true };
56691
56661
  }
56692
56662
  return null;
56693
56663
  }
56694
- var PALETTE = ["#3b82f6", "#f59e0b", "#10b981", "#8b5cf6", "#ef4444", "#14b8a6", "#eab308", "#64748b"];
56695
- function overlapRatio(a, b) {
56696
- const lo = Math.max(a[0], b[0]);
56697
- const hi = Math.min(a[1], b[1]);
56698
- if (hi <= lo) return 0;
56699
- const shorter = Math.max(1e-9, Math.min(a[1] - a[0], b[1] - b[0]));
56700
- return (hi - lo) / shorter;
56664
+ function profileDims(profile) {
56665
+ const din = profileDimsIn(profile);
56666
+ return din ? { w: din.w * IN_TO_MM2, d: din.d * IN_TO_MM2, approx: din.approx } : null;
56701
56667
  }
56702
- function viewsToScene(contractInput) {
56668
+ var SCENE_DEFAULT_PAL = ["#60a5fa", "#94a3b8", "#f59e0b", "#34d399", "#f472b6", "#a78bfa", "#fb7185", "#22d3ee", "#facc15", "#4ade80"];
56669
+ function pickColor(profile, idx, contract) {
56670
+ const pc = contract.profile_colors ?? {};
56671
+ const override = pc[profile] ?? Object.entries(pc).find(([k]) => canonProfile(k) === profile)?.[1];
56672
+ if (override) return override;
56673
+ const pal = contract.palette && contract.palette.length ? contract.palette : SCENE_DEFAULT_PAL;
56674
+ return pal[(idx % pal.length + pal.length) % pal.length];
56675
+ }
56676
+ function dispToMm(pt, ptPerFt) {
56677
+ const k = FT_TO_MM / ptPerFt;
56678
+ return [pt[0] * k, -pt[1] * k];
56679
+ }
56680
+ function inferMaterial(profile) {
56681
+ const P = profile.toUpperCase().replace(/×/g, "X").replace(/\s+/g, "");
56682
+ if (P.startsWith("HSS")) return "A500-GR.B";
56683
+ if (/^W\d/.test(P)) return "A992";
56684
+ return "A36";
56685
+ }
56686
+ function teklaClassFor(profile, role) {
56687
+ const P = profile.toUpperCase().replace(/×/g, "X").replace(/\s+/g, "");
56688
+ if (/^L\d/.test(P)) return "7";
56689
+ if (/^M?C\d/.test(P)) return "8";
56690
+ const isHSS = P.startsWith("HSS");
56691
+ const isW = /^W\d/.test(P);
56692
+ if (isW || isHSS) return role === "brace" ? "4" : role === "column" ? "2" : "3";
56693
+ return "1";
56694
+ }
56695
+ function contractToScene(contractInput) {
56703
56696
  const contract = contractInput ?? {};
56704
- const sheets = contract.sheets ?? [];
56705
- const datums = contract.datums ?? [];
56706
- const links = contract.links ?? [];
56707
56697
  const elements = [];
56698
+ const memberGeo = /* @__PURE__ */ new Map();
56708
56699
  const skipped = [];
56709
- const groupKeys = [];
56710
- const seenKey = /* @__PURE__ */ new Set();
56711
- const plans = sheets.filter((s) => s.view?.kind === "plan");
56712
- const uprights = sheets.filter((s) => s.view?.kind === "elevation" || s.view?.kind === "section");
56713
- const uprightEntities = [];
56714
- for (const sh of uprights) {
56715
- const hz = uprightHorizontal(sh);
56716
- if (!hz) continue;
56717
- for (const g of sh.groups ?? []) {
56718
- const z = elevationZExtent(sh, g);
56719
- const h = worldInterval(sh, g, 0, hz.sign);
56720
- if (z && h) uprightEntities.push({ sheet: sh, g, z, h, axis: hz.axis });
56721
- }
56722
- }
56723
- const linkedAway = /* @__PURE__ */ new Set();
56724
- for (const l of links) {
56725
- if (l.kind !== "same-entity") continue;
56726
- linkedAway.add(`${l.a.sheet}/${l.a.id ?? ""}`);
56727
- linkedAway.add(`${l.b.sheet}/${l.b.id ?? ""}`);
56728
- }
56729
- function resolveZ(planSheet, g) {
56730
- if (g.extrude && (g.extrude.from !== void 0 || g.extrude.to !== void 0)) {
56731
- const exFrom = resolveDatum(g.extrude.from, datums, "z");
56732
- const exTo = resolveDatum(g.extrude.to, datums, "z");
56733
- if (exFrom != null && exTo != null) return { z: [exFrom, exTo], how: "extrude" };
56734
- return { error: "extrude reference unresolved \u2014 each end must be a number or the id of a z-axis datum" };
56735
- }
56736
- const key = { sheet: planSheet.id, id: g.id };
56737
- for (const l of links) {
56738
- if (l.kind !== "same-entity") continue;
56739
- const other = l.a.sheet === key.sheet && l.a.id === key.id ? l.b : l.b.sheet === key.sheet && l.b.id === key.id ? l.a : null;
56740
- if (!other) continue;
56741
- const hit = uprightEntities.find((u) => u.sheet.id === other.sheet && u.g.id === other.id);
56742
- if (hit) return { z: hit.z, how: "link" };
56743
- }
56744
- const mineX = worldInterval(planSheet, g, 0);
56745
- const mineY = worldInterval(planSheet, g, 1);
56746
- if (mineX || mineY) {
56747
- const candidates = uprightEntities.filter((u) => !linkedAway.has(`${u.sheet.id}/${u.g.id ?? ""}`)).map((u) => {
56748
- const mine = u.axis === "x" ? mineX : mineY;
56749
- return { u, r: mine ? overlapRatio(mine, u.h) : 0 };
56750
- }).filter((x) => x.r >= 0.8);
56751
- if (candidates.length === 1) return { z: candidates[0].u.z, how: "match" };
56752
- if (candidates.length > 1) return { ambiguous: candidates.length };
56753
- }
56754
- return null;
56700
+ const profileOrder = [];
56701
+ const seenProfile = /* @__PURE__ */ new Set();
56702
+ const beamClear = /* @__PURE__ */ new Map();
56703
+ for (const j of contract.joints ?? []) {
56704
+ if (!j || j.kind !== "shear-plate" || !j.main || j.at !== "end0" && j.at !== "end1") continue;
56705
+ const pc = j.params?.["clearance"];
56706
+ const cl = typeof pc === "number" && isFinite(pc) ? Math.max(0, pc) : 12.7;
56707
+ const cur = beamClear.get(j.main) ?? { e0: 0, e1: 0 };
56708
+ if (j.at === "end0") cur.e0 = Math.max(cur.e0, cl);
56709
+ else cur.e1 = Math.max(cur.e1, cl);
56710
+ beamClear.set(j.main, cur);
56755
56711
  }
56756
- for (const plan of plans) {
56757
- const map = mapper(plan);
56758
- const sheetId = plan.id ?? "?";
56759
- if (!map) {
56760
- for (const g of plan.groups ?? []) skipped.push({ id: `${sheetId}/${g.id ?? "?"}`, reason: "sheet has no world transform (transform.scale required)" });
56761
- continue;
56762
- }
56763
- for (const g of plan.groups ?? []) {
56764
- const gid = `${sheetId}/${g.id ?? "?"}`;
56765
- const isMember = !!(g.axis && g.section);
56766
- const isFootprint = !!(g.footprint && g.footprint.length >= 3);
56767
- if (!isMember && !isFootprint) continue;
56768
- if (isMember && !(g.section.w > 0 && g.section.d > 0)) {
56769
- skipped.push({ id: gid, reason: "invalid section \u2014 w and d must be positive world units" });
56712
+ for (const plan of contract.plans ?? []) {
56713
+ const ptPerFt = plan.pt_per_ft && plan.pt_per_ft > 0 ? plan.pt_per_ft : 1;
56714
+ const defaultTosMm = (plan.default_tos ?? 0) * IN_TO_MM2;
56715
+ for (const m of plan.members ?? []) {
56716
+ const explicit = m.section && typeof m.section.w === "number" && m.section.w > 0 && typeof m.section.d === "number" && m.section.d > 0 ? { w: m.section.w, d: m.section.d, approx: false } : null;
56717
+ const dims = profileDims(m.profile) ?? explicit;
56718
+ if (!dims || !Array.isArray(m.wp) || m.wp.length < 2) {
56719
+ skipped.push(m.id);
56770
56720
  continue;
56771
56721
  }
56772
- const zr0 = resolveZ(plan, g);
56773
- if (!zr0) {
56774
- skipped.push({ id: gid, reason: "no Z extent \u2014 add extrude datums/values, a same-entity link, or a matching elevation entity" });
56775
- continue;
56722
+ const mIsBrace = memberIsBrace(m);
56723
+ const profile = canonProfile(m.profile) || (explicit ? "CUSTOM" : "");
56724
+ if (!seenProfile.has(profile)) {
56725
+ seenProfile.add(profile);
56726
+ profileOrder.push(profile);
56776
56727
  }
56777
- if ("ambiguous" in zr0) {
56778
- skipped.push({ id: gid, reason: `ambiguous Z \u2014 ${zr0.ambiguous} elevation entities share this span; add a same-entity link to pick one` });
56728
+ const [ax, ay] = dispToMm(m.wp[0], ptPerFt);
56729
+ const [bx, by] = dispToMm(m.wp[1], ptPerFt);
56730
+ let from;
56731
+ let to;
56732
+ let workFrom;
56733
+ let workTo;
56734
+ let posOffset = 0;
56735
+ if (m.role === "column") {
56736
+ const bos = m.col?.bos != null ? m.col.bos * IN_TO_MM2 : 0;
56737
+ const tos = m.col?.tos != null ? m.col.tos * IN_TO_MM2 : defaultTosMm;
56738
+ from = [ax, ay, bos];
56739
+ to = [ax, ay, tos];
56740
+ workFrom = from;
56741
+ workTo = to;
56742
+ } else {
56743
+ const z0 = m.ends?.[0]?.tos != null ? m.ends[0].tos * IN_TO_MM2 : defaultTosMm;
56744
+ const z1 = m.ends?.[1]?.tos != null ? m.ends[1].tos * IN_TO_MM2 : defaultTosMm;
56745
+ workFrom = [ax, ay, z0];
56746
+ workTo = [bx, by, z1];
56747
+ const pos2 = depthPosition(m.position, Math.abs(z1 - z0), Math.hypot(bx - ax, by - ay), mIsBrace && m.brace?.type === "vertical");
56748
+ const zoff = pos2 === "top" ? -dims.d / 2 : pos2 === "bottom" ? dims.d / 2 : 0;
56749
+ posOffset = zoff;
56750
+ from = [ax, ay, z0 + zoff];
56751
+ to = [bx, by, z1 + zoff];
56752
+ }
56753
+ if (m.role === "column" && Math.abs(to[2] - from[2]) < 1) {
56754
+ skipped.push(m.id);
56779
56755
  continue;
56780
56756
  }
56781
- if ("error" in zr0) {
56782
- skipped.push({ id: gid, reason: zr0.error });
56757
+ if (mIsBrace && Math.hypot(workTo[0] - workFrom[0], workTo[1] - workFrom[1], workTo[2] - workFrom[2]) < 1) {
56758
+ skipped.push(m.id);
56783
56759
  continue;
56784
56760
  }
56785
- const zr = zr0;
56786
- const key = g.kind || (isMember ? "member" : "footprint");
56787
- if (!seenKey.has(key)) {
56788
- seenKey.add(key);
56789
- groupKeys.push(key);
56761
+ memberGeo.set(m.id, { id: m.id, role: m.role === "column" ? "column" : "beam", from: workFrom, to: workTo, dims: { w: dims.w, d: dims.d }, profile, posOffset, isBrace: mIsBrace, ...typeof m.rot === "number" ? { rot: -m.rot } : {} });
56762
+ const clr = beamClear.get(m.id);
56763
+ if (clr && m.role !== "column" && !mIsBrace) {
56764
+ const dx = to[0] - from[0], dy = to[1] - from[1], dz = to[2] - from[2];
56765
+ const L = Math.hypot(dx, dy, dz) || 1;
56766
+ const ex = dx / L, ey = dy / L, ez = dz / L;
56767
+ const e0 = Math.min(Math.max(0, clr.e0), L * 0.4), e1 = Math.min(Math.max(0, clr.e1), L * 0.4);
56768
+ if (e0 > 0) from = [from[0] + ex * e0, from[1] + ey * e0, from[2] + ez * e0];
56769
+ if (e1 > 0) to = [to[0] - ex * e1, to[1] - ey * e1, to[2] - ez * e1];
56790
56770
  }
56791
- if (isMember) {
56792
- const [ax, ay] = map(g.axis[0]);
56793
- const [bx, by] = map(g.axis[1]);
56794
- const zFrom = zr.how === "extrude" ? zr.z[0] : (zr.z[0] + zr.z[1]) / 2;
56795
- const zTo = zr.how === "extrude" ? zr.z[1] : zFrom;
56796
- elements.push({
56797
- id: g.id ?? gid,
56798
- group: key,
56799
- kind: "box",
56800
- from: [ax, ay, zFrom],
56801
- to: [bx, by, zTo],
56802
- section: { w: g.section.w, d: g.section.d },
56803
- meta: { sheet: sheetId, ...g.label ? { label: g.label } : {} }
56804
- });
56771
+ const role = mIsBrace ? "brace" : m.role === "column" ? "column" : "beam";
56772
+ const material = m.material && m.material.trim() || inferMaterial(profile);
56773
+ elements.push({
56774
+ id: m.id,
56775
+ group: profile,
56776
+ kind: "box",
56777
+ from,
56778
+ to,
56779
+ section: { w: dims.w, d: dims.d },
56780
+ meta: { profile },
56781
+ role,
56782
+ material,
56783
+ teklaClass: teklaClassFor(profile, role),
56784
+ xsection: xsectionFor(profile, { w: dims.w, d: dims.d }),
56785
+ ...typeof m.rot === "number" ? { rot: -m.rot } : {}
56786
+ });
56787
+ }
56788
+ }
56789
+ const allProfiles = (contract.plans ?? []).flatMap((pl2) => (pl2.members ?? []).map((m) => canonProfile(m.profile))).filter(Boolean);
56790
+ const paletteRank = [.../* @__PURE__ */ new Set([...allProfiles, ...Object.keys(contract.weights ?? {}).map((k) => canonProfile(k))])].sort();
56791
+ const groups = profileOrder.map((profile) => ({
56792
+ key: profile,
56793
+ label: profile,
56794
+ color: pickColor(profile, paletteRank.indexOf(profile), contract)
56795
+ }));
56796
+ const joints = expandJoints(contract.joints, memberGeo);
56797
+ for (const part of joints.elements) elements.push(part);
56798
+ for (const g of joints.groups) groups.push(g);
56799
+ for (const id of joints.skipped) skipped.push(`joint:${id}`);
56800
+ return {
56801
+ scene: { meta: { name: contract.title || "Steel Model", units: "mm", up: "z" }, groups, elements },
56802
+ skipped
56803
+ };
56804
+ }
56805
+
56806
+ // bom-format.ts
56807
+ var round1 = (n) => Math.round(n * 10) / 10;
56808
+ function foldedWeight(weights, profile) {
56809
+ const target = canonProfile(profile);
56810
+ const hit = Object.entries(weights).find(([k]) => canonProfile(k) === target);
56811
+ return hit ? hit[1] ?? null : null;
56812
+ }
56813
+ function contractToBom(contractInput) {
56814
+ const c = contractInput ?? {};
56815
+ const weights = c.weights ?? {};
56816
+ const agg = /* @__PURE__ */ new Map();
56817
+ for (const plan of c.plans ?? []) {
56818
+ const ptPerFt = typeof plan.pt_per_ft === "number" && plan.pt_per_ft > 0 ? plan.pt_per_ft : 12;
56819
+ const defaultTos = plan.default_tos ?? 0;
56820
+ for (const m of plan.members ?? []) {
56821
+ const profile = m.profile;
56822
+ if (!profile) continue;
56823
+ const plf = weights[profile] ?? foldedWeight(weights, profile);
56824
+ if (plf == null) continue;
56825
+ let lenFt;
56826
+ if (m.role === "column") {
56827
+ const l = columnLengthFt(m.col, defaultTos);
56828
+ if (l == null) continue;
56829
+ lenFt = l;
56830
+ if (!(lenFt > 0)) continue;
56805
56831
  } else {
56806
- elements.push({
56807
- id: g.id ?? gid,
56808
- group: key,
56809
- kind: "extrusion",
56810
- footprint: g.footprint.map((p) => map(p)),
56811
- from: Math.min(zr.z[0], zr.z[1]),
56812
- to: Math.max(zr.z[0], zr.z[1]),
56813
- meta: { sheet: sheetId, ...g.label ? { label: g.label } : {} }
56814
- });
56832
+ const l = memberLengthFt(m.wp, m.ends, ptPerFt, defaultTos);
56833
+ if (l == null) continue;
56834
+ lenFt = l;
56815
56835
  }
56836
+ const g = agg.get(profile) ?? { qty: 0, lenFt: 0, plf };
56837
+ g.qty += 1;
56838
+ g.lenFt += lenFt;
56839
+ agg.set(profile, g);
56816
56840
  }
56817
56841
  }
56818
- const groups = groupKeys.map((key, i) => ({ key, label: key, color: PALETTE[i % PALETTE.length] }));
56819
- const name = contract.source && typeof contract.source.name === "string" ? String(contract.source.name) : "Reconstructed drawing";
56820
- return { scene: { meta: { name, units: "mm", up: "z" }, groups, elements }, skipped };
56842
+ const rows = [...agg.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([profile, g]) => ({
56843
+ Profile: profile,
56844
+ Qty: g.qty,
56845
+ "Length (ft)": round1(g.lenFt),
56846
+ "lb/ft": g.plf,
56847
+ "Weight (lb)": Math.round(g.lenFt * g.plf)
56848
+ }));
56849
+ const totalLb = rows.reduce((t, r) => t + r["Weight (lb)"], 0);
56850
+ const totalQty = rows.reduce((t, r) => t + r.Qty, 0);
56851
+ const totalLenFt = round1(rows.reduce((t, r) => t + r["Length (ft)"], 0));
56852
+ const totalTons = round1(totalLb / 2e3);
56853
+ rows.push({
56854
+ Profile: "TOTAL",
56855
+ Qty: totalQty,
56856
+ "Length (ft)": totalLenFt,
56857
+ "lb/ft": "",
56858
+ "Weight (lb)": totalLb
56859
+ });
56860
+ return {
56861
+ title: `Bill of Materials \u2014 ${totalTons} tons (${totalLb.toLocaleString("en-US")} lb)`,
56862
+ columns: ["Profile", "Qty", "Length (ft)", "lb/ft", "Weight (lb)"],
56863
+ rows,
56864
+ totalLb,
56865
+ totalTons
56866
+ };
56821
56867
  }
56822
56868
 
56823
- // steel-joints.ts
56824
- var GROUPS = {
56825
- "base-plate": { key: "base-plate", label: "Base plates", color: "#6b7a8d" },
56826
- // darkest plate grey
56827
- "washer-plate": { key: "washer-plate", label: "Washer plates", color: "#9aafc3" },
56828
- "anchor-plate": { key: "anchor-plate", label: "Anchor plates", color: "#8293a6" },
56829
- // embedded bearing plate at the rod's anchored end — mid steel-grey, between base + washer plate
56830
- anchor: { key: "anchor", label: "Anchor rods", color: "#b0c4d8" },
56831
- // cool zinc-grey
56832
- nut: { key: "nut", label: "Nuts", color: "#7a8a9e" },
56833
- washer: { key: "washer", label: "Washers", color: "#dde4ed" },
56834
- // lightest zinc
56835
- weld: { key: "weld", label: "Welds", color: "#f97316" },
56836
- // weld orange (heat) — off the UI error-red
56837
- // Shear-plate kit — same muted steel band; the fin plate a touch lighter than the base plate so the
56838
- // two connection types are tellable apart in a mixed model, bolts on the zinc fastener grey.
56839
- "shear-plate": { key: "shear-plate", label: "Shear plates", color: "#7d8ba0" },
56840
- bolt: { key: "bolt", label: "Bolts", color: "#b0c4d8" },
56841
- // cool zinc-grey (matches the anchor fasteners)
56842
- stiffener: { key: "stiffener", label: "Stiffeners", color: "#9aafc3" },
56843
- cope: { key: "cope", label: "Copes", color: "#c2703a" },
56844
- // a muted cut/burn amber — the removed corner (subtractive; rendered as the notch, not a swatch mesh)
56845
- // Imported (custom) connection — one neutral steel band for the whole opaque assembly, so it reads
56846
- // as a single imported unit (not scattered across the recipe-part legend rows). Roles (plate/bolt/
56847
- // weld) are kept on each part's meta for labels, but share this one legend group + colour.
56848
- custom: { key: "custom", label: "Imported connections", color: "#8a97a8" }
56849
- };
56850
- var EMBED = 1;
56851
- function num3(params, key, def) {
56852
- const v = params?.[key];
56853
- return typeof v === "number" && isFinite(v) ? v : def;
56854
- }
56855
- function pos(params, key, def) {
56856
- const v = num3(params, key, def);
56857
- return v > 0 ? v : def;
56869
+ // steel-diff.ts
56870
+ var NUL = String.fromCharCode(0);
56871
+ var asArray = (v) => Array.isArray(v) ? v : [];
56872
+ var str = (v) => typeof v === "string" ? v : "";
56873
+ var normProfile = (v) => str(v).trim().toUpperCase().replace(/\s+/g, "");
56874
+ var num2 = (v) => typeof v === "number" && isFinite(v) ? v : null;
56875
+ var MOVE_TOL_FT = 0.5;
56876
+ function collect(contract) {
56877
+ const byKey = /* @__PURE__ */ new Map();
56878
+ const dup = /* @__PURE__ */ new Set();
56879
+ const idSheets = /* @__PURE__ */ new Map();
56880
+ const c = contract ?? {};
56881
+ for (const plan of asArray(c.plans)) {
56882
+ const sheet = str(plan?.sheet);
56883
+ const rawPpf = plan?.pt_per_ft;
56884
+ const hasScale = typeof rawPpf === "number" && rawPpf > 0;
56885
+ const ptPerFt = hasScale ? rawPpf : 12;
56886
+ for (const m of asArray(plan?.members)) {
56887
+ const id = str(m?.id);
56888
+ if (!id) continue;
56889
+ const key = sheet + NUL + id;
56890
+ (idSheets.get(id) ?? idSheets.set(id, /* @__PURE__ */ new Set()).get(id)).add(sheet);
56891
+ if (byKey.has(key)) {
56892
+ dup.add(key);
56893
+ continue;
56894
+ }
56895
+ byKey.set(key, {
56896
+ key,
56897
+ id,
56898
+ sheet,
56899
+ mark: str(m?.mark) || void 0,
56900
+ profile: str(m?.profile),
56901
+ role: str(m?.role) || "beam",
56902
+ ptPerFt,
56903
+ hasScale,
56904
+ wp: asArray(m?.wp).map((p) => asArray(p).map((x) => fin(x))),
56905
+ // finite-guarded (no NaN) — consistent with num() elsewhere
56906
+ ends: asArray(m?.ends),
56907
+ col: m?.col ?? {},
56908
+ material: str(m?.material)
56909
+ });
56910
+ }
56911
+ }
56912
+ return { byKey, dupKeys: [...dup], idSheets };
56858
56913
  }
56859
- function intMin1(params, key, def) {
56860
- return Math.max(1, Math.round(num3(params, key, def)));
56914
+ var refOf = (m) => ({ key: m.key, id: m.id, sheet: m.sheet, ...m.mark ? { mark: m.mark } : {}, profile: m.profile, role: m.role });
56915
+ var fin = (v) => {
56916
+ const n = Number(v);
56917
+ return isFinite(n) ? n : 0;
56918
+ };
56919
+ var dist = (p, q) => Math.hypot((p[0] ?? 0) - (q[0] ?? 0), (p[1] ?? 0) - (q[1] ?? 0));
56920
+ var ftPt = (p, ppf) => [fin(p?.[0]) / ppf, fin(p?.[1]) / ppf];
56921
+ function beamMoveFeet(a, b) {
56922
+ const af0 = ftPt(a.wp[0], a.ptPerFt), af1 = ftPt(a.wp[1] ?? a.wp[0], a.ptPerFt);
56923
+ const bf0 = ftPt(b.wp[0], b.ptPerFt), bf1 = ftPt(b.wp[1] ?? b.wp[0], b.ptPerFt);
56924
+ const aligned = Math.max(dist(af0, bf0), dist(af1, bf1));
56925
+ const flipped = Math.max(dist(af0, bf1), dist(af1, bf0));
56926
+ return flipped < aligned ? { feet: flipped, flipped: true } : { feet: aligned, flipped: false };
56861
56927
  }
56862
- function finite3(a) {
56863
- return Array.isArray(a) && a.length >= 3 && a.every((n) => typeof n === "number" && isFinite(n));
56928
+ function elevMoveFeet(a, b) {
56929
+ let ft = 0;
56930
+ const at = num2(a.col?.tos), bt = num2(b.col?.tos);
56931
+ if (at != null && bt != null) ft = Math.max(ft, Math.abs(at - bt) / 12);
56932
+ const ab = num2(a.col?.bos), bb = num2(b.col?.bos);
56933
+ if (ab != null && bb != null) ft = Math.max(ft, Math.abs(ab - bb) / 12);
56934
+ for (let i = 0; i < 2; i++) {
56935
+ const ea = num2(a.ends?.[i]?.tos), eb = num2(b.ends?.[i]?.tos);
56936
+ if (ea != null && eb != null) ft = Math.max(ft, Math.abs(ea - eb) / 12);
56937
+ }
56938
+ return ft;
56864
56939
  }
56865
- function spread(n, half) {
56866
- if (n <= 1) return [0];
56867
- return Array.from({ length: n }, (_, i) => -half + 2 * half * i / (n - 1));
56940
+ var stable = (o) => {
56941
+ if (Array.isArray(o)) return "[" + o.map(stable).join(",") + "]";
56942
+ if (o && typeof o === "object") return "{" + Object.keys(o).sort().map((k) => k + ":" + stable(o[k])).join(",") + "}";
56943
+ return JSON.stringify(o) ?? "null";
56944
+ };
56945
+ function connIdentity(ref, lib) {
56946
+ const conn = str(ref?.conn).trim();
56947
+ if (conn && lib.has(conn)) {
56948
+ const r = lib.get(conn);
56949
+ return `${str(r?.type)}/${str(r?.detail)}`;
56950
+ }
56951
+ return str(ref?.detail).trim() || str(ref?.note).trim() || "";
56868
56952
  }
56869
- function profileKind(profile) {
56870
- const p = (profile || "").toUpperCase().trim();
56871
- if (/^(W|M|S|HP|UC|UB|UKC|UKB|IPE|HE)/.test(p)) return "I";
56872
- if (/^(C|MC|PFC)/.test(p)) return "C";
56873
- if (/^L/.test(p)) return "L";
56874
- if (/^(HSS|PIPE|TS|SHS|RHS|CHS|TUBE|HSQ)/.test(p)) return "TUBE";
56875
- return "BOX";
56953
+ function jointsSummary(a, b) {
56954
+ const kind = (sig) => sig.split("@")[0] ?? "";
56955
+ const setA = new Set(a), setB = new Set(b);
56956
+ const gone = a.filter((x) => !setB.has(x));
56957
+ const got = b.filter((x) => !setA.has(x));
56958
+ const gk = gone.length ? kind(gone[0] ?? "") : "";
56959
+ const tk = got.length ? kind(got[0] ?? "") : "";
56960
+ if (gone.length && got.length && gk === tk) return `${tk || "connection"} params changed`;
56961
+ if (got.length) return `${tk || "connection"} added`;
56962
+ if (gone.length) return `${gk || "connection"} removed`;
56963
+ return "connection changed";
56876
56964
  }
56877
- function profileOutline(profile, w, d) {
56878
- const hw = w / 2, hd = d / 2;
56879
- switch (profileKind(profile)) {
56880
- case "I": {
56881
- const tf = Math.min(d * 0.5, Math.max(d * 0.1, 6)), tw = Math.min(w * 0.5, Math.max(w * 0.1, 5));
56882
- return [
56883
- [-hw, -hd],
56884
- [hw, -hd],
56885
- [hw, -hd + tf],
56886
- [tw / 2, -hd + tf],
56887
- [tw / 2, hd - tf],
56888
- [hw, hd - tf],
56889
- [hw, hd],
56890
- [-hw, hd],
56891
- [-hw, hd - tf],
56892
- [-tw / 2, hd - tf],
56893
- [-tw / 2, -hd + tf],
56894
- [-hw, -hd + tf]
56895
- ];
56896
- }
56897
- case "C": {
56898
- const tf = Math.max(d * 0.1, 5), tw = Math.max(w * 0.12, 5);
56899
- return [[-hw, -hd], [hw, -hd], [hw, -hd + tf], [-hw + tw, -hd + tf], [-hw + tw, hd - tf], [hw, hd - tf], [hw, hd], [-hw, hd]];
56900
- }
56901
- case "L": {
56902
- const t = Math.max(Math.min(w, d) * 0.18, 5);
56903
- return [[-hw, -hd], [hw, -hd], [hw, -hd + t], [-hw + t, -hd + t], [-hw + t, hd], [-hw, hd]];
56965
+ function indexJoints(contract, lib) {
56966
+ const idx = /* @__PURE__ */ new Map();
56967
+ for (const j of asArray(contract?.joints)) {
56968
+ const sig = `${str(j?.kind)}@${str(j?.at)}:${connIdentity(j, lib)}:${stable(j?.params)}:${stable(asArray(j?.secondaries).map(str).sort())}:${stable(j?.place)}`;
56969
+ for (const ref of [str(j?.main), ...asArray(j?.secondaries).map(str)].filter(Boolean)) {
56970
+ const arr = idx.get(ref);
56971
+ if (arr) arr.push(sig);
56972
+ else idx.set(ref, [sig]);
56904
56973
  }
56905
- default:
56906
- return [[-hw, -hd], [hw, -hd], [hw, hd], [-hw, hd]];
56907
56974
  }
56975
+ for (const sigs of idx.values()) sigs.sort();
56976
+ return idx;
56908
56977
  }
56909
- function expandBasePlate(joint, col) {
56910
- const p = joint.params;
56911
- const base = col.from[2] <= col.to[2] ? col.from : col.to;
56912
- const [bx, by, bz] = base;
56913
- const { w, d } = col.dims;
56914
- const thickness = pos(p, "thickness", 25);
56915
- const margin = Math.max(0, num3(p, "margin", 75));
56916
- const width = pos(p, "plateWidth", Math.max(w, d) + 2 * margin);
56917
- const depth = pos(p, "plateDepth", Math.max(w, d) + 2 * margin);
56918
- const boltDia = pos(p, "boltDia", 24);
56919
- const clearance = num3(p, "holeClearance", 6);
56920
- const edge = num3(p, "edgeDist", Math.max(1.5 * boltDia, 40));
56921
- const cols = intMin1(p, "boltCols", 2);
56922
- const rows = intMin1(p, "boltRows", 2);
56923
- const weldLeg = num3(p, "weldLeg", 8);
56924
- const projBelow = num3(p, "projBelow", Math.max(220, 9 * boltDia));
56925
- const embedment = Math.max(0, num3(p, "embedment", 0));
56926
- const grout = Math.max(0, num3(p, "grout", 0));
56927
- const nutH = pos(p, "nutHeight", 0.8 * boltDia);
56928
- const nutAF = pos(p, "nutAcrossFlats", 1.6 * boltDia);
56929
- const wpSide = pos(p, "washerPlateSide", 2.5 * boltDia);
56930
- const wpThick = pos(p, "washerPlateThickness", Math.max(0.35 * boltDia, 8));
56931
- const washerOD = pos(p, "washerOuter", 2 * boltDia);
56932
- const washerID = boltDia + 3;
56933
- const washerH = pos(p, "washerThickness", Math.max(0.25 * boltDia, 4));
56934
- const levelingNut = p?.["levelingNut"] !== false;
56935
- const anchorPlate = p?.["anchorPlate"] !== false;
56936
- const apSide = pos(p, "anchorPlateSide", 3.3 * boltDia);
56937
- const apThick = pos(p, "anchorPlateThickness", Math.max(0.6 * boltDia, 20));
56938
- const bottomNut = p?.["bottomNut"] !== false;
56939
- const rodProj = pos(p, "anchorRodProjection", 25.4 / 4);
56940
- const SEAT = 0.5;
56941
- const rodBelow = Math.max(embedment > 0 ? grout + embedment : projBelow, rodProj + nutH + apThick + SEAT);
56942
- const plateTop = bz + EMBED, plateBottom = plateTop - thickness;
56943
- const us = spread(cols, Math.max(0, width / 2 - edge));
56944
- const vs = spread(rows, Math.max(0, depth / 2 - edge));
56945
- const holes = [];
56946
- const kit = [];
56947
- const wpBot = plateTop + SEAT, wpTop = wpBot + wpThick, washerTop = wpTop + washerH, fnTop = washerTop + nutH;
56948
- const rodTopZ = fnTop + 0.4 * boltDia, rodBotZ = plateBottom - rodBelow;
56949
- const concreteTopZ = plateBottom - (embedment > 0 ? grout : 0);
56950
- let k = 0;
56951
- for (const v of vs) {
56952
- for (const u of us) {
56953
- const ax = bx + u, ay = by + v, jid = joint.id;
56954
- holes.push({ u, v, d: boltDia + clearance });
56955
- kit.push(
56956
- { id: `${jid}:rod${k}`, group: "anchor", kind: "rod", from: [ax, ay, rodBotZ], to: [ax, ay, rodTopZ], d: boltDia, meta: { label: `Anchor rod \u2300${boltDia}` } },
56957
- { id: `${jid}:wp${k}`, group: "washer-plate", kind: "plate", center: [ax, ay, wpBot + wpThick / 2], uDir: [1, 0, 0], vDir: [0, 1, 0], width: wpSide, depth: wpSide, thickness: wpThick, holes: [{ u: 0, v: 0, d: boltDia + 2 }], meta: { label: `Washer plate ${Math.round(wpSide)}\xD7${Math.round(wpSide)}\xD7${Math.round(wpThick)}` } },
56958
- { id: `${jid}:wsh${k}`, group: "washer", kind: "washer", from: [ax, ay, wpTop], to: [ax, ay, washerTop], dOuter: washerOD, dInner: washerID, meta: { label: `Washer \u2300${Math.round(washerOD)}` } },
56959
- { id: `${jid}:fn${k}`, group: "nut", kind: "nut", from: [ax, ay, washerTop], to: [ax, ay, fnTop], acrossFlats: nutAF, meta: { label: `Nut M${boltDia}` } }
56960
- );
56961
- if (levelingNut) kit.push({ id: `${jid}:ln${k}`, group: "nut", kind: "nut", from: [ax, ay, plateBottom - SEAT - nutH], to: [ax, ay, plateBottom - SEAT], acrossFlats: nutAF, meta: { label: `Leveling nut M${boltDia}` } });
56962
- const nutBotZ = rodBotZ + rodProj;
56963
- if (bottomNut) kit.push({ id: `${jid}:fnb${k}`, group: "nut", kind: "nut", from: [ax, ay, nutBotZ], to: [ax, ay, nutBotZ + nutH], acrossFlats: nutAF, meta: { label: `Anchor nut M${boltDia}` } });
56964
- const apBotZ = nutBotZ + (bottomNut ? nutH : 0);
56965
- if (anchorPlate) kit.push({ id: `${jid}:ap${k}`, group: "anchor-plate", kind: "plate", center: [ax, ay, apBotZ + apThick / 2], uDir: [1, 0, 0], vDir: [0, 1, 0], width: apSide, depth: apSide, thickness: apThick, holes: [{ u: 0, v: 0, d: boltDia + 2 }], meta: { label: `Anchor plate ${Math.round(apSide)}\xD7${Math.round(apSide)}\xD7${Math.round(apThick)}` } });
56966
- k++;
56967
- }
56968
- }
56969
- const plate = {
56970
- id: `${joint.id}:plate`,
56971
- group: "base-plate",
56972
- kind: "plate",
56973
- center: [bx, by, plateBottom + thickness / 2],
56974
- // plate top seats the column (= bz + EMBED); body hangs below
56975
- uDir: [1, 0, 0],
56976
- vDir: [0, 1, 0],
56977
- width,
56978
- depth,
56979
- thickness,
56980
- holes,
56981
- meta: {
56982
- label: `Base plate ${Math.round(width)}\xD7${Math.round(depth)}\xD7${Math.round(thickness)}`,
56983
- // anchor depth for the view's PROJ/GROUT/EMBED overlay + the rod inspector. projection is above B.O.
56984
- // plate; the grout pad sits B.O. plate → T.O. concrete; embedment is INTO the concrete (T.O. concrete → rod bottom).
56985
- anchor: { rodTopZ, rodBotZ, plateBotZ: plateBottom, concreteTopZ, projMm: rodTopZ - plateBottom, groutMm: plateBottom - concreteTopZ, embedMm: concreteTopZ - rodBotZ, embedSet: embedment > 0 }
56978
+ function diffContracts(from, to) {
56979
+ const A = collect(from);
56980
+ const B = collect(to);
56981
+ const dupKeys = [.../* @__PURE__ */ new Set([...A.dupKeys, ...B.dupKeys])];
56982
+ const ambiguous = new Set(dupKeys);
56983
+ const libA = new Map(asArray(from?.connections).map((r) => [str(r?.id), r]));
56984
+ const libB = new Map(asArray(to?.connections).map((r) => [str(r?.id), r]));
56985
+ const jointsA = indexJoints(from, libA);
56986
+ const jointsB = indexJoints(to, libB);
56987
+ const ambiguousJoints = /* @__PURE__ */ new Set();
56988
+ const flagAmbiguousJoints = (contract, idSheets) => {
56989
+ for (const j of asArray(contract?.joints)) {
56990
+ const refs = [str(j?.main), ...asArray(j?.secondaries).map(str)].filter(Boolean);
56991
+ if (refs.some((r) => (idSheets.get(r)?.size ?? 0) > 1)) ambiguousJoints.add(str(j?.id));
56986
56992
  }
56987
56993
  };
56988
- const axisSign = col.to[2] < col.from[2] ? -1 : 1;
56989
- const rollRad = (col.rot || 0) * Math.PI * axisSign / 180;
56990
- const cosR = Math.cos(rollRad), sinR = Math.sin(rollRad);
56991
- const weld = {
56992
- id: `${joint.id}:weld`,
56993
- group: "weld",
56994
- kind: "weld",
56995
- path: profileOutline(col.profile, w, d).map(([u, vv]) => [bx + (u * cosR - vv * sinR), by + (u * sinR + vv * cosR), bz]),
56996
- leg: weldLeg,
56997
- meta: { label: `Fillet ${weldLeg}` }
56998
- };
56999
- return [plate, ...kit, weld];
57000
- }
57001
- function webHalfThk(profile, w) {
57002
- return profileKind(profile) === "I" ? Math.min(w * 0.5, Math.max(w * 0.1, 5)) / 2 : 0;
57003
- }
57004
- function distPointSeg(p, a, b) {
57005
- const abx = b[0] - a[0], aby = b[1] - a[1], abz = b[2] - a[2];
57006
- const apx = p[0] - a[0], apy = p[1] - a[1], apz = p[2] - a[2];
57007
- const len2 = abx * abx + aby * aby + abz * abz;
57008
- const t = len2 > 1e-9 ? Math.max(0, Math.min(1, (apx * abx + apy * aby + apz * abz) / len2)) : 0;
57009
- return Math.hypot(apx - t * abx, apy - t * aby, apz - t * abz);
57010
- }
57011
- function unitDir(a, b) {
57012
- const dx = b[0] - a[0], dy = b[1] - a[1], dz = b[2] - a[2];
57013
- const L = Math.hypot(dx, dy, dz);
57014
- return L > 1e-9 ? [dx / L, dy / L, dz / L] : null;
57015
- }
57016
- function inferSupport(beam, end, memberGeo) {
57017
- const bd = unitDir(beam.from, beam.to);
57018
- let best, bestD = Infinity;
57019
- for (const m of memberGeo.values()) {
57020
- if (m.id === beam.id || m.isBrace || !finite3(m.from) || !finite3(m.to)) continue;
57021
- const md = unitDir(m.from, m.to);
57022
- if (bd && md && Math.abs(bd[0] * md[0] + bd[1] * md[1] + bd[2] * md[2]) > 0.966) continue;
57023
- const d = distPointSeg(end, m.from, m.to);
57024
- if (d < bestD) {
57025
- bestD = d;
57026
- best = m;
56994
+ flagAmbiguousJoints(from, A.idSheets);
56995
+ flagAmbiguousJoints(to, B.idSheets);
56996
+ const added = [];
56997
+ const removed = [];
56998
+ for (const [key, b] of B.byKey) if (!A.byKey.has(key)) added.push(refOf(b));
56999
+ for (const [key, a] of A.byKey) if (!B.byKey.has(key)) removed.push(refOf(a));
57000
+ const resized = [];
57001
+ const material = [];
57002
+ const moved = [];
57003
+ const connections = [];
57004
+ let unchanged = 0;
57005
+ let anyScaleUnknown = false;
57006
+ for (const [key, a] of A.byKey) {
57007
+ const b = B.byKey.get(key);
57008
+ if (!b || ambiguous.has(key)) continue;
57009
+ let changed = false;
57010
+ if (normProfile(a.profile) !== normProfile(b.profile)) {
57011
+ resized.push({ ref: refOf(b), from: a.profile, to: b.profile });
57012
+ changed = true;
57013
+ }
57014
+ if (a.material.trim().toUpperCase() !== b.material.trim().toUpperCase() && (a.material || b.material)) {
57015
+ material.push({ ref: refOf(b), from: a.material, to: b.material });
57016
+ changed = true;
57017
+ }
57018
+ const planMove = a.wp.length && b.wp.length ? beamMoveFeet(a, b) : { feet: 0, flipped: false };
57019
+ const feet = Math.max(planMove.feet, elevMoveFeet(a, b));
57020
+ if (feet > MOVE_TOL_FT) {
57021
+ const scaleUnknown = !a.hasScale || !b.hasScale;
57022
+ moved.push({ ref: refOf(b), feet: Math.round(feet * 10) / 10, ...scaleUnknown ? { scaleUnknown: true } : {} });
57023
+ if (scaleUnknown) anyScaleUnknown = true;
57024
+ changed = true;
57025
+ }
57026
+ const eA = [connIdentity(a.ends?.[0], libA), connIdentity(a.ends?.[1], libA)];
57027
+ const eB = [connIdentity(b.ends?.[0], libB), connIdentity(b.ends?.[1], libB)];
57028
+ const [eB0, eB1] = planMove.flipped ? [eB[1], eB[0]] : [eB[0], eB[1]];
57029
+ const parts = [];
57030
+ if (eA[0] !== eB0) parts.push(`end 1: ${eA[0] || "none"} \u2192 ${eB0 || "none"}`);
57031
+ if (eA[1] !== eB1) parts.push(`end 2: ${eA[1] || "none"} \u2192 ${eB1 || "none"}`);
57032
+ const cA = connIdentity(a.col, libA), cB = connIdentity(b.col, libB);
57033
+ if (cA !== cB) parts.push(`column: ${cA || "none"} \u2192 ${cB || "none"}`);
57034
+ if (!((A.idSheets.get(a.id)?.size ?? 0) > 1 || (B.idSheets.get(b.id)?.size ?? 0) > 1)) {
57035
+ const jA = jointsA.get(a.id) ?? [];
57036
+ const jB = jointsB.get(b.id) ?? [];
57037
+ if (stable(jA) !== stable(jB)) parts.push(jointsSummary(jA, jB));
57038
+ }
57039
+ if (parts.length) {
57040
+ connections.push({ ref: refOf(b), summary: parts.join("; ") });
57041
+ changed = true;
57027
57042
  }
57043
+ if (!changed) unchanged++;
57028
57044
  }
57029
- return best && bestD <= Math.max(best.dims.w, best.dims.d) ? best : void 0;
57045
+ const keysA = A.byKey.size;
57046
+ const keysB = B.byKey.size;
57047
+ let shared = 0;
57048
+ for (const k of A.byKey.keys()) if (B.byKey.has(k)) shared++;
57049
+ const smaller = Math.min(keysA, keysB);
57050
+ const identityNotPreserved = keysA >= 5 && keysB >= 5 && smaller > 0 && shared / smaller < 0.1;
57051
+ const bom = (x) => {
57052
+ try {
57053
+ return contractToBom(x);
57054
+ } catch {
57055
+ return { totalLb: 0, totalTons: 0 };
57056
+ }
57057
+ };
57058
+ const fromBom = bom(from);
57059
+ const toBom = bom(to);
57060
+ const netLb = toBom.totalLb - fromBom.totalLb;
57061
+ const warnings = {
57062
+ ...identityNotPreserved ? { identityNotPreserved: true } : {},
57063
+ ...dupKeys.length ? { duplicateKeys: dupKeys } : {},
57064
+ ...ambiguousJoints.size ? { ambiguousJoints: [...ambiguousJoints] } : {},
57065
+ ...anyScaleUnknown ? { scaleUnknown: true } : {}
57066
+ };
57067
+ return {
57068
+ from: 0,
57069
+ to: 0,
57070
+ tonnage: {
57071
+ fromLb: fromBom.totalLb,
57072
+ toLb: toBom.totalLb,
57073
+ netLb,
57074
+ fromTons: fromBom.totalTons,
57075
+ toTons: toBom.totalTons,
57076
+ netTons: Math.round(netLb / 2e3 * 10) / 10
57077
+ },
57078
+ added,
57079
+ removed,
57080
+ resized,
57081
+ moved,
57082
+ material,
57083
+ connections,
57084
+ unchanged,
57085
+ warnings
57086
+ };
57030
57087
  }
57031
- function flangeThk(profile, d) {
57032
- return profileKind(profile) === "I" ? Math.min(d * 0.5, Math.max(d * 0.1, 6)) : d / 2;
57088
+
57089
+ // version-diff.ts
57090
+ function appSupportsDiff(app) {
57091
+ return app === "steel-model";
57033
57092
  }
57034
- var clamp = (x, lo, hi) => Math.max(lo, Math.min(hi, x));
57035
- function supportWorkZAt(support, pt) {
57036
- const a = support.from, b = support.to;
57037
- const dx = b[0] - a[0], dy = b[1] - a[1];
57038
- const len2 = dx * dx + dy * dy;
57039
- if (!(len2 > 1e-9)) return a[2];
57040
- const t = clamp(((pt[0] - a[0]) * dx + (pt[1] - a[1]) * dy) / len2, 0, 1);
57041
- return a[2] + (b[2] - a[2]) * t;
57093
+ function computeVersionDiff(id, n, base) {
57094
+ if (!Number.isInteger(n) || n < 1) return { code: 400, body: { ok: false, error: "n must be a positive integer version number" } };
57095
+ const head = listVersions(id)[0]?.n ?? 0;
57096
+ if (head === 0) return { code: 404, body: { ok: false, error: "no versions for this project" } };
57097
+ const to = readVersionSkeleton(id, n);
57098
+ if (to == null) return { code: 404, body: { ok: false, error: `version v${n} not found` } };
57099
+ if (n === 1) {
57100
+ const empty = diffContracts({}, to);
57101
+ return {
57102
+ code: 200,
57103
+ body: { ok: true, diff: { ...empty, from: 0, to: 1, firstVersion: true, added: [], tonnage: { fromLb: 0, toLb: 0, netLb: 0, fromTons: 0, toTons: 0, netTons: 0 } } }
57104
+ };
57105
+ }
57106
+ const b = base ?? n - 1;
57107
+ if (!Number.isInteger(b) || b < 1 || b >= n) return { code: 400, body: { ok: false, error: `base must be an integer in 1..${n - 1}` } };
57108
+ const from = readVersionSkeleton(id, b);
57109
+ if (from == null) return { code: 404, body: { ok: false, error: `base version v${b} not found` } };
57110
+ const diff = diffContracts(from, to);
57111
+ diff.from = b;
57112
+ diff.to = n;
57113
+ return { code: 200, body: { ok: true, diff } };
57042
57114
  }
57043
- function beamCopes(beam, support, at, params) {
57044
- if (!support || !finite3(support.from) || !finite3(support.to) || !support.dims || !(support.dims.d > 0) || !(support.dims.w > 0)) return {};
57045
- if (!finite3(beam.from) || !finite3(beam.to) || !beam.dims || !(beam.dims.d > 0) || !(beam.dims.w > 0)) return {};
57046
- if (profileKind(support.profile) !== "I") return {};
57047
- const endPt = at === "end1" ? beam.to : beam.from;
57048
- const gap = Math.max(0, num3(params, "clearance", 12.7));
57049
- const beamMidZ = endPt[2] + (typeof beam.posOffset === "number" && isFinite(beam.posOffset) ? beam.posOffset : 0);
57050
- const beamTopZ = beamMidZ + beam.dims.d / 2, beamBotZ = beamMidZ - beam.dims.d / 2;
57051
- const supMidZ = supportWorkZAt(support, endPt) + (typeof support.posOffset === "number" && isFinite(support.posOffset) ? support.posOffset : 0);
57052
- const supTopZ = supMidZ + support.dims.d / 2, supBotZ = supMidZ - support.dims.d / 2;
57053
- const tfS = flangeThk(support.profile, support.dims.d);
57054
- const kClear = Math.max(0, num3(params, "copeKClear", 12.7));
57055
- const minLen = Math.max(0, num3(params, "copeMinLength", 31.75));
57056
- const kBand = tfS + kClear;
57057
- const webLo = supBotZ + kBand, webHi = supTopZ - kBand;
57058
- if (!(webLo < webHi && beamTopZ > webLo && beamBotZ < webHi)) return {};
57059
- const length = Math.max(support.dims.w / 2 + gap, minLen);
57060
- const out = {};
57061
- if (beamTopZ > webHi) out.top = { depth: clamp(beamTopZ - (webHi - gap), 0, beam.dims.d), length };
57062
- if (beamBotZ < webLo) out.bottom = { depth: clamp(webLo + gap - beamBotZ, 0, beam.dims.d), length };
57063
- return out;
57115
+
57116
+ // project-sources-store.ts
57117
+ var import_node_crypto10 = require("node:crypto");
57118
+ var import_node_fs27 = require("node:fs");
57119
+ var import_node_path24 = require("node:path");
57120
+ var sourcesDir = (id) => (0, import_node_path24.join)(projectDir(id), "sources");
57121
+ var safeExt = (ext) => typeof ext === "string" && /^[a-z0-9]{1,8}$/i.test(ext) ? ext.toLowerCase() : "bin";
57122
+ function writeAtomic2(path, buf) {
57123
+ const tmp = `${path}.${process.pid}.tmp`;
57124
+ (0, import_node_fs27.writeFileSync)(tmp, buf);
57125
+ (0, import_node_fs27.renameSync)(tmp, path);
57064
57126
  }
57065
- var IN = 25.4;
57066
- function aiscBoltLength(gripMm, diaMm) {
57067
- const Q = IN / 4;
57068
- const raw = gripMm + diaMm + Q;
57069
- const step = raw > 5 * IN ? 2 * Q : Q;
57070
- return Math.ceil((raw - 1e-6) / step) * step;
57127
+ function saveSource(id, file) {
57128
+ (0, import_node_fs27.mkdirSync)(sourcesDir(id), { recursive: true });
57129
+ const sha2562 = (0, import_node_crypto10.createHash)("sha256").update(file.buf).digest("hex");
57130
+ const ext = safeExt(file.ext);
57131
+ const p = (0, import_node_path24.join)(sourcesDir(id), `${sha2562}.${ext}`);
57132
+ if (!(0, import_node_fs27.existsSync)(p)) writeAtomic2(p, file.buf);
57133
+ return { name: String(file.name), sha256: sha2562, ext, bytes: file.buf.length };
57071
57134
  }
57072
- function expandShearPlate(joint, beam, support) {
57073
- const p = joint.params;
57074
- const atEnd1 = joint.at === "end1";
57075
- const endPt = atEnd1 ? beam.to : beam.from;
57076
- const farPt = atEnd1 ? beam.from : beam.to;
57077
- let ux = farPt[0] - endPt[0], uy = farPt[1] - endPt[1];
57078
- const hLen = Math.hypot(ux, uy);
57079
- if (!(hLen > 1e-6)) return [];
57080
- ux /= hLen;
57081
- uy /= hLen;
57082
- const uDir = [ux, uy, 0];
57083
- const vDir = [0, 0, 1];
57084
- const nDir = [uy, -ux, 0];
57085
- const posOff = typeof beam.posOffset === "number" && isFinite(beam.posOffset) ? beam.posOffset : 0;
57086
- const webZ = endPt[2] + posOff;
57087
- const P = (u, v, n) => [
57088
- endPt[0] + uDir[0] * u + nDir[0] * n,
57089
- endPt[1] + uDir[1] * u + nDir[1] * n,
57090
- webZ + v
57091
- ];
57092
- const thickness = pos(p, "plateThickness", 10);
57093
- const width = pos(p, "plateWidth", 120);
57094
- const boltDia = pos(p, "boltDia", 20);
57095
- const cols = intMin1(p, "boltCols", 1);
57096
- const rows = intMin1(p, "boltRows", 3);
57097
- const pitch = pos(p, "boltPitch", 70);
57098
- const colPitch = pos(p, "boltColPitch", pitch);
57099
- const holeClr = num3(p, "holeClearance", 2);
57100
- const edge = Math.max(0, num3(p, "edgeDist", Math.max(1.5 * boltDia, 30)));
57101
- const weldLeg = num3(p, "weldLeg", 6);
57102
- const clearance = Math.max(0, num3(p, "clearance", 12.7));
57103
- const stiffener = p?.["stiffener"] === true;
57104
- const height = pos(p, "plateHeight", (rows - 1) * pitch + 2 * edge);
57105
- const twHalf = webHalfThk(beam.profile, beam.dims.w);
57106
- const webSide = num3(p, "webSide", 1) >= 0 ? 1 : -1;
57107
- const pOff = webSide * (twHalf + thickness / 2);
57108
- const u0 = support ? webHalfThk(support.profile, support.dims.w) : 0;
57109
- const edgeV = Math.min(edge, height * 0.4);
57110
- const pV = rows > 1 ? Math.min(pitch, Math.max(0, height - 2 * edgeV) / (rows - 1)) : 0;
57111
- const vOffs = Array.from({ length: rows }, (_, i) => (i - (rows - 1) / 2) * pV);
57112
- const edgeU = Math.min(edge, width * 0.4);
57113
- const regHi = Math.max(edgeU, width - edgeU);
57114
- const regLo = Math.min(clearance + edgeU, regHi);
57115
- const cU = (regLo + regHi) / 2;
57116
- const pU = cols > 1 ? Math.min(colPitch, (regHi - regLo) / (cols - 1)) : 0;
57117
- const uOffs = Array.from({ length: cols }, (_, j) => cU + (j - (cols - 1) / 2) * pU);
57118
- const nutH = 0.8 * boltDia, nutAF = 1.6 * boltDia;
57119
- const plateOuterN = webSide * (twHalf + thickness);
57120
- const webFarN = -webSide * twHalf;
57121
- const headTipN = plateOuterN + webSide * nutH;
57122
- const nutTipN = webFarN - webSide * nutH;
57123
- const grade = p?.["boltGrade"] === "A490" ? "A490" : "A325";
57124
- const grip = thickness + 2 * twHalf;
57125
- const boltLen = aiscBoltLength(grip, boltDia);
57126
- const callout = `\u2300${Math.round(boltDia)} ${grade} \xD7 ${Math.round(boltLen)}`;
57127
- const holes = [];
57128
- const bolts = [];
57129
- let k = 0;
57130
- for (const v of vOffs) {
57131
- for (const u of uOffs) {
57132
- const jid = joint.id;
57133
- holes.push({ u: u - width / 2, v, d: boltDia + holeClr });
57134
- bolts.push(
57135
- // the shank = the AISC bolt LENGTH, from under the head (plate outer face) into the connection
57136
- { id: `${jid}:bolt${k}`, group: "bolt", kind: "rod", from: P(u0 + u, v, plateOuterN), to: P(u0 + u, v, plateOuterN - webSide * boltLen), d: boltDia, meta: { label: `Bolt ${callout}` } },
57137
- { id: `${jid}:head${k}`, group: "nut", kind: "nut", from: P(u0 + u, v, plateOuterN), to: P(u0 + u, v, headTipN), acrossFlats: nutAF, meta: { label: `Bolt head ${callout}` } },
57138
- { id: `${jid}:nut${k}`, group: "nut", kind: "nut", from: P(u0 + u, v, webFarN), to: P(u0 + u, v, nutTipN), acrossFlats: nutAF, meta: { label: `Bolt nut ${callout}` } }
57139
- );
57140
- k++;
57141
- }
57135
+
57136
+ // contract-bake.ts
57137
+ var import_node_fs28 = require("node:fs");
57138
+ var import_yaml6 = __toESM(require_dist6(), 1);
57139
+ function bakeContractIntoApp(sourcePath, contract) {
57140
+ const doc = (0, import_yaml6.parseDocument)((0, import_node_fs28.readFileSync)(sourcePath, "utf8"));
57141
+ if (doc.errors.length > 0) {
57142
+ throw new Error(`contract bake: source is not valid YAML: ${doc.errors[0]?.message ?? "parse error"}`);
57142
57143
  }
57143
- const plate = {
57144
- id: `${joint.id}:plate`,
57145
- group: "shear-plate",
57146
- kind: "plate",
57147
- center: P(u0 + width / 2, 0, pOff),
57148
- uDir,
57149
- vDir,
57150
- // welded edge at the support web FACE (u0); lapped on the webSide face; cantilevered +uDir toward the beam
57151
- width,
57152
- depth: height,
57153
- thickness,
57154
- holes,
57155
- meta: { label: `Shear plate ${Math.round(width)}\xD7${Math.round(height)}\xD7${Math.round(thickness)}` }
57144
+ const seq = doc.get("nodes");
57145
+ const items = (0, import_yaml6.isSeq)(seq) ? seq.items : [];
57146
+ const nodeOf = (it) => (0, import_yaml6.isMap)(it) ? it.toJSON() : null;
57147
+ let idx = items.findIndex((it) => nodeOf(it)?.config?.contract === contract.type);
57148
+ if (idx < 0) idx = items.findIndex((it) => nodeOf(it)?.agent === "steel-takeoff-us");
57149
+ if (idx < 0) throw new Error("no contract-emitting node to bake the contract into");
57150
+ doc.setIn(["nodes", idx, "config", "contract"], contract.type);
57151
+ const baked = { ...contract };
57152
+ delete baked.dims3d;
57153
+ delete baked.detail_placements;
57154
+ delete baked.prop_labels;
57155
+ delete baked.member_styles;
57156
+ if (Array.isArray(contract.plans)) {
57157
+ baked.plans = contract.plans.map((p) => {
57158
+ if (p && typeof p === "object") {
57159
+ const clone = { ...p };
57160
+ delete clone.dims;
57161
+ return clone;
57162
+ }
57163
+ return p;
57164
+ });
57165
+ }
57166
+ const stripPageRaster = (p) => {
57167
+ if (p && typeof p === "object") {
57168
+ const page = { ...p };
57169
+ delete page.bg_b64;
57170
+ return page;
57171
+ }
57172
+ return p;
57156
57173
  };
57157
- const weldSide = p?.["weldSide"] === "near" || p?.["weldSide"] === "far" ? p["weldSide"] : "both";
57158
- const nOuter = pOff + webSide * thickness / 2;
57159
- const nInner = pOff - webSide * thickness / 2;
57160
- const faceWeld = (suffix, n) => ({
57161
- id: `${joint.id}:${suffix}`,
57162
- group: "weld",
57163
- kind: "weld",
57164
- closed: false,
57165
- path: [P(u0, -height / 2, n), P(u0, height / 2, n)],
57166
- leg: weldLeg,
57167
- // at the support web FACE
57168
- meta: { label: `Fillet ${weldLeg} (${weldSide === "both" ? "both sides" : weldSide + " side"})` }
57169
- });
57170
- const welds = [];
57171
- if (weldSide !== "far") welds.push(faceWeld("weld", nOuter));
57172
- if (weldSide !== "near") welds.push(faceWeld("weld2", nInner));
57173
- const parts = [plate, ...bolts, ...welds];
57174
- if (stiffener) {
57175
- if (support && support.role === "beam" && !support.isBrace && finite3(support.from) && finite3(support.to) && support.dims && support.dims.d > 0 && support.dims.w > 0) {
57176
- const supPosOff = typeof support.posOffset === "number" && isFinite(support.posOffset) ? support.posOffset : 0;
57177
- const twGirder = webHalfThk(support.profile, support.dims.w) * 2;
57178
- const stiffH = support.dims.d * 0.9;
57179
- const stiffW = Math.max(support.dims.w / 2 - twGirder / 2, thickness * 2);
57180
- const girderCentZ = endPt[2] + supPosOff;
57181
- const cu = -(twGirder / 2 + stiffW / 2);
57182
- const center = [endPt[0] + uDir[0] * cu, endPt[1] + uDir[1] * cu, girderCentZ];
57183
- parts.push({ id: `${joint.id}:stiff`, group: "stiffener", kind: "plate", center, uDir, vDir, width: stiffW, depth: stiffH, thickness, holes: [], meta: { label: `Stiffener ${Math.round(stiffW)}\xD7${Math.round(stiffH)}\xD7${Math.round(thickness)}` } });
57184
- const wfx = endPt[0] - uDir[0] * (twGirder / 2), wfy = endPt[1] - uDir[1] * (twGirder / 2);
57185
- parts.push({ id: `${joint.id}:stiffweld`, group: "weld", kind: "weld", closed: false, path: [[wfx, wfy, girderCentZ - stiffH / 2], [wfx, wfy, girderCentZ + stiffH / 2]], leg: weldLeg, meta: { label: `Fillet ${weldLeg}` } });
57186
- } else {
57187
- const oppOff = -webSide * (twHalf + thickness / 2);
57188
- parts.push({ id: `${joint.id}:stiff`, group: "stiffener", kind: "plate", center: P(u0 + width / 2, 0, oppOff), uDir, vDir, width, depth: height, thickness, holes: [], meta: { label: `Stiffener ${Math.round(width)}\xD7${Math.round(height)}\xD7${Math.round(thickness)}` } });
57189
- parts.push({ id: `${joint.id}:stiffweld`, group: "weld", kind: "weld", closed: false, path: [P(u0, -height / 2, oppOff), P(u0, height / 2, oppOff)], leg: weldLeg, meta: { label: `Fillet ${weldLeg}` } });
57174
+ const filter = baked.filter;
57175
+ if (filter && typeof filter === "object") {
57176
+ const next = { ...filter };
57177
+ if (filter.page) next.page = stripPageRaster(filter.page);
57178
+ if (Array.isArray(filter.sheets)) {
57179
+ next.sheets = filter.sheets.map(
57180
+ (s) => s && typeof s === "object" ? { ...s, page: stripPageRaster(s.page) } : s
57181
+ );
57190
57182
  }
57191
- }
57192
- const cope = beamCopes(beam, support, joint.at ?? "end0", p);
57193
- const copeRadius = pos(p, "copeRadius", 12.7);
57194
- const MIN_COPE = 1;
57195
- const pushCope = (side, dec) => {
57196
- if (!(dec.depth > MIN_COPE)) return;
57197
- const lenU = dec.length + clearance;
57198
- const vC = side === "top" ? beam.dims.d / 2 - dec.depth / 2 : -beam.dims.d / 2 + dec.depth / 2;
57199
- parts.push({
57200
- id: `${joint.id}:cope-${side}`,
57201
- group: "cope",
57202
- kind: "cut",
57203
- member: beam.id,
57204
- center: P(lenU / 2, vC, 0),
57205
- uDir,
57206
- vDir,
57207
- width: lenU,
57208
- depth: dec.depth,
57209
- thickness: beam.dims.w + 2,
57210
- radius: copeRadius,
57211
- reentrantV: side === "top" ? -1 : 1,
57212
- // web side = toward the beam centroid (top cope below, bottom above)
57213
- meta: { label: `${side === "top" ? "Top" : "Bottom"} cope ${Math.round(dec.length)}\xD7${Math.round(dec.depth)}` }
57214
- });
57183
+ baked.filter = next;
57184
+ }
57185
+ if (Array.isArray(baked.sheets)) {
57186
+ baked.sheets = baked.sheets.map(
57187
+ (s) => s && typeof s === "object" ? { ...s, page: stripPageRaster(s.page) } : s
57188
+ );
57189
+ }
57190
+ doc.setIn(["nodes", idx, "config", "takeoff"], baked);
57191
+ (0, import_node_fs28.writeFileSync)(sourcePath, doc.toString());
57192
+ }
57193
+
57194
+ // vectorize.ts
57195
+ function assignIds(items, prefix) {
57196
+ const used = /* @__PURE__ */ new Set();
57197
+ const keep = items.map((it) => {
57198
+ if (it.id && !used.has(it.id)) {
57199
+ used.add(it.id);
57200
+ return true;
57201
+ }
57202
+ return false;
57203
+ });
57204
+ let counter = 0;
57205
+ const nextId = () => {
57206
+ let id;
57207
+ do {
57208
+ counter += 1;
57209
+ id = `${prefix}${counter}`;
57210
+ } while (used.has(id));
57211
+ used.add(id);
57212
+ return id;
57215
57213
  };
57216
- if (cope.top) pushCope("top", cope.top);
57217
- if (cope.bottom) pushCope("bottom", cope.bottom);
57218
- return parts;
57214
+ return items.map((it, i) => keep[i] ? it : { ...it, id: nextId() });
57219
57215
  }
57220
- function expandCustom(joint) {
57221
- const place = finite3(joint.place) ? joint.place : [0, 0, 0];
57222
- const [dx, dy, dz] = place;
57216
+ function geomKey(el, index) {
57217
+ const layer = el.layer ?? "";
57218
+ if (el.kind === "text") {
57219
+ const pos2 = el.origin ? el.origin.join(",") : (el.bbox ?? []).join(",");
57220
+ return `text|${layer}|${el.text ?? ""}|${pos2}`;
57221
+ }
57222
+ if (el.d) return `${el.kind}|${layer}|${el.d}`;
57223
+ if (el.pts) return `${el.kind}|${layer}|${el.pts.map((p) => p.join(",")).join(" ")}`;
57224
+ return `nogeom|${index}`;
57225
+ }
57226
+ function dedupeElements(elements) {
57227
+ const seen = /* @__PURE__ */ new Set();
57223
57228
  const out = [];
57224
- (joint.geometry ?? []).forEach((g, i) => {
57225
- if (!g || !Array.isArray(g.positions) || !Array.isArray(g.indices)) return;
57226
- if (g.positions.length < 9 || g.indices.length < 3 || g.positions.length % 3 !== 0) return;
57227
- const positions = new Array(g.positions.length);
57228
- for (let k = 0; k < g.positions.length; k += 3) {
57229
- positions[k] = g.positions[k] + dx;
57230
- positions[k + 1] = g.positions[k + 1] + dy;
57231
- positions[k + 2] = g.positions[k + 2] + dz;
57232
- }
57233
- const role = typeof g.role === "string" ? g.role : void 0;
57234
- const label = role ? role.charAt(0).toUpperCase() + role.slice(1) : "Imported part";
57235
- out.push({ id: `${joint.id}:${g.id || `m${i}`}`, group: "custom", kind: "mesh", positions, indices: g.indices.slice(), meta: { label, role } });
57229
+ elements.forEach((el, i) => {
57230
+ const key = geomKey(el, i);
57231
+ if (seen.has(key)) return;
57232
+ seen.add(key);
57233
+ out.push(el);
57236
57234
  });
57237
57235
  return out;
57238
57236
  }
57239
- function expandJoints(joints, memberGeo) {
57240
- const elements = [];
57241
- const skipped = [];
57242
- const usedGroups = /* @__PURE__ */ new Set();
57243
- (joints ?? []).forEach((j, i) => {
57244
- if (!j || !j.id) {
57245
- skipped.push(`joint#${i}`);
57246
- return;
57237
+ function snapEndpoints(elements, tol = 1) {
57238
+ const reps = [];
57239
+ const tol2 = tol * tol;
57240
+ const snap = (p) => {
57241
+ for (const r of reps) {
57242
+ const dx = p[0] - r[0];
57243
+ const dy = p[1] - r[1];
57244
+ if (dx * dx + dy * dy <= tol2) return r;
57247
57245
  }
57248
- if (j.kind === "custom") {
57249
- const parts = expandCustom(j);
57250
- if (!parts.length) {
57251
- skipped.push(j.id);
57252
- return;
57253
- }
57254
- for (const part of parts) {
57255
- part.conn = j.id;
57256
- part.connKind = j.kind;
57257
- elements.push(part);
57258
- usedGroups.add(part.group);
57259
- }
57260
- } else if (j.kind === "base-plate") {
57261
- const col = j.main ? memberGeo.get(j.main) : void 0;
57262
- if (!col || col.role !== "column") {
57263
- skipped.push(j.id);
57264
- return;
57265
- }
57266
- if (!finite3(col.from) || !finite3(col.to) || !col.dims || !(col.dims.w > 0) || !(col.dims.d > 0)) {
57267
- skipped.push(j.id);
57268
- return;
57269
- }
57270
- for (const part of expandBasePlate(j, col)) {
57271
- part.conn = j.id;
57272
- part.connKind = j.kind;
57273
- elements.push(part);
57274
- usedGroups.add(part.group);
57275
- }
57276
- } else if (j.kind === "shear-plate") {
57277
- const beam = j.main ? memberGeo.get(j.main) : void 0;
57278
- if (!beam || beam.role !== "beam" || beam.isBrace) {
57279
- skipped.push(j.id);
57280
- return;
57281
- }
57282
- if (!finite3(beam.from) || !finite3(beam.to) || !beam.dims || !(beam.dims.w > 0) || !(beam.dims.d > 0)) {
57283
- skipped.push(j.id);
57284
- return;
57285
- }
57286
- let support = j.secondaries && j.secondaries[0] ? memberGeo.get(j.secondaries[0]) : void 0;
57287
- if (support && support.isBrace) support = void 0;
57288
- if (!support) support = inferSupport(beam, j.at === "end1" ? beam.to : beam.from, memberGeo);
57289
- const parts = expandShearPlate(j, beam, support);
57290
- if (!parts.length) {
57291
- skipped.push(j.id);
57292
- return;
57293
- }
57294
- for (const part of parts) {
57295
- part.conn = j.id;
57296
- part.connKind = j.kind;
57297
- elements.push(part);
57298
- if (part.kind !== "cut") usedGroups.add(part.group);
57299
- }
57300
- } else {
57301
- skipped.push(j.id);
57246
+ const rep = [p[0], p[1]];
57247
+ reps.push(rep);
57248
+ return rep;
57249
+ };
57250
+ return elements.map((el) => {
57251
+ if (!el.pts || el.pts.length === 0) return el;
57252
+ const pts = el.pts.map((p) => {
57253
+ const s = snap(p);
57254
+ return [s[0], s[1]];
57255
+ });
57256
+ return { ...el, pts };
57257
+ });
57258
+ }
57259
+ function deriveLayers(elements, existing) {
57260
+ const onByName = /* @__PURE__ */ new Map();
57261
+ for (const l of existing ?? []) if (l && l.name && l.on != null) onByName.set(l.name, l.on);
57262
+ const counts = /* @__PURE__ */ new Map();
57263
+ for (const el of elements) {
57264
+ if (!el.layer) continue;
57265
+ counts.set(el.layer, (counts.get(el.layer) ?? 0) + 1);
57266
+ }
57267
+ return [...counts.entries()].map(([name, count]) => onByName.has(name) ? { name, count, on: onByName.get(name) } : { name, count }).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
57268
+ }
57269
+ function pickSheet(contract, sheetId) {
57270
+ const sheets = contract.sheets ?? [];
57271
+ if (sheetId) return sheets.find((s) => s.id === sheetId);
57272
+ const active = contract.active ?? 0;
57273
+ return sheets[active] ?? sheets[0];
57274
+ }
57275
+ function escAttr(s) {
57276
+ return s.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
57277
+ }
57278
+ function escText(s) {
57279
+ return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
57280
+ }
57281
+ function num3(v, fallback) {
57282
+ const n = typeof v === "number" ? v : Number(v);
57283
+ return Number.isFinite(n) ? n : fallback;
57284
+ }
57285
+ function ptsToPath(pts) {
57286
+ if (!pts || pts.length < 2) return "";
57287
+ return pts.map((p, i) => `${i === 0 ? "M" : "L"}${num3(p[0], 0)} ${num3(p[1], 0)}`).join(" ");
57288
+ }
57289
+ function contractToSvg(contract, sheetId) {
57290
+ const sheet = pickSheet(contract, sheetId);
57291
+ if (!sheet) return '<svg xmlns="http://www.w3.org/2000/svg"></svg>';
57292
+ const w = num3(sheet.page?.w, 100);
57293
+ const h = num3(sheet.page?.h, 100);
57294
+ const parts = [];
57295
+ for (const el of sheet.elements) {
57296
+ if (el.kind === "text") {
57297
+ if (!el.text) continue;
57298
+ const bbox = el.bbox;
57299
+ const ox = num3(el.origin?.[0] ?? bbox?.[0], 0);
57300
+ const oy = num3(el.origin?.[1] ?? bbox?.[3] ?? bbox?.[1], 0);
57301
+ const fs2 = el.size != null ? num3(el.size, 4) : num3(el.w, 1) * 6;
57302
+ const font = el.font ? ` font-family="${escAttr(el.font)}"` : "";
57303
+ const ang = num3(el.angle, 0);
57304
+ const rot = ang ? ` transform="rotate(${ang} ${ox} ${oy})"` : "";
57305
+ parts.push(
57306
+ `<text x="${ox}" y="${oy}" font-size="${fs2}" fill="${escAttr(el.color ?? "#94a3b8")}"${font}${rot}>${escText(el.text)}</text>`
57307
+ );
57308
+ continue;
57302
57309
  }
57310
+ const d = el.d || ptsToPath(el.pts);
57311
+ if (!d) continue;
57312
+ const sw = num3(el.w, 1);
57313
+ const dash = el.dashed ? ` stroke-dasharray="${sw * 3} ${sw * 2}"` : "";
57314
+ parts.push(
57315
+ `<path d="${escAttr(d)}" fill="none" stroke="${escAttr(el.color ?? "#e2e8f0")}" stroke-width="${sw}"${dash}/>`
57316
+ );
57317
+ }
57318
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${w} ${h}" width="${w}" height="${h}">${parts.join("")}</svg>`;
57319
+ }
57320
+ function postProcess(contract, opts = {}) {
57321
+ const snapTol = opts.snapTol ?? 1;
57322
+ const sheets = (contract.sheets ?? []).map((sheet, i) => {
57323
+ let elements = sheet.elements ?? [];
57324
+ elements = snapEndpoints(elements, snapTol);
57325
+ elements = dedupeElements(elements);
57326
+ elements = assignIds(elements, "e");
57327
+ const layers = deriveLayers(elements, sheet.layers);
57328
+ const id = sheet.id ?? `s${i + 1}`;
57329
+ const groups = sheet.groups ? assignIds(sheet.groups, "g") : void 0;
57330
+ return { ...sheet, id, elements, layers, ...groups ? { groups } : {} };
57303
57331
  });
57304
- const groups = [...usedGroups].map((k) => GROUPS[k]);
57305
- return { elements, groups, skipped };
57332
+ const datums = contract.datums ? assignIds(contract.datums, "dt") : void 0;
57333
+ const links = contract.links ? assignIds(contract.links, "lk") : void 0;
57334
+ return {
57335
+ ...contract,
57336
+ type: "drawing.vector/v1",
57337
+ sheets,
57338
+ ...datums ? { datums } : {},
57339
+ ...links ? { links } : {}
57340
+ };
57306
57341
  }
57307
57342
 
57308
- // contract-to-scene.ts
57309
- var BF_IN = aisc_shapes_default;
57310
- var FT_TO_MM = 304.8;
57311
- var IN_TO_MM = 25.4;
57312
- var memberIsBrace = (m) => typeof m.memberType === "string" && m.memberType.trim().toLowerCase() === "brace";
57313
- function depthPosition(explicit, dzMm, horizMm, isVerticalBrace = false) {
57314
- if (explicit === "top" || explicit === "middle" || explicit === "bottom") return explicit;
57315
- if (isVerticalBrace) return "middle";
57316
- return dzMm > horizMm * 0.5774 ? "middle" : "top";
57343
+ // views-to-scene.ts
57344
+ function mapper(sheet) {
57345
+ const t = sheet.transform;
57346
+ if (!t || typeof t.scale !== "number" || !(t.scale > 0)) return null;
57347
+ const s = t.scale;
57348
+ const [ox, oy] = t.origin ?? [0, 0];
57349
+ const rot = (t.rotation ?? 0) * Math.PI / 180;
57350
+ const cos = Math.cos(rot);
57351
+ const sin = Math.sin(rot);
57352
+ return (p) => {
57353
+ const dx = p[0] - ox;
57354
+ const dy = p[1] - oy;
57355
+ const rx = dx * cos - dy * sin;
57356
+ const ry = dx * sin + dy * cos;
57357
+ return [rx * s + 0, -ry * s + 0];
57358
+ };
57359
+ }
57360
+ function uprightHorizontal(sheet) {
57361
+ const dir = sheet.view?.dir ?? "+y";
57362
+ if (dir === "+y") return { axis: "x", sign: 1 };
57363
+ if (dir === "-y") return { axis: "x", sign: -1 };
57364
+ if (dir === "+x") return { axis: "y", sign: -1 };
57365
+ if (dir === "-x") return { axis: "y", sign: 1 };
57366
+ return null;
57367
+ }
57368
+ function elevationZExtent(sheet, g) {
57369
+ const map = mapper(sheet);
57370
+ if (!map) return null;
57371
+ const pts = collectDisplayPoints(g, sheet);
57372
+ if (pts.length === 0) return null;
57373
+ let lo = Infinity;
57374
+ let hi = -Infinity;
57375
+ for (const p of pts) {
57376
+ const z = map(p)[1];
57377
+ if (z < lo) lo = z;
57378
+ if (z > hi) hi = z;
57379
+ }
57380
+ return lo <= hi ? [lo, hi] : null;
57317
57381
  }
57318
- function profileDimsIn(profile) {
57319
- if (!profile) return null;
57320
- const p = profile.trim().toUpperCase();
57321
- if (p === "" || /(^|[^A-Z])MF($|[^A-Z])/.test(p)) return null;
57322
- const m = p.match(/^([A-Z]+)\s*([0-9X./]+)/);
57323
- if (!m) return null;
57324
- const prefix = m[1];
57325
- const nums = m[2].split("X").map((t) => parseFloat(t)).filter((n) => !isNaN(n));
57326
- if (nums.length === 0) return null;
57327
- if ((prefix === "HSS" || prefix === "TUBE" || prefix === "L") && nums.length >= 3) {
57328
- return { d: nums[0], w: nums[1], approx: false };
57382
+ function worldInterval(sheet, g, component, sign = 1) {
57383
+ const map = mapper(sheet);
57384
+ if (!map) return null;
57385
+ const pts = collectDisplayPoints(g, sheet);
57386
+ if (pts.length === 0) return null;
57387
+ let lo = Infinity;
57388
+ let hi = -Infinity;
57389
+ for (const p of pts) {
57390
+ const v = map(p)[component] * sign;
57391
+ if (v < lo) lo = v;
57392
+ if (v > hi) hi = v;
57329
57393
  }
57330
- if (prefix === "HSS" || prefix === "PIPE") {
57331
- const dia = nums[0];
57332
- return { d: dia, w: dia, approx: false };
57394
+ return lo <= hi ? [lo, hi] : null;
57395
+ }
57396
+ function collectDisplayPoints(g, sheet) {
57397
+ if (g.footprint && g.footprint.length) return g.footprint;
57398
+ if (g.axis && g.axis.length === 2) return g.axis;
57399
+ const ids = new Set(g.elementIds ?? []);
57400
+ const pts = [];
57401
+ for (const el of sheet.elements ?? []) {
57402
+ if (!el.id || !ids.has(el.id)) continue;
57403
+ if (el.pts) pts.push(...el.pts);
57404
+ else if (el.bbox && el.bbox.length === 4) {
57405
+ pts.push([el.bbox[0], el.bbox[1]], [el.bbox[2], el.bbox[3]]);
57406
+ }
57333
57407
  }
57334
- if (/^(W|S|M|HP|C|MC|WT|ST|MT)$/.test(prefix)) {
57335
- const d = nums[0];
57336
- const bf = BF_IN[p.replace(/\s+/g, "")];
57337
- if (bf !== void 0) return { d, w: bf, approx: false };
57338
- const ratio = prefix === "C" || prefix === "MC" ? 0.28 : 0.42;
57339
- return { d, w: d * ratio, approx: true };
57408
+ return pts;
57409
+ }
57410
+ function resolveDatum(v, datums, axis) {
57411
+ if (typeof v === "number") return v;
57412
+ if (typeof v === "string") {
57413
+ const d = datums.find((x) => x.id === v);
57414
+ return d && (d.axis ?? "z") === axis ? d.value : null;
57340
57415
  }
57341
57416
  return null;
57342
57417
  }
57343
- function profileDims(profile) {
57344
- const din = profileDimsIn(profile);
57345
- return din ? { w: din.w * IN_TO_MM, d: din.d * IN_TO_MM, approx: din.approx } : null;
57346
- }
57347
- var SCENE_DEFAULT_PAL = ["#60a5fa", "#94a3b8", "#f59e0b", "#34d399", "#f472b6", "#a78bfa", "#fb7185", "#22d3ee", "#facc15", "#4ade80"];
57348
- function pickColor(profile, idx, contract) {
57349
- const pc = contract.profile_colors ?? {};
57350
- const override = pc[profile] ?? Object.entries(pc).find(([k]) => k.trim().toUpperCase() === profile)?.[1];
57351
- if (override) return override;
57352
- const pal = contract.palette && contract.palette.length ? contract.palette : SCENE_DEFAULT_PAL;
57353
- return pal[(idx % pal.length + pal.length) % pal.length];
57354
- }
57355
- function dispToMm(pt, ptPerFt) {
57356
- const k = FT_TO_MM / ptPerFt;
57357
- return [pt[0] * k, -pt[1] * k];
57418
+ var PALETTE = ["#3b82f6", "#f59e0b", "#10b981", "#8b5cf6", "#ef4444", "#14b8a6", "#eab308", "#64748b"];
57419
+ function overlapRatio(a, b) {
57420
+ const lo = Math.max(a[0], b[0]);
57421
+ const hi = Math.min(a[1], b[1]);
57422
+ if (hi <= lo) return 0;
57423
+ const shorter = Math.max(1e-9, Math.min(a[1] - a[0], b[1] - b[0]));
57424
+ return (hi - lo) / shorter;
57358
57425
  }
57359
- function contractToScene(contractInput) {
57426
+ function viewsToScene(contractInput) {
57360
57427
  const contract = contractInput ?? {};
57428
+ const sheets = contract.sheets ?? [];
57429
+ const datums = contract.datums ?? [];
57430
+ const links = contract.links ?? [];
57361
57431
  const elements = [];
57362
- const memberGeo = /* @__PURE__ */ new Map();
57363
57432
  const skipped = [];
57364
- const profileOrder = [];
57365
- const seenProfile = /* @__PURE__ */ new Set();
57366
- const beamClear = /* @__PURE__ */ new Map();
57367
- for (const j of contract.joints ?? []) {
57368
- if (!j || j.kind !== "shear-plate" || !j.main || j.at !== "end0" && j.at !== "end1") continue;
57369
- const pc = j.params?.["clearance"];
57370
- const cl = typeof pc === "number" && isFinite(pc) ? Math.max(0, pc) : 12.7;
57371
- const cur = beamClear.get(j.main) ?? { e0: 0, e1: 0 };
57372
- if (j.at === "end0") cur.e0 = Math.max(cur.e0, cl);
57373
- else cur.e1 = Math.max(cur.e1, cl);
57374
- beamClear.set(j.main, cur);
57433
+ const groupKeys = [];
57434
+ const seenKey = /* @__PURE__ */ new Set();
57435
+ const plans = sheets.filter((s) => s.view?.kind === "plan");
57436
+ const uprights = sheets.filter((s) => s.view?.kind === "elevation" || s.view?.kind === "section");
57437
+ const uprightEntities = [];
57438
+ for (const sh of uprights) {
57439
+ const hz = uprightHorizontal(sh);
57440
+ if (!hz) continue;
57441
+ for (const g of sh.groups ?? []) {
57442
+ const z = elevationZExtent(sh, g);
57443
+ const h = worldInterval(sh, g, 0, hz.sign);
57444
+ if (z && h) uprightEntities.push({ sheet: sh, g, z, h, axis: hz.axis });
57445
+ }
57375
57446
  }
57376
- for (const plan of contract.plans ?? []) {
57377
- const ptPerFt = plan.pt_per_ft && plan.pt_per_ft > 0 ? plan.pt_per_ft : 1;
57378
- const defaultTosMm = (plan.default_tos ?? 0) * IN_TO_MM;
57379
- for (const m of plan.members ?? []) {
57380
- const explicit = m.section && typeof m.section.w === "number" && m.section.w > 0 && typeof m.section.d === "number" && m.section.d > 0 ? { w: m.section.w, d: m.section.d, approx: false } : null;
57381
- const dims = profileDims(m.profile) ?? explicit;
57382
- if (!dims || !Array.isArray(m.wp) || m.wp.length < 2) {
57383
- skipped.push(m.id);
57447
+ const linkedAway = /* @__PURE__ */ new Set();
57448
+ for (const l of links) {
57449
+ if (l.kind !== "same-entity") continue;
57450
+ linkedAway.add(`${l.a.sheet}/${l.a.id ?? ""}`);
57451
+ linkedAway.add(`${l.b.sheet}/${l.b.id ?? ""}`);
57452
+ }
57453
+ function resolveZ(planSheet, g) {
57454
+ if (g.extrude && (g.extrude.from !== void 0 || g.extrude.to !== void 0)) {
57455
+ const exFrom = resolveDatum(g.extrude.from, datums, "z");
57456
+ const exTo = resolveDatum(g.extrude.to, datums, "z");
57457
+ if (exFrom != null && exTo != null) return { z: [exFrom, exTo], how: "extrude" };
57458
+ return { error: "extrude reference unresolved \u2014 each end must be a number or the id of a z-axis datum" };
57459
+ }
57460
+ const key = { sheet: planSheet.id, id: g.id };
57461
+ for (const l of links) {
57462
+ if (l.kind !== "same-entity") continue;
57463
+ const other = l.a.sheet === key.sheet && l.a.id === key.id ? l.b : l.b.sheet === key.sheet && l.b.id === key.id ? l.a : null;
57464
+ if (!other) continue;
57465
+ const hit = uprightEntities.find((u) => u.sheet.id === other.sheet && u.g.id === other.id);
57466
+ if (hit) return { z: hit.z, how: "link" };
57467
+ }
57468
+ const mineX = worldInterval(planSheet, g, 0);
57469
+ const mineY = worldInterval(planSheet, g, 1);
57470
+ if (mineX || mineY) {
57471
+ const candidates = uprightEntities.filter((u) => !linkedAway.has(`${u.sheet.id}/${u.g.id ?? ""}`)).map((u) => {
57472
+ const mine = u.axis === "x" ? mineX : mineY;
57473
+ return { u, r: mine ? overlapRatio(mine, u.h) : 0 };
57474
+ }).filter((x) => x.r >= 0.8);
57475
+ if (candidates.length === 1) return { z: candidates[0].u.z, how: "match" };
57476
+ if (candidates.length > 1) return { ambiguous: candidates.length };
57477
+ }
57478
+ return null;
57479
+ }
57480
+ for (const plan of plans) {
57481
+ const map = mapper(plan);
57482
+ const sheetId = plan.id ?? "?";
57483
+ if (!map) {
57484
+ for (const g of plan.groups ?? []) skipped.push({ id: `${sheetId}/${g.id ?? "?"}`, reason: "sheet has no world transform (transform.scale required)" });
57485
+ continue;
57486
+ }
57487
+ for (const g of plan.groups ?? []) {
57488
+ const gid = `${sheetId}/${g.id ?? "?"}`;
57489
+ const isMember = !!(g.axis && g.section);
57490
+ const isFootprint = !!(g.footprint && g.footprint.length >= 3);
57491
+ if (!isMember && !isFootprint) continue;
57492
+ if (isMember && !(g.section.w > 0 && g.section.d > 0)) {
57493
+ skipped.push({ id: gid, reason: "invalid section \u2014 w and d must be positive world units" });
57384
57494
  continue;
57385
57495
  }
57386
- const mIsBrace = memberIsBrace(m);
57387
- const profile = (m.profile ?? "").trim().toUpperCase() || (explicit ? "CUSTOM" : "");
57388
- if (!seenProfile.has(profile)) {
57389
- seenProfile.add(profile);
57390
- profileOrder.push(profile);
57391
- }
57392
- const [ax, ay] = dispToMm(m.wp[0], ptPerFt);
57393
- const [bx, by] = dispToMm(m.wp[1], ptPerFt);
57394
- let from;
57395
- let to;
57396
- let workFrom;
57397
- let workTo;
57398
- let posOffset = 0;
57399
- if (m.role === "column") {
57400
- const bos = m.col?.bos != null ? m.col.bos * IN_TO_MM : 0;
57401
- const tos = m.col?.tos != null ? m.col.tos * IN_TO_MM : defaultTosMm;
57402
- from = [ax, ay, bos];
57403
- to = [ax, ay, tos];
57404
- workFrom = from;
57405
- workTo = to;
57406
- } else {
57407
- const z0 = m.ends?.[0]?.tos != null ? m.ends[0].tos * IN_TO_MM : defaultTosMm;
57408
- const z1 = m.ends?.[1]?.tos != null ? m.ends[1].tos * IN_TO_MM : defaultTosMm;
57409
- workFrom = [ax, ay, z0];
57410
- workTo = [bx, by, z1];
57411
- const pos2 = depthPosition(m.position, Math.abs(z1 - z0), Math.hypot(bx - ax, by - ay), mIsBrace && m.brace?.type === "vertical");
57412
- const zoff = pos2 === "top" ? -dims.d / 2 : pos2 === "bottom" ? dims.d / 2 : 0;
57413
- posOffset = zoff;
57414
- from = [ax, ay, z0 + zoff];
57415
- to = [bx, by, z1 + zoff];
57496
+ const zr0 = resolveZ(plan, g);
57497
+ if (!zr0) {
57498
+ skipped.push({ id: gid, reason: "no Z extent \u2014 add extrude datums/values, a same-entity link, or a matching elevation entity" });
57499
+ continue;
57416
57500
  }
57417
- if (m.role === "column" && Math.abs(to[2] - from[2]) < 1) {
57418
- skipped.push(m.id);
57501
+ if ("ambiguous" in zr0) {
57502
+ skipped.push({ id: gid, reason: `ambiguous Z \u2014 ${zr0.ambiguous} elevation entities share this span; add a same-entity link to pick one` });
57419
57503
  continue;
57420
57504
  }
57421
- if (mIsBrace && Math.hypot(workTo[0] - workFrom[0], workTo[1] - workFrom[1], workTo[2] - workFrom[2]) < 1) {
57422
- skipped.push(m.id);
57505
+ if ("error" in zr0) {
57506
+ skipped.push({ id: gid, reason: zr0.error });
57423
57507
  continue;
57424
57508
  }
57425
- memberGeo.set(m.id, { id: m.id, role: m.role === "column" ? "column" : "beam", from: workFrom, to: workTo, dims: { w: dims.w, d: dims.d }, profile, posOffset, isBrace: mIsBrace, ...typeof m.rot === "number" ? { rot: -m.rot } : {} });
57426
- const clr = beamClear.get(m.id);
57427
- if (clr && m.role !== "column" && !mIsBrace) {
57428
- const dx = to[0] - from[0], dy = to[1] - from[1], dz = to[2] - from[2];
57429
- const L = Math.hypot(dx, dy, dz) || 1;
57430
- const ex = dx / L, ey = dy / L, ez = dz / L;
57431
- const e0 = Math.min(Math.max(0, clr.e0), L * 0.4), e1 = Math.min(Math.max(0, clr.e1), L * 0.4);
57432
- if (e0 > 0) from = [from[0] + ex * e0, from[1] + ey * e0, from[2] + ez * e0];
57433
- if (e1 > 0) to = [to[0] - ex * e1, to[1] - ey * e1, to[2] - ez * e1];
57509
+ const zr = zr0;
57510
+ const key = g.kind || (isMember ? "member" : "footprint");
57511
+ if (!seenKey.has(key)) {
57512
+ seenKey.add(key);
57513
+ groupKeys.push(key);
57514
+ }
57515
+ if (isMember) {
57516
+ const [ax, ay] = map(g.axis[0]);
57517
+ const [bx, by] = map(g.axis[1]);
57518
+ const zFrom = zr.how === "extrude" ? zr.z[0] : (zr.z[0] + zr.z[1]) / 2;
57519
+ const zTo = zr.how === "extrude" ? zr.z[1] : zFrom;
57520
+ elements.push({
57521
+ id: g.id ?? gid,
57522
+ group: key,
57523
+ kind: "box",
57524
+ from: [ax, ay, zFrom],
57525
+ to: [bx, by, zTo],
57526
+ section: { w: g.section.w, d: g.section.d },
57527
+ meta: { sheet: sheetId, ...g.label ? { label: g.label } : {} }
57528
+ });
57529
+ } else {
57530
+ elements.push({
57531
+ id: g.id ?? gid,
57532
+ group: key,
57533
+ kind: "extrusion",
57534
+ footprint: g.footprint.map((p) => map(p)),
57535
+ from: Math.min(zr.z[0], zr.z[1]),
57536
+ to: Math.max(zr.z[0], zr.z[1]),
57537
+ meta: { sheet: sheetId, ...g.label ? { label: g.label } : {} }
57538
+ });
57434
57539
  }
57435
- elements.push({ id: m.id, group: profile, kind: "box", from, to, section: { w: dims.w, d: dims.d }, meta: { profile }, ...typeof m.rot === "number" ? { rot: -m.rot } : {} });
57436
57540
  }
57437
57541
  }
57438
- const allProfiles = (contract.plans ?? []).flatMap((pl2) => (pl2.members ?? []).map((m) => (m.profile ?? "").trim().toUpperCase())).filter(Boolean);
57439
- const paletteRank = [.../* @__PURE__ */ new Set([...allProfiles, ...Object.keys(contract.weights ?? {}).map((k) => k.trim().toUpperCase())])].sort();
57440
- const groups = profileOrder.map((profile) => ({
57441
- key: profile,
57442
- label: profile,
57443
- color: pickColor(profile, paletteRank.indexOf(profile), contract)
57444
- }));
57445
- const joints = expandJoints(contract.joints, memberGeo);
57446
- for (const part of joints.elements) elements.push(part);
57447
- for (const g of joints.groups) groups.push(g);
57448
- for (const id of joints.skipped) skipped.push(`joint:${id}`);
57449
- return {
57450
- scene: { meta: { name: contract.title || "Steel Model", units: "mm", up: "z" }, groups, elements },
57451
- skipped
57452
- };
57542
+ const groups = groupKeys.map((key, i) => ({ key, label: key, color: PALETTE[i % PALETTE.length] }));
57543
+ const name = contract.source && typeof contract.source.name === "string" ? String(contract.source.name) : "Reconstructed drawing";
57544
+ return { scene: { meta: { name, units: "mm", up: "z" }, groups, elements }, skipped };
57453
57545
  }
57454
57546
 
57455
57547
  // bom-export.ts
@@ -61890,7 +61982,8 @@ function weightOf(contract, profile) {
61890
61982
  const w = contract.weights;
61891
61983
  if (!w || !profile) return null;
61892
61984
  if (profile in w) return w[profile] ?? null;
61893
- const hit = Object.entries(w).find(([k]) => k.toUpperCase() === profile.toUpperCase());
61985
+ const target = canonProfile(profile);
61986
+ const hit = Object.entries(w).find(([k]) => canonProfile(k) === target);
61894
61987
  return hit ? hit[1] ?? null : null;
61895
61988
  }
61896
61989
  var isMfMark = (p) => !!p && /(^|[^A-Z])MF($|[^A-Z])/i.test(p);
@@ -66301,7 +66394,7 @@ async function startServer() {
66301
66394
  res.setHeader("Cache-Control", /\.(html|js|css)$/i.test(path) ? "no-cache" : "public, max-age=0");
66302
66395
  }
66303
66396
  });
66304
- const MIN_AWARE = "0.70.0";
66397
+ const MIN_AWARE = "0.89.0";
66305
66398
  const isWin3 = process.platform === "win32";
66306
66399
  const has = (cmd) => {
66307
66400
  try {
@@ -66538,7 +66631,7 @@ async function startServer() {
66538
66631
  const apps = await aware.list();
66539
66632
  return { ok: true, apps: apps.map((a) => ({ ...a, provider: appProvider(a.id), baked: appBaked(a.id), workspace: appWorkspace(a.id), ...appOrigin(a.id) })) };
66540
66633
  });
66541
- app.get("/api/aisc-shapes", async () => ({ ok: true, shapes: Object.keys(aisc_shapes_default), bf: aisc_shapes_default }));
66634
+ app.get("/api/aisc-shapes", async () => ({ ok: true, shapes: Object.keys(aisc_shapes_default), bf: aisc_shapes_default, sections: SECTION_DIMS_IN }));
66542
66635
  app.get("/api/workflows/updates", async () => {
66543
66636
  const apps = await aware.list();
66544
66637
  const installed = [];