@websolutespa/bom-llm 0.0.5 → 0.0.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @websolutespa/bom-llm
2
2
 
3
+ ## 0.0.7
4
+
5
+ ### Patch Changes
6
+
7
+ - Modified: components dangerouslySetInnerHTML, styles, useLlm status opened with threadId
8
+
9
+ ## 0.0.6
10
+
11
+ ### Patch Changes
12
+
13
+ - Fixing: threads
14
+ - Modified: MessageService, FormRecap, useLlm
15
+
3
16
  ## 0.0.5
4
17
 
5
18
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ type LlmOptions = {
10
10
  market?: string;
11
11
  test?: boolean;
12
12
  threadId?: string;
13
+ opened?: boolean;
13
14
  };
14
15
 
15
16
  declare function bomLlm(props: LlmOptions): void;
@@ -1415,6 +1415,9 @@
1415
1415
  .-llm-scrolled .llm .llm__header-logo-full {
1416
1416
  display: none;
1417
1417
  }
1418
+ .llm .llm__header-logo-full > img {
1419
+ object-fit: contain;
1420
+ }
1418
1421
  .llm .llm__header-logo-mini {
1419
1422
  position: relative;
1420
1423
  overflow: hidden;
@@ -1444,6 +1447,9 @@
1444
1447
  .-llm-scrolled .llm .llm__header-logo-mini {
1445
1448
  display: block;
1446
1449
  }
1450
+ .llm .llm__header-logo-mini > img {
1451
+ object-fit: contain;
1452
+ }
1447
1453
  .llm .llm__header-back {
1448
1454
  color: white;
1449
1455
  text-transform: uppercase;
@@ -1765,7 +1771,12 @@
1765
1771
  }
1766
1772
  .llm .llm__message--assistant .llm__inner--string:not(:first-child) .llm__text .llm__text-body ol,
1767
1773
  .llm .llm__message--assistant .llm__inner--string:not(:first-child) .llm__text .llm__text-body ul {
1768
- margin-left: 0.9em;
1774
+ display: flex;
1775
+ flex-direction: column;
1776
+ gap: clamp(24px,
1777
+ calc(24px + (100vw - 375px) / (1920 - 375) * (8)),
1778
+ 32px);
1779
+ margin-left: 1em;
1769
1780
  }
1770
1781
  .llm .llm__message--assistant .llm__inner--string:not(:first-child) .llm__text .llm__text-body ul {
1771
1782
  list-style: disc;
package/dist/umd/index.js CHANGED
@@ -22873,8 +22873,18 @@
22873
22873
  let decodedChunks = [];
22874
22874
  try {
22875
22875
  // const replacedText = decodedText.replace(/(^\[)|(,$)|(\]$)/g, '');
22876
- const replacedText = decodedText.replace(/(,$)/g, '');
22877
- // console.log('textToChunks', `[${replacedText}]`);
22876
+ let replacedText = decodedText;
22877
+ // replacedText = replacedText.replace(/(^,")/, '",');
22878
+ replacedText = replacedText.replace(/(,$)/, '');
22879
+ // replacedText = replacedText.replace(/}\s{/g, '},{');
22880
+ /*
22881
+ replacedText = replacedText.split(',').map(x => {
22882
+ return x.replace(/^"([^{]*)"$/m, (m, g) => {
22883
+ return '"' + g.replace('"', '\\"') + '"';
22884
+ });
22885
+ }).join(',');
22886
+ */
22887
+ // console.log('textToChunks.replacedText', `[${replacedText}]`);
22878
22888
  const chunks = JSON.parse(`[${replacedText}]`);
22879
22889
  // console.log('chunks', chunks);
22880
22890
  /*
@@ -22959,19 +22969,24 @@
22959
22969
  chunks.push(x);
22960
22970
  }
22961
22971
  } else if (typeof x === 'string') {
22962
- if (lastMessage && lastMessage.type === 'string') {
22963
- const content = lastMessage.content + x;
22964
- const contents = content.split('\n');
22965
- contents.forEach((content, i) => {
22966
- if (i === 0) {
22967
- lastMessage.content = content;
22968
- } else if (content.length > 0 || i === contents.length - 1) {
22969
- chunks.push({
22970
- type: 'string',
22971
- content
22972
- });
22973
- }
22974
- });
22972
+ // console.warn('chunksToChunkItems typeof string');
22973
+ if (lastMessage && lastMessage.type === 'string' && !lastMessage.content.includes('\n')) {
22974
+ if (x.includes('\n')) {
22975
+ const contents = x.split('\n');
22976
+ contents.forEach((content, i) => {
22977
+ const lastChar = contents.length > i + 1 ? '\n' : '';
22978
+ if (i === 0) {
22979
+ lastMessage.content += content + lastChar;
22980
+ } else if (content.length > 0) {
22981
+ chunks.push({
22982
+ type: 'string',
22983
+ content: content + lastChar
22984
+ });
22985
+ }
22986
+ });
22987
+ } else {
22988
+ lastMessage.content += x;
22989
+ }
22975
22990
  } else {
22976
22991
  chunks.push({
22977
22992
  type: 'string',
@@ -22983,19 +22998,39 @@
22983
22998
  return chunks;
22984
22999
  }
22985
23000
  function decodeMessages(messages) {
22986
- return messages.map(x => ({
22987
- ...x,
22988
- chunks: chunksToChunkItems(textToChunks(x.content.split('\r\n').map(x => {
22989
- if (['{', '['].includes(x.substring(0, 1))) {
22990
- // console.log('obj', x);
22991
- return x;
22992
- } else {
22993
- // console.log('str', `"${x.replace(/\n/g, '\\n')}"`);
22994
- return `"${x.replace(/\n/g, '\\n')}"`;
22995
- }
22996
- }).join(',')))
22997
- }));
23001
+ return messages.map(x => {
23002
+ if (x.role === 'user') {
23003
+ return {
23004
+ ...x,
23005
+ chunks: [{
23006
+ type: 'string',
23007
+ content: x.content
23008
+ }]
23009
+ };
23010
+ }
23011
+ return {
23012
+ ...x,
23013
+ chunks: chunksToChunkItems(textToChunks(x.content))
23014
+ /*
23015
+ chunks: chunksToChunkItems(textToChunks(
23016
+ x.content
23017
+ .split('\r\n')
23018
+ .map(x => {
23019
+ if (['{', '['].includes(x.substring(0, 1))) {
23020
+ // console.log('obj', x);
23021
+ return x;
23022
+ } else {
23023
+ // console.log('str', `"${x.replace(/\n/g, '\\n')}"`);
23024
+ return `"${x.replace(/\n/g, '\\n')}"`;
23025
+ }
23026
+ })
23027
+ .join(',')
23028
+ )),
23029
+ */
23030
+ };
23031
+ });
22998
23032
  }
