eat-js-sdk 2.3.6 → 2.3.8

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.
@@ -19285,6 +19285,11 @@ const isSuperSubTag = (tag) => {
19285
19285
  const name = getTagName(tag);
19286
19286
  return name === "sup" || name === "sub";
19287
19287
  };
19288
+ const trailingPunctuationPattern = /([.,!?;:)\]}"'\u201D\u2019»…\u2014\u2013]+)$/;
19289
+ const leadingPunctuationPattern = /^([([{'""\u201C\u2018]+)/;
19290
+ const openingCharsAtWordEndPattern = /([(\[{\u201C\u2018]+)$/;
19291
+ const wordContainsOnlyPunctuationPattern = /^[^\w\u00C0-\u024F]+$/;
19292
+ const TOKEN_PATTERN = /((?:<(?!\/?eat-)[^>]+>)*)<eat-contentful>(.*?)<\/eat-contentful>((?:<\/[^>]+>)*)|((?:<(?!\/?eat-)[^>]*>|[^<>])+)/;
19288
19293
  const extractHtmlWords = (htmlText) => {
19289
19294
  const re = /(\s+)|(<\/[^>]+>)|(<[^>]+>)|([^\s<>]+)/g;
19290
19295
  const tokens = [];
@@ -19386,13 +19391,115 @@ const extractHtmlWords = (htmlText) => {
19386
19391
  });
19387
19392
  };
19388
19393
  const splitParagraphs = (rawText) => rawText.split(/<\/p>/i).map((p) => p.replace(/^<p>/i, "").trim()).filter(Boolean);
19394
+ const decodeAuthored = (para) => para.replace(/&lt;eat-contentful&gt;/g, "<eat-contentful>").replace(/&lt;\/eat-contentful&gt;/g, "</eat-contentful>").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&apos;/g, "'");
19395
+ const flushLeadingPunct = (text, state2) => {
19396
+ const m = text.match(leadingPunctuationPattern);
19397
+ const extractedLeading = m ? m[1] : "";
19398
+ const lp = state2.pendingLeadingPunct + extractedLeading;
19399
+ const leadingPunctuation = lp.length ? lp : void 0;
19400
+ state2.pendingLeadingPunct = "";
19401
+ return { leadingPunctuation, extractedLeading };
19402
+ };
19403
+ const appendTrailingOrPush = (text, state2) => {
19404
+ const prev = state2.segments[state2.segments.length - 1];
19405
+ if (prev && !prev.isPunctuation && !prev.isLineBreak) {
19406
+ prev.trailingPunctuation = (prev.trailingPunctuation ?? "") + text;
19407
+ } else {
19408
+ state2.segments.push({ id: `${state2.globalIndex}`, text, isPunctuation: true });
19409
+ state2.globalIndex++;
19410
+ }
19411
+ };
19412
+ const processPurePunctWord = (visibleWord, state2) => {
19413
+ const isDoubleQuote = visibleWord === '"';
19414
+ const isSingleQuote = visibleWord === "'";
19415
+ const quoteDepth = isDoubleQuote ? state2.openDoubleQuoteDepth : isSingleQuote ? state2.openSingleQuoteDepth : -1;
19416
+ if ((isDoubleQuote || isSingleQuote) && quoteDepth > 0) {
19417
+ appendTrailingOrPush(visibleWord, state2);
19418
+ if (isDoubleQuote) state2.openDoubleQuoteDepth--;
19419
+ else state2.openSingleQuoteDepth--;
19420
+ } else if (leadingPunctuationPattern.test(visibleWord)) {
19421
+ state2.pendingLeadingPunct += visibleWord;
19422
+ if (isDoubleQuote) state2.openDoubleQuoteDepth++;
19423
+ else if (isSingleQuote) state2.openSingleQuoteDepth++;
19424
+ } else {
19425
+ appendTrailingOrPush(visibleWord, state2);
19426
+ }
19427
+ };
19428
+ const processHtmlWord = (word, state2) => {
19429
+ const innerVisible = decodeHtmlEntities(stripTags(word));
19430
+ const outerOpenTags = word.match(/^((?:<[^>]+>)+)/)?.[1] ?? "";
19431
+ const outerCloseTags = word.match(/((?:<\/[^>]+>)+)$/)?.[1] ?? "";
19432
+ const wrapInTags = (s) => outerOpenTags ? outerOpenTags + s + outerCloseTags : s;
19433
+ const leadingMatch = innerVisible.match(leadingPunctuationPattern);
19434
+ const extractedLeading = leadingMatch ? leadingMatch[1] : "";
19435
+ const lp = state2.pendingLeadingPunct + (extractedLeading ? wrapInTags(extractedLeading) : "");
19436
+ const leadingPunctuation = lp.length ? lp : void 0;
19437
+ state2.pendingLeadingPunct = "";
19438
+ let wordForTrailing = word;
19439
+ if (extractedLeading) {
19440
+ wordForTrailing = word.replace(new RegExp("^((?:<[^>]+>)*)" + escapeRegExp(extractedLeading)), "$1");
19441
+ }
19442
+ const visibleAfterLeading = extractedLeading ? innerVisible.slice(extractedLeading.length) : innerVisible;
19443
+ const punctMatch = visibleAfterLeading.match(trailingPunctuationPattern);
19444
+ if (punctMatch) {
19445
+ const punc = punctMatch[1];
19446
+ const rebuilt = wordForTrailing.replace(new RegExp(escapeRegExp(punc) + "(</)"), "$1");
19447
+ state2.segments.push({
19448
+ id: `${state2.globalIndex}`,
19449
+ text: decodeNbsp(rebuilt),
19450
+ leadingPunctuation,
19451
+ trailingPunctuation: wrapInTags(punc)
19452
+ });
19453
+ } else {
19454
+ state2.segments.push({ id: `${state2.globalIndex}`, text: decodeNbsp(wordForTrailing), leadingPunctuation });
19455
+ }
19456
+ state2.globalIndex++;
19457
+ };
19458
+ const processPlainWord = (visibleWord, state2) => {
19459
+ const { leadingPunctuation, extractedLeading } = flushLeadingPunct(visibleWord, state2);
19460
+ let wordAfterLeading = extractedLeading ? visibleWord.slice(extractedLeading.length) : visibleWord;
19461
+ const openingCharsAtEnd = wordAfterLeading.match(openingCharsAtWordEndPattern);
19462
+ if (openingCharsAtEnd) {
19463
+ state2.pendingLeadingPunct += openingCharsAtEnd[1];
19464
+ wordAfterLeading = wordAfterLeading.slice(0, -openingCharsAtEnd[1].length);
19465
+ }
19466
+ if (!wordAfterLeading.length) return;
19467
+ const punctMatch = wordAfterLeading.match(trailingPunctuationPattern);
19468
+ const text = decodeNbsp(punctMatch ? wordAfterLeading.slice(0, -punctMatch[1].length) : wordAfterLeading);
19469
+ const trailingPunctuation = punctMatch ? punctMatch[1] : void 0;
19470
+ state2.segments.push({ id: `${state2.globalIndex}`, text, leadingPunctuation, trailingPunctuation });
19471
+ state2.globalIndex++;
19472
+ };
19473
+ const processContentfulToken = (match, state2) => {
19474
+ const outerOpen = match[1] ?? "";
19475
+ const outerClose = match[3] ?? "";
19476
+ const rawContent = match[2].trim();
19477
+ const displayText = decodeNbsp(rawContent);
19478
+ if (!displayText) return;
19479
+ const { leadingPunctuation, extractedLeading } = flushLeadingPunct(displayText, state2);
19480
+ const textAfterLeading = extractedLeading ? displayText.slice(extractedLeading.length) : displayText;
19481
+ const rawAfterLeading = extractedLeading ? rawContent.slice(extractedLeading.length) : rawContent;
19482
+ const punctMatch = textAfterLeading.match(trailingPunctuationPattern);
19483
+ const rawText = punctMatch ? rawAfterLeading.slice(0, -punctMatch[1].length) : rawAfterLeading;
19484
+ const trailingPunctuation = punctMatch ? punctMatch[1] : void 0;
19485
+ const innerText = punctMatch ? textAfterLeading.slice(0, -punctMatch[1].length) : textAfterLeading;
19486
+ const text = outerOpen + innerText + outerClose;
19487
+ state2.segments.push({
19488
+ id: `${state2.globalIndex}`,
19489
+ text,
19490
+ rawText,
19491
+ leadingPunctuation,
19492
+ trailingPunctuation,
19493
+ isContentful: true
19494
+ });
19495
+ state2.globalIndex++;
19496
+ };
19389
19497
  const parseSentences = (rawText) => {
19390
19498
  const paragraphs = splitParagraphs(rawText);
19391
19499
  const segments = [];
19392
19500
  let posIndex = 0;
19393
19501
  for (let pIdx = 0; pIdx < paragraphs.length; pIdx++) {
19394
- const para = paragraphs[pIdx];
19395
- const decoded = para.replace(/&lt;eat-contentful&gt;/g, "<eat-contentful>").replace(/&lt;\/eat-contentful&gt;/g, "</eat-contentful>").replace(/&lt;eat-sentence&gt;/g, "<eat-sentence>");
19502
+ const decoded = decodeAuthored(paragraphs[pIdx]).replace(/&lt;eat-sentence&gt;/g, "<eat-sentence>");
19396
19503
  const chunks = decoded.split("<eat-sentence>");
19397
19504
  for (const chunk of chunks) {
19398
19505
  const contentfulMatch = chunk.match(/((?:<(?!\/?eat-)[^>]+>)*)<eat-contentful>(.*?)<\/eat-contentful>([\s\S]*)/);
@@ -19402,10 +19509,8 @@ const parseSentences = (rawText) => {
19402
19509
  const displayText = decodeNbsp(rawChunk);
19403
19510
  if (displayText) {
19404
19511
  const text = contentfulMatch ? outerOpen + displayText + outerClose : displayText;
19405
- const id = String(posIndex);
19406
19512
  const rawText2 = contentfulMatch ? rawChunk : void 0;
19407
- const isContentful = !!contentfulMatch;
19408
- segments.push({ id, text, rawText: rawText2, isContentful: isContentful || void 0 });
19513
+ segments.push({ id: String(posIndex), text, rawText: rawText2, isContentful: contentfulMatch ? true : void 0 });
19409
19514
  posIndex++;
19410
19515
  }
19411
19516
  }
@@ -19417,113 +19522,50 @@ const parseSentences = (rawText) => {
19417
19522
  };
19418
19523
  const parseWords = (rawText) => {
19419
19524
  const paragraphs = splitParagraphs(rawText);
19420
- const segments = [];
19421
- let globalIndex = 0;
19422
- const tokenRegex = /((?:<(?!\/?eat-)[^>]+>)*)<eat-contentful>(.*?)<\/eat-contentful>((?:<\/[^>]+>)*)|((?:<(?!\/?eat-)[^>]*>|[^<>])+)/g;
19423
- const trailingPunctRe = /([.,!?;:)\]}"'\u201D\u2019»…\u2014\u2013]+)$/;
19424
- const leadingPunctRe = /^([([{'""\u201C\u2018]+)/;
19425
- const purePunctRe = /^[^\w\u00C0-\u024F]+$/;
19525
+ const state2 = {
19526
+ segments: [],
19527
+ globalIndex: 0,
19528
+ pendingLeadingPunct: "",
19529
+ openDoubleQuoteDepth: 0,
19530
+ openSingleQuoteDepth: 0
19531
+ };
19426
19532
  for (let pIdx = 0; pIdx < paragraphs.length; pIdx++) {
19427
- const para = paragraphs[pIdx];
19428
- const decoded = para.replace(/&lt;eat-contentful&gt;/g, "<eat-contentful>").replace(/&lt;\/eat-contentful&gt;/g, "</eat-contentful>");
19429
- tokenRegex.lastIndex = 0;
19533
+ const decoded = decodeAuthored(paragraphs[pIdx]);
19534
+ const tokenRegex = new RegExp(TOKEN_PATTERN, "g");
19535
+ state2.pendingLeadingPunct = "";
19536
+ state2.openDoubleQuoteDepth = 0;
19537
+ state2.openSingleQuoteDepth = 0;
19430
19538
  let match;
19431
- let pendingLeadingPunct = "";
19432
- const flushLeadingPunct = (text) => {
19433
- const m = text.match(leadingPunctRe);
19434
- const extractedLeading = m ? m[1] : "";
19435
- const lp = pendingLeadingPunct + extractedLeading;
19436
- const leadingPunctuation = lp.length ? lp : void 0;
19437
- pendingLeadingPunct = "";
19438
- return { leadingPunctuation, extractedLeading };
19439
- };
19440
19539
  while ((match = tokenRegex.exec(decoded)) !== null) {
19441
19540
  if (match[2] !== void 0) {
19442
- const outerOpen = match[1] ?? "";
19443
- const outerClose = match[3] ?? "";
19444
- const rawContent = match[2].trim();
19445
- const displayText = decodeNbsp(rawContent);
19446
- if (displayText) {
19447
- const { leadingPunctuation, extractedLeading } = flushLeadingPunct(displayText);
19448
- const textAfterLeading = extractedLeading ? displayText.slice(extractedLeading.length) : displayText;
19449
- const rawAfterLeading = extractedLeading ? rawContent.slice(extractedLeading.length) : rawContent;
19450
- const punctMatch = textAfterLeading.match(trailingPunctRe);
19451
- const rawText2 = punctMatch ? rawAfterLeading.slice(0, -punctMatch[1].length) : rawAfterLeading;
19452
- const trailingPunctuation = punctMatch ? punctMatch[1] : void 0;
19453
- const innerText = punctMatch ? textAfterLeading.slice(0, -punctMatch[1].length) : textAfterLeading;
19454
- const text = outerOpen + innerText + outerClose;
19455
- const id = `${globalIndex}`;
19456
- segments.push({ id, text, rawText: rawText2, leadingPunctuation, trailingPunctuation, isContentful: true });
19457
- globalIndex++;
19458
- }
19541
+ processContentfulToken(match, state2);
19459
19542
  } else if (match[4] !== void 0) {
19460
19543
  const rawChunk = match[4];
19461
19544
  const words = hasHtmlTags(rawChunk) ? extractHtmlWords(rawChunk) : rawChunk.split(/\s+/).filter(Boolean);
19462
19545
  for (const word of words) {
19463
- const visibleWord = hasHtmlTags(word) ? stripTags(word) : decodeHtmlEntities(word);
19464
- if (purePunctRe.test(visibleWord)) {
19465
- if (leadingPunctRe.test(visibleWord)) {
19466
- pendingLeadingPunct += visibleWord;
19467
- } else {
19468
- const prev = segments[segments.length - 1];
19469
- if (prev && !prev.isPunctuation && !prev.isLineBreak) {
19470
- prev.trailingPunctuation = (prev.trailingPunctuation ?? "") + visibleWord;
19471
- } else {
19472
- segments.push({ id: `${globalIndex}`, text: visibleWord, isPunctuation: true });
19473
- globalIndex++;
19474
- }
19475
- }
19546
+ const visibleWord = hasHtmlTags(word) ? decodeHtmlEntities(stripTags(word)) : decodeHtmlEntities(word);
19547
+ if (wordContainsOnlyPunctuationPattern.test(visibleWord)) {
19548
+ processPurePunctWord(visibleWord, state2);
19549
+ } else if (hasHtmlTags(word)) {
19550
+ processHtmlWord(word, state2);
19476
19551
  } else {
19477
- if (hasHtmlTags(word)) {
19478
- const innerVisible = stripTags(word);
19479
- const { leadingPunctuation, extractedLeading } = flushLeadingPunct(innerVisible);
19480
- let wordForTrailing = word;
19481
- if (extractedLeading) {
19482
- wordForTrailing = word.replace(new RegExp("^((?:<[^>]+>)*)" + escapeRegExp(extractedLeading)), "$1");
19483
- }
19484
- const visibleAfterLeading = extractedLeading ? innerVisible.slice(extractedLeading.length) : innerVisible;
19485
- const punctMatch = visibleAfterLeading.match(trailingPunctRe);
19486
- if (punctMatch) {
19487
- const punc = punctMatch[1];
19488
- const rebuilt = wordForTrailing.replace(new RegExp(escapeRegExp(punc) + "(</)"), "$1");
19489
- segments.push({
19490
- id: `${globalIndex}`,
19491
- text: decodeNbsp(rebuilt),
19492
- leadingPunctuation,
19493
- trailingPunctuation: punc
19494
- });
19495
- } else {
19496
- segments.push({ id: `${globalIndex}`, text: decodeNbsp(wordForTrailing), leadingPunctuation });
19497
- }
19498
- } else {
19499
- const { leadingPunctuation, extractedLeading } = flushLeadingPunct(visibleWord);
19500
- const wordAfterLeading = extractedLeading ? visibleWord.slice(extractedLeading.length) : visibleWord;
19501
- const punctMatch = wordAfterLeading.match(trailingPunctRe);
19502
- const text = decodeNbsp(punctMatch ? wordAfterLeading.slice(0, -punctMatch[1].length) : wordAfterLeading);
19503
- const trailingPunctuation = punctMatch ? punctMatch[1] : void 0;
19504
- segments.push({ id: `${globalIndex}`, text, leadingPunctuation, trailingPunctuation });
19505
- }
19506
- globalIndex++;
19552
+ processPlainWord(visibleWord, state2);
19507
19553
  }
19508
19554
  }
19509
19555
  }
19510
19556
  }
19511
- if (pendingLeadingPunct) {
19512
- segments.push({ id: `${globalIndex}`, text: pendingLeadingPunct, isPunctuation: true });
19513
- globalIndex++;
19557
+ if (state2.pendingLeadingPunct) {
19558
+ state2.segments.push({ id: `${state2.globalIndex}`, text: state2.pendingLeadingPunct, isPunctuation: true });
19559
+ state2.globalIndex++;
19560
+ state2.pendingLeadingPunct = "";
19514
19561
  }
19515
19562
  if (pIdx < paragraphs.length - 1) {
19516
- segments.push({ id: `br-${pIdx}`, text: "", isLineBreak: true });
19563
+ state2.segments.push({ id: `br-${pIdx}`, text: "", isLineBreak: true });
19517
19564
  }
19518
19565
  }
19519
- return segments;
19520
- };
19521
- const parseSelectableText = (text, selectableType) => {
19522
- if (selectableType === "Sentence") {
19523
- return parseSentences(text);
19524
- }
19525
- return parseWords(text);
19566
+ return state2.segments;
19526
19567
  };
19568
+ const parseSelectableText = (text, selectableType) => selectableType === "Sentence" ? parseSentences(text) : parseWords(text);
19527
19569
  function getSegmentState(segmentId, selectedIds, correctAnswerIds, isPreviewMode2, isValidating) {
19528
19570
  const isSegmentSelected = selectedIds.includes(segmentId);
19529
19571
  const isInCorrectAnswers = correctAnswerIds.includes(segmentId);
@@ -19708,14 +19750,14 @@ init_fn = function() {
19708
19750
  let SvelteSet = _SvelteSet;
19709
19751
  var root_3$1 = /* @__PURE__ */ from_html(`<br/>`);
19710
19752
  var root_5 = /* @__PURE__ */ from_html(`<span class="segment-punctuation" aria-hidden="true"><!></span>`);
19711
- var root_8 = /* @__PURE__ */ from_html(`<span class="segment-leading-punct" aria-hidden="true"> </span>`);
19753
+ var root_8 = /* @__PURE__ */ from_html(`<span class="segment-leading-punct" aria-hidden="true"><!></span>`);
19712
19754
  var root_9 = /* @__PURE__ */ from_html(`<span class="selectable-segment-missing-badge" aria-hidden="true" data-testid="select-mis-ans-tt">Missing answer</span>`);
19713
19755
  var root_10 = /* @__PURE__ */ from_html(`<span aria-hidden="true" class="selectable-segment-deselect-icon" data-testid="select-close-icon"><!></span>`);
19714
19756
  var root_12 = /* @__PURE__ */ from_html(`<span aria-hidden="true" class="selectable-segment-status-icon"><!></span>`);
19715
19757
  var root_13 = /* @__PURE__ */ from_html(`<span class="sr-only">Correct answer</span>`);
19716
19758
  var root_14 = /* @__PURE__ */ from_html(`<span class="sr-only">Incorrect answer</span>`);
19717
19759
  var root_15 = /* @__PURE__ */ from_html(`<span class="sr-only">Missing answer</span>`);
19718
- var root_16 = /* @__PURE__ */ from_html(`<span class="segment-trailing-punct" aria-hidden="true"> </span>`);
19760
+ var root_16 = /* @__PURE__ */ from_html(`<span class="segment-trailing-punct" aria-hidden="true"><!></span>`);
19719
19761
  var root_7 = /* @__PURE__ */ from_html(`<span class="segment-word-group"><!><span role="button"><!><span class="selectable-segment-text"><!><!></span><!><!><!></span><!></span>`);
19720
19762
  var root_18 = /* @__PURE__ */ from_html(`<span class="selectable-segment-missing-badge" aria-hidden="true" data-testid="select-mis-ans-tt">Missing answer</span>`);
19721
19763
  var root_19 = /* @__PURE__ */ from_html(`<span aria-hidden="true" class="selectable-segment-deselect-icon" data-testid="select-close-icon"><!></span>`);
@@ -19736,7 +19778,7 @@ var root_37 = /* @__PURE__ */ from_html(`<!><!>`, 1);
19736
19778
  var root_41 = /* @__PURE__ */ from_html(`<span class="sr-only">Correct answer</span>`);
19737
19779
  var root_42 = /* @__PURE__ */ from_html(`<span class="sr-only">Incorrect answer</span>`);
19738
19780
  var root_43 = /* @__PURE__ */ from_html(`<span class="sr-only">Missing answer</span>`);
19739
- var root_44 = /* @__PURE__ */ from_html(`<span class="segment-trailing-punct" aria-hidden="true"> </span>`);
19781
+ var root_44 = /* @__PURE__ */ from_html(`<span class="segment-trailing-punct" aria-hidden="true"><!></span>`);
19740
19782
  var root_31 = /* @__PURE__ */ from_html(`<span role="button"><!><span class="selectable-segment-text"><!></span><!><!><!></span><!>`, 1);
19741
19783
  var root_28 = /* @__PURE__ */ from_html(`<span></span>`);
19742
19784
  var root = /* @__PURE__ */ from_html(`<main class="selectable-text-passage" aria-describedby="passage-reader" data-testid="select-passage-ctr"><span id="passage-reader" class="sr-only"> </span> <div><!></div></main>`);
@@ -19755,7 +19797,7 @@ function SelectableTextInteractionContent($$anchor, $$props) {
19755
19797
  const { stripTags: stripTags2, decodeHtmlEntities: decodeHtmlEntities2 } = htmlUtils;
19756
19798
  let passagePlainText = /* @__PURE__ */ user_derived(() => segments.map((s) => {
19757
19799
  if (s.isLineBreak) return " ";
19758
- return (s.leadingPunctuation ?? "") + decodeHtmlEntities2(stripTags2(s.text)) + (s.trailingPunctuation ?? "");
19800
+ return stripTags2(s.leadingPunctuation ?? "") + decodeHtmlEntities2(stripTags2(s.text)) + stripTags2(s.trailingPunctuation ?? "");
19759
19801
  }).join(" ").replace(/\s+/g, " ").trim());
19760
19802
  const getSegmentAriaLabel = (segment, seg, segmentId) => {
19761
19803
  const text = stripTags2(segment.text);
@@ -20032,9 +20074,9 @@ function SelectableTextInteractionContent($$anchor, $$props) {
20032
20074
  {
20033
20075
  var consequent_2 = ($$anchor7) => {
20034
20076
  var span_3 = root_8();
20035
- var text_2 = child(span_3, true);
20077
+ var node_7 = child(span_3);
20078
+ html(node_7, () => get$1(segment).leadingPunctuation);
20036
20079
  reset(span_3);
20037
- template_effect(() => set_text(text_2, get$1(segment).leadingPunctuation));
20038
20080
  append($$anchor7, span_3);
20039
20081
  };
20040
20082
  if_block(node_6, ($$render) => {
@@ -20044,39 +20086,39 @@ function SelectableTextInteractionContent($$anchor, $$props) {
20044
20086
  var span_4 = sibling(node_6);
20045
20087
  span_4.__click = () => handleSegmentClick(get$1(segment).id);
20046
20088
  span_4.__keydown = (e2) => handleSegmentKeydown(e2, get$1(segment).id);
20047
- var node_7 = child(span_4);
20089
+ var node_8 = child(span_4);
20048
20090
  {
20049
20091
  var consequent_3 = ($$anchor7) => {
20050
20092
  var span_5 = root_9();
20051
20093
  append($$anchor7, span_5);
20052
20094
  };
20053
- if_block(node_7, ($$render) => {
20095
+ if_block(node_8, ($$render) => {
20054
20096
  if (get$1(computed_const).seg.isMissing) $$render(consequent_3);
20055
20097
  });
20056
20098
  }
20057
- var span_6 = sibling(node_7);
20058
- var node_8 = child(span_6);
20059
- html(node_8, () => get$1(segment).text);
20060
- var node_9 = sibling(node_8);
20099
+ var span_6 = sibling(node_8);
20100
+ var node_9 = child(span_6);
20101
+ html(node_9, () => get$1(segment).text);
20102
+ var node_10 = sibling(node_9);
20061
20103
  {
20062
20104
  var consequent_4 = ($$anchor7) => {
20063
20105
  var span_7 = root_10();
20064
- var node_10 = child(span_7);
20065
- SvgLoader(node_10, { svgName: "crossIcon", className: "deselect-icon" });
20106
+ var node_11 = child(span_7);
20107
+ SvgLoader(node_11, { svgName: "crossIcon", className: "deselect-icon" });
20066
20108
  reset(span_7);
20067
20109
  append($$anchor7, span_7);
20068
20110
  };
20069
20111
  var alternate = ($$anchor7) => {
20070
20112
  var fragment_4 = comment();
20071
- var node_11 = first_child(fragment_4);
20113
+ var node_12 = first_child(fragment_4);
20072
20114
  {
20073
20115
  var consequent_5 = ($$anchor8) => {
20074
20116
  var span_8 = root_12();
20075
- var node_12 = child(span_8);
20117
+ var node_13 = child(span_8);
20076
20118
  {
20077
20119
  let $0 = /* @__PURE__ */ user_derived(() => get$1(computed_const).seg.isCorrect ? "successSolid" : "errorSolid");
20078
20120
  let $1 = /* @__PURE__ */ user_derived(() => get$1(computed_const).seg.isCorrect ? "correct-icon" : "incorrect-icon");
20079
- SvgLoader(node_12, {
20121
+ SvgLoader(node_13, {
20080
20122
  get svgName() {
20081
20123
  return get$1($0);
20082
20124
  },
@@ -20090,7 +20132,7 @@ function SelectableTextInteractionContent($$anchor, $$props) {
20090
20132
  append($$anchor8, span_8);
20091
20133
  };
20092
20134
  if_block(
20093
- node_11,
20135
+ node_12,
20094
20136
  ($$render) => {
20095
20137
  if (get$1(computed_const).seg.isCorrect || get$1(computed_const).seg.isIncorrect) $$render(consequent_5);
20096
20138
  },
@@ -20099,53 +20141,53 @@ function SelectableTextInteractionContent($$anchor, $$props) {
20099
20141
  }
20100
20142
  append($$anchor7, fragment_4);
20101
20143
  };
20102
- if_block(node_9, ($$render) => {
20144
+ if_block(node_10, ($$render) => {
20103
20145
  if (get$1(computed_const).seg.isSegmentSelected && !get$1(sharedState).isValidating && !get$1(sharedState).isPreviewMode) $$render(consequent_4);
20104
20146
  else $$render(alternate, false);
20105
20147
  });
20106
20148
  }
20107
20149
  reset(span_6);
20108
- var node_13 = sibling(span_6);
20150
+ var node_14 = sibling(span_6);
20109
20151
  {
20110
20152
  var consequent_6 = ($$anchor7) => {
20111
20153
  var span_9 = root_13();
20112
20154
  append($$anchor7, span_9);
20113
20155
  };
20114
- if_block(node_13, ($$render) => {
20156
+ if_block(node_14, ($$render) => {
20115
20157
  if (get$1(computed_const).seg.isCorrect) $$render(consequent_6);
20116
20158
  });
20117
20159
  }
20118
- var node_14 = sibling(node_13);
20160
+ var node_15 = sibling(node_14);
20119
20161
  {
20120
20162
  var consequent_7 = ($$anchor7) => {
20121
20163
  var span_10 = root_14();
20122
20164
  append($$anchor7, span_10);
20123
20165
  };
20124
- if_block(node_14, ($$render) => {
20166
+ if_block(node_15, ($$render) => {
20125
20167
  if (get$1(computed_const).seg.isIncorrect) $$render(consequent_7);
20126
20168
  });
20127
20169
  }
20128
- var node_15 = sibling(node_14);
20170
+ var node_16 = sibling(node_15);
20129
20171
  {
20130
20172
  var consequent_8 = ($$anchor7) => {
20131
20173
  var span_11 = root_15();
20132
20174
  append($$anchor7, span_11);
20133
20175
  };
20134
- if_block(node_15, ($$render) => {
20176
+ if_block(node_16, ($$render) => {
20135
20177
  if (get$1(computed_const).seg.isMissing) $$render(consequent_8);
20136
20178
  });
20137
20179
  }
20138
20180
  reset(span_4);
20139
- var node_16 = sibling(span_4);
20181
+ var node_17 = sibling(span_4);
20140
20182
  {
20141
20183
  var consequent_9 = ($$anchor7) => {
20142
20184
  var span_12 = root_16();
20143
- var text_3 = child(span_12, true);
20185
+ var node_18 = child(span_12);
20186
+ html(node_18, () => get$1(segment).trailingPunctuation);
20144
20187
  reset(span_12);
20145
- template_effect(() => set_text(text_3, get$1(segment).trailingPunctuation));
20146
20188
  append($$anchor7, span_12);
20147
20189
  };
20148
- if_block(node_16, ($$render) => {
20190
+ if_block(node_17, ($$render) => {
20149
20191
  if (get$1(segment).trailingPunctuation) $$render(consequent_9);
20150
20192
  });
20151
20193
  }
@@ -20174,39 +20216,39 @@ function SelectableTextInteractionContent($$anchor, $$props) {
20174
20216
  var span_13 = root_17();
20175
20217
  span_13.__click = () => handleSegmentClick(get$1(segment).id);
20176
20218
  span_13.__keydown = (e2) => handleSegmentKeydown(e2, get$1(segment).id);
20177
- var node_17 = child(span_13);
20219
+ var node_19 = child(span_13);
20178
20220
  {
20179
20221
  var consequent_11 = ($$anchor7) => {
20180
20222
  var span_14 = root_18();
20181
20223
  append($$anchor7, span_14);
20182
20224
  };
20183
- if_block(node_17, ($$render) => {
20225
+ if_block(node_19, ($$render) => {
20184
20226
  if (get$1(computed_const).seg.isMissing) $$render(consequent_11);
20185
20227
  });
20186
20228
  }
20187
- var span_15 = sibling(node_17);
20188
- var node_18 = child(span_15);
20189
- html(node_18, () => get$1(segment).text);
20190
- var node_19 = sibling(node_18);
20229
+ var span_15 = sibling(node_19);
20230
+ var node_20 = child(span_15);
20231
+ html(node_20, () => get$1(segment).text);
20232
+ var node_21 = sibling(node_20);
20191
20233
  {
20192
20234
  var consequent_12 = ($$anchor7) => {
20193
20235
  var span_16 = root_19();
20194
- var node_20 = child(span_16);
20195
- SvgLoader(node_20, { svgName: "crossIcon", className: "deselect-icon" });
20236
+ var node_22 = child(span_16);
20237
+ SvgLoader(node_22, { svgName: "crossIcon", className: "deselect-icon" });
20196
20238
  reset(span_16);
20197
20239
  append($$anchor7, span_16);
20198
20240
  };
20199
20241
  var alternate_1 = ($$anchor7) => {
20200
20242
  var fragment_5 = comment();
20201
- var node_21 = first_child(fragment_5);
20243
+ var node_23 = first_child(fragment_5);
20202
20244
  {
20203
20245
  var consequent_13 = ($$anchor8) => {
20204
20246
  var span_17 = root_21();
20205
- var node_22 = child(span_17);
20247
+ var node_24 = child(span_17);
20206
20248
  {
20207
20249
  let $0 = /* @__PURE__ */ user_derived(() => get$1(computed_const).seg.isCorrect ? "successSolid" : "errorSolid");
20208
20250
  let $1 = /* @__PURE__ */ user_derived(() => get$1(computed_const).seg.isCorrect ? "correct-icon" : "incorrect-icon");
20209
- SvgLoader(node_22, {
20251
+ SvgLoader(node_24, {
20210
20252
  get svgName() {
20211
20253
  return get$1($0);
20212
20254
  },
@@ -20220,7 +20262,7 @@ function SelectableTextInteractionContent($$anchor, $$props) {
20220
20262
  append($$anchor8, span_17);
20221
20263
  };
20222
20264
  if_block(
20223
- node_21,
20265
+ node_23,
20224
20266
  ($$render) => {
20225
20267
  if (get$1(computed_const).seg.isCorrect || get$1(computed_const).seg.isIncorrect) $$render(consequent_13);
20226
20268
  },
@@ -20229,39 +20271,39 @@ function SelectableTextInteractionContent($$anchor, $$props) {
20229
20271
  }
20230
20272
  append($$anchor7, fragment_5);
20231
20273
  };
20232
- if_block(node_19, ($$render) => {
20274
+ if_block(node_21, ($$render) => {
20233
20275
  if (get$1(computed_const).seg.isSegmentSelected && !get$1(sharedState).isValidating && !get$1(sharedState).isPreviewMode) $$render(consequent_12);
20234
20276
  else $$render(alternate_1, false);
20235
20277
  });
20236
20278
  }
20237
20279
  reset(span_15);
20238
- var node_23 = sibling(span_15);
20280
+ var node_25 = sibling(span_15);
20239
20281
  {
20240
20282
  var consequent_14 = ($$anchor7) => {
20241
20283
  var span_18 = root_22();
20242
20284
  append($$anchor7, span_18);
20243
20285
  };
20244
- if_block(node_23, ($$render) => {
20286
+ if_block(node_25, ($$render) => {
20245
20287
  if (get$1(computed_const).seg.isCorrect) $$render(consequent_14);
20246
20288
  });
20247
20289
  }
20248
- var node_24 = sibling(node_23);
20290
+ var node_26 = sibling(node_25);
20249
20291
  {
20250
20292
  var consequent_15 = ($$anchor7) => {
20251
20293
  var span_19 = root_23();
20252
20294
  append($$anchor7, span_19);
20253
20295
  };
20254
- if_block(node_24, ($$render) => {
20296
+ if_block(node_26, ($$render) => {
20255
20297
  if (get$1(computed_const).seg.isIncorrect) $$render(consequent_15);
20256
20298
  });
20257
20299
  }
20258
- var node_25 = sibling(node_24);
20300
+ var node_27 = sibling(node_26);
20259
20301
  {
20260
20302
  var consequent_16 = ($$anchor7) => {
20261
20303
  var span_20 = root_24();
20262
20304
  append($$anchor7, span_20);
20263
20305
  };
20264
- if_block(node_25, ($$render) => {
20306
+ if_block(node_27, ($$render) => {
20265
20307
  if (get$1(computed_const).seg.isMissing) $$render(consequent_16);
20266
20308
  });
20267
20309
  }
@@ -20315,10 +20357,10 @@ function SelectableTextInteractionContent($$anchor, $$props) {
20315
20357
  };
20316
20358
  var alternate_10 = ($$anchor2) => {
20317
20359
  var fragment_6 = comment();
20318
- var node_26 = first_child(fragment_6);
20319
- each(node_26, 19, () => sentenceDisplayRows, (row, rowIdx) => Array.isArray(row) ? segments[row[0]].id : `break-${rowIdx}`, ($$anchor3, row) => {
20360
+ var node_28 = first_child(fragment_6);
20361
+ each(node_28, 19, () => sentenceDisplayRows, (row, rowIdx) => Array.isArray(row) ? segments[row[0]].id : `break-${rowIdx}`, ($$anchor3, row) => {
20320
20362
  var fragment_7 = comment();
20321
- var node_27 = first_child(fragment_7);
20363
+ var node_29 = first_child(fragment_7);
20322
20364
  {
20323
20365
  var consequent_18 = ($$anchor4) => {
20324
20366
  var br_1 = root_27();
@@ -20334,12 +20376,12 @@ function SelectableTextInteractionContent($$anchor, $$props) {
20334
20376
  });
20335
20377
  const isSessionLocked = /* @__PURE__ */ user_derived(() => get$1(sharedState).isSessionMode && get$1(sharedState).isValidating && !get$1(computed_const_1).seg.isMissing);
20336
20378
  var fragment_8 = comment();
20337
- var node_28 = first_child(fragment_8);
20379
+ var node_30 = first_child(fragment_8);
20338
20380
  {
20339
20381
  var consequent_19 = ($$anchor6) => {
20340
20382
  var span_22 = root_30();
20341
- var node_29 = child(span_22);
20342
- html(node_29, () => get$1(segment).text);
20383
+ var node_31 = child(span_22);
20384
+ html(node_31, () => get$1(segment).text);
20343
20385
  reset(span_22);
20344
20386
  append($$anchor6, span_22);
20345
20387
  };
@@ -20348,18 +20390,18 @@ function SelectableTextInteractionContent($$anchor, $$props) {
20348
20390
  var span_23 = first_child(fragment_9);
20349
20391
  span_23.__click = () => handleSegmentClick(get$1(segment).id);
20350
20392
  span_23.__keydown = (e2) => handleSegmentKeydown(e2, get$1(segment).id);
20351
- var node_30 = child(span_23);
20393
+ var node_32 = child(span_23);
20352
20394
  {
20353
20395
  var consequent_20 = ($$anchor7) => {
20354
20396
  var span_24 = root_32();
20355
20397
  append($$anchor7, span_24);
20356
20398
  };
20357
- if_block(node_30, ($$render) => {
20399
+ if_block(node_32, ($$render) => {
20358
20400
  if (get$1(computed_const_1).seg.isMissing) $$render(consequent_20);
20359
20401
  });
20360
20402
  }
20361
- var span_25 = sibling(node_30);
20362
- var node_31 = child(span_25);
20403
+ var span_25 = sibling(node_32);
20404
+ var node_33 = child(span_25);
20363
20405
  {
20364
20406
  var consequent_23 = ($$anchor7) => {
20365
20407
  const computed_const_2 = /* @__PURE__ */ user_derived(() => {
@@ -20367,31 +20409,31 @@ function SelectableTextInteractionContent($$anchor, $$props) {
20367
20409
  return { bodyText, lastWord };
20368
20410
  });
20369
20411
  var fragment_10 = root_33();
20370
- var node_32 = first_child(fragment_10);
20371
- html(node_32, () => get$1(computed_const_2).bodyText);
20372
- var span_26 = sibling(node_32);
20373
- var node_33 = child(span_26);
20374
- html(node_33, () => get$1(computed_const_2).lastWord);
20375
- var node_34 = sibling(node_33);
20412
+ var node_34 = first_child(fragment_10);
20413
+ html(node_34, () => get$1(computed_const_2).bodyText);
20414
+ var span_26 = sibling(node_34);
20415
+ var node_35 = child(span_26);
20416
+ html(node_35, () => get$1(computed_const_2).lastWord);
20417
+ var node_36 = sibling(node_35);
20376
20418
  {
20377
20419
  var consequent_21 = ($$anchor8) => {
20378
20420
  var span_27 = root_34();
20379
- var node_35 = child(span_27);
20380
- SvgLoader(node_35, { svgName: "crossIcon", className: "deselect-icon" });
20421
+ var node_37 = child(span_27);
20422
+ SvgLoader(node_37, { svgName: "crossIcon", className: "deselect-icon" });
20381
20423
  reset(span_27);
20382
20424
  append($$anchor8, span_27);
20383
20425
  };
20384
20426
  var alternate_5 = ($$anchor8) => {
20385
20427
  var fragment_11 = comment();
20386
- var node_36 = first_child(fragment_11);
20428
+ var node_38 = first_child(fragment_11);
20387
20429
  {
20388
20430
  var consequent_22 = ($$anchor9) => {
20389
20431
  var span_28 = root_36();
20390
- var node_37 = child(span_28);
20432
+ var node_39 = child(span_28);
20391
20433
  {
20392
20434
  let $0 = /* @__PURE__ */ user_derived(() => get$1(computed_const_1).seg.isCorrect ? "successSolid" : "errorSolid");
20393
20435
  let $1 = /* @__PURE__ */ user_derived(() => get$1(computed_const_1).seg.isCorrect ? "correct-icon" : "incorrect-icon");
20394
- SvgLoader(node_37, {
20436
+ SvgLoader(node_39, {
20395
20437
  get svgName() {
20396
20438
  return get$1($0);
20397
20439
  },
@@ -20405,7 +20447,7 @@ function SelectableTextInteractionContent($$anchor, $$props) {
20405
20447
  append($$anchor9, span_28);
20406
20448
  };
20407
20449
  if_block(
20408
- node_36,
20450
+ node_38,
20409
20451
  ($$render) => {
20410
20452
  if (get$1(computed_const_1).seg.isCorrect || get$1(computed_const_1).seg.isIncorrect) $$render(consequent_22);
20411
20453
  },
@@ -20414,7 +20456,7 @@ function SelectableTextInteractionContent($$anchor, $$props) {
20414
20456
  }
20415
20457
  append($$anchor8, fragment_11);
20416
20458
  };
20417
- if_block(node_34, ($$render) => {
20459
+ if_block(node_36, ($$render) => {
20418
20460
  if (get$1(computed_const_1).seg.isSegmentSelected && !get$1(sharedState).isValidating && !get$1(sharedState).isPreviewMode) $$render(consequent_21);
20419
20461
  else $$render(alternate_5, false);
20420
20462
  });
@@ -20424,28 +20466,28 @@ function SelectableTextInteractionContent($$anchor, $$props) {
20424
20466
  };
20425
20467
  var alternate_7 = ($$anchor7) => {
20426
20468
  var fragment_12 = root_37();
20427
- var node_38 = first_child(fragment_12);
20428
- html(node_38, () => get$1(segment).text);
20429
- var node_39 = sibling(node_38);
20469
+ var node_40 = first_child(fragment_12);
20470
+ html(node_40, () => get$1(segment).text);
20471
+ var node_41 = sibling(node_40);
20430
20472
  {
20431
20473
  var consequent_24 = ($$anchor8) => {
20432
20474
  var span_29 = root_38();
20433
- var node_40 = child(span_29);
20434
- SvgLoader(node_40, { svgName: "crossIcon", className: "deselect-icon" });
20475
+ var node_42 = child(span_29);
20476
+ SvgLoader(node_42, { svgName: "crossIcon", className: "deselect-icon" });
20435
20477
  reset(span_29);
20436
20478
  append($$anchor8, span_29);
20437
20479
  };
20438
20480
  var alternate_6 = ($$anchor8) => {
20439
20481
  var fragment_13 = comment();
20440
- var node_41 = first_child(fragment_13);
20482
+ var node_43 = first_child(fragment_13);
20441
20483
  {
20442
20484
  var consequent_25 = ($$anchor9) => {
20443
20485
  var span_30 = root_40();
20444
- var node_42 = child(span_30);
20486
+ var node_44 = child(span_30);
20445
20487
  {
20446
20488
  let $0 = /* @__PURE__ */ user_derived(() => get$1(computed_const_1).seg.isCorrect ? "successSolid" : "errorSolid");
20447
20489
  let $1 = /* @__PURE__ */ user_derived(() => get$1(computed_const_1).seg.isCorrect ? "correct-icon" : "incorrect-icon");
20448
- SvgLoader(node_42, {
20490
+ SvgLoader(node_44, {
20449
20491
  get svgName() {
20450
20492
  return get$1($0);
20451
20493
  },
@@ -20459,7 +20501,7 @@ function SelectableTextInteractionContent($$anchor, $$props) {
20459
20501
  append($$anchor9, span_30);
20460
20502
  };
20461
20503
  if_block(
20462
- node_41,
20504
+ node_43,
20463
20505
  ($$render) => {
20464
20506
  if (get$1(computed_const_1).seg.isCorrect || get$1(computed_const_1).seg.isIncorrect) $$render(consequent_25);
20465
20507
  },
@@ -20468,60 +20510,60 @@ function SelectableTextInteractionContent($$anchor, $$props) {
20468
20510
  }
20469
20511
  append($$anchor8, fragment_13);
20470
20512
  };
20471
- if_block(node_39, ($$render) => {
20513
+ if_block(node_41, ($$render) => {
20472
20514
  if (get$1(computed_const_1).seg.isSegmentSelected && !get$1(sharedState).isValidating && !get$1(sharedState).isPreviewMode) $$render(consequent_24);
20473
20515
  else $$render(alternate_6, false);
20474
20516
  });
20475
20517
  }
20476
20518
  append($$anchor7, fragment_12);
20477
20519
  };
20478
- if_block(node_31, ($$render) => {
20520
+ if_block(node_33, ($$render) => {
20479
20521
  if (!isWord) $$render(consequent_23);
20480
20522
  else $$render(alternate_7, false);
20481
20523
  });
20482
20524
  }
20483
20525
  reset(span_25);
20484
- var node_43 = sibling(span_25);
20526
+ var node_45 = sibling(span_25);
20485
20527
  {
20486
20528
  var consequent_26 = ($$anchor7) => {
20487
20529
  var span_31 = root_41();
20488
20530
  append($$anchor7, span_31);
20489
20531
  };
20490
- if_block(node_43, ($$render) => {
20532
+ if_block(node_45, ($$render) => {
20491
20533
  if (get$1(computed_const_1).seg.isCorrect) $$render(consequent_26);
20492
20534
  });
20493
20535
  }
20494
- var node_44 = sibling(node_43);
20536
+ var node_46 = sibling(node_45);
20495
20537
  {
20496
20538
  var consequent_27 = ($$anchor7) => {
20497
20539
  var span_32 = root_42();
20498
20540
  append($$anchor7, span_32);
20499
20541
  };
20500
- if_block(node_44, ($$render) => {
20542
+ if_block(node_46, ($$render) => {
20501
20543
  if (get$1(computed_const_1).seg.isIncorrect) $$render(consequent_27);
20502
20544
  });
20503
20545
  }
20504
- var node_45 = sibling(node_44);
20546
+ var node_47 = sibling(node_46);
20505
20547
  {
20506
20548
  var consequent_28 = ($$anchor7) => {
20507
20549
  var span_33 = root_43();
20508
20550
  append($$anchor7, span_33);
20509
20551
  };
20510
- if_block(node_45, ($$render) => {
20552
+ if_block(node_47, ($$render) => {
20511
20553
  if (get$1(computed_const_1).seg.isMissing) $$render(consequent_28);
20512
20554
  });
20513
20555
  }
20514
20556
  reset(span_23);
20515
- var node_46 = sibling(span_23);
20557
+ var node_48 = sibling(span_23);
20516
20558
  {
20517
20559
  var consequent_29 = ($$anchor7) => {
20518
20560
  var span_34 = root_44();
20519
- var text_4 = child(span_34, true);
20561
+ var node_49 = child(span_34);
20562
+ html(node_49, () => get$1(segment).trailingPunctuation);
20520
20563
  reset(span_34);
20521
- template_effect(() => set_text(text_4, get$1(segment).trailingPunctuation));
20522
20564
  append($$anchor7, span_34);
20523
20565
  };
20524
- if_block(node_46, ($$render) => {
20566
+ if_block(node_48, ($$render) => {
20525
20567
  if (get$1(segment).trailingPunctuation) $$render(consequent_29);
20526
20568
  });
20527
20569
  }
@@ -20545,7 +20587,7 @@ function SelectableTextInteractionContent($$anchor, $$props) {
20545
20587
  event("focus", span_23, () => handleSegmentFocus(get$1(segment).id));
20546
20588
  append($$anchor6, fragment_9);
20547
20589
  };
20548
- if_block(node_28, ($$render) => {
20590
+ if_block(node_30, ($$render) => {
20549
20591
  if (get$1(segment).isPunctuation) $$render(consequent_19);
20550
20592
  else $$render(alternate_8, false);
20551
20593
  });
@@ -20555,7 +20597,7 @@ function SelectableTextInteractionContent($$anchor, $$props) {
20555
20597
  reset(span_21);
20556
20598
  append($$anchor4, span_21);
20557
20599
  };
20558
- if_block(node_27, ($$render) => {
20600
+ if_block(node_29, ($$render) => {
20559
20601
  if (get$1(row) === "break") $$render(consequent_18);
20560
20602
  else $$render(alternate_9, false);
20561
20603
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eat-js-sdk",
3
- "version": "2.3.6",
3
+ "version": "2.3.8",
4
4
  "change version": "2.3.0",
5
5
  "description": "Authoring tool frontend SDK",
6
6
  "contributors": [