scip-query 0.20.0 → 0.21.1
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/CHANGELOG.md +81 -0
- package/README.md +255 -884
- package/dist/augment-vue-worker.js +1 -1
- package/dist/by-kind-XXGZGNZ6.js +2 -0
- package/dist/call-graph-VGY3R4L3.js +2 -0
- package/dist/call-graph-evidence-lZa2dwQA.d.ts +11 -0
- package/dist/change-analysis-types-CCtoCHbC.d.ts +9 -0
- package/dist/chunk-26CT72HM.js +2 -0
- package/dist/chunk-27OUNZW5.js +3 -0
- package/dist/chunk-2LJLEM5B.js +2 -0
- package/dist/chunk-3KXFB2FM.js +2 -0
- package/dist/chunk-3T5U2EQ2.js +2 -0
- package/dist/chunk-3TNRNKAT.js +2 -0
- package/dist/{chunk-PXY7F6Y4.js → chunk-3XQLJG7V.js} +5 -5
- package/dist/chunk-3XZELASU.js +2 -0
- package/dist/chunk-3YETOKNO.js +4 -0
- package/dist/chunk-47WX6UC4.js +2 -0
- package/dist/{chunk-7SQQWSY3.js → chunk-4HQYNZ3P.js} +2 -2
- package/dist/chunk-4IASLUOP.js +3 -0
- package/dist/{chunk-KMKTIO2G.js → chunk-4KIPF45P.js} +2 -2
- package/dist/chunk-4SZJF4GK.js +2 -0
- package/dist/chunk-4TOU7HHQ.js +2 -0
- package/dist/chunk-4ZCLDH6T.js +11 -0
- package/dist/{chunk-DQGFVPUV.js → chunk-527HV7JY.js} +3 -3
- package/dist/{chunk-ZTETIQ35.js → chunk-5BJPJUXF.js} +2 -2
- package/dist/chunk-5J3A6RBZ.js +16 -0
- package/dist/chunk-5KIJMEPC.js +2 -0
- package/dist/{chunk-JDOEX4E6.js → chunk-5QM7QT5B.js} +2 -2
- package/dist/chunk-5Z2H76VD.js +11 -0
- package/dist/chunk-63TFRBMB.js +2 -0
- package/dist/chunk-67FK5KGV.js +3 -0
- package/dist/chunk-6DO3VBLV.js +2 -0
- package/dist/chunk-6LS3IG2I.js +13 -0
- package/dist/chunk-6QN4FYQW.js +2 -0
- package/dist/chunk-6X4KO5A7.js +11 -0
- package/dist/chunk-743MEVFJ.js +8 -0
- package/dist/chunk-7G2WIVIX.js +2 -0
- package/dist/chunk-7KCZELVM.js +2 -0
- package/dist/chunk-7MUHSZGN.js +3 -0
- package/dist/chunk-7YZGSLW6.js +3 -0
- package/dist/chunk-7Z4GMCHM.js +117 -0
- package/dist/{chunk-32LVLCLN.js → chunk-AAOEROT3.js} +3 -3
- package/dist/chunk-AFRS7WJU.js +26 -0
- package/dist/chunk-ANCHW2R4.js +57 -0
- package/dist/{chunk-SXP2MBJH.js → chunk-AQF35NGT.js} +2 -2
- package/dist/chunk-ARGPDW2Y.js +6 -0
- package/dist/chunk-B3AREUQK.js +16 -0
- package/dist/chunk-BCTCADNB.js +2 -0
- package/dist/chunk-BM4OTGSY.js +3 -0
- package/dist/chunk-BMKTDJI6.js +16 -0
- package/dist/chunk-BOJ5SVE2.js +2 -0
- package/dist/{chunk-WXZLAAWK.js → chunk-BVR44XXB.js} +2 -2
- package/dist/{chunk-RUJURYSV.js → chunk-BYXWXLKM.js} +2 -2
- package/dist/chunk-BZCRHP46.js +3 -0
- package/dist/chunk-BZYSGZRK.js +2 -0
- package/dist/chunk-C52Q3JEQ.js +2 -0
- package/dist/chunk-C7WSQA6A.js +21 -0
- package/dist/{chunk-BDCC2NPY.js → chunk-CNT4ND5O.js} +2 -2
- package/dist/chunk-CQVDALWQ.js +2 -0
- package/dist/chunk-CTO3TRX7.js +2 -0
- package/dist/chunk-CXT3GZSQ.js +2 -0
- package/dist/{chunk-JVYA47YU.js → chunk-DGM2RJ3I.js} +2 -2
- package/dist/{chunk-7PIO7NKH.js → chunk-DK6MB565.js} +2 -2
- package/dist/chunk-DNPETNXT.js +2 -0
- package/dist/chunk-DRENNWRG.js +2 -0
- package/dist/chunk-DUDUIT5P.js +2 -0
- package/dist/chunk-DXEJ4FLZ.js +21 -0
- package/dist/chunk-DXYMTQZ4.js +2 -0
- package/dist/chunk-DZA7MQMU.js +6 -0
- package/dist/{chunk-ZHXX42OH.js → chunk-DZNWXJN2.js} +4 -4
- package/dist/{chunk-CJST5ETY.js → chunk-E6N6YTVM.js} +2 -2
- package/dist/chunk-E7CJ6O72.js +2 -0
- package/dist/chunk-EJHNTAEE.js +2 -0
- package/dist/chunk-EPLE5O5O.js +2 -0
- package/dist/chunk-F4FNK44D.js +2 -0
- package/dist/chunk-FCGMQETU.js +2 -0
- package/dist/chunk-FIO44MVK.js +3 -0
- package/dist/chunk-FLSVYEPL.js +2 -0
- package/dist/chunk-FOP7HD6H.js +3 -0
- package/dist/chunk-FSPENGSU.js +4 -0
- package/dist/chunk-FUUDUAKM.js +2 -0
- package/dist/chunk-FYCH2EYQ.js +2 -0
- package/dist/{chunk-5E4WNAVD.js → chunk-G47MFF47.js} +2 -2
- package/dist/chunk-G6VV7ROY.js +2 -0
- package/dist/chunk-GBZCVYWA.js +2 -0
- package/dist/chunk-GSHTVE56.js +3 -0
- package/dist/chunk-GTZFKDP3.js +2 -0
- package/dist/{chunk-2HPVVXM5.js → chunk-H2RBDP5S.js} +2 -2
- package/dist/chunk-H5EXS3HM.js +2 -0
- package/dist/chunk-HR5JYLVV.js +4 -0
- package/dist/chunk-HW7FASEL.js +2 -0
- package/dist/chunk-HYU4W353.js +10 -0
- package/dist/{chunk-FKSELJQF.js → chunk-I2LY3KN7.js} +2 -2
- package/dist/chunk-IGBQVEHE.js +2 -0
- package/dist/{chunk-3G66UZBH.js → chunk-IH3K5J6K.js} +2 -2
- package/dist/chunk-IHGK3SZ7.js +29 -0
- package/dist/chunk-IM23CSG5.js +2 -0
- package/dist/chunk-IQMGNIGY.js +2 -0
- package/dist/chunk-ITF3CWS5.js +2 -0
- package/dist/chunk-IZKJQQCQ.js +3 -0
- package/dist/chunk-J4HUBIVF.js +5 -0
- package/dist/{chunk-AZJQQKDD.js → chunk-JGMD6JGB.js} +2 -2
- package/dist/chunk-JLZWYDCZ.js +4 -0
- package/dist/chunk-JO6FK3Q5.js +2 -0
- package/dist/chunk-JSHDCVUM.js +81 -0
- package/dist/chunk-K2DZCH2K.js +2 -0
- package/dist/chunk-K63CAPS2.js +23 -0
- package/dist/chunk-KBIC6JHJ.js +2 -0
- package/dist/chunk-KFFQURUZ.js +2 -0
- package/dist/chunk-KFOYCQAJ.js +9 -0
- package/dist/chunk-KGKCJFWZ.js +6 -0
- package/dist/chunk-KK7GPALL.js +28 -0
- package/dist/chunk-L7WRUNKJ.js +2 -0
- package/dist/{chunk-W4ETQAXM.js → chunk-LFWB7TOJ.js} +2 -2
- package/dist/chunk-LGVTIZPV.js +61 -0
- package/dist/chunk-LIWIV26I.js +29 -0
- package/dist/chunk-LJMWILX6.js +3 -0
- package/dist/{chunk-BPAPWKP6.js → chunk-LXMW6ZAX.js} +8 -8
- package/dist/chunk-MFBVUQJZ.js +2 -0
- package/dist/{chunk-O64IZ6UX.js → chunk-MLTKGHD2.js} +2 -2
- package/dist/chunk-MLTSTKXD.js +5 -0
- package/dist/chunk-MR4ZKWO6.js +57 -0
- package/dist/{chunk-EN3O7VJA.js → chunk-MRXBLYRE.js} +2 -2
- package/dist/chunk-MXNGIEPU.js +3 -0
- package/dist/chunk-N4EFQIRX.js +20 -0
- package/dist/chunk-ND3BWIVN.js +7 -0
- package/dist/chunk-NODZYYGC.js +2 -0
- package/dist/chunk-NP4JFCLE.js +133 -0
- package/dist/chunk-NQXWWE6S.js +8 -0
- package/dist/chunk-NSDPPUDY.js +7 -0
- package/dist/chunk-NT4NVEHU.js +18 -0
- package/dist/chunk-O2VY47Y5.js +325 -0
- package/dist/chunk-O3EX5STE.js +5 -0
- package/dist/chunk-O4PZFAXA.js +3 -0
- package/dist/chunk-OA2BO4DR.js +2 -0
- package/dist/chunk-OFZVFIDF.js +3 -0
- package/dist/{chunk-PQCI4SQX.js → chunk-OG5UK2K7.js} +2 -2
- package/dist/chunk-OMVNRPST.js +2 -0
- package/dist/{chunk-7BAVHKMJ.js → chunk-OU6SDWAM.js} +9 -9
- package/dist/{chunk-LY4WC4AD.js → chunk-OY7PCALC.js} +2 -2
- package/dist/{chunk-A73XVBCR.js → chunk-P3UFF22M.js} +2 -2
- package/dist/chunk-PAZSBPJR.js +3 -0
- package/dist/chunk-PJBYDCBQ.js +38 -0
- package/dist/chunk-PRLU3I7G.js +79 -0
- package/dist/chunk-PU6XDQ2X.js +16 -0
- package/dist/{chunk-3CLX5EOX.js → chunk-PWEQ6CZZ.js} +2 -2
- package/dist/{chunk-XSRF6Q77.js → chunk-PX6QNUYF.js} +2 -2
- package/dist/chunk-Q4MRRB3C.js +3 -0
- package/dist/chunk-QGVUPYBC.js +35 -0
- package/dist/chunk-QH5Q6M5C.js +2 -0
- package/dist/chunk-QLWZUFDT.js +2 -0
- package/dist/chunk-QN2AI3D2.js +3 -0
- package/dist/{chunk-JAYYFEQY.js → chunk-QZCACNV5.js} +2 -2
- package/dist/chunk-RNKRYK6B.js +4 -0
- package/dist/chunk-RSUH7G5T.js +29 -0
- package/dist/chunk-RZWBTKXO.js +5 -0
- package/dist/chunk-SBFDPHKH.js +4 -0
- package/dist/{chunk-HX4GQPZP.js → chunk-SGSPCEFC.js} +3 -3
- package/dist/chunk-SIGVQT43.js +2 -0
- package/dist/chunk-SRIZDEWX.js +4 -0
- package/dist/chunk-SV2LEFVM.js +2 -0
- package/dist/chunk-T2PBOVDI.js +3 -0
- package/dist/chunk-TP2X2C2Y.js +3 -0
- package/dist/chunk-U2MNECDU.js +2 -0
- package/dist/chunk-U7DOYZDH.js +2 -0
- package/dist/chunk-UAQQR55F.js +2 -0
- package/dist/chunk-UBETC3Q2.js +2 -0
- package/dist/chunk-UEQORB2A.js +2 -0
- package/dist/chunk-UM56ZET4.js +38 -0
- package/dist/chunk-UXNXOMXJ.js +2 -0
- package/dist/{chunk-6SHPK5ZE.js → chunk-V6XENWOF.js} +2 -2
- package/dist/chunk-VJAD5WX5.js +2 -0
- package/dist/chunk-VRJG7N3I.js +453 -0
- package/dist/chunk-W7HN6V4E.js +7 -0
- package/dist/chunk-WCIKJ2E3.js +3 -0
- package/dist/chunk-WEXQYJY3.js +5 -0
- package/dist/chunk-WOPZX5GM.js +2 -0
- package/dist/chunk-WRQXLNYE.js +9 -0
- package/dist/{chunk-XKWKXZKW.js → chunk-WV6R37XV.js} +2 -2
- package/dist/{chunk-N5W4YZMK.js → chunk-WZ7V4BQV.js} +2 -2
- package/dist/chunk-WZRNEVYC.js +2 -0
- package/dist/chunk-X5MWO4DM.js +7 -0
- package/dist/chunk-XDAUYDFT.js +2 -0
- package/dist/{chunk-L7AW2QB5.js → chunk-XDOEHEET.js} +2 -2
- package/dist/chunk-XDQX6LDT.js +4 -0
- package/dist/chunk-XFRHBAIT.js +2 -0
- package/dist/chunk-XIPGCT3D.js +5 -0
- package/dist/chunk-XKM5D2XS.js +16 -0
- package/dist/chunk-XNF5T4T2.js +4 -0
- package/dist/chunk-Y2S4YNLH.js +3 -0
- package/dist/chunk-YA72ZUKO.js +2 -0
- package/dist/chunk-YBWE6J32.js +43 -0
- package/dist/chunk-YCXQQ3YB.js +2 -0
- package/dist/chunk-YDTK77JP.js +43 -0
- package/dist/chunk-YF25RQER.js +4 -0
- package/dist/chunk-YKHL4J3G.js +2 -0
- package/dist/chunk-YLNCTPOI.js +4 -0
- package/dist/chunk-YR7VRWNX.js +2 -0
- package/dist/chunk-YT4IQBET.js +3 -0
- package/dist/chunk-YUKYB54I.js +1 -0
- package/dist/chunk-Z2KGMIL4.js +2 -0
- package/dist/chunk-Z2QB75BS.js +3 -0
- package/dist/chunk-Z67JOKRE.js +554 -0
- package/dist/chunk-ZGDHC5AT.js +2 -0
- package/dist/chunk-ZMS4YCY7.js +2 -0
- package/dist/chunk-ZNW5A5VX.js +3 -0
- package/dist/{chunk-TFRAYKN6.js → chunk-ZP2WUVZ5.js} +2 -2
- package/dist/chunk-ZQUNCTEZ.js +2 -0
- package/dist/cli-main.js +8 -0
- package/dist/cli.js +1 -3
- package/dist/code-AXLJBZ6T.js +2 -0
- package/dist/code-B17qEMbt.d.ts +121 -0
- package/dist/code-result-json-CTZHAQXJ.js +2 -0
- package/dist/command-descriptors-6INSCKLW.js +342 -0
- package/dist/{config-types-jVM3D7MA.d.ts → config-types-B9B60MiR.d.ts} +199 -23
- package/dist/dataflow-AFXY423Q.js +2 -0
- package/dist/{db-B5PM5yNk.d.ts → db-BwIVAYNB.d.ts} +1 -1
- package/dist/dependence-slice-2G4X6VSJ.js +2 -0
- package/dist/deps-LMCAV5DO.js +2 -0
- package/dist/direct-navigation-2ONV22Y2.js +3 -0
- package/dist/entry-map-ZOC3VXO5.js +2 -0
- package/dist/exploration-topology-BG4v30HZ.d.ts +256 -0
- package/dist/file-dep-graph-Bqg3t3Px.d.ts +4 -0
- package/dist/file-kind-BKCVMNUf.d.ts +10 -0
- package/dist/files-WJQJLHMH.js +2 -0
- package/dist/graph-evidence-Bjyky2V4.d.ts +126 -0
- package/dist/graph-exploration-contract-CqDsnPQL.d.ts +7 -0
- package/dist/{health-Do5TKSJI.d.ts → health-CPp2Jf1Z.d.ts} +33 -34
- package/dist/hierarchy-ASNIHAX4.js +2 -0
- package/dist/imports-JICEKDKK.js +2 -0
- package/dist/index.d.ts +4 -31
- package/dist/index.js +1 -1
- package/dist/members-C5H2K3MS.js +2 -0
- package/dist/methods-KZOZHSD4.js +2 -0
- package/dist/next-anchor-candidates-BwMczMvX.d.ts +90 -0
- package/dist/output-continuation-command-NX3RH3TP.js +3 -0
- package/dist/output-pagination-3OFL2MJV.js +19 -0
- package/dist/postinstall.js +1 -1
- package/dist/project-reindex-A2SXUH2H.js +3 -0
- package/dist/queries/affected.d.ts +22 -4
- package/dist/queries/affected.js +1 -1
- package/dist/queries/anchors.d.ts +123 -0
- package/dist/queries/anchors.js +2 -0
- package/dist/queries/architecture.d.ts +3 -2
- package/dist/queries/architecture.js +1 -1
- package/dist/queries/bottlenecks.d.ts +26 -7
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +2 -2
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +17 -3
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +2 -2
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.d.ts +2 -2
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +2 -2
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.d.ts +5 -26
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +2 -2
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +2 -2
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/context.d.ts +145 -0
- package/dist/queries/context.js +2 -0
- package/dist/queries/convergence.d.ts +2 -2
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +8 -3
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +34 -7
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +40 -14
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +2 -2
- package/dist/queries/dead.js +1 -1
- package/dist/queries/decorative-checkers.d.ts +3 -3
- package/dist/queries/decorative-checkers.js +1 -1
- package/dist/queries/deep-chains.d.ts +4 -38
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/dependence-slice.d.ts +47 -0
- package/dist/queries/dependence-slice.js +2 -0
- package/dist/queries/dependency-depth.d.ts +49 -0
- package/dist/queries/dependency-depth.js +2 -0
- package/dist/queries/deps.d.ts +4 -2
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.d.ts +3 -3
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.d.ts +4 -4
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +2 -2
- package/dist/queries/drift.js +1 -1
- package/dist/queries/duplicate-bodies.d.ts +2 -2
- package/dist/queries/duplicate-bodies.js +1 -1
- package/dist/queries/entry-map.d.ts +121 -0
- package/dist/queries/entry-map.js +2 -0
- package/dist/queries/evidence.d.ts +70 -0
- package/dist/queries/evidence.js +2 -0
- package/dist/queries/extract-candidates.d.ts +2 -2
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +18 -5
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +2 -2
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +4 -3
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +5 -3
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +11 -5
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +2 -2
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +4 -4
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +56 -136
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +2 -2
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.d.ts +2 -2
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.d.ts +2 -2
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +2 -2
- package/dist/queries/methods.js +1 -1
- package/dist/queries/not-implemented.d.ts +3 -3
- package/dist/queries/not-implemented.js +1 -1
- package/dist/queries/outline.d.ts +2 -2
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +5 -9
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +27 -64
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +2 -2
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +2 -2
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +2 -2
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.d.ts +2 -2
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +2 -2
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/reference-neighborhood.d.ts +4 -0
- package/dist/queries/reference-neighborhood.js +2 -0
- package/dist/queries/reference-reachability.d.ts +48 -0
- package/dist/queries/reference-reachability.js +2 -0
- package/dist/queries/refs.d.ts +2 -2
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +2 -2
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.d.ts +2 -2
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +2 -2
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +2 -2
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +2 -2
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +3 -36
- package/dist/queries/slice.js +1 -1
- package/dist/queries/source-inspection.d.ts +209 -0
- package/dist/queries/source-inspection.js +2 -0
- package/dist/queries/source-search.d.ts +13 -0
- package/dist/queries/source-search.js +2 -0
- package/dist/queries/stale-abstractions.d.ts +2 -2
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +2 -2
- package/dist/queries/surface.d.ts +13 -4
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +2 -2
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system-map.d.ts +449 -0
- package/dist/queries/system-map.js +2 -0
- package/dist/queries/system.d.ts +5 -3
- package/dist/queries/system.js +1 -1
- package/dist/queries/test-quality.d.ts +2 -2
- package/dist/queries/test-quality.js +1 -1
- package/dist/queries/trace.d.ts +47 -3
- package/dist/queries/trace.js +1 -1
- package/dist/queries/twin-ab.d.ts +3 -3
- package/dist/queries/twin-ab.js +1 -1
- package/dist/queries/twin-drift.d.ts +3 -3
- package/dist/queries/twin-drift.js +1 -1
- package/dist/queries/unused-imports.d.ts +2 -2
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.d.ts +2 -2
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/value-flow.d.ts +43 -0
- package/dist/queries/value-flow.js +2 -0
- package/dist/queries/vue-component-duplicates.d.ts +2 -2
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.d.ts +2 -2
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.d.ts +2 -2
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +2 -2
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/query-service-fastpath.js +6 -0
- package/dist/query-service-server.js +5 -0
- package/dist/refs-ZOORVRQC.js +2 -0
- package/dist/refs-pagination-SRCUOYRD.js +2 -0
- package/dist/reindex-worker.js +85 -86
- package/dist/reindex.d.ts +64 -42
- package/dist/reindex.js +93 -77
- package/dist/repository-text-C0Q8VYdN.d.ts +19 -0
- package/dist/runtime.d.ts +287 -8
- package/dist/runtime.js +4 -3
- package/dist/rust-semantic-session-server.js +1 -1
- package/dist/rust-semantic-session-worker.js +1 -1
- package/dist/rust-semantic-worker.js +1 -1
- package/dist/{scip-cli-BnEwZRLJ.d.ts → scip-cli-H-n59izO.d.ts} +33 -2
- package/dist/slice-NOTBWA7S.js +2 -0
- package/dist/source-search-types-Dwz8KeuW.d.ts +79 -0
- package/dist/source-snippet-_wrcgmZc.d.ts +15 -0
- package/dist/stats-OOJ74B32.js +2 -0
- package/dist/surface-BTBCLKNA.js +2 -0
- package/dist/symbol-resolution-SVSMX4RN.js +2 -0
- package/dist/system-2EIUFP6B.js +2 -0
- package/dist/trace-BB2GHQPG.js +2 -0
- package/dist/typescript-mailbox-worker.js +1 -1
- package/dist/value-flow-OA7AHSUG.js +2 -0
- package/dist/watch-server.js +3 -2
- package/docs/AGENT_GUIDE.md +133 -476
- package/docs/AI_FAILURE_MODES.md +30 -301
- package/docs/API.md +1 -1
- package/docs/API_EVOLUTION.md +6 -0
- package/docs/CLI_JSON_OUTPUT.md +207 -29
- package/docs/COMMAND_REFERENCE.md +255 -154
- package/docs/CONFIGURATION_WRITE_SAFETY.md +14 -13
- package/docs/DETECTOR_EVIDENCE_CONTRACTS.md +84 -0
- package/docs/DETECTOR_GUIDE.md +46 -138
- package/docs/DURABILITY.md +7 -1
- package/docs/INDEX_GENERATIONS.md +6 -0
- package/docs/LOCK_PROTOCOL.md +8 -0
- package/docs/REINDEX_METADATA_COMPATIBILITY.md +13 -3
- package/docs/SECURITY_MODEL.md +39 -42
- package/docs/accuracy-audit-checklist.md +4 -0
- package/docs/accuracy-hardening-goal.md +9 -2
- package/docs/analyzer-inventory.md +59 -264
- package/docs/analyzer-validation-protocol.md +62 -170
- package/docs/architecture-coherence-vision.md +18 -12
- package/docs/locality-analyzer-design.md +1 -1
- package/docs/schemas/cli-json-envelope.schema.json +212 -27
- package/docs/schemas/cli-json-export-receipt.schema.json +25 -0
- package/docs/schemas/cli-output-page.schema.json +1 -1
- package/docs/schemas/observation-receipt.schema.json +164 -0
- package/docs/schemas/project-config.schema.json +37 -45
- package/docs/schemas/suppression-record.schema.json +1 -34
- package/package.json +69 -11
- package/skills/concrete-plan/SKILL.md +8 -0
- package/skills/concrete-plan/agents/openai.yaml +4 -0
- package/skills/scip-explore/SKILL.md +49 -61
- package/skills/scip-explore/agents/openai.yaml +3 -3
- package/skills/scip-explore/references/delegated-exploration.md +51 -0
- package/skills/scip-explore/references/external-evidence.md +72 -0
- package/skills/scip-explore/references/information-model.md +51 -0
- package/skills/scip-explore/scripts/capture-evidence.mjs +666 -0
- package/skills/scip-integrity-audit/SKILL.md +185 -0
- package/skills/scip-integrity-audit/agents/openai.yaml +4 -0
- package/skills/scip-plan/SKILL.md +67 -49
- package/skills/scip-plan/agents/openai.yaml +3 -3
- package/skills/scip-query/SKILL.md +98 -77
- package/skills/scip-query/agents/openai.yaml +3 -3
- package/skills/scip-setup/SKILL.md +10 -102
- package/skills/scip-setup/agents/openai.yaml +3 -3
- package/dist/chunk-26QA6FAI.js +0 -8
- package/dist/chunk-2KAZEZ6M.js +0 -2
- package/dist/chunk-3ORVDL3H.js +0 -2
- package/dist/chunk-46XGSFNI.js +0 -2
- package/dist/chunk-4MAK2HOY.js +0 -6
- package/dist/chunk-4TURLRL5.js +0 -16
- package/dist/chunk-4UQVNCQE.js +0 -2
- package/dist/chunk-55Q3WLZX.js +0 -2
- package/dist/chunk-5I5G2QOX.js +0 -3
- package/dist/chunk-6LDJQXAH.js +0 -2
- package/dist/chunk-6O5TICIZ.js +0 -3
- package/dist/chunk-7O5IKBTZ.js +0 -16
- package/dist/chunk-7S5E7KWT.js +0 -2
- package/dist/chunk-7WPLAODU.js +0 -5
- package/dist/chunk-AFHORGLH.js +0 -42
- package/dist/chunk-AIE7TFJW.js +0 -9
- package/dist/chunk-AQOFWNQJ.js +0 -1
- package/dist/chunk-B2PX5I6M.js +0 -2
- package/dist/chunk-B75HZHUP.js +0 -2
- package/dist/chunk-B7PBSLZN.js +0 -2
- package/dist/chunk-BBW6JFHN.js +0 -2
- package/dist/chunk-BNXCIFVY.js +0 -2
- package/dist/chunk-BS2NMXQZ.js +0 -4
- package/dist/chunk-C3KV2II6.js +0 -2
- package/dist/chunk-C43RDDP4.js +0 -20
- package/dist/chunk-DAFAHMNB.js +0 -42
- package/dist/chunk-DQLPXMH6.js +0 -8
- package/dist/chunk-EKZTZXHZ.js +0 -117
- package/dist/chunk-EW2NTSFA.js +0 -18
- package/dist/chunk-F3Z4OUDS.js +0 -8
- package/dist/chunk-FJH2NW7J.js +0 -66
- package/dist/chunk-FTFP6O3L.js +0 -11
- package/dist/chunk-FYLK2DEJ.js +0 -2
- package/dist/chunk-GH74ASD6.js +0 -11
- package/dist/chunk-GMXWZP2B.js +0 -2
- package/dist/chunk-GOUBFH5O.js +0 -3
- package/dist/chunk-HLF2TX6R.js +0 -2
- package/dist/chunk-HX7M4BDI.js +0 -30
- package/dist/chunk-HZ72SESS.js +0 -128
- package/dist/chunk-IB2N4FIY.js +0 -10
- package/dist/chunk-IZYYAFN5.js +0 -2
- package/dist/chunk-JFGGXWQF.js +0 -947
- package/dist/chunk-JN4NMBEX.js +0 -8
- package/dist/chunk-JW56N3KI.js +0 -4
- package/dist/chunk-JZ2OXNWB.js +0 -2
- package/dist/chunk-KFZNKUNT.js +0 -2
- package/dist/chunk-L5GJNV2T.js +0 -8
- package/dist/chunk-L7JDSCDF.js +0 -4
- package/dist/chunk-LU47HG23.js +0 -14
- package/dist/chunk-LVY7NPF7.js +0 -2
- package/dist/chunk-MKCDWWGV.js +0 -4
- package/dist/chunk-MNE7YG56.js +0 -2
- package/dist/chunk-MRXBEXSY.js +0 -26
- package/dist/chunk-MV7OWDUX.js +0 -2
- package/dist/chunk-NGEXCJJW.js +0 -11
- package/dist/chunk-NIW6JDC5.js +0 -29
- package/dist/chunk-PBUQFCNB.js +0 -16
- package/dist/chunk-POAVPHH7.js +0 -2
- package/dist/chunk-QZ4JVECJ.js +0 -2
- package/dist/chunk-RDO52JGY.js +0 -2
- package/dist/chunk-RJT3TUUZ.js +0 -2
- package/dist/chunk-RVLDN63O.js +0 -4
- package/dist/chunk-RXOXSKY3.js +0 -2
- package/dist/chunk-S7OYBOCK.js +0 -2
- package/dist/chunk-SMNXQT5Z.js +0 -3
- package/dist/chunk-SRAFT254.js +0 -2
- package/dist/chunk-T7YQSHPQ.js +0 -3
- package/dist/chunk-UJCOIXDY.js +0 -2
- package/dist/chunk-UJPRPGCO.js +0 -13
- package/dist/chunk-WCCFZ7V7.js +0 -113
- package/dist/chunk-WUPW3UN3.js +0 -3
- package/dist/chunk-X54AGLVX.js +0 -2
- package/dist/chunk-Y2MVPNKY.js +0 -5
- package/dist/chunk-YKUU5AIC.js +0 -3
- package/dist/chunk-YLCJLTPL.js +0 -2
- package/dist/chunk-YTQVETEO.js +0 -2
- package/dist/chunk-Z4N3MZYA.js +0 -38
- package/dist/chunk-ZJOOT3BG.js +0 -2
- package/dist/chunk-ZK26BAQL.js +0 -2
- package/dist/command-descriptors-DSS46KXI.js +0 -642
- package/dist/diff-gate-types-B0QYpDv1.d.ts +0 -11
- package/dist/direct-navigation-6YHV6IB5.js +0 -3
- package/dist/queries/diff-gate.d.ts +0 -253
- package/dist/queries/diff-gate.js +0 -2
- package/docs/COMMITTED_RECORD_COMPATIBILITY.md +0 -154
- package/docs/analyzer-validation-ledger.md +0 -516
- package/docs/schemas/outcome-event-record.schema.json +0 -95
- package/skills/_shared/SKILL.md +0 -101
- package/skills/_shared/agents/openai.yaml +0 -4
- package/skills/_shared/references/agent-contract-catalog.md +0 -105
- package/skills/_shared/references/command-catalog.md +0 -118
- package/skills/_shared/references/detector-precision-and-diffgate.md +0 -59
- package/skills/_shared/references/evidence-and-dead-code.md +0 -25
- package/skills/scip-audit/SKILL.md +0 -77
- package/skills/scip-audit/agents/openai.yaml +0 -4
- package/skills/scip-audit/references/claims.md +0 -98
- package/skills/scip-audit/references/cleanup.md +0 -100
- package/skills/scip-audit/references/directory.md +0 -222
- package/skills/scip-audit/references/frontend.md +0 -130
- package/skills/scip-audit/references/integrity.md +0 -154
- package/skills/scip-audit/references/maintainability.md +0 -162
- package/skills/scip-audit/references/twin-drift.md +0 -104
- package/skills/scip-diagnose/SKILL.md +0 -52
- package/skills/scip-diagnose/agents/openai.yaml +0 -4
- package/skills/scip-diagnose/references/debug.md +0 -117
- package/skills/scip-diagnose/references/probe-reachability.md +0 -77
- package/skills/scip-diagnose/references/root-cause.md +0 -145
- package/skills/scip-diagnose/references/triage.md +0 -119
- package/skills/scip-explore/references/diagrams.md +0 -40
- package/skills/scip-explore/references/language-playbook.md +0 -49
- package/skills/scip-improve/SKILL.md +0 -56
- package/skills/scip-improve/agents/openai.yaml +0 -4
- package/skills/scip-improve/references/cleanup-batches.md +0 -53
- package/skills/scip-improve/references/directory-moves.md +0 -53
- package/skills/scip-improve/references/doc-reconcile.md +0 -30
- package/skills/scip-improve/references/frontend-extraction.md +0 -39
- package/skills/scip-improve/references/maintainability-mechanism.md +0 -43
- package/skills/scip-improve/references/twin-drift.md +0 -35
- package/skills/scip-plan/references/api-impact.md +0 -19
- package/skills/scip-plan/references/conductor.md +0 -41
- package/skills/scip-plan/references/high-assurance.md +0 -43
- package/skills/scip-plan/references/hyper-optimization.md +0 -50
- package/skills/scip-plan/references/tla-model.md +0 -88
- package/skills/scip-setup/references/bootstrap-workflow.md +0 -119
- package/skills/scip-setup/references/language-verification.md +0 -61
- package/skills/scip-setup/references/lifecycle-commands.md +0 -119
- package/skills/scip-setup/references/per-repo-triage.md +0 -24
- package/skills/scip-verify/SKILL.md +0 -229
- package/skills/scip-verify/agents/openai.yaml +0 -4
- package/skills/scip-verify/references/calibrate-detectors.md +0 -170
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{a as ye}from"./chunk-3TNRNKAT.js";import{b as ne,c as Xe}from"./chunk-7KCZELVM.js";import{a as Zn}from"./chunk-OFZVFIDF.js";import{a as gt,b as yt,c as Qn,d as Ye,e as Qt,f as Me,g as Yt,h as Xt}from"./chunk-YF25RQER.js";import{b as Yn,c as Xn,d as ht}from"./chunk-SRIZDEWX.js";import{a as Ut,b as zn,c as Wn,d as Hn,h as Vt,i as Vn}from"./chunk-MR4ZKWO6.js";import{a as je}from"./chunk-XFRHBAIT.js";import{b as pt}from"./chunk-EPLE5O5O.js";import{a as Ee,d as mt,e as Un,f as ft,n as Ht}from"./chunk-5J3A6RBZ.js";import{b as Wt}from"./chunk-T2PBOVDI.js";import{b as Gn,c as jn}from"./chunk-UAQQR55F.js";import{A as ge,C as zt,G as xe,I as On,P as X,Q as qn,W as Ge,g as dt,j as le,q as qt,v as Y,y as ut,z as J}from"./chunk-NP4JFCLE.js";import{a as _n,b as Bn}from"./chunk-5Z2H76VD.js";import{b as Kn,c as ee,h as re}from"./chunk-DRENNWRG.js";import{c as Dn}from"./chunk-FYCH2EYQ.js";import{C as Pe,c as kn,f as $n}from"./chunk-XIPGCT3D.js";import{createHash as pc}from"crypto";var Yr=[{id:"general-interprocedural-value-flow",families:["dataflow"],capability:"Whole-program definition-use flow through arbitrary calls and returns is unavailable.",consequence:"Missing dataflow edges cannot establish that a value never crosses an unmodeled call.",recoverWith:["value-flow","dependence-slice","inspect","code"]},{id:"heap-aliasing",families:["dataflow","state"],capability:"Heap points-to and cross-instance alias analysis are unavailable.",consequence:"Missing field or state edges cannot establish that two references never reach the same object.",recoverWith:["value-flow","dependence-slice","inspect","code"]},{id:"exceptional-flow",families:["execution","dataflow","temporal"],capability:"Interprocedural exception propagation and finally completion flow are unavailable.",consequence:"Normal-path reachability and ordering do not establish behavior after a throw or rejection.",recoverWith:["dependence-slice","inspect","code"]},{id:"reflection",families:["execution","runtime","identity","dependencies"],capability:"Reflective lookup, dynamic loading, and name-computed invocation are unavailable without exact evidence.",consequence:"Missing static edges cannot establish that a construct is unreachable through reflection.",recoverWith:["search","inspect","code"]},{id:"generated-dispatch",families:["execution","runtime","identity"],capability:"Dispatch tables or names created only by generated or unavailable source are unavailable.",consequence:"Missing dispatch edges cannot establish that no generated consumer exists.",recoverWith:["search","inspect","code"]},{id:"unsupported-framework-adapters",families:["runtime","dataflow","state","temporal"],capability:"Framework runtime crossings without a registered source adapter are unavailable.",consequence:"Missing boundary edges cannot establish that no producer, consumer, state effect, or ordering exists.",recoverWith:["search","inspect","code"]}];function Xr(e){let t=new Set(e);return Yr.filter(n=>n.families.some(o=>t.has(o)))}function Jn(e){return Xr(e).map(t=>`[${t.id}] ${t.capability} ${t.consequence} Recover selected paths with: ${t.recoverWith.map(n=>`scip-query ${n}`).join(", ")}.`)}var Zr=["incoming","outgoing","both"];function W(e,t,n,o={}){return{family:e,subtype:t,...o.match?{match:o.match}:{},directions:Zr,evidenceStrengths:o.strengths??["exact","derived","mixed"],supportCeiling:o.supportCeiling??"partial",establishes:n,nonClaims:o.nonClaims??[],recoverWith:o.recoverWith??["inspect","code"]}}var Jr=["predicate-consequence","predicate-alternative","predicate-fallthrough","predicate-case","predicate-default","predicate-return","predicate-throw","loop-iteration","loop-exit","exception-handler","finally-cleanup","handler-return","handler-throw"],ei=["captured-value-to-state","constant-to-state","expression-to-state","property-to-state","return-to-state","value-to-state"],ti=["await-completion-before","awaits-completion","inside-lock-scope","lexical-successor"],ni=[{id:"indexed-program-identity",label:"SCIP/compiler identity and source ownership",requirements:["indexed-graph"],relations:[W("execution","call","The source construct may call the resolved target.",{strengths:["exact","derived","candidate","mixed"],nonClaims:["Static may-call reachability does not prove that an invocation occurred at runtime."],recoverWith:["call-graph","inspect","code"]}),W("execution","result-callback","The referenced callable can produce the result consumed by this path.",{nonClaims:["A callback relationship does not prove invocation order or runtime selection."],recoverWith:["call-graph","inspect","code"]}),W("contract","uses-contract-symbol","The source construct refers to the identified contract symbol.",{supportCeiling:"exact",nonClaims:["Contract identity does not prove runtime invocation or behavioral conformance."],recoverWith:["hierarchy","inspect","code"]}),W("identity","references","The occurrence resolves to the identified compiler-owned symbol.",{supportCeiling:"exact",nonClaims:["A reference does not establish execution or value transfer."],recoverWith:["refs","trace","inspect"]}),W("ownership","contains","The owner contains the identified program construct.",{supportCeiling:"exact",nonClaims:["Structural containment does not establish runtime lifetime or sharing scope."],recoverWith:["outline","inspect"]}),W("ownership","contains-","The owner contains the identified program construct.",{match:"prefix",supportCeiling:"exact",nonClaims:["Structural containment does not establish runtime lifetime or sharing scope."],recoverWith:["outline","inspect"]}),W("ownership","owns-","The owner owns the identified source or runtime observation.",{match:"prefix",supportCeiling:"exact",nonClaims:["Observation ownership does not establish singleton lifetime or exclusive ownership."],recoverWith:["inspect","code"]}),W("dependencies","imports","The source file or module statically imports the indexed target.",{nonClaims:["An import does not establish that imported code executes."],recoverWith:["imports","deps","code"]}),W("dependencies","imports-external","The source region statically imports an external package.",{nonClaims:["An external import does not establish which package behavior executes."],recoverWith:["imports","code"]})]},{id:"runtime-boundary-join",label:"source-grounded runtime-boundary joins",requirements:["indexed-graph","source-facts"],relations:[W("runtime","runtime-handoff","A producer and consumer share a source-grounded runtime rendezvous.",{strengths:["exact","derived","candidate","mixed"],nonClaims:["A candidate or unresolved join does not prove a runtime handoff."],recoverWith:["evidence","inspect","code"]}),W("runtime","discriminator-dispatch","A serialized discriminator selects the reported consumer.",{strengths:["exact","derived","mixed"],nonClaims:["The dispatch edge does not prove delivery, retry, or successful handling."],recoverWith:["evidence","inspect","code"]}),W("dataflow","serialized-discriminator-transfer","The producer serializes the discriminator consumed by dispatch.",{strengths:["exact","derived","mixed"],nonClaims:["This edge does not establish the flow of every payload field."],recoverWith:["value-flow","inspect","code"]}),W("temporal","enqueue-before-consume","The reported enqueue precedes a possible consume through the queue.",{strengths:["exact","derived","mixed"],nonClaims:["Queue order does not establish delivery time, uniqueness, retry count, or durability."],recoverWith:["evidence","inspect","code"]})]},{id:"parser-control-dependence",label:"parser-proved intraprocedural control dependence",requirements:["indexed-graph","source-facts"],relations:[...Jr.map(e=>W("execution",e,"The outcome is control-dependent on the reported predicate or handler.",{strengths:["exact"],nonClaims:["Local control dependence does not establish that the containing function executes."],recoverWith:["dependence-slice","inspect","code"]})),W("execution","returns","The selected construct contains the reported return terminal.",{strengths:["exact"],nonClaims:["A local return terminal does not establish that the containing callable executes."],recoverWith:["inspect","code"]}),W("execution","throws","The selected construct contains the reported throw terminal.",{strengths:["exact"],nonClaims:["A local throw terminal does not establish propagation, handling, or callable execution."],recoverWith:["inspect","code"]})]},{id:"bounded-static-value-flow",label:"compiler callsites and bounded static value evaluation",requirements:["indexed-graph","source-facts"],relations:["argument-to-parameter","constant-to-parameter","property-to-parameter","return-to-parameter","return-to-call-result"].map(e=>W("dataflow",e,"The reported value may reach the target through the evidenced callsite transfer.",{strengths:["exact","derived","mixed"],nonClaims:["This provider does not establish general local definition-use, alias, field, or heap flow."],recoverWith:["value-flow","dependence-slice","inspect","code"]}))},{id:"typescript-local-dependence",label:"TypeScript compiler identities, control-flow graph, and reaching definitions",requirements:["typescript-semantic"],relations:[W("dataflow","definition-to-use","The definition reaches the reported read on a feasible local control-flow path.",{strengths:["exact"],nonClaims:["Local reaching definitions do not establish heap aliasing, exceptional flow, or the runtime order of closure invocation."],recoverWith:["value-flow","dependence-slice","inspect","code"]}),W("dataflow","value-to-definition","The reported right-hand-side read supplies the assigned local definition.",{strengths:["exact"],nonClaims:["A local assignment edge does not establish field or heap points-to flow."],recoverWith:["value-flow","dependence-slice","inspect","code"]}),W("dataflow","closure-capture","The nested callable reads the reported binding from an enclosing callable.",{strengths:["candidate"],supportCeiling:"candidate",nonClaims:["Closure capture does not establish whether or when the nested callable executes."],recoverWith:["call-graph","inspect","code"]}),W("dataflow","field-definition-to-use","The reported same-owner field definition can reach the field read.",{strengths:["exact","candidate"],nonClaims:["Field-name identity does not establish whole-program heap aliasing or cross-instance flow."],recoverWith:["value-flow","dependence-slice","inspect","code"]}),W("execution","control-dependence","Execution of the reported statement depends on the outcome of the predicate.",{strengths:["exact"],nonClaims:["Intraprocedural control dependence does not establish that the containing callable executes."],recoverWith:["dependence-slice","inspect","code"]})]},{id:"parser-state-temporal",label:"parser-proved local state and temporal facts",requirements:["indexed-graph","source-facts"],relations:[...ei.map(e=>W("dataflow",e,"The reported source value is assigned into the identified state resource.",{strengths:["exact"],nonClaims:["The edge does not establish alias, heap, or later read flow."],recoverWith:["value-flow","inspect","code"]})),...["writes-resource","deletes-resource","reads-resource","enqueues-resource","consumes-resource"].map(e=>W("state",e,"The reported construct performs the named operation on the identified resource.",{strengths:["exact"],nonClaims:["A state operation does not establish transactionality, durability, or exclusive ownership."],recoverWith:["evidence","inspect","code"]})),...ti.map(e=>W("temporal",e,"The reported source constructs have the named local ordering relationship.",{strengths:["exact"],nonClaims:["Local source order does not establish cross-process happens-before or durable completion."],recoverWith:["evidence","inspect","code"]}))]}];function eo(e,t){let n=ni.flatMap(o=>o.relations.filter(r=>r.family===e&&(r.match==="prefix"?t.startsWith(r.subtype):t===r.subtype)).map(r=>({provider:o,relation:r})));if(n.length>1)throw new Error(`Ambiguous graph relation provider for ${e}/${t}: ${n.map(o=>o.provider.id).join(", ")}`);return n[0]??null}var Ce=["execution","runtime","dataflow","state","temporal","contract","identity","ownership","dependencies"];function Ke(e){return e.includes("symbol-anchor")?0:e.includes("literal-owner")?1:e.some(t=>t.startsWith("boundary-import:"))?2:e.includes("reference-owner")?3:4}function to(e,t){return Ke(e.origins)-Ke(t.origins)||e.depth-t.depth||e.startLine-t.startLine||e.shortName.localeCompare(t.shortName)}var no=new WeakMap,oo=new WeakMap,ro=new WeakMap,io=new WeakMap,ao=new WeakMap;function so(e,t){let n=oo.get(e);n||(n=new Map,oo.set(e,n));let o=n.get(t);if(o)return o;let r=Y(e,t)?.rootNode;if(!r)return n.set(t,[]),[];let a=new Set;he(r,d=>{if(d.type!=="call_expression")return;let c=d.childForFieldName("function")??d.namedChild(0),u=/^([A-Za-z_$][\w$]*(?:\.Service)?)\.of$/u.exec(c?.text.replace(/\s+/gu,"")??"");u&&a.add(u[1])});let i=xe(e,t).filter(d=>!!d.sourcePath),s=new Set;for(let d of a){let c=/^([A-Za-z_$][\w$]*)\.Service$/u.exec(d);if(c){for(let u of i)u.localName===c[1]&&s.add(u.sourcePath);continue}if(d==="Service"){X(e,t).some(u=>u.leaf==="Service")&&s.add(t);for(let u of i)(u.localName??u.importedName)==="Service"&&s.add(u.sourcePath)}}let l=tn([...s]).sort();return n.set(t,l),l}function Zt(e,t,n={}){let r=zt(e,t)?.filter(m=>!n.ranges||n.ranges.some(p=>m.line>=p.startLine&&m.line<=p.endLine));if(!r)return{targets:[],unresolvedCallsites:0};let a=xe(e,t).filter(m=>!!m.sourcePath),i=Si(dt(e,t)??""),s=Y(e,t)?.rootNode??null,l=s?ri(s):lo(),d=new Map,c=ft(e),u=[],f=0;for(let m of r){if(!m.memberAccess)continue;let p=mt(t,c.get(m.calleeLeaf)??[]);if(n.excludeIndexedTargets!==!1&&Un(e,t,p,!0,m.calleeQualifier))continue;let g=m.calleeQualifier,b=hi(e,t,m,a);if(b){u.push(b);continue}let C=oi(e,t,m,a,ii(l,m.calleeQualifier,m.line));if(C.length>0){u.push(...C);continue}let S=ai(e,t,m);if(S.length>0){u.push(...S);continue}let v=g?i.get(g)??g:null,y=(v?tn(a.filter(L=>(L.localName??L.importedName)===v).map(L=>L.sourcePath)):[]).flatMap(L=>{let x=d.get(L);return x||(x=ge(e,L)??[],d.set(L,x)),x.filter(M=>M.name===m.calleeLeaf).map(M=>({file:L,callable:M}))});if(y.length!==1){f+=1;continue}let N=y[0];u.push({calleeLeaf:m.calleeLeaf,line:m.line,sourceFile:t,targetFile:N.file,targetStartLine:N.callable.startLine,targetEndLine:N.callable.endLine,resolution:"direct-import-receiver",strength:"candidate"})}return{targets:u,unresolvedCallsites:f}}function oi(e,t,n,o,r){let a=n.calleeQualifier;if(!a||!/^[A-Za-z_$][\w$]*$/u.test(a))return[];if(r.size!==1)return[];let i=[...r][0],s=tn(o.filter(c=>c.localName===i||c.importedName===i).map(c=>c.sourcePath));if(s.length!==1)return[];let l=s[0],d=di(e,l,n.calleeLeaf);return d.map(c=>({calleeLeaf:c.name,line:n.line,sourceFile:t,targetFile:c.file,targetStartLine:c.startLine,targetEndLine:c.endLine,serviceFile:l,resolutionAlternativeCount:d.length,resolution:"imported-service-object-member",strength:"candidate"}))}function lo(){return{declarations:new Map,callbacks:[]}}function ri(e){let t=lo();return he(e,n=>{if(n.type==="variable_declarator"){let l=n.childForFieldName("name")??n.namedChild(0),d=n.childForFieldName("value")??n.namedChild(1);if(l?.type!=="identifier"||!d)return;let c=new Set;if(he(d,u=>{if(u.type!=="member_expression")return;let f=u.childForFieldName("object")??u.namedChild(0),m=u.childForFieldName("property")??u.namedChild(1);f?.type==="identifier"&&m?.text==="Service"&&c.add(f.text)}),c.size===1){let u=t.declarations.get(l.text)??[];u.push({line:n.startPosition.row,alias:[...c][0]}),t.declarations.set(l.text,u)}return}if(!["arrow_function","function_expression","generator_function"].includes(n.type))return;let o=n.childForFieldName("parameters")??n.childForFieldName("parameter");if(!o)return;let r=n.parent;for(;r&&r.type!=="call_expression";)r=r.parent;if(!r)return;let a=r.childForFieldName("function")??r.namedChild(0),i=/^([A-Za-z_$][\w$]*)\.Service\.use$/u.exec(a?.text??"");if(!i)return;let s=new Set;he(o,l=>{l.type==="identifier"&&s.add(l.text)}),s.size!==0&&t.callbacks.push({startLine:n.startPosition.row,endLine:n.endPosition.row,receivers:s,alias:i[1]})}),t}function ii(e,t,n){if(!t||!/^[A-Za-z_$][\w$]*$/u.test(t))return new Set;let o=new Set((e.declarations.get(t)??[]).filter(r=>r.line<=n).map(r=>r.alias));for(let r of e.callbacks)r.startLine<=n&&r.endLine>=n&&r.receivers.has(t)&&o.add(r.alias);return o}function ai(e,t,n){let o=n.calleeQualifier;if(!o||!/^[A-Za-z_$][\w$]*$/u.test(o))return[];let r=Y(e,t)?.rootNode;if(!r)return[];let a=si(e,t,r,n.line,n.calleeLeaf,o),i=a?ci(a,o):null;if(!i)return[];if(!li(i))return[];let s=(ge(e,t)??[]).filter(m=>m.startLine<=i.startPosition.row&&m.endLine>=i.endPosition.row).sort((m,p)=>m.endLine-m.startLine-(p.endLine-p.startLine))[0];if(!s)return[];let l=X(e,t).filter(m=>m.isFunctionLike&&m.leaf===s.name);if(l.length!==1)return[];let d=l[0],c=io.get(e);c||(c=new Map,io.set(e,c));let u=`${d.symbol}\0${n.calleeLeaf}`,f=c.get(u);if(!f){let m=[];for(let p of Ht(e,d)){let g=Y(e,p.file)?.rootNode;if(!g)continue;let b=g.descendantsOfType("call_expression").filter(v=>v.startPosition.row>p.line||v.endPosition.row<p.line?!1:(v.childForFieldName("function")??v.namedChild(0))?.text.replace(/\s+/gu,"").replace(/<[^<>]*>$/u,"").match(/[A-Za-z_$][\w$]*$/u)?.[0]===d.leaf);if(b.length!==1)continue;let S=b[0].childForFieldName("arguments")?.namedChildren.find(v=>Ae(v).type==="object");if(S)for(let v of Ae(S).namedChildren){if(v.type==="shorthand_property_identifier"&&v.text===n.calleeLeaf){m.push(...bt(e,p.file,n.calleeLeaf,v,v));continue}if(v.type!=="pair")continue;let R=v.childForFieldName("key")??v.namedChild(0),y=v.childForFieldName("value")??v.namedChild(1);St(R?.text)!==n.calleeLeaf||!y||m.push(...bt(e,p.file,n.calleeLeaf,y,v))}}f=m.filter((p,g,b)=>b.findIndex(C=>C.file===p.file&&C.startLine===p.startLine&&C.endLine===p.endLine&&C.name===p.name)===g),c.set(u,f)}return f.map(m=>({calleeLeaf:m.name,line:n.line,sourceFile:t,targetFile:m.file,targetStartLine:m.startLine,targetEndLine:m.endLine,resolutionAlternativeCount:f.length,resolution:"factory-callback-member",strength:f.length===1?"exact":"candidate"}))}function si(e,t,n,o,r,a){let i=ro.get(e);i||(i=new Map,ro.set(e,i));let s=i.get(t);if(!s){s=new Map;for(let l of n.descendantsOfType("call_expression")){let d=l.childForFieldName("function")??l.namedChild(0),c=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(d?.text.replace(/\s+/gu,"")??"");if(c)for(let u=l.startPosition.row;u<=l.endPosition.row;u+=1){let f=`${u}\0${c[1]}\0${c[2]}`,m=s.get(f);(!m||l.endIndex-l.startIndex<m.endIndex-m.startIndex)&&s.set(f,l)}}i.set(t,s)}return s.get(`${o}\0${a}\0${r}`)??null}function li(e){return e.descendantsOfType("return_statement").some(t=>{let n=t.childForFieldName("argument")??t.namedChild(0);return!!(n&&Ae(n).type==="object")})}function ci(e,t){let n=e.parent;for(;n;){if(/(?:function|method|lambda)/u.test(n.type)||n.type==="arrow_function"){let o=n.childForFieldName("parameters")??n.childForFieldName("parameter"),r=!1;if(o&&he(o,a=>{a.type==="identifier"&&a.text===t&&(r=!0)}),r)return n}n=n.parent}return null}function bt(e,t,n,o,r){if(o.type==="identifier")return(ge(e,t)??[]).filter(l=>l.name===o.text).map(l=>({...l,file:t}));let a=Jt(e,t,o.text);if(a.length>0)return a;if(!en(o))return[];let s=(ge(e,t)??[]).filter(l=>l.startLine>=r.startPosition.row&&l.endLine<=r.endPosition.row&&(l.name===n||l.name.startsWith("source@"))).sort((l,d)=>l.endLine-l.startLine-(d.endLine-d.startLine))[0];return[s?{...s,file:t}:{name:n,file:t,startLine:r.startPosition.row,endLine:r.endPosition.row}]}function di(e,t,n){let o=ao.get(e);o||(o=new Map,ao.set(e,o));let r=`${t}\0${n}`,a=o.get(r);if(a)return a;let i=mi(e,t).flatMap(s=>ui(e,s,t,n));return o.set(r,i),i}function ui(e,t,n,o){let r=Y(e,t)?.rootNode,a=ge(e,t)??[];if(!r)return[];let i=fi(e,t,n);if(i.size===0)return[];let s=new Set,l=[],d=[],c=[];return he(r,f=>{if(pi(f,i)){if(f.type==="pair"){let m=f.childForFieldName("key")??f.namedChild(0),p=f.childForFieldName("value")??f.namedChild(1);if(St(m?.text)!==o||!p)return;if(p.type==="identifier")s.add(p.text);else if(en(p))l.push({name:o,startLine:f.startPosition.row,endLine:f.endPosition.row});else{let g=gi(e,t,p.text),b=Jt(e,t,p.text);if(g.length>0)c.push(...g);else if(b.length>0)c.push(...b);else{let C=yi(f);C&&d.push(C)}}return}f.type==="shorthand_property_identifier"&&f.text===o&&s.add(o)}}),[...a.filter(f=>s.has(f.name)).map(f=>({...f,file:t})),...l.map(f=>({...f,file:t})),...d.map(f=>({...f,file:t})),...c].filter((f,m,p)=>p.findIndex(g=>g.file===f.file&&g.name===f.name&&g.startLine===f.startLine&&g.endLine===f.endLine)===m)}function pi(e,t){let n=e,o=null;for(;n;){if(n.type==="object"&&(o=n),n.type==="call_expression"){if(!o)return!1;let r=n.childForFieldName("function")??n.namedChild(0);return r?t.has(r.text.replace(/\.of$/u,""))&&r.text.endsWith(".of"):!1}n=n.parent}return!1}function mi(e,t){let n=no.get(e);n||(n=new Map,no.set(e,n));let o=n.get(t);if(o)return o;let r=new Set([t]),a=X(e,t).filter(s=>s.leaf==="Service"&&s.isTypeLike);for(let s of a)for(let l of Ht(e,s))r.add(l.file);let i=[...r].sort();return n.set(t,i),i}function fi(e,t,n){let o=new Set;Pe(t,n)&&o.add("Service");for(let r of xe(e,t)){if(!r.sourcePath||!Pe(r.sourcePath,n))continue;if(r.kind==="namespace"&&r.localName){o.add(`${r.localName}.Service`);continue}(r.importedName==="default"?r.localName:r.importedName)==="Service"?o.add(r.localName??r.importedName):r.localName&&r.importedName!=="default"&&o.add(`${r.localName}.Service`)}return o}function Jt(e,t,n){let o=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n.replace(/\s+/gu,""));if(!o)return[];let r=Y(e,t)?.rootNode;if(!r)return[];let a=co(r,o[1]),i=a?uo(a):null;if(!i)return[];let s=i.childForFieldName("function")??i.namedChild(0),l=s?po(e,t,s.text):[];if(l.length!==1)return[];let d=l[0],c=Y(e,d.relativePath)?.rootNode;if(!c)return[];let u=qt(c,d.startLine,d.endLine);if(!u)return[];let f=[];for(let m of u.descendantsOfType("return_statement")){let p=m.childForFieldName("argument")??m.namedChild(0);if(!p)continue;let g=Ae(p);if(g.type==="object")for(let b of g.namedChildren){if(b.type==="shorthand_property_identifier"&&b.text===o[2]){for(let v of ge(e,d.relativePath)??[])v.name===o[2]&&f.push({...v,file:d.relativePath});continue}if(b.type!=="pair")continue;let C=b.childForFieldName("key")??b.namedChild(0),S=b.childForFieldName("value")??b.namedChild(1);if(!(St(C?.text)!==o[2]||!S))if(S.type==="identifier")for(let v of ge(e,d.relativePath)??[])v.name===S.text&&f.push({...v,file:d.relativePath});else en(S)&&f.push({name:o[2],startLine:b.startPosition.row,endLine:b.endPosition.row,file:d.relativePath})}}return f.filter((m,p,g)=>g.findIndex(b=>b.file===m.file&&b.name===m.name&&b.startLine===m.startLine&&b.endLine===m.endLine)===p)}function gi(e,t,n){let o=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n.replace(/\s+/gu,""));if(!o)return[];let r=Y(e,t)?.rootNode;if(!r)return[];let a=co(r,o[1]),i=a?uo(a):null,s=i?.childForFieldName("function")??i?.namedChild(0),l=s?po(e,t,s.text):[];if(l.length!==1||!i)return[];let d=l[0],c=Y(e,d.relativePath)?.rootNode;if(!c)return[];let u=qt(c,d.startLine,d.endLine);if(!u)return[];let f=new Set,m=u.childForFieldName("parameters")??u.childForFieldName("parameter");if(m&&he(m,L=>{L.type==="identifier"&&f.add(L.text)}),f.size===0)return[];let p=Jt(e,t,n);if(p.length===0)return[];let g=(ge(e,d.relativePath)??[]).filter(L=>L.startLine>=d.startLine&&L.endLine<=d.endLine),b=(zt(e,d.relativePath)??[]).filter(L=>L.line>=d.startLine&&L.line<=d.endLine),C=new Set,S=p.map(L=>({name:L.name,startLine:L.startLine,endLine:L.endLine})),v=new Set;for(;S.length>0&&v.size<32;){let L=S.shift(),x=`${L.name}\0${L.startLine}\0${L.endLine}`;if(!v.has(x)){v.add(x);for(let M of b.filter(h=>h.line>=L.startLine&&h.line<=L.endLine)){if(M.memberAccess&&M.calleeQualifier&&f.has(M.calleeQualifier)){C.add(M.calleeLeaf);continue}if(M.memberAccess)continue;let h=g.filter(P=>P.name===M.calleeLeaf);h.length===1&&S.push(h[0])}}}if(C.size===0)return[];let y=i.childForFieldName("arguments")?.namedChildren.find(L=>Ae(L).type==="object");if(!y)return[];let N=[];for(let L of Ae(y).namedChildren){if(L.type==="shorthand_property_identifier"&&C.has(L.text)){N.push(...bt(e,t,L.text,L,L));continue}if(L.type!=="pair")continue;let x=L.childForFieldName("key")??L.namedChild(0),M=L.childForFieldName("value")??L.namedChild(1),h=St(x?.text);!h||!C.has(h)||!M||N.push(...bt(e,t,h,M,L))}return N.filter((L,x,M)=>M.findIndex(h=>h.file===L.file&&h.name===L.name&&h.startLine===L.startLine&&h.endLine===L.endLine)===x)}function co(e,t){for(let n of e.descendantsOfType("variable_declarator"))if((n.childForFieldName("name")??n.namedChild(0))?.text===t)return n.childForFieldName("value")??n.namedChild(1);return null}function uo(e){return e.type==="call_expression"?e:e.descendantsOfType("call_expression")[0]??null}function po(e,t,n){let o=n.replace(/\s+/gu,"").replace(/<[^<>]*>$/u,""),r=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(o);if(r){let u=xe(e,t).filter(p=>p.localName===r[1]&&p.sourcePath);if(u.length!==1||!u[0].sourcePath)return[];let f=u[0].sourcePath,m=je(e,f,r[2]).filter(p=>p.isFunctionLike);return m.length>0?m:(ge(e,f)??[]).filter(p=>p.name===r[2]).map(p=>({...p,relativePath:f}))}if(!/^[A-Za-z_$][\w$]*$/u.test(o))return[];let a=X(e,t).filter(u=>u.leaf===o&&u.isFunctionLike);if(a.length>0)return a;let i=(ge(e,t)??[]).filter(u=>u.name===o).map(u=>({...u,relativePath:t}));if(i.length>0)return i;let s=xe(e,t).filter(u=>u.localName===o&&u.sourcePath&&u.kind!=="namespace");if(s.length!==1||!s[0].sourcePath)return[];let l=s[0].sourcePath,d=s[0].importedName==="default"?o:s[0].importedName,c=je(e,l,d).filter(u=>u.isFunctionLike);return c.length>0?c:(ge(e,l)??[]).filter(u=>u.name===d).map(u=>({...u,relativePath:l}))}function en(e){return["arrow_function","function_expression","generator_function"].includes(e.type)||e.descendantsOfType(["arrow_function","function_expression","generator_function"]).length>0}function yi(e){let t=e.parent;for(;t;){if(t.type==="variable_declarator"){let n=t.childForFieldName("name")??t.namedChild(0);if(n?.type==="identifier")return{name:n.text,startLine:t.startPosition.row,endLine:t.endPosition.row}}t=t.parent}return null}function St(e){return e?e.replace(/^(?:['"])(.*)(?:['"])$/u,"$1"):null}function hi(e,t,n,o){let r=/^this\.([A-Za-z_$][\w$]*)$/u.exec(n.calleeQualifier??"");if(!r)return null;let a=Y(e,t)?.rootNode;if(!a)return null;let i=bi(a,n.line);if(!i)return null;let s=new Set;if(he(i,g=>{if(g.type!=="assignment_expression")return;let b=g.childForFieldName("left")??g.namedChild(0),C=g.childForFieldName("right")??g.namedChild(g.namedChildCount-1);if(b?.text.replace(/\s+/gu,"")!==`this.${r[1]}`||!C)return;let S=Ae(C);if(S.type!=="new_expression")return;let R=(S.childForFieldName("constructor")??S.namedChild(0))?.text.match(/[A-Za-z_$][\w$]*$/u)?.[0];R&&s.add(R)}),s.size!==1)return null;let l=[...s][0],d=o.filter(g=>g.localName===l);if(d.length!==1)return null;let c=d[0].importedName==="default"?l:d[0].importedName,u=d[0].importedName==="default"?je(e,d[0].sourcePath,l):[],f=u.length===1?u[0].leaf:c,m=X(e,d[0].sourcePath).filter(g=>g.isFunctionLike&&g.leaf===n.calleeLeaf&&Kn(g.symbol)===f);if(m.length!==1)return null;let p=m[0];return{calleeLeaf:n.calleeLeaf,line:n.line,sourceFile:t,targetFile:p.relativePath,targetStartLine:p.startLine,targetEndLine:p.endLine,targetSymbol:p.symbol,resolution:"constructed-member-receiver",strength:"exact"}}function bi(e,t){let n=[];return he(e,o=>{["class","class_declaration","class_definition"].includes(o.type)&&o.startPosition.row<=t&&o.endPosition.row>=t&&n.push(o)}),n.sort((o,r)=>o.endPosition.row-o.startPosition.row-(r.endPosition.row-r.startPosition.row))[0]??null}function Ae(e){let t=e;for(;["parenthesized_expression","as_expression","type_assertion","satisfies_expression"].includes(t.type)&&t.namedChildCount===1;)t=t.namedChild(0);return t}function he(e,t){t(e);for(let n of e.namedChildren)he(n,t)}function Si(e){let t=new Map,n=/\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*([A-Za-z_$][\w$]*)\s*;/gu;for(let o of e.matchAll(n)){let r=o[1],a=o[2];r&&a&&t.set(r,a)}return t}function tn(e){let t=[];for(let n of e)t.some(o=>Pe(o,n))||t.push(n);return t}import{existsSync as xi}from"fs";import{SymbolRole as Ei}from"@c4312/scip";import{deserializeSCIP as vi}from"@c4312/scip";function mo(e,t){return vi($n(e,{inputKind:t,maxBytes:kn}))}var nn=new WeakMap;function vt(e,t,n,o){let r=J(e,t),a=(r?.callSites??[]).filter(m=>m.line>=n&&m.line<=o);if(!r||a.length===0)return{available:!!r,targets:[],resolvedCallsites:0,unresolvedCallsites:0};let i=rn(e);if(!i)return{available:!1,targets:[],resolvedCallsites:0,unresolvedCallsites:a.length};let s=(i.byFile.get(t)??[]).filter(m=>m.sourceLine>=n&&m.sourceLine<=o).map(m=>({...m,calleeLeaf:m.definition.leaf})),l=fo(a.map(m=>({line:m.line,leaf:m.calleeLeaf}))),d=fo(s.map(m=>({line:m.sourceLine,leaf:m.calleeLeaf}))),c=new Set([...l].flatMap(([m,p])=>d.get(m)===p?[m]:[])),u=s.filter(m=>c.has(yo(m.sourceLine,m.calleeLeaf))),f=[...c].reduce((m,p)=>m+(l.get(p)??0),0);return{available:!0,targets:u,resolvedCallsites:f,unresolvedCallsites:Math.max(0,a.length-f)}}function on(e,t,n,o){let r=rn(e);return r?{available:!0,targets:(r.byFile.get(t)??[]).filter(a=>a.sourceLine>=n&&a.sourceLine<=o)}:{available:!1,targets:[]}}function go(e,t,n,o){let r=rn(e);return r?{available:!0,targets:(r.byFile.get(t)??[]).filter(a=>a.sourceLine>=n&&a.sourceLine<=o&&xt(e,a.definition)).map(a=>({...a,calleeLeaf:a.definition.leaf}))}:{available:!1,targets:[]}}function rn(e){if(nn.has(e))return nn.get(e)??null;let t=Ci(e);return nn.set(e,t),t}function Ci(e){if(!e.generation.indexPath||!xi(e.generation.indexPath))return null;try{let t=qn(e),n=new Map(t.map(a=>[a.symbol,a])),o=mo(e.generation.indexPath,"SCIP source-range call-target index"),r=new Map;for(let a of o.documents??[]){let i=a.relativePath;if(!i||e.isIgnored(i))continue;let s=[];for(let l of a.occurrences??[]){if(!l.symbol||(l.symbolRoles&Ei.Definition)!==0)continue;let d=n.get(l.symbol),c=l.range?.[0];!d||!Number.isInteger(c)||s.push({sourceLine:c,definition:d})}r.set(i,s)}return{byFile:r}}catch{return null}}function xt(e,t){if(!t.isFunctionLike)return!1;let n=J(e,t.relativePath);return!n||n.callables.some(o=>o.name===t.leaf&&o.startLine===t.startLine&&o.endLine===t.endLine)?!0:Li(t)}function Li(e){let t=e.documentation;if(!t)return!1;let n=e.leaf.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`\\bfunction\\s+${n}\\s*(?:<[^>]*>)?\\s*\\(`,"u").test(t)||new RegExp(`\\b(?:const|let|var)\\s+${n}\\s*:\\s*(?:<[^>]*>\\s*)?\\([^\\n]*\\)\\s*=>`,"u").test(t)}function fo(e){let t=new Map;for(let n of e){let o=yo(n.line,n.leaf);t.set(o,(t.get(o)??0)+1)}return t}function yo(e,t){return`${e}\0${t}`}var Ii=16,wi=4,Ni=3e3,Mi=800,Ri=new Set(["assignment","const_declaration","const_item","field_declaration","lexical_declaration","local_declaration_statement","local_variable_declaration","static_item","variable_declaration"]);function Eo(e,t,n={}){let o=n.maxSteps??Ii;if(!Number.isSafeInteger(o)||o<=0)throw new RangeError(`maxSteps must be a positive safe integer; received ${o}`);let r=new Map(t.nodes.map(E=>[E.id,E])),a=Di(n.focusLocations??[]),i=new Set,s=new Map(t.edges.map(E=>[E.id,E])),l=Le(t.paths.flatMap(E=>E.nodeIds)),d=Le(t.anchors.filter(E=>E.status==="matched").flatMap(E=>E.nodeIds)),c=t.nodes.filter(E=>E.disposition==="emitted"&&E.attributes.upstreamCausalPath===!0).sort((E,k)=>Number(k.attributes.upstreamCausalDistance??0)-Number(E.attributes.upstreamCausalDistance??0)||E.id.localeCompare(k.id)).map(E=>E.id),u=new Set(c),f=Math.max(0,o-d.length),p=Ti(t,d,a,f).slice(0,f),g=new Set(p),b=new Set(p),C=new Set([...l,...c,...d]),S=t.edges.filter(E=>E.disposition==="emitted"&&E.kind!=="structural-membership"),v=t.edges.filter(E=>E.disposition!=="excluded"&&E.disposition!=="unsupported"&&E.kind!=="structural-membership"),R=new Set([...t.paths.flatMap(E=>E.edgeIds),...S.filter(E=>u.has(E.fromNodeId)&&u.has(E.toNodeId)).map(E=>E.id)]),y=t.paths.some(E=>E.edgeIds.length>0),N=new Set(d);for(let E of p)N.add(E);for(let E of t.paths){let k=E.nodeIds[0],G=s.get(E.edgeIds[0]??""),H=E.nodeIds[1];k&&H&&G?.fromNodeId===k&&G.toNodeId===H&&N.add(k)}if(t.paths.every(E=>E.nodeIds.length===0))for(let E of t.anchors)for(let k of E.nodeIds)N.add(k);let L=ji(d,v,r,wi),x=Le(S.filter(E=>E.kind==="call"&&d.includes(E.fromNodeId)).map(E=>E.toNodeId)),M=new Set(Le([...L,...y?[]:x]));for(let E of M)N.add(E);let h=Le(S.flatMap(E=>C.has(E.fromNodeId)||C.has(E.toNodeId)?[E.fromNodeId,E.toNodeId]:[])),P=t.nodes.filter(E=>E.disposition==="emitted"&&E.kind!=="structural-region"&&S.some(k=>k.fromNodeId===E.id||k.toNodeId===E.id)).map(E=>E.id),D=Le([...c,...l,...d,...p,...M,...h,...P]).filter(E=>r.has(E)),O=[];for(let E of D)y&&!C.has(E)&&!g.has(E)&&!M.has(E)||O.length>=o&&!C.has(E)||O.push(E);let w=new Set(O),T=new Map(O.map(E=>[E,qi(E)])),I=new Set([...l,...c]),_=new Set(t.anchors.flatMap(E=>E.nodeIds)),A=O.map((E,k)=>{let G=r.get(E),H=$i(G,a);for(let me of H)i.add(qe(G.location.file,me));return{id:T.get(E),nodeId:E,order:k,role:_.has(E)?"anchor":I.has(E)?"connector":"junction",kind:G.kind,label:G.label,location:G.location,behavior:Fi(e,G,_.has(E),[...new Set([...H,...ki(e,G,v,r,R,N)])],H,N.has(G.id)&&(H.length===0||_.has(G.id)),M.has(G.id),b.has(G.id)&&H.length===0)}}),j=new Map;for(let E of t.paths)for(let k=0;k<E.edgeIds.length;k+=1){let G=s.get(E.edgeIds[k]),H=E.nodeIds[k],me=E.nodeIds[k+1];!G||!H||!me||j.set(G.id,G.fromNodeId===H&&G.toNodeId===me?"forward":"reverse")}let B=v.filter(E=>w.has(E.fromNodeId)&&w.has(E.toNodeId)).sort((E,k)=>Ki(E,k,t)).map((E,k)=>({id:zi(E.id),edgeId:E.id,order:k,kind:E.kind,fromStepId:T.get(E.fromNodeId),toStepId:T.get(E.toNodeId),directed:!0,pathTraversal:j.get(E.id)??"adjacent",evidence:E.evidence})),U=new Map(B.map(E=>[E.edgeId,E.id])),q=t.paths.map(E=>({id:E.id,status:E.status,stepIds:E.nodeIds.flatMap(k=>{let G=T.get(k);return G?[G]:[]}),transitionIds:E.edgeIds.flatMap(k=>{let G=U.get(k);return G?[G]:[]})})),se=A.flatMap(E=>E.location?[`${E.location.file}:${E.location.line+1}`]:[]),Ne=t.anchors.some(E=>E.status==="ambiguous"),Oe=q.some(E=>E.status==="connected"||E.status==="candidate"),ve=q.some(E=>E.status==="partial");return{status:A.length===0?"unavailable":Ne?"ambiguous":Oe&&!ve?"connected":ve?"partial":"connected",steps:A,transitions:B,paths:q,coverage:{candidateNodes:D.length,returnedNodes:O.length,omittedNodeIds:D.filter(E=>!w.has(E)),returnedTransitions:B.length,withheldStatements:A.reduce((E,k)=>E+(k.behavior?.coverage.omittedStatements??0),0),requestedFocusLocations:a,matchedFocusLocations:a.filter(E=>i.has(qe(E.file,E.line))),unmatchedFocusLocations:a.filter(E=>!i.has(qe(E.file,E.line)))},behaviorCommand:xo(se,"behavior"),exactSourceCommand:xo(se,"source")}}function Ti(e,t,n,o){if(o<=0||n.length===0)return[];let r=new Set(t),a=new Set(n.map(i=>qe(i.file,i.line)));return Le(e.edges.filter(i=>i.disposition!=="excluded"&&i.disposition!=="unsupported"&&["call","runtime-boundary"].includes(i.kind)&&r.has(i.fromNodeId)&&i.evidence.some(s=>!["candidate","unknown"].includes(s.strength)&&s.location&&a.has(qe(s.location.file,s.location.line)))).sort((i,s)=>{let l=i.evidence.find(c=>c.location)?.location,d=s.evidence.find(c=>c.location)?.location;return(l?.file??"").localeCompare(d?.file??"")||(l?.line??Number.MAX_SAFE_INTEGER)-(d?.line??Number.MAX_SAFE_INTEGER)||i.id.localeCompare(s.id)}).map(i=>i.toNodeId)).slice(0,o)}function Fi(e,t,n,o,r,a,i,s){if(!t.location||!["symbol","source-construct","runtime-boundary-participant"].includes(t.kind))return null;let l=t.location.endLine??t.location.line,d=le(e,t.location.file),c=o.length>0?o:[t.location.line],u=t.kind==="runtime-boundary-participant"?Ye(e,t.location.file,0,Math.max(0,d.length-1),[t.location.line]):Ye(e,t.location.file,t.location.line,l,c),f=o.filter(M=>M>=u.startLine&&M<=u.endLine),m=gt(e,t.location.file,u.startLine,u.endLine,f),p=m??(f.length>0?gt(e,t.location.file,u.startLine,u.endLine,f,{requireSavings:!1}):null),g=f.length>0?_i(e,t,u.startLine,u.endLine,f,p,a):null,b=d.slice(u.startLine,u.endLine+1).join(`
|
|
2
|
+
`).length,C=Me(e,t.location.file,u.startLine,u.endLine),S=d.slice(u.startLine,u.endLine+1).some((M,h)=>M.length>Mi&&(C.get(u.startLine+h)??[]).some(P=>["binding","branch","loop","call","return","throw","mutation"].includes(P))),v=M=>Pi(e,t,u.startLine,u.endLine,r.filter(h=>h>=u.startLine&&h<=u.endLine),M),R=(i||t.kind==="runtime-boundary-participant"||t.anchorIds.length>0)&&b<=Ni,y=n&&(f.length===0||R);if(m&&(s||y))return v(ho(m));if(!s&&!y&&g&&!S&&!R&&g.renderedCharacters<(p?.outlineCharacters??b))return v(g);if(m)return v(ho(m));let N=d.slice(u.startLine,u.endLine+1),L=N.join(`
|
|
3
|
+
`),x=Me(e,t.location.file,u.startLine,u.endLine);return v({kind:"source",constructKind:"source construct",signature:N.find(M=>M.trim().length>0)?.trim()??t.label,lines:N.map((M,h)=>({line:u.startLine+h,endLine:u.startLine+h,depth:0,signals:x.get(u.startLine+h)??[],text:M,copied:!0})),coverage:{sourceStatements:N.length,representedStatements:N.length,copiedStatements:N.length,omittedStatements:0},rawCharacters:L.length,renderedCharacters:L.length})}function Pi(e,t,n,o,r,a){if(!t.location)return a;let i=on(e,t.location.file,n,o);if(!i.available)return a;let s=Me(e,t.location.file,n,o),l=le(e,t.location.file),d=new Set(r);for(let S of r){let v=Et(l[S]??"");if(!v)continue;let R=Ee(e,t.location.file,v).find(y=>y>S&&y<=o);R!==void 0&&d.add(R)}let c=[...new Map(i.targets.flatMap(S=>{let v=S.definition,R=v.relativePath===t.location.file&&v.startLine<=o&&v.endLine>=n;if(v.isTypeLike||R)return[];let y=xt(e,v),N=r.length>0&&y&&s.get(S.sourceLine)?.includes("return"),L=y&&d.has(S.sourceLine);return y&&!N&&!L?[]:[[v.symbol,{definition:v,kind:N?"return-value-transformer":L?"focused-causal-target":"compiler-referenced-declaration"}]]})).values()].sort((S,v)=>S.definition.relativePath.localeCompare(v.definition.relativePath)||S.definition.startLine-v.definition.startLine||S.definition.symbol.localeCompare(v.definition.symbol)),u=[],f=c.filter(({kind:S})=>S!=="compiler-referenced-declaration").map(({definition:S})=>({owner:S,depth:1})),m=new Set,p=new Set(c.map(({definition:S})=>S.symbol));for(;f.length>0;){let S=f.shift();if(!S||m.has(S.owner.symbol))continue;m.add(S.owner.symbol);let{owner:v,depth:R}=S,y=on(e,v.relativePath,v.startLine,v.endLine);if(!y.available)continue;let N=Me(e,v.relativePath,v.startLine,v.endLine),L=le(e,v.relativePath);for(let x of y.targets){let M=x.definition,h=M.relativePath===v.relativePath&&M.startLine<=v.endLine&&M.endLine>=v.startLine;if(M.isTypeLike||h)continue;let P=xt(e,M),D=Et(L[x.sourceLine]??""),O=P&&D!==null&&Ee(e,v.relativePath,D).some(T=>T>x.sourceLine&&T<=v.endLine&&(N.get(T)??[]).some(I=>["branch","return","throw"].includes(I))),w=P&&((N.get(x.sourceLine)??[]).some(T=>["branch","return","throw"].includes(T))||O);P&&!w||(p.has(M.symbol)||(p.add(M.symbol),u.push({definition:M,kind:P?"focused-causal-target":"compiler-referenced-declaration"})),P&&R<2&&f.push({owner:M,depth:R+1}))}}let g=[...new Map([...c,...u].map(S=>[S.definition.symbol,S])).values()].sort((S,v)=>S.definition.relativePath.localeCompare(v.definition.relativePath)||S.definition.startLine-v.definition.startLine||S.definition.symbol.localeCompare(v.definition.symbol)),b=[],C=[];for(let{definition:S,kind:v}of g){let R=v==="compiler-referenced-declaration"?Ai(e,S.relativePath,S.startLine,S.endLine):{startLine:S.startLine,endLine:S.endLine},y=le(e,S.relativePath).slice(R.startLine,R.endLine+1).join(`
|
|
4
|
+
`),N=v==="compiler-referenced-declaration"?null:gt(e,S.relativePath,S.startLine,S.endLine,[]),L=N?[N.signature,...N.lines.map(D=>`${D.line+1}${D.signals.length>0?`[${D.signals.join(",")}]`:""} ${D.text}`)].join(" | "):null,x=L&&L.length<y.length?L:y,M={symbol:S.symbol,label:S.leaf,file:S.relativePath,line:R.startLine,endLine:R.endLine},h=v==="compiler-referenced-declaration"?1e3:8e3,P=v==="compiler-referenced-declaration"?12:120;if(x.length>h||R.endLine-R.startLine>P){C.push({...M,reason:"source-too-large"});continue}b.push({kind:v,...M,text:x})}return{...a,...b.length===0?{}:{supportingDeclarations:b},...C.length===0?{}:{omittedSupportingDeclarations:C}}}function Ai(e,t,n,o){let r=Y(e,t);if(!r)return{startLine:n,endLine:o};let a=[];Co(r.rootNode,s=>{Ri.has(s.type)&&s.startPosition.row<=n&&s.endPosition.row>=o&&a.push(s)});let i=a.sort((s,l)=>s.endPosition.row-s.startPosition.row-(l.endPosition.row-l.startPosition.row)||s.endIndex-s.startIndex-(l.endIndex-l.startIndex))[0];return i?{startLine:i.startPosition.row,endLine:i.endPosition.row}:{startLine:n,endLine:o}}function Co(e,t){t(e);for(let n of e.namedChildren)Co(n,t)}function ho(e){return{kind:"outline",constructKind:e.constructKind,signature:e.signature,lines:e.lines,coverage:e.coverage,rawCharacters:e.rawCharacters,renderedCharacters:e.outlineCharacters}}function ki(e,t,n,o,r,a){if(!t.location||!["symbol","source-construct","runtime-boundary-participant"].includes(t.kind))return[];let i=new Set,s=new Set(J(e,t.location.file)?.callSites.map(l=>l.line)??[]);if(t.kind==="runtime-boundary-participant"&&i.add(t.location.line),a.has(t.id))for(let l of Vt(e,{files:[t.location.file]}))l.source.startLine>=t.location.line&&l.source.startLine<=(t.location.endLine??t.location.line)&&i.add(l.source.startLine);for(let l of n){if(l.fromNodeId!==t.id&&l.toNodeId!==t.id)continue;let d=o.get(l.fromNodeId===t.id?l.toNodeId:l.fromNodeId),c=a.has(t.id)&&["call","reference","runtime-boundary"].includes(l.kind)&&l.fromNodeId===t.id,u=(d?.anchorIds.length??0)>0;if(!r.has(l.id)&&!c&&!u)continue;let f=l.evidence.flatMap(C=>C.location?.file===t.location.file?[C.location.line]:[]),m=f.filter(C=>s.has(C));for(let C of m.length>0?m:f)i.add(C);let p=d?.attributes.leaf;if(typeof p!="string"||p.length===0)continue;let g=Ee(e,t.location.file,p).filter(C=>C>=t.location.line&&C<=(t.location.endLine??t.location.line)),b=g.find(C=>s.has(C))??g[0];b!==void 0&&i.add(b)}return[...i].sort((l,d)=>l-d)}function $i(e,t){if(!e.location)return[];let n=e.location.endLine??e.location.line;return t.filter(o=>o.file===e.location.file&&o.line>=e.location.line&&o.line<=n).map(o=>o.line)}function Di(e){let t=new Map;for(let n of e){if(!n.file||!Number.isSafeInteger(n.line)||n.line<0)throw new RangeError(`Behavior focus locations require a repository file and non-negative line; received ${JSON.stringify(n)}.`);t.set(qe(n.file,n.line),{file:n.file,line:n.line})}return[...t.values()].sort((n,o)=>n.file.localeCompare(o.file)||n.line-o.line)}function qe(e,t){return`${e}\0${t}`}function _i(e,t,n,o,r,a,i){if(!t.location)return null;let s=le(e,t.location.file),l=Me(e,t.location.file,n,o),d=[...l].filter(([,w])=>w.length>0).map(([w])=>w).sort((w,T)=>w-T),c=r.map(w=>(l.get(w)??[]).length>0?w:d.find(T=>T>w&&T-w<=8)??w),u=new Set([...r,...c]),f=i?Qt(e,t.location.file,n,o,{minimumBodyLines:0}):null,m=a?[...new Map(c.flatMap(w=>a.lines.filter(T=>T.text.length<=500&&T.signals.some(I=>["branch","loop","catch","finally"].includes(I))&&w>=T.line&&w<=T.endLine).sort((T,I)=>T.endLine-T.line-(I.endLine-I.line)||T.line-I.line).slice(0,2).map(T=>[`${T.line}\0${T.endLine}`,T]))).values()]:yt(e,t.location.file,n,o,c);for(let w of f?.lines??[])u.add(w.line);for(let w of m)u.add(w.line);for(let[w,T]of l)T.includes("call")&&T.includes("shape")&&u.add(w);let p=[];for(let w of c){let T=Et(s[w]??"");if(!T)continue;let I=Ee(e,t.location.file,T).filter(B=>B>w&&B<=o),_=I[0];_!==void 0&&u.add(_);let A=I.find(B=>(l.get(B)??[]).some(U=>U==="branch"||U==="loop"));if(A===void 0)continue;u.add(A);let j=(a?.lines??[]).find(B=>B.line===A)??{line:A,endLine:Math.min(o,A+40),depth:0,signals:l.get(A)??[],text:(s[A]??"").trim(),copied:!0},$=a?.lines??s.slice(j.line,j.endLine+1).map((B,U)=>{let q=j.line+U;return{line:q,endLine:q,depth:0,signals:l.get(q)??[],text:B.trim(),copied:!0}});p.push({focusLine:w,governingUse:A,lines:$.filter(B=>B.line>=j.line&&B.line<=j.endLine&&B.text.length<=500&&B.signals.some(U=>["binding","branch","call","mutation"].includes(U)))})}for(let w of p.sort((T,I)=>I.governingUse-I.focusLine-(T.governingUse-T.focusLine)||T.focusLine-I.focusLine).slice(0,2))for(let T of w.lines.slice(0,14))u.add(T.line);let g=new Set(["binding","branch","loop","call","return","throw","mutation"]);for(let w of m)for(let T of a?.lines??[])T.line<w.line||T.line>w.endLine||T.signals.some(I=>g.has(I))&&u.add(T.line);let b=s.slice(n,o+1).flatMap((w,T)=>{let I=Et(w);return I?[{name:I,line:n+T}]:[]}),C=!0;for(;C;){C=!1;for(let w of b)if([...u].some(I=>Oi(s[I]??"",w.name))){u.has(w.line)||(u.add(w.line),C=!0);for(let I of Ee(e,t.location.file,w.name))I<n||I>o||u.has(I)||(l.get(I)??[]).some(_=>g.has(_))&&(u.add(I),C=!0)}}for(let w of a?.lines??[])if(w.signals.some(T=>["branch","loop","catch","finally"].includes(T))&&u.has(w.line))for(let T of a?.lines??[])T.line<w.line||T.line>w.endLine||T.signals.some(I=>g.has(I))&&u.add(T.line);let S=J(e,t.location.file),v=new Set(S?.callSites.map(w=>w.line)??[]),R=l,y=new Map([...a?.lines??[],...m].filter(w=>w.signals.some(T=>["branch","loop","catch","finally"].includes(T))).map(w=>[w.line,w])),N=new Map((a?.lines??[]).filter(w=>w.text.length<=500&&w.signals.includes("shape")&&(w.signals.includes("call")||w.signals.includes("mutation")||w.signals.includes("return"))).sort((w,T)=>w.endLine-w.line-(T.endLine-T.line)||w.line-T.line).map(w=>[w.line,w])),L=new Map((f?.lines??[]).map(w=>[w.line,w.signals.filter(T=>T!=="lifecycle")])),x=[...u].filter(w=>w>=n&&w<=o).sort((w,T)=>w-T).map(w=>{let T=y.get(w)??N.get(w);return{line:w,endLine:T?.endLine??w,depth:T?.depth??0,signals:Bi([...R.get(w)??[],...a?.lines.filter(I=>w>=I.line&&w<=I.endLine).flatMap(I=>I.signals)??[],...L.get(w)??[],...r.includes(w)?["anchor"]:[],...v.has(w)?["call"]:[]]),text:T?.text??(s[w]??"").trim(),copied:T?.copied??!0}}).filter(w=>w.text.length>0);if(x.length===0)return null;let M=f?.candidateLines??Qt(e,t.location.file,n,o,{minimumBodyLines:0})?.candidateLines??0,h=Math.max(a?.coverage.sourceStatements??0,M,x.length),P=a?.signature??(s[n]??t.label).trim(),D=P.length+x.reduce((w,T)=>w+T.text.length+T.signals.join(",").length+12,0),O=s.slice(n,o+1).join(`
|
|
5
|
+
`).length;return{kind:"connector-slice",constructKind:a?.constructKind??"source construct",signature:P,lines:x,coverage:{sourceStatements:h,representedStatements:x.length,copiedStatements:x.length,omittedStatements:Math.max(0,h-x.length)},rawCharacters:O,renderedCharacters:D}}function Bi(e){let t=["anchor","signature","binding","branch","loop","call","await","return","throw","mutation","shape","spread","catch","finally"],n=new Set(e);return t.filter(o=>n.has(o))}function Et(e){return/\b(?:const|let|var)\s+([\p{L}_$][\p{L}\p{N}_$]*)\s*(?:=|\bof\b|\bin\b)/u.exec(e)?.[1]??null}function Oi(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`(?:^|[^\\p{L}\\p{N}_$])${n}(?:$|[^\\p{L}\\p{N}_$])`,"u").test(e)}function Gi(e,t,n){return Le(e.flatMap(o=>{let r=n.get(o),a=t.filter(i=>i.kind==="call"&&i.toNodeId===o).map(i=>({edge:i,node:n.get(i.fromNodeId)})).filter(i=>i.node!==void 0&&["symbol","source-construct","runtime-boundary-participant"].includes(i.node.kind)&&i.node.location!==null).sort((i,s)=>{let l=bo(s.edge)-bo(i.edge);if(l!==0)return l;let d=So(i.node,r)?0:1,c=So(s.node,r)?0:1,u=(i.node.location?.endLine??i.node.location?.line??0)-(i.node.location?.line??0),f=(s.node.location?.endLine??s.node.location?.line??0)-(s.node.location?.line??0);return d-c||u-f||i.node.label.localeCompare(s.node.label)});return a[0]?[a[0].node.id]:[]}))}function bo(e){let t={exact:4,mixed:3,derived:2,candidate:1,unknown:0};return Math.max(0,...e.evidence.map(n=>t[n.strength]))}function So(e,t){return!e.location||!t?.location?!1:vo(e.location.file)===vo(t.location.file)}function vo(e){return e.split("/").filter(Boolean).slice(0,2).join("/")}function ji(e,t,n,o){let r=new Set(e),a=new Set,i=[],s=Le(e);for(let l=0;l<o&&s.length>0;l+=1){let d=s.filter(u=>!a.has(u));for(let u of d)a.add(u);let c=Gi(d,t,n);s=[];for(let u of c)!r.has(u)&&!i.includes(u)&&i.push(u),a.has(u)||s.push(u)}return i}function Ki(e,t,n){let o=new Map(n.paths.flatMap(r=>r.edgeIds).map((r,a)=>[r,a]));return(o.get(e.id)??Number.MAX_SAFE_INTEGER)-(o.get(t.id)??Number.MAX_SAFE_INTEGER)||e.id.localeCompare(t.id)}function qi(e){return`step:${e}`}function zi(e){return`transition:${e}`}function xo(e,t){return e.length===0?null:`scip-query inspect ${e.map(n=>`--at ${Ui(n)}`).join(" ")} --view ${t}`}function Ui(e){return`'${e.replace(/'/gu,`'"'"'`)}'`}function Le(e){return[...new Set(e)]}var Wi=6;function Lo(e,t,n){return`${e}\0${t}\0${n??t}`}function Mo(e,t,n,o={}){let r=o.limit??Wi;if(!Number.isSafeInteger(r)||r<=0)throw new RangeError(`next-anchor limit must be a positive safe integer; received ${r}`);let a=o.sourceAllowed??(()=>!0),i=new Map(t.nodes.map(x=>[x.id,x])),s=new Set(n.steps.map(x=>x.nodeId)),l=new Set(n.steps.flatMap(x=>{let M=an(i.get(x.nodeId));return M?[M]:[]})),d=new Set;for(let x of n.steps)for(let M of x.behavior?.supportingDeclarations??[])l.add(M.symbol),d.add(Lo(M.file,M.line,M.endLine));let c=x=>x.symbol!==null&&l.has(x.symbol)||d.has(Lo(x.file,x.line,x.endLine)),u=new Map(n.steps.flatMap(x=>{if(!x.location)return[];let M=an(i.get(x.nodeId));if(!M)return[];let h=X(e,x.location.file).find(P=>P.symbol===M);return h?[[x.id,h]]:[]})),f=new ht(e).calleeMap([...u.values()],{additive:!1,semantic:!0}),m=[],p=new Set,g=new Set,b=0,C=0,S=0,v=0,R=0,y=0,N=0,L=0;for(let x of n.steps){if(!x.location||!x.behavior)continue;let M=Hi(x,{db:e,topology:t,nodeById:i,returnedNodeIds:s,sourceAllowed:a,alternativeAlreadyReturned:c});m.push(...M.candidates),y+=M.upstreamCandidates,L+=M.runtimeCandidates,N+=M.resultCandidates;let h=Vi(x,{db:e,topology:t,nodeById:i,returnedNodeIds:s,sourceAllowed:a,alternativeAlreadyReturned:c},p);m.push(...h);let P=Qi(x,{db:e,topology:t,nodeById:i,returnedNodeIds:s,sourceAllowed:a,alternativeAlreadyReturned:c},{evidencedCallsiteKeys:p,consideredCandidateKeys:g,calleeMap:f,stepDefinition:u.get(x.id)});m.push(...P.candidates),b+=P.scannedBehaviorSteps,C+=P.visibleCallsites,S+=P.identityCandidateCallsites,v+=P.ambiguousCallsites,R+=P.unresolvedCallsites}return Yi(e,m,n.steps,r,{scannedBehaviorSteps:b,visibleCallsites:C,graphEvidencedCallsites:p.size,identityCandidateCallsites:S,ambiguousCallsites:v,unresolvedCallsites:R,upstreamCandidates:y,resultCandidates:N,runtimeCandidates:L},o.selectionTerms)}function Hi(e,t){let n=[],o=0,r=0,a=0;if(!e.location||!e.behavior)return{candidates:n,upstreamCandidates:o,resultCandidates:r,runtimeCandidates:a};let i=t.topology.edges.filter(l=>["call","runtime-boundary"].includes(l.kind)&&(l.fromNodeId===e.nodeId||l.toNodeId===e.nodeId)&&l.disposition!=="excluded"&&l.disposition!=="unsupported");for(let l of i){let d=l.toNodeId===e.nodeId,c=d?l.fromNodeId:l.toNodeId;if(t.returnedNodeIds.has(c))continue;let u=t.nodeById.get(c);if(!u?.location||!t.sourceAllowed(u.location.file))continue;let f=l.kind==="call"?sn(t.db,u):un(u);if(!f||t.alternativeAlreadyReturned(f))continue;let m=ln(l,u.location.file)??u.location,p=le(t.db,m.file)[m.line]?.trim(),g=d?"upstream":"downstream",b=l.kind==="runtime-boundary"?d?"runtime-producer":"runtime-consumer":d?"caller":"callee",C=cn(l.evidence),S=Je(u);n.push({anchor:{id:ze(e.id,m.line,u.id),status:C,source:"graph-relation",direction:g,causalRole:b,relationKind:l.kind,fromStepId:e.id,fromLabel:e.label,callsite:{file:m.file,line:m.line,endLine:m.endLine??m.line,text:p||`${u.label} \u2192 ${e.label}`,signals:["call"],calleeLeaf:S},alternatives:[f],alternativeCount:1,evidence:l.evidence}}),d&&(o+=1),l.kind==="runtime-boundary"&&(a+=1)}let s=t.topology.edges.filter(l=>l.kind==="reference"&&l.fromNodeId===e.nodeId&&l.disposition!=="excluded"&&l.disposition!=="unsupported"&&!t.returnedNodeIds.has(l.toNodeId));for(let l of s){let d=t.nodeById.get(l.toNodeId);if(!d?.location||!t.sourceAllowed(d.location.file))continue;let c=sn(t.db,d);if(!c||t.alternativeAlreadyReturned(c))continue;let u=Je(d),f=ln(l,e.location.file)?.line,m=e.behavior.lines.find(b=>(f===void 0||f>=b.line&&f<=b.endLine)&&b.text.includes(u));if(!m)continue;let p=To(m.signals),g=cn(l.evidence);n.push({anchor:{id:ze(e.id,m.line,d.id),status:g,source:"graph-relation",direction:"downstream",causalRole:p,relationKind:"reference",fromStepId:e.id,fromLabel:e.label,callsite:{file:e.location.file,line:m.line,endLine:m.endLine,text:m.text,signals:m.signals,calleeLeaf:u},alternatives:[c],alternativeCount:1,evidence:l.evidence}}),p==="result-callback"&&(r+=1)}return{candidates:n,upstreamCandidates:o,resultCandidates:r,runtimeCandidates:a}}function Vi(e,t,n){let o=[];if(!e.location)return o;let r=vt(t.db,e.location.file,e.location.line,e.location.endLine??e.location.line),a=le(t.db,e.location.file),i=Me(t.db,e.location.file,e.location.line,e.location.endLine??e.location.line);for(let s of r.targets){if(!t.sourceAllowed(s.definition.relativePath))continue;let l=Ct(e.location.file,s.sourceLine,s.calleeLeaf);if(n.has(l))continue;n.add(l);let d=Zi(i.get(s.sourceLine)),c={symbol:s.definition.symbol,label:s.definition.leaf,file:s.definition.relativePath,line:s.definition.startLine,endLine:s.definition.endLine};t.alternativeAlreadyReturned(c)||o.push({anchor:{id:ze(e.id,s.sourceLine,s.definition.symbol),status:"exact",source:"graph-call",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:e.id,fromLabel:e.label,callsite:{file:e.location.file,line:s.sourceLine,endLine:s.sourceLine,text:a[s.sourceLine]?.trim()||`${s.calleeLeaf}()`,signals:d,calleeLeaf:s.calleeLeaf},alternatives:[c],alternativeCount:1,evidence:[{method:"scip-occurrence-callsite",strength:"exact",identity:s.definition.symbol,location:{file:e.location.file,line:s.sourceLine}}]}})}return o}function Qi(e,t,n){let o={candidates:[],scannedBehaviorSteps:0,visibleCallsites:0,identityCandidateCallsites:0,ambiguousCallsites:0,unresolvedCallsites:0};if(!e.location||!e.behavior)return o;let r=e.behavior.lines.filter(p=>p.signals.includes("call"));if(r.length===0)return o;let a=[],i=0,s=0,l=0,d=(J(t.db,e.location.file)?.callSites??[]).filter(p=>r.some(g=>p.line>=g.line&&p.line<=g.endLine)),c=t.topology.edges.filter(p=>p.kind==="call"&&p.fromNodeId===e.nodeId&&p.disposition!=="excluded"&&p.disposition!=="unsupported"),u=new Map;for(let p of c){let g=t.nodeById.get(p.toNodeId);if(!g)continue;let b=Je(g);u.set(b,(u.get(b)??0)+1)}let f=Ji(t.db,n.stepDefinition?n.calleeMap.get(n.stepDefinition.symbolId)??[]:[]),m=ea(f);for(let p of f){if(!t.sourceAllowed(p.alternative.file)||t.alternativeAlreadyReturned(p.alternative))continue;let g=Xe(p.alternative.label),b=wo(d,r,g,p.row.callsiteLine,m.get(g)===1);if(!b)continue;let C=Ze(r,b.line,g);if(!C)continue;let S=Ct(e.location.file,b.line,g);if(n.evidencedCallsiteKeys.has(S))continue;n.evidencedCallsiteKeys.add(S);let v=Po(p.row.source);a.push({anchor:{id:ze(e.id,b.line,p.alternative.symbol??p.alternative.file),status:v,source:"graph-call",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:e.id,fromLabel:e.label,callsite:{file:e.location.file,line:C.line,endLine:C.endLine,text:C.text,signals:C.signals,calleeLeaf:g},alternatives:[p.alternative],alternativeCount:1,evidence:[{method:p.row.source,strength:v,identity:p.row.symbol,location:{file:e.location.file,line:b.line}}]}})}for(let p of c){if(t.returnedNodeIds.has(p.toNodeId))continue;let g=t.nodeById.get(p.toNodeId);if(!g?.location||!t.sourceAllowed(g.location.file))continue;let b=Je(g),C=p.evidence.find(L=>{let x=L.location;return x!==null&&x.file===e.location?.file&&x.line>=0})?.location?.line,S=wo(d,r,b,C,u.get(b)===1);if(!S)continue;let v=Ze(r,S.line,b);if(!v)continue;let R=Ct(e.location.file,S.line,b);if(n.evidencedCallsiteKeys.has(R))continue;n.evidencedCallsiteKeys.add(R);let y=un(g);if(!y||t.alternativeAlreadyReturned(y))continue;let N=cn(p.evidence);a.push({anchor:{id:ze(e.id,S.line,g.id),status:N,source:"graph-call",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:e.id,fromLabel:e.label,callsite:{file:e.location.file,line:v.line,endLine:v.endLine,text:v.text,signals:v.signals,calleeLeaf:b},alternatives:[y],alternativeCount:1,evidence:p.evidence}})}for(let p of d){let g=Ct(e.location.file,p.line,p.calleeLeaf);if(n.evidencedCallsiteKeys.has(g))continue;let b=Ze(r,p.line,p.calleeLeaf);if(!b)continue;let C=mt(e.location.file,ft(t.db).get(p.calleeLeaf)??[]).flatMap(y=>X(t.db,y.file).filter(N=>N.symbol===y.symbol&&N.isFunctionLike)).filter(y=>t.sourceAllowed(y.relativePath)&&!t.alternativeAlreadyReturned({symbol:y.symbol,label:y.leaf,file:y.relativePath,line:y.startLine,endLine:y.endLine})),S=dn(C.map(y=>({symbol:y.symbol,label:y.leaf??p.calleeLeaf,file:y.relativePath,line:y.startLine,endLine:y.endLine})));if(S.length===0){l+=1;continue}let v=`${e.id}\0${p.line}\0${p.calleeLeaf}`;if(n.consideredCandidateKeys.has(v))continue;n.consideredCandidateKeys.add(v);let R=S.length>1;R?s+=1:i+=1,a.push({anchor:{id:ze(e.id,p.line,p.calleeLeaf),status:R?"ambiguous":"candidate",source:"leaf-identity-candidate",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:e.id,fromLabel:e.label,callsite:{file:e.location.file,line:b.line,endLine:b.endLine,text:b.text,signals:b.signals,calleeLeaf:p.calleeLeaf},alternatives:S.slice(0,3),alternativeCount:S.length,evidence:[]}})}return{candidates:a,scannedBehaviorSteps:1,visibleCallsites:d.length,identityCandidateCallsites:i,ambiguousCallsites:s,unresolvedCallsites:l}}function Ro(e,t,n){let o=new Map(t.nodes.map(r=>[r.id,r]));for(let r of n.steps)if(!(!r.behavior||!r.location))for(let a of t.edges){if(a.kind!=="reference"||a.fromNodeId!==r.nodeId||a.disposition==="excluded"||a.disposition==="unsupported")continue;let i=o.get(a.toNodeId);if(!i?.location||!sn(e,i))continue;let s=Je(i),l=ln(a,r.location.file)?.line,d=r.behavior.lines.find(c=>(l===void 0||l>=c.line&&l<=c.endLine)&&c.text.includes(s));!d||To(d.signals)!=="result-callback"||a.semantics?.some(({family:c,subtype:u})=>c==="control"&&u==="result-callback")||(a.semantics=[...a.semantics??[],{family:"control",subtype:"result-callback",attributes:{evidenceRole:"result-producing-callable-reference"}}])}}function To(e){return e.includes("call")&&e.some(t=>["return","mutation","shape","spread","binding"].includes(t))?"result-callback":"callable-reference"}function Yi(e,t,n,o,r,a=[]){let i=ta(t).sort(Fo),s=i.filter(p=>Xi(e,p)).slice(0,o),l=new Set(s.map(p=>p.anchor.id)),d=i.filter(p=>!l.has(p.anchor.id)),c=s.map(p=>p.anchor),u=d.map(p=>p.anchor),f=dn(c.flatMap(p=>p.alternativeCount===1?p.alternatives:[])),m=dn(u.flatMap(p=>p.alternativeCount===1?p.alternatives:[]));return{anchors:c,withheldAnchors:u,candidateAnchors:i.length,omittedAnchors:Math.max(0,i.length-c.length),...r,inspectCommand:f.length===0?null:`scip-query inspect ${f.map(No).join(" ")} --view behavior`,remainingInspectCommands:oa(m,8).map(p=>`scip-query inspect ${p.map(No).join(" ")} --view behavior`)}}function Fo(e,t){let n=e.anchor.alternatives[0],o=t.anchor.alternatives[0];return Lt(e.anchor.status)-Lt(t.anchor.status)||(e.anchor.direction??"").localeCompare(t.anchor.direction??"")||(e.anchor.relationKind??"").localeCompare(t.anchor.relationKind??"")||(e.anchor.causalRole??"").localeCompare(t.anchor.causalRole??"")||e.anchor.fromStepId.localeCompare(t.anchor.fromStepId)||e.anchor.callsite.file.localeCompare(t.anchor.callsite.file)||e.anchor.callsite.line-t.anchor.callsite.line||(n?.file??"").localeCompare(o?.file??"")||(n?.line??0)-(o?.line??0)||e.anchor.id.localeCompare(t.anchor.id)}function Xi(e,t){if(t.anchor.alternativeCount!==1)return!0;let n=t.anchor.alternatives[0],o=n.endLine??n.line;return le(e,n.file).slice(n.line,o+1).join(`
|
|
6
|
+
`).length<=2e4}function Zi(e){return e?.includes("call")?[...e]:["call",...e??[]]}function Ji(e,t){let n=new Map;for(let o of t){let r=X(e,o.file).find(s=>s.symbol===o.symbol&&s.isFunctionLike);if(!r)continue;let a={symbol:r.symbol,label:r.leaf,file:r.relativePath,line:r.startLine,endLine:r.endLine},i=n.get(r.symbol);!i||Io(o.source)>Io(i.row.source)?n.set(r.symbol,{row:{...o,...o.callsiteLine===void 0&&i?.row.callsiteLine!==void 0?{callsiteLine:i.row.callsiteLine}:{}},alternative:a}):i.row.callsiteLine===void 0&&o.callsiteLine!==void 0&&n.set(r.symbol,{...i,row:{...i.row,callsiteLine:o.callsiteLine}})}return[...n.values()]}function ea(e){let t=new Map;for(let n of e){let o=Xe(n.alternative.label);t.set(o,(t.get(o)??0)+1)}return t}function Po(e){return e==="semantic-callee"||e==="scip-chunk"?"exact":"derived"}function Io(e){return Po(e)==="exact"?2:1}function Ze(e,t,n){return e.find(o=>t>=o.line&&t<=o.endLine&&o.text.includes(n))??e.find(o=>t>=o.line&&t<=o.endLine)??null}function wo(e,t,n,o,r){if(o!==void 0)return e.find(i=>i.line===o&&i.calleeLeaf===n&&Ze(t,i.line,n)!==null)??null;let a=e.filter(i=>i.calleeLeaf===n&&Ze(t,i.line,i.calleeLeaf)!==null);return r&&a.length===1?a[0]:null}function Je(e){let t=e.attributes.leaf;if(typeof t=="string"&&t.length>0)return Xe(t);let n=e.label.slice(e.label.lastIndexOf(":")+1);return Xe(n)}function an(e){if(e?.kind!=="symbol"||!e.id.startsWith("symbol:"))return null;try{return decodeURIComponent(e.id.slice(7))}catch{return null}}function un(e){return e.location?{symbol:an(e),label:e.label,file:e.location.file,line:e.location.line,endLine:e.location.endLine??null}:null}function sn(e,t){let n=un(t);return n?.symbol&&X(e,n.file).some(r=>r.symbol===n.symbol&&r.isFunctionLike)?n:null}function ln(e,t){return e.evidence.find(n=>n.location?.file===t)?.location??e.evidence.find(n=>n.location!==null)?.location??null}function cn(e){let t={exact:5,derived:4,mixed:3,candidate:2,unknown:1};return e.reduce((n,o)=>t[o.strength]>t[n]?o.strength:n,"unknown")}function ta(e){let t=new Map;for(let n of e){let r=n.anchor.alternatives[0]?.symbol??`${n.anchor.callsite.file}:${n.anchor.callsite.line}:${n.anchor.callsite.calleeLeaf}`,a=t.get(r);(!a||na(n,a)<0)&&t.set(r,n)}return[...t.values()]}function na(e,t){return Lt(e.anchor.status)-Lt(t.anchor.status)||e.anchor.alternativeCount-t.anchor.alternativeCount||Fo(e,t)}function Lt(e){return{exact:0,derived:1,mixed:2,candidate:3,unknown:4,ambiguous:5}[e]}function dn(e){let t=new Map;for(let n of e)t.set(n.symbol??`${n.file}:${n.line}`,n);return[...t.values()].sort((n,o)=>n.file.localeCompare(o.file)||n.line-o.line||n.label.localeCompare(o.label))}function No(e){return`--at ${ra(`${e.file}:${e.line+1}`)}`}function oa(e,t){let n=[];for(let o=0;o<e.length;o+=t)n.push(e.slice(o,o+t));return n}function ra(e){return`'${e.replaceAll("'","'\\''")}'`}function Ct(e,t,n){return`${e}\0${t}\0${n}`}function ze(e,t,n){return["next-anchor",e,String(t),n].map(encodeURIComponent).join(":")}var Ao=["call","contract-symbol","import","reference","runtime-boundary"],ia={call:[{family:"control",subtype:"call"}],"contract-symbol":[{family:"contract",subtype:"uses-contract-symbol"}],import:[{family:"identity",subtype:"imports"}],reference:[{family:"identity",subtype:"references"}]},aa={"structural-membership":[{family:"identity",subtype:"contains"}],"boundary-observation":[{family:"identity",subtype:"owns-runtime-observation"}],"external-import":[{family:"identity",subtype:"imports-external"}]};function ko(e){if(e.kind!=="runtime-boundary")return $o(ia[e.kind]);let t=e.fromBoundaryParticipant?.protocol??e.toBoundaryParticipant?.protocol,n={crossesRuntimeBoundary:!0,...t?{protocol:t}:{},...e.runtimeBoundaryKey?{runtimeKey:e.runtimeBoundaryKey}:{}},o=[{family:"control",subtype:"runtime-handoff",context:n}];return e.evidence==="runtime-boundary:carrier.discriminator"&&(o.push({family:"control",subtype:"discriminator-dispatch",context:{...n},attributes:{joinRule:"carrier.discriminator",...e.fromBoundaryParticipant?.action?{producerAction:e.fromBoundaryParticipant.action}:{},...e.toBoundaryParticipant?.action?{consumerAction:e.toBoundaryParticipant.action}:{}}}),o.push({family:"data",subtype:"serialized-discriminator-transfer",context:{...n},attributes:{joinRule:"carrier.discriminator"}})),e.evidence==="runtime-boundary:queue.address"&&e.fromBoundaryParticipant?.action==="queue.send"&&e.toBoundaryParticipant?.action==="queue.consume"&&o.push({family:"temporal",subtype:"enqueue-before-consume",context:{...n},attributes:{producerAction:e.fromBoundaryParticipant.action,consumerAction:e.toBoundaryParticipant.action,retryPolicy:"unknown"}}),o}function It(e){return $o(aa[e])}function $o(e){return e.map(t=>({...t,...t.context?{context:{...t.context}}:{},...t.attributes?{attributes:{...t.attributes}}:{}}))}import{join as Pa}from"path";import{createRequire as sa}from"module";import{resolve as tt}from"path";var la=sa(import.meta.url),et;function _o(e,t,n){let o=ca();if(!o)return pn("The TypeScript compiler runtime is unavailable.");let r=da(o,e,t),a=r.getSourceFile(tt(t))??r.getSourceFile(t);if(!a)return pn(`The TypeScript compiler did not materialize ${t}.`);let i={ts:o,sourceFile:a,checker:r.getTypeChecker(),points:new Map,edges:new Map,unsupported:new Set,nextCfgId:0},s=pa(o,a,n);if(s.length===0)return pn("No function-like construct intersects the selected source range.");let l=new Map(s.map(u=>[u,ma(a,u)])),d=s.map(u=>ga(i,u,fa(o,u,l),l.get(u)));for(let u of d)ya(i,u),va(i,u),Ca(i,u);Ia(i,d);let c=[...i.unsupported].sort();return{points:[...i.points.values()].map(({node:u,...f})=>f).sort(Fa),edges:[...i.edges.values()].sort((u,f)=>u.id.localeCompare(f.id)),coverage:{status:c.length===0?"complete":"partial",basis:"typescript-compiler-cfg-reaching-definitions",unsupported:c}}}function ca(){if(et!==void 0)return et;try{et=la("typescript")}catch{et=jn()?.ts??null}return et}function da(e,t,n){let o=tt(n),r={target:e.ScriptTarget.ESNext,module:e.ModuleKind.NodeNext,moduleResolution:e.ModuleResolutionKind.NodeNext,skipLibCheck:!0,noResolve:!0},a=e.createSourceFile(o,t,r.target,!0,ua(e,o)),i=e.createCompilerHost(r,!0),s=i.getSourceFile.bind(i),l=i.readFile.bind(i),d=i.fileExists.bind(i);return i.getSourceFile=(c,u,f,m)=>tt(c)===o?a:s(c,u,f,m),i.readFile=c=>tt(c)===o?t:l(c),i.fileExists=c=>tt(c)===o||d(c),e.createProgram([o],r,i)}function ua(e,t){return/\.tsx$/iu.test(t)?e.ScriptKind.TSX:/\.[cm]?js$/iu.test(t)?e.ScriptKind.JS:/\.jsx$/iu.test(t)?e.ScriptKind.JSX:e.ScriptKind.TS}function pa(e,t,n){let o=[],r=a=>{if(Bo(e,a)){let i=t.getLineAndCharacterOfPosition(a.getStart(t)).line,s=t.getLineAndCharacterOfPosition(a.getEnd()).line;(!n||i<=n.endLine&&s>=n.startLine)&&o.push(a)}a.forEachChild(r)};return t.forEachChild(r),o.sort((a,i)=>a.getStart(t)-i.getStart(t))}function Bo(e,t){return e.isFunctionLike(t)&&"body"in t&&t.body!==void 0}function ma(e,t){return`callable:${encodeURIComponent(e.fileName)}:${t.getStart(e)}:${t.getEnd()}`}function fa(e,t,n){for(let o=t.parent;o;o=o.parent)if(Bo(e,o)&&n.has(o))return n.get(o);return null}function ga(e,t,n,o){let r=new Map,a=te(e,r,"exit",null),i=t.body,s=a.id;if(i&&e.ts.isBlock(i))s=mn(e,r,[...i.statements],a.id,{breakTarget:null,continueTarget:null});else if(i){let d=te(e,r,"statement",i);Q(r,d.id,a.id),s=d.id}let l=te(e,r,"entry",t);return Q(r,l.id,s),{id:o,node:t,parentId:n,cfg:r,entryId:l.id,exitId:a.id}}function mn(e,t,n,o,r){let a=o;for(let i=n.length-1;i>=0;i-=1)a=ke(e,t,n[i],a,r);return a}function ke(e,t,n,o,r){let a=e.ts;if(a.isBlock(n))return mn(e,t,[...n.statements],o,r);if(a.isIfStatement(n)){let s=te(e,t,"predicate",n.expression),l=ke(e,t,n.thenStatement,o,r),d=n.elseStatement?ke(e,t,n.elseStatement,o,r):o;return Q(t,s.id,l),Q(t,s.id,d),s.id}if(a.isWhileStatement(n)){let s=te(e,t,"predicate",n.expression),l=ke(e,t,n.statement,s.id,{breakTarget:o,continueTarget:s.id});return Q(t,s.id,l),Q(t,s.id,o),s.id}if(a.isDoStatement(n)){let s=te(e,t,"predicate",n.expression),l=ke(e,t,n.statement,s.id,{breakTarget:o,continueTarget:s.id});return Q(t,s.id,l),Q(t,s.id,o),l}if(a.isForStatement(n)){let s=te(e,t,"predicate",n.condition??n),l=n.incrementor?te(e,t,"statement",n.incrementor):null;l&&Q(t,l.id,s.id);let d=l?.id??s.id,c=ke(e,t,n.statement,d,{breakTarget:o,continueTarget:d});if(Q(t,s.id,c),n.condition&&Q(t,s.id,o),!n.initializer)return s.id;let u=te(e,t,"statement",n.initializer);return Q(t,u.id,s.id),u.id}if(a.isForInStatement(n)||a.isForOfStatement(n)){e.unsupported.add("for-in/for-of iterator assignment is conservatively represented without iterable element flow.");let s=te(e,t,"predicate",n.expression),l=te(e,t,"statement",n.initializer),d=ke(e,t,n.statement,s.id,{breakTarget:o,continueTarget:s.id});return Q(t,s.id,l.id),Q(t,s.id,o),Q(t,l.id,d),s.id}if(a.isSwitchStatement(n)){e.unsupported.add("switch fallthrough is represented conservatively; discriminant-to-case value refinement is unsupported.");let s=te(e,t,"predicate",n.expression),l=o,d=[];for(let c=n.caseBlock.clauses.length-1;c>=0;c-=1){let u=n.caseBlock.clauses[c];l=mn(e,t,[...u.statements],l,{...r,breakTarget:o}),d.push(l)}for(let c of d)Q(t,s.id,c);return Q(t,s.id,o),s.id}if(a.isReturnStatement(n)||a.isThrowStatement(n)){let s=te(e,t,"statement",n),l=[...t.values()].find(d=>d.kind==="exit");return Q(t,s.id,l.id),s.id}if(a.isBreakStatement(n)){let s=te(e,t,"statement",n);return r.breakTarget||e.unsupported.add("A break statement could not be attached to a structured target."),Q(t,s.id,r.breakTarget??o),s.id}if(a.isContinueStatement(n)){let s=te(e,t,"statement",n);return r.continueTarget||e.unsupported.add("A continue statement could not be attached to a structured target."),Q(t,s.id,r.continueTarget??o),s.id}if(a.isTryStatement(n)){e.unsupported.add("Exceptional control-flow and finally completion are not included in the local compiler CFG.");let s=te(e,t,"statement",n);return s.invalidatesAllDefinitions=!0,Q(t,s.id,o),s.id}let i=te(e,t,"statement",n);return Q(t,i.id,o),i.id}function te(e,t,n,o){let r={id:`cfg:${e.nextCfgId++}`,kind:n,ast:o,successors:new Set,predecessors:new Set,definitions:[],uses:[],displayPoint:null,invalidatesAllDefinitions:!1};return t.set(r.id,r),r}function Q(e,t,n){e.get(t).successors.add(n),e.get(n).predecessors.add(t)}function ya(e,t){let n=t.cfg.get(t.entryId);for(let o of t.node.parameters){let r=$e(e,o.name);if(!r){e.unsupported.add("Destructured parameter definition-use is not implemented.");continue}n.definitions.push({point:De(e,r.node,"parameter-definition",r.symbolKey,r.name,t.id),rhsUseIds:[]})}for(let o of t.cfg.values())!o.ast||o.kind==="entry"||o.kind==="exit"||(o.kind==="predicate"&&(o.displayPoint=De(e,o.ast,"predicate",null,"predicate",t.id)),ha(e,t,o,o.ast),!o.displayPoint&&o.definitions.length===0&&o.uses.length===0&&(o.displayPoint=De(e,o.ast,"statement",null,Na(e,o.ast),t.id)))}function ha(e,t,n,o){let r=e.ts;if(r.isTryStatement(o))return;let a=i=>{if(!(i!==o&&r.isFunctionLike(i))){if(r.isVariableDeclaration(i)){let s=i.initializer?wt(e,t.id,i.initializer,n):[];n.uses.push(...s);let l=$e(e,i.name);l?n.definitions.push({point:De(e,l.node,"definition",l.symbolKey,l.name,t.id),rhsUseIds:s.map(d=>d.point.id)}):(n.invalidatesAllDefinitions=!0,e.unsupported.add("Destructured variable reaching definitions are not implemented."));return}if(r.isBinaryExpression(i)&&jo(r,i.operatorToken.kind)){let s=wt(e,t.id,i.right,n);i.operatorToken.kind!==r.SyntaxKind.EqualsToken&&s.push(...wt(e,t.id,i.left,n)),n.uses.push(...s);let l=$e(e,i.left);l?n.definitions.push({point:De(e,l.node,"definition",l.symbolKey,l.name,t.id),rhsUseIds:s.map(d=>d.point.id)}):(n.invalidatesAllDefinitions=!0,e.unsupported.add("Dynamic or destructured assignment targets are not included in reaching definitions."));return}if((r.isPrefixUnaryExpression(i)||r.isPostfixUnaryExpression(i))&&(i.operator===r.SyntaxKind.PlusPlusToken||i.operator===r.SyntaxKind.MinusMinusToken)){let s=wt(e,t.id,i.operand,n);n.uses.push(...s);let l=$e(e,i.operand);l&&n.definitions.push({point:De(e,l.node,"definition",l.symbolKey,l.name,t.id),rhsUseIds:s.map(d=>d.point.id)});return}if(!(r.isFunctionDeclaration(i)||r.isClassDeclaration(i)||r.isInterfaceDeclaration(i))){if(Oo(e,i)){let s=Go(e,t.id,i);s&&n.uses.push(s),r.isPropertyAccessExpression(i)&&a(i.expression);return}i.forEachChild(a)}}};a(o),n.uses=Ko(n.uses)}function wt(e,t,n,o){let r=[],a=i=>{if(!e.ts.isFunctionLike(i)){if(e.ts.isBinaryExpression(i)&&jo(e.ts,i.operatorToken.kind)){o.invalidatesAllDefinitions=!0,e.unsupported.add("Nested assignment expressions are not included in ordered local definition-use flow."),i.operatorToken.kind!==e.ts.SyntaxKind.EqualsToken&&a(i.left),a(i.right);return}if(Oo(e,i)){let s=Go(e,t,i);s&&r.push(s),e.ts.isPropertyAccessExpression(i)&&a(i.expression);return}i.forEachChild(a)}};return a(n),Ko(r)}function Oo(e,t){if(e.ts.isPropertyAccessExpression(t))return!0;if(!e.ts.isIdentifier(t))return!1;let n=t.parent;return!(e.ts.isPropertyAccessExpression(n)&&n.name===t||"name"in n&&n.name===t&&ba(e.ts,n)||e.ts.isPropertyAssignment(n)&&n.name===t||e.ts.isBindingElement(n)&&n.propertyName===t||e.ts.isLabeledStatement(n)||e.ts.isBreakOrContinueStatement(n)||Sa(e.ts,t))}function ba(e,t){return e.isVariableDeclaration(t)||e.isParameter(t)||e.isFunctionDeclaration(t)||e.isFunctionExpression(t)||e.isClassDeclaration(t)||e.isMethodDeclaration(t)||e.isPropertyDeclaration(t)||e.isInterfaceDeclaration(t)||e.isTypeAliasDeclaration(t)||e.isImportSpecifier(t)||e.isImportClause(t)||e.isNamespaceImport(t)}function Sa(e,t){for(let n=t.parent;n;n=n.parent){if(e.isExpression(n)||e.isStatement(n)||e.isSourceFile(n))return!1;if(e.isTypeNode(n))return!0}return!1}function Go(e,t,n){let o=$e(e,n);return o?{point:De(e,o.node,"use",o.symbolKey,o.name,t),property:e.ts.isPropertyAccessExpression(n)}:null}function $e(e,t){let n=e.ts;if(n.isIdentifier(t)){let o=Do(e,t);return o?{node:t,symbolKey:o,name:t.text}:null}if(n.isPropertyAccessExpression(t)){let o=Do(e,t.name);return o?{node:t,symbolKey:o,name:t.getText(e.sourceFile)}:null}return n.isParenthesizedExpression(t)||n.isAsExpression(t)||n.isTypeAssertionExpression(t)||n.isNonNullExpression(t)?$e(e,t.expression):((n.isArrayLiteralExpression(t)||n.isObjectLiteralExpression(t))&&e.unsupported.add("Heap aggregate identity and destructured assignment are not included in local points-to flow."),null)}function Do(e,t){let n=e.checker.getSymbolAtLocation(t);if(!n)return null;if((n.flags&e.ts.SymbolFlags.Alias)!==0)try{n=e.checker.getAliasedSymbol(n)}catch{}let o=n.valueDeclaration??n.declarations?.[0];return o?`symbol:${encodeURIComponent(o.getSourceFile().fileName)}:${o.getStart()}:${n.getName()}`:`symbol:${n.getName()}`}function De(e,t,n,o,r,a){let i=t.getStart(e.sourceFile),s=t.getEnd(),l=e.sourceFile.getLineAndCharacterOfPosition(i),d=`flow-point:${encodeURIComponent(e.sourceFile.fileName)}:${i}:${s}:${n}:${encodeURIComponent(o??r)}`,c=e.points.get(d);if(c)return c;let u={id:d,kind:n,name:r,symbolKey:o,callableId:a,start:i,end:s,line:l.line,column:l.character,node:t};return e.points.set(d,u),u}function va(e,t){let n=[...t.cfg.values()].flatMap(l=>l.definitions),o=new Map(n.map(l=>[l.point.id,l])),r=xa(n),a=new Map,i=new Map;for(let l of t.cfg.values())a.set(l.id,new Set),i.set(l.id,new Set);let s=!0;for(;s;){s=!1;for(let l of t.cfg.values()){let d=Ra([...l.predecessors].map(f=>i.get(f))),c=new Set(d);l.invalidatesAllDefinitions&&c.clear();let u=Ea(l.definitions);for(let f of u){for(let m of r.get(f.point.symbolKey)??[])c.delete(m.point.id);c.add(f.point.id)}fn(a.get(l.id),d)||(a.set(l.id,d),s=!0),fn(i.get(l.id),c)||(i.set(l.id,c),s=!0)}}for(let l of t.cfg.values()){let d=a.get(l.id);for(let c of l.uses){let u=l.definitions.filter(m=>m.point.symbolKey===c.point.symbolKey&&m.point.start<c.point.start&&!m.rhsUseIds.includes(c.point.id)).sort((m,p)=>p.point.start-m.point.start)[0],f=u?[u.point.id]:d;for(let m of f){let p=o.get(m);p.point.symbolKey===c.point.symbolKey&&nt(e,"reaching-definition",p.point.id,c.point.id,"exact","A CFG path reaches this use without an intervening definition.")}}for(let c of l.definitions)for(let u of c.rhsUseIds)nt(e,"value-source",u,c.point.id,"exact","This right-hand-side use supplies the new definition.")}}function xa(e){let t=new Map;for(let n of e){if(!n.point.symbolKey)continue;let o=t.get(n.point.symbolKey)??[];o.push(n),t.set(n.point.symbolKey,o)}return t}function Ea(e){let t=new Map;for(let n of e)n.point.symbolKey&&t.set(n.point.symbolKey,n);return[...t.values()]}function Ca(e,t){let n=La(t);for(let o of t.cfg.values()){if(o.successors.size<2||!o.displayPoint)continue;let r=n.get(o.id);for(let a of o.successors)for(let i of n.get(a)??[]){if(r.has(i)||i===t.exitId)continue;let s=t.cfg.get(i),l=[...s.definitions.map(d=>d.point),...s.uses.map(d=>d.point),...s.displayPoint?[s.displayPoint]:[]];for(let d of Ma(l))nt(e,"control-dependence",o.displayPoint.id,d.id,"exact","The target postdominates a branch successor but does not postdominate the predicate.")}}}function La(e){let t=[...e.cfg.keys()],n=new Set(t),o=new Map;for(let a of t)o.set(a,a===e.exitId?new Set([a]):new Set(n));let r=!0;for(;r;){r=!1;for(let a of e.cfg.values()){if(a.id===e.exitId)continue;let i=[...a.successors].map(l=>o.get(l)),s=new Set([a.id,...Ta(i)]);fn(o.get(a.id),s)||(o.set(a.id,s),r=!0)}}return o}function Ia(e,t){let n=new Map(t.map(i=>[i.id,i.parentId])),o=t.flatMap(i=>[...i.cfg.values()].flatMap(s=>s.definitions.map(l=>l.point))),r=new Map;for(let i of o){if(!i.symbolKey)continue;let s=r.get(i.symbolKey)??[];s.push(i),r.set(i.symbolKey,s)}let a=new Set([...e.edges.values()].filter(i=>i.kind==="reaching-definition").map(i=>i.toPointId));for(let i of t)for(let s of[...i.cfg.values()].flatMap(l=>l.uses)){if(!s.point.symbolKey||a.has(s.point.id))continue;let l=r.get(s.point.symbolKey)??[];for(let d of l)wa(d.callableId,s.point.callableId,n)?nt(e,"closure-capture",d.id,s.point.id,"candidate","Compiler identity proves the captured binding, but invocation order can select among outer definitions."):s.property&&nt(e,"field-definition-to-use",d.id,s.point.id,"candidate","Compiler identity matches the field; cross-callable receiver and execution order remain unresolved.")}[...e.edges.values()].some(i=>i.kind==="closure-capture")&&e.unsupported.add("Closure capture identity is known, but invocation order and intervening writes remain candidate flow."),[...e.edges.values()].some(i=>i.kind==="field-definition-to-use")&&e.unsupported.add("Cross-callable field flow lacks receiver points-to and invocation-order analysis.")}function wa(e,t,n){for(let o=n.get(t)??null;o;o=n.get(o)??null)if(o===e)return!0;return!1}function nt(e,t,n,o,r,a){let i=`local-flow-edge:${t}:${encodeURIComponent(n)}:${encodeURIComponent(o)}`;e.edges.set(i,{id:i,kind:t,fromPointId:n,toPointId:o,strength:r,reason:a})}function jo(e,t){return t>=e.SyntaxKind.FirstAssignment&&t<=e.SyntaxKind.LastAssignment}function Na(e,t){let n=t.getText(e.sourceFile).replace(/\s+/gu," ").trim();return n.length>80?`${n.slice(0,77)}...`:n||e.ts.SyntaxKind[t.kind]||"statement"}function Ko(e){return[...new Map(e.map(t=>[t.point.id,t])).values()]}function Ma(e){return[...new Map(e.map(t=>[t.id,t])).values()]}function Ra(e){return new Set(e.flatMap(t=>[...t]))}function Ta(e){return e.length===0?new Set:new Set([...e[0]].filter(t=>e.slice(1).every(n=>n.has(t))))}function fn(e,t){return e.size===t.size&&[...e].every(n=>t.has(n))}function Fa(e,t){return e.start-t.start||e.kind.localeCompare(t.kind)||e.id.localeCompare(t.id)}function pn(e){return{points:[],edges:[],coverage:{status:"unsupported",basis:"typescript-compiler-cfg-reaching-definitions",unsupported:[e]}}}var Aa=Dn("typescript-local-flow",{clearGroups:["whole-project","source-file","semantic-provider"]});function gn(e,t,n,o){if(!Gn(t))return null;let r=`${t}\0${n}\0${o}`;return Aa.get(e,r,()=>{let a=dt(e,t);return a?_o(a,Pa(e.config.projectRoot,t),{startLine:n,endLine:o}):{points:[],edges:[],coverage:{status:"unsupported",basis:"typescript-compiler-cfg-reaching-definitions",unsupported:[`Current source is unavailable for ${t}.`]}}})}function ka(e,t=new Map){let n=new Map,o=new Map,r=[];for(let a of e.transfers){if(!e.caller)continue;let i=Nt(e.caller,a.callerPosition),s=Nt(e.callee,a.calleePosition);ot(n,i),ot(n,s),hn(o,e.caller,i),hn(o,e.callee,s);let l=oe("edge","data-transfer",a.proof.file,String(a.proof.startLine),String(a.callerPosition),String(a.calleePosition));o.set(l,{id:l,kind:"data-transfer",fromNodeId:i.id,toNodeId:s.id,directed:!0,disposition:"folded",semantics:[{family:"data",subtype:"argument-to-parameter",attributes:{argumentText:a.argumentText,callerPosition:a.callerPosition,calleePosition:a.calleePosition}}],evidence:[{method:"compiler-callsite-direct-parameter-transfer",strength:"exact",identity:`${e.caller.symbol}:${a.callerPosition} -> ${e.callee.symbol}:${a.calleePosition}`,location:{file:a.proof.file,line:a.proof.startLine,endLine:a.proof.endLine}}]})}return e.unknown.forEach((a,i)=>{let s=Nt(e.callee,a.calleePosition);ot(n,s),hn(o,e.callee,s);let l=t.get(a.calleePosition);if(l&&Ua(l)){za(o,n,e,a.calleePosition,a.argumentText,l);return}let d=Ka(e,a.calleePosition,a.argumentText);ot(n,d);let c=oe("edge","data-transfer-unsupported",a.proof.file,String(a.proof.startLine),String(a.calleePosition),String(i));o.set(c,{id:c,kind:"data-transfer",fromNodeId:d.id,toNodeId:s.id,directed:!0,disposition:"unsupported",semantics:[{family:"data",subtype:"argument-to-parameter",attributes:{argumentText:a.argumentText,calleePosition:a.calleePosition}}],evidence:[{method:"compiler-callsite-argument-expression",strength:"exact",identity:a.argumentText,location:{file:a.proof.file,line:a.proof.startLine,endLine:a.proof.endLine}}]}),r.push({id:oe("frontier","data-transfer",c),kind:"data-transfer",direction:"unresolved",fromNodeIds:[d.id],edgeIds:[c],memberNodeIds:[s.id],memberCount:1,disposition:"unsupported",reason:l?.derivation.rule??a.reason,expansion:null})}),{nodes:[...n.values()],edges:[...o.values()],frontiers:r,blindSpots:[]}}function zo(e,t,n=[]){let o=Uo(),r=new Map,a=new Set;for(let i of t){if(i.kind!=="call"||!i.fromSymbol||!i.toSymbol||i.line===null)continue;let s=ja(r,e,i.toFile,i.toSymbol);if(!s)continue;let l=Wn(e,s),d=l.sites.filter(g=>g.file===i.fromFile&&g.startLine<=i.line&&g.endLine>=i.line&&g.caller?.symbol===i.fromSymbol);if(d.length!==1){let g=l.unresolved.find(b=>b.file===i.fromFile&&b.line===i.line);g&&o.blindSpots.push(`Parameter flow unresolved at ${i.fromFile}:${i.line+1}: ${g.reason}.`);continue}let c=d[0],u=`${c.file}\0${c.callNode.startIndex}\0${c.callNode.endIndex}\0${s.symbol}`;if(a.has(u))continue;a.add(u);let f=Hn(e,c),m=Y(e,c.file)?.rootNode,p=new Map;if(m)for(let g of f.unknown){let b=zn({db:e,file:c.file,root:m},c.arguments[g.calleePosition]);b&&p.set(g.calleePosition,b)}qo(o,ka(f,p)),f.caller&&Oa(c.callNode)&&Ga(o,f,c.callNode)}for(let i of n){if(!i.location||!["source-construct","symbol"].includes(i.kind))continue;let s=i.location.endLine??i.location.line,l=gn(e,i.location.file,i.location.line,s);if(l){qo(o,$a(i,l.points,l.edges));for(let d of l.coverage.unsupported)o.blindSpots.push(`TypeScript local flow is partial for ${i.location.file}:${i.location.line+1}-${s+1}: ${d} Recover with: scip-query inspect --at '${i.location.file}:${i.location.line+1}-${s+1}' --view behavior.`)}}return o.blindSpots=[...new Set(o.blindSpots)].sort(),o}function $a(e,t,n){let o=Uo(),r=new Map,a=new Map,i=new Map,s=e.location.file;for(let l of t){let d=Da(e,s,l);i.set(l.id,d.id),r.set(d.id,d),_a(a,e,d)}for(let l of n){let d=i.get(l.fromPointId),c=i.get(l.toPointId);if(!d||!c)continue;let u=Ba(l),f=oe("edge","typescript-local-flow",s,l.id);a.set(f,{id:f,kind:l.kind==="control-dependence"?"control-dependence":"data-transfer",fromNodeId:d,toNodeId:c,directed:!0,disposition:"folded",semantics:[u],evidence:[{method:"typescript-compiler-cfg-reaching-definitions",strength:l.strength,identity:l.reason,location:r.get(d)?.location??e.location}]})}return o.nodes=[...r.values()],o.edges=[...a.values()],o}function Da(e,t,n){return{id:oe("local-flow-point",t,String(n.start),String(n.end),n.kind,n.symbolKey??n.name),kind:n.kind==="parameter-definition"||n.kind==="definition"?"local-definition":n.kind==="use"?"local-use":n.kind==="predicate"?"control-predicate":"local-statement",label:n.name,disposition:"folded",location:{file:t,line:n.line,endLine:n.line},anchorIds:[],attributes:{ownerNodeId:e.id,pointKind:n.kind,callableId:n.callableId,symbolKey:n.symbolKey,column:n.column}}}function _a(e,t,n){let o=oe("edge","local-flow-owner",t.id,n.id);e.has(o)||e.set(o,{id:o,kind:"local-flow-owner",fromNodeId:t.id,toNodeId:n.id,directed:!0,disposition:"folded",semantics:[{family:"identity",subtype:"contains"}],evidence:[{method:"typescript-compiler-local-flow-owner",strength:"exact",identity:t.id,location:n.location}]})}function Ba(e){switch(e.kind){case"reaching-definition":return{family:"data",subtype:"definition-to-use"};case"value-source":return{family:"data",subtype:"value-to-definition"};case"closure-capture":return{family:"data",subtype:"closure-capture"};case"field-definition-to-use":return{family:"data",subtype:"field-definition-to-use"};case"control-dependence":return{family:"control",subtype:"control-dependence"}}}function Oa(e){let t=e;for(;t.parent&&["await_expression","yield_expression","parenthesized_expression","as_expression","type_assertion"].includes(t.parent.type);)t=t.parent;return t.parent!==null&&t.parent.type!=="expression_statement"}function Ga(e,t,n){if(!t.caller)return;let o={id:oe("call-result",t.call.file,String(n.startIndex),String(n.endIndex),t.callee.symbol),kind:"call-result",label:`result of ${t.callee.leaf}`,disposition:"folded",location:{file:t.call.file,line:t.call.startLine,endLine:t.call.endLine},anchorIds:[],attributes:{calleeSymbol:t.callee.symbol,callerSymbol:t.caller.symbol}},r=oe("edge","return-to-call-result",t.callee.symbol,o.id),a=oe("edge","call-result-owner",t.caller.symbol,o.id);e.nodes.push(o),e.edges.push({id:r,kind:"data-transfer",fromNodeId:bn(t.callee.symbol),toNodeId:o.id,directed:!0,disposition:"folded",semantics:[{family:"data",subtype:"return-to-call-result"}],evidence:[{method:"compiler-callsite-used-result",strength:"exact",identity:`${t.callee.symbol} -> ${t.caller.symbol}`,location:o.location}]},{id:a,kind:"call-result-owner",fromNodeId:bn(t.caller.symbol),toNodeId:o.id,directed:!0,disposition:"folded",semantics:[{family:"identity",subtype:"contains-call-result"}],evidence:[{method:"compiler-call-result-owner",strength:"exact",identity:t.caller.symbol,location:o.location}]})}function Uo(){return{nodes:[],edges:[],frontiers:[],blindSpots:[]}}function qo(e,t){yn(e.nodes,t.nodes),yn(e.edges,t.edges),yn(e.frontiers,t.frontiers),e.blindSpots.push(...t.blindSpots)}function yn(e,t){let n=new Set(e.map(o=>o.id));for(let o of t)n.has(o.id)||(n.add(o.id),e.push(o))}function ja(e,t,n,o){let r=`${n}\0${o}`,a=e.get(r);if(a!==void 0)return a;let i=X(t,n).find(s=>s.symbol===o)??null;return e.set(r,i),i}function Nt(e,t){return{id:Va(e.symbol,t),kind:"parameter",label:`${e.leaf} parameter ${t}`,disposition:"folded",location:{file:e.relativePath,line:e.startLine,endLine:e.endLine},anchorIds:[],attributes:{ownerSymbol:e.symbol,position:t}}}function Ka(e,t,n){return{id:oe("argument-expression",e.call.file,String(e.call.startLine),String(e.call.endLine),String(t)),kind:"argument-expression",label:n,disposition:"unsupported",location:{file:e.call.file,line:e.call.startLine,endLine:e.call.endLine},anchorIds:[],attributes:{calleeSymbol:e.callee.symbol,position:t}}}function qa(e,t,n){return{id:oe("static-value",e.call.file,String(e.call.startLine),String(e.call.endLine),String(t)),kind:"static-value",label:n.value,disposition:"folded",location:{file:e.call.file,line:e.call.startLine,endLine:e.call.endLine},anchorIds:[],attributes:{value:n.value,precision:n.precision,evidence:n.evidence,termKind:n.term.kind,derivationRule:n.derivation.rule}}}function za(e,t,n,o,r,a){let i=qa(n,o,a),s=Nt(n.callee,o);ot(t,i);let l=oe("edge","static-value-transfer",n.call.file,String(n.call.startLine),String(o));e.set(l,{id:l,kind:"data-transfer",fromNodeId:i.id,toNodeId:s.id,directed:!0,disposition:"folded",semantics:[{family:"data",subtype:Wa(a),attributes:{argumentText:r,calleePosition:o,value:a.value,precision:a.precision,derivationRule:a.derivation.rule}}],evidence:Ha(a,n)})}function Ua(e){return e.derivation.kind!=="heuristic"&&e.precision!=="symbolic"&&e.precision!=="unknown"}function Wa(e){return e.derivation.rule==="bounded-call-return"?"return-to-parameter":e.derivation.rule==="member-constant"||e.term.kind==="property"?"property-to-parameter":"constant-to-parameter"}function Ha(e,t){return(e.derivation.sourceSpans.length>0?e.derivation.sourceSpans:[t.call]).map(o=>({method:`static-value:${e.derivation.rule}`,strength:e.derivation.kind==="direct"?"exact":"derived",identity:e.derivation.inputFactIds.join(",")||e.value,location:{file:o.file,line:o.startLine,endLine:o.endLine}}))}function ot(e,t){e.has(t.id)||e.set(t.id,t)}function hn(e,t,n){let o=oe("edge","parameter-owner",t.symbol,n.id);e.has(o)||e.set(o,{id:o,kind:"parameter-owner",fromNodeId:bn(t.symbol),toNodeId:n.id,directed:!0,disposition:"folded",semantics:[{family:"identity",subtype:"contains"}],evidence:[{method:"compiler-parameter-owner",strength:"exact",identity:t.symbol,location:{file:t.relativePath,line:t.startLine,endLine:t.endLine}}]})}function Va(e,t){return oe("parameter",e,String(t))}function bn(e){return oe("symbol",e)}function oe(...e){return e.map(t=>encodeURIComponent(t)).join(":")}function Wo(e,t){let n=new Map,o=new Map,r=new Map,a=new Set;for(let i of t){if(!i.location||!["source-construct","symbol"].includes(i.kind))continue;let s=i.location.endLine??i.location.line,l=Qn(e,i.location.file,i.location.line,s);if(!l){a.add(`Control dependence unavailable for ${i.location.file}:${i.location.line+1}-${s+1}: no supported syntax tree or covering construct.`);continue}for(let d of l.facts){let c=Sn(i,d.controller),u=Sn(i,d.outcome);n.set(c.id,c),n.set(u.id,u),Qa(o,i,c);let f=_e("edge","control-dependence",c.id,u.id,d.subtype);o.set(f,{id:f,kind:"control-dependence",fromNodeId:c.id,toNodeId:u.id,directed:!0,disposition:"folded",semantics:[{family:"control",subtype:d.subtype,attributes:{...d.attributes}}],evidence:[{method:"parser-control-dependence",strength:"exact",identity:`${i.location.file}:${d.controller.startLine+1}-${d.outcome.startLine+1}`,location:{file:i.location.file,line:d.controller.startLine,endLine:d.controller.endLine}}]})}for(let d of l.terminals){let c=Sn(i,d);n.set(c.id,c);let u=d.label.startsWith("throw")||d.label.startsWith("raise")?"throw":"return",f=_e("edge","control-terminal",i.id,c.id,u);o.set(f,{id:f,kind:"control-terminal",fromNodeId:i.id,toNodeId:c.id,directed:!0,disposition:"folded",semantics:[{family:"control",subtype:u==="throw"?"throws":"returns"}],evidence:[{method:"parser-terminal-statement",strength:"exact",identity:d.label,location:{file:i.location.file,line:d.startLine,endLine:d.endLine}}]})}for(let d of l.unsupported){let c=_e("control-unsupported",i.location.file,String(d.startLine),String(d.endLine),d.reason);n.set(c,{id:c,kind:"control-unsupported",label:d.reason,disposition:"unsupported",location:{file:i.location.file,line:d.startLine,endLine:d.endLine},anchorIds:[],attributes:{ownerNodeId:i.id}});let u=_e("edge","control-unsupported",i.id,c);o.set(u,{id:u,kind:"control-dependence",fromNodeId:i.id,toNodeId:c,directed:!0,disposition:"unsupported",semantics:[{family:"control",subtype:"unresolved-control-construct"}],evidence:[{method:"parser-control-construct",strength:"exact",identity:d.reason,location:{file:i.location.file,line:d.startLine,endLine:d.endLine}}]});let f=_e("frontier","control-dependence",c);r.set(f,{id:f,kind:"control-dependence",direction:"unresolved",fromNodeIds:[i.id],edgeIds:[u],memberNodeIds:[c],memberCount:1,disposition:"unsupported",reason:d.reason,expansion:null})}}return{nodes:[...n.values()],edges:[...o.values()],frontiers:[...r.values()],blindSpots:[...a].sort()}}function Sn(e,t){let n=e.location.file;return{id:_e(`control-${t.kind}`,n,String(t.startLine),String(t.endLine),t.label),kind:`control-${t.kind}`,label:t.label,disposition:"folded",location:{file:n,line:t.startLine,endLine:t.endLine},anchorIds:[],attributes:{ownerNodeId:e.id,constructKind:t.kind,implicit:t.implicit}}}function Qa(e,t,n){let o=_e("edge","control-owner",t.id,n.id);e.has(o)||e.set(o,{id:o,kind:"control-owner",fromNodeId:t.id,toNodeId:n.id,directed:!0,disposition:"folded",semantics:[{family:"identity",subtype:"contains-control"}],evidence:[{method:"parser-control-owner",strength:"exact",identity:t.id,location:t.location}]})}function _e(...e){return e.map(t=>encodeURIComponent(t)).join(":")}var Mt=new Set(["arrow_function","constructor_declaration","function_declaration","function_definition","function_expression","generator_function","generator_function_declaration","function_item","lambda","lambda_expression","method","method_declaration","method_definition"]),it=new Set(["block","body","compound_statement","declaration_list","statement_block"]),Ya=new Set(["assignment","assignment_expression","augmented_assignment_expression"]),xn=new Set(["update_expression"]),Yo=new Set(["array_access","element_access_expression","subscript_expression"]),Xo=new Set(["attribute","field_access","field_expression","member_access_expression","member_expression","selector_expression"]),Xa=new Set(["false","null","null_literal","number","number_literal","string","string_literal","template_string","true"]),Za=new Set(["call_expression","method_invocation","object_creation_expression"]),Ja=new Set(["comment","else_clause","formal_parameters","parameters","type_parameters"]);function Zo(e,t,n,o){let r=Y(e,t);if(!r)return null;let a=ss(r.rootNode,n,o);if(!a)return null;let i=[],s=[],l=[];return Be(a,d=>{if(Ya.has(d.type)||xn.has(d.type)||er(d)){let c=es(d);c?i.push(c):l.push({family:"state",startLine:d.startPosition.row,endLine:d.endPosition.row,reason:`Mutation target ${be(d.text)} could not be resolved to an exact source resource.`})}}),Be(a,d=>{if(!it.has(d.type))return;let c=is(d);for(let u=0;u<c.length-1;u+=1)s.push({from:rt(c[u]),to:rt(c[u+1]),subtype:"lexical-successor",synchronizationScope:null,attributes:{sameScope:!0,executionConditional:!0}});for(let u=0;u<c.length;u+=1){let f=c[u],m=cs(f).filter(p=>p.type==="await_expression");for(let p of m){let g=at("event",`await ${be(p.text.replace(/^await\s+/u,""))}`,p);s.push({from:rt(f),to:g,subtype:"awaits-completion",synchronizationScope:null,attributes:{completionRequired:!0}});let b=c[u+1];b&&s.push({from:g,to:rt(b),subtype:"await-completion-before",synchronizationScope:null,attributes:{continuationOnly:!0}})}}}),Be(a,d=>{if(d.type!=="synchronized_statement")return;let c=d.childForFieldName("object")??d.childForFieldName("condition")??d.namedChildren.find(g=>!it.has(g.type)),u=d.childForFieldName("body")??d.namedChildren.find(g=>it.has(g.type));if(!c||!u){l.push({family:"temporal",startLine:d.startPosition.row,endLine:d.endPosition.row,reason:"Synchronized scope has no structurally resolved monitor or body."});return}let f=be(c.text).replace(/^\(|\)$/gu,""),m=at("lock",f,c),p=ls(u).filter(g=>g.parent!==null&&tr(g));for(let g of as(p))s.push({from:m,to:rt(g),subtype:"inside-lock-scope",synchronizationScope:f,attributes:{syntaxNative:!0}})}),{mutations:i,temporal:s,unsupported:l}}function es(e){let t=er(e),n=e.childForFieldName("left")??e.childForFieldName("argument")??(t?e.namedChildren.at(-1)??null:e.namedChildren[0]??null);if(!n)return null;let o=ts(n);if(!o)return null;let r=t?"delete":xn.has(e.type)||!rs(e,n).startsWith("=")?"update":"assign",a=t||xn.has(e.type)?null:e.childForFieldName("right");return{event:at("event",be(e.text),e),resource:{kind:"resource",label:o.name,startLine:n.startPosition.row,endLine:n.endPosition.row},operation:r,durabilityClass:"in-memory",recordIdentity:o.recordIdentity,value:a?at("value",be(a.text),a):null,dataSubtype:a?ns(a,e):null}}function ts(e){if(Yo.has(e.type)){let t=e.childForFieldName("object")??e.childForFieldName("array")??e.namedChildren[0]??null,n=e.childForFieldName("index")??e.childForFieldName("subscript")??e.namedChildren[1]??null;return!t||!n?null:{name:`${be(t.text)}[]`,recordIdentity:be(n.text)}}return Xo.has(e.type)?{name:be(e.text),recordIdentity:null}:/^(?:identifier|property_identifier|field_identifier)$/u.test(e.type)?{name:be(e.text),recordIdentity:null}:null}function ns(e,t){return Xa.has(e.type)||/(?:integer|float|decimal|boolean|character)_literal$/u.test(e.type)?"constant-to-state":Za.has(e.type)?"return-to-state":Xo.has(e.type)||Yo.has(e.type)?"property-to-state":/identifier$/u.test(e.type)?os(e.text,t)?"captured-value-to-state":"value-to-state":"expression-to-state"}function os(e,t){let n=vn(t.parent);if(!n||Ho(n,e))return!1;let o=vn(n.parent);for(;o;){if(Ho(o,e))return!0;o=vn(o.parent)}return!1}function vn(e){let t=e;for(;t;){if(Mt.has(t.type))return t;t=t.parent}return null}function Ho(e,t){let n=e.childForFieldName("parameters")??e.namedChildren.find(a=>["formal_parameters","parameters"].includes(a.type));if(n&&Vo(n,t))return!0;let o=e.childForFieldName("body")??e.namedChildren.find(a=>it.has(a.type));if(!o)return!1;let r=!1;return Jo(o,e,a=>{if(r||!/(?:declarator|declaration|parameter)$/u.test(a.type))return;let i=a.childForFieldName("name")??a.childForFieldName("pattern")??a.namedChildren[0];i&&Vo(i,t)&&(r=!0)}),r}function Vo(e,t){let n=!1;return Be(e,o=>{/identifier$/u.test(o.type)&&o.text===t&&(n=!0)}),n}function Jo(e,t,n){n(e);for(let o of e.namedChildren)o!==t&&Mt.has(o.type)||Jo(o,t,n)}function rs(e,t){let n=e.childForFieldName("right"),o=Math.max(0,t.endIndex-e.startIndex),r=n?Math.max(o,n.startIndex-e.startIndex):e.text.length;return e.text.slice(o,r).trim()}function er(e){return(e.type==="delete_expression"||e.type==="unary_expression")&&/^delete\b/u.test(e.text.trim())}function is(e){return e.namedChildren.filter(t=>tr(t))}function tr(e){return Ja.has(e.type)||it.has(e.type)?!1:/(?:statement|declaration)$/u.test(e.type)||e.type==="expression_statement"||e.type==="local_variable_declaration"}function as(e){let t=new Set(e);return e.filter(n=>{let o=n.parent;for(;o;){if(t.has(o))return!1;o=o.parent}return!0})}function rt(e){return at("event",be(e.text),e)}function at(e,t,n){return{kind:e,label:t,startLine:n.startPosition.row,endLine:n.endPosition.row}}function ss(e,t,n){let o=[];return Be(e,a=>{a.startPosition.row<=t&&a.endPosition.row>=n&&o.push(a)}),o.filter(a=>Mt.has(a.type)).sort(Qo)[0]??o.sort(Qo)[0]??null}function Qo(e,t){return e.endIndex-e.startIndex-(t.endIndex-t.startIndex)||e.startIndex-t.startIndex}function ls(e){let t=[];return Be(e,n=>t.push(n)),t}function cs(e){let t=[],n=o=>{t.push(o);for(let r of o.namedChildren)r!==e&&Mt.has(r.type)||n(r)};return n(e),t}function Be(e,t){t(e);for(let n of e.namedChildren)Be(n,t)}function be(e){return e.trim().replace(/\s+/gu," ")}function rr(e,t,n=[]){let o=new Map,r=new Map,a=new Map,i=new Set;for(let s of t){if(!s.location||!["source-construct","symbol"].includes(s.kind))continue;let l=s.location.endLine??s.location.line,d=Zo(e,s.location.file,s.location.line,l);if(!d){i.add(`State and temporal analysis unavailable for ${s.location.file}:${s.location.line+1}-${l+1}: no supported syntax tree or covering construct.`);continue}for(let c of d.mutations){let u=Tt(s,c.event),f=gs(s,c.resource,c.durabilityClass);if(o.set(u.id,u),o.set(f.id,f),Ft(r,s,u,"contains-state-effect"),Pt(r,{kind:"state-resource",from:u,to:f,semantics:[{family:"state",subtype:c.operation==="delete"?"deletes-resource":"writes-resource",attributes:{operation:c.operation,durabilityClass:c.durabilityClass,resource:c.resource.label,recordIdentity:c.recordIdentity,transactionMembership:"unknown"}}],method:"parser-state-mutation",identity:c.event.label}),c.value&&c.dataSubtype){let m=Tt(s,c.value);o.set(m.id,m),Pt(r,{kind:"data-to-state",from:m,to:f,semantics:[{family:"data",subtype:c.dataSubtype,attributes:{operation:c.operation,resource:c.resource.label,recordIdentity:c.recordIdentity,value:c.value.label}}],method:"parser-assignment-value",identity:`${c.value.label} -> ${c.resource.label}`})}}for(let c of d.temporal){let u=Tt(s,c.from),f=Tt(s,c.to);o.set(u.id,u),o.set(f.id,f),Ft(r,s,u,c.from.kind==="lock"?"contains-lock-scope":"contains-event"),Ft(r,s,f,"contains-event"),Pt(r,{kind:"temporal-order",from:u,to:f,semantics:[{family:"temporal",subtype:c.subtype,context:c.synchronizationScope?{synchronizationScope:c.synchronizationScope}:void 0,attributes:{...c.attributes}}],method:c.subtype==="inside-lock-scope"?"parser-synchronized-scope":"parser-program-order",identity:`${c.from.label} -> ${c.to.label}`})}for(let c of d.unsupported){let u=Ie(`${c.family}-unsupported`,s.location.file,String(c.startLine),String(c.endLine),c.reason);o.set(u,{id:u,kind:`${c.family}-unsupported`,label:c.reason,disposition:"unsupported",location:{file:s.location.file,line:c.startLine,endLine:c.endLine},anchorIds:[],attributes:{ownerNodeId:s.id}});let f=Ie("edge",`${c.family}-unsupported`,s.id,u);r.set(f,{id:f,kind:`${c.family}-unsupported`,fromNodeId:s.id,toNodeId:u,directed:!0,disposition:"unsupported",semantics:[{family:c.family,subtype:`unresolved-${c.family}-construct`}],evidence:[{method:`parser-${c.family}-construct`,strength:"exact",identity:c.reason,location:{file:s.location.file,line:c.startLine,endLine:c.endLine}}]});let m=Ie("frontier",c.family,u);a.set(m,{id:m,kind:c.family,direction:"unresolved",fromNodeIds:[s.id],edgeIds:[f],memberNodeIds:[u],memberCount:1,disposition:"unsupported",reason:c.reason,expansion:null})}}for(let s of t.filter(l=>l.kind==="runtime-boundary-participant")){let l=Rt(s,"protocol"),d=Rt(s,"action"),c=Rt(s,"address")??s.label;!l||!d||!or(l,d)||nr(o,r,s,{observationId:s.id,action:d,strength:"exact",file:s.location?.file??"",line:s.location?.line??0,address:c,protocol:l,role:Rt(s,"role")??void 0,resolution:"locally-linked"})}for(let s of n){if(!s.protocol||!or(s.protocol,s.action))continue;let l=ms(t,s.file,s.line,s.ownerShortName??null);if(!l){i.add(`State observation ${s.observationId} at ${s.file}:${s.line+1} has no materialized owner node.`);continue}nr(o,r,l,s)}return{nodes:[...o.values()],edges:[...r.values()],frontiers:[...a.values()],blindSpots:[...i].sort()}}function nr(e,t,n,o){let r=us(o),i={id:Ie("runtime-state-event",o.observationId),kind:"runtime-state-event",label:`${o.action} ${r}`,disposition:"folded",location:{file:o.file,line:o.line},anchorIds:[],attributes:{action:o.action,protocol:o.protocol??null,modality:o.modality??null,resolution:o.resolution??null}},s=o.protocol==="database"?"external-durable-intent":"external",l={id:Ie("runtime-state-resource",o.protocol??"unknown",r),kind:"runtime-state-resource",label:r,disposition:"folded",location:{file:o.file,line:o.line},anchorIds:[],attributes:{protocol:o.protocol??null,durabilityClass:s}};e.set(i.id,i),e.set(l.id,l),Ft(t,n,i,"contains-runtime-state-effect");let d=ds(o.action);Pt(t,{kind:"runtime-state-resource",from:i,to:l,semantics:[{family:"state",subtype:d,context:{crossesRuntimeBoundary:!0,protocol:o.protocol},attributes:{operation:o.action,durabilityClass:s,resource:r,recordIdentity:ps(o),modality:o.modality??null,resolution:o.resolution??null,transactionMembership:"unknown",commitState:o.protocol==="database"?"unknown":null}}],method:`runtime-boundary-${o.strength}`,identity:o.observationId})}function ds(e){return e==="database.read"?"reads-resource":e==="queue.send"?"enqueues-resource":e==="queue.consume"?"consumes-resource":"writes-resource"}function us(e){return(e.keyParts?.find(n=>["address","resource"].includes(n.name))?.value??e.address)||e.observationId}function ps(e){return e.keyParts?.find(n=>/^(?:id|key|record)$/u.test(n.name))?.value??null}function or(e,t){return e==="database"&&["database.read","database.write"].includes(t)||e==="queue"&&["queue.consume","queue.send"].includes(t)}function Rt(e,t){let n=e.attributes[t];return typeof n=="string"?n:null}function ms(e,t,n,o){let r=e.filter(i=>i.location?.file===t&&["source-construct","symbol"].includes(i.kind)),a=r.filter(i=>i.location.line<=n&&(i.location.endLine??i.location.line)>=n).sort(fs)[0];if(a)return a;if(o){let i=r.find(s=>s.label===o||s.label.endsWith(`.${o}`)||s.label.includes(o));if(i)return i}return r.length===1?r[0]:null}function fs(e,t){let n=(e.location?.endLine??e.location?.line??0)-(e.location?.line??0),o=(t.location?.endLine??t.location?.line??0)-(t.location?.line??0);return n-o}function Tt(e,t){let n=e.location.file;return{id:Ie(`program-${t.kind}`,n,String(t.startLine),String(t.endLine),t.label),kind:`program-${t.kind}`,label:t.label,disposition:"folded",location:{file:n,line:t.startLine,endLine:t.endLine},anchorIds:[],attributes:{ownerNodeId:e.id,constructKind:t.kind}}}function gs(e,t,n){let o=e.location.file;return{id:Ie("program-resource",o,e.id,t.label,n),kind:"program-resource",label:t.label,disposition:"folded",location:{file:o,line:t.startLine,endLine:t.endLine},anchorIds:[],attributes:{ownerNodeId:e.id,durabilityClass:n}}}function Ft(e,t,n,o){let r=Ie("edge","program-owner",t.id,n.id,o);e.has(r)||e.set(r,{id:r,kind:"program-owner",fromNodeId:t.id,toNodeId:n.id,directed:!0,disposition:"folded",semantics:[{family:"identity",subtype:o}],evidence:[{method:"parser-program-owner",strength:"exact",identity:t.id,location:n.location}]})}function Pt(e,t){let n=Ie("edge",t.kind,t.from.id,t.to.id,t.semantics[0].subtype);e.set(n,{id:n,kind:t.kind,fromNodeId:t.from.id,toNodeId:t.to.id,directed:!0,disposition:"folded",semantics:t.semantics,evidence:[{method:t.method,strength:"exact",identity:t.identity,location:t.from.location}]})}function Ie(...e){return e.map(t=>encodeURIComponent(t)).join(":")}var ys=new Set(["control","data","state","temporal"]),At=new Set(["contains-control","contains-event","contains-lock-scope","contains-state-effect","contains-runtime-state-effect","contains","owns-parameter","owns-runtime-observation"]),lr=new Set(["discriminator-dispatch","result-callback","returns","runtime-handoff","throws"]);function cr(e,t={}){let n=new Map(e.nodes.map(x=>[x.id,x])),o=Cs(e.nodes,t.focusLocations),r=Ls(e.edges,t.focusLocations),a=Is(e.edges,r),i=new Set(e.paths.flatMap(x=>x.edgeIds)),s=we(e.anchors.filter(x=>x.status==="matched").flatMap(x=>x.nodeIds)),d=e.edges.filter(sr).filter(x=>hs(x,o,r,i)),c=d.filter(x=>xs(x,o,r,a,n,i)),u=ir(s,c,"forward"),f=vs(u,c),m=ir(f,c,"backward"),p=new Set([...u].filter(x=>m.has(x)));for(let x of s)p.add(x);let g=new Set(c.filter(x=>p.has(x.fromNodeId)&&p.has(x.toNodeId)).map(x=>x.id)),b=new Set(p),C=new Set(g);bs(d,b,C,o,r);let S=e.frontiers.filter(x=>Ns(x,b)),v=we(S.filter(x=>x.disposition==="unsupported").map(x=>x.id)),R=we(e.edges.filter(x=>!sr(x)&&ur(x)&&ws(x,b)).map(x=>x.id)),y=we(S.map(x=>x.id)),N=[];s.length===0&&N.push("No matched anchor node starts the corridor."),f.length===0&&N.push("No proved mechanical outcome is reachable from a matched anchor."),v.length>0&&N.push(`${v.length} unsupported frontier(s) touch the protected corridor.`),R.length>0&&N.push(`${R.length} candidate or unknown edge(s) touch the protected corridor.`);let L=N.length===0?"complete":"incomplete";return{schemaVersion:1,status:L,startNodeIds:s,outcomeNodeIds:f,baseNodeIds:we([...p]),baseEdgeIds:we([...g]),nodeIds:we([...b]),edgeIds:we([...C]),accountedFrontierIds:y,unresolvedFrontierIds:v,unresolvedEdgeIds:R,coverage:{protectedNodes:b.size,protectedEdges:C.size,baseNodes:p.size,baseEdges:g.size,accountedFrontiers:y.length,unresolvedFrontiers:v.length,unresolvedEdges:R.length},explanation:L==="complete"?"Every proved anchor-to-outcome path is closed over its material causal facts within reported coverage.":N.join(" ")}}function hs(e,t,n,o){return t===null||e.disposition==="emitted"||o.has(e.id)||n?.has(e.id)===!0?!0:(e.semantics??[]).some(r=>{if(r.family==="identity"&&At.has(r.subtype))return t.has(e.toNodeId);if(r.family==="contract")return t.has(e.fromNodeId)&&t.has(e.toNodeId);if(r.family==="state")return t.has(e.fromNodeId);if(r.family==="data"||r.family==="temporal")return t.has(e.fromNodeId)||t.has(e.toNodeId);if(r.family==="control"){if(pr(r))return t.has(e.fromNodeId);if(["returns","throws"].includes(r.subtype))return t.has(e.toNodeId);if(r.subtype==="completion-callback")return t.has(e.fromNodeId)||t.has(e.toNodeId)}return!1})}function bs(e,t,n,o,r){let a=!0;for(;a;){a=!1;for(let i of e)Ss(i,t,o,r)&&(n.has(i.id)||(n.add(i.id),a=!0),t.has(i.fromNodeId)||(t.add(i.fromNodeId),a=!0),t.has(i.toNodeId)||(t.add(i.toNodeId),a=!0))}}function Ss(e,t,n,o){let r=t.has(e.fromNodeId),a=t.has(e.toNodeId);return!r&&!a?!1:(e.semantics??[]).some(i=>i.family==="identity"?At.has(i.subtype)&&(a||n===null||n.has(e.toNodeId)):i.family==="contract"?!0:i.family==="state"?r&&(n===null||n.has(e.fromNodeId)):i.family==="temporal"?i.subtype==="lexical-successor"?r&&a:!0:i.family==="data"?a&&(r||n===null||n.has(e.fromNodeId)||o?.has(e.id)===!0):i.family==="control"?dr(i)||["returns","throws"].includes(i.subtype)&&!a&&n!==null&&!n.has(e.toNodeId)?!1:lr.has(i.subtype)||pr(i)||i.subtype==="completion-callback":!1)}function vs(e,t){let n=new Set,o=new Map,r=new Map;for(let a of t)!e.has(a.fromNodeId)||!e.has(a.toNodeId)||(o.set(a.fromNodeId,(o.get(a.fromNodeId)??0)+1),r.set(a.toNodeId,(r.get(a.toNodeId)??0)+1),(a.semantics??[]).some(i=>i.family==="state"||i.family==="control"&&lr.has(i.subtype))&&n.add(a.toNodeId));for(let a of e)(r.get(a)??0)>0&&(o.get(a)??0)===0&&n.add(a);return we([...n])}function ir(e,t,n){let o=new Map;for(let i of t){let s=n==="forward"?i.fromNodeId:i.toNodeId,l=n==="forward"?i.toNodeId:i.fromNodeId,d=o.get(s)??[];d.push(l),o.set(s,d)}let r=new Set(e),a=[...e];for(;a.length>0;){let i=a.shift();for(let s of o.get(i)??[])r.has(s)||(r.add(s),a.push(s))}return r}function xs(e,t,n,o,r,a){return(e.semantics??[]).some(i=>e.disposition==="emitted"||a.has(e.id)?!0:i.family==="identity"&&At.has(i.subtype)?t===null||t.has(e.toNodeId)||o?.has(e.toNodeId)===!0:!ys.has(i.family)||dr(i)?!1:i.family==="control"&&["returns","throws"].includes(i.subtype)&&t!==null?t.has(e.toNodeId):t===null?!0:i.family==="state"?t.has(e.fromNodeId):i.family==="data"?t.has(e.fromNodeId)||t.has(e.toNodeId)||n?.has(e.id)===!0:i.family==="temporal"?i.subtype==="lexical-successor"?t.has(e.fromNodeId)&&t.has(e.toNodeId):t.has(e.fromNodeId)||t.has(e.toNodeId):i.family==="control"?Es(e,r)&&(t.has(e.fromNodeId)||t.has(e.toNodeId)):!1)}function dr(e){return e.family==="control"&&["call","discriminator-dispatch","result-callback","runtime-handoff"].includes(e.subtype)}function Es(e,t){let n=t.get(e.fromNodeId),o=t.get(e.toNodeId);if(!n||!o)return!1;let r=ar(n,"ownerNodeId")??(n.kind==="symbol"?n.id:null),a=ar(o,"ownerNodeId")??(o.kind==="symbol"?o.id:null);return r!==null&&r===a}function Cs(e,t){if(!t)return null;let n=new Map;for(let o of t){let r=n.get(o.file)??[];r.push(o.line),n.set(o.file,r)}return new Set(e.filter(o=>{if(!o.location||o.kind==="parameter")return!1;let r=n.get(o.location.file)??[],a=o.location.endLine??o.location.line;return r.some(i=>i>=o.location.line&&i<=a)}).map(o=>o.id))}function Ls(e,t){if(!t)return null;let n=new Map;for(let o of t){let r=n.get(o.file)??[];r.push(o.line),n.set(o.file,r)}return new Set(e.filter(o=>o.evidence.some(r=>{if(!r.location)return!1;let a=n.get(r.location.file)??[],i=r.location.endLine??r.location.line;return a.some(s=>s>=r.location.line&&s<=i)})).map(o=>o.id))}function Is(e,t){return t===null?null:new Set(e.filter(n=>t.has(n.id)).flatMap(n=>[n.fromNodeId,n.toNodeId]))}function ar(e,t){let n=e.attributes[t];return typeof n=="string"?n:null}function sr(e){return e.disposition==="excluded"||e.disposition==="unsupported"||!ur(e)?!1:e.evidence.some(t=>t.strength==="exact"||t.strength==="derived")}function ur(e){return(e.semantics??[]).some(t=>t.family!=="identity"||At.has(t.subtype))}function pr(e){return e.subtype.startsWith("predicate-")||e.subtype.startsWith("loop-")||e.subtype.startsWith("exception-")||e.subtype.startsWith("finally-")||e.subtype.startsWith("handler-")}function ws(e,t){return t.has(e.fromNodeId)||t.has(e.toNodeId)}function Ns(e,t){return[...e.fromNodeIds,...e.memberNodeIds].some(n=>t.has(n))}function we(e){return[...new Set(e)].sort()}import{createHash as Ms}from"crypto";var kt=["identity","contract","control","data","state","temporal"],Rs=new Set(kt);function Dt(e){let t=We(e.anchors,"anchor"),n=We(e.nodes,"node"),o=We(e.edges,"edge"),r=We(e.paths??[],"path"),a=We(e.frontiers??[],"frontier"),i=new Set(t.map(m=>m.id)),s=new Set(n.map(m=>m.id)),l=new Set(o.map(m=>m.id)),d=e.routeCatalog?{...e.routeCatalog,routes:We(e.routeCatalog.routes,"route"),selectedRouteIds:ie(e.routeCatalog.selectedRouteIds)}:void 0;for(let m of t)ce(`anchor ${m.id}`,[...m.nodeIds,...m.candidateNodeIds],s,"node");for(let m of n)ce(`node ${m.id}`,m.anchorIds,i,"anchor");for(let m of o){if(ce(`edge ${m.id}`,[m.fromNodeId,m.toNodeId],s,"node"),m.evidence.length===0)throw new Error(`Exploration edge ${m.id} has no evidence source.`);Ps(m)}for(let m of r)ce(`path ${m.id}`,[m.fromAnchorId,m.toAnchorId],i,"anchor"),ce(`path ${m.id}`,m.nodeIds,s,"node"),ce(`path ${m.id}`,m.edgeIds,l,"edge");for(let m of a)if(ce(`frontier ${m.id}`,m.fromNodeIds,s,"node"),ce(`frontier ${m.id}`,m.edgeIds,l,"edge"),ce(`frontier ${m.id}`,m.memberNodeIds,s,"node"),m.memberCount!==m.memberNodeIds.length)throw new Error(`Exploration frontier ${m.id} reports ${m.memberCount} member(s) but identifies ${m.memberNodeIds.length}.`);for(let m of d?.routes??[])ce(`route ${m.id}`,m.nodeIds,s,"node"),ce(`route ${m.id}`,m.edgeIds,l,"edge"),ce(`route ${m.id}`,[m.anchorNodeId,m.endpointNodeId],s,"node");d&&ce("route catalog selection",d.selectedRouteIds,new Set(d.routes.map(m=>m.id)),"route");let c=ie(e.incompleteReasons??[]),u=c.length===0?"accounted":"incomplete",f=t.reduce((m,p)=>m+p.omittedCandidates,0);return{schemaVersion:1,anchors:t,nodes:n,edges:o,paths:r,frontiers:a,coverage:{status:u,scope:e.scope,nodes:xr(n),edges:xr(o),matchedAnchors:t.filter(m=>m.status==="matched").length,ambiguousAnchors:t.filter(m=>m.status==="ambiguous").length,missingAnchors:t.filter(m=>m.status==="missing").length,omittedCandidates:f,frontierGroups:a.length,programEdges:Fs(o),blindSpots:ie(e.blindSpots??[]),explanation:u==="accounted"?"Every node and edge discovered within the declared query scope is emitted, folded with recoverable identity, explicitly excluded, or reported unsupported.":`The declared query scope is not fully accounted for: ${c.join("; ")}`},completion:$s(u,r,e.scope),...d?{routeCatalog:d}:{}}}function Ts(e){return e.flatMap(t=>As(t.semantics??[]).map(n=>({id:ks(t.id,n),sourceEdgeId:t.id,sourceKind:t.kind,fromNodeId:t.fromNodeId,toNodeId:t.toNodeId,directed:!0,disposition:t.disposition,evidence:[...t.evidence],family:n.family,subtype:n.subtype,...n.context?{context:{...n.context}}:{},...n.attributes?{attributes:{...n.attributes}}:{}}))).sort((t,n)=>t.id.localeCompare(n.id))}function Fs(e){let t=Ts(e),n=new Set(t.map(i=>i.sourceEdgeId)),o=new Map(kt.map(i=>[i,new Set])),r=new Map(kt.map(i=>[i,new Set])),a=new Map(kt.map(i=>[i,0]));for(let i of t)o.get(i.family).add(i.sourceEdgeId),r.get(i.family).add(i.subtype),a.set(i.family,a.get(i.family)+1);return{sourceEdges:e.length,mappedSourceEdges:n.size,projectedEdges:t.length,unmappedSourceEdges:e.length-n.size,unsupportedSourceEdges:e.filter(i=>i.disposition==="unsupported").length,unmappedKinds:ie(e.filter(i=>!n.has(i.id)).map(i=>i.kind)),families:{identity:Ue("identity",o,a,r),contract:Ue("contract",o,a,r),control:Ue("control",o,a,r),data:Ue("data",o,a,r),state:Ue("state",o,a,r),temporal:Ue("temporal",o,a,r)}}}function Ue(e,t,n,o){return{sourceEdges:t.get(e)?.size??0,projectedEdges:n.get(e)??0,subtypes:[...o.get(e)??[]].sort()}}function Ps(e){let t=new Set;for(let n of e.semantics??[]){if(!Rs.has(n.family))throw new Error(`Exploration edge ${e.id} has unknown program edge family: ${n.family}.`);if(n.subtype.trim().length===0)throw new Error(`Exploration edge ${e.id} has an empty program edge subtype.`);let o=En(n);if(t.has(o))throw new Error(`Exploration edge ${e.id} repeats program edge semantic ${o}.`);t.add(o)}}function As(e){return[...e].sort((t,n)=>En(t).localeCompare(En(n)))}function En(e){return`${e.family}:${e.subtype}`}function ks(e,t){return`program:${encodeURIComponent(e)}:${t.family}:${encodeURIComponent(t.subtype)}`}function $s(e,t,n){return e==="incomplete"||t.some(o=>o.status!=="connected")?{status:"coverage-incomplete",scope:n,explanation:"The declared graph query has an ambiguous, missing, candidate-only, or disconnected anchor relationship."}:t.length>0?{status:"connector-complete",scope:n,explanation:"Every requested anchor pair has a selected path supported by proved repository relationships."}:{status:"frontier-accounted",scope:n,explanation:"Every discovered direction in the declared graph query is emitted or represented by an exact frontier."}}function Er(e,t={}){let n=t.maxSelectedNodes??24;if(!Number.isSafeInteger(n)||n<=0)throw new RangeError(`maxSelectedNodes must be a positive safe integer; received ${n}`);let o=new Set(e.anchors.flatMap(h=>[...h.nodeIds,...h.candidateNodeIds])),r=[],a=e.anchors.filter(h=>h.status!=="missing"&&h.nodeIds.length+h.candidateNodeIds.length>0);for(let h=0;h<a.length;h+=1)for(let P=h+1;P<a.length;P+=1){let D=a[h],O=a[P],w=hr(e,D,O,!1),I=w??hr(e,D,O,!0);I?(I.nodeIds.forEach(_=>o.add(_)),r.push({id:$t("path",D.id,O.id),fromAnchorId:D.id,toAnchorId:O.id,status:!w||D.status==="ambiguous"||O.status==="ambiguous"?"candidate":"connected",nodeIds:I.nodeIds,edgeIds:I.edgeIds})):r.push({id:$t("path",D.id,O.id),fromAnchorId:D.id,toAnchorId:O.id,status:"partial",nodeIds:[],edgeIds:[]})}let i=ie(t.routeIds??[]),s=Ds(e,i),l=new Set(s.routes.map(h=>h.id)),d=i.filter(h=>!l.has(h));if(d.length>0)throw new Error(`Unknown exploration route id(s): ${d.join(", ")}`);let u=s.routes.filter(h=>i.includes(h.id)).map(h=>({anchorNodeId:h.anchorNodeId,endpointNodeId:h.endpointNodeId,endpointKind:h.endpointKind,endpointPriority:2,nodeIds:[...h.nodeIds].reverse(),edgeIds:[...h.edgeIds].reverse()}));for(let h of u)h.nodeIds.forEach(P=>o.add(P));let f=r.length===0||r.some(h=>h.edgeIds.length>0);f&&Sr(e,o,n);let m=vr(e,o),p=new Set(t.expandedFrontierIds??[]),g=new Set(m.map(h=>h.id)),b=[...p].filter(h=>!g.has(h)).sort();if(b.length>0)throw new Error(`Unknown exploration frontier id(s): ${b.join(", ")}`);for(let h of m)p.has(h.id)&&h.memberNodeIds.forEach(P=>o.add(P));f&&Sr(e,o,n);let C=new Map(u.map(h=>[h.endpointNodeId,h.endpointKind])),S=new Set(u.flatMap(h=>h.nodeIds)),v=new Map;for(let h of u)for(let P=0;P<h.nodeIds.length;P+=1){let D=h.nodeIds[P],O=P;v.set(D,Math.max(v.get(D)??0,O))}let R=e.nodes.map(h=>{let P=C.get(h.id),D=S.has(h.id)?{upstreamCausalPath:!0,upstreamCausalDistance:v.get(h.id)??0,...P?{upstreamCausalEndpoint:P}:{}}:{};return{...h,attributes:{...h.attributes,...D},disposition:h.disposition==="excluded"||h.disposition==="unsupported"?h.disposition:o.has(h.id)?"emitted":"folded"}}),y=new Set([...r.flatMap(h=>h.edgeIds),...u.flatMap(h=>h.edgeIds)]),N=e.edges.map(h=>({...h,disposition:h.disposition==="excluded"||h.disposition==="unsupported"?h.disposition:y.has(h.id)||o.has(h.fromNodeId)&&o.has(h.toNodeId)?"emitted":"folded"})),L=Dt({anchors:e.anchors,nodes:R,edges:N,paths:r,frontiers:[...e.frontiers.filter(h=>h.disposition!=="folded"),...vr({...e,nodes:R,edges:N},o)],scope:e.coverage.scope,blindSpots:e.coverage.blindSpots,incompleteReasons:e.coverage.status==="incomplete"?[e.coverage.explanation]:[],routeCatalog:s}),x=new Set(L.frontiers.flatMap(h=>h.edgeIds)),M=L.edges.filter(h=>h.disposition==="folded"&&!x.has(h.id)).map(h=>h.id);if(M.length>0)throw new Error(`Folded exploration edge(s) are not frontier-accounted: ${M.sort().join(", ")}`);return L}var mr=10;function Ds(e,t=[]){let n=new Map(e.nodes.map(b=>[b.id,b])),o=new Map(e.edges.map(b=>[b.id,b])),r=new Map;for(let b of e.edges){if(!_s(b))continue;let C=r.get(b.toNodeId)??[];C.push(b),r.set(b.toNodeId,C)}for(let b of r.values())b.sort((C,S)=>Number(st(S))-Number(st(C))||yr(S)-yr(C)||C.fromNodeId.localeCompare(S.fromNodeId)||C.id.localeCompare(S.id));let a=ie(e.anchors.filter(b=>b.status==="matched").flatMap(b=>b.nodeIds)),i=new Map,s=new Set,l=(b,C,S)=>{let v=C.nodeIds[C.nodeIds.length-1],R=n.get(v),y=n.get(b);if(!R?.location||!y)return;let N=[...C.nodeIds].reverse(),L=[...C.edgeIds].reverse(),x=new Set(N),M=L.flatMap(w=>{let T=o.get(w);return T?[T]:[]}),h=e.edges.filter(w=>w.disposition!=="excluded"&&w.disposition!=="unsupported"&&(x.has(w.fromNodeId)||x.has(w.toNodeId))),P={id:$t("route",b,v,S,...L),status:"proved",anchorNodeId:b,anchorLabel:y.label,endpointNodeId:v,endpointLabel:R.label,endpointLocation:{...R.location},endpointKind:S,nodeIds:N,edgeIds:L,evidenceStrengths:ie(M.flatMap(w=>w.evidence.map(T=>T.strength))),spineEdgeFamilies:fr(M,!0),relatedEdgeFamilies:fr(h,!1),crossesRuntimeBoundary:M.some(st)},D=`${b}\0${v}\0${S}`,O=i.get(D);(!O||gr(P,O)<0)&&i.set(D,P)};for(let b of a){n.get(b)?.attributes.publicEntry===!0&&l(b,{nodeIds:[b],edgeIds:[]},"public-entry");let C=[{nodeIds:[b],edgeIds:[]}],S=new Map([[b,0]]);for(let v=0;v<C.length;v+=1){let R=C[v],y=R.nodeIds[R.nodeIds.length-1];R.edgeIds.length>0&&n.get(y)?.location&&n.get(y)?.attributes.publicEntry===!0&&l(b,R,"public-entry");let N=r.get(y)??[];if(R.edgeIds.length>=mr){N.some(L=>!R.nodeIds.includes(L.fromNodeId))&&s.add(b);continue}for(let L of N){if(R.nodeIds.includes(L.fromNodeId))continue;let x=R.edgeIds.length+1,M=S.get(L.fromNodeId);if(M!==void 0&&M<=x)continue;let h={nodeIds:[...R.nodeIds,L.fromNodeId],edgeIds:[...R.edgeIds,L.id]};if(S.set(L.fromNodeId,x),st(L)&&n.get(L.fromNodeId)?.location){l(b,h,"runtime-boundary");continue}C.push(h)}}}let d=[...i.values()].sort(gr),c=new Set(d.map(b=>b.id)),u=ie(t.filter(b=>c.has(b))),f=ie(d.map(b=>b.anchorNodeId)),m=a.filter(b=>!f.includes(b)),p=[...s].sort(),g=e.coverage.status==="accounted"&&p.length===0?"accounted":"incomplete";return{schemaVersion:1,routes:d,selectedRouteIds:u,coverage:{status:g,scope:"Distinct proved public-entry and runtime-boundary endpoints reachable upstream in the supplied topology.",enumeration:"one-shortest-proved-path-per-endpoint",maximumDepth:mr,anchorNodeIds:a,anchorsWithRoutes:f,anchorsWithoutRoutes:m,depthLimitedAnchorNodeIds:p,routeCount:d.length,explanation:g==="accounted"?"Every distinct proved upstream public/runtime endpoint in the supplied topology has one stable shortest route.":"Route enumeration is incomplete because the supplied topology has incomplete coverage or a traversal reached the route-depth bound."}}}function fr(e,t){let n=e.flatMap(o=>o.semantics?.map(r=>r.family)??[]);return t&&e.length>0&&n.length===0&&n.push("control"),ie(n)}function gr(e,t){return e.anchorNodeId.localeCompare(t.anchorNodeId)||e.edgeIds.length-t.edgeIds.length||e.endpointKind.localeCompare(t.endpointKind)||e.endpointNodeId.localeCompare(t.endpointNodeId)||e.id.localeCompare(t.id)}function _s(e){return e.disposition!=="excluded"&&e.disposition!=="unsupported"&&Bs(e)&&e.evidence.some(t=>["exact","derived","mixed"].includes(t.strength))}function Bs(e){return st(e)||e.kind==="boundary-observation"||e.kind==="call"||e.kind==="compiler:call"}function st(e){return e.kind==="runtime-boundary"||e.kind.startsWith("runtime:")}function yr(e){let t={exact:5,derived:4,mixed:3,candidate:1,unknown:0};return Math.max(0,...e.evidence.map(n=>t[n.strength]))}function hr(e,t,n,o){return br(e,t,n,o)??br(e,n,t,o)}function br(e,t,n,o){let r=[...t.nodeIds,...t.candidateNodeIds].sort(),a=new Set([...n.nodeIds,...n.candidateNodeIds]);if(r.some(c=>a.has(c)))return{nodeIds:[r.find(u=>a.has(u))],edgeIds:[]};let i=new Set(e.nodes.filter(c=>c.kind==="structural-region").map(c=>c.id)),s=new Map;for(let c of e.edges)c.disposition==="excluded"||c.disposition==="unsupported"||c.kind==="structural-membership"||i.has(c.fromNodeId)||i.has(c.toNodeId)||c.evidence.every(f=>["candidate","unknown"].includes(f.strength))&&!o||Os(s,c.fromNodeId,c.toNodeId,c.id);for(let c of s.values())c.sort((u,f)=>u.nodeId.localeCompare(f.nodeId)||u.edgeId.localeCompare(f.edgeId));let l=r.map(c=>({nodeId:c,nodeIds:[c],edgeIds:[]})),d=new Set(r);for(let c=0;c<l.length;c+=1){let u=l[c];for(let f of s.get(u.nodeId)??[]){if(d.has(f.nodeId))continue;let m={nodeId:f.nodeId,nodeIds:[...u.nodeIds,f.nodeId],edgeIds:[...u.edgeIds,f.edgeId]};if(a.has(f.nodeId))return m;d.add(f.nodeId),l.push(m)}}return null}function Os(e,t,n,o){let r=e.get(t)??[];r.push({nodeId:n,edgeId:o}),e.set(t,r)}function Gs(e,t,n){let o=new Map;for(let s of e.edges){let l=o.get(s.fromNodeId)??{incoming:0,outgoing:0},d=o.get(s.toNodeId)??{incoming:0,outgoing:0};l.outgoing+=1,d.incoming+=1,o.set(s.fromNodeId,l),o.set(s.toNodeId,d)}let r=new Set,a=new Map;for(let s of e.edges){let l=t.has(s.fromNodeId),d=t.has(s.toNodeId);if(l===d)continue;let c=l?s.toNodeId:s.fromNodeId,u=l?s.fromNodeId:s.toNodeId,f=e.nodes.find(g=>g.id===c);if(f?.kind==="structural-region")continue;let m=a.get(c)??new Set;m.add(u),a.set(c,m),(/(?:runtime-boundary|external)/u.test(s.kind)||f&&/(?:frontier|external)/u.test(f.kind))&&r.add(c)}let i=[...a].filter(([s,l])=>{if(r.has(s))return!0;let d=o.get(s)??{incoming:0,outgoing:0};return(d.incoming>1||d.outgoing>1)&&l.size>1}).sort(([s,l],[d,c])=>Number(r.has(d))-Number(r.has(s))||c.size-l.size||s.localeCompare(d)).map(([s])=>s);for(let s of i){if(t.size>=n)break;t.add(s)}}function Sr(e,t,n){let o=-1;for(;t.size!==o&&t.size<n;)o=t.size,Gs(e,t,n)}function vr(e,t){let n=new Set(e.nodes.filter(i=>!t.has(i.id)&&i.disposition!=="excluded"&&i.disposition!=="unsupported").map(i=>i.id)),o=new Map;for(let i of e.edges){if(!n.has(i.fromNodeId)||!n.has(i.toNodeId))continue;let s=o.get(i.fromNodeId)??new Set,l=o.get(i.toNodeId)??new Set;s.add(i.toNodeId),l.add(i.fromNodeId),o.set(i.fromNodeId,s),o.set(i.toNodeId,l)}let r=[],a=new Set;for(let i of[...n].sort()){if(a.has(i))continue;let s=[],l=[i];a.add(i);for(let d=0;d<l.length;d+=1){let c=l[d];s.push(c);for(let u of[...o.get(c)??[]].sort())a.has(u)||(a.add(u),l.push(u))}r.push(s.sort())}return r.map(i=>{let s=new Set(i),l=e.edges.filter(p=>s.has(p.fromNodeId)||s.has(p.toNodeId)),d=l.filter(p=>s.has(p.fromNodeId)!==s.has(p.toNodeId)),c=ie(d.map(p=>s.has(p.fromNodeId)?p.toNodeId:p.fromNodeId)),u=new Set(d.map(p=>s.has(p.toNodeId)?"outgoing":"incoming")),f=ie(l.map(p=>p.id)),m=ie(d.map(p=>p.kind));return{id:$t("frontier",...i,...f),kind:m.join("+")||"disconnected",direction:u.size===1?[...u][0]:"undirected",fromNodeIds:c,edgeIds:f,memberNodeIds:i,memberCount:i.length,disposition:"folded",reason:d.length>0?"Connected evidence is folded beyond the first edge leaving the selected connector graph.":"Discovered evidence is disconnected from every selected anchor connector under the declared relation scope.",expansion:null}})}function $t(e,...t){let n=Ms("sha256").update(t.join("\0")).digest("hex").slice(0,16);return`${e}:${n}`}function We(e,t){let n=[...e].sort((o,r)=>o.id.localeCompare(r.id));for(let o=1;o<n.length;o+=1)if(n[o-1].id===n[o].id)throw new Error(`Duplicate exploration ${t} id: ${n[o].id}`);return n}function ce(e,t,n,o){let r=ie(t.filter(a=>!n.has(a)));if(r.length>0)throw new Error(`Exploration ${e} references missing ${o}(s): ${r.join(", ")}`)}function xr(e){return{total:e.length,emitted:e.filter(t=>t.disposition==="emitted").length,folded:e.filter(t=>t.disposition==="folded").length,excluded:e.filter(t=>t.disposition==="excluded").length,unsupported:e.filter(t=>t.disposition==="unsupported").length}}function ie(e){return[...new Set(e)].sort()}var js=5,Ks=12,qs=8,zs=3,Cr=8,Us=6,Ws=12,Lr=12,Hs=12,Vs=2,Qs=new Set(["branch","loop","call","await","return","throw","mutation","catch","finally"]),Ys=9e3,Ir=Ao,wr=new WeakMap;function Dr(e,t){return sl(e,t,"topology")}function Xs(e,t,n,o,r,a=!1){let i=e.get(t);if(i)return i.depth=Math.min(i.depth,n),i.primary||=r,i.promoteBoundaryImports||=a,i.origins.add(o),i;let s={file:t,depth:n,primary:r,promoteBoundaryImports:a,origins:new Set([o]),processed:!1};return e.set(t,s),s}function Zs(e,t,n,o,r,a,i="none",s=!1){let l=e.get(n.symbol);if(l)return l.depth=Math.min(l.depth,o),l.origins.add(r),a&&l.anchorQueries.add(a),l.referenceScope=Xl(l.referenceScope,i),t(n.relativePath,o,r,!0,s),l;let d={definition:n,depth:o,origins:new Set([r]),anchorQueries:new Set(a?[a]:[]),referenceScope:i,processed:!1};return e.set(n.symbol,d),t(n.relativePath,o,r,!0,s),d}function Js(e,t,n,o,r,a,i=!1,s=!0){let l=Se(n),d=e.get(l);if(d)return d.depth=Math.min(d.depth,o),d.origins.add(r),a&&d.anchorQueries.add(a),d.reverseCallExpansion||=i,d.traversalEligible||=s,t(n.file,o,r,d.traversalEligible,!0),d;let c={...n,depth:o,origins:new Set([r]),anchorQueries:new Set(a?[a]:[]),reverseCallExpansion:i,traversalEligible:s};return e.set(l,c),t(n.file,o,r,s,!0),c}function el(e){let{db:t,index:n,pendingRelations:o,addFile:r,addSymbol:a,addSourceConstruct:i,observation:s,depth:l,origin:d}=e;r(s.source.file,l,d,!0,!0),s.owner.file!==s.source.file&&r(s.owner.file,l,`${d}:owner`,!0,!0);let c=X(t,s.owner.file),u=s.owner.symbol?Te(t,n,s.owner.symbol).matches.find(p=>p.relativePath===s.owner.file):null,f=(u&&!re(u.symbol)?u:null)??Ge(c,s.source.startLine);if(f&&!re(f.symbol))return a(f,l,d,void 0,"none",!0),f.symbol;s.owner.name&&i({file:s.owner.file,name:s.owner.name,startLine:s.owner.startLine,endLine:s.owner.endLine},l,`${d}:source-owner`,void 0,!0);let m=e.index.definitionsForFile(s.source.file).filter(p=>!!p.leaf&&Ee(t,s.source.file,p.leaf).some(g=>g>=s.source.startLine&&g<=s.source.endLine));if(m.length===1){let p=m[0];a(p,l,`${d}:handler-identifier`,void 0,"none",!0),pe(o,{kind:"runtime-boundary",evidence:"runtime-boundary:handler-identifier",fromFile:s.source.file,fromSymbol:null,toFile:p.relativePath,toSymbol:p.symbol,fromBoundaryParticipant:Ve(s),line:s.source.startLine,strength:"derived"})}return null}function tl(e){let t=0,n=0,o=0;for(let r of e.searches){let a=kl(e.db,e.index,r,e.boundaryObservationLocations),i=a.filter(c=>Ol(c,e.sourceAllowed)),s=!e.opts.fullLiteralTraversal&&(a.length>Ks||i.length>qs),l=s?[]:a,d=new Set((s?[]:e.opts.fullLiteralTraversal?i:[...i].sort($l).slice(0,zs)).map(Fr));s&&(n+=1,o+=a.length);for(let c of l){let u=d.has(Fr(c)),f=u&&!c.ownerSymbol&&c.ownerStartLine!==null&&c.ownerEndLine!==null;if(e.addFile(c.relativePath,0,`${u?"literal-anchor":"literal-match"}:${r}`,f,f),f&&e.addSourceConstruct({file:c.relativePath,name:c.ownerShortName??`${c.relativePath}:${c.ownerStartLine+1}`,startLine:c.ownerStartLine,endLine:c.ownerEndLine},0,`literal-source-owner:${r}`,r,!0),u&&c.ownerSymbol){let m=Te(e.db,e.index,c.ownerSymbol).matches[0];m&&!re(m.symbol)&&e.addSymbol(m,0,"literal-owner",r,"all",!0)}e.literalHits.push({query:r,file:c.relativePath,line:c.line,ownerSymbol:c.ownerSymbol,ownerShortName:c.ownerShortName,ownerStartLine:c.ownerStartLine,ownerEndLine:c.ownerEndLine,sourceLine:c.sourceLine.trim(),matchKind:c.matchKind,traversalSeed:u})}e.anchors.push({kind:"literal",query:r,status:a.length>0?"matched":"missing",matchedRegionIds:[],matchingLines:a.length,seedMatchingLines:s?0:d.size,matchOnlyLines:a.length-d.size,eligibleSeedMatchingLines:i.length,materializedMatchingLines:l.length,withheldMatchingLines:s?a.length:0,literalTraversal:s?"withheld-broad":"materialized",representativeMatches:s?Gl(r,a):void 0,narrowingCommands:s?Kl(r,a):void 0,exhaustiveTraversalCommand:s||d.size<i.length?`scip-query system-map --search ${V(r)} --full-literal-traversal`:void 0,seedRegionIds:[],matchOnlyRegionIds:[]})}for(let r of e.symbolQueries){let a=Te(e.db,e.index,r);t+=a.omitted;let i=Dl(e.db,r),s=a.matches.filter(f=>!re(f.symbol)),l=i!==null&&s.length===0;l&&e.addSourceConstruct(i,0,"source-construct-anchor",r,!0);let d=l?s:a.matches;for(let f of d)e.addSymbol(f,0,"symbol-anchor",r,"all",!0);let c=l?_l(i):null,u=l?1:a.total;e.anchors.push({kind:"symbol",query:r,status:u===0?"missing":u===1?"matched":"ambiguous",matchedRegionIds:[],symbolCandidates:[...c?[c]:[],...d.map(Hl)],totalSymbolCandidates:u,omittedSymbolCandidates:a.omitted})}return{omittedSymbolCandidates:t,broadLiteralAnchors:n,withheldLiteralMatches:o}}function nl(e){let{db:t,opts:n,mode:o,searches:r,symbolQueries:a,maxDepth:i,maxTopologyCharacters:s,requestedRelationKinds:l,evidenceFloor:d,includedSourceScopes:c,workspaces:u,runtimeBoundaries:f,boundaryObservations:m,representedBoundaryLinkIds:p,files:g,symbols:b,sourceConstructs:C,literalHits:S,pendingRelations:v,externalImports:R,anchors:y,omittedSymbolCandidates:N,broadLiteralAnchors:L,withheldLiteralMatches:x,filteredUnverifiedCallEdges:M,memberCallCandidateEdges:h,unresolvedMemberCallsites:P,sourceAllowed:D}=e,O=new Set(l),w=new Map;for(let F of g.keys())w.set(F,lt(F,u));let T=[...v.values()].filter(F=>w.has(F.fromFile)&&w.has(F.toFile)).map(F=>({...F,fromRegionId:w.get(F.fromFile).id,toRegionId:w.get(F.toFile).id})).sort(Gr),I=ac(T),_=new Set(n.expand??[]),A=nc(g,b,S,T,I,w,_),j=new Set([...g.values()].filter(F=>[...F.origins].some(K=>K.startsWith("literal-anchor:")||K==="literal-owner"||K==="symbol-anchor")).map(F=>w.get(F.file).id)),$=Fl(A),B=new Set(A.map(F=>F.id)),U=[..._].filter(F=>!B.has(F)).sort();for(let F of y)if(F.matchedRegionIds=lc(F,S,b,w),F.kind==="literal"){let K=S.filter(Z=>Z.query===F.query);F.seedRegionIds=z(K.filter(Z=>Z.traversalSeed).map(Z=>w.get(Z.file).id)),F.matchOnlyRegionIds=z(K.filter(Z=>!Z.traversalSeed).map(Z=>w.get(Z.file).id))}let q=[...b.values()].filter(F=>!F.processed).length,se=[...g.values()].filter(F=>F.primary&&!F.processed).length,Ne=[...g.values()].filter(F=>!F.primary&&!F.processed).length,Oe=[...b.values()].filter(F=>F.processed),ve=(f?.frontiers??[]).flatMap(F=>{let K=m.get(F.observationId);return!K&&F.source&&F.action&&F.strength?!O.has("runtime-boundary")||!D(F.source.file)||d==="exact"||!g.has(F.source.file)?[]:[{observationId:F.observationId,action:F.action,strength:F.strength,file:F.source.file,line:F.source.startLine,ownerShortName:F.ownerShortName??null,address:F.address??F.missingKeyParts.join(", "),reason:F.reason}]:!O.has("runtime-boundary")||!K||!D(K.source.file)||d==="exact"&&K.strength!=="exact"||!g.has(K.source.file)?[]:[{observationId:K.id,action:K.action,strength:K.strength,file:K.source.file,line:K.source.startLine,ownerShortName:K.owner.name,address:Or(K),reason:F.reason,protocol:K.protocol,role:K.role,modality:K.modality,resolution:K.resolution,sourceScope:K.sourceScope,keyParts:K.keyParts.map(Z=>({name:Z.name,value:Z.value,evidence:Z.evidence}))}]}).sort((F,K)=>F.file.localeCompare(K.file)||F.line-K.line),E=(f?.links??[]).filter(F=>{if(!O.has("runtime-boundary")||d==="exact"&&F.strength!=="exact")return!1;let K=m.get(F.from),Z=m.get(F.to);return!!(K&&Z&&D(K.source.file)&&D(Z.source.file)&&(g.has(K.source.file)||g.has(Z.source.file)))}),k=E.filter(F=>F.strength==="exact").length,G=E.filter(F=>F.strength==="derived").length,H=E.filter(F=>F.strength==="candidate").length,me=f?.links.filter(F=>F.strength==="exact").length??0,Fe=f?.links.filter(F=>F.strength==="derived").length??0,Qe=f?.links.filter(F=>F.strength==="candidate").length??0,jt=sc(R,w),Kt=N===0?"accounted":"incomplete",Tn=[...L>0?[`${L} broad literal anchor(s) withheld ${x} exact match(es) before graph traversal; representative identities and scoped search commands preserve recovery without treating every textual occurrence as relevant.`]:[],`Literal matches outside the included source scopes (${c.join(", ")}) remain visible as match-only evidence and do not seed traversal.`,f?"Built-in runtime-boundary extractors traverse direct and replayably derived links; heuristic candidates, unsupported frameworks, reflection, generated names, and dependency wiring not recoverable from compiler occurrences or constructor assignments remain disclosed frontiers.":"Runtime-boundary evidence is unavailable for this index; run scip-query reindex with this build to extract supported HTTP, event, registry, and persistence observations.","Reverse references do not recursively expand from discovered callers or callees.","Member calls use compiler occurrences, exact constructor-assigned fields, bounded unique service providers, direct factory-return members, and compiler-resolved object-literal callbacks when available. Ambiguous providers remain candidate frontiers; callback values routed through mutation, reflection, or unsupported dependency containers remain unrepresented.","Literal traversal is bounded to the smallest parser-delimited source construct; parser gaps may reduce an owner to one source line and leave its continuation untraversed.","Schema consumers stay within forward-flow regions; cross-workspace contracts may discover consumers in other workspaces. Add an explicit symbol anchor to widen either scope.",`Traversal stops after depth ${i}; nonzero frontier counts identify evidence that was discovered but not traversed.`,"Region labels are structural path groupings, not inferred runtime or architectural boundaries."],fe=vl({db:t,anchors:y,regions:A,symbolStates:b,sourceConstructStates:C,literalHits:S,relations:T,externalBoundaries:jt,boundaryFrontiers:ve,regionForFile:w,closureStatus:Kt,omittedSymbolCandidates:N,maxDepth:i,requestedRelationKinds:l,evidenceFloor:d,includedSourceScopes:c,blindSpots:Tn,topologyFrontiers:n.topologyFrontiers??[],routeIds:n.routeIds??[],expandedRegionIds:[..._],maxTopologyCharacters:s,fullLiteralTraversal:n.fullLiteralTraversal??!1});if(o==="topology")return fe;let Fn=(n.behaviorFocusLocations?.length??0)>0?new Set([...fe.anchors.flatMap(F=>F.nodeIds),...fe.paths.flatMap(F=>F.nodeIds)]).size:void 0,ct=Eo(t,fe,{focusLocations:n.behaviorFocusLocations,...Fn?{maxSteps:Fn}:{}});Ro(t,fe,ct);let Hr=ll(t,fe,ct,n.behaviorFocusLocations??[]);fe.corridor=cr(fe,{focusLocations:Hr});let Pn=Mo(t,fe,ct,{sourceAllowed:D,selectionTerms:n.selectionTerms}),An=Il(fe),Vr=Rl(r,a,i,l,d,c,n.fullLiteralTraversal??!1,s,A,I,j,_,An),Qr=Ml(r,a,i,A.filter(F=>An.has(F.id)),j,l,d,c,n.fullLiteralTraversal??!1,s);return{anchors:y,regions:A,regionRelations:I,externalBoundaries:jt,boundaryFrontiers:ve,unmatchedExpansions:U,expansion:Qr,drilldown:$,presentation:Vr,topology:fe,behavior:ct,nextAnchors:Pn,closure:{status:Kt,emitted:{regions:A.length,relations:T.length,runtimeLinks:p.size},withheld:{symbols:q,files:se+Ne,regions:fe.nodes.filter(F=>F.kind==="structural-region"&&F.disposition==="folded").length,drillAnchors:($?.omittedAnchors??0)+Pn.omittedAnchors,literalMatches:x},ambiguous:{anchors:y.filter(F=>F.status==="ambiguous").length,omittedSymbolCandidates:N},external:jt.length,unresolved:ve.length,explanation:Kt==="accounted"?"Every fact reached under the declared anchors, relations, depth, evidence floor, source scopes, and installed analyzers is accounted for as emitted, withheld, ambiguous, external, or unresolved.":"Some ambiguous symbol candidates were not identified, so the declared query is not fully accounted for."},coverage:{explicitAnchorCount:y.length,requestedRelationKinds:l,evidenceFloor:d,includedSourceScopes:c,matchedAnchorCount:y.filter(F=>F.status!=="missing").length,literalSearchesComplete:!0,broadLiteralAnchors:L,withheldLiteralMatches:x,symbolCandidateSetsComplete:N===0,omittedSymbolCandidates:N,maxTraversalDepth:i,frontierSymbols:q,frontierFiles:se,supportFilesNotTraversed:Ne,filteredUnverifiedCallEdges:M,memberCallCandidateEdges:h,unresolvedMemberCallsites:P,runtimeBoundaryEvidenceAvailable:f!==null,runtimeBoundaryObservations:f?.observations.length??0,runtimeBoundaryExactLinks:k,runtimeBoundaryDerivedLinks:G,runtimeBoundaryCandidateLinks:H,repositoryRuntimeBoundaryExactLinks:me,repositoryRuntimeBoundaryDerivedLinks:Fe,repositoryRuntimeBoundaryCandidateLinks:Qe,runtimeBoundaryTraversedLinks:p.size,runtimeBoundaryFrontiers:ve.length,referenceExpansionEligibleSymbols:Oe.filter(F=>F.referenceScope!=="none").length,referenceExpansionSkippedSymbols:Oe.filter(F=>F.referenceScope==="none").length,dynamicDispatchRepresented:f?.links.some(F=>F.joinRule==="carrier.discriminator"&&p.has(F.id))??!1,runtimeGeneratedLinksRepresented:f!==null,regionBoundariesAreStructural:!0,relationFamilies:{"literal-anchor":{evidence:"exact-source",scope:"all indexed documents for each explicit literal",completeWithinScope:!0},reference:{evidence:"compiler-graph",scope:"all cross-file indexed/source-attributed sites for explicit anchors and promoted non-module boundary symbols",completeWithinScope:!0},call:{evidence:"mixed",scope:"static callees plus exact SCIP call occurrences in traversed source ranges, exact constructor-assigned member receivers, and uniquely attributed direct-import member candidates",completeWithinScope:!0},"contract-symbol":{evidence:"compiler-graph",scope:"compiler-resolved symbol identities referenced across inferred workspace boundaries",completeWithinScope:!0},import:{evidence:"compiler-graph",scope:"all indexed or source-resolved imports of traversed primary files",completeWithinScope:!0},"runtime-boundary":{evidence:"exact-source",scope:"direct and mechanically derived links produced by grounded runtime adapters and factorized relation groups",completeWithinScope:!0}},blindSpots:Tn}}}function ol(e,t){let{db:n,relationPolicy:o,sourceConstructs:r,reverseExpandedSourceConstructs:a,pendingRelations:i,reverseFileGraph:s,serviceCallerFilesBySourceConstruct:l,sourceAllowed:d,memberCallTargetsForWholeFile:c,addSymbol:u,addSourceConstruct:f}=e;if(o.has("call")){let m=[...r.values()].filter(p=>p.traversalEligible&&p.reverseCallExpansion&&p.depth<=t&&!a.has(Se(p)));for(let p of m){a.add(Se(p));let g=J(n,p.file);if((g?.callables??[]).filter(S=>S.name===p.name&&S.startLine<=p.endLine&&S.endLine>=p.startLine).length===1){let S=(g?.callSites??[]).filter(v=>v.calleeLeaf===p.name&&!v.memberAccess);for(let v of S){let R=t+1,y=Ge(X(n,p.file),v.line),N=null,L=null;if(y&&!re(y.symbol)){if(y.relativePath===p.file&&y.startLine<=p.endLine&&y.endLine>=p.startLine)continue;u(y,R,"reverse-local-call-owner",void 0,"forward-regions",!0),N=y.symbol}else{let x=Cn(n,p.file,v.line);x&&Se(x)!==Se(p)&&(L=f(x,R,"reverse-local-call-source-owner",void 0,!0))}!N&&!L||pe(i,{kind:"call",evidence:"ast-callsite",fromFile:p.file,fromSymbol:N,toFile:p.file,toSymbol:null,fromSourceConstruct:L?ae(L):void 0,toSourceConstruct:ae(p),line:v.line,strength:"derived"})}}let C=new Set([...s.get(p.file)??[],...l.get(Se(p))??[],...so(n,p.file).flatMap(S=>[...s.get(S)??[]])]);for(let S of C){if(!d(S))continue;let R=c(S).targets.filter(y=>y.targetFile===p.file&&y.targetStartLine<=p.endLine&&y.targetEndLine>=p.startLine);for(let y of R){let N=t+1,L=Ge(X(n,S),y.line),x=null,M=null;if(L&&!re(L.symbol))u(L,N,"reverse-member-call-owner",void 0,"cross-workspace-or-forward",!0),x=L.symbol;else{let h=Cn(n,S,y.line);h&&(M=f(h,N,"reverse-member-call-source-owner",void 0,!0))}!x&&!M||pe(i,{kind:"call",evidence:"ast-service-member-callsite",fromFile:S,fromSymbol:x,toFile:p.file,toSymbol:null,fromSourceConstruct:M?ae(M):void 0,toSourceConstruct:ae(p),line:y.line,strength:y.strength==="exact"?"exact":"derived"})}}}}}function rl(e,t){let{db:n,index:o,relationPolicy:r,symbols:a,sourceAllowed:i,files:s,workspaces:l,addFile:d,addSymbol:c,addSourceConstruct:u,pendingRelations:f,fileGraph:m,traversalMetrics:p}=e,g=[...a.values()].filter(C=>!C.processed&&C.depth<=t),b=r.has("call")?o.calleeMap(g.map(C=>C.definition),{additive:!1,semantic:!1}):new Map;for(let C of g){C.processed=!0;let S=C.definition;if(C.referenceScope!=="none"&&(r.has("call")||r.has("reference")||r.has("contract-symbol"))){let v=zl(n,o,S).filter(y=>i(y.file)&&Yl(C,y.file,s,l)),R=new Set(v.flatMap(y=>{if(!(r.has("call")&&J(n,y.file)?.callSites.some(x=>x.line===y.line&&Nr(n,y.file,x,S))===!0)||!y.enclosingSymbol)return[];let L=Te(n,o,y.enclosingSymbol).matches[0];return L&&!re(L.symbol)?[{owner:L,site:y}]:[]}).sort((y,N)=>{let L=de(S.relativePath,l).relativeDir,x=de(y.owner.relativePath,l).relativeDir===L,M=de(N.owner.relativePath,l).relativeDir===L,h=Mr(n,y.owner),P=Mr(n,N.owner),D=y.owner.endLine-y.owner.startLine,O=N.owner.endLine-N.owner.startLine;return Number(M)-Number(x)||P-h||D-O||y.owner.symbol.localeCompare(N.owner.symbol)}).filter((y,N,L)=>L.findIndex(x=>x.owner.symbol===y.owner.symbol)===N).reduce((y,N)=>{if(y.length>=Vs)return y;let L=de(N.owner.relativePath,l).relativeDir;return y.some(x=>x.workspace===L)||y.push({symbol:N.owner.symbol,workspace:L}),y},[]).map(y=>y.symbol));for(let y of v){let N=t+1;d(y.file,N,`reference:${ee(S.symbol)}`,!0);let L=r.has("call")&&J(n,y.file)?.callSites.some(h=>h.line===y.line&&Nr(n,y.file,h,S))===!0,x=null,M=null;if(y.enclosingSymbol){let h=Te(n,o,y.enclosingSymbol).matches[0];h&&!re(h.symbol)&&(c(h,N,"reference-owner",void 0,L&&R.has(h.symbol)?C.referenceScope:"none"),x=h.symbol)}if(!x&&y.line!==null){let h=Cn(n,y.file,y.line);h&&(M=u(h,N,"reference-source-owner",void 0,L))}r.has("reference")&&pe(f,{kind:"reference",evidence:"indexed-or-source-reference",fromFile:y.file,fromSymbol:x,toFile:S.relativePath,toSymbol:S.symbol,fromSourceConstruct:M?ae(M):void 0,line:y.line,strength:"mixed"}),L&&pe(f,{kind:"call",evidence:"ast-callsite",fromFile:y.file,fromSymbol:x,toFile:S.relativePath,toSymbol:S.symbol,fromSourceConstruct:M?ae(M):void 0,line:y.line,strength:"derived"}),r.has("contract-symbol")&&de(y.file,l).relativeDir!==de(S.relativePath,l).relativeDir&&pe(f,{kind:"contract-symbol",evidence:"compiler-cross-workspace-symbol",fromFile:y.file,fromSymbol:x,toFile:S.relativePath,toSymbol:S.symbol,fromSourceConstruct:M?ae(M):void 0,line:y.line,strength:"exact"})}}for(let v of b.get(S.symbolId)??[]){let R=Te(n,o,v.symbol).matches.find(N=>N.relativePath===v.file);if(!R||!i(R.relativePath))continue;if(!(R.relativePath===S.relativePath||(m.get(S.relativePath)??new Set).has(R.relativePath))){p.filteredUnverifiedCallEdges+=1;continue}c(R,t+1,`call:${ee(S.symbol)}`,void 0,"none",!0),pe(f,{kind:"call",evidence:v.source,fromFile:S.relativePath,fromSymbol:S.symbol,toFile:R.relativePath,toSymbol:R.symbol,line:null,strength:Nl(v.source)})}}}function il(e,t){let{db:n,index:o,relationPolicy:r,files:a,sourceConstructs:i,symbols:s,boundaryObservations:l,boundaryObservationDepths:d,sourceAllowed:c,addSymbol:u,pendingRelations:f,traversalMetrics:m,addSourceConstruct:p,serviceCallerFilesBySourceConstruct:g,reverseFileGraph:b,externalImports:C,addFile:S,workspaces:v}=e,R=[...a.values()].filter(y=>!y.processed&&y.primary&&y.depth<=t);for(let y of R){y.processed=!0;let N=[...i.values()].filter(I=>I.traversalEligible&&I.file===y.file&&I.depth<=t),L=[...s.values()].filter(I=>I.definition.relativePath===y.file&&I.depth<=t).map(I=>{let _=Yt(n,y.file,I.definition.startLine);return{startLine:_?.startLine??I.definition.startLine,endLine:_?.endLine??I.definition.endLine}}),x=I=>[...s.values()].filter(_=>_.definition.relativePath===y.file&&_.definition.startLine<=I&&_.definition.endLine>=I).sort((_,A)=>_.definition.endLine-_.definition.startLine-(A.definition.endLine-A.definition.startLine)||_.definition.startLine-A.definition.startLine)[0],M=[...l.values()].filter(I=>I.source.file===y.file&&d.has(I.id)),h=[...N.map(I=>({startLine:I.startLine,endLine:I.endLine})),...M.map(I=>({..._t(n,I)}))],P=[...L,...h],D=(J(n,y.file)?.callSites??[]).filter(I=>P.some(_=>I.line>=_.startLine&&I.line<=_.endLine)),O=new Set;if(r.has("call"))for(let I of P){let _=vt(n,y.file,I.startLine,I.endLine);for(let A of _.targets){if(!c(A.definition.relativePath))continue;let j=x(A.sourceLine),$=N.find(U=>U.startLine<=A.sourceLine&&U.endLine>=A.sourceLine),B=M.find(U=>{let q=_t(n,U);return q.startLine<=A.sourceLine&&q.endLine>=A.sourceLine});u(A.definition,t+1,`scip-occurrence-call:${y.file}:${A.sourceLine+1}`,void 0,"none",!0),pe(f,{kind:"call",evidence:"scip-occurrence-callsite",fromFile:y.file,fromSymbol:j?.definition.symbol??null,toFile:A.definition.relativePath,toSymbol:A.definition.symbol,fromBoundaryParticipant:B?Ve(B):void 0,fromSourceConstruct:$?ae($):void 0,line:A.sourceLine,strength:"exact"}),O.add(`${A.sourceLine}\0${A.calleeLeaf}`)}}if(r.has("reference"))for(let I of P){let _=go(n,y.file,I.startLine,I.endLine);for(let A of _.targets){if(!c(A.definition.relativePath)||O.has(`${A.sourceLine}\0${A.calleeLeaf}`))continue;let j=x(A.sourceLine);if(j?.definition.symbol===A.definition.symbol)continue;let $=N.find(U=>U.startLine<=A.sourceLine&&U.endLine>=A.sourceLine),B=M.find(U=>{let q=_t(n,U);return q.startLine<=A.sourceLine&&q.endLine>=A.sourceLine});u(A.definition,t+1,`scip-occurrence-reference:${y.file}:${A.sourceLine+1}`,void 0,"none",!0),pe(f,{kind:"reference",evidence:"scip-occurrence-reference",fromFile:y.file,fromSymbol:j?.definition.symbol??null,toFile:A.definition.relativePath,toSymbol:A.definition.symbol,fromBoundaryParticipant:B?Ve(B):void 0,fromSourceConstruct:$?ae($):void 0,line:A.sourceLine,strength:"exact"})}}let w=r.has("call")?Zt(n,y.file,{ranges:P,excludeIndexedTargets:!1}):{targets:[],unresolvedCallsites:0};m.unresolvedMemberCallsites+=w.unresolvedCallsites;let T=w.targets.filter(I=>!O.has(`${I.line}\0${I.calleeLeaf}`));m.memberCallCandidateEdges+=T.filter(I=>I.strength!=="exact"&&(I.resolution!=="imported-service-object-member"||(I.resolutionAlternativeCount??0)>1)).length;for(let I of T){let _=(I.resolutionAlternativeCount??1)===1,A=I.targetSymbol?X(n,I.targetFile).find(q=>q.symbol===I.targetSymbol):void 0,j=A?null:p({file:I.targetFile,name:I.calleeLeaf,startLine:I.targetStartLine,endLine:I.targetEndLine},t+1,`member-call:${y.file}`,void 0,I.resolution==="imported-service-object-member"&&_,_);if(j&&I.serviceFile){let q=Se(j),se=g.get(q)??new Set;for(let Ne of b.get(I.serviceFile)??[])se.add(Ne);g.set(q,se)}A&&u(A,t+1,`member-call:${y.file}`,void 0,"none",!0);let $=N.find(q=>q.startLine<=I.line&&q.endLine>=I.line),B=x(I.line),U=M.find(q=>{let se=_t(n,q);return se.startLine<=I.line&&se.endLine>=I.line});pe(f,{kind:"call",evidence:I.resolution==="constructed-member-receiver"?"ast-constructed-member-callsite":I.resolution==="factory-callback-member"?"ast-factory-callback-callsite":I.resolution==="imported-service-object-member"?"ast-service-member-callsite":"ast-member-import-candidate",fromFile:y.file,fromSymbol:B?.definition.symbol??null,toFile:I.targetFile,toSymbol:A?.symbol??null,fromBoundaryParticipant:U?Ve(U):void 0,fromSourceConstruct:$?ae($):void 0,toSourceConstruct:j?ae(j):void 0,line:I.line,strength:I.resolution==="imported-service-object-member"?(I.resolutionAlternativeCount??0)===1?"derived":"candidate":I.strength??"candidate"})}for(let I of r.has("import")||r.has("call")?Ul(n,y.file):[]){if(!I.fromFile){if(r.has("import")){let A=C.get(I.shortName)??{name:I.shortName,fromFiles:new Set};A.fromFiles.add(y.file),C.set(I.shortName,A)}continue}if(!c(I.fromFile))continue;if(r.has("import")&&(S(I.fromFile,t+1,`import:${y.file}`,!1),pe(f,{kind:"import",evidence:"indexed-or-source-import",fromFile:y.file,fromSymbol:null,toFile:I.fromFile,toSymbol:I.symbol,line:null,strength:"mixed"})),r.has("call")&&D.length>0){let A=(I.source==="compiler"?Te(n,o,I.symbol).matches:je(n,I.fromFile,I.importedName)).filter(j=>!re(j.symbol));for(let j of A){let $=D.filter(B=>B.calleeLeaf===I.localName).map(B=>B.line);if($.length!==0){u(j,t+1,`source-call:${y.file}`,void 0,"none",!0);for(let B of $)pe(f,{kind:"call",evidence:"ast-callsite",fromFile:y.file,fromSymbol:null,toFile:j.relativePath,toSymbol:j.symbol,line:B,strength:"derived"})}}}if(!y.promoteBoundaryImports||!Vl(y.file,I.fromFile,v))continue;let _=Te(n,o,I.symbol);for(let A of _.matches)if(Ql(A.relativePath,I.fromFile,v)&&!re(A.symbol)){let j=de(y.file,v).relativeDir!==de(A.relativePath,v).relativeDir;u(A,t+1,`boundary-import:${y.file}`,void 0,j?"cross-workspace-or-forward":"forward-regions")}}}}function al(e,t){let{relationPolicy:n,runtimeBoundaries:o,evidenceFloor:r,representedBoundaryLinkIds:a,boundaryObservations:i,sourceAllowed:s,boundaryObservationDepths:l,symbols:d,sourceConstructs:c,addBoundaryObservation:u,pendingRelations:f}=e;for(let m of n.has("runtime-boundary")?o?.links??[]:[]){if(m.strength==="candidate"||r==="exact"&&m.strength!=="exact"||a.has(m.id))continue;let p=i.get(m.from),g=i.get(m.to);if(!p||!g||!s(p.source.file)||!s(g.source.file))continue;let b=kr(p,t,l,d,c),C=kr(g,t,l,d,c);if(b===null&&C===null)continue;let S=t+1,v=u(p,b??S,`runtime-boundary:${m.joinRule}`),R=u(g,C??S,`runtime-boundary:${m.joinRule}`),y=v?null:Ar(c,p),N=R?null:Ar(c,g);l.set(p.id,b??S),l.set(g.id,C??S),pe(f,{kind:"runtime-boundary",evidence:`runtime-boundary:${m.joinRule}`,fromFile:p.source.file,fromSymbol:v,toFile:g.source.file,toSymbol:R,fromBoundaryParticipant:Ve(p),toBoundaryParticipant:Ve(g),fromSourceConstruct:y?ae(y):void 0,toSourceConstruct:N?ae(N):void 0,runtimeBoundaryKey:m.matchedKeyParts.map(L=>`${L.name}=${L.value}`).join(" "),line:p.source.startLine,strength:m.strength}),a.add(m.id)}}function sl(e,t,n){let o=ne(t.searches??[]),r=ne(t.symbols??[]),a=ne(t.relations&&t.relations.length>0?t.relations:Ir),i=a.filter(k=>!Ir.includes(k));if(i.length>0)throw new Error(`Unsupported system-map relation kind(s): ${i.join(", ")}`);let s=new Set(a),l=t.evidenceFloor??"derived";if(l!=="exact"&&l!=="derived")throw new Error(`Unsupported system-map evidence floor: ${l}`);let d=ne(t.sourceScopes&&t.sourceScopes.length>0?t.sourceScopes:["production"]),c=["production","test","fixture","example","generated","script","unknown"],u=d.filter(k=>!c.includes(k));if(u.length>0)throw new Error(`Unsupported system-map source scope(s): ${u.join(", ")}`);let f=new Set(d),m=k=>f.has(Ut(k));if(o.length===0&&r.length===0)throw new Error("system-map requires at least one --search or --symbol anchor.");let p=t.maxDepth??js;if(!Number.isSafeInteger(p)||p<0)throw new RangeError(`maxDepth must be a non-negative safe integer; received ${p}`);let g=t.maxTopologyCharacters??Ys;if(!Number.isSafeInteger(g)||g<=0)throw new RangeError(`maxTopologyCharacters must be a positive safe integer; received ${g}`);let b=new ht(e),{fileGraph:C,reverseFileGraph:S,workspaces:v,runtimeBoundaries:R}=Zl(e,b),y=new Map((R?.observations??[]).map(k=>[k.id,k])),N=new Set((R?.observations??[]).map(k=>`${k.source.file}\0${k.source.startLine}`)),L=new Set,x=new Map,M=new Map,h=new Map,P=new Map,D=[],O=new Map,w=new Map,T=[],I={filteredUnverifiedCallEdges:0,memberCallCandidateEdges:0,unresolvedMemberCallsites:0},_=new Set,A=new Map,j=new Map,$=k=>{let G=j.get(k);if(G)return G;let H=Zt(e,k,{excludeIndexedTargets:!1});return j.set(k,H),H},B=(k,G,H,me,Fe=!1)=>Xs(M,k,G,H,me,Fe),U=(k,G,H,me,Fe="none",Qe=!1)=>Zs(h,B,k,G,H,me,Fe,Qe),q=(k,G,H,me,Fe=!1,Qe=!0)=>Js(P,B,k,G,H,me,Fe,Qe),se=(k,G,H)=>el({db:e,index:b,pendingRelations:O,addFile:B,addSymbol:U,addSourceConstruct:q,observation:k,depth:G,origin:H}),{omittedSymbolCandidates:Ne,broadLiteralAnchors:Oe,withheldLiteralMatches:ve}=tl({db:e,index:b,searches:o,symbolQueries:r,opts:t,boundaryObservationLocations:N,sourceAllowed:m,addFile:B,addSymbol:U,addSourceConstruct:q,literalHits:D,anchors:T}),E={db:e,index:b,relationPolicy:s,evidenceFloor:l,sourceAllowed:m,fileGraph:C,reverseFileGraph:S,workspaces:v,runtimeBoundaries:R,boundaryObservations:y,boundaryObservationDepths:x,representedBoundaryLinkIds:L,files:M,symbols:h,sourceConstructs:P,pendingRelations:O,externalImports:w,reverseExpandedSourceConstructs:_,serviceCallerFilesBySourceConstruct:A,traversalMetrics:I,memberCallTargetsForWholeFile:$,addFile:B,addSymbol:U,addSourceConstruct:q,addBoundaryObservation:se};for(let k=0;k<p;k+=1)ol(E,k),rl(E,k),il(E,k),al(E,k);return nl({db:e,opts:t,mode:n,searches:o,symbolQueries:r,maxDepth:p,maxTopologyCharacters:g,requestedRelationKinds:a,evidenceFloor:l,includedSourceScopes:d,workspaces:v,runtimeBoundaries:R,boundaryObservations:y,representedBoundaryLinkIds:L,files:M,symbols:h,sourceConstructs:P,literalHits:D,pendingRelations:O,externalImports:w,anchors:T,omittedSymbolCandidates:Ne,broadLiteralAnchors:Oe,withheldLiteralMatches:ve,filteredUnverifiedCallEdges:I.filteredUnverifiedCallEdges,memberCallCandidateEdges:I.memberCallCandidateEdges,unresolvedMemberCallsites:I.unresolvedMemberCallsites,sourceAllowed:m})}function ll(e,t,n,o){let r=new Map,a=l=>{r.set(`${l.file}\0${l.line}`,l)};for(let l of o)a(l);let i=new Set(t.anchors.filter(l=>l.status==="matched").flatMap(l=>l.nodeIds));for(let l of n.steps)if(!(!l.location||!i.has(l.nodeId)||(l.behavior?.rawCharacters??1/0)>3e3))for(let d of l.behavior?.lines??[])d.signals.some(c=>Qs.has(c))&&a({file:l.location.file,line:d.line,endLine:d.endLine});let s=t.edges.filter(l=>l.disposition==="emitted").flatMap(l=>l.evidence.flatMap(d=>d.location?[d.location]:[]));for(let l of s){a(l);let d=t.nodes.filter(u=>u.location?.file===l.file&&["symbol","source-construct","runtime-boundary-participant"].includes(u.kind)&&u.location.line<=l.line&&(u.location.endLine??u.location.line)>=l.line).sort((u,f)=>(u.location.endLine??u.location.line)-u.location.line-((f.location.endLine??f.location.line)-f.location.line)||u.id.localeCompare(f.id))[0];if(!d?.location)continue;let c=yt(e,l.file,d.location.line,d.location.endLine??d.location.line,[l.line]);for(let u of c)a({file:l.file,line:u.line,endLine:u.endLine})}return[...r.values()].sort((l,d)=>l.file.localeCompare(d.file)||l.line-d.line)}function cl(e){if(e.ownerStartLine===null||e.ownerStartLine===void 0)throw new Error(`Literal hit ${e.file}:${e.line+1} has no source-owner start line.`);if(e.ownerEndLine===null||e.ownerEndLine===void 0)throw new Error(`Literal hit ${e.file}:${e.line+1} has no source-owner end line.`);return{file:e.file,name:e.ownerShortName??`${e.file}:${e.ownerStartLine+1}`,startLine:e.ownerStartLine,endLine:e.ownerEndLine}}function Se(e){return`${e.file}\0${e.startLine}\0${e.endLine}\0${e.name}`}function ae(e){return{file:e.file,name:e.name,startLine:e.startLine,endLine:e.endLine}}function Nr(e,t,n,o){if(n.calleeLeaf===o.leaf)return!0;let r=On(e,t,n.calleeLeaf);return r!==null&&r.importedName===o.leaf&&r.sourcePath!==null&&Pe(r.sourcePath,o.relativePath)}function Bt(e,t){let n=ut(J(e,t.file)?.callables??[],t.startLine);if(n&&n.endLine>=t.endLine)return{file:t.file,name:/^source@\d+$/u.test(n.name)&&!/^source@\d+$/u.test(t.name)?t.name:n.name,startLine:n.startLine,endLine:n.endLine};let o=Br(e,t.file,t.startLine);return o&&o.endLine>=t.endLine?{file:t.file,name:o.name,startLine:o.startLine,endLine:o.endLine}:ae(t)}function He(e){return ue("source-construct",e.file,String(e.startLine),String(e.endLine),e.name)}function Ot(e,t){let n=Yn(e,t.symbol,t.relativePath),o=new Set(["package-surface-file","transitive-package-surface"]),r=n.filter(i=>!o.has(i)||Zn(e,t)),a=r.some(i=>!o.has(i));return{evidence:r,priority:a||Xn(e,t.symbol,t.relativePath)?2:1}}function Mr(e,t){let n=Ot(e,t);return n.evidence.length>0?n.priority:0}function dl(e,t){let n=X(e,t.file),o=n.filter(r=>r.startLine<=t.startLine&&r.endLine>=t.startLine).sort((r,a)=>r.endLine-r.startLine-(a.endLine-a.startLine)||r.startLine-a.startLine);for(let r of o){let a=Ot(e,r);if(a.evidence.length>0)return a}for(let r of ul(e,t.file,t.startLine)){let a=n.filter(i=>i.leaf===r.name).sort((i,s)=>Math.abs(i.startLine-r.startLine)-Math.abs(s.startLine-r.startLine)||i.symbol.localeCompare(s.symbol));for(let i of a){let s=Ot(e,i);if(s.evidence.length>0)return s}return{evidence:[],priority:0}}return{evidence:[],priority:0}}function ul(e,t,n){let o=Y(e,t)?.rootNode;if(!o||o.startPosition.row>n||o.endPosition.row<n)return[];let r=[],a=wn(o,n);for(;a;){if(a.type==="variable_declarator"||a.type==="function_declaration"||a.type==="generator_function_declaration"||a.type==="class_declaration"){let i=a.childForFieldName("name")??a.namedChild(0);(i?.type==="identifier"||i?.type==="type_identifier")&&r.push({name:i.text,startLine:a.startPosition.row})}a=a.parent}return r}function pl(e){return[...new Map([...e.sourceConstructStates.values()].map(t=>Bt(e.db,t)).map(t=>[Se(t),t])).values()].sort((t,n)=>t.file.localeCompare(n.file)||t.startLine-n.startLine||t.endLine-n.endLine)}function ml(e,t){return e.anchors.map((n,o)=>{let r=ue("anchor",String(o),n.kind,n.query),a=[...e.symbolStates.values()].filter(c=>c.anchorQueries.has(n.query)).flatMap(c=>{if(!re(c.definition.symbol))return[Re(c.definition.symbol)];let u=t.filter(f=>f.file===c.definition.relativePath).map(f=>He(f));return u.length>0?u:[Re(c.definition.symbol)]}),i=[...e.sourceConstructStates.values()].filter(c=>c.anchorQueries.has(n.query)).map(c=>He(Bt(e.db,c))),s=e.literalHits.filter(c=>c.query===n.query&&c.traversalSeed===!0&&c.ownerSymbol&&e.symbolStates.has(c.ownerSymbol)).map(c=>Re(c.ownerSymbol)),l=e.literalHits.filter(c=>c.query===n.query&&c.traversalSeed===!0&&!c.ownerSymbol&&c.ownerStartLine!==null&&c.ownerStartLine!==void 0&&c.ownerEndLine!==null&&c.ownerEndLine!==void 0).map(c=>He(Bt(e.db,cl(c)))),d=z(n.kind==="symbol"?[...a,...i]:s.length+l.length>0?[...s,...l]:n.seedRegionIds??[]);return{id:r,kind:n.kind,query:n.query,status:n.status,nodeIds:n.status==="ambiguous"?[]:d,candidateNodeIds:n.status==="ambiguous"?d:[],omittedCandidates:n.omittedSymbolCandidates??0}})}function fl(e){let t=new Map;for(let n of e)for(let o of[...n.nodeIds,...n.candidateNodeIds]){let r=t.get(o)??[];r.push(n.id),t.set(o,r)}return t}function gl(e,t,n){let o=e.relations.flatMap(i=>[i.fromBoundaryParticipant,i.toBoundaryParticipant].flatMap(s=>s?.ownerName?[s]:[])),r=e.regions.map(i=>({id:i.id,kind:"structural-region",label:i.label,disposition:"folded",location:null,anchorIds:z(n.get(i.id)??[]),attributes:{workspace:i.workspace,structuralPath:i.structuralPath,minimumDepth:i.minDepth,files:i.fileCount,symbols:i.symbolCount,expanded:i.expanded}}));for(let i of e.symbolStates.values()){let s=e.regionForFile.get(i.definition.relativePath)?.id;if(!s)throw new Error(`System-map symbol ${i.definition.symbol} has no structural region.`);let l=Re(i.definition.symbol),d=Ot(e.db,i.definition);r.push({id:l,kind:"symbol",label:ee(i.definition.symbol),disposition:(n.get(l)?.length??0)>0?"emitted":"folded",location:{file:i.definition.relativePath,line:i.definition.startLine,endLine:i.definition.endLine},anchorIds:z(n.get(l)??[]),attributes:{regionId:s,depth:i.depth,leaf:i.definition.leaf??ee(i.definition.symbol),referenceScope:i.referenceScope,...d.evidence.length>0?{publicEntry:!0,publicEntryPriority:d.priority,publicEntryEvidence:d.evidence.join(",")}:{}}})}for(let i of t){let s=e.regionForFile.get(i.file)?.id;if(!s)throw new Error(`Source construct ${i.name} has no structural region.`);let l=He(i),c=o.find(f=>f.file===i.file&&f.line>=i.startLine&&f.line<=i.endLine)?.ownerName??i.name,u=dl(e.db,i);r.push({id:l,kind:"source-construct",label:c,disposition:(n.get(l)?.length??0)>0?"emitted":"folded",location:{file:i.file,line:i.startLine,endLine:i.endLine},anchorIds:z(n.get(l)??[]),attributes:{regionId:s,leaf:c,sourceOwned:!0,...u.evidence.length>0?{publicEntry:!0,publicEntryPriority:u.priority,publicEntryEvidence:u.evidence.join(",")}:{}}})}let a=new Map;for(let i of e.relations)i.fromBoundaryParticipant&&a.set(i.fromBoundaryParticipant.observationId,i.fromBoundaryParticipant),i.toBoundaryParticipant&&a.set(i.toBoundaryParticipant.observationId,i.toBoundaryParticipant);for(let i of[...a.values()].sort((s,l)=>s.observationId.localeCompare(l.observationId))){let s=e.regionForFile.get(i.file)?.id;if(!s)throw new Error(`Runtime-boundary participant ${i.observationId} has no structural region.`);r.push({id:Nn(i.observationId),kind:"runtime-boundary-participant",label:i.address||i.ownerName||`${i.role} ${i.action}`,disposition:"folded",location:{file:i.file,line:i.line,endLine:i.endLine},anchorIds:[],attributes:{regionId:s,action:i.action,protocol:i.protocol,role:i.role,...i.address?{address:i.address}:{},ownerSymbol:i.ownerSymbol}})}return r}function yl(e,t,n,o,r,a,i,s,l,d=!1){let c=o?Re(o):null;if(c&&t.has(c)&&!re(o))return c;let u=r?Nn(r.observationId):null;if(d&&u&&t.has(u))return u;let f=a?He(Bt(e,a)):null;if(f&&t.has(f))return f;if(u&&t.has(u))return u;let m=l===null?null:(n.get(s)??[]).filter(p=>p.startLine<=l&&p.endLine>=l).sort((p,g)=>p.endLine-p.startLine-(g.endLine-g.startLine)||p.startLine-g.startLine)[0]??null;return m?He(m):c&&t.has(c)?c:i}function hl(e,t,n){let o=new Set(t.map(d=>d.id)),r=ye(n,d=>d.file),a=(d,c,u,f,m,p,g=!1)=>yl(e.db,o,r,d,c,u,f,m,p,g),i=[];for(let d of e.symbolStates.values()){let c=e.regionForFile.get(d.definition.relativePath)?.id;if(!c)continue;let u=Re(d.definition.symbol);i.push({id:ue("edge","structural-membership",c,u),kind:"structural-membership",fromNodeId:c,toNodeId:u,directed:!0,disposition:"folded",semantics:It("structural-membership"),evidence:[{method:"indexed-definition-file",strength:"exact",identity:d.definition.symbol,location:{file:d.definition.relativePath,line:d.definition.startLine,endLine:d.definition.endLine}}]})}let s=ye(e.relations,d=>`${a(d.fromSymbol,d.fromBoundaryParticipant,d.fromSourceConstruct,d.fromRegionId,d.fromFile,d.line,d.kind==="runtime-boundary")}\0${a(d.toSymbol,d.toBoundaryParticipant,d.toSourceConstruct,d.toRegionId,d.toFile,null)}\0${d.kind}`),l=new Set;for(let d of s.values()){let c=d[0],u=a(c.fromSymbol,c.fromBoundaryParticipant,c.fromSourceConstruct,c.fromRegionId,c.fromFile,c.line,c.kind==="runtime-boundary"),f=a(c.toSymbol,c.toBoundaryParticipant,c.toSourceConstruct,c.toRegionId,c.toFile,null);if(c.kind==="runtime-boundary"&&c.fromBoundaryParticipant){let p=Nn(c.fromBoundaryParticipant.observationId),g=a(c.fromSymbol,void 0,c.fromSourceConstruct,c.fromRegionId,c.fromFile,c.line);g!==p&&!l.has(p)&&(l.add(p),i.push({id:ue("edge","boundary-observation",g,p),kind:"boundary-observation",fromNodeId:g,toNodeId:p,directed:!0,disposition:"folded",semantics:It("boundary-observation"),evidence:[{method:"runtime-boundary-observation-owner",strength:c.strength??"unknown",identity:c.fromBoundaryParticipant.observationId,location:{file:c.fromBoundaryParticipant.file,line:c.fromBoundaryParticipant.line,endLine:c.fromBoundaryParticipant.endLine}}]}))}(u===f?t.find(p=>p.id===u):null)?.kind!=="structural-region"&&i.push({id:ue("edge",c.kind,u,f),kind:c.kind,fromNodeId:u,toNodeId:f,directed:!0,disposition:"folded",semantics:ko(c),evidence:wl(d.map(p=>({method:p.evidence,strength:p.strength??"unknown",identity:p.kind==="runtime-boundary"&&p.runtimeBoundaryKey?p.runtimeBoundaryKey:`${p.fromSymbol??p.fromFile} -> ${p.toSymbol??p.toFile}`,location:p.line===null?null:{file:p.fromFile,line:p.line}})))})}return i}function bl(e,t,n){for(let r of e.externalBoundaries){let a=ue("external",r.kind,r.name),i=z(r.fromRegionIds);t.push({id:a,kind:r.kind,label:r.name,disposition:"folded",location:null,anchorIds:[],attributes:{}});for(let s of i)n.push({id:ue("edge",r.kind,s,a),kind:r.kind,fromNodeId:s,toNodeId:a,directed:!0,disposition:"folded",semantics:It("external-import"),evidence:[{method:"indexed-or-source-import",strength:"mixed",identity:`${s} -> ${r.name}`,location:null}]})}let o=[];return e.boundaryFrontiers.forEach((r,a)=>{let i=e.regionForFile.get(r.file)?.id;if(!i)throw new Error(`Runtime-boundary frontier ${r.observationId} has no system-map region.`);let s=ue("unsupported","runtime-boundary",r.observationId,String(a)),l=ue("edge","runtime-boundary-frontier",i,s);t.push({id:s,kind:"runtime-boundary-frontier",label:r.address,disposition:"unsupported",location:{file:r.file,line:r.line},anchorIds:[],attributes:{action:r.action,strength:r.strength,owner:r.ownerShortName}}),n.push({id:l,kind:"runtime-boundary-frontier",fromNodeId:i,toNodeId:s,directed:!0,disposition:"unsupported",evidence:[{method:"runtime-boundary-extractor",strength:r.strength,identity:r.observationId,location:{file:r.file,line:r.line}}]}),o.push({id:ue("frontier","runtime-boundary",r.observationId,String(a)),kind:"runtime-boundary",direction:"unresolved",fromNodeIds:[i],edgeIds:[l],memberNodeIds:[s],memberCount:1,disposition:"unsupported",reason:r.reason,expansion:null})}),o}function Sl(e,t){let n=t.topologyFrontiers.some(p=>p==="frontier:program-facts"),o=Er(e,{expandedFrontierIds:t.topologyFrontiers.filter(p=>p!=="frontier:program-facts"),routeIds:t.routeIds}),r=o.nodes.filter(p=>p.disposition==="emitted"||o.anchors.some(g=>g.status==="matched"&&g.nodeIds.includes(p.id))),a=t.relations.filter(p=>r.some(g=>xl(p,g))),i=t.boundaryFrontiers.filter(p=>r.some(g=>El(p,g))),s=zo(t.db,a,r),l=Wo(t.db,r),d=rr(t.db,r,i),c=[...s.nodes,...l.nodes,...d.nodes].map(p=>n&&p.disposition==="folded"?{...p,disposition:"emitted"}:p),u=[...s.edges,...l.edges,...d.edges].map(p=>n&&p.disposition==="folded"?{...p,disposition:"emitted"}:p),f=n?null:Cl(r,c,u),m=Dt({anchors:o.anchors,nodes:[...o.nodes,...c],edges:[...o.edges,...u],paths:o.paths,frontiers:[...o.frontiers,...s.frontiers,...l.frontiers,...d.frontiers,...f?[f]:[]],scope:o.coverage.scope,blindSpots:[...o.coverage.blindSpots,...s.blindSpots,...l.blindSpots,...d.blindSpots],incompleteReasons:o.coverage.status==="incomplete"?[o.coverage.explanation]:[],...o.routeCatalog?{routeCatalog:o.routeCatalog}:{}});m.completion=o.completion;for(let p of m.frontiers)p.disposition==="folded"&&(p.id.startsWith("frontier:program-facts:")||(p.expansion=Ll(t,p.id)));return m}function vl(e){let t=pl(e),n=ml(e,t),o=gl(e,t,fl(n)),r=hl(e,o,t),a=bl(e,o,r);return Sl(Dt({anchors:n,nodes:o,edges:r,paths:[],frontiers:a,scope:`explicit anchors; relations ${e.requestedRelationKinds.join(", ")}; depth ${e.maxDepth}; evidence floor ${e.evidenceFloor}; source scopes ${e.includedSourceScopes.join(", ")}`,blindSpots:[...e.blindSpots],incompleteReasons:e.closureStatus==="incomplete"?[`${e.omittedSymbolCandidates} ambiguous symbol candidate(s) were omitted`]:[]}),e)}function xl(e,t){if(e.fromSymbol&&t.id===Re(e.fromSymbol)||e.toSymbol&&t.id===Re(e.toSymbol))return!0;if(!t.location)return!1;let n=t.location.endLine??t.location.line;return t.location.file===e.fromFile&&e.line!==null&&e.line>=t.location.line&&e.line<=n||t.location.file===e.toFile}function El(e,t){if(!t.location||t.location.file!==e.file)return!1;let n=t.location.endLine??t.location.line;return e.line>=t.location.line&&e.line<=n||t.label===e.ownerShortName||typeof e.ownerShortName=="string"&&t.label.includes(e.ownerShortName)}function Cl(e,t,n){let o=z(t.filter(a=>a.disposition==="folded").map(a=>a.id)),r=z(n.filter(a=>a.disposition==="folded").map(a=>a.id));return o.length===0&&r.length===0?null:{id:ue("frontier","program-facts"),kind:"program-facts",direction:"outgoing",fromNodeIds:z(e.map(a=>a.id)),edgeIds:r,memberNodeIds:o,memberCount:o.length,disposition:"folded",reason:"Control, data, state, and temporal facts are folded beneath the selected high-level owners.",expansion:null}}function Ll(e,t){return`scip-query system-map ${[...e.anchors.flatMap(o=>o.kind==="literal"?[`--search ${V(o.query)}`]:[`--symbol ${V(o.query)}`]),`--depth ${e.maxDepth}`,...e.requestedRelationKinds.map(o=>`--relation ${V(o)}`),`--evidence-floor ${V(e.evidenceFloor)}`,...e.includedSourceScopes.map(o=>`--source-scope ${V(o)}`),...e.fullLiteralTraversal?["--full-literal-traversal"]:[],`--topology-characters ${e.maxTopologyCharacters}`,...e.expandedRegionIds.map(o=>`--expand ${V(o)}`),...e.topologyFrontiers.map(o=>`--frontier ${V(o)}`),...e.routeIds.map(o=>`--route ${V(o)}`),`--frontier ${V(t)}`].join(" ")}`}function Il(e){let t=new Set;for(let n of e.nodes){if(n.disposition!=="emitted")continue;n.kind==="structural-region"&&t.add(n.id);let o=n.attributes.regionId;typeof o=="string"&&t.add(o)}return t}function wl(e){let t=new Map;for(let n of e){let o=n.location?`${n.location.file}:${n.location.line}`:"";t.set(`${n.method}\0${n.strength}\0${n.identity??""}\0${o}`,n)}return[...t.values()].sort((n,o)=>n.method.localeCompare(o.method)||(n.identity??"").localeCompare(o.identity??"")||(n.location?.file??"").localeCompare(o.location?.file??"")||(n.location?.line??0)-(o.location?.line??0))}function ue(...e){return e.map(t=>encodeURIComponent(t)).join(":")}function Re(e){return ue("symbol",e)}function Nl(e){return e==="semantic-callee"||e==="scip-chunk"?"exact":"derived"}function Ml(e,t,n,o,r,a,i,s,l,d){let c=[...o].sort((g,b)=>_r(g,b,r)),f=c.slice(0,Lr).map(g=>g.id),m=c.slice(Lr).map(g=>g.id),p=[...e.map(g=>`--search ${V(g)}`),...t.map(g=>`--symbol ${V(g)}`),`--depth ${n}`,...a.map(g=>`--relation ${V(g)}`),`--evidence-floor ${V(i)}`,...s.map(g=>`--source-scope ${V(g)}`),...l?["--full-literal-traversal"]:[],`--topology-characters ${d}`,...f.map(g=>`--expand ${V(g)}`)];return{command:f.length===0?null:`scip-query system-map ${p.join(" ")}`,regionCount:f.length,regionIds:f,candidateRegionCount:o.length,omittedRegionIds:m}}function Rl(e,t,n,o,r,a,i,s,l,d,c,u,f){let m=[...l].sort((h,P)=>_r(h,P,c)).filter(h=>!f||f.has(h.id)||u.has(h.id)),p=d.length>0?Math.floor(s*.4):0,g=s-p,b=new Set,C=0;for(let h of m){let P=Rr(h);!u.has(h.id)&&b.size>0&&C+P>g||(b.add(h.id),C+=P)}let S=d.filter(h=>b.has(h.fromRegionId)&&b.has(h.toRegionId)).sort(Tl),v=[];for(let h of S){let P=Tr(h);v.length>0&&C+P>s||(v.push(Gt(h)),C+=P)}let R=l.filter(h=>!b.has(h.id)).map(h=>h.id).sort(),y=new Set(v),N=d.filter(h=>!y.has(Gt(h))).length,L=l.reduce((h,P)=>h+Rr(P),0)+d.reduce((h,P)=>h+Tr(P),0),x=m.every(h=>b.has(h.id))&&v.length===S.length,M=[...e.map(h=>`--search ${V(h)}`),...t.map(h=>`--symbol ${V(h)}`),`--depth ${n}`,...o.map(h=>`--relation ${V(h)}`),`--evidence-floor ${V(r)}`,...a.map(h=>`--source-scope ${V(h)}`),...i?["--full-literal-traversal"]:[],`--topology-characters ${Math.max(s,L)}`];return{maxCharacters:s,estimatedCharacters:C,totalEstimatedCharacters:L,regionIds:[...b],omittedRegionIds:R,relationKeys:v,omittedRelations:N,complete:x,expansionCommand:x?null:`scip-query system-map ${M.join(" ")}`}}function Rr(e){return 120+e.id.length+e.anchorQueries.join(",").length+e.relationKinds.join(",").length+e.notableSymbols.slice(0,2).reduce((t,n)=>t+n.shortName.length+n.file.length,0)}function Tr(e){return 70+e.fromRegionId.length+e.toRegionId.length+e.kinds.join(",").length+e.evidence.join(",").length}function Tl(e,t){let n=o=>o.kinds.includes("runtime-boundary")?0:o.kinds.includes("contract-symbol")?1:2;return n(e)-n(t)||t.relationCount-e.relationCount||Gt(e).localeCompare(Gt(t))}function Gt(e){return`${e.fromRegionId}\0${e.toRegionId}`}function _r(e,t,n){let o=s=>n.has(s.id)?0:1,r=s=>s.sourceFileCount===0?1:0,a=s=>s.symbolCount+s.literalHitCount>0?0:1,i=s=>[...s.incomingRegionIds,...s.outgoingRegionIds].filter(l=>n.has(l)).length;return o(e)-o(t)||a(e)-a(t)||r(e)-r(t)||e.minDepth-t.minDepth||i(t)-i(e)||t.literalHitCount-e.literalHitCount||e.testFileCount-t.testFileCount||e.label.localeCompare(t.label)}function Fl(e){let t=[],n=new Set;for(let r of e.filter(a=>a.expanded)){for(let l of r.symbols)l.origins.includes("symbol-anchor")&&n.add(l.file);let a=ye(r.symbols,l=>l.file),i=ye(r.literalHits,l=>l.file),s=[...r.files].sort((l,d)=>Al(l,d,a,i));for(let l of s){let d=(a.get(l.file)??[]).sort(to)[0];if(d){t.push({kind:"symbol",regionId:r.id,file:d.file,line:d.startLine,endLine:d.endLine,label:d.shortName});continue}let c=(i.get(l.file)??[]).sort(jr)[0];c&&t.push({kind:"literal",regionId:r.id,file:c.file,line:c.line,endLine:null,label:c.ownerShortName??c.query})}}let o=Pl(t,n);return{command:o.length===0?null:`scip-query inspect ${o.map(r=>`--at ${V(`${r.file}:${r.line+1}`)}`).join(" ")} --view behavior`,definitionCommand:null,candidateAnchors:t.length,selectedAnchors:o.length,omittedAnchors:t.length-o.length,anchors:o}}function Pl(e,t){let n=[...ye(e,i=>i.regionId).values()],o=[],r=new Set,a=Math.min(Hs,24);for(let i of e)if(!(!t.has(i.file)||r.has(i.file))&&(o.push(i),r.add(i.file),o.length===a))return o;for(let i=0;o.length<a;i+=1){let s=!1;for(let l of n){let d=l[i];if(d&&(s=!0,!r.has(d.file)&&(o.push(d),r.add(d.file),o.length===a)))break}if(!s)break}return o}function Al(e,t,n,o){let r=s=>s.kind==="test"?2:s.kind==="barrel"?1:0,a=s=>(o.get(s.file)??[]).some(l=>l.traversalSeed)?0:1,i=s=>{let l=n.get(s.file)??[];return Math.min(5,...l.map(d=>Ke(d.origins)))};return r(e)-r(t)||a(e)-a(t)||i(e)-i(t)||e.depth-t.depth||e.file.localeCompare(t.file)}function V(e){return`'${e.replaceAll("'","'\\''")}'`}function kl(e,t,n,o){let r=[];for(let a of _n(e,{includeIgnored:!1})){let i=le(e,a);if(i.length===0)continue;let s=[];for(let c=0;c<i.length;c+=1){let u=i[c]??"";u.includes(n)&&s.push({line:c,sourceLine:u})}if(s.length===0)continue;let l=t.definitionsForFile(a),d=J(e,a)?.callables??[];for(let{line:c,sourceLine:u}of s){let f=Ge(l,c),m=ut(d,c),p=f&&!re(f.symbol)?f:null,g=p?.startLine??m?.startLine??f?.startLine??c,b=p?.endLine??m?.endLine??f?.endLine??c,C=Xt(e,a,c,g,b),S=o.has(`${a}\0${c}`),v=!!(p?.isFunctionLike||m);r.push({relativePath:a,line:c,sourceLine:u,ownerSymbol:p?.symbol??null,ownerShortName:p?ee(p.symbol):m?.name??(f?ee(f.symbol):null),ownerStartLine:C.startLine,ownerEndLine:C.endLine,matchKind:Bl(u,n),seedPriority:S?0:v?1:2})}}return r}function $l(e,t){let n={"exact-value":0,boundary:1,embedded:2};return e.seedPriority-t.seedPriority||n[e.matchKind]-n[t.matchKind]||e.relativePath.localeCompare(t.relativePath)||e.line-t.line}function Fr(e){return`${e.relativePath}\0${e.line}`}function Cn(e,t,n){let r=ut(J(e,t)?.callables??[],n)??Br(e,t,n);if(!r)return null;let a=Xt(e,t,n,r.startLine,r.endLine);return{file:t,name:r.name,startLine:a.startLine,endLine:a.endLine}}function Br(e,t,n){let o=Y(e,t)?.rootNode;if(!o||o.startPosition.row>n||o.endPosition.row<n)return null;let r=wn(o,n);for(;r;){if(r.type==="variable_declarator"){let i=r.childForFieldName("name")??r.namedChild(0),s=r.childForFieldName("value")??r.namedChild(1);if(i?.type==="identifier"&&s&&Ln(s,n))return{name:i.text,startLine:r.startPosition.row,endLine:r.endPosition.row}}if(r.type==="pair"){let i=r.childForFieldName("key")??r.namedChild(0),s=r.childForFieldName("value")??r.namedChild(1),l=i?.text.replace(/^(?:['"])(.*)(?:['"])$/u,"$1");if(l&&s&&/^[A-Za-z_$][\w$]*$/u.test(l)&&Ln(s,n))return{name:l,startLine:r.startPosition.row,endLine:r.endPosition.row}}r=r.parent}let a=Yt(e,t,n);return a?{name:`source@${n+1}`,startLine:a.startLine,endLine:a.endLine}:null}function Ln(e,t){return["arrow_function","function_expression","generator_function","generator_function_declaration"].includes(e.type)&&e.startPosition.row<=t&&e.endPosition.row>=t?!0:e.namedChildren.some(n=>n.startPosition.row<=t&&n.endPosition.row>=t&&Ln(n,t))}function wn(e,t){let n=e.namedChildren.filter(o=>o.startPosition.row<=t&&o.endPosition.row>=t).sort((o,r)=>o.endIndex-o.startIndex-(r.endIndex-r.startIndex)||o.startPosition.row-r.startPosition.row)[0];return n?wn(n,t):e}function Dl(e,t){let n=t.match(/^(.+):(\d+)(?:-(\d+))?$/u);if(!n)return null;let o=Bn(e,n[1],{allowMultiple:!1})[0]?.relativePath;if(!o)return null;let r=Math.max(0,Number.parseInt(n[2],10)-1),a=n[3]?Math.max(r,Number.parseInt(n[3],10)-1):r,i=(J(e,o)?.callables??[]).filter(s=>s.startLine<=r&&s.endLine>=a).sort((s,l)=>s.endLine-s.startLine-(l.endLine-l.startLine)||s.startLine-l.startLine)[0];return i?{file:o,name:i.name,startLine:i.startLine,endLine:i.endLine}:null}function _l(e){return{symbol:`source-construct:${e.file}:${e.startLine}:${e.endLine}:${e.name}`,shortName:e.name,relativePath:e.file,startLine:e.startLine,endLine:e.endLine}}function Bl(e,t){let n=/[\p{L}\p{N}_$]/u,o=e.indexOf(t);for(;o>=0;){let r=e[o-1]??"",a=e[o+t.length]??"";if((r==="'"||r==='"'||r==="`")&&a===r)return"exact-value";if(!n.test(r)&&!n.test(a))return"boundary";o=e.indexOf(t,o+Math.max(1,t.length))}return"embedded"}function In(e){return pt(e)==="test"?!1:!/(?:^|[/._-])(?:fixtures?|mocks?|previews?|demos?|examples?|stories)(?:[/._-]|$)/iu.test(e)}function Ol(e,t){return e.matchKind!=="embedded"&&t(e.relativePath)&&(Ut(e.relativePath)!=="production"||In(e.relativePath))}function Gl(e,t){let n=[...t].sort(jl),o=[],r=new Set;for(let a of n)if(!r.has(a.relativePath)&&(o.push(a),r.add(a.relativePath),o.length>=Cr))break;for(let a of n){if(o.length>=Cr)break;o.includes(a)||o.push(a)}return o.map(a=>({query:e,file:a.relativePath,line:a.line,ownerSymbol:a.ownerSymbol,ownerShortName:a.ownerShortName,ownerStartLine:a.ownerStartLine,ownerEndLine:a.ownerEndLine,sourceLine:a.sourceLine.trim(),matchKind:a.matchKind,traversalSeed:!1}))}function jl(e,t){let n={"exact-value":0,boundary:1,embedded:2};return n[e.matchKind]-n[t.matchKind]||+(t.ownerSymbol!==null)-+(e.ownerSymbol!==null)||+!In(e.relativePath)-+!In(t.relativePath)||e.relativePath.localeCompare(t.relativePath)||e.line-t.line}function Kl(e,t){let n=new Map;for(let o of t){let r=ql(o.relativePath);n.set(r,(n.get(r)??0)+1)}return[...n].sort(([o,r],[a,i])=>i-r||o.localeCompare(a)).slice(0,Us).map(([o])=>`scip-query search ${V(e)} --scope ${V(o)}`)}function ql(e){let t=e.split("/").filter(Boolean);if(t.length<=1)return e;let n=t.slice(0,-1),o=n.lastIndexOf("src");return o>=0?n.slice(0,Math.min(n.length,o+3)).join("/"):n.slice(0,Math.min(n.length,3)).join("/")}function zl(e,t,n){let o=t.callerFileMap([n],{semantic:!1}).get(n.symbolId)??new Set,r=[];for(let a of[...o].sort()){let i=xe(e,a).filter(c=>c.importedName===n.leaf&&c.sourcePath!==null&&Pe(c.sourcePath,n.relativePath)),s=new Set;if(i.length>0)for(let c of i)s.add(c.localName??c.importedName);else n.leaf&&s.add(n.leaf);let l=[...new Set([...s].flatMap(c=>Ee(e,a,c)))].sort((c,u)=>c-u);if(l.length===0){r.push({file:a,line:null,enclosingSymbol:null});continue}let d=t.definitionsForFile(a);for(let c of l)r.push({file:a,line:c,enclosingSymbol:Ge(d,c)?.symbol??null})}return r}function Ul(e,t){let n=e.all(`SELECT DISTINCT gs.symbol, def_d.relative_path AS from_file
|
|
7
|
+
FROM mentions m
|
|
8
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
9
|
+
JOIN documents imp_d ON c.document_id = imp_d.id
|
|
10
|
+
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
11
|
+
LEFT JOIN (
|
|
12
|
+
SELECT m2.symbol_id, c2.document_id
|
|
13
|
+
FROM mentions m2
|
|
14
|
+
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
15
|
+
WHERE m2.role = 1
|
|
16
|
+
GROUP BY m2.symbol_id
|
|
17
|
+
) sym_def ON sym_def.symbol_id = gs.id
|
|
18
|
+
LEFT JOIN documents def_d ON sym_def.document_id = def_d.id
|
|
19
|
+
WHERE imp_d.relative_path = ? AND m.role = 2
|
|
20
|
+
ORDER BY def_d.relative_path, gs.symbol`,t);return n.length>0?n.map(o=>({symbol:o.symbol,shortName:ee(o.symbol),importedName:Pr(ee(o.symbol)),localName:Pr(ee(o.symbol)),fromFile:o.from_file,source:"compiler"})):xe(e,t).map(o=>{let r=Wl(o.importedName,o.localName,o.kind),a=o.localName??o.importedName,i=o.importedName==="default"?a:o.importedName;return{symbol:r,shortName:r,importedName:i,localName:a,fromFile:o.sourcePath,source:"parsed-source"}})}function Pr(e){return e.slice(e.lastIndexOf(":")+1).replace(/\(\)$/u,"")||e}function Wl(e,t,n){return n==="namespace"&&e==="*"&&t?`* as ${t}`:n==="default"&&t?`default as ${t}`:n==="side-effect"?"(side effect import)":t&&t!==e?`${e} as ${t}`:e}function Te(e,t,n){let o=Wt(e,n);if(!o.match)return{matches:[],total:0,omitted:0};let r=[o.match,...o.candidates.map(i=>Wt(e,i.symbol).match)].filter(i=>i!==null),a=new Map;for(let i of r){let s=t.definitionsForFile(i.relativePath).find(l=>l.symbol===i.symbol);s&&a.set(s.symbol,s)}return{matches:[...a.values()],total:o.total,omitted:Math.max(0,o.total-a.size)}}function Hl(e){return{symbol:e.symbol,shortName:ee(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine}}function pe(e,t){let n=[t.kind,t.fromFile,t.fromSymbol??"",t.toFile,t.toSymbol??"",t.fromBoundaryParticipant?.observationId??"",t.toBoundaryParticipant?.observationId??"",t.fromSourceConstruct?Se(t.fromSourceConstruct):"",t.toSourceConstruct?Se(t.toSourceConstruct):"",t.runtimeBoundaryKey??"",t.line??""].join("\0");e.set(n,t)}function Ve(e){return{observationId:e.id,action:e.action,protocol:e.protocol,role:e.role,address:Or(e),file:e.source.file,line:e.source.startLine,endLine:e.source.endLine,ownerName:e.owner.name,ownerSymbol:e.owner.symbol}}function _t(e,t){let n=le(e,t.source.file);return Ye(e,t.source.file,0,Math.max(0,n.length-1),[t.source.startLine])}function Ar(e,t){let n=[...e.values()];for(let o of[t.owner,t.source]){let r=n.filter(a=>a.file===o.file&&a.startLine<=o.startLine&&a.endLine>=o.startLine).sort((a,i)=>a.endLine-a.startLine-(i.endLine-i.startLine)||a.startLine-i.startLine)[0];if(r)return r}return null}function kr(e,t,n,o,r){let a=[],i=n.get(e.id);i!==void 0&&i<=t&&a.push(i);for(let s of o.values()){if(s.depth>t)continue;let l=s.definition;$r(l,e)&&a.push(s.depth)}for(let s of r.values())s.depth>t||$r(s,e)&&a.push(s.depth);return a.length>0?Math.min(...a):null}function $r(e,t){let n=e.relativePath??e.file;return[t.owner,t.source].some(o=>n===o.file&&e.startLine<=o.startLine&&e.endLine>=o.startLine)}function Nn(e){return ue("runtime-boundary-participant",e)}function Vl(e,t,n){let o=de(e,n),r=de(t,n);return o.relativeDir!==r.relativeDir?!0:/(?:^|\/)(?:contracts?|schemas?|db\/schema)(?:\/|$)/u.test(t)}function Ql(e,t,n){return lt(e,n).id===lt(t,n).id}function Yl(e,t,n,o){if(e.referenceScope==="all")return!0;let r=lt(t,o).id;return[...n.values()].some(i=>i.promoteBoundaryImports&<(i.file,o).id===r)?!0:e.referenceScope!=="cross-workspace-or-forward"?!1:de(t,o).relativeDir!==de(e.definition.relativePath,o).relativeDir}function Xl(e,t){let n={none:0,"forward-regions":1,"cross-workspace-or-forward":2,all:3};return n[e]>=n[t]?e:t}function Zl(e,t){let n=wr.get(e);if(n)return n;let o=t.fileDependencyGraph(),r={fileGraph:o,reverseFileGraph:Jl(o),workspaces:ec(t.sourceFiles()),runtimeBoundaries:Vn(e)};return wr.set(e,r),r}function Jl(e){let t=new Map;for(let[n,o]of e)for(let r of o){let a=t.get(r)??new Set;a.add(n),t.set(r,a)}return t}function de(e,t){return t.find(n=>e===n.relativeDir||e.startsWith(`${n.relativeDir}/`))??{name:"root",relativeDir:""}}function ec(e){let t=new Set(["apps","packages","services","crates","libs","tools"]),n=new Map;for(let o of e){let r=o.split("/").filter(Boolean);if(r.length<3||!t.has(r[0]))continue;let a=`${r[0]}/${r[1]}`;n.set(a,{name:r[1],relativeDir:a})}return[...n.values()].sort((o,r)=>r.relativeDir.length-o.relativeDir.length)}function lt(e,t){let n=de(e,t),r=(n.relativeDir?e.slice(n.relativeDir.length+1):e).split("/").filter(Boolean);r[0]==="src"&&r.shift();let a=tc(r);return{id:`region:${n.relativeDir||"root"}:${a}`,label:`${n.name}:${a}`,workspace:n.name,structuralPath:a}}function tc(e){if(e.length<=1)return"root";let t=e[0],n=e[1];return["components","features","modules"].includes(t)?`${t}/${n}`:t==="db"?`${t}/${n}`:["contracts","routes","services"].includes(t)?t:t==="tests"||t==="__tests__"?"tests":t}function nc(e,t,n,o,r,a,i){let s=ye([...e.values()],m=>a.get(m.file).id),l=ye([...t.values()],m=>a.get(m.definition.relativePath).id),d=ye(n,m=>a.get(m.file).id),c=new Map;for(let m of o)for(let p of new Set([m.fromRegionId,m.toRegionId])){let g=c.get(p)??[];g.push(m),c.set(p,g)}let u=ye(r,m=>m.toRegionId),f=ye(r,m=>m.fromRegionId);return[...s.entries()].map(([m,p])=>{let g=a.get(p[0].file),b=l.get(m)??[],C=d.get(m)??[],S=c.get(m)??[],v=i.has(m),R=b.map(ic).sort(cc).slice(0,Ws),y=p.filter(N=>pt(N.file)==="test").length;return{id:m,label:g.label,workspace:g.workspace,structuralPath:g.structuralPath,minDepth:Math.min(...p.map(N=>N.depth)),fileCount:p.length,sourceFileCount:p.length-y,testFileCount:y,symbolCount:b.length,literalHitCount:C.length,anchorQueries:z([...C.map(N=>N.query),...b.flatMap(N=>[...N.anchorQueries])]),relationKinds:z(S.map(N=>N.kind)),incomingRegionIds:z((u.get(m)??[]).map(N=>N.fromRegionId)),outgoingRegionIds:z((f.get(m)??[]).map(N=>N.toRegionId)),memberCallCandidateRelationCount:S.filter(N=>N.evidence==="ast-member-import-candidate").length,notableSymbols:R,omittedNotableSymbols:Math.max(0,b.length-R.length),expanded:v,files:v?p.map(oc).sort(dc):[],symbols:v?b.map(rc).sort(uc):[],literalHits:v?[...C].sort(jr):[],relations:v?[...S].sort(Gr):[]}}).sort((m,p)=>m.minDepth-p.minDepth||m.label.localeCompare(p.label))}function oc(e){return{file:e.file,kind:pt(e.file),depth:e.depth,origins:z([...e.origins])}}function rc(e){return{symbol:e.definition.symbol,shortName:ee(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,depth:e.depth,origins:z([...e.origins]),anchorQueries:z([...e.anchorQueries]),referenceExpansion:e.referenceScope!=="none",referenceScope:e.referenceScope}}function ic(e){return{shortName:ee(e.definition.symbol),file:e.definition.relativePath,origins:z([...e.origins])}}function ac(e){return[...ye(e.filter(n=>n.fromRegionId!==n.toRegionId),n=>`${n.fromRegionId}\0${n.toRegionId}`).values()].map(n=>({fromRegionId:n[0].fromRegionId,toRegionId:n[0].toRegionId,kinds:z(n.map(o=>o.kind)),relationCount:n.length,fromFiles:z(n.map(o=>o.fromFile)),toFiles:z(n.map(o=>o.toFile)),fromSymbols:z(n.flatMap(o=>o.fromSymbol?[ee(o.fromSymbol)]:[])),toSymbols:z(n.flatMap(o=>o.toSymbol?[ee(o.toSymbol)]:[])),evidence:z(n.map(o=>o.evidence)),strengths:z(n.map(o=>o.strength??"unknown"))})).sort((n,o)=>n.fromRegionId.localeCompare(o.fromRegionId)||n.toRegionId.localeCompare(o.toRegionId))}function sc(e,t){return[...e.values()].map(n=>({kind:"external-import",name:n.name,fromRegionIds:z([...n.fromFiles].flatMap(o=>{let r=t.get(o);return r?[r.id]:[]})),fromFiles:z([...n.fromFiles])})).sort((n,o)=>n.name.localeCompare(o.name))}function lc(e,t,n,o){let r=e.kind==="literal"?t.filter(a=>a.query===e.query).map(a=>a.file):[...n.values()].filter(a=>a.anchorQueries.has(e.query)).map(a=>a.definition.relativePath);return z(r.map(a=>o.get(a)?.id).filter(a=>!!a))}function Or(e){return e.keyParts.map(t=>`${t.name}=${t.value}`).join(" ")}function z(e){return[...new Set(e)].sort()}function Gr(e,t){return e.fromRegionId.localeCompare(t.fromRegionId)||e.toRegionId.localeCompare(t.toRegionId)||e.kind.localeCompare(t.kind)||e.fromFile.localeCompare(t.fromFile)||e.toFile.localeCompare(t.toFile)||(e.line??-1)-(t.line??-1)}function cc(e,t){return Ke(e.origins)-Ke(t.origins)||e.shortName.localeCompare(t.shortName)}function dc(e,t){return e.depth-t.depth||e.file.localeCompare(t.file)}function uc(e,t){return e.depth-t.depth||e.file.localeCompare(t.file)||e.symbol.localeCompare(t.symbol)}function jr(e,t){return e.file.localeCompare(t.file)||e.line-t.line||e.query.localeCompare(t.query)}var mc={causal:["execution","runtime","dataflow","state","temporal"],structure:["contract","identity","ownership","dependencies"],complete:Ce},fc=2,gc=48,Kr=64,yc=5e4;function Gu(e,t,n={}){let o=ne([...t.symbols??[],...t.locations??[]]),r=ne(t.searches??[]);if(o.length===0&&r.length===0)throw new Error("evidence requires at least one positional symbol, --symbol, --at, or --search selector.");let a=n.view??"causal",i=hc(n.families,a),s=n.direction??"both",l=ne(n.subtypes??[]),d=n.connecting??!1,c=n.inventoryOnly??!1,u=ne(n.foldIds??[]),f=n.maxDepth??fc,m=n.maxEdges??gc;if(!Number.isSafeInteger(f)||f<0)throw new RangeError(`Evidence depth must be a non-negative safe integer; received ${f}.`);if(!Number.isSafeInteger(m)||m<=0)throw new RangeError(`Evidence max edges must be a positive safe integer; received ${m}.`);if(!["incoming","outgoing","both"].includes(s))throw new Error(`Unsupported graph evidence direction: ${s}.`);if(c&&u.length>0)throw new Error("Evidence fold materialization cannot be combined with --inventory-only.");let p=Dr(e,{symbols:o,searches:r,maxDepth:f,maxTopologyCharacters:yc,relations:bc(i)}),g=new Map(p.nodes.map($=>[$.id,$])),b=p.edges.filter($=>$.disposition==="emitted"||$.disposition==="folded").flatMap($=>Sc($,g)),C=b.filter($=>i.includes($.family)).filter($=>l.length===0||l.includes($.subtype)),S=new Set(p.anchors.flatMap($=>$.nodeIds));if(d&&S.size<2)throw new Error("Connecting evidence requires at least two resolved root nodes.");let v=new Set(C.map($=>$.id)),R=Mn(b,S,"incoming").filter($=>v.has($.id)),y=Mn(b,S,"outgoing").filter($=>v.has($.id)),N=Mn(b,S,"both").filter($=>v.has($.id)),L=Lc(i,l,R,y,N),x=s==="incoming"?R:s==="outgoing"?y:N,M=d?Fc(x,[...S],s):x,h=Ac(M,S,s),P=[...M].sort(($,B)=>kc($,B,h)),D=Ic(P,m),O=Nc(D,u),w=c?[]:u.length>0?P.filter($=>O.has($.id)):P,T=u.length>0?w:w.slice(0,m),I=u.length>0||c?[]:D,_=Math.max(0,w.length-T.length),A=p.frontiers.filter($=>$.disposition==="unsupported").length,j=p.coverage.status==="incomplete"?"incomplete":_>0?"bounded":"accounted";return{kind:"graph",view:n.families&&n.families.length>0?"custom":a,families:i,selection:{direction:s,subtypes:l,connecting:d,inventoryOnly:c,foldIds:u},targets:p.anchors.map($=>({kind:$.kind,query:$.query,status:$.status,nodeIds:[...$.nodeIds],omittedCandidates:$.omittedCandidates})),inventory:L,edges:T,folds:I,coverage:{status:j,topologyStatus:p.coverage.status,scope:p.coverage.scope,maxDepth:f,maxEdges:m,matchedEdges:P.length,eligibleEdges:w.length,returnedEdges:T.length,omittedEdges:_,frontierGroups:p.frontiers.length,unsupportedFrontiers:A,blindSpots:ne([...p.coverage.blindSpots,...Jn(i)]),explanation:c?`${P.length} relationship(s) match the explicit projection; only exact inventory counts were requested.`:u.length>0?`Every relationship in ${u.length} explicitly selected recoverable fold(s) was emitted.`:j==="accounted"?"Every selected relationship in the bounded topology was emitted.":j==="bounded"?`${_} selected relationship(s) were withheld by the explicit edge budget.`:p.coverage.explanation}}}function hc(e,t){let n=e&&e.length>0?e:mc[t],o=n.filter(r=>!Ce.includes(r));if(o.length>0)throw new Error(`Unsupported graph evidence family: ${o.join(", ")}.`);return ne(n)}function bc(e){return["call","contract-symbol","import","reference","runtime-boundary"]}function Sc(e,t){let n=t.get(e.fromNodeId),o=t.get(e.toNodeId);return!n||!o?[]:(e.semantics??[]).flatMap((r,a)=>{let i=xc(r);if(!i)return[];let s=eo(i,r.subtype);if(!s)throw new Error(`No graph relation provider contract is registered for ${i}/${r.subtype}.`);let l=Cc(e);return s.relation.evidenceStrengths.includes(l)?[{id:`${e.id}:${a}:${i}`,family:i,semanticFamily:r.family,subtype:r.subtype,from:qr(n),to:qr(o),sourceKind:e.kind,providerId:s.provider.id,supportCeiling:s.relation.supportCeiling,establishes:s.relation.establishes,nonClaims:[...s.relation.nonClaims],recoverWith:[...s.relation.recoverWith],evidenceStrength:l,evidenceMethods:ne(e.evidence.map(d=>d.method)),evidenceConstituents:vc(e.evidence),context:r.context?{...r.context}:null,attributes:r.attributes?{...r.attributes}:null}]:[]})}function vc(e){let t=new Map;for(let n of e)t.set(`${n.method}\0${n.strength}`,n);return[...t.values()].map(({method:n,strength:o})=>({method:n,strength:o}))}function xc(e){switch(e.family){case"control":return e.context?.crossesRuntimeBoundary===!0||e.subtype==="runtime-handoff"?"runtime":"execution";case"data":return"dataflow";case"state":return"state";case"temporal":return"temporal";case"contract":return"contract";case"identity":return e.subtype.startsWith("contains")||e.subtype.startsWith("owns-")?"ownership":e.subtype.startsWith("import")?"dependencies":"identity"}}function qr(e){let t=Ec(e);return{id:e.id,kind:e.kind,label:t?ee(t):e.label,symbol:t,location:e.location?{...e.location}:null}}function Ec(e){return e.kind!=="symbol"||!e.id.startsWith("symbol:")?null:decodeURIComponent(e.id.slice(7))}function Cc(e){let t=ne(e.evidence.map(n=>n.strength));return t.length===1?t[0]:t.includes("exact")&&t.every(n=>n==="exact"||n==="derived")?"mixed":t.includes("candidate")?"candidate":t.includes("unknown")||t.length===0?"unknown":"mixed"}function Mn(e,t,n){let o=Rn(e,n),r=new Map,a=new Map,i=[...t].sort();for(let s of i)a.set(s,0);for(let s=0;s<i.length;s+=1){let l=i[s],d=a.get(l);for(let c of o.get(l)??[])r.set(c.edge.id,c.edge),!a.has(c.next)&&(a.set(c.next,d+1),i.push(c.next))}return[...r.values()]}function Rn(e,t){let n=new Map,o=(r,a,i)=>{let s=n.get(r)??[];s.push({edge:i,next:a}),n.set(r,s)};for(let r of e)t!=="incoming"&&o(r.from.id,r.to.id,r),t!=="outgoing"&&o(r.to.id,r.from.id,r);for(let r of n.values())r.sort((a,i)=>a.edge.id.localeCompare(i.edge.id)||a.next.localeCompare(i.next));return n}function Lc(e,t,n,o,r){let a=new Set;for(let c of[...n,...o,...r])a.add(`${c.family}\0${c.subtype}`);if(t.length>0)for(let c of e)for(let u of t)a.add(`${c}\0${u}`);let i=c=>{let u=new Map;for(let f of c){let m=`${f.family}\0${f.subtype}`;u.set(m,(u.get(m)??0)+1)}return u},s=i(n),l=i(o),d=i(r);return[...a].map(c=>{let[u,f]=c.split("\0");return{family:u,subtype:f,incoming:s.get(c)??0,outgoing:l.get(c)??0,both:d.get(c)??0}}).sort((c,u)=>Ce.indexOf(c.family)-Ce.indexOf(u.family)||c.subtype.localeCompare(u.subtype))}function Ic(e,t){let n=e.slice(t),o=new Map;for(let i of n){let s=wc(i),l=`${i.family}\0${s}`,d=o.get(l)??[];d.push(i),o.set(l,d)}let r=new Map(e.map((i,s)=>[i.id,s+1])),a=[];for(let[i,s]of[...o].sort(([l],[d])=>l.localeCompare(d))){let[l,d]=i.split("\0"),c=[...s].sort((u,f)=>u.id.localeCompare(f.id));for(let u=0;u<c.length;u+=Kr){let f=c.slice(u,u+Kr),m=f.map(C=>C.id),p=ne(f.map(C=>C.subtype)).sort(),g=p.length===1?p[0]:"mixed",b=[...new Set(f.flatMap(C=>[C.from.id,C.to.id]))].sort();a.push({id:Tc(l,p.join("\0"),m),mode:Mc(f),family:l,subtype:g,subtypes:p,region:d,edgeCount:m.length,edgeIds:m,nodeIds:b,minimumMaxEdges:Math.max(...m.map(C=>r.get(C)??e.length))})}}return a.sort((i,s)=>Ce.indexOf(i.family)-Ce.indexOf(s.family)||(i.region??"").localeCompare(s.region??"")||i.id.localeCompare(s.id))}function wc(e){let t=e.from.location?.file??`kind:${e.from.kind}`,n=e.to.location?.file??`kind:${e.to.kind}`;return t===n?t:`${t} -> ${n}`}function Nc(e,t){if(t.length===0)return new Set;let n=new Map(e.map(r=>[r.id,r])),o=t.filter(r=>!n.has(r));if(o.length>0){let r=e.map(a=>a.id).sort();throw new Error(`Unknown evidence fold ${o.join(", ")} for this projection. Available folds: ${r.join(", ")||"(none)"}.`)}return new Set(t.flatMap(r=>n.get(r).edgeIds))}function Mc(e){let t=new Map,n=new Map,o=new Set;for(let a of e){o.add(a.from.id),o.add(a.to.id);let i=t.get(a.from.id)??new Set;i.add(a.to.id),t.set(a.from.id,i);let s=n.get(a.to.id)??new Set;s.add(a.from.id),n.set(a.to.id,s)}return Rc(o,t)?"scc":[...o].every(a=>(n.get(a)?.size??0)<=1&&(t.get(a)?.size??0)<=1)?"linear":"topology"}function Rc(e,t){let n=new Set,o=new Set,r=a=>{if(n.has(a))return!0;if(o.has(a))return!1;n.add(a);for(let i of t.get(a)??[])if(r(i))return!0;return n.delete(a),o.add(a),!1};return[...e].some(r)}function Tc(e,t,n){return`fold:${pc("sha256").update([e,t,...n].join("\0")).digest("hex").slice(0,16)}`}function Fc(e,t,n){let o=new Map,r=[...new Set(t)].sort();for(let a=0;a<r.length;a+=1)for(let i=a+1;i<r.length;i+=1)for(let s of Pc(e,r[a],r[i],n))o.set(s.id,s);return[...o.values()]}function Pc(e,t,n,o){let r=Rn(e,o),a=new Map([[t,0]]),i=new Map,s=[t];for(let d=0;d<s.length;d+=1){let c=s[d],u=a.get(c);if(c!==n)for(let f of r.get(c)??[])a.has(f.next)||(a.set(f.next,u+1),i.set(f.next,{node:c,edge:f.edge}),s.push(f.next))}if(!a.has(n))return[];let l=[];for(let d=n;d!==t;){let c=i.get(d);if(!c)return[];l.push(c.edge),d=c.node}return l.reverse()}function Ac(e,t,n){let o=Rn(e,n),r=new Map,a=[...t];for(let i of t)r.set(i,0);for(let i=0;i<a.length;i+=1){let s=a[i],l=r.get(s);for(let{next:d}of o.get(s)??[])r.has(d)||(r.set(d,l+1),a.push(d))}return r}function kc(e,t,n){return zr(e,n)-zr(t,n)||Ur(e)-Ur(t)||Wr(e.evidenceStrength)-Wr(t.evidenceStrength)||Ce.indexOf(e.family)-Ce.indexOf(t.family)||e.from.label.localeCompare(t.from.label)||e.to.label.localeCompare(t.to.label)||e.subtype.localeCompare(t.subtype)||e.id.localeCompare(t.id)}function zr(e,t){return Math.min(t.get(e.from.id)??Number.MAX_SAFE_INTEGER,t.get(e.to.id)??Number.MAX_SAFE_INTEGER)}function Ur(e){let t=[e.from,e.to].filter(n=>n.kind==="structural-region").length;return t===2?2:t}function Wr(e){switch(e){case"exact":return 0;case"mixed":return 1;case"derived":return 2;case"candidate":return 3;case"unknown":return 4}}export{Gu as a};
|
|
21
|
+
//# sourceMappingURL=chunk-DXEJ4FLZ.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as r,b as u}from"./chunk-H5EXS3HM.js";import{r as c}from"./chunk-XIPGCT3D.js";var g=["typescript","javascript","java","scala","kotlin","rust","python","ruby","go","cpp","c","csharp","vb","dart","php","clojure"],R=["entry-surface","generated-code","compatibility-shim","reflection-or-registration","test-fixture","intentional-twin","historical-coupling-ended","detector-counterexample"];var p=2,a=3;var d=new Set(g);function P(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch(l){return{kind:"malformed",reason:`invalid JSON: ${C(l)}`}}if(!r(t))return{kind:"malformed",reason:"metadata must be a JSON object"};let n=t.version;if(!Number.isInteger(n))return{kind:"malformed",reason:"version must be an integer"};if(n!==p&&n!==a)return{kind:"unsupported",version:n,direction:n<p?"older":"future"};let o=m(t,n);if(o)return{kind:"malformed",reason:o};let i=t,s={metadata:i,capabilities:f(i)};return n===p?{kind:"legacy",...s,metadata:i}:{kind:"supported",...s,metadata:i}}function L(e){return e.kind==="legacy"||e.kind==="supported"?e.metadata:null}function j(e){if(e.kind!=="legacy"&&e.kind!=="supported"||!e.capabilities.stableGenerationIdentity)return null;let t=e.metadata;return JSON.stringify({version:t.version,status:t.status,updatedAt:t.updatedAt,fingerprint:t.fingerprint,indexedLanguages:t.indexedLanguages,scipCompanion:t.scipCompanion,sqliteLayoutVersion:t.version===a?t.sqliteLayoutVersion:void 0})}function f(e){let t=e.fingerprint!==void 0,n=r(e.fingerprint),o=e.indexedLanguages!==void 0,i=e.status==="complete",s=e.version===a?e:null;return{usableForQuery:o,usableForEvidenceCache:t,publishableGeneration:i&&n&&o,stableGenerationIdentity:i&&t&&typeof e.updatedAt=="string",languageShardReuse:!!s?.languageFingerprints,typescriptProjectShardReuse:!!s?.typescriptProjectShards}}function m(e,t){if(e.status!=="complete"&&e.status!=="partial")return"status must be complete or partial";if(e.updatedAt!==void 0&&!u(e.updatedAt))return"updatedAt must be a valid timestamp";for(let n of["requestedLanguages","indexedLanguages"])if(e[n]!==void 0&&!y(e[n]))return`${n} must contain unique supported languages`;return e.skipped!==void 0&&!b(e.skipped)?"skipped must contain supported language/reason pairs":e.scipCompanion!==void 0&&e.scipCompanion!=="current"&&e.scipCompanion!=="deferred"?"scipCompanion must be current or deferred":t===a&&e.sqliteLayoutVersion!==void 0&&(!Number.isSafeInteger(e.sqliteLayoutVersion)||e.sqliteLayoutVersion<1)?"sqliteLayoutVersion must be a positive safe integer":t===a&&e.languageFingerprints!==void 0&&!x(e.languageFingerprints)?"languageFingerprints must map supported languages to fingerprint objects":t===a&&e.typescriptProjectShards!==void 0&&!S(e.typescriptProjectShards)?"typescriptProjectShards must map project names to file fingerprints":null}function v(e){return e.version===a&&e.sqliteLayoutVersion===1}function y(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string"&&d.has(t))?!1:new Set(e).size===e.length}function b(e){return Array.isArray(e)&&e.every(t=>r(t)&&typeof t.language=="string"&&d.has(t.language)&&typeof t.reason=="string")}function x(e){return r(e)&&Object.entries(e).every(([t,n])=>d.has(t)&&r(n))}function S(e){return r(e)&&Object.values(e).every(t=>r(t)&&Array.isArray(t.files)&&t.files.every(c))}function C(e){return e instanceof Error?e.message:String(e)}export{g as a,R as b,a as c,P as d,L as e,j as f,f as g,v as h};
|
|
2
|
+
//# sourceMappingURL=chunk-DXYMTQZ4.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{a as ie}from"./chunk-IHGK3SZ7.js";import{a as oe}from"./chunk-XNF5T4T2.js";import{b as D}from"./chunk-ZQUNCTEZ.js";import{a as te}from"./chunk-IGBQVEHE.js";import{b as ne}from"./chunk-3YETOKNO.js";import{a as W,b as ee}from"./chunk-K2DZCH2K.js";import{b as Q}from"./chunk-GTZFKDP3.js";import{f as V}from"./chunk-DGM2RJ3I.js";import{a as H}from"./chunk-VJAD5WX5.js";import{a as q}from"./chunk-4ZCLDH6T.js";import{b as Y}from"./chunk-47WX6UC4.js";import{a as X}from"./chunk-BYXWXLKM.js";import{d as Z}from"./chunk-ARGPDW2Y.js";import{b as K}from"./chunk-QH5Q6M5C.js";import{a as J}from"./chunk-XKM5D2XS.js";import{a as w}from"./chunk-MLTSTKXD.js";import{a as G}from"./chunk-HYU4W353.js";import{a as j,c as z}from"./chunk-7MUHSZGN.js";import{b as $}from"./chunk-HW7FASEL.js";import{e as P,t as A}from"./chunk-7Z4GMCHM.js";import{t as U}from"./chunk-JSHDCVUM.js";function se(n){let e=new Set(n.filter(o=>o.definition?.isFunctionLike).map(o=>`${o.role}:${o.definition.relativePath}`));return n.flatMap(o=>o.definition?!o.definition.isFunctionLike&&e.has(`${o.role}:${o.definition.relativePath}`)?[]:[{definition:o.definition,role:o.role}]:[])}var me=6,I=10,M=3,T=8,de=.7,re=24,_=200,fe=12,le=80,ce=600;function Ze(n,e,o={}){let l=o.impactDepth??3,a=o.sliceDepth??3,u=o.semantic,c=Ee(e)?Ce(n,e):null,S=c?c.primary?.symbol??null:e,{traceResult:r,callGraphResult:C,complexityResult:R,dataflowResult:t,backwardSliceResult:d,forwardSliceResult:s,affectedResults:p,reuseCandidates:b,targetSymbol:i,affectedConsumerReuse:y}=ye(n,S,o,l,a),h=f("change-surface",e,()=>q(n,e,{semantic:u}),m=>({symbols:m?.symbols.length??0,externalConsumers:m?.totalExternalConsumers??0})),x=f("system",e,()=>oe(n,e),m=>({files:m.files.length,symbols:m.symbols.length})),L=x.files.length===1,B=f("deps",e,()=>L?x.dependsOn.map(m=>({relativePath:m,edgeBasis:"symbol-references",evidence:"cross-file SCIP references plus resolved source imports"})):W(n,e),m=>({files:m.length,reusedSystem:L})),k=f("rdeps",e,()=>L?x.dependedOnBy.map(m=>({relativePath:m,edgeBasis:"symbol-references",evidence:"cross-file SCIP references plus resolved source imports"})):ee(n,e),m=>({files:m.length,reusedSystem:L})),N=f("surface",e,()=>ie(n,e),m=>({consumers:m.length})),g={symbol:r.definitions.length>0||r.referencedBy.length>0||C!==null||R!==null||t!==null||d!==null||s!==null||p.length>0,file:h!==null||B.length>0||k.length>0,module:x.files.length>0||x.symbols.length>0||N.length>0},E=[];c&&!c.primary&&c.callableCount>1&&E.push(`File target has ${c.callableCount} callable symbols; use one callable name for compiler-resolved flow.`);let F=[...new Set(r.referencedBy.map(m=>m.relativePath))];F.length>0&&F.every(m=>$(m)==="test")&&E.push("Only test references were found for this target. For replacement or retirement work, map the currently wired owner or one production entry point before planning; this target does not describe the live affected surface."),!g.symbol&&!g.file&&!g.module&&E.push("No symbol, file, or module matched target.");let O=h?.file??r.definitions[0]?.relativePath??null;return{target:e,...c?.primary?{primaryCallable:{symbol:c.primary.symbol,shortName:P(c.primary.symbol),file:c.primary.relativePath}}:{},matched:g,history:f("history",O??e,()=>ge(n,O,o.gitHead)),trace:pe(r),callGraph:C,complexity:R,dataflow:t,backwardSlice:d,forwardSlice:s,affected:p,changeSurface:h,deps:B,rdeps:k,system:x,surface:N,reuseCandidates:b,affectedConsumerReuse:y,sourcePacket:be(n,i,r,y,b),warnings:E}}function ye(n,e,o,l,a){let u=o.semantic,c=e?f("trace",e,()=>ne(n,e,{semantic:u,referenceContext:fe}),i=>({definitions:i.definitions.length,references:i.referencedBy.length})):{definitions:[],referencedBy:[],claimSupport:null},S=e?f("call-graph",e,()=>H(n,e,{semantic:u}),i=>({callers:i?.callers.length??0,callees:i?.callees.length??0})):null,r=e?f("complexity",e,()=>J(n,e,{semantic:u}),i=>({callees:i?.calleeCount??0})):null,C=e?f("dataflow",e,()=>Q(n,e,{semantic:u}),i=>({references:i?.usageSites.length??0,producers:i?.producers.length??0,consumers:i?.consumers.length??0})):null,R=e?f("backward-slice",e,()=>D(n,e,{direction:"backward",maxDepth:a,semantic:u}),i=>({maxDepth:a,connectedSymbols:i?.connectedSymbols.length??0})):null,t=e?f("forward-slice",e,()=>D(n,e,{direction:"forward",maxDepth:a,semantic:u}),i=>({maxDepth:a,connectedSymbols:i?.connectedSymbols.length??0})):null,d=e?f("affected",e,()=>G(n,e,{maxDepth:l,scope:o.scope}),i=>({maxDepth:l,affectedSymbols:i.length})):[],s=e?f("reuse-candidates",e,()=>w(n,e,{minSimilarity:.4,limit:5,semantic:u,sourceCandidateMode:"target-pruned"}),i=>({candidates:i.length,direct:i.filter(y=>y.actionTier==="direct").length})):[],p=e?j(n,e)?.symbol??null:null,b=e?f("affected-consumer-reuse",e,()=>Se(c,p,i=>w(n,i,{minSimilarity:.4,limit:I,semantic:u,sourceCandidateMode:"target-pruned"}),{consumerLimit:me,perConsumerSearchLimit:I,perConsumerCandidateLimit:M,candidateLimit:T}),i=>({totalConsumers:i.coverage.totalConsumers,analyzedConsumers:i.coverage.analyzedConsumers,candidates:i.candidates.length})):Le();return{traceResult:c,callGraphResult:S,complexityResult:r,dataflowResult:C,backwardSliceResult:R,forwardSliceResult:t,affectedResults:d,reuseCandidates:s,targetSymbol:p,affectedConsumerReuse:b}}function pe(n){return{definitions:n.definitions,referencedBy:n.referencedBy.map(e=>({relativePath:e.relativePath,line:e.line,enclosingSymbol:e.enclosingSymbol,enclosingShort:e.enclosingShort}))}}function Ce(n,e){let o=K(n,e);if(o.length!==1)return{primary:null,callableCount:0};let l=A(n,o[0]).filter(c=>c.isFunctionLike),a=l.filter(c=>c.enclosingSymbol===null),u=a.length>0?a:l;return{primary:u.length===1?u[0]:null,callableCount:u.length}}function be(n,e,o,l,a){let u=[...e?[{definition:ae(n,e),role:"target"}]:[],...[...l.candidates.map(t=>t.candidate),...a].map(t=>({definition:ae(n,t.symbolB),role:"reuse-candidate"}))],c=new Map;for(let t of se(u)){if(c.has(t.definition.symbol))continue;let d=t.role==="target"?_:le,s=t.definition.endLine<=t.definition.startLine?Z(n,t.definition.relativePath,t.definition.startLine,d):null,p=s?.unitType?s.source:V(n,t.definition);if(!p)continue;let b=p.split(`
|
|
2
|
+
`),i=Math.min(b.length,d),y=s?.unitType?s.startLine:t.definition.startLine;c.set(t.definition.symbol,{role:t.role,symbol:t.definition.symbol,shortName:P(t.definition.symbol),file:t.definition.relativePath,startLine:y,endLine:y+i-1,source:b.slice(0,i).join(`
|
|
3
|
+
`),omittedLines:(s?.unitType?s.omittedLines:0)+Math.max(0,b.length-i)})}let S=new Map;for(let t of o.referencedBy){if(t.source===void 0||t.source===null||t.sourceStartLine===void 0||t.sourceStartLine===null||t.sourceEndLine===void 0||t.sourceEndLine===null)continue;let d=`${t.relativePath}:${t.sourceStartLine}-${t.sourceEndLine}`,s=S.get(d);if(s){s.focusLines=[...new Set([...s.focusLines??[],t.line])].sort((p,b)=>p-b);continue}S.set(d,{role:"consumer",symbol:t.enclosingSymbol??`${t.relativePath}:${t.line}`,shortName:t.enclosingShort,file:t.relativePath,startLine:t.sourceStartLine,endLine:t.sourceEndLine,source:t.source,omittedLines:0,focusLines:[t.line]})}let r=[...[...c.values()].filter(t=>t.role==="target"),...S.values(),...[...c.values()].filter(t=>t.role==="reuse-candidate")],C=[],R=ce;for(let t of r){if(C.length>=re||R<=0)break;let d=t.source.split(`
|
|
4
|
+
`),s=Math.min(d.length,R);C.push({...t,endLine:t.startLine+s-1,source:d.slice(0,s).join(`
|
|
5
|
+
`),omittedLines:t.omittedLines+Math.max(0,d.length-s),...t.focusLines?{focusLines:t.focusLines.filter(p=>p<=t.startLine+s-1)}:{}}),R-=s}return{slices:C,candidateSlices:r.length,omittedSlices:Math.max(0,r.length-C.length),maxSlices:re,maxLinesPerSlice:_,maxTotalLines:ce,targetLineLimit:_,consumerContextLines:fe,reuseLineLimit:le}}function ae(n,e){let o=z(n,e);return o?A(n,o.relativePath).find(l=>l.symbol===e)??null:null}function Se(n,e,o,l={}){let a=v(l.consumerLimit,me),u=v(l.perConsumerSearchLimit,I),c=v(l.perConsumerCandidateLimit,M),S=v(l.candidateLimit,T),r=Re(n),C=r.slice(0,a),R=new Set(r.map(s=>s.symbol));e&&R.add(e);let t=new Map;for(let s of C){let p=o(s.symbol).slice(0,u),b=0;for(let i of p){let y=he(i,s.symbol);if(!y||R.has(y.symbolB))continue;let h=t.get(y.symbolB);if(h?(h.consumers.some(x=>x.symbol===s.symbol)||h.consumers.push(s),y.similarity>h.candidate.similarity&&(h.candidate=y)):t.set(y.symbolB,{candidate:y,consumers:[s]}),b+=1,b>=c)break}}let d=[...t.values()].filter(s=>s.candidate.actionTier==="direct"||s.candidate.similarity>=de||s.consumers.length>1).sort(xe).slice(0,S);return{candidates:d,coverage:{totalConsumers:r.length,analyzedConsumers:C.length,omittedConsumers:Math.max(0,r.length-C.length),perConsumerSearchLimit:u,perConsumerCandidateLimit:c,candidateLimit:S,returnedCandidates:d.length}}}function Re(n){let e=new Map;for(let o of n.referencedBy){if(!o.enclosingSymbol)continue;let l=e.get(o.enclosingSymbol);if(l){l.referenceCount+=1;continue}e.set(o.enclosingSymbol,{symbol:o.enclosingSymbol,shortName:P(o.enclosingSymbol)||o.enclosingShort,file:o.relativePath,referenceCount:1})}return[...e.values()].sort((o,l)=>l.referenceCount-o.referenceCount||o.symbol.localeCompare(l.symbol))}function he(n,e){return n.symbolA===e?n:n.symbolB!==e?null:{...n,symbolA:n.symbolB,shortNameA:n.shortNameB,fileA:n.fileB,symbolB:n.symbolA,shortNameB:n.shortNameA,fileB:n.fileA,uniqueToA:n.uniqueToB,uniqueToB:n.uniqueToA}}function xe(n,e){let o=ue(e.candidate.actionTier)-ue(n.candidate.actionTier);if(o!==0)return o;let l=e.consumers.length-n.consumers.length;if(l!==0)return l;let a=e.candidate.similarity-n.candidate.similarity;return a!==0?a:n.candidate.symbolB.localeCompare(e.candidate.symbolB)}function ue(n){return n==="direct"?1:0}function v(n,e){return typeof n=="number"&&Number.isFinite(n)?Math.max(1,Math.floor(n)):e}function Le(){return{candidates:[],coverage:{totalConsumers:0,analyzedConsumers:0,omittedConsumers:0,perConsumerSearchLimit:I,perConsumerCandidateLimit:M,candidateLimit:T,returnedCandidates:0}}}function f(n,e,o,l=()=>({})){let a;return U(`context.${n}`,()=>(a=o(),a),()=>({target:e,...l(a)}))}function ge(n,e,o){let l={available:!1,file:e,churn:null,coChangePartners:[],suppressionsInFile:0};if(!e)return l;let a=X(n,o?{head:o}:{}),u=f("history.churn",e,()=>a.fileChurn(),r=>({files:r?.size??0}));if(!u)return l;let c=f("history.co-change",e,()=>Y(n,e,{limit:5,...o?{head:o}:{}}),r=>({commits:r.commitsAnalyzed,partners:r.findings.length})),S=f("history.suppressions",e,()=>te(n).byFile.get(e)??0,r=>({suppressions:r}));return{available:!0,file:e,churn:u.get(e)??{changes:0,fixChanges:0,lastChangedAt:0},coChangePartners:c.findings.map(r=>({file:r.fileA===e?r.fileB:r.fileA,together:r.together,confidence:r.confidence,subjectContext:r.subjectContext})),suppressionsInFile:S}}function Ee(n){return n.includes("/")||n.includes("\\")||/\.[A-Za-z0-9]+(?::\d+(?:-\d+)?)?$/.test(n)}export{Ze as a,Se as b};
|
|
6
|
+
//# sourceMappingURL=chunk-DZA7MQMU.js.map
|