23033
+
22999
23034
  function shouldAddFormRequest(messages) {
23000
23035
  const hasFormRequest = messages.find(x => x.chunks.find(x => x.type === 'formRequest') !== undefined);
23001
23036
  const importantMessages = messages.filter(x => x.chunks.find(x => ['event', 'eventItem', 'eventGroup', 'poi', 'poiItem', 'poiGroup', 'tripadvisor', 'tripadvisorItem', 'tripadvisorGroup'].includes(x.type)) !== undefined);
@@ -23745,26 +23780,24 @@
23745
23780
  appKey,
23746
23781
  apiKey,
23747
23782
  threadId,
23783
+ opened,
23748
23784
  decorateUrl,
23749
23785
  endpoint,
23750
23786
  test,
23751
23787
  storage,
23752
23788
  label
23753
23789
  } = _ref;
23754
- /*
23755
- endpoint = endpoint || 'http://localhost:4000/bowl';
23756
- test = false;
23757
- */
23758
-
23759
23790
  const props = {
23760
23791
  hydrated: false,
23761
23792
  messages: [],
23762
23793
  prompt: '',
23763
23794
  locale: 'en',
23764
23795
  streaming: false,
23765
- opened: false,
23796
+ opened: opened != null ? opened : threadId != null ? true : false,
23766
23797
  hidden: false,
23767
23798
  fixed: false,
23799
+ idle: true,
23800
+ direction: 0,
23768
23801
  speakEnabled: false
23769
23802
  };
23770
23803
  let messageService = undefined;
@@ -23783,35 +23816,49 @@
23783
23816
  const baseUrl = `${origin}/api/llm`;
