@caspian2026/agent-sdk 0.0.19 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-ggg97179.js → chunk-09nzqj0f.js} +2927 -764
- package/dist/{chunk-c073acgz.js → chunk-0a8jb5c8.js} +9 -9
- package/dist/{chunk-b9t57m67.js → chunk-0b85d7q0.js} +7 -7
- package/dist/{chunk-py5ytxp4.js → chunk-0dwdg9bz.js} +9 -9
- package/dist/{chunk-yvvgfb9f.js → chunk-0f84wjjc.js} +79 -79
- package/dist/chunk-0fw1mz8s.js +27 -0
- package/dist/{chunk-kwekc97v.js → chunk-0pbwcm8b.js} +1 -1
- package/dist/chunk-0pqv68xt.js +133 -0
- package/dist/chunk-0pv13fxq.js +1684 -0
- package/dist/chunk-0tgn1431.js +38 -0
- package/dist/{chunk-bg4x9ex0.js → chunk-0tja7d1y.js} +6 -6
- package/dist/{chunk-t5jqejqk.js → chunk-0w2ntzwz.js} +92 -92
- package/dist/chunk-0yshjsxt.js +122 -0
- package/dist/chunk-0z9s957c.js +94 -0
- package/dist/{chunk-fyc5fepv.js → chunk-0zscb6c7.js} +1 -1
- package/dist/{chunk-x8d2ehd7.js → chunk-13pmg16e.js} +1 -1
- package/dist/{chunk-v4t6dyyh.js → chunk-15f7ee0j.js} +245 -158
- package/dist/{chunk-7yp1ra14.js → chunk-1ehn6qdp.js} +13 -13
- package/dist/chunk-1gt45dyg.js +101 -0
- package/dist/{chunk-bdb81673.js → chunk-1s9jxpjm.js} +7 -7
- package/dist/{chunk-3c25bcsw.js → chunk-1t3cyn1k.js} +1 -1
- package/dist/{chunk-v8twrmnw.js → chunk-1ycd7t0f.js} +88 -88
- package/dist/{chunk-t300xs2e.js → chunk-1ytng03p.js} +12 -12
- package/dist/{chunk-jqn60wdn.js → chunk-25jhz0br.js} +16 -16
- package/dist/{chunk-j03zh8dy.js → chunk-26kp0k1t.js} +79 -79
- package/dist/{chunk-6mqmk16a.js → chunk-2b00k9ep.js} +78 -78
- package/dist/{chunk-ywhmg8xp.js → chunk-2bh7f2wa.js} +13 -13
- package/dist/{chunk-eady4fzn.js → chunk-2bk4jvse.js} +7 -7
- package/dist/{chunk-0vkfrmqm.js → chunk-2mfzqkzn.js} +69 -29
- package/dist/{chunk-szj5wvdy.js → chunk-2qpy8kne.js} +1 -1
- package/dist/{chunk-pwwa7s62.js → chunk-2vc3fyp9.js} +2 -2
- package/dist/{chunk-c2nnhgr2.js → chunk-37j24srh.js} +6 -6
- package/dist/{chunk-5gjwp5bc.js → chunk-39r7sh1h.js} +90 -90
- package/dist/{chunk-t4khqff1.js → chunk-3hcfwedh.js} +5 -5
- package/dist/{chunk-w6m6trzq.js → chunk-3hxr3x9d.js} +2 -2
- package/dist/{chunk-4xwfsejb.js → chunk-3jbxhytz.js} +8 -8
- package/dist/{chunk-qwa7xy95.js → chunk-3k8ecscj.js} +78 -78
- package/dist/chunk-3kx7brrn.js +55 -0
- package/dist/{chunk-gg55fns0.js → chunk-3w4xq6cv.js} +92 -92
- package/dist/{chunk-pywnxth6.js → chunk-3xamk0n1.js} +25 -25
- package/dist/{chunk-89vrm4ae.js → chunk-41wn5eqw.js} +10 -10
- package/dist/{chunk-cxrktb5g.js → chunk-44bqv91d.js} +3 -3
- package/dist/{chunk-cgfdkzhb.js → chunk-4bcx2a3p.js} +1 -1
- package/dist/{chunk-mswx2nma.js → chunk-4e1j46k0.js} +3 -3
- package/dist/{chunk-rshp5b43.js → chunk-4fwzreqj.js} +6 -6
- package/dist/{chunk-txn11vtv.js → chunk-4kfhh3aw.js} +4 -4
- package/dist/chunk-4kfs8ymb.js +92 -0
- package/dist/{chunk-t29a6zb5.js → chunk-4nqm22j3.js} +6 -4
- package/dist/{chunk-hz31bs21.js → chunk-4v1mr2x2.js} +41 -41
- package/dist/{chunk-a2hq2yt9.js → chunk-4yq5zz3m.js} +9 -9
- package/dist/{chunk-0r04e4ap.js → chunk-52pp0dbk.js} +4 -4
- package/dist/{chunk-3nk79af8.js → chunk-568q88qz.js} +1 -1
- package/dist/{chunk-ase86y73.js → chunk-5f57qtf9.js} +1 -1
- package/dist/{chunk-07069jq1.js → chunk-5gr6ekgm.js} +4 -4
- package/dist/{chunk-ppwjyveh.js → chunk-5nqrdqz5.js} +1 -1
- package/dist/chunk-5rhmrt2j.js +121 -0
- package/dist/{chunk-1e1rjstz.js → chunk-5sd5fz78.js} +78 -78
- package/dist/{chunk-5n1jc02d.js → chunk-5v6wr1z4.js} +2 -2
- package/dist/{chunk-69n11zng.js → chunk-5vavvf6y.js} +5 -5
- package/dist/{chunk-kwp6116t.js → chunk-60a647ty.js} +81 -81
- package/dist/{chunk-zxh62ved.js → chunk-61x3akfa.js} +2 -2
- package/dist/chunk-626watky.js +50 -0
- package/dist/{chunk-6s68m1dg.js → chunk-62jrhytw.js} +10 -10
- package/dist/{chunk-fkr3tfcs.js → chunk-638qz5y7.js} +5 -5
- package/dist/{chunk-tz9r44d9.js → chunk-657k4mef.js} +78 -78
- package/dist/chunk-6aqa0ec5.js +145 -0
- package/dist/{chunk-7d24zw5w.js → chunk-6c22q39e.js} +78 -78
- package/dist/{chunk-b0kf00ff.js → chunk-6d05fvxz.js} +2 -2
- package/dist/{chunk-q9t2n7d1.js → chunk-6fe0an4e.js} +79 -79
- package/dist/{chunk-vc12yftf.js → chunk-6fx36a3s.js} +5 -5
- package/dist/{chunk-qzf23s30.js → chunk-6hs3wed5.js} +7 -7
- package/dist/{chunk-1hg8ktay.js → chunk-6qb753r5.js} +79 -79
- package/dist/{chunk-0xjaqda8.js → chunk-6rcf54zd.js} +48 -27
- package/dist/{chunk-bamjc1k5.js → chunk-6twsw69m.js} +7 -7
- package/dist/{chunk-arhmkw0v.js → chunk-6vp8zen2.js} +79 -79
- package/dist/chunk-6zfb4n08.js +91 -0
- package/dist/chunk-73bgy356.js +90 -0
- package/dist/{chunk-f9wnty9x.js → chunk-7ba45tqg.js} +5 -5
- package/dist/{chunk-f98yad99.js → chunk-7dc9d8fy.js} +7 -7
- package/dist/{chunk-ngc2r6jc.js → chunk-7deqmrby.js} +5 -5
- package/dist/{chunk-9x5zgy22.js → chunk-7e9xcw77.js} +1 -1
- package/dist/{chunk-w2qjc4dy.js → chunk-7gbe6ftc.js} +9 -9
- package/dist/{chunk-xhfmdq1y.js → chunk-7gte8zc4.js} +1 -1
- package/dist/{chunk-6nsd9606.js → chunk-7kp42hzq.js} +2 -2
- package/dist/{chunk-hakdhagh.js → chunk-7njkaxjp.js} +39 -120
- package/dist/chunk-7nphjzve.js +105 -0
- package/dist/chunk-7sp9dk6d.js +20 -0
- package/dist/{chunk-wgk9sxk7.js → chunk-7tdk9ypw.js} +10 -10
- package/dist/{chunk-6dj5t602.js → chunk-7wegz81g.js} +1 -1
- package/dist/{chunk-7wm5s02e.js → chunk-7yexhdjs.js} +1 -1
- package/dist/{chunk-eert2day.js → chunk-88k0rgdp.js} +11 -11
- package/dist/{chunk-fcynwjpm.js → chunk-8a1jee0e.js} +2 -2
- package/dist/{chunk-3vy1jt9p.js → chunk-8ady2sm4.js} +8 -8
- package/dist/chunk-8jmkpx1h.js +123 -0
- package/dist/{chunk-mccjtnrw.js → chunk-8m1gfrme.js} +14 -14
- package/dist/{chunk-7sgtxrsc.js → chunk-8q5fzyem.js} +10 -8
- package/dist/{chunk-zzm33q8x.js → chunk-8r1napm7.js} +1 -1
- package/dist/{chunk-cdz5yb0r.js → chunk-9029sbq1.js} +1 -1
- package/dist/{chunk-y1784krc.js → chunk-92wwx9vf.js} +2 -2
- package/dist/{chunk-0zprysa2.js → chunk-93hxjnkb.js} +78 -78
- package/dist/{chunk-qh5p43j4.js → chunk-93kvs6fh.js} +6 -6
- package/dist/{chunk-gw9291xk.js → chunk-9b71sn2g.js} +41 -41
- package/dist/{chunk-zt86q6j5.js → chunk-9drwsb3g.js} +80 -80
- package/dist/{chunk-0075f5sb.js → chunk-9p62r6he.js} +6 -6
- package/dist/{chunk-5c980jax.js → chunk-9re786wa.js} +40 -40
- package/dist/{chunk-s7x8ajv3.js → chunk-9rhy5vt7.js} +9 -9
- package/dist/chunk-9xq7ef8y.js +100 -0
- package/dist/chunk-9ydxqdhe.js +121 -0
- package/dist/{chunk-rmbbmd3s.js → chunk-a00gfn8e.js} +2 -2
- package/dist/{chunk-2vj1ta7d.js → chunk-a1mewckj.js} +78 -78
- package/dist/{chunk-k8vp0atq.js → chunk-a3qtafgw.js} +79 -79
- package/dist/chunk-ab6apbd2.js +140 -0
- package/dist/{chunk-d4mdda98.js → chunk-apjnwens.js} +8 -8
- package/dist/{chunk-ddsjkqs4.js → chunk-b1hygym1.js} +8 -8
- package/dist/{chunk-qatfdxvd.js → chunk-b610qrvk.js} +3 -3
- package/dist/{chunk-qpaeatmf.js → chunk-bbhg7m1a.js} +79 -79
- package/dist/{chunk-83hfzbx3.js → chunk-bdhdmkya.js} +1 -1
- package/dist/chunk-bdrsheny.js +35 -0
- package/dist/{chunk-vyjeh50y.js → chunk-bktmgb4n.js} +68 -39
- package/dist/{chunk-feyzykye.js → chunk-bq0wp28e.js} +1 -1
- package/dist/{chunk-0vp3wfab.js → chunk-bs9rn85s.js} +1 -1
- package/dist/{chunk-ft4dxnwq.js → chunk-bstyysxw.js} +3 -3
- package/dist/{chunk-yyex5gsf.js → chunk-bta8w8ge.js} +10 -10
- package/dist/chunk-bvfqg3cg.js +131 -0
- package/dist/{chunk-p1sn36ax.js → chunk-bw8y1msy.js} +5 -5
- package/dist/{chunk-7n6tk7rw.js → chunk-c2k1n6yb.js} +13 -13
- package/dist/{chunk-rtbar3a1.js → chunk-c6gpdd2c.js} +78 -78
- package/dist/{chunk-f84vvk41.js → chunk-cajjdb7j.js} +4 -4
- package/dist/{chunk-8svj497n.js → chunk-ccdh8eh2.js} +38 -38
- package/dist/{chunk-mys37bb4.js → chunk-cfpnb7x4.js} +78 -78
- package/dist/{chunk-21jaw3mt.js → chunk-cgzq4zww.js} +4 -4
- package/dist/chunk-cj0j4n23.js +71 -0
- package/dist/{chunk-0731m51q.js → chunk-ckrs789w.js} +1 -1
- package/dist/{chunk-rnxctq9p.js → chunk-cqb31tfg.js} +6 -6
- package/dist/{chunk-v6qvcajp.js → chunk-cx21etb2.js} +2 -2
- package/dist/chunk-cynnhyy3.js +103 -0
- package/dist/chunk-d0zx5hba.js +85 -0
- package/dist/{chunk-rn7w9k0a.js → chunk-d2cypdsx.js} +23 -23
- package/dist/{chunk-1h2famwb.js → chunk-d99k9r9g.js} +1 -1
- package/dist/{chunk-qatqd4rk.js → chunk-dg2k597k.js} +9 -9
- package/dist/{chunk-ewadzrm8.js → chunk-dh01e4bp.js} +2 -2
- package/dist/{chunk-d564dtpq.js → chunk-dmp3nd67.js} +90 -90
- package/dist/{chunk-1j0n05rf.js → chunk-dv38yqdn.js} +3 -3
- package/dist/{chunk-fqak69ft.js → chunk-dy8278wt.js} +7 -7
- package/dist/{chunk-36akc07b.js → chunk-dzcb2ekz.js} +4 -4
- package/dist/{chunk-z2npjf0h.js → chunk-e01rphq3.js} +108 -109
- package/dist/{chunk-dfszv6kn.js → chunk-e22at2jn.js} +4 -4
- package/dist/chunk-e6s584g7.js +77 -0
- package/dist/{chunk-v4162e76.js → chunk-e7j6g62d.js} +9 -9
- package/dist/chunk-e90dyenj.js +127 -0
- package/dist/{chunk-z0pmdn8s.js → chunk-eb4t4ehh.js} +6 -6
- package/dist/{chunk-5h1wfdk2.js → chunk-ej882sb5.js} +26 -26
- package/dist/{chunk-fvm8gehr.js → chunk-ekewg3tj.js} +4 -4
- package/dist/chunk-em5s71j6.js +89 -0
- package/dist/chunk-eqcgr89w.js +646 -0
- package/dist/{chunk-4ce75svs.js → chunk-et3jfht8.js} +13 -13
- package/dist/{chunk-qp2qdcda.js → chunk-eta5aekm.js} +9 -30
- package/dist/{chunk-f3ychkjd.js → chunk-ewsvbzhz.js} +3 -3
- package/dist/{chunk-7wg82yq4.js → chunk-eynfddhq.js} +143 -144
- package/dist/{chunk-66zry909.js → chunk-f517h74h.js} +1 -1
- package/dist/{chunk-4pbx3g7s.js → chunk-f79jyxwd.js} +4 -4
- package/dist/{chunk-hwfknpxv.js → chunk-f9ybfyyp.js} +2 -2
- package/dist/chunk-f9zvs66e.js +105 -0
- package/dist/{chunk-7aw745vx.js → chunk-fdwtd6s9.js} +3 -3
- package/dist/{chunk-gmdt7w5d.js → chunk-fefs2xby.js} +25 -25
- package/dist/{chunk-jzthz1bx.js → chunk-fpq87r80.js} +1 -1
- package/dist/{chunk-s8gy4ky9.js → chunk-fqr6n9z6.js} +3 -3
- package/dist/{chunk-s8kj6ajy.js → chunk-fr5s5ceq.js} +2 -2
- package/dist/chunk-gaf31961.js +81 -0
- package/dist/{chunk-64c1avct.js → chunk-gbvmks09.js} +1 -1
- package/dist/{chunk-y4ca9kqz.js → chunk-ggk84sc5.js} +4 -4
- package/dist/chunk-gkz2djp0.js +121 -0
- package/dist/{chunk-rjsfkzty.js → chunk-gm8ht8g9.js} +6 -6
- package/dist/{chunk-wn3zb71r.js → chunk-gt43z5zd.js} +81 -81
- package/dist/chunk-gwktnbeg.js +90 -0
- package/dist/{chunk-xv3era3s.js → chunk-gxsrvxjn.js} +1 -1
- package/dist/chunk-h0bgwz9v.js +55 -0
- package/dist/{chunk-gy4se0z5.js → chunk-h1tv19q0.js} +80 -80
- package/dist/chunk-h3v46eky.js +105 -0
- package/dist/{chunk-e8s2e141.js → chunk-h4tnp6dw.js} +7 -7
- package/dist/{chunk-5bs3xf11.js → chunk-h8n0a991.js} +79 -79
- package/dist/{chunk-nc0ve25x.js → chunk-hbz8xggv.js} +11 -11
- package/dist/{chunk-v78fj8by.js → chunk-he9zw1gh.js} +2 -2
- package/dist/{chunk-1cpeddhv.js → chunk-hgb8024k.js} +8 -8
- package/dist/{chunk-m2yqqry6.js → chunk-hhvf84fa.js} +183 -185
- package/dist/chunk-hycm92ss.js +52 -0
- package/dist/{chunk-670trxyg.js → chunk-j0bfbce5.js} +36 -36
- package/dist/{chunk-srkc8pwp.js → chunk-j15xyew5.js} +4 -4
- package/dist/chunk-j3c5r08n.js +87 -0
- package/dist/chunk-j3q2sbhc.js +107 -0
- package/dist/{chunk-dhfag5m0.js → chunk-j77g2v22.js} +5 -5
- package/dist/{chunk-ps49ymvj.js → chunk-ja1nqz5q.js} +2 -2
- package/dist/{chunk-3t7kecay.js → chunk-ja23mty8.js} +83 -83
- package/dist/{chunk-e83tfqyt.js → chunk-jrqjxhxj.js} +2 -2
- package/dist/{chunk-x47h283a.js → chunk-jsvsnqkn.js} +2 -2
- package/dist/{chunk-rs4yayw6.js → chunk-jw9zwgea.js} +4 -4
- package/dist/{chunk-xq0q4bky.js → chunk-jwqveqpr.js} +9 -9
- package/dist/{chunk-844zmnw6.js → chunk-k0dprbnn.js} +78 -78
- package/dist/{chunk-e0abab5b.js → chunk-k3gvjjm9.js} +5 -5
- package/dist/{chunk-2fwze72g.js → chunk-k6cq3j7z.js} +1 -1
- package/dist/{chunk-x7fdwq3d.js → chunk-k6wmp81y.js} +1 -1
- package/dist/{chunk-xtanrzac.js → chunk-k8by1vfd.js} +19 -19
- package/dist/chunk-k9h7kjf6.js +8 -0
- package/dist/chunk-karea2z2.js +89 -0
- package/dist/{chunk-wa8yn2p0.js → chunk-kcp41jcn.js} +2 -2
- package/dist/{chunk-a5cj5yk1.js → chunk-khwhppzs.js} +2 -2
- package/dist/{chunk-68ffk5qa.js → chunk-kjx9a9p4.js} +2 -2
- package/dist/chunk-kra9y8qb.js +97 -0
- package/dist/{chunk-j5bth84e.js → chunk-kt25n52f.js} +4 -4
- package/dist/{chunk-eqj42wkk.js → chunk-m12e2wq3.js} +80 -80
- package/dist/{chunk-h9n54swm.js → chunk-m13ptmf2.js} +2 -2
- package/dist/{chunk-4jm600zv.js → chunk-m6vs965c.js} +1 -1
- package/dist/{chunk-03jc62cq.js → chunk-m82ketm1.js} +78 -78
- package/dist/{chunk-y9bhjjdz.js → chunk-m8qvkabg.js} +4 -4
- package/dist/{chunk-d9e7ndag.js → chunk-ma6x4ws8.js} +46 -46
- package/dist/{chunk-rtbrh4ac.js → chunk-mbfzfg56.js} +85 -85
- package/dist/{chunk-8457y05z.js → chunk-mtstpt1e.js} +43 -43
- package/dist/chunk-mwzwm2z2.js +60 -0
- package/dist/{chunk-vkhrrvfq.js → chunk-myac8yfs.js} +5 -5
- package/dist/{chunk-110c7hek.js → chunk-n3vmrzcy.js} +5 -5
- package/dist/chunk-n535j168.js +131 -0
- package/dist/{chunk-v9smspw2.js → chunk-n9ne98cj.js} +5 -4
- package/dist/{chunk-c0vhnnct.js → chunk-n9xhrzxs.js} +78 -78
- package/dist/{chunk-sqckd5nx.js → chunk-ngde5k9k.js} +79 -79
- package/dist/{chunk-ksq6zjys.js → chunk-nsxw4b3j.js} +8 -8
- package/dist/{chunk-d4q90j1w.js → chunk-nwdpjkrw.js} +78 -78
- package/dist/{chunk-sd36yzx8.js → chunk-nztayqyx.js} +1 -1
- package/dist/{chunk-byfawrfx.js → chunk-p0n9ew4x.js} +4 -4
- package/dist/{chunk-ehtwnxpg.js → chunk-p4e5ymdw.js} +1 -1
- package/dist/{chunk-cnsj3vq2.js → chunk-p8hn07q2.js} +1 -1
- package/dist/chunk-p9nkqgej.js +19 -0
- package/dist/{chunk-pe3rkfp2.js → chunk-pg4fbhbm.js} +11 -11
- package/dist/{chunk-e9w9zc0g.js → chunk-pg8asjpk.js} +20 -20
- package/dist/chunk-pgptefy1.js +114 -0
- package/dist/chunk-pjn0s3j1.js +111 -0
- package/dist/chunk-pkwv0q5q.js +91 -0
- package/dist/{chunk-netzwgv1.js → chunk-pnc7q9rt.js} +1 -1
- package/dist/{chunk-xeb6075z.js → chunk-pnrdvxhy.js} +2 -2
- package/dist/{chunk-9ed7v1qq.js → chunk-pp5zbnpr.js} +80 -80
- package/dist/{chunk-dmahh26f.js → chunk-pqf2bjy1.js} +4 -4
- package/dist/{chunk-hgdxffqr.js → chunk-pqxyft7d.js} +8 -8
- package/dist/{chunk-v8kjswxt.js → chunk-pt1jzmkv.js} +2 -2
- package/dist/{chunk-a1s9n17m.js → chunk-pt6vj628.js} +9 -9
- package/dist/{chunk-c7jwbe76.js → chunk-pyn4ry36.js} +103 -57
- package/dist/{chunk-2ewarpza.js → chunk-q53kkzhr.js} +80 -80
- package/dist/chunk-q6m9qgaa.js +88 -0
- package/dist/{chunk-p8na2wwp.js → chunk-q74fcthe.js} +2 -2
- package/dist/{chunk-v311af96.js → chunk-q8t0ym9s.js} +83 -83
- package/dist/{chunk-mcws22k3.js → chunk-q9y73cmh.js} +1 -1
- package/dist/{chunk-fajg8x36.js → chunk-qbbf7rr5.js} +1818 -727
- package/dist/{chunk-qb6k2afy.js → chunk-qka6pqrq.js} +11 -11
- package/dist/{chunk-0paqc2yw.js → chunk-qqc3b97c.js} +1 -1
- package/dist/{chunk-t9p85zff.js → chunk-qrdbqeve.js} +2 -2
- package/dist/{chunk-p81gg65v.js → chunk-qrgxbrs9.js} +930 -1057
- package/dist/{chunk-ky1z78ve.js → chunk-qs4stpt5.js} +14 -14
- package/dist/{chunk-b1kcd3ss.js → chunk-r055z03k.js} +1 -1
- package/dist/{chunk-ns7x6xam.js → chunk-r1q9s5hs.js} +13 -10
- package/dist/{chunk-drqk484j.js → chunk-r27tskss.js} +11 -9
- package/dist/{chunk-etdt1xz3.js → chunk-r4pq77kb.js} +3 -3
- package/dist/{chunk-5z28bqne.js → chunk-r585pc0g.js} +4 -3
- package/dist/chunk-r82c7gfc.js +58 -0
- package/dist/{chunk-0rs4m3ya.js → chunk-ra9hbfyz.js} +3 -3
- package/dist/{chunk-xk89d6vy.js → chunk-rfj6gjwh.js} +14 -14
- package/dist/{chunk-qkczt8cr.js → chunk-rgaedd84.js} +5 -5
- package/dist/chunk-rgshryeb.js +93 -0
- package/dist/chunk-rk2kb2ec.js +101 -0
- package/dist/{chunk-x6r4v44b.js → chunk-rpta0rqz.js} +1 -1
- package/dist/{chunk-2gzv8nrw.js → chunk-rrtpbztr.js} +4 -3
- package/dist/{chunk-dfzkwynj.js → chunk-rx9ypbjy.js} +8 -8
- package/dist/{chunk-hpd100ja.js → chunk-rzk001ay.js} +85 -85
- package/dist/{chunk-c33r7wby.js → chunk-rzn9w8p2.js} +3 -3
- package/dist/chunk-s0p653k2.js +93 -0
- package/dist/{chunk-2e8ybf05.js → chunk-s13y3w7e.js} +36 -36
- package/dist/{chunk-vj9segre.js → chunk-s201s689.js} +18 -18
- package/dist/{chunk-a5ry85ct.js → chunk-s5arr49c.js} +11 -200
- package/dist/{chunk-3jh2z27c.js → chunk-s7tq4e5g.js} +78 -78
- package/dist/{chunk-brqy29g9.js → chunk-s9906sac.js} +83 -83
- package/dist/{chunk-302xme7e.js → chunk-s9jxtj04.js} +92 -92
- package/dist/{chunk-pgtnj1mt.js → chunk-sbe9zd56.js} +6 -6
- package/dist/chunk-skypjdyc.js +147 -0
- package/dist/{chunk-fbv4apne.js → chunk-snd4pbkp.js} +1 -1
- package/dist/{chunk-nc7kjfxk.js → chunk-sthmb4xf.js} +78 -78
- package/dist/{chunk-1gx78081.js → chunk-t3yc7m07.js} +1 -1
- package/dist/{chunk-0r5bb9j4.js → chunk-t83amzhd.js} +12 -12
- package/dist/{chunk-5h5kx2jd.js → chunk-t8chhacb.js} +2 -2
- package/dist/{chunk-k0p9w03v.js → chunk-taqr0qw1.js} +3 -3
- package/dist/{chunk-nzdz8raj.js → chunk-tdf3ha9b.js} +79 -79
- package/dist/{chunk-8g5pe1gr.js → chunk-tevzn1xp.js} +1 -1
- package/dist/chunk-tgayhxvz.js +41 -0
- package/dist/{chunk-j64ga6ta.js → chunk-tkbwrjte.js} +325 -284
- package/dist/{chunk-4wx02mba.js → chunk-tmye4d2k.js} +15 -15
- package/dist/{chunk-55raexh7.js → chunk-tnpk0ne1.js} +2458 -1002
- package/dist/{chunk-sa1pvh58.js → chunk-tnv92c5m.js} +80 -80
- package/dist/{chunk-jd32zbps.js → chunk-trm02xde.js} +2 -2
- package/dist/{chunk-y6x9kgba.js → chunk-tyc5c0q4.js} +8 -8
- package/dist/{chunk-4k9d7gxv.js → chunk-v2szqm5g.js} +5 -5
- package/dist/{chunk-bbc9f5q9.js → chunk-v8k67zfz.js} +1123 -388
- package/dist/{chunk-hr9c2w99.js → chunk-v9sy0cj3.js} +10 -10
- package/dist/{chunk-p7vkh4wx.js → chunk-vbe1ersf.js} +1 -1
- package/dist/{chunk-ntztbz5t.js → chunk-vd5dh925.js} +78 -78
- package/dist/{chunk-6dngjwkh.js → chunk-vnrevqdf.js} +4 -4
- package/dist/{chunk-7s3g2nbw.js → chunk-vq4k182g.js} +5 -5
- package/dist/chunk-vr5vyt2h.js +107 -0
- package/dist/{chunk-a2v77s0p.js → chunk-vv84k232.js} +5 -5
- package/dist/chunk-vvjhax8n.js +114 -0
- package/dist/chunk-vvsts2t9.js +30 -0
- package/dist/{chunk-mq451b1k.js → chunk-vwkb146r.js} +90 -90
- package/dist/{chunk-a6328ts5.js → chunk-vwt2fv6j.js} +3 -3
- package/dist/{chunk-6fes9049.js → chunk-vx28ztc7.js} +20 -20
- package/dist/{chunk-g9f19ttm.js → chunk-vxsad4bw.js} +2 -2
- package/dist/chunk-w287mz4p.js +146 -0
- package/dist/{chunk-1ts9qapj.js → chunk-w2bff8pq.js} +12 -12
- package/dist/{chunk-q3w82drt.js → chunk-w60c0dkw.js} +5 -5
- package/dist/chunk-wa852b5b.js +113 -0
- package/dist/{chunk-7xyswgjh.js → chunk-wfh12nzh.js} +1 -1
- package/dist/{chunk-vf612n57.js → chunk-wt799fvk.js} +34 -34
- package/dist/{chunk-qajrkk97.js → chunk-wwrswxg1.js} +1 -1
- package/dist/{chunk-1fb0jqty.js → chunk-wyyd1qfn.js} +81 -81
- package/dist/{chunk-40gj4vgn.js → chunk-x09aacvx.js} +5 -5
- package/dist/{chunk-m8wxbjg3.js → chunk-x4x3691j.js} +12 -12
- package/dist/chunk-xbpt4dv8.js +155 -0
- package/dist/{chunk-rn0v1hk8.js → chunk-xdxdztxa.js} +1 -1
- package/dist/{chunk-wc67aegv.js → chunk-xggbj4j9.js} +3 -3
- package/dist/chunk-xj72jfpd.js +33 -0
- package/dist/{chunk-8yhf030a.js → chunk-xj8tk3d7.js} +3 -3
- package/dist/{chunk-5cj7yfg1.js → chunk-xkra2684.js} +85 -86
- package/dist/{chunk-hav5hw2k.js → chunk-xm9zf0tv.js} +78 -78
- package/dist/chunk-xwbh3j1x.js +107 -0
- package/dist/chunk-xwrar1c5.js +97 -0
- package/dist/{chunk-nsbtda9y.js → chunk-xygy5v97.js} +27 -27
- package/dist/{chunk-3jp8zgek.js → chunk-xyzbgjpv.js} +2 -2
- package/dist/{chunk-1ae3nt9j.js → chunk-y83gxqvc.js} +3 -3
- package/dist/{chunk-64r16v22.js → chunk-y8b45mt2.js} +4 -4
- package/dist/{chunk-65j4q40b.js → chunk-ycpdfeya.js} +79 -79
- package/dist/{chunk-k6bpr2zz.js → chunk-yh46f77t.js} +78 -78
- package/dist/{chunk-6g0hnb1k.js → chunk-ykvf93ft.js} +79 -79
- package/dist/{chunk-26wtxbdc.js → chunk-ynx3fetd.js} +1222 -463
- package/dist/{chunk-d5eckc42.js → chunk-yp64t9je.js} +8 -8
- package/dist/{chunk-eqp1rfft.js → chunk-ysfam81t.js} +2 -2
- package/dist/chunk-yt9mady7.js +36 -0
- package/dist/{chunk-bpkpy613.js → chunk-yteprw63.js} +26 -26
- package/dist/{chunk-8bxm9bv1.js → chunk-ytt8da3v.js} +81 -81
- package/dist/{chunk-hnwg3k83.js → chunk-yvm9t98e.js} +7 -18
- package/dist/{chunk-3f2ryn4p.js → chunk-z7yj7dfh.js} +10 -10
- package/dist/{chunk-d6eym4sa.js → chunk-z8b8f2n3.js} +79 -79
- package/dist/{chunk-1vyfr81c.js → chunk-z8n8cjhz.js} +2 -2
- package/dist/{chunk-5ccdsxgy.js → chunk-z9v4bxrj.js} +3 -3
- package/dist/{chunk-k737m0z6.js → chunk-zat7q2e0.js} +79 -79
- package/dist/chunk-zfxp82tk.js +24 -0
- package/dist/chunk-zgkngrp4.js +54 -0
- package/dist/{chunk-brjd9zmk.js → chunk-zhnnzkzm.js} +14 -14
- package/dist/{chunk-7hfzfe98.js → chunk-zp5nvg44.js} +2 -2
- package/dist/{chunk-5ekyhb1w.js → chunk-zqajmq38.js} +6 -6
- package/dist/{chunk-v1kzp02e.js → chunk-zx9r7a23.js} +1 -1
- package/dist/cli.js +11 -11
- package/dist/gateway/worker.js +17902 -12387
- package/dist/sdk/query.cjs +8 -18
- package/dist/sdk/query.js +1 -1
- package/package.json +128 -128
- package/dist/chunk-0e495v4y.js +0 -103
- package/dist/chunk-0n4n14c1.js +0 -55
- package/dist/chunk-0t81d427.js +0 -41
- package/dist/chunk-1pjgxfeq.js +0 -105
- package/dist/chunk-2tb0e476.js +0 -121
- package/dist/chunk-3dx4h9pq.js +0 -114
- package/dist/chunk-3kf30xba.js +0 -121
- package/dist/chunk-3mgywd32.js +0 -8
- package/dist/chunk-3t2pkmek.js +0 -77
- package/dist/chunk-4e708nwk.js +0 -50
- package/dist/chunk-5h4berfm.js +0 -30
- package/dist/chunk-5xkp0tnb.js +0 -97
- package/dist/chunk-6rvr3wwq.js +0 -55
- package/dist/chunk-7eb2qp91.js +0 -90
- package/dist/chunk-7m3a6kb8.js +0 -93
- package/dist/chunk-9hd3p970.js +0 -88
- package/dist/chunk-a1gwg4fx.js +0 -87
- package/dist/chunk-adtgferq.js +0 -107
- package/dist/chunk-ahxpxdqg.js +0 -105
- package/dist/chunk-ajrrg4t1.js +0 -131
- package/dist/chunk-b3q5g3x5.js +0 -71
- package/dist/chunk-bh5zqvyc.js +0 -36
- package/dist/chunk-bjwdqabf.js +0 -113
- package/dist/chunk-by2e46kd.js +0 -92
- package/dist/chunk-c6sjhj89.js +0 -1284
- package/dist/chunk-cdef9v7b.js +0 -27
- package/dist/chunk-czsjnagp.js +0 -114
- package/dist/chunk-dn00fcy7.js +0 -54
- package/dist/chunk-dnb45dhp.js +0 -97
- package/dist/chunk-e2nwdr09.js +0 -127
- package/dist/chunk-e4vx828d.js +0 -91
- package/dist/chunk-f0eqte4j.js +0 -105
- package/dist/chunk-f6xzr8q2.js +0 -101
- package/dist/chunk-g0x0gksg.js +0 -91
- package/dist/chunk-gdwdqewd.js +0 -19
- package/dist/chunk-gz1e8y1w.js +0 -33
- package/dist/chunk-hca6b2e5.js +0 -133
- package/dist/chunk-hszdxe8f.js +0 -146
- package/dist/chunk-k2p273gs.js +0 -107
- package/dist/chunk-kc8am0nn.js +0 -111
- package/dist/chunk-kde61fqf.js +0 -148
- package/dist/chunk-knbjqnc7.js +0 -52
- package/dist/chunk-m626yecd.js +0 -107
- package/dist/chunk-m86p6rs2.js +0 -121
- package/dist/chunk-nmgj86tt.js +0 -24
- package/dist/chunk-pd0yqtm8.js +0 -122
- package/dist/chunk-pgs47kqs.js +0 -155
- package/dist/chunk-py7pm42n.js +0 -60
- package/dist/chunk-pzxz2an7.js +0 -145
- package/dist/chunk-q0kafg58.js +0 -89
- package/dist/chunk-qnfx3qtx.js +0 -617
- package/dist/chunk-qs3g8f9e.js +0 -20
- package/dist/chunk-readr4t2.js +0 -89
- package/dist/chunk-rnajq3vk.js +0 -140
- package/dist/chunk-s6cxke3j.js +0 -100
- package/dist/chunk-sgpmpn90.js +0 -35
- package/dist/chunk-sh02d2qn.js +0 -38
- package/dist/chunk-t04tpqda.js +0 -130
- package/dist/chunk-t3se5crr.js +0 -85
- package/dist/chunk-vffwxpad.js +0 -101
- package/dist/chunk-vtjgsgyf.js +0 -123
- package/dist/chunk-w022zpyz.js +0 -81
- package/dist/chunk-w28zrffk.js +0 -94
- package/dist/chunk-w328d3yn.js +0 -71
- package/dist/chunk-xrb6mn8j.js +0 -93
- package/dist/chunk-ypsecc1v.js +0 -90
- package/dist/chunk-yrr23vr1.js +0 -58
|
@@ -0,0 +1,1684 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
__esm
|
|
4
|
+
} from "./chunk-eta5aekm.js";
|
|
5
|
+
|
|
6
|
+
// node_modules/.bun/fuse.js@7.5.0/node_modules/fuse.js/dist/fuse.mjs
|
|
7
|
+
function isArray(value) {
|
|
8
|
+
return !Array.isArray ? getTag(value) === "[object Array]" : Array.isArray(value);
|
|
9
|
+
}
|
|
10
|
+
function baseToString(value) {
|
|
11
|
+
if (typeof value == "string")
|
|
12
|
+
return value;
|
|
13
|
+
if (typeof value === "bigint")
|
|
14
|
+
return value.toString();
|
|
15
|
+
const result = value + "";
|
|
16
|
+
return result == "0" && 1 / value == -Infinity ? "-0" : result;
|
|
17
|
+
}
|
|
18
|
+
function toString(value) {
|
|
19
|
+
return value == null ? "" : baseToString(value);
|
|
20
|
+
}
|
|
21
|
+
function isString(value) {
|
|
22
|
+
return typeof value === "string";
|
|
23
|
+
}
|
|
24
|
+
function isNumber(value) {
|
|
25
|
+
return typeof value === "number";
|
|
26
|
+
}
|
|
27
|
+
function isBoolean(value) {
|
|
28
|
+
return value === true || value === false || isObjectLike(value) && getTag(value) == "[object Boolean]";
|
|
29
|
+
}
|
|
30
|
+
function isObject(value) {
|
|
31
|
+
return typeof value === "object";
|
|
32
|
+
}
|
|
33
|
+
function isObjectLike(value) {
|
|
34
|
+
return isObject(value) && value !== null;
|
|
35
|
+
}
|
|
36
|
+
function isDefined(value) {
|
|
37
|
+
return value !== undefined && value !== null;
|
|
38
|
+
}
|
|
39
|
+
function isBlank(value) {
|
|
40
|
+
return !value.trim().length;
|
|
41
|
+
}
|
|
42
|
+
function getTag(value) {
|
|
43
|
+
return value == null ? value === undefined ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(value);
|
|
44
|
+
}
|
|
45
|
+
function createKey(key) {
|
|
46
|
+
let path = null;
|
|
47
|
+
let id = null;
|
|
48
|
+
let src = null;
|
|
49
|
+
let weight = 1;
|
|
50
|
+
let getFn = null;
|
|
51
|
+
if (isString(key) || isArray(key)) {
|
|
52
|
+
src = key;
|
|
53
|
+
path = createKeyPath(key);
|
|
54
|
+
id = createKeyId(key);
|
|
55
|
+
} else {
|
|
56
|
+
if (!hasOwn.call(key, "name"))
|
|
57
|
+
throw new Error(MISSING_KEY_PROPERTY("name"));
|
|
58
|
+
const name = key.name;
|
|
59
|
+
src = name;
|
|
60
|
+
if (hasOwn.call(key, "weight") && key.weight !== undefined) {
|
|
61
|
+
weight = key.weight;
|
|
62
|
+
if (weight <= 0)
|
|
63
|
+
throw new Error(INVALID_KEY_WEIGHT_VALUE(createKeyId(name)));
|
|
64
|
+
}
|
|
65
|
+
path = createKeyPath(name);
|
|
66
|
+
id = createKeyId(name);
|
|
67
|
+
getFn = key.getFn ?? null;
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
path,
|
|
71
|
+
id,
|
|
72
|
+
weight,
|
|
73
|
+
src,
|
|
74
|
+
getFn
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function createKeyPath(key) {
|
|
78
|
+
return isArray(key) ? key : key.split(".");
|
|
79
|
+
}
|
|
80
|
+
function createKeyId(key) {
|
|
81
|
+
return isArray(key) ? key.join(".") : key;
|
|
82
|
+
}
|
|
83
|
+
function get(obj, path) {
|
|
84
|
+
const list = [];
|
|
85
|
+
let arr = false;
|
|
86
|
+
const deepGet = (obj2, path2, index, arrayIndex) => {
|
|
87
|
+
if (!isDefined(obj2))
|
|
88
|
+
return;
|
|
89
|
+
if (!path2[index])
|
|
90
|
+
list.push(arrayIndex !== undefined ? {
|
|
91
|
+
v: obj2,
|
|
92
|
+
i: arrayIndex
|
|
93
|
+
} : obj2);
|
|
94
|
+
else {
|
|
95
|
+
const value = obj2[path2[index]];
|
|
96
|
+
if (!isDefined(value))
|
|
97
|
+
return;
|
|
98
|
+
if (index === path2.length - 1 && (isString(value) || isNumber(value) || isBoolean(value) || typeof value === "bigint"))
|
|
99
|
+
list.push(arrayIndex !== undefined ? {
|
|
100
|
+
v: toString(value),
|
|
101
|
+
i: arrayIndex
|
|
102
|
+
} : toString(value));
|
|
103
|
+
else if (isArray(value)) {
|
|
104
|
+
arr = true;
|
|
105
|
+
for (let i = 0, len = value.length;i < len; i += 1)
|
|
106
|
+
deepGet(value[i], path2, index + 1, i);
|
|
107
|
+
} else if (path2.length)
|
|
108
|
+
deepGet(value, path2, index + 1, arrayIndex);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
deepGet(obj, isString(path) ? path.split(".") : path, 0);
|
|
112
|
+
return arr ? list : list[0];
|
|
113
|
+
}
|
|
114
|
+
function isWordSeparator(code) {
|
|
115
|
+
return code >= 9 && code <= 13 || code === 32 || code === 160;
|
|
116
|
+
}
|
|
117
|
+
function norm(weight = 1, mantissa = 3) {
|
|
118
|
+
const cache = /* @__PURE__ */ new Map;
|
|
119
|
+
const m = Math.pow(10, mantissa);
|
|
120
|
+
return {
|
|
121
|
+
get(value) {
|
|
122
|
+
let numTokens = 0;
|
|
123
|
+
let inWord = false;
|
|
124
|
+
for (let i = 0;i < value.length; i++)
|
|
125
|
+
if (!isWordSeparator(value.charCodeAt(i))) {
|
|
126
|
+
if (!inWord) {
|
|
127
|
+
numTokens++;
|
|
128
|
+
inWord = true;
|
|
129
|
+
}
|
|
130
|
+
} else
|
|
131
|
+
inWord = false;
|
|
132
|
+
if (numTokens === 0)
|
|
133
|
+
numTokens = 1;
|
|
134
|
+
if (cache.has(numTokens))
|
|
135
|
+
return cache.get(numTokens);
|
|
136
|
+
const n = Math.round(m / Math.pow(numTokens, 0.5 * weight)) / m;
|
|
137
|
+
cache.set(numTokens, n);
|
|
138
|
+
return n;
|
|
139
|
+
},
|
|
140
|
+
clear() {
|
|
141
|
+
cache.clear();
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function createIndex(keys, docs, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) {
|
|
146
|
+
const myIndex = new FuseIndex({
|
|
147
|
+
getFn,
|
|
148
|
+
fieldNormWeight
|
|
149
|
+
});
|
|
150
|
+
myIndex.setKeys(keys.map(createKey));
|
|
151
|
+
myIndex.setSources(docs);
|
|
152
|
+
myIndex.create();
|
|
153
|
+
return myIndex;
|
|
154
|
+
}
|
|
155
|
+
function parseIndex(data, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) {
|
|
156
|
+
const { keys, records } = data;
|
|
157
|
+
const myIndex = new FuseIndex({
|
|
158
|
+
getFn,
|
|
159
|
+
fieldNormWeight
|
|
160
|
+
});
|
|
161
|
+
myIndex.setKeys(keys);
|
|
162
|
+
myIndex.setIndexRecords(records);
|
|
163
|
+
return myIndex;
|
|
164
|
+
}
|
|
165
|
+
function convertMaskToIndices(matchmask = [], minMatchCharLength = Config.minMatchCharLength) {
|
|
166
|
+
const indices = [];
|
|
167
|
+
let start = -1;
|
|
168
|
+
let end = -1;
|
|
169
|
+
let i = 0;
|
|
170
|
+
for (let len = matchmask.length;i < len; i += 1) {
|
|
171
|
+
const match = matchmask[i];
|
|
172
|
+
if (match && start === -1)
|
|
173
|
+
start = i;
|
|
174
|
+
else if (!match && start !== -1) {
|
|
175
|
+
end = i - 1;
|
|
176
|
+
if (end - start + 1 >= minMatchCharLength)
|
|
177
|
+
indices.push([start, end]);
|
|
178
|
+
start = -1;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (matchmask[i - 1] && i - start >= minMatchCharLength)
|
|
182
|
+
indices.push([start, i - 1]);
|
|
183
|
+
return indices;
|
|
184
|
+
}
|
|
185
|
+
function search(text, pattern, patternAlphabet, { location = Config.location, distance = Config.distance, threshold = Config.threshold, findAllMatches = Config.findAllMatches, minMatchCharLength = Config.minMatchCharLength, includeMatches = Config.includeMatches, ignoreLocation = Config.ignoreLocation } = {}) {
|
|
186
|
+
if (pattern.length > 32)
|
|
187
|
+
throw new Error(PATTERN_LENGTH_TOO_LARGE(32));
|
|
188
|
+
const patternLen = pattern.length;
|
|
189
|
+
const textLen = text.length;
|
|
190
|
+
const expectedLocation = Math.max(0, Math.min(location, textLen));
|
|
191
|
+
let currentThreshold = threshold;
|
|
192
|
+
let bestLocation = expectedLocation;
|
|
193
|
+
const calcScore = (errors, currentLocation) => {
|
|
194
|
+
const accuracy = errors / patternLen;
|
|
195
|
+
if (ignoreLocation)
|
|
196
|
+
return accuracy;
|
|
197
|
+
const proximity = Math.abs(expectedLocation - currentLocation);
|
|
198
|
+
if (!distance)
|
|
199
|
+
return proximity ? 1 : accuracy;
|
|
200
|
+
return accuracy + proximity / distance;
|
|
201
|
+
};
|
|
202
|
+
const computeMatches = minMatchCharLength > 1 || includeMatches;
|
|
203
|
+
const matchMask = computeMatches ? Array(textLen) : [];
|
|
204
|
+
let index;
|
|
205
|
+
while ((index = text.indexOf(pattern, bestLocation)) > -1) {
|
|
206
|
+
const score = calcScore(0, index);
|
|
207
|
+
currentThreshold = Math.min(score, currentThreshold);
|
|
208
|
+
bestLocation = index + patternLen;
|
|
209
|
+
if (computeMatches) {
|
|
210
|
+
let i = 0;
|
|
211
|
+
while (i < patternLen) {
|
|
212
|
+
matchMask[index + i] = 1;
|
|
213
|
+
i += 1;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
bestLocation = -1;
|
|
218
|
+
let lastBitArr = [];
|
|
219
|
+
let finalScore = 1;
|
|
220
|
+
let bestErrors = 0;
|
|
221
|
+
let binMax = patternLen + textLen;
|
|
222
|
+
const mask = 1 << patternLen - 1;
|
|
223
|
+
for (let i = 0;i < patternLen; i += 1) {
|
|
224
|
+
let binMin = 0;
|
|
225
|
+
let binMid = binMax;
|
|
226
|
+
while (binMin < binMid) {
|
|
227
|
+
if (calcScore(i, expectedLocation + binMid) <= currentThreshold)
|
|
228
|
+
binMin = binMid;
|
|
229
|
+
else
|
|
230
|
+
binMax = binMid;
|
|
231
|
+
binMid = Math.floor((binMax - binMin) / 2 + binMin);
|
|
232
|
+
}
|
|
233
|
+
binMax = binMid;
|
|
234
|
+
let start = Math.max(1, expectedLocation - binMid + 1);
|
|
235
|
+
const finish = findAllMatches ? textLen : Math.min(expectedLocation + binMid, textLen) + patternLen;
|
|
236
|
+
const bitArr = Array(finish + 2);
|
|
237
|
+
bitArr[finish + 1] = (1 << i) - 1;
|
|
238
|
+
for (let j = finish;j >= start; j -= 1) {
|
|
239
|
+
const currentLocation = j - 1;
|
|
240
|
+
const charMatch = patternAlphabet[text[currentLocation]];
|
|
241
|
+
bitArr[j] = (bitArr[j + 1] << 1 | 1) & charMatch;
|
|
242
|
+
if (i)
|
|
243
|
+
bitArr[j] |= (lastBitArr[j + 1] | lastBitArr[j]) << 1 | 1 | lastBitArr[j + 1];
|
|
244
|
+
if (bitArr[j] & mask) {
|
|
245
|
+
finalScore = calcScore(i, currentLocation);
|
|
246
|
+
if (finalScore <= currentThreshold) {
|
|
247
|
+
currentThreshold = finalScore;
|
|
248
|
+
bestLocation = currentLocation;
|
|
249
|
+
bestErrors = i;
|
|
250
|
+
if (bestLocation <= expectedLocation)
|
|
251
|
+
break;
|
|
252
|
+
start = Math.max(1, 2 * expectedLocation - bestLocation);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
if (calcScore(i + 1, expectedLocation) > currentThreshold)
|
|
257
|
+
break;
|
|
258
|
+
lastBitArr = bitArr;
|
|
259
|
+
}
|
|
260
|
+
if (computeMatches && bestLocation >= 0) {
|
|
261
|
+
const matchEnd = Math.min(textLen - 1, bestLocation + patternLen - 1 + bestErrors);
|
|
262
|
+
for (let k = bestLocation;k <= matchEnd; k += 1)
|
|
263
|
+
if (patternAlphabet[text[k]])
|
|
264
|
+
matchMask[k] = 1;
|
|
265
|
+
}
|
|
266
|
+
const result = {
|
|
267
|
+
isMatch: bestLocation >= 0,
|
|
268
|
+
score: Math.max(0.001, finalScore)
|
|
269
|
+
};
|
|
270
|
+
if (computeMatches) {
|
|
271
|
+
const indices = convertMaskToIndices(matchMask, minMatchCharLength);
|
|
272
|
+
if (!indices.length)
|
|
273
|
+
result.isMatch = false;
|
|
274
|
+
else if (includeMatches)
|
|
275
|
+
result.indices = indices;
|
|
276
|
+
}
|
|
277
|
+
return result;
|
|
278
|
+
}
|
|
279
|
+
function createPatternAlphabet(pattern) {
|
|
280
|
+
const mask = {};
|
|
281
|
+
for (let i = 0, len = pattern.length;i < len; i += 1) {
|
|
282
|
+
const char = pattern.charAt(i);
|
|
283
|
+
mask[char] = (mask[char] || 0) | 1 << len - i - 1;
|
|
284
|
+
}
|
|
285
|
+
return mask;
|
|
286
|
+
}
|
|
287
|
+
function mergeIndices(indices) {
|
|
288
|
+
if (indices.length <= 1)
|
|
289
|
+
return indices;
|
|
290
|
+
indices.sort((a, b) => a[0] - b[0] || a[1] - b[1]);
|
|
291
|
+
const merged = [indices[0]];
|
|
292
|
+
for (let i = 1, len = indices.length;i < len; i += 1) {
|
|
293
|
+
const last = merged[merged.length - 1];
|
|
294
|
+
const curr = indices[i];
|
|
295
|
+
if (curr[0] <= last[1] + 1)
|
|
296
|
+
last[1] = Math.max(last[1], curr[1]);
|
|
297
|
+
else
|
|
298
|
+
merged.push(curr);
|
|
299
|
+
}
|
|
300
|
+
return merged;
|
|
301
|
+
}
|
|
302
|
+
function isInverse(type) {
|
|
303
|
+
return type.startsWith("inverse");
|
|
304
|
+
}
|
|
305
|
+
function tokenize(pattern) {
|
|
306
|
+
const tokens = [];
|
|
307
|
+
const len = pattern.length;
|
|
308
|
+
let i = 0;
|
|
309
|
+
while (i < len) {
|
|
310
|
+
while (i < len && pattern[i] === " ")
|
|
311
|
+
i++;
|
|
312
|
+
if (i >= len)
|
|
313
|
+
break;
|
|
314
|
+
let j = i;
|
|
315
|
+
while (j < len && pattern[j] !== " " && pattern[j] !== '"')
|
|
316
|
+
j++;
|
|
317
|
+
if (j < len && pattern[j] === '"') {
|
|
318
|
+
j++;
|
|
319
|
+
while (j < len) {
|
|
320
|
+
if (pattern[j] === '"') {
|
|
321
|
+
const next = j + 1;
|
|
322
|
+
if (next >= len || pattern[next] === " ") {
|
|
323
|
+
j++;
|
|
324
|
+
break;
|
|
325
|
+
}
|
|
326
|
+
if (pattern[next] === "$" && (next + 1 >= len || pattern[next + 1] === " ")) {
|
|
327
|
+
j += 2;
|
|
328
|
+
break;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
j++;
|
|
332
|
+
}
|
|
333
|
+
tokens.push(pattern.substring(i, j));
|
|
334
|
+
i = j;
|
|
335
|
+
} else {
|
|
336
|
+
while (j < len && pattern[j] !== " ")
|
|
337
|
+
j++;
|
|
338
|
+
tokens.push(pattern.substring(i, j));
|
|
339
|
+
i = j;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
return tokens;
|
|
343
|
+
}
|
|
344
|
+
function getMatch(pattern, exp) {
|
|
345
|
+
const matches = pattern.match(exp);
|
|
346
|
+
return matches ? matches[1] : null;
|
|
347
|
+
}
|
|
348
|
+
function parseQuery(pattern, options = {}) {
|
|
349
|
+
return pattern.replace(/\\\|/g, ESCAPED_PIPE).split(OR_TOKEN).map((item) => {
|
|
350
|
+
const query = tokenize(item.replace(/\u0000/g, "|").trim()).filter((item2) => item2 && !!item2.trim());
|
|
351
|
+
const results = [];
|
|
352
|
+
for (let i = 0, len = query.length;i < len; i += 1) {
|
|
353
|
+
const queryItem = query[i];
|
|
354
|
+
let found = false;
|
|
355
|
+
let idx = -1;
|
|
356
|
+
while (!found && ++idx < matchersLen) {
|
|
357
|
+
const def = matchers[idx];
|
|
358
|
+
const token = getMatch(queryItem, def.multiRegex);
|
|
359
|
+
if (token) {
|
|
360
|
+
results.push(def.create(token, options));
|
|
361
|
+
found = true;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
if (found)
|
|
365
|
+
continue;
|
|
366
|
+
idx = -1;
|
|
367
|
+
while (++idx < matchersLen) {
|
|
368
|
+
const def = matchers[idx];
|
|
369
|
+
const token = getMatch(queryItem, def.singleRegex);
|
|
370
|
+
if (token) {
|
|
371
|
+
results.push(def.create(token, options));
|
|
372
|
+
break;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
return results;
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
function register(...args) {
|
|
380
|
+
registeredSearchers.push(...args);
|
|
381
|
+
}
|
|
382
|
+
function createSearcher(pattern, options) {
|
|
383
|
+
for (let i = 0, len = registeredSearchers.length;i < len; i += 1) {
|
|
384
|
+
const searcherClass = registeredSearchers[i];
|
|
385
|
+
if (searcherClass.condition(pattern, options))
|
|
386
|
+
return new searcherClass(pattern, options);
|
|
387
|
+
}
|
|
388
|
+
return new BitapSearch(pattern, options);
|
|
389
|
+
}
|
|
390
|
+
function parse(query, options, { auto = true } = {}) {
|
|
391
|
+
const next = (query2) => {
|
|
392
|
+
if (isString(query2)) {
|
|
393
|
+
const obj = {
|
|
394
|
+
keyId: null,
|
|
395
|
+
pattern: query2
|
|
396
|
+
};
|
|
397
|
+
if (auto)
|
|
398
|
+
obj.searcher = createSearcher(query2, options);
|
|
399
|
+
return obj;
|
|
400
|
+
}
|
|
401
|
+
const keys = Object.keys(query2);
|
|
402
|
+
const isQueryPath = isPath(query2);
|
|
403
|
+
if (!isQueryPath && keys.length > 1 && !isExpression(query2))
|
|
404
|
+
return next(convertToExplicit(query2));
|
|
405
|
+
if (isLeaf(query2)) {
|
|
406
|
+
const key = isQueryPath ? query2[KeyType.PATH] : keys[0];
|
|
407
|
+
const pattern = isQueryPath ? query2[KeyType.PATTERN] : query2[key];
|
|
408
|
+
if (!isString(pattern))
|
|
409
|
+
throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key));
|
|
410
|
+
const obj = {
|
|
411
|
+
keyId: createKeyId(key),
|
|
412
|
+
pattern
|
|
413
|
+
};
|
|
414
|
+
if (auto)
|
|
415
|
+
obj.searcher = createSearcher(pattern, options);
|
|
416
|
+
return obj;
|
|
417
|
+
}
|
|
418
|
+
const node = {
|
|
419
|
+
children: [],
|
|
420
|
+
operator: keys[0]
|
|
421
|
+
};
|
|
422
|
+
keys.forEach((key) => {
|
|
423
|
+
const value = query2[key];
|
|
424
|
+
if (isArray(value))
|
|
425
|
+
value.forEach((item) => {
|
|
426
|
+
node.children.push(next(item));
|
|
427
|
+
});
|
|
428
|
+
});
|
|
429
|
+
return node;
|
|
430
|
+
};
|
|
431
|
+
if (!isExpression(query))
|
|
432
|
+
query = convertToExplicit(query);
|
|
433
|
+
return next(query);
|
|
434
|
+
}
|
|
435
|
+
function computeScoreSingle(matches, { ignoreFieldNorm = Config.ignoreFieldNorm }) {
|
|
436
|
+
let totalScore = 1;
|
|
437
|
+
matches.forEach(({ key, norm: norm2, score }) => {
|
|
438
|
+
const weight = key ? key.weight : null;
|
|
439
|
+
totalScore *= Math.pow(score === 0 && weight ? Number.EPSILON : score, (weight || 1) * (ignoreFieldNorm ? 1 : norm2));
|
|
440
|
+
});
|
|
441
|
+
return totalScore;
|
|
442
|
+
}
|
|
443
|
+
function computeScore(results, { ignoreFieldNorm = Config.ignoreFieldNorm }) {
|
|
444
|
+
results.forEach((result) => {
|
|
445
|
+
result.score = computeScoreSingle(result.matches, { ignoreFieldNorm });
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
function formatMatches(result) {
|
|
449
|
+
const matches = [];
|
|
450
|
+
result.matches.forEach((match) => {
|
|
451
|
+
if (!isDefined(match.indices) || !match.indices.length)
|
|
452
|
+
return;
|
|
453
|
+
const obj = {
|
|
454
|
+
indices: match.indices,
|
|
455
|
+
value: match.value
|
|
456
|
+
};
|
|
457
|
+
if (match.key)
|
|
458
|
+
obj.key = match.key.id;
|
|
459
|
+
if (match.idx > -1)
|
|
460
|
+
obj.refIndex = match.idx;
|
|
461
|
+
matches.push(obj);
|
|
462
|
+
});
|
|
463
|
+
return matches;
|
|
464
|
+
}
|
|
465
|
+
function format(results, docs, { includeMatches = Config.includeMatches, includeScore = Config.includeScore } = {}) {
|
|
466
|
+
return results.map((result) => {
|
|
467
|
+
const { idx } = result;
|
|
468
|
+
const data = {
|
|
469
|
+
item: docs[idx],
|
|
470
|
+
refIndex: idx
|
|
471
|
+
};
|
|
472
|
+
if (includeMatches)
|
|
473
|
+
data.matches = formatMatches(result);
|
|
474
|
+
if (includeScore)
|
|
475
|
+
data.score = result.score;
|
|
476
|
+
return data;
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
function warnNonGlobal(regex) {
|
|
480
|
+
if (!warned.has(regex)) {
|
|
481
|
+
warned.add(regex);
|
|
482
|
+
console.warn(`[Fuse] tokenize regex ${regex} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
function resolveTokenize(tokenize2) {
|
|
486
|
+
if (typeof tokenize2 === "function") {
|
|
487
|
+
let validated = false;
|
|
488
|
+
return (text) => {
|
|
489
|
+
const result = tokenize2(text);
|
|
490
|
+
if (!validated) {
|
|
491
|
+
validated = true;
|
|
492
|
+
if (!Array.isArray(result) || result.some((t) => typeof t !== "string"))
|
|
493
|
+
throw new Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(result) ? "array containing non-strings" : typeof result}.`);
|
|
494
|
+
}
|
|
495
|
+
return result;
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
if (tokenize2 instanceof RegExp) {
|
|
499
|
+
if (!tokenize2.global)
|
|
500
|
+
warnNonGlobal(tokenize2);
|
|
501
|
+
return (text) => text.match(tokenize2) || [];
|
|
502
|
+
}
|
|
503
|
+
return (text) => text.match(DEFAULT_TOKEN) || [];
|
|
504
|
+
}
|
|
505
|
+
function createAnalyzer({ isCaseSensitive = false, ignoreDiacritics = false, tokenize: tokenize2 } = {}) {
|
|
506
|
+
const tokenizeFn = resolveTokenize(tokenize2);
|
|
507
|
+
return { tokenize(text) {
|
|
508
|
+
if (!isCaseSensitive)
|
|
509
|
+
text = text.toLowerCase();
|
|
510
|
+
if (ignoreDiacritics)
|
|
511
|
+
text = stripDiacritics(text);
|
|
512
|
+
return tokenizeFn(text);
|
|
513
|
+
} };
|
|
514
|
+
}
|
|
515
|
+
function addField(index, text, docIdx, analyzer) {
|
|
516
|
+
const tokens = analyzer.tokenize(text);
|
|
517
|
+
if (!tokens.length)
|
|
518
|
+
return;
|
|
519
|
+
index.fieldCount++;
|
|
520
|
+
index.docFieldCount.set(docIdx, (index.docFieldCount.get(docIdx) || 0) + 1);
|
|
521
|
+
const distinctTerms = new Set(tokens);
|
|
522
|
+
let perDocTerms = index.docTermFieldHits.get(docIdx);
|
|
523
|
+
if (!perDocTerms) {
|
|
524
|
+
perDocTerms = /* @__PURE__ */ new Map;
|
|
525
|
+
index.docTermFieldHits.set(docIdx, perDocTerms);
|
|
526
|
+
}
|
|
527
|
+
for (const term of distinctTerms) {
|
|
528
|
+
perDocTerms.set(term, (perDocTerms.get(term) || 0) + 1);
|
|
529
|
+
index.df.set(term, (index.df.get(term) || 0) + 1);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
function ingestRecord(index, record, keyCount, analyzer) {
|
|
533
|
+
const { i: docIdx, v, $: fields } = record;
|
|
534
|
+
if (v !== undefined) {
|
|
535
|
+
addField(index, v, docIdx, analyzer);
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
if (!fields)
|
|
539
|
+
return;
|
|
540
|
+
for (let keyIdx = 0;keyIdx < keyCount; keyIdx++) {
|
|
541
|
+
const value = fields[keyIdx];
|
|
542
|
+
if (!value)
|
|
543
|
+
continue;
|
|
544
|
+
if (Array.isArray(value))
|
|
545
|
+
for (const sub of value)
|
|
546
|
+
addField(index, sub.v, docIdx, analyzer);
|
|
547
|
+
else
|
|
548
|
+
addField(index, value.v, docIdx, analyzer);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
function buildInvertedIndex(records, keyCount, analyzer) {
|
|
552
|
+
const index = {
|
|
553
|
+
fieldCount: 0,
|
|
554
|
+
df: /* @__PURE__ */ new Map,
|
|
555
|
+
docFieldCount: /* @__PURE__ */ new Map,
|
|
556
|
+
docTermFieldHits: /* @__PURE__ */ new Map
|
|
557
|
+
};
|
|
558
|
+
for (const record of records)
|
|
559
|
+
ingestRecord(index, record, keyCount, analyzer);
|
|
560
|
+
return index;
|
|
561
|
+
}
|
|
562
|
+
function addToInvertedIndex(index, record, keyCount, analyzer) {
|
|
563
|
+
ingestRecord(index, record, keyCount, analyzer);
|
|
564
|
+
}
|
|
565
|
+
function removeFromInvertedIndex(index, docIdx) {
|
|
566
|
+
const fieldCount = index.docFieldCount.get(docIdx);
|
|
567
|
+
if (fieldCount === undefined)
|
|
568
|
+
return;
|
|
569
|
+
index.fieldCount -= fieldCount;
|
|
570
|
+
index.docFieldCount.delete(docIdx);
|
|
571
|
+
const perDocTerms = index.docTermFieldHits.get(docIdx);
|
|
572
|
+
if (!perDocTerms)
|
|
573
|
+
return;
|
|
574
|
+
for (const [term, hits] of perDocTerms) {
|
|
575
|
+
const next = (index.df.get(term) || 0) - hits;
|
|
576
|
+
if (next <= 0)
|
|
577
|
+
index.df.delete(term);
|
|
578
|
+
else
|
|
579
|
+
index.df.set(term, next);
|
|
580
|
+
}
|
|
581
|
+
index.docTermFieldHits.delete(docIdx);
|
|
582
|
+
}
|
|
583
|
+
function removeAndShiftInvertedIndex(index, removedIndices) {
|
|
584
|
+
if (removedIndices.length === 0)
|
|
585
|
+
return;
|
|
586
|
+
const sorted = Array.from(new Set(removedIndices)).sort((a, b) => a - b);
|
|
587
|
+
for (const idx of sorted)
|
|
588
|
+
removeFromInvertedIndex(index, idx);
|
|
589
|
+
const shift = (oldIdx) => {
|
|
590
|
+
let lo = 0;
|
|
591
|
+
let hi = sorted.length;
|
|
592
|
+
while (lo < hi) {
|
|
593
|
+
const mid = lo + hi >>> 1;
|
|
594
|
+
if (sorted[mid] < oldIdx)
|
|
595
|
+
lo = mid + 1;
|
|
596
|
+
else
|
|
597
|
+
hi = mid;
|
|
598
|
+
}
|
|
599
|
+
return oldIdx - lo;
|
|
600
|
+
};
|
|
601
|
+
const firstRemoved = sorted[0];
|
|
602
|
+
const shiftedDocFieldCount = /* @__PURE__ */ new Map;
|
|
603
|
+
for (const [oldKey, count] of index.docFieldCount)
|
|
604
|
+
shiftedDocFieldCount.set(oldKey > firstRemoved ? shift(oldKey) : oldKey, count);
|
|
605
|
+
index.docFieldCount = shiftedDocFieldCount;
|
|
606
|
+
const shiftedDocTermFieldHits = /* @__PURE__ */ new Map;
|
|
607
|
+
for (const [oldKey, terms] of index.docTermFieldHits)
|
|
608
|
+
shiftedDocTermFieldHits.set(oldKey > firstRemoved ? shift(oldKey) : oldKey, terms);
|
|
609
|
+
index.docTermFieldHits = shiftedDocTermFieldHits;
|
|
610
|
+
}
|
|
611
|
+
var INCORRECT_INDEX_TYPE = "Incorrect 'index' type", INVALID_DOC_INDEX = "Invalid doc index: must be a non-negative integer within the bounds of the docs array", LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY = (key) => `Invalid value for key ${key}`, PATTERN_LENGTH_TOO_LARGE = (max) => `Pattern length exceeds max of ${max}.`, MISSING_KEY_PROPERTY = (name) => `Missing ${name} property in key`, INVALID_KEY_WEIGHT_VALUE = (key) => `Property 'weight' in key '${key}' must be a positive integer`, FUSE_MATCH_TOKEN_SEARCH_UNSUPPORTED = "Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.", hasOwn, KeyStore = class {
|
|
612
|
+
constructor(keys) {
|
|
613
|
+
this._keys = [];
|
|
614
|
+
this._keyMap = {};
|
|
615
|
+
let totalWeight = 0;
|
|
616
|
+
keys.forEach((key) => {
|
|
617
|
+
const obj = createKey(key);
|
|
618
|
+
this._keys.push(obj);
|
|
619
|
+
this._keyMap[obj.id] = obj;
|
|
620
|
+
totalWeight += obj.weight;
|
|
621
|
+
});
|
|
622
|
+
this._keys.forEach((key) => {
|
|
623
|
+
key.weight /= totalWeight;
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
get(keyId) {
|
|
627
|
+
return this._keyMap[keyId];
|
|
628
|
+
}
|
|
629
|
+
keys() {
|
|
630
|
+
return this._keys;
|
|
631
|
+
}
|
|
632
|
+
toJSON() {
|
|
633
|
+
return JSON.stringify(this._keys);
|
|
634
|
+
}
|
|
635
|
+
}, MatchOptions, BasicOptions, FuzzyOptions, AdvancedOptions, Config, FuseIndex = class {
|
|
636
|
+
constructor({ getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) {
|
|
637
|
+
this.norm = norm(fieldNormWeight, 3);
|
|
638
|
+
this.getFn = getFn;
|
|
639
|
+
this.isCreated = false;
|
|
640
|
+
this.docs = [];
|
|
641
|
+
this.keys = [];
|
|
642
|
+
this._keysMap = {};
|
|
643
|
+
this.setIndexRecords();
|
|
644
|
+
}
|
|
645
|
+
setSources(docs = []) {
|
|
646
|
+
this.docs = docs;
|
|
647
|
+
}
|
|
648
|
+
setIndexRecords(records = []) {
|
|
649
|
+
this.records = records;
|
|
650
|
+
}
|
|
651
|
+
setKeys(keys = []) {
|
|
652
|
+
this.keys = keys;
|
|
653
|
+
this._keysMap = {};
|
|
654
|
+
keys.forEach((key, idx) => {
|
|
655
|
+
this._keysMap[key.id] = idx;
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
create() {
|
|
659
|
+
if (this.isCreated || !this.docs.length)
|
|
660
|
+
return;
|
|
661
|
+
this.isCreated = true;
|
|
662
|
+
const len = this.docs.length;
|
|
663
|
+
this.records = new Array(len);
|
|
664
|
+
let recordCount = 0;
|
|
665
|
+
if (isString(this.docs[0]))
|
|
666
|
+
for (let i = 0;i < len; i++) {
|
|
667
|
+
const record = this._createStringRecord(this.docs[i], i);
|
|
668
|
+
if (record)
|
|
669
|
+
this.records[recordCount++] = record;
|
|
670
|
+
}
|
|
671
|
+
else
|
|
672
|
+
for (let i = 0;i < len; i++)
|
|
673
|
+
this.records[recordCount++] = this._createObjectRecord(this.docs[i], i);
|
|
674
|
+
this.records.length = recordCount;
|
|
675
|
+
this.norm.clear();
|
|
676
|
+
}
|
|
677
|
+
add(doc, docIndex) {
|
|
678
|
+
if (!Number.isInteger(docIndex) || docIndex < 0)
|
|
679
|
+
throw new Error(INVALID_DOC_INDEX);
|
|
680
|
+
if (isString(doc)) {
|
|
681
|
+
const record2 = this._createStringRecord(doc, docIndex);
|
|
682
|
+
if (record2)
|
|
683
|
+
this.records.push(record2);
|
|
684
|
+
return record2;
|
|
685
|
+
}
|
|
686
|
+
const record = this._createObjectRecord(doc, docIndex);
|
|
687
|
+
this.records.push(record);
|
|
688
|
+
return record;
|
|
689
|
+
}
|
|
690
|
+
removeAt(idx) {
|
|
691
|
+
if (!Number.isInteger(idx) || idx < 0)
|
|
692
|
+
throw new Error(INVALID_DOC_INDEX);
|
|
693
|
+
for (let i = 0, len = this.records.length;i < len; i += 1)
|
|
694
|
+
if (this.records[i].i === idx) {
|
|
695
|
+
this.records.splice(i, 1);
|
|
696
|
+
break;
|
|
697
|
+
}
|
|
698
|
+
for (let i = 0, len = this.records.length;i < len; i += 1)
|
|
699
|
+
if (this.records[i].i > idx)
|
|
700
|
+
this.records[i].i -= 1;
|
|
701
|
+
}
|
|
702
|
+
removeAll(indices) {
|
|
703
|
+
const toRemove = /* @__PURE__ */ new Set;
|
|
704
|
+
for (const v of indices)
|
|
705
|
+
if (Number.isInteger(v) && v >= 0)
|
|
706
|
+
toRemove.add(v);
|
|
707
|
+
if (toRemove.size === 0)
|
|
708
|
+
return;
|
|
709
|
+
this.records = this.records.filter((r) => !toRemove.has(r.i));
|
|
710
|
+
const sorted = Array.from(toRemove).sort((a, b) => a - b);
|
|
711
|
+
for (const record of this.records) {
|
|
712
|
+
let lo = 0;
|
|
713
|
+
let hi = sorted.length;
|
|
714
|
+
while (lo < hi) {
|
|
715
|
+
const mid = lo + hi >>> 1;
|
|
716
|
+
if (sorted[mid] < record.i)
|
|
717
|
+
lo = mid + 1;
|
|
718
|
+
else
|
|
719
|
+
hi = mid;
|
|
720
|
+
}
|
|
721
|
+
record.i -= lo;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
getValueForItemAtKeyId(item, keyId) {
|
|
725
|
+
return item[this._keysMap[keyId]];
|
|
726
|
+
}
|
|
727
|
+
size() {
|
|
728
|
+
return this.records.length;
|
|
729
|
+
}
|
|
730
|
+
_createStringRecord(doc, docIndex) {
|
|
731
|
+
if (!isDefined(doc) || isBlank(doc))
|
|
732
|
+
return null;
|
|
733
|
+
return {
|
|
734
|
+
v: doc,
|
|
735
|
+
i: docIndex,
|
|
736
|
+
n: this.norm.get(doc)
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
_createObjectRecord(doc, docIndex) {
|
|
740
|
+
const record = {
|
|
741
|
+
i: docIndex,
|
|
742
|
+
$: {}
|
|
743
|
+
};
|
|
744
|
+
for (let keyIndex = 0, keyLen = this.keys.length;keyIndex < keyLen; keyIndex++) {
|
|
745
|
+
const key = this.keys[keyIndex];
|
|
746
|
+
const value = key.getFn ? key.getFn(doc) : this.getFn(doc, key.path);
|
|
747
|
+
if (!isDefined(value))
|
|
748
|
+
continue;
|
|
749
|
+
if (isArray(value)) {
|
|
750
|
+
const subRecords = [];
|
|
751
|
+
for (let i = 0, len = value.length;i < len; i += 1) {
|
|
752
|
+
const item = value[i];
|
|
753
|
+
if (!isDefined(item))
|
|
754
|
+
continue;
|
|
755
|
+
if (isString(item)) {
|
|
756
|
+
if (!isBlank(item)) {
|
|
757
|
+
const subRecord = {
|
|
758
|
+
v: item,
|
|
759
|
+
i,
|
|
760
|
+
n: this.norm.get(item)
|
|
761
|
+
};
|
|
762
|
+
subRecords.push(subRecord);
|
|
763
|
+
}
|
|
764
|
+
} else if (isDefined(item.v)) {
|
|
765
|
+
const text = isString(item.v) ? item.v : toString(item.v);
|
|
766
|
+
if (!isBlank(text)) {
|
|
767
|
+
const subRecord = {
|
|
768
|
+
v: text,
|
|
769
|
+
i: item.i,
|
|
770
|
+
n: this.norm.get(text)
|
|
771
|
+
};
|
|
772
|
+
subRecords.push(subRecord);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
record.$[keyIndex] = subRecords;
|
|
777
|
+
} else if (isString(value) && !isBlank(value)) {
|
|
778
|
+
const subRecord = {
|
|
779
|
+
v: value,
|
|
780
|
+
n: this.norm.get(value)
|
|
781
|
+
};
|
|
782
|
+
record.$[keyIndex] = subRecord;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
return record;
|
|
786
|
+
}
|
|
787
|
+
toJSON() {
|
|
788
|
+
return {
|
|
789
|
+
keys: this.keys.map(({ getFn, ...key }) => key),
|
|
790
|
+
records: this.records
|
|
791
|
+
};
|
|
792
|
+
}
|
|
793
|
+
}, NON_DECOMPOSABLE_MAP, NON_DECOMPOSABLE_RE, stripDiacritics, BitapSearch = class {
|
|
794
|
+
constructor(pattern, { location = Config.location, threshold = Config.threshold, distance = Config.distance, includeMatches = Config.includeMatches, findAllMatches = Config.findAllMatches, minMatchCharLength = Config.minMatchCharLength, isCaseSensitive = Config.isCaseSensitive, ignoreDiacritics = Config.ignoreDiacritics, ignoreLocation = Config.ignoreLocation } = {}) {
|
|
795
|
+
this.options = {
|
|
796
|
+
location,
|
|
797
|
+
threshold,
|
|
798
|
+
distance,
|
|
799
|
+
includeMatches,
|
|
800
|
+
findAllMatches,
|
|
801
|
+
minMatchCharLength,
|
|
802
|
+
isCaseSensitive,
|
|
803
|
+
ignoreDiacritics,
|
|
804
|
+
ignoreLocation
|
|
805
|
+
};
|
|
806
|
+
pattern = isCaseSensitive ? pattern : pattern.toLowerCase();
|
|
807
|
+
pattern = ignoreDiacritics ? stripDiacritics(pattern) : pattern;
|
|
808
|
+
this.pattern = pattern;
|
|
809
|
+
this.chunks = [];
|
|
810
|
+
if (!this.pattern.length)
|
|
811
|
+
return;
|
|
812
|
+
const addChunk = (pattern2, startIndex) => {
|
|
813
|
+
this.chunks.push({
|
|
814
|
+
pattern: pattern2,
|
|
815
|
+
alphabet: createPatternAlphabet(pattern2),
|
|
816
|
+
startIndex
|
|
817
|
+
});
|
|
818
|
+
};
|
|
819
|
+
const len = this.pattern.length;
|
|
820
|
+
if (len > 32) {
|
|
821
|
+
let i = 0;
|
|
822
|
+
const remainder = len % 32;
|
|
823
|
+
const end = len - remainder;
|
|
824
|
+
while (i < end) {
|
|
825
|
+
addChunk(this.pattern.substr(i, 32), i);
|
|
826
|
+
i += 32;
|
|
827
|
+
}
|
|
828
|
+
if (remainder) {
|
|
829
|
+
const startIndex = len - 32;
|
|
830
|
+
addChunk(this.pattern.substr(startIndex), startIndex);
|
|
831
|
+
}
|
|
832
|
+
} else
|
|
833
|
+
addChunk(this.pattern, 0);
|
|
834
|
+
}
|
|
835
|
+
searchIn(text) {
|
|
836
|
+
const { isCaseSensitive, ignoreDiacritics, includeMatches } = this.options;
|
|
837
|
+
text = isCaseSensitive ? text : text.toLowerCase();
|
|
838
|
+
text = ignoreDiacritics ? stripDiacritics(text) : text;
|
|
839
|
+
if (this.pattern === text) {
|
|
840
|
+
if (text.length < this.options.minMatchCharLength)
|
|
841
|
+
return {
|
|
842
|
+
isMatch: false,
|
|
843
|
+
score: 1
|
|
844
|
+
};
|
|
845
|
+
const result2 = {
|
|
846
|
+
isMatch: true,
|
|
847
|
+
score: 0
|
|
848
|
+
};
|
|
849
|
+
if (includeMatches)
|
|
850
|
+
result2.indices = [[0, text.length - 1]];
|
|
851
|
+
return result2;
|
|
852
|
+
}
|
|
853
|
+
const { location, distance, threshold, findAllMatches, minMatchCharLength, ignoreLocation } = this.options;
|
|
854
|
+
const allIndices = [];
|
|
855
|
+
let totalScore = 0;
|
|
856
|
+
let hasMatches = false;
|
|
857
|
+
this.chunks.forEach(({ pattern, alphabet, startIndex }) => {
|
|
858
|
+
const { isMatch, score, indices } = search(text, pattern, alphabet, {
|
|
859
|
+
location: location + startIndex,
|
|
860
|
+
distance,
|
|
861
|
+
threshold,
|
|
862
|
+
findAllMatches,
|
|
863
|
+
minMatchCharLength,
|
|
864
|
+
includeMatches,
|
|
865
|
+
ignoreLocation
|
|
866
|
+
});
|
|
867
|
+
if (isMatch)
|
|
868
|
+
hasMatches = true;
|
|
869
|
+
totalScore += score;
|
|
870
|
+
if (isMatch && indices)
|
|
871
|
+
allIndices.push(...indices);
|
|
872
|
+
});
|
|
873
|
+
const result = {
|
|
874
|
+
isMatch: hasMatches,
|
|
875
|
+
score: hasMatches ? totalScore / this.chunks.length : 1
|
|
876
|
+
};
|
|
877
|
+
if (hasMatches && includeMatches)
|
|
878
|
+
result.indices = mergeIndices(allIndices);
|
|
879
|
+
return result;
|
|
880
|
+
}
|
|
881
|
+
}, MULTI_MATCH_TYPES, matchers, matchersLen, ESCAPED_PIPE = "\x00", OR_TOKEN = "|", ExtendedSearch = class {
|
|
882
|
+
constructor(pattern, { isCaseSensitive = Config.isCaseSensitive, ignoreDiacritics = Config.ignoreDiacritics, includeMatches = Config.includeMatches, minMatchCharLength = Config.minMatchCharLength, ignoreLocation = Config.ignoreLocation, findAllMatches = Config.findAllMatches, location = Config.location, threshold = Config.threshold, distance = Config.distance } = {}) {
|
|
883
|
+
this.query = null;
|
|
884
|
+
this.options = {
|
|
885
|
+
isCaseSensitive,
|
|
886
|
+
ignoreDiacritics,
|
|
887
|
+
includeMatches,
|
|
888
|
+
minMatchCharLength,
|
|
889
|
+
findAllMatches,
|
|
890
|
+
ignoreLocation,
|
|
891
|
+
location,
|
|
892
|
+
threshold,
|
|
893
|
+
distance
|
|
894
|
+
};
|
|
895
|
+
pattern = isCaseSensitive ? pattern : pattern.toLowerCase();
|
|
896
|
+
pattern = ignoreDiacritics ? stripDiacritics(pattern) : pattern;
|
|
897
|
+
this.pattern = pattern;
|
|
898
|
+
this.query = parseQuery(this.pattern, this.options);
|
|
899
|
+
}
|
|
900
|
+
static condition(_, options) {
|
|
901
|
+
return options.useExtendedSearch;
|
|
902
|
+
}
|
|
903
|
+
searchIn(text) {
|
|
904
|
+
const query = this.query;
|
|
905
|
+
if (!query)
|
|
906
|
+
return {
|
|
907
|
+
isMatch: false,
|
|
908
|
+
score: 1
|
|
909
|
+
};
|
|
910
|
+
const { includeMatches, isCaseSensitive, ignoreDiacritics } = this.options;
|
|
911
|
+
text = isCaseSensitive ? text : text.toLowerCase();
|
|
912
|
+
text = ignoreDiacritics ? stripDiacritics(text) : text;
|
|
913
|
+
let numMatches = 0;
|
|
914
|
+
const allIndices = [];
|
|
915
|
+
let totalScore = 0;
|
|
916
|
+
let hasInverse = false;
|
|
917
|
+
for (let i = 0, qLen = query.length;i < qLen; i += 1) {
|
|
918
|
+
const searchers = query[i];
|
|
919
|
+
allIndices.length = 0;
|
|
920
|
+
numMatches = 0;
|
|
921
|
+
hasInverse = false;
|
|
922
|
+
for (let j = 0, pLen = searchers.length;j < pLen; j += 1) {
|
|
923
|
+
const matcher = searchers[j];
|
|
924
|
+
const { isMatch, indices, score } = matcher.search(text);
|
|
925
|
+
if (isMatch) {
|
|
926
|
+
numMatches += 1;
|
|
927
|
+
totalScore += score;
|
|
928
|
+
if (isInverse(matcher.type))
|
|
929
|
+
hasInverse = true;
|
|
930
|
+
if (includeMatches)
|
|
931
|
+
if (MULTI_MATCH_TYPES.has(matcher.type))
|
|
932
|
+
allIndices.push(...indices);
|
|
933
|
+
else
|
|
934
|
+
allIndices.push(indices);
|
|
935
|
+
} else {
|
|
936
|
+
totalScore = 0;
|
|
937
|
+
numMatches = 0;
|
|
938
|
+
allIndices.length = 0;
|
|
939
|
+
hasInverse = false;
|
|
940
|
+
break;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
if (numMatches) {
|
|
944
|
+
const result = {
|
|
945
|
+
isMatch: true,
|
|
946
|
+
score: totalScore / numMatches
|
|
947
|
+
};
|
|
948
|
+
if (hasInverse)
|
|
949
|
+
result.hasInverse = true;
|
|
950
|
+
if (includeMatches)
|
|
951
|
+
result.indices = mergeIndices(allIndices);
|
|
952
|
+
return result;
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
return {
|
|
956
|
+
isMatch: false,
|
|
957
|
+
score: 1
|
|
958
|
+
};
|
|
959
|
+
}
|
|
960
|
+
}, registeredSearchers, LogicalOperator, KeyType, isExpression = (query) => !!(query[LogicalOperator.AND] || query[LogicalOperator.OR]), isPath = (query) => !!query[KeyType.PATH], isLeaf = (query) => !isArray(query) && isObject(query) && !isExpression(query), convertToExplicit = (query) => ({ [LogicalOperator.AND]: Object.keys(query).map((key) => ({ [key]: query[key] })) }), MaxHeap = class {
|
|
961
|
+
constructor(limit, comparator) {
|
|
962
|
+
this.limit = limit;
|
|
963
|
+
this.heap = [];
|
|
964
|
+
this.comparator = comparator;
|
|
965
|
+
}
|
|
966
|
+
get size() {
|
|
967
|
+
return this.heap.length;
|
|
968
|
+
}
|
|
969
|
+
insert(item) {
|
|
970
|
+
if (this.size < this.limit) {
|
|
971
|
+
this.heap.push(item);
|
|
972
|
+
this._bubbleUp(this.size - 1);
|
|
973
|
+
} else if (this.comparator(item, this.heap[0]) < 0) {
|
|
974
|
+
this.heap[0] = item;
|
|
975
|
+
this._sinkDown(0);
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
extractSorted() {
|
|
979
|
+
return this.heap.sort(this.comparator);
|
|
980
|
+
}
|
|
981
|
+
_bubbleUp(i) {
|
|
982
|
+
const heap = this.heap;
|
|
983
|
+
while (i > 0) {
|
|
984
|
+
const parent = i - 1 >> 1;
|
|
985
|
+
if (this.comparator(heap[i], heap[parent]) <= 0)
|
|
986
|
+
break;
|
|
987
|
+
const tmp = heap[i];
|
|
988
|
+
heap[i] = heap[parent];
|
|
989
|
+
heap[parent] = tmp;
|
|
990
|
+
i = parent;
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
_sinkDown(i) {
|
|
994
|
+
const heap = this.heap;
|
|
995
|
+
const len = heap.length;
|
|
996
|
+
let largest = i;
|
|
997
|
+
do {
|
|
998
|
+
i = largest;
|
|
999
|
+
const left = 2 * i + 1;
|
|
1000
|
+
const right = 2 * i + 2;
|
|
1001
|
+
if (left < len && this.comparator(heap[left], heap[largest]) > 0)
|
|
1002
|
+
largest = left;
|
|
1003
|
+
if (right < len && this.comparator(heap[right], heap[largest]) > 0)
|
|
1004
|
+
largest = right;
|
|
1005
|
+
if (largest !== i) {
|
|
1006
|
+
const tmp = heap[i];
|
|
1007
|
+
heap[i] = heap[largest];
|
|
1008
|
+
heap[largest] = tmp;
|
|
1009
|
+
}
|
|
1010
|
+
} while (largest !== i);
|
|
1011
|
+
}
|
|
1012
|
+
}, DEFAULT_TOKEN, warned, TokenSearch = class {
|
|
1013
|
+
static condition(_, options) {
|
|
1014
|
+
return options.useTokenSearch;
|
|
1015
|
+
}
|
|
1016
|
+
constructor(pattern, options) {
|
|
1017
|
+
this.options = options;
|
|
1018
|
+
this.analyzer = createAnalyzer({
|
|
1019
|
+
isCaseSensitive: options.isCaseSensitive,
|
|
1020
|
+
ignoreDiacritics: options.ignoreDiacritics,
|
|
1021
|
+
tokenize: options.tokenize
|
|
1022
|
+
});
|
|
1023
|
+
const queryTerms = this.analyzer.tokenize(pattern);
|
|
1024
|
+
const { df, fieldCount } = options._invertedIndex;
|
|
1025
|
+
this.termSearchers = [];
|
|
1026
|
+
this.idfWeights = [];
|
|
1027
|
+
for (const term of queryTerms) {
|
|
1028
|
+
this.termSearchers.push(new BitapSearch(term, {
|
|
1029
|
+
location: options.location,
|
|
1030
|
+
threshold: options.threshold,
|
|
1031
|
+
distance: options.distance,
|
|
1032
|
+
includeMatches: options.includeMatches,
|
|
1033
|
+
findAllMatches: options.findAllMatches,
|
|
1034
|
+
minMatchCharLength: options.minMatchCharLength,
|
|
1035
|
+
isCaseSensitive: options.isCaseSensitive,
|
|
1036
|
+
ignoreDiacritics: options.ignoreDiacritics,
|
|
1037
|
+
ignoreLocation: true
|
|
1038
|
+
}));
|
|
1039
|
+
const docFreq = df.get(term) || 0;
|
|
1040
|
+
const idf = Math.log(1 + (fieldCount - docFreq + 0.5) / (docFreq + 0.5));
|
|
1041
|
+
this.idfWeights.push(idf);
|
|
1042
|
+
}
|
|
1043
|
+
this.combineAll = options.tokenMatch === "all";
|
|
1044
|
+
this.numTerms = this.termSearchers.length;
|
|
1045
|
+
this.useMask = this.numTerms <= 31;
|
|
1046
|
+
}
|
|
1047
|
+
searchIn(text) {
|
|
1048
|
+
if (!this.termSearchers.length)
|
|
1049
|
+
return {
|
|
1050
|
+
isMatch: false,
|
|
1051
|
+
score: 1
|
|
1052
|
+
};
|
|
1053
|
+
const allIndices = [];
|
|
1054
|
+
let weightedScore = 0;
|
|
1055
|
+
let maxPossibleScore = 0;
|
|
1056
|
+
let matchedCount = 0;
|
|
1057
|
+
let matchedMask = 0;
|
|
1058
|
+
const matchedTerms = this.combineAll && !this.useMask ? /* @__PURE__ */ new Set : null;
|
|
1059
|
+
for (let i = 0;i < this.termSearchers.length; i++) {
|
|
1060
|
+
const result = this.termSearchers[i].searchIn(text);
|
|
1061
|
+
const idf = this.idfWeights[i];
|
|
1062
|
+
maxPossibleScore += idf;
|
|
1063
|
+
if (result.isMatch) {
|
|
1064
|
+
matchedCount++;
|
|
1065
|
+
weightedScore += idf * (1 - result.score);
|
|
1066
|
+
if (result.indices)
|
|
1067
|
+
allIndices.push(...result.indices);
|
|
1068
|
+
if (this.combineAll)
|
|
1069
|
+
if (this.useMask)
|
|
1070
|
+
matchedMask |= 1 << i;
|
|
1071
|
+
else
|
|
1072
|
+
matchedTerms.add(i);
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
if (matchedCount === 0)
|
|
1076
|
+
return {
|
|
1077
|
+
isMatch: false,
|
|
1078
|
+
score: 1
|
|
1079
|
+
};
|
|
1080
|
+
const normalized = maxPossibleScore > 0 ? 1 - weightedScore / maxPossibleScore : 0;
|
|
1081
|
+
const searchResult = {
|
|
1082
|
+
isMatch: true,
|
|
1083
|
+
score: Math.max(0.001, normalized)
|
|
1084
|
+
};
|
|
1085
|
+
if (this.options.includeMatches && allIndices.length)
|
|
1086
|
+
searchResult.indices = mergeIndices(allIndices);
|
|
1087
|
+
if (this.combineAll) {
|
|
1088
|
+
if (this.useMask)
|
|
1089
|
+
searchResult.matchedMask = matchedMask;
|
|
1090
|
+
else
|
|
1091
|
+
searchResult.matchedTerms = matchedTerms;
|
|
1092
|
+
searchResult.termCount = this.numTerms;
|
|
1093
|
+
}
|
|
1094
|
+
return searchResult;
|
|
1095
|
+
}
|
|
1096
|
+
}, Fuse = class {
|
|
1097
|
+
constructor(docs, options, index) {
|
|
1098
|
+
this.options = {
|
|
1099
|
+
...Config,
|
|
1100
|
+
...options
|
|
1101
|
+
};
|
|
1102
|
+
if (this.options.useExtendedSearch && false)
|
|
1103
|
+
;
|
|
1104
|
+
if (this.options.useTokenSearch && false)
|
|
1105
|
+
;
|
|
1106
|
+
this._keyStore = new KeyStore(this.options.keys);
|
|
1107
|
+
this._docs = docs;
|
|
1108
|
+
this._myIndex = null;
|
|
1109
|
+
this._invertedIndex = null;
|
|
1110
|
+
this.setCollection(docs, index);
|
|
1111
|
+
this._lastQuery = null;
|
|
1112
|
+
this._lastSearcher = null;
|
|
1113
|
+
}
|
|
1114
|
+
_getSearcher(query) {
|
|
1115
|
+
if (this._lastQuery === query)
|
|
1116
|
+
return this._lastSearcher;
|
|
1117
|
+
const searcher = createSearcher(query, this._invertedIndex ? {
|
|
1118
|
+
...this.options,
|
|
1119
|
+
_invertedIndex: this._invertedIndex
|
|
1120
|
+
} : this.options);
|
|
1121
|
+
this._lastQuery = query;
|
|
1122
|
+
this._lastSearcher = searcher;
|
|
1123
|
+
return searcher;
|
|
1124
|
+
}
|
|
1125
|
+
setCollection(docs, index) {
|
|
1126
|
+
this._docs = docs;
|
|
1127
|
+
if (index && !(index instanceof FuseIndex))
|
|
1128
|
+
throw new Error(INCORRECT_INDEX_TYPE);
|
|
1129
|
+
this._myIndex = index || createIndex(this.options.keys, this._docs, {
|
|
1130
|
+
getFn: this.options.getFn,
|
|
1131
|
+
fieldNormWeight: this.options.fieldNormWeight
|
|
1132
|
+
});
|
|
1133
|
+
if (this.options.useTokenSearch) {
|
|
1134
|
+
const analyzer = createAnalyzer({
|
|
1135
|
+
isCaseSensitive: this.options.isCaseSensitive,
|
|
1136
|
+
ignoreDiacritics: this.options.ignoreDiacritics,
|
|
1137
|
+
tokenize: this.options.tokenize
|
|
1138
|
+
});
|
|
1139
|
+
this._invertedIndex = buildInvertedIndex(this._myIndex.records, this._myIndex.keys.length, analyzer);
|
|
1140
|
+
}
|
|
1141
|
+
this._invalidateSearcherCache();
|
|
1142
|
+
}
|
|
1143
|
+
add(doc) {
|
|
1144
|
+
if (!isDefined(doc))
|
|
1145
|
+
return;
|
|
1146
|
+
this._docs.push(doc);
|
|
1147
|
+
const record = this._myIndex.add(doc, this._docs.length - 1);
|
|
1148
|
+
if (this._invertedIndex && record) {
|
|
1149
|
+
const analyzer = createAnalyzer({
|
|
1150
|
+
isCaseSensitive: this.options.isCaseSensitive,
|
|
1151
|
+
ignoreDiacritics: this.options.ignoreDiacritics,
|
|
1152
|
+
tokenize: this.options.tokenize
|
|
1153
|
+
});
|
|
1154
|
+
addToInvertedIndex(this._invertedIndex, record, this._myIndex.keys.length, analyzer);
|
|
1155
|
+
}
|
|
1156
|
+
this._invalidateSearcherCache();
|
|
1157
|
+
}
|
|
1158
|
+
remove(predicate = () => false) {
|
|
1159
|
+
const results = [];
|
|
1160
|
+
const indicesToRemove = [];
|
|
1161
|
+
for (let i = 0, len = this._docs.length;i < len; i += 1)
|
|
1162
|
+
if (predicate(this._docs[i], i)) {
|
|
1163
|
+
results.push(this._docs[i]);
|
|
1164
|
+
indicesToRemove.push(i);
|
|
1165
|
+
}
|
|
1166
|
+
if (indicesToRemove.length) {
|
|
1167
|
+
if (this._invertedIndex)
|
|
1168
|
+
removeAndShiftInvertedIndex(this._invertedIndex, indicesToRemove);
|
|
1169
|
+
const toRemove = new Set(indicesToRemove);
|
|
1170
|
+
this._docs = this._docs.filter((_, i) => !toRemove.has(i));
|
|
1171
|
+
this._myIndex.removeAll(indicesToRemove);
|
|
1172
|
+
this._invalidateSearcherCache();
|
|
1173
|
+
}
|
|
1174
|
+
return results;
|
|
1175
|
+
}
|
|
1176
|
+
removeAt(idx) {
|
|
1177
|
+
if (!Number.isInteger(idx) || idx < 0 || idx >= this._docs.length)
|
|
1178
|
+
throw new Error(INVALID_DOC_INDEX);
|
|
1179
|
+
if (this._invertedIndex)
|
|
1180
|
+
removeAndShiftInvertedIndex(this._invertedIndex, [idx]);
|
|
1181
|
+
const doc = this._docs.splice(idx, 1)[0];
|
|
1182
|
+
this._myIndex.removeAt(idx);
|
|
1183
|
+
this._invalidateSearcherCache();
|
|
1184
|
+
return doc;
|
|
1185
|
+
}
|
|
1186
|
+
_invalidateSearcherCache() {
|
|
1187
|
+
this._lastQuery = null;
|
|
1188
|
+
this._lastSearcher = null;
|
|
1189
|
+
}
|
|
1190
|
+
getIndex() {
|
|
1191
|
+
return this._myIndex;
|
|
1192
|
+
}
|
|
1193
|
+
_normalizedKeys() {
|
|
1194
|
+
return this._myIndex.keys.map((key) => this._keyStore.get(key.id) || key);
|
|
1195
|
+
}
|
|
1196
|
+
search(query, options) {
|
|
1197
|
+
const { limit = -1 } = options || {};
|
|
1198
|
+
const { includeMatches, includeScore, shouldSort, sortFn, ignoreFieldNorm } = this.options;
|
|
1199
|
+
if (isString(query) && !query.trim()) {
|
|
1200
|
+
let docs = this._docs.map((item, idx) => ({
|
|
1201
|
+
item,
|
|
1202
|
+
refIndex: idx
|
|
1203
|
+
}));
|
|
1204
|
+
if (isNumber(limit) && limit > -1)
|
|
1205
|
+
docs = docs.slice(0, limit);
|
|
1206
|
+
return docs;
|
|
1207
|
+
}
|
|
1208
|
+
const useHeap = shouldSort && isNumber(limit) && limit > 0 && isString(query);
|
|
1209
|
+
const comparator = sortFn;
|
|
1210
|
+
const stable = (a, b) => comparator(a, b) || a.idx - b.idx;
|
|
1211
|
+
let results;
|
|
1212
|
+
if (useHeap) {
|
|
1213
|
+
const heap = new MaxHeap(limit, stable);
|
|
1214
|
+
if (isString(this._docs[0]))
|
|
1215
|
+
this._searchStringList(query, {
|
|
1216
|
+
heap,
|
|
1217
|
+
ignoreFieldNorm
|
|
1218
|
+
});
|
|
1219
|
+
else
|
|
1220
|
+
this._searchObjectList(query, {
|
|
1221
|
+
heap,
|
|
1222
|
+
ignoreFieldNorm
|
|
1223
|
+
});
|
|
1224
|
+
results = heap.extractSorted();
|
|
1225
|
+
} else {
|
|
1226
|
+
results = isString(query) ? isString(this._docs[0]) ? this._searchStringList(query) : this._searchObjectList(query) : this._searchLogical(query);
|
|
1227
|
+
computeScore(results, { ignoreFieldNorm });
|
|
1228
|
+
if (shouldSort)
|
|
1229
|
+
results.sort(isString(query) ? stable : comparator);
|
|
1230
|
+
if (isNumber(limit) && limit > -1)
|
|
1231
|
+
results = results.slice(0, limit);
|
|
1232
|
+
}
|
|
1233
|
+
return format(results, this._docs, {
|
|
1234
|
+
includeMatches,
|
|
1235
|
+
includeScore
|
|
1236
|
+
});
|
|
1237
|
+
}
|
|
1238
|
+
_searchStringList(query, { heap, ignoreFieldNorm } = {}) {
|
|
1239
|
+
const searcher = this._getSearcher(query);
|
|
1240
|
+
const requireAllTokens = this.options.useTokenSearch && this.options.tokenMatch === "all";
|
|
1241
|
+
const { records } = this._myIndex;
|
|
1242
|
+
const results = heap ? null : [];
|
|
1243
|
+
records.forEach(({ v: text, i: idx, n: norm2 }) => {
|
|
1244
|
+
if (!isDefined(text))
|
|
1245
|
+
return;
|
|
1246
|
+
const searchResult = searcher.searchIn(text);
|
|
1247
|
+
if (searchResult.isMatch) {
|
|
1248
|
+
const match = {
|
|
1249
|
+
score: searchResult.score,
|
|
1250
|
+
value: text,
|
|
1251
|
+
norm: norm2,
|
|
1252
|
+
indices: searchResult.indices
|
|
1253
|
+
};
|
|
1254
|
+
if (requireAllTokens) {
|
|
1255
|
+
match.matchedMask = searchResult.matchedMask;
|
|
1256
|
+
match.matchedTerms = searchResult.matchedTerms;
|
|
1257
|
+
match.termCount = searchResult.termCount;
|
|
1258
|
+
}
|
|
1259
|
+
const matches = [match];
|
|
1260
|
+
if (!requireAllTokens || this._coversAllTokens(matches)) {
|
|
1261
|
+
const result = {
|
|
1262
|
+
item: text,
|
|
1263
|
+
idx,
|
|
1264
|
+
matches
|
|
1265
|
+
};
|
|
1266
|
+
if (heap) {
|
|
1267
|
+
result.score = computeScoreSingle(result.matches, { ignoreFieldNorm });
|
|
1268
|
+
heap.insert(result);
|
|
1269
|
+
} else
|
|
1270
|
+
results.push(result);
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
});
|
|
1274
|
+
return results;
|
|
1275
|
+
}
|
|
1276
|
+
_searchLogical(query) {
|
|
1277
|
+
const expression = parse(query, this.options);
|
|
1278
|
+
const keys = this._normalizedKeys();
|
|
1279
|
+
const evaluate = (node, item, idx) => {
|
|
1280
|
+
if (!("children" in node)) {
|
|
1281
|
+
const { keyId, searcher } = node;
|
|
1282
|
+
let matches;
|
|
1283
|
+
if (keyId === null) {
|
|
1284
|
+
matches = [];
|
|
1285
|
+
keys.forEach((key, keyIndex) => {
|
|
1286
|
+
matches.push(...this._findMatches({
|
|
1287
|
+
key,
|
|
1288
|
+
value: item[keyIndex],
|
|
1289
|
+
searcher
|
|
1290
|
+
}));
|
|
1291
|
+
});
|
|
1292
|
+
} else
|
|
1293
|
+
matches = this._findMatches({
|
|
1294
|
+
key: this._keyStore.get(keyId),
|
|
1295
|
+
value: this._myIndex.getValueForItemAtKeyId(item, keyId),
|
|
1296
|
+
searcher
|
|
1297
|
+
});
|
|
1298
|
+
if (matches && matches.length)
|
|
1299
|
+
return [{
|
|
1300
|
+
idx,
|
|
1301
|
+
item,
|
|
1302
|
+
matches
|
|
1303
|
+
}];
|
|
1304
|
+
return [];
|
|
1305
|
+
}
|
|
1306
|
+
const { children, operator } = node;
|
|
1307
|
+
const res = [];
|
|
1308
|
+
for (let i = 0, len = children.length;i < len; i += 1) {
|
|
1309
|
+
const child = children[i];
|
|
1310
|
+
const result = evaluate(child, item, idx);
|
|
1311
|
+
if (result.length)
|
|
1312
|
+
res.push(...result);
|
|
1313
|
+
else if (operator === LogicalOperator.AND)
|
|
1314
|
+
return [];
|
|
1315
|
+
}
|
|
1316
|
+
return res;
|
|
1317
|
+
};
|
|
1318
|
+
const records = this._myIndex.records;
|
|
1319
|
+
const resultMap = /* @__PURE__ */ new Map;
|
|
1320
|
+
const results = [];
|
|
1321
|
+
records.forEach(({ $: item, i: idx }) => {
|
|
1322
|
+
if (isDefined(item)) {
|
|
1323
|
+
const expResults = evaluate(expression, item, idx);
|
|
1324
|
+
if (expResults.length) {
|
|
1325
|
+
if (!resultMap.has(idx)) {
|
|
1326
|
+
resultMap.set(idx, {
|
|
1327
|
+
idx,
|
|
1328
|
+
item,
|
|
1329
|
+
matches: []
|
|
1330
|
+
});
|
|
1331
|
+
results.push(resultMap.get(idx));
|
|
1332
|
+
}
|
|
1333
|
+
expResults.forEach(({ matches }) => {
|
|
1334
|
+
resultMap.get(idx).matches.push(...matches);
|
|
1335
|
+
});
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
});
|
|
1339
|
+
return results;
|
|
1340
|
+
}
|
|
1341
|
+
_searchObjectList(query, { heap, ignoreFieldNorm } = {}) {
|
|
1342
|
+
const searcher = this._getSearcher(query);
|
|
1343
|
+
const requireAllTokens = this.options.useTokenSearch && this.options.tokenMatch === "all";
|
|
1344
|
+
const { records } = this._myIndex;
|
|
1345
|
+
const keys = this._normalizedKeys();
|
|
1346
|
+
const results = heap ? null : [];
|
|
1347
|
+
records.forEach(({ $: item, i: idx }) => {
|
|
1348
|
+
if (!isDefined(item))
|
|
1349
|
+
return;
|
|
1350
|
+
const matches = [];
|
|
1351
|
+
let anyKeyFailed = false;
|
|
1352
|
+
let hasInverse = false;
|
|
1353
|
+
keys.forEach((key, keyIndex) => {
|
|
1354
|
+
const keyMatches = this._findMatches({
|
|
1355
|
+
key,
|
|
1356
|
+
value: item[keyIndex],
|
|
1357
|
+
searcher
|
|
1358
|
+
});
|
|
1359
|
+
if (keyMatches.length) {
|
|
1360
|
+
matches.push(...keyMatches);
|
|
1361
|
+
if (keyMatches[0].hasInverse)
|
|
1362
|
+
hasInverse = true;
|
|
1363
|
+
} else
|
|
1364
|
+
anyKeyFailed = true;
|
|
1365
|
+
});
|
|
1366
|
+
if (hasInverse && anyKeyFailed)
|
|
1367
|
+
return;
|
|
1368
|
+
if (matches.length && (!requireAllTokens || this._coversAllTokens(matches))) {
|
|
1369
|
+
const result = {
|
|
1370
|
+
idx,
|
|
1371
|
+
item,
|
|
1372
|
+
matches
|
|
1373
|
+
};
|
|
1374
|
+
if (heap) {
|
|
1375
|
+
result.score = computeScoreSingle(result.matches, { ignoreFieldNorm });
|
|
1376
|
+
heap.insert(result);
|
|
1377
|
+
} else
|
|
1378
|
+
results.push(result);
|
|
1379
|
+
}
|
|
1380
|
+
});
|
|
1381
|
+
return results;
|
|
1382
|
+
}
|
|
1383
|
+
_findMatches({ key, value, searcher }) {
|
|
1384
|
+
if (!isDefined(value))
|
|
1385
|
+
return [];
|
|
1386
|
+
const matches = [];
|
|
1387
|
+
if (isArray(value))
|
|
1388
|
+
value.forEach(({ v: text, i: idx, n: norm2 }) => {
|
|
1389
|
+
if (!isDefined(text))
|
|
1390
|
+
return;
|
|
1391
|
+
const searchResult = searcher.searchIn(text);
|
|
1392
|
+
if (searchResult.isMatch) {
|
|
1393
|
+
const match = {
|
|
1394
|
+
score: searchResult.score,
|
|
1395
|
+
key,
|
|
1396
|
+
value: text,
|
|
1397
|
+
idx,
|
|
1398
|
+
norm: norm2,
|
|
1399
|
+
indices: searchResult.indices,
|
|
1400
|
+
hasInverse: searchResult.hasInverse
|
|
1401
|
+
};
|
|
1402
|
+
if (searchResult.termCount !== undefined) {
|
|
1403
|
+
match.matchedMask = searchResult.matchedMask;
|
|
1404
|
+
match.matchedTerms = searchResult.matchedTerms;
|
|
1405
|
+
match.termCount = searchResult.termCount;
|
|
1406
|
+
}
|
|
1407
|
+
matches.push(match);
|
|
1408
|
+
}
|
|
1409
|
+
});
|
|
1410
|
+
else {
|
|
1411
|
+
const { v: text, n: norm2 } = value;
|
|
1412
|
+
const searchResult = searcher.searchIn(text);
|
|
1413
|
+
if (searchResult.isMatch) {
|
|
1414
|
+
const match = {
|
|
1415
|
+
score: searchResult.score,
|
|
1416
|
+
key,
|
|
1417
|
+
value: text,
|
|
1418
|
+
norm: norm2,
|
|
1419
|
+
indices: searchResult.indices,
|
|
1420
|
+
hasInverse: searchResult.hasInverse
|
|
1421
|
+
};
|
|
1422
|
+
if (searchResult.termCount !== undefined) {
|
|
1423
|
+
match.matchedMask = searchResult.matchedMask;
|
|
1424
|
+
match.matchedTerms = searchResult.matchedTerms;
|
|
1425
|
+
match.termCount = searchResult.termCount;
|
|
1426
|
+
}
|
|
1427
|
+
matches.push(match);
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
return matches;
|
|
1431
|
+
}
|
|
1432
|
+
_coversAllTokens(matches) {
|
|
1433
|
+
const termCount = matches.length ? matches[0].termCount : undefined;
|
|
1434
|
+
if (termCount === undefined)
|
|
1435
|
+
return true;
|
|
1436
|
+
if (termCount <= 31) {
|
|
1437
|
+
let coverage2 = 0;
|
|
1438
|
+
for (let i = 0;i < matches.length; i++)
|
|
1439
|
+
coverage2 |= matches[i].matchedMask || 0;
|
|
1440
|
+
return coverage2 === 2 ** termCount - 1;
|
|
1441
|
+
}
|
|
1442
|
+
const coverage = /* @__PURE__ */ new Set;
|
|
1443
|
+
for (let i = 0;i < matches.length; i++) {
|
|
1444
|
+
const terms = matches[i].matchedTerms;
|
|
1445
|
+
if (terms)
|
|
1446
|
+
for (const t of terms)
|
|
1447
|
+
coverage.add(t);
|
|
1448
|
+
}
|
|
1449
|
+
return coverage.size === termCount;
|
|
1450
|
+
}
|
|
1451
|
+
}, entry_default;
|
|
1452
|
+
var init_fuse = __esm(() => {
|
|
1453
|
+
hasOwn = Object.prototype.hasOwnProperty;
|
|
1454
|
+
MatchOptions = {
|
|
1455
|
+
includeMatches: false,
|
|
1456
|
+
findAllMatches: false,
|
|
1457
|
+
minMatchCharLength: 1
|
|
1458
|
+
};
|
|
1459
|
+
BasicOptions = {
|
|
1460
|
+
isCaseSensitive: false,
|
|
1461
|
+
ignoreDiacritics: false,
|
|
1462
|
+
includeScore: false,
|
|
1463
|
+
keys: [],
|
|
1464
|
+
shouldSort: true,
|
|
1465
|
+
sortFn: (a, b) => a.score === b.score ? a.idx < b.idx ? -1 : 1 : a.score < b.score ? -1 : 1
|
|
1466
|
+
};
|
|
1467
|
+
FuzzyOptions = {
|
|
1468
|
+
location: 0,
|
|
1469
|
+
threshold: 0.6,
|
|
1470
|
+
distance: 100
|
|
1471
|
+
};
|
|
1472
|
+
AdvancedOptions = {
|
|
1473
|
+
useExtendedSearch: false,
|
|
1474
|
+
useTokenSearch: false,
|
|
1475
|
+
tokenize: undefined,
|
|
1476
|
+
tokenMatch: "any",
|
|
1477
|
+
getFn: get,
|
|
1478
|
+
ignoreLocation: false,
|
|
1479
|
+
ignoreFieldNorm: false,
|
|
1480
|
+
fieldNormWeight: 1
|
|
1481
|
+
};
|
|
1482
|
+
Config = Object.freeze({
|
|
1483
|
+
...BasicOptions,
|
|
1484
|
+
...MatchOptions,
|
|
1485
|
+
...FuzzyOptions,
|
|
1486
|
+
...AdvancedOptions
|
|
1487
|
+
});
|
|
1488
|
+
NON_DECOMPOSABLE_MAP = {
|
|
1489
|
+
"\u0142": "l",
|
|
1490
|
+
"\u0141": "L",
|
|
1491
|
+
"\u0111": "d",
|
|
1492
|
+
"\u0110": "D",
|
|
1493
|
+
"\xF8": "o",
|
|
1494
|
+
"\xD8": "O",
|
|
1495
|
+
"\u0127": "h",
|
|
1496
|
+
"\u0126": "H",
|
|
1497
|
+
"\u0167": "t",
|
|
1498
|
+
"\u0166": "T",
|
|
1499
|
+
"\u0131": "i",
|
|
1500
|
+
"\xDF": "ss"
|
|
1501
|
+
};
|
|
1502
|
+
NON_DECOMPOSABLE_RE = new RegExp("[" + Object.keys(NON_DECOMPOSABLE_MAP).join("") + "]", "g");
|
|
1503
|
+
stripDiacritics = typeof String.prototype.normalize === "function" ? (str) => str.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g, "").replace(NON_DECOMPOSABLE_RE, (ch) => NON_DECOMPOSABLE_MAP[ch]) : (str) => str;
|
|
1504
|
+
MULTI_MATCH_TYPES = new Set(["fuzzy", "include"]);
|
|
1505
|
+
matchers = [
|
|
1506
|
+
{
|
|
1507
|
+
type: "exact",
|
|
1508
|
+
multiRegex: /^="(.*)"$/,
|
|
1509
|
+
singleRegex: /^=(.*)$/,
|
|
1510
|
+
create: (pattern) => ({
|
|
1511
|
+
type: "exact",
|
|
1512
|
+
search(text) {
|
|
1513
|
+
const isMatch = text === pattern;
|
|
1514
|
+
return {
|
|
1515
|
+
isMatch,
|
|
1516
|
+
score: isMatch ? 0 : 1,
|
|
1517
|
+
indices: [0, pattern.length - 1]
|
|
1518
|
+
};
|
|
1519
|
+
}
|
|
1520
|
+
})
|
|
1521
|
+
},
|
|
1522
|
+
{
|
|
1523
|
+
type: "include",
|
|
1524
|
+
multiRegex: /^'"(.*)"$/,
|
|
1525
|
+
singleRegex: /^'(.*)$/,
|
|
1526
|
+
create: (pattern) => ({
|
|
1527
|
+
type: "include",
|
|
1528
|
+
search(text) {
|
|
1529
|
+
let location = 0;
|
|
1530
|
+
let index;
|
|
1531
|
+
const indices = [];
|
|
1532
|
+
const patternLen = pattern.length;
|
|
1533
|
+
while ((index = text.indexOf(pattern, location)) > -1) {
|
|
1534
|
+
location = index + patternLen;
|
|
1535
|
+
indices.push([index, location - 1]);
|
|
1536
|
+
}
|
|
1537
|
+
const isMatch = !!indices.length;
|
|
1538
|
+
return {
|
|
1539
|
+
isMatch,
|
|
1540
|
+
score: isMatch ? 0 : 1,
|
|
1541
|
+
indices
|
|
1542
|
+
};
|
|
1543
|
+
}
|
|
1544
|
+
})
|
|
1545
|
+
},
|
|
1546
|
+
{
|
|
1547
|
+
type: "prefix-exact",
|
|
1548
|
+
multiRegex: /^\^"(.*)"$/,
|
|
1549
|
+
singleRegex: /^\^(.*)$/,
|
|
1550
|
+
create: (pattern) => ({
|
|
1551
|
+
type: "prefix-exact",
|
|
1552
|
+
search(text) {
|
|
1553
|
+
const isMatch = text.startsWith(pattern);
|
|
1554
|
+
return {
|
|
1555
|
+
isMatch,
|
|
1556
|
+
score: isMatch ? 0 : 1,
|
|
1557
|
+
indices: [0, pattern.length - 1]
|
|
1558
|
+
};
|
|
1559
|
+
}
|
|
1560
|
+
})
|
|
1561
|
+
},
|
|
1562
|
+
{
|
|
1563
|
+
type: "inverse-prefix-exact",
|
|
1564
|
+
multiRegex: /^!\^"(.*)"$/,
|
|
1565
|
+
singleRegex: /^!\^(.*)$/,
|
|
1566
|
+
create: (pattern) => ({
|
|
1567
|
+
type: "inverse-prefix-exact",
|
|
1568
|
+
search(text) {
|
|
1569
|
+
const isMatch = !text.startsWith(pattern);
|
|
1570
|
+
return {
|
|
1571
|
+
isMatch,
|
|
1572
|
+
score: isMatch ? 0 : 1,
|
|
1573
|
+
indices: [0, text.length - 1]
|
|
1574
|
+
};
|
|
1575
|
+
}
|
|
1576
|
+
})
|
|
1577
|
+
},
|
|
1578
|
+
{
|
|
1579
|
+
type: "inverse-suffix-exact",
|
|
1580
|
+
multiRegex: /^!"(.*)"\$$/,
|
|
1581
|
+
singleRegex: /^!(.*)\$$/,
|
|
1582
|
+
create: (pattern) => ({
|
|
1583
|
+
type: "inverse-suffix-exact",
|
|
1584
|
+
search(text) {
|
|
1585
|
+
const isMatch = !text.endsWith(pattern);
|
|
1586
|
+
return {
|
|
1587
|
+
isMatch,
|
|
1588
|
+
score: isMatch ? 0 : 1,
|
|
1589
|
+
indices: [0, text.length - 1]
|
|
1590
|
+
};
|
|
1591
|
+
}
|
|
1592
|
+
})
|
|
1593
|
+
},
|
|
1594
|
+
{
|
|
1595
|
+
type: "suffix-exact",
|
|
1596
|
+
multiRegex: /^"(.*)"\$$/,
|
|
1597
|
+
singleRegex: /^(.*)\$$/,
|
|
1598
|
+
create: (pattern) => ({
|
|
1599
|
+
type: "suffix-exact",
|
|
1600
|
+
search(text) {
|
|
1601
|
+
const isMatch = text.endsWith(pattern);
|
|
1602
|
+
return {
|
|
1603
|
+
isMatch,
|
|
1604
|
+
score: isMatch ? 0 : 1,
|
|
1605
|
+
indices: [text.length - pattern.length, text.length - 1]
|
|
1606
|
+
};
|
|
1607
|
+
}
|
|
1608
|
+
})
|
|
1609
|
+
},
|
|
1610
|
+
{
|
|
1611
|
+
type: "inverse-exact",
|
|
1612
|
+
multiRegex: /^!"(.*)"$/,
|
|
1613
|
+
singleRegex: /^!(.*)$/,
|
|
1614
|
+
create: (pattern) => ({
|
|
1615
|
+
type: "inverse-exact",
|
|
1616
|
+
search(text) {
|
|
1617
|
+
const isMatch = text.indexOf(pattern) === -1;
|
|
1618
|
+
return {
|
|
1619
|
+
isMatch,
|
|
1620
|
+
score: isMatch ? 0 : 1,
|
|
1621
|
+
indices: [0, text.length - 1]
|
|
1622
|
+
};
|
|
1623
|
+
}
|
|
1624
|
+
})
|
|
1625
|
+
},
|
|
1626
|
+
{
|
|
1627
|
+
type: "fuzzy",
|
|
1628
|
+
multiRegex: /^"(.*)"$/,
|
|
1629
|
+
singleRegex: /^(.*)$/,
|
|
1630
|
+
create: (pattern, options = {}) => {
|
|
1631
|
+
const bitap = new BitapSearch(pattern, {
|
|
1632
|
+
location: options.location ?? Config.location,
|
|
1633
|
+
threshold: options.threshold ?? Config.threshold,
|
|
1634
|
+
distance: options.distance ?? Config.distance,
|
|
1635
|
+
includeMatches: options.includeMatches ?? Config.includeMatches,
|
|
1636
|
+
findAllMatches: options.findAllMatches ?? Config.findAllMatches,
|
|
1637
|
+
minMatchCharLength: options.minMatchCharLength ?? Config.minMatchCharLength,
|
|
1638
|
+
isCaseSensitive: options.isCaseSensitive ?? Config.isCaseSensitive,
|
|
1639
|
+
ignoreDiacritics: options.ignoreDiacritics ?? Config.ignoreDiacritics,
|
|
1640
|
+
ignoreLocation: options.ignoreLocation ?? Config.ignoreLocation
|
|
1641
|
+
});
|
|
1642
|
+
return {
|
|
1643
|
+
type: "fuzzy",
|
|
1644
|
+
search(text) {
|
|
1645
|
+
return bitap.searchIn(text);
|
|
1646
|
+
}
|
|
1647
|
+
};
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
];
|
|
1651
|
+
matchersLen = matchers.length;
|
|
1652
|
+
registeredSearchers = [];
|
|
1653
|
+
LogicalOperator = {
|
|
1654
|
+
AND: "$and",
|
|
1655
|
+
OR: "$or"
|
|
1656
|
+
};
|
|
1657
|
+
KeyType = {
|
|
1658
|
+
PATH: "$path",
|
|
1659
|
+
PATTERN: "$val"
|
|
1660
|
+
};
|
|
1661
|
+
DEFAULT_TOKEN = /[\p{L}\p{M}\p{N}_]+/gu;
|
|
1662
|
+
warned = /* @__PURE__ */ new WeakSet;
|
|
1663
|
+
Fuse.version = "7.5.0";
|
|
1664
|
+
Fuse.createIndex = createIndex;
|
|
1665
|
+
Fuse.parseIndex = parseIndex;
|
|
1666
|
+
Fuse.config = Config;
|
|
1667
|
+
Fuse.match = function(pattern, text, options) {
|
|
1668
|
+
if (options && options.useTokenSearch)
|
|
1669
|
+
throw new Error(FUSE_MATCH_TOKEN_SEARCH_UNSUPPORTED);
|
|
1670
|
+
return createSearcher(pattern, {
|
|
1671
|
+
...Config,
|
|
1672
|
+
...options
|
|
1673
|
+
}).searchIn(text);
|
|
1674
|
+
};
|
|
1675
|
+
Fuse.parseQuery = parse;
|
|
1676
|
+
register(ExtendedSearch);
|
|
1677
|
+
register(TokenSearch);
|
|
1678
|
+
Fuse.use = function(...plugins) {
|
|
1679
|
+
plugins.forEach((plugin) => register(plugin));
|
|
1680
|
+
};
|
|
1681
|
+
entry_default = Fuse;
|
|
1682
|
+
});
|
|
1683
|
+
|
|
1684
|
+
export { entry_default, init_fuse };
|