@ni/nimble-components 35.2.0 → 35.2.2

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.
Files changed (73) hide show
  1. package/dist/all-components-bundle.js +167 -109
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +154 -89
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/anchor/template.js +4 -4
  6. package/dist/esm/anchor/template.js.map +1 -1
  7. package/dist/esm/anchor-tabs/index.js +2 -0
  8. package/dist/esm/anchor-tabs/index.js.map +1 -1
  9. package/dist/esm/checkbox/template.js +3 -3
  10. package/dist/esm/checkbox/template.js.map +1 -1
  11. package/dist/esm/chip/testing/chip.pageobject.js +1 -1
  12. package/dist/esm/chip/testing/chip.pageobject.js.map +1 -1
  13. package/dist/esm/combobox/index.js +11 -11
  14. package/dist/esm/combobox/index.js.map +1 -1
  15. package/dist/esm/combobox/template.js +1 -1
  16. package/dist/esm/combobox/template.js.map +1 -1
  17. package/dist/esm/dialog/index.js +1 -1
  18. package/dist/esm/dialog/index.js.map +1 -1
  19. package/dist/esm/menu/menu.foundation.js +3 -3
  20. package/dist/esm/menu/menu.foundation.js.map +1 -1
  21. package/dist/esm/menu-button/index.js +2 -2
  22. package/dist/esm/menu-button/index.js.map +1 -1
  23. package/dist/esm/number-field/template.js +3 -3
  24. package/dist/esm/number-field/template.js.map +1 -1
  25. package/dist/esm/rich-text/editor/index.js +1 -1
  26. package/dist/esm/rich-text/editor/index.js.map +1 -1
  27. package/dist/esm/rich-text/editor/models/create-tiptap-editor.js +1 -1
  28. package/dist/esm/rich-text/editor/models/create-tiptap-editor.js.map +1 -1
  29. package/dist/esm/rich-text/editor/testing/rich-text-editor.pageobject.js +1 -3
  30. package/dist/esm/rich-text/editor/testing/rich-text-editor.pageobject.js.map +1 -1
  31. package/dist/esm/rich-text/mention-listbox/index.d.ts +1 -1
  32. package/dist/esm/rich-text/mention-listbox/index.js +3 -3
  33. package/dist/esm/rich-text/mention-listbox/index.js.map +1 -1
  34. package/dist/esm/rich-text/models/markdown-serializer.js +1 -1
  35. package/dist/esm/rich-text/models/markdown-serializer.js.map +1 -1
  36. package/dist/esm/rich-text/models/rich-text-validator.js +1 -1
  37. package/dist/esm/rich-text/models/rich-text-validator.js.map +1 -1
  38. package/dist/esm/select/index.js +11 -15
  39. package/dist/esm/select/index.js.map +1 -1
  40. package/dist/esm/select/template.js +1 -1
  41. package/dist/esm/select/template.js.map +1 -1
  42. package/dist/esm/switch/styles.js +101 -36
  43. package/dist/esm/switch/styles.js.map +1 -1
  44. package/dist/esm/switch/template.js +1 -1
  45. package/dist/esm/switch/template.js.map +1 -1
  46. package/dist/esm/table/index.js +1 -1
  47. package/dist/esm/table/index.js.map +1 -1
  48. package/dist/esm/table/models/array-to-tree.js +6 -10
  49. package/dist/esm/table/models/array-to-tree.js.map +1 -1
  50. package/dist/esm/table/models/keyboard-navigation-manager.js.map +1 -1
  51. package/dist/esm/table/models/selection-managers/selection-manager-base.js +1 -1
  52. package/dist/esm/table/models/selection-managers/selection-manager-base.js.map +1 -1
  53. package/dist/esm/table/models/table-layout-manager.js +1 -1
  54. package/dist/esm/table/models/table-layout-manager.js.map +1 -1
  55. package/dist/esm/table/models/table-validator.js +1 -1
  56. package/dist/esm/table/models/table-validator.js.map +1 -1
  57. package/dist/esm/table-column/duration-text/models/duration-formatter.js +2 -2
  58. package/dist/esm/table-column/duration-text/models/duration-formatter.js.map +1 -1
  59. package/dist/esm/text-area/template.js +1 -1
  60. package/dist/esm/text-area/template.js.map +1 -1
  61. package/dist/esm/text-field/template.js +1 -1
  62. package/dist/esm/text-field/template.js.map +1 -1
  63. package/dist/esm/utilities/models/tracker.js.map +1 -1
  64. package/dist/esm/wafer-map/experimental/worker-renderer.js +1 -2
  65. package/dist/esm/wafer-map/experimental/worker-renderer.js.map +1 -1
  66. package/dist/esm/wafer-map/modules/rendering.js +1 -1
  67. package/dist/esm/wafer-map/modules/rendering.js.map +1 -1
  68. package/dist/esm/wafer-map/modules/wafer-map-validator.js +1 -1
  69. package/dist/esm/wafer-map/modules/wafer-map-validator.js.map +1 -1
  70. package/dist/esm/wafer-map/workers/worker-code.d.ts +1 -1
  71. package/dist/esm/wafer-map/workers/worker-code.js +1 -1
  72. package/dist/esm/wafer-map/workers/worker-code.js.map +1 -1
  73. package/package.json +1 -1
@@ -16696,12 +16696,12 @@
16696
16696
  Whitespace intentionally avoided between tags for inline styles */ ''}<span
16697
16697
  part="start"
16698
16698
  ${ref('startContainer')}
16699
- class="${_x => (definition.start ? 'start' : null)}"
16699
+ class="${_x => (definition.start !== undefined ? 'start' : null)}"
16700
16700
  ><slot
16701
16701
  name="start"
16702
16702
  ${ref('start')}
16703
16703
  @slotchange="${x => x.handleStartContentChange()}">
16704
- ${definition.start || ''}
16704
+ ${definition.start ?? ''}
16705
16705
  </slot
16706
16706
  ></span
16707
16707
  ><span
@@ -16714,12 +16714,12 @@
16714
16714
  ><span
16715
16715
  part="end"
16716
16716
  ${ref('endContainer')}
16717
- class=${_x => (definition.end ? 'end' : null)}
16717
+ class=${_x => (definition.end !== undefined ? 'end' : null)}
16718
16718
  ><slot
16719
16719
  name="end"
16720
16720
  ${ref('end')}
16721
16721
  @slotchange="${x => x.handleEndContentChange()}">
16722
- ${definition.end || ''}
16722
+ ${definition.end ?? ''}
16723
16723
  </slot