23784
23817
  return {
23785
23818
  get: async pathname => {
23786
- const response = await fetch(`${baseUrl}${pathname}${pathname.indexOf('?') !== -1 ? '&' : '?'}locale=${options.locale}`, {
23787
- method: 'GET',
23788
- headers: {
23789
- 'Content-Type': 'application/json'
23819
+ const url = `${baseUrl}${pathname}${pathname.indexOf('?') !== -1 ? '&' : '?'}locale=${options.locale}`;
23820
+ try {
23821
+ const response = await fetch(url, {
23822
+ method: 'GET',
23823
+ headers: {
23824
+ 'Content-Type': 'application/json'
23825
+ }
23826
+ });
23827
+ if (response.ok) {
23828
+ const data = await response.json();
23829
+ return data;
23830
+ } else {
23831
+ console.error('useLlm.api.get', url, response);
23832
+ return undefined;
23790
23833
  }
23791
- });
23792
- if (response.ok) {
23793
- const data = await response.json();
23794
- return data;
23795
- } else {
23796
- throw response;
23834
+ } catch (error) {
23835
+ console.error('useLlm.api.get', url, error);
23836
+ return undefined;
23797
23837
  }
23798
23838
  },
23799
23839
  post: async (pathname, payload) => {
23800
- const response = await fetch(`${baseUrl}${pathname}${pathname.indexOf('?') !== -1 ? '&' : '?'}locale=${options.locale}`, {
23801
- method: 'POST',
23802
- body: JSON.stringify({
23803
- ...options,
23804
- ...payload
23805
- }),
23806
- headers: {
23807
- 'Content-Type': 'application/json'
23840
+ const url = `${baseUrl}${pathname}${pathname.indexOf('?') !== -1 ? '&' : '?'}locale=${options.locale}`;
23841
+ try {
23842
+ const response = await fetch(url, {
23843
+ method: 'POST',
23844
+ body: JSON.stringify({
23845
+ ...options,
23846
+ ...payload
23847
+ }),
23848
+ headers: {
23849
+ 'Content-Type': 'application/json'
23850
+ }
23851
+ });
23852
+ if (response.ok) {
23853
+ const data = await response.json();
23854
+ return data;
23855
+ } else {
23856
+ console.error('useLlm.api.post', response, url);
23857
+ return undefined;
23808
23858
  }
23809
- });
23810
- if (response.ok) {
23811
- const data = await response.json();
23812
- return data;
23813
- } else {
23814
- throw response;
23859
+ } catch (error) {
23860
+ console.error('useLlm.api.post', error, url);
23861
+ return undefined;
23815
23862
  }
23816
23863
  }
23817
23864
  };
@@ -23834,21 +23881,19 @@
23834
23881
  },
23835
23882
  init: async locale => {
23836
23883
  const fetchApp = async () => {
23837
- try {
23838
- const api = getApi({
23839
- locale,
23840
- appKey,
23841
- apiKey,
23842
- threadId
23843
- });
23844
- const app = await api.post('/info');
23845
- return app;
23846
- } catch (error) {
23847
- console.log('useLlm.init.error', error);
23848
- throw error;
23849
- }
23884
+ const api = getApi({
23885
+ locale,
23886
+ appKey,
23887
+ apiKey,
23888
+ threadId
23889
+ });
23890
+ const app = await api.post('/info');
23891
+ return app;
23850
23892
  };
23851
23893
  const app = await fetchApp();
23894
+ if (!app) {
23895
+ return;
23896
+ }
23852
23897
  const state = get();
23853
23898
  speech.lang = locale;
23854
23899
  speech.enabled = state.speakEnabled;
@@ -23868,6 +23913,43 @@
23868
23913
  locale,
23869
23914
  ...thread
23870
23915
  }));
23916
+ // handle idle times
23917
+ const setIdleTimeout = () => {
23918
+ return setTimeout(() => {
23919
+ set(() => ({
23920
+ idle: true
23921
+ }));
23922
+ }, 6000);
23923
+ };
23924
+ const handleIdleTimes = () => {
23925
+ let to = setIdleTimeout();
23926
+ let lastScrollTop = 0;
23927
+ window.addEventListener('scroll', () => {
23928
+ const st = window.scrollY || document.documentElement.scrollTop;
23929
+ let direction = 0;
23930
+ if (st > lastScrollTop) {
23931
+ direction = 1;
23932
+ } else if (st < lastScrollTop) {
23933
+ direction = -1;
23934
+ }
23935
+ lastScrollTop = st <= 0 ? 0 : st;
23936
+ if (direction === 1) {
23937
+ if (to) {
23938
+ clearTimeout(to);
23939
+ }
23940
+ set(() => ({
23941
+ idle: false
23942
+ }));
23943
+ to = setIdleTimeout();
23944
+ }
23945
+ });
23946
+ };
23947
+ setTimeout(() => {
23948
+ set(() => ({
23949
+ idle: false
23950
+ }));
23951
+ handleIdleTimes();
23952
+ }, 2000);
23871
23953
  },
