@drghaliasri/butex 6.1.1 → 6.1.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.
@@ -1,3 +1,23 @@
1
+ // src/react/matrixPickerCss.ts
2
+ var MATRIX_PICKER_CSS = `
3
+ .butex-widget .matrix-grid-picker,
4
+ .butex-widget .matrix-grid-cell {
5
+ box-sizing: border-box;
6
+ }
7
+ `.trim();
8
+ var MATRIX_PICKER_STYLE_ID = "butex-matrix-picker-css";
9
+ function injectMatrixPickerCss(doc) {
10
+ const d = doc ?? (typeof document !== "undefined" ? document : void 0);
11
+ if (!d || d.getElementById(MATRIX_PICKER_STYLE_ID)) {
12
+ return;
13
+ }
14
+ const style = d.createElement("style");
15
+ style.id = MATRIX_PICKER_STYLE_ID;
16
+ style.textContent = MATRIX_PICKER_CSS;
17
+ d.head.appendChild(style);
18
+ }
19
+ injectMatrixPickerCss();
20
+
1
21
  // src/react-document2/ArticleMetaPanel.tsx
2
22
  import { useEffect, useId, useRef, useState } from "react";
3
23
 
@@ -9325,7 +9345,7 @@ function toDocumentJson2(document2) {
9325
9345
  }
9326
9346
 
9327
9347
  // src/document2/keys.ts
9328
- var DOCUMENT2_KEY_PATTERN = /^[\p{L}\p{M}0-9:._-]+$/u;
9348
+ var DOCUMENT2_KEY_PATTERN = /^[\p{L}\p{M}\p{Nd}:._-]+$/u;
9329
9349
  function normalizeDocument2Key(key) {
9330
9350
  return key.normalize("NFC").trim();
9331
9351
  }
@@ -10185,7 +10205,7 @@ var DOCUMENT2_MESSAGES = {
10185
10205
  editInternalRef: "\u062A\u062D\u0631\u064A\u0631 \u0627\u0644\u0645\u0631\u062C\u0639 \u0627\u0644\u062F\u0627\u062E\u0644\u064A",
10186
10206
  deleteInternalRef: "\u062D\u0630\u0641 \u0627\u0644\u0645\u0631\u062C\u0639 \u0627\u0644\u062F\u0627\u062E\u0644\u064A",
10187
10207
  labelsTitle: "\u0627\u0644\u062A\u0633\u0645\u064A\u0627\u062A \u0648\u0627\u0644\u0645\u0631\u0627\u062C\u0639 \u0627\u0644\u062F\u0627\u062E\u0644\u064A\u0629",
10188
- labelsHelp: "\u0627\u0644\u062A\u0633\u0645\u064A\u0627\u062A \u0644\u0644\u0645\u0631\u0627\u062C\u0639 \u062F\u0627\u062E\u0644 \u0627\u0644\u0645\u0633\u062A\u0646\u062F\u061B \u0627\u0644\u0645\u0631\u0627\u062C\u0639 \u0627\u0644\u0628\u0628\u0644\u064A\u0648\u063A\u0631\u0627\u0641\u064A\u0629 \u0644\u0644\u0627\u0642\u062A\u0628\u0627\u0633\u0627\u062A \u0645\u0646 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0645\u0631\u0627\u062C\u0639.",
10208
+ labelsHelp: "\u0627\u0644\u062A\u0633\u0645\u064A\u0627\u062A \u0644\u0644\u0645\u0631\u0627\u062C\u0639 \u062F\u0627\u062E\u0644 \u0627\u0644\u0645\u0633\u062A\u0646\u062F\u061B \u0648\u0627\u0644\u0627\u0642\u062A\u0628\u0627\u0633\u0627\u062A \u062A\u0633\u062A\u0646\u062F \u0625\u0644\u0649 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0645\u0631\u0627\u062C\u0639.",
10189
10209
  captionToggle: "\u062A\u0639\u0644\u064A\u0642",
10190
10210
  labelToggle: "\u062A\u0633\u0645\u064A\u0629",
10191
10211
  centerParagraph: "\u062A\u0648\u0633\u064A\u0637 \u0627\u0644\u0641\u0642\u0631\u0629",
@@ -10629,7 +10649,7 @@ function parseJsonDebugInput(text) {
10629
10649
  import { useEffect as useEffect3, useState as useState3 } from "react";
10630
10650
 
10631
10651
  // src/react-document2/InlineField.tsx
10632
- import { useRef as useRef3 } from "react";
10652
+ import { Fragment, useRef as useRef3 } from "react";
10633
10653
 
10634
10654
  // src/react-document2/CiteChip.tsx
10635
10655
  import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
@@ -11313,8 +11333,14 @@ function RefChip({
11313
11333
  ] });
11314
11334
  }
11315
11335
 
11336
+ // src/react-document2/xelatexTextValidation.ts
11337
+ var XELATEX_UNSUPPORTED_EMOJI_PATTERN = /[\p{Emoji_Presentation}\p{Emoji_Modifier}\p{Regional_Indicator}\uFE0F\u20E3]/u;
11338
+ function hasXeLatexUnsupportedEmoji(value) {
11339
+ return XELATEX_UNSUPPORTED_EMOJI_PATTERN.test(value);
11340
+ }
11341
+
11316
11342
  // src/react-document2/InlineField.tsx
