@mcp-graph-workflow/mcp-graph 5.32.0 → 5.34.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/dist/api/router.d.ts.map +1 -1
- package/dist/api/router.js +2 -0
- package/dist/api/router.js.map +1 -1
- package/dist/api/routes/code-graph.d.ts.map +1 -1
- package/dist/api/routes/code-graph.js +3 -1
- package/dist/api/routes/code-graph.js.map +1 -1
- package/dist/api/routes/davinci.d.ts +3 -0
- package/dist/api/routes/davinci.d.ts.map +1 -0
- package/dist/api/routes/davinci.js +188 -0
- package/dist/api/routes/davinci.js.map +1 -0
- package/dist/core/analyzer/ac-coverage.d.ts +16 -0
- package/dist/core/analyzer/ac-coverage.d.ts.map +1 -0
- package/dist/core/analyzer/ac-coverage.js +38 -0
- package/dist/core/analyzer/ac-coverage.js.map +1 -0
- package/dist/core/analyzer/asset-blockers.d.ts +23 -0
- package/dist/core/analyzer/asset-blockers.d.ts.map +1 -0
- package/dist/core/analyzer/asset-blockers.js +50 -0
- package/dist/core/analyzer/asset-blockers.js.map +1 -0
- package/dist/core/analyzer/concurrency-risk.d.ts +26 -0
- package/dist/core/analyzer/concurrency-risk.d.ts.map +1 -0
- package/dist/core/analyzer/concurrency-risk.js +99 -0
- package/dist/core/analyzer/concurrency-risk.js.map +1 -0
- package/dist/core/analyzer/config-coverage.d.ts +20 -0
- package/dist/core/analyzer/config-coverage.d.ts.map +1 -0
- package/dist/core/analyzer/config-coverage.js +49 -0
- package/dist/core/analyzer/config-coverage.js.map +1 -0
- package/dist/core/analyzer/contract-coverage.d.ts +22 -0
- package/dist/core/analyzer/contract-coverage.d.ts.map +1 -0
- package/dist/core/analyzer/contract-coverage.js +51 -0
- package/dist/core/analyzer/contract-coverage.js.map +1 -0
- package/dist/core/analyzer/data-integrity.d.ts +22 -0
- package/dist/core/analyzer/data-integrity.d.ts.map +1 -0
- package/dist/core/analyzer/data-integrity.js +80 -0
- package/dist/core/analyzer/data-integrity.js.map +1 -0
- package/dist/core/analyzer/economy-simulator.d.ts +33 -0
- package/dist/core/analyzer/economy-simulator.d.ts.map +1 -0
- package/dist/core/analyzer/economy-simulator.js +162 -0
- package/dist/core/analyzer/economy-simulator.js.map +1 -0
- package/dist/core/analyzer/formula-consistency.d.ts +25 -0
- package/dist/core/analyzer/formula-consistency.d.ts.map +1 -0
- package/dist/core/analyzer/formula-consistency.js +82 -0
- package/dist/core/analyzer/formula-consistency.js.map +1 -0
- package/dist/core/analyzer/metric-coverage.d.ts +22 -0
- package/dist/core/analyzer/metric-coverage.d.ts.map +1 -0
- package/dist/core/analyzer/metric-coverage.js +52 -0
- package/dist/core/analyzer/metric-coverage.js.map +1 -0
- package/dist/core/analyzer/performance-budget-check.d.ts +22 -0
- package/dist/core/analyzer/performance-budget-check.d.ts.map +1 -0
- package/dist/core/analyzer/performance-budget-check.js +40 -0
- package/dist/core/analyzer/performance-budget-check.js.map +1 -0
- package/dist/core/analyzer/risk-assessment.d.ts.map +1 -1
- package/dist/core/analyzer/risk-assessment.js +9 -0
- package/dist/core/analyzer/risk-assessment.js.map +1 -1
- package/dist/core/analyzer/scenario-coverage.d.ts +19 -0
- package/dist/core/analyzer/scenario-coverage.d.ts.map +1 -0
- package/dist/core/analyzer/scenario-coverage.js +59 -0
- package/dist/core/analyzer/scenario-coverage.js.map +1 -0
- package/dist/core/analyzer/state-completeness.d.ts +22 -0
- package/dist/core/analyzer/state-completeness.d.ts.map +1 -0
- package/dist/core/analyzer/state-completeness.js +76 -0
- package/dist/core/analyzer/state-completeness.js.map +1 -0
- package/dist/core/code/code-indexer.d.ts +1 -1
- package/dist/core/code/code-indexer.d.ts.map +1 -1
- package/dist/core/code/code-indexer.js +50 -3
- package/dist/core/code/code-indexer.js.map +1 -1
- package/dist/core/code/code-store.js +3 -3
- package/dist/core/code/code-store.js.map +1 -1
- package/dist/core/code/code-types.d.ts +4 -4
- package/dist/core/code/treesitter/treesitter-manager.d.ts.map +1 -1
- package/dist/core/code/treesitter/treesitter-manager.js +2 -0
- package/dist/core/code/treesitter/treesitter-manager.js.map +1 -1
- package/dist/core/davinci/build-runner.d.ts +37 -0
- package/dist/core/davinci/build-runner.d.ts.map +1 -0
- package/dist/core/davinci/build-runner.js +239 -0
- package/dist/core/davinci/build-runner.js.map +1 -0
- package/dist/core/davinci/davinci-parser.d.ts +6 -0
- package/dist/core/davinci/davinci-parser.d.ts.map +1 -0
- package/dist/core/davinci/davinci-parser.js +218 -0
- package/dist/core/davinci/davinci-parser.js.map +1 -0
- package/dist/core/davinci/davinci-store.d.ts +49 -0
- package/dist/core/davinci/davinci-store.d.ts.map +1 -0
- package/dist/core/davinci/davinci-store.js +121 -0
- package/dist/core/davinci/davinci-store.js.map +1 -0
- package/dist/core/davinci/davinci-types.d.ts +241 -0
- package/dist/core/davinci/davinci-types.d.ts.map +1 -0
- package/dist/core/davinci/davinci-types.js +123 -0
- package/dist/core/davinci/davinci-types.js.map +1 -0
- package/dist/core/davinci/davinci-validators.d.ts +16 -0
- package/dist/core/davinci/davinci-validators.d.ts.map +1 -0
- package/dist/core/davinci/davinci-validators.js +86 -0
- package/dist/core/davinci/davinci-validators.js.map +1 -0
- package/dist/core/davinci/descriptor-generator.d.ts +19 -0
- package/dist/core/davinci/descriptor-generator.d.ts.map +1 -0
- package/dist/core/davinci/descriptor-generator.js +52 -0
- package/dist/core/davinci/descriptor-generator.js.map +1 -0
- package/dist/core/davinci/plugin-generator.d.ts +29 -0
- package/dist/core/davinci/plugin-generator.d.ts.map +1 -0
- package/dist/core/davinci/plugin-generator.js +86 -0
- package/dist/core/davinci/plugin-generator.js.map +1 -0
- package/dist/core/davinci/plugin-type-detector.d.ts +15 -0
- package/dist/core/davinci/plugin-type-detector.d.ts.map +1 -0
- package/dist/core/davinci/plugin-type-detector.js +114 -0
- package/dist/core/davinci/plugin-type-detector.js.map +1 -0
- package/dist/core/davinci/pom-generator.d.ts +4 -0
- package/dist/core/davinci/pom-generator.d.ts.map +1 -0
- package/dist/core/davinci/pom-generator.js +179 -0
- package/dist/core/davinci/pom-generator.js.map +1 -0
- package/dist/core/davinci/template-registry.d.ts +25 -0
- package/dist/core/davinci/template-registry.d.ts.map +1 -0
- package/dist/core/davinci/template-registry.js +280 -0
- package/dist/core/davinci/template-registry.js.map +1 -0
- package/dist/core/davinci/variable-resolver.d.ts +9 -0
- package/dist/core/davinci/variable-resolver.d.ts.map +1 -0
- package/dist/core/davinci/variable-resolver.js +62 -0
- package/dist/core/davinci/variable-resolver.js.map +1 -0
- package/dist/core/designer/adr-validator.d.ts.map +1 -1
- package/dist/core/designer/adr-validator.js +12 -4
- package/dist/core/designer/adr-validator.js.map +1 -1
- package/dist/core/designer/tech-risk-assessor.d.ts +5 -1
- package/dist/core/designer/tech-risk-assessor.d.ts.map +1 -1
- package/dist/core/designer/tech-risk-assessor.js +39 -11
- package/dist/core/designer/tech-risk-assessor.js.map +1 -1
- package/dist/core/designer/traceability-matrix.d.ts.map +1 -1
- package/dist/core/designer/traceability-matrix.js +14 -3
- package/dist/core/designer/traceability-matrix.js.map +1 -1
- package/dist/core/graph/auto-sequence.d.ts +10 -0
- package/dist/core/graph/auto-sequence.d.ts.map +1 -0
- package/dist/core/graph/auto-sequence.js +29 -0
- package/dist/core/graph/auto-sequence.js.map +1 -0
- package/dist/core/graph/csv-export.d.ts +7 -0
- package/dist/core/graph/csv-export.d.ts.map +1 -0
- package/dist/core/graph/csv-export.js +43 -0
- package/dist/core/graph/csv-export.js.map +1 -0
- package/dist/core/graph/graph-types.d.ts +2 -2
- package/dist/core/graph/graph-types.d.ts.map +1 -1
- package/dist/core/graph/mermaid-export.d.ts +1 -1
- package/dist/core/graph/mermaid-export.d.ts.map +1 -1
- package/dist/core/graph/mermaid-export.js +101 -0
- package/dist/core/graph/mermaid-export.js.map +1 -1
- package/dist/core/importer/prd-to-graph.d.ts.map +1 -1
- package/dist/core/importer/prd-to-graph.js +8 -1
- package/dist/core/importer/prd-to-graph.js.map +1 -1
- package/dist/core/listener/backlog-health.d.ts.map +1 -1
- package/dist/core/listener/backlog-health.js +15 -3
- package/dist/core/listener/backlog-health.js.map +1 -1
- package/dist/core/parser/classify.d.ts +4 -0
- package/dist/core/parser/classify.d.ts.map +1 -1
- package/dist/core/parser/classify.js +18 -0
- package/dist/core/parser/classify.js.map +1 -1
- package/dist/core/parser/extract.d.ts.map +1 -1
- package/dist/core/parser/extract.js +22 -4
- package/dist/core/parser/extract.js.map +1 -1
- package/dist/core/parser/prd-diff.d.ts +23 -0
- package/dist/core/parser/prd-diff.d.ts.map +1 -0
- package/dist/core/parser/prd-diff.js +55 -0
- package/dist/core/parser/prd-diff.js.map +1 -0
- package/dist/core/parser/read-swagger.d.ts.map +1 -1
- package/dist/core/parser/read-swagger.js +6 -0
- package/dist/core/parser/read-swagger.js.map +1 -1
- package/dist/core/parser/segment.d.ts +5 -0
- package/dist/core/parser/segment.d.ts.map +1 -1
- package/dist/core/parser/segment.js +70 -0
- package/dist/core/parser/segment.js.map +1 -1
- package/dist/core/planner/auto-ready.d.ts +19 -0
- package/dist/core/planner/auto-ready.d.ts.map +1 -0
- package/dist/core/planner/auto-ready.js +39 -0
- package/dist/core/planner/auto-ready.js.map +1 -0
- package/dist/core/planner/planning-report.d.ts +13 -1
- package/dist/core/planner/planning-report.d.ts.map +1 -1
- package/dist/core/planner/planning-report.js +53 -2
- package/dist/core/planner/planning-report.js.map +1 -1
- package/dist/core/planner/sprint-health.d.ts +22 -0
- package/dist/core/planner/sprint-health.d.ts.map +1 -0
- package/dist/core/planner/sprint-health.js +41 -0
- package/dist/core/planner/sprint-health.js.map +1 -0
- package/dist/core/siebel/sif-parser.d.ts.map +1 -1
- package/dist/core/siebel/sif-parser.js +6 -0
- package/dist/core/siebel/sif-parser.js.map +1 -1
- package/dist/core/siebel/wsdl-parser.d.ts.map +1 -1
- package/dist/core/siebel/wsdl-parser.js +6 -0
- package/dist/core/siebel/wsdl-parser.js.map +1 -1
- package/dist/core/store/migrations.d.ts.map +1 -1
- package/dist/core/store/migrations.js +17 -0
- package/dist/core/store/migrations.js.map +1 -1
- package/dist/core/store/sqlite-store.d.ts +6 -0
- package/dist/core/store/sqlite-store.d.ts.map +1 -1
- package/dist/core/store/sqlite-store.js +54 -3
- package/dist/core/store/sqlite-store.js.map +1 -1
- package/dist/core/templates/template-engine.d.ts +36 -0
- package/dist/core/templates/template-engine.d.ts.map +1 -0
- package/dist/core/templates/template-engine.js +104 -0
- package/dist/core/templates/template-engine.js.map +1 -0
- package/dist/core/translation/generators/universal-generator.d.ts.map +1 -1
- package/dist/core/translation/generators/universal-generator.js +187 -9
- package/dist/core/translation/generators/universal-generator.js.map +1 -1
- package/dist/core/translation/language-detect.d.ts.map +1 -1
- package/dist/core/translation/language-detect.js +37 -14
- package/dist/core/translation/language-detect.js.map +1 -1
- package/dist/docs-manifest.json +68 -5
- package/dist/mcp/app-factory.js +1 -1
- package/dist/mcp/app-factory.js.map +1 -1
- package/dist/mcp/tools/analyze.d.ts.map +1 -1
- package/dist/mcp/tools/analyze.js +100 -1
- package/dist/mcp/tools/analyze.js.map +1 -1
- package/dist/mcp/tools/davinci-analyze.d.ts +4 -0
- package/dist/mcp/tools/davinci-analyze.d.ts.map +1 -0
- package/dist/mcp/tools/davinci-analyze.js +31 -0
- package/dist/mcp/tools/davinci-analyze.js.map +1 -0
- package/dist/mcp/tools/davinci-build.d.ts +4 -0
- package/dist/mcp/tools/davinci-build.d.ts.map +1 -0
- package/dist/mcp/tools/davinci-build.js +43 -0
- package/dist/mcp/tools/davinci-build.js.map +1 -0
- package/dist/mcp/tools/davinci-convert.d.ts +4 -0
- package/dist/mcp/tools/davinci-convert.d.ts.map +1 -0
- package/dist/mcp/tools/davinci-convert.js +61 -0
- package/dist/mcp/tools/davinci-convert.js.map +1 -0
- package/dist/mcp/tools/edge.d.ts.map +1 -1
- package/dist/mcp/tools/edge.js +81 -3
- package/dist/mcp/tools/edge.js.map +1 -1
- package/dist/mcp/tools/export.d.ts.map +1 -1
- package/dist/mcp/tools/export.js +17 -4
- package/dist/mcp/tools/export.js.map +1 -1
- package/dist/mcp/tools/import-prd.d.ts.map +1 -1
- package/dist/mcp/tools/import-prd.js +89 -2
- package/dist/mcp/tools/import-prd.js.map +1 -1
- package/dist/mcp/tools/index.d.ts.map +1 -1
- package/dist/mcp/tools/index.js +12 -0
- package/dist/mcp/tools/index.js.map +1 -1
- package/dist/mcp/tools/node.d.ts.map +1 -1
- package/dist/mcp/tools/node.js +127 -6
- package/dist/mcp/tools/node.js.map +1 -1
- package/dist/mcp/tools/plan-sprint.d.ts.map +1 -1
- package/dist/mcp/tools/plan-sprint.js +6 -2
- package/dist/mcp/tools/plan-sprint.js.map +1 -1
- package/dist/mcp/tools/show.d.ts.map +1 -1
- package/dist/mcp/tools/show.js +11 -4
- package/dist/mcp/tools/show.js.map +1 -1
- package/dist/mcp/tools/template.d.ts +4 -0
- package/dist/mcp/tools/template.d.ts.map +1 -0
- package/dist/mcp/tools/template.js +137 -0
- package/dist/mcp/tools/template.js.map +1 -0
- package/dist/schemas/analyzer-schema.d.ts +2 -2
- package/dist/schemas/designer-schema.d.ts +21 -0
- package/dist/schemas/designer-schema.d.ts.map +1 -1
- package/dist/schemas/designer-schema.js +2 -0
- package/dist/schemas/designer-schema.js.map +1 -1
- package/dist/schemas/edge.schema.d.ts +6 -0
- package/dist/schemas/edge.schema.d.ts.map +1 -1
- package/dist/schemas/edge.schema.js +2 -0
- package/dist/schemas/edge.schema.js.map +1 -1
- package/dist/schemas/graph.schema.d.ts +13 -0
- package/dist/schemas/graph.schema.d.ts.map +1 -1
- package/dist/schemas/node.schema.d.ts +20 -0
- package/dist/schemas/node.schema.d.ts.map +1 -1
- package/dist/schemas/node.schema.js +3 -0
- package/dist/schemas/node.schema.js.map +1 -1
- package/dist/schemas/siebel.schema.d.ts +13 -13
- package/dist/web/dashboard/dist/assets/{benchmark-tab-en-UkR66.js → benchmark-tab-Aqr2Xzu5.js} +1 -1
- package/dist/web/dashboard/dist/assets/{circle-alert-5GIBBP3L.js → circle-alert-BJTyaShp.js} +1 -1
- package/dist/web/dashboard/dist/assets/constants-DLyESMjx.js +1 -0
- package/dist/web/dashboard/dist/assets/{context-tab-DjfwQik8.js → context-tab-CbmHGGZh.js} +1 -1
- package/dist/web/dashboard/dist/assets/davinci-tab-krxsY7Pp.js +10 -0
- package/dist/web/dashboard/dist/assets/{docs-tab-gEBzBEEV.js → docs-tab-AautK0dL.js} +1 -1
- package/dist/web/dashboard/dist/assets/file-code-DVOtQrhl.js +11 -0
- package/dist/web/dashboard/dist/assets/{gitnexus-tab-BE2pi0xe.js → gitnexus-tab-D5xRYU3u.js} +1 -1
- package/dist/web/dashboard/dist/assets/{graph-section-Cwx-Bmeh.js → graph-section-D5y4S3T1.js} +1 -1
- package/dist/web/dashboard/dist/assets/{graph-tab-BcS75lY0.js → graph-tab-tmjyMc4q.js} +1 -1
- package/dist/web/dashboard/dist/assets/{graph-utils-OY_fOvB3.js → graph-utils-BlwoHdjR.js} +1 -1
- package/dist/web/dashboard/dist/assets/index-BcMjWikL.css +1 -0
- package/dist/web/dashboard/dist/assets/{index-4X4gmCkA.js → index-C13O-yj1.js} +1 -1
- package/dist/web/dashboard/dist/assets/{index-1aGs8JPI.js → index-CAOXRHQq.js} +1 -1
- package/dist/web/dashboard/dist/assets/{index-C3Kad9YO.js → index-DrvFzUJS.js} +24 -19
- package/dist/web/dashboard/dist/assets/{insights-tab-CP2uIpid.js → insights-tab-9sq9NfBt.js} +1 -1
- package/dist/web/dashboard/dist/assets/{journey-tab-ChwNK_8S.js → journey-tab-ujeAoAsS.js} +1 -1
- package/dist/web/dashboard/dist/assets/{languages-tab-DnBvSh4N.js → languages-tab-DT-46f7p.js} +24 -39
- package/dist/web/dashboard/dist/assets/{loader-circle-Bxe_TLXv.js → loader-circle-DQz_g7p_.js} +1 -1
- package/dist/web/dashboard/dist/assets/{logs-tab-BH86QvKe.js → logs-tab-DHj9jG6G.js} +1 -1
- package/dist/web/dashboard/dist/assets/{lsp-tab-DUpaQXtx.js → lsp-tab-DGIm2cTM.js} +3 -3
- package/dist/web/dashboard/dist/assets/{memories-tab-CkwtNv3t.js → memories-tab-DT7JcHgq.js} +1 -1
- package/dist/web/dashboard/dist/assets/{prd-backlog-tab-CPJanaVF.js → prd-backlog-tab-CLzQ5p_3.js} +1 -1
- package/dist/web/dashboard/dist/assets/{refresh-cw-DL1dUrhF.js → refresh-cw-C0EeXZ6n.js} +1 -1
- package/dist/web/dashboard/dist/assets/{siebel-tab-D7x34UXy.js → siebel-tab-67cdoYQ_.js} +3 -3
- package/dist/web/dashboard/dist/assets/{sif-parse.worker-DZrybOHz.js → sif-parse.worker-Cty_N-lP.js} +3 -3
- package/dist/web/dashboard/dist/assets/{skills-tab-BuqCMS29.js → skills-tab-DL8-pMo9.js} +1 -1
- package/dist/web/dashboard/dist/assets/{style-iy_ryTT6.js → style-DeKQIW_i.js} +1 -1
- package/dist/web/dashboard/dist/assets/triangle-alert-cibtv50e.js +16 -0
- package/dist/web/dashboard/dist/assets/upload-CZI9Zosi.js +16 -0
- package/dist/web/dashboard/dist/index.html +2 -2
- package/package.json +3 -1
- package/dist/web/dashboard/dist/assets/constants-Dd6A34aQ.js +0 -1
- package/dist/web/dashboard/dist/assets/index-BVhCKhGJ.css +0 -1
- package/dist/web/dashboard/dist/assets/triangle-alert-CPzksLkC.js +0 -26
package/dist/web/dashboard/dist/assets/{gitnexus-tab-BE2pi0xe.js → gitnexus-tab-D5xRYU3u.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as $r,r as N,R as Et,j as f,a as Oe,O as Ii}from"./index-C3Kad9YO.js";import{C as we,b as pt,c as jr}from"./constants-Dd6A34aQ.js";var st={exports:{}},Xt;function Oi(){if(Xt)return st.exports;Xt=1;var n=typeof Reflect=="object"?Reflect:null,r=n&&typeof n.apply=="function"?n.apply:function(y,S,C){return Function.prototype.apply.call(y,S,C)},t;n&&typeof n.ownKeys=="function"?t=n.ownKeys:Object.getOwnPropertySymbols?t=function(y){return Object.getOwnPropertyNames(y).concat(Object.getOwnPropertySymbols(y))}:t=function(y){return Object.getOwnPropertyNames(y)};function e(m){console&&console.warn&&console.warn(m)}var i=Number.isNaN||function(y){return y!==y};function a(){a.init.call(this)}st.exports=a,st.exports.once=D,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var o=10;function s(m){if(typeof m!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof m)}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(m){if(typeof m!="number"||m<0||i(m))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+m+".");o=m}}),a.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(y){if(typeof y!="number"||y<0||i(y))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+y+".");return this._maxListeners=y,this};function u(m){return m._maxListeners===void 0?a.defaultMaxListeners:m._maxListeners}a.prototype.getMaxListeners=function(){return u(this)},a.prototype.emit=function(y){for(var S=[],C=1;C<arguments.length;C++)S.push(arguments[C]);var P=y==="error",O=this._events;if(O!==void 0)P=P&&O.error===void 0;else if(!P)return!1;if(P){var z;if(S.length>0&&(z=S[0]),z instanceof Error)throw z;var Z=new Error("Unhandled error."+(z?" ("+z.message+")":""));throw Z.context=z,Z}var U=O[y];if(U===void 0)return!1;if(typeof U=="function")r(U,this,S);else for(var p=U.length,Q=b(U,p),C=0;C<p;++C)r(Q[C],this,S);return!0};function l(m,y,S,C){var P,O,z;if(s(S),O=m._events,O===void 0?(O=m._events=Object.create(null),m._eventsCount=0):(O.newListener!==void 0&&(m.emit("newListener",y,S.listener?S.listener:S),O=m._events),z=O[y]),z===void 0)z=O[y]=S,++m._eventsCount;else if(typeof z=="function"?z=O[y]=C?[S,z]:[z,S]:C?z.unshift(S):z.push(S),P=u(m),P>0&&z.length>P&&!z.warned){z.warned=!0;var Z=new Error("Possible EventEmitter memory leak detected. "+z.length+" "+String(y)+" listeners added. Use emitter.setMaxListeners() to increase limit");Z.name="MaxListenersExceededWarning",Z.emitter=m,Z.type=y,Z.count=z.length,e(Z)}return m}a.prototype.addListener=function(y,S){return l(this,y,S,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(y,S){return l(this,y,S,!0)};function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(m,y,S){var C={fired:!1,wrapFn:void 0,target:m,type:y,listener:S},P=h.bind(C);return P.listener=S,C.wrapFn=P,P}a.prototype.once=function(y,S){return s(S),this.on(y,d(this,y,S)),this},a.prototype.prependOnceListener=function(y,S){return s(S),this.prependListener(y,d(this,y,S)),this},a.prototype.removeListener=function(y,S){var C,P,O,z,Z;if(s(S),P=this._events,P===void 0)return this;if(C=P[y],C===void 0)return this;if(C===S||C.listener===S)--this._eventsCount===0?this._events=Object.create(null):(delete P[y],P.removeListener&&this.emit("removeListener",y,C.listener||S));else if(typeof C!="function"){for(O=-1,z=C.length-1;z>=0;z--)if(C[z]===S||C[z].listener===S){Z=C[z].listener,O=z;break}if(O<0)return this;O===0?C.shift():w(C,O),C.length===1&&(P[y]=C[0]),P.removeListener!==void 0&&this.emit("removeListener",y,Z||S)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(y){var S,C,P;if(C=this._events,C===void 0)return this;if(C.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):C[y]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete C[y]),this;if(arguments.length===0){var O=Object.keys(C),z;for(P=0;P<O.length;++P)z=O[P],z!=="removeListener"&&this.removeAllListeners(z);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(S=C[y],typeof S=="function")this.removeListener(y,S);else if(S!==void 0)for(P=S.length-1;P>=0;P--)this.removeListener(y,S[P]);return this};function c(m,y,S){var C=m._events;if(C===void 0)return[];var P=C[y];return P===void 0?[]:typeof P=="function"?S?[P.listener||P]:[P]:S?E(P):b(P,P.length)}a.prototype.listeners=function(y){return c(this,y,!0)},a.prototype.rawListeners=function(y){return c(this,y,!1)},a.listenerCount=function(m,y){return typeof m.listenerCount=="function"?m.listenerCount(y):g.call(m,y)},a.prototype.listenerCount=g;function g(m){var y=this._events;if(y!==void 0){var S=y[m];if(typeof S=="function")return 1;if(S!==void 0)return S.length}return 0}a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function b(m,y){for(var S=new Array(y),C=0;C<y;++C)S[C]=m[C];return S}function w(m,y){for(;y+1<m.length;y++)m[y]=m[y+1];m.pop()}function E(m){for(var y=new Array(m.length),S=0;S<y.length;++S)y[S]=m[S].listener||m[S];return y}function D(m,y){return new Promise(function(S,C){function P(z){m.removeListener(y,O),C(z)}function O(){typeof m.removeListener=="function"&&m.removeListener("error",P),S([].slice.call(arguments))}R(m,y,O,{once:!0}),y!=="error"&&_(m,P,{once:!0})})}function _(m,y,S){typeof m.on=="function"&&R(m,"error",y,S)}function R(m,y,S,C){if(typeof m.on=="function")C.once?m.once(y,S):m.on(y,S);else if(typeof m.addEventListener=="function")m.addEventListener(y,function P(O){C.once&&m.removeEventListener(y,P),S(O)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof m)}return st.exports}var Ur=Oi();function zi(){const n=arguments[0];for(let r=1,t=arguments.length;r<t;r++)if(arguments[r])for(const e in arguments[r])n[e]=arguments[r][e];return n}let te=zi;typeof Object.assign=="function"&&(te=Object.assign);function fe(n,r,t,e){const i=n._nodes.get(r);let a=null;return i&&(e==="mixed"?a=i.out&&i.out[t]||i.undirected&&i.undirected[t]:e==="directed"?a=i.out&&i.out[t]:a=i.undirected&&i.undirected[t]),a}function oe(n){return typeof n=="object"&&n!==null}function Mr(n){let r;for(r in n)return!1;return!0}function de(n,r,t){Object.defineProperty(n,r,{enumerable:!1,configurable:!1,writable:!0,value:t})}function ve(n,r,t){const e={enumerable:!0,configurable:!0};typeof t=="function"?e.get=t:(e.value=t,e.writable=!1),Object.defineProperty(n,r,e)}function Qt(n){return!(!oe(n)||n.attributes&&!Array.isArray(n.attributes))}function $i(){let n=Math.floor(Math.random()*256)&255;return()=>n++}function ke(){const n=arguments;let r=null,t=-1;return{[Symbol.iterator](){return this},next(){let e=null;do{if(r===null){if(t++,t>=n.length)return{done:!0};r=n[t][Symbol.iterator]()}if(e=r.next(),e.done){r=null;continue}break}while(!0);return e}}}function Ve(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}class Bt extends Error{constructor(r){super(),this.name="GraphError",this.message=r}}class L extends Bt{constructor(r){super(r),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,L.prototype.constructor)}}class A extends Bt{constructor(r){super(r),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,A.prototype.constructor)}}class j extends Bt{constructor(r){super(r),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,j.prototype.constructor)}}function Br(n,r){this.key=n,this.attributes=r,this.clear()}Br.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function Hr(n,r){this.key=n,this.attributes=r,this.clear()}Hr.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function Wr(n,r){this.key=n,this.attributes=r,this.clear()}Wr.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function qe(n,r,t,e,i){this.key=r,this.attributes=i,this.undirected=n,this.source=t,this.target=e}qe.prototype.attach=function(){let n="out",r="in";this.undirected&&(n=r="undirected");const t=this.source.key,e=this.target.key;this.source[n][e]=this,!(this.undirected&&t===e)&&(this.target[r][t]=this)};qe.prototype.attachMulti=function(){let n="out",r="in";const t=this.source.key,e=this.target.key;this.undirected&&(n=r="undirected");const i=this.source[n],a=i[e];if(typeof a>"u"){i[e]=this,this.undirected&&t===e||(this.target[r][t]=this);return}a.previous=this,this.next=a,i[e]=this,this.target[r][t]=this};qe.prototype.detach=function(){const n=this.source.key,r=this.target.key;let t="out",e="in";this.undirected&&(t=e="undirected"),delete this.source[t][r],delete this.target[e][n]};qe.prototype.detachMulti=function(){const n=this.source.key,r=this.target.key;let t="out",e="in";this.undirected&&(t=e="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[t][r],delete this.target[e][n]):(this.next.previous=void 0,this.source[t][r]=this.next,this.target[e][n]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const Vr=0,qr=1,ji=2,Kr=3;function Ae(n,r,t,e,i,a,o){let s,u,l,h;if(e=""+e,t===Vr){if(s=n._nodes.get(e),!s)throw new A(`Graph.${r}: could not find the "${e}" node in the graph.`);l=i,h=a}else if(t===Kr){if(i=""+i,u=n._edges.get(i),!u)throw new A(`Graph.${r}: could not find the "${i}" edge in the graph.`);const d=u.source.key,c=u.target.key;if(e===d)s=u.target;else if(e===c)s=u.source;else throw new A(`Graph.${r}: the "${e}" node is not attached to the "${i}" edge (${d}, ${c}).`);l=a,h=o}else{if(u=n._edges.get(e),!u)throw new A(`Graph.${r}: could not find the "${e}" edge in the graph.`);t===qr?s=u.source:s=u.target,l=i,h=a}return[s,l,h]}function Ui(n,r,t){n.prototype[r]=function(e,i,a){const[o,s]=Ae(this,r,t,e,i,a);return o.attributes[s]}}function Mi(n,r,t){n.prototype[r]=function(e,i){const[a]=Ae(this,r,t,e,i);return a.attributes}}function Bi(n,r,t){n.prototype[r]=function(e,i,a){const[o,s]=Ae(this,r,t,e,i,a);return o.attributes.hasOwnProperty(s)}}function Hi(n,r,t){n.prototype[r]=function(e,i,a,o){const[s,u,l]=Ae(this,r,t,e,i,a,o);return s.attributes[u]=l,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}function Wi(n,r,t){n.prototype[r]=function(e,i,a,o){const[s,u,l]=Ae(this,r,t,e,i,a,o);if(typeof l!="function")throw new L(`Graph.${r}: updater should be a function.`);const h=s.attributes,d=l(h[u]);return h[u]=d,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}function Vi(n,r,t){n.prototype[r]=function(e,i,a){const[o,s]=Ae(this,r,t,e,i,a);return delete o.attributes[s],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:s}),this}}function qi(n,r,t){n.prototype[r]=function(e,i,a){const[o,s]=Ae(this,r,t,e,i,a);if(!oe(s))throw new L(`Graph.${r}: provided attributes are not a plain object.`);return o.attributes=s,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}function Ki(n,r,t){n.prototype[r]=function(e,i,a){const[o,s]=Ae(this,r,t,e,i,a);if(!oe(s))throw new L(`Graph.${r}: provided attributes are not a plain object.`);return te(o.attributes,s),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:s}),this}}function Yi(n,r,t){n.prototype[r]=function(e,i,a){const[o,s]=Ae(this,r,t,e,i,a);if(typeof s!="function")throw new L(`Graph.${r}: provided updater is not a function.`);return o.attributes=s(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}const Zi=[{name:n=>`get${n}Attribute`,attacher:Ui},{name:n=>`get${n}Attributes`,attacher:Mi},{name:n=>`has${n}Attribute`,attacher:Bi},{name:n=>`set${n}Attribute`,attacher:Hi},{name:n=>`update${n}Attribute`,attacher:Wi},{name:n=>`remove${n}Attribute`,attacher:Vi},{name:n=>`replace${n}Attributes`,attacher:qi},{name:n=>`merge${n}Attributes`,attacher:Ki},{name:n=>`update${n}Attributes`,attacher:Yi}];function Xi(n){Zi.forEach(function({name:r,attacher:t}){t(n,r("Node"),Vr),t(n,r("Source"),qr),t(n,r("Target"),ji),t(n,r("Opposite"),Kr)})}function Qi(n,r,t){n.prototype[r]=function(e,i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new j(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new j(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+i;if(i=arguments[2],a=fe(this,o,s,t),!a)throw new A(`Graph.${r}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new j(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new A(`Graph.${r}: could not find the "${e}" edge in the graph.`)}return a.attributes[i]}}function Ji(n,r,t){n.prototype[r]=function(e){let i;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new j(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new j(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+e,o=""+arguments[1];if(i=fe(this,a,o,t),!i)throw new A(`Graph.${r}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new j(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,i=this._edges.get(e),!i)throw new A(`Graph.${r}: could not find the "${e}" edge in the graph.`)}return i.attributes}}function en(n,r,t){n.prototype[r]=function(e,i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new j(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new j(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+i;if(i=arguments[2],a=fe(this,o,s,t),!a)throw new A(`Graph.${r}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new j(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new A(`Graph.${r}: could not find the "${e}" edge in the graph.`)}return a.attributes.hasOwnProperty(i)}}function tn(n,r,t){n.prototype[r]=function(e,i,a){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new j(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new j(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+e,u=""+i;if(i=arguments[2],a=arguments[3],o=fe(this,s,u,t),!o)throw new A(`Graph.${r}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new j(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,o=this._edges.get(e),!o)throw new A(`Graph.${r}: could not find the "${e}" edge in the graph.`)}return o.attributes[i]=a,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:i}),this}}function rn(n,r,t){n.prototype[r]=function(e,i,a){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new j(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new j(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+e,u=""+i;if(i=arguments[2],a=arguments[3],o=fe(this,s,u,t),!o)throw new A(`Graph.${r}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new j(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,o=this._edges.get(e),!o)throw new A(`Graph.${r}: could not find the "${e}" edge in the graph.`)}if(typeof a!="function")throw new L(`Graph.${r}: updater should be a function.`);return o.attributes[i]=a(o.attributes[i]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:i}),this}}function nn(n,r,t){n.prototype[r]=function(e,i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new j(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new j(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+i;if(i=arguments[2],a=fe(this,o,s,t),!a)throw new A(`Graph.${r}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new j(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new A(`Graph.${r}: could not find the "${e}" edge in the graph.`)}return delete a.attributes[i],this.emit("edgeAttributesUpdated",{key:a.key,type:"remove",attributes:a.attributes,name:i}),this}}function an(n,r,t){n.prototype[r]=function(e,i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new j(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new j(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+i;if(i=arguments[2],a=fe(this,o,s,t),!a)throw new A(`Graph.${r}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new j(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new A(`Graph.${r}: could not find the "${e}" edge in the graph.`)}if(!oe(i))throw new L(`Graph.${r}: provided attributes are not a plain object.`);return a.attributes=i,this.emit("edgeAttributesUpdated",{key:a.key,type:"replace",attributes:a.attributes}),this}}function on(n,r,t){n.prototype[r]=function(e,i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new j(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new j(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+i;if(i=arguments[2],a=fe(this,o,s,t),!a)throw new A(`Graph.${r}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new j(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new A(`Graph.${r}: could not find the "${e}" edge in the graph.`)}if(!oe(i))throw new L(`Graph.${r}: provided attributes are not a plain object.`);return te(a.attributes,i),this.emit("edgeAttributesUpdated",{key:a.key,type:"merge",attributes:a.attributes,data:i}),this}}function sn(n,r,t){n.prototype[r]=function(e,i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new j(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new j(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+i;if(i=arguments[2],a=fe(this,o,s,t),!a)throw new A(`Graph.${r}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new j(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new A(`Graph.${r}: could not find the "${e}" edge in the graph.`)}if(typeof i!="function")throw new L(`Graph.${r}: provided updater is not a function.`);return a.attributes=i(a.attributes),this.emit("edgeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}const un=[{name:n=>`get${n}Attribute`,attacher:Qi},{name:n=>`get${n}Attributes`,attacher:Ji},{name:n=>`has${n}Attribute`,attacher:en},{name:n=>`set${n}Attribute`,attacher:tn},{name:n=>`update${n}Attribute`,attacher:rn},{name:n=>`remove${n}Attribute`,attacher:nn},{name:n=>`replace${n}Attributes`,attacher:an},{name:n=>`merge${n}Attributes`,attacher:on},{name:n=>`update${n}Attributes`,attacher:sn}];function ln(n){un.forEach(function({name:r,attacher:t}){t(n,r("Edge"),"mixed"),t(n,r("DirectedEdge"),"directed"),t(n,r("UndirectedEdge"),"undirected")})}const hn=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function dn(n,r,t,e){let i=!1;for(const a in r){if(a===e)continue;const o=r[a];if(i=t(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),n&&i)return o.key}}function cn(n,r,t,e){let i,a,o,s=!1;for(const u in r)if(u!==e){i=r[u];do{if(a=i.source,o=i.target,s=t(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected),n&&s)return i.key;i=i.next}while(i!==void 0)}}function xt(n,r){const t=Object.keys(n),e=t.length;let i,a=0;return{[Symbol.iterator](){return this},next(){do if(i)i=i.next;else{if(a>=e)return{done:!0};const o=t[a++];if(o===r){i=void 0;continue}i=n[o]}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}}}}function fn(n,r,t,e){const i=r[t];if(!i)return;const a=i.source,o=i.target;if(e(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected)&&n)return i.key}function gn(n,r,t,e){let i=r[t];if(!i)return;let a=!1;do{if(a=e(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),n&&a)return i.key;i=i.next}while(i!==void 0)}function _t(n,r){let t=n[r];if(t.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!t)return{done:!0};const i={edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected};return t=t.next,{done:!1,value:i}}};let e=!1;return{[Symbol.iterator](){return this},next(){return e===!0?{done:!0}:(e=!0,{done:!1,value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected}})}}}function pn(n,r){if(n.size===0)return[];if(r==="mixed"||r===n.type)return Array.from(n._edges.keys());const t=r==="undirected"?n.undirectedSize:n.directedSize,e=new Array(t),i=r==="undirected",a=n._edges.values();let o=0,s,u;for(;s=a.next(),s.done!==!0;)u=s.value,u.undirected===i&&(e[o++]=u.key);return e}function Yr(n,r,t,e){if(r.size===0)return;const i=t!=="mixed"&&t!==r.type,a=t==="undirected";let o,s,u=!1;const l=r._edges.values();for(;o=l.next(),o.done!==!0;){if(s=o.value,i&&s.undirected!==a)continue;const{key:h,attributes:d,source:c,target:g}=s;if(u=e(h,d,c.key,g.key,c.attributes,g.attributes,s.undirected),n&&u)return h}}function mn(n,r){if(n.size===0)return Ve();const t=r!=="mixed"&&r!==n.type,e=r==="undirected",i=n._edges.values();return{[Symbol.iterator](){return this},next(){let a,o;for(;;){if(a=i.next(),a.done)return a;if(o=a.value,!(t&&o.undirected!==e))break}return{value:{edge:o.key,attributes:o.attributes,source:o.source.key,target:o.target.key,sourceAttributes:o.source.attributes,targetAttributes:o.target.attributes,undirected:o.undirected},done:!1}}}}function Ht(n,r,t,e,i,a){const o=r?cn:dn;let s;if(t!=="undirected"&&(e!=="out"&&(s=o(n,i.in,a),n&&s)||e!=="in"&&(s=o(n,i.out,a,e?void 0:i.key),n&&s))||t!=="directed"&&(s=o(n,i.undirected,a),n&&s))return s}function vn(n,r,t,e){const i=[];return Ht(!1,n,r,t,e,function(a){i.push(a)}),i}function yn(n,r,t){let e=Ve();return n!=="undirected"&&(r!=="out"&&typeof t.in<"u"&&(e=ke(e,xt(t.in))),r!=="in"&&typeof t.out<"u"&&(e=ke(e,xt(t.out,r?void 0:t.key)))),n!=="directed"&&typeof t.undirected<"u"&&(e=ke(e,xt(t.undirected))),e}function Wt(n,r,t,e,i,a,o){const s=t?gn:fn;let u;if(r!=="undirected"&&(typeof i.in<"u"&&e!=="out"&&(u=s(n,i.in,a,o),n&&u)||typeof i.out<"u"&&e!=="in"&&(e||i.key!==a)&&(u=s(n,i.out,a,o),n&&u))||r!=="directed"&&typeof i.undirected<"u"&&(u=s(n,i.undirected,a,o),n&&u))return u}function bn(n,r,t,e,i){const a=[];return Wt(!1,n,r,t,e,i,function(o){a.push(o)}),a}function wn(n,r,t,e){let i=Ve();return n!=="undirected"&&(typeof t.in<"u"&&r!=="out"&&e in t.in&&(i=ke(i,_t(t.in,e))),typeof t.out<"u"&&r!=="in"&&e in t.out&&(r||t.key!==e)&&(i=ke(i,_t(t.out,e)))),n!=="directed"&&typeof t.undirected<"u"&&e in t.undirected&&(i=ke(i,_t(t.undirected,e))),i}function En(n,r){const{name:t,type:e,direction:i}=r;n.prototype[t]=function(a,o){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return[];if(!arguments.length)return pn(this,e);if(arguments.length===1){a=""+a;const s=this._nodes.get(a);if(typeof s>"u")throw new A(`Graph.${t}: could not find the "${a}" node in the graph.`);return vn(this.multi,e==="mixed"?this.type:e,i,s)}if(arguments.length===2){a=""+a,o=""+o;const s=this._nodes.get(a);if(!s)throw new A(`Graph.${t}: could not find the "${a}" source node in the graph.`);if(!this._nodes.has(o))throw new A(`Graph.${t}: could not find the "${o}" target node in the graph.`);return bn(e,this.multi,i,s,o)}throw new L(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function xn(n,r){const{name:t,type:e,direction:i}=r,a="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(l,h,d){if(!(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)){if(arguments.length===1)return d=l,Yr(!1,this,e,d);if(arguments.length===2){l=""+l,d=h;const c=this._nodes.get(l);if(typeof c>"u")throw new A(`Graph.${a}: could not find the "${l}" node in the graph.`);return Ht(!1,this.multi,e==="mixed"?this.type:e,i,c,d)}if(arguments.length===3){l=""+l,h=""+h;const c=this._nodes.get(l);if(!c)throw new A(`Graph.${a}: could not find the "${l}" source node in the graph.`);if(!this._nodes.has(h))throw new A(`Graph.${a}: could not find the "${h}" target node in the graph.`);return Wt(!1,e,this.multi,i,c,h,d)}throw new L(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(){const l=Array.prototype.slice.call(arguments),h=l.pop();let d;if(l.length===0){let c=0;e!=="directed"&&(c+=this.undirectedSize),e!=="undirected"&&(c+=this.directedSize),d=new Array(c);let g=0;l.push((b,w,E,D,_,R,m)=>{d[g++]=h(b,w,E,D,_,R,m)})}else d=[],l.push((c,g,b,w,E,D,_)=>{d.push(h(c,g,b,w,E,D,_))});return this[a].apply(this,l),d};const s="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(){const l=Array.prototype.slice.call(arguments),h=l.pop(),d=[];return l.push((c,g,b,w,E,D,_)=>{h(c,g,b,w,E,D,_)&&d.push(c)}),this[a].apply(this,l),d};const u="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[u]=function(){let l=Array.prototype.slice.call(arguments);if(l.length<2||l.length>4)throw new L(`Graph.${u}: invalid number of arguments (expecting 2, 3 or 4 and got ${l.length}).`);if(typeof l[l.length-1]=="function"&&typeof l[l.length-2]!="function")throw new L(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let h,d;l.length===2?(h=l[0],d=l[1],l=[]):l.length===3?(h=l[1],d=l[2],l=[l[0]]):l.length===4&&(h=l[2],d=l[3],l=[l[0],l[1]]);let c=d;return l.push((g,b,w,E,D,_,R)=>{c=h(c,g,b,w,E,D,_,R)}),this[a].apply(this,l),c}}function _n(n,r){const{name:t,type:e,direction:i}=r,a="find"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(u,l,h){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return!1;if(arguments.length===1)return h=u,Yr(!0,this,e,h);if(arguments.length===2){u=""+u,h=l;const d=this._nodes.get(u);if(typeof d>"u")throw new A(`Graph.${a}: could not find the "${u}" node in the graph.`);return Ht(!0,this.multi,e==="mixed"?this.type:e,i,d,h)}if(arguments.length===3){u=""+u,l=""+l;const d=this._nodes.get(u);if(!d)throw new A(`Graph.${a}: could not find the "${u}" source node in the graph.`);if(!this._nodes.has(l))throw new A(`Graph.${a}: could not find the "${l}" target node in the graph.`);return Wt(!0,e,this.multi,i,d,l,h)}throw new L(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const o="some"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[o]=function(){const u=Array.prototype.slice.call(arguments),l=u.pop();return u.push((d,c,g,b,w,E,D)=>l(d,c,g,b,w,E,D)),!!this[a].apply(this,u)};const s="every"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[s]=function(){const u=Array.prototype.slice.call(arguments),l=u.pop();return u.push((d,c,g,b,w,E,D)=>!l(d,c,g,b,w,E,D)),!this[a].apply(this,u)}}function Cn(n,r){const{name:t,type:e,direction:i}=r,a=t.slice(0,-1)+"Entries";n.prototype[a]=function(o,s){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return Ve();if(!arguments.length)return mn(this,e);if(arguments.length===1){o=""+o;const u=this._nodes.get(o);if(!u)throw new A(`Graph.${a}: could not find the "${o}" node in the graph.`);return yn(e,i,u)}if(arguments.length===2){o=""+o,s=""+s;const u=this._nodes.get(o);if(!u)throw new A(`Graph.${a}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(s))throw new A(`Graph.${a}: could not find the "${s}" target node in the graph.`);return wn(e,i,u,s)}throw new L(`Graph.${a}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Sn(n){hn.forEach(r=>{En(n,r),xn(n,r),_n(n,r),Cn(n,r)})}const Tn=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function mt(){this.A=null,this.B=null}mt.prototype.wrap=function(n){this.A===null?this.A=n:this.B===null&&(this.B=n)};mt.prototype.has=function(n){return this.A!==null&&n in this.A||this.B!==null&&n in this.B};function Ze(n,r,t,e,i){for(const a in e){const o=e[a],s=o.source,u=o.target,l=s===t?u:s;if(r&&r.has(l.key))continue;const h=i(l.key,l.attributes);if(n&&h)return l.key}}function Vt(n,r,t,e,i){if(r!=="mixed"){if(r==="undirected")return Ze(n,null,e,e.undirected,i);if(typeof t=="string")return Ze(n,null,e,e[t],i)}const a=new mt;let o;if(r!=="undirected"){if(t!=="out"){if(o=Ze(n,null,e,e.in,i),n&&o)return o;a.wrap(e.in)}if(t!=="in"){if(o=Ze(n,a,e,e.out,i),n&&o)return o;a.wrap(e.out)}}if(r!=="directed"&&(o=Ze(n,a,e,e.undirected,i),n&&o))return o}function Rn(n,r,t){if(n!=="mixed"){if(n==="undirected")return Object.keys(t.undirected);if(typeof r=="string")return Object.keys(t[r])}const e=[];return Vt(!1,n,r,t,function(i){e.push(i)}),e}function Xe(n,r,t){const e=Object.keys(t),i=e.length;let a=0;return{[Symbol.iterator](){return this},next(){let o=null;do{if(a>=i)return n&&n.wrap(t),{done:!0};const s=t[e[a++]],u=s.source,l=s.target;if(o=u===r?l:u,n&&n.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}}}function kn(n,r,t){if(n!=="mixed"){if(n==="undirected")return Xe(null,t,t.undirected);if(typeof r=="string")return Xe(null,t,t[r])}let e=Ve();const i=new mt;return n!=="undirected"&&(r!=="out"&&(e=ke(e,Xe(i,t,t.in))),r!=="in"&&(e=ke(e,Xe(i,t,t.out)))),n!=="directed"&&(e=ke(e,Xe(i,t,t.undirected))),e}function An(n,r){const{name:t,type:e,direction:i}=r;n.prototype[t]=function(a){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return[];a=""+a;const o=this._nodes.get(a);if(typeof o>"u")throw new A(`Graph.${t}: could not find the "${a}" node in the graph.`);return Rn(e==="mixed"?this.type:e,i,o)}}function Dn(n,r){const{name:t,type:e,direction:i}=r,a="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(l,h){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return;l=""+l;const d=this._nodes.get(l);if(typeof d>"u")throw new A(`Graph.${a}: could not find the "${l}" node in the graph.`);Vt(!1,e==="mixed"?this.type:e,i,d,h)};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(l,h){const d=[];return this[a](l,(c,g)=>{d.push(h(c,g))}),d};const s="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(l,h){const d=[];return this[a](l,(c,g)=>{h(c,g)&&d.push(c)}),d};const u="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[u]=function(l,h,d){if(arguments.length<3)throw new L(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let c=d;return this[a](l,(g,b)=>{c=h(c,g,b)}),c}}function Ln(n,r){const{name:t,type:e,direction:i}=r,a=t[0].toUpperCase()+t.slice(1,-1),o="find"+a;n.prototype[o]=function(l,h){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return;l=""+l;const d=this._nodes.get(l);if(typeof d>"u")throw new A(`Graph.${o}: could not find the "${l}" node in the graph.`);return Vt(!0,e==="mixed"?this.type:e,i,d,h)};const s="some"+a;n.prototype[s]=function(l,h){return!!this[o](l,h)};const u="every"+a;n.prototype[u]=function(l,h){return!this[o](l,(c,g)=>!h(c,g))}}function Nn(n,r){const{name:t,type:e,direction:i}=r,a=t.slice(0,-1)+"Entries";n.prototype[a]=function(o){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return Ve();o=""+o;const s=this._nodes.get(o);if(typeof s>"u")throw new A(`Graph.${a}: could not find the "${o}" node in the graph.`);return kn(e==="mixed"?this.type:e,i,s)}}function Gn(n){Tn.forEach(r=>{An(n,r),Dn(n,r),Ln(n,r),Nn(n,r)})}function ut(n,r,t,e,i){const a=e._nodes.values(),o=e.type;let s,u,l,h,d,c;for(;s=a.next(),s.done!==!0;){let g=!1;if(u=s.value,o!=="undirected"){h=u.out;for(l in h){d=h[l];do c=d.target,g=!0,i(u.key,c.key,u.attributes,c.attributes,d.key,d.attributes,d.undirected),d=d.next;while(d)}}if(o!=="directed"){h=u.undirected;for(l in h)if(!(r&&u.key>l)){d=h[l];do c=d.target,c.key!==l&&(c=d.source),g=!0,i(u.key,c.key,u.attributes,c.attributes,d.key,d.attributes,d.undirected),d=d.next;while(d)}}t&&!g&&i(u.key,null,u.attributes,null,null,null,null)}}function Fn(n,r){const t={key:n};return Mr(r.attributes)||(t.attributes=te({},r.attributes)),t}function Pn(n,r,t){const e={key:r,source:t.source.key,target:t.target.key};return Mr(t.attributes)||(e.attributes=te({},t.attributes)),n==="mixed"&&t.undirected&&(e.undirected=!0),e}function In(n){if(!oe(n))throw new L('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in n))throw new L("Graph.import: serialized node is missing its key.");if("attributes"in n&&(!oe(n.attributes)||n.attributes===null))throw new L("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function On(n){if(!oe(n))throw new L('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in n))throw new L("Graph.import: serialized edge is missing its source.");if(!("target"in n))throw new L("Graph.import: serialized edge is missing its target.");if("attributes"in n&&(!oe(n.attributes)||n.attributes===null))throw new L("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in n&&typeof n.undirected!="boolean")throw new L("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const zn=$i(),$n=new Set(["directed","undirected","mixed"]),Jt=new Set(["domain","_events","_eventsCount","_maxListeners"]),jn=[{name:n=>`${n}Edge`,generateKey:!0},{name:n=>`${n}DirectedEdge`,generateKey:!0,type:"directed"},{name:n=>`${n}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:n=>`${n}EdgeWithKey`},{name:n=>`${n}DirectedEdgeWithKey`,type:"directed"},{name:n=>`${n}UndirectedEdgeWithKey`,type:"undirected"}],Un={allowSelfLoops:!0,multi:!1,type:"mixed"};function Mn(n,r,t){if(t&&!oe(t))throw new L(`Graph.addNode: invalid attributes. Expecting an object but got "${t}"`);if(r=""+r,t=t||{},n._nodes.has(r))throw new j(`Graph.addNode: the "${r}" node already exist in the graph.`);const e=new n.NodeDataClass(r,t);return n._nodes.set(r,e),n.emit("nodeAdded",{key:r,attributes:t}),e}function er(n,r,t){const e=new n.NodeDataClass(r,t);return n._nodes.set(r,e),n.emit("nodeAdded",{key:r,attributes:t}),e}function Zr(n,r,t,e,i,a,o,s){if(!e&&n.type==="undirected")throw new j(`Graph.${r}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(e&&n.type==="directed")throw new j(`Graph.${r}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(s&&!oe(s))throw new L(`Graph.${r}: invalid attributes. Expecting an object but got "${s}"`);if(a=""+a,o=""+o,s=s||{},!n.allowSelfLoops&&a===o)throw new j(`Graph.${r}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const u=n._nodes.get(a),l=n._nodes.get(o);if(!u)throw new A(`Graph.${r}: source node "${a}" not found.`);if(!l)throw new A(`Graph.${r}: target node "${o}" not found.`);const h={key:null,undirected:e,source:a,target:o,attributes:s};if(t)i=n._edgeKeyGenerator();else if(i=""+i,n._edges.has(i))throw new j(`Graph.${r}: the "${i}" edge already exists in the graph.`);if(!n.multi&&(e?typeof u.undirected[o]<"u":typeof u.out[o]<"u"))throw new j(`Graph.${r}: an edge linking "${a}" to "${o}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const d=new qe(e,i,u,l,s);n._edges.set(i,d);const c=a===o;return e?(u.undirectedDegree++,l.undirectedDegree++,c&&(u.undirectedLoops++,n._undirectedSelfLoopCount++)):(u.outDegree++,l.inDegree++,c&&(u.directedLoops++,n._directedSelfLoopCount++)),n.multi?d.attachMulti():d.attach(),e?n._undirectedSize++:n._directedSize++,h.key=i,n.emit("edgeAdded",h),i}function Bn(n,r,t,e,i,a,o,s,u){if(!e&&n.type==="undirected")throw new j(`Graph.${r}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(e&&n.type==="directed")throw new j(`Graph.${r}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(s){if(u){if(typeof s!="function")throw new L(`Graph.${r}: invalid updater function. Expecting a function but got "${s}"`)}else if(!oe(s))throw new L(`Graph.${r}: invalid attributes. Expecting an object but got "${s}"`)}a=""+a,o=""+o;let l;if(u&&(l=s,s=void 0),!n.allowSelfLoops&&a===o)throw new j(`Graph.${r}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let h=n._nodes.get(a),d=n._nodes.get(o),c,g;if(!t&&(c=n._edges.get(i),c)){if((c.source.key!==a||c.target.key!==o)&&(!e||c.source.key!==o||c.target.key!==a))throw new j(`Graph.${r}: inconsistency detected when attempting to merge the "${i}" edge with "${a}" source & "${o}" target vs. ("${c.source.key}", "${c.target.key}").`);g=c}if(!g&&!n.multi&&h&&(g=e?h.undirected[o]:h.out[o]),g){const _=[g.key,!1,!1,!1];if(u?!l:!s)return _;if(u){const R=g.attributes;g.attributes=l(R),n.emit("edgeAttributesUpdated",{type:"replace",key:g.key,attributes:g.attributes})}else te(g.attributes,s),n.emit("edgeAttributesUpdated",{type:"merge",key:g.key,attributes:g.attributes,data:s});return _}s=s||{},u&&l&&(s=l(s));const b={key:null,undirected:e,source:a,target:o,attributes:s};if(t)i=n._edgeKeyGenerator();else if(i=""+i,n._edges.has(i))throw new j(`Graph.${r}: the "${i}" edge already exists in the graph.`);let w=!1,E=!1;h||(h=er(n,a,{}),w=!0,a===o&&(d=h,E=!0)),d||(d=er(n,o,{}),E=!0),c=new qe(e,i,h,d,s),n._edges.set(i,c);const D=a===o;return e?(h.undirectedDegree++,d.undirectedDegree++,D&&(h.undirectedLoops++,n._undirectedSelfLoopCount++)):(h.outDegree++,d.inDegree++,D&&(h.directedLoops++,n._directedSelfLoopCount++)),n.multi?c.attachMulti():c.attach(),e?n._undirectedSize++:n._directedSize++,b.key=i,n.emit("edgeAdded",b),[i,!0,w,E]}function Me(n,r){n._edges.delete(r.key);const{source:t,target:e,attributes:i}=r,a=r.undirected,o=t===e;a?(t.undirectedDegree--,e.undirectedDegree--,o&&(t.undirectedLoops--,n._undirectedSelfLoopCount--)):(t.outDegree--,e.inDegree--,o&&(t.directedLoops--,n._directedSelfLoopCount--)),n.multi?r.detachMulti():r.detach(),a?n._undirectedSize--:n._directedSize--,n.emit("edgeDropped",{key:r.key,attributes:i,source:t.key,target:e.key,undirected:a})}class X extends Ur.EventEmitter{constructor(r){if(super(),r=te({},Un,r),typeof r.multi!="boolean")throw new L(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${r.multi}".`);if(!$n.has(r.type))throw new L(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${r.type}".`);if(typeof r.allowSelfLoops!="boolean")throw new L(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${r.allowSelfLoops}".`);const t=r.type==="mixed"?Br:r.type==="directed"?Hr:Wr;de(this,"NodeDataClass",t);const e="geid_"+zn()+"_";let i=0;const a=()=>{let o;do o=e+i++;while(this._edges.has(o));return o};de(this,"_attributes",{}),de(this,"_nodes",new Map),de(this,"_edges",new Map),de(this,"_directedSize",0),de(this,"_undirectedSize",0),de(this,"_directedSelfLoopCount",0),de(this,"_undirectedSelfLoopCount",0),de(this,"_edgeKeyGenerator",a),de(this,"_options",r),Jt.forEach(o=>de(this,o,this[o])),ve(this,"order",()=>this._nodes.size),ve(this,"size",()=>this._edges.size),ve(this,"directedSize",()=>this._directedSize),ve(this,"undirectedSize",()=>this._undirectedSize),ve(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),ve(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),ve(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),ve(this,"multi",this._options.multi),ve(this,"type",this._options.type),ve(this,"allowSelfLoops",this._options.allowSelfLoops),ve(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(r){return this._nodes.has(""+r)}hasDirectedEdge(r,t){if(this.type==="undirected")return!1;if(arguments.length===1){const e=""+r,i=this._edges.get(e);return!!i&&!i.undirected}else if(arguments.length===2){r=""+r,t=""+t;const e=this._nodes.get(r);return e?e.out.hasOwnProperty(t):!1}throw new L(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(r,t){if(this.type==="directed")return!1;if(arguments.length===1){const e=""+r,i=this._edges.get(e);return!!i&&i.undirected}else if(arguments.length===2){r=""+r,t=""+t;const e=this._nodes.get(r);return e?e.undirected.hasOwnProperty(t):!1}throw new L(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(r,t){if(arguments.length===1){const e=""+r;return this._edges.has(e)}else if(arguments.length===2){r=""+r,t=""+t;const e=this._nodes.get(r);return e?typeof e.out<"u"&&e.out.hasOwnProperty(t)||typeof e.undirected<"u"&&e.undirected.hasOwnProperty(t):!1}throw new L(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(r,t){if(this.type==="undirected")return;if(r=""+r,t=""+t,this.multi)throw new j("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const e=this._nodes.get(r);if(!e)throw new A(`Graph.directedEdge: could not find the "${r}" source node in the graph.`);if(!this._nodes.has(t))throw new A(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const i=e.out&&e.out[t]||void 0;if(i)return i.key}undirectedEdge(r,t){if(this.type==="directed")return;if(r=""+r,t=""+t,this.multi)throw new j("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const e=this._nodes.get(r);if(!e)throw new A(`Graph.undirectedEdge: could not find the "${r}" source node in the graph.`);if(!this._nodes.has(t))throw new A(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const i=e.undirected&&e.undirected[t]||void 0;if(i)return i.key}edge(r,t){if(this.multi)throw new j("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new A(`Graph.edge: could not find the "${r}" source node in the graph.`);if(!this._nodes.has(t))throw new A(`Graph.edge: could not find the "${t}" target node in the graph.`);const i=e.out&&e.out[t]||e.undirected&&e.undirected[t]||void 0;if(i)return i.key}areDirectedNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new A(`Graph.areDirectedNeighbors: could not find the "${r}" node in the graph.`);return this.type==="undirected"?!1:t in e.in||t in e.out}areOutNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new A(`Graph.areOutNeighbors: could not find the "${r}" node in the graph.`);return this.type==="undirected"?!1:t in e.out}areInNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new A(`Graph.areInNeighbors: could not find the "${r}" node in the graph.`);return this.type==="undirected"?!1:t in e.in}areUndirectedNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new A(`Graph.areUndirectedNeighbors: could not find the "${r}" node in the graph.`);return this.type==="directed"?!1:t in e.undirected}areNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new A(`Graph.areNeighbors: could not find the "${r}" node in the graph.`);return this.type!=="undirected"&&(t in e.in||t in e.out)||this.type!=="directed"&&t in e.undirected}areInboundNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new A(`Graph.areInboundNeighbors: could not find the "${r}" node in the graph.`);return this.type!=="undirected"&&t in e.in||this.type!=="directed"&&t in e.undirected}areOutboundNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new A(`Graph.areOutboundNeighbors: could not find the "${r}" node in the graph.`);return this.type!=="undirected"&&t in e.out||this.type!=="directed"&&t in e.undirected}inDegree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.inDegree: could not find the "${r}" node in the graph.`);return this.type==="undirected"?0:t.inDegree}outDegree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.outDegree: could not find the "${r}" node in the graph.`);return this.type==="undirected"?0:t.outDegree}directedDegree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.directedDegree: could not find the "${r}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree}undirectedDegree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.undirectedDegree: could not find the "${r}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree}inboundDegree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.inboundDegree: could not find the "${r}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.inDegree),e}outboundDegree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.outboundDegree: could not find the "${r}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.outDegree),e}degree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.degree: could not find the "${r}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.inDegree+t.outDegree),e}inDegreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.inDegreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);return this.type==="undirected"?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.outDegreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);return this.type==="undirected"?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.directedDegreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);let e=0,i=0;return this.type!=="directed"&&(e+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.inDegree,i+=t.directedLoops),e-i}outboundDegreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);let e=0,i=0;return this.type!=="directed"&&(e+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.outDegree,i+=t.directedLoops),e-i}degreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.degreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);let e=0,i=0;return this.type!=="directed"&&(e+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.inDegree+t.outDegree,i+=t.directedLoops*2),e-i}source(r){r=""+r;const t=this._edges.get(r);if(!t)throw new A(`Graph.source: could not find the "${r}" edge in the graph.`);return t.source.key}target(r){r=""+r;const t=this._edges.get(r);if(!t)throw new A(`Graph.target: could not find the "${r}" edge in the graph.`);return t.target.key}extremities(r){r=""+r;const t=this._edges.get(r);if(!t)throw new A(`Graph.extremities: could not find the "${r}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(r,t){r=""+r,t=""+t;const e=this._edges.get(t);if(!e)throw new A(`Graph.opposite: could not find the "${t}" edge in the graph.`);const i=e.source.key,a=e.target.key;if(r===i)return a;if(r===a)return i;throw new A(`Graph.opposite: the "${r}" node is not attached to the "${t}" edge (${i}, ${a}).`)}hasExtremity(r,t){r=""+r,t=""+t;const e=this._edges.get(r);if(!e)throw new A(`Graph.hasExtremity: could not find the "${r}" edge in the graph.`);return e.source.key===t||e.target.key===t}isUndirected(r){r=""+r;const t=this._edges.get(r);if(!t)throw new A(`Graph.isUndirected: could not find the "${r}" edge in the graph.`);return t.undirected}isDirected(r){r=""+r;const t=this._edges.get(r);if(!t)throw new A(`Graph.isDirected: could not find the "${r}" edge in the graph.`);return!t.undirected}isSelfLoop(r){r=""+r;const t=this._edges.get(r);if(!t)throw new A(`Graph.isSelfLoop: could not find the "${r}" edge in the graph.`);return t.source===t.target}addNode(r,t){return Mn(this,r,t).key}mergeNode(r,t){if(t&&!oe(t))throw new L(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);r=""+r,t=t||{};let e=this._nodes.get(r);return e?(t&&(te(e.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:r,attributes:e.attributes,data:t})),[r,!1]):(e=new this.NodeDataClass(r,t),this._nodes.set(r,e),this.emit("nodeAdded",{key:r,attributes:t}),[r,!0])}updateNode(r,t){if(t&&typeof t!="function")throw new L(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);r=""+r;let e=this._nodes.get(r);if(e){if(t){const a=e.attributes;e.attributes=t(a),this.emit("nodeAttributesUpdated",{type:"replace",key:r,attributes:e.attributes})}return[r,!1]}const i=t?t({}):{};return e=new this.NodeDataClass(r,i),this._nodes.set(r,e),this.emit("nodeAdded",{key:r,attributes:i}),[r,!0]}dropNode(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.dropNode: could not find the "${r}" node in the graph.`);let e;if(this.type!=="undirected"){for(const i in t.out){e=t.out[i];do Me(this,e),e=e.next;while(e)}for(const i in t.in){e=t.in[i];do Me(this,e),e=e.next;while(e)}}if(this.type!=="directed")for(const i in t.undirected){e=t.undirected[i];do Me(this,e),e=e.next;while(e)}this._nodes.delete(r),this.emit("nodeDropped",{key:r,attributes:t.attributes})}dropEdge(r){let t;if(arguments.length>1){const e=""+arguments[0],i=""+arguments[1];if(t=fe(this,e,i,this.type),!t)throw new A(`Graph.dropEdge: could not find the "${e}" -> "${i}" edge in the graph.`)}else if(r=""+r,t=this._edges.get(r),!t)throw new A(`Graph.dropEdge: could not find the "${r}" edge in the graph.`);return Me(this,t),this}dropDirectedEdge(r,t){if(arguments.length<2)throw new j("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new j("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");r=""+r,t=""+t;const e=fe(this,r,t,"directed");if(!e)throw new A(`Graph.dropDirectedEdge: could not find a "${r}" -> "${t}" edge in the graph.`);return Me(this,e),this}dropUndirectedEdge(r,t){if(arguments.length<2)throw new j("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new j("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const e=fe(this,r,t,"undirected");if(!e)throw new A(`Graph.dropUndirectedEdge: could not find a "${r}" -> "${t}" edge in the graph.`);return Me(this,e),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const r=this._nodes.values();let t;for(;t=r.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(r){return this._attributes[r]}getAttributes(){return this._attributes}hasAttribute(r){return this._attributes.hasOwnProperty(r)}setAttribute(r,t){return this._attributes[r]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:r}),this}updateAttribute(r,t){if(typeof t!="function")throw new L("Graph.updateAttribute: updater should be a function.");const e=this._attributes[r];return this._attributes[r]=t(e),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:r}),this}removeAttribute(r){return delete this._attributes[r],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:r}),this}replaceAttributes(r){if(!oe(r))throw new L("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=r,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(r){if(!oe(r))throw new L("Graph.mergeAttributes: provided attributes are not a plain object.");return te(this._attributes,r),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:r}),this}updateAttributes(r){if(typeof r!="function")throw new L("Graph.updateAttributes: provided updater is not a function.");return this._attributes=r(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(r,t){if(typeof r!="function")throw new L("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!Qt(t))throw new L("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const e=this._nodes.values();let i,a;for(;i=e.next(),i.done!==!0;)a=i.value,a.attributes=r(a.key,a.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(r,t){if(typeof r!="function")throw new L("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!Qt(t))throw new L("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const e=this._edges.values();let i,a,o,s;for(;i=e.next(),i.done!==!0;)a=i.value,o=a.source,s=a.target,a.attributes=r(a.key,a.attributes,o.key,s.key,o.attributes,s.attributes,a.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(r){if(typeof r!="function")throw new L("Graph.forEachAdjacencyEntry: expecting a callback.");ut(!1,!1,!1,this,r)}forEachAdjacencyEntryWithOrphans(r){if(typeof r!="function")throw new L("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");ut(!1,!1,!0,this,r)}forEachAssymetricAdjacencyEntry(r){if(typeof r!="function")throw new L("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");ut(!1,!0,!1,this,r)}forEachAssymetricAdjacencyEntryWithOrphans(r){if(typeof r!="function")throw new L("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");ut(!1,!0,!0,this,r)}nodes(){return Array.from(this._nodes.keys())}forEachNode(r){if(typeof r!="function")throw new L("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let e,i;for(;e=t.next(),e.done!==!0;)i=e.value,r(i.key,i.attributes)}findNode(r){if(typeof r!="function")throw new L("Graph.findNode: expecting a callback.");const t=this._nodes.values();let e,i;for(;e=t.next(),e.done!==!0;)if(i=e.value,r(i.key,i.attributes))return i.key}mapNodes(r){if(typeof r!="function")throw new L("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let e,i;const a=new Array(this.order);let o=0;for(;e=t.next(),e.done!==!0;)i=e.value,a[o++]=r(i.key,i.attributes);return a}someNode(r){if(typeof r!="function")throw new L("Graph.someNode: expecting a callback.");const t=this._nodes.values();let e,i;for(;e=t.next(),e.done!==!0;)if(i=e.value,r(i.key,i.attributes))return!0;return!1}everyNode(r){if(typeof r!="function")throw new L("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let e,i;for(;e=t.next(),e.done!==!0;)if(i=e.value,!r(i.key,i.attributes))return!1;return!0}filterNodes(r){if(typeof r!="function")throw new L("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let e,i;const a=[];for(;e=t.next(),e.done!==!0;)i=e.value,r(i.key,i.attributes)&&a.push(i.key);return a}reduceNodes(r,t){if(typeof r!="function")throw new L("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new L("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let e=t;const i=this._nodes.values();let a,o;for(;a=i.next(),a.done!==!0;)o=a.value,e=r(e,o.key,o.attributes);return e}nodeEntries(){const r=this._nodes.values();return{[Symbol.iterator](){return this},next(){const t=r.next();if(t.done)return t;const e=t.value;return{value:{node:e.key,attributes:e.attributes},done:!1}}}}export(){const r=new Array(this._nodes.size);let t=0;this._nodes.forEach((i,a)=>{r[t++]=Fn(a,i)});const e=new Array(this._edges.size);return t=0,this._edges.forEach((i,a)=>{e[t++]=Pn(this.type,a,i)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:r,edges:e}}import(r,t=!1){if(r instanceof X)return r.forEachNode((u,l)=>{t?this.mergeNode(u,l):this.addNode(u,l)}),r.forEachEdge((u,l,h,d,c,g,b)=>{t?b?this.mergeUndirectedEdgeWithKey(u,h,d,l):this.mergeDirectedEdgeWithKey(u,h,d,l):b?this.addUndirectedEdgeWithKey(u,h,d,l):this.addDirectedEdgeWithKey(u,h,d,l)}),this;if(!oe(r))throw new L("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(r.attributes){if(!oe(r.attributes))throw new L("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(r.attributes):this.replaceAttributes(r.attributes)}let e,i,a,o,s;if(r.nodes){if(a=r.nodes,!Array.isArray(a))throw new L("Graph.import: invalid nodes. Expecting an array.");for(e=0,i=a.length;e<i;e++){o=a[e],In(o);const{key:u,attributes:l}=o;t?this.mergeNode(u,l):this.addNode(u,l)}}if(r.edges){let u=!1;if(this.type==="undirected"&&(u=!0),a=r.edges,!Array.isArray(a))throw new L("Graph.import: invalid edges. Expecting an array.");for(e=0,i=a.length;e<i;e++){s=a[e],On(s);const{source:l,target:h,attributes:d,undirected:c=u}=s;let g;"key"in s?(g=t?c?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:c?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,g.call(this,s.key,l,h,d)):(g=t?c?this.mergeUndirectedEdge:this.mergeDirectedEdge:c?this.addUndirectedEdge:this.addDirectedEdge,g.call(this,l,h,d))}}return this}nullCopy(r){const t=new X(te({},this._options,r));return t.replaceAttributes(te({},this.getAttributes())),t}emptyCopy(r){const t=this.nullCopy(r);return this._nodes.forEach((e,i)=>{const a=te({},e.attributes);e=new t.NodeDataClass(i,a),t._nodes.set(i,e)}),t}copy(r){if(r=r||{},typeof r.type=="string"&&r.type!==this.type&&r.type!=="mixed")throw new j(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${r.type}" because this would mean losing information about the current graph.`);if(typeof r.multi=="boolean"&&r.multi!==this.multi&&r.multi!==!0)throw new j("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof r.allowSelfLoops=="boolean"&&r.allowSelfLoops!==this.allowSelfLoops&&r.allowSelfLoops!==!0)throw new j("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const t=this.emptyCopy(r),e=this._edges.values();let i,a;for(;i=e.next(),i.done!==!0;)a=i.value,Zr(t,"copy",!1,a.undirected,a.key,a.source.key,a.target.key,te({},a.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const r={};this._nodes.forEach((a,o)=>{r[o]=a.attributes});const t={},e={};this._edges.forEach((a,o)=>{const s=a.undirected?"--":"->";let u="",l=a.source.key,h=a.target.key,d;a.undirected&&l>h&&(d=l,l=h,h=d);const c=`(${l})${s}(${h})`;o.startsWith("geid_")?this.multi&&(typeof e[c]>"u"?e[c]=0:e[c]++,u+=`${e[c]}. `):u+=`[${o}]: `,u+=c,t[u]=a.attributes});const i={};for(const a in this)this.hasOwnProperty(a)&&!Jt.has(a)&&typeof this[a]!="function"&&typeof a!="symbol"&&(i[a]=this[a]);return i.attributes=this._attributes,i.nodes=r,i.edges=t,de(i,"constructor",this.constructor),i}}typeof Symbol<"u"&&(X.prototype[Symbol.for("nodejs.util.inspect.custom")]=X.prototype.inspect);jn.forEach(n=>{["add","merge","update"].forEach(r=>{const t=n.name(r),e=r==="add"?Zr:Bn;n.generateKey?X.prototype[t]=function(i,a,o){return e(this,t,!0,(n.type||this.type)==="undirected",null,i,a,o,r==="update")}:X.prototype[t]=function(i,a,o,s){return e(this,t,!1,(n.type||this.type)==="undirected",i,a,o,s,r==="update")}})});Xi(X);ln(X);Sn(X);Gn(X);class Xr extends X{constructor(r){const t=te({type:"directed"},r);if("multi"in t&&t.multi!==!1)throw new L("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new L('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Qr extends X{constructor(r){const t=te({type:"undirected"},r);if("multi"in t&&t.multi!==!1)throw new L("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new L('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Jr extends X{constructor(r){const t=te({multi:!0},r);if("multi"in t&&t.multi!==!0)throw new L("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class ei extends X{constructor(r){const t=te({type:"directed",multi:!0},r);if("multi"in t&&t.multi!==!0)throw new L("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new L('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class ti extends X{constructor(r){const t=te({type:"undirected",multi:!0},r);if("multi"in t&&t.multi!==!0)throw new L("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new L('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function Ke(n){n.from=function(r,t){const e=te({},r.options,t),i=new n(e);return i.import(r),i}}Ke(X);Ke(Xr);Ke(Qr);Ke(Jr);Ke(ei);Ke(ti);X.Graph=X;X.DirectedGraph=Xr;X.UndirectedGraph=Qr;X.MultiGraph=Jr;X.MultiDirectedGraph=ei;X.MultiUndirectedGraph=ti;X.InvalidArgumentsGraphError=L;X.NotFoundGraphError=A;X.UsageGraphError=j;function Hn(n,r){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var e=t.call(n,r);if(typeof e!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}function it(n){var r=Hn(n,"string");return typeof r=="symbol"?r:r+""}function re(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")}function tr(n,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(n,it(e.key),e)}}function ie(n,r,t){return r&&tr(n.prototype,r),t&&tr(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n}function He(n){return He=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},He(n)}function ri(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ri=function(){return!!n})()}function Wn(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function Vn(n,r){if(r&&(typeof r=="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Wn(n)}function le(n,r,t){return r=He(r),Vn(n,ri()?Reflect.construct(r,t||[],He(n).constructor):r.apply(n,t))}function It(n,r){return It=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},It(n,r)}function he(n,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(r&&r.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),r&&It(n,r)}function qn(n){if(Array.isArray(n))return n}function Kn(n,r){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var e,i,a,o,s=[],u=!0,l=!1;try{if(a=(t=t.call(n)).next,r===0){if(Object(t)!==t)return;u=!1}else for(;!(u=(e=a.call(t)).done)&&(s.push(e.value),s.length!==r);u=!0);}catch(h){l=!0,i=h}finally{try{if(!u&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Ot(n,r){(r==null||r>n.length)&&(r=n.length);for(var t=0,e=Array(r);t<r;t++)e[t]=n[t];return e}function ii(n,r){if(n){if(typeof n=="string")return Ot(n,r);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ot(n,r):void 0}}function Yn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1
|
+
import{g as $r,r as N,R as Et,j as f,a as Oe,O as Ii}from"./index-DrvFzUJS.js";import{C as we,b as pt,c as jr}from"./constants-DLyESMjx.js";var st={exports:{}},Xt;function Oi(){if(Xt)return st.exports;Xt=1;var n=typeof Reflect=="object"?Reflect:null,r=n&&typeof n.apply=="function"?n.apply:function(y,S,C){return Function.prototype.apply.call(y,S,C)},t;n&&typeof n.ownKeys=="function"?t=n.ownKeys:Object.getOwnPropertySymbols?t=function(y){return Object.getOwnPropertyNames(y).concat(Object.getOwnPropertySymbols(y))}:t=function(y){return Object.getOwnPropertyNames(y)};function e(m){console&&console.warn&&console.warn(m)}var i=Number.isNaN||function(y){return y!==y};function a(){a.init.call(this)}st.exports=a,st.exports.once=D,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var o=10;function s(m){if(typeof m!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof m)}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(m){if(typeof m!="number"||m<0||i(m))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+m+".");o=m}}),a.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(y){if(typeof y!="number"||y<0||i(y))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+y+".");return this._maxListeners=y,this};function u(m){return m._maxListeners===void 0?a.defaultMaxListeners:m._maxListeners}a.prototype.getMaxListeners=function(){return u(this)},a.prototype.emit=function(y){for(var S=[],C=1;C<arguments.length;C++)S.push(arguments[C]);var P=y==="error",O=this._events;if(O!==void 0)P=P&&O.error===void 0;else if(!P)return!1;if(P){var z;if(S.length>0&&(z=S[0]),z instanceof Error)throw z;var Z=new Error("Unhandled error."+(z?" ("+z.message+")":""));throw Z.context=z,Z}var U=O[y];if(U===void 0)return!1;if(typeof U=="function")r(U,this,S);else for(var p=U.length,Q=b(U,p),C=0;C<p;++C)r(Q[C],this,S);return!0};function l(m,y,S,C){var P,O,z;if(s(S),O=m._events,O===void 0?(O=m._events=Object.create(null),m._eventsCount=0):(O.newListener!==void 0&&(m.emit("newListener",y,S.listener?S.listener:S),O=m._events),z=O[y]),z===void 0)z=O[y]=S,++m._eventsCount;else if(typeof z=="function"?z=O[y]=C?[S,z]:[z,S]:C?z.unshift(S):z.push(S),P=u(m),P>0&&z.length>P&&!z.warned){z.warned=!0;var Z=new Error("Possible EventEmitter memory leak detected. "+z.length+" "+String(y)+" listeners added. Use emitter.setMaxListeners() to increase limit");Z.name="MaxListenersExceededWarning",Z.emitter=m,Z.type=y,Z.count=z.length,e(Z)}return m}a.prototype.addListener=function(y,S){return l(this,y,S,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(y,S){return l(this,y,S,!0)};function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(m,y,S){var C={fired:!1,wrapFn:void 0,target:m,type:y,listener:S},P=h.bind(C);return P.listener=S,C.wrapFn=P,P}a.prototype.once=function(y,S){return s(S),this.on(y,d(this,y,S)),this},a.prototype.prependOnceListener=function(y,S){return s(S),this.prependListener(y,d(this,y,S)),this},a.prototype.removeListener=function(y,S){var C,P,O,z,Z;if(s(S),P=this._events,P===void 0)return this;if(C=P[y],C===void 0)return this;if(C===S||C.listener===S)--this._eventsCount===0?this._events=Object.create(null):(delete P[y],P.removeListener&&this.emit("removeListener",y,C.listener||S));else if(typeof C!="function"){for(O=-1,z=C.length-1;z>=0;z--)if(C[z]===S||C[z].listener===S){Z=C[z].listener,O=z;break}if(O<0)return this;O===0?C.shift():w(C,O),C.length===1&&(P[y]=C[0]),P.removeListener!==void 0&&this.emit("removeListener",y,Z||S)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(y){var S,C,P;if(C=this._events,C===void 0)return this;if(C.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):C[y]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete C[y]),this;if(arguments.length===0){var O=Object.keys(C),z;for(P=0;P<O.length;++P)z=O[P],z!=="removeListener"&&this.removeAllListeners(z);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(S=C[y],typeof S=="function")this.removeListener(y,S);else if(S!==void 0)for(P=S.length-1;P>=0;P--)this.removeListener(y,S[P]);return this};function c(m,y,S){var C=m._events;if(C===void 0)return[];var P=C[y];return P===void 0?[]:typeof P=="function"?S?[P.listener||P]:[P]:S?E(P):b(P,P.length)}a.prototype.listeners=function(y){return c(this,y,!0)},a.prototype.rawListeners=function(y){return c(this,y,!1)},a.listenerCount=function(m,y){return typeof m.listenerCount=="function"?m.listenerCount(y):g.call(m,y)},a.prototype.listenerCount=g;function g(m){var y=this._events;if(y!==void 0){var S=y[m];if(typeof S=="function")return 1;if(S!==void 0)return S.length}return 0}a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function b(m,y){for(var S=new Array(y),C=0;C<y;++C)S[C]=m[C];return S}function w(m,y){for(;y+1<m.length;y++)m[y]=m[y+1];m.pop()}function E(m){for(var y=new Array(m.length),S=0;S<y.length;++S)y[S]=m[S].listener||m[S];return y}function D(m,y){return new Promise(function(S,C){function P(z){m.removeListener(y,O),C(z)}function O(){typeof m.removeListener=="function"&&m.removeListener("error",P),S([].slice.call(arguments))}R(m,y,O,{once:!0}),y!=="error"&&_(m,P,{once:!0})})}function _(m,y,S){typeof m.on=="function"&&R(m,"error",y,S)}function R(m,y,S,C){if(typeof m.on=="function")C.once?m.once(y,S):m.on(y,S);else if(typeof m.addEventListener=="function")m.addEventListener(y,function P(O){C.once&&m.removeEventListener(y,P),S(O)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof m)}return st.exports}var Ur=Oi();function zi(){const n=arguments[0];for(let r=1,t=arguments.length;r<t;r++)if(arguments[r])for(const e in arguments[r])n[e]=arguments[r][e];return n}let te=zi;typeof Object.assign=="function"&&(te=Object.assign);function fe(n,r,t,e){const i=n._nodes.get(r);let a=null;return i&&(e==="mixed"?a=i.out&&i.out[t]||i.undirected&&i.undirected[t]:e==="directed"?a=i.out&&i.out[t]:a=i.undirected&&i.undirected[t]),a}function oe(n){return typeof n=="object"&&n!==null}function Mr(n){let r;for(r in n)return!1;return!0}function de(n,r,t){Object.defineProperty(n,r,{enumerable:!1,configurable:!1,writable:!0,value:t})}function ve(n,r,t){const e={enumerable:!0,configurable:!0};typeof t=="function"?e.get=t:(e.value=t,e.writable=!1),Object.defineProperty(n,r,e)}function Qt(n){return!(!oe(n)||n.attributes&&!Array.isArray(n.attributes))}function $i(){let n=Math.floor(Math.random()*256)&255;return()=>n++}function ke(){const n=arguments;let r=null,t=-1;return{[Symbol.iterator](){return this},next(){let e=null;do{if(r===null){if(t++,t>=n.length)return{done:!0};r=n[t][Symbol.iterator]()}if(e=r.next(),e.done){r=null;continue}break}while(!0);return e}}}function Ve(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}class Bt extends Error{constructor(r){super(),this.name="GraphError",this.message=r}}class L extends Bt{constructor(r){super(r),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,L.prototype.constructor)}}class A extends Bt{constructor(r){super(r),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,A.prototype.constructor)}}class j extends Bt{constructor(r){super(r),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,j.prototype.constructor)}}function Br(n,r){this.key=n,this.attributes=r,this.clear()}Br.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function Hr(n,r){this.key=n,this.attributes=r,this.clear()}Hr.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function Wr(n,r){this.key=n,this.attributes=r,this.clear()}Wr.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function qe(n,r,t,e,i){this.key=r,this.attributes=i,this.undirected=n,this.source=t,this.target=e}qe.prototype.attach=function(){let n="out",r="in";this.undirected&&(n=r="undirected");const t=this.source.key,e=this.target.key;this.source[n][e]=this,!(this.undirected&&t===e)&&(this.target[r][t]=this)};qe.prototype.attachMulti=function(){let n="out",r="in";const t=this.source.key,e=this.target.key;this.undirected&&(n=r="undirected");const i=this.source[n],a=i[e];if(typeof a>"u"){i[e]=this,this.undirected&&t===e||(this.target[r][t]=this);return}a.previous=this,this.next=a,i[e]=this,this.target[r][t]=this};qe.prototype.detach=function(){const n=this.source.key,r=this.target.key;let t="out",e="in";this.undirected&&(t=e="undirected"),delete this.source[t][r],delete this.target[e][n]};qe.prototype.detachMulti=function(){const n=this.source.key,r=this.target.key;let t="out",e="in";this.undirected&&(t=e="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[t][r],delete this.target[e][n]):(this.next.previous=void 0,this.source[t][r]=this.next,this.target[e][n]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const Vr=0,qr=1,ji=2,Kr=3;function Ae(n,r,t,e,i,a,o){let s,u,l,h;if(e=""+e,t===Vr){if(s=n._nodes.get(e),!s)throw new A(`Graph.${r}: could not find the "${e}" node in the graph.`);l=i,h=a}else if(t===Kr){if(i=""+i,u=n._edges.get(i),!u)throw new A(`Graph.${r}: could not find the "${i}" edge in the graph.`);const d=u.source.key,c=u.target.key;if(e===d)s=u.target;else if(e===c)s=u.source;else throw new A(`Graph.${r}: the "${e}" node is not attached to the "${i}" edge (${d}, ${c}).`);l=a,h=o}else{if(u=n._edges.get(e),!u)throw new A(`Graph.${r}: could not find the "${e}" edge in the graph.`);t===qr?s=u.source:s=u.target,l=i,h=a}return[s,l,h]}function Ui(n,r,t){n.prototype[r]=function(e,i,a){const[o,s]=Ae(this,r,t,e,i,a);return o.attributes[s]}}function Mi(n,r,t){n.prototype[r]=function(e,i){const[a]=Ae(this,r,t,e,i);return a.attributes}}function Bi(n,r,t){n.prototype[r]=function(e,i,a){const[o,s]=Ae(this,r,t,e,i,a);return o.attributes.hasOwnProperty(s)}}function Hi(n,r,t){n.prototype[r]=function(e,i,a,o){const[s,u,l]=Ae(this,r,t,e,i,a,o);return s.attributes[u]=l,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}function Wi(n,r,t){n.prototype[r]=function(e,i,a,o){const[s,u,l]=Ae(this,r,t,e,i,a,o);if(typeof l!="function")throw new L(`Graph.${r}: updater should be a function.`);const h=s.attributes,d=l(h[u]);return h[u]=d,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}function Vi(n,r,t){n.prototype[r]=function(e,i,a){const[o,s]=Ae(this,r,t,e,i,a);return delete o.attributes[s],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:s}),this}}function qi(n,r,t){n.prototype[r]=function(e,i,a){const[o,s]=Ae(this,r,t,e,i,a);if(!oe(s))throw new L(`Graph.${r}: provided attributes are not a plain object.`);return o.attributes=s,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}function Ki(n,r,t){n.prototype[r]=function(e,i,a){const[o,s]=Ae(this,r,t,e,i,a);if(!oe(s))throw new L(`Graph.${r}: provided attributes are not a plain object.`);return te(o.attributes,s),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:s}),this}}function Yi(n,r,t){n.prototype[r]=function(e,i,a){const[o,s]=Ae(this,r,t,e,i,a);if(typeof s!="function")throw new L(`Graph.${r}: provided updater is not a function.`);return o.attributes=s(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}const Zi=[{name:n=>`get${n}Attribute`,attacher:Ui},{name:n=>`get${n}Attributes`,attacher:Mi},{name:n=>`has${n}Attribute`,attacher:Bi},{name:n=>`set${n}Attribute`,attacher:Hi},{name:n=>`update${n}Attribute`,attacher:Wi},{name:n=>`remove${n}Attribute`,attacher:Vi},{name:n=>`replace${n}Attributes`,attacher:qi},{name:n=>`merge${n}Attributes`,attacher:Ki},{name:n=>`update${n}Attributes`,attacher:Yi}];function Xi(n){Zi.forEach(function({name:r,attacher:t}){t(n,r("Node"),Vr),t(n,r("Source"),qr),t(n,r("Target"),ji),t(n,r("Opposite"),Kr)})}function Qi(n,r,t){n.prototype[r]=function(e,i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new j(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new j(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+i;if(i=arguments[2],a=fe(this,o,s,t),!a)throw new A(`Graph.${r}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new j(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new A(`Graph.${r}: could not find the "${e}" edge in the graph.`)}return a.attributes[i]}}function Ji(n,r,t){n.prototype[r]=function(e){let i;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new j(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new j(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+e,o=""+arguments[1];if(i=fe(this,a,o,t),!i)throw new A(`Graph.${r}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new j(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,i=this._edges.get(e),!i)throw new A(`Graph.${r}: could not find the "${e}" edge in the graph.`)}return i.attributes}}function en(n,r,t){n.prototype[r]=function(e,i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new j(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new j(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+i;if(i=arguments[2],a=fe(this,o,s,t),!a)throw new A(`Graph.${r}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new j(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new A(`Graph.${r}: could not find the "${e}" edge in the graph.`)}return a.attributes.hasOwnProperty(i)}}function tn(n,r,t){n.prototype[r]=function(e,i,a){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new j(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new j(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+e,u=""+i;if(i=arguments[2],a=arguments[3],o=fe(this,s,u,t),!o)throw new A(`Graph.${r}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new j(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,o=this._edges.get(e),!o)throw new A(`Graph.${r}: could not find the "${e}" edge in the graph.`)}return o.attributes[i]=a,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:i}),this}}function rn(n,r,t){n.prototype[r]=function(e,i,a){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new j(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new j(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+e,u=""+i;if(i=arguments[2],a=arguments[3],o=fe(this,s,u,t),!o)throw new A(`Graph.${r}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new j(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,o=this._edges.get(e),!o)throw new A(`Graph.${r}: could not find the "${e}" edge in the graph.`)}if(typeof a!="function")throw new L(`Graph.${r}: updater should be a function.`);return o.attributes[i]=a(o.attributes[i]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:i}),this}}function nn(n,r,t){n.prototype[r]=function(e,i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new j(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new j(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+i;if(i=arguments[2],a=fe(this,o,s,t),!a)throw new A(`Graph.${r}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new j(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new A(`Graph.${r}: could not find the "${e}" edge in the graph.`)}return delete a.attributes[i],this.emit("edgeAttributesUpdated",{key:a.key,type:"remove",attributes:a.attributes,name:i}),this}}function an(n,r,t){n.prototype[r]=function(e,i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new j(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new j(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+i;if(i=arguments[2],a=fe(this,o,s,t),!a)throw new A(`Graph.${r}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new j(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new A(`Graph.${r}: could not find the "${e}" edge in the graph.`)}if(!oe(i))throw new L(`Graph.${r}: provided attributes are not a plain object.`);return a.attributes=i,this.emit("edgeAttributesUpdated",{key:a.key,type:"replace",attributes:a.attributes}),this}}function on(n,r,t){n.prototype[r]=function(e,i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new j(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new j(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+i;if(i=arguments[2],a=fe(this,o,s,t),!a)throw new A(`Graph.${r}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new j(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new A(`Graph.${r}: could not find the "${e}" edge in the graph.`)}if(!oe(i))throw new L(`Graph.${r}: provided attributes are not a plain object.`);return te(a.attributes,i),this.emit("edgeAttributesUpdated",{key:a.key,type:"merge",attributes:a.attributes,data:i}),this}}function sn(n,r,t){n.prototype[r]=function(e,i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new j(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new j(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+i;if(i=arguments[2],a=fe(this,o,s,t),!a)throw new A(`Graph.${r}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new j(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new A(`Graph.${r}: could not find the "${e}" edge in the graph.`)}if(typeof i!="function")throw new L(`Graph.${r}: provided updater is not a function.`);return a.attributes=i(a.attributes),this.emit("edgeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}const un=[{name:n=>`get${n}Attribute`,attacher:Qi},{name:n=>`get${n}Attributes`,attacher:Ji},{name:n=>`has${n}Attribute`,attacher:en},{name:n=>`set${n}Attribute`,attacher:tn},{name:n=>`update${n}Attribute`,attacher:rn},{name:n=>`remove${n}Attribute`,attacher:nn},{name:n=>`replace${n}Attributes`,attacher:an},{name:n=>`merge${n}Attributes`,attacher:on},{name:n=>`update${n}Attributes`,attacher:sn}];function ln(n){un.forEach(function({name:r,attacher:t}){t(n,r("Edge"),"mixed"),t(n,r("DirectedEdge"),"directed"),t(n,r("UndirectedEdge"),"undirected")})}const hn=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function dn(n,r,t,e){let i=!1;for(const a in r){if(a===e)continue;const o=r[a];if(i=t(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),n&&i)return o.key}}function cn(n,r,t,e){let i,a,o,s=!1;for(const u in r)if(u!==e){i=r[u];do{if(a=i.source,o=i.target,s=t(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected),n&&s)return i.key;i=i.next}while(i!==void 0)}}function xt(n,r){const t=Object.keys(n),e=t.length;let i,a=0;return{[Symbol.iterator](){return this},next(){do if(i)i=i.next;else{if(a>=e)return{done:!0};const o=t[a++];if(o===r){i=void 0;continue}i=n[o]}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}}}}function fn(n,r,t,e){const i=r[t];if(!i)return;const a=i.source,o=i.target;if(e(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected)&&n)return i.key}function gn(n,r,t,e){let i=r[t];if(!i)return;let a=!1;do{if(a=e(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),n&&a)return i.key;i=i.next}while(i!==void 0)}function _t(n,r){let t=n[r];if(t.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!t)return{done:!0};const i={edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected};return t=t.next,{done:!1,value:i}}};let e=!1;return{[Symbol.iterator](){return this},next(){return e===!0?{done:!0}:(e=!0,{done:!1,value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected}})}}}function pn(n,r){if(n.size===0)return[];if(r==="mixed"||r===n.type)return Array.from(n._edges.keys());const t=r==="undirected"?n.undirectedSize:n.directedSize,e=new Array(t),i=r==="undirected",a=n._edges.values();let o=0,s,u;for(;s=a.next(),s.done!==!0;)u=s.value,u.undirected===i&&(e[o++]=u.key);return e}function Yr(n,r,t,e){if(r.size===0)return;const i=t!=="mixed"&&t!==r.type,a=t==="undirected";let o,s,u=!1;const l=r._edges.values();for(;o=l.next(),o.done!==!0;){if(s=o.value,i&&s.undirected!==a)continue;const{key:h,attributes:d,source:c,target:g}=s;if(u=e(h,d,c.key,g.key,c.attributes,g.attributes,s.undirected),n&&u)return h}}function mn(n,r){if(n.size===0)return Ve();const t=r!=="mixed"&&r!==n.type,e=r==="undirected",i=n._edges.values();return{[Symbol.iterator](){return this},next(){let a,o;for(;;){if(a=i.next(),a.done)return a;if(o=a.value,!(t&&o.undirected!==e))break}return{value:{edge:o.key,attributes:o.attributes,source:o.source.key,target:o.target.key,sourceAttributes:o.source.attributes,targetAttributes:o.target.attributes,undirected:o.undirected},done:!1}}}}function Ht(n,r,t,e,i,a){const o=r?cn:dn;let s;if(t!=="undirected"&&(e!=="out"&&(s=o(n,i.in,a),n&&s)||e!=="in"&&(s=o(n,i.out,a,e?void 0:i.key),n&&s))||t!=="directed"&&(s=o(n,i.undirected,a),n&&s))return s}function vn(n,r,t,e){const i=[];return Ht(!1,n,r,t,e,function(a){i.push(a)}),i}function yn(n,r,t){let e=Ve();return n!=="undirected"&&(r!=="out"&&typeof t.in<"u"&&(e=ke(e,xt(t.in))),r!=="in"&&typeof t.out<"u"&&(e=ke(e,xt(t.out,r?void 0:t.key)))),n!=="directed"&&typeof t.undirected<"u"&&(e=ke(e,xt(t.undirected))),e}function Wt(n,r,t,e,i,a,o){const s=t?gn:fn;let u;if(r!=="undirected"&&(typeof i.in<"u"&&e!=="out"&&(u=s(n,i.in,a,o),n&&u)||typeof i.out<"u"&&e!=="in"&&(e||i.key!==a)&&(u=s(n,i.out,a,o),n&&u))||r!=="directed"&&typeof i.undirected<"u"&&(u=s(n,i.undirected,a,o),n&&u))return u}function bn(n,r,t,e,i){const a=[];return Wt(!1,n,r,t,e,i,function(o){a.push(o)}),a}function wn(n,r,t,e){let i=Ve();return n!=="undirected"&&(typeof t.in<"u"&&r!=="out"&&e in t.in&&(i=ke(i,_t(t.in,e))),typeof t.out<"u"&&r!=="in"&&e in t.out&&(r||t.key!==e)&&(i=ke(i,_t(t.out,e)))),n!=="directed"&&typeof t.undirected<"u"&&e in t.undirected&&(i=ke(i,_t(t.undirected,e))),i}function En(n,r){const{name:t,type:e,direction:i}=r;n.prototype[t]=function(a,o){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return[];if(!arguments.length)return pn(this,e);if(arguments.length===1){a=""+a;const s=this._nodes.get(a);if(typeof s>"u")throw new A(`Graph.${t}: could not find the "${a}" node in the graph.`);return vn(this.multi,e==="mixed"?this.type:e,i,s)}if(arguments.length===2){a=""+a,o=""+o;const s=this._nodes.get(a);if(!s)throw new A(`Graph.${t}: could not find the "${a}" source node in the graph.`);if(!this._nodes.has(o))throw new A(`Graph.${t}: could not find the "${o}" target node in the graph.`);return bn(e,this.multi,i,s,o)}throw new L(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function xn(n,r){const{name:t,type:e,direction:i}=r,a="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(l,h,d){if(!(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)){if(arguments.length===1)return d=l,Yr(!1,this,e,d);if(arguments.length===2){l=""+l,d=h;const c=this._nodes.get(l);if(typeof c>"u")throw new A(`Graph.${a}: could not find the "${l}" node in the graph.`);return Ht(!1,this.multi,e==="mixed"?this.type:e,i,c,d)}if(arguments.length===3){l=""+l,h=""+h;const c=this._nodes.get(l);if(!c)throw new A(`Graph.${a}: could not find the "${l}" source node in the graph.`);if(!this._nodes.has(h))throw new A(`Graph.${a}: could not find the "${h}" target node in the graph.`);return Wt(!1,e,this.multi,i,c,h,d)}throw new L(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(){const l=Array.prototype.slice.call(arguments),h=l.pop();let d;if(l.length===0){let c=0;e!=="directed"&&(c+=this.undirectedSize),e!=="undirected"&&(c+=this.directedSize),d=new Array(c);let g=0;l.push((b,w,E,D,_,R,m)=>{d[g++]=h(b,w,E,D,_,R,m)})}else d=[],l.push((c,g,b,w,E,D,_)=>{d.push(h(c,g,b,w,E,D,_))});return this[a].apply(this,l),d};const s="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(){const l=Array.prototype.slice.call(arguments),h=l.pop(),d=[];return l.push((c,g,b,w,E,D,_)=>{h(c,g,b,w,E,D,_)&&d.push(c)}),this[a].apply(this,l),d};const u="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[u]=function(){let l=Array.prototype.slice.call(arguments);if(l.length<2||l.length>4)throw new L(`Graph.${u}: invalid number of arguments (expecting 2, 3 or 4 and got ${l.length}).`);if(typeof l[l.length-1]=="function"&&typeof l[l.length-2]!="function")throw new L(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let h,d;l.length===2?(h=l[0],d=l[1],l=[]):l.length===3?(h=l[1],d=l[2],l=[l[0]]):l.length===4&&(h=l[2],d=l[3],l=[l[0],l[1]]);let c=d;return l.push((g,b,w,E,D,_,R)=>{c=h(c,g,b,w,E,D,_,R)}),this[a].apply(this,l),c}}function _n(n,r){const{name:t,type:e,direction:i}=r,a="find"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(u,l,h){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return!1;if(arguments.length===1)return h=u,Yr(!0,this,e,h);if(arguments.length===2){u=""+u,h=l;const d=this._nodes.get(u);if(typeof d>"u")throw new A(`Graph.${a}: could not find the "${u}" node in the graph.`);return Ht(!0,this.multi,e==="mixed"?this.type:e,i,d,h)}if(arguments.length===3){u=""+u,l=""+l;const d=this._nodes.get(u);if(!d)throw new A(`Graph.${a}: could not find the "${u}" source node in the graph.`);if(!this._nodes.has(l))throw new A(`Graph.${a}: could not find the "${l}" target node in the graph.`);return Wt(!0,e,this.multi,i,d,l,h)}throw new L(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const o="some"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[o]=function(){const u=Array.prototype.slice.call(arguments),l=u.pop();return u.push((d,c,g,b,w,E,D)=>l(d,c,g,b,w,E,D)),!!this[a].apply(this,u)};const s="every"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[s]=function(){const u=Array.prototype.slice.call(arguments),l=u.pop();return u.push((d,c,g,b,w,E,D)=>!l(d,c,g,b,w,E,D)),!this[a].apply(this,u)}}function Cn(n,r){const{name:t,type:e,direction:i}=r,a=t.slice(0,-1)+"Entries";n.prototype[a]=function(o,s){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return Ve();if(!arguments.length)return mn(this,e);if(arguments.length===1){o=""+o;const u=this._nodes.get(o);if(!u)throw new A(`Graph.${a}: could not find the "${o}" node in the graph.`);return yn(e,i,u)}if(arguments.length===2){o=""+o,s=""+s;const u=this._nodes.get(o);if(!u)throw new A(`Graph.${a}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(s))throw new A(`Graph.${a}: could not find the "${s}" target node in the graph.`);return wn(e,i,u,s)}throw new L(`Graph.${a}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Sn(n){hn.forEach(r=>{En(n,r),xn(n,r),_n(n,r),Cn(n,r)})}const Tn=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function mt(){this.A=null,this.B=null}mt.prototype.wrap=function(n){this.A===null?this.A=n:this.B===null&&(this.B=n)};mt.prototype.has=function(n){return this.A!==null&&n in this.A||this.B!==null&&n in this.B};function Ze(n,r,t,e,i){for(const a in e){const o=e[a],s=o.source,u=o.target,l=s===t?u:s;if(r&&r.has(l.key))continue;const h=i(l.key,l.attributes);if(n&&h)return l.key}}function Vt(n,r,t,e,i){if(r!=="mixed"){if(r==="undirected")return Ze(n,null,e,e.undirected,i);if(typeof t=="string")return Ze(n,null,e,e[t],i)}const a=new mt;let o;if(r!=="undirected"){if(t!=="out"){if(o=Ze(n,null,e,e.in,i),n&&o)return o;a.wrap(e.in)}if(t!=="in"){if(o=Ze(n,a,e,e.out,i),n&&o)return o;a.wrap(e.out)}}if(r!=="directed"&&(o=Ze(n,a,e,e.undirected,i),n&&o))return o}function Rn(n,r,t){if(n!=="mixed"){if(n==="undirected")return Object.keys(t.undirected);if(typeof r=="string")return Object.keys(t[r])}const e=[];return Vt(!1,n,r,t,function(i){e.push(i)}),e}function Xe(n,r,t){const e=Object.keys(t),i=e.length;let a=0;return{[Symbol.iterator](){return this},next(){let o=null;do{if(a>=i)return n&&n.wrap(t),{done:!0};const s=t[e[a++]],u=s.source,l=s.target;if(o=u===r?l:u,n&&n.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}}}function kn(n,r,t){if(n!=="mixed"){if(n==="undirected")return Xe(null,t,t.undirected);if(typeof r=="string")return Xe(null,t,t[r])}let e=Ve();const i=new mt;return n!=="undirected"&&(r!=="out"&&(e=ke(e,Xe(i,t,t.in))),r!=="in"&&(e=ke(e,Xe(i,t,t.out)))),n!=="directed"&&(e=ke(e,Xe(i,t,t.undirected))),e}function An(n,r){const{name:t,type:e,direction:i}=r;n.prototype[t]=function(a){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return[];a=""+a;const o=this._nodes.get(a);if(typeof o>"u")throw new A(`Graph.${t}: could not find the "${a}" node in the graph.`);return Rn(e==="mixed"?this.type:e,i,o)}}function Dn(n,r){const{name:t,type:e,direction:i}=r,a="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(l,h){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return;l=""+l;const d=this._nodes.get(l);if(typeof d>"u")throw new A(`Graph.${a}: could not find the "${l}" node in the graph.`);Vt(!1,e==="mixed"?this.type:e,i,d,h)};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(l,h){const d=[];return this[a](l,(c,g)=>{d.push(h(c,g))}),d};const s="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(l,h){const d=[];return this[a](l,(c,g)=>{h(c,g)&&d.push(c)}),d};const u="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[u]=function(l,h,d){if(arguments.length<3)throw new L(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let c=d;return this[a](l,(g,b)=>{c=h(c,g,b)}),c}}function Ln(n,r){const{name:t,type:e,direction:i}=r,a=t[0].toUpperCase()+t.slice(1,-1),o="find"+a;n.prototype[o]=function(l,h){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return;l=""+l;const d=this._nodes.get(l);if(typeof d>"u")throw new A(`Graph.${o}: could not find the "${l}" node in the graph.`);return Vt(!0,e==="mixed"?this.type:e,i,d,h)};const s="some"+a;n.prototype[s]=function(l,h){return!!this[o](l,h)};const u="every"+a;n.prototype[u]=function(l,h){return!this[o](l,(c,g)=>!h(c,g))}}function Nn(n,r){const{name:t,type:e,direction:i}=r,a=t.slice(0,-1)+"Entries";n.prototype[a]=function(o){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return Ve();o=""+o;const s=this._nodes.get(o);if(typeof s>"u")throw new A(`Graph.${a}: could not find the "${o}" node in the graph.`);return kn(e==="mixed"?this.type:e,i,s)}}function Gn(n){Tn.forEach(r=>{An(n,r),Dn(n,r),Ln(n,r),Nn(n,r)})}function ut(n,r,t,e,i){const a=e._nodes.values(),o=e.type;let s,u,l,h,d,c;for(;s=a.next(),s.done!==!0;){let g=!1;if(u=s.value,o!=="undirected"){h=u.out;for(l in h){d=h[l];do c=d.target,g=!0,i(u.key,c.key,u.attributes,c.attributes,d.key,d.attributes,d.undirected),d=d.next;while(d)}}if(o!=="directed"){h=u.undirected;for(l in h)if(!(r&&u.key>l)){d=h[l];do c=d.target,c.key!==l&&(c=d.source),g=!0,i(u.key,c.key,u.attributes,c.attributes,d.key,d.attributes,d.undirected),d=d.next;while(d)}}t&&!g&&i(u.key,null,u.attributes,null,null,null,null)}}function Fn(n,r){const t={key:n};return Mr(r.attributes)||(t.attributes=te({},r.attributes)),t}function Pn(n,r,t){const e={key:r,source:t.source.key,target:t.target.key};return Mr(t.attributes)||(e.attributes=te({},t.attributes)),n==="mixed"&&t.undirected&&(e.undirected=!0),e}function In(n){if(!oe(n))throw new L('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in n))throw new L("Graph.import: serialized node is missing its key.");if("attributes"in n&&(!oe(n.attributes)||n.attributes===null))throw new L("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function On(n){if(!oe(n))throw new L('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in n))throw new L("Graph.import: serialized edge is missing its source.");if(!("target"in n))throw new L("Graph.import: serialized edge is missing its target.");if("attributes"in n&&(!oe(n.attributes)||n.attributes===null))throw new L("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in n&&typeof n.undirected!="boolean")throw new L("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const zn=$i(),$n=new Set(["directed","undirected","mixed"]),Jt=new Set(["domain","_events","_eventsCount","_maxListeners"]),jn=[{name:n=>`${n}Edge`,generateKey:!0},{name:n=>`${n}DirectedEdge`,generateKey:!0,type:"directed"},{name:n=>`${n}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:n=>`${n}EdgeWithKey`},{name:n=>`${n}DirectedEdgeWithKey`,type:"directed"},{name:n=>`${n}UndirectedEdgeWithKey`,type:"undirected"}],Un={allowSelfLoops:!0,multi:!1,type:"mixed"};function Mn(n,r,t){if(t&&!oe(t))throw new L(`Graph.addNode: invalid attributes. Expecting an object but got "${t}"`);if(r=""+r,t=t||{},n._nodes.has(r))throw new j(`Graph.addNode: the "${r}" node already exist in the graph.`);const e=new n.NodeDataClass(r,t);return n._nodes.set(r,e),n.emit("nodeAdded",{key:r,attributes:t}),e}function er(n,r,t){const e=new n.NodeDataClass(r,t);return n._nodes.set(r,e),n.emit("nodeAdded",{key:r,attributes:t}),e}function Zr(n,r,t,e,i,a,o,s){if(!e&&n.type==="undirected")throw new j(`Graph.${r}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(e&&n.type==="directed")throw new j(`Graph.${r}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(s&&!oe(s))throw new L(`Graph.${r}: invalid attributes. Expecting an object but got "${s}"`);if(a=""+a,o=""+o,s=s||{},!n.allowSelfLoops&&a===o)throw new j(`Graph.${r}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const u=n._nodes.get(a),l=n._nodes.get(o);if(!u)throw new A(`Graph.${r}: source node "${a}" not found.`);if(!l)throw new A(`Graph.${r}: target node "${o}" not found.`);const h={key:null,undirected:e,source:a,target:o,attributes:s};if(t)i=n._edgeKeyGenerator();else if(i=""+i,n._edges.has(i))throw new j(`Graph.${r}: the "${i}" edge already exists in the graph.`);if(!n.multi&&(e?typeof u.undirected[o]<"u":typeof u.out[o]<"u"))throw new j(`Graph.${r}: an edge linking "${a}" to "${o}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const d=new qe(e,i,u,l,s);n._edges.set(i,d);const c=a===o;return e?(u.undirectedDegree++,l.undirectedDegree++,c&&(u.undirectedLoops++,n._undirectedSelfLoopCount++)):(u.outDegree++,l.inDegree++,c&&(u.directedLoops++,n._directedSelfLoopCount++)),n.multi?d.attachMulti():d.attach(),e?n._undirectedSize++:n._directedSize++,h.key=i,n.emit("edgeAdded",h),i}function Bn(n,r,t,e,i,a,o,s,u){if(!e&&n.type==="undirected")throw new j(`Graph.${r}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(e&&n.type==="directed")throw new j(`Graph.${r}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(s){if(u){if(typeof s!="function")throw new L(`Graph.${r}: invalid updater function. Expecting a function but got "${s}"`)}else if(!oe(s))throw new L(`Graph.${r}: invalid attributes. Expecting an object but got "${s}"`)}a=""+a,o=""+o;let l;if(u&&(l=s,s=void 0),!n.allowSelfLoops&&a===o)throw new j(`Graph.${r}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let h=n._nodes.get(a),d=n._nodes.get(o),c,g;if(!t&&(c=n._edges.get(i),c)){if((c.source.key!==a||c.target.key!==o)&&(!e||c.source.key!==o||c.target.key!==a))throw new j(`Graph.${r}: inconsistency detected when attempting to merge the "${i}" edge with "${a}" source & "${o}" target vs. ("${c.source.key}", "${c.target.key}").`);g=c}if(!g&&!n.multi&&h&&(g=e?h.undirected[o]:h.out[o]),g){const _=[g.key,!1,!1,!1];if(u?!l:!s)return _;if(u){const R=g.attributes;g.attributes=l(R),n.emit("edgeAttributesUpdated",{type:"replace",key:g.key,attributes:g.attributes})}else te(g.attributes,s),n.emit("edgeAttributesUpdated",{type:"merge",key:g.key,attributes:g.attributes,data:s});return _}s=s||{},u&&l&&(s=l(s));const b={key:null,undirected:e,source:a,target:o,attributes:s};if(t)i=n._edgeKeyGenerator();else if(i=""+i,n._edges.has(i))throw new j(`Graph.${r}: the "${i}" edge already exists in the graph.`);let w=!1,E=!1;h||(h=er(n,a,{}),w=!0,a===o&&(d=h,E=!0)),d||(d=er(n,o,{}),E=!0),c=new qe(e,i,h,d,s),n._edges.set(i,c);const D=a===o;return e?(h.undirectedDegree++,d.undirectedDegree++,D&&(h.undirectedLoops++,n._undirectedSelfLoopCount++)):(h.outDegree++,d.inDegree++,D&&(h.directedLoops++,n._directedSelfLoopCount++)),n.multi?c.attachMulti():c.attach(),e?n._undirectedSize++:n._directedSize++,b.key=i,n.emit("edgeAdded",b),[i,!0,w,E]}function Me(n,r){n._edges.delete(r.key);const{source:t,target:e,attributes:i}=r,a=r.undirected,o=t===e;a?(t.undirectedDegree--,e.undirectedDegree--,o&&(t.undirectedLoops--,n._undirectedSelfLoopCount--)):(t.outDegree--,e.inDegree--,o&&(t.directedLoops--,n._directedSelfLoopCount--)),n.multi?r.detachMulti():r.detach(),a?n._undirectedSize--:n._directedSize--,n.emit("edgeDropped",{key:r.key,attributes:i,source:t.key,target:e.key,undirected:a})}class X extends Ur.EventEmitter{constructor(r){if(super(),r=te({},Un,r),typeof r.multi!="boolean")throw new L(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${r.multi}".`);if(!$n.has(r.type))throw new L(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${r.type}".`);if(typeof r.allowSelfLoops!="boolean")throw new L(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${r.allowSelfLoops}".`);const t=r.type==="mixed"?Br:r.type==="directed"?Hr:Wr;de(this,"NodeDataClass",t);const e="geid_"+zn()+"_";let i=0;const a=()=>{let o;do o=e+i++;while(this._edges.has(o));return o};de(this,"_attributes",{}),de(this,"_nodes",new Map),de(this,"_edges",new Map),de(this,"_directedSize",0),de(this,"_undirectedSize",0),de(this,"_directedSelfLoopCount",0),de(this,"_undirectedSelfLoopCount",0),de(this,"_edgeKeyGenerator",a),de(this,"_options",r),Jt.forEach(o=>de(this,o,this[o])),ve(this,"order",()=>this._nodes.size),ve(this,"size",()=>this._edges.size),ve(this,"directedSize",()=>this._directedSize),ve(this,"undirectedSize",()=>this._undirectedSize),ve(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),ve(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),ve(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),ve(this,"multi",this._options.multi),ve(this,"type",this._options.type),ve(this,"allowSelfLoops",this._options.allowSelfLoops),ve(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(r){return this._nodes.has(""+r)}hasDirectedEdge(r,t){if(this.type==="undirected")return!1;if(arguments.length===1){const e=""+r,i=this._edges.get(e);return!!i&&!i.undirected}else if(arguments.length===2){r=""+r,t=""+t;const e=this._nodes.get(r);return e?e.out.hasOwnProperty(t):!1}throw new L(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(r,t){if(this.type==="directed")return!1;if(arguments.length===1){const e=""+r,i=this._edges.get(e);return!!i&&i.undirected}else if(arguments.length===2){r=""+r,t=""+t;const e=this._nodes.get(r);return e?e.undirected.hasOwnProperty(t):!1}throw new L(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(r,t){if(arguments.length===1){const e=""+r;return this._edges.has(e)}else if(arguments.length===2){r=""+r,t=""+t;const e=this._nodes.get(r);return e?typeof e.out<"u"&&e.out.hasOwnProperty(t)||typeof e.undirected<"u"&&e.undirected.hasOwnProperty(t):!1}throw new L(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(r,t){if(this.type==="undirected")return;if(r=""+r,t=""+t,this.multi)throw new j("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const e=this._nodes.get(r);if(!e)throw new A(`Graph.directedEdge: could not find the "${r}" source node in the graph.`);if(!this._nodes.has(t))throw new A(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const i=e.out&&e.out[t]||void 0;if(i)return i.key}undirectedEdge(r,t){if(this.type==="directed")return;if(r=""+r,t=""+t,this.multi)throw new j("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const e=this._nodes.get(r);if(!e)throw new A(`Graph.undirectedEdge: could not find the "${r}" source node in the graph.`);if(!this._nodes.has(t))throw new A(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const i=e.undirected&&e.undirected[t]||void 0;if(i)return i.key}edge(r,t){if(this.multi)throw new j("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new A(`Graph.edge: could not find the "${r}" source node in the graph.`);if(!this._nodes.has(t))throw new A(`Graph.edge: could not find the "${t}" target node in the graph.`);const i=e.out&&e.out[t]||e.undirected&&e.undirected[t]||void 0;if(i)return i.key}areDirectedNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new A(`Graph.areDirectedNeighbors: could not find the "${r}" node in the graph.`);return this.type==="undirected"?!1:t in e.in||t in e.out}areOutNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new A(`Graph.areOutNeighbors: could not find the "${r}" node in the graph.`);return this.type==="undirected"?!1:t in e.out}areInNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new A(`Graph.areInNeighbors: could not find the "${r}" node in the graph.`);return this.type==="undirected"?!1:t in e.in}areUndirectedNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new A(`Graph.areUndirectedNeighbors: could not find the "${r}" node in the graph.`);return this.type==="directed"?!1:t in e.undirected}areNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new A(`Graph.areNeighbors: could not find the "${r}" node in the graph.`);return this.type!=="undirected"&&(t in e.in||t in e.out)||this.type!=="directed"&&t in e.undirected}areInboundNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new A(`Graph.areInboundNeighbors: could not find the "${r}" node in the graph.`);return this.type!=="undirected"&&t in e.in||this.type!=="directed"&&t in e.undirected}areOutboundNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new A(`Graph.areOutboundNeighbors: could not find the "${r}" node in the graph.`);return this.type!=="undirected"&&t in e.out||this.type!=="directed"&&t in e.undirected}inDegree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.inDegree: could not find the "${r}" node in the graph.`);return this.type==="undirected"?0:t.inDegree}outDegree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.outDegree: could not find the "${r}" node in the graph.`);return this.type==="undirected"?0:t.outDegree}directedDegree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.directedDegree: could not find the "${r}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree}undirectedDegree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.undirectedDegree: could not find the "${r}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree}inboundDegree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.inboundDegree: could not find the "${r}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.inDegree),e}outboundDegree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.outboundDegree: could not find the "${r}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.outDegree),e}degree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.degree: could not find the "${r}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.inDegree+t.outDegree),e}inDegreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.inDegreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);return this.type==="undirected"?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.outDegreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);return this.type==="undirected"?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.directedDegreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);let e=0,i=0;return this.type!=="directed"&&(e+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.inDegree,i+=t.directedLoops),e-i}outboundDegreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);let e=0,i=0;return this.type!=="directed"&&(e+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.outDegree,i+=t.directedLoops),e-i}degreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.degreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);let e=0,i=0;return this.type!=="directed"&&(e+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.inDegree+t.outDegree,i+=t.directedLoops*2),e-i}source(r){r=""+r;const t=this._edges.get(r);if(!t)throw new A(`Graph.source: could not find the "${r}" edge in the graph.`);return t.source.key}target(r){r=""+r;const t=this._edges.get(r);if(!t)throw new A(`Graph.target: could not find the "${r}" edge in the graph.`);return t.target.key}extremities(r){r=""+r;const t=this._edges.get(r);if(!t)throw new A(`Graph.extremities: could not find the "${r}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(r,t){r=""+r,t=""+t;const e=this._edges.get(t);if(!e)throw new A(`Graph.opposite: could not find the "${t}" edge in the graph.`);const i=e.source.key,a=e.target.key;if(r===i)return a;if(r===a)return i;throw new A(`Graph.opposite: the "${r}" node is not attached to the "${t}" edge (${i}, ${a}).`)}hasExtremity(r,t){r=""+r,t=""+t;const e=this._edges.get(r);if(!e)throw new A(`Graph.hasExtremity: could not find the "${r}" edge in the graph.`);return e.source.key===t||e.target.key===t}isUndirected(r){r=""+r;const t=this._edges.get(r);if(!t)throw new A(`Graph.isUndirected: could not find the "${r}" edge in the graph.`);return t.undirected}isDirected(r){r=""+r;const t=this._edges.get(r);if(!t)throw new A(`Graph.isDirected: could not find the "${r}" edge in the graph.`);return!t.undirected}isSelfLoop(r){r=""+r;const t=this._edges.get(r);if(!t)throw new A(`Graph.isSelfLoop: could not find the "${r}" edge in the graph.`);return t.source===t.target}addNode(r,t){return Mn(this,r,t).key}mergeNode(r,t){if(t&&!oe(t))throw new L(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);r=""+r,t=t||{};let e=this._nodes.get(r);return e?(t&&(te(e.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:r,attributes:e.attributes,data:t})),[r,!1]):(e=new this.NodeDataClass(r,t),this._nodes.set(r,e),this.emit("nodeAdded",{key:r,attributes:t}),[r,!0])}updateNode(r,t){if(t&&typeof t!="function")throw new L(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);r=""+r;let e=this._nodes.get(r);if(e){if(t){const a=e.attributes;e.attributes=t(a),this.emit("nodeAttributesUpdated",{type:"replace",key:r,attributes:e.attributes})}return[r,!1]}const i=t?t({}):{};return e=new this.NodeDataClass(r,i),this._nodes.set(r,e),this.emit("nodeAdded",{key:r,attributes:i}),[r,!0]}dropNode(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new A(`Graph.dropNode: could not find the "${r}" node in the graph.`);let e;if(this.type!=="undirected"){for(const i in t.out){e=t.out[i];do Me(this,e),e=e.next;while(e)}for(const i in t.in){e=t.in[i];do Me(this,e),e=e.next;while(e)}}if(this.type!=="directed")for(const i in t.undirected){e=t.undirected[i];do Me(this,e),e=e.next;while(e)}this._nodes.delete(r),this.emit("nodeDropped",{key:r,attributes:t.attributes})}dropEdge(r){let t;if(arguments.length>1){const e=""+arguments[0],i=""+arguments[1];if(t=fe(this,e,i,this.type),!t)throw new A(`Graph.dropEdge: could not find the "${e}" -> "${i}" edge in the graph.`)}else if(r=""+r,t=this._edges.get(r),!t)throw new A(`Graph.dropEdge: could not find the "${r}" edge in the graph.`);return Me(this,t),this}dropDirectedEdge(r,t){if(arguments.length<2)throw new j("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new j("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");r=""+r,t=""+t;const e=fe(this,r,t,"directed");if(!e)throw new A(`Graph.dropDirectedEdge: could not find a "${r}" -> "${t}" edge in the graph.`);return Me(this,e),this}dropUndirectedEdge(r,t){if(arguments.length<2)throw new j("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new j("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const e=fe(this,r,t,"undirected");if(!e)throw new A(`Graph.dropUndirectedEdge: could not find a "${r}" -> "${t}" edge in the graph.`);return Me(this,e),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const r=this._nodes.values();let t;for(;t=r.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(r){return this._attributes[r]}getAttributes(){return this._attributes}hasAttribute(r){return this._attributes.hasOwnProperty(r)}setAttribute(r,t){return this._attributes[r]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:r}),this}updateAttribute(r,t){if(typeof t!="function")throw new L("Graph.updateAttribute: updater should be a function.");const e=this._attributes[r];return this._attributes[r]=t(e),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:r}),this}removeAttribute(r){return delete this._attributes[r],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:r}),this}replaceAttributes(r){if(!oe(r))throw new L("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=r,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(r){if(!oe(r))throw new L("Graph.mergeAttributes: provided attributes are not a plain object.");return te(this._attributes,r),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:r}),this}updateAttributes(r){if(typeof r!="function")throw new L("Graph.updateAttributes: provided updater is not a function.");return this._attributes=r(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(r,t){if(typeof r!="function")throw new L("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!Qt(t))throw new L("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const e=this._nodes.values();let i,a;for(;i=e.next(),i.done!==!0;)a=i.value,a.attributes=r(a.key,a.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(r,t){if(typeof r!="function")throw new L("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!Qt(t))throw new L("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const e=this._edges.values();let i,a,o,s;for(;i=e.next(),i.done!==!0;)a=i.value,o=a.source,s=a.target,a.attributes=r(a.key,a.attributes,o.key,s.key,o.attributes,s.attributes,a.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(r){if(typeof r!="function")throw new L("Graph.forEachAdjacencyEntry: expecting a callback.");ut(!1,!1,!1,this,r)}forEachAdjacencyEntryWithOrphans(r){if(typeof r!="function")throw new L("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");ut(!1,!1,!0,this,r)}forEachAssymetricAdjacencyEntry(r){if(typeof r!="function")throw new L("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");ut(!1,!0,!1,this,r)}forEachAssymetricAdjacencyEntryWithOrphans(r){if(typeof r!="function")throw new L("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");ut(!1,!0,!0,this,r)}nodes(){return Array.from(this._nodes.keys())}forEachNode(r){if(typeof r!="function")throw new L("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let e,i;for(;e=t.next(),e.done!==!0;)i=e.value,r(i.key,i.attributes)}findNode(r){if(typeof r!="function")throw new L("Graph.findNode: expecting a callback.");const t=this._nodes.values();let e,i;for(;e=t.next(),e.done!==!0;)if(i=e.value,r(i.key,i.attributes))return i.key}mapNodes(r){if(typeof r!="function")throw new L("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let e,i;const a=new Array(this.order);let o=0;for(;e=t.next(),e.done!==!0;)i=e.value,a[o++]=r(i.key,i.attributes);return a}someNode(r){if(typeof r!="function")throw new L("Graph.someNode: expecting a callback.");const t=this._nodes.values();let e,i;for(;e=t.next(),e.done!==!0;)if(i=e.value,r(i.key,i.attributes))return!0;return!1}everyNode(r){if(typeof r!="function")throw new L("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let e,i;for(;e=t.next(),e.done!==!0;)if(i=e.value,!r(i.key,i.attributes))return!1;return!0}filterNodes(r){if(typeof r!="function")throw new L("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let e,i;const a=[];for(;e=t.next(),e.done!==!0;)i=e.value,r(i.key,i.attributes)&&a.push(i.key);return a}reduceNodes(r,t){if(typeof r!="function")throw new L("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new L("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let e=t;const i=this._nodes.values();let a,o;for(;a=i.next(),a.done!==!0;)o=a.value,e=r(e,o.key,o.attributes);return e}nodeEntries(){const r=this._nodes.values();return{[Symbol.iterator](){return this},next(){const t=r.next();if(t.done)return t;const e=t.value;return{value:{node:e.key,attributes:e.attributes},done:!1}}}}export(){const r=new Array(this._nodes.size);let t=0;this._nodes.forEach((i,a)=>{r[t++]=Fn(a,i)});const e=new Array(this._edges.size);return t=0,this._edges.forEach((i,a)=>{e[t++]=Pn(this.type,a,i)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:r,edges:e}}import(r,t=!1){if(r instanceof X)return r.forEachNode((u,l)=>{t?this.mergeNode(u,l):this.addNode(u,l)}),r.forEachEdge((u,l,h,d,c,g,b)=>{t?b?this.mergeUndirectedEdgeWithKey(u,h,d,l):this.mergeDirectedEdgeWithKey(u,h,d,l):b?this.addUndirectedEdgeWithKey(u,h,d,l):this.addDirectedEdgeWithKey(u,h,d,l)}),this;if(!oe(r))throw new L("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(r.attributes){if(!oe(r.attributes))throw new L("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(r.attributes):this.replaceAttributes(r.attributes)}let e,i,a,o,s;if(r.nodes){if(a=r.nodes,!Array.isArray(a))throw new L("Graph.import: invalid nodes. Expecting an array.");for(e=0,i=a.length;e<i;e++){o=a[e],In(o);const{key:u,attributes:l}=o;t?this.mergeNode(u,l):this.addNode(u,l)}}if(r.edges){let u=!1;if(this.type==="undirected"&&(u=!0),a=r.edges,!Array.isArray(a))throw new L("Graph.import: invalid edges. Expecting an array.");for(e=0,i=a.length;e<i;e++){s=a[e],On(s);const{source:l,target:h,attributes:d,undirected:c=u}=s;let g;"key"in s?(g=t?c?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:c?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,g.call(this,s.key,l,h,d)):(g=t?c?this.mergeUndirectedEdge:this.mergeDirectedEdge:c?this.addUndirectedEdge:this.addDirectedEdge,g.call(this,l,h,d))}}return this}nullCopy(r){const t=new X(te({},this._options,r));return t.replaceAttributes(te({},this.getAttributes())),t}emptyCopy(r){const t=this.nullCopy(r);return this._nodes.forEach((e,i)=>{const a=te({},e.attributes);e=new t.NodeDataClass(i,a),t._nodes.set(i,e)}),t}copy(r){if(r=r||{},typeof r.type=="string"&&r.type!==this.type&&r.type!=="mixed")throw new j(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${r.type}" because this would mean losing information about the current graph.`);if(typeof r.multi=="boolean"&&r.multi!==this.multi&&r.multi!==!0)throw new j("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof r.allowSelfLoops=="boolean"&&r.allowSelfLoops!==this.allowSelfLoops&&r.allowSelfLoops!==!0)throw new j("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const t=this.emptyCopy(r),e=this._edges.values();let i,a;for(;i=e.next(),i.done!==!0;)a=i.value,Zr(t,"copy",!1,a.undirected,a.key,a.source.key,a.target.key,te({},a.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const r={};this._nodes.forEach((a,o)=>{r[o]=a.attributes});const t={},e={};this._edges.forEach((a,o)=>{const s=a.undirected?"--":"->";let u="",l=a.source.key,h=a.target.key,d;a.undirected&&l>h&&(d=l,l=h,h=d);const c=`(${l})${s}(${h})`;o.startsWith("geid_")?this.multi&&(typeof e[c]>"u"?e[c]=0:e[c]++,u+=`${e[c]}. `):u+=`[${o}]: `,u+=c,t[u]=a.attributes});const i={};for(const a in this)this.hasOwnProperty(a)&&!Jt.has(a)&&typeof this[a]!="function"&&typeof a!="symbol"&&(i[a]=this[a]);return i.attributes=this._attributes,i.nodes=r,i.edges=t,de(i,"constructor",this.constructor),i}}typeof Symbol<"u"&&(X.prototype[Symbol.for("nodejs.util.inspect.custom")]=X.prototype.inspect);jn.forEach(n=>{["add","merge","update"].forEach(r=>{const t=n.name(r),e=r==="add"?Zr:Bn;n.generateKey?X.prototype[t]=function(i,a,o){return e(this,t,!0,(n.type||this.type)==="undirected",null,i,a,o,r==="update")}:X.prototype[t]=function(i,a,o,s){return e(this,t,!1,(n.type||this.type)==="undirected",i,a,o,s,r==="update")}})});Xi(X);ln(X);Sn(X);Gn(X);class Xr extends X{constructor(r){const t=te({type:"directed"},r);if("multi"in t&&t.multi!==!1)throw new L("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new L('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Qr extends X{constructor(r){const t=te({type:"undirected"},r);if("multi"in t&&t.multi!==!1)throw new L("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new L('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Jr extends X{constructor(r){const t=te({multi:!0},r);if("multi"in t&&t.multi!==!0)throw new L("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class ei extends X{constructor(r){const t=te({type:"directed",multi:!0},r);if("multi"in t&&t.multi!==!0)throw new L("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new L('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class ti extends X{constructor(r){const t=te({type:"undirected",multi:!0},r);if("multi"in t&&t.multi!==!0)throw new L("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new L('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function Ke(n){n.from=function(r,t){const e=te({},r.options,t),i=new n(e);return i.import(r),i}}Ke(X);Ke(Xr);Ke(Qr);Ke(Jr);Ke(ei);Ke(ti);X.Graph=X;X.DirectedGraph=Xr;X.UndirectedGraph=Qr;X.MultiGraph=Jr;X.MultiDirectedGraph=ei;X.MultiUndirectedGraph=ti;X.InvalidArgumentsGraphError=L;X.NotFoundGraphError=A;X.UsageGraphError=j;function Hn(n,r){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var e=t.call(n,r);if(typeof e!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}function it(n){var r=Hn(n,"string");return typeof r=="symbol"?r:r+""}function re(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")}function tr(n,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(n,it(e.key),e)}}function ie(n,r,t){return r&&tr(n.prototype,r),t&&tr(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n}function He(n){return He=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},He(n)}function ri(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ri=function(){return!!n})()}function Wn(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function Vn(n,r){if(r&&(typeof r=="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Wn(n)}function le(n,r,t){return r=He(r),Vn(n,ri()?Reflect.construct(r,t||[],He(n).constructor):r.apply(n,t))}function It(n,r){return It=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},It(n,r)}function he(n,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(r&&r.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),r&&It(n,r)}function qn(n){if(Array.isArray(n))return n}function Kn(n,r){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var e,i,a,o,s=[],u=!0,l=!1;try{if(a=(t=t.call(n)).next,r===0){if(Object(t)!==t)return;u=!1}else for(;!(u=(e=a.call(t)).done)&&(s.push(e.value),s.length!==r);u=!0);}catch(h){l=!0,i=h}finally{try{if(!u&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Ot(n,r){(r==null||r>n.length)&&(r=n.length);for(var t=0,e=Array(r);t<r;t++)e[t]=n[t];return e}function ii(n,r){if(n){if(typeof n=="string")return Ot(n,r);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ot(n,r):void 0}}function Yn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function We(n,r){return qn(n)||Kn(n,r)||ii(n,r)||Yn()}var Ct={black:"#000000",silver:"#C0C0C0",gray:"#808080",grey:"#808080",white:"#FFFFFF",maroon:"#800000",red:"#FF0000",purple:"#800080",fuchsia:"#FF00FF",green:"#008000",lime:"#00FF00",olive:"#808000",yellow:"#FFFF00",navy:"#000080",blue:"#0000FF",teal:"#008080",aqua:"#00FFFF",darkblue:"#00008B",mediumblue:"#0000CD",darkgreen:"#006400",darkcyan:"#008B8B",deepskyblue:"#00BFFF",darkturquoise:"#00CED1",mediumspringgreen:"#00FA9A",springgreen:"#00FF7F",cyan:"#00FFFF",midnightblue:"#191970",dodgerblue:"#1E90FF",lightseagreen:"#20B2AA",forestgreen:"#228B22",seagreen:"#2E8B57",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",limegreen:"#32CD32",mediumseagreen:"#3CB371",turquoise:"#40E0D0",royalblue:"#4169E1",steelblue:"#4682B4",darkslateblue:"#483D8B",mediumturquoise:"#48D1CC",indigo:"#4B0082",darkolivegreen:"#556B2F",cadetblue:"#5F9EA0",cornflowerblue:"#6495ED",rebeccapurple:"#663399",mediumaquamarine:"#66CDAA",dimgray:"#696969",dimgrey:"#696969",slateblue:"#6A5ACD",olivedrab:"#6B8E23",slategray:"#708090",slategrey:"#708090",lightslategray:"#778899",lightslategrey:"#778899",mediumslateblue:"#7B68EE",lawngreen:"#7CFC00",chartreuse:"#7FFF00",aquamarine:"#7FFFD4",skyblue:"#87CEEB",lightskyblue:"#87CEFA",blueviolet:"#8A2BE2",darkred:"#8B0000",darkmagenta:"#8B008B",saddlebrown:"#8B4513",darkseagreen:"#8FBC8F",lightgreen:"#90EE90",mediumpurple:"#9370DB",darkviolet:"#9400D3",palegreen:"#98FB98",darkorchid:"#9932CC",yellowgreen:"#9ACD32",sienna:"#A0522D",brown:"#A52A2A",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",lightblue:"#ADD8E6",greenyellow:"#ADFF2F",paleturquoise:"#AFEEEE",lightsteelblue:"#B0C4DE",powderblue:"#B0E0E6",firebrick:"#B22222",darkgoldenrod:"#B8860B",mediumorchid:"#BA55D3",rosybrown:"#BC8F8F",darkkhaki:"#BDB76B",mediumvioletred:"#C71585",indianred:"#CD5C5C",peru:"#CD853F",chocolate:"#D2691E",tan:"#D2B48C",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",thistle:"#D8BFD8",orchid:"#DA70D6",goldenrod:"#DAA520",palevioletred:"#DB7093",crimson:"#DC143C",gainsboro:"#DCDCDC",plum:"#DDA0DD",burlywood:"#DEB887",lightcyan:"#E0FFFF",lavender:"#E6E6FA",darksalmon:"#E9967A",violet:"#EE82EE",palegoldenrod:"#EEE8AA",lightcoral:"#F08080",khaki:"#F0E68C",aliceblue:"#F0F8FF",honeydew:"#F0FFF0",azure:"#F0FFFF",sandybrown:"#F4A460",wheat:"#F5DEB3",beige:"#F5F5DC",whitesmoke:"#F5F5F5",mintcream:"#F5FFFA",ghostwhite:"#F8F8FF",salmon:"#FA8072",antiquewhite:"#FAEBD7",linen:"#FAF0E6",lightgoldenrodyellow:"#FAFAD2",oldlace:"#FDF5E6",magenta:"#FF00FF",deeppink:"#FF1493",orangered:"#FF4500",tomato:"#FF6347",hotpink:"#FF69B4",coral:"#FF7F50",darkorange:"#FF8C00",lightsalmon:"#FFA07A",orange:"#FFA500",lightpink:"#FFB6C1",pink:"#FFC0CB",gold:"#FFD700",peachpuff:"#FFDAB9",navajowhite:"#FFDEAD",moccasin:"#FFE4B5",bisque:"#FFE4C4",mistyrose:"#FFE4E1",blanchedalmond:"#FFEBCD",papayawhip:"#FFEFD5",lavenderblush:"#FFF0F5",seashell:"#FFF5EE",cornsilk:"#FFF8DC",lemonchiffon:"#FFFACD",floralwhite:"#FFFAF0",snow:"#FFFAFA",lightyellow:"#FFFFE0",ivory:"#FFFFF0"},ni=new Int8Array(4),St=new Int32Array(ni.buffer,0,1),Zn=new Float32Array(ni.buffer,0,1),Xn=/^\s*rgba?\s*\(/,Qn=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)(?:\s*,\s*(.*)?)?\)\s*$/;function Jn(n){var r=0,t=0,e=0,i=1;if(n[0]==="#")n.length===4?(r=parseInt(n.charAt(1)+n.charAt(1),16),t=parseInt(n.charAt(2)+n.charAt(2),16),e=parseInt(n.charAt(3)+n.charAt(3),16)):(r=parseInt(n.charAt(1)+n.charAt(2),16),t=parseInt(n.charAt(3)+n.charAt(4),16),e=parseInt(n.charAt(5)+n.charAt(6),16)),n.length===9&&(i=parseInt(n.charAt(7)+n.charAt(8),16)/255);else if(Xn.test(n)){var a=n.match(Qn);a&&(r=+a[1],t=+a[2],e=+a[3],a[4]&&(i=+a[4]))}return{r,g:t,b:e,a:i}}var Be={};for(var lt in Ct)Be[lt]=$e(Ct[lt]),Be[Ct[lt]]=Be[lt];function ai(n,r,t,e,i){return St[0]=e<<24|t<<16|r<<8|n,St[0]=St[0]&4278190079,Zn[0]}function $e(n){if(n=n.toLowerCase(),typeof Be[n]<"u")return Be[n];var r=Jn(n),t=r.r,e=r.g,i=r.b,a=r.a;a=a*255|0;var o=ai(t,e,i,a);return Be[n]=o,o}var Tt={};function oi(n){if(typeof Tt[n]<"u")return Tt[n];var r=(n&16711680)>>>16,t=(n&65280)>>>8,e=n&255,i=255,a=ai(r,t,e,i);return Tt[n]=a,a}function rr(n,r,t,e){return t+(r<<8)+(n<<16)}function ir(n,r,t,e,i,a){var o=Math.floor(t/a*i),s=Math.floor(n.drawingBufferHeight/a-e/a*i),u=new Uint8Array(4);n.bindFramebuffer(n.FRAMEBUFFER,r),n.readPixels(o,s,1,1,n.RGBA,n.UNSIGNED_BYTE,u);var l=We(u,4),h=l[0],d=l[1],c=l[2],g=l[3];return[h,d,c,g]}function T(n,r,t){return(r=it(r))in n?Object.defineProperty(n,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[r]=t,n}function nr(n,r){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);r&&(e=e.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,e)}return t}function F(n){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?nr(Object(t),!0).forEach(function(e){T(n,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):nr(Object(t)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})}return n}function ea(n,r){for(;!{}.hasOwnProperty.call(n,r)&&(n=He(n))!==null;);return n}function zt(){return zt=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(n,r,t){var e=ea(n,r);if(e){var i=Object.getOwnPropertyDescriptor(e,r);return i.get?i.get.call(arguments.length<3?n:t):i.value}},zt.apply(null,arguments)}function si(n,r,t,e){var i=zt(He(n.prototype),r,t);return typeof i=="function"?function(a){return i.apply(t,a)}:i}function ta(n){return n.normalized?1:n.size}function Rt(n){var r=0;return n.forEach(function(t){return r+=ta(t)}),r}function ui(n,r,t){var e=n==="VERTEX"?r.VERTEX_SHADER:r.FRAGMENT_SHADER,i=r.createShader(e);if(i===null)throw new Error("loadShader: error while creating the shader");r.shaderSource(i,t),r.compileShader(i);var a=r.getShaderParameter(i,r.COMPILE_STATUS);if(!a){var o=r.getShaderInfoLog(i);throw r.deleteShader(i),new Error(`loadShader: error while compiling the shader:
|
|
3
3
|
`.concat(o,`
|
|
4
4
|
`).concat(t))}return i}function ra(n,r){return ui("VERTEX",n,r)}function ia(n,r){return ui("FRAGMENT",n,r)}function na(n,r){var t=n.createProgram();if(t===null)throw new Error("loadProgram: error while creating the program.");var e,i;for(e=0,i=r.length;e<i;e++)n.attachShader(t,r[e]);n.linkProgram(t);var a=n.getProgramParameter(t,n.LINK_STATUS);if(!a)throw n.deleteProgram(t),new Error("loadProgram: error while linking the program.");return t}function ar(n){var r=n.gl,t=n.buffer,e=n.program,i=n.vertexShader,a=n.fragmentShader;r.deleteShader(i),r.deleteShader(a),r.deleteProgram(e),r.deleteBuffer(t)}var or=`#define PICKING_MODE
|
package/dist/web/dashboard/dist/assets/{graph-section-Cwx-Bmeh.js → graph-section-D5y4S3T1.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as x,j as e}from"./index-C3Kad9YO.js";import{H as E,P as T,g as V,c as W,E as Y,u as K,a as Z,i as q,B as U,C as X}from"./style-iy_ryTT6.js";import{e as b,f as L}from"./constants-Dd6A34aQ.js";import{d as $}from"./index-1aGs8JPI.js";import"./index-4X4gmCkA.js";const J=x.memo(function({data:r}){const a=b[r.siebelType]||"#6b7280";return e.jsxs(e.Fragment,{children:[e.jsx(E,{type:"target",position:T.Top,className:"!w-2 !h-2"}),e.jsx("div",{className:`bg-surface border border-edge rounded-lg shadow-sm hover:shadow-md transition-shadow cursor-pointer min-w-[200px] ${r.isImpacted?r.impactLevel==="direct"?"ring-2 ring-red-500/60":"ring-2 ring-orange-400/50":""} ${r.inactive?"opacity-50":""}`,children:e.jsxs("div",{className:"p-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase px-1.5 py-0.5 rounded",style:{background:`${a}20`,color:a},children:r.siebelType.replace(/_/g," ")}),r.inactive&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-surface-alt text-muted",children:"inactive"})]}),e.jsx("div",{className:"text-sm font-medium leading-tight line-clamp-2 mb-1",children:r.label}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted",children:[r.project&&e.jsx("span",{children:r.project}),e.jsxs("span",{children:[r.propertyCount," props"]}),r.childCount>0&&e.jsxs("span",{children:[r.childCount," children"]})]})]})}),e.jsx(E,{type:"source",position:T.Bottom,className:"!w-2 !h-2"})]})}),Q=x.memo(function({id:r,sourceX:a,sourceY:n,targetX:i,targetY:d,sourcePosition:o,targetPosition:h,style:l,data:t}){const[c,m,g]=V({sourceX:a,sourceY:n,sourcePosition:o,targetX:i,targetY:d,targetPosition:h});return e.jsxs(e.Fragment,{children:[e.jsx(W,{id:r,path:c,style:l}),(t==null?void 0:t.relationType)&&e.jsx(Y,{children:e.jsx("div",{className:"absolute text-[9px] px-1 py-0.5 rounded bg-surface border border-edge text-muted pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${m}px, ${g}px)`},children:t.relationType.replace(/_/g," ")})})]})});function ee({object:s,dependencies:r,onClose:a,onShowImpact:n,impactTarget:i}){const d=b[s.type]||"#6b7280",o=x.useMemo(()=>r.filter(t=>t.from.name===s.name&&t.from.type===s.type),[r,s]),h=x.useMemo(()=>r.filter(t=>t.to.name===s.name&&t.to.type===s.type),[r,s]),l=(i==null?void 0:i.name)===s.name&&(i==null?void 0:i.type)===s.type;return e.jsxs("aside",{className:"w-80 flex-shrink-0 border-l border-edge bg-surface-alt overflow-y-auto",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-edge flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase px-1.5 py-0.5 rounded flex-shrink-0",style:{background:`${d}20`,color:d},children:s.type.replace(/_/g," ")}),s.inactive&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface text-muted",children:"inactive"})]}),e.jsx("h3",{className:"text-sm font-semibold truncate",children:s.name}),s.project&&e.jsx("p",{className:"text-xs text-muted",children:s.project})]}),e.jsx("button",{onClick:a,"aria-label":"Close detail panel",className:"p-1 text-muted hover:text-foreground cursor-pointer transition-colors",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"px-4 py-2 border-b border-edge",children:e.jsx("button",{onClick:()=>{l||n(s.type,s.name)},disabled:l,"aria-label":"Show impact analysis",className:`w-full px-3 py-1.5 text-xs font-medium rounded-md transition-opacity cursor-pointer ${l?"bg-orange-500/20 text-orange-400 cursor-default":"bg-accent text-white hover:opacity-90"}`,children:l?"Impact Analysis Active":"Show Impact"})}),s.properties.length>0&&e.jsxs("div",{className:"px-4 py-3 border-b border-edge",children:[e.jsxs("h4",{className:"text-[10px] font-semibold uppercase text-muted mb-2 tracking-wider",children:["Properties (",s.properties.length,")"]}),e.jsx("div",{className:"space-y-1 max-h-48 overflow-y-auto",children:s.properties.map((t,c)=>e.jsxs("div",{className:"flex gap-2 text-[11px]",children:[e.jsx("span",{className:"font-mono text-muted flex-shrink-0",children:t.name}),e.jsx("span",{className:"text-foreground truncate",children:t.value})]},c))})]}),s.children.length>0&&e.jsxs("div",{className:"px-4 py-3 border-b border-edge",children:[e.jsxs("h4",{className:"text-[10px] font-semibold uppercase text-muted mb-2 tracking-wider",children:["Children (",s.children.length,")"]}),e.jsx("div",{className:"space-y-1 max-h-48 overflow-y-auto",children:s.children.map((t,c)=>{const m=b[t.type]||"#6b7280";return e.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx("span",{className:"text-[9px] font-semibold uppercase px-1 py-0.5 rounded flex-shrink-0",style:{background:`${m}20`,color:m},children:t.type}),e.jsx("span",{className:"truncate",children:t.name})]},c)})})]}),o.length>0&&e.jsxs("div",{className:"px-4 py-3 border-b border-edge",children:[e.jsxs("h4",{className:"text-[10px] font-semibold uppercase text-muted mb-2 tracking-wider",children:["Depends On (",o.length,")"]}),e.jsx("div",{className:"space-y-1",children:o.map((t,c)=>{const m=b[t.to.type]||"#6b7280";return e.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx("span",{className:"text-[9px] font-semibold uppercase px-1 py-0.5 rounded flex-shrink-0",style:{background:`${m}20`,color:m},children:t.to.type.replace(/_/g," ")}),e.jsx("span",{className:"truncate",children:t.to.name}),e.jsx("span",{className:"text-[9px] text-muted ml-auto flex-shrink-0",children:t.relationType})]},c)})})]}),h.length>0&&e.jsxs("div",{className:"px-4 py-3",children:[e.jsxs("h4",{className:"text-[10px] font-semibold uppercase text-muted mb-2 tracking-wider",children:["Referenced By (",h.length,")"]}),e.jsx("div",{className:"space-y-1",children:h.map((t,c)=>{const m=b[t.from.type]||"#6b7280";return e.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx("span",{className:"text-[9px] font-semibold uppercase px-1 py-0.5 rounded flex-shrink-0",style:{background:`${m}20`,color:m},children:t.from.type.replace(/_/g," ")}),e.jsx("span",{className:"truncate",children:t.from.name}),e.jsx("span",{className:"text-[9px] text-muted ml-auto flex-shrink-0",children:t.relationType})]},c)})})]})]})}const w=220,B=72;function v(s,r){return`siebel:${s}:${r}`}function te(s,r,a){return s.filter(n=>{var i;return!((i=r==null?void 0:r.types)!=null&&i.size&&!r.types.has(n.type)||!(r!=null&&r.showInactive)&&n.inactive)}).map(n=>{const i=v(n.type,n.name),d=b[n.type]||"#6b7280",o=a==null?void 0:a.get(i);return{id:i,type:"siebelNode",position:{x:0,y:0},data:{label:n.name,siebelType:n.type,project:n.project,propertyCount:n.properties.length,childCount:n.children.length,inactive:n.inactive,sourceObject:n,isImpacted:!!o,impactLevel:o},style:{width:w,borderLeft:`4px solid ${d}`}}})}function se(s,r){return s.map((a,n)=>{const i=v(a.from.type,a.from.name),d=v(a.to.type,a.to.name);if(!r.has(i)||!r.has(d))return null;const o=L[a.relationType]||L.references;return{id:`siebel-edge-${n}`,source:i,target:d,label:o.label,type:"siebelEdge",data:{relationType:a.relationType,inferred:a.inferred},style:{stroke:o.color,strokeDasharray:o.dashed?"5 5":void 0},labelStyle:{fontSize:10,fill:"#6c757d"}}}).filter(a=>a!==null)}let j=null;function re(s,r,a){let n=0;const i=[a,...s,"|",...r];for(const d of i)for(let o=0;o<d.length;o++)n=(n<<5)-n+d.charCodeAt(o)|0;return n}function ne(s,r,a="TB"){const n=s.map(l=>l.id),i=r.map(l=>`${l.source}-${l.target}`),d=re(n,i,a);let o;if(j&&j.key===d)o=j.positions;else{const l=new $.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:a,ranksep:80,nodesep:50});for(const t of s)l.setNode(t.id,{width:w,height:B});for(const t of r)l.setEdge(t.source,t.target);$.layout(l),o=new Map;for(const t of s){const c=l.node(t.id);o.set(t.id,{x:c.x-w/2,y:c.y-B/2})}j={key:d,positions:o}}return{nodes:s.map(l=>{const t=o.get(l.id)??{x:0,y:0};return{...l,position:t}}),edges:r}}function oe(s,r,a){const n=v(r,a),i=new Map,d=new Map;for(const t of s){const c=v(t.to.type,t.to.name),m=v(t.from.type,t.from.name);d.has(c)||d.set(c,[]),d.get(c).push(m)}const o=[n],h=new Set([n]);let l=0;for(;o.length>0;){const t=o.length;l++;for(let c=0;c<t;c++){const m=o.shift(),g=d.get(m)||[];for(const N of g)h.has(N)||(h.add(N),i.set(N,l===1?"direct":"transitive"),o.push(N))}}return i}const ae={siebelNode:J},le={siebelEdge:Q},ie={hideAttribution:!0};function ue({objects:s,dependencies:r}){const[a,n,i]=K([]),[d,o,h]=Z([]),[l,t]=x.useState(null),[c,m]=x.useState("TB"),[g,N]=x.useState(new Set),[k,_]=x.useState(!1),[y,C]=x.useState(null),S=x.useDeferredValue(g),D=x.useMemo(()=>{const p=new Set;for(const u of s)p.add(u.type);return[...p].sort()},[s]),I=x.useMemo(()=>{if(y)return oe(r,y.type,y.name)},[r,y]);x.useEffect(()=>{if(s.length===0){n([]),o([]);return}const u=te(s,{types:S,showInactive:k},I),f=new Set(u.map(G=>G.id)),F=se(r,f),{nodes:R,edges:H}=ne(u,F,c);n(R),o(H)},[s,r,S,k,c,I,n,o]);const M=x.useCallback((p,u)=>{t(u.data.sourceObject)},[]),A=x.useCallback(()=>{t(null)},[]),P=x.useCallback(p=>{N(u=>{const f=new Set(u);return f.has(p)?f.delete(p):f.add(p),f})},[]),O=x.useCallback((p,u)=>{C({type:p,name:u})},[]),z=x.useCallback(()=>{C(null)},[]);return s.length===0?e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsxs("div",{className:"text-center space-y-3",children:[e.jsx("svg",{className:"w-12 h-12 mx-auto text-muted",fill:"none",viewBox:"0 0 24 24",strokeWidth:1,stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 14.25v2.25m3-4.5v4.5m3-6.75v6.75m3-9v9M6 20.25h12A2.25 2.25 0 0020.25 18V6A2.25 2.25 0 0018 3.75H6A2.25 2.25 0 003.75 6v12A2.25 2.25 0 006 20.25z"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"SIF Dependency Graph"}),e.jsx("p",{className:"text-xs text-muted mt-1",children:"Upload a .sif file to visualize Siebel object relationships"})]})]})}):e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-edge bg-surface-alt",children:[e.jsx("div",{className:"flex flex-wrap gap-1 flex-1",children:D.map(p=>{const u=b[p]||"#6b7280",f=g.size===0||g.has(p);return e.jsx("button",{onClick:()=>P(p),"aria-label":`Filter ${p}`,"aria-pressed":g.has(p),className:"px-2 py-0.5 text-[10px] rounded-md border transition-colors cursor-pointer",style:{borderColor:f?u:"var(--color-border)",backgroundColor:f?`${u}15`:"transparent",color:f?u:"var(--color-text-muted)",opacity:f?1:.5},children:p.replace(/_/g," ")},p)})}),e.jsxs("div",{className:"flex items-center gap-1 border-l border-edge pl-3",children:[e.jsx("button",{onClick:()=>m("TB"),"aria-label":"Top to bottom layout",className:`px-2 py-0.5 text-[10px] rounded cursor-pointer transition-colors ${c==="TB"?"bg-accent/10 text-accent":"text-muted"}`,children:"TB"}),e.jsx("button",{onClick:()=>m("LR"),"aria-label":"Left to right layout",className:`px-2 py-0.5 text-[10px] rounded cursor-pointer transition-colors ${c==="LR"?"bg-accent/10 text-accent":"text-muted"}`,children:"LR"})]}),e.jsxs("label",{className:"flex items-center gap-1.5 text-[10px] text-muted cursor-pointer border-l border-edge pl-3",children:[e.jsx("input",{type:"checkbox",checked:k,onChange:p=>_(p.target.checked),className:"rounded"}),"Inactive"]}),y&&e.jsxs("div",{className:"flex items-center gap-1.5 border-l border-edge pl-3",children:[e.jsxs("span",{className:"text-[10px] text-orange-400",children:["Impact: ",y.name]}),e.jsx("button",{onClick:z,"aria-label":"Clear impact analysis",className:"text-[10px] px-1.5 py-0.5 rounded bg-surface text-muted hover:text-foreground cursor-pointer transition-colors",children:"Clear"})]}),e.jsxs("span",{className:"text-[10px] text-muted",children:[a.length," nodes"]})]}),e.jsxs("div",{className:"flex-1 flex min-h-0",children:[e.jsx("div",{className:"flex-1",children:e.jsxs(q,{nodes:a,edges:d,onNodesChange:i,onEdgesChange:h,onNodeClick:M,onPaneClick:A,nodeTypes:ae,edgeTypes:le,proOptions:ie,fitView:!0,fitViewOptions:{padding:.2},minZoom:.1,maxZoom:2,children:[e.jsx(U,{gap:16,size:1}),e.jsx(X,{showInteractive:!1})]})}),l&&e.jsx(ee,{object:l,dependencies:r,onClose:()=>t(null),onShowImpact:O,impactTarget:y})]})]})}export{ue as GraphSection};
|
|
1
|
+
import{r as x,j as e}from"./index-DrvFzUJS.js";import{H as E,P as T,g as V,c as W,E as Y,u as K,a as Z,i as q,B as U,C as X}from"./style-DeKQIW_i.js";import{e as b,f as L}from"./constants-DLyESMjx.js";import{d as $}from"./index-CAOXRHQq.js";import"./index-C13O-yj1.js";const J=x.memo(function({data:r}){const a=b[r.siebelType]||"#6b7280";return e.jsxs(e.Fragment,{children:[e.jsx(E,{type:"target",position:T.Top,className:"!w-2 !h-2"}),e.jsx("div",{className:`bg-surface border border-edge rounded-lg shadow-sm hover:shadow-md transition-shadow cursor-pointer min-w-[200px] ${r.isImpacted?r.impactLevel==="direct"?"ring-2 ring-red-500/60":"ring-2 ring-orange-400/50":""} ${r.inactive?"opacity-50":""}`,children:e.jsxs("div",{className:"p-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase px-1.5 py-0.5 rounded",style:{background:`${a}20`,color:a},children:r.siebelType.replace(/_/g," ")}),r.inactive&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-surface-alt text-muted",children:"inactive"})]}),e.jsx("div",{className:"text-sm font-medium leading-tight line-clamp-2 mb-1",children:r.label}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted",children:[r.project&&e.jsx("span",{children:r.project}),e.jsxs("span",{children:[r.propertyCount," props"]}),r.childCount>0&&e.jsxs("span",{children:[r.childCount," children"]})]})]})}),e.jsx(E,{type:"source",position:T.Bottom,className:"!w-2 !h-2"})]})}),Q=x.memo(function({id:r,sourceX:a,sourceY:n,targetX:i,targetY:d,sourcePosition:o,targetPosition:h,style:l,data:t}){const[c,m,g]=V({sourceX:a,sourceY:n,sourcePosition:o,targetX:i,targetY:d,targetPosition:h});return e.jsxs(e.Fragment,{children:[e.jsx(W,{id:r,path:c,style:l}),(t==null?void 0:t.relationType)&&e.jsx(Y,{children:e.jsx("div",{className:"absolute text-[9px] px-1 py-0.5 rounded bg-surface border border-edge text-muted pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${m}px, ${g}px)`},children:t.relationType.replace(/_/g," ")})})]})});function ee({object:s,dependencies:r,onClose:a,onShowImpact:n,impactTarget:i}){const d=b[s.type]||"#6b7280",o=x.useMemo(()=>r.filter(t=>t.from.name===s.name&&t.from.type===s.type),[r,s]),h=x.useMemo(()=>r.filter(t=>t.to.name===s.name&&t.to.type===s.type),[r,s]),l=(i==null?void 0:i.name)===s.name&&(i==null?void 0:i.type)===s.type;return e.jsxs("aside",{className:"w-80 flex-shrink-0 border-l border-edge bg-surface-alt overflow-y-auto",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-edge flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase px-1.5 py-0.5 rounded flex-shrink-0",style:{background:`${d}20`,color:d},children:s.type.replace(/_/g," ")}),s.inactive&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface text-muted",children:"inactive"})]}),e.jsx("h3",{className:"text-sm font-semibold truncate",children:s.name}),s.project&&e.jsx("p",{className:"text-xs text-muted",children:s.project})]}),e.jsx("button",{onClick:a,"aria-label":"Close detail panel",className:"p-1 text-muted hover:text-foreground cursor-pointer transition-colors",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"px-4 py-2 border-b border-edge",children:e.jsx("button",{onClick:()=>{l||n(s.type,s.name)},disabled:l,"aria-label":"Show impact analysis",className:`w-full px-3 py-1.5 text-xs font-medium rounded-md transition-opacity cursor-pointer ${l?"bg-orange-500/20 text-orange-400 cursor-default":"bg-accent text-white hover:opacity-90"}`,children:l?"Impact Analysis Active":"Show Impact"})}),s.properties.length>0&&e.jsxs("div",{className:"px-4 py-3 border-b border-edge",children:[e.jsxs("h4",{className:"text-[10px] font-semibold uppercase text-muted mb-2 tracking-wider",children:["Properties (",s.properties.length,")"]}),e.jsx("div",{className:"space-y-1 max-h-48 overflow-y-auto",children:s.properties.map((t,c)=>e.jsxs("div",{className:"flex gap-2 text-[11px]",children:[e.jsx("span",{className:"font-mono text-muted flex-shrink-0",children:t.name}),e.jsx("span",{className:"text-foreground truncate",children:t.value})]},c))})]}),s.children.length>0&&e.jsxs("div",{className:"px-4 py-3 border-b border-edge",children:[e.jsxs("h4",{className:"text-[10px] font-semibold uppercase text-muted mb-2 tracking-wider",children:["Children (",s.children.length,")"]}),e.jsx("div",{className:"space-y-1 max-h-48 overflow-y-auto",children:s.children.map((t,c)=>{const m=b[t.type]||"#6b7280";return e.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx("span",{className:"text-[9px] font-semibold uppercase px-1 py-0.5 rounded flex-shrink-0",style:{background:`${m}20`,color:m},children:t.type}),e.jsx("span",{className:"truncate",children:t.name})]},c)})})]}),o.length>0&&e.jsxs("div",{className:"px-4 py-3 border-b border-edge",children:[e.jsxs("h4",{className:"text-[10px] font-semibold uppercase text-muted mb-2 tracking-wider",children:["Depends On (",o.length,")"]}),e.jsx("div",{className:"space-y-1",children:o.map((t,c)=>{const m=b[t.to.type]||"#6b7280";return e.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx("span",{className:"text-[9px] font-semibold uppercase px-1 py-0.5 rounded flex-shrink-0",style:{background:`${m}20`,color:m},children:t.to.type.replace(/_/g," ")}),e.jsx("span",{className:"truncate",children:t.to.name}),e.jsx("span",{className:"text-[9px] text-muted ml-auto flex-shrink-0",children:t.relationType})]},c)})})]}),h.length>0&&e.jsxs("div",{className:"px-4 py-3",children:[e.jsxs("h4",{className:"text-[10px] font-semibold uppercase text-muted mb-2 tracking-wider",children:["Referenced By (",h.length,")"]}),e.jsx("div",{className:"space-y-1",children:h.map((t,c)=>{const m=b[t.from.type]||"#6b7280";return e.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx("span",{className:"text-[9px] font-semibold uppercase px-1 py-0.5 rounded flex-shrink-0",style:{background:`${m}20`,color:m},children:t.from.type.replace(/_/g," ")}),e.jsx("span",{className:"truncate",children:t.from.name}),e.jsx("span",{className:"text-[9px] text-muted ml-auto flex-shrink-0",children:t.relationType})]},c)})})]})]})}const w=220,B=72;function v(s,r){return`siebel:${s}:${r}`}function te(s,r,a){return s.filter(n=>{var i;return!((i=r==null?void 0:r.types)!=null&&i.size&&!r.types.has(n.type)||!(r!=null&&r.showInactive)&&n.inactive)}).map(n=>{const i=v(n.type,n.name),d=b[n.type]||"#6b7280",o=a==null?void 0:a.get(i);return{id:i,type:"siebelNode",position:{x:0,y:0},data:{label:n.name,siebelType:n.type,project:n.project,propertyCount:n.properties.length,childCount:n.children.length,inactive:n.inactive,sourceObject:n,isImpacted:!!o,impactLevel:o},style:{width:w,borderLeft:`4px solid ${d}`}}})}function se(s,r){return s.map((a,n)=>{const i=v(a.from.type,a.from.name),d=v(a.to.type,a.to.name);if(!r.has(i)||!r.has(d))return null;const o=L[a.relationType]||L.references;return{id:`siebel-edge-${n}`,source:i,target:d,label:o.label,type:"siebelEdge",data:{relationType:a.relationType,inferred:a.inferred},style:{stroke:o.color,strokeDasharray:o.dashed?"5 5":void 0},labelStyle:{fontSize:10,fill:"#6c757d"}}}).filter(a=>a!==null)}let j=null;function re(s,r,a){let n=0;const i=[a,...s,"|",...r];for(const d of i)for(let o=0;o<d.length;o++)n=(n<<5)-n+d.charCodeAt(o)|0;return n}function ne(s,r,a="TB"){const n=s.map(l=>l.id),i=r.map(l=>`${l.source}-${l.target}`),d=re(n,i,a);let o;if(j&&j.key===d)o=j.positions;else{const l=new $.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:a,ranksep:80,nodesep:50});for(const t of s)l.setNode(t.id,{width:w,height:B});for(const t of r)l.setEdge(t.source,t.target);$.layout(l),o=new Map;for(const t of s){const c=l.node(t.id);o.set(t.id,{x:c.x-w/2,y:c.y-B/2})}j={key:d,positions:o}}return{nodes:s.map(l=>{const t=o.get(l.id)??{x:0,y:0};return{...l,position:t}}),edges:r}}function oe(s,r,a){const n=v(r,a),i=new Map,d=new Map;for(const t of s){const c=v(t.to.type,t.to.name),m=v(t.from.type,t.from.name);d.has(c)||d.set(c,[]),d.get(c).push(m)}const o=[n],h=new Set([n]);let l=0;for(;o.length>0;){const t=o.length;l++;for(let c=0;c<t;c++){const m=o.shift(),g=d.get(m)||[];for(const N of g)h.has(N)||(h.add(N),i.set(N,l===1?"direct":"transitive"),o.push(N))}}return i}const ae={siebelNode:J},le={siebelEdge:Q},ie={hideAttribution:!0};function ue({objects:s,dependencies:r}){const[a,n,i]=K([]),[d,o,h]=Z([]),[l,t]=x.useState(null),[c,m]=x.useState("TB"),[g,N]=x.useState(new Set),[k,_]=x.useState(!1),[y,C]=x.useState(null),S=x.useDeferredValue(g),D=x.useMemo(()=>{const p=new Set;for(const u of s)p.add(u.type);return[...p].sort()},[s]),I=x.useMemo(()=>{if(y)return oe(r,y.type,y.name)},[r,y]);x.useEffect(()=>{if(s.length===0){n([]),o([]);return}const u=te(s,{types:S,showInactive:k},I),f=new Set(u.map(G=>G.id)),F=se(r,f),{nodes:R,edges:H}=ne(u,F,c);n(R),o(H)},[s,r,S,k,c,I,n,o]);const M=x.useCallback((p,u)=>{t(u.data.sourceObject)},[]),A=x.useCallback(()=>{t(null)},[]),P=x.useCallback(p=>{N(u=>{const f=new Set(u);return f.has(p)?f.delete(p):f.add(p),f})},[]),O=x.useCallback((p,u)=>{C({type:p,name:u})},[]),z=x.useCallback(()=>{C(null)},[]);return s.length===0?e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsxs("div",{className:"text-center space-y-3",children:[e.jsx("svg",{className:"w-12 h-12 mx-auto text-muted",fill:"none",viewBox:"0 0 24 24",strokeWidth:1,stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 14.25v2.25m3-4.5v4.5m3-6.75v6.75m3-9v9M6 20.25h12A2.25 2.25 0 0020.25 18V6A2.25 2.25 0 0018 3.75H6A2.25 2.25 0 003.75 6v12A2.25 2.25 0 006 20.25z"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"SIF Dependency Graph"}),e.jsx("p",{className:"text-xs text-muted mt-1",children:"Upload a .sif file to visualize Siebel object relationships"})]})]})}):e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-edge bg-surface-alt",children:[e.jsx("div",{className:"flex flex-wrap gap-1 flex-1",children:D.map(p=>{const u=b[p]||"#6b7280",f=g.size===0||g.has(p);return e.jsx("button",{onClick:()=>P(p),"aria-label":`Filter ${p}`,"aria-pressed":g.has(p),className:"px-2 py-0.5 text-[10px] rounded-md border transition-colors cursor-pointer",style:{borderColor:f?u:"var(--color-border)",backgroundColor:f?`${u}15`:"transparent",color:f?u:"var(--color-text-muted)",opacity:f?1:.5},children:p.replace(/_/g," ")},p)})}),e.jsxs("div",{className:"flex items-center gap-1 border-l border-edge pl-3",children:[e.jsx("button",{onClick:()=>m("TB"),"aria-label":"Top to bottom layout",className:`px-2 py-0.5 text-[10px] rounded cursor-pointer transition-colors ${c==="TB"?"bg-accent/10 text-accent":"text-muted"}`,children:"TB"}),e.jsx("button",{onClick:()=>m("LR"),"aria-label":"Left to right layout",className:`px-2 py-0.5 text-[10px] rounded cursor-pointer transition-colors ${c==="LR"?"bg-accent/10 text-accent":"text-muted"}`,children:"LR"})]}),e.jsxs("label",{className:"flex items-center gap-1.5 text-[10px] text-muted cursor-pointer border-l border-edge pl-3",children:[e.jsx("input",{type:"checkbox",checked:k,onChange:p=>_(p.target.checked),className:"rounded"}),"Inactive"]}),y&&e.jsxs("div",{className:"flex items-center gap-1.5 border-l border-edge pl-3",children:[e.jsxs("span",{className:"text-[10px] text-orange-400",children:["Impact: ",y.name]}),e.jsx("button",{onClick:z,"aria-label":"Clear impact analysis",className:"text-[10px] px-1.5 py-0.5 rounded bg-surface text-muted hover:text-foreground cursor-pointer transition-colors",children:"Clear"})]}),e.jsxs("span",{className:"text-[10px] text-muted",children:[a.length," nodes"]})]}),e.jsxs("div",{className:"flex-1 flex min-h-0",children:[e.jsx("div",{className:"flex-1",children:e.jsxs(q,{nodes:a,edges:d,onNodesChange:i,onEdgesChange:h,onNodeClick:M,onPaneClick:A,nodeTypes:ae,edgeTypes:le,proOptions:ie,fitView:!0,fitViewOptions:{padding:.2},minZoom:.1,maxZoom:2,children:[e.jsx(U,{gap:16,size:1}),e.jsx(X,{showInteractive:!1})]})}),l&&e.jsx(ee,{object:l,dependencies:r,onClose:()=>t(null),onShowImpact:O,impactTarget:y})]})]})}export{ue as GraphSection};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as oe,r as s,j as e,a as de,F as ce}from"./index-
|
|
1
|
+
import{c as oe,r as s,j as e,a as de,F as ce}from"./index-DrvFzUJS.js";import{u as ie,a as xe,i as ue,B as me,C as pe}from"./style-DeKQIW_i.js";import{b as he,a as fe,g as O,t as be,s as ge,c as je,d as Ne,W as ye,e as ve,N as Ce}from"./graph-utils-BlwoHdjR.js";import{A as ke,S as L,a as we,N as _,E as Se}from"./constants-DLyESMjx.js";import{L as W}from"./loader-circle-DQz_g7p_.js";import{C as Te}from"./circle-alert-BJTyaShp.js";import"./index-C13O-yj1.js";import"./index-CAOXRHQq.js";/**
|
|
2
2
|
* @license lucide-react v1.7.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as b,j as t}from"./index-C3Kad9YO.js";import{H as v,P as k,g as L,c as _,E as P}from"./style-iy_ryTT6.js";import{N as j,S as N,E as h}from"./constants-Dd6A34aQ.js";import{d as C}from"./index-1aGs8JPI.js";function H(a,e){const r=new Map,i=(s,o)=>{let u=r.get(s);u||(u=new Set,r.set(s,u)),u.add(o)};for(const s of a)s.parentId&&i(s.parentId,s.id);for(const s of e)s.relationType==="parent_of"?i(s.from,s.to):s.relationType==="child_of"&&i(s.to,s.from);const d=new Map;for(const[s,o]of r)d.set(s,[...o]);return d}function A(a,e,r){const i=new Map,d=new Set;for(const n of a)i.set(n.id,n),d.add(n.id);const s=a.filter(n=>!n.parentId||!d.has(n.parentId)),o=[],u=new Set,l=n=>{if(u.has(n))return;u.add(n);const m=i.get(n);if(m&&o.push(m),e.has(n)){const f=r.get(n)??[];for(const c of f)l(c)}};for(const n of s)l(n.id);return o}function B(a,e){if(a.length===0)return[];const r=new Map,i=new Set;for(const l of a)r.set(l.id,l),i.add(l.id);const d=(l,n)=>{if(n.has(l))return null;n.add(l);const m=r.get(l);if(!m)return null;const f=e.get(l)??[],c=[];for(const p of f){const x=d(p,n);x&&c.push(x)}return{node:m,children:c}},s=a.filter(l=>!l.parentId||!i.has(l.parentId)),o=new Set,u=[];for(const l of s){const n=d(l.id,o);n&&u.push(n)}return u}const F=b.memo(function({data:e}){const r=j[e.nodeType]||"#6c757d",i=N[e.status]||"#9e9e9e",d=b.useCallback(s=>{var o;s.stopPropagation(),(o=e.onExpand)==null||o.call(e,e.sourceNode.id)},[e]);return t.jsxs(t.Fragment,{children:[t.jsx(v,{type:"target",position:k.Top,className:"!w-2 !h-2"}),t.jsxs("div",{className:"bg-surface border border-edge rounded-lg shadow-sm hover:shadow-md transition-shadow cursor-pointer min-w-[200px]",children:[t.jsxs("div",{className:"p-2.5",children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsx("span",{className:"text-[10px] font-semibold uppercase px-1.5 py-0.5 rounded",style:{background:`${r}20`,color:r},children:e.nodeType}),t.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:`${i}20`,color:i},children:e.status.replace("_"," ")})]}),t.jsx("div",{className:"text-sm font-medium leading-tight line-clamp-2 mb-1",children:e.label}),t.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted",children:[t.jsxs("span",{children:["P",e.priority]}),e.xpSize&&t.jsx("span",{children:e.xpSize}),e.sprint&&t.jsx("span",{children:e.sprint})]})]}),e.hasChildren&&t.jsxs("button",{onClick:d,className:"w-full flex items-center justify-center gap-1.5 py-1.5 text-xs font-medium border-t border-edge text-muted hover:text-foreground hover:bg-surface-elevated transition-colors rounded-b-lg",title:e.isExpanded?"Collapse children":"Expand children",children:[t.jsx("span",{children:e.isExpanded?"▼":"▶"}),t.jsxs("span",{children:[e.childCount," ",e.childCount===1?"child":"children"]})]})]}),t.jsx(v,{type:"source",position:k.Bottom,className:"!w-2 !h-2"})]})}),G=b.memo(function({id:e,sourceX:r,sourceY:i,targetX:d,targetY:s,sourcePosition:o,targetPosition:u,data:l,style:n={}}){const[m,f,c]=L({sourceX:r,sourceY:i,sourcePosition:o,targetX:d,targetY:s,targetPosition:u}),p=(l==null?void 0:l.relationType)||"related_to",x=h[p]||h.related_to;return t.jsxs(t.Fragment,{children:[t.jsx(_,{id:e,path:m,style:{...n,stroke:x.color,strokeDasharray:x.dashed?"5 5":void 0,strokeWidth:1.5}}),t.jsx(P,{children:t.jsx("div",{className:"text-[9px] text-muted bg-surface px-1 rounded pointer-events-none absolute",style:{transform:`translate(-50%, -50%) translate(${f}px,${c}px)`},children:x.label})})]})});function R(a,e){const r=[],i=[];for(const d of e)d.from===a&&r.push(d),d.to===a&&i.push(d);return{outgoing:r,incoming:i}}const Y=b.memo(function({node:e,edges:r=[],allNodes:i=[],childrenMap:d,onClose:s,onNodeNavigate:o}){if(!e)return null;const u=j[e.type]||"#6c757d",l=N[e.status]||"#9e9e9e",n=b.useMemo(()=>R(e.id,r),[e.id,r]),m=b.useMemo(()=>{const c=new Map;for(const p of i)c.set(p.id,p);return c},[i]),f=n.outgoing.length>0||n.incoming.length>0;return t.jsxs("div",{className:"w-80 border-l border-edge bg-surface-alt overflow-y-auto p-4",children:[t.jsxs("div",{className:"flex items-center justify-between mb-3",children:[t.jsx("h3",{className:"text-sm font-bold",children:"Node Details"}),t.jsx("button",{onClick:s,className:"text-muted hover:text-foreground text-lg leading-none",children:"×"})]}),t.jsx("h4",{className:"text-base font-semibold mb-3",children:e.title}),t.jsxs("div",{className:"space-y-2 text-sm",children:[t.jsx(g,{label:"ID",children:t.jsx("code",{className:"text-xs bg-surface-elevated px-1 rounded break-all",children:e.id})}),t.jsx(g,{label:"Type",children:t.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-medium",style:{background:`${u}20`,color:u},children:e.type})}),t.jsx(g,{label:"Status",children:t.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium",style:{background:`${l}20`,color:l},children:e.status.replace("_"," ")})}),t.jsxs(g,{label:"Priority",children:["P",e.priority]}),e.xpSize&&t.jsx(g,{label:"Size",children:e.xpSize}),e.estimateMinutes!=null&&t.jsxs(g,{label:"Estimate",children:[e.estimateMinutes,"min"]}),e.sprint&&t.jsx(g,{label:"Sprint",children:e.sprint}),e.description&&t.jsxs("div",{className:"pt-2 border-t border-edge",children:[t.jsx("div",{className:"text-xs font-medium text-muted mb-1",children:"Description"}),t.jsx("p",{className:"text-xs whitespace-pre-wrap",children:e.description})]}),d&&(()=>{const c=d.get(e.id)??[];return c.length===0?null:t.jsxs("div",{className:"pt-2 border-t border-edge",children:[t.jsxs("div",{className:"text-xs font-medium text-muted mb-1",children:["Children (",c.length,")"]}),t.jsx("div",{className:"space-y-1",children:c.map(p=>{const x=m.get(p);if(!x)return null;const D=N[x.status]||"#9e9e9e",S=j[x.type]||"#6c757d";return t.jsxs("button",{onClick:()=>o==null?void 0:o(p),className:"w-full text-left flex items-center gap-1.5 px-1.5 py-1 rounded hover:bg-surface-elevated transition-colors text-xs",children:[t.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:D}}),t.jsx("span",{className:"text-[9px] px-1 rounded shrink-0",style:{background:`${S}20`,color:S},children:x.type}),t.jsx("span",{className:"truncate font-medium",children:x.title})]},p)})})]})})(),f&&t.jsxs("div",{className:"pt-2 border-t border-edge",children:[t.jsxs("div",{className:"text-xs font-medium text-muted mb-1",children:["Relationships (",n.outgoing.length+n.incoming.length,")"]}),t.jsxs("div",{className:"space-y-1",children:[n.outgoing.map(c=>{const p=m.get(c.to),x=h[c.relationType]||h.related_to;return t.jsx(E,{direction:"out",label:x.label,color:x.color,targetTitle:(p==null?void 0:p.title)??c.to,targetId:c.to,onNavigate:o},c.id)}),n.incoming.map(c=>{const p=m.get(c.from),x=h[c.relationType]||h.related_to;return t.jsx(E,{direction:"in",label:x.label,color:x.color,targetTitle:(p==null?void 0:p.title)??c.from,targetId:c.from,onNavigate:o},c.id)})]})]}),e.acceptanceCriteria&&e.acceptanceCriteria.length>0&&t.jsxs("div",{className:"pt-2 border-t border-edge",children:[t.jsxs("div",{className:"text-xs font-medium text-muted mb-1",children:["Acceptance Criteria (",e.acceptanceCriteria.length,")"]}),t.jsx("ul",{className:"text-xs space-y-1 list-disc pl-4",children:e.acceptanceCriteria.map((c,p)=>t.jsx("li",{children:c},p))})]}),e.tags&&e.tags.length>0&&t.jsxs("div",{className:"pt-2 border-t border-edge",children:[t.jsx("div",{className:"text-xs font-medium text-muted mb-1",children:"Tags"}),t.jsx("div",{className:"flex flex-wrap gap-1",children:e.tags.map(c=>t.jsx("span",{className:"text-[10px] bg-surface-elevated px-1.5 py-0.5 rounded",children:c},c))})]}),e.sourceRef&&t.jsxs("div",{className:"pt-2 border-t border-edge",children:[t.jsx("div",{className:"text-xs font-medium text-muted mb-1",children:"Source"}),t.jsxs("div",{className:"text-xs",children:[e.sourceRef.file,e.sourceRef.startLine!=null&&` (L${e.sourceRef.startLine}–${e.sourceRef.endLine??"?"})`]})]}),t.jsxs("div",{className:"pt-2 border-t border-edge text-[10px] text-muted",children:[t.jsxs("div",{children:["Created: ",new Date(e.createdAt).toLocaleString()]}),t.jsxs("div",{children:["Updated: ",new Date(e.updatedAt).toLocaleString()]})]})]})]})});function g({label:a,children:e}){return t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsx("span",{className:"text-xs text-muted shrink-0",children:a}),t.jsx("div",{className:"text-right",children:e})]})}function E({direction:a,label:e,color:r,targetTitle:i,targetId:d,onNavigate:s}){const o=a==="out"?"→":"←";return t.jsxs("button",{onClick:()=>s==null?void 0:s(d),className:"w-full text-left flex items-center gap-1.5 px-1.5 py-1 rounded hover:bg-surface-elevated transition-colors text-xs",children:[t.jsx("span",{style:{color:r},children:o}),t.jsx("span",{className:"text-[10px] text-muted",children:e}),t.jsx("span",{className:"truncate font-medium",children:i})]})}const w=240,T=80;function K(a,e,r,i,d){return a.filter(s=>{var o,u;return!((o=e==null?void 0:e.statuses)!=null&&o.size&&!e.statuses.has(s.status)||(u=e==null?void 0:e.types)!=null&&u.size&&!e.types.has(s.type))}).map(s=>{const o=r==null?void 0:r.get(s.id),u=o!=null&&o.length>0;return{id:s.id,type:"workflowNode",position:{x:0,y:0},data:{label:s.title,nodeType:s.type,status:s.status,priority:s.priority,xpSize:s.xpSize,sprint:s.sprint,sourceNode:s,hasChildren:u,isExpanded:(i==null?void 0:i.has(s.id))??!1,childCount:(o==null?void 0:o.length)??0,onExpand:d},style:{width:w,borderLeft:`4px solid ${j[s.type]||"#6c757d"}`}}})}function U(a,e){return a.filter(r=>e.has(r.from)&&e.has(r.to)).map(r=>{const i=h[r.relationType]||h.related_to;return{id:r.id,source:r.from,target:r.to,label:i.label,type:"workflowEdge",data:{relationType:r.relationType},style:{stroke:i.color,strokeDasharray:i.dashed?"5 5":void 0},labelStyle:{fontSize:10,fill:"#6c757d"}}})}function $(a,e,r){let i=0;const d=[r,...a,"|",...e];for(const s of d)for(let o=0;o<s.length;o++)i=(i<<5)-i+s.charCodeAt(o)|0;return i}function V(a,e){if(a===null||a.length!==e.length)return!1;for(let r=0;r<a.length;r++)if(a[r]!==e[r])return!1;return!0}let y=null;function X(a,e,r="TB"){const i=a.map(l=>l.id),d=e.map(l=>`${l.source}-${l.target}`),s=$(i,d,r);let o;if(y&&y.key===s)o=y.positions;else{const l=new C.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:r,ranksep:60,nodesep:40});for(const n of a)l.setNode(n.id,{width:w,height:T});for(const n of e)l.setEdge(n.source,n.target);C.layout(l),o=new Map;for(const n of a){const m=l.node(n.id);o.set(n.id,{x:m.x-w/2,y:m.y-T/2})}y={key:s,positions:o}}return{nodes:a.map(l=>{const n=o.get(l.id)??{x:0,y:0};return{...l,position:n}}),edges:e}}export{Y as N,G as W,B as a,H as b,U as c,X as d,F as e,A as g,V as s,K as t};
|
|
1
|
+
import{r as b,j as t}from"./index-DrvFzUJS.js";import{H as v,P as k,g as L,c as _,E as P}from"./style-DeKQIW_i.js";import{N as j,S as N,E as h}from"./constants-DLyESMjx.js";import{d as C}from"./index-CAOXRHQq.js";function H(a,e){const r=new Map,i=(s,o)=>{let u=r.get(s);u||(u=new Set,r.set(s,u)),u.add(o)};for(const s of a)s.parentId&&i(s.parentId,s.id);for(const s of e)s.relationType==="parent_of"?i(s.from,s.to):s.relationType==="child_of"&&i(s.to,s.from);const d=new Map;for(const[s,o]of r)d.set(s,[...o]);return d}function A(a,e,r){const i=new Map,d=new Set;for(const n of a)i.set(n.id,n),d.add(n.id);const s=a.filter(n=>!n.parentId||!d.has(n.parentId)),o=[],u=new Set,l=n=>{if(u.has(n))return;u.add(n);const m=i.get(n);if(m&&o.push(m),e.has(n)){const f=r.get(n)??[];for(const c of f)l(c)}};for(const n of s)l(n.id);return o}function B(a,e){if(a.length===0)return[];const r=new Map,i=new Set;for(const l of a)r.set(l.id,l),i.add(l.id);const d=(l,n)=>{if(n.has(l))return null;n.add(l);const m=r.get(l);if(!m)return null;const f=e.get(l)??[],c=[];for(const p of f){const x=d(p,n);x&&c.push(x)}return{node:m,children:c}},s=a.filter(l=>!l.parentId||!i.has(l.parentId)),o=new Set,u=[];for(const l of s){const n=d(l.id,o);n&&u.push(n)}return u}const F=b.memo(function({data:e}){const r=j[e.nodeType]||"#6c757d",i=N[e.status]||"#9e9e9e",d=b.useCallback(s=>{var o;s.stopPropagation(),(o=e.onExpand)==null||o.call(e,e.sourceNode.id)},[e]);return t.jsxs(t.Fragment,{children:[t.jsx(v,{type:"target",position:k.Top,className:"!w-2 !h-2"}),t.jsxs("div",{className:"bg-surface border border-edge rounded-lg shadow-sm hover:shadow-md transition-shadow cursor-pointer min-w-[200px]",children:[t.jsxs("div",{className:"p-2.5",children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsx("span",{className:"text-[10px] font-semibold uppercase px-1.5 py-0.5 rounded",style:{background:`${r}20`,color:r},children:e.nodeType}),t.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:`${i}20`,color:i},children:e.status.replace("_"," ")})]}),t.jsx("div",{className:"text-sm font-medium leading-tight line-clamp-2 mb-1",children:e.label}),t.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted",children:[t.jsxs("span",{children:["P",e.priority]}),e.xpSize&&t.jsx("span",{children:e.xpSize}),e.sprint&&t.jsx("span",{children:e.sprint})]})]}),e.hasChildren&&t.jsxs("button",{onClick:d,className:"w-full flex items-center justify-center gap-1.5 py-1.5 text-xs font-medium border-t border-edge text-muted hover:text-foreground hover:bg-surface-elevated transition-colors rounded-b-lg",title:e.isExpanded?"Collapse children":"Expand children",children:[t.jsx("span",{children:e.isExpanded?"▼":"▶"}),t.jsxs("span",{children:[e.childCount," ",e.childCount===1?"child":"children"]})]})]}),t.jsx(v,{type:"source",position:k.Bottom,className:"!w-2 !h-2"})]})}),G=b.memo(function({id:e,sourceX:r,sourceY:i,targetX:d,targetY:s,sourcePosition:o,targetPosition:u,data:l,style:n={}}){const[m,f,c]=L({sourceX:r,sourceY:i,sourcePosition:o,targetX:d,targetY:s,targetPosition:u}),p=(l==null?void 0:l.relationType)||"related_to",x=h[p]||h.related_to;return t.jsxs(t.Fragment,{children:[t.jsx(_,{id:e,path:m,style:{...n,stroke:x.color,strokeDasharray:x.dashed?"5 5":void 0,strokeWidth:1.5}}),t.jsx(P,{children:t.jsx("div",{className:"text-[9px] text-muted bg-surface px-1 rounded pointer-events-none absolute",style:{transform:`translate(-50%, -50%) translate(${f}px,${c}px)`},children:x.label})})]})});function R(a,e){const r=[],i=[];for(const d of e)d.from===a&&r.push(d),d.to===a&&i.push(d);return{outgoing:r,incoming:i}}const Y=b.memo(function({node:e,edges:r=[],allNodes:i=[],childrenMap:d,onClose:s,onNodeNavigate:o}){if(!e)return null;const u=j[e.type]||"#6c757d",l=N[e.status]||"#9e9e9e",n=b.useMemo(()=>R(e.id,r),[e.id,r]),m=b.useMemo(()=>{const c=new Map;for(const p of i)c.set(p.id,p);return c},[i]),f=n.outgoing.length>0||n.incoming.length>0;return t.jsxs("div",{className:"w-80 border-l border-edge bg-surface-alt overflow-y-auto p-4",children:[t.jsxs("div",{className:"flex items-center justify-between mb-3",children:[t.jsx("h3",{className:"text-sm font-bold",children:"Node Details"}),t.jsx("button",{onClick:s,className:"text-muted hover:text-foreground text-lg leading-none",children:"×"})]}),t.jsx("h4",{className:"text-base font-semibold mb-3",children:e.title}),t.jsxs("div",{className:"space-y-2 text-sm",children:[t.jsx(g,{label:"ID",children:t.jsx("code",{className:"text-xs bg-surface-elevated px-1 rounded break-all",children:e.id})}),t.jsx(g,{label:"Type",children:t.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-medium",style:{background:`${u}20`,color:u},children:e.type})}),t.jsx(g,{label:"Status",children:t.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium",style:{background:`${l}20`,color:l},children:e.status.replace("_"," ")})}),t.jsxs(g,{label:"Priority",children:["P",e.priority]}),e.xpSize&&t.jsx(g,{label:"Size",children:e.xpSize}),e.estimateMinutes!=null&&t.jsxs(g,{label:"Estimate",children:[e.estimateMinutes,"min"]}),e.sprint&&t.jsx(g,{label:"Sprint",children:e.sprint}),e.description&&t.jsxs("div",{className:"pt-2 border-t border-edge",children:[t.jsx("div",{className:"text-xs font-medium text-muted mb-1",children:"Description"}),t.jsx("p",{className:"text-xs whitespace-pre-wrap",children:e.description})]}),d&&(()=>{const c=d.get(e.id)??[];return c.length===0?null:t.jsxs("div",{className:"pt-2 border-t border-edge",children:[t.jsxs("div",{className:"text-xs font-medium text-muted mb-1",children:["Children (",c.length,")"]}),t.jsx("div",{className:"space-y-1",children:c.map(p=>{const x=m.get(p);if(!x)return null;const D=N[x.status]||"#9e9e9e",S=j[x.type]||"#6c757d";return t.jsxs("button",{onClick:()=>o==null?void 0:o(p),className:"w-full text-left flex items-center gap-1.5 px-1.5 py-1 rounded hover:bg-surface-elevated transition-colors text-xs",children:[t.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:D}}),t.jsx("span",{className:"text-[9px] px-1 rounded shrink-0",style:{background:`${S}20`,color:S},children:x.type}),t.jsx("span",{className:"truncate font-medium",children:x.title})]},p)})})]})})(),f&&t.jsxs("div",{className:"pt-2 border-t border-edge",children:[t.jsxs("div",{className:"text-xs font-medium text-muted mb-1",children:["Relationships (",n.outgoing.length+n.incoming.length,")"]}),t.jsxs("div",{className:"space-y-1",children:[n.outgoing.map(c=>{const p=m.get(c.to),x=h[c.relationType]||h.related_to;return t.jsx(E,{direction:"out",label:x.label,color:x.color,targetTitle:(p==null?void 0:p.title)??c.to,targetId:c.to,onNavigate:o},c.id)}),n.incoming.map(c=>{const p=m.get(c.from),x=h[c.relationType]||h.related_to;return t.jsx(E,{direction:"in",label:x.label,color:x.color,targetTitle:(p==null?void 0:p.title)??c.from,targetId:c.from,onNavigate:o},c.id)})]})]}),e.acceptanceCriteria&&e.acceptanceCriteria.length>0&&t.jsxs("div",{className:"pt-2 border-t border-edge",children:[t.jsxs("div",{className:"text-xs font-medium text-muted mb-1",children:["Acceptance Criteria (",e.acceptanceCriteria.length,")"]}),t.jsx("ul",{className:"text-xs space-y-1 list-disc pl-4",children:e.acceptanceCriteria.map((c,p)=>t.jsx("li",{children:c},p))})]}),e.tags&&e.tags.length>0&&t.jsxs("div",{className:"pt-2 border-t border-edge",children:[t.jsx("div",{className:"text-xs font-medium text-muted mb-1",children:"Tags"}),t.jsx("div",{className:"flex flex-wrap gap-1",children:e.tags.map(c=>t.jsx("span",{className:"text-[10px] bg-surface-elevated px-1.5 py-0.5 rounded",children:c},c))})]}),e.sourceRef&&t.jsxs("div",{className:"pt-2 border-t border-edge",children:[t.jsx("div",{className:"text-xs font-medium text-muted mb-1",children:"Source"}),t.jsxs("div",{className:"text-xs",children:[e.sourceRef.file,e.sourceRef.startLine!=null&&` (L${e.sourceRef.startLine}–${e.sourceRef.endLine??"?"})`]})]}),t.jsxs("div",{className:"pt-2 border-t border-edge text-[10px] text-muted",children:[t.jsxs("div",{children:["Created: ",new Date(e.createdAt).toLocaleString()]}),t.jsxs("div",{children:["Updated: ",new Date(e.updatedAt).toLocaleString()]})]})]})]})});function g({label:a,children:e}){return t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsx("span",{className:"text-xs text-muted shrink-0",children:a}),t.jsx("div",{className:"text-right",children:e})]})}function E({direction:a,label:e,color:r,targetTitle:i,targetId:d,onNavigate:s}){const o=a==="out"?"→":"←";return t.jsxs("button",{onClick:()=>s==null?void 0:s(d),className:"w-full text-left flex items-center gap-1.5 px-1.5 py-1 rounded hover:bg-surface-elevated transition-colors text-xs",children:[t.jsx("span",{style:{color:r},children:o}),t.jsx("span",{className:"text-[10px] text-muted",children:e}),t.jsx("span",{className:"truncate font-medium",children:i})]})}const w=240,T=80;function K(a,e,r,i,d){return a.filter(s=>{var o,u;return!((o=e==null?void 0:e.statuses)!=null&&o.size&&!e.statuses.has(s.status)||(u=e==null?void 0:e.types)!=null&&u.size&&!e.types.has(s.type))}).map(s=>{const o=r==null?void 0:r.get(s.id),u=o!=null&&o.length>0;return{id:s.id,type:"workflowNode",position:{x:0,y:0},data:{label:s.title,nodeType:s.type,status:s.status,priority:s.priority,xpSize:s.xpSize,sprint:s.sprint,sourceNode:s,hasChildren:u,isExpanded:(i==null?void 0:i.has(s.id))??!1,childCount:(o==null?void 0:o.length)??0,onExpand:d},style:{width:w,borderLeft:`4px solid ${j[s.type]||"#6c757d"}`}}})}function U(a,e){return a.filter(r=>e.has(r.from)&&e.has(r.to)).map(r=>{const i=h[r.relationType]||h.related_to;return{id:r.id,source:r.from,target:r.to,label:i.label,type:"workflowEdge",data:{relationType:r.relationType},style:{stroke:i.color,strokeDasharray:i.dashed?"5 5":void 0},labelStyle:{fontSize:10,fill:"#6c757d"}}})}function $(a,e,r){let i=0;const d=[r,...a,"|",...e];for(const s of d)for(let o=0;o<s.length;o++)i=(i<<5)-i+s.charCodeAt(o)|0;return i}function V(a,e){if(a===null||a.length!==e.length)return!1;for(let r=0;r<a.length;r++)if(a[r]!==e[r])return!1;return!0}let y=null;function X(a,e,r="TB"){const i=a.map(l=>l.id),d=e.map(l=>`${l.source}-${l.target}`),s=$(i,d,r);let o;if(y&&y.key===s)o=y.positions;else{const l=new C.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:r,ranksep:60,nodesep:40});for(const n of a)l.setNode(n.id,{width:w,height:T});for(const n of e)l.setEdge(n.source,n.target);C.layout(l),o=new Map;for(const n of a){const m=l.node(n.id);o.set(n.id,{x:m.x-w/2,y:m.y-T/2})}y={key:s,positions:o}}return{nodes:a.map(l=>{const n=o.get(l.id)??{x:0,y:0};return{...l,position:n}}),edges:e}}export{Y as N,G as W,B as a,H as b,U as c,X as d,F as e,A as g,V as s,K as t};
|