23872
23954
  send: async (prompt, onChunk, onEnd) => {
23873
23955
  if (test) {
@@ -23918,7 +24000,7 @@
23918
24000
  await messageService.sendMessage(request,
23919
24001
  // onMessage
23920
24002
  response => {
23921
- // console.log('response.chunks', response.chunks);
24003
+ // console.log('messageService.sendMessage.onMessage', response.chunks);
23922
24004
  set(state => ({
23923
24005
  chunks: response.chunks
23924
24006
  }));
@@ -23929,7 +24011,7 @@
23929
24011
  },
23930
24012
  // onEnd
23931
24013
  response => {
23932
- // console.log('response.chunks', response.chunks);
24014
+ // console.log('messageService.sendMessage.onEnd', response.chunks);
23933
24015
  const chunks = [...response.chunks];
23934
24016
  const assistantMessage = {
23935
24017
  chunks,
@@ -23942,17 +24024,22 @@
23942
24024
  type: 'formRequest'
23943
24025
  });
23944
24026
  }
23945
- assistantMessage.content = chunks.filter(x => !['info', 'end', 'formRequest', 'formRecap', 'formRecapSuccess', 'formRecapError'].includes(x.type)).map(x => {
23946
- let text = '';
23947
- switch (x.type) {
23948
- case 'string':
23949
- text += x.content;
23950
- break;
23951
- default:
23952
- text += JSON.stringify(x);
24027
+ // filtering history
24028
+ const validChunks = chunks.filter(x => !['info', 'end', 'formRequest', 'formRecap', 'formRecapSuccess', 'formRecapError'].includes(x.type));
24029
+ const parsedChunks = [];
24030
+ validChunks.reduce((p, c) => {
24031
+ const firstChunk = p.length > 1 && p[p.length - 2];
24032
+ const secondChunk = p.length > 1 && p[p.length - 1];
24033
+ if (firstChunk && secondChunk && c.type === 'string' && firstChunk.type === 'string' && secondChunk.type === 'string') {
24034
+ secondChunk.content += c.content;
24035
+ } else {
24036
+ p.push({
24037
+ ...c
24038
+ });
23953
24039
  }
23954
- return text;
23955
- }).join('\r\n');
24040
+ return p;
24041
+ }, parsedChunks);
24042
+ assistantMessage.content = parsedChunks.map(x => JSON.stringify(x)).join(',') + ',';
23956
24043
  set(state => ({
23957
24044
  chunks: undefined,
23958
24045
  messages,
@@ -24029,7 +24116,9 @@
24029
24116
  }));
24030
24117
  },
24031
24118
  formRecap: error => {
24032
- console.log('useLlm.formRecap', error);
24119
+ if (error) {
24120
+ console.warn('useLlm.formRecap', error);
24121
+ }
24033
24122
  const messages = [];
24034
24123
  const assistantMessage = {
24035
24124
  chunks: [{
@@ -24074,10 +24163,14 @@
24074
24163
  const scrolled = targetScroll > 100;
24075
24164
  const fixed = direction == -1 && scrolled && !autoScroll;
24076
24165
  const hidden = autoScroll || direction == 1 && scrolled;
24077
- set(state => ({
24078
- hidden,
24079
- fixed
24080
- }));
24166
+ const state = get();
24167
+ if (state.hidden !== hidden || state.fixed !== fixed || state.direction !== direction) {
24168
+ set(state => ({
24169
+ hidden,
24170
+ fixed,
24171
+ direction
24172
+ }));
24173
+ }
24081
24174
  });
24082
24175
  }
24083
24176
  }
@@ -24106,16 +24199,20 @@
24106
24199
  */
24107
24200
  currentState.hydrated = true;
24108
24201
  return currentState;
24109
- }
24202
+ },
24203
+ partialize: state => Object.fromEntries(Object.entries(state).filter(_ref2 => {
24204
+ let [key] = _ref2;
24205
+ return ['app', 'locale', 'speakEnabled'].includes(key);
24206
+ }))
24110
24207
  }));
