showai-reader 0.10.0-reader.oi4tdyjp → 0.10.0-reader.pb4kagun

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +1 -1
  2. package/chunks/CardGrid-TRO37NZO.js +2 -0
  3. package/chunks/CommandReference-YOBZ67AR.js +3 -0
  4. package/chunks/ComparisonMatrix-P3TVMSP7.js +1 -0
  5. package/chunks/{EventTimeline-EUOZGK5I.js → EventTimeline-PL6EEZLL.js} +1 -1
  6. package/chunks/{ExperimentTracker-ULN4Z5OW.js → ExperimentTracker-QLIXOBDQ.js} +1 -1
  7. package/chunks/{ExternalDiagram-6XIHKA7E.js → ExternalDiagram-ZTY4TDJJ.js} +3 -3
  8. package/chunks/{Flowchart-CLUQTGTM.js → Flowchart-PRS65CS3.js} +1 -1
  9. package/chunks/{G2Chart-DIG5VQML.js → G2Chart-TOPADKCR.js} +2 -2
  10. package/chunks/LayerDiagram-3CLVCITA.js +2 -0
  11. package/chunks/{Mindmap-6XNXEXFE.js → Mindmap-3XJLR4JB.js} +1 -1
  12. package/chunks/RichTextEditor-6ICZMOD6.js +156 -0
  13. package/chunks/{Roadmap-J643DY2U.js → Roadmap-SPBI3665.js} +1 -1
  14. package/chunks/{Scene3D-KGHIFPQH.js → Scene3D-MUQ74HZI.js} +2 -2
  15. package/chunks/SequenceDiagram-OOQN7BWQ.js +2 -0
  16. package/chunks/StatusTree-B6NZDDIZ.js +1 -0
  17. package/chunks/StepGuide-MWZV4NYU.js +1 -0
  18. package/chunks/StructureBrowser-CVA2IQML.js +3 -0
  19. package/chunks/{Waterfall-WQQRXMRH.js → Waterfall-B2BPYBF3.js} +1 -1
  20. package/chunks/chunk-2MWQ4I4F.js +1 -0
  21. package/chunks/chunk-4AKSPULD.js +9 -0
  22. package/chunks/{chunk-LXPCGURF.js → chunk-4RYRJOIW.js} +1 -1
  23. package/chunks/chunk-5CTTY5BQ.js +2 -0
  24. package/chunks/{chunk-57OQN4T3.js → chunk-6G2M37RQ.js} +1 -1
  25. package/chunks/chunk-AAGG3TEN.js +1 -0
  26. package/chunks/{chunk-5KANJNMG.js → chunk-BR33OQJ3.js} +1 -1
  27. package/chunks/chunk-GLP5VV7P.js +1 -0
  28. package/chunks/chunk-H7ALO2Q6.js +349 -0
  29. package/chunks/{chunk-HC6FTJAR.js.LEGAL.txt → chunk-H7ALO2Q6.js.LEGAL.txt} +3 -0
  30. package/chunks/{chunk-5HKZMSJF.js → chunk-KQR52I3G.js} +8 -8
  31. package/chunks/chunk-MLBEJ7IZ.js +1 -0
  32. package/chunks/{chunk-4M3FPEBB.js → chunk-PDHAXJXJ.js} +1 -1
  33. package/chunks/{chunk-A2JDK7HA.js → chunk-QD4XRUJK.js} +1 -1
  34. package/chunks/chunk-S7HOQGTC.js +4 -0
  35. package/chunks/{chunk-MCD72KVU.js → chunk-WP3ME37P.js} +2 -2
  36. package/chunks/chunk-XXZZVMLJ.js +1 -0
  37. package/index.js +1 -1
  38. package/manifest.json +5 -5
  39. package/package.json +1 -1
  40. package/reader-PB4KAGUN.js +51 -0
  41. package/chunks/CardGrid-AJZKUXS6.js +0 -2
  42. package/chunks/CommandReference-RV7YII3H.js +0 -3
  43. package/chunks/ComparisonMatrix-ZZD2G2AA.js +0 -1
  44. package/chunks/LayerDiagram-ERF2NRNM.js +0 -2
  45. package/chunks/RichTextEditor-6VUVXVYN.js +0 -156
  46. package/chunks/SequenceDiagram-G7UAIBJJ.js +0 -2
  47. package/chunks/StatusTree-BO3E5N3J.js +0 -1
  48. package/chunks/StepGuide-QYQ74I56.js +0 -1
  49. package/chunks/StructureBrowser-IKXDOONV.js +0 -3
  50. package/chunks/chunk-C2OMFGU2.js +0 -4
  51. package/chunks/chunk-HC6FTJAR.js +0 -21
  52. package/chunks/chunk-HPTQVBGO.js +0 -329
  53. package/chunks/chunk-JZTWI7SZ.js +0 -1
  54. package/chunks/chunk-KYWOOES7.js +0 -2
  55. package/chunks/chunk-NL63BEBA.js +0 -1
  56. package/chunks/chunk-WWRZIZ7N.js +0 -1
  57. package/reader-OI4TDYJP.js +0 -51
  58. /package/chunks/{G2Chart-DIG5VQML.js.LEGAL.txt → G2Chart-TOPADKCR.js.LEGAL.txt} +0 -0
  59. /package/chunks/{Scene3D-KGHIFPQH.js.LEGAL.txt → Scene3D-MUQ74HZI.js.LEGAL.txt} +0 -0
  60. /package/chunks/{chunk-KYWOOES7.js.LEGAL.txt → chunk-5CTTY5BQ.js.LEGAL.txt} +0 -0
  61. /package/chunks/{chunk-MCD72KVU.js.LEGAL.txt → chunk-WP3ME37P.js.LEGAL.txt} +0 -0
  62. /package/{reader-OI4TDYJP.js.LEGAL.txt → reader-PB4KAGUN.js.LEGAL.txt} +0 -0