16724
16724
  ></span></a></div>`;
16725
16725
 
@@ -19012,6 +19012,8 @@
19012
19012
  tab.style[gridHorizontalProperty] = `${index + 1}`;
19013
19013
  });
19014
19014
  if (firstFocusableTab
19015
+ // False positive. See: https://github.com/typescript-eslint/typescript-eslint/issues/12036
19016
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
19015
19017
  && (!this.activetab || !this.isFocusableElement(this.activetab))) {
19016
19018
  firstFocusableTab.setAttribute('tabindex', '0');
19017
19019
  }
@@ -20592,15 +20594,15 @@ so this becomes the fallback color for the slot */ ''}
20592
20594
  <div part="container" class="container">
20593
20595
  <div part="control" class="control">
20594
20596
  <slot name="checked-indicator">
20595
- ${definition.checkedIndicator || ''}
20597
+ ${definition.checkedIndicator ?? ''}
20596
20598
  </slot>
20597
20599
  <slot name="indeterminate-indicator">
20598
- ${definition.indeterminateIndicator || ''}
20600
+ ${definition.indeterminateIndicator ?? ''}
20599
20601
  </slot>
20600
20602
  </div>
20601
20603
  <label
20602
20604
  part="label"
20603
- class="${x => (x.defaultSlottedNodes?.length
20605
+ class="${x => (x.defaultSlottedNodes?.length > 0
20604
20606
  ? 'label'
20605
20607
  : 'label label__hidden')}"
20606
20608
  >
@@ -21322,7 +21324,7 @@ so this becomes the fallback color for the slot */ ''}
21322
21324
  />
21323
21325
  <div class="indicator" part="indicator" aria-hidden="true">
21324
21326
  <slot name="indicator">
21325
- ${definition.indicator || ''}
21327
+ ${definition.indicator ?? ''}
21326
21328
  </slot>
21327
21329
  </div>
21328
21330
  </slot>
@@ -21455,7 +21457,7 @@ so this becomes the fallback color for the slot */ ''}
21455
21457
  set value(next) {
21456
21458
  const prev = this._value;
21457
21459
  let updatedValue = next;
21458
- if (this.$fastController.isConnected && this.options) {
21460
+ if (this.$fastController.isConnected) {
21459
21461
  const selectedIndex = this.findIndexOfValidOption(next);
21460
21462
  const prevSelectedValue = this.options[this.selectedIndex]?.text;
21461
21463
  const nextSelectedValue = this.options[selectedIndex]?.text;
@@ -21481,7 +21483,7 @@ so this becomes the fallback color for the slot */ ''}
21481
21483
  */
21482
21484
  get options() {
21483
21485
  Observable.track(this, 'options');
21484
- return this.filteredOptions && this.filter
21486
+ return this.filter
21485
21487
  ? this.filteredOptions
21486
21488
  : this._options;
21487
21489
  }
@@ -21595,12 +21597,12 @@ so this becomes the fallback color for the slot */ ''}
21595
21597
  if (!this.isAutocompleteInline) {
21596
21598
  this.selectedIndex = this.findIndexOfValidOption(this.control.value);
21597
21599
  }
21598
- if (!e.inputType.includes('deleteContent') && this.filter.length) {
21600
+ if (!e.inputType.includes('deleteContent') && this.filter.length > 0) {
21599
21601
  if (this.isAutocompleteList && !this.open) {
21600
21602
  this.open = true;
21601
21603
  }
21602
21604
  if (this.isAutocompleteInline) {
21603
- if (this.filteredOptions.length) {
21605
+ if (this.filteredOptions.length > 0) {
21604
21606
  this.selectedOptions = [this.filteredOptions[0]];
21605
21607
  this.selectedIndex = this.options.indexOf(this.firstSelectedOption);
21606
21608
  this.setInlineSelection();
@@ -21739,11 +21741,11 @@ so this becomes the fallback color for the slot */ ''}
21739
21741
  * Overrides `Listbox.setDefaultSelectedOption`
21740
21742
  */
21741
21743
  setDefaultSelectedOption() {
21742
- if (this.$fastController.isConnected && this.options) {
21744
+ if (this.$fastController.isConnected) {
21743
21745
  const selectedIndex = this.options.findIndex(el => !el.disabled
21744
21746
  && (el.getAttribute('selected') !== null || el.selected));
21745
21747
  this.selectedIndex = selectedIndex;
21746
- if (!this.dirtyValue && this.firstSelectedOption) {
21748
+ if (!this.dirtyValue && this.firstSelectedOption !== null) {
21747
21749
  this.value = this.firstSelectedOption.text;
21748
21750
  }
21749
21751
  this.setSelectedOptions();
@@ -21860,7 +21862,7 @@ so this becomes the fallback color for the slot */ ''}
21860
21862
  if (this.open) {
21861
21863
  if (this.contains(document.activeElement)) {
21862
21864
  this.control.focus();
21863
- if (this.firstSelectedOption) {
21865
+ if (this.firstSelectedOption !== null) {
21864
21866
  requestAnimationFrame(() => {
21865
21867
  this.firstSelectedOption?.scrollIntoView({
21866
21868
  block: 'nearest'
@@ -21921,12 +21923,12 @@ so this becomes the fallback color for the slot */ ''}
21921
21923
  this.setPositioning();
21922
21924
  }
21923
21925
  regionChanged(_prev, _next) {
21924
- if (this.region && this.controlWrapper) {
21926
+ if (this.region) {
21925
21927
  this.region.anchorElement = this.controlWrapper;
21926
21928
  }
21927
21929
  }
21928
21930
  controlWrapperChanged(_prev, _next) {
21929
- if (this.region && this.controlWrapper) {
21931
+ if (this.region) {
21930
21932
  this.region.anchorElement = this.controlWrapper;
21931
21933
  }
21932
21934
  }
@@ -21950,7 +21952,7 @@ so this becomes the fallback color for the slot */ ''}
21950
21952
  * Focus and set the content of the control based on the first selected option.
21951
21953
  */
21952
21954
  setInputToSelection() {
21953
- if (this.firstSelectedOption) {
21955
+ if (this.firstSelectedOption !== null) {
21954
21956
  this.control.value = this.firstSelectedOption.text;
21955
21957
  this.control.focus();
21956
21958
  }
@@ -21959,7 +21961,7 @@ so this becomes the fallback color for the slot */ ''}
21959
21961
  * Focus, set and select the content of the control based on the first selected option.
21960
21962
  */
21961
21963
  setInlineSelection() {
21962
- if (this.firstSelectedOption) {
21964
+ if (this.firstSelectedOption !== null) {
21963
21965
  this.setInputToSelection();
21964
21966
  this.control.setSelectionRange(this.filter.length, this.control.value.length, 'backward');
21965
21967
  }
@@ -22287,7 +22289,7 @@ so this becomes the fallback color for the slot */ ''}
22287
22289
  this.doResolveShow(reason);
22288
22290
  }
22289
22291
  slottedFooterElementsChanged(_prev, next) {
22290
- this.footerIsEmpty = !next?.length;
22292
+ this.footerIsEmpty = next === undefined || next.length === 0;
22291
22293
  }
22292
22294
  /**
22293
22295
  * @internal
@@ -26281,7 +26283,7 @@ so this becomes the fallback color for the slot */ ''}
26281
26283
  // closing an expanded item without opening another
26282
26284
  if (this.expandedItem !== null
26283
26285
  && changedItem === this.expandedItem
26284
- && changedItem.expanded === false) {
26286
+ && !changedItem.expanded) {
26285
26287
  this.expandedItem = null;
26286
26288
  return;
26287
26289
  }
@@ -26310,7 +26312,7 @@ so this becomes the fallback color for the slot */ ''}
26310
26312
  this.menuItems = newItems;
26311
26313
  const menuItems = this.menuItems.filter(this.isMenuItemElement);
26312
26314
  // if our focus index is not -1 we have items
26313
- if (menuItems.length) {
26315
+ if (menuItems.length > 0) {
26314
26316
  this.focusIndex = 0;
26315
26317
  }
26316
26318
  function elementIndent(el) {
@@ -26353,7 +26355,7 @@ so this becomes the fallback color for the slot */ ''}
26353
26355
  return;
26354
26356
  }
26355
26357
  if (changedMenuItem.role === 'menuitemradio'
26356
- && changedMenuItem.checked === true) {
26358
+ && changedMenuItem.checked) {
26357
26359
  for (let i = changeItemIndex - 1; i >= 0; --i) {
26358
26360
  const item = this.menuItems[i];
26359
26361
  const role = item.getAttribute('role');
@@ -26819,7 +26821,7 @@ so this becomes the fallback color for the slot */ ''}
26819
26821
  // Get the menu that is slotted within the menu-button, taking into account
26820
26822
  // that it may be nested within multiple 'slot' elements, such as when used
26821
26823
  // within a table.
26822
- if (!this.slottedMenus?.length) {
26824
+ if (!this.slottedMenus || this.slottedMenus.length === 0) {
26823
26825
  return undefined;
26824
26826
  }
26825
26827
  let currentItem = this.slottedMenus[0];
@@ -26850,7 +26852,7 @@ so this becomes the fallback color for the slot */ ''}
26850
26852
  }
26851
26853
  focusLastMenuItem() {
26852
26854
  const menuItems = this.getMenu()?.querySelectorAll('[role=menuitem]');
26853
- if (menuItems?.length) {
26855
+ if (menuItems && menuItems.length > 0) {
26854
26856
  const lastMenuItem = menuItems[menuItems.length - 1];
26855
26857
  lastMenuItem.focus();
26856
26858
  }
@@ -27227,7 +27229,7 @@ so this becomes the fallback color for the slot */ ''}
27227
27229
  const labelTemplate$4 = createRequiredVisibleLabelTemplate(html `<label
27228
27230
  part="label"
27229
27231
  for="control"
27230
- class="${x => (x.defaultSlottedNodes?.length ? 'label' : 'label label__hidden')}"
27232
+ class="${x => (x.defaultSlottedNodes?.length > 0 ? 'label' : 'label label__hidden')}"
27231
27233
  >
27232
27234
  <slot ${slotted('defaultSlottedNodes')}></slot>
27233
27235
  </label>`);
@@ -27292,7 +27294,7 @@ so this becomes the fallback color for the slot */ ''}
27292
27294
  @click="${x => x.stepUp()}"
27293
27295
  >
27294
27296
  <slot name="step-up-glyph">
27295
- ${definition.stepUpGlyph || ''}
27297
+ ${definition.stepUpGlyph ?? ''}
27296
27298
  </slot>
27297
27299
  </div>
27298
27300
  <div
@@ -27301,7 +27303,7 @@ so this becomes the fallback color for the slot */ ''}
27301
27303
  @click="${x => x.stepDown()}"
27302
27304
  >
27303
27305
  <slot name="step-down-glyph">
27304
- ${definition.stepDownGlyph || ''}
27306
+ ${definition.stepDownGlyph ?? ''}
27305
27307
  </slot>
27306
27308
  </div>
27307
27309
  </div>
@@ -46951,7 +46953,7 @@ ${renderedContent}
46951
46953
  */
46952
46954
  get options() {
46953
46955
  Observable.track(this, 'options');
46954
- return this.filteredOptions?.length ? this.filteredOptions : [];
46956
+ return this.filteredOptions?.length > 0 ? this.filteredOptions : [];
46955
46957
  }
46956
46958
  set options(value) {
46957
46959
  this._options = value;
@@ -47021,7 +47023,7 @@ ${renderedContent}
47021
47023
  this._options.forEach(o => {
47022
47024
  o.hidden = !this.filteredOptions.includes(o);
47023
47025
  });
47024
- if (this.filteredOptions.length) {
47026
+ if (this.filteredOptions.length > 0) {
47025
47027
  this.selectedOptions = [this.filteredOptions[0]];
47026
47028
  this.selectedIndex = this.options.indexOf(this.firstSelectedOption);
47027
47029
  }
@@ -47111,7 +47113,7 @@ ${renderedContent}
47111
47113
  * Overrides: `Listbox.focusAndScrollOptionIntoView`
47112
47114
  */
47113
47115
  focusAndScrollOptionIntoView() {
47114
- if (this.open && this.firstSelectedOption) {
47116
+ if (this.open && this.firstSelectedOption !== null) {
47115
47117
  requestAnimationFrame(() => {
47116
47118
  this.firstSelectedOption?.scrollIntoView({ block: 'nearest' });
47117
47119
  });
@@ -56909,7 +56911,7 @@ ${renderedContent}
56909
56911
  * https://github.com/ProseMirror/prosemirror-markdown/blob/b7c1fd2fb74c7564bfe5428c7c8141ded7ebdd9f/src/to_markdown.ts#L94C2-L101C7
56910
56912
  */
56911
56913
  const orderedListNode = function orderedList(state, node) {
56912
- const start = node.attrs.start || 1;
56914
+ const start = node.attrs.start ?? 1;
56913
56915
  const maxW = String(start + node.childCount - 1).length;
56914
56916
  const space = state.repeat(' ', maxW + 2);
56915
56917
  state.renderList(node, space, i => {
@@ -57280,7 +57282,7 @@ ${renderedContent}
57280
57282
  };
57281
57283
  }
57282
57284
  isValid() {
57283
- return Object.values(this.getValidity()).every(x => x === false);
57285
+ return Object.values(this.getValidity()).every(x => !x);
57284
57286
  }
57285
57287
  validate(mentions) {
57286
57288
  this.validateDuplicateMentionConfigurations(mentions);
@@ -63023,7 +63025,7 @@ ${nextLine.slice(indentLevel + 2)}`;
63023
63025
  const updatedNodes = [];
