@liip/liipgpt 3.8.3 → 3.9.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.
Files changed (36) hide show
  1. package/button/liipgpt-button.iife.js +2 -2
  2. package/chat/liipgpt-chat.iife.js +3 -3
  3. package/config/index.cjs +2 -1
  4. package/config/index.d.ts +40 -0
  5. package/config/index.js +2 -1
  6. package/configurator/_app/env.js +1 -1
  7. package/configurator/_app/immutable/chunks/{MC0coRHJ.js → BKESH8zC.js} +1 -1
  8. package/configurator/_app/immutable/chunks/{Bu_-InX1.js → BKZTsJMz.js} +1 -1
  9. package/configurator/_app/immutable/chunks/{B08O5lEA.js → BX7oppMQ.js} +1 -1
  10. package/configurator/_app/immutable/chunks/{BUUeJ3PL.js → BiMiaf32.js} +1 -1
  11. package/configurator/_app/immutable/chunks/{CDdeR5pk.js → BoSlghYU.js} +1 -1
  12. package/configurator/_app/immutable/chunks/{De77gmQ_.js → C8BUw-Wc.js} +1 -1
  13. package/configurator/_app/immutable/chunks/{I5yNRJE1.js → CW8XT_f0.js} +1 -1
  14. package/configurator/_app/immutable/chunks/{CSTjgsmX.js → CWvh3_h0.js} +2 -2
  15. package/configurator/_app/immutable/chunks/{Bk4g5DYk.js → CzlKx6Dn.js} +1 -1
  16. package/configurator/_app/immutable/chunks/{CEu7mztv.js → DGbgqVw-.js} +1 -1
  17. package/configurator/_app/immutable/chunks/{DRp9CXa9.js → DWxJNFvO.js} +1 -1
  18. package/configurator/_app/immutable/chunks/{-qY1__IK.js → Dn_5PWao.js} +2 -2
  19. package/configurator/_app/immutable/chunks/{BcilqXKJ.js → IPBcm7Y9.js} +1 -1
  20. package/configurator/_app/immutable/chunks/{BAjfX0W5.js → cE02ifhd.js} +1 -1
  21. package/configurator/_app/immutable/chunks/{sO26aA7w.js → kfKo0Lxm.js} +1 -1
  22. package/configurator/_app/immutable/entry/{app.BmOUkFX-.js → app.CwqfSUK4.js} +2 -2
  23. package/configurator/_app/immutable/entry/start.C9g5qB7o.js +1 -0
  24. package/configurator/_app/immutable/nodes/{0.-KJpMwiy.js → 0.WsdkbKsV.js} +1 -1
  25. package/configurator/_app/immutable/nodes/{1.DN5O46GR.js → 1.2qVIdLFb.js} +1 -1
  26. package/configurator/_app/immutable/nodes/{2.pnjjXJQ9.js → 2.zFWWXwja.js} +3 -3
  27. package/configurator/_app/immutable/nodes/{3.Bz5VupwB.js → 3.YVKriLPj.js} +1 -1
  28. package/configurator/_app/version.json +1 -1
  29. package/configurator/index.html +6 -6
  30. package/configurator/sidebar.html +6 -6
  31. package/index.cjs +2 -1
  32. package/index.d.ts +144 -0
  33. package/index.js +2 -1
  34. package/package.json +1 -1
  35. package/search-summary/liipgpt-search-summary.iife.js +1 -1
  36. package/configurator/_app/immutable/entry/start.CLMeMkjm.js +0 -1
package/index.d.ts CHANGED
@@ -4140,6 +4140,10 @@ export declare const chatMessageBotStreamingSchema: z.ZodObject<{
4140
4140
  ]>>;
4141
4141
  retrievalQuestion: z.ZodOptional<z.ZodString>;
4142
4142
  noFeedback: z.ZodOptional<z.ZodBoolean>;
4143
+ feedback: z.ZodOptional<z.ZodEnum<{
4144
+ up: "up";
4145
+ down: "down";
4146
+ }>>;
4143
4147
  state: z.ZodEnum<{
4144
4148
  streaming: "streaming";
4145
4149
  done: "done";
@@ -4279,6 +4283,10 @@ export declare const chatMessageBotLoadingSchema: z.ZodObject<{
4279
4283
  ]>>;
4280
4284
  retrievalQuestion: z.ZodOptional<z.ZodString>;
4281
4285
  noFeedback: z.ZodOptional<z.ZodBoolean>;
4286
+ feedback: z.ZodOptional<z.ZodEnum<{
4287
+ up: "up";
4288
+ down: "down";
4289
+ }>>;
4282
4290
  state: z.ZodLiteral<"loading">;
4283
4291
  }, z.core.$strip>;
4284
4292
  export declare const chatContentSchema: z.ZodUnion<readonly [
@@ -4416,6 +4424,10 @@ export declare const chatContentSchema: z.ZodUnion<readonly [
4416
4424
  ]>>;
4417
4425
  retrievalQuestion: z.ZodOptional<z.ZodString>;
4418
4426
  noFeedback: z.ZodOptional<z.ZodBoolean>;
4427
+ feedback: z.ZodOptional<z.ZodEnum<{
4428
+ up: "up";
4429
+ down: "down";
4430
+ }>>;
4419
4431
  state: z.ZodLiteral<"loading">;
4420
4432
  }, z.core.$strip>,
