showai-reader 0.9.0-reader.x77hhf3w → 0.9.0-reader.yla6qncv

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 (31) hide show
  1. package/README.md +1 -1
  2. package/chunks/{ComparisonMatrix-KTLR7NQV.js → ComparisonMatrix-PQNUZGEW.js} +1 -1
  3. package/chunks/{ExperimentTracker-JWWECSJR.js → ExperimentTracker-S2OQ2C65.js} +1 -1
  4. package/chunks/{ExternalDiagram-VNWAO35E.js → ExternalDiagram-RGCSIRGU.js} +3156 -767
  5. package/chunks/{Flowchart-BOY3JGQF.js → Flowchart-UMAF7GBA.js} +2 -2
  6. package/chunks/{G2Chart-M63242NG.js → G2Chart-TYEBYCPM.js} +2 -2
  7. package/chunks/{Mindmap-WERZLYP6.js → Mindmap-WRLKGZQL.js} +1 -1
  8. package/chunks/{RichTextEditor-3PQXABDI.js → RichTextEditor-ZYPMWGYW.js} +43 -43
  9. package/chunks/{Scene3D-WNBIE7LS.js → Scene3D-ZRKLP6L2.js} +2 -2
  10. package/chunks/{StatusTree-JVEVAYO5.js → StatusTree-S2BDN3CS.js} +1 -1
  11. package/chunks/{chunk-UHMLBB4O.js → chunk-AX4UNHCV.js} +3 -3
  12. package/chunks/chunk-EM2ABYID.js +1 -0
  13. package/chunks/{chunk-NPT6AF6K.js → chunk-KPBPXRFN.js} +2 -2
  14. package/chunks/{chunk-GNOF6PGV.js → chunk-LXTHC47J.js} +1 -1
  15. package/chunks/{chunk-QIGHBYK6.js → chunk-TLUHKHNU.js} +1 -1
  16. package/chunks/chunk-UQOH5VCX.js +21 -0
  17. package/chunks/{chunk-CMJMBEIC.js.LEGAL.txt → chunk-UQOH5VCX.js.LEGAL.txt} +2 -0
  18. package/chunks/{chunk-HHKKCN2F.js → chunk-UX7WTGG7.js} +1 -1
  19. package/chunks/{chunk-J7ZODHSI.js → chunk-VB5ICXSF.js} +1 -1
  20. package/index.js +1 -1
  21. package/manifest.json +4 -4
  22. package/package.json +1 -1
  23. package/reader-YLA6QNCV.js +41 -0
  24. package/chunks/chunk-CMJMBEIC.js +0 -21
  25. package/chunks/chunk-QBNRB4AJ.js +0 -1
  26. package/reader-X77HHF3W.js +0 -41
  27. /package/chunks/{Flowchart-BOY3JGQF.js.LEGAL.txt → Flowchart-UMAF7GBA.js.LEGAL.txt} +0 -0
  28. /package/chunks/{G2Chart-M63242NG.js.LEGAL.txt → G2Chart-TYEBYCPM.js.LEGAL.txt} +0 -0
  29. /package/chunks/{Scene3D-WNBIE7LS.js.LEGAL.txt → Scene3D-ZRKLP6L2.js.LEGAL.txt} +0 -0
  30. /package/chunks/{chunk-NPT6AF6K.js.LEGAL.txt → chunk-KPBPXRFN.js.LEGAL.txt} +0 -0
  31. /package/{reader-X77HHF3W.js.LEGAL.txt → reader-YLA6QNCV.js.LEGAL.txt} +0 -0
