markdown-flow-ui 0.1.100-beta.4 → 0.1.100-beta.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-input@1.8.0_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-input/es/BaseInput.cjs.js +1 -1
  2. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-input@1.8.0_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-input/es/BaseInput.es.js +1 -1
  3. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/ResizableTextArea.cjs.js +1 -1
  4. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/ResizableTextArea.es.js +1 -1
  5. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/TextArea.cjs.js +1 -1
  6. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/TextArea.es.js +1 -1
  7. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/index.cjs.js +1 -1
  8. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/index.es.js +1 -1
  9. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/remark-custom-variable.cjs.js +1 -1
  10. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/remark-custom-variable.es.js +1 -1
  11. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/remark-interaction.cjs.js +1 -1
  12. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/remark-interaction.es.js +1 -1
  13. package/dist/_virtual/index.cjs3.js +1 -1
  14. package/dist/_virtual/index.cjs4.js +1 -1
  15. package/dist/_virtual/index.es3.js +4 -5
  16. package/dist/_virtual/index.es3.js.map +1 -1
  17. package/dist/_virtual/index.es4.js +5 -4
  18. package/dist/_virtual/index.es4.js.map +1 -1
  19. package/dist/assets/markdown-flow-ui.css +1 -1
  20. package/dist/components/ContentRender/ContentRender.cjs.js +2 -2
  21. package/dist/components/ContentRender/ContentRender.cjs.js.map +1 -1
  22. package/dist/components/ContentRender/ContentRender.d.ts +13 -10
  23. package/dist/components/ContentRender/ContentRender.es.js +184 -160
  24. package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
  25. package/dist/components/ContentRender/IframeSandbox.cjs.js +5 -4
  26. package/dist/components/ContentRender/IframeSandbox.cjs.js.map +1 -1
  27. package/dist/components/ContentRender/IframeSandbox.d.ts +1 -0
  28. package/dist/components/ContentRender/IframeSandbox.es.js +307 -210
  29. package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
  30. package/dist/components/ContentRender/SandboxApp.cjs.js +3 -3
  31. package/dist/components/ContentRender/SandboxApp.cjs.js.map +1 -1
  32. package/dist/components/ContentRender/SandboxApp.d.ts +4 -0
  33. package/dist/components/ContentRender/SandboxApp.es.js +87 -80
  34. package/dist/components/ContentRender/SandboxApp.es.js.map +1 -1
  35. package/dist/components/ContentRender/index.cjs.js +1 -1
  36. package/dist/components/ContentRender/index.es.js +5 -6
  37. package/dist/components/ContentRender/plugins/CustomVariable.cjs.js +1 -1
  38. package/dist/components/ContentRender/plugins/CustomVariable.cjs.js.map +1 -1
  39. package/dist/components/ContentRender/plugins/CustomVariable.es.js +68 -64
  40. package/dist/components/ContentRender/plugins/CustomVariable.es.js.map +1 -1
  41. package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js +1 -1
  42. package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js.map +1 -1
  43. package/dist/components/MarkdownFlow/MarkdownFlow.d.ts +3 -0
  44. package/dist/components/MarkdownFlow/MarkdownFlow.es.js +21 -18
  45. package/dist/components/MarkdownFlow/MarkdownFlow.es.js.map +1 -1
  46. package/dist/components/Slide/Player.cjs.js +1 -1
  47. package/dist/components/Slide/Player.cjs.js.map +1 -1
  48. package/dist/components/Slide/Player.d.ts +3 -2
  49. package/dist/components/Slide/Player.es.js +228 -170
  50. package/dist/components/Slide/Player.es.js.map +1 -1
  51. package/dist/components/Slide/Slide.cjs.js +1 -1
  52. package/dist/components/Slide/Slide.cjs.js.map +1 -1
  53. package/dist/components/Slide/Slide.d.ts +10 -0
  54. package/dist/components/Slide/Slide.es.js +422 -270
  55. package/dist/components/Slide/Slide.es.js.map +1 -1
  56. package/dist/components/Slide/Slide.stories.d.ts +27 -1
  57. package/dist/components/Slide/index.d.ts +3 -3
  58. package/dist/components/Slide/types.d.ts +5 -6
  59. package/dist/components/Slide/useSlide.cjs.js +1 -1
  60. package/dist/components/Slide/useSlide.cjs.js.map +1 -1
  61. package/dist/components/Slide/useSlide.d.ts +4 -1
  62. package/dist/components/Slide/useSlide.es.js +125 -83
  63. package/dist/components/Slide/useSlide.es.js.map +1 -1
  64. package/dist/components/Slide/useWakePlayerFromIframe.cjs.js +2 -0
  65. package/dist/components/Slide/useWakePlayerFromIframe.cjs.js.map +1 -0
  66. package/dist/components/Slide/useWakePlayerFromIframe.d.ts +7 -0
  67. package/dist/components/Slide/useWakePlayerFromIframe.es.js +89 -0
  68. package/dist/components/Slide/useWakePlayerFromIframe.es.js.map +1 -0
  69. package/dist/components/Slide/utils/playerCustomActions.cjs.js +2 -0
  70. package/dist/components/Slide/utils/playerCustomActions.cjs.js.map +1 -0
  71. package/dist/components/Slide/utils/playerCustomActions.d.ts +3 -0
  72. package/dist/components/Slide/utils/playerCustomActions.es.js +7 -0
  73. package/dist/components/Slide/utils/playerCustomActions.es.js.map +1 -0
  74. package/dist/components/index.d.ts +4 -2
  75. package/dist/components/ui/inputGroup/textarea.cjs.js +1 -1
  76. package/dist/components/ui/inputGroup/textarea.es.js +1 -1
  77. package/dist/index.cjs.js +1 -1
  78. package/dist/index.es.js +24 -22
  79. package/dist/lib/interaction-defaults.cjs.js +2 -0
  80. package/dist/lib/interaction-defaults.cjs.js.map +1 -0
  81. package/dist/lib/interaction-defaults.es.js +106 -0
  82. package/dist/lib/interaction-defaults.es.js.map +1 -0
  83. package/dist/lib/sandboxInteraction.cjs.js +2 -0
  84. package/dist/lib/sandboxInteraction.cjs.js.map +1 -0
  85. package/dist/lib/sandboxInteraction.d.ts +8 -0
  86. package/dist/lib/sandboxInteraction.es.js +12 -0
  87. package/dist/lib/sandboxInteraction.es.js.map +1 -0
  88. package/dist/markdown-flow-ui-lib.css +1 -1
  89. package/dist/renderer.cjs.js +1 -1
  90. package/dist/renderer.d.ts +5 -3
  91. package/dist/renderer.es.js +18 -16
  92. package/package.json +17 -2
  93. package/dist/components/Slide/interaction-defaults.cjs.js +0 -2
  94. package/dist/components/Slide/interaction-defaults.cjs.js.map +0 -1
  95. package/dist/components/Slide/interaction-defaults.es.js +0 -85
  96. package/dist/components/Slide/interaction-defaults.es.js.map +0 -1
  97. package/dist/lib/browserUserActivation.cjs.js +0 -2
  98. package/dist/lib/browserUserActivation.cjs.js.map +0 -1
  99. package/dist/lib/browserUserActivation.es.js +0 -13
  100. package/dist/lib/browserUserActivation.es.js.map +0 -1
  101. /package/dist/{components/Slide → lib}/interaction-defaults.d.ts +0 -0
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("../../_virtual/jsx-runtime.cjs.js"),T=require("../ContentRender/ContentRender.cjs.js");require("../ContentRender/IframeSandbox.cjs.js");require("../ui/inputGroup/input-group.cjs.js");require("react");;/* empty css */const B=({initialContentList:n=[],customRenderBar:d,onSend:i,typingSpeed:s,enableTypewriter:o=!1,onBlockComplete:a,confirmButtonText:l,copyButtonText:c,copiedButtonText:m,beforeSend:p})=>u.jsxRuntimeExports.jsx("div",{className:"markdown-flow",children:n.map((e,r)=>{const t=e.isFinished??!1,x=!t&&o,y=t?void 0:i,S=t?void 0:s,f=p??(()=>!0);return u.jsxRuntimeExports.jsx(T.default,{content:e.content,defaultInputText:e.defaultInputText,defaultButtonText:e.defaultButtonText,defaultSelectedValues:e.defaultSelectedValues,readonly:e.readonly,enableTypewriter:x,customRenderBar:e.customRenderBar||d,onSend:y,beforeSend:f,onClickCustomButtonAfterContent:e.onClickCustomButtonAfterContent,typingSpeed:S,confirmButtonText:l,copyButtonText:c,copiedButtonText:m,dynamicInteractionFormat:e.dynamicInteractionFormat,onTypeFinished:()=>{a?.(r)}},r)})});exports.default=B;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("../../_virtual/jsx-runtime.cjs.js"),B=require("../ContentRender/ContentRender.cjs.js");require("react");require("react-dom/client");require("../ui/inputGroup/input-group.cjs.js");;/* empty css */const C=({initialContentList:s=[],customRenderBar:n,onSend:d,typingSpeed:i,enableTypewriter:a=!1,onBlockComplete:o,confirmButtonText:l,copyButtonText:c,copiedButtonText:m,beforeSend:p,interactionDefaultValueOptions:x})=>u.jsxRuntimeExports.jsx("div",{className:"markdown-flow",children:s.map((e,r)=>{const t=e.isFinished??!1,y=!t&&a,S=t?void 0:d,T=t?void 0:i,f=p??(()=>!0);return u.jsxRuntimeExports.jsx(B.default,{content:e.content,userInput:e.userInput,defaultInputText:e.defaultInputText,defaultButtonText:e.defaultButtonText,defaultSelectedValues:e.defaultSelectedValues,readonly:e.readonly,enableTypewriter:y,customRenderBar:e.customRenderBar||n,onSend:S,beforeSend:f,interactionDefaultValueOptions:x,onClickCustomButtonAfterContent:e.onClickCustomButtonAfterContent,typingSpeed:T,confirmButtonText:l,copyButtonText:c,copiedButtonText:m,dynamicInteractionFormat:e.dynamicInteractionFormat,onTypeFinished:()=>{o?.(r)}},r)})});exports.default=C;
2
2
  //# sourceMappingURL=MarkdownFlow.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownFlow.cjs.js","sources":["../../../src/components/MarkdownFlow/MarkdownFlow.tsx"],"sourcesContent":["import React from \"react\";\nimport ContentRender from \"../ContentRender\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport \"./markdownFlow.css\";\n\nexport interface MarkdownFlowProps {\n initialContentList?: {\n content: string;\n isFinished?: boolean;\n defaultInputText?: string;\n defaultButtonText?: string;\n defaultSelectedValues?: string[];\n readonly?: boolean;\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n dynamicInteractionFormat?: string;\n }[];\n customRenderBar?: CustomRenderBarProps;\n onSend?: (content: OnSendContentParams) => void;\n typingSpeed?: number;\n enableTypewriter?: boolean;\n onBlockComplete?: (blockIndex: number) => void;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text for code blocks\n copyButtonText?: string;\n // Copied state text for code blocks\n copiedButtonText?: string;\n beforeSend?: (content: OnSendContentParams) => boolean;\n}\n\nconst MarkdownFlow: React.FC<MarkdownFlowProps> = ({\n initialContentList = [],\n customRenderBar,\n onSend: onSendProp,\n typingSpeed: typingSpeedProp,\n enableTypewriter = false,\n onBlockComplete,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n beforeSend: beforeSendProp,\n}) => {\n return (\n <div className=\"markdown-flow\">\n {initialContentList.map((contentInfo, index) => {\n const isFinished = contentInfo.isFinished ?? false;\n const enableTypewriterForBlock = !isFinished && enableTypewriter;\n const onSend = isFinished ? undefined : onSendProp;\n const typingSpeed = isFinished ? undefined : typingSpeedProp;\n const beforeSend = beforeSendProp ?? (() => true);\n return (\n <ContentRender\n key={index}\n content={contentInfo.content}\n defaultInputText={contentInfo.defaultInputText}\n defaultButtonText={contentInfo.defaultButtonText}\n defaultSelectedValues={contentInfo.defaultSelectedValues}\n readonly={contentInfo.readonly}\n enableTypewriter={enableTypewriterForBlock}\n customRenderBar={contentInfo.customRenderBar || customRenderBar}\n onSend={onSend}\n beforeSend={beforeSend}\n onClickCustomButtonAfterContent={\n contentInfo.onClickCustomButtonAfterContent\n }\n typingSpeed={typingSpeed}\n confirmButtonText={confirmButtonText}\n copyButtonText={copyButtonText}\n copiedButtonText={copiedButtonText}\n dynamicInteractionFormat={contentInfo.dynamicInteractionFormat}\n onTypeFinished={() => {\n onBlockComplete?.(index);\n }}\n />\n );\n })}\n </div>\n );\n};\n\nexport default MarkdownFlow;\n"],"names":["MarkdownFlow","initialContentList","customRenderBar","onSendProp","typingSpeedProp","enableTypewriter","onBlockComplete","confirmButtonText","copyButtonText","copiedButtonText","beforeSendProp","jsx","contentInfo","index","isFinished","enableTypewriterForBlock","onSend","typingSpeed","beforeSend","ContentRender"],"mappings":"0WA+BA,MAAMA,EAA4C,CAAC,CACjD,mBAAAC,EAAqB,CAAA,EACrB,gBAAAC,EACA,OAAQC,EACR,YAAaC,EACb,iBAAAC,EAAmB,GACnB,gBAAAC,EACA,kBAAAC,EACA,eAAAC,EACA,iBAAAC,EACA,WAAYC,CACd,IAEIC,wBAAC,OAAI,UAAU,gBACZ,WAAmB,IAAI,CAACC,EAAaC,IAAU,CAC9C,MAAMC,EAAaF,EAAY,YAAc,GACvCG,EAA2B,CAACD,GAAcT,EAC1CW,EAASF,EAAa,OAAYX,EAClCc,EAAcH,EAAa,OAAYV,EACvCc,EAAaR,IAAmB,IAAM,IAC5C,OACEC,EAAAA,kBAAAA,IAACQ,EAAAA,QAAA,CAEC,QAASP,EAAY,QACrB,iBAAkBA,EAAY,iBAC9B,kBAAmBA,EAAY,kBAC/B,sBAAuBA,EAAY,sBACnC,SAAUA,EAAY,SACtB,iBAAkBG,EAClB,gBAAiBH,EAAY,iBAAmBV,EAChD,OAAAc,EACA,WAAAE,EACA,gCACEN,EAAY,gCAEd,YAAAK,EACA,kBAAAV,EACA,eAAAC,EACA,iBAAAC,EACA,yBAA0BG,EAAY,yBACtC,eAAgB,IAAM,CACpBN,IAAkBO,CAAK,CACzB,CAAA,EApBKA,CAAA,CAuBX,CAAC,CAAA,CACH"}