11317
- import { jsx as jsx6 } from "react/jsx-runtime";
11343
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
11318
11344
  function rememberCaret(element, blockId, fieldId, tokenId, onFieldFocus) {
11319
11345
  if (!blockId || !onFieldFocus) {
11320
11346
  return;
@@ -11332,6 +11358,9 @@ function fitTextareaHeight(element) {
11332
11358
  element.style.height = "auto";
11333
11359
  element.style.height = `${String(element.scrollHeight)}px`;
11334
11360
  }
11361
+ function xeLatexUnsupportedEmojiMessage(uiLocale) {
11362
+ return uiLocale === "ar" ? "\u0647\u0630\u0627 \u0627\u0644\u0631\u0645\u0632 \u0627\u0644\u062A\u0639\u0628\u064A\u0631\u064A \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645 \u0641\u064A \u062A\u0635\u062F\u064A\u0631 XeLaTeX \u0627\u0644\u062D\u0627\u0644\u064A \u0628\u062E\u0637 Amiri." : "This emoji is not supported by the current XeLaTeX export using the Amiri font.";
11363
+ }
11335
11364
  function InlineField({
11336
11365
  field,
11337
11366
  blockId,
@@ -11450,74 +11479,92 @@ function InlineField({
11450
11479
  const backwardArrowKey = documentDirection === "rtl" ? "ArrowRight" : "ArrowLeft";
11451
11480
  return /* @__PURE__ */ jsx6("div", { className: "butex-document2-widget__inline-field", dir: documentDirection, "data-document-direction": documentDirection, children: field.tokens.map((token) => {
11452
11481
  if (token.kind === "text") {
11453
- return /* @__PURE__ */ jsx6(
11454
- "textarea",
11455
- {
11456
- className: "butex-document2-widget__inline-text",
11457
- value: token.text,
11458
- "data-bold": token.style?.bold === true ? "true" : void 0,
11459
- "data-italic": token.style?.italic === true ? "true" : void 0,
11460
- "data-underline": token.style?.underline === true ? "true" : void 0,
11461
- dir: documentDirection,
11462
- "aria-label": messages.text,
11463
- rows: 1,
11464
- "data-field-id": field.id,
11465
- "data-text-token-id": token.id,
11466
- ref: (element) => {
11467
- if (element) {
11468
- textRefs.current.set(token.id, element);
11469
- fitTextareaHeight(element);
11470
- } else {
11471
- textRefs.current.delete(token.id);
11472
- }
11473
- },
11474
- onChange: (event) => {
11475
- onTextChange(field.id, token.id, event.currentTarget.value);
11476
- fitTextareaHeight(event.currentTarget);
11477
- },
11478
- onKeyDown: (event) => {
11479
- const element = event.currentTarget;
11480
- const collapsed = element.selectionStart === element.selectionEnd;
11481
- if (!collapsed) {
11482
- return;
11483
- }
11484
- if (event.key === forwardArrowKey && element.selectionStart === element.value.length) {
11485
- const next = adjacentIslandId(token.id, 1);
11486
- if (next) {
11487
- event.preventDefault();
11488
- if (next.kind === "math") {
11489
- focusMathToken(next.id);
11490
- } else if (next.kind === "cite") {
11491
- focusCiteToken(next.id);
11492
- } else {
11493
- focusRefToken(next.id);
11494
- }
11482
+ const unsupportedEmoji = hasXeLatexUnsupportedEmoji(token.text);
11483
+ const errorId = `butex-document2-xelatex-text-error-${token.id}`;
11484
+ return /* @__PURE__ */ jsxs5(Fragment, { children: [
11485
+ /* @__PURE__ */ jsx6(
11486
+ "textarea",
11487
+ {
11488
+ className: "butex-document2-widget__inline-text",
11489
+ value: token.text,
11490
+ "data-bold": token.style?.bold === true ? "true" : void 0,
11491
+ "data-italic": token.style?.italic === true ? "true" : void 0,
11492
+ "data-underline": token.style?.underline === true ? "true" : void 0,
11493
+ dir: documentDirection,
11494
+ "aria-label": messages.text,
11495
+ "aria-invalid": unsupportedEmoji ? true : void 0,
11496
+ "aria-describedby": unsupportedEmoji ? errorId : void 0,
11497
+ rows: 1,
11498
+ "data-field-id": field.id,
11499
+ "data-text-token-id": token.id,
11500
+ style: unsupportedEmoji ? {
11501
+ borderColor: "var(--butex-document2-error)",
11502
+ background: "var(--butex-document2-error-bg)"
11503
+ } : void 0,
11504
+ ref: (element) => {
11505
+ if (element) {
11506
+ textRefs.current.set(token.id, element);
11507
+ fitTextareaHeight(element);
11508
+ } else {
11509
+ textRefs.current.delete(token.id);
11510
+ }
11511
+ },
11512
+ onChange: (event) => {
11513
+ onTextChange(field.id, token.id, event.currentTarget.value);
11514
+ fitTextareaHeight(event.currentTarget);
11515
+ },
11516
+ onKeyDown: (event) => {
11517
+ const element = event.currentTarget;
11518
+ const collapsed = element.selectionStart === element.selectionEnd;
11519
+ if (!collapsed) {
11520
+ return;
11495
11521
  }
11496
- } else if (event.key === backwardArrowKey && element.selectionStart === 0) {
11497
- const previous = adjacentIslandId(token.id, -1);
11498
- if (previous) {
11499
- event.preventDefault();
11500
- if (previous.kind === "math") {
11501
- focusMathToken(previous.id);
11502
- } else if (previous.kind === "cite") {
11503
- focusCiteToken(previous.id);
11504
- } else {
11505
- focusRefToken(previous.id);
11522
+ if (event.key === forwardArrowKey && element.selectionStart === element.value.length) {
11523
+ const next = adjacentIslandId(token.id, 1);
11524
+ if (next) {
11525
+ event.preventDefault();
11526
+ if (next.kind === "math") {
11527
+ focusMathToken(next.id);
11528
+ } else if (next.kind === "cite") {
11529
+ focusCiteToken(next.id);
11530
+ } else {
11531
+ focusRefToken(next.id);
11532
+ }
11533
+ }
11534
+ } else if (event.key === backwardArrowKey && element.selectionStart === 0) {
11535
+ const previous = adjacentIslandId(token.id, -1);
11536
+ if (previous) {
11537
+ event.preventDefault();
11538
+ if (previous.kind === "math") {
11539
+ focusMathToken(previous.id);
11540
+ } else if (previous.kind === "cite") {
11541
+ focusCiteToken(previous.id);
11542
+ } else {
11543
+ focusRefToken(previous.id);
11544
+ }
11506
11545
  }
11507
11546
  }
11508
- }
11509
- },
11510
- onFocus: (event) => rememberCaret(event.currentTarget, blockId, field.id, token.id, onFieldFocus),
11511
- onClick: (event) => rememberCaret(event.currentTarget, blockId, field.id, token.id, onFieldFocus),
11512
- onKeyUp: (event) => {
11513
- rememberCaret(event.currentTarget, blockId, field.id, token.id, onFieldFocus);
11514
- fitTextareaHeight(event.currentTarget);
11515
- },
11516
- onSelect: (event) => rememberCaret(event.currentTarget, blockId, field.id, token.id, onFieldFocus),
11517
- onBlur: () => onFieldBlur?.()
11518
- },
11519
- token.id
11520
- );
11547
+ },
11548
+ onFocus: (event) => rememberCaret(event.currentTarget, blockId, field.id, token.id, onFieldFocus),
11549
+ onClick: (event) => rememberCaret(event.currentTarget, blockId, field.id, token.id, onFieldFocus),
11550
+ onKeyUp: (event) => {
11551
+ rememberCaret(event.currentTarget, blockId, field.id, token.id, onFieldFocus);
11552
+ fitTextareaHeight(event.currentTarget);
11553
+ },
11554
+ onSelect: (event) => rememberCaret(event.currentTarget, blockId, field.id, token.id, onFieldFocus),
11555
+ onBlur: () => onFieldBlur?.()
11556
+ }
11557
+ ),
11558
+ unsupportedEmoji ? /* @__PURE__ */ jsx6(
11559
+ "p",
11560
+ {
11561
+ id: errorId,
11562
+ className: "butex-document2-widget__field-error",
11563
+ style: { flexBasis: "100%" },
11564
+ children: xeLatexUnsupportedEmojiMessage(uiLocale)
11565
+ }
11566
+ ) : null
11567
+ ] }, token.id);
11521
11568
  }
11522
11569
  if (token.kind === "cite") {
11523
11570
  return /* @__PURE__ */ jsx6(
@@ -11618,7 +11665,7 @@ function uiLocaleDirection(locale) {
11618
11665
  }
11619
11666
 
11620
11667
  // src/react-document2/BlockEditor.tsx
11621
- import { Fragment, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
11668
+ import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
11622
11669
  function blockChromeClass(block) {
11623
11670
  const root = "butex-document2-widget__block";
11624
11671
  if (block.kind === "textBlock") {
@@ -11732,8 +11779,8 @@ function FloatMetaEditor({
11732
11779
  labels,
11733
11780
  excludeOwnerId: ownerId
11734
11781
  }) : null;
11735
- return /* @__PURE__ */ jsxs5("div", { className: "butex-document2-widget__float-meta", children: [
11736
- /* @__PURE__ */ jsxs5("label", { className: "butex-document2-widget__float-meta-toggle", children: [
11782
+ return /* @__PURE__ */ jsxs6("div", { className: "butex-document2-widget__float-meta", children: [
11783
+ /* @__PURE__ */ jsxs6("label", { className: "butex-document2-widget__float-meta-toggle", children: [
11737
11784
  /* @__PURE__ */ jsx7(
11738
11785
  "input",
11739
11786
  {
@@ -11747,7 +11794,7 @@ function FloatMetaEditor({
11747
11794
  ),
11748
11795
  /* @__PURE__ */ jsx7("span", { children: messages.captionToggle })
11749
11796
  ] }),
11750
- captionEnabled ? /* @__PURE__ */ jsxs5("label", { className: "butex-document2-widget__refs-field", children: [
11797
+ captionEnabled ? /* @__PURE__ */ jsxs6("label", { className: "butex-document2-widget__refs-field", children: [
11751
11798
  /* @__PURE__ */ jsx7("span", { children: messages.floatCaption }),
11752
11799
  /* @__PURE__ */ jsx7(
11753
11800
  "input",
@@ -11762,7 +11809,7 @@ function FloatMetaEditor({
11762
11809
  }
11763
11810
  )
11764
11811
  ] }) : null,
11765
- /* @__PURE__ */ jsxs5("label", { className: "butex-document2-widget__float-meta-toggle", children: [
11812
+ /* @__PURE__ */ jsxs6("label", { className: "butex-document2-widget__float-meta-toggle", children: [
11766
11813
  /* @__PURE__ */ jsx7(
11767
11814
  "input",
11768
11815
  {
@@ -11776,7 +11823,7 @@ function FloatMetaEditor({
11776
11823
  ),
11777
11824
  /* @__PURE__ */ jsx7("span", { children: messages.labelToggle })
11778
11825
  ] }),
11779
- labelEnabled ? /* @__PURE__ */ jsxs5("label", { className: "butex-document2-widget__refs-field", children: [
11826
+ labelEnabled ? /* @__PURE__ */ jsxs6("label", { className: "butex-document2-widget__refs-field", children: [
11780
11827
  /* @__PURE__ */ jsx7("span", { children: messages.floatLabel }),
11781
11828
  /* @__PURE__ */ jsx7(
11782
11829
  "input",
@@ -11885,23 +11932,23 @@ function ImageAssetEditor({
11885
11932
  document.getElementById(selectId)?.focus();
11886
11933
  }
11887
11934
  }
11888
- const defaultUi = /* @__PURE__ */ jsxs5("div", { className: "butex-document2-widget__image-editor", children: [
11889
- /* @__PURE__ */ jsx7("div", { className: `butex-document2-widget__image-asset ${hasImage ? "butex-document2-widget__image-asset--filled" : "butex-document2-widget__image-asset--empty"}`, children: hasImage ? /* @__PURE__ */ jsxs5(Fragment, { children: [
11935
+ const defaultUi = /* @__PURE__ */ jsxs6("div", { className: "butex-document2-widget__image-editor", children: [
11936
+ /* @__PURE__ */ jsx7("div", { className: `butex-document2-widget__image-asset ${hasImage ? "butex-document2-widget__image-asset--filled" : "butex-document2-widget__image-asset--empty"}`, children: hasImage ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
11890
11937
  resolvedUrl ? /* @__PURE__ */ jsx7("img", { className: "butex-document2-widget__image-thumb", src: resolvedUrl, alt: messages.imagePreviewAlt }) : null,
11891
- /* @__PURE__ */ jsxs5("div", { className: "butex-document2-widget__image-asset-main", children: [
11938
+ /* @__PURE__ */ jsxs6("div", { className: "butex-document2-widget__image-asset-main", children: [
11892
11939
  /* @__PURE__ */ jsx7("span", { className: "butex-document2-widget__image-asset-title", dir: "ltr", children: block.assetId ?? block.value }),
11893
- /* @__PURE__ */ jsxs5("div", { className: "butex-document2-widget__image-actions", children: [
11940
+ /* @__PURE__ */ jsxs6("div", { className: "butex-document2-widget__image-actions", children: [
11894
11941
  /* @__PURE__ */ jsx7("button", { type: "button", onClick: activateImagePicker, disabled: !canUsePicker && !canSelectListedAsset, children: messages.changeImage }),
11895
11942
  /* @__PURE__ */ jsx7("button", { type: "button", className: "butex-document2-widget__button--danger", onClick: () => onClearAsset?.(block.id), children: messages.removeImage })
11896
11943
  ] })
11897
11944
  ] })
11898
- ] }) : /* @__PURE__ */ jsxs5("div", { className: "butex-document2-widget__image-empty-content", children: [
11945
+ ] }) : /* @__PURE__ */ jsxs6("div", { className: "butex-document2-widget__image-empty-content", children: [
11899
11946
  /* @__PURE__ */ jsx7("strong", { children: messages.noImageSelected }),
11900
11947
  /* @__PURE__ */ jsx7("button", { type: "button", onClick: activateImagePicker, disabled: !canUsePicker && !canSelectListedAsset, children: messages.chooseImage })
11901
11948
  ] }) }),
11902
- !canUsePicker ? /* @__PURE__ */ jsxs5("label", { className: "butex-document2-widget__image-select", htmlFor: selectId, children: [
11949
+ !canUsePicker ? /* @__PURE__ */ jsxs6("label", { className: "butex-document2-widget__image-select", htmlFor: selectId, children: [
11903
11950
  /* @__PURE__ */ jsx7("span", { children: messages.selectImageAsset }),
11904
- /* @__PURE__ */ jsxs5(
11951
+ /* @__PURE__ */ jsxs6(
11905
11952
  "select",
11906
11953
  {
11907
11954
  id: selectId,
@@ -11916,7 +11963,7 @@ function ImageAssetEditor({
11916
11963
  }
11917
11964
  )
11918
11965
  ] }) : null,
11919
- /* @__PURE__ */ jsxs5(
11966
+ /* @__PURE__ */ jsxs6(
11920
11967
  "details",
11921
11968
  {
11922
11969
  className: "butex-document2-widget__image-advanced",
@@ -11953,7 +12000,7 @@ function ImageAssetEditor({
11953
12000
  )
11954
12001
  ] });
11955
12002
  if (renderImageBlockEditor) {
11956
- return /* @__PURE__ */ jsx7(Fragment, { children: renderImageBlockEditor({
12003
+ return /* @__PURE__ */ jsx7(Fragment2, { children: renderImageBlockEditor({
11957
12004
  blockId: block.id,
11958
12005
  assetId: block.assetId,
11959
12006
  value: block.value,
@@ -11964,7 +12011,7 @@ function ImageAssetEditor({
11964
12011
  defaultUi
11965
12012
  }) });
11966
12013
  }
11967
- return /* @__PURE__ */ jsx7(Fragment, { children: defaultUi });
12014
+ return /* @__PURE__ */ jsx7(Fragment2, { children: defaultUi });
11968
12015
  }
11969
12016
  function blockSummary(block, referenceCount, messages) {
11970
12017
  if (block.kind === "textBlock") {
@@ -12071,7 +12118,7 @@ function BlockEditor({
12071
12118
  }
12072
12119
  onBlockFocus?.(block.id);
12073
12120
  },
12074
- children: /* @__PURE__ */ jsxs5("span", { className: "butex-document2-widget__block-title", children: [
12121
+ children: /* @__PURE__ */ jsxs6("span", { className: "butex-document2-widget__block-title", children: [
12075
12122
  onToggleSelect ? /* @__PURE__ */ jsx7(
12076
12123
  "input",
12077
12124
  {
@@ -12107,16 +12154,16 @@ function BlockEditor({
12107
12154
  }
12108
12155
  ) : null;
12109
12156
  if (isCollapsed && showChrome) {
12110
- return /* @__PURE__ */ jsxs5("section", { className: chromeClass, "data-butex-block-source": block.metadata?.source, children: [
12157
+ return /* @__PURE__ */ jsxs6("section", { className: chromeClass, "data-butex-block-source": block.metadata?.source, children: [
12111
12158
  header,
12112
12159
  /* @__PURE__ */ jsx7("div", { className: "butex-document2-widget__block-summary", children: blockSummary(block, references.length, messages) })
12113
12160
  ] });
12114
12161
  }
12115
12162
  if (block.kind === "textBlock") {
12116
- return /* @__PURE__ */ jsxs5("section", { className: chromeClass, "data-butex-block-source": block.metadata?.source, children: [
12163
+ return /* @__PURE__ */ jsxs6("section", { className: chromeClass, "data-butex-block-source": block.metadata?.source, children: [
12117
12164
  header,
12118
12165
  /* @__PURE__ */ jsx7(InlineField, { field: block.field, ...fieldProps }),
12119
- block.command === "\\paragraph" ? /* @__PURE__ */ jsx7("div", { className: "butex-document2-widget__float-meta butex-document2-widget__float-meta--compact", children: /* @__PURE__ */ jsxs5("label", { className: "butex-document2-widget__float-meta-toggle", children: [
12166
+ block.command === "\\paragraph" ? /* @__PURE__ */ jsx7("div", { className: "butex-document2-widget__float-meta butex-document2-widget__float-meta--compact", children: /* @__PURE__ */ jsxs6("label", { className: "butex-document2-widget__float-meta-toggle", children: [
12120
12167
  /* @__PURE__ */ jsx7(
12121
12168
  "input",
12122
12169
  {
@@ -12133,11 +12180,11 @@ function BlockEditor({
12133
12180
  ] });
12134
12181
  }
12135
12182
  if (block.kind === "list") {
12136
- return /* @__PURE__ */ jsxs5("section", { className: chromeClass, "data-butex-block-source": block.metadata?.source, children: [
12183
+ return /* @__PURE__ */ jsxs6("section", { className: chromeClass, "data-butex-block-source": block.metadata?.source, children: [
12137
12184
  header,
12138
- block.items.map((item, index) => /* @__PURE__ */ jsxs5("div", { className: "butex-document2-widget__field", dir: "rtl", children: [
12185
+ block.items.map((item, index) => /* @__PURE__ */ jsxs6("div", { className: "butex-document2-widget__field", dir: "rtl", children: [
12139
12186
  /* @__PURE__ */ jsx7("span", { className: "butex-document2-widget__toolbar-label", children: block.command === "\\begin{enumerate}" ? `${messages.item} ${String(index + 1)}` : messages.item }),
12140
- /* @__PURE__ */ jsxs5("div", { className: "butex-document2-widget__list-item-content", dir: documentDirection, children: [
12187
+ /* @__PURE__ */ jsxs6("div", { className: "butex-document2-widget__list-item-content", dir: documentDirection, children: [
12141
12188
  /* @__PURE__ */ jsx7(InlineField, { field: item.field, ...fieldProps }),
12142
12189
  item.blocks.map((child) => /* @__PURE__ */ jsx7(
12143
12190
  BlockEditor,
@@ -12177,14 +12224,14 @@ function BlockEditor({
12177
12224
  ] }),
12178
12225
  onRemoveListItem && block.items.length > 1 ? /* @__PURE__ */ jsx7("div", { className: "butex-document2-widget__list-item-actions", children: /* @__PURE__ */ jsx7("button", { type: "button", className: "butex-document2-widget__button--danger", onClick: () => onRemoveListItem(block.id, item.id), children: messages.deleteItem }) }) : null
12179
12226
  ] }, item.id)),
12180
- onAddListItem ? /* @__PURE__ */ jsx7("div", { className: "butex-document2-widget__list-footer", children: /* @__PURE__ */ jsxs5("button", { type: "button", onClick: () => onAddListItem(block.id), children: [
12227
+ onAddListItem ? /* @__PURE__ */ jsx7("div", { className: "butex-document2-widget__list-footer", children: /* @__PURE__ */ jsxs6("button", { type: "button", onClick: () => onAddListItem(block.id), children: [
12181
12228
  "+ ",
12182
12229
  messages.addItem
12183
12230
  ] }) }) : null
12184
12231
  ] });
12185
12232
  }
12186
12233
  if (block.kind === "table") {
12187
- return /* @__PURE__ */ jsxs5("section", { className: chromeClass, "data-butex-block-source": block.metadata?.source, children: [
12234
+ return /* @__PURE__ */ jsxs6("section", { className: chromeClass, "data-butex-block-source": block.metadata?.source, children: [
12188
12235
  header,
12189
12236
  block.rows.map((row, rowIndex) => /* @__PURE__ */ jsx7("div", { className: "butex-document2-widget__row", dir: documentDirection, children: row.map((cell) => /* @__PURE__ */ jsx7("div", { className: "butex-document2-widget__table-cell", dir: documentDirection, children: /* @__PURE__ */ jsx7(InlineField, { field: cell, ...fieldProps }) }, cell.id)) }, rowIndex)),
12190
12237
  /* @__PURE__ */ jsx7(
@@ -12206,7 +12253,7 @@ function BlockEditor({
12206
12253
  ] });
12207
12254
  }
12208
12255
  if (block.kind === "image") {
12209
- return /* @__PURE__ */ jsxs5("section", { className: chromeClass, "data-butex-block-source": block.metadata?.source, children: [
12256
+ return /* @__PURE__ */ jsxs6("section", { className: chromeClass, "data-butex-block-source": block.metadata?.source, children: [
12210
12257
  header,
12211
12258
  /* @__PURE__ */ jsx7(
12212
12259
  ImageAssetEditor,
@@ -12243,10 +12290,10 @@ function BlockEditor({
12243
12290
  ] });
12244
12291
  }
12245
12292
  if (block.kind === "bibliography") {
12246
- return /* @__PURE__ */ jsxs5("section", { className: chromeClass, "data-butex-block-source": block.metadata?.source, children: [
12293
+ return /* @__PURE__ */ jsxs6("section", { className: chromeClass, "data-butex-block-source": block.metadata?.source, children: [
12247
12294
  header,
12248
- /* @__PURE__ */ jsx7("ol", { className: "butex-document2-widget__bibliography-editor", dir: documentDirection, children: referenceList.map((reference, index) => /* @__PURE__ */ jsxs5("li", { children: [
12249
- /* @__PURE__ */ jsxs5("strong", { children: [
12295
+ /* @__PURE__ */ jsx7("ol", { className: "butex-document2-widget__bibliography-editor", dir: documentDirection, children: referenceList.map((reference, index) => /* @__PURE__ */ jsxs6("li", { children: [
12296
+ /* @__PURE__ */ jsxs6("strong", { children: [
12250
12297
  "[",
12251
12298
  formatBibliographyNumber(index + 1, { documentDirection, digitForm }),
12252
12299
  "] ",
@@ -12259,7 +12306,7 @@ function BlockEditor({
12259
12306
  onManageReferences ? /* @__PURE__ */ jsx7("button", { type: "button", onClick: onManageReferences, children: messages.manageReferences }) : null
12260
12307
  ] });
12261
12308
  }
12262
- return /* @__PURE__ */ jsxs5("section", { className: chromeClass, "data-butex-block-source": block.metadata?.source, children: [
12309
+ return /* @__PURE__ */ jsxs6("section", { className: chromeClass, "data-butex-block-source": block.metadata?.source, children: [
12263
12310
  header,
12264
12311
  /* @__PURE__ */ jsx7("pre", { className: "butex-document2-widget__raw", children: block.value })
12265
12312
  ] });
@@ -12267,7 +12314,7 @@ function BlockEditor({
12267
12314
 
12268
12315
  // src/react-document2/CitePickerPopover.tsx
12269
12316
  import { useEffect as useEffect4, useState as useState4 } from "react";
12270
- import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
12317
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
12271
12318
  function CitePickerPopover({
12272
12319
  open,
12273
12320
  references,
@@ -12292,7 +12339,7 @@ function CitePickerPopover({
12292
12339
  function toggleKey(key) {
12293
12340
  setSelected((current) => current.includes(key) ? current.filter((entry) => entry !== key) : [...current, key]);
12294
12341
  }
12295
- return /* @__PURE__ */ jsx8("div", { className: "butex-document2-widget__cite-picker-backdrop", role: "presentation", onClick: onClose, children: /* @__PURE__ */ jsxs6(
12342
+ return /* @__PURE__ */ jsx8("div", { className: "butex-document2-widget__cite-picker-backdrop", role: "presentation", onClick: onClose, children: /* @__PURE__ */ jsxs7(
12296
12343
  "div",
12297
12344
  {
12298
12345
  className: "butex-document2-widget__cite-picker",
@@ -12300,7 +12347,7 @@ function CitePickerPopover({
12300
12347
  "aria-label": messages.citePickerTitle,
12301
12348
  onClick: (event) => event.stopPropagation(),
12302
12349
  children: [
12303
- /* @__PURE__ */ jsxs6("header", { className: "butex-document2-widget__cite-picker-header", children: [
12350
+ /* @__PURE__ */ jsxs7("header", { className: "butex-document2-widget__cite-picker-header", children: [
12304
12351
  /* @__PURE__ */ jsx8("strong", { children: messages.citePickerTitle }),
12305
12352
  /* @__PURE__ */ jsx8("button", { type: "button", className: "butex-document2-widget__icon-btn", title: messages.close, "aria-label": messages.close, onClick: onClose, children: "\xD7" })
12306
12353
  ] }),
@@ -12308,10 +12355,10 @@ function CitePickerPopover({
12308
12355
  const checked = selected.includes(reference.key);
12309
12356
  const subtitle = [reference.authors, reference.title].filter(Boolean).join(" \u2014 ");
12310
12357
  const numberLabel = formatBibliographyNumber(index + 1, { documentDirection, digitForm });
12311
- return /* @__PURE__ */ jsx8("li", { children: /* @__PURE__ */ jsxs6("label", { className: "butex-document2-widget__cite-picker-item", children: [
12358
+ return /* @__PURE__ */ jsx8("li", { children: /* @__PURE__ */ jsxs7("label", { className: "butex-document2-widget__cite-picker-item", children: [
12312
12359
  /* @__PURE__ */ jsx8("input", { type: "checkbox", checked, onChange: () => toggleKey(reference.key) }),
12313
- /* @__PURE__ */ jsxs6("span", { children: [
12314
- /* @__PURE__ */ jsxs6("strong", { children: [
12360
+ /* @__PURE__ */ jsxs7("span", { children: [
12361
+ /* @__PURE__ */ jsxs7("strong", { children: [
12315
12362
  "[",
12316
12363
  numberLabel,
12317
12364
  "] ",
@@ -12321,7 +12368,7 @@ function CitePickerPopover({
12321
12368
  ] })
12322
12369
  ] }) }, reference.id);
12323
12370
  }) }),
12324
- /* @__PURE__ */ jsxs6("footer", { className: "butex-document2-widget__cite-picker-footer", children: [
12371
+ /* @__PURE__ */ jsxs7("footer", { className: "butex-document2-widget__cite-picker-footer", children: [
12325
12372
  onManageReferences ? /* @__PURE__ */ jsx8("button", { type: "button", onClick: onManageReferences, children: messages.manageReferences }) : null,
12326
12373
  /* @__PURE__ */ jsx8("button", { type: "button", onClick: onClose, children: messages.close }),
12327
12374
  /* @__PURE__ */ jsx8(
@@ -12345,7 +12392,7 @@ import { useEffect as useEffect6, useRef as useRef5, useState as useState6 } fro
12345
12392
 
12346
12393
  // src/react-document2/TableInsertPopover.tsx
12347
12394
  import { useEffect as useEffect5, useRef as useRef4, useState as useState5 } from "react";
12348
- import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
12395
+ import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
12349
12396
  function TableInsertPopover({ uiLocale = "ar", onConfirm }) {
12350
12397
  const messages = document2Messages(uiLocale);
12351
12398
  const [open, setOpen] = useState5(false);
@@ -12370,7 +12417,7 @@ function TableInsertPopover({ uiLocale = "ar", onConfirm }) {
12370
12417
  onConfirm(rowCount, colCount);
12371
12418
  setOpen(false);
12372
12419
  }
12373
- return /* @__PURE__ */ jsxs7("div", { className: "butex-document2-widget__table-popover", ref: rootRef, children: [
12420
+ return /* @__PURE__ */ jsxs8("div", { className: "butex-document2-widget__table-popover", ref: rootRef, children: [
12374
12421
  /* @__PURE__ */ jsx9(
12375
12422
  "button",
12376
12423
  {
@@ -12384,12 +12431,12 @@ function TableInsertPopover({ uiLocale = "ar", onConfirm }) {
12384
12431
  children: "\u229E"
12385
12432
  }
12386
12433
  ),
12387
- open ? /* @__PURE__ */ jsxs7("div", { className: "butex-document2-widget__table-popover-panel", role: "dialog", "aria-label": messages.tableSize, children: [
12388
- /* @__PURE__ */ jsxs7("label", { children: [
12434
+ open ? /* @__PURE__ */ jsxs8("div", { className: "butex-document2-widget__table-popover-panel", role: "dialog", "aria-label": messages.tableSize, children: [
12435
+ /* @__PURE__ */ jsxs8("label", { children: [
12389
12436
  messages.rows,
12390
12437
  /* @__PURE__ */ jsx9("input", { type: "number", min: 1, max: 20, value: rows, onChange: (event) => setRows(event.currentTarget.value) })
12391
12438
  ] }),
12392
- /* @__PURE__ */ jsxs7("label", { children: [
12439
+ /* @__PURE__ */ jsxs8("label", { children: [
12393
12440
  messages.columns,
12394
12441
  /* @__PURE__ */ jsx9("input", { type: "number", min: 1, max: 10, value: cols, onChange: (event) => setCols(event.currentTarget.value) })
12395
12442
  ] }),
@@ -12399,7 +12446,7 @@ function TableInsertPopover({ uiLocale = "ar", onConfirm }) {
12399
12446
  }
12400
12447
 
12401
12448
  // src/react-document2/DocumentInsertToolbar.tsx
12402
- import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
12449
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
12403
12450
  var DIGIT_FORMS = ["western", "arabicIndic", "persianIndic"];
12404
12451
  function digitFormLabel(digitForm) {
12405
12452
  if (digitForm === "arabicIndic") {
@@ -12506,12 +12553,12 @@ function DocumentInsertToolbar({
12506
12553
  }
12507
12554
  return messages.westernDigits;
12508
12555
  }
12509
- return /* @__PURE__ */ jsxs8("div", { className: "butex-document2-widget__toolbar-insert", children: [
12510
- /* @__PURE__ */ jsxs8("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.undoRedo, children: [
12556
+ return /* @__PURE__ */ jsxs9("div", { className: "butex-document2-widget__toolbar-insert", children: [
12557
+ /* @__PURE__ */ jsxs9("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.undoRedo, children: [
12511
12558
  /* @__PURE__ */ jsx10("button", { type: "button", className: "butex-document2-widget__icon-btn", title: `${messages.undo} (Ctrl+Z)`, "aria-label": messages.undo, disabled: !canUndo, onClick: onUndo, children: "\u21B6" }),
12512
12559
  /* @__PURE__ */ jsx10("button", { type: "button", className: "butex-document2-widget__icon-btn", title: `${messages.redo} (Ctrl+Shift+Z)`, "aria-label": messages.redo, disabled: !canRedo, onClick: onRedo, children: "\u21B7" })
12513
12560
  ] }),
12514
- /* @__PURE__ */ jsxs8("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.blockSelection, children: [
12561
+ /* @__PURE__ */ jsxs9("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.blockSelection, children: [
12515
12562
  /* @__PURE__ */ jsx10(
12516
12563
  "button",
12517
12564
  {
@@ -12548,13 +12595,13 @@ function DocumentInsertToolbar({
12548
12595
  children: messages.deleteBlock
12549
12596
  }
12550
12597
  ),
12551
- selectionCount > 0 ? /* @__PURE__ */ jsxs8("span", { className: "butex-document2-widget__selection-count", children: [
12598
+ selectionCount > 0 ? /* @__PURE__ */ jsxs9("span", { className: "butex-document2-widget__selection-count", children: [
12552
12599
  selectionCount,
12553
12600
  " ",
12554
12601
  messages.selectedBlockCount
12555
12602
  ] }) : null
12556
12603
  ] }),
12557
- /* @__PURE__ */ jsxs8("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.textFormatting, children: [
12604
+ /* @__PURE__ */ jsxs9("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.textFormatting, children: [
12558
12605
  /* @__PURE__ */ jsx10(
12559
12606
  "button",
12560
12607
  {
@@ -12598,7 +12645,7 @@ function DocumentInsertToolbar({
12598
12645
  }
12599
12646
  )
12600
12647
  ] }),
12601
- /* @__PURE__ */ jsxs8("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.structure, children: [
12648
+ /* @__PURE__ */ jsxs9("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.structure, children: [
12602
12649
  /* @__PURE__ */ jsx10(
12603
12650
  "button",
12604
12651
  {
@@ -12615,10 +12662,10 @@ function DocumentInsertToolbar({
12615
12662
  /* @__PURE__ */ jsx10("button", { type: "button", className: "butex-document2-widget__icon-btn butex-document2-widget__icon-btn--h3", title: messages.addSubsubsection, "aria-label": messages.addSubsubsection, onClick: onAddSubsubsection, children: messages.subsubsectionGlyph }),
12616
12663
  /* @__PURE__ */ jsx10("button", { type: "button", className: "butex-document2-widget__icon-btn", title: messages.addParagraph, "aria-label": messages.addParagraph, onClick: onAddParagraph, children: messages.paragraphGlyph })
12617
12664
  ] }),
12618
- /* @__PURE__ */ jsxs8("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.equations, children: [
12665
+ /* @__PURE__ */ jsxs9("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.equations, children: [
12619
12666
  /* @__PURE__ */ jsx10("button", { type: "button", className: "butex-document2-widget__icon-btn", title: `${messages.inlineEquation} ($\u2026$)`, "aria-label": messages.inlineEquation, disabled: !editableEquations, onClick: onAddInlineEquation, children: /* @__PURE__ */ jsx10("span", { className: "butex-document2-widget__icon-math-inline", "aria-hidden": "true", children: "$=$" }) }),
12620
12667
  /* @__PURE__ */ jsx10("button", { type: "button", className: "butex-document2-widget__icon-btn", title: `${messages.displayEquation} (\\[\u2026\\])`, "aria-label": messages.displayEquation, disabled: !editableEquations, onClick: onAddDisplayEquation, children: /* @__PURE__ */ jsx10("span", { className: "butex-document2-widget__icon-math-display", "aria-hidden": "true", children: "\\[\xF7\\]" }) }),
12621
- /* @__PURE__ */ jsxs8("div", { className: "butex-document2-widget__digit-form-menu", children: [
12668
+ /* @__PURE__ */ jsxs9("div", { className: "butex-document2-widget__digit-form-menu", children: [
12622
12669
  /* @__PURE__ */ jsx10(
12623
12670
  "button",
12624
12671
  {
@@ -12649,8 +12696,8 @@ function DocumentInsertToolbar({
12649
12696
  )) }) : null
12650
12697
  ] })
12651
12698
  ] }),
12652
- /* @__PURE__ */ jsx10("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.citations, children: /* @__PURE__ */ jsxs8("div", { className: "butex-document2-widget__references-menu", ref: referencesMenuRef, children: [
12653
- /* @__PURE__ */ jsxs8(
12699
+ /* @__PURE__ */ jsx10("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.citations, children: /* @__PURE__ */ jsxs9("div", { className: "butex-document2-widget__references-menu", ref: referencesMenuRef, children: [
12700
+ /* @__PURE__ */ jsxs9(
12654
12701
  "button",
12655
12702
  {
12656
12703
  ref: referencesTriggerRef,
@@ -12668,7 +12715,7 @@ function DocumentInsertToolbar({
12668
12715
  ]
12669
12716
  }
12670
12717
  ),
12671
- referencesMenuOpen ? /* @__PURE__ */ jsxs8(
12718
+ referencesMenuOpen ? /* @__PURE__ */ jsxs9(
12672
12719
  "div",
12673
12720
  {
12674
12721
  className: "butex-document2-widget__references-menu-options",
@@ -12676,23 +12723,23 @@ function DocumentInsertToolbar({
12676
12723
  "aria-label": messages.citations,
12677
12724
  onKeyDown: moveReferenceMenuFocus,
12678
12725
  children: [
12679
- /* @__PURE__ */ jsxs8("button", { type: "button", role: "menuitem", title: messages.insertCitation, onClick: () => runReferenceAction(onInsertCitation), children: [
12726
+ /* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", title: messages.insertCitation, onClick: () => runReferenceAction(onInsertCitation), children: [
12680
12727
  /* @__PURE__ */ jsx10("span", { "aria-hidden": "true", children: "[]" }),
12681
12728
  /* @__PURE__ */ jsx10("span", { children: messages.insertCitation })
12682
12729
  ] }),
12683
- /* @__PURE__ */ jsxs8("button", { type: "button", role: "menuitem", title: messages.insertInternalRef, onClick: () => runReferenceAction(onInsertInternalRef), children: [
12730
+ /* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", title: messages.insertInternalRef, onClick: () => runReferenceAction(onInsertInternalRef), children: [
12684
12731
  /* @__PURE__ */ jsx10("span", { "aria-hidden": "true", children: "\xA7" }),
12685
12732
  /* @__PURE__ */ jsx10("span", { children: messages.insertInternalRef })
12686
12733
  ] }),
12687
- /* @__PURE__ */ jsxs8("button", { type: "button", role: "menuitem", title: messages.insertBibliography, onClick: () => runReferenceAction(onInsertBibliography), children: [
12734
+ /* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", title: messages.insertBibliography, onClick: () => runReferenceAction(onInsertBibliography), children: [
12688
12735
  /* @__PURE__ */ jsx10("span", { className: "butex-document2-widget__icon-bibliography", "aria-hidden": "true", children: /* @__PURE__ */ jsx10("svg", { viewBox: "0 0 16 16", width: "14", height: "14", focusable: "false", children: /* @__PURE__ */ jsx10("path", { fill: "currentColor", d: "M2.2 2.4h7.2c.9 0 1.6.7 1.6 1.6v9.2c0 .5-.6.8-1 .5l-2.2-1.6H2.2c-.9 0-1.6-.7-1.6-1.6V4c0-.9.7-1.6 1.6-1.6zm0 1.2c-.2 0-.4.2-.4.4v6.5c0 .2.2.4.4.4h6.1l1.5 1.1V4c0-.2-.2-.4-.4-.4H2.2zM3.4 5.2h5.2v1H3.4zm0 2.1h4.2v1H3.4zm0 2.1h3.4v1H3.4zM11.4 4.1h2.2c.8 0 1.4.6 1.4 1.4v7.1c0 .4-.5.7-.8.4l-1.7-1.3h-1.1V4.1zm1.2 1.2v5.4l.7.5V5.5c0-.1-.1-.2-.2-.2h-.5z" }) }) }),
12689
12736
  /* @__PURE__ */ jsx10("span", { children: messages.insertBibliography })
12690
12737
  ] }),
12691
- /* @__PURE__ */ jsxs8("button", { type: "button", role: "menuitem", title: messages.manageReferences, onClick: () => runReferenceAction(onManageReferences), children: [
12738
+ /* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", title: messages.manageReferences, onClick: () => runReferenceAction(onManageReferences), children: [
12692
12739
  /* @__PURE__ */ jsx10("span", { "aria-hidden": "true", children: "\u2630" }),
12693
12740
  /* @__PURE__ */ jsx10("span", { children: messages.manageReferences })
12694
12741
  ] }),
12695
- /* @__PURE__ */ jsxs8("button", { type: "button", role: "menuitem", title: messages.manageLabels, onClick: () => runReferenceAction(onManageLabels), children: [
12742
+ /* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", title: messages.manageLabels, onClick: () => runReferenceAction(onManageLabels), children: [
12696
12743
  /* @__PURE__ */ jsx10("span", { "aria-hidden": "true", children: "\u2317" }),
12697
12744
  /* @__PURE__ */ jsx10("span", { children: messages.manageLabels })
12698
12745
  ] })
@@ -12700,7 +12747,7 @@ function DocumentInsertToolbar({
12700
12747
  }
12701
12748
  ) : null
12702
12749
  ] }) }),
12703
- /* @__PURE__ */ jsxs8("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.lists, children: [
12750
+ /* @__PURE__ */ jsxs9("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.lists, children: [
12704
12751
  /* @__PURE__ */ jsx10("button", { type: "button", className: "butex-document2-widget__icon-btn", title: messages.bulletedList, "aria-label": messages.bulletedList, onClick: onAddList, children: "\u2022\u2261" }),
12705
12752
  /* @__PURE__ */ jsx10("button", { type: "button", className: "butex-document2-widget__icon-btn", title: messages.numberedList, "aria-label": messages.numberedList, onClick: onAddEnumerate, children: "1." })
12706
12753
  ] }),
@@ -12710,9 +12757,9 @@ function DocumentInsertToolbar({
12710
12757
  }
12711
12758
 
12712
12759
  // src/react-document2/DocumentPreview.tsx
12713
- import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
12760
+ import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
12714
12761
  function PreviewInlines({ inlines, output }) {
12715
- return /* @__PURE__ */ jsx11(Fragment2, { children: inlines.map((inline, index) => {
12762
+ return /* @__PURE__ */ jsx11(Fragment3, { children: inlines.map((inline, index) => {
12716
12763
  if (inline.kind === "text") {
12717
12764
  let content = /* @__PURE__ */ jsx11("span", { children: inline.text });
12718
12765
  if (inline.style?.bold) {
@@ -12753,8 +12800,8 @@ function PreviewBlock({
12753
12800
  if (!numberLabel && !caption) {
12754
12801
  return null;
12755
12802
  }
12756
- return /* @__PURE__ */ jsxs9("figcaption", { dir: documentDirection, children: [
12757
- numberLabel ? /* @__PURE__ */ jsxs9("span", { className: "butex-document2-widget__preview-float-number", children: [
12803
+ return /* @__PURE__ */ jsxs10("figcaption", { dir: documentDirection, children: [
12804
+ numberLabel ? /* @__PURE__ */ jsxs10("span", { className: "butex-document2-widget__preview-float-number", children: [
12758
12805
  numberLabel,
12759
12806
  caption ? floatCaptionSeparator : ""
12760
12807
  ] }) : null,
@@ -12771,9 +12818,9 @@ function PreviewBlock({
12771
12818
  );
12772
12819
  }
12773
12820
  if (block.kind === "titleBlock") {
12774
- return /* @__PURE__ */ jsxs9("header", { className: "butex-document2-widget__preview-title-block", children: [
12821
+ return /* @__PURE__ */ jsxs10("header", { className: "butex-document2-widget__preview-title-block", children: [
12775
12822
  block.title ? /* @__PURE__ */ jsx11("h1", { className: "butex-document2-widget__preview-article-title", children: block.title }) : null,
12776
- block.authors ? /* @__PURE__ */ jsx11("p", { className: "butex-document2-widget__preview-article-authors", children: block.authors.split("\n").map((line, index) => /* @__PURE__ */ jsxs9("span", { children: [
12823
+ block.authors ? /* @__PURE__ */ jsx11("p", { className: "butex-document2-widget__preview-article-authors", children: block.authors.split("\n").map((line, index) => /* @__PURE__ */ jsxs10("span", { children: [
12777
12824
  index > 0 ? /* @__PURE__ */ jsx11("br", {}) : null,
12778
12825
  line
12779
12826
  ] }, index)) }) : null,
@@ -12781,7 +12828,7 @@ function PreviewBlock({
12781
12828
  ] });
12782
12829
  }
12783
12830
  if (block.kind === "abstract") {
12784
- return /* @__PURE__ */ jsxs9("section", { className: "butex-document2-widget__preview-abstract", "aria-label": messages.articleAbstract, children: [
12831
+ return /* @__PURE__ */ jsxs10("section", { className: "butex-document2-widget__preview-abstract", "aria-label": messages.articleAbstract, children: [
12785
12832
  /* @__PURE__ */ jsx11("h2", { className: "butex-document2-widget__preview-abstract-label", children: messages.articleAbstract }),
12786
12833
  /* @__PURE__ */ jsx11("p", { children: block.text })
12787
12834
  ] });
@@ -12795,7 +12842,7 @@ function PreviewBlock({
12795
12842
  }
12796
12843
  if (block.kind === "list") {
12797
12844
  const Tag = block.ordered ? "ol" : "ul";
12798
- return /* @__PURE__ */ jsx11(Tag, { "data-butex-block-source": source, children: block.items.map((item) => /* @__PURE__ */ jsxs9("li", { children: [
12845
+ return /* @__PURE__ */ jsx11(Tag, { "data-butex-block-source": source, children: block.items.map((item) => /* @__PURE__ */ jsxs10("li", { children: [
12799
12846
  /* @__PURE__ */ jsx11(PreviewInlines, { inlines: item.inlines, output }),
12800
12847
  item.blocks.map((child) => /* @__PURE__ */ jsx11(
12801
12848
  PreviewBlock,
@@ -12815,28 +12862,28 @@ function PreviewBlock({
12815
12862
  return null;
12816
12863
  }
12817
12864
  if (block.kind === "table") {
12818
- return /* @__PURE__ */ jsxs9("figure", { className: "butex-document2-widget__preview-float", "data-butex-block-source": source, children: [
12865
+ return /* @__PURE__ */ jsxs10("figure", { className: "butex-document2-widget__preview-float", "data-butex-block-source": source, children: [
12819
12866
  /* @__PURE__ */ jsx11("table", { children: /* @__PURE__ */ jsx11("tbody", { children: block.rows.map((row, rowIndex) => /* @__PURE__ */ jsx11("tr", { children: row.map((cell, columnIndex) => /* @__PURE__ */ jsx11("td", { children: /* @__PURE__ */ jsx11(PreviewInlines, { inlines: cell, output }) }, columnIndex)) }, rowIndex)) }) }),
12820
12867
  /* @__PURE__ */ jsx11(FloatCaption, { numberLabel: block.numberLabel, caption: block.caption })
12821
12868
  ] });
12822
12869
  }
12823
12870
  if (block.kind === "image") {
12824
12871
  const src = resolveImageUrl ? resolveImageUrl({ assetId: block.assetId, value: block.src }) : block.src;
12825
- return /* @__PURE__ */ jsxs9("figure", { className: "butex-document2-widget__preview-float", "data-butex-block-source": source, children: [
12872
+ return /* @__PURE__ */ jsxs10("figure", { className: "butex-document2-widget__preview-float", "data-butex-block-source": source, children: [
12826
12873
  /* @__PURE__ */ jsx11("img", { src, alt: block.caption ?? "" }),
12827
12874
  /* @__PURE__ */ jsx11(FloatCaption, { numberLabel: block.numberLabel, caption: block.caption })
12828
12875
  ] });
12829
12876
  }
12830
12877
  if (block.kind === "bibliography") {
12831
- return /* @__PURE__ */ jsx11("ol", { className: "butex-document2-widget__preview-bibliography", "data-butex-block-source": source, children: block.items.map((item) => /* @__PURE__ */ jsxs9("li", { children: [
12832
- /* @__PURE__ */ jsxs9("span", { className: "butex-document2-widget__preview-bib-number", children: [
12878
+ return /* @__PURE__ */ jsx11("ol", { className: "butex-document2-widget__preview-bibliography", "data-butex-block-source": source, children: block.items.map((item) => /* @__PURE__ */ jsxs10("li", { children: [
12879
+ /* @__PURE__ */ jsxs10("span", { className: "butex-document2-widget__preview-bib-number", children: [
12833
12880
  item.numberLabel,
12834
12881
  "."
12835
12882
  ] }),
12836
12883
  " ",
12837
- /* @__PURE__ */ jsxs9("span", { children: [
12884
+ /* @__PURE__ */ jsxs10("span", { children: [
12838
12885
  bibliographyEntryBody(item, item.fieldSeparator, { digitForm }),
12839
- item.url ? /* @__PURE__ */ jsxs9(Fragment2, { children: [
12886
+ item.url ? /* @__PURE__ */ jsxs10(Fragment3, { children: [
12840
12887
  " ",
12841
12888
  /* @__PURE__ */ jsx11("a", { href: absoluteHttpHref(item.url), target: "_blank", rel: "noreferrer", children: item.url })
12842
12889
  ] }) : null
@@ -12856,7 +12903,7 @@ function DocumentPreview({
12856
12903
  const messages = document2Messages(uiLocale);
12857
12904
  const resolvedDigitForm = digitForm ?? (documentDirection === "rtl" ? "arabicIndic" : "western");
12858
12905
  const hasBody = blocks.some(isBodyPreviewBlock);
12859
- return /* @__PURE__ */ jsxs9("div", { className: "butex-document2-widget__preview", dir: documentDirection, children: [
12906
+ return /* @__PURE__ */ jsxs10("div", { className: "butex-document2-widget__preview", dir: documentDirection, children: [
12860
12907
  blocks.map((block) => /* @__PURE__ */ jsx11(
12861
12908
  PreviewBlock,
12862
12909
  {
@@ -13886,7 +13933,7 @@ function injectWidgetChromeCss(doc) {
13886
13933
  }
13887
13934
 
13888
13935
  // src/react/ButexEditor.tsx
13889
- import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
13936
+ import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
13890
13937
  var DIGIT_FORM_OPTIONS = [
13891
13938
  { id: "western", label: "456" },
13892
13939
  { id: "arabicIndic", label: "\u0664\u0665\u0666" },
@@ -13962,7 +14009,7 @@ function renderArabicCommandLabel(command) {
13962
14009
  if (command.id !== "ln") {
13963
14010
  return command.arabicLabel;
13964
14011
  }
13965
- return /* @__PURE__ */ jsxs10("span", { className: "function-command-label-with-sub", "aria-hidden": "true", children: [
14012
+ return /* @__PURE__ */ jsxs11("span", { className: "function-command-label-with-sub", "aria-hidden": "true", children: [
13966
14013
  /* @__PURE__ */ jsx12("span", { className: "function-command-label-with-sub__base", children: command.arabicLabel }),
13967
14014
  /* @__PURE__ */ jsx12("span", { className: "function-command-label-with-sub__sub", children: "\u0647\u0640" })
13968
14015
  ] });
@@ -14240,14 +14287,14 @@ ${arabic || currentMessages.empty}`;
14240
14287
  className: `butex-widget ${className ?? ""}`.trim(),
14241
14288
  dir: uiLocaleDirection(uiLocale),
14242
14289
  lang: uiLocale,
14243
- children: /* @__PURE__ */ jsxs10("div", { className: "butex-widget-layout", children: [
14244
- /* @__PURE__ */ jsxs10("section", { className: "panel", children: [
14245
- /* @__PURE__ */ jsxs10("div", { className: "toolbar", children: [
14246
- /* @__PURE__ */ jsxs10("div", { className: "toolbar-group toolbar-history", role: "group", "aria-label": messages.undoRedo, children: [
14290
+ children: /* @__PURE__ */ jsxs11("div", { className: "butex-widget-layout", children: [
14291
+ /* @__PURE__ */ jsxs11("section", { className: "panel", children: [
14292
+ /* @__PURE__ */ jsxs11("div", { className: "toolbar", children: [
14293
+ /* @__PURE__ */ jsxs11("div", { className: "toolbar-group toolbar-history", role: "group", "aria-label": messages.undoRedo, children: [
14247
14294
  /* @__PURE__ */ jsx12("button", { ref: undoBtnRef, id: "btn-undo", type: "button", className: "icon-btn", title: messages.undo, "aria-label": messages.undo, children: "\u21B7" }),
14248
14295
  /* @__PURE__ */ jsx12("button", { ref: redoBtnRef, id: "btn-redo", type: "button", className: "icon-btn", title: messages.redo, "aria-label": messages.redo, children: "\u21B6" })
14249
14296
  ] }),
14250
- /* @__PURE__ */ jsxs10("div", { className: "toolbar-group toolbar-clipboard", role: "group", "aria-label": messages.clipboard, children: [
14297
+ /* @__PURE__ */ jsxs11("div", { className: "toolbar-group toolbar-clipboard", role: "group", "aria-label": messages.clipboard, children: [
14251
14298
  /* @__PURE__ */ jsx12("button", { ref: copyBtnRef, id: "btn-copy", type: "button", className: "icon-btn", title: messages.copy, "aria-label": messages.copy, disabled: true, children: "\u29C9" }),
14252
14299
  /* @__PURE__ */ jsx12("button", { ref: cutBtnRef, id: "btn-cut", type: "button", className: "icon-btn", title: messages.cut, "aria-label": messages.cut, disabled: true, children: "\u2702" }),
14253
14300
  /* @__PURE__ */ jsx12(
@@ -14268,8 +14315,8 @@ ${arabic || currentMessages.empty}`;
14268
14315
  )
14269
14316
  ] }),
14270
14317
  /* @__PURE__ */ jsx12("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": messages.editorSettings, children: /* @__PURE__ */ jsx12("button", { className: "icon-btn accent", type: "button", title: messages.toggleSide, "aria-label": messages.toggleSide, onClick: () => runtimeRef.current?.toggleSide(), children: "\u21C4" }) }),
14271
- /* @__PURE__ */ jsxs10("div", { className: "toolbar-group toolbar-structures", role: "group", "aria-label": messages.structures, children: [
14272
- /* @__PURE__ */ jsxs10(
14318
+ /* @__PURE__ */ jsxs11("div", { className: "toolbar-group toolbar-structures", role: "group", "aria-label": messages.structures, children: [
14319
+ /* @__PURE__ */ jsxs11(
14273
14320
  "div",
14274
14321
  {
14275
14322
  className: "delimiter-command-menu",
@@ -14293,7 +14340,7 @@ ${arabic || currentMessages.empty}`;
14293
14340
  children: "()"
14294
14341
  }
14295
14342
  ),
14296
- /* @__PURE__ */ jsxs10("div", { className: "delimiter-command-options", role: "listbox", "aria-label": messages.insertDelimiters, hidden: !delimiterMenuOpen, children: [
14343
+ /* @__PURE__ */ jsxs11("div", { className: "delimiter-command-options", role: "listbox", "aria-label": messages.insertDelimiters, hidden: !delimiterMenuOpen, children: [
14297
14344
  /* @__PURE__ */ jsx12(
14298
14345
  "button",
14299
14346
  {
@@ -14355,7 +14402,7 @@ ${arabic || currentMessages.empty}`;
14355
14402
  /* @__PURE__ */ jsx12("button", { id: "insert-frac", className: "icon-btn frac-icon-btn", type: "button", title: messages.insertFraction, "aria-label": messages.insertFraction, onClick: () => {
14356
14403
  runtimeRef.current?.insertFraction();
14357
14404
  focusSurface();
14358
- }, children: /* @__PURE__ */ jsxs10("span", { className: "toolbar-frac-icon", "aria-hidden": "true", children: [
14405
+ }, children: /* @__PURE__ */ jsxs11("span", { className: "toolbar-frac-icon", "aria-hidden": "true", children: [
14359
14406
  /* @__PURE__ */ jsx12("span", { children: "\u0623" }),
14360
14407
  /* @__PURE__ */ jsx12("span", { children: "\u0628" })
14361
14408
  ] }) }),
@@ -14366,26 +14413,26 @@ ${arabic || currentMessages.empty}`;
14366
14413
  /* @__PURE__ */ jsx12("button", { id: "insert-overset", className: "icon-btn", type: "button", title: messages.insertOverset, "aria-label": messages.insertOverset, onClick: () => {
14367
14414
  runtimeRef.current?.insertOverset();
14368
14415
  focusSurface();
14369
- }, children: /* @__PURE__ */ jsxs10("span", { className: "toolbar-accent-icon toolbar-accent-icon--over", "aria-hidden": "true", children: [
14416
+ }, children: /* @__PURE__ */ jsxs11("span", { className: "toolbar-accent-icon toolbar-accent-icon--over", "aria-hidden": "true", children: [
14370
14417
  /* @__PURE__ */ jsx12("span", { children: "\u2217" }),
14371
14418
  /* @__PURE__ */ jsx12("span", { children: "\u25A1" })
14372
14419
  ] }) }),
14373
14420
  /* @__PURE__ */ jsx12("button", { id: "insert-underset", className: "icon-btn", type: "button", title: messages.insertUnderset, "aria-label": messages.insertUnderset, onClick: () => {
14374
14421
  runtimeRef.current?.insertUnderset();
14375
14422
  focusSurface();
14376
- }, children: /* @__PURE__ */ jsxs10("span", { className: "toolbar-accent-icon toolbar-accent-icon--under", "aria-hidden": "true", children: [
14423
+ }, children: /* @__PURE__ */ jsxs11("span", { className: "toolbar-accent-icon toolbar-accent-icon--under", "aria-hidden": "true", children: [
14377
14424
  /* @__PURE__ */ jsx12("span", { children: "\u25A1" }),
14378
14425
  /* @__PURE__ */ jsx12("span", { children: "\u2217" })
14379
14426
  ] }) }),
14380
14427
  /* @__PURE__ */ jsx12("button", { id: "insert-accent-pair", className: "icon-btn", type: "button", title: messages.insertAccentPair, "aria-label": messages.insertAccentPair, onClick: () => {
14381
14428
  runtimeRef.current?.insertAccentPair();
14382
14429
  focusSurface();
14383
- }, children: /* @__PURE__ */ jsxs10("span", { className: "toolbar-accent-icon toolbar-accent-icon--pair", "aria-hidden": "true", children: [
14430
+ }, children: /* @__PURE__ */ jsxs11("span", { className: "toolbar-accent-icon toolbar-accent-icon--pair", "aria-hidden": "true", children: [
14384
14431
  /* @__PURE__ */ jsx12("span", { children: "\u2217" }),
14385
14432
  /* @__PURE__ */ jsx12("span", { children: "\u25A1" }),
14386
14433
  /* @__PURE__ */ jsx12("span", { children: "\u2217" })
14387
14434
  ] }) }),
14388
- /* @__PURE__ */ jsxs10(
14435
+ /* @__PURE__ */ jsxs11(
14389
14436
  "div",
14390
14437
  {
14391
14438
  className: "function-command-menu operator-command-menu",
@@ -14407,7 +14454,7 @@ ${arabic || currentMessages.empty}`;
14407
14454
  "aria-haspopup": "listbox",
14408
14455
  "aria-expanded": accentMenuOpen,
14409
14456
  onClick: () => setAccentMenuOpen((open) => !open),
14410
- children: /* @__PURE__ */ jsxs10("span", { className: "toolbar-accent-icon toolbar-accent-icon--over", "aria-hidden": "true", children: [
14457
+ children: /* @__PURE__ */ jsxs11("span", { className: "toolbar-accent-icon toolbar-accent-icon--over", "aria-hidden": "true", children: [
14411
14458
  /* @__PURE__ */ jsx12("span", { children: "\u02C6" }),
14412
14459
  /* @__PURE__ */ jsx12("span", { children: "\u25A1" })
14413
14460
  ] })
@@ -14435,7 +14482,7 @@ ${arabic || currentMessages.empty}`;
14435
14482
  }
14436
14483
  )
14437
14484
  ] }),
14438
- /* @__PURE__ */ jsx12("div", { className: "toolbar-group toolbar-environments", role: "group", "aria-label": messages.environments, children: /* @__PURE__ */ jsxs10(
14485
+ /* @__PURE__ */ jsx12("div", { className: "toolbar-group toolbar-environments", role: "group", "aria-label": messages.environments, children: /* @__PURE__ */ jsxs11(
14439
14486
  "div",
14440
14487
  {
14441
14488
  className: "matrix-command-menu",
@@ -14456,7 +14503,7 @@ ${arabic || currentMessages.empty}`;
14456
14503
  "aria-haspopup": "dialog",
14457
14504
  "aria-expanded": matrixMenuOpen,
14458
14505
  onClick: () => setMatrixMenuOpen((open) => !open),
14459
- children: /* @__PURE__ */ jsxs10("span", { className: "toolbar-matrix-icon", "aria-hidden": "true", children: [
14506
+ children: /* @__PURE__ */ jsxs11("span", { className: "toolbar-matrix-icon", "aria-hidden": "true", children: [
14460
14507
  /* @__PURE__ */ jsx12("span", {}),
14461
14508
  /* @__PURE__ */ jsx12("span", {}),
14462
14509
  /* @__PURE__ */ jsx12("span", {}),
@@ -14464,7 +14511,7 @@ ${arabic || currentMessages.empty}`;
14464
14511
  ] })
14465
14512
  }
14466
14513
  ),
14467
- /* @__PURE__ */ jsxs10("div", { className: "matrix-command-popover", role: "dialog", "aria-label": messages.insertEnvironment, hidden: !matrixMenuOpen, children: [
14514
+ /* @__PURE__ */ jsxs11("div", { className: "matrix-command-popover", role: "dialog", "aria-label": messages.insertEnvironment, hidden: !matrixMenuOpen, children: [
14468
14515
  /* @__PURE__ */ jsx12("div", { className: "matrix-style-options", role: "listbox", "aria-label": messages.environmentType, children: [
14469
14516
  { id: "matrix", label: messages.matrix },
14470
14517
  { id: "array", label: messages.array },
@@ -14533,8 +14580,8 @@ ${arabic || currentMessages.empty}`;
14533
14580
  );
14534
14581
  })
14535
14582
  ) }),
14536
- /* @__PURE__ */ jsxs10("div", { className: "matrix-custom-size", children: [
14537
- /* @__PURE__ */ jsxs10("label", { children: [
14583
+ /* @__PURE__ */ jsxs11("div", { className: "matrix-custom-size", children: [
14584
+ /* @__PURE__ */ jsxs11("label", { children: [
14538
14585
  messages.row,
14539
14586
  /* @__PURE__ */ jsx12(
14540
14587
  "input",
@@ -14547,7 +14594,7 @@ ${arabic || currentMessages.empty}`;
14547
14594
  }
14548
14595
  )
14549
14596
  ] }),
14550
- /* @__PURE__ */ jsxs10("label", { children: [
14597
+ /* @__PURE__ */ jsxs11("label", { children: [
14551
14598
  messages.column,
14552
14599
  /* @__PURE__ */ jsx12(
14553
14600
  "input",
@@ -14578,10 +14625,10 @@ ${arabic || currentMessages.empty}`;
14578
14625
  }
14579
14626
  )
14580
14627
  ] }),
14581
- /* @__PURE__ */ jsxs10("div", { className: "matrix-edit-actions", "aria-label": messages.editSelectedEnvironment, children: [
14628
+ /* @__PURE__ */ jsxs11("div", { className: "matrix-edit-actions", "aria-label": messages.editSelectedEnvironment, children: [
14582
14629
  envPaletteMode === "matrix" ? /* @__PURE__ */ jsx12("button", { type: "button", title: messages.applySelectedMatrixStyle, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.setMatrixEnvStyle(matrixStyle), children: messages.applyStyle }) : null,
14583
- envPaletteMode === "array" ? /* @__PURE__ */ jsxs10(Fragment3, { children: [
14584
- /* @__PURE__ */ jsxs10("label", { children: [
14630
+ envPaletteMode === "array" ? /* @__PURE__ */ jsxs11(Fragment4, { children: [
14631
+ /* @__PURE__ */ jsxs11("label", { children: [
14585
14632
  messages.column,
14586
14633
  /* @__PURE__ */ jsx12(
14587
14634
  "input",
@@ -14606,19 +14653,19 @@ ${arabic || currentMessages.empty}`;
14606
14653
  alignment.id
14607
14654
  ))
14608
14655
  ] }) : null,
14609
- /* @__PURE__ */ jsxs10("button", { type: "button", title: messages.addRow, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.addMatrixRow(), children: [
14656
+ /* @__PURE__ */ jsxs11("button", { type: "button", title: messages.addRow, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.addMatrixRow(), children: [
14610
14657
  "+",
14611
14658
  messages.row
14612
14659
  ] }),
14613
- /* @__PURE__ */ jsxs10("button", { type: "button", title: messages.removeRow, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.removeMatrixRow(), children: [
14660
+ /* @__PURE__ */ jsxs11("button", { type: "button", title: messages.removeRow, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.removeMatrixRow(), children: [
14614
14661
  "-",
14615
14662
  messages.row
14616
14663
  ] }),
14617
- /* @__PURE__ */ jsxs10("button", { type: "button", title: messages.addColumn, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.addMatrixColumn(), children: [
14664
+ /* @__PURE__ */ jsxs11("button", { type: "button", title: messages.addColumn, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.addMatrixColumn(), children: [
14618
14665
  "+",
14619
14666
  messages.column
14620
14667
  ] }),
14621
- /* @__PURE__ */ jsxs10("button", { type: "button", title: messages.removeColumn, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.removeMatrixColumn(), children: [
14668
+ /* @__PURE__ */ jsxs11("button", { type: "button", title: messages.removeColumn, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.removeMatrixColumn(), children: [
14622
14669
  "-",
14623
14670
  messages.column
14624
14671
  ] })
@@ -14627,7 +14674,7 @@ ${arabic || currentMessages.empty}`;
14627
14674
  ]
14628
14675
  }
14629
14676
  ) }),
14630
- /* @__PURE__ */ jsx12("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": messages.spaces, children: /* @__PURE__ */ jsxs10(
14677
+ /* @__PURE__ */ jsx12("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": messages.spaces, children: /* @__PURE__ */ jsxs11(
14631
14678
  "div",
14632
14679
  {
14633
14680
  className: `spacing-command-menu spacing-command-menu--${activeEditorSide}`,
@@ -14648,13 +14695,13 @@ ${arabic || currentMessages.empty}`;
14648
14695
  "aria-haspopup": "listbox",
14649
14696
  "aria-expanded": spacingMenuOpen,
14650
14697
  onClick: () => setSpacingMenuOpen((open) => !open),
14651
- children: /* @__PURE__ */ jsxs10("span", { className: "spacing-command-glyph spacing-command-glyph--positive spacing-command-glyph--level-2", "aria-hidden": "true", children: [
14698
+ children: /* @__PURE__ */ jsxs11("span", { className: "spacing-command-glyph spacing-command-glyph--positive spacing-command-glyph--level-2", "aria-hidden": "true", children: [
14652
14699
  /* @__PURE__ */ jsx12("span", { className: "spacing-command-glyph__bar" }),
14653
14700
  /* @__PURE__ */ jsx12("span", { className: "spacing-command-glyph__arrow", children: activeEditorSide === "arabic" ? "\u2190" : "\u2192" })
14654
14701
  ] })
14655
14702
  }
14656
14703
  ),
14657
- /* @__PURE__ */ jsx12("div", { className: "spacing-command-options", role: "listbox", "aria-label": messages.insertSpace, hidden: !spacingMenuOpen, children: SPACING_COMMANDS.map((command) => /* @__PURE__ */ jsxs10(
14704
+ /* @__PURE__ */ jsx12("div", { className: "spacing-command-options", role: "listbox", "aria-label": messages.insertSpace, hidden: !spacingMenuOpen, children: SPACING_COMMANDS.map((command) => /* @__PURE__ */ jsxs11(
14658
14705
  "button",
14659
14706
  {
14660
14707
  type: "button",
@@ -14668,7 +14715,7 @@ ${arabic || currentMessages.empty}`;
14668
14715
  focusSurface();
14669
14716
  },
14670
14717
  children: [
14671
- /* @__PURE__ */ jsxs10("span", { className: `spacing-command-glyph spacing-command-glyph--${command.spacing.direction} spacing-command-glyph--level-${String(command.spacing.level)}`, "aria-hidden": "true", children: [
14718
+ /* @__PURE__ */ jsxs11("span", { className: `spacing-command-glyph spacing-command-glyph--${command.spacing.direction} spacing-command-glyph--level-${String(command.spacing.level)}`, "aria-hidden": "true", children: [
14672
14719
  command.spacing.direction === "negative" ? /* @__PURE__ */ jsx12("span", { className: "spacing-command-glyph__arrow", children: spacingArrow(command, activeEditorSide) }) : null,
14673
14720
  /* @__PURE__ */ jsx12("span", { className: "spacing-command-glyph__bar" }),
14674
14721
  command.spacing.direction === "positive" ? /* @__PURE__ */ jsx12("span", { className: "spacing-command-glyph__arrow", children: spacingArrow(command, activeEditorSide) }) : null
@@ -14681,8 +14728,8 @@ ${arabic || currentMessages.empty}`;
14681
14728
  ]
14682
14729
  }
14683
14730
  ) }),
14684
- /* @__PURE__ */ jsxs10("div", { className: "toolbar-group toolbar-functions", role: "group", "aria-label": messages.functions, children: [
14685
- /* @__PURE__ */ jsxs10(
14731
+ /* @__PURE__ */ jsxs11("div", { className: "toolbar-group toolbar-functions", role: "group", "aria-label": messages.functions, children: [
14732
+ /* @__PURE__ */ jsxs11(
14686
14733
  "div",
14687
14734
  {
14688
14735
  className: "function-command-menu",
@@ -14727,7 +14774,7 @@ ${arabic || currentMessages.empty}`;
14727
14774
  ]
14728
14775
  }
14729
14776
  ),
14730
- /* @__PURE__ */ jsxs10(
14777
+ /* @__PURE__ */ jsxs11(
14731
14778
  "div",
14732
14779
  {
14733
14780
  className: "function-command-menu function-command-menu--limits-series",
@@ -14772,7 +14819,7 @@ ${arabic || currentMessages.empty}`;
14772
14819
  ]
14773
14820
  }
14774
14821
  ),
14775
- /* @__PURE__ */ jsxs10(
14822
+ /* @__PURE__ */ jsxs11(
14776
14823
  "div",
14777
14824
  {
14778
14825
  className: "function-command-menu function-command-menu--function2",
@@ -14817,7 +14864,7 @@ ${arabic || currentMessages.empty}`;
14817
14864
  ]
14818
14865
  }
14819
14866
  ),
14820
- /* @__PURE__ */ jsxs10(
14867
+ /* @__PURE__ */ jsxs11(
14821
14868
  "div",
14822
14869
  {
14823
14870
  className: "function-command-menu function-command-menu--derivative",
@@ -14841,7 +14888,7 @@ ${arabic || currentMessages.empty}`;
14841
14888
  children: DERIVATIVE_COMMANDS[0]?.arabicLabel ?? "\u0621"
14842
14889
  }
14843
14890
  ),
14844
- /* @__PURE__ */ jsxs10("div", { className: "function-command-options", role: "listbox", "aria-label": messages.insertDerivative, hidden: !derivativeMenuOpen, children: [
14891
+ /* @__PURE__ */ jsxs11("div", { className: "function-command-options", role: "listbox", "aria-label": messages.insertDerivative, hidden: !derivativeMenuOpen, children: [
14845
14892
  DERIVATIVE_COMMANDS.map((command) => /* @__PURE__ */ jsx12(
14846
14893
  "button",
14847
14894
  {
@@ -14898,7 +14945,7 @@ ${arabic || currentMessages.empty}`;
14898
14945
  ]
14899
14946
  }
14900
14947
  ),
14901
- /* @__PURE__ */ jsxs10(
14948
+ /* @__PURE__ */ jsxs11(
14902
14949
  "div",
14903
14950
  {
14904
14951
  className: "function-command-menu function-command-menu--groups",
@@ -14944,8 +14991,8 @@ ${arabic || currentMessages.empty}`;
14944
14991
  }
14945
14992
  )
14946
14993
  ] }),
14947
- /* @__PURE__ */ jsxs10("div", { className: "toolbar-group toolbar-operators", role: "group", "aria-label": messages.operations, children: [
14948
- /* @__PURE__ */ jsxs10(
14994
+ /* @__PURE__ */ jsxs11("div", { className: "toolbar-group toolbar-operators", role: "group", "aria-label": messages.operations, children: [
14995
+ /* @__PURE__ */ jsxs11(
14949
14996
  "div",
14950
14997
  {
14951
14998
  className: "function-command-menu operator-command-menu",
@@ -14990,7 +15037,7 @@ ${arabic || currentMessages.empty}`;
14990
15037
  ]
14991
15038
  }
14992
15039
  ),
14993
- /* @__PURE__ */ jsxs10(
15040
+ /* @__PURE__ */ jsxs11(
14994
15041
  "div",
14995
15042
  {
14996
15043
  className: "function-command-menu operator-command-menu",
@@ -15035,7 +15082,7 @@ ${arabic || currentMessages.empty}`;
15035
15082
  ]
15036
15083
  }
15037
15084
  ),
15038
- /* @__PURE__ */ jsxs10(
15085
+ /* @__PURE__ */ jsxs11(
15039
15086
  "div",
15040
15087
  {
15041
15088
  className: "function-command-menu operator-command-menu",
@@ -15080,7 +15127,7 @@ ${arabic || currentMessages.empty}`;
15080
15127
  ]
15081
15128
  }
15082
15129
  ),
15083
- /* @__PURE__ */ jsxs10(
15130
+ /* @__PURE__ */ jsxs11(
15084
15131
  "div",
15085
15132
  {
15086
15133
  className: "function-command-menu operator-command-menu",
@@ -15125,7 +15172,7 @@ ${arabic || currentMessages.empty}`;
15125
15172
  ]
15126
15173
  }
15127
15174
  ),
15128
- /* @__PURE__ */ jsxs10(
15175
+ /* @__PURE__ */ jsxs11(
15129
15176
  "div",
15130
15177
  {
15131
15178
  className: "function-command-menu operator-command-menu",
@@ -15171,28 +15218,28 @@ ${arabic || currentMessages.empty}`;
15171
15218
  }
15172
15219
  )
15173
15220
  ] }),
15174
- /* @__PURE__ */ jsxs10("div", { className: "toolbar-group toolbar-scripts", role: "group", "aria-label": messages.scripts, children: [
15175
- /* @__PURE__ */ jsx12("button", { className: "icon-btn script-icon-btn", type: "button", title: messages.addSuperscript, "aria-label": messages.addSuperscript, onClick: () => runtimeRef.current?.addSup(), children: /* @__PURE__ */ jsxs10("span", { className: "toolbar-script-icon toolbar-script-icon--sup", "aria-hidden": "true", children: [
15221
+ /* @__PURE__ */ jsxs11("div", { className: "toolbar-group toolbar-scripts", role: "group", "aria-label": messages.scripts, children: [
15222
+ /* @__PURE__ */ jsx12("button", { className: "icon-btn script-icon-btn", type: "button", title: messages.addSuperscript, "aria-label": messages.addSuperscript, onClick: () => runtimeRef.current?.addSup(), children: /* @__PURE__ */ jsxs11("span", { className: "toolbar-script-icon toolbar-script-icon--sup", "aria-hidden": "true", children: [
15176
15223
  /* @__PURE__ */ jsx12("span", { children: "\u0646" }),
15177
15224
  /* @__PURE__ */ jsx12("span", { children: "\u0633" })
15178
15225
  ] }) }),
15179
- /* @__PURE__ */ jsx12("button", { className: "icon-btn script-icon-btn", type: "button", title: messages.addSubscript, "aria-label": messages.addSubscript, onClick: () => runtimeRef.current?.addSub(), children: /* @__PURE__ */ jsxs10("span", { className: "toolbar-script-icon toolbar-script-icon--sub", "aria-hidden": "true", children: [
15226
+ /* @__PURE__ */ jsx12("button", { className: "icon-btn script-icon-btn", type: "button", title: messages.addSubscript, "aria-label": messages.addSubscript, onClick: () => runtimeRef.current?.addSub(), children: /* @__PURE__ */ jsxs11("span", { className: "toolbar-script-icon toolbar-script-icon--sub", "aria-hidden": "true", children: [
15180
15227
  /* @__PURE__ */ jsx12("span", { children: "\u0646" }),
15181
15228
  /* @__PURE__ */ jsx12("span", { children: "\u0633" })
15182
15229
  ] }) }),
15183
- /* @__PURE__ */ jsx12("button", { className: "icon-btn script-icon-btn remove-script-btn", type: "button", title: messages.removeSuperscript, "aria-label": messages.removeSuperscript, onClick: () => runtimeRef.current?.removeSup(), children: /* @__PURE__ */ jsxs10("span", { className: "toolbar-remove-script-icon toolbar-remove-script-icon--sup", "aria-hidden": "true", children: [
15230
+ /* @__PURE__ */ jsx12("button", { className: "icon-btn script-icon-btn remove-script-btn", type: "button", title: messages.removeSuperscript, "aria-label": messages.removeSuperscript, onClick: () => runtimeRef.current?.removeSup(), children: /* @__PURE__ */ jsxs11("span", { className: "toolbar-remove-script-icon toolbar-remove-script-icon--sup", "aria-hidden": "true", children: [
15184
15231
  /* @__PURE__ */ jsx12("span", { children: "\u0646" }),
15185
15232
  /* @__PURE__ */ jsx12("span", { children: "\xD7" })
15186
15233
  ] }) }),
15187
- /* @__PURE__ */ jsx12("button", { className: "icon-btn script-icon-btn remove-script-btn", type: "button", title: messages.removeSubscript, "aria-label": messages.removeSubscript, onClick: () => runtimeRef.current?.removeSub(), children: /* @__PURE__ */ jsxs10("span", { className: "toolbar-remove-script-icon toolbar-remove-script-icon--sub", "aria-hidden": "true", children: [
15234
+ /* @__PURE__ */ jsx12("button", { className: "icon-btn script-icon-btn remove-script-btn", type: "button", title: messages.removeSubscript, "aria-label": messages.removeSubscript, onClick: () => runtimeRef.current?.removeSub(), children: /* @__PURE__ */ jsxs11("span", { className: "toolbar-remove-script-icon toolbar-remove-script-icon--sub", "aria-hidden": "true", children: [
15188
15235
  /* @__PURE__ */ jsx12("span", { children: "\u0646" }),
15189
15236
  /* @__PURE__ */ jsx12("span", { children: "\xD7" })
15190
15237
  ] }) })
15191
15238
  ] }),
15192
- /* @__PURE__ */ jsxs10("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": messages.inputStyles, children: [
15239
+ /* @__PURE__ */ jsxs11("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": messages.inputStyles, children: [
15193
15240
  /* @__PURE__ */ jsx12("button", { className: "icon-btn delete-node-btn", type: "button", title: messages.deleteSelectedStructure, "aria-label": messages.deleteSelectedStructure, onClick: () => runtimeRef.current?.deleteStructure(), children: "\xD7" }),
15194
15241
  /* @__PURE__ */ jsx12("button", { ref: splitTypingBtnRef, id: "toggle-split-leaf-typing", className: "icon-btn ligature-btn", type: "button", title: messages.toggleLetterMerging, "aria-label": messages.toggleLetterMerging, onClick: () => runtimeRef.current?.toggleSplitLeafTyping(), children: "\u0633\u0635\u0639" }),
15195
- /* @__PURE__ */ jsxs10(
15242
+ /* @__PURE__ */ jsxs11(
15196
15243
  "div",
15197
15244
  {
15198
15245
  className: "character-font-menu",
@@ -15240,7 +15287,7 @@ ${arabic || currentMessages.empty}`;
15240
15287
  ]
15241
15288
  }
15242
15289
  ),
15243
- /* @__PURE__ */ jsxs10(
15290
+ /* @__PURE__ */ jsxs11(
15244
15291
  "div",
15245
15292
  {
15246
15293
  className: "digit-form-menu",
@@ -15317,14 +15364,14 @@ ${arabic || currentMessages.empty}`;
15317
15364
  /* @__PURE__ */ jsx12("div", { ref: renderErrorRef, className: "error", hidden: true })
15318
15365
  ] }),
15319
15366
  /* @__PURE__ */ jsx12("section", { className: "panel panel-preview", "aria-label": messages.renderPreview, children: /* @__PURE__ */ jsx12("div", { ref: mathOutputRef, className: "preview-box" }) }),
15320
- debugEnabled ? /* @__PURE__ */ jsxs10("section", { className: "panel", children: [
15321
- /* @__PURE__ */ jsxs10("div", { className: "dev-strip", children: [
15367
+ debugEnabled ? /* @__PURE__ */ jsxs11("section", { className: "panel", children: [
15368
+ /* @__PURE__ */ jsxs11("div", { className: "dev-strip", children: [
15322
15369
  /* @__PURE__ */ jsx12("span", { className: "dev-badge", children: messages.development }),
15323
15370
  /* @__PURE__ */ jsx12("div", { ref: latexLinesRef, className: "ascii" }),
15324
15371
  /* @__PURE__ */ jsx12("div", { ref: passivePreviewRef, className: "passive-preview-text" })
15325
15372
  ] }),
15326
- /* @__PURE__ */ jsxs10("div", { style: { marginTop: 12 }, children: [
15327
- /* @__PURE__ */ jsxs10("div", { className: "debug-head", children: [
15373
+ /* @__PURE__ */ jsxs11("div", { style: { marginTop: 12 }, children: [
15374
+ /* @__PURE__ */ jsxs11("div", { className: "debug-head", children: [
15328
15375
  /* @__PURE__ */ jsx12("button", { type: "button", onClick: () => void copyDebugText(currentMathObjectJsonText()), children: "Copy MathObject JSON" }),
15329
15376
  /* @__PURE__ */ jsx12("button", { type: "button", "aria-expanded": debugImportOpen, onClick: openDebugMathObjectImport, children: "Import MathObject JSON" }),
15330
15377
  /* @__PURE__ */ jsx12(
@@ -15362,7 +15409,7 @@ ${arabic || currentMessages.empty}`;
15362
15409
  }
15363
15410
  )
15364
15411
  ] }),
15365
- debugImportOpen ? /* @__PURE__ */ jsxs10("div", { className: "debug-json-import", children: [
15412
+ debugImportOpen ? /* @__PURE__ */ jsxs11("div", { className: "debug-json-import", children: [
15366
15413
  /* @__PURE__ */ jsx12(
15367
15414
  "textarea",
15368
15415
  {
@@ -15375,7 +15422,7 @@ ${arabic || currentMessages.empty}`;
15375
15422
  }
15376
15423
  }
15377
15424
  ),
15378
- /* @__PURE__ */ jsxs10("div", { className: "debug-head", children: [
15425
+ /* @__PURE__ */ jsxs11("div", { className: "debug-head", children: [
15379
15426
  /* @__PURE__ */ jsx12("button", { type: "button", onClick: applyDebugMathObjectImport, children: "Apply" }),
15380
15427
  /* @__PURE__ */ jsx12(
15381
15428
  "button",
@@ -15402,7 +15449,7 @@ ${arabic || currentMessages.empty}`;
15402
15449
  ButexEditor.displayName = "ButexEditor";
15403
15450
 
15404
15451
  // src/react-document2/EquationDrawer.tsx
15405
- import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
15452
+ import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
15406
15453
  function keyErrorMessage2(error, messages) {
15407
15454
  if (error === "empty") {
15408
15455
  return messages.keyEmpty;
@@ -15456,7 +15503,7 @@ function EquationDrawer({
15456
15503
  window.addEventListener("keydown", onKeyDown);
15457
15504
  return () => window.removeEventListener("keydown", onKeyDown);
15458
15505
  }, [onClose]);
15459
- return /* @__PURE__ */ jsxs11("div", { className: "butex-document2-widget__equation-modal", role: "presentation", children: [
15506
+ return /* @__PURE__ */ jsxs12("div", { className: "butex-document2-widget__equation-modal", role: "presentation", children: [
15460
15507
  /* @__PURE__ */ jsx13(
15461
15508
  "button",
15462
15509
  {
@@ -15466,7 +15513,7 @@ function EquationDrawer({
15466
15513
  onClick: onClose
15467
15514
  }
15468
15515
  ),
15469
- /* @__PURE__ */ jsxs11(
15516
+ /* @__PURE__ */ jsxs12(
15470
15517
  "div",
15471
15518
  {
15472
15519
  className: "butex-document2-widget__equation-modal-panel",
@@ -15476,22 +15523,22 @@ function EquationDrawer({
15476
15523
  dir: uiLocaleDirection(uiLocale),
15477
15524
  lang: uiLocale,
15478
15525
  children: [
15479
- /* @__PURE__ */ jsxs11("div", { className: "butex-document2-widget__row", children: [
15526
+ /* @__PURE__ */ jsxs12("div", { className: "butex-document2-widget__row", children: [
15480
15527
  /* @__PURE__ */ jsx13("strong", { id: "butex-document2-equation-modal-title", children: messages.equationEditorTitle }),
15481
15528
  /* @__PURE__ */ jsx13("button", { type: "button", onClick: onClose, children: messages.close })
15482
15529
  ] }),
15483
- /* @__PURE__ */ jsxs11("div", { className: "butex-document2-widget__row", role: "group", "aria-label": messages.equationType, children: [
15484
- /* @__PURE__ */ jsxs11("button", { type: "button", "aria-pressed": mathMode === "inline", onClick: () => onMathModeChange("inline"), children: [
15530
+ /* @__PURE__ */ jsxs12("div", { className: "butex-document2-widget__row", role: "group", "aria-label": messages.equationType, children: [
15531
+ /* @__PURE__ */ jsxs12("button", { type: "button", "aria-pressed": mathMode === "inline", onClick: () => onMathModeChange("inline"), children: [
15485
15532
  messages.inline,
15486
15533
  " ($)"
15487
15534
  ] }),
15488
- /* @__PURE__ */ jsxs11("button", { type: "button", "aria-pressed": mathMode === "display", onClick: () => onMathModeChange("display"), children: [
15535
+ /* @__PURE__ */ jsxs12("button", { type: "button", "aria-pressed": mathMode === "display", onClick: () => onMathModeChange("display"), children: [
15489
15536
  messages.displayed,
15490
15537
  " (\\\\[)"
15491
15538
  ] })
15492
15539
  ] }),
15493
- mathMode === "display" ? /* @__PURE__ */ jsxs11("div", { className: "butex-document2-widget__float-meta", children: [
15494
- /* @__PURE__ */ jsxs11("label", { className: "butex-document2-widget__float-meta-toggle", children: [
15540
+ mathMode === "display" ? /* @__PURE__ */ jsxs12("div", { className: "butex-document2-widget__float-meta", children: [
15541
+ /* @__PURE__ */ jsxs12("label", { className: "butex-document2-widget__float-meta-toggle", children: [
15495
15542
  /* @__PURE__ */ jsx13(
15496
15543
  "input",
15497
15544
  {
@@ -15502,7 +15549,7 @@ function EquationDrawer({
15502
15549
  ),
15503
15550
  /* @__PURE__ */ jsx13("span", { children: messages.labelToggle })
15504
15551
  ] }),
15505
- labelEnabled ? /* @__PURE__ */ jsxs11("label", { className: "butex-document2-widget__refs-field", children: [
15552
+ labelEnabled ? /* @__PURE__ */ jsxs12("label", { className: "butex-document2-widget__refs-field", children: [
15506
15553
  /* @__PURE__ */ jsx13("span", { children: messages.floatLabel }),
15507
15554
  /* @__PURE__ */ jsx13(
15508
15555
  "input",
@@ -15543,7 +15590,7 @@ function EquationDrawer({
15543
15590
  }
15544
15591
  }
15545
15592
  ),
15546
- /* @__PURE__ */ jsxs11("div", { className: "butex-document2-widget__row", children: [
15593
+ /* @__PURE__ */ jsxs12("div", { className: "butex-document2-widget__row", children: [
15547
15594
  canDelete && onDelete ? /* @__PURE__ */ jsx13("button", { type: "button", className: "butex-document2-widget__button--danger", onClick: onDelete, children: messages.deleteEquation }) : null,
15548
15595
  /* @__PURE__ */ jsx13(
15549
15596
  "button",
@@ -15563,7 +15610,7 @@ function EquationDrawer({
15563
15610
 
15564
15611
  // src/react-document2/LabelsPanel.tsx
15565
15612
  import { useState as useState9 } from "react";
15566
- import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
15613
+ import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
15567
15614
  function keyErrorMessage3(error, messages) {
15568
15615
  if (error === "empty") {
15569
15616
  return messages.keyEmpty;
@@ -15592,7 +15639,7 @@ function LabelsPanel({
15592
15639
  if (!open) {
15593
15640
  return null;
15594
15641
  }
15595
- return /* @__PURE__ */ jsx14("div", { className: "butex-document2-widget__refs-backdrop", role: "presentation", onClick: onClose, children: /* @__PURE__ */ jsxs12(
15642
+ return /* @__PURE__ */ jsx14("div", { className: "butex-document2-widget__refs-backdrop", role: "presentation", onClick: onClose, children: /* @__PURE__ */ jsxs13(
15596
15643
  "div",
15597
15644
  {
15598
15645
  className: "butex-document2-widget__refs-panel",
@@ -15600,7 +15647,7 @@ function LabelsPanel({
15600
15647
  "aria-label": messages.labelsTitle,
15601
15648
  onClick: (event) => event.stopPropagation(),
15602
15649
  children: [
15603
- /* @__PURE__ */ jsxs12("header", { className: "butex-document2-widget__refs-header", children: [
15650
+ /* @__PURE__ */ jsxs13("header", { className: "butex-document2-widget__refs-header", children: [
15604
15651
  /* @__PURE__ */ jsx14("strong", { children: messages.labelsTitle }),
15605
15652
  /* @__PURE__ */ jsx14("button", { type: "button", className: "butex-document2-widget__icon-btn", title: messages.close, "aria-label": messages.close, onClick: onClose, children: "\xD7" })
15606
15653
  ] }),
@@ -15619,8 +15666,8 @@ function LabelsPanel({
15619
15666
  labels,
15620
15667
  excludeOwnerId: entry.ownerId
15621
15668
  });
15622
- return /* @__PURE__ */ jsxs12("li", { className: "butex-document2-widget__refs-item", children: [
15623
- /* @__PURE__ */ jsxs12("div", { className: "butex-document2-widget__refs-item-head", children: [
15669
+ return /* @__PURE__ */ jsxs13("li", { className: "butex-document2-widget__refs-item", children: [
15670
+ /* @__PURE__ */ jsxs13("div", { className: "butex-document2-widget__refs-item-head", children: [
15624
15671
  /* @__PURE__ */ jsx14("strong", { children: title }),
15625
15672
  /* @__PURE__ */ jsx14("span", { className: "butex-document2-widget__refs-item-key", children: entry.key })
15626
15673
  ] }),
@@ -15633,8 +15680,8 @@ function LabelsPanel({
15633
15680
  children: captionPreview
15634
15681
  }
15635
15682
  ),
15636
- /* @__PURE__ */ jsxs12("div", { className: "butex-document2-widget__refs-grid", children: [
15637
- /* @__PURE__ */ jsxs12("label", { className: "butex-document2-widget__refs-field", children: [
15683
+ /* @__PURE__ */ jsxs13("div", { className: "butex-document2-widget__refs-grid", children: [
15684
+ /* @__PURE__ */ jsxs13("label", { className: "butex-document2-widget__refs-field", children: [
15638
15685
  /* @__PURE__ */ jsx14("span", { children: messages.floatLabel }),
15639
15686
  /* @__PURE__ */ jsx14(
15640
15687
  "input",
@@ -15668,7 +15715,7 @@ function LabelsPanel({
15668
15715
  ),
15669
15716
  entryKeyError !== null ? /* @__PURE__ */ jsx14("p", { className: "butex-document2-widget__field-error", children: entryKeyError === "invalid" ? messages.keyRulesHint : keyErrorMessage3(entryKeyError, messages) }) : null
15670
15717
  ] }),
15671
- entry.kind === "fig" || entry.kind === "tab" ? /* @__PURE__ */ jsxs12("label", { className: "butex-document2-widget__refs-field", children: [
15718
+ entry.kind === "fig" || entry.kind === "tab" ? /* @__PURE__ */ jsxs13("label", { className: "butex-document2-widget__refs-field", children: [
15672
15719
  /* @__PURE__ */ jsx14("span", { children: messages.floatCaption }),
15673
15720
  /* @__PURE__ */ jsx14(
15674
15721
  "input",
@@ -15694,7 +15741,7 @@ function LabelsPanel({
15694
15741
 
15695
15742
  // src/react-document2/ReferencesPanel.tsx
15696
15743
  import { useMemo, useState as useState10 } from "react";
15697
- import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
15744
+ import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
15698
15745
  var EMPTY_DRAFT = {
15699
15746
  key: "",
15700
15747
  authors: "",
@@ -15729,9 +15776,9 @@ function FieldSeparatorToggle({
15729
15776
  messages,
15730
15777
  onChange
15731
15778
  }) {
15732
- return /* @__PURE__ */ jsxs13("div", { className: "butex-document2-widget__refs-field butex-document2-widget__refs-separator", children: [
15779
+ return /* @__PURE__ */ jsxs14("div", { className: "butex-document2-widget__refs-field butex-document2-widget__refs-separator", children: [
15733
15780
  /* @__PURE__ */ jsx15("span", { children: messages.referenceFieldSeparator }),
15734
- /* @__PURE__ */ jsxs13("div", { className: "butex-document2-widget__refs-separator-toggle", role: "group", "aria-label": messages.referenceFieldSeparator, children: [
15781
+ /* @__PURE__ */ jsxs14("div", { className: "butex-document2-widget__refs-separator-toggle", role: "group", "aria-label": messages.referenceFieldSeparator, children: [
15735
15782
  /* @__PURE__ */ jsx15(
15736
15783
  "button",
15737
15784
  {
@@ -15772,20 +15819,20 @@ function ReferencePreview({
15772
15819
  digitForm
15773
15820
  }) {
15774
15821
  const body = bibliographyEntryBody({ authors, title, venue, year, fieldSeparator }, fieldSeparator, { digitForm });
15775
- return /* @__PURE__ */ jsxs13(
15822
+ return /* @__PURE__ */ jsxs14(
15776
15823
  "div",
15777
15824
  {
15778
15825
  className: "butex-document2-widget__modal-preview",
15779
15826
  dir: uiLocaleDirection(uiLocale),
15780
15827
  "aria-label": messages.referencePreview,
15781
15828
  children: [
15782
- numberLabel ? /* @__PURE__ */ jsxs13("span", { className: "butex-document2-widget__modal-preview-number", children: [
15829
+ numberLabel ? /* @__PURE__ */ jsxs14("span", { className: "butex-document2-widget__modal-preview-number", children: [
15783
15830
  "[",
15784
15831
  numberLabel,
15785
15832
  "] "
15786
15833
  ] }) : null,
15787
15834
  body.length > 0 ? body : /* @__PURE__ */ jsx15("span", { className: "butex-document2-widget__cite-picker-empty", children: "\u2026" }),
15788
- url.trim().length > 0 ? /* @__PURE__ */ jsxs13(Fragment4, { children: [
15835
+ url.trim().length > 0 ? /* @__PURE__ */ jsxs14(Fragment5, { children: [
15789
15836
  " ",
15790
15837
  /* @__PURE__ */ jsx15("span", { className: "butex-document2-widget__modal-preview-url", children: url.trim() })
15791
15838
  ] }) : null
@@ -15821,7 +15868,7 @@ function ReferencesPanel({
15821
15868
  if (!open) {
15822
15869
  return null;
15823
15870
  }
15824
- return /* @__PURE__ */ jsx15("div", { className: "butex-document2-widget__refs-backdrop", role: "presentation", onClick: onClose, children: /* @__PURE__ */ jsxs13(
15871
+ return /* @__PURE__ */ jsx15("div", { className: "butex-document2-widget__refs-backdrop", role: "presentation", onClick: onClose, children: /* @__PURE__ */ jsxs14(
15825
15872
  "div",
15826
15873
  {
15827
15874
  className: "butex-document2-widget__refs-panel",
@@ -15829,14 +15876,14 @@ function ReferencesPanel({
15829
15876
  "aria-label": messages.referencesTitle,
15830
15877
  onClick: (event) => event.stopPropagation(),
15831
15878
  children: [
15832
- /* @__PURE__ */ jsxs13("header", { className: "butex-document2-widget__refs-header", children: [
15879
+ /* @__PURE__ */ jsxs14("header", { className: "butex-document2-widget__refs-header", children: [
15833
15880
  /* @__PURE__ */ jsx15("strong", { children: messages.referencesTitle }),
15834
15881
  /* @__PURE__ */ jsx15("button", { type: "button", className: "butex-document2-widget__icon-btn", title: messages.close, "aria-label": messages.close, onClick: onClose, children: "\xD7" })
15835
15882
  ] }),
15836
- /* @__PURE__ */ jsxs13("div", { className: "butex-document2-widget__refs-add", children: [
15883
+ /* @__PURE__ */ jsxs14("div", { className: "butex-document2-widget__refs-add", children: [
15837
15884
  /* @__PURE__ */ jsx15("h3", { children: messages.addReference }),
15838
- /* @__PURE__ */ jsxs13("div", { className: "butex-document2-widget__refs-grid", children: [
15839
- REFERENCE_FIELDS.map(([field, messageKey]) => /* @__PURE__ */ jsxs13("label", { className: "butex-document2-widget__refs-field", children: [
15885
+ /* @__PURE__ */ jsxs14("div", { className: "butex-document2-widget__refs-grid", children: [
15886
+ REFERENCE_FIELDS.map(([field, messageKey]) => /* @__PURE__ */ jsxs14("label", { className: "butex-document2-widget__refs-field", children: [
15840
15887
  /* @__PURE__ */ jsx15("span", { children: messages[messageKey] }),
15841
15888
  /* @__PURE__ */ jsx15(
15842
15889
  "input",
@@ -15900,15 +15947,15 @@ function ReferencesPanel({
15900
15947
  excludeReferenceId: reference.id
15901
15948
  });
15902
15949
  const numberLabel = formatBibliographyNumber(index + 1, { documentDirection, digitForm });
15903
- return /* @__PURE__ */ jsxs13("li", { className: "butex-document2-widget__refs-item", children: [
15904
- /* @__PURE__ */ jsxs13("div", { className: "butex-document2-widget__refs-item-head", children: [
15905
- /* @__PURE__ */ jsxs13("strong", { children: [
15950
+ return /* @__PURE__ */ jsxs14("li", { className: "butex-document2-widget__refs-item", children: [
15951
+ /* @__PURE__ */ jsxs14("div", { className: "butex-document2-widget__refs-item-head", children: [
15952
+ /* @__PURE__ */ jsxs14("strong", { children: [
15906
15953
  "[",
15907
15954
  numberLabel,
15908
15955
  "] ",
15909
15956
  reference.key
15910
15957
  ] }),
15911
- /* @__PURE__ */ jsxs13("div", { className: "butex-document2-widget__refs-item-actions", children: [
15958
+ /* @__PURE__ */ jsxs14("div", { className: "butex-document2-widget__refs-item-actions", children: [
15912
15959
  /* @__PURE__ */ jsx15("button", { type: "button", title: messages.moveUp, "aria-label": messages.moveUp, disabled: index === 0, onClick: () => onMove(reference.id, -1), children: "\u2191" }),
15913
15960
  /* @__PURE__ */ jsx15(
15914
15961
  "button",
@@ -15939,8 +15986,8 @@ function ReferencesPanel({
15939
15986
  digitForm
15940
15987
  }
15941
15988
  ),
15942
- /* @__PURE__ */ jsxs13("div", { className: "butex-document2-widget__refs-grid", children: [
15943
- REFERENCE_FIELDS.map(([field, messageKey]) => /* @__PURE__ */ jsxs13("label", { className: "butex-document2-widget__refs-field", children: [
15989
+ /* @__PURE__ */ jsxs14("div", { className: "butex-document2-widget__refs-grid", children: [
15990
+ REFERENCE_FIELDS.map(([field, messageKey]) => /* @__PURE__ */ jsxs14("label", { className: "butex-document2-widget__refs-field", children: [
15944
15991
  /* @__PURE__ */ jsx15("span", { children: messages[messageKey] }),
15945
15992
  /* @__PURE__ */ jsx15(
15946
15993
  "input",
@@ -15990,7 +16037,7 @@ function ReferencesPanel({
15990
16037
 
15991
16038
  // src/react-document2/RefPickerPopover.tsx
15992
16039
  import { useEffect as useEffect9, useState as useState11 } from "react";
15993
- import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
16040
+ import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
15994
16041
  function RefPickerPopover({
15995
16042
  open,
15996
16043
  labels,
@@ -16019,7 +16066,7 @@ function RefPickerPopover({
16019
16066
  setSelected([key]);
16020
16067
  setRefCommand(kind === "eq" ? "eqref" : "ref");
16021
16068
  }
16022
- return /* @__PURE__ */ jsx16("div", { className: "butex-document2-widget__cite-picker-backdrop", role: "presentation", onClick: onClose, children: /* @__PURE__ */ jsxs14(
16069
+ return /* @__PURE__ */ jsx16("div", { className: "butex-document2-widget__cite-picker-backdrop", role: "presentation", onClick: onClose, children: /* @__PURE__ */ jsxs15(
16023
16070
  "div",
16024
16071
  {
16025
16072
  className: "butex-document2-widget__cite-picker",
@@ -16027,7 +16074,7 @@ function RefPickerPopover({
16027
16074
  "aria-label": messages.refPickerTitle,
16028
16075
  onClick: (event) => event.stopPropagation(),
16029
16076
  children: [
16030
- /* @__PURE__ */ jsxs14("header", { className: "butex-document2-widget__cite-picker-header", children: [
16077
+ /* @__PURE__ */ jsxs15("header", { className: "butex-document2-widget__cite-picker-header", children: [
16031
16078
  /* @__PURE__ */ jsx16("strong", { children: messages.refPickerTitle }),
16032
16079
  /* @__PURE__ */ jsx16("button", { type: "button", className: "butex-document2-widget__icon-btn", title: messages.close, "aria-label": messages.close, onClick: onClose, children: "\xD7" })
16033
16080
  ] }),
@@ -16038,10 +16085,10 @@ function RefPickerPopover({
16038
16085
  digitForm,
16039
16086
  documentDirection
16040
16087
  });
16041
- return /* @__PURE__ */ jsx16("li", { children: /* @__PURE__ */ jsxs14("label", { className: "butex-document2-widget__cite-picker-item", children: [
16088
+ return /* @__PURE__ */ jsx16("li", { children: /* @__PURE__ */ jsxs15("label", { className: "butex-document2-widget__cite-picker-item", children: [
16042
16089
  /* @__PURE__ */ jsx16("input", { type: "radio", name: "butex-ref-key", checked, onChange: () => selectKey(entry.key, entry.kind) }),
16043
- /* @__PURE__ */ jsxs14("span", { children: [
16044
- /* @__PURE__ */ jsxs14("strong", { children: [
16090
+ /* @__PURE__ */ jsxs15("span", { children: [
16091
+ /* @__PURE__ */ jsxs15("strong", { children: [
16045
16092
  title,
16046
16093
  " ",
16047
16094
  /* @__PURE__ */ jsx16("span", { className: "butex-document2-widget__refs-item-key", children: entry.key })
@@ -16050,7 +16097,7 @@ function RefPickerPopover({
16050
16097
  ] })
16051
16098
  ] }) }, `${entry.kind}:${entry.ownerId}`);
16052
16099
  }) }),
16053
- /* @__PURE__ */ jsxs14("footer", { className: "butex-document2-widget__cite-picker-footer", children: [
16100
+ /* @__PURE__ */ jsxs15("footer", { className: "butex-document2-widget__cite-picker-footer", children: [
16054
16101
  onManageLabels ? /* @__PURE__ */ jsx16("button", { type: "button", onClick: onManageLabels, children: messages.manageLabels }) : null,
16055
16102
  /* @__PURE__ */ jsx16("button", { type: "button", onClick: onClose, children: messages.close }),
16056
16103
  /* @__PURE__ */ jsx16(
@@ -17816,7 +17863,7 @@ function injectBuTeXDocument2Styles(doc) {
17816
17863
  }
17817
17864
 
17818
17865
  // src/react-document2/ButexDocumentEditor2.tsx
17819
- import { Fragment as Fragment5, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
17866
+ import { Fragment as Fragment6, jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
17820
17867
  function mathDelimiters(mode) {
17821
17868
  return mode === "inline" ? { opening: "$", closing: "$" } : { opening: "\\[", closing: "\\]" };
17822
17869
  }
@@ -18723,8 +18770,8 @@ var ButexDocumentEditor2 = forwardRef2(
18723
18770
  className: ["butex-document2-widget", className].filter(Boolean).join(" "),
18724
18771
  dir: uiLocaleDirection(uiLocale),
18725
18772
  lang: uiLocale,
18726
- children: /* @__PURE__ */ jsxs15("div", { className: "butex-document2-widget__shell", children: [
18727
- !previewOnly ? /* @__PURE__ */ jsxs15("div", { className: "butex-document2-widget__toolbar", children: [
18773
+ children: /* @__PURE__ */ jsxs16("div", { className: "butex-document2-widget__shell", children: [
18774
+ !previewOnly ? /* @__PURE__ */ jsxs16("div", { className: "butex-document2-widget__toolbar", children: [
18728
18775
  /* @__PURE__ */ jsx17(
18729
18776
  DocumentInsertToolbar,
18730
18777
  {
@@ -18790,17 +18837,17 @@ var ButexDocumentEditor2 = forwardRef2(
18790
18837
  }
18791
18838
  }
18792
18839
  ),
18793
- /* @__PURE__ */ jsxs15("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.panels, children: [
18840
+ /* @__PURE__ */ jsxs16("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.panels, children: [
18794
18841
  /* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": editorOpen, onClick: toggleEditorPanel, children: editorOpen ? messages.hideEditor : messages.editor }),
18795
18842
  /* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": previewOpen, onClick: togglePreviewPanel, children: previewOpen ? messages.hidePreview : messages.preview })
18796
18843
  ] }),
18797
- /* @__PURE__ */ jsxs15("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.collapseBlocks, children: [
18844
+ /* @__PURE__ */ jsxs16("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.collapseBlocks, children: [
18798
18845
  /* @__PURE__ */ jsx17("button", { type: "button", onClick: collapseAllBlocks, children: messages.collapseAll }),
18799
18846
  /* @__PURE__ */ jsx17("button", { type: "button", onClick: openAllBlocks, children: messages.openAll })
18800
18847
  ] })
18801
18848
  ] }) : null,
18802
18849
  error ? /* @__PURE__ */ jsx17("p", { className: "butex-document2-widget__error", children: error }) : null,
18803
- /* @__PURE__ */ jsxs15(
18850
+ /* @__PURE__ */ jsxs16(
18804
18851
  "div",
18805
18852
  {
18806
18853
  className: `butex-document2-widget__layout butex-document2-widget__layout--editor-${showEditorPanel ? "open" : "closed"} butex-document2-widget__layout--preview-${showPreviewPanel ? "open" : "closed"}`,
@@ -18811,7 +18858,7 @@ var ButexDocumentEditor2 = forwardRef2(
18811
18858
  className: "butex-document2-widget__panel butex-document2-widget__editor-panel",
18812
18859
  "aria-label": messages.documentEditor,
18813
18860
  "aria-hidden": !showEditorPanel,
18814
- children: /* @__PURE__ */ jsxs15("div", { className: "butex-document2-widget__blocks", children: [
18861
+ children: /* @__PURE__ */ jsxs16("div", { className: "butex-document2-widget__blocks", children: [
18815
18862
  /* @__PURE__ */ jsx17(
18816
18863
  ArticleMetaPanel,
18817
18864
  {
@@ -18920,17 +18967,17 @@ var ButexDocumentEditor2 = forwardRef2(
18920
18967
  ]
18921
18968
  }
18922
18969
  ),
18923
- debugEnabled ? /* @__PURE__ */ jsxs15("div", { className: "butex-document2-widget__dev", children: [
18924
- debugEnabled && documentNode.diagnostics.length > 0 ? /* @__PURE__ */ jsxs15(Fragment5, { children: [
18970
+ debugEnabled ? /* @__PURE__ */ jsxs16("div", { className: "butex-document2-widget__dev", children: [
18971
+ debugEnabled && documentNode.diagnostics.length > 0 ? /* @__PURE__ */ jsxs16(Fragment6, { children: [
18925
18972
  /* @__PURE__ */ jsx17("strong", { children: messages.importWarnings }),
18926
18973
  documentNode.diagnostics.map((diagnostic) => /* @__PURE__ */ jsx17("p", { className: "butex-document2-widget__dev-diagnostic", children: formatDocument2Diagnostic(diagnostic, messages) }, `${diagnostic.path}-${diagnostic.message}`))
18927
18974
  ] }) : null,
18928
- /* @__PURE__ */ jsxs15("div", { className: "butex-document2-widget__dev-actions", children: [
18975
+ /* @__PURE__ */ jsxs16("div", { className: "butex-document2-widget__dev-actions", children: [
18929
18976
  /* @__PURE__ */ jsx17("button", { type: "button", onClick: () => void copyDebugText(JSON.stringify(documentJson, null, 2)), children: "Copy JSON" }),
18930
18977
  /* @__PURE__ */ jsx17("button", { type: "button", onClick: () => void copyDebugText(latex), children: "Copy TeX" }),
18931
18978
  /* @__PURE__ */ jsx17("button", { type: "button", "aria-expanded": debugImportOpen, onClick: openDebugJsonImport, children: "Import JSON" })
18932
18979
  ] }),
18933
- debugImportOpen ? /* @__PURE__ */ jsxs15("div", { className: "butex-document2-widget__dev-import", children: [
18980
+ debugImportOpen ? /* @__PURE__ */ jsxs16("div", { className: "butex-document2-widget__dev-import", children: [
18934
18981
  /* @__PURE__ */ jsx17(
18935
18982
  "textarea",
18936
18983
  {
@@ -18943,7 +18990,7 @@ var ButexDocumentEditor2 = forwardRef2(
18943
18990
  }
18944
18991
  }
18945
18992
  ),
18946
- /* @__PURE__ */ jsxs15("div", { className: "butex-document2-widget__dev-actions", children: [
18993
+ /* @__PURE__ */ jsxs16("div", { className: "butex-document2-widget__dev-actions", children: [
18947
18994
  /* @__PURE__ */ jsx17("button", { type: "button", onClick: applyDebugJsonImport, children: "Apply" }),
18948
18995
  /* @__PURE__ */ jsx17(
18949
18996
  "button",