@bcrumbs.net/bc-chat 1.0.86 → 1.0.87

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/build/index.d.ts CHANGED
@@ -132,6 +132,10 @@ interface AutoCompleteControls {
132
132
  onInputChange?: (text: string) => void;
133
133
  /** Callback to mutate the auto-complete suggestion. Called with updated suggestion or null to reset */
134
134
  onAutoCompleteMutate?: (suggestion: string | null) => void;
135
+ /** When set, replaces the entire composer draft (e.g. enhance). Parent clears after apply. */
136
+ autoCompleteReplaceDraft?: string;
137
+ /** Bumped when replace draft is applied so the same text can be applied again. */
138
+ autoCompleteReplaceDraftKey?: number;
135
139
  }
136
140
 
137
141
  interface ChatProps extends AutoCompleteControls {
@@ -170,6 +174,6 @@ interface ChatProps extends AutoCompleteControls {
170
174
  /** Called when user clicks "Add Contact" on a contact message card */
171
175
  onContactAddContact?: (contact: ContactMessagePayload) => void;
172
176
  }
173
- declare const Chat: ({ config, messages, sendMessage, debug, minimize, onReachingUp, agentsIdsAvatarsMap, actionChips, noteMode, onNoteSend, onCloseNoteMode, searchPattern, notePlaceholder, searchMatchNo, onSearchMatchCount, onMessageReply, replyMessageTitle, replyMessageContent, onCancelReplyMessage, errorMessage, autoCompleteEnabled, autoCompleteSuggestion, onInputChange, onAutoCompleteMutate, onContactMessage, onContactAddContact, }: ChatProps) => react_jsx_runtime.JSX.Element;
177
+ declare const Chat: ({ config, messages, sendMessage, debug, minimize, onReachingUp, agentsIdsAvatarsMap, actionChips, noteMode, onNoteSend, onCloseNoteMode, searchPattern, notePlaceholder, searchMatchNo, onSearchMatchCount, onMessageReply, replyMessageTitle, replyMessageContent, onCancelReplyMessage, errorMessage, autoCompleteEnabled, autoCompleteSuggestion, onInputChange, onAutoCompleteMutate, autoCompleteReplaceDraft, autoCompleteReplaceDraftKey, onContactMessage, onContactAddContact, }: ChatProps) => react_jsx_runtime.JSX.Element;
174
178
 
175
179
  export { Chat as BCChat };
package/build/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{useMemo as o,useCallback as i,useRef as a,useState as r,useEffect as s,useLayoutEffect as l}from"react";import c from"@emotion/styled";import d from"react-markdown";import g from"rehype-raw";import{franc as p}from"franc-min";import{v4 as h}from"uuid";import{BlobServiceClient as u,AnonymousCredential as m}from"@azure/storage-blob";import{keyframes as C}from"@emotion/react";import{Mp3Encoder as b}from"@breezystack/lamejs";const f={MaxFileSize:52428800,SupportedFormats:["png","jpg","jpeg","gif","bmp","pdf","doc","xls","xlsx","docx","ppt","pptx","avi","m4a","m4v","mov","mp4","wav","wma","wmv"],SupportedImageFormats:["png","jpg","jpeg","gif","bmp","webp"],SupportedAudioFormats:["mp3","acc","m4a","ogg","amr","webm","m4a"]},x="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEEAAABBCAYAAACO98lFAAAACXBIWXMAAAsSAAALEgHS3X78AAAFa0lEQVR42u2bX0xTVxzHvzqqVOqQrtJC2gmF4ooMWNg6FEJE3NhClpnG8aBzsTHugbgsLltiJg/6NI3J5pLFLbpIIjEjLuriiH9qnESlI6BQWcGsSEvT2lK8q0CvFChme1hwXs5tKfTWXfT83s6fe3Lz6fn9zvl9f7eL9L/u/xvPuS0GNQqBQqAQKAQKYaYlzfdBk0qPtzRFnL7L7ttoGLzz/EBQSlNRrMzj9HUzA9QdaEygECgECoFCoBAoBAqBQqAQKASaRQph6UlLUCJToCjtZcgkydCmqh6PPQyPo39kEP7QCDoeeGCbCD5bEN5dkQljlgFl6sKo854c97EMfvf2osl1K+FAEgqhPEWBuvyNRModi2XIFDDmVcCYV4FLjnZ8Zf8NQ1OTCysmmFR6HK2smxeAmVatNaC56lPUKrIXzk74Jv8dVGsNEcfZcAh3A25OX4pECp1cE/EZmUSKfaXbUGi/hnp7i7gh7Mku5QXAhkMwOztw8Z4NNx4yEZ+vVWRjbfrqiBCNeRVISUrG7t6L4oRQqMji3f4nesw47u6MyadPMU6cYpwo6G/Fl4U1vOtVaw0wBVyC6ZmCxoSZL8yGQ/j46hEccLbNOajZJoLY0tGEI9ZzvONfvP4BylMU4g6MbDiEz240RN36sdh3HisO3fyZd6wuf6O4j8hoAIxpq1CQqkbWciUAYGxqHANBPywBJyxjAWJ+w+AdKHvM+GjN28TOM6n0cbtFQiCc6DHzAjCmrcJ23QaolsmJMYNSj1qsh+0vJ37sbyFgHHC2YW2GnjhBNmlL44awOBFucNzdSfQfzK3CnqLNvACetIKXsnHYYMK2lWRA/KH3EtGnk2vijg2CQzhjv04EwYO5VahUF89pnU/WvAdj2ipO34VhL3wsucPK03PFBaHZ20O4wFwBTNuu/BooXljC6Tt718J7NIsGgo9liGRnu27DvNeTSaTYnvEqp8/6wEPMy41y03zqEBzDXk573TL5rDFgNqvI5GaefAFXJpGKB0L/yCAXgjz+hEe1TI51M0D2zcg7ptP1Z1pZkiUt5bQfhkMLI5VeSEYhCA1BJknmtP0CyWLmUV/URA0AbrGMOCA8KZwCwIXAQNxrtvu5V+KCpct558UjvQmeSqcn/Xe5YR5N4qrHGtea5+51cdpvpKmJOXynxf8aE2oUOZz2Ied1sPOM5lc9VsIV1qlWE/P+YJzigrBJW8ppM48mUd/VNGcQjlEvDjmvE67AJ9t3B1zigqCTawhV2DIWQH1XExyj3tjyj4E27Lp9Gswjrp/vyCnjvaqfinMnJERP+LxkM1qufMsJVpaxACydP2HbyjzUaEqgfTGTSME7/H/iylAv4QLTN0I+8fWyq1OcypJMIsXh14zY0tFEjDXet6Pxvv1xbiFLWgr3eBB3JtmI65WnKLD/za0xaxeiuSwVK/NwrHgT57SYaZaxAMyjvlkBfF1u4k2Svr/dLEhVSlAIVr+d0y5TF+KYYeu8lZ9d6uKIAFo93YJJ7oK6Q2PfNaKSpJNrcLSyDpcc7TjtuhmT+mxS6fHhK5XIkPHD6wu4sdd2XrD3Fjwm7Gw/iWOGrYQgWq01oFprgI9l0D3kgD80DEfQj+DUBFTJqVBKU5GTqkKRUhdVH+gLuLGz/aSgxVnBIQxNTUYEAfxbbY70C89mrZ5u7LWdF7w6nZDAODQ1ifctDThjvybIemw4hH1tjdhp/SUh5fmEfp9Qb29Bk+sWduSURa1SRzIfy+CyqzPmOuZTh+APjRCnQTBMvqhtIojdvRdR0N+K9StzUKTIgnZFJq9LTJfsHSODaB2y48KwF0/DFtE/h1JliUKgECgECoFCoBAi2D8QCAe+XuY7HAAAAABJRU5ErkJggg==",y=["🤓","🙃","😕","☹️","😲","😳","😠","😇","😀","😁","😂","🤣","😃","😄","😅","😆","😉","😊","😏","😣","😥","😮","😴","😌","😋","😎","😍","🙂","🤗","🤔","😐","😑","😶","🙄"],v="bc-message-list-content";const w=c.div`
1
+ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{useMemo as o,useCallback as i,useRef as a,useState as r,useEffect as l,useLayoutEffect as s}from"react";import c from"@emotion/styled";import d from"react-markdown";import g from"rehype-raw";import{franc as p}from"franc-min";import{v4 as h}from"uuid";import{BlobServiceClient as u,AnonymousCredential as m}from"@azure/storage-blob";import{keyframes as C}from"@emotion/react";import{Mp3Encoder as b}from"@breezystack/lamejs";const f={MaxFileSize:52428800,SupportedFormats:["png","jpg","jpeg","gif","bmp","pdf","doc","xls","xlsx","docx","ppt","pptx","avi","m4a","m4v","mov","mp4","wav","wma","wmv"],SupportedImageFormats:["png","jpg","jpeg","gif","bmp","webp"],SupportedAudioFormats:["mp3","acc","m4a","ogg","amr","webm","m4a"]},x="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEEAAABBCAYAAACO98lFAAAACXBIWXMAAAsSAAALEgHS3X78AAAFa0lEQVR42u2bX0xTVxzHvzqqVOqQrtJC2gmF4ooMWNg6FEJE3NhClpnG8aBzsTHugbgsLltiJg/6NI3J5pLFLbpIIjEjLuriiH9qnESlI6BQWcGsSEvT2lK8q0CvFChme1hwXs5tKfTWXfT83s6fe3Lz6fn9zvl9f7eL9L/u/xvPuS0GNQqBQqAQKAQKYaYlzfdBk0qPtzRFnL7L7ttoGLzz/EBQSlNRrMzj9HUzA9QdaEygECgECoFCoBAoBAqBQqAQKASaRQph6UlLUCJToCjtZcgkydCmqh6PPQyPo39kEP7QCDoeeGCbCD5bEN5dkQljlgFl6sKo854c97EMfvf2osl1K+FAEgqhPEWBuvyNRModi2XIFDDmVcCYV4FLjnZ8Zf8NQ1OTCysmmFR6HK2smxeAmVatNaC56lPUKrIXzk74Jv8dVGsNEcfZcAh3A25OX4pECp1cE/EZmUSKfaXbUGi/hnp7i7gh7Mku5QXAhkMwOztw8Z4NNx4yEZ+vVWRjbfrqiBCNeRVISUrG7t6L4oRQqMji3f4nesw47u6MyadPMU6cYpwo6G/Fl4U1vOtVaw0wBVyC6ZmCxoSZL8yGQ/j46hEccLbNOajZJoLY0tGEI9ZzvONfvP4BylMU4g6MbDiEz240RN36sdh3HisO3fyZd6wuf6O4j8hoAIxpq1CQqkbWciUAYGxqHANBPywBJyxjAWJ+w+AdKHvM+GjN28TOM6n0cbtFQiCc6DHzAjCmrcJ23QaolsmJMYNSj1qsh+0vJ37sbyFgHHC2YW2GnjhBNmlL44awOBFucNzdSfQfzK3CnqLNvACetIKXsnHYYMK2lWRA/KH3EtGnk2vijg2CQzhjv04EwYO5VahUF89pnU/WvAdj2ipO34VhL3wsucPK03PFBaHZ20O4wFwBTNuu/BooXljC6Tt718J7NIsGgo9liGRnu27DvNeTSaTYnvEqp8/6wEPMy41y03zqEBzDXk573TL5rDFgNqvI5GaefAFXJpGKB0L/yCAXgjz+hEe1TI51M0D2zcg7ptP1Z1pZkiUt5bQfhkMLI5VeSEYhCA1BJknmtP0CyWLmUV/URA0AbrGMOCA8KZwCwIXAQNxrtvu5V+KCpct558UjvQmeSqcn/Xe5YR5N4qrHGtea5+51cdpvpKmJOXynxf8aE2oUOZz2Ied1sPOM5lc9VsIV1qlWE/P+YJzigrBJW8ppM48mUd/VNGcQjlEvDjmvE67AJ9t3B1zigqCTawhV2DIWQH1XExyj3tjyj4E27Lp9Gswjrp/vyCnjvaqfinMnJERP+LxkM1qufMsJVpaxACydP2HbyjzUaEqgfTGTSME7/H/iylAv4QLTN0I+8fWyq1OcypJMIsXh14zY0tFEjDXet6Pxvv1xbiFLWgr3eBB3JtmI65WnKLD/za0xaxeiuSwVK/NwrHgT57SYaZaxAMyjvlkBfF1u4k2Svr/dLEhVSlAIVr+d0y5TF+KYYeu8lZ9d6uKIAFo93YJJ7oK6Q2PfNaKSpJNrcLSyDpcc7TjtuhmT+mxS6fHhK5XIkPHD6wu4sdd2XrD3Fjwm7Gw/iWOGrYQgWq01oFprgI9l0D3kgD80DEfQj+DUBFTJqVBKU5GTqkKRUhdVH+gLuLGz/aSgxVnBIQxNTUYEAfxbbY70C89mrZ5u7LWdF7w6nZDAODQ1ifctDThjvybIemw4hH1tjdhp/SUh5fmEfp9Qb29Bk+sWduSURa1SRzIfy+CyqzPmOuZTh+APjRCnQTBMvqhtIojdvRdR0N+K9StzUKTIgnZFJq9LTJfsHSODaB2y48KwF0/DFtE/h1JliUKgECgECoFCoBAi2D8QCAe+XuY7HAAAAABJRU5ErkJggg==",y=["🤓","🙃","😕","☹️","😲","😳","😠","😇","😀","😁","😂","🤣","😃","😄","😅","😆","😉","😊","😏","😣","😥","😮","😴","😌","😋","😎","😍","🙂","🤗","🤔","😐","😑","😶","🙄"],v="bc-message-list-content";const w=c.div`
2
2
  font-size: var(--bc-chat-fontSize-xs);
3
3
  opacity: 0.7;
4
4
  font-weight: 400;
@@ -23,13 +23,13 @@ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{useMemo a
23
23
  display: flex;
24
24
  flex-direction: column;
25
25
  gap: 6px;
26
- `,B=c.div`
26
+ `,D=c.div`
27
27
  display: flex;
28
28
  align-items: center;
29
29
  gap: 6px;
30
30
  font-size: var(--bc-chat-fontSize-sm);
31
31
  font-weight: 500;
32
- `,D=c.div`
32
+ `,B=c.div`
33
33
  display: flex;
34
34
  flex-direction: column;
35
35
  gap: 8px;
@@ -59,7 +59,7 @@ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{useMemo a
59
59
  display: flex;
60
60
  flex-direction: column;
61
61
  gap: 4px;
62
- `,j={en:"English",en_US:"English",en_GB:"English",ar:"Arabic",ar_SA:"Arabic",tr:"Turkish",tr_TR:"Turkish",es:"Spanish",es_ES:"Spanish",fr:"French",fr_FR:"French",de:"German",de_DE:"German",it:"Italian",it_IT:"Italian",pt:"Portuguese",pt_BR:"Portuguese",pt_PT:"Portuguese",ru:"Russian",ru_RU:"Russian",zh:"Chinese",zh_CN:"Chinese",ja:"Japanese",ja_JP:"Japanese",ko:"Korean",ko_KR:"Korean",hi:"Hindi",hi_IN:"Hindi"},P=({messageContent:n,isMyMessage:i,configLanguage:a})=>{const r=o((()=>{try{return JSON.parse(n)}catch(e){return void console.log(e.message)}}),[n]),s="string"==typeof r?.language?r.language:r?.language?.code,l=o((()=>(e=>{if(!e)return;if(j[e])return j[e];const t=e.split("_")[0].toLowerCase();return j[t]?j[t]:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})(s)),[s]),c=o((()=>{if(!r)return[];const e=[];if(r.templateComponents){let t=[];try{"string"==typeof r.templateComponents?t=JSON.parse(r.templateComponents):Array.isArray(r.templateComponents)&&(t=r.templateComponents)}catch(t){return console.log("Error parsing templateComponents:",t.message),e}t.forEach(((t,n)=>{if(!t||"object"!=typeof t)return;const o=t.type||"unknown",i=t.parameters||[];if("body"===o)i.forEach(((t,n)=>{if(t&&"object"==typeof t){const o=t.text||t.value||JSON.stringify(t),a=i.length>1?`Body Parameter ${n+1}`:"Body";e.push({label:a,value:String(o)})}}));else if("button"===o){const o=void 0!==t.index?t.index:n,a=t.sub_type||t.subType||"";i.forEach(((t,n)=>{if(t&&"object"==typeof t){const r=t.text||t.value||JSON.stringify(t),s=a?`Button ${o} (${a})`:`Button ${o}`,l=i.length>1?`${s} - Parameter ${n+1}`:s;e.push({label:l,value:String(r)})}}))}else i.forEach(((t,n)=>{if(t&&"object"==typeof t){const a=t.text||t.value||JSON.stringify(t),r=o.charAt(0).toUpperCase()+o.slice(1),s=i.length>1?`${r} Parameter ${n+1}`:r;e.push({label:s,value:String(a)})}}))}))}return e}),[r]);return r?e(H,{children:t(S,{isMyMessage:i,language:a,children:[t(F,{children:[t(B,{children:[e(E,{}),e(z,{children:r.name||"Template"})]}),l&&t(B,{children:[e(R,{}),e(z,{children:l})]})]}),c.length>0&&e(D,{children:c.map(((n,o)=>t(N,{children:[e(T,{children:n.label}),e(Z,{children:n.value})]},o)))})]})}):null},U=c(I)`
62
+ `,j={en:"English",en_US:"English",en_GB:"English",ar:"Arabic",ar_SA:"Arabic",tr:"Turkish",tr_TR:"Turkish",es:"Spanish",es_ES:"Spanish",fr:"French",fr_FR:"French",de:"German",de_DE:"German",it:"Italian",it_IT:"Italian",pt:"Portuguese",pt_BR:"Portuguese",pt_PT:"Portuguese",ru:"Russian",ru_RU:"Russian",zh:"Chinese",zh_CN:"Chinese",ja:"Japanese",ja_JP:"Japanese",ko:"Korean",ko_KR:"Korean",hi:"Hindi",hi_IN:"Hindi"},P=({messageContent:n,isMyMessage:i,configLanguage:a})=>{const r=o((()=>{try{return JSON.parse(n)}catch(e){return void console.log(e.message)}}),[n]),l="string"==typeof r?.language?r.language:r?.language?.code,s=o((()=>(e=>{if(!e)return;if(j[e])return j[e];const t=e.split("_")[0].toLowerCase();return j[t]?j[t]:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})(l)),[l]),c=o((()=>{if(!r)return[];const e=[];if(r.templateComponents){let t=[];try{"string"==typeof r.templateComponents?t=JSON.parse(r.templateComponents):Array.isArray(r.templateComponents)&&(t=r.templateComponents)}catch(t){return console.log("Error parsing templateComponents:",t.message),e}t.forEach(((t,n)=>{if(!t||"object"!=typeof t)return;const o=t.type||"unknown",i=t.parameters||[];if("body"===o)i.forEach(((t,n)=>{if(t&&"object"==typeof t){const o=t.text||t.value||JSON.stringify(t),a=i.length>1?`Body Parameter ${n+1}`:"Body";e.push({label:a,value:String(o)})}}));else if("button"===o){const o=void 0!==t.index?t.index:n,a=t.sub_type||t.subType||"";i.forEach(((t,n)=>{if(t&&"object"==typeof t){const r=t.text||t.value||JSON.stringify(t),l=a?`Button ${o} (${a})`:`Button ${o}`,s=i.length>1?`${l} - Parameter ${n+1}`:l;e.push({label:s,value:String(r)})}}))}else i.forEach(((t,n)=>{if(t&&"object"==typeof t){const a=t.text||t.value||JSON.stringify(t),r=o.charAt(0).toUpperCase()+o.slice(1),l=i.length>1?`${r} Parameter ${n+1}`:r;e.push({label:l,value:String(a)})}}))}))}return e}),[r]);return r?e(H,{children:t(S,{isMyMessage:i,language:a,children:[t(F,{children:[t(D,{children:[e(E,{}),e(z,{children:r.name||"Template"})]}),s&&t(D,{children:[e(R,{}),e(z,{children:s})]})]}),c.length>0&&e(B,{children:c.map(((n,o)=>t(N,{children:[e(T,{children:n.label}),e(Z,{children:n.value})]},o)))})]})}):null},U=c(I)`
63
63
  overflow: hidden;
64
64
  text-overflow: ellipsis;
65
65
  white-space: nowrap;
@@ -71,7 +71,7 @@ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{useMemo a
71
71
  `,V=c.div`
72
72
  white-space: normal;
73
73
  cursor: pointer;
74
- `,G=({className:t,context:n,isMyMessage:o,language:a})=>{const r=i((()=>{const e=document.getElementById(v),t=document.getElementById(n.replyToId);e&&t&&(e.style.scrollBehavior="smooth",t.scrollIntoView())}),[n.replyToId]),s=()=>"image"===n.replyToType?e("img",{src:n.replyToContent,alt:"Media preview",style:{width:"30px",height:"30px",objectFit:"cover",marginLeft:"8px",verticalAlign:"middle"}}):"template"===n.replyToType&&n.replyToContent?e(V,{onClick:r,children:e(P,{messageContent:n.replyToContent,isMyMessage:o,configLanguage:a})}):n.replyToContent;return"template"===n.replyToType?e("div",{className:t,onClick:r,children:s()}):e(U,{className:t,isMyMessage:o,language:a,onClick:r,children:s()})},J=c.div`
74
+ `,G=({className:t,context:n,isMyMessage:o,language:a})=>{const r=i((()=>{const e=document.getElementById(v),t=document.getElementById(n.replyToId);e&&t&&(e.style.scrollBehavior="smooth",t.scrollIntoView())}),[n.replyToId]),l=()=>"image"===n.replyToType?e("img",{src:n.replyToContent,alt:"Media preview",style:{width:"30px",height:"30px",objectFit:"cover",marginLeft:"8px",verticalAlign:"middle"}}):"template"===n.replyToType&&n.replyToContent?e(V,{onClick:r,children:e(P,{messageContent:n.replyToContent,isMyMessage:o,configLanguage:a})}):n.replyToContent;return"template"===n.replyToType?e("div",{className:t,onClick:r,children:l()}):e(U,{className:t,isMyMessage:o,language:a,onClick:r,children:l()})},J=c.div`
75
75
  position: relative;
76
76
  background-image: ${e=>e.isMyMessage?"linear-gradient(104deg,var(--bc-chat-my-message-background-start-color),var(--bc-chat-my-message-background-end-color))":"linear-gradient(104deg,var(--bc-chat-other-message-background-start-color),var(--bc-chat-other-message-background-end-color))"};
77
77
  color: ${e=>e.isMyMessage?"var(--bc-chat-my-message-text-color)":"var(--bc-chat-other-message-text-color)"};
@@ -138,7 +138,7 @@ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{useMemo a
138
138
  background-color: rgba(22, 97, 108, 0.12);
139
139
  outline: none;
140
140
  }
141
- `,O=()=>e("svg",{width:"15",height:"16",viewBox:"0 0 15 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M7.2232 8.33921C6.85992 8.33921 5.54564 8.35033 5.54564 8.35033V11.3333L1.29228 6.67275L5.54564 2.00666V5.01186C5.54564 5.01186 6.93435 4.99519 7.2232 5.0063C11.146 5.1285 13.8701 9.59462 13.8879 11.6832C12.6892 10.1445 9.53958 8.33921 7.2232 8.33921ZM6.65828 3.90089V0.623508C6.67716 0.456862 6.63217 0.290241 6.50552 0.162479C6.28554 -0.0541598 5.92892 -0.0541598 5.70895 0.162479L0.160208 6.25058C0.0430006 6.36723 -0.00699451 6.51722 0.000782283 6.67275C-0.00699451 6.82273 0.0430006 6.97827 0.160208 7.09493L5.6784 13.1442C5.78061 13.2719 5.92892 13.3553 6.10168 13.3553C6.25944 13.3553 6.39997 13.2886 6.50107 13.183C6.50218 13.183 6.50441 13.183 6.50552 13.1775C6.63217 13.0553 6.67716 12.8831 6.65828 12.722C6.65828 12.722 6.66772 9.63904 6.66772 9.45018C10.3339 9.45018 13.6496 12.0887 14.3079 15.5661C14.7511 14.544 15 13.4219 15 12.2387C15 7.63375 11.2649 3.90089 6.65828 3.90089Z",fill:"#161616"})}),q=({isMyMessage:n,createdAt:o,children:a,className:r,message:s,config:l,style:c,onReply:d,isMedia:g})=>{const h=p(s.content),u="AR"===l.language,m=s?.messageId,C=Boolean(d&&m),b=i((()=>{m&&d?.(m)}),[m,d]),f=o||s&&l&&l.isAgent===s.isAgent?t(Q,{isMedia:g,isMyMessage:n,children:[s&&l&&l.isAgent===s.isAgent&&e(L,{message:s,config:l}),o&&e(M,{createdAt:o})]}):null;return t(J,{isMyMessage:n,language:l.language,className:r,style:c,children:[C?e(Y,{className:"bc-replyButton",type:"button",onClick:b,isRTL:u,isMyMessage:n,children:e(O,{})}):null,s.context&&s.context.replyToId?e(G,{context:s.context,isMyMessage:n,language:h}):null,"template"===s.type?e(P,{messageContent:s.content,isMyMessage:n,configLanguage:l.language}):null,t(K,{isMyMessage:n,isMedia:g,children:[t(W,{language:h,children:[a,g&&f]}),!g&&f]})]})},X=({message:t,config:n,searchPattern:o,onReply:i})=>{const a=n.isAgent===t.isAgent;return e(q,{className:"bc-textMessage",isMyMessage:a,createdAt:t.createdAt,message:t,config:n,onReply:i,children:(t.content&&t.content.indexOf("\n")>-1?t.content.split("\n"):[t.content]).map(((n,i)=>{const a=o&&o.trim()?function(e,t){const n=(o=t.trim(),o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"));var o;if(!n)return e;const i=new RegExp(`(${n})`,"gi");return e.replace(i,'<span style="background-color: var(--bc-chat-message-highlight-color, yellow); padding: 3px 0;">$1</span>')}(n,o):n;return e(d,{rehypePlugins:[g],skipHtml:!1,children:a},`${t.messageId}-${i}`)}))})};function $(e){if(!isFinite(e)||e<0)return"0:00";return`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`}function _({src:n}){const l=a(null),[c,d]=r(!1),[g,p]=r(!0),[h,u]=r(0),[m,C]=r(0),b=o((()=>{const e=function(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return()=>{t+=1831565813;let e=Math.imul(t^t>>>15,1|t);return e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n),t=[];for(let n=0;n<82;n++){const o=.6*Math.sin(n/82*Math.PI)+.2,i=.25*(e()-.5),a=Math.min(1,Math.max(.15,o+i));t.push(a)}return t}),[n]);s((()=>{const e=l.current;if(!e)return;const t=()=>{u(e.duration),p(!1)},n=()=>C(e.currentTime),o=()=>d(!1),i=()=>{document.querySelectorAll("video, audio").forEach((t=>{t!==e&&t.pause()})),d(!0)},a=()=>d(!1);return e.addEventListener("loadedmetadata",t),e.addEventListener("timeupdate",n),e.addEventListener("ended",o),e.addEventListener("play",i),e.addEventListener("pause",a),()=>{e.removeEventListener("loadedmetadata",t),e.removeEventListener("timeupdate",n),e.removeEventListener("ended",o),e.removeEventListener("play",i),e.removeEventListener("pause",a)}}),[n]);const f=i((()=>{const e=l.current;e&&(e.paused?e.play():e.pause())}),[]),x=i((e=>{const t=l.current;if(!t||!h)return;const n=e.currentTarget.getBoundingClientRect(),o=Math.min(1,Math.max(0,(e.clientX-n.left)/n.width));t.currentTime=o*h,C(t.currentTime)}),[h]),y=h?Math.min(1,m/h):0;return t("div",{className:"bc-audioPlayer",role:"group","aria-label":"Audio message player",children:[e("button",{type:"button",className:"bc-audioPlayer__button "+(c?"pause":"play"),onClick:f,"aria-label":c?"Pause audio":"Play audio"}),t("div",{className:"bc-audioPlayer__wave",onClick:x,children:[e("div",{className:"bc-audioPlayer__wave--future",children:b.map(((t,n)=>e("span",{style:{height:`${Math.round(18*t)}px`}},`f-${n}`)))}),e("div",{className:"bc-audioPlayer__wave--past",style:{width:100*y+"%"},children:b.map(((t,n)=>e("span",{style:{height:`${Math.round(18*t)}px`}},`p-${n}`)))})]}),e("div",{className:"bc-audioPlayer__time","aria-live":"polite",children:g?"--:--":$(h)}),e("audio",{ref:l,src:n,preload:"auto"})]})}const ee=({message:n,config:o,onReply:l})=>{const[c,d]=r(!1),[g,p]=r(!0),h=a(null),u=i((()=>{const e=h.current;e&&console.error("Media playback error:",{src:e.src,error:e.error,networkState:e.networkState,readyState:e.readyState,messageType:n.type}),d(!0),p(!1)}),[n.type]),m=i((()=>{console.log("Media loaded successfully:",n.content),p(!1)}),[n.content]),C=i((()=>{console.log("Media can play:",n.content),p(!1)}),[n.content]),b=i((()=>{console.log("Media load started:",n.content)}),[n.content]);s((()=>{const e=()=>{document.querySelectorAll("video, audio").forEach((e=>{e!==h.current&&e.pause()}))},t=h.current;if(t){t.addEventListener("play",e),t.addEventListener("loadeddata",m),t.addEventListener("canplay",C),t.addEventListener("error",u),t.addEventListener("loadstart",b);const o=setTimeout((()=>{console.log("Loading timeout reached for:",n.content),p(!1)}),5e3);return()=>{t&&(t.removeEventListener("play",e),t.removeEventListener("loadeddata",m),t.removeEventListener("canplay",C),t.removeEventListener("error",u),t.removeEventListener("loadstart",b)),clearTimeout(o)}}}),[C,b,u,m,n.content,n.type]);const f=o.isAgent===n.isAgent;return c?t(q,{className:"bc-mediaMessage"+("audio"===n.type?" audio":""),isMyMessage:f,isMedia:!0,createdAt:n.createdAt,message:n,config:o,onReply:l,children:[t("p",{style:{margin:0,color:"#666"},children:["Unable to load ","audio"===n.type?"audio":"video"," file."]}),t("a",{href:n.content,target:"_blank",rel:"noopener noreferrer",style:{color:"#007bff",textDecoration:"none"},children:["Open ","audio"===n.type?"audio":"video"," in new tab"]})]}):"audio"===n.type?e(q,{className:"bc-mediaMessage audio",isMyMessage:f,isMedia:!0,createdAt:n.createdAt,message:n,config:o,style:{position:"relative"},onReply:l,children:e(_,{src:n.content})}):t(q,{className:"bc-mediaMessage",isMyMessage:f,isMedia:!0,createdAt:n.createdAt,message:n,config:o,style:{position:"relative"},onReply:l,children:[e("video",{ref:h,src:n.content,controls:!0,preload:"metadata",playsInline:!0,onError:u,onLoadedData:m,onCanPlay:C,onLoadStart:b}),g&&e("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:"14px",zIndex:1},children:"Loading video..."})]})};var te={EN:{share_my_location:"Share My Location",share_my_current_location:"Share My Current Location",placeholder:"Message...",notePlaceholder:"Add your note",see_your_location:"See Your Location",location_permission:"Please give location permission",download:"Download",template_message:"Template Message",message:"Message",add_contact:"Add Contact",autoCompleteAcceptHint:"Press Tab or the Right arrow key to insert the full suggestion."},AR:{share_my_location:"مشاركة موقعي",share_my_current_location:"مشاركة موقعي الحالي",placeholder:"الرسالة...",notePlaceholder:"أضف ملاحظتك",see_your_location:"رؤية موقعك",location_permission:"يرجى منح إذن الموقع",download:"تحميل",template_message:"رسالة قالب",message:"أرسل رسالة",add_contact:"إضافة جهة اتصال",autoCompleteAcceptHint:"اضغط Tab أو مفتاح السهم الأيمن لإدراج الاقتراح كاملًا."},TR:{share_my_location:"Konumumu paylaş",share_my_current_location:"Güncel konumumu paylaş",placeholder:"Mesajınızı yazın",notePlaceholder:"Notunuzu ekleyin",see_your_location:"Konumunuzu Görüntüleyin",location_permission:"Lütfen konum paylaşımı için izin verin",download:"İndir",template_message:"Şablon Mesajı",message:"Mesaj",add_contact:"Kişi Ekle",autoCompleteAcceptHint:"Tam öneriyi eklemek için Tab veya Sağ ok tuşuna basın."}};const ne=()=>e("svg",{width:"18",height:"22",viewBox:"0 0 18 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M8.56055 0.249878C9.16365 0.249377 9.64011 0.249415 10.0869 0.407104C10.1792 0.439689 10.2701 0.477175 10.3584 0.519409C10.7858 0.723899 11.1227 1.06135 11.5488 1.48816L16.4443 6.38367C16.9387 6.87712 17.3304 7.26784 17.541 7.77625C17.7515 8.28461 17.7507 8.83754 17.75 9.53601V13.0565C17.75 14.8942 17.7498 16.3499 17.5967 17.4891C17.439 18.6615 17.1067 19.61 16.3584 20.3583C15.6101 21.1066 14.6616 21.4389 13.4893 21.5966C12.3501 21.7497 10.8943 21.7499 9.05664 21.7499H8.94336C7.10571 21.7499 5.64991 21.7497 4.51074 21.5966C3.33844 21.4389 2.38991 21.1066 1.6416 20.3583C0.893309 19.61 0.560952 18.6615 0.40332 17.4891C0.25016 16.3499 0.249984 14.8942 0.25 13.0565V8.4071C0.249988 6.82577 0.250388 5.57298 0.366211 4.58093C0.485107 3.56261 0.733898 2.72281 1.30176 2.01843C1.51427 1.75486 1.755 1.51514 2.01855 1.30261C2.72296 0.734673 3.56267 0.484993 4.58105 0.366089C5.57311 0.250277 6.8259 0.249866 8.40723 0.249878H8.56055ZM8.45605 1.74988C6.81549 1.74988 5.6499 1.75086 4.75488 1.85535C3.87608 1.95795 3.35453 2.15151 2.95996 2.4696C2.77959 2.61504 2.61516 2.77947 2.46973 2.95984C2.15159 3.35441 1.95808 3.87589 1.85547 4.75476C1.75097 5.64979 1.75 6.8153 1.75 8.45593V12.9999C1.75 14.9066 1.75151 16.2613 1.88965 17.2889C2.02491 18.295 2.27897 18.8745 2.70215 19.2977C3.12536 19.7209 3.70485 19.975 4.71094 20.1102C5.73859 20.2484 7.09323 20.2499 9 20.2499C10.9068 20.2499 12.2614 20.2484 13.2891 20.1102C14.2952 19.975 14.8746 19.7209 15.2979 19.2977C15.721 18.8745 15.9751 18.295 16.1104 17.2889C16.2485 16.2613 16.25 14.9066 16.25 12.9999V9.6571C16.25 9.21922 16.2468 8.94195 16.2334 8.74988H15.9453C14.5778 8.7499 13.4753 8.7502 12.6084 8.63367C11.7083 8.51265 10.9505 8.25316 10.3486 7.65125C9.74676 7.04934 9.48722 6.29156 9.36621 5.39148C9.24969 4.52456 9.24998 3.422 9.25 2.05457V1.76355C9.08319 1.75292 8.84192 1.74988 8.45605 1.74988ZM13 15.2499C13.4142 15.2499 13.75 15.5857 13.75 15.9999C13.75 16.4141 13.4142 16.7499 13 16.7499H5C4.58579 16.7499 4.25 16.4141 4.25 15.9999C4.25 15.5857 4.58579 15.2499 5 15.2499H13ZM9 11.2499C9.41421 11.2499 9.75 11.5857 9.75 11.9999C9.75 12.4141 9.41421 12.7499 9 12.7499H5C4.58579 12.7499 4.25 12.4141 4.25 11.9999C4.25 11.5857 4.58579 11.2499 5 11.2499H9ZM10.751 2.8114C10.7546 3.82629 10.7723 4.58818 10.8535 5.19226C10.9522 5.92571 11.1325 6.31399 11.4092 6.5907C11.6859 6.86746 12.0748 7.04771 12.8086 7.14636C13.4126 7.22753 14.1738 7.24524 15.1885 7.2489L10.751 2.8114Z",fill:"#16616C"})}),oe=c.a`
141
+ `,O=()=>e("svg",{width:"15",height:"16",viewBox:"0 0 15 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M7.2232 8.33921C6.85992 8.33921 5.54564 8.35033 5.54564 8.35033V11.3333L1.29228 6.67275L5.54564 2.00666V5.01186C5.54564 5.01186 6.93435 4.99519 7.2232 5.0063C11.146 5.1285 13.8701 9.59462 13.8879 11.6832C12.6892 10.1445 9.53958 8.33921 7.2232 8.33921ZM6.65828 3.90089V0.623508C6.67716 0.456862 6.63217 0.290241 6.50552 0.162479C6.28554 -0.0541598 5.92892 -0.0541598 5.70895 0.162479L0.160208 6.25058C0.0430006 6.36723 -0.00699451 6.51722 0.000782283 6.67275C-0.00699451 6.82273 0.0430006 6.97827 0.160208 7.09493L5.6784 13.1442C5.78061 13.2719 5.92892 13.3553 6.10168 13.3553C6.25944 13.3553 6.39997 13.2886 6.50107 13.183C6.50218 13.183 6.50441 13.183 6.50552 13.1775C6.63217 13.0553 6.67716 12.8831 6.65828 12.722C6.65828 12.722 6.66772 9.63904 6.66772 9.45018C10.3339 9.45018 13.6496 12.0887 14.3079 15.5661C14.7511 14.544 15 13.4219 15 12.2387C15 7.63375 11.2649 3.90089 6.65828 3.90089Z",fill:"#161616"})}),q=({isMyMessage:n,createdAt:o,children:a,className:r,message:l,config:s,style:c,onReply:d,isMedia:g})=>{const h=p(l.content),u="AR"===s.language,m=l?.messageId,C=Boolean(d&&m),b=i((()=>{m&&d?.(m)}),[m,d]),f=o||l&&s&&s.isAgent===l.isAgent?t(Q,{isMedia:g,isMyMessage:n,children:[l&&s&&s.isAgent===l.isAgent&&e(L,{message:l,config:s}),o&&e(M,{createdAt:o})]}):null;return t(J,{isMyMessage:n,language:s.language,className:r,style:c,children:[C?e(Y,{className:"bc-replyButton",type:"button",onClick:b,isRTL:u,isMyMessage:n,children:e(O,{})}):null,l.context&&l.context.replyToId?e(G,{context:l.context,isMyMessage:n,language:h}):null,"template"===l.type?e(P,{messageContent:l.content,isMyMessage:n,configLanguage:s.language}):null,t(K,{isMyMessage:n,isMedia:g,children:[t(W,{language:h,children:[a,g&&f]}),!g&&f]})]})},X=({message:t,config:n,searchPattern:o,onReply:i})=>{const a=n.isAgent===t.isAgent;return e(q,{className:"bc-textMessage",isMyMessage:a,createdAt:t.createdAt,message:t,config:n,onReply:i,children:(t.content&&t.content.indexOf("\n")>-1?t.content.split("\n"):[t.content]).map(((n,i)=>{const a=o&&o.trim()?function(e,t){const n=(o=t.trim(),o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"));var o;if(!n)return e;const i=new RegExp(`(${n})`,"gi");return e.replace(i,'<span style="background-color: var(--bc-chat-message-highlight-color, yellow); padding: 3px 0;">$1</span>')}(n,o):n;return e(d,{rehypePlugins:[g],skipHtml:!1,children:a},`${t.messageId}-${i}`)}))})};function $(e){if(!isFinite(e)||e<0)return"0:00";return`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`}function _({src:n}){const s=a(null),[c,d]=r(!1),[g,p]=r(!0),[h,u]=r(0),[m,C]=r(0),b=o((()=>{const e=function(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return()=>{t+=1831565813;let e=Math.imul(t^t>>>15,1|t);return e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n),t=[];for(let n=0;n<82;n++){const o=.6*Math.sin(n/82*Math.PI)+.2,i=.25*(e()-.5),a=Math.min(1,Math.max(.15,o+i));t.push(a)}return t}),[n]);l((()=>{const e=s.current;if(!e)return;const t=()=>{u(e.duration),p(!1)},n=()=>C(e.currentTime),o=()=>d(!1),i=()=>{document.querySelectorAll("video, audio").forEach((t=>{t!==e&&t.pause()})),d(!0)},a=()=>d(!1);return e.addEventListener("loadedmetadata",t),e.addEventListener("timeupdate",n),e.addEventListener("ended",o),e.addEventListener("play",i),e.addEventListener("pause",a),()=>{e.removeEventListener("loadedmetadata",t),e.removeEventListener("timeupdate",n),e.removeEventListener("ended",o),e.removeEventListener("play",i),e.removeEventListener("pause",a)}}),[n]);const f=i((()=>{const e=s.current;e&&(e.paused?e.play():e.pause())}),[]),x=i((e=>{const t=s.current;if(!t||!h)return;const n=e.currentTarget.getBoundingClientRect(),o=Math.min(1,Math.max(0,(e.clientX-n.left)/n.width));t.currentTime=o*h,C(t.currentTime)}),[h]),y=h?Math.min(1,m/h):0;return t("div",{className:"bc-audioPlayer",role:"group","aria-label":"Audio message player",children:[e("button",{type:"button",className:"bc-audioPlayer__button "+(c?"pause":"play"),onClick:f,"aria-label":c?"Pause audio":"Play audio"}),t("div",{className:"bc-audioPlayer__wave",onClick:x,children:[e("div",{className:"bc-audioPlayer__wave--future",children:b.map(((t,n)=>e("span",{style:{height:`${Math.round(18*t)}px`}},`f-${n}`)))}),e("div",{className:"bc-audioPlayer__wave--past",style:{width:100*y+"%"},children:b.map(((t,n)=>e("span",{style:{height:`${Math.round(18*t)}px`}},`p-${n}`)))})]}),e("div",{className:"bc-audioPlayer__time","aria-live":"polite",children:g?"--:--":$(h)}),e("audio",{ref:s,src:n,preload:"auto"})]})}const ee=({message:n,config:o,onReply:s})=>{const[c,d]=r(!1),[g,p]=r(!0),h=a(null),u=i((()=>{const e=h.current;e&&console.error("Media playback error:",{src:e.src,error:e.error,networkState:e.networkState,readyState:e.readyState,messageType:n.type}),d(!0),p(!1)}),[n.type]),m=i((()=>{console.log("Media loaded successfully:",n.content),p(!1)}),[n.content]),C=i((()=>{console.log("Media can play:",n.content),p(!1)}),[n.content]),b=i((()=>{console.log("Media load started:",n.content)}),[n.content]);l((()=>{const e=()=>{document.querySelectorAll("video, audio").forEach((e=>{e!==h.current&&e.pause()}))},t=h.current;if(t){t.addEventListener("play",e),t.addEventListener("loadeddata",m),t.addEventListener("canplay",C),t.addEventListener("error",u),t.addEventListener("loadstart",b);const o=setTimeout((()=>{console.log("Loading timeout reached for:",n.content),p(!1)}),5e3);return()=>{t&&(t.removeEventListener("play",e),t.removeEventListener("loadeddata",m),t.removeEventListener("canplay",C),t.removeEventListener("error",u),t.removeEventListener("loadstart",b)),clearTimeout(o)}}}),[C,b,u,m,n.content,n.type]);const f=o.isAgent===n.isAgent;return c?t(q,{className:"bc-mediaMessage"+("audio"===n.type?" audio":""),isMyMessage:f,isMedia:!0,createdAt:n.createdAt,message:n,config:o,onReply:s,children:[t("p",{style:{margin:0,color:"#666"},children:["Unable to load ","audio"===n.type?"audio":"video"," file."]}),t("a",{href:n.content,target:"_blank",rel:"noopener noreferrer",style:{color:"#007bff",textDecoration:"none"},children:["Open ","audio"===n.type?"audio":"video"," in new tab"]})]}):"audio"===n.type?e(q,{className:"bc-mediaMessage audio",isMyMessage:f,isMedia:!0,createdAt:n.createdAt,message:n,config:o,style:{position:"relative"},onReply:s,children:e(_,{src:n.content})}):t(q,{className:"bc-mediaMessage",isMyMessage:f,isMedia:!0,createdAt:n.createdAt,message:n,config:o,style:{position:"relative"},onReply:s,children:[e("video",{ref:h,src:n.content,controls:!0,preload:"metadata",playsInline:!0,onError:u,onLoadedData:m,onCanPlay:C,onLoadStart:b}),g&&e("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:"14px",zIndex:1},children:"Loading video..."})]})};var te={EN:{share_my_location:"Share My Location",share_my_current_location:"Share My Current Location",placeholder:"Message...",notePlaceholder:"Add your note",see_your_location:"See Your Location",location_permission:"Please give location permission",download:"Download",template_message:"Template Message",message:"Message",add_contact:"Add Contact",autoCompleteAcceptHint:"Press Tab or the Right arrow key to insert the full suggestion."},AR:{share_my_location:"مشاركة موقعي",share_my_current_location:"مشاركة موقعي الحالي",placeholder:"الرسالة...",notePlaceholder:"أضف ملاحظتك",see_your_location:"رؤية موقعك",location_permission:"يرجى منح إذن الموقع",download:"تحميل",template_message:"رسالة قالب",message:"أرسل رسالة",add_contact:"إضافة جهة اتصال",autoCompleteAcceptHint:"اضغط Tab أو مفتاح السهم الأيمن لإدراج الاقتراح كاملًا."},TR:{share_my_location:"Konumumu paylaş",share_my_current_location:"Güncel konumumu paylaş",placeholder:"Mesajınızı yazın",notePlaceholder:"Notunuzu ekleyin",see_your_location:"Konumunuzu Görüntüleyin",location_permission:"Lütfen konum paylaşımı için izin verin",download:"İndir",template_message:"Şablon Mesajı",message:"Mesaj",add_contact:"Kişi Ekle",autoCompleteAcceptHint:"Tam öneriyi eklemek için Tab veya Sağ ok tuşuna basın."}};const ne=()=>e("svg",{width:"18",height:"22",viewBox:"0 0 18 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M8.56055 0.249878C9.16365 0.249377 9.64011 0.249415 10.0869 0.407104C10.1792 0.439689 10.2701 0.477175 10.3584 0.519409C10.7858 0.723899 11.1227 1.06135 11.5488 1.48816L16.4443 6.38367C16.9387 6.87712 17.3304 7.26784 17.541 7.77625C17.7515 8.28461 17.7507 8.83754 17.75 9.53601V13.0565C17.75 14.8942 17.7498 16.3499 17.5967 17.4891C17.439 18.6615 17.1067 19.61 16.3584 20.3583C15.6101 21.1066 14.6616 21.4389 13.4893 21.5966C12.3501 21.7497 10.8943 21.7499 9.05664 21.7499H8.94336C7.10571 21.7499 5.64991 21.7497 4.51074 21.5966C3.33844 21.4389 2.38991 21.1066 1.6416 20.3583C0.893309 19.61 0.560952 18.6615 0.40332 17.4891C0.25016 16.3499 0.249984 14.8942 0.25 13.0565V8.4071C0.249988 6.82577 0.250388 5.57298 0.366211 4.58093C0.485107 3.56261 0.733898 2.72281 1.30176 2.01843C1.51427 1.75486 1.755 1.51514 2.01855 1.30261C2.72296 0.734673 3.56267 0.484993 4.58105 0.366089C5.57311 0.250277 6.8259 0.249866 8.40723 0.249878H8.56055ZM8.45605 1.74988C6.81549 1.74988 5.6499 1.75086 4.75488 1.85535C3.87608 1.95795 3.35453 2.15151 2.95996 2.4696C2.77959 2.61504 2.61516 2.77947 2.46973 2.95984C2.15159 3.35441 1.95808 3.87589 1.85547 4.75476C1.75097 5.64979 1.75 6.8153 1.75 8.45593V12.9999C1.75 14.9066 1.75151 16.2613 1.88965 17.2889C2.02491 18.295 2.27897 18.8745 2.70215 19.2977C3.12536 19.7209 3.70485 19.975 4.71094 20.1102C5.73859 20.2484 7.09323 20.2499 9 20.2499C10.9068 20.2499 12.2614 20.2484 13.2891 20.1102C14.2952 19.975 14.8746 19.7209 15.2979 19.2977C15.721 18.8745 15.9751 18.295 16.1104 17.2889C16.2485 16.2613 16.25 14.9066 16.25 12.9999V9.6571C16.25 9.21922 16.2468 8.94195 16.2334 8.74988H15.9453C14.5778 8.7499 13.4753 8.7502 12.6084 8.63367C11.7083 8.51265 10.9505 8.25316 10.3486 7.65125C9.74676 7.04934 9.48722 6.29156 9.36621 5.39148C9.24969 4.52456 9.24998 3.422 9.25 2.05457V1.76355C9.08319 1.75292 8.84192 1.74988 8.45605 1.74988ZM13 15.2499C13.4142 15.2499 13.75 15.5857 13.75 15.9999C13.75 16.4141 13.4142 16.7499 13 16.7499H5C4.58579 16.7499 4.25 16.4141 4.25 15.9999C4.25 15.5857 4.58579 15.2499 5 15.2499H13ZM9 11.2499C9.41421 11.2499 9.75 11.5857 9.75 11.9999C9.75 12.4141 9.41421 12.7499 9 12.7499H5C4.58579 12.7499 4.25 12.4141 4.25 11.9999C4.25 11.5857 4.58579 11.2499 5 11.2499H9ZM10.751 2.8114C10.7546 3.82629 10.7723 4.58818 10.8535 5.19226C10.9522 5.92571 11.1325 6.31399 11.4092 6.5907C11.6859 6.86746 12.0748 7.04771 12.8086 7.14636C13.4126 7.22753 14.1738 7.24524 15.1885 7.2489L10.751 2.8114Z",fill:"#16616C"})}),oe=c.a`
142
142
  ${e=>e.isMyMessage?"flex-direction: row;":"flex-direction: row-reverse;"}
143
143
  min-width: 300px;
144
144
  display: flex;
@@ -176,11 +176,11 @@ i {
176
176
  display: flex;
177
177
  flex-direction: column;
178
178
  gap: 4px;
179
- `,se=c.span`
179
+ `,le=c.span`
180
180
  font-size: var(--bc-chat-fontSize-xs);
181
181
  font-weight: var(--bc-chat-fontWeight-regular);
182
182
  line-height: var(--bc-chat-lineHeight-xs);
183
- `,le=c.span`
183
+ `,se=c.span`
184
184
  font-size: var(--bc-chat-fontSize-sm);
185
185
  opacity: 0.7;
186
186
  font-weight: var(--bc-chat-fontWeight-regular);
@@ -292,11 +292,11 @@ i {
292
292
  &:first-of-type {
293
293
  border-right: 1px solid var(--bc-chat-other-message-separator-color);
294
294
  }
295
- `,Ee=({contact:n,createdAt:i,language:a,onMessage:r,onAddContact:s})=>{const l=o((()=>{const e=[n.firstName,n.lastName].filter(Boolean);return e.length>0?e.join(" "):"Unknown Contact"}),[n.firstName,n.lastName]);return t(be,{children:[t(fe,{children:[t(xe,{children:[e(ye,{children:l}),n.phone&&e(ve,{children:n.phone}),i&&e(we,{children:e(M,{createdAt:i})})]}),e(Me,{children:e(Ae,{})})]}),e(ke,{}),t(Le,{children:[e(Ie,{onClick:r,children:te[a]?.message||"Message"}),e(Ie,{onClick:s,children:te[a]?.add_contact||"Add Contact"})]})]})},Re=c.div`
295
+ `,Ee=({contact:n,createdAt:i,language:a,onMessage:r,onAddContact:l})=>{const s=o((()=>{const e=[n.firstName,n.lastName].filter(Boolean);return e.length>0?e.join(" "):"Unknown Contact"}),[n.firstName,n.lastName]);return t(be,{children:[t(fe,{children:[t(xe,{children:[e(ye,{children:s}),n.phone&&e(ve,{children:n.phone}),i&&e(we,{children:e(M,{createdAt:i})})]}),e(Me,{children:e(Ae,{})})]}),e(ke,{}),t(Le,{children:[e(Ie,{onClick:r,children:te[a]?.message||"Message"}),e(Ie,{onClick:l,children:te[a]?.add_contact||"Add Contact"})]})]})},Re=c.div`
296
296
  display: flex;
297
297
  flex-direction: column;
298
298
  gap: 8px;
299
- `,Se={document:({message:n,config:i,onReply:a})=>{const l=i.isAgent===n.isAgent,[c,d]=r(""),g=o((()=>{try{const e=(n.content||"").split("/");return decodeURIComponent(e[e.length-1]||"file")}catch{return"file"}}),[n.content]);s((()=>{let e=!1;const t=n.content;if(t){try{new URL(t)}catch{return}return fetch(t,{method:"HEAD"}).then((t=>{if(!t.ok)return;const n=t.headers.get("content-length");if(!n)return;const o=Number(n);var i;!Number.isFinite(o)||o<0||(e||d((i=o)<1024?`${i} B`:i<1048576?`${(i/1024).toFixed(1)}KB`:i<1073741824?`${(i/1048576).toFixed(1)}MB`:`${(i/1073741824).toFixed(1)}GB`))})).catch((e=>{console.debug("Failed to fetch file size:",e)})),()=>{e=!0}}}),[n.content]);const p=c?`${c} - ${te[i.language]?.download}`:te[i.language]?.download;return e(q,{isMyMessage:l,createdAt:n.createdAt,message:n,config:i,onReply:a,children:e(oe,{href:n.content,target:"_blank",download:g,rel:"noopener noreferrer",isMyMessage:l,children:t(ie,{isMyMessage:l,children:[e(ae,{children:e(ne,{})}),t(re,{children:[e(se,{children:g}),e(le,{children:p})]})]})})})},image:({message:t,config:n,onReply:o})=>{const i=n.isAgent===t.isAgent;return e(q,{className:"bc-mediaMessage",isMyMessage:i,createdAt:t.createdAt,message:t,config:n,onReply:o,isMedia:!0,children:e("a",{href:t.content,target:"_blank",rel:"noreferrer",children:e("img",{src:t.content,alt:"message content",style:{width:"100%",height:"auto",borderRadius:"8px"}})})})},location:({message:n,config:o,onReply:i})=>{const a=o.isAgent===n.isAgent;return e(q,{isMyMessage:a,createdAt:n.createdAt,message:n,config:o,onReply:i,children:e(ce,{href:"https://www.google.com/maps/?q="+n.content,target:"_blank",rel:"noopener noreferrer",children:t(de,{children:[e(pe,{color:"000000"}),e(ge,{children:"Open location"})]})})})},text:X,video:ee,audio:ee,interactive:null,template:({message:n,config:o,onReply:i})=>{const a=o.isAgent===n.isAgent;return t(q,{isMyMessage:a,createdAt:n.createdAt,message:n,config:o,onReply:i,children:[e(me,{})," ",e(Ce,{children:te[o.language]?.template_message||"Template Message"})]})},note:({message:n})=>{const o=p(n.content);return t(he,{children:[e(ue,{language:o,children:n.content})," ",e(M,{createdAt:n.createdAt})]})},button:X,contacts:({message:t,config:n,onContactMessage:a,onContactAddContact:r})=>{const s=o((()=>{try{const e=JSON.parse(t.content||"[]");return Array.isArray(e)?e:[e]}catch{return[]}}),[t.content]),l=i((e=>{a&&a(e)}),[a]),c=i((e=>{r&&r(e)}),[r]);return 0===s.length?null:e(Re,{children:s.map(((o,i)=>e(Ee,{contact:o,createdAt:0===i?t.createdAt:void 0,language:n.language,onMessage:()=>l(o),onAddContact:()=>c(o)},`${o.phone||i}`)))})}};function Fe(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&o.firstChild?o.insertBefore(i,o.firstChild):o.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}Fe('/* Shared styles between agent and client messages */\n.bc-otherMessage,\n.bc-myMessage {\n margin: 24px;\n font-size: var(--bc-chat-fontSize-sm);\n line-height: var(--bc-chat-lineHeight-sm);\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 12px;\n}\n.bc-otherMessage div p,\n.bc-myMessage div p {\n padding: 0;\n margin: 0;\n}\n\n/* Styles for agent messages */\n.bc-otherMessage {\n justify-content: flex-start;\n}\n.bc-otherMessage:first-child {\n flex: 1 0 50%;\n}\n.bc-otherMessage > :nth-child(2) {\n flex: 0 1 auto;\n max-width: 85%;\n}\n\n/* Styles for other messages */\n.bc-note {\n text-align: center;\n gap: 5px;\n}\n\n.bc-myMessage {\n justify-content: flex-end;\n}\n.bc-myMessage > div:not(.bc-debugCon),\n.bc-myMessage .bc-locationMessage,\n.bc-myMessage audio {\n color: #fff;\n}\n.bc-myMessage svg path:nth-child(2) {\n fill: #fff;\n}\n\n.bc-mediaMessage {\n position: relative;\n max-width: 300px !important;\n}\n.bc-mediaMessage audio,\n.bc-mediaMessage video,\n.bc-mediaMessage img {\n max-width: 100%;\n}\n.bc-mediaMessage audio {\n -webkit-appearance: none;\n -webkit-border-radius: 0;\n border-radius: 0;\n}\n.bc-mediaMessage audio::-webkit-media-controls-panel {\n background-color: transparent;\n}\n.bc-mediaMessage audio::-webkit-media-controls-play-button {\n background-color: transparent;\n}\n.bc-mediaMessage audio::-webkit-media-controls-timeline {\n background-color: transparent;\n}\n.bc-mediaMessage audio::-webkit-media-controls-current-time-display, .bc-mediaMessage audio::-webkit-media-controls-time-remaining-display {\n color: inherit;\n}\n.bc-mediaMessage audio {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n height: 40px !important;\n width: 100% !important;\n max-width: 400px !important;\n position: static !important;\n -webkit-appearance: none !important;\n -webkit-border-radius: 0 !important;\n border-radius: 0 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls {\n display: flex !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-panel {\n display: flex !important;\n visibility: visible !important;\n background-color: #f0f0f0 !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-play-button {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-timeline {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-volume-slider {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-current-time-display, .bc-mediaMessage audio::-webkit-media-controls-time-remaining-display {\n display: block !important;\n visibility: visible !important;\n color: #000 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-mute-button {\n display: block !important;\n visibility: visible !important;\n}\n\n.bc-mediaMessage.audio {\n width: 320px;\n height: 64px !important;\n}\n\n/* Custom audio player */\n.bc-audioPlayer {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 300px;\n position: relative;\n height: 50px;\n justify-self: flex-start;\n}\n\n.bc-audioPlayer audio {\n display: none !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.bc-audioPlayer__button {\n flex: 0 0 auto;\n width: 40px;\n height: 40px;\n border: none;\n border-radius: 50%;\n background: var(--bc-chat-white-color);\n position: relative;\n cursor: pointer;\n}\n\n.bc-otherMessage .bc-audioPlayer__button {\n background: #16616C;\n}\n\n.bc-audioPlayer__button.play::before {\n content: "";\n position: absolute;\n left: 12px;\n top: 12px;\n width: 16px;\n height: 16px;\n background-repeat: no-repeat;\n background-position: center;\n background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M6.23541%202.19233C5.2355%201.62986%204%202.35243%204%203.49968V12.5C4%2013.6472%205.23546%2014.3698%206.23537%2013.8073L14.2356%209.30735C15.2551%208.73391%2015.2551%207.26609%2014.2357%206.69262L6.23541%202.19233Z%22%20fill%3D%22%2316616C%22%2F%3E%3C%2Fsvg%3E");\n}\n\n.bc-otherMessage .bc-audioPlayer__button.play::before {\n background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M6.23541%202.19233C5.2355%201.62986%204%202.35243%204%203.49968V12.5C4%2013.6472%205.23546%2014.3698%206.23537%2013.8073L14.2356%209.30735C15.2551%208.73391%2015.2551%207.26609%2014.2357%206.69262L6.23541%202.19233Z%22%20fill%3D%22%23ffffff%22%2F%3E%3C%2Fsvg%3E");\n}\n\n.bc-audioPlayer__button.pause::before,\n.bc-audioPlayer__button.pause::after {\n content: "";\n position: absolute;\n top: 14px;\n width: 3px;\n height: 12px;\n background: #16616C;\n}\n\n.bc-otherMessage .bc-audioPlayer__button.pause::before,\n.bc-otherMessage .bc-audioPlayer__button.pause::after {\n background: var(--bc-chat-white-color);\n}\n\n.bc-audioPlayer__button.pause::before {\n left: 16px;\n}\n\n.bc-audioPlayer__button.pause::after {\n right: 16px;\n}\n\n.bc-audioPlayer__wave {\n position: relative;\n flex: 1 1 auto;\n height: 22px;\n cursor: pointer;\n}\n\n.bc-audioPlayer__wave--future,\n.bc-audioPlayer__wave--past {\n position: absolute;\n left: 0;\n top: 50%;\n transform: translateY(-50%);\n height: 22px;\n display: grid;\n grid-auto-flow: column;\n grid-auto-columns: 2px;\n column-gap: 1px;\n align-items: end;\n width: 100%;\n pointer-events: none;\n}\n\n.bc-audioPlayer__wave--future span {\n display: block;\n width: 2px;\n background: rgba(255, 255, 255, 0.6);\n border-radius: 2px;\n}\n\n.bc-otherMessage .bc-audioPlayer__wave--future span {\n background: #16616C;\n opacity: 0.6;\n}\n\n.bc-audioPlayer__wave--past {\n overflow: hidden;\n white-space: nowrap;\n}\n\n.bc-audioPlayer__wave--past span {\n display: inline-block;\n width: 2px;\n margin-right: 3px;\n background: var(--bc-chat-white-color);\n border-radius: 2px;\n}\n\n.bc-otherMessage .bc-audioPlayer__wave--past span {\n background: #16616C;\n}\n\n.bc-otherMessage:hover .bc-replyButton, .bc-otherMessage:active .bc-replyButton, .bc-myMessage:hover .bc-replyButton, .bc-myMessage:active .bc-replyButton {\n display: block;\n}\n\n.bc-audioPlayer__time {\n color: var(--bc-chat-white-color);\n font-weight: 400;\n opacity: 0.95;\n position: absolute;\n top: 46px;\n left: 80px;\n font-size: 10px;\n}\n\n.bc-otherMessage .bc-audioPlayer__time {\n color: #16616C;\n}\n\n.bc-selectionContainer {\n display: flex;\n align-items: flex-start;\n flex-wrap: wrap;\n}\n\n.bc-selectionContainer:first-child {\n flex: 1 0 50%;\n}\n\n.status-icon {\n color: var(--bc-chat-my-message-text-color) !important;\n opacity: 0.7;\n}\n.status-icon.read {\n color: #33C1FF !important;\n}\n.status-icon.failed {\n color: var(--bc-chat-danger-color) !important;\n}\n.status-icon.failed .resend {\n color: var(--bc-chat-text-secondary-dark) !important;\n cursor: pointer;\n margin: 0 10px;\n}');const Be=c.i`
299
+ `,Se={document:({message:n,config:i,onReply:a})=>{const s=i.isAgent===n.isAgent,[c,d]=r(""),g=o((()=>{try{const e=(n.content||"").split("/");return decodeURIComponent(e[e.length-1]||"file")}catch{return"file"}}),[n.content]);l((()=>{let e=!1;const t=n.content;if(t){try{new URL(t)}catch{return}return fetch(t,{method:"HEAD"}).then((t=>{if(!t.ok)return;const n=t.headers.get("content-length");if(!n)return;const o=Number(n);var i;!Number.isFinite(o)||o<0||(e||d((i=o)<1024?`${i} B`:i<1048576?`${(i/1024).toFixed(1)}KB`:i<1073741824?`${(i/1048576).toFixed(1)}MB`:`${(i/1073741824).toFixed(1)}GB`))})).catch((e=>{console.debug("Failed to fetch file size:",e)})),()=>{e=!0}}}),[n.content]);const p=c?`${c} - ${te[i.language]?.download}`:te[i.language]?.download;return e(q,{isMyMessage:s,createdAt:n.createdAt,message:n,config:i,onReply:a,children:e(oe,{href:n.content,target:"_blank",download:g,rel:"noopener noreferrer",isMyMessage:s,children:t(ie,{isMyMessage:s,children:[e(ae,{children:e(ne,{})}),t(re,{children:[e(le,{children:g}),e(se,{children:p})]})]})})})},image:({message:t,config:n,onReply:o})=>{const i=n.isAgent===t.isAgent;return e(q,{className:"bc-mediaMessage",isMyMessage:i,createdAt:t.createdAt,message:t,config:n,onReply:o,isMedia:!0,children:e("a",{href:t.content,target:"_blank",rel:"noreferrer",children:e("img",{src:t.content,alt:"message content",style:{width:"100%",height:"auto",borderRadius:"8px"}})})})},location:({message:n,config:o,onReply:i})=>{const a=o.isAgent===n.isAgent;return e(q,{isMyMessage:a,createdAt:n.createdAt,message:n,config:o,onReply:i,children:e(ce,{href:"https://www.google.com/maps/?q="+n.content,target:"_blank",rel:"noopener noreferrer",children:t(de,{children:[e(pe,{color:"000000"}),e(ge,{children:"Open location"})]})})})},text:X,video:ee,audio:ee,interactive:null,template:({message:n,config:o,onReply:i})=>{const a=o.isAgent===n.isAgent;return t(q,{isMyMessage:a,createdAt:n.createdAt,message:n,config:o,onReply:i,children:[e(me,{})," ",e(Ce,{children:te[o.language]?.template_message||"Template Message"})]})},note:({message:n})=>{const o=p(n.content);return t(he,{children:[e(ue,{language:o,children:n.content})," ",e(M,{createdAt:n.createdAt})]})},button:X,contacts:({message:t,config:n,onContactMessage:a,onContactAddContact:r})=>{const l=o((()=>{try{const e=JSON.parse(t.content||"[]");return Array.isArray(e)?e:[e]}catch{return[]}}),[t.content]),s=i((e=>{a&&a(e)}),[a]),c=i((e=>{r&&r(e)}),[r]);return 0===l.length?null:e(Re,{children:l.map(((o,i)=>e(Ee,{contact:o,createdAt:0===i?t.createdAt:void 0,language:n.language,onMessage:()=>s(o),onAddContact:()=>c(o)},`${o.phone||i}`)))})}};function Fe(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&o.firstChild?o.insertBefore(i,o.firstChild):o.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}Fe('/* Shared styles between agent and client messages */\n.bc-otherMessage,\n.bc-myMessage {\n margin: 24px;\n font-size: var(--bc-chat-fontSize-sm);\n line-height: var(--bc-chat-lineHeight-sm);\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 12px;\n}\n.bc-otherMessage div p,\n.bc-myMessage div p {\n padding: 0;\n margin: 0;\n}\n\n/* Styles for agent messages */\n.bc-otherMessage {\n justify-content: flex-start;\n}\n.bc-otherMessage:first-child {\n flex: 1 0 50%;\n}\n.bc-otherMessage > :nth-child(2) {\n flex: 0 1 auto;\n max-width: 85%;\n}\n\n/* Styles for other messages */\n.bc-note {\n text-align: center;\n gap: 5px;\n}\n\n.bc-myMessage {\n justify-content: flex-end;\n}\n.bc-myMessage > div:not(.bc-debugCon),\n.bc-myMessage .bc-locationMessage,\n.bc-myMessage audio {\n color: #fff;\n}\n.bc-myMessage svg path:nth-child(2) {\n fill: #fff;\n}\n\n.bc-mediaMessage {\n position: relative;\n max-width: 300px !important;\n}\n.bc-mediaMessage audio,\n.bc-mediaMessage video,\n.bc-mediaMessage img {\n max-width: 100%;\n}\n.bc-mediaMessage audio {\n -webkit-appearance: none;\n -webkit-border-radius: 0;\n border-radius: 0;\n}\n.bc-mediaMessage audio::-webkit-media-controls-panel {\n background-color: transparent;\n}\n.bc-mediaMessage audio::-webkit-media-controls-play-button {\n background-color: transparent;\n}\n.bc-mediaMessage audio::-webkit-media-controls-timeline {\n background-color: transparent;\n}\n.bc-mediaMessage audio::-webkit-media-controls-current-time-display, .bc-mediaMessage audio::-webkit-media-controls-time-remaining-display {\n color: inherit;\n}\n.bc-mediaMessage audio {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n height: 40px !important;\n width: 100% !important;\n max-width: 400px !important;\n position: static !important;\n -webkit-appearance: none !important;\n -webkit-border-radius: 0 !important;\n border-radius: 0 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls {\n display: flex !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-panel {\n display: flex !important;\n visibility: visible !important;\n background-color: #f0f0f0 !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-play-button {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-timeline {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-volume-slider {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-current-time-display, .bc-mediaMessage audio::-webkit-media-controls-time-remaining-display {\n display: block !important;\n visibility: visible !important;\n color: #000 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-mute-button {\n display: block !important;\n visibility: visible !important;\n}\n\n.bc-mediaMessage.audio {\n width: 320px;\n height: 64px !important;\n}\n\n/* Custom audio player */\n.bc-audioPlayer {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 300px;\n position: relative;\n height: 50px;\n justify-self: flex-start;\n}\n\n.bc-audioPlayer audio {\n display: none !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.bc-audioPlayer__button {\n flex: 0 0 auto;\n width: 40px;\n height: 40px;\n border: none;\n border-radius: 50%;\n background: var(--bc-chat-white-color);\n position: relative;\n cursor: pointer;\n}\n\n.bc-otherMessage .bc-audioPlayer__button {\n background: #16616C;\n}\n\n.bc-audioPlayer__button.play::before {\n content: "";\n position: absolute;\n left: 12px;\n top: 12px;\n width: 16px;\n height: 16px;\n background-repeat: no-repeat;\n background-position: center;\n background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M6.23541%202.19233C5.2355%201.62986%204%202.35243%204%203.49968V12.5C4%2013.6472%205.23546%2014.3698%206.23537%2013.8073L14.2356%209.30735C15.2551%208.73391%2015.2551%207.26609%2014.2357%206.69262L6.23541%202.19233Z%22%20fill%3D%22%2316616C%22%2F%3E%3C%2Fsvg%3E");\n}\n\n.bc-otherMessage .bc-audioPlayer__button.play::before {\n background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M6.23541%202.19233C5.2355%201.62986%204%202.35243%204%203.49968V12.5C4%2013.6472%205.23546%2014.3698%206.23537%2013.8073L14.2356%209.30735C15.2551%208.73391%2015.2551%207.26609%2014.2357%206.69262L6.23541%202.19233Z%22%20fill%3D%22%23ffffff%22%2F%3E%3C%2Fsvg%3E");\n}\n\n.bc-audioPlayer__button.pause::before,\n.bc-audioPlayer__button.pause::after {\n content: "";\n position: absolute;\n top: 14px;\n width: 3px;\n height: 12px;\n background: #16616C;\n}\n\n.bc-otherMessage .bc-audioPlayer__button.pause::before,\n.bc-otherMessage .bc-audioPlayer__button.pause::after {\n background: var(--bc-chat-white-color);\n}\n\n.bc-audioPlayer__button.pause::before {\n left: 16px;\n}\n\n.bc-audioPlayer__button.pause::after {\n right: 16px;\n}\n\n.bc-audioPlayer__wave {\n position: relative;\n flex: 1 1 auto;\n height: 22px;\n cursor: pointer;\n}\n\n.bc-audioPlayer__wave--future,\n.bc-audioPlayer__wave--past {\n position: absolute;\n left: 0;\n top: 50%;\n transform: translateY(-50%);\n height: 22px;\n display: grid;\n grid-auto-flow: column;\n grid-auto-columns: 2px;\n column-gap: 1px;\n align-items: end;\n width: 100%;\n pointer-events: none;\n}\n\n.bc-audioPlayer__wave--future span {\n display: block;\n width: 2px;\n background: rgba(255, 255, 255, 0.6);\n border-radius: 2px;\n}\n\n.bc-otherMessage .bc-audioPlayer__wave--future span {\n background: #16616C;\n opacity: 0.6;\n}\n\n.bc-audioPlayer__wave--past {\n overflow: hidden;\n white-space: nowrap;\n}\n\n.bc-audioPlayer__wave--past span {\n display: inline-block;\n width: 2px;\n margin-right: 3px;\n background: var(--bc-chat-white-color);\n border-radius: 2px;\n}\n\n.bc-otherMessage .bc-audioPlayer__wave--past span {\n background: #16616C;\n}\n\n.bc-otherMessage:hover .bc-replyButton, .bc-otherMessage:active .bc-replyButton, .bc-myMessage:hover .bc-replyButton, .bc-myMessage:active .bc-replyButton {\n display: block;\n}\n\n.bc-audioPlayer__time {\n color: var(--bc-chat-white-color);\n font-weight: 400;\n opacity: 0.95;\n position: absolute;\n top: 46px;\n left: 80px;\n font-size: 10px;\n}\n\n.bc-otherMessage .bc-audioPlayer__time {\n color: #16616C;\n}\n\n.bc-selectionContainer {\n display: flex;\n align-items: flex-start;\n flex-wrap: wrap;\n}\n\n.bc-selectionContainer:first-child {\n flex: 1 0 50%;\n}\n\n.status-icon {\n color: var(--bc-chat-my-message-text-color) !important;\n opacity: 0.7;\n}\n.status-icon.read {\n color: #33C1FF !important;\n}\n.status-icon.failed {\n color: var(--bc-chat-danger-color) !important;\n}\n.status-icon.failed .resend {\n color: var(--bc-chat-text-secondary-dark) !important;\n cursor: pointer;\n margin: 0 10px;\n}');const De=c.i`
300
300
  background-image: url(${e=>e.avatar||x});
301
301
  width: 30px;
302
302
  height: 30px;
@@ -305,7 +305,7 @@ i {
305
305
  display: inline-block;
306
306
  border-radius: 50%;
307
307
  background-repeat: no-repeat;
308
- `;function De(e,t,n){return"note"===e?"bc-note":n.isAgent?t?"bc-myMessage":"bc-otherMessage":t?"bc-otherMessage":"bc-myMessage"}const ze=n=>{const{type:o,isAgent:i}=n.message,a=n.message.isAgent&&n.message.agentId&&n.agentsIdsAvatarsMap?.[n.message.agentId]||n.config?.brandLogo,r=Se[o]??null;return r?t("div",{className:De(o,i,n.config),id:n.message.messageId,style:{flexDirection:"AR"===n.config.language?"row-reverse":"row",alignItems:"flex-end"},children:[e(r,{message:n.message,config:n.config,searchPattern:n.searchPattern,onReply:n.onMessageReply,onContactMessage:n.onContactMessage,onContactAddContact:n.onContactAddContact}),n.config.isAgent&&i&&"note"!==o?e(Be,{avatar:a}):null]}):null},Ne=c.div`
308
+ `;function Be(e,t,n){return"note"===e?"bc-note":n.isAgent?t?"bc-myMessage":"bc-otherMessage":t?"bc-otherMessage":"bc-myMessage"}const ze=n=>{const{type:o,isAgent:i}=n.message,a=n.message.isAgent&&n.message.agentId&&n.agentsIdsAvatarsMap?.[n.message.agentId]||n.config?.brandLogo,r=Se[o]??null;return r?t("div",{className:Be(o,i,n.config),id:n.message.messageId,style:{flexDirection:"AR"===n.config.language?"row-reverse":"row",alignItems:"flex-end"},children:[e(r,{message:n.message,config:n.config,searchPattern:n.searchPattern,onReply:n.onMessageReply,onContactMessage:n.onContactMessage,onContactAddContact:n.onContactAddContact}),n.config.isAgent&&i&&"note"!==o?e(De,{avatar:a}):null]}):null},Ne=c.div`
309
309
  width: 90%;
310
310
  display: flex;
311
311
  align-items: center;
@@ -379,7 +379,7 @@ i {
379
379
  font-size: var(--bc-chat-fontSize-sm);
380
380
  line-height: var(--bc-chat-lineHeight-sm);
381
381
  color: inherit;
382
- `,Ge=()=>e("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.95833 16.6667C4.70114 16.6667 1.25 13.2155 1.25 8.95833C1.25 4.70114 4.70114 1.25 8.95833 1.25C13.2155 1.25 16.6667 4.70114 16.6667 8.95833C16.6667 13.2155 13.2155 16.6667 8.95833 16.6667ZM0 8.95833C0 13.9059 4.01078 17.9167 8.95833 17.9167C13.9059 17.9167 17.9167 13.9059 17.9167 8.95833C17.9167 4.01078 13.9059 0 8.95833 0C4.01078 0 0 4.01078 0 8.95833ZM8.53419 8.75097C8.47632 8.75004 8.40939 8.75001 8.32682 8.75001C7.98164 8.75001 7.70182 8.47019 7.70182 8.12501C7.70182 7.77984 7.98164 7.50001 8.32682 7.50001L8.35553 7.50001C8.52646 7.49994 8.71128 7.49987 8.8673 7.52084C9.05007 7.54541 9.28356 7.60861 9.48006 7.80511C9.67656 8.00161 9.73975 8.2351 9.76433 8.41787C9.7853 8.57388 9.78523 8.75871 9.78516 8.92964V8.92964L9.78516 8.95835V13.125C9.78516 13.4702 9.50533 13.75 9.16016 13.75C8.81498 13.75 8.53516 13.4702 8.53516 13.125V8.95835C8.53516 8.87578 8.53513 8.80885 8.53419 8.75097ZM8.95182 4.79167C8.49159 4.79167 8.11849 5.16476 8.11849 5.625C8.11849 6.08524 8.49159 6.45833 8.95182 6.45833H8.95931C9.41955 6.45833 9.79264 6.08524 9.79264 5.625C9.79264 5.16476 9.41955 4.79167 8.95931 4.79167H8.95182Z",fill:"#6C737F"})});function Je(e){return new Date(e).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"})}function Ke(e){if(!e)return null;const t=e.querySelectorAll("[data-message-date]");if(0===t.length)return null;const n=e.getBoundingClientRect(),o=n.top+50;let i=null,a=null;for(const e of t){const t=e.getAttribute("data-message-date");if(!t)continue;const r=e.getBoundingClientRect();r.top<n.bottom&&r.bottom>n.top&&(!i||r.top<i.top)&&(i={date:t,top:r.top}),r.bottom<=o&&(!a||r.bottom>a.bottom)&&(a={date:t,bottom:r.bottom})}return i?i.date:a?a.date:t[0]?.getAttribute("data-message-date")??null}const We=({sendMessage:o,debug:i,config:c,messages:d,onReachingUp:g,agentsIdsAvatarsMap:p,searchPattern:h,searchMatchNo:u,onSearchMatchCount:m,onMessageReply:C,errorMessage:b,onContactMessage:f,onContactAddContact:x})=>{const y=a(null),w=a(0),[M,A]=r(null),[k,L]=r(!0),[I,E]=r(null),R=b?.trim(),S=d.find((e=>"seperator"!==e.type)),F=S?.createdAt?Je(S.createdAt):null;s((()=>{const e=document.getElementById(v);if(!e)return;w.current=e.scrollHeight;const t=()=>{0===e.scrollTop&&g?.();const t=e.scrollHeight-e.scrollTop-e.clientHeight<=4;L(t);const n=Ke(e);E((e=>n!==e?n:e))};return e.addEventListener("scroll",t),()=>{e.removeEventListener("scroll",t)}}),[g]),l((()=>{const e=y.current;if(!e)return;const t=w.current;if(e.scrollHeight-e.scrollTop<=e.clientHeight+200){const t=e.scrollHeight;e.style.scrollBehavior="smooth",e.style.overscrollBehavior="contain",e.scroll(0,t),L(!0)}else{const n=e.scrollHeight-t;e.style.scrollBehavior="auto",e.scrollTop=e.scrollTop+n;const o=4,i=e.scrollHeight-e.scrollTop-e.clientHeight<=o;L(i)}w.current=e.scrollHeight;const n=Ke(e);E(n)}),[d,R]),s((()=>{if(!h||!h.trim())return A(null),void m?.(0);const e=h.toLowerCase(),t=[];for(const n of d){const o=n&&n.content,i=n&&n.messageId;i&&o&&(String(o).toLowerCase().includes(e)&&t.push(i))}if(m?.(t.length),0===t.length)return void A(null);const n=t[Math.min(Math.max((u??1)-1,0),t.length-1)];A(n);const o=y.current,i=n?document.getElementById(n):null;o&&i&&(o.style.scrollBehavior="smooth",i.scrollIntoView())}),[h,u,d,m]);const B=I??F??null;return t(Ze,{ref:y,id:v,config:c,children:[B&&e(He,{children:e("span",{className:"sticky-date-pill-inner",children:B})}),d?.map(((t,n)=>"seperator"===t.type?e(Te,{data:t,config:c}):e("div",{"data-message-date":t.createdAt?Je(t.createdAt):void 0,children:e(ze,{message:t,index:n,sendMessage:o,messageActionsEnabled:d.length-1===n,debug:i,config:c,agentsIdsAvatarsMap:p,highlighted:M===t.messageId,searchPattern:h,onMessageReply:C,onContactMessage:f,onContactAddContact:x})},t.messageId?t.messageId:"message"+n))),R&&t(n,{children:[e(Te,{data:{type:"seperator"},config:c}),t(Pe,{role:"alert","aria-live":"assertive","data-testid":"chat-error-message",children:[e(Ue,{children:e(Ge,{})}),e(Ve,{children:R})]})]}),!k&&e(je,{"aria-label":"Scroll to latest message",onClick:()=>{const e=y.current;if(!e)return;const t=e.scrollHeight;e.style.scrollBehavior="smooth",e.style.overscrollBehavior="contain",e.scroll(0,t),L(!0)},children:e("svg",{width:"14",height:"8",viewBox:"0 0 14 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M1.60372 0.555285C1.7256 0.716659 2.08951 1.1984 2.30624 1.47611C2.74031 2.03233 3.33342 2.77142 3.97323 3.50831C4.61627 4.24893 5.29178 4.97022 5.89189 5.50046C6.19281 5.76634 6.45714 5.96837 6.67527 6.09987C6.88042 6.22355 7.00161 6.24927 7.00161 6.24927C7.00161 6.24927 7.11923 6.22355 7.32437 6.09988C7.5425 5.96838 7.80684 5.76635 8.10775 5.50047C8.70786 4.97022 9.38337 4.24892 10.0264 3.5083C10.6662 2.7714 11.2593 2.0323 11.6934 1.47608C11.9101 1.19837 12.2735 0.717304 12.3954 0.555928C12.6411 0.222405 13.1111 0.150469 13.4446 0.396102C13.7781 0.641734 13.8494 1.11123 13.6037 1.44476L13.6018 1.4473C13.474 1.61655 13.0971 2.11556 12.8759 2.39892C12.4321 2.9677 11.8216 3.72861 11.1591 4.49171C10.4997 5.25109 9.77408 6.02979 9.10096 6.62454C8.76526 6.92116 8.42497 7.18788 8.0988 7.3845C7.79322 7.56872 7.40633 7.75 6.99982 7.75C6.59331 7.75 6.20642 7.56871 5.90084 7.3845C5.57468 7.18787 5.23439 6.92116 4.89869 6.62454C4.22557 6.02979 3.4999 5.2511 2.84058 4.49173C2.17803 3.72863 1.5676 2.96774 1.12372 2.39896C0.902432 2.11541 0.525506 1.61637 0.397929 1.44747L0.396279 1.44528C0.150645 1.11176 0.22154 0.641787 0.555062 0.396152C0.888572 0.150526 1.35808 0.221792 1.60372 0.555285Z",fill:"white"})})})]},v)},Qe="text";async function Ye(e,t,n){const o=new u("https://bcuserres.blob.core.windows.net?sv=2024-11-04&ss=b&srt=o&sp=rc&se=2027-12-31T19:19:59Z&st=2026-01-02T11:04:59Z&spr=https&sig=OqvZvcz%2FmvmhVS8gWqPpMBxDZXHbEZ%2BTQRpCT3bE3G0%3D",new m).getContainerClient("anonymous"),i=new Date,a=`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}`,r=o.getBlockBlobClient(`${a}/${h()}`);try{await r.uploadBrowserData(e,{onProgress:n=>{const o=Math.round(n.loadedBytes/e.size*100);t(o)},blockSize:4194304,concurrency:20,blobHTTPHeaders:{blobContentType:e.type}});n(r.url.split("?")[0])}catch(e){n(void 0,"Error uploading file:"+e.message)}}const Oe=c.span`
382
+ `,Ge=()=>e("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.95833 16.6667C4.70114 16.6667 1.25 13.2155 1.25 8.95833C1.25 4.70114 4.70114 1.25 8.95833 1.25C13.2155 1.25 16.6667 4.70114 16.6667 8.95833C16.6667 13.2155 13.2155 16.6667 8.95833 16.6667ZM0 8.95833C0 13.9059 4.01078 17.9167 8.95833 17.9167C13.9059 17.9167 17.9167 13.9059 17.9167 8.95833C17.9167 4.01078 13.9059 0 8.95833 0C4.01078 0 0 4.01078 0 8.95833ZM8.53419 8.75097C8.47632 8.75004 8.40939 8.75001 8.32682 8.75001C7.98164 8.75001 7.70182 8.47019 7.70182 8.12501C7.70182 7.77984 7.98164 7.50001 8.32682 7.50001L8.35553 7.50001C8.52646 7.49994 8.71128 7.49987 8.8673 7.52084C9.05007 7.54541 9.28356 7.60861 9.48006 7.80511C9.67656 8.00161 9.73975 8.2351 9.76433 8.41787C9.7853 8.57388 9.78523 8.75871 9.78516 8.92964V8.92964L9.78516 8.95835V13.125C9.78516 13.4702 9.50533 13.75 9.16016 13.75C8.81498 13.75 8.53516 13.4702 8.53516 13.125V8.95835C8.53516 8.87578 8.53513 8.80885 8.53419 8.75097ZM8.95182 4.79167C8.49159 4.79167 8.11849 5.16476 8.11849 5.625C8.11849 6.08524 8.49159 6.45833 8.95182 6.45833H8.95931C9.41955 6.45833 9.79264 6.08524 9.79264 5.625C9.79264 5.16476 9.41955 4.79167 8.95931 4.79167H8.95182Z",fill:"#6C737F"})});function Je(e){return new Date(e).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"})}function Ke(e){if(!e)return null;const t=e.querySelectorAll("[data-message-date]");if(0===t.length)return null;const n=e.getBoundingClientRect(),o=n.top+50;let i=null,a=null;for(const e of t){const t=e.getAttribute("data-message-date");if(!t)continue;const r=e.getBoundingClientRect();r.top<n.bottom&&r.bottom>n.top&&(!i||r.top<i.top)&&(i={date:t,top:r.top}),r.bottom<=o&&(!a||r.bottom>a.bottom)&&(a={date:t,bottom:r.bottom})}return i?i.date:a?a.date:t[0]?.getAttribute("data-message-date")??null}const We=({sendMessage:o,debug:i,config:c,messages:d,onReachingUp:g,agentsIdsAvatarsMap:p,searchPattern:h,searchMatchNo:u,onSearchMatchCount:m,onMessageReply:C,errorMessage:b,onContactMessage:f,onContactAddContact:x})=>{const y=a(null),w=a(0),[M,A]=r(null),[k,L]=r(!0),[I,E]=r(null),R=b?.trim(),S=d.find((e=>"seperator"!==e.type)),F=S?.createdAt?Je(S.createdAt):null;l((()=>{const e=document.getElementById(v);if(!e)return;w.current=e.scrollHeight;const t=()=>{0===e.scrollTop&&g?.();const t=e.scrollHeight-e.scrollTop-e.clientHeight<=4;L(t);const n=Ke(e);E((e=>n!==e?n:e))};return e.addEventListener("scroll",t),()=>{e.removeEventListener("scroll",t)}}),[g]),s((()=>{const e=y.current;if(!e)return;const t=w.current;if(e.scrollHeight-e.scrollTop<=e.clientHeight+200){const t=e.scrollHeight;e.style.scrollBehavior="smooth",e.style.overscrollBehavior="contain",e.scroll(0,t),L(!0)}else{const n=e.scrollHeight-t;e.style.scrollBehavior="auto",e.scrollTop=e.scrollTop+n;const o=4,i=e.scrollHeight-e.scrollTop-e.clientHeight<=o;L(i)}w.current=e.scrollHeight;const n=Ke(e);E(n)}),[d,R]),l((()=>{if(!h||!h.trim())return A(null),void m?.(0);const e=h.toLowerCase(),t=[];for(const n of d){const o=n&&n.content,i=n&&n.messageId;i&&o&&(String(o).toLowerCase().includes(e)&&t.push(i))}if(m?.(t.length),0===t.length)return void A(null);const n=t[Math.min(Math.max((u??1)-1,0),t.length-1)];A(n);const o=y.current,i=n?document.getElementById(n):null;o&&i&&(o.style.scrollBehavior="smooth",i.scrollIntoView())}),[h,u,d,m]);const D=I??F??null;return t(Ze,{ref:y,id:v,config:c,children:[D&&e(He,{children:e("span",{className:"sticky-date-pill-inner",children:D})}),d?.map(((t,n)=>"seperator"===t.type?e(Te,{data:t,config:c}):e("div",{"data-message-date":t.createdAt?Je(t.createdAt):void 0,children:e(ze,{message:t,index:n,sendMessage:o,messageActionsEnabled:d.length-1===n,debug:i,config:c,agentsIdsAvatarsMap:p,highlighted:M===t.messageId,searchPattern:h,onMessageReply:C,onContactMessage:f,onContactAddContact:x})},t.messageId?t.messageId:"message"+n))),R&&t(n,{children:[e(Te,{data:{type:"seperator"},config:c}),t(Pe,{role:"alert","aria-live":"assertive","data-testid":"chat-error-message",children:[e(Ue,{children:e(Ge,{})}),e(Ve,{children:R})]})]}),!k&&e(je,{"aria-label":"Scroll to latest message",onClick:()=>{const e=y.current;if(!e)return;const t=e.scrollHeight;e.style.scrollBehavior="smooth",e.style.overscrollBehavior="contain",e.scroll(0,t),L(!0)},children:e("svg",{width:"14",height:"8",viewBox:"0 0 14 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M1.60372 0.555285C1.7256 0.716659 2.08951 1.1984 2.30624 1.47611C2.74031 2.03233 3.33342 2.77142 3.97323 3.50831C4.61627 4.24893 5.29178 4.97022 5.89189 5.50046C6.19281 5.76634 6.45714 5.96837 6.67527 6.09987C6.88042 6.22355 7.00161 6.24927 7.00161 6.24927C7.00161 6.24927 7.11923 6.22355 7.32437 6.09988C7.5425 5.96838 7.80684 5.76635 8.10775 5.50047C8.70786 4.97022 9.38337 4.24892 10.0264 3.5083C10.6662 2.7714 11.2593 2.0323 11.6934 1.47608C11.9101 1.19837 12.2735 0.717304 12.3954 0.555928C12.6411 0.222405 13.1111 0.150469 13.4446 0.396102C13.7781 0.641734 13.8494 1.11123 13.6037 1.44476L13.6018 1.4473C13.474 1.61655 13.0971 2.11556 12.8759 2.39892C12.4321 2.9677 11.8216 3.72861 11.1591 4.49171C10.4997 5.25109 9.77408 6.02979 9.10096 6.62454C8.76526 6.92116 8.42497 7.18788 8.0988 7.3845C7.79322 7.56872 7.40633 7.75 6.99982 7.75C6.59331 7.75 6.20642 7.56871 5.90084 7.3845C5.57468 7.18787 5.23439 6.92116 4.89869 6.62454C4.22557 6.02979 3.4999 5.2511 2.84058 4.49173C2.17803 3.72863 1.5676 2.96774 1.12372 2.39896C0.902432 2.11541 0.525506 1.61637 0.397929 1.44747L0.396279 1.44528C0.150645 1.11176 0.22154 0.641787 0.555062 0.396152C0.888572 0.150526 1.35808 0.221792 1.60372 0.555285Z",fill:"white"})})})]},v)},Qe="text";async function Ye(e,t,n){const o=new u("https://bcuserres.blob.core.windows.net?sv=2024-11-04&ss=b&srt=o&sp=rc&se=2027-12-31T19:19:59Z&st=2026-01-02T11:04:59Z&spr=https&sig=OqvZvcz%2FmvmhVS8gWqPpMBxDZXHbEZ%2BTQRpCT3bE3G0%3D",new m).getContainerClient("anonymous"),i=new Date,a=`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}`,r=o.getBlockBlobClient(`${a}/${h()}`);try{await r.uploadBrowserData(e,{onProgress:n=>{const o=Math.round(n.loadedBytes/e.size*100);t(o)},blockSize:4194304,concurrency:20,blobHTTPHeaders:{blobContentType:e.type}});n(r.url.split("?")[0])}catch(e){n(void 0,"Error uploading file:"+e.message)}}const Oe=c.span`
383
383
  cursor: pointer;
384
384
  width: 20px;
385
385
  height: 20px;
@@ -406,7 +406,7 @@ i {
406
406
  width: 100%;
407
407
  max-height: 200px;
408
408
  overflow-y: auto;
409
- `,tt=({file:n,isFileSelected:o,cancelFileUpload:i,config:a})=>{const r=f.SupportedImageFormats.indexOf(n.extension)>=0,s=f.SupportedAudioFormats.indexOf(n.extension)>=0;return t("div",{className:"bc-uploadFileDetails "+("AR"===a?.language?"bc-RTL":""),style:{border:o?"green dashed 1px":""},id:"uploadFileDetails",children:[e("div",{className:"bc-uploadedFile",style:{maxWidth:s?300:"auto",pointerEvents:s?"auto":"none"},children:r?e("img",{src:n.fileUrl,alt:"",className:"bc-imageFile"}):s?e("audio",{src:n.fileUrl,controls:!0,style:{height:28}}):e("img",{src:"data:image/png;base64,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",alt:"",className:"bc-documentFile"})}),e("div",{className:"bc-uploadFileName",children:e("span",{children:n.fileName})}),e("div",{className:"bc-uploadFileCancel",children:e("span",{onClick:()=>{try{n.blob&&n.fileUrl.startsWith("blob:")&&URL.revokeObjectURL(n.fileUrl)}catch{}i(n)},children:e($e,{})})})]})},nt=c.div`
409
+ `,tt=({file:n,isFileSelected:o,cancelFileUpload:i,config:a})=>{const r=f.SupportedImageFormats.indexOf(n.extension)>=0,l=f.SupportedAudioFormats.indexOf(n.extension)>=0;return t("div",{className:"bc-uploadFileDetails "+("AR"===a?.language?"bc-RTL":""),style:{border:o?"green dashed 1px":""},id:"uploadFileDetails",children:[e("div",{className:"bc-uploadedFile",style:{maxWidth:l?300:"auto",pointerEvents:l?"auto":"none"},children:r?e("img",{src:n.fileUrl,alt:"",className:"bc-imageFile"}):l?e("audio",{src:n.fileUrl,controls:!0,style:{height:28}}):e("img",{src:"data:image/png;base64,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",alt:"",className:"bc-documentFile"})}),e("div",{className:"bc-uploadFileName",children:e("span",{children:n.fileName})}),e("div",{className:"bc-uploadFileCancel",children:e("span",{onClick:()=>{try{n.blob&&n.fileUrl.startsWith("blob:")&&URL.revokeObjectURL(n.fileUrl)}catch{}i(n)},children:e($e,{})})})]})},nt=c.div`
410
410
  position: relative;
411
411
  width: 100%;
412
412
  direction: ${e=>e.isRTL?"rtl":"ltr"};
@@ -461,13 +461,13 @@ i {
461
461
  color: #b0b8c1;
462
462
  flex: 1;
463
463
  min-width: 0;
464
- `,st=c.span`
464
+ `,lt=c.span`
465
465
  flex-shrink: 0;
466
466
  display: flex;
467
467
  align-items: center;
468
468
  justify-content: center;
469
469
  color: #c5cdd6;
470
- `,lt=({text:n,setText:o,config:r,send:l,placeholder:c,autoCompleteEnabled:d,autoCompleteSuggestion:g,onInputChange:p,onAutoCompleteMutate:h})=>{const u=a(null),m="AR"===r?.language,C=i((()=>{const e=u.current;if(!e)return;e.style.height="20px";const t=e.scrollHeight;t!==e.offsetHeight&&(e.style.height=t+"px")}),[]);s((()=>{n||(C(),u.current?.focus())}),[C,n]),s((()=>{d&&u.current&&u.current.focus()}),[d,g]);const b=Boolean(d&&g),f=te[r.language]?.autoCompleteAcceptHint??te.EN.autoCompleteAcceptHint;return t(nt,{isRTL:m,children:[t(ot,{children:[e("textarea",{ref:u,value:n,className:"bc-messageInputTextArea",id:"textInput",placeholder:c,maxLength:1024,dir:m?"rtl":"ltr",onKeyDown:e=>{if(d&&g&&("Tab"===e.key||"ArrowRight"===e.key&&!e.shiftKey)){e.preventDefault();const t=(n||"")+g;return o(t),C(),p?.(t),void h?.(null)}if("Enter"===e.key&&(e.shiftKey||e.ctrlKey||e.altKey)){e.preventDefault();const t=u.current?.selectionStart||0,i=n.slice(0,t)+"\n"+n.slice(t);return o(i),C(),void p?.(i)}"Enter"===e.key&&(e.preventDefault(),l(),C())},onChange:e=>{const t=e.target.value,i=n||"";if(o(t),C(),p?.(t),d&&g&&h){const e=i+g;if(t&&e.toLowerCase().startsWith(t.toLowerCase())){const n=e.slice(t.length);n.length>0?h(n):h(null)}else h(null)}},style:{color:b?"transparent":void 0}}),b&&t("div",{className:"bc-autoCompleteOverlay",children:[n,e("span",{className:"bc-suggestion",children:g})]})]}),b&&t(at,{children:[e(st,{children:e(it,{})}),e(rt,{children:f})]})]})},ct=({config:n,send:o,file:i,isFileSelected:a,text:r,setText:s,cancelFileUpload:l,noteMode:c,onCloseNoteMode:d,notePlaceholder:g,autoCompleteEnabled:p,autoCompleteSuggestion:h,onInputChange:u,onAutoCompleteMutate:m})=>{const C="AR"===n?.language,b=Array.isArray(i)?i:i?[i]:[],f=b.length>0;return t("div",{className:"bc-messageInput "+(C?"bc-RTL":""),children:[c?e(qe,{onClick:d,isRTL:C,children:e(_e,{})}):null,f?e(et,{children:b.map(((t,o)=>e(tt,{file:t,isFileSelected:a,cancelFileUpload:l,config:n},`${t.fileName}-${o}-${t.fileUrl}`)))}):null,f?null:e(lt,{text:r||"",setText:s,config:n,send:o,placeholder:c?g||te[n.language]?.notePlaceholder:n.inputPlaceholder||te[n.language]?.placeholder,autoCompleteEnabled:p,autoCompleteSuggestion:h,onInputChange:u,onAutoCompleteMutate:m}),e(Oe,{onClick:()=>o(),isRTL:C,children:r||f?e(Xe,{}):null})]})},dt=(e,t)=>`\n &:hover {\n background-image: ${e.replaceAll("%23a3a3a3",t.activeColor)};\n }\n background-image: ${t.isActive?e.replaceAll("%23a3a3a3",t.activeColor):e};\n`,gt="\ndisplay: flex;\njustify-content: center;\nalign-items: center;\ngap: 4px;\nborder-radius: 8px;\nborder: 1px solid #D2D6DB;\nbackground: #FFF;\ntransition: background-color 0.2s ease, border-color 0.2s ease;\ncursor: pointer;\nfont-size: 14px;\n&:hover {\n background: #f7f7f7;\n border-color: #dcdcdc;\n}\n&:active {\n background: #f0f0f0;\n}\n";c.button`
470
+ `,st=({text:n,setText:o,config:r,send:s,placeholder:c,autoCompleteEnabled:d,autoCompleteSuggestion:g,onInputChange:p,onAutoCompleteMutate:h})=>{const u=a(null),m="AR"===r?.language,C=i((()=>{const e=u.current;if(!e)return;e.style.height="20px";const t=e.scrollHeight;t!==e.offsetHeight&&(e.style.height=t+"px")}),[]);l((()=>{n||(C(),u.current?.focus())}),[C,n]),l((()=>{d&&u.current&&u.current.focus()}),[d,g]);const b=Boolean(d&&g),f=te[r.language]?.autoCompleteAcceptHint??te.EN.autoCompleteAcceptHint;return t(nt,{isRTL:m,children:[t(ot,{children:[e("textarea",{ref:u,value:n,className:"bc-messageInputTextArea",id:"textInput",placeholder:c,maxLength:1024,dir:m?"rtl":"ltr",onKeyDown:e=>{if(d&&g&&("Tab"===e.key||"ArrowRight"===e.key&&!e.shiftKey)){e.preventDefault();const t=(n||"")+g;return o(t),C(),p?.(t),void h?.(null)}if("Enter"===e.key&&(e.shiftKey||e.ctrlKey||e.altKey)){e.preventDefault();const t=u.current?.selectionStart||0,i=n.slice(0,t)+"\n"+n.slice(t);return o(i),C(),void p?.(i)}"Enter"===e.key&&(e.preventDefault(),s(),C())},onChange:e=>{const t=e.target.value,i=n||"";if(o(t),C(),p?.(t),d&&g&&h){const e=i+g;if(t&&e.toLowerCase().startsWith(t.toLowerCase())){const n=e.slice(t.length);n.length>0?h(n):h(null)}else h(null)}},style:{color:b?"transparent":void 0}}),b&&t("div",{className:"bc-autoCompleteOverlay",children:[n,e("span",{className:"bc-suggestion",children:g})]})]}),b&&t(at,{children:[e(lt,{children:e(it,{})}),e(rt,{children:f})]})]})},ct=({config:n,send:o,file:i,isFileSelected:a,text:r,setText:l,cancelFileUpload:s,noteMode:c,onCloseNoteMode:d,notePlaceholder:g,autoCompleteEnabled:p,autoCompleteSuggestion:h,onInputChange:u,onAutoCompleteMutate:m})=>{const C="AR"===n?.language,b=Array.isArray(i)?i:i?[i]:[],f=b.length>0;return t("div",{className:"bc-messageInput "+(C?"bc-RTL":""),children:[c?e(qe,{onClick:d,isRTL:C,children:e(_e,{})}):null,f?e(et,{children:b.map(((t,o)=>e(tt,{file:t,isFileSelected:a,cancelFileUpload:s,config:n},`${t.fileName}-${o}-${t.fileUrl}`)))}):null,f?null:e(st,{text:r||"",setText:l,config:n,send:o,placeholder:c?g||te[n.language]?.notePlaceholder:n.inputPlaceholder||te[n.language]?.placeholder,autoCompleteEnabled:p,autoCompleteSuggestion:h,onInputChange:u,onAutoCompleteMutate:m}),e(Oe,{onClick:()=>o(),isRTL:C,children:r||f?e(Xe,{}):null})]})},dt=(e,t)=>`\n &:hover {\n background-image: ${e.replaceAll("%23a3a3a3",t.activeColor)};\n }\n background-image: ${t.isActive?e.replaceAll("%23a3a3a3",t.activeColor):e};\n`,gt="\ndisplay: flex;\njustify-content: center;\nalign-items: center;\ngap: 4px;\nborder-radius: 8px;\nborder: 1px solid #D2D6DB;\nbackground: #FFF;\ntransition: background-color 0.2s ease, border-color 0.2s ease;\ncursor: pointer;\nfont-size: 14px;\n&:hover {\n background: #f7f7f7;\n border-color: #dcdcdc;\n}\n&:active {\n background: #f0f0f0;\n}\n";c.button`
471
471
  ${gt}
472
472
  height: 32px;
473
473
  min-height: 32px;
@@ -520,15 +520,15 @@ i {
520
520
  align-items: center;
521
521
  gap: 5px;
522
522
  direction: ${e=>e.isRTL?"rtl":"ltr"};
523
- `;function wt(e){const t=new Int16Array(e.length);for(let n=0;n<e.length;n++){const o=Math.max(-1,Math.min(1,e[n]));t[n]=o<0?32768*o:32767*o}return t}const Mt=({setProgress:o,setError:l,setFile:c,onActiveChange:d,config:g})=>{const p="AR"===g?.language,[h,u]=r(!1),m=a(null),C=a([]),f=a(null),x=a(null),y=a(!1),v=i((()=>{f.current&&(f.current.getTracks().forEach((e=>e.stop())),f.current=null)}),[]);s((()=>()=>{const e=m.current;if(e&&"inactive"!==e.state)try{e.stop()}catch{}v()}),[v]);const w=i((async()=>{if(l(void 0),h){const e=m.current;if(e&&"inactive"!==e.state)try{e.stop()}catch(e){l(`Failed to stop recording: ${e?.message??"unknown error"}`)}return}if("undefined"==typeof MediaRecorder)return void l("Voice recording is not supported in this browser.");let e;try{e=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}})}catch(e){return l("NotAllowedError"===e?.name?"Microphone access denied. Please allow microphone access and try again.":"NotFoundError"===e?.name?"No microphone found. Please connect a microphone and try again.":`Microphone error: ${e?.message??"unknown error"}`),void(d&&d(!1))}f.current=e;const t=function(){if("undefined"==typeof MediaRecorder)return null;const e=[{mimeType:"audio/ogg;codecs=opus",extension:"ogg"},{mimeType:"audio/webm;codecs=opus",extension:"webm"},{mimeType:"audio/webm",extension:"webm"},{mimeType:"audio/mp4;codecs=mp4a.40.2",extension:"m4a"},{mimeType:"audio/mp4",extension:"m4a"}];for(const t of e)try{if(MediaRecorder.isTypeSupported(t.mimeType))return t}catch{}return{mimeType:"",extension:"webm"}}();let n;x.current=t;try{n=new MediaRecorder(e,t&&t.mimeType?{mimeType:t.mimeType,audioBitsPerSecond:yt}:{audioBitsPerSecond:yt})}catch(e){return v(),l(`Cannot start recording: ${e?.message??"unsupported format"}`),void(d&&d(!1))}C.current=[],y.current=!1,m.current=n,n.ondataavailable=e=>{e.data&&e.data.size>0&&C.current.push(e.data)},n.onerror=e=>{console.error("MediaRecorder error:",e),l(`Recording error: ${e?.error?.message??"unknown error"}`),v(),m.current=null,u(!1),d&&d(!1)},n.onstop=async()=>{const e=y.current;if(y.current=!1,v(),m.current=null,u(!1),e)return C.current=[],void(d&&d(!1));const t=x.current,o=n.mimeType||t?.mimeType||"audio/webm",i=t?.extension??o.split("/")[1]?.split(";")[0]??"webm",a=new Blob(C.current,{type:o});if(C.current=[],!a||0===a.size)return l("Invalid audio recording. Please try again."),void(d&&d(!1));if(a.size<1e3)return l("Recording seems too short. Please try again."),void(d&&d(!1));let r=a,s=o,g=i;if(o.startsWith("audio/webm"))try{r=await async function(e){const t=new(window.AudioContext||window.webkitAudioContext);try{const n=await e.arrayBuffer(),o=await t.decodeAudioData(n),i=Math.max(1,Math.min(2,o.numberOfChannels)),a=o.sampleRate,r=new b(i,a,128),s=1152,l=[];if(1===i){const e=wt(o.getChannelData(0));for(let t=0;t<e.length;t+=s){const n=e.subarray(t,t+s),o=r.encodeBuffer(n);o.length>0&&l.push(o)}}else{const e=wt(o.getChannelData(0)),t=wt(o.getChannelData(1));for(let n=0;n<e.length;n+=s){const o=e.subarray(n,n+s),i=t.subarray(n,n+s),a=r.encodeBuffer(o,i);a.length>0&&l.push(a)}}const c=r.flush();c.length>0&&l.push(c);const d=l.map((e=>{const t=new Uint8Array(e.byteLength);return t.set(e),t}));return new Blob(d,{type:"audio/mpeg"})}finally{"closed"!==t.state&&await t.close()}}(a),s="audio/mpeg",g="mp3"}catch(e){return l(`Failed to convert recording for WhatsApp: ${e?.message??"unknown error"}`),void(d&&d(!1))}const p=`recording-${(new Date).toISOString().replace(/[:.]/g,"-")}.${g}`,h=new File([r],p,{type:s}),f=URL.createObjectURL(h);c({fileUrl:f,fileName:p,extension:g,blob:h}),d&&d(!1)};try{n.start(),u(!0),d&&d(!0)}catch(e){v(),m.current=null,l(`Failed to start recording: ${e?.message??"unknown error"}`),d&&d(!1)}}),[h,l,c,d,v]),M=i((()=>{y.current=!0;const e=m.current;if(e&&"inactive"!==e.state)try{e.stop()}catch{}else v(),m.current=null,u(!1);C.current=[],l(void 0),d&&d(!1)}),[l,d,v]);return t(vt,{isRTL:p&&h,children:[h?e(pt,{onClick:M,children:e(xt,{})}):null,e(pt,{onClick:w,id:"voiceRecorderIcon",className:"mic-container",children:h?t(n,{children:[e(ft,{isRTL:p}),e(Ct,{className:"circle "+(h?"active":""),$isRecording:h,children:e(mt,{"aria-hidden":!0})})]}):e(ht,{activeColor:"var(--bc-chat-text-secondary-dark)"})})]})};const At=c.i`
523
+ `;function wt(e){const t=new Int16Array(e.length);for(let n=0;n<e.length;n++){const o=Math.max(-1,Math.min(1,e[n]));t[n]=o<0?32768*o:32767*o}return t}const Mt=({setProgress:o,setError:s,setFile:c,onActiveChange:d,config:g})=>{const p="AR"===g?.language,[h,u]=r(!1),m=a(null),C=a([]),f=a(null),x=a(null),y=a(!1),v=i((()=>{f.current&&(f.current.getTracks().forEach((e=>e.stop())),f.current=null)}),[]);l((()=>()=>{const e=m.current;if(e&&"inactive"!==e.state)try{e.stop()}catch{}v()}),[v]);const w=i((async()=>{if(s(void 0),h){const e=m.current;if(e&&"inactive"!==e.state)try{e.stop()}catch(e){s(`Failed to stop recording: ${e?.message??"unknown error"}`)}return}if("undefined"==typeof MediaRecorder)return void s("Voice recording is not supported in this browser.");let e;try{e=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}})}catch(e){return s("NotAllowedError"===e?.name?"Microphone access denied. Please allow microphone access and try again.":"NotFoundError"===e?.name?"No microphone found. Please connect a microphone and try again.":`Microphone error: ${e?.message??"unknown error"}`),void(d&&d(!1))}f.current=e;const t=function(){if("undefined"==typeof MediaRecorder)return null;const e=[{mimeType:"audio/ogg;codecs=opus",extension:"ogg"},{mimeType:"audio/webm;codecs=opus",extension:"webm"},{mimeType:"audio/webm",extension:"webm"},{mimeType:"audio/mp4;codecs=mp4a.40.2",extension:"m4a"},{mimeType:"audio/mp4",extension:"m4a"}];for(const t of e)try{if(MediaRecorder.isTypeSupported(t.mimeType))return t}catch{}return{mimeType:"",extension:"webm"}}();let n;x.current=t;try{n=new MediaRecorder(e,t&&t.mimeType?{mimeType:t.mimeType,audioBitsPerSecond:yt}:{audioBitsPerSecond:yt})}catch(e){return v(),s(`Cannot start recording: ${e?.message??"unsupported format"}`),void(d&&d(!1))}C.current=[],y.current=!1,m.current=n,n.ondataavailable=e=>{e.data&&e.data.size>0&&C.current.push(e.data)},n.onerror=e=>{console.error("MediaRecorder error:",e),s(`Recording error: ${e?.error?.message??"unknown error"}`),v(),m.current=null,u(!1),d&&d(!1)},n.onstop=async()=>{const e=y.current;if(y.current=!1,v(),m.current=null,u(!1),e)return C.current=[],void(d&&d(!1));const t=x.current,o=n.mimeType||t?.mimeType||"audio/webm",i=t?.extension??o.split("/")[1]?.split(";")[0]??"webm",a=new Blob(C.current,{type:o});if(C.current=[],!a||0===a.size)return s("Invalid audio recording. Please try again."),void(d&&d(!1));if(a.size<1e3)return s("Recording seems too short. Please try again."),void(d&&d(!1));let r=a,l=o,g=i;if(o.startsWith("audio/webm"))try{r=await async function(e){const t=new(window.AudioContext||window.webkitAudioContext);try{const n=await e.arrayBuffer(),o=await t.decodeAudioData(n),i=Math.max(1,Math.min(2,o.numberOfChannels)),a=o.sampleRate,r=new b(i,a,128),l=1152,s=[];if(1===i){const e=wt(o.getChannelData(0));for(let t=0;t<e.length;t+=l){const n=e.subarray(t,t+l),o=r.encodeBuffer(n);o.length>0&&s.push(o)}}else{const e=wt(o.getChannelData(0)),t=wt(o.getChannelData(1));for(let n=0;n<e.length;n+=l){const o=e.subarray(n,n+l),i=t.subarray(n,n+l),a=r.encodeBuffer(o,i);a.length>0&&s.push(a)}}const c=r.flush();c.length>0&&s.push(c);const d=s.map((e=>{const t=new Uint8Array(e.byteLength);return t.set(e),t}));return new Blob(d,{type:"audio/mpeg"})}finally{"closed"!==t.state&&await t.close()}}(a),l="audio/mpeg",g="mp3"}catch(e){return s(`Failed to convert recording for WhatsApp: ${e?.message??"unknown error"}`),void(d&&d(!1))}const p=`recording-${(new Date).toISOString().replace(/[:.]/g,"-")}.${g}`,h=new File([r],p,{type:l}),f=URL.createObjectURL(h);c({fileUrl:f,fileName:p,extension:g,blob:h}),d&&d(!1)};try{n.start(),u(!0),d&&d(!0)}catch(e){v(),m.current=null,s(`Failed to start recording: ${e?.message??"unknown error"}`),d&&d(!1)}}),[h,s,c,d,v]),M=i((()=>{y.current=!0;const e=m.current;if(e&&"inactive"!==e.state)try{e.stop()}catch{}else v(),m.current=null,u(!1);C.current=[],s(void 0),d&&d(!1)}),[s,d,v]);return t(vt,{isRTL:p&&h,children:[h?e(pt,{onClick:M,children:e(xt,{})}):null,e(pt,{onClick:w,id:"voiceRecorderIcon",className:"mic-container",children:h?t(n,{children:[e(ft,{isRTL:p}),e(Ct,{className:"circle "+(h?"active":""),$isRecording:h,children:e(mt,{"aria-hidden":!0})})]}):e(ht,{activeColor:"var(--bc-chat-text-secondary-dark)"})})]})};const At=c.i`
524
524
  ${e=>dt('url("data:image/svg+xml,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M10%2019.084C15.0163%2019.0838%2019.0838%2015.0163%2019.084%2010C19.0838%204.98367%2015.0163%200.917168%2010%200.916992C4.98367%200.917168%200.917168%204.98367%200.916992%2010C0.917168%2015.0163%204.98367%2019.0838%2010%2019.084ZM10%2017.584C5.8121%2017.5838%202.41717%2014.1879%202.41699%2010C2.41717%205.8121%205.8121%202.41717%2010%202.41699C14.1879%202.41717%2017.5838%205.8121%2017.584%2010C17.5838%2014.1879%2014.1879%2017.5838%2010%2017.584ZM6.6748%208.5C7.22679%208.49964%207.6748%208.05206%207.6748%207.5C7.6748%206.94794%207.22679%206.50036%206.6748%206.5H6.66699C6.11471%206.5%205.66699%206.94771%205.66699%207.5C5.66699%208.05229%206.11471%208.5%206.66699%208.5H6.6748ZM13.334%208.5C13.886%208.49965%2014.334%208.05207%2014.334%207.5C14.334%206.94793%2013.886%206.50035%2013.334%206.5H13.3262C12.7739%206.50001%2012.3262%206.94772%2012.3262%207.5C12.3262%208.05228%2012.7739%208.49999%2013.3262%208.5H13.334ZM10%2014.917C11.6088%2014.9169%2013.038%2014.1426%2013.9336%2012.9502C14.1819%2012.6191%2014.115%2012.1491%2013.7842%2011.9004C13.453%2011.6517%2012.9832%2011.7188%2012.7344%2012.0498C12.1099%2012.8813%2011.117%2013.4169%2010%2013.417C8.88307%2013.4169%207.89111%2012.8811%207.2666%2012.0498C7.01792%2011.7187%206.54798%2011.6519%206.2168%2011.9004C5.88563%2012.1491%205.81871%2012.619%206.06738%2012.9502C6.96298%2014.1425%208.39126%2014.9169%2010%2014.917Z%22%20fill%3D%22%23161616%22%2F%3E%3C%2Fsvg%3E");',e)}
525
525
  `,kt=c.span`
526
526
  margin: 8px;
527
527
  cursor: pointer;
528
528
  font-size: var(--bc-chat-fontSize-xl);
529
- `,Lt=({onClick:t})=>e("div",{id:"emojiIcon",children:e(pt,{children:e(At,{onClick:t,activeColor:"var(--bc-chat-text-secondary-dark)"})})}),It=({text:t,setText:n,onClick:o})=>{const r=function(e){const t=a(null);return s((()=>{const n=n=>{t.current&&!t.current.contains(n.target)&&e()};return document.addEventListener("mousedown",n),document.addEventListener("touchstart",n),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}}),[e]),t}(o),l=i((e=>{n(t+e)}),[n,t]),c=y.map(((t,n)=>e(kt,{className:"emoji",onClick:e=>l(e.target.innerText),children:t},"emoji"+n)));return e("div",{ref:r,children:e("div",{className:"bc-emojiPicker",id:"emojiPicker",children:c})})},Et=c.i`
529
+ `,Lt=({onClick:t})=>e("div",{id:"emojiIcon",children:e(pt,{children:e(At,{onClick:t,activeColor:"var(--bc-chat-text-secondary-dark)"})})}),It=({text:t,setText:n,onClick:o})=>{const r=function(e){const t=a(null);return l((()=>{const n=n=>{t.current&&!t.current.contains(n.target)&&e()};return document.addEventListener("mousedown",n),document.addEventListener("touchstart",n),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}}),[e]),t}(o),s=i((e=>{n(t+e)}),[n,t]),c=y.map(((t,n)=>e(kt,{className:"emoji",onClick:e=>s(e.target.innerText),children:t},"emoji"+n)));return e("div",{ref:r,children:e("div",{className:"bc-emojiPicker",id:"emojiPicker",children:c})})},Et=c.i`
530
530
  ${e=>dt('url("data:image/svg+xml,%3Csvg%20width%3D%2214%22%20height%3D%2218%22%20viewBox%3D%220%200%2014%2018%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M4.91667%202.12488C2.96066%202.12488%201.375%203.71054%201.375%205.66655L1.375%2010.2499C1.375%2013.3565%203.8934%2015.8749%207%2015.8749C10.1066%2015.8749%2012.625%2013.3565%2012.625%2010.2499V8.99993C12.625%208.65475%2012.9048%208.37493%2013.25%208.37493C13.5952%208.37493%2013.875%208.65475%2013.875%208.99993V10.2499C13.875%2014.0469%2010.797%2017.1249%207%2017.1249C3.20304%2017.1249%200.125%2014.0469%200.125%2010.2499L0.125%205.66655C0.125%203.02018%202.2703%200.874878%204.91667%200.874878C7.56303%200.874878%209.70833%203.02018%209.70833%205.66654V10.2499C9.70833%2011.7456%208.49577%2012.9582%207%2012.9582C5.50423%2012.9582%204.29167%2011.7456%204.29167%2010.2499L4.29167%206.91654C4.29167%206.57137%204.57149%206.29154%204.91667%206.29154C5.26184%206.29154%205.54167%206.57137%205.54167%206.91654L5.54167%2010.2499C5.54167%2011.0553%206.19458%2011.7082%207%2011.7082C7.80542%2011.7082%208.45833%2011.0553%208.45833%2010.2499V5.66654C8.45833%203.71054%206.87267%202.12488%204.91667%202.12488Z%22%20fill%3D%22%23161616%22%2F%3E%3C%2Fsvg%3E");',e)}
531
- `,Rt=({setProgress:n,setFile:o,setError:a})=>{const r=i((e=>{a(void 0);const t=Array.from(e.target.files);if(e.target.value="",t.length<1)return;const i=[];for(const e of t){const{name:t,size:n}=e,o=t.substring(t.lastIndexOf(".")+1).toLowerCase();if(f.SupportedFormats.indexOf(o)<0){a(`File "${t}" type is not valid.`);continue}if(n>f.MaxFileSize){a(`File "${t}" exceeds maximum limit of 20 MBs.`);continue}const r={fileUrl:URL.createObjectURL(e),fileName:t,extension:o,blob:e};i.push({file:e,bcFile:r})}if(0===i.length)return;o((e=>[...e,...i.map((({bcFile:e})=>e))]));let r=0;const s=[];i.forEach((({file:e,bcFile:t})=>{Ye(e,n,((e,l)=>{if(r++,e){try{URL.revokeObjectURL(t.fileUrl)}catch{}const n={...t,fileUrl:e,blob:void 0};s.push(n),o((e=>e.map((e=>e.fileName===t.fileName&&e.fileUrl===t.fileUrl?n:e))))}else l&&(o((e=>{const n=e.filter((e=>!(e.fileName===t.fileName&&e.fileUrl===t.fileUrl)));try{URL.revokeObjectURL(t.fileUrl)}catch{}return n})),a(`Failed to upload "${t.fileName}": ${l}`));r===i.length&&n(0)}))}))}),[n,o,a]),s=i((()=>{a(void 0)}),[a]);return t("div",{id:"attachIcon",children:[e(pt,{htmlFor:"fileInput",onClick:s,children:e(Et,{activeColor:"var(--bc-chat-text-secondary-dark)"})}),e("input",{type:"file",className:"bc-fileUpload",id:"fileInput",multiple:!0,onChange:r,onClick:s})]})},St=c.div`
531
+ `,Rt=({setProgress:n,setFile:o,setError:a})=>{const r=i((e=>{a(void 0);const t=Array.from(e.target.files);if(e.target.value="",t.length<1)return;const i=[];for(const e of t){const{name:t,size:n}=e,o=t.substring(t.lastIndexOf(".")+1).toLowerCase();if(f.SupportedFormats.indexOf(o)<0){a(`File "${t}" type is not valid.`);continue}if(n>f.MaxFileSize){a(`File "${t}" exceeds maximum limit of 20 MBs.`);continue}const r={fileUrl:URL.createObjectURL(e),fileName:t,extension:o,blob:e};i.push({file:e,bcFile:r})}if(0===i.length)return;o((e=>[...e,...i.map((({bcFile:e})=>e))]));let r=0;const l=[];i.forEach((({file:e,bcFile:t})=>{Ye(e,n,((e,s)=>{if(r++,e){try{URL.revokeObjectURL(t.fileUrl)}catch{}const n={...t,fileUrl:e,blob:void 0};l.push(n),o((e=>e.map((e=>e.fileName===t.fileName&&e.fileUrl===t.fileUrl?n:e))))}else s&&(o((e=>{const n=e.filter((e=>!(e.fileName===t.fileName&&e.fileUrl===t.fileUrl)));try{URL.revokeObjectURL(t.fileUrl)}catch{}return n})),a(`Failed to upload "${t.fileName}": ${s}`));r===i.length&&n(0)}))}))}),[n,o,a]),l=i((()=>{a(void 0)}),[a]);return t("div",{id:"attachIcon",children:[e(pt,{htmlFor:"fileInput",onClick:l,children:e(Et,{activeColor:"var(--bc-chat-text-secondary-dark)"})}),e("input",{type:"file",className:"bc-fileUpload",id:"fileInput",multiple:!0,onChange:r,onClick:l})]})},St=c.div`
532
532
  padding: 0px 0px 0px 10px;
533
533
  margin: 0px;
534
534
  width: fit-content;
@@ -547,7 +547,7 @@ i {
547
547
  cursor: pointer;
548
548
  display: block;
549
549
  }
550
- `,Ft=({setView:o,setFile:i,setProgress:a,setError:s,text:l,setText:c,send:d,config:g})=>{const[p,h]=r(!1),[u,m]=r(!1);return t("div",{className:"bc-inputActions",id:"bc-inputActions",children:[t(St,{id:"iconsContainer",isRTL:"AR"===g?.language,children:[u?null:t(n,{children:[e(Rt,{setFile:i,setProgress:a,setError:s}),e(Lt,{onClick:()=>h(!0)})]}),e(Mt,{setFile:i,setError:s,setProgress:a,onActiveChange:e=>{m(e),e&&h(!1)},config:g})]}),p?e(It,{text:l,setText:c,onClick:()=>h(!1)}):null]})};Fe('.bc-trademark {\n height: 40px;\n width: 100%;\n box-shadow: 0 0 30px 0 rgba(0, 0, 0, 0.1);\n background-color: #fff;\n overflow-y: hidden;\n border-bottom-left-radius: 15px;\n border-bottom-right-radius: 15px;\n padding: 15px 0;\n}\n\n.bc-messageInput {\n min-height: 30px;\n max-height: 100%;\n background-color: #fff;\n overflow-y: hidden;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n.bc-messageInput .bc-messageInputTextArea {\n color: var(--bc-chat-text-secondary-dark);\n display: block;\n min-height: 36px;\n background-color: #fff;\n box-sizing: border-box;\n font-family: var(--bc-chat-font-stack);\n font-size: var(--bc-chat-fontSize-md);\n padding: 10px 0;\n resize: none;\n overflow: auto;\n border-width: 0;\n width: calc(100% - 20px);\n word-wrap: break-word;\n border: none;\n overflow: hidden;\n outline: none;\n -webkit-box-shadow: none;\n -moz-box-shadow: none;\n box-shadow: none;\n}\n.bc-messageInput.bc-RTL {\n direction: rtl;\n}\n\n.bc-inputActions {\n display: flex;\n align-items: center;\n position: relative;\n width: fit-content;\n height: 36px;\n margin-left: auto;\n}\n.bc-inputActions .bc-fileUpload {\n display: none;\n}\n.bc-inputActions i {\n display: block;\n margin: 0 5px;\n}\n.bc-inputActions.bc-RTL {\n direction: rtl;\n}\n\n.bc-ActionChips {\n display: flex;\n gap: 10px;\n}\n\n.bc-BottomBar {\n width: 100%;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n padding-top: 8px;\n}\n.bc-BottomBar.bc-RTL {\n direction: rtl;\n}\n\n.bc-CommandsArea {\n margin-left: auto;\n display: flex;\n align-items: center;\n}\n.bc-CommandsArea.bc-RTL {\n margin-left: 0;\n margin-right: auto;\n direction: rtl;\n}\n\n.bc-emojiPicker {\n position: absolute;\n bottom: 40px;\n right: 0;\n width: 200px;\n background: var(--bc-chat-white-color) 0% 0% no-repeat padding-box;\n box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.1019607843);\n border-radius: 10px;\n opacity: 1;\n padding: 10px;\n z-index: 10;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n}\n[dir=rtl] .bc-emojiPicker, .bc-RTL .bc-emojiPicker {\n right: auto;\n left: 0;\n}\n\n.bc-uploadFileDetails {\n background-color: transparent;\n display: flex;\n align-items: center;\n width: calc(100% - 60px);\n height: 40px;\n padding: 4px 10px;\n}\n.bc-uploadFileDetails.bc-RTL {\n direction: rtl;\n}\n.bc-uploadFileDetails audio {\n width: 260px;\n}\n.bc-uploadFileDetails .bc-uploadedFile {\n max-width: 32px;\n max-height: 32px;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadedFile .bc-imageFile {\n max-width: 100%;\n max-height: 100%;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadedFile .bc-documentFile {\n max-width: 100%;\n max-height: 100%;\n margin-top: 4px;\n min-width: 25px;\n min-height: 25px;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadFileName {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadFileName span {\n padding: 10px;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadFileCancel {\n cursor: pointer;\n margin-bottom: -6px;\n margin-left: 6px;\n color: var(--bc-chat-danger-color);\n}\n[dir=rtl] .bc-uploadFileDetails .bc-uploadFileCancel, .bc-RTL .bc-uploadFileDetails .bc-uploadFileCancel {\n margin-left: 0;\n margin-right: 6px;\n}\n\n.mic-container {\n position: relative;\n}\n.mic-container svg {\n z-index: 5;\n}\n.mic-container i {\n transition: 0.9s;\n z-index: 10;\n position: relative;\n}\n.mic-container .circle {\n z-index: 4;\n top: 3px;\n left: 3px;\n position: absolute;\n background-color: transparent;\n width: 24px;\n height: 24px;\n border-radius: 50%;\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 1;\n transition: 0.5s;\n}\n.mic-container .circle:before {\n content: "";\n width: 36px;\n height: 36px;\n border-radius: 50%;\n opacity: 0.5;\n z-index: 3;\n position: absolute;\n}\n.mic-container .circle.active {\n background-color: #A8E6A3;\n}\n.mic-container .circle.active:before {\n background: #A8E6A3;\n}\n\n@keyframes bounce {\n 0% {\n transform: scale(1);\n }\n 25% {\n transform: scale(1.4);\n }\n 75% {\n transform: scale(1);\n }\n 100% {\n transform: scale(1.3);\n }\n}');const Bt=c.div`
550
+ `,Ft=({setView:o,setFile:i,setProgress:a,setError:l,text:s,setText:c,send:d,config:g})=>{const[p,h]=r(!1),[u,m]=r(!1);return t("div",{className:"bc-inputActions",id:"bc-inputActions",children:[t(St,{id:"iconsContainer",isRTL:"AR"===g?.language,children:[u?null:t(n,{children:[e(Rt,{setFile:i,setProgress:a,setError:l}),e(Lt,{onClick:()=>h(!0)})]}),e(Mt,{setFile:i,setError:l,setProgress:a,onActiveChange:e=>{m(e),e&&h(!1)},config:g})]}),p?e(It,{text:s,setText:c,onClick:()=>h(!1)}):null]})};Fe('.bc-trademark {\n height: 40px;\n width: 100%;\n box-shadow: 0 0 30px 0 rgba(0, 0, 0, 0.1);\n background-color: #fff;\n overflow-y: hidden;\n border-bottom-left-radius: 15px;\n border-bottom-right-radius: 15px;\n padding: 15px 0;\n}\n\n.bc-messageInput {\n min-height: 30px;\n max-height: 100%;\n background-color: #fff;\n overflow-y: hidden;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n.bc-messageInput .bc-messageInputTextArea {\n color: var(--bc-chat-text-secondary-dark);\n display: block;\n min-height: 36px;\n background-color: #fff;\n box-sizing: border-box;\n font-family: var(--bc-chat-font-stack);\n font-size: var(--bc-chat-fontSize-md);\n padding: 10px 0;\n resize: none;\n overflow: auto;\n border-width: 0;\n width: calc(100% - 20px);\n word-wrap: break-word;\n border: none;\n overflow: hidden;\n outline: none;\n -webkit-box-shadow: none;\n -moz-box-shadow: none;\n box-shadow: none;\n}\n.bc-messageInput.bc-RTL {\n direction: rtl;\n}\n\n.bc-inputActions {\n display: flex;\n align-items: center;\n position: relative;\n width: fit-content;\n height: 36px;\n margin-left: auto;\n}\n.bc-inputActions .bc-fileUpload {\n display: none;\n}\n.bc-inputActions i {\n display: block;\n margin: 0 5px;\n}\n.bc-inputActions.bc-RTL {\n direction: rtl;\n}\n\n.bc-ActionChips {\n display: flex;\n gap: 10px;\n}\n\n.bc-BottomBar {\n width: 100%;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n padding-top: 8px;\n}\n.bc-BottomBar.bc-RTL {\n direction: rtl;\n}\n\n.bc-CommandsArea {\n margin-left: auto;\n display: flex;\n align-items: center;\n}\n.bc-CommandsArea.bc-RTL {\n margin-left: 0;\n margin-right: auto;\n direction: rtl;\n}\n\n.bc-emojiPicker {\n position: absolute;\n bottom: 40px;\n right: 0;\n width: 200px;\n background: var(--bc-chat-white-color) 0% 0% no-repeat padding-box;\n box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.1019607843);\n border-radius: 10px;\n opacity: 1;\n padding: 10px;\n z-index: 10;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n}\n[dir=rtl] .bc-emojiPicker, .bc-RTL .bc-emojiPicker {\n right: auto;\n left: 0;\n}\n\n.bc-uploadFileDetails {\n background-color: transparent;\n display: flex;\n align-items: center;\n width: calc(100% - 60px);\n height: 40px;\n padding: 4px 10px;\n}\n.bc-uploadFileDetails.bc-RTL {\n direction: rtl;\n}\n.bc-uploadFileDetails audio {\n width: 260px;\n}\n.bc-uploadFileDetails .bc-uploadedFile {\n max-width: 32px;\n max-height: 32px;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadedFile .bc-imageFile {\n max-width: 100%;\n max-height: 100%;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadedFile .bc-documentFile {\n max-width: 100%;\n max-height: 100%;\n margin-top: 4px;\n min-width: 25px;\n min-height: 25px;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadFileName {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadFileName span {\n padding: 10px;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadFileCancel {\n cursor: pointer;\n margin-bottom: -6px;\n margin-left: 6px;\n color: var(--bc-chat-danger-color);\n}\n[dir=rtl] .bc-uploadFileDetails .bc-uploadFileCancel, .bc-RTL .bc-uploadFileDetails .bc-uploadFileCancel {\n margin-left: 0;\n margin-right: 6px;\n}\n\n.mic-container {\n position: relative;\n}\n.mic-container svg {\n z-index: 5;\n}\n.mic-container i {\n transition: 0.9s;\n z-index: 10;\n position: relative;\n}\n.mic-container .circle {\n z-index: 4;\n top: 3px;\n left: 3px;\n position: absolute;\n background-color: transparent;\n width: 24px;\n height: 24px;\n border-radius: 50%;\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 1;\n transition: 0.5s;\n}\n.mic-container .circle:before {\n content: "";\n width: 36px;\n height: 36px;\n border-radius: 50%;\n opacity: 0.5;\n z-index: 3;\n position: absolute;\n}\n.mic-container .circle.active {\n background-color: #A8E6A3;\n}\n.mic-container .circle.active:before {\n background: #A8E6A3;\n}\n\n@keyframes bounce {\n 0% {\n transform: scale(1);\n }\n 25% {\n transform: scale(1.4);\n }\n 75% {\n transform: scale(1);\n }\n 100% {\n transform: scale(1.3);\n }\n}');const Dt=c.div`
551
551
  display: flex;
552
552
  padding: 8px 16px 16px 16px;
553
553
  flex-direction: column;
@@ -571,7 +571,7 @@ i {
571
571
  margin-top: 6px;
572
572
  text-align: center;
573
573
  }
574
- `,Dt=c.div`
574
+ `,Bt=c.div`
575
575
  width: 100%;
576
576
  padding: 8px 12px;
577
577
  display: flex;
@@ -622,7 +622,7 @@ i {
622
622
  color: #111827;
623
623
  outline: none;
624
624
  }
625
- `,Ht=()=>e("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M8 6.58579L11.2929 3.29289C11.6834 2.90237 12.3166 2.90237 12.7071 3.29289C13.0976 3.68342 13.0976 4.31658 12.7071 4.70711L9.41421 8L12.7071 11.2929C13.0976 11.6834 13.0976 12.3166 12.7071 12.7071C12.3166 13.0976 11.6834 13.0976 11.2929 12.7071L8 9.41421L4.70711 12.7071C4.31658 13.0976 3.68342 13.0976 3.29289 12.7071C2.90237 12.3166 2.90237 11.6834 3.29289 11.2929L6.58579 8L3.29289 4.70711C2.90237 4.31658 2.90237 3.68342 3.29289 3.29289C3.68342 2.90237 4.31658 2.90237 4.70711 3.29289L8 6.58579Z",fill:"currentColor"})}),jt=({config:n,sendMessage:a,setView:l,actionChips:c,noteMode:d,onNoteSend:g,onCloseNoteMode:p,notePlaceholder:h,replyMessageTitle:u,replyMessageContent:m,onCancelReplyMessage:C,autoCompleteEnabled:b,autoCompleteSuggestion:x,onInputChange:y,onAutoCompleteMutate:v})=>{const w="AR"===n?.language,[M,A]=r(),[k,L]=r([]),[I,E]=r(),[R,S]=r(0),F=o((()=>Boolean(u||m)),[u,m]),B=o((()=>u||("AR"===n?.language?"الرد على رسالة":"TR"===n?.language?"Bir mesaja yanıt veriliyor":"Replying to message")),[n?.language,u]),D=o((()=>"AR"===n?.language?"إلغاء":"TR"===n?.language?"İptal":"Cancel"),[n?.language]);s((()=>{I&&M&&M.trim().length>0&&E(void 0)}),[I,M]),s((()=>{const e=Array.isArray(k)?k:k?[k]:[];I&&e.length>0&&E(void 0)}),[k,I]);const z=i((e=>{if(d){const e=(M||"").trim();return g&&g(e),void A("")}const t=e=>{const{fileUrl:t,extension:n}=e;a(f.SupportedImageFormats.indexOf(n)>=0?"image":f.SupportedAudioFormats.indexOf(n)>=0?"audio":"document",t)};if(e)return void(e.blob&&e.fileUrl.startsWith("blob:")?Ye(e.blob,S,((n,o)=>{if(n){try{URL.revokeObjectURL(e.fileUrl)}catch{}t({...e,fileUrl:n,blob:void 0})}else o&&E(o)})):t(e));const n=Array.isArray(k)?k:k?[k]:[];if(n.length>0){const e=n.filter((e=>e.blob&&e.fileUrl.startsWith("blob:"))),o=n.filter((e=>!e.blob||!e.fileUrl.startsWith("blob:")));let i=o.length+e.length,a=0;o.forEach((e=>{t(e),a++})),e.length>0?e.forEach((e=>{Ye(e.blob,S,((n,o)=>{if(a++,n){try{URL.revokeObjectURL(e.fileUrl)}catch{}t({...e,fileUrl:n,blob:void 0})}else o&&E(`Failed to upload "${e.fileName}": ${o}`);a===i&&(L([]),S(0))}))})):L([])}else a(Qe,M),A("")}),[k,M,a,d,g,L,E,S]);return t(Bt,{isRTL:w,children:[F?t(Dt,{isRTL:w,children:[t(zt,{isRTL:w,children:[B?e(Nt,{children:B}):null,C?e(Zt,{type:"button",onClick:C,"aria-label":D,title:D,children:e(Ht,{})}):null]}),m?e(Tt,{children:m}):null]}):null,e("div",{className:"bc-InputArea",children:e(ct,{config:n,send:z,text:M,setText:A,file:d?void 0:k,isFileSelected:Array.isArray(k)?k.length>0:!!k,cancelFileUpload:e=>{L(e?t=>{const n=(Array.isArray(t)?t:t?[t]:[]).filter((t=>!(t.fileName===e.fileName&&t.fileUrl===e.fileUrl)));if(e.blob&&e.fileUrl.startsWith("blob:"))try{URL.revokeObjectURL(e.fileUrl)}catch{}return n}:e=>((Array.isArray(e)?e:e?[e]:[]).forEach((e=>{if(e.blob&&e.fileUrl.startsWith("blob:"))try{URL.revokeObjectURL(e.fileUrl)}catch{}})),[]))},noteMode:d,onCloseNoteMode:()=>{A(""),p?.()},notePlaceholder:h,autoCompleteEnabled:b,autoCompleteSuggestion:x,onInputChange:y,onAutoCompleteMutate:v})}),t("div",{className:"bc-BottomBar "+(w?"bc-RTL":""),children:[void 0!==c?c:null,e("div",{className:"bc-CommandsArea "+(w?"bc-RTL":""),children:d?null:e(Ft,{setView:l,setFile:L,setProgress:S,setError:E,setText:A,text:M,send:z,config:n})})]}),I?e("div",{className:"bc-uploadFileError",children:I}):null]})},Pt="bc-chat-header-banner",Ut=390,Vt=c.div`
625
+ `,Ht=()=>e("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M8 6.58579L11.2929 3.29289C11.6834 2.90237 12.3166 2.90237 12.7071 3.29289C13.0976 3.68342 13.0976 4.31658 12.7071 4.70711L9.41421 8L12.7071 11.2929C13.0976 11.6834 13.0976 12.3166 12.7071 12.7071C12.3166 13.0976 11.6834 13.0976 11.2929 12.7071L8 9.41421L4.70711 12.7071C4.31658 13.0976 3.68342 13.0976 3.29289 12.7071C2.90237 12.3166 2.90237 11.6834 3.29289 11.2929L6.58579 8L3.29289 4.70711C2.90237 4.31658 2.90237 3.68342 3.29289 3.29289C3.68342 2.90237 4.31658 2.90237 4.70711 3.29289L8 6.58579Z",fill:"currentColor"})}),jt=({config:n,sendMessage:s,setView:c,actionChips:d,noteMode:g,onNoteSend:p,onCloseNoteMode:h,notePlaceholder:u,replyMessageTitle:m,replyMessageContent:C,onCancelReplyMessage:b,autoCompleteEnabled:x,autoCompleteSuggestion:y,onInputChange:v,onAutoCompleteMutate:w,autoCompleteReplaceDraft:M,autoCompleteReplaceDraftKey:A})=>{const k="AR"===n?.language,[L,I]=r(),E=a(v),R=a(w);l((()=>{E.current=v}),[v]),l((()=>{R.current=w}),[w]),l((()=>{void 0!==M&&(R.current?.(null),I(M),E.current?.(M))}),[M,A]);const[S,F]=r([]),[D,B]=r(),[z,N]=r(0),T=o((()=>Boolean(m||C)),[m,C]),Z=o((()=>m||("AR"===n?.language?"الرد على رسالة":"TR"===n?.language?"Bir mesaja yanıt veriliyor":"Replying to message")),[n?.language,m]),H=o((()=>"AR"===n?.language?"إلغاء":"TR"===n?.language?"İptal":"Cancel"),[n?.language]);l((()=>{D&&L&&L.trim().length>0&&B(void 0)}),[D,L]),l((()=>{const e=Array.isArray(S)?S:S?[S]:[];D&&e.length>0&&B(void 0)}),[S,D]);const j=i((e=>{if(g){const e=(L||"").trim();return p&&p(e),void I("")}const t=e=>{const{fileUrl:t,extension:n}=e;s(f.SupportedImageFormats.indexOf(n)>=0?"image":f.SupportedAudioFormats.indexOf(n)>=0?"audio":"document",t)};if(e)return void(e.blob&&e.fileUrl.startsWith("blob:")?Ye(e.blob,N,((n,o)=>{if(n){try{URL.revokeObjectURL(e.fileUrl)}catch{}t({...e,fileUrl:n,blob:void 0})}else o&&B(o)})):t(e));const n=Array.isArray(S)?S:S?[S]:[];if(n.length>0){const e=n.filter((e=>e.blob&&e.fileUrl.startsWith("blob:"))),o=n.filter((e=>!e.blob||!e.fileUrl.startsWith("blob:")));let i=o.length+e.length,a=0;o.forEach((e=>{t(e),a++})),e.length>0?e.forEach((e=>{Ye(e.blob,N,((n,o)=>{if(a++,n){try{URL.revokeObjectURL(e.fileUrl)}catch{}t({...e,fileUrl:n,blob:void 0})}else o&&B(`Failed to upload "${e.fileName}": ${o}`);a===i&&(F([]),N(0))}))})):F([])}else s(Qe,L),I("")}),[S,L,s,g,p,F,B,N]);return t(Dt,{isRTL:k,children:[T?t(Bt,{isRTL:k,children:[t(zt,{isRTL:k,children:[Z?e(Nt,{children:Z}):null,b?e(Zt,{type:"button",onClick:b,"aria-label":H,title:H,children:e(Ht,{})}):null]}),C?e(Tt,{children:C}):null]}):null,e("div",{className:"bc-InputArea",children:e(ct,{config:n,send:j,text:L,setText:I,file:g?void 0:S,isFileSelected:Array.isArray(S)?S.length>0:!!S,cancelFileUpload:e=>{F(e?t=>{const n=(Array.isArray(t)?t:t?[t]:[]).filter((t=>!(t.fileName===e.fileName&&t.fileUrl===e.fileUrl)));if(e.blob&&e.fileUrl.startsWith("blob:"))try{URL.revokeObjectURL(e.fileUrl)}catch{}return n}:e=>((Array.isArray(e)?e:e?[e]:[]).forEach((e=>{if(e.blob&&e.fileUrl.startsWith("blob:"))try{URL.revokeObjectURL(e.fileUrl)}catch{}})),[]))},noteMode:g,onCloseNoteMode:()=>{I(""),h?.()},notePlaceholder:u,autoCompleteEnabled:x,autoCompleteSuggestion:y,onInputChange:v,onAutoCompleteMutate:w})}),t("div",{className:"bc-BottomBar "+(k?"bc-RTL":""),children:[void 0!==d?d:null,e("div",{className:"bc-CommandsArea "+(k?"bc-RTL":""),children:g?null:e(Ft,{setView:c,setFile:F,setProgress:N,setError:B,setText:I,text:L,send:j,config:n})})]}),D?e("div",{className:"bc-uploadFileError",children:D}):null]})},Pt="bc-chat-header-banner",Ut=390,Vt=c.div`
626
626
  ${e=>e.bannerWidth>Ut?"height: 60px;":"height: 90px;"}
627
627
  display: block;
628
628
  width: 100%;
@@ -680,7 +680,7 @@ i {
680
680
  }
681
681
  `,Qt=c.i`
682
682
  background-image: url("data:image/svg+xml;base64,PHN2ZyBpZD0ibWluaW1pemUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxLjgxNyIgdmlld0JveD0iMCAwIDE2IDEuODE3Ij4KICA8ZGVmcz4KICAgIDxjbGlwUGF0aCBpZD0iY2xpcC1wYXRoIj4KICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZV82OCIgZGF0YS1uYW1lPSJSZWN0YW5nbGUgNjgiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxLjgxNyIgZmlsbD0iIzAwMCIvPgogICAgPC9jbGlwUGF0aD4KICA8L2RlZnM+CiAgPGcgaWQ9Ikdyb3VwXzMwMSIgZGF0YS1uYW1lPSJHcm91cCAzMDEiIGNsaXAtcGF0aD0idXJsKCNjbGlwLXBhdGgpIj4KICAgIDxwYXRoIGlkPSJQYXRoXzgwNCIgZGF0YS1uYW1lPSJQYXRoIDgwNCIgZD0iTTE1LjM5NCwyLjIxMUguNjA2QS42MDYuNjA2LDAsMSwxLC42MDYsMUgxNS4zOTRhLjYwNi42MDYsMCwwLDEsMCwxLjIxMSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAtMC4zOTQpIiBmaWxsPSIjZmZmIi8+CiAgPC9nPgo8L3N2Zz4K");
683
- `,Yt=({config:n,minimize:o})=>{const[i,a]=r();return s((()=>{new ResizeObserver((()=>{const e=document.getElementById(Pt)?.offsetWidth;e&&e>50&&e!==i&&a(e)})).observe(document.getElementById(Pt))}),[]),e(Vt,{bannerWidth:i,className:"bc-header",children:e(Gt,{className:"bc-banner",id:Pt,startColor:"#065A60",endColor:"#006466",bannerWidth:i,children:t(Jt,{className:"bc-bannerContents",children:[t(Kt,{className:"bc-companyInfo",bannerWidth:i,logo:n.brandLogo||x,children:[e("i",{}),e("span",{children:n.brandName||"BreadCrumbs"})]}),e(Wt,{className:"bc-bannerActions",bannerWidth:i,children:o?e(Qt,{className:"bc-flow-minimize",onClick:()=>o()}):null})]})})})};Fe('@import url("https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");\n/* Chat constants - we should use html to allow portal overrides those values if it needs to be different */\nhtml {\n --bc-chat-font-stack: "Poppins", "Montserrat", sans-serif;\n --bc-chat-fontSize-xs: 10px;\n --bc-chat-fontSize-sm: 12px;\n --bc-chat-fontSize-md: 16px;\n --bc-chat-fontSize-lg: 18px;\n --bc-chat-fontSize-xl: 22px;\n --bc-chat-fontWeight-light: 100;\n --bc-chat-fontWeight-regular: 400;\n --bc-chat-fontWeight-medium: 500;\n --bc-chat-fontWeight-bold: 700;\n --bc-chat-lineHeight-xs: 18px;\n --bc-chat-lineHeight-sm: 22px;\n --bc-chat-lineHeight-md: 28px;\n --bc-chat-radius: 5px;\n --bc-chat-other-message-border-color: #E5E7EB;\n --bc-chat-other-message-separator-color: #D2D6DB;\n --bc-chat-other-message-background-start-color: #E5E7EB;\n --bc-chat-other-message-background-end-color: #E5E7EB;\n --bc-chat-other-message-text-color: #161616;\n --bc-chat-my-message-border-color: #258694;\n --bc-chat-my-message-background-start-color: #258694;\n --bc-chat-my-message-background-end-color: #258694;\n --bc-chat-my-message-text-color: #fff;\n --bc-chat-text-secondary: #6C737F;\n --bc-chat-text-secondary-dark: #4d4d4d;\n --bc-chat-text-secondary-darkest: #1F2A37;\n --bc-chat-message-highlight-color: #EBC10466;\n --bc-chat-danger-color: #B42318;\n --bc-chat-success-color: #58aa18;\n --bc-chat-white-color: #fff;\n --bc-background-primary-50: #F3FBFC;\n --bc-border-primary: #16616C;\n --bc-border-neutral-secondary: #E5E7EB;\n}');const Ot=c.div`
683
+ `,Yt=({config:n,minimize:o})=>{const[i,a]=r();return l((()=>{new ResizeObserver((()=>{const e=document.getElementById(Pt)?.offsetWidth;e&&e>50&&e!==i&&a(e)})).observe(document.getElementById(Pt))}),[]),e(Vt,{bannerWidth:i,className:"bc-header",children:e(Gt,{className:"bc-banner",id:Pt,startColor:"#065A60",endColor:"#006466",bannerWidth:i,children:t(Jt,{className:"bc-bannerContents",children:[t(Kt,{className:"bc-companyInfo",bannerWidth:i,logo:n.brandLogo||x,children:[e("i",{}),e("span",{children:n.brandName||"BreadCrumbs"})]}),e(Wt,{className:"bc-bannerActions",bannerWidth:i,children:o?e(Qt,{className:"bc-flow-minimize",onClick:()=>o()}):null})]})})})};Fe('@import url("https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");\n/* Chat constants - we should use html to allow portal overrides those values if it needs to be different */\nhtml {\n --bc-chat-font-stack: "Poppins", "Montserrat", sans-serif;\n --bc-chat-fontSize-xs: 10px;\n --bc-chat-fontSize-sm: 12px;\n --bc-chat-fontSize-md: 16px;\n --bc-chat-fontSize-lg: 18px;\n --bc-chat-fontSize-xl: 22px;\n --bc-chat-fontWeight-light: 100;\n --bc-chat-fontWeight-regular: 400;\n --bc-chat-fontWeight-medium: 500;\n --bc-chat-fontWeight-bold: 700;\n --bc-chat-lineHeight-xs: 18px;\n --bc-chat-lineHeight-sm: 22px;\n --bc-chat-lineHeight-md: 28px;\n --bc-chat-radius: 5px;\n --bc-chat-other-message-border-color: #E5E7EB;\n --bc-chat-other-message-separator-color: #D2D6DB;\n --bc-chat-other-message-background-start-color: #E5E7EB;\n --bc-chat-other-message-background-end-color: #E5E7EB;\n --bc-chat-other-message-text-color: #161616;\n --bc-chat-my-message-border-color: #258694;\n --bc-chat-my-message-background-start-color: #258694;\n --bc-chat-my-message-background-end-color: #258694;\n --bc-chat-my-message-text-color: #fff;\n --bc-chat-text-secondary: #6C737F;\n --bc-chat-text-secondary-dark: #4d4d4d;\n --bc-chat-text-secondary-darkest: #1F2A37;\n --bc-chat-message-highlight-color: #EBC10466;\n --bc-chat-danger-color: #B42318;\n --bc-chat-success-color: #58aa18;\n --bc-chat-white-color: #fff;\n --bc-background-primary-50: #F3FBFC;\n --bc-border-primary: #16616C;\n --bc-border-neutral-secondary: #E5E7EB;\n}');const Ot=c.div`
684
684
  position: relative;
685
685
  height: 100%;
686
686
  display: flex;
@@ -699,5 +699,5 @@ i {
699
699
  font-style: normal;
700
700
  line-height: var(--bc-chat-lineHeight-xs);
701
701
  color: var(--bc-chat-text-secondary-dark);
702
- `,qt=({config:n={language:"EN",backgroundColor:"#F3F4F6"},messages:o=[],sendMessage:i,debug:a,minimize:s,onReachingUp:l,agentsIdsAvatarsMap:c,actionChips:d,noteMode:g,onNoteSend:p,onCloseNoteMode:h,searchPattern:u,notePlaceholder:m,searchMatchNo:C=1,onSearchMatchCount:b,onMessageReply:f,replyMessageTitle:x,replyMessageContent:y,onCancelReplyMessage:v,errorMessage:w,autoCompleteEnabled:M,autoCompleteSuggestion:A,onInputChange:k,onAutoCompleteMutate:L,onContactMessage:I,onContactAddContact:E})=>{const[R,S]=r("MESSAGE_LIST");return t(Ot,{className:"bc-chat",children:[n.hideHeader?null:e(Yt,{config:n,minimize:s}),"MESSAGE_LIST"===R?e(We,{messages:o,sendMessage:i,debug:a,config:n,onReachingUp:l,agentsIdsAvatarsMap:c,searchPattern:u,searchMatchNo:C,onSearchMatchCount:b,onMessageReply:f,errorMessage:w,onContactMessage:I,onContactAddContact:E},"message-list"):null,n.inputDisabled?null:e(jt,{sendMessage:i,setView:S,config:n,actionChips:d,noteMode:g,onCloseNoteMode:h,onNoteSend:p,notePlaceholder:m,replyMessageTitle:x,replyMessageContent:y,onCancelReplyMessage:v,autoCompleteEnabled:M,autoCompleteSuggestion:A,onInputChange:k,onAutoCompleteMutate:L},"message-input")]})};export{qt as BCChat};
702
+ `,qt=({config:n={language:"EN",backgroundColor:"#F3F4F6"},messages:o=[],sendMessage:i,debug:a,minimize:l,onReachingUp:s,agentsIdsAvatarsMap:c,actionChips:d,noteMode:g,onNoteSend:p,onCloseNoteMode:h,searchPattern:u,notePlaceholder:m,searchMatchNo:C=1,onSearchMatchCount:b,onMessageReply:f,replyMessageTitle:x,replyMessageContent:y,onCancelReplyMessage:v,errorMessage:w,autoCompleteEnabled:M,autoCompleteSuggestion:A,onInputChange:k,onAutoCompleteMutate:L,autoCompleteReplaceDraft:I,autoCompleteReplaceDraftKey:E,onContactMessage:R,onContactAddContact:S})=>{const[F,D]=r("MESSAGE_LIST");return t(Ot,{className:"bc-chat",children:[n.hideHeader?null:e(Yt,{config:n,minimize:l}),"MESSAGE_LIST"===F?e(We,{messages:o,sendMessage:i,debug:a,config:n,onReachingUp:s,agentsIdsAvatarsMap:c,searchPattern:u,searchMatchNo:C,onSearchMatchCount:b,onMessageReply:f,errorMessage:w,onContactMessage:R,onContactAddContact:S},"message-list"):null,n.inputDisabled?null:e(jt,{sendMessage:i,setView:D,config:n,actionChips:d,noteMode:g,onCloseNoteMode:h,onNoteSend:p,notePlaceholder:m,replyMessageTitle:x,replyMessageContent:y,onCancelReplyMessage:v,autoCompleteEnabled:M,autoCompleteSuggestion:A,onInputChange:k,onAutoCompleteMutate:L,autoCompleteReplaceDraft:I,autoCompleteReplaceDraftKey:E},"message-input")]})};export{qt as BCChat};
703
703
  //# sourceMappingURL=index.es.js.map
package/build/index.js CHANGED
@@ -1,10 +1,10 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("@emotion/styled"),a=require("react-markdown"),o=require("rehype-raw"),i=require("franc-min"),r=require("uuid"),s=require("@azure/storage-blob"),l=require("@emotion/react"),c=require("@breezystack/lamejs");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var g=d(n),p=d(a),u=d(o);const h={MaxFileSize:52428800,SupportedFormats:["png","jpg","jpeg","gif","bmp","pdf","doc","xls","xlsx","docx","ppt","pptx","avi","m4a","m4v","mov","mp4","wav","wma","wmv"],SupportedImageFormats:["png","jpg","jpeg","gif","bmp","webp"],SupportedAudioFormats:["mp3","acc","m4a","ogg","amr","webm","m4a"]},m="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEEAAABBCAYAAACO98lFAAAACXBIWXMAAAsSAAALEgHS3X78AAAFa0lEQVR42u2bX0xTVxzHvzqqVOqQrtJC2gmF4ooMWNg6FEJE3NhClpnG8aBzsTHugbgsLltiJg/6NI3J5pLFLbpIIjEjLuriiH9qnESlI6BQWcGsSEvT2lK8q0CvFChme1hwXs5tKfTWXfT83s6fe3Lz6fn9zvl9f7eL9L/u/xvPuS0GNQqBQqAQKAQKYaYlzfdBk0qPtzRFnL7L7ttoGLzz/EBQSlNRrMzj9HUzA9QdaEygECgECoFCoBAoBAqBQqAQKASaRQph6UlLUCJToCjtZcgkydCmqh6PPQyPo39kEP7QCDoeeGCbCD5bEN5dkQljlgFl6sKo854c97EMfvf2osl1K+FAEgqhPEWBuvyNRModi2XIFDDmVcCYV4FLjnZ8Zf8NQ1OTCysmmFR6HK2smxeAmVatNaC56lPUKrIXzk74Jv8dVGsNEcfZcAh3A25OX4pECp1cE/EZmUSKfaXbUGi/hnp7i7gh7Mku5QXAhkMwOztw8Z4NNx4yEZ+vVWRjbfrqiBCNeRVISUrG7t6L4oRQqMji3f4nesw47u6MyadPMU6cYpwo6G/Fl4U1vOtVaw0wBVyC6ZmCxoSZL8yGQ/j46hEccLbNOajZJoLY0tGEI9ZzvONfvP4BylMU4g6MbDiEz240RN36sdh3HisO3fyZd6wuf6O4j8hoAIxpq1CQqkbWciUAYGxqHANBPywBJyxjAWJ+w+AdKHvM+GjN28TOM6n0cbtFQiCc6DHzAjCmrcJ23QaolsmJMYNSj1qsh+0vJ37sbyFgHHC2YW2GnjhBNmlL44awOBFucNzdSfQfzK3CnqLNvACetIKXsnHYYMK2lWRA/KH3EtGnk2vijg2CQzhjv04EwYO5VahUF89pnU/WvAdj2ipO34VhL3wsucPK03PFBaHZ20O4wFwBTNuu/BooXljC6Tt718J7NIsGgo9liGRnu27DvNeTSaTYnvEqp8/6wEPMy41y03zqEBzDXk573TL5rDFgNqvI5GaefAFXJpGKB0L/yCAXgjz+hEe1TI51M0D2zcg7ptP1Z1pZkiUt5bQfhkMLI5VeSEYhCA1BJknmtP0CyWLmUV/URA0AbrGMOCA8KZwCwIXAQNxrtvu5V+KCpct558UjvQmeSqcn/Xe5YR5N4qrHGtea5+51cdpvpKmJOXynxf8aE2oUOZz2Ied1sPOM5lc9VsIV1qlWE/P+YJzigrBJW8ppM48mUd/VNGcQjlEvDjmvE67AJ9t3B1zigqCTawhV2DIWQH1XExyj3tjyj4E27Lp9Gswjrp/vyCnjvaqfinMnJERP+LxkM1qufMsJVpaxACydP2HbyjzUaEqgfTGTSME7/H/iylAv4QLTN0I+8fWyq1OcypJMIsXh14zY0tFEjDXet6Pxvv1xbiFLWgr3eBB3JtmI65WnKLD/za0xaxeiuSwVK/NwrHgT57SYaZaxAMyjvlkBfF1u4k2Svr/dLEhVSlAIVr+d0y5TF+KYYeu8lZ9d6uKIAFo93YJJ7oK6Q2PfNaKSpJNrcLSyDpcc7TjtuhmT+mxS6fHhK5XIkPHD6wu4sdd2XrD3Fjwm7Gw/iWOGrYQgWq01oFprgI9l0D3kgD80DEfQj+DUBFTJqVBKU5GTqkKRUhdVH+gLuLGz/aSgxVnBIQxNTUYEAfxbbY70C89mrZ5u7LWdF7w6nZDAODQ1ifctDThjvybIemw4hH1tjdhp/SUh5fmEfp9Qb29Bk+sWduSURa1SRzIfy+CyqzPmOuZTh+APjRCnQTBMvqhtIojdvRdR0N+K9StzUKTIgnZFJq9LTJfsHSODaB2y48KwF0/DFtE/h1JliUKgECgECoFCoBAi2D8QCAe+XuY7HAAAAABJRU5ErkJggg==",x=["🤓","🙃","😕","☹️","😲","😳","😠","😇","😀","😁","😂","🤣","😃","😄","😅","😆","😉","😊","😏","😣","😥","😮","😴","😌","😋","😎","😍","🙂","🤗","🤔","😐","😑","😶","🙄"],C="bc-message-list-content";const f=g.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("@emotion/styled"),a=require("react-markdown"),o=require("rehype-raw"),i=require("franc-min"),r=require("uuid"),s=require("@azure/storage-blob"),l=require("@emotion/react"),c=require("@breezystack/lamejs");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var g=d(n),p=d(a),u=d(o);const h={MaxFileSize:52428800,SupportedFormats:["png","jpg","jpeg","gif","bmp","pdf","doc","xls","xlsx","docx","ppt","pptx","avi","m4a","m4v","mov","mp4","wav","wma","wmv"],SupportedImageFormats:["png","jpg","jpeg","gif","bmp","webp"],SupportedAudioFormats:["mp3","acc","m4a","ogg","amr","webm","m4a"]},m="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEEAAABBCAYAAACO98lFAAAACXBIWXMAAAsSAAALEgHS3X78AAAFa0lEQVR42u2bX0xTVxzHvzqqVOqQrtJC2gmF4ooMWNg6FEJE3NhClpnG8aBzsTHugbgsLltiJg/6NI3J5pLFLbpIIjEjLuriiH9qnESlI6BQWcGsSEvT2lK8q0CvFChme1hwXs5tKfTWXfT83s6fe3Lz6fn9zvl9f7eL9L/u/xvPuS0GNQqBQqAQKAQKYaYlzfdBk0qPtzRFnL7L7ttoGLzz/EBQSlNRrMzj9HUzA9QdaEygECgECoFCoBAoBAqBQqAQKASaRQph6UlLUCJToCjtZcgkydCmqh6PPQyPo39kEP7QCDoeeGCbCD5bEN5dkQljlgFl6sKo854c97EMfvf2osl1K+FAEgqhPEWBuvyNRModi2XIFDDmVcCYV4FLjnZ8Zf8NQ1OTCysmmFR6HK2smxeAmVatNaC56lPUKrIXzk74Jv8dVGsNEcfZcAh3A25OX4pECp1cE/EZmUSKfaXbUGi/hnp7i7gh7Mku5QXAhkMwOztw8Z4NNx4yEZ+vVWRjbfrqiBCNeRVISUrG7t6L4oRQqMji3f4nesw47u6MyadPMU6cYpwo6G/Fl4U1vOtVaw0wBVyC6ZmCxoSZL8yGQ/j46hEccLbNOajZJoLY0tGEI9ZzvONfvP4BylMU4g6MbDiEz240RN36sdh3HisO3fyZd6wuf6O4j8hoAIxpq1CQqkbWciUAYGxqHANBPywBJyxjAWJ+w+AdKHvM+GjN28TOM6n0cbtFQiCc6DHzAjCmrcJ23QaolsmJMYNSj1qsh+0vJ37sbyFgHHC2YW2GnjhBNmlL44awOBFucNzdSfQfzK3CnqLNvACetIKXsnHYYMK2lWRA/KH3EtGnk2vijg2CQzhjv04EwYO5VahUF89pnU/WvAdj2ipO34VhL3wsucPK03PFBaHZ20O4wFwBTNuu/BooXljC6Tt718J7NIsGgo9liGRnu27DvNeTSaTYnvEqp8/6wEPMy41y03zqEBzDXk573TL5rDFgNqvI5GaefAFXJpGKB0L/yCAXgjz+hEe1TI51M0D2zcg7ptP1Z1pZkiUt5bQfhkMLI5VeSEYhCA1BJknmtP0CyWLmUV/URA0AbrGMOCA8KZwCwIXAQNxrtvu5V+KCpct558UjvQmeSqcn/Xe5YR5N4qrHGtea5+51cdpvpKmJOXynxf8aE2oUOZz2Ied1sPOM5lc9VsIV1qlWE/P+YJzigrBJW8ppM48mUd/VNGcQjlEvDjmvE67AJ9t3B1zigqCTawhV2DIWQH1XExyj3tjyj4E27Lp9Gswjrp/vyCnjvaqfinMnJERP+LxkM1qufMsJVpaxACydP2HbyjzUaEqgfTGTSME7/H/iylAv4QLTN0I+8fWyq1OcypJMIsXh14zY0tFEjDXet6Pxvv1xbiFLWgr3eBB3JtmI65WnKLD/za0xaxeiuSwVK/NwrHgT57SYaZaxAMyjvlkBfF1u4k2Svr/dLEhVSlAIVr+d0y5TF+KYYeu8lZ9d6uKIAFo93YJJ7oK6Q2PfNaKSpJNrcLSyDpcc7TjtuhmT+mxS6fHhK5XIkPHD6wu4sdd2XrD3Fjwm7Gw/iWOGrYQgWq01oFprgI9l0D3kgD80DEfQj+DUBFTJqVBKU5GTqkKRUhdVH+gLuLGz/aSgxVnBIQxNTUYEAfxbbY70C89mrZ5u7LWdF7w6nZDAODQ1ifctDThjvybIemw4hH1tjdhp/SUh5fmEfp9Qb29Bk+sWduSURa1SRzIfy+CyqzPmOuZTh+APjRCnQTBMvqhtIojdvRdR0N+K9StzUKTIgnZFJq9LTJfsHSODaB2y48KwF0/DFtE/h1JliUKgECgECoFCoBAi2D8QCAe+XuY7HAAAAABJRU5ErkJggg==",x=["🤓","🙃","😕","☹️","😲","😳","😠","😇","😀","😁","😂","🤣","😃","😄","😅","😆","😉","😊","😏","😣","😥","😮","😴","😌","😋","😎","😍","🙂","🤗","🤔","😐","😑","😶","🙄"],f="bc-message-list-content";const C=g.default.div`
2
2
  font-size: var(--bc-chat-fontSize-xs);
3
3
  opacity: 0.7;
4
4
  font-weight: 400;
5
5
  display: inline;
6
6
  white-space: nowrap;
7
- `,b=({createdAt:t})=>{const n=new Date(t).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"});return e.jsx(f,{children:n})},y=()=>e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M1.5 12.5L5.57574 16.5757C5.81005 16.8101 6.18995 16.8101 6.42426 16.5757L9 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("path",{d:"M16 7L12 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("path",{d:"M7 12L11.5757 16.5757C11.8101 16.8101 12.1899 16.8101 12.4243 16.5757L22 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),v={delivered:y,failed:()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M8.4449 0.608765C8.0183 -0.107015 6.9817 -0.107015 6.55509 0.608766L0.161178 11.3368C-0.275824 12.07 0.252503 13 1.10608 13H13.8939C14.7475 13 15.2758 12.07 14.8388 11.3368L8.4449 0.608765ZM7.4141 1.12073C7.45288 1.05566 7.54712 1.05566 7.5859 1.12073L13.9798 11.8488C14.0196 11.9154 13.9715 12 13.8939 12H1.10608C1.02849 12 0.980454 11.9154 1.02018 11.8488L7.4141 1.12073ZM6.8269 4.48611C6.81221 4.10423 7.11783 3.78663 7.5 3.78663C7.88217 3.78663 8.18778 4.10423 8.1731 4.48612L8.01921 8.48701C8.00848 8.766 7.7792 8.98664 7.5 8.98664C7.2208 8.98664 6.99151 8.766 6.98078 8.48701L6.8269 4.48611ZM8.24989 10.476C8.24989 10.8902 7.9141 11.226 7.49989 11.226C7.08567 11.226 6.74989 10.8902 6.74989 10.476C6.74989 10.0618 7.08567 9.72599 7.49989 9.72599C7.9141 9.72599 8.24989 10.0618 8.24989 10.476Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})}),read:y,sent:()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M5 13L9 17L19 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),pending:()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M7.50009 0.877014C3.84241 0.877014 0.877258 3.84216 0.877258 7.49984C0.877258 11.1575 3.8424 14.1227 7.50009 14.1227C11.1578 14.1227 14.1229 11.1575 14.1229 7.49984C14.1229 3.84216 11.1577 0.877014 7.50009 0.877014ZM1.82726 7.49984C1.82726 4.36683 4.36708 1.82701 7.50009 1.82701C10.6331 1.82701 13.1729 4.36683 13.1729 7.49984C13.1729 10.6328 10.6331 13.1727 7.50009 13.1727C4.36708 13.1727 1.82726 10.6328 1.82726 7.49984ZM8 4.50001C8 4.22387 7.77614 4.00001 7.5 4.00001C7.22386 4.00001 7 4.22387 7 4.50001V7.50001C7 7.63262 7.05268 7.7598 7.14645 7.85357L9.14645 9.85357C9.34171 10.0488 9.65829 10.0488 9.85355 9.85357C10.0488 9.65831 10.0488 9.34172 9.85355 9.14646L8 7.29291V4.50001Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})}),played:y},w=({message:t})=>{if(!t.status)return null;const n=v[t.status];return e.jsx("div",{className:`status-icon ${t.status||""}`,children:e.jsx(n,{})})},M=g.default.div`
7
+ `,b=({createdAt:t})=>{const n=new Date(t).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"});return e.jsx(C,{children:n})},y=()=>e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M1.5 12.5L5.57574 16.5757C5.81005 16.8101 6.18995 16.8101 6.42426 16.5757L9 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("path",{d:"M16 7L12 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("path",{d:"M7 12L11.5757 16.5757C11.8101 16.8101 12.1899 16.8101 12.4243 16.5757L22 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),v={delivered:y,failed:()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M8.4449 0.608765C8.0183 -0.107015 6.9817 -0.107015 6.55509 0.608766L0.161178 11.3368C-0.275824 12.07 0.252503 13 1.10608 13H13.8939C14.7475 13 15.2758 12.07 14.8388 11.3368L8.4449 0.608765ZM7.4141 1.12073C7.45288 1.05566 7.54712 1.05566 7.5859 1.12073L13.9798 11.8488C14.0196 11.9154 13.9715 12 13.8939 12H1.10608C1.02849 12 0.980454 11.9154 1.02018 11.8488L7.4141 1.12073ZM6.8269 4.48611C6.81221 4.10423 7.11783 3.78663 7.5 3.78663C7.88217 3.78663 8.18778 4.10423 8.1731 4.48612L8.01921 8.48701C8.00848 8.766 7.7792 8.98664 7.5 8.98664C7.2208 8.98664 6.99151 8.766 6.98078 8.48701L6.8269 4.48611ZM8.24989 10.476C8.24989 10.8902 7.9141 11.226 7.49989 11.226C7.08567 11.226 6.74989 10.8902 6.74989 10.476C6.74989 10.0618 7.08567 9.72599 7.49989 9.72599C7.9141 9.72599 8.24989 10.0618 8.24989 10.476Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})}),read:y,sent:()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M5 13L9 17L19 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),pending:()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M7.50009 0.877014C3.84241 0.877014 0.877258 3.84216 0.877258 7.49984C0.877258 11.1575 3.8424 14.1227 7.50009 14.1227C11.1578 14.1227 14.1229 11.1575 14.1229 7.49984C14.1229 3.84216 11.1577 0.877014 7.50009 0.877014ZM1.82726 7.49984C1.82726 4.36683 4.36708 1.82701 7.50009 1.82701C10.6331 1.82701 13.1729 4.36683 13.1729 7.49984C13.1729 10.6328 10.6331 13.1727 7.50009 13.1727C4.36708 13.1727 1.82726 10.6328 1.82726 7.49984ZM8 4.50001C8 4.22387 7.77614 4.00001 7.5 4.00001C7.22386 4.00001 7 4.22387 7 4.50001V7.50001C7 7.63262 7.05268 7.7598 7.14645 7.85357L9.14645 9.85357C9.34171 10.0488 9.65829 10.0488 9.85355 9.85357C10.0488 9.65831 10.0488 9.34172 9.85355 9.14646L8 7.29291V4.50001Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})}),played:y},w=({message:t})=>{if(!t.status)return null;const n=v[t.status];return e.jsx("div",{className:`status-icon ${t.status||""}`,children:e.jsx(n,{})})},M=g.default.div`
8
8
  position: relative;
9
9
  font-size: var(--bc-chat-fontSize-sm);
10
10
  background: var(--bc-background-primary-50);
@@ -53,13 +53,13 @@
53
53
  `,F=g.default.span`
54
54
  white-space: nowrap;
55
55
  text-transform: capitalize;
56
- `,B=g.default.span`
56
+ `,D=g.default.span`
57
57
  font-weight: var(--bc-chat-fontWeight-regular);
58
- `,D=g.default.div`
58
+ `,B=g.default.div`
59
59
  display: flex;
60
60
  flex-direction: column;
61
61
  gap: 4px;
62
- `,z={en:"English",en_US:"English",en_GB:"English",ar:"Arabic",ar_SA:"Arabic",tr:"Turkish",tr_TR:"Turkish",es:"Spanish",es_ES:"Spanish",fr:"French",fr_FR:"French",de:"German",de_DE:"German",it:"Italian",it_IT:"Italian",pt:"Portuguese",pt_BR:"Portuguese",pt_PT:"Portuguese",ru:"Russian",ru_RU:"Russian",zh:"Chinese",zh_CN:"Chinese",ja:"Japanese",ja_JP:"Japanese",ko:"Korean",ko_KR:"Korean",hi:"Hindi",hi_IN:"Hindi"},N=({messageContent:n,isMyMessage:a,configLanguage:o})=>{const i=t.useMemo((()=>{try{return JSON.parse(n)}catch(e){return void console.log(e.message)}}),[n]),r="string"==typeof i?.language?i.language:i?.language?.code,s=t.useMemo((()=>(e=>{if(!e)return;if(z[e])return z[e];const t=e.split("_")[0].toLowerCase();return z[t]?z[t]:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})(r)),[r]),l=t.useMemo((()=>{if(!i)return[];const e=[];if(i.templateComponents){let t=[];try{"string"==typeof i.templateComponents?t=JSON.parse(i.templateComponents):Array.isArray(i.templateComponents)&&(t=i.templateComponents)}catch(t){return console.log("Error parsing templateComponents:",t.message),e}t.forEach(((t,n)=>{if(!t||"object"!=typeof t)return;const a=t.type||"unknown",o=t.parameters||[];if("body"===a)o.forEach(((t,n)=>{if(t&&"object"==typeof t){const a=t.text||t.value||JSON.stringify(t),i=o.length>1?`Body Parameter ${n+1}`:"Body";e.push({label:i,value:String(a)})}}));else if("button"===a){const a=void 0!==t.index?t.index:n,i=t.sub_type||t.subType||"";o.forEach(((t,n)=>{if(t&&"object"==typeof t){const r=t.text||t.value||JSON.stringify(t),s=i?`Button ${a} (${i})`:`Button ${a}`,l=o.length>1?`${s} - Parameter ${n+1}`:s;e.push({label:l,value:String(r)})}}))}else o.forEach(((t,n)=>{if(t&&"object"==typeof t){const i=t.text||t.value||JSON.stringify(t),r=a.charAt(0).toUpperCase()+a.slice(1),s=o.length>1?`${r} Parameter ${n+1}`:r;e.push({label:s,value:String(i)})}}))}))}return e}),[i]);return i?e.jsx(D,{children:e.jsxs(j,{isMyMessage:a,language:o,children:[e.jsxs(L,{children:[e.jsxs(E,{children:[e.jsx(A,{}),e.jsx(R,{children:i.name||"Template"})]}),s&&e.jsxs(E,{children:[e.jsx(k,{}),e.jsx(R,{children:s})]})]}),l.length>0&&e.jsx(I,{children:l.map(((t,n)=>e.jsxs(S,{children:[e.jsx(F,{children:t.label}),e.jsx(B,{children:t.value})]},n)))})]})}):null},T=g.default(M)`
62
+ `,z={en:"English",en_US:"English",en_GB:"English",ar:"Arabic",ar_SA:"Arabic",tr:"Turkish",tr_TR:"Turkish",es:"Spanish",es_ES:"Spanish",fr:"French",fr_FR:"French",de:"German",de_DE:"German",it:"Italian",it_IT:"Italian",pt:"Portuguese",pt_BR:"Portuguese",pt_PT:"Portuguese",ru:"Russian",ru_RU:"Russian",zh:"Chinese",zh_CN:"Chinese",ja:"Japanese",ja_JP:"Japanese",ko:"Korean",ko_KR:"Korean",hi:"Hindi",hi_IN:"Hindi"},N=({messageContent:n,isMyMessage:a,configLanguage:o})=>{const i=t.useMemo((()=>{try{return JSON.parse(n)}catch(e){return void console.log(e.message)}}),[n]),r="string"==typeof i?.language?i.language:i?.language?.code,s=t.useMemo((()=>(e=>{if(!e)return;if(z[e])return z[e];const t=e.split("_")[0].toLowerCase();return z[t]?z[t]:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})(r)),[r]),l=t.useMemo((()=>{if(!i)return[];const e=[];if(i.templateComponents){let t=[];try{"string"==typeof i.templateComponents?t=JSON.parse(i.templateComponents):Array.isArray(i.templateComponents)&&(t=i.templateComponents)}catch(t){return console.log("Error parsing templateComponents:",t.message),e}t.forEach(((t,n)=>{if(!t||"object"!=typeof t)return;const a=t.type||"unknown",o=t.parameters||[];if("body"===a)o.forEach(((t,n)=>{if(t&&"object"==typeof t){const a=t.text||t.value||JSON.stringify(t),i=o.length>1?`Body Parameter ${n+1}`:"Body";e.push({label:i,value:String(a)})}}));else if("button"===a){const a=void 0!==t.index?t.index:n,i=t.sub_type||t.subType||"";o.forEach(((t,n)=>{if(t&&"object"==typeof t){const r=t.text||t.value||JSON.stringify(t),s=i?`Button ${a} (${i})`:`Button ${a}`,l=o.length>1?`${s} - Parameter ${n+1}`:s;e.push({label:l,value:String(r)})}}))}else o.forEach(((t,n)=>{if(t&&"object"==typeof t){const i=t.text||t.value||JSON.stringify(t),r=a.charAt(0).toUpperCase()+a.slice(1),s=o.length>1?`${r} Parameter ${n+1}`:r;e.push({label:s,value:String(i)})}}))}))}return e}),[i]);return i?e.jsx(B,{children:e.jsxs(j,{isMyMessage:a,language:o,children:[e.jsxs(L,{children:[e.jsxs(E,{children:[e.jsx(A,{}),e.jsx(R,{children:i.name||"Template"})]}),s&&e.jsxs(E,{children:[e.jsx(k,{}),e.jsx(R,{children:s})]})]}),l.length>0&&e.jsx(I,{children:l.map(((t,n)=>e.jsxs(S,{children:[e.jsx(F,{children:t.label}),e.jsx(D,{children:t.value})]},n)))})]})}):null},T=g.default(M)`
63
63
  overflow: hidden;
64
64
  text-overflow: ellipsis;
65
65
  white-space: nowrap;
@@ -71,7 +71,7 @@
71
71
  `,Z=g.default.div`
72
72
  white-space: normal;
73
73
  cursor: pointer;
74
- `,H=({className:n,context:a,isMyMessage:o,language:i})=>{const r=t.useCallback((()=>{const e=document.getElementById(C),t=document.getElementById(a.replyToId);e&&t&&(e.style.scrollBehavior="smooth",t.scrollIntoView())}),[a.replyToId]),s=()=>"image"===a.replyToType?e.jsx("img",{src:a.replyToContent,alt:"Media preview",style:{width:"30px",height:"30px",objectFit:"cover",marginLeft:"8px",verticalAlign:"middle"}}):"template"===a.replyToType&&a.replyToContent?e.jsx(Z,{onClick:r,children:e.jsx(N,{messageContent:a.replyToContent,isMyMessage:o,configLanguage:i})}):a.replyToContent;return"template"===a.replyToType?e.jsx("div",{className:n,onClick:r,children:s()}):e.jsx(T,{className:n,isMyMessage:o,language:i,onClick:r,children:s()})},P=g.default.div`
74
+ `,H=({className:n,context:a,isMyMessage:o,language:i})=>{const r=t.useCallback((()=>{const e=document.getElementById(f),t=document.getElementById(a.replyToId);e&&t&&(e.style.scrollBehavior="smooth",t.scrollIntoView())}),[a.replyToId]),s=()=>"image"===a.replyToType?e.jsx("img",{src:a.replyToContent,alt:"Media preview",style:{width:"30px",height:"30px",objectFit:"cover",marginLeft:"8px",verticalAlign:"middle"}}):"template"===a.replyToType&&a.replyToContent?e.jsx(Z,{onClick:r,children:e.jsx(N,{messageContent:a.replyToContent,isMyMessage:o,configLanguage:i})}):a.replyToContent;return"template"===a.replyToType?e.jsx("div",{className:n,onClick:r,children:s()}):e.jsx(T,{className:n,isMyMessage:o,language:i,onClick:r,children:s()})},P=g.default.div`
75
75
  position: relative;
76
76
  background-image: ${e=>e.isMyMessage?"linear-gradient(104deg,var(--bc-chat-my-message-background-start-color),var(--bc-chat-my-message-background-end-color))":"linear-gradient(104deg,var(--bc-chat-other-message-background-start-color),var(--bc-chat-other-message-background-end-color))"};
77
77
  color: ${e=>e.isMyMessage?"var(--bc-chat-my-message-text-color)":"var(--bc-chat-other-message-text-color)"};
@@ -138,7 +138,7 @@
138
138
  background-color: rgba(22, 97, 108, 0.12);
139
139
  outline: none;
140
140
  }
141
- `,K=()=>e.jsx("svg",{width:"15",height:"16",viewBox:"0 0 15 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M7.2232 8.33921C6.85992 8.33921 5.54564 8.35033 5.54564 8.35033V11.3333L1.29228 6.67275L5.54564 2.00666V5.01186C5.54564 5.01186 6.93435 4.99519 7.2232 5.0063C11.146 5.1285 13.8701 9.59462 13.8879 11.6832C12.6892 10.1445 9.53958 8.33921 7.2232 8.33921ZM6.65828 3.90089V0.623508C6.67716 0.456862 6.63217 0.290241 6.50552 0.162479C6.28554 -0.0541598 5.92892 -0.0541598 5.70895 0.162479L0.160208 6.25058C0.0430006 6.36723 -0.00699451 6.51722 0.000782283 6.67275C-0.00699451 6.82273 0.0430006 6.97827 0.160208 7.09493L5.6784 13.1442C5.78061 13.2719 5.92892 13.3553 6.10168 13.3553C6.25944 13.3553 6.39997 13.2886 6.50107 13.183C6.50218 13.183 6.50441 13.183 6.50552 13.1775C6.63217 13.0553 6.67716 12.8831 6.65828 12.722C6.65828 12.722 6.66772 9.63904 6.66772 9.45018C10.3339 9.45018 13.6496 12.0887 14.3079 15.5661C14.7511 14.544 15 13.4219 15 12.2387C15 7.63375 11.2649 3.90089 6.65828 3.90089Z",fill:"#161616"})}),W=({isMyMessage:n,createdAt:a,children:o,className:r,message:s,config:l,style:c,onReply:d,isMedia:g})=>{const p=i.franc(s.content),u="AR"===l.language,h=s?.messageId,m=Boolean(d&&h),x=t.useCallback((()=>{h&&d?.(h)}),[h,d]),C=a||s&&l&&l.isAgent===s.isAgent?e.jsxs(G,{isMedia:g,isMyMessage:n,children:[s&&l&&l.isAgent===s.isAgent&&e.jsx(w,{message:s,config:l}),a&&e.jsx(b,{createdAt:a})]}):null;return e.jsxs(P,{isMyMessage:n,language:l.language,className:r,style:c,children:[m?e.jsx(J,{className:"bc-replyButton",type:"button",onClick:x,isRTL:u,isMyMessage:n,children:e.jsx(K,{})}):null,s.context&&s.context.replyToId?e.jsx(H,{context:s.context,isMyMessage:n,language:p}):null,"template"===s.type?e.jsx(N,{messageContent:s.content,isMyMessage:n,configLanguage:l.language}):null,e.jsxs(U,{isMyMessage:n,isMedia:g,children:[e.jsxs(V,{language:p,children:[o,g&&C]}),!g&&C]})]})},Q=({message:t,config:n,searchPattern:a,onReply:o})=>{const i=n.isAgent===t.isAgent;return e.jsx(W,{className:"bc-textMessage",isMyMessage:i,createdAt:t.createdAt,message:t,config:n,onReply:o,children:(t.content&&t.content.indexOf("\n")>-1?t.content.split("\n"):[t.content]).map(((n,o)=>{const i=a&&a.trim()?function(e,t){const n=(a=t.trim(),a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"));var a;if(!n)return e;const o=new RegExp(`(${n})`,"gi");return e.replace(o,'<span style="background-color: var(--bc-chat-message-highlight-color, yellow); padding: 3px 0;">$1</span>')}(n,a):n;return e.jsx(p.default,{rehypePlugins:[u.default],skipHtml:!1,children:i},`${t.messageId}-${o}`)}))})};function Y(e){if(!isFinite(e)||e<0)return"0:00";return`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`}function O({src:n}){const a=t.useRef(null),[o,i]=t.useState(!1),[r,s]=t.useState(!0),[l,c]=t.useState(0),[d,g]=t.useState(0),p=t.useMemo((()=>{const e=function(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return()=>{t+=1831565813;let e=Math.imul(t^t>>>15,1|t);return e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n),t=[];for(let n=0;n<82;n++){const a=.6*Math.sin(n/82*Math.PI)+.2,o=.25*(e()-.5),i=Math.min(1,Math.max(.15,a+o));t.push(i)}return t}),[n]);t.useEffect((()=>{const e=a.current;if(!e)return;const t=()=>{c(e.duration),s(!1)},n=()=>g(e.currentTime),o=()=>i(!1),r=()=>{document.querySelectorAll("video, audio").forEach((t=>{t!==e&&t.pause()})),i(!0)},l=()=>i(!1);return e.addEventListener("loadedmetadata",t),e.addEventListener("timeupdate",n),e.addEventListener("ended",o),e.addEventListener("play",r),e.addEventListener("pause",l),()=>{e.removeEventListener("loadedmetadata",t),e.removeEventListener("timeupdate",n),e.removeEventListener("ended",o),e.removeEventListener("play",r),e.removeEventListener("pause",l)}}),[n]);const u=t.useCallback((()=>{const e=a.current;e&&(e.paused?e.play():e.pause())}),[]),h=t.useCallback((e=>{const t=a.current;if(!t||!l)return;const n=e.currentTarget.getBoundingClientRect(),o=Math.min(1,Math.max(0,(e.clientX-n.left)/n.width));t.currentTime=o*l,g(t.currentTime)}),[l]),m=l?Math.min(1,d/l):0;return e.jsxs("div",{className:"bc-audioPlayer",role:"group","aria-label":"Audio message player",children:[e.jsx("button",{type:"button",className:"bc-audioPlayer__button "+(o?"pause":"play"),onClick:u,"aria-label":o?"Pause audio":"Play audio"}),e.jsxs("div",{className:"bc-audioPlayer__wave",onClick:h,children:[e.jsx("div",{className:"bc-audioPlayer__wave--future",children:p.map(((t,n)=>e.jsx("span",{style:{height:`${Math.round(18*t)}px`}},`f-${n}`)))}),e.jsx("div",{className:"bc-audioPlayer__wave--past",style:{width:100*m+"%"},children:p.map(((t,n)=>e.jsx("span",{style:{height:`${Math.round(18*t)}px`}},`p-${n}`)))})]}),e.jsx("div",{className:"bc-audioPlayer__time","aria-live":"polite",children:r?"--:--":Y(l)}),e.jsx("audio",{ref:a,src:n,preload:"auto"})]})}const q=({message:n,config:a,onReply:o})=>{const[i,r]=t.useState(!1),[s,l]=t.useState(!0),c=t.useRef(null),d=t.useCallback((()=>{const e=c.current;e&&console.error("Media playback error:",{src:e.src,error:e.error,networkState:e.networkState,readyState:e.readyState,messageType:n.type}),r(!0),l(!1)}),[n.type]),g=t.useCallback((()=>{console.log("Media loaded successfully:",n.content),l(!1)}),[n.content]),p=t.useCallback((()=>{console.log("Media can play:",n.content),l(!1)}),[n.content]),u=t.useCallback((()=>{console.log("Media load started:",n.content)}),[n.content]);t.useEffect((()=>{const e=()=>{document.querySelectorAll("video, audio").forEach((e=>{e!==c.current&&e.pause()}))},t=c.current;if(t){t.addEventListener("play",e),t.addEventListener("loadeddata",g),t.addEventListener("canplay",p),t.addEventListener("error",d),t.addEventListener("loadstart",u);const a=setTimeout((()=>{console.log("Loading timeout reached for:",n.content),l(!1)}),5e3);return()=>{t&&(t.removeEventListener("play",e),t.removeEventListener("loadeddata",g),t.removeEventListener("canplay",p),t.removeEventListener("error",d),t.removeEventListener("loadstart",u)),clearTimeout(a)}}}),[p,u,d,g,n.content,n.type]);const h=a.isAgent===n.isAgent;return i?e.jsxs(W,{className:"bc-mediaMessage"+("audio"===n.type?" audio":""),isMyMessage:h,isMedia:!0,createdAt:n.createdAt,message:n,config:a,onReply:o,children:[e.jsxs("p",{style:{margin:0,color:"#666"},children:["Unable to load ","audio"===n.type?"audio":"video"," file."]}),e.jsxs("a",{href:n.content,target:"_blank",rel:"noopener noreferrer",style:{color:"#007bff",textDecoration:"none"},children:["Open ","audio"===n.type?"audio":"video"," in new tab"]})]}):"audio"===n.type?e.jsx(W,{className:"bc-mediaMessage audio",isMyMessage:h,isMedia:!0,createdAt:n.createdAt,message:n,config:a,style:{position:"relative"},onReply:o,children:e.jsx(O,{src:n.content})}):e.jsxs(W,{className:"bc-mediaMessage",isMyMessage:h,isMedia:!0,createdAt:n.createdAt,message:n,config:a,style:{position:"relative"},onReply:o,children:[e.jsx("video",{ref:c,src:n.content,controls:!0,preload:"metadata",playsInline:!0,onError:d,onLoadedData:g,onCanPlay:p,onLoadStart:u}),s&&e.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:"14px",zIndex:1},children:"Loading video..."})]})};var X={EN:{share_my_location:"Share My Location",share_my_current_location:"Share My Current Location",placeholder:"Message...",notePlaceholder:"Add your note",see_your_location:"See Your Location",location_permission:"Please give location permission",download:"Download",template_message:"Template Message",message:"Message",add_contact:"Add Contact",autoCompleteAcceptHint:"Press Tab or the Right arrow key to insert the full suggestion."},AR:{share_my_location:"مشاركة موقعي",share_my_current_location:"مشاركة موقعي الحالي",placeholder:"الرسالة...",notePlaceholder:"أضف ملاحظتك",see_your_location:"رؤية موقعك",location_permission:"يرجى منح إذن الموقع",download:"تحميل",template_message:"رسالة قالب",message:"أرسل رسالة",add_contact:"إضافة جهة اتصال",autoCompleteAcceptHint:"اضغط Tab أو مفتاح السهم الأيمن لإدراج الاقتراح كاملًا."},TR:{share_my_location:"Konumumu paylaş",share_my_current_location:"Güncel konumumu paylaş",placeholder:"Mesajınızı yazın",notePlaceholder:"Notunuzu ekleyin",see_your_location:"Konumunuzu Görüntüleyin",location_permission:"Lütfen konum paylaşımı için izin verin",download:"İndir",template_message:"Şablon Mesajı",message:"Mesaj",add_contact:"Kişi Ekle",autoCompleteAcceptHint:"Tam öneriyi eklemek için Tab veya Sağ ok tuşuna basın."}};const $=()=>e.jsx("svg",{width:"18",height:"22",viewBox:"0 0 18 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M8.56055 0.249878C9.16365 0.249377 9.64011 0.249415 10.0869 0.407104C10.1792 0.439689 10.2701 0.477175 10.3584 0.519409C10.7858 0.723899 11.1227 1.06135 11.5488 1.48816L16.4443 6.38367C16.9387 6.87712 17.3304 7.26784 17.541 7.77625C17.7515 8.28461 17.7507 8.83754 17.75 9.53601V13.0565C17.75 14.8942 17.7498 16.3499 17.5967 17.4891C17.439 18.6615 17.1067 19.61 16.3584 20.3583C15.6101 21.1066 14.6616 21.4389 13.4893 21.5966C12.3501 21.7497 10.8943 21.7499 9.05664 21.7499H8.94336C7.10571 21.7499 5.64991 21.7497 4.51074 21.5966C3.33844 21.4389 2.38991 21.1066 1.6416 20.3583C0.893309 19.61 0.560952 18.6615 0.40332 17.4891C0.25016 16.3499 0.249984 14.8942 0.25 13.0565V8.4071C0.249988 6.82577 0.250388 5.57298 0.366211 4.58093C0.485107 3.56261 0.733898 2.72281 1.30176 2.01843C1.51427 1.75486 1.755 1.51514 2.01855 1.30261C2.72296 0.734673 3.56267 0.484993 4.58105 0.366089C5.57311 0.250277 6.8259 0.249866 8.40723 0.249878H8.56055ZM8.45605 1.74988C6.81549 1.74988 5.6499 1.75086 4.75488 1.85535C3.87608 1.95795 3.35453 2.15151 2.95996 2.4696C2.77959 2.61504 2.61516 2.77947 2.46973 2.95984C2.15159 3.35441 1.95808 3.87589 1.85547 4.75476C1.75097 5.64979 1.75 6.8153 1.75 8.45593V12.9999C1.75 14.9066 1.75151 16.2613 1.88965 17.2889C2.02491 18.295 2.27897 18.8745 2.70215 19.2977C3.12536 19.7209 3.70485 19.975 4.71094 20.1102C5.73859 20.2484 7.09323 20.2499 9 20.2499C10.9068 20.2499 12.2614 20.2484 13.2891 20.1102C14.2952 19.975 14.8746 19.7209 15.2979 19.2977C15.721 18.8745 15.9751 18.295 16.1104 17.2889C16.2485 16.2613 16.25 14.9066 16.25 12.9999V9.6571C16.25 9.21922 16.2468 8.94195 16.2334 8.74988H15.9453C14.5778 8.7499 13.4753 8.7502 12.6084 8.63367C11.7083 8.51265 10.9505 8.25316 10.3486 7.65125C9.74676 7.04934 9.48722 6.29156 9.36621 5.39148C9.24969 4.52456 9.24998 3.422 9.25 2.05457V1.76355C9.08319 1.75292 8.84192 1.74988 8.45605 1.74988ZM13 15.2499C13.4142 15.2499 13.75 15.5857 13.75 15.9999C13.75 16.4141 13.4142 16.7499 13 16.7499H5C4.58579 16.7499 4.25 16.4141 4.25 15.9999C4.25 15.5857 4.58579 15.2499 5 15.2499H13ZM9 11.2499C9.41421 11.2499 9.75 11.5857 9.75 11.9999C9.75 12.4141 9.41421 12.7499 9 12.7499H5C4.58579 12.7499 4.25 12.4141 4.25 11.9999C4.25 11.5857 4.58579 11.2499 5 11.2499H9ZM10.751 2.8114C10.7546 3.82629 10.7723 4.58818 10.8535 5.19226C10.9522 5.92571 11.1325 6.31399 11.4092 6.5907C11.6859 6.86746 12.0748 7.04771 12.8086 7.14636C13.4126 7.22753 14.1738 7.24524 15.1885 7.2489L10.751 2.8114Z",fill:"#16616C"})}),_=g.default.a`
141
+ `,K=()=>e.jsx("svg",{width:"15",height:"16",viewBox:"0 0 15 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M7.2232 8.33921C6.85992 8.33921 5.54564 8.35033 5.54564 8.35033V11.3333L1.29228 6.67275L5.54564 2.00666V5.01186C5.54564 5.01186 6.93435 4.99519 7.2232 5.0063C11.146 5.1285 13.8701 9.59462 13.8879 11.6832C12.6892 10.1445 9.53958 8.33921 7.2232 8.33921ZM6.65828 3.90089V0.623508C6.67716 0.456862 6.63217 0.290241 6.50552 0.162479C6.28554 -0.0541598 5.92892 -0.0541598 5.70895 0.162479L0.160208 6.25058C0.0430006 6.36723 -0.00699451 6.51722 0.000782283 6.67275C-0.00699451 6.82273 0.0430006 6.97827 0.160208 7.09493L5.6784 13.1442C5.78061 13.2719 5.92892 13.3553 6.10168 13.3553C6.25944 13.3553 6.39997 13.2886 6.50107 13.183C6.50218 13.183 6.50441 13.183 6.50552 13.1775C6.63217 13.0553 6.67716 12.8831 6.65828 12.722C6.65828 12.722 6.66772 9.63904 6.66772 9.45018C10.3339 9.45018 13.6496 12.0887 14.3079 15.5661C14.7511 14.544 15 13.4219 15 12.2387C15 7.63375 11.2649 3.90089 6.65828 3.90089Z",fill:"#161616"})}),W=({isMyMessage:n,createdAt:a,children:o,className:r,message:s,config:l,style:c,onReply:d,isMedia:g})=>{const p=i.franc(s.content),u="AR"===l.language,h=s?.messageId,m=Boolean(d&&h),x=t.useCallback((()=>{h&&d?.(h)}),[h,d]),f=a||s&&l&&l.isAgent===s.isAgent?e.jsxs(G,{isMedia:g,isMyMessage:n,children:[s&&l&&l.isAgent===s.isAgent&&e.jsx(w,{message:s,config:l}),a&&e.jsx(b,{createdAt:a})]}):null;return e.jsxs(P,{isMyMessage:n,language:l.language,className:r,style:c,children:[m?e.jsx(J,{className:"bc-replyButton",type:"button",onClick:x,isRTL:u,isMyMessage:n,children:e.jsx(K,{})}):null,s.context&&s.context.replyToId?e.jsx(H,{context:s.context,isMyMessage:n,language:p}):null,"template"===s.type?e.jsx(N,{messageContent:s.content,isMyMessage:n,configLanguage:l.language}):null,e.jsxs(U,{isMyMessage:n,isMedia:g,children:[e.jsxs(V,{language:p,children:[o,g&&f]}),!g&&f]})]})},Q=({message:t,config:n,searchPattern:a,onReply:o})=>{const i=n.isAgent===t.isAgent;return e.jsx(W,{className:"bc-textMessage",isMyMessage:i,createdAt:t.createdAt,message:t,config:n,onReply:o,children:(t.content&&t.content.indexOf("\n")>-1?t.content.split("\n"):[t.content]).map(((n,o)=>{const i=a&&a.trim()?function(e,t){const n=(a=t.trim(),a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"));var a;if(!n)return e;const o=new RegExp(`(${n})`,"gi");return e.replace(o,'<span style="background-color: var(--bc-chat-message-highlight-color, yellow); padding: 3px 0;">$1</span>')}(n,a):n;return e.jsx(p.default,{rehypePlugins:[u.default],skipHtml:!1,children:i},`${t.messageId}-${o}`)}))})};function Y(e){if(!isFinite(e)||e<0)return"0:00";return`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`}function O({src:n}){const a=t.useRef(null),[o,i]=t.useState(!1),[r,s]=t.useState(!0),[l,c]=t.useState(0),[d,g]=t.useState(0),p=t.useMemo((()=>{const e=function(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return()=>{t+=1831565813;let e=Math.imul(t^t>>>15,1|t);return e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n),t=[];for(let n=0;n<82;n++){const a=.6*Math.sin(n/82*Math.PI)+.2,o=.25*(e()-.5),i=Math.min(1,Math.max(.15,a+o));t.push(i)}return t}),[n]);t.useEffect((()=>{const e=a.current;if(!e)return;const t=()=>{c(e.duration),s(!1)},n=()=>g(e.currentTime),o=()=>i(!1),r=()=>{document.querySelectorAll("video, audio").forEach((t=>{t!==e&&t.pause()})),i(!0)},l=()=>i(!1);return e.addEventListener("loadedmetadata",t),e.addEventListener("timeupdate",n),e.addEventListener("ended",o),e.addEventListener("play",r),e.addEventListener("pause",l),()=>{e.removeEventListener("loadedmetadata",t),e.removeEventListener("timeupdate",n),e.removeEventListener("ended",o),e.removeEventListener("play",r),e.removeEventListener("pause",l)}}),[n]);const u=t.useCallback((()=>{const e=a.current;e&&(e.paused?e.play():e.pause())}),[]),h=t.useCallback((e=>{const t=a.current;if(!t||!l)return;const n=e.currentTarget.getBoundingClientRect(),o=Math.min(1,Math.max(0,(e.clientX-n.left)/n.width));t.currentTime=o*l,g(t.currentTime)}),[l]),m=l?Math.min(1,d/l):0;return e.jsxs("div",{className:"bc-audioPlayer",role:"group","aria-label":"Audio message player",children:[e.jsx("button",{type:"button",className:"bc-audioPlayer__button "+(o?"pause":"play"),onClick:u,"aria-label":o?"Pause audio":"Play audio"}),e.jsxs("div",{className:"bc-audioPlayer__wave",onClick:h,children:[e.jsx("div",{className:"bc-audioPlayer__wave--future",children:p.map(((t,n)=>e.jsx("span",{style:{height:`${Math.round(18*t)}px`}},`f-${n}`)))}),e.jsx("div",{className:"bc-audioPlayer__wave--past",style:{width:100*m+"%"},children:p.map(((t,n)=>e.jsx("span",{style:{height:`${Math.round(18*t)}px`}},`p-${n}`)))})]}),e.jsx("div",{className:"bc-audioPlayer__time","aria-live":"polite",children:r?"--:--":Y(l)}),e.jsx("audio",{ref:a,src:n,preload:"auto"})]})}const q=({message:n,config:a,onReply:o})=>{const[i,r]=t.useState(!1),[s,l]=t.useState(!0),c=t.useRef(null),d=t.useCallback((()=>{const e=c.current;e&&console.error("Media playback error:",{src:e.src,error:e.error,networkState:e.networkState,readyState:e.readyState,messageType:n.type}),r(!0),l(!1)}),[n.type]),g=t.useCallback((()=>{console.log("Media loaded successfully:",n.content),l(!1)}),[n.content]),p=t.useCallback((()=>{console.log("Media can play:",n.content),l(!1)}),[n.content]),u=t.useCallback((()=>{console.log("Media load started:",n.content)}),[n.content]);t.useEffect((()=>{const e=()=>{document.querySelectorAll("video, audio").forEach((e=>{e!==c.current&&e.pause()}))},t=c.current;if(t){t.addEventListener("play",e),t.addEventListener("loadeddata",g),t.addEventListener("canplay",p),t.addEventListener("error",d),t.addEventListener("loadstart",u);const a=setTimeout((()=>{console.log("Loading timeout reached for:",n.content),l(!1)}),5e3);return()=>{t&&(t.removeEventListener("play",e),t.removeEventListener("loadeddata",g),t.removeEventListener("canplay",p),t.removeEventListener("error",d),t.removeEventListener("loadstart",u)),clearTimeout(a)}}}),[p,u,d,g,n.content,n.type]);const h=a.isAgent===n.isAgent;return i?e.jsxs(W,{className:"bc-mediaMessage"+("audio"===n.type?" audio":""),isMyMessage:h,isMedia:!0,createdAt:n.createdAt,message:n,config:a,onReply:o,children:[e.jsxs("p",{style:{margin:0,color:"#666"},children:["Unable to load ","audio"===n.type?"audio":"video"," file."]}),e.jsxs("a",{href:n.content,target:"_blank",rel:"noopener noreferrer",style:{color:"#007bff",textDecoration:"none"},children:["Open ","audio"===n.type?"audio":"video"," in new tab"]})]}):"audio"===n.type?e.jsx(W,{className:"bc-mediaMessage audio",isMyMessage:h,isMedia:!0,createdAt:n.createdAt,message:n,config:a,style:{position:"relative"},onReply:o,children:e.jsx(O,{src:n.content})}):e.jsxs(W,{className:"bc-mediaMessage",isMyMessage:h,isMedia:!0,createdAt:n.createdAt,message:n,config:a,style:{position:"relative"},onReply:o,children:[e.jsx("video",{ref:c,src:n.content,controls:!0,preload:"metadata",playsInline:!0,onError:d,onLoadedData:g,onCanPlay:p,onLoadStart:u}),s&&e.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:"14px",zIndex:1},children:"Loading video..."})]})};var X={EN:{share_my_location:"Share My Location",share_my_current_location:"Share My Current Location",placeholder:"Message...",notePlaceholder:"Add your note",see_your_location:"See Your Location",location_permission:"Please give location permission",download:"Download",template_message:"Template Message",message:"Message",add_contact:"Add Contact",autoCompleteAcceptHint:"Press Tab or the Right arrow key to insert the full suggestion."},AR:{share_my_location:"مشاركة موقعي",share_my_current_location:"مشاركة موقعي الحالي",placeholder:"الرسالة...",notePlaceholder:"أضف ملاحظتك",see_your_location:"رؤية موقعك",location_permission:"يرجى منح إذن الموقع",download:"تحميل",template_message:"رسالة قالب",message:"أرسل رسالة",add_contact:"إضافة جهة اتصال",autoCompleteAcceptHint:"اضغط Tab أو مفتاح السهم الأيمن لإدراج الاقتراح كاملًا."},TR:{share_my_location:"Konumumu paylaş",share_my_current_location:"Güncel konumumu paylaş",placeholder:"Mesajınızı yazın",notePlaceholder:"Notunuzu ekleyin",see_your_location:"Konumunuzu Görüntüleyin",location_permission:"Lütfen konum paylaşımı için izin verin",download:"İndir",template_message:"Şablon Mesajı",message:"Mesaj",add_contact:"Kişi Ekle",autoCompleteAcceptHint:"Tam öneriyi eklemek için Tab veya Sağ ok tuşuna basın."}};const $=()=>e.jsx("svg",{width:"18",height:"22",viewBox:"0 0 18 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M8.56055 0.249878C9.16365 0.249377 9.64011 0.249415 10.0869 0.407104C10.1792 0.439689 10.2701 0.477175 10.3584 0.519409C10.7858 0.723899 11.1227 1.06135 11.5488 1.48816L16.4443 6.38367C16.9387 6.87712 17.3304 7.26784 17.541 7.77625C17.7515 8.28461 17.7507 8.83754 17.75 9.53601V13.0565C17.75 14.8942 17.7498 16.3499 17.5967 17.4891C17.439 18.6615 17.1067 19.61 16.3584 20.3583C15.6101 21.1066 14.6616 21.4389 13.4893 21.5966C12.3501 21.7497 10.8943 21.7499 9.05664 21.7499H8.94336C7.10571 21.7499 5.64991 21.7497 4.51074 21.5966C3.33844 21.4389 2.38991 21.1066 1.6416 20.3583C0.893309 19.61 0.560952 18.6615 0.40332 17.4891C0.25016 16.3499 0.249984 14.8942 0.25 13.0565V8.4071C0.249988 6.82577 0.250388 5.57298 0.366211 4.58093C0.485107 3.56261 0.733898 2.72281 1.30176 2.01843C1.51427 1.75486 1.755 1.51514 2.01855 1.30261C2.72296 0.734673 3.56267 0.484993 4.58105 0.366089C5.57311 0.250277 6.8259 0.249866 8.40723 0.249878H8.56055ZM8.45605 1.74988C6.81549 1.74988 5.6499 1.75086 4.75488 1.85535C3.87608 1.95795 3.35453 2.15151 2.95996 2.4696C2.77959 2.61504 2.61516 2.77947 2.46973 2.95984C2.15159 3.35441 1.95808 3.87589 1.85547 4.75476C1.75097 5.64979 1.75 6.8153 1.75 8.45593V12.9999C1.75 14.9066 1.75151 16.2613 1.88965 17.2889C2.02491 18.295 2.27897 18.8745 2.70215 19.2977C3.12536 19.7209 3.70485 19.975 4.71094 20.1102C5.73859 20.2484 7.09323 20.2499 9 20.2499C10.9068 20.2499 12.2614 20.2484 13.2891 20.1102C14.2952 19.975 14.8746 19.7209 15.2979 19.2977C15.721 18.8745 15.9751 18.295 16.1104 17.2889C16.2485 16.2613 16.25 14.9066 16.25 12.9999V9.6571C16.25 9.21922 16.2468 8.94195 16.2334 8.74988H15.9453C14.5778 8.7499 13.4753 8.7502 12.6084 8.63367C11.7083 8.51265 10.9505 8.25316 10.3486 7.65125C9.74676 7.04934 9.48722 6.29156 9.36621 5.39148C9.24969 4.52456 9.24998 3.422 9.25 2.05457V1.76355C9.08319 1.75292 8.84192 1.74988 8.45605 1.74988ZM13 15.2499C13.4142 15.2499 13.75 15.5857 13.75 15.9999C13.75 16.4141 13.4142 16.7499 13 16.7499H5C4.58579 16.7499 4.25 16.4141 4.25 15.9999C4.25 15.5857 4.58579 15.2499 5 15.2499H13ZM9 11.2499C9.41421 11.2499 9.75 11.5857 9.75 11.9999C9.75 12.4141 9.41421 12.7499 9 12.7499H5C4.58579 12.7499 4.25 12.4141 4.25 11.9999C4.25 11.5857 4.58579 11.2499 5 11.2499H9ZM10.751 2.8114C10.7546 3.82629 10.7723 4.58818 10.8535 5.19226C10.9522 5.92571 11.1325 6.31399 11.4092 6.5907C11.6859 6.86746 12.0748 7.04771 12.8086 7.14636C13.4126 7.22753 14.1738 7.24524 15.1885 7.2489L10.751 2.8114Z",fill:"#16616C"})}),_=g.default.a`
142
142
  ${e=>e.isMyMessage?"flex-direction: row;":"flex-direction: row-reverse;"}
143
143
  min-width: 300px;
144
144
  display: flex;
@@ -249,11 +249,11 @@ i {
249
249
  font-weight: 500;
250
250
  font-size: var(--bc-chat-fontSize-sm);
251
251
  color: var(--bc-chat-text-secondary-darkest);
252
- `,Ce=g.default.span`
252
+ `,fe=g.default.span`
253
253
  font-weight: var(--bc-chat-fontWeight-regular);
254
254
  font-size: var(--bc-chat-fontSize-sm);
255
255
  color: var(--bc-chat-text-secondary-dark);
256
- `,fe=g.default.span`
256
+ `,Ce=g.default.span`
257
257
  color: var(--bc-chat-other-message-text-color);
258
258
  `,be=g.default.div`
259
259
  width: 48px;
@@ -292,7 +292,7 @@ i {
292
292
  &:first-of-type {
293
293
  border-right: 1px solid var(--bc-chat-other-message-separator-color);
294
294
  }
295
- `,Ae=({contact:n,createdAt:a,language:o,onMessage:i,onAddContact:r})=>{const s=t.useMemo((()=>{const e=[n.firstName,n.lastName].filter(Boolean);return e.length>0?e.join(" "):"Unknown Contact"}),[n.firstName,n.lastName]);return e.jsxs(ue,{children:[e.jsxs(he,{children:[e.jsxs(me,{children:[e.jsx(xe,{children:s}),n.phone&&e.jsx(Ce,{children:n.phone}),a&&e.jsx(fe,{children:e.jsx(b,{createdAt:a})})]}),e.jsx(be,{children:e.jsx(ye,{})})]}),e.jsx(ve,{}),e.jsxs(we,{children:[e.jsx(Me,{onClick:i,children:X[o]?.message||"Message"}),e.jsx(Me,{onClick:r,children:X[o]?.add_contact||"Add Contact"})]})]})},ke=g.default.div`
295
+ `,Ae=({contact:n,createdAt:a,language:o,onMessage:i,onAddContact:r})=>{const s=t.useMemo((()=>{const e=[n.firstName,n.lastName].filter(Boolean);return e.length>0?e.join(" "):"Unknown Contact"}),[n.firstName,n.lastName]);return e.jsxs(ue,{children:[e.jsxs(he,{children:[e.jsxs(me,{children:[e.jsx(xe,{children:s}),n.phone&&e.jsx(fe,{children:n.phone}),a&&e.jsx(Ce,{children:e.jsx(b,{createdAt:a})})]}),e.jsx(be,{children:e.jsx(ye,{})})]}),e.jsx(ve,{}),e.jsxs(we,{children:[e.jsx(Me,{onClick:i,children:X[o]?.message||"Message"}),e.jsx(Me,{onClick:r,children:X[o]?.add_contact||"Add Contact"})]})]})},ke=g.default.div`
296
296
  display: flex;
297
297
  flex-direction: column;
298
298
  gap: 8px;
@@ -320,7 +320,7 @@ i {
320
320
  margin-bottom: -10px;
321
321
  padding:0 16px;
322
322
  }
323
- `,Fe=({data:t,config:n})=>e.jsx("div",{children:e.jsx(Se,{backgroundColor:n.backgroundColor,children:e.jsx("div",{className:"seperator-content",children:t.content})})}),Be=g.default.div`
323
+ `,Fe=({data:t,config:n})=>e.jsx("div",{children:e.jsx(Se,{backgroundColor:n.backgroundColor,children:e.jsx("div",{className:"seperator-content",children:t.content})})}),De=g.default.div`
324
324
  height: 100%;
325
325
  width: 100%;
326
326
  overflow-y: auto;
@@ -328,7 +328,7 @@ i {
328
328
  background-size: 100% 100%;
329
329
  background-image: ${e=>`url(${e.config.backgroundImage})`};
330
330
  ${e=>e.config.backgroundColor&&`background-color: ${e.config.backgroundColor};`}
331
- `,De=g.default.div`
331
+ `,Be=g.default.div`
332
332
  position: sticky;
333
333
  top: 0px;
334
334
  z-index: 2;
@@ -379,7 +379,7 @@ i {
379
379
  font-size: var(--bc-chat-fontSize-sm);
380
380
  line-height: var(--bc-chat-lineHeight-sm);
381
381
  color: inherit;
382
- `,He=()=>e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.95833 16.6667C4.70114 16.6667 1.25 13.2155 1.25 8.95833C1.25 4.70114 4.70114 1.25 8.95833 1.25C13.2155 1.25 16.6667 4.70114 16.6667 8.95833C16.6667 13.2155 13.2155 16.6667 8.95833 16.6667ZM0 8.95833C0 13.9059 4.01078 17.9167 8.95833 17.9167C13.9059 17.9167 17.9167 13.9059 17.9167 8.95833C17.9167 4.01078 13.9059 0 8.95833 0C4.01078 0 0 4.01078 0 8.95833ZM8.53419 8.75097C8.47632 8.75004 8.40939 8.75001 8.32682 8.75001C7.98164 8.75001 7.70182 8.47019 7.70182 8.12501C7.70182 7.77984 7.98164 7.50001 8.32682 7.50001L8.35553 7.50001C8.52646 7.49994 8.71128 7.49987 8.8673 7.52084C9.05007 7.54541 9.28356 7.60861 9.48006 7.80511C9.67656 8.00161 9.73975 8.2351 9.76433 8.41787C9.7853 8.57388 9.78523 8.75871 9.78516 8.92964V8.92964L9.78516 8.95835V13.125C9.78516 13.4702 9.50533 13.75 9.16016 13.75C8.81498 13.75 8.53516 13.4702 8.53516 13.125V8.95835C8.53516 8.87578 8.53513 8.80885 8.53419 8.75097ZM8.95182 4.79167C8.49159 4.79167 8.11849 5.16476 8.11849 5.625C8.11849 6.08524 8.49159 6.45833 8.95182 6.45833H8.95931C9.41955 6.45833 9.79264 6.08524 9.79264 5.625C9.79264 5.16476 9.41955 4.79167 8.95931 4.79167H8.95182Z",fill:"#6C737F"})});function Pe(e){return new Date(e).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"})}function Ue(e){if(!e)return null;const t=e.querySelectorAll("[data-message-date]");if(0===t.length)return null;const n=e.getBoundingClientRect(),a=n.top+50;let o=null,i=null;for(const e of t){const t=e.getAttribute("data-message-date");if(!t)continue;const r=e.getBoundingClientRect();r.top<n.bottom&&r.bottom>n.top&&(!o||r.top<o.top)&&(o={date:t,top:r.top}),r.bottom<=a&&(!i||r.bottom>i.bottom)&&(i={date:t,bottom:r.bottom})}return o?o.date:i?i.date:t[0]?.getAttribute("data-message-date")??null}const Ve=({sendMessage:n,debug:a,config:o,messages:i,onReachingUp:r,agentsIdsAvatarsMap:s,searchPattern:l,searchMatchNo:c,onSearchMatchCount:d,onMessageReply:g,errorMessage:p,onContactMessage:u,onContactAddContact:h})=>{const m=t.useRef(null),x=t.useRef(0),[f,b]=t.useState(null),[y,v]=t.useState(!0),[w,M]=t.useState(null),A=p?.trim(),k=i.find((e=>"seperator"!==e.type)),j=k?.createdAt?Pe(k.createdAt):null;t.useEffect((()=>{const e=document.getElementById(C);if(!e)return;x.current=e.scrollHeight;const t=()=>{0===e.scrollTop&&r?.();const t=e.scrollHeight-e.scrollTop-e.clientHeight<=4;v(t);const n=Ue(e);M((e=>n!==e?n:e))};return e.addEventListener("scroll",t),()=>{e.removeEventListener("scroll",t)}}),[r]),t.useLayoutEffect((()=>{const e=m.current;if(!e)return;const t=x.current;if(e.scrollHeight-e.scrollTop<=e.clientHeight+200){const t=e.scrollHeight;e.style.scrollBehavior="smooth",e.style.overscrollBehavior="contain",e.scroll(0,t),v(!0)}else{const n=e.scrollHeight-t;e.style.scrollBehavior="auto",e.scrollTop=e.scrollTop+n;const a=4,o=e.scrollHeight-e.scrollTop-e.clientHeight<=a;v(o)}x.current=e.scrollHeight;const n=Ue(e);M(n)}),[i,A]),t.useEffect((()=>{if(!l||!l.trim())return b(null),void d?.(0);const e=l.toLowerCase(),t=[];for(const n of i){const a=n&&n.content,o=n&&n.messageId;o&&a&&(String(a).toLowerCase().includes(e)&&t.push(o))}if(d?.(t.length),0===t.length)return void b(null);const n=t[Math.min(Math.max((c??1)-1,0),t.length-1)];b(n);const a=m.current,o=n?document.getElementById(n):null;a&&o&&(a.style.scrollBehavior="smooth",o.scrollIntoView())}),[l,c,i,d]);const L=w??j??null;return e.jsxs(Be,{ref:m,id:C,config:o,children:[L&&e.jsx(De,{children:e.jsx("span",{className:"sticky-date-pill-inner",children:L})}),i?.map(((t,r)=>"seperator"===t.type?e.jsx(Fe,{data:t,config:o}):e.jsx("div",{"data-message-date":t.createdAt?Pe(t.createdAt):void 0,children:e.jsx(Re,{message:t,index:r,sendMessage:n,messageActionsEnabled:i.length-1===r,debug:a,config:o,agentsIdsAvatarsMap:s,highlighted:f===t.messageId,searchPattern:l,onMessageReply:g,onContactMessage:u,onContactAddContact:h})},t.messageId?t.messageId:"message"+r))),A&&e.jsxs(e.Fragment,{children:[e.jsx(Fe,{data:{type:"seperator"},config:o}),e.jsxs(Ne,{role:"alert","aria-live":"assertive","data-testid":"chat-error-message",children:[e.jsx(Te,{children:e.jsx(He,{})}),e.jsx(Ze,{children:A})]})]}),!y&&e.jsx(ze,{"aria-label":"Scroll to latest message",onClick:()=>{const e=m.current;if(!e)return;const t=e.scrollHeight;e.style.scrollBehavior="smooth",e.style.overscrollBehavior="contain",e.scroll(0,t),v(!0)},children:e.jsx("svg",{width:"14",height:"8",viewBox:"0 0 14 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M1.60372 0.555285C1.7256 0.716659 2.08951 1.1984 2.30624 1.47611C2.74031 2.03233 3.33342 2.77142 3.97323 3.50831C4.61627 4.24893 5.29178 4.97022 5.89189 5.50046C6.19281 5.76634 6.45714 5.96837 6.67527 6.09987C6.88042 6.22355 7.00161 6.24927 7.00161 6.24927C7.00161 6.24927 7.11923 6.22355 7.32437 6.09988C7.5425 5.96838 7.80684 5.76635 8.10775 5.50047C8.70786 4.97022 9.38337 4.24892 10.0264 3.5083C10.6662 2.7714 11.2593 2.0323 11.6934 1.47608C11.9101 1.19837 12.2735 0.717304 12.3954 0.555928C12.6411 0.222405 13.1111 0.150469 13.4446 0.396102C13.7781 0.641734 13.8494 1.11123 13.6037 1.44476L13.6018 1.4473C13.474 1.61655 13.0971 2.11556 12.8759 2.39892C12.4321 2.9677 11.8216 3.72861 11.1591 4.49171C10.4997 5.25109 9.77408 6.02979 9.10096 6.62454C8.76526 6.92116 8.42497 7.18788 8.0988 7.3845C7.79322 7.56872 7.40633 7.75 6.99982 7.75C6.59331 7.75 6.20642 7.56871 5.90084 7.3845C5.57468 7.18787 5.23439 6.92116 4.89869 6.62454C4.22557 6.02979 3.4999 5.2511 2.84058 4.49173C2.17803 3.72863 1.5676 2.96774 1.12372 2.39896C0.902432 2.11541 0.525506 1.61637 0.397929 1.44747L0.396279 1.44528C0.150645 1.11176 0.22154 0.641787 0.555062 0.396152C0.888572 0.150526 1.35808 0.221792 1.60372 0.555285Z",fill:"white"})})})]},C)},Ge="text";async function Je(e,t,n){const a=new s.BlobServiceClient("https://bcuserres.blob.core.windows.net?sv=2024-11-04&ss=b&srt=o&sp=rc&se=2027-12-31T19:19:59Z&st=2026-01-02T11:04:59Z&spr=https&sig=OqvZvcz%2FmvmhVS8gWqPpMBxDZXHbEZ%2BTQRpCT3bE3G0%3D",new s.AnonymousCredential).getContainerClient("anonymous"),o=new Date,i=`${o.getFullYear()}-${String(o.getMonth()+1).padStart(2,"0")}`,l=a.getBlockBlobClient(`${i}/${r.v4()}`);try{await l.uploadBrowserData(e,{onProgress:n=>{const a=Math.round(n.loadedBytes/e.size*100);t(a)},blockSize:4194304,concurrency:20,blobHTTPHeaders:{blobContentType:e.type}});n(l.url.split("?")[0])}catch(e){n(void 0,"Error uploading file:"+e.message)}}const Ke=g.default.span`
382
+ `,He=()=>e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.95833 16.6667C4.70114 16.6667 1.25 13.2155 1.25 8.95833C1.25 4.70114 4.70114 1.25 8.95833 1.25C13.2155 1.25 16.6667 4.70114 16.6667 8.95833C16.6667 13.2155 13.2155 16.6667 8.95833 16.6667ZM0 8.95833C0 13.9059 4.01078 17.9167 8.95833 17.9167C13.9059 17.9167 17.9167 13.9059 17.9167 8.95833C17.9167 4.01078 13.9059 0 8.95833 0C4.01078 0 0 4.01078 0 8.95833ZM8.53419 8.75097C8.47632 8.75004 8.40939 8.75001 8.32682 8.75001C7.98164 8.75001 7.70182 8.47019 7.70182 8.12501C7.70182 7.77984 7.98164 7.50001 8.32682 7.50001L8.35553 7.50001C8.52646 7.49994 8.71128 7.49987 8.8673 7.52084C9.05007 7.54541 9.28356 7.60861 9.48006 7.80511C9.67656 8.00161 9.73975 8.2351 9.76433 8.41787C9.7853 8.57388 9.78523 8.75871 9.78516 8.92964V8.92964L9.78516 8.95835V13.125C9.78516 13.4702 9.50533 13.75 9.16016 13.75C8.81498 13.75 8.53516 13.4702 8.53516 13.125V8.95835C8.53516 8.87578 8.53513 8.80885 8.53419 8.75097ZM8.95182 4.79167C8.49159 4.79167 8.11849 5.16476 8.11849 5.625C8.11849 6.08524 8.49159 6.45833 8.95182 6.45833H8.95931C9.41955 6.45833 9.79264 6.08524 9.79264 5.625C9.79264 5.16476 9.41955 4.79167 8.95931 4.79167H8.95182Z",fill:"#6C737F"})});function Pe(e){return new Date(e).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"})}function Ue(e){if(!e)return null;const t=e.querySelectorAll("[data-message-date]");if(0===t.length)return null;const n=e.getBoundingClientRect(),a=n.top+50;let o=null,i=null;for(const e of t){const t=e.getAttribute("data-message-date");if(!t)continue;const r=e.getBoundingClientRect();r.top<n.bottom&&r.bottom>n.top&&(!o||r.top<o.top)&&(o={date:t,top:r.top}),r.bottom<=a&&(!i||r.bottom>i.bottom)&&(i={date:t,bottom:r.bottom})}return o?o.date:i?i.date:t[0]?.getAttribute("data-message-date")??null}const Ve=({sendMessage:n,debug:a,config:o,messages:i,onReachingUp:r,agentsIdsAvatarsMap:s,searchPattern:l,searchMatchNo:c,onSearchMatchCount:d,onMessageReply:g,errorMessage:p,onContactMessage:u,onContactAddContact:h})=>{const m=t.useRef(null),x=t.useRef(0),[C,b]=t.useState(null),[y,v]=t.useState(!0),[w,M]=t.useState(null),A=p?.trim(),k=i.find((e=>"seperator"!==e.type)),j=k?.createdAt?Pe(k.createdAt):null;t.useEffect((()=>{const e=document.getElementById(f);if(!e)return;x.current=e.scrollHeight;const t=()=>{0===e.scrollTop&&r?.();const t=e.scrollHeight-e.scrollTop-e.clientHeight<=4;v(t);const n=Ue(e);M((e=>n!==e?n:e))};return e.addEventListener("scroll",t),()=>{e.removeEventListener("scroll",t)}}),[r]),t.useLayoutEffect((()=>{const e=m.current;if(!e)return;const t=x.current;if(e.scrollHeight-e.scrollTop<=e.clientHeight+200){const t=e.scrollHeight;e.style.scrollBehavior="smooth",e.style.overscrollBehavior="contain",e.scroll(0,t),v(!0)}else{const n=e.scrollHeight-t;e.style.scrollBehavior="auto",e.scrollTop=e.scrollTop+n;const a=4,o=e.scrollHeight-e.scrollTop-e.clientHeight<=a;v(o)}x.current=e.scrollHeight;const n=Ue(e);M(n)}),[i,A]),t.useEffect((()=>{if(!l||!l.trim())return b(null),void d?.(0);const e=l.toLowerCase(),t=[];for(const n of i){const a=n&&n.content,o=n&&n.messageId;o&&a&&(String(a).toLowerCase().includes(e)&&t.push(o))}if(d?.(t.length),0===t.length)return void b(null);const n=t[Math.min(Math.max((c??1)-1,0),t.length-1)];b(n);const a=m.current,o=n?document.getElementById(n):null;a&&o&&(a.style.scrollBehavior="smooth",o.scrollIntoView())}),[l,c,i,d]);const L=w??j??null;return e.jsxs(De,{ref:m,id:f,config:o,children:[L&&e.jsx(Be,{children:e.jsx("span",{className:"sticky-date-pill-inner",children:L})}),i?.map(((t,r)=>"seperator"===t.type?e.jsx(Fe,{data:t,config:o}):e.jsx("div",{"data-message-date":t.createdAt?Pe(t.createdAt):void 0,children:e.jsx(Re,{message:t,index:r,sendMessage:n,messageActionsEnabled:i.length-1===r,debug:a,config:o,agentsIdsAvatarsMap:s,highlighted:C===t.messageId,searchPattern:l,onMessageReply:g,onContactMessage:u,onContactAddContact:h})},t.messageId?t.messageId:"message"+r))),A&&e.jsxs(e.Fragment,{children:[e.jsx(Fe,{data:{type:"seperator"},config:o}),e.jsxs(Ne,{role:"alert","aria-live":"assertive","data-testid":"chat-error-message",children:[e.jsx(Te,{children:e.jsx(He,{})}),e.jsx(Ze,{children:A})]})]}),!y&&e.jsx(ze,{"aria-label":"Scroll to latest message",onClick:()=>{const e=m.current;if(!e)return;const t=e.scrollHeight;e.style.scrollBehavior="smooth",e.style.overscrollBehavior="contain",e.scroll(0,t),v(!0)},children:e.jsx("svg",{width:"14",height:"8",viewBox:"0 0 14 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M1.60372 0.555285C1.7256 0.716659 2.08951 1.1984 2.30624 1.47611C2.74031 2.03233 3.33342 2.77142 3.97323 3.50831C4.61627 4.24893 5.29178 4.97022 5.89189 5.50046C6.19281 5.76634 6.45714 5.96837 6.67527 6.09987C6.88042 6.22355 7.00161 6.24927 7.00161 6.24927C7.00161 6.24927 7.11923 6.22355 7.32437 6.09988C7.5425 5.96838 7.80684 5.76635 8.10775 5.50047C8.70786 4.97022 9.38337 4.24892 10.0264 3.5083C10.6662 2.7714 11.2593 2.0323 11.6934 1.47608C11.9101 1.19837 12.2735 0.717304 12.3954 0.555928C12.6411 0.222405 13.1111 0.150469 13.4446 0.396102C13.7781 0.641734 13.8494 1.11123 13.6037 1.44476L13.6018 1.4473C13.474 1.61655 13.0971 2.11556 12.8759 2.39892C12.4321 2.9677 11.8216 3.72861 11.1591 4.49171C10.4997 5.25109 9.77408 6.02979 9.10096 6.62454C8.76526 6.92116 8.42497 7.18788 8.0988 7.3845C7.79322 7.56872 7.40633 7.75 6.99982 7.75C6.59331 7.75 6.20642 7.56871 5.90084 7.3845C5.57468 7.18787 5.23439 6.92116 4.89869 6.62454C4.22557 6.02979 3.4999 5.2511 2.84058 4.49173C2.17803 3.72863 1.5676 2.96774 1.12372 2.39896C0.902432 2.11541 0.525506 1.61637 0.397929 1.44747L0.396279 1.44528C0.150645 1.11176 0.22154 0.641787 0.555062 0.396152C0.888572 0.150526 1.35808 0.221792 1.60372 0.555285Z",fill:"white"})})})]},f)},Ge="text";async function Je(e,t,n){const a=new s.BlobServiceClient("https://bcuserres.blob.core.windows.net?sv=2024-11-04&ss=b&srt=o&sp=rc&se=2027-12-31T19:19:59Z&st=2026-01-02T11:04:59Z&spr=https&sig=OqvZvcz%2FmvmhVS8gWqPpMBxDZXHbEZ%2BTQRpCT3bE3G0%3D",new s.AnonymousCredential).getContainerClient("anonymous"),o=new Date,i=`${o.getFullYear()}-${String(o.getMonth()+1).padStart(2,"0")}`,l=a.getBlockBlobClient(`${i}/${r.v4()}`);try{await l.uploadBrowserData(e,{onProgress:n=>{const a=Math.round(n.loadedBytes/e.size*100);t(a)},blockSize:4194304,concurrency:20,blobHTTPHeaders:{blobContentType:e.type}});n(l.url.split("?")[0])}catch(e){n(void 0,"Error uploading file:"+e.message)}}const Ke=g.default.span`
383
383
  cursor: pointer;
384
384
  width: 20px;
385
385
  height: 20px;
@@ -467,7 +467,7 @@ i {
467
467
  align-items: center;
468
468
  justify-content: center;
469
469
  color: #c5cdd6;
470
- `,ot=({text:n,setText:a,config:o,send:i,placeholder:r,autoCompleteEnabled:s,autoCompleteSuggestion:l,onInputChange:c,onAutoCompleteMutate:d})=>{const g=t.useRef(null),p="AR"===o?.language,u=t.useCallback((()=>{const e=g.current;if(!e)return;e.style.height="20px";const t=e.scrollHeight;t!==e.offsetHeight&&(e.style.height=t+"px")}),[]);t.useEffect((()=>{n||(u(),g.current?.focus())}),[u,n]),t.useEffect((()=>{s&&g.current&&g.current.focus()}),[s,l]);const h=Boolean(s&&l),m=X[o.language]?.autoCompleteAcceptHint??X.EN.autoCompleteAcceptHint;return e.jsxs($e,{isRTL:p,children:[e.jsxs(_e,{children:[e.jsx("textarea",{ref:g,value:n,className:"bc-messageInputTextArea",id:"textInput",placeholder:r,maxLength:1024,dir:p?"rtl":"ltr",onKeyDown:e=>{if(s&&l&&("Tab"===e.key||"ArrowRight"===e.key&&!e.shiftKey)){e.preventDefault();const t=(n||"")+l;return a(t),u(),c?.(t),void d?.(null)}if("Enter"===e.key&&(e.shiftKey||e.ctrlKey||e.altKey)){e.preventDefault();const t=g.current?.selectionStart||0,o=n.slice(0,t)+"\n"+n.slice(t);return a(o),u(),void c?.(o)}"Enter"===e.key&&(e.preventDefault(),i(),u())},onChange:e=>{const t=e.target.value,o=n||"";if(a(t),u(),c?.(t),s&&l&&d){const e=o+l;if(t&&e.toLowerCase().startsWith(t.toLowerCase())){const n=e.slice(t.length);n.length>0?d(n):d(null)}else d(null)}},style:{color:h?"transparent":void 0}}),h&&e.jsxs("div",{className:"bc-autoCompleteOverlay",children:[n,e.jsx("span",{className:"bc-suggestion",children:l})]})]}),h&&e.jsxs(tt,{children:[e.jsx(at,{children:e.jsx(et,{})}),e.jsx(nt,{children:m})]})]})},it=({config:t,send:n,file:a,isFileSelected:o,text:i,setText:r,cancelFileUpload:s,noteMode:l,onCloseNoteMode:c,notePlaceholder:d,autoCompleteEnabled:g,autoCompleteSuggestion:p,onInputChange:u,onAutoCompleteMutate:h})=>{const m="AR"===t?.language,x=Array.isArray(a)?a:a?[a]:[],C=x.length>0;return e.jsxs("div",{className:"bc-messageInput "+(m?"bc-RTL":""),children:[l?e.jsx(We,{onClick:c,isRTL:m,children:e.jsx(Oe,{})}):null,C?e.jsx(qe,{children:x.map(((n,a)=>e.jsx(Xe,{file:n,isFileSelected:o,cancelFileUpload:s,config:t},`${n.fileName}-${a}-${n.fileUrl}`)))}):null,C?null:e.jsx(ot,{text:i||"",setText:r,config:t,send:n,placeholder:l?d||X[t.language]?.notePlaceholder:t.inputPlaceholder||X[t.language]?.placeholder,autoCompleteEnabled:g,autoCompleteSuggestion:p,onInputChange:u,onAutoCompleteMutate:h}),e.jsx(Ke,{onClick:()=>n(),isRTL:m,children:i||C?e.jsx(Qe,{}):null})]})},rt=(e,t)=>`\n &:hover {\n background-image: ${e.replaceAll("%23a3a3a3",t.activeColor)};\n }\n background-image: ${t.isActive?e.replaceAll("%23a3a3a3",t.activeColor):e};\n`,st="\ndisplay: flex;\njustify-content: center;\nalign-items: center;\ngap: 4px;\nborder-radius: 8px;\nborder: 1px solid #D2D6DB;\nbackground: #FFF;\ntransition: background-color 0.2s ease, border-color 0.2s ease;\ncursor: pointer;\nfont-size: 14px;\n&:hover {\n background: #f7f7f7;\n border-color: #dcdcdc;\n}\n&:active {\n background: #f0f0f0;\n}\n";g.default.button`
470
+ `,ot=({text:n,setText:a,config:o,send:i,placeholder:r,autoCompleteEnabled:s,autoCompleteSuggestion:l,onInputChange:c,onAutoCompleteMutate:d})=>{const g=t.useRef(null),p="AR"===o?.language,u=t.useCallback((()=>{const e=g.current;if(!e)return;e.style.height="20px";const t=e.scrollHeight;t!==e.offsetHeight&&(e.style.height=t+"px")}),[]);t.useEffect((()=>{n||(u(),g.current?.focus())}),[u,n]),t.useEffect((()=>{s&&g.current&&g.current.focus()}),[s,l]);const h=Boolean(s&&l),m=X[o.language]?.autoCompleteAcceptHint??X.EN.autoCompleteAcceptHint;return e.jsxs($e,{isRTL:p,children:[e.jsxs(_e,{children:[e.jsx("textarea",{ref:g,value:n,className:"bc-messageInputTextArea",id:"textInput",placeholder:r,maxLength:1024,dir:p?"rtl":"ltr",onKeyDown:e=>{if(s&&l&&("Tab"===e.key||"ArrowRight"===e.key&&!e.shiftKey)){e.preventDefault();const t=(n||"")+l;return a(t),u(),c?.(t),void d?.(null)}if("Enter"===e.key&&(e.shiftKey||e.ctrlKey||e.altKey)){e.preventDefault();const t=g.current?.selectionStart||0,o=n.slice(0,t)+"\n"+n.slice(t);return a(o),u(),void c?.(o)}"Enter"===e.key&&(e.preventDefault(),i(),u())},onChange:e=>{const t=e.target.value,o=n||"";if(a(t),u(),c?.(t),s&&l&&d){const e=o+l;if(t&&e.toLowerCase().startsWith(t.toLowerCase())){const n=e.slice(t.length);n.length>0?d(n):d(null)}else d(null)}},style:{color:h?"transparent":void 0}}),h&&e.jsxs("div",{className:"bc-autoCompleteOverlay",children:[n,e.jsx("span",{className:"bc-suggestion",children:l})]})]}),h&&e.jsxs(tt,{children:[e.jsx(at,{children:e.jsx(et,{})}),e.jsx(nt,{children:m})]})]})},it=({config:t,send:n,file:a,isFileSelected:o,text:i,setText:r,cancelFileUpload:s,noteMode:l,onCloseNoteMode:c,notePlaceholder:d,autoCompleteEnabled:g,autoCompleteSuggestion:p,onInputChange:u,onAutoCompleteMutate:h})=>{const m="AR"===t?.language,x=Array.isArray(a)?a:a?[a]:[],f=x.length>0;return e.jsxs("div",{className:"bc-messageInput "+(m?"bc-RTL":""),children:[l?e.jsx(We,{onClick:c,isRTL:m,children:e.jsx(Oe,{})}):null,f?e.jsx(qe,{children:x.map(((n,a)=>e.jsx(Xe,{file:n,isFileSelected:o,cancelFileUpload:s,config:t},`${n.fileName}-${a}-${n.fileUrl}`)))}):null,f?null:e.jsx(ot,{text:i||"",setText:r,config:t,send:n,placeholder:l?d||X[t.language]?.notePlaceholder:t.inputPlaceholder||X[t.language]?.placeholder,autoCompleteEnabled:g,autoCompleteSuggestion:p,onInputChange:u,onAutoCompleteMutate:h}),e.jsx(Ke,{onClick:()=>n(),isRTL:m,children:i||f?e.jsx(Qe,{}):null})]})},rt=(e,t)=>`\n &:hover {\n background-image: ${e.replaceAll("%23a3a3a3",t.activeColor)};\n }\n background-image: ${t.isActive?e.replaceAll("%23a3a3a3",t.activeColor):e};\n`,st="\ndisplay: flex;\njustify-content: center;\nalign-items: center;\ngap: 4px;\nborder-radius: 8px;\nborder: 1px solid #D2D6DB;\nbackground: #FFF;\ntransition: background-color 0.2s ease, border-color 0.2s ease;\ncursor: pointer;\nfont-size: 14px;\n&:hover {\n background: #f7f7f7;\n border-color: #dcdcdc;\n}\n&:active {\n background: #f0f0f0;\n}\n";g.default.button`
471
471
  ${st}
472
472
  height: 32px;
473
473
  min-height: 32px;
@@ -515,12 +515,12 @@ i {
515
515
  justify-content: center;
516
516
 
517
517
  ${e=>e.isRTL&&"\n svg {\n transform: scaleX(-1);\n }\n "}
518
- `,ht=({isRTL:t})=>e.jsx(ut,{isRTL:t,children:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M1.20308 1.04312C1.00481 0.954998 0.772341 1.0048 0.627577 1.16641C0.482813 1.32802 0.458794 1.56455 0.568117 1.75196L3.92115 7.50002L0.568117 13.2481C0.458794 13.4355 0.482813 13.672 0.627577 13.8336C0.772341 13.9952 1.00481 14.045 1.20308 13.9569L14.7031 7.95693C14.8836 7.87668 15 7.69762 15 7.50002C15 7.30243 14.8836 7.12337 14.7031 7.04312L1.20308 1.04312ZM4.84553 7.10002L2.21234 2.586L13.2689 7.50002L2.21234 12.414L4.84552 7.90002H9C9.22092 7.90002 9.4 7.72094 9.4 7.50002C9.4 7.27911 9.22092 7.10002 9 7.10002H4.84553Z",fill:"#666",fillRule:"evenodd",clipRule:"evenodd"})})}),mt=()=>e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M12.8536 2.85355C13.0488 2.65829 13.0488 2.34171 12.8536 2.14645C12.6583 1.95118 12.3417 1.95118 12.1464 2.14645L7.5 6.79289L2.85355 2.14645C2.65829 1.95118 2.34171 1.95118 2.14645 2.14645C1.95118 2.34171 1.95118 2.65829 2.14645 2.85355L6.79289 7.5L2.14645 12.1464C1.95118 12.3417 1.95118 12.6583 2.14645 12.8536C2.34171 13.0488 2.65829 13.0488 2.85355 12.8536L7.5 8.20711L12.1464 12.8536C12.3417 13.0488 12.6583 13.0488 12.8536 12.8536C13.0488 12.6583 13.0488 12.3417 12.8536 12.1464L8.20711 7.5L12.8536 2.85355Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})}),xt=128e3,Ct=g.default.div`
518
+ `,ht=({isRTL:t})=>e.jsx(ut,{isRTL:t,children:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M1.20308 1.04312C1.00481 0.954998 0.772341 1.0048 0.627577 1.16641C0.482813 1.32802 0.458794 1.56455 0.568117 1.75196L3.92115 7.50002L0.568117 13.2481C0.458794 13.4355 0.482813 13.672 0.627577 13.8336C0.772341 13.9952 1.00481 14.045 1.20308 13.9569L14.7031 7.95693C14.8836 7.87668 15 7.69762 15 7.50002C15 7.30243 14.8836 7.12337 14.7031 7.04312L1.20308 1.04312ZM4.84553 7.10002L2.21234 2.586L13.2689 7.50002L2.21234 12.414L4.84552 7.90002H9C9.22092 7.90002 9.4 7.72094 9.4 7.50002C9.4 7.27911 9.22092 7.10002 9 7.10002H4.84553Z",fill:"#666",fillRule:"evenodd",clipRule:"evenodd"})})}),mt=()=>e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M12.8536 2.85355C13.0488 2.65829 13.0488 2.34171 12.8536 2.14645C12.6583 1.95118 12.3417 1.95118 12.1464 2.14645L7.5 6.79289L2.85355 2.14645C2.65829 1.95118 2.34171 1.95118 2.14645 2.14645C1.95118 2.34171 1.95118 2.65829 2.14645 2.85355L6.79289 7.5L2.14645 12.1464C1.95118 12.3417 1.95118 12.6583 2.14645 12.8536C2.34171 13.0488 2.65829 13.0488 2.85355 12.8536L7.5 8.20711L12.1464 12.8536C12.3417 13.0488 12.6583 13.0488 12.8536 12.8536C13.0488 12.6583 13.0488 12.3417 12.8536 12.1464L8.20711 7.5L12.8536 2.85355Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})}),xt=128e3,ft=g.default.div`
519
519
  display: flex;
520
520
  align-items: center;
521
521
  gap: 5px;
522
522
  direction: ${e=>e.isRTL?"rtl":"ltr"};
523
- `;function ft(e){const t=new Int16Array(e.length);for(let n=0;n<e.length;n++){const a=Math.max(-1,Math.min(1,e[n]));t[n]=a<0?32768*a:32767*a}return t}const bt=({setProgress:n,setError:a,setFile:o,onActiveChange:i,config:r})=>{const s="AR"===r?.language,[l,d]=t.useState(!1),g=t.useRef(null),p=t.useRef([]),u=t.useRef(null),h=t.useRef(null),m=t.useRef(!1),x=t.useCallback((()=>{u.current&&(u.current.getTracks().forEach((e=>e.stop())),u.current=null)}),[]);t.useEffect((()=>()=>{const e=g.current;if(e&&"inactive"!==e.state)try{e.stop()}catch{}x()}),[x]);const C=t.useCallback((async()=>{if(a(void 0),l){const e=g.current;if(e&&"inactive"!==e.state)try{e.stop()}catch(e){a(`Failed to stop recording: ${e?.message??"unknown error"}`)}return}if("undefined"==typeof MediaRecorder)return void a("Voice recording is not supported in this browser.");let e;try{e=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}})}catch(e){return a("NotAllowedError"===e?.name?"Microphone access denied. Please allow microphone access and try again.":"NotFoundError"===e?.name?"No microphone found. Please connect a microphone and try again.":`Microphone error: ${e?.message??"unknown error"}`),void(i&&i(!1))}u.current=e;const t=function(){if("undefined"==typeof MediaRecorder)return null;const e=[{mimeType:"audio/ogg;codecs=opus",extension:"ogg"},{mimeType:"audio/webm;codecs=opus",extension:"webm"},{mimeType:"audio/webm",extension:"webm"},{mimeType:"audio/mp4;codecs=mp4a.40.2",extension:"m4a"},{mimeType:"audio/mp4",extension:"m4a"}];for(const t of e)try{if(MediaRecorder.isTypeSupported(t.mimeType))return t}catch{}return{mimeType:"",extension:"webm"}}();let n;h.current=t;try{n=new MediaRecorder(e,t&&t.mimeType?{mimeType:t.mimeType,audioBitsPerSecond:xt}:{audioBitsPerSecond:xt})}catch(e){return x(),a(`Cannot start recording: ${e?.message??"unsupported format"}`),void(i&&i(!1))}p.current=[],m.current=!1,g.current=n,n.ondataavailable=e=>{e.data&&e.data.size>0&&p.current.push(e.data)},n.onerror=e=>{console.error("MediaRecorder error:",e),a(`Recording error: ${e?.error?.message??"unknown error"}`),x(),g.current=null,d(!1),i&&i(!1)},n.onstop=async()=>{const e=m.current;if(m.current=!1,x(),g.current=null,d(!1),e)return p.current=[],void(i&&i(!1));const t=h.current,r=n.mimeType||t?.mimeType||"audio/webm",s=t?.extension??r.split("/")[1]?.split(";")[0]??"webm",l=new Blob(p.current,{type:r});if(p.current=[],!l||0===l.size)return a("Invalid audio recording. Please try again."),void(i&&i(!1));if(l.size<1e3)return a("Recording seems too short. Please try again."),void(i&&i(!1));let u=l,C=r,f=s;if(r.startsWith("audio/webm"))try{u=await async function(e){const t=new(window.AudioContext||window.webkitAudioContext);try{const n=await e.arrayBuffer(),a=await t.decodeAudioData(n),o=Math.max(1,Math.min(2,a.numberOfChannels)),i=a.sampleRate,r=new c.Mp3Encoder(o,i,128),s=1152,l=[];if(1===o){const e=ft(a.getChannelData(0));for(let t=0;t<e.length;t+=s){const n=e.subarray(t,t+s),a=r.encodeBuffer(n);a.length>0&&l.push(a)}}else{const e=ft(a.getChannelData(0)),t=ft(a.getChannelData(1));for(let n=0;n<e.length;n+=s){const a=e.subarray(n,n+s),o=t.subarray(n,n+s),i=r.encodeBuffer(a,o);i.length>0&&l.push(i)}}const d=r.flush();d.length>0&&l.push(d);const g=l.map((e=>{const t=new Uint8Array(e.byteLength);return t.set(e),t}));return new Blob(g,{type:"audio/mpeg"})}finally{"closed"!==t.state&&await t.close()}}(l),C="audio/mpeg",f="mp3"}catch(e){return a(`Failed to convert recording for WhatsApp: ${e?.message??"unknown error"}`),void(i&&i(!1))}const b=`recording-${(new Date).toISOString().replace(/[:.]/g,"-")}.${f}`,y=new File([u],b,{type:C}),v=URL.createObjectURL(y);o({fileUrl:v,fileName:b,extension:f,blob:y}),i&&i(!1)};try{n.start(),d(!0),i&&i(!0)}catch(e){x(),g.current=null,a(`Failed to start recording: ${e?.message??"unknown error"}`),i&&i(!1)}}),[l,a,o,i,x]),f=t.useCallback((()=>{m.current=!0;const e=g.current;if(e&&"inactive"!==e.state)try{e.stop()}catch{}else x(),g.current=null,d(!1);p.current=[],a(void 0),i&&i(!1)}),[a,i,x]);return e.jsxs(Ct,{isRTL:s&&l,children:[l?e.jsx(lt,{onClick:f,children:e.jsx(mt,{})}):null,e.jsx(lt,{onClick:C,id:"voiceRecorderIcon",className:"mic-container",children:l?e.jsxs(e.Fragment,{children:[e.jsx(ht,{isRTL:s}),e.jsx(pt,{className:"circle "+(l?"active":""),$isRecording:l,children:e.jsx(gt,{"aria-hidden":!0})})]}):e.jsx(ct,{activeColor:"var(--bc-chat-text-secondary-dark)"})})]})};const yt=g.default.i`
523
+ `;function Ct(e){const t=new Int16Array(e.length);for(let n=0;n<e.length;n++){const a=Math.max(-1,Math.min(1,e[n]));t[n]=a<0?32768*a:32767*a}return t}const bt=({setProgress:n,setError:a,setFile:o,onActiveChange:i,config:r})=>{const s="AR"===r?.language,[l,d]=t.useState(!1),g=t.useRef(null),p=t.useRef([]),u=t.useRef(null),h=t.useRef(null),m=t.useRef(!1),x=t.useCallback((()=>{u.current&&(u.current.getTracks().forEach((e=>e.stop())),u.current=null)}),[]);t.useEffect((()=>()=>{const e=g.current;if(e&&"inactive"!==e.state)try{e.stop()}catch{}x()}),[x]);const f=t.useCallback((async()=>{if(a(void 0),l){const e=g.current;if(e&&"inactive"!==e.state)try{e.stop()}catch(e){a(`Failed to stop recording: ${e?.message??"unknown error"}`)}return}if("undefined"==typeof MediaRecorder)return void a("Voice recording is not supported in this browser.");let e;try{e=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}})}catch(e){return a("NotAllowedError"===e?.name?"Microphone access denied. Please allow microphone access and try again.":"NotFoundError"===e?.name?"No microphone found. Please connect a microphone and try again.":`Microphone error: ${e?.message??"unknown error"}`),void(i&&i(!1))}u.current=e;const t=function(){if("undefined"==typeof MediaRecorder)return null;const e=[{mimeType:"audio/ogg;codecs=opus",extension:"ogg"},{mimeType:"audio/webm;codecs=opus",extension:"webm"},{mimeType:"audio/webm",extension:"webm"},{mimeType:"audio/mp4;codecs=mp4a.40.2",extension:"m4a"},{mimeType:"audio/mp4",extension:"m4a"}];for(const t of e)try{if(MediaRecorder.isTypeSupported(t.mimeType))return t}catch{}return{mimeType:"",extension:"webm"}}();let n;h.current=t;try{n=new MediaRecorder(e,t&&t.mimeType?{mimeType:t.mimeType,audioBitsPerSecond:xt}:{audioBitsPerSecond:xt})}catch(e){return x(),a(`Cannot start recording: ${e?.message??"unsupported format"}`),void(i&&i(!1))}p.current=[],m.current=!1,g.current=n,n.ondataavailable=e=>{e.data&&e.data.size>0&&p.current.push(e.data)},n.onerror=e=>{console.error("MediaRecorder error:",e),a(`Recording error: ${e?.error?.message??"unknown error"}`),x(),g.current=null,d(!1),i&&i(!1)},n.onstop=async()=>{const e=m.current;if(m.current=!1,x(),g.current=null,d(!1),e)return p.current=[],void(i&&i(!1));const t=h.current,r=n.mimeType||t?.mimeType||"audio/webm",s=t?.extension??r.split("/")[1]?.split(";")[0]??"webm",l=new Blob(p.current,{type:r});if(p.current=[],!l||0===l.size)return a("Invalid audio recording. Please try again."),void(i&&i(!1));if(l.size<1e3)return a("Recording seems too short. Please try again."),void(i&&i(!1));let u=l,f=r,C=s;if(r.startsWith("audio/webm"))try{u=await async function(e){const t=new(window.AudioContext||window.webkitAudioContext);try{const n=await e.arrayBuffer(),a=await t.decodeAudioData(n),o=Math.max(1,Math.min(2,a.numberOfChannels)),i=a.sampleRate,r=new c.Mp3Encoder(o,i,128),s=1152,l=[];if(1===o){const e=Ct(a.getChannelData(0));for(let t=0;t<e.length;t+=s){const n=e.subarray(t,t+s),a=r.encodeBuffer(n);a.length>0&&l.push(a)}}else{const e=Ct(a.getChannelData(0)),t=Ct(a.getChannelData(1));for(let n=0;n<e.length;n+=s){const a=e.subarray(n,n+s),o=t.subarray(n,n+s),i=r.encodeBuffer(a,o);i.length>0&&l.push(i)}}const d=r.flush();d.length>0&&l.push(d);const g=l.map((e=>{const t=new Uint8Array(e.byteLength);return t.set(e),t}));return new Blob(g,{type:"audio/mpeg"})}finally{"closed"!==t.state&&await t.close()}}(l),f="audio/mpeg",C="mp3"}catch(e){return a(`Failed to convert recording for WhatsApp: ${e?.message??"unknown error"}`),void(i&&i(!1))}const b=`recording-${(new Date).toISOString().replace(/[:.]/g,"-")}.${C}`,y=new File([u],b,{type:f}),v=URL.createObjectURL(y);o({fileUrl:v,fileName:b,extension:C,blob:y}),i&&i(!1)};try{n.start(),d(!0),i&&i(!0)}catch(e){x(),g.current=null,a(`Failed to start recording: ${e?.message??"unknown error"}`),i&&i(!1)}}),[l,a,o,i,x]),C=t.useCallback((()=>{m.current=!0;const e=g.current;if(e&&"inactive"!==e.state)try{e.stop()}catch{}else x(),g.current=null,d(!1);p.current=[],a(void 0),i&&i(!1)}),[a,i,x]);return e.jsxs(ft,{isRTL:s&&l,children:[l?e.jsx(lt,{onClick:C,children:e.jsx(mt,{})}):null,e.jsx(lt,{onClick:f,id:"voiceRecorderIcon",className:"mic-container",children:l?e.jsxs(e.Fragment,{children:[e.jsx(ht,{isRTL:s}),e.jsx(pt,{className:"circle "+(l?"active":""),$isRecording:l,children:e.jsx(gt,{"aria-hidden":!0})})]}):e.jsx(ct,{activeColor:"var(--bc-chat-text-secondary-dark)"})})]})};const yt=g.default.i`
524
524
  ${e=>rt('url("data:image/svg+xml,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M10%2019.084C15.0163%2019.0838%2019.0838%2015.0163%2019.084%2010C19.0838%204.98367%2015.0163%200.917168%2010%200.916992C4.98367%200.917168%200.917168%204.98367%200.916992%2010C0.917168%2015.0163%204.98367%2019.0838%2010%2019.084ZM10%2017.584C5.8121%2017.5838%202.41717%2014.1879%202.41699%2010C2.41717%205.8121%205.8121%202.41717%2010%202.41699C14.1879%202.41717%2017.5838%205.8121%2017.584%2010C17.5838%2014.1879%2014.1879%2017.5838%2010%2017.584ZM6.6748%208.5C7.22679%208.49964%207.6748%208.05206%207.6748%207.5C7.6748%206.94794%207.22679%206.50036%206.6748%206.5H6.66699C6.11471%206.5%205.66699%206.94771%205.66699%207.5C5.66699%208.05229%206.11471%208.5%206.66699%208.5H6.6748ZM13.334%208.5C13.886%208.49965%2014.334%208.05207%2014.334%207.5C14.334%206.94793%2013.886%206.50035%2013.334%206.5H13.3262C12.7739%206.50001%2012.3262%206.94772%2012.3262%207.5C12.3262%208.05228%2012.7739%208.49999%2013.3262%208.5H13.334ZM10%2014.917C11.6088%2014.9169%2013.038%2014.1426%2013.9336%2012.9502C14.1819%2012.6191%2014.115%2012.1491%2013.7842%2011.9004C13.453%2011.6517%2012.9832%2011.7188%2012.7344%2012.0498C12.1099%2012.8813%2011.117%2013.4169%2010%2013.417C8.88307%2013.4169%207.89111%2012.8811%207.2666%2012.0498C7.01792%2011.7187%206.54798%2011.6519%206.2168%2011.9004C5.88563%2012.1491%205.81871%2012.619%206.06738%2012.9502C6.96298%2014.1425%208.39126%2014.9169%2010%2014.917Z%22%20fill%3D%22%23161616%22%2F%3E%3C%2Fsvg%3E");',e)}
525
525
  `,vt=g.default.span`
526
526
  margin: 8px;
@@ -603,7 +603,7 @@ i {
603
603
  overflow: hidden;
604
604
  text-overflow: ellipsis;
605
605
  white-space: nowrap;
606
- `,Bt=g.default.button`
606
+ `,Dt=g.default.button`
607
607
  border: none;
608
608
  background: transparent;
609
609
  display: inline-flex;
@@ -622,7 +622,7 @@ i {
622
622
  color: #111827;
623
623
  outline: none;
624
624
  }
625
- `,Dt=()=>e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M8 6.58579L11.2929 3.29289C11.6834 2.90237 12.3166 2.90237 12.7071 3.29289C13.0976 3.68342 13.0976 4.31658 12.7071 4.70711L9.41421 8L12.7071 11.2929C13.0976 11.6834 13.0976 12.3166 12.7071 12.7071C12.3166 13.0976 11.6834 13.0976 11.2929 12.7071L8 9.41421L4.70711 12.7071C4.31658 13.0976 3.68342 13.0976 3.29289 12.7071C2.90237 12.3166 2.90237 11.6834 3.29289 11.2929L6.58579 8L3.29289 4.70711C2.90237 4.31658 2.90237 3.68342 3.29289 3.29289C3.68342 2.90237 4.31658 2.90237 4.70711 3.29289L8 6.58579Z",fill:"currentColor"})}),zt=({config:n,sendMessage:a,setView:o,actionChips:i,noteMode:r,onNoteSend:s,onCloseNoteMode:l,notePlaceholder:c,replyMessageTitle:d,replyMessageContent:g,onCancelReplyMessage:p,autoCompleteEnabled:u,autoCompleteSuggestion:m,onInputChange:x,onAutoCompleteMutate:C})=>{const f="AR"===n?.language,[b,y]=t.useState(),[v,w]=t.useState([]),[M,A]=t.useState(),[k,j]=t.useState(0),L=t.useMemo((()=>Boolean(d||g)),[d,g]),E=t.useMemo((()=>d||("AR"===n?.language?"الرد على رسالة":"TR"===n?.language?"Bir mesaja yanıt veriliyor":"Replying to message")),[n?.language,d]),I=t.useMemo((()=>"AR"===n?.language?"إلغاء":"TR"===n?.language?"İptal":"Cancel"),[n?.language]);t.useEffect((()=>{M&&b&&b.trim().length>0&&A(void 0)}),[M,b]),t.useEffect((()=>{const e=Array.isArray(v)?v:v?[v]:[];M&&e.length>0&&A(void 0)}),[v,M]);const R=t.useCallback((e=>{if(r){const e=(b||"").trim();return s&&s(e),void y("")}const t=e=>{const{fileUrl:t,extension:n}=e;a(h.SupportedImageFormats.indexOf(n)>=0?"image":h.SupportedAudioFormats.indexOf(n)>=0?"audio":"document",t)};if(e)return void(e.blob&&e.fileUrl.startsWith("blob:")?Je(e.blob,j,((n,a)=>{if(n){try{URL.revokeObjectURL(e.fileUrl)}catch{}t({...e,fileUrl:n,blob:void 0})}else a&&A(a)})):t(e));const n=Array.isArray(v)?v:v?[v]:[];if(n.length>0){const e=n.filter((e=>e.blob&&e.fileUrl.startsWith("blob:"))),a=n.filter((e=>!e.blob||!e.fileUrl.startsWith("blob:")));let o=a.length+e.length,i=0;a.forEach((e=>{t(e),i++})),e.length>0?e.forEach((e=>{Je(e.blob,j,((n,a)=>{if(i++,n){try{URL.revokeObjectURL(e.fileUrl)}catch{}t({...e,fileUrl:n,blob:void 0})}else a&&A(`Failed to upload "${e.fileName}": ${a}`);i===o&&(w([]),j(0))}))})):w([])}else a(Ge,b),y("")}),[v,b,a,r,s,w,A,j]);return e.jsxs(Et,{isRTL:f,children:[L?e.jsxs(It,{isRTL:f,children:[e.jsxs(Rt,{isRTL:f,children:[E?e.jsx(St,{children:E}):null,p?e.jsx(Bt,{type:"button",onClick:p,"aria-label":I,title:I,children:e.jsx(Dt,{})}):null]}),g?e.jsx(Ft,{children:g}):null]}):null,e.jsx("div",{className:"bc-InputArea",children:e.jsx(it,{config:n,send:R,text:b,setText:y,file:r?void 0:v,isFileSelected:Array.isArray(v)?v.length>0:!!v,cancelFileUpload:e=>{w(e?t=>{const n=(Array.isArray(t)?t:t?[t]:[]).filter((t=>!(t.fileName===e.fileName&&t.fileUrl===e.fileUrl)));if(e.blob&&e.fileUrl.startsWith("blob:"))try{URL.revokeObjectURL(e.fileUrl)}catch{}return n}:e=>((Array.isArray(e)?e:e?[e]:[]).forEach((e=>{if(e.blob&&e.fileUrl.startsWith("blob:"))try{URL.revokeObjectURL(e.fileUrl)}catch{}})),[]))},noteMode:r,onCloseNoteMode:()=>{y(""),l?.()},notePlaceholder:c,autoCompleteEnabled:u,autoCompleteSuggestion:m,onInputChange:x,onAutoCompleteMutate:C})}),e.jsxs("div",{className:"bc-BottomBar "+(f?"bc-RTL":""),children:[void 0!==i?i:null,e.jsx("div",{className:"bc-CommandsArea "+(f?"bc-RTL":""),children:r?null:e.jsx(Lt,{setView:o,setFile:w,setProgress:j,setError:A,setText:y,text:b,send:R,config:n})})]}),M?e.jsx("div",{className:"bc-uploadFileError",children:M}):null]})},Nt="bc-chat-header-banner",Tt=390,Zt=g.default.div`
625
+ `,Bt=()=>e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M8 6.58579L11.2929 3.29289C11.6834 2.90237 12.3166 2.90237 12.7071 3.29289C13.0976 3.68342 13.0976 4.31658 12.7071 4.70711L9.41421 8L12.7071 11.2929C13.0976 11.6834 13.0976 12.3166 12.7071 12.7071C12.3166 13.0976 11.6834 13.0976 11.2929 12.7071L8 9.41421L4.70711 12.7071C4.31658 13.0976 3.68342 13.0976 3.29289 12.7071C2.90237 12.3166 2.90237 11.6834 3.29289 11.2929L6.58579 8L3.29289 4.70711C2.90237 4.31658 2.90237 3.68342 3.29289 3.29289C3.68342 2.90237 4.31658 2.90237 4.70711 3.29289L8 6.58579Z",fill:"currentColor"})}),zt=({config:n,sendMessage:a,setView:o,actionChips:i,noteMode:r,onNoteSend:s,onCloseNoteMode:l,notePlaceholder:c,replyMessageTitle:d,replyMessageContent:g,onCancelReplyMessage:p,autoCompleteEnabled:u,autoCompleteSuggestion:m,onInputChange:x,onAutoCompleteMutate:f,autoCompleteReplaceDraft:C,autoCompleteReplaceDraftKey:b})=>{const y="AR"===n?.language,[v,w]=t.useState(),M=t.useRef(x),A=t.useRef(f);t.useEffect((()=>{M.current=x}),[x]),t.useEffect((()=>{A.current=f}),[f]),t.useEffect((()=>{void 0!==C&&(A.current?.(null),w(C),M.current?.(C))}),[C,b]);const[k,j]=t.useState([]),[L,E]=t.useState(),[I,R]=t.useState(0),S=t.useMemo((()=>Boolean(d||g)),[d,g]),F=t.useMemo((()=>d||("AR"===n?.language?"الرد على رسالة":"TR"===n?.language?"Bir mesaja yanıt veriliyor":"Replying to message")),[n?.language,d]),D=t.useMemo((()=>"AR"===n?.language?"إلغاء":"TR"===n?.language?"İptal":"Cancel"),[n?.language]);t.useEffect((()=>{L&&v&&v.trim().length>0&&E(void 0)}),[L,v]),t.useEffect((()=>{const e=Array.isArray(k)?k:k?[k]:[];L&&e.length>0&&E(void 0)}),[k,L]);const B=t.useCallback((e=>{if(r){const e=(v||"").trim();return s&&s(e),void w("")}const t=e=>{const{fileUrl:t,extension:n}=e;a(h.SupportedImageFormats.indexOf(n)>=0?"image":h.SupportedAudioFormats.indexOf(n)>=0?"audio":"document",t)};if(e)return void(e.blob&&e.fileUrl.startsWith("blob:")?Je(e.blob,R,((n,a)=>{if(n){try{URL.revokeObjectURL(e.fileUrl)}catch{}t({...e,fileUrl:n,blob:void 0})}else a&&E(a)})):t(e));const n=Array.isArray(k)?k:k?[k]:[];if(n.length>0){const e=n.filter((e=>e.blob&&e.fileUrl.startsWith("blob:"))),a=n.filter((e=>!e.blob||!e.fileUrl.startsWith("blob:")));let o=a.length+e.length,i=0;a.forEach((e=>{t(e),i++})),e.length>0?e.forEach((e=>{Je(e.blob,R,((n,a)=>{if(i++,n){try{URL.revokeObjectURL(e.fileUrl)}catch{}t({...e,fileUrl:n,blob:void 0})}else a&&E(`Failed to upload "${e.fileName}": ${a}`);i===o&&(j([]),R(0))}))})):j([])}else a(Ge,v),w("")}),[k,v,a,r,s,j,E,R]);return e.jsxs(Et,{isRTL:y,children:[S?e.jsxs(It,{isRTL:y,children:[e.jsxs(Rt,{isRTL:y,children:[F?e.jsx(St,{children:F}):null,p?e.jsx(Dt,{type:"button",onClick:p,"aria-label":D,title:D,children:e.jsx(Bt,{})}):null]}),g?e.jsx(Ft,{children:g}):null]}):null,e.jsx("div",{className:"bc-InputArea",children:e.jsx(it,{config:n,send:B,text:v,setText:w,file:r?void 0:k,isFileSelected:Array.isArray(k)?k.length>0:!!k,cancelFileUpload:e=>{j(e?t=>{const n=(Array.isArray(t)?t:t?[t]:[]).filter((t=>!(t.fileName===e.fileName&&t.fileUrl===e.fileUrl)));if(e.blob&&e.fileUrl.startsWith("blob:"))try{URL.revokeObjectURL(e.fileUrl)}catch{}return n}:e=>((Array.isArray(e)?e:e?[e]:[]).forEach((e=>{if(e.blob&&e.fileUrl.startsWith("blob:"))try{URL.revokeObjectURL(e.fileUrl)}catch{}})),[]))},noteMode:r,onCloseNoteMode:()=>{w(""),l?.()},notePlaceholder:c,autoCompleteEnabled:u,autoCompleteSuggestion:m,onInputChange:x,onAutoCompleteMutate:f})}),e.jsxs("div",{className:"bc-BottomBar "+(y?"bc-RTL":""),children:[void 0!==i?i:null,e.jsx("div",{className:"bc-CommandsArea "+(y?"bc-RTL":""),children:r?null:e.jsx(Lt,{setView:o,setFile:j,setProgress:R,setError:E,setText:w,text:v,send:B,config:n})})]}),L?e.jsx("div",{className:"bc-uploadFileError",children:L}):null]})},Nt="bc-chat-header-banner",Tt=390,Zt=g.default.div`
626
626
  ${e=>e.bannerWidth>Tt?"height: 60px;":"height: 90px;"}
627
627
  display: block;
628
628
  width: 100%;
@@ -699,5 +699,5 @@ i {
699
699
  font-style: normal;
700
700
  line-height: var(--bc-chat-lineHeight-xs);
701
701
  color: var(--bc-chat-text-secondary-dark);
702
- `;exports.BCChat=({config:n={language:"EN",backgroundColor:"#F3F4F6"},messages:a=[],sendMessage:o,debug:i,minimize:r,onReachingUp:s,agentsIdsAvatarsMap:l,actionChips:c,noteMode:d,onNoteSend:g,onCloseNoteMode:p,searchPattern:u,notePlaceholder:h,searchMatchNo:m=1,onSearchMatchCount:x,onMessageReply:C,replyMessageTitle:f,replyMessageContent:b,onCancelReplyMessage:y,errorMessage:v,autoCompleteEnabled:w,autoCompleteSuggestion:M,onInputChange:A,onAutoCompleteMutate:k,onContactMessage:j,onContactAddContact:L})=>{const[E,I]=t.useState("MESSAGE_LIST");return e.jsxs(Kt,{className:"bc-chat",children:[n.hideHeader?null:e.jsx(Jt,{config:n,minimize:r}),"MESSAGE_LIST"===E?e.jsx(Ve,{messages:a,sendMessage:o,debug:i,config:n,onReachingUp:s,agentsIdsAvatarsMap:l,searchPattern:u,searchMatchNo:m,onSearchMatchCount:x,onMessageReply:C,errorMessage:v,onContactMessage:j,onContactAddContact:L},"message-list"):null,n.inputDisabled?null:e.jsx(zt,{sendMessage:o,setView:I,config:n,actionChips:c,noteMode:d,onCloseNoteMode:p,onNoteSend:g,notePlaceholder:h,replyMessageTitle:f,replyMessageContent:b,onCancelReplyMessage:y,autoCompleteEnabled:w,autoCompleteSuggestion:M,onInputChange:A,onAutoCompleteMutate:k},"message-input")]})};
702
+ `;exports.BCChat=({config:n={language:"EN",backgroundColor:"#F3F4F6"},messages:a=[],sendMessage:o,debug:i,minimize:r,onReachingUp:s,agentsIdsAvatarsMap:l,actionChips:c,noteMode:d,onNoteSend:g,onCloseNoteMode:p,searchPattern:u,notePlaceholder:h,searchMatchNo:m=1,onSearchMatchCount:x,onMessageReply:f,replyMessageTitle:C,replyMessageContent:b,onCancelReplyMessage:y,errorMessage:v,autoCompleteEnabled:w,autoCompleteSuggestion:M,onInputChange:A,onAutoCompleteMutate:k,autoCompleteReplaceDraft:j,autoCompleteReplaceDraftKey:L,onContactMessage:E,onContactAddContact:I})=>{const[R,S]=t.useState("MESSAGE_LIST");return e.jsxs(Kt,{className:"bc-chat",children:[n.hideHeader?null:e.jsx(Jt,{config:n,minimize:r}),"MESSAGE_LIST"===R?e.jsx(Ve,{messages:a,sendMessage:o,debug:i,config:n,onReachingUp:s,agentsIdsAvatarsMap:l,searchPattern:u,searchMatchNo:m,onSearchMatchCount:x,onMessageReply:f,errorMessage:v,onContactMessage:E,onContactAddContact:I},"message-list"):null,n.inputDisabled?null:e.jsx(zt,{sendMessage:o,setView:S,config:n,actionChips:c,noteMode:d,onCloseNoteMode:p,onNoteSend:g,notePlaceholder:h,replyMessageTitle:C,replyMessageContent:b,onCancelReplyMessage:y,autoCompleteEnabled:w,autoCompleteSuggestion:M,onInputChange:A,onAutoCompleteMutate:k,autoCompleteReplaceDraft:j,autoCompleteReplaceDraftKey:L},"message-input")]})};
703
703
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bcrumbs.net/bc-chat",
3
- "version": "1.0.86",
3
+ "version": "1.0.87",
4
4
  "main": "build/index.js",
5
5
  "module": "build/index.es.js",
6
6
  "jsnext:main": "build/index.es.js",