1
+ {"version":3,"file":"MarkdownFlow.cjs.js","sources":["../../../src/components/MarkdownFlow/MarkdownFlow.tsx"],"sourcesContent":["import React from \"react\";\nimport type { InteractionDefaultValueOptions } from \"../../lib/interaction-defaults\";\nimport ContentRender from \"../ContentRender\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport \"./markdownFlow.css\";\n\nexport interface MarkdownFlowProps {\n initialContentList?: {\n content: string;\n isFinished?: boolean;\n userInput?: string;\n defaultInputText?: string;\n defaultButtonText?: string;\n defaultSelectedValues?: string[];\n readonly?: boolean;\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n dynamicInteractionFormat?: string;\n }[];\n customRenderBar?: CustomRenderBarProps;\n onSend?: (content: OnSendContentParams) => void;\n typingSpeed?: number;\n enableTypewriter?: boolean;\n onBlockComplete?: (blockIndex: number) => void;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text for code blocks\n copyButtonText?: string;\n // Copied state text for code blocks\n copiedButtonText?: string;\n beforeSend?: (content: OnSendContentParams) => boolean;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n}\n\nconst MarkdownFlow: React.FC<MarkdownFlowProps> = ({\n initialContentList = [],\n customRenderBar,\n onSend: onSendProp,\n typingSpeed: typingSpeedProp,\n enableTypewriter = false,\n onBlockComplete,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n beforeSend: beforeSendProp,\n interactionDefaultValueOptions,\n}) => {\n return (\n <div className=\"markdown-flow\">\n {initialContentList.map((contentInfo, index) => {\n const isFinished = contentInfo.isFinished ?? false;\n const enableTypewriterForBlock = !isFinished && enableTypewriter;\n const onSend = isFinished ? undefined : onSendProp;\n const typingSpeed = isFinished ? undefined : typingSpeedProp;\n const beforeSend = beforeSendProp ?? (() => true);\n return (\n <ContentRender\n key={index}\n content={contentInfo.content}\n userInput={contentInfo.userInput}\n defaultInputText={contentInfo.defaultInputText}\n defaultButtonText={contentInfo.defaultButtonText}\n defaultSelectedValues={contentInfo.defaultSelectedValues}\n readonly={contentInfo.readonly}\n enableTypewriter={enableTypewriterForBlock}\n customRenderBar={contentInfo.customRenderBar || customRenderBar}\n onSend={onSend}\n beforeSend={beforeSend}\n interactionDefaultValueOptions={interactionDefaultValueOptions}\n onClickCustomButtonAfterContent={\n contentInfo.onClickCustomButtonAfterContent\n }\n typingSpeed={typingSpeed}\n confirmButtonText={confirmButtonText}\n copyButtonText={copyButtonText}\n copiedButtonText={copiedButtonText}\n dynamicInteractionFormat={contentInfo.dynamicInteractionFormat}\n onTypeFinished={() => {\n onBlockComplete?.(index);\n }}\n />\n );\n })}\n </div>\n );\n};\n\nexport default MarkdownFlow;\n"],"names":["MarkdownFlow","initialContentList","customRenderBar","onSendProp","typingSpeedProp","enableTypewriter","onBlockComplete","confirmButtonText","copyButtonText","copiedButtonText","beforeSendProp","interactionDefaultValueOptions","jsx","contentInfo","index","isFinished","enableTypewriterForBlock","onSend","typingSpeed","beforeSend","ContentRender"],"mappings":"qVAkCA,MAAMA,EAA4C,CAAC,CACjD,mBAAAC,EAAqB,CAAA,EACrB,gBAAAC,EACA,OAAQC,EACR,YAAaC,EACb,iBAAAC,EAAmB,GACnB,gBAAAC,EACA,kBAAAC,EACA,eAAAC,EACA,iBAAAC,EACA,WAAYC,EACZ,+BAAAC,CACF,IAEIC,wBAAC,OAAI,UAAU,gBACZ,WAAmB,IAAI,CAACC,EAAaC,IAAU,CAC9C,MAAMC,EAAaF,EAAY,YAAc,GACvCG,EAA2B,CAACD,GAAcV,EAC1CY,EAASF,EAAa,OAAYZ,EAClCe,EAAcH,EAAa,OAAYX,EACvCe,EAAaT,IAAmB,IAAM,IAC5C,OACEE,EAAAA,kBAAAA,IAACQ,EAAAA,QAAA,CAEC,QAASP,EAAY,QACrB,UAAWA,EAAY,UACvB,iBAAkBA,EAAY,iBAC9B,kBAAmBA,EAAY,kBAC/B,sBAAuBA,EAAY,sBACnC,SAAUA,EAAY,SACtB,iBAAkBG,EAClB,gBAAiBH,EAAY,iBAAmBX,EAChD,OAAAe,EACA,WAAAE,EACA,+BAAAR,EACA,gCACEE,EAAY,gCAEd,YAAAK,EACA,kBAAAX,EACA,eAAAC,EACA,iBAAAC,EACA,yBAA0BI,EAAY,yBACtC,eAAgB,IAAM,CACpBP,IAAkBQ,CAAK,CACzB,CAAA,EAtBKA,CAAA,CAyBX,CAAC,CAAA,CACH"}
@@ -1,9 +1,11 @@
1
1
  import { default as React } from 'react';
2
+ import { InteractionDefaultValueOptions } from '../../lib/interaction-defaults';
2
3
  import { CustomRenderBarProps, OnSendContentParams } from '../types';
