markdown-flow-ui 0.2.3-dev.1 → 0.2.3-dev.3

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.
@@ -10,8 +10,9 @@ const i = ({
10
10
  isInteractionOverlayOpen: e,
11
11
  shouldBlockPlaybackForInteraction: t,
12
12
  playerControlsVisible: n,
13
- shouldMountPlayer: u
14
- }) => !(!r || !e || t && u && !n);
13
+ shouldMountPlayer: u,
14
+ hasFocusedTextInput: f
15
+ }) => !r || !e ? !1 : f ? !0 : !(t && u && !n);
15
16
  export {
16
17
  i as shouldPresentInteractionOverlay,
17
18
  s as shouldRenderInteractionOverlay
@@ -1 +1 @@
1
- {"version":3,"file":"interactionPlayback.es.js","sources":["../../../../src/components/Slide/utils/interactionPlayback.ts"],"sourcesContent":["interface ShouldPresentInteractionOverlayParams {\n hasInteraction: boolean;\n shouldBlockPlaybackForInteraction: boolean;\n shouldOpenInteractionOverlayAfterAudio: boolean;\n hasPlaybackContextChanged: boolean;\n hasResolvedCurrentInteraction: boolean;\n currentStepHasSpeakableElement: boolean;\n}\n\nexport const shouldPresentInteractionOverlay = ({\n hasInteraction,\n shouldBlockPlaybackForInteraction,\n shouldOpenInteractionOverlayAfterAudio,\n hasPlaybackContextChanged,\n hasResolvedCurrentInteraction,\n currentStepHasSpeakableElement,\n}: ShouldPresentInteractionOverlayParams) => {\n if (!hasInteraction) {\n return false;\n }\n\n if (shouldBlockPlaybackForInteraction) {\n return true;\n }\n\n if (shouldOpenInteractionOverlayAfterAudio) {\n return true;\n }\n\n // Re-open the interaction entry state whenever playback navigates into\n // the interaction step so the notes action stays highlighted for history\n // playback and manual prev/next navigation.\n if (hasPlaybackContextChanged) {\n return true;\n }\n\n if (!hasResolvedCurrentInteraction) {\n return false;\n }\n\n // Once a resolved interaction step starts receiving follow-up speech,\n // keep the overlay closed so the step can continue as normal playback.\n return !currentStepHasSpeakableElement;\n};\n\nexport interface ShouldRenderInteractionOverlayParams {\n hasActiveInteraction: boolean;\n isInteractionOverlayOpen: boolean;\n shouldBlockPlaybackForInteraction: boolean;\n playerControlsVisible: boolean;\n shouldMountPlayer: boolean;\n}\n\nexport const shouldRenderInteractionOverlay = ({\n hasActiveInteraction,\n isInteractionOverlayOpen,\n shouldBlockPlaybackForInteraction,\n playerControlsVisible,\n shouldMountPlayer,\n}: ShouldRenderInteractionOverlayParams) => {\n if (!hasActiveInteraction || !isInteractionOverlayOpen) {\n return false;\n }\n\n if (\n shouldBlockPlaybackForInteraction &&\n shouldMountPlayer &&\n !playerControlsVisible\n ) {\n return false;\n }\n\n return true;\n};\n"],"names":["shouldPresentInteractionOverlay","hasInteraction","shouldBlockPlaybackForInteraction","shouldOpenInteractionOverlayAfterAudio","hasPlaybackContextChanged","hasResolvedCurrentInteraction","currentStepHasSpeakableElement","shouldRenderInteractionOverlay","hasActiveInteraction","isInteractionOverlayOpen","playerControlsVisible","shouldMountPlayer"],"mappings":"AASO,MAAMA,IAAkC,CAAC;AAAA,EAC9C,gBAAAC;AAAA,EACA,mCAAAC;AAAA,EACA,wCAAAC;AAAA,EACA,2BAAAC;AAAA,EACA,+BAAAC;AAAA,EACA,gCAAAC;AACF,MACOL,IAIDC,KAIAC,KAOAC,IACK,KAGJC,IAME,CAACC,IALC,KAnBA,IAmCEC,IAAiC,CAAC;AAAA,EAC7C,sBAAAC;AAAA,EACA,0BAAAC;AAAA,EACA,mCAAAP;AAAA,EACA,uBAAAQ;AAAA,EACA,mBAAAC;AACF,MACM,GAACH,KAAwB,CAACC,KAK5BP,KACAS,KACA,CAACD;"}
1
+ {"version":3,"file":"interactionPlayback.es.js","sources":["../../../../src/components/Slide/utils/interactionPlayback.ts"],"sourcesContent":["interface ShouldPresentInteractionOverlayParams {\n hasInteraction: boolean;\n shouldBlockPlaybackForInteraction: boolean;\n shouldOpenInteractionOverlayAfterAudio: boolean;\n hasPlaybackContextChanged: boolean;\n hasResolvedCurrentInteraction: boolean;\n currentStepHasSpeakableElement: boolean;\n}\n\nexport const shouldPresentInteractionOverlay = ({\n hasInteraction,\n shouldBlockPlaybackForInteraction,\n shouldOpenInteractionOverlayAfterAudio,\n hasPlaybackContextChanged,\n hasResolvedCurrentInteraction,\n currentStepHasSpeakableElement,\n}: ShouldPresentInteractionOverlayParams) => {\n if (!hasInteraction) {\n return false;\n }\n\n if (shouldBlockPlaybackForInteraction) {\n return true;\n }\n\n if (shouldOpenInteractionOverlayAfterAudio) {\n return true;\n }\n\n // Re-open the interaction entry state whenever playback navigates into\n // the interaction step so the notes action stays highlighted for history\n // playback and manual prev/next navigation.\n if (hasPlaybackContextChanged) {\n return true;\n }\n\n if (!hasResolvedCurrentInteraction) {\n return false;\n }\n\n // Once a resolved interaction step starts receiving follow-up speech,\n // keep the overlay closed so the step can continue as normal playback.\n return !currentStepHasSpeakableElement;\n};\n\nexport interface ShouldRenderInteractionOverlayParams {\n hasActiveInteraction: boolean;\n isInteractionOverlayOpen: boolean;\n shouldBlockPlaybackForInteraction: boolean;\n playerControlsVisible: boolean;\n shouldMountPlayer: boolean;\n hasFocusedTextInput: boolean;\n}\n\nexport const shouldRenderInteractionOverlay = ({\n hasActiveInteraction,\n isInteractionOverlayOpen,\n shouldBlockPlaybackForInteraction,\n playerControlsVisible,\n shouldMountPlayer,\n hasFocusedTextInput,\n}: ShouldRenderInteractionOverlayParams) => {\n if (!hasActiveInteraction || !isInteractionOverlayOpen) {\n return false;\n }\n\n if (hasFocusedTextInput) {\n return true;\n }\n\n if (\n shouldBlockPlaybackForInteraction &&\n shouldMountPlayer &&\n !playerControlsVisible\n ) {\n return false;\n }\n\n return true;\n};\n"],"names":["shouldPresentInteractionOverlay","hasInteraction","shouldBlockPlaybackForInteraction","shouldOpenInteractionOverlayAfterAudio","hasPlaybackContextChanged","hasResolvedCurrentInteraction","currentStepHasSpeakableElement","shouldRenderInteractionOverlay","hasActiveInteraction","isInteractionOverlayOpen","playerControlsVisible","shouldMountPlayer","hasFocusedTextInput"],"mappings":"AASO,MAAMA,IAAkC,CAAC;AAAA,EAC9C,gBAAAC;AAAA,EACA,mCAAAC;AAAA,EACA,wCAAAC;AAAA,EACA,2BAAAC;AAAA,EACA,+BAAAC;AAAA,EACA,gCAAAC;AACF,MACOL,IAIDC,KAIAC,KAOAC,IACK,KAGJC,IAME,CAACC,IALC,KAnBA,IAoCEC,IAAiC,CAAC;AAAA,EAC7C,sBAAAC;AAAA,EACA,0BAAAC;AAAA,EACA,mCAAAP;AAAA,EACA,uBAAAQ;AAAA,EACA,mBAAAC;AAAA,EACA,qBAAAC;AACF,MACM,CAACJ,KAAwB,CAACC,IACrB,KAGLG,IACK,KAIP,EAAAV,KACAS,KACA,CAACD;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=r=>!!(r?.type==="interaction"&&(r.readonly||r.user_input?.trim())),h=(r,a)=>r.length<=a.length&&r.every((n,t)=>n===a[t]),f=({previousIndex:r,previousSlideElementList:a,nextSlideElementList:n})=>{if(n.length===0)return-1;const t=n.length>a.length&&h(a,n),o=a.length-1,c=r===o,e=r>=0?a[r]:void 0;return t&&c&&g(e)?a.length:r>=0&&r<n.length?r:-1};exports.resolveNextSlideIndexAfterMarkerAppend=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=r=>!!(r?.type==="interaction"&&(r.readonly||r.user_input?.trim())),M=(r,n)=>r.length<=n.length&&r.every((a,c)=>a===n[c]),f=(r,n)=>n.length<=r.length&&n.every((a,c)=>{const h=r[c];return a.type===h?.type&&a.sequence_number===h?.sequence_number&&a.content===h?.content}),k=({previousIndex:r,previousSlideElementList:n,nextSlideElementList:a})=>{if(a.length===0)return-1;const c=a.length>n.length&&M(n,a),h=n.length-1,t=r===h,g=r>=0?n[r]:void 0;return c&&t&&o(g)?n.length:a.length<n.length&&f(n,a)&&a.length>0?Math.min(r,a.length-1):r>=0&&r<a.length?r:-1};exports.resolveNextSlideIndexAfterMarkerAppend=k;
2
2
  //# sourceMappingURL=streamingNavigation.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"streamingNavigation.cjs.js","sources":["../../../../src/components/Slide/utils/streamingNavigation.ts"],"sourcesContent":["import type { Element } from \"../types\";\n\ninterface ResolveNextSlideIndexParams {\n previousIndex: number;\n previousSlideElementList: Element[];\n nextSlideElementList: Element[];\n}\n\nconst isResolvedInteractionElement = (element?: Element) =>\n Boolean(\n element?.type === \"interaction\" &&\n (element.readonly || element.user_input?.trim())\n );\n\nconst hasStableMarkerPrefix = (\n previousSlideElementList: Element[],\n nextSlideElementList: Element[]\n) =>\n previousSlideElementList.length <= nextSlideElementList.length &&\n previousSlideElementList.every(\n (element, index) => element === nextSlideElementList[index]\n );\n\nexport const resolveNextSlideIndexAfterMarkerAppend = ({\n previousIndex,\n previousSlideElementList,\n nextSlideElementList,\n}: ResolveNextSlideIndexParams) => {\n if (nextSlideElementList.length === 0) {\n return -1;\n }\n\n const hasAppendedMarkers =\n nextSlideElementList.length > previousSlideElementList.length &&\n hasStableMarkerPrefix(previousSlideElementList, nextSlideElementList);\n const previousLastMarkerIndex = previousSlideElementList.length - 1;\n const wasFocusedOnPreviousLastMarker =\n previousIndex === previousLastMarkerIndex;\n const previousCurrentElement =\n previousIndex >= 0 ? previousSlideElementList[previousIndex] : undefined;\n\n // When a resolved interaction is already the terminal step and SSE appends\n // the first follow-up marker, jump into that new marker immediately instead\n // of waiting for the interaction auto-close and silent-step delay.\n if (\n hasAppendedMarkers &&\n wasFocusedOnPreviousLastMarker &&\n isResolvedInteractionElement(previousCurrentElement)\n ) {\n return previousSlideElementList.length;\n }\n\n if (previousIndex >= 0 && previousIndex < nextSlideElementList.length) {\n return previousIndex;\n }\n\n return -1;\n};\n"],"names":["isResolvedInteractionElement","element","hasStableMarkerPrefix","previousSlideElementList","nextSlideElementList","index","resolveNextSlideIndexAfterMarkerAppend","previousIndex","hasAppendedMarkers","previousLastMarkerIndex","wasFocusedOnPreviousLastMarker","previousCurrentElement"],"mappings":"gFAQA,MAAMA,EAAgCC,GACpC,GACEA,GAAS,OAAS,gBACfA,EAAQ,UAAYA,EAAQ,YAAY,KAAA,IAGzCC,EAAwB,CAC5BC,EACAC,IAEAD,EAAyB,QAAUC,EAAqB,QACxDD,EAAyB,MACvB,CAACF,EAASI,IAAUJ,IAAYG,EAAqBC,CAAK,CAC5D,EAEWC,EAAyC,CAAC,CACrD,cAAAC,EACA,yBAAAJ,EACA,qBAAAC,CACF,IAAmC,CACjC,GAAIA,EAAqB,SAAW,EAClC,MAAO,GAGT,MAAMI,EACJJ,EAAqB,OAASD,EAAyB,QACvDD,EAAsBC,EAA0BC,CAAoB,EAChEK,EAA0BN,EAAyB,OAAS,EAC5DO,EACJH,IAAkBE,EACdE,EACJJ,GAAiB,EAAIJ,EAAyBI,CAAa,EAAI,OAKjE,OACEC,GACAE,GACAV,EAA6BW,CAAsB,EAE5CR,EAAyB,OAG9BI,GAAiB,GAAKA,EAAgBH,EAAqB,OACtDG,EAGF,EACT"}
1
+ {"version":3,"file":"streamingNavigation.cjs.js","sources":["../../../../src/components/Slide/utils/streamingNavigation.ts"],"sourcesContent":["import type { Element } from \"../types\";\n\ninterface ResolveNextSlideIndexParams {\n previousIndex: number;\n previousSlideElementList: Element[];\n nextSlideElementList: Element[];\n}\n\nconst isResolvedInteractionElement = (element?: Element) =>\n Boolean(\n element?.type === \"interaction\" &&\n (element.readonly || element.user_input?.trim())\n );\n\nconst hasStableMarkerPrefix = (\n previousSlideElementList: Element[],\n nextSlideElementList: Element[]\n) =>\n previousSlideElementList.length <= nextSlideElementList.length &&\n previousSlideElementList.every(\n (element, index) => element === nextSlideElementList[index]\n );\n\nconst hasStableMarkerIdentityPrefix = (\n previousSlideElementList: Element[],\n nextSlideElementList: Element[]\n) =>\n nextSlideElementList.length <= previousSlideElementList.length &&\n nextSlideElementList.every((element, index) => {\n const previousElement = previousSlideElementList[index];\n\n return (\n element.type === previousElement?.type &&\n element.sequence_number === previousElement?.sequence_number &&\n element.content === previousElement?.content\n );\n });\n\nexport const resolveNextSlideIndexAfterMarkerAppend = ({\n previousIndex,\n previousSlideElementList,\n nextSlideElementList,\n}: ResolveNextSlideIndexParams) => {\n if (nextSlideElementList.length === 0) {\n return -1;\n }\n\n const hasAppendedMarkers =\n nextSlideElementList.length > previousSlideElementList.length &&\n hasStableMarkerPrefix(previousSlideElementList, nextSlideElementList);\n const previousLastMarkerIndex = previousSlideElementList.length - 1;\n const wasFocusedOnPreviousLastMarker =\n previousIndex === previousLastMarkerIndex;\n const previousCurrentElement =\n previousIndex >= 0 ? previousSlideElementList[previousIndex] : undefined;\n\n // When a resolved interaction is already the terminal step and SSE appends\n // the first follow-up marker, jump into that new marker immediately instead\n // of waiting for the interaction auto-close and silent-step delay.\n if (\n hasAppendedMarkers &&\n wasFocusedOnPreviousLastMarker &&\n isResolvedInteractionElement(previousCurrentElement)\n ) {\n return previousSlideElementList.length;\n }\n\n const hasTruncatedMarkers =\n nextSlideElementList.length < previousSlideElementList.length &&\n hasStableMarkerIdentityPrefix(\n previousSlideElementList,\n nextSlideElementList\n );\n\n if (hasTruncatedMarkers && nextSlideElementList.length > 0) {\n return Math.min(previousIndex, nextSlideElementList.length - 1);\n }\n\n if (previousIndex >= 0 && previousIndex < nextSlideElementList.length) {\n return previousIndex;\n }\n\n return -1;\n};\n"],"names":["isResolvedInteractionElement","element","hasStableMarkerPrefix","previousSlideElementList","nextSlideElementList","index","hasStableMarkerIdentityPrefix","previousElement","resolveNextSlideIndexAfterMarkerAppend","previousIndex","hasAppendedMarkers","previousLastMarkerIndex","wasFocusedOnPreviousLastMarker","previousCurrentElement"],"mappings":"gFAQA,MAAMA,EAAgCC,GACpC,GACEA,GAAS,OAAS,gBACfA,EAAQ,UAAYA,EAAQ,YAAY,KAAA,IAGzCC,EAAwB,CAC5BC,EACAC,IAEAD,EAAyB,QAAUC,EAAqB,QACxDD,EAAyB,MACvB,CAACF,EAASI,IAAUJ,IAAYG,EAAqBC,CAAK,CAC5D,EAEIC,EAAgC,CACpCH,EACAC,IAEAA,EAAqB,QAAUD,EAAyB,QACxDC,EAAqB,MAAM,CAACH,EAASI,IAAU,CAC7C,MAAME,EAAkBJ,EAAyBE,CAAK,EAEtD,OACEJ,EAAQ,OAASM,GAAiB,MAClCN,EAAQ,kBAAoBM,GAAiB,iBAC7CN,EAAQ,UAAYM,GAAiB,OAEzC,CAAC,EAEUC,EAAyC,CAAC,CACrD,cAAAC,EACA,yBAAAN,EACA,qBAAAC,CACF,IAAmC,CACjC,GAAIA,EAAqB,SAAW,EAClC,MAAO,GAGT,MAAMM,EACJN,EAAqB,OAASD,EAAyB,QACvDD,EAAsBC,EAA0BC,CAAoB,EAChEO,EAA0BR,EAAyB,OAAS,EAC5DS,EACJH,IAAkBE,EACdE,EACJJ,GAAiB,EAAIN,EAAyBM,CAAa,EAAI,OAKjE,OACEC,GACAE,GACAZ,EAA6Ba,CAAsB,EAE5CV,EAAyB,OAIhCC,EAAqB,OAASD,EAAyB,QACvDG,EACEH,EACAC,CAAA,GAGuBA,EAAqB,OAAS,EAChD,KAAK,IAAIK,EAAeL,EAAqB,OAAS,CAAC,EAG5DK,GAAiB,GAAKA,EAAgBL,EAAqB,OACtDK,EAGF,EACT"}
@@ -1,16 +1,22 @@
1
- const g = (r) => !!(r?.type === "interaction" && (r.readonly || r.user_input?.trim())), f = (r, a) => r.length <= a.length && r.every(
2
- (n, t) => n === a[t]
3
- ), k = ({
1
+ const t = (r) => !!(r?.type === "interaction" && (r.readonly || r.user_input?.trim())), M = (r, n) => r.length <= n.length && r.every(
2
+ (a, h) => a === n[h]
3
+ ), k = (r, n) => n.length <= r.length && n.every((a, h) => {
4
+ const c = r[h];
5
+ return a.type === c?.type && a.sequence_number === c?.sequence_number && a.content === c?.content;
6
+ }), y = ({
4
7
  previousIndex: r,
5
- previousSlideElementList: a,
6
- nextSlideElementList: n
8
+ previousSlideElementList: n,
9
+ nextSlideElementList: a
7
10
  }) => {
8
- if (n.length === 0)
11
+ if (a.length === 0)
9
12
  return -1;
10
- const t = n.length > a.length && f(a, n), c = a.length - 1, h = r === c, o = r >= 0 ? a[r] : void 0;
11
- return t && h && g(o) ? a.length : r >= 0 && r < n.length ? r : -1;
13
+ const h = a.length > n.length && M(n, a), c = n.length - 1, g = r === c, o = r >= 0 ? n[r] : void 0;
14
+ return h && g && t(o) ? n.length : a.length < n.length && k(
15
+ n,
16
+ a
17
+ ) && a.length > 0 ? Math.min(r, a.length - 1) : r >= 0 && r < a.length ? r : -1;
12
18
  };
13
19
  export {
14
- k as resolveNextSlideIndexAfterMarkerAppend
20
+ y as resolveNextSlideIndexAfterMarkerAppend
15
21
  };
16
22
  //# sourceMappingURL=streamingNavigation.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"streamingNavigation.es.js","sources":["../../../../src/components/Slide/utils/streamingNavigation.ts"],"sourcesContent":["import type { Element } from \"../types\";\n\ninterface ResolveNextSlideIndexParams {\n previousIndex: number;\n previousSlideElementList: Element[];\n nextSlideElementList: Element[];\n}\n\nconst isResolvedInteractionElement = (element?: Element) =>\n Boolean(\n element?.type === \"interaction\" &&\n (element.readonly || element.user_input?.trim())\n );\n\nconst hasStableMarkerPrefix = (\n previousSlideElementList: Element[],\n nextSlideElementList: Element[]\n) =>\n previousSlideElementList.length <= nextSlideElementList.length &&\n previousSlideElementList.every(\n (element, index) => element === nextSlideElementList[index]\n );\n\nexport const resolveNextSlideIndexAfterMarkerAppend = ({\n previousIndex,\n previousSlideElementList,\n nextSlideElementList,\n}: ResolveNextSlideIndexParams) => {\n if (nextSlideElementList.length === 0) {\n return -1;\n }\n\n const hasAppendedMarkers =\n nextSlideElementList.length > previousSlideElementList.length &&\n hasStableMarkerPrefix(previousSlideElementList, nextSlideElementList);\n const previousLastMarkerIndex = previousSlideElementList.length - 1;\n const wasFocusedOnPreviousLastMarker =\n previousIndex === previousLastMarkerIndex;\n const previousCurrentElement =\n previousIndex >= 0 ? previousSlideElementList[previousIndex] : undefined;\n\n // When a resolved interaction is already the terminal step and SSE appends\n // the first follow-up marker, jump into that new marker immediately instead\n // of waiting for the interaction auto-close and silent-step delay.\n if (\n hasAppendedMarkers &&\n wasFocusedOnPreviousLastMarker &&\n isResolvedInteractionElement(previousCurrentElement)\n ) {\n return previousSlideElementList.length;\n }\n\n if (previousIndex >= 0 && previousIndex < nextSlideElementList.length) {\n return previousIndex;\n }\n\n return -1;\n};\n"],"names":["isResolvedInteractionElement","element","hasStableMarkerPrefix","previousSlideElementList","nextSlideElementList","index","resolveNextSlideIndexAfterMarkerAppend","previousIndex","hasAppendedMarkers","previousLastMarkerIndex","wasFocusedOnPreviousLastMarker","previousCurrentElement"],"mappings":"AAQA,MAAMA,IAA+B,CAACC,MACpC,GACEA,GAAS,SAAS,kBACfA,EAAQ,YAAYA,EAAQ,YAAY,KAAA,KAGzCC,IAAwB,CAC5BC,GACAC,MAEAD,EAAyB,UAAUC,EAAqB,UACxDD,EAAyB;AAAA,EACvB,CAACF,GAASI,MAAUJ,MAAYG,EAAqBC,CAAK;AAC5D,GAEWC,IAAyC,CAAC;AAAA,EACrD,eAAAC;AAAA,EACA,0BAAAJ;AAAA,EACA,sBAAAC;AACF,MAAmC;AACjC,MAAIA,EAAqB,WAAW;AAClC,WAAO;AAGT,QAAMI,IACJJ,EAAqB,SAASD,EAAyB,UACvDD,EAAsBC,GAA0BC,CAAoB,GAChEK,IAA0BN,EAAyB,SAAS,GAC5DO,IACJH,MAAkBE,GACdE,IACJJ,KAAiB,IAAIJ,EAAyBI,CAAa,IAAI;AAKjE,SACEC,KACAE,KACAV,EAA6BW,CAAsB,IAE5CR,EAAyB,SAG9BI,KAAiB,KAAKA,IAAgBH,EAAqB,SACtDG,IAGF;AACT;"}
1
+ {"version":3,"file":"streamingNavigation.es.js","sources":["../../../../src/components/Slide/utils/streamingNavigation.ts"],"sourcesContent":["import type { Element } from \"../types\";\n\ninterface ResolveNextSlideIndexParams {\n previousIndex: number;\n previousSlideElementList: Element[];\n nextSlideElementList: Element[];\n}\n\nconst isResolvedInteractionElement = (element?: Element) =>\n Boolean(\n element?.type === \"interaction\" &&\n (element.readonly || element.user_input?.trim())\n );\n\nconst hasStableMarkerPrefix = (\n previousSlideElementList: Element[],\n nextSlideElementList: Element[]\n) =>\n previousSlideElementList.length <= nextSlideElementList.length &&\n previousSlideElementList.every(\n (element, index) => element === nextSlideElementList[index]\n );\n\nconst hasStableMarkerIdentityPrefix = (\n previousSlideElementList: Element[],\n nextSlideElementList: Element[]\n) =>\n nextSlideElementList.length <= previousSlideElementList.length &&\n nextSlideElementList.every((element, index) => {\n const previousElement = previousSlideElementList[index];\n\n return (\n element.type === previousElement?.type &&\n element.sequence_number === previousElement?.sequence_number &&\n element.content === previousElement?.content\n );\n });\n\nexport const resolveNextSlideIndexAfterMarkerAppend = ({\n previousIndex,\n previousSlideElementList,\n nextSlideElementList,\n}: ResolveNextSlideIndexParams) => {\n if (nextSlideElementList.length === 0) {\n return -1;\n }\n\n const hasAppendedMarkers =\n nextSlideElementList.length > previousSlideElementList.length &&\n hasStableMarkerPrefix(previousSlideElementList, nextSlideElementList);\n const previousLastMarkerIndex = previousSlideElementList.length - 1;\n const wasFocusedOnPreviousLastMarker =\n previousIndex === previousLastMarkerIndex;\n const previousCurrentElement =\n previousIndex >= 0 ? previousSlideElementList[previousIndex] : undefined;\n\n // When a resolved interaction is already the terminal step and SSE appends\n // the first follow-up marker, jump into that new marker immediately instead\n // of waiting for the interaction auto-close and silent-step delay.\n if (\n hasAppendedMarkers &&\n wasFocusedOnPreviousLastMarker &&\n isResolvedInteractionElement(previousCurrentElement)\n ) {\n return previousSlideElementList.length;\n }\n\n const hasTruncatedMarkers =\n nextSlideElementList.length < previousSlideElementList.length &&\n hasStableMarkerIdentityPrefix(\n previousSlideElementList,\n nextSlideElementList\n );\n\n if (hasTruncatedMarkers && nextSlideElementList.length > 0) {\n return Math.min(previousIndex, nextSlideElementList.length - 1);\n }\n\n if (previousIndex >= 0 && previousIndex < nextSlideElementList.length) {\n return previousIndex;\n }\n\n return -1;\n};\n"],"names":["isResolvedInteractionElement","element","hasStableMarkerPrefix","previousSlideElementList","nextSlideElementList","index","hasStableMarkerIdentityPrefix","previousElement","resolveNextSlideIndexAfterMarkerAppend","previousIndex","hasAppendedMarkers","previousLastMarkerIndex","wasFocusedOnPreviousLastMarker","previousCurrentElement"],"mappings":"AAQA,MAAMA,IAA+B,CAACC,MACpC,GACEA,GAAS,SAAS,kBACfA,EAAQ,YAAYA,EAAQ,YAAY,KAAA,KAGzCC,IAAwB,CAC5BC,GACAC,MAEAD,EAAyB,UAAUC,EAAqB,UACxDD,EAAyB;AAAA,EACvB,CAACF,GAASI,MAAUJ,MAAYG,EAAqBC,CAAK;AAC5D,GAEIC,IAAgC,CACpCH,GACAC,MAEAA,EAAqB,UAAUD,EAAyB,UACxDC,EAAqB,MAAM,CAACH,GAASI,MAAU;AAC7C,QAAME,IAAkBJ,EAAyBE,CAAK;AAEtD,SACEJ,EAAQ,SAASM,GAAiB,QAClCN,EAAQ,oBAAoBM,GAAiB,mBAC7CN,EAAQ,YAAYM,GAAiB;AAEzC,CAAC,GAEUC,IAAyC,CAAC;AAAA,EACrD,eAAAC;AAAA,EACA,0BAAAN;AAAA,EACA,sBAAAC;AACF,MAAmC;AACjC,MAAIA,EAAqB,WAAW;AAClC,WAAO;AAGT,QAAMM,IACJN,EAAqB,SAASD,EAAyB,UACvDD,EAAsBC,GAA0BC,CAAoB,GAChEO,IAA0BR,EAAyB,SAAS,GAC5DS,IACJH,MAAkBE,GACdE,IACJJ,KAAiB,IAAIN,EAAyBM,CAAa,IAAI;AAKjE,SACEC,KACAE,KACAZ,EAA6Ba,CAAsB,IAE5CV,EAAyB,SAIhCC,EAAqB,SAASD,EAAyB,UACvDG;AAAA,IACEH;AAAA,IACAC;AAAA,EAAA,KAGuBA,EAAqB,SAAS,IAChD,KAAK,IAAIK,GAAeL,EAAqB,SAAS,CAAC,IAG5DK,KAAiB,KAAKA,IAAgBL,EAAqB,SACtDK,IAGF;AACT;"}
package/package.json CHANGED
@@ -174,7 +174,7 @@
174
174
  ]
175
175
  }
176
176
  },
177
- "version": "0.2.3-dev.1",
177
+ "version": "0.2.3-dev.3",
178
178
  "type": "module",
179
179
  "exports": {
180
180
  ".": {