24111
24208
  return useStore;
24112
24209
  };
24113
24210
  const LlmContext = /*#__PURE__*/reactExports.createContext(null);
24114
- function LlmProvider(_ref2) {
24211
+ function LlmProvider(_ref3) {
24115
24212
  let {
24116
24213
  children,
24117
24214
  ...props
24118
- } = _ref2;
24215
+ } = _ref3;
24119
24216
  const label = useLabel();
24120
24217
  const storeRef = reactExports.useRef();
24121
24218
  if (!storeRef.current) {
@@ -25558,13 +25655,17 @@ void main(void) {
25558
25655
  children: label('llm.eventPretitle')
25559
25656
  }), props.title && /*#__PURE__*/jsxRuntimeExports.jsx("div", {
25560
25657
  className: "llm__event-title",
25561
- children: props.title
25658
+ dangerouslySetInnerHTML: {
25659
+ __html: props.title
25660
+ }
25562
25661
  }), props.abstract && /*#__PURE__*/jsxRuntimeExports.jsx("div", {
25563
25662
  className: "llm__event-body",
25564
- children: props.abstract
25663
+ dangerouslySetInnerHTML: {
25664
+ __html: props.abstract
25665
+ }
25565
25666
  }), props.place && /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
25566
25667
  className: "llm__event-location",
25567
- children: [/*#__PURE__*/jsxRuntimeExports.jsx(IconLlmPin, {}), props.place]
25668
+ children: [/*#__PURE__*/jsxRuntimeExports.jsx(IconLlmPin, {}), " ", props.place]
25568
25669
  }), /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
25569
25670
  className: "llm__event-ctas",
