stream-chat 9.16.0 → 9.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -2665,6 +2665,58 @@ var toUpdatedMessagePayload = (message) => {
2665
2665
  )
2666
2666
  };
2667
2667
  };
2668
+ var toDeletedMessage = ({
2669
+ message,
2670
+ deletedAt,
2671
+ hardDelete = false
2672
+ }) => {
2673
+ if (hardDelete) {
2674
+ return {
2675
+ attachments: [],
2676
+ cid: message.cid,
2677
+ created_at: message.created_at,
2678
+ deleted_at: deletedAt,
2679
+ id: message.id,
2680
+ latest_reactions: [],
2681
+ mentioned_users: [],
2682
+ own_reactions: [],
2683
+ parent_id: message.parent_id,
2684
+ reply_count: message.reply_count,
2685
+ status: message.status,
2686
+ thread_participants: message.thread_participants,
2687
+ type: "deleted",
2688
+ updated_at: message.updated_at,
2689
+ user: message.user
2690
+ };
2691
+ } else {
2692
+ return {
2693
+ ...message,
2694
+ attachments: [],
2695
+ type: "deleted",
2696
+ deleted_at: deletedAt
2697
+ };
2698
+ }
2699
+ };
2700
+ var deleteUserMessages = ({
2701
+ messages,
2702
+ user,
2703
+ hardDelete = false,
2704
+ deletedAt
2705
+ }) => {
2706
+ for (let i = 0; i < messages.length; i++) {
2707
+ const message = messages[i];
2708
+ if (message.user?.id === user.id) {
2709
+ messages[i] = message.type === "deleted" ? message : toDeletedMessage({ message, hardDelete, deletedAt });
2710
+ }
2711
+ if (message.quoted_message?.user?.id === user.id) {
2712
+ messages[i].quoted_message = message.quoted_message.type === "deleted" ? message.quoted_message : toDeletedMessage({
2713
+ message: messages[i].quoted_message,
2714
+ hardDelete,
2715
+ deletedAt
2716
+ });
2717
+ }
2718
+ }
2719
+ };
2668
2720
  var findIndexInSortedArray = ({
2669
2721
  needle,
2670
2722
  sortedArray,
@@ -3199,46 +3251,24 @@ var ChannelState = class {
3199
3251
  * @param {UserResponse} user
3200
3252
  * @param {boolean} hardDelete
3201
3253
  */
3202
- this.deleteUserMessages = (user, hardDelete = false) => {
3203
- const _deleteUserMessages = (messages, user2, hardDelete2 = false) => {
3204
- for (let i = 0; i < messages.length; i++) {
3205
- const m = messages[i];
3206
- if (m.user?.id !== user2.id) {
3207
- continue;
3208
- }
3209
- if (hardDelete2) {
3210
- messages[i] = {
3211
- cid: m.cid,
3212
- created_at: m.created_at,
3213
- deleted_at: user2.deleted_at,
3214
- id: m.id,
3215
- latest_reactions: [],
3216
- mentioned_users: [],
3217
- own_reactions: [],
3218
- parent_id: m.parent_id,
3219
- reply_count: m.reply_count,
3220
- status: m.status,
3221
- thread_participants: m.thread_participants,
3222
- type: "deleted",
3223
- updated_at: m.updated_at,
3224
- user: m.user
3225
- };
3226
- } else {
3227
- messages[i] = {
3228
- ...m,
3229
- type: "deleted",
3230
- deleted_at: user2.deleted_at ? new Date(user2.deleted_at) : null
3231
- };
3232
- }
3233
- }
3234
- };
3254
+ this.deleteUserMessages = (user, hardDelete = false, deletedAt) => {
3235
3255
  this.messageSets.forEach(
3236
- (set) => _deleteUserMessages(set.messages, user, hardDelete)
3256
+ ({ messages }) => deleteUserMessages({ messages, user, hardDelete, deletedAt: deletedAt ?? null })
3237
3257
  );
3238
3258
  for (const parentId in this.threads) {
3239
- _deleteUserMessages(this.threads[parentId], user, hardDelete);
3259
+ deleteUserMessages({
3260
+ messages: this.threads[parentId],
3261
+ user,
3262
+ hardDelete,
3263
+ deletedAt: deletedAt ?? null
3264
+ });
3240
3265
  }
3241
- _deleteUserMessages(this.pinnedMessages, user, hardDelete);
3266
+ deleteUserMessages({
3267
+ messages: this.pinnedMessages,
3268
+ user,
3269
+ hardDelete,
3270
+ deletedAt: deletedAt ?? null
3271
+ });
3242
3272
  };
3243
3273
  this._channel = channel;
3244
3274
  this.watcher_count = 0;
@@ -5247,15 +5277,9 @@ _AttachmentManager.toLocalUploadAttachment = (fileLike) => {
5247
5277
  };
5248
5278
  var AttachmentManager = _AttachmentManager;
5249
5279
 
5250
- // node_modules/linkifyjs/dist/linkify.es.js
5251
- var encodedTlds = "aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2";
5280
+ // node_modules/linkifyjs/dist/linkify.mjs
5281
+ var encodedTlds = "aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2";
5252
5282
  var encodedUtlds = "\u03B5\u03BB1\u03C52\u0431\u04331\u0435\u043B3\u0434\u0435\u0442\u04384\u0435\u044E2\u043A\u0430\u0442\u043E\u043B\u0438\u043A6\u043E\u043C3\u043C\u043A\u04342\u043E\u043D1\u0441\u043A\u0432\u04306\u043E\u043D\u043B\u0430\u0439\u043D5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043A\u04403\u049B\u0430\u04373\u0570\u0561\u05753\u05D9\u05E9\u05E8\u05D0\u05DC5\u05E7\u05D5\u05DD3\u0627\u0628\u0648\u0638\u0628\u064A5\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062F\u06464\u0628\u062D\u0631\u064A\u06465\u062C\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062F\u064A\u06296\u0639\u0644\u064A\u0627\u06465\u0645\u063A\u0631\u06285\u0645\u0627\u0631\u0627\u062A5\u06CC\u0631\u0627\u06465\u0628\u0627\u0631\u062A2\u0632\u0627\u06314\u064A\u062A\u06433\u06BE\u0627\u0631\u062A5\u062A\u0648\u0646\u06334\u0633\u0648\u062F\u0627\u06463\u0631\u064A\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064A\u06466\u0642\u0637\u06313\u0643\u0627\u062B\u0648\u0644\u064A\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064A\u0633\u064A\u06275\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067E\u0627\u06A9\u0633\u062A\u0627\u06467\u0680\u0627\u0631\u062A4\u0915\u0949\u092E3\u0928\u0947\u091F3\u092D\u093E\u0930\u09240\u092E\u094D3\u094B\u09245\u0938\u0902\u0917\u0920\u09285\u09AC\u09BE\u0982\u09B2\u09BE5\u09AD\u09BE\u09B0\u09A42\u09F0\u09A44\u0A2D\u0A3E\u0A30\u0A244\u0AAD\u0ABE\u0AB0\u0AA44\u0B2D\u0B3E\u0B30\u0B244\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE6\u0BB2\u0B99\u0BCD\u0B95\u0BC86\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD11\u0C2D\u0C3E\u0C30\u0C24\u0C4D5\u0CAD\u0CBE\u0CB0\u0CA44\u0D2D\u0D3E\u0D30\u0D24\u0D025\u0DBD\u0D82\u0D9A\u0DCF4\u0E04\u0E2D\u0E213\u0E44\u0E17\u0E223\u0EA5\u0EB2\u0EA73\u10D2\u10D42\u307F\u3093\u306A3\u30A2\u30DE\u30BE\u30F34\u30AF\u30E9\u30A6\u30C94\u30B0\u30FC\u30B0\u30EB4\u30B3\u30E02\u30B9\u30C8\u30A23\u30BB\u30FC\u30EB3\u30D5\u30A1\u30C3\u30B7\u30E7\u30F36\u30DD\u30A4\u30F3\u30C84\u4E16\u754C2\u4E2D\u4FE11\u56FD1\u570B1\u6587\u7F513\u4E9A\u9A6C\u900A3\u4F01\u4E1A2\u4F5B\u5C712\u4FE1\u606F2\u5065\u5EB72\u516B\u53662\u516C\u53F81\u76CA2\u53F0\u6E7E1\u70632\u5546\u57CE1\u5E971\u68072\u5609\u91CC0\u5927\u9152\u5E975\u5728\u7EBF2\u5927\u62FF2\u5929\u4E3B\u65593\u5A31\u4E502\u5BB6\u96FB2\u5E7F\u4E1C2\u5FAE\u535A2\u6148\u55842\u6211\u7231\u4F603\u624B\u673A2\u62DB\u80582\u653F\u52A11\u5E9C2\u65B0\u52A0\u57612\u95FB2\u65F6\u5C1A2\u66F8\u7C4D2\u673A\u67842\u6DE1\u9A6C\u95213\u6E38\u620F2\u6FB3\u95802\u70B9\u770B2\u79FB\u52A82\u7EC4\u7EC7\u673A\u67844\u7F51\u57401\u5E971\u7AD91\u7EDC2\u8054\u901A2\u8C37\u6B4C2\u8D2D\u72692\u901A\u8CA92\u96C6\u56E22\u96FB\u8A0A\u76C8\u79D14\u98DE\u5229\u6D663\u98DF\u54C12\u9910\u53852\u9999\u683C\u91CC\u62C93\u6E2F2\uB2F7\uB1371\uCEF42\uC0BC\uC1312\uD55C\uAD6D2";
5253
- var assign = (target, properties) => {
5254
- for (const key in properties) {
5255
- target[key] = properties[key];
5256
- }
5257
- return target;
5258
- };
5259
5283
  var numeric = "numeric";
5260
5284
  var ascii = "ascii";
5261
5285
  var alpha = "alpha";
@@ -5445,7 +5469,7 @@ State.prototype = {
5445
5469
  let nextState, templateState = state.go(input);
5446
5470
  if (templateState) {
5447
5471
  nextState = new State();
5448
- assign(nextState.j, templateState.j);
5472
+ Object.assign(nextState.j, templateState.j);
5449
5473
  nextState.jr.push.apply(nextState.jr, templateState.jr);
5450
5474
  nextState.jd = templateState.jd;
5451
5475
  nextState.t = templateState.t;
@@ -5455,7 +5479,7 @@ State.prototype = {
5455
5479
  if (t) {
5456
5480
  if (groups) {
5457
5481
  if (nextState.t && typeof nextState.t === "string") {
5458
- const allFlags = assign(flagsForToken(nextState.t, groups), flags);
5482
+ const allFlags = Object.assign(flagsForToken(nextState.t, groups), flags);
5459
5483
  addToGroups(t, allFlags, groups);
5460
5484
  } else if (flags) {
5461
5485
  addToGroups(t, flags, groups);
@@ -5528,61 +5552,61 @@ var EMOJI$1 = "EMOJI";
5528
5552
  var SYM = "SYM";
5529
5553
  var tk = /* @__PURE__ */ Object.freeze({
5530
5554
  __proto__: null,
5531
- WORD,
5532
- UWORD,
5533
- ASCIINUMERICAL,
5534
5555
  ALPHANUMERICAL,
5535
- LOCALHOST,
5536
- TLD,
5537
- UTLD,
5538
- SCHEME,
5539
- SLASH_SCHEME,
5540
- NUM,
5541
- WS,
5542
- NL,
5543
- OPENBRACE,
5544
- CLOSEBRACE,
5545
- OPENBRACKET,
5546
- CLOSEBRACKET,
5547
- OPENPAREN,
5548
- CLOSEPAREN,
5549
- OPENANGLEBRACKET,
5550
- CLOSEANGLEBRACKET,
5551
- FULLWIDTHLEFTPAREN,
5552
- FULLWIDTHRIGHTPAREN,
5553
- LEFTCORNERBRACKET,
5554
- RIGHTCORNERBRACKET,
5555
- LEFTWHITECORNERBRACKET,
5556
- RIGHTWHITECORNERBRACKET,
5557
- FULLWIDTHLESSTHAN,
5558
- FULLWIDTHGREATERTHAN,
5559
5556
  AMPERSAND,
5560
5557
  APOSTROPHE,
5558
+ ASCIINUMERICAL,
5561
5559
  ASTERISK,
5562
5560
  AT,
5563
5561
  BACKSLASH,
5564
5562
  BACKTICK,
5565
5563
  CARET,
5564
+ CLOSEANGLEBRACKET,
5565
+ CLOSEBRACE,
5566
+ CLOSEBRACKET,
5567
+ CLOSEPAREN,
5566
5568
  COLON,
5567
5569
  COMMA,
5568
5570
  DOLLAR,
5569
5571
  DOT,
5572
+ EMOJI: EMOJI$1,
5570
5573
  EQUALS,
5571
5574
  EXCLAMATION,
5575
+ FULLWIDTHGREATERTHAN,
5576
+ FULLWIDTHLEFTPAREN,
5577
+ FULLWIDTHLESSTHAN,
5578
+ FULLWIDTHMIDDLEDOT,
5579
+ FULLWIDTHRIGHTPAREN,
5572
5580
  HYPHEN,
5581
+ LEFTCORNERBRACKET,
5582
+ LEFTWHITECORNERBRACKET,
5583
+ LOCALHOST,
5584
+ NL,
5585
+ NUM,
5586
+ OPENANGLEBRACKET,
5587
+ OPENBRACE,
5588
+ OPENBRACKET,
5589
+ OPENPAREN,
5573
5590
  PERCENT,
5574
5591
  PIPE,
5575
5592
  PLUS,
5576
5593
  POUND,
5577
5594
  QUERY,
5578
5595
  QUOTE,
5579
- FULLWIDTHMIDDLEDOT,
5596
+ RIGHTCORNERBRACKET,
5597
+ RIGHTWHITECORNERBRACKET,
5598
+ SCHEME,
5580
5599
  SEMI,
5581
5600
  SLASH,
5601
+ SLASH_SCHEME,
5602
+ SYM,
5582
5603
  TILDE,
5604
+ TLD,
5583
5605
  UNDERSCORE,
5584
- EMOJI: EMOJI$1,
5585
- SYM
5606
+ UTLD,
5607
+ UWORD,
5608
+ WORD,
5609
+ WS
5586
5610
  });
5587
5611
  var ASCII_LETTER = /[a-z]/;
5588
5612
  var LETTER = /\p{L}/u;
@@ -5755,7 +5779,7 @@ function init$2(customSchemes = []) {
5755
5779
  Start.jd = new State(SYM);
5756
5780
  return {
5757
5781
  start: Start,
5758
- tokens: assign({
5782
+ tokens: Object.assign({
5759
5783
  groups
5760
5784
  }, tk)
5761
5785
  };
@@ -5875,9 +5899,9 @@ var defaults2 = {
5875
5899
  render: null
5876
5900
  };
5877
5901
  function Options(opts, defaultRender = null) {
5878
- let o = assign({}, defaults2);
5902
+ let o = Object.assign({}, defaults2);
5879
5903
  if (opts) {
5880
- o = assign(o, opts instanceof Options ? opts.o : opts);
5904
+ o = Object.assign(o, opts instanceof Options ? opts.o : opts);
5881
5905
  }
5882
5906
  const ignoredTags = o.ignoreTags;
5883
5907
  const uppercaseIgnoredTags = [];
@@ -6094,7 +6118,7 @@ MultiToken.prototype = {
6094
6118
  attributes.rel = rel;
6095
6119
  }
6096
6120
  if (attrs) {
6097
- assign(attributes, attrs);
6121
+ Object.assign(attributes, attrs);
6098
6122
  }
6099
6123
  return {
6100
6124
  tagName,
@@ -6151,7 +6175,7 @@ function init$1({
6151
6175
  groups
6152
6176
  }) {
6153
6177
  const qsAccepting = groups.domain.concat([AMPERSAND, ASTERISK, AT, BACKSLASH, BACKTICK, CARET, DOLLAR, EQUALS, HYPHEN, NUM, PERCENT, PIPE, PLUS, POUND, SLASH, SYM, TILDE, UNDERSCORE]);
6154
- const qsNonAccepting = [COLON, COMMA, DOT, EXCLAMATION, PERCENT, QUERY, QUOTE, SEMI, OPENANGLEBRACKET, CLOSEANGLEBRACKET, OPENBRACE, CLOSEBRACE, CLOSEBRACKET, OPENBRACKET, OPENPAREN, CLOSEPAREN, FULLWIDTHLEFTPAREN, FULLWIDTHRIGHTPAREN, LEFTCORNERBRACKET, RIGHTCORNERBRACKET, LEFTWHITECORNERBRACKET, RIGHTWHITECORNERBRACKET, FULLWIDTHLESSTHAN, FULLWIDTHGREATERTHAN];
6178
+ const qsNonAccepting = [APOSTROPHE, COLON, COMMA, DOT, EXCLAMATION, PERCENT, QUERY, QUOTE, SEMI, OPENANGLEBRACKET, CLOSEANGLEBRACKET, OPENBRACE, CLOSEBRACE, CLOSEBRACKET, OPENBRACKET, OPENPAREN, CLOSEPAREN, FULLWIDTHLEFTPAREN, FULLWIDTHRIGHTPAREN, LEFTCORNERBRACKET, RIGHTCORNERBRACKET, LEFTWHITECORNERBRACKET, RIGHTWHITECORNERBRACKET, FULLWIDTHLESSTHAN, FULLWIDTHGREATERTHAN];
6155
6179
  const localpartAccepting = [AMPERSAND, APOSTROPHE, ASTERISK, BACKSLASH, BACKTICK, CARET, DOLLAR, EQUALS, HYPHEN, OPENBRACE, CLOSEBRACE, PERCENT, PIPE, PLUS, POUND, QUERY, SLASH, SYM, TILDE, UNDERSCORE];
6156
6180
  const Start = makeState();
6157
6181
  const Localpart = tt(Start, TILDE);
@@ -7958,21 +7982,242 @@ var SearchController = class {
7958
7982
  }
7959
7983
  };
7960
7984
 
7985
+ // src/pagination/BasePaginator.ts
7986
+ var DEFAULT_PAGINATION_OPTIONS = {
7987
+ debounceMs: 300,
7988
+ pageSize: 10
7989
+ };
7990
+ var BasePaginator = class {
7991
+ constructor(options) {
7992
+ this._isCursorPagination = false;
7993
+ this.setDebounceOptions = ({ debounceMs }) => {
7994
+ this._executeQueryDebounced = debounce(this.executeQuery.bind(this), debounceMs);
7995
+ };
7996
+ this.canExecuteQuery = (direction) => !this.isLoading && direction === "next" && this.hasNext || direction === "prev" && this.hasPrev;
7997
+ this.next = () => this.executeQuery({ direction: "next" });
7998
+ this.prev = () => this.executeQuery({ direction: "prev" });
7999
+ this.nextDebounced = () => {
8000
+ this._executeQueryDebounced({ direction: "next" });
8001
+ };
8002
+ this.prevDebounced = () => {
8003
+ this._executeQueryDebounced({ direction: "prev" });
8004
+ };
8005
+ const { debounceMs, pageSize } = { ...DEFAULT_PAGINATION_OPTIONS, ...options };
8006
+ this.pageSize = pageSize;
8007
+ this.state = new StateStore(this.initialState);
8008
+ this.setDebounceOptions({ debounceMs });
8009
+ }
8010
+ get lastQueryError() {
8011
+ return this.state.getLatestValue().lastQueryError;
8012
+ }
8013
+ get hasNext() {
8014
+ return this.state.getLatestValue().hasNext;
8015
+ }
8016
+ get hasPrev() {
8017
+ return this.state.getLatestValue().hasPrev;
8018
+ }
8019
+ get hasResults() {
8020
+ return Array.isArray(this.state.getLatestValue().items);
8021
+ }
8022
+ get isLoading() {
8023
+ return this.state.getLatestValue().isLoading;
8024
+ }
8025
+ get initialState() {
8026
+ return {
8027
+ hasNext: true,
8028
+ hasPrev: true,
8029
+ //todo: check if optimistic value does not cause problems in UI
8030
+ isLoading: false,
8031
+ items: void 0,
8032
+ lastQueryError: void 0,
8033
+ cursor: void 0,
8034
+ offset: 0
8035
+ };
8036
+ }
8037
+ get items() {
8038
+ return this.state.getLatestValue().items;
8039
+ }
8040
+ get cursor() {
8041
+ return this.state.getLatestValue().cursor;
8042
+ }
8043
+ get offset() {
8044
+ return this.state.getLatestValue().offset;
8045
+ }
8046
+ getStateBeforeFirstQuery() {
8047
+ return {
8048
+ ...this.initialState,
8049
+ isLoading: true
8050
+ };
8051
+ }
8052
+ getStateAfterQuery(stateUpdate, isFirstPage) {
8053
+ const current = this.state.getLatestValue();
8054
+ return {
8055
+ ...current,
8056
+ lastQueryError: void 0,
8057
+ // reset lastQueryError that can be overridden by the stateUpdate
8058
+ ...stateUpdate,
8059
+ isLoading: false,
8060
+ items: isFirstPage ? stateUpdate.items : [...this.items ?? [], ...stateUpdate.items || []]
8061
+ };
8062
+ }
8063
+ async executeQuery({ direction }) {
8064
+ if (!this.canExecuteQuery(direction)) return;
8065
+ const isFirstPage = typeof this.items === "undefined";
8066
+ if (isFirstPage) {
8067
+ this.state.next(this.getStateBeforeFirstQuery());
8068
+ } else {
8069
+ this.state.partialNext({ isLoading: true });
8070
+ }
8071
+ const stateUpdate = {};
8072
+ try {
8073
+ const results = await this.query({ direction });
8074
+ if (!results) return;
8075
+ const { items, next, prev } = results;
8076
+ if (isFirstPage && (next || prev)) {
8077
+ this._isCursorPagination = true;
8078
+ }
8079
+ if (this._isCursorPagination) {
8080
+ stateUpdate.cursor = { next: next || null, prev: prev || null };
8081
+ stateUpdate.hasNext = !!next;
8082
+ stateUpdate.hasPrev = !!prev;
8083
+ } else {
8084
+ stateUpdate.offset = (this.offset ?? 0) + items.length;
8085
+ stateUpdate.hasNext = items.length === this.pageSize;
8086
+ }
8087
+ stateUpdate.items = await this.filterQueryResults(items);
8088
+ } catch (e) {
8089
+ stateUpdate.lastQueryError = e;
8090
+ } finally {
8091
+ this.state.next(this.getStateAfterQuery(stateUpdate, isFirstPage));
8092
+ }
8093
+ }
8094
+ cancelScheduledQuery() {
8095
+ this._executeQueryDebounced.cancel();
8096
+ }
8097
+ resetState() {
8098
+ this.state.next(this.initialState);
8099
+ }
8100
+ };
8101
+
8102
+ // src/pagination/FilterBuilder.ts
8103
+ var FilterBuilder = class {
8104
+ constructor(params) {
8105
+ this.context = new StateStore(params?.initialContext ?? {});
8106
+ this.filterConfig = new StateStore(
8107
+ params?.initialFilterConfig ?? {}
8108
+ );
8109
+ }
8110
+ updateFilterConfig(config) {
8111
+ this.filterConfig.partialNext(config);
8112
+ }
8113
+ enableFilter(filterKey) {
8114
+ const config = this.filterConfig.getLatestValue();
8115
+ if (config[filterKey]) {
8116
+ this.filterConfig.partialNext({
8117
+ [filterKey]: {
8118
+ ...config[filterKey],
8119
+ enabled: true
8120
+ }
8121
+ });
8122
+ }
8123
+ }
8124
+ disableFilter(filterKey) {
8125
+ const config = this.filterConfig.getLatestValue();
8126
+ if (config[filterKey]) {
8127
+ this.filterConfig.partialNext({
8128
+ [filterKey]: {
8129
+ ...config[filterKey],
8130
+ enabled: false
8131
+ }
8132
+ });
8133
+ }
8134
+ }
8135
+ updateContext(newContext) {
8136
+ this.context.partialNext(newContext);
8137
+ }
8138
+ buildFilters(params) {
8139
+ const filters = {
8140
+ ...params?.baseFilters ?? {}
8141
+ };
8142
+ const filterConfig = this.filterConfig.getLatestValue();
8143
+ for (const key in filterConfig) {
8144
+ const configItem = filterConfig[key];
8145
+ if (!configItem?.enabled) continue;
8146
+ const generated = configItem.generate({
8147
+ ...this.context.getLatestValue(),
8148
+ ...params?.context ?? {}
8149
+ });
8150
+ if (generated) Object.assign(filters, generated);
8151
+ }
8152
+ return filters;
8153
+ }
8154
+ };
8155
+
8156
+ // src/pagination/ReminderPaginator.ts
8157
+ var ReminderPaginator = class extends BasePaginator {
8158
+ constructor(client, options) {
8159
+ super(options);
8160
+ this.query = async ({
8161
+ direction
8162
+ }) => {
8163
+ const cursor = this.cursor?.[direction];
8164
+ const {
8165
+ reminders: items,
8166
+ next,
8167
+ prev
8168
+ } = await this.client.queryReminders({
8169
+ filter: this.filters,
8170
+ sort: this.sort,
8171
+ limit: this.pageSize,
8172
+ [direction]: cursor
8173
+ });
8174
+ return { items, next, prev };
8175
+ };
8176
+ this.filterQueryResults = (items) => items;
8177
+ this.client = client;
8178
+ }
8179
+ get filters() {
8180
+ return this._filters;
8181
+ }
8182
+ get sort() {
8183
+ return this._sort;
8184
+ }
8185
+ set filters(filters) {
8186
+ this._filters = filters;
8187
+ this.resetState();
8188
+ }
8189
+ set sort(sort) {
8190
+ this._sort = sort;
8191
+ this.resetState();
8192
+ }
8193
+ };
8194
+
7961
8195
  // src/search/UserSearchSource.ts
7962
8196
  var UserSearchSource = class extends BaseSearchSource {
7963
- constructor(client, options) {
8197
+ constructor(client, options, filterBuilderOptions = {}) {
7964
8198
  super(options);
7965
8199
  this.type = "users";
7966
8200
  this.client = client;
8201
+ this.filterBuilder = new FilterBuilder({
8202
+ initialFilterConfig: {
8203
+ $or: {
8204
+ enabled: true,
8205
+ generate: ({ searchQuery }) => searchQuery ? {
8206
+ $or: [
8207
+ { id: { $autocomplete: searchQuery } },
8208
+ { name: { $autocomplete: searchQuery } }
8209
+ ]
8210
+ } : null
8211
+ }
8212
+ },
8213
+ ...filterBuilderOptions
8214
+ });
7967
8215
  }
7968
8216
  async query(searchQuery) {
7969
- const filters = {
7970
- $or: [
7971
- { id: { $autocomplete: searchQuery } },
7972
- { name: { $autocomplete: searchQuery } }
7973
- ],
7974
- ...this.filters
7975
- };
8217
+ const filters = this.filterBuilder.buildFilters({
8218
+ baseFilters: this.filters,
8219
+ context: { searchQuery }
8220
+ });
7976
8221
  const sort = { id: 1, ...this.sort };
7977
8222
  const options = { ...this.searchOptions, limit: this.pageSize, offset: this.offset };
7978
8223
  const { users } = await this.client.queryUsers(filters, sort, options);
@@ -7985,17 +8230,29 @@ var UserSearchSource = class extends BaseSearchSource {
7985
8230
 
7986
8231
  // src/search/ChannelSearchSource.ts
7987
8232
  var ChannelSearchSource = class extends BaseSearchSource {
7988
- constructor(client, options) {
8233
+ constructor(client, options, filterBuilderOptions = {}) {
7989
8234
  super(options);
7990
8235
  this.type = "channels";
7991
8236
  this.client = client;
8237
+ this.filterBuilder = new FilterBuilder({
8238
+ ...filterBuilderOptions,
8239
+ initialFilterConfig: {
8240
+ name: {
8241
+ enabled: true,
8242
+ generate: ({ searchQuery }) => searchQuery ? { name: { $autocomplete: searchQuery } } : null
8243
+ },
8244
+ ...filterBuilderOptions.initialFilterConfig
8245
+ }
8246
+ });
7992
8247
  }
7993
8248
  async query(searchQuery) {
7994
- const filters = {
7995
- members: { $in: [this.client.userID] },
7996
- name: { $autocomplete: searchQuery },
7997
- ...this.filters
7998
- };
8249
+ const filters = this.filterBuilder.buildFilters({
8250
+ baseFilters: {
8251
+ ...this.client.userID ? { members: { $in: [this.client.userID] } } : {},
8252
+ ...this.filters
8253
+ },
8254
+ context: { searchQuery }
8255
+ });
7999
8256
  const sort = this.sort ?? {};
8000
8257
  const options = { ...this.searchOptions, limit: this.pageSize, offset: this.offset };
8001
8258
  const items = await this.client.queryChannels(filters, sort, options);
@@ -8008,23 +8265,48 @@ var ChannelSearchSource = class extends BaseSearchSource {
8008
8265
 
8009
8266
  // src/search/MessageSearchSource.ts
8010
8267
  var MessageSearchSource = class extends BaseSearchSource {
8011
- constructor(client, options) {
8268
+ constructor(client, options, filterBuilderOptions) {
8012
8269
  super(options);
8013
8270
  this.type = "messages";
8014
8271
  this.client = client;
8272
+ this.messageSearchChannelFilterBuilder = new FilterBuilder(filterBuilderOptions?.messageSearchChannel);
8273
+ this.messageSearchFilterBuilder = new FilterBuilder({
8274
+ ...filterBuilderOptions?.messageSearch,
8275
+ initialFilterConfig: {
8276
+ text: {
8277
+ enabled: true,
8278
+ generate: ({ searchQuery }) => searchQuery ? { text: searchQuery } : null
8279
+ },
8280
+ ...filterBuilderOptions?.messageSearch?.initialFilterConfig
8281
+ }
8282
+ });
8283
+ this.channelQueryFilterBuilder = new FilterBuilder({
8284
+ ...filterBuilderOptions?.channelQuery,
8285
+ initialFilterConfig: {
8286
+ cid: {
8287
+ enabled: true,
8288
+ generate: ({ cids }) => cids ? { cid: { $in: cids } } : null
8289
+ },
8290
+ ...filterBuilderOptions?.channelQuery?.initialFilterConfig
8291
+ }
8292
+ });
8015
8293
  }
8016
8294
  async query(searchQuery) {
8017
- if (!this.client.userID) return { items: [] };
8018
- const channelFilters = {
8019
- members: { $in: [this.client.userID] },
8020
- ...this.messageSearchChannelFilters
8021
- };
8022
- const messageFilters = {
8023
- text: searchQuery,
8024
- type: "regular",
8025
- // FIXME: type: 'reply' resp. do not filter by type and allow to jump to a message in a thread - missing support
8026
- ...this.messageSearchFilters
8027
- };
8295
+ if (!this.client.userID || !searchQuery || this.next === null) return { items: [] };
8296
+ const channelFilters = this.messageSearchChannelFilterBuilder.buildFilters({
8297
+ baseFilters: {
8298
+ ...this.client.userID ? { members: { $in: [this.client.userID] } } : {},
8299
+ ...this.messageSearchChannelFilters
8300
+ },
8301
+ context: { searchQuery }
8302
+ });
8303
+ const messageFilters = this.messageSearchFilterBuilder.buildFilters({
8304
+ baseFilters: {
8305
+ type: "regular",
8306
+ ...this.messageSearchFilters
8307
+ },
8308
+ context: { searchQuery }
8309
+ });
8028
8310
  const sort = {
8029
8311
  created_at: -1,
8030
8312
  ...this.messageSearchSort
@@ -8045,15 +8327,14 @@ var MessageSearchSource = class extends BaseSearchSource {
8045
8327
  if (message.cid && !this.client.activeChannels[message.cid]) acc.add(message.cid);
8046
8328
  return acc;
8047
8329
  }, /* @__PURE__ */ new Set())
8048
- // keep the cids unique
8049
8330
  );
8050
- const allChannelsLoadedLocally = cids.length === 0;
8051
- if (!allChannelsLoadedLocally) {
8331
+ if (cids.length > 0) {
8332
+ const channelQueryFilters = this.channelQueryFilterBuilder.buildFilters({
8333
+ baseFilters: this.channelQueryFilters,
8334
+ context: { cids }
8335
+ });
8052
8336
  await this.client.queryChannels(
8053
- {
8054
- cid: { $in: cids },
8055
- ...this.channelQueryFilters
8056
- },
8337
+ channelQueryFilters,
8057
8338
  {
8058
8339
  last_message_at: -1,
8059
8340
  ...this.channelQuerySort
@@ -11451,6 +11732,15 @@ var Channel = class {
11451
11732
  }
11452
11733
  }
11453
11734
  break;
11735
+ case "user.messages.deleted":
11736
+ if (event.user) {
11737
+ this.state.deleteUserMessages(
11738
+ event.user,
11739
+ !!event.hard_delete,
11740
+ new Date(event.created_at ?? Date.now())
11741
+ );
11742
+ }
11743
+ break;
11454
11744
  case "message.new":
11455
11745
  if (event.message) {
11456
11746
  const ownMessage = event.user?.id === this.getClient().user?.id;
@@ -14369,162 +14659,6 @@ _Reminder.toStateValue = (data) => ({
14369
14659
  });
14370
14660
  var Reminder = _Reminder;
14371
14661
 
14372
- // src/pagination/BasePaginator.ts
14373
- var DEFAULT_PAGINATION_OPTIONS = {
14374
- debounceMs: 300,
14375
- pageSize: 10
14376
- };
14377
- var BasePaginator = class {
14378
- constructor(options) {
14379
- this._isCursorPagination = false;
14380
- this.setDebounceOptions = ({ debounceMs }) => {
14381
- this._executeQueryDebounced = debounce(this.executeQuery.bind(this), debounceMs);
14382
- };
14383
- this.canExecuteQuery = (direction) => !this.isLoading && direction === "next" && this.hasNext || direction === "prev" && this.hasPrev;
14384
- this.next = () => this.executeQuery({ direction: "next" });
14385
- this.prev = () => this.executeQuery({ direction: "prev" });
14386
- this.nextDebounced = () => {
14387
- this._executeQueryDebounced({ direction: "next" });
14388
- };
14389
- this.prevDebounced = () => {
14390
- this._executeQueryDebounced({ direction: "prev" });
14391
- };
14392
- const { debounceMs, pageSize } = { ...DEFAULT_PAGINATION_OPTIONS, ...options };
14393
- this.pageSize = pageSize;
14394
- this.state = new StateStore(this.initialState);
14395
- this.setDebounceOptions({ debounceMs });
14396
- }
14397
- get lastQueryError() {
14398
- return this.state.getLatestValue().lastQueryError;
14399
- }
14400
- get hasNext() {
14401
- return this.state.getLatestValue().hasNext;
14402
- }
14403
- get hasPrev() {
14404
- return this.state.getLatestValue().hasPrev;
14405
- }
14406
- get hasResults() {
14407
- return Array.isArray(this.state.getLatestValue().items);
14408
- }
14409
- get isLoading() {
14410
- return this.state.getLatestValue().isLoading;
14411
- }
14412
- get initialState() {
14413
- return {
14414
- hasNext: true,
14415
- hasPrev: true,
14416
- //todo: check if optimistic value does not cause problems in UI
14417
- isLoading: false,
14418
- items: void 0,
14419
- lastQueryError: void 0,
14420
- cursor: void 0,
14421
- offset: 0
14422
- };
14423
- }
14424
- get items() {
14425
- return this.state.getLatestValue().items;
14426
- }
14427
- get cursor() {
14428
- return this.state.getLatestValue().cursor;
14429
- }
14430
- get offset() {
14431
- return this.state.getLatestValue().offset;
14432
- }
14433
- getStateBeforeFirstQuery() {
14434
- return {
14435
- ...this.initialState,
14436
- isLoading: true
14437
- };
14438
- }
14439
- getStateAfterQuery(stateUpdate, isFirstPage) {
14440
- const current = this.state.getLatestValue();
14441
- return {
14442
- ...current,
14443
- lastQueryError: void 0,
14444
- // reset lastQueryError that can be overridden by the stateUpdate
14445
- ...stateUpdate,
14446
- isLoading: false,
14447
- items: isFirstPage ? stateUpdate.items : [...this.items ?? [], ...stateUpdate.items || []]
14448
- };
14449
- }
14450
- async executeQuery({ direction }) {
14451
- if (!this.canExecuteQuery(direction)) return;
14452
- const isFirstPage = typeof this.items === "undefined";
14453
- if (isFirstPage) {
14454
- this.state.next(this.getStateBeforeFirstQuery());
14455
- } else {
14456
- this.state.partialNext({ isLoading: true });
14457
- }
14458
- const stateUpdate = {};
14459
- try {
14460
- const results = await this.query({ direction });
14461
- if (!results) return;
14462
- const { items, next, prev } = results;
14463
- if (isFirstPage && (next || prev)) {
14464
- this._isCursorPagination = true;
14465
- }
14466
- if (this._isCursorPagination) {
14467
- stateUpdate.cursor = { next: next || null, prev: prev || null };
14468
- stateUpdate.hasNext = !!next;
14469
- stateUpdate.hasPrev = !!prev;
14470
- } else {
14471
- stateUpdate.offset = (this.offset ?? 0) + items.length;
14472
- stateUpdate.hasNext = items.length === this.pageSize;
14473
- }
14474
- stateUpdate.items = await this.filterQueryResults(items);
14475
- } catch (e) {
14476
- stateUpdate.lastQueryError = e;
14477
- } finally {
14478
- this.state.next(this.getStateAfterQuery(stateUpdate, isFirstPage));
14479
- }
14480
- }
14481
- cancelScheduledQuery() {
14482
- this._executeQueryDebounced.cancel();
14483
- }
14484
- resetState() {
14485
- this.state.next(this.initialState);
14486
- }
14487
- };
14488
-
14489
- // src/pagination/ReminderPaginator.ts
14490
- var ReminderPaginator = class extends BasePaginator {
14491
- constructor(client, options) {
14492
- super(options);
14493
- this.query = async ({
14494
- direction
14495
- }) => {
14496
- const cursor = this.cursor?.[direction];
14497
- const {
14498
- reminders: items,
14499
- next,
14500
- prev
14501
- } = await this.client.queryReminders({
14502
- filter: this.filters,
14503
- sort: this.sort,
14504
- limit: this.pageSize,
14505
- [direction]: cursor
14506
- });
14507
- return { items, next, prev };
14508
- };
14509
- this.filterQueryResults = (items) => items;
14510
- this.client = client;
14511
- }
14512
- get filters() {
14513
- return this._filters;
14514
- }
14515
- get sort() {
14516
- return this._sort;
14517
- }
14518
- set filters(filters) {
14519
- this._filters = filters;
14520
- this.resetState();
14521
- }
14522
- set sort(sort) {
14523
- this._sort = sort;
14524
- this.resetState();
14525
- }
14526
- };
14527
-
14528
14662
  // src/reminders/ReminderManager.ts
14529
14663
  var oneMinute2 = 60 * 1e3;
14530
14664
  var oneHour2 = 60 * oneMinute2;
@@ -15087,13 +15221,13 @@ var StreamChat = class _StreamChat {
15087
15221
  * @param {UserResponse} user
15088
15222
  * @param {boolean} hardDelete
15089
15223
  */
15090
- this._deleteUserMessageReference = (user, hardDelete = false) => {
15224
+ this._deleteUserMessageReference = (user, hardDelete = false, deletedAt) => {
15091
15225
  const refMap = this.state.userChannelReferences[user.id] || {};
15092
15226
  for (const channelID in refMap) {
15093
15227
  const channel = this.activeChannels[channelID];
15094
15228
  if (channel) {
15095
15229
  const state = channel.state;
15096
- state?.deleteUserMessages(user, hardDelete);
15230
+ state?.deleteUserMessages(user, hardDelete, deletedAt);
15097
15231
  }
15098
15232
  }
15099
15233
  };
@@ -15139,7 +15273,11 @@ var StreamChat = class _StreamChat {
15139
15273
  this._updateUserMessageReferences(event.user);
15140
15274
  }
15141
15275
  if (event.type === "user.deleted" && event.user.deleted_at && (event.mark_messages_deleted || event.hard_delete)) {
15142
- this._deleteUserMessageReference(event.user, event.hard_delete);
15276
+ this._deleteUserMessageReference(
15277
+ event.user,
15278
+ event.hard_delete,
15279
+ event.user.deleted_at ? new Date(event.user.deleted_at) : null
15280
+ );
15143
15281
  }
15144
15282
  };
15145
15283
  this._callClientListeners = (event) => {
@@ -15709,6 +15847,13 @@ var StreamChat = class _StreamChat {
15709
15847
  if (event.type === "user.presence.changed" || event.type === "user.updated" || event.type === "user.deleted") {
15710
15848
  this._handleUserEvent(event);
15711
15849
  }
15850
+ if (event.type === "user.messages.deleted" && !event.cid && event.user) {
15851
+ this._deleteUserMessageReference(
15852
+ event.user,
15853
+ event.hard_delete,
15854
+ event.created_at ? new Date(event.created_at) : null
15855
+ );
15856
+ }
15712
15857
  if (event.type === "health.check" && event.me) {
15713
15858
  client.user = event.me;
15714
15859
  client.state.updateUser(event.me);
@@ -16969,7 +17114,7 @@ var StreamChat = class _StreamChat {
16969
17114
  if (this.userAgent) {
16970
17115
  return this.userAgent;
16971
17116
  }
16972
- const version = "9.16.0";
17117
+ const version = "9.17.0";
16973
17118
  const clientBundle = "browser-esm";
16974
17119
  let userAgentString = "";
16975
17120
  if (this.sdkIdentifier) {
@@ -18167,6 +18312,7 @@ var EVENT_MAP = {
18167
18312
  "typing.stop": true,
18168
18313
  "user.banned": true,
18169
18314
  "user.deleted": true,
18315
+ "user.messages.deleted": true,
18170
18316
  "user.presence.changed": true,
18171
18317
  "user.unbanned": true,
18172
18318
  "user.unread_message_reminder": true,
@@ -19330,6 +19476,7 @@ export {
19330
19476
  DevToken,
19331
19477
  EVENT_MAP,
19332
19478
  ErrorFromResponse,
19479
+ FilterBuilder,
19333
19480
  FixedSizeQueueCache,
19334
19481
  InsightMetrics,
19335
19482
  JWTServerToken,