codebaseiq 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/dist/augment-vue-worker.js +1 -1
- package/dist/{chunk-DQMDCD24.js → chunk-27PHVDKL.js} +2 -2
- package/dist/{chunk-ZMI2JSX2.js → chunk-2DMVFAY7.js} +2 -2
- package/dist/{chunk-5PUWMSDU.js → chunk-2E6BTWER.js} +2 -2
- package/dist/{chunk-YESXMKX3.js → chunk-2F5ERMNI.js} +2 -2
- package/dist/chunk-2VKB5CMA.js +60 -0
- package/dist/{chunk-NNJ2KZZG.js → chunk-327YK6TB.js} +4 -4
- package/dist/chunk-347TXATM.js +2 -0
- package/dist/{chunk-VEXUL62T.js → chunk-35YYZD3D.js} +2 -2
- package/dist/chunk-36WRYYTE.js +3 -0
- package/dist/chunk-37TKC6MB.js +2 -0
- package/dist/{chunk-FAJQ7LWY.js → chunk-3AC56WAR.js} +2 -2
- package/dist/{chunk-JE3WZ6II.js → chunk-3NUZVLR7.js} +2 -2
- package/dist/{chunk-UZGZB3VB.js → chunk-3XFJUWJE.js} +2 -2
- package/dist/{chunk-OVTS4DKB.js → chunk-4AOOSCZ7.js} +2 -2
- package/dist/{chunk-LU3BMVH2.js → chunk-4IFISPQW.js} +2 -2
- package/dist/chunk-4NHWNAWQ.js +11 -0
- package/dist/chunk-4O52YNKL.js +5 -0
- package/dist/{chunk-HPJRBHVT.js → chunk-54K6556S.js} +2 -2
- package/dist/{chunk-HRWGYWRJ.js → chunk-57GCCPLS.js} +2 -2
- package/dist/{chunk-J77SU6VA.js → chunk-57KEZDPT.js} +2 -2
- package/dist/{chunk-OFBE4NGP.js → chunk-57KFVPVZ.js} +2 -2
- package/dist/{chunk-WOQBZPIF.js → chunk-5BDK6QC3.js} +2 -2
- package/dist/{chunk-7MGU3HPH.js → chunk-5IO2APSS.js} +2 -2
- package/dist/chunk-5NJPH3QZ.js +61 -0
- package/dist/{chunk-GW6Z3WGY.js → chunk-5WXOEJ4G.js} +2 -2
- package/dist/chunk-5XEVXVTK.js +3 -0
- package/dist/{chunk-RR7SX44N.js → chunk-6OVNYYY4.js} +2 -2
- package/dist/{chunk-ZV3JV5G5.js → chunk-6SDEQTVY.js} +2 -2
- package/dist/{chunk-EF2R3WNQ.js → chunk-6URCE5QY.js} +2 -2
- package/dist/{chunk-UCD3H3UZ.js → chunk-6ZV5EDUT.js} +2 -2
- package/dist/{chunk-C6SBF2WH.js → chunk-77GHPR2R.js} +2 -2
- package/dist/{chunk-YVCIMIOC.js → chunk-7R64XY4Y.js} +2 -2
- package/dist/{chunk-VXYS3FZD.js → chunk-7Z7HCZ7J.js} +2 -2
- package/dist/{chunk-CO5R3UNA.js → chunk-A67HT5FR.js} +2 -2
- package/dist/{chunk-UDS562V4.js → chunk-A7XQT7MH.js} +2 -2
- package/dist/{chunk-RDBI2RXU.js → chunk-ACZDU5GK.js} +2 -2
- package/dist/{chunk-FETNQCFO.js → chunk-AM5SUGHF.js} +2 -2
- package/dist/{chunk-NNOKTMZT.js → chunk-B2E3HZ2A.js} +2 -2
- package/dist/{chunk-CVYSU6BX.js → chunk-BH5CE4LN.js} +2 -2
- package/dist/chunk-BLKYYQ7C.js +543 -0
- package/dist/{chunk-4WKDMDEW.js → chunk-BX2U3QQV.js} +2 -2
- package/dist/{chunk-ZKX2FRS6.js → chunk-CANBLFVQ.js} +2 -2
- package/dist/{chunk-SMRBZ6EC.js → chunk-CCRZLRWJ.js} +2 -2
- package/dist/chunk-CDWSLAPN.js +21 -0
- package/dist/chunk-CIVYHK7U.js +22 -0
- package/dist/{chunk-L57ZKWVG.js → chunk-CMXW7MFV.js} +2 -2
- package/dist/{chunk-T3DGWPXM.js → chunk-CSZOQ7YO.js} +2 -2
- package/dist/{chunk-ZZXSWSN6.js → chunk-CWMHWD56.js} +2 -2
- package/dist/{chunk-6NW7MU72.js → chunk-CZEIHYMP.js} +2 -2
- package/dist/{chunk-DO6WQD2T.js → chunk-D62CTZX6.js} +2 -2
- package/dist/{chunk-XWUOUWYI.js → chunk-DFPAZXLU.js} +2 -2
- package/dist/{chunk-MOVBWNIP.js → chunk-DKJXK3HA.js} +2 -2
- package/dist/{chunk-XMQ23E27.js → chunk-DLC6JDN7.js} +2 -2
- package/dist/chunk-DUKHVPU5.js +4 -0
- package/dist/{chunk-ID63777H.js → chunk-DVYG3JTA.js} +2 -2
- package/dist/{chunk-NE6IU5ZD.js → chunk-EFFMFK7C.js} +2 -2
- package/dist/{chunk-I2T2LLK2.js → chunk-EM5UHLAM.js} +2 -2
- package/dist/chunk-EN4AHLL3.js +3 -0
- package/dist/chunk-EXMVF3JR.js +3 -0
- package/dist/{chunk-SWHMHUKF.js → chunk-FEBLLMTL.js} +2 -2
- package/dist/chunk-FIXYHQ3W.js +3 -0
- package/dist/{chunk-RKEJ6VTF.js → chunk-FLLXYUOL.js} +2 -2
- package/dist/{chunk-KWVHSKHK.js → chunk-FPDL2TUB.js} +2 -2
- package/dist/chunk-FQA3KIFX.js +17 -0
- package/dist/chunk-FWY2PRIF.js +3 -0
- package/dist/chunk-FY5V4V4F.js +2 -0
- package/dist/chunk-G2XUZCF2.js +88 -0
- package/dist/{chunk-QHRNXP3C.js → chunk-GXVDTHFC.js} +2 -2
- package/dist/{chunk-6MUIJMVL.js → chunk-H3CKAL6P.js} +2 -2
- package/dist/chunk-H5QXP63L.js +2 -0
- package/dist/{chunk-VUIYB2V3.js → chunk-HBQGKMM3.js} +2 -2
- package/dist/{chunk-PYAB5SM6.js → chunk-HBXZAGY6.js} +2 -2
- package/dist/{chunk-NNO6A2PO.js → chunk-HCMQZPEO.js} +2 -2
- package/dist/{chunk-Q65CQ4XL.js → chunk-HHBBGWES.js} +2 -2
- package/dist/{chunk-GTXSJDCO.js → chunk-HIEXRDJF.js} +2 -2
- package/dist/{chunk-4FC325IF.js → chunk-HYKSLTAR.js} +2 -2
- package/dist/{chunk-XLQ3GLWZ.js → chunk-I2KP4AGR.js} +2 -2
- package/dist/chunk-I5FCDTK2.js +2 -0
- package/dist/{chunk-QKPLA6IC.js → chunk-I645ZF75.js} +2 -2
- package/dist/{chunk-FDGD5AB5.js → chunk-IBM3F2BJ.js} +2 -2
- package/dist/{chunk-Q72QSKXC.js → chunk-IEL6Q5W3.js} +38 -38
- package/dist/{chunk-NCZUNH3E.js → chunk-IGQQUENU.js} +12 -12
- package/dist/chunk-IGYAZPRX.js +4 -0
- package/dist/chunk-IOVPAZWP.js +3 -0
- package/dist/{chunk-OL6KJP3N.js → chunk-IVJJNVSX.js} +2 -2
- package/dist/{chunk-AKB7V7TV.js → chunk-IWAMYGPN.js} +2 -2
- package/dist/chunk-IYBIBMPF.js +90 -0
- package/dist/{chunk-IOP6FWIM.js → chunk-J24VICI5.js} +2 -2
- package/dist/{chunk-C7QOQX32.js → chunk-JN5LIBT3.js} +2 -2
- package/dist/{chunk-O6QTXQPJ.js → chunk-JOALNFY3.js} +2 -2
- package/dist/{chunk-GCHRX4YW.js → chunk-JUO3Z644.js} +2 -2
- package/dist/{chunk-BJ6SQAEN.js → chunk-JXHLB7TP.js} +2 -2
- package/dist/{chunk-IJ4HMYBE.js → chunk-JYX5UZSZ.js} +2 -2
- package/dist/chunk-K2O7SBAU.js +2 -0
- package/dist/{chunk-OLF4MA5W.js → chunk-K5G7SPAG.js} +2 -2
- package/dist/{chunk-YSNONTJ2.js → chunk-KDYQQJ6X.js} +2 -2
- package/dist/{chunk-7NVGT435.js → chunk-KM4QRWI5.js} +2 -2
- package/dist/{chunk-HKQUXIFO.js → chunk-KNV5VFDV.js} +2 -2
- package/dist/chunk-L3YSDLNB.js +2 -0
- package/dist/{chunk-EZNMUY67.js → chunk-LAGDJXFY.js} +2 -2
- package/dist/{chunk-ENCCHKM6.js → chunk-LY2NB5XR.js} +4 -4
- package/dist/chunk-M4EVGA5S.js +14 -0
- package/dist/chunk-M7LAIM77.js +127 -0
- package/dist/{chunk-BVAJLC5A.js → chunk-MRGTCMDK.js} +2 -2
- package/dist/{chunk-OZYRSMSH.js → chunk-MT5W4DUG.js} +2 -2
- package/dist/{chunk-VE5AVNMP.js → chunk-MTMF4N7F.js} +2 -2
- package/dist/chunk-N3Q3AWGW.js +545 -0
- package/dist/{chunk-TXXOEMZJ.js → chunk-NDGTJHQN.js} +2 -2
- package/dist/chunk-NIO346UL.js +2 -0
- package/dist/chunk-NJA4MMBD.js +2 -0
- package/dist/{chunk-7FND7D7N.js → chunk-NK76RSB6.js} +2 -2
- package/dist/{chunk-H3LGFZVK.js → chunk-NTRW52UR.js} +2 -2
- package/dist/{chunk-JOIRNPPY.js → chunk-OJFLPVBP.js} +2 -2
- package/dist/{chunk-KMITESMT.js → chunk-OMBRP7BB.js} +2 -2
- package/dist/{chunk-UP3BUZR5.js → chunk-OVKZM2XI.js} +2 -2
- package/dist/{chunk-MVB3DAEY.js → chunk-PARCKE3Q.js} +2 -2
- package/dist/{chunk-CAUCPUOF.js → chunk-PFPHS4NO.js} +2 -2
- package/dist/chunk-PHPQ24UG.js +22 -0
- package/dist/chunk-PLZXWZHY.js +77 -0
- package/dist/{chunk-34WBMAYK.js → chunk-PNVZIJ57.js} +2 -2
- package/dist/{chunk-SYDJMPES.js → chunk-QKVTWODE.js} +2 -2
- package/dist/{chunk-FW53T7EB.js → chunk-QLTFXVUI.js} +2 -2
- package/dist/{chunk-PBI2LFKH.js → chunk-QMGWSEPL.js} +2 -2
- package/dist/{chunk-CQP3THUZ.js → chunk-QVHZB75Z.js} +2 -2
- package/dist/{chunk-6BQ3DSPK.js → chunk-QVWDQTMG.js} +2 -2
- package/dist/{chunk-ST7V3SKN.js → chunk-RCPZOPV6.js} +2 -2
- package/dist/chunk-RJWAB4VR.js +345 -0
- package/dist/chunk-RRPK327J.js +20 -0
- package/dist/chunk-RVYLJDXC.js +21 -0
- package/dist/chunk-RWKEXCHU.js +3 -0
- package/dist/{chunk-L4NRUAGJ.js → chunk-S5SKXCND.js} +2 -2
- package/dist/{chunk-RBAS5ZHI.js → chunk-S64NCE2Z.js} +2 -2
- package/dist/{chunk-WMPRTGH2.js → chunk-SF34QLK2.js} +2 -2
- package/dist/{chunk-ANFVSJWQ.js → chunk-SJZQ2PTZ.js} +2 -2
- package/dist/{chunk-4XTAUQFD.js → chunk-SRY26ITJ.js} +2 -2
- package/dist/chunk-SV2LEFVM.js +2 -0
- package/dist/{chunk-7XAN6GKB.js → chunk-T3YFIJ5P.js} +2 -2
- package/dist/chunk-T55YPJGB.js +3 -0
- package/dist/chunk-TAJ6UGCO.js +21 -0
- package/dist/{chunk-PIOMTC27.js → chunk-TUTSO7UZ.js} +2 -2
- package/dist/{chunk-FQKZWM4L.js → chunk-U24M5RQM.js} +5 -5
- package/dist/{chunk-XME3HPXZ.js → chunk-U2XX3BT4.js} +2 -2
- package/dist/{chunk-SZD2KF7Q.js → chunk-UWB5WMC2.js} +2 -2
- package/dist/{chunk-6CS3UQTN.js → chunk-VCL7FK3E.js} +2 -2
- package/dist/{chunk-N3IQCBCF.js → chunk-VCWAJPXQ.js} +2 -2
- package/dist/{chunk-LZYFLFEH.js → chunk-VG55NFXF.js} +2 -2
- package/dist/{chunk-PTAWHLVJ.js → chunk-VLTUX4IF.js} +2 -2
- package/dist/{chunk-JEJLSICM.js → chunk-VVCBMH5O.js} +2 -2
- package/dist/{chunk-JSOYNVWH.js → chunk-VYZQZ4ZN.js} +2 -2
- package/dist/chunk-W3FK73MD.js +8 -0
- package/dist/{chunk-UNBY47BC.js → chunk-W6C6QTXJ.js} +2 -2
- package/dist/chunk-WH5SYOMD.js +2 -0
- package/dist/chunk-WJOQC4P7.js +7 -0
- package/dist/chunk-WO47BIPY.js +3 -0
- package/dist/chunk-WOOTEWQT.js +239 -0
- package/dist/{chunk-UBGWN7I4.js → chunk-X5I2BQGX.js} +2 -2
- package/dist/{chunk-PX4RYAAK.js → chunk-XNUWRTYM.js} +2 -2
- package/dist/{chunk-ICFDQHAM.js → chunk-XUJM6474.js} +2 -2
- package/dist/chunk-XYLV727H.js +21 -0
- package/dist/{chunk-TRRC4ZJ7.js → chunk-YFQPWKHR.js} +2 -2
- package/dist/{chunk-NEDP5RFQ.js → chunk-YIOQJ45A.js} +2 -2
- package/dist/{chunk-Y6KHROC3.js → chunk-YXJ4IAHH.js} +2 -2
- package/dist/chunk-YYFV32WR.js +3 -0
- package/dist/{chunk-BH5F2Q4O.js → chunk-ZB3V5QM7.js} +2 -2
- package/dist/chunk-ZJZQ7Q2Q.js +3 -0
- package/dist/{chunk-EMNIHCRB.js → chunk-ZNQCR656.js} +2 -2
- package/dist/{chunk-TIIC3ZE7.js → chunk-ZOEDRCR4.js} +2 -2
- package/dist/cli-context-TSADTXLB.js +2 -0
- package/dist/cli-context-XEPPF4RX.js +3 -0
- package/dist/cli-program-KJGQEM72.js +7 -0
- package/dist/cli.js +1 -1
- package/dist/{code-DlqpBDd0.d.ts → code-CDe-mIjx.d.ts} +1 -1
- package/dist/code-viewer-YGDON6SY.js +12 -0
- package/dist/code-viewer-ZCTHXQ5C.js +11 -0
- package/dist/command-descriptors-5VAB2MZX.js +335 -0
- package/dist/command-descriptors-EAHKIRAG.js +337 -0
- package/dist/{config-types-BNoC96J3.d.ts → config-types-D6X5S68_.d.ts} +50 -0
- package/dist/{db-D7sauVFH.d.ts → db-DmRNdCtm.d.ts} +1 -1
- package/dist/direct-navigation-B3SGOOBW.js +2 -0
- package/dist/direct-navigation-ZL362KXF.js +3 -0
- package/dist/{graph-evidence-BIFqyisO.d.ts → graph-evidence-Bs54NWws.d.ts} +1 -1
- package/dist/{health-DJaZXg8I.d.ts → health-BnzbSLCE.d.ts} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/invocation-command-descriptors-CSUGUHTT.js +2 -0
- package/dist/invocation-command-descriptors-PPVZOIE5.js +3 -0
- package/dist/output-continuation-command-FTVVBVSN.js +2 -0
- package/dist/output-continuation-command-ITPRC3YV.js +3 -0
- package/dist/project-reindex-7HZSLLLY.js +3 -0
- package/dist/project-reindex-NGM3DYBN.js +2 -0
- package/dist/queries/affected.d.ts +2 -2
- package/dist/queries/affected.js +1 -1
- package/dist/queries/anchors.d.ts +2 -2
- package/dist/queries/anchors.js +1 -1
- package/dist/queries/architecture.d.ts +2 -2
- package/dist/queries/architecture.js +1 -1
- package/dist/queries/bottlenecks.d.ts +2 -2
- 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 +2 -2
- 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 +3 -3
- 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 +2 -2
- package/dist/queries/context.js +1 -1
- package/dist/queries/convergence.d.ts +2 -2
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +2 -2
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +2 -2
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +2 -2
- 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 +2 -2
- package/dist/queries/decorative-checkers.js +1 -1
- package/dist/queries/deep-chains.d.ts +2 -2
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/dependence-slice.d.ts +3 -3
- package/dist/queries/dependence-slice.js +1 -1
- package/dist/queries/dependency-depth.d.ts +2 -2
- package/dist/queries/dependency-depth.js +1 -1
- package/dist/queries/deps.d.ts +2 -2
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.d.ts +2 -2
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.d.ts +2 -2
- 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 +2 -2
- package/dist/queries/entry-map.js +1 -1
- package/dist/queries/evidence.d.ts +3 -3
- package/dist/queries/evidence.js +1 -1
- package/dist/queries/extract-candidates.d.ts +2 -2
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +2 -2
- 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 +3 -3
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +2 -2
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +2 -2
- 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 +2 -2
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +5 -5
- 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 +2 -2
- 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 +2 -2
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +2 -2
- 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 +2 -2
- package/dist/queries/reference-neighborhood.js +1 -1
- package/dist/queries/reference-reachability.d.ts +2 -2
- package/dist/queries/reference-reachability.js +1 -1
- 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 +2 -2
- package/dist/queries/slice.js +1 -1
- package/dist/queries/source-inspection.d.ts +4 -4
- package/dist/queries/source-inspection.js +1 -1
- package/dist/queries/source-search.d.ts +2 -2
- package/dist/queries/source-search.js +1 -1
- 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 +2 -2
- 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 +2 -2
- package/dist/queries/system-map.js +1 -1
- package/dist/queries/system.d.ts +2 -2
- 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 +2 -2
- package/dist/queries/trace.js +1 -1
- package/dist/queries/twin-ab.d.ts +2 -2
- package/dist/queries/twin-ab.js +1 -1
- package/dist/queries/twin-drift.d.ts +2 -2
- 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 +3 -3
- package/dist/queries/value-flow.js +1 -1
- 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/reindex-worker.js +1 -1
- package/dist/reindex.d.ts +3 -3
- package/dist/reindex.js +31 -31
- package/dist/runtime.d.ts +24 -4
- package/dist/runtime.js +3 -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-B7N3haxa.d.ts → scip-cli-BRFKkHQn.d.ts} +1 -1
- package/dist/sentinel-ensure-command-KYYULCFU.js +2 -0
- package/dist/sentinel-ensure-command-RIZA3RY7.js +3 -0
- package/dist/sentinel-hook.js +39 -0
- package/dist/sentinel-worker.js +16 -0
- package/dist/typescript-mailbox-worker.js +1 -1
- package/dist/watch-server.js +6 -6
- package/docs/COMMAND_REFERENCE.md +5 -3
- package/docs/schemas/project-config.schema.json +159 -0
- package/package.json +9 -5
- package/skills/codebaseiq/SKILL.md +1 -1
- package/skills/concrete-plan/SKILL.md +1 -1
- package/ui/view/api.js +450 -0
- package/ui/view/app.js +394 -0
- package/ui/view/builder.js +323 -0
- package/ui/view/file-panel.js +170 -0
- package/ui/view/focus.js +379 -0
- package/ui/view/index.html +54 -0
- package/ui/view/map.js +424 -0
- package/ui/view/styles.css +1125 -0
- package/dist/chunk-2X7V4HS4.js +0 -88
- package/dist/chunk-3IER7Q6H.js +0 -12
- package/dist/chunk-3JSXXYTZ.js +0 -345
- package/dist/chunk-476NR5B7.js +0 -2
- package/dist/chunk-5VKBFZZU.js +0 -3
- package/dist/chunk-ADTBPVUZ.js +0 -21
- package/dist/chunk-BFFZDZQV.js +0 -2
- package/dist/chunk-BMYOV5GP.js +0 -77
- package/dist/chunk-C74PPYLA.js +0 -3
- package/dist/chunk-CWONGW6P.js +0 -3
- package/dist/chunk-DDZ7VHWV.js +0 -20
- package/dist/chunk-DR2LURYU.js +0 -3
- package/dist/chunk-ECQBG7PW.js +0 -564
- package/dist/chunk-FM5BPL4V.js +0 -60
- package/dist/chunk-G6XFR4ZL.js +0 -4
- package/dist/chunk-GTIYTDRE.js +0 -562
- package/dist/chunk-HOA5YGOH.js +0 -3
- package/dist/chunk-KUW32IRO.js +0 -2
- package/dist/chunk-LTA3BRZX.js +0 -2
- package/dist/chunk-NAUD7LCA.js +0 -2
- package/dist/chunk-OGTFJ3XD.js +0 -2
- package/dist/chunk-Q5ELPRKQ.js +0 -2
- package/dist/chunk-QCN62RTF.js +0 -3
- package/dist/chunk-QW7EP6WI.js +0 -21
- package/dist/chunk-RU65DDUP.js +0 -215
- package/dist/chunk-SELM5MER.js +0 -2
- package/dist/chunk-SNNWPCN7.js +0 -4
- package/dist/chunk-TFZB6XTM.js +0 -239
- package/dist/chunk-UXM43C7T.js +0 -3
- package/dist/chunk-VFY6Y2H6.js +0 -61
- package/dist/chunk-WE5RZHZ7.js +0 -5
- package/dist/chunk-Z54RD7VL.js +0 -3
- package/dist/cli-context-3SNLDYBM.js +0 -3
- package/dist/cli-context-T3B7W6GG.js +0 -2
- package/dist/cli-program-YNOXO72B.js +0 -7
- package/dist/command-descriptors-6AOUKWW7.js +0 -346
- package/dist/command-descriptors-ZFKJSRUP.js +0 -344
- package/dist/direct-navigation-DP4LVMRX.js +0 -3
- package/dist/direct-navigation-FLUS3BT6.js +0 -2
- package/dist/invocation-command-descriptors-QT2JMY5J.js +0 -3
- package/dist/invocation-command-descriptors-YN4QJEAX.js +0 -2
- package/dist/output-continuation-command-2V2SL4TD.js +0 -2
- package/dist/output-continuation-command-65J5IP3O.js +0 -3
- package/dist/project-reindex-5JOKXAXT.js +0 -2
- package/dist/project-reindex-UQBIKO4M.js +0 -3
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{A as Xi,Ba as ke,Ca as Y,E as an,aa as pr,fa as fr,g as qi,h as D,ha as ge,i as at,na as mr,oa as gr,pa as yr,qa as hr,u as ct,w as lt,x as Ki,z as Gi}from"./chunk-G2XUZCF2.js";import{r as st,x as sn,y as Wi}from"./chunk-DUKHVPU5.js";import{createHash as Rc}from"crypto";import{existsSync as Fc,mkdirSync as Tc}from"fs";import{dirname as Qi,join as Pc}from"path";import Sr from"better-sqlite3";function Ji(){let e=new WeakMap;return{cache:e,ensure(t){let n=e.get(t);return n||(n=new Map,e.set(t,n)),n}}}function v(e,t){let{cache:n,ensure:r}=Ji(),i={get(o,s,a){let c=r(o);if(c.has(s))return c.get(s);let l=a();return c.set(s,l),l},invalidate(o,s){n.get(o)?.delete(s)},invalidateAll(o){n.delete(o)},size(o){return n.get(o)?.size??0}};return lt({name:e,groups:t.clearGroups,clearAll:o=>i.invalidateAll(o),clearFile:(o,s)=>i.invalidate(o,s)}),i}function ye(e,t){let n=new WeakMap,r={get(i,o){let s=n.get(i);if(s)return s.value;let a=o();return n.set(i,{value:a}),a},invalidate(i){n.delete(i)},has(i){return n.has(i)}};return lt({name:e,groups:t.clearGroups,clearAll:i=>r.invalidate(i)}),r}var Ic={clearGroups:["whole-project","source-file"]};function De(e){return ze(e,Ic)}function ze(e,t){let{cache:n,ensure:r}=Ji(),i={get(o,s,a,c){let l=r(o),u=l.get(s);if(u&&u.source===a)return u.value;let d=c();return l.set(s,{source:a,value:d}),d},invalidate(o,s){n.get(o)?.delete(s)},invalidateAll(o){n.delete(o)}};return lt({name:e,groups:t.clearGroups,clearAll:o=>i.invalidateAll(o),clearFile:(o,s)=>i.invalidate(o,s)}),i}var wc="evidence.db";var Lc=["source-facts","callable-units","definition-exclusions","doc-path-tokens","react-component-behavior-profiles"],br=new Set(Lc),kc=25e4,Dc=512*1024*1024,Ac=6e4,dt=new WeakMap;Ki({name:"evidence-connections",close:Zi});var Oc=v("evidence-content-hash",{clearGroups:["whole-project","source-file"]}),Mc=v("evidence-project-fingerprint",{clearGroups:["whole-project"]}),G="evidence-v1",ut="version NOT LIKE 'evidence-%'";function Ne(e){return Rc("sha256").update(e).digest("hex")}function he(e,t,n){return Oc.get(e,t,()=>Ne(n))}function We(e){return Mc.get(e,"current",()=>{try{if(!e.generation.metadataRaw)return null;let t=an(e.generation.metadataRaw);if(t.kind!=="legacy"&&t.kind!=="supported"||!t.capabilities.usableForEvidenceCache)return null;let n=t.metadata,r=[...n.indexedLanguages??[]].sort();return Ne(JSON.stringify({fingerprint:n.fingerprint,indexedLanguages:r,status:n.status}))}catch(t){return Ae("project fingerprint unavailable",t),null}})}function Ae(e,t){process.env.CODEBASEIQ_DEBUG&&console.error(`evidence-cache: ${e}: ${t instanceof Error?t.message:String(t)}`)}function Ee(e){if(dt.has(e))return dt.get(e)??null;let t=null;try{let n=new Sr(ct(Pc(Qi(e.config.dbPath),wc)));n.pragma("journal_mode = WAL"),n.pragma("busy_timeout = 5000"),n.pragma("synchronous = NORMAL"),n.exec(`
|
|
3
|
+
CREATE TABLE IF NOT EXISTS file_evidence (
|
|
4
|
+
kind TEXT NOT NULL,
|
|
5
|
+
relative_path TEXT NOT NULL,
|
|
6
|
+
content_hash TEXT NOT NULL,
|
|
7
|
+
version TEXT NOT NULL,
|
|
8
|
+
payload TEXT NOT NULL,
|
|
9
|
+
PRIMARY KEY (kind, relative_path)
|
|
10
|
+
);
|
|
11
|
+
CREATE TABLE IF NOT EXISTS project_evidence (
|
|
12
|
+
kind TEXT NOT NULL,
|
|
13
|
+
cache_key TEXT NOT NULL,
|
|
14
|
+
project_fingerprint TEXT NOT NULL,
|
|
15
|
+
version TEXT NOT NULL,
|
|
16
|
+
payload TEXT NOT NULL,
|
|
17
|
+
PRIMARY KEY (kind, cache_key)
|
|
18
|
+
);
|
|
19
|
+
CREATE TABLE IF NOT EXISTS semantic_callees (
|
|
20
|
+
relative_path TEXT NOT NULL,
|
|
21
|
+
symbol TEXT NOT NULL,
|
|
22
|
+
content_hash TEXT NOT NULL,
|
|
23
|
+
deps_digest TEXT NOT NULL,
|
|
24
|
+
version TEXT NOT NULL,
|
|
25
|
+
payload TEXT NOT NULL,
|
|
26
|
+
PRIMARY KEY (relative_path, symbol)
|
|
27
|
+
);
|
|
28
|
+
CREATE TABLE IF NOT EXISTS semantic_references (
|
|
29
|
+
relative_path TEXT NOT NULL,
|
|
30
|
+
symbol TEXT NOT NULL,
|
|
31
|
+
project_fingerprint TEXT NOT NULL,
|
|
32
|
+
version TEXT NOT NULL,
|
|
33
|
+
payload TEXT NOT NULL,
|
|
34
|
+
PRIMARY KEY (relative_path, symbol)
|
|
35
|
+
);
|
|
36
|
+
`),t={evidence:n,shared:$c(e.config.sharedEvidenceDbPath),readFileEvidence:n.prepare("SELECT payload FROM file_evidence WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?"),readLegacyFileEvidence:n.prepare(`SELECT payload FROM file_evidence
|
|
37
|
+
WHERE kind = ? AND relative_path = ? AND content_hash = ? AND ${ut}
|
|
38
|
+
ORDER BY version DESC
|
|
39
|
+
LIMIT 1`),writeFileEvidence:n.prepare("INSERT OR REPLACE INTO file_evidence (kind, relative_path, content_hash, version, payload) VALUES (?, ?, ?, ?, ?)"),readProjectEvidence:n.prepare("SELECT payload FROM project_evidence WHERE kind = ? AND cache_key = ? AND project_fingerprint = ? AND version = ?"),readLegacyProjectEvidence:n.prepare(`SELECT payload FROM project_evidence
|
|
40
|
+
WHERE kind = ? AND cache_key = ? AND project_fingerprint = ? AND ${ut}
|
|
41
|
+
ORDER BY version DESC
|
|
42
|
+
LIMIT 1`),writeProjectEvidence:n.prepare("INSERT OR REPLACE INTO project_evidence (kind, cache_key, project_fingerprint, version, payload) VALUES (?, ?, ?, ?, ?)"),readCallees:n.prepare(`SELECT payload FROM semantic_callees
|
|
43
|
+
WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND version = ?`),readLegacyCallees:n.prepare(`SELECT payload FROM semantic_callees
|
|
44
|
+
WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND ${ut}
|
|
45
|
+
ORDER BY version DESC
|
|
46
|
+
LIMIT 1`),readCalleesForFile:n.prepare(`SELECT symbol, payload FROM semantic_callees
|
|
47
|
+
WHERE relative_path = ? AND content_hash = ? AND deps_digest = ? AND version = ?`),readLegacyCalleesForFile:n.prepare(`SELECT symbol, payload FROM semantic_callees
|
|
48
|
+
WHERE relative_path = ? AND content_hash = ? AND deps_digest = ? AND ${ut}
|
|
49
|
+
ORDER BY symbol, version DESC`),writeCallees:n.prepare(`INSERT OR REPLACE INTO semantic_callees
|
|
50
|
+
(relative_path, symbol, content_hash, deps_digest, version, payload) VALUES (?, ?, ?, ?, ?, ?)`),dropStaleCallees:n.prepare("DELETE FROM semantic_callees WHERE relative_path = ? AND content_hash != ?"),readReferences:n.prepare(`SELECT payload FROM semantic_references
|
|
51
|
+
WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND version = ?`),readLegacyReferences:n.prepare(`SELECT payload FROM semantic_references
|
|
52
|
+
WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND ${ut}
|
|
53
|
+
ORDER BY version DESC
|
|
54
|
+
LIMIT 1`),readReferencesForFile:n.prepare(`SELECT symbol, payload FROM semantic_references
|
|
55
|
+
WHERE relative_path = ? AND project_fingerprint = ? AND version = ?`),readLegacyReferencesForFile:n.prepare(`SELECT symbol, payload FROM semantic_references
|
|
56
|
+
WHERE relative_path = ? AND project_fingerprint = ? AND ${ut}
|
|
57
|
+
ORDER BY symbol, version DESC`),writeReferences:n.prepare(`INSERT OR REPLACE INTO semantic_references
|
|
58
|
+
(relative_path, symbol, project_fingerprint, version, payload) VALUES (?, ?, ?, ?, ?)`),dropStaleReferences:n.prepare("DELETE FROM semantic_references WHERE relative_path = ? AND project_fingerprint != ?")}}catch(n){Ae("disabled (open failed)",n)}return dt.set(e,t),t}function Ce(e,t,n){Ae(`disabled (${t})`,n);try{Zi(e)}catch(r){Ae("close failed while disabling",r)}dt.set(e,null)}function Zi(e){let t=dt.get(e);if(dt.delete(e),!t)return;let n,r;try{t.shared?.evidence.close()}catch(i){n=i}try{t.evidence.close()}catch(i){r=i}if(n!==void 0&&r!==void 0)throw new AggregateError([n,r],"Shared and project evidence connections failed to close.");if(n!==void 0)throw n;if(r!==void 0)throw r}function $c(e){if(!e)return null;try{Tc(Qi(e),{recursive:!0});let t=new Sr(ct(e));return t.pragma("journal_mode = WAL"),t.pragma("busy_timeout = 250"),t.pragma("synchronous = NORMAL"),t.exec(`
|
|
59
|
+
CREATE TABLE IF NOT EXISTS file_evidence (
|
|
60
|
+
kind TEXT NOT NULL,
|
|
61
|
+
relative_path TEXT NOT NULL,
|
|
62
|
+
content_hash TEXT NOT NULL,
|
|
63
|
+
version TEXT NOT NULL,
|
|
64
|
+
payload TEXT NOT NULL,
|
|
65
|
+
last_accessed_at INTEGER NOT NULL,
|
|
66
|
+
PRIMARY KEY (kind, relative_path, content_hash, version)
|
|
67
|
+
);
|
|
68
|
+
CREATE INDEX IF NOT EXISTS idx_file_evidence_lru
|
|
69
|
+
ON file_evidence(last_accessed_at, kind, relative_path, content_hash, version);
|
|
70
|
+
`),{evidence:t,readFileEvidence:t.prepare("SELECT payload FROM file_evidence WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?"),writeFileEvidence:t.prepare(`INSERT INTO file_evidence (kind, relative_path, content_hash, version, payload, last_accessed_at)
|
|
71
|
+
VALUES (?, ?, ?, ?, ?, ?)
|
|
72
|
+
ON CONFLICT(kind, relative_path, content_hash, version)
|
|
73
|
+
DO UPDATE SET payload = excluded.payload, last_accessed_at = excluded.last_accessed_at`),touchFileEvidence:t.prepare(`UPDATE file_evidence
|
|
74
|
+
SET last_accessed_at = ?
|
|
75
|
+
WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?
|
|
76
|
+
AND last_accessed_at < ?`)}}catch(t){return Ae("shared cache disabled (open failed)",t),null}}function xr(e,t,n){Ae(`shared cache disabled (${t})`,n);try{e.shared?.evidence.close()}catch{}e.shared=null}function kS(e,t={}){if(!Fc(e))return null;let n;try{n=new Sr(ct(e)),n.pragma("busy_timeout = 50"),n.exec(`CREATE INDEX IF NOT EXISTS idx_file_evidence_lru
|
|
77
|
+
ON file_evidence(last_accessed_at, kind, relative_path, content_hash, version)`),n.pragma("wal_checkpoint(TRUNCATE)");let r=n.prepare("SELECT COUNT(*) AS count FROM file_evidence").get().count,i=t.maxRows??kc,o=t.budgetBytes??Dc,s=Number(n.pragma("page_size",{simple:!0})),a=Number(n.pragma("page_count",{simple:!0})),c=Number(n.pragma("freelist_count",{simple:!0})),l=Math.max(0,a-c)*s,u=r>0&&l>o?Math.min(r,Math.ceil((l-o)/Math.max(1,l/r))):0,d=Math.max(r-i,u);return d>0&&(n.prepare(`DELETE FROM file_evidence WHERE rowid IN (
|
|
78
|
+
SELECT rowid FROM file_evidence ORDER BY last_accessed_at ASC, rowid ASC LIMIT ?
|
|
79
|
+
)`).run(d),n.pragma("wal_checkpoint(TRUNCATE)")),{deletedRows:d,remainingRows:r-d}}catch(r){return Ae("shared cache maintenance skipped",r),null}finally{try{n?.close()}catch{}}}function Yi(e,t,n,r){let i=Ee(e);if(!i)return null;try{let o=i.readFileEvidence.get(t,n,r,G)??i.readLegacyFileEvidence.get(t,n,r);if(o?.payload!==void 0)return o.payload;if(!br.has(t)||!i.shared)return null;try{let s=i.shared.readFileEvidence.get(t,n,r,G);return s?.payload!==void 0&&Bc(i.shared,t,n,r),s?.payload??null}catch(s){return xr(i,"file_evidence read",s),null}}catch(o){return Ce(e,"file_evidence read",o),null}}function Bc(e,t,n,r){let i=Date.now();try{e.touchFileEvidence.run(i,t,n,r,G,i-Ac)}catch(o){Ae("shared file_evidence recency touch skipped",o)}}function eo(e,t,n,r,i){let o=Ee(e);if(o)try{if(o.writeFileEvidence.run(t,n,r,G,i),br.has(t)&&o.shared)try{o.shared.writeFileEvidence.run(t,n,r,G,i,Date.now())}catch(s){xr(o,"file_evidence write",s)}}catch(s){Ce(e,"file_evidence write",s)}}function to(e,t){if(t.length===0)return;let n=Ee(e);if(n)try{n.evidence.transaction(()=>{for(let i of t)n.writeFileEvidence.run(i.kind,i.relativePath,i.contentHash,G,i.payload)})();let r=t.filter(i=>br.has(i.kind));if(r.length>0&&n.shared)try{n.shared.evidence.transaction(()=>{for(let i of r)n.shared.writeFileEvidence.run(i.kind,i.relativePath,i.contentHash,G,i.payload,Date.now())})()}catch(i){xr(n,"file_evidence batch write",i)}}catch(r){Ce(e,"file_evidence batch write",r)}}function no(e,t,n,r){let i=Ee(e);if(!i)return null;try{return(i.readProjectEvidence.get(t,n,r,G)??i.readLegacyProjectEvidence.get(t,n,r))?.payload??null}catch(o){return Ce(e,"project_evidence read",o),null}}function ro(e,t,n,r,i){let o=Ee(e);if(o)try{o.writeProjectEvidence.run(t,n,r,G,i)}catch(s){Ce(e,"project_evidence write",s)}}function DS(e,t,n,r){let i=Ee(e);if(!i)return new Map;try{let o=i.readCalleesForFile.all(t,n,r,G),s=i.readLegacyCalleesForFile.all(t,n,r);return io([...s,...o])}catch(o){return Ce(e,"semantic_callees bulk read",o),new Map}}function AS(e,t,n){let r=Ee(e);if(!r)return new Map;try{let i=r.readReferencesForFile.all(t,n,G),o=r.readLegacyReferencesForFile.all(t,n);return io([...o,...i])}catch(i){return Ce(e,"semantic_references bulk read",i),new Map}}function io(e){let t=new Map;for(let n of e)t.set(n.symbol,n.payload);return t}function OS(e,t){if(t.length===0)return;let n=Ee(e);if(n)try{n.evidence.transaction(()=>{let r=new Set;for(let i of t){let o=`${i.relativePath}\0${i.contentHash}`;r.has(o)||(r.add(o),n.dropStaleCallees.run(i.relativePath,i.contentHash)),n.writeCallees.run(i.relativePath,i.symbol,i.contentHash,i.depsDigest,G,i.payload)}})()}catch(r){Ce(e,"semantic_callees write",r)}}function MS(e,t){if(t.length===0)return;let n=Ee(e);if(n)try{n.evidence.transaction(()=>{let r=new Set;for(let i of t){let o=`${i.relativePath}\0${i.projectFingerprint}`;r.has(o)||(r.add(o),n.dropStaleReferences.run(i.relativePath,i.projectFingerprint)),n.writeReferences.run(i.relativePath,i.symbol,i.projectFingerprint,G,i.payload)}})()}catch(r){Ce(e,"semantic_references write",r)}}import{basename as oo}from"path";var jc=v("indexed-document-paths",{clearGroups:["whole-project"]});function ee(e,t={}){let n=Vc(t);return[...jc.get(e,n,()=>{let i=t.scope?"AND relative_path LIKE ?":"",o=t.like?"AND relative_path LIKE ?":"",s=[...t.scope?[`%${t.scope}%`]:[],...t.like?[t.like]:[]],a=e.all(`SELECT relative_path
|
|
80
|
+
FROM documents
|
|
81
|
+
WHERE 1 = 1
|
|
82
|
+
${e.pathExclusionsFor("documents")}
|
|
83
|
+
${i}
|
|
84
|
+
${o}
|
|
85
|
+
ORDER BY relative_path`,...s).map(l=>l.relative_path),c=t.extensions?a.filter(l=>t.extensions.some(u=>l.toLowerCase().endsWith(u.toLowerCase()))):a;return t.includeIgnored===!1?c.filter(l=>!e.isIgnored(l)):c})]}function Vc(e){let t=e.extensions?[...new Set(e.extensions.map(n=>n.toLowerCase()))].sort():null;return JSON.stringify({scope:e.scope??null,like:e.like??null,extensions:t,includeIgnored:e.includeIgnored!==!1})}function ao(e,t,n){let r=co(t);if(!r)return[];let i=e.all(`SELECT relative_path
|
|
86
|
+
FROM documents
|
|
87
|
+
WHERE relative_path = ?
|
|
88
|
+
${e.pathExclusionsFor("documents")}`,r).filter(c=>!e.isIgnored(c.relative_path)).map(c=>({relativePath:c.relative_path,score:so(c.relative_path,r)}));if(i.length>0)return i;let o=ee(e,{includeIgnored:!1}).map(c=>({relativePath:c,score:so(c,r)})).filter(c=>c.score>0).sort((c,l)=>l.score-c.score||c.relativePath.localeCompare(l.relativePath)),s=o.filter(c=>c.score>=1100);if(s.length>0)return n.allowMultiple?s:[s[0]];let a=o.filter(c=>c.score>=800);return a.length>0?n.allowMultiple?a:[a[0]]:n.allowMultiple?o:o.slice(0,1)}function so(e,t){let n=co(e),r=oo(n),i=oo(t),o=0;return n===t&&(o+=1200),n.endsWith(`/${t}`)&&(o+=1100),r===i&&(o+=900),n.startsWith(`${t}/`)&&(o+=850),n.includes(t)&&(o+=250),o}function co(e){return e.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}import{extname as lo}from"path";var Uc={".rs":"rust",".ts":"typescript",".mts":"typescript",".cts":"typescript",".tsx":"tsx",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".java":"java",".kt":"kotlin",".kts":"kotlin",".scala":"scala",".sc":"scala",".rb":"ruby",".c":"c",".h":"c",".cc":"cpp",".cpp":"cpp",".cxx":"cpp",".hpp":"cpp",".hh":"cpp",".hxx":"cpp",".cs":"csharp",".php":"php",".vb":"vb",".clj":"clojure",".cljs":"clojure",".cljc":"clojure"};function H(e){return Uc[lo(e).toLowerCase()]??null}function Se(e){return lo(e).toLowerCase()===".vue"}import{createRequire as Hc}from"module";var V=Hc(import.meta.url),Tt=null,vr=!1;function uo(){if(vr)return null;if(Tt)return Tt;try{return Tt=V("tree-sitter"),Tt}catch{return vr=!0,null}}function WS(e){if(e==="clojure")return"reader";let t=uo();if(!t)return"unavailable";let n=po(e);if(!n)return"unavailable";try{return new t().setLanguage(n),"ast"}catch{return pt.add(e),"unavailable"}}var Nr=new Map,pt=new Set;function po(e){if(pt.has(e))return null;let t=Nr.get(e);if(t)return t;let n;try{switch(e){case"rust":n=V("tree-sitter-rust");break;case"typescript":n=V("tree-sitter-typescript").typescript;break;case"tsx":n=V("tree-sitter-typescript").tsx;break;case"javascript":n=V("tree-sitter-javascript");break;case"python":n=V("tree-sitter-python");break;case"java":n=V("tree-sitter-java");break;case"kotlin":n=V("tree-sitter-kotlin");break;case"scala":n=V("tree-sitter-scala");break;case"ruby":n=V("tree-sitter-ruby");break;case"c":n=V("tree-sitter-c");break;case"cpp":n=V("tree-sitter-cpp");break;case"csharp":n=V("tree-sitter-c-sharp");break;case"php":n=V("tree-sitter-php").php;break;case"vb":{let r=V("tree-sitter-vb-dotnet");n=r.language??r;break}case"clojure":return pt.add(e),null}}catch{return pt.add(e),null}return Nr.set(e,n),n}var Er=new Map;function qS(){Tt=null,vr=!1,Nr.clear(),pt.clear(),Er.clear(),qc.clear()}function zc(e){let t=Er.get(e);if(t)return t;let n=po(e);if(!n)return null;let r=uo();if(!r)return null;let i=new r;try{i.setLanguage(n)}catch{return pt.add(e),null}return Er.set(e,i),i}function Wc(e,t){return e.parse(r=>r>=t.length?null:t.slice(r,Math.min(t.length,r+16384)))}function qe(e,t){let n=zc(e);if(!n)return null;try{return Wc(n,t)}catch{return null}}var qc=new Map;var Kc=v("source-text",{clearGroups:["whole-project","source-file"]}),Gc=v("source-lines",{clearGroups:["whole-project","source-file"]});function x(e,t){let n=t.replace(/\\/g,"/");return Kc.get(e,n,()=>{try{return yr(e.config.projectRoot,n,{inputKind:"indexed source file"})}catch(r){if(hr(r))return"";throw r}})}function Pt(e,t){let n=t.replace(/\\/g,"/");return Gc.get(e,n,()=>{let r=x(e,n);return r?r.split(`
|
|
89
|
+
`):[]})}var Xc=/^\s*(?:\/\/|#|\/\*+|\*)\s*codebaseiq[\s:-]*ignore(?:[\s:-]+(dead(?:-code)?|stale|wrapper|passthrough|drift|extract|similar|twin))?\b/i;function Jc(e){let t=Xc.exec(e);return t?t[1]??"":null}function JS(e,t,n){return fo(e,t,n).length>0}function QS(e,t,n,r){let i=r.toLowerCase();return fo(e,t,n).some(o=>o.toLowerCase()===i)}function fo(e,t,n){if(n<=0)return[];let r=Pt(e,t);if(r.length===0)return[];let i=[];for(let o=n-1;o>=0&&o>=n-5;o-=1){let s=(r[o]??"").trim();if(s==="")continue;let a=Jc(s);if(a!==null){i.push(a);continue}if(!s.startsWith("//")&&!s.startsWith("*")&&!s.startsWith("/*")&&!s.startsWith("@")&&!s.startsWith("#"))return i}return i}import{posix as Cr}from"path";import{parse as Qc}from"@vue/compiler-sfc";var Zc=De("vue-sfc-units");function ft(e,t){let n=yo(t),r=x(e,n);return Zc.get(e,n,r,()=>_r(e,n,r))}function yo(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function Yc(e){let t=e?.toLowerCase();return!t||t==="js"||t==="javascript"||t==="jsx"?"javascript":t==="ts"||t==="typescript"?"typescript":t==="tsx"?"tsx":null}function Ke(e){return!e||e.body.length===0?0:e.body.split(`
|
|
90
|
+
`).length}function _r(e,t,n){let r={relativePath:t,template:null,scripts:[],styles:[],customBlocks:[],errors:[]};if(!n)return r;let i;try{i=Qc(n,{filename:t})}catch(s){return r.errors.push(go(s)),r}r.errors.push(...i.errors.map(go));let{descriptor:o}=i;return o.template&&(r.template=cn(e,t,"template",o.template)),o.script&&r.scripts.push(mo(e,t,o.script,!1)),o.scriptSetup&&r.scripts.push(mo(e,t,o.scriptSetup,!0)),r.styles=o.styles.map(s=>cn(e,t,"style",s)),r.customBlocks=o.customBlocks.map(s=>cn(e,t,"custom",s)),r.errors.push(...[r.template,...r.scripts,...r.styles,...r.customBlocks].flatMap(s=>s?.errors??[])),r}function mo(e,t,n,r){let i=cn(e,t,"script",n);return{...i,kind:"script",setup:r,astLanguage:Yc(i.lang)}}function cn(e,t,n,r){let i=tl(r.attrs),o=typeof i.lang=="string"?i.lang:null,s=typeof i.src=="string"?i.src:typeof r.src=="string"?r.src:void 0;if(s){let c=el(t,s);if(!c)return{kind:n,ownerPath:t,sourcePath:t,external:!0,src:s,attrs:i,lang:o,body:"",startLine:0,endLine:0,errors:[`Could not resolve Vue ${n} block source: ${s}`]};let l=x(e,c),u=l?Math.max(0,l.split(`
|
|
91
|
+
`).length-1):0;return{kind:n,ownerPath:t,sourcePath:c,external:!0,src:s,attrs:i,lang:o,body:l,startLine:0,endLine:u,errors:l?[]:[`Vue ${n} block source not found: ${c}`]}}let a=Math.max(0,r.loc.start.line-1);return{kind:n,ownerPath:t,sourcePath:t,external:!1,attrs:i,lang:o,body:r.content,startLine:a,endLine:Math.max(a,r.loc.end.line-1),errors:[]}}function el(e,t){let n=t.split(/[?#]/,1)[0];if(!n||n.startsWith("/")||n.includes("://"))return null;let r=yo(Cr.normalize(Cr.join(Cr.dirname(e),n)));return r===".."||r.startsWith("../")?null:r}function tl(e){return{...e}}function go(e){return e instanceof Error?e.message:String(e)}function wt(e,t,n){let i=_r(e,t,n).scripts.filter(s=>s.astLanguage&&s.body.length>0),o=i[0]?.astLanguage;return o?{body:i.map(s=>`${`
|
|
92
|
+
`.repeat(s.startLine)}${s.body}`).join(`
|
|
93
|
+
`),startLine:0,language:o}:null}var ho=ze("ast-trees",{clearGroups:["whole-project","source-file"]});function R(e,t){if(Se(t))return nl(e,t);let n=H(t);if(!n)return null;let r=x(e,t);return r?ho.get(e,t,r,()=>qe(n,r)):null}function Lt(e,t,n){if(Se(t)){let o=wt(e,t,n);if(!o)return null;let s=qe(o.language,`
|
|
94
|
+
`.repeat(o.startLine)+o.body);return s?{tree:s,language:o.language}:null}let r=H(t);if(!r)return null;let i=qe(r,n);return i?{tree:i,language:r}:null}function nl(e,t){let n=x(e,t);return n?ho.get(e,t,n,()=>{let r=wt(e,t,n);if(!r)return null;let i=`
|
|
95
|
+
`.repeat(r.startLine)+r.body;return qe(r.language,i)}):null}function mt(e,t){let n=il(e,t);if(!n)return null;let r=_e(n);if(!r)return null;let i=ol(n);return{calleeLeaf:r,calleeQualifier:i?rl(n):void 0,calleeText:n.text,memberAccess:i,line:e.startPosition.row}}function rl(e){return(e.childForFieldName("object")??e.childForFieldName("value")??e.namedChild(0)??void 0)?.text||void 0}function il(e,t){if(t==="rust")return e.type==="call_expression"?e.childForFieldName("function")??e.namedChild(0):e.type==="macro_invocation"?e.childForFieldName("macro")??e.namedChild(0):null;if(t==="python")return e.type!=="call"?null:e.childForFieldName("function")??e.namedChild(0);if(t==="typescript"||t==="tsx"||t==="javascript"){if(e.type==="call_expression")return e.childForFieldName("function")??e.namedChild(0);if(e.type==="new_expression")return e.childForFieldName("constructor")??e.namedChild(0)}return null}function ol(e){switch(e.type){case"field_expression":case"member_expression":case"attribute":return!0;default:return!1}}function _e(e){switch(e.type){case"identifier":case"type_identifier":case"field_identifier":case"property_identifier":case"private_property_identifier":case"shorthand_property_identifier":return e.text.replace(/^#/u,"");case"field_expression":case"member_expression":case"attribute":{let t=e.namedChild(e.namedChildCount-1);return t?_e(t):null}case"generic_function":{let t=e.childForFieldName("function")??e.namedChild(0);return t?_e(t):null}case"scoped_identifier":{let t=e.childForFieldName("name")??e.namedChild(e.namedChildCount-1);return t?_e(t):null}case"super":case"self":case"this":return null;default:return null}}var sl=[U("source-facts",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/source/source-facts.ts"}),U("callable-units",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/source/callable-units.test.ts",owner:"src/source/facts/callable-units.ts"}),U("file-definitions",{dependsOn:["content-hash","project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","contentHash","projectFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/symbols/definition-catalog.ts"}),U("definition-exclusions",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/analysis/framework-patterns.ts"}),U("doc-path-tokens",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-products.test.ts",owner:"tests/storage/evidence-cache.test.ts"}),U("doc-path-evidence",{dependsOn:["content-hash","git-history","git-head","tool-version"],keyParts:["kind","relativePath","contentHash","trackedFiles","historyWindow","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/queries/cleanup/doc-drift.ts"}),U("source-imports",{dependsOn:["content-hash","import-resolution-fingerprint","config","tool-version"],keyParts:["kind","relativePath","contentHash","importResolutionFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/language-parsers/index.ts"}),U("source-reexports",{dependsOn:["content-hash","import-resolution-fingerprint","config","tool-version"],keyParts:["kind","relativePath","contentHash","importResolutionFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/language-parsers/index.ts"}),U("source-fingerprints",{dependsOn:["content-hash","project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","contentHash","projectFingerprint","payloadVersion"],stalenessTest:"tests/symbols/definition-catalog.test.ts",owner:"src/queries/cleanup/similar.ts"}),U("consumer-file-usage",{dependsOn:["content-hash","project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","contentHash","projectFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/queries/internal/consumer-evidence.ts"}),U("react-component-behavior-profiles",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/source/react-profile.ts"}),U("git-file-adds",{dependsOn:["git-head","git-history","tool-version"],keyParts:["kind","cacheKey","head","historyWindow","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/analysis/git-history.ts"}),U("typescript-reference-fragments",{dependsOn:["content-hash","transitive-deps-digest","config","tool-version"],keyParts:["kind","relativePath","semanticIdentity","payloadVersion"],stalenessTest:"tests/semantic/typescript/typescript-reference-fragments.test.ts",owner:"src/semantic/typescript/reference-fragment-shadow.ts"}),U("typescript-import-usage",{dependsOn:["content-hash","transitive-deps-digest","config","tool-version"],keyParts:["kind","relativePath","semanticIdentity","payloadVersion"],stalenessTest:"tests/semantic/typescript/typescript-semantic-provider.test.ts",owner:"src/semantic/shared-primitives.ts"}),U("typescript-signatures",{dependsOn:["content-hash","transitive-deps-digest","config","tool-version"],keyParts:["kind","relativePath","semanticIdentity","payloadVersion"],stalenessTest:"tests/semantic/typescript/typescript-semantic-provider.test.ts",owner:"src/semantic/shared-primitives.ts"}),ln("file-dependency-graph",{dependsOn:["project-fingerprint","indexed-language-set","import-resolution-fingerprint","tool-version"],keyParts:["kind","scope","projectFingerprint","payloadVersion"],stalenessTest:"tests/symbols/file-dep-graph.test.ts",owner:"src/symbols/graph/file-dep-graph.ts"}),ln("semantic-import-usage",{dependsOn:["project-fingerprint","indexed-language-set","import-resolution-fingerprint","tool-version"],keyParts:["kind","relativePath","projectFingerprint","language","semanticEngine","payloadVersion"],stalenessTest:"tests/semantic/rust/rust-semantic-cache-gate.test.ts",owner:"src/semantic/shared-primitives.ts"}),ln("semantic-signatures",{dependsOn:["project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","symbol","projectFingerprint","language","semanticEngine","payloadVersion"],stalenessTest:"tests/semantic/rust/rust-semantic-cache-gate.test.ts",owner:"src/semantic/shared-primitives.ts"}),ln("health-semantic-prewarm",{dependsOn:["project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","scope","cliVersion","projectFingerprint","payloadVersion"],stalenessTest:"tests/runtime/cli-support.test.ts",owner:"src/runtime/cli-support.ts"})];function le(e){let t=new Map;return{kind:e.kind,read(n,r,i){let o=!1,s=0,a;if(pr()){let c=We(n);if(c){let l=`${c}\0${r}\0${i}`;a=t.get(l),a||(a=fr(["evidence-product-file-read-v1",e.kind,c,r,i]),t.set(l,a))}}return ge("evidence-product.file.read",()=>{let c=Yi(n,e.kind,r,i);if(c===null)return null;s=c.length;try{let l=e.deserialize(c);return o=l!==null,l}catch{return null}},()=>({...a?{workIdentity:a,workOutcome:"computed"}:{},scope:"file",kind:e.kind,available:!0,hit:o,payloadBytes:s}))},write(n,r,i,o){eo(n,e.kind,r,i,e.serialize(o))},writeBatch(n,r){to(n,r.map(i=>({kind:e.kind,relativePath:i.relativePath,contentHash:i.contentHash,payload:e.serialize(i.value)})))}}}function So(e){let t=new Map;return{kind:e.kind,read(n,r,i){let o=!1,s=0,a;if(pr()){let c=`${i}\0${r}`;a=t.get(c),a||(a=fr(["evidence-product-project-read-v1",e.kind,i,r]),t.set(c,a))}return ge("evidence-product.project.read",()=>{let c=no(n,e.kind,r,i);if(c===null)return null;s=c.length;try{let l=e.deserialize(c);return o=l!==null,l}catch{return null}},()=>({...a?{workIdentity:a,workOutcome:"computed"}:{},scope:"project",kind:e.kind,available:!0,hit:o,payloadBytes:s}))},write(n,r,i,o){ro(n,e.kind,r,i,e.serialize(o))}}}function X(e){let t=sl.find(n=>n.kind===e);if(!t)throw new Error(`missing evidence product manifest entry for ${e}`);return t.invalidation}function U(e,t){return{scope:"file",kind:e,invalidation:{scope:"file",...t}}}function ln(e,t){return{scope:"project",kind:e,invalidation:{scope:"project",...t}}}function kt(e){return e.type==="comment"||e.type==="line_comment"||e.type==="block_comment"}var al=new Set(["function_declaration","generator_function_declaration","method_definition","method_signature","function_signature"]),bo=new Set(["arrow_function","function_expression","generator_function"]);function cl(e,t){let n=pl(e,t);if(n)return n;if(!dl(e.type,t))return null;let r=e.childForFieldName("name")??e.namedChildren.find(i=>i.type==="identifier"||i.type==="property_identifier");return r?{name:r.text,definitionNode:e,functionNode:e}:null}function un(e,t){let n=cl(e,t);if(!n)return null;let{definitionNode:r,functionNode:i}=n;return{name:n.name,startLine:r.startPosition.row,endLine:r.endPosition.row,paramCount:fl(i),params:ll(i),paramsEndLine:ul(i),isLiteralPassthrough:ml(i,t)}}function vo(e){return e.namedChildren.find(t=>t.type==="parameters"||t.type==="formal_parameters")}function ll(e){let t=vo(e);if(!t)return[];let n=[];for(let r of t.namedChildren){if(kt(r))continue;if(r.type==="identifier"){n.push({name:r.text,simple:!0});continue}let i=r.namedChildren.some(a=>a.type.endsWith("_modifier"))||/^\s*(?:public|private|protected|readonly|override)\b/.test(r.text),o=r.childForFieldName("pattern");if(!i&&o&&o.type==="identifier"){n.push({name:o.text,simple:!0});continue}let s=r.namedChildren.find(a=>a.type==="identifier");n.push({name:o?.type==="identifier"?o.text:s?.text??"",simple:!1})}return n}function ul(e){let t=vo(e);return t?t.endPosition.row:e.startPosition.row}function dl(e,t){return t==="rust"?e==="function_item"||e==="function_signature_item":t==="python"?e==="function_definition":t==="typescript"||t==="tsx"||t==="javascript"?al.has(e):!1}function pl(e,t){if(t!=="typescript"&&t!=="tsx"&&t!=="javascript")return null;if(e.type==="variable_declarator"){let n=e.childForFieldName("name")??e.namedChild(0),r=e.childForFieldName("value")??e.namedChild(1);if(!n||!r)return null;let i=xo(r);return i?{name:n.text,definitionNode:e,functionNode:i}:null}if(e.type==="public_field_definition"){let n=e.childForFieldName("name")??e.namedChild(0),r=e.childForFieldName("value")??e.namedChild(1);if(!n||!r)return null;let i=xo(r);return i?{name:n.text,definitionNode:e,functionNode:i}:null}return null}function xo(e){if(bo.has(e.type))return e;if(e.type!=="call_expression"||(e.childForFieldName("function")??e.namedChild(0))?.type!=="call_expression")return null;let r=((e.childForFieldName("arguments")??e.namedChildren.find(i=>i.type==="arguments"))?.namedChildren??[]).filter(i=>bo.has(i.type));return r.length===1?r[0]:null}function fl(e){let t=e.namedChildren.find(r=>r.type==="parameters"||r.type==="formal_parameters");if(!t)return 0;let n=0;for(let r of t.namedChildren)kt(r)||(n+=1);return n}function ml(e,t){let n=e.namedChildren.find(d=>d.type==="block"||d.type==="statement_block");if(!n)return!1;let r=n.namedChildren.filter(d=>!kt(d));if(r.length!==1)return!1;let i=r[0],o=null;if(i.type==="return_statement"||i.type==="expression_statement"?o=i.namedChild(0)??null:t==="rust"&&(i.type==="call_expression"||i.type==="macro_invocation")&&(o=i),!o)return!1;let s=t==="python"?"call":"call_expression";if(o.type!==s)return!1;let a=o.namedChildren.find(d=>d.type==="arguments"||d.type==="argument_list");if(!a)return!1;let c=a.namedChildren.filter(d=>!kt(d)),l=e.namedChildren.find(d=>d.type==="parameters"||d.type==="formal_parameters");if(!l)return!1;let u=[];for(let d of l.namedChildren){if(d.type==="identifier"){u.push(d.text);continue}let p=d.namedChildren.find(f=>f.type==="identifier");p&&u.push(p.text)}if(c.length!==u.length)return!1;for(let d=0;d<u.length;d+=1){let p=c[d];if(p.type!=="identifier"||p.text!==u[d])return!1}return!0}var gl=new Set(["identifier","type_identifier","field_identifier"]),yl=new Set(["identifier"]),hl=new Set(["identifier","property_identifier","type_identifier","shorthand_property_identifier","shorthand_property_identifier_pattern"]),Sl=new Set(["rust","python"]),bl=/\{([^{}]*)\}/g,xl=/\b([A-Za-z_][\w]*)\b/g;function No(e,t){return vl(t).has(e.type)}function Eo(e,t){return Sl.has(t)&&e.type==="string_content"}function Ir(e){let t=0;for(let r of e.values()){let i=r[r.length-1];i!==void 0&&i>t&&(t=i)}let n=new Array(t+1);for(let r=0;r<=t;r+=1)n[r]=new Set;for(let[r,i]of e)for(let o of i)n[o].add(r);return n}function vl(e){return e==="rust"?gl:e==="python"?yl:hl}function Co(e,t){let n=e.startPosition.row;for(let r of e.text.matchAll(bl)){let i=r[1]??"";for(let o of i.matchAll(xl))o[1]&&t(o[1],n)}}var Nl=[/\bdefault\s*=\s*"([^"]+)"/g,/\bwith\s*=\s*"([^"]+)"/g,/\bserialize_with\s*=\s*"([^"]+)"/g,/\bdeserialize_with\s*=\s*"([^"]+)"/g,/\bskip_serializing_if\s*=\s*"([^"]+)"/g,/\bgetter\s*=\s*"([^"]+)"/g,/\brename_all_with\s*=\s*"([^"]+)"/g,/\bschema_with\s*=\s*"([^"]+)"/g],El=/^#!?\[\s*serde\s*\(/,Cl=/^#!?\[\s*schemars\s*\(/,_l=/^#!?\[\s*validate\s*\(/,Il=new Set(["invoke","invokeTauriCommand","listen","once","emit","subscribe","dispatch","sendCommand","callRust"]);function _o(e,t,n){if(t!=="typescript"&&t!=="tsx"&&t!=="javascript"||e.type!=="call_expression")return;let r=e.childForFieldName("function")??e.namedChild(0);if(!r)return;let i=_e(r);if(!i||!Il.has(i))return;let o=e.namedChildren.find(c=>c.type==="arguments");if(!o)return;let s=o.namedChild(0);if(!s||s.type!=="string")return;let a=s.namedChildren.find(c=>c.type==="string_fragment");a&&n.add(a.text)}function Io(e,t){let n=El.test(e),r=Cl.test(e),i=_l.test(e);if(!(!n&&!r&&!i))for(let o of Nl){o.lastIndex=0;let s;for(;(s=o.exec(e))!==null;){let a=s[1],c=a.split("::").pop()??a;c==="is_none"&&/\bOption\b/.test(a)||c==="is_empty"&&/\b(String|Vec|HashMap|BTreeMap|HashSet|BTreeSet)\b/.test(a)||c&&t.add(c)}}}function Ro(e,t){let n=new Map,r=(s,a)=>{if(s===a)return;let c=n.get(s);c||(c=new Set,n.set(s,c)),c.add(a)},i=t==="python"?new Set(["identifier"]):new Set(["type_identifier"]),o=(s,a)=>{let c=l=>{i.has(l.type)&&l.text!==a&&r(l.text,a);for(let u of l.children)c(u)};for(let l of s.children)c(l)};if(t==="rust")for(let s of e.rootNode.descendantsOfType(["struct_item","enum_item","union_item","type_item"])){let a=s.namedChildren.find(l=>l.type==="type_identifier")?.text;if(!a)continue;let c=s.namedChildren.find(l=>l.type==="field_declaration_list"||l.type==="enum_variant_list"||l.type==="ordered_field_declaration_list");c&&o(c,a),s.type==="type_item"&&o(s,a)}else if(t==="python")for(let s of e.rootNode.descendantsOfType("class_definition")){let a=s.namedChildren.find(u=>u.type==="identifier")?.text;if(!a)continue;let c=s.childForFieldName("superclasses");c&&o(c,a);let l=s.namedChildren.find(u=>u.type==="block");if(l)for(let u of l.descendantsOfType("type"))for(let d of u.descendantsOfType("identifier"))d.text!==a&&r(d.text,a)}else for(let s of e.rootNode.descendantsOfType(["interface_declaration","type_alias_declaration","class_declaration"])){let a=s.namedChildren.find(c=>c.type==="type_identifier")?.text;a&&o(s,a)}return n}var Rl=new Map([["defn","function"],["defn-","function"],["defmacro","macro"],["defmacro-","macro"],["defmethod","method"]]),Rr=new Set(["catch","comment","def","defprotocol","defrecord","deftype","defmethod","defmacro","defmacro-","defn","defn-","do","doseq","dotimes","fn","for","if","let","loop","ns","quote","recur","throw","try","extend-protocol","extend-type","when","when-let","when-not"]);function Fo(e){let t=[],n=[],r=[],i=new Map,o=[],s=0,a=0,c=(l,u)=>{let d=i.get(l);if(!d){i.set(l,[u]);return}d[d.length-1]!==u&&d.push(u)};for(;a<e.length;){let l=e[a];if(l===`
|
|
96
|
+
`){s+=1,a+=1;continue}if(/\s|,/.test(l)){a+=1;continue}if(l===";"){a=pn(e,a);continue}if(l==='"'){let m=At(e,a,s);s=m.line,a=m.index;continue}if(l==="("||l==="["||l==="{"){o.push({kind:l,startLine:s,endLine:s,headTokens:[],tokens:[],children:[]}),a+=1;continue}if(l===")"||l==="]"||l==="}"){let m=o.pop();m&&(m.endLine=s,Fl(m,{callables:t,callSites:n,clojureMembers:r,recordIdentifier:c}),o[o.length-1]?.children.push(m)),a+=1;continue}if(Fr(l)){a+=1;continue}let u=s,d=a;for(;a<e.length&&!Tr(e[a]);)a+=1;let p=e.slice(d,a);if(!p)continue;let f={text:p,line:u};Tl(o[o.length-1],f),c(te(p),u)}return{language:"clojure",callables:t,callSites:n,clojureMembers:r,typeContainerMap:new Map,identifierLineMap:i,identifiersByLine:Dl(i),fileIdentifiers:new Set(i.keys()),rustAttrReferencedNames:new Set,crossLanguageDispatchNames:new Set}}function Fl(e,t){if(e.kind!=="("||e.headTokens.length===0)return;let n=e.headTokens[0],r=te(n.text),i=Rl.get(n.text);if(i){let s=e.headTokens[1];if(s){let a=te(s.text);t.recordIdentifier(a,s.line),t.callables.push({name:a,startLine:e.startLine,endLine:e.endLine,paramCount:0,params:[],paramsEndLine:s.line,isLiteralPassthrough:!1,clojureKind:i})}}if(Pl(e,t),!r||Rr.has(n.text)||Rr.has(r)||r.startsWith(":"))return;let o=kl(n.text);t.callSites.push({calleeLeaf:o.leaf,calleeQualifier:o.qualifier,calleeText:o.text,memberAccess:!1,line:n.line})}function Tl(e,t){e&&(e.headTokens.length<2&&e.headTokens.push(t),e.tokens.length<200&&e.tokens.push(t))}function Pl(e,t){let n=te(e.tokens[0]?.text??"");if(n==="defprotocol"){let r=te(e.tokens[1]?.text??"");if(!r)return;for(let i of dn(e))Dt(t,r,"protocol",i,"protocol-method");return}if(n==="defrecord"||n==="deftype"){let r=te(e.tokens[1]?.text??"");if(!r)return;let i=n==="defrecord"?"record":"type",o=n==="defrecord"?"record-method":"type-method";for(let s of dn(e))Dt(t,r,i,s,o);return}if(n==="extend-type"){let r=te(e.tokens[1]?.text??"");if(!r)return;for(let i of dn(e))Dt(t,r,"extension",i,"extension-method");return}if(n==="extend-protocol"){let r=te(e.tokens[1]?.text??"");for(let i of dn(e)){r&&Dt(t,r,"extension",i,"extension-method");let o=Ll(e,i.startLine);o&&o!==r&&Dt(t,o,"extension",i,"extension-method")}}}function dn(e){return e.children.filter(wl)}function wl(e){if(e.kind!=="(")return!1;let t=te(e.tokens[0]?.text??"");return!!(t&&!Rr.has(t)&&!t.startsWith(":"))}function Dt(e,t,n,r,i){let o=r.tokens[0],s=te(o?.text??"");!o||!s||(e.recordIdentifier(s,o.line),e.clojureMembers.push({ownerName:t,ownerKind:n,memberName:s,memberKind:i,startLine:r.startLine,endLine:r.endLine}))}function Ll(e,t){let n=null;for(let r=2;r<e.tokens.length;r+=1){let i=e.tokens[r];if(i.line>t)break;let o=te(i.text);o&&!o.startsWith(":")&&(n=o)}return n}function te(e){return e.replace(/^#?['`~@]+/,"").split("/").pop()?.replace(/^\./,"")??""}function kl(e){let t=e.replace(/^#?['`~@]+/,""),n=t.lastIndexOf("/"),r=te(t);if(n<=0)return{leaf:r,text:t};let i=t.slice(0,n);return{leaf:r,qualifier:i,text:t}}function pn(e,t){let n=t;for(;n<e.length&&e[n]!==`
|
|
97
|
+
`;)n+=1;return n}function At(e,t,n){let r=t+1,i=n;for(;r<e.length;){let o=e[r];if(o==="\\"){r+=2;continue}if(o===`
|
|
98
|
+
`&&(i+=1),r+=1,o==='"')break}return{index:r,line:i}}function Fr(e){return e==="'"||e==="`"||e==="~"||e==="@"||e==="^"||e==="#"}function Tr(e){return/\s|,/.test(e)||e==="("||e===")"||e==="["||e==="]"||e==="{"||e==="}"||e==='"'||e===";"}function Dl(e){let t=[];for(let[n,r]of e)for(let i of r)t[i]??=new Set,t[i].add(n);return t}var To=6,Al=ze("source-facts",{clearGroups:["whole-project","source-file"]}),Pr=le({kind:"source-facts",invalidation:X("source-facts"),serialize:$l,deserialize:Bl});function A(e,t){return wr(e,t).facts}function wr(e,t){let n=x(e,t);if(!n)return{facts:null};let r=Ol(e,t,n);return r?Al.get(e,t,n,()=>Ml(e,t,r,n)):{facts:null}}function Ol(e,t,n){return Se(t)?wt(e,t,n)?.language??null:H(t)}function Ml(e,t,n,r){let i=he(e,t,r),o=Pr.read(e,t,i);if(o&&o.language===n)return{facts:o};if(n==="clojure"){let c=Fo(r);return Pr.write(e,t,i,c),{facts:c}}let s=R(e,t);if(!s)return{facts:null,unavailable:{language:n,reason:"parser-unavailable"}};let a=Hl(s,n);return Pr.write(e,t,i,a),{facts:a}}function $l(e){let t={version:To,language:e.language,callables:e.callables,callSites:e.callSites,clojureMembers:e.clojureMembers,typeContainerMap:[...e.typeContainerMap.entries()].map(([n,r])=>[n,[...r]]),identifierLineMap:[...e.identifierLineMap.entries()],rustAttrReferencedNames:[...e.rustAttrReferencedNames],crossLanguageDispatchNames:[...e.crossLanguageDispatchNames]};return JSON.stringify(t)}function Bl(e){try{let t=JSON.parse(e);if(t.version!==To||t.language==="clojure"&&(t.clojureMembers===void 0||t.callSites.some(r=>r.calleeText===void 0)))return null;let n=new Map(t.identifierLineMap);return{language:t.language,callables:t.callables,callSites:t.callSites,clojureMembers:t.clojureMembers??[],typeContainerMap:new Map(t.typeContainerMap.map(([r,i])=>[r,new Set(i)])),identifierLineMap:n,identifiersByLine:Ir(n),fileIdentifiers:new Set(n.keys()),rustAttrReferencedNames:new Set(t.rustAttrReferencedNames),crossLanguageDispatchNames:new Set(t.crossLanguageDispatchNames)}}catch{return null}}function jl(e,t,n,r){let i=A(e,t);return i?Ul(i,n,r)?.isLiteralPassthrough??!0:!0}function Vl(e,t){return t.relativePath.includes(".clj-kondo/hooks/")?!0:A(e,t.relativePath)?.callables.find(r=>r.startLine===t.startLine&&r.endLine===t.endLine)?.clojureKind==="macro"}function Ul(e,t,n){return e.callables.find(r=>r.startLine===t&&r.endLine===n)??null}function Hl(e,t){let n=[],r=[],i=new Set,o=new Set,s=new Map,a=(l,u)=>{let d=s.get(l);if(!d){s.set(l,[u]);return}d[d.length-1]!==u&&d.push(u)},c=l=>{let u=un(l,t);u&&n.push(u);let d=mt(l,t);d&&r.push(d),_o(l,t,o),t==="rust"&&(l.type==="attribute_item"||l.type==="inner_attribute_item")&&Io(l.text,i),No(l,t)&&a(l.text,l.startPosition.row),Eo(l,t)&&Co(l,a);for(let p of l.children)c(p)};return c(e.rootNode),{language:t,callables:n,callSites:r,clojureMembers:[],typeContainerMap:Ro(e,t),identifierLineMap:s,identifiersByLine:Ir(s),fileIdentifiers:new Set(s.keys()),rustAttrReferencedNames:i,crossLanguageDispatchNames:o}}var Po=new Set(["rust","typescript","tsx","javascript","python","clojure"]);function Lr(e,t){let n=A(e,t);return!n||!Po.has(n.language)?null:n.callables.map(r=>({name:r.name,startLine:r.startLine,endLine:r.endLine}))}function zl(e,t){let n=A(e,t);return!n||!Po.has(n.language)?null:n.callSites}function Wl(e,t){return A(e,t)?.typeContainerMap??new Map}import{ElementTypes as Kl,NodeTypes as kr,parse as Gl}from"@vue/compiler-dom";import{parse as qb}from"@vue/compiler-sfc";var ql=new Set(["children","className","data","e","err","error","ev","event","false","id","idx","index","item","key","null","props","res","result","state","style","true","undefined","val","value"]);function fn(e){return e.length<=2||ql.has(e)}function mn(e,t){return e.split(t).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join("")}var Xl=De("vue-template-facts"),Jl=new Set(["component","keep-alive","slot","suspense","teleport","template","transition","transition-group"]),Ql=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]),Zl=new Set(["div","span","template"]),Yl=new Set(["as","await","break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","false","finally","for","from","function","if","import","in","instanceof","let","new","null","of","return","super","switch","this","throw","true","try","typeof","undefined","var","void","while","with","yield"]);function gn(e,t){let n=t.replace(/\\/g,"/"),r=x(e,n);return Xl.get(e,n,r,()=>eu(n,ft(e,n).template))}function eu(e,t){let n={relativePath:e,template:t?{startLine:t.startLine,endLine:t.endLine}:null,componentTags:[],nativeTags:[],builtinTags:[],props:[],events:[],directives:[],slots:[],expressionIdentifiers:[],structuralTokens:[]};if(!t)return n;let r;try{r=Gl(t.body,{comments:!1})}catch{return n}let i=new Set,o=s=>{s.trim()&&i.add(s)};return Lo(r.children,t.startLine,n,o),n.structuralTokens=[...i].sort(),n}function Lo(e,t,n,r){for(let i of e)if(i.type===kr.ELEMENT)tu(i,t,n,r),Lo(i.children,t,n,r);else if(i.type===kr.INTERPOLATION){r("interpolation");let o=Dr(i.content);o&&ko(o,t,i.loc.start.line,n,r)}}function tu(e,t,n,r){let i=cu(e.tag),o={tag:e.tag,normalized:i,kind:au(e),startLine:gt(t,e.loc.start.line),endLine:gt(t,e.loc.end.line)};o.kind==="component"?(n.componentTags.push(o),r(`component:${i}`)):o.kind==="builtin"?(n.builtinTags.push(o),r(`builtin:${i}`)):(n.nativeTags.push(o),Zl.has(e.tag)||r(`native:${e.tag}`));for(let s of e.props)nu(s,t,n,r)}function nu(e,t,n,r){if(e.type===kr.ATTRIBUTE){let a=e.value?.content??null,c=wo("prop",e.name,a,t,e.loc.start.line,e.loc.end.line);n.props.push(c),r(`prop:${e.name}`);return}let i=iu(e),o=Dr(e.exp),s=wo(ru(e.name),i,o,t,e.loc.start.line,e.loc.end.line);switch(s.kind){case"prop":n.props.push(s),r(`prop:${i}`);break;case"event":n.events.push(s),r(`event:${i}`);break;case"slot":n.slots.push(s),r(`slot:${i}`);break;case"directive":n.directives.push(s),r(`directive:${i}`);break}o&&ko(o,t,e.loc.start.line,n,r)}function wo(e,t,n,r,i,o){return{kind:e,name:t,value:n,startLine:gt(r,i),endLine:gt(r,o)}}function ru(e){switch(e){case"bind":case"model":return"prop";case"on":return"event";case"slot":return"slot";default:return"directive"}}function iu(e){let t=Dr(e.arg);return t||e.name}function Dr(e){if(!e)return null;let t=("content"in e&&typeof e.content=="string"?e.content:e.loc.source).trim();return t||null}function ko(e,t,n,r,i){for(let o of ou(e)){let s={name:o,startLine:gt(t,n),endLine:gt(t,n)};r.expressionIdentifiers.push(s),i(`id:${o}`)}}function ou(e){let t=new Set,n=su(e),r=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,i;for(;i=r.exec(n);){let o=i[0];Yl.has(o)||fn(o)||/^[A-Z_]+$/.test(o)||t.add(o)}return[...t].sort()}function su(e){return e.replace(/\/\*[\s\S]*?\*\//g," ").replace(/\/\/.*$/gm," ").replace(/`(?:\\[\s\S]|\$\{([^}]*)\}|[^`\\])*`/g,(t,n)=>n??" ").replace(/'(?:\\[\s\S]|[^'\\])*'/g," ").replace(/"(?:\\[\s\S]|[^"\\])*"/g," ")}function au(e){let t=e.tag;return e.tagType===Kl.COMPONENT?"component":Jl.has(t)?"builtin":Ql.has(t)?"native":/^[A-Z]/.test(t)||t.includes("-")?"component":"native"}function cu(e){return mn(e,/[-_:]/)}function gt(e,t){return e+Math.max(0,t-1)}import{createRequire as bu}from"module";import{existsSync as Je}from"fs";import{basename as Ao,dirname as J,extname as Ie,join as ne,relative as Ge,resolve as O,sep as xu}from"path";import{existsSync as Or,readdirSync as lu,statSync as uu}from"fs";import{join as yt,relative as du}from"path";function Do(e){let t=pu(e)??yu(e);if(!t||t.length===0)return[];let n=[],r=new Set;for(let i of t)for(let o of hu(e,i)){if(r.has(o))continue;r.add(o);let s=Su(e,o);s&&n.push(s)}return n}function pu(e){let t=yt(e,"pnpm-workspace.yaml");if(!Or(t))return null;try{return fu(st(t,"pnpm workspace manifest"))}catch{return null}}function fu(e){let t=[],n=!1;for(let r of e.split(/\r?\n/)){let i=mu(r);if(!n){/^packages\s*:\s*$/.test(i.trim())&&(n=!0);continue}let o=/^\s+-\s*(.+)$/.exec(i);if(o){let s=gu(o[1].trim());s&&t.push(s);continue}if(i.trim()!=="")break}return t}function mu(e){let t=e.indexOf("#");return t===-1?e:e.slice(0,t)}function gu(e){return e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e}function yu(e){let t=yt(e,"package.json");if(!Or(t))return null;try{let n=JSON.parse(st(t,"workspace package manifest"));return n.workspaces?Array.isArray(n.workspaces)?n.workspaces:n.workspaces.packages??[]:null}catch{return null}}function hu(e,t){if(!t||t.startsWith("!")||t.includes("node_modules"))return[];if(!t.includes("*")){let s=yt(e,t);return Ar(s)?[s]:[]}let n=t.indexOf("*"),r=t.slice(0,n).replace(/\/$/,""),i=t.slice(n+1).replace(/^\//,""),o=yt(e,r||".");return Ar(o)?lu(o).map(s=>yt(o,s,i)).filter(Ar):[]}function Ar(e){try{return uu(e).isDirectory()}catch{return!1}}function Su(e,t){let n=yt(t,"package.json");if(!Or(n))return null;try{let r=JSON.parse(st(n,"workspace package manifest"));return typeof r.name!="string"||r.name.length===0?null:{name:r.name,relativeDir:du(e,t).replace(/\\/g,"/"),exports:r.exports}}catch{return null}}var vu=ye("indexed-paths",{clearGroups:[]}),Nu=ye("indexed-path-digest",{clearGroups:[]}),Eu=v("tsconfig-alias-config",{clearGroups:["whole-project"]}),Cu=v("tsconfig-alias-config-for-dir",{clearGroups:["whole-project"]}),_u=bu(import.meta.url),Ot;function Iu(){if(Ot!==void 0)return Ot;try{Ot=_u("typescript")}catch{Ot=null}return Ot}var Ru=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"],Fu=ye("workspace-packages",{clearGroups:["whole-project"]}),Xe=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],yn=[".py",".pyi"],Q=[".java",".scala",".kt",".kts"],hn=[".rs"],Sn=[".rb"],bn=[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],Oe=[".cs",".vb"],xn=[".dart"],Qe=[".php"],ht=[".clj",".cljs",".cljc"],Tu=new Set(Xe),Mr=new Set(yn),Oo=new Set(Q),$r=new Set(hn),Br=new Set(Sn),Mo=new Set(bn),$o=new Set(Oe),jr=new Set(xn),Bo=new Set(Qe),jo=new Set(ht),Pu=[{extensions:Xe,lookup:Tu},{extensions:yn,lookup:Mr},{extensions:Q,lookup:Oo},{extensions:hn,lookup:$r},{extensions:Sn,lookup:Br},{extensions:bn,lookup:Mo},{extensions:Oe,lookup:$o},{extensions:xn,lookup:jr},{extensions:Qe,lookup:Bo},{extensions:ht,lookup:jo}];function Re(e,t){return t.has(Ie(e).toLowerCase())}function wu(e){return Re(e,Mr)}function Lu(e){return Re(e,Oo)}function ku(e){return Re(e,$r)}function Du(e){return Re(e,Br)}function Au(e){return Re(e,Mo)}function Ou(e){return Re(e,$o)}function Vo(e){return Ie(e).toLowerCase()===".vb"}function Mu(e){return Re(e,jr)}function $u(e){return Re(e,Bo)}function Bu(e){return Re(e,jo)}function Vr(e){let t=Ie(e).toLowerCase();for(let n of Pu)if(n.lookup.has(t))return n.extensions;return Xe}function ju(e){return Lu(e)||Ou(e)||$u(e)}function be(e,t,n){return wu(t)?St(e,t,n):ku(t)?Fe(e,t,n):Du(t)?vn(e,t,n):Au(t)?Nn(e,t,n):ju(t)?w(e,n.replace(/\\/g,"."),Vr(t)):Mu(t)?En(e,t,n):Bu(t)?Ur(e,n):Vu(e,t,n)}function Vu(e,t,n){if(!n.startsWith(".")&&!n.startsWith("/"))return Uu(e,t,n)??zu(e,n);let r=J(ne(e.config.projectRoot,t)),i=O(r,n),o=Te(e);for(let s of zr(i)){let a=D(Ge(e.config.projectRoot,s));if(o.has(a)||Je(s))return a}return D(Ge(e.config.projectRoot,i))}function Uu(e,t,n){let r=Ju(e,t);if(!r)return null;let i=Te(e);for(let o of Hu(r,n)){let s=O(r.baseUrl,o);for(let a of zr(s)){let c=D(Ge(e.config.projectRoot,a));if(i.has(c)||Je(a))return c}}return null}function Hu(e,t){let n=[];for(let[r,i]of Object.entries(e.paths)){let o=r.indexOf("*");if(o===-1){if(t!==r)continue;n.push(...i);continue}let s=r.slice(0,o),a=r.slice(o+1);if(!t.startsWith(s)||!t.endsWith(a)||t.length<s.length+a.length)continue;let c=t.slice(s.length,t.length-a.length);for(let l of i)n.push(l.includes("*")?l.replace("*",c):l)}return n}function zu(e,t){let n=qu(Wu(e),t);if(!n)return null;let r=Te(e);for(let i of Ku(n)){let o=O(e.config.projectRoot,n.pkg.relativeDir,i);for(let s of zr(o)){let a=D(Ge(e.config.projectRoot,s));if(r.has(a)||Je(s))return a}}return null}function Wu(e){return Fu.get(e,()=>Do(e.config.projectRoot))}function qu(e,t){let n=null;for(let r of e){let i=null;t===r.name?i="":t.startsWith(`${r.name}/`)&&(i=t.slice(r.name.length+1)),i!==null&&(!n||r.name.length>n.pkg.name.length)&&(n={pkg:r,subpath:i})}return n}function Ku(e){let t=[],n=Gu(e.pkg.exports,e.subpath);if(n){let r=Xu(n);r&&t.push(r)}return t.push(e.subpath?`src/${e.subpath}`:"src/index"),t}function Gu(e,t){if(!e||typeof e!="object")return null;let n=t===""?".":`./${t}`;return Uo(e[n])}function Uo(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;let t=e;for(let n of["types","import","default","require","node"]){let r=Uo(t[n]);if(r)return r}return null}function Xu(e){let t=e.replace(/^\.\//,"");return t.startsWith("dist/")?`src/${t.slice(5)}`:null}function Ju(e,t){let n=D(J(t));return Cu.get(e,n,()=>Qu(e,n))}function Qu(e,t){let n=Iu();if(!n)return null;let r=O(e.config.projectRoot),i=O(r,t);for(;i===r||i.startsWith(r+xu);){for(let s of Ru){let a=ne(i,s);if(!Je(a))continue;let c=Eu.get(e,a,()=>Zu(n,a));if(c)return c}let o=J(i);if(o===i)break;i=o}return null}function Zu(e,t){try{let n=e.readConfigFile(t,e.sys.readFile);if(n.error||!n.config)return null;let r=e.parseJsonConfigFileContent(n.config,e.sys,J(t)),i=r.options.paths;return!i||Object.keys(i).length===0?null:{baseUrl:r.options.baseUrl?O(J(t),r.options.baseUrl):J(t),paths:i}}catch{return null}}function St(e,t,n){let r=Te(e),i;if(n.startsWith(".")){let o=n.match(/^(\.+)(.*)$/);if(!o)return null;let s=o[1].length,a=o[2].replace(/^\./,""),c=J(ne(e.config.projectRoot,t));for(let l=1;l<s;l++)c=J(c);i=a?O(c,a.replace(/\./g,"/")):c}else i=O(e.config.projectRoot,n.replace(/\./g,"/"));for(let o of Yu(i)){let s=D(Ge(e.config.projectRoot,o));if(r.has(s)||Je(o))return s}return null}function Fe(e,t,n){if(!n)return null;let r=n.replace(/\s+as\s+.+$/,"").trim();if(!r.startsWith("crate::")&&!r.startsWith("self::")&&!r.startsWith("super::"))return null;let i=J(ne(e.config.projectRoot,t)),o;return r.startsWith("crate::")?o=O(e.config.projectRoot,"src",r.slice(7).replace(/::/g,"/")):r.startsWith("self::")?o=O(i,r.slice(6).replace(/::/g,"/")):o=O(J(i),r.slice(7).replace(/::/g,"/")),Hr(e,ed(o))}function vn(e,t,n){let r=J(ne(e.config.projectRoot,t)),i=O(r,n);return Hr(e,td(i))}function Nn(e,t,n){let r=J(ne(e.config.projectRoot,t)),i=[O(r,n),O(e.config.projectRoot,n),O(e.config.projectRoot,"include",n),O(e.config.projectRoot,"src",n)];return Hr(e,i)}function w(e,t,n){let r=Te(e),i=t.replace(/\\/g,".").replace(/::/g,".").replace(/^global::/,""),o=i.replace(/\./g,"/"),s=i.split(".").pop()??i;for(let c of n){let l=`${o}${c}`,u=[...r].find(d=>d.endsWith(l));if(u)return u}for(let c of n){let l=[...r].find(u=>Ao(u)===`${s}${c}`);if(l)return l}let a=[...r].filter(c=>n.includes(Ie(c).toLowerCase())).filter(c=>c.includes(`/${o}/`)||c.includes(`/${s}/`)).sort((c,l)=>c.localeCompare(l));return a.length===1?a[0]:null}function En(e,t,n){let r=Te(e);if(n.startsWith("package:")){let s=n.slice(8),a=s.indexOf("/");if(a<0)return null;let c=s.slice(a+1),l=D(c.startsWith("lib/")?c:`lib/${c}`);return r.has(l)?l:null}let i=J(ne(e.config.projectRoot,t)),o=O(i,n);for(let s of nd(o)){let a=D(Ge(e.config.projectRoot,s));if(r.has(a)||Je(s))return a}return null}function Ur(e,t){let n=t.replace(/-/g,"_").replace(/\./g,"/"),r=Te(e);for(let i of ht){let o=`${n}${i}`,s=[...r].find(a=>a.endsWith(o));if(s)return s}for(let i of ht){let o=[...r].find(s=>Ao(s)===`${n.split("/").pop()}${i}`);if(o)return o}return null}function Yu(e){let t=Ie(e);return Mr.has(t)?[e]:[`${e}.py`,`${e}.pyi`,ne(e,"__init__.py"),ne(e,"__init__.pyi")]}function Hr(e,t){let n=Te(e);for(let r of t){let i=D(Ge(e.config.projectRoot,r));if(n.has(i)||Je(r))return i}return null}function ed(e){let t=Ie(e);return $r.has(t)?[e]:[`${e}.rs`,ne(e,"mod.rs")]}function td(e){let t=Ie(e);return Br.has(t)?[e]:[`${e}.rb`,ne(e,"index.rb")]}function nd(e){let t=Ie(e);return jr.has(t)?[e]:[`${e}.dart`,e]}function zr(e){let t=Ie(e),n=new Set;if(t){n.add(e);for(let r of Xe)n.add(e.slice(0,-t.length)+r)}else for(let r of Xe)n.add(`${e}${r}`),n.add(ne(e,`index${r}`));return[...n]}function Te(e){return vu.get(e,()=>new Set(ee(e,{includeIgnored:!1}).map(D)))}function Wr(e){return Nu.get(e,()=>Ne([...Te(e)].sort().join(`
|
|
99
|
+
`)))}import{readdirSync as rd}from"fs";import{execFileSync as id}from"child_process";import{extname as Cn,join as od}from"path";var sd=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".clj",".cljs",".cljc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],hx=[".vue"],Ho=[".tsx",".jsx"],zo=[".vue"],ad=[...Ho,...zo],cd=new Set(Ho),ld=new Set(zo),Wo=new Set(sd.map(e=>e.toLowerCase())),ud=[...Wo].sort().join(","),qo=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs","out","coverage",".codebaseiq-cache","__pycache__",".venv","venv",".idea",".vscode"]);function z(e,t={}){let n=t.includeIndexed??!0,r=t.includeAuxiliary??!0,i=t.extensions?.map(c=>c.toLowerCase()),o=i?new Set(i):Wo,s=i?[...o].sort().join(","):ud,a=`${n?"1":"0"}|${r?"1":"0"}|${s}`;return dd.get(e,a,()=>{let c=new Set;if(n)for(let l of ee(e,{includeIgnored:!1}))o.has(Cn(l).toLowerCase())&&c.add(l);if(r)for(let l of pd(e.config.projectRoot,o))e.isIgnored(l)||n&&c.has(l)||c.add(l);return[...c].sort()})}function Sx(e,t={}){let n=!1,r=!1;for(let i of z(e,{extensions:ad})){if(t.scope&&!i.includes(t.scope))continue;let o=Cn(i).toLowerCase();if(n||=cd.has(o),r||=ld.has(o),n&&r)break}return{react:n,vue:r}}var dd=v("source-files",{clearGroups:[]});function pd(e,t){return fd(e,t)??gd(e,t)}function fd(e,t){try{let n=id("git",["ls-files","--cached","--others","--exclude-standard"],{cwd:e,encoding:"utf-8",timeout:1e4,killSignal:"SIGKILL",stdio:["ignore","pipe","ignore"],windowsHide:!0}),r=new Set;for(let i of n.split(`
|
|
100
|
+
`)){let o=i.trim();o&&(md(o)||t.has(Cn(o).toLowerCase())&&r.add(o))}return r}catch{return null}}function md(e){return e.split("/").some(t=>qo.has(t))}function gd(e,t){let n=new Set,r=i=>{let o=i?od(e,i):e,s;try{s=rd(o,{withFileTypes:!0})}catch{return}for(let a of s)if(!qo.has(a.name)){if(a.isDirectory()){r(i?`${i}/${a.name}`:a.name);continue}t.has(Cn(a.name).toLowerCase())&&n.add(i?`${i}/${a.name}`:a.name)}};return r(""),n}var yd=new Set(["ref","shallowRef","reactive","computed","watch","watchEffect"]),hd=new Set(["onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","onActivated","onDeactivated","onErrorCaptured"]),Sd=new Set(["axios","fetch","runRequest","useAsyncData","useFetch","useResource"]),bd=new Set(["defineEmits","defineExpose","defineModel","defineOptions","defineProps","withDefaults"]),xd=new Set(["catch","for","function","if","return","switch","while"]);function In(e){let t={imports:[],functions:[],calls:[],composables:[],stores:[],reactivity:[],lifecycle:[],requests:[],macros:[],lineCount:0,externalLineCount:0,externalScriptPaths:[],unresolvedScripts:[]};for(let n of e.scripts){t.lineCount+=Ke(n),n.external&&(t.externalLineCount+=Ke(n),t.externalScriptPaths.push(n.sourcePath));for(let i of n.errors)t.unresolvedScripts.push({sourcePath:n.sourcePath,reason:i});if(!n.body||!n.astLanguage){n.astLanguage||t.unresolvedScripts.push({sourcePath:n.sourcePath,reason:`Unsupported Vue script language: ${n.lang??"unknown"}`});continue}t.imports.push(...Cd(n));let r=qe(n.astLanguage,n.body);r?Nd(n,r.rootNode,t):Ed(n,t)}return vd(t),t.externalScriptPaths=Go(t.externalScriptPaths),t}function vd(e){e.composables=bt(e,"composable"),e.stores=bt(e,"store"),e.reactivity=bt(e,"reactivity"),e.lifecycle=bt(e,"lifecycle"),e.requests=bt(e,"request"),e.macros=bt(e,"macro")}function bt(e,t){return Go(e.calls.filter(n=>n.categories.includes(t)).map(n=>n.name))}function Nd(e,t,n){let r=new Set,i=new Set,o=s=>{let a=un(s,e.astLanguage);if(a){let l=`${a.name}:${a.startLine}:${a.endLine}`;i.has(l)||(i.add(l),n.functions.push({name:a.name,sourcePath:e.sourcePath,startLine:e.startLine+a.startLine,endLine:e.startLine+a.endLine,setup:e.setup}))}let c=mt(s,e.astLanguage);if(c){let l=`${c.calleeLeaf}:${c.line}`;r.has(l)||(r.add(l),n.calls.push({name:c.calleeLeaf,sourcePath:e.sourcePath,line:e.startLine+c.line,categories:Ko(c.calleeLeaf),setup:e.setup}))}for(let l of s.children)o(l)};o(t)}function Ed(e,t){for(let n of e.body.matchAll(/\b([A-Za-z_$][\w$]*)\s*\(/g)){let r=n[1];!r||xd.has(r)||t.calls.push({name:r,sourcePath:e.sourcePath,line:e.startLine+_n(e.body,n.index??0),categories:Ko(r),setup:e.setup})}for(let n of e.body.matchAll(/\bfunction\s+([A-Za-z_$][\w$]*)\b/g)){let r=n[1];if(!r)continue;let i=e.startLine+_n(e.body,n.index??0);t.functions.push({name:r,sourcePath:e.sourcePath,startLine:i,endLine:i,setup:e.setup})}for(let n of e.body.matchAll(/\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:async\s*)?(?:function\b|\([^)]*\)\s*=>|[A-Za-z_$][\w$]*\s*=>)/g)){let r=n[1];if(!r)continue;let i=e.startLine+_n(e.body,n.index??0);t.functions.push({name:r,sourcePath:e.sourcePath,startLine:i,endLine:i,setup:e.setup})}}function Cd(e){let t=[];for(let n of e.body.matchAll(/\bimport\s+(?:type\s+)?([^'";]+?)\s+from\s+['"]([^'"]+)['"]/g)){let r=n[1]?.trim(),i=n[2];if(!r||!i)continue;let o=e.startLine+_n(e.body,n.index??0);for(let s of _d(r))t.push({local:s,source:i,sourcePath:e.sourcePath,line:o,setup:e.setup})}return t}function _d(e){let t=[],r=e.split(",").map(s=>s.trim()).filter(Boolean)[0];r&&!r.startsWith("{")&&!r.startsWith("*")&&t.push(r);let i=/\{([^}]*)\}/.exec(e)?.[1];if(i)for(let s of i.split(",")){let a=s.trim();if(!a)continue;let c=/\bas\s+([A-Za-z_$][\w$]*)$/.exec(a)?.[1];t.push(c??a.replace(/^type\s+/,"").trim())}let o=/\*\s+as\s+([A-Za-z_$][\w$]*)/.exec(e)?.[1];return o&&t.push(o),t.filter(s=>/^[A-Za-z_$][\w$]*$/.test(s))}function Ko(e){let t=["call"];return/^use[A-Z0-9_]/.test(e)&&t.push("composable"),/^use[A-Z0-9_].*Store$/.test(e)&&t.push("store"),yd.has(e)&&t.push("reactivity"),hd.has(e)&&t.push("lifecycle"),Sd.has(e)&&t.push("request"),bd.has(e)&&t.push("macro"),t}function _n(e,t){let n=0;for(let r=0;r<t&&r<e.length;r+=1)e.charCodeAt(r)===10&&(n+=1);return n}function Go(e){return[...new Set(e)].sort()}var Id=new Set(["in","key","of"]),Rd=new Set(["computed","defineEmits","defineProps","reactive","ref","watch","watchEffect"]),Fd=De("vue-component-behavior-profiles");function Xo(e,t={}){let n=z(e,{extensions:[".vue"]}).filter(i=>!t.scope||i.includes(t.scope)).sort();return(typeof t.scanLimit=="number"&&t.scanLimit>0?n.slice(0,t.scanLimit):n).map(i=>qr(e,i)).filter(i=>(t.minTemplateTokens===void 0||i.templateTokens.size>=t.minTemplateTokens)&&(t.minBehaviorTokens===void 0||i.behaviorTokens.size>=t.minBehaviorTokens))}function qr(e,t){let n=t.replace(/\\/g,"/"),r=x(e,n),i=Fd.get(e,n,r,()=>Td(e,n,r));return wd(i)}function Td(e,t,n){let r=ft(e,t),i=gn(e,t),o=In(r),s=Dd(i),a=i.expressionIdentifiers.map(y=>y.name).filter(y=>!s.includes(y)).filter((y,S,b)=>b.indexOf(y)===S).sort(),c=i.componentTags.map(y=>y.normalized).filter((y,S,b)=>b.indexOf(y)===S).sort(),l=n?n.split(`
|
|
101
|
+
`).length:0,u=Ke(r.template),d=o.lineCount,p=r.styles.reduce((y,S)=>y+Ke(S),0),f=r.customBlocks.reduce((y,S)=>y+Ke(S),0),{lines:m,paths:g}=Pd(e,t,o);return{file:t,sfc:r,templateFacts:i,scriptFacts:o,templateTokens:new Set(i.structuralTokens),behaviorTokens:kd(i,o,a),templateBindingNames:a,templateLocalNames:s,componentNames:c,sfcLines:l,totalLines:l+o.externalLineCount,templateLines:u,scriptLines:d,styleLines:p,externalScriptLines:o.externalLineCount,externalScriptPaths:o.externalScriptPaths,customBlockLines:f,delegatedComposableLines:m,delegatedComposablePaths:g}}function Pd(e,t,n){let r=new Set;for(let s of n.composables){let a=n.imports.find(l=>l.local===s);if(!a)continue;let c=be(e,a.sourcePath,a.source);!c||c===t||r.add(c)}let i=[...r].sort();return{lines:i.reduce((s,a)=>{let c=x(e,a);return s+(c?c.split(`
|
|
102
|
+
`).length:0)},0),paths:i}}function wd(e){let t=Ld(e.scriptFacts);return{...e,scriptFacts:t,templateTokens:new Set(e.templateTokens),behaviorTokens:new Set(e.behaviorTokens),templateBindingNames:[...e.templateBindingNames],templateLocalNames:[...e.templateLocalNames],componentNames:[...e.componentNames],externalScriptPaths:t.externalScriptPaths,delegatedComposablePaths:[...e.delegatedComposablePaths]}}function Ld(e){return{...e,imports:e.imports.map(t=>({...t})),functions:e.functions.map(t=>({...t})),calls:e.calls.map(t=>({...t,categories:[...t.categories]})),composables:[...e.composables],stores:[...e.stores],reactivity:[...e.reactivity],lifecycle:[...e.lifecycle],requests:[...e.requests],macros:[...e.macros],externalScriptPaths:[...e.externalScriptPaths],unresolvedScripts:e.unresolvedScripts.map(t=>({...t}))}}function kd(e,t,n){let r=new Set;for(let i of t.composables)r.add(`composable:${i}`);for(let i of t.stores)r.add(`store:${i}`);for(let i of t.reactivity)r.add(`reactivity:${i}`);for(let i of t.lifecycle)r.add(`lifecycle:${i}`);for(let i of t.requests)r.add(`request:${i}`);for(let i of t.macros)r.add(`macro:${i}`);for(let i of t.functions){if(Rd.has(i.name))continue;r.add(`function:${i.name}`);let o=/^[a-z]+/.exec(i.name)?.[0]??null;o&&o.length>2&&o!==i.name&&r.add(`function-verb:${o}`)}for(let i of e.events)r.add(`template-event:${i.name}`);for(let i of n)r.add(`template-binding:${i}`);return r}function Dd(e){let t=new Set;for(let n of e.directives)if(n.name==="for"&&n.value)for(let r of Ad(n.value))t.add(r);for(let n of e.slots)if(n.value)for(let r of Jo(n.value))t.add(r);return[...t].sort()}function Ad(e){let t=/^(.*?)\s+(?:in|of)\s+/.exec(e.trim());return t?Jo(t[1]??""):[]}function Jo(e){let t=[];for(let n of e.matchAll(/\b[A-Za-z_$][\w$]*\b/g)){let r=n[0];Id.has(r)||t.push(r)}return t}import{extname as Od}from"path";var Md=[".tsx",".jsx"],Qo=new Set(["useActionState","useCallback","useContext","useDebugValue","useDeferredValue","useEffect","useId","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useOptimistic","useReducer","useRef","useState","useSyncExternalStore","useTransition"]),$d=new Set(["useEffect","useInsertionEffect","useLayoutEffect"]),Bd=new Set(["useActionState","useOptimistic","useReducer","useRef","useState"]),jd=new Set(["useLocation","useNavigate","useParams","useSearchParams","useTranslation"]),Vd=new Set(["axios","fetch","gql","graphql","mutate","query","request","useMutation","useQuery","useSuspenseQuery"]),Ud=new Set(["add","apply","cancel","change","clear","close","create","delete","fetch","filter","handle","load","open","refresh","remove","render","reset","save","select","submit","toggle","update"]),Hd=new Set(["aria-hidden","className","clipRule","d","fill","fillRule","height","role","stroke","strokeLinecap","strokeLinejoin","strokeWidth","style","viewBox","width","xmlns"]),zd=De("react-component-behavior-profiles"),Zo=le({kind:"react-component-behavior-profiles",invalidation:X("react-component-behavior-profiles"),serialize:Gd,deserialize:Xd});function ns(e,t={}){let n=z(e,{extensions:Md}).filter(i=>!t.scope||i.includes(t.scope)).sort();return(typeof t.scanLimit=="number"&&t.scanLimit>0?n.slice(0,t.scanLimit):n).flatMap(i=>Gr(e,i)).filter(i=>(t.minJsxTokens===void 0||i.jsxTokens.size>=t.minJsxTokens)&&(t.minBehaviorTokens===void 0||i.behaviorTokens.size>=t.minBehaviorTokens))}function Gr(e,t){let n=t.replace(/\\/g,"/"),r=x(e,n);return zd.get(e,n,r,()=>Wd(e,n,r)).map(Kd)}function Wd(e,t,n){let r=he(e,t,n),i=Zo.read(e,t,r);if(i)return i;let o=qd(e,t);return Zo.write(e,t,r,o),o}function qd(e,t){let n=Qd(t);if(!n)return[];let r=R(e,t);if(!r)return[];let i=Pt(e,t).length;return Zd(r.rootNode,n).filter(s=>s.kind==="hook"||Xr(s.bodyNode)).map(s=>{let a=op(s.bodyNode),c=up(s.bodyNode,n);return{file:t,name:s.name,kind:s.kind,startLine:s.node.startPosition.row,endLine:s.node.endPosition.row,loc:Math.max(1,s.node.endPosition.row-s.node.startPosition.row+1),fileLines:i,jsxTokens:a.tokens,behaviorTokens:c.tokens,componentNames:Pe(a.componentNames),nativeTags:Pe(a.nativeTags),propNames:Pe(a.propNames),eventNames:Pe(a.eventNames),hookNames:Pe(c.hookNames),requestNames:Pe(c.requestNames),stateNames:Pe(c.stateNames),effectNames:Pe(c.effectNames),handlerNames:Pe(c.handlerNames)}})}function Kd(e){return{...e,jsxTokens:new Set(e.jsxTokens),behaviorTokens:new Set(e.behaviorTokens),componentNames:[...e.componentNames],nativeTags:[...e.nativeTags],propNames:[...e.propNames],eventNames:[...e.eventNames],hookNames:[...e.hookNames],requestNames:[...e.requestNames],stateNames:[...e.stateNames],effectNames:[...e.effectNames],handlerNames:[...e.handlerNames]}}function Gd(e){return JSON.stringify(e.map(t=>({...t,jsxTokens:[...t.jsxTokens],behaviorTokens:[...t.behaviorTokens]})))}function Xd(e){try{let t=JSON.parse(e);if(!Array.isArray(t))return null;let n=[];for(let r of t){let i=Jd(r);if(!i)return null;n.push(i)}return n}catch{return null}}function Jd(e){if(!ke(e))return null;let{file:t,name:n,kind:r,startLine:i,endLine:o,loc:s,fileLines:a,jsxTokens:c,behaviorTokens:l,componentNames:u,nativeTags:d,propNames:p,eventNames:f,hookNames:m,requestNames:g,stateNames:y,effectNames:S,handlerNames:b}=e;if(typeof t!="string"||typeof n!="string"||r!=="component"&&r!=="hook"||!Rn(i)||!Rn(o)||!Rn(s)||!Rn(a))return null;let N={jsxTokens:Y(c),behaviorTokens:Y(l),componentNames:Y(u),nativeTags:Y(d),propNames:Y(p),eventNames:Y(f),hookNames:Y(m),requestNames:Y(g),stateNames:Y(y),effectNames:Y(S),handlerNames:Y(b)};return Object.values(N).some(E=>E===null)?null:{file:t,name:n,kind:r,startLine:i,endLine:o,loc:s,fileLines:a,jsxTokens:new Set(N.jsxTokens),behaviorTokens:new Set(N.behaviorTokens),componentNames:N.componentNames,nativeTags:N.nativeTags,propNames:N.propNames,eventNames:N.eventNames,hookNames:N.hookNames,requestNames:N.requestNames,stateNames:N.stateNames,effectNames:N.effectNames,handlerNames:N.handlerNames}}function Rn(e){return typeof e=="number"&&Number.isFinite(e)}function Qd(e){let t=Od(e).toLowerCase();return t!==".tsx"&&t!==".jsx"?null:H(e)}function Zd(e,t){let n=[],r=new Set,i=o=>{let s=Yd(o);if(s&&(!rp(o)||s.kind==="component")){let a=`${s.name}:${s.node.startIndex}:${s.node.endIndex}`;r.has(a)||(r.add(a),n.push(s))}for(let a of o.namedChildren)i(a)};return(t==="tsx"||t==="javascript")&&i(e),n}function Yd(e){if(e.type==="class_declaration"){let o=Kr(e);if(!o||!/^[A-Z]/.test(o))return null;let s=ep(e);return!s||!tp(e)&&!Xr(s)?null:{name:o,kind:"component",node:e,bodyNode:s}}if(e.type==="function_declaration"){let o=Kr(e);return!o||!Yo(o)?null:{name:o,kind:es(o),node:e,bodyNode:e}}if(e.type!=="variable_declarator")return null;let t=e.childForFieldName("name")??e.namedChild(0),n=e.childForFieldName("value")??e.namedChild(1),r=Mt(t);if(!r||!n||!Yo(r))return null;let i=np(n);return i?{name:r,kind:es(r),node:e,bodyNode:i}:null}function ep(e){for(let t of e.namedChildren)if(t.type==="class_body")for(let n of t.namedChildren){if(n.type!=="method_definition")continue;if((n.childForFieldName("name")??n.namedChild(0))?.text==="render")return n}return null}function tp(e){return/\b(?:React\.)?(?:Pure)?Component\b/.test(e.text)}function Yo(e){return/^[A-Z]/.test(e)||/^use[A-Z0-9_]/.test(e)}function es(e){return/^use[A-Z0-9_]/.test(e)?"hook":"component"}function np(e){if(e.type==="arrow_function"||e.type==="function_expression")return e;if(e.type!=="call_expression")return null;let t=ip(e);return t!=="memo"&&t!=="forwardRef"?null:e.namedChildren.find(i=>i.type==="arguments")?.namedChildren.find(i=>i.type==="arrow_function"||i.type==="function_expression")??null}function rp(e){let t=e.parent;for(;t;){if(t.type==="function_declaration"||t.type==="function_expression"||t.type==="arrow_function"||t.type==="method_definition")return!0;t=t.parent}return!1}function Kr(e){return Mt(e.childForFieldName("name")??e.namedChild(0))}function ip(e){let t=e.childForFieldName("function")??e.namedChild(0);return t?t.text.split(".").pop()??t.text:null}function Xr(e){return e.type.startsWith("jsx_")?!0:e.namedChildren.some(Xr)}function op(e){let t={tokens:new Set,componentNames:new Set,nativeTags:new Set,propNames:new Set,eventNames:new Set},n=r=>{r.type==="jsx_opening_element"||r.type==="jsx_self_closing_element"?sp(r,t):r.type==="jsx_element"&&r.text.trimStart().startsWith("<>")?t.tokens.add("jsx:fragment"):r.type==="jsx_expression"?ap(r,t):r.type==="jsx_fragment"&&t.tokens.add("jsx:fragment");for(let i of r.children)n(i)};return n(e),t}function sp(e,t){let n=cp(e),r=!1;if(n){let i=ts(n),o=i==="Fragment"||i==="React.Fragment";r=gp(i)&&!o,o?t.tokens.add("jsx:fragment"):r?(t.componentNames.add(i),t.tokens.add(`component:${i}`)):(t.nativeTags.add(i),t.tokens.add(`native:${i}`))}for(let i of e.namedChildren)if(i.type==="jsx_attribute"){let o=lp(i);if(!o)continue;let s=ts(o);if(s.startsWith("on")&&s.length>2){let a=s.slice(2).replace(/^[A-Z]/,c=>c.toLowerCase());t.eventNames.add(a),t.tokens.add(`event:${a}`)}else Hd.has(s)||(t.propNames.add(s),t.tokens.add(`${r?"prop":"native-prop"}:${s}`))}else i.type==="jsx_spread_attribute"&&t.tokens.add(rs(i))}function ap(e,t){let n=e.text;/^\{\s*\.\.\./.test(n)&&t.tokens.add(rs(e)),is(e)&&t.tokens.add("jsx:conditional"),(n.includes(".map(")||n.includes(".flatMap("))&&t.tokens.add("jsx:list");for(let r of yp(n))fn(r)||t.tokens.add(`binding:${r}`)}function rs(e){let t=/^\{\s*\.\.\.\s*([^}]+)\s*\}$/.exec(e.text)?.[1],n=e.namedChildren.find(o=>o.type!=="comment"),r=t??n?.text??"",i=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.exec(r.trim())?.[0];return i?`prop:spread:${i}`:"prop:spread"}function is(e){return e.type==="ternary_expression"||e.type==="conditional_expression"?!0:e.namedChildren.some(is)}function cp(e){for(let t of e.namedChildren)if(t.type==="identifier"||t.type==="jsx_identifier"||t.type==="property_identifier"||t.type==="member_expression"||t.type==="jsx_member_expression")return t.text;return/^<\s*([A-Za-z][\w$.]*)/.exec(e.text)?.[1]??null}function lp(e){for(let t of e.namedChildren)if(t.type==="property_identifier"||t.type==="identifier"||t.type==="jsx_identifier")return t.text;return/^([A-Za-z_$][\w$:-]*)/.exec(e.text)?.[1]??null}function up(e,t){let n={tokens:new Set,hookNames:new Set,requestNames:new Set,stateNames:new Set,effectNames:new Set,handlerNames:new Set},r=i=>{if(i.type==="call_expression"){let o=mt(i,t);o&&dp(o.calleeLeaf,n)}else if(i.type==="variable_declarator")fp(i,n);else if(i.type==="function_declaration"){let o=Kr(i);o&&os(o,n)}for(let o of i.namedChildren)r(o)};return r(e),n}function dp(e,t){/^use[A-Z0-9_]/.test(e)&&(t.hookNames.add(e),!Qo.has(e)&&!jd.has(e)&&t.tokens.add(`hook:${e}`)),Qo.has(e)&&t.tokens.add(`react-hook:${e}`),$d.has(e)&&(t.effectNames.add(e),t.tokens.add(`effect:${e}`)),Bd.has(e)&&t.tokens.add(`state-hook:${e}`),pp(e)&&(t.requestNames.add(e),t.tokens.add(`request:${e}`))}function pp(e){if(Vd.has(e))return!0;let t=/^use([A-Z0-9_].*)$/.exec(e)?.[1];return t?/(Query|Mutation|Fetch|Resource)$/.test(t):!1}function fp(e,t){let n=e.childForFieldName("name")??e.namedChild(0),r=e.childForFieldName("value")??e.namedChild(1);if(n?.type==="array_pattern"&&r?.text.includes("useState")){let o=n.namedChildren.find(a=>Mt(a)),s=Mt(o);s&&(t.stateNames.add(s),t.tokens.add(`state:${s}`))}let i=Mt(n);i&&os(i,t)}function os(e,t){let n=mp(e);!n||!Ud.has(n)||(t.handlerNames.add(e),t.tokens.add(`handler:${e}`),t.tokens.add(`handler-verb:${n}`))}function mp(e){let t=e.startsWith("handle")&&e.length>6?e.slice(6).replace(/^[A-Z]/,n=>n.toLowerCase()):e;return/^[a-z]+/.exec(t)?.[0]??null}function gp(e){return/^[A-Z]/.test(e)||e.includes(".")}function ts(e){return e.replace(/^this\./,"").replace(/\$/g,".")}function Mt(e){return e&&(e.type==="identifier"||e.type==="property_identifier"||e.type==="shorthand_property_identifier"||/^[A-Za-z_$][\w$]*$/.test(e.text))?e.text:null}function yp(e){let t=[];for(let n of e.matchAll(/\b[A-Za-z_$][\w$]*\b/g)){let r=n[0];t.includes(r)||t.push(r)}return t}function Pe(e){return[...e].sort()}function Jx(e){return{capability:(t,n)=>hp(t,n),reactProfiles:(t={})=>ns(e,t),reactProfilesForFile:t=>Gr(e,t),vueProfiles:(t={})=>Xo(e,t),vueProfileForFile:t=>qr(e,t),vueTemplateFacts:t=>gn(e,t),vueScriptFacts:t=>In(ft(e,t))}}function hp(e,t){let n=e.startsWith("react-")?"react":"vue";if(t===void 0)return{slot:e,available:!0,framework:n};let r=t.replace(/\\/g,"/").toLowerCase();return n==="react"&&!r.endsWith(".tsx")&&!r.endsWith(".jsx")?{slot:e,available:!1,framework:n,reason:"React behavior profiles are only available for .tsx and .jsx files"}:n==="vue"&&!r.endsWith(".vue")?{slot:e,available:!1,framework:n,reason:"Vue behavior facts are only available for .vue files"}:{slot:e,available:!0,framework:n}}function Sp(e,t,n={}){let r=A(e,t);if(!r)return[];let i=[];if(n.includeCrossLanguageDispatchNames)for(let o of r.crossLanguageDispatchNames)i.push({name:o,kind:"cross-language-dispatch",occurrences:1});if(n.includeRustAttributeNames&&r.language==="rust")for(let o of r.rustAttrReferencedNames)i.push({name:o,kind:"rust-attribute",occurrences:1});return i}import{basename as as}from"path";function re(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qr(e){return e.replace(/'''[\s\S]*?'''/g,Me).replace(/"""[\s\S]*?"""/g,Me).replace(/#.*$/gm,Me).replace(/\/\/.*$/gm,Me).replace(/\/\*[\s\S]*?\*\//g,Me).replace(/`(?:\\[\s\S]|[^`])*`/g,Me).replace(/'(?:\\.|[^'\\\r\n])*'/g,Me).replace(/"(?:\\.|[^"\\\r\n])*"/g,Me)}function pv(e){return ss(e,{maskStrings:!1})}function fv(e){return ss(e,{maskStrings:!0})}function ss(e,t){let n="",r=0,i=e.length;for(;r<i;){if(e[r]==="/"&&e[r+1]==="/"){let s=e.indexOf(`
|
|
103
|
+
`,r),a=s===-1?i:s;n+=Jr(e,r,a),r=a;continue}if(e[r]==="/"&&e[r+1]==="*"){let s=e.indexOf("*/",r+2),a=s===-1?i:s+2;n+=Jr(e,r,a),r=a;continue}let o=e[r];if(o==="`"||o==="'"||o==='"'){let s=o,a=r+1;for(;a<i;){if(e[a]==="\\"){a+=2;continue}if(e[a]===s){a+=1;break}if(s!=="`"&&e[a]===`
|
|
104
|
+
`)break;a+=1}n+=t.maskStrings?Jr(e,r,a):e.slice(r,a),r=a;continue}n+=o,r+=1}return n}function Jr(e,t,n){let r="";for(let i=t;i<n;i+=1)r+=e[i]===`
|
|
105
|
+
`?`
|
|
106
|
+
`:" ";return r}function Me(e){return e.replace(/[^\r\n]/g," ")}var mv=ze("stripped-lines",{clearGroups:["whole-project","source-file"]});lt({name:"stripped-source-singleton",groups:["whole-project","source-file"],clearAll:()=>{Fn=null,$t=""},clearFile:()=>{Fn=null,$t=""}});var Fn=null,$t="";function bp(e){return Fn===e||(Fn=e,$t=Qr(e)),$t}function $e(e,t,n){let r=bp(e);return`${r.slice(0,t)}${" ".repeat(n-t)}${r.slice(n)}`}function W(e,t){return new RegExp(`\\b${re(t)}\\b`,"m").test(e)}function xt(e,t){let n=new Set,r=new RegExp(`\\b${re(t)}\\s*\\.\\s*([A-Za-z_$][\\w$]*)`,"g");for(let i of e.matchAll(r)){let o=i[1];o&&n.add(o)}return[...n]}function Zr(e){let t=0;for(let n of e)n==="("&&(t+=1),n===")"&&(t-=1);return t}var xp=new Set(["identifier","type_identifier","property_identifier","shorthand_property_identifier","field_identifier"]);function q(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let o=e[i];(o==="{"||o==="["||o==="(")&&n++,(o==="}"||o==="]"||o===")")&&n--,o===","&&n===0&&(t.push(e.slice(r,i)),r=i+1)}return t.push(e.slice(r)),t}function Z(e,t){for(let n of e.namedChildren)if(n.type===t)return n;return null}function L(e,t){let n=new Set,r=(i,o)=>{let s=o||t.has(i.type);!s&&xp.has(i.type)&&n.add(i.text);for(let a of i.children)r(a,s)};return r(e.rootNode,!1),n}function ue(e,t,n,r,i,o,s){return{importedName:i,localName:o,sourcePath:s??w(e,r,Vr(t)),kind:"named",used:W(n,o),usedMembers:[]}}function T(e,t,n,r,i="named",o={}){return{importedName:e,localName:t,sourcePath:n,kind:i,used:r.has(t),usedMembers:[],isTypeOnly:o.isTypeOnly}}function we(e,t,n,r,i="named",o=[],s={}){return{importedName:e,localName:t,sourcePath:n,kind:i,used:r,usedMembers:o,isTypeOnly:s.isTypeOnly}}function Ze(e,t){return{importedName:e,localName:null,sourcePath:t,kind:"side-effect",used:!0,usedMembers:[]}}function Ye(e,t,n={}){return{importedName:e,localName:n.localName??null,sourcePath:t,kind:"namespace",used:n.used??!0,usedMembers:n.usedMembers??[],isTypeOnly:n.isTypeOnly}}function ie(e,t,n){let r=[];for(let i of e.matchAll(t)){let o=i[0];if(!o||typeof i.index!="number")continue;let s=$e(e,i.index,i.index+o.length);for(let a of n(i,s))r.push(a)}return r}function oe(e,t,n,r,i){let o=Lt(e,t,i)?.tree??null;if(o){let s=n(o);if(s)return s}return r()}function Tn(e,t,n,r,i){let o=Lt(e,t,i)?.tree??null,s=H(t),a=s?n[s]:void 0;return o&&a?a(o):r()}function cs(e,t,n){return oe(e,t,r=>Np(e,t,r),()=>vp(e,t,n),n)}function vp(e,t,n){return ie(n,/^[ \t]*#include\s+[<"]([^">]+)[">]\s*$/gm,(r,i)=>{let o=r[1]?.trim();if(!o)return[];let s=as(o).replace(/\.[^.]+$/,"");return[we(o,s,Nn(e,t,o),W(i,s))]})}function Np(e,t,n){let r=L(n,new Set(["preproc_include"])),i=[];for(let o of n.rootNode.descendantsOfType("preproc_include")){let s=null;for(let c of o.namedChildren){if(c.type==="system_lib_string"){s=c.text.replace(/^<|>$/g,"");break}if(c.type==="string_literal"){s=c.namedChildren.find(u=>u.type==="string_content")?.text??c.text.replace(/^"|"$/g,"");break}}if(!s)continue;let a=as(s).replace(/\.[^.]+$/,"");i.push(T(s,a,Nn(e,t,s),r))}return i}var Ep=new Set([":require",":require-macros",":use"]),ti=String.raw`A-Za-z0-9_$*+!?.<>=-`;function us(e,t,n){let r=Dp(n);if(!r)return[];let i=kp(n,r.start,r.end),o=[];for(let s of r.children.slice(2)){if(s.type!=="list"||s.children.length===0)continue;let a=se(s.children[0]);if(a){if(Ep.has(a)){for(let c of Ip(s.children.slice(1)))o.push(..._p(e,c,i));continue}if(a===":import")for(let c of Fp(s.children.slice(1)))o.push(c)}}return o}function Cp(e){return e.type==="list"&&se(e.children[0])==="ns"}function _p(e,t,n){let r=Ur(e,t.namespace),i=t.alias??t.namespace,o=Pp(n,i),s=[{importedName:t.namespace,localName:i,sourcePath:r,kind:"namespace",used:t.refers.length>0||t.referAll||o.length>0||wp(n,t.namespace),usedMembers:o}];t.referAll&&s.push({importedName:"*",localName:null,sourcePath:r,kind:"side-effect",used:!0,usedMembers:[]});for(let a of t.refers)s.push({importedName:a,localName:a,sourcePath:r,kind:"named",used:Lp(n,a),usedMembers:[]});return s}function Ip(e){return e.flatMap(t=>Pn(t,null))}function Pn(e,t){if(e.type==="atom")return e.text.startsWith(":")?[]:[{namespace:ei(t,e.text),alias:null,refers:[],referAll:!1}];if(e.type==="vector")return e.children.length>0&&se(e.children[0])===null?e.children.flatMap(n=>Pn(n,t)):Rp(e,t);if(e.type==="list"&&e.children.length>0){let n=se(e.children[0]);return n?!n||n.startsWith(":")?[]:e.children.slice(1).flatMap(r=>Pn(r,ei(t,n))):e.children.flatMap(r=>Pn(r,t))}return[]}function Rp(e,t){let n=se(e.children[0]);if(!n||n.startsWith(":"))return[];let r={namespace:ei(t,n),alias:null,refers:[],referAll:!1};for(let i=1;i<e.children.length;i+=1){let o=se(e.children[i]);if(!o?.startsWith(":"))continue;let s=e.children[i+1];if((o===":as"||o===":as-alias")&&s){r.alias=se(s),i+=1;continue}o===":refer"&&s&&(se(s)===":all"?r.referAll=!0:(s.type==="vector"||s.type==="list")&&r.refers.push(...s.children.map(se).filter(Tp)),i+=1)}return[r]}function Fp(e){let t=[];for(let n of e){if(n.type==="atom"){let i=n.text.split(".").pop()??n.text;t.push(we(i,i,null,!0));continue}if(n.type!=="vector")continue;let r=se(n.children[0]);if(r)for(let i of n.children.slice(1)){let o=se(i);o&&t.push(we(`${r}.${o}`,o,null,!0))}}return t}function ei(e,t){return e?`${e}.${t}`:t}function se(e){return e?.type==="atom"?e.text:null}function Tp(e){return!!(e&&!e.startsWith(":"))}function Pp(e,t){let n=new Set,r=new RegExp(`${ni()}${re(t)}\\s*/\\s*([${ti}]+)`,"g");for(let i of e.matchAll(r)){let o=i[1];o&&n.add(o)}return[...n]}function wp(e,t){return new RegExp(`${ni()}${re(t)}\\s*/`,"m").test(e)}function Lp(e,t){return new RegExp(`${ni()}${re(t)}(?![${ti}])`,"m").test(e)}function ni(){return`(?<![${ti}])`}function kp(e,t,n){let r="",i=0;for(;i<e.length;){if(i>=t&&i<n){r+=e[i]===`
|
|
107
|
+
`?`
|
|
108
|
+
`:" ",i+=1;continue}let o=e[i];if(o===";"){let s=pn(e,i);r+=ls(e.slice(i,s)),i=s;continue}if(o==='"'){let s=At(e,i,0).index;r+=ls(e.slice(i,s)),i=s;continue}r+=o,i+=1}return r}function Dp(e){let t=0;for(;t<e.length&&(t=ri(e,t),!(t>=e.length));){let n=wn(e,t);if(!n){t+=1;continue}if(Cp(n.form))return n.form;t=n.index}return null}function wn(e,t){let n=ri(e,t);if(e.startsWith("#?@",n)||e.startsWith("#?",n))return Ap(e,n);if(e.startsWith("#_",n)){let i=wn(e,n+2);return i?{form:{type:"atom",text:"",start:n,end:i.index},index:i.index}:null}for(;Fr(e[n]);)n+=1;let r=e[n];return r?r==="("?Yr(e,n,"list",")"):r==="["?Yr(e,n,"vector","]"):r==="{"?Yr(e,n,"map","}"):r==='"'?{form:{type:"atom",text:"",start:n,end:At(e,n,0).index},index:At(e,n,0).index}:Mp(e,n):null}function Ap(e,t){let n=e.startsWith("#?@",t)?3:2,r=wn(e,t+n);return r?{form:{type:"list",children:r.form.type==="list"||r.form.type==="vector"||r.form.type==="map"?Op(r.form.children):[],start:t,end:r.index},index:r.index}:null}function Op(e){let t=[];for(let n=0;n<e.length;n+=2){let r=se(e[n]),i=e[n+1];r?.startsWith(":")&&i&&t.push(i)}return t}function Yr(e,t,n,r){let i=[],o=t+1;for(;o<e.length;){if(o=ri(e,o),e[o]===r)return{form:{type:n,children:i,start:t,end:o+1},index:o+1};let s=wn(e,o);if(!s){o+=1;continue}s.form.type==="atom"&&s.form.text===""||i.push(s.form),o=s.index}return{form:{type:n,children:i,start:t,end:e.length},index:e.length}}function Mp(e,t){let n=t;for(;n<e.length&&!Tr(e[n]);)n+=1;return{form:{type:"atom",text:e.slice(t,n),start:t,end:n},index:n}}function ri(e,t){let n=t;for(;n<e.length;){let r=e[n];if(/\s|,/.test(r)){n+=1;continue}if(r===";"){n=pn(e,n);continue}break}return n}function ls(e){return e.replace(/[^\r\n]/g," ")}function ds(e,t,n){let r=[];for(let i of n.matchAll(/^[ \t]*import\s+['"]([^'"]+)['"](?:\s+as\s+([A-Za-z_]\w*))?[\s\S]*?;$/gm)){let o=i[1]?.trim(),s=i[2]?.trim()??null,a=i[0];if(!o||!a||typeof i.index!="number")continue;let c=$e(n,i.index,i.index+a.length);r.push({importedName:o,localName:s,sourcePath:En(e,t,o),kind:s?"namespace":"side-effect",used:s?W(c,s):!0,usedMembers:s?xt(c,s):[]})}return r}function ps(e,t,n){let r=[];for(let i of n.matchAll(/^[ \t]*export\s+['"]([^'"]+)['"][\s\S]*?;$/gm)){let o=i[1]?.trim();o&&r.push({specifier:o,sourcePath:En(e,t,o)})}return r}function fs(e,t,n){return Tn(e,t,{csharp:r=>Bp(e,t,r),vb:r=>$p(e,t,r)},()=>{let r=Vo(t)?/^[ \t]*Imports\s+(.+?)\s*$/gm:/^[ \t]*using\s+(.+?)\s*;$/gm;return ie(n,r,(i,o)=>{let s=i[1]?.trim();if(!s)return[];let[a,c]=s.split(/\s*=\s*/),l=!!c,u=(l?c:a)?.trim()??s,d=u.split(".").pop()??u,p=l?a?.trim()??d:d;return[ue(e,t,o,u,d,p,w(e,u,Oe))]})},n)}function $p(e,t,n){let r=L(n,new Set(["imports_statement"])),i=[];for(let o of n.rootNode.descendantsOfType("imports_statement")){let s=o.namedChildren.filter(p=>p.type==="namespace_name");if(s.length===0)continue;let a=s[s.length-1],c=s.length>1?s[0]:null,l=a.text,u=l.split(".").pop()??l,d=c?.text??u;i.push(T(u,d,w(e,l,Oe),r,c?"namespace":"named"))}return i}function Bp(e,t,n){let r=L(n,new Set(["using_directive"])),i=[];for(let o of n.rootNode.descendantsOfType("using_directive")){let s=o.namedChildren;if(s.length===0)continue;let a=null,c;s.length>=2&&s[0].type==="identifier"&&(s[1].type==="qualified_name"||s[1].type==="identifier")?(a=s[0],c=s[1]):c=s[s.length-1];let l=c.text,u=l.split(".").pop()??l,d=a?.text??u;i.push(T(u,d,w(e,l,Oe),r,a?"namespace":"named"))}return i}var jp=v("vue-non-script-identifiers",{clearGroups:["whole-project","source-file"]});function ms(e,t){return jp.get(e,t,()=>{let n=new Set,r=x(e,t);if(!r)return n;let o=r.replace(/<script\b[^>]*>[\s\S]*?<\/script>/g,s=>s.replace(/[^\r\n]/g," ")).replace(/<!--[\s\S]*?-->/g,s=>s.replace(/[^\r\n]/g," ")).replace(/\/\*[\s\S]*?\*\//g,s=>s.replace(/[^\r\n]/g," "));for(let s of o.matchAll(/[A-Za-z_$][\w$]*/g))n.add(s[0]);return n})}function ii(e,t,n){return oe(e,t,r=>Up(e,t,r),()=>Vp(e,t,n),n)}function Vp(e,t,n){return Yp(n).flatMap(r=>ef(e,t,r.clause,r.specifier,r.start,r.end,n))}function Up(e,t,n){let r=Hp(e,t,n),i=[];for(let o of n.rootNode.descendantsOfType("import_statement"))i.push(...zp(e,t,n,o,r));return i}function Hp(e,t,n){let r=L(n,new Set(["import_statement"]));if(Se(t))for(let i of ms(e,t))r.add(i);return r}function zp(e,t,n,r,i){let o=Xp(r);if(!o)return[];let s=be(e,t,o),a=Z(r,"import_clause");return a?Wp(n,a,s,i,Jp(r.text)):[Ze("*",s)]}function Wp(e,t,n,r,i){let o=[];for(let s of t.namedChildren)if(s.type==="identifier")o.push(qp(s.text,n,r,i));else if(s.type==="namespace_import"){let a=Kp(e,s,n,r,i);a&&o.push(a)}else s.type==="named_imports"&&o.push(...Gp(s,n,r,i));return o}function qp(e,t,n,r){return T("default",e,t,n,"default",{isTypeOnly:r})}function Kp(e,t,n,r,i){let s=Z(t,"identifier")?.text??"";if(!s)return null;let a=Zp(e,s);return Ye("*",n,{localName:s,usedMembers:a,isTypeOnly:i,used:a.length>0||r.has(s)})}function Gp(e,t,n,r){let i=[];for(let o of e.namedChildren){if(o.type!=="import_specifier")continue;let s=o.namedChild(0),a=o.namedChild(1);if(!s)continue;let c=s.text,l=a?.text??c;i.push(T(c,l,t,n,"named",{isTypeOnly:r||Qp(o.text)}))}return i}function Xp(e){let t=Z(e,"string");if(!t)return null;let n=Z(t,"string_fragment");return n?n.text:null}function Jp(e){return/^\s*import\s+type\b/.test(e)}function Qp(e){return/^\s*type\b/.test(e.trim())}function Zp(e,t){let n=new Set;for(let r of e.rootNode.descendantsOfType("member_expression")){let i=r.namedChild(0),o=r.namedChild(1);!i||!o||i.type!=="identifier"||i.text!==t||(o.type==="property_identifier"||o.type==="identifier")&&n.add(o.text)}return[...n]}function Yp(e){let t=[],n=/^[ \t]*import\s+([\s\S]*?)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let i of e.matchAll(n)){let o=i[0],s=i[1],a=i[2];!o||!a||typeof i.index!="number"||t.push({clause:s,specifier:a,start:i.index,end:i.index+o.length})}let r=/^[ \t]*import\s+['"]([^'"]+)['"]\s*;?/gm;for(let i of e.matchAll(r)){let o=i[0],s=i[1];!o||!s||typeof i.index!="number"||t.push({clause:null,specifier:s,start:i.index,end:i.index+o.length})}return t.sort((i,o)=>i.start-o.start)}function ef(e,t,n,r,i,o,s){let a=be(e,t,r),c=$e(s,i,o);return n?tf(n).map(u=>({...u,sourcePath:a})).map(u=>{if(u.kind==="namespace"){let d=xt(c,u.localName);return Ye(u.importedName,u.sourcePath,{localName:u.localName,usedMembers:d,used:d.length>0||W(c,u.localName),isTypeOnly:u.isTypeOnly})}return u.kind==="side-effect"?Ze(u.importedName,u.sourcePath):we(u.importedName,u.localName??"",u.sourcePath,u.localName?W(c,u.localName):!1,u.kind,[],{isTypeOnly:u.isTypeOnly})}):[Ze("*",a)]}function tf(e){let t=e.trim(),n=/^type\b/.test(t),r=t.replace(/^type\s+/,""),[i,o]=nf(r),s=[];return i&&s.push(...gs(i,n)),o&&s.push(...gs(o,n)),s}function gs(e,t){let n=e.trim();if(!n)return[];if(n.startsWith("{")){let r=n.slice(1,-1).trim();return r?q(r).map(i=>{let o=i.trim(),s=t||/^type\b/.test(o),a=o.replace(/^type\s+/,""),[c,l]=a.split(/\s+as\s+/);return{importedName:c.trim(),localName:(l??c).trim(),kind:"named",isTypeOnly:s}}):[]}return n.startsWith("* as ")?[{importedName:"*",localName:n.slice(5).trim(),kind:"namespace",isTypeOnly:t}]:[{importedName:"default",localName:n,kind:"default",isTypeOnly:t}]}function nf(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];if(r==="{"&&t++,r==="}"&&t--,r===","&&t===0)return[e.slice(0,n).trim(),e.slice(n+1).trim()]}return[e.trim(),null]}function oi(e,t,n){let r=R(e,t);return r?lf(e,t,r):rf(e,t,n)}function rf(e,t,n){return[...of(e,t,n),...sf(e,t,n),...af(e,t,n)]}function of(e,t,n){let r=[],i=/^[ \t]*export\s+(?:type\s+)?\{([\s\S]*?)\}\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of n.matchAll(i)){if(typeof o.index!="number")continue;let s=o[1]??"",a=o[2]??"",c=q(s).map(d=>cf(d.trim())).filter(d=>!!d),l=vt(n,o.index),u=vt(n,o.index+o[0].length-1);r.push({kind:"named",sourcePath:be(e,t,a),names:c,startLine:l,endLine:u})}return r}function sf(e,t,n){let r=[],i=/^[ \t]*export\s+\*\s+as\s+(\w+)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of n.matchAll(i)){if(typeof o.index!="number")continue;let s=o[2]??"",a=vt(n,o.index),c=vt(n,o.index+o[0].length-1);r.push({kind:"star-as",sourcePath:be(e,t,s),names:o[1]?[o[1]]:[],startLine:a,endLine:c})}return r}function af(e,t,n){let r=[],i=/^[ \t]*export\s+\*\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of n.matchAll(i)){if(typeof o.index!="number")continue;let s=o[1]??"",a=vt(n,o.index),c=vt(n,o.index+o[0].length-1);r.push({kind:"star",sourcePath:be(e,t,s),names:[],startLine:a,endLine:c})}return r}function cf(e){if(!e)return null;let t=e.replace(/^type\s+/,"").trim();if(!t)return null;let n=t.match(/^(\w+)\s+as\s+(\w+)$/);if(n)return n[2]??null;let r=t.match(/^(\w+)$/);return r?r[1]??null:null}function vt(e,t){let n=0;for(let r=0;r<t&&r<e.length;r++)e.charCodeAt(r)===10&&n++;return n}function lf(e,t,n){let r=[];for(let i of n.rootNode.descendantsOfType("export_statement")){let o=uf(e,t,i);if(o===void 0)continue;let s=i.startPosition.row,a=i.endPosition.row,c=df(i,o,s,a);r.push(c)}return r}function uf(e,t,n){let r=Z(n,"string");if(!r)return;let i=Z(r,"string_fragment");if(i)return be(e,t,i.text)}function df(e,t,n,r){let i=Z(e,"export_clause");if(i){let s=[];for(let a of i.namedChildren){if(a.type!=="export_specifier")continue;let c=a.namedChild(0),l=a.namedChild(1);c&&s.push((l??c).text)}return{kind:"named",sourcePath:t,names:s,startLine:n,endLine:r}}let o=Z(e,"namespace_export");if(o){let s=o.namedChildren.find(a=>a.type==="identifier"||a.type==="type_identifier")?.text;return{kind:"star-as",sourcePath:t,names:s?[s]:[],startLine:n,endLine:r}}return{kind:"star",sourcePath:t,names:[],startLine:n,endLine:r}}function ys(e,t,n){return Tn(e,t,{java:r=>pf(e,t,r),kotlin:r=>ff(e,t,r),scala:r=>mf(e,t,r)},()=>ie(n,/^[ \t]*import\s+(?:static\s+)?(.+?)\s*;?$/gm,(r,i)=>{let o=r[1]?.trim();return o?gf(e,t,o,i):[]}),n)}function pf(e,t,n){let r=L(n,new Set(["import_declaration"])),i=[];for(let o of n.rootNode.descendantsOfType("import_declaration")){let s=o.children.some(d=>d.type==="asterisk"),c=o.namedChildren.find(d=>d.type==="scoped_identifier")??o.namedChildren.find(d=>d.type==="identifier");if(!c)continue;let l=c.text;if(s){i.push(Ye("*",w(e,l,Q)));continue}let u=l.split(".").pop()??l;i.push(T(u,u,w(e,l,Q),r))}return i}function ff(e,t,n){let r=L(n,new Set(["import_header","import_list"])),i=[];for(let o of n.rootNode.descendantsOfType("import_header")){let s=o.namedChildren.find(f=>f.type==="identifier");if(!s)continue;let a=o.namedChildren.some(f=>f.type==="wildcard_import"),c=o.namedChildren.find(f=>f.type==="import_alias");if(a){i.push(Ye("*",w(e,s.text,Q)));continue}let l=s.text,u=l.split(".").pop()??l,p=c?.namedChild(0)?.text??u;i.push(T(u,p,w(e,l,Q),r))}return i}function mf(e,t,n){let r=L(n,new Set(["import_declaration"])),i=[];for(let o of n.rootNode.descendantsOfType("import_declaration")){let s=o.namedChildren.find(d=>d.type==="namespace_selectors"||d.type==="namespace_wildcard"),a=o.namedChildren.filter(d=>d!==s&&(d.type==="identifier"||d.type==="stable_identifier")),c=a.map(d=>d.text).join(".");if(!c)continue;if(s?.type==="namespace_wildcard"){i.push(Ye("*",w(e,c,Q)));continue}if(s?.type==="namespace_selectors"){for(let d of s.namedChildren)if(d.type==="arrow_renamed_identifier"){let[p,f]=d.namedChildren;if(!p)continue;let m=p.text,g=f?.text??m;if(m==="_")continue;i.push(T(m,g,w(e,`${c}.${m}`,Q),r))}else if(d.type==="identifier"){let p=d.text;i.push(T(p,p,w(e,`${c}.${p}`,Q),r))}continue}let l=a[a.length-1]?.text??c,u=a.slice(0,-1).map(d=>d.text).join(".")||c;i.push(T(l,l,w(e,u&&a.length>1?`${u}.${l}`:c,Q),r))}return i}function gf(e,t,n,r){if(n.includes("{")&&n.includes("}")){let i=n.slice(0,n.indexOf("{")).replace(/\.$/,"").trim(),o=n.slice(n.indexOf("{")+1,n.lastIndexOf("}")).trim();return q(o).flatMap(s=>{let a=s.trim();if(!a)return[];let[c,l]=a.includes("=>")?a.split(/\s*=>\s*/):a.split(/\s+as\s+/),u=c?.trim();if(!u||u==="_")return[];let d=(l??u.split(".").pop()??u).trim(),p=u==="_"?i:`${i}.${u}`.replace(/\.\./g,".");return[ue(e,t,r,p,u,d)]})}return[ue(e,t,r,n,n.split(".").pop()??n,n.split(".").pop()??n)]}function Ss(e,t,n){return oe(e,t,r=>yf(e,t,r),()=>ie(n,/^[ \t]*use\s+(.+?)\s*;$/gm,(r,i)=>{let o=r[1]?.trim();return o?q(o).flatMap(s=>{let a=s.trim();if(!a)return[];let[c,l]=a.split(/\s+as\s+/i),u=c?.trim()??a,d=u.split("\\").pop()??u,p=(l??d).trim();return[ue(e,t,i,u,d,p,w(e,u.replace(/\\/g,"."),Qe))]}):[]}),n)}function yf(e,t,n){let r=L(n,new Set(["namespace_use_declaration"])),i=[],o=(s,a,c)=>{i.push(T(a,c,w(e,s.replace(/\\/g,"."),Qe),r))};for(let s of n.rootNode.descendantsOfType("namespace_use_declaration")){let a=s.namedChildren.find(c=>c.type==="namespace_use_group");if(a){let c=s.namedChildren.find(l=>l.type==="namespace_name")?.text??"";for(let l of a.namedChildren){if(l.type!=="namespace_use_clause")continue;let{importedName:u,localName:d,qualified:p}=hs(l,c);u&&o(p,u,d)}continue}for(let c of s.namedChildren){if(c.type!=="namespace_use_clause")continue;let{importedName:l,localName:u,qualified:d}=hs(c,"");l&&o(d,l,u)}}return i}function hs(e,t){let n=e.namedChildren.find(l=>l.type==="qualified_name"),r=e.namedChildren.filter(l=>l.type==="name"),i="";n?i=n.text:r.length>=1&&(i=r[0].text);let o=n&&r.length>0?r[r.length-1]:null,s=i.split("\\").pop()??i,a=o?.text??s,c=t?`${t}\\${i}`:i;return{importedName:s,localName:a,qualified:c}}function xs(e,t,n){return oe(e,t,r=>hf(e,t,r),()=>bf(n).flatMap(r=>vf(e,t,r,n)),n)}function hf(e,t,n){let r=L(n,new Set(["import_statement","import_from_statement"])),i=[];for(let o of n.rootNode.descendantsOfType("import_statement"))for(let s of o.namedChildren){let a=bs(s);if(!a)continue;let c=St(e,t,a.qualifiedName);i.push({importedName:a.qualifiedName,localName:a.localName,sourcePath:c,kind:"namespace",used:r.has(a.localName),usedMembers:[]})}for(let o of n.rootNode.descendantsOfType("import_from_statement")){let s=o.namedChild(0);if(!s)continue;let a=Sf(s);if(a===null)continue;let c=St(e,t,a);for(let l=1;l<o.namedChildCount;l+=1){let u=o.namedChild(l);if(u.type==="wildcard_import"){i.push({importedName:"*",localName:null,sourcePath:c,kind:"side-effect",used:!0,usedMembers:[]});continue}let d=bs(u);d&&i.push({importedName:d.qualifiedName,localName:d.localName,sourcePath:c,kind:"named",used:r.has(d.localName),usedMembers:[]})}}return i}function bs(e){if(e.type==="aliased_import"){let t=e.namedChild(0),n=e.namedChild(1);return!t||!n?null:{qualifiedName:t.text,localName:n.text}}if(e.type==="dotted_name"){let t=e.text;return{qualifiedName:t,localName:t.split(".")[0]??t}}return e.type==="identifier"?{qualifiedName:e.text,localName:e.text}:null}function Sf(e){if(e.type==="dotted_name")return e.text;if(e.type==="relative_import"){let t=Z(e,"import_prefix")?.text??"",n=Z(e,"dotted_name")?.text??"";return`${t}${n}`}return null}function bf(e){let t=e.split(`
|
|
109
|
+
`),n=[],r=0;for(let i=0;i<t.length;i++){let o=t[i],s=o.trimStart(),a=r;if(r+=o.length+1,!s.startsWith("import ")&&!s.startsWith("from "))continue;let c=o,l=a+o.length,u=Zr(o);for(;i+1<t.length&&(u>0||c.trimEnd().endsWith("\\"));){i++;let p=t[i];c+=`
|
|
110
|
+
${p}`,l+=1+p.length,u+=Zr(p),r+=p.length+1}let d=xf(c);d&&n.push({...d,start:a,end:l})}return n}function xf(e){let t=e.replace(/\\\s*\n/g," ").trim();if(t.startsWith("import "))return{kind:"import",module:null,clause:t.slice(7).trim()};let n=t.match(/^from\s+([.\w]+)\s+import\s+([\s\S]+)$/);if(!n)return null;let r=n[2].trim();return r.startsWith("(")&&r.endsWith(")")&&(r=r.slice(1,-1).trim()),{kind:"from",module:n[1],clause:r}}function vf(e,t,n,r){let i=$e(r,n.start,n.end),o=n.clause.replace(/\n/g," ").trim();if(n.kind==="import")return q(o).flatMap(c=>{let l=c.trim().replace(/,$/,"");if(!l)return[];let[u,d]=l.split(/\s+as\s+/),p=u.trim(),f=(d??p.split(".")[0]??p).trim(),m=St(e,t,p),g=xt(i,f);return[{importedName:p,localName:f,sourcePath:m,kind:"namespace",used:W(i,f)||g.length>0,usedMembers:g}]});let s=n.module?St(e,t,n.module):null,a=[];for(let c of q(o)){let l=c.trim().replace(/,$/,"");if(!l)continue;if(l==="*"){a.push({importedName:"*",localName:null,sourcePath:s,kind:"side-effect",used:!0,usedMembers:[]});continue}let[u,d]=l.split(/\s+as\s+/),p=(d??u).trim();a.push({importedName:u.trim(),localName:p,sourcePath:s,kind:"named",used:W(i,p),usedMembers:[]})}return a}import{basename as Nf}from"path";function vs(e,t,n){return oe(e,t,r=>Cf(e,t,r),()=>Ef(e,t,n),n)}function Ef(e,t,n){return ie(n,/^[ \t]*(require_relative|require)\s+["']([^"']+)["']\s*$/gm,(r,i)=>{let o=r[1],s=r[2];if(!o||!s)return[];let a=o==="require_relative"?vn(e,t,s):null;if(a){let c=Ns(s);return[we(c,c,a,W(i,c))]}return[Ze(s,a)]})}function Cf(e,t,n){let r=L(n,new Set([])),i=[],o=new Set(["require","require_relative","load"]);for(let s of n.rootNode.descendantsOfType("call")){let a=s.namedChild(0);if(!a||a.type!=="identifier"||!o.has(a.text))continue;let l=s.namedChildren.find(f=>f.type==="argument_list")?.namedChild(0);if(!l||l.type!=="string")continue;let d=l.namedChildren.find(f=>f.type==="string_content")?.text;if(!d)continue;let p=a.text==="require_relative"?vn(e,t,d):null;if(p){let f=Ns(d);i.push(T(f,f,p,r))}else i.push(Ze(d,p))}return i}function Ns(e){return mn(Nf(e).replace(/\.[^.]+$/,""),/_/)}function Es(e,t,n){return oe(e,t,r=>_f(e,t,r),()=>ie(n,/^[ \t]*use\s+(.+?)\s*;$/gm,(r,i)=>{let o=r[1]?.trim();return o?If(e,t,o,i):[]}),n)}function _f(e,t,n){let r=L(n,new Set(["use_declaration"])),i=[];for(let o of n.rootNode.descendantsOfType("use_declaration")){let s=o.namedChild(0);if(s)for(let a of Bt(s,"")){if(!a.importedName||a.importedName==="*")continue;let c=Fe(e,t,a.qualifiedName)??Fe(e,t,a.qualifiedName.split("::").slice(0,-1).join("::"));i.push(T(a.importedName,a.localName,c,r))}}return i}function Bt(e,t){switch(e.type){case"identifier":case"super":case"crate":{let n=e.text;return[{qualifiedName:Ln(t,n),importedName:n,localName:n}]}case"self":{let n=t.split("::").filter(Boolean).pop()??"self";return[{qualifiedName:t||"self",importedName:n,localName:n}]}case"scoped_identifier":{let n=e.text,r=n.split("::").pop()??n;return[{qualifiedName:Ln(t,n),importedName:r,localName:r}]}case"scoped_use_list":{let n=e.namedChild(0),r=e.namedChild(1);if(!n||!r)return[];let i=Ln(t,n.text),o=[];for(let s of r.namedChildren)o.push(...Bt(s,i));return o}case"use_list":{let n=[];for(let r of e.namedChildren)n.push(...Bt(r,t));return n}case"use_as_clause":{let n=e.namedChild(0),r=e.namedChild(1);if(!n||!r)return[];let i=Bt(n,t),o=r.text;return i.map(s=>({...s,localName:o}))}case"use_wildcard":{let n=e.namedChild(0),r=n?n.text:"";return[{qualifiedName:Ln(t,`${r}::*`),importedName:"*",localName:"*"}]}default:return[]}}function Ln(e,t){return e?t?`${e}::${t}`:e:t}function If(e,t,n,r){let i=n.trim();if(i.includes("{")&&i.includes("}")){let u=i.slice(0,i.indexOf("{")).replace(/::$/,"").trim(),d=i.slice(i.indexOf("{")+1,i.lastIndexOf("}")).trim();return q(d).flatMap(p=>{let f=p.trim();if(!f)return[];if(f==="self"){let N=u.split("::").filter(Boolean).pop();return N?[ue(e,t,r,u,N,N)]:[]}let[m,g]=f.split(/\s+as\s+/),y=m?.trim();if(!y)return[];let S=(g??y.split("::").pop()??y).trim(),b=`${u}::${y}`.replace(/::::/g,"::");return[ue(e,t,r,b,y.split("::").pop()??y,S,Fe(e,t,u))]})}let[o,s]=i.split(/\s+as\s+/),a=o?.trim()??i,c=(s??a.split("::").pop()??a).trim(),l=Fe(e,t,a)??Fe(e,t,a.split("::").slice(0,-1).join("::"));return[ue(e,t,r,a,a.split("::").pop()??a,c,l)]}function Cs(e,t,n){let r=R(e,t);if(r)return Rf(e,t,r);let i=[];for(let o of n.matchAll(/^[ \t]*pub\s+use\s+(.+?)\s*;$/gm)){let s=o[1]?.trim();s&&i.push(...Tf(e,t,s))}return i}function Rf(e,t,n){let r=[];for(let i of n.rootNode.descendantsOfType("use_declaration")){if(!Ff(i))continue;let o=i.namedChildren.find(s=>s.type!=="visibility_modifier");if(o)for(let s of Bt(o,""))s.importedName&&r.push(si(e,t,s.qualifiedName))}return r}function Ff(e){for(let t of e.children)if(t.type==="visibility_modifier"&&t.text.startsWith("pub"))return!0;return!1}function Tf(e,t,n){let r=n.trim();if(r.includes("{")&&r.includes("}")){let i=r.slice(0,r.indexOf("{")).replace(/::$/,"").trim(),o=r.slice(r.indexOf("{")+1,r.lastIndexOf("}")).trim();return q(o).flatMap(s=>{let a=s.trim();if(!a||a==="self")return[];let[c]=a.split(/\s+as\s+/),l=`${i}::${c?.trim()??a}`.replace(/::::/g,"::");return[si(e,t,l)]})}return[si(e,t,r)]}function si(e,t,n){return{specifier:n,sourcePath:Fe(e,t,n)??Fe(e,t,n.split("::").slice(0,-1).join("::"))}}function Be({language:e,extensions:t,imports:n,parseImports:r}){return{language:e,extensions:t,capabilities:{imports:n},parseImports:r}}function _s(e,t){let n=t.toLowerCase();for(let r of e)for(let i of r.extensions)if(n.endsWith(i))return r;return null}var Pf={language:"javascript",extensions:Xe,capabilities:{imports:"ast-with-regex-fallback",reExports:"ast-with-regex-fallback"},parseImports:ii,parseReExports:oi},wf=Be({language:"python",extensions:yn,imports:"ast-with-regex-fallback",parseImports:xs}),Lf=Be({language:"jvm",extensions:Q,imports:"ast-dispatch-with-regex-fallback",parseImports:ys}),kf={language:"rust",extensions:hn,capabilities:{imports:"ast-with-regex-fallback",exports:"ast-with-regex-fallback"},parseImports:Es,parseExports:Cs},Df=Be({language:"ruby",extensions:Sn,imports:"ast-with-regex-fallback",parseImports:vs}),Af=Be({language:"c/cpp",extensions:bn,imports:"ast-with-regex-fallback",parseImports:cs}),Of=Be({language:"dotnet",extensions:Oe,imports:"ast-dispatch-with-regex-fallback",parseImports:fs}),Mf={language:"dart",extensions:xn,capabilities:{imports:"regex-only",exports:"regex-only"},parseImports:ds,parseExports:ps},$f=Be({language:"php",extensions:Qe,imports:"ast-with-regex-fallback",parseImports:Ss}),Bf=Be({language:"clojure",extensions:ht,imports:"regex-only",parseImports:us}),Is=[Pf,wf,Lf,kf,Df,Af,Of,Mf,$f,Bf];function kn(e){return _s(Is,e)}function LN(e){return Is.find(n=>n.language===e)?.capabilities??null}var ai={clearGroups:["whole-project","source-file"]},jf=v("source-imports",ai),Vf=v("source-exports",ai),Uf=v("source-reexports",ai),Rs=le({kind:"source-imports",invalidation:X("source-imports"),serialize:Hf,deserialize:zf}),Fs=le({kind:"source-reexports",invalidation:X("source-reexports"),serialize:Wf,deserialize:qf});function je(e,t){let n=D(t);return Uf.get(e,n,()=>{let r=kn(n);if(!r?.parseReExports)return[];let i=x(e,n);if(!i)return[];let o=he(e,n,i),s=Wr(e),a=Fs.read(e,n,o);if(a?.resolutionFingerprint===s)return a.reExports;let c=r.parseReExports(e,n,i);return Fs.write(e,n,o,{resolutionFingerprint:s,reExports:c}),c})}function M(e,t){let n=D(t);return jf.get(e,n,()=>{let r=kn(n);if(!r)return[];let i=x(e,n);if(!i)return[];let o=he(e,n,i),s=Wr(e),a=Rs.read(e,n,o);if(a?.resolutionFingerprint===s)return a.imports;let c=r.parseImports(e,n,i);return Rs.write(e,n,o,{resolutionFingerprint:s,imports:c}),c})}function VN(e,t){let n=D(t);return Vf.get(e,n,()=>{let r=kn(n);if(!r?.parseExports)return[];let i=x(e,n);return i?r.parseExports(e,n,i):[]})}function Hf(e){return JSON.stringify(e)}function zf(e){try{let t=JSON.parse(e);return!ke(t)||typeof t.resolutionFingerprint!="string"||!Array.isArray(t.imports)?null:{resolutionFingerprint:t.resolutionFingerprint,imports:t.imports}}catch{return null}}function Wf(e){return JSON.stringify(e)}function qf(e){try{let t=JSON.parse(e);return!ke(t)||typeof t.resolutionFingerprint!="string"||!Array.isArray(t.reExports)?null:{resolutionFingerprint:t.resolutionFingerprint,reExports:t.reExports}}catch{return null}}function Dn(e){return{forFile(t,n){return Ts(e,t,n)},forFiles(t,n){let r=new Map;for(let i of t)r.set(i,Ts(e,i,n));return r}}}function Ts(e,t,n){let r={file:t},i=n.facts||n.identifiers;if(n.text&&(r.text=x(e,t)),n.lines&&(r.lines=Pt(e,t)),n.ast&&(r.ast=R(e,t)),n.imports&&(r.imports=M(e,t)),n.reexports&&(r.reexports=je(e,t)),i){let o=wr(e,t),s=o.facts;n.facts&&(r.facts=s),o.unavailable&&(r.sourceFactsUnavailable=o.unavailable),n.identifiers&&s&&(r.identifiers=s.fileIdentifiers,r.identifierLineMap=s.identifierLineMap)}return r}var Kf={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function de(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let t=e.split(" ");if(t.length<4)return{scheme:t[0]??"",manager:t[1]??"",packageName:t[2]??"",version:"",descriptors:[],raw:e};let n=t[0],r=t[1],i=e.slice(n.length+1+r.length+1),o;if(i.startsWith("`")){let l=i.indexOf("`",1);l===-1?(o=i.slice(1),i=""):(o=i.slice(1,l),i=i.slice(l+2))}else{let l=i.indexOf(" ");l===-1?(o=i,i=""):(o=i.slice(0,l),i=i.slice(l+1))}let s,a=i.indexOf(" ");a===-1?(s=i,i=""):(s=i.slice(0,a),i=i.slice(a+1));let c=Gf(i);return{scheme:n,manager:r,packageName:o,version:s,descriptors:c,raw:e}}function ae(e){let t=de(e);if("kind"in t)return null;for(let n=t.descriptors.length-2;n>=0;n--){let r=t.descriptors[n];if(r?.suffix==="type")return r.name}return null}function Gf(e){let t=[],n=0;for(;n<e.length;){if(e[n]==="["){let o=e.indexOf("]",n+1);if(o===-1){t.push({name:e.slice(n+1),suffix:"type-param"});break}t.push({name:e.slice(n+1,o),suffix:"type-param"}),n=o+1;continue}if(e[n]==="("&&(t.length===0||n===0||Ps(e[n-1]))){let o=e.indexOf(")",n+1);if(o!==-1&&e[o+1]!=="."){t.push({name:e.slice(n+1,o),suffix:"parameter"}),n=o+1;continue}}let r;if(e[n]==="`"){let o=e.indexOf("`",n+1);if(o===-1){r=e.slice(n+1),t.push({name:r,suffix:"term"});break}r=e.slice(n+1,o),n=o+1}else{let o=n;for(;n<e.length&&!Ps(e[n]);)n++;r=e.slice(o,n)}if(n>=e.length){r&&t.push({name:r,suffix:"term"});break}let i=e[n];if(i==="("){let o=e.indexOf(")",n+1);o!==-1&&e[o+1]==="."?(t.push({name:r,suffix:"method"}),n=o+2):o!==-1?(t.push({name:r,suffix:"method"}),n=o+1):(t.push({name:r,suffix:"term"}),n++)}else{let o=Kf[i];o&&t.push({name:r,suffix:o}),n+=1}}return t}function Ps(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function Ve(e){let t=de(e);if("kind"in t&&t.kind==="local")return`local:${t.id}`;let n=t;if(n.descriptors.length===0)return n.raw;let r=[];for(let i of n.descriptors){let o=Xf(i);o&&r.push(o)}return r.join(":")}function Xf(e){let t=e.suffix==="namespace"?Jf(e.name):e.name;return t?e.suffix==="method"?`${t}()`:t:""}function Jf(e){return e.replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/,"").replace(/\.(py|pyi)$/,"").replace(/\.(rs)$/,"").replace(/\.(java|scala|kt|kts)$/,"").replace(/\.(rb)$/,"").replace(/\.(go)$/,"").replace(/\.(cs|vb)$/,"").replace(/\.(dart)$/,"").replace(/\.(php)$/,"").replace(/\.(c|cc|cpp|cxx|h|hpp)$/,"")}function K(e){let t=de(e);if("kind"in t&&t.kind==="local")return t.id;let n=t;return n.descriptors.length===0?"":n.descriptors[n.descriptors.length-1].name}function et(e){let t=de(e);if("kind"in t&&t.kind==="local")return null;let n=t;return n.descriptors[n.descriptors.length-1]?.suffix??null}function ci(e){return e.endsWith("().")||et(e)==="method"}function jt(e){let t=et(e);return t==="method"?!0:t!=="term"?!1:e.endsWith("().")?!0:e.startsWith("rust-analyzer ")&&e.includes("#")?!1:e.startsWith("scip-typescript ")?!/#[A-Za-z0-9_$]+\.$/.test(e):!0}function ws(e){return et(e)==="namespace"}var Qf=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function GN(e){return Qf.test(e)}var Zf=new Set(["test","tests","_tests"]);function XN(e){let t=de(e);if("kind"in t)return!1;for(let n=0;n<t.descriptors.length-1;n+=1){let r=t.descriptors[n];if(r?.suffix==="namespace"&&r.name&&Zf.has(r.name))return!0}return!1}function JN(e,t){let n=de(e),r=de(t);if("kind"in n||"kind"in r)return!1;let i=n.descriptors,o=r.descriptors;if(o.length!==i.length+1)return!1;for(let s=0;s<i.length;s++){let a=i[s],c=o[s];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function QN(e,t){let n=de(e),r=de(t);if("kind"in n||"kind"in r)return!1;let i=n.descriptors,o=r.descriptors;if(o.length<=i.length)return!1;for(let s=0;s<i.length;s++){let a=i[s],c=o[s];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function Ue(e,t){return e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.start_char, der.end_line, der.end_char, d.relative_path, gs.display_name, gs.documentation
|
|
111
|
+
FROM global_symbols gs
|
|
112
|
+
JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
|
|
113
|
+
JOIN documents d ON der.document_id = d.id
|
|
114
|
+
WHERE ${t.where}
|
|
115
|
+
${e.pathExclusionsFor("d")}
|
|
116
|
+
${ks(t.orderBy)}
|
|
117
|
+
${Ds(t.limit)}`,...t.params??[])}function tt(e,t){return e.all(`SELECT
|
|
118
|
+
gs.id,
|
|
119
|
+
gs.symbol,
|
|
120
|
+
c.document_id,
|
|
121
|
+
MIN(c.start_line) AS start_line,
|
|
122
|
+
0 AS start_char,
|
|
123
|
+
MAX(c.end_line) AS end_line,
|
|
124
|
+
0 AS end_char,
|
|
125
|
+
d.relative_path,
|
|
126
|
+
gs.display_name,
|
|
127
|
+
gs.documentation
|
|
128
|
+
FROM global_symbols gs
|
|
129
|
+
JOIN mentions m ON m.symbol_id = gs.id
|
|
130
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
131
|
+
JOIN documents d ON c.document_id = d.id
|
|
132
|
+
WHERE m.role = 1
|
|
133
|
+
AND ${t.where}
|
|
134
|
+
${e.pathExclusionsFor("d")}
|
|
135
|
+
GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path, gs.display_name, gs.documentation
|
|
136
|
+
${ks(t.orderBy)}
|
|
137
|
+
${Ds(t.limit)}`,...t.params??[])}function ks(e){return e?`ORDER BY ${e}`:""}function Ds(e){return typeof e=="number"?`LIMIT ${e}`:""}function li(e){return!e||!e.trim()?null:e.replace(/^```\w*\s*/,"").replace(/\s*```$/,"").replace(/^\(method\)\s*/,"").replace(/^\(property\)\s*/,"").replace(/^\(function\)\s*/,"").replace(/^\(class\)\s*/,"").replace(/^\(interface\)\s*/,"").replace(/^\(enum\)\s*/,"").replace(/^\(type alias\)\s*/,"").replace(/^\(const\)\s*/,"").replace(/^\(var\)\s*/,"").trim()||null}function ui(e){if(!e)return null;let t=Ls(e);if(t)return t.replace(/\n/g," ");let n=e.indexOf("|");if(n===-1)return e.replace(/\n/g," ");let r=e.slice(n+1);return(Ls(r)??r).replace(/\n/g," ")}function Ls(e){return/^```(?:\w+)?\s*\n?([\s\S]*?)\n?```/.exec(e.trimStart())?.[1]?.trim()||null}function Yf(e,t={}){if(ae(e.symbol)!==null)return t.includeClassMemberFallbacks===!0;let i=(e.documentation??"").replace(/^```\w*\s*/,"").replace(/\s*```$/,"").trim();return/^(?:var|let|const|function|class|interface|type|enum)\b/.test(i)}function Le(e,t,n={}){let r=new Map;for(let o of t)e.length>0&&!Yf(o,{includeClassMemberFallbacks:n.includeClassMemberFallbacks})||r.set(o.id,o);for(let o of e)r.set(o.id,o);let i=[...r.values()];return n.sort?i.sort((o,s)=>o.start_line-s.start_line||o.end_line-s.end_line||o.symbol.localeCompare(s.symbol)):i}function fE(e){let t=new Map;for(let n of e){if(!n.leaf)continue;let r=t.get(n.leaf)??[];r.push(n),t.set(n.leaf,r)}return t}var em=v("file-definitions",{clearGroups:["definition-catalog"]}),tm=ye("scoped-matched-definitions",{clearGroups:["definition-catalog"]}),nm=v("file-function-like-definitions",{clearGroups:["definition-catalog"]}),As=new WeakMap;function F(e,t,n={}){return n.includeClassMemberFallbacks?di(e,t,void 0,{includeClassMemberFallbacks:!0}):em.get(e,t,()=>{let r=Bs(e,t);if(r)return r;let i=di(e,t),o=We(e),s=Dn(e).forFile(t,{text:!0}).text;return o&&s&&$s.write(e,t,he(e,t,s),{projectFingerprint:o,definitions:i.map(a=>({...a}))}),i})}function rm(e,t){return nm.get(e,t,()=>{let n=Bs(e,t);return n?n.filter(r=>r.isFunctionLike):di(e,t,r=>r.isFunctionLike)})}var $s=le({kind:"file-definitions",invalidation:X("file-definitions"),serialize:im,deserialize:om});function Bs(e,t){let n=We(e);if(!n)return null;let r=Dn(e).forFile(t,{text:!0}).text;if(!r)return null;let i=$s.read(e,t,he(e,t,r));return i?sm(i,n,t):null}function im(e){return JSON.stringify(e)}function om(e){try{let t=JSON.parse(e);return!ke(t)||typeof t.projectFingerprint!="string"||!Array.isArray(t.definitions)?null:{projectFingerprint:t.projectFingerprint,definitions:t.definitions}}catch{return null}}function sm(e,t,n){if(e.projectFingerprint!==t)return null;let r=[];for(let i of e.definitions){let o=am(i,n);if(!o)return null;r.push(o)}return r}function am(e,t){return!ke(e)||typeof e.symbolId!="number"||typeof e.symbol!="string"||typeof e.documentId!="number"||typeof e.startLine!="number"||typeof e.startChar!="number"&&e.startChar!==void 0||typeof e.endLine!="number"||typeof e.endChar!="number"&&e.endChar!==void 0||e.relativePath!==t||typeof e.leaf!="string"||typeof e.parentTypeName!="string"&&e.parentTypeName!==null||typeof e.isFunctionLike!="boolean"||typeof e.isTypeLike!="boolean"||typeof e.kind!="number"&&e.kind!==null||typeof e.documentation!="string"&&e.documentation!==null||typeof e.enclosingSymbol!="string"&&e.enclosingSymbol!==null?null:{symbolId:e.symbolId,symbol:e.symbol,documentId:e.documentId,startLine:e.startLine,startChar:e.startChar,endLine:e.endLine,endChar:e.endChar,relativePath:e.relativePath,leaf:e.leaf,parentTypeName:e.parentTypeName,isFunctionLike:e.isFunctionLike,isTypeLike:e.isTypeLike,kind:e.kind,documentation:e.documentation,enclosingSymbol:e.enclosingSymbol}}function di(e,t,n,r={}){let i=Le(cm(e,t),lm(e,t),{sort:!0,includeClassMemberFallbacks:r.includeClassMemberFallbacks}).map(js);return n&&(i=i.filter(n)),Us(e,t,i)}function cm(e,t){return e.all(`SELECT
|
|
138
|
+
gs.id,
|
|
139
|
+
gs.symbol,
|
|
140
|
+
der.document_id,
|
|
141
|
+
der.start_line,
|
|
142
|
+
der.start_char,
|
|
143
|
+
der.end_line,
|
|
144
|
+
der.end_char,
|
|
145
|
+
d.relative_path,
|
|
146
|
+
gs.display_name,
|
|
147
|
+
gs.kind,
|
|
148
|
+
gs.documentation,
|
|
149
|
+
gs.enclosing_symbol
|
|
150
|
+
FROM global_symbols gs
|
|
151
|
+
JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
|
|
152
|
+
JOIN documents d ON der.document_id = d.id
|
|
153
|
+
WHERE d.relative_path = ?
|
|
154
|
+
${e.symbolNoiseFor("gs")}
|
|
155
|
+
ORDER BY der.start_line, der.end_line`,t)}function lm(e,t){return e.all(`SELECT
|
|
156
|
+
gs.id,
|
|
157
|
+
gs.symbol,
|
|
158
|
+
c.document_id,
|
|
159
|
+
MIN(c.start_line) AS start_line,
|
|
160
|
+
0 AS start_char,
|
|
161
|
+
MAX(c.end_line) AS end_line,
|
|
162
|
+
0 AS end_char,
|
|
163
|
+
d.relative_path,
|
|
164
|
+
gs.display_name,
|
|
165
|
+
gs.kind,
|
|
166
|
+
gs.documentation,
|
|
167
|
+
gs.enclosing_symbol
|
|
168
|
+
FROM global_symbols gs
|
|
169
|
+
JOIN mentions m ON m.symbol_id = gs.id
|
|
170
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
171
|
+
JOIN documents d ON c.document_id = d.id
|
|
172
|
+
WHERE d.relative_path = ?
|
|
173
|
+
AND m.role = 1
|
|
174
|
+
${e.symbolNoiseFor("gs")}
|
|
175
|
+
GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
|
|
176
|
+
ORDER BY start_line, end_line`,t)}function js(e){return{symbolId:e.id,symbol:e.symbol,documentId:e.document_id,startLine:e.start_line,startChar:e.start_char??0,endLine:e.end_line,endChar:e.end_char??0,relativePath:e.relative_path,leaf:K(e.symbol),parentTypeName:ae(e.symbol),isFunctionLike:jt(e.symbol),isTypeLike:et(e.symbol)==="type",kind:e.kind??null,documentation:e.documentation??null,enclosingSymbol:e.enclosing_symbol??null}}function mE(e,t={}){return um(e,t.scope)}function um(e,t){return ee(e,{scope:t,includeIgnored:!1}).flatMap(n=>F(e,n)).filter(n=>!e.isIgnored(n.relativePath))}function gE(e,t){return ee(e,{scope:t,includeIgnored:!1}).flatMap(n=>rm(e,n)).filter(n=>!e.isIgnored(n.relativePath))}function yE(e,t){let n=tm.get(e,()=>new WeakMap),r=n.get(t.symbolMatches);r||(r=new Map,n.set(t.symbolMatches,r));let i=JSON.stringify({scope:t.scope??null,sqlPrefilter:t.sqlPrefilter??null}),o=r.get(i);if(o)return[...o];let s=Os(dm(e,t.scope,t.sqlPrefilter)),a=Os(pm(e,t.scope,t.sqlPrefilter)),c=new Set([...s.keys(),...a.keys()]),l=[];for(let u of[...c].sort()){if(e.isIgnored(u))continue;let d=Le(s.get(u)??[],a.get(u)??[],{sort:!0}).filter(p=>t.symbolMatches(p.symbol));d.length!==0&&l.push(...Us(e,u,d.map(js)))}return r.set(i,l),[...l]}function dm(e,t,n){let r=t?"AND d.relative_path LIKE ?":"",i=n?`AND ${Vs("gs",n)}`:"",o=t?[`%${t}%`]:[];return e.all(`SELECT
|
|
177
|
+
gs.id,
|
|
178
|
+
gs.symbol,
|
|
179
|
+
der.document_id,
|
|
180
|
+
der.start_line,
|
|
181
|
+
der.start_char,
|
|
182
|
+
der.end_line,
|
|
183
|
+
der.end_char,
|
|
184
|
+
d.relative_path,
|
|
185
|
+
gs.display_name,
|
|
186
|
+
gs.kind,
|
|
187
|
+
gs.documentation,
|
|
188
|
+
gs.enclosing_symbol
|
|
189
|
+
FROM global_symbols gs
|
|
190
|
+
JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
|
|
191
|
+
JOIN documents d ON der.document_id = d.id
|
|
192
|
+
WHERE 1 = 1
|
|
193
|
+
${e.pathExclusionsFor("d")}
|
|
194
|
+
${r}
|
|
195
|
+
${i}
|
|
196
|
+
${e.symbolNoiseFor("gs")}
|
|
197
|
+
ORDER BY d.relative_path, der.start_line, der.end_line`,...o)}function pm(e,t,n){let r=t?"AND d.relative_path LIKE ?":"",i=n?`AND ${Vs("gs",n)}`:"",o=t?[`%${t}%`]:[];return e.all(`SELECT
|
|
198
|
+
gs.id,
|
|
199
|
+
gs.symbol,
|
|
200
|
+
c.document_id,
|
|
201
|
+
MIN(c.start_line) AS start_line,
|
|
202
|
+
0 AS start_char,
|
|
203
|
+
MAX(c.end_line) AS end_line,
|
|
204
|
+
0 AS end_char,
|
|
205
|
+
d.relative_path,
|
|
206
|
+
gs.display_name,
|
|
207
|
+
gs.kind,
|
|
208
|
+
gs.documentation,
|
|
209
|
+
gs.enclosing_symbol
|
|
210
|
+
FROM global_symbols gs
|
|
211
|
+
JOIN mentions m ON m.symbol_id = gs.id
|
|
212
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
213
|
+
JOIN documents d ON c.document_id = d.id
|
|
214
|
+
WHERE m.role = 1
|
|
215
|
+
AND NOT EXISTS (
|
|
216
|
+
SELECT 1
|
|
217
|
+
FROM defn_enclosing_ranges existing_der
|
|
218
|
+
WHERE existing_der.symbol_id = gs.id
|
|
219
|
+
)
|
|
220
|
+
${e.pathExclusionsFor("d")}
|
|
221
|
+
${r}
|
|
222
|
+
${i}
|
|
223
|
+
${e.symbolNoiseFor("gs")}
|
|
224
|
+
GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
|
|
225
|
+
ORDER BY d.relative_path, start_line, end_line`,...o)}function fm(e){return`(${e}.symbol LIKE '%().' OR ${e}.symbol LIKE '%()')`}function Vs(e,t){return t==="callable"?fm(e):mm(e)}function mm(e){return`(${e}.symbol LIKE '%.' OR ${e}.symbol LIKE '%()')`}function Os(e){let t=new Map;for(let n of e){let r=t.get(n.relative_path);r?r.push(n):t.set(n.relative_path,[n])}return t}function hE(e,t,n={}){if(t.length===0)return[];let r=t.flatMap(i=>F(e,i)).filter(i=>!e.isIgnored(i.relativePath));return n.onlyDocumented&&(r=r.filter(i=>i.documentation!==null&&i.documentation!=="")),n.sort&&(r=r.sort((i,o)=>i.relativePath.localeCompare(o.relativePath)||i.startLine-o.startLine||i.endLine-o.endLine)),r.map(i=>({startLine:i.startLine,endLine:i.endLine,symbol:i.symbol,shortName:Ve(i.symbol),signature:li(ui(i.documentation)),relativePath:i.relativePath,enclosingSymbol:i.enclosingSymbol}))}function gm(e){let t=new Map,n=e.map((r,i)=>({definition:r,index:i,span:r.endLine-r.startLine})).sort((r,i)=>r.span-i.span||r.index-i.index);for(let{definition:r}of n)for(let i=r.startLine;i<=r.endLine;i+=1)t.has(i)||t.set(i,r);return t}function Nt(e,t){let n=As.get(e);return n||(n=gm(e),As.set(e,n)),n.get(t)??null}function An(e,t){let n=F(e,t.relative_path).find(r=>r.symbolId===t.id);return n?{symbolId:n.symbolId,symbol:n.symbol,documentId:n.documentId,startLine:n.startLine,startChar:n.startChar,endLine:n.endLine,endChar:n.endChar,relativePath:n.relativePath}:{symbolId:t.id,symbol:t.symbol,documentId:t.document_id,startLine:t.start_line,startChar:t.start_char??0,endLine:t.end_line,endChar:t.end_char??0,relativePath:t.relative_path}}function Us(e,t,n){let r=Dn(e).forFile(t,{text:!0}).text,i=Lr(e,t);return i?vm(n,i,r):r?ym(n,r):n}function ym(e,t){let n=t.split(/\r?\n/),r=hm(e,n),i=Sm(e,r),o=bm(i,n);return xm(e,o)}function hm(e,t){let n=e.some(i=>On(i.symbol))?Fm(t):null,r=new Map;for(let i of e)r.set(i.symbolId,Rm(t,n,i));return r}function Sm(e,t){return e.filter(n=>On(n.symbol)).map(n=>({definition:n,startLine:t.get(n.symbolId)??n.startLine})).sort((n,r)=>n.startLine-r.startLine||n.definition.startLine-r.definition.startLine||n.definition.symbol.localeCompare(r.definition.symbol))}function bm(e,t){let n=new Map;for(let r=0;r<e.length;r+=1){let i=e[r],o=e[r+1],s=o?Math.max(i.startLine,o.startLine-1):t.length-1;n.set(i.definition.symbolId,{startLine:i.startLine,endLine:Tm(t,i.definition,i.startLine,s)})}return n}function xm(e,t){return e.map(n=>{let r=t.get(n.symbolId);return r?{...n,startLine:r.startLine,endLine:r.endLine}:n})}function vm(e,t,n=null){let r=new Map;for(let i of t){let o=r.get(i.name);o?o.push(i):r.set(i.name,[i])}return e.map(i=>{if(!Im(i)||!i.leaf)return Ms(i,n);let o=r.get(i.leaf);if(!o||o.length===0)return Ms(i,n);let s=n?Nm(i,o,n):null;if(s)return{...i,startLine:s.startLine,endLine:s.endLine};let a=o[0],c=Math.abs(a.startLine-i.startLine);for(let l=1;l<o.length;l+=1){let u=o[l],d=Math.abs(u.startLine-i.startLine);d<c&&(a=u,c=d)}return{...i,startLine:a.startLine,endLine:a.endLine}})}function Nm(e,t,n){let r=Em(e.symbol);if(!r)return null;let i=n.split(/\r?\n/),o=new RegExp(`\\b${re(r)}\\b`);for(let s of t){let a=Cm(i,s.startLine);if(a&&o.test(a))return s}return null}function Em(e){return e.match(/\/impl#\[([^\]]+)\]/)?.[1]??null}function Cm(e,t){for(let n=t;n>=0;n-=1){let r=e[n]?.trim()??"";if(r){if(/^impl\b/.test(r))return _m(e,n,t);if(/^(?:struct|enum|trait|mod)\b/.test(r))return null}}return null}function _m(e,t,n){let r=[];for(let i=t;i<=n;i+=1){let o=e[i]??"";if(r.push(o),o.includes("{"))break}return r.join(" ")}function Im(e){return On(e.symbol)?!0:et(e.symbol)==="term"&&ae(e.symbol)===null}function Ms(e,t){if(!t||!e.leaf||et(e.symbol)!=="term"||ae(e.symbol)!==null)return e;let n=re(e.leaf),r=new RegExp(`\\b(?:export\\s+)?(?:const|let|var)\\s+${n}\\b`),o=t.split(/\r?\n/).findIndex(s=>r.test(s));return o>=0?{...e,startLine:o,endLine:o}:e}function Rm(e,t,n){if(!On(n.symbol))return n.startLine;let r=Math.max(0,Math.min(n.startLine,e.length-1));if(!t)return r;let i=t.get(n.leaf);if(!i||i.length===0)return r;let o=null;for(let s of i){let a=Math.abs(s-n.startLine);(!o||a<o.distance)&&(o={line:s,distance:a})}return o?.line??r}function Fm(e){let t=/\b(?:function|def|fn)\s+([A-Za-z_$][\w$]*)/g,n=/\b([A-Za-z_$][\w$]*)\s*[:=]\s*(?:async\s*)?(?:function\b|\()/g,r=/^\s*(?:(?:export|public|private|protected|static|readonly|async|abstract|get|set)\s+)*([A-Za-z_$][\w$]*)\s*(?:<[^(]*>)?\s*\(/,i=/\b([A-Za-z_$][\w$]*)\s*\(/g,o=new Map,s=(a,c)=>{let l=o.get(a);if(!l){o.set(a,[c]);return}l[l.length-1]!==c&&l.push(c)};for(let a=0;a<e.length;a+=1){let c=e[a]??"";for(let u of c.matchAll(t))u[1]&&s(u[1],a);for(let u of c.matchAll(n))u[1]&&s(u[1],a);let l=c.match(r);l?.[1]&&s(l[1],a);for(let u of c.matchAll(i))u[1]&&s(u[1],a)}return o}function Tm(e,t,n,r){let i=Math.max(n,Math.min(e.length-1,r)),o=Math.max(n,Math.min(i,t.endLine)),s=0,a=0,c=!1;for(let l=n;l<=i;l+=1){let u=Pm(e[l]??"");for(let d of u)d==="{"?(s+=1,c=!0):d==="}"?s=Math.max(0,s-1):d==="("?a+=1:d===")"&&(a=Math.max(0,a-1));if(c&&s===0||!c&&a===0&&l>=o)return l}return o}function Pm(e){let t="",n=null,r=!1;for(let i=0;i<e.length;i+=1){let o=e[i],s=e[i+1];if(!n&&o==="/"&&s==="/"){t+=" ".repeat(e.length-i);break}if(n){if(r){r=!1,t+=" ";continue}if(o==="\\"){r=!0,t+=" ";continue}o===n&&(n=null),t+=" ";continue}if(o==='"'||o==="'"||o==="`"){n=o,t+=" ";continue}t+=o}return t}function On(e){return e.includes("().")}function SE(e){let t=de(e);if("kind"in t)return[];let n=[];for(let r=t.descriptors.length-2;r>=0;r-=1){let i=t.descriptors[r];i?.suffix==="type"&&i.name&&n.push(i.name)}return n}var Hs=So({kind:"file-dependency-graph",invalidation:X("file-dependency-graph"),serialize:e=>JSON.stringify(e),deserialize:Mm}),wm=v("file-dep-graph",{clearGroups:["whole-project"]});function Mn(e,t,n={}){let r=n.scipEdges??"all-references",i=n.sourceEdges??"imports-only",o=Dm(t,r,i);return wm.get(e,o,()=>{let s=new Set(ee(e,{includeIgnored:!1})),a=We(e),c=0,l=0,u=null,d=!1,p=0,f=0;return ge("file-dep-graph.product",()=>{if(a){let S=Hs.read(e,o,a);if(S){d=!0;let b=Om(S);return c=S.sourceFileCount,l=S.sourceEdgeCount,p=S.scipEdgeCount,f=b.size,u=S.sourceDependencyFingerprint,b}}let m=ge("file-dep-graph.source-imports",()=>{let S=Lm(e,s,t,i);return c=S.files.length,l=S.edges.length,u=S.fingerprint,S},()=>({scope:t??null,sourceEdges:i,files:c,edges:l})),g=new Map,y=(S,b)=>Vm(e,g,s,S,b);ge("file-dep-graph.scip-edges",()=>{for(let S of jm(e,t,r))p+=1,y(S.from_file,S.to_file)},()=>({scope:t??null,edges:p}));for(let S of m.edges)y(S.fromFile,S.toFile);return f=g.size,a&&Hs.write(e,o,a,{sourceDependencyFingerprint:m.fingerprint,sourceFileCount:m.files.length,sourceEdgeCount:m.edges.length,scipEdgeCount:p,graph:Am(g)}),g},()=>({scope:t??null,available:a!==null,hit:d,files:c,sourceEdges:l,sourceEdgeMode:i,scipEdges:p,graphFiles:f,sourceDependencyFingerprint:u}))})}function Lm(e,t,n,r){let i=[],o=[];for(let s of t)if(!(n&&!s.includes(n))){i.push(s);for(let a of M(e,s))a.sourcePath&&o.push({fromFile:s,toFile:a.sourcePath});if(r==="imports-and-reexports")for(let a of je(e,s))a.sourcePath&&o.push({fromFile:s,toFile:a.sourcePath})}return{files:i,edges:o,fingerprint:km(i,o)}}function km(e,t){let n=t.map(r=>`${r.fromFile}\0${r.toFile}`).sort();return Ne(JSON.stringify({files:e,edges:n}))}function Dm(e,t,n){return`edge-mode-v3:${t}:${n}:${e??"<all>"}`}function Am(e){return[...e].map(([t,n])=>[t,[...n]])}function Om(e){return new Map(e.graph.map(([t,n])=>[t,new Set(n)]))}function Mm(e){let t=JSON.parse(e);return $m(t)?t:null}function $m(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.sourceDependencyFingerprint=="string"&&typeof t.sourceFileCount=="number"&&typeof t.sourceEdgeCount=="number"&&typeof t.scipEdgeCount=="number"&&Array.isArray(t.graph)&&t.graph.every(Bm)}function Bm(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="string"&&Array.isArray(e[1])&&e[1].every(t=>typeof t=="string")}function jm(e,t,n){let r=t?"AND d1.relative_path LIKE ?":"",i=t?[`%${t}%`]:[],o=n==="imports-only"?"AND m.role = 2":"AND m.role != 1";return e.all(`SELECT DISTINCT
|
|
226
|
+
d1.relative_path AS from_file,
|
|
227
|
+
d2.relative_path AS to_file
|
|
228
|
+
FROM mentions m
|
|
229
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
230
|
+
JOIN documents d1 ON c.document_id = d1.id
|
|
231
|
+
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
232
|
+
JOIN (
|
|
233
|
+
SELECT m2.symbol_id, c2.document_id
|
|
234
|
+
FROM mentions m2
|
|
235
|
+
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
236
|
+
WHERE m2.role = 1
|
|
237
|
+
GROUP BY m2.symbol_id
|
|
238
|
+
) sym_def ON sym_def.symbol_id = gs.id
|
|
239
|
+
JOIN documents d2 ON sym_def.document_id = d2.id
|
|
240
|
+
WHERE d1.id != d2.id
|
|
241
|
+
${o}
|
|
242
|
+
${e.pathExclusionsFor("d1","d2")}
|
|
243
|
+
${r}`,...i)}function Vm(e,t,n,r,i){if(r===i||e.isIgnored(r)||e.isIgnored(i)||!n.has(i))return;let o=t.get(r);o||(o=new Set,t.set(r,o)),o.add(i)}var Um=v("symbol-resolution",{clearGroups:[]});function UE(e,t){return Hm(e,t).match}function Hm(e,t){return Um.get(e,t,()=>{let n=qs(e,t.trim()).filter(s=>!e.isIgnored(s.relative_path));if(n.length>0)return Et(e,n);let r=Qm(e,t);if(r&&!e.isIgnored(r.relative_path))return Et(e,[r]);let i=zm(e,t);if(i.length>0)return Et(e,i);let o=Wm(e,t);return o.length>0?Et(e,o):Xm(e,t)})}function zm(e,t){let n=t.trim().replace(/\(\)$/u,""),r=n.lastIndexOf(":");if(r<=0||r===n.length-1||n.startsWith("local:"))return[];let i=n.slice(r+1);if(!/^[\p{L}_$][\p{L}\p{N}_$]*$/u.test(i))return[];let o=[`/${i}().`,`/${i}.`,`/${i}#`,`#${i}().`,`#${i}.`,`/${i}/`],s=`gs.display_name = ? OR ${o.map(()=>"instr(gs.symbol, ?) > 0").join(" OR ")}`,a=[i,...o],c=Ue(e,{where:s,params:a,orderBy:"d.relative_path, der.start_line",limit:200}),l=c.length>0?[]:tt(e,{where:s,params:a,orderBy:"d.relative_path, start_line",limit:200}),u=Le(c,l).filter(d=>!e.isIgnored(d.relative_path)).filter(d=>Ve(d.symbol).replace(/\(\)$/u,"")===n);return[...new Map(u.map(d=>[`${d.symbol}\0${d.relative_path}`,d])).values()]}function Wm(e,t){let n=$n(t),r=pi(n);if(!r)return[];let i=`%${r.path}%`,o=r.leaf;return qm(e,i,o,n)}function qm(e,t,n,r){let i=Le([],[...Km(e,t,n),...Gm(e,t,n)]).filter(o=>!e.isIgnored(o.relative_path)).filter(o=>Ct(o,r)>1);return i.sort((o,s)=>Ct(s,r)-Ct(o,r)||o.end_line-o.start_line-(s.end_line-s.start_line)||o.start_line-s.start_line||o.symbol.localeCompare(s.symbol)),i}function Km(e,t,n){return Ue(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[t,n,`%/${n}.%`]})}function Gm(e,t,n){return tt(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[t,n,`%/${n}.%`]})}function Xm(e,t){let n=$n(t),r=rg(t),i=tg(e,r),o=ig(i,t,n).filter(a=>!e.isIgnored(a.relative_path));if(o.length>0)return Et(e,o);let s=[];for(let a of i){if(e.isIgnored(a.relative_path))continue;let c=ng(a,t,n,r);c<=0||s.push({row:a,score:c})}return s.sort((a,c)=>c.score-a.score||a.row.end_line-a.row.start_line-(c.row.end_line-c.row.start_line)||a.row.relative_path.localeCompare(c.row.relative_path)||a.row.symbol.localeCompare(c.row.symbol)),Et(e,s.map(a=>a.row))}function Et(e,t){let n=t.map(i=>An(e,i)),r=n[0]??null;return{match:r,candidates:r?Jm(n,r):[],total:n.length}}function Jm(e,t){let n=new Set([`${t.symbolId}:${t.relativePath}:${t.startLine}`]),r=[];for(let i of e){let o=`${i.symbolId}:${i.relativePath}:${i.startLine}`;if(!n.has(o)&&(n.add(o),r.push({symbol:i.symbol,shortName:Ve(i.symbol),relativePath:i.relativePath,startLine:i.startLine}),r.length>=5))break}return r}function Qm(e,t){let n=t.match(/^(.+):(\d+)(?:-(\d+))?$/);if(!n)return;let[,r,i,o]=n,s=ao(e,r,{allowMultiple:!1})[0]?.relativePath;if(!s)return;let a=Math.max(0,parseInt(i,10)-1),c=o?Math.max(a,parseInt(o,10)-1):a;return Zm(e,s,a,c)??Ym(e,s,a,c)}function Zm(e,t,n,r){return Ue(e,{where:"d.relative_path = ? AND der.start_line <= ? AND der.end_line >= ?",params:[t,n,r],orderBy:"(der.end_line - der.start_line) ASC",limit:1})[0]}function Ym(e,t,n,r){return tt(e,{where:"d.relative_path = ? AND c.start_line <= ? AND c.end_line >= ?",params:[t,n,r],orderBy:"(MAX(c.end_line) - MIN(c.start_line)) ASC",limit:1})[0]}function HE(e,t){let n=qs(e,t).find(r=>!e.isIgnored(r.relative_path));return n?An(e,n):null}function qs(e,t){let n=Ue(e,{where:"gs.symbol = ?",params:[t],orderBy:"d.relative_path, der.start_line"}),r=n.length>0?[]:tt(e,{where:"gs.symbol = ?",params:[t],orderBy:"d.relative_path, start_line"});return Le(n,r)}function Vt(e,t){if("symbol"in t&&"relativePath"in t)return t;let n=eg(e,t.symbolId)[0];return n?An(e,n):null}function eg(e,t){let n=Ue(e,{where:"gs.id = ?",params:[t],orderBy:"der.start_line, der.end_line"}),r=tt(e,{where:"gs.id = ?",params:[t],orderBy:"start_line, end_line"});return Le(n,r)}function tg(e,t){let n=t.map(()=>"(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)"),r=t.flatMap(a=>{let c=`%${a}%`;return[c,c,c]}),i=n.join(`
|
|
244
|
+
AND `),o=Ue(e,{where:i,params:r,limit:200}),s=tt(e,{where:i,params:r,limit:200});return Le(o,s)}function ng(e,t,n,r){let i=t.trim(),o=n,s=o.replace(/\(\)$/,""),a=t.toLowerCase(),c=n.toLowerCase(),l=c.replace(/\(\)$/,""),u=e.symbol,d=Ve(e.symbol),p=K(e.symbol),f=e.display_name??"",m=e.symbol.toLowerCase(),g=d.toLowerCase(),y=p.toLowerCase(),S=f.toLowerCase(),b=e.relative_path.toLowerCase(),N=/[/:.]/.test(n),E=pi(n),I=E?.leaf.toLowerCase(),h=0;return(u===i||u===o)&&(h+=1150),(d===i||d===o)&&(h+=1100),f===s&&(h+=1180),p===s&&(h+=1160),(`${p}()`===i||`${p}()`===o)&&(h+=955),(m===a||m===c)&&(h+=1e3),(g===a||g===c)&&(h+=950),(b===a||b===c)&&(h+=925),(b.endsWith(`/${c}`)||b.endsWith(`/${a}`))&&(h+=875),S===l&&(h+=850),y===l&&(h+=825),(`${y}()`===a||`${y}()`===c)&&(h+=820),(g.endsWith(`:${c}`)||g.endsWith(`:${l}`)||g.endsWith(`:${l}()`))&&(h+=800),m.includes(c)&&(h+=120),g.includes(c)&&(h+=140),b.includes(c)&&(h+=140),S.includes(c)&&(h+=110),r.every(C=>{let _=C.toLowerCase();return m.includes(_)||g.includes(_)||b.includes(_)||S.includes(_)})&&(h+=100+r.length*15),E&&b.includes(E.path.toLowerCase())&&(h+=360,I&&(y===I||`${y}()`===I||`${y}()`==`${I}()`)&&(h+=700),ci(e.symbol)&&(h+=180)),jt(e.symbol)&&y===l&&(h+=60),!N&&ws(e.symbol)&&(h-=160),h-=Math.min(50,Math.max(0,e.end_line-e.start_line)),h}function pi(e){let t=e.trim().replace(/\\/g,"/"),n=t.lastIndexOf("/");if(n<=0||n===t.length-1)return null;let r=t.slice(n+1).replace(/\(\)$/,"");return!r||r.includes(".")?null:{path:t.slice(0,n),leaf:r}}function $n(e){return e.trim().replace(/\(\)$/,"").replace(/\(.*$/,"")}function rg(e){let t=$n(e),n=t.split(/[^A-Za-z0-9_]+/).map(r=>r.trim()).filter(r=>r.length>0);return n.length>0?[...new Set(n)]:[t]}function ig(e,t,n){let r=t.trim(),i=e.filter(a=>{let c=Ve(a.symbol),l=K(a.symbol),u=(a.display_name??"").trim();return a.symbol===r||c===r||c===n||l===r||l===n||`${l}()`===r||u===r||u===n||`${u}()`===r||Ct(a,n)>1||a.relative_path===r});if(i.length===0)return[];let o=n.replace(/\(\)$/u,""),s=i.filter(a=>K(a.symbol)===o);if(s.length>0){s.sort((c,l)=>zs(c,l,n));let a=s.filter(c=>jt(c.symbol));return a.length>0?a:s}return i.sort((a,c)=>zs(a,c,n)),i}function zs(e,t,n){return Ct(t,n)-Ct(e,n)||e.end_line-e.start_line-(t.end_line-t.start_line)||e.relative_path.localeCompare(t.relative_path)||e.symbol.localeCompare(t.symbol)}function Ct(e,t){let n=pi(t);if(!n)return 0;let r=e.relative_path.toLowerCase(),i=K(e.symbol).toLowerCase(),o=n.path.toLowerCase(),s=n.leaf.toLowerCase();return r.includes(o)?i!==s?1:ci(e.symbol)?ae(e.symbol)===null?5:4:ae(e.symbol)===null?3:2:0}function zE(e,t,n=5){let r=Ws(t);if(!r)return[];let i=Ue(e,{where:"1 = 1",orderBy:"d.relative_path, der.start_line",limit:5e3}),o=new Map;for(let s of i){if(e.isIgnored(s.relative_path))continue;let a=Ve(s.symbol),c=K(s.symbol),l=s.display_name??c,u=[a,c,l].filter(f=>f.trim().length>0),d=Math.min(...u.map(f=>og(Ws(f),r))),p=o.get(a);(!p||d<p.distance)&&o.set(a,{shortName:a,distance:d})}return[...o.values()].sort((s,a)=>s.distance-a.distance||s.shortName.localeCompare(a.shortName)).slice(0,n).map(s=>s.shortName)}function Ws(e){return $n(e).toLowerCase().replace(/[^a-z0-9_]+/g,"")}function og(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let n=Array.from({length:t.length+1},(r,i)=>i);for(let r=0;r<e.length;r++){let i=[r+1];for(let o=0;o<t.length;o++){let s=e[r]===t[o]?0:1;i[o+1]=Math.min(i[o]+1,n[o+1]+1,n[o]+s)}n=i}return n[t.length]}function YE(e,t){let n=Ks(e);return n?t.filter(r=>Ks(r.file)===n):t}function eC(e,t,n,r,i){let o=n.find(s=>s.file===t);if(o)return o;if(r){let s=i?.match(/^[A-Za-z_$][\w$]*/u)?.[0];if(!s)return null;let a=M(e,t),c=new Set(a.filter(p=>p.localName===s||p.importedName===s).map(p=>p.sourcePath).filter(p=>!!p));for(let p of n)for(let f of c)if(at(f,p.file))return p;let l=sg(x(e,t)??"",s);if(l.size===0)return null;let u=new Set(a.filter(p=>l.has(p.localName??p.importedName)).map(p=>p.sourcePath).filter(p=>!!p)),d=n.filter(p=>l.has(ae(p.symbol)??"")&&[...u].some(f=>at(f,p.file)));return d.length===1?d[0]:null}return n.length===1?n[0]:null}function sg(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),r=new Set,i=[new RegExp(`\\b${n}\\s*:\\s*([A-Za-z_$][\\w$]*)`,"gu"),new RegExp(`\\b${n}\\s*=\\s*(?:new\\s+)?([A-Za-z_$][\\w$]*)\\s*\\(`,"gu")];for(let o of i)for(let s of e.matchAll(o))r.add(s[1]);return r.size===1?r:new Set}function Ks(e){let t=H(e);return t?t==="typescript"||t==="tsx"||t==="javascript"?"javascript-family":t:null}var ag=ye("global-leaf-index",{clearGroups:["whole-project"]});function fi(e){return ag.get(e,()=>{let t=e.all(`SELECT gs.id, gs.symbol,
|
|
245
|
+
COALESCE(der_doc.relative_path, mention_doc.relative_path) AS relative_path
|
|
246
|
+
FROM global_symbols gs
|
|
247
|
+
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
248
|
+
LEFT JOIN documents der_doc ON der_doc.id = der.document_id
|
|
249
|
+
LEFT JOIN (
|
|
250
|
+
SELECT m.symbol_id, MIN(d.relative_path) AS relative_path
|
|
251
|
+
FROM mentions m
|
|
252
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
253
|
+
JOIN documents d ON c.document_id = d.id
|
|
254
|
+
WHERE m.role = 1
|
|
255
|
+
GROUP BY m.symbol_id
|
|
256
|
+
) mention_doc ON mention_doc.symbol_id = gs.id
|
|
257
|
+
WHERE 1 = 1
|
|
258
|
+
${e.symbolNoiseFor("gs")}`),n=new Map;for(let r of t){if(!r.relative_path||e.isIgnored(r.relative_path))continue;let i=K(r.symbol);if(!i)continue;let o=n.get(i);o||(o=[],n.set(i,o)),o.some(s=>s.symbolId===r.id)||o.push({symbol:r.symbol,symbolId:r.id,file:r.relative_path})}return n})}function Bn(e,t,n,r={}){if(!n)return[];let i=x(e,t);return i?i.indexOf(n)===-1?[]:(mi(e,t).get(n)??[]).filter(s=>!cg(s,r)):[]}function cg(e,t){return typeof t.excludeStartLine=="number"&&typeof t.excludeEndLine=="number"&&e>=t.excludeStartLine&&e<=t.excludeEndLine}var lg=v("file-identifiers",{clearGroups:["whole-project","source-file"]});function Gs(e,t){let n=A(e,t);return n?n.fileIdentifiers:lg.get(e,t,()=>new Set(mi(e,t).keys()))}var ug=v("file-ident-lines",{clearGroups:["whole-project","source-file"]});function mi(e,t){let n=A(e,t);return n?n.identifierLineMap:ug.get(e,t,()=>pg(e,t))}var dg=v("file-idents-by-line",{clearGroups:["whole-project","source-file"]});function sC(e,t){let n=A(e,t);return n?n.identifiersByLine:dg.get(e,t,()=>{let r=mi(e,t),i=0;for(let s of r.values()){let a=s[s.length-1];a!==void 0&&a>i&&(i=a)}let o=new Array(i+1);for(let s=0;s<=i;s+=1)o[s]=new Set;for(let[s,a]of r)for(let c of a)o[c].add(s);return o})}function pg(e,t){let n=new Map,r=(a,c)=>{let l=n.get(a);if(!l){n.set(a,[c]);return}l[l.length-1]!==c&&l.push(c)},i=x(e,t);if(!i)return n;let o=Qr(i).split(/\r?\n/),s=/\b([A-Za-z_$][\w$]*)\b/g;for(let a=0;a<o.length;a+=1){let c=o[a]??"";for(let l of c.matchAll(s))l[1]&&r(l[1],a)}return n}var Xs=/[A-Za-z_$][A-Za-z0-9_$]*/g,Js=/^[A-Za-z_$][A-Za-z0-9_$]*$/,fg=512;function gi(e){let t=[],n=!1;for(let r of e)r&&(n=!0,Js.test(r)||t.push(r));return{candidateNames:e,hasUsableCandidate:n,nonIdentifierNames:t}}function Qs(e,t){let n=mg(t)?t:gi(t);if(n.candidateNames.size===0||!n.hasUsableCandidate)return!0;if(n.candidateNames.size<=fg){for(let i of n.candidateNames)if(i){if(Js.test(i)){if(gg(i).test(e))return!0;continue}if(e.includes(i))return!0}return!1}Xs.lastIndex=0;let r;for(;(r=Xs.exec(e))!==null;)if(n.candidateNames.has(r[0]))return!0;for(let i of n.nonIdentifierNames)if(e.includes(i))return!0;return!1}function mg(e){return"candidateNames"in e}function gg(e){return new RegExp(`(?<![A-Za-z_$0-9])${re(e)}(?![A-Za-z_$0-9])`)}var yg=v("source-import-paths-by-local-name",{clearGroups:["whole-project","source-file"]});function Ys(e,t){let n=qi(t);return yg.get(e,n,()=>hg(e,n))}function hg(e,t){let n=new Map;for(let r of M(e,t)){if(!r.sourcePath)continue;let i=r.localName??r.importedName;if(i&&Zs(n,i,r.sourcePath),r.kind==="namespace")for(let o of r.usedMembers)Zs(n,o,r.sourcePath)}return n}function Zs(e,t,n){let r=e.get(t);r||(r=new Set,e.set(t,r)),r.add(n)}function yi(e,t,n){let r=fi(e).get(n);if(!r||r.length===0)return[];if(r.length===1)return[Ut(r[0])];let i=r.filter(c=>c.file===t);if(i.length>0)return i.map(Ut);let o=Ys(e,t),s=o.get(n);if(s)for(let c of s){let l=r.filter(u=>at(c,u.file));if(l.length>0)return l.map(Ut)}let a=new Set;for(let c of o.values())for(let l of c)a.add(l);for(let c of a){let l=r.filter(u=>at(c,u.file));if(l.length>0&&l.length===r.length)return l.map(Ut)}return[]}function CC(e,t,n){let r=yi(e,t,n);if(r.length>0)return r;let i=fi(e).get(n);return!i||i.length===0?[]:i.map(Ut)}function ea(e,t,n={}){let r=Sg(e,t);if(!r)return[];let i=Vt(e,t);if(n.semantic!==!1&&n.semanticEvidence){let s=n.semanticEvidence.references(e,{...i,leaf:r.identifier,parentTypeName:null,isFunctionLike:!1,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null});if(s.length>0){let a=new Map;for(let c of s){let l=a.get(c.file)??[];l.push(c.line),a.set(c.file,l)}return jn(e,a)}}let o=new Map;for(let s of z(e)){let a=bg(e,r,s);a.length>0&&o.set(s,a)}return jn(e,o)}function Sg(e,t){let n=Vt(e,t);if(!n)return null;let r=K(n.symbol);return r?{symbolId:n.symbolId,relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,identifier:r}:null}function bg(e,t,n){let r=x(e,n);return!r||r.indexOf(t.identifier)===-1?[]:n!==t.relativePath&&!yi(e,n,t.identifier).some(o=>o.symbolId===t.symbolId)?[]:Bn(e,n,t.identifier,n===t.relativePath?{excludeStartLine:t.startLine,excludeEndLine:t.endLine}:{})}function _C(e,t,n={}){let r=new Map;for(let c of t){if(!c.leaf)continue;let l=r.get(c.leaf)??[];l.push(c),r.set(c.leaf,l)}if(r.size===0)return new Map;let i=new Set(t.map(c=>c.symbolId)),o=new Set(r.keys()),s=gi(o),a=new Map;for(let c of z(e)){if(n.skipPath?.(c)||!Qs(x(e,c),s))continue;let l=Gs(e,c);if(l.size!==0){for(let u of l)if(r.has(u))for(let d of yi(e,c,u)){if(!i.has(d.symbolId)||c===d.relativePath)continue;let p=a.get(d.symbolId);p||(p=new Set,a.set(d.symbolId,p)),p.add(c)}}}return a}function Ut(e){return{symbolId:e.symbolId,symbol:e.symbol,relativePath:e.file}}function jn(e,t){let n=[],r=new Set;for(let[i,o]of t){let s=F(e,i);for(let a of o){let c=Nt(s,a),l=`${i}|${a}|${c?.symbol??""}`;r.has(l)||(r.add(l),n.push({file:i,line:a,enclosingSymbol:c?.symbol??null}))}}return n}function RC(e,t){return Vn(e,t,n=>{let r=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT
|
|
259
|
+
m.symbol_id,
|
|
260
|
+
d.relative_path,
|
|
261
|
+
COUNT(*) AS ref_count
|
|
262
|
+
FROM mentions m
|
|
263
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
264
|
+
JOIN documents d ON c.document_id = d.id
|
|
265
|
+
WHERE m.role != 1
|
|
266
|
+
${r}
|
|
267
|
+
${e.pathExclusionsFor("d")}
|
|
268
|
+
GROUP BY m.symbol_id, d.relative_path`,...n??[])})}function FC(e,t){return Vn(e,t,n=>{let r=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT DISTINCT m.symbol_id, d.relative_path
|
|
269
|
+
FROM mentions m
|
|
270
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
271
|
+
JOIN documents d ON c.document_id = d.id
|
|
272
|
+
WHERE m.role != 1
|
|
273
|
+
${r}
|
|
274
|
+
${e.pathExclusionsFor("d")}`,...n??[])}).filter(n=>n.symbol_id!==null)}function TC(e,t){return Vn(e,t,n=>{let r=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT DISTINCT m.symbol_id
|
|
275
|
+
FROM mentions m
|
|
276
|
+
WHERE m.role != 1
|
|
277
|
+
${r}`,...n??[])}).filter(n=>n.symbol_id!==null)}function ta(e,t){return Vn(e,t,n=>{let r=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT DISTINCT m.symbol_id, d.relative_path, c.document_id,
|
|
278
|
+
c.start_line AS chunk_start, c.end_line AS chunk_end
|
|
279
|
+
FROM mentions m
|
|
280
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
281
|
+
JOIN documents d ON c.document_id = d.id
|
|
282
|
+
WHERE m.role != 1
|
|
283
|
+
${r}
|
|
284
|
+
${e.pathExclusionsFor("d")}
|
|
285
|
+
ORDER BY d.relative_path, c.start_line`,...n??[])})}function Vn(e,t,n){if(!t)return n();if(t.length===0)return[];let r=[];for(let i=0;i<t.length;i+=750)r.push(...n(t.slice(i,i+750)));return r}function xg(e,t){return vg(e,[t]).get(t.symbolId)??[]}function vg(e,t){let n=t.map(o=>({symbolId:o.symbolId,prelude:Ig(e,o)})).filter(o=>o.prelude!==null),r=Eg(e,n.map(o=>o.symbolId)),i=new Map;for(let{symbolId:o,prelude:s}of n){let a=Ng(e,r.get(o)??new Map,s.match,s.identifier);i.set(o,jn(e,a))}return i}function OC(e,t,n={}){return hi(e,t,n).map(r=>({file:r.file,line:r.line,enclosingSymbol:r.enclosingSymbol}))}function hi(e,t,n={}){let r=ea(e,t,{semantic:n.semantic,semanticEvidence:n.semanticEvidence}),i=r.length>0?na(r,"source-attribution"):na(xg(e,t),"scip-reference-chunk");return n.includeIgnored===!0?i:i.filter(o=>!e.isIgnored(o.file))}function na(e,t){return e.map(n=>({...n,provenance:t}))}function Ng(e,t,n,r){let i=new Map;for(let[o,s]of t)i.set(o,Cg(e,o,s,n,r));return i}function Eg(e,t){let n=new Map;for(let r of ta(e,t)){if(e.isIgnored(r.relative_path))continue;let i=n.get(r.symbol_id);i||(i=new Map,n.set(r.symbol_id,i));let o=i.get(r.relative_path);o||(o=[],i.set(r.relative_path,o)),o.push({start_line:r.chunk_start,end_line:r.chunk_end})}return n}function Cg(e,t,n,r,i){let o=t===r.relativePath?{excludeStartLine:r.startLine,excludeEndLine:r.endLine}:{},s=i?Bn(e,t,i,o):[];return n.flatMap(a=>_g(s,a))}function _g(e,t){let n=e.filter(r=>r>=t.start_line&&r<=t.end_line);return n.length>0?n:[t.start_line]}function Ig(e,t){let n=Vt(e,t);return n?{match:n,identifier:K(n.symbol)||null}:null}import{execFileSync as sa,spawnSync as Ag}from"child_process";import{platform as Og}from"os";import{resolve as Mg}from"path";import{createHash as Rg}from"crypto";import{existsSync as ra,renameSync as Fg,rmSync as Tg,writeFileSync as Pg}from"fs";import{tmpdir as wg}from"os";import{join as Lg}from"path";var ia=`'use strict';
|
|
286
|
+
const NativeRegExp = globalThis.RegExp;
|
|
287
|
+
const escapeLoneSeparator = (args) =>
|
|
288
|
+
typeof args[0] === 'string' && args[0] === '\\\\' ? ['\\\\\\\\', ...args.slice(1)] : args;
|
|
289
|
+
globalThis.RegExp = new Proxy(NativeRegExp, {
|
|
290
|
+
construct(target, args) {
|
|
291
|
+
return Reflect.construct(target, escapeLoneSeparator(args));
|
|
292
|
+
},
|
|
293
|
+
apply(target, thisArg, args) {
|
|
294
|
+
return Reflect.apply(target, thisArg, escapeLoneSeparator(args));
|
|
295
|
+
},
|
|
296
|
+
});
|
|
297
|
+
`,kg=/scip-python/i;function oa(e,t=process.platform){return t!=="win32"||!kg.test(e)?[]:["--require",Dg()]}function Dg(e=wg()){let t=Rg("sha256").update(ia).digest("hex").slice(0,16),n=Lg(e,`codebaseiq-indexer-compat-${t}.cjs`);if(ra(n))return n;let r=`${n}.${process.pid}.tmp`;Pg(r,ia);try{Fg(r,n)}catch{if(Tg(r,{force:!0}),!ra(n))throw new Error(`could not materialize indexer compatibility preload at ${n}`)}return n}var aa=Og()==="win32";function KC(e,t=Ag){try{return t(e,["--version"],{stdio:"ignore",timeout:1e4}).status===0}catch{return!1}}function ca(e){let t=aa?"where":"which";try{return sa(t,[e],{stdio:"pipe",timeout:1e4,killSignal:"SIGKILL"}),!0}catch{return!1}}var $g=/\.(?:c|m)?js$/i,Bg=/\.(?:exe|com)$/i;function GC(e,t){return $g.test(e)?{binary:process.execPath,args:[...oa(e),e,...t]}:{binary:e,args:[...t]}}function jg(e,t){return sa(e,t,{stdio:["ignore","pipe","ignore"],windowsHide:!0,encoding:"utf8",timeout:1e4,killSignal:"SIGKILL"})}function la(e,t={}){let n=t.isWindows??aa,r=t.lookup??jg,i;try{i=r(n?"where":"which",[e])}catch{return null}let o=i.split(/\r?\n/).map(s=>s.trim()).filter(Boolean);if(!n){let s=o[0];return s?Mg(s):null}return o.find(s=>Bg.test(s))??null}import{execFileSync as da}from"child_process";import{createHash as Vg}from"crypto";import{existsSync as Un,statSync as Ug}from"fs";import{createRequire as Hg}from"module";import{platform as zg}from"os";import{dirname as ua,join as Ht}from"path";var Wg=Hg(import.meta.url),o_={language:"rust",indexerBinary:"rust-analyzer",installUrl:"https://github.com/rust-lang/rust-analyzer"};function Si(e){return[e.indexerBinary,...e.binaryAliases??[]]}function qg(e){let t=Si(e);return t.length===1?t[0]:t.join(" or ")}function bi(e){for(let t of Si(e)){let n=la(t);if(n)return n}return Gg(e)}function s_(e){return bi(e)!==null||Kg(e)}function Kg(e){return pa(e)!==null}function Gg(e){let t=pa(e);if(!t)return null;let r=JSON.parse(st(t,"indexer package manifest")).bin;if(!r)return null;if(typeof r=="string")return Ht(ua(t),r);for(let i of Si(e)){let o=r[i];if(o)return Ht(ua(t),o)}return null}function pa(e){if(!e.bundledNpmPackage)return null;try{return Wg.resolve(`${e.bundledNpmPackage}/package.json`)}catch{return null}}function Xg(e,t){for(let n of e.projectLocalBinaries??[]){let r=Ht(t,n);if(Un(r))return r}return null}function Jg(e,t){for(let n of e.projectLocalBinaries??[]){let r=Ht(t,n);if(Un(r))return fa(t,n,r)}return null}function a_(e,t){let n=Qg(e,t);if(!n||n.canonicalPath!==t.canonicalPath||n.sha256!==t.sha256||n.size!==t.size||n.mtimeMs!==t.mtimeMs||n.device!==t.device||n.inode!==t.inode||n.executable!==t.executable)throw new Error(`refusing changed project-local indexer ${t.relativePath}; review the current file and rerun with --trust-project-tools`)}function Qg(e,t){try{return fa(e,t.relativePath,t.configuredPath)}catch{return null}}function fa(e,t,n){let r={maxBytes:268435456,inputKind:"project-local indexer"},i=mr(e,t,r),o=gr(e,t,r),s=Ug(i.absolutePath);return{configuredPath:n,canonicalPath:i.absolutePath,relativePath:t,sha256:Vg("sha256").update(o).digest("hex"),size:i.size,mtimeMs:i.mtimeMs,device:i.device,inode:i.inode,executable:(s.mode&73)!==0}}function Zg(e,t,n={}){return(n.trustProjectTools?Jg(e,t)?.canonicalPath:null)??bi(e)}function c_(e,t=process.env,n=e.indexerBinary){if(e.indexerBinary!=="scip-dotnet"||xi(n,t))return t;let r=ma(n,t);return r?{...t,DOTNET_ROOT:r}:t}function l_(e,t,n={}){let r=qg(e),i=t?Zg(e,t,n):bi(e);if(!i)return{language:e.language,binaryLabel:r,installed:!1,runnable:!1,resolvedBinary:null,installUrl:e.installUrl,...t&&Xg(e,t)?{note:"project-local indexer available only with --trust-project-tools"}:{}};if(e.indexerBinary!=="scip-dotnet")return{language:e.language,binaryLabel:r,installed:!0,runnable:!0,resolvedBinary:i};let o=Yg(i);return{language:e.language,binaryLabel:r,installed:!0,runnable:o.runnable,resolvedBinary:i,installUrl:e.installUrl,note:o.note}}function Yg(e){if(xi(e,process.env))return{runnable:!0};let t=ma(e,process.env);if(t)return{runnable:!0,note:`using .NET 9 runtime from ${t}`};let n=ga(process.env);return{runnable:!1,note:n.length>0?`.NET 9 runtime still unavailable after checking ${n.join(", ")}`:"binary is present, but scip-dotnet still needs a .NET 9 runtime"}}function ma(e,t){for(let n of ga(t))if(xi(e,{...t,DOTNET_ROOT:n}))return n;return null}function ga(e){let t=[],n=e.DOTNET_ROOT;if(n&&Un(n)&&t.push(n),zg()==="darwin"&&ca("brew"))try{let r=da("brew",["--prefix","dotnet@9"],{stdio:"pipe",windowsHide:!0,env:e,timeout:1e4,killSignal:"SIGKILL"}).toString().trim(),i=Ht(r,"libexec");Un(i)&&!t.includes(i)&&t.push(i)}catch{}return t}function xi(e,t){try{return da(e,["--version"],{stdio:"pipe",windowsHide:!0,env:t,timeout:1e4,killSignal:"SIGKILL"}),!0}catch{return!1}}var ey=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"];function Hn(e){let t=e.toLowerCase();return ey.some(n=>t.endsWith(n))}function Wn(e){let t=zn(e.projectFiles),n=new Set(t),r=new Map(e.snapshot.files.map(d=>[d.path,d])),i=e.snapshot.files.filter(d=>{let p=Gi(d.path,["typescript"]);return p==="config"||p==="ambient"}).map(d=>d.path),o=zn([...t,...i]),s=o.find(d=>!r.has(d)),a=new Set(e.snapshot.files.map(d=>d.path)).size!==e.snapshot.files.length,c=!s&&o.some(d=>ya(r.get(d))),l=Ne(JSON.stringify({pnpmWorkspaces:e.snapshot.pnpmWorkspaces,typescriptProjectMode:e.snapshot.typescriptProjectMode,typescriptProjects:zn(e.snapshot.typescriptProjects),membership:t})),u=new Map;return{identityFor(d,p){if(!n.has(d))return _t("target-outside-project");if(a)return _t("duplicate-input-path");if(s)return _t("missing-input-fingerprint");if(c)return _t("unreadable-input");let f=[],m,g;if(e.graph===null)f.push("dependency-graph-unavailable"),g="whole-project",m=o;else{let b=ny(d,e.graph,u);if(b.find(E=>!r.has(E)))return _t("missing-input-fingerprint");if(m=zn([...b,...i]),m.some(E=>ya(r.get(E))))return _t("unreadable-input");g="dependency-closure"}let y=m.map(b=>ry(r.get(b)));return{version:1,key:Ne(JSON.stringify({version:1,engineIdentity:e.engineIdentity,schemaVersion:p,projectIdentity:l,inputs:y})),mode:g,inputFiles:m,reasons:f}}}}function ty(e,t){let n=new Set,r=[e];for(let i=0;i<r.length;i+=1){let o=r[i];if(!(o===void 0||n.has(o))){n.add(o);for(let s of[...t.get(o)??[]].sort())n.has(s)||r.push(s)}}return[...n].sort()}function ny(e,t,n){let r=n.get(e);if(r)return r;let i=ty(e,t);return n.set(e,i),i}function ry(e){return{path:e.path,size:e.size,hash:e.hash}}function ya(e){return e.size<0||e.hash==="unreadable"}function _t(e){return{version:1,key:null,mode:"unkeyed",inputFiles:[],reasons:[e]}}function zn(e){return[...new Set(e)].sort()}import{createRequire as iy}from"module";var ha=iy(import.meta.url),zt,qn;function oy(){if(zt!==void 0)return zt;try{zt=ha("ts-morph")}catch{zt=null}return zt}function Kn(){if(qn)return qn;let e=oy();if(!e)return"ts-morph:unavailable";let t="unknown";try{t=ha("ts-morph/package.json").version??"unknown"}catch{}return qn=`ts-morph:${t}:typescript:${e.ts.version}`,qn}function y_(e,t){return t.map(n=>({tsconfigPath:n,project:new e.Project({tsConfigFilePath:n,skipFileDependencyResolution:!0})}))}function h_(e,t,n){return{language:"typescript",availability:()=>({available:!1,reason:e,tsconfigPath:t,tsconfigPaths:n}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}var sy=ye("typescript-semantic-identity-context",{clearGroups:["whole-project"]});function vi(e,t,n){let r=sy.get(e,()=>ay(e));if(!r)return null;let i=`${n}\0${t}`,o=r.identities.get(i);if(o)return o;let s=r.builder.identityFor(t,n);return r.identities.set(i,s),s}function Wt(e){return ee(e,{includeIgnored:!1}).filter(Hn).sort()}function ay(e){try{if(!e.generation.metadataRaw)return null;let t=an(e.generation.metadataRaw);if(t.kind!=="legacy"&&t.kind!=="supported"||!t.capabilities.usableForEvidenceCache)return null;let n=Xi(t.metadata.fingerprint);return n?{builder:Wn({projectFiles:Wt(e),snapshot:n,graph:Mn(e),engineIdentity:Kn()}),identities:new Map}:null}catch{return null}}function Gn(e,t){let n=new Map(e.map(i=>[i.symbol,i])),r=new Map(e.map(i=>[i.symbolId,[]]));for(let i of t.values())for(let o of i){let s=n.get(o.targetSymbol);s&&r.get(s.symbolId).push(o.location)}for(let[i,o]of r)r.set(i,cy(o));return r}function xa(e,t,n){let r=ba(e,t),i=ba(e,n),o=[...r].filter(d=>!i.has(d)).sort(),s=[...i].filter(d=>!r.has(d)).sort(),a=Sa(e,t),c=Sa(e,n),l=[...a].filter(d=>!c.has(d)).sort(),u=[...c].filter(d=>!a.has(d)).sort();return{passed:o.length===0&&s.length===0,expectedCount:r.size,actualCount:i.size,missing:o,extra:s,callerFiles:{passed:l.length===0&&u.length===0,expectedCount:a.size,actualCount:c.size,missing:l,extra:u}}}function Sa(e,t){let n=new Set;for(let r of e)for(let i of t.get(r.symbolId)??[])i.file!==r.relativePath&&n.add(`${r.symbol}\0${i.file}`);return n}function F_(e,t,n){let r=new Set(n),i=new Map(n.map(o=>[o,[]]));for(let o of e)for(let s of t.get(o.symbolId)??[])r.has(s.file)&&i.get(s.file).push({targetSymbol:o.symbol,location:s});for(let[o,s]of i)i.set(o,ly(s));return i}function ba(e,t){let n=new Set;for(let r of e)for(let i of t.get(r.symbolId)??[])n.add(`${r.symbol}\0${i.file}\0${i.line}\0${i.column}`);return n}function cy(e){let t=new Map;for(let n of e)t.set(`${n.file}\0${n.line}\0${n.column}`,n);return[...t.values()].sort(va)}function ly(e){let t=new Map;for(let n of e){let{location:r}=n;t.set(`${n.targetSymbol}\0${r.file}\0${r.line}\0${r.column}`,n)}return[...t.values()].sort((n,r)=>n.targetSymbol.localeCompare(r.targetSymbol)||va(n.location,r.location))}function va(e,t){return e.file.localeCompare(t.file)||e.line-t.line||e.column-t.column}var Ni="typescript-reference-fragment-v3-incomplete-scan",Xn=le({kind:"typescript-reference-fragments",invalidation:X("typescript-reference-fragments"),serialize:e=>JSON.stringify(e),deserialize:dy});function $_(e,t,n,r=e){let i=Wt(e),o=Wn({projectFiles:i,snapshot:t,graph:Mn(e),engineIdentity:Kn()}),s=[...n].map(([a,c])=>({relativePath:a,contentHash:o.identityFor(a,Ni).key,value:[...c]}));if(s.some(a=>a.contentHash===null))throw new Error("TypeScript reference fragment identity is unavailable for an affected document.");return Xn.writeBatch(r,s.map(a=>({...a,contentHash:a.contentHash}))),s.length}function B_(e,t,n,r){let i=t.filter(s=>Hn(s.relativePath));if(i.length===0)return qt("no TypeScript definitions");let o=qt("shadow did not run");return ge("typescript.reference-fragments.shadow",()=>{try{let s=r(i[0].relativePath);if(!s.availability().available||!s.referenceFragmentsForFiles)return o=qt("TypeScript reference fragment provider is unavailable"),o;let a=Wt(e),c=new Set(a),l=s.referenceFragmentsForFiles(a),u=a.filter(m=>!l.has(m));if(u.length>0)return o=qt(`TypeScript reference lookup was incomplete for ${u.length} file(s)`),o;let d=Gn(i,l),p=xa(i,uy(n,c),d);if(!p.passed)return o={state:"failing",files:a.length,keyedFiles:0,writtenFiles:0,...p},o;let f=[];for(let m of a){let g=vi(e,m,Ni);g?.key&&f.push({relativePath:m,contentHash:g.key,value:l.get(m)??[]})}return Xn.writeBatch(e,f),o={state:"passing",files:a.length,keyedFiles:f.length,writtenFiles:f.length,...p},o}catch(s){return o=qt(s instanceof Error?s.message:String(s)),o}},()=>({...o}))}function uy(e,t){return new Map([...e].map(([n,r])=>[n,r.filter(i=>t.has(i.file))]))}function j_(e,t,n){if(t.length===0)return{references:new Map,files:0,cacheHits:0,cacheMisses:0,computedFiles:0};let r="fallback",i=0,o=0,s=0,a=0;return ge("typescript.reference-fragments.materialize",()=>{try{let c=Wt(e);i=c.length;let l=new Map,u=new Map,d=[];for(let m of c){let g=vi(e,m,Ni);if(!g?.key)return null;l.set(m,g.key);let y=Xn.read(e,m,g.key);y===null?(s+=1,d.push(m)):(o+=1,u.set(m,y))}if(s===0)return r="hit",{references:Gn(t,u),files:i,cacheHits:o,cacheMisses:s,computedFiles:a};let p=n(t[0].relativePath);if(!p.availability().available||!p.referenceFragmentsForFiles)return null;let f=p.referenceFragmentsForFiles(d);if(d.some(m=>!f.has(m)))return null;a=f.size,Xn.writeBatch(e,d.map(m=>({relativePath:m,contentHash:l.get(m),value:f.get(m)??[]})));for(let[m,g]of f)u.set(m,g);return r="computed",{references:Gn(t,u),files:i,cacheHits:o,cacheMisses:s,computedFiles:a}}catch{return null}},()=>({state:r,files:i,cacheHits:o,cacheMisses:s,computedFiles:a}))}function qt(e){return{state:"unavailable",files:0,keyedFiles:0,writtenFiles:0,expectedCount:0,actualCount:0,missing:[],extra:[],reason:e}}function dy(e){try{let t=JSON.parse(e);return!Array.isArray(t)||!t.every(py)?null:t}catch{return null}}function py(e){if(!e||typeof e!="object")return!1;let t=e,n=t.location;return typeof t.targetSymbol=="string"&&!!n&&typeof n.file=="string"&&typeof n.line=="number"&&typeof n.column=="number"}import{spawn as yy}from"child_process";import{platform as La}from"os";import{performance as ka}from"perf_hooks";import{execFileSync as Ca}from"child_process";import{platform as fy}from"os";var _a=1e3,Ia=2*1024*1024,my=25;function Ra(e,t,n=wa){let r=n.readIdentity(e),i=new Map;return r&&i.set(e,r),{rootPid:e,rootIdentity:r,ownsProcessGroup:t,knownMembers:i}}async function Fa(e,t,n=wa){if(!e.rootIdentity){let c=await Kt(e,t.gracefulMs+t.forceMs,n);return{reaped:c,reason:c?"terminated":"identity-unavailable",detail:c?void 0:`Could not establish the birth identity of process ${e.rootPid}.`}}let r=Ta(e,n);if(r==="mismatch")return{reaped:!1,reason:"identity-mismatch",detail:`Process ${e.rootPid} no longer has the identity owned by this runner.`};if(r==="exited"&&!Pa(e,n))return{reaped:!0,reason:"terminated"};if(n.platform==="win32"){try{n.terminateWindowsTree(e.rootPid)}catch(l){let u=await Kt(e,t.forceMs,n);return{reaped:u,reason:u?"terminated":"signal-failed",detail:u?void 0:Ei(l)}}let c=await Kt(e,t.forceMs,n);return{reaped:c,reason:c?"terminated":"deadline"}}let i=Na(e,"SIGTERM",n);if(await Kt(e,t.gracefulMs,n))return{reaped:!0,reason:"terminated"};let s=Na(e,"SIGKILL",n);return await Kt(e,t.forceMs,n)?{reaped:!0,reason:"terminated"}:s?{reaped:!1,reason:s.reason,detail:s.detail}:i?{reaped:!1,reason:i.reason,detail:i.detail}:{reaped:!1,reason:"deadline",detail:`Process tree ${e.rootPid} did not exit before its termination deadline.`}}function Ta(e,t){let n=t.readIdentity(e.rootPid);if(!n)return"exited";if(!e.rootIdentity||!sn(e.rootIdentity,n))return"mismatch";e.knownMembers.set(e.rootPid,n);for(let r of t.listDescendantPids(e.rootPid)){let i=t.readIdentity(r);i&&e.knownMembers.set(r,i)}return"owned"}function Na(e,t,n){let r=Ta(e,n);if(r==="mismatch")return{reason:"identity-mismatch",detail:`Process ${e.rootPid} changed identity before ${t}.`};if(r==="owned"&&e.ownsProcessGroup)try{return n.signal(-e.rootPid,t),null}catch(o){if(!Ea(o))return{reason:"signal-failed",detail:Ei(o)}}let i=null;for(let o of e.knownMembers.values()){let s=n.readIdentity(o.pid);if(!(!s||!sn(o,s)))try{n.signal(o.pid,t)}catch(a){!Ea(a)&&i===null&&(i=Ei(a))}}return i===null?null:{reason:"signal-failed",detail:i}}async function Kt(e,t,n){let r=n.now()+t;for(;Pa(e,n);){if(n.now()>=r)return!1;await n.sleep(Math.min(my,Math.max(1,r-n.now())))}return!0}function Pa(e,t){if(!e.rootIdentity&&t.isProcessAlive(e.rootPid))return!0;for(let n of e.knownMembers.values()){let r=t.readIdentity(n.pid);if(r&&sn(n,r))return!0}return!!(e.ownsProcessGroup&&t.isProcessGroupAlive(e.rootPid))}function gy(e){let t=Ca("ps",["-axo","pid=,ppid="],{encoding:"utf8",timeout:_a,maxBuffer:Ia,env:{...process.env,LC_ALL:"C",LANG:"C"},stdio:["ignore","pipe","ignore"],windowsHide:!0}),n=new Map;for(let s of t.split(/\r?\n/)){let a=/^\s*(\d+)\s+(\d+)\s*$/.exec(s);if(!a)continue;let c=Number(a[1]),l=Number(a[2]),u=n.get(l)??[];u.push(c),n.set(l,u)}let r=[],i=[...n.get(e)??[]],o=new Set;for(;i.length>0;){let s=i.pop();o.has(s)||(o.add(s),r.push(s),i.push(...n.get(s)??[]))}return r}function Ea(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ESRCH"}function Ei(e){return e instanceof Error?e.message:String(e)}var wa={platform:fy(),now:Date.now,readIdentity:Wi,isProcessAlive(e){try{return process.kill(e,0),!0}catch(t){return typeof t=="object"&&t!==null&&"code"in t&&t.code==="EPERM"}},isProcessGroupAlive(e){if(this.platform==="win32")return!1;try{return process.kill(-e,0),!0}catch(t){return typeof t=="object"&&t!==null&&"code"in t&&t.code==="EPERM"}},listDescendantPids(e){if(this.platform==="win32")return[];try{return gy(e)}catch{return[]}},signal(e,t){process.kill(e,t)},terminateWindowsTree(e){Ca("taskkill.exe",["/PID",String(e),"/T","/F"],{timeout:_a,maxBuffer:Ia,stdio:"ignore",windowsHide:!0})},async sleep(e){await new Promise(t=>setTimeout(t,e))}};var J_={probe:1e4,git:3e4,analysis:18e4,install:3e5,indexer:6e5},Xt=class extends Error{constructor(n,r,i,o={}){super(i,o.cause===void 0?void 0:{cause:o.cause});this.kind=n;this.label=r;this.name="BoundedProcessError",this.timedOut=o.timedOut??!1,this.reaped=o.reaped??!1,this.stdout=o.stdout??"",this.stderr=o.stderr??"",this.stdoutTruncated=o.stdoutTruncated??!1,this.stderrTruncated=o.stderrTruncated??!1}kind;label;timedOut;reaped;stdout;stderr;stdoutTruncated;stderrTruncated};function Gt(e,t){if(!Number.isFinite(e)||e<=0)throw new TypeError(`${t} must be a positive finite number.`)}function Da(e,t,n,r){let i=Math.max(0,r-n);i>0&&e.push(t.subarray(0,i))}function Aa(e,t,n){let r=Buffer.concat([...e,t]);e.length=0,e.push(r.subarray(Math.max(0,r.length-n)))}function Q_(e){Gt(e.timeoutMs,"timeoutMs"),Gt(e.maxStdoutBytes,"maxStdoutBytes"),Gt(e.maxStderrBytes,"maxStderrBytes");let t=e.terminationGraceMs??1e3;Gt(t,"terminationGraceMs");let n=e.terminationForceMs??t;return Gt(n,"terminationForceMs"),new Promise((r,i)=>{let o=ka.now(),s;try{let h=La()!=="win32";s=yy(e.command,[...e.args??[]],{cwd:e.cwd,env:e.env,detached:h?!0:e.detached,stdio:["pipe","pipe","pipe"],windowsHide:!0})}catch(h){i(new Xt("spawn",e.label,`${e.label} could not start.`,{cause:h,reaped:!0}));return}let a=[],c=[],l=0,u=0,d=!1,p=!1,f=null,m=!1,g=La()!=="win32",y=s.pid===void 0?null:Ra(s.pid,g),S=()=>{clearTimeout(E),e.signal?.removeEventListener("abort",I)},b=h=>{if(m||!f)return;m=!0,S();let C=Buffer.concat(a).toString("utf8"),_=Buffer.concat(c).toString("utf8"),k=h.reaped||!h.detail?"":` Process-tree cleanup failed: ${h.detail}`;i(new Xt(f.kind,e.label,`${f.message}${k}`,{timedOut:f.timedOut,reaped:h.reaped,stdout:C,stderr:_,stdoutTruncated:d,stderrTruncated:p}))},N=h=>{if(!(f||m)){if(f=h,!y){b({reaped:s.pid===void 0,reason:s.pid===void 0?"terminated":"identity-unavailable"});return}Fa(y,{gracefulMs:t,forceMs:n}).then(b,C=>{b({reaped:!1,reason:"signal-failed",detail:C instanceof Error?C.message:String(C)})})}},E=setTimeout(()=>{N({kind:"timeout",timedOut:!0,message:`${e.label} timed out after ${e.timeoutMs}ms.`})},e.timeoutMs);E.unref();let I=()=>{N({kind:"aborted",timedOut:!1,message:`${e.label} was cancelled.`})};e.signal?.addEventListener("abort",I,{once:!0}),e.signal?.aborted&&I(),s.stdout.on("data",h=>{let C=Buffer.isBuffer(h)?h:Buffer.from(h);e.outputLimitBehavior==="truncate-tail"?Aa(a,C,e.maxStdoutBytes):Da(a,C,l,e.maxStdoutBytes),l+=C.length,l>e.maxStdoutBytes&&(d=!0,e.outputLimitBehavior!=="truncate-tail"&&N({kind:"stdout-limit",timedOut:!1,message:`${e.label} exceeded stdout limit (${e.maxStdoutBytes} bytes).`}))}),s.stderr.on("data",h=>{let C=Buffer.isBuffer(h)?h:Buffer.from(h);e.outputLimitBehavior==="truncate-tail"?Aa(c,C,e.maxStderrBytes):Da(c,C,u,e.maxStderrBytes),u+=C.length,u>e.maxStderrBytes&&(p=!0,e.outputLimitBehavior!=="truncate-tail"&&N({kind:"stderr-limit",timedOut:!1,message:`${e.label} exceeded stderr limit (${e.maxStderrBytes} bytes).`}))}),s.on("error",h=>{if(!m&&!f){if(s.pid===void 0){S(),m=!0,i(new Xt("spawn",e.label,`${e.label} could not start: ${h.message}`,{cause:h,reaped:!0}));return}N({kind:"spawn",timedOut:!1,message:`${e.label} failed after start: ${h.message}`})}}),s.on("close",(h,C)=>{if(m||f)return;m=!0,S();let _=Buffer.concat(a).toString("utf8"),k=Buffer.concat(c).toString("utf8");r({status:h,signal:C,stdout:_,stderr:k,timedOut:!1,durationMs:ka.now()-o,stdoutTruncated:d,stderrTruncated:p})}),e.input===void 0?s.stdin.end():s.stdin.end(e.input)})}function Oa(e){let t=D(e);return hy(t)?"test":Sy(t)?"worker":by(t)?"entry":xy(t)?"barrel":"source"}function hy(e){return!!(/\.(?:test|spec)\.[a-z0-9]+$/i.test(e)||/(?:^|\/)(?:_)?test_[^/]+$/i.test(e)||/(?:^|\/)spec_[^/]+$/i.test(e)||/(?:^|\/)[^/]+_test\.[a-z0-9]+$/i.test(e)||/(?:^|\/)[^/]+_tests\.rs$/i.test(e)||/(?:^|\/)tests\.rs$/i.test(e)||/(?:^|\/)[^/]+_spec\.[a-z0-9]+$/i.test(e)||/(?:^|\/)__tests__\//i.test(e)||/(?:^|\/)test\//i.test(e)||/(?:^|\/)tests\//i.test(e)||/(?:^|\/)__fixtures__\//i.test(e)||/(?:^|\/)__mocks__\//i.test(e)||/(?:^|\/)test-support\//i.test(e)||/(?:^|\/)test-utils\//i.test(e)||/(?:^|\/)testing\//i.test(e))}function Sy(e){return/(?:^|\/)[^/]*worker\.(?:ts|tsx|js|mjs|cjs|rs|py|go)$/.test(e)}function by(e){let t=e.split("/"),n=t[t.length-1]??e;return n==="cli.ts"||n==="cli.js"||n==="postinstall.ts"||n==="postinstall.js"||n==="main.ts"||n==="main.js"||n==="main.rs"||n==="main.go"||n==="main.py"||n==="build.rs"||n==="lib.rs"||/\bsrc\/bin\/[^/]+\.rs$/.test(e)||/(?:^|\/)examples\/[^/]+\.rs$/.test(e)||/(?:^|\/)tests\/[^/]+\.rs$/.test(e)||/(?:^|\/)benches\/[^/]+\.rs$/.test(e)?!0:n==="index.ts"||n==="index.js"?/(?:^|\/)(?:apps|services)\/[^/]+\/src\/index\.(?:ts|js)$/.test(e)?!0:t.length<=2:!1}function xy(e){return e==="index.ts"||e==="index.js"||e.endsWith("/index.ts")||e.endsWith("/index.js")||e.endsWith("/mod.rs")||e.endsWith("/__init__.py")}function Jn(e){let t=e.replaceAll("\\","/");return Oa(t)==="test"?/(?:^|\/)__fixtures__\//iu.test(t)?"fixture":"test":/(?:^|\/)(?:fixtures?|testdata)\//iu.test(t)?"fixture":/(?:^|\/)(?:examples?|demos?|previews?)\//iu.test(t)?"example":/(?:^|\/)(?:generated|dist|build|coverage)\//iu.test(t)||/\.generated\./iu.test(t)?"generated":/^(?:scripts?|tools?)\//iu.test(t)?"script":"production"}var vy=4;function nt(e,t,n,r={}){return Ma(e,t,n,r.maxReexportDepth??vy,0,new Set)}function Ma(e,t,n,r,i,o){let s=`${t}\0${n}`;if(o.has(s)||i>r)return[];o.add(s);let a=F(e,t).filter(c=>c.leaf===n);return a.length>0?a:je(e,t).flatMap(c=>c.sourcePath?c.kind==="named"&&!c.names.includes(n)?[]:Ma(e,c.sourcePath,n,r,i+1,new Set(o)):[])}import{createHash as Nc}from"crypto";import{createHash as jy}from"crypto";var Qn=8;function It(e,t,n){return Fi($a(e,t,Ii(n),0,new Set))}function Ri(e,t,n){return Ci(e,t,n,0,new Set)}function $a(e,t,n,r,i){if(r>Qn)return[];let o=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n);return o?Ba(e,t,o[1],o[2],r,i):/^[A-Za-z_$][\w$]*$/u.test(n)?ja(e,t,n,r,i):[]}function Ba(e,t,n,r,i,o){let s=[];for(let a of Ci(e,t,n,i+1,new Set(o))){let c=Iy(a.initializer);for(let l of c.namedChildren){if(l.type==="pair"){let u=l.childForFieldName("key")??l.namedChild(0);if(Ry(u)!==r)continue;let d=l.childForFieldName("value")??l.namedChild(1);d&&s.push(...$a(e,a.definition.relativePath,Ii(d.text),i+1,new Set(o)));continue}if(/(?:method|function)/u.test(l.type)){if((l.childForFieldName("name")??l.namedChild(0))?.text!==r)continue;let d=Cy(e,a.definition.relativePath,r,l);s.push(...d.length>0?d:[Ny(a.definition,r,l)]);continue}if(l.type==="spread_element"){let u=l.namedChild(0);if(!u)continue;for(let d of Ci(e,a.definition.relativePath,Ii(u.text),i+1,new Set(o)))s.push(...Ba(e,d.definition.relativePath,d.definition.leaf,r,i+1,new Set(o)))}}}return Fi(s)}function Ny(e,t,n){return{documentId:e.documentId,symbolId:-1,symbol:`source-callable:${e.relativePath}:${n.startPosition.row}:${t}`,relativePath:e.relativePath,startLine:n.startPosition.row,startChar:n.startPosition.column,endLine:n.endPosition.row,endChar:n.endPosition.column,leaf:t,parentTypeName:e.leaf,isFunctionLike:!0,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:e.symbol}}function Ci(e,t,n,r,i){return r>Qn||!/^[A-Za-z_$][\w$]*$/u.test(n)?[]:ja(e,t,n,r,i).flatMap(o=>{let s=R(e,o.relativePath)?.rootNode,a=s?_y(s,o.leaf):null;return a?[{definition:o,initializer:a}]:[]})}function ja(e,t,n,r,i){if(r>Qn)return[];let o=`${t}\0${n}`;if(i.has(o))return[];i.add(o);let s=F(e,t).filter(l=>l.leaf===n);if(s.length>0)return s;let a=Ey(e,t,n);if(a.length>0)return a;let c=M(e,t).find(l=>l.localName===n&&l.sourcePath);if(c?.sourcePath){let l=c.kind==="namespace"||c.importedName==="default"?n:c.importedName;return _i(e,c.sourcePath,l,r+1,new Set(i))}return _i(e,t,n,r+1,new Set(i))}function Ey(e,t,n){let r=e.get("SELECT id FROM documents WHERE relative_path = ?",t)?.id;return r===void 0?[]:(A(e,t)?.callables??[]).filter(i=>i.name===n).map(i=>({documentId:r,symbolId:-1,symbol:`source-callable:${t}:${i.startLine}:${n}`,relativePath:t,startLine:i.startLine,startChar:0,endLine:i.endLine,endChar:0,leaf:n,parentTypeName:null,isFunctionLike:!0,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null}))}function _i(e,t,n,r,i){if(r>Qn)return[];let o=F(e,t).filter(s=>s.leaf===n);return o.length>0?o:Fi(je(e,t).flatMap(s=>s.sourcePath?s.kind==="named"&&!s.names.includes(n)?[]:_i(e,s.sourcePath,n,r+1,new Set(i)):[]))}function Cy(e,t,n,r){return F(e,t).filter(i=>i.leaf===n&&i.startLine<=r.startPosition.row&&i.endLine>=r.endPosition.row)}function _y(e,t){let n=null;return Va(e,r=>{n||r.type!=="variable_declarator"||(r.childForFieldName("name")??r.namedChild(0))?.text.trim()!==t||(n=r.childForFieldName("value")??r.namedChild(1))}),n}function Iy(e){let t=e;for(;["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(t.type)&&t.namedChildren.length>0;)t=t.namedChildren[0];return t}function Ry(e){return e?.text.replace(/^['"`]|['"`]$/gu,"")??null}function Ii(e){return e.replace(/\s+/gu,"").replace(/^\.\.\./u,"")}function Fi(e){return[...new Map(e.map(t=>[t.symbol,t])).values()]}function Va(e,t){t(e);for(let n of e.namedChildren)Va(n,t)}var Fy=8;function fe(e,t){return t?Rt(e,t,0,new Set):null}function Rt(e,t,n,r){if(n>Fy)return xe(t,"value-evaluation-depth");let i=Ha(t),o=Dy(i);if(o)return Ay(e.file,i,o.term,o.value,o.precision);if(i.type==="binary_expression"&&/\+/u.test(i.text)){let c=i.namedChildren.map(l=>Rt(e,l,n+1,new Set(r)));if(c.length>=2&&c.every(l=>l!==null)){let l={kind:"concat",parts:c.map(d=>d.term)},u=c.map(d=>d.value).join("");return Oy(e.file,i,l,u,c.some(d=>d.precision!=="literal")?"constrained-pattern":"literal",c)}}let s=i.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(s))return Ly(e,s,i,n,r);let a=My(i);return a?ky(e,a.base,a.properties,i,n,r):i.type==="call_expression"||i.type==="call"?Ty(e,i,n,r):xe(i,`unsupported-expression:${i.type}`)}function Ty(e,t,n,r){let o=(t.childForFieldName("function")??t.namedChild(0))?.text.replace(/\s+/gu,"").replace(/<.*>$/u,"")??"",s=Py(e,o);if(s.length!==1)return xe(t,s.length===0?"call-target-unresolved":"call-target-ambiguous");let a=s[0],c=`${a.relativePath}\0${a.symbol}`;if(r.has(c))return xe(t,"call-return-cycle");let l=R(e.db,a.relativePath)?.rootNode;if(!l)return xe(t,"call-target-unparsed");let u=By(l,a.startLine,a.endLine);if(!u)return xe(t,"call-target-syntax-unavailable");let d=wy(u);if(!d)return xe(t,"call-return-not-single-expression");let p=new Set(r);p.add(c);let f=Rt({db:e.db,file:a.relativePath,root:l},d,n+1,p);return f?Zn(t,"bounded-call-return",f,a.symbol):xe(t,"call-return-unresolved")}function Py(e,t){if(/^[A-Za-z_$][\w$]*$/u.test(t)){let i=F(e.db,e.file).filter(s=>s.isFunctionLike&&s.leaf===t);if(i.length>0)return i;let o=M(e.db,e.file).find(s=>s.localName===t&&s.sourcePath&&s.kind!=="namespace");return o?.sourcePath?nt(e.db,o.sourcePath,o.importedName==="default"?t:o.importedName).filter(s=>s.isFunctionLike):[]}let n=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(t);if(!n)return[];let r=M(e.db,e.file).find(i=>i.kind==="namespace"&&i.localName===n[1]&&i.sourcePath);return r?.sourcePath?nt(e.db,r.sourcePath,n[2]).filter(i=>i.isFunctionLike):[]}function wy(e){let t=e.childForFieldName("body");if(e.type==="arrow_function"&&t&&t.type!=="statement_block")return t;let n=[];return Ua(t??e,t??e,n),n.length!==1?null:n[0].childForFieldName("argument")??n[0].namedChild(0)}function Ua(e,t,n){if(!(t!==e&&(/(?:function|method|lambda)/u.test(t.type)||t.type==="arrow_function"))){if(t.type==="return_statement"){n.push(t);return}for(let r of t.namedChildren)Ua(e,r,n)}}function Ly(e,t,n,r,i){let o=`${e.file}\0${t}`;if(i.has(o))return xe(n,"value-cycle");i.add(o);let s=Ti(e.root,t);if(s){let m=Rt(e,s,r+1,i);return m?Zn(n,"local-constant",m):xe(n,"non-foldable-local")}let a=M(e.db,e.file).find(m=>m.localName===t&&m.sourcePath);if(!a?.sourcePath)return pe(n,t,"unresolved-identifier");if(a.kind==="namespace")return pe(n,t,"namespace-import-requires-property");let c=a.importedName==="default"?t:a.importedName,l=nt(e.db,a.sourcePath,c);if(l.length!==1)return pe(n,t,l.length===0?"import-definition-missing":"import-definition-ambiguous");let u=l[0],d=R(e.db,u.relativePath)?.rootNode;if(!d)return pe(n,u.symbol,"import-definition-unparsed");let p=Ti(d,u.leaf);if(!p)return pe(n,u.symbol,"import-definition-non-value");let f=Rt({db:e.db,file:u.relativePath,root:d},p,r+1,i);return f?Zn(n,"imported-constant",f,u.symbol):pe(n,u.symbol,"import-value-unresolved")}function ky(e,t,n,r,i,o){let s=M(e.db,e.file).find(f=>f.localName===t&&f.sourcePath),a=e.file,c=t,l;if(s?.sourcePath){s.kind==="namespace"?(c=n[0]??"",n=n.slice(1)):c=s.importedName==="default"?t:s.importedName;let f=nt(e.db,s.sourcePath,c);if(f.length!==1)return pe(r,`${t}.${n.join(".")}`,f.length===0?"member-definition-missing":"member-definition-ambiguous");a=f[0].relativePath,c=f[0].leaf,l=f[0].symbol}let u=a===e.file?e.root:R(e.db,a)?.rootNode;if(!u)return pe(r,l??t,"member-definition-unparsed");let d=Ti(u,c);if(!d)return pe(r,l??t,"member-base-non-value");for(let f of n){let m=Ha(d);if(d=$y(m,f),!d)return pe(r,l??`${t}.${n.join(".")}`,`member-property-missing:${f}`)}let p=Rt({db:e.db,file:a,root:u},d,i+1,o);return p?Zn(r,"member-constant",p,l):pe(r,l??t,"member-value-unresolved")}function Dy(e){let t=e.text.trim(),n=t[0];if(n!=="'"&&n!=='"'&&n!=="`"||t.at(-1)!==n)return null;let r=t.slice(1,-1);if(n!=="`"||!r.includes("${"))return{term:{kind:"literal",value:r},value:r,precision:"literal"};let i=[],o=0,s=/\$\{([^}]*)\}/gu;for(let a of r.matchAll(s)){let c=a.index??0;c>o&&i.push({kind:"literal",value:r.slice(o,c)}),i.push({kind:"unknown",reason:`template-hole:${a[1]?.trim()||"expression"}`}),o=c+a[0].length}return o<r.length&&i.push({kind:"literal",value:r.slice(o)}),{term:{kind:"pattern",language:"template",value:r.replace(s,"{}")},value:r.replace(s,"{}"),precision:"constrained-pattern"}}function Ay(e,t,n,r,i){return{value:r,evidence:"literal",term:n,precision:i,derivation:Yn("direct-literal","direct",e,t)}}function Oy(e,t,n,r,i,o){return{value:r,evidence:"constant",term:n,precision:i,derivation:{...Yn("constant-concatenation","mechanically-derived",e,t),inputFactIds:o.flatMap(s=>s.derivation.inputFactIds),sourceSpans:o.flatMap(s=>s.derivation.sourceSpans)}}}function Zn(e,t,n,r){return n.evidence==="expression"?{...n,derivation:{kind:"heuristic",rule:t,ruleVersion:"1",inputFactIds:[...n.derivation.inputFactIds,...r?[r]:[]],sourceSpans:n.derivation.sourceSpans}}:{...n,evidence:"constant",derivation:{kind:"mechanically-derived",rule:t,ruleVersion:"1",inputFactIds:[...n.derivation.inputFactIds,...r?[r]:[]],sourceSpans:n.derivation.sourceSpans}}}function pe(e,t,n){return{value:e.text.trim(),evidence:"expression",term:{kind:"symbol",symbol:t},precision:"symbolic",derivation:Yn(n,"heuristic","",e)}}function xe(e,t){return{value:e.text.trim(),evidence:"expression",term:{kind:"unknown",reason:t},precision:"unknown",derivation:Yn(t,"heuristic","",e)}}function Yn(e,t,n,r){return{kind:t,rule:e,ruleVersion:"1",inputFactIds:[],sourceSpans:n?[{file:n,startLine:r.startPosition.row,endLine:r.endPosition.row}]:[]}}function My(e){let t=e.text.replace(/\s+/gu,"");if(!/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/u.test(t))return null;let[n,...r]=t.split(".");return n?{base:n,properties:r}:null}function Ti(e,t){let n=null;return Pi(e,r=>{if(n||r.type!=="variable_declarator"||(r.childForFieldName("name")??r.namedChild(0))?.text.trim()!==t)return;let o=r.parent;!o||o.type!=="lexical_declaration"||!/^\s*(?:export\s+)?const\b/u.test(o.text)||(n=r.childForFieldName("value")??r.namedChild(1))}),n}function $y(e,t){for(let n of e.namedChildren)if(!(n.type!=="pair"||(n.childForFieldName("key")??n.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")!==t))return n.childForFieldName("value")??n.namedChild(1);return null}function Ha(e){let t=e;for(;["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(t.type)&&t.namedChildren.length>0;)t=t.namedChildren[0];return t}function By(e,t,n){let r=null;return Pi(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function Pi(e,t){t(e);for(let n of e.namedChildren)Pi(n,t)}var Ka=new Set(["delete","get","head","options","patch","post","put"]),Vy=/(?:^|\.)(?:app|router|server)$/u,Uy=new Set(["findFirst","findMany","findUnique","from","get","select"]),Hy=new Set(["create","delete","insert","remove","update","upsert"]),zy=new Set(["execute","query","raw"]),ki=[Gy(),Ky(),Wy(),Xy(),Qy(),Zy(),eh()],Li=new Set(["exec","execFile","execFileSync","execSync","fork","spawn","spawnSync"]);function Wy(){return{id:"builtin.node-child-process",supports:e=>/(?:from\s*|require\s*\(\s*)['"](?:node:)?child_process['"]/u.test(e)&&/\b(?:exec|execFile|execFileSync|execSync|fork|spawn|spawnSync)\s*\(/u.test(e),extract:e=>{let t=qy(e.source),n=[];return me(e.root,r=>{if(r.type!=="call_expression")return;let i=Zt(r);if(!i)return;let o=t.direct.get(i),s=/^(.*?)\.([A-Za-z_$][\w$]*)$/u.exec(i),a=s&&t.namespaces.has(s[1])?s[2]:null,c=o??a;if(!c||!Li.has(c))return;let l=rt(r),u=ce(l[0],e)??{value:l[0]?.text.trim()||"<missing>",evidence:"expression"},d=["exec","execFile","execFileSync","execSync"].includes(c)?"process.exec":"process.spawn";n.push(B(e,r,"builtin.node-child-process",d,[{name:"operation",value:c,evidence:"literal"},{name:"executable",...u}],"exact","node-child-process-import"))}),n}}}function qy(e){let t=new Map,n=new Set,r=String.raw`['"](?:node:)?child_process['"]`,i=new RegExp(String.raw`\bimport\s*\{([^}]*)\}\s*from\s*${r}`,"gu");for(let c of e.matchAll(i))for(let l of(c[1]??"").split(",")){let u=/^\s*([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?\s*$/u.exec(l);u&&Li.has(u[1])&&t.set(u[2]??u[1],u[1])}let o=new RegExp(String.raw`\b(?:const|let)\s*\{([^}]*)\}\s*=\s*require\s*\(\s*${r}\s*\)`,"gu");for(let c of e.matchAll(o))for(let l of(c[1]??"").split(",")){let u=/^\s*([A-Za-z_$][\w$]*)(?:\s*:\s*([A-Za-z_$][\w$]*))?\s*$/u.exec(l);u&&Li.has(u[1])&&t.set(u[2]??u[1],u[1])}let s=new RegExp(String.raw`\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*${r}`,"gu");for(let c of e.matchAll(s))n.add(c[1]);let a=new RegExp(String.raw`\b(?:const|let)\s+([A-Za-z_$][\w$]*)\s*=\s*require\s*\(\s*${r}\s*\)`,"gu");for(let c of e.matchAll(a))n.add(c[1]);return{direct:t,namespaces:n}}function j(e,t){let n=R(e,t)?.rootNode;if(!n)return null;let r=x(e,t),i=F(e,t),o=A(e,t)?.callables??[];return{db:e,file:t,source:r,root:n,constants:sh(n),ownerAt:s=>{let a=i.filter(l=>l.startLine<=s&&l.endLine>=s).sort((l,u)=>l.endLine-l.startLine-(u.endLine-u.startLine)||l.startLine-u.startLine)[0];if(a)return{file:t,symbol:a.symbol,name:a.leaf,startLine:a.startLine,endLine:a.endLine};let c=o.filter(l=>l.startLine<=s&&l.endLine>=s).sort((l,u)=>l.endLine-l.startLine-(u.endLine-u.startLine)||l.startLine-u.startLine)[0];return{file:t,symbol:null,name:c?.name??null,startLine:c?.startLine??s,endLine:c?.endLine??s}}}}function Ky(){return{id:"builtin.effect-httpapi",supports:e=>Jt(e,"HttpApiEndpoint").size>0||Jt(e,"HttpApiBuilder").size>0,extract:e=>{let t=[],n=Jt(e.source,"HttpApiEndpoint"),r=Jt(e.source,"HttpApiGroup"),i=Jt(e.source,"HttpApiBuilder");return me(e.root,o=>{if(o.type!=="call_expression")return;let s=Ga(o);if(!s)return;let a=rt(o);if(n.has(s.receiver)&&Ka.has(s.member)){let g=ce(a[0],e),y=ce(a[1],e),S=Wa(o,r,"make",0,e);if(!g||!y||!S)return;let b=s.member.toUpperCase();t.push(B(e,o,"builtin.effect-httpapi","http.handle",[{name:"method",value:b,evidence:"literal"},{name:"path",...y}],ve([{name:"path",...y}]),"effect-httpapi-endpoint-declaration")),t.push(B(e,o,"builtin.effect-httpapi","framework.declare",wi(S,g),ve(wi(S,g)),"effect-httpapi-operation-declaration"));return}if(!["handle","handleRaw"].includes(s.member))return;let c=Wa(o,i,"group",1,e),l=ce(a[0],e),u=a[1];if(!c||!l||!u)return;let d=wi(c,l),p=It(e.db,e.file,u.text),f=B(e,o,"builtin.effect-httpapi","framework.handle",d,p.length===1?ve(d):"candidate","effect-httpapi-handler-registration"),m=p[0];p.length===1&&m&&(f.owner={file:m.relativePath,symbol:m.symbol,name:m.leaf,startLine:m.startLine,endLine:m.endLine}),t.push(f)}),t}}}function wi(e,t){return[{name:"adapter",value:"effect-httpapi",evidence:"literal"},{name:"group",...e},{name:"operation",...t}]}function Jt(e,t){let n=new Set,r=/\bimport\s*\{([\s\S]*?)\}\s*from\s*['"]([^'"]+)['"]/gu;for(let o of e.matchAll(r)){let s=o[2]??"";if(za(s))for(let a of(o[1]??"").split(",")){let c=a.trim().replace(/^type\s+/u,""),l=/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/u.exec(c);l?.[1]===t&&n.add(l[2]??l[1])}}let i=/\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*['"]([^'"]+)['"]/gu;for(let o of e.matchAll(i)){let s=o[2]??"";s.endsWith(`/${t}`)&&za(s)&&n.add(o[1])}return n}function za(e){return e==="effect/unstable/httpapi"||e==="@effect/platform"||e.startsWith("@effect/platform/HttpApi")}function Wa(e,t,n,r,i){let o=e.parent;for(;o;){if(o.type==="call_expression"){let s=qa(o,t,n,r,i);if(s)return s;let a=o.childForFieldName("function")??o.namedChild(0),c=null;if(a&&me(a,l=>{!c&&l.type==="call_expression"&&(c=qa(l,t,n,r,i))}),c)return c}o=o.parent}return null}function qa(e,t,n,r,i){let o=Ga(e);return!o||o.member!==n||!t.has(o.receiver)?null:ce(rt(e)[r],i)}function Ga(e){let t=e.childForFieldName("function")??e.namedChild(0);if(!t||!["member_expression","subscript_expression"].includes(t.type))return null;let n=t.childForFieldName("object")??t.namedChild(0),r=t.childForFieldName("property")??t.childForFieldName("index")??t.namedChild(1);return!n||!r?null:{receiver:n.text.replace(/\s+/gu,""),member:r.text.replace(/^['"`]|['"`]$/gu,"")}}function Gy(){return{id:"builtin.http",supports:e=>/\bfetch\s*\(|\baxios\b|\b(?:app|router|server)\s*\.\s*(?:get|post|put|patch|delete|options|head)\s*\(/u.test(e)||Qt(e,["axios"])||/\b(?:FastAPI|Flask|APIRouter|axum|Router::new)\b/u.test(e),extract:e=>{let t=[];return me(e.root,n=>{if(n.type==="decorator"){let p=/^@[^\s(]+\.(get|post|put|patch|delete|options|head)\s*\(\s*(['"`])([^'"`]+)\2/iu.exec(n.text.trim());if(!p||!Qt(e.source,["fastapi","flask"]))return;t.push(B(e,n,"builtin.http","http.handle",[{name:"method",value:p[1].toUpperCase(),evidence:"literal"},{name:"path",value:p[3],evidence:"literal"}],"exact","framework-decorator"));return}if(n.type!=="call_expression")return;let r=Zt(n);if(!r)return;let i=r.split(".").at(-1)?.toLowerCase()??"",o=r.includes(".")?r.slice(0,r.lastIndexOf(".")):"",s=rt(n);if(i==="route"&&Qt(e.source,["axum"])){let p=ce(s[0],e),f=/^\s*(get|post|put|patch|delete|options|head)\s*\(/iu.exec(s[1]?.text??"")?.[1];if(!p||!f)return;t.push(B(e,n,"builtin.http","http.handle",[{name:"method",value:f.toUpperCase(),evidence:"literal"},{name:"path",...p}],ve([{name:"path",...p}]),"framework-adapter"));return}if(r==="fetch"||r.endsWith(".fetch")){let p=ce(s[0],e);if(!p)return;let m=/\bmethod\s*:\s*['"`]([A-Za-z]+)['"`]/u.exec(s[1]?.text??"")?.[1]?.toUpperCase()??(s[1]?null:"GET"),g=[...m?[{name:"method",value:m,evidence:"literal"}]:[],{name:"path",...p}];t.push(B(e,n,"builtin.http","http.request",g,m?ve(g):"candidate","call-expression"));return}if(!Ka.has(i))return;let a=ce(s[0],e);if(!a)return;let c=i.toUpperCase();if(Vy.test(o)&&Qt(e.source,["express","fastify","hono","koa-router","@koa/router"])){t.push(B(e,n,"builtin.http","http.handle",[{name:"method",value:c,evidence:"literal"},{name:"path",...a}],ve([{name:"path",...a}]),"framework-adapter"));return}let u=rh(e.source,["axios"]),d=o.split(".")[0]??"";u.has(d)&&t.push(B(e,n,"builtin.http","http.request",[{name:"method",value:c,evidence:"literal"},{name:"path",...a}],ve([{name:"path",...a}]),"client-adapter"))}),t}}}function Xy(){return{id:"builtin.capability-registry",supports:e=>/\b(?:execute|handler|invoke|run)\s*(?:[:(])/u.test(e)||/['"`][^'"`\n]{0,256}\b[A-Za-z_$][\w$-]*\s*\(/u.test(e),extract:e=>{let t=[],n=new Set;return me(e.root,r=>{if(r.type==="pair"){let o=r.childForFieldName("key")??r.namedChild(0),s=r.childForFieldName("value")??r.namedChild(1),a=o?.text.replace(/^['"`]|['"`]$/gu,"");if(a!=="name"&&a!=="id")return;let c=Xa(s,e),l=ch(r);if(!c||c.evidence!=="literal"||!l)return;let u=`handle\0${c.value}\0${l.startPosition.row}`;if(n.has(u))return;n.add(u),t.push(B(e,l,"builtin.capability-registry","registry.handle",[{name:"key",...c}],"exact","capability-descriptor"));return}if(!["string","string_literal","template_string"].includes(r.type))return;let i=r.text.replace(/^['"`]|['"`]$/gu,"");for(let o of i.matchAll(/\b([A-Za-z_$][\w$-]*)\s*\(/gu)){let s=o[1];if(!Jy(i,s,o.index))continue;let a=`reference\0${s}\0${r.startPosition.row}`;n.has(a)||(n.add(a),t.push(B(e,r,"builtin.capability-registry","registry.reference",[{name:"key",value:s,evidence:"literal"}],"exact","capability-instruction-reference")))}}),t}}}function Jy(e,t,n){if(t.includes("_")||t.includes("-"))return!0;let r=e.slice(Math.max(0,n-64),n);return/\b(?:use|call|invoke|run|via|with|read|stop)(?:\s+the)?(?:\s+(?:tool|capability|command))?\s*$/iu.test(r)}function Qy(){return{id:"builtin.registry",supports:e=>/(?:Handlers?|Registry|Routes?)\b/iu.test(e),extract:e=>{let t=[];return me(e.root,n=>{if(n.type==="pair"){let o=ah(n);if(!o)return;let s=n.childForFieldName("key")??n.namedChild(0),a=n.childForFieldName("value")??n.namedChild(1),c=Xa(s,e);if(!c||!a||!Ja(a))return;let l=Di(a)?"exact":"candidate";t.push(B(e,n,"builtin.registry","registry.handle",[{name:"registry",value:o,evidence:"identifier"},{name:"key",...c}],ve([{name:"key",...c}],l),"object-member"));return}if(n.type!=="call_expression")return;let r=n.childForFieldName("function")??n.namedChild(0);if(!r)return;let i=/^([A-Za-z_$][\w$]*)\s*\[\s*(['"`])([^'"`]+)\2\s*\]$/u.exec(r.text.trim());i&&t.push(B(e,n,"builtin.registry","registry.dispatch",[{name:"registry",value:i[1],evidence:"identifier"},{name:"key",value:i[3],evidence:"literal"}],"exact","indexed-access-call"))}),t}}}function Zy(){return{id:"builtin.persistence",supports:e=>/\b(?:db|database|prisma|drizzle|[A-Za-z_$][\w$]*(?:Repository|Repo))\b[^;]{0,1024}?\.\s*(?:findFirst|findMany|findUnique|from|get|select|create|delete|insert|remove|update|upsert|execute|query|raw|transaction)(?:\s*<[^()]{1,512}>)?\s*\(/iu.test(e),extract:e=>{let t=[],n=uh(e.root);return me(e.root,r=>{if(r.type!=="call_expression")return;let i=Zt(r);if(!i)return;let o=i.split("."),s=o.at(-1)??"",a=rt(r),c=a[0]?.text??"",l=lh(s,c);if(!l)return;let u=Qa(o,n);if(!u)return;let d=Yy(a[0],e)??dh(c),p=ph(u,o,s,d);if(!p)return;let f=s==="insert"?"persistence-insert":l==="database.read"&&/\bFOR\s+UPDATE\s+SKIP\s+LOCKED\b/iu.test(c)?"persistence-skip-locked-claim":"persistence-adapter";t.push(B(e,r,"builtin.persistence",l,[{name:"resource",...p}],ve([{name:"resource",...p}]),f))}),t}}}function Yy(e,t){if(!e)return null;let n=e.text.replace(/\s+/gu,"");return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/u.test(n)?{value:n.split(".").at(-1),evidence:"identifier",term:{kind:"symbol",symbol:n}}:ce(e,t)}function eh(){return{id:"builtin.queue",supports:e=>Qt(e,["amqplib","bullmq","kafkajs","@aws-sdk/client-sqs","rabbitmq"])&&/\.(?:sendToQueue|consume|send|subscribe)\s*\(/u.test(e),extract:e=>{let t=[];return me(e.root,n=>{if(n.type!=="call_expression")return;let r=Zt(n);if(!r)return;let i=r.split(".").at(-1)??"",o=rt(n),s=i==="sendToQueue"||i==="send"?"queue.send":i==="consume"||i==="subscribe"?"queue.consume":null;if(!s)return;let a=i==="send"||i==="subscribe"?ih(o[0],"topic",e):ce(o[0],e);a&&t.push(B(e,n,"builtin.queue",s,[{name:"address",...a}],ve([{name:"address",...a}]),"framework-adapter"))}),t}}}function B(e,t,n,r,i,o,s){let a=e.ownerAt(t.startPosition.row),c=JSON.stringify({extractor:n,action:r,file:e.file,line:t.startPosition.row,keyParts:i});return{id:`boundary:${jy("sha256").update(c).digest("hex").slice(0,16)}`,extractor:n,action:r,owner:a,source:{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},keyParts:i,evidence:s,strength:o,protocol:r.split(".")[0]??r,role:th(r),executionDomain:nh(e.file),derivation:{kind:o==="candidate"?"heuristic":o==="derived"?"mechanically-derived":"direct",rule:s,ruleVersion:"1",inputFactIds:i.flatMap(l=>l.derivation?.inputFactIds??[]),sourceSpans:[{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},...i.flatMap(l=>l.derivation?.sourceSpans??[])]},valuePrecision:i.some(l=>l.evidence==="expression")?"unknown":i.some(l=>l.evidence==="identifier")?"symbolic":"literal",modality:"may",resolution:"unresolved",sourceScope:Jn(e.file)}}function th(e){let t=e.split(".").at(-1)??e;return["handle","subscribe","consume","read"].includes(t)?"consumer":["request","publish","send","write","dispatch","reference","invoke","spawn","exec"].includes(t)?"producer":"observe"}function nh(e){let t=e.replaceAll("\\","/"),n=/^(apps|services|packages)\/([^/]+)/u.exec(t);return n?`${n[1]}/${n[2]}`:null}function Qt(e,t){return t.some(n=>{let r=n.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`(?:\\bfrom\\s+${r}\\b|\\buse\\s+${r}\\b|(?:\\bfrom\\s*|\\brequire\\s*\\(\\s*)['"]${r}(?:[/']|"))`,"u").test(e)})}function rh(e,t){let n=new Set;for(let r of t){let i=r.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),o=new RegExp(`(?:import\\s+([A-Za-z_$][\\w$]*)[^;]*?\\sfrom\\s*|(?:const|let)\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*require\\s*\\(\\s*)['"]${i}(?:[/']|")`,"gu");for(let s of e.matchAll(o)){let a=s[1]??s[2];a&&n.add(a)}}return n}function er(e,t,n,r,i,o,s){return B(e,t,n,r,i,o,s)}function Zt(e){return(e.childForFieldName("function")??e.namedChild(0))?.text.replace(/\s+/gu,"")??null}function rt(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function ce(e,t){let n=fe(t,e);return n?{value:n.value,evidence:n.evidence,term:n.term,derivation:n.derivation}:null}function ih(e,t,n){if(!e)return null;let r=e.namedChildren.find(o=>o.type!=="pair"?!1:(o.childForFieldName("key")??o.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")===t),i=r?.childForFieldName("value")??r?.namedChild(1);return ce(i,n)}function Xa(e,t){if(!e)return null;let n=ce(e,t);if(n?.evidence==="literal"||n?.evidence==="constant")return n;let r=e.text.trim();return/^[A-Za-z_$][\w$]*$/u.test(r)?{value:r,evidence:"identifier",term:{kind:"symbol",symbol:r}}:n}function ve(e,t="exact"){return t==="candidate"||e.some(n=>n.evidence==="expression")?"candidate":t==="derived"||e.some(n=>n.evidence==="constant")?"derived":"exact"}function oh(e){let t=e.text.trim(),n=t[0];if(n!=="'"&&n!=='"'&&n!=="`"||t.at(-1)!==n)return null;let r=t.slice(1,-1);return n==="`"&&r.includes("${")?null:r}function sh(e){let t=new Map;return me(e,n=>{if(n.type!=="variable_declarator")return;let r=n.childForFieldName("name")??n.namedChild(0),i=n.childForFieldName("value")??n.namedChild(1);if(!r||!i||!/^[A-Za-z_$][\w$]*$/u.test(r.text))return;let o=oh(i);o!==null&&t.set(r.text,o)}),t}function ah(e){let t=e.parent,n=t?.parent??null;for(;n&&["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(n.type);)n=n.parent;if(!t||!n||n.type!=="variable_declarator")return null;let i=(n.childForFieldName("name")??n.namedChild(0))?.text??"";return/(?:handlers?|registry|routes?)$/iu.test(i)?i:null}function Di(e){return/(?:function|lambda|method)/u.test(e.type)||e.type==="arrow_function"}function Ja(e){return Di(e)||e.type==="member_expression"?!0:e.type==="identifier"&&/(?:command|controller|dispatch|handle|handler)/iu.test(e.text)}function ch(e){let t=e.parent;for(;t&&t.type!=="variable_declarator";){if(["object","object_literal","dictionary"].includes(t.type))for(let n of t.namedChildren){if(n.type==="pair"){let i=n.childForFieldName("key")??n.namedChild(0),o=n.childForFieldName("value")??n.namedChild(1),s=i?.text.replace(/^['"`]|['"`]$/gu,"");if(s&&["execute","handler","invoke","run"].includes(s)&&o&&Ja(o))return t}let r=n.childForFieldName("name")??n.namedChild(0);if(r&&["execute","handler","invoke","run"].includes(r.text.replace(/^['"`]|['"`]$/gu,""))&&/(?:function|method)/u.test(n.type))return t}t=t.parent}return null}function Qa(e,t=new Set){let n=e.slice(0,-1).map(r=>r.replace(/\([^)]*\)/gu,""));return n.some(r=>/^(?:prisma|drizzle)$/iu.test(r))?"orm":n.some(r=>/(?:Repository|Repo)$/u.test(r))?"repository":n.some(r=>/^(?:db|database)$/iu.test(r)||t.has(r))?"database":null}function lh(e,t){if(Uy.has(e))return"database.read";if(Hy.has(e))return"database.write";if(!zy.has(e))return null;let n=/\b(SELECT|INSERT|UPDATE|DELETE)\b/iu.exec(t)?.[1]?.toUpperCase();return n==="SELECT"?"database.read":n?"database.write":null}function uh(e){let t=new Set;return me(e,n=>{if(n.type!=="call_expression")return;let r=Zt(n);if(!r)return;let i=r.split(".");if(!(i.at(-1)!=="transaction"||!Qa(i)))for(let o of rt(n)){if(!Di(o))continue;let a=(o.childForFieldName("parameters")??o.namedChildren.find(l=>/parameters/u.test(l.type)))?.namedChildren[0],c=a?Za(a):null;c&&t.add(c)}}),t}function Za(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?Za(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function dh(e){let t=Ya(e);return t?{value:t,evidence:"identifier",term:{kind:"symbol",symbol:t}}:null}function ph(e,t,n,r){if(e==="orm"&&t.length>=3)return{value:t.at(-2).replace(/\([^)]*\)/gu,""),evidence:"identifier"};if(e==="repository"){let o=t.at(-2)?.replace(/(?:Repository|Repo)$/u,"");return o?{value:o,evidence:"identifier"}:null}if(!r)return null;if(n==="from"||n==="insert")return r;let i=Ya(r.value);return i?{value:i,evidence:r.evidence}:null}function Ya(e){return/\b(?:from|into|update|table)\s+(?:\$\{\s*)?['"`]?([A-Za-z_$][\w$.-]*)/iu.exec(e)?.[1]??null}function me(e,t){t(e);for(let n of e.namedChildren)me(n,t)}var fh=v("resolved-call-syntax",{clearGroups:[]}),mh=v("resolved-call-sites",{clearGroups:[]});function Yt(e,t){return mh.get(e,t.symbolId,()=>gh(e,t))}function gh(e,t){let n=[],r=[],i=new Set,o=new Set;for(let s of hi(e,t,{semantic:!1})){i.add(s.file);let a=fh.get(e,s.file,()=>yh(e,s.file));if(!a){r.push({callee:t,file:s.file,line:s.line,reason:"ast-unavailable",candidates:0,referenceProvenance:s.provenance});continue}let c=(a.byLeaf.get(t.leaf)??[]).filter(({callNode:d})=>d.startPosition.row<=s.line&&d.endPosition.row>=s.line);if(c.length!==1){r.push({callee:t,file:s.file,line:s.line,reason:c.length===0?"call-not-found":"ambiguous-call",candidates:c.length,referenceProvenance:s.provenance});continue}let l=c[0],u=`${s.file}\0${l.callNode.startIndex}\0${l.callNode.endIndex}`;o.has(u)||(o.add(u),n.push({callee:t,caller:Nt(F(e,s.file),l.callNode.startPosition.row),file:s.file,line:s.line,startLine:l.callNode.startPosition.row,endLine:l.callNode.endPosition.row,targetText:l.targetNode.text,callNode:l.callNode,targetNode:l.targetNode,arguments:l.arguments,referenceProvenance:s.provenance}))}return{sites:n,unresolved:r,filesVisited:i.size}}function yh(e,t){let n=R(e,t)?.rootNode;if(!n)return null;let r=new Map;return ec(n,i=>{if(i.type!=="call_expression"&&i.type!=="call")return;let o=i.childForFieldName("function")??i.namedChild(0);if(!o)return;let s=_e(o);if(!s)return;let a=i.childForFieldName("arguments")??i.namedChildren.find(u=>u.type==="arguments"),c={callNode:i,targetNode:o,arguments:a?.namedChildren??[]},l=r.get(s);l?l.push(c):r.set(s,[c])}),{byLeaf:r}}function ec(e,t){t(e);for(let n of e.namedChildren)ec(n,t)}var hh=v("call-parameter-value-flow",{clearGroups:[]});function en(e,t){let n=`${t.callee.symbolId}\0${t.file}\0${t.callNode.startIndex}\0${t.callNode.endIndex}`;return hh.get(e,n,()=>Sh(e,t))}function tn(e,t){let n=new Set(t);return[...new Set(e.transfers.flatMap(r=>n.has(r.calleePosition)?[r.callerPosition]:[]))].sort((r,i)=>r-i)}function Sh(e,t){let n={file:t.file,startLine:t.startLine,endLine:t.endLine};if(!t.caller)return{callee:t.callee,caller:null,call:n,transfers:[],unknown:t.arguments.map((c,l)=>({calleePosition:l,argumentText:c.text.trim(),reason:"caller-unavailable",proof:n}))};let r=R(e,t.caller.relativePath)?.rootNode,i=r?bh(r,t.caller.startLine,t.caller.endLine):null;if(!i)return{callee:t.callee,caller:t.caller,call:n,transfers:[],unknown:t.arguments.map((c,l)=>({calleePosition:l,argumentText:c.text.trim(),reason:"caller-syntax-unavailable",proof:n}))};let o=xh(i),s=[],a=[];return t.arguments.forEach((c,l)=>{let u=c.text.trim(),d=o.indexOf(u);d>=0?s.push({calleePosition:l,callerPosition:d,argumentText:u,proof:n}):a.push({calleePosition:l,argumentText:u,reason:"argument-not-direct-parameter",proof:n})}),{callee:t.callee,caller:t.caller,call:n,transfers:s,unknown:a}}function bh(e,t,n){let r=null;return nc(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function xh(e){return(e.childForFieldName("parameters")??e.namedChildren.find(n=>/parameters/u.test(n.type)))?.namedChildren.map(tc)??[]}function tc(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?tc(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function nc(e,t){t(e);for(let n of e.namedChildren)nc(n,t)}var vh=8,Nh=8;function ic(e,t){let n=[],r=Eh(e,n),i=r.summaries,o=Ch(e,t,i,n),s=_h(e,t,n);return{observations:Oh([...o.observations,...s]),bodySummaries:i.size,discriminatorSummaries:o.summaries,filesInspected:r.filesInspected,errors:n}}function Eh(e,t){let n=new Map,r=[],i=z(e);for(let o of i){let s=x(e,o);if(!/\bJSON\.stringify\s*\(/u.test(s)||!/\bbody\s*:/u.test(s))continue;let a=j(e,o);if(a)for(let[c,l]of Ih(a)){let u={definition:c,parameterIndexes:l,depth:0,proofSpans:[{file:o,startLine:c.startLine,endLine:c.endLine}]};n.set(c.symbol,u),r.push(u)}}for(;r.length>0;){let o=r.shift();if(!(o.depth>=vh))try{for(let s of Yt(e,o.definition).sites){if(!j(e,s.file))continue;let c=s.caller;if(!c)continue;let l=tn(en(e,s),o.parameterIndexes);if(l.length===0)continue;let u={definition:c,parameterIndexes:dc(l),depth:o.depth+1,proofSpans:[...o.proofSpans,{file:s.file,startLine:s.startLine,endLine:s.endLine}]};Ph(n,u)&&r.push(n.get(c.symbol))}}catch(s){t.push(`builtin.carrier body summary failed for ${o.definition.relativePath}: ${$i(s)}`)}}return{summaries:n,filesInspected:i.length}}function Ch(e,t,n,r){let i=new Map,o=[],s=[];for(let a of t){if(a.action!=="http.request"||a.strength==="candidate"||a.sourceScope!=="production")continue;let c=oc(a);if(!c)continue;let l=j(e,a.source.file);if(!l)continue;let u=cc(l.root,a.source.startLine),d=u.find(b=>b.startPosition.row===a.source.startLine)??u[0];if(!d)continue;let p=Mi(d);if(!p)continue;let f=It(e,a.source.file,p.text);if(f.length!==1)continue;let m=n.get(f[0].symbol);if(!m)continue;let g=a.owner.symbol?F(e,a.owner.file).find(b=>b.symbol===a.owner.symbol):null;if(!g)continue;let y=wh(l,g),S=nr(d);for(let b of m.parameterIndexes){let N=kh(l,S[b]);if(N)for(let E of Dh(N)){let I=lc(E),h=uc(E);if(!I||!h)continue;let C=y.indexOf(h.text.trim());if(C>=0){let k={definition:g,carrier:c,field:I,parameterIndex:C,depth:0,proofObservationIds:[a.id],proofSpans:[a.source,{file:a.source.file,startLine:E.startPosition.row,endLine:E.endPosition.row}]},$=rc(k);i.has($)||(i.set($,k),o.push(k));continue}let _=fe(l,h);!_||_.evidence==="expression"||s.push(Oi(l,E,"carrier.publish",c,I,_.value,[a.id]))}}}for(;o.length>0;){let a=o.shift();if(!(a.depth>=Nh))try{for(let c of Yt(e,a.definition).sites){let l=j(e,c.file);if(!l)continue;let u=c.callNode,d=nr(u)[a.parameterIndex];if(!d)continue;let p=fe(l,d);p&&p.evidence!=="expression"&&s.push(Oi(l,u,"carrier.publish",a.carrier,a.field,p.value,a.proofObservationIds));let f=c.caller;if(!f)continue;let m=en(e,c).transfers.find(S=>S.calleePosition===a.parameterIndex)?.callerPosition;if(m===void 0)continue;let g={...a,definition:f,parameterIndex:m,depth:a.depth+1,proofSpans:[...a.proofSpans,{file:c.file,startLine:c.startLine,endLine:c.endLine}]},y=rc(g);i.has(y)||(i.set(y,g),o.push(g))}}catch(c){r.push(`builtin.carrier discriminator summary failed for ${a.definition.relativePath}: ${$i(c)}`)}}return{observations:s,summaries:i.size}}function _h(e,t,n){let r=[],i=t.filter(o=>o.action==="registry.handle"&&o.strength!=="candidate"&&o.sourceScope==="production");for(let o of t){if(o.action!=="http.handle"||o.strength==="candidate"||o.sourceScope!=="production")continue;let s=oc(o);if(!s)continue;let a=j(e,o.source.file);if(!a)continue;let c=cc(a.root,o.source.startLine)[0];if(c)for(let l of nr(c).slice(1)){let u=It(e,o.source.file,l.text);for(let d of u)try{let p=j(e,d.relativePath);if(!p)continue;let f=tr(p.root,d.startLine,d.endLine);if(!f)continue;He(f,m=>{if(m.type!=="call_expression")return;let g=Mi(m);if(!g)return;let y=/^([A-Za-z_$][\w$]*)\s*\[\s*([A-Za-z_$][\w$]*)\s*\]$/u.exec(g.text.trim());if(!y)return;let S=y[1],b=y[2],N=Fh(e,p,d,b);if(!N)return;let E=Th(e,d.relativePath,S);for(let I of i){let h=I.keyParts.find($=>$.name==="registry")?.value,C=I.keyParts.find($=>$.name==="key")?.value;if(!h||!C||!E.some($=>$.file===I.source.file&&$.binding===h))continue;let _=j(e,I.source.file),k=_?Lh(_.root,I.source.startLine):null;!_||!k||r.push(Oi(_,k,"carrier.consume",s,N,C,[o.id,I.id]))}})}catch(p){n.push(`builtin.carrier consumer analysis failed for ${d.relativePath}: ${$i(p)}`)}}}return r}function Ih(e){let t=F(e.db,e.file),n=new Map;return He(e.root,r=>{if(r.type!=="pair"||lc(r)?.toLowerCase()!=="body")return;let i=uc(r);if(!i||!/\bJSON\.stringify\s*\(/u.test(i.text))return;let o=Nt(t,r.startPosition.row),s=Rh(r);if(!o||!s)return;let a=sc(s),c=new Set;Ah(i,a,c);let l=n.get(o.symbol)??new Set;a.forEach((u,d)=>{u&&c.has(u)&&l.add(d)}),l.size>0&&n.set(o.symbol,l)}),t.flatMap(r=>{let i=n.get(r.symbol);return i?[[r,[...i].sort((o,s)=>o-s)]]:[]})}function Rh(e){let t=e.parent;for(;t;){if(/(?:function|method|lambda)/u.test(t.type)||t.type==="arrow_function")return t;t=t.parent}return null}function Fh(e,t,n,r){let i=tr(t.root,n.startLine,n.endLine);if(!i)return null;let o=new RegExp(`\\.body\\??\\.${Ai(r)}\\b`,"u");if(o.test(i.text))return r;let s=null;if(He(i,u=>{if(s||u.type!=="variable_declarator")return;let d=u.childForFieldName("name")??u.namedChild(0),p=u.childForFieldName("value")??u.namedChild(1);!d||!p||!new RegExp(`(?:^|[,{}])\\s*${Ai(r)}\\s*(?:[,}]|$)`,"u").test(d.text)||p.type==="call_expression"&&(s=Mi(p)?.text??null)}),!s)return null;let a=It(e,n.relativePath,s);if(a.length!==1)return null;let c=j(e,a[0].relativePath),l=c?tr(c.root,a[0].startLine,a[0].endLine):null;return l&&o.test(l.text)&&new RegExp(`\\b${Ai(r)}\\s*[,}]`,"u").test(l.text)?r:null}function Th(e,t,n){let r=[];for(let i of Ri(e,t,n)){let o=nn(i.initializer);if(o.type==="call_expression")for(let s of nr(o)){let a=s.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(a))for(let c of Ri(e,i.definition.relativePath,a))r.push({file:c.definition.relativePath,binding:c.definition.leaf})}}return[...new Map(r.map(i=>[`${i.file}\0${i.binding}`,i])).values()]}function Oi(e,t,n,r,i,o,s){let c=er(e,t,"builtin.carrier",n,[{name:"carrier",value:r,evidence:"constant",term:{kind:"literal",value:r}},{name:"field",value:i,evidence:"literal",term:{kind:"literal",value:i}},{name:"value",value:o,evidence:"constant",term:{kind:"literal",value:o}}],"derived","http-body-registry-discriminator");return c.derivation={kind:"mechanically-derived",rule:"http-body-registry-discriminator",ruleVersion:"1",inputFactIds:[...s],sourceSpans:[c.source]},c}function oc(e){let t=e.keyParts.find(r=>r.name==="method"&&r.evidence!=="expression")?.value,n=e.keyParts.find(r=>r.name==="path"&&r.evidence!=="expression")?.value;return t&&n?`${t.toUpperCase()} ${n}`:null}function Ph(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=dc([...n.parameterIndexes,...t.parameterIndexes]);return r.length===n.parameterIndexes.length&&t.depth>=n.depth?!1:(e.set(t.definition.symbol,{...n,parameterIndexes:r,depth:Math.min(n.depth,t.depth),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0)}function rc(e){return`${e.definition.symbol}\0${e.carrier}\0${e.field}\0${e.parameterIndex}`}function wh(e,t){let n=tr(e.root,t.startLine,t.endLine);return n?sc(n):[]}function sc(e){return(e.childForFieldName("parameters")??e.namedChildren.find(n=>/parameters/u.test(n.type)))?.namedChildren.map(ac)??[]}function ac(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?ac(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function tr(e,t,n){let r=null;return He(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function Lh(e,t){let n=null;return He(e,r=>{r.startPosition.row>t||r.endPosition.row<t||(!n||r.endIndex-r.startIndex<n.endIndex-n.startIndex)&&(n=r)}),n}function cc(e,t){let n=[];return He(e,r=>{r.type==="call_expression"&&r.startPosition.row<=t&&r.endPosition.row>=t&&n.push(r)}),n.sort((r,i)=>r.endIndex-r.startIndex-(i.endIndex-i.startIndex))}function Mi(e){return e.childForFieldName("function")??e.namedChild(0)}function nr(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function kh(e,t){if(!t)return null;let n=t.text.trim();if(!/^[A-Za-z_$][\w$]*$/u.test(n))return nn(t);let r=null;return He(e.root,i=>{r||i.type!=="variable_declarator"||(i.childForFieldName("name")??i.namedChild(0))?.text.trim()!==n||(r=i.childForFieldName("value")??i.namedChild(1))}),nn(r||t)}function Dh(e){let t=nn(e);return t.type==="object"?t.namedChildren.filter(n=>n.type==="pair"||n.type==="shorthand_property_identifier"):[]}function lc(e){return e.type==="shorthand_property_identifier"?e.text:(e.childForFieldName("key")??e.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")??null}function uc(e){return e.type==="shorthand_property_identifier"?e:e.childForFieldName("value")??e.namedChild(1)}function nn(e){let t=e;for(;["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(t.type)&&t.namedChildren.length>0;)t=t.namedChildren[0];return t}function Ah(e,t,n){let r=new Set(e.text.match(/[A-Za-z_$][\w$]*/gu)??[]);for(let i of t)i&&r.has(i)&&n.add(i)}function dc(e){return[...new Set(e)].sort((t,n)=>t-n)}function Oh(e){return[...new Map(e.map(t=>[t.id,t])).values()]}function Ai(e){return e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}function $i(e){return e instanceof Error?e.message:String(e)}function He(e,t){t(e);for(let n of e.namedChildren)He(n,t)}import{createHash as Mh}from"crypto";function pc(e,t){let n=new Map;for(let o of t){if(o.action!=="http.handle"||o.sourceScope!=="production")continue;let s=n.get(o.source.file)??[];s.push(o),n.set(o.source.file,s)}let r=[],i=$h(e);for(let o of i.mounts)for(let s of o.targetFiles)for(let a of n.get(s)??[]){let c=a.keyParts.find(p=>p.name==="path");if(!c||c.evidence==="expression")continue;let l=jh(o.prefix.value,c.value),u=a.keyParts.map(p=>p.name==="path"?{name:"path",value:l,evidence:"constant",term:{kind:"concat",parts:[o.prefix.term??{kind:"literal",value:o.prefix.value},c.term??{kind:"literal",value:c.value}]},derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[a.id],sourceSpans:[a.source,{file:o.file,startLine:o.line,endLine:o.line},...o.prefix.derivation?.sourceSpans??[],...c.derivation?.sourceSpans??[]]}}:p),d=`${a.id}\0${o.file}\0${o.line}\0${l}`;r.push({...a,id:`boundary:${Mh("sha256").update(d).digest("hex").slice(0,16)}`,keyParts:u,strength:"derived",evidence:"framework-mount-composition",derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[a.id],sourceSpans:[a.source,{file:o.file,startLine:o.line,endLine:o.line}]},resolution:"unresolved"}),a.strength="candidate",a.resolution="unresolved"}return{observations:r,filesInspected:i.filesInspected,mounts:i.mounts.length}}function $h(e){let t=[],n=z(e);for(let r of n){let i=x(e,r);if(!Vh(i))continue;let o=j(e,r);o&&fc(o.root,s=>{if(s.type!=="call_expression")return;let a=s.childForFieldName("function")??s.namedChild(0);if(!a||!/\.use$/u.test(a.text.replace(/\s+/gu,"")))return;let c=Uh(s);if(c.length<2)return;let l=fe(o,c[0]);if(!l||l.evidence==="expression")return;let u=Bh(e,r,c[1]);u.length!==0&&t.push({file:r,line:s.startPosition.row,prefix:{value:l.value,evidence:l.evidence,term:l.term,derivation:l.derivation},targetFiles:u})})}return{mounts:t,filesInspected:n.length}}function Bh(e,t,n){let r=n.text.replace(/\s+/gu,""),i=/^([A-Za-z_$][\w$]*)/u.exec(r)?.[1];if(!i)return[];let o=M(e,t).find(c=>c.localName===i&&c.sourcePath);if(!o?.sourcePath)return[t];if(o.kind==="namespace")return[o.sourcePath];let s=o.importedName==="default"?i:o.importedName,a=nt(e,o.sourcePath,s);return[...new Set(a.map(c=>c.relativePath))]}function jh(e,t){let n=e==="/"?"":e.replace(/\/+$/u,""),r=t.startsWith("/")?t:`/${t}`;return`${n}${r}`||"/"}function Vh(e){return/(?:\bfrom\s*|\brequire\s*\(\s*)['"](?:express|fastify|hono|koa-router|@koa\/router)(?:[/']|")/u.test(e)}function Uh(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function fc(e,t){t(e);for(let n of e.namedChildren)fc(n,t)}import{createHash as Hh}from"crypto";var Bi=new Set(["DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT"]),zh=8;function yc(e,t){let n=new Map,r=[],i=[],o=new Set,s=[],a=[];for(let c of t){if(c.action!=="http.request"||!c.owner.symbol||c.evidence!=="call-expression"&&c.evidence!=="client-adapter")continue;let l=F(e,c.owner.file).find(f=>f.symbol===c.owner.symbol);if(!l)continue;let u=j(e,l.relativePath);if(!u)continue;let d=mc(u,l),p={definition:l,...d,constantMethods:c.keyParts.flatMap(f=>f.name==="method"&&f.evidence!=="expression"&&Bi.has(f.value.toUpperCase())?[f.value.toUpperCase()]:[]),depth:0,proofObservationIds:[c.id],proofSpans:[c.source]};gc(n,p)&&r.push(n.get(l.symbol))}for(;r.length>0;){let c=r.shift();if(!(c.depth>=zh))try{let l=Yt(e,c.definition);a.push(...l.unresolved.map(u=>Wh(c,u)));for(let u of l.sites){let d=j(e,u.file);if(!d)continue;o.add(u.file);let p=u.callNode,f=Kh(c,p,d);f&&i.push(f);let m=u.caller;if(!m)continue;let g=mc(d,m),y=Gh(e,c,u),S={definition:m,pathParameterIndexes:rr([...g.pathParameterIndexes,...y.pathParameterIndexes]),methodParameterIndexes:rr([...g.methodParameterIndexes,...y.methodParameterIndexes]),constantMethods:Ft([...c.constantMethods,...g.constantMethods]),depth:c.depth+1,proofObservationIds:Ft([...c.proofObservationIds,...f?[f.id]:[]]),proofSpans:[...c.proofSpans,{file:u.file,startLine:u.startLine,endLine:u.endLine}]};gc(n,S)&&r.push(n.get(m.symbol))}}catch(l){s.push(`builtin.http-summary failed for ${c.definition.relativePath}:${c.definition.startLine+1}: ${l instanceof Error?l.message:String(l)}`)}}return{observations:i,frontiers:qh(a),summaries:n.size,filesInspected:o.size,errors:s}}function Wh(e,t){let n=Ft([...e.pathParameterIndexes.length>0?["path"]:[],...e.methodParameterIndexes.length>0&&e.constantMethods.length!==1?["method"]:[]]),r=e.constantMethods.length===1?e.constantMethods[0]:"?",i=`${e.definition.symbol}\0${t.file}\0${t.line}\0${t.reason}`;return{observationId:`frontier:${Hh("sha256").update(i).digest("hex").slice(0,16)}`,kind:"call-resolution",action:"http.request",strength:"candidate",source:{file:t.file,startLine:t.line,endLine:t.line},ownerShortName:null,address:`method=${r??"?"} path=?`,reason:`Compiler identity found a reference to ${e.definition.leaf}, but exact call recovery stopped with ${t.reason} (${t.candidates} syntax candidate(s)); HTTP value propagation did not cross this site.`,missingKeyParts:n.length>0?n:["call"],sourceScope:Jn(t.file)}}function qh(e){return[...new Map(e.map(t=>[t.observationId,t])).values()].sort((t,n)=>t.observationId.localeCompare(n.observationId))}function Kh(e,t,n){let r=Sc(t),i=e.pathParameterIndexes.flatMap(d=>{let p=fe(n,r[d]);return p&&p.evidence!=="expression"&&Zh(p.value)?[{index:d,value:p}]:[]}),o=e.methodParameterIndexes.flatMap(d=>{let p=fe(n,r[d]),f=p?.value.toUpperCase();return p&&f&&p.evidence!=="expression"&&Bi.has(f)?[{index:d,value:{...p,value:f}}]:[]}),s=Ft([...e.constantMethods,...o.map(d=>d.value.value)]);if(i.length!==1||s.length!==1)return null;let a=i[0].value,c=o.find(d=>d.value.value===s[0])?.value,l=[{name:"method",value:s[0],evidence:c?"constant":"literal",term:c?.term??{kind:"literal",value:s[0]},derivation:c?.derivation},{name:"path",value:a.value,evidence:"constant",term:a.term,derivation:a.derivation}],u=er(n,t,"builtin.http-summary","http.request",l,"derived","compiler-resolved-http-summary");return u.derivation={kind:"mechanically-derived",rule:"compiler-resolved-http-summary",ruleVersion:"1",inputFactIds:e.proofObservationIds,sourceSpans:[...e.proofSpans,u.source]},u}function mc(e,t){let n=Qh(e.root,t.startLine,t.endLine);if(!n)return{pathParameterIndexes:[],methodParameterIndexes:[],constantMethods:[]};let r=Jh(n),i=new Set,o=new Set,s=new Set;return ji(n,a=>{if(a.type==="call_expression"&&((a.childForFieldName("function")??a.namedChild(0))?.text.replace(/\s+/gu,"").split(".").at(-1)??"")==="fetch"){let f=Sc(a);rn(f[0],r,i);let m=Xh(f[1],"method");if(m){rn(m,r,o);let g=fe(e,m),y=g?.value.toUpperCase();y&&g?.evidence!=="expression"&&Bi.has(y)&&s.add(y)}else rn(f[1],r,o)}if(a.type!=="pair")return;let c=a.childForFieldName("key")??a.namedChild(0),l=a.childForFieldName("value")??a.namedChild(1),u=c?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase();(u==="url"||u==="path"||u==="endpoint")&&rn(l,r,i),(u==="init"||u==="requestinit"||u==="options")&&rn(l,r,o)}),{pathParameterIndexes:r.flatMap((a,c)=>a&&i.has(a)?[c]:[]),methodParameterIndexes:r.flatMap((a,c)=>a&&o.has(a)?[c]:[]),constantMethods:[...s].sort()}}function Gh(e,t,n){let r=en(e,n);return{pathParameterIndexes:tn(r,t.pathParameterIndexes),methodParameterIndexes:tn(r,t.methodParameterIndexes)}}function gc(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=rr([...n.pathParameterIndexes,...t.pathParameterIndexes]),i=rr([...n.methodParameterIndexes,...t.methodParameterIndexes]),o=Ft([...n.constantMethods,...t.constantMethods]);return r.length!==n.pathParameterIndexes.length||i.length!==n.methodParameterIndexes.length||o.length!==n.constantMethods.length||t.depth<n.depth?(e.set(t.definition.symbol,{...n,pathParameterIndexes:r,methodParameterIndexes:i,constantMethods:o,depth:Math.min(n.depth,t.depth),proofObservationIds:Ft([...n.proofObservationIds,...t.proofObservationIds]),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0):!1}function Xh(e,t){if(!e)return null;for(let n of e.namedChildren)if(!(n.type!=="pair"||(n.childForFieldName("key")??n.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase()!==t))return n.childForFieldName("value")??n.namedChild(1);return null}function rn(e,t,n){if(!e)return;let r=new Set(e.text.match(/[A-Za-z_$][\w$]*/gu)??[]);for(let i of t)i&&r.has(i)&&n.add(i)}function Jh(e){return(e.childForFieldName("parameters")??e.namedChildren.find(n=>/parameters/u.test(n.type)))?.namedChildren.map(hc)??[]}function hc(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?hc(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function Qh(e,t,n){let r=null;return ji(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function Sc(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Zh(e){return e.startsWith("/")||/^https?:\/\//iu.test(e)}function rr(e){return[...new Set(e)].sort((t,n)=>t-n)}function Ft(e){return[...new Set(e)].sort()}function ji(e,t){t(e);for(let n of e.namedChildren)ji(n,t)}import{createHash as Yh}from"crypto";function vc(e){let t=bc(e.filter(r=>r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim")),n=bc(e.filter(r=>r.action==="database.write"&&r.evidence==="persistence-insert"));return e.flatMap(r=>r.action==="database.write"&&r.evidence==="persistence-insert"?Vi(r).flatMap(i=>{let o=t.get(i)?.[0];return o?[xc(r,o,i,"queue.send")]:[]}):r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim"?Vi(r).flatMap(i=>{let o=n.get(i)?.[0];return o?[xc(r,o,i,"queue.consume")]:[]}):[])}function bc(e){let t=new Map;for(let n of e)for(let r of Vi(n)){let i=t.get(r);i?i.push(n):t.set(r,[n])}for(let n of t.values())n.sort((r,i)=>r.id.localeCompare(i.id));return t}function Vi(e){return e.keyParts.filter(t=>t.name==="resource").map(t=>t.value)}function xc(e,t,n,r){let i=`database:${n}`,o=r==="queue.send"?"database-queue-insert":"database-queue-skip-locked-claim",s=[e.id,r,i,o].join("\0");return{...e,id:`boundary:${Yh("sha256").update(s).digest("hex").slice(0,16)}`,extractor:"builtin.database-queue",action:r,keyParts:[{name:"address",value:i,evidence:"identifier",term:{kind:"symbol",symbol:n},derivation:{kind:"mechanically-derived",rule:"database-work-queue.resource",ruleVersion:"1",inputFactIds:[e.id,t.id],sourceSpans:[e.source,t.source]}}],evidence:o,strength:"derived",protocol:"queue",role:r==="queue.send"?"producer":"consumer",derivation:{kind:"mechanically-derived",rule:"database-work-queue.insert-skip-locked",ruleVersion:"1",inputFactIds:[e.id,t.id],sourceSpans:[e.source,t.source]},valuePrecision:"symbolic",resolution:"unresolved"}}var Ui="runtime-boundaries-v15",sr=[{id:"http.method-path",protocol:"http",producerActions:["http.request"],consumerActions:["http.handle"],keyNames:["method","path"],traversable:!0},{id:"registry.identity-key",protocol:"registry",producerActions:["registry.dispatch"],consumerActions:["registry.handle"],keyNames:["registry","key"],traversable:!0},{id:"registry.capability-key",protocol:"registry",producerActions:["registry.reference"],consumerActions:["registry.handle"],keyNames:["key"],traversable:!0,requireUniqueConsumer:!0},{id:"queue.address",protocol:"queue",producerActions:["queue.send"],consumerActions:["queue.consume"],keyNames:["address"],traversable:!0},{id:"carrier.discriminator",protocol:"carrier",producerActions:["carrier.publish"],consumerActions:["carrier.consume"],keyNames:["carrier","field","value"],traversable:!0},{id:"resource.identity",protocol:"database",producerActions:["database.write"],consumerActions:["database.read"],keyNames:["resource"],traversable:!1},{id:"framework.effect-httpapi-operation",protocol:"framework",producerActions:[],consumerActions:["framework.handle"],declarationActions:["framework.declare"],keyNames:["adapter","group","operation"],traversable:!0,linkFrom:"declaration",requireUniquePair:!0}],eS=64;function tS(e,t={}){let n=z(e),r=new Set(n),i=new Set((t.affectedFiles??[]).map(oS)),o=t.previousGraph?.fileCoverage,s=i.size>0&&t.previousGraph?.extractorVersion===Ui&&o!==void 0&&o.length===t.previousGraph.coverage.filesScanned,a=s?o.filter(P=>r.has(P.file)&&!i.has(P.file)):[],c=new Set(a.flatMap(P=>P.observationIds)),l=s?t.previousGraph.observations.filter(P=>c.has(P.id)&&r.has(P.source.file)):[],u=s?n.filter(P=>i.has(P)):n,d=[],p=o?.reduce((P,dr)=>P+dr.observationIds.length,0)??0,f=performance.now(),m=nS(e,u);it(d,"direct-extraction",f,u.length,m.observations.length,{filesVisited:u.length,filesReused:a.length,factsReused:l.length,factsInvalidated:Math.max(0,p-l.length)});let g=[...a,...m.fileCoverage].sort((P,dr)=>P.file.localeCompare(dr.file)),y=iS(g),S=g.flatMap(P=>P.extractionErrors),b=on([...l,...m.observations]),N=on([...b,...vc(b)]);f=performance.now();let E=yc(e,N);it(d,"http-summary",f,N.length,E.observations.length,{filesVisited:E.filesInspected}),y.set("builtin.wrapper",{id:"builtin.wrapper",applicableFiles:E.filesInspected,observations:E.observations.length,errors:E.errors.length}),S.push(...E.errors);let I=on([...N,...E.observations]);f=performance.now();let h=pc(e,I);it(d,"http-mount",f,I.length,h.observations.length,{filesVisited:h.filesInspected});let C=on([...I,...h.observations]);f=performance.now();let _=ic(e,C);it(d,"carrier",f,C.length,_.observations.length,{filesVisited:_.filesInspected}),y.set("builtin.carrier",{id:"builtin.carrier",applicableFiles:_.bodySummaries,observations:_.observations.length,errors:_.errors.length}),S.push(..._.errors);let k=on([...C,..._.observations]);f=performance.now();let $=sS(k);it(d,"relations",f,k.length,$.length),f=performance.now();let Hi=cS(k,$);it(d,"links",f,$.length,Hi.length),lS(k,$),f=performance.now();let zi=pS([...uS(k,$),...E.frontiers]);return it(d,"frontiers",f,k.length,zi.length),{schemaVersion:2,extractorVersion:Ui,observations:k,relationGroups:$,links:Hi,frontiers:zi,coverage:{filesScanned:n.length,filesWithAst:g.filter(P=>P.hasAst).length,filesWithoutAst:g.filter(P=>!P.hasAst).length,...s?{filesReused:a.length}:{},extractors:[...y.values()],extractionErrors:S,phases:d},fileCoverage:g}}function it(e,t,n,r,i,o={}){e.push({id:t,durationMs:Math.max(0,performance.now()-n),inputFacts:r,outputFacts:i,...o})}function nS(e,t){let n=[],r=[];for(let i of t){let o=x(e,i),s=ki.filter(l=>l.supports(o)),a=s.length>0?j(e,i):null,c={file:i,hasAst:a!==null||rS(i,o),observationIds:[],extractors:[],extractionErrors:[]};if(a)for(let l of s){let u={id:l.id,applicableFiles:1,observations:0,errors:0};try{let d=l.extract(a);u.observations=d.length,n.push(...d),c.observationIds.push(...d.map(p=>p.id))}catch(d){u.errors=1,c.extractionErrors.push(`${l.id} failed for ${i}: ${d instanceof Error?d.message:String(d)}`)}c.extractors.push(u)}r.push(c)}return{observations:n,fileCoverage:r}}function rS(e,t){return t?Se(e)?/<script\b/iu.test(t):H(e)!==null:!1}function iS(e){let t=new Map(ki.map(n=>[n.id,{id:n.id,applicableFiles:0,observations:0,errors:0}]));for(let n of e)for(let r of n.extractors){let i=t.get(r.id);i&&(i.applicableFiles+=r.applicableFiles,i.observations+=r.observations,i.errors+=r.errors)}return t}function oS(e){return e.replaceAll("\\","/").replace(/^\.\//u,"")}function sS(e){let t=new Map;for(let n of sr){let r=new Set([...n.producerActions,...n.consumerActions,...n.declarationActions??[]]);for(let i of e){if(!r.has(i.action)||i.strength==="candidate")continue;let o=fS(i,n.keyNames);if(!o)continue;let s=o.map(d=>`${d.name}=${Cc(d.name,d.value)}`).join("\0"),a=i.sourceScope==="production"?"production":i.sourceScope,c=`${n.id}\0${a}\0${s}`,l=`boundary-group:${Nc("sha256").update(c).digest("hex").slice(0,16)}`,u=t.get(l)??{id:l,protocol:n.protocol,joinRule:n.id,normalizedKey:s,keyParts:o,producerIds:[],consumerIds:[],declarationIds:[],derivation:{kind:"mechanically-derived",rule:n.id,ruleVersion:"2",inputFactIds:[],sourceSpans:[]}};n.producerActions.includes(i.action)&&u.producerIds.push(i.id),n.consumerActions.includes(i.action)&&u.consumerIds.push(i.id),n.declarationActions?.includes(i.action)&&u.declarationIds.push(i.id),u.derivation.inputFactIds.push(i.id),u.derivation.sourceSpans.push(i.source),t.set(l,u)}}return[...t.values()].map(aS).sort(gS)}function aS(e){return{...e,producerIds:ir(e.producerIds),consumerIds:ir(e.consumerIds),declarationIds:ir(e.declarationIds),derivation:{...e.derivation,inputFactIds:ir(e.derivation.inputFactIds),sourceSpans:[...new Map(e.derivation.sourceSpans.map(t=>[`${t.file}:${t.startLine}:${t.endLine}`,t])).values()]}}}function cS(e,t){let n=new Map(e.map(i=>[i.id,i])),r=new Map;for(let i of t){let o=sr.find(a=>a.id===i.joinRule);if(!o?.traversable)continue;let s=o.linkFrom==="declaration"?i.declarationIds:i.producerIds;if(!(s.length===0||i.consumerIds.length===0)&&!(o.requireUniquePair&&(s.length!==1||i.consumerIds.length!==1))&&!(o.requireUniqueConsumer&&i.consumerIds.length!==1)&&!(s.length*i.consumerIds.length>eS))for(let a of s)for(let c of i.consumerIds){let l=n.get(a),u=n.get(c);if(!l||!u||mS(l,u))continue;let d=l.strength==="derived"||u.strength==="derived"?"derived":"exact",p=`${i.joinRule}\0${a}\0${c}`,f={id:`boundary-link:${Nc("sha256").update(p).digest("hex").slice(0,16)}`,from:a,to:c,joinRule:i.joinRule,matchedKeyParts:i.keyParts,strength:d,derivation:{kind:"mechanically-derived",rule:i.joinRule,ruleVersion:"2",inputFactIds:[a,c],sourceSpans:[l.source,u.source]}};r.set(f.id,f)}}return[...r.values()].sort(yS)}function lS(e,t){let n=new Set(t.filter(Ec).flatMap(or)),r=new Set(t.filter(dS).flatMap(or));for(let i of e)i.resolution=n.has(i.id)?"locally-linked":r.has(i.id)?"ambiguous":"unresolved"}function uS(e,t){let n=new Set(e.filter(o=>o.strength!=="candidate").map(o=>`${o.action}\0${o.source.file}\0${o.source.startLine}\0${o.source.endLine}`)),r=new Set(t.flatMap(or)),i=new Set(t.filter(Ec).flatMap(or));return e.filter(o=>o.sourceScope==="production").filter(o=>o.strength!=="candidate"||!n.has(`${o.action}\0${o.source.file}\0${o.source.startLine}\0${o.source.endLine}`)).filter(o=>!i.has(o.id)).map(o=>{let s=o.keyParts.filter(c=>c.evidence==="expression"||c.value.length===0).map(c=>c.name),a=s.length>0?`${o.extractor} observed ${o.action}, but ${s.join(", ")} remained symbolic or unknown.`:o.resolution==="ambiguous"?`${o.extractor} established the address for ${o.action}, but more than one indexed peer has the same runtime key.`:r.has(o.id)?`${o.extractor} established the address for ${o.action}, but the indexed production scope contains no counterpart role in that relation group.`:`${o.extractor} observed ${o.action}, but no supported factorization rule could establish its addressed relation.`;return{observationId:o.id,reason:a,missingKeyParts:s,sourceScope:o.sourceScope}}).sort((o,s)=>o.observationId.localeCompare(s.observationId))}function or(e){return[...e.producerIds,...e.consumerIds,...e.declarationIds]}function Ec(e){let t=sr.find(r=>r.id===e.joinRule);if(!t)return!1;let n=t.linkFrom==="declaration"?e.declarationIds:e.producerIds;return n.length===0||e.consumerIds.length===0?!1:!t.requireUniquePair||n.length===1&&e.consumerIds.length===1}function dS(e){let t=sr.find(r=>r.id===e.joinRule);if(!t?.requireUniquePair)return!1;let n=t.linkFrom==="declaration"?e.declarationIds:e.producerIds;return n.length>0&&e.consumerIds.length>0&&(n.length!==1||e.consumerIds.length!==1)}function pS(e){return[...new Map(e.map(t=>[t.observationId,t])).values()].sort((t,n)=>t.observationId.localeCompare(n.observationId))}function fS(e,t){let n=[];for(let r of t){let i=e.keyParts.find(o=>o.name===r);if(!i||i.evidence==="expression"||i.value.length===0)return null;n.push({...i,value:Cc(r,i.value)})}return n}function Cc(e,t){if(e==="method")return t.toUpperCase();if(e!=="path")return t;let n=t.startsWith("/")?t:`/${t}`;return n.length>1?n.replace(/\/+$/u,""):n}function mS(e,t){return e.source.file===t.source.file&&e.source.startLine===t.source.startLine}function on(e){return[...new Map(e.map(t=>[t.id,t])).values()].sort((t,n)=>t.source.file.localeCompare(n.source.file)||t.source.startLine-n.source.startLine||t.action.localeCompare(n.action))}function ir(e){return[...new Set(e)].sort()}function gS(e,t){return e.joinRule.localeCompare(t.joinRule)||e.normalizedKey.localeCompare(t.normalizedKey)}function yS(e,t){return e.joinRule.localeCompare(t.joinRule)||e.from.localeCompare(t.from)||e.to.localeCompare(t.to)}import hS from"better-sqlite3";var cr="codebaseiq_runtime_boundaries",ot="codebaseiq_runtime_observations",lr="codebaseiq_runtime_relation_groups",ur="codebaseiq_runtime_relation_participants";function SS(e,t){let n=new hS(ct(e));try{n.exec(`
|
|
298
|
+
CREATE TABLE IF NOT EXISTS ${cr} (
|
|
299
|
+
singleton INTEGER PRIMARY KEY CHECK (singleton = 1),
|
|
300
|
+
schema_version INTEGER NOT NULL,
|
|
301
|
+
extractor_version TEXT NOT NULL,
|
|
302
|
+
payload TEXT NOT NULL
|
|
303
|
+
)
|
|
304
|
+
`),xS(n),n.transaction(()=>{n.prepare(`INSERT OR REPLACE INTO ${cr} (singleton, schema_version, extractor_version, payload) VALUES (1, ?, ?, ?)`).run(t.schemaVersion,t.extractorVersion,JSON.stringify(t)),n.prepare(`DELETE FROM ${ot}`).run(),n.prepare(`DELETE FROM ${ur}`).run(),n.prepare(`DELETE FROM ${lr}`).run();let r=n.prepare(`INSERT INTO ${ot}
|
|
305
|
+
(id, protocol, action, role, strength, source_scope, resolution, file, start_line, end_line, owner_symbol, payload)
|
|
306
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);for(let s of t.observations)r.run(s.id,s.protocol,s.action,s.role,s.strength,s.sourceScope,s.resolution,s.source.file,s.source.startLine,s.source.endLine,s.owner.symbol,JSON.stringify(s));let i=n.prepare(`INSERT INTO ${lr} (id, protocol, join_rule, normalized_key, payload) VALUES (?, ?, ?, ?, ?)`),o=n.prepare(`INSERT INTO ${ur} (group_id, observation_id, participant_role) VALUES (?, ?, ?)`);for(let s of t.relationGroups){i.run(s.id,s.protocol,s.joinRule,s.normalizedKey,JSON.stringify(s));for(let a of s.producerIds)o.run(s.id,a,"producer");for(let a of s.consumerIds)o.run(s.id,a,"consumer");for(let a of s.declarationIds)o.run(s.id,a,"declaration")}})()}finally{n.close()}}function bS(e,t={}){if(!vS(e,ot))return _c(e)?.observations??[];let n=[],r=[];return ar(n,r,"protocol",t.protocols),ar(n,r,"action",t.actions),ar(n,r,"source_scope",t.sourceScopes),ar(n,r,"file",t.files),e.all(`SELECT payload FROM ${ot}${n.length>0?` WHERE ${n.join(" AND ")}`:""} ORDER BY file, start_line, id`,...r).flatMap(o=>NS(o.payload))}function xS(e){e.exec(`
|
|
307
|
+
CREATE TABLE IF NOT EXISTS ${ot} (
|
|
308
|
+
id TEXT PRIMARY KEY,
|
|
309
|
+
protocol TEXT NOT NULL,
|
|
310
|
+
action TEXT NOT NULL,
|
|
311
|
+
role TEXT NOT NULL,
|
|
312
|
+
strength TEXT NOT NULL,
|
|
313
|
+
source_scope TEXT NOT NULL,
|
|
314
|
+
resolution TEXT NOT NULL,
|
|
315
|
+
file TEXT NOT NULL,
|
|
316
|
+
start_line INTEGER NOT NULL,
|
|
317
|
+
end_line INTEGER NOT NULL,
|
|
318
|
+
owner_symbol TEXT,
|
|
319
|
+
payload TEXT NOT NULL
|
|
320
|
+
);
|
|
321
|
+
CREATE INDEX IF NOT EXISTS idx_runtime_observations_protocol_action_scope
|
|
322
|
+
ON ${ot}(protocol, action, source_scope);
|
|
323
|
+
CREATE INDEX IF NOT EXISTS idx_runtime_observations_file_line
|
|
324
|
+
ON ${ot}(file, start_line);
|
|
325
|
+
|
|
326
|
+
CREATE TABLE IF NOT EXISTS ${lr} (
|
|
327
|
+
id TEXT PRIMARY KEY,
|
|
328
|
+
protocol TEXT NOT NULL,
|
|
329
|
+
join_rule TEXT NOT NULL,
|
|
330
|
+
normalized_key TEXT NOT NULL,
|
|
331
|
+
payload TEXT NOT NULL
|
|
332
|
+
);
|
|
333
|
+
CREATE INDEX IF NOT EXISTS idx_runtime_groups_protocol_key
|
|
334
|
+
ON ${lr}(protocol, join_rule, normalized_key);
|
|
335
|
+
|
|
336
|
+
CREATE TABLE IF NOT EXISTS ${ur} (
|
|
337
|
+
group_id TEXT NOT NULL,
|
|
338
|
+
observation_id TEXT NOT NULL,
|
|
339
|
+
participant_role TEXT NOT NULL,
|
|
340
|
+
PRIMARY KEY (group_id, observation_id, participant_role)
|
|
341
|
+
);
|
|
342
|
+
CREATE INDEX IF NOT EXISTS idx_runtime_participants_observation
|
|
343
|
+
ON ${ur}(observation_id, participant_role);
|
|
344
|
+
`)}function vS(e,t){return!!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",t)}function ar(e,t,n,r){!r||r.length===0||(e.push(`${n} IN (${r.map(()=>"?").join(", ")})`),t.push(...r))}function NS(e){try{return[JSON.parse(e)]}catch{return[]}}function _c(e){if(!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",cr))return null;let n=e.get(`SELECT schema_version, payload FROM ${cr} WHERE singleton = 1`);if(!n||n.schema_version!==2)return null;try{let r=JSON.parse(n.payload);return r.schemaVersion===2&&Array.isArray(r.observations)&&Array.isArray(r.relationGroups)&&Array.isArray(r.links)?r:null}catch{return null}}export{v as a,ye as b,Ne as c,he as d,We as e,kS as f,DS as g,AS as h,OS as i,MS as j,ee as k,ao as l,co as m,Do as n,hu as o,ht as p,be as q,le as r,So as s,X as t,x as u,Pt as v,Jc as w,JS as x,QS as y,re as z,Qr as A,pv as B,fv as C,Zr as D,H as E,Se as F,WS as G,qS as H,R as I,Lt as J,mt as K,kt as L,cl as M,A as N,jl as O,Vl as P,Lr as Q,zl as R,Wl as S,hx as T,qo as U,z as V,Sx as W,Jx as X,Sp as Y,Ln as Z,LN as _,je as $,M as aa,VN as ba,Mn as ca,Dn as da,de as ea,ae as fa,Ve as ga,K as ha,et as ia,ci as ja,jt as ka,ws as la,GN as ma,XN as na,JN as oa,QN as pa,li as qa,ui as ra,fE as sa,F as ta,mE as ua,um as va,gE as wa,yE as xa,hE as ya,gm as za,Nt as Aa,SE as Ba,Oa as Ca,Bn as Da,mi as Ea,sC as Fa,UE as Ga,Hm as Ha,HE as Ia,zE as Ja,RC as Ka,FC as La,TC as Ma,ta as Na,YE as Oa,eC as Pa,fi as Qa,gi as Ra,Qs as Sa,Ys as Ta,yi as Ua,CC as Va,Sg as Wa,bg as Xa,_C as Ya,xg as Za,vg as _a,OC as $a,hi as ab,KC as bb,ca as cb,GC as db,la as eb,o_ as fb,qg as gb,bi as hb,s_ as ib,Xg as jb,Jg as kb,a_ as lb,c_ as mb,l_ as nb,Fa as ob,ey as pb,Hn as qb,oy as rb,y_ as sb,h_ as tb,F_ as ub,Wn as vb,vi as wb,$_ as xb,B_ as yb,j_ as zb,Jn as Ab,nt as Bb,fe as Cb,Yt as Db,en as Eb,Ui as Fb,tS as Gb,SS as Hb,bS as Ib,_c as Jb,J_ as Kb,Xt as Lb,Q_ as Mb};
|
|
345
|
+
//# sourceMappingURL=chunk-RJWAB4VR.js.map
|