4421
4433
  z.ZodObject<{
@@ -4552,6 +4564,10 @@ export declare const chatContentSchema: z.ZodUnion<readonly [
4552
4564
  ]>>;
4553
4565
  retrievalQuestion: z.ZodOptional<z.ZodString>;
4554
4566
  noFeedback: z.ZodOptional<z.ZodBoolean>;
4567
+ feedback: z.ZodOptional<z.ZodEnum<{
4568
+ up: "up";
4569
+ down: "down";
4570
+ }>>;
4555
4571
  state: z.ZodEnum<{
4556
4572
  streaming: "streaming";
4557
4573
  done: "done";
@@ -4694,6 +4710,10 @@ export declare const chatMessageSchema: z.ZodUnion<readonly [
4694
4710
  ]>>;
4695
4711
  retrievalQuestion: z.ZodOptional<z.ZodString>;
4696
4712
  noFeedback: z.ZodOptional<z.ZodBoolean>;
4713
+ feedback: z.ZodOptional<z.ZodEnum<{
4714
+ up: "up";
4715
+ down: "down";
4716
+ }>>;
4697
4717
  state: z.ZodLiteral<"loading">;
4698
4718
  }, z.core.$strip>,
4699
4719
  z.ZodObject<{
@@ -4830,6 +4850,10 @@ export declare const chatMessageSchema: z.ZodUnion<readonly [
4830
4850
  ]>>;
4831
4851
  retrievalQuestion: z.ZodOptional<z.ZodString>;
4832
4852
  noFeedback: z.ZodOptional<z.ZodBoolean>;
4853
+ feedback: z.ZodOptional<z.ZodEnum<{
4854
+ up: "up";
4855
+ down: "down";
4856
+ }>>;
4833
4857
  state: z.ZodEnum<{
4834
4858
  streaming: "streaming";
4835
4859
  done: "done";
@@ -6435,6 +6459,10 @@ export declare const completeChatConfigSchema: z.ZodObject<{
6435
6459
  ]>>;
6436
6460
  retrievalQuestion: z.ZodOptional<z.ZodString>;
6437
6461
  noFeedback: z.ZodOptional<z.ZodBoolean>;
6462
+ feedback: z.ZodOptional<z.ZodEnum<{
6463
+ up: "up";
6464
+ down: "down";
6465
+ }>>;
6438
6466
  state: z.ZodLiteral<"loading">;
6439
6467
  }, z.core.$strip>,
6440
6468
  z.ZodObject<{
@@ -6571,6 +6599,10 @@ export declare const completeChatConfigSchema: z.ZodObject<{
6571
6599
  ]>>;
6572
6600
  retrievalQuestion: z.ZodOptional<z.ZodString>;
6573
6601
  noFeedback: z.ZodOptional<z.ZodBoolean>;
6602
+ feedback: z.ZodOptional<z.ZodEnum<{
6603
+ up: "up";
6604
+ down: "down";
6605
+ }>>;
6574
6606
  state: z.ZodEnum<{
6575
6607
  streaming: "streaming";
6576
6608
  done: "done";
@@ -6785,6 +6817,10 @@ export declare const completeChatConfigSchema: z.ZodObject<{
6785
6817
  ]>>;
6786
6818
  retrievalQuestion: z.ZodOptional<z.ZodString>;
6787
6819
  noFeedback: z.ZodOptional<z.ZodBoolean>;
6820
+ feedback: z.ZodOptional<z.ZodEnum<{
6821
+ up: "up";
6822
+ down: "down";
6823
+ }>>;
6788
6824
  state: z.ZodLiteral<"loading">;
6789
6825
  }, z.core.$strip>,
6790
6826
  z.ZodObject<{
@@ -6921,6 +6957,10 @@ export declare const completeChatConfigSchema: z.ZodObject<{
6921
6957
  ]>>;
6922
6958
  retrievalQuestion: z.ZodOptional<z.ZodString>;
6923
6959
  noFeedback: z.ZodOptional<z.ZodBoolean>;
6960
+ feedback: z.ZodOptional<z.ZodEnum<{
6961
+ up: "up";
6962
+ down: "down";
6963
+ }>>;
6924
6964
  state: z.ZodEnum<{
6925
6965
  streaming: "streaming";
6926
6966
  done: "done";
@@ -7134,6 +7174,10 @@ export declare const completeChatConfigSchema: z.ZodObject<{
7134
7174
  ]>>;
7135
7175
  retrievalQuestion: z.ZodOptional<z.ZodString>;
7136
7176
  noFeedback: z.ZodOptional<z.ZodBoolean>;
7177
+ feedback: z.ZodOptional<z.ZodEnum<{
7178
+ up: "up";
7179
+ down: "down";
7180
+ }>>;
7137
7181
  state: z.ZodLiteral<"loading">;
7138
7182
  }, z.core.$strip>,
7139
7183
  z.ZodObject<{
@@ -7270,6 +7314,10 @@ export declare const completeChatConfigSchema: z.ZodObject<{
7270
7314
  ]>>;
7271
7315
  retrievalQuestion: z.ZodOptional<z.ZodString>;
7272
7316
  noFeedback: z.ZodOptional<z.ZodBoolean>;
7317
+ feedback: z.ZodOptional<z.ZodEnum<{
7318
+ up: "up";
7319
+ down: "down";
7320
+ }>>;
7273
7321
  state: z.ZodEnum<{
7274
7322
  streaming: "streaming";
7275
7323
  done: "done";
@@ -7485,6 +7533,10 @@ export declare const completeChatConfigSchema: z.ZodObject<{
7485
7533
  ]>>;
7486
7534
  retrievalQuestion: z.ZodOptional<z.ZodString>;
7487
7535
  noFeedback: z.ZodOptional<z.ZodBoolean>;
7536
+ feedback: z.ZodOptional<z.ZodEnum<{
7537
+ up: "up";
7538
+ down: "down";
7539
+ }>>;
7488
7540
  state: z.ZodLiteral<"loading">;
7489
7541
  }, z.core.$strip>,
7490
7542
  z.ZodObject<{
@@ -7621,6 +7673,10 @@ export declare const completeChatConfigSchema: z.ZodObject<{
7621
7673
  ]>>;
7622
7674
  retrievalQuestion: z.ZodOptional<z.ZodString>;
7623
7675
  noFeedback: z.ZodOptional<z.ZodBoolean>;
7676
+ feedback: z.ZodOptional<z.ZodEnum<{
7677
+ up: "up";
7678
+ down: "down";
7679
+ }>>;
7624
7680
  state: z.ZodEnum<{
7625
7681
  streaming: "streaming";
7626
7682
  done: "done";
@@ -7834,6 +7890,10 @@ export declare const completeChatConfigSchema: z.ZodObject<{
7834
7890
  ]>>;
7835
7891
  retrievalQuestion: z.ZodOptional<z.ZodString>;
7836
7892
  noFeedback: z.ZodOptional<z.ZodBoolean>;
7893
+ feedback: z.ZodOptional<z.ZodEnum<{
7894
+ up: "up";
7895
+ down: "down";
7896
+ }>>;
7837
7897
  state: z.ZodLiteral<"loading">;
7838
7898
  }, z.core.$strip>,
7839
7899
  z.ZodObject<{
@@ -7970,6 +8030,10 @@ export declare const completeChatConfigSchema: z.ZodObject<{
7970
8030
  ]>>;
7971
8031
  retrievalQuestion: z.ZodOptional<z.ZodString>;
7972
8032
  noFeedback: z.ZodOptional<z.ZodBoolean>;
8033
+ feedback: z.ZodOptional<z.ZodEnum<{
8034
+ up: "up";
8035
+ down: "down";
8036
+ }>>;
7973
8037
  state: z.ZodEnum<{
7974
8038
  streaming: "streaming";
7975
8039
  done: "done";
@@ -9102,6 +9166,10 @@ export declare const chatConfigSchema: z.ZodObject<{
9102
9166
  ]>>;
9103
9167
  retrievalQuestion: z.ZodOptional<z.ZodString>;
9104
9168
  noFeedback: z.ZodOptional<z.ZodBoolean>;
9169
+ feedback: z.ZodOptional<z.ZodEnum<{
9170
+ up: "up";
9171
+ down: "down";
9172
+ }>>;
9105
9173
  state: z.ZodLiteral<"loading">;
9106
9174
  }, z.core.$strip>,
9107
9175
  z.ZodObject<{
@@ -9238,6 +9306,10 @@ export declare const chatConfigSchema: z.ZodObject<{
9238
9306
  ]>>;
9239
9307
  retrievalQuestion: z.ZodOptional<z.ZodString>;
9240
9308
  noFeedback: z.ZodOptional<z.ZodBoolean>;
9309
+ feedback: z.ZodOptional<z.ZodEnum<{
9310
+ up: "up";
9311
+ down: "down";
9312
+ }>>;
9241
9313
  state: z.ZodEnum<{
9242
9314
  streaming: "streaming";
9243
9315
  done: "done";
@@ -9452,6 +9524,10 @@ export declare const chatConfigSchema: z.ZodObject<{
9452
9524
  ]>>;
9453
9525
  retrievalQuestion: z.ZodOptional<z.ZodString>;
9454
9526
  noFeedback: z.ZodOptional<z.ZodBoolean>;
9527
+ feedback: z.ZodOptional<z.ZodEnum<{
9528
+ up: "up";
9529
+ down: "down";
9530
+ }>>;
9455
9531
  state: z.ZodLiteral<"loading">;
9456
9532
  }, z.core.$strip>,
9457
9533
  z.ZodObject<{
@@ -9588,6 +9664,10 @@ export declare const chatConfigSchema: z.ZodObject<{
9588
9664
  ]>>;
9589
9665
  retrievalQuestion: z.ZodOptional<z.ZodString>;
9590
9666
  noFeedback: z.ZodOptional<z.ZodBoolean>;
9667
+ feedback: z.ZodOptional<z.ZodEnum<{
9668
+ up: "up";
9669
+ down: "down";
9670
+ }>>;
9591
9671
  state: z.ZodEnum<{
9592
9672
  streaming: "streaming";
9593
9673
  done: "done";
@@ -9801,6 +9881,10 @@ export declare const chatConfigSchema: z.ZodObject<{
9801
9881
  ]>>;
9802
9882
  retrievalQuestion: z.ZodOptional<z.ZodString>;
9803
9883
  noFeedback: z.ZodOptional<z.ZodBoolean>;
9884
+ feedback: z.ZodOptional<z.ZodEnum<{
9885
+ up: "up";
9886
+ down: "down";
9887
+ }>>;
9804
9888
  state: z.ZodLiteral<"loading">;
9805
9889
  }, z.core.$strip>,
9806
9890
  z.ZodObject<{
@@ -9937,6 +10021,10 @@ export declare const chatConfigSchema: z.ZodObject<{
9937
10021
  ]>>;
9938
10022
  retrievalQuestion: z.ZodOptional<z.ZodString>;
9939
10023
  noFeedback: z.ZodOptional<z.ZodBoolean>;
10024
+ feedback: z.ZodOptional<z.ZodEnum<{
10025
+ up: "up";
10026
+ down: "down";
10027
+ }>>;
9940
10028
  state: z.ZodEnum<{
9941
10029
  streaming: "streaming";
9942
10030
  done: "done";
@@ -10152,6 +10240,10 @@ export declare const chatConfigSchema: z.ZodObject<{
10152
10240
  ]>>;
10153
10241
  retrievalQuestion: z.ZodOptional<z.ZodString>;
10154
10242
  noFeedback: z.ZodOptional<z.ZodBoolean>;
10243
+ feedback: z.ZodOptional<z.ZodEnum<{
10244
+ up: "up";
10245
+ down: "down";
10246
+ }>>;
10155
10247
  state: z.ZodLiteral<"loading">;
10156
10248
  }, z.core.$strip>,
10157
10249
  z.ZodObject<{
@@ -10288,6 +10380,10 @@ export declare const chatConfigSchema: z.ZodObject<{
10288
10380
  ]>>;
10289
10381
  retrievalQuestion: z.ZodOptional<z.ZodString>;
10290
10382
  noFeedback: z.ZodOptional<z.ZodBoolean>;
10383
+ feedback: z.ZodOptional<z.ZodEnum<{
10384
+ up: "up";
10385
+ down: "down";
10386
+ }>>;
10291
10387
  state: z.ZodEnum<{
10292
10388
  streaming: "streaming";
10293
10389
  done: "done";
@@ -10501,6 +10597,10 @@ export declare const chatConfigSchema: z.ZodObject<{
10501
10597
  ]>>;
10502
10598
  retrievalQuestion: z.ZodOptional<z.ZodString>;
10503
10599
  noFeedback: z.ZodOptional<z.ZodBoolean>;
10600
+ feedback: z.ZodOptional<z.ZodEnum<{
10601
+ up: "up";
10602
+ down: "down";
10603
+ }>>;
10504
10604
  state: z.ZodLiteral<"loading">;
10505
10605
  }, z.core.$strip>,
10506
10606
  z.ZodObject<{
@@ -10637,6 +10737,10 @@ export declare const chatConfigSchema: z.ZodObject<{
10637
10737
  ]>>;
10638
10738
  retrievalQuestion: z.ZodOptional<z.ZodString>;
10639
10739
  noFeedback: z.ZodOptional<z.ZodBoolean>;
10740
+ feedback: z.ZodOptional<z.ZodEnum<{
10741
+ up: "up";
10742
+ down: "down";
10743
+ }>>;
10640
10744
  state: z.ZodEnum<{
10641
10745
  streaming: "streaming";
10642
10746
  done: "done";
@@ -11769,6 +11873,10 @@ export declare const chatConfigSchemaWithLegacyThemeName: z.ZodIntersection<z.Zo
11769
11873
  ]>>;
11770
11874
  retrievalQuestion: z.ZodOptional<z.ZodString>;
11771
11875
  noFeedback: z.ZodOptional<z.ZodBoolean>;
11876
+ feedback: z.ZodOptional<z.ZodEnum<{
11877
+ up: "up";
11878
+ down: "down";
11879
+ }>>;
11772
11880
  state: z.ZodLiteral<"loading">;
11773
11881
  }, z.core.$strip>,
11774
11882
  z.ZodObject<{
@@ -11905,6 +12013,10 @@ export declare const chatConfigSchemaWithLegacyThemeName: z.ZodIntersection<z.Zo
11905
12013
  ]>>;
11906
12014
  retrievalQuestion: z.ZodOptional<z.ZodString>;
11907
12015
  noFeedback: z.ZodOptional<z.ZodBoolean>;
12016
+ feedback: z.ZodOptional<z.ZodEnum<{
12017
+ up: "up";
12018
+ down: "down";
12019
+ }>>;
11908
12020
  state: z.ZodEnum<{
11909
12021
  streaming: "streaming";
11910
12022
  done: "done";
@@ -12119,6 +12231,10 @@ export declare const chatConfigSchemaWithLegacyThemeName: z.ZodIntersection<z.Zo
12119
12231
  ]>>;
12120
12232
  retrievalQuestion: z.ZodOptional<z.ZodString>;
12121
12233
  noFeedback: z.ZodOptional<z.ZodBoolean>;
12234
+ feedback: z.ZodOptional<z.ZodEnum<{
12235
+ up: "up";
12236
+ down: "down";
12237
+ }>>;
12122
12238
  state: z.ZodLiteral<"loading">;
12123
12239
  }, z.core.$strip>,
12124
12240
  z.ZodObject<{
@@ -12255,6 +12371,10 @@ export declare const chatConfigSchemaWithLegacyThemeName: z.ZodIntersection<z.Zo
12255
12371
  ]>>;
12256
12372
  retrievalQuestion: z.ZodOptional<z.ZodString>;
12257
12373
  noFeedback: z.ZodOptional<z.ZodBoolean>;
12374
+ feedback: z.ZodOptional<z.ZodEnum<{
12375
+ up: "up";
12376
+ down: "down";
12377
+ }>>;
12258
12378
  state: z.ZodEnum<{
12259
12379
  streaming: "streaming";
12260
12380
  done: "done";
@@ -12468,6 +12588,10 @@ export declare const chatConfigSchemaWithLegacyThemeName: z.ZodIntersection<z.Zo
12468
12588
  ]>>;
12469
12589
  retrievalQuestion: z.ZodOptional<z.ZodString>;
12470
12590
  noFeedback: z.ZodOptional<z.ZodBoolean>;
12591
+ feedback: z.ZodOptional<z.ZodEnum<{
12592
+ up: "up";
12593
+ down: "down";
12594
+ }>>;
12471
12595
  state: z.ZodLiteral<"loading">;
12472
12596
  }, z.core.$strip>,
12473
12597
  z.ZodObject<{
@@ -12604,6 +12728,10 @@ export declare const chatConfigSchemaWithLegacyThemeName: z.ZodIntersection<z.Zo
12604
12728
  ]>>;
12605
12729
  retrievalQuestion: z.ZodOptional<z.ZodString>;
12606
12730
  noFeedback: z.ZodOptional<z.ZodBoolean>;
12731
+ feedback: z.ZodOptional<z.ZodEnum<{
12732
+ up: "up";
12733
+ down: "down";
12734
+ }>>;
12607
12735
  state: z.ZodEnum<{
12608
12736
  streaming: "streaming";
12609
12737
  done: "done";
@@ -12819,6 +12947,10 @@ export declare const chatConfigSchemaWithLegacyThemeName: z.ZodIntersection<z.Zo
12819
12947
  ]>>;
12820
12948
  retrievalQuestion: z.ZodOptional<z.ZodString>;
12821
12949
  noFeedback: z.ZodOptional<z.ZodBoolean>;
12950
+ feedback: z.ZodOptional<z.ZodEnum<{
12951
+ up: "up";
12952
+ down: "down";
12953
+ }>>;
12822
12954
  state: z.ZodLiteral<"loading">;
12823
12955
  }, z.core.$strip>,
12824
12956
  z.ZodObject<{
@@ -12955,6 +13087,10 @@ export declare const chatConfigSchemaWithLegacyThemeName: z.ZodIntersection<z.Zo
12955
13087
  ]>>;
12956
13088
  retrievalQuestion: z.ZodOptional<z.ZodString>;
12957
13089
  noFeedback: z.ZodOptional<z.ZodBoolean>;
13090
+ feedback: z.ZodOptional<z.ZodEnum<{
13091
+ up: "up";
13092
+ down: "down";
13093
+ }>>;
12958
13094
  state: z.ZodEnum<{
12959
13095
  streaming: "streaming";
12960
13096
  done: "done";
@@ -13168,6 +13304,10 @@ export declare const chatConfigSchemaWithLegacyThemeName: z.ZodIntersection<z.Zo
13168
13304
  ]>>;
13169
13305
  retrievalQuestion: z.ZodOptional<z.ZodString>;
13170
13306
  noFeedback: z.ZodOptional<z.ZodBoolean>;
13307
+ feedback: z.ZodOptional<z.ZodEnum<{
13308
+ up: "up";
13309
+ down: "down";
13310
+ }>>;
13171
13311
  state: z.ZodLiteral<"loading">;
13172
13312
  }, z.core.$strip>,
13173
13313
  z.ZodObject<{
@@ -13304,6 +13444,10 @@ export declare const chatConfigSchemaWithLegacyThemeName: z.ZodIntersection<z.Zo
13304
13444
  ]>>;
13305
13445
  retrievalQuestion: z.ZodOptional<z.ZodString>;
13306
13446
  noFeedback: z.ZodOptional<z.ZodBoolean>;
13447
+ feedback: z.ZodOptional<z.ZodEnum<{
13448
+ up: "up";
13449
+ down: "down";
13450
+ }>>;
13307
13451
  state: z.ZodEnum<{
13308
13452
  streaming: "streaming";
13309
13453
  done: "done";
package/index.js CHANGED
@@ -19831,7 +19831,8 @@ var botMessageBaseSchema = exports_external.object({
19831
19831
  references: chatReferencesSchema,
19832
19832
  errors: exports_external.array(chatErrorsSchema),
19833
19833
  retrievalQuestion: exports_external.string().optional(),
19834
- noFeedback: exports_external.boolean().optional()
19834
+ noFeedback: exports_external.boolean().optional(),
19835
+ feedback: exports_external.enum(["up", "down"]).optional()
19835
19836
  });
19836
19837
  var chatMessageBotStreamingSchema = botMessageBaseSchema.extend({
19837
19838
  state: exports_external.enum(["streaming", "done"])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liip/liipgpt",
3
- "version": "3.8.3",
3
+ "version": "3.9.0",
4
4
  "description": "LiipGPT Chat and Library",
5
5
  "type": "module",
6
6
  "exports": {
@@ -94,7 +94,7 @@ ${e}</tr>
94
94
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
95
95
  `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Lg(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Rg(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Lg(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Rg(e);if(i===null)return Lg(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${Lg(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Lg(e.text)}},qg=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}},Jg=class e{options;renderer;textRenderer;constructor(e){this.options=e||Ah,this.options.renderer=this.options.renderer||new Kg,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new qg}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(t!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`paragraph`,`text`].includes(e.type)){n+=t||``;continue}}let a=i;switch(a.type){case`space`:n+=this.renderer.space(a);continue;case`hr`:n+=this.renderer.hr(a);continue;case`heading`:n+=this.renderer.heading(a);continue;case`code`:n+=this.renderer.code(a);continue;case`table`:n+=this.renderer.table(a);continue;case`blockquote`:n+=this.renderer.blockquote(a);continue;case`list`:n+=this.renderer.list(a);continue;case`html`:n+=this.renderer.html(a);continue;case`paragraph`:n+=this.renderer.paragraph(a);continue;case`text`:{let i=a,o=this.renderer.text(i);for(;r+1<e.length&&e[r+1].type===`text`;)i=e[++r],o+=`
96
96
  `+this.renderer.text(i);t?n+=this.renderer.paragraph({type:`paragraph`,raw:o,text:o,tokens:[{type:`text`,raw:o,text:o,escaped:!0}]}):n+=o;continue}default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}parseInline(e,t=this.renderer){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Yg=class{options;block;constructor(e){this.options=e||Ah}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?Gg.lex:Gg.lexInline}provideParser(){return this.block?Jg.parse:Jg.parseInline}},Xg=class{defaults=kh();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Jg;Renderer=Kg;TextRenderer=qg;Lexer=Gg;Tokenizer=Wg;Hooks=Yg;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Kg(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Wg(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Yg;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];Yg.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async)return Promise.resolve(i.call(t,e)).then(e=>a.call(t,e));let n=i.call(t,e);return a.call(t,n)}:t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Gg.lex(e,t??this.defaults)}parser(e,t){return Jg.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(t==null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));i.hooks&&(i.hooks.options=i,i.hooks.block=e);let o=i.hooks?i.hooks.provideLexer():e?Gg.lex:Gg.lexInline,s=i.hooks?i.hooks.provideParser():e?Jg.parse:Jg.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(t):t).then(e=>o(e,i)).then(e=>i.hooks?i.hooks.processAllTokens(e):e).then(e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then(()=>e):e).then(e=>s(e,i)).then(e=>i.hooks?i.hooks.postprocess(e):e).catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let e=o(t,i);i.hooks&&(e=i.hooks.processAllTokens(e)),i.walkTokens&&this.walkTokens(e,i.walkTokens);let n=s(e,i);return i.hooks&&(n=i.hooks.postprocess(n)),n}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
97
- Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Lg(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},Zg=new Xg;function $(e,t){return Zg.parse(e,t)}$.options=$.setOptions=function(e){return Zg.setOptions(e),$.defaults=Zg.defaults,jh($.defaults),$},$.getDefaults=kh,$.defaults=Ah,$.use=function(...e){return Zg.use(...e),$.defaults=Zg.defaults,jh($.defaults),$},$.walkTokens=function(e,t){return Zg.walkTokens(e,t)},$.parseInline=Zg.parseInline,$.Parser=Jg,$.parser=Jg.parse,$.Renderer=Kg,$.TextRenderer=qg,$.Lexer=Gg,$.lexer=Gg.lex,$.Tokenizer=Wg,$.Hooks=Yg,$.parse=$,$.options,$.setOptions,$.use,$.walkTokens,$.parseInline,Jg.parse,Gg.lex;var Qg=e=>(Object.getOwnPropertyNames(e).forEach(t=>{let n=e[t];n&&typeof n==`object`&&Qg(n)}),Object.freeze(e)),$g=Qg({all:[],used:[],unused:[]}),e_=(e,t)=>{let n=Oh(e);return n.addHook(`uponSanitizeElement`,function(e,t){let n=t.tagName||e.nodeName.toLowerCase();n.startsWith(`liipgpt-`)&&(t.allowedTags[n]=!0)}),n.addHook(`afterSanitizeAttributes`,function(e){if(e.tagName!==`A`||!e.getAttribute(`href`)?.startsWith(`http`)||(e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`),!t||e.querySelector(`.sr-only`)))return;let n=e.ownerDocument.createElement(`span`);n.className=`sr-only`,n.textContent=` ${t}`,e.appendChild(n)}),n},t_=class{marked;currentReferences=$g;lastUsedIndex=0;DomPurity;constructor(e={}){this.marked=new Xg({async:!1,breaks:!0}).use(this.createFootnoteExtension(),...e.extensions??[]),this.DomPurity=e_(e.window,e.newTabSrText)}createFootnoteExtension=()=>{let e=this;return{extensions:[{name:`footnote`,level:`inline`,start(e){return e.match(/\[\^(\d+)\]/)?.index},tokenizer(e){let t=/^\[\^(\d+)\]/.exec(e);if(t){let[e,n]=t;return{type:`footnote`,raw:e,refNumber:n}}},renderer(t){if(t.type===`footnote`){let n=parseInt(t.refNumber)-1,r=e.currentReferences.all[n];if(!r)return console.error(`Could not find ref with index:`,n),``;let i;return r?.referenceIndex.used?i=r.referenceIndex.used:(e.currentReferences.used.push(r),e.lastUsedIndex++,i=e.lastUsedIndex,r.referenceIndex.used=i),` <liipgpt-reference-number data-all-index="${n}" data-used-index="${i}" data-source="${JSON.stringify(r).replace(/"/g,`&quot;`)}"></liipgpt-reference-number>`}}}]}};parse(e){return this.DomPurity.sanitize(this.marked.parse(e),{USE_PROFILES:{html:!0,svg:!0,svgFilters:!0,mathMl:!0},FORBID_TAGS:[`hr`],ADD_ATTR:[`target`]})}toHTML(e,t){this.currentReferences=t;let n=this.parse(e);return this.currentReferences=$g,n}};function n_(){let e,t;return{promise:new Promise((n,r)=>{t=n,e=r}),reject:e,resolve:t}}var r_=class{promise;resolve;reject;constructor(){let{promise:e,resolve:t,reject:n}=n_();this.promise=e,this.resolve=t,this.reject=n}then(e,t){return this.promise.then(e,t)}catch(e){return this.promise.catch(e)}finally(e){return this.promise.finally(e)}toPromise(){return this.promise}[Symbol.toStringTag]=`Flag`},i_=class{hasValue=new r_;currentValue;setValue(e){this.currentValue=e,this.hasValue.resolve()}cleanup(e){this.hasValue.reject(e)}getCurrentValue(){return this.currentValue}async toPromise(){return await this.hasValue,this.currentValue}then(e,t){return this.toPromise().then(e,t)}catch(e){return this.toPromise().catch(e)}finally(e){return this.toPromise().finally(e)}[Symbol.toStringTag]=`FutureValue`},a_=e=>{try{return new URL(e).hostname}catch{return e}};function o_(e){return e.replace(/<[^>]*>/g,``).replace(/&nbsp;/g,` `).replace(/&amp;/g,`&`).replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).replace(/&quot;/g,`"`)}var s_=({url:e,considered:t,title:n,description:r,summary:i})=>{let a=a_(e);return{url:e,considered:t,referenceIndex:{},score:0,metadata:{},display:{card:{title:n,description:r||i,badge:e},listItem:{title:n,badge:a}}}},c_=class{store;content=new i_;backendSendsMappedRefs=!1;constructor(e){this.options=e,this.store=mt({id:e.id,state:`loading`,errors:[],type:`bot`,time:new Date().toISOString(),message:{markdown:``,html:``,text:``},references:{all:[],used:[],unused:[]},retrievalQuestion:e.userQuestion})}pushError(e){this.options.onError?.(e),this.store.update(t=>({...t,errors:[...t.errors,e]}))}updateRequestId(e){this.store.update(t=>({...t,id:e}))}updateText(e){this.store.update(t=>{let n=t.message.markdown+e,r=this.options.markdownRenderer.toHTML(n,t.references);return{...t,state:`streaming`,message:{markdown:n,html:r,text:``}}})}finishMessage(){this.store.update(e=>{let t={...e,state:`done`};return t.references.unused=t.references.all.filter(e=>e.referenceIndex.used===void 0),t.message.text=o_(t.message.html),this.options?.onFinish?.(t),this.content.setValue(t),t})}addReference(e){this.store.update(t=>{let n=t.references.all,r=n.length,i=[...n,{...e,referenceIndex:{all:r}}];return{...t,references:{used:t.references.used,all:i}}})}addMappedReference(e){this.backendSendsMappedRefs=!0,this.addReference(e)}addOldReference(e){this.backendSendsMappedRefs||this.addReference(s_(e))}updateRetrievalQuestion(e){this.store.update(t=>({...t,retrievalQuestion:e}))}setNoFeedback(){this.store.update(e=>({...e,noFeedback:!0}))}getReadableStore(){return{subscribe:this.store.subscribe}}getPromise(){return this.content.toPromise()}},l_,u_,d_,f_,p_,m_,h_,g_,__,v_,y_=s((()=>{Qp(),l_=X({blocked:q(),maintenance:q(),"rate-limit":q(),"server-error":q(),"too-short":q(),"too-long":q(),"quota-reached":q(),aborted:q(),"sse-error":q(),"client-error":q(),"unexpected-call":q(),"incomplete-error":q(),"feedback-failed":q(),"answer-form-failed":q(),"speech-not-supported":q(),"speech-transcription-failed":q(),"speech-no-text-detected":q(),"speech-microphone-access-denied":q(),"pii-detected":q()}),u_=X({email:q(),creditCard:q(),ahv:q(),phoneSwiss:q(),phoneInternational:q(),swissPassport:q(),longNumber:q()}),d_=X({name:q(),namePlural:q().optional(),intro:q().optional(),placeholder:q(),values:zf(q(),q())}),f_=X({action:q(),label:q(),type:Vf([`primary`,`secondary`]).optional()}),p_=X({hash:q(),title:q(),content:q(),actions:Y(f_).optional()}),m_=X({introductionTitle:q(),introductionDisclaimer:q().optional(),termsInvitationToConsent:q().optional(),chatInputPlaceholder:q(),chatInputPlaceholderListening:q().optional(),chatInputSubmit:q(),chatInputAbort:q(),chatInputStartListening:q(),chatInputStopListening:q(),referenceLink:q(),referencesDisplay:q(),referencesHide:q(),referencesTitle:q(),referencesFurtherTitle:q(),newChat:q(),maintenanceModeError:q(),messageBotLoading:q(),messageBotError:q(),messageBotDefaultError:q(),noResultsFound:q(),chatFooterText:q().optional(),scrollToBottom:q(),openButtonTitle:q().optional(),openButtonDescription:q().optional(),openMenu:q(),openInfo:q(),aboutThisChat:q().optional(),closeMenu:q(),closeChat:q(),close:q(),send:q(),thankYouForFeedback:q(),answerFormThankYou:q(),giveFeedback:q(),sendFeedback:q(),feedbackFormTitle:q(),feedbackFormMessage:q(),feedbackFormMessagePlaceholder:q(),feedbackFormEmail:q(),feedbackFormEmailPlaceholder:q(),askQuestionAgain:q(),answerGood:q(),answerBad:q(),classificationSubmit:q(),classificationThankYou:q(),classificationTitle:q(),selectLanguage:q(),languageChanged:q(),selectColorTheme:q(),lightMode:q(),darkMode:q(),ariaMainNavigation:q(),ariaMainNavigationInfo:q(),ariaMainNavigationLinks:q(),ariaMainNavigationLanguageSwitch:q(),ariaMainNavigationColorMode:q(),ariaGotoMainNavigation:q(),ariaAskQuestion:q(),ariaAskQuestionRegion:q(),ariaNotifications:q(),ariaPredefinedQuestions:q(),ariaPredefinedQuestionsRegion:q(),ariaChatHistory:q(),ariaOpenChat:q(),ariaQuestionFromYou:q(),ariaAnswerFromBot:q(),ariaLastAnswerNavigation:q(),ariaQuestionSent:q(),ariaAnswerReady:q(),ariaAnswerFinished:q(),ariaAnswerFinishedWithSelectedTopic:q(),ariaAskQuestionAgain:q(),ariaAnswerGood:q(),ariaAnswerBad:q(),ariaReferenceSource:q(),ariaGiveFeedback:q(),ariaAnswerForm:q(),ariaLanguageChanged:q(),ariaLightSelected:q(),ariaDarkSelected:q(),ariaSettings:q(),ariaSettingsRegion:q(),ariaReferencesRegion:q(),ariaOpensInNewTab:q(),ariaPageTitle:q(),ariaCloseWithEsc:q(),ariaInfoTitle:q(),ariaFlyoutRegion:q(),ariaSelected:q(),ariaUnselected:q(),ariaAllSelected:q(),ariaAllUnselected:q(),ariaAllReseted:q(),ariaChangeTopic:q(),popups:Y(p_).optional(),termsAcceptButton:q().optional(),termsReadButton:q().optional(),selectors:zf(q(),d_).optional(),hideSettings:q(),showSettings:q(),chooseAtLeastOneOption:q(),selectAll:q(),selectNone:q(),resetToDefaults:q(),messageTooLong:q(),selectedTopic:q(),changeTopic:q(),searchSummaryExpand:q(),searchSummaryCollapse:q(),searchSummaryOptInDefault:q(),searchSummaryOptOut:q(),searchSummaryError:q(),searchSummaryDisclaimer:q().optional(),searchSummaryLoading:q(),searchSummaryFollowUpPlaceholder:q(),searchSummaryFollowUpSubmit:q(),ariaSearchSummaryExpand:q(),ariaSearchSummaryCollapse:q(),ariaSearchSummaryOptOut:q(),ariaSearchSummaryFollowUpInput:q(),jsonLdEventDate:q(),jsonLdEventLocation:q(),jsonLdEventDescription:q(),jsonLdEventCtaLabel:q(),jsonLdCtaLabel:q(),jsonLdMapOpenMap:q(),ariaJsonLdMapCanvas:q(),ariaJsonLdEventCard:q(),ariaJsonLdMapCard:q(),ariaJsonLdCtaCard:q()}),h_=[`en`,`de`,`fr`,`it`],g_=Vf(h_),__=m_.partial().extend({selectors:zf(q(),d_).optional()}),v_=Bf(g_,__),zf(g_,l_),zf(g_,u_)})),b_,x_,S_,C_,w_,T_,E_,D_=s((()=>{Qp(),y_(),b_=Bf(g_,q()),x_=X({componentName:Hf(`buttons`),data:X({caption:q().optional(),buttons:Y(X({label:q(),href:q().url().optional(),value:q(),variant:Vf([`primary`,`secondary`,`tertiary`]).optional(),icon:q().optional(),target:q().optional()}))})}),S_=X({componentName:Hf(`combobox`),data:X({caption:b_.optional(),placeholder:b_,values:Y(X({label:b_,value:q(),metadata:zf(q(),Pf()).optional()})),removeComponentAfterValueSelection:J().optional(),selectorKey:q().optional()})}),C_=X({componentName:Hf(`alva-init`),data:X({})}),w_=X({componentName:Hf(`alva-score-survey`),data:X({})}),T_=X({type:Hf(`component`),id:q().optional(),time:q().optional(),hideAvatar:J().optional(),noSectionPadding:J().optional(),hideChatInput:J().optional()}),E_=Rf(Lf(`componentName`,[x_,S_,C_,w_]),T_)})),O_,k_,A_,j_=s((()=>{Qp(),O_=If([q(),Mf(),J(),Y(q()),Y(Mf()),Y(J())]),k_=X({title:q(),description:q().optional(),badge:q().optional(),breadcrumbs:Y(q()).optional(),previewImage:q().optional(),date:q().datetime().optional()}),A_=X({url:q().url(),score:Mf(),metadata:zf(q(),O_),language:q().optional()}).extend(k_.shape)})),M_,N_,P_,F_,I_,L_,R_,z_,B_,V_,H_,U_,W_=s((()=>{j_(),Qp(),D_(),Vf([`start`,`chat`]),Lf(`name`,[X({name:Hf(`start-page`),prefill:q().optional()}),X({name:Hf(`consent-page`)}),X({name:Hf(`chat-page`),query:q().optional(),predefinedQuestionId:q().optional(),switchQuestionId:q().optional()})]),M_=X({type:Hf(`user`),time:q(),message:q(),id:q().optional()}),Vf([`idle`,`searching`,`answering`]),N_=If([q(),Mf(),J(),Y(q()),Y(Mf()),Y(J())]),P_=X({url:q(),score:Mf(),metadata:zf(q(),N_),considered:J(),display:X({card:k_,listItem:k_})}).extend({referenceIndex:X({all:Mf(),used:Mf().optional()})}),F_=X({all:Y(P_),used:Y(P_),unused:Y(P_)}),I_=Vf([`pii-detected`,`blocked`,`maintenance`,`rate-limit`,`server-error`,`too-short`,`too-long`,`quota-reached`,`aborted`]),L_=If([I_,Hf(`sse-error`),Hf(`client-error`),Hf(`unexpected-call`)]),R_=X({type:Hf(`bot`),time:q(),id:q(),message:X({markdown:q(),html:q(),text:q()}),references:F_,errors:Y(L_),retrievalQuestion:q().optional(),noFeedback:J().optional()}),z_=R_.extend({state:Vf([`streaming`,`done`])}),B_=R_.extend({state:Hf(`loading`)}),V_=If([B_,z_]),H_=If([V_,M_,E_]),U_=Y(X({question:q(),answer:q()}))})),G_,K_=s((()=>{G_={inherit:`inherit`,current:`currentcolor`,transparent:`transparent`,black:`#000`,white:`#fff`,slate:{50:`oklch(98.4% 0.003 247.858)`,100:`oklch(96.8% 0.007 247.896)`,200:`oklch(92.9% 0.013 255.508)`,300:`oklch(86.9% 0.022 252.894)`,400:`oklch(70.4% 0.04 256.788)`,500:`oklch(55.4% 0.046 257.417)`,600:`oklch(44.6% 0.043 257.281)`,700:`oklch(37.2% 0.044 257.287)`,800:`oklch(27.9% 0.041 260.031)`,900:`oklch(20.8% 0.042 265.755)`,950:`oklch(12.9% 0.042 264.695)`},gray:{50:`oklch(98.5% 0.002 247.839)`,100:`oklch(96.7% 0.003 264.542)`,200:`oklch(92.8% 0.006 264.531)`,300:`oklch(87.2% 0.01 258.338)`,400:`oklch(70.7% 0.022 261.325)`,500:`oklch(55.1% 0.027 264.364)`,600:`oklch(44.6% 0.03 256.802)`,700:`oklch(37.3% 0.034 259.733)`,800:`oklch(27.8% 0.033 256.848)`,900:`oklch(21% 0.034 264.665)`,950:`oklch(13% 0.028 261.692)`},zinc:{50:`oklch(98.5% 0 0)`,100:`oklch(96.7% 0.001 286.375)`,200:`oklch(92% 0.004 286.32)`,300:`oklch(87.1% 0.006 286.286)`,400:`oklch(70.5% 0.015 286.067)`,500:`oklch(55.2% 0.016 285.938)`,600:`oklch(44.2% 0.017 285.786)`,700:`oklch(37% 0.013 285.805)`,800:`oklch(27.4% 0.006 286.033)`,900:`oklch(21% 0.006 285.885)`,950:`oklch(14.1% 0.005 285.823)`},neutral:{50:`oklch(98.5% 0 0)`,100:`oklch(97% 0 0)`,200:`oklch(92.2% 0 0)`,300:`oklch(87% 0 0)`,400:`oklch(70.8% 0 0)`,500:`oklch(55.6% 0 0)`,600:`oklch(43.9% 0 0)`,700:`oklch(37.1% 0 0)`,800:`oklch(26.9% 0 0)`,900:`oklch(20.5% 0 0)`,950:`oklch(14.5% 0 0)`},stone:{50:`oklch(98.5% 0.001 106.423)`,100:`oklch(97% 0.001 106.424)`,200:`oklch(92.3% 0.003 48.717)`,300:`oklch(86.9% 0.005 56.366)`,400:`oklch(70.9% 0.01 56.259)`,500:`oklch(55.3% 0.013 58.071)`,600:`oklch(44.4% 0.011 73.639)`,700:`oklch(37.4% 0.01 67.558)`,800:`oklch(26.8% 0.007 34.298)`,900:`oklch(21.6% 0.006 56.043)`,950:`oklch(14.7% 0.004 49.25)`},mauve:{50:`oklch(98.5% 0 0)`,100:`oklch(96% 0.003 325.6)`,200:`oklch(92.2% 0.005 325.62)`,300:`oklch(86.5% 0.012 325.68)`,400:`oklch(71.1% 0.019 323.02)`,500:`oklch(54.2% 0.034 322.5)`,600:`oklch(43.5% 0.029 321.78)`,700:`oklch(36.4% 0.029 323.89)`,800:`oklch(26.3% 0.024 320.12)`,900:`oklch(21.2% 0.019 322.12)`,950:`oklch(14.5% 0.008 326)`},olive:{50:`oklch(98.8% 0.003 106.5)`,100:`oklch(96.6% 0.005 106.5)`,200:`oklch(93% 0.007 106.5)`,300:`oklch(88% 0.011 106.6)`,400:`oklch(73.7% 0.021 106.9)`,500:`oklch(58% 0.031 107.3)`,600:`oklch(46.6% 0.025 107.3)`,700:`oklch(39.4% 0.023 107.4)`,800:`oklch(28.6% 0.016 107.4)`,900:`oklch(22.8% 0.013 107.4)`,950:`oklch(15.3% 0.006 107.1)`},mist:{50:`oklch(98.7% 0.002 197.1)`,100:`oklch(96.3% 0.002 197.1)`,200:`oklch(92.5% 0.005 214.3)`,300:`oklch(87.2% 0.007 219.6)`,400:`oklch(72.3% 0.014 214.4)`,500:`oklch(56% 0.021 213.5)`,600:`oklch(45% 0.017 213.2)`,700:`oklch(37.8% 0.015 216)`,800:`oklch(27.5% 0.011 216.9)`,900:`oklch(21.8% 0.008 223.9)`,950:`oklch(14.8% 0.004 228.8)`},taupe:{50:`oklch(98.6% 0.002 67.8)`,100:`oklch(96% 0.002 17.2)`,200:`oklch(92.2% 0.005 34.3)`,300:`oklch(86.8% 0.007 39.5)`,400:`oklch(71.4% 0.014 41.2)`,500:`oklch(54.7% 0.021 43.1)`,600:`oklch(43.8% 0.017 39.3)`,700:`oklch(36.7% 0.016 35.7)`,800:`oklch(26.8% 0.011 36.5)`,900:`oklch(21.4% 0.009 43.1)`,950:`oklch(14.7% 0.004 49.3)`},red:{50:`oklch(97.1% 0.013 17.38)`,100:`oklch(93.6% 0.032 17.717)`,200:`oklch(88.5% 0.062 18.334)`,300:`oklch(80.8% 0.114 19.571)`,400:`oklch(70.4% 0.191 22.216)`,500:`oklch(63.7% 0.237 25.331)`,600:`oklch(57.7% 0.245 27.325)`,700:`oklch(50.5% 0.213 27.518)`,800:`oklch(44.4% 0.177 26.899)`,900:`oklch(39.6% 0.141 25.723)`,950:`oklch(25.8% 0.092 26.042)`},orange:{50:`oklch(98% 0.016 73.684)`,100:`oklch(95.4% 0.038 75.164)`,200:`oklch(90.1% 0.076 70.697)`,300:`oklch(83.7% 0.128 66.29)`,400:`oklch(75% 0.183 55.934)`,500:`oklch(70.5% 0.213 47.604)`,600:`oklch(64.6% 0.222 41.116)`,700:`oklch(55.3% 0.195 38.402)`,800:`oklch(47% 0.157 37.304)`,900:`oklch(40.8% 0.123 38.172)`,950:`oklch(26.6% 0.079 36.259)`},amber:{50:`oklch(98.7% 0.022 95.277)`,100:`oklch(96.2% 0.059 95.617)`,200:`oklch(92.4% 0.12 95.746)`,300:`oklch(87.9% 0.169 91.605)`,400:`oklch(82.8% 0.189 84.429)`,500:`oklch(76.9% 0.188 70.08)`,600:`oklch(66.6% 0.179 58.318)`,700:`oklch(55.5% 0.163 48.998)`,800:`oklch(47.3% 0.137 46.201)`,900:`oklch(41.4% 0.112 45.904)`,950:`oklch(27.9% 0.077 45.635)`},yellow:{50:`oklch(98.7% 0.026 102.212)`,100:`oklch(97.3% 0.071 103.193)`,200:`oklch(94.5% 0.129 101.54)`,300:`oklch(90.5% 0.182 98.111)`,400:`oklch(85.2% 0.199 91.936)`,500:`oklch(79.5% 0.184 86.047)`,600:`oklch(68.1% 0.162 75.834)`,700:`oklch(55.4% 0.135 66.442)`,800:`oklch(47.6% 0.114 61.907)`,900:`oklch(42.1% 0.095 57.708)`,950:`oklch(28.6% 0.066 53.813)`},lime:{50:`oklch(98.6% 0.031 120.757)`,100:`oklch(96.7% 0.067 122.328)`,200:`oklch(93.8% 0.127 124.321)`,300:`oklch(89.7% 0.196 126.665)`,400:`oklch(84.1% 0.238 128.85)`,500:`oklch(76.8% 0.233 130.85)`,600:`oklch(64.8% 0.2 131.684)`,700:`oklch(53.2% 0.157 131.589)`,800:`oklch(45.3% 0.124 130.933)`,900:`oklch(40.5% 0.101 131.063)`,950:`oklch(27.4% 0.072 132.109)`},green:{50:`oklch(98.2% 0.018 155.826)`,100:`oklch(96.2% 0.044 156.743)`,200:`oklch(92.5% 0.084 155.995)`,300:`oklch(87.1% 0.15 154.449)`,400:`oklch(79.2% 0.209 151.711)`,500:`oklch(72.3% 0.219 149.579)`,600:`oklch(62.7% 0.194 149.214)`,700:`oklch(52.7% 0.154 150.069)`,800:`oklch(44.8% 0.119 151.328)`,900:`oklch(39.3% 0.095 152.535)`,950:`oklch(26.6% 0.065 152.934)`},emerald:{50:`oklch(97.9% 0.021 166.113)`,100:`oklch(95% 0.052 163.051)`,200:`oklch(90.5% 0.093 164.15)`,300:`oklch(84.5% 0.143 164.978)`,400:`oklch(76.5% 0.177 163.223)`,500:`oklch(69.6% 0.17 162.48)`,600:`oklch(59.6% 0.145 163.225)`,700:`oklch(50.8% 0.118 165.612)`,800:`oklch(43.2% 0.095 166.913)`,900:`oklch(37.8% 0.077 168.94)`,950:`oklch(26.2% 0.051 172.552)`},teal:{50:`oklch(98.4% 0.014 180.72)`,100:`oklch(95.3% 0.051 180.801)`,200:`oklch(91% 0.096 180.426)`,300:`oklch(85.5% 0.138 181.071)`,400:`oklch(77.7% 0.152 181.912)`,500:`oklch(70.4% 0.14 182.503)`,600:`oklch(60% 0.118 184.704)`,700:`oklch(51.1% 0.096 186.391)`,800:`oklch(43.7% 0.078 188.216)`,900:`oklch(38.6% 0.063 188.416)`,950:`oklch(27.7% 0.046 192.524)`},cyan:{50:`oklch(98.4% 0.019 200.873)`,100:`oklch(95.6% 0.045 203.388)`,200:`oklch(91.7% 0.08 205.041)`,300:`oklch(86.5% 0.127 207.078)`,400:`oklch(78.9% 0.154 211.53)`,500:`oklch(71.5% 0.143 215.221)`,600:`oklch(60.9% 0.126 221.723)`,700:`oklch(52% 0.105 223.128)`,800:`oklch(45% 0.085 224.283)`,900:`oklch(39.8% 0.07 227.392)`,950:`oklch(30.2% 0.056 229.695)`},sky:{50:`oklch(97.7% 0.013 236.62)`,100:`oklch(95.1% 0.026 236.824)`,200:`oklch(90.1% 0.058 230.902)`,300:`oklch(82.8% 0.111 230.318)`,400:`oklch(74.6% 0.16 232.661)`,500:`oklch(68.5% 0.169 237.323)`,600:`oklch(58.8% 0.158 241.966)`,700:`oklch(50% 0.134 242.749)`,800:`oklch(44.3% 0.11 240.79)`,900:`oklch(39.1% 0.09 240.876)`,950:`oklch(29.3% 0.066 243.157)`},blue:{50:`oklch(97% 0.014 254.604)`,100:`oklch(93.2% 0.032 255.585)`,200:`oklch(88.2% 0.059 254.128)`,300:`oklch(80.9% 0.105 251.813)`,400:`oklch(70.7% 0.165 254.624)`,500:`oklch(62.3% 0.214 259.815)`,600:`oklch(54.6% 0.245 262.881)`,700:`oklch(48.8% 0.243 264.376)`,800:`oklch(42.4% 0.199 265.638)`,900:`oklch(37.9% 0.146 265.522)`,950:`oklch(28.2% 0.091 267.935)`},indigo:{50:`oklch(96.2% 0.018 272.314)`,100:`oklch(93% 0.034 272.788)`,200:`oklch(87% 0.065 274.039)`,300:`oklch(78.5% 0.115 274.713)`,400:`oklch(67.3% 0.182 276.935)`,500:`oklch(58.5% 0.233 277.117)`,600:`oklch(51.1% 0.262 276.966)`,700:`oklch(45.7% 0.24 277.023)`,800:`oklch(39.8% 0.195 277.366)`,900:`oklch(35.9% 0.144 278.697)`,950:`oklch(25.7% 0.09 281.288)`},violet:{50:`oklch(96.9% 0.016 293.756)`,100:`oklch(94.3% 0.029 294.588)`,200:`oklch(89.4% 0.057 293.283)`,300:`oklch(81.1% 0.111 293.571)`,400:`oklch(70.2% 0.183 293.541)`,500:`oklch(60.6% 0.25 292.717)`,600:`oklch(54.1% 0.281 293.009)`,700:`oklch(49.1% 0.27 292.581)`,800:`oklch(43.2% 0.232 292.759)`,900:`oklch(38% 0.189 293.745)`,950:`oklch(28.3% 0.141 291.089)`},purple:{50:`oklch(97.7% 0.014 308.299)`,100:`oklch(94.6% 0.033 307.174)`,200:`oklch(90.2% 0.063 306.703)`,300:`oklch(82.7% 0.119 306.383)`,400:`oklch(71.4% 0.203 305.504)`,500:`oklch(62.7% 0.265 303.9)`,600:`oklch(55.8% 0.288 302.321)`,700:`oklch(49.6% 0.265 301.924)`,800:`oklch(43.8% 0.218 303.724)`,900:`oklch(38.1% 0.176 304.987)`,950:`oklch(29.1% 0.149 302.717)`},fuchsia:{50:`oklch(97.7% 0.017 320.058)`,100:`oklch(95.2% 0.037 318.852)`,200:`oklch(90.3% 0.076 319.62)`,300:`oklch(83.3% 0.145 321.434)`,400:`oklch(74% 0.238 322.16)`,500:`oklch(66.7% 0.295 322.15)`,600:`oklch(59.1% 0.293 322.896)`,700:`oklch(51.8% 0.253 323.949)`,800:`oklch(45.2% 0.211 324.591)`,900:`oklch(40.1% 0.17 325.612)`,950:`oklch(29.3% 0.136 325.661)`},pink:{50:`oklch(97.1% 0.014 343.198)`,100:`oklch(94.8% 0.028 342.258)`,200:`oklch(89.9% 0.061 343.231)`,300:`oklch(82.3% 0.12 346.018)`,400:`oklch(71.8% 0.202 349.761)`,500:`oklch(65.6% 0.241 354.308)`,600:`oklch(59.2% 0.249 0.584)`,700:`oklch(52.5% 0.223 3.958)`,800:`oklch(45.9% 0.187 3.815)`,900:`oklch(40.8% 0.153 2.432)`,950:`oklch(28.4% 0.109 3.907)`},rose:{50:`oklch(96.9% 0.015 12.422)`,100:`oklch(94.1% 0.03 12.58)`,200:`oklch(89.2% 0.058 10.001)`,300:`oklch(81% 0.117 11.638)`,400:`oklch(71.2% 0.194 13.428)`,500:`oklch(64.5% 0.246 16.439)`,600:`oklch(58.6% 0.253 17.585)`,700:`oklch(51.4% 0.222 16.935)`,800:`oklch(45.5% 0.188 13.697)`,900:`oklch(41% 0.159 10.272)`,950:`oklch(27.1% 0.105 12.094)`}}})),q_=s((()=>{K_()})),J_,Y_,X_,Z_,Q_,$_=s((()=>{Qp(),vm(),J_=X({50:q(),100:q(),200:q(),300:q(),400:q(),500:q(),600:q(),700:q(),800:q(),900:q(),950:q()}),Y_=Vf([`slate`,`gray`,`zinc`,`neutral`,`stone`,`red`,`orange`,`amber`,`yellow`,`lime`,`green`,`emerald`,`teal`,`cyan`,`sky`,`blue`,`indigo`,`violet`,`purple`,`fuchsia`,`pink`,`rose`]),X_=If([J_,Y_]),Z_=If([Rf(J_,X({0:q(),1e3:q()})),Y_]),Q_=X({avatarImageUrl:q().optional(),colors:X({brand:X_.optional(),highlight:X_.optional(),grey:Z_.optional(),background:q().optional(),text:q().optional(),anchor:X({default:q().optional(),hover:q().optional()}).optional()}).optional(),font:X({family:q().optional(),urls:Y(q()).optional(),sizeXs:am.optional(),sizeSm:am.optional(),sizeBody:am.optional(),sizeH3:am.optional(),sizeH2:am.optional(),sizeH1:am.optional(),weightNormal:q().optional(),weightBold:q().optional(),weightTitle:q().optional()}).optional(),borderRadius:am.optional(),fineGrained:_m.optional()})})),ev,tv,nv,rv,iv,av,ov,sv,cv,lv,uv,dv,fv,pv,mv=s((()=>{Qp(),D_(),W_(),$_(),y_(),ev=X({label:q(),options:Y(X({label:q(),value:Mf()}))}),tv=X({label:q(),icon:q(),url:q(),target:Vf([`_blank`,`_self`]).optional()}),nv=X({id:q().optional(),label:q().nullable(),question:q(),switchQuestionId:q().optional()}),rv=X({impact:ev.optional(),quality:ev.optional()}),X({classification:rv.optional()}),iv=X({predefinedQuestions:Y(nv)}),av=If([X({maintenance:Hf(!0)}),X({id:q(),cID:q()})]),zf(g_,m_),X({label:q(),placeholder:q(),locked:J().optional()}),ov=X({settingName:q(),iconName:q(),settingIntro:q().optional(),type:Vf([`single-select`,`multi-select`]),allowEmpty:J(),values:Y(q()),defaultValues:Y(q()).optional()}),sv=X({type:Vf([`text`,`select`,`checkbox`,`radio`]),name:q(),label:b_,placeholder:b_.optional(),required:J().optional(),options:Y(X({value:q(),label:b_})).optional()}),cv=X({receiverEmail:q(),triggerLabel:b_,title:b_.optional(),caption:b_.optional(),submitLabel:b_,fields:Y(sv)}),lv=X({before:Y(H_).optional(),after:Y(H_).optional()}),uv=X({init:Y(H_).optional(),bot:lv.optional(),user:lv.optional()}),dv=X({forcePredefinedQuestions:J().optional(),forceChatPage:J().optional(),showOverallFeedbackButton:J(),showOverallFeedbackEmail:J(),showCloseChatButton:J(),showContextMenu:J(),showContextInfo:J(),showReferencesByDefault:J(),showExpandedSelectors:J(),showTextFeedback:J(),inlineLayout:J(),allowAudioInput:J(),blockPII:J(),questionPrefix:q(),menu:Bf(g_,Y(tv)).optional(),supportedLanguages:Y(g_),classification:rv.optional(),answerForm:cv.optional(),theme:Q_,translations:v_,buttonHref:q().optional(),addQueryToUrlParams:J().optional(),addRetrievalQuestionToUrlParams:J().optional(),renderKatex:J().optional(),reflectLanguageInPath:J().optional(),sendReferrer:Vf([`all`,`own`,`none`,`location`]).optional(),selectorsConfig:Y(ov).default([]),questionLengthLimit:Mf().optional(),forceConsent:J().optional(),askQuestionAgain:J(),enableBackdrop:J().optional(),parentPageContext:X({extractSelectors:q().array().optional()}),messageAdditions:uv.optional(),contextVersion:Mf().optional(),selectedTopicResetPredefinedQuestionId:q().optional()}),fv=dv.partial(),pv=Rf(fv,X({theme:X({name:q().optional()}).optional()}))}));mv();var hv=class{id;constructor(e){this.chatResponseData=e,this.id=this.chatResponseData.id}async isReadyForFeedback(){return await this.chatResponseData.readyForFeedback.toPromise(),!0}subscribe(e,t){return this.chatResponseData.readableStore.subscribe(e,t)}getContent(){return this.chatResponseData.content.toPromise()}abort(){return this.chatResponseData.abort()}async thumbsUp(){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.thumbsUp(this.id,this.chatResponseData.question)}async thumbsDown(){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.thumbsDown(this.id,this.chatResponseData.question)}async feedback(e){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.feedback(this.id,this.chatResponseData.question,e)}},gv=class{latestRequest=new i_;state=mt({state:`idle`});id;history=[];constructor(e){this.clientPrimitive=e,this.id=e.createConversationId()}subscribe(e){return this.state.subscribe(e)}chat(e,t={}){let n=this.clientPrimitive.chat(this.id,e,t);return this.history.push(n),this.latestRequest.setValue({question:e,response:n}),n}async abort(){let e=this.history.map(e=>e.abort());await Promise.all(e)}async thumbsUp(){let{question:e,response:t}=await this.latestRequest;await t.isReadyForFeedback(),await this.clientPrimitive.thumbsUp(t.id,e)}async thumbsDown(){let{question:e,response:t}=await this.latestRequest;await t.isReadyForFeedback(),await this.clientPrimitive.thumbsDown(t.id,e)}async feedback(e){let{question:t,response:n}=await this.latestRequest;await n.isReadyForFeedback(),await this.clientPrimitive.feedback(n.id,t,e)}},_v=[];for(let e=0;e<256;++e)_v.push((e+256).toString(16).slice(1));function vv(e,t=0){return(_v[e[t+0]]+_v[e[t+1]]+_v[e[t+2]]+_v[e[t+3]]+`-`+_v[e[t+4]]+_v[e[t+5]]+`-`+_v[e[t+6]]+_v[e[t+7]]+`-`+_v[e[t+8]]+_v[e[t+9]]+`-`+_v[e[t+10]]+_v[e[t+11]]+_v[e[t+12]]+_v[e[t+13]]+_v[e[t+14]]+_v[e[t+15]]).toLowerCase()}var yv,bv=new Uint8Array(16);function xv(){if(!yv){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);yv=crypto.getRandomValues.bind(crypto)}return yv(bv)}var Sv={};function Cv(e,t,n){let r;if(e)r=Tv(e.random??e.rng?.()??xv(),e.msecs,e.seq,t,n);else{let e=Date.now(),i=xv();wv(Sv,e,i),r=Tv(i,Sv.msecs,Sv.seq,t,n)}return t??vv(r)}function wv(e,t,n){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=n[6]<<23|n[7]<<16|n[8]<<8|n[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function Tv(e,t,n,r,i=0){if(e.length<16)throw Error(`Random bytes length must be >= 16`);if(!r)r=new Uint8Array(16),i=0;else if(i<0||i+16>r.length)throw RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),n??=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9],r[i++]=t/1099511627776&255,r[i++]=t/4294967296&255,r[i++]=t/16777216&255,r[i++]=t/65536&255,r[i++]=t/256&255,r[i++]=t&255,r[i++]=112|n>>>28&15,r[i++]=n>>>20&255,r[i++]=128|n>>>14&63,r[i++]=n>>>6&255,r[i++]=n<<2&255|e[10]&3,r[i++]=e[11],r[i++]=e[12],r[i++]=e[13],r[i++]=e[14],r[i++]=e[15],r}var Ev=new Map,Dv=class{get length(){return Ev.size}clear(){Ev.clear()}getItem(e){return Ev.get(e)||null}key(e){return Array.from(Ev.keys())[e]||null}removeItem(e){Ev.delete(e)}setItem(e,t){Ev.set(e,String(t))}},Ov=globalThis.localStorage??new Dv,kv=async(e,t)=>{try{let n=Ov.getItem(`liipgpt:uID`)||Ov.getItem(`uID`),r={method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({referrer:globalThis?.document?.referrer||null,uID:n,...t?{startParameters:t}:{}})},i=await e.fetchData(`/login`,av,{},r).catch(t=>(console.log(`Failed to /login use /log`,t),e.fetchData(`/log`,av,{},r)));if(`maintenance`in i&&i.maintenance)return{mode:`maintenance`};if(!(`id`in i))throw Error(`Invalid response format: missing user id`);return Ov.setItem(`liipgpt:uID`,i.id),{mode:`ready`,userId:i.id}}catch(e){throw console.error(`Failed to fetch user data:`,e),e}},Av=function(e,t){if(!(this instanceof Av))return new Av(e,t);this.url=e,t||={},this.headers=t.headers||{},this.payload=t.payload===void 0?``:t.payload,this.method=t.method||this.payload&&`POST`||`GET`,this.withCredentials=!!t.withCredentials,this.debug=!!t.debug,this.autoReconnect=t.autoReconnect===void 0?!1:t.autoReconnect,this.reconnectDelay=t.reconnectDelay===void 0?3e3:t.reconnectDelay,this.maxRetries=t.maxRetries===void 0?null:t.maxRetries,this.retryCount=0,this.reconnectTimer=null,this.useLastEventId=t.useLastEventId===void 0?!0:t.useLastEventId,this.FIELD_SEPARATOR=`:`,this.listeners={},this.xhr=null,this.readyState=Av.INITIALIZING,this.progress=0,this.chunk=``,this.lastEventId=``,this._hasParsedBom=!1,this.addEventListener=function(e,t){this.listeners[e]===void 0&&(this.listeners[e]=[]),this.listeners[e].indexOf(t)===-1&&this.listeners[e].push(t)},this.removeEventListener=function(e,t){if(this.listeners[e]===void 0)return;let n=[];this.listeners[e].forEach(function(e){e!==t&&n.push(e)}),n.length===0?delete this.listeners[e]:this.listeners[e]=n},this.dispatchEvent=function(e){if(!e)return!0;this.debug&&console.debug(e),e.source=this;let t=`on`+e.type;return this.hasOwnProperty(t)&&(this[t].call(this,e),e.defaultPrevented)?!1:this.listeners[e.type]?this.listeners[e.type].every(function(t){return t(e),!e.defaultPrevented}):!0},this._markClosed=function(){if(this.xhr=null,this.progress=0,this.chunk=``,this._setReadyState(Av.CLOSED),this.autoReconnect){if(this.maxRetries!==null&&this.retryCount>=this.maxRetries){this.debug&&console.debug(`SSE max retries (${this.maxRetries}) reached, stopping reconnection attempts`),this.autoReconnect=!1,this.close();return}this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.debug&&console.debug(`SSE will attempt to reconnect in ${this.reconnectDelay}ms (attempt ${this.retryCount+1}${this.maxRetries?`/`+this.maxRetries:``})`),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.retryCount++,this.stream()},this.reconnectDelay)}},this._setReadyState=function(e){let t=new CustomEvent(`readystatechange`);t.readyState=e,this.readyState=e,this.dispatchEvent(t)},this._onStreamFailure=function(e){let t=new CustomEvent(`error`);t.responseCode=e.currentTarget.status,t.data=e.currentTarget.response,this.dispatchEvent(t),this._markClosed()},this._onStreamAbort=function(){this.dispatchEvent(new CustomEvent(`abort`)),this._markClosed()},this._onStreamProgress=function(e){if(!this.xhr)return;if(this.xhr.status<200||this.xhr.status>=300){this._onStreamFailure(e);return}this.retryCount=0;let t=this.xhr.responseText.substring(this.progress);this.progress+=t.length,!this._hasParsedBom&&this.chunk.length===0&&(t.charCodeAt(0)===65279&&(t=t.substring(1)),this._hasParsedBom=!0);let n=(this.chunk+t).split(/(\r\n\r\n|\r\r|\n\n)/g),r=n.pop();n.forEach(function(e){e.trim().length>0&&this.dispatchEvent(this._parseEventChunk(e))}.bind(this)),this.chunk=r},this._onStreamLoaded=function(e){this._onStreamProgress(e),this.dispatchEvent(this._parseEventChunk(this.chunk)),this.chunk=``,this._markClosed()},this._parseEventChunk=function(e){if(!e||e.length===0)return null;this.debug&&console.debug(e);let t={id:null,retry:null,data:null,event:null};if(e.split(/\n|\r\n|\r/).forEach(function(e){let n=e.indexOf(this.FIELD_SEPARATOR),r,i;if(n>0){let t=e[n+1]===` `?2:1;r=e.substring(0,n),i=e.substring(n+t)}else if(n<0)r=e,i=``;else return;r in t&&(r===`data`&&t[r]!==null?t.data+=`
97
+ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Lg(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},Zg=new Xg;function $(e,t){return Zg.parse(e,t)}$.options=$.setOptions=function(e){return Zg.setOptions(e),$.defaults=Zg.defaults,jh($.defaults),$},$.getDefaults=kh,$.defaults=Ah,$.use=function(...e){return Zg.use(...e),$.defaults=Zg.defaults,jh($.defaults),$},$.walkTokens=function(e,t){return Zg.walkTokens(e,t)},$.parseInline=Zg.parseInline,$.Parser=Jg,$.parser=Jg.parse,$.Renderer=Kg,$.TextRenderer=qg,$.Lexer=Gg,$.lexer=Gg.lex,$.Tokenizer=Wg,$.Hooks=Yg,$.parse=$,$.options,$.setOptions,$.use,$.walkTokens,$.parseInline,Jg.parse,Gg.lex;var Qg=e=>(Object.getOwnPropertyNames(e).forEach(t=>{let n=e[t];n&&typeof n==`object`&&Qg(n)}),Object.freeze(e)),$g=Qg({all:[],used:[],unused:[]}),e_=(e,t)=>{let n=Oh(e);return n.addHook(`uponSanitizeElement`,function(e,t){let n=t.tagName||e.nodeName.toLowerCase();n.startsWith(`liipgpt-`)&&(t.allowedTags[n]=!0)}),n.addHook(`afterSanitizeAttributes`,function(e){if(e.tagName!==`A`||!e.getAttribute(`href`)?.startsWith(`http`)||(e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`),!t||e.querySelector(`.sr-only`)))return;let n=e.ownerDocument.createElement(`span`);n.className=`sr-only`,n.textContent=` ${t}`,e.appendChild(n)}),n},t_=class{marked;currentReferences=$g;lastUsedIndex=0;DomPurity;constructor(e={}){this.marked=new Xg({async:!1,breaks:!0}).use(this.createFootnoteExtension(),...e.extensions??[]),this.DomPurity=e_(e.window,e.newTabSrText)}createFootnoteExtension=()=>{let e=this;return{extensions:[{name:`footnote`,level:`inline`,start(e){return e.match(/\[\^(\d+)\]/)?.index},tokenizer(e){let t=/^\[\^(\d+)\]/.exec(e);if(t){let[e,n]=t;return{type:`footnote`,raw:e,refNumber:n}}},renderer(t){if(t.type===`footnote`){let n=parseInt(t.refNumber)-1,r=e.currentReferences.all[n];if(!r)return console.error(`Could not find ref with index:`,n),``;let i;return r?.referenceIndex.used?i=r.referenceIndex.used:(e.currentReferences.used.push(r),e.lastUsedIndex++,i=e.lastUsedIndex,r.referenceIndex.used=i),` <liipgpt-reference-number data-all-index="${n}" data-used-index="${i}" data-source="${JSON.stringify(r).replace(/"/g,`&quot;`)}"></liipgpt-reference-number>`}}}]}};parse(e){return this.DomPurity.sanitize(this.marked.parse(e),{USE_PROFILES:{html:!0,svg:!0,svgFilters:!0,mathMl:!0},FORBID_TAGS:[`hr`],ADD_ATTR:[`target`]})}toHTML(e,t){this.currentReferences=t;let n=this.parse(e);return this.currentReferences=$g,n}};function n_(){let e,t;return{promise:new Promise((n,r)=>{t=n,e=r}),reject:e,resolve:t}}var r_=class{promise;resolve;reject;constructor(){let{promise:e,resolve:t,reject:n}=n_();this.promise=e,this.resolve=t,this.reject=n}then(e,t){return this.promise.then(e,t)}catch(e){return this.promise.catch(e)}finally(e){return this.promise.finally(e)}toPromise(){return this.promise}[Symbol.toStringTag]=`Flag`},i_=class{hasValue=new r_;currentValue;setValue(e){this.currentValue=e,this.hasValue.resolve()}cleanup(e){this.hasValue.reject(e)}getCurrentValue(){return this.currentValue}async toPromise(){return await this.hasValue,this.currentValue}then(e,t){return this.toPromise().then(e,t)}catch(e){return this.toPromise().catch(e)}finally(e){return this.toPromise().finally(e)}[Symbol.toStringTag]=`FutureValue`},a_=e=>{try{return new URL(e).hostname}catch{return e}};function o_(e){return e.replace(/<[^>]*>/g,``).replace(/&nbsp;/g,` `).replace(/&amp;/g,`&`).replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).replace(/&quot;/g,`"`)}var s_=({url:e,considered:t,title:n,description:r,summary:i})=>{let a=a_(e);return{url:e,considered:t,referenceIndex:{},score:0,metadata:{},display:{card:{title:n,description:r||i,badge:e},listItem:{title:n,badge:a}}}},c_=class{store;content=new i_;backendSendsMappedRefs=!1;constructor(e){this.options=e,this.store=mt({id:e.id,state:`loading`,errors:[],type:`bot`,time:new Date().toISOString(),message:{markdown:``,html:``,text:``},references:{all:[],used:[],unused:[]},retrievalQuestion:e.userQuestion})}pushError(e){this.options.onError?.(e),this.store.update(t=>({...t,errors:[...t.errors,e]}))}updateRequestId(e){this.store.update(t=>({...t,id:e}))}updateText(e){this.store.update(t=>{let n=t.message.markdown+e,r=this.options.markdownRenderer.toHTML(n,t.references);return{...t,state:`streaming`,message:{markdown:n,html:r,text:``}}})}finishMessage(){this.store.update(e=>{let t={...e,state:`done`};return t.references.unused=t.references.all.filter(e=>e.referenceIndex.used===void 0),t.message.text=o_(t.message.html),this.options?.onFinish?.(t),this.content.setValue(t),t})}addReference(e){this.store.update(t=>{let n=t.references.all,r=n.length,i=[...n,{...e,referenceIndex:{all:r}}];return{...t,references:{used:t.references.used,all:i}}})}addMappedReference(e){this.backendSendsMappedRefs=!0,this.addReference(e)}addOldReference(e){this.backendSendsMappedRefs||this.addReference(s_(e))}updateRetrievalQuestion(e){this.store.update(t=>({...t,retrievalQuestion:e}))}setNoFeedback(){this.store.update(e=>({...e,noFeedback:!0}))}getReadableStore(){return{subscribe:this.store.subscribe}}getPromise(){return this.content.toPromise()}},l_,u_,d_,f_,p_,m_,h_,g_,__,v_,y_=s((()=>{Qp(),l_=X({blocked:q(),maintenance:q(),"rate-limit":q(),"server-error":q(),"too-short":q(),"too-long":q(),"quota-reached":q(),aborted:q(),"sse-error":q(),"client-error":q(),"unexpected-call":q(),"incomplete-error":q(),"feedback-failed":q(),"answer-form-failed":q(),"speech-not-supported":q(),"speech-transcription-failed":q(),"speech-no-text-detected":q(),"speech-microphone-access-denied":q(),"pii-detected":q()}),u_=X({email:q(),creditCard:q(),ahv:q(),phoneSwiss:q(),phoneInternational:q(),swissPassport:q(),longNumber:q()}),d_=X({name:q(),namePlural:q().optional(),intro:q().optional(),placeholder:q(),values:zf(q(),q())}),f_=X({action:q(),label:q(),type:Vf([`primary`,`secondary`]).optional()}),p_=X({hash:q(),title:q(),content:q(),actions:Y(f_).optional()}),m_=X({introductionTitle:q(),introductionDisclaimer:q().optional(),termsInvitationToConsent:q().optional(),chatInputPlaceholder:q(),chatInputPlaceholderListening:q().optional(),chatInputSubmit:q(),chatInputAbort:q(),chatInputStartListening:q(),chatInputStopListening:q(),referenceLink:q(),referencesDisplay:q(),referencesHide:q(),referencesTitle:q(),referencesFurtherTitle:q(),newChat:q(),maintenanceModeError:q(),messageBotLoading:q(),messageBotError:q(),messageBotDefaultError:q(),noResultsFound:q(),chatFooterText:q().optional(),scrollToBottom:q(),openButtonTitle:q().optional(),openButtonDescription:q().optional(),openMenu:q(),openInfo:q(),aboutThisChat:q().optional(),closeMenu:q(),closeChat:q(),close:q(),send:q(),thankYouForFeedback:q(),answerFormThankYou:q(),giveFeedback:q(),sendFeedback:q(),feedbackFormTitle:q(),feedbackFormMessage:q(),feedbackFormMessagePlaceholder:q(),feedbackFormEmail:q(),feedbackFormEmailPlaceholder:q(),askQuestionAgain:q(),answerGood:q(),answerBad:q(),classificationSubmit:q(),classificationThankYou:q(),classificationTitle:q(),selectLanguage:q(),languageChanged:q(),selectColorTheme:q(),lightMode:q(),darkMode:q(),ariaMainNavigation:q(),ariaMainNavigationInfo:q(),ariaMainNavigationLinks:q(),ariaMainNavigationLanguageSwitch:q(),ariaMainNavigationColorMode:q(),ariaGotoMainNavigation:q(),ariaAskQuestion:q(),ariaAskQuestionRegion:q(),ariaNotifications:q(),ariaPredefinedQuestions:q(),ariaPredefinedQuestionsRegion:q(),ariaChatHistory:q(),ariaOpenChat:q(),ariaQuestionFromYou:q(),ariaAnswerFromBot:q(),ariaLastAnswerNavigation:q(),ariaQuestionSent:q(),ariaAnswerReady:q(),ariaAnswerFinished:q(),ariaAnswerFinishedWithSelectedTopic:q(),ariaAskQuestionAgain:q(),ariaAnswerGood:q(),ariaAnswerBad:q(),ariaReferenceSource:q(),ariaGiveFeedback:q(),ariaAnswerForm:q(),ariaLanguageChanged:q(),ariaLightSelected:q(),ariaDarkSelected:q(),ariaSettings:q(),ariaSettingsRegion:q(),ariaReferencesRegion:q(),ariaOpensInNewTab:q(),ariaPageTitle:q(),ariaCloseWithEsc:q(),ariaInfoTitle:q(),ariaFlyoutRegion:q(),ariaSelected:q(),ariaUnselected:q(),ariaAllSelected:q(),ariaAllUnselected:q(),ariaAllReseted:q(),ariaChangeTopic:q(),popups:Y(p_).optional(),termsAcceptButton:q().optional(),termsReadButton:q().optional(),selectors:zf(q(),d_).optional(),hideSettings:q(),showSettings:q(),chooseAtLeastOneOption:q(),selectAll:q(),selectNone:q(),resetToDefaults:q(),messageTooLong:q(),selectedTopic:q(),changeTopic:q(),searchSummaryExpand:q(),searchSummaryCollapse:q(),searchSummaryOptInDefault:q(),searchSummaryOptOut:q(),searchSummaryError:q(),searchSummaryDisclaimer:q().optional(),searchSummaryLoading:q(),searchSummaryFollowUpPlaceholder:q(),searchSummaryFollowUpSubmit:q(),ariaSearchSummaryExpand:q(),ariaSearchSummaryCollapse:q(),ariaSearchSummaryOptOut:q(),ariaSearchSummaryFollowUpInput:q(),jsonLdEventDate:q(),jsonLdEventLocation:q(),jsonLdEventDescription:q(),jsonLdEventCtaLabel:q(),jsonLdCtaLabel:q(),jsonLdMapOpenMap:q(),ariaJsonLdMapCanvas:q(),ariaJsonLdEventCard:q(),ariaJsonLdMapCard:q(),ariaJsonLdCtaCard:q()}),h_=[`en`,`de`,`fr`,`it`],g_=Vf(h_),__=m_.partial().extend({selectors:zf(q(),d_).optional()}),v_=Bf(g_,__),zf(g_,l_),zf(g_,u_)})),b_,x_,S_,C_,w_,T_,E_,D_=s((()=>{Qp(),y_(),b_=Bf(g_,q()),x_=X({componentName:Hf(`buttons`),data:X({caption:q().optional(),buttons:Y(X({label:q(),href:q().url().optional(),value:q(),variant:Vf([`primary`,`secondary`,`tertiary`]).optional(),icon:q().optional(),target:q().optional()}))})}),S_=X({componentName:Hf(`combobox`),data:X({caption:b_.optional(),placeholder:b_,values:Y(X({label:b_,value:q(),metadata:zf(q(),Pf()).optional()})),removeComponentAfterValueSelection:J().optional(),selectorKey:q().optional()})}),C_=X({componentName:Hf(`alva-init`),data:X({})}),w_=X({componentName:Hf(`alva-score-survey`),data:X({})}),T_=X({type:Hf(`component`),id:q().optional(),time:q().optional(),hideAvatar:J().optional(),noSectionPadding:J().optional(),hideChatInput:J().optional()}),E_=Rf(Lf(`componentName`,[x_,S_,C_,w_]),T_)})),O_,k_,A_,j_=s((()=>{Qp(),O_=If([q(),Mf(),J(),Y(q()),Y(Mf()),Y(J())]),k_=X({title:q(),description:q().optional(),badge:q().optional(),breadcrumbs:Y(q()).optional(),previewImage:q().optional(),date:q().datetime().optional()}),A_=X({url:q().url(),score:Mf(),metadata:zf(q(),O_),language:q().optional()}).extend(k_.shape)})),M_,N_,P_,F_,I_,L_,R_,z_,B_,V_,H_,U_,W_=s((()=>{j_(),Qp(),D_(),Vf([`start`,`chat`]),Lf(`name`,[X({name:Hf(`start-page`),prefill:q().optional()}),X({name:Hf(`consent-page`)}),X({name:Hf(`chat-page`),query:q().optional(),predefinedQuestionId:q().optional(),switchQuestionId:q().optional()})]),M_=X({type:Hf(`user`),time:q(),message:q(),id:q().optional()}),Vf([`idle`,`searching`,`answering`]),N_=If([q(),Mf(),J(),Y(q()),Y(Mf()),Y(J())]),P_=X({url:q(),score:Mf(),metadata:zf(q(),N_),considered:J(),display:X({card:k_,listItem:k_})}).extend({referenceIndex:X({all:Mf(),used:Mf().optional()})}),F_=X({all:Y(P_),used:Y(P_),unused:Y(P_)}),I_=Vf([`pii-detected`,`blocked`,`maintenance`,`rate-limit`,`server-error`,`too-short`,`too-long`,`quota-reached`,`aborted`]),L_=If([I_,Hf(`sse-error`),Hf(`client-error`),Hf(`unexpected-call`)]),R_=X({type:Hf(`bot`),time:q(),id:q(),message:X({markdown:q(),html:q(),text:q()}),references:F_,errors:Y(L_),retrievalQuestion:q().optional(),noFeedback:J().optional(),feedback:Vf([`up`,`down`]).optional()}),z_=R_.extend({state:Vf([`streaming`,`done`])}),B_=R_.extend({state:Hf(`loading`)}),V_=If([B_,z_]),H_=If([V_,M_,E_]),U_=Y(X({question:q(),answer:q()}))})),G_,K_=s((()=>{G_={inherit:`inherit`,current:`currentcolor`,transparent:`transparent`,black:`#000`,white:`#fff`,slate:{50:`oklch(98.4% 0.003 247.858)`,100:`oklch(96.8% 0.007 247.896)`,200:`oklch(92.9% 0.013 255.508)`,300:`oklch(86.9% 0.022 252.894)`,400:`oklch(70.4% 0.04 256.788)`,500:`oklch(55.4% 0.046 257.417)`,600:`oklch(44.6% 0.043 257.281)`,700:`oklch(37.2% 0.044 257.287)`,800:`oklch(27.9% 0.041 260.031)`,900:`oklch(20.8% 0.042 265.755)`,950:`oklch(12.9% 0.042 264.695)`},gray:{50:`oklch(98.5% 0.002 247.839)`,100:`oklch(96.7% 0.003 264.542)`,200:`oklch(92.8% 0.006 264.531)`,300:`oklch(87.2% 0.01 258.338)`,400:`oklch(70.7% 0.022 261.325)`,500:`oklch(55.1% 0.027 264.364)`,600:`oklch(44.6% 0.03 256.802)`,700:`oklch(37.3% 0.034 259.733)`,800:`oklch(27.8% 0.033 256.848)`,900:`oklch(21% 0.034 264.665)`,950:`oklch(13% 0.028 261.692)`},zinc:{50:`oklch(98.5% 0 0)`,100:`oklch(96.7% 0.001 286.375)`,200:`oklch(92% 0.004 286.32)`,300:`oklch(87.1% 0.006 286.286)`,400:`oklch(70.5% 0.015 286.067)`,500:`oklch(55.2% 0.016 285.938)`,600:`oklch(44.2% 0.017 285.786)`,700:`oklch(37% 0.013 285.805)`,800:`oklch(27.4% 0.006 286.033)`,900:`oklch(21% 0.006 285.885)`,950:`oklch(14.1% 0.005 285.823)`},neutral:{50:`oklch(98.5% 0 0)`,100:`oklch(97% 0 0)`,200:`oklch(92.2% 0 0)`,300:`oklch(87% 0 0)`,400:`oklch(70.8% 0 0)`,500:`oklch(55.6% 0 0)`,600:`oklch(43.9% 0 0)`,700:`oklch(37.1% 0 0)`,800:`oklch(26.9% 0 0)`,900:`oklch(20.5% 0 0)`,950:`oklch(14.5% 0 0)`},stone:{50:`oklch(98.5% 0.001 106.423)`,100:`oklch(97% 0.001 106.424)`,200:`oklch(92.3% 0.003 48.717)`,300:`oklch(86.9% 0.005 56.366)`,400:`oklch(70.9% 0.01 56.259)`,500:`oklch(55.3% 0.013 58.071)`,600:`oklch(44.4% 0.011 73.639)`,700:`oklch(37.4% 0.01 67.558)`,800:`oklch(26.8% 0.007 34.298)`,900:`oklch(21.6% 0.006 56.043)`,950:`oklch(14.7% 0.004 49.25)`},mauve:{50:`oklch(98.5% 0 0)`,100:`oklch(96% 0.003 325.6)`,200:`oklch(92.2% 0.005 325.62)`,300:`oklch(86.5% 0.012 325.68)`,400:`oklch(71.1% 0.019 323.02)`,500:`oklch(54.2% 0.034 322.5)`,600:`oklch(43.5% 0.029 321.78)`,700:`oklch(36.4% 0.029 323.89)`,800:`oklch(26.3% 0.024 320.12)`,900:`oklch(21.2% 0.019 322.12)`,950:`oklch(14.5% 0.008 326)`},olive:{50:`oklch(98.8% 0.003 106.5)`,100:`oklch(96.6% 0.005 106.5)`,200:`oklch(93% 0.007 106.5)`,300:`oklch(88% 0.011 106.6)`,400:`oklch(73.7% 0.021 106.9)`,500:`oklch(58% 0.031 107.3)`,600:`oklch(46.6% 0.025 107.3)`,700:`oklch(39.4% 0.023 107.4)`,800:`oklch(28.6% 0.016 107.4)`,900:`oklch(22.8% 0.013 107.4)`,950:`oklch(15.3% 0.006 107.1)`},mist:{50:`oklch(98.7% 0.002 197.1)`,100:`oklch(96.3% 0.002 197.1)`,200:`oklch(92.5% 0.005 214.3)`,300:`oklch(87.2% 0.007 219.6)`,400:`oklch(72.3% 0.014 214.4)`,500:`oklch(56% 0.021 213.5)`,600:`oklch(45% 0.017 213.2)`,700:`oklch(37.8% 0.015 216)`,800:`oklch(27.5% 0.011 216.9)`,900:`oklch(21.8% 0.008 223.9)`,950:`oklch(14.8% 0.004 228.8)`},taupe:{50:`oklch(98.6% 0.002 67.8)`,100:`oklch(96% 0.002 17.2)`,200:`oklch(92.2% 0.005 34.3)`,300:`oklch(86.8% 0.007 39.5)`,400:`oklch(71.4% 0.014 41.2)`,500:`oklch(54.7% 0.021 43.1)`,600:`oklch(43.8% 0.017 39.3)`,700:`oklch(36.7% 0.016 35.7)`,800:`oklch(26.8% 0.011 36.5)`,900:`oklch(21.4% 0.009 43.1)`,950:`oklch(14.7% 0.004 49.3)`},red:{50:`oklch(97.1% 0.013 17.38)`,100:`oklch(93.6% 0.032 17.717)`,200:`oklch(88.5% 0.062 18.334)`,300:`oklch(80.8% 0.114 19.571)`,400:`oklch(70.4% 0.191 22.216)`,500:`oklch(63.7% 0.237 25.331)`,600:`oklch(57.7% 0.245 27.325)`,700:`oklch(50.5% 0.213 27.518)`,800:`oklch(44.4% 0.177 26.899)`,900:`oklch(39.6% 0.141 25.723)`,950:`oklch(25.8% 0.092 26.042)`},orange:{50:`oklch(98% 0.016 73.684)`,100:`oklch(95.4% 0.038 75.164)`,200:`oklch(90.1% 0.076 70.697)`,300:`oklch(83.7% 0.128 66.29)`,400:`oklch(75% 0.183 55.934)`,500:`oklch(70.5% 0.213 47.604)`,600:`oklch(64.6% 0.222 41.116)`,700:`oklch(55.3% 0.195 38.402)`,800:`oklch(47% 0.157 37.304)`,900:`oklch(40.8% 0.123 38.172)`,950:`oklch(26.6% 0.079 36.259)`},amber:{50:`oklch(98.7% 0.022 95.277)`,100:`oklch(96.2% 0.059 95.617)`,200:`oklch(92.4% 0.12 95.746)`,300:`oklch(87.9% 0.169 91.605)`,400:`oklch(82.8% 0.189 84.429)`,500:`oklch(76.9% 0.188 70.08)`,600:`oklch(66.6% 0.179 58.318)`,700:`oklch(55.5% 0.163 48.998)`,800:`oklch(47.3% 0.137 46.201)`,900:`oklch(41.4% 0.112 45.904)`,950:`oklch(27.9% 0.077 45.635)`},yellow:{50:`oklch(98.7% 0.026 102.212)`,100:`oklch(97.3% 0.071 103.193)`,200:`oklch(94.5% 0.129 101.54)`,300:`oklch(90.5% 0.182 98.111)`,400:`oklch(85.2% 0.199 91.936)`,500:`oklch(79.5% 0.184 86.047)`,600:`oklch(68.1% 0.162 75.834)`,700:`oklch(55.4% 0.135 66.442)`,800:`oklch(47.6% 0.114 61.907)`,900:`oklch(42.1% 0.095 57.708)`,950:`oklch(28.6% 0.066 53.813)`},lime:{50:`oklch(98.6% 0.031 120.757)`,100:`oklch(96.7% 0.067 122.328)`,200:`oklch(93.8% 0.127 124.321)`,300:`oklch(89.7% 0.196 126.665)`,400:`oklch(84.1% 0.238 128.85)`,500:`oklch(76.8% 0.233 130.85)`,600:`oklch(64.8% 0.2 131.684)`,700:`oklch(53.2% 0.157 131.589)`,800:`oklch(45.3% 0.124 130.933)`,900:`oklch(40.5% 0.101 131.063)`,950:`oklch(27.4% 0.072 132.109)`},green:{50:`oklch(98.2% 0.018 155.826)`,100:`oklch(96.2% 0.044 156.743)`,200:`oklch(92.5% 0.084 155.995)`,300:`oklch(87.1% 0.15 154.449)`,400:`oklch(79.2% 0.209 151.711)`,500:`oklch(72.3% 0.219 149.579)`,600:`oklch(62.7% 0.194 149.214)`,700:`oklch(52.7% 0.154 150.069)`,800:`oklch(44.8% 0.119 151.328)`,900:`oklch(39.3% 0.095 152.535)`,950:`oklch(26.6% 0.065 152.934)`},emerald:{50:`oklch(97.9% 0.021 166.113)`,100:`oklch(95% 0.052 163.051)`,200:`oklch(90.5% 0.093 164.15)`,300:`oklch(84.5% 0.143 164.978)`,400:`oklch(76.5% 0.177 163.223)`,500:`oklch(69.6% 0.17 162.48)`,600:`oklch(59.6% 0.145 163.225)`,700:`oklch(50.8% 0.118 165.612)`,800:`oklch(43.2% 0.095 166.913)`,900:`oklch(37.8% 0.077 168.94)`,950:`oklch(26.2% 0.051 172.552)`},teal:{50:`oklch(98.4% 0.014 180.72)`,100:`oklch(95.3% 0.051 180.801)`,200:`oklch(91% 0.096 180.426)`,300:`oklch(85.5% 0.138 181.071)`,400:`oklch(77.7% 0.152 181.912)`,500:`oklch(70.4% 0.14 182.503)`,600:`oklch(60% 0.118 184.704)`,700:`oklch(51.1% 0.096 186.391)`,800:`oklch(43.7% 0.078 188.216)`,900:`oklch(38.6% 0.063 188.416)`,950:`oklch(27.7% 0.046 192.524)`},cyan:{50:`oklch(98.4% 0.019 200.873)`,100:`oklch(95.6% 0.045 203.388)`,200:`oklch(91.7% 0.08 205.041)`,300:`oklch(86.5% 0.127 207.078)`,400:`oklch(78.9% 0.154 211.53)`,500:`oklch(71.5% 0.143 215.221)`,600:`oklch(60.9% 0.126 221.723)`,700:`oklch(52% 0.105 223.128)`,800:`oklch(45% 0.085 224.283)`,900:`oklch(39.8% 0.07 227.392)`,950:`oklch(30.2% 0.056 229.695)`},sky:{50:`oklch(97.7% 0.013 236.62)`,100:`oklch(95.1% 0.026 236.824)`,200:`oklch(90.1% 0.058 230.902)`,300:`oklch(82.8% 0.111 230.318)`,400:`oklch(74.6% 0.16 232.661)`,500:`oklch(68.5% 0.169 237.323)`,600:`oklch(58.8% 0.158 241.966)`,700:`oklch(50% 0.134 242.749)`,800:`oklch(44.3% 0.11 240.79)`,900:`oklch(39.1% 0.09 240.876)`,950:`oklch(29.3% 0.066 243.157)`},blue:{50:`oklch(97% 0.014 254.604)`,100:`oklch(93.2% 0.032 255.585)`,200:`oklch(88.2% 0.059 254.128)`,300:`oklch(80.9% 0.105 251.813)`,400:`oklch(70.7% 0.165 254.624)`,500:`oklch(62.3% 0.214 259.815)`,600:`oklch(54.6% 0.245 262.881)`,700:`oklch(48.8% 0.243 264.376)`,800:`oklch(42.4% 0.199 265.638)`,900:`oklch(37.9% 0.146 265.522)`,950:`oklch(28.2% 0.091 267.935)`},indigo:{50:`oklch(96.2% 0.018 272.314)`,100:`oklch(93% 0.034 272.788)`,200:`oklch(87% 0.065 274.039)`,300:`oklch(78.5% 0.115 274.713)`,400:`oklch(67.3% 0.182 276.935)`,500:`oklch(58.5% 0.233 277.117)`,600:`oklch(51.1% 0.262 276.966)`,700:`oklch(45.7% 0.24 277.023)`,800:`oklch(39.8% 0.195 277.366)`,900:`oklch(35.9% 0.144 278.697)`,950:`oklch(25.7% 0.09 281.288)`},violet:{50:`oklch(96.9% 0.016 293.756)`,100:`oklch(94.3% 0.029 294.588)`,200:`oklch(89.4% 0.057 293.283)`,300:`oklch(81.1% 0.111 293.571)`,400:`oklch(70.2% 0.183 293.541)`,500:`oklch(60.6% 0.25 292.717)`,600:`oklch(54.1% 0.281 293.009)`,700:`oklch(49.1% 0.27 292.581)`,800:`oklch(43.2% 0.232 292.759)`,900:`oklch(38% 0.189 293.745)`,950:`oklch(28.3% 0.141 291.089)`},purple:{50:`oklch(97.7% 0.014 308.299)`,100:`oklch(94.6% 0.033 307.174)`,200:`oklch(90.2% 0.063 306.703)`,300:`oklch(82.7% 0.119 306.383)`,400:`oklch(71.4% 0.203 305.504)`,500:`oklch(62.7% 0.265 303.9)`,600:`oklch(55.8% 0.288 302.321)`,700:`oklch(49.6% 0.265 301.924)`,800:`oklch(43.8% 0.218 303.724)`,900:`oklch(38.1% 0.176 304.987)`,950:`oklch(29.1% 0.149 302.717)`},fuchsia:{50:`oklch(97.7% 0.017 320.058)`,100:`oklch(95.2% 0.037 318.852)`,200:`oklch(90.3% 0.076 319.62)`,300:`oklch(83.3% 0.145 321.434)`,400:`oklch(74% 0.238 322.16)`,500:`oklch(66.7% 0.295 322.15)`,600:`oklch(59.1% 0.293 322.896)`,700:`oklch(51.8% 0.253 323.949)`,800:`oklch(45.2% 0.211 324.591)`,900:`oklch(40.1% 0.17 325.612)`,950:`oklch(29.3% 0.136 325.661)`},pink:{50:`oklch(97.1% 0.014 343.198)`,100:`oklch(94.8% 0.028 342.258)`,200:`oklch(89.9% 0.061 343.231)`,300:`oklch(82.3% 0.12 346.018)`,400:`oklch(71.8% 0.202 349.761)`,500:`oklch(65.6% 0.241 354.308)`,600:`oklch(59.2% 0.249 0.584)`,700:`oklch(52.5% 0.223 3.958)`,800:`oklch(45.9% 0.187 3.815)`,900:`oklch(40.8% 0.153 2.432)`,950:`oklch(28.4% 0.109 3.907)`},rose:{50:`oklch(96.9% 0.015 12.422)`,100:`oklch(94.1% 0.03 12.58)`,200:`oklch(89.2% 0.058 10.001)`,300:`oklch(81% 0.117 11.638)`,400:`oklch(71.2% 0.194 13.428)`,500:`oklch(64.5% 0.246 16.439)`,600:`oklch(58.6% 0.253 17.585)`,700:`oklch(51.4% 0.222 16.935)`,800:`oklch(45.5% 0.188 13.697)`,900:`oklch(41% 0.159 10.272)`,950:`oklch(27.1% 0.105 12.094)`}}})),q_=s((()=>{K_()})),J_,Y_,X_,Z_,Q_,$_=s((()=>{Qp(),vm(),J_=X({50:q(),100:q(),200:q(),300:q(),400:q(),500:q(),600:q(),700:q(),800:q(),900:q(),950:q()}),Y_=Vf([`slate`,`gray`,`zinc`,`neutral`,`stone`,`red`,`orange`,`amber`,`yellow`,`lime`,`green`,`emerald`,`teal`,`cyan`,`sky`,`blue`,`indigo`,`violet`,`purple`,`fuchsia`,`pink`,`rose`]),X_=If([J_,Y_]),Z_=If([Rf(J_,X({0:q(),1e3:q()})),Y_]),Q_=X({avatarImageUrl:q().optional(),colors:X({brand:X_.optional(),highlight:X_.optional(),grey:Z_.optional(),background:q().optional(),text:q().optional(),anchor:X({default:q().optional(),hover:q().optional()}).optional()}).optional(),font:X({family:q().optional(),urls:Y(q()).optional(),sizeXs:am.optional(),sizeSm:am.optional(),sizeBody:am.optional(),sizeH3:am.optional(),sizeH2:am.optional(),sizeH1:am.optional(),weightNormal:q().optional(),weightBold:q().optional(),weightTitle:q().optional()}).optional(),borderRadius:am.optional(),fineGrained:_m.optional()})})),ev,tv,nv,rv,iv,av,ov,sv,cv,lv,uv,dv,fv,pv,mv=s((()=>{Qp(),D_(),W_(),$_(),y_(),ev=X({label:q(),options:Y(X({label:q(),value:Mf()}))}),tv=X({label:q(),icon:q(),url:q(),target:Vf([`_blank`,`_self`]).optional()}),nv=X({id:q().optional(),label:q().nullable(),question:q(),switchQuestionId:q().optional()}),rv=X({impact:ev.optional(),quality:ev.optional()}),X({classification:rv.optional()}),iv=X({predefinedQuestions:Y(nv)}),av=If([X({maintenance:Hf(!0)}),X({id:q(),cID:q()})]),zf(g_,m_),X({label:q(),placeholder:q(),locked:J().optional()}),ov=X({settingName:q(),iconName:q(),settingIntro:q().optional(),type:Vf([`single-select`,`multi-select`]),allowEmpty:J(),values:Y(q()),defaultValues:Y(q()).optional()}),sv=X({type:Vf([`text`,`select`,`checkbox`,`radio`]),name:q(),label:b_,placeholder:b_.optional(),required:J().optional(),options:Y(X({value:q(),label:b_})).optional()}),cv=X({receiverEmail:q(),triggerLabel:b_,title:b_.optional(),caption:b_.optional(),submitLabel:b_,fields:Y(sv)}),lv=X({before:Y(H_).optional(),after:Y(H_).optional()}),uv=X({init:Y(H_).optional(),bot:lv.optional(),user:lv.optional()}),dv=X({forcePredefinedQuestions:J().optional(),forceChatPage:J().optional(),showOverallFeedbackButton:J(),showOverallFeedbackEmail:J(),showCloseChatButton:J(),showContextMenu:J(),showContextInfo:J(),showReferencesByDefault:J(),showExpandedSelectors:J(),showTextFeedback:J(),inlineLayout:J(),allowAudioInput:J(),blockPII:J(),questionPrefix:q(),menu:Bf(g_,Y(tv)).optional(),supportedLanguages:Y(g_),classification:rv.optional(),answerForm:cv.optional(),theme:Q_,translations:v_,buttonHref:q().optional(),addQueryToUrlParams:J().optional(),addRetrievalQuestionToUrlParams:J().optional(),renderKatex:J().optional(),reflectLanguageInPath:J().optional(),sendReferrer:Vf([`all`,`own`,`none`,`location`]).optional(),selectorsConfig:Y(ov).default([]),questionLengthLimit:Mf().optional(),forceConsent:J().optional(),askQuestionAgain:J(),enableBackdrop:J().optional(),parentPageContext:X({extractSelectors:q().array().optional()}),messageAdditions:uv.optional(),contextVersion:Mf().optional(),selectedTopicResetPredefinedQuestionId:q().optional()}),fv=dv.partial(),pv=Rf(fv,X({theme:X({name:q().optional()}).optional()}))}));mv();var hv=class{id;constructor(e){this.chatResponseData=e,this.id=this.chatResponseData.id}async isReadyForFeedback(){return await this.chatResponseData.readyForFeedback.toPromise(),!0}subscribe(e,t){return this.chatResponseData.readableStore.subscribe(e,t)}getContent(){return this.chatResponseData.content.toPromise()}abort(){return this.chatResponseData.abort()}async thumbsUp(){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.thumbsUp(this.id,this.chatResponseData.question)}async thumbsDown(){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.thumbsDown(this.id,this.chatResponseData.question)}async feedback(e){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.feedback(this.id,this.chatResponseData.question,e)}},gv=class{latestRequest=new i_;state=mt({state:`idle`});id;history=[];constructor(e){this.clientPrimitive=e,this.id=e.createConversationId()}subscribe(e){return this.state.subscribe(e)}chat(e,t={}){let n=this.clientPrimitive.chat(this.id,e,t);return this.history.push(n),this.latestRequest.setValue({question:e,response:n}),n}async abort(){let e=this.history.map(e=>e.abort());await Promise.all(e)}async thumbsUp(){let{question:e,response:t}=await this.latestRequest;await t.isReadyForFeedback(),await this.clientPrimitive.thumbsUp(t.id,e)}async thumbsDown(){let{question:e,response:t}=await this.latestRequest;await t.isReadyForFeedback(),await this.clientPrimitive.thumbsDown(t.id,e)}async feedback(e){let{question:t,response:n}=await this.latestRequest;await n.isReadyForFeedback(),await this.clientPrimitive.feedback(n.id,t,e)}},_v=[];for(let e=0;e<256;++e)_v.push((e+256).toString(16).slice(1));function vv(e,t=0){return(_v[e[t+0]]+_v[e[t+1]]+_v[e[t+2]]+_v[e[t+3]]+`-`+_v[e[t+4]]+_v[e[t+5]]+`-`+_v[e[t+6]]+_v[e[t+7]]+`-`+_v[e[t+8]]+_v[e[t+9]]+`-`+_v[e[t+10]]+_v[e[t+11]]+_v[e[t+12]]+_v[e[t+13]]+_v[e[t+14]]+_v[e[t+15]]).toLowerCase()}var yv,bv=new Uint8Array(16);function xv(){if(!yv){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);yv=crypto.getRandomValues.bind(crypto)}return yv(bv)}var Sv={};function Cv(e,t,n){let r;if(e)r=Tv(e.random??e.rng?.()??xv(),e.msecs,e.seq,t,n);else{let e=Date.now(),i=xv();wv(Sv,e,i),r=Tv(i,Sv.msecs,Sv.seq,t,n)}return t??vv(r)}function wv(e,t,n){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=n[6]<<23|n[7]<<16|n[8]<<8|n[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function Tv(e,t,n,r,i=0){if(e.length<16)throw Error(`Random bytes length must be >= 16`);if(!r)r=new Uint8Array(16),i=0;else if(i<0||i+16>r.length)throw RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),n??=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9],r[i++]=t/1099511627776&255,r[i++]=t/4294967296&255,r[i++]=t/16777216&255,r[i++]=t/65536&255,r[i++]=t/256&255,r[i++]=t&255,r[i++]=112|n>>>28&15,r[i++]=n>>>20&255,r[i++]=128|n>>>14&63,r[i++]=n>>>6&255,r[i++]=n<<2&255|e[10]&3,r[i++]=e[11],r[i++]=e[12],r[i++]=e[13],r[i++]=e[14],r[i++]=e[15],r}var Ev=new Map,Dv=class{get length(){return Ev.size}clear(){Ev.clear()}getItem(e){return Ev.get(e)||null}key(e){return Array.from(Ev.keys())[e]||null}removeItem(e){Ev.delete(e)}setItem(e,t){Ev.set(e,String(t))}},Ov=globalThis.localStorage??new Dv,kv=async(e,t)=>{try{let n=Ov.getItem(`liipgpt:uID`)||Ov.getItem(`uID`),r={method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({referrer:globalThis?.document?.referrer||null,uID:n,...t?{startParameters:t}:{}})},i=await e.fetchData(`/login`,av,{},r).catch(t=>(console.log(`Failed to /login use /log`,t),e.fetchData(`/log`,av,{},r)));if(`maintenance`in i&&i.maintenance)return{mode:`maintenance`};if(!(`id`in i))throw Error(`Invalid response format: missing user id`);return Ov.setItem(`liipgpt:uID`,i.id),{mode:`ready`,userId:i.id}}catch(e){throw console.error(`Failed to fetch user data:`,e),e}},Av=function(e,t){if(!(this instanceof Av))return new Av(e,t);this.url=e,t||={},this.headers=t.headers||{},this.payload=t.payload===void 0?``:t.payload,this.method=t.method||this.payload&&`POST`||`GET`,this.withCredentials=!!t.withCredentials,this.debug=!!t.debug,this.autoReconnect=t.autoReconnect===void 0?!1:t.autoReconnect,this.reconnectDelay=t.reconnectDelay===void 0?3e3:t.reconnectDelay,this.maxRetries=t.maxRetries===void 0?null:t.maxRetries,this.retryCount=0,this.reconnectTimer=null,this.useLastEventId=t.useLastEventId===void 0?!0:t.useLastEventId,this.FIELD_SEPARATOR=`:`,this.listeners={},this.xhr=null,this.readyState=Av.INITIALIZING,this.progress=0,this.chunk=``,this.lastEventId=``,this._hasParsedBom=!1,this.addEventListener=function(e,t){this.listeners[e]===void 0&&(this.listeners[e]=[]),this.listeners[e].indexOf(t)===-1&&this.listeners[e].push(t)},this.removeEventListener=function(e,t){if(this.listeners[e]===void 0)return;let n=[];this.listeners[e].forEach(function(e){e!==t&&n.push(e)}),n.length===0?delete this.listeners[e]:this.listeners[e]=n},this.dispatchEvent=function(e){if(!e)return!0;this.debug&&console.debug(e),e.source=this;let t=`on`+e.type;return this.hasOwnProperty(t)&&(this[t].call(this,e),e.defaultPrevented)?!1:this.listeners[e.type]?this.listeners[e.type].every(function(t){return t(e),!e.defaultPrevented}):!0},this._markClosed=function(){if(this.xhr=null,this.progress=0,this.chunk=``,this._setReadyState(Av.CLOSED),this.autoReconnect){if(this.maxRetries!==null&&this.retryCount>=this.maxRetries){this.debug&&console.debug(`SSE max retries (${this.maxRetries}) reached, stopping reconnection attempts`),this.autoReconnect=!1,this.close();return}this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.debug&&console.debug(`SSE will attempt to reconnect in ${this.reconnectDelay}ms (attempt ${this.retryCount+1}${this.maxRetries?`/`+this.maxRetries:``})`),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.retryCount++,this.stream()},this.reconnectDelay)}},this._setReadyState=function(e){let t=new CustomEvent(`readystatechange`);t.readyState=e,this.readyState=e,this.dispatchEvent(t)},this._onStreamFailure=function(e){let t=new CustomEvent(`error`);t.responseCode=e.currentTarget.status,t.data=e.currentTarget.response,this.dispatchEvent(t),this._markClosed()},this._onStreamAbort=function(){this.dispatchEvent(new CustomEvent(`abort`)),this._markClosed()},this._onStreamProgress=function(e){if(!this.xhr)return;if(this.xhr.status<200||this.xhr.status>=300){this._onStreamFailure(e);return}this.retryCount=0;let t=this.xhr.responseText.substring(this.progress);this.progress+=t.length,!this._hasParsedBom&&this.chunk.length===0&&(t.charCodeAt(0)===65279&&(t=t.substring(1)),this._hasParsedBom=!0);let n=(this.chunk+t).split(/(\r\n\r\n|\r\r|\n\n)/g),r=n.pop();n.forEach(function(e){e.trim().length>0&&this.dispatchEvent(this._parseEventChunk(e))}.bind(this)),this.chunk=r},this._onStreamLoaded=function(e){this._onStreamProgress(e),this.dispatchEvent(this._parseEventChunk(this.chunk)),this.chunk=``,this._markClosed()},this._parseEventChunk=function(e){if(!e||e.length===0)return null;this.debug&&console.debug(e);let t={id:null,retry:null,data:null,event:null};if(e.split(/\n|\r\n|\r/).forEach(function(e){let n=e.indexOf(this.FIELD_SEPARATOR),r,i;if(n>0){let t=e[n+1]===` `?2:1;r=e.substring(0,n),i=e.substring(n+t)}else if(n<0)r=e,i=``;else return;r in t&&(r===`data`&&t[r]!==null?t.data+=`
98
98
  `+i:t[r]=i)}.bind(this)),t.id!==null&&t.id.indexOf(`\0`)===-1&&(this.lastEventId=t.id),t.retry!==null&&/^[0-9]+$/.test(t.retry)&&(this.reconnectDelay=parseInt(t.retry,10)),t.data===null)return null;let n=new CustomEvent(t.event||`message`);return n.id=t.id,n.data=t.data||``,n.lastEventId=this.lastEventId,n},this._onReadyStateChange=function(){if(this.xhr&&this.xhr.readyState===XMLHttpRequest.HEADERS_RECEIVED){let e={},t=this.xhr.getAllResponseHeaders().trim().split(`\r
99
99
  `);for(let n of t){let[t,...r]=n.split(`:`),i=r.join(`:`).trim();e[t.trim().toLowerCase()]=e[t.trim().toLowerCase()]||[],e[t.trim().toLowerCase()].push(i)}let n=new CustomEvent(`open`);n.responseCode=this.xhr.status,n.headers=e,this.dispatchEvent(n),this._setReadyState(Av.OPEN)}},this.stream=function(){if(!this.xhr){this._setReadyState(Av.CONNECTING),this.xhr=new XMLHttpRequest,this.xhr.addEventListener(`progress`,this._onStreamProgress.bind(this)),this.xhr.addEventListener(`load`,this._onStreamLoaded.bind(this)),this.xhr.addEventListener(`readystatechange`,this._onReadyStateChange.bind(this)),this.xhr.addEventListener(`error`,this._onStreamFailure.bind(this)),this.xhr.addEventListener(`abort`,this._onStreamAbort.bind(this)),this.xhr.open(this.method,this.url);for(let e in this.headers)this.xhr.setRequestHeader(e,this.headers[e]);this.useLastEventId&&this.lastEventId.length>0&&this.xhr.setRequestHeader(`Last-Event-ID`,this.lastEventId),this.xhr.withCredentials=this.withCredentials,this.xhr.send(this.payload)}},this.close=function(){this.reconnectTimer&&=(clearTimeout(this.reconnectTimer),null),this.autoReconnect=!1,this.xhr&&this.xhr.abort()},(t.start===void 0||t.start)&&this.stream()};Av.INITIALIZING=-1,Av.CONNECTING=0,Av.OPEN=1,Av.CLOSED=2;var jv=class{eventSource;triggeredOnClose=!1;constructor(e,t,n){this.options=t,this.payload=n;let r={headers:{"content-type":`application/json`}};n&&(r.payload=JSON.stringify(n)),t.apiKey&&(r.headers[`api-key`]=t.apiKey),this.eventSource=new(t.EventSource??Av)(e,r),this.eventSource.onmessage=e=>{try{let n=JSON.parse(e.data);t.onMessage(n)}catch(e){t.onError(new CustomEvent(`parse-error`,{detail:e}))}},this.eventSource.onerror=e=>{t.onError(e),this.isClosed()&&this.close()}}isClosed(){return this.eventSource.readyState===EventSource.CLOSED}close(){this.isClosed()||this.eventSource.close(),this.triggeredOnClose||(this.triggeredOnClose=!0,this.options.onClose())}},Mv=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>t!=null)),Nv=class{constructor(e){this.options=e}getDefaultHeaders(e={}){let t={"Content-Type":`application/json`,...e};return this.options.apiKey&&(t[`api-key`]=this.options.apiKey),t}get speechRecognitionApiKey(){return this.options.speechRecognitionApiKey}async subscribeSse(e,t={},n){let r=Mv(t);return this.options.apiKey&&(n.apiKey=this.options.apiKey),new jv(`${this.options.apiUrl}${e}`,n,r)}async fetchData(e,t,n={},r={}){let i=`${this.options.apiUrl}${e}?${new URLSearchParams(Mv(n)).toString()}`,a={...r,headers:this.getDefaultHeaders(r?.headers)},o=await fetch(i,a);if(!o.ok){let e=await o.text();throw Error(`API request failed: ${o.status} - ${e}`)}let s=await o.json(),{success:c,data:l,error:u}=t.safeParse(s);if(this.options.strict){if(!c)throw console.error(`Server response has wrong type:
100
100
  `,{error:u,url:i,opts:a,data:s}),Error(`Server response has wrong type: ${u.message}`);return l}else return c||console.warn(`Server response has wrong type:
@@ -1 +0,0 @@
1
- import"../chunks/rEsbAd0y.js";import{n as e,s as t}from"../chunks/BAjfX0W5.js";import"../chunks/Bo0U8J3e.js";export{t as load_css,e as start};