@caspian2026/agent-sdk 0.0.20 → 0.0.21
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-q8t0ym9s.js → chunk-06xmvpv7.js} +83 -83
- package/dist/{chunk-5gr6ekgm.js → chunk-07069jq1.js} +4 -4
- package/dist/{chunk-ckrs789w.js → chunk-0731m51q.js} +1 -1
- package/dist/chunk-079tw1d6.js +155 -0
- package/dist/{chunk-w2bff8pq.js → chunk-08prz7zp.js} +12 -12
- package/dist/chunk-0hqv6vq3.js +127 -0
- package/dist/{chunk-qqc3b97c.js → chunk-0paqc2yw.js} +1 -1
- package/dist/{chunk-t83amzhd.js → chunk-0r5bb9j4.js} +12 -12
- package/dist/chunk-0rbxzwnb.js +146 -0
- package/dist/chunk-0t81d427.js +41 -0
- package/dist/{chunk-2mfzqkzn.js → chunk-0vkfrmqm.js} +29 -69
- package/dist/{chunk-bs9rn85s.js → chunk-0vp3wfab.js} +1 -1
- package/dist/{chunk-6rcf54zd.js → chunk-0xjaqda8.js} +27 -48
- package/dist/chunk-102ee39t.js +97 -0
- package/dist/chunk-1058brys.js +54 -0
- package/dist/{chunk-ekewg3tj.js → chunk-14qkwgmf.js} +4 -4
- package/dist/{chunk-2b00k9ep.js → chunk-1871fy77.js} +78 -78
- package/dist/{chunk-y83gxqvc.js → chunk-1ae3nt9j.js} +3 -3
- package/dist/{chunk-t3yc7m07.js → chunk-1gx78081.js} +1 -1
- package/dist/{chunk-d99k9r9g.js → chunk-1h2famwb.js} +1 -1
- package/dist/{chunk-vv84k232.js → chunk-1ksywqf6.js} +5 -5
- package/dist/{chunk-6hs3wed5.js → chunk-1q2taz28.js} +7 -7
- package/dist/{chunk-cgzq4zww.js → chunk-21jaw3mt.js} +4 -4
- package/dist/{chunk-ra9hbfyz.js → chunk-24q2kxjm.js} +3 -3
- package/dist/{chunk-ja23mty8.js → chunk-25s7wwvz.js} +83 -83
- package/dist/{chunk-xm9zf0tv.js → chunk-26b7qsct.js} +78 -78
- package/dist/{chunk-e7j6g62d.js → chunk-26sypsqa.js} +10 -11
- package/dist/{chunk-xkra2684.js → chunk-26vzce3s.js} +86 -85
- package/dist/{chunk-ynx3fetd.js → chunk-26wtxbdc.js} +463 -1222
- package/dist/chunk-27dhfb9v.js +77 -0
- package/dist/{chunk-k6cq3j7z.js → chunk-2fwze72g.js} +1 -1
- package/dist/{chunk-rrtpbztr.js → chunk-2gzv8nrw.js} +3 -4
- package/dist/chunk-2mdzhnxj.js +88 -0
- package/dist/{chunk-9b71sn2g.js → chunk-2qghgd3d.js} +41 -41
- package/dist/{chunk-k8by1vfd.js → chunk-2qkcx6gx.js} +19 -19
- package/dist/chunk-2xes6j9k.js +121 -0
- package/dist/{chunk-zp5nvg44.js → chunk-33e7y2ye.js} +2 -2
- package/dist/{chunk-1t3cyn1k.js → chunk-3c25bcsw.js} +1 -1
- package/dist/{chunk-nwdpjkrw.js → chunk-3csagva2.js} +78 -78
- package/dist/{chunk-60a647ty.js → chunk-3jwpbxxx.js} +81 -81
- package/dist/chunk-3mgywd32.js +8 -0
- package/dist/{chunk-52pp0dbk.js → chunk-3mqgy4d8.js} +4 -4
- package/dist/{chunk-568q88qz.js → chunk-3nk79af8.js} +1 -1
- package/dist/chunk-3pm48qgm.js +97 -0
- package/dist/{chunk-rzk001ay.js → chunk-3tx97a7z.js} +85 -85
- package/dist/{chunk-8ady2sm4.js → chunk-3vy1jt9p.js} +8 -8
- package/dist/{chunk-sthmb4xf.js → chunk-3w6dvw7z.js} +78 -78
- package/dist/{chunk-s201s689.js → chunk-40p1xyv4.js} +18 -18
- package/dist/{chunk-j77g2v22.js → chunk-4621eys4.js} +5 -5
- package/dist/{chunk-7deqmrby.js → chunk-46y1vrxs.js} +6 -6
- package/dist/{chunk-khwhppzs.js → chunk-49ce42vr.js} +2 -2
- package/dist/{chunk-6qb753r5.js → chunk-4bjfp2cp.js} +79 -79
- package/dist/{chunk-m6vs965c.js → chunk-4jm600zv.js} +1 -1
- package/dist/{chunk-v2szqm5g.js → chunk-4k9d7gxv.js} +5 -5
- package/dist/{chunk-pqf2bjy1.js → chunk-4nyewkpd.js} +4 -4
- package/dist/{chunk-f79jyxwd.js → chunk-4pbx3g7s.js} +4 -4
- package/dist/{chunk-qrgxbrs9.js → chunk-4sk0ekmh.js} +9810 -2820
- package/dist/{chunk-n3vmrzcy.js → chunk-4th9sgzv.js} +5 -5
- package/dist/{chunk-9drwsb3g.js → chunk-50cqjkgy.js} +80 -80
- package/dist/{chunk-xyzbgjpv.js → chunk-530bp1wc.js} +2 -2
- package/dist/{chunk-tnpk0ne1.js → chunk-55raexh7.js} +935 -2391
- package/dist/{chunk-bbhg7m1a.js → chunk-59564wn5.js} +79 -79
- package/dist/{chunk-z9v4bxrj.js → chunk-5ccdsxgy.js} +3 -3
- package/dist/{chunk-3k8ecscj.js → chunk-5e4jj4hd.js} +78 -78
- package/dist/{chunk-zqajmq38.js → chunk-5ekyhb1w.js} +6 -6
- package/dist/chunk-5h4berfm.js +30 -0
- package/dist/{chunk-t8chhacb.js → chunk-5h5kx2jd.js} +2 -2
- package/dist/chunk-5jkawn33.js +71 -0
- package/dist/{chunk-5v6wr1z4.js → chunk-5n1jc02d.js} +2 -2
- package/dist/{chunk-x09aacvx.js → chunk-5wnkq46y.js} +5 -5
- package/dist/{chunk-r585pc0g.js → chunk-5z28bqne.js} +3 -4
- package/dist/{chunk-gbvmks09.js → chunk-64c1avct.js} +1 -1
- package/dist/{chunk-y8b45mt2.js → chunk-64r16v22.js} +4 -4
- package/dist/{chunk-ej882sb5.js → chunk-65w2019d.js} +26 -26
- package/dist/{chunk-m82ketm1.js → chunk-66wbs5de.js} +78 -78
- package/dist/{chunk-f517h74h.js → chunk-66zry909.js} +1 -1
- package/dist/{chunk-kjx9a9p4.js → chunk-68ffk5qa.js} +2 -2
- package/dist/{chunk-bstyysxw.js → chunk-68ypktng.js} +3 -3
- package/dist/{chunk-xygy5v97.js → chunk-69bms9eh.js} +30 -30
- package/dist/{chunk-5vavvf6y.js → chunk-69n11zng.js} +5 -5
- package/dist/{chunk-7wegz81g.js → chunk-6dj5t602.js} +1 -1
- package/dist/{chunk-vnrevqdf.js → chunk-6dngjwkh.js} +4 -4
- package/dist/{chunk-7kp42hzq.js → chunk-6nsd9606.js} +2 -2
- package/dist/chunk-7641fj0b.js +107 -0
- package/dist/{chunk-fdwtd6s9.js → chunk-7aw745vx.js} +3 -3
- package/dist/{chunk-dv38yqdn.js → chunk-7gy9xrjc.js} +3 -3
- package/dist/{chunk-93hxjnkb.js → chunk-7k74bhsg.js} +78 -78
- package/dist/{chunk-1s9jxpjm.js → chunk-7pz9rdg8.js} +7 -7
- package/dist/{chunk-vd5dh925.js → chunk-7ry9qp54.js} +78 -78
- package/dist/{chunk-8q5fzyem.js → chunk-7sgtxrsc.js} +8 -10
- package/dist/{chunk-vx28ztc7.js → chunk-7v902gw4.js} +20 -20
- package/dist/chunk-7vhfhyq0.js +123 -0
- package/dist/{chunk-dmp3nd67.js → chunk-7w4n7zr8.js} +90 -90
- package/dist/{chunk-7yexhdjs.js → chunk-7wm5s02e.js} +1 -1
- package/dist/{chunk-wfh12nzh.js → chunk-7xyswgjh.js} +1 -1
- package/dist/{chunk-bdhdmkya.js → chunk-83hfzbx3.js} +1 -1
- package/dist/chunk-86fwp0mg.js +148 -0
- package/dist/{chunk-tevzn1xp.js → chunk-8g5pe1gr.js} +1 -1
- package/dist/{chunk-6twsw69m.js → chunk-8knpmkt5.js} +7 -7
- package/dist/chunk-8mpv3j7b.js +105 -0
- package/dist/chunk-8scyf6tf.js +90 -0
- package/dist/{chunk-xj8tk3d7.js → chunk-8yhf030a.js} +3 -3
- package/dist/chunk-92cczfwx.js +903 -0
- package/dist/{chunk-mbfzfg56.js → chunk-9r16nw6z.js} +85 -85
- package/dist/{chunk-s7tq4e5g.js → chunk-9rm2hczd.js} +78 -78
- package/dist/{chunk-s13y3w7e.js → chunk-9shyda79.js} +37 -37
- package/dist/{chunk-c6gpdd2c.js → chunk-9t8650e0.js} +78 -78
- package/dist/{chunk-7e9xcw77.js → chunk-9x5zgy22.js} +1 -1
- package/dist/{chunk-1ytng03p.js → chunk-9znd08ha.js} +12 -12
- package/dist/{chunk-r27tskss.js → chunk-a0qftggg.js} +9 -11
- package/dist/{chunk-0w2ntzwz.js → chunk-ab78zrxc.js} +92 -92
- package/dist/{chunk-638qz5y7.js → chunk-acj1j3dw.js} +5 -5
- package/dist/{chunk-z8n8cjhz.js → chunk-aj7nt1ae.js} +2 -2
- package/dist/{chunk-jwqveqpr.js → chunk-akd5hjav.js} +9 -9
- package/dist/{chunk-et3jfht8.js → chunk-ang6j1ma.js} +16 -16
- package/dist/{chunk-s9jxtj04.js → chunk-arrvgw6z.js} +95 -94
- package/dist/{chunk-cajjdb7j.js → chunk-as3pvrmw.js} +8 -8
- package/dist/{chunk-5f57qtf9.js → chunk-ase86y73.js} +1 -1
- package/dist/{chunk-m12e2wq3.js → chunk-b08zb0sw.js} +80 -80
- package/dist/{chunk-6d05fvxz.js → chunk-b0kf00ff.js} +2 -2
- package/dist/{chunk-r055z03k.js → chunk-b1kcd3ss.js} +1 -1
- package/dist/{chunk-k0dprbnn.js → chunk-ba473zak.js} +78 -78
- package/dist/{chunk-0tja7d1y.js → chunk-bg4x9ex0.js} +6 -6
- package/dist/{chunk-eb4t4ehh.js → chunk-bgzwt111.js} +6 -6
- package/dist/chunk-bh5zqvyc.js +36 -0
- package/dist/{chunk-eynfddhq.js → chunk-bpes1x7d.js} +144 -143
- package/dist/chunk-brbrrj03.js +114 -0
- package/dist/{chunk-zhnnzkzm.js → chunk-brjd9zmk.js} +14 -14
- package/dist/chunk-bs975312.js +133 -0
- package/dist/chunk-bww6hm2e.js +58 -0
- package/dist/{chunk-p0n9ew4x.js → chunk-byfawrfx.js} +4 -4
- package/dist/chunk-c67ypsa8.js +20 -0
- package/dist/chunk-c6sjhj89.js +1284 -0
- package/dist/{chunk-pyn4ry36.js → chunk-c7jwbe76.js} +57 -103
- package/dist/chunk-cdef9v7b.js +27 -0
- package/dist/{chunk-9029sbq1.js → chunk-cdz5yb0r.js} +1 -1
- package/dist/{chunk-4bcx2a3p.js → chunk-cgfdkzhb.js} +1 -1
- package/dist/chunk-cgy9g4wp.js +100 -0
- package/dist/{chunk-fefs2xby.js → chunk-cmtvwbwf.js} +25 -25
- package/dist/{chunk-p8hn07q2.js → chunk-cnsj3vq2.js} +1 -1
- package/dist/{chunk-ngde5k9k.js → chunk-cpywwph7.js} +79 -79
- package/dist/chunk-crcrnd8y.js +55 -0
- package/dist/{chunk-j15xyew5.js → chunk-crfk7ed8.js} +4 -4
- package/dist/{chunk-0a8jb5c8.js → chunk-crvwmrey.js} +9 -9
- package/dist/{chunk-44bqv91d.js → chunk-cxrktb5g.js} +3 -3
- package/dist/{chunk-apjnwens.js → chunk-d4mdda98.js} +8 -8
- package/dist/{chunk-d2cypdsx.js → chunk-d6kvya9n.js} +23 -23
- package/dist/chunk-daqd8kee.js +122 -0
- package/dist/{chunk-cx21etb2.js → chunk-db2awvr6.js} +2 -2
- package/dist/{chunk-b1hygym1.js → chunk-ddsjkqs4.js} +8 -8
- package/dist/{chunk-rx9ypbjy.js → chunk-dfzkwynj.js} +8 -8
- package/dist/{chunk-yteprw63.js → chunk-dhk2dt7n.js} +29 -29
- package/dist/{chunk-rzn9w8p2.js → chunk-dq94esjd.js} +3 -3
- package/dist/{chunk-z8b8f2n3.js → chunk-dw1x0kzg.js} +79 -79
- package/dist/{chunk-k3gvjjm9.js → chunk-e0abab5b.js} +5 -5
- package/dist/{chunk-wyyd1qfn.js → chunk-e28pnfmr.js} +81 -81
- package/dist/{chunk-pg8asjpk.js → chunk-e9w9zc0g.js} +20 -20
- package/dist/chunk-effhh1pw.js +81 -0
- package/dist/{chunk-rfj6gjwh.js → chunk-efrjt26j.js} +14 -14
- package/dist/{chunk-p4e5ymdw.js → chunk-ehtwnxpg.js} +1 -1
- package/dist/chunk-em7h8kqy.js +89 -0
- package/dist/{chunk-yh46f77t.js → chunk-enkgx9p5.js} +78 -78
- package/dist/{chunk-ysfam81t.js → chunk-eqp1rfft.js} +2 -2
- package/dist/{chunk-r4pq77kb.js → chunk-etdt1xz3.js} +3 -3
- package/dist/{chunk-dh01e4bp.js → chunk-ewadzrm8.js} +2 -2
- package/dist/{chunk-7dc9d8fy.js → chunk-f98yad99.js} +7 -7
- package/dist/{chunk-4v1mr2x2.js → chunk-f99jr604.js} +41 -41
- package/dist/{chunk-37j24srh.js → chunk-f9mnmjf4.js} +6 -6
- package/dist/{chunk-qbbf7rr5.js → chunk-fajg8x36.js} +727 -1818
- package/dist/{chunk-snd4pbkp.js → chunk-fbv4apne.js} +1 -1
- package/dist/{chunk-8m1gfrme.js → chunk-fc8mescd.js} +26 -15
- package/dist/{chunk-8a1jee0e.js → chunk-fcynwjpm.js} +2 -2
- package/dist/{chunk-gt43z5zd.js → chunk-fddfa07d.js} +81 -81
- package/dist/{chunk-bq0wp28e.js → chunk-feyzykye.js} +1 -1
- package/dist/chunk-ffcwak1t.js +91 -0
- package/dist/{chunk-25jhz0br.js → chunk-fgmmtj9k.js} +16 -16
- package/dist/{chunk-4kfhh3aw.js → chunk-fj3a38w3.js} +4 -4
- package/dist/chunk-fk60d1qf.js +87 -0
- package/dist/chunk-fnxysrtm.js +52 -0
- package/dist/chunk-fq24vgdm.js +113 -0
- package/dist/{chunk-dy8278wt.js → chunk-fqak69ft.js} +7 -7
- package/dist/{chunk-657k4mef.js → chunk-fs7jna05.js} +79 -79
- package/dist/{chunk-0zscb6c7.js → chunk-fyc5fepv.js} +1 -1
- package/dist/{chunk-vwt2fv6j.js → chunk-g0wv2y40.js} +3 -3
- package/dist/chunk-g3gr434c.js +101 -0
- package/dist/{chunk-v9sy0cj3.js → chunk-g3zgsm5x.js} +10 -10
- package/dist/{chunk-vxsad4bw.js → chunk-g9f19ttm.js} +2 -2
- package/dist/{chunk-bw8y1msy.js → chunk-g9q2patf.js} +5 -5
- package/dist/chunk-gdwdqewd.js +19 -0
- package/dist/{chunk-h8n0a991.js → chunk-ge8zt73c.js} +79 -79
- package/dist/{chunk-3w4xq6cv.js → chunk-gg55fns0.js} +92 -92
- package/dist/chunk-gk8dvdsw.js +140 -0
- package/dist/{chunk-9p62r6he.js → chunk-gw6kn54v.js} +6 -6
- package/dist/chunk-gz1e8y1w.js +33 -0
- package/dist/{chunk-ycpdfeya.js → chunk-gzt1cd1y.js} +79 -79
- package/dist/{chunk-m13ptmf2.js → chunk-h9n54swm.js} +2 -2
- package/dist/{chunk-7njkaxjp.js → chunk-hakdhagh.js} +120 -39
- package/dist/{chunk-dzcb2ekz.js → chunk-hcwcwa84.js} +4 -4
- package/dist/{chunk-1ehn6qdp.js → chunk-hf96emr1.js} +13 -13
- package/dist/{chunk-vq4k182g.js → chunk-hgteysah.js} +5 -5
- package/dist/{chunk-6fx36a3s.js → chunk-hszppxh0.js} +5 -5
- package/dist/chunk-hvbnh0ht.js +131 -0
- package/dist/{chunk-f9ybfyyp.js → chunk-hwfknpxv.js} +2 -2
- package/dist/{chunk-gm8ht8g9.js → chunk-hwyp85fa.js} +6 -6
- package/dist/{chunk-kt25n52f.js → chunk-j5bth84e.js} +4 -4
- package/dist/{chunk-tkbwrjte.js → chunk-j64ga6ta.js} +284 -325
- package/dist/{chunk-1ycd7t0f.js → chunk-jagq2tcw.js} +88 -88
- package/dist/{chunk-trm02xde.js → chunk-jd32zbps.js} +2 -2
- package/dist/{chunk-0f84wjjc.js → chunk-jgwfkvdk.js} +79 -79
- package/dist/{chunk-6fe0an4e.js → chunk-jhrshs1y.js} +79 -79
- package/dist/{chunk-3xamk0n1.js → chunk-jjnmcaeb.js} +25 -25
- package/dist/{chunk-x4x3691j.js → chunk-jtjqrrtq.js} +12 -12
- package/dist/{chunk-pp5zbnpr.js → chunk-jtx7ka0g.js} +80 -80
- package/dist/chunk-jvdhwjth.js +107 -0
- package/dist/{chunk-fpq87r80.js → chunk-jzthz1bx.js} +1 -1
- package/dist/{chunk-taqr0qw1.js → chunk-k0p9w03v.js} +3 -3
- package/dist/{chunk-9re786wa.js → chunk-k4xyha98.js} +40 -40
- package/dist/{chunk-pqxyft7d.js → chunk-k6tvcn37.js} +8 -8
- package/dist/{chunk-a3qtafgw.js → chunk-k8vp0atq.js} +79 -79
- package/dist/chunk-kbqx20y8.js +89 -0
- package/dist/{chunk-h4tnp6dw.js → chunk-khnqc2x8.js} +7 -7
- package/dist/{chunk-s9906sac.js → chunk-kqc0x8w6.js} +83 -83
- package/dist/{chunk-nsxw4b3j.js → chunk-ksq6zjys.js} +8 -8
- package/dist/{chunk-0pbwcm8b.js → chunk-kwekc97v.js} +1 -1
- package/dist/{chunk-qs4stpt5.js → chunk-ky1z78ve.js} +14 -14
- package/dist/{chunk-e22at2jn.js → chunk-m1ergjg5.js} +4 -4
- package/dist/chunk-m4k4mve9.js +130 -0
- package/dist/{chunk-q9y73cmh.js → chunk-mcws22k3.js} +1 -1
- package/dist/chunk-mfdqvcr5.js +50 -0
- package/dist/{chunk-88k0rgdp.js → chunk-mgv4r1af.js} +12 -12
- package/dist/{chunk-62jrhytw.js → chunk-mh52m71p.js} +10 -10
- package/dist/{chunk-pt6vj628.js → chunk-mjcxt56a.js} +9 -9
- package/dist/chunk-mpc6f96q.js +111 -0
- package/dist/{chunk-s5arr49c.js → chunk-mra3tr23.js} +200 -11
- package/dist/{chunk-4e1j46k0.js → chunk-mswx2nma.js} +3 -3
- package/dist/{chunk-zat7q2e0.js → chunk-mxt0a1ab.js} +79 -79
- package/dist/chunk-mympkkbw.js +103 -0
- package/dist/chunk-mzrxzmpm.js +121 -0
- package/dist/{chunk-0b85d7q0.js → chunk-n0zd06za.js} +7 -7
- package/dist/{chunk-jrqjxhxj.js → chunk-n22k5xdw.js} +2 -2
- package/dist/{chunk-7gbe6ftc.js → chunk-n9ftnh2y.js} +10 -10
- package/dist/{chunk-ykvf93ft.js → chunk-nd39ny9k.js} +79 -79
- package/dist/{chunk-mtstpt1e.js → chunk-nd7zx01p.js} +43 -43
- package/dist/{chunk-pnc7q9rt.js → chunk-netzwgv1.js} +1 -1
- package/dist/chunk-nmgj86tt.js +24 -0
- package/dist/{chunk-r1q9s5hs.js → chunk-ns7x6xam.js} +10 -13
- package/dist/{chunk-vbe1ersf.js → chunk-p7vkh4wx.js} +1 -1
- package/dist/{chunk-q74fcthe.js → chunk-p8na2wwp.js} +2 -2
- package/dist/{chunk-tmye4d2k.js → chunk-pajqjgkr.js} +15 -15
- package/dist/{chunk-pg4fbhbm.js → chunk-pe3rkfp2.js} +11 -11
- package/dist/chunk-pe824pp5.js +71 -0
- package/dist/{chunk-sbe9zd56.js → chunk-pgtnj1mt.js} +6 -6
- package/dist/{chunk-41wn5eqw.js → chunk-phr23vzw.js} +10 -10
- package/dist/{chunk-5nqrdqz5.js → chunk-ppwjyveh.js} +1 -1
- package/dist/chunk-pqe0s3es.js +85 -0
- package/dist/{chunk-ja1nqz5q.js → chunk-ps49ymvj.js} +2 -2
- package/dist/{chunk-2vc3fyp9.js → chunk-pwwa7s62.js} +2 -2
- package/dist/chunk-px0z9762.js +91 -0
- package/dist/{chunk-v8k67zfz.js → chunk-q4wj3v8n.js} +392 -1127
- package/dist/{chunk-wwrswxg1.js → chunk-qajrkk97.js} +1 -1
- package/dist/{chunk-b610qrvk.js → chunk-qatfdxvd.js} +3 -3
- package/dist/{chunk-qka6pqrq.js → chunk-qb6k2afy.js} +11 -11
- package/dist/{chunk-rgaedd84.js → chunk-qkczt8cr.js} +5 -5
- package/dist/chunk-qnfx3qtx.js +617 -0
- package/dist/{chunk-eta5aekm.js → chunk-qp2qdcda.js} +30 -9
- package/dist/{chunk-cfpnb7x4.js → chunk-qr516hqj.js} +78 -78
- package/dist/{chunk-a1mewckj.js → chunk-qswz887n.js} +78 -78
- package/dist/{chunk-tnv92c5m.js → chunk-r1w3jrs8.js} +81 -81
- package/dist/chunk-r5q49139.js +93 -0
- package/dist/{chunk-a00gfn8e.js → chunk-rmbbmd3s.js} +2 -2
- package/dist/{chunk-xdxdztxa.js → chunk-rn0v1hk8.js} +1 -1
- package/dist/{chunk-cqb31tfg.js → chunk-rnxctq9p.js} +6 -6
- package/dist/{chunk-z7yj7dfh.js → chunk-rs4yvre8.js} +10 -10
- package/dist/chunk-s07p92v4.js +107 -0
- package/dist/{chunk-fqr6n9z6.js → chunk-s8gy4ky9.js} +3 -3
- package/dist/chunk-s8hykxf5.js +145 -0
- package/dist/{chunk-fr5s5ceq.js → chunk-s8kj6ajy.js} +2 -2
- package/dist/{chunk-39r7sh1h.js → chunk-scz7dzwq.js} +90 -90
- package/dist/{chunk-nztayqyx.js → chunk-sd36yzx8.js} +1 -1
- package/dist/chunk-sgpmpn90.js +35 -0
- package/dist/chunk-sh02d2qn.js +38 -0
- package/dist/{chunk-6c22q39e.js → chunk-sncz1ag3.js} +78 -78
- package/dist/{chunk-0dwdg9bz.js → chunk-ssec5007.js} +9 -9
- package/dist/{chunk-2qpy8kne.js → chunk-szj5wvdy.js} +1 -1
- package/dist/{chunk-4nqm22j3.js → chunk-t29a6zb5.js} +4 -6
- package/dist/{chunk-w60c0dkw.js → chunk-t32ddjb3.js} +5 -5
- package/dist/{chunk-3hcfwedh.js → chunk-t4khqff1.js} +5 -5
- package/dist/{chunk-q53kkzhr.js → chunk-t7j96x8z.js} +80 -80
- package/dist/{chunk-qrdbqeve.js → chunk-t9p85zff.js} +2 -2
- package/dist/{chunk-ma6x4ws8.js → chunk-tgafrp5a.js} +46 -46
- package/dist/{chunk-ewsvbzhz.js → chunk-tgnbeeyx.js} +3 -3
- package/dist/{chunk-yp64t9je.js → chunk-tndhag9g.js} +8 -8
- package/dist/chunk-tr9zera9.js +55 -0
- package/dist/{chunk-5sd5fz78.js → chunk-tz3td6hy.js} +78 -78
- package/dist/{chunk-6vp8zen2.js → chunk-v17y7qay.js} +79 -79
- package/dist/{chunk-zx9r7a23.js → chunk-v1kzp02e.js} +1 -1
- package/dist/{chunk-15f7ee0j.js → chunk-v4t6dyyh.js} +158 -245
- package/dist/{chunk-93kvs6fh.js → chunk-v5brqghz.js} +6 -6
- package/dist/{chunk-he9zw1gh.js → chunk-v78fj8by.js} +2 -2
- package/dist/{chunk-pt1jzmkv.js → chunk-v8kjswxt.js} +2 -2
- package/dist/{chunk-n9ne98cj.js → chunk-v9smspw2.js} +4 -5
- package/dist/{chunk-2bh7f2wa.js → chunk-vbmdqx87.js} +13 -13
- package/dist/{chunk-4yq5zz3m.js → chunk-vcwzs8xk.js} +9 -9
- package/dist/{chunk-wt799fvk.js → chunk-vf612n57.js} +34 -34
- package/dist/chunk-vf9320w1.js +105 -0
- package/dist/{chunk-myac8yfs.js → chunk-vkhrrvfq.js} +5 -5
- package/dist/{chunk-hbz8xggv.js → chunk-vneepj82.js} +11 -11
- package/dist/{chunk-ytt8da3v.js → chunk-vr96pznr.js} +81 -81
- package/dist/chunk-vszex7fm.js +90 -0
- package/dist/{chunk-jw9zwgea.js → chunk-vv7kzavx.js} +4 -4
- package/dist/chunk-vwxpwg2r.js +121 -0
- package/dist/{chunk-bktmgb4n.js → chunk-vyjeh50y.js} +39 -68
- package/dist/{chunk-9rhy5vt7.js → chunk-vzzsjg7m.js} +9 -9
- package/dist/{chunk-yvm9t98e.js → chunk-w0dz2sa5.js} +18 -7
- package/dist/{chunk-xggbj4j9.js → chunk-w1fb9aqj.js} +3 -3
- package/dist/{chunk-hgb8024k.js → chunk-w43b6749.js} +10 -10
- package/dist/{chunk-3hxr3x9d.js → chunk-w6m6trzq.js} +2 -2
- package/dist/chunk-w9a226y4.js +105 -0
- package/dist/{chunk-kcp41jcn.js → chunk-wa8yn2p0.js} +2 -2
- package/dist/{chunk-4fwzreqj.js → chunk-wf16jx1f.js} +6 -6
- package/dist/{chunk-7tdk9ypw.js → chunk-wgk9sxk7.js} +10 -10
- package/dist/{chunk-2bk4jvse.js → chunk-wkny3k77.js} +7 -7
- package/dist/chunk-wsfq03qa.js +101 -0
- package/dist/{chunk-e01rphq3.js → chunk-x12h3n65.js} +727 -128
- package/dist/{chunk-26kp0k1t.js → chunk-x1dw8vry.js} +80 -80
- package/dist/{chunk-jsvsnqkn.js → chunk-x47h283a.js} +2 -2
- package/dist/{chunk-ccdh8eh2.js → chunk-x5wgbcme.js} +38 -38
- package/dist/{chunk-rpta0rqz.js → chunk-x6r4v44b.js} +1 -1
- package/dist/{chunk-tyc5c0q4.js → chunk-x70f036b.js} +8 -8
- package/dist/{chunk-k6wmp81y.js → chunk-x7fdwq3d.js} +1 -1
- package/dist/{chunk-13pmg16e.js → chunk-x8d2ehd7.js} +1 -1
- package/dist/{chunk-dg2k597k.js → chunk-xca0q5ap.js} +9 -9
- package/dist/{chunk-pnrdvxhy.js → chunk-xeb6075z.js} +2 -2
- package/dist/{chunk-n9xhrzxs.js → chunk-xg08qv1e.js} +78 -78
- package/dist/{chunk-7gte8zc4.js → chunk-xhfmdq1y.js} +1 -1
- package/dist/{chunk-gxsrvxjn.js → chunk-xv3era3s.js} +1 -1
- package/dist/chunk-xv78ch6z.js +92 -0
- package/dist/chunk-xy94q6qg.js +114 -0
- package/dist/{chunk-92wwx9vf.js → chunk-y1784krc.js} +2 -2
- package/dist/{chunk-ggk84sc5.js → chunk-y4ca9kqz.js} +4 -4
- package/dist/{chunk-h1tv19q0.js → chunk-y4d1sgf4.js} +80 -80
- package/dist/{chunk-m8qvkabg.js → chunk-y9bhjjdz.js} +4 -4
- package/dist/{chunk-vwkb146r.js → chunk-y9ffgh1g.js} +90 -90
- package/dist/chunk-ycs5r2ef.js +60 -0
- package/dist/{chunk-c2k1n6yb.js → chunk-yde1e32y.js} +16 -16
- package/dist/chunk-yfztvfhh.js +94 -0
- package/dist/{chunk-hhvf84fa.js → chunk-yjk0f08a.js} +188 -186
- package/dist/{chunk-bta8w8ge.js → chunk-yyex5gsf.js} +10 -10
- package/dist/chunk-zcq3r82m.js +93 -0
- package/dist/{chunk-3jbxhytz.js → chunk-zecx4x3b.js} +8 -8
- package/dist/{chunk-7ba45tqg.js → chunk-zpdzhck8.js} +5 -5
- package/dist/{chunk-j0bfbce5.js → chunk-zpw4ny96.js} +36 -36
- package/dist/{chunk-tdf3ha9b.js → chunk-zv1frw5e.js} +79 -79
- package/dist/{chunk-61x3akfa.js → chunk-zxh62ved.js} +2 -2
- package/dist/{chunk-8r1napm7.js → chunk-zzm33q8x.js} +1 -1
- package/dist/cli.js +12 -12
- package/dist/gateway/worker.js +170082 -171912
- package/dist/sdk/query.cjs +18 -8
- package/dist/sdk/query.js +1 -1
- package/package.json +128 -128
- package/dist/chunk-09nzqj0f.js +0 -9605
- package/dist/chunk-0fw1mz8s.js +0 -27
- package/dist/chunk-0pqv68xt.js +0 -133
- package/dist/chunk-0pv13fxq.js +0 -1684
- package/dist/chunk-0tgn1431.js +0 -38
- package/dist/chunk-0yshjsxt.js +0 -122
- package/dist/chunk-0z9s957c.js +0 -94
- package/dist/chunk-1gt45dyg.js +0 -101
- package/dist/chunk-3kx7brrn.js +0 -55
- package/dist/chunk-4kfs8ymb.js +0 -92
- package/dist/chunk-5rhmrt2j.js +0 -121
- package/dist/chunk-626watky.js +0 -50
- package/dist/chunk-6aqa0ec5.js +0 -145
- package/dist/chunk-6zfb4n08.js +0 -91
- package/dist/chunk-73bgy356.js +0 -90
- package/dist/chunk-7nphjzve.js +0 -105
- package/dist/chunk-7sp9dk6d.js +0 -20
- package/dist/chunk-8jmkpx1h.js +0 -123
- package/dist/chunk-9xq7ef8y.js +0 -100
- package/dist/chunk-9ydxqdhe.js +0 -121
- package/dist/chunk-ab6apbd2.js +0 -140
- package/dist/chunk-bdrsheny.js +0 -35
- package/dist/chunk-bvfqg3cg.js +0 -131
- package/dist/chunk-cj0j4n23.js +0 -71
- package/dist/chunk-cynnhyy3.js +0 -103
- package/dist/chunk-d0zx5hba.js +0 -85
- package/dist/chunk-e6s584g7.js +0 -77
- package/dist/chunk-e90dyenj.js +0 -127
- package/dist/chunk-em5s71j6.js +0 -89
- package/dist/chunk-eqcgr89w.js +0 -646
- package/dist/chunk-f9zvs66e.js +0 -105
- package/dist/chunk-gaf31961.js +0 -81
- package/dist/chunk-gkz2djp0.js +0 -121
- package/dist/chunk-gwktnbeg.js +0 -90
- package/dist/chunk-h0bgwz9v.js +0 -55
- package/dist/chunk-h3v46eky.js +0 -105
- package/dist/chunk-hycm92ss.js +0 -52
- package/dist/chunk-j3c5r08n.js +0 -87
- package/dist/chunk-j3q2sbhc.js +0 -107
- package/dist/chunk-k9h7kjf6.js +0 -8
- package/dist/chunk-karea2z2.js +0 -89
- package/dist/chunk-kra9y8qb.js +0 -97
- package/dist/chunk-mwzwm2z2.js +0 -60
- package/dist/chunk-n535j168.js +0 -131
- package/dist/chunk-p9nkqgej.js +0 -19
- package/dist/chunk-pgptefy1.js +0 -114
- package/dist/chunk-pjn0s3j1.js +0 -111
- package/dist/chunk-pkwv0q5q.js +0 -91
- package/dist/chunk-q6m9qgaa.js +0 -88
- package/dist/chunk-r82c7gfc.js +0 -58
- package/dist/chunk-rgshryeb.js +0 -93
- package/dist/chunk-rk2kb2ec.js +0 -101
- package/dist/chunk-s0p653k2.js +0 -93
- package/dist/chunk-skypjdyc.js +0 -147
- package/dist/chunk-tgayhxvz.js +0 -41
- package/dist/chunk-vr5vyt2h.js +0 -107
- package/dist/chunk-vvjhax8n.js +0 -114
- package/dist/chunk-vvsts2t9.js +0 -30
- package/dist/chunk-w287mz4p.js +0 -146
- package/dist/chunk-wa852b5b.js +0 -113
- package/dist/chunk-xbpt4dv8.js +0 -155
- package/dist/chunk-xj72jfpd.js +0 -33
- package/dist/chunk-xwbh3j1x.js +0 -107
- package/dist/chunk-xwrar1c5.js +0 -97
- package/dist/chunk-yt9mady7.js +0 -36
- package/dist/chunk-zfxp82tk.js +0 -24
- package/dist/chunk-zgkngrp4.js +0 -54
package/dist/chunk-0pv13fxq.js
DELETED
|
@@ -1,1684 +0,0 @@
|
|
|
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 };
|