showai-reader 0.9.0-reader.q4ja4waa → 0.9.0-reader.rdnqa6s3
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.
- package/README.md +1 -1
- package/chunks/CardGrid-4J43EYBG.js +2 -0
- package/chunks/CommandReference-RURBETEE.js +3 -0
- package/chunks/{ComparisonMatrix-VW2IGVU5.js → ComparisonMatrix-3NPOV2C2.js} +1 -1
- package/chunks/EventTimeline-ZBPOWX5G.js +2 -0
- package/chunks/{ExperimentTracker-MGDLULUF.js → ExperimentTracker-M2MCK3T3.js} +1 -1
- package/chunks/{ExternalDiagram-GBZ7V5UE.js → ExternalDiagram-X2PKL6FZ.js} +1 -1
- package/chunks/Flowchart-DKB2L4BW.js +12 -0
- package/chunks/{G2Chart-7EVLDIBD.js → G2Chart-ZNQ2DX2B.js} +2 -2
- package/chunks/LayerDiagram-4K3MUVMX.js +2 -0
- package/chunks/{Mindmap-4KIEQIOX.js → Mindmap-W34T7QBH.js} +2 -2
- package/chunks/{RichTextEditor-3RHTXHKF.js → RichTextEditor-V22CLVIU.js} +1 -1
- package/chunks/Roadmap-XUE53GDT.js +2 -0
- package/chunks/{Scene3D-UGBYDVQQ.js → Scene3D-J4LQMEHU.js} +2 -2
- package/chunks/SequenceDiagram-OC62QNYE.js +2 -0
- package/chunks/{StatusTree-2D4NMGCP.js → StatusTree-XHA64Z6X.js} +1 -1
- package/chunks/StepGuide-L7B5BISR.js +1 -0
- package/chunks/StructureBrowser-V7D7T4IJ.js +3 -0
- package/chunks/Waterfall-QCPM23JB.js +2 -0
- package/chunks/chunk-3RZMLHCB.js +1 -0
- package/chunks/{chunk-ANLBEZ6Q.js → chunk-4S5THSYJ.js} +2 -2
- package/chunks/chunk-7KLWJ6U4.js +1 -0
- package/chunks/chunk-AIBH6MTQ.js +1 -0
- package/chunks/chunk-D74K2NKW.js +1 -0
- package/chunks/{chunk-YNCGN7XC.js → chunk-DY7XKPRY.js} +1 -1
- package/chunks/chunk-GLP5VV7P.js +1 -0
- package/chunks/chunk-JXKAISUX.js +1 -0
- package/chunks/{chunk-OQ6FTOA6.js → chunk-NF6YPAR6.js} +1 -1
- package/chunks/{chunk-YMCR7XS6.js → chunk-NIXNABQP.js} +1 -1
- package/chunks/chunk-NJBFXE6W.js +1 -0
- package/chunks/chunk-P3JIINVU.js +4 -0
- package/chunks/{chunk-3HD2PTWK.js → chunk-UXI4E4FN.js} +1 -1
- package/chunks/{chunk-IGVOXOPU.js → chunk-XCJENDJI.js} +1 -1
- package/chunks/chunk-YLTLOYBH.js +1 -0
- package/chunks/{chunk-KWOFOCF3.js → chunk-Z26LTCQQ.js} +3 -3
- package/index.js +1 -1
- package/manifest.json +5 -5
- package/package.json +1 -1
- package/reader-RDNQA6S3.js +46 -0
- package/chunks/Flowchart-LXZEZDKL.js +0 -10
- package/chunks/chunk-M3KEZP5Z.js +0 -1
- package/reader-Q4JA4WAA.js +0 -41
- package/chunks/{Flowchart-LXZEZDKL.js.LEGAL.txt → Flowchart-DKB2L4BW.js.LEGAL.txt} +0 -0
- package/chunks/{G2Chart-7EVLDIBD.js.LEGAL.txt → G2Chart-ZNQ2DX2B.js.LEGAL.txt} +0 -0
- package/chunks/{Scene3D-UGBYDVQQ.js.LEGAL.txt → Scene3D-J4LQMEHU.js.LEGAL.txt} +0 -0
- package/chunks/{chunk-ANLBEZ6Q.js.LEGAL.txt → chunk-4S5THSYJ.js.LEGAL.txt} +0 -0
- package/chunks/{chunk-KWOFOCF3.js.LEGAL.txt → chunk-Z26LTCQQ.js.LEGAL.txt} +1 -1
- /package/{reader-Q4JA4WAA.js.LEGAL.txt → reader-RDNQA6S3.js.LEGAL.txt} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as w}from"./chunk-7KLWJ6U4.js";import{a as A,b as v,d as L}from"./chunk-AIBH6MTQ.js";import"./chunk-D74K2NKW.js";import{d as R}from"./chunk-NF6YPAR6.js";import{a as M,c as C,lb as D,ob as E}from"./chunk-Z26LTCQQ.js";import{c as x,d as T}from"./chunk-DUIGVKKG.js";var n=x(C(),1);M(`.sb-block.ly-block :is(h3,h4,p,ul,ol,li,pre):not(svg){margin:0}.sb-block.ly-block li:not(svg){padding:0}.sb-block.ly-block pre:not(svg){border:0;border-radius:0;background:none;color:inherit}.sb-block.ly-block{--ly-text: var(--sb-text);--ly-muted: var(--sb-muted);--ly-faint: color-mix(in srgb, var(--sb-muted) 70%, transparent);--ly-line: var(--sb-line);--ly-paper: var(--sb-surface);--ly-soft: var(--sb-soft);--ly-accent: var(--sb-accent);--ly-accent-soft: var(--sb-accent-soft);--ly-teal: #0d8579;--ly-teal-soft: #e6f4f2;--ly-orange: #bf6528;--ly-orange-soft: #fbefe6;--ly-violet: #7348d0;--ly-violet-soft: #f2edfc;--ly-rose: #c4415a;--ly-rose-soft: #fbebee;--ly-slate: #526476;--ly-slate-soft: #edf1f4;--t: var(--ly-accent);--ts: var(--ly-accent-soft);color:var(--ly-text);font-family:inherit;font-size:14px;line-height:1.65;padding:8px 0;container-type:inline-size;overflow-wrap:anywhere}:root[data-theme=dark] .sb-block.ly-block,[data-theme=dark] .sb-block.ly-block{--ly-teal: #4fc4b6;--ly-teal-soft: #163734;--ly-orange: #e79c64;--ly-orange-soft: #3b2b1e;--ly-violet: #b497ff;--ly-violet-soft: #2e2648;--ly-rose: #f0839a;--ly-rose-soft: #3e222a;--ly-slate: #a2b2c2;--ly-slate-soft: #242d35}.sb-block.ly-block *{box-sizing:border-box}.sb-block.ly-block [data-tone=accent]{--t: var(--ly-accent);--ts: var(--ly-accent-soft)}.sb-block.ly-block [data-tone=teal]{--t: var(--ly-teal);--ts: var(--ly-teal-soft)}.sb-block.ly-block [data-tone=orange]{--t: var(--ly-orange);--ts: var(--ly-orange-soft)}.sb-block.ly-block [data-tone=violet]{--t: var(--ly-violet);--ts: var(--ly-violet-soft)}.sb-block.ly-block [data-tone=rose]{--t: var(--ly-rose);--ts: var(--ly-rose-soft)}.sb-block.ly-block [data-tone=slate]{--t: var(--ly-slate);--ts: var(--ly-slate-soft)}.sb-block.ly-block .ly-top{display:flex;align-items:baseline;justify-content:space-between;gap:16px;margin:0 0 10px}.sb-block.ly-block .ly-title{margin:0;font-size:16px;line-height:1.5;font-weight:650}.sb-block.ly-block .ly-caption{margin:0;font-size:13px;color:var(--ly-muted);line-height:1.6}.sb-block.ly-block .ly-hint{flex:none;font-size:12px;color:var(--ly-faint);white-space:nowrap}.sb-block.ly-block code{font-family:var(--mono, ui-monospace, Menlo, Consolas, monospace);font-size:.88em;background:var(--ly-soft);border-radius:4px;padding:1px 5px}.sb-block.ly-block .ly-band{display:grid;grid-template-columns:minmax(150px,200px) minmax(0,1fr);align-items:center;gap:20px;padding:14px 16px;border:1px solid var(--ly-line);border-radius:10px;background:var(--ly-soft);transition:border-color .18s ease}.sb-block.ly-block .ly-band[data-active]{border-color:color-mix(in srgb,var(--t) 45%,var(--ly-line))}.sb-block.ly-block .ly-head{display:flex;align-items:flex-start;gap:12px;min-width:0}.sb-block.ly-block .ly-index{flex:none;width:24px;height:24px;margin-top:1px;border-radius:6px;background:var(--ts);color:var(--t);font-size:12px;font-weight:650;line-height:24px;text-align:center;font-variant-numeric:tabular-nums}.sb-block.ly-block .ly-head h4{margin:0;font-size:15px;line-height:1.6;font-weight:650}.sb-block.ly-block .ly-head small{display:block;font-size:12px;line-height:1.5;color:var(--ly-muted)}.sb-block.ly-block .ly-modules{display:flex;flex-wrap:wrap;gap:8px}.sb-block.ly-block .ly-chip{display:inline-flex;align-items:center;gap:8px;font:inherit;font-size:13px;line-height:1.4;color:var(--ly-text);background:var(--ly-paper);border:1px solid var(--ly-line);border-radius:6px;padding:6px 12px;cursor:pointer;transition:border-color .15s ease,background-color .15s ease}.sb-block.ly-block .ly-chip i{width:6px;height:6px;border-radius:50%;background:var(--t);opacity:.75;flex:none}.sb-block.ly-block .ly-chip:hover{border-color:color-mix(in srgb,var(--t) 55%,var(--ly-line))}.sb-block.ly-block .ly-chip[aria-pressed=true]{background:var(--ts);border-color:var(--t);box-shadow:0 0 0 1px var(--t) inset;font-weight:650}.sb-block.ly-block .ly-chip[aria-pressed=true] i{opacity:1}.sb-block.ly-block .ly-chip:focus-visible,.sb-block.ly-block a:focus-visible{outline:2px solid var(--ly-accent);outline-offset:2px}.sb-block.ly-block .ly-none{font-size:13px;color:var(--ly-faint)}.sb-block.ly-block .ly-link{height:22px;padding-left:23px;display:flex;align-items:center}.sb-block.ly-block .ly-link svg{display:block;fill:none;stroke:var(--ly-faint);stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}.sb-block.ly-block .ly-panel{margin-top:14px;border:1px solid var(--ly-line);border-radius:10px;background:var(--ly-paper);padding:16px 20px;min-height:76px}.sb-block.ly-block .ly-panel[data-empty]{display:flex;align-items:center;border-style:dashed}.sb-block.ly-block .ly-panel>p{margin:0;color:var(--ly-muted);font-size:13px}.sb-block.ly-block .ly-crumb{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--ly-muted);line-height:1.5}.sb-block.ly-block .ly-crumb span:first-child{color:var(--t);font-weight:650}.sb-block.ly-block .ly-crumb b{font-weight:400;color:var(--ly-faint)}.sb-block.ly-block .ly-panel h4{margin:2px 0 6px;font-size:15px;line-height:1.5;font-weight:650}.sb-block.ly-block .ly-path{display:inline-block;margin:0 0 8px;font-size:12px;padding:3px 8px;border-radius:6px;border:1px solid var(--ly-line);word-break:break-all}.sb-block.ly-block .ly-md p{margin:0 0 6px;font-size:14px;line-height:1.7}.sb-block.ly-block .ly-md p:last-child{margin-bottom:0}.sb-block.ly-block .ly-md strong{font-weight:650}.sb-block.ly-block .ly-md a{color:var(--ly-accent);text-underline-offset:3px}.sb-block.ly-block .ly-static{display:none}@container (max-width: 640px){.sb-block.ly-block .ly-hint{display:none}.sb-block.ly-block .ly-band{grid-template-columns:minmax(0,1fr);gap:10px;padding:12px 14px}.sb-block.ly-block .ly-link{padding-left:21px}.sb-block.ly-block .ly-panel{padding:14px 16px}}@media(prefers-reduced-motion:reduce){.sb-block.ly-block .ly-band,.sb-block.ly-block .ly-chip{transition:none}}@media print{.sb-block.ly-block .ly-hint,.sb-block.ly-block .ly-panel{display:none}.sb-block.ly-block .ly-band{break-inside:avoid}.sb-block.ly-block .ly-static{display:block;margin-top:12px;font-size:13px}.sb-block.ly-block .ly-static-layer{margin-bottom:8px}.sb-block.ly-block .ly-static ul{margin:4px 0 0;padding-left:20px}.sb-block.ly-block .ly-static li{break-inside:avoid;margin-bottom:4px}.sb-block.ly-block .ly-static code{margin-left:6px}}
|
|
2
|
+
`);var S=T("layerDiagram",{"zh-CN":{title:"\u5206\u5C42\u67B6\u6784\u56FE",hint:"\u70B9\u9009\u6A21\u5757\u67E5\u770B\u8BF4\u660E",modules:"{layer}\u7684\u6A21\u5757",empty:"\u6682\u65E0\u6A21\u5757",prompt:"\u9009\u62E9\u4E0A\u65B9\u4EFB\u4E00\u6A21\u5757\uFF0C\u67E5\u770B\u5B83\u7684\u804C\u8D23\u548C\u4F4D\u7F6E\u3002",path:"\u4F4D\u7F6E"},en:{title:"Layer diagram",hint:"Select a module to see its details",modules:"Modules in {layer}",empty:"No modules",prompt:"Select any module above to see what it does and where it lives.",path:"Location"}});var l=x(D(),1);function N({source:d,inline:s}){return(0,l.jsx)(l.Fragment,{children:L(d).map((a,t)=>s?(0,l.jsxs)(n.Fragment,{children:[t>0&&" ",(0,l.jsx)(w,{source:a})]},t):(0,l.jsx)("p",{children:(0,l.jsx)(w,{source:a})},t))})}var F=(d,s)=>A.includes(d.tone)?d.tone:v[s%v.length];function J({data:d}){let s=E(S),a=d,t=(0,n.useMemo)(()=>(Array.isArray(a.layers)?a.layers:[]).map((e,o)=>({...e,tone:F(e,o),modules:Array.isArray(e.modules)?e.modules:[]})),[a.layers]),p=t.some(e=>e.modules.some(o=>o.id===a.initial))?a.initial:null,[f,k]=(0,n.useState)(p),[I,B]=(0,n.useState)(p);I!==p&&(B(p),k(p));let u=(0,n.useRef)(new Map),z=t.findIndex(e=>e.modules.some(o=>o.id===f)),m=t[z],r=m?.modules.find(e=>e.id===f),O=(e,o,i)=>{if(e.key==="Escape")return k(null);let c,y=t[o].modules;if(e.key==="ArrowRight")c=y[Math.min(y.length-1,i+1)];else if(e.key==="ArrowLeft")c=y[Math.max(0,i-1)];else if(e.key==="ArrowDown"||e.key==="ArrowUp"){let b=e.key==="ArrowDown"?1:-1;for(let g=o+b;g>=0&&g<t.length;g+=b){let h=t[g].modules;if(h.length){c=h[Math.min(i,h.length-1)];break}}}c&&(e.preventDefault(),u.current.get(c.id)?.focus(),k(c.id))};return(0,l.jsxs)("section",{className:"sb-block ly-block","aria-label":R(a.title,s("title")),children:[(0,l.jsxs)("div",{className:"ly-top",children:[(0,l.jsxs)("div",{children:[a.title&&(0,l.jsx)("h3",{className:"ly-title",children:a.title}),a.caption&&(0,l.jsx)("p",{className:"ly-caption",children:(0,l.jsx)(N,{source:a.caption,inline:!0})})]}),(0,l.jsx)("span",{className:"ly-hint",children:s("hint")})]}),(0,l.jsx)("div",{className:"ly-stack",children:t.map((e,o)=>(0,l.jsxs)(n.Fragment,{children:[o>0&&(0,l.jsx)("div",{className:"ly-link","aria-hidden":"true",children:(0,l.jsxs)("svg",{width:"12",height:"20",viewBox:"0 0 12 20",children:[(0,l.jsx)("path",{d:"M6 1v15"}),(0,l.jsx)("path",{d:"M2.5 12.5 6 16.5l3.5-4"})]})}),(0,l.jsxs)("section",{className:"ly-band","data-tone":e.tone,"data-active":o===z?"":void 0,"aria-label":e.name,children:[(0,l.jsxs)("header",{className:"ly-head",children:[(0,l.jsx)("span",{className:"ly-index",children:o+1}),(0,l.jsxs)("div",{children:[(0,l.jsx)("h4",{children:e.name}),e.sub&&(0,l.jsx)("small",{children:e.sub})]})]}),(0,l.jsx)("div",{className:"ly-modules",role:"group","aria-label":s("modules",{layer:e.name}),children:e.modules.length?e.modules.map((i,c)=>{let y=i.id===f;return(0,l.jsxs)("button",{type:"button",className:"ly-chip",ref:b=>{b?u.current.set(i.id,b):u.current.delete(i.id)},"aria-pressed":y,onClick:()=>k(y?null:i.id),onKeyDown:b=>O(b,o,c),children:[(0,l.jsx)("i",{"aria-hidden":"true"}),i.name]},i.id)}):(0,l.jsx)("span",{className:"ly-none",children:s("empty")})})]})]},e.id))}),(0,l.jsx)("div",{className:"ly-panel","data-tone":m?.tone,"data-empty":r?void 0:"","aria-live":"polite",children:r&&m?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"ly-crumb",children:[(0,l.jsx)("span",{children:m.name}),(0,l.jsx)("b",{"aria-hidden":"true",children:"/"}),(0,l.jsx)("span",{children:r.name})]}),(0,l.jsx)("h4",{children:r.name}),r.path&&(0,l.jsx)("code",{className:"ly-path",title:s("path"),children:r.path}),r.detail&&(0,l.jsx)("div",{className:"ly-md",children:(0,l.jsx)(N,{source:r.detail})})]}):(0,l.jsx)("p",{children:s("prompt")})}),(0,l.jsx)("div",{className:"ly-static",children:t.map(e=>(0,l.jsxs)("div",{className:"ly-static-layer",children:[(0,l.jsx)("b",{children:e.name}),e.sub&&(0,l.jsxs)("span",{children:[" \xB7 ",e.sub]}),(0,l.jsx)("ul",{children:e.modules.map(o=>(0,l.jsxs)("li",{children:[(0,l.jsx)("b",{children:o.name}),o.path&&(0,l.jsx)("code",{children:o.path}),o.detail&&(0,l.jsx)("div",{className:"ly-md",children:(0,l.jsx)(N,{source:o.detail})})]},o.id))})]},e.id))})]})}export{J as LayerDiagramBlock};
|
|
@@ -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-
|
|
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};
|
|
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-DY7XKPRY.js";import{d as Ne,e as Ce}from"./chunk-NF6YPAR6.js";import{A as ie,Da as A,Ha as ce,a as ae,c as Te,db as ue,eb as pe,gb as be,lb as me,ma as re,ob as ke,ra as se,ta as le,xa as de}from"./chunk-Z26LTCQQ.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{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
|
+
`);var t=W(me(),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 b=s.getBoundingClientRect(),m=l.getBoundingClientRect();$(b.bottom<m.top||b.top>m.bottom||b.right<m.left||b.left>m.right?null:{left:Math.max(m.left,Math.min(m.right,b.left+b.width/2)),top:Math.max(m.top,b.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(b=>b.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 b=!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)b=!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 m=O(n,i)[0];m&&w(m.id)}else if(e.key==="ArrowUp"||e.key==="ArrowDown"){let m=n.nodes.filter(j=>j.parentId===y.parentId),Ie=m.findIndex(j=>j.id===i),oe=m[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):b=!1;b&&(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)(be,{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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Ws,c as _s,i as yu,m as bu,n as ku,o as Ce,p as Po,q as wu,r as xu,s as js}from"./chunk-3HD2PTWK.js";import{a as ny,b as ry}from"./chunk-ANLBEZ6Q.js";import"./chunk-WDYURK6F.js";import{a as Su}from"./chunk-YNCGN7XC.js";import{$ as Zc,$a as Ar,A as Oo,Da as jt,F as Uc,G as qc,Ga as Ps,Ha as lu,I as Jc,L as Gc,N as Xc,O as Yc,Oa as zs,Pa as $s,Qa as au,Ta as cu,Va as Bs,Wa as uu,Xa as Hs,Y as Qc,Ya as du,Za as fu,_a as Fs,a as Vc,aa as eu,ab as Tr,ba as tu,bb as hu,c as Wn,ca as nu,cb as Nr,da as Ro,db as Io,eb as Lo,fa as ru,fb as pu,gb as mu,ib as gu,ka as Do,kb as Or,la as Is,lb as it,m as Wc,mb as Vs,na as Ls,ob as Qe,q as _c,r as jc,sa as ou,ta as iu,y as Kc,ya as su,z as Er}from"./chunk-KWOFOCF3.js";import{c as ue,i as _n}from"./chunk-DUIGVKKG.js";function vu(t,e){let n=t.cut(0,e).toJSON().content??[],r=t.cut(e).toJSON().content??[],o=l=>l?.type==="paragraph"&&!l.content?.length||l?.type==="richText"&&!Object.keys(l.attrs?.data??{}).length&&(l.content??[]).every(o);o(n.at(-1))&&n.pop(),o(r[0])&&r.shift();let i=new Set,s=l=>{let a=l.attrs?.id;a&&(i.has(a)&&(l.attrs={...l.attrs,id:crypto.randomUUID()}),i.add(l.attrs.id)),l.content?.forEach(s)};return n.forEach(s),r.forEach(s),{before:n,after:r}}var z=ue(Wn(),1),Rc=ue(Vs(),1);var U=ue(Wn(),1);function Oe(t){this.content=t}Oe.prototype={constructor:Oe,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,o=r.find(t),i=r.content.slice();return o==-1?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new Oe(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Oe(n)},addToStart:function(t,e){return new Oe([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Oe(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(i==-1?o.length:i,0,e,n),new Oe(o)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Oe.from(t),t.size?new Oe(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Oe.from(t),t.size?new Oe(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Oe.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Oe.from=function(t){if(t instanceof Oe)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Oe(e)};var Ks=Oe;function Lu(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){let s=o.text,l=i.text,a=0;for(;s[a]==l[a];a++)n++;return a&&a<s.length&&a<l.length&&$u(s.charCodeAt(a-1))&&zu(s.charCodeAt(a))&&n--,n}if(o.content.size||i.content.size){let s=Lu(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function Pu(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=t.child(--o),l=e.child(--i),a=s.nodeSize;if(s==l){n-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let c=s.text,u=l.text,d=c.length,f=u.length;for(;d>0&&f>0&&c[d-1]==u[f-1];)d--,f--,n--,r--;return d&&f&&d<c.length&&$u(c.charCodeAt(d-1))&&zu(c.charCodeAt(d))&&(n++,r++),{a:n,b:r}}if(s.content.size||l.content.size){let c=Pu(s.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}function zu(t){return t>=56320&&t<57344}function $u(t){return t>=55296&&t<56320}var C=class t{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,o=0,i){for(let s=0,l=0;l<n;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,o+l,i||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,n-u),r,o+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let i="",s=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?o?typeof o=="function"?o(l):o:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new t(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let i=0,s=0;s<n;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),r.push(l),o+=l.nodeSize),s=a}return new t(r,o)}cutByIndex(e,n){return e==n?t.empty:e==0&&n==this.content.length?this:new t(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new t(o,i)}addToStart(e){return new t([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new t(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return Lu(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Pu(this,e,n,r)}findIndex(e){if(e==0)return zo(0,e);if(e==this.size)return zo(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=this.child(n),i=r+o.nodeSize;if(i>=e)return i==e?zo(n+1,i):zo(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return t.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return t.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return t.empty;let n,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(n||(n=e.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new t(n||e,r)}static from(e){if(!e)return t.empty;if(e instanceof t)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new t([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};C.empty=new C([],0);var Us={index:0,offset:0};function zo(t,e){return Us.index=t,Us.offset=e,Us}function Ho(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Ho(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Ho(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}var Z=class t{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Ho(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);return r.create(n.attrs)}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return t.none;if(e instanceof t)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};Z.none=[];var Kt=class extends Error{},T=class t{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Hu(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new t(r,this.openStart,this.openEnd)}removeBetween(e,n){return new t(Bu(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return t.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new t(C.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new t(e,r,o)}};T.empty=new T(C.empty,0,0);function Bu(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:l}=t.findIndex(n);if(o==e||i.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(Bu(i.content,e-o-1,n-o-1)))}function Hu(t,e,n,r,o,i){let{index:s,offset:l}=t.findIndex(e),a=t.maybeChild(s);if(l==e||a.isText)return i&&r<=0&&o<=0&&!i.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=Hu(a.content,e-l-1,n,s==0?r-1:0,s==t.childCount-1?o-1:0,a);return c&&t.replaceChild(s,a.copy(c))}function oy(t,e,n){if(n.openStart>t.depth)throw new Kt("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Kt("Inconsistent open depths");return Fu(t,e,n,0)}function Fu(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let s=Fu(t,e,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,l=s.content;return hn(s,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=iy(n,t);return hn(i,Wu(t,s,l,e,r))}else return hn(i,Fo(t,e,r))}function Vu(t,e){if(!e.type.compatibleContent(t.type))throw new Kt("Cannot join "+e.type.name+" onto "+t.type.name)}function qs(t,e,n){let r=t.node(n);return Vu(r,e.node(n)),r}function fn(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Rr(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(fn(t.nodeAfter,r),i++));for(let l=i;l<s;l++)fn(o.child(l),r);e&&e.depth==n&&e.textOffset&&fn(e.nodeBefore,r)}function hn(t,e){if(!t.type.validContent(e))throw new Kt("Invalid content for node "+t.type.name);return t.copy(e)}function Wu(t,e,n,r,o){let i=t.depth>o&&qs(t,e,o+1),s=r.depth>o&&qs(n,r,o+1),l=[];return Rr(null,t,o,l),i&&s&&e.index(o)==n.index(o)?(Vu(i,s),fn(hn(i,Wu(t,e,n,r,o+1)),l)):(i&&fn(hn(i,Fo(t,e,o+1)),l),Rr(e,n,o,l),s&&fn(hn(s,Fo(n,r,o+1)),l)),Rr(r,null,o,l),new C(l)}function Fo(t,e,n){let r=[];if(Rr(null,t,n,r),t.depth>n){let o=qs(t,e,n+1);fn(hn(o,Fo(t,e,n+1)),r)}return Rr(e,null,n,r),new C(r)}function iy(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)o=e.node(i).copy(C.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}var Vo=class t{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(n);return r?e.child(n).cut(r):o}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Z.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let l=r;r=o,o=l}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new pn(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),c=i-a;if(r.push(s,l,o+a),!c||(s=s.child(l),s.isText))break;i=c-1,o+=a+1}return new t(n,r,i)}static resolveCached(e,n){let r=Cu.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else Cu.set(e,r=new Js);let o=r.elts[r.i]=t.resolve(e,n);return r.i=(r.i+1)%sy,o}},Js=class{constructor(){this.elts=[],this.i=0}},sy=12,Cu=new WeakMap,pn=class{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},ly=Object.create(null),st=class t{constructor(e,n,r,o=Z.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||C.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,o=0){this.content.nodesBetween(e,n,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,o){return this.content.textBetween(e,n,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Ho(this.attrs,n||e.defaultAttrs||ly)&&Z.sameSet(this.marks,r||Z.none)}copy(e=null){return e==this.content?this:new t(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new t(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return T.empty;let o=this.resolve(e),i=this.resolve(n),s=r?0:o.sharedDepth(n),l=o.start(s),c=o.node(s).content.cut(o.pos-l,i.pos-l);return new T(c,o.depth-s,i.depth-s)}replace(e,n,r){return oy(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return Vo.resolveCached(this,e)}resolveNoCache(e){return Vo.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),_u(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=C.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=o;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),Mu(this.type.attrs,this.attrs,"node",this.type.name);let e=Z.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];Mu(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!Z.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let o=C.fromJSON(e,n.content);return e.nodeType(n.type).create(n.attrs,o,r)}};st.prototype.text=void 0;var Gs=class t extends st{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):_u(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new t(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new t(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function _u(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}function Mu(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${r}`);for(let o in t)t[o].validate&&t[o].validate(e[o])}var mn=class t{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new Xs(e,n);if(r.next==null)return t.empty;let o=ju(r);r.next&&r.err("Unexpected trailing text");let i=py(hy(o));return my(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let o=this;for(let i=n;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let o=[this];function i(s,l){let a=s.matchFragment(e,r);if(a&&(!n||a.validEnd))return C.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let l=o;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
|
|
1
|
+
import{a as Ws,c as _s,i as yu,m as bu,n as ku,o as Ce,p as Po,q as wu,r as xu,s as js}from"./chunk-UXI4E4FN.js";import{a as ny,b as ry}from"./chunk-4S5THSYJ.js";import"./chunk-WDYURK6F.js";import{a as Su}from"./chunk-DY7XKPRY.js";import{$ as Zc,$a as Ar,A as Oo,Da as jt,F as Uc,G as qc,Ga as Ps,Ha as lu,I as Jc,L as Gc,N as Xc,O as Yc,Oa as zs,Pa as $s,Qa as au,Ta as cu,Va as Bs,Wa as uu,Xa as Hs,Y as Qc,Ya as du,Za as fu,_a as Fs,a as Vc,aa as eu,ab as Tr,ba as tu,bb as hu,c as Wn,ca as nu,cb as Nr,da as Ro,db as Io,eb as Lo,fa as ru,fb as pu,gb as mu,ib as gu,ka as Do,kb as Or,la as Is,lb as it,m as Wc,mb as Vs,na as Ls,ob as Qe,q as _c,r as jc,sa as ou,ta as iu,y as Kc,ya as su,z as Er}from"./chunk-Z26LTCQQ.js";import{c as ue,i as _n}from"./chunk-DUIGVKKG.js";function vu(t,e){let n=t.cut(0,e).toJSON().content??[],r=t.cut(e).toJSON().content??[],o=l=>l?.type==="paragraph"&&!l.content?.length||l?.type==="richText"&&!Object.keys(l.attrs?.data??{}).length&&(l.content??[]).every(o);o(n.at(-1))&&n.pop(),o(r[0])&&r.shift();let i=new Set,s=l=>{let a=l.attrs?.id;a&&(i.has(a)&&(l.attrs={...l.attrs,id:crypto.randomUUID()}),i.add(l.attrs.id)),l.content?.forEach(s)};return n.forEach(s),r.forEach(s),{before:n,after:r}}var z=ue(Wn(),1),Rc=ue(Vs(),1);var U=ue(Wn(),1);function Oe(t){this.content=t}Oe.prototype={constructor:Oe,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,o=r.find(t),i=r.content.slice();return o==-1?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new Oe(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Oe(n)},addToStart:function(t,e){return new Oe([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Oe(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(i==-1?o.length:i,0,e,n),new Oe(o)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Oe.from(t),t.size?new Oe(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Oe.from(t),t.size?new Oe(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Oe.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Oe.from=function(t){if(t instanceof Oe)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Oe(e)};var Ks=Oe;function Lu(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){let s=o.text,l=i.text,a=0;for(;s[a]==l[a];a++)n++;return a&&a<s.length&&a<l.length&&$u(s.charCodeAt(a-1))&&zu(s.charCodeAt(a))&&n--,n}if(o.content.size||i.content.size){let s=Lu(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function Pu(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=t.child(--o),l=e.child(--i),a=s.nodeSize;if(s==l){n-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let c=s.text,u=l.text,d=c.length,f=u.length;for(;d>0&&f>0&&c[d-1]==u[f-1];)d--,f--,n--,r--;return d&&f&&d<c.length&&$u(c.charCodeAt(d-1))&&zu(c.charCodeAt(d))&&(n++,r++),{a:n,b:r}}if(s.content.size||l.content.size){let c=Pu(s.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}function zu(t){return t>=56320&&t<57344}function $u(t){return t>=55296&&t<56320}var C=class t{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,o=0,i){for(let s=0,l=0;l<n;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,o+l,i||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,n-u),r,o+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let i="",s=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?o?typeof o=="function"?o(l):o:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new t(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let i=0,s=0;s<n;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),r.push(l),o+=l.nodeSize),s=a}return new t(r,o)}cutByIndex(e,n){return e==n?t.empty:e==0&&n==this.content.length?this:new t(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new t(o,i)}addToStart(e){return new t([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new t(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return Lu(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Pu(this,e,n,r)}findIndex(e){if(e==0)return zo(0,e);if(e==this.size)return zo(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=this.child(n),i=r+o.nodeSize;if(i>=e)return i==e?zo(n+1,i):zo(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return t.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return t.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return t.empty;let n,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(n||(n=e.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new t(n||e,r)}static from(e){if(!e)return t.empty;if(e instanceof t)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new t([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};C.empty=new C([],0);var Us={index:0,offset:0};function zo(t,e){return Us.index=t,Us.offset=e,Us}function Ho(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Ho(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Ho(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}var Z=class t{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Ho(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);return r.create(n.attrs)}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return t.none;if(e instanceof t)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};Z.none=[];var Kt=class extends Error{},T=class t{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Hu(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new t(r,this.openStart,this.openEnd)}removeBetween(e,n){return new t(Bu(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return t.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new t(C.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new t(e,r,o)}};T.empty=new T(C.empty,0,0);function Bu(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:l}=t.findIndex(n);if(o==e||i.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(Bu(i.content,e-o-1,n-o-1)))}function Hu(t,e,n,r,o,i){let{index:s,offset:l}=t.findIndex(e),a=t.maybeChild(s);if(l==e||a.isText)return i&&r<=0&&o<=0&&!i.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=Hu(a.content,e-l-1,n,s==0?r-1:0,s==t.childCount-1?o-1:0,a);return c&&t.replaceChild(s,a.copy(c))}function oy(t,e,n){if(n.openStart>t.depth)throw new Kt("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Kt("Inconsistent open depths");return Fu(t,e,n,0)}function Fu(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let s=Fu(t,e,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,l=s.content;return hn(s,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=iy(n,t);return hn(i,Wu(t,s,l,e,r))}else return hn(i,Fo(t,e,r))}function Vu(t,e){if(!e.type.compatibleContent(t.type))throw new Kt("Cannot join "+e.type.name+" onto "+t.type.name)}function qs(t,e,n){let r=t.node(n);return Vu(r,e.node(n)),r}function fn(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Rr(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(fn(t.nodeAfter,r),i++));for(let l=i;l<s;l++)fn(o.child(l),r);e&&e.depth==n&&e.textOffset&&fn(e.nodeBefore,r)}function hn(t,e){if(!t.type.validContent(e))throw new Kt("Invalid content for node "+t.type.name);return t.copy(e)}function Wu(t,e,n,r,o){let i=t.depth>o&&qs(t,e,o+1),s=r.depth>o&&qs(n,r,o+1),l=[];return Rr(null,t,o,l),i&&s&&e.index(o)==n.index(o)?(Vu(i,s),fn(hn(i,Wu(t,e,n,r,o+1)),l)):(i&&fn(hn(i,Fo(t,e,o+1)),l),Rr(e,n,o,l),s&&fn(hn(s,Fo(n,r,o+1)),l)),Rr(r,null,o,l),new C(l)}function Fo(t,e,n){let r=[];if(Rr(null,t,n,r),t.depth>n){let o=qs(t,e,n+1);fn(hn(o,Fo(t,e,n+1)),r)}return Rr(e,null,n,r),new C(r)}function iy(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)o=e.node(i).copy(C.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}var Vo=class t{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(n);return r?e.child(n).cut(r):o}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Z.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let l=r;r=o,o=l}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new pn(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),c=i-a;if(r.push(s,l,o+a),!c||(s=s.child(l),s.isText))break;i=c-1,o+=a+1}return new t(n,r,i)}static resolveCached(e,n){let r=Cu.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else Cu.set(e,r=new Js);let o=r.elts[r.i]=t.resolve(e,n);return r.i=(r.i+1)%sy,o}},Js=class{constructor(){this.elts=[],this.i=0}},sy=12,Cu=new WeakMap,pn=class{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},ly=Object.create(null),st=class t{constructor(e,n,r,o=Z.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||C.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,o=0){this.content.nodesBetween(e,n,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,o){return this.content.textBetween(e,n,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Ho(this.attrs,n||e.defaultAttrs||ly)&&Z.sameSet(this.marks,r||Z.none)}copy(e=null){return e==this.content?this:new t(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new t(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return T.empty;let o=this.resolve(e),i=this.resolve(n),s=r?0:o.sharedDepth(n),l=o.start(s),c=o.node(s).content.cut(o.pos-l,i.pos-l);return new T(c,o.depth-s,i.depth-s)}replace(e,n,r){return oy(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return Vo.resolveCached(this,e)}resolveNoCache(e){return Vo.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),_u(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=C.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=o;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),Mu(this.type.attrs,this.attrs,"node",this.type.name);let e=Z.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];Mu(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!Z.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let o=C.fromJSON(e,n.content);return e.nodeType(n.type).create(n.attrs,o,r)}};st.prototype.text=void 0;var Gs=class t extends st{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):_u(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new t(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new t(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function _u(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}function Mu(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${r}`);for(let o in t)t[o].validate&&t[o].validate(e[o])}var mn=class t{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new Xs(e,n);if(r.next==null)return t.empty;let o=ju(r);r.next&&r.err("Unexpected trailing text");let i=py(hy(o));return my(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let o=this;for(let i=n;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let o=[this];function i(s,l){let a=s.matchFragment(e,r);if(a&&(!n||a.validEnd))return C.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let l=o;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
|
|
2
2
|
`)}};mn.empty=new mn(!0);var Xs=class{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};function ju(t){let e=[];do e.push(ay(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function ay(t){let e=[];do e.push(cy(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function cy(t){let e=fy(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=uy(t,e);else break;return e}function Eu(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function uy(t,e){let n=Eu(t),r=n;return t.eat(",")&&(t.next!="}"?r=Eu(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function dy(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function fy(t){if(t.eat("(")){let e=ju(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=dy(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function hy(t){let e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function o(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=i(s.exprs[a],l);if(a==s.exprs.length-1)return c;o(c,l=n())}else if(s.type=="star"){let a=n();return r(l,a),o(i(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=n();return o(i(s.expr,l),a),o(i(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let u=n();o(i(s.expr,a),u),a=u}if(s.max==-1)o(i(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let u=n();r(a,u),o(i(s.expr,a),u),a=u}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Ku(t,e){return e-t}function Au(t,e){let n=[];return r(e),n.sort(Ku);function r(o){let i=t[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&n.indexOf(a)==-1&&r(a)}}}function py(t){let e=Object.create(null);return n(Au(t,0));function n(r){let o=[];r.forEach(s=>{t[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<o.length;u++)o[u][0]==l&&(c=o[u][1]);Au(t,a).forEach(u=>{c||o.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new mn(r.indexOf(t.length-1)>-1);for(let s=0;s<o.length;s++){let l=o[s][1].sort(Ku);i.next.push({type:o[s][0],next:e[l.join(",")]||n(l)})}return i}}function my(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let l=0;l<o.next.length;l++){let{type:a,next:c}=o.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Uu(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function qu(t,e){let n=Object.create(null);for(let r in t){let o=t[r],i=e&&e[r];if(i===void 0)if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r);else o.validate&&o.validate(i);n[r]=i}return n}function Ju(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new Ys(t,r,e[r]);return n}var Wo=class t{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Ju(e,r.attrs),this.defaultAttrs=Uu(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==mn.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:qu(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new st(this,this.computeAttrs(e),C.from(n),Z.setFrom(r))}createChecked(e=null,n,r){return n=C.from(n),this.checkContent(n),new st(this,this.computeAttrs(e),n,Z.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=C.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(C.empty,!0);return i?new st(this,e,n.append(i),Z.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Z.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,s)=>r[i]=new t(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function gy(t,e,n){let r=n.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}var Ys=class{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?gy(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}},Ir=class t{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=Ju(e,o.attrs),this.excluded=null;let i=Uu(this.attrs);this.instance=i?new Z(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Z(this,qu(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new t(i,o++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}excludes(e){return this.excluded.indexOf(e)>-1}},Lr=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=Ks.from(e.nodes),n.marks=Ks.from(e.marks||{}),this.nodes=Wo.compile(this.spec.nodes,this),this.marks=Ir.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=mn.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?Tu(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:Tu(this,s.split(" "))}this.nodeFromJSON=o=>st.fromJSON(this,o),this.markFromJSON=o=>Z.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Wo){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,o)}text(e,n){let r=this.nodes.text;return new Gs(r,r.defaultAttrs,e,Z.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function Tu(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(let l in t.marks){let a=t.marks[l];(o=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function yy(t){return t.tag!=null}function by(t){return t.style!=null}var xt=class t{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(yy(o))this.tags.push(o);else if(by(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new _o(this,n,!1);return r.addAll(e,Z.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new _o(this,n,!0);return r.addAll(e,Z.none,n.from,n.to),T.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(xy(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(s.getAttrs){let a=s.getAttrs(n);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<n.length;s++){let l=n[s];if((l.priority==null?50:l.priority)<i)break}n.splice(s,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=Ou(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=Ou(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new t(e,t.schemaRules(e)))}},Gu={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},ky={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Xu={ol:!0,ul:!0},Pr=1,Qs=2,Dr=4;function Nu(t,e,n){return e!=null?(e?Pr:0)|(e==="full"?Qs:0):t&&t.whitespace=="pre"?Pr|Qs:n&~Dr}var jn=class{constructor(e,n,r,o,i,s){this.type=e,this.attrs=n,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=Z.none,this.match=i||(s&Dr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(C.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Pr)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=C.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(C.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Gu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},_o=class{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,i,s=Nu(null,n.preserveWhitespace,0)|(r?Dr:0);o?i=new jn(o.type,o.attrs,Z.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new jn(null,null,Z.none,!0,null,s):i=new jn(e.schema.topNodeType,null,Z.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,o=this.top,i=o.options&Qs?"full":this.localPreserveWS||(o.options&Pr)>0,{schema:s}=this.parser;if(i==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
|
|
3
3
|
`);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(s.linebreakReplacement.create(),n,!0),l[a]&&this.insertNode(s.text(l[a]),n,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=o.content[o.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let o=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;Xu.hasOwnProperty(s)&&this.parser.normalizeLists&&wy(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:ky.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(Gu.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=a&&a.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=o}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
4
|
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(i,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(c=>!a.clearMark(c)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(e,n,r,o){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(s,n.attrs||null,r,n.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,n,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=o==null?null:e.childNodes[o];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n,r){let o,i;for(let s=this.open,l=0;s>=0;s--){let a=this.nodes[s],c=a.findWrapping(e);if(c&&(!o||o.length>c.length+l)&&(o=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!o)return null;this.sync(i);for(let s=0;s<o.length;s++)n=this.enterInner(o[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let o=this.findPlace(e,n,r);if(o){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=Z.none;for(let l of o.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):Ru(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,r,o){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,o)),i}enterInner(e,n,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=Nu(e,i,s.options);s.options&Dr&&s.content.length==0&&(l|=Dr);let a=Z.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):Ru(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new jn(e,n,a,o,null,l)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Pr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let u=a>0||a==0&&o?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}};function wy(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Xu.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function xy(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Ou(t){let e={};for(let n in t)e[n]=t[n];return e}function Ru(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&s(u))return!0}};if(s(o.contentMatch))return!0}}var St=class t{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=$o(n).createDocumentFragment());let o=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,a=0;for(;l<i.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)o=i.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],u=this.serializeMark(c,s.isInline,n);u&&(i.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){if(e.isText)return $o(n).createTextNode(e.text);let{dom:r,contentDOM:o}=Bo($o(n),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,o)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&Bo($o(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return typeof n=="string"?{dom:e.createTextNode(n)}:Bo(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new t(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Du(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Du(e.marks)}};function Du(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function $o(t){return t.document||window.document}var Iu=new WeakMap;function Sy(t){let e=Iu.get(t);return e===void 0&&Iu.set(t,e=vy(t)),e}function vy(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(t),e}function Bo(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let o=e[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=Sy(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=o.indexOf(" ");s>0&&(n=o.slice(0,s),o=o.slice(s+1));let l,a=n?t.createElementNS(n,o):t.createElement(o),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else if(typeof f=="string")a.appendChild(t.createTextNode(f));else{let{dom:h,contentDOM:p}=Bo(t,f,n,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}var td=65535,nd=Math.pow(2,16);function Cy(t,e){return t+e*nd}function Yu(t){return t&td}function My(t){return(t-(t&td))/nd}var rd=1,od=2,jo=4,id=8,Br=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&id)>0}get deletedBefore(){return(this.delInfo&(rd|jo))>0}get deletedAfter(){return(this.delInfo&(od|jo))>0}get deletedAcross(){return(this.delInfo&jo)>0}},vt=class t{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&t.empty)return t.empty}recover(e){let n=0,r=Yu(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+My(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+s],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:n:n,h=a+o+(f<0?0:u);if(r)return h;let p=e==(n<0?a:d)?null:Cy(l/3,e-a),m=0;return c&&(m|=e==a?od:e==d?rd:jo,(n<0?e!=a:e!=d)&&(m|=id)),new Br(h,m,p)}o+=u-c}return r?e+o:new Br(e+o,0,null)}touches(e,n){let r=0,o=Yu(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==o*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),c=this.ranges[o+n],u=this.ranges[o+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new t(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?t.empty:new t(e<0?[0,-e,0]:[0,0,e])}};vt.empty=new vt([]);var gn=class t{constructor(e,n,r=0,o=e?e.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new t(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let o=e.getMirror(n);this.appendMap(e._maps[n],o!=null&&o<n?r+o:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let o=e.getMirror(n);this.appendMap(e._maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let e=new t;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}o|=l.delInfo,e=l.pos}return r?e:new Br(e,o,null)}},Zs=Object.create(null),ve=class{getMap(){return vt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Zs[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Zs)throw new RangeError("Duplicate use of step JSON ID "+e);return Zs[e]=n,n.prototype.jsonID=e,n}},Me=class t{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new t(e,null)}static fail(e){return new t(null,e)}static fromReplace(e,n,r,o){try{return t.ok(e.replace(n,r,o))}catch(i){if(i instanceof Kt)return t.fail(i.message);throw i}}};function rl(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let i=t.child(o);i.content.size&&(i=i.copy(rl(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return C.fromArray(r)}var Hr=class t extends ve{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new T(rl(n.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return Me.fromReplace(e,this.from,this.to,i)}invert(){return new Ct(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)}merge(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))}};ve.jsonID("addMark",Hr);var Ct=class t extends ve{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new T(rl(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return Me.fromReplace(e,this.from,this.to,r)}invert(){return new Hr(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)}merge(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))}};ve.jsonID("removeMark",Ct);var Fr=class t extends ve{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Me.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Me.fromReplace(e,this.pos,this.pos+1,new T(C.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new t(this.pos,n.marks[o]);return new t(this.pos,this.mark)}}return new Kn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new t(n.pos,e.markFromJSON(n.mark))}};ve.jsonID("addNodeMark",Fr);var Kn=class t extends ve{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Me.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Me.fromReplace(e,this.pos,this.pos+1,new T(C.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Fr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new t(n.pos,e.markFromJSON(n.mark))}};ve.jsonID("removeNodeMark",Kn);var he=class t extends ve{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&tl(e,this.from,this.to)?Me.fail("Structure replace would overwrite content"):Me.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new vt([this.from,this.to-this.from,this.slice.size])}invert(e){return new t(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&t.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new t(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof t)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?T.empty:new T(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new t(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?T.empty:new T(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new t(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new t(n.from,n.to,T.fromJSON(e,n.slice),!!n.structure)}};he.MAP_BIAS=1;ve.jsonID("replace",he);var pe=class t extends ve{constructor(e,n,r,o,i,s,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(tl(e,this.from,this.gapFrom)||tl(e,this.gapTo,this.to)))return Me.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Me.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Me.fromReplace(e,this.from,this.to,r):Me.fail("Content does not fit in gap")}getMap(){return new vt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new t(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||i>r.pos?null:new t(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new t(n.from,n.to,n.gapFrom,n.gapTo,T.fromJSON(e,n.slice),n.insert,!!n.structure)}};ve.jsonID("replaceAround",pe);function tl(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function Ey(t,e,n,r){let o=[],i=[],s,l;t.doc.nodesBetween(e,n,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,n),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(s&&s.to==f&&s.mark.eq(d[m])?s.to=h:o.push(s=new Ct(f,h,d[m])));l&&l.to==f?l.to=h:i.push(l=new Hr(f,h,r))}}),o.forEach(a=>t.step(a)),i.forEach(a=>t.step(a))}function Ay(t,e,n,r){let o=[],i=0;t.doc.nodesBetween(e,n,(s,l)=>{if(!s.isInline)return;i++;let a=null;if(r instanceof Ir){let c=s.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,n);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<o.length;h++){let p=o[h];p.step==i-1&&d.eq(o[h].style)&&(f=p)}f?(f.to=c,f.step=i):o.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),o.forEach(s=>t.step(new Ct(s.from,s.to,s.style)))}function ol(t,e,n,r=n.contentMatch,o=!0){let i=t.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new he(l,u,T.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new Ct(l,u,c.marks[f]));if(o&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new T(C.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new he(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(C.empty,!0);t.replace(l,l,new T(a,0,0))}for(let a=s.length-1;a>=0;a--)t.step(s[a])}function Ty(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Mt(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,o=0,i=0;;--r){let s=t.$from.node(r),l=t.$from.index(r)+o,a=t.$to.indexAfter(r)-i;if(r<t.depth&&s.canReplace(l,a,n))return r;if(r==0||s.type.spec.isolating||!Ty(s,l,a))break;l&&(o=1),a<s.childCount&&(i=1)}return null}function Ny(t,e,n){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),l=o.after(i+1),a=s,c=l,u=C.empty,d=0;for(let p=i,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,u=C.from(r.node(p).copy(u)),d++):a--;let f=C.empty,h=0;for(let p=i,m=!1;p>n;p--)m||o.after(p+1)<o.end(p)?(m=!0,f=C.from(o.node(p).copy(f)),h++):c++;t.step(new pe(a,c,s,l,new T(u.append(f),d,h),u.size-d,!0))}function qn(t,e,n=null,r=t){let o=Oy(t,e),i=o&&Ry(r,e);return i?o.map(Qu).concat({type:e,attrs:n}).concat(i.map(Qu)):null}function Qu(t){return{type:t,attrs:null}}function Oy(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}function Ry(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;a&&c<o;c++)a=a.matchType(n.child(c).type);return!a||!a.validEnd?null:s}function Dy(t,e,n){let r=C.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let l=n[s].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=C.from(n[s].type.create(n[s].attrs,r))}let o=e.start,i=e.end;t.step(new pe(o,i,o,i,new T(r,0,0),n.length,!0))}function Iy(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,l)=>{let a=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,a)&&Ly(t.doc,t.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&ld(t,s,l,i),ol(t,t.mapping.slice(i).map(l,1),r,void 0,c===null);let u=t.mapping.slice(i),d=u.map(l,1),f=u.map(l+s.nodeSize,1);return t.step(new pe(d,f,d+1,f-1,new T(C.from(r.create(a,null,s.marks)),0,0),1,!0)),c===!0&&sd(t,s,l,i),!1}})}function sd(t,e,n,r){e.forEach((o,i)=>{if(o.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(o.text);){let a=t.mapping.slice(r).map(n+1+i+s.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function ld(t,e,n,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as g,b as _,c as Y,d as ae,e as se}from"./chunk-3RZMLHCB.js";import{d as ie}from"./chunk-NF6YPAR6.js";import{a as te,c as Te,lb as oe,nb as ne,ob as G}from"./chunk-Z26LTCQQ.js";import{c as K,d as le}from"./chunk-DUIGVKKG.js";var d=K(Te(),1);te(`.sb-block.rm-block :is(h3,h4,p,ul,ol,li,pre):not(svg){margin:0}.sb-block.rm-block li:not(svg){padding:0}.sb-block.rm-block pre:not(svg){border:0;border-radius:0;background:none;color:inherit}.sb-block.rm-block{--rm-text: var(--text, #222222);--rm-muted: var(--muted, #6a6a6a);--rm-line: var(--line, #dddddd);--rm-paper: var(--paper, #ffffff);--rm-surface: var(--surface, #fafafa);--rm-accent: var(--accent, #120a8f);--rm-grid: color-mix(in srgb, var(--rm-line) 70%, transparent);--rm-idle: #8a918c;--rm-bad: #b0473f;--rm-today: #c2410c;--rm-related: #d08a16;color:var(--rm-text);font-family:inherit;font-size:13px;line-height:1.5;padding:8px 0;font-variant-numeric:tabular-nums;overflow-wrap:anywhere;container-type:inline-size}:root[data-theme=dark] .sb-block.rm-block,[data-theme=dark] .sb-block.rm-block{--rm-idle: #a3aaa5;--rm-bad: #e48b83;--rm-today: #f08a4b;--rm-related: #f0b44a}.sb-block.rm-block *{box-sizing:border-box}.sb-block.rm-block button{font:inherit;color:inherit;cursor:pointer}.sb-block.rm-block button:focus-visible{outline:2px solid var(--rm-accent);outline-offset:2px}.sb-block.rm-block .rm-head{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:10px 24px}.sb-block.rm-block .rm-intro{flex:1 1 280px;min-width:0}.sb-block.rm-block .rm-title{font-size:17px;font-weight:700;margin:0}.sb-block.rm-block .rm-sub{color:var(--rm-muted);font-size:13px;margin:2px 0 0;max-width:44em}.sb-block.rm-block .rm-load{flex:0 1 300px;min-width:220px;display:flex;flex-direction:column;gap:5px}.sb-block.rm-block .rm-label{font-size:11.5px;font-weight:600;color:var(--rm-muted)}.sb-block.rm-block .rm-load-bar{display:flex;height:8px;border-radius:4px;overflow:hidden;background:var(--rm-surface)}.sb-block.rm-block .rm-load-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px;font-size:12px}.sb-block.rm-block .rm-load-list li{display:flex;align-items:center;gap:6px}.sb-block.rm-block .rm-load-list i{width:8px;height:8px;border-radius:2px;flex:none}.sb-block.rm-block .rm-load-list span{color:var(--rm-muted);margin-left:auto;white-space:nowrap}.sb-block.rm-block .rm-tools{display:flex;flex-wrap:wrap;align-items:center;gap:8px 14px;margin:12px 0 6px}.sb-block.rm-block .rm-seg{display:inline-flex;align-items:center;gap:2px;background:var(--rm-surface);border:1px solid var(--rm-line);border-radius:8px;padding:2px}.sb-block.rm-block .rm-seg span{font-size:11.5px;color:var(--rm-muted);padding:0 6px}.sb-block.rm-block .rm-seg button{border:0;background:transparent;border-radius:6px;padding:2px 10px;font-size:12px;color:var(--rm-muted)}.sb-block.rm-block .rm-seg button[aria-pressed=true]{background:var(--rm-paper);color:var(--rm-text);font-weight:600;box-shadow:0 1px 2px #00000014}.sb-block.rm-block .rm-chips{display:flex;flex-wrap:wrap;gap:6px}.sb-block.rm-block .rm-chips button{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--rm-line);background:var(--rm-paper);border-radius:999px;padding:2px 10px;font-size:12px}.sb-block.rm-block .rm-chips i{width:8px;height:8px;border-radius:50%;background:var(--rm-c)}.sb-block.rm-block .rm-chips button[aria-pressed=true]{border-color:var(--rm-c, var(--rm-text));box-shadow:inset 0 0 0 1px var(--rm-c, var(--rm-text));font-weight:600}.sb-block.rm-block .rm-legend{list-style:none;margin:0 0 0 auto;padding:0;display:flex;flex-wrap:wrap;gap:4px 12px;font-size:11.5px;color:var(--rm-muted)}.sb-block.rm-block .rm-legend li{display:inline-flex;align-items:center;gap:5px}.sb-block.rm-block .rm-legend b{color:var(--rm-text);font-weight:600}.sb-block.rm-block .rm-swatch{--rm-c: var(--rm-idle);display:inline-block;width:16px;height:8px;border-radius:3px;flex:none}.sb-block.rm-block .rm-swatch.rm-tone-done{background:color-mix(in srgb,var(--rm-c) 55%,var(--rm-paper))}.sb-block.rm-block .rm-swatch.rm-tone-active{background:repeating-linear-gradient(135deg,var(--rm-c) 0 3px,color-mix(in srgb,var(--rm-c) 45%,var(--rm-paper)) 3px 6px)}.sb-block.rm-block .rm-swatch.rm-tone-todo{border:1.5px dashed var(--rm-c)}.sb-block.rm-block .rm-swatch.rm-tone-blocked{border:1.5px solid var(--rm-bad);background:color-mix(in srgb,var(--rm-bad) 18%,var(--rm-paper))}.sb-block.rm-block .rm-scroll{position:relative}.sb-block.rm-block .rm-scroll.is-narrow{overflow-x:auto;padding-bottom:4px}.sb-block.rm-block .rm-chart{position:relative}.sb-block.rm-block .rm-axis{position:relative;height:46px;border-bottom:1px solid var(--rm-line)}.sb-block.rm-block .rm-tick{position:absolute;top:2px;font-size:11px;color:var(--rm-muted);transform:translate(3px);white-space:nowrap;line-height:1.25}.sb-block.rm-block .rm-tick small{display:block;font-size:10px}.sb-block.rm-block .rm-milestone{position:absolute;bottom:3px;display:flex;align-items:center;gap:4px;transform:translate(-5px);white-space:nowrap;color:var(--rm-today)}.sb-block.rm-block .rm-milestone i{width:9px;height:9px;background:currentColor;transform:rotate(45deg);border-radius:2px}.sb-block.rm-block .rm-milestone em{font-style:normal;font-size:11px;font-weight:650}.sb-block.rm-block .rm-rows{position:relative;padding-bottom:8px}.sb-block.rm-block .rm-overlay{position:absolute;inset:0;pointer-events:none}.sb-block.rm-block .rm-grid,.sb-block.rm-block .rm-milestone-line{position:absolute;top:0;bottom:0;border-left:1px dashed var(--rm-grid)}.sb-block.rm-block .rm-milestone-line{border-left-color:color-mix(in srgb,var(--rm-today) 45%,transparent)}.sb-block.rm-block .rm-past{position:absolute;top:0;bottom:0;background:repeating-linear-gradient(135deg,color-mix(in srgb,var(--rm-text) 4%,transparent) 0 6px,transparent 6px 12px)}.sb-block.rm-block .rm-today{position:absolute;top:0;bottom:0;border-left:2px solid var(--rm-today);z-index:2}.sb-block.rm-block .rm-today em,.sb-block.rm-block .rm-deadline em{position:absolute;bottom:-18px;transform:translate(-50%);white-space:nowrap;font-style:normal;font-size:10.5px;font-weight:700;border-radius:4px;padding:0 5px;line-height:16px}.sb-block.rm-block .rm-today em{background:var(--rm-today);color:var(--rm-paper)}.sb-block.rm-block .rm-deadline{position:absolute;top:0;bottom:0;border-left:2px solid var(--rm-text);z-index:2}.sb-block.rm-block .rm-deadline em{background:var(--rm-text);color:var(--rm-paper)}.sb-block.rm-block .rm-group{position:relative;display:flex;align-items:center;gap:6px;font-size:11.5px;font-weight:650;color:var(--rm-muted);padding:10px 0 2px;letter-spacing:.02em}.sb-block.rm-block .rm-group i{width:9px;height:9px;border-radius:3px}.sb-block.rm-block .rm-row{position:relative;display:flex;height:28px;align-items:center}.sb-block.rm-block .rm-gutter{width:var(--rm-gutter);flex:none;min-width:0;padding-right:8px;display:flex;align-items:center;overflow:hidden;transition:opacity .2s}.sb-block.rm-block .is-narrow .rm-gutter{display:none}.sb-block.rm-block .rm-gutter.is-dim{opacity:.3}.sb-block.rm-block .rm-owner-tag{font-size:10.5px;font-weight:650;border-radius:4px;padding:0 6px;line-height:16px;color:var(--rm-c);background:color-mix(in srgb,var(--rm-c) 12%,transparent);white-space:nowrap}.sb-block.rm-block .rm-lane-tag{font-size:11px;color:var(--rm-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sb-block.rm-block .rm-track{position:relative;flex:1;min-width:0;height:100%}.sb-block.rm-block .rm-bar{position:absolute;top:4px;height:20px;min-width:6px;border-radius:6px;border:1.5px solid var(--rm-c);background:var(--rm-c);color:#fff;padding:0 7px;text-align:left;overflow:hidden;z-index:1;transition:opacity .2s,box-shadow .15s}.sb-block.rm-block .rm-bar.rm-tone-done{background:color-mix(in srgb,var(--rm-c) 55%,var(--rm-paper));border-color:transparent}.sb-block.rm-block .rm-bar.rm-tone-active{background:repeating-linear-gradient(135deg,var(--rm-c) 0 7px,color-mix(in srgb,var(--rm-c) 80%,var(--rm-paper)) 7px 14px)}.sb-block.rm-block .rm-bar.rm-tone-todo{background:color-mix(in srgb,var(--rm-c) 14%,var(--rm-paper));border-style:dashed;color:var(--rm-text)}.sb-block.rm-block .rm-bar.rm-tone-blocked{background:color-mix(in srgb,var(--rm-bad) 14%,var(--rm-paper));border-color:var(--rm-bad);color:var(--rm-text)}.sb-block.rm-block .rm-progress{position:absolute;inset:0 auto 0 0;background:var(--rm-c)}.sb-block.rm-block .rm-bar-text{position:relative;display:block;font-size:11.5px;font-weight:600;line-height:17px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sb-block.rm-block .rm-bar.rm-tone-active .rm-bar-text,.sb-block.rm-block .rm-bar.rm-tone-done .rm-bar-text{text-shadow:0 0 3px #00000059}.sb-block.rm-block .rm-bar:hover{box-shadow:0 2px 6px #0000001f}.sb-block.rm-block .rm-bar.is-selected{box-shadow:0 0 0 2px var(--rm-paper),0 0 0 4px var(--rm-c)}.sb-block.rm-block .rm-bar.is-related{box-shadow:0 0 0 2px var(--rm-paper),0 0 0 3.5px var(--rm-related)}.sb-block.rm-block .rm-bar.is-dim,.sb-block.rm-block .rm-outside.is-dim{opacity:.22}.sb-block.rm-block .rm-outside{position:absolute;top:5px;font-size:11.5px;color:var(--rm-muted);white-space:nowrap;cursor:pointer;transition:opacity .2s}.sb-block.rm-block .rm-outside.is-selected,.sb-block.rm-block .rm-outside.is-related{color:var(--rm-text);font-weight:600}.sb-block.rm-block .rm-detail{margin-top:22px;border-top:1px solid var(--rm-line);padding-top:12px;display:grid;grid-template-columns:minmax(0,1.4fr) minmax(0,1fr);gap:12px 20px}.sb-block.rm-block .rm-hint{grid-column:1 / -1;margin:0;color:var(--rm-muted);font-size:12.5px}.sb-block.rm-block .rm-meta{display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px;font-size:12px;color:var(--rm-muted)}.sb-block.rm-block .rm-pill{color:#fff;border-radius:999px;padding:0 8px;font-weight:650;line-height:18px}.sb-block.rm-block .rm-status{display:inline-flex;align-items:center;gap:5px;color:var(--rm-text)}.sb-block.rm-block .rm-close{margin-left:auto;border:0;background:transparent;color:var(--rm-muted);font-size:16px;line-height:1;padding:2px 6px;border-radius:6px}.sb-block.rm-block .rm-detail h4{margin:6px 0 4px;font-size:15px}.sb-block.rm-block .rm-detail p{margin:0;font-size:13px}.sb-block.rm-block .rm-detail .rm-basis{margin-top:6px;font-size:12px;color:var(--rm-muted)}.sb-block.rm-block .rm-basis b{color:var(--rm-text);margin-right:4px}.sb-block.rm-block .rm-detail-side{display:flex;flex-direction:column;gap:10px;font-size:12.5px}.sb-block.rm-block .rm-detail-side small{display:block;font-size:11px;font-weight:600;color:var(--rm-muted);letter-spacing:.03em}.sb-block.rm-block .rm-links,.sb-block.rm-block .rm-tags{display:flex;flex-wrap:wrap;gap:5px;margin-top:3px}.sb-block.rm-block .rm-links button{border:1px solid color-mix(in srgb,var(--rm-related) 60%,var(--rm-line));background:color-mix(in srgb,var(--rm-related) 10%,var(--rm-paper));border-radius:6px;padding:1px 8px;font-size:12px;text-align:left}.sb-block.rm-block .rm-links button:hover{background:color-mix(in srgb,var(--rm-related) 20%,var(--rm-paper))}.sb-block.rm-block .rm-tags span{border:1px solid var(--rm-line);border-radius:6px;padding:0 7px;font-size:11.5px;color:var(--rm-muted)}.sb-block.rm-block .rm-static{margin-top:12px;font-size:13px}.sb-block.rm-block .rm-static summary{cursor:pointer;color:var(--rm-muted)}.sb-block.rm-block .rm-static h4{margin:10px 0 4px;font-size:13px}.sb-block.rm-block .rm-static ul{margin:0;padding-left:18px}.sb-block.rm-block .rm-static li{margin:4px 0}.sb-block.rm-block .rm-static li div{color:var(--rm-muted);font-size:12.5px}@container (max-width: 640px){.sb-block.rm-block .rm-detail{grid-template-columns:minmax(0,1fr)}.sb-block.rm-block .rm-legend{margin-left:0}.sb-block.rm-block .rm-load{flex-basis:100%}}@media(prefers-reduced-motion:reduce){.sb-block.rm-block .rm-bar,.sb-block.rm-block .rm-outside,.sb-block.rm-block .rm-gutter{transition:none}}@media print{.sb-block.rm-block .rm-tools .rm-seg,.sb-block.rm-block .rm-tools .rm-chips,.sb-block.rm-block .rm-close{display:none}.sb-block.rm-block .rm-scroll.is-narrow{overflow:visible}.sb-block.rm-block .rm-bar.is-dim,.sb-block.rm-block .rm-outside.is-dim,.sb-block.rm-block .rm-gutter.is-dim{opacity:1}}
|
|
2
|
+
`);var H=le("roadmap",{"zh-CN":{title:"\u8DEF\u7EBF\u56FE","status.done":"\u5DF2\u5B8C\u6210","status.active":"\u8FDB\u884C\u4E2D","status.todo":"\u672A\u5F00\u59CB","status.blocked":"\u53D7\u963B",groupBy:"\u5206\u7EC4",byLane:"\u5DE5\u4F5C\u6D41",byOwner:"\u8D1F\u8D23\u4EBA",ownerFilter:"\u6309\u8D1F\u8D23\u4EBA\u7A81\u51FA",everyone:"\u5168\u90E8",unassigned:"\u672A\u6307\u6D3E",statusLegend:"\u72B6\u6001\u56FE\u4F8B",today:"\u4ECA\u5929",deadline:"\u622A\u6B62",workload:"\u8D1F\u8D23\u4EBA\u5DE5\u4F5C\u91CF",workloadEntry:"{owner}\uFF1A\u6392\u671F {scheduled} \u5929\uFF0C\u5F85\u505A {open} \u5929",scheduledDays:"\u6392\u671F {count} \u5929",openDays:"\u5F85\u505A {count} \u5929",days:"{count} \u5929",range:"{start} \u2013 {end}",progress:"\u5B8C\u6210 {percent}%",doneWhen:"\u5B8C\u6210\u6807\u51C6",basis:"\u4F9D\u636E",depends:"\u4F9D\u8D56",unblocks:"\u5B8C\u6210\u540E\u53EF\u4EE5\u5F00\u59CB",tags:"\u5173\u8054",hint:"\u70B9\u51FB\u4EFB\u52A1\u6761\u67E5\u770B\u8BF4\u660E\u3001\u4F9D\u8D56\u548C\u5B83\u89E3\u9501\u7684\u5DE5\u4F5C\uFF1B\u4E0E\u5B83\u76F8\u8FDE\u7684\u4EFB\u52A1\u4F1A\u88AB\u63CF\u8FB9\u7A81\u51FA\u3002",clearSelection:"\u53D6\u6D88\u9009\u62E9",bar:"{title}\uFF0C{owner}\uFF0C{status}\uFF0C{range}",chart:"\u6309\u65E5\u671F\u6392\u5217\u7684\u8BA1\u5212",readAll:"\u6309\u5DE5\u4F5C\u6D41\u9605\u8BFB\u5168\u90E8\u4EFB\u52A1\uFF08{count}\uFF09",staticItem:"{range} \xB7 {status}",staticDepends:"\u4F9D\u8D56\uFF1A{items}",staticDoneWhen:"\u5B8C\u6210\u6807\u51C6\uFF1A{text}",listSeparator:"\u3001"},en:{title:"Roadmap","status.done":"Done","status.active":"In progress","status.todo":"Not started","status.blocked":"Blocked",groupBy:"Group",byLane:"Workstream",byOwner:"Owner",ownerFilter:"Highlight by owner",everyone:"Everyone",unassigned:"Unassigned",statusLegend:"Status legend",today:"Today",deadline:"Deadline",workload:"Workload by owner",workloadEntry:"{owner}: {scheduled} days scheduled, {open} days open",scheduledDays:{one:"{count} day scheduled",other:"{count} days scheduled"},openDays:{one:"{count} day open",other:"{count} days open"},days:{one:"{count} day",other:"{count} days"},range:"{start} \u2013 {end}",progress:"{percent}% done",doneWhen:"Done when",basis:"Basis",depends:"Depends on",unblocks:"Unblocks",tags:"Related",hint:"Click a bar to see its details, dependencies and the work it unblocks; connected tasks are outlined.",clearSelection:"Clear selection",bar:"{title}, {owner}, {status}, {range}",chart:"Plan by date",readAll:"Read every task by workstream ({count})",staticItem:"{range} \xB7 {status}",staticDepends:"Depends on: {items}",staticDoneWhen:"Done when: {text}",listSeparator:", "}});var r=K(oe(),1),v=864e5,ce=["#3b74b8","#2f8f6b","#b7792f","#7c5cc4","#c0504a","#2a9aa6","#8a6d3b","#5b6f8a"],Se=132,de=520,Ce=new Map(_.map(s=>[s.id,s.label])),$e={done:"status.done",active:"status.active",todo:"status.todo",blocked:"status.blocked"};function Me(){let s=(0,d.useRef)(null),[o,i]=(0,d.useState)(900);return(0,d.useEffect)(()=>{let t=s.current;if(!t)return;let k=new ResizeObserver(([l])=>i(l.contentRect.width));return k.observe(t),()=>k.disconnect()},[]),[s,o]}var Ee=s=>[...s].reduce((o,i)=>o+(/[\u2e80-\uffff]/.test(i)?12:6.8),0)+16;function Le(s,o){let i=o-s+1,t=[];if(i<=21){for(let l=s;l<=o;l+=1)t.push(l);return{ticks:t,unit:"day"}}if(i<=120){for(let l=s+((4-s)%7+7)%7;l<=o;l+=7)t.push(l);return{ticks:t,unit:"week"}}let k=new Date(s*v);for(let l=new Date(Date.UTC(k.getUTCFullYear(),k.getUTCMonth()+1,1));l.getTime()/v<=o;l=new Date(Date.UTC(l.getUTCFullYear(),l.getUTCMonth()+1,1)))t.push(l.getTime()/v);return{ticks:t,unit:"month"}}var M=s=>Math.round(s*10)/10;function Ke({data:s}){let o=G(H),i=ne(),t=s,k=(t.statuses??_).map(e=>{let a=$e[e.id];return a&&Ce.get(e.id)===e.label?{...e,label:o(a)}:e}),l=new Map(k.map(e=>[e.id,e])),m=(t.owners??[]).map((e,a)=>({...e,color:e.color??ce[a%ce.length]})),x=new Map(m.map(e=>[e.id,e])),D=new Map(t.lanes.map(e=>[e.id,e])),b=new Map(t.items.map(e=>[e.id,e])),c=se(t),me=t.items.some(e=>!e.owner),[be,Z]=Me(),[E,pe]=(0,d.useState)(m.length?t.groupBy??"lane":"lane"),[h,j]=(0,d.useState)(null),[y,z]=(0,d.useState)(()=>t.initialItem??t.items.find(e=>l.get(e.status)?.tone==="active")?.id??null),L=(0,d.useRef)(null);(0,d.useEffect)(()=>{let e=()=>{L.current&&(L.current.open=!0)};return window.addEventListener("beforeprint",e),()=>window.removeEventListener("beforeprint",e)},[]);let ke=(0,d.useMemo)(()=>new Intl.DateTimeFormat(i,{month:"short",day:"numeric",timeZone:"UTC"}),[i]),ue=(0,d.useMemo)(()=>new Intl.DateTimeFormat(i,{weekday:"short",timeZone:"UTC"}),[i]),ge=(0,d.useMemo)(()=>new Intl.DateTimeFormat(i,{year:"numeric",month:"short",timeZone:"UTC"}),[i]),I=e=>ke.format(new Date(e*v)),W=e=>o("range",{start:I(g(e.start)),end:I(g(e.end))}),{start:T,end:F}=ae(t),U=F-T+1,u=e=>(e-T)/U*100,R=Z<640,q=R?0:Se,B=Math.max(Z,de)-q,{ticks:w,unit:O}=Le(T,F),xe=w.length>1?(w[1]-w[0])/U*B:B,J=Math.max(1,Math.ceil((O==="day"?40:52)/xe)),f=e=>`calc(var(--rm-gutter) + (100% - var(--rm-gutter)) * ${e/100})`,S=t.today?g(t.today):Number.NaN,fe=S>=T&&S<=F,ve=t.deadline?g(t.deadline.date):Number.NaN,p=y?b.get(y):void 0,Q=p?t.items.filter(e=>(e.depends??[]).includes(p.id)):[],he=new Set([...p?.depends??[],...Q.map(e=>e.id)]),ye=E==="owner"?[...m.map(e=>({id:e.id,label:e.label,color:e.color,items:t.items.filter(a=>a.owner===e.id)})),...me?[{id:"",label:o("unassigned"),color:void 0,items:t.items.filter(e=>!e.owner)}]:[]]:t.lanes.map(e=>({id:e.id,label:e.label,color:void 0,items:t.items.filter(a=>a.lane===e.id)})),A=new Map;for(let e of t.items)A.set(e.status,(A.get(e.status)??0)+1);let we=m.reduce((e,a)=>e+(c[a.id]?.scheduled??0),0)||1,V=e=>z(y===e?null:e),Ne=e=>{e.key==="Escape"&&y&&(e.stopPropagation(),z(null))},De=e=>e.owner&&x.get(e.owner)?.color||"var(--rm-idle)";return(0,r.jsxs)("section",{className:"sb-block rm-block","aria-label":ie(t.title,o("title")),onKeyDown:Ne,children:[(0,r.jsxs)("div",{className:"rm-head",children:[(0,r.jsxs)("div",{className:"rm-intro",children:[t.title&&(0,r.jsx)("h3",{className:"rm-title",children:t.title}),t.description&&(0,r.jsx)("p",{className:"rm-sub",children:t.description})]}),m.length>0&&(0,r.jsxs)("div",{className:"rm-load",role:"group","aria-label":o("workload"),children:[(0,r.jsx)("span",{className:"rm-label",children:o("workload")}),(0,r.jsx)("div",{className:"rm-load-bar","aria-hidden":"true",children:m.map(e=>(0,r.jsx)("span",{style:{width:`${(c[e.id]?.scheduled??0)/we*100}%`,background:e.color}},e.id))}),(0,r.jsx)("ul",{className:"rm-load-list",children:m.map(e=>(0,r.jsxs)("li",{"aria-label":o("workloadEntry",{owner:e.label,scheduled:M(c[e.id]?.scheduled??0),open:M(c[e.id]?.open??0)}),children:[(0,r.jsx)("i",{style:{background:e.color}}),(0,r.jsx)("b",{children:e.label}),(0,r.jsxs)("span",{children:[o("scheduledDays",{count:M(c[e.id]?.scheduled??0)})," \xB7 ",o("openDays",{count:M(c[e.id]?.open??0)})]})]},e.id))})]})]}),(0,r.jsxs)("div",{className:"rm-tools",children:[m.length>0&&(0,r.jsxs)("div",{className:"rm-seg",role:"group","aria-label":o("groupBy"),children:[(0,r.jsx)("span",{children:o("groupBy")}),["lane","owner"].map(e=>(0,r.jsx)("button",{type:"button","aria-pressed":E===e,onClick:()=>pe(e),children:o(e==="lane"?"byLane":"byOwner")},e))]}),m.length>1&&(0,r.jsxs)("div",{className:"rm-chips",role:"group","aria-label":o("ownerFilter"),children:[(0,r.jsx)("button",{type:"button","aria-pressed":h===null,onClick:()=>j(null),children:o("everyone")}),m.map(e=>(0,r.jsxs)("button",{type:"button","aria-pressed":h===e.id,style:{"--rm-c":e.color},onClick:()=>j(h===e.id?null:e.id),children:[(0,r.jsx)("i",{}),e.label]},e.id))]}),(0,r.jsx)("ul",{className:"rm-legend","aria-label":o("statusLegend"),children:k.map(e=>(0,r.jsxs)("li",{children:[(0,r.jsx)("i",{className:`rm-swatch rm-tone-${e.tone}`}),e.label," ",(0,r.jsx)("b",{children:A.get(e.id)??0})]},e.id))})]}),(0,r.jsx)("div",{className:`rm-scroll${R?" is-narrow":""}`,ref:be,children:(0,r.jsxs)("div",{className:"rm-chart",role:"group","aria-label":o("chart"),style:{"--rm-gutter":`${q}px`,minWidth:R?de:void 0},children:[(0,r.jsxs)("div",{className:"rm-axis",children:[w.map((e,a)=>(0,r.jsxs)("span",{className:"rm-tick",style:{left:f(u(e))},children:[a%J===0&&(O==="month"?ge.format(new Date(e*v)):I(e)),O==="day"&&a%J===0&&(0,r.jsx)("small",{children:ue.format(new Date(e*v))})]},e)),(t.milestones??[]).map(e=>(0,r.jsxs)("span",{className:"rm-milestone",style:{left:f(u(g(e.date)+.5))},children:[(0,r.jsx)("i",{"aria-hidden":"true"}),(0,r.jsx)("em",{children:e.label})]},`${e.date}-${e.label}`))]}),(0,r.jsxs)("div",{className:"rm-rows",children:[(0,r.jsxs)("div",{className:"rm-overlay","aria-hidden":"true",children:[w.map(e=>(0,r.jsx)("i",{className:"rm-grid",style:{left:f(u(e))}},e)),fe&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"rm-past",style:{left:"var(--rm-gutter)",width:`calc((100% - var(--rm-gutter)) * ${u(S)/100})`}}),(0,r.jsx)("span",{className:"rm-today",style:{left:f(u(S+.5))},children:(0,r.jsx)("em",{children:o("today")})})]}),(t.milestones??[]).map(e=>(0,r.jsx)("i",{className:"rm-milestone-line",style:{left:f(u(g(e.date)+.5))}},`${e.date}-${e.label}`)),t.deadline&&(0,r.jsx)("span",{className:"rm-deadline",style:{left:f(u(ve+1))},children:(0,r.jsx)("em",{children:t.deadline.label??o("deadline")})})]}),ye.map(e=>e.items.length?(0,r.jsxs)(d.Fragment,{children:[(0,r.jsxs)("div",{className:"rm-group",children:[e.color&&(0,r.jsx)("i",{style:{background:e.color}}),e.label]}),e.items.map(a=>{let n=l.get(a.status),N=a.owner?x.get(a.owner):void 0,C=u(g(a.start)),$=Y(a)/U*100,X=h!==null&&a.owner!==h,P=$/100*B>=Ee(a.title),ze=!P&&C+$>72,ee=a.id===y,re=`${ee?" is-selected":""}${he.has(a.id)?" is-related":""}${X?" is-dim":""}`;return(0,r.jsxs)("div",{className:"rm-row",style:{"--rm-c":De(a)},children:[(0,r.jsx)("div",{className:`rm-gutter${X?" is-dim":""}`,children:E==="lane"?N&&(0,r.jsx)("span",{className:"rm-owner-tag",children:N.label}):(0,r.jsx)("span",{className:"rm-lane-tag",children:D.get(a.lane)?.label})}),(0,r.jsxs)("div",{className:"rm-track",children:[(0,r.jsxs)("button",{type:"button",className:`rm-bar rm-tone-${n.tone}${re}`,style:{left:`${C}%`,width:`${$}%`},"aria-pressed":ee,"aria-label":o("bar",{title:a.title,owner:N?.label??o("unassigned"),status:n.label,range:W(a)}),onClick:()=>V(a.id),children:[n.tone==="active"&&a.progress!==void 0&&(0,r.jsx)("span",{className:"rm-progress",style:{width:`${a.progress*100}%`}}),P&&(0,r.jsx)("span",{className:"rm-bar-text",children:a.title})]}),!P&&(0,r.jsx)("span",{className:`rm-outside${re}`,"aria-hidden":"true",style:ze?{right:`calc(${100-C}% + 6px)`}:{left:`calc(${C+$}% + 6px)`},onClick:()=>V(a.id),children:a.title})]})]},a.id)})]},e.id):null)]})]})}),(0,r.jsx)("div",{className:"rm-detail","aria-live":"polite",children:p?(0,r.jsx)(Ie,{item:p,status:l.get(p.status),owner:p.owner?x.get(p.owner):void 0,lane:D.get(p.lane),range:W(p),depends:(p.depends??[]).map(e=>b.get(e)),dependents:Q,onSelect:z,onClear:()=>z(null)}):(0,r.jsx)("p",{className:"rm-hint",children:o("hint")})}),(0,r.jsxs)("details",{className:"rm-static",ref:L,children:[(0,r.jsx)("summary",{children:o("readAll",{count:t.items.length})}),t.lanes.map(e=>{let a=t.items.filter(n=>n.lane===e.id);return a.length?(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{children:e.label}),(0,r.jsx)("ul",{children:a.map(n=>(0,r.jsxs)("li",{children:[(0,r.jsx)("b",{children:n.title}),n.owner&&` \xB7 ${x.get(n.owner)?.label}`," \xB7 ",o("staticItem",{range:W(n),status:l.get(n.status).label}),n.detail&&(0,r.jsx)("div",{children:n.detail}),n.doneWhen&&(0,r.jsx)("div",{children:o("staticDoneWhen",{text:n.doneWhen})}),n.depends&&n.depends.length>0&&(0,r.jsx)("div",{children:o("staticDepends",{items:n.depends.map(N=>b.get(N)?.title).join(o("listSeparator"))})})]},n.id))})]},e.id):null})]})]})}function Ie({item:s,status:o,owner:i,lane:t,range:k,depends:l,dependents:m,onSelect:x,onClear:D}){let b=G(H);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"rm-detail-main",children:[(0,r.jsxs)("div",{className:"rm-meta",children:[i&&(0,r.jsx)("span",{className:"rm-pill",style:{background:i.color},children:i.label}),(0,r.jsxs)("span",{className:"rm-status",children:[(0,r.jsx)("i",{className:`rm-swatch rm-tone-${o.tone}`}),o.label,o.tone==="active"&&s.progress!==void 0&&(0,r.jsxs)(r.Fragment,{children:[" ","\xB7 ",b("progress",{percent:Math.round(s.progress*100)})]})]}),(0,r.jsxs)("span",{children:[k," \xB7 ",b("days",{count:Y(s)})]}),t&&(0,r.jsx)("span",{children:t.label}),(0,r.jsx)("button",{type:"button",className:"rm-close","aria-label":b("clearSelection"),onClick:D,children:"\xD7"})]}),(0,r.jsx)("h4",{children:s.title}),s.detail&&(0,r.jsx)("p",{children:s.detail}),s.basis&&(0,r.jsxs)("p",{className:"rm-basis",children:[(0,r.jsx)("b",{children:b("basis")})," ",s.basis]})]}),(0,r.jsxs)("div",{className:"rm-detail-side",children:[s.doneWhen&&(0,r.jsxs)("div",{children:[(0,r.jsx)("small",{children:b("doneWhen")}),(0,r.jsx)("p",{children:s.doneWhen})]}),l.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsx)("small",{children:b("depends")}),(0,r.jsx)("div",{className:"rm-links",children:l.map(c=>(0,r.jsx)("button",{type:"button",onClick:()=>x(c.id),children:c.title},c.id))})]}),m.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsx)("small",{children:b("unblocks")}),(0,r.jsx)("div",{className:"rm-links",children:m.map(c=>(0,r.jsx)("button",{type:"button",onClick:()=>x(c.id),children:c.title},c.id))})]}),s.tags&&s.tags.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsx)("small",{children:b("tags")}),(0,r.jsx)("div",{className:"rm-tags",children:s.tags.map(c=>(0,r.jsx)("span",{children:c},c))})]})]})]})}export{Ke as RoadmapBlock};
|