likec4 1.56.0 → 1.57.0
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/__app__/chunks/AIChat2.mjs +2 -0
- package/__app__/chunks/DiagramActorProvider.mjs +4 -4
- package/__app__/chunks/EmbedPage.mjs +1 -0
- package/__app__/chunks/ExportPage.mjs +2 -0
- package/__app__/chunks/LikeC4Diagram.mjs +5 -5
- package/__app__/chunks/LikeC4Styles.mjs +11 -11
- package/__app__/chunks/Markdown.mjs +1 -0
- package/__app__/chunks/NavigationPanel.mjs +1 -1
- package/__app__/chunks/ViewReact.mjs +1 -1
- package/__app__/chunks/adhoc-editor.mjs +1 -1
- package/__app__/chunks/aichat.mjs +1 -0
- package/__app__/chunks/box.mjs +1 -0
- package/__app__/chunks/create-style-context.mjs +1 -0
- package/__app__/chunks/css.mjs +1 -0
- package/__app__/chunks/factory.mjs +1 -0
- package/__app__/chunks/hooks.mjs +1 -1
- package/__app__/chunks/hstack.mjs +1 -0
- package/__app__/chunks/libs/@dagrejs/dagre.mjs +1 -1
- package/__app__/chunks/libs/@floating-ui/core.mjs +1 -1
- package/__app__/chunks/libs/@floating-ui/dom.mjs +1 -1
- package/__app__/chunks/libs/@floating-ui/react.mjs +1 -1
- package/__app__/chunks/libs/@mantine/core.mjs +24 -24
- package/__app__/chunks/libs/@mantine/hooks.mjs +1 -1
- package/__app__/chunks/libs/@nanostores/react.mjs +1 -1
- package/__app__/chunks/libs/@react-hookz/web.mjs +1 -1
- package/__app__/chunks/libs/@tabler/icons-react.mjs +347 -4
- package/__app__/chunks/libs/@tanstack/ai-client.mjs +2 -0
- package/__app__/chunks/libs/@tanstack/ai-react-ui.mjs +1 -0
- package/__app__/chunks/libs/@tanstack/ai-react.mjs +1 -0
- package/__app__/chunks/libs/@tanstack/ai.mjs +2 -0
- package/__app__/chunks/libs/@tanstack/history.mjs +1 -1
- package/__app__/chunks/libs/@tanstack/react-router.mjs +3 -3
- package/__app__/chunks/libs/@tanstack/router-core.mjs +1 -1
- package/__app__/chunks/libs/@xstate/react.mjs +1 -1
- package/__app__/chunks/libs/@xstate/store.mjs +1 -1
- package/__app__/chunks/libs/@xyflow/react.mjs +3 -3
- package/__app__/chunks/libs/@zag-js/anatomy.mjs +1 -1
- package/__app__/chunks/libs/@zag-js/collection.mjs +1 -1
- package/__app__/chunks/libs/@zag-js/core.mjs +1 -1
- package/__app__/chunks/libs/@zag-js/react.mjs +1 -1
- package/__app__/chunks/libs/@zag-js/tree-view.mjs +1 -1
- package/__app__/chunks/libs/bezier-js.mjs +1 -1
- package/__app__/chunks/libs/copy-anything.mjs +1 -0
- package/__app__/chunks/libs/d3-path.mjs +1 -1
- package/__app__/chunks/libs/d3-shape.mjs +1 -1
- package/__app__/chunks/libs/fast-equals.mjs +1 -1
- package/__app__/chunks/libs/framer-motion.mjs +3 -3
- package/__app__/chunks/libs/html-to-image.mjs +2 -2
- package/__app__/chunks/libs/motion-dom.mjs +1 -1
- package/__app__/chunks/libs/nanostores.mjs +1 -1
- package/__app__/chunks/libs/react-error-boundary.mjs +1 -1
- package/__app__/chunks/libs/react-resizable-panels.mjs +1 -1
- package/__app__/chunks/libs/remeda.mjs +1 -1
- package/__app__/chunks/libs/superjson.mjs +1 -0
- package/__app__/chunks/libs/zod.mjs +39 -14
- package/__app__/chunks/rolldown-runtime.mjs +1 -1
- package/__app__/chunks/styles.css.mjs +1 -1
- package/__app__/chunks/txt.mjs +1 -0
- package/__app__/chunks/useLikeC4Project.mjs +1 -1
- package/__app__/codegen/webcomponent.mjs +221 -69
- package/__app__/src/aichat/index.mjs +1 -0
- package/__app__/src/main.mjs +45 -1
- package/__app__/src/pages/AdHocViewEditor.mjs +1 -1
- package/__app__/src/pages/EmbedPage.mjs +1 -1
- package/__app__/src/pages/ExportPage.mjs +1 -1
- package/__app__/src/pages/ProjectsOverview.mjs +1 -1
- package/__app__/src/pages/ViewAsD2.mjs +1 -1
- package/__app__/src/pages/ViewAsDot.mjs +1 -1
- package/__app__/src/pages/ViewAsMmd.mjs +1 -1
- package/__app__/src/pages/ViewAsPuml.mjs +1 -1
- package/__app__/src/pages/ViewEditor.mjs +1 -1
- package/__app__/src/style.css +1 -1
- package/config/schema.json +14 -41
- package/dist/chunks/enableServer.mjs +1 -0
- package/dist/chunks/index2.d.mts +569 -377
- package/dist/chunks/libs/@hono/mcp.mjs +33 -8
- package/dist/chunks/libs/@hono/node-server.mjs +1 -1
- package/dist/chunks/libs/@modelcontextprotocol/sdk.mjs +7 -7
- package/dist/chunks/libs/@ts-graphviz/ast.mjs +3 -0
- package/dist/chunks/libs/@ts-graphviz/common.d.mts +9 -0
- package/dist/chunks/libs/@ts-graphviz/core.mjs +1 -0
- package/dist/chunks/libs/ajv.mjs +1 -1
- package/dist/chunks/libs/ansi-styles.mjs +1 -1
- package/dist/chunks/libs/boxen.mjs +2 -2
- package/dist/chunks/libs/chevrotain.mjs +2 -2
- package/dist/chunks/libs/conf.mjs +1 -1
- package/dist/chunks/libs/langium.d.mts +5 -5
- package/dist/chunks/libs/langium.mjs +10 -10
- package/dist/chunks/libs/merge-error-cause.mjs +1 -1
- package/dist/chunks/libs/pako.mjs +3 -1
- package/dist/chunks/libs/remeda.mjs +1 -1
- package/dist/chunks/libs/ts-graphviz.mjs +1 -4
- package/dist/chunks/libs/unctx.mjs +1 -0
- package/dist/chunks/libs/vscode-languageserver.mjs +1 -1
- package/dist/chunks/libs/zod.d.mts +60 -25
- package/dist/chunks/node.mjs +62 -45
- package/dist/chunks/plugin.mjs +234 -41
- package/dist/chunks/sequence-view.mjs +1 -1
- package/dist/cli/index.mjs +142 -139
- package/dist/index.d.mts +1 -130
- package/dist/model/index.d.mts +1 -1
- package/dist/vite-plugin/index.d.mts +53 -2
- package/dist/vite-plugin/internal/index.d.mts +331 -3
- package/dist/vite-plugin/internal/index.mjs +1 -1
- package/package.json +65 -51
- package/react/index.d.mts +82 -50
- package/react/index.mjs +34017 -32421
- package/vite-plugin-modules.d.ts +4 -0
- package/__app__/chunks/ColorSchemeToggle.mjs +0 -1
- package/__app__/chunks/Fallback.mjs +0 -1
- package/__app__/chunks/Header.mjs +0 -13
- package/__app__/chunks/IconRenderer.mjs +0 -1
- package/__app__/chunks/LikeC4ModelContext.mjs +0 -1
- package/__app__/chunks/LikeC4ModelContext2.mjs +0 -1
- package/__app__/chunks/StaticLikeC4Diagram.mjs +0 -1
- package/__app__/chunks/__root.mjs +0 -1
- package/__app__/chunks/libs/motion.mjs +0 -1
- package/__app__/chunks/libs/xstate.mjs +0 -1
- package/__app__/chunks/safeCtx.mjs +0 -1
- package/__app__/chunks/searchParams.mjs +0 -1
- package/__app__/chunks/single-index.mjs +0 -1
- package/__app__/chunks/styled-system.mjs +0 -1
- package/__app__/chunks/useUpdateEffect.mjs +0 -1
- package/__app__/src/routeTree.gen.mjs +0 -1
- package/__app__/src/routes/__root.mjs +0 -1
- package/__app__/src/routes/_single/adhoc.mjs +0 -1
- package/__app__/src/routes/_single/embed._viewId.mjs +0 -1
- package/__app__/src/routes/_single/export._viewId.mjs +0 -1
- package/__app__/src/routes/_single/route.mjs +0 -1
- package/__app__/src/routes/_single/single-index.mjs +0 -1
- package/__app__/src/routes/_single/view._viewId.d2.mjs +0 -1
- package/__app__/src/routes/_single/view._viewId.dot.mjs +0 -1
- package/__app__/src/routes/_single/view._viewId.index.mjs +0 -1
- package/__app__/src/routes/_single/view._viewId.mjs +0 -1
- package/__app__/src/routes/_single/view._viewId.mmd.mjs +0 -1
- package/__app__/src/routes/_single/view._viewId.puml.mjs +0 -1
- package/__app__/src/routes/_single/webcomponent._.mjs +0 -33
- package/__app__/src/routes/index.mjs +0 -1
- package/__app__/src/routes/project._projectId/-components.mjs +0 -1
- package/__app__/src/routes/project._projectId/adhoc.mjs +0 -1
- package/__app__/src/routes/project._projectId/embed._viewId.mjs +0 -1
- package/__app__/src/routes/project._projectId/export._viewId.mjs +0 -1
- package/__app__/src/routes/project._projectId/index.mjs +0 -1
- package/__app__/src/routes/project._projectId/route.mjs +0 -1
- package/__app__/src/routes/project._projectId/view._viewId.d2.mjs +0 -1
- package/__app__/src/routes/project._projectId/view._viewId.dot.mjs +0 -1
- package/__app__/src/routes/project._projectId/view._viewId.index.mjs +0 -1
- package/__app__/src/routes/project._projectId/view._viewId.mjs +0 -1
- package/__app__/src/routes/project._projectId/view._viewId.mmd.mjs +0 -1
- package/__app__/src/routes/project._projectId/view._viewId.puml.mjs +0 -1
- package/__app__/src/routes/projects.mjs +0 -1
- package/dist/chunks/libs/ts-graphviz.d.mts +0 -12
- package/dist/vite-plugin/internal/chunks/libs/@nanostores/react.d.mts +0 -269
- package/dist/vite-plugin/internal/chunks/libs/nanostores.d.mts +0 -59
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"../../rolldown-runtime.mjs";var t=e(((e,t)=>{var n=`\0`,r=`\0`,i=``,Graph=class{_isDirected=!0;_isMultigraph=!1;_isCompound=!1;_label;_defaultNodeLabelFn=()=>void 0;_defaultEdgeLabelFn=()=>void 0;_nodes={};_in={};_preds={};_out={};_sucs={};_edgeObjs={};_edgeLabels={};_nodeCount=0;_edgeCount=0;_parent;_children;constructor(e){e&&(this._isDirected=Object.hasOwn(e,`directed`)?e.directed:!0,this._isMultigraph=Object.hasOwn(e,`multigraph`)?e.multigraph:!1,this._isCompound=Object.hasOwn(e,`compound`)?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[r]={})}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 this._defaultNodeLabelFn=e,typeof e!=`function`&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter(t=>Object.keys(e._in[t]).length===0)}sinks(){var e=this;return this.nodes().filter(t=>Object.keys(e._out[t]).length===0)}setNodes(e,t){var n=arguments,r=this;return e.forEach(function(e){n.length>1?r.setNode(e,t):r.setNode(e)}),this}setNode(e,t){return Object.hasOwn(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=r,this._children[e]={},this._children[r][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 Object.hasOwn(this._nodes,e)}removeNode(e){var t=this;if(Object.hasOwn(this._nodes,e)){var removeEdge=e=>t.removeEdge(t._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(function(e){t.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(removeEdge),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(removeEdge),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=r;else{t+=``;for(var n=t;n!==void 0;n=this.parent(n))if(n===e)throw 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}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if(t!==r)return t}}children(e=r){if(this._isCompound){var t=this._children[e];if(t)return Object.keys(t)}else if(e===r)return this.nodes();else if(this.hasNode(e))return[]}predecessors(e){var t=this._preds[e];if(t)return Object.keys(t)}successors(e){var t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){var t=this.predecessors(e);if(t){let r=new Set(t);for(var n of this.successors(e))r.add(n);return Array.from(r.values())}}isLeaf(e){return(this.isDirected()?this.successors(e):this.neighbors(e)).length===0}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;Object.entries(this._nodes).forEach(function([n,r]){e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))});var r={};function findParent(e){var i=n.parent(e);return i===void 0||t.hasNode(i)?(r[e]=i,i):i in r?r[i]:findParent(i)}return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,findParent(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,typeof e!=`function`&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){var n=this,r=arguments;return e.reduce(function(e,i){return r.length>1?n.setEdge(e,i,t):n.setEdge(e,i),i}),this}setEdge(){var e,t,n,r,i=!1,a=arguments[0];typeof a==`object`&&a&&`v`in a?(e=a.v,t=a.w,n=a.name,arguments.length===2&&(r=arguments[1],i=!0)):(e=a,t=arguments[1],n=arguments[3],arguments.length>2&&(r=arguments[2],i=!0)),e=``+e,t=``+t,n!==void 0&&(n=``+n);var o=edgeArgsToId(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,o))return i&&(this._edgeLabels[o]=r),this;if(n!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(e),this.setNode(t),this._edgeLabels[o]=i?r:this._defaultEdgeLabelFn(e,t,n);var s=edgeArgsToObj(this._isDirected,e,t,n);return e=s.v,t=s.w,Object.freeze(s),this._edgeObjs[o]=s,incrementOrInitEntry(this._preds[t],e),incrementOrInitEntry(this._sucs[e],t),this._in[t][o]=s,this._out[e][o]=s,this._edgeCount++,this}edge(e,t,n){var r=arguments.length===1?edgeObjToId(this._isDirected,arguments[0]):edgeArgsToId(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(){let e=this.edge(...arguments);return typeof e==`object`?e:{label:e}}hasEdge(e,t,n){var r=arguments.length===1?edgeObjToId(this._isDirected,arguments[0]):edgeArgsToId(this._isDirected,e,t,n);return Object.hasOwn(this._edgeLabels,r)}removeEdge(e,t,n){var r=arguments.length===1?edgeObjToId(this._isDirected,arguments[0]):edgeArgsToId(this._isDirected,e,t,n),i=this._edgeObjs[r];return i&&(e=i.v,t=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],decrementOrRemoveEntry(this._preds[t],e),decrementOrRemoveEntry(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this}inEdges(e,t){var n=this._in[e];if(n){var r=Object.values(n);return t?r.filter(e=>e.v===t):r}}outEdges(e,t){var n=this._out[e];if(n){var r=Object.values(n);return t?r.filter(e=>e.w===t):r}}nodeEdges(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))}};function incrementOrInitEntry(e,t){e[t]?e[t]++:e[t]=1}function decrementOrRemoveEntry(e,t){--e[t]||delete e[t]}function edgeArgsToId(e,t,r,a){var o=``+t,s=``+r;if(!e&&o>s){var c=o;o=s,s=c}return o+i+s+i+(a===void 0?n:a)}function edgeArgsToObj(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return r&&(s.name=r),s}function edgeObjToId(e,t){return edgeArgsToId(e,t.v,t.w,t.name)}t.exports=Graph})),n=e(((e,t)=>{t.exports=`2.2.4`})),r=e(((e,r)=>{r.exports={Graph:t(),version:n()}})),i=e(((e,n)=>{var r=t();n.exports={write,read};function write(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:writeNodes(e),edges:writeEdges(e)};return e.graph()!==void 0&&(t.value=structuredClone(e.graph())),t}function writeNodes(e){return e.nodes().map(function(t){var n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function writeEdges(e){return e.edges().map(function(t){var n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function read(e){var t=new r(e.options).setGraph(e.value);return e.nodes.forEach(function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}})),a=e(((e,t)=>{t.exports=components;function components(e){var t={},n=[],r;function dfs(n){Object.hasOwn(t,n)||(t[n]=!0,r.push(n),e.successors(n).forEach(dfs),e.predecessors(n).forEach(dfs))}return e.nodes().forEach(function(e){r=[],dfs(e),r.length&&n.push(r)}),n}})),o=e(((e,t)=>{var PriorityQueue=class{_arr=[];_keyIndices={};size(){return this._arr.length}keys(){return this._arr.map(function(e){return e.key})}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){var n=this._keyIndices;if(e=String(e),!Object.hasOwn(n,e)){var r=this._arr,i=r.length;return n[e]=i,r.push({key:e,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw Error(`New priority is greater than current priority. Key: `+e+` Old: `+this._arr[n].priority+` New: `+t);this._arr[n].priority=t,this._decrease(n)}_heapify(e){var t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){for(var t=this._arr,n=t[e].priority,r;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){var n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}};t.exports=PriorityQueue})),s=e(((e,t)=>{var n=o();t.exports=dijkstra;var DEFAULT_WEIGHT_FUNC=()=>1;function dijkstra(e,t,n,r){return runDijkstra(e,String(t),n||DEFAULT_WEIGHT_FUNC,r||function(t){return e.outEdges(t)})}function runDijkstra(e,t,r,i){var a={},o=new n,s,c,updateNeighbors=function(e){var t=e.v===s?e.w:e.v,n=a[t],i=r(e),l=c.distance+i;if(i<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+i);l<n.distance&&(n.distance=l,n.predecessor=s,o.decrease(t,l))};for(e.nodes().forEach(function(e){var n=e===t?0:1/0;a[e]={distance:n},o.add(e,n)});o.size()>0&&(s=o.removeMin(),c=a[s],c.distance!==1/0);)i(s).forEach(updateNeighbors);return a}})),c=e(((e,t)=>{var n=s();t.exports=dijkstraAll;function dijkstraAll(e,t,r){return e.nodes().reduce(function(i,a){return i[a]=n(e,a,t,r),i},{})}})),l=e(((e,t)=>{t.exports=tarjan;function tarjan(e){var t=0,n=[],r={},i=[];function dfs(a){var o=r[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(e){Object.hasOwn(r,e)?r[e].onStack&&(o.lowlink=Math.min(o.lowlink,r[e].index)):(dfs(e),o.lowlink=Math.min(o.lowlink,r[e].lowlink))}),o.lowlink===o.index){var s=[],c;do c=n.pop(),r[c].onStack=!1,s.push(c);while(a!==c);i.push(s)}}return e.nodes().forEach(function(e){Object.hasOwn(r,e)||dfs(e)}),i}})),u=e(((e,t)=>{var n=l();t.exports=findCycles;function findCycles(e){return n(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}})),d=e(((e,t)=>{t.exports=floydWarshall;var DEFAULT_WEIGHT_FUNC=()=>1;function floydWarshall(e,t,n){return runFloydWarshall(e,t||DEFAULT_WEIGHT_FUNC,n||function(t){return e.outEdges(t)})}function runFloydWarshall(e,t,n){var r={},i=e.nodes();return i.forEach(function(e){r[e]={},r[e][e]={distance:0},i.forEach(function(t){e!==t&&(r[e][t]={distance:1/0})}),n(e).forEach(function(n){var i=n.v===e?n.w:n.v,a=t(n);r[e][i]={distance:a,predecessor:e}})}),i.forEach(function(e){var t=r[e];i.forEach(function(n){var a=r[n];i.forEach(function(n){var r=a[e],i=t[n],o=a[n],s=r.distance+i.distance;s<o.distance&&(o.distance=s,o.predecessor=i.predecessor)})})}),r}})),f=e(((e,t)=>{function topsort(e){var t={},n={},r=[];function visit(i){if(Object.hasOwn(n,i))throw new CycleException;Object.hasOwn(t,i)||(n[i]=!0,t[i]=!0,e.predecessors(i).forEach(visit),delete n[i],r.push(i))}if(e.sinks().forEach(visit),Object.keys(t).length!==e.nodeCount())throw new CycleException;return r}var CycleException=class extends Error{constructor(){super(...arguments)}};t.exports=topsort,topsort.CycleException=CycleException})),p=e(((e,t)=>{var n=f();t.exports=isAcyclic;function isAcyclic(e){try{n(e)}catch(e){if(e instanceof n.CycleException)return!1;throw e}return!0}})),m=e(((e,t)=>{t.exports=dfs;function dfs(e,t,n){Array.isArray(t)||(t=[t]);var r=e.isDirected()?t=>e.successors(t):t=>e.neighbors(t),i=n===`post`?postOrderDfs:preOrderDfs,a=[],o={};return t.forEach(t=>{if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);i(t,r,o,a)}),a}function postOrderDfs(e,t,n,r){for(var i=[[e,!1]];i.length>0;){var a=i.pop();a[1]?r.push(a[0]):Object.hasOwn(n,a[0])||(n[a[0]]=!0,i.push([a[0],!0]),forEachRight(t(a[0]),e=>i.push([e,!1])))}}function preOrderDfs(e,t,n,r){for(var i=[e];i.length>0;){var a=i.pop();Object.hasOwn(n,a)||(n[a]=!0,r.push(a),forEachRight(t(a),e=>i.push(e)))}}function forEachRight(e,t){for(var n=e.length;n--;)t(e[n],n,e);return e}})),h=e(((e,t)=>{var n=m();t.exports=postorder;function postorder(e,t){return n(e,t,`post`)}})),g=e(((e,t)=>{var n=m();t.exports=preorder;function preorder(e,t){return n(e,t,`pre`)}})),_=e(((e,n)=>{var r=t(),i=o();n.exports=prim;function prim(e,t){var n=new r,a={},o=new i,s;function updateNeighbors(e){var n=e.v===s?e.w:e.v,r=o.priority(n);if(r!==void 0){var i=t(e);i<r&&(a[n]=s,o.decrease(n,i))}}if(e.nodeCount()===0)return n;e.nodes().forEach(function(e){o.add(e,1/0),n.setNode(e)}),o.decrease(e.nodes()[0],0);for(var c=!1;o.size()>0;){if(s=o.removeMin(),Object.hasOwn(a,s))n.setEdge(s,a[s]);else if(c)throw Error(`Input graph is not connected: `+e);else c=!0;e.nodeEdges(s).forEach(updateNeighbors)}return n}})),v=e(((e,t)=>{t.exports={components:a(),dijkstra:s(),dijkstraAll:c(),findCycles:u(),floydWarshall:d(),isAcyclic:p(),postorder:h(),preorder:g(),prim:_(),tarjan:l(),topsort:f()}})),y=e(((e,t)=>{var n=r();t.exports={Graph:n.Graph,json:i(),alg:v(),version:n.version}})),b=e(((e,t)=>{var List=class{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return unlink(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&unlink(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,filterOutLinks)),n=n._prev;return`[`+e.join(`, `)+`]`}};function unlink(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function filterOutLinks(e,t){if(e!==`_next`&&e!==`_prev`)return t}t.exports=List})),x=e(((e,t)=>{let n=y().Graph,r=b();t.exports=greedyFAS;let DEFAULT_WEIGHT_FN=()=>1;function greedyFAS(e,t){if(e.nodeCount()<=1)return[];let n=buildState(e,t||DEFAULT_WEIGHT_FN);return doGreedyFAS(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w))}function doGreedyFAS(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)removeNode(e,t,n,o);for(;o=i.dequeue();)removeNode(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i].dequeue(),o){r=r.concat(removeNode(e,t,n,o,!0));break}}}return r}function removeNode(e,t,n,r,i){let a=i?[]:void 0;return e.inEdges(r.v).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,assignBucket(t,n,s)}),e.outEdges(r.v).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,assignBucket(t,n,o)}),e.removeNode(r.v),a}function buildState(e,t){let i=new n,a=0,o=0;e.nodes().forEach(e=>{i.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let n=i.edge(e.v,e.w)||0,r=t(e),s=n+r;i.setEdge(e.v,e.w,s),o=Math.max(o,i.node(e.v).out+=r),a=Math.max(a,i.node(e.w).in+=r)});let s=range(o+a+3).map(()=>new r),c=a+1;return i.nodes().forEach(e=>{assignBucket(s,c,i.node(e))}),{graph:i,buckets:s,zeroIdx:c}}function assignBucket(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}function range(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}})),S=e(((e,t)=>{let n=y().Graph;t.exports={addBorderNode,addDummyNode,applyWithChunking,asNonCompoundGraph,buildLayerMatrix,intersectRect,mapValues,maxRank,normalizeRanks,notime,partition,pick,predecessorWeights,range,removeEmptyRanks,simplify,successorWeights,time,uniqueId,zipObject};function addDummyNode(e,t,n,r){for(var i=r;e.hasNode(i);)i=uniqueId(r);return n.dummy=t,e.setNode(i,n),i}function simplify(e){let t=new n().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function asNonCompoundGraph(e){let t=new n({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function successorWeights(e){let t=e.nodes().map(t=>{let n={};return e.outEdges(t).forEach(t=>{n[t.w]=(n[t.w]||0)+e.edge(t).weight}),n});return zipObject(e.nodes(),t)}function predecessorWeights(e){let t=e.nodes().map(t=>{let n={};return e.inEdges(t).forEach(t=>{n[t.v]=(n[t.v]||0)+e.edge(t).weight}),n});return zipObject(e.nodes(),t)}function intersectRect(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function buildLayerMatrix(e){let t=range(maxRank(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i][r.order]=n)}),t}function normalizeRanks(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=applyWithChunking(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function removeEmptyRanks(e){let t=e.nodes().map(t=>e.node(t).rank),n=applyWithChunking(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function addBorderNode(e,t,n,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),addDummyNode(e,`border`,i,t)}function splitToChunks(e,t=r){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}let r=65535;function applyWithChunking(e,t){if(t.length>r){let n=splitToChunks(t);return e.apply(null,n.map(t=>e.apply(null,t)))}else return e.apply(null,t)}function maxRank(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return applyWithChunking(Math.max,t)}function partition(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function time(e,t){let n=Date.now();try{return t()}finally{console.log(e+` time: `+(Date.now()-n)+`ms`)}}function notime(e,t){return t()}let i=0;function uniqueId(e){return e+(``+ ++i)}function range(e,t,n=1){t??(t=e,e=0);let endCon=e=>e<t;n<0&&(endCon=e=>t<e);let r=[];for(let t=e;endCon(t);t+=n)r.push(t);return r}function pick(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function mapValues(e,t){let func=t;return typeof t==`string`&&(func=e=>e[t]),Object.entries(e).reduce((e,[t,n])=>(e[t]=func(n,t),e),{})}function zipObject(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}})),C=e(((e,t)=>{let n=x(),r=S().uniqueId;t.exports={run,undo};function run(e){(e.graph().acyclicer===`greedy`?n(e,weightFn(e)):dfsFAS(e)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,r(`rev`))});function weightFn(e){return t=>e.edge(t).weight}}function dfsFAS(e){let t=[],n={},r={};function dfs(i){Object.hasOwn(r,i)||(r[i]=!0,n[i]=!0,e.outEdges(i).forEach(e=>{Object.hasOwn(n,e.w)?t.push(e):dfs(e.w)}),delete n[i])}return e.nodes().forEach(dfs),t}function undo(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}})),w=e(((e,t)=>{let n=S();t.exports={run,undo};function run(e){e.graph().dummyChains=[],e.edges().forEach(t=>normalizeEdge(e,t))}function normalizeEdge(e,t){let r=t.v,i=e.node(r).rank,a=t.w,o=e.node(a).rank,s=t.name,c=e.edge(t),l=c.labelRank;if(o===i+1)return;e.removeEdge(t);let u,d,f;for(f=0,++i;i<o;++f,++i)c.points=[],d={width:0,height:0,edgeLabel:c,edgeObj:t,rank:i},u=n.addDummyNode(e,`edge`,d,`_d`),i===l&&(d.width=c.width,d.height=c.height,d.dummy=`edge-label`,d.labelpos=c.labelpos),e.setEdge(r,u,{weight:c.weight},s),f===0&&e.graph().dummyChains.push(u),r=u;e.setEdge(r,a,{weight:c.weight},s)}function undo(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}})),T=e(((e,t)=>{let{applyWithChunking:n}=S();t.exports={longestPath,slack};function longestPath(e){var t={};function dfs(r){var i=e.node(r);if(Object.hasOwn(t,r))return i.rank;t[r]=!0;let a=e.outEdges(r).map(t=>t==null?1/0:dfs(t.w)-e.edge(t).minlen);var o=n(Math.min,a);return o===1/0&&(o=0),i.rank=o}e.sources().forEach(dfs)}function slack(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}})),E=e(((e,t)=>{var n=y().Graph,r=T().slack;t.exports=feasibleTree;function feasibleTree(e){var t=new n({directed:!1}),i=e.nodes()[0],a=e.nodeCount();t.setNode(i,{});for(var o,s;tightTree(t,e)<a;)o=findMinSlackEdge(t,e),s=t.hasNode(o.v)?r(e,o):-r(e,o),shiftRanks(t,e,s);return t}function tightTree(e,t){function dfs(n){t.nodeEdges(n).forEach(i=>{var a=i.v,o=n===a?i.w:a;!e.hasNode(o)&&!r(t,i)&&(e.setNode(o,{}),e.setEdge(n,o,{}),dfs(o))})}return e.nodes().forEach(dfs),e.nodeCount()}function findMinSlackEdge(e,t){return t.edges().reduce((n,i)=>{let a=1/0;return e.hasNode(i.v)!==e.hasNode(i.w)&&(a=r(t,i)),a<n[0]?[a,i]:n},[1/0,null])[1]}function shiftRanks(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}})),D=e(((e,t)=>{var n=E(),r=T().slack,i=T().longestPath,a=y().alg.preorder,o=y().alg.postorder,s=S().simplify;t.exports=networkSimplex,networkSimplex.initLowLimValues=initLowLimValues,networkSimplex.initCutValues=initCutValues,networkSimplex.calcCutValue=calcCutValue,networkSimplex.leaveEdge=leaveEdge,networkSimplex.enterEdge=enterEdge,networkSimplex.exchangeEdges=exchangeEdges;function networkSimplex(e){e=s(e),i(e);var t=n(e);initLowLimValues(t),initCutValues(t,e);for(var r,a;r=leaveEdge(t);)a=enterEdge(t,e,r),exchangeEdges(t,e,r,a)}function initCutValues(e,t){var n=o(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>assignCutValue(e,t,n))}function assignCutValue(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=calcCutValue(e,t,n)}function calcCutValue(e,t,n){var r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;return a||=(i=!1,t.edge(r,n)),o=a.weight,t.nodeEdges(n).forEach(a=>{var s=a.v===n,c=s?a.w:a.v;if(c!==r){var l=s===i,u=t.edge(a).weight;if(o+=l?u:-u,isTreeEdge(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function initLowLimValues(e,t){arguments.length<2&&(t=e.nodes()[0]),dfsAssignLowLim(e,{},1,t)}function dfsAssignLowLim(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,e.neighbors(r).forEach(i=>{Object.hasOwn(t,i)||(n=dfsAssignLowLim(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function leaveEdge(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function enterEdge(e,t,n){var i=n.v,a=n.w;t.hasEdge(i,a)||(i=n.w,a=n.v);var o=e.node(i),s=e.node(a),c=o,l=!1;return o.lim>s.lim&&(c=s,l=!0),t.edges().filter(t=>l===isDescendant(e,e.node(t.v),c)&&l!==isDescendant(e,e.node(t.w),c)).reduce((e,n)=>r(t,n)<r(t,e)?n:e)}function exchangeEdges(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),initLowLimValues(e),initCutValues(e,t),updateRanks(e,t)}function updateRanks(e,t){var n=a(e,e.nodes().find(e=>!t.node(e).parent));n=n.slice(1),n.forEach(n=>{var r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function isTreeEdge(e,t,n){return e.hasEdge(t,n)}function isDescendant(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}})),O=e(((e,t)=>{var n=T().longestPath,r=E(),i=D();t.exports=rank;function rank(e){var t=e.graph().ranker;if(t instanceof Function)return t(e);switch(e.graph().ranker){case`network-simplex`:networkSimplexRanker(e);break;case`tight-tree`:tightTreeRanker(e);break;case`longest-path`:a(e);break;case`none`:break;default:networkSimplexRanker(e)}}var a=n;function tightTreeRanker(e){n(e),r(e)}function networkSimplexRanker(e){i(e)}})),k=e(((e,t)=>{t.exports=parentDummyChains;function parentDummyChains(e){let t=postorder(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),i=r.edgeObj,a=findPath(e,t,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;for(;n!==i.w;){if(r=e.node(n),u){for(;(l=o[c])!==s&&e.node(l).maxRank<r.rank;)c++;l===s&&(u=!1)}if(!u){for(;c<o.length-1&&e.node(l=o[c+1]).minRank<=r.rank;)c++;l=o[c]}e.setParent(n,l),n=e.successors(n)[0]}})}function findPath(e,t,n,r){let i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c,l;c=n;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));for(l=c,c=r;(c=e.parent(c))!==l;)a.push(c);return{path:i.concat(a.reverse()),lca:l}}function postorder(e){let t={},n=0;function dfs(r){let i=n;e.children(r).forEach(dfs),t[r]={low:i,lim:n++}}return e.children().forEach(dfs),t}})),A=e(((e,t)=>{let n=S();t.exports={run,cleanup};function run(e){let t=n.addDummyNode(e,`root`,{},`_root`),r=treeDepths(e),i=Object.values(r),a=n.applyWithChunking(Math.max,i)-1,o=2*a+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=o);let s=sumWeights(e)+1;e.children().forEach(n=>dfs(e,t,o,s,a,r,n)),e.graph().nodeRankFactor=o}function dfs(e,t,r,i,a,o,s){let c=e.children(s);if(!c.length){s!==t&&e.setEdge(t,s,{weight:0,minlen:r});return}let l=n.addBorderNode(e,`_bt`),u=n.addBorderNode(e,`_bb`),d=e.node(s);e.setParent(l,s),d.borderTop=l,e.setParent(u,s),d.borderBottom=u,c.forEach(n=>{dfs(e,t,r,i,a,o,n);let c=e.node(n),d=c.borderTop?c.borderTop:n,f=c.borderBottom?c.borderBottom:n,p=c.borderTop?i:2*i,m=d===f?a-o[s]+1:1;e.setEdge(l,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,u,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(s)||e.setEdge(t,l,{weight:0,minlen:a+o[s]})}function treeDepths(e){var t={};function dfs(n,r){var i=e.children(n);i&&i.length&&i.forEach(e=>dfs(e,r+1)),t[n]=r}return e.children().forEach(e=>dfs(e,1)),t}function sumWeights(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function cleanup(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}})),j=e(((e,t)=>{let n=S();t.exports=addBorderSegments;function addBorderSegments(e){function dfs(t){let n=e.children(t),r=e.node(t);if(n.length&&n.forEach(dfs),Object.hasOwn(r,`minRank`)){r.borderLeft=[],r.borderRight=[];for(let n=r.minRank,i=r.maxRank+1;n<i;++n)addBorderNode(e,`borderLeft`,`_bl`,t,r,n),addBorderNode(e,`borderRight`,`_br`,t,r,n)}}e.children().forEach(dfs)}function addBorderNode(e,t,r,i,a,o){let s={width:0,height:0,rank:o,borderType:t},c=a[t][o-1],l=n.addDummyNode(e,`border`,s,r);a[t][o]=l,e.setParent(l,i),c&&e.setEdge(c,l,{weight:1})}})),M=e(((e,t)=>{t.exports={adjust,undo};function adjust(e){let t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&swapWidthHeight(e)}function undo(e){let t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&reverseY(e),(t===`lr`||t===`rl`)&&(swapXY(e),swapWidthHeight(e))}function swapWidthHeight(e){e.nodes().forEach(t=>swapWidthHeightOne(e.node(t))),e.edges().forEach(t=>swapWidthHeightOne(e.edge(t)))}function swapWidthHeightOne(e){let t=e.width;e.width=e.height,e.height=t}function reverseY(e){e.nodes().forEach(t=>reverseYOne(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(reverseYOne),Object.hasOwn(n,`y`)&&reverseYOne(n)})}function reverseYOne(e){e.y=-e.y}function swapXY(e){e.nodes().forEach(t=>swapXYOne(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(swapXYOne),Object.hasOwn(n,`x`)&&swapXYOne(n)})}function swapXYOne(e){let t=e.x;e.x=e.y,e.y=t}})),N=e(((e,t)=>{let n=S();t.exports=initOrder;function initOrder(e){let t={},r=e.nodes().filter(t=>!e.children(t).length),i=r.map(t=>e.node(t).rank),a=n.applyWithChunking(Math.max,i),o=n.range(a+1).map(()=>[]);function dfs(n){t[n]||(t[n]=!0,o[e.node(n).rank].push(n),e.successors(n).forEach(dfs))}return r.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(dfs),o}})),P=e(((e,t)=>{let n=S().zipObject;t.exports=crossCount;function crossCount(e,t){let n=0;for(let r=1;r<t.length;++r)n+=twoLayerCrossCount(e,t[r-1],t[r]);return n}function twoLayerCrossCount(e,t,r){let i=n(r,r.map((e,t)=>t)),a=t.flatMap(t=>e.outEdges(t).map(t=>({pos:i[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos)),o=1;for(;o<r.length;)o<<=1;let s=2*o-1;--o;let c=Array(s).fill(0),l=0;return a.forEach(e=>{let t=e.pos+o;c[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=c[t+1]),t=t-1>>1,c[t]+=e.weight;l+=e.weight*n}),l}})),F=e(((e,t)=>{t.exports=barycenter;function barycenter(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(n.length){let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}else return{v:t}})}})),I=e(((e,t)=>{let n=S();t.exports=resolveConflicts;function resolveConflicts(e,t){let n={};return e.forEach((e,t)=>{let r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight)}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(n[e.w]))}),doResolveConflicts(Object.values(n).filter(e=>!e.indegree))}function doResolveConflicts(e){let t=[];function handleIn(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&mergeEntries(e,t)}}function handleOut(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let n=e.pop();t.push(n),n.in.reverse().forEach(handleIn(n)),n.out.forEach(handleOut(n))}return t.filter(e=>!e.merged).map(e=>n.pick(e,[`vs`,`i`,`barycenter`,`weight`]))}function mergeEntries(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}})),L=e(((e,t)=>{let n=S();t.exports=sort;function sort(e,t){let r=n.partition(e,e=>Object.hasOwn(e,`barycenter`)),i=r.lhs,a=r.rhs.sort((e,t)=>t.i-e.i),o=[],s=0,c=0,l=0;i.sort(compareWithBias(!!t)),l=consumeUnsortable(o,a,l),i.forEach(e=>{l+=e.vs.length,o.push(e.vs),s+=e.barycenter*e.weight,c+=e.weight,l=consumeUnsortable(o,a,l)});let u={vs:o.flat(!0)};return c&&(u.barycenter=s/c,u.weight=c),u}function consumeUnsortable(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function compareWithBias(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}})),R=e(((e,t)=>{let n=F(),r=I(),i=L();t.exports=sortSubgraph;function sortSubgraph(e,t,a,o){let s=e.children(t),c=e.node(t),l=c?c.borderLeft:void 0,u=c?c.borderRight:void 0,d={};l&&(s=s.filter(e=>e!==l&&e!==u));let f=n(e,s);f.forEach(t=>{if(e.children(t.v).length){let n=sortSubgraph(e,t.v,a,o);d[t.v]=n,Object.hasOwn(n,`barycenter`)&&mergeBarycenters(t,n)}});let p=r(f,a);expandSubgraphs(p,d);let m=i(p,o);if(l&&(m.vs=[l,m.vs,u].flat(!0),e.predecessors(l).length)){let t=e.node(e.predecessors(l)[0]),n=e.node(e.predecessors(u)[0]);Object.hasOwn(m,`barycenter`)||(m.barycenter=0,m.weight=0),m.barycenter=(m.barycenter*m.weight+t.order+n.order)/(m.weight+2),m.weight+=2}return m}function expandSubgraphs(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function mergeBarycenters(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}})),z=e(((e,t)=>{let n=y().Graph,r=S();t.exports=buildLayerGraph;function buildLayerGraph(e,t,r,i){i||=e.nodes();let a=createRootNode(e),o=new n({compound:!0}).setGraph({root:a}).setDefaultNodeLabel(t=>e.node(t));return i.forEach(n=>{let i=e.node(n),s=e.parent(n);(i.rank===t||i.minRank<=t&&t<=i.maxRank)&&(o.setNode(n),o.setParent(n,s||a),e[r](n).forEach(t=>{let r=t.v===n?t.w:t.v,i=o.edge(r,n),a=i===void 0?0:i.weight;o.setEdge(r,n,{weight:e.edge(t).weight+a})}),Object.hasOwn(i,`minRank`)&&o.setNode(n,{borderLeft:i.borderLeft[t],borderRight:i.borderRight[t]}))}),o}function createRootNode(e){for(var t;e.hasNode(t=r.uniqueId(`_root`)););return t}})),B=e(((e,t)=>{t.exports=addSubgraphConstraints;function addSubgraphConstraints(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}})),V=e(((e,t)=>{let n=N(),r=P(),i=R(),a=z(),o=B(),s=y().Graph,c=S();t.exports=order;function order(e,t){if(t&&typeof t.customOrder==`function`){t.customOrder(e,order);return}let i=c.maxRank(e),a=buildLayerGraphs(e,c.range(1,i+1),`inEdges`),o=buildLayerGraphs(e,c.range(i-1,-1,-1),`outEdges`),s=n(e);if(assignOrder(e,s),t&&t.disableOptimalOrderHeuristic)return;let l=1/0,u;for(let t=0,n=0;n<4;++t,++n){sweepLayerGraphs(t%2?a:o,t%4>=2),s=c.buildLayerMatrix(e);let i=r(e,s);i<l&&(n=0,u=Object.assign({},s),l=i)}assignOrder(e,u)}function buildLayerGraphs(e,t,n){let r=new Map,addNodeToRank=(e,t)=>{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if(typeof n.rank==`number`&&addNodeToRank(n.rank,t),typeof n.minRank==`number`&&typeof n.maxRank==`number`)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&addNodeToRank(e,t)}return t.map(function(t){return a(e,t,n,r.get(t)||[])})}function sweepLayerGraphs(e,t){let n=new s;e.forEach(function(e){let r=e.graph().root,a=i(e,r,n,t);a.vs.forEach((t,n)=>e.node(t).order=n),o(e,n,a.vs)})}function assignOrder(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}})),H=e(((e,t)=>{let n=y().Graph,r=S();t.exports={positionX,findType1Conflicts,findType2Conflicts,addConflict,hasConflict,verticalAlignment,horizontalCompaction,alignCoordinates,findSmallestWidthAlignment,balance};function findType1Conflicts(e,t){let n={};function visitLayer(t,r){let i=0,a=0,o=t.length,s=r[r.length-1];return r.forEach((t,c)=>{let l=findOtherInnerSegmentNode(e,t),u=l?e.node(l).order:o;(l||t===s)&&(r.slice(a,c+1).forEach(t=>{e.predecessors(t).forEach(r=>{let a=e.node(r),o=a.order;(o<i||u<o)&&!(a.dummy&&e.node(t).dummy)&&addConflict(n,r,t)})}),a=c+1,i=u)}),r}return t.length&&t.reduce(visitLayer),n}function findType2Conflicts(e,t){let n={};function scan(t,i,a,o,s){let c;r.range(i,a).forEach(r=>{c=t[r],e.node(c).dummy&&e.predecessors(c).forEach(t=>{let r=e.node(t);r.dummy&&(r.order<o||r.order>s)&&addConflict(n,t,c)})})}function visitLayer(t,n){let r=-1,i,a=0;return n.forEach((o,s)=>{if(e.node(o).dummy===`border`){let t=e.predecessors(o);t.length&&(i=e.node(t[0]).order,scan(n,a,s,r,i),a=s,r=i)}scan(n,a,n.length,i,t.length)}),n}return t.length&&t.reduce(visitLayer),n}function findOtherInnerSegmentNode(e,t){if(e.node(t).dummy)return e.predecessors(t).find(t=>e.node(t).dummy)}function addConflict(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function hasConflict(e,t,n){if(t>n){let e=t;t=n,n=e}return!!e[t]&&Object.hasOwn(e[t],n)}function verticalAlignment(e,t,n,r){let i={},a={},o={};return t.forEach(e=>{e.forEach((e,t)=>{i[e]=e,a[e]=e,o[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let s=r(e);if(s.length){s=s.sort((e,t)=>o[e]-o[t]);let r=(s.length-1)/2;for(let c=Math.floor(r),l=Math.ceil(r);c<=l;++c){let r=s[c];a[e]===e&&t<o[r]&&!hasConflict(n,e,r)&&(a[r]=e,a[e]=i[e]=i[r],t=o[r])}}})}),{root:i,align:a}}function horizontalCompaction(e,t,n,r,i){let a={},o=buildBlockGraph(e,t,n,i),s=i?`borderLeft`:`borderRight`;function iterate(e,t){let n=o.nodes(),r=n.pop(),i={};for(;r;)i[r]?e(r):(i[r]=!0,n.push(r),n=n.concat(t(r))),r=n.pop()}function pass1(e){a[e]=o.inEdges(e).reduce((e,t)=>Math.max(e,a[t.v]+o.edge(t)),0)}function pass2(t){let n=o.outEdges(t).reduce((e,t)=>Math.min(e,a[t.w]-o.edge(t)),1/0),r=e.node(t);n!==1/0&&r.borderType!==s&&(a[t]=Math.max(a[t],n))}return iterate(pass1,o.predecessors.bind(o)),iterate(pass2,o.successors.bind(o)),Object.keys(r).forEach(e=>a[e]=a[n[e]]),a}function buildBlockGraph(e,t,r,i){let a=new n,o=e.graph(),s=sep(o.nodesep,o.edgesep,i);return t.forEach(t=>{let n;t.forEach(t=>{let i=r[t];if(a.setNode(i),n){var o=r[n],c=a.edge(o,i);a.setEdge(o,i,Math.max(s(e,t,n),c||0))}n=t})}),a}function findSmallestWidthAlignment(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=width(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[1/0,null])[1]}function alignCoordinates(e,t){let n=Object.values(t),i=r.applyWithChunking(Math.min,n),a=r.applyWithChunking(Math.max,n);[`u`,`d`].forEach(n=>{[`l`,`r`].forEach(o=>{let s=n+o,c=e[s];if(c===t)return;let l=Object.values(c),u=i-r.applyWithChunking(Math.min,l);o!==`l`&&(u=a-r.applyWithChunking(Math.max,l)),u&&(e[s]=r.mapValues(c,e=>e+u))})})}function balance(e,t){return r.mapValues(e.ul,(n,r)=>{if(t)return e[t.toLowerCase()][r];{let t=Object.values(e).map(e=>e[r]).sort((e,t)=>e-t);return(t[1]+t[2])/2}})}function positionX(e){let t=r.buildLayerMatrix(e),n=Object.assign(findType1Conflicts(e,t),findType2Conflicts(e,t)),i={},a;return[`u`,`d`].forEach(o=>{a=o===`u`?t:Object.values(t).reverse(),[`l`,`r`].forEach(t=>{t===`r`&&(a=a.map(e=>Object.values(e).reverse()));let s=(o===`u`?e.predecessors:e.successors).bind(e),c=verticalAlignment(e,a,n,s),l=horizontalCompaction(e,a,c.root,c.align,t===`r`);t===`r`&&(l=r.mapValues(l,e=>-e)),i[o+t]=l})}),alignCoordinates(i,findSmallestWidthAlignment(e,i)),balance(i,e.graph().align)}function sep(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2;break}if(l&&(c+=n?l:-l),l=0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2;break}return l&&(c+=n?l:-l),l=0,c}}function width(e,t){return e.node(t).width}})),U=e(((e,t)=>{let n=S(),r=H().positionX;t.exports=position;function position(e){e=n.asNonCompoundGraph(e),positionY(e),Object.entries(r(e)).forEach(([t,n])=>e.node(t).x=n)}function positionY(e){let t=n.buildLayerMatrix(e),r=e.graph().ranksep,i=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height;return t>r?t:r},0);t.forEach(t=>e.node(t).y=i+n/2),i+=n+r})}})),W=e(((e,t)=>{let n=C(),r=w(),i=O(),a=S().normalizeRanks,o=k(),s=S().removeEmptyRanks,c=A(),l=j(),u=M(),d=V(),f=U(),p=S(),m=y().Graph;t.exports=layout;function layout(e,t){let n=t&&t.debugTiming?p.time:p.notime;n(`layout`,()=>{let r=n(` buildLayoutGraph`,()=>buildLayoutGraph(e));n(` runLayout`,()=>runLayout(r,n,t)),n(` updateInputGraph`,()=>updateInputGraph(e,r))})}function runLayout(e,t,m){t(` makeSpaceForEdgeLabels`,()=>makeSpaceForEdgeLabels(e)),t(` removeSelfEdges`,()=>removeSelfEdges(e)),t(` acyclic`,()=>n.run(e)),t(` nestingGraph.run`,()=>c.run(e)),t(` rank`,()=>i(p.asNonCompoundGraph(e))),t(` injectEdgeLabelProxies`,()=>injectEdgeLabelProxies(e)),t(` removeEmptyRanks`,()=>s(e)),t(` nestingGraph.cleanup`,()=>c.cleanup(e)),t(` normalizeRanks`,()=>a(e)),t(` assignRankMinMax`,()=>assignRankMinMax(e)),t(` removeEdgeLabelProxies`,()=>removeEdgeLabelProxies(e)),t(` normalize.run`,()=>r.run(e)),t(` parentDummyChains`,()=>o(e)),t(` addBorderSegments`,()=>l(e)),t(` order`,()=>d(e,m)),t(` insertSelfEdges`,()=>insertSelfEdges(e)),t(` adjustCoordinateSystem`,()=>u.adjust(e)),t(` position`,()=>f(e)),t(` positionSelfEdges`,()=>positionSelfEdges(e)),t(` removeBorderNodes`,()=>removeBorderNodes(e)),t(` normalize.undo`,()=>r.undo(e)),t(` fixupEdgeLabelCoords`,()=>fixupEdgeLabelCoords(e)),t(` undoCoordinateSystem`,()=>u.undo(e)),t(` translateGraph`,()=>translateGraph(e)),t(` assignNodeIntersects`,()=>assignNodeIntersects(e)),t(` reversePoints`,()=>reversePointsForReversedEdges(e)),t(` acyclic.undo`,()=>n.undo(e))}function updateInputGraph(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}let h=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],g={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},_=[`acyclicer`,`ranker`,`rankdir`,`align`],v=[`width`,`height`,`rank`],b={width:0,height:0},x=[`minlen`,`weight`,`width`,`height`,`labeloffset`],T={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},E=[`labelpos`];function buildLayoutGraph(e){let t=new m({multigraph:!0,compound:!0}),n=canonicalize(e.graph());return t.setGraph(Object.assign({},g,selectNumberAttrs(n,h),p.pick(n,_))),e.nodes().forEach(n=>{let r=selectNumberAttrs(canonicalize(e.node(n)),v);Object.keys(b).forEach(e=>{r[e]===void 0&&(r[e]=b[e])}),t.setNode(n,r),t.setParent(n,e.parent(n))}),e.edges().forEach(n=>{let r=canonicalize(e.edge(n));t.setEdge(n,Object.assign({},T,selectNumberAttrs(r,x),p.pick(r,E)))}),t}function makeSpaceForEdgeLabels(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function injectEdgeLabelProxies(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v),r={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};p.addDummyNode(e,`edge-proxy`,r,`_ep`)}})}function assignRankMinMax(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function removeEdgeLabelProxies(e){e.nodes().forEach(t=>{let n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function translateGraph(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function getExtremes(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>getExtremes(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&getExtremes(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function assignNodeIntersects(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(p.intersectRect(r,a)),n.points.push(p.intersectRect(i,o))})}function fixupEdgeLabelCoords(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset;break}})}function reversePointsForReversedEdges(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function removeBorderNodes(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function removeSelfEdges(e){e.edges().forEach(t=>{if(t.v===t.w){var n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function insertSelfEdges(e){p.buildLayerMatrix(e).forEach(t=>{var n=0;t.forEach((t,r)=>{var i=e.node(t);i.order=r+n,(i.selfEdges||[]).forEach(t=>{p.addDummyNode(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function positionSelfEdges(e){e.nodes().forEach(t=>{var n=e.node(t);if(n.dummy===`selfedge`){var r=e.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function selectNumberAttrs(e,t){return p.mapValues(p.pick(e,t),Number)}function canonicalize(e){var t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}})),G=e(((e,t)=>{let n=S(),r=y().Graph;t.exports={debugOrdering};function debugOrdering(e){let t=n.buildLayerMatrix(e),i=new r({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{i.setNode(t,{label:t}),i.setParent(t,`layer`+e.node(t).rank)}),e.edges().forEach(e=>i.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{let n=`layer`+t;i.setNode(n,{rank:`same`}),e.reduce((e,t)=>(i.setEdge(e,t,{style:`invis`}),t))}),i}})),K=e(((e,t)=>{t.exports=`1.1.8`})),q=e(((e,t)=>{t.exports={graphlib:y(),layout:W(),debug:G(),util:{time:S().time,notime:S().notime},version:K()}}));export{q as t};
|
|
1
|
+
import{t as e}from"../../rolldown-runtime.mjs";var t=e(((e,t)=>{var n=`\0`,r=`\0`,i=``,a=class{_isDirected=!0;_isMultigraph=!1;_isCompound=!1;_label;_defaultNodeLabelFn=()=>void 0;_defaultEdgeLabelFn=()=>void 0;_nodes={};_in={};_preds={};_out={};_sucs={};_edgeObjs={};_edgeLabels={};_nodeCount=0;_edgeCount=0;_parent;_children;constructor(e){e&&(this._isDirected=Object.hasOwn(e,`directed`)?e.directed:!0,this._isMultigraph=Object.hasOwn(e,`multigraph`)?e.multigraph:!1,this._isCompound=Object.hasOwn(e,`compound`)?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[r]={})}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 this._defaultNodeLabelFn=e,typeof e!=`function`&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter(t=>Object.keys(e._in[t]).length===0)}sinks(){var e=this;return this.nodes().filter(t=>Object.keys(e._out[t]).length===0)}setNodes(e,t){var n=arguments,r=this;return e.forEach(function(e){n.length>1?r.setNode(e,t):r.setNode(e)}),this}setNode(e,t){return Object.hasOwn(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=r,this._children[e]={},this._children[r][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 Object.hasOwn(this._nodes,e)}removeNode(e){var t=this;if(Object.hasOwn(this._nodes,e)){var n=e=>t.removeEdge(t._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(function(e){t.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(n),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(n),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=r;else{t+=``;for(var n=t;n!==void 0;n=this.parent(n))if(n===e)throw 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}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if(t!==r)return t}}children(e=r){if(this._isCompound){var t=this._children[e];if(t)return Object.keys(t)}else if(e===r)return this.nodes();else if(this.hasNode(e))return[]}predecessors(e){var t=this._preds[e];if(t)return Object.keys(t)}successors(e){var t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){var t=this.predecessors(e);if(t){let r=new Set(t);for(var n of this.successors(e))r.add(n);return Array.from(r.values())}}isLeaf(e){return(this.isDirected()?this.successors(e):this.neighbors(e)).length===0}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;Object.entries(this._nodes).forEach(function([n,r]){e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))});var r={};function i(e){var a=n.parent(e);return a===void 0||t.hasNode(a)?(r[e]=a,a):a in r?r[a]:i(a)}return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,i(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,typeof e!=`function`&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){var n=this,r=arguments;return e.reduce(function(e,i){return r.length>1?n.setEdge(e,i,t):n.setEdge(e,i),i}),this}setEdge(){var e,t,n,r,i=!1,a=arguments[0];typeof a==`object`&&a&&`v`in a?(e=a.v,t=a.w,n=a.name,arguments.length===2&&(r=arguments[1],i=!0)):(e=a,t=arguments[1],n=arguments[3],arguments.length>2&&(r=arguments[2],i=!0)),e=``+e,t=``+t,n!==void 0&&(n=``+n);var s=c(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,s))return i&&(this._edgeLabels[s]=r),this;if(n!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(e),this.setNode(t),this._edgeLabels[s]=i?r:this._defaultEdgeLabelFn(e,t,n);var u=l(this._isDirected,e,t,n);return e=u.v,t=u.w,Object.freeze(u),this._edgeObjs[s]=u,o(this._preds[t],e),o(this._sucs[e],t),this._in[t][s]=u,this._out[e][s]=u,this._edgeCount++,this}edge(e,t,n){var r=arguments.length===1?u(this._isDirected,arguments[0]):c(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(){let e=this.edge(...arguments);return typeof e==`object`?e:{label:e}}hasEdge(e,t,n){var r=arguments.length===1?u(this._isDirected,arguments[0]):c(this._isDirected,e,t,n);return Object.hasOwn(this._edgeLabels,r)}removeEdge(e,t,n){var r=arguments.length===1?u(this._isDirected,arguments[0]):c(this._isDirected,e,t,n),i=this._edgeObjs[r];return i&&(e=i.v,t=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],s(this._preds[t],e),s(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this}inEdges(e,t){var n=this._in[e];if(n){var r=Object.values(n);return t?r.filter(e=>e.v===t):r}}outEdges(e,t){var n=this._out[e];if(n){var r=Object.values(n);return t?r.filter(e=>e.w===t):r}}nodeEdges(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))}};function o(e,t){e[t]?e[t]++:e[t]=1}function s(e,t){--e[t]||delete e[t]}function c(e,t,r,a){var o=``+t,s=``+r;if(!e&&o>s){var c=o;o=s,s=c}return o+i+s+i+(a===void 0?n:a)}function l(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return r&&(s.name=r),s}function u(e,t){return c(e,t.v,t.w,t.name)}t.exports=a})),n=e(((e,t)=>{t.exports=`2.2.4`})),r=e(((e,r)=>{r.exports={Graph:t(),version:n()}})),i=e(((e,n)=>{var r=t();n.exports={write:i,read:s};function i(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:a(e),edges:o(e)};return e.graph()!==void 0&&(t.value=structuredClone(e.graph())),t}function a(e){return e.nodes().map(function(t){var n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function o(e){return e.edges().map(function(t){var n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function s(e){var t=new r(e.options).setGraph(e.value);return e.nodes.forEach(function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}})),a=e(((e,t)=>{t.exports=n;function n(e){var t={},n=[],r;function i(n){Object.hasOwn(t,n)||(t[n]=!0,r.push(n),e.successors(n).forEach(i),e.predecessors(n).forEach(i))}return e.nodes().forEach(function(e){r=[],i(e),r.length&&n.push(r)}),n}})),o=e(((e,t)=>{t.exports=class{_arr=[];_keyIndices={};size(){return this._arr.length}keys(){return this._arr.map(function(e){return e.key})}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){var n=this._keyIndices;if(e=String(e),!Object.hasOwn(n,e)){var r=this._arr,i=r.length;return n[e]=i,r.push({key:e,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw Error(`New priority is greater than current priority. Key: `+e+` Old: `+this._arr[n].priority+` New: `+t);this._arr[n].priority=t,this._decrease(n)}_heapify(e){var t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){for(var t=this._arr,n=t[e].priority,r;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){var n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}}})),s=e(((e,t)=>{var n=o();t.exports=i;var r=()=>1;function i(e,t,n,i){return a(e,String(t),n||r,i||function(t){return e.outEdges(t)})}function a(e,t,r,i){var a={},o=new n,s,c,l=function(e){var t=e.v===s?e.w:e.v,n=a[t],i=r(e),l=c.distance+i;if(i<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+i);l<n.distance&&(n.distance=l,n.predecessor=s,o.decrease(t,l))};for(e.nodes().forEach(function(e){var n=e===t?0:1/0;a[e]={distance:n},o.add(e,n)});o.size()>0&&(s=o.removeMin(),c=a[s],c.distance!==1/0);)i(s).forEach(l);return a}})),c=e(((e,t)=>{var n=s();t.exports=r;function r(e,t,r){return e.nodes().reduce(function(i,a){return i[a]=n(e,a,t,r),i},{})}})),l=e(((e,t)=>{t.exports=n;function n(e){var t=0,n=[],r={},i=[];function a(o){var s=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),e.successors(o).forEach(function(e){Object.hasOwn(r,e)?r[e].onStack&&(s.lowlink=Math.min(s.lowlink,r[e].index)):(a(e),s.lowlink=Math.min(s.lowlink,r[e].lowlink))}),s.lowlink===s.index){var c=[],l;do l=n.pop(),r[l].onStack=!1,c.push(l);while(o!==l);i.push(c)}}return e.nodes().forEach(function(e){Object.hasOwn(r,e)||a(e)}),i}})),u=e(((e,t)=>{var n=l();t.exports=r;function r(e){return n(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}})),d=e(((e,t)=>{t.exports=r;var n=()=>1;function r(e,t,r){return i(e,t||n,r||function(t){return e.outEdges(t)})}function i(e,t,n){var r={},i=e.nodes();return i.forEach(function(e){r[e]={},r[e][e]={distance:0},i.forEach(function(t){e!==t&&(r[e][t]={distance:1/0})}),n(e).forEach(function(n){var i=n.v===e?n.w:n.v,a=t(n);r[e][i]={distance:a,predecessor:e}})}),i.forEach(function(e){var t=r[e];i.forEach(function(n){var a=r[n];i.forEach(function(n){var r=a[e],i=t[n],o=a[n],s=r.distance+i.distance;s<o.distance&&(o.distance=s,o.predecessor=i.predecessor)})})}),r}})),f=e(((e,t)=>{function n(e){var t={},n={},i=[];function a(o){if(Object.hasOwn(n,o))throw new r;Object.hasOwn(t,o)||(n[o]=!0,t[o]=!0,e.predecessors(o).forEach(a),delete n[o],i.push(o))}if(e.sinks().forEach(a),Object.keys(t).length!==e.nodeCount())throw new r;return i}var r=class extends Error{constructor(){super(...arguments)}};t.exports=n,n.CycleException=r})),p=e(((e,t)=>{var n=f();t.exports=r;function r(e){try{n(e)}catch(e){if(e instanceof n.CycleException)return!1;throw e}return!0}})),m=e(((e,t)=>{t.exports=n;function n(e,t,n){Array.isArray(t)||(t=[t]);var a=e.isDirected()?t=>e.successors(t):t=>e.neighbors(t),o=n===`post`?r:i,s=[],c={};return t.forEach(t=>{if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);o(t,a,c,s)}),s}function r(e,t,n,r){for(var i=[[e,!1]];i.length>0;){var o=i.pop();o[1]?r.push(o[0]):Object.hasOwn(n,o[0])||(n[o[0]]=!0,i.push([o[0],!0]),a(t(o[0]),e=>i.push([e,!1])))}}function i(e,t,n,r){for(var i=[e];i.length>0;){var o=i.pop();Object.hasOwn(n,o)||(n[o]=!0,r.push(o),a(t(o),e=>i.push(e)))}}function a(e,t){for(var n=e.length;n--;)t(e[n],n,e);return e}})),h=e(((e,t)=>{var n=m();t.exports=r;function r(e,t){return n(e,t,`post`)}})),g=e(((e,t)=>{var n=m();t.exports=r;function r(e,t){return n(e,t,`pre`)}})),_=e(((e,n)=>{var r=t(),i=o();n.exports=a;function a(e,t){var n=new r,a={},o=new i,s;function c(e){var n=e.v===s?e.w:e.v,r=o.priority(n);if(r!==void 0){var i=t(e);i<r&&(a[n]=s,o.decrease(n,i))}}if(e.nodeCount()===0)return n;e.nodes().forEach(function(e){o.add(e,1/0),n.setNode(e)}),o.decrease(e.nodes()[0],0);for(var l=!1;o.size()>0;){if(s=o.removeMin(),Object.hasOwn(a,s))n.setEdge(s,a[s]);else if(l)throw Error(`Input graph is not connected: `+e);else l=!0;e.nodeEdges(s).forEach(c)}return n}})),v=e(((e,t)=>{t.exports={components:a(),dijkstra:s(),dijkstraAll:c(),findCycles:u(),floydWarshall:d(),isAcyclic:p(),postorder:h(),preorder:g(),prim:_(),tarjan:l(),topsort:f()}})),y=e(((e,t)=>{var n=r();t.exports={Graph:n.Graph,json:i(),alg:v(),version:n.version}})),b=e(((e,t)=>{var n=class{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return r(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&r(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,i)),n=n._prev;return`[`+e.join(`, `)+`]`}};function r(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function i(e,t){if(e!==`_next`&&e!==`_prev`)return t}t.exports=n})),x=e(((e,t)=>{let n=y().Graph,r=b();t.exports=a;let i=()=>1;function a(e,t){if(e.nodeCount()<=1)return[];let n=c(e,t||i);return o(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w))}function o(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)s(e,t,n,o);for(;o=i.dequeue();)s(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i].dequeue(),o){r=r.concat(s(e,t,n,o,!0));break}}}return r}function s(e,t,n,r,i){let a=i?[]:void 0;return e.inEdges(r.v).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,l(t,n,s)}),e.outEdges(r.v).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,l(t,n,o)}),e.removeNode(r.v),a}function c(e,t){let i=new n,a=0,o=0;e.nodes().forEach(e=>{i.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let n=i.edge(e.v,e.w)||0,r=t(e),s=n+r;i.setEdge(e.v,e.w,s),o=Math.max(o,i.node(e.v).out+=r),a=Math.max(a,i.node(e.w).in+=r)});let s=u(o+a+3).map(()=>new r),c=a+1;return i.nodes().forEach(e=>{l(s,c,i.node(e))}),{graph:i,buckets:s,zeroIdx:c}}function l(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}function u(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}})),S=e(((e,t)=>{let n=y().Graph;t.exports={addBorderNode:f,addDummyNode:r,applyWithChunking:h,asNonCompoundGraph:a,buildLayerMatrix:l,intersectRect:c,mapValues:T,maxRank:g,normalizeRanks:u,notime:b,partition:_,pick:w,predecessorWeights:s,range:C,removeEmptyRanks:d,simplify:i,successorWeights:o,time:v,uniqueId:S,zipObject:E};function r(e,t,n,r){for(var i=r;e.hasNode(i);)i=S(r);return n.dummy=t,e.setNode(i,n),i}function i(e){let t=new n().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function a(e){let t=new n({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function o(e){let t=e.nodes().map(t=>{let n={};return e.outEdges(t).forEach(t=>{n[t.w]=(n[t.w]||0)+e.edge(t).weight}),n});return E(e.nodes(),t)}function s(e){let t=e.nodes().map(t=>{let n={};return e.inEdges(t).forEach(t=>{n[t.v]=(n[t.v]||0)+e.edge(t).weight}),n});return E(e.nodes(),t)}function c(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function l(e){let t=C(g(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i][r.order]=n)}),t}function u(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=h(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function d(e){let t=e.nodes().map(t=>e.node(t).rank),n=h(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function f(e,t,n,i){let a={width:0,height:0};return arguments.length>=4&&(a.rank=n,a.order=i),r(e,`border`,a,t)}function p(e,t=m){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}let m=65535;function h(e,t){if(t.length>m){let n=p(t);return e.apply(null,n.map(t=>e.apply(null,t)))}else return e.apply(null,t)}function g(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return h(Math.max,t)}function _(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function v(e,t){let n=Date.now();try{return t()}finally{console.log(e+` time: `+(Date.now()-n)+`ms`)}}function b(e,t){return t()}let x=0;function S(e){return e+(``+ ++x)}function C(e,t,n=1){t??(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let i=[];for(let t=e;r(t);t+=n)i.push(t);return i}function w(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function T(e,t){let n=t;return typeof t==`string`&&(n=e=>e[t]),Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function E(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}})),C=e(((e,t)=>{let n=x(),r=S().uniqueId;t.exports={run:i,undo:o};function i(e){(e.graph().acyclicer===`greedy`?n(e,t(e)):a(e)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,r(`rev`))});function t(e){return t=>e.edge(t).weight}}function a(e){let t=[],n={},r={};function i(a){Object.hasOwn(r,a)||(r[a]=!0,n[a]=!0,e.outEdges(a).forEach(e=>{Object.hasOwn(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return e.nodes().forEach(i),t}function o(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}})),w=e(((e,t)=>{let n=S();t.exports={run:r,undo:a};function r(e){e.graph().dummyChains=[],e.edges().forEach(t=>i(e,t))}function i(e,t){let r=t.v,i=e.node(r).rank,a=t.w,o=e.node(a).rank,s=t.name,c=e.edge(t),l=c.labelRank;if(o===i+1)return;e.removeEdge(t);let u,d,f;for(f=0,++i;i<o;++f,++i)c.points=[],d={width:0,height:0,edgeLabel:c,edgeObj:t,rank:i},u=n.addDummyNode(e,`edge`,d,`_d`),i===l&&(d.width=c.width,d.height=c.height,d.dummy=`edge-label`,d.labelpos=c.labelpos),e.setEdge(r,u,{weight:c.weight},s),f===0&&e.graph().dummyChains.push(u),r=u;e.setEdge(r,a,{weight:c.weight},s)}function a(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}})),T=e(((e,t)=>{let{applyWithChunking:n}=S();t.exports={longestPath:r,slack:i};function r(e){var t={};function r(i){var a=e.node(i);if(Object.hasOwn(t,i))return a.rank;t[i]=!0;let o=e.outEdges(i).map(t=>t==null?1/0:r(t.w)-e.edge(t).minlen);var s=n(Math.min,o);return s===1/0&&(s=0),a.rank=s}e.sources().forEach(r)}function i(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}})),E=e(((e,t)=>{var n=y().Graph,r=T().slack;t.exports=i;function i(e){var t=new n({directed:!1}),i=e.nodes()[0],c=e.nodeCount();t.setNode(i,{});for(var l,u;a(t,e)<c;)l=o(t,e),u=t.hasNode(l.v)?r(e,l):-r(e,l),s(t,e,u);return t}function a(e,t){function n(i){t.nodeEdges(i).forEach(a=>{var o=a.v,s=i===o?a.w:o;!e.hasNode(s)&&!r(t,a)&&(e.setNode(s,{}),e.setEdge(i,s,{}),n(s))})}return e.nodes().forEach(n),e.nodeCount()}function o(e,t){return t.edges().reduce((n,i)=>{let a=1/0;return e.hasNode(i.v)!==e.hasNode(i.w)&&(a=r(t,i)),a<n[0]?[a,i]:n},[1/0,null])[1]}function s(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}})),D=e(((e,t)=>{var n=E(),r=T().slack,i=T().longestPath,a=y().alg.preorder,o=y().alg.postorder,s=S().simplify;t.exports=c,c.initLowLimValues=f,c.initCutValues=l,c.calcCutValue=d,c.leaveEdge=m,c.enterEdge=h,c.exchangeEdges=g;function c(e){e=s(e),i(e);var t=n(e);f(t),l(t,e);for(var r,a;r=m(t);)a=h(t,e,r),g(t,e,r,a)}function l(e,t){var n=o(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>u(e,t,n))}function u(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=d(e,t,n)}function d(e,t,n){var r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;return a||=(i=!1,t.edge(r,n)),o=a.weight,t.nodeEdges(n).forEach(a=>{var s=a.v===n,c=s?a.w:a.v;if(c!==r){var l=s===i,u=t.edge(a).weight;if(o+=l?u:-u,v(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function f(e,t){arguments.length<2&&(t=e.nodes()[0]),p(e,{},1,t)}function p(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,e.neighbors(r).forEach(i=>{Object.hasOwn(t,i)||(n=p(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function m(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function h(e,t,n){var i=n.v,a=n.w;t.hasEdge(i,a)||(i=n.w,a=n.v);var o=e.node(i),s=e.node(a),c=o,l=!1;return o.lim>s.lim&&(c=s,l=!0),t.edges().filter(t=>l===b(e,e.node(t.v),c)&&l!==b(e,e.node(t.w),c)).reduce((e,n)=>r(t,n)<r(t,e)?n:e)}function g(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),f(e),l(e,t),_(e,t)}function _(e,t){var n=a(e,e.nodes().find(e=>!t.node(e).parent));n=n.slice(1),n.forEach(n=>{var r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function v(e,t,n){return e.hasEdge(t,n)}function b(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}})),O=e(((e,t)=>{var n=T().longestPath,r=E(),i=D();t.exports=a;function a(e){var t=e.graph().ranker;if(t instanceof Function)return t(e);switch(e.graph().ranker){case`network-simplex`:c(e);break;case`tight-tree`:s(e);break;case`longest-path`:o(e);break;case`none`:break;default:c(e)}}var o=n;function s(e){n(e),r(e)}function c(e){i(e)}})),k=e(((e,t)=>{t.exports=n;function n(e){let t=i(e);e.graph().dummyChains.forEach(n=>{let i=e.node(n),a=i.edgeObj,o=r(e,t,a.v,a.w),s=o.path,c=o.lca,l=0,u=s[l],d=!0;for(;n!==a.w;){if(i=e.node(n),d){for(;(u=s[l])!==c&&e.node(u).maxRank<i.rank;)l++;u===c&&(d=!1)}if(!d){for(;l<s.length-1&&e.node(u=s[l+1]).minRank<=i.rank;)l++;u=s[l]}e.setParent(n,u),n=e.successors(n)[0]}})}function r(e,t,n,r){let i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c,l;c=n;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));for(l=c,c=r;(c=e.parent(c))!==l;)a.push(c);return{path:i.concat(a.reverse()),lca:l}}function i(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children().forEach(r),t}})),A=e(((e,t)=>{let n=S();t.exports={run:r,cleanup:s};function r(e){let t=n.addDummyNode(e,`root`,{},`_root`),r=a(e),s=Object.values(r),c=n.applyWithChunking(Math.max,s)-1,l=2*c+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=l);let u=o(e)+1;e.children().forEach(n=>i(e,t,l,u,c,r,n)),e.graph().nodeRankFactor=l}function i(e,t,r,a,o,s,c){let l=e.children(c);if(!l.length){c!==t&&e.setEdge(t,c,{weight:0,minlen:r});return}let u=n.addBorderNode(e,`_bt`),d=n.addBorderNode(e,`_bb`),f=e.node(c);e.setParent(u,c),f.borderTop=u,e.setParent(d,c),f.borderBottom=d,l.forEach(n=>{i(e,t,r,a,o,s,n);let l=e.node(n),f=l.borderTop?l.borderTop:n,p=l.borderBottom?l.borderBottom:n,m=l.borderTop?a:2*a,h=f===p?o-s[c]+1:1;e.setEdge(u,f,{weight:m,minlen:h,nestingEdge:!0}),e.setEdge(p,d,{weight:m,minlen:h,nestingEdge:!0})}),e.parent(c)||e.setEdge(t,u,{weight:0,minlen:o+s[c]})}function a(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children().forEach(e=>n(e,1)),t}function o(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function s(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}})),j=e(((e,t)=>{let n=S();t.exports=r;function r(e){function t(n){let r=e.children(n),a=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(a,`minRank`)){a.borderLeft=[],a.borderRight=[];for(let t=a.minRank,r=a.maxRank+1;t<r;++t)i(e,`borderLeft`,`_bl`,n,a,t),i(e,`borderRight`,`_br`,n,a,t)}}e.children().forEach(t)}function i(e,t,r,i,a,o){let s={width:0,height:0,rank:o,borderType:t},c=a[t][o-1],l=n.addDummyNode(e,`border`,s,r);a[t][o]=l,e.setParent(l,i),c&&e.setEdge(c,l,{weight:1})}})),M=e(((e,t)=>{t.exports={adjust:n,undo:r};function n(e){let t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&i(e)}function r(e){let t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&o(e),(t===`lr`||t===`rl`)&&(c(e),i(e))}function i(e){e.nodes().forEach(t=>a(e.node(t))),e.edges().forEach(t=>a(e.edge(t)))}function a(e){let t=e.width;e.width=e.height,e.height=t}function o(e){e.nodes().forEach(t=>s(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(s),Object.hasOwn(n,`y`)&&s(n)})}function s(e){e.y=-e.y}function c(e){e.nodes().forEach(t=>l(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(l),Object.hasOwn(n,`x`)&&l(n)})}function l(e){let t=e.x;e.x=e.y,e.y=t}})),N=e(((e,t)=>{let n=S();t.exports=r;function r(e){let t={},r=e.nodes().filter(t=>!e.children(t).length),i=r.map(t=>e.node(t).rank),a=n.applyWithChunking(Math.max,i),o=n.range(a+1).map(()=>[]);function s(n){t[n]||(t[n]=!0,o[e.node(n).rank].push(n),e.successors(n).forEach(s))}return r.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(s),o}})),P=e(((e,t)=>{let n=S().zipObject;t.exports=r;function r(e,t){let n=0;for(let r=1;r<t.length;++r)n+=i(e,t[r-1],t[r]);return n}function i(e,t,r){let i=n(r,r.map((e,t)=>t)),a=t.flatMap(t=>e.outEdges(t).map(t=>({pos:i[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos)),o=1;for(;o<r.length;)o<<=1;let s=2*o-1;--o;let c=Array(s).fill(0),l=0;return a.forEach(e=>{let t=e.pos+o;c[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=c[t+1]),t=t-1>>1,c[t]+=e.weight;l+=e.weight*n}),l}})),F=e(((e,t)=>{t.exports=n;function n(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(n.length){let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}else return{v:t}})}})),I=e(((e,t)=>{let n=S();t.exports=r;function r(e,t){let n={};return e.forEach((e,t)=>{let r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight)}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(n[e.w]))}),i(Object.values(n).filter(e=>!e.indegree))}function i(e){let t=[];function r(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&a(e,t)}}function i(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let n=e.pop();t.push(n),n.in.reverse().forEach(r(n)),n.out.forEach(i(n))}return t.filter(e=>!e.merged).map(e=>n.pick(e,[`vs`,`i`,`barycenter`,`weight`]))}function a(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}})),L=e(((e,t)=>{let n=S();t.exports=r;function r(e,t){let r=n.partition(e,e=>Object.hasOwn(e,`barycenter`)),o=r.lhs,s=r.rhs.sort((e,t)=>t.i-e.i),c=[],l=0,u=0,d=0;o.sort(a(!!t)),d=i(c,s,d),o.forEach(e=>{d+=e.vs.length,c.push(e.vs),l+=e.barycenter*e.weight,u+=e.weight,d=i(c,s,d)});let f={vs:c.flat(!0)};return u&&(f.barycenter=l/u,f.weight=u),f}function i(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function a(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}})),R=e(((e,t)=>{let n=F(),r=I(),i=L();t.exports=a;function a(e,t,c,l){let u=e.children(t),d=e.node(t),f=d?d.borderLeft:void 0,p=d?d.borderRight:void 0,m={};f&&(u=u.filter(e=>e!==f&&e!==p));let h=n(e,u);h.forEach(t=>{if(e.children(t.v).length){let n=a(e,t.v,c,l);m[t.v]=n,Object.hasOwn(n,`barycenter`)&&s(t,n)}});let g=r(h,c);o(g,m);let _=i(g,l);if(f&&(_.vs=[f,_.vs,p].flat(!0),e.predecessors(f).length)){let t=e.node(e.predecessors(f)[0]),n=e.node(e.predecessors(p)[0]);Object.hasOwn(_,`barycenter`)||(_.barycenter=0,_.weight=0),_.barycenter=(_.barycenter*_.weight+t.order+n.order)/(_.weight+2),_.weight+=2}return _}function o(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function s(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}})),z=e(((e,t)=>{let n=y().Graph,r=S();t.exports=i;function i(e,t,r,i){i||=e.nodes();let o=a(e),s=new n({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(t=>e.node(t));return i.forEach(n=>{let i=e.node(n),a=e.parent(n);(i.rank===t||i.minRank<=t&&t<=i.maxRank)&&(s.setNode(n),s.setParent(n,a||o),e[r](n).forEach(t=>{let r=t.v===n?t.w:t.v,i=s.edge(r,n),a=i===void 0?0:i.weight;s.setEdge(r,n,{weight:e.edge(t).weight+a})}),Object.hasOwn(i,`minRank`)&&s.setNode(n,{borderLeft:i.borderLeft[t],borderRight:i.borderRight[t]}))}),s}function a(e){for(var t;e.hasNode(t=r.uniqueId(`_root`)););return t}})),B=e(((e,t)=>{t.exports=n;function n(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}})),V=e(((e,t)=>{let n=N(),r=P(),i=R(),a=z(),o=B(),s=y().Graph,c=S();t.exports=l;function l(e,t){if(t&&typeof t.customOrder==`function`){t.customOrder(e,l);return}let i=c.maxRank(e),a=u(e,c.range(1,i+1),`inEdges`),o=u(e,c.range(i-1,-1,-1),`outEdges`),s=n(e);if(f(e,s),t&&t.disableOptimalOrderHeuristic)return;let p=1/0,m;for(let t=0,n=0;n<4;++t,++n){d(t%2?a:o,t%4>=2),s=c.buildLayerMatrix(e);let i=r(e,s);i<p&&(n=0,m=Object.assign({},s),p=i)}f(e,m)}function u(e,t,n){let r=new Map,i=(e,t)=>{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if(typeof n.rank==`number`&&i(n.rank,t),typeof n.minRank==`number`&&typeof n.maxRank==`number`)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&i(e,t)}return t.map(function(t){return a(e,t,n,r.get(t)||[])})}function d(e,t){let n=new s;e.forEach(function(e){let r=e.graph().root,a=i(e,r,n,t);a.vs.forEach((t,n)=>e.node(t).order=n),o(e,n,a.vs)})}function f(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}})),H=e(((e,t)=>{let n=y().Graph,r=S();t.exports={positionX:h,findType1Conflicts:i,findType2Conflicts:a,addConflict:s,hasConflict:c,verticalAlignment:l,horizontalCompaction:u,alignCoordinates:p,findSmallestWidthAlignment:f,balance:m};function i(e,t){let n={};function r(t,r){let i=0,a=0,c=t.length,l=r[r.length-1];return r.forEach((t,u)=>{let d=o(e,t),f=d?e.node(d).order:c;(d||t===l)&&(r.slice(a,u+1).forEach(t=>{e.predecessors(t).forEach(r=>{let a=e.node(r),o=a.order;(o<i||f<o)&&!(a.dummy&&e.node(t).dummy)&&s(n,r,t)})}),a=u+1,i=f)}),r}return t.length&&t.reduce(r),n}function a(e,t){let n={};function i(t,i,a,o,c){let l;r.range(i,a).forEach(r=>{l=t[r],e.node(l).dummy&&e.predecessors(l).forEach(t=>{let r=e.node(t);r.dummy&&(r.order<o||r.order>c)&&s(n,t,l)})})}function a(t,n){let r=-1,a,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);t.length&&(a=e.node(t[0]).order,i(n,o,c,r,a),o=c,r=a)}i(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(a),n}function o(e,t){if(e.node(t).dummy)return e.predecessors(t).find(t=>e.node(t).dummy)}function s(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function c(e,t,n){if(t>n){let e=t;t=n,n=e}return!!e[t]&&Object.hasOwn(e[t],n)}function l(e,t,n,r){let i={},a={},o={};return t.forEach(e=>{e.forEach((e,t)=>{i[e]=e,a[e]=e,o[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let s=r(e);if(s.length){s=s.sort((e,t)=>o[e]-o[t]);let r=(s.length-1)/2;for(let l=Math.floor(r),u=Math.ceil(r);l<=u;++l){let r=s[l];a[e]===e&&t<o[r]&&!c(n,e,r)&&(a[r]=e,a[e]=i[e]=i[r],t=o[r])}}})}),{root:i,align:a}}function u(e,t,n,r,i){let a={},o=d(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){let n=o.nodes(),r=n.pop(),i={};for(;r;)i[r]?e(r):(i[r]=!0,n.push(r),n=n.concat(t(r))),r=n.pop()}function l(e){a[e]=o.inEdges(e).reduce((e,t)=>Math.max(e,a[t.v]+o.edge(t)),0)}function u(t){let n=o.outEdges(t).reduce((e,t)=>Math.min(e,a[t.w]-o.edge(t)),1/0),r=e.node(t);n!==1/0&&r.borderType!==s&&(a[t]=Math.max(a[t],n))}return c(l,o.predecessors.bind(o)),c(u,o.successors.bind(o)),Object.keys(r).forEach(e=>a[e]=a[n[e]]),a}function d(e,t,r,i){let a=new n,o=e.graph(),s=g(o.nodesep,o.edgesep,i);return t.forEach(t=>{let n;t.forEach(t=>{let i=r[t];if(a.setNode(i),n){var o=r[n],c=a.edge(o,i);a.setEdge(o,i,Math.max(s(e,t,n),c||0))}n=t})}),a}function f(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=_(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[1/0,null])[1]}function p(e,t){let n=Object.values(t),i=r.applyWithChunking(Math.min,n),a=r.applyWithChunking(Math.max,n);[`u`,`d`].forEach(n=>{[`l`,`r`].forEach(o=>{let s=n+o,c=e[s];if(c===t)return;let l=Object.values(c),u=i-r.applyWithChunking(Math.min,l);o!==`l`&&(u=a-r.applyWithChunking(Math.max,l)),u&&(e[s]=r.mapValues(c,e=>e+u))})})}function m(e,t){return r.mapValues(e.ul,(n,r)=>{if(t)return e[t.toLowerCase()][r];{let t=Object.values(e).map(e=>e[r]).sort((e,t)=>e-t);return(t[1]+t[2])/2}})}function h(e){let t=r.buildLayerMatrix(e),n=Object.assign(i(e,t),a(e,t)),o={},s;return[`u`,`d`].forEach(i=>{s=i===`u`?t:Object.values(t).reverse(),[`l`,`r`].forEach(t=>{t===`r`&&(s=s.map(e=>Object.values(e).reverse()));let a=(i===`u`?e.predecessors:e.successors).bind(e),c=l(e,s,n,a),d=u(e,s,c.root,c.align,t===`r`);t===`r`&&(d=r.mapValues(d,e=>-e)),o[i+t]=d})}),p(o,f(e,o)),m(o,e.graph().align)}function g(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2;break}if(l&&(c+=n?l:-l),l=0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2;break}return l&&(c+=n?l:-l),l=0,c}}function _(e,t){return e.node(t).width}})),U=e(((e,t)=>{let n=S(),r=H().positionX;t.exports=i;function i(e){e=n.asNonCompoundGraph(e),a(e),Object.entries(r(e)).forEach(([t,n])=>e.node(t).x=n)}function a(e){let t=n.buildLayerMatrix(e),r=e.graph().ranksep,i=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height;return t>r?t:r},0);t.forEach(t=>e.node(t).y=i+n/2),i+=n+r})}})),W=e(((e,t)=>{let n=C(),r=w(),i=O(),a=S().normalizeRanks,o=k(),s=S().removeEmptyRanks,c=A(),l=j(),u=M(),d=V(),f=U(),p=S(),m=y().Graph;t.exports=h;function h(e,t){let n=t&&t.debugTiming?p.time:p.notime;n(`layout`,()=>{let r=n(` buildLayoutGraph`,()=>F(e));n(` runLayout`,()=>g(r,n,t)),n(` updateInputGraph`,()=>_(e,r))})}function g(e,t,m){t(` makeSpaceForEdgeLabels`,()=>I(e)),t(` removeSelfEdges`,()=>q(e)),t(` acyclic`,()=>n.run(e)),t(` nestingGraph.run`,()=>c.run(e)),t(` rank`,()=>i(p.asNonCompoundGraph(e))),t(` injectEdgeLabelProxies`,()=>L(e)),t(` removeEmptyRanks`,()=>s(e)),t(` nestingGraph.cleanup`,()=>c.cleanup(e)),t(` normalizeRanks`,()=>a(e)),t(` assignRankMinMax`,()=>R(e)),t(` removeEdgeLabelProxies`,()=>z(e)),t(` normalize.run`,()=>r.run(e)),t(` parentDummyChains`,()=>o(e)),t(` addBorderSegments`,()=>l(e)),t(` order`,()=>d(e,m)),t(` insertSelfEdges`,()=>J(e)),t(` adjustCoordinateSystem`,()=>u.adjust(e)),t(` position`,()=>f(e)),t(` positionSelfEdges`,()=>Y(e)),t(` removeBorderNodes`,()=>K(e)),t(` normalize.undo`,()=>r.undo(e)),t(` fixupEdgeLabelCoords`,()=>W(e)),t(` undoCoordinateSystem`,()=>u.undo(e)),t(` translateGraph`,()=>B(e)),t(` assignNodeIntersects`,()=>H(e)),t(` reversePoints`,()=>G(e)),t(` acyclic.undo`,()=>n.undo(e))}function _(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}let v=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],b={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},x=[`acyclicer`,`ranker`,`rankdir`,`align`],T=[`width`,`height`,`rank`],E={width:0,height:0},D=[`minlen`,`weight`,`width`,`height`,`labeloffset`],N={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},P=[`labelpos`];function F(e){let t=new m({multigraph:!0,compound:!0}),n=Z(e.graph());return t.setGraph(Object.assign({},b,X(n,v),p.pick(n,x))),e.nodes().forEach(n=>{let r=X(Z(e.node(n)),T);Object.keys(E).forEach(e=>{r[e]===void 0&&(r[e]=E[e])}),t.setNode(n,r),t.setParent(n,e.parent(n))}),e.edges().forEach(n=>{let r=Z(e.edge(n));t.setEdge(n,Object.assign({},N,X(r,D),p.pick(r,P)))}),t}function I(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function L(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v),r={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};p.addDummyNode(e,`edge-proxy`,r,`_ep`)}})}function R(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function z(e){e.nodes().forEach(t=>{let n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function B(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function H(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(p.intersectRect(r,a)),n.points.push(p.intersectRect(i,o))})}function W(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset;break}})}function G(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function K(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function q(e){e.edges().forEach(t=>{if(t.v===t.w){var n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function J(e){p.buildLayerMatrix(e).forEach(t=>{var n=0;t.forEach((t,r)=>{var i=e.node(t);i.order=r+n,(i.selfEdges||[]).forEach(t=>{p.addDummyNode(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function Y(e){e.nodes().forEach(t=>{var n=e.node(t);if(n.dummy===`selfedge`){var r=e.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function X(e,t){return p.mapValues(p.pick(e,t),Number)}function Z(e){var t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}})),G=e(((e,t)=>{let n=S(),r=y().Graph;t.exports={debugOrdering:i};function i(e){let t=n.buildLayerMatrix(e),i=new r({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{i.setNode(t,{label:t}),i.setParent(t,`layer`+e.node(t).rank)}),e.edges().forEach(e=>i.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{let n=`layer`+t;i.setNode(n,{rank:`same`}),e.reduce((e,t)=>(i.setEdge(e,t,{style:`invis`}),t))}),i}})),K=e(((e,t)=>{t.exports=`1.1.8`})),q=e(((e,t)=>{t.exports={graphlib:y(),layout:W(),debug:G(),util:{time:S().time,notime:S().notime},version:K()}}));export{q as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../rolldown-runtime.mjs";const e=[`top`,`right`,`bottom`,`left`],t=[`start`,`end`],n=e.reduce((e,n)=>e.concat(n,n+`-`+t[0],n+`-`+t[1]),[]),r=Math.min,i=Math.max,a=Math.round,o=Math.floor,createCoords=e=>({x:e,y:e}),s={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function clamp(e,t,n){return i(e,r(t,n))}function evaluate(e,t){return typeof e==`function`?e(t):e}function getSide(e){return e.split(`-`)[0]}function getAlignment(e){return e.split(`-`)[1]}function getOppositeAxis(e){return e===`x`?`y`:`x`}function getAxisLength(e){return e===`y`?`height`:`width`}function getSideAxis(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function getAlignmentAxis(e){return getOppositeAxis(getSideAxis(e))}function getAlignmentSides(e,t,n){n===void 0&&(n=!1);let r=getAlignment(e),i=getAlignmentAxis(e),a=getAxisLength(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=getOppositePlacement(o)),[o,getOppositePlacement(o)]}function getExpandedPlacements(e){let t=getOppositePlacement(e);return[getOppositeAlignmentPlacement(e),t,getOppositeAlignmentPlacement(t)]}function getOppositeAlignmentPlacement(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}const c=[`left`,`right`],l=[`right`,`left`],u=[`top`,`bottom`],d=[`bottom`,`top`];function getSideList(e,t,n){switch(e){case`top`:case`bottom`:return n?t?l:c:t?c:l;case`left`:case`right`:return t?u:d;default:return[]}}function getOppositeAxisPlacements(e,t,n,r){let i=getAlignment(e),a=getSideList(getSide(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(getOppositeAlignmentPlacement)))),a}function getOppositePlacement(e){let t=getSide(e);return s[t]+e.slice(t.length)}function expandPaddingObject(e){return{top:0,right:0,bottom:0,left:0,...e}}function getPaddingObject(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:expandPaddingObject(e)}function rectToClientRect(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function computeCoordsFromPlacement(e,t,n){let{reference:r,floating:i}=e,a=getSideAxis(t),o=getAlignmentAxis(t),s=getAxisLength(o),c=getSide(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(getAlignment(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function detectOverflow(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=evaluate(t,e),p=getPaddingObject(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=rectToClientRect(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=rectToClientRect(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}const computePosition=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=computeCoordsFromPlacement(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<50&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=computeCoordsFromPlacement(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},arrow=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:i,placement:a,rects:o,platform:s,elements:c,middlewareData:l}=t,{element:u,padding:d=0}=evaluate(e,t)||{};if(u==null)return{};let f=getPaddingObject(d),p={x:n,y:i},m=getAlignmentAxis(a),h=getAxisLength(m),g=await s.getDimensions(u),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=o.reference[h]+o.reference[m]-p[m]-o.floating[h],S=p[m]-o.reference[m],C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u)),w=C?C[b]:0;(!w||!await(s.isElement==null?void 0:s.isElement(C)))&&(w=c.floating[b]||o.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=r(f[v],E),O=r(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=clamp(k,j,A),N=!l.arrow&&getAlignment(a)!=null&&j!==M&&o.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}});function getPlacementList(e,t,n){return(e?[...n.filter(t=>getAlignment(t)===e),...n.filter(t=>getAlignment(t)!==e)]:n.filter(e=>getSide(e)===e)).filter(n=>e?getAlignment(n)===e||(t?getOppositeAlignmentPlacement(n)!==n:!1):!0)}const autoPlacement=function(e){return e===void 0&&(e={}),{name:`autoPlacement`,options:e,async fn(t){let{rects:r,middlewareData:i,placement:a,platform:o,elements:s}=t,{crossAxis:c=!1,alignment:l,allowedPlacements:u=n,autoAlignment:d=!0,...f}=evaluate(e,t),p=l!==void 0||u===n?getPlacementList(l||null,d,u):u,m=await o.detectOverflow(t,f),h=i.autoPlacement?.index||0,g=p[h];if(g==null)return{};let _=getAlignmentSides(g,r,await(o.isRTL==null?void 0:o.isRTL(s.floating)));if(a!==g)return{reset:{placement:p[0]}};let v=[m[getSide(g)],m[_[0]],m[_[1]]],y=[...i.autoPlacement?.overflows||[],{placement:g,overflows:v}],b=p[h+1];if(b)return{data:{index:h+1,overflows:y},reset:{placement:b}};let x=y.map(e=>{let t=getAlignment(e.placement);return[e.placement,t&&c?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),S=x.filter(e=>e[2].slice(0,getAlignment(e[0])?2:3).every(e=>e<=0))[0]?.[0]||x[0][0];return S===a?{}:{data:{index:h+1,overflows:y},reset:{placement:S}}}}},flip=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=evaluate(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=getSide(r),_=getSideAxis(o),v=getSide(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[getOppositePlacement(o)]:getExpandedPlacements(o)),x=p!==`none`;!d&&x&&b.push(...getOppositeAxisPlacements(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=getAlignmentSides(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==getSideAxis(t))||T.every(e=>getSideAxis(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=getSideAxis(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function getSideOffsets(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function isAnySideFullyClipped(t){return e.some(e=>t[e]>=0)}const hide=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=evaluate(e,t);switch(i){case`referenceHidden`:{let e=getSideOffsets(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:isAnySideFullyClipped(e)}}}case`escaped`:{let e=getSideOffsets(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:isAnySideFullyClipped(e)}}}default:return{}}}}};function getBoundingRect(e){let t=r(...e.map(e=>e.left)),n=r(...e.map(e=>e.top)),a=i(...e.map(e=>e.right)),o=i(...e.map(e=>e.bottom));return{x:t,y:n,width:a-t,height:o-n}}function getRectsByLine(e){let t=e.slice().sort((e,t)=>e.y-t.y),n=[],r=null;for(let e=0;e<t.length;e++){let i=t[e];!r||i.y-r.y>r.height/2?n.push([i]):n[n.length-1].push(i),r=i}return n.map(e=>rectToClientRect(getBoundingRect(e)))}const inline=function(e){return e===void 0&&(e={}),{name:`inline`,options:e,async fn(t){let{placement:n,elements:a,rects:o,platform:s,strategy:c}=t,{padding:l=2,x:u,y:d}=evaluate(e,t),f=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(a.reference))||[]),p=getRectsByLine(f),m=rectToClientRect(getBoundingRect(f)),h=getPaddingObject(l);function getBoundingClientRect(){if(p.length===2&&p[0].left>p[1].right&&u!=null&&d!=null)return p.find(e=>u>e.left-h.left&&u<e.right+h.right&&d>e.top-h.top&&d<e.bottom+h.bottom)||m;if(p.length>=2){if(getSideAxis(n)===`y`){let e=p[0],t=p[p.length-1],r=getSide(n)===`top`,i=e.top,a=t.bottom,o=r?e.left:t.left,s=r?e.right:t.right;return{top:i,bottom:a,left:o,right:s,width:s-o,height:a-i,x:o,y:i}}let e=getSide(n)===`left`,t=i(...p.map(e=>e.right)),a=r(...p.map(e=>e.left)),o=p.filter(n=>e?n.left===a:n.right===t),s=o[0].top,c=o[o.length-1].bottom,l=a,u=t;return{top:s,bottom:c,left:l,right:u,width:u-l,height:c-s,x:l,y:s}}return m}let g=await s.getElementRects({reference:{getBoundingClientRect},floating:a.floating,strategy:c});return o.reference.x!==g.reference.x||o.reference.y!==g.reference.y||o.reference.width!==g.reference.width||o.reference.height!==g.reference.height?{reset:{rects:g}}:{}}}},f=new Set([`left`,`top`]);async function convertValueToCoords(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=getSide(n),s=getAlignment(n),c=getSideAxis(n)===`y`,l=f.has(o)?-1:1,u=a&&c?-1:1,d=evaluate(t,e),{mainAxis:p,crossAxis:m,alignmentAxis:h}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof h==`number`&&(m=s===`end`?h*-1:h),c?{x:m*u,y:p*l}:{x:p*l,y:m*u}}const offset=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await convertValueToCoords(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},shift=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=evaluate(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=getSideAxis(getSide(i)),p=getOppositeAxis(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=clamp(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=clamp(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},limitShift=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=evaluate(e,t),u={x:n,y:r},d=getSideAxis(i),p=getOppositeAxis(d),m=u[p],h=u[d],g=evaluate(s,t),_=typeof g==`number`?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){let e=p===`y`?`height`:`width`,t=a.reference[p]-a.floating[e]+_.mainAxis,n=a.reference[p]+a.reference[e]-_.mainAxis;m<t?m=t:m>n&&(m=n)}if(l){let e=p===`y`?`width`:`height`,t=f.has(getSide(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:_.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?_.crossAxis:0);h<n?h=n:h>r&&(h=r)}return{[p]:m,[d]:h}}}},size=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,a;let{placement:o,rects:s,platform:c,elements:l}=t,{apply=()=>{},...u}=evaluate(e,t),d=await c.detectOverflow(t,u),f=getSide(o),p=getAlignment(o),m=getSideAxis(o)===`y`,{width:h,height:g}=s.floating,_,v;f===`top`||f===`bottom`?(_=f,v=p===(await(c.isRTL==null?void 0:c.isRTL(l.floating))?`start`:`end`)?`left`:`right`):(v=f,_=p===`end`?`top`:`bottom`);let y=g-d.top-d.bottom,b=h-d.left-d.right,x=r(g-d[_],y),S=r(h-d[v],b),C=!t.middlewareData.shift,w=x,T=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=b),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(w=y),C&&!p){let e=i(d.left,0),t=i(d.right,0),n=i(d.top,0),r=i(d.bottom,0);m?T=h-2*(e!==0||t!==0?e+t:i(d.left,d.right)):w=g-2*(n!==0||r!==0?n+r:i(d.top,d.bottom))}await apply({...t,availableWidth:T,availableHeight:w});let E=await c.getDimensions(l.floating);return h!==E.width||g!==E.height?{reset:{rects:!0}}:{}}}};export{hide as a,offset as c,createCoords as d,o as f,a as g,rectToClientRect as h,flip as i,shift as l,r as m,autoPlacement as n,inline as o,i as p,computePosition as r,limitShift as s,arrow as t,size as u};
|
|
1
|
+
const e=[`top`,`right`,`bottom`,`left`],t=[`start`,`end`],n=e.reduce((e,n)=>e.concat(n,n+`-`+t[0],n+`-`+t[1]),[]),r=Math.min,i=Math.max,a=Math.round,o=Math.floor,s=e=>({x:e,y:e}),c={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function l(e,t,n){return i(e,r(t,n))}function u(e,t){return typeof e==`function`?e(t):e}function d(e){return e.split(`-`)[0]}function f(e){return e.split(`-`)[1]}function p(e){return e===`x`?`y`:`x`}function m(e){return e===`y`?`height`:`width`}function h(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function g(e){return p(h(e))}function _(e,t,n){n===void 0&&(n=!1);let r=f(e),i=g(e),a=m(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=E(o)),[o,E(o)]}function v(e){let t=E(e);return[y(e),t,y(t)]}function y(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}const b=[`left`,`right`],x=[`right`,`left`],S=[`top`,`bottom`],C=[`bottom`,`top`];function w(e,t,n){switch(e){case`top`:case`bottom`:return n?t?x:b:t?b:x;case`left`:case`right`:return t?S:C;default:return[]}}function T(e,t,n,r){let i=f(e),a=w(d(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(y)))),a}function E(e){let t=d(e);return c[t]+e.slice(t.length)}function D(e){return{top:0,right:0,bottom:0,left:0,...e}}function O(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:D(e)}function k(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function A(e,t,n){let{reference:r,floating:i}=e,a=h(t),o=g(t),s=m(o),c=d(t),l=a===`y`,u=r.x+r.width/2-i.width/2,p=r.y+r.height/2-i.height/2,_=r[s]/2-i[s]/2,v;switch(c){case`top`:v={x:u,y:r.y-i.height};break;case`bottom`:v={x:u,y:r.y+r.height};break;case`right`:v={x:r.x+r.width,y:p};break;case`left`:v={x:r.x-i.width,y:p};break;default:v={x:r.x,y:r.y}}switch(f(t)){case`start`:v[o]-=_*(n&&l?-1:1);break;case`end`:v[o]+=_*(n&&l?-1:1);break}return v}async function j(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:d=`floating`,altBoundary:f=!1,padding:p=0}=u(t,e),m=O(p),h=o[f?d===`floating`?`reference`:`floating`:d],g=k(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(h))??!0?h:h.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),_=d===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,v=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),y=await(i.isElement==null?void 0:i.isElement(v))&&await(i.getScale==null?void 0:i.getScale(v))||{x:1,y:1},b=k(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:_,offsetParent:v,strategy:s}):_);return{top:(g.top-b.top+m.top)/y.y,bottom:(b.bottom-g.bottom+m.bottom)/y.y,left:(g.left-b.left+m.left)/y.x,right:(b.right-g.right+m.right)/y.x}}const M=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:j},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=A(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<50&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=A(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},N=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:i,placement:a,rects:o,platform:s,elements:c,middlewareData:d}=t,{element:p,padding:h=0}=u(e,t)||{};if(p==null)return{};let _=O(h),v={x:n,y:i},y=g(a),b=m(y),x=await s.getDimensions(p),S=y===`y`,C=S?`top`:`left`,w=S?`bottom`:`right`,T=S?`clientHeight`:`clientWidth`,E=o.reference[b]+o.reference[y]-v[y]-o.floating[b],D=v[y]-o.reference[y],k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(p)),A=k?k[T]:0;(!A||!await(s.isElement==null?void 0:s.isElement(k)))&&(A=c.floating[T]||o.floating[b]);let j=E/2-D/2,M=A/2-x[b]/2-1,N=r(_[C],M),P=r(_[w],M),F=N,I=A-x[b]-P,L=A/2-x[b]/2+j,R=l(F,L,I),z=!d.arrow&&f(a)!=null&&L!==R&&o.reference[b]/2-(L<F?N:P)-x[b]/2<0,B=z?L<F?L-F:L-I:0;return{[y]:v[y]+B,data:{[y]:R,centerOffset:L-R-B,...z&&{alignmentOffset:B}},reset:z}}});function P(e,t,n){return(e?[...n.filter(t=>f(t)===e),...n.filter(t=>f(t)!==e)]:n.filter(e=>d(e)===e)).filter(n=>e?f(n)===e||(t?y(n)!==n:!1):!0)}const F=function(e){return e===void 0&&(e={}),{name:`autoPlacement`,options:e,async fn(t){let{rects:r,middlewareData:i,placement:a,platform:o,elements:s}=t,{crossAxis:c=!1,alignment:l,allowedPlacements:p=n,autoAlignment:m=!0,...h}=u(e,t),g=l!==void 0||p===n?P(l||null,m,p):p,v=await o.detectOverflow(t,h),y=i.autoPlacement?.index||0,b=g[y];if(b==null)return{};let x=_(b,r,await(o.isRTL==null?void 0:o.isRTL(s.floating)));if(a!==b)return{reset:{placement:g[0]}};let S=[v[d(b)],v[x[0]],v[x[1]]],C=[...i.autoPlacement?.overflows||[],{placement:b,overflows:S}],w=g[y+1];if(w)return{data:{index:y+1,overflows:C},reset:{placement:w}};let T=C.map(e=>{let t=f(e.placement);return[e.placement,t&&c?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),E=T.filter(e=>e[2].slice(0,f(e[0])?2:3).every(e=>e<=0))[0]?.[0]||T[0][0];return E===a?{}:{data:{index:y+1,overflows:C},reset:{placement:E}}}}},I=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:m=`bestFit`,fallbackAxisSideDirection:g=`none`,flipAlignment:y=!0,...b}=u(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let x=d(r),S=h(o),C=d(o)===o,w=await(s.isRTL==null?void 0:s.isRTL(c.floating)),D=p||(C||!y?[E(o)]:v(o)),O=g!==`none`;!p&&O&&D.push(...T(o,y,g,w));let k=[o,...D],A=await s.detectOverflow(t,b),j=[],M=i.flip?.overflows||[];if(l&&j.push(A[x]),f){let e=_(r,a,w);j.push(A[e[0]],A[e[1]])}if(M=[...M,{placement:r,overflows:j}],!j.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=k[e];if(t&&(!(f===`alignment`&&S!==h(t))||M.every(e=>h(e.placement)===S?e.overflows[0]>0:!0)))return{data:{index:e,overflows:M},reset:{placement:t}};let n=M.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(m){case`bestFit`:{let e=M.filter(e=>{if(O){let t=h(e.placement);return t===S||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function L(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function R(t){return e.some(e=>t[e]>=0)}const z=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=u(e,t);switch(i){case`referenceHidden`:{let e=L(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:R(e)}}}case`escaped`:{let e=L(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:R(e)}}}default:return{}}}}};function B(e){let t=r(...e.map(e=>e.left)),n=r(...e.map(e=>e.top)),a=i(...e.map(e=>e.right)),o=i(...e.map(e=>e.bottom));return{x:t,y:n,width:a-t,height:o-n}}function V(e){let t=e.slice().sort((e,t)=>e.y-t.y),n=[],r=null;for(let e=0;e<t.length;e++){let i=t[e];!r||i.y-r.y>r.height/2?n.push([i]):n[n.length-1].push(i),r=i}return n.map(e=>k(B(e)))}const H=function(e){return e===void 0&&(e={}),{name:`inline`,options:e,async fn(t){let{placement:n,elements:a,rects:o,platform:s,strategy:c}=t,{padding:l=2,x:f,y:p}=u(e,t),m=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(a.reference))||[]),g=V(m),_=k(B(m)),v=O(l);function y(){if(g.length===2&&g[0].left>g[1].right&&f!=null&&p!=null)return g.find(e=>f>e.left-v.left&&f<e.right+v.right&&p>e.top-v.top&&p<e.bottom+v.bottom)||_;if(g.length>=2){if(h(n)===`y`){let e=g[0],t=g[g.length-1],r=d(n)===`top`,i=e.top,a=t.bottom,o=r?e.left:t.left,s=r?e.right:t.right;return{top:i,bottom:a,left:o,right:s,width:s-o,height:a-i,x:o,y:i}}let e=d(n)===`left`,t=i(...g.map(e=>e.right)),a=r(...g.map(e=>e.left)),o=g.filter(n=>e?n.left===a:n.right===t),s=o[0].top,c=o[o.length-1].bottom,l=a,u=t;return{top:s,bottom:c,left:l,right:u,width:u-l,height:c-s,x:l,y:s}}return _}let b=await s.getElementRects({reference:{getBoundingClientRect:y},floating:a.floating,strategy:c});return o.reference.x!==b.reference.x||o.reference.y!==b.reference.y||o.reference.width!==b.reference.width||o.reference.height!==b.reference.height?{reset:{rects:b}}:{}}}},U=new Set([`left`,`top`]);async function W(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=d(n),s=f(n),c=h(n)===`y`,l=U.has(o)?-1:1,p=a&&c?-1:1,m=u(t,e),{mainAxis:g,crossAxis:_,alignmentAxis:v}=typeof m==`number`?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return s&&typeof v==`number`&&(_=s===`end`?v*-1:v),c?{x:_*p,y:g*l}:{x:g*l,y:_*p}}const G=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await W(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},K=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...f}=u(e,t),m={x:n,y:r},g=await a.detectOverflow(t,f),_=h(d(i)),v=p(_),y=m[v],b=m[_];if(o){let e=v===`y`?`top`:`left`,t=v===`y`?`bottom`:`right`,n=y+g[e],r=y-g[t];y=l(n,y,r)}if(s){let e=_===`y`?`top`:`left`,t=_===`y`?`bottom`:`right`,n=b+g[e],r=b-g[t];b=l(n,b,r)}let x=c.fn({...t,[v]:y,[_]:b});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[v]:o,[_]:s}}}}}},q=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=u(e,t),f={x:n,y:r},m=h(i),g=p(m),_=f[g],v=f[m],y=u(s,t),b=typeof y==`number`?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(c){let e=g===`y`?`height`:`width`,t=a.reference[g]-a.floating[e]+b.mainAxis,n=a.reference[g]+a.reference[e]-b.mainAxis;_<t?_=t:_>n&&(_=n)}if(l){let e=g===`y`?`width`:`height`,t=U.has(d(i)),n=a.reference[m]-a.floating[e]+(t&&o.offset?.[m]||0)+(t?0:b.crossAxis),r=a.reference[m]+a.reference[e]+(t?0:o.offset?.[m]||0)-(t?b.crossAxis:0);v<n?v=n:v>r&&(v=r)}return{[g]:_,[m]:v}}}},J=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,a;let{placement:o,rects:s,platform:c,elements:l}=t,{apply:p=()=>{},...m}=u(e,t),g=await c.detectOverflow(t,m),_=d(o),v=f(o),y=h(o)===`y`,{width:b,height:x}=s.floating,S,C;_===`top`||_===`bottom`?(S=_,C=v===(await(c.isRTL==null?void 0:c.isRTL(l.floating))?`start`:`end`)?`left`:`right`):(C=_,S=v===`end`?`top`:`bottom`);let w=x-g.top-g.bottom,T=b-g.left-g.right,E=r(x-g[S],w),D=r(b-g[C],T),O=!t.middlewareData.shift,k=E,A=D;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=T),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(k=w),O&&!v){let e=i(g.left,0),t=i(g.right,0),n=i(g.top,0),r=i(g.bottom,0);y?A=b-2*(e!==0||t!==0?e+t:i(g.left,g.right)):k=x-2*(n!==0||r!==0?n+r:i(g.top,g.bottom))}await p({...t,availableWidth:A,availableHeight:k});let j=await c.getDimensions(l.floating);return b!==j.width||x!==j.height?{reset:{rects:!0}}:{}}}};export{z as a,G as c,s as d,o as f,a as g,k as h,I as i,K as l,r as m,F as n,H as o,i as p,M as r,q as s,N as t,J as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"../../rolldown-runtime.mjs";import{a as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g}from"./core.mjs";function hasWindow(){return typeof window<`u`}function getNodeName(e){return isNode(e)?(e.nodeName||``).toLowerCase():`#document`}function getWindow(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function getDocumentElement(e){return((isNode(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function isNode(e){return hasWindow()?e instanceof Node||e instanceof getWindow(e).Node:!1}function isElement(e){return hasWindow()?e instanceof Element||e instanceof getWindow(e).Element:!1}function isHTMLElement(e){return hasWindow()?e instanceof HTMLElement||e instanceof getWindow(e).HTMLElement:!1}function isShadowRoot(e){return!hasWindow()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof getWindow(e).ShadowRoot}function isOverflowElement(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=getComputedStyle$1(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function isTableElement(e){return/^(table|td|th)$/.test(getNodeName(e))}function isTopLayer(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}const _=/transform|translate|scale|rotate|perspective|filter/,v=/paint|layout|strict|content/,isNotNone=e=>!!e&&e!==`none`;let y;function isContainingBlock(e){let t=isElement(e)?getComputedStyle$1(e):e;return isNotNone(t.transform)||isNotNone(t.translate)||isNotNone(t.scale)||isNotNone(t.rotate)||isNotNone(t.perspective)||!isWebKit()&&(isNotNone(t.backdropFilter)||isNotNone(t.filter))||_.test(t.willChange||``)||v.test(t.contain||``)}function getContainingBlock(e){let t=getParentNode(e);for(;isHTMLElement(t)&&!isLastTraversableNode(t);){if(isContainingBlock(t))return t;if(isTopLayer(t))return null;t=getParentNode(t)}return null}function isWebKit(){return y??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),y}function isLastTraversableNode(e){return/^(html|body|#document)$/.test(getNodeName(e))}function getComputedStyle$1(e){return getWindow(e).getComputedStyle(e)}e(getComputedStyle$1,`getComputedStyle`);function getNodeScroll(e){return isElement(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function getParentNode(e){if(getNodeName(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||isShadowRoot(e)&&e.host||getDocumentElement(e);return isShadowRoot(t)?t.host:t}function getNearestOverflowAncestor(e){let t=getParentNode(e);return isLastTraversableNode(t)?e.ownerDocument?e.ownerDocument.body:e.body:isHTMLElement(t)&&isOverflowElement(t)?t:getNearestOverflowAncestor(t)}function getOverflowAncestors(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=getNearestOverflowAncestor(e),i=r===e.ownerDocument?.body,a=getWindow(r);if(i){let e=getFrameElement(a);return t.concat(a,a.visualViewport||[],isOverflowElement(r)?r:[],e&&n?getOverflowAncestors(e):[])}else return t.concat(r,getOverflowAncestors(r,[],n))}function getFrameElement(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function getCssDimensions(e){let t=getComputedStyle$1(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=isHTMLElement(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,c=a(n)!==o||a(r)!==s;return c&&(n=o,r=s),{width:n,height:r,$:c}}function unwrapElement(e){return isElement(e)?e:e.contextElement}function getScale(e){let t=unwrapElement(e);if(!isHTMLElement(t))return r(1);let n=t.getBoundingClientRect(),{width:i,height:o,$:s}=getCssDimensions(t),c=(s?a(n.width):n.width)/i,l=(s?a(n.height):n.height)/o;return(!c||!Number.isFinite(c))&&(c=1),(!l||!Number.isFinite(l))&&(l=1),{x:c,y:l}}const b=r(0);function getVisualOffsets(e){let t=getWindow(e);return!isWebKit()||!t.visualViewport?b:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function shouldAddVisualOffsets(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==getWindow(e)?!1:t}function getBoundingClientRect(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n=!1);let a=e.getBoundingClientRect(),s=unwrapElement(e),c=r(1);t&&(i?isElement(i)&&(c=getScale(i)):c=getScale(e));let l=shouldAddVisualOffsets(s,n,i)?getVisualOffsets(s):r(0),u=(a.left+l.x)/c.x,d=(a.top+l.y)/c.y,f=a.width/c.x,p=a.height/c.y;if(s){let e=getWindow(s),t=i&&isElement(i)?getWindow(i):i,n=e,r=getFrameElement(n);for(;r&&i&&t!==n;){let e=getScale(r),t=r.getBoundingClientRect(),i=getComputedStyle$1(r),a=t.left+(r.clientLeft+parseFloat(i.paddingLeft))*e.x,o=t.top+(r.clientTop+parseFloat(i.paddingTop))*e.y;u*=e.x,d*=e.y,f*=e.x,p*=e.y,u+=a,d+=o,n=getWindow(r),r=getFrameElement(n)}}return o({width:f,height:p,x:u,y:d})}function getWindowScrollBarX(e,t){let n=getNodeScroll(e).scrollLeft;return t?t.left+n:getBoundingClientRect(getDocumentElement(e)).left+n}function getHTMLOffset(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-getWindowScrollBarX(e,n),y:n.top+t.scrollTop}}function convertOffsetParentRelativeRectToViewportRelativeRect(e){let{elements:t,rect:n,offsetParent:i,strategy:a}=e,o=a===`fixed`,s=getDocumentElement(i),c=t?isTopLayer(t.floating):!1;if(i===s||c&&o)return n;let l={scrollLeft:0,scrollTop:0},u=r(1),d=r(0),f=isHTMLElement(i);if((f||!f&&!o)&&((getNodeName(i)!==`body`||isOverflowElement(s))&&(l=getNodeScroll(i)),f)){let e=getBoundingClientRect(i);u=getScale(i),d.x=e.x+i.clientLeft,d.y=e.y+i.clientTop}let p=s&&!f&&!o?getHTMLOffset(s,l):r(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-l.scrollTop*u.y+d.y+p.y}}function getClientRects(e){return Array.from(e.getClientRects())}function getDocumentRect(e){let t=getDocumentElement(e),n=getNodeScroll(e),r=e.ownerDocument.body,i=f(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=f(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+getWindowScrollBarX(e),s=-n.scrollTop;return getComputedStyle$1(r).direction===`rtl`&&(o+=f(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}function getViewportRect(e,t){let n=getWindow(e),r=getDocumentElement(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=isWebKit();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=getWindowScrollBarX(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=25&&(a-=o)}else l<=25&&(a+=l);return{width:a,height:o,x:s,y:c}}function getInnerBoundingClientRect(e,t){let n=getBoundingClientRect(e,!0,t===`fixed`),i=n.top+e.clientTop,a=n.left+e.clientLeft,o=isHTMLElement(e)?getScale(e):r(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:a*o.x,y:i*o.y}}function getClientRectFromClippingAncestor(e,t,n){let r;if(t===`viewport`)r=getViewportRect(e,n);else if(t===`document`)r=getDocumentRect(getDocumentElement(e));else if(isElement(t))r=getInnerBoundingClientRect(t,n);else{let n=getVisualOffsets(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return o(r)}function hasFixedPositionAncestor(e,t){let n=getParentNode(e);return n===t||!isElement(n)||isLastTraversableNode(n)?!1:getComputedStyle$1(n).position===`fixed`||hasFixedPositionAncestor(n,t)}function getClippingElementAncestors(e,t){let n=t.get(e);if(n)return n;let r=getOverflowAncestors(e,[],!1).filter(e=>isElement(e)&&getNodeName(e)!==`body`),i=null,a=getComputedStyle$1(e).position===`fixed`,o=a?getParentNode(e):e;for(;isElement(o)&&!isLastTraversableNode(o);){let t=getComputedStyle$1(o),n=isContainingBlock(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||isOverflowElement(o)&&!n&&hasFixedPositionAncestor(e,o))?r=r.filter(e=>e!==o):i=t,o=getParentNode(o)}return t.set(e,r),r}function getClippingRect(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?isTopLayer(t)?[]:getClippingElementAncestors(t,this._c):[].concat(n),r],o=getClientRectFromClippingAncestor(t,a[0],i),s=o.top,c=o.right,u=o.bottom,d=o.left;for(let e=1;e<a.length;e++){let n=getClientRectFromClippingAncestor(t,a[e],i);s=f(n.top,s),c=l(n.right,c),u=l(n.bottom,u),d=f(n.left,d)}return{width:c-d,height:u-s,x:d,y:s}}function getDimensions(e){let{width:t,height:n}=getCssDimensions(e);return{width:t,height:n}}function getRectRelativeToOffsetParent(e,t,n){let i=isHTMLElement(t),a=getDocumentElement(t),o=n===`fixed`,s=getBoundingClientRect(e,!0,o,t),c={scrollLeft:0,scrollTop:0},l=r(0);function setLeftRTLScrollbarOffset(){l.x=getWindowScrollBarX(a)}if(i||!i&&!o)if((getNodeName(t)!==`body`||isOverflowElement(a))&&(c=getNodeScroll(t)),i){let e=getBoundingClientRect(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else a&&setLeftRTLScrollbarOffset();o&&!i&&a&&setLeftRTLScrollbarOffset();let u=a&&!i&&!o?getHTMLOffset(a,c):r(0);return{x:s.left+c.scrollLeft-l.x-u.x,y:s.top+c.scrollTop-l.y-u.y,width:s.width,height:s.height}}function isStaticPositioned(e){return getComputedStyle$1(e).position===`static`}function getTrueOffsetParent(e,t){if(!isHTMLElement(e)||getComputedStyle$1(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return getDocumentElement(e)===n&&(n=n.ownerDocument.body),n}function getOffsetParent(e,t){let n=getWindow(e);if(isTopLayer(e))return n;if(!isHTMLElement(e)){let t=getParentNode(e);for(;t&&!isLastTraversableNode(t);){if(isElement(t)&&!isStaticPositioned(t))return t;t=getParentNode(t)}return n}let r=getTrueOffsetParent(e,t);for(;r&&isTableElement(r)&&isStaticPositioned(r);)r=getTrueOffsetParent(r,t);return r&&isLastTraversableNode(r)&&isStaticPositioned(r)&&!isContainingBlock(r)?n:r||getContainingBlock(e)||n}const getElementRects=async function(e){let t=this.getOffsetParent||getOffsetParent,n=this.getDimensions,r=await n(e.floating);return{reference:getRectRelativeToOffsetParent(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function isRTL(e){return getComputedStyle$1(e).direction===`rtl`}const x={convertOffsetParentRelativeRectToViewportRelativeRect,getDocumentElement,getClippingRect,getOffsetParent,getElementRects,getClientRects,getDimensions,getScale,isElement,isRTL};function rectsAreEqual(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function observeMove(e,t){let n=null,r,a=getDocumentElement(e);function cleanup(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function refresh(o,s){o===void 0&&(o=!1),s===void 0&&(s=1),cleanup();let c=e.getBoundingClientRect(),{left:u,top:d,width:p,height:m}=c;if(o||t(),!p||!m)return;let h=i(d),g=i(a.clientWidth-(u+p)),_=i(a.clientHeight-(d+m)),v=i(u),y={rootMargin:-h+`px `+-g+`px `+-_+`px `+-v+`px`,threshold:f(0,l(1,s))||1},b=!0;function handleObserve(t){let n=t[0].intersectionRatio;if(n!==s){if(!b)return refresh();n?refresh(!1,n):r=setTimeout(()=>{refresh(!1,1e-7)},1e3)}n===1&&!rectsAreEqual(c,e.getBoundingClientRect())&&refresh(),b=!1}try{n=new IntersectionObserver(handleObserve,{...y,root:a.ownerDocument})}catch{n=new IntersectionObserver(handleObserve,y)}n.observe(e)}return refresh(!0),cleanup}function autoUpdate(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=unwrapElement(e),u=i||a?[...l?getOverflowAncestors(l):[],...t?getOverflowAncestors(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?observeMove(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?getBoundingClientRect(e):null;c&&frameLoop();function frameLoop(){let t=getBoundingClientRect(e);h&&!rectsAreEqual(h,t)&&n(),h=t,m=requestAnimationFrame(frameLoop)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}const S=n,C=u,w=c,T=s,E=g,D=t,O=h,k=d,A=m,computePosition=(e,t,n)=>{let r=new Map,i={platform:x,...n},a={...i.platform,_c:r};return p(e,t,{...i,platform:a})};export{isHTMLElement as _,T as a,isWebKit as b,A as c,E as d,getComputedStyle$1 as f,isElement as g,getWindow as h,computePosition as i,S as l,getParentNode as m,C as n,D as o,getOverflowAncestors as p,autoUpdate as r,k as s,O as t,w as u,isLastTraversableNode as v,isShadowRoot as y};
|
|
1
|
+
import{a as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,s as p,t as m,u as h}from"./core.mjs";function g(){return typeof window<`u`}function _(e){return b(e)?(e.nodeName||``).toLowerCase():`#document`}function v(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function y(e){return((b(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function b(e){return g()?e instanceof Node||e instanceof v(e).Node:!1}function x(e){return g()?e instanceof Element||e instanceof v(e).Element:!1}function S(e){return g()?e instanceof HTMLElement||e instanceof v(e).HTMLElement:!1}function C(e){return!g()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof v(e).ShadowRoot}function w(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=j(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ee(e){return/^(table|td|th)$/.test(_(e))}function T(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}const te=/transform|translate|scale|rotate|perspective|filter/,ne=/paint|layout|strict|content/,E=e=>!!e&&e!==`none`;let D;function O(e){let t=x(e)?j(e):e;return E(t.transform)||E(t.translate)||E(t.scale)||E(t.rotate)||E(t.perspective)||!k()&&(E(t.backdropFilter)||E(t.filter))||te.test(t.willChange||``)||ne.test(t.contain||``)}function re(e){let t=N(e);for(;S(t)&&!A(t);){if(O(t))return t;if(T(t))return null;t=N(t)}return null}function k(){return D??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),D}function A(e){return/^(html|body|#document)$/.test(_(e))}function j(e){return v(e).getComputedStyle(e)}function M(e){return x(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function N(e){if(_(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||C(e)&&e.host||y(e);return C(t)?t.host:t}function P(e){let t=N(e);return A(t)?e.ownerDocument?e.ownerDocument.body:e.body:S(t)&&w(t)?t:P(t)}function F(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=P(e),i=r===e.ownerDocument?.body,a=v(r);if(i){let e=I(a);return t.concat(a,a.visualViewport||[],w(r)?r:[],e&&n?F(e):[])}else return t.concat(r,F(r,[],n))}function I(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function L(e){let t=j(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,a=S(e),o=a?e.offsetWidth:n,s=a?e.offsetHeight:r,c=i(n)!==o||i(r)!==s;return c&&(n=o,r=s),{width:n,height:r,$:c}}function R(e){return x(e)?e:e.contextElement}function z(e){let t=R(e);if(!S(t))return n(1);let r=t.getBoundingClientRect(),{width:a,height:o,$:s}=L(t),c=(s?i(r.width):r.width)/a,l=(s?i(r.height):r.height)/o;return(!c||!Number.isFinite(c))&&(c=1),(!l||!Number.isFinite(l))&&(l=1),{x:c,y:l}}const ie=n(0);function B(e){let t=v(e);return!k()||!t.visualViewport?ie:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ae(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==v(e)?!1:t}function V(e,t,r,i){t===void 0&&(t=!1),r===void 0&&(r=!1);let o=e.getBoundingClientRect(),s=R(e),c=n(1);t&&(i?x(i)&&(c=z(i)):c=z(e));let l=ae(s,r,i)?B(s):n(0),u=(o.left+l.x)/c.x,d=(o.top+l.y)/c.y,f=o.width/c.x,p=o.height/c.y;if(s){let e=v(s),t=i&&x(i)?v(i):i,n=e,r=I(n);for(;r&&i&&t!==n;){let e=z(r),t=r.getBoundingClientRect(),i=j(r),a=t.left+(r.clientLeft+parseFloat(i.paddingLeft))*e.x,o=t.top+(r.clientTop+parseFloat(i.paddingTop))*e.y;u*=e.x,d*=e.y,f*=e.x,p*=e.y,u+=a,d+=o,n=v(r),r=I(n)}}return a({width:f,height:p,x:u,y:d})}function H(e,t){let n=M(e).scrollLeft;return t?t.left+n:V(y(e)).left+n}function U(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-H(e,n),y:n.top+t.scrollTop}}function oe(e){let{elements:t,rect:r,offsetParent:i,strategy:a}=e,o=a===`fixed`,s=y(i),c=t?T(t.floating):!1;if(i===s||c&&o)return r;let l={scrollLeft:0,scrollTop:0},u=n(1),d=n(0),f=S(i);if((f||!f&&!o)&&((_(i)!==`body`||w(s))&&(l=M(i)),f)){let e=V(i);u=z(i),d.x=e.x+i.clientLeft,d.y=e.y+i.clientTop}let p=s&&!f&&!o?U(s,l):n(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-l.scrollLeft*u.x+d.x+p.x,y:r.y*u.y-l.scrollTop*u.y+d.y+p.y}}function W(e){return Array.from(e.getClientRects())}function G(e){let t=y(e),n=M(e),r=e.ownerDocument.body,i=d(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=d(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+H(e),s=-n.scrollTop;return j(r).direction===`rtl`&&(o+=d(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}function K(e,t){let n=v(e),r=y(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=k();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=H(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=25&&(a-=o)}else l<=25&&(a+=l);return{width:a,height:o,x:s,y:c}}function se(e,t){let r=V(e,!0,t===`fixed`),i=r.top+e.clientTop,a=r.left+e.clientLeft,o=S(e)?z(e):n(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:a*o.x,y:i*o.y}}function q(e,t,n){let r;if(t===`viewport`)r=K(e,n);else if(t===`document`)r=G(y(e));else if(x(t))r=se(t,n);else{let n=B(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return a(r)}function J(e,t){let n=N(e);return n===t||!x(n)||A(n)?!1:j(n).position===`fixed`||J(n,t)}function ce(e,t){let n=t.get(e);if(n)return n;let r=F(e,[],!1).filter(e=>x(e)&&_(e)!==`body`),i=null,a=j(e).position===`fixed`,o=a?N(e):e;for(;x(o)&&!A(o);){let t=j(o),n=O(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||w(o)&&!n&&J(e,o))?r=r.filter(e=>e!==o):i=t,o=N(o)}return t.set(e,r),r}function le(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?T(t)?[]:ce(t,this._c):[].concat(n),r],o=q(t,a[0],i),s=o.top,l=o.right,u=o.bottom,f=o.left;for(let e=1;e<a.length;e++){let n=q(t,a[e],i);s=d(n.top,s),l=c(n.right,l),u=c(n.bottom,u),f=d(n.left,f)}return{width:l-f,height:u-s,x:f,y:s}}function ue(e){let{width:t,height:n}=L(e);return{width:t,height:n}}function de(e,t,r){let i=S(t),a=y(t),o=r===`fixed`,s=V(e,!0,o,t),c={scrollLeft:0,scrollTop:0},l=n(0);function u(){l.x=H(a)}if(i||!i&&!o)if((_(t)!==`body`||w(a))&&(c=M(t)),i){let e=V(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else a&&u();o&&!i&&a&&u();let d=a&&!i&&!o?U(a,c):n(0);return{x:s.left+c.scrollLeft-l.x-d.x,y:s.top+c.scrollTop-l.y-d.y,width:s.width,height:s.height}}function Y(e){return j(e).position===`static`}function X(e,t){if(!S(e)||j(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return y(e)===n&&(n=n.ownerDocument.body),n}function Z(e,t){let n=v(e);if(T(e))return n;if(!S(e)){let t=N(e);for(;t&&!A(t);){if(x(t)&&!Y(t))return t;t=N(t)}return n}let r=X(e,t);for(;r&&ee(r)&&Y(r);)r=X(r,t);return r&&A(r)&&Y(r)&&!O(r)?n:r||re(e)||n}const fe=async function(e){let t=this.getOffsetParent||Z,n=this.getDimensions,r=await n(e.floating);return{reference:de(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function pe(e){return j(e).direction===`rtl`}const me={convertOffsetParentRelativeRectToViewportRelativeRect:oe,getDocumentElement:y,getClippingRect:le,getOffsetParent:Z,getElementRects:fe,getClientRects:W,getDimensions:ue,getScale:z,isElement:x,isRTL:pe};function Q(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function he(e,t){let n=null,i,a=y(e);function o(){var e;clearTimeout(i),(e=n)==null||e.disconnect(),n=null}function s(l,u){l===void 0&&(l=!1),u===void 0&&(u=1),o();let f=e.getBoundingClientRect(),{left:p,top:m,width:h,height:g}=f;if(l||t(),!h||!g)return;let _=r(m),v=r(a.clientWidth-(p+h)),y=r(a.clientHeight-(m+g)),b=r(p),x={rootMargin:-_+`px `+-v+`px `+-y+`px `+-b+`px`,threshold:d(0,c(1,u))||1},S=!0;function C(t){let n=t[0].intersectionRatio;if(n!==u){if(!S)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}n===1&&!Q(f,e.getBoundingClientRect())&&s(),S=!1}try{n=new IntersectionObserver(C,{...x,root:a.ownerDocument})}catch{n=new IntersectionObserver(C,x)}n.observe(e)}return s(!0),o}function ge(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=R(e),u=i||a?[...l?F(l):[],...t?F(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?he(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?V(e):null;c&&g();function g(){let t=V(e);h&&!Q(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}const _e=t,$=l,ve=s,ye=o,be=h,xe=e,Se=m,Ce=u,we=p,Te=(e,t,n)=>{let r=new Map,i={platform:me,...n},a={...i.platform,_c:r};return f(e,t,{...i,platform:a})};export{S as _,ye as a,k as b,we as c,be as d,j as f,x as g,v as h,Te as i,_e as l,N as m,$ as n,xe as o,F as p,ge as r,Ce as s,Se as t,ve as u,A as v,C as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"../../rolldown-runtime.mjs";import{_ as t,a as n,b as r,c as i,d as a,f as o,g as s,h as c,i as l,l as u,m as d,o as f,p,s as m,t as h,u as g,v as _,y as v}from"./dom.mjs";import*as y from"react";import{useLayoutEffect as b}from"react";import{jsx as x}from"react/jsx-runtime";import*as S from"react-dom";function getPlatform(){let e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function getUserAgent(){let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(e=>{let{brand:t,version:n}=e;return t+`/`+n}).join(` `):navigator.userAgent}function isSafari(){return/apple/i.test(navigator.vendor)}function isMac(){return getPlatform().toLowerCase().startsWith(`mac`)&&!navigator.maxTouchPoints}function isJSDOM(){return getUserAgent().includes(`jsdom/`)}const C=`data-floating-ui-focusable`;function activeElement(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function contains(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&v(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function getTarget(e){return`composedPath`in e?e.composedPath()[0]:e.target}function isEventTargetWithin(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function isRootElement(e){return e.matches(`html,body`)}function getDocument(e){return e?.ownerDocument||document}function isTypeableElement(e){return t(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function matchesFocusVisible(e){if(!e||isJSDOM())return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function getFloatingFocusElement(e){return e?e.hasAttribute(C)?e:e.querySelector(`[`+C+`]`)||e:null}function getNodeChildren(e,t,n){return n===void 0&&(n=!0),e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...getNodeChildren(e,t.id,n)])}function isReactEvent(e){return`nativeEvent`in e}function isMouseLikePointerType(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}var w=typeof document<`u`?b:function noop(){};const T={...y};function useLatestRef$1(e){let t=y.useRef(e);return w(()=>{t.current=e}),t}e(useLatestRef$1,`useLatestRef`);const E=T.useInsertionEffect||(e=>e());function useEffectEvent$1(e){let t=y.useRef(()=>{});return E(()=>{t.current=e}),y.useCallback(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}e(useEffectEvent$1,`useEffectEvent`);var D=typeof document<`u`?b:function noop(){};function deepEqual(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!deepEqual(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!deepEqual(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function getDPR(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function roundByDPR(e,t){let n=getDPR(e);return Math.round(t*n)/n}function useLatestRef(e){let t=y.useRef(e);return D(()=>{t.current=e}),t}function useFloating$1(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:u}=e,[d,f]=y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=y.useState(r);deepEqual(p,r)||m(r);let[h,g]=y.useState(null),[_,v]=y.useState(null),b=y.useCallback(e=>{e!==T.current&&(T.current=e,g(e))},[]),x=y.useCallback(e=>{e!==E.current&&(E.current=e,v(e))},[]),C=a||h,w=o||_,T=y.useRef(null),E=y.useRef(null),O=y.useRef(d),k=c!=null,A=useLatestRef(c),j=useLatestRef(i),M=useLatestRef(u),N=y.useCallback(()=>{if(!T.current||!E.current)return;let e={placement:t,strategy:n,middleware:p};j.current&&(e.platform=j.current),l(T.current,E.current,e).then(e=>{let t={...e,isPositioned:M.current!==!1};P.current&&!deepEqual(O.current,t)&&(O.current=t,S.flushSync(()=>{f(t)}))})},[p,t,n,j,M]);D(()=>{u===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[u]);let P=y.useRef(!1);D(()=>(P.current=!0,()=>{P.current=!1}),[]),D(()=>{if(C&&(T.current=C),w&&(E.current=w),C&&w){if(A.current)return A.current(C,w,N);N()}},[C,w,N,A,k]);let F=y.useMemo(()=>({reference:T,floating:E,setReference:b,setFloating:x}),[b,x]),I=y.useMemo(()=>({reference:C,floating:w}),[C,w]),L=y.useMemo(()=>{let e={position:n,left:0,top:0};if(!I.floating)return e;let t=roundByDPR(I.floating,d.x),r=roundByDPR(I.floating,d.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...getDPR(I.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,I.floating,d.x,d.y]);return y.useMemo(()=>({...d,update:N,refs:F,elements:I,floatingStyles:L}),[d,N,F,I,L])}e(useFloating$1,`useFloating`);const arrow$1=e=>{function isRef(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(t){let{element:n,padding:r}=typeof e==`function`?e(t):e;return n&&isRef(n)?n.current==null?{}:h({element:n.current,padding:r}).fn(t):n?h({element:n,padding:r}).fn(t):{}}}},offset=(e,t)=>{let n=u(e);return{name:n.name,fn:n.fn,options:[e,t]}},shift=(e,t)=>{let n=g(e);return{name:n.name,fn:n.fn,options:[e,t]}},limitShift=(e,t)=>({fn:i(e).fn,options:[e,t]}),flip=(e,t)=>{let r=n(e);return{name:r.name,fn:r.fn,options:[e,t]}},size=(e,t)=>{let n=a(e);return{name:n.name,fn:n.fn,options:[e,t]}},hide=(e,t)=>{let n=f(e);return{name:n.name,fn:n.fn,options:[e,t]}},inline=(e,t)=>{let n=m(e);return{name:n.name,fn:n.fn,options:[e,t]}},arrow=(e,t)=>{let n=arrow$1(e);return{name:n.name,fn:n.fn,options:[e,t]}};function useMergeRefs(e){let t=y.useRef(void 0),n=y.useCallback(t=>{let n=e.map(e=>{if(e!=null){if(typeof e==`function`){let n=e,r=n(t);return typeof r==`function`?r:()=>{n(null)}}return e.current=t,()=>{e.current=null}}});return()=>{n.forEach(e=>e?.())}},e);return y.useMemo(()=>e.every(e=>e==null)?null:e=>{t.current&&=(t.current(),void 0),e!=null&&(t.current=n(e))},e)}const O=`active`,k=`selected`,A=[`ArrowLeft`,`ArrowRight`],j=[`ArrowUp`,`ArrowDown`];[...A,...j];const M={...y};let N=!1,P=0;const genId=()=>`floating-ui-`+Math.random().toString(36).slice(2,6)+ P++;function useFloatingId(){let[e,t]=y.useState(()=>N?genId():void 0);return w(()=>{e??t(genId())},[]),y.useEffect(()=>{N=!0},[]),e}const F=M.useId||useFloatingId;function createEventEmitter(){let e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}const I=y.createContext(null),L=y.createContext(null),useFloatingParentNodeId=()=>y.useContext(I)?.id||null,useFloatingTree=()=>y.useContext(L);function createAttribute(e){return`data-floating-ui-`+e}function clearTimeoutIfSet(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const R=createAttribute(`safe-polygon`);function getDelay(e,t,n){if(n&&!isMouseLikePointerType(n))return 0;if(typeof e==`number`)return e;if(typeof e==`function`){let n=e();return typeof n==`number`?n:n?.[t]}return e?.[t]}function getRestMs(e){return typeof e==`function`?e():e}function useHover(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,dataRef:i,events:a,elements:o}=e,{enabled:c=!0,delay:l=0,handleClose:u=null,mouseOnly:d=!1,restMs:f=0,move:p=!0}=t,m=useFloatingTree(),h=useFloatingParentNodeId(),g=useLatestRef$1(u),_=useLatestRef$1(l),v=useLatestRef$1(n),b=useLatestRef$1(f),x=y.useRef(),S=y.useRef(-1),C=y.useRef(),T=y.useRef(-1),E=y.useRef(!0),D=y.useRef(!1),O=y.useRef(()=>{}),k=y.useRef(!1),A=useEffectEvent$1(()=>{let e=i.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`});y.useEffect(()=>{if(!c)return;function onOpenChange(e){let{open:t}=e;t||(clearTimeoutIfSet(S),clearTimeoutIfSet(T),E.current=!0,k.current=!1)}return a.on(`openchange`,onOpenChange),()=>{a.off(`openchange`,onOpenChange)}},[c,a]),y.useEffect(()=>{if(!c||!g.current||!n)return;function onLeave(e){A()&&r(!1,e,`hover`)}let e=getDocument(o.floating).documentElement;return e.addEventListener(`mouseleave`,onLeave),()=>{e.removeEventListener(`mouseleave`,onLeave)}},[o.floating,n,r,c,g,A]);let j=y.useCallback(function(e,t,n){t===void 0&&(t=!0),n===void 0&&(n=`hover`);let i=getDelay(_.current,`close`,x.current);i&&!C.current?(clearTimeoutIfSet(S),S.current=window.setTimeout(()=>r(!1,e,n),i)):t&&(clearTimeoutIfSet(S),r(!1,e,n))},[_,r]),M=useEffectEvent$1(()=>{O.current(),C.current=void 0}),N=useEffectEvent$1(()=>{if(D.current){let e=getDocument(o.floating).body;e.style.pointerEvents=``,e.removeAttribute(R),D.current=!1}}),P=useEffectEvent$1(()=>i.current.openEvent?[`click`,`mousedown`].includes(i.current.openEvent.type):!1);y.useEffect(()=>{if(!c)return;function onReferenceMouseEnter(e){if(clearTimeoutIfSet(S),E.current=!1,d&&!isMouseLikePointerType(x.current)||getRestMs(b.current)>0&&!getDelay(_.current,`open`))return;let t=getDelay(_.current,`open`,x.current);t?S.current=window.setTimeout(()=>{v.current||r(!0,e,`hover`)},t):n||r(!0,e,`hover`)}function onReferenceMouseLeave(e){if(P()){N();return}O.current();let t=getDocument(o.floating);if(clearTimeoutIfSet(T),k.current=!1,g.current&&i.current.floatingContext){n||clearTimeoutIfSet(S),C.current=g.current({...i.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){N(),M(),P()||j(e,!0,`safe-polygon`)}});let r=C.current;t.addEventListener(`mousemove`,r),O.current=()=>{t.removeEventListener(`mousemove`,r)};return}(x.current!==`touch`||!contains(o.floating,e.relatedTarget))&&j(e)}function onScrollMouseLeave(e){P()||i.current.floatingContext&&(g.current==null||g.current({...i.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){N(),M(),P()||j(e)}})(e))}function onFloatingMouseEnter(){clearTimeoutIfSet(S)}function onFloatingMouseLeave(e){P()||j(e,!1)}if(s(o.domReference)){let e=o.domReference,t=o.floating;return n&&e.addEventListener(`mouseleave`,onScrollMouseLeave),p&&e.addEventListener(`mousemove`,onReferenceMouseEnter,{once:!0}),e.addEventListener(`mouseenter`,onReferenceMouseEnter),e.addEventListener(`mouseleave`,onReferenceMouseLeave),t&&(t.addEventListener(`mouseleave`,onScrollMouseLeave),t.addEventListener(`mouseenter`,onFloatingMouseEnter),t.addEventListener(`mouseleave`,onFloatingMouseLeave)),()=>{n&&e.removeEventListener(`mouseleave`,onScrollMouseLeave),p&&e.removeEventListener(`mousemove`,onReferenceMouseEnter),e.removeEventListener(`mouseenter`,onReferenceMouseEnter),e.removeEventListener(`mouseleave`,onReferenceMouseLeave),t&&(t.removeEventListener(`mouseleave`,onScrollMouseLeave),t.removeEventListener(`mouseenter`,onFloatingMouseEnter),t.removeEventListener(`mouseleave`,onFloatingMouseLeave))}}},[o,c,e,d,p,j,M,N,r,n,v,m,_,g,i,P,b]),w(()=>{var e;if(c&&n&&(e=g.current)!=null&&(e=e.__options)!=null&&e.blockPointerEvents&&A()){D.current=!0;let e=o.floating;if(s(o.domReference)&&e){var t;let n=getDocument(o.floating).body;n.setAttribute(R,``);let r=o.domReference,i=m==null||(t=m.nodesRef.current.find(e=>e.id===h))==null||(t=t.context)==null?void 0:t.elements.floating;return i&&(i.style.pointerEvents=``),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,e.style.pointerEvents=`auto`,()=>{n.style.pointerEvents=``,r.style.pointerEvents=``,e.style.pointerEvents=``}}}},[c,n,h,o,m,g,A]),w(()=>{n||(x.current=void 0,k.current=!1,M(),N())},[n,M,N]),y.useEffect(()=>()=>{M(),clearTimeoutIfSet(S),clearTimeoutIfSet(T),N()},[c,o.domReference,M,N]);let F=y.useMemo(()=>{function setPointerRef(e){x.current=e.pointerType}return{onPointerDown:setPointerRef,onPointerEnter:setPointerRef,onMouseMove(e){let{nativeEvent:t}=e;function handleMouseMove(){!E.current&&!v.current&&r(!0,t,`hover`)}d&&!isMouseLikePointerType(x.current)||n||getRestMs(b.current)===0||k.current&&e.movementX**2+e.movementY**2<2||(clearTimeoutIfSet(T),x.current===`touch`?handleMouseMove():(k.current=!0,T.current=window.setTimeout(handleMouseMove,getRestMs(b.current))))}}},[d,r,n,v,b]);return y.useMemo(()=>c?{reference:F}:{},[c,F])}const NOOP=()=>{},z=y.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:NOOP,setState:NOOP,isInstantPhase:!1}),useDelayGroupContext=()=>y.useContext(z);function FloatingDelayGroup(e){let{children:t,delay:n,timeoutMs:r=0}=e,[i,a]=y.useReducer((e,t)=>({...e,...t}),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),o=y.useRef(null),s=y.useCallback(e=>{a({currentId:e})},[]);return w(()=>{i.currentId?o.current===null?o.current=i.currentId:i.isInstantPhase||a({isInstantPhase:!0}):(i.isInstantPhase&&a({isInstantPhase:!1}),o.current=null)},[i.currentId,i.isInstantPhase]),x(z.Provider,{value:y.useMemo(()=>({...i,setState:a,setCurrentId:s}),[i,s]),children:t})}function useDelayGroup(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,floatingId:i}=e,{id:a,enabled:o=!0}=t,s=a??i,c=useDelayGroupContext(),{currentId:l,setCurrentId:u,initialDelay:d,setState:f,timeoutMs:p}=c;return w(()=>{o&&l&&(f({delay:{open:1,close:getDelay(d,`close`)}}),l!==s&&r(!1))},[o,s,r,f,l,d]),w(()=>{function unset(){r(!1),f({delay:d,currentId:null})}if(o&&l&&!n&&l===s){if(p){let e=window.setTimeout(unset,p);return()=>{clearTimeout(e)}}unset()}},[o,n,f,l,s,r,d,p]),w(()=>{o&&(u===NOOP||!n||u(s))},[o,n,u,s]),c}const B={pointerdown:`onPointerDown`,mousedown:`onMouseDown`,click:`onClick`},V={pointerdown:`onPointerDownCapture`,mousedown:`onMouseDownCapture`,click:`onClickCapture`},normalizeProp=e=>({escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0});function useDismiss(e,n){n===void 0&&(n={});let{open:i,onOpenChange:a,elements:c,dataRef:l}=e,{enabled:u=!0,escapeKey:f=!0,outsidePress:m=!0,outsidePressEvent:h=`pointerdown`,referencePress:g=!1,referencePressEvent:v=`pointerdown`,ancestorScroll:b=!1,bubbles:x,capture:S}=n,C=useFloatingTree(),w=useEffectEvent$1(typeof m==`function`?m:()=>!1),T=typeof m==`function`?w:m,E=y.useRef(!1),{escapeKey:D,outsidePress:O}=normalizeProp(x),{escapeKey:k,outsidePress:A}=normalizeProp(S),j=y.useRef(!1),M=useEffectEvent$1(e=>{if(!i||!u||!f||e.key!==`Escape`||j.current)return;let t=l.current.floatingContext?.nodeId,n=C?getNodeChildren(C.nodesRef.current,t):[];if(!D&&(e.stopPropagation(),n.length>0)){let e=!0;if(n.forEach(t=>{var n;if((n=t.context)!=null&&n.open&&!t.context.dataRef.current.__escapeKeyBubbles){e=!1;return}}),!e)return}a(!1,isReactEvent(e)?e.nativeEvent:e,`escape-key`)}),N=useEffectEvent$1(e=>{var t;let callback=()=>{var t;M(e),(t=getTarget(e))==null||t.removeEventListener(`keydown`,callback)};(t=getTarget(e))==null||t.addEventListener(`keydown`,callback)}),P=useEffectEvent$1(e=>{let n=l.current.insideReactTree;l.current.insideReactTree=!1;let r=E.current;if(E.current=!1,h===`click`&&r||n||typeof T==`function`&&!T(e))return;let i=getTarget(e),u=`[`+createAttribute(`inert`)+`]`,f=getDocument(c.floating).querySelectorAll(u),p=s(i)?i:null;for(;p&&!_(p);){let e=d(p);if(_(e)||!s(e))break;p=e}if(f.length&&s(i)&&!isRootElement(i)&&!contains(i,c.floating)&&Array.from(f).every(e=>!contains(p,e)))return;if(t(i)&&L){let t=_(i),n=o(i),r=/auto|scroll/,a=t||r.test(n.overflowX),s=t||r.test(n.overflowY),c=a&&i.clientWidth>0&&i.scrollWidth>i.clientWidth,l=s&&i.clientHeight>0&&i.scrollHeight>i.clientHeight,u=n.direction===`rtl`,d=l&&(u?e.offsetX<=i.offsetWidth-i.clientWidth:e.offsetX>i.clientWidth),f=c&&e.offsetY>i.clientHeight;if(d||f)return}let m=l.current.floatingContext?.nodeId,g=C&&getNodeChildren(C.nodesRef.current,m).some(t=>isEventTargetWithin(e,t.context?.elements.floating));if(isEventTargetWithin(e,c.floating)||isEventTargetWithin(e,c.domReference)||g)return;let v=C?getNodeChildren(C.nodesRef.current,m):[];if(v.length>0){let e=!0;if(v.forEach(t=>{var n;if((n=t.context)!=null&&n.open&&!t.context.dataRef.current.__outsidePressBubbles){e=!1;return}}),!e)return}a(!1,e,`outside-press`)}),F=useEffectEvent$1(e=>{var t;let callback=()=>{var t;P(e),(t=getTarget(e))==null||t.removeEventListener(h,callback)};(t=getTarget(e))==null||t.addEventListener(h,callback)});y.useEffect(()=>{if(!i||!u)return;l.current.__escapeKeyBubbles=D,l.current.__outsidePressBubbles=O;let e=-1;function onScroll(e){a(!1,e,`ancestor-scroll`)}function handleCompositionStart(){window.clearTimeout(e),j.current=!0}function handleCompositionEnd(){e=window.setTimeout(()=>{j.current=!1},r()?5:0)}let t=getDocument(c.floating);f&&(t.addEventListener(`keydown`,k?N:M,k),t.addEventListener(`compositionstart`,handleCompositionStart),t.addEventListener(`compositionend`,handleCompositionEnd)),T&&t.addEventListener(h,A?F:P,A);let n=[];return b&&(s(c.domReference)&&(n=p(c.domReference)),s(c.floating)&&(n=n.concat(p(c.floating))),!s(c.reference)&&c.reference&&c.reference.contextElement&&(n=n.concat(p(c.reference.contextElement)))),n=n.filter(e=>e!==t.defaultView?.visualViewport),n.forEach(e=>{e.addEventListener(`scroll`,onScroll,{passive:!0})}),()=>{f&&(t.removeEventListener(`keydown`,k?N:M,k),t.removeEventListener(`compositionstart`,handleCompositionStart),t.removeEventListener(`compositionend`,handleCompositionEnd)),T&&t.removeEventListener(h,A?F:P,A),n.forEach(e=>{e.removeEventListener(`scroll`,onScroll)}),window.clearTimeout(e)}},[l,c,f,T,h,i,a,b,u,D,O,M,k,N,P,A,F]),y.useEffect(()=>{l.current.insideReactTree=!1},[l,T,h]);let I=y.useMemo(()=>({onKeyDown:M,...g&&{[B[v]]:e=>{a(!1,e.nativeEvent,`reference-press`)},...v!==`click`&&{onClick(e){a(!1,e.nativeEvent,`reference-press`)}}}}),[M,a,g,v]),L=y.useMemo(()=>{function setMouseDownOrUpInside(e){e.button===0&&(E.current=!0)}return{onKeyDown:M,onMouseDown:setMouseDownOrUpInside,onMouseUp:setMouseDownOrUpInside,[V[h]]:()=>{l.current.insideReactTree=!0}}},[M,h,l]);return y.useMemo(()=>u?{reference:I,floating:L}:{},[u,I,L])}function useFloatingRootContext(e){let{open:t=!1,onOpenChange:n,elements:r}=e,i=F(),a=y.useRef({}),[o]=y.useState(()=>createEventEmitter()),s=useFloatingParentNodeId()!=null,[c,l]=y.useState(r.reference),u=useEffectEvent$1((e,t,r)=>{a.current.openEvent=e?t:void 0,o.emit(`openchange`,{open:e,event:t,reason:r,nested:s}),n?.(e,t,r)}),d=y.useMemo(()=>({setPositionReference:l}),[]),f=y.useMemo(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);return y.useMemo(()=>({dataRef:a,open:t,onOpenChange:u,elements:f,events:o,floatingId:i,refs:d}),[t,u,f,o,i,d])}function useFloating(e){e===void 0&&(e={});let{nodeId:t}=e,n=useFloatingRootContext({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,i=r.elements,[a,o]=y.useState(null),[c,l]=y.useState(null),u=i?.domReference||a,d=y.useRef(null),f=useFloatingTree();w(()=>{u&&(d.current=u)},[u]);let p=useFloating$1({...e,elements:{...i,...c&&{reference:c}}}),m=y.useCallback(e=>{let t=s(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;l(t),p.refs.setReference(t)},[p.refs]),h=y.useCallback(e=>{(s(e)||e===null)&&(d.current=e,o(e)),(s(p.refs.reference.current)||p.refs.reference.current===null||e!==null&&!s(e))&&p.refs.setReference(e)},[p.refs]),g=y.useMemo(()=>({...p.refs,setReference:h,setPositionReference:m,domReference:d}),[p.refs,h,m]),_=y.useMemo(()=>({...p.elements,domReference:u}),[p.elements,u]),v=y.useMemo(()=>({...p,...r,refs:g,elements:_,nodeId:t}),[p,g,_,t,r]);return w(()=>{r.dataRef.current.floatingContext=v;let e=f?.nodesRef.current.find(e=>e.id===t);e&&(e.context=v)}),y.useMemo(()=>({...p,context:v,refs:g,elements:_}),[p,g,_,v])}function isMacSafari(){return isMac()&&isSafari()}function useFocus(e,n){n===void 0&&(n={});let{open:r,onOpenChange:i,events:a,dataRef:o,elements:l}=e,{enabled:u=!0,visibleOnly:d=!0}=n,f=y.useRef(!1),p=y.useRef(-1),m=y.useRef(!0);y.useEffect(()=>{if(!u)return;let e=c(l.domReference);function onBlur(){!r&&t(l.domReference)&&l.domReference===activeElement(getDocument(l.domReference))&&(f.current=!0)}function onKeyDown(){m.current=!0}function onPointerDown(){m.current=!1}return e.addEventListener(`blur`,onBlur),isMacSafari()&&(e.addEventListener(`keydown`,onKeyDown,!0),e.addEventListener(`pointerdown`,onPointerDown,!0)),()=>{e.removeEventListener(`blur`,onBlur),isMacSafari()&&(e.removeEventListener(`keydown`,onKeyDown,!0),e.removeEventListener(`pointerdown`,onPointerDown,!0))}},[l.domReference,r,u]),y.useEffect(()=>{if(!u)return;function onOpenChange(e){let{reason:t}=e;(t===`reference-press`||t===`escape-key`)&&(f.current=!0)}return a.on(`openchange`,onOpenChange),()=>{a.off(`openchange`,onOpenChange)}},[a,u]),y.useEffect(()=>()=>{clearTimeoutIfSet(p)},[]);let h=y.useMemo(()=>({onMouseLeave(){f.current=!1},onFocus(e){if(f.current)return;let t=getTarget(e.nativeEvent);if(d&&s(t)){if(isMacSafari()&&!e.relatedTarget){if(!m.current&&!isTypeableElement(t))return}else if(!matchesFocusVisible(t))return}i(!0,e.nativeEvent,`focus`)},onBlur(e){f.current=!1;let t=e.relatedTarget,n=e.nativeEvent,r=s(t)&&t.hasAttribute(createAttribute(`focus-guard`))&&t.getAttribute(`data-type`)===`outside`;p.current=window.setTimeout(()=>{let e=activeElement(l.domReference?l.domReference.ownerDocument:document);!t&&e===l.domReference||contains(o.current.floatingContext?.refs.floating.current,e)||contains(l.domReference,e)||r||i(!1,n,`focus`)})}}),[o,l.domReference,i,d]);return y.useMemo(()=>u?{reference:h}:{},[u,h])}function mergeProps(e,t,n){let r=new Map,i=n===`item`,a=e;if(i&&e){let{[O]:t,[k]:n,...r}=e;a=r}return{...n===`floating`&&{tabIndex:-1,"data-floating-ui-focusable":``},...a,...t.map(t=>{let r=t?t[n]:null;return typeof r==`function`?e?r(e):null:r}).concat(e).reduce((e,t)=>(t&&Object.entries(t).forEach(t=>{let[n,a]=t;if(!(i&&[O,k].includes(n)))if(n.indexOf(`on`)===0){if(r.has(n)||r.set(n,[]),typeof a==`function`){var o;(o=r.get(n))==null||o.push(a),e[n]=function(){var e=[...arguments];return r.get(n)?.map(t=>t(...e)).find(e=>e!==void 0)}}}else e[n]=a}),e),{})}}function useInteractions(e){e===void 0&&(e=[]);let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=y.useCallback(t=>mergeProps(t,e,`reference`),t),a=y.useCallback(t=>mergeProps(t,e,`floating`),n),o=y.useCallback(t=>mergeProps(t,e,`item`),r);return y.useMemo(()=>({getReferenceProps:i,getFloatingProps:a,getItemProps:o}),[i,a,o])}const H=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function useRole(e,t){t===void 0&&(t={});let{open:n,elements:r,floatingId:i}=e,{enabled:a=!0,role:o=`dialog`}=t,s=F(),c=r.domReference?.id||s,l=y.useMemo(()=>getFloatingFocusElement(r.floating)?.id||i,[r.floating,i]),u=H.get(o)??o,d=useFloatingParentNodeId()!=null,f=y.useMemo(()=>u===`tooltip`||o===`label`?{[`aria-`+(o===`label`?`labelledby`:`describedby`)]:n?l:void 0}:{"aria-expanded":n?`true`:`false`,"aria-haspopup":u===`alertdialog`?`dialog`:u,"aria-controls":n?l:void 0,...u===`listbox`&&{role:`combobox`},...u===`menu`&&{id:c},...u===`menu`&&d&&{role:`menuitem`},...o===`select`&&{"aria-autocomplete":`none`},...o===`combobox`&&{"aria-autocomplete":`list`}},[u,l,d,n,c,o]),p=y.useMemo(()=>{let e={id:l,...u&&{role:u}};return u===`tooltip`||o===`label`?e:{...e,...u===`menu`&&{"aria-labelledby":c}}},[u,l,c,o]),m=y.useCallback(e=>{let{active:t,selected:n}=e,r={role:`option`,...t&&{id:l+`-fui-option`}};switch(o){case`select`:case`combobox`:return{...r,"aria-selected":n}}return{}},[l,o]);return y.useMemo(()=>a?{reference:f,floating:p,item:m}:{},[a,f,p,m])}export{size as _,useFocus as a,useMergeRefs as c,flip as d,hide as f,shift as g,offset as h,useFloating as i,useRole as l,limitShift as m,useDelayGroup as n,useHover as o,inline as p,useDismiss as r,useInteractions as s,FloatingDelayGroup as t,arrow as u};
|
|
1
|
+
import{_ as e,a as t,b as n,c as r,d as i,f as a,g as o,h as s,i as c,l,m as u,o as d,p as f,s as p,t as m,u as h,v as g,y as _}from"./dom.mjs";import*as v from"react";import{useLayoutEffect as y}from"react";import{jsx as b}from"react/jsx-runtime";import*as x from"react-dom";function S(){let e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function C(){let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(e=>{let{brand:t,version:n}=e;return t+`/`+n}).join(` `):navigator.userAgent}function w(){return/apple/i.test(navigator.vendor)}function T(){return S().toLowerCase().startsWith(`mac`)&&!navigator.maxTouchPoints}function E(){return C().includes(`jsdom/`)}function D(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function O(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&_(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function k(e){return`composedPath`in e?e.composedPath()[0]:e.target}function A(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function j(e){return e.matches(`html,body`)}function M(e){return e?.ownerDocument||document}function N(t){return e(t)&&t.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function P(e){if(!e||E())return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function F(e){return e?e.hasAttribute(`data-floating-ui-focusable`)?e:e.querySelector(`[data-floating-ui-focusable]`)||e:null}function I(e,t,n){return n===void 0&&(n=!0),e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...I(e,t.id,n)])}function ee(e){return`nativeEvent`in e}function L(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}var R=typeof document<`u`?y:function(){};const z={...v};function B(e){let t=v.useRef(e);return R(()=>{t.current=e}),t}const V=z.useInsertionEffect||(e=>e());function H(e){let t=v.useRef(()=>{});return V(()=>{t.current=e}),v.useCallback(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}var U=typeof document<`u`?y:function(){};function W(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!W(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!W(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function te(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ne(e,t){let n=te(e);return Math.round(t*n)/n}function G(e){let t=v.useRef(e);return U(()=>{t.current=e}),t}function re(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:l,open:u}=e,[d,f]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=v.useState(r);W(p,r)||m(r);let[h,g]=v.useState(null),[_,y]=v.useState(null),b=v.useCallback(e=>{e!==T.current&&(T.current=e,g(e))},[]),S=v.useCallback(e=>{e!==E.current&&(E.current=e,y(e))},[]),C=a||h,w=o||_,T=v.useRef(null),E=v.useRef(null),D=v.useRef(d),O=l!=null,k=G(l),A=G(i),j=G(u),M=v.useCallback(()=>{if(!T.current||!E.current)return;let e={placement:t,strategy:n,middleware:p};A.current&&(e.platform=A.current),c(T.current,E.current,e).then(e=>{let t={...e,isPositioned:j.current!==!1};N.current&&!W(D.current,t)&&(D.current=t,x.flushSync(()=>{f(t)}))})},[p,t,n,A,j]);U(()=>{u===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[u]);let N=v.useRef(!1);U(()=>(N.current=!0,()=>{N.current=!1}),[]),U(()=>{if(C&&(T.current=C),w&&(E.current=w),C&&w){if(k.current)return k.current(C,w,M);M()}},[C,w,M,k,O]);let P=v.useMemo(()=>({reference:T,floating:E,setReference:b,setFloating:S}),[b,S]),F=v.useMemo(()=>({reference:C,floating:w}),[C,w]),I=v.useMemo(()=>{let e={position:n,left:0,top:0};if(!F.floating)return e;let t=ne(F.floating,d.x),r=ne(F.floating,d.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...te(F.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,F.floating,d.x,d.y]);return v.useMemo(()=>({...d,update:M,refs:P,elements:F,floatingStyles:I}),[d,M,P,F,I])}const ie=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:m({element:r.current,padding:i}).fn(n):r?m({element:r,padding:i}).fn(n):{}}}},ae=(e,t)=>{let n=l(e);return{name:n.name,fn:n.fn,options:[e,t]}},oe=(e,t)=>{let n=h(e);return{name:n.name,fn:n.fn,options:[e,t]}},se=(e,t)=>({fn:r(e).fn,options:[e,t]}),ce=(e,n)=>{let r=t(e);return{name:r.name,fn:r.fn,options:[e,n]}},le=(e,t)=>{let n=i(e);return{name:n.name,fn:n.fn,options:[e,t]}},ue=(e,t)=>{let n=d(e);return{name:n.name,fn:n.fn,options:[e,t]}},de=(e,t)=>{let n=p(e);return{name:n.name,fn:n.fn,options:[e,t]}},fe=(e,t)=>{let n=ie(e);return{name:n.name,fn:n.fn,options:[e,t]}};function pe(e){let t=v.useRef(void 0),n=v.useCallback(t=>{let n=e.map(e=>{if(e!=null){if(typeof e==`function`){let n=e,r=n(t);return typeof r==`function`?r:()=>{n(null)}}return e.current=t,()=>{e.current=null}}});return()=>{n.forEach(e=>e?.())}},e);return v.useMemo(()=>e.every(e=>e==null)?null:e=>{t.current&&=(t.current(),void 0),e!=null&&(t.current=n(e))},e)}const me=`active`,he=`selected`,ge=[`ArrowLeft`,`ArrowRight`],_e=[`ArrowUp`,`ArrowDown`];[...ge,..._e];const ve={...v};let ye=!1,be=0;const xe=()=>`floating-ui-`+Math.random().toString(36).slice(2,6)+ be++;function Se(){let[e,t]=v.useState(()=>ye?xe():void 0);return R(()=>{e??t(xe())},[]),v.useEffect(()=>{ye=!0},[]),e}const Ce=ve.useId||Se;function we(){let e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}const Te=v.createContext(null),Ee=v.createContext(null),K=()=>v.useContext(Te)?.id||null,q=()=>v.useContext(Ee);function J(e){return`data-floating-ui-`+e}function Y(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const De=J(`safe-polygon`);function X(e,t,n){if(n&&!L(n))return 0;if(typeof e==`number`)return e;if(typeof e==`function`){let n=e();return typeof n==`number`?n:n?.[t]}return e?.[t]}function Z(e){return typeof e==`function`?e():e}function Oe(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,dataRef:i,events:a,elements:s}=e,{enabled:c=!0,delay:l=0,handleClose:u=null,mouseOnly:d=!1,restMs:f=0,move:p=!0}=t,m=q(),h=K(),g=B(u),_=B(l),y=B(n),b=B(f),x=v.useRef(),S=v.useRef(-1),C=v.useRef(),w=v.useRef(-1),T=v.useRef(!0),E=v.useRef(!1),D=v.useRef(()=>{}),k=v.useRef(!1),A=H(()=>{let e=i.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`});v.useEffect(()=>{if(!c)return;function e(e){let{open:t}=e;t||(Y(S),Y(w),T.current=!0,k.current=!1)}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[c,a]),v.useEffect(()=>{if(!c||!g.current||!n)return;function e(e){A()&&r(!1,e,`hover`)}let t=M(s.floating).documentElement;return t.addEventListener(`mouseleave`,e),()=>{t.removeEventListener(`mouseleave`,e)}},[s.floating,n,r,c,g,A]);let j=v.useCallback(function(e,t,n){t===void 0&&(t=!0),n===void 0&&(n=`hover`);let i=X(_.current,`close`,x.current);i&&!C.current?(Y(S),S.current=window.setTimeout(()=>r(!1,e,n),i)):t&&(Y(S),r(!1,e,n))},[_,r]),N=H(()=>{D.current(),C.current=void 0}),P=H(()=>{if(E.current){let e=M(s.floating).body;e.style.pointerEvents=``,e.removeAttribute(De),E.current=!1}}),F=H(()=>i.current.openEvent?[`click`,`mousedown`].includes(i.current.openEvent.type):!1);v.useEffect(()=>{if(!c)return;function e(e){if(Y(S),T.current=!1,d&&!L(x.current)||Z(b.current)>0&&!X(_.current,`open`))return;let t=X(_.current,`open`,x.current);t?S.current=window.setTimeout(()=>{y.current||r(!0,e,`hover`)},t):n||r(!0,e,`hover`)}function t(e){if(F()){P();return}D.current();let t=M(s.floating);if(Y(w),k.current=!1,g.current&&i.current.floatingContext){n||Y(S),C.current=g.current({...i.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){P(),N(),F()||j(e,!0,`safe-polygon`)}});let r=C.current;t.addEventListener(`mousemove`,r),D.current=()=>{t.removeEventListener(`mousemove`,r)};return}(x.current!==`touch`||!O(s.floating,e.relatedTarget))&&j(e)}function a(e){F()||i.current.floatingContext&&(g.current==null||g.current({...i.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){P(),N(),F()||j(e)}})(e))}function l(){Y(S)}function u(e){F()||j(e,!1)}if(o(s.domReference)){let r=s.domReference,i=s.floating;return n&&r.addEventListener(`mouseleave`,a),p&&r.addEventListener(`mousemove`,e,{once:!0}),r.addEventListener(`mouseenter`,e),r.addEventListener(`mouseleave`,t),i&&(i.addEventListener(`mouseleave`,a),i.addEventListener(`mouseenter`,l),i.addEventListener(`mouseleave`,u)),()=>{n&&r.removeEventListener(`mouseleave`,a),p&&r.removeEventListener(`mousemove`,e),r.removeEventListener(`mouseenter`,e),r.removeEventListener(`mouseleave`,t),i&&(i.removeEventListener(`mouseleave`,a),i.removeEventListener(`mouseenter`,l),i.removeEventListener(`mouseleave`,u))}}},[s,c,e,d,p,j,N,P,r,n,y,m,_,g,i,F,b]),R(()=>{var e;if(c&&n&&(e=g.current)!=null&&(e=e.__options)!=null&&e.blockPointerEvents&&A()){E.current=!0;let e=s.floating;if(o(s.domReference)&&e){var t;let n=M(s.floating).body;n.setAttribute(De,``);let r=s.domReference,i=m==null||(t=m.nodesRef.current.find(e=>e.id===h))==null||(t=t.context)==null?void 0:t.elements.floating;return i&&(i.style.pointerEvents=``),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,e.style.pointerEvents=`auto`,()=>{n.style.pointerEvents=``,r.style.pointerEvents=``,e.style.pointerEvents=``}}}},[c,n,h,s,m,g,A]),R(()=>{n||(x.current=void 0,k.current=!1,N(),P())},[n,N,P]),v.useEffect(()=>()=>{N(),Y(S),Y(w),P()},[c,s.domReference,N,P]);let I=v.useMemo(()=>{function e(e){x.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e;function i(){!T.current&&!y.current&&r(!0,t,`hover`)}d&&!L(x.current)||n||Z(b.current)===0||k.current&&e.movementX**2+e.movementY**2<2||(Y(w),x.current===`touch`?i():(k.current=!0,w.current=window.setTimeout(i,Z(b.current))))}}},[d,r,n,y,b]);return v.useMemo(()=>c?{reference:I}:{},[c,I])}const Q=()=>{},ke=v.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:Q,setState:Q,isInstantPhase:!1}),Ae=()=>v.useContext(ke);function je(e){let{children:t,delay:n,timeoutMs:r=0}=e,[i,a]=v.useReducer((e,t)=>({...e,...t}),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),o=v.useRef(null),s=v.useCallback(e=>{a({currentId:e})},[]);return R(()=>{i.currentId?o.current===null?o.current=i.currentId:i.isInstantPhase||a({isInstantPhase:!0}):(i.isInstantPhase&&a({isInstantPhase:!1}),o.current=null)},[i.currentId,i.isInstantPhase]),b(ke.Provider,{value:v.useMemo(()=>({...i,setState:a,setCurrentId:s}),[i,s]),children:t})}function Me(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,floatingId:i}=e,{id:a,enabled:o=!0}=t,s=a??i,c=Ae(),{currentId:l,setCurrentId:u,initialDelay:d,setState:f,timeoutMs:p}=c;return R(()=>{o&&l&&(f({delay:{open:1,close:X(d,`close`)}}),l!==s&&r(!1))},[o,s,r,f,l,d]),R(()=>{function e(){r(!1),f({delay:d,currentId:null})}if(o&&l&&!n&&l===s){if(p){let t=window.setTimeout(e,p);return()=>{clearTimeout(t)}}e()}},[o,n,f,l,s,r,d,p]),R(()=>{o&&(u===Q||!n||u(s))},[o,n,u,s]),c}function $(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&_(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Ne(e){return`composedPath`in e?e.composedPath()[0]:e.target}const Pe={pointerdown:`onPointerDown`,mousedown:`onMouseDown`,click:`onClick`},Fe={pointerdown:`onPointerDownCapture`,mousedown:`onMouseDownCapture`,click:`onClickCapture`},Ie=e=>({escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0});function Le(t,r){r===void 0&&(r={});let{open:i,onOpenChange:s,elements:c,dataRef:l}=t,{enabled:d=!0,escapeKey:p=!0,outsidePress:m=!0,outsidePressEvent:h=`pointerdown`,referencePress:_=!1,referencePressEvent:y=`pointerdown`,ancestorScroll:b=!1,bubbles:x,capture:S}=r,C=q(),w=H(typeof m==`function`?m:()=>!1),T=typeof m==`function`?w:m,E=v.useRef(!1),{escapeKey:D,outsidePress:N}=Ie(x),{escapeKey:P,outsidePress:F}=Ie(S),L=v.useRef(!1),R=H(e=>{if(!i||!d||!p||e.key!==`Escape`||L.current)return;let t=l.current.floatingContext?.nodeId,n=C?I(C.nodesRef.current,t):[];if(!D&&(e.stopPropagation(),n.length>0)){let e=!0;if(n.forEach(t=>{var n;if((n=t.context)!=null&&n.open&&!t.context.dataRef.current.__escapeKeyBubbles){e=!1;return}}),!e)return}s(!1,ee(e)?e.nativeEvent:e,`escape-key`)}),z=H(e=>{var t;let n=()=>{var t;R(e),(t=k(e))==null||t.removeEventListener(`keydown`,n)};(t=k(e))==null||t.addEventListener(`keydown`,n)}),B=H(t=>{let n=l.current.insideReactTree;l.current.insideReactTree=!1;let r=E.current;if(E.current=!1,h===`click`&&r||n||typeof T==`function`&&!T(t))return;let i=k(t),d=`[`+J(`inert`)+`]`,f=M(c.floating).querySelectorAll(d),p=o(i)?i:null;for(;p&&!g(p);){let e=u(p);if(g(e)||!o(e))break;p=e}if(f.length&&o(i)&&!j(i)&&!O(i,c.floating)&&Array.from(f).every(e=>!O(p,e)))return;if(e(i)&&W){let e=g(i),n=a(i),r=/auto|scroll/,o=e||r.test(n.overflowX),s=e||r.test(n.overflowY),c=o&&i.clientWidth>0&&i.scrollWidth>i.clientWidth,l=s&&i.clientHeight>0&&i.scrollHeight>i.clientHeight,u=n.direction===`rtl`,d=l&&(u?t.offsetX<=i.offsetWidth-i.clientWidth:t.offsetX>i.clientWidth),f=c&&t.offsetY>i.clientHeight;if(d||f)return}let m=l.current.floatingContext?.nodeId,_=C&&I(C.nodesRef.current,m).some(e=>A(t,e.context?.elements.floating));if(A(t,c.floating)||A(t,c.domReference)||_)return;let v=C?I(C.nodesRef.current,m):[];if(v.length>0){let e=!0;if(v.forEach(t=>{var n;if((n=t.context)!=null&&n.open&&!t.context.dataRef.current.__outsidePressBubbles){e=!1;return}}),!e)return}s(!1,t,`outside-press`)}),V=H(e=>{var t;let n=()=>{var t;B(e),(t=k(e))==null||t.removeEventListener(h,n)};(t=k(e))==null||t.addEventListener(h,n)});v.useEffect(()=>{if(!i||!d)return;l.current.__escapeKeyBubbles=D,l.current.__outsidePressBubbles=N;let e=-1;function t(e){s(!1,e,`ancestor-scroll`)}function r(){window.clearTimeout(e),L.current=!0}function a(){e=window.setTimeout(()=>{L.current=!1},n()?5:0)}let u=M(c.floating);p&&(u.addEventListener(`keydown`,P?z:R,P),u.addEventListener(`compositionstart`,r),u.addEventListener(`compositionend`,a)),T&&u.addEventListener(h,F?V:B,F);let m=[];return b&&(o(c.domReference)&&(m=f(c.domReference)),o(c.floating)&&(m=m.concat(f(c.floating))),!o(c.reference)&&c.reference&&c.reference.contextElement&&(m=m.concat(f(c.reference.contextElement)))),m=m.filter(e=>e!==u.defaultView?.visualViewport),m.forEach(e=>{e.addEventListener(`scroll`,t,{passive:!0})}),()=>{p&&(u.removeEventListener(`keydown`,P?z:R,P),u.removeEventListener(`compositionstart`,r),u.removeEventListener(`compositionend`,a)),T&&u.removeEventListener(h,F?V:B,F),m.forEach(e=>{e.removeEventListener(`scroll`,t)}),window.clearTimeout(e)}},[l,c,p,T,h,i,s,b,d,D,N,R,P,z,B,F,V]),v.useEffect(()=>{l.current.insideReactTree=!1},[l,T,h]);let U=v.useMemo(()=>({onKeyDown:R,..._&&{[Pe[y]]:e=>{s(!1,e.nativeEvent,`reference-press`)},...y!==`click`&&{onClick(e){s(!1,e.nativeEvent,`reference-press`)}}}}),[R,s,_,y]),W=v.useMemo(()=>{function e(e){e.button===0&&(E.current=!0)}return{onKeyDown:R,onMouseDown:e,onMouseUp:e,[Fe[h]]:()=>{l.current.insideReactTree=!0}}},[R,h,l]);return v.useMemo(()=>d?{reference:U,floating:W}:{},[d,U,W])}function Re(e){let{open:t=!1,onOpenChange:n,elements:r}=e,i=Ce(),a=v.useRef({}),[o]=v.useState(()=>we()),s=K()!=null,[c,l]=v.useState(r.reference),u=H((e,t,r)=>{a.current.openEvent=e?t:void 0,o.emit(`openchange`,{open:e,event:t,reason:r,nested:s}),n?.(e,t,r)}),d=v.useMemo(()=>({setPositionReference:l}),[]),f=v.useMemo(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);return v.useMemo(()=>({dataRef:a,open:t,onOpenChange:u,elements:f,events:o,floatingId:i,refs:d}),[t,u,f,o,i,d])}function ze(e){e===void 0&&(e={});let{nodeId:t}=e,n=Re({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,i=r.elements,[a,s]=v.useState(null),[c,l]=v.useState(null),u=i?.domReference||a,d=v.useRef(null),f=q();R(()=>{u&&(d.current=u)},[u]);let p=re({...e,elements:{...i,...c&&{reference:c}}}),m=v.useCallback(e=>{let t=o(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;l(t),p.refs.setReference(t)},[p.refs]),h=v.useCallback(e=>{(o(e)||e===null)&&(d.current=e,s(e)),(o(p.refs.reference.current)||p.refs.reference.current===null||e!==null&&!o(e))&&p.refs.setReference(e)},[p.refs]),g=v.useMemo(()=>({...p.refs,setReference:h,setPositionReference:m,domReference:d}),[p.refs,h,m]),_=v.useMemo(()=>({...p.elements,domReference:u}),[p.elements,u]),y=v.useMemo(()=>({...p,...r,refs:g,elements:_,nodeId:t}),[p,g,_,t,r]);return R(()=>{r.dataRef.current.floatingContext=y;let e=f?.nodesRef.current.find(e=>e.id===t);e&&(e.context=y)}),v.useMemo(()=>({...p,context:y,refs:g,elements:_}),[p,g,_,y])}function Be(){return T()&&w()}function Ve(t,n){n===void 0&&(n={});let{open:r,onOpenChange:i,events:a,dataRef:c,elements:l}=t,{enabled:u=!0,visibleOnly:d=!0}=n,f=v.useRef(!1),p=v.useRef(-1),m=v.useRef(!0);v.useEffect(()=>{if(!u)return;let t=s(l.domReference);function n(){!r&&e(l.domReference)&&l.domReference===D(M(l.domReference))&&(f.current=!0)}function i(){m.current=!0}function a(){m.current=!1}return t.addEventListener(`blur`,n),Be()&&(t.addEventListener(`keydown`,i,!0),t.addEventListener(`pointerdown`,a,!0)),()=>{t.removeEventListener(`blur`,n),Be()&&(t.removeEventListener(`keydown`,i,!0),t.removeEventListener(`pointerdown`,a,!0))}},[l.domReference,r,u]),v.useEffect(()=>{if(!u)return;function e(e){let{reason:t}=e;(t===`reference-press`||t===`escape-key`)&&(f.current=!0)}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,u]),v.useEffect(()=>()=>{Y(p)},[]);let h=v.useMemo(()=>({onMouseLeave(){f.current=!1},onFocus(e){if(f.current)return;let t=k(e.nativeEvent);if(d&&o(t)){if(Be()&&!e.relatedTarget){if(!m.current&&!N(t))return}else if(!P(t))return}i(!0,e.nativeEvent,`focus`)},onBlur(e){f.current=!1;let t=e.relatedTarget,n=e.nativeEvent,r=o(t)&&t.hasAttribute(J(`focus-guard`))&&t.getAttribute(`data-type`)===`outside`;p.current=window.setTimeout(()=>{let e=D(l.domReference?l.domReference.ownerDocument:document);!t&&e===l.domReference||O(c.current.floatingContext?.refs.floating.current,e)||O(l.domReference,e)||r||i(!1,n,`focus`)})}}),[c,l.domReference,i,d]);return v.useMemo(()=>u?{reference:h}:{},[u,h])}function He(e,t,n){let r=new Map,i=n===`item`,a=e;if(i&&e){let{[me]:t,[he]:n,...r}=e;a=r}return{...n===`floating`&&{tabIndex:-1,"data-floating-ui-focusable":``},...a,...t.map(t=>{let r=t?t[n]:null;return typeof r==`function`?e?r(e):null:r}).concat(e).reduce((e,t)=>(t&&Object.entries(t).forEach(t=>{let[n,a]=t;if(!(i&&[me,he].includes(n)))if(n.indexOf(`on`)===0){if(r.has(n)||r.set(n,[]),typeof a==`function`){var o;(o=r.get(n))==null||o.push(a),e[n]=function(){var e=[...arguments];return r.get(n)?.map(t=>t(...e)).find(e=>e!==void 0)}}}else e[n]=a}),e),{})}}function Ue(e){e===void 0&&(e=[]);let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=v.useCallback(t=>He(t,e,`reference`),t),a=v.useCallback(t=>He(t,e,`floating`),n),o=v.useCallback(t=>He(t,e,`item`),r);return v.useMemo(()=>({getReferenceProps:i,getFloatingProps:a,getItemProps:o}),[i,a,o])}const We=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function Ge(e,t){t===void 0&&(t={});let{open:n,elements:r,floatingId:i}=e,{enabled:a=!0,role:o=`dialog`}=t,s=Ce(),c=r.domReference?.id||s,l=v.useMemo(()=>F(r.floating)?.id||i,[r.floating,i]),u=We.get(o)??o,d=K()!=null,f=v.useMemo(()=>u===`tooltip`||o===`label`?{[`aria-`+(o===`label`?`labelledby`:`describedby`)]:n?l:void 0}:{"aria-expanded":n?`true`:`false`,"aria-haspopup":u===`alertdialog`?`dialog`:u,"aria-controls":n?l:void 0,...u===`listbox`&&{role:`combobox`},...u===`menu`&&{id:c},...u===`menu`&&d&&{role:`menuitem`},...o===`select`&&{"aria-autocomplete":`none`},...o===`combobox`&&{"aria-autocomplete":`list`}},[u,l,d,n,c,o]),p=v.useMemo(()=>{let e={id:l,...u&&{role:u}};return u===`tooltip`||o===`label`?e:{...e,...u===`menu`&&{"aria-labelledby":c}}},[u,l,c,o]),m=v.useCallback(e=>{let{active:t,selected:n}=e,r={role:`option`,...t&&{id:l+`-fui-option`}};switch(o){case`select`:case`combobox`:return{...r,"aria-selected":n}}return{}},[l,o]);return v.useMemo(()=>a?{reference:f,floating:p,item:m}:{},[a,f,p,m])}function Ke(e,t,n){return n===void 0&&(n=!0),e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...Ke(e,t.id,n)])}function qe(e,t){let[n,r]=e,i=!1,a=t.length;for(let e=0,o=a-1;e<a;o=e++){let[a,s]=t[e]||[0,0],[c,l]=t[o]||[0,0];s>=r!=l>=r&&n<=(c-a)*(r-s)/(l-s)+a&&(i=!i)}return i}function Je(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function Ye(e){e===void 0&&(e={});let{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,i={current:-1},a=!1,s=null,c=null,l=typeof performance<`u`?performance.now():0;function u(e,t){let n=performance.now(),r=n-l;if(s===null||c===null||r===0)return s=e,c=t,l=n,null;let i=e-s,a=t-c,o=Math.sqrt(i*i+a*a)/r;return s=e,c=t,l=n,o}let d=e=>{let{x:n,y:s,placement:c,elements:l,onClose:d,nodeId:f,tree:p}=e;return function(e){function m(){Y(i),d()}if(Y(i),!l.domReference||!l.floating||c==null||n==null||s==null)return;let{clientX:h,clientY:g}=e,_=[h,g],v=Ne(e),y=e.type===`mouseleave`,b=$(l.floating,v),x=$(l.domReference,v),S=l.domReference.getBoundingClientRect(),C=l.floating.getBoundingClientRect(),w=c.split(`-`)[0],T=n>C.right-C.width/2,E=s>C.bottom-C.height/2,D=Je(_,S),O=C.width>S.width,k=C.height>S.height,A=(O?S:C).left,j=(O?S:C).right,M=(k?S:C).top,N=(k?S:C).bottom;if(b&&(a=!0,!y))return;if(x&&(a=!1),x&&!y){a=!0;return}if(y&&o(e.relatedTarget)&&$(l.floating,e.relatedTarget)||p&&Ke(p.nodesRef.current,f).length)return;if(w===`top`&&s>=S.bottom-1||w===`bottom`&&s<=S.top+1||w===`left`&&n>=S.right-1||w===`right`&&n<=S.left+1)return m();let P=[];switch(w){case`top`:P=[[A,S.top+1],[A,C.bottom-1],[j,C.bottom-1],[j,S.top+1]];break;case`bottom`:P=[[A,C.top+1],[A,S.bottom-1],[j,S.bottom-1],[j,C.top+1]];break;case`left`:P=[[C.right-1,N],[C.right-1,M],[S.left+1,M],[S.left+1,N]];break;case`right`:P=[[S.right-1,N],[S.right-1,M],[C.left+1,M],[C.left+1,N]];break}function F(e){let[n,r]=e;switch(w){case`top`:return[[O?n+t/2:T?n+t*4:n-t*4,r+t+1],[O?n-t/2:T?n+t*4:n-t*4,r+t+1],[C.left,T||O?C.bottom-t:C.top],[C.right,T?O?C.bottom-t:C.top:C.bottom-t]];case`bottom`:return[[O?n+t/2:T?n+t*4:n-t*4,r-t],[O?n-t/2:T?n+t*4:n-t*4,r-t],[C.left,T||O?C.top+t:C.bottom],[C.right,T?O?C.top+t:C.bottom:C.top+t]];case`left`:{let e=[n+t+1,k?r+t/2:E?r+t*4:r-t*4],i=[n+t+1,k?r-t/2:E?r+t*4:r-t*4];return[[E||k?C.right-t:C.left,C.top],[E?k?C.right-t:C.left:C.right-t,C.bottom],e,i]}case`right`:return[[n-t,k?r+t/2:E?r+t*4:r-t*4],[n-t,k?r-t/2:E?r+t*4:r-t*4],[E||k?C.left+t:C.right,C.top],[E?k?C.left+t:C.right:C.left+t,C.bottom]]}}if(!qe([h,g],P)){if(a&&!D)return m();if(!y&&r){let t=u(e.clientX,e.clientY);if(t!==null&&t<.1)return m()}qe([h,g],F([n,s]))?!a&&r&&(i.current=window.setTimeout(m,40)):m()}}};return d.__options={blockPointerEvents:n},d}export{oe as _,ze as a,Ue as c,fe as d,ce as f,ae as g,se as h,Le as i,pe as l,de as m,Ye as n,Ve as o,ue as p,Me as r,Oe as s,je as t,Ge as u,le as v};
|