25570
25671
  children: [/*#__PURE__*/jsxRuntimeExports.jsx(Cta, {
@@ -25654,6 +25755,7 @@ void main(void) {
25654
25755
 
25655
25756
  const FormRecap = () => {
25656
25757
  const label = useLabel();
25758
+ const app = useLlm(state => state.app);
25657
25759
  const threadId = useLlm(state => state.threadId);
25658
25760
  const {
25659
25761
  formRecap,
@@ -25670,12 +25772,19 @@ void main(void) {
25670
25772
  data.threadId = threadId;
25671
25773
  const payload = {
25672
25774
  ...data,
25673
- html: getEmailHtml(data)
25775
+ html: getEmailHtml(data, app)
25674
25776
  };
25675
25777
  const api = getApi();
25676
25778
  const response = await api.post('/summary', payload);
25677
- console.warn('FormRecap.onSubmit.success', response, payload);
25678
- formRecap();
25779
+ if (response) {
25780
+ console.warn('FormRecap.onSubmit.success', response, payload);
25781
+ formRecap();
25782
+ } else {
25783
+ console.warn('FormRecap.onSubmit.error');
25784
+ formRecap({
25785
+ message: 'unknown error'
25786
+ });
25787
+ }
25679
25788
  } catch (error) {
25680
25789
  console.warn('FormRecap.onSubmit.error', error);
25681
25790
  formRecap(error);
@@ -25731,12 +25840,13 @@ void main(void) {
25731
25840
  })
25732
25841
  });
25733
25842
  };
25734
- function getEmailHtml(data) {
25843
+ function getEmailHtml(data, app) {
25735
25844
  const firstName = data.fullName ? data.fullName.split(' ')[0] : '';
25845
+ const name = app?.contents?.shortWelcomeText || 'PlatformAI';
25736
25846
  const title = `Ciao ${firstName}`;
25737
25847
  const paragraphs = `<p>${['Ecco il tuo promemoria,', 'per qualunque altra cosa sai dove potermi trovare, sarò sempre lieto di parlare con te. 👋'].join('</p><p>')}</p>`;
25738
25848
  const colorAccent = '#00aeff';
25739
- const threadUrl = window.location.href + `${window.location.search ? '&' : '?'}threadId=${data.threadId}`;
25849
+ const threadUrl = window.location.href + `${window.location.search ? '&' : '?'}llmThreadId=${data.threadId}`;
25740
25850
  return `
25741
25851
  <!doctype html>
25742
25852
  <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
@@ -25834,7 +25944,7 @@ void main(void) {
25834
25944
  <tbody>
25835
25945
  <tr>
25836
25946
  <td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
25837
- <div style="font-family:Inter;font-size:20px;font-weight:600;line-height:24px;text-align:left;color:#3b3b3b;">platform@websolute.ai</div>
25947
+ <div style="font-family:Inter;font-size:20px;font-weight:600;line-height:24px;text-align:left;color:#3b3b3b;">${name}</div>
25838
25948
  </td>
25839
25949
  </tr>
25840
25950
  <tr>
@@ -28312,10 +28422,14 @@ void main(void) {
28312
28422
  className: "llm__poi-content",
28313
28423
  children: [props.title && /*#__PURE__*/jsxRuntimeExports.jsx("div", {
28314
28424
  className: "llm__poi-title",
28315
- children: props.title
28425
+ dangerouslySetInnerHTML: {
28426
+ __html: props.title
28427
+ }
28316
28428
  }), props.abstract && /*#__PURE__*/jsxRuntimeExports.jsx("div", {
28317
28429
  className: "llm__poi-body",
28318
- children: props.abstract
28430
+ dangerouslySetInnerHTML: {
28431
+ __html: props.abstract
28432
+ }
28319
28433
  }), (props.time || props.place) && /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
28320
28434
  className: "llm__poi-tags",
28321
28435
  children: [props.time && /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
@@ -28397,7 +28511,7 @@ void main(void) {
28397
28511
  })
28398
28512
  }), props.address && /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
28399
28513
  className: "llm__tripadv-location",
28400
- children: [/*#__PURE__*/jsxRuntimeExports.jsx(IconLlmPin, {}), props.address]
28514
+ children: [/*#__PURE__*/jsxRuntimeExports.jsx(IconLlmPin, {}), " ", props.address]
28401
28515
  }), /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
28402
28516
  className: "llm__tripadv-ctas",
28403
28517
  children: [props.book && /*#__PURE__*/jsxRuntimeExports.jsx(Cta, {
@@ -28678,8 +28792,17 @@ void main(void) {
28678
28792
  const app = useLlm(state => state.app);
28679
28793
  const label = useLabel();
28680
28794
  return /*#__PURE__*/jsxRuntimeExports.jsxs(motion.div, {
28795
+ initial: {
28796
+ y: '200%',
28797
+ opacity: 0
28798
+ },
28799
+ animate: {
28800
+ y: 0,
28801
+ opacity: 1
28802
+ },
28681
28803
  exit: {
28682
- y: '200%'
28804
+ y: '200%',
28805
+ opacity: 0
28683
28806
  },
28684
28807
  transition: {
28685
28808
  duration: .4
@@ -28722,6 +28845,7 @@ void main(void) {
28722
28845
  init
28723
28846
  } = useLlm(state => state.actions);
28724
28847
  const app = useLlm(state => state.app);
28848
+ const idle = useLlm(state => state.idle);
28725
28849
  const opened = useLlm(state => state.opened);
28726
28850
  reactExports.useEffect(() => {
28727
28851
  init(locale);
@@ -28735,14 +28859,14 @@ void main(void) {
28735
28859
  });
28736
28860
  if (mounted) {
28737
28861
  return /*#__PURE__*/jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {
28738
- children: app && /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
28862
+ children: app && /*#__PURE__*/jsxRuntimeExports.jsx("div", {
28739
28863
  className: classNames,
28740
28864
  ...props,
28741
- children: [/*#__PURE__*/jsxRuntimeExports.jsx(AnimatePresence, {
28742
- children: !opened && /*#__PURE__*/jsxRuntimeExports.jsx(Trigger, {})
28743
- }), /*#__PURE__*/jsxRuntimeExports.jsx(AnimatePresence, {
28744
- children: opened && /*#__PURE__*/jsxRuntimeExports.jsx(Main, {})
28745
- })]
28865
+ children: /*#__PURE__*/jsxRuntimeExports.jsxs(AnimatePresence, {
28866
+ mode: "wait",
28867
+ initial: false,
28868
+ children: [!opened && !idle && /*#__PURE__*/jsxRuntimeExports.jsx(Trigger, {}), opened && /*#__PURE__*/jsxRuntimeExports.jsx(Main, {})]
28869
+ })
28746
28870
  })
28747
28871
  });
28748
28872
  } else {