@@ -1 +1 @@
1
- import{a as b,c as y,e as x}from"./chunk-WWRZIZ7N.js";var s=e=>{throw new Error(e)},E=e=>!!e&&typeof e=="object"&&!Array.isArray(e);function u(e,n,o){(typeof e!="string"||!e.trim())&&s(`${n} must be non-empty text.`),e.length>o&&s(`${n} must be at most ${o} characters.`)}function f(e,n,o){e!==void 0&&u(e,n,o)}function j(e,n,o,i=1){return(!Array.isArray(e)||e.length<i||e.length>o)&&s(`${n} must be an array of ${i} to ${o} items.`),e.forEach((l,a)=>{E(l)||s(`${n}[${a}] must be an object.`)}),e}function A(e,n,o){for(let i of Object.keys(e))n.includes(i)||s(`${o}.${i} is not a supported field.`)}function d(e,n){if(e===void 0)return;let[o]=x(e);o!==void 0&&s(`${n} links to ${o}; only http(s), mailto, # anchors and relative paths are allowed.`)}var w=["dir","file","object","array","field"],I=["name","kind","type","badge","summary","detail","example","exampleLang","children","open"],p={siblings:60,nodes:400,depth:8},g=e=>e.replace(/\/+$/,"")||e,T=e=>e.split("/").filter(Boolean).join("/"),C=e=>e.kind??(e.children?.length?"dir":"file");function U(e){let n=new Map,o=[],i=(l,a,m,h)=>{for(let t of l??[]){let c=(a?`${a}/`:"")+g(t.name),r={node:t,path:c,depth:m,parent:a,kind:C(t),children:[]};n.set(c,r),h.push(c),i(t.children,c,m+1,r.children)}};return i(e,null,0,o),{items:n,roots:o}}function L(e){f(e.caption,"caption",600),d(e.caption,"caption");let n=0,o=new Set,i=(l,a,m,h)=>{h>p.depth&&s(`${a} is nested deeper than ${p.depth} levels.`),j(l,a,p.siblings),l.forEach((t,c)=>{let r=`${a}[${c}]`;n+=1,n>p.nodes&&s(`The structure has more than ${p.nodes} nodes.`),A(t,I,r),u(t.name,`${r}.name`,80),g(t.name).includes("/")&&s(`${r}.name may only end with "/"; it is one path segment.`);let $=(m?`${m}/`:"")+g(t.name);o.has($)&&s(`${r}.name repeats the path ${$}; sibling names must be unique.`),o.add($),t.kind!==void 0&&!w.includes(t.kind)&&s(`${r}.kind must be one of ${w.join(", ")}.`),f(t.type,`${r}.type`,80),f(t.badge,`${r}.badge`,16),f(t.summary,`${r}.summary`,300),f(t.detail,`${r}.detail`,3e3),f(t.example,`${r}.example`,6e3),f(t.exampleLang,`${r}.exampleLang`,24),d(t.summary,`${r}.summary`),d(t.detail,`${r}.detail`),t.exampleLang!==void 0&&t.example===void 0&&s(`${r}.exampleLang needs ${r}.example.`),t.open!==void 0&&typeof t.open!="boolean"&&s(`${r}.open must be true or false.`),t.children!==void 0&&i(t.children,`${r}.children`,$,h+1)})};if(i(e.nodes,"nodes",null,1),e.initial!==void 0){u(e.initial,"initial",400);let l=T(e.initial);o.has(l)||s(`initial ${e.initial} does not match a node path.`)}}var k=["brand","teal","warm","violet","rose","slate"],S=["tile","row"],R=["icon","title","body","href","tag","tone"];function K(e){if(e.columns)return e.columns;let n=e.cards.length;return e.variant==="row"?n>3?2:1:n===4?2:Math.max(1,Math.min(3,n))}function D(e){e.variant!==void 0&&!S.includes(e.variant)&&s(`variant must be one of ${S.join(", ")}.`),e.columns!==void 0&&(!Number.isInteger(e.columns)||e.columns<1||e.columns>4)&&s("columns must be an integer from 1 to 4."),j(e.cards,"cards",24).forEach((n,o)=>{let i=`cards[${o}]`;A(n,R,i),u(n.title,`${i}.title`,80),u(n.body,`${i}.body`,400),f(n.icon,`${i}.icon`,8),f(n.tag,`${i}.tag`,16),n.tone!==void 0&&!k.includes(n.tone)&&s(`${i}.tone must be one of ${k.join(", ")}.`),n.href!==void 0?(u(n.href,`${i}.href`,2e3),b(n.href)||s(`${i}.href must be an http(s), mailto, # anchor or relative link.`),y(n.body).some(l=>l.type==="link")&&s(`${i}.body cannot contain links when the card has an href.`)):d(n.body,`${i}.body`)})}function M(e,n){return E(n)||s("Component data must be an object."),f(n.title,"title",120),e==="structure-browser"?L(n):e==="card-grid"?D(n):s(`Unknown document browsing component ${e}.`),n}export{g as a,T as b,U as c,k as d,K as e,M as f};
1
+ import{a as b,c as y,e as x}from"./chunk-MLBEJ7IZ.js";var s=e=>{throw new Error(e)},E=e=>!!e&&typeof e=="object"&&!Array.isArray(e);function u(e,n,o){(typeof e!="string"||!e.trim())&&s(`${n} must be non-empty text.`),e.length>o&&s(`${n} must be at most ${o} characters.`)}function f(e,n,o){e!==void 0&&u(e,n,o)}function j(e,n,o,i=1){return(!Array.isArray(e)||e.length<i||e.length>o)&&s(`${n} must be an array of ${i} to ${o} items.`),e.forEach((l,a)=>{E(l)||s(`${n}[${a}] must be an object.`)}),e}function A(e,n,o){for(let i of Object.keys(e))n.includes(i)||s(`${o}.${i} is not a supported field.`)}function d(e,n){if(e===void 0)return;let[o]=x(e);o!==void 0&&s(`${n} links to ${o}; only http(s), mailto, # anchors and relative paths are allowed.`)}var w=["dir","file","object","array","field"],I=["name","kind","type","badge","summary","detail","example","exampleLang","children","open"],p={siblings:60,nodes:400,depth:8},g=e=>e.replace(/\/+$/,"")||e,T=e=>e.split("/").filter(Boolean).join("/"),C=e=>e.kind??(e.children?.length?"dir":"file");function U(e){let n=new Map,o=[],i=(l,a,m,h)=>{for(let t of l??[]){let c=(a?`${a}/`:"")+g(t.name),r={node:t,path:c,depth:m,parent:a,kind:C(t),children:[]};n.set(c,r),h.push(c),i(t.children,c,m+1,r.children)}};return i(e,null,0,o),{items:n,roots:o}}function L(e){f(e.caption,"caption",600),d(e.caption,"caption");let n=0,o=new Set,i=(l,a,m,h)=>{h>p.depth&&s(`${a} is nested deeper than ${p.depth} levels.`),j(l,a,p.siblings),l.forEach((t,c)=>{let r=`${a}[${c}]`;n+=1,n>p.nodes&&s(`The structure has more than ${p.nodes} nodes.`),A(t,I,r),u(t.name,`${r}.name`,80),g(t.name).includes("/")&&s(`${r}.name may only end with "/"; it is one path segment.`);let $=(m?`${m}/`:"")+g(t.name);o.has($)&&s(`${r}.name repeats the path ${$}; sibling names must be unique.`),o.add($),t.kind!==void 0&&!w.includes(t.kind)&&s(`${r}.kind must be one of ${w.join(", ")}.`),f(t.type,`${r}.type`,80),f(t.badge,`${r}.badge`,16),f(t.summary,`${r}.summary`,300),f(t.detail,`${r}.detail`,3e3),f(t.example,`${r}.example`,6e3),f(t.exampleLang,`${r}.exampleLang`,24),d(t.summary,`${r}.summary`),d(t.detail,`${r}.detail`),t.exampleLang!==void 0&&t.example===void 0&&s(`${r}.exampleLang needs ${r}.example.`),t.open!==void 0&&typeof t.open!="boolean"&&s(`${r}.open must be true or false.`),t.children!==void 0&&i(t.children,`${r}.children`,$,h+1)})};if(i(e.nodes,"nodes",null,1),e.initial!==void 0){u(e.initial,"initial",400);let l=T(e.initial);o.has(l)||s(`initial ${e.initial} does not match a node path.`)}}var k=["brand","teal","warm","violet","rose","slate"],S=["tile","row"],R=["icon","title","body","href","tag","tone"];function K(e){if(e.columns)return e.columns;let n=e.cards.length;return e.variant==="row"?n>3?2:1:n===4?2:Math.max(1,Math.min(3,n))}function D(e){e.variant!==void 0&&!S.includes(e.variant)&&s(`variant must be one of ${S.join(", ")}.`),e.columns!==void 0&&(!Number.isInteger(e.columns)||e.columns<1||e.columns>4)&&s("columns must be an integer from 1 to 4."),j(e.cards,"cards",24).forEach((n,o)=>{let i=`cards[${o}]`;A(n,R,i),u(n.title,`${i}.title`,80),u(n.body,`${i}.body`,400),f(n.icon,`${i}.icon`,8),f(n.tag,`${i}.tag`,16),n.tone!==void 0&&!k.includes(n.tone)&&s(`${i}.tone must be one of ${k.join(", ")}.`),n.href!==void 0?(u(n.href,`${i}.href`,2e3),b(n.href)||s(`${i}.href must be an http(s), mailto, # anchor or relative link.`),y(n.body).some(l=>l.type==="link")&&s(`${i}.body cannot contain links when the card has an href.`)):d(n.body,`${i}.body`)})}function M(e,n){return E(n)||s("Component data must be an object."),f(n.title,"title",120),e==="structure-browser"?L(n):e==="card-grid"?D(n):s(`Unknown document browsing component ${e}.`),n}export{g as a,T as b,U as c,k as d,K as e,M as f};
@@ -0,0 +1,2 @@
1
+ var Ne=Object.defineProperty,Ke=(e,t,r)=>t in e?Ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Qe=(e,t)=>{for(var r in t)Ne(e,r,{get:t[r],enumerable:!0})},Ue=(e,t,r)=>Ke(e,typeof t!="symbol"?t+"":t,r),He={};Qe(He,{Graph:()=>P,alg:()=>te});var Ze=Object.defineProperty,xe=(e,t)=>{for(var r in t)Ze(e,r,{get:t[r],enumerable:!0})},ee=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected="directed"in e?e.directed:!0,this._isMultigraph="multigraph"in e?e.multigraph:!1,this._isCompound="compound"in e?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return typeof e!="function"?this._defaultNodeLabelFn=()=>e:this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(r=>{t!==void 0?this.setNode(r,t):this.setNode(r)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=r=>this.removeEdge(this._edgeObjs[r]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(r=>{this.setParent(r)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t===void 0)t="\0";else{t+="";for(let r=t;r!==void 0;r=this.parent(r))if(r===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!=="\0")return t}}children(e="\0"){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e==="\0")return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let r=new Set(t),n=this.successors(e);if(n)for(let i of n)r.add(i);return Array.from(r.values())}}isLeaf(e){var t;let r;return this.isDirected()?r=this.successors(e):r=this.neighbors(e),((t=r?.length)!=null?t:0)===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([i,o])=>{e(i)&&t.setNode(i,o)}),Object.values(this._edgeObjs).forEach(i=>{t.hasNode(i.v)&&t.hasNode(i.w)&&t.setEdge(i,this.edge(i))});let r={},n=i=>{let o=this.parent(i);return!o||t.hasNode(o)?(r[i]=o,o):o in r?r[o]:n(o)};return this._isCompound&&t.nodes().forEach(i=>t.setParent(i,n(i))),t}setDefaultEdgeLabel(e){return typeof e!="function"?this._defaultEdgeLabelFn=()=>e:this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((r,n)=>(t!==void 0?this.setEdge(r,n,t):this.setEdge(r,n),n)),this}setEdge(e,t,r,n){let i,o,s,l,a=!1;typeof e=="object"&&e!==null&&"v"in e?(i=e.v,o=e.w,s=e.name,arguments.length===2&&(l=t,a=!0)):(i=e,o=t,s=n,arguments.length>2&&(l=r,a=!0)),i=""+i,o=""+o,s!==void 0&&(s=""+s);let d=V(this._isDirected,i,o,s);if(d in this._edgeLabels)return a&&(this._edgeLabels[d]=l),this;if(s!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(i),this.setNode(o),this._edgeLabels[d]=a?l:this._defaultEdgeLabelFn(i,o,s);let u=et(this._isDirected,i,o,s);return i=u.v,o=u.w,Object.freeze(u),this._edgeObjs[d]=u,se(this._preds[o],i),se(this._sucs[i],o),this._in[o][d]=u,this._out[i][d]=u,this._edgeCount++,this}edge(e,t,r){let n=arguments.length===1?W(this._isDirected,e):V(this._isDirected,e,t,r);return this._edgeLabels[n]}edgeAsObj(e,t,r){let n=arguments.length===1?this.edge(e):this.edge(e,t,r);return typeof n!="object"||n===null?{label:n}:n}hasEdge(e,t,r){return(arguments.length===1?W(this._isDirected,e):V(this._isDirected,e,t,r))in this._edgeLabels}removeEdge(e,t,r){let n=arguments.length===1?W(this._isDirected,e):V(this._isDirected,e,t,r),i=this._edgeObjs[n];if(i){let o=i.v,s=i.w;delete this._edgeLabels[n],delete this._edgeObjs[n],le(this._preds[s],o),le(this._sucs[o],s),delete this._in[s][n],delete this._out[o][n],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,r){if(!e)return;let n=Object.values(e);return r?n.filter(i=>i.v===t&&i.w===r||i.v===r&&i.w===t):n}};function se(e,t){e[t]?e[t]++:e[t]=1}function le(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function V(e,t,r,n){let i=""+t,o=""+r;if(!e&&i>o){let s=i;i=o,o=s}return i+""+o+""+(n===void 0?"\0":n)}function et(e,t,r,n){let i=""+t,o=""+r;if(!e&&i>o){let l=i;i=o,o=l}let s={v:i,w:o};return n&&(s.name=n),s}function W(e,t){return V(e,t.v,t.w,t.name)}var tt={};xe(tt,{read:()=>ot,write:()=>rt});function rt(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:nt(e),edges:it(e)},r=e.graph();return r!==void 0&&(t.value=structuredClone(r)),t}function nt(e){return e.nodes().map(t=>{let r=e.node(t),n=e.parent(t),i={v:t};return r!==void 0&&(i.value=r),n!==void 0&&(i.parent=n),i})}function it(e){return e.edges().map(t=>{let r=e.edge(t),n={v:t.v,w:t.w};return t.name!==void 0&&(n.name=t.name),r!==void 0&&(n.value=r),n})}function ot(e){let t=new ee(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(r=>{t.setNode(r.v,r.value),r.parent&&t.setParent(r.v,r.parent)}),e.edges.forEach(r=>{t.setEdge({v:r.v,w:r.w,name:r.name},r.value)}),t}var te={};xe(te,{CycleException:()=>B,bellmanFord:()=>je,components:()=>dt,dijkstra:()=>G,dijkstraAll:()=>ht,findCycles:()=>ct,floydWarshall:()=>gt,isAcyclic:()=>vt,postorder:()=>wt,preorder:()=>Et,prim:()=>bt,shortestPaths:()=>yt,tarjan:()=>Ce,topsort:()=>Me});var st=()=>1;function je(e,t,r,n){return lt(e,String(t),r||st,n||function(i){var o;return(o=e.outEdges(i))!=null?o:[]})}function lt(e,t,r,n){let i={},o,s=0,l=e.nodes(),a=function(h){let c=i[h.v],f=i[h.w];if(!c||!f)return;let p=r(h);c.distance+p<f.distance&&(i[h.w]={distance:c.distance+p,predecessor:h.v},o=!0)},d=function(){l.forEach(function(h){n(h).forEach(function(c){let f=c.v===h?c.v:c.w,p=f===c.v?c.w:c.v;a({v:f,w:p})})})};l.forEach(function(h){let c=h===t?0:Number.POSITIVE_INFINITY;i[h]={distance:c,predecessor:""}});let u=l.length;for(let h=1;h<u&&(o=!1,s++,d(),!!o);h++);if(s===u-1&&(o=!1,d(),o))throw new Error("The graph contains a negative weight cycle");return i}function dt(e){let t={},r=[],n;function i(o){var s,l;o in t||(t[o]=!0,n.push(o),(s=e.successors(o))==null||s.forEach(i),(l=e.predecessors(o))==null||l.forEach(i))}return e.nodes().forEach(function(o){n=[],i(o),n.length&&r.push(n)}),r}var Ie=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,t){let r=this._keyIndices,n=String(e);if(!(n in r)){let i=this._arr,o=i.length;return r[n]=o,i.push({key:n,priority:t}),this._decrease(o),!0}return!1}removeMin(){if(this.size()===0)throw new Error("Queue underflow");this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let r=this._keyIndices[e];if(r===void 0)throw new Error(`Key not found: ${e}`);let n=this._arr[r].priority;if(t>n)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${n} New: ${t}`);this._arr[r].priority=t,this._decrease(r)}_heapify(e){let t=this._arr,r=2*e,n=r+1,i=e;r<t.length&&(i=t[r].priority<t[i].priority?r:i,n<t.length&&(i=t[n].priority<t[i].priority?n:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){let t=this._arr,r=t[e].priority,n;for(;e!==0&&(n=e>>1,!(t[n].priority<r));)this._swap(e,n),e=n}_swap(e,t){let r=this._arr,n=this._keyIndices,i=r[e],o=r[t];r[e]=o,r[t]=i,n[o.key]=e,n[i.key]=t}},at=()=>1;function G(e,t,r,n){let i=function(o){var s;return(s=e.outEdges(o))!=null?s:[]};return ut(e,String(t),r||at,n||i)}function ut(e,t,r,n){let i={},o=new Ie,s,l,a=function(d){let u=d.v!==s?d.v:d.w,h=i[u];if(!h)return;let c=r(d),f=l.distance+c;if(c<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+d+" Weight: "+c);f<h.distance&&(h.distance=f,h.predecessor=s,o.decrease(u,f))};for(e.nodes().forEach(function(d){let u=d===t?0:Number.POSITIVE_INFINITY;i[d]={distance:u,predecessor:""},o.add(d,u)});o.size()>0;){s=o.removeMin();let d=i[s];if(!d||d.distance===Number.POSITIVE_INFINITY)break;l=d,n(s).forEach(a)}return i}function ht(e,t,r){return e.nodes().reduce(function(n,i){return n[i]=G(e,i,t,r),n},{})}function Ce(e){let t=0,r=[],n={},i=[];function o(s){var l;let a=n[s]={onStack:!0,lowlink:t,index:t++};if(r.push(s),(l=e.successors(s))==null||l.forEach(function(d){if(d in n){let u=n[d];u!=null&&u.onStack&&(a.lowlink=Math.min(a.lowlink,u.index))}else{o(d);let u=n[d];u&&(a.lowlink=Math.min(a.lowlink,u.lowlink))}}),a.lowlink===a.index){let d=[],u;do{u=r.pop();let h=n[u];h&&(h.onStack=!1),d.push(u)}while(s!==u);i.push(d)}}return e.nodes().forEach(function(s){s in n||o(s)}),i}function ct(e){return Ce(e).filter(function(t){var r;let n=t[0];return n?t.length>1||t.length===1&&((r=e.outEdges(n,n))!=null?r:[]).length>0:!1})}var ft=()=>1;function gt(e,t,r){return pt(e,t||ft,r||function(n){var i;return(i=e.outEdges(n))!=null?i:[]})}function pt(e,t,r){let n={},i=e.nodes();return i.forEach(function(o){let s={};n[o]=s,s[o]={distance:0,predecessor:""},i.forEach(function(l){o!==l&&(s[l]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),r(o).forEach(function(l){let a=l.v===o?l.w:l.v,d=t(l);s[a]={distance:d,predecessor:o}})}),i.forEach(function(o){let s=n[o];s&&i.forEach(function(l){let a=n[l];a&&i.forEach(function(d){let u=a[o],h=s[d],c=a[d];if(u&&h&&c){let f=u.distance+h.distance;f<c.distance&&(c.distance=f,c.predecessor=h.predecessor)}})})}),n}var B=class extends Error{constructor(e){super(e),this.name="CycleException"}};function Me(e){let t={},r={},n=[];function i(o){var s;if(o in r)throw new B;o in t||(r[o]=!0,t[o]=!0,(s=e.predecessors(o))==null||s.forEach(i),delete r[o],n.push(o))}if(e.sinks().forEach(i),Object.keys(t).length!==e.nodeCount())throw new B;return n}function vt(e){try{Me(e)}catch(t){if(t instanceof B)return!1;throw t}return!0}function mt(e,t,r,n,i){Array.isArray(t)||(t=[t]);let o=(l=>{var a;return(a=e.isDirected()?e.successors(l):e.neighbors(l))!=null?a:[]}),s={};return t.forEach(function(l){if(!e.hasNode(l))throw new Error("Graph does not have node: "+l);i=Le(e,l,r==="post",s,o,n,i)}),i}function Le(e,t,r,n,i,o,s){return t in n||(n[t]=!0,r||(s=o(s,t)),i(t).forEach(function(l){s=Le(e,l,r,n,i,o,s)}),r&&(s=o(s,t))),s}function Se(e,t,r){return mt(e,t,r,function(n,i){return n.push(i),n},[])}function wt(e,t){return Se(e,t,"post")}function Et(e,t){return Se(e,t,"pre")}function bt(e,t){var r;let n=new ee,i={},o=new Ie,s;function l(u){let h=u.v===s?u.w:u.v,c=o.priority(h);if(c!==void 0){let f=t(u);f<c&&(i[h]=s,o.decrease(h,f))}}if(e.nodeCount()===0)return n;e.nodes().forEach(function(u){o.add(u,Number.POSITIVE_INFINITY),n.setNode(u)});let a=e.nodes()[0];a!==void 0&&o.decrease(a,0);let d=!1;for(;o.size()>0;){if(s=o.removeMin(),s in i)n.setEdge(s,i[s]);else{if(d)throw new Error("Input graph is not connected: "+e);d=!0}(r=e.nodeEdges(s))==null||r.forEach(l)}return n}function yt(e,t,r,n){return _t(e,t,r,n??(i=>{var o;return(o=e.outEdges(i))!=null?o:[]}))}function _t(e,t,r,n){if(r===void 0)return G(e,t,r,n);let i=!1,o=e.nodes();for(let s=0;s<o.length;s++){let l=o[s];if(l===void 0)continue;let a=n(l);for(let d=0;d<a.length;d++){let u=a[d];if(!u)continue;let h=u.v===l?u.v:u.w,c=h===u.v?u.w:u.v;r({v:h,w:c})<0&&(i=!0)}if(i)return je(e,t,r,n)}return G(e,t,r,n)}var P=ee;function Y(e,t,r,n){let i=n;for(;e.hasNode(i);)i=re(n);return r.dummy=t,e.setNode(i,r),i}function kt(e){let t=new P().setGraph(e.graph());return e.nodes().forEach(r=>t.setNode(r,e.node(r))),e.edges().forEach(r=>{let n=t.edge(r.v,r.w)||{weight:0,minlen:1},i=e.edge(r);t.setEdge(r.v,r.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),t}function Te(e){let t=new P({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(r=>{e.children(r).length||t.setNode(r,e.node(r))}),e.edges().forEach(r=>{t.setEdge(r,e.edge(r))}),t}function de(e,t){let r=e.x,n=e.y,i=t.x-r,o=t.y-n,s=e.width/2,l=e.height/2;if(!i&&!o)throw new Error("Not possible to find intersection inside of the rectangle");let a,d;return Math.abs(o)*s>Math.abs(i)*l?(o<0&&(l=-l),a=l*i/o,d=l):(i<0&&(s=-s),a=s,d=s*o/i),{x:r+a,y:n+d}}function q(e){let t=A(Fe(e)+1).map(()=>[]);return e.nodes().forEach(r=>{let n=e.node(r),i=n.rank;i!==void 0&&(t[i]||(t[i]=[]),t[i][n.order]=r)}),t}function Ot(e){let t=e.nodes().map(n=>{let i=e.node(n).rank;return i===void 0?Number.MAX_VALUE:i}),r=T(Math.min,t);e.nodes().forEach(n=>{let i=e.node(n);Object.hasOwn(i,"rank")&&(i.rank-=r)})}function Nt(e){let t=e.nodes().map(s=>e.node(s).rank).filter(s=>s!==void 0),r=T(Math.min,t),n=[];e.nodes().forEach(s=>{let l=e.node(s).rank-r;n[l]||(n[l]=[]),n[l].push(s)});let i=0,o=e.graph().nodeRankFactor;Array.from(n).forEach((s,l)=>{s===void 0&&l%o!==0?--i:s!==void 0&&i&&s.forEach(a=>e.node(a).rank+=i)})}function ae(e,t,r,n){let i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=n),Y(e,"border",i,t)}function xt(e,t=Pe){let r=[];for(let n=0;n<e.length;n+=t){let i=e.slice(n,n+t);r.push(i)}return r}var Pe=65535;function T(e,t){if(t.length>Pe){let r=xt(t);return e(...r.map(n=>e(...n)))}else return e(...t)}function Fe(e){let t=e.nodes().map(r=>{let n=e.node(r).rank;return n===void 0?Number.MIN_VALUE:n});return T(Math.max,t)}function jt(e,t){let r={lhs:[],rhs:[]};return e.forEach(n=>{t(n)?r.lhs.push(n):r.rhs.push(n)}),r}function It(e,t){return t()}var Ct=0;function re(e){let t=++Ct;return e+(""+t)}function A(e,t,r=1){t==null&&(t=e,e=0);let n=o=>o<t;r<0&&(n=o=>t<o);let i=[];for(let o=e;n(o);o+=r)i.push(o);return i}function z(e,t){let r={};for(let n of t)e[n]!==void 0&&(r[n]=e[n]);return r}function $(e,t){let r;return typeof t=="string"?r=n=>n[t]:r=t,Object.entries(e).reduce((n,[i,o])=>(n[i]=r(o,i),n),{})}function Mt(e,t){return e.reduce((r,n,i)=>(r[n]=t[i],r),{})}var X="\0";function Re(e,t,r){var n,i,o,s,l,a;if(!(e&&t&&r&&t.dummy==="edge"&&r.dummy==="edge"&&t.edgeObj&&r.edgeObj&&e[t.edgeObj.v]&&e[r.edgeObj.v]&&e[t.edgeObj.w]&&e[r.edgeObj.w]))return 0;let d=!0;t.edgeObj.w===r.edgeObj.w&&(d=!1);let u=d?(i=(n=e[t.edgeObj.v])==null?void 0:n.rank)!=null?i:NaN+1:(s=(o=e[t.edgeObj.w])==null?void 0:o.rank)!=null?s:NaN-1,h=Object.entries(e).find(b=>{var y,w;return((y=b[1].edgeObj)==null?void 0:y.v)===t.edgeObj.v&&((w=b[1].edgeObj)==null?void 0:w.w)===t.edgeObj.w&&b[1].rank===u}),c=Object.entries(e).find(b=>{var y,w;return((y=b[1].edgeObj)==null?void 0:y.v)===r.edgeObj.v&&((w=b[1].edgeObj)==null?void 0:w.w)===r.edgeObj.w&&b[1].rank===u});if(!h||!c)return 0;let f=(l=h[1].order)!=null?l:NaN,p=(a=c[1].order)!=null?a:NaN;return isNaN(f-p)?0:f-p}var Lt=class{constructor(){Ue(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return ue(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&ue(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,r=t._prev;for(;r!==t;)e.push(JSON.stringify(r,St)),r=r._prev;return"["+e.join(", ")+"]"}};function ue(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function St(e,t){if(e!=="_next"&&e!=="_prev")return t}var Tt=Lt,Pt=()=>1;function Ft(e,t){if(e.nodeCount()<=1)return[];let r=Dt(e,t||Pt);return Rt(r.graph,r.buckets,r.zeroIdx).flatMap(n=>e.outEdges(n.v,n.w)||[])}function Rt(e,t,r){var n;let i=[],o=t[t.length-1],s=t[0],l;for(;e.nodeCount();){for(;l=s.dequeue();)J(e,t,r,l);for(;l=o.dequeue();)J(e,t,r,l);if(e.nodeCount()){for(let a=t.length-2;a>0;--a)if(l=(n=t[a])==null?void 0:n.dequeue(),l){i=i.concat(J(e,t,r,l,!0)||[]);break}}}return i}function J(e,t,r,n,i){let o=[],s=i?o:void 0;return(e.inEdges(n.v)||[]).forEach(l=>{let a=e.edge(l),d=e.node(l.v);i&&o.push({v:l.v,w:l.w}),d.out-=a,Z(t,r,d)}),(e.outEdges(n.v)||[]).forEach(l=>{let a=e.edge(l),d=l.w,u=e.node(d);u.in-=a,Z(t,r,u)}),e.removeNode(n.v),s}function Dt(e,t){let r=new P,n=0,i=0;e.nodes().forEach(l=>{r.setNode(l,{v:l,in:0,out:0})}),e.edges().forEach(l=>{let a=r.edge(l.v,l.w)||0,d=t(l),u=a+d;r.setEdge(l.v,l.w,u);let h=r.node(l.v),c=r.node(l.w);i=Math.max(i,h.out+=d),n=Math.max(n,c.in+=d)});let o=Yt(i+n+3).map(()=>new Tt),s=n+1;return r.nodes().forEach(l=>{Z(o,s,r.node(l))}),{graph:r,buckets:o,zeroIdx:s}}function Z(e,t,r){var n,i,o;r.out?r.in?(o=e[r.out-r.in+t])==null||o.enqueue(r):(i=e[e.length-1])==null||i.enqueue(r):(n=e[0])==null||n.enqueue(r)}function Yt(e){let t=[];for(let r=0;r<e;r++)t.push(r);return t}function Vt(e,t){(e.graph().acyclicer==="greedy"?Ft(e,r(e)):At(e,t??null)).forEach(n=>{let i=e.edge(n);e.removeEdge(n),i.forwardName=n.name,i.reversed=!0,e.setEdge(n.w,n.v,i,re("rev"))});function r(n){return i=>n.edge(i).weight}}function At(e,t){let r=[],n={},i={};function o(a){Object.hasOwn(i,a)||(i[a]=!0,n[a]=!0,e.outEdges(a).forEach(d=>{Object.hasOwn(n,d.w)?r.push(d):o(d.w)}),delete n[a])}function s(a){var d;Object.hasOwn(i,a)||(i[a]=!0,n[a]=!0,(d=e.outEdges(a))==null||d.forEach(u=>{var h,c;Object.hasOwn(n,u.w)||((h=t.node(a))==null?void 0:h.rank)>((c=t.node(u.w))==null?void 0:c.rank)&&Bt(e,u.w,u)?r.push(u):s(u.w)}),delete n[a])}let l=o;return t&&typeof t.node=="function"&&(l=s),e.sources().forEach(l),e.nodes().forEach(l),r}function Gt(e){e.edges().forEach(t=>{let r=e.edge(t);if(r.reversed){e.removeEdge(t);let n=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(t.w,t.v,r,n)}})}function Bt(e,t,r){let n=new Set;function i(o){var s;if(e.sources().includes(o))return!0;n.add(o);for(let l of(s=e.inEdges(o))!=null?s:[])if(!(l.v===r.v&&l.w===r.w)&&!n.has(l.v)&&i(l.v))return!0;return!1}return i(t)}function zt(e){e.graph().dummyChains=[],e.edges().forEach(t=>qt(e,t))}function qt(e,t){let r=t.v,n=e.node(r).rank,i=t.w,o=e.node(i).rank,s=t.name,l=e.edge(t),a=l.labelRank;if(o===n+1)return;e.removeEdge(t);let d,u,h;for(h=0,++n;n<o;++h,++n)l.points=[],u={width:0,height:0,edgeLabel:l,edgeObj:t,rank:n},d=Y(e,"edge",u,"_d"),n===a&&(u.width=l.width,u.height=l.height,u.dummy="edge-label",u.labelpos=l.labelpos),e.setEdge(r,d,{weight:l.weight},s),h===0&&e.graph().dummyChains.push(d),r=d;e.setEdge(r,i,{weight:l.weight},s)}function $t(e){e.graph().dummyChains.forEach(t=>{let r=e.node(t),n=r.edgeLabel,i;for(e.setEdge(r.edgeObj,n);r.dummy;)i=e.successors(t)[0],e.removeNode(t),n.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(n.x=r.x,n.y=r.y,n.width=r.width,n.height=r.height),t=i,r=e.node(t)})}function ne(e){let t={};function r(n){let i=e.node(n);if(Object.hasOwn(t,n))return i.rank;t[n]=!0;let o=e.outEdges(n),s=o?o.map(a=>a==null?Number.POSITIVE_INFINITY:r(a.w)-e.edge(a).minlen):[],l=T(Math.min,s);return l===Number.POSITIVE_INFINITY&&(l=0),i.rank=l}e.sources().forEach(r)}function D(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var De=Xt;function Xt(e){let t=new P({directed:!1}),r=e.nodes();if(r.length===0)throw new Error("Graph must have at least one node");let n=r[0],i=e.nodeCount();t.setNode(n,{});let o,s;for(;Wt(t,e)<i&&(o=Jt(t,e),!!o);)s=t.hasNode(o.v)?D(e,o):-D(e,o),Kt(t,e,s);return t}function Wt(e,t){function r(n){let i=t.nodeEdges(n);i&&i.forEach(o=>{let s=o.v,l=n===s?o.w:s;!e.hasNode(l)&&!D(t,o)&&(e.setNode(l,{}),e.setEdge(n,l,{}),r(l))})}return e.nodes().forEach(r),e.nodeCount()}function Jt(e,t){return t.edges().reduce((r,n)=>{let i=Number.POSITIVE_INFINITY;return e.hasNode(n.v)!==e.hasNode(n.w)&&(i=D(t,n)),i<r[0]?[i,n]:r},[Number.POSITIVE_INFINITY,null])[1]}function Kt(e,t,r){e.nodes().forEach(n=>t.node(n).rank+=r)}var{preorder:Qt,postorder:Ut}=te,Ht=F;F.initLowLimValues=oe;F.initCutValues=ie;F.calcCutValue=Ye;F.leaveEdge=Ae;F.enterEdge=Ge;F.exchangeEdges=Be;function F(e){e=kt(e),ne(e);let t=De(e);oe(t),ie(t,e);let r,n;for(;r=Ae(t);)n=Ge(t,e,r),Be(t,e,r,n)}function ie(e,t){let r=Ut(e,e.nodes());r=r.slice(0,r.length-1),r.forEach(n=>Zt(e,t,n))}function Zt(e,t,r){let n=e.node(r).parent,i=e.edge(r,n);i.cutvalue=Ye(e,t,r)}function Ye(e,t,r){let n=e.node(r).parent,i=!0,o=t.edge(r,n),s=0;o||(i=!1,o=t.edge(n,r)),s=o.weight;let l=t.nodeEdges(r);return l&&l.forEach(a=>{let d=a.v===r,u=d?a.w:a.v;if(u!==n){let h=d===i,c=t.edge(a).weight;if(s+=h?c:-c,tr(e,r,u)){let f=e.edge(r,u).cutvalue;s+=h?-f:f}}}),s}function oe(e,t){arguments.length<2&&(t=e.nodes()[0]),Ve(e,{},1,t)}function Ve(e,t,r,n,i){let o=r,s=e.node(n);t[n]=!0;let l=e.neighbors(n);return l&&l.forEach(a=>{Object.hasOwn(t,a)||(r=Ve(e,t,r,a,n))}),s.low=o,s.lim=r++,i?s.parent=i:delete s.parent,r}function Ae(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function Ge(e,t,r){let n=r.v,i=r.w;t.hasEdge(n,i)||(n=r.w,i=r.v);let o=e.node(n),s=e.node(i),l=o,a=!1;return o.lim>s.lim&&(l=s,a=!0),t.edges().filter(d=>a===he(e,e.node(d.v),l)&&a!==he(e,e.node(d.w),l)).reduce((d,u)=>D(t,u)<D(t,d)?u:d)}function Be(e,t,r,n){let i=r.v,o=r.w;e.removeEdge(i,o),e.setEdge(n.v,n.w,{}),oe(e),ie(e,t),er(e,t)}function er(e,t){let r=e.nodes().find(i=>!e.node(i).parent);if(!r)return;let n=Qt(e,[r]);n=n.slice(1),n.forEach(i=>{let o=e.node(i).parent,s=t.edge(i,o),l=!1;s||(s=t.edge(o,i),l=!0),t.node(i).rank=t.node(o).rank+(l?s.minlen:-s.minlen)})}function tr(e,t,r){return e.hasEdge(t,r)}function he(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}var rr=nr;function nr(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":ce(e);break;case"tight-tree":or(e);break;case"longest-path":ir(e);break;case"none":break;default:ce(e)}}var ir=ne;function or(e){ne(e),De(e)}function ce(e){Ht(e)}var sr=lr;function lr(e){let t=ar(e),r=e.graph();Array.isArray(r.dummyChains)&&r.dummyChains.forEach(n=>{let i=e.node(n),o=i.edgeObj,s=dr(e,t,o.v,o.w),l=s.path,a=s.lca,d=0,u=l[d],h=!0;for(;n!==o.w;){if(i=e.node(n),h){for(;(u=l[d])!==a&&e.node(u).maxRank<i.rank;)d++;u===a&&(h=!1)}if(!h){for(;d<l.length-1&&e.node(l[d+1]).minRank<=i.rank;)d++;u=l[d]}u!==void 0&&e.setParent(n,u),n=e.successors(n)[0]}})}function dr(e,t,r,n){let i=[],o=[],s=Math.min(t[r].low,t[n].low),l=Math.max(t[r].lim,t[n].lim),a;a=r;do a=e.parent(a),i.push(a);while(a&&(t[a].low>s||l>t[a].lim));let d=a,u=n;for(;(u=e.parent(u))!==d;)o.push(u);return{path:i.concat(o.reverse()),lca:d}}function ar(e){let t={},r=0;function n(i){let o=r;e.children(i).forEach(n),t[i]={low:o,lim:r++}}return e.children(X).forEach(n),t}function ur(e){let t=Y(e,"root",{},"_root"),r=hr(e),n=Object.values(r),i=T(Math.max,n)-1,o=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(l=>e.edge(l).minlen*=o);let s=cr(e)+1;e.children(X).forEach(l=>{ze(e,t,o,s,i,r,l)}),e.graph().nodeRankFactor=o}function ze(e,t,r,n,i,o,s){var l;let a=e.children(s);if(!a.length){s!==t&&e.setEdge(t,s,{weight:0,minlen:r});return}let d=ae(e,"_bt"),u=ae(e,"_bb"),h=e.node(s);e.setParent(d,s),h.borderTop=d,e.setParent(u,s),h.borderBottom=u,a.forEach(c=>{var f;ze(e,t,r,n,i,o,c);let p=e.node(c),b=p.borderTop?p.borderTop:c,y=p.borderBottom?p.borderBottom:c,w=p.borderTop?n:2*n,g=b!==y?1:i-((f=o[s])!=null?f:0)+1;e.setEdge(d,b,{weight:w,minlen:g,nestingEdge:!0}),e.setEdge(y,u,{weight:w,minlen:g,nestingEdge:!0})}),e.parent(s)||e.setEdge(t,d,{weight:0,minlen:i+((l=o[s])!=null?l:0)})}function hr(e){let t={};function r(n,i){let o=e.children(n);o&&o.length&&o.forEach(s=>r(s,i+1)),t[n]=i}return e.children(X).forEach(n=>r(n,1)),t}function cr(e){return e.edges().reduce((t,r)=>t+e.edge(r).weight,0)}function fr(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(r=>{e.edge(r).nestingEdge&&e.removeEdge(r)})}var gr=pr;function pr(e){function t(r){let n=e.children(r),i=e.node(r);if(n.length&&n.forEach(t),i&&Object.hasOwn(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(let o=i.minRank,s=i.maxRank+1;o<s;++o)fe(e,"borderLeft","_bl",r,i,o),fe(e,"borderRight","_br",r,i,o)}}e.children(X).forEach(t)}function fe(e,t,r,n,i,o){let s={width:0,height:0,rank:o,borderType:t},l=i[t][o-1],a=Y(e,"border",s,r);i[t][o]=a,e.setParent(a,n),l&&e.setEdge(l,a,{weight:1})}function vr(e){var t;let r=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(r==="lr"||r==="rl")&&qe(e)}function mr(e){var t;let r=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(r==="bt"||r==="rl")&&wr(e),(r==="lr"||r==="rl")&&(Er(e),qe(e))}function qe(e){e.nodes().forEach(t=>ge(e.node(t))),e.edges().forEach(t=>ge(e.edge(t)))}function ge(e){let t=e.width;e.width=e.height,e.height=t}function wr(e){e.nodes().forEach(t=>K(e.node(t))),e.edges().forEach(t=>{var r;let n=e.edge(t);(r=n.points)==null||r.forEach(K),Object.hasOwn(n,"y")&&K(n)})}function K(e){e.y=-e.y}function Er(e){e.nodes().forEach(t=>Q(e.node(t))),e.edges().forEach(t=>{var r;let n=e.edge(t);(r=n.points)==null||r.forEach(Q),Object.hasOwn(n,"x")&&Q(n)})}function Q(e){let t=e.x;e.x=e.y,e.y=t}function br(e,t=null){let r={},n=e.nodes().filter(d=>!e.children(d).length),i=n.map(d=>e.node(d).rank),o=T(Math.max,i),s=A(o+1).map(()=>[]);function l(d){if(r[d])return;r[d]=!0;let u=e.node(d);s[u.rank].push(d);let h=e.successors(d);h&&[...h].sort((c,f)=>a(c,f)).forEach(l)}n.sort((d,u)=>e.node(d).rank-e.node(u).rank).forEach(l);function a(d,u){let h=e.node(d),c=e.node(u);return Re(t,h,c)}return s}function yr(e,t){let r=0;for(let n=1;n<t.length;++n)r+=_r(e,t[n-1],t[n]);return r}function _r(e,t,r){let n=Mt(r,r.map((d,u)=>u)),i=t.flatMap(d=>{let u=e.outEdges(d);return u?u.map(h=>({pos:n[h.w],weight:e.edge(h).weight})).sort((h,c)=>h.pos-c.pos):[]}),o=1;for(;o<r.length;)o<<=1;let s=2*o-1;o-=1;let l=new Array(s).fill(0),a=0;return i.forEach(d=>{let u=d.pos+o;l[u]+=d.weight;let h=0;for(;u>0;)u%2&&(h+=l[u+1]),u=u-1>>1,l[u]+=d.weight;a+=d.weight*h}),a}function kr(e,t=[]){return t.map(r=>{let n=e.inEdges(r);if(!n||!n.length)return{v:r};{let i=n.reduce((o,s)=>{let l=e.edge(s),a=e.node(s.v);return{sum:o.sum+l.weight*a.order,weight:o.weight+l.weight}},{sum:0,weight:0});return{v:r,barycenter:i.sum/i.weight,weight:i.weight}}})}function Or(e,t){let r={};e.forEach((i,o)=>{let s={indegree:0,in:[],out:[],vs:[i.v],i:o};i.barycenter!==void 0&&(s.barycenter=i.barycenter,s.weight=i.weight),r[i.v]=s}),t.edges().forEach(i=>{let o=r[i.v],s=r[i.w];o!==void 0&&s!==void 0&&(s.indegree++,o.out.push(s))});let n=Object.values(r).filter(i=>!i.indegree);return Nr(n)}function Nr(e){let t=[];function r(i){return o=>{o.merged||(o.barycenter===void 0||i.barycenter===void 0||o.barycenter>=i.barycenter)&&xr(i,o)}}function n(i){return o=>{o.in.push(i),--o.indegree===0&&e.push(o)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(r(i)),i.out.forEach(n(i))}return t.filter(i=>!i.merged).map(i=>z(i,["vs","i","barycenter","weight"]))}function xr(e,t){let r=0,n=0;e.weight&&(r+=e.barycenter*e.weight,n+=e.weight),t.weight&&(r+=t.barycenter*t.weight,n+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=r/n,e.weight=n,e.i=Math.min(t.i,e.i),t.merged=!0}function jr(e,t,r,n,i){let o={},s=null,l=null,a=i;typeof t=="boolean"?(a=t,o={}):t&&(o=t,s=r??null,l=n??null);let d=jt(e,w=>Object.hasOwn(w,"barycenter")),u=d.lhs,h=d.rhs.sort((w,g)=>g.i-w.i),c=[],f=0,p=0,b=0;u.sort(Ir(l,s,!!a));for(let[w,g]of Object.entries(o)){let v=u.findIndex(m=>m.vs[0]===w);u.splice(v+1,0,g)}b=pe(c,h,b),u.forEach(w=>{b+=w.vs.length,c.push(w.vs),f+=w.barycenter*w.weight,p+=w.weight,b=pe(c,h,b)});let y={vs:c.flat(1)};return p&&(y.barycenter=f/p,y.weight=p),y}function pe(e,t,r){let n;for(;t.length&&(n=t[t.length-1]).i<=r;)t.pop(),e.push(n.vs),r++;return r}function Ir(e,t,r){return(n,i)=>{if(n.barycenter<i.barycenter)return-1;if(n.barycenter>i.barycenter)return 1;if(e&&(typeof n.vs[0]=="string"||typeof i.vs[0]=="string")){let o=e.node(n.vs[0]),s=e.node(i.vs[0]),l=Re(t,o,s);if(l!==0)return l}return r?i.i-n.i:n.i-i.i}}function $e(e,t,r,n,i){var o,s,l,a,d,u,h,c,f,p,b;let y=null,w=i;typeof n=="boolean"?(w=n,y=null):n!==void 0&&(y=n);let g=e.children(t),v=e.node(t),m=v?v.borderLeft:void 0,E=v?v.borderRight:void 0,N={};m&&(g=g.filter(O=>O!==m&&O!==E));let L=kr(e,g);L.forEach(O=>{if(e.children(O.v).length){let{result:I}=$e(e,O.v,r,y,w);N[O.v]=I,Object.hasOwn(I,"barycenter")&&Mr(O,I)}});let _=Or(L,r);Cr(_,N);let M={},S=!1;for(let O=0;O<_.length;O++)for(let I=O+1;I<_.length;I++)if(!(!_[O]||!_[I]||!((o=_[O])!=null&&o.barycenter)||!((s=_[I])!=null&&s.barycenter))&&((l=_[O])==null?void 0:l.barycenter)===_[I].barycenter){let x=(d=(a=_[O])==null?void 0:a.vs[0])!=null?d:"",k=(h=(u=_[I])==null?void 0:u.vs[0])!=null?h:"",C=e.node(x),R=e.node(k);if(C.dummy==="edge"&&R.dummy==="edge"&&((c=C.edgeObj)==null?void 0:c.v)===((f=R.edgeObj)==null?void 0:f.v)&&((p=C.edgeObj)==null?void 0:p.w)===((b=R.edgeObj)==null?void 0:b.w))if(C.edgeLabel.reversed){M[k]=_[O],_.splice(O,1),O--;break}else M[x]=_[I],_.splice(I,1),I--;else S=!0}let j=jr(_,M,y,e,w);if(m&&E){j.vs=[m,j.vs,E].flat(1);let O=e.predecessors(m);if(O&&O.length){let I=e.node(O[0]),x=e.predecessors(E),k=e.node(x[0]);Object.hasOwn(j,"barycenter")||(j.barycenter=0,j.weight=0),j.barycenter=(j.barycenter*j.weight+I.order+k.order)/(j.weight+2),j.weight+=2}}return Object.defineProperty(j,"result",{value:j,enumerable:!1,configurable:!0,writable:!0}),Object.defineProperty(j,"usedBias",{value:S,enumerable:!1,configurable:!0,writable:!0}),j}function Cr(e,t){e.forEach(r=>{r.vs=r.vs.flatMap(n=>t[n]?t[n].vs:n)})}function Mr(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}function Lr(e,t,r,n){n||(n=e.nodes());let i=Sr(e),o=new P({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(s=>e.node(s));return n.forEach(s=>{let l=e.node(s),a=e.parent(s);if(l.rank===t||l.minRank<=t&&t<=l.maxRank){o.setNode(s),o.setParent(s,a||i);let d=e[r](s);d&&d.forEach(u=>{let h=u.v===s?u.w:u.v,c=o.edge(h,s),f=c!==void 0?c.weight:0;o.setEdge(h,s,{weight:e.edge(u).weight+f})}),Object.hasOwn(l,"minRank")&&o.setNode(s,{borderLeft:l.borderLeft[t],borderRight:l.borderRight[t]})}}),o}function Sr(e){let t;for(;e.hasNode(t=re("_root")););return t}function Tr(e,t,r){let n={},i;r.forEach(o=>{let s=e.parent(o),l,a;for(;s;){if(l=e.parent(s),l?(a=n[l],n[l]=s):(a=i,i=s),a&&a!==s){t.setEdge(a,s);return}s=l}})}function Xe(e,t={},r=null){if(typeof t.customOrder=="function"){t.customOrder(e,Xe);return}let n=Fe(e),i=ve(e,A(1,n+1),"inEdges"),o=ve(e,A(n-1,-1,-1),"outEdges"),s=br(e,r);if(me(e,s),t.disableOptimalOrderHeuristic)return;let l=Number.POSITIVE_INFINITY,a,d=t.constraints||[];for(let u=0,h=0;h<4;++u,++h){Pr(u%2?i:o,u%4>=2,d,r),s=q(e);let c=yr(e,s);c<l?(h=0,a=Object.assign({},s),l=c):c===l&&(a=structuredClone(s))}me(e,a)}function ve(e,t,r){let n=new Map,i=(o,s)=>{n.has(o)||n.set(o,[]),n.get(o).push(s)};for(let o of e.nodes()){let s=e.node(o);if(typeof s.rank=="number"&&i(s.rank,o),typeof s.minRank=="number"&&typeof s.maxRank=="number")for(let l=s.minRank;l<=s.maxRank;l++)l!==s.rank&&i(l,o)}return t.map(function(o){return Lr(e,o,r,n.get(o)||[])})}function Pr(e,t,r,n){let i=!0,o=new P;e.forEach(function(s){r.forEach(u=>o.setEdge(u.left,u.right));let l=s.graph().root,{result:a,usedBias:d}=$e(s,l,o,n,i);t&&d&&(i=!i),a.vs.forEach((u,h)=>s.node(u).order=h),Tr(s,o,a.vs)})}function me(e,t){Object.values(t).forEach(r=>r.forEach((n,i)=>e.node(n).order=i))}function Fr(e,t){let r={};function n(i,o){let s=0,l=0,a=i.length,d=o[o.length-1];return o.forEach((u,h)=>{let c=Dr(e,u),f=c?e.node(c).order:a;(c||u===d)&&(o.slice(l,h+1).forEach(p=>{let b=e.predecessors(p);b&&b.forEach(y=>{let w=e.node(y),g=w.order;(g<s||f<g)&&!(w.dummy&&e.node(p).dummy)&&We(r,y,p)})}),l=h+1,s=f)}),o}return t.length&&t.reduce(n),r}function Rr(e,t){let r={};function n(o,s,l,a,d){A(s,l).forEach(u=>{let h=o[u];if(h!==void 0&&e.node(h).dummy){let c=e.predecessors(h);c&&c.forEach(f=>{if(f===void 0)return;let p=e.node(f);p.dummy&&(p.order<a||p.order>d)&&We(r,f,h)})}})}function i(o,s){let l=-1,a=-1,d=0;return s.forEach((u,h)=>{if(e.node(u).dummy==="border"){let c=e.predecessors(u);if(c&&c.length){let f=c[0];if(f===void 0)return;a=e.node(f).order,n(s,d,h,l,a),d=h,l=a}}n(s,d,s.length,a,o.length)}),s}return t.length&&t.reduce(i),r}function Dr(e,t){if(e.node(t).dummy){let r=e.predecessors(t);if(r)return r.find(n=>e.node(n).dummy)}}function We(e,t,r){if(t>r){let i=t;t=r,r=i}let n=e[t];n||(e[t]=n={}),n[r]=!0}function Yr(e,t,r){if(t>r){let i=t;t=r,r=i}let n=e[t];return n!==void 0&&Object.hasOwn(n,r)}function Vr(e,t,r,n,i){let o={},s={},l={};return t.forEach(a=>{a.forEach((d,u)=>{o[d]=d,s[d]=d,l[d]=u})}),t.forEach(a=>{let d=-1,u=-1,h=!1,c=a,f=a.findIndex(p=>i?.includes(p)||we(p,e,i));f>0&&(c=[a[f],...a.slice(0,f),...a.slice(f+1)],h=!0),c.forEach(p=>{var b;let y=n(p);if(y&&y.length){i!=null&&i.includes(p)&&(y=y.filter(v=>we(v,e,i)));let w=y.sort((v,m)=>{let E=l[v],N=l[m];return(E!==void 0?E:0)-(N!==void 0?N:0)}),g=(w.length-1)/2;for(let v=Math.floor(g),m=Math.ceil(g);v<=m;++v){let E=w[v];if(E===void 0)continue;let N=l[E];if(N!==void 0&&s[p]===p&&d<N&&l[E]!==u&&!Yr(r,p,E)){let L=o[E];L!==void 0&&(s[E]=p,s[p]=o[p]=L,d=N,h&&(d=-1,u=(b=l[E])!=null?b:-1,h=!1))}}}})}),{root:o,align:s}}function Ar(e,t,r,n,i=!1){let o={},s=Gr(e,t,r,i),l=i?"borderLeft":"borderRight";function a(f,p){let b=s.nodes().slice(),y={},w=b.pop();for(;w;){if(y[w])f(w);else{y[w]=!0,b.push(w);for(let g of p(w))b.push(g)}w=b.pop()}}function d(f){let p=s.inEdges(f);p?o[f]=p.reduce((b,y)=>{var w;let g=(w=o[y.v])!=null?w:0,v=s.edge(y);return Math.max(b,g+(v!==void 0?v:0))},0):o[f]=0}function u(f){let p=s.outEdges(f),b=Number.POSITIVE_INFINITY;p&&(b=p.reduce((w,g)=>{let v=o[g.w],m=s.edge(g);return Math.min(w,(v!==void 0?v:0)-(m!==void 0?m:0))},Number.POSITIVE_INFINITY));let y=e.node(f);b!==Number.POSITIVE_INFINITY&&y.borderType!==l&&(o[f]=Math.max(o[f]!==void 0?o[f]:0,b))}function h(f){return s.predecessors(f)||[]}function c(f){return s.successors(f)||[]}return a(d,h),a(u,c),Object.keys(n).forEach(f=>{var p;let b=r[f];b!==void 0&&(o[f]=(p=o[b])!=null?p:0)}),o}function Gr(e,t,r,n){let i=new P,o=e.graph(),s=Xr(o.nodesep,o.edgesep,n);return t.forEach(l=>{let a;l.forEach(d=>{let u=r[d];if(u!==void 0){if(i.setNode(u),a!==void 0){let h=r[a];if(h!==void 0){let c=i.edge(h,u);i.setEdge(h,u,Math.max(s(e,d,a),c||0))}}a=d}})}),i}function Br(e,t){return Object.values(t).reduce((r,n)=>{let i=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;Object.entries(n).forEach(([l,a])=>{let d=Wr(e,l)/2;i=Math.max(a+d,i),o=Math.min(a-d,o)});let s=i-o;return s<r[0]&&(r=[s,n]),r},[Number.POSITIVE_INFINITY,null])[1]}function zr(e,t){let r=Object.values(t),n=T(Math.min,r),i=T(Math.max,r);["u","d"].forEach(o=>{["l","r"].forEach(s=>{let l=o+s,a=e[l];if(!a||a===t)return;let d=Object.values(a),u=n-T(Math.min,d);s!=="l"&&(u=i-T(Math.max,d)),u&&(e[l]=$(a,h=>h+u))})})}function qr(e,t=void 0){let r=e.ul;return r?$(r,(n,i)=>{var o,s;if(t){let a=t.toLowerCase(),d=e[a];if(d&&d[i]!==void 0)return d[i]}let l=Object.values(e).map(a=>{let d=a[i];return d!==void 0?d:0}).sort((a,d)=>a-d);return(((o=l[1])!=null?o:0)+((s=l[2])!=null?s:0))/2}):{}}function $r(e,t){let r=q(e),n=Object.assign(Fr(e,r),Rr(e,r)),i={},o;["u","d"].forEach(l=>{o=l==="u"?r:Object.values(r).reverse(),["l","r"].forEach(a=>{a==="r"&&(o=o.map(h=>Object.values(h).reverse()));let d=Vr(e,o,n,h=>(l==="u"?e.predecessors(h):e.successors(h))||[],t),u=Ar(e,o,d.root,d.align,a==="r");a==="r"&&(u=$(u,h=>-h)),i[l+a]=u})});let s=Br(e,i);return zr(i,s),qr(i,e.graph().align)}function Xr(e,t,r){return(n,i,o)=>{let s=n.node(i),l=n.node(o),a=0,d;if(a+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":d=-s.width/2;break;case"r":d=s.width/2;break}if(d&&(a+=r?d:-d),d=void 0,a+=(s.dummy?t:e)/2,a+=(l.dummy?t:e)/2,a+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":d=l.width/2;break;case"r":d=-l.width/2;break}return d&&(a+=r?d:-d),a}}function Wr(e,t){return e.node(t).width}function we(e,t,r){var n;if(!r)return!1;let i=(n=t.node(e))==null?void 0:n.edgeObj;if(!i||t.node(e).edgeLabel.reversed)return!1;let o=r.indexOf(i?.v),s=r.indexOf(i?.w);return o!==-1&&s!==-1&&o===(s+1)%r.length||o===(s-1)%r.length}function Jr(e,t){e=Te(e),Kr(e),Object.entries($r(e,t)).forEach(([r,n])=>e.node(r).x=n)}function Kr(e){let t=q(e),r=e.graph(),n=r.ranksep,i=r.rankalign,o=0;t.forEach(s=>{let l=s.reduce((a,d)=>{var u;let h=(u=e.node(d).height)!=null?u:0;return a>h?a:h},0);s.forEach(a=>{let d=e.node(a);i==="top"?d.y=o+d.height/2:i==="bottom"?d.y=o+l-d.height/2:d.y=o+l/2}),o+=l+n})}var Ee=new WeakMap;function vn(e,t={}){return Je(e,It,t),e}function be(e,t,r){let n=t;for(;n!==void 0;){let i=e.parent(n);if(i===r)return n;n=i}}function Je(e,t,r){var n;let i=e.nodes().filter(g=>e.children(g).length),o={};i.forEach(g=>{let v=e.node(g);if(v&&v.rankdir){let m=new P({multigraph:!0,compound:!0});m.setGraph({rankdir:v.rankdir});let E=e.children(g);E.forEach(x=>{let k={...e.node(x)};m.setNode(x,k);let C=e.parent(x);C&&C!==g&&E.includes(C)&&m.setParent(x,C)});let N=new Set;e.edges().forEach(x=>{let k=be(e,x.v,g),C=be(e,x.w,g);if(k&&C&&k!==C){let R=`${k}\0${C}`;N.has(R)||(N.add(R),m.setEdge(k,C,{...e.edge(x)}))}}),Je(m,t,r);let L=Oe(m);ye(L,t,r,null),_e(m,L);let _=1/0,M=1/0,S=-1/0,j=-1/0;m.nodes().forEach(x=>{if(x===g)return;let k=m.node(x);k&&typeof k.x=="number"&&typeof k.y=="number"&&typeof k.width=="number"&&typeof k.height=="number"&&(_=Math.min(_,k.x-k.width/2),S=Math.max(S,k.x+k.width/2),M=Math.min(M,k.y-k.height/2),j=Math.max(j,k.y+k.height/2))}),(!isFinite(_)||!isFinite(M)||!isFinite(S)||!isFinite(j))&&(_=M=0,S=j=0);let O=S-_,I=j-M;o[g]={minX:_,minY:M,maxX:S,maxY:j,width:O,height:I,offsetX:_,offsetY:M},v._dagreClusterSubgraph=m}});let s=[],l=g=>{let v=[],m=(e.children(g)||[]).filter(E=>E!==g);for(;m.length>0;){let E=m.shift();v.push(E),(e.children(E)||[]).filter(N=>N!==E).forEach(N=>m.push(N))}return v},a=new Map;i.forEach(g=>{let v=e.node(g);v&&v.rankdir&&o[g]&&a.set(g,(e.children(g)||[]).filter(m=>m!==g))});let d=new Set([...a.values()].flat()),u=new Map;a.forEach((g,v)=>{d.has(v)||u.set(v,l(v))});let h=new Set([...u.values()].flat()),c=g=>{for(let[v,m]of u)if(m.includes(g))return v;return g},f=[];e.edges().forEach(g=>{(h.has(g.v)||h.has(g.w))&&f.push({edge:g,label:e.edge(g)})});let p=new Map;h.forEach(g=>{let v=e.parent(g);p.set(g,typeof v=="string"?v:void 0)}),u.forEach((g,v)=>{let m=e.node(v),E=[];g.forEach(_=>{let M=e.node(_);M&&(E.push({id:_,node:M,parent:p.get(_)}),e.removeNode(_))});let N=f.filter(({edge:_})=>g.includes(_.v)||g.includes(_.w)),L=o[v];m&&(s.push({clusterId:v,subgraph:m._dagreClusterSubgraph,bounds:L,children:g,removedNodes:E,removedEdges:N}),m.width=L.width,m.height=L.height)});let b=new Set;f.forEach(({edge:g,label:v})=>{let m=c(g.v),E=c(g.w);if(m!==E&&e.hasNode(m)&&e.hasNode(E)){let N=`${m}\0${E}`;b.has(N)||(b.add(N),e.setEdge(m,E,{...v,width:0,height:0}))}});let y=Oe(e),w=ye(y,t,r,(n=Ee.get(e))!=null?n:null);Ee.set(e,w),_e(e,y),b.forEach(g=>{let v=g.indexOf("\0"),m=g.slice(0,v),E=g.slice(v+1);e.hasEdge(m,E)&&e.removeEdge(m,E)}),s.forEach(({clusterId:g,subgraph:v,bounds:m,removedNodes:E,removedEdges:N})=>{var L,_;let M=e.node(g),S=(L=M?.x)!=null?L:0,j=(_=M?.y)!=null?_:0,O=(m.minX+m.maxX)/2,I=(m.minY+m.maxY)/2;E.forEach(({id:x,node:k,parent:C})=>{e.setNode(x,k),C!==void 0&&e.setParent(x,C)}),N.forEach(({edge:x,label:k})=>{e.setEdge(x,k)}),v.nodes().forEach(x=>{if(x===g)return;let k=v.node(x),C=e.node(x);C&&k&&typeof k.x=="number"&&typeof k.y=="number"&&(C.x=S+(k.x-O),C.y=j+(k.y-I))}),delete M._dagreClusterSubgraph}),i.forEach(g=>{var v,m;let E=e.node(g),N=o[g];if(E&&E.rankdir&&E._dagreClusterSubgraph&&N){let L=E._dagreClusterSubgraph,_=(v=E.x)!=null?v:0,M=(m=E.y)!=null?m:0,S=(N.minX+N.maxX)/2,j=(N.minY+N.maxY)/2;L.nodes().forEach(O=>{if(O===g)return;let I=L.node(O),x=e.node(O);if(x&&I&&typeof I.x=="number"&&typeof I.y=="number"){let k=I.x-S,C=I.y-j;x.x=_+k,x.y=M+C}}),delete E._dagreClusterSubgraph}})}function ye(e,t,r,n=null){var i,o;let s=r?.useDynamic!==!1,l=s&&(i=n?.graph)!=null?i:null,a=s&&(o=n?.rawNodes)!=null?o:null;t(" makeSpaceForEdgeLabels",()=>nn(e)),t(" removeSelfEdges",()=>fn(e)),t(" acyclic",()=>Vt(e,l)),t(" nestingGraph.run",()=>ur(e)),t(" rank",()=>rr(Te(e))),t(" injectEdgeLabelProxies",()=>on(e)),t(" removeEmptyRanks",()=>Nt(e)),t(" nestingGraph.cleanup",()=>fr(e)),t(" normalizeRanks",()=>Ot(e)),t(" assignRankMinMax",()=>sn(e)),t(" removeEdgeLabelProxies",()=>ln(e)),t(" normalize.run",()=>zt(e)),t(" parentDummyChains",()=>sr(e)),t(" addBorderSegments",()=>gr(e)),t(" order",()=>Xe(e,r,a)),t(" insertSelfEdges",()=>gn(e)),t(" adjustCoordinateSystem",()=>vr(e)),t(" position",()=>Jr(e,r.corePath)),t(" positionSelfEdges",()=>pn(e));let d=JSON.parse(JSON.stringify(e._nodes));return t(" removeBorderNodes",()=>cn(e)),t(" normalize.undo",()=>$t(e)),t(" fixupEdgeLabelCoords",()=>un(e)),t(" undoCoordinateSystem",()=>mr(e)),t(" translateGraph",()=>dn(e)),t(" assignNodeIntersects",()=>an(e)),t(" reversePoints",()=>hn(e)),t(" acyclic.undo",()=>Gt(e)),{graph:e,rawNodes:d}}function _e(e,t){e.nodes().forEach(r=>{let n=e.node(r),i=t.node(r);n&&(n.x=i.x,n.y=i.y,n.order=i.order,n.rank=i.rank,t.children(r).length&&(n.width=i.width,n.height=i.height))}),e.edges().forEach(r=>{let n=e.edge(r),i=t.edge(r);n.points=i.points,Object.hasOwn(i,"x")&&(n.x=i.x,n.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Qr=["nodesep","edgesep","ranksep","marginx","marginy"],Ur={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},Hr=["acyclicer","ranker","rankdir","align","rankalign"],Zr=["width","height","rank"],ke={width:0,height:0},en=["minlen","weight","width","height","labeloffset"],tn={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},rn=["labelpos"];function Oe(e){let t=new P({multigraph:!0,compound:!0}),r=H(e.graph());return t.setGraph(Object.assign({},Ur,U(r,Qr),z(r,Hr))),e.nodes().forEach(n=>{let i=H(e.node(n)),o=U(i,Zr);Object.keys(ke).forEach(l=>{o[l]===void 0&&(o[l]=ke[l])}),t.setNode(n,o);let s=e.parent(n);s!==void 0&&t.setParent(n,s)}),e.edges().forEach(n=>{let i=H(e.edge(n));t.setEdge(n,Object.assign({},tn,U(i,en),z(i,rn)))}),t}function nn(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(r=>{var n;let i=e.edge(r);i.minlen*=2,((n=i.labelpos)!=null?n:"r").toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?i.width+=i.labeloffset:i.height+=i.labeloffset)})}function on(e){e.edges().forEach(t=>{let r=e.edge(t);if(r.width&&r.height){let n=e.node(t.v),i={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};Y(e,"edge-proxy",i,"_ep")}})}function sn(e){let t=0;e.nodes().forEach(r=>{let n=e.node(r);n.borderTop&&(n.minRank=e.node(n.borderTop).rank,n.maxRank=e.node(n.borderBottom).rank,t=Math.max(t,n.maxRank))}),e.graph().maxRank=t}function ln(e){e.nodes().forEach(t=>{let r=e.node(t);if(r.dummy==="edge-proxy"){let n=r;e.edge(n.e).labelRank=r.rank,e.removeNode(t)}})}function dn(e){let t=Number.POSITIVE_INFINITY,r=0,n=Number.POSITIVE_INFINITY,i=0,o=e.graph(),s=o.marginx||0,l=o.marginy||0;function a(d){let u=d.x,h=d.y,c=d.width,f=d.height;t=Math.min(t,u-c/2),r=Math.max(r,u+c/2),n=Math.min(n,h-f/2),i=Math.max(i,h+f/2)}e.nodes().forEach(d=>a(e.node(d))),e.edges().forEach(d=>{let u=e.edge(d);Object.hasOwn(u,"x")&&a(u)}),t-=s,n-=l,e.nodes().forEach(d=>{let u=e.node(d);u.x-=t,u.y-=n}),e.edges().forEach(d=>{let u=e.edge(d);u.points.forEach(h=>{h.x-=t,h.y-=n}),Object.hasOwn(u,"x")&&(u.x-=t),Object.hasOwn(u,"y")&&(u.y-=n)}),o.width=r-t+s,o.height=i-n+l}function an(e){e.edges().forEach(t=>{if(t.v===t.w)return;let r=e.edge(t),n=e.node(t.v),i=e.node(t.w),o,s;r.points?(o=r.points[0],s=r.points[r.points.length-1]):(r.points=[],o=i,s=n),r.points.unshift(de(n,o)),r.points.push(de(i,s))})}function un(e){e.edges().forEach(t=>{let r=e.edge(t);if(Object.hasOwn(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function hn(e){e.edges().forEach(t=>{let r=e.edge(t);r.reversed&&r.points.reverse()})}function cn(e){e.nodes().forEach(t=>{if(e.children(t).length){let r=e.node(t),n=e.node(r.borderTop),i=e.node(r.borderBottom),o=e.node(r.borderLeft[r.borderLeft.length-1]),s=e.node(r.borderRight[r.borderRight.length-1]);r.width=Math.abs(s.x-o.x),r.height=Math.abs(i.y-n.y),r.x=o.x+r.width/2,r.y=n.y+r.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function fn(e){e.edges().forEach(t=>{if(t.v===t.w){let r=e.node(t.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function gn(e){q(e).forEach(t=>{let r=0;t.forEach((n,i)=>{let o=e.node(n);typeof o.rank!="number"&&(o.rank=0),o.order=i+r,(o.selfEdges||[]).forEach(s=>{Y(e,"selfedge",{width:s.label.width,height:s.label.height,rank:o.rank,order:i+ ++r,e:s.e,edgeLabel:s.label},"_se"),(!Array.isArray(s.label.points)||s.label.points.length!==7)&&(s.label.points=[{x:0,y:-10},{x:0,y:-10},{x:0,y:0},{x:0,y:10},{x:0,y:10},{x:0,y:0},{x:0,y:0}])}),delete o.selfEdges})})}function pn(e){e.nodes().forEach(t=>{let r=e.node(t),n=i=>typeof i=="number"&&isFinite(i);if(r.dummy==="selfedge"){let i=r,o=e.node(i.e.v),s=n(o?.x)?o.x:0,l=n(o?.y)?o.y:0,a=n(o?.width)?o.width:0,d=n(o?.height)?o.height:0,u=n(r.x)?r.x:s,h=n(r.y)?r.y:l,c=a/2,f=d/2;i.edgeLabel.points=[{x:u+c,y:h-f},{x:u+c,y:h-f},{x:u,y:h},{x:u-c,y:h+f},{x:u-c,y:h+f},{x:u,y:h},{x:u,y:h}],i.edgeLabel.x=u,i.edgeLabel.y=h,e.setEdge(i.e,i.edgeLabel),e.removeNode(t)}else r&&Array.isArray(r.selfEdges)&&r.selfEdges.forEach(i=>{if(!Array.isArray(i.label.points)||i.label.points.length!==7){let o=n(r.x)?r.x:0,s=n(r.y)?r.y:0,l=n(r.width)?r.width:0,a=n(r.height)?r.height:0,d=l/2,u=a/2;i.label.points=[{x:o+d,y:s-u},{x:o+d,y:s-u},{x:o,y:s},{x:o-d,y:s+u},{x:o-d,y:s+u},{x:o,y:s},{x:o,y:s}]}})})}function U(e,t){return $(z(e,t),Number)}function H(e){let t={};return e&&Object.entries(e).forEach(([r,n])=>{typeof r=="string"&&(r=r.toLowerCase()),t[r]=n}),t}export{He as a,vn as b};
2
+ /*! For license information please see chunk-5CTTY5BQ.js.LEGAL.txt */
@@ -1,2 +1,2 @@
1
- import{a as g,c as C,jb as x,kb as H,mb as w}from"./chunk-HC6FTJAR.js";import{a as v}from"./chunk-J6IRWTF7.js";import{c as l}from"./chunk-DCANE7XH.js";g(`.editor-tool{display:inline-flex;align-items:center;justify-content:center;width:28px;height:29px;padding:0;flex-shrink:0;color:var(--muted);border:0;border-radius:4px;background:transparent}.editor-tool svg{stroke-width:1.65}.editor-tool:hover,.editor-tool.is-active{color:var(--accent);background:var(--editor-soft)}.editor-tool:disabled{opacity:.32}.editor-bubble{--editor-line: var(--line, #e8ece5);--editor-soft: var(--accent-soft, #edf2e9);position:fixed;z-index:80;display:flex;align-items:center;gap:2px;padding:5px;border:1px solid var(--line, #e8ece5);border-radius:6px;background:var(--paper, #fff);color:var(--text, #343a35);font-family:var(--font-ui, system-ui, sans-serif);font-size:12px;font-weight:400;line-height:1.2;letter-spacing:normal;box-shadow:0 5px 20px #2434291c;animation:editor-menu-appear .13s ease;max-width:calc(100vw - 16px);overflow-x:auto}@keyframes editor-menu-appear{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.editor-bubble{animation:none!important;transition:none!important}}@media print{.editor-bubble{display:none!important}}
1
+ import{Ab as w,a as g,c as C,mb as x,nb as H}from"./chunk-H7ALO2Q6.js";import{a as v}from"./chunk-J6IRWTF7.js";import{c as l}from"./chunk-DCANE7XH.js";g(`.editor-tool{display:inline-flex;align-items:center;justify-content:center;width:28px;height:29px;padding:0;flex-shrink:0;color:var(--muted);border:0;border-radius:4px;background:transparent}.editor-tool svg{stroke-width:1.65}.editor-tool:hover,.editor-tool.is-active{color:var(--accent);background:var(--editor-soft)}.editor-tool:disabled{opacity:.32}.editor-bubble{--editor-line: var(--line, #e8ece5);--editor-soft: var(--accent-soft, #edf2e9);position:fixed;z-index:80;display:flex;align-items:center;gap:2px;padding:5px;border:1px solid var(--line, #e8ece5);border-radius:6px;background:var(--paper, #fff);color:var(--text, #343a35);font-family:var(--font-ui, system-ui, sans-serif);font-size:12px;font-weight:400;line-height:1.2;letter-spacing:normal;box-shadow:0 5px 20px #2434291c;animation:editor-menu-appear .13s ease;max-width:calc(100vw - 16px);overflow-x:auto}@keyframes editor-menu-appear{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.editor-bubble{animation:none!important;transition:none!important}}@media print{.editor-bubble{display:none!important}}
2
2
  `);var i=l(C(),1),h=l(H(),1);var y=v("editor",{"zh-CN":{selectionToolbar:"\u9009\u4E2D\u6587\u5B57\u683C\u5F0F"},en:{selectionToolbar:"Selected text formatting"}});var k=l(x(),1);function O({id:M,anchor:n,anchorElement:t,children:L,onEscape:E,label:T,keyboardScope:z,viewportTop:d=8,className:b}){let R=w(y),u=(0,i.useRef)(null),[D,S]=(0,i.useState)(n);return(0,i.useLayoutEffect)(()=>{let e=u.current,r=()=>{let{width:o,height:c}=e.getBoundingClientRect(),a=t?.isConnected?t.getBoundingClientRect():null,s=a?{left:(a.left+a.right)/2,top:a.top,bottom:a.bottom}:n,m={left:Math.max(8,Math.min(s.left-o/2,window.innerWidth-o-8)),top:Math.max(d,Math.min(s.top-c-8>=d?s.top-c-8:(s.bottom??s.top)+8,window.innerHeight-c-8))};S(f=>f.left===m.left&&f.top===m.top?f:m)};r();let p=new ResizeObserver(r);if(p.observe(e),t)for(let o=t;o;o=o.parentElement)p.observe(o);return window.addEventListener("resize",r),t&&window.addEventListener("scroll",r,!0),()=>{p.disconnect(),window.removeEventListener("resize",r),t&&window.removeEventListener("scroll",r,!0)}},[n.left,n.top,n.bottom,t,d]),(0,h.createPortal)((0,k.jsx)("div",{ref:u,id:M,className:`editor-bubble${b?` ${b}`:""}`,"data-editor-menu-trigger":"selection","data-editor-keyboard-scope":z,role:"toolbar","aria-label":T??R("selectionToolbar"),style:D,onMouseDown:e=>{e.target.closest("input,select,textarea")||e.preventDefault()},onKeyDown:e=>{e.key==="Escape"&&(e.preventDefault(),E())},children:L}),document.body)}export{O as a};
@@ -0,0 +1 @@
1
+ import{H as f,I as p,J as h,c as g}from"./chunk-KQR52I3G.js";import{c as S}from"./chunk-H7ALO2Q6.js";import{c as x}from"./chunk-DCANE7XH.js";function b(o,a){let r="showai-frame-text-"+o,u=document.createElement("style");u.textContent=`::highlight(${r}){background:Highlight;color:HighlightText}`,document.head.append(u);let s=window,i=0,y=(t,e)=>{let n=document.caretRangeFromPoint(t,e);return n?a(document.body).offsetAt(n.startContainer,n.startOffset):null},d=()=>parent.postMessage({channel:o,type:"showai:text-selection-content",text:a(document.body).text.slice(0,256e3)},"*"),c=(t,e,n,l)=>{let m=y(e,n);m!==null&&(i=m),parent.postMessage({channel:o,type:"showai:text-selection-pointer",phase:t,x:e,y:n,width:innerWidth,height:innerHeight,buttons:l,offset:i},"*")};window.addEventListener("message",t=>{if(!(t.source!==parent||t.data?.channel!==o))if(t.data.type==="showai:text-selection-content-request")d();else if(t.data.type==="showai:text-selection-range"){let{from:e,to:n}=t.data;if(!Number.isFinite(e)||!Number.isFinite(n))return;if(n>e){let l=a(document.body);s.Highlight&&s.CSS.highlights&&s.CSS.highlights.set(r,new s.Highlight(...l.ranges(Math.max(0,e),Math.min(l.text.length,n)))),document.getSelection()?.removeAllRanges()}else s.CSS.highlights?.delete(r)}else t.data.type==="showai:text-selection-hit"&&[t.data.x,t.data.y].every(Number.isFinite)&&c("move",t.data.x,t.data.y,1)}),document.addEventListener("pointerdown",t=>{if(t.button!==0||t.pointerType!=="mouse"||t.shiftKey||t.metaKey||t.ctrlKey||!(t.target instanceof Element)||t.target.closest('button,input,textarea,select,summary,[role="button"],[role="slider"],[data-surface-ui],.react-flow,[data-surface-gesture="own"]')||getComputedStyle(t.target).userSelect==="none")return;let e=document.caretRangeFromPoint(t.clientX,t.clientY);e?.startContainer.nodeType!==Node.TEXT_NODE||!t.target.contains(e.startContainer)||(d(),c("down",t.clientX,t.clientY,t.buttons))},!0),document.addEventListener("pointermove",t=>{t.pointerType==="mouse"&&t.buttons&1&&c("move",t.clientX,t.clientY,t.buttons)},!0),document.addEventListener("pointerup",t=>c("up",t.clientX,t.clientY,t.buttons),!0),document.addEventListener("pointercancel",t=>c("cancel",t.clientX,t.clientY,t.buttons),!0)}function C(o){return`(${b.toString()})(${JSON.stringify(o)},${g.toString()});`}var w=x(S(),1);function L(o,a){(0,w.useEffect)(()=>{let r=o.current,u=f(r,a),s=i=>{i.source!==r.contentWindow||i.data?.channel!==a||(i.data.type==="showai:text-selection-pointer"&&h(r,i.data),i.data.type==="showai:text-selection-content"&&p(r,i.data.text))};return window.addEventListener("message",s),()=>{u(),window.removeEventListener("message",s)}},[a,o])}export{C as a,L as b};
@@ -1 +1 @@
1
- import{d as p}from"./chunk-WWRZIZ7N.js";var r=t=>{throw new Error(t)},h=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function l(t,i,o){(typeof t!="string"||!t.trim())&&r(`${i} must be non-empty text.`),t.length>o&&r(`${i} must be at most ${o} characters.`)}function a(t,i,o){t!==void 0&&l(t,i,o)}function g(t,i){(typeof t!="string"||!t.trim())&&r(`${i} must be non-empty code.`),t.length>8e3&&r(`${i} must be at most 8000 characters.`)}function b(t,i,o,e,f=!1){(typeof t!="number"||!Number.isFinite(t)||(f?t<=o:t<o)||t>e)&&r(`${i} must be a number ${f?"above":"of at least"} ${o} and at most ${e}.`)}function y(t,i,o,e){(!Number.isInteger(t)||t<o||t>e)&&r(`${i} must be an integer from ${o} to ${e}.`)}function m(t,i,o,e=0){return(!Array.isArray(t)||t.length<e||t.length>o)&&r(`${i} must be an array of ${e} to ${o} items.`),t.forEach((f,n)=>{h(f)||r(`${i}[${n}] must be an object.`)}),t}function u(t,i,o){for(let e of Object.keys(t))i.includes(e)||r(`${o}.${e} is not a known field.`)}var w=["list","focus"],S=["active","wait"],x=["id","title","short","badge","body","code","lang","variants","note","result","cue","wait","timer","segments"];function E(t){a(t.description,"description",600),t.layout!==void 0&&!w.includes(t.layout)&&r(`layout must be one of ${w.join(", ")}.`),t.start!==void 0&&y(t.start,"start",0,999);let i=m(t.steps,"steps",40,1);t.initialStep!==void 0&&y(t.initialStep,"initialStep",0,i.length-1);let o=new Set;i.forEach((e,f)=>{let n=`steps[${f}]`;u(e,x,n),e.id!==void 0&&(l(e.id,`${n}.id`,64),o.has(e.id)&&r(`${n}.id duplicates ${e.id}.`),o.add(e.id)),l(e.title,`${n}.title`,160),a(e.short,`${n}.short`,24),a(e.badge,`${n}.badge`,24),a(e.body,`${n}.body`,3e3);for(let s of["note","result","cue","wait"])a(e[s],`${n}.${s}`,600);if(a(e.lang,`${n}.lang`,24),e.code!==void 0&&g(e.code,`${n}.code`),e.variants!==void 0){e.code!==void 0&&r(`${n} uses either code or variants, not both.`);let s=new Set;m(e.variants,`${n}.variants`,6,1).forEach((c,d)=>{let $=`${n}.variants[${d}]`;u(c,["label","code","lang"],$),l(c.label,`${$}.label`,32),s.has(c.label)&&r(`${$}.label duplicates ${c.label}.`),s.add(c.label),g(c.code,`${$}.code`),a(c.lang,`${$}.lang`,24)})}e.timer!==void 0&&(h(e.timer)||r(`${n}.timer must be an object.`),u(e.timer,["minutes","label"],`${n}.timer`),b(e.timer.minutes,`${n}.timer.minutes`,0,1440,!0),a(e.timer.label,`${n}.timer.label`,40)),e.segments!==void 0&&m(e.segments,`${n}.segments`,8,1).forEach((s,c)=>{let d=`${n}.segments[${c}]`;u(s,["start","minutes","kind"],d),b(s.start,`${d}.start`,0,1e4),b(s.minutes,`${d}.minutes`,0,1e4,!0),S.includes(s.kind)||r(`${d}.kind must be one of ${S.join(", ")}.`)})})}function k(t){a(t.description,"description",600),a(t.placeholder,"placeholder",60),a(t.program,"program",40),t.program!==void 0&&/\s/.test(t.program)&&r("program must be a single word.");let i=new Set;m(t.groups,"groups",16,1).forEach((e,f)=>{let n=`groups[${f}]`;u(e,["id","label"],n),l(e.id,`${n}.id`,64),i.has(e.id)&&r(`${n}.id duplicates ${e.id}.`),i.add(e.id),l(e.label,`${n}.label`,24)});let o=new Set;m(t.commands,"commands",300,1).forEach((e,f)=>{let n=`commands[${f}]`;if(u(e,["id","group","command","summary","detail","params","examples"],n),e.id!==void 0&&(l(e.id,`${n}.id`,64),o.has(e.id)&&r(`${n}.id duplicates ${e.id}.`),o.add(e.id)),l(e.group,`${n}.group`,64),i.has(e.group)||r(`${n}.group ${e.group} does not match a group id.`),l(e.command,`${n}.command`,240),l(e.summary,`${n}.summary`,240),a(e.detail,`${n}.detail`,3e3),e.params!==void 0){let s=new Set;m(e.params,`${n}.params`,40,1).forEach((c,d)=>{let $=`${n}.params[${d}]`;u(c,["name","meaning"],$),l(c.name,`${$}.name`,80),s.has(c.name)&&r(`${$}.name duplicates ${c.name}.`),s.add(c.name),l(c.meaning,`${$}.meaning`,400)})}e.examples!==void 0&&m(e.examples,`${n}.examples`,6,1).forEach((s,c)=>{let d=`${n}.examples[${c}]`;u(s,["label","code"],d),a(s.label,`${d}.label`,40),g(s.code,`${d}.code`)})})}function T(t,i){return h(i)||r("Component data must be an object."),a(i.title,"title",120),t==="step-guide"?E(i):t==="command-reference"?k(i):r(`Unknown doc reference component ${t}.`),i}function A(t){let i=0,o=0,e=0;for(let f of t)for(let n of f.segments??[])n.kind==="active"?i+=n.minutes:o+=n.minutes,e=Math.max(e,n.start+n.minutes);return{active:i,wait:o,total:e}}function C(t){if(!(t>0))return[];let i=[5,10,15,30,60,120,240,480].find(e=>t/e<=8)??Math.ceil(t/8/60)*60,o=[];for(let e=0;e<=t;e+=i)o.push(e);return o}function O(t){return[...new Set(t.toLowerCase().split(/\s+/).filter(Boolean))]}function L(t,i){let o=[t.command,p(t.summary),...(t.params??[]).map(e=>`${e.name} ${e.meaning}`)].map(e=>e.toLowerCase());return i.every(e=>o.some(f=>f.includes(e)))}function M(t,i){let o=t.toLowerCase(),e=[];for(let n of i)for(let s=o.indexOf(n);s>=0;s=o.indexOf(n,s+n.length))e.push([s,s+n.length]);e.sort((n,s)=>n[0]-s[0]);let f=[];for(let n of e){let s=f[f.length-1];s&&n[0]<=s[1]?s[1]=Math.max(s[1],n[1]):f.push([n[0],n[1]])}return f}export{T as a,A as b,C as c,O as d,L as e,M as f};
1
+ import{d as p}from"./chunk-MLBEJ7IZ.js";var r=t=>{throw new Error(t)},h=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function l(t,i,o){(typeof t!="string"||!t.trim())&&r(`${i} must be non-empty text.`),t.length>o&&r(`${i} must be at most ${o} characters.`)}function a(t,i,o){t!==void 0&&l(t,i,o)}function g(t,i){(typeof t!="string"||!t.trim())&&r(`${i} must be non-empty code.`),t.length>8e3&&r(`${i} must be at most 8000 characters.`)}function b(t,i,o,e,f=!1){(typeof t!="number"||!Number.isFinite(t)||(f?t<=o:t<o)||t>e)&&r(`${i} must be a number ${f?"above":"of at least"} ${o} and at most ${e}.`)}function y(t,i,o,e){(!Number.isInteger(t)||t<o||t>e)&&r(`${i} must be an integer from ${o} to ${e}.`)}function m(t,i,o,e=0){return(!Array.isArray(t)||t.length<e||t.length>o)&&r(`${i} must be an array of ${e} to ${o} items.`),t.forEach((f,n)=>{h(f)||r(`${i}[${n}] must be an object.`)}),t}function u(t,i,o){for(let e of Object.keys(t))i.includes(e)||r(`${o}.${e} is not a known field.`)}var w=["list","focus"],S=["active","wait"],x=["id","title","short","badge","body","code","lang","variants","note","result","cue","wait","timer","segments"];function E(t){a(t.description,"description",600),t.layout!==void 0&&!w.includes(t.layout)&&r(`layout must be one of ${w.join(", ")}.`),t.start!==void 0&&y(t.start,"start",0,999);let i=m(t.steps,"steps",40,1);t.initialStep!==void 0&&y(t.initialStep,"initialStep",0,i.length-1);let o=new Set;i.forEach((e,f)=>{let n=`steps[${f}]`;u(e,x,n),e.id!==void 0&&(l(e.id,`${n}.id`,64),o.has(e.id)&&r(`${n}.id duplicates ${e.id}.`),o.add(e.id)),l(e.title,`${n}.title`,160),a(e.short,`${n}.short`,24),a(e.badge,`${n}.badge`,24),a(e.body,`${n}.body`,3e3);for(let s of["note","result","cue","wait"])a(e[s],`${n}.${s}`,600);if(a(e.lang,`${n}.lang`,24),e.code!==void 0&&g(e.code,`${n}.code`),e.variants!==void 0){e.code!==void 0&&r(`${n} uses either code or variants, not both.`);let s=new Set;m(e.variants,`${n}.variants`,6,1).forEach((c,d)=>{let $=`${n}.variants[${d}]`;u(c,["label","code","lang"],$),l(c.label,`${$}.label`,32),s.has(c.label)&&r(`${$}.label duplicates ${c.label}.`),s.add(c.label),g(c.code,`${$}.code`),a(c.lang,`${$}.lang`,24)})}e.timer!==void 0&&(h(e.timer)||r(`${n}.timer must be an object.`),u(e.timer,["minutes","label"],`${n}.timer`),b(e.timer.minutes,`${n}.timer.minutes`,0,1440,!0),a(e.timer.label,`${n}.timer.label`,40)),e.segments!==void 0&&m(e.segments,`${n}.segments`,8,1).forEach((s,c)=>{let d=`${n}.segments[${c}]`;u(s,["start","minutes","kind"],d),b(s.start,`${d}.start`,0,1e4),b(s.minutes,`${d}.minutes`,0,1e4,!0),S.includes(s.kind)||r(`${d}.kind must be one of ${S.join(", ")}.`)})})}function k(t){a(t.description,"description",600),a(t.placeholder,"placeholder",60),a(t.program,"program",40),t.program!==void 0&&/\s/.test(t.program)&&r("program must be a single word.");let i=new Set;m(t.groups,"groups",16,1).forEach((e,f)=>{let n=`groups[${f}]`;u(e,["id","label"],n),l(e.id,`${n}.id`,64),i.has(e.id)&&r(`${n}.id duplicates ${e.id}.`),i.add(e.id),l(e.label,`${n}.label`,24)});let o=new Set;m(t.commands,"commands",300,1).forEach((e,f)=>{let n=`commands[${f}]`;if(u(e,["id","group","command","summary","detail","params","examples"],n),e.id!==void 0&&(l(e.id,`${n}.id`,64),o.has(e.id)&&r(`${n}.id duplicates ${e.id}.`),o.add(e.id)),l(e.group,`${n}.group`,64),i.has(e.group)||r(`${n}.group ${e.group} does not match a group id.`),l(e.command,`${n}.command`,240),l(e.summary,`${n}.summary`,240),a(e.detail,`${n}.detail`,3e3),e.params!==void 0){let s=new Set;m(e.params,`${n}.params`,40,1).forEach((c,d)=>{let $=`${n}.params[${d}]`;u(c,["name","meaning"],$),l(c.name,`${$}.name`,80),s.has(c.name)&&r(`${$}.name duplicates ${c.name}.`),s.add(c.name),l(c.meaning,`${$}.meaning`,400)})}e.examples!==void 0&&m(e.examples,`${n}.examples`,6,1).forEach((s,c)=>{let d=`${n}.examples[${c}]`;u(s,["label","code"],d),a(s.label,`${d}.label`,40),g(s.code,`${d}.code`)})})}function T(t,i){return h(i)||r("Component data must be an object."),a(i.title,"title",120),t==="step-guide"?E(i):t==="command-reference"?k(i):r(`Unknown doc reference component ${t}.`),i}function A(t){let i=0,o=0,e=0;for(let f of t)for(let n of f.segments??[])n.kind==="active"?i+=n.minutes:o+=n.minutes,e=Math.max(e,n.start+n.minutes);return{active:i,wait:o,total:e}}function C(t){if(!(t>0))return[];let i=[5,10,15,30,60,120,240,480].find(e=>t/e<=8)??Math.ceil(t/8/60)*60,o=[];for(let e=0;e<=t;e+=i)o.push(e);return o}function O(t){return[...new Set(t.toLowerCase().split(/\s+/).filter(Boolean))]}function L(t,i){let o=[t.command,p(t.summary),...(t.params??[]).map(e=>`${e.name} ${e.meaning}`)].map(e=>e.toLowerCase());return i.every(e=>o.some(f=>f.includes(e)))}function M(t,i){let o=t.toLowerCase(),e=[];for(let n of i)for(let s=o.indexOf(n);s>=0;s=o.indexOf(n,s+n.length))e.push([s,s+n.length]);e.sort((n,s)=>n[0]-s[0]);let f=[];for(let n of e){let s=f[f.length-1];s&&n[0]<=s[1]?s[1]=Math.max(s[1],n[1]):f.push([n[0],n[1]])}return f}export{T as a,A as b,C as c,O as d,L as e,M as f};
@@ -0,0 +1 @@
1
+ var b=new Set(["request","skill","decision","reference","query","result"]),E=new Set(["__proto__","prototype","constructor"]),y=["ok","warn","bad","idle","active"],p=new Set(y);function s(e,n,o=!1,t=1e4){if(!(e===void 0&&!o)&&(typeof e!="string"||e.length>t||o&&!e.trim()))throw new Error(`${n} must be ${o?"non-empty ":""}text.`)}function l(e,n,o){if(!Array.isArray(e)||e.length>o)throw new Error(`${n} must contain at most ${o} items.`);let t=new Set;for(let r of e){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`${n} requires objects.`);if(s(r.id,`${n}.id`,!0,200),E.has(r.id)||t.has(r.id))throw new Error(`${n} requires unique, non-reserved IDs.`);t.add(r.id)}return t}function A(e){if(s(e.title,"flowchart.title"),s(e.description,"flowchart.description"),e.height!==void 0&&(!Number.isFinite(e.height)||e.height<360||e.height>1200))throw new Error("Flowchart height must be between 360 and 1200.");l(e.flows,"flowchart.flows",20);for(let n of e.flows){if(s(n.label,"flow.label",!0,200),s(n.description,"flow.description"),n.direction!==void 0&&!["TB","LR"].includes(n.direction))throw new Error("Flow direction must be TB or LR.");let o=l(n.nodes,"flow.nodes",200);l(n.edges,"flow.edges",400);for(let t of n.nodes){s(t.label,"node.label",!0,200),s(t.subtitle,"node.subtitle",!1,300),s(t.detail,"node.detail");for(let r of["sourceSide","targetSide"])if(t[r]!==void 0&&!["top","bottom","left","right"].includes(t[r]))throw new Error(`${r} must be a valid connection side.`);if(t.kind!==void 0&&!b.has(t.kind))throw new Error("Unsupported flow node kind.");for(let r of["commands","references"])if(t[r]!==void 0){if(!Array.isArray(t[r])||t[r].length>30)throw new Error(`${r} must have at most 30 entries.`);t[r].forEach(d=>s(d,r,!0,3e3))}if(t.position&&(!Number.isFinite(t.position.x)||!Number.isFinite(t.position.y)))throw new Error("Node positions must be finite.")}for(let t of n.edges){if(!o.has(t.source)||!o.has(t.target))throw new Error(`Flow edge ${t.id} references a missing node.`);s(t.label,"edge.label",!1,300)}S(n,`flowchart.flows[${e.flows.indexOf(n)}]`)}return e}function $(e,n){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${n} must be an object.`)}function S(e,n){let o=new Set(e.nodes.map(r=>r.id)),t=new Map(e.edges.map(r=>[r.id,r]));if(e.journeys!==void 0){let r=l(e.journeys,`${n}.journeys`,12);if(e.journeys.forEach((d,a)=>{let f=`${n}.journeys[${a}]`;if(s(d.label,`${f}.label`,!0,200),s(d.summary,`${f}.summary`,!1,1e3),!Array.isArray(d.steps)||!d.steps.length||d.steps.length>60)throw new Error(`${f}.steps must contain 1 to 60 steps.`);d.steps.forEach((i,h)=>{let c=`${f}.steps[${h}]`;if($(i,c),!o.has(i.node))throw new Error(`${c}.node references a missing node.`);if(s(i.title,`${c}.title`,!0,200),s(i.text,`${c}.text`,!0,3e3),i.edge===void 0)return;let u=t.get(i.edge);if(!u)throw new Error(`${c}.edge references a missing edge.`);if(u.source!==i.node&&u.target!==i.node)throw new Error(`${c}.edge must connect to node ${i.node}.`)})}),e.initialJourney!==void 0&&!r.has(e.initialJourney))throw new Error(`${n}.initialJourney references a missing journey.`)}else if(e.initialJourney!==void 0)throw new Error(`${n}.initialJourney requires journeys.`);if(e.stages!==void 0){let r=l(e.stages,`${n}.stages`,30);if(e.stages.forEach((d,a)=>{let f=`${n}.stages[${a}]`;s(d.label,`${f}.label`,!0,200),s(d.summary,`${f}.summary`,!1,3e3);for(let[i,h,c]of[["nodes",o,"note"],["edges",t,"label"]]){if(d[i]===void 0)continue;$(d[i],`${f}.${i}`);let u=Object.entries(d[i]);if(u.length>(i==="nodes"?200:400))throw new Error(`${f}.${i} has too many entries.`);for(let[m,g]of u){let w=`${f}.${i}.${m}`;if(!h.has(m))throw new Error(`${w} references a missing ${i==="nodes"?"node":"edge"}.`);if($(g,w),!p.has(g.state))throw new Error(`${w}.state must be one of ${y.join(", ")}.`);s(g[c],`${w}.${c}`,!1,300)}}}),e.initialStage!==void 0&&!r.has(e.initialStage))throw new Error(`${n}.initialStage references a missing stage.`)}else if(e.initialStage!==void 0)throw new Error(`${n}.initialStage requires stages.`)}function j(e,n){return n.steps.map((o,t)=>{if(o.edge!==void 0)return o.edge;let r=n.steps[t-1]?.node;return r===void 0||r===o.node?void 0:(e.edges.find(a=>a.source===r&&a.target===o.node)??e.edges.find(a=>a.source===o.node&&a.target===r))?.id})}export{A as a,j as b};