63024
63026
  fragment.forEach(node => {
63025
63027
  if (node.isText && node.marks.length > 0) {
63026
- const linkMark = node.marks.find(mark => mark.type.name === 'link' && mark.attrs);
63028
+ const linkMark = node.marks.find(mark => mark.type.name === 'link');
63027
63029
  if (linkMark) {
63028
63030
  // Checks if the link is valid link or not
63029
63031
  // Needing to separately validate the link on paste is a workaround for a tiptap issue
@@ -63148,7 +63150,7 @@ ${nextLine.slice(indentLevel + 2)}`;
63148
63150
  if (node.type.name.startsWith(mentionPluginPrefix)) {
63149
63151
  hasMention = true;
63150
63152
  }
63151
- const continueDescent = hasMention === false;
63153
+ const continueDescent = !hasMention;
63152
63154
  return continueDescent;
63153
63155
  });
63154
63156
  return !hasMention;
@@ -64212,7 +64214,7 @@ ${nextLine.slice(indentLevel + 2)}`;
64212
64214
  `)}
64213
64215
  <div aria-hidden="true" class="indicator" part="indicator">
64214
64216
  <slot name="indicator">
64215
- ${definition.indicator || ''}
64217
+ ${definition.indicator ?? ''}
64216
64218
  </slot>
64217
64219
  </div>
64218
64220
  </slot>
@@ -64404,7 +64406,7 @@ ${nextLine.slice(indentLevel + 2)}`;
64404
64406
  set value(next) {
64405
64407
  const prev = this._value;
64406
64408
  let newValue = next;
64407
- if (this.options?.length) {
64409
+ if (this.options !== undefined && this.options.length > 0) {
64408
64410
  const newValueIndex = this.options.findIndex(el => el.value === newValue);
64409
64411
  const prevSelectedValue = this.options[this.selectedIndex]?.value ?? null;
64410
64412
  const nextSelectedValue = this.options[newValueIndex]?.value ?? null;
@@ -64433,7 +64435,7 @@ ${nextLine.slice(indentLevel + 2)}`;
64433
64435
  * @internal
64434
64436
  */
64435
64437
  anchoredRegionChanged(_prev, _next) {
64436
- if (this.anchoredRegion && this.control) {
64438
+ if (this.anchoredRegion !== undefined && this.control !== undefined) {
64437
64439
  this.anchoredRegion.anchorElement = this.control;
64438
64440
  }
64439
64441
  }
@@ -64441,7 +64443,7 @@ ${nextLine.slice(indentLevel + 2)}`;
64441
64443
  * @internal
64442
64444
  */
64443
64445
  controlChanged(_prev, _next) {
64444
- if (this.anchoredRegion && this.control) {
64446
+ if (this.anchoredRegion !== undefined && this.control !== undefined) {
64445
64447
  this.anchoredRegion.anchorElement = this.control;
64446
64448
  }
64447
64449
  }
@@ -64598,9 +64600,7 @@ ${nextLine.slice(indentLevel + 2)}`;
64598
64600
  */
64599
64601
  multipleChanged(prev, next) {
64600
64602
  super.multipleChanged(prev, next);
64601
- if (this.proxy) {
64602
- this.proxy.multiple = next;
64603
- }
64603
+ this.proxy.multiple = next;
64604
64604
  }
64605
64605
  /**
64606
64606
  * @internal
@@ -64657,7 +64657,7 @@ ${nextLine.slice(indentLevel + 2)}`;
64657
64657
  if (this.filterMode !== FilterMode.none) {
64658
64658
  this.emitFilterInputEvent();
64659
64659
  }
64660
- if (e.inputType.includes('deleteContent') || !this.filter.length) {
64660
+ if (e.inputType.includes('deleteContent') || this.filter.length === 0) {
64661
64661
  return true;
64662
64662
  }
64663
64663
  e.stopPropagation();
@@ -64826,7 +64826,7 @@ ${nextLine.slice(indentLevel + 2)}`;
64826
64826
  typeaheadBufferChanged(_, __) {
64827
64827
  if (this.$fastController.isConnected) {
64828
64828
  const typeaheadMatches = this.getTypeaheadMatches();
64829
- if (typeaheadMatches.length) {
64829
+ if (typeaheadMatches.length > 0) {
64830
64830
  const activeOptionIndex = this.options.indexOf(typeaheadMatches[0]);
64831
64831
  if (!(this.open && this.filterMode !== FilterMode.none)) {
64832
64832
  this.setActiveOption(activeOptionIndex);
@@ -64959,9 +64959,7 @@ ${nextLine.slice(indentLevel + 2)}`;
64959
64959
  */
64960
64960
  sizeChanged(prev, next) {
64961
64961
  super.sizeChanged(prev, next);
64962
- if (this.proxy) {
64963
- this.proxy.size = next;
64964
- }
64962
+ this.proxy.size = next;
64965
64963
  }
64966
64964
  openChanged() {
64967
64965
  if (!this.collapsible) {
@@ -65266,14 +65264,14 @@ ${nextLine.slice(indentLevel + 2)}`;
65266
65264
  * @internal
65267
65265
  */
65268
65266
  setProxyOptions() {
65269
- if (this.proxy instanceof HTMLSelectElement && this.options) {
65267
+ if (this.proxy instanceof HTMLSelectElement && this.options !== null) {
65270
65268
  this.proxy.options.length = 0;
65271
65269
  this.options.forEach(option => {
65272
65270
  const proxyOption = option.proxy
65273
- || (option instanceof HTMLOptionElement
65271
+ ?? (option instanceof HTMLOptionElement
65274
65272
  ? option.cloneNode()
65275
65273
  : null);
65276
- if (proxyOption) {
65274
+ if (proxyOption !== null) {
65277
65275
  this.proxy.options.add(proxyOption);
65278
65276
  }
65279
65277
  });
@@ -65301,7 +65299,7 @@ ${nextLine.slice(indentLevel + 2)}`;
65301
65299
  return;
65302
65300
  }
65303
65301
  const selectedOption = this.firstSelectedOption;
65304
- if (selectedOption) {
65302
+ if (selectedOption !== null) {
65305
65303
  this.selectedOptionObserver?.observe(selectedOption, {
65306
65304
  characterData: true,
65307
65305
  subtree: true,
@@ -65440,7 +65438,9 @@ ${nextLine.slice(indentLevel + 2)}`;
65440
65438
  flex-direction: column;
65441
65439
  cursor: pointer;
65442
65440
  --ni-private-switch-height: 24px;
65443
- --ni-private-switch-indicator-size: 16px;
65441
+ --ni-private-switch-indicator-size: 24px;
65442
+ --ni-private-switch-indicator-inner-size: 18px;
65443
+ --ni-private-switch-indicator-margin: -2px;
65444
65444
  padding-bottom: calc(
65445
65445
  ${controlHeight} - var(--ni-private-switch-height)
65446
65446
  );
@@ -65478,20 +65478,36 @@ ${nextLine.slice(indentLevel + 2)}`;
65478
65478
  display: flex;
65479
65479
  height: var(--ni-private-switch-height);
65480
65480
  width: calc(var(--ni-private-switch-height) * 2);
65481
- background-color: ${fillHoverColor};
65481
+ background-color: var(--ni-private-switch-background-color);
65482
65482
  border-radius: calc(var(--ni-private-switch-height) / 2);
65483
65483
  align-items: center;
65484
- border: calc(${borderWidth} * 2) solid transparent;
65484
+ border: calc(${borderWidth}) solid transparent;
65485
65485
  }
65486
65486
 
65487
- :host([disabled]) .switch {
65488
- background-color: var(--ni-private-switch-background-disabled-color);
65487
+ :host([aria-checked='true']) .switch {
65488
+ background-color: var(--ni-private-switch-background-selected-color);
65489
+ }
65490
+
65491
+ :host([aria-checked='true']:hover) .switch {
65492
+ background-color: var(--ni-private-switch-background-selected-rollover-color);
65489
65493
  }
65490
65494
 
65491
65495
  :host(${focusVisible}) .switch {
65492
65496
  border-color: ${borderHoverColor};
65493
65497
  }
65494
65498
 
65499
+ :host(${focusVisible}[aria-checked='true']) .switch {
65500
+ background-color: var(--ni-private-switch-background-selected-rollover-color);
65501
+ }
65502
+
65503
+ :host([disabled]) .switch {
65504
+ background-color: var(--ni-private-switch-background-disabled-color);
65505
+ }
65506
+
65507
+ :host([disabled]:hover) .switch {
65508
+ background-color: var(--ni-private-switch-background-disabled-color);
65509
+ }
65510
+
65495
65511
  .checked-indicator-spacer {
65496
65512
  flex-grow: 0;
65497
65513
  transition: flex-grow ${smallDelay} ease-in-out;
@@ -65509,51 +65525,81 @@ ${nextLine.slice(indentLevel + 2)}`;
65509
65525
  width: var(--ni-private-switch-indicator-size);
65510
65526
  height: var(--ni-private-switch-indicator-size);
65511
65527
  border-radius: calc(var(--ni-private-switch-indicator-size) / 2);
65512
- margin: calc(
65513
- calc(
65514
- var(--ni-private-switch-height) - var(
65515
- --ni-private-switch-indicator-size
65516
- )
65517
- ) /
65518
- 2
65519
- );
65528
+ margin: var(--ni-private-switch-indicator-margin);
65520
65529
  border: ${borderWidth} solid
65521
65530
  var(--ni-private-switch-indicator-border-color);
65522
65531
  }
65523
65532
 
65533
+ :host([aria-checked='true']) .checked-indicator {
65534
+ border-color: var(--ni-private-switch-indicator-border-selected-color);
65535
+ }
65536
+
65524
65537
  :host(:hover) .checked-indicator {
65525
65538
  border: calc(${borderWidth} * 2) solid ${borderHoverColor};
65526
65539
  }
65527
65540
 
65541
+ :host(${focusVisible}) .checked-indicator {
65542
+ border: calc(${borderWidth} * 2) solid ${borderHoverColor};
65543
+ }
65544
+
65528
65545
  :host([disabled]) .checked-indicator {
65529
- background-color: var(
65530
- --ni-private-switch-indicator-background-disabled-color
65531
- );
65546
+ background-color: transparent;
65532
65547
  border: ${borderWidth} solid
65533
65548
  var(--ni-private-switch-indicator-border-disabled-color);
65534
65549
  }
65535
65550
 
65536
- :host(${focusVisible}) .checked-indicator {
65537
- border: ${borderWidth} solid ${borderHoverColor};
65551
+ :host([disabled]:hover) .checked-indicator {
65552
+ background-color: transparent;
65553
+ border: ${borderWidth} solid
65554
+ var(--ni-private-switch-indicator-border-disabled-color);
65538
65555
  }
65539
65556
 
65540
- .checked-indicator-inner {
65541
- width: calc(var(--ni-private-switch-indicator-size) / 2);
65542
- height: calc(var(--ni-private-switch-indicator-size) / 2);
65543
- border-radius: calc(var(--ni-private-switch-indicator-size) / 4);
65544
- background-color: var(--ni-private-switch-indicator-border-color);
65557
+ :host([disabled]${focusVisible}) .checked-indicator {
65558
+ background-color: transparent;
65559
+ border: ${borderWidth} solid
65560
+ var(--ni-private-switch-indicator-border-disabled-color);
65561
+ }
65562
+
65563
+ :host([disabled]:active) .checked-indicator-inner {
65564
+ background-color: var(
65565
+ --ni-private-switch-indicator-border-disabled-color
65566
+ );
65545
65567
  opacity: 0;
65546
- transition: opacity ${smallDelay} ease-in-out;
65547
65568
  }
65548
65569
 
65549
- :host([disabled]) .checked-indicator-inner {
65570
+ :host([disabled]${focusVisible}) .checked-indicator-inner {
65550
65571
  background-color: var(
65551
65572
  --ni-private-switch-indicator-border-disabled-color
65552
65573
  );
65574
+ opacity: 0;
65575
+ }
65576
+
65577
+ .checked-indicator-inner {
65578
+ width: var(--ni-private-switch-indicator-inner-size);
65579
+ height: var(--ni-private-switch-indicator-inner-size);
65580
+ border-radius: calc(var(--ni-private-switch-indicator-inner-size) / 2);
65581
+ opacity: 0;
65553
65582
  }
65554
65583
 
65555
65584
  :host([aria-checked='true']) .checked-indicator-inner {
65585
+ opacity: 0;
65586
+ }
65587
+
65588
+ :host(${focusVisible}) .checked-indicator-inner {
65589
+ opacity: 1;
65590
+ background-color: var(--ni-private-switch-indicator-background-color);
65591
+ border: 1px solid var(--ni-private-switch-indicator-border-selected-color);
65592
+ }
65593
+
65594
+ :host(:active) .checked-indicator-inner {
65556
65595
  opacity: 1;
65596
+ background-color: var(--ni-private-switch-indicator-background-active-color);
65597
+ }
65598
+
65599
+ :host([disabled]) .checked-indicator-inner {
65600
+ background-color: var(
65601
+ --ni-private-switch-indicator-border-disabled-color
65602
+ );
65557
65603
  }
65558
65604
 
65559
65605
  slot[name='checked-message']::slotted(*) {
@@ -65568,26 +65614,43 @@ ${nextLine.slice(indentLevel + 2)}`;
65568
65614
  }
65569
65615
  `.withBehaviors(themeBehavior(Theme.light, css `
65570
65616
  :host {
65617
+ --ni-private-switch-background-color: ${hexToRgbaCssColor(Black91, 0.1)};
65571
65618
  --ni-private-switch-background-disabled-color: ${hexToRgbaCssColor(Black91, 0.07)};
65619
+ --ni-private-switch-background-selected-color: ${hexToRgbaCssColor(DigitalGreenLight, 0.6)};
65620
+ --ni-private-switch-background-selected-rollover-color: ${hexToRgbaCssColor(DigitalGreenLight, 0.3)};
65572
65621
  --ni-private-switch-indicator-background-color: ${White};
65573
- --ni-private-switch-indicator-background-disabled-color: ${hexToRgbaCssColor(White, 0.1)};
65574
- --ni-private-switch-indicator-border-color: ${Black91};
65575
- --ni-private-switch-indicator-border-disabled-color: ${hexToRgbaCssColor(Black91, 0.3)};
65622
+ --ni-private-switch-indicator-background-disabled-color: ${hexToRgbaCssColor(Black91, 0.15)};
65623
+ --ni-private-switch-indicator-background-active-color: ${hexToRgbaCssColor(DigitalGreenLight, 0.3)};
65624
+
65625
+ --ni-private-switch-indicator-border-color: ${hexToRgbaCssColor(Black91, 0.3)};
65626
+ --ni-private-switch-indicator-border-selected-color: ${DigitalGreenLight};
65627
+ --ni-private-switch-indicator-border-disabled-color: ${hexToRgbaCssColor(Black91, 0.15)};
65628
+
65576
65629
  }
65577
65630
  `), themeBehavior(Theme.dark, css `
65578
65631
  :host {
65632
+ --ni-private-switch-background-color: ${hexToRgbaCssColor(Black15, 0.1)};
65579
65633
  --ni-private-switch-background-disabled-color: ${hexToRgbaCssColor(Black15, 0.07)};
65580
- --ni-private-switch-indicator-background-color: ${hexToRgbaCssColor(Black91, 0.3)};
65581
- --ni-private-switch-indicator-background-disabled-color: ${hexToRgbaCssColor(Black91, 0.1)};
65582
- --ni-private-switch-indicator-border-color: ${Black7};
65583
- --ni-private-switch-indicator-border-disabled-color: ${hexToRgbaCssColor(Black7, 0.3)};
65634
+ --ni-private-switch-background-selected-color: ${hexToRgbaCssColor(PowerGreen, 0.6)};
65635
+ --ni-private-switch-background-selected-rollover-color: ${hexToRgbaCssColor(PowerGreen, 0.3)};
65636
+ --ni-private-switch-indicator-background-color: ${Black75};
65637
+ --ni-private-switch-indicator-background-disabled-color: ${hexToRgbaCssColor(Black15, 0.1)};
65638
+ --ni-private-switch-indicator-background-active-color: ${hexToRgbaCssColor(PowerGreen, 0.3)};
65639
+ --ni-private-switch-indicator-border-color: ${hexToRgbaCssColor(Black15, 0.3)};
65640
+ --ni-private-switch-indicator-border-selected-color: ${PowerGreen};
65641
+ --ni-private-switch-indicator-border-disabled-color: ${hexToRgbaCssColor(Black15, 0.15)};
65584
65642
  }
65585
65643
  `), themeBehavior(Theme.color, css `
65586
65644
  :host {
65645
+ --ni-private-switch-background-color: ${hexToRgbaCssColor(White, 0.1)};
65587
65646
  --ni-private-switch-background-disabled-color: ${hexToRgbaCssColor(White, 0.07)};
65588
- --ni-private-switch-indicator-background-color: ${hexToRgbaCssColor(White, 0.1)};
65647
+ --ni-private-switch-background-selected-color: ${hexToRgbaCssColor(White, 0.6)};
65648
+ --ni-private-switch-background-selected-rollover-color: ${hexToRgbaCssColor(White, 0.3)};
65649
+ --ni-private-switch-indicator-background-color: ${hexToRgbaCssColor(White, 0.3)};
65589
65650
  --ni-private-switch-indicator-background-disabled-color: ${hexToRgbaCssColor(White, 0.1)};
65590
- --ni-private-switch-indicator-border-color: ${White};
65651
+ --ni-private-switch-indicator-background-active-color: ${hexToRgbaCssColor(White, 0.3)};
65652
+ --ni-private-switch-indicator-border-color: ${hexToRgbaCssColor(White, 0.3)};
65653
+ --ni-private-switch-indicator-border-selected-color: ${White} ;
65591
65654
  --ni-private-switch-indicator-border-disabled-color: ${hexToRgbaCssColor(White, 0.3)};
65592
65655
  }
65593
65656
  `));
@@ -65605,7 +65668,7 @@ ${nextLine.slice(indentLevel + 2)}`;
65605
65668
  >
65606
65669
  <label
65607
65670
  part="label"
65608
- class="${x => (x.defaultSlottedNodes?.length ? 'label' : 'label label__hidden')}"
65671
+ class="${x => (x.defaultSlottedNodes?.length > 0 ? 'label' : 'label label__hidden')}"
65609
65672
  >
65610
65673
  <slot ${slotted('defaultSlottedNodes')}></slot>
65611
65674
  </label>
@@ -69407,7 +69470,7 @@ ${nextLine.slice(indentLevel + 2)}`;
69407
69470
  };
69408
69471
  }
69409
69472
  isValid() {
69410
- return Object.values(this.getValidity()).every(x => x === false);
69473
+ return Object.values(this.getValidity()).every(x => !x);
69411
69474
  }
69412
69475
  areRecordIdsValid() {
69413
69476
  const validity = this.getValidity();
@@ -72134,7 +72197,7 @@ focus outline in that case.
72134
72197
  return this.getVisibleColumns()
72135
72198
  .map(column => {
72136
72199
  const { minPixelWidth, currentPixelWidth, currentFractionalWidth } = column.columnInternals;
72137
- if (currentPixelWidth) {
72200
+ if (currentPixelWidth !== undefined) {
72138
72201
  const coercedPixelWidth = Math.max(minPixelWidth, currentPixelWidth);
72139
72202
  return `${coercedPixelWidth}px`;
72140
72203
  }
@@ -72596,7 +72659,7 @@ focus outline in that case.
72596
72659
  const allRows = [];
72597
72660
  for (const row of topLevelRows) {
72598
72661
  allRows.push(row);
72599
- if (row.subRows?.length) {
72662
+ if (row.subRows?.length > 0) {
72600
72663
  allRows.push(...this.getOrderedRows(row.subRows));
72601
72664
  }
72602
72665
  }
@@ -72851,10 +72914,8 @@ focus outline in that case.
72851
72914
  originalIndex: undefined
72852
72915
  };
72853
72916
  }
72854
- // if we track orphans, delete this item from the orphan set if it is in it
72855
- if (orphanIds) {
72856
- orphanIds.delete(itemId);
72857
- }
72917
+ // delete this item from the orphan set if it is in it
72918
+ orphanIds.delete(itemId);
72858
72919
  // add the current item's data to the item in the lookup table
72859
72920
  lookup[itemId].clientRecord = item;
72860
72921
  const treeItem = lookup[itemId];
@@ -72874,16 +72935,14 @@ focus outline in that case.
72874
72935
  clientRecord: undefined,
72875
72936
  originalIndex: undefined
72876
72937
  };
72877
- // if we track orphans, add the generated parent to the orphan list
72878
- if (orphanIds) {
72879
- orphanIds.add(parentId);
72880
- }
72938
+ // add the generated parent to the orphan list
72939
+ orphanIds.add(parentId);
72881
72940
  }
72882
72941
  // add the current item to the parent
72883
72942
  lookup[parentId].subRows.push(treeItem);
72884
72943
  }
72885
72944
  }
72886
- if (orphanIds?.size) {
72945
+ if (orphanIds.size > 0) {
72887
72946
  const orphans = Array.from(orphanIds.values()).join(',');
72888
72947
  throw new Error(`The items array contains orphans that point to the following parentIds: [${orphans}]. These parentIds do not exist in the items array.`);
72889
72948
  }
@@ -72898,7 +72957,7 @@ focus outline in that case.
72898
72957
  * @returns Number of nodes in the tree
72899
72958
  */
72900
72959
  function countNodes(tree) {
72901
- return tree.reduce((sum, n) => sum + 1 + (n.subRows && countNodes(n.subRows)), 0);
72960
+ return tree.reduce((sum, n) => sum + 1 + (n.subRows ? countNodes(n.subRows) : 0), 0);
72902
72961
  }
72903
72962
 
72904
72963
  /**
@@ -74964,7 +75023,7 @@ focus outline in that case.
74964
75023
  calculateTanStackSortState() {
74965
75024
  const sortedColumns = this.getColumnsParticipatingInSorting().sort((x, y) => x.columnInternals.currentSortIndex
74966
75025
  - y.columnInternals.currentSortIndex);
74967
- this.firstSortedColumn = sortedColumns.length
75026
+ this.firstSortedColumn = sortedColumns.length > 0
74968
75027
  ? sortedColumns[0]
74969
75028
  : undefined;
74970
75029
  return sortedColumns.map(column => {
@@ -76168,13 +76227,13 @@ focus outline in that case.
76168
76227
  }
76169
76228
  const hours = Math.floor((milliseconds / millisecondsPerHour) % 24);
76170
76229
  remainingTime -= hours * millisecondsPerHour;
76171
- if (hours) {
76230
+ if (hours !== 0) {
76172
76231
  const formattedHours = this.hoursFormatter.format(hours);
76173
76232
  result.push(formattedHours);
76174
76233
  }
76175
76234
  const minutes = Math.floor((milliseconds / millisecondsPerMinute) % 60);
76176
76235
  remainingTime -= minutes * millisecondsPerMinute;
76177
- if (minutes) {
76236
+ if (minutes !== 0) {
76178
76237
  const formattedMinutes = this.minutesFormatter.format(minutes);
76179
76238
  result.push(formattedMinutes);
76180
76239
  }
@@ -78024,7 +78083,7 @@ focus outline in that case.
78024
78083
  <label
78025
78084
  part="label"
78026
78085
  for="control"
78027
- class="${x => (x.defaultSlottedNodes?.length ? 'label' : 'label label__hidden')}"
78086
+ class="${x => (x.defaultSlottedNodes?.length > 0 ? 'label' : 'label label__hidden')}"
78028
78087
  >
78029
78088
  <slot ${slotted('defaultSlottedNodes')}></slot>
78030
78089
  </label>
@@ -78459,7 +78518,7 @@ focus outline in that case.
78459
78518
  const labelTemplate = createRequiredVisibleLabelTemplate(html `<label
78460
78519
  part="label"
78461
78520
  for="control"
78462
- class="${x => (x.defaultSlottedNodes?.length ? 'label' : 'label label__hidden')}"
78521
+ class="${x => (x.defaultSlottedNodes?.length > 0 ? 'label' : 'label label__hidden')}"
78463
78522
  >
78464
78523
  <slot
78465
78524
  ${slotted({
@@ -95176,7 +95235,7 @@ focus outline in that case.
95176
95235
  }
95177
95236
  const dieWidth = this.wafermap.dataManager.dieDimensions.width;
95178
95237
  const dieHeight = this.wafermap.dataManager.dieDimensions.height;
95179
- const dieSize = dieWidth * dieHeight * (this.wafermap.transform.k || 1);
95238
+ const dieSize = dieWidth * dieHeight * (this.wafermap.transform.k !== 0 ? this.wafermap.transform.k : 1);
95180
95239
  if (dieSize >= this.minDieDim) {
95181
95240
  const fontsize = this.wafermap.dataManager.labelsFontSize;
95182
95241
  const context = this.wafermap.canvasContext;
@@ -95370,7 +95429,7 @@ focus outline in that case.
95370
95429
  };
95371
95430
  }
95372
95431
  isValid() {
95373
- return Object.values(this.getValidity()).every(x => x === false);
95432
+ return Object.values(this.getValidity()).every(x => !x);
95374
95433
  }
95375
95434
  validateGridDimensions() {
95376
95435
  this.invalidGridDimensions = false;
@@ -95765,7 +95824,7 @@ focus outline in that case.
95765
95824
  .join("-");
95766
95825
  }
95767
95826
 
95768
- const workerCode = "var MatrixRenderer = (function (exports) {\n 'use strict';\n\n /**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n const proxyMarker = Symbol(\"Comlink.proxy\");\n const createEndpoint = Symbol(\"Comlink.endpoint\");\n const releaseProxy = Symbol(\"Comlink.releaseProxy\");\n const finalizer = Symbol(\"Comlink.finalizer\");\n const throwMarker = Symbol(\"Comlink.thrown\");\n const isObject = (val) => (typeof val === \"object\" && val !== null) || typeof val === \"function\";\n /**\n * Internal transfer handle to handle objects marked to proxy.\n */\n const proxyTransferHandler = {\n canHandle: (val) => isObject(val) && val[proxyMarker],\n serialize(obj) {\n const { port1, port2 } = new MessageChannel();\n expose(obj, port1);\n return [port2, [port2]];\n },\n deserialize(port) {\n port.start();\n return wrap(port);\n },\n };\n /**\n * Internal transfer handler to handle thrown exceptions.\n */\n const throwTransferHandler = {\n canHandle: (value) => isObject(value) && throwMarker in value,\n serialize({ value }) {\n let serialized;\n if (value instanceof Error) {\n serialized = {\n isError: true,\n value: {\n message: value.message,\n name: value.name,\n stack: value.stack,\n },\n };\n }\n else {\n serialized = { isError: false, value };\n }\n return [serialized, []];\n },\n deserialize(serialized) {\n if (serialized.isError) {\n throw Object.assign(new Error(serialized.value.message), serialized.value);\n }\n throw serialized.value;\n },\n };\n /**\n * Allows customizing the serialization of certain values.\n */\n const transferHandlers = new Map([\n [\"proxy\", proxyTransferHandler],\n [\"throw\", throwTransferHandler],\n ]);\n function isAllowedOrigin(allowedOrigins, origin) {\n for (const allowedOrigin of allowedOrigins) {\n if (origin === allowedOrigin || allowedOrigin === \"*\") {\n return true;\n }\n if (allowedOrigin instanceof RegExp && allowedOrigin.test(origin)) {\n return true;\n }\n }\n return false;\n }\n function expose(obj, ep = globalThis, allowedOrigins = [\"*\"]) {\n ep.addEventListener(\"message\", function callback(ev) {\n if (!ev || !ev.data) {\n return;\n }\n if (!isAllowedOrigin(allowedOrigins, ev.origin)) {\n console.warn(`Invalid origin '${ev.origin}' for comlink proxy`);\n return;\n }\n const { id, type, path } = Object.assign({ path: [] }, ev.data);\n const argumentList = (ev.data.argumentList || []).map(fromWireValue);\n let returnValue;\n try {\n const parent = path.slice(0, -1).reduce((obj, prop) => obj[prop], obj);\n const rawValue = path.reduce((obj, prop) => obj[prop], obj);\n switch (type) {\n case \"GET\" /* MessageType.GET */:\n {\n returnValue = rawValue;\n }\n break;\n case \"SET\" /* MessageType.SET */:\n {\n parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);\n returnValue = true;\n }\n break;\n case \"APPLY\" /* MessageType.APPLY */:\n {\n returnValue = rawValue.apply(parent, argumentList);\n }\n break;\n case \"CONSTRUCT\" /* MessageType.CONSTRUCT */:\n {\n const value = new rawValue(...argumentList);\n returnValue = proxy(value);\n }\n break;\n case \"ENDPOINT\" /* MessageType.ENDPOINT */:\n {\n const { port1, port2 } = new MessageChannel();\n expose(obj, port2);\n returnValue = transfer(port1, [port1]);\n }\n break;\n case \"RELEASE\" /* MessageType.RELEASE */:\n {\n returnValue = undefined;\n }\n break;\n default:\n return;\n }\n }\n catch (value) {\n returnValue = { value, [throwMarker]: 0 };\n }\n Promise.resolve(returnValue)\n .catch((value) => {\n return { value, [throwMarker]: 0 };\n })\n .then((returnValue) => {\n const [wireValue, transferables] = toWireValue(returnValue);\n ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);\n if (type === \"RELEASE\" /* MessageType.RELEASE */) {\n // detach and deactive after sending release response above.\n ep.removeEventListener(\"message\", callback);\n closeEndPoint(ep);\n if (finalizer in obj && typeof obj[finalizer] === \"function\") {\n obj[finalizer]();\n }\n }\n })\n .catch((error) => {\n // Send Serialization Error To Caller\n const [wireValue, transferables] = toWireValue({\n value: new TypeError(\"Unserializable return value\"),\n [throwMarker]: 0,\n });\n ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);\n });\n });\n if (ep.start) {\n ep.start();\n }\n }\n function isMessagePort(endpoint) {\n return endpoint.constructor.name === \"MessagePort\";\n }\n function closeEndPoint(endpoint) {\n if (isMessagePort(endpoint))\n endpoint.close();\n }\n function wrap(ep, target) {\n const pendingListeners = new Map();\n ep.addEventListener(\"message\", function handleMessage(ev) {\n const { data } = ev;\n if (!data || !data.id) {\n return;\n }\n const resolver = pendingListeners.get(data.id);\n if (!resolver) {\n return;\n }\n try {\n resolver(data);\n }\n finally {\n pendingListeners.delete(data.id);\n }\n });\n return createProxy(ep, pendingListeners, [], target);\n }\n function throwIfProxyReleased(isReleased) {\n if (isReleased) {\n throw new Error(\"Proxy has been released and is not useable\");\n }\n }\n function releaseEndpoint(ep) {\n return requestResponseMessage(ep, new Map(), {\n type: \"RELEASE\" /* MessageType.RELEASE */,\n }).then(() => {\n closeEndPoint(ep);\n });\n }\n const proxyCounter = new WeakMap();\n const proxyFinalizers = \"FinalizationRegistry\" in globalThis &&\n new FinalizationRegistry((ep) => {\n const newCount = (proxyCounter.get(ep) || 0) - 1;\n proxyCounter.set(ep, newCount);\n if (newCount === 0) {\n releaseEndpoint(ep);\n }\n });\n function registerProxy(proxy, ep) {\n const newCount = (proxyCounter.get(ep) || 0) + 1;\n proxyCounter.set(ep, newCount);\n if (proxyFinalizers) {\n proxyFinalizers.register(proxy, ep, proxy);\n }\n }\n function unregisterProxy(proxy) {\n if (proxyFinalizers) {\n proxyFinalizers.unregister(proxy);\n }\n }\n function createProxy(ep, pendingListeners, path = [], target = function () { }) {\n let isProxyReleased = false;\n const proxy = new Proxy(target, {\n get(_target, prop) {\n throwIfProxyReleased(isProxyReleased);\n if (prop === releaseProxy) {\n return () => {\n unregisterProxy(proxy);\n releaseEndpoint(ep);\n pendingListeners.clear();\n isProxyReleased = true;\n };\n }\n if (prop === \"then\") {\n if (path.length === 0) {\n return { then: () => proxy };\n }\n const r = requestResponseMessage(ep, pendingListeners, {\n type: \"GET\" /* MessageType.GET */,\n path: path.map((p) => p.toString()),\n }).then(fromWireValue);\n return r.then.bind(r);\n }\n return createProxy(ep, pendingListeners, [...path, prop]);\n },\n set(_target, prop, rawValue) {\n throwIfProxyReleased(isProxyReleased);\n // FIXME: ES6 Proxy Handler `set` methods are supposed to return a\n // boolean. To show good will, we return true asynchronously ¯\\_(ツ)_/¯\n const [value, transferables] = toWireValue(rawValue);\n return requestResponseMessage(ep, pendingListeners, {\n type: \"SET\" /* MessageType.SET */,\n path: [...path, prop].map((p) => p.toString()),\n value,\n }, transferables).then(fromWireValue);\n },\n apply(_target, _thisArg, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const last = path[path.length - 1];\n if (last === createEndpoint) {\n return requestResponseMessage(ep, pendingListeners, {\n type: \"ENDPOINT\" /* MessageType.ENDPOINT */,\n }).then(fromWireValue);\n }\n // We just pretend that `bind()` didn’t happen.\n if (last === \"bind\") {\n return createProxy(ep, pendingListeners, path.slice(0, -1));\n }\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, pendingListeners, {\n type: \"APPLY\" /* MessageType.APPLY */,\n path: path.map((p) => p.toString()),\n argumentList,\n }, transferables).then(fromWireValue);\n },\n construct(_target, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, pendingListeners, {\n type: \"CONSTRUCT\" /* MessageType.CONSTRUCT */,\n path: path.map((p) => p.toString()),\n argumentList,\n }, transferables).then(fromWireValue);\n },\n });\n registerProxy(proxy, ep);\n return proxy;\n }\n function myFlat(arr) {\n return Array.prototype.concat.apply([], arr);\n }\n function processArguments(argumentList) {\n const processed = argumentList.map(toWireValue);\n return [processed.map((v) => v[0]), myFlat(processed.map((v) => v[1]))];\n }\n const transferCache = new WeakMap();\n function transfer(obj, transfers) {\n transferCache.set(obj, transfers);\n return obj;\n }\n function proxy(obj) {\n return Object.assign(obj, { [proxyMarker]: true });\n }\n function toWireValue(value) {\n for (const [name, handler] of transferHandlers) {\n if (handler.canHandle(value)) {\n const [serializedValue, transferables] = handler.serialize(value);\n return [\n {\n type: \"HANDLER\" /* WireValueType.HANDLER */,\n name,\n value: serializedValue,\n },\n transferables,\n ];\n }\n }\n return [\n {\n type: \"RAW\" /* WireValueType.RAW */,\n value,\n },\n transferCache.get(value) || [],\n ];\n }\n function fromWireValue(value) {\n switch (value.type) {\n case \"HANDLER\" /* WireValueType.HANDLER */:\n return transferHandlers.get(value.name).deserialize(value.value);\n case \"RAW\" /* WireValueType.RAW */:\n return value.value;\n }\n }\n function requestResponseMessage(ep, pendingListeners, msg, transfers) {\n return new Promise((resolve) => {\n const id = generateUUID();\n pendingListeners.set(id, resolve);\n if (ep.start) {\n ep.start();\n }\n ep.postMessage(Object.assign({ id }, msg), transfers);\n });\n }\n function generateUUID() {\n return new Array(4)\n .fill(0)\n .map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))\n .join(\"-\");\n }\n\n /**\n * MatrixRenderer class is meant to be used within a Web Worker context,\n * using Comlink to facilitate communication between the main thread and the worker.\n * The MatrixRenderer class manages a matrix of dies, once an instance of MatrixRenderer is created,\n * it is exposed to the main thread using Comlink's `expose` method.\n * This setup is used in the wafer-map component to perform heavy computational duties\n */\n class MatrixRenderer {\n constructor() {\n this.values = Float64Array.from([]);\n this.scaledColumnIndices = Float64Array.from([]);\n this.scaledRowIndices = Float64Array.from([]);\n this.columnIndicesPositions = Int32Array.from([]);\n this.colorIndices = Int32Array.from([]);\n this.colors = [];\n this.colorValues = Float64Array.from([]);\n this.outsideRangeDieColor = 'rgba(218,223,236,1)';\n this.fontSizeFactor = 0.8;\n this.renderConfig = {\n dieDimensions: {\n width: 0,\n height: 0\n },\n margin: {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n },\n verticalCoefficient: 1,\n horizontalCoefficient: 1,\n horizontalConstant: 0,\n verticalConstant: 0,\n gridMinX: 0,\n gridMaxX: 0,\n gridMinY: 0,\n gridMaxY: 0,\n labelsFontSize: 0,\n colorScale: [],\n dieLabelsSuffix: '',\n maxCharacters: 0\n };\n this.transformConfig = {\n transform: {\n k: 1,\n x: 0,\n y: 0\n },\n topLeftCanvasCorner: {\n x: 0,\n y: 0\n },\n bottomRightCanvasCorner: {\n x: 0,\n y: 0\n }\n };\n }\n setMatrixData(columnIndices, rowIndices, valuesBuffer) {\n const scaledColumnIndex = [];\n const columnPositions = [];\n const scaledRowIndices = [];\n const values = [];\n const colorIndices = [];\n let prevXIndex;\n let dieCount = 0;\n for (let i = 0; i < columnIndices.length; i++) {\n const xIndex = columnIndices[i];\n const yIndex = rowIndices[i];\n if (this.isDieInGrid(xIndex, yIndex)) {\n if (xIndex !== prevXIndex) {\n scaledColumnIndex.push(this.calculateHorizontalScaledIndices(xIndex));\n columnPositions.push(dieCount);\n prevXIndex = xIndex;\n }\n scaledRowIndices.push(this.calculateVerticalScaledIndices(yIndex));\n const value = valuesBuffer[i];\n values.push(value);\n colorIndices.push(this.findColorIndex(value));\n dieCount += 1;\n }\n }\n this.scaledColumnIndices = Float64Array.from(scaledColumnIndex);\n this.columnIndicesPositions = Int32Array.from(columnPositions);\n this.scaledRowIndices = Float64Array.from(scaledRowIndices);\n this.values = Float64Array.from(values);\n this.colorIndices = Int32Array.from(colorIndices);\n }\n setRenderConfig(renderConfig) {\n this.renderConfig = renderConfig;\n this.colors = renderConfig.colorScale.map(marker => marker.color);\n this.colorValues = Float64Array.from(renderConfig.colorScale.map(marker => marker.value));\n }\n setTransformConfig(transformData) {\n this.transformConfig = transformData;\n }\n setCanvas(canvas) {\n this.canvas = canvas;\n this.context = canvas.getContext('2d');\n }\n scaleCanvas() {\n this.context.translate(this.transformConfig.transform.x, this.transformConfig.transform.y);\n this.context.scale(this.transformConfig.transform.k, this.transformConfig.transform.k);\n }\n setCanvasDimensions(data) {\n this.canvas.width = data.width;\n this.canvas.height = data.height;\n }\n getCanvasDimensions() {\n return {\n width: this.canvas.width,\n height: this.canvas.height\n };\n }\n clearCanvas() {\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n }\n drawWafer() {\n this.context.restore();\n this.context.save();\n this.clearCanvas();\n this.scaleCanvas();\n for (let i = 0; i < this.scaledColumnIndices.length; i++) {\n const scaledX = this.scaledColumnIndices[i];\n if (!(scaledX >= this.transformConfig.topLeftCanvasCorner.x\n && scaledX < this.transformConfig.bottomRightCanvasCorner.x)) {\n continue;\n }\n // columnIndexPositions is used to get chunks to determine the start and end index of the column, it looks something like [0, 1, 4, 9, 12]\n // This means that the first column has a start index of 0 and an end index of 1, the second column has a start index of 1 and an end index of 4, and so on\n // scaledRowIndices is used when we reach the end of the columnIndexPositions, when columnIndexPositions is [0, 1, 4, 9, 12], scaledRowIndices is 13\n const columnEndIndex = this.columnIndicesPositions[i + 1] !== undefined\n ? this.columnIndicesPositions[i + 1]\n : this.scaledRowIndices.length;\n for (let columnStartIndex = this.columnIndicesPositions[i]; columnStartIndex < columnEndIndex; columnStartIndex++) {\n const scaledY = this.scaledRowIndices[columnStartIndex];\n if (!(scaledY >= this.transformConfig.topLeftCanvasCorner.y\n && scaledY < this.transformConfig.bottomRightCanvasCorner.y)) {\n continue;\n }\n // Fill style is temporary green for all dies, will be replaced with a color based on the value of the die in a future implementation\n this.context.fillStyle = this.colors[this.colorIndices[columnStartIndex]]\n ?? this.outsideRangeDieColor;\n this.context.fillRect(scaledX, scaledY, this.renderConfig.dieDimensions.width, this.renderConfig.dieDimensions.height);\n }\n }\n }\n drawText() {\n this.context.font = `${this.renderConfig.labelsFontSize.toString()}px sans-serif`;\n this.context.fillStyle = '#ffffff';\n this.context.textAlign = 'center';\n this.context.lineCap = 'butt';\n const approximateTextHeight = this.context.measureText('M');\n for (let i = 0; i < this.scaledColumnIndices.length; i++) {\n const scaledX = this.scaledColumnIndices[i];\n if (!(scaledX >= this.transformConfig.topLeftCanvasCorner.x\n && scaledX < this.transformConfig.bottomRightCanvasCorner.x)) {\n continue;\n }\n // columnIndexPositions is used to get chunks to determine the start and end index of the column, it looks something like [0, 1, 4, 9, 12]\n // This means that the first column has a start index of 0 and an end index of 1, the second column has a start index of 1 and an end index of 4, and so on\n // scaledRowIndices is used when we reach the end of the columnIndexPositions, when columnIndexPositions is [0, 1, 4, 9, 12], scaledRowIndices is 13\n const columnEndIndex = this.columnIndicesPositions[i + 1] !== undefined\n ? this.columnIndicesPositions[i + 1]\n : this.scaledRowIndices.length;\n for (let columnStartIndex = this.columnIndicesPositions[i]; columnStartIndex < columnEndIndex; columnStartIndex++) {\n const scaledY = this.scaledRowIndices[columnStartIndex];\n if (!(scaledY >= this.transformConfig.topLeftCanvasCorner.y\n && scaledY < this.transformConfig.bottomRightCanvasCorner.y)) {\n continue;\n }\n let label = `${this.values[columnStartIndex] || 'NaN'}${this.renderConfig.dieLabelsSuffix}`;\n if (label.length >= this.renderConfig.maxCharacters) {\n label = `${label.substring(0, this.renderConfig.maxCharacters)}…`;\n }\n this.context.fillText(label, scaledX + this.renderConfig.dieDimensions.width / 2, scaledY\n + this.renderConfig.dieDimensions.height / 2\n + approximateTextHeight.width / 2, this.renderConfig.dieDimensions.width * this.fontSizeFactor);\n }\n }\n }\n isDieInGrid(x, y) {\n return (x >= this.renderConfig.gridMinX\n && x <= this.renderConfig.gridMaxX\n && y >= this.renderConfig.gridMinY\n && y <= this.renderConfig.gridMaxY);\n }\n calculateHorizontalScaledIndices(columnIndex) {\n return (this.renderConfig.horizontalCoefficient * columnIndex\n + this.renderConfig.horizontalConstant\n + this.renderConfig.margin.left);\n }\n calculateVerticalScaledIndices(rowIndex) {\n return (this.renderConfig.verticalCoefficient * rowIndex\n + this.renderConfig.verticalConstant\n + this.renderConfig.margin.top);\n }\n findColorIndex(value) {\n let index = -1;\n if (this.colorValues.length === 0 || this.colorValues[0] >= value) {\n return index;\n }\n for (let i = 0; i < this.colorValues.length; i++) {\n if (value <= this.colorValues[i]) {\n index = i;\n break;\n }\n }\n return index;\n }\n }\n expose(MatrixRenderer);\n\n exports.MatrixRenderer = MatrixRenderer;\n\n return exports;\n\n})({});\n";
95827
+ const workerCode = "var MatrixRenderer = (function (exports) {\n 'use strict';\n\n /**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n const proxyMarker = Symbol(\"Comlink.proxy\");\n const createEndpoint = Symbol(\"Comlink.endpoint\");\n const releaseProxy = Symbol(\"Comlink.releaseProxy\");\n const finalizer = Symbol(\"Comlink.finalizer\");\n const throwMarker = Symbol(\"Comlink.thrown\");\n const isObject = (val) => (typeof val === \"object\" && val !== null) || typeof val === \"function\";\n /**\n * Internal transfer handle to handle objects marked to proxy.\n */\n const proxyTransferHandler = {\n canHandle: (val) => isObject(val) && val[proxyMarker],\n serialize(obj) {\n const { port1, port2 } = new MessageChannel();\n expose(obj, port1);\n return [port2, [port2]];\n },\n deserialize(port) {\n port.start();\n return wrap(port);\n },\n };\n /**\n * Internal transfer handler to handle thrown exceptions.\n */\n const throwTransferHandler = {\n canHandle: (value) => isObject(value) && throwMarker in value,\n serialize({ value }) {\n let serialized;\n if (value instanceof Error) {\n serialized = {\n isError: true,\n value: {\n message: value.message,\n name: value.name,\n stack: value.stack,\n },\n };\n }\n else {\n serialized = { isError: false, value };\n }\n return [serialized, []];\n },\n deserialize(serialized) {\n if (serialized.isError) {\n throw Object.assign(new Error(serialized.value.message), serialized.value);\n }\n throw serialized.value;\n },\n };\n /**\n * Allows customizing the serialization of certain values.\n */\n const transferHandlers = new Map([\n [\"proxy\", proxyTransferHandler],\n [\"throw\", throwTransferHandler],\n ]);\n function isAllowedOrigin(allowedOrigins, origin) {\n for (const allowedOrigin of allowedOrigins) {\n if (origin === allowedOrigin || allowedOrigin === \"*\") {\n return true;\n }\n if (allowedOrigin instanceof RegExp && allowedOrigin.test(origin)) {\n return true;\n }\n }\n return false;\n }\n function expose(obj, ep = globalThis, allowedOrigins = [\"*\"]) {\n ep.addEventListener(\"message\", function callback(ev) {\n if (!ev || !ev.data) {\n return;\n }\n if (!isAllowedOrigin(allowedOrigins, ev.origin)) {\n console.warn(`Invalid origin '${ev.origin}' for comlink proxy`);\n return;\n }\n const { id, type, path } = Object.assign({ path: [] }, ev.data);\n const argumentList = (ev.data.argumentList || []).map(fromWireValue);\n let returnValue;\n try {\n const parent = path.slice(0, -1).reduce((obj, prop) => obj[prop], obj);\n const rawValue = path.reduce((obj, prop) => obj[prop], obj);\n switch (type) {\n case \"GET\" /* MessageType.GET */:\n {\n returnValue = rawValue;\n }\n break;\n case \"SET\" /* MessageType.SET */:\n {\n parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);\n returnValue = true;\n }\n break;\n case \"APPLY\" /* MessageType.APPLY */:\n {\n returnValue = rawValue.apply(parent, argumentList);\n }\n break;\n case \"CONSTRUCT\" /* MessageType.CONSTRUCT */:\n {\n const value = new rawValue(...argumentList);\n returnValue = proxy(value);\n }\n break;\n case \"ENDPOINT\" /* MessageType.ENDPOINT */:\n {\n const { port1, port2 } = new MessageChannel();\n expose(obj, port2);\n returnValue = transfer(port1, [port1]);\n }\n break;\n case \"RELEASE\" /* MessageType.RELEASE */:\n {\n returnValue = undefined;\n }\n break;\n default:\n return;\n }\n }\n catch (value) {\n returnValue = { value, [throwMarker]: 0 };\n }\n Promise.resolve(returnValue)\n .catch((value) => {\n return { value, [throwMarker]: 0 };\n })\n .then((returnValue) => {\n const [wireValue, transferables] = toWireValue(returnValue);\n ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);\n if (type === \"RELEASE\" /* MessageType.RELEASE */) {\n // detach and deactive after sending release response above.\n ep.removeEventListener(\"message\", callback);\n closeEndPoint(ep);\n if (finalizer in obj && typeof obj[finalizer] === \"function\") {\n obj[finalizer]();\n }\n }\n })\n .catch((error) => {\n // Send Serialization Error To Caller\n const [wireValue, transferables] = toWireValue({\n value: new TypeError(\"Unserializable return value\"),\n [throwMarker]: 0,\n });\n ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);\n });\n });\n if (ep.start) {\n ep.start();\n }\n }\n function isMessagePort(endpoint) {\n return endpoint.constructor.name === \"MessagePort\";\n }\n function closeEndPoint(endpoint) {\n if (isMessagePort(endpoint))\n endpoint.close();\n }\n function wrap(ep, target) {\n const pendingListeners = new Map();\n ep.addEventListener(\"message\", function handleMessage(ev) {\n const { data } = ev;\n if (!data || !data.id) {\n return;\n }\n const resolver = pendingListeners.get(data.id);\n if (!resolver) {\n return;\n }\n try {\n resolver(data);\n }\n finally {\n pendingListeners.delete(data.id);\n }\n });\n return createProxy(ep, pendingListeners, [], target);\n }\n function throwIfProxyReleased(isReleased) {\n if (isReleased) {\n throw new Error(\"Proxy has been released and is not useable\");\n }\n }\n function releaseEndpoint(ep) {\n return requestResponseMessage(ep, new Map(), {\n type: \"RELEASE\" /* MessageType.RELEASE */,\n }).then(() => {\n closeEndPoint(ep);\n });\n }\n const proxyCounter = new WeakMap();\n const proxyFinalizers = \"FinalizationRegistry\" in globalThis &&\n new FinalizationRegistry((ep) => {\n const newCount = (proxyCounter.get(ep) || 0) - 1;\n proxyCounter.set(ep, newCount);\n if (newCount === 0) {\n releaseEndpoint(ep);\n }\n });\n function registerProxy(proxy, ep) {\n const newCount = (proxyCounter.get(ep) || 0) + 1;\n proxyCounter.set(ep, newCount);\n if (proxyFinalizers) {\n proxyFinalizers.register(proxy, ep, proxy);\n }\n }\n function unregisterProxy(proxy) {\n if (proxyFinalizers) {\n proxyFinalizers.unregister(proxy);\n }\n }\n function createProxy(ep, pendingListeners, path = [], target = function () { }) {\n let isProxyReleased = false;\n const proxy = new Proxy(target, {\n get(_target, prop) {\n throwIfProxyReleased(isProxyReleased);\n if (prop === releaseProxy) {\n return () => {\n unregisterProxy(proxy);\n releaseEndpoint(ep);\n pendingListeners.clear();\n isProxyReleased = true;\n };\n }\n if (prop === \"then\") {\n if (path.length === 0) {\n return { then: () => proxy };\n }\n const r = requestResponseMessage(ep, pendingListeners, {\n type: \"GET\" /* MessageType.GET */,\n path: path.map((p) => p.toString()),\n }).then(fromWireValue);\n return r.then.bind(r);\n }\n return createProxy(ep, pendingListeners, [...path, prop]);\n },\n set(_target, prop, rawValue) {\n throwIfProxyReleased(isProxyReleased);\n // FIXME: ES6 Proxy Handler `set` methods are supposed to return a\n // boolean. To show good will, we return true asynchronously ¯\\_(ツ)_/¯\n const [value, transferables] = toWireValue(rawValue);\n return requestResponseMessage(ep, pendingListeners, {\n type: \"SET\" /* MessageType.SET */,\n path: [...path, prop].map((p) => p.toString()),\n value,\n }, transferables).then(fromWireValue);\n },\n apply(_target, _thisArg, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const last = path[path.length - 1];\n if (last === createEndpoint) {\n return requestResponseMessage(ep, pendingListeners, {\n type: \"ENDPOINT\" /* MessageType.ENDPOINT */,\n }).then(fromWireValue);\n }\n // We just pretend that `bind()` didn’t happen.\n if (last === \"bind\") {\n return createProxy(ep, pendingListeners, path.slice(0, -1));\n }\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, pendingListeners, {\n type: \"APPLY\" /* MessageType.APPLY */,\n path: path.map((p) => p.toString()),\n argumentList,\n }, transferables).then(fromWireValue);\n },\n construct(_target, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, pendingListeners, {\n type: \"CONSTRUCT\" /* MessageType.CONSTRUCT */,\n path: path.map((p) => p.toString()),\n argumentList,\n }, transferables).then(fromWireValue);\n },\n });\n registerProxy(proxy, ep);\n return proxy;\n }\n function myFlat(arr) {\n return Array.prototype.concat.apply([], arr);\n }\n function processArguments(argumentList) {\n const processed = argumentList.map(toWireValue);\n return [processed.map((v) => v[0]), myFlat(processed.map((v) => v[1]))];\n }\n const transferCache = new WeakMap();\n function transfer(obj, transfers) {\n transferCache.set(obj, transfers);\n return obj;\n }\n function proxy(obj) {\n return Object.assign(obj, { [proxyMarker]: true });\n }\n function toWireValue(value) {\n for (const [name, handler] of transferHandlers) {\n if (handler.canHandle(value)) {\n const [serializedValue, transferables] = handler.serialize(value);\n return [\n {\n type: \"HANDLER\" /* WireValueType.HANDLER */,\n name,\n value: serializedValue,\n },\n transferables,\n ];\n }\n }\n return [\n {\n type: \"RAW\" /* WireValueType.RAW */,\n value,\n },\n transferCache.get(value) || [],\n ];\n }\n function fromWireValue(value) {\n switch (value.type) {\n case \"HANDLER\" /* WireValueType.HANDLER */:\n return transferHandlers.get(value.name).deserialize(value.value);\n case \"RAW\" /* WireValueType.RAW */:\n return value.value;\n }\n }\n function requestResponseMessage(ep, pendingListeners, msg, transfers) {\n return new Promise((resolve) => {\n const id = generateUUID();\n pendingListeners.set(id, resolve);\n if (ep.start) {\n ep.start();\n }\n ep.postMessage(Object.assign({ id }, msg), transfers);\n });\n }\n function generateUUID() {\n return new Array(4)\n .fill(0)\n .map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))\n .join(\"-\");\n }\n\n /**\n * MatrixRenderer class is meant to be used within a Web Worker context,\n * using Comlink to facilitate communication between the main thread and the worker.\n * The MatrixRenderer class manages a matrix of dies, once an instance of MatrixRenderer is created,\n * it is exposed to the main thread using Comlink's `expose` method.\n * This setup is used in the wafer-map component to perform heavy computational duties\n */\n class MatrixRenderer {\n constructor() {\n this.values = Float64Array.from([]);\n this.scaledColumnIndices = Float64Array.from([]);\n this.scaledRowIndices = Float64Array.from([]);\n this.columnIndicesPositions = Int32Array.from([]);\n this.colorIndices = Int32Array.from([]);\n this.colors = [];\n this.colorValues = Float64Array.from([]);\n this.outsideRangeDieColor = 'rgba(218,223,236,1)';\n this.fontSizeFactor = 0.8;\n this.renderConfig = {\n dieDimensions: {\n width: 0,\n height: 0\n },\n margin: {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n },\n verticalCoefficient: 1,\n horizontalCoefficient: 1,\n horizontalConstant: 0,\n verticalConstant: 0,\n gridMinX: 0,\n gridMaxX: 0,\n gridMinY: 0,\n gridMaxY: 0,\n labelsFontSize: 0,\n colorScale: [],\n dieLabelsSuffix: '',\n maxCharacters: 0\n };\n this.transformConfig = {\n transform: {\n k: 1,\n x: 0,\n y: 0\n },\n topLeftCanvasCorner: {\n x: 0,\n y: 0\n },\n bottomRightCanvasCorner: {\n x: 0,\n y: 0\n }\n };\n }\n setMatrixData(columnIndices, rowIndices, valuesBuffer) {\n const scaledColumnIndex = [];\n const columnPositions = [];\n const scaledRowIndices = [];\n const values = [];\n const colorIndices = [];\n let prevXIndex;\n let dieCount = 0;\n for (let i = 0; i < columnIndices.length; i++) {\n const xIndex = columnIndices[i];\n const yIndex = rowIndices[i];\n if (this.isDieInGrid(xIndex, yIndex)) {\n if (xIndex !== prevXIndex) {\n scaledColumnIndex.push(this.calculateHorizontalScaledIndices(xIndex));\n columnPositions.push(dieCount);\n prevXIndex = xIndex;\n }\n scaledRowIndices.push(this.calculateVerticalScaledIndices(yIndex));\n const value = valuesBuffer[i];\n values.push(value);\n colorIndices.push(this.findColorIndex(value));\n dieCount += 1;\n }\n }\n this.scaledColumnIndices = Float64Array.from(scaledColumnIndex);\n this.columnIndicesPositions = Int32Array.from(columnPositions);\n this.scaledRowIndices = Float64Array.from(scaledRowIndices);\n this.values = Float64Array.from(values);\n this.colorIndices = Int32Array.from(colorIndices);\n }\n setRenderConfig(renderConfig) {\n this.renderConfig = renderConfig;\n this.colors = renderConfig.colorScale.map(marker => marker.color);\n this.colorValues = Float64Array.from(renderConfig.colorScale.map(marker => marker.value));\n }\n setTransformConfig(transformData) {\n this.transformConfig = transformData;\n }\n setCanvas(canvas) {\n this.canvas = canvas;\n this.context = canvas.getContext('2d');\n }\n scaleCanvas() {\n this.context.translate(this.transformConfig.transform.x, this.transformConfig.transform.y);\n this.context.scale(this.transformConfig.transform.k, this.transformConfig.transform.k);\n }\n setCanvasDimensions(data) {\n this.canvas.width = data.width;\n this.canvas.height = data.height;\n }\n getCanvasDimensions() {\n return {\n width: this.canvas.width,\n height: this.canvas.height\n };\n }\n clearCanvas() {\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n }\n drawWafer() {\n this.context.restore();\n this.context.save();\n this.clearCanvas();\n this.scaleCanvas();\n for (let i = 0; i < this.scaledColumnIndices.length; i++) {\n const scaledX = this.scaledColumnIndices[i];\n if (!(scaledX >= this.transformConfig.topLeftCanvasCorner.x\n && scaledX < this.transformConfig.bottomRightCanvasCorner.x)) {\n continue;\n }\n // columnIndexPositions is used to get chunks to determine the start and end index of the column, it looks something like [0, 1, 4, 9, 12]\n // This means that the first column has a start index of 0 and an end index of 1, the second column has a start index of 1 and an end index of 4, and so on\n // scaledRowIndices is used when we reach the end of the columnIndexPositions, when columnIndexPositions is [0, 1, 4, 9, 12], scaledRowIndices is 13\n const columnEndIndex = this.columnIndicesPositions[i + 1] !== undefined\n ? this.columnIndicesPositions[i + 1]\n : this.scaledRowIndices.length;\n for (let columnStartIndex = this.columnIndicesPositions[i]; columnStartIndex < columnEndIndex; columnStartIndex++) {\n const scaledY = this.scaledRowIndices[columnStartIndex];\n if (!(scaledY >= this.transformConfig.topLeftCanvasCorner.y\n && scaledY < this.transformConfig.bottomRightCanvasCorner.y)) {\n continue;\n }\n // Fill style is temporary green for all dies, will be replaced with a color based on the value of the die in a future implementation\n this.context.fillStyle = this.colors[this.colorIndices[columnStartIndex]]\n ?? this.outsideRangeDieColor;\n this.context.fillRect(scaledX, scaledY, this.renderConfig.dieDimensions.width, this.renderConfig.dieDimensions.height);\n }\n }\n }\n drawText() {\n this.context.font = `${this.renderConfig.labelsFontSize.toString()}px sans-serif`;\n this.context.fillStyle = '#ffffff';\n this.context.textAlign = 'center';\n this.context.lineCap = 'butt';\n const approximateTextHeight = this.context.measureText('M');\n for (let i = 0; i < this.scaledColumnIndices.length; i++) {\n const scaledX = this.scaledColumnIndices[i];\n if (!(scaledX >= this.transformConfig.topLeftCanvasCorner.x\n && scaledX < this.transformConfig.bottomRightCanvasCorner.x)) {\n continue;\n }\n // columnIndexPositions is used to get chunks to determine the start and end index of the column, it looks something like [0, 1, 4, 9, 12]\n // This means that the first column has a start index of 0 and an end index of 1, the second column has a start index of 1 and an end index of 4, and so on\n // scaledRowIndices is used when we reach the end of the columnIndexPositions, when columnIndexPositions is [0, 1, 4, 9, 12], scaledRowIndices is 13\n const columnEndIndex = this.columnIndicesPositions[i + 1] !== undefined\n ? this.columnIndicesPositions[i + 1]\n : this.scaledRowIndices.length;\n for (let columnStartIndex = this.columnIndicesPositions[i]; columnStartIndex < columnEndIndex; columnStartIndex++) {\n const scaledY = this.scaledRowIndices[columnStartIndex];\n if (!(scaledY >= this.transformConfig.topLeftCanvasCorner.y\n && scaledY < this.transformConfig.bottomRightCanvasCorner.y)) {\n continue;\n }\n let label = `${this.values[columnStartIndex] ?? 'NaN'}${this.renderConfig.dieLabelsSuffix}`;\n if (label.length >= this.renderConfig.maxCharacters) {\n label = `${label.substring(0, this.renderConfig.maxCharacters)}…`;\n }\n this.context.fillText(label, scaledX + this.renderConfig.dieDimensions.width / 2, scaledY\n + this.renderConfig.dieDimensions.height / 2\n + approximateTextHeight.width / 2, this.renderConfig.dieDimensions.width * this.fontSizeFactor);\n }\n }\n }\n isDieInGrid(x, y) {\n return (x >= this.renderConfig.gridMinX\n && x <= this.renderConfig.gridMaxX\n && y >= this.renderConfig.gridMinY\n && y <= this.renderConfig.gridMaxY);\n }\n calculateHorizontalScaledIndices(columnIndex) {\n return (this.renderConfig.horizontalCoefficient * columnIndex\n + this.renderConfig.horizontalConstant\n + this.renderConfig.margin.left);\n }\n calculateVerticalScaledIndices(rowIndex) {\n return (this.renderConfig.verticalCoefficient * rowIndex\n + this.renderConfig.verticalConstant\n + this.renderConfig.margin.top);\n }\n findColorIndex(value) {\n let index = -1;\n if (this.colorValues.length === 0 || this.colorValues[0] >= value) {\n return index;\n }\n for (let i = 0; i < this.colorValues.length; i++) {\n if (value <= this.colorValues[i]) {\n index = i;\n break;\n }\n }\n return index;\n }\n }\n expose(MatrixRenderer);\n\n exports.MatrixRenderer = MatrixRenderer;\n\n return exports;\n\n})({});\n";
95769
95828
 
95770
95829
  let url;
95771
95830
  /**
@@ -95826,10 +95885,9 @@ focus outline in that case.
95826
95885
  });
95827
95886
  await this.matrixRenderer.drawWafer();
95828
95887
  if (!snapshot.dieLabelsHidden
95829
- && snapshot.dieDimensions
95830
95888
  && snapshot.dieDimensions.width
95831
95889
  * snapshot.dieDimensions.height
95832
- * (snapshot.transform.k || 1)
95890
+ * (snapshot.transform.k !== 0 ? snapshot.transform.k : 1)
95833
95891
  >= this.minDieDim) {
95834
95892
  await this.matrixRenderer.drawText();
95835
95893
  }