3
4
  export interface MarkdownFlowProps {
4
5
  initialContentList?: {
5
6
  content: string;
6
7
  isFinished?: boolean;
8
+ userInput?: string;
7
9
  defaultInputText?: string;
8
10
  defaultButtonText?: string;
9
11
  defaultSelectedValues?: string[];
@@ -21,6 +23,7 @@ export interface MarkdownFlowProps {
21
23
  copyButtonText?: string;
22
24
  copiedButtonText?: string;
23
25
  beforeSend?: (content: OnSendContentParams) => boolean;
26
+ interactionDefaultValueOptions?: InteractionDefaultValueOptions;
24
27
  }
25
28
  declare const MarkdownFlow: React.FC<MarkdownFlowProps>;
26
29
  export default MarkdownFlow;
@@ -1,48 +1,51 @@
1
1
  import { j as o } from "../../_virtual/jsx-runtime.es.js";
2
- import B from "../ContentRender/ContentRender.es.js";
3
- import "../ContentRender/IframeSandbox.es.js";
4
- import "../ui/inputGroup/input-group.es.js";
2
+ import C from "../ContentRender/ContentRender.es.js";
5
3
  import "react";
4
+ import "react-dom/client";
5
+ import "../ui/inputGroup/input-group.es.js";
6
6
  /* empty css */
7
- const h = ({
7
+ const j = ({
8
8
  initialContentList: a = [],
9
9
  customRenderBar: d,
10
10
  onSend: n,
11
- typingSpeed: i,
12
- enableTypewriter: s = !1,
13
- onBlockComplete: l,
14
- confirmButtonText: u,
11
+ typingSpeed: s,
12
+ enableTypewriter: i = !1,
13
+ onBlockComplete: u,
14
+ confirmButtonText: l,
15
15
  copyButtonText: m,
16
16
  copiedButtonText: p,
17
- beforeSend: c
17
+ beforeSend: c,
18
+ interactionDefaultValueOptions: y
18
19
  }) => /* @__PURE__ */ o.jsx("div", { className: "markdown-flow", children: a.map((e, r) => {
19
- const t = e.isFinished ?? !1, y = !t && s, f = t ? void 0 : n, x = t ? void 0 : i, S = c ?? (() => !0);
20
+ const t = e.isFinished ?? !1, x = !t && i, S = t ? void 0 : n, f = t ? void 0 : s, B = c ?? (() => !0);
20
21
  return /* @__PURE__ */ o.jsx(
21
- B,
22
+ C,
22
23
  {
23
24
  content: e.content,
25
+ userInput: e.userInput,
24
26
  defaultInputText: e.defaultInputText,
25
27
  defaultButtonText: e.defaultButtonText,
26
28
  defaultSelectedValues: e.defaultSelectedValues,
27
29
  readonly: e.readonly,
28
- enableTypewriter: y,
30
+ enableTypewriter: x,
29
31
  customRenderBar: e.customRenderBar || d,
30
- onSend: f,
31
- beforeSend: S,
32
+ onSend: S,
33
+ beforeSend: B,
34
+ interactionDefaultValueOptions: y,
32
35
  onClickCustomButtonAfterContent: e.onClickCustomButtonAfterContent,
33
- typingSpeed: x,
34
- confirmButtonText: u,
36
+ typingSpeed: f,
37
+ confirmButtonText: l,
35
38
  copyButtonText: m,
36
39
  copiedButtonText: p,
37
40
  dynamicInteractionFormat: e.dynamicInteractionFormat,
38
41
  onTypeFinished: () => {
39
- l?.(r);
42
+ u?.(r);
40
43
  }
41
44
  },
42
45
  r
43
46
  );
44
47
  }) });
45
48
  export {
46
- h as default
49
+ j as default
47
50
  };
48
51
  //# sourceMappingURL=MarkdownFlow.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownFlow.es.js","sources":["../../../src/components/MarkdownFlow/MarkdownFlow.tsx"],"sourcesContent":["import React from \"react\";\nimport ContentRender from \"../ContentRender\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport \"./markdownFlow.css\";\n\nexport interface MarkdownFlowProps {\n initialContentList?: {\n content: string;\n isFinished?: boolean;\n defaultInputText?: string;\n defaultButtonText?: string;\n defaultSelectedValues?: string[];\n readonly?: boolean;\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n dynamicInteractionFormat?: string;\n }[];\n customRenderBar?: CustomRenderBarProps;\n onSend?: (content: OnSendContentParams) => void;\n typingSpeed?: number;\n enableTypewriter?: boolean;\n onBlockComplete?: (blockIndex: number) => void;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text for code blocks\n copyButtonText?: string;\n // Copied state text for code blocks\n copiedButtonText?: string;\n beforeSend?: (content: OnSendContentParams) => boolean;\n}\n\nconst MarkdownFlow: React.FC<MarkdownFlowProps> = ({\n initialContentList = [],\n customRenderBar,\n onSend: onSendProp,\n typingSpeed: typingSpeedProp,\n enableTypewriter = false,\n onBlockComplete,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n beforeSend: beforeSendProp,\n}) => {\n return (\n <div className=\"markdown-flow\">\n {initialContentList.map((contentInfo, index) => {\n const isFinished = contentInfo.isFinished ?? false;\n const enableTypewriterForBlock = !isFinished && enableTypewriter;\n const onSend = isFinished ? undefined : onSendProp;\n const typingSpeed = isFinished ? undefined : typingSpeedProp;\n const beforeSend = beforeSendProp ?? (() => true);\n return (\n <ContentRender\n key={index}\n content={contentInfo.content}\n defaultInputText={contentInfo.defaultInputText}\n defaultButtonText={contentInfo.defaultButtonText}\n defaultSelectedValues={contentInfo.defaultSelectedValues}\n readonly={contentInfo.readonly}\n enableTypewriter={enableTypewriterForBlock}\n customRenderBar={contentInfo.customRenderBar || customRenderBar}\n onSend={onSend}\n beforeSend={beforeSend}\n onClickCustomButtonAfterContent={\n contentInfo.onClickCustomButtonAfterContent\n }\n typingSpeed={typingSpeed}\n confirmButtonText={confirmButtonText}\n copyButtonText={copyButtonText}\n copiedButtonText={copiedButtonText}\n dynamicInteractionFormat={contentInfo.dynamicInteractionFormat}\n onTypeFinished={() => {\n onBlockComplete?.(index);\n }}\n />\n );\n })}\n </div>\n );\n};\n\nexport default MarkdownFlow;\n"],"names":["MarkdownFlow","initialContentList","customRenderBar","onSendProp","typingSpeedProp","enableTypewriter","onBlockComplete","confirmButtonText","copyButtonText","copiedButtonText","beforeSendProp","jsx","contentInfo","index","isFinished","enableTypewriterForBlock","onSend","typingSpeed","beforeSend","ContentRender"],"mappings":";;;;;;AA+BA,MAAMA,IAA4C,CAAC;AAAA,EACjD,oBAAAC,IAAqB,CAAA;AAAA,EACrB,iBAAAC;AAAA,EACA,QAAQC;AAAA,EACR,aAAaC;AAAA,EACb,kBAAAC,IAAmB;AAAA,EACnB,iBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,YAAYC;AACd,MAEIC,gBAAAA,MAAC,SAAI,WAAU,iBACZ,YAAmB,IAAI,CAACC,GAAaC,MAAU;AAC9C,QAAMC,IAAaF,EAAY,cAAc,IACvCG,IAA2B,CAACD,KAAcT,GAC1CW,IAASF,IAAa,SAAYX,GAClCc,IAAcH,IAAa,SAAYV,GACvCc,IAAaR,MAAmB,MAAM;AAC5C,SACEC,gBAAAA,EAAAA;AAAAA,IAACQ;AAAA,IAAA;AAAA,MAEC,SAASP,EAAY;AAAA,MACrB,kBAAkBA,EAAY;AAAA,MAC9B,mBAAmBA,EAAY;AAAA,MAC/B,uBAAuBA,EAAY;AAAA,MACnC,UAAUA,EAAY;AAAA,MACtB,kBAAkBG;AAAA,MAClB,iBAAiBH,EAAY,mBAAmBV;AAAA,MAChD,QAAAc;AAAA,MACA,YAAAE;AAAA,MACA,iCACEN,EAAY;AAAA,MAEd,aAAAK;AAAA,MACA,mBAAAV;AAAA,MACA,gBAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,0BAA0BG,EAAY;AAAA,MACtC,gBAAgB,MAAM;AACpB,QAAAN,IAAkBO,CAAK;AAAA,MACzB;AAAA,IAAA;AAAA,IApBKA;AAAA,EAAA;AAuBX,CAAC,EAAA,CACH;"}
1
+ {"version":3,"file":"MarkdownFlow.es.js","sources":["../../../src/components/MarkdownFlow/MarkdownFlow.tsx"],"sourcesContent":["import React from \"react\";\nimport type { InteractionDefaultValueOptions } from \"../../lib/interaction-defaults\";\nimport ContentRender from \"../ContentRender\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport \"./markdownFlow.css\";\n\nexport interface MarkdownFlowProps {\n initialContentList?: {\n content: string;\n isFinished?: boolean;\n userInput?: string;\n defaultInputText?: string;\n defaultButtonText?: string;\n defaultSelectedValues?: string[];\n readonly?: boolean;\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n dynamicInteractionFormat?: string;\n }[];\n customRenderBar?: CustomRenderBarProps;\n onSend?: (content: OnSendContentParams) => void;\n typingSpeed?: number;\n enableTypewriter?: boolean;\n onBlockComplete?: (blockIndex: number) => void;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text for code blocks\n copyButtonText?: string;\n // Copied state text for code blocks\n copiedButtonText?: string;\n beforeSend?: (content: OnSendContentParams) => boolean;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n}\n\nconst MarkdownFlow: React.FC<MarkdownFlowProps> = ({\n initialContentList = [],\n customRenderBar,\n onSend: onSendProp,\n typingSpeed: typingSpeedProp,\n enableTypewriter = false,\n onBlockComplete,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n beforeSend: beforeSendProp,\n interactionDefaultValueOptions,\n}) => {\n return (\n <div className=\"markdown-flow\">\n {initialContentList.map((contentInfo, index) => {\n const isFinished = contentInfo.isFinished ?? false;\n const enableTypewriterForBlock = !isFinished && enableTypewriter;\n const onSend = isFinished ? undefined : onSendProp;\n const typingSpeed = isFinished ? undefined : typingSpeedProp;\n const beforeSend = beforeSendProp ?? (() => true);\n return (\n <ContentRender\n key={index}\n content={contentInfo.content}\n userInput={contentInfo.userInput}\n defaultInputText={contentInfo.defaultInputText}\n defaultButtonText={contentInfo.defaultButtonText}\n defaultSelectedValues={contentInfo.defaultSelectedValues}\n readonly={contentInfo.readonly}\n enableTypewriter={enableTypewriterForBlock}\n customRenderBar={contentInfo.customRenderBar || customRenderBar}\n onSend={onSend}\n beforeSend={beforeSend}\n interactionDefaultValueOptions={interactionDefaultValueOptions}\n onClickCustomButtonAfterContent={\n contentInfo.onClickCustomButtonAfterContent\n }\n typingSpeed={typingSpeed}\n confirmButtonText={confirmButtonText}\n copyButtonText={copyButtonText}\n copiedButtonText={copiedButtonText}\n dynamicInteractionFormat={contentInfo.dynamicInteractionFormat}\n onTypeFinished={() => {\n onBlockComplete?.(index);\n }}\n />\n );\n })}\n </div>\n );\n};\n\nexport default MarkdownFlow;\n"],"names":["MarkdownFlow","initialContentList","customRenderBar","onSendProp","typingSpeedProp","enableTypewriter","onBlockComplete","confirmButtonText","copyButtonText","copiedButtonText","beforeSendProp","interactionDefaultValueOptions","jsx","contentInfo","index","isFinished","enableTypewriterForBlock","onSend","typingSpeed","beforeSend","ContentRender"],"mappings":";;;;;;AAkCA,MAAMA,IAA4C,CAAC;AAAA,EACjD,oBAAAC,IAAqB,CAAA;AAAA,EACrB,iBAAAC;AAAA,EACA,QAAQC;AAAA,EACR,aAAaC;AAAA,EACb,kBAAAC,IAAmB;AAAA,EACnB,iBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,YAAYC;AAAA,EACZ,gCAAAC;AACF,MAEIC,gBAAAA,MAAC,SAAI,WAAU,iBACZ,YAAmB,IAAI,CAACC,GAAaC,MAAU;AAC9C,QAAMC,IAAaF,EAAY,cAAc,IACvCG,IAA2B,CAACD,KAAcV,GAC1CY,IAASF,IAAa,SAAYZ,GAClCe,IAAcH,IAAa,SAAYX,GACvCe,IAAaT,MAAmB,MAAM;AAC5C,SACEE,gBAAAA,EAAAA;AAAAA,IAACQ;AAAA,IAAA;AAAA,MAEC,SAASP,EAAY;AAAA,MACrB,WAAWA,EAAY;AAAA,MACvB,kBAAkBA,EAAY;AAAA,MAC9B,mBAAmBA,EAAY;AAAA,MAC/B,uBAAuBA,EAAY;AAAA,MACnC,UAAUA,EAAY;AAAA,MACtB,kBAAkBG;AAAA,MAClB,iBAAiBH,EAAY,mBAAmBX;AAAA,MAChD,QAAAe;AAAA,MACA,YAAAE;AAAA,MACA,gCAAAR;AAAA,MACA,iCACEE,EAAY;AAAA,MAEd,aAAAK;AAAA,MACA,mBAAAX;AAAA,MACA,gBAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,0BAA0BI,EAAY;AAAA,MACtC,gBAAgB,MAAM;AACpB,QAAAP,IAAkBQ,CAAK;AAAA,MACzB;AAAA,IAAA;AAAA,IAtBKA;AAAA,EAAA;AAyBX,CAAC,EAAA,CACH;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("../../_virtual/jsx-runtime.cjs.js"),t=require("react"),T=require("../../lib/utils.cjs.js");;/* empty css */const ee=require("../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.cjs.js"),te=require("../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/volume-2.cjs.js"),re=require("../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/rotate-ccw.cjs.js"),se=require("../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/rotate-cw.cjs.js"),ne=require("../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/maximize.cjs.js"),ue=require("../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/file-pen-line.cjs.js"),le=()=>r.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"34",height:"34",viewBox:"0 0 34 34",fill:"none",children:[r.jsxRuntimeExports.jsx("path",{d:"M16.6667 33.3333C25.8714 33.3333 33.3333 25.8714 33.3333 16.6667C33.3333 7.46192 25.8714 0 16.6667 0C7.46192 0 0 7.46192 0 16.6667C0 25.8714 7.46192 33.3333 16.6667 33.3333Z",fill:"#0A0A0A"}),r.jsxRuntimeExports.jsx("path",{d:"M12 10H16V24H12V10ZM18 10H22V24H18V10Z",fill:"white"})]}),ce=()=>r.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"34",height:"34",viewBox:"0 0 34 34",fill:"none",children:[r.jsxRuntimeExports.jsx("path",{d:"M16.6667 33.3333C25.8714 33.3333 33.3333 25.8714 33.3333 16.6667C33.3333 7.46192 25.8714 0 16.6667 0C7.46192 0 0 7.46192 0 16.6667C0 25.8714 7.46192 33.3333 16.6667 33.3333Z",fill:"#0A0A0A"}),r.jsxRuntimeExports.jsx("path",{d:"M13.3333 10L23.3333 16.6667L13.3333 23.3333V10Z",fill:"white"})]}),ae=({audioList:L=[],className:Z,currentAudioIndex:s=-1,defaultPlaying:u=!0,onPrev:$,onNext:F,onFullscreen:H,onEnded:M,onPlayRequest:v,onInteractionToggle:U,hasInteraction:B=!1,isInteractionOpen:K=!1,prevDisabled:z=!1,nextDisabled:O=!1,showControls:P=!0,...G})=>{const d=t.useRef(null),R=t.useRef(null),q=t.useRef(null),h=t.useRef(0),o=t.useRef(null),w=t.useRef(void 0),C=t.useRef([]),f=t.useRef(!1),n=t.useRef(!1),i=t.useRef(null),p=t.useRef(!1),[N,l]=t.useState(u),m=s>=0?L[s]:void 0,b=m?.audioUrl,x=t.useMemo(()=>[...m?.audioSegments??[]].sort((e,a)=>e.segment_index-a.segment_index),[m?.audioSegments]),A=`${s}:${m?.serialNumber??"none"}:${b??""}`;t.useEffect(()=>{w.current=m},[m]),t.useEffect(()=>{C.current=x},[x]);const W=t.useCallback(e=>e?e.startsWith("data:")?e:`data:audio/mpeg;base64,${e}`:"",[]),g=t.useCallback(()=>{const e=d.current;e&&(n.current=!1,i.current=null,f.current=!1,p.current=!1,e.pause(),e.removeAttribute("src"),e.load(),R.current=null,h.current=0,o.current=null,l(!1))},[s]),j=t.useCallback(e=>{const a=d.current;if(!a)return!1;const c=a.play();return c&&typeof c.then=="function"&&c.then(()=>{n.current=!1,p.current=!1}).catch(_=>{l(!1)}),!0},[s]),E=t.useCallback((e,a)=>{const c=d.current,_=C.current[e];if(!c||!_)return!1;const y=W(_.audio_data);h.current=e,o.current=null,f.current=!1,p.current=!0,n.current=u;const k=R.current!==y;return k&&(c.pause(),c.removeAttribute("src"),c.load(),R.current=y,c.src=y,c.load()),i.current=0,c.readyState>0&&(c.currentTime=0,i.current=null),u?k?!0:j(`start-segment:${a}`):(n.current=!1,p.current=!1,c.pause(),l(!1),!0)},[s,u,W,j]),S=t.useCallback(()=>{n.current=!1,f.current=!1,p.current=!1,l(!1),s>=0&&M?.(s)},[s,M]),V=t.useCallback(()=>{const e=h.current+1,a=C.current,c=a[e],_=w.current,y=a.some(k=>k.is_final);if(c){E(e,"ended");return}if(_?.isAudioStreaming||!y){h.current=e,o.current=e,f.current=!0,n.current=u,l(u);return}S("segments-completed")},[s,u,S,E]);t.useEffect(()=>{if(q.current===A)return;q.current=A,h.current=0,o.current=null,f.current=!1,n.current=!1,p.current=!1,R.current=null;const e=d.current;e&&(e.pause(),e.removeAttribute("src"),e.load(),l(!1))},[s,A,x.length,b]),t.useEffect(()=>{const e=d.current;if(e){if(!m){g();return}if(b){const a=R.current!==b;if(a&&(e.pause(),e.removeAttribute("src"),e.load(),R.current=b,e.src=b,e.load()),i.current=0,e.readyState>0&&(e.currentTime=0,i.current=null),n.current=u,f.current=!1,p.current=!1,!u){n.current=!1,e.pause(),l(!1);return}a||j("sync-url");return}if(o.current!==null){if(o.current<x.length){E(o.current,"wait-resume");return}f.current=!0,n.current=u,l(u);return}if(!x.length){if(m.isAudioStreaming){o.current=h.current,f.current=!0,n.current=u,l(u);return}g();return}if(!R.current){E(Math.min(h.current,x.length-1),"effect-init");return}if(!u){n.current=!1,e.pause(),l(!1);return}e.paused&&(n.current=!0,j("sync-paused-retry"))}},[m,s,x,b,u,g,E,j]),t.useEffect(()=>g,[g]);const J=t.useCallback(()=>{l(!0)},[s]),Q=t.useCallback(()=>{f.current||p.current||l(!1)},[s]),X=t.useCallback(()=>{const e=d.current;e&&i.current!==null&&(e.currentTime=i.current,i.current=null),!(!n.current||!u)&&j("canplay")},[s,u,j]),Y=t.useCallback(()=>{const e=d.current;e&&i.current!==null&&(e.currentTime=i.current,i.current=null)},[s]),D=t.useCallback(()=>{if(p.current=!1,w.current?.audioUrl||C.current.length===0){S("url-ended");return}V()},[s,S,V]),I=t.useCallback(()=>{l(!1)},[s]);return r.jsxRuntimeExports.jsxs("div",{className:T.cn("slide-player",Z),...G,children:[r.jsxRuntimeExports.jsx("audio",{ref:d,preload:"metadata",playsInline:!0,onLoadedMetadata:Y,onCanPlay:X,onPlay:J,onPause:Q,onEnded:D,onError:I}),P?r.jsxRuntimeExports.jsxs("div",{className:"slide-player__controls",children:[r.jsxRuntimeExports.jsxs("div",{className:"slide-player__group",children:[r.jsxRuntimeExports.jsx("button",{"aria-label":"More options",className:"hidden",type:"button",children:r.jsxRuntimeExports.jsx(ee.default,{className:"slide-player__icon",strokeWidth:2.25})}),r.jsxRuntimeExports.jsx("button",{"aria-label":"Volume",className:"hidden",type:"button",children:r.jsxRuntimeExports.jsx(te.default,{className:"slide-player__icon",strokeWidth:2.25})}),r.jsxRuntimeExports.jsx("button",{"aria-label":"Rewind",className:"slide-player__action",disabled:z,onClick:$,type:"button",children:r.jsxRuntimeExports.jsx(re.default,{className:"slide-player__icon",strokeWidth:2.25})}),r.jsxRuntimeExports.jsx("button",{"aria-label":N?"Pause":"Play",className:"slide-player__toggle",onClick:()=>{const e=d.current;if(!(!e||!m)){if(o.current!==null){if(N){n.current=!1,o.current=null,f.current=!1,l(!1),e.pause();return}v?.(),n.current=!0,l(!0);return}if(!e.src&&x.length>0){v?.(),E(Math.min(h.current,x.length-1),"toggle");return}if(e.paused){v?.(),n.current=!0,j("toggle-resume");return}n.current=!1,e.pause()}},type:"button",children:N?r.jsxRuntimeExports.jsx(le,{}):r.jsxRuntimeExports.jsx(ce,{})}),r.jsxRuntimeExports.jsx("button",{"aria-label":"Forward",className:"slide-player__action",disabled:O,onClick:F,type:"button",children:r.jsxRuntimeExports.jsx(se.default,{className:"slide-player__icon",strokeWidth:2.25})}),r.jsxRuntimeExports.jsx("button",{"aria-label":"Fullscreen",className:"hidden",onClick:H,type:"button",children:r.jsxRuntimeExports.jsx(ne.default,{className:"slide-player__icon",strokeWidth:2.25})})]}),r.jsxRuntimeExports.jsx("div",{className:"slide-player__separator"}),r.jsxRuntimeExports.jsx("div",{className:"slide-player__group",children:r.jsxRuntimeExports.jsx("button",{"aria-label":"Notes",className:T.cn("slide-player__action",K&&"slide-player__action--active"),disabled:!B,onClick:U,type:"button",children:r.jsxRuntimeExports.jsx(ue.default,{className:"slide-player__icon",strokeWidth:2.25})})})]}):null]})};exports.default=ae;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("../../_virtual/jsx-runtime.cjs.js"),t=require("react"),J=require("../../lib/utils.cjs.js"),xe=require("./utils/playerCustomActions.cjs.js");;/* empty css */const he=require("../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.cjs.js"),Re=require("../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/volume-2.cjs.js"),ge=require("../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/rotate-ccw.cjs.js"),be=require("../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/rotate-cw.cjs.js"),je=require("../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/maximize.cjs.js"),ye=require("../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/file-pen-line.cjs.js"),Q=new Map,X=b=>{if(typeof window>"u"||!b||Q.has(b))return;const _=window.document.createElement("audio");_.preload="auto",_.setAttribute("playsinline","true"),_.src=b,_.load(),Q.set(b,_)},Ee=()=>r.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"34",height:"34",viewBox:"0 0 34 34",fill:"none",children:[r.jsxRuntimeExports.jsx("path",{d:"M16.6667 33.3333C25.8714 33.3333 33.3333 25.8714 33.3333 16.6667C33.3333 7.46192 25.8714 0 16.6667 0C7.46192 0 0 7.46192 0 16.6667C0 25.8714 7.46192 33.3333 16.6667 33.3333Z",fill:"#0A0A0A"}),r.jsxRuntimeExports.jsx("path",{d:"M12 10H16V24H12V10ZM18 10H22V24H18V10Z",fill:"white"})]}),Se=()=>r.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"34",height:"34",viewBox:"0 0 34 34",fill:"none",children:[r.jsxRuntimeExports.jsx("path",{d:"M16.6667 33.3333C25.8714 33.3333 33.3333 25.8714 33.3333 16.6667C33.3333 7.46192 25.8714 0 16.6667 0C7.46192 0 0 7.46192 0 16.6667C0 25.8714 7.46192 33.3333 16.6667 33.3333Z",fill:"#0A0A0A"}),r.jsxRuntimeExports.jsx("path",{d:"M13.3333 10L23.3333 16.6667L13.3333 23.3333V10Z",fill:"white"})]}),ke=({audioList:b=[],className:_,currentAudioIndex:o=-1,defaultPlaying:x=!0,onLoadingChange:W,onPrev:Y,onNext:D,onFullscreen:I,onEnded:V,onInteractionToggle:ee,hasInteraction:te=!1,isInteractionOpen:re=!1,prevDisabled:ne=!1,nextDisabled:se=!1,showControls:ue=!0,customActions:F,...le})=>{const h=t.useRef(null),j=t.useRef(null),L=t.useRef(null),y=t.useRef(0),i=t.useRef(null),B=t.useRef(void 0),N=t.useRef([]),K=t.useRef(!1),d=t.useRef(!1),w=t.useRef(null),m=t.useRef(!1),s=t.useRef(!1),f=t.useRef(null),p=t.useRef(!1),E=t.useRef("unknown"),[U,c]=t.useState(x),a=o>=0?b[o]:void 0,A=a?.audioUrl,R=t.useMemo(()=>[...a?.audioSegments??[]].sort((e,l)=>e.segment_index-l.segment_index),[a?.audioSegments]),Z=t.useMemo(()=>xe.toPlayerCustomActionList(F),[F]),$=Z.length+4,ce=t.useMemo(()=>({"--slide-player-mobile-control-count":String($)}),[$]),T=t.useMemo(()=>a?a.audioKey??`${String(a.sequenceNumber??"none")}:${String(a.audioUrl??"")}`:"none",[a]);t.useEffect(()=>{B.current=a},[a]),t.useEffect(()=>{N.current=R},[R]),t.useEffect(()=>{const e=a?.audioUrl,l=o>=0?b[o+1]?.audioUrl:void 0;X(e),X(l)},[b,a?.audioUrl,o]);const n=t.useCallback(e=>{K.current!==e&&(K.current=e,W?.(e))},[W]),H=t.useCallback(e=>e instanceof DOMException?e.name==="NotAllowedError"||e.name==="SecurityError":!1,[]),S=t.useCallback(()=>x&&!d.current&&E.current!=="blocked",[x]),O=t.useCallback(e=>e?e.startsWith("data:")?e:`data:audio/mpeg;base64,${e}`:"",[]),z=t.useCallback(()=>{const e=i.current;return e==null||e<=0?0:N.current.slice(0,e).reduce((l,u)=>l+Math.max(Number(u.duration_ms??0),0),0)/1e3},[]),M=t.useCallback(()=>{const e=h.current;e&&(s.current=!1,d.current=!1,w.current=null,f.current=null,m.current=!1,p.current=!1,e.pause(),e.removeAttribute("src"),e.load(),j.current=null,y.current=0,i.current=null,c(!1),n(!1))},[n]),g=t.useCallback(e=>{const l=h.current;if(!l)return!1;const u=l.play();return u&&typeof u.then=="function"&&u.then(()=>{E.current==="unknown"&&(E.current="auto"),s.current=!1,p.current=!1}).catch(C=>{E.current==="unknown"&&H(C)&&(E.current="blocked",s.current=!1,n(!1)),p.current=!1,c(!1)}),!0},[H,n]),v=t.useCallback((e,l)=>{const u=h.current,C=N.current[e];if(!u||!C)return!1;const k=O(C.audio_data);y.current=e,i.current=null,m.current=!1,p.current=!0;const q=S();s.current=q,n(!1);const pe=j.current!==k;return w.current="segment",pe&&(u.pause(),u.removeAttribute("src"),u.load(),j.current=k,u.src=k,u.load()),f.current=0,u.readyState>0&&(u.currentTime=0,f.current=null),q?g(`start-segment:${l}`):(s.current=!1,p.current=!1,u.pause(),c(!1),!0)},[S,O,g,n]),P=t.useCallback(e=>{s.current=!1,m.current=!1,p.current=!1,c(!1),n(!1),o>=0&&V?.(o)},[o,V,n]),G=t.useCallback(()=>{const e=y.current+1,l=N.current,u=l[e],C=B.current,k=l.some(q=>q.is_final);if(u){v(e,"ended");return}if(C?.isAudioStreaming||!k){y.current=e,i.current=e,m.current=!0,s.current=x,c(!1),n(!0);return}P("segments-completed")},[x,P,v,n]);t.useEffect(()=>{if(L.current===T)return;L.current=T,y.current=0,i.current=null,m.current=!1,d.current=!1,s.current=!1,p.current=!1,w.current=null,j.current=null,n(!1);const e=h.current;e&&(e.pause(),e.removeAttribute("src"),e.load(),c(!1))},[o,T,R.length,A,n]),t.useEffect(()=>{const e=h.current;if(e){if(!a){M();return}if(A){const l=j.current!==A,u=S();if(w.current==="segment"&&!!j.current&&i.current===null){if(!u){s.current=!1,e.pause(),c(!1);return}e.paused&&(s.current=!0,g("keep-segment-source"));return}if(l){const k=i.current!==null?z():0;e.pause(),e.removeAttribute("src"),e.load(),j.current=A,w.current="url",e.src=A,e.load(),f.current=k,e.readyState>0&&(e.currentTime=k,f.current=null)}if(s.current=u,m.current=!1,p.current=!1,n(!1),!u){s.current=!1,e.pause(),c(!1);return}g(l?"sync-url-init":"sync-url");return}if(i.current!==null){if(i.current<R.length){if(d.current){c(!1),n(!1);return}v(i.current,"wait-resume");return}m.current=!0,s.current=S(),c(!1),n(S());return}if(!R.length){if(a.isAudioStreaming){i.current=y.current,m.current=!0,s.current=S(),c(!1),n(S());return}M();return}if(!j.current){v(Math.min(y.current,R.length-1),"effect-init");return}if(!x||d.current){s.current=!1,e.pause(),c(!1);return}e.paused&&(s.current=!0,g("sync-paused-retry"))}},[a,o,R,A,x,S,M,v,g,z,n]),t.useEffect(()=>M,[M]);const ae=t.useCallback(()=>{c(!0),n(!1)},[n]),oe=t.useCallback(()=>{m.current||p.current||c(!1)},[o]),ie=t.useCallback(()=>{const e=h.current;e&&f.current!==null&&(e.currentTime=f.current,f.current=null),!(!s.current||!x)&&g("canplay")},[o,x,g]),fe=t.useCallback(()=>{const e=h.current;e&&f.current!==null&&(e.currentTime=f.current,f.current=null)},[o]),de=t.useCallback(()=>{const e=w.current==="url"||N.current.length===0;if(p.current=!1,e){P("url-ended");return}G()},[P,G]),me=t.useCallback(()=>{c(!1),n(!1)},[n]);return r.jsxRuntimeExports.jsxs("div",{className:J.cn("slide-player",_),...le,children:[r.jsxRuntimeExports.jsx("audio",{ref:h,preload:"auto",playsInline:!0,onLoadedMetadata:fe,onCanPlay:ie,onPlay:ae,onPause:oe,onEnded:de,onError:me}),ue?r.jsxRuntimeExports.jsxs("div",{className:"slide-player__controls",style:ce,children:[r.jsxRuntimeExports.jsxs("div",{className:"slide-player__group",children:[r.jsxRuntimeExports.jsx("button",{"aria-label":"More options",className:"hidden",type:"button",children:r.jsxRuntimeExports.jsx(he.default,{className:"slide-player__icon",strokeWidth:2.25})}),r.jsxRuntimeExports.jsx("button",{"aria-label":"Volume",className:"hidden",type:"button",children:r.jsxRuntimeExports.jsx(Re.default,{className:"slide-player__icon",strokeWidth:2.25})}),r.jsxRuntimeExports.jsx("button",{"aria-label":"Rewind",className:"slide-player__action",disabled:ne,onClick:Y,type:"button",children:r.jsxRuntimeExports.jsx(ge.default,{className:"slide-player__icon",strokeWidth:2.25})}),r.jsxRuntimeExports.jsx("button",{"aria-label":U?"Pause":"Play",className:"slide-player__toggle",onClick:()=>{const e=h.current;if(!(!e||!a)){if(i.current!==null){if(U){s.current=!1,d.current=!0,i.current=null,m.current=!1,c(!1),n(!1),e.pause();return}E.current="manual",d.current=!1,s.current=!0,n(!0);return}if(!e.src&&R.length>0){E.current="manual",d.current=!1,v(Math.min(y.current,R.length-1),"toggle");return}if(e.paused){E.current="manual",d.current=!1,s.current=!0,g("toggle-resume");return}s.current=!1,d.current=!0,e.pause()}},type:"button",children:U?r.jsxRuntimeExports.jsx(Ee,{}):r.jsxRuntimeExports.jsx(Se,{})}),r.jsxRuntimeExports.jsx("button",{"aria-label":"Forward",className:"slide-player__action",disabled:se,onClick:D,type:"button",children:r.jsxRuntimeExports.jsx(be.default,{className:"slide-player__icon",strokeWidth:2.25})}),r.jsxRuntimeExports.jsx("button",{"aria-label":"Fullscreen",className:"hidden",onClick:I,type:"button",children:r.jsxRuntimeExports.jsx(je.default,{className:"slide-player__icon",strokeWidth:2.25})})]}),r.jsxRuntimeExports.jsx("div",{className:"slide-player__separator"}),r.jsxRuntimeExports.jsxs("div",{className:"slide-player__group",children:[Z.map((e,l)=>r.jsxRuntimeExports.jsx(t.Fragment,{children:e},`custom-action-${l}`)),r.jsxRuntimeExports.jsx("button",{"aria-label":"Notes",className:J.cn("slide-player__action",re&&"slide-player__action--active"),disabled:!te,onClick:ee,type:"button",children:r.jsxRuntimeExports.jsx(ye.default,{className:"slide-player__icon",strokeWidth:2.25})})]})]}):null]})};exports.default=ke;
2
2
  //# sourceMappingURL=Player.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Player.cjs.js","sources":["../../../src/components/Slide/Player.tsx"],"sourcesContent":["import React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n EllipsisVertical,\n FilePenLine,\n Maximize,\n RotateCcw,\n RotateCw,\n Volume2,\n} from \"lucide-react\";\n\nimport { cn } from \"../../lib/utils\";\nimport type { SlideAudioItem } from \"./useSlide\";\nimport \"./player.css\";\n\nexport type PlayerProps = React.ComponentProps<\"div\"> & {\n audioList?: SlideAudioItem[];\n currentAudioIndex?: number;\n defaultPlaying?: boolean;\n onPrev?: () => void;\n onNext?: () => void;\n onFullscreen?: () => void;\n onEnded?: (audioIndex: number) => void;\n onPlayRequest?: () => void;\n onInteractionToggle?: () => void;\n hasInteraction?: boolean;\n isInteractionOpen?: boolean;\n prevDisabled?: boolean;\n nextDisabled?: boolean;\n showControls?: boolean;\n};\n\nconst PauseIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"34\"\n height=\"34\"\n viewBox=\"0 0 34 34\"\n fill=\"none\"\n >\n <path\n d=\"M16.6667 33.3333C25.8714 33.3333 33.3333 25.8714 33.3333 16.6667C33.3333 7.46192 25.8714 0 16.6667 0C7.46192 0 0 7.46192 0 16.6667C0 25.8714 7.46192 33.3333 16.6667 33.3333Z\"\n fill=\"#0A0A0A\"\n />\n <path d=\"M12 10H16V24H12V10ZM18 10H22V24H18V10Z\" fill=\"white\" />\n </svg>\n);\n\nconst PlayIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"34\"\n height=\"34\"\n viewBox=\"0 0 34 34\"\n fill=\"none\"\n >\n <path\n d=\"M16.6667 33.3333C25.8714 33.3333 33.3333 25.8714 33.3333 16.6667C33.3333 7.46192 25.8714 0 16.6667 0C7.46192 0 0 7.46192 0 16.6667C0 25.8714 7.46192 33.3333 16.6667 33.3333Z\"\n fill=\"#0A0A0A\"\n />\n <path d=\"M13.3333 10L23.3333 16.6667L13.3333 23.3333V10Z\" fill=\"white\" />\n </svg>\n);\n\nconst Player: React.FC<PlayerProps> = ({\n audioList = [],\n className,\n currentAudioIndex = -1,\n defaultPlaying = true,\n onPrev,\n onNext,\n onFullscreen,\n onEnded,\n onPlayRequest,\n onInteractionToggle,\n hasInteraction = false,\n isInteractionOpen = false,\n prevDisabled = false,\n nextDisabled = false,\n showControls = true,\n ...props\n}) => {\n const audioRef = useRef<HTMLAudioElement | null>(null);\n const audioSrcRef = useRef<string | null>(null);\n const currentAudioKeyRef = useRef<string | null>(null);\n const currentSegmentIndexRef = useRef(0);\n const waitingSegmentIndexRef = useRef<number | null>(null);\n const currentAudioRef = useRef<SlideAudioItem | undefined>(undefined);\n const currentAudioSegmentsRef = useRef<\n NonNullable<SlideAudioItem[\"audioSegments\"]>\n >([]);\n const isWaitingForSegmentRef = useRef(false);\n const pendingAutoPlayRef = useRef(false);\n const pendingSeekTimeRef = useRef<number | null>(null);\n const isSwitchingSegmentRef = useRef(false);\n const [isPlaying, setIsPlaying] = useState(defaultPlaying);\n const currentAudio =\n currentAudioIndex >= 0 ? audioList[currentAudioIndex] : undefined;\n const currentAudioUrl = currentAudio?.audioUrl;\n const currentAudioSegments = useMemo(\n () =>\n [...(currentAudio?.audioSegments ?? [])].sort(\n (prevSegment, nextSegment) =>\n prevSegment.segment_index - nextSegment.segment_index\n ),\n [currentAudio?.audioSegments]\n );\n const currentAudioKey = `${currentAudioIndex}:${currentAudio?.serialNumber ?? \"none\"}:${currentAudioUrl ?? \"\"}`;\n\n useEffect(() => {\n currentAudioRef.current = currentAudio;\n }, [currentAudio]);\n\n useEffect(() => {\n currentAudioSegmentsRef.current = currentAudioSegments;\n }, [currentAudioSegments]);\n\n const getSegmentSrc = useCallback((audioData: string) => {\n if (!audioData) {\n return \"\";\n }\n\n if (audioData.startsWith(\"data:\")) {\n return audioData;\n }\n\n return `data:audio/mpeg;base64,${audioData}`;\n }, []);\n\n const resetAudio = useCallback(() => {\n const audioElement = audioRef.current;\n\n if (!audioElement) {\n return;\n }\n\n pendingAutoPlayRef.current = false;\n pendingSeekTimeRef.current = null;\n isWaitingForSegmentRef.current = false;\n isSwitchingSegmentRef.current = false;\n audioElement.pause();\n audioElement.removeAttribute(\"src\");\n audioElement.load();\n audioSrcRef.current = null;\n currentSegmentIndexRef.current = 0;\n waitingSegmentIndexRef.current = null;\n setIsPlaying(false);\n }, [currentAudioIndex]);\n\n const tryPlayCurrentAudio = useCallback(\n (_reason: string) => {\n const audioElement = audioRef.current;\n\n if (!audioElement) {\n return false;\n }\n\n const playPromise = audioElement.play();\n\n if (playPromise && typeof playPromise.then === \"function\") {\n void playPromise\n .then(() => {\n pendingAutoPlayRef.current = false;\n isSwitchingSegmentRef.current = false;\n })\n .catch((_error: unknown) => {\n setIsPlaying(false);\n });\n }\n\n return true;\n },\n [currentAudioIndex]\n );\n\n const startSegmentPlayback = useCallback(\n (segmentIndex: number, _reason: string) => {\n const audioElement = audioRef.current;\n const segment = currentAudioSegmentsRef.current[segmentIndex];\n\n if (!audioElement || !segment) {\n return false;\n }\n\n const nextAudioSrc = getSegmentSrc(segment.audio_data);\n\n currentSegmentIndexRef.current = segmentIndex;\n waitingSegmentIndexRef.current = null;\n isWaitingForSegmentRef.current = false;\n isSwitchingSegmentRef.current = true;\n pendingAutoPlayRef.current = defaultPlaying;\n\n const hasNewSrc = audioSrcRef.current !== nextAudioSrc;\n\n if (hasNewSrc) {\n audioElement.pause();\n audioElement.removeAttribute(\"src\");\n audioElement.load();\n audioSrcRef.current = nextAudioSrc;\n audioElement.src = nextAudioSrc;\n audioElement.load();\n }\n\n pendingSeekTimeRef.current = 0;\n\n if (audioElement.readyState > 0) {\n audioElement.currentTime = 0;\n pendingSeekTimeRef.current = null;\n }\n\n if (!defaultPlaying) {\n pendingAutoPlayRef.current = false;\n isSwitchingSegmentRef.current = false;\n audioElement.pause();\n setIsPlaying(false);\n return true;\n }\n\n if (hasNewSrc) {\n return true;\n }\n\n return tryPlayCurrentAudio(`start-segment:${_reason}`);\n },\n [currentAudioIndex, defaultPlaying, getSegmentSrc, tryPlayCurrentAudio]\n );\n\n const finishAudioItem = useCallback(() => {\n pendingAutoPlayRef.current = false;\n isWaitingForSegmentRef.current = false;\n isSwitchingSegmentRef.current = false;\n setIsPlaying(false);\n\n if (currentAudioIndex >= 0) {\n onEnded?.(currentAudioIndex);\n }\n }, [currentAudioIndex, onEnded]);\n\n const handleSegmentEnded = useCallback(() => {\n const nextSegmentIndex = currentSegmentIndexRef.current + 1;\n const segments = currentAudioSegmentsRef.current;\n const nextSegment = segments[nextSegmentIndex];\n const activeAudio = currentAudioRef.current;\n const hasFinal = segments.some((segment) => segment.is_final);\n\n if (nextSegment) {\n startSegmentPlayback(nextSegmentIndex, \"ended\");\n return;\n }\n\n if (activeAudio?.isAudioStreaming || !hasFinal) {\n currentSegmentIndexRef.current = nextSegmentIndex;\n waitingSegmentIndexRef.current = nextSegmentIndex;\n isWaitingForSegmentRef.current = true;\n pendingAutoPlayRef.current = defaultPlaying;\n setIsPlaying(defaultPlaying);\n\n return;\n }\n\n finishAudioItem(\"segments-completed\");\n }, [\n currentAudioIndex,\n defaultPlaying,\n finishAudioItem,\n startSegmentPlayback,\n ]);\n\n useEffect(() => {\n if (currentAudioKeyRef.current === currentAudioKey) {\n return;\n }\n\n currentAudioKeyRef.current = currentAudioKey;\n currentSegmentIndexRef.current = 0;\n waitingSegmentIndexRef.current = null;\n isWaitingForSegmentRef.current = false;\n pendingAutoPlayRef.current = false;\n isSwitchingSegmentRef.current = false;\n audioSrcRef.current = null;\n\n const audioElement = audioRef.current;\n\n if (!audioElement) {\n return;\n }\n\n audioElement.pause();\n audioElement.removeAttribute(\"src\");\n audioElement.load();\n setIsPlaying(false);\n }, [\n currentAudioIndex,\n currentAudioKey,\n currentAudioSegments.length,\n currentAudioUrl,\n ]);\n\n useEffect(() => {\n const audioElement = audioRef.current;\n\n if (!audioElement) {\n return;\n }\n\n if (!currentAudio) {\n resetAudio();\n return;\n }\n\n if (currentAudioUrl) {\n const hasNewSrc = audioSrcRef.current !== currentAudioUrl;\n\n if (hasNewSrc) {\n audioElement.pause();\n audioElement.removeAttribute(\"src\");\n audioElement.load();\n audioSrcRef.current = currentAudioUrl;\n audioElement.src = currentAudioUrl;\n audioElement.load();\n }\n\n pendingSeekTimeRef.current = 0;\n\n if (audioElement.readyState > 0) {\n audioElement.currentTime = 0;\n pendingSeekTimeRef.current = null;\n }\n\n pendingAutoPlayRef.current = defaultPlaying;\n isWaitingForSegmentRef.current = false;\n isSwitchingSegmentRef.current = false;\n\n if (!defaultPlaying) {\n pendingAutoPlayRef.current = false;\n audioElement.pause();\n setIsPlaying(false);\n return;\n }\n\n if (!hasNewSrc) {\n tryPlayCurrentAudio(\"sync-url\");\n }\n return;\n }\n\n if (waitingSegmentIndexRef.current !== null) {\n if (waitingSegmentIndexRef.current < currentAudioSegments.length) {\n startSegmentPlayback(waitingSegmentIndexRef.current, \"wait-resume\");\n return;\n }\n\n isWaitingForSegmentRef.current = true;\n pendingAutoPlayRef.current = defaultPlaying;\n setIsPlaying(defaultPlaying);\n return;\n }\n\n if (!currentAudioSegments.length) {\n if (currentAudio.isAudioStreaming) {\n waitingSegmentIndexRef.current = currentSegmentIndexRef.current;\n isWaitingForSegmentRef.current = true;\n pendingAutoPlayRef.current = defaultPlaying;\n setIsPlaying(defaultPlaying);\n return;\n }\n\n resetAudio();\n return;\n }\n\n if (!audioSrcRef.current) {\n startSegmentPlayback(\n Math.min(\n currentSegmentIndexRef.current,\n currentAudioSegments.length - 1\n ),\n \"effect-init\"\n );\n return;\n }\n\n if (!defaultPlaying) {\n pendingAutoPlayRef.current = false;\n audioElement.pause();\n setIsPlaying(false);\n return;\n }\n\n if (audioElement.paused) {\n pendingAutoPlayRef.current = true;\n tryPlayCurrentAudio(\"sync-paused-retry\");\n }\n }, [\n currentAudio,\n currentAudioIndex,\n currentAudioSegments,\n currentAudioUrl,\n defaultPlaying,\n resetAudio,\n startSegmentPlayback,\n tryPlayCurrentAudio,\n ]);\n\n useEffect(() => resetAudio, [resetAudio]);\n\n const handleAudioPlay = useCallback(() => {\n setIsPlaying(true);\n }, [currentAudioIndex]);\n\n const handleAudioPause = useCallback(() => {\n if (isWaitingForSegmentRef.current || isSwitchingSegmentRef.current) {\n return;\n }\n\n setIsPlaying(false);\n }, [currentAudioIndex]);\n\n const handleAudioCanPlay = useCallback(() => {\n const audioElement = audioRef.current;\n\n if (audioElement && pendingSeekTimeRef.current !== null) {\n audioElement.currentTime = pendingSeekTimeRef.current;\n pendingSeekTimeRef.current = null;\n }\n\n if (!pendingAutoPlayRef.current || !defaultPlaying) {\n return;\n }\n\n tryPlayCurrentAudio(\"canplay\");\n }, [currentAudioIndex, defaultPlaying, tryPlayCurrentAudio]);\n\n const handleLoadedMetadata = useCallback(() => {\n const audioElement = audioRef.current;\n\n if (audioElement && pendingSeekTimeRef.current !== null) {\n audioElement.currentTime = pendingSeekTimeRef.current;\n pendingSeekTimeRef.current = null;\n }\n }, [currentAudioIndex]);\n\n const handleAudioEnded = useCallback(() => {\n isSwitchingSegmentRef.current = false;\n\n if (\n currentAudioRef.current?.audioUrl ||\n currentAudioSegmentsRef.current.length === 0\n ) {\n finishAudioItem(\"url-ended\");\n return;\n }\n\n handleSegmentEnded();\n }, [currentAudioIndex, finishAudioItem, handleSegmentEnded]);\n\n const handleAudioError = useCallback(() => {\n setIsPlaying(false);\n }, [currentAudioIndex]);\n\n return (\n <div className={cn(\"slide-player\", className)} {...props}>\n <audio\n ref={audioRef}\n preload=\"metadata\"\n playsInline\n onLoadedMetadata={handleLoadedMetadata}\n onCanPlay={handleAudioCanPlay}\n onPlay={handleAudioPlay}\n onPause={handleAudioPause}\n onEnded={handleAudioEnded}\n onError={handleAudioError}\n />\n\n {showControls ? (\n <div className=\"slide-player__controls\">\n <div className=\"slide-player__group\">\n <button aria-label=\"More options\" className=\"hidden\" type=\"button\">\n <EllipsisVertical\n className=\"slide-player__icon\"\n strokeWidth={2.25}\n />\n </button>\n <button aria-label=\"Volume\" className=\"hidden\" type=\"button\">\n <Volume2 className=\"slide-player__icon\" strokeWidth={2.25} />\n </button>\n <button\n aria-label=\"Rewind\"\n className=\"slide-player__action\"\n disabled={prevDisabled}\n onClick={onPrev}\n type=\"button\"\n >\n <RotateCcw className=\"slide-player__icon\" strokeWidth={2.25} />\n </button>\n <button\n aria-label={isPlaying ? \"Pause\" : \"Play\"}\n className=\"slide-player__toggle\"\n onClick={() => {\n const audioElement = audioRef.current;\n\n if (!audioElement || !currentAudio) {\n return;\n }\n\n if (waitingSegmentIndexRef.current !== null) {\n if (isPlaying) {\n pendingAutoPlayRef.current = false;\n waitingSegmentIndexRef.current = null;\n isWaitingForSegmentRef.current = false;\n setIsPlaying(false);\n audioElement.pause();\n return;\n }\n\n onPlayRequest?.();\n pendingAutoPlayRef.current = true;\n setIsPlaying(true);\n return;\n }\n\n if (!audioElement.src && currentAudioSegments.length > 0) {\n // Only the player play button can unlock playback when autoplay is unavailable.\n onPlayRequest?.();\n startSegmentPlayback(\n Math.min(\n currentSegmentIndexRef.current,\n currentAudioSegments.length - 1\n ),\n \"toggle\"\n );\n return;\n }\n\n if (audioElement.paused) {\n onPlayRequest?.();\n pendingAutoPlayRef.current = true;\n tryPlayCurrentAudio(\"toggle-resume\");\n return;\n }\n\n pendingAutoPlayRef.current = false;\n audioElement.pause();\n }}\n type=\"button\"\n >\n {isPlaying ? <PauseIcon /> : <PlayIcon />}\n </button>\n <button\n aria-label=\"Forward\"\n className=\"slide-player__action\"\n disabled={nextDisabled}\n onClick={onNext}\n type=\"button\"\n >\n <RotateCw className=\"slide-player__icon\" strokeWidth={2.25} />\n </button>\n <button\n aria-label=\"Fullscreen\"\n className=\"hidden\"\n onClick={onFullscreen}\n type=\"button\"\n >\n <Maximize className=\"slide-player__icon\" strokeWidth={2.25} />\n </button>\n </div>\n\n <div className=\"slide-player__separator\" />\n\n <div className=\"slide-player__group\">\n <button\n aria-label=\"Notes\"\n className={cn(\n \"slide-player__action\",\n isInteractionOpen && \"slide-player__action--active\"\n )}\n disabled={!hasInteraction}\n onClick={onInteractionToggle}\n type=\"button\"\n >\n <FilePenLine className=\"slide-player__icon\" strokeWidth={2.25} />\n </button>\n </div>\n </div>\n ) : null}\n </div>\n );\n};\n\nexport default Player;\n"],"names":["PauseIcon","jsxs","jsx","PlayIcon","Player","audioList","className","currentAudioIndex","defaultPlaying","onPrev","onNext","onFullscreen","onEnded","onPlayRequest","onInteractionToggle","hasInteraction","isInteractionOpen","prevDisabled","nextDisabled","showControls","props","audioRef","useRef","audioSrcRef","currentAudioKeyRef","currentSegmentIndexRef","waitingSegmentIndexRef","currentAudioRef","currentAudioSegmentsRef","isWaitingForSegmentRef","pendingAutoPlayRef","pendingSeekTimeRef","isSwitchingSegmentRef","isPlaying","setIsPlaying","useState","currentAudio","currentAudioUrl","currentAudioSegments","useMemo","prevSegment","nextSegment","currentAudioKey","useEffect","getSegmentSrc","useCallback","audioData","resetAudio","audioElement","tryPlayCurrentAudio","_reason","playPromise","_error","startSegmentPlayback","segmentIndex","segment","nextAudioSrc","hasNewSrc","finishAudioItem","handleSegmentEnded","nextSegmentIndex","segments","activeAudio","hasFinal","handleAudioPlay","handleAudioPause","handleAudioCanPlay","handleLoadedMetadata","handleAudioEnded","handleAudioError","cn","EllipsisVertical","Volume2","RotateCcw","RotateCw","Maximize","FilePenLine"],"mappings":"kvCAqCMA,GAAY,IAChBC,EAAAA,kBAAAA,KAAC,MAAA,CACC,MAAM,6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AAC,SAAA,CACC,aAAW,aACX,UAAU,SACV,QAASS,EACT,KAAK,SAEL,SAAAT,EAAAA,kBAAAA,IAACyE,WAAA,CAAS,UAAU,qBAAqB,YAAa,IAAA,CAAM,CAAA,CAAA,CAC9D,EACF,EAEAzE,EAAAA,kBAAAA,IAAC,MAAA,CAAI,UAAU,yBAAA,CAA0B,EAEzCA,EAAAA,kBAAAA,IAAC,MAAA,CAAI,UAAU,sBACb,SAAAA,EAAAA,kBAAAA,IAAC,SAAA,CACC,aAAW,QACX,UAAWoE,EAAAA,GACT,uBACAtD,GAAqB,8BAAA,EAEvB,SAAU,CAACD,EACX,QAASD,EACT,KAAK,SAEL,SAAAZ,EAAAA,kBAAAA,IAAC0E,WAAA,CAAY,UAAU,qBAAqB,YAAa,IAAA,CAAM,CAAA,CAAA,CACjE,CACF,CAAA,CAAA,CACF,EACE,IAAA,EACN,CAEJ"}
1
+ {"version":3,"file":"Player.cjs.js","sources":["../../../src/components/Slide/Player.tsx"],"sourcesContent":["import React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n EllipsisVertical,\n FilePenLine,\n Maximize,\n RotateCcw,\n RotateCw,\n Volume2,\n} from \"lucide-react\";\n\nimport { cn } from \"../../lib/utils\";\nimport type { SlideAudioItem } from \"./useSlide\";\nimport { toPlayerCustomActionList } from \"./utils/playerCustomActions\";\nimport \"./player.css\";\n\nconst audioPreloadElementCache = new Map<string, HTMLAudioElement>();\n\nconst preloadAudioUrl = (url?: string) => {\n if (typeof window === \"undefined\" || !url) {\n return;\n }\n\n if (audioPreloadElementCache.has(url)) {\n return;\n }\n\n // Use a detached audio element so warm-up follows the same media loading\n // path as the visible player instead of relying on link preload hints.\n const audio = window.document.createElement(\"audio\");\n audio.preload = \"auto\";\n audio.setAttribute(\"playsinline\", \"true\");\n audio.src = url;\n audio.load();\n\n audioPreloadElementCache.set(url, audio);\n};\n\nexport type PlayerProps = Omit<React.ComponentProps<\"div\">, \"onEnded\"> & {\n audioList?: SlideAudioItem[];\n currentAudioIndex?: number;\n defaultPlaying?: boolean;\n onLoadingChange?: (loading: boolean) => void;\n onPrev?: () => void;\n onNext?: () => void;\n onFullscreen?: () => void;\n onEnded?: (audioIndex: number) => void;\n onInteractionToggle?: () => void;\n hasInteraction?: boolean;\n isInteractionOpen?: boolean;\n prevDisabled?: boolean;\n nextDisabled?: boolean;\n showControls?: boolean;\n customActions?: React.ReactNode;\n};\n\nconst PauseIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"34\"\n height=\"34\"\n viewBox=\"0 0 34 34\"\n fill=\"none\"\n >\n <path\n d=\"M16.6667 33.3333C25.8714 33.3333 33.3333 25.8714 33.3333 16.6667C33.3333 7.46192 25.8714 0 16.6667 0C7.46192 0 0 7.46192 0 16.6667C0 25.8714 7.46192 33.3333 16.6667 33.3333Z\"\n fill=\"#0A0A0A\"\n />\n <path d=\"M12 10H16V24H12V10ZM18 10H22V24H18V10Z\" fill=\"white\" />\n </svg>\n);\n\nconst PlayIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"34\"\n height=\"34\"\n viewBox=\"0 0 34 34\"\n fill=\"none\"\n >\n <path\n d=\"M16.6667 33.3333C25.8714 33.3333 33.3333 25.8714 33.3333 16.6667C33.3333 7.46192 25.8714 0 16.6667 0C7.46192 0 0 7.46192 0 16.6667C0 25.8714 7.46192 33.3333 16.6667 33.3333Z\"\n fill=\"#0A0A0A\"\n />\n <path d=\"M13.3333 10L23.3333 16.6667L13.3333 23.3333V10Z\" fill=\"white\" />\n </svg>\n);\n\nconst Player: React.FC<PlayerProps> = ({\n audioList = [],\n className,\n currentAudioIndex = -1,\n defaultPlaying = true,\n onLoadingChange,\n onPrev,\n onNext,\n onFullscreen,\n onEnded,\n onInteractionToggle,\n hasInteraction = false,\n isInteractionOpen = false,\n prevDisabled = false,\n nextDisabled = false,\n showControls = true,\n customActions,\n ...props\n}) => {\n const audioRef = useRef<HTMLAudioElement | null>(null);\n const audioSrcRef = useRef<string | null>(null);\n const currentAudioKeyRef = useRef<string | null>(null);\n const currentSegmentIndexRef = useRef(0);\n const waitingSegmentIndexRef = useRef<number | null>(null);\n const currentAudioRef = useRef<SlideAudioItem | undefined>(undefined);\n const currentAudioSegmentsRef = useRef<\n NonNullable<SlideAudioItem[\"audioSegments\"]>\n >([]);\n const isLoadingRef = useRef(false);\n const isPausedByUserRef = useRef(false);\n const activeSourceTypeRef = useRef<\"url\" | \"segment\" | null>(null);\n const isWaitingForSegmentRef = useRef(false);\n const pendingAutoPlayRef = useRef(false);\n const pendingSeekTimeRef = useRef<number | null>(null);\n const isSwitchingSegmentRef = useRef(false);\n const playbackAccessModeRef = useRef<\n \"unknown\" | \"auto\" | \"manual\" | \"blocked\"\n >(\"unknown\");\n const [isPlaying, setIsPlaying] = useState(defaultPlaying);\n const currentAudio =\n currentAudioIndex >= 0 ? audioList[currentAudioIndex] : undefined;\n const currentAudioUrl = currentAudio?.audioUrl;\n const currentAudioSegments = useMemo(\n () =>\n [...(currentAudio?.audioSegments ?? [])].sort(\n (prevSegment, nextSegment) =>\n prevSegment.segment_index - nextSegment.segment_index\n ),\n [currentAudio?.audioSegments]\n );\n const customActionList = useMemo(\n () => toPlayerCustomActionList(customActions),\n [customActions]\n );\n const mobileVisibleActionCount = customActionList.length + 4;\n const controlsStyle = useMemo(\n () =>\n ({\n \"--slide-player-mobile-control-count\": String(mobileVisibleActionCount),\n }) as React.CSSProperties,\n [mobileVisibleActionCount]\n );\n const currentAudioKey = useMemo(() => {\n if (!currentAudio) {\n return \"none\";\n }\n\n return (\n currentAudio.audioKey ??\n `${String(currentAudio.sequenceNumber ?? \"none\")}:${String(currentAudio.audioUrl ?? \"\")}`\n );\n }, [currentAudio]);\n\n useEffect(() => {\n currentAudioRef.current = currentAudio;\n }, [currentAudio]);\n\n useEffect(() => {\n currentAudioSegmentsRef.current = currentAudioSegments;\n }, [currentAudioSegments]);\n\n useEffect(() => {\n const currentUrl = currentAudio?.audioUrl;\n const nextUrl =\n currentAudioIndex >= 0\n ? audioList[currentAudioIndex + 1]?.audioUrl\n : undefined;\n\n preloadAudioUrl(currentUrl);\n preloadAudioUrl(nextUrl);\n }, [audioList, currentAudio?.audioUrl, currentAudioIndex]);\n\n const updateLoading = useCallback(\n (loading: boolean) => {\n if (isLoadingRef.current === loading) {\n return;\n }\n\n isLoadingRef.current = loading;\n onLoadingChange?.(loading);\n },\n [onLoadingChange]\n );\n\n const isAutoplayBlockedError = useCallback((error: unknown) => {\n if (!(error instanceof DOMException)) {\n return false;\n }\n\n return error.name === \"NotAllowedError\" || error.name === \"SecurityError\";\n }, []);\n\n const canStartPlaybackAutomatically = useCallback(() => {\n return (\n defaultPlaying &&\n !isPausedByUserRef.current &&\n playbackAccessModeRef.current !== \"blocked\"\n );\n }, [defaultPlaying]);\n\n const getSegmentSrc = useCallback((audioData: string) => {\n if (!audioData) {\n return \"\";\n }\n\n if (audioData.startsWith(\"data:\")) {\n return audioData;\n }\n\n return `data:audio/mpeg;base64,${audioData}`;\n }, []);\n\n const getWaitingSegmentSeekTime = useCallback(() => {\n const waitingSegmentIndex = waitingSegmentIndexRef.current;\n\n if (waitingSegmentIndex == null || waitingSegmentIndex <= 0) {\n return 0;\n }\n\n return (\n currentAudioSegmentsRef.current\n .slice(0, waitingSegmentIndex)\n .reduce(\n (totalDurationMs, segment) =>\n totalDurationMs + Math.max(Number(segment.duration_ms ?? 0), 0),\n 0\n ) / 1000\n );\n }, []);\n\n const resetAudio = useCallback(() => {\n const audioElement = audioRef.current;\n\n if (!audioElement) {\n return;\n }\n\n pendingAutoPlayRef.current = false;\n isPausedByUserRef.current = false;\n activeSourceTypeRef.current = null;\n pendingSeekTimeRef.current = null;\n isWaitingForSegmentRef.current = false;\n isSwitchingSegmentRef.current = false;\n audioElement.pause();\n audioElement.removeAttribute(\"src\");\n audioElement.load();\n audioSrcRef.current = null;\n currentSegmentIndexRef.current = 0;\n waitingSegmentIndexRef.current = null;\n setIsPlaying(false);\n updateLoading(false);\n }, [updateLoading]);\n\n const tryPlayCurrentAudio = useCallback(\n (_reason: string) => {\n const audioElement = audioRef.current;\n\n if (!audioElement) {\n return false;\n }\n\n const playPromise = audioElement.play();\n\n if (playPromise && typeof playPromise.then === \"function\") {\n void playPromise\n .then(() => {\n if (playbackAccessModeRef.current === \"unknown\") {\n playbackAccessModeRef.current = \"auto\";\n }\n\n pendingAutoPlayRef.current = false;\n isSwitchingSegmentRef.current = false;\n })\n .catch((error: unknown) => {\n if (\n playbackAccessModeRef.current === \"unknown\" &&\n isAutoplayBlockedError(error)\n ) {\n // Lock autoplay after the first browser rejection.\n playbackAccessModeRef.current = \"blocked\";\n pendingAutoPlayRef.current = false;\n updateLoading(false);\n }\n\n isSwitchingSegmentRef.current = false;\n setIsPlaying(false);\n });\n }\n\n return true;\n },\n [isAutoplayBlockedError, updateLoading]\n );\n\n const startSegmentPlayback = useCallback(\n (segmentIndex: number, _reason: string) => {\n const audioElement = audioRef.current;\n const segment = currentAudioSegmentsRef.current[segmentIndex];\n\n if (!audioElement || !segment) {\n return false;\n }\n\n const nextAudioSrc = getSegmentSrc(segment.audio_data);\n\n currentSegmentIndexRef.current = segmentIndex;\n waitingSegmentIndexRef.current = null;\n isWaitingForSegmentRef.current = false;\n isSwitchingSegmentRef.current = true;\n const shouldAutoResume = canStartPlaybackAutomatically();\n\n pendingAutoPlayRef.current = shouldAutoResume;\n updateLoading(false);\n\n const hasNewSrc = audioSrcRef.current !== nextAudioSrc;\n\n activeSourceTypeRef.current = \"segment\";\n\n if (hasNewSrc) {\n audioElement.pause();\n audioElement.removeAttribute(\"src\");\n audioElement.load();\n audioSrcRef.current = nextAudioSrc;\n audioElement.src = nextAudioSrc;\n audioElement.load();\n }\n\n pendingSeekTimeRef.current = 0;\n\n if (audioElement.readyState > 0) {\n audioElement.currentTime = 0;\n pendingSeekTimeRef.current = null;\n }\n\n if (!shouldAutoResume) {\n pendingAutoPlayRef.current = false;\n isSwitchingSegmentRef.current = false;\n audioElement.pause();\n setIsPlaying(false);\n return true;\n }\n\n return tryPlayCurrentAudio(`start-segment:${_reason}`);\n },\n [\n canStartPlaybackAutomatically,\n getSegmentSrc,\n tryPlayCurrentAudio,\n updateLoading,\n ]\n );\n\n const finishAudioItem = useCallback(\n (_reason?: string) => {\n pendingAutoPlayRef.current = false;\n isWaitingForSegmentRef.current = false;\n isSwitchingSegmentRef.current = false;\n setIsPlaying(false);\n updateLoading(false);\n\n if (currentAudioIndex >= 0) {\n onEnded?.(currentAudioIndex);\n }\n },\n [currentAudioIndex, onEnded, updateLoading]\n );\n\n const handleSegmentEnded = useCallback(() => {\n const nextSegmentIndex = currentSegmentIndexRef.current + 1;\n const segments = currentAudioSegmentsRef.current;\n const nextSegment = segments[nextSegmentIndex];\n const activeAudio = currentAudioRef.current;\n const hasFinal = segments.some((segment) => segment.is_final);\n\n if (nextSegment) {\n startSegmentPlayback(nextSegmentIndex, \"ended\");\n return;\n }\n\n if (activeAudio?.isAudioStreaming || !hasFinal) {\n currentSegmentIndexRef.current = nextSegmentIndex;\n waitingSegmentIndexRef.current = nextSegmentIndex;\n isWaitingForSegmentRef.current = true;\n pendingAutoPlayRef.current = defaultPlaying;\n setIsPlaying(false);\n updateLoading(true);\n\n return;\n }\n\n finishAudioItem(\"segments-completed\");\n }, [defaultPlaying, finishAudioItem, startSegmentPlayback, updateLoading]);\n\n useEffect(() => {\n if (currentAudioKeyRef.current === currentAudioKey) {\n return;\n }\n\n currentAudioKeyRef.current = currentAudioKey;\n currentSegmentIndexRef.current = 0;\n waitingSegmentIndexRef.current = null;\n isWaitingForSegmentRef.current = false;\n isPausedByUserRef.current = false;\n pendingAutoPlayRef.current = false;\n isSwitchingSegmentRef.current = false;\n activeSourceTypeRef.current = null;\n audioSrcRef.current = null;\n updateLoading(false);\n\n const audioElement = audioRef.current;\n\n if (!audioElement) {\n return;\n }\n\n audioElement.pause();\n audioElement.removeAttribute(\"src\");\n audioElement.load();\n setIsPlaying(false);\n }, [\n currentAudioIndex,\n currentAudioKey,\n currentAudioSegments.length,\n currentAudioUrl,\n updateLoading,\n ]);\n\n useEffect(() => {\n const audioElement = audioRef.current;\n\n if (!audioElement) {\n return;\n }\n\n if (!currentAudio) {\n resetAudio();\n return;\n }\n\n if (currentAudioUrl) {\n const hasNewSrc = audioSrcRef.current !== currentAudioUrl;\n const shouldAutoResume = canStartPlaybackAutomatically();\n const shouldKeepSegmentSource =\n activeSourceTypeRef.current === \"segment\" &&\n Boolean(audioSrcRef.current) &&\n waitingSegmentIndexRef.current === null;\n\n if (shouldKeepSegmentSource) {\n if (!shouldAutoResume) {\n pendingAutoPlayRef.current = false;\n audioElement.pause();\n setIsPlaying(false);\n return;\n }\n\n if (audioElement.paused) {\n pendingAutoPlayRef.current = true;\n tryPlayCurrentAudio(\"keep-segment-source\");\n }\n\n return;\n }\n\n if (hasNewSrc) {\n const nextSeekTime =\n waitingSegmentIndexRef.current !== null\n ? getWaitingSegmentSeekTime()\n : 0;\n\n audioElement.pause();\n audioElement.removeAttribute(\"src\");\n audioElement.load();\n audioSrcRef.current = currentAudioUrl;\n activeSourceTypeRef.current = \"url\";\n audioElement.src = currentAudioUrl;\n audioElement.load();\n pendingSeekTimeRef.current = nextSeekTime;\n\n if (audioElement.readyState > 0) {\n audioElement.currentTime = nextSeekTime;\n pendingSeekTimeRef.current = null;\n }\n }\n\n pendingAutoPlayRef.current = shouldAutoResume;\n isWaitingForSegmentRef.current = false;\n isSwitchingSegmentRef.current = false;\n updateLoading(false);\n\n if (!shouldAutoResume) {\n pendingAutoPlayRef.current = false;\n audioElement.pause();\n setIsPlaying(false);\n return;\n }\n\n tryPlayCurrentAudio(hasNewSrc ? \"sync-url-init\" : \"sync-url\");\n return;\n }\n\n if (waitingSegmentIndexRef.current !== null) {\n if (waitingSegmentIndexRef.current < currentAudioSegments.length) {\n if (isPausedByUserRef.current) {\n setIsPlaying(false);\n updateLoading(false);\n return;\n }\n\n startSegmentPlayback(waitingSegmentIndexRef.current, \"wait-resume\");\n return;\n }\n\n isWaitingForSegmentRef.current = true;\n pendingAutoPlayRef.current = canStartPlaybackAutomatically();\n setIsPlaying(false);\n updateLoading(canStartPlaybackAutomatically());\n return;\n }\n\n if (!currentAudioSegments.length) {\n if (currentAudio.isAudioStreaming) {\n waitingSegmentIndexRef.current = currentSegmentIndexRef.current;\n isWaitingForSegmentRef.current = true;\n pendingAutoPlayRef.current = canStartPlaybackAutomatically();\n setIsPlaying(false);\n updateLoading(canStartPlaybackAutomatically());\n return;\n }\n\n resetAudio();\n return;\n }\n\n if (!audioSrcRef.current) {\n startSegmentPlayback(\n Math.min(\n currentSegmentIndexRef.current,\n currentAudioSegments.length - 1\n ),\n \"effect-init\"\n );\n return;\n }\n\n if (!defaultPlaying || isPausedByUserRef.current) {\n pendingAutoPlayRef.current = false;\n audioElement.pause();\n setIsPlaying(false);\n return;\n }\n\n if (audioElement.paused) {\n pendingAutoPlayRef.current = true;\n tryPlayCurrentAudio(\"sync-paused-retry\");\n }\n }, [\n currentAudio,\n currentAudioIndex,\n currentAudioSegments,\n currentAudioUrl,\n defaultPlaying,\n canStartPlaybackAutomatically,\n resetAudio,\n startSegmentPlayback,\n tryPlayCurrentAudio,\n getWaitingSegmentSeekTime,\n updateLoading,\n ]);\n\n useEffect(() => resetAudio, [resetAudio]);\n\n const handleAudioPlay = useCallback(() => {\n setIsPlaying(true);\n updateLoading(false);\n }, [updateLoading]);\n\n const handleAudioPause = useCallback(() => {\n if (isWaitingForSegmentRef.current || isSwitchingSegmentRef.current) {\n return;\n }\n\n setIsPlaying(false);\n }, [currentAudioIndex]);\n\n const handleAudioCanPlay = useCallback(() => {\n const audioElement = audioRef.current;\n\n if (audioElement && pendingSeekTimeRef.current !== null) {\n audioElement.currentTime = pendingSeekTimeRef.current;\n pendingSeekTimeRef.current = null;\n }\n\n if (!pendingAutoPlayRef.current || !defaultPlaying) {\n return;\n }\n\n tryPlayCurrentAudio(\"canplay\");\n }, [currentAudioIndex, defaultPlaying, tryPlayCurrentAudio]);\n\n const handleLoadedMetadata = useCallback(() => {\n const audioElement = audioRef.current;\n\n if (audioElement && pendingSeekTimeRef.current !== null) {\n audioElement.currentTime = pendingSeekTimeRef.current;\n pendingSeekTimeRef.current = null;\n }\n }, [currentAudioIndex]);\n\n const handleAudioEnded = useCallback(() => {\n const shouldFinishAsUrl =\n activeSourceTypeRef.current === \"url\" ||\n currentAudioSegmentsRef.current.length === 0;\n\n isSwitchingSegmentRef.current = false;\n\n if (shouldFinishAsUrl) {\n finishAudioItem(\"url-ended\");\n return;\n }\n\n handleSegmentEnded();\n }, [finishAudioItem, handleSegmentEnded]);\n\n const handleAudioError = useCallback(() => {\n setIsPlaying(false);\n updateLoading(false);\n }, [updateLoading]);\n\n return (\n <div className={cn(\"slide-player\", className)} {...props}>\n <audio\n ref={audioRef}\n preload=\"auto\"\n playsInline\n onLoadedMetadata={handleLoadedMetadata}\n onCanPlay={handleAudioCanPlay}\n onPlay={handleAudioPlay}\n onPause={handleAudioPause}\n onEnded={handleAudioEnded}\n onError={handleAudioError}\n />\n\n {showControls ? (\n <div className=\"slide-player__controls\" style={controlsStyle}>\n <div className=\"slide-player__group\">\n <button aria-label=\"More options\" className=\"hidden\" type=\"button\">\n <EllipsisVertical\n className=\"slide-player__icon\"\n strokeWidth={2.25}\n />\n </button>\n <button aria-label=\"Volume\" className=\"hidden\" type=\"button\">\n <Volume2 className=\"slide-player__icon\" strokeWidth={2.25} />\n </button>\n <button\n aria-label=\"Rewind\"\n className=\"slide-player__action\"\n disabled={prevDisabled}\n onClick={onPrev}\n type=\"button\"\n >\n <RotateCcw className=\"slide-player__icon\" strokeWidth={2.25} />\n </button>\n <button\n aria-label={isPlaying ? \"Pause\" : \"Play\"}\n className=\"slide-player__toggle\"\n onClick={() => {\n const audioElement = audioRef.current;\n\n if (!audioElement || !currentAudio) {\n return;\n }\n\n if (waitingSegmentIndexRef.current !== null) {\n if (isPlaying) {\n pendingAutoPlayRef.current = false;\n isPausedByUserRef.current = true;\n waitingSegmentIndexRef.current = null;\n isWaitingForSegmentRef.current = false;\n setIsPlaying(false);\n updateLoading(false);\n audioElement.pause();\n return;\n }\n\n playbackAccessModeRef.current = \"manual\";\n isPausedByUserRef.current = false;\n pendingAutoPlayRef.current = true;\n updateLoading(true);\n return;\n }\n\n if (!audioElement.src && currentAudioSegments.length > 0) {\n playbackAccessModeRef.current = \"manual\";\n isPausedByUserRef.current = false;\n startSegmentPlayback(\n Math.min(\n currentSegmentIndexRef.current,\n currentAudioSegments.length - 1\n ),\n \"toggle\"\n );\n return;\n }\n\n if (audioElement.paused) {\n playbackAccessModeRef.current = \"manual\";\n isPausedByUserRef.current = false;\n pendingAutoPlayRef.current = true;\n tryPlayCurrentAudio(\"toggle-resume\");\n return;\n }\n\n pendingAutoPlayRef.current = false;\n isPausedByUserRef.current = true;\n audioElement.pause();\n }}\n type=\"button\"\n >\n {isPlaying ? <PauseIcon /> : <PlayIcon />}\n </button>\n <button\n aria-label=\"Forward\"\n className=\"slide-player__action\"\n disabled={nextDisabled}\n onClick={onNext}\n type=\"button\"\n >\n <RotateCw className=\"slide-player__icon\" strokeWidth={2.25} />\n </button>\n <button\n aria-label=\"Fullscreen\"\n className=\"hidden\"\n onClick={onFullscreen}\n type=\"button\"\n >\n <Maximize className=\"slide-player__icon\" strokeWidth={2.25} />\n </button>\n </div>\n\n <div className=\"slide-player__separator\" />\n\n <div className=\"slide-player__group\">\n {customActionList.map((customAction, customActionIndex) => (\n <React.Fragment key={`custom-action-${customActionIndex}`}>\n {customAction}\n </React.Fragment>\n ))}\n <button\n aria-label=\"Notes\"\n className={cn(\n \"slide-player__action\",\n isInteractionOpen && \"slide-player__action--active\"\n )}\n disabled={!hasInteraction}\n onClick={onInteractionToggle}\n type=\"button\"\n >\n <FilePenLine className=\"slide-player__icon\" strokeWidth={2.25} />\n </button>\n </div>\n </div>\n ) : null}\n </div>\n );\n};\n\nexport default Player;\n"],"names":["audioPreloadElementCache","preloadAudioUrl","url","audio","PauseIcon","jsxs","jsx","PlayIcon","Player","audioList","className","currentAudioIndex","defaultPlaying","onLoadingChange","onPrev","onNext","onFullscreen","onEnded","onInteractionToggle","hasInteraction","isInteractionOpen","prevDisabled","nextDisabled","showControls","customActions","props","audioRef","useRef","audioSrcRef","currentAudioKeyRef","currentSegmentIndexRef","waitingSegmentIndexRef","currentAudioRef","currentAudioSegmentsRef","isLoadingRef","isPausedByUserRef","activeSourceTypeRef","isWaitingForSegmentRef","pendingAutoPlayRef","pendingSeekTimeRef","isSwitchingSegmentRef","playbackAccessModeRef","isPlaying","setIsPlaying","useState","currentAudio","currentAudioUrl","currentAudioSegments","useMemo","prevSegment","nextSegment","customActionList","toPlayerCustomActionList","mobileVisibleActionCount","controlsStyle","currentAudioKey","useEffect","currentUrl","nextUrl","updateLoading","useCallback","loading","isAutoplayBlockedError","error","canStartPlaybackAutomatically","getSegmentSrc","audioData","getWaitingSegmentSeekTime","waitingSegmentIndex","totalDurationMs","segment","resetAudio","audioElement","tryPlayCurrentAudio","_reason","playPromise","startSegmentPlayback","segmentIndex","nextAudioSrc","shouldAutoResume","hasNewSrc","finishAudioItem","handleSegmentEnded","nextSegmentIndex","segments","activeAudio","hasFinal","nextSeekTime","handleAudioPlay","handleAudioPause","handleAudioCanPlay","handleLoadedMetadata","handleAudioEnded","shouldFinishAsUrl","handleAudioError","cn","EllipsisVertical","Volume2","RotateCcw","RotateCw","Maximize","customAction","customActionIndex","React","FilePenLine"],"mappings":"myCAqBMA,MAA+B,IAE/BC,EAAmBC,GAAiB,CAKxC,GAJI,OAAO,OAAW,KAAe,CAACA,GAIlCF,EAAyB,IAAIE,CAAG,EAClC,OAKF,MAAMC,EAAQ,OAAO,SAAS,cAAc,OAAO,EACnDA,EAAM,QAAU,OAChBA,EAAM,aAAa,cAAe,MAAM,EACxCA,EAAM,IAAMD,EACZC,EAAM,KAAA,EAENH,EAAyB,IAAIE,EAAKC,CAAK,CACzC,EAoBMC,GAAY,I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AEL,SAAAT,EAAAA,kBAAAA,IAAC6F,WAAA,CAAS,UAAU,qBAAqB,YAAa,IAAA,CAAM,CAAA,CAAA,EAE9D7F,EAAAA,kBAAAA,IAAC,SAAA,CACC,aAAW,aACX,UAAU,SACV,QAASU,EACT,KAAK,SAEL,SAAAV,EAAAA,kBAAAA,IAAC8F,WAAA,CAAS,UAAU,qBAAqB,YAAa,IAAA,CAAM,CAAA,CAAA,CAC9D,EACF,EAEA9F,EAAAA,kBAAAA,IAAC,MAAA,CAAI,UAAU,yBAAA,CAA0B,EAEzCD,EAAAA,kBAAAA,KAAC,MAAA,CAAI,UAAU,sBACZ,SAAA,CAAA8C,EAAiB,IAAI,CAACkD,EAAcC,IACnChG,EAAAA,kBAAAA,IAACiG,EAAM,SAAN,CACE,SAAAF,CAAA,EADkB,iBAAiBC,CAAiB,EAEvD,CACD,EACDhG,EAAAA,kBAAAA,IAAC,SAAA,CACC,aAAW,QACX,UAAWyF,EAAAA,GACT,uBACA3E,IAAqB,8BAAA,EAEvB,SAAU,CAACD,GACX,QAASD,GACT,KAAK,SAEL,SAAAZ,EAAAA,kBAAAA,IAACkG,WAAA,CAAY,UAAU,qBAAqB,YAAa,IAAA,CAAM,CAAA,CAAA,CACjE,CAAA,CACF,CAAA,CAAA,CACF,EACE,IAAA,EACN,CAEJ"}
@@ -1,20 +1,21 @@
1
1
  import { default as React } from 'react';
2
2
  import { SlideAudioItem } from './useSlide';
3
- export type PlayerProps = React.ComponentProps<"div"> & {
3
+ export type PlayerProps = Omit<React.ComponentProps<"div">, "onEnded"> & {
4
4
  audioList?: SlideAudioItem[];
5
5
  currentAudioIndex?: number;
6
6
  defaultPlaying?: boolean;
7
+ onLoadingChange?: (loading: boolean) => void;
7
8
  onPrev?: () => void;
8
9
  onNext?: () => void;
9
10
  onFullscreen?: () => void;
10
11
  onEnded?: (audioIndex: number) => void;
11
- onPlayRequest?: () => void;
12
12
  onInteractionToggle?: () => void;
13
13
  hasInteraction?: boolean;
14
14
  isInteractionOpen?: boolean;
15
15
  prevDisabled?: boolean;
16
16
  nextDisabled?: boolean;
17
17
  showControls?: boolean;
18
+ customActions?: React.ReactNode;
18
19
  };
19
20
  declare const Player: React.FC<PlayerProps>;
20
21
  export default Player;