@@ -1,2 +1,2 @@
1
- import{a as S,b as X,c as O,d as he,e as fe,f as ge,g as ye,h as we}from"./chunk-DG67SWQA.js";import{a as ve}from"./chunk-GNOF6PGV.js";import{d as Ne,e as Ce}from"./chunk-J7ZODHSI.js";import{Ba as A,Fa as ce,a as ae,ab as ue,bb as pe,c as Te,db as me,ib as be,ka as re,lb as ke,pa as se,ra as le,va as de,z as ie}from"./chunk-CMJMBEIC.js";import{c as W,d as xe}from"./chunk-DUIGVKKG.js";var r=W(Te(),1);var Le=xe("mindmap",{"zh-CN":{mindmap:"\u601D\u7EF4\u5BFC\u56FE",enterNodeName:"\u8BF7\u8F93\u5165\u8282\u70B9\u540D\u79F0\u3002",nodeLimit:"\u601D\u7EF4\u5BFC\u56FE\u6700\u591A\u652F\u6301 {count} \u4E2A\u8282\u70B9\u3002",radialLayout:"\u56DB\u5468\u5C55\u5F00",treeLayout:"\u5355\u5411\u5C55\u5F00","treeLayout.right":"\u5355\u5411\u5C55\u5F00\uFF0C\u5F53\u524D\u5411\u53F3","treeLayout.left":"\u5355\u5411\u5C55\u5F00\uFF0C\u5F53\u524D\u5411\u5DE6","treeLayout.rightToggle":"\u5355\u5411\u5C55\u5F00\uFF0C\u5F53\u524D\u5411\u53F3\uFF1B\u518D\u6B21\u70B9\u51FB\u5207\u6362\u5411\u5DE6","treeLayout.leftToggle":"\u5355\u5411\u5C55\u5F00\uFF0C\u5F53\u524D\u5411\u5DE6\uFF1B\u518D\u6B21\u70B9\u51FB\u5207\u6362\u5411\u53F3",nodes:"\u5BFC\u56FE\u8282\u70B9",nodeName:"\u8282\u70B9\u540D\u79F0",view:"\u601D\u7EF4\u5BFC\u56FE\u89C6\u56FE",zoomOut:"\u7F29\u5C0F\u601D\u7EF4\u5BFC\u56FE",fit:"\u663E\u793A\u5B8C\u6574\u601D\u7EF4\u5BFC\u56FE",zoomIn:"\u653E\u5927\u601D\u7EF4\u5BFC\u56FE",nodeActions:"\u601D\u7EF4\u5BFC\u56FE\u8282\u70B9\u64CD\u4F5C",editNode:"\u7F16\u8F91\u8282\u70B9",newChild:"\u65B0\u5EFA\u5B50\u8282\u70B9",child:"\u5B50\u8282\u70B9",newSibling:"\u65B0\u5EFA\u540C\u7EA7\u8282\u70B9",sibling:"\u540C\u7EA7",expandBranch:"\u5C55\u5F00\u5206\u652F",collapseBranch:"\u6298\u53E0\u5206\u652F",toggleBranch:"\u6298\u53E0 / \u5C55\u5F00",undoAction:"\u64A4\u9500\u5BFC\u56FE\u64CD\u4F5C",undo:"\u64A4\u9500",redoAction:"\u91CD\u505A\u5BFC\u56FE\u64CD\u4F5C",redo:"\u91CD\u505A",deleteNodeAndChildren:"\u5220\u9664\u8282\u70B9\u53CA\u5176\u5B50\u8282\u70B9",deleteBranch:"\u5220\u9664\u5206\u652F"},en:{mindmap:"Mind map",enterNodeName:"Enter a node name.",nodeLimit:"A mind map can have up to {count} nodes.",radialLayout:"Radial layout",treeLayout:"One-way layout","treeLayout.right":"One-way layout, currently to the right","treeLayout.left":"One-way layout, currently to the left","treeLayout.rightToggle":"One-way layout, currently to the right. Click again to switch to the left.","treeLayout.leftToggle":"One-way layout, currently to the left. Click again to switch to the right.",nodes:"Mind map nodes",nodeName:"Node name",view:"Mind map view",zoomOut:"Zoom out mind map",fit:"Show entire mind map",zoomIn:"Zoom in mind map",nodeActions:"Mind map node actions",editNode:"Edit node",newChild:"New child node",child:"Child",newSibling:"New sibling node",sibling:"Sibling",expandBranch:"Expand branch",collapseBranch:"Collapse branch",toggleBranch:"Collapse / expand",undoAction:"Undo mind map change",undo:"Undo",redoAction:"Redo mind map change",redo:"Redo",deleteNodeAndChildren:"Delete node and its children",deleteBranch:"Delete branch"}});ae(`.sm-block{position:relative}.sm-viewport{overflow:auto;overscroll-behavior-x:contain;border-radius:8px;background:radial-gradient(var(--sb-line) .6px,transparent .6px) 0 0 / 20px 20px}.sm-scroll-space{position:relative;display:flex;justify-content:center;align-items:center}.sm-map{position:absolute;flex:none;transform-origin:top left}.sm-connections{position:absolute;inset:0;width:100%!important;height:100%!important;overflow:visible;pointer-events:none}.sm-connections path{fill:none;stroke:var(--sm-branch);stroke-width:2;opacity:.7}.sm-branch-0{--sm-branch: #5f8b78}.sm-branch-1{--sm-branch: #6b89b7}.sm-branch-2{--sm-branch: #c38b55}.sm-branch-3{--sm-branch: #ab7890}.sm-branch-4{--sm-branch: #8580b5}.sm-branch-5{--sm-branch: #789c9f}.sm-node-wrap{position:absolute}.sm-block .sm-node,.sm-block .sm-node-input{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:var(--sm-node-height);padding:10px 16px;border:1.5px solid var(--sm-branch, var(--sb-accent));border-radius:9px;background:var(--sb-surface);color:var(--sb-text);font:inherit;font-size:14px;line-height:20px;text-align:center;box-shadow:0 2px 8px #00000005}.sm-node span:first-child{overflow-wrap:anywhere;white-space:pre-wrap}.sm-node:hover{background:color-mix(in srgb,var(--sm-branch, var(--sb-accent)) 8%,var(--sb-surface))}.sm-node.is-selected,.sm-node:focus-visible,.sm-node-input:focus{outline:3px solid color-mix(in srgb,var(--sm-branch, var(--sb-accent)) 30%,transparent);outline-offset:3px}.sm-root .sm-node{background:var(--sb-accent);color:var(--sb-surface);border-color:var(--sb-accent);font-weight:600}.sm-count{flex:none;font-size:11px;border-radius:4px;padding:1px 4px;background:var(--sb-soft);color:var(--sb-muted)}.sm-footer{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:10px 2px 0;color:var(--sb-muted);font-size:11px}.sm-view-controls{display:flex;flex:none;gap:2px}.sm-view-controls button{display:flex;align-items:center;justify-content:center;gap:6px;min-width:28px;height:28px;border-radius:4px}.sm-view-controls button:hover{background:var(--sb-soft)}.sm-notice{color:var(--sb-accent);font-size:12px}@media print{.sm-footer,.sm-notice{display:none}.sm-viewport{overflow:visible;background:none}}.sm-block .sm-root .sm-node:hover{background:var(--sb-accent);color:var(--sb-surface)}.editor-bubble[data-editor-keyboard-scope=mindmap]{--editor-line: var(--line);--editor-soft: var(--accent-soft);font-family:var( --font-sans, -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif );font-size:12px;font-weight:400;line-height:1;letter-spacing:0}.editor-bubble[data-editor-keyboard-scope=mindmap] .editor-tool{font:inherit}.editor-bubble[data-editor-keyboard-scope=mindmap] .sm-labeled-action{width:auto;padding:0 7px;gap:4px;color:var(--text);white-space:nowrap}.editor-bubble[data-editor-keyboard-scope=mindmap] .editor-tool svg{display:block;flex:none}.sm-block>.sb-header>.sb-actions{flex-wrap:nowrap;gap:2px;border:1px solid var(--sb-line);box-shadow:0 2px 8px #00000008;pointer-events:none}.sm-block:hover>.sb-header>.sb-actions,.sm-block>.sb-header>.sb-actions:focus-within{opacity:1;pointer-events:auto}.sm-block>.sb-header.has-caption>.sb-heading{padding-right:78px}.sm-block .sb-actions .sb-icon-button[aria-pressed=true]{color:var(--sb-accent);background:var(--sb-accent-soft)}body:has([role=menu]) .sm-block>.sb-header>.sb-actions{opacity:0;pointer-events:none}@media(hover:none){.sm-block>.sb-header>.sb-actions{opacity:1;pointer-events:auto}}@media print{.sm-block>.sb-header>.sb-actions{display:none}}
1
+ import{a as S,b as X,c as O,d as he,e as fe,f as ge,g as ye,h as we}from"./chunk-DG67SWQA.js";import{a as ve}from"./chunk-LXTHC47J.js";import{d as Ne,e as Ce}from"./chunk-VB5ICXSF.js";import{A as ie,Da as A,Ha as ce,a as ae,c as Te,cb as ue,db as pe,fb as me,kb as be,ma as re,nb as ke,ra as se,ta as le,xa as de}from"./chunk-UQOH5VCX.js";import{c as W,d as xe}from"./chunk-DUIGVKKG.js";var r=W(Te(),1);var Le=xe("mindmap",{"zh-CN":{mindmap:"\u601D\u7EF4\u5BFC\u56FE",enterNodeName:"\u8BF7\u8F93\u5165\u8282\u70B9\u540D\u79F0\u3002",nodeLimit:"\u601D\u7EF4\u5BFC\u56FE\u6700\u591A\u652F\u6301 {count} \u4E2A\u8282\u70B9\u3002",radialLayout:"\u56DB\u5468\u5C55\u5F00",treeLayout:"\u5355\u5411\u5C55\u5F00","treeLayout.right":"\u5355\u5411\u5C55\u5F00\uFF0C\u5F53\u524D\u5411\u53F3","treeLayout.left":"\u5355\u5411\u5C55\u5F00\uFF0C\u5F53\u524D\u5411\u5DE6","treeLayout.rightToggle":"\u5355\u5411\u5C55\u5F00\uFF0C\u5F53\u524D\u5411\u53F3\uFF1B\u518D\u6B21\u70B9\u51FB\u5207\u6362\u5411\u5DE6","treeLayout.leftToggle":"\u5355\u5411\u5C55\u5F00\uFF0C\u5F53\u524D\u5411\u5DE6\uFF1B\u518D\u6B21\u70B9\u51FB\u5207\u6362\u5411\u53F3",nodes:"\u5BFC\u56FE\u8282\u70B9",nodeName:"\u8282\u70B9\u540D\u79F0",view:"\u601D\u7EF4\u5BFC\u56FE\u89C6\u56FE",zoomOut:"\u7F29\u5C0F\u601D\u7EF4\u5BFC\u56FE",fit:"\u663E\u793A\u5B8C\u6574\u601D\u7EF4\u5BFC\u56FE",zoomIn:"\u653E\u5927\u601D\u7EF4\u5BFC\u56FE",nodeActions:"\u601D\u7EF4\u5BFC\u56FE\u8282\u70B9\u64CD\u4F5C",editNode:"\u7F16\u8F91\u8282\u70B9",newChild:"\u65B0\u5EFA\u5B50\u8282\u70B9",child:"\u5B50\u8282\u70B9",newSibling:"\u65B0\u5EFA\u540C\u7EA7\u8282\u70B9",sibling:"\u540C\u7EA7",expandBranch:"\u5C55\u5F00\u5206\u652F",collapseBranch:"\u6298\u53E0\u5206\u652F",toggleBranch:"\u6298\u53E0 / \u5C55\u5F00",undoAction:"\u64A4\u9500\u5BFC\u56FE\u64CD\u4F5C",undo:"\u64A4\u9500",redoAction:"\u91CD\u505A\u5BFC\u56FE\u64CD\u4F5C",redo:"\u91CD\u505A",deleteNodeAndChildren:"\u5220\u9664\u8282\u70B9\u53CA\u5176\u5B50\u8282\u70B9",deleteBranch:"\u5220\u9664\u5206\u652F"},en:{mindmap:"Mind map",enterNodeName:"Enter a node name.",nodeLimit:"A mind map can have up to {count} nodes.",radialLayout:"Radial layout",treeLayout:"One-way layout","treeLayout.right":"One-way layout, currently to the right","treeLayout.left":"One-way layout, currently to the left","treeLayout.rightToggle":"One-way layout, currently to the right. Click again to switch to the left.","treeLayout.leftToggle":"One-way layout, currently to the left. Click again to switch to the right.",nodes:"Mind map nodes",nodeName:"Node name",view:"Mind map view",zoomOut:"Zoom out mind map",fit:"Show entire mind map",zoomIn:"Zoom in mind map",nodeActions:"Mind map node actions",editNode:"Edit node",newChild:"New child node",child:"Child",newSibling:"New sibling node",sibling:"Sibling",expandBranch:"Expand branch",collapseBranch:"Collapse branch",toggleBranch:"Collapse / expand",undoAction:"Undo mind map change",undo:"Undo",redoAction:"Redo mind map change",redo:"Redo",deleteNodeAndChildren:"Delete node and its children",deleteBranch:"Delete branch"}});ae(`.sm-block{position:relative}.sm-viewport{overflow:auto;overscroll-behavior-x:contain;border-radius:8px;background:radial-gradient(var(--sb-line) .6px,transparent .6px) 0 0 / 20px 20px}.sm-scroll-space{position:relative;display:flex;justify-content:center;align-items:center}.sm-map{position:absolute;flex:none;transform-origin:top left}.sm-connections{position:absolute;inset:0;width:100%!important;height:100%!important;overflow:visible;pointer-events:none}.sm-connections path{fill:none;stroke:var(--sm-branch);stroke-width:2;opacity:.7}.sm-branch-0{--sm-branch: #5f8b78}.sm-branch-1{--sm-branch: #6b89b7}.sm-branch-2{--sm-branch: #c38b55}.sm-branch-3{--sm-branch: #ab7890}.sm-branch-4{--sm-branch: #8580b5}.sm-branch-5{--sm-branch: #789c9f}.sm-node-wrap{position:absolute}.sm-block .sm-node,.sm-block .sm-node-input{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:var(--sm-node-height);padding:10px 16px;border:1.5px solid var(--sm-branch, var(--sb-accent));border-radius:9px;background:var(--sb-surface);color:var(--sb-text);font:inherit;font-size:14px;line-height:20px;text-align:center;box-shadow:0 2px 8px #00000005}.sm-node span:first-child{overflow-wrap:anywhere;white-space:pre-wrap}.sm-node:hover{background:color-mix(in srgb,var(--sm-branch, var(--sb-accent)) 8%,var(--sb-surface))}.sm-node.is-selected,.sm-node:focus-visible,.sm-node-input:focus{outline:3px solid color-mix(in srgb,var(--sm-branch, var(--sb-accent)) 30%,transparent);outline-offset:3px}.sm-root .sm-node{background:var(--sb-accent);color:var(--sb-surface);border-color:var(--sb-accent);font-weight:600}.sm-count{flex:none;font-size:11px;border-radius:4px;padding:1px 4px;background:var(--sb-soft);color:var(--sb-muted)}.sm-footer{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:10px 2px 0;color:var(--sb-muted);font-size:11px}.sm-view-controls{display:flex;flex:none;gap:2px}.sm-view-controls button{display:flex;align-items:center;justify-content:center;gap:6px;min-width:28px;height:28px;border-radius:4px}.sm-view-controls button:hover{background:var(--sb-soft)}.sm-notice{color:var(--sb-accent);font-size:12px}@media print{.sm-footer,.sm-notice{display:none}.sm-viewport{overflow:visible;background:none}}.sm-block .sm-root .sm-node:hover{background:var(--sb-accent);color:var(--sb-surface)}.editor-bubble[data-editor-keyboard-scope=mindmap]{--editor-line: var(--line);--editor-soft: var(--accent-soft);font-family:var( --font-sans, -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif );font-size:12px;font-weight:400;line-height:1;letter-spacing:0}.editor-bubble[data-editor-keyboard-scope=mindmap] .editor-tool{font:inherit}.editor-bubble[data-editor-keyboard-scope=mindmap] .sm-labeled-action{width:auto;padding:0 7px;gap:4px;color:var(--text);white-space:nowrap}.editor-bubble[data-editor-keyboard-scope=mindmap] .editor-tool svg{display:block;flex:none}.sm-block>.sb-header>.sb-actions{flex-wrap:nowrap;gap:2px;border:1px solid var(--sb-line);box-shadow:0 2px 8px #00000008;pointer-events:none}.sm-block:hover>.sb-header>.sb-actions,.sm-block>.sb-header>.sb-actions:focus-within{opacity:1;pointer-events:auto}.sm-block>.sb-header.has-caption>.sb-heading{padding-right:78px}.sm-block .sb-actions .sb-icon-button[aria-pressed=true]{color:var(--sb-accent);background:var(--sb-accent-soft)}body:has([role=menu]) .sm-block>.sb-header>.sb-actions{opacity:0;pointer-events:none}@media(hover:none){.sm-block>.sb-header>.sb-actions{opacity:1;pointer-events:auto}}@media print{.sm-block>.sb-header>.sb-actions{display:none}}
2
2
  `);var t=W(be(),1);function Je({data:Z,onChange:R,readOnly:Me=!1}){let a=ke(Le),n=(0,r.useMemo)(()=>X(Z),[Z]),d=!Me&&!!R,L=n.nodes.find(e=>e.parentId===null),[i,M]=(0,r.useState)(L.id),[H,k]=(0,r.useState)(!1),[c,z]=(0,r.useState)(null),D=(0,r.useRef)(null),K=(0,r.useRef)(!0),[Ee,Se]=(0,r.useState)(null),[_,ze]=(0,r.useState)(null),f=!d&&_?.layout||n.layout||"radial",g=!d&&_?.direction||n.direction||"right",x=Ee??new Set(n.nodes.filter(e=>e.collapsed).map(e=>e.id)),u=(0,r.useMemo)(()=>ye({...n,layout:f,direction:g},x),[n,f,g,JSON.stringify([...x])]),[h,P]=(0,r.useState)(1),[q,$]=(0,r.useState)(null),G=(0,r.useRef)(null),E=(0,r.useRef)(null),v=(0,r.useRef)(null),N=(0,r.useRef)(new Map),U=(0,r.useId)(),p=(0,r.useRef)({past:[],future:[],expected:null}),[Q,F]=(0,r.useState)(""),y=n.nodes.find(e=>e.id===i)??L,Y=O(n,y.id).length>0,ee=()=>{let e=E.current;e&&P(Math.max(.15,Math.min(1,(e.clientWidth-20)/u.width,(e.clientHeight-20)/u.height)))};(0,r.useLayoutEffect)(ee,[f,g]),(0,r.useEffect)(()=>{let e=JSON.stringify(n);p.current.expected!==null&&p.current.expected!==e&&(p.current.past=[],p.current.future=[]),p.current.expected=e},[n]),(0,r.useEffect)(()=>{!u.nodes.some(e=>e.id===i)&&c?.id!==i&&M(L.id)},[u,i,L.id,c?.id]);let w=e=>{M(e),requestAnimationFrame(()=>{let o=N.current.get(e);o?.focus({preventScroll:!0}),o?.scrollIntoView({block:"nearest",inline:"nearest"})})};(0,r.useLayoutEffect)(()=>{c&&(v.current?.focus(),K.current?v.current?.select():v.current?.setSelectionRange(c.value.length,c.value.length),v.current?.scrollIntoView({block:"nearest",inline:"nearest"}))},[c?.id,n.nodes.length]),(0,r.useLayoutEffect)(()=>{if(!H||c||!d){$(null);return}let e=()=>{let s=N.current.get(i),l=E.current;if(!s||!l)return;let m=s.getBoundingClientRect(),b=l.getBoundingClientRect();$(m.bottom<b.top||m.top>b.bottom||m.right<b.left||m.left>b.right?null:{left:Math.max(b.left,Math.min(b.right,m.left+m.width/2)),top:Math.max(b.top,m.top)})};e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e);let o=new ResizeObserver(e);return E.current&&o.observe(E.current),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e),o.disconnect()}},[H,c,d,i,u,h]);let C=e=>{!d||e===n||(X(e),p.current.past=[...p.current.past.slice(-99),n],p.current.future=[],p.current.expected=JSON.stringify(e),F(""),R?.(e))},te=e=>{let o=e==="tree"&&f==="tree"?g==="right"?"left":"right":g;e===f&&o===g||(d?C({...n,layout:e,direction:o}):ze({layout:e,direction:o}))},I=(e=!1)=>{let s=(e?p.current.future:p.current.past).pop();!s||!d||((e?p.current.past:p.current.future).push(n),p.current.expected=JSON.stringify(s),R?.(s),w(s.nodes.some(l=>l.id===i)?i:L.id))},T=(e=i,o)=>{if(!d)return;let s=n.nodes.find(l=>l.id===e);s&&(D.current=e,K.current=o===void 0,$(null),z({id:e,value:o??s.label}))},J=(e=!1)=>{if(!c||D.current!==c.id)return;let o=c.value.trim();if(!e&&!o){F(a("enterNodeName")),v.current?.focus();return}D.current=null,z(null),!e&&o!==n.nodes.find(s=>s.id===c.id)?.label&&C({...n,nodes:n.nodes.map(s=>s.id===c.id?{...s,label:o}:s)}),w(c.id)},B=(e,o=!1)=>{if(!d)return;if(n.nodes.length>=S){F(a("nodeLimit",{count:S}));return}let s=crypto.randomUUID(),l=he(n,i,s,e,o);C(l),M(s),D.current=s,K.current=!0,z({id:s,value:l.nodes.find(m=>m.id===s).label})},ne=()=>{!d||y.parentId===null||(C(fe(n,i)),w(y.parentId))},V=()=>{if(!Y)return;let e=new Set(x);e.has(i)?e.delete(i):e.add(i),d?C({...n,nodes:n.nodes.map(o=>o.id===i?{...o,collapsed:e.has(i)}:o)}):Se(e),w(i)},De=e=>{if(e.nativeEvent.isComposing||e.keyCode===229||e.target.closest("input, .sm-view-controls"))return;let o=e.metaKey||e.ctrlKey,s=e.target.closest(".editor-bubble")?.id===U,l=e.target.closest(".sb-header .sb-actions");if(s||l?!o:!e.target.closest(".sm-node"))return;let m=!0;if(o&&e.key.toLowerCase()==="z"&&d)I(e.shiftKey);else if(o&&e.key.toLowerCase()==="y"&&d)I(!0);else if(o||e.altKey)m=!1;else if(e.key==="Tab"&&d&&!e.shiftKey)B("child");else if(e.key==="Tab"&&d&&e.shiftKey)C(ge(n,i)),w(i);else if(e.key==="Enter"&&d)B("sibling",e.shiftKey);else if(e.key==="F2"&&d)T();else if((e.key==="Delete"||e.key==="Backspace")&&d)ne();else if(e.key===" ")V();else if(e.key==="ArrowLeft")y.parentId&&w(y.parentId);else if(e.key==="ArrowRight")if(x.has(i))V();else{let b=O(n,i)[0];b&&w(b.id)}else if(e.key==="ArrowUp"||e.key==="ArrowDown"){let b=n.nodes.filter(j=>j.parentId===y.parentId),Ie=b.findIndex(j=>j.id===i),oe=b[Ie+(e.key==="ArrowUp"?-1:1)];oe&&w(oe.id)}else e.key==="Escape"?(k(!1),e.target.blur()):e.key.length===1&&d?T(i,e.key):m=!1;m&&(e.preventDefault(),e.stopPropagation())};return(0,t.jsxs)("section",{ref:G,className:"sb-block sm-block","aria-label":Ne(n.title,a("mindmap")),contentEditable:!1,"data-editor-keyboard-scope":"mindmap","data-mindmap-layout":f,"data-mindmap-direction":g,onClick:e=>e.stopPropagation(),onKeyDown:De,onFocus:e=>{e.target.closest(".sm-node, .sm-node-input")&&k(!0)},onBlur:e=>{!G.current?.contains(e.relatedTarget)&&!e.relatedTarget?.closest?.(`[id="${U}"]`)&&k(!1)},onContextMenu:()=>k(!1),children:[(0,t.jsxs)(Ce,{title:n.title,defaultTitle:"\u601D\u7EF4\u5BFC\u56FE",description:n.description,children:[(0,t.jsx)("button",{type:"button",className:"sb-icon-button","aria-label":a("radialLayout"),title:a("radialLayout"),"aria-pressed":f==="radial","data-surface-ui":!0,onMouseDown:e=>e.preventDefault(),onClick:()=>te("radial"),children:(0,t.jsx)(de,{size:16})}),(0,t.jsx)("button",{type:"button",className:"sb-icon-button","aria-label":a("treeLayout"),title:a(g==="right"?f==="tree"?"treeLayout.rightToggle":"treeLayout.right":f==="tree"?"treeLayout.leftToggle":"treeLayout.left"),"aria-pressed":f==="tree","data-surface-ui":!0,onMouseDown:e=>e.preventDefault(),onClick:()=>te("tree"),children:(0,t.jsx)(re,{size:16,style:{transform:g==="left"?"scaleX(-1)":void 0}})})]}),(0,t.jsx)("div",{ref:E,className:"sm-viewport",style:{height:n.height??460},children:(0,t.jsx)("div",{className:"sm-scroll-space",style:{width:u.width*h,height:u.height*h,minWidth:"100%",minHeight:"100%"},children:(0,t.jsxs)("div",{className:"sm-map",role:"tree","aria-label":a("nodes"),style:{width:u.width,height:u.height,transform:`scale(${h})`,left:`max(0px, calc(50% - ${u.width*h/2}px))`,top:`max(0px, calc(50% - ${u.height*h/2}px))`},children:[(0,t.jsx)("svg",{className:"sm-connections",width:u.width,height:u.height,"aria-hidden":"true",children:u.nodes.filter(e=>e.parentId).map(e=>{let o=u.nodes.find(s=>s.id===e.parentId);return(0,t.jsx)("path",{className:`sm-branch-${e.color}`,d:we(o,e)},e.id)})}),u.nodes.map(e=>{let o=O(n,e.id).length,s=c?.id===e.id;return(0,t.jsx)("div",{className:`sm-node-wrap sm-branch-${e.color}${e.parentId===null?" sm-root":""}`,style:{left:e.x,top:e.y,width:e.width,minHeight:e.height,"--sm-node-height":`${e.height}px`},children:s?(0,t.jsx)("input",{ref:v,className:"sm-node-input","aria-label":a("nodeName"),maxLength:200,value:c.value,onChange:l=>z({id:e.id,value:l.target.value}),onBlur:()=>J(),onKeyDown:l=>{l.stopPropagation(),!(l.nativeEvent.isComposing||l.keyCode===229)&&((l.key==="Enter"||l.key==="Tab")&&(l.preventDefault(),J()),l.key==="Escape"&&(l.preventDefault(),J(!0)))}}):(0,t.jsxs)("button",{type:"button",ref:l=>{l?N.current.set(e.id,l):N.current.delete(e.id)},className:`sm-node${H&&i===e.id?" is-selected":""}`,role:"treeitem","aria-level":e.depth+1,"aria-selected":i===e.id,"aria-expanded":o?!x.has(e.id):void 0,tabIndex:i===e.id?0:-1,onFocus:()=>M(e.id),onClick:l=>{l.currentTarget.focus({preventScroll:!0}),M(e.id),k(!0)},onDoubleClick:()=>T(e.id),children:[(0,t.jsx)("span",{children:e.label}),o>0&&x.has(e.id)&&(0,t.jsxs)("span",{className:"sm-count",children:["+",o]})]})},e.id)})]})})}),(0,t.jsx)("div",{className:"sm-footer",children:(0,t.jsxs)("div",{className:"sm-view-controls",role:"group","aria-label":a("view"),children:[(0,t.jsx)("button",{type:"button","aria-label":a("zoomOut"),disabled:h<=.15,onClick:()=>P(Math.max(.15,h/1.2)),children:(0,t.jsx)(le,{size:15})}),(0,t.jsxs)("button",{type:"button","aria-label":a("fit"),onClick:ee,children:[(0,t.jsx)(se,{size:15}),(0,t.jsxs)("span",{children:[Math.round(h*100),"%"]})]}),(0,t.jsx)("button",{type:"button","aria-label":a("zoomIn"),disabled:h>=2,onClick:()=>P(Math.min(2,h*1.2)),children:(0,t.jsx)(A,{size:15})})]})}),Q&&(0,t.jsx)("p",{role:"status",className:"sm-notice",children:Q}),q&&d&&!c&&(0,t.jsxs)(ve,{id:U,anchor:q,anchorElement:N.current.get(i),label:a("nodeActions"),keyboardScope:"mindmap",onEscape:()=>{k(!1),N.current.get(i)?.blur()},children:[(0,t.jsx)("button",{className:"editor-tool",type:"button","aria-label":a("editNode"),title:a("editNode"),onClick:()=>T(),children:(0,t.jsx)(pe,{size:16})}),(0,t.jsx)("span",{className:"toolbar-divider"}),(0,t.jsxs)("button",{className:"editor-tool sm-labeled-action",type:"button","aria-label":a("newChild"),title:a("newChild"),disabled:n.nodes.length>=S,onClick:()=>B("child"),children:[(0,t.jsx)(A,{size:16}),(0,t.jsx)("span",{children:a("child")})]}),(0,t.jsxs)("button",{className:"editor-tool sm-labeled-action",type:"button","aria-label":a("newSibling"),title:a("newSibling"),disabled:n.nodes.length>=S||y.parentId===null,onClick:()=>B("sibling"),children:[(0,t.jsx)(A,{size:16}),(0,t.jsx)("span",{children:a("sibling")})]}),(0,t.jsx)("button",{className:"editor-tool",type:"button","aria-label":x.has(i)?a("expandBranch"):a("collapseBranch"),title:a("toggleBranch"),disabled:!Y,onClick:V,children:(0,t.jsx)(ie,{size:16})}),(0,t.jsx)("button",{className:"editor-tool",type:"button","aria-label":a("undoAction"),title:a("undo"),disabled:!p.current.past.length,onClick:()=>I(),children:(0,t.jsx)(me,{size:16})}),(0,t.jsx)("button",{className:"editor-tool",type:"button","aria-label":a("redoAction"),title:a("redo"),disabled:!p.current.future.length,onClick:()=>I(!0),children:(0,t.jsx)(ce,{size:16})}),(0,t.jsx)("button",{className:"editor-tool",type:"button","aria-label":a("deleteNodeAndChildren"),title:a("deleteBranch"),disabled:y.parentId===null,onClick:ne,children:(0,t.jsx)(ue,{size:16})})]})]})}export{Je as MindmapBlock};