@chatdakenh/widget 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/logo.svg +196 -0
- package/dist/widget.js +1 -0
- package/package.json +32 -0
package/dist/logo.svg
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
2
|
+
width="100%" viewBox="0 0 500 500" enable-background="new 0 0 500 500" xml:space="preserve">
|
|
3
|
+
|
|
4
|
+
<path fill="#9BBDFF" opacity="1.000000" stroke="none"
|
|
5
|
+
d="
|
|
6
|
+
M140.252762,54.245255
|
|
7
|
+
C161.199081,40.689423 183.823654,31.758812 207.401901,25.441967
|
|
8
|
+
C218.162231,22.559170 229.443436,21.474543 240.552277,20.085209
|
|
9
|
+
C249.344025,18.985662 258.256256,17.894676 267.074524,18.157549
|
|
10
|
+
C286.327698,18.731489 305.418152,20.832294 324.238861,25.508360
|
|
11
|
+
C342.365295,30.011917 359.974152,35.993649 376.050507,45.254520
|
|
12
|
+
C390.599274,53.635445 404.269012,63.634136 417.842194,73.580231
|
|
13
|
+
C425.236206,78.998398 431.905945,85.508339 438.407745,92.019745
|
|
14
|
+
C453.031647,106.665215 464.399719,123.674751 471.380707,143.132553
|
|
15
|
+
C474.512604,151.862045 475.486511,161.423309 476.933563,170.686203
|
|
16
|
+
C479.086426,184.467300 476.760651,197.912125 473.042145,211.196777
|
|
17
|
+
C469.138641,225.142105 462.030579,237.334549 452.987610,248.498154
|
|
18
|
+
C451.031036,250.913574 449.011749,253.278244 447.222992,255.424408
|
|
19
|
+
C452.578979,262.901031 458.419708,269.942169 463.016998,277.718384
|
|
20
|
+
C470.989227,291.203278 475.878845,305.659546 477.228210,321.619019
|
|
21
|
+
C479.005951,342.644440 473.921509,361.978516 464.654266,380.186249
|
|
22
|
+
C459.562073,390.191101 452.179291,399.112488 445.241089,408.066589
|
|
23
|
+
C440.601715,414.053833 435.103363,419.418091 429.681763,424.748230
|
|
24
|
+
C416.609558,437.599976 402.080109,448.743652 385.938477,457.294098
|
|
25
|
+
C371.010132,465.201843 355.611420,472.498718 339.783081,478.338623
|
|
26
|
+
C328.065460,482.661804 315.348694,484.320099 303.036499,486.977600
|
|
27
|
+
C287.606628,490.308044 271.887787,490.742279 256.265381,489.821228
|
|
28
|
+
C242.122437,488.987457 227.914429,487.443146 214.011795,484.772064
|
|
29
|
+
C192.990158,480.733246 173.204575,472.657898 154.339157,462.634796
|
|
30
|
+
C137.535614,453.707153 121.945580,443.004517 107.576645,430.333160
|
|
31
|
+
C92.684273,417.200195 79.884979,402.420380 68.669403,386.181244
|
|
32
|
+
C53.099525,363.637512 42.290356,338.815369 35.383755,312.427704
|
|
33
|
+
C32.518871,301.481964 31.045507,290.045258 30.174398,278.736725
|
|
34
|
+
C29.106480,264.873260 28.579288,250.874588 29.233473,237.001099
|
|
35
|
+
C29.774836,225.520233 31.840506,214.026443 34.178226,202.734497
|
|
36
|
+
C37.918365,184.668381 44.283577,167.369522 52.657726,150.958160
|
|
37
|
+
C61.209385,134.198929 70.957283,118.114639 83.548431,103.955528
|
|
38
|
+
C88.771812,98.081696 93.625313,91.827011 99.264633,86.385597
|
|
39
|
+
C111.716057,74.371162 125.021523,63.355614 140.252762,54.245255
|
|
40
|
+
M108.120209,148.666534
|
|
41
|
+
C104.447884,154.809601 100.510056,160.811142 97.147957,167.119553
|
|
42
|
+
C80.106979,199.093979 73.178864,233.161484 75.861305,269.322540
|
|
43
|
+
C77.930298,297.213928 85.955261,323.176819 99.716423,347.430084
|
|
44
|
+
C117.004189,377.898743 141.297302,401.322479 171.721924,418.448242
|
|
45
|
+
C213.823135,442.146759 258.649567,449.251038 305.811920,438.849579
|
|
46
|
+
C349.532410,429.207184 386.088409,407.243866 414.248810,372.145020
|
|
47
|
+
C425.279663,358.396271 432.706299,342.711517 430.605408,324.703369
|
|
48
|
+
C427.819458,300.823303 413.933746,284.421753 392.071655,275.197144
|
|
49
|
+
C371.312012,266.437622 352.093231,271.254883 334.967804,284.643890
|
|
50
|
+
C327.676544,290.344360 321.794983,297.812286 314.961823,304.141266
|
|
51
|
+
C296.444458,321.292358 274.844513,328.971405 249.755310,323.359222
|
|
52
|
+
C214.214554,315.409180 191.208771,282.394226 196.043884,245.608185
|
|
53
|
+
C199.801422,217.020401 215.618057,196.903122 243.128448,187.776154
|
|
54
|
+
C269.608887,178.990906 293.779999,184.648239 314.353760,203.723877
|
|
55
|
+
C320.200836,209.145187 325.443268,215.245255 330.727783,221.241318
|
|
56
|
+
C342.579987,234.689407 357.343689,240.364700 375.198914,239.298920
|
|
57
|
+
C415.211884,236.910507 441.233917,197.116104 427.265320,159.530792
|
|
58
|
+
C420.437622,141.159485 408.230408,126.889565 393.728912,114.287544
|
|
59
|
+
C342.808899,70.037331 284.217865,55.052128 218.855057,71.201500
|
|
60
|
+
C172.727554,82.598366 136.025131,109.127724 108.120209,148.666534
|
|
61
|
+
M235.598419,290.227814
|
|
62
|
+
C237.346329,289.684235 239.420258,289.567719 240.786758,288.524506
|
|
63
|
+
C247.355972,283.509674 254.340652,285.013580 261.608154,286.313660
|
|
64
|
+
C275.517670,288.801910 288.528015,285.788727 300.120270,277.859833
|
|
65
|
+
C318.746368,265.119873 319.992035,242.878952 303.485718,228.103714
|
|
66
|
+
C287.071564,213.410950 253.270721,212.606583 235.945602,226.738678
|
|
67
|
+
C223.729797,236.703125 219.690872,250.082748 225.986404,262.513824
|
|
68
|
+
C228.339157,267.159485 231.950302,271.310974 235.584763,275.117737
|
|
69
|
+
C238.336823,278.000244 238.381363,280.308899 235.750916,282.707642
|
|
70
|
+
C233.435349,284.819214 230.718979,286.491028 228.181503,288.359650
|
|
71
|
+
C226.971115,289.250977 225.765106,290.148254 224.557114,291.042816
|
|
72
|
+
C224.742432,291.423157 224.927750,291.803497 225.113068,292.183807
|
|
73
|
+
C228.350769,291.614594 231.588455,291.045349 235.598419,290.227814
|
|
74
|
+
z"/>
|
|
75
|
+
<path fill="#0155FF" opacity="1.000000" stroke="none"
|
|
76
|
+
d="
|
|
77
|
+
M108.322021,148.367065
|
|
78
|
+
C136.025131,109.127724 172.727554,82.598366 218.855057,71.201500
|
|
79
|
+
C284.217865,55.052128 342.808899,70.037331 393.728912,114.287544
|
|
80
|
+
C408.230408,126.889565 420.437622,141.159485 427.265320,159.530792
|
|
81
|
+
C441.233917,197.116104 415.211884,236.910507 375.198914,239.298920
|
|
82
|
+
C357.343689,240.364700 342.579987,234.689407 330.727783,221.241318
|
|
83
|
+
C325.443268,215.245255 320.200836,209.145187 314.353760,203.723877
|
|
84
|
+
C293.779999,184.648239 269.608887,178.990906 243.128448,187.776154
|
|
85
|
+
C215.618057,196.903122 199.801422,217.020401 196.043884,245.608185
|
|
86
|
+
C191.208771,282.394226 214.214554,315.409180 249.755310,323.359222
|
|
87
|
+
C274.844513,328.971405 296.444458,321.292358 314.961823,304.141266
|
|
88
|
+
C321.794983,297.812286 327.676544,290.344360 334.967804,284.643890
|
|
89
|
+
C352.093231,271.254883 371.312012,266.437622 392.071655,275.197144
|
|
90
|
+
C413.933746,284.421753 427.819458,300.823303 430.605408,324.703369
|
|
91
|
+
C432.706299,342.711517 425.279663,358.396271 414.248810,372.145020
|
|
92
|
+
C386.088409,407.243866 349.532410,429.207184 305.811920,438.849579
|
|
93
|
+
C258.649567,449.251038 213.823135,442.146759 171.721924,418.448242
|
|
94
|
+
C141.297302,401.322479 117.004189,377.898743 99.716423,347.430084
|
|
95
|
+
C85.955261,323.176819 77.930298,297.213928 75.861305,269.322540
|
|
96
|
+
C73.178864,233.161484 80.106979,199.093979 97.147957,167.119553
|
|
97
|
+
C100.510056,160.811142 104.447884,154.809601 108.322021,148.367065
|
|
98
|
+
M124.732277,348.758545
|
|
99
|
+
C137.075897,367.711823 152.421600,383.870148 171.464478,396.022980
|
|
100
|
+
C216.863174,424.995544 265.766296,431.981781 317.353333,416.653839
|
|
101
|
+
C328.825653,413.245056 339.519928,406.953430 350.211639,401.306030
|
|
102
|
+
C354.789398,398.888062 355.795074,393.890808 353.986969,390.580719
|
|
103
|
+
C351.664520,386.329071 346.933105,384.648438 341.863373,386.510406
|
|
104
|
+
C338.743591,387.656189 335.718903,389.076111 332.698029,390.473511
|
|
105
|
+
C313.928802,399.155762 294.305084,404.978973 273.621399,405.807190
|
|
106
|
+
C233.120285,407.428894 197.177872,395.239075 166.501266,368.445831
|
|
107
|
+
C119.026039,326.980469 102.398308,258.873688 125.774902,200.401932
|
|
108
|
+
C129.581100,190.881516 135.008072,181.997131 139.853516,172.908127
|
|
109
|
+
C143.407333,166.241943 141.580566,160.515106 134.994873,158.541763
|
|
110
|
+
C130.428177,157.173386 125.811470,159.657990 121.864021,166.289673
|
|
111
|
+
C106.951569,191.342392 98.216049,218.374680 97.119453,247.585983
|
|
112
|
+
C95.757301,283.871216 104.612198,317.514099 124.732277,348.758545
|
|
113
|
+
M231.371399,150.805130
|
|
114
|
+
C223.340347,153.234314 215.590225,156.229111 209.735519,162.594116
|
|
115
|
+
C206.951294,165.621002 206.433975,169.058380 208.892334,172.605530
|
|
116
|
+
C211.312332,176.097321 214.422379,177.869446 218.716782,176.167175
|
|
117
|
+
C221.494781,175.065994 224.297882,173.993149 226.971573,172.669037
|
|
118
|
+
C258.672729,156.969666 298.586456,161.985825 325.048859,185.445374
|
|
119
|
+
C332.877136,192.385330 340.022064,200.109787 347.323059,207.627243
|
|
120
|
+
C355.346741,215.888763 364.878937,220.104919 376.462219,218.946335
|
|
121
|
+
C385.279724,218.064377 393.504395,215.629944 399.346313,208.332779
|
|
122
|
+
C402.498993,204.394745 402.417938,199.530991 399.436829,195.925613
|
|
123
|
+
C396.607666,192.504013 391.521362,191.729782 387.168457,194.133835
|
|
124
|
+
C386.009613,194.773865 384.983093,195.649841 383.876251,196.388168
|
|
125
|
+
C375.607117,201.904083 366.485657,201.373352 359.141144,194.697296
|
|
126
|
+
C356.446014,192.247452 354.091125,189.406265 351.703400,186.638062
|
|
127
|
+
C339.709167,172.732666 326.008118,161.082138 308.883057,153.885254
|
|
128
|
+
C283.708405,143.305466 258.067749,143.584015 231.371399,150.805130
|
|
129
|
+
M154.652512,133.691925
|
|
130
|
+
C147.558197,132.693588 142.721359,135.941010 141.486389,142.531601
|
|
131
|
+
C140.414276,148.253052 143.815903,153.179947 149.896072,154.712143
|
|
132
|
+
C155.230484,156.056396 160.184494,153.312469 162.133408,147.934067
|
|
133
|
+
C164.276215,142.020569 161.953751,137.177597 154.652512,133.691925
|
|
134
|
+
z"/>
|
|
135
|
+
<path fill="#FEFFFF" opacity="1.000000" stroke="none"
|
|
136
|
+
d="
|
|
137
|
+
M235.212280,290.351990
|
|
138
|
+
C231.588455,291.045349 228.350769,291.614594 225.113068,292.183807
|
|
139
|
+
C224.927750,291.803497 224.742432,291.423157 224.557114,291.042816
|
|
140
|
+
C225.765106,290.148254 226.971115,289.250977 228.181503,288.359650
|
|
141
|
+
C230.718979,286.491028 233.435349,284.819214 235.750916,282.707642
|
|
142
|
+
C238.381363,280.308899 238.336823,278.000244 235.584763,275.117737
|
|
143
|
+
C231.950302,271.310974 228.339157,267.159485 225.986404,262.513824
|
|
144
|
+
C219.690872,250.082748 223.729797,236.703125 235.945602,226.738678
|
|
145
|
+
C253.270721,212.606583 287.071564,213.410950 303.485718,228.103714
|
|
146
|
+
C319.992035,242.878952 318.746368,265.119873 300.120270,277.859833
|
|
147
|
+
C288.528015,285.788727 275.517670,288.801910 261.608154,286.313660
|
|
148
|
+
C254.340652,285.013580 247.355972,283.509674 240.786758,288.524506
|
|
149
|
+
C239.420258,289.567719 237.346329,289.684235 235.212280,290.351990
|
|
150
|
+
z"/>
|
|
151
|
+
<path fill="#99BCFF" opacity="1.000000" stroke="none"
|
|
152
|
+
d="
|
|
153
|
+
M124.528618,348.458801
|
|
154
|
+
C104.612198,317.514099 95.757301,283.871216 97.119453,247.585983
|
|
155
|
+
C98.216049,218.374680 106.951569,191.342392 121.864021,166.289673
|
|
156
|
+
C125.811470,159.657990 130.428177,157.173386 134.994873,158.541763
|
|
157
|
+
C141.580566,160.515106 143.407333,166.241943 139.853516,172.908127
|
|
158
|
+
C135.008072,181.997131 129.581100,190.881516 125.774902,200.401932
|
|
159
|
+
C102.398308,258.873688 119.026039,326.980469 166.501266,368.445831
|
|
160
|
+
C197.177872,395.239075 233.120285,407.428894 273.621399,405.807190
|
|
161
|
+
C294.305084,404.978973 313.928802,399.155762 332.698029,390.473511
|
|
162
|
+
C335.718903,389.076111 338.743591,387.656189 341.863373,386.510406
|
|
163
|
+
C346.933105,384.648438 351.664520,386.329071 353.986969,390.580719
|
|
164
|
+
C355.795074,393.890808 354.789398,398.888062 350.211639,401.306030
|
|
165
|
+
C339.519928,406.953430 328.825653,413.245056 317.353333,416.653839
|
|
166
|
+
C265.766296,431.981781 216.863174,424.995544 171.464478,396.022980
|
|
167
|
+
C152.421600,383.870148 137.075897,367.711823 124.528618,348.458801
|
|
168
|
+
z"/>
|
|
169
|
+
<path fill="#99BCFF" opacity="1.000000" stroke="none"
|
|
170
|
+
d="
|
|
171
|
+
M231.751648,150.669800
|
|
172
|
+
C258.067749,143.584015 283.708405,143.305466 308.883057,153.885254
|
|
173
|
+
C326.008118,161.082138 339.709167,172.732666 351.703400,186.638062
|
|
174
|
+
C354.091125,189.406265 356.446014,192.247452 359.141144,194.697296
|
|
175
|
+
C366.485657,201.373352 375.607117,201.904083 383.876251,196.388168
|
|
176
|
+
C384.983093,195.649841 386.009613,194.773865 387.168457,194.133835
|
|
177
|
+
C391.521362,191.729782 396.607666,192.504013 399.436829,195.925613
|
|
178
|
+
C402.417938,199.530991 402.498993,204.394745 399.346313,208.332779
|
|
179
|
+
C393.504395,215.629944 385.279724,218.064377 376.462219,218.946335
|
|
180
|
+
C364.878937,220.104919 355.346741,215.888763 347.323059,207.627243
|
|
181
|
+
C340.022064,200.109787 332.877136,192.385330 325.048859,185.445374
|
|
182
|
+
C298.586456,161.985825 258.672729,156.969666 226.971573,172.669037
|
|
183
|
+
C224.297882,173.993149 221.494781,175.065994 218.716782,176.167175
|
|
184
|
+
C214.422379,177.869446 211.312332,176.097321 208.892334,172.605530
|
|
185
|
+
C206.433975,169.058380 206.951294,165.621002 209.735519,162.594116
|
|
186
|
+
C215.590225,156.229111 223.340347,153.234314 231.751648,150.669800
|
|
187
|
+
z"/>
|
|
188
|
+
<path fill="#97BBFF" opacity="1.000000" stroke="none"
|
|
189
|
+
d="
|
|
190
|
+
M155.025177,133.790253
|
|
191
|
+
C161.953751,137.177597 164.276215,142.020569 162.133408,147.934067
|
|
192
|
+
C160.184494,153.312469 155.230484,156.056396 149.896072,154.712143
|
|
193
|
+
C143.815903,153.179947 140.414276,148.253052 141.486389,142.531601
|
|
194
|
+
C142.721359,135.941010 147.558197,132.693588 155.025177,133.790253
|
|
195
|
+
z"/>
|
|
196
|
+
</svg>
|
package/dist/widget.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){var s=document.createElement('style');s.setAttribute('data-cdk-widget','');s.textContent=".cdk-widget,.cdk-widget *{box-sizing:border-box;margin:0;padding:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;line-height:1.5}.cdk-widget{position:fixed;z-index:2147483647;color-scheme:light;--cdk-brand: #0b63f6;--cdk-brand-hover: #0852d6;--cdk-brand-soft: #dbeafe;--cdk-brand-contrast: #ffffff}.cdk-bottom-right{bottom:20px;right:20px}.cdk-bottom-left{bottom:20px;left:20px}.cdk-top-right{top:20px;right:20px}.cdk-top-left{top:20px;left:20px}.cdk-panel{position:absolute;bottom:72px;right:0;width:380px;max-width:calc(100vw - 32px);height:560px;max-height:calc(100vh - 120px);background:#fff;border-radius:16px;box-shadow:0 20px 60px #00000026,0 8px 20px #0000001a;display:flex;flex-direction:column;overflow:hidden;opacity:0;transform:translateY(16px) scale(.95);pointer-events:none;transition:opacity .25s ease,transform .25s ease}.cdk-bottom-left .cdk-panel{right:auto;left:0}.cdk-top-right .cdk-panel,.cdk-top-left .cdk-panel{bottom:auto;top:72px;transform:translateY(-16px) scale(.95)}.cdk-panel-open{opacity:1;transform:translateY(0) scale(1);pointer-events:auto}.cdk-widget-compact.cdk-bottom-right .cdk-panel,.cdk-widget-compact.cdk-bottom-left .cdk-panel{bottom:58px}.cdk-widget-compact.cdk-top-right .cdk-panel,.cdk-widget-compact.cdk-top-left .cdk-panel{top:86px}.cdk-header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;background:linear-gradient(135deg,#0f6bff,#0b63f6 55%,#0852d6);color:#fff;flex-shrink:0}.cdk-header-info{flex:1;min-width:0}.cdk-header-avatar{width:40px;height:40px;margin-right:12px;object-fit:contain}.cdk-header-title{font-size:16px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.cdk-header-subtitle{font-size:12px;opacity:.85;margin-top:2px;transition:opacity .2s ease}.cdk-subtitle-typing{font-style:italic;opacity:1;animation:cdk-typingPulse 1.5s ease-in-out infinite}@keyframes cdk-typingPulse{0%,to{opacity:.7}50%{opacity:1}}.cdk-header-close{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:none;border-radius:8px;background:#fff3;color:#fff;cursor:pointer;transition:background .2s;flex-shrink:0;margin-left:12px}.cdk-header-close:hover{background:#ffffff59}.cdk-widget-compact .cdk-header{padding:12px 14px}.cdk-widget-compact .cdk-header-avatar{width:36px;height:36px;margin-right:11px}.cdk-widget-compact .cdk-header-title{font-size:14px;line-height:1.2}.cdk-widget-compact .cdk-header-subtitle{font-size:12px;margin-top:1px;line-height:1.2}.cdk-widget-compact .cdk-header-close{width:30px;height:30px;margin-left:10px;border-radius:8px}.cdk-widget-compact .cdk-header-close svg{width:17px;height:17px}.cdk-messages{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:8px;background:#f8f9fb}.cdk-messages::-webkit-scrollbar{width:4px}.cdk-messages::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:4px}.cdk-msg{display:flex;flex-direction:column;max-width:80%;animation:cdk-fadeIn .2s ease}@keyframes cdk-fadeIn{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}.cdk-msg-visitor{align-self:flex-end;align-items:flex-end}.cdk-msg-agent{align-self:flex-start;align-items:flex-start}.cdk-msg-bubble{padding:10px 14px;border-radius:16px;font-size:14px;word-break:break-word;white-space:pre-wrap}.cdk-msg-bubble-visitor{background:var(--cdk-brand);color:#fff;border:1px solid rgba(255,255,255,.18);border-bottom-right-radius:4px}.cdk-msg-bubble-agent{background:#fff;color:#1f2937;border:1px solid #e5e7eb;border-bottom-left-radius:4px}.cdk-msg-time{font-size:11px;color:#9ca3af;margin-top:4px;padding:0 4px}.cdk-msg-attachments{margin-bottom:4px}.cdk-attachment-img-link{display:block}.cdk-attachment-img{max-width:100%;max-height:200px;border-radius:8px;object-fit:cover;cursor:pointer;transition:opacity .2s}.cdk-attachment-img:hover{opacity:.85}.cdk-attachment-file{display:flex;align-items:center;gap:6px;padding:8px 12px;background:#0000000f;border-radius:8px;text-decoration:none;color:inherit;font-size:13px;transition:background .2s}.cdk-attachment-file:hover{background:#0000001a}.cdk-msg-bubble-visitor .cdk-attachment-file{background:#ffffff26;color:#fff}.cdk-msg-bubble-visitor .cdk-attachment-file:hover{background:#ffffff40}.cdk-attachment-icon{font-size:16px;flex-shrink:0}.cdk-attachment-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cdk-attachment-size{font-size:11px;opacity:.7;flex-shrink:0}.cdk-typing{display:flex;align-items:center;gap:4px;padding:12px 18px}.cdk-dot{width:7px;height:7px;background:#9ca3af;border-radius:50%;animation:cdk-bounce 1.4s infinite ease-in-out both}.cdk-dot:nth-child(1){animation-delay:-.32s}.cdk-dot:nth-child(2){animation-delay:-.16s}@keyframes cdk-bounce{0%,80%,to{transform:scale(.6);opacity:.4}40%{transform:scale(1);opacity:1}}.cdk-input-wrapper{display:flex;flex-direction:column;position:relative;background:#fff;border-top:1px solid #e5e7eb}.cdk-action-btn{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border:none;background:transparent;color:#6b7280;border-radius:8px;cursor:pointer;transition:background .2s,color .2s;flex-shrink:0}.cdk-action-btn:hover{background:#f3f4f6;color:#1f2937}.cdk-input-area{display:flex;align-items:flex-end;gap:6px;padding:8px 12px;background:#fff}.cdk-emoji-picker{position:absolute;bottom:100%;left:12px;width:300px;max-width:calc(100% - 24px);background:#fff;border:1px solid #e5e7eb;border-radius:12px;box-shadow:0 10px 25px #0000001a;padding:10px;z-index:10;margin-bottom:8px}.cdk-emoji-grid{display:grid;grid-template-columns:repeat(8,1fr);gap:4px;max-height:200px;overflow-y:auto}.cdk-emoji-grid::-webkit-scrollbar{width:4px}.cdk-emoji-grid::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:4px}.cdk-emoji-btn{background:transparent;border:none;font-size:20px;cursor:pointer;width:100%;aspect-ratio:1;border-radius:6px;display:flex;align-items:center;justify-content:center}.cdk-emoji-btn:hover{background:#f3f4f6}.cdk-input-box{flex:1;display:flex;align-items:flex-end;background:#f9fafb;border:1px solid #e5e7eb;border-radius:10px;padding:2px 3px;transition:border-color .2s,background .2s;gap:1px}.cdk-input-box:focus-within{border-color:var(--cdk-brand);background:#fff}.cdk-input{flex:1;border:none;background:transparent;padding:4px 8px;font-size:14px;resize:none;outline:none;max-height:88px;min-height:30px;color:#1f2937;font-family:inherit;line-height:1.35}.cdk-input::placeholder{color:#9ca3af}.cdk-send-btn{display:flex;align-items:center;justify-content:center;width:36px;height:36px;border:none;border-radius:10px;background:var(--cdk-brand);color:#fff;cursor:pointer;flex-shrink:0;transition:opacity .2s,transform .15s}.cdk-send-btn:hover:not(:disabled){background:var(--cdk-brand-hover);opacity:1;transform:scale(1.03)}.cdk-send-btn:disabled{opacity:.4;cursor:not-allowed}.cdk-footer{text-align:center;padding:8px;font-size:11px;color:#9ca3af;background:#fff;border-top:1px solid #f3f4f6}.cdk-footer a{color:var(--cdk-brand);text-decoration:none;font-weight:500}.cdk-footer a:hover{text-decoration:underline}.cdk-toggle{display:flex;align-items:center;justify-content:center;width:58px;height:58px;border:none;border-radius:99px;color:#fff;cursor:pointer;background:#0b63f6;box-shadow:0 12px 26px #0b63f652,0 4px 10px #02061726;transition:transform .2s,box-shadow .2s;position:relative}.cdk-toggle:hover{transform:translateY(-1px);box-shadow:0 16px 30px #0b63f65c,0 5px 12px #02061729}.cdk-toggle:active{transform:scale(.98)}.cdk-toggle-logo{width:38px;height:38px;display:block;object-fit:contain;object-position:center;filter:drop-shadow(0 1px 2px rgba(255,255,255,.18))}.cdk-toggle[aria-label=\"Toggle chat\"]>svg{color:#fff}.cdk-toggle-compact{height:136px;border-radius:13px 0 0 13px;border:none;flex-direction:column;padding:12px 0;width:40px;position:absolute;right:-20px;bottom:0;transform:none;background:#0b63f6;box-shadow:-10px 12px 24px #0b63f647}.cdk-toggle-compact:hover{transform:none;box-shadow:-12px 14px 28px #0b63f657}.cdk-toggle-compact:active{transform:none}.cdk-toggle-compact.cdk-compact-left{border-radius:0 13px 13px 0;left:-20px;right:auto;box-shadow:10px 12px 24px #0b63f647}.cdk-toggle-compact.cdk-compact-left:hover{transform:none;box-shadow:12px 14px 28px #0b63f657}.cdk-toggle-compact.cdk-compact-left:active{transform:none}.cdk-compact-inner{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;width:100%;height:100%;padding:6px 0;position:relative;z-index:1}.cdk-compact-logo{width:24px;height:24px;display:block;object-fit:contain;object-position:center;position:static;transform:none;padding:0;background:transparent;border:none;border-radius:0;box-shadow:none;opacity:.95;transform:translateY(-1px)}.cdk-compact-title{writing-mode:vertical-rl;font-weight:700;font-size:12px;letter-spacing:.3px;text-transform:none;white-space:nowrap;color:#fff;text-shadow:0 1px 2px rgba(2,6,23,.2);transform:rotate(180deg);margin:0;line-height:1;transform-origin:center}.cdk-toggle-compact:not(.cdk-compact-left) .cdk-compact-title{transform:none}.cdk-compact-icon{display:flex;align-items:center;justify-content:center}.cdk-toggle-compact .cdk-badge{top:-4px;bottom:auto;right:auto;left:-8px}.cdk-compact-left .cdk-badge{left:auto;right:-8px}.cdk-badge{position:absolute;top:-4px;right:-4px;min-width:20px;height:20px;background:#ef4444;border-radius:10px;font-size:11px;font-weight:700;color:#fff;display:flex;align-items:center;justify-content:center;padding:0 5px;border:2px solid white;animation:cdk-popIn .3s ease}@keyframes cdk-popIn{0%{transform:scale(0)}to{transform:scale(1)}}@media(max-width:480px){.cdk-panel{width:calc(100vw - 16px);height:calc(100vh - 100px);border-radius:12px;right:-12px}.cdk-widget{bottom:12px!important;right:12px!important}}.cdk-toast{position:absolute;bottom:62px;left:12px;right:12px;display:flex;align-items:center;justify-content:space-between;padding:10px 14px;border-radius:10px;font-size:13px;z-index:10;animation:cdk-toastSlideIn .3s ease}.cdk-toast-error{background:#fef2f2;color:#b91c1c;border:1px solid #fecaca}.cdk-toast-close{background:none;border:none;color:#b91c1c;cursor:pointer;font-size:14px;padding:0 0 0 8px;opacity:.6}.cdk-toast-close:hover{opacity:1}@keyframes cdk-toastSlideIn{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.cdk-msg-failed{opacity:.85}.cdk-msg-bubble-failed{background:#fef2f2!important;color:#b91c1c!important;border:1px dashed #fca5a5!important}.cdk-msg-meta{display:flex;align-items:center;margin-top:4px;padding:0 4px}.cdk-msg-error{display:flex;align-items:center;gap:8px}.cdk-msg-error-text{font-size:11px;color:#dc2626}.cdk-msg-retry-btn{background:none;border:1px solid #dc2626;color:#dc2626;border-radius:4px;font-size:11px;padding:2px 8px;cursor:pointer;transition:all .2s}.cdk-msg-retry-btn:hover{background:#dc2626;color:#fff}.cdk-msg-delete-btn{background:none;border:none;color:#9ca3af;cursor:pointer;font-size:12px;padding:2px 4px}.cdk-msg-delete-btn:hover{color:#dc2626}\n";document.head.appendChild(s)})();var ChatDaKenh=function(){"use strict";var t,e,n,s,i,r,o,a,c,h,l,u={},d=[],p=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,_=Array.isArray;function f(t,e){for(var n in e)t[n]=e[n];return t}function g(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function m(t,s,i,r,o){var a={type:t,props:s,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==o?++n:o,__i:-1,__u:0};return null==o&&null!=e.vnode&&e.vnode(a),a}function y(t){return t.children}function v(t,e){this.props=t,this.context=e}function b(t,e){if(null==e)return t.__?b(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e)return n.__e;return"function"==typeof t.type?b(t):null}function w(t){if(t.__P&&t.__d){var n=t.__v,s=n.__e,i=[],r=[],o=f({},n);o.__v=n.__v+1,e.vnode&&e.vnode(o),R(t.__P,o,n,t.__n,t.__P.namespaceURI,32&n.__u?[s]:null,i,null==s?b(n):s,!!(32&n.__u),r),o.__v=n.__v,o.__.__k[o.__i]=o,B(i,o,r),n.__e=n.__=null,o.__e!=s&&k(o)}}function k(t){if(null!=(t=t.__)&&null!=t.__c)return t.__e=t.__c.base=null,t.__k.some(function(e){if(null!=e&&null!=e.__e)return t.__e=t.__c.base=e.__e}),k(t)}function T(t){(!t.__d&&(t.__d=!0)&&s.push(t)&&!C.__r++||i!=e.debounceRendering)&&((i=e.debounceRendering)||r)(C)}function C(){for(var t,e=1;s.length;)s.length>e&&s.sort(o),t=s.shift(),e=s.length,w(t);C.__r=0}function S(t,e,n,s,i,r,o,a,c,h,l){var p,f,g,v,w,k,T,C=s&&s.__k||d,S=e.length;for(c=function(t,e,n,s,i){var r,o,a,c,h,l=n.length,u=l,d=0;for(t.__k=new Array(i),r=0;r<i;r++)null!=(o=e[r])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=t.__k[r]=m(null,o,null,null,null):_(o)?o=t.__k[r]=m(y,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=t.__k[r]=m(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):t.__k[r]=o,c=r+d,o.__=t,o.__b=t.__b+1,a=null,-1!=(h=o.__i=A(o,n,c,u))&&(u--,(a=n[h])&&(a.__u|=2)),null==a||null==a.__v?(-1==h&&(i>l?d--:i<l&&d++),"function"!=typeof o.type&&(o.__u|=4)):h!=c&&(h==c-1?d--:h==c+1?d++:(h>c?d--:d++,o.__u|=4))):t.__k[r]=null;if(u)for(r=0;r<l;r++)null!=(a=n[r])&&!(2&a.__u)&&(a.__e==s&&(s=b(a)),P(a,a));return s}(n,e,C,c,S),p=0;p<S;p++)null!=(g=n.__k[p])&&(f=-1!=g.__i&&C[g.__i]||u,g.__i=p,k=R(t,g,f,i,r,o,a,c,h,l),v=g.__e,g.ref&&f.ref!=g.ref&&(f.ref&&L(f.ref,null,g),l.push(g.ref,g.__c||v,g)),null==w&&null!=v&&(w=v),(T=!!(4&g.__u))||f.__k===g.__k?c=E(g,c,t,T):"function"==typeof g.type&&void 0!==k?c=k:v&&(c=v.nextSibling),g.__u&=-7);return n.__e=w,c}function E(t,e,n,s){var i,r;if("function"==typeof t.type){for(i=t.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=t,e=E(i[r],e,n,s));return e}t.__e!=e&&(s&&(e&&t.type&&!e.parentNode&&(e=b(t)),n.insertBefore(t.__e,e||null)),e=t.__e);do{e=e&&e.nextSibling}while(null!=e&&8==e.nodeType);return e}function A(t,e,n,s){var i,r,o,a=t.key,c=t.type,h=e[n],l=null!=h&&!(2&h.__u);if(null===h&&null==a||l&&a==h.key&&c==h.type)return n;if(s>(l?1:0))for(i=n-1,r=n+1;i>=0||r<e.length;)if(null!=(h=e[o=i>=0?i--:r++])&&!(2&h.__u)&&a==h.key&&c==h.type)return o;return-1}function O(t,e,n){"-"==e[0]?t.setProperty(e,null==n?"":n):t[e]=null==n?"":"number"!=typeof n||p.test(e)?n:n+"px"}function x(t,e,n,s,i){var r,o;t:if("style"==e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof s&&(t.style.cssText=s=""),s)for(e in s)n&&e in n||O(t.style,e,"");if(n)for(e in n)s&&n[e]==s[e]||O(t.style,e,n[e])}else if("o"==e[0]&&"n"==e[1])r=e!=(e=e.replace(a,"$1")),o=e.toLowerCase(),e=o in t||"onFocusOut"==e||"onFocusIn"==e?o.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+r]=n,n?s?n.u=s.u:(n.u=c,t.addEventListener(e,r?l:h,r)):t.removeEventListener(e,r?l:h,r);else{if("http://www.w3.org/2000/svg"==i)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=e&&"height"!=e&&"href"!=e&&"list"!=e&&"form"!=e&&"tabIndex"!=e&&"download"!=e&&"rowSpan"!=e&&"colSpan"!=e&&"role"!=e&&"popover"!=e&&e in t)try{t[e]=null==n?"":n;break t}catch(u){}"function"==typeof n||(null==n||!1===n&&"-"!=e[4]?t.removeAttribute(e):t.setAttribute(e,"popover"==e&&1==n?"":n))}}function N(t){return function(n){if(this.l){var s=this.l[n.type+t];if(null==n.t)n.t=c++;else if(n.t<s.u)return;return s(e.event?e.event(n):n)}}}function R(n,s,i,r,o,a,c,h,l,p){var m,w,k,T,C,E,A,O,N,R,B,L,P,j,M,q=s.type;if(void 0!==s.constructor)return null;128&i.__u&&(l=!!(32&i.__u),a=[h=s.__e=i.__e]),(m=e.__b)&&m(s);t:if("function"==typeof q)try{if(O=s.props,N="prototype"in q&&q.prototype.render,R=(m=q.contextType)&&r[m.__c],B=m?R?R.props.value:m.__:r,i.__c?A=(w=s.__c=i.__c).__=w.__E:(N?s.__c=w=new q(O,B):(s.__c=w=new v(O,B),w.constructor=q,w.render=U),R&&R.sub(w),w.state||(w.state={}),w.__n=r,k=w.__d=!0,w.__h=[],w._sb=[]),N&&null==w.__s&&(w.__s=w.state),N&&null!=q.getDerivedStateFromProps&&(w.__s==w.state&&(w.__s=f({},w.__s)),f(w.__s,q.getDerivedStateFromProps(O,w.__s))),T=w.props,C=w.state,w.__v=s,k)N&&null==q.getDerivedStateFromProps&&null!=w.componentWillMount&&w.componentWillMount(),N&&null!=w.componentDidMount&&w.__h.push(w.componentDidMount);else{if(N&&null==q.getDerivedStateFromProps&&O!==T&&null!=w.componentWillReceiveProps&&w.componentWillReceiveProps(O,B),s.__v==i.__v||!w.__e&&null!=w.shouldComponentUpdate&&!1===w.shouldComponentUpdate(O,w.__s,B)){s.__v!=i.__v&&(w.props=O,w.state=w.__s,w.__d=!1),s.__e=i.__e,s.__k=i.__k,s.__k.some(function(t){t&&(t.__=s)}),d.push.apply(w.__h,w._sb),w._sb=[],w.__h.length&&c.push(w);break t}null!=w.componentWillUpdate&&w.componentWillUpdate(O,w.__s,B),N&&null!=w.componentDidUpdate&&w.__h.push(function(){w.componentDidUpdate(T,C,E)})}if(w.context=B,w.props=O,w.__P=n,w.__e=!1,L=e.__r,P=0,N)w.state=w.__s,w.__d=!1,L&&L(s),m=w.render(w.props,w.state,w.context),d.push.apply(w.__h,w._sb),w._sb=[];else do{w.__d=!1,L&&L(s),m=w.render(w.props,w.state,w.context),w.state=w.__s}while(w.__d&&++P<25);w.state=w.__s,null!=w.getChildContext&&(r=f(f({},r),w.getChildContext())),N&&!k&&null!=w.getSnapshotBeforeUpdate&&(E=w.getSnapshotBeforeUpdate(T,C)),j=null!=m&&m.type===y&&null==m.key?D(m.props.children):m,h=S(n,_(j)?j:[j],s,i,r,o,a,c,h,l,p),w.base=s.__e,s.__u&=-161,w.__h.length&&c.push(w),A&&(w.__E=w.__=null)}catch(F){if(s.__v=null,l||null!=a)if(F.then){for(s.__u|=l?160:128;h&&8==h.nodeType&&h.nextSibling;)h=h.nextSibling;a[a.indexOf(h)]=null,s.__e=h}else{for(M=a.length;M--;)g(a[M]);I(s)}else s.__e=i.__e,s.__k=i.__k,F.then||I(s);e.__e(F,s,i)}else null==a&&s.__v==i.__v?(s.__k=i.__k,s.__e=i.__e):h=s.__e=function(n,s,i,r,o,a,c,h,l){var d,p,f,m,y,v,w,k=i.props||u,T=s.props,C=s.type;if("svg"==C?o="http://www.w3.org/2000/svg":"math"==C?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=a)for(d=0;d<a.length;d++)if((y=a[d])&&"setAttribute"in y==!!C&&(C?y.localName==C:3==y.nodeType)){n=y,a[d]=null;break}if(null==n){if(null==C)return document.createTextNode(T);n=document.createElementNS(o,C,T.is&&T),h&&(e.__m&&e.__m(s,a),h=!1),a=null}if(null==C)k===T||h&&n.data==T||(n.data=T);else{if(a=a&&t.call(n.childNodes),!h&&null!=a)for(k={},d=0;d<n.attributes.length;d++)k[(y=n.attributes[d]).name]=y.value;for(d in k)y=k[d],"dangerouslySetInnerHTML"==d?f=y:"children"==d||d in T||"value"==d&&"defaultValue"in T||"checked"==d&&"defaultChecked"in T||x(n,d,null,y,o);for(d in T)y=T[d],"children"==d?m=y:"dangerouslySetInnerHTML"==d?p=y:"value"==d?v=y:"checked"==d?w=y:h&&"function"!=typeof y||k[d]===y||x(n,d,y,k[d],o);if(p)h||f&&(p.__html==f.__html||p.__html==n.innerHTML)||(n.innerHTML=p.__html),s.__k=[];else if(f&&(n.innerHTML=""),S("template"==s.type?n.content:n,_(m)?m:[m],s,i,r,"foreignObject"==C?"http://www.w3.org/1999/xhtml":o,a,c,a?a[0]:i.__k&&b(i,0),h,l),null!=a)for(d=a.length;d--;)g(a[d]);h||(d="value","progress"==C&&null==v?n.removeAttribute("value"):null!=v&&(v!==n[d]||"progress"==C&&!v||"option"==C&&v!=k[d])&&x(n,d,v,k[d],o),d="checked",null!=w&&w!=n[d]&&x(n,d,w,k[d],o))}return n}(i.__e,s,i,r,o,a,c,l,p);return(m=e.diffed)&&m(s),128&s.__u?void 0:h}function I(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(I))}function B(t,n,s){for(var i=0;i<s.length;i++)L(s[i],s[++i],s[++i]);e.__c&&e.__c(n,t),t.some(function(n){try{t=n.__h,n.__h=[],t.some(function(t){t.call(n)})}catch(s){e.__e(s,n.__v)}})}function D(t){return"object"!=typeof t||null==t||t.__b>0?t:_(t)?t.map(D):f({},t)}function L(t,n,s){try{if("function"==typeof t){var i="function"==typeof t.__u;i&&t.__u(),i&&null==n||(t.__u=t(n))}else t.current=n}catch(r){e.__e(r,s)}}function P(t,n,s){var i,r;if(e.unmount&&e.unmount(t),(i=t.ref)&&(i.current&&i.current!=t.__e||L(i,null,n)),null!=(i=t.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){e.__e(o,n)}i.base=i.__P=null}if(i=t.__k)for(r=0;r<i.length;r++)i[r]&&P(i[r],n,s||"function"!=typeof t.type);s||g(t.__e),t.__c=t.__=t.__e=void 0}function U(t,e,n){return this.constructor(t,n)}function j(n,s,i){var r,o,a;s==document&&(s=document.documentElement),e.__&&e.__(n,s),r=!1?null:s.__k,o=[],a=[],R(s,n=s.__k=function(e,n,s){var i,r,o,a={};for(o in n)"key"==o?i=n[o]:"ref"==o?r=n[o]:a[o]=n[o];if(arguments.length>2&&(a.children=arguments.length>3?t.call(arguments,2):s),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===a[o]&&(a[o]=e.defaultProps[o]);return m(e,a,i,r,null)}(y,null,[n]),r||u,u,s.namespaceURI,r?null:s.firstChild?t.call(s.childNodes):null,o,r?r.__e:s.firstChild,false,a),B(o,n,a)}t=d.slice,e={__e:function(t,e,n,s){for(var i,r,o;e=e.__;)if((i=e.__c)&&!i.__)try{if((r=i.constructor)&&null!=r.getDerivedStateFromError&&(i.setState(r.getDerivedStateFromError(t)),o=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(t,s||{}),o=i.__d),o)return i.__E=i}catch(a){t=a}throw t}},n=0,v.prototype.setState=function(t,e){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=f({},this.state),"function"==typeof t&&(t=t(f({},n),this.props)),t&&f(n,t),null!=t&&this.__v&&(e&&this._sb.push(e),T(this))},v.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),T(this))},v.prototype.render=y,s=[],r="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,o=function(t,e){return t.__v.__b-e.__v.__b},C.__r=0,a=/(PointerCapture)$|Capture$/i,c=0,h=N(!1),l=N(!0);var M=0;function q(t,n,s,i,r,o){n||(n={});var a,c,h=n;if("ref"in h)for(c in h={},n)"ref"==c?a=n[c]:h[c]=n[c];var l={type:t,props:h,key:s,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--M,__i:-1,__u:0,__source:r,__self:o};if("function"==typeof t&&(a=t.defaultProps))for(c in a)void 0===h[c]&&(h[c]=a[c]);return e.vnode&&e.vnode(l),l}var F,$,H,V,z=0,W=[],K=e,Y=K.__b,J=K.__r,X=K.diffed,Q=K.__c,Z=K.unmount,G=K.__;function tt(t,e){K.__h&&K.__h($,t,z||e),z=0;var n=$.__H||($.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function et(t){return z=1,function(t,e){var n=tt(F++,2);if(n.t=t,!n.__c&&(n.__=[dt(void 0,e),function(t){var e=n.__N?n.__N[0]:n.__[0],s=n.t(e,t);e!==s&&(n.__N=[s,n.__[1]],n.__c.setState({}))}],n.__c=$,!$.__f)){var s=function(t,e,s){if(!n.__c.__H)return!0;var r=n.__c.__H.__.filter(function(t){return t.__c});if(r.every(function(t){return!t.__N}))return!i||i.call(this,t,e,s);var o=n.__c.props!==t;return r.some(function(t){if(t.__N){var e=t.__[0];t.__=t.__N,t.__N=void 0,e!==t.__[0]&&(o=!0)}}),i&&i.call(this,t,e,s)||o};$.__f=!0;var i=$.shouldComponentUpdate,r=$.componentWillUpdate;$.componentWillUpdate=function(t,e,n){if(this.__e){var o=i;i=void 0,s(t,e,n),i=o}r&&r.call(this,t,e,n)},$.shouldComponentUpdate=s}return n.__N||n.__}(dt,t)}function nt(t,e){var n=tt(F++,3);!K.__s&&ut(n.__H,e)&&(n.__=t,n.u=e,$.__H.__h.push(n))}function st(t){return z=5,it(function(){return{current:t}},[])}function it(t,e){var n=tt(F++,7);return ut(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function rt(t,e){return z=8,it(function(){return t},e)}function ot(){for(var t;t=W.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(ht),e.__h.some(lt),e.__h=[]}catch(n){e.__h=[],K.__e(n,t.__v)}}}K.__b=function(t){$=null,Y&&Y(t)},K.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),G&&G(t,e)},K.__r=function(t){J&&J(t),F=0;var e=($=t.__c).__H;e&&(H===$?(e.__h=[],$.__h=[],e.__.some(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.some(ht),e.__h.some(lt),e.__h=[],F=0)),H=$},K.diffed=function(t){X&&X(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==W.push(e)&&V===K.requestAnimationFrame||((V=K.requestAnimationFrame)||ct)(ot)),e.__H.__.some(function(t){t.u&&(t.__H=t.u),t.u=void 0})),H=$=null},K.__c=function(t,e){e.some(function(t){try{t.__h.some(ht),t.__h=t.__h.filter(function(t){return!t.__||lt(t)})}catch(n){e.some(function(t){t.__h&&(t.__h=[])}),e=[],K.__e(n,t.__v)}}),Q&&Q(t,e)},K.unmount=function(t){Z&&Z(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.some(function(t){try{ht(t)}catch(n){e=n}}),n.__H=void 0,e&&K.__e(e,n.__v))};var at="function"==typeof requestAnimationFrame;function ct(t){var e,n=function(){clearTimeout(s),at&&cancelAnimationFrame(e),setTimeout(t)},s=setTimeout(n,35);at&&(e=requestAnimationFrame(n))}function ht(t){var e=$,n=t.__c;"function"==typeof n&&(t.__c=void 0,n()),$=e}function lt(t){var e=$;t.__c=t.__(),$=e}function ut(t,e){return!t||t.length!==e.length||e.some(function(e,n){return e!==t[n]})}function dt(t,e){return"function"==typeof e?e(t):e}const pt={VISITOR_ID:"cdk_visitor_id",CONVERSATION_ID:"cdk_conversation_id",SESSION_TOKEN:"cdk_session_token",COMPANY_ID:"cdk_company_id"},_t="widget:message",ft="widget:agent_typing",gt="widget:session_expired",mt="receive_message",yt="join_receive_message";const vt=new class{get(t){try{return localStorage.getItem(t)??sessionStorage.getItem(t)??null}catch{return null}}set(t,e){try{localStorage.setItem(t,e)}catch{try{sessionStorage.setItem(t,e)}catch{}}}remove(t){try{localStorage.removeItem(t),sessionStorage.removeItem(t)}catch{}}getVisitorId(){return this.get(pt.VISITOR_ID)}setVisitorId(t){this.set(pt.VISITOR_ID,t)}getConversationId(){return this.get(pt.CONVERSATION_ID)}setConversationId(t){this.set(pt.CONVERSATION_ID,t)}getSessionToken(){return this.get(pt.SESSION_TOKEN)}setSessionToken(t){this.set(pt.SESSION_TOKEN,t)}getCompanyId(){return this.get(pt.COMPANY_ID)}setCompanyId(t){this.set(pt.COMPANY_ID,t)}clearAll(){Object.values(pt).forEach(t=>this.remove(t))}};const bt=new class{constructor(){this.baseUrl=""}configure(t){this.baseUrl=t.replace(/\/$/,"")+"/widgets"}async request(t,e={}){const n=vt.getSessionToken(),s=vt.getCompanyId(),i=await fetch(`${this.baseUrl}${t}`,{...e,headers:{"Content-Type":"application/json",...n?{Authorization:`Bearer ${n}`}:{},...s?{"x-tenant-id":s}:{},...e.headers}});if(!i.ok)throw new Error(`API Error: ${i.status} ${i.statusText}`);return i.json()}async initialize(t){const e=await this.request("/initialize",{method:"POST",body:JSON.stringify(t)});if(!e.success)throw new Error("Failed to initialize widget");const n=e.data,s={...n.widget_config.settings};return delete s.primaryColor,delete s.widget_bubble_launcher_title,{...n,widget_config:{...n.widget_config,settings:s}}}async sendMessage(t){const e=await this.request("/send-message",{method:"POST",body:JSON.stringify(t)});if(!e.success)throw new Error(e.message||"Failed to send message");return e}async getMessages(t,e){const n=await this.request(`/${t}/get-messages/${e}`);if(!n.success)throw new Error("Failed to fetch messages");return n.data}async uploadFile(t){const e=vt.getSessionToken(),n=vt.getCompanyId(),s=new FormData;s.append("file",t);const i=await fetch(`${this.baseUrl}/upload`,{method:"POST",headers:{...e?{Authorization:`Bearer ${e}`}:{},...n?{"x-tenant-id":n}:{}},body:s});if(!i.ok){const t=await i.json().catch(()=>({}));throw new Error(t.message||`Upload failed: ${i.status}`)}const r=await i.json();if(!r.success)throw new Error(r.message||"Upload failed");return r.data}},wt=Object.create(null);wt.open="0",wt.close="1",wt.ping="2",wt.pong="3",wt.message="4",wt.upgrade="5",wt.noop="6";const kt=Object.create(null);Object.keys(wt).forEach(t=>{kt[wt[t]]=t});const Tt={type:"error",data:"parser error"},Ct="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),St="function"==typeof ArrayBuffer,Et=t=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,At=({type:t,data:e},n,s)=>Ct&&e instanceof Blob?n?s(e):Ot(e,s):St&&(e instanceof ArrayBuffer||Et(e))?n?s(e):Ot(new Blob([e]),s):s(wt[t]+(e||"")),Ot=(t,e)=>{const n=new FileReader;return n.onload=function(){const t=n.result.split(",")[1];e("b"+(t||""))},n.readAsDataURL(t)};function xt(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let Nt;const Rt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",It="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let en=0;en<64;en++)It[Rt.charCodeAt(en)]=en;const Bt="function"==typeof ArrayBuffer,Dt=(t,e)=>{if("string"!=typeof t)return{type:"message",data:Pt(t,e)};const n=t.charAt(0);if("b"===n)return{type:"message",data:Lt(t.substring(1),e)};return kt[n]?t.length>1?{type:kt[n],data:t.substring(1)}:{type:kt[n]}:Tt},Lt=(t,e)=>{if(Bt){const n=(t=>{let e,n,s,i,r,o=.75*t.length,a=t.length,c=0;"="===t[t.length-1]&&(o--,"="===t[t.length-2]&&o--);const h=new ArrayBuffer(o),l=new Uint8Array(h);for(e=0;e<a;e+=4)n=It[t.charCodeAt(e)],s=It[t.charCodeAt(e+1)],i=It[t.charCodeAt(e+2)],r=It[t.charCodeAt(e+3)],l[c++]=n<<2|s>>4,l[c++]=(15&s)<<4|i>>2,l[c++]=(3&i)<<6|63&r;return h})(t);return Pt(n,e)}return{base64:!0,data:t}},Pt=(t,e)=>"blob"===e?t instanceof Blob?t:new Blob([t]):t instanceof ArrayBuffer?t:t.buffer,Ut=String.fromCharCode(30);function jt(){return new TransformStream({transform(t,e){!function(t,e){Ct&&t.data instanceof Blob?t.data.arrayBuffer().then(xt).then(e):St&&(t.data instanceof ArrayBuffer||Et(t.data))?e(xt(t.data)):At(t,!1,t=>{Nt||(Nt=new TextEncoder),e(Nt.encode(t))})}(t,n=>{const s=n.length;let i;if(s<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,s);else if(s<65536){i=new Uint8Array(3);const t=new DataView(i.buffer);t.setUint8(0,126),t.setUint16(1,s)}else{i=new Uint8Array(9);const t=new DataView(i.buffer);t.setUint8(0,127),t.setBigUint64(1,BigInt(s))}t.data&&"string"!=typeof t.data&&(i[0]|=128),e.enqueue(i),e.enqueue(n)})}})}let Mt;function qt(t){return t.reduce((t,e)=>t+e.length,0)}function Ft(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let s=0;for(let i=0;i<e;i++)n[i]=t[0][s++],s===t[0].length&&(t.shift(),s=0);return t.length&&s<t[0].length&&(t[0]=t[0].slice(s)),n}function $t(t){if(t)return function(t){for(var e in $t.prototype)t[e]=$t.prototype[e];return t}(t)}$t.prototype.on=$t.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},$t.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},$t.prototype.off=$t.prototype.removeListener=$t.prototype.removeAllListeners=$t.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,s=this._callbacks["$"+t];if(!s)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var i=0;i<s.length;i++)if((n=s[i])===e||n.fn===e){s.splice(i,1);break}return 0===s.length&&delete this._callbacks["$"+t],this},$t.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(n){s=0;for(var i=(n=n.slice(0)).length;s<i;++s)n[s].apply(this,e)}return this},$t.prototype.emitReserved=$t.prototype.emit,$t.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},$t.prototype.hasListeners=function(t){return!!this.listeners(t).length};const Ht="function"==typeof Promise&&"function"==typeof Promise.resolve?t=>Promise.resolve().then(t):(t,e)=>e(t,0),Vt="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function zt(t,...e){return e.reduce((e,n)=>(t.hasOwnProperty(n)&&(e[n]=t[n]),e),{})}const Wt=Vt.setTimeout,Kt=Vt.clearTimeout;function Yt(t,e){e.useNativeTimers?(t.setTimeoutFn=Wt.bind(Vt),t.clearTimeoutFn=Kt.bind(Vt)):(t.setTimeoutFn=Vt.setTimeout.bind(Vt),t.clearTimeoutFn=Vt.clearTimeout.bind(Vt))}function Jt(t){return"string"==typeof t?function(t){let e=0,n=0;for(let s=0,i=t.length;s<i;s++)e=t.charCodeAt(s),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(s++,n+=4);return n}(t):Math.ceil(1.33*(t.byteLength||t.size))}function Xt(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class Qt extends Error{constructor(t,e,n){super(t),this.description=e,this.context=n,this.type="TransportError"}}class Zt extends $t{constructor(t){super(),this.writable=!1,Yt(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,e,n){return super.emitReserved("error",new Qt(t,e,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(t){"open"===this.readyState&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const e=Dt(t,this.socket.binaryType);this.onPacket(e)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,e={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(e)}_hostname(){const t=this.opts.hostname;return-1===t.indexOf(":")?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&443!==Number(this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(t){const e=function(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}(t);return e.length?"?"+e:""}}class Gt extends Zt{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const e=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let t=0;this._polling&&(t++,this.once("pollComplete",function(){--t||e()})),this.writable||(t++,this.once("drain",function(){--t||e()}))}else e()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){((t,e)=>{const n=t.split(Ut),s=[];for(let i=0;i<n.length;i++){const t=Dt(n[i],e);if(s.push(t),"error"===t.type)break}return s})(t,this.socket.binaryType).forEach(t=>{if("opening"===this.readyState&&"open"===t.type&&this.onOpen(),"close"===t.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(t)}),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};"open"===this.readyState?t():this.once("open",t)}write(t){this.writable=!1,((t,e)=>{const n=t.length,s=new Array(n);let i=0;t.forEach((t,r)=>{At(t,!1,t=>{s[r]=t,++i===n&&e(s.join(Ut))})})})(t,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",e=this.query||{};return!1!==this.opts.timestampRequests&&(e[this.opts.timestampParam]=Xt()),this.supportsBinary||e.sid||(e.b64=1),this.createUri(t,e)}}let te=!1;try{te="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(tn){}const ee=te;function ne(){}class se extends Gt{constructor(t){if(super(t),"undefined"!=typeof location){const e="https:"===location.protocol;let n=location.port;n||(n=e?"443":"80"),this.xd="undefined"!=typeof location&&t.hostname!==location.hostname||n!==t.port}}doWrite(t,e){const n=this.request({method:"POST",data:t});n.on("success",e),n.on("error",(t,e)=>{this.onError("xhr post error",t,e)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(t,e)=>{this.onError("xhr poll error",t,e)}),this.pollXhr=t}}class ie extends $t{constructor(t,e,n){super(),this.createRequest=t,Yt(this,n),this._opts=n,this._method=n.method||"GET",this._uri=e,this._data=void 0!==n.data?n.data:null,this._create()}_create(){var t;const e=zt(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(e);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let t in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(t)&&n.setRequestHeader(t,this._opts.extraHeaders[t])}}catch(s){}if("POST"===this._method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(s){}try{n.setRequestHeader("Accept","*/*")}catch(s){}null===(t=this._opts.cookieJar)||void 0===t||t.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var t;3===n.readyState&&(null===(t=this._opts.cookieJar)||void 0===t||t.parseCookies(n.getResponseHeader("set-cookie"))),4===n.readyState&&(200===n.status||1223===n.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof n.status?n.status:0)},0))},n.send(this._data)}catch(s){return void this.setTimeoutFn(()=>{this._onError(s)},0)}"undefined"!=typeof document&&(this._index=ie.requestsCount++,ie.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=ne,t)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete ie.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;null!==t&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(ie.requestsCount=0,ie.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",re);else if("function"==typeof addEventListener){addEventListener("onpagehide"in Vt?"pagehide":"unload",re,!1)}function re(){for(let t in ie.requests)ie.requests.hasOwnProperty(t)&&ie.requests[t].abort()}const oe=function(){const t=ae({xdomain:!1});return t&&null!==t.responseType}();function ae(t){const e=t.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!e||ee))return new XMLHttpRequest}catch(n){}if(!e)try{return new(Vt[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(n){}}const ce="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class he extends Zt{get name(){return"websocket"}doOpen(){const t=this.uri(),e=this.opts.protocols,n=ce?{}:zt(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,e,n)}catch(tn){return this.emitReserved("error",tn)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let e=0;e<t.length;e++){const n=t[e],s=e===t.length-1;At(n,this.supportsBinary,t=>{try{this.doWrite(n,t)}catch(e){}s&&Ht(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",e=this.query||{};return this.opts.timestampRequests&&(e[this.opts.timestampParam]=Xt()),this.supportsBinary||(e.b64=1),this.createUri(t,e)}}const le=Vt.WebSocket||Vt.MozWebSocket;const ue={websocket:class extends he{createSocket(t,e,n){return ce?new le(t,e,n):e?new le(t,e):new le(t)}doWrite(t,e){this.ws.send(e)}},webtransport:class extends Zt{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(tn){return this.emitReserved("error",tn)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const e=function(t,e){Mt||(Mt=new TextDecoder);const n=[];let s=0,i=-1,r=!1;return new TransformStream({transform(o,a){for(n.push(o);;){if(0===s){if(qt(n)<1)break;const t=Ft(n,1);r=!(128&~t[0]),i=127&t[0],s=i<126?3:126===i?1:2}else if(1===s){if(qt(n)<2)break;const t=Ft(n,2);i=new DataView(t.buffer,t.byteOffset,t.length).getUint16(0),s=3}else if(2===s){if(qt(n)<8)break;const t=Ft(n,8),e=new DataView(t.buffer,t.byteOffset,t.length),r=e.getUint32(0);if(r>Math.pow(2,21)-1){a.enqueue(Tt);break}i=r*Math.pow(2,32)+e.getUint32(4),s=3}else{if(qt(n)<i)break;const t=Ft(n,i);a.enqueue(Dt(r?t:Mt.decode(t),e)),s=0}if(0===i||i>t){a.enqueue(Tt);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=t.readable.pipeThrough(e).getReader(),s=jt();s.readable.pipeTo(t.writable),this._writer=s.writable.getWriter();const i=()=>{n.read().then(({done:t,value:e})=>{t||(this.onPacket(e),i())}).catch(t=>{})};i();const r={type:"open"};this.query.sid&&(r.data=`{"sid":"${this.query.sid}"}`),this._writer.write(r).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let e=0;e<t.length;e++){const n=t[e],s=e===t.length-1;this._writer.write(n).then(()=>{s&&Ht(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;null===(t=this._transport)||void 0===t||t.close()}},polling:class extends se{constructor(t){super(t);const e=t&&t.forceBase64;this.supportsBinary=oe&&!e}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new ie(ae,this.uri(),t)}}},de=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,pe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function _e(t){if(t.length>8e3)throw"URI too long";const e=t,n=t.indexOf("["),s=t.indexOf("]");-1!=n&&-1!=s&&(t=t.substring(0,n)+t.substring(n,s).replace(/:/g,";")+t.substring(s,t.length));let i=de.exec(t||""),r={},o=14;for(;o--;)r[pe[o]]=i[o]||"";return-1!=n&&-1!=s&&(r.source=e,r.host=r.host.substring(1,r.host.length-1).replace(/;/g,":"),r.authority=r.authority.replace("[","").replace("]","").replace(/;/g,":"),r.ipv6uri=!0),r.pathNames=function(t,e){const n=/\/{2,9}/g,s=e.replace(n,"/").split("/");"/"!=e.slice(0,1)&&0!==e.length||s.splice(0,1);"/"==e.slice(-1)&&s.splice(s.length-1,1);return s}(0,r.path),r.queryKey=function(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(t,e,s){e&&(n[e]=s)}),n}(0,r.query),r}const fe="function"==typeof addEventListener&&"function"==typeof removeEventListener,ge=[];fe&&addEventListener("offline",()=>{ge.forEach(t=>t())},!1);class me extends $t{constructor(t,e){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&"object"==typeof t&&(e=t,t=null),t){const n=_e(t);e.hostname=n.host,e.secure="https"===n.protocol||"wss"===n.protocol,e.port=n.port,n.query&&(e.query=n.query)}else e.host&&(e.hostname=_e(e.host).host);Yt(this,e),this.secure=null!=e.secure?e.secure:"undefined"!=typeof location&&"https:"===location.protocol,e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.hostname=e.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=e.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},e.transports.forEach(t=>{const e=t.prototype.name;this.transports.push(e),this._transportsByName[e]=t}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},e),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(t){let e={},n=t.split("&");for(let s=0,i=n.length;s<i;s++){let t=n[s].split("=");e[decodeURIComponent(t[0])]=decodeURIComponent(t[1])}return e}(this.opts.query)),fe&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},ge.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const e=Object.assign({},this.opts.query);e.EIO=4,e.transport=t,this.id&&(e.sid=this.id);const n=Object.assign({},this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](n)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);const t=this.opts.rememberUpgrade&&me.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const e=this.createTransport(t);e.open(),this.setTransport(e)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",me.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const e=new Error("server error");e.code=t.data,this._onError(e);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data)}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let e=0;e<this.writeBuffer.length;e++){const n=this.writeBuffer[e].data;if(n&&(t+=Jt(n)),e>0&&t>this._maxPayload)return this.writeBuffer.slice(0,e);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Ht(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,e,n){return this._sendPacket("message",t,e,n),this}send(t,e,n){return this._sendPacket("message",t,e,n),this}_sendPacket(t,e,n,s){if("function"==typeof e&&(s=e,e=void 0),"function"==typeof n&&(s=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const i={type:t,data:e,options:n};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),s&&this.once("flush",s),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},e=()=>{this.off("upgrade",e),this.off("upgradeError",e),t()},n=()=>{this.once("upgrade",e),this.once("upgradeError",e)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():t()}):this.upgrading?n():t()),this}_onError(t){if(me.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),fe&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const t=ge.indexOf(this._offlineEventListener);-1!==t&&ge.splice(t,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,e),this.writeBuffer=[],this._prevBufferLen=0}}}me.protocol=4;class ye extends me{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let e=this.createTransport(t),n=!1;me.priorWebsocketSuccess=!1;const s=()=>{n||(e.send([{type:"ping",data:"probe"}]),e.once("packet",t=>{if(!n)if("pong"===t.type&&"probe"===t.data){if(this.upgrading=!0,this.emitReserved("upgrading",e),!e)return;me.priorWebsocketSuccess="websocket"===e.name,this.transport.pause(()=>{n||"closed"!==this.readyState&&(h(),this.setTransport(e),e.send([{type:"upgrade"}]),this.emitReserved("upgrade",e),e=null,this.upgrading=!1,this.flush())})}else{const t=new Error("probe error");t.transport=e.name,this.emitReserved("upgradeError",t)}}))};function i(){n||(n=!0,h(),e.close(),e=null)}const r=t=>{const n=new Error("probe error: "+t);n.transport=e.name,i(),this.emitReserved("upgradeError",n)};function o(){r("transport closed")}function a(){r("socket closed")}function c(t){e&&t.name!==e.name&&i()}const h=()=>{e.removeListener("open",s),e.removeListener("error",r),e.removeListener("close",o),this.off("close",a),this.off("upgrading",c)};e.once("open",s),e.once("error",r),e.once("close",o),this.once("close",a),this.once("upgrading",c),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==t?this.setTimeoutFn(()=>{n||e.open()},200):e.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const e=[];for(let n=0;n<t.length;n++)~this.transports.indexOf(t[n])&&e.push(t[n]);return e}}let ve=class extends ye{constructor(t,e={}){const n="object"==typeof t?t:e;(!n.transports||n.transports&&"string"==typeof n.transports[0])&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map(t=>ue[t]).filter(t=>!!t)),super(t,n)}};const be="function"==typeof ArrayBuffer,we=Object.prototype.toString,ke="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===we.call(Blob),Te="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===we.call(File);function Ce(t){return be&&(t instanceof ArrayBuffer||(t=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer)(t))||ke&&t instanceof Blob||Te&&t instanceof File}function Se(t,e){if(!t||"object"!=typeof t)return!1;if(Array.isArray(t)){for(let e=0,n=t.length;e<n;e++)if(Se(t[e]))return!0;return!1}if(Ce(t))return!0;if(t.toJSON&&"function"==typeof t.toJSON&&1===arguments.length)return Se(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&Se(t[n]))return!0;return!1}function Ee(t){const e=[],n=t.data,s=t;return s.data=Ae(n,e),s.attachments=e.length,{packet:s,buffers:e}}function Ae(t,e){if(!t)return t;if(Ce(t)){const n={_placeholder:!0,num:e.length};return e.push(t),n}if(Array.isArray(t)){const n=new Array(t.length);for(let s=0;s<t.length;s++)n[s]=Ae(t[s],e);return n}if("object"==typeof t&&!(t instanceof Date)){const n={};for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[s]=Ae(t[s],e));return n}return t}function Oe(t,e){return t.data=xe(t.data,e),delete t.attachments,t}function xe(t,e){if(!t)return t;if(t&&!0===t._placeholder){if("number"==typeof t.num&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]=xe(t[n],e);else if("object"==typeof t)for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=xe(t[n],e));return t}const Ne=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Re,Ie;(Ie=Re||(Re={}))[Ie.CONNECT=0]="CONNECT",Ie[Ie.DISCONNECT=1]="DISCONNECT",Ie[Ie.EVENT=2]="EVENT",Ie[Ie.ACK=3]="ACK",Ie[Ie.CONNECT_ERROR=4]="CONNECT_ERROR",Ie[Ie.BINARY_EVENT=5]="BINARY_EVENT",Ie[Ie.BINARY_ACK=6]="BINARY_ACK";class Be extends $t{constructor(t){super(),this.reviver=t}add(t){let e;if("string"==typeof t){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");e=this.decodeString(t);const n=e.type===Re.BINARY_EVENT;n||e.type===Re.BINARY_ACK?(e.type=n?Re.EVENT:Re.ACK,this.reconstructor=new De(e),0===e.attachments&&super.emitReserved("decoded",e)):super.emitReserved("decoded",e)}else{if(!Ce(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");e=this.reconstructor.takeBinaryData(t),e&&(this.reconstructor=null,super.emitReserved("decoded",e))}}decodeString(t){let e=0;const n={type:Number(t.charAt(0))};if(void 0===Re[n.type])throw new Error("unknown packet type "+n.type);if(n.type===Re.BINARY_EVENT||n.type===Re.BINARY_ACK){const s=e+1;for(;"-"!==t.charAt(++e)&&e!=t.length;);const i=t.substring(s,e);if(i!=Number(i)||"-"!==t.charAt(e))throw new Error("Illegal attachments");n.attachments=Number(i)}if("/"===t.charAt(e+1)){const s=e+1;for(;++e;){if(","===t.charAt(e))break;if(e===t.length)break}n.nsp=t.substring(s,e)}else n.nsp="/";const s=t.charAt(e+1);if(""!==s&&Number(s)==s){const s=e+1;for(;++e;){const n=t.charAt(e);if(null==n||Number(n)!=n){--e;break}if(e===t.length)break}n.id=Number(t.substring(s,e+1))}if(t.charAt(++e)){const s=this.tryParse(t.substr(e));if(!Be.isPayloadValid(n.type,s))throw new Error("invalid payload");n.data=s}return n}tryParse(t){try{return JSON.parse(t,this.reviver)}catch(e){return!1}}static isPayloadValid(t,e){switch(t){case Re.CONNECT:return Le(e);case Re.DISCONNECT:return void 0===e;case Re.CONNECT_ERROR:return"string"==typeof e||Le(e);case Re.EVENT:case Re.BINARY_EVENT:return Array.isArray(e)&&("number"==typeof e[0]||"string"==typeof e[0]&&-1===Ne.indexOf(e[0]));case Re.ACK:case Re.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class De{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const t=Oe(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function Le(t){return"[object Object]"===Object.prototype.toString.call(t)}const Pe=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Be,Encoder:class{constructor(t){this.replacer=t}encode(t){return t.type!==Re.EVENT&&t.type!==Re.ACK||!Se(t)?[this.encodeAsString(t)]:this.encodeAsBinary({type:t.type===Re.EVENT?Re.BINARY_EVENT:Re.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id})}encodeAsString(t){let e=""+t.type;return t.type!==Re.BINARY_EVENT&&t.type!==Re.BINARY_ACK||(e+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(e+=t.nsp+","),null!=t.id&&(e+=t.id),null!=t.data&&(e+=JSON.stringify(t.data,this.replacer)),e}encodeAsBinary(t){const e=Ee(t),n=this.encodeAsString(e.packet),s=e.buffers;return s.unshift(n),s}},get PacketType(){return Re}},Symbol.toStringTag,{value:"Module"}));function Ue(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const je=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Me extends $t{constructor(t,e,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=e,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Ue(t,"open",this.onopen.bind(this)),Ue(t,"packet",this.onpacket.bind(this)),Ue(t,"error",this.onerror.bind(this)),Ue(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...e){var n,s,i;if(je.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(e.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;const r={type:Re.EVENT,data:e,options:{}};if(r.options.compress=!1!==this.flags.compress,"function"==typeof e[e.length-1]){const t=this.ids++,n=e.pop();this._registerAckCallback(t,n),r.id=t}const o=null===(s=null===(n=this.io.engine)||void 0===n?void 0:n.transport)||void 0===s?void 0:s.writable,a=this.connected&&!(null===(i=this.io.engine)||void 0===i?void 0:i._hasPingExpired());return this.flags.volatile&&!o||(a?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(t,e){var n;const s=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===s)return void(this.acks[t]=e);const i=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let e=0;e<this.sendBuffer.length;e++)this.sendBuffer[e].id===t&&this.sendBuffer.splice(e,1);e.call(this,new Error("operation has timed out"))},s),r=(...t)=>{this.io.clearTimeoutFn(i),e.apply(this,t)};r.withError=!0,this.acks[t]=r}emitWithAck(t,...e){return new Promise((n,s)=>{const i=(t,e)=>t?s(t):n(e);i.withError=!0,e.push(i),this.emit(t,...e)})}_addToQueue(t){let e;"function"==typeof t[t.length-1]&&(e=t.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((t,...s)=>{this._queue[0];return null!==t?n.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(t)):(this._queue.shift(),e&&e(null,...s)),n.pending=!1,this._drainQueue()}),this._queue.push(n),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||0===this._queue.length)return;const e=this._queue[0];e.pending&&!t||(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){"function"==typeof this.auth?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Re.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,e),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(e=>String(e.id)===t)){const e=this.acks[t];delete this.acks[t],e.withError&&e.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Re.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Re.EVENT:case Re.BINARY_EVENT:this.onevent(t);break;case Re.ACK:case Re.BINARY_ACK:this.onack(t);break;case Re.DISCONNECT:this.ondisconnect();break;case Re.CONNECT_ERROR:this.destroy();const e=new Error(t.data.message);e.data=t.data.data,this.emitReserved("connect_error",e)}}onevent(t){const e=t.data||[];null!=t.id&&e.push(this.ack(t.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const e=this._anyListeners.slice();for(const n of e)n.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&"string"==typeof t[t.length-1]&&(this._lastOffset=t[t.length-1])}ack(t){const e=this;let n=!1;return function(...s){n||(n=!0,e.packet({type:Re.ACK,id:t,data:s}))}}onack(t){const e=this.acks[t.id];"function"==typeof e&&(delete this.acks[t.id],e.withError&&t.data.unshift(null),e.apply(this,t.data))}onconnect(t,e){this.id=t,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Re.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const e=this._anyListeners;for(let n=0;n<e.length;n++)if(t===e[n])return e.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const e=this._anyOutgoingListeners;for(let n=0;n<e.length;n++)if(t===e[n])return e.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const e=this._anyOutgoingListeners.slice();for(const n of e)n.apply(this,t.data)}}}function qe(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}qe.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=1&Math.floor(10*e)?t+n:t-n}return 0|Math.min(t,this.max)},qe.prototype.reset=function(){this.attempts=0},qe.prototype.setMin=function(t){this.ms=t},qe.prototype.setMax=function(t){this.max=t},qe.prototype.setJitter=function(t){this.jitter=t};class Fe extends $t{constructor(t,e){var n;super(),this.nsps={},this.subs=[],t&&"object"==typeof t&&(e=t,t=void 0),(e=e||{}).path=e.path||"/socket.io",this.opts=e,Yt(this,e),this.reconnection(!1!==e.reconnection),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=e.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new qe({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==e.timeout?2e4:e.timeout),this._readyState="closed",this.uri=t;const s=e.parser||Pe;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=!1!==e.autoConnect,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return void 0===t?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var e;return void 0===t?this._reconnectionDelay:(this._reconnectionDelay=t,null===(e=this.backoff)||void 0===e||e.setMin(t),this)}randomizationFactor(t){var e;return void 0===t?this._randomizationFactor:(this._randomizationFactor=t,null===(e=this.backoff)||void 0===e||e.setJitter(t),this)}reconnectionDelayMax(t){var e;return void 0===t?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,null===(e=this.backoff)||void 0===e||e.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new ve(this.uri,this.opts);const e=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const s=Ue(e,"open",function(){n.onopen(),t&&t()}),i=e=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",e),t?t(e):this.maybeReconnectOnOpen()},r=Ue(e,"error",i);if(!1!==this._timeout){const t=this._timeout,n=this.setTimeoutFn(()=>{s(),i(new Error("timeout")),e.close()},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(s),this.subs.push(r),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Ue(t,"ping",this.onping.bind(this)),Ue(t,"data",this.ondata.bind(this)),Ue(t,"error",this.onerror.bind(this)),Ue(t,"close",this.onclose.bind(this)),Ue(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(e){this.onclose("parse error",e)}}ondecoded(t){Ht(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,e){let n=this.nsps[t];return n?this._autoConnect&&!n.active&&n.connect():(n=new Me(this,t,e),this.nsps[t]=n),n}_destroy(t){const e=Object.keys(this.nsps);for(const n of e){if(this.nsps[n].active)return}this._close()}_packet(t){const e=this.encoder.encode(t);for(let n=0;n<e.length;n++)this.engine.write(e[n],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,e){var n;this.cleanup(),null===(n=this.engine)||void 0===n||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const e=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),t.skipReconnect||t.open(e=>{e?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",e)):t.onreconnect()}))},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const $e={};function He(t,e){"object"==typeof t&&(e=t,t=void 0);const n=function(t,e="",n){let s=t;n=n||"undefined"!=typeof location&&location,null==t&&(t=n.protocol+"//"+n.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?n.protocol+t:n.host+t),/^(https?|wss?):\/\//.test(t)||(t=void 0!==n?n.protocol+"//"+t:"https://"+t),s=_e(t)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const i=-1!==s.host.indexOf(":")?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+i+":"+s.port+e,s.href=s.protocol+"://"+i+(n&&n.port===s.port?"":":"+s.port),s}(t,(e=e||{}).path||"/socket.io"),s=n.source,i=n.id,r=n.path,o=$e[i]&&r in $e[i].nsps;let a;return e.forceNew||e["force new connection"]||!1===e.multiplex||o?a=new Fe(s,e):($e[i]||($e[i]=new Fe(s,e)),a=$e[i]),n.query&&!e.query&&(e.query=n.queryKey),a.socket(n.path,e)}Object.assign(He,{Manager:Fe,Socket:Me,io:He,connect:He});const Ve=new class{constructor(){this.socket=null,this.wsUrl="",this.pendingJoinConversationId=null,this.handlers={message:new Set,typing:new Set,disconnect:new Set}}configure(t){this.wsUrl=t}connect(){var t;if(null==(t=this.socket)?void 0:t.connected)return void this._joinStoredConversation();const e=vt.getSessionToken();e&&(this.socket=He(this.wsUrl,{transports:["websocket","polling"],timeout:2e4,reconnection:!0,reconnectionDelay:2e3,reconnectionDelayMax:1e4,reconnectionAttempts:10,auth:{token:e,type:"widget"}}),this.socket.on("connect",()=>{this._joinStoredConversation()}),this.socket.on("disconnect",t=>{this.handlers.disconnect.forEach(e=>e(t))}),this.socket.on("reconnect",()=>{this._joinStoredConversation()}),this.socket.on("joined_conversation",t=>{}),this.socket.on(mt,t=>{this._handleIncomingMessage(t)}),this.socket.on(_t,t=>{this._handleIncomingMessage(t)}),this.socket.on(ft,t=>{this.handlers.typing.forEach(e=>e(t))}),this.socket.on("typing",t=>{this.handlers.typing.forEach(e=>e({isTyping:(null==t?void 0:t.isTyping)??!1}))}),this.socket.on(gt,()=>{this.disconnect(),vt.clearAll()}),this.socket.on("error",t=>{}),this.socket.on("connect_error",t=>{}))}_joinStoredConversation(){const t=this.pendingJoinConversationId||vt.getConversationId();t&&this.joinConversation(t)}_handleIncomingMessage(t){var e;const n=null==(e=null==t?void 0:t.data)?void 0:e.messages;if(n&&"outgoing"===n.message_type){const t={id:n.id,content:n.content,content_type:n.content_type,sender_type:"user",message_type:n.message_type,attachments:n.attachments,sent_at:n.sent_at,quote_id:n.quote_id};this.handlers.message.forEach(e=>e(t))}}joinConversation(t){var e;this.pendingJoinConversationId=t,(null==(e=this.socket)?void 0:e.connected)&&this.socket.emit(yt,t)}leaveConversation(t){var e;(null==(e=this.socket)?void 0:e.connected)&&this.socket.emit("leave_receive_message",t)}emitTyping(t,e){var n;null==(n=this.socket)||n.emit("typing",{conversationId:t,isTyping:e})}disconnect(){this.socket&&(this.socket.removeAllListeners(),this.socket.disconnect(),this.socket=null)}get connected(){var t;return(null==(t=this.socket)?void 0:t.connected)??!1}onMessage(t){return this.handlers.message.add(t),()=>{this.handlers.message.delete(t)}}onTyping(t){return this.handlers.typing.add(t),()=>{this.handlers.typing.delete(t)}}onDisconnect(t){return this.handlers.disconnect.add(t),()=>{this.handlers.disconnect.delete(t)}}},ze=["😀","😃","😄","😁","😅","😂","🤣","😊","😇","🙂","😉","😌","😍","🥰","😘","😗","😙","😚","😋","😛","😝","😜","🤪","🤨","🧐","🤓","😎","🤩","🥳","😏","😒","😞","😔","😟","😕","🙁","☹️","😣","😖","😫","😩","🥺","😢","😭","😤","😠","😡","🤬","🤯","😳","👍","👎","👏","🙌","👐","🤲","🤝","🙏","❤️","💔"],We=({onSelect:t})=>q("div",{class:"cdk-emoji-picker",children:q("div",{class:"cdk-emoji-grid",children:ze.map(e=>q("button",{type:"button",class:"cdk-emoji-btn",onClick:n=>{n.preventDefault(),t(e)},children:e},e))})}),Ke=({widgetId:t,apiUrl:e,wsUrl:n})=>{var s;const[i,r]=et(!1),[o,a]=et(!1),[c,h]=et(null),[l,u]=et([]),[d,p]=et(""),[_,f]=et(!1),[g,m]=et(!1),[y,v]=et(0),[b,w]=et(!1),[k,T]=et(null),[C,S]=et(new Set),E=st(null),A=st(null),O=st(null),x=st(!1),N=st(null),R=st(null),I=null==c?void 0:c.settings,B="compact"===(null==(s=null==c?void 0:c.settings)?void 0:s.widget_bubble_type),D="/logo.svg",L=rt(t=>{const e=(t||"").trim().toLowerCase();return{mon:"monday",tue:"tuesday",tues:"tuesday",wed:"wednesday",thu:"thursday",thur:"thursday",thurs:"thursday",fri:"friday",sat:"saturday",sun:"sunday","thứ 2":"monday","thu 2":"monday","thứ 3":"tuesday","thu 3":"tuesday","thứ 4":"wednesday","thu 4":"wednesday","thứ 5":"thursday","thu 5":"thursday","thứ 6":"friday","thu 6":"friday","thứ 7":"saturday","thu 7":"saturday","chủ nhật":"sunday","chu nhat":"sunday"}[e]||e},[]);nt(()=>{if(x.current||!t)return;x.current=!0,bt.configure(e),Ve.configure(n);return(async()=>{var e;try{let n=vt.getVisitorId();n||(n=`visitor_${Math.random().toString(36).substring(2,15)}${Date.now().toString(36)}`,vt.setVisitorId(n));const s=await bt.initialize({widget_id:t,visitor_id:n,page_info:{url:window.location.href,title:document.title,referrer:document.referrer},browser_info:{userAgent:navigator.userAgent,language:navigator.language||"en",timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${screen.width}x${screen.height}`}});vt.setSessionToken(s.session_token),vt.setCompanyId(s.company_id),vt.setConversationId(s.conversation_id),h(s.widget_config),a(!0),(null==(e=s.widget_config.settings)?void 0:e.autoOpen)&&setTimeout(()=>r(!0),2e3),Ve.connect();try{const e=await bt.getMessages(t,s.conversation_id);u(e)}catch{}}catch(tn){}})(),()=>{Ve.disconnect()}},[t,e,n]),nt(()=>{if(!o)return;const t=Ve.onMessage(t=>{u(e=>[...e,t]),i||v(t=>t+1),m(!1),R.current&&(window.clearTimeout(R.current),R.current=null)}),e=Ve.onTyping(t=>{(null==t?void 0:t.isWidget)||(m(t.isTyping),R.current&&(window.clearTimeout(R.current),R.current=null),t.isTyping&&(R.current=window.setTimeout(()=>{m(!1),R.current=null},3e3)))});return()=>{t(),e()}},[o,i]),nt(()=>{var t;null==(t=A.current)||t.scrollIntoView({behavior:"smooth"})},[l,g]),nt(()=>{i&&setTimeout(()=>{var t;return null==(t=O.current)?void 0:t.focus()},300)},[i]);const P=rt(async()=>{var e,n,s;const i=d.trim();if(!i||_)return;f(!0),p("");const r=vt.getConversationId();r&&(N.current&&(clearTimeout(N.current),N.current=null),Ve.emitTyping(r,!1));const o=`temp_${Date.now()}`,a={id:o,content:i,sender_type:"contact",message_type:"incoming",sent_at:(new Date).toISOString()};u(t=>[...t,a]);if((()=>{if(!(null==I?void 0:I.enable_business_hours)||!(null==I?void 0:I.business_hours))return!1;const t=(()=>{const t=null==I?void 0:I.timezone;if(!t)return new Date;try{const e=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,weekday:"long"}).formatToParts(new Date),n=t=>{var n;return(null==(n=e.find(e=>e.type===t))?void 0:n.value)||""};return{day:n("weekday"),hours:parseInt(n("hour")),minutes:parseInt(n("minute"))}}catch{const t=new Date;return{day:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][t.getDay()],hours:t.getHours(),minutes:t.getMinutes()}}})(),e="object"==typeof t&&"day"in t?L(t.day):"",n=I.business_hours.find(t=>L(t.day)===e);if(!n||!n.enabled)return!0;const s=60*("object"==typeof t&&"hours"in t?t.hours:0)+("object"==typeof t&&"minutes"in t?t.minutes:0),[i,r]=n.startTime.split(":").map(Number),[o,a]=n.endTime.split(":").map(Number);return s<60*i+(r||0)||s>60*o+(a||0)})()){const t={id:`offline_${Date.now()}`,content:(null==I?void 0:I.offlineMessage)||"We're currently offline. Leave a message and we'll get back to you!",sender_type:"user",message_type:"outgoing",sent_at:(new Date).toISOString()};return u(e=>[...e,t]),void f(!1)}try{const r=vt.getConversationId()||"",c=vt.getVisitorId()||"",h=await bt.sendMessage({conversation_id:r,widget_id:t,visitor_id:c,sender_name:c,message:i,message_type:"text"}),l=(null==(e=h.data)?void 0:e.conversation_id)||(null==(s=null==(n=h.data)?void 0:n.conversation)?void 0:s.id);l&&(vt.setConversationId(l),Ve.joinConversation(l)),u(t=>t.map(t=>{var e,n,s,r;return t.id===o?{id:(null==(e=h.data)?void 0:e.id)||o,content:(null==(n=h.data)?void 0:n.content)||i,sender_type:"contact",message_type:"incoming",attachments:null==(s=h.data)?void 0:s.attachments,sent_at:(null==(r=h.data)?void 0:r.sent_at)||a.sent_at}:t}))}catch(tn){S(t=>new Set(t).add(o)),U("Gửi tin nhắn thất bại. Nhấn ⚠️ để thử lại.")}finally{f(!1),setTimeout(()=>{O.current&&O.current.focus()},0)}},[d,_,t,I]),U=rt(t=>{T(t),E.current&&clearTimeout(E.current),E.current=window.setTimeout(()=>{T(null),E.current=null},4e3)},[]),j=rt(async e=>{var n,s,i;const r=l.find(t=>t.id===e);if(r){S(t=>{const n=new Set(t);return n.delete(e),n});try{const o=vt.getConversationId()||"",a=vt.getVisitorId()||"",c=await bt.sendMessage({conversation_id:o,widget_id:t,visitor_id:a,sender_name:a,message:r.content,message_type:r.content_type||"text"}),h=(null==(n=c.data)?void 0:n.conversation_id)||(null==(i=null==(s=c.data)?void 0:s.conversation)?void 0:i.id);h&&(vt.setConversationId(h),Ve.joinConversation(h)),u(t=>t.map(t=>{var n,s,i,o;return t.id===e?{id:(null==(n=c.data)?void 0:n.id)||e,content:(null==(s=c.data)?void 0:s.content)||r.content,sender_type:"contact",message_type:"incoming",attachments:null==(i=c.data)?void 0:i.attachments,sent_at:(null==(o=c.data)?void 0:o.sent_at)||r.sent_at}:t}))}catch(tn){S(t=>new Set(t).add(e)),U("Thử lại thất bại. Kiểm tra kết nối mạng.")}}},[l,t,U]),M=rt(t=>{if(O.current){const e=O.current.selectionStart,n=O.current.selectionEnd,s=d,i=s.substring(0,e)+t+s.substring(n);p(i),setTimeout(()=>{if(O.current){O.current.focus();const n=e+t.length;O.current.setSelectionRange(n,n)}},0)}else p(e=>e+t)},[d]),F=rt(async e=>{var n,s,i;const r=e.target;if(!r.files||0===r.files.length)return;const o=r.files[0];if(r.value="",o.size>10485760)return void alert(`File too large (${(o.size/1024/1024).toFixed(1)}MB). Max allowed: 10MB.`);const a=`upload_${Date.now()}`,c=o.type.startsWith("image/"),h={id:a,content:c?"":`📎 Uploading ${o.name}...`,sender_type:"contact",message_type:"incoming",sent_at:(new Date).toISOString()};u(t=>[...t,h]);try{const e=await bt.uploadFile(o),r=vt.getConversationId()||"",l=vt.getVisitorId()||"",d=await bt.sendMessage({conversation_id:r,widget_id:t,visitor_id:l,sender_name:l,message:c?"":`📎 ${o.name}`,message_type:c?"image":"file",attachments:[e.url]}),p=(null==(n=d.data)?void 0:n.conversation_id)||(null==(i=null==(s=d.data)?void 0:s.conversation)?void 0:i.id);p&&(vt.setConversationId(p),Ve.joinConversation(p)),u(t=>t.map(t=>{var n,s,i;return t.id===a?{id:(null==(n=d.data)?void 0:n.id)||a,content:(null==(s=d.data)?void 0:s.content)||(c?"":`📎 ${o.name}`),sender_type:"contact",message_type:"incoming",attachments:[{id:a,name:o.name,size:o.size,type:o.type,url:e.url}],sent_at:(null==(i=d.data)?void 0:i.sent_at)||h.sent_at}:t}))}catch(tn){u(t=>t.filter(t=>t.id!==a)),alert(`Upload failed: ${tn.message}`)}finally{setTimeout(()=>{O.current&&O.current.focus()},0)}},[t]),$=rt(()=>{const t=null==I?void 0:I.timezone;if(!t)return new Date;try{const e=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,weekday:"long"}).formatToParts(new Date),n=t=>{var n;return(null==(n=e.find(e=>e.type===t))?void 0:n.value)||""};return{day:n("weekday"),hours:parseInt(n("hour")),minutes:parseInt(n("minute"))}}catch{const e=t.match(/UTC([+-])(\d{1,2})/i);if(e){const t="+"===e[1]?1:-1,n=parseInt(e[2]),s=new Date((new Date).getTime()+t*n*60*60*1e3);return{day:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][s.getUTCDay()],hours:s.getUTCHours(),minutes:s.getUTCMinutes()}}const n=new Date;return{day:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][n.getDay()],hours:n.getHours(),minutes:n.getMinutes()}}},[null==I?void 0:I.timezone]),H=it(()=>{if(!(null==I?void 0:I.enable_business_hours)||!(null==I?void 0:I.business_hours))return!0;const t=$(),e="object"==typeof t&&"day"in t?L(t.day):"",n=I.business_hours.find(t=>L(t.day)===e);if(!n||!n.enabled)return!1;const s=60*("object"==typeof t&&"hours"in t?t.hours:0)+("object"==typeof t&&"minutes"in t?t.minutes:0),[i,r]=n.startTime.split(":").map(Number),[o,a]=n.endTime.split(":").map(Number);return s>=60*i+(r||0)&&s<=60*o+(a||0)},[I,$,L]),V=it(()=>{var t;if(!(null==I?void 0:I.enable_business_hours)||!(null==I?void 0:I.business_hours))return null;const e=$(),n="object"==typeof e&&"day"in e?L(e.day):"",s=I.business_hours.find(t=>L(t.day)===n&&t.enabled),i=I.timezone||"";let r="";if(i)try{r=(null==(t=new Intl.DateTimeFormat("en-US",{timeZone:i,timeZoneName:"shortOffset"}).formatToParts(new Date).find(t=>"timeZoneName"===t.type))?void 0:t.value)||i}catch{r=i}return s?`Service hours: ${s.startTime}–${s.endTime}${r?` (${r})`:""}`:"Closed today"+(r?` (${r})`:"")},[I,$,L]),z=(null==I?void 0:I.position)||"bottom-right",W=t=>{try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}};return o?q("div",{class:`cdk-widget cdk-${z} ${B?"cdk-widget-compact":""}`,children:[q("div",{class:"cdk-panel "+(i?"cdk-panel-open":""),children:[q("div",{class:"cdk-header",children:[(null==c?void 0:c.website_url)&&q("img",{src:`https://www.google.com/s2/favicons?domain=${c.website_url}&sz=64`,alt:"Avatar",class:"cdk-header-avatar",onError:t=>t.currentTarget.style.display="none"}),q("div",{class:"cdk-header-info",children:[q("div",{class:"cdk-header-title",children:(null==c?void 0:c.name)||"Chat"}),q("div",{class:"cdk-header-subtitle "+(g?"cdk-subtitle-typing":""),children:g?"Agent is typing...":V||(null==I?void 0:I.subtitle)||"We typically reply within minutes"})]}),q("button",{class:"cdk-header-close",onClick:()=>r(!1),"aria-label":"Close",children:q("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor",children:q("path",{d:"M12 16.5a1 1 0 0 1-.7-.29l-6-6A1 1 0 0 1 6.7 8.79L12 14.09l5.3-5.3a1 1 0 1 1 1.41 1.42l-6 6A1 1 0 0 1 12 16.5z"})})})]}),q("div",{class:"cdk-messages",children:[0===l.length&&(H?null==I?void 0:I.welcomeMessage:(null==I?void 0:I.offlineMessage)||"We're currently offline. Leave a message and we'll get back to you!")&&q("div",{class:"cdk-msg cdk-msg-agent",children:q("div",{class:"cdk-msg-bubble cdk-msg-bubble-agent",children:H?null==I?void 0:I.welcomeMessage:(null==I?void 0:I.offlineMessage)||"We're currently offline. Leave a message and we'll get back to you!"})}),l.map(t=>{const e=C.has(t.id);return q("div",{class:`cdk-msg ${"contact"===t.sender_type?"cdk-msg-visitor":"cdk-msg-agent"} ${e?"cdk-msg-failed":""}`,children:[q("div",{class:`cdk-msg-bubble ${"contact"===t.sender_type?"cdk-msg-bubble-visitor":"cdk-msg-bubble-agent"} ${e?"cdk-msg-bubble-failed":""}`,children:[t.attachments&&t.attachments.length>0&&q("div",{class:"cdk-msg-attachments",children:t.attachments.map(t=>{var e;return q("a",(null==(e=t.type)?void 0:e.startsWith("image/"))||/\.(jpg|jpeg|png|gif|webp|svg)$/i.test(t.url||t.name)?{href:t.url,target:"_blank",rel:"noopener noreferrer",class:"cdk-attachment-img-link",children:q("img",{src:t.url,alt:t.name,class:"cdk-attachment-img",loading:"lazy"})}:{href:t.url,target:"_blank",rel:"noopener noreferrer",class:"cdk-attachment-file",children:[q("span",{class:"cdk-attachment-icon",children:"📎"}),q("span",{class:"cdk-attachment-name",children:t.name}),t.size&&q("span",{class:"cdk-attachment-size",children:["(",(t.size/1024).toFixed(0),"KB)"]})]})})}),t.content&&q("span",{children:t.content})]}),q("div",{class:"cdk-msg-meta",children:q("div",e?{class:"cdk-msg-error",children:[q("span",{class:"cdk-msg-error-text",children:"Gửi thất bại"}),q("button",{class:"cdk-msg-retry-btn",onClick:()=>j(t.id),title:"Thử lại",children:"⟳ Thử lại"}),q("button",{class:"cdk-msg-delete-btn",onClick:()=>{u(e=>e.filter(e=>e.id!==t.id)),S(e=>{const n=new Set(e);return n.delete(t.id),n})},title:"Xoá",children:"✕"})]}:{class:"cdk-msg-time",children:W(t.sent_at)})})]},t.id)}),g&&q("div",{class:"cdk-msg cdk-msg-agent",children:q("div",{class:"cdk-msg-bubble cdk-msg-bubble-agent cdk-typing",children:[q("span",{class:"cdk-dot"}),q("span",{class:"cdk-dot"}),q("span",{class:"cdk-dot"})]})}),q("div",{ref:A})]}),k&&q("div",{class:"cdk-toast cdk-toast-error",children:[q("span",{children:["⚠️ ",k]}),q("button",{class:"cdk-toast-close",onClick:()=>T(null),children:"✕"})]}),q("div",{class:"cdk-input-wrapper",children:[b&&q(We,{onSelect:M}),q("div",{class:"cdk-input-area",children:[q("div",{class:"cdk-input-box",children:[q("textarea",{ref:O,class:"cdk-input",placeholder:(null==I?void 0:I.placeholderText)||"Type a message...",value:d,onInput:t=>{p(t.target.value);const e=vt.getConversationId();e&&(N.current?clearTimeout(N.current):Ve.emitTyping(e,!0),N.current=window.setTimeout(()=>{Ve.emitTyping(e,!1),N.current=null},2500))},onKeyDown:t=>{"Enter"!==t.key||t.shiftKey||(t.preventDefault(),P())},rows:1,disabled:_}),q("button",{type:"button",class:"cdk-action-btn",onClick:()=>w(!b),title:"Add emoji",children:q("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[q("circle",{cx:"12",cy:"12",r:"10"}),q("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),q("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),q("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})}),q("label",{class:"cdk-action-btn",title:"Attach file",children:[q("input",{type:"file",style:{display:"none"},onChange:F}),q("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:q("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})]})]}),q("button",{class:"cdk-send-btn",onClick:P,disabled:!d.trim()||_,"aria-label":"Send",children:q("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:q("path",{d:"M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"})})})]})]})]}),!(i&&B)&&q("button",{class:`cdk-toggle ${!i&&B?"cdk-toggle-compact":""} ${!i&&B&&z.includes("left")?"cdk-compact-left":""}`,onClick:()=>{r(t=>!t),i||(v(0),w(!1))},"aria-label":"Toggle chat",children:[!B&&i?q("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.25","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:q("path",{d:"M6 10l6 6 6-6"})}):B?q("div",{class:"cdk-compact-inner",children:[q("img",{src:D,alt:"","aria-hidden":"true",class:"cdk-compact-logo"}),q("span",{class:"cdk-compact-title",children:"Chat with us"})]}):q("img",{src:D,alt:"","aria-hidden":"true",class:"cdk-toggle-logo"}),y>0&&!i&&q("span",{class:"cdk-badge",children:y>9?"9+":y})]})]}):null},Ye=new Map,Je="https://api.chatdakenh.vn/api/v1",Xe="https://ws.chatdakenh.vn";function Qe(t){const{widgetId:e,apiUrl:n=Je,wsUrl:s=Xe}=t;if(Ye.has(e))return;const i=document.createElement("div");i.id=`cdk-widget-${e}`,i.setAttribute("data-cdk-widget","true"),document.body.appendChild(i),j(q(Ke,{widgetId:e,apiUrl:n,wsUrl:s}),i),Ye.set(e,{container:i,unmount:()=>{j(null,i),i.remove()}})}function Ze(){document.querySelectorAll("script[data-widget-id]").forEach(t=>{const e=t.getAttribute("data-widget-id"),n=t.getAttribute("data-api-url")||Je,s=t.getAttribute("data-ws-url")||Xe;e&&Qe({widgetId:e,apiUrl:n,wsUrl:s})})}const Ge={init:Qe,destroy:function(t){if(t){const e=Ye.get(t);e&&(e.unmount(),Ye.delete(t))}else Ye.forEach(t=>t.unmount()),Ye.clear()},version:"1.0.0"};return"undefined"!=typeof window&&(window.ChatDaKenh=Ge,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",Ze):Ze()),Ge}();
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@chatdakenh/widget",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "ChatDaKenh embeddable chat widget for websites and applications.",
|
|
5
|
+
"author": "ChatDaKenh Team <support@chatdakenh.vn>",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dinhsan2000/chatdakenh-widget"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "dist/widget.js",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"dev": "vite",
|
|
18
|
+
"build": "vite build",
|
|
19
|
+
"test": "vite build && npx -y serve . -l 4200 --cors",
|
|
20
|
+
"preview": "vite preview"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"preact": "^10.25.4",
|
|
24
|
+
"socket.io-client": "^4.8.1"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@preact/preset-vite": "^2.9.4",
|
|
28
|
+
"terser": "^5.46.1",
|
|
29
|
+
"typescript": "^5.7.3",
|
|
30
|
+
"vite": "^6.2.0"
|
|
31
|
+
}
|
|
32
|
+
}
|