@helpai/elements 1.1.12 → 1.1.14
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/README.md +4 -3
- package/configurator.mjs +1 -1
- package/elements-web-component.esm.js +27 -27
- package/elements-web-component.esm.js.map +3 -3
- package/elements.cjs.js +27 -27
- package/elements.cjs.js.map +3 -3
- package/elements.esm.js +27 -27
- package/elements.esm.js.map +3 -3
- package/elements.js +26 -26
- package/elements.js.map +3 -3
- package/index.d.ts +35 -13
- package/index.mjs +5 -5
- package/loader.js +1 -1
- package/package.json +1 -1
- package/schema.d.ts +22 -5
- package/schema.json +18 -3
- package/schema.mjs +1 -1
- package/web-component.mjs +4 -4
package/elements.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";var HelpAI=(()=>{var ua=Object.defineProperty;var h_=Object.getOwnPropertyDescriptor;var b_=Object.getOwnPropertyNames;var y_=Object.prototype.hasOwnProperty;var P_=(e,t,n)=>t in e?ua(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var x_=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of b_(t))!y_.call(e,r)&&r!==n&&ua(e,r,{get:()=>t[r],enumerable:!(o=h_(t,r))||o.enumerable});return e};var S_=e=>x_(ua({},"__esModule",{value:!0}),e);var le=(e,t,n)=>P_(e,typeof t!="symbol"?t+"":t,n);var xv={};var C={id:"help-ai",name:"@helpai/elements",global:"HelpAI",tagName:"web-ai-chat",cssPrefix:"helpai",defaultBaseUrl:"https://help.ai",displayName:"Help AI",domain:"help.ai",siteUrl:"https://help.ai"};var Zi={attach:"Attach files",attachmentMimeRejected:"File type not supported",attachmentTooLarge:"File is too large",attachmentTooMany:"Attachment limit reached",conversationClosed:"This chat is closed",conversationLoading:"Loading chat\u2026",loadPreviousMessages:"Load previous messages",close:"Close",collapse:"Collapse",collapseSidebar:"Collapse sidebar",composerPlaceholder:"Type a message\u2026",dateLastWeek:"Last 7 days",dateOlder:"Older",dateToday:"Today",dateYesterday:"Yesterday",dropZone:"Drop files to attach",errorGeneric:"Something went wrong",errorRateLimited:"Too many requests \u2014 please try again in a moment.",errorRetry:"Retry",expand:"Expand",expandSidebar:"Expand sidebar",exitFullscreen:"Exit fullscreen",fullscreen:"Fullscreen",history:"History",historyBack:"Back to chat",historyEmpty:"No previous chats yet",historyLoading:"Loading your chats\u2026",historyContinue:"Continue the chat",historyTitle:"Chat history",loadMoreConversations:"Load more conversations",language:"Language",launcherOpen:"Open chat",launcherLabel:"Chat with us",micStart:"Start voice input",micStop:"Stop voice input",micUnsupported:"Voice input is not supported in this browser",moreActions:"More actions",newConversation:"New chat",panelTitle:"Chat",resizeHandle:"Drag to resize",scrollToBottom:"Scroll to latest",send:"Send",soundOff:"Sound off",soundOn:"Sound on",startNewConversation:"Start a new chat",talkToOperator:"Talk to an operator",connectingOperator:"Connecting you to an operator\u2026",noOperatorAvailable:"No one's available right now \u2014 leave your details and we'll follow up.",chattingWithOperator:"You're chatting with {operator}",cancelOperatorRequest:"Keep chatting with the AI",stop:"Stop",theme:"Theme",themeAuto:"Auto",themeDark:"Dark",themeLight:"Light",textSize:"Text size",textSizeSmall:"Small",textSizeNormal:"Normal",textSizeLarge:"Large",loading:"Loading\u2026",thinking:"Thinking\u2026",thoughts:"Thoughts",toolResult:"Result",sources:"Sources",feedbackUp:"Good response",feedbackDown:"Bad response",feedbackThanks:"Thanks for your feedback",copy:"Copy",copied:"Copied",tabHome:"Home",tabConversations:"Chats",tabHelp:"Help",tabNews:"News",modulesEmpty:"Nothing here yet",moduleBack:"Back",contentLoading:"Loading\u2026",homeGreeting:"How can we help?",homeGreetingNamed:"Hi {name} \u{1F44B}",homeGreetingLead:"How can we help?",homeSearchPlaceholder:"Search for help",homeContentTitle:"Popular articles",homeStatus:"Status",helpTitle:"Help",helpSearchPlaceholder:"Search for help",helpEmpty:"No help articles yet",helpLoading:"Loading help\u2026",helpSearchEmpty:"No results found",newsTitle:"News",newsEmpty:"No news yet",newsLoading:"Loading news\u2026",newsBack:"Back to news",newsPublishedAt:"Published {date}",formSubmit:"Submit",formSkip:"Maybe later",formSubmitted:"Completed",formSkipped:"Maybe later",formFillOut:"Fill out",formRequired:"This field is required",formInvalidEmail:"Enter a valid email address",formInvalidTel:"Enter a valid phone number",formInvalidUrl:"Enter a valid URL",formInvalidNumber:"Enter a valid number",formTooShort:"Too short (min {min} characters)",formTooLong:"Too long (max {max} characters)",formNumberTooSmall:"Must be at least {min}",formNumberTooLarge:"Must be at most {max}",formPatternMismatch:"Please match the requested format",formChooseAtLeast:"Choose at least {min}",formChooseAtMost:"Choose at most {max}",formOther:"Other",formOtherPlaceholder:"Type your answer\u2026",inputRequired:"Questions for you",inputBadge:"Questions",inputAnswered:"Answered",inputSkipped:"Skipped",showOptions:"Show options",hideOptions:"Hide options",qtypeText:"Your answer",qtypeEmail:"Email address",qtypePhone:"Phone number",qtypeNumber:"Number",qtypeDate:"Date",qtypeChooseOne:"Pick one",qtypeChooseAny:"Pick any",qtypeBoolean:"Yes / No",inputSubmit:"Submit answers",inputSubmitHint:"Enter to send \xB7 Shift+Enter = new line",inputSkip:"Skip",confirmYes:"Yes",confirmNo:"No",approve:"Approve",reject:"Reject",approvalPrompt:"{tool} requires your approval to execute.",approvalBody:"Review the tool input above and decide whether to allow this action.",approvalYourResponse:"Your response: {decision}",approvalEditHint:"You can edit this response until this step continues.",approvalSubmitting:"Response submitted. Request in progress\u2026",edit:"Edit",toolParameters:"Parameters",statusAwaiting:"Awaiting Approval",statusResponded:"Submitted",statusRunning:"Running",statusCompleted:"Completed",statusDenied:"Denied",statusError:"Error",statusSuperseded:"Skipped"},k_={attach:"Joindre des fichiers",attachmentMimeRejected:"Type de fichier non pris en charge",attachmentTooLarge:"Le fichier est trop volumineux",attachmentTooMany:"Limite de pi\xE8ces jointes atteinte",conversationClosed:"Ce chat est ferm\xE9",conversationLoading:"Chargement du chat\u2026",loadPreviousMessages:"Charger les messages pr\xE9c\xE9dents",close:"Fermer",collapse:"R\xE9duire",collapseSidebar:"R\xE9duire la barre lat\xE9rale",composerPlaceholder:"\xC9crivez un message\u2026",dateLastWeek:"7 derniers jours",dateOlder:"Plus ancien",dateToday:"Aujourd'hui",dateYesterday:"Hier",dropZone:"D\xE9posez les fichiers \xE0 joindre",errorGeneric:"Une erreur s'est produite",errorRateLimited:"Trop de requ\xEAtes \u2014 veuillez r\xE9essayer dans un instant.",errorRetry:"R\xE9essayer",expand:"Agrandir",expandSidebar:"D\xE9velopper la barre lat\xE9rale",exitFullscreen:"Quitter le plein \xE9cran",fullscreen:"Plein \xE9cran",history:"Historique",historyBack:"Retour au chat",historyEmpty:"Aucun chat pour le moment",historyContinue:"Poursuivre le chat",historyLoading:"Chargement de vos chats\u2026",historyTitle:"Historique des chats",loadMoreConversations:"Charger plus de conversations",language:"Langue",launcherOpen:"Ouvrir le chat",launcherLabel:"Discuter avec nous",micStart:"D\xE9marrer la saisie vocale",micStop:"Arr\xEAter la saisie vocale",micUnsupported:"La saisie vocale n'est pas prise en charge par ce navigateur",moreActions:"Plus d'actions",newConversation:"Nouveau chat",panelTitle:"Chat",resizeHandle:"Glisser pour redimensionner",scrollToBottom:"Aller au plus r\xE9cent",send:"Envoyer",soundOff:"Son d\xE9sactiv\xE9",soundOn:"Son activ\xE9",startNewConversation:"D\xE9marrer un nouveau chat",talkToOperator:"Parler \xE0 un op\xE9rateur",connectingOperator:"Mise en relation avec un op\xE9rateur\u2026",noOperatorAvailable:"Personne n'est disponible pour le moment \u2014 laissez vos coordonn\xE9es et nous reviendrons vers vous.",chattingWithOperator:"Vous discutez avec {operator}",cancelOperatorRequest:"Continuer avec l'IA",stop:"Arr\xEAter",theme:"Th\xE8me",themeAuto:"Auto",themeDark:"Sombre",themeLight:"Clair",textSize:"Taille du texte",textSizeSmall:"Petite",textSizeNormal:"Normale",textSizeLarge:"Grande",loading:"Chargement\u2026",thinking:"R\xE9flexion\u2026",thoughts:"R\xE9flexions",toolResult:"R\xE9sultat",sources:"Sources",feedbackUp:"Bonne r\xE9ponse",feedbackDown:"Mauvaise r\xE9ponse",feedbackThanks:"Merci pour votre retour",copy:"Copier",copied:"Copi\xE9",tabHome:"Accueil",tabConversations:"Chats",tabHelp:"Aide",tabNews:"Actualit\xE9s",modulesEmpty:"Rien pour le moment",moduleBack:"Retour",contentLoading:"Chargement\u2026",homeGreeting:"Comment pouvons-nous vous aider ?",homeGreetingNamed:"Bonjour {name} \u{1F44B}",homeGreetingLead:"Comment pouvons-nous vous aider ?",homeSearchPlaceholder:"Rechercher de l'aide",homeContentTitle:"Articles populaires",homeStatus:"Statut",helpTitle:"Aide",helpSearchPlaceholder:"Rechercher de l'aide",helpEmpty:"Aucun article d'aide pour le moment",helpLoading:"Chargement de l'aide\u2026",helpSearchEmpty:"Aucun r\xE9sultat trouv\xE9",newsTitle:"Actualit\xE9s",newsEmpty:"Aucune actualit\xE9 pour le moment",newsLoading:"Chargement des actualit\xE9s\u2026",newsBack:"Retour aux actualit\xE9s",newsPublishedAt:"Publi\xE9 le {date}",formSubmit:"Envoyer",formSkip:"Plus tard",formSubmitted:"Termin\xE9",formSkipped:"Plus tard",formFillOut:"Remplir",formRequired:"Ce champ est obligatoire",formInvalidEmail:"Saisissez une adresse e-mail valide",formInvalidTel:"Saisissez un num\xE9ro de t\xE9l\xE9phone valide",formInvalidUrl:"Saisissez une URL valide",formInvalidNumber:"Saisissez un nombre valide",formTooShort:"Trop court (min. {min} caract\xE8res)",formTooLong:"Trop long (max. {max} caract\xE8res)",formNumberTooSmall:"Doit \xEAtre au moins {min}",formNumberTooLarge:"Doit \xEAtre au plus {max}",formPatternMismatch:"Veuillez respecter le format demand\xE9",formChooseAtLeast:"Choisissez au moins {min}",formChooseAtMost:"Choisissez au plus {max}",formOther:"Autre",formOtherPlaceholder:"Saisissez votre r\xE9ponse\u2026",inputRequired:"Questions pour vous",inputBadge:"Questions",inputAnswered:"R\xE9pondu",inputSkipped:"Ignor\xE9",showOptions:"Afficher les options",hideOptions:"Masquer les options",qtypeText:"Votre r\xE9ponse",qtypeEmail:"Adresse e-mail",qtypePhone:"Num\xE9ro de t\xE9l\xE9phone",qtypeNumber:"Nombre",qtypeDate:"Date",qtypeChooseOne:"Choisir une",qtypeChooseAny:"Choisir plusieurs",qtypeBoolean:"Oui / Non",inputSubmit:"Envoyer les r\xE9ponses",inputSubmitHint:"Entr\xE9e pour envoyer \xB7 Maj+Entr\xE9e = saut de ligne",inputSkip:"Ignorer",confirmYes:"Oui",confirmNo:"Non",approve:"Approuver",reject:"Refuser",approvalPrompt:"{tool} n\xE9cessite votre approbation pour s'ex\xE9cuter.",approvalBody:"V\xE9rifiez les param\xE8tres ci-dessus et d\xE9cidez d'autoriser ou non cette action.",approvalYourResponse:"Votre r\xE9ponse : {decision}",approvalEditHint:"Vous pouvez modifier votre r\xE9ponse jusqu'\xE0 la reprise de cette \xE9tape.",approvalSubmitting:"R\xE9ponse envoy\xE9e. Traitement en cours\u2026",edit:"Modifier",toolParameters:"Param\xE8tres",statusAwaiting:"En attente d'approbation",statusResponded:"Envoy\xE9",statusRunning:"En cours",statusCompleted:"Termin\xE9",statusDenied:"Refus\xE9",statusError:"Erreur",statusSuperseded:"Ignor\xE9"},w_={attach:"\u0625\u0631\u0641\u0627\u0642 \u0645\u0644\u0641\u0627\u062A",attachmentMimeRejected:"\u0646\u0648\u0639 \u0627\u0644\u0645\u0644\u0641 \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645",attachmentTooLarge:"\u062D\u062C\u0645 \u0627\u0644\u0645\u0644\u0641 \u0643\u0628\u064A\u0631 \u062C\u062F\u064B\u0627",attachmentTooMany:"\u062A\u0645 \u0628\u0644\u0648\u063A \u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 \u0644\u0644\u0645\u0631\u0641\u0642\u0627\u062A",conversationClosed:"\u062A\u0645 \u0625\u063A\u0644\u0627\u0642 \u0647\u0630\u0647 \u0627\u0644\u062F\u0631\u062F\u0634\u0629",conversationLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u062F\u0631\u062F\u0634\u0629\u2026",loadPreviousMessages:"\u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0631\u0633\u0627\u0626\u0644 \u0627\u0644\u0633\u0627\u0628\u0642\u0629",close:"\u0625\u063A\u0644\u0627\u0642",collapse:"\u0637\u064A\u0651",collapseSidebar:"\u0637\u064A\u0651 \u0627\u0644\u0634\u0631\u064A\u0637 \u0627\u0644\u062C\u0627\u0646\u0628\u064A",composerPlaceholder:"\u0627\u0643\u062A\u0628 \u0631\u0633\u0627\u0644\u0629\u2026",dateLastWeek:"\u0622\u062E\u0631 \u0667 \u0623\u064A\u0627\u0645",dateOlder:"\u0623\u0642\u062F\u0645",dateToday:"\u0627\u0644\u064A\u0648\u0645",dateYesterday:"\u0623\u0645\u0633",dropZone:"\u0623\u0641\u0644\u062A \u0627\u0644\u0645\u0644\u0641\u0627\u062A \u0644\u0625\u0631\u0641\u0627\u0642\u0647\u0627",errorGeneric:"\u062D\u062F\u062B \u062E\u0637\u0623 \u0645\u0627",errorRateLimited:"\u0637\u0644\u0628\u0627\u062A \u0643\u062B\u064A\u0631\u0629 \u062C\u062F\u064B\u0627 \u2014 \u064A\u0631\u062C\u0649 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629 \u0628\u0639\u062F \u0644\u062D\u0638\u0629.",errorRetry:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629",expand:"\u062A\u0648\u0633\u064A\u0639",expandSidebar:"\u062A\u0648\u0633\u064A\u0639 \u0627\u0644\u0634\u0631\u064A\u0637 \u0627\u0644\u062C\u0627\u0646\u0628\u064A",exitFullscreen:"\u0625\u0646\u0647\u0627\u0621 \u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629",fullscreen:"\u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629",history:"\u0627\u0644\u0633\u062C\u0644",historyBack:"\u0627\u0644\u0639\u0648\u062F\u0629 \u0625\u0644\u0649 \u0627\u0644\u062F\u0631\u062F\u0634\u0629",historyEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u062F\u0631\u062F\u0634\u0627\u062A \u0633\u0627\u0628\u0642\u0629 \u0628\u0639\u062F",historyContinue:"\u0645\u062A\u0627\u0628\u0639\u0629 \u0627\u0644\u062F\u0631\u062F\u0634\u0629",historyLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u062F\u0631\u062F\u0634\u0627\u062A\u0643\u2026",historyTitle:"\u0633\u062C\u0644 \u0627\u0644\u062F\u0631\u062F\u0634\u0627\u062A",loadMoreConversations:"\u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u0632\u064A\u062F \u0645\u0646 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0627\u062A",language:"\u0627\u0644\u0644\u063A\u0629",launcherOpen:"\u0641\u062A\u062D \u0627\u0644\u062F\u0631\u062F\u0634\u0629",launcherLabel:"\u062A\u062D\u062F\u062B \u0645\u0639\u0646\u0627",micStart:"\u0628\u062F\u0621 \u0627\u0644\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0635\u0648\u062A\u064A",micStop:"\u0625\u064A\u0642\u0627\u0641 \u0627\u0644\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0635\u0648\u062A\u064A",micUnsupported:"\u0627\u0644\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0635\u0648\u062A\u064A \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645 \u0641\u064A \u0647\u0630\u0627 \u0627\u0644\u0645\u062A\u0635\u0641\u062D",moreActions:"\u0625\u062C\u0631\u0627\u0621\u0627\u062A \u0625\u0636\u0627\u0641\u064A\u0629",newConversation:"\u062F\u0631\u062F\u0634\u0629 \u062C\u062F\u064A\u062F\u0629",panelTitle:"\u0627\u0644\u062F\u0631\u062F\u0634\u0629",resizeHandle:"\u0627\u0633\u062D\u0628 \u0644\u062A\u063A\u064A\u064A\u0631 \u0627\u0644\u062D\u062C\u0645",scrollToBottom:"\u0627\u0644\u0627\u0646\u062A\u0642\u0627\u0644 \u0625\u0644\u0649 \u0627\u0644\u0623\u062D\u062F\u062B",send:"\u0625\u0631\u0633\u0627\u0644",soundOff:"\u0643\u062A\u0645 \u0627\u0644\u0635\u0648\u062A",soundOn:"\u062A\u0634\u063A\u064A\u0644 \u0627\u0644\u0635\u0648\u062A",startNewConversation:"\u0628\u062F\u0621 \u062F\u0631\u062F\u0634\u0629 \u062C\u062F\u064A\u062F\u0629",talkToOperator:"\u0627\u0644\u062A\u062D\u062F\u062B \u0625\u0644\u0649 \u0645\u0648\u0638\u0641",connectingOperator:"\u062C\u0627\u0631\u064A \u062A\u0648\u0635\u064A\u0644\u0643 \u0628\u0623\u062D\u062F \u0627\u0644\u0645\u0648\u0638\u0641\u064A\u0646\u2026",noOperatorAvailable:"\u0644\u0627 \u064A\u0648\u062C\u062F \u0645\u0648\u0638\u0641\u0648\u0646 \u0645\u062A\u0627\u062D\u0648\u0646 \u0627\u0644\u0622\u0646 \u2014 \u0627\u062A\u0631\u0643 \u0628\u064A\u0627\u0646\u0627\u062A\u0643 \u0648\u0633\u0646\u062A\u0648\u0627\u0635\u0644 \u0645\u0639\u0643.",chattingWithOperator:"\u0623\u0646\u062A \u062A\u062A\u062D\u062F\u062B \u0645\u0639 {operator}",cancelOperatorRequest:"\u0645\u062A\u0627\u0628\u0639\u0629 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629 \u0645\u0639 \u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A",stop:"\u0625\u064A\u0642\u0627\u0641",theme:"\u0627\u0644\u0645\u0638\u0647\u0631",themeAuto:"\u062A\u0644\u0642\u0627\u0626\u064A",themeDark:"\u062F\u0627\u0643\u0646",themeLight:"\u0641\u0627\u062A\u062D",textSize:"\u062D\u062C\u0645 \u0627\u0644\u0646\u0635",textSizeSmall:"\u0635\u063A\u064A\u0631",textSizeNormal:"\u0639\u0627\u062F\u064A",textSizeLarge:"\u0643\u0628\u064A\u0631",loading:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026",thinking:"\u064A\u0641\u0643\u0651\u0631\u2026",thoughts:"\u0627\u0644\u0623\u0641\u0643\u0627\u0631",toolResult:"\u0627\u0644\u0646\u062A\u064A\u062C\u0629",sources:"\u0627\u0644\u0645\u0635\u0627\u062F\u0631",feedbackUp:"\u0631\u062F \u062C\u064A\u062F",feedbackDown:"\u0631\u062F \u0633\u064A\u0626",feedbackThanks:"\u0634\u0643\u0631\u064B\u0627 \u0639\u0644\u0649 \u0645\u0644\u0627\u062D\u0638\u0627\u062A\u0643",copy:"\u0646\u0633\u062E",copied:"\u062A\u0645 \u0627\u0644\u0646\u0633\u062E",tabHome:"\u0627\u0644\u0631\u0626\u064A\u0633\u064A\u0629",tabConversations:"\u0627\u0644\u062F\u0631\u062F\u0634\u0627\u062A",tabHelp:"\u0627\u0644\u0645\u0633\u0627\u0639\u062F\u0629",tabNews:"\u0627\u0644\u0623\u062E\u0628\u0627\u0631",modulesEmpty:"\u0644\u0627 \u0634\u064A\u0621 \u0647\u0646\u0627 \u0628\u0639\u062F",moduleBack:"\u0631\u062C\u0648\u0639",contentLoading:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026",homeGreeting:"\u0643\u064A\u0641 \u064A\u0645\u0643\u0646\u0646\u0627 \u0645\u0633\u0627\u0639\u062F\u062A\u0643\u061F",homeGreetingNamed:"\u0645\u0631\u062D\u0628\u064B\u0627 {name} \u{1F44B}",homeGreetingLead:"\u0643\u064A\u0641 \u064A\u0645\u0643\u0646\u0646\u0627 \u0645\u0633\u0627\u0639\u062F\u062A\u0643\u061F",homeSearchPlaceholder:"\u0627\u0628\u062D\u062B \u0639\u0646 \u0645\u0633\u0627\u0639\u062F\u0629",homeContentTitle:"\u0645\u0642\u0627\u0644\u0627\u062A \u0634\u0627\u0626\u0639\u0629",homeStatus:"\u0627\u0644\u062D\u0627\u0644\u0629",helpTitle:"\u0627\u0644\u0645\u0633\u0627\u0639\u062F\u0629",helpSearchPlaceholder:"\u0627\u0628\u062D\u062B \u0639\u0646 \u0645\u0633\u0627\u0639\u062F\u0629",helpEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0645\u0642\u0627\u0644\u0627\u062A \u0645\u0633\u0627\u0639\u062F\u0629 \u0628\u0639\u062F",helpLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u0633\u0627\u0639\u062F\u0629\u2026",helpSearchEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0646\u062A\u0627\u0626\u062C",newsTitle:"\u0627\u0644\u0623\u062E\u0628\u0627\u0631",newsEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0623\u062E\u0628\u0627\u0631 \u0628\u0639\u062F",newsLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0623\u062E\u0628\u0627\u0631\u2026",newsBack:"\u0627\u0644\u0639\u0648\u062F\u0629 \u0625\u0644\u0649 \u0627\u0644\u0623\u062E\u0628\u0627\u0631",newsPublishedAt:"\u0646\u064F\u0634\u0631 \u0641\u064A {date}",formSubmit:"\u0625\u0631\u0633\u0627\u0644",formSkip:"\u0644\u0627\u062D\u0642\u064B\u0627",formSubmitted:"\u062A\u0645",formSkipped:"\u0644\u0627\u062D\u0642\u064B\u0627",formFillOut:"\u062A\u0639\u0628\u0626\u0629",formRequired:"\u0647\u0630\u0627 \u0627\u0644\u062D\u0642\u0644 \u0645\u0637\u0644\u0648\u0628",formInvalidEmail:"\u0623\u062F\u062E\u0644 \u0628\u0631\u064A\u062F\u064B\u0627 \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",formInvalidTel:"\u0623\u062F\u062E\u0644 \u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0635\u062D\u064A\u062D\u064B\u0627",formInvalidUrl:"\u0623\u062F\u062E\u0644 \u0631\u0627\u0628\u0637\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",formInvalidNumber:"\u0623\u062F\u062E\u0644 \u0631\u0642\u0645\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",formTooShort:"\u0642\u0635\u064A\u0631 \u062C\u062F\u064B\u0627 (\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u062F\u0646\u0649 {min} \u062D\u0631\u0641\u064B\u0627)",formTooLong:"\u0637\u0648\u064A\u0644 \u062C\u062F\u064B\u0627 (\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 {max} \u062D\u0631\u0641\u064B\u0627)",formNumberTooSmall:"\u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0642\u0644 \u0639\u0646 {min}",formNumberTooLarge:"\u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0632\u064A\u062F \u0639\u0646 {max}",formPatternMismatch:"\u064A\u0631\u062C\u0649 \u0645\u0637\u0627\u0628\u0642\u0629 \u0627\u0644\u0635\u064A\u063A\u0629 \u0627\u0644\u0645\u0637\u0644\u0648\u0628\u0629",formChooseAtLeast:"\u0627\u062E\u062A\u0631 {min} \u0639\u0644\u0649 \u0627\u0644\u0623\u0642\u0644",formChooseAtMost:"\u0627\u062E\u062A\u0631 {max} \u0639\u0644\u0649 \u0627\u0644\u0623\u0643\u062B\u0631",formOther:"\u0623\u062E\u0631\u0649",formOtherPlaceholder:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643\u2026",inputRequired:"\u0623\u0633\u0626\u0644\u0629 \u0644\u0643",inputBadge:"\u0623\u0633\u0626\u0644\u0629",inputAnswered:"\u062A\u0645\u062A \u0627\u0644\u0625\u062C\u0627\u0628\u0629",inputSkipped:"\u062A\u0645 \u0627\u0644\u062A\u062E\u0637\u064A",showOptions:"\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A",hideOptions:"\u0625\u062E\u0641\u0627\u0621 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A",qtypeText:"\u0625\u062C\u0627\u0628\u062A\u0643",qtypeEmail:"\u0639\u0646\u0648\u0627\u0646 \u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",qtypePhone:"\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062A\u0641",qtypeNumber:"\u0631\u0642\u0645",qtypeDate:"\u062A\u0627\u0631\u064A\u062E",qtypeChooseOne:"\u0627\u062E\u062A\u0631 \u0648\u0627\u062D\u062F\u064B\u0627",qtypeChooseAny:"\u0627\u062E\u062A\u0631 \u0623\u064A\u064B\u0627",qtypeBoolean:"\u0646\u0639\u0645 / \u0644\u0627",inputSubmit:"\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A",inputSubmitHint:"Enter \u0644\u0644\u0625\u0631\u0633\u0627\u0644 \xB7 Shift+Enter = \u0633\u0637\u0631 \u062C\u062F\u064A\u062F",inputSkip:"\u062A\u062E\u0637\u064D\u0651",confirmYes:"\u0646\u0639\u0645",confirmNo:"\u0644\u0627",approve:"\u0645\u0648\u0627\u0641\u0642\u0629",reject:"\u0631\u0641\u0636",approvalPrompt:"\u062A\u062A\u0637\u0644\u0628 {tool} \u0645\u0648\u0627\u0641\u0642\u062A\u0643 \u0644\u0644\u062A\u0646\u0641\u064A\u0630.",approvalBody:"\u0631\u0627\u062C\u0639 \u0645\u064F\u0639\u0637\u064A\u0627\u062A \u0627\u0644\u0623\u062F\u0627\u0629 \u0623\u0639\u0644\u0627\u0647 \u0648\u0642\u0631\u0651\u0631 \u0627\u0644\u0633\u0645\u0627\u062D \u0628\u0647\u0630\u0627 \u0627\u0644\u0625\u062C\u0631\u0627\u0621 \u0623\u0648 \u0631\u0641\u0636\u0647.",approvalYourResponse:"\u0631\u062F\u0651\u0643: {decision}",approvalEditHint:"\u064A\u0645\u0643\u0646\u0643 \u062A\u0639\u062F\u064A\u0644 \u0631\u062F\u0651\u0643 \u062D\u062A\u0649 \u062A\u0633\u062A\u0623\u0646\u0641 \u0647\u0630\u0647 \u0627\u0644\u062E\u0637\u0648\u0629.",approvalSubmitting:"\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0631\u062F. \u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0646\u0641\u064A\u0630\u2026",edit:"\u062A\u0639\u062F\u064A\u0644",toolParameters:"\u0627\u0644\u0645\u0639\u0637\u064A\u0627\u062A",statusAwaiting:"\u0628\u0627\u0646\u062A\u0638\u0627\u0631 \u0627\u0644\u0645\u0648\u0627\u0641\u0642\u0629",statusResponded:"\u062A\u0645 \u0627\u0644\u0625\u0631\u0633\u0627\u0644",statusRunning:"\u0642\u064A\u062F \u0627\u0644\u062A\u0646\u0641\u064A\u0630",statusCompleted:"\u0645\u0643\u062A\u0645\u0644",statusDenied:"\u0645\u0631\u0641\u0648\u0636",statusError:"\u062E\u0637\u0623",statusSuperseded:"\u062A\u0645 \u0627\u0644\u062A\u062E\u0637\u064A"},C_={attach:"Adjuntar archivos",attachmentMimeRejected:"Tipo de archivo no admitido",attachmentTooLarge:"El archivo es demasiado grande",attachmentTooMany:"Se alcanz\xF3 el l\xEDmite de adjuntos",conversationClosed:"Este chat est\xE1 cerrado",conversationLoading:"Cargando chat\u2026",loadPreviousMessages:"Cargar mensajes anteriores",close:"Cerrar",collapse:"Contraer",collapseSidebar:"Contraer la barra lateral",composerPlaceholder:"Escribe un mensaje\u2026",dateLastWeek:"\xDAltimos 7 d\xEDas",dateOlder:"Anteriores",dateToday:"Hoy",dateYesterday:"Ayer",dropZone:"Suelta los archivos para adjuntarlos",errorGeneric:"Algo sali\xF3 mal",errorRateLimited:"Demasiadas solicitudes: int\xE9ntalo de nuevo en un momento.",errorRetry:"Reintentar",expand:"Ampliar",expandSidebar:"Expandir la barra lateral",exitFullscreen:"Salir de pantalla completa",fullscreen:"Pantalla completa",history:"Historial",historyBack:"Volver al chat",historyEmpty:"A\xFAn no tienes chats",historyContinue:"Continuar el chat",historyLoading:"Cargando tus chats\u2026",historyTitle:"Historial de chats",loadMoreConversations:"Cargar m\xE1s conversaciones",language:"Idioma",launcherOpen:"Abrir el chat",launcherLabel:"Chatea con nosotros",micStart:"Iniciar entrada de voz",micStop:"Detener entrada de voz",micUnsupported:"Este navegador no admite la entrada de voz",moreActions:"M\xE1s acciones",newConversation:"Nuevo chat",panelTitle:"Chat",resizeHandle:"Arrastra para cambiar el tama\xF1o",scrollToBottom:"Ir a lo m\xE1s reciente",send:"Enviar",soundOff:"Sonido desactivado",soundOn:"Sonido activado",startNewConversation:"Iniciar un chat nuevo",talkToOperator:"Hablar con un operador",connectingOperator:"Conect\xE1ndote con un operador\u2026",noOperatorAvailable:"Nadie est\xE1 disponible ahora \u2014 deja tus datos y te contactaremos.",chattingWithOperator:"Est\xE1s chateando con {operator}",cancelOperatorRequest:"Seguir con la IA",stop:"Detener",theme:"Tema",themeAuto:"Autom\xE1tico",themeDark:"Oscuro",themeLight:"Claro",textSize:"Tama\xF1o del texto",textSizeSmall:"Peque\xF1o",textSizeNormal:"Normal",textSizeLarge:"Grande",loading:"Cargando\u2026",thinking:"Pensando\u2026",thoughts:"Razonamiento",toolResult:"Resultado",sources:"Fuentes",feedbackUp:"Buena respuesta",feedbackDown:"Mala respuesta",feedbackThanks:"Gracias por tu opini\xF3n",copy:"Copiar",copied:"Copiado",tabHome:"Inicio",tabConversations:"Chats",tabHelp:"Ayuda",tabNews:"Novedades",modulesEmpty:"A\xFAn no hay nada aqu\xED",moduleBack:"Atr\xE1s",contentLoading:"Cargando\u2026",homeGreeting:"\xBFC\xF3mo podemos ayudarte?",homeGreetingNamed:"Hola, {name} \u{1F44B}",homeGreetingLead:"\xBFC\xF3mo podemos ayudarte?",homeSearchPlaceholder:"Buscar ayuda",homeContentTitle:"Art\xEDculos populares",homeStatus:"Estado",helpTitle:"Ayuda",helpSearchPlaceholder:"Buscar ayuda",helpEmpty:"A\xFAn no hay art\xEDculos de ayuda",helpLoading:"Cargando la ayuda\u2026",helpSearchEmpty:"No se encontraron resultados",newsTitle:"Novedades",newsEmpty:"A\xFAn no hay novedades",newsLoading:"Cargando novedades\u2026",newsBack:"Volver a novedades",newsPublishedAt:"Publicado el {date}",formSubmit:"Enviar",formSkip:"Quiz\xE1 m\xE1s tarde",formSubmitted:"Completado",formSkipped:"Quiz\xE1 m\xE1s tarde",formFillOut:"Completar",formRequired:"Este campo es obligatorio",formInvalidEmail:"Introduce un correo electr\xF3nico v\xE1lido",formInvalidTel:"Introduce un n\xFAmero de tel\xE9fono v\xE1lido",formInvalidUrl:"Introduce una URL v\xE1lida",formInvalidNumber:"Introduce un n\xFAmero v\xE1lido",formTooShort:"Demasiado corto (m\xEDn. {min} caracteres)",formTooLong:"Demasiado largo (m\xE1x. {max} caracteres)",formNumberTooSmall:"Debe ser al menos {min}",formNumberTooLarge:"Debe ser como m\xE1ximo {max}",formPatternMismatch:"Respeta el formato solicitado",formChooseAtLeast:"Elige al menos {min}",formChooseAtMost:"Elige como m\xE1ximo {max}",formOther:"Otro",formOtherPlaceholder:"Escribe tu respuesta\u2026",inputRequired:"Preguntas para ti",inputBadge:"Preguntas",inputAnswered:"Respondido",inputSkipped:"Omitido",showOptions:"Mostrar opciones",hideOptions:"Ocultar opciones",qtypeText:"Tu respuesta",qtypeEmail:"Correo electr\xF3nico",qtypePhone:"N\xFAmero de tel\xE9fono",qtypeNumber:"N\xFAmero",qtypeDate:"Fecha",qtypeChooseOne:"Elige una",qtypeChooseAny:"Elige varias",qtypeBoolean:"S\xED / No",inputSubmit:"Enviar respuestas",inputSubmitHint:"Enter para enviar \xB7 May\xFAs+Enter = nueva l\xEDnea",inputSkip:"Omitir",confirmYes:"S\xED",confirmNo:"No",approve:"Aprobar",reject:"Rechazar",approvalPrompt:"{tool} requiere tu aprobaci\xF3n para ejecutarse.",approvalBody:"Revisa los par\xE1metros de arriba y decide si permites esta acci\xF3n.",approvalYourResponse:"Tu respuesta: {decision}",approvalEditHint:"Puedes cambiar tu respuesta hasta que este paso contin\xFAe.",approvalSubmitting:"Respuesta enviada. Procesando\u2026",edit:"Editar",toolParameters:"Par\xE1metros",statusAwaiting:"Esperando aprobaci\xF3n",statusResponded:"Enviado",statusRunning:"En curso",statusCompleted:"Completado",statusDenied:"Denegado",statusError:"Error",statusSuperseded:"Omitido"},R_={attach:"\u05E6\u05D9\u05E8\u05D5\u05E3 \u05E7\u05D1\u05E6\u05D9\u05DD",attachmentMimeRejected:"\u05E1\u05D5\u05D2 \u05D4\u05E7\u05D5\u05D1\u05E5 \u05D0\u05D9\u05E0\u05D5 \u05E0\u05EA\u05DE\u05DA",attachmentTooLarge:"\u05D4\u05E7\u05D5\u05D1\u05E5 \u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9",attachmentTooMany:"\u05D4\u05D2\u05E2\u05EA \u05DC\u05DE\u05E1\u05E4\u05E8 \u05D4\u05DE\u05E8\u05D1\u05D9 \u05E9\u05DC \u05E7\u05D1\u05E6\u05D9\u05DD \u05DE\u05E6\u05D5\u05E8\u05E4\u05D9\u05DD",conversationClosed:"\u05D4\u05E6\u05F3\u05D0\u05D8 \u05D4\u05D6\u05D4 \u05E0\u05E1\u05D2\u05E8",conversationLoading:"\u05D8\u05D5\u05E2\u05DF \u05E6\u05F3\u05D0\u05D8\u2026",loadPreviousMessages:"\u05D8\u05E2\u05D9\u05E0\u05EA \u05D4\u05D5\u05D3\u05E2\u05D5\u05EA \u05E7\u05D5\u05D3\u05DE\u05D5\u05EA",close:"\u05E1\u05D2\u05D9\u05E8\u05D4",collapse:"\u05DB\u05D9\u05D5\u05D5\u05E5",collapseSidebar:"\u05DB\u05D9\u05D5\u05D5\u05E5 \u05E1\u05E8\u05D2\u05DC \u05D4\u05E6\u05D3",composerPlaceholder:"\u05DB\u05EA\u05D5\u05D1 \u05D4\u05D5\u05D3\u05E2\u05D4\u2026",dateLastWeek:"7 \u05D4\u05D9\u05DE\u05D9\u05DD \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D9\u05DD",dateOlder:"\u05D9\u05E9\u05DF \u05D9\u05D5\u05EA\u05E8",dateToday:"\u05D4\u05D9\u05D5\u05DD",dateYesterday:"\u05D0\u05EA\u05DE\u05D5\u05DC",dropZone:"\u05E9\u05D7\u05E8\u05E8 \u05E7\u05D1\u05E6\u05D9\u05DD \u05DB\u05D3\u05D9 \u05DC\u05E6\u05E8\u05E3",errorGeneric:"\u05DE\u05E9\u05D4\u05D5 \u05D4\u05E9\u05EA\u05D1\u05E9",errorRateLimited:"\u05D9\u05D5\u05EA\u05E8 \u05DE\u05D3\u05D9 \u05D1\u05E7\u05E9\u05D5\u05EA \u2014 \u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1 \u05D1\u05E2\u05D5\u05D3 \u05E8\u05D2\u05E2.",errorRetry:"\u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1",expand:"\u05D4\u05E8\u05D7\u05D1\u05D4",expandSidebar:"\u05D4\u05E8\u05D7\u05D1\u05EA \u05E1\u05E8\u05D2\u05DC \u05D4\u05E6\u05D3",exitFullscreen:"\u05D9\u05E6\u05D9\u05D0\u05D4 \u05DE\u05DE\u05E1\u05DA \u05DE\u05DC\u05D0",fullscreen:"\u05DE\u05E1\u05DA \u05DE\u05DC\u05D0",history:"\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D4",historyBack:"\u05D7\u05D6\u05E8\u05D4 \u05DC\u05E6\u05F3\u05D0\u05D8",historyEmpty:"\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05E6\u05F3\u05D0\u05D8\u05D9\u05DD \u05E7\u05D5\u05D3\u05DE\u05D9\u05DD",historyContinue:"\u05D4\u05DE\u05E9\u05DA \u05E6\u05F3\u05D0\u05D8",historyLoading:"\u05D8\u05D5\u05E2\u05DF \u05D0\u05EA \u05D4\u05E6\u05F3\u05D0\u05D8\u05D9\u05DD \u05E9\u05DC\u05DA\u2026",historyTitle:"\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05E6\u05F3\u05D0\u05D8\u05D9\u05DD",loadMoreConversations:"\u05D8\u05E2\u05D9\u05E0\u05EA \u05E9\u05D9\u05D7\u05D5\u05EA \u05E0\u05D5\u05E1\u05E4\u05D5\u05EA",language:"\u05E9\u05E4\u05D4",launcherOpen:"\u05E4\u05EA\u05D9\u05D7\u05EA \u05E6\u05F3\u05D0\u05D8",launcherLabel:"\u05D3\u05D1\u05E8\u05D5 \u05D0\u05D9\u05EA\u05E0\u05D5",micStart:"\u05D4\u05EA\u05D7\u05DC\u05EA \u05E7\u05DC\u05D8 \u05E7\u05D5\u05DC\u05D9",micStop:"\u05E2\u05E6\u05D9\u05E8\u05EA \u05E7\u05DC\u05D8 \u05E7\u05D5\u05DC\u05D9",micUnsupported:"\u05E7\u05DC\u05D8 \u05E7\u05D5\u05DC\u05D9 \u05D0\u05D9\u05E0\u05D5 \u05E0\u05EA\u05DE\u05DA \u05D1\u05D3\u05E4\u05D3\u05E4\u05DF \u05D6\u05D4",moreActions:"\u05E4\u05E2\u05D5\u05DC\u05D5\u05EA \u05E0\u05D5\u05E1\u05E4\u05D5\u05EA",newConversation:"\u05E6\u05F3\u05D0\u05D8 \u05D7\u05D3\u05E9",panelTitle:"\u05E6\u05F3\u05D0\u05D8",resizeHandle:"\u05D2\u05E8\u05D5\u05E8 \u05DC\u05E9\u05D9\u05E0\u05D5\u05D9 \u05D4\u05D2\u05D5\u05D3\u05DC",scrollToBottom:"\u05DE\u05E2\u05D1\u05E8 \u05DC\u05D7\u05D3\u05E9 \u05D1\u05D9\u05D5\u05EA\u05E8",send:"\u05E9\u05DC\u05D9\u05D7\u05D4",soundOff:"\u05D4\u05E9\u05EA\u05E7\u05EA \u05D4\u05E6\u05DC\u05D9\u05DC",soundOn:"\u05D4\u05E4\u05E2\u05DC\u05EA \u05D4\u05E6\u05DC\u05D9\u05DC",startNewConversation:"\u05D4\u05EA\u05D7\u05DC\u05EA \u05E6\u05F3\u05D0\u05D8 \u05D7\u05D3\u05E9",talkToOperator:"\u05D3\u05D1\u05E8 \u05E2\u05DD \u05E0\u05E6\u05D9\u05D2",connectingOperator:"\u05DE\u05D7\u05D1\u05E8 \u05D0\u05D5\u05EA\u05DA \u05DC\u05E0\u05E6\u05D9\u05D2\u2026",noOperatorAvailable:"\u05D0\u05D9\u05DF \u05E0\u05E6\u05D9\u05D2\u05D9\u05DD \u05D6\u05DE\u05D9\u05E0\u05D9\u05DD \u05DB\u05E2\u05EA \u2014 \u05D4\u05E9\u05D0\u05E8 \u05D0\u05EA \u05D4\u05E4\u05E8\u05D8\u05D9\u05DD \u05E9\u05DC\u05DA \u05D5\u05E0\u05D7\u05D6\u05D5\u05E8 \u05D0\u05DC\u05D9\u05DA.",chattingWithOperator:"\u05D0\u05EA\u05D4 \u05DE\u05E6\u05F3\u05D5\u05D8\u05D8 \u05E2\u05DD {operator}",cancelOperatorRequest:"\u05D4\u05DE\u05E9\u05DA \u05DC\u05E9\u05D5\u05D7\u05D7 \u05E2\u05DD \u05D4-AI",stop:"\u05E2\u05E6\u05D9\u05E8\u05D4",theme:"\u05E2\u05E8\u05DB\u05EA \u05E0\u05D5\u05E9\u05D0",themeAuto:"\u05D0\u05D5\u05D8\u05D5\u05DE\u05D8\u05D9",themeDark:"\u05DB\u05D4\u05D4",themeLight:"\u05D1\u05D4\u05D9\u05E8",textSize:"\u05D2\u05D5\u05D3\u05DC \u05D8\u05E7\u05E1\u05D8",textSizeSmall:"\u05E7\u05D8\u05DF",textSizeNormal:"\u05E8\u05D2\u05D9\u05DC",textSizeLarge:"\u05D2\u05D3\u05D5\u05DC",loading:"\u05D8\u05D5\u05E2\u05DF\u2026",thinking:"\u05D7\u05D5\u05E9\u05D1\u2026",thoughts:"\u05DE\u05D7\u05E9\u05D1\u05D5\u05EA",toolResult:"\u05EA\u05D5\u05E6\u05D0\u05D4",sources:"\u05DE\u05E7\u05D5\u05E8\u05D5\u05EA",feedbackUp:"\u05EA\u05E9\u05D5\u05D1\u05D4 \u05D8\u05D5\u05D1\u05D4",feedbackDown:"\u05EA\u05E9\u05D5\u05D1\u05D4 \u05D2\u05E8\u05D5\u05E2\u05D4",feedbackThanks:"\u05EA\u05D5\u05D3\u05D4 \u05E2\u05DC \u05D4\u05DE\u05E9\u05D5\u05D1",copy:"\u05D4\u05E2\u05EA\u05E7",copied:"\u05D4\u05D5\u05E2\u05EA\u05E7",tabHome:"\u05D1\u05D9\u05EA",tabConversations:"\u05E6\u05F3\u05D0\u05D8\u05D9\u05DD",tabHelp:"\u05E2\u05D6\u05E8\u05D4",tabNews:"\u05D7\u05D3\u05E9\u05D5\u05EA",modulesEmpty:"\u05D0\u05D9\u05DF \u05DB\u05D0\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05DB\u05DC\u05D5\u05DD",moduleBack:"\u05D7\u05D6\u05E8\u05D4",contentLoading:"\u05D8\u05D5\u05E2\u05DF\u2026",homeGreeting:"\u05DB\u05D9\u05E6\u05D3 \u05E0\u05D5\u05DB\u05DC \u05DC\u05E2\u05D6\u05D5\u05E8?",homeGreetingNamed:"\u05E9\u05DC\u05D5\u05DD {name} \u{1F44B}",homeGreetingLead:"\u05DB\u05D9\u05E6\u05D3 \u05E0\u05D5\u05DB\u05DC \u05DC\u05E2\u05D6\u05D5\u05E8?",homeSearchPlaceholder:"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05E2\u05D6\u05E8\u05D4",homeContentTitle:"\u05DE\u05D0\u05DE\u05E8\u05D9\u05DD \u05E4\u05D5\u05E4\u05D5\u05DC\u05E8\u05D9\u05D9\u05DD",homeStatus:"\u05E1\u05D8\u05D8\u05D5\u05E1",helpTitle:"\u05E2\u05D6\u05E8\u05D4",helpSearchPlaceholder:"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05E2\u05D6\u05E8\u05D4",helpEmpty:"\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05DE\u05D0\u05DE\u05E8\u05D9 \u05E2\u05D6\u05E8\u05D4",helpLoading:"\u05D8\u05D5\u05E2\u05DF \u05E2\u05D6\u05E8\u05D4\u2026",helpSearchEmpty:"\u05DC\u05D0 \u05E0\u05DE\u05E6\u05D0\u05D5 \u05EA\u05D5\u05E6\u05D0\u05D5\u05EA",newsTitle:"\u05D7\u05D3\u05E9\u05D5\u05EA",newsEmpty:"\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05D7\u05D3\u05E9\u05D5\u05EA",newsLoading:"\u05D8\u05D5\u05E2\u05DF \u05D7\u05D3\u05E9\u05D5\u05EA\u2026",newsBack:"\u05D7\u05D6\u05E8\u05D4 \u05DC\u05D7\u05D3\u05E9\u05D5\u05EA",newsPublishedAt:"\u05E4\u05D5\u05E8\u05E1\u05DD \u05D1-{date}",formSubmit:"\u05E9\u05DC\u05D9\u05D7\u05D4",formSkip:"\u05D0\u05D7\u05E8 \u05DB\u05DA",formSubmitted:"\u05E0\u05E9\u05DC\u05D7",formSkipped:"\u05D3\u05D5\u05DC\u05D2",formFillOut:"\u05DE\u05D9\u05DC\u05D5\u05D9",formRequired:"\u05E9\u05D3\u05D4 \u05D7\u05D5\u05D1\u05D4",formInvalidEmail:"\u05D4\u05D6\u05DF \u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC \u05EA\u05E7\u05D9\u05E0\u05D4",formInvalidTel:"\u05D4\u05D6\u05DF \u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF \u05EA\u05E7\u05D9\u05DF",formInvalidUrl:"\u05D4\u05D6\u05DF \u05DB\u05EA\u05D5\u05D1\u05EA URL \u05EA\u05E7\u05D9\u05E0\u05D4",formInvalidNumber:"\u05D4\u05D6\u05DF \u05DE\u05E1\u05E4\u05E8 \u05EA\u05E7\u05D9\u05DF",formTooShort:"\u05E7\u05E6\u05E8 \u05DE\u05D3\u05D9 (\u05DC\u05E4\u05D7\u05D5\u05EA {min} \u05EA\u05D5\u05D5\u05D9\u05DD)",formTooLong:"\u05D0\u05E8\u05D5\u05DA \u05DE\u05D3\u05D9 (\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max} \u05EA\u05D5\u05D5\u05D9\u05DD)",formNumberTooSmall:"\u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DC\u05E4\u05D7\u05D5\u05EA {min}",formNumberTooLarge:"\u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max}",formPatternMismatch:"\u05D4\u05EA\u05D0\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA \u05D4\u05E0\u05D3\u05E8\u05E9\u05EA",formChooseAtLeast:"\u05D1\u05D7\u05E8 \u05DC\u05E4\u05D7\u05D5\u05EA {min}",formChooseAtMost:"\u05D1\u05D7\u05E8 \u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max}",formOther:"\u05D0\u05D7\u05E8",formOtherPlaceholder:"\u05DB\u05EA\u05D5\u05D1 \u05D0\u05EA \u05EA\u05E9\u05D5\u05D1\u05EA\u05DA\u2026",inputRequired:"\u05E9\u05D0\u05DC\u05D5\u05EA \u05E2\u05D1\u05D5\u05E8\u05DA",inputBadge:"\u05E9\u05D0\u05DC\u05D5\u05EA",inputAnswered:"\u05E0\u05E2\u05E0\u05D4",inputSkipped:"\u05D3\u05D5\u05DC\u05D2",showOptions:"\u05D4\u05E6\u05D2 \u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA",hideOptions:"\u05D4\u05E1\u05EA\u05E8 \u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA",qtypeText:"\u05D4\u05EA\u05E9\u05D5\u05D1\u05D4 \u05E9\u05DC\u05DA",qtypeEmail:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",qtypePhone:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF",qtypeNumber:"\u05DE\u05E1\u05E4\u05E8",qtypeDate:"\u05EA\u05D0\u05E8\u05D9\u05DA",qtypeChooseOne:"\u05D1\u05D7\u05E8 \u05D0\u05D7\u05EA",qtypeChooseAny:"\u05D1\u05D7\u05E8 \u05DB\u05DE\u05D4",qtypeBoolean:"\u05DB\u05DF / \u05DC\u05D0",inputSubmit:"\u05E9\u05DC\u05D9\u05D7\u05EA \u05EA\u05E9\u05D5\u05D1\u05D5\u05EA",inputSubmitHint:"Enter \u05DC\u05E9\u05DC\u05D9\u05D7\u05D4 \xB7 Shift+Enter = \u05E9\u05D5\u05E8\u05D4 \u05D7\u05D3\u05E9\u05D4",inputSkip:"\u05D3\u05D9\u05DC\u05D5\u05D2",confirmYes:"\u05DB\u05DF",confirmNo:"\u05DC\u05D0",approve:"\u05D0\u05D9\u05E9\u05D5\u05E8",reject:"\u05D3\u05D7\u05D9\u05D9\u05D4",approvalPrompt:"\u05D4\u05DB\u05DC\u05D9 {tool} \u05D3\u05D5\u05E8\u05E9 \u05D0\u05EA \u05D0\u05D9\u05E9\u05D5\u05E8\u05DA \u05DB\u05D3\u05D9 \u05DC\u05E4\u05E2\u05D5\u05DC.",approvalBody:"\u05D1\u05D3\u05D5\u05E7 \u05D0\u05EA \u05E4\u05E8\u05DE\u05D8\u05E8\u05D9 \u05D4\u05DB\u05DC\u05D9 \u05E9\u05DC\u05DE\u05E2\u05DC\u05D4 \u05D5\u05D4\u05D7\u05DC\u05D8 \u05D0\u05DD \u05DC\u05D0\u05E9\u05E8 \u05E4\u05E2\u05D5\u05DC\u05D4 \u05D6\u05D5.",approvalYourResponse:"\u05D4\u05EA\u05D2\u05D5\u05D1\u05D4 \u05E9\u05DC\u05DA: {decision}",approvalEditHint:"\u05E0\u05D9\u05EA\u05DF \u05DC\u05E2\u05E8\u05D5\u05DA \u05D0\u05EA \u05EA\u05D2\u05D5\u05D1\u05EA\u05DA \u05E2\u05D3 \u05E9\u05D4\u05E9\u05DC\u05D1 \u05D4\u05D6\u05D4 \u05D9\u05EA\u05D7\u05D3\u05E9.",approvalSubmitting:"\u05D4\u05EA\u05D2\u05D5\u05D1\u05D4 \u05E0\u05E9\u05DC\u05D7\u05D4. \u05DE\u05D1\u05E6\u05E2\u2026",edit:"\u05E2\u05E8\u05D9\u05DB\u05D4",toolParameters:"\u05E4\u05E8\u05DE\u05D8\u05E8\u05D9\u05DD",statusAwaiting:"\u05DE\u05DE\u05EA\u05D9\u05DF \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8",statusResponded:"\u05E0\u05E9\u05DC\u05D7",statusRunning:"\u05E4\u05D5\u05E2\u05DC",statusCompleted:"\u05D4\u05D5\u05E9\u05DC\u05DD",statusDenied:"\u05E0\u05D3\u05D7\u05D4",statusError:"\u05E9\u05D2\u05D9\u05D0\u05D4",statusSuperseded:"\u05D3\u05D5\u05DC\u05D2"},T_={en:Zi,fr:k_,ar:w_,es:C_,he:R_};function Oo(e,t){let n=es(e),o=No(t),r=n==="en"?{}:T_[n]??{},a=o?t[n]??{}:t??{},s=o?t.en??{}:{};return{...Zi,...r,...s,...a}}function es(e){return(e.split("-")[0]??"en").toLowerCase()}var I_=new Set(["ar","he","iw","fa","ur","ps","sd","ug","yi","dv","ckb","ks","nqo","prs","syr"]);function ts(e){return I_.has(es(e))}function rt(e,t){return e[t]??t}function No(e){if(!e)return!1;for(let t of Object.values(e))if(t&&typeof t=="object")return!0;return!1}function ns(e,t){if(!(!e?.length||!t))return e.find(n=>n.locale===t)}function os(e,t){let{translations:n,defaultLocale:o,...r}=e,a=ns(n,t);return a?{...r,title:a.title??r.title,description:a.description??r.description,content:a.content??r.content}:r}function rs(e,t){let{translations:n,defaultLocale:o,...r}=e,a=ns(n,t);if(!a)return r;let s=new Map((a.fields??[]).map(c=>[c.name,c])),l=r.fields.map(c=>{let d=s.get(c.name);if(!d)return c;let _=new Map((d.options??[]).map(p=>[p.value,p]));return{...c,label:d.label??c.label,placeholder:d.placeholder??c.placeholder,validationHint:d.validationHint??c.validationHint,options:c.options?.map(p=>{let u=_.get(p.value);return u?{...p,label:u.label??p.label,description:u.description??p.description}:p})}});return{...r,title:a.title??r.title,description:a.description??r.description,submitLabel:a.submitLabel??r.submitLabel,fields:l}}var _a=class{get(t){try{return localStorage.getItem(t)}catch{return null}}set(t,n){try{localStorage.setItem(t,n)}catch{}}remove(t){try{localStorage.removeItem(t)}catch{}}},Do=new _a;var ma=["off","error","warn","info","debug","trace"],ga=C.cssPrefix,as=`${ga}.debug`,E_=`__${C.global}_DEBUG__`,A_=`${ga}-debug`,$o=2,pa=null;function M_(){if(typeof window>"u")return 2;try{let e=new URLSearchParams(window.location.search).get(A_);if(e!==null){let t=fa(e);if(t>=0)return t}}catch{}try{let e=window.localStorage?.getItem(as);if(e){let t=fa(e);if(t>=0)return t}}catch{}return Reflect.get(window,E_)?4:2}function fa(e){if(e===!0||e==="1"||e==="true")return 4;if(e===!1||e==="0"||e==="false"||e==="off")return 0;if(typeof e=="number")return Math.max(0,Math.min(5,Math.floor(e)));if(typeof e=="string"){let t=ma.indexOf(e);if(t>=0)return t}return-1}function Fo(e){let t=fa(e);if(!(t<0)){$o=t;try{window.localStorage?.setItem(as,ma[t])}catch{}}}function Yn(){return ma[$o]}$o=M_();function is(e){let t=`[${ga}:${e}]`,n=(o,r,a)=>(s,l)=>{if(!($o<o)&&(l===void 0?console[r](t,s):console[r](t,s,l),pa))try{pa({level:a,scope:e,message:s,payload:l})}catch{}};return{error:n(1,"error","error"),warn:n(2,"warn","warn"),info:n(3,"info","info"),debug:n(4,"debug","debug"),trace:n(5,"debug","trace"),scope:o=>is(`${e}:${o}`)}}var Z=is("core");function Jn(e){pa=e}var tn=Z.scope("context"),L_=new Set(["visitorId","conversationId","conversationId","jwt","token","authorization","password"]),ss=50,va=1024,O_=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function ha(e){return ls(e,"userContext",!0)}function ba(e){return ls(e,"pageContext",!1)}function ls(e,t,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){tn.warn(`ignored ${t} \u2014 expected an object`,{type:Array.isArray(e)?"array":typeof e});return}let o={},r=0;for(let[a,s]of Object.entries(e)){if(L_.has(a)){tn.warn(`dropped reserved ${t} key "${a}" \u2014 managed by the widget, not host-settable`);continue}if(s==null)continue;if(r>=ss){tn.warn(`${t} truncated at ${ss} keys \u2014 dropped "${a}"`);continue}let l=N_(t,a,s);l!==void 0&&(o[a]=l,r++)}return n&&typeof o.email=="string"&&!O_.test(o.email)&&(tn.warn(`dropped malformed ${t}.email "${o.email}"`),delete o.email),Object.keys(o).length>0?o:void 0}function N_(e,t,n){if(typeof n=="boolean")return n;if(typeof n=="number"){if(!Number.isFinite(n)){tn.warn(`dropped non-finite ${e}.${t}`);return}return n}if(typeof n=="string"){let o=n.trim();return o===""?void 0:o.length>va?(tn.warn(`truncated ${e}.${t} to ${va} chars`),o.slice(0,va)):o}tn.warn(`dropped ${e}.${t} \u2014 only string/number/boolean values are allowed`,{type:typeof n})}var Bo={maxBytes:10485760,maxCount:10,accept:"*/*"},cs={voice:"local"},ds={list:[],byTrigger:{}},ya={enabled:!0,sampleRate:1},Ho={upload:"/pai/upload-file",transcribe:"/pai/transcribe-audio",submitForm:"/pai/submit-form"},kn={variant:"circle",size:"md",label:void 0,icon:"chat",hidden:!1},us={floating:["theme","textSize","history","close","clear","expand","fullscreen","sound","language"],inline:["theme","textSize","history","close","clear","fullscreen","sound","language"],standalone:["theme","textSize","history","clear","sound","language"],page:["theme","textSize","history","clear","sound","language"],modal:["theme","textSize","history","close","clear","fullscreen","sound","language"],drawer:["theme","textSize","history","close","clear","fullscreen","sound","language"]},Pa={enabled:!0,volume:.3,events:void 0},_s={enabled:!0,events:void 0},ps=[{label:"tabConversations",layout:"chat"}];function Vt(e){let t=e!==null&&typeof e=="object"?e:{},n=t.presentation??{},o=t.behavior??{},r=t.i18n??{},a=t.feedback??{},s=t.footer??{},l=t.header??{},{themeMode:c,themeOverrides:d}=D_(t.theme),_=n.mode??"floating",p=$_(r.defaultLocale),u=r.availableLocales??[r.locale??p],f=wn(r.locale??p,u,p),m=(t.baseUrl??C.defaultBaseUrl).replace(/\/$/,""),b=(t.agentApiBaseUrl??`${m}/api/agent`).replace(/\/$/,""),h=(t.dataApiBaseUrl??`${m}/api/data`).replace(/\/$/,"");return{widgetId:t.widgetId??"default",publicKey:t.publicKey,aiAgentDeploymentId:t.aiAgentDeploymentId,baseUrl:m,agentApiBaseUrl:b,dataApiBaseUrl:h,userContext:ha(t.userContext),pageContext:ba(t.pageContext),position:n.position??"bottom-right",themeMode:c,textSize:"normal",themeOverrides:d,mode:_,iframe:n.iframe??!1,responseMode:o.responseMode??"streaming",showReasoning:o.showReasoning??!1,showToolCalls:o.showToolCalls??!1,showSources:o.showSources??!1,enableMessageFeedback:!(o.disableMessageFeedback??!1),autoSendSuggestions:o.autoSendSuggestions??!1,features:{voice:t.features?.voice??cs.voice,fileUpload:!(t.features?.disableFileUpload??!1),humanInLoop:!(t.features?.disableHumanInLoop??!1),operatorRequest:t.features?.enableOperatorRequest===!0},forms:Qn(t.forms,f),endpoints:{upload:t.endpoints?.upload??Ho.upload,transcribe:t.endpoints?.transcribe??Ho.transcribe,submitForm:t.endpoints?.submitForm??Ho.submitForm},attachments:{accept:t.composer?.attachments?.accept??Bo.accept,maxBytes:t.composer?.attachments?.maxBytes??Bo.maxBytes,maxCount:t.composer?.attachments?.maxCount??Bo.maxCount},locale:f,defaultLocale:p,availableLocales:u,startMinimized:o.startMinimized??!0,actions:F_(_,l.actions),size:n.size??{},launcher:G_(t.launcher),sound:B_(a.sound),haptics:H_(a.haptics),strings:Oo(f,r.strings),stringsOverride:r.strings,composerDisclaimer:s.composerDisclaimer??"",poweredBy:z_(s.poweredBy),composer:q_(t.composer),modules:V_(t.modules),tracking:U_(t.tracking,h),storage:t.storage??Do,onMessage:t.onMessage,onOpen:t.onOpen,onClose:t.onClose,onError:t.onError}}function D_(e){return typeof e=="string"?{themeMode:e,themeOverrides:{}}:e&&typeof e=="object"?{themeMode:"auto",themeOverrides:e}:{themeMode:"auto",themeOverrides:{}}}function $_(e){return e&&e!=="auto"?e:typeof navigator<"u"&&navigator.language?navigator.language:"en"}function wn(e,t,n){return t.length<=1||t.includes(e)?e:t.includes(n)?n:t[0]??e}function F_(e,t){return t??us[e]}function B_(e){return{enabled:e?.enabled??Pa.enabled,volume:e?.volume??Pa.volume,events:e?.events}}function H_(e){return{enabled:e?.enabled??_s.enabled,events:e?.events}}function U_(e,t){let n=e?.sampleRate??ya.sampleRate;return{enabled:e?.enabled??ya.enabled,endpoint:e?.endpoint??`${t}/pai/elements-px.gif`,sampleRate:Math.min(1,Math.max(0,Number.isFinite(n)?n:1)),token:e?.token}}function z_(e){let n={...{text:`Powered by ${C.displayName}`,href:C.siteUrl},...e};return!!(n.text||n.logoUrl)?n:null}function q_(e){let t=e?.sendButton;return{sendButton:{shape:t?.shape??"circle",icon:t?.icon??"arrowUp",variant:t?.variant??"filled"}}}function V_(e){let t=e===void 0?ps:e,n=new Set,o=[];for(let a of t.slice(0,4)){if(!a?.label||!a?.layout)continue;let s=a.contentTags?.filter(Boolean),l=a.id??s?.[0]??a.layout;for(;n.has(l);)l=`${l}-${o.length}`;n.add(l);let c={id:l,label:a.label,layout:a.layout};s&&s.length>0&&(c.contentTags=s),a.layout==="home"&&(c.brandName=a.brandName,c.greetingText=a.greetingText,c.showGreeting=!(a.hideGreeting??!1),c.showSearchBar=!(a.hideSearchBar??!1),c.showRecentConversations=!(a.hideRecentConversations??!1),a.userAvatars&&a.userAvatars.length>0&&(c.userAvatars=a.userAvatars),a.status&&(c.status=a.status),c.contentBlockTitle=a.contentBlockTitle),o.push(c)}let r=Object.fromEntries(o.map(a=>[a.id,a]));return{list:o,byId:r}}function Qn(e,t){var a;if(!e?.length)return ds;let n=[],o=new Set;for(let s of e){if(!s?.id||o.has(s.id))continue;let l=rs(s,t),c=(l.fields??[]).filter(_=>!!(_&&_.name&&_.label&&_.type)),d=(Array.isArray(l.on)?l.on:[l.on]).map(W_).filter(_=>_!==null);c.length===0||d.length===0||(o.add(l.id),n.push({id:l.id,triggers:d,when:l.when,fields:c,title:l.title,description:l.description,submitLabel:l.submitLabel,skippable:l.skippable??!1,frequency:l.frequency??"once",mirrorToContext:l.mirrorToContext??!0,reopenable:l.reopenable??!0,reviewable:l.reviewable??!0}))}let r={};for(let s of n)for(let l of s.triggers)(r[a=l.kind]??(r[a]=[])).push(s);return{list:n,byTrigger:r}}function W_(e){if(typeof e!="string")return null;if(e==="pre-chat"||e==="conversation-closed"||e==="panel-close"||e==="manual")return{kind:e};let[t,n]=e.split(":",2);if(t==="after-messages"){let o=Number(n);return Number.isFinite(o)&&o>0?{kind:"after-messages",param:o}:null}if(t==="idle"){let o=Number(n);return Number.isFinite(o)&&o>0?{kind:"idle",param:o}:null}return t==="page-area"&&n?{kind:"page-area",param:n}:null}function G_(e){let t=e?.callout?.text?{shape:"pill",position:"auto",delayMs:1200,autoDismissMs:0,animated:!0,persistent:!0,...e.callout}:null;return{variant:e?.variant??kn.variant,size:e?.size??kn.size,label:e?.label??kn.label,icon:e?.icon??kn.icon,hidden:e?.hidden??kn.hidden,callout:t}}function xa(e,t,n,o){let r=wn(t,e.availableLocales,e.defaultLocale);if(r===e.locale&&n===e.themeMode&&o===e.textSize)return e;let a={...e};return r!==e.locale&&(a.locale=r,a.strings=Oo(r,e.stringsOverride)),n!==e.themeMode&&(a.themeMode=n),o!==e.textSize&&(a.textSize=o),a}var K_=["presentation","behavior","theme","launcher","header","composer","feedback","i18n","footer","features","tracking","endpoints"];function Sa(e,t){if(!t)return e;let n={...e};for(let a of K_){let s=t[a];if(s===void 0)continue;let l=e[a];if(a==="theme"){l===void 0&&(n[a]=s);continue}a!=="i18n"&&(n[a]=fs(s,l))}t.modules!==void 0&&e.modules===void 0&&(n.modules=t.modules),t.dataApiBaseUrl!==void 0&&e.dataApiBaseUrl===void 0&&(n.dataApiBaseUrl=t.dataApiBaseUrl);let o=e.i18n,r=t.i18n;if(o||r){let a=fs(r??{},o);r?.availableLocales!==void 0&&(a.availableLocales=r.availableLocales),r?.defaultLocale!==void 0&&(a.defaultLocale=r.defaultLocale);let s=o?.strings,l=r?.strings;(s||l)&&(a.strings=j_(l,s)),n.i18n=a}return n}function fs(e,t){if(!t)return e;let n={...e};for(let[o,r]of Object.entries(t))r!==void 0&&(n[o]=r);return n}function j_(e,t){if(!e)return t;if(!t)return e;let n=No(e),o=No(t);if(!n&&!o)return{...e,...t};let r={},a=n?e:{en:e},s=o?t:{en:t};for(let[l,c]of Object.entries(a))r[l]={...c};for(let[l,c]of Object.entries(s))r[l]={...r[l],...c};return r}var X_=["clear","expand","fullscreen","sound","history","language","theme","textSize","close"],Ot=e=>e!=="false",Y_=e=>e.split(",").map(t=>t.trim()).filter(Boolean),gs=[["public-key","publicKey"],["ai-agent-deployment-id","aiAgentDeploymentId"],["base-url","baseUrl"],["agent-api-base-url","agentApiBaseUrl"],["data-api-base-url","dataApiBaseUrl"],["theme","theme",e=>e]],vs=[["mode","mode",e=>e],["position","position",e=>e],["iframe","iframe",Ot]],hs=[["width","width"],["height","height"]],bs=[["response-mode","responseMode",e=>e],["start-minimized","startMinimized",Ot],["show-reasoning","showReasoning",Ot],["show-tool-calls","showToolCalls",Ot],["show-sources","showSources",Ot],["disable-message-feedback","disableMessageFeedback",Ot],["auto-send-suggestions","autoSendSuggestions",Ot]],ys=[["locale","locale"]],J_=new Set(X_),Q_=e=>Y_(e).filter(t=>J_.has(t)),Ps=[["launcher-variant","variant",e=>e],["launcher-size","size",e=>e],["launcher-icon","icon"],["launcher-hidden","hidden",Ot]],xs=[["features-disable-file-upload","disableFileUpload",Ot],["features-voice","voice",e=>e]],Ss=[["endpoint-upload","upload"],["endpoint-transcribe","transcribe"]],ks=[["user-id","id"],["user-email","email"],["user-name","name"]],ws=[["page-area","area"],["page-url","url"],["page-path","path"],["page-title","title"]],Z_=["launcher-label","callout-text","callout-delay","actions","user-context","page-context"],ep=[gs,vs,hs,bs,ys,Ps,xs,Ss,ks,ws],tp=new Set(["iframe","start-minimized"]),ka=[...ep.flatMap(e=>e.map(([t])=>t).filter(t=>!tp.has(t))),...Z_];function Uo(e){let t={},n=f=>{let m=e(f);return m===null||m===""?void 0:m};for(let[f,m,b]of gs){let h=n(f);h!==void 0&&(t[m]=b?b(h):h)}let o=nn(n,vs),r=nn(n,hs);(o||r)&&(t.presentation={...o,...r?{size:r}:{}});let a=nn(n,bs);a&&(t.behavior=a);let s=nn(n,ys);s&&(t.i18n=s);let l=op(e,n);l&&(t.launcher=l);let c=nn(n,xs);c&&(t.features=c);let d=nn(n,Ss);d&&(t.endpoints=d);let _=ms(n,ks,"user-context");_&&(t.userContext=_);let p=ms(n,ws,"page-context");p&&(t.pageContext=p);let u=n("actions");return u!==void 0&&(t.header={actions:Q_(u)}),t}function wa(e){return e?Uo(t=>e[np(t==="data-api-base-url"?"api-base-url":t)]??null):{}}function np(e){return e.replaceAll(/-([a-z])/g,(t,n)=>n.toUpperCase())}function nn(e,t){let n={};for(let[o,r,a]of t){let s=e(o);s!==void 0&&(n[r]=a?a(s):s)}return Object.keys(n).length>0?n:null}function ms(e,t,n){let o={};for(let[l,c]of t){let d=e(l);d!==void 0&&(o[c]=d)}let r={},a=e(n);if(a)try{let l=JSON.parse(a);l&&typeof l=="object"&&!Array.isArray(l)&&(r=l)}catch{}let s={...r,...o};return Object.keys(s).length>0?s:null}function op(e,t){let n=nn(t,Ps)??{},o=e("launcher-label");o!==null&&(n.label=o);let r=t("callout-text");if(r){let a=Number.parseInt(t("callout-delay")??"",10);n.callout={text:r,...Number.isFinite(a)?{delayMs:a}:{}}}return Object.keys(n).length>0?n:null}var jo,ne,Es,Ia,Wt,Cs,As,Ms,Ca,qo,Zn,Ls,Ea,Ra,Ta,rp,Wo={},Go=[],ap=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,eo=Array.isArray;function Nt(e,t){for(var n in t)e[n]=t[n];return e}function Aa(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Dt(e,t,n){var o,r,a,s={};for(a in t)a=="key"?o=t[a]:a=="ref"?r=t[a]:s[a]=t[a];if(arguments.length>2&&(s.children=arguments.length>3?jo.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)s[a]===void 0&&(s[a]=e.defaultProps[a]);return Vo(e,s,o,r,null)}function Vo(e,t,n,o,r){var a={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Es,__i:-1,__u:0};return r==null&&ne.vnode!=null&&ne.vnode(a),a}function me(e){return e.children}function st(e,t){this.props=e,this.context=t}function Cn(e,t){if(t==null)return e.__?Cn(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Cn(e):null}function ip(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],r=[],a=Nt({},t);a.__v=t.__v+1,ne.vnode&&ne.vnode(a),Ma(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??Cn(t),!!(32&t.__u),r),a.__v=t.__v,a.__.__k[a.__i]=a,Fs(o,a,r),t.__e=t.__=null,a.__e!=n&&Os(a)}}function Os(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Os(e)}function Rs(e){(!e.__d&&(e.__d=!0)&&Wt.push(e)&&!Ko.__r++||Cs!=ne.debounceRendering)&&((Cs=ne.debounceRendering)||As)(Ko)}function Ko(){try{for(var e,t=1;Wt.length;)Wt.length>t&&Wt.sort(Ms),e=Wt.shift(),t=Wt.length,ip(e)}finally{Wt.length=Ko.__r=0}}function Ns(e,t,n,o,r,a,s,l,c,d,_){var p,u,f,m,b,h,x,P=o&&o.__k||Go,v=t.length;for(c=sp(n,t,P,c,v),p=0;p<v;p++)(f=n.__k[p])!=null&&(u=f.__i!=-1&&P[f.__i]||Wo,f.__i=p,h=Ma(e,f,u,r,a,s,l,c,d,_),m=f.__e,f.ref&&u.ref!=f.ref&&(u.ref&&La(u.ref,null,f),_.push(f.ref,f.__c||m,f)),b==null&&m!=null&&(b=m),(x=!!(4&f.__u))||u.__k===f.__k?(c=Ds(f,c,e,x),x&&u.__e&&(u.__e=null)):typeof f.type=="function"&&h!==void 0?c=h:m&&(c=m.nextSibling),f.__u&=-7);return n.__e=b,c}function sp(e,t,n,o,r){var a,s,l,c,d,_=n.length,p=_,u=0;for(e.__k=new Array(r),a=0;a<r;a++)(s=t[a])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[a]=Vo(null,s,null,null,null):eo(s)?s=e.__k[a]=Vo(me,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[a]=Vo(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[a]=s,c=a+u,s.__=e,s.__b=e.__b+1,l=null,(d=s.__i=lp(s,n,c,p))!=-1&&(p--,(l=n[d])&&(l.__u|=2)),l==null||l.__v==null?(d==-1&&(r>_?u--:r<_&&u++),typeof s.type!="function"&&(s.__u|=4)):d!=c&&(d==c-1?u--:d==c+1?u++:(d>c?u--:u++,s.__u|=4))):e.__k[a]=null;if(p)for(a=0;a<_;a++)(l=n[a])!=null&&(2&l.__u)==0&&(l.__e==o&&(o=Cn(l)),Hs(l,l));return o}function Ds(e,t,n,o){var r,a;if(typeof e.type=="function"){for(r=e.__k,a=0;r&&a<r.length;a++)r[a]&&(r[a].__=e,t=Ds(r[a],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=Cn(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function to(e,t){return t=t||[],e==null||typeof e=="boolean"||(eo(e)?e.some(function(n){to(n,t)}):t.push(e)),t}function lp(e,t,n,o){var r,a,s,l=e.key,c=e.type,d=t[n],_=d!=null&&(2&d.__u)==0;if(d===null&&l==null||_&&l==d.key&&c==d.type)return n;if(o>(_?1:0)){for(r=n-1,a=n+1;r>=0||a<t.length;)if((d=t[s=r>=0?r--:a++])!=null&&(2&d.__u)==0&&l==d.key&&c==d.type)return s}return-1}function Ts(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||ap.test(t)?n:n+"px"}function zo(e,t,n,o,r){var a,s;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||Ts(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||Ts(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")a=t!=(t=t.replace(Ls,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+a]=n,n?o?n[Zn]=o[Zn]:(n[Zn]=Ea,e.addEventListener(t,a?Ta:Ra,a)):e.removeEventListener(t,a?Ta:Ra,a);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Is(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[qo]==null)t[qo]=Ea++;else if(t[qo]<n[Zn])return;return n(ne.event?ne.event(t):t)}}}function Ma(e,t,n,o,r,a,s,l,c,d){var _,p,u,f,m,b,h,x,P,v,y,k,w,$,ie,z,T=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[l=t.__e=n.__e]),(_=ne.__b)&&_(t);e:if(typeof T=="function"){p=s.length;try{if(P=t.props,v=T.prototype&&T.prototype.render,y=(_=T.contextType)&&o[_.__c],k=_?y?y.props.value:_.__:o,n.__c?x=(u=t.__c=n.__c).__=u.__E:(v?t.__c=u=new T(P,k):(t.__c=u=new st(P,k),u.constructor=T,u.render=dp),y&&y.sub(u),u.state||(u.state={}),u.__n=o,f=u.__d=!0,u.__h=[],u._sb=[]),v&&u.__s==null&&(u.__s=u.state),v&&T.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=Nt({},u.__s)),Nt(u.__s,T.getDerivedStateFromProps(P,u.__s))),m=u.props,b=u.state,u.__v=t,f)v&&T.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),v&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(v&&T.getDerivedStateFromProps==null&&P!==m&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(P,k),t.__v==n.__v||!u.__e&&u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(P,u.__s,k)===!1){t.__v!=n.__v&&(u.props=P,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(D){D&&(D.__=t)}),Go.push.apply(u.__h,u._sb),u._sb=[],u.__h.length&&s.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(P,u.__s,k),v&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(m,b,h)})}if(u.context=k,u.props=P,u.__P=e,u.__e=!1,w=ne.__r,$=0,v)u.state=u.__s,u.__d=!1,w&&w(t),_=u.render(u.props,u.state,u.context),Go.push.apply(u.__h,u._sb),u._sb=[];else do u.__d=!1,w&&w(t),_=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++$<25);u.state=u.__s,u.getChildContext!=null&&(o=Nt(Nt({},o),u.getChildContext())),v&&!f&&u.getSnapshotBeforeUpdate!=null&&(h=u.getSnapshotBeforeUpdate(m,b)),ie=_!=null&&_.type===me&&_.key==null?Bs(_.props.children):_,l=Ns(e,eo(ie)?ie:[ie],t,n,o,r,a,s,l,c,d),u.base=t.__e,t.__u&=-161,u.__h.length&&s.push(u),x&&(u.__E=u.__=null)}catch(D){if(s.length=p,t.__v=null,c||a!=null){if(D.then){for(t.__u|=c?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;a!=null&&(a[a.indexOf(l)]=null),t.__e=l}else if(a!=null)for(z=a.length;z--;)Aa(a[z])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),D.then||$s(t),ne.__e(D,t,n)}}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=cp(n.__e,t,n,o,r,a,s,c,d);return(_=ne.diffed)&&_(t),128&t.__u?void 0:l}function $s(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some($s))}function Fs(e,t,n){for(var o=0;o<n.length;o++)La(n[o],n[++o],n[++o]);ne.__c&&ne.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(a){a.call(r)})}catch(a){ne.__e(a,r.__v)}})}function Bs(e){return typeof e!="object"||e==null||e.__b>0?e:eo(e)?e.map(Bs):e.constructor!==void 0?null:Nt({},e)}function cp(e,t,n,o,r,a,s,l,c){var d,_,p,u,f,m,b,h=n.props||Wo,x=t.props,P=t.type;if(P=="svg"?r="http://www.w3.org/2000/svg":P=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),a!=null){for(d=0;d<a.length;d++)if((f=a[d])&&"setAttribute"in f==!!P&&(P?f.localName==P:f.nodeType==3)){e=f,a[d]=null;break}}if(e==null){if(P==null)return document.createTextNode(x);e=document.createElementNS(r,P,x.is&&x),l&&(ne.__m&&ne.__m(t,a),l=!1),a=null}if(P==null)h===x||l&&e.data==x||(e.data=x);else{if(a=P=="textarea"&&x.defaultValue!=null?null:a&&jo.call(e.childNodes),!l&&a!=null)for(h={},d=0;d<e.attributes.length;d++)h[(f=e.attributes[d]).name]=f.value;for(d in h)f=h[d],d=="dangerouslySetInnerHTML"?p=f:d=="children"||d in x||d=="value"&&"defaultValue"in x||d=="checked"&&"defaultChecked"in x||zo(e,d,null,f,r);for(d in x)f=x[d],d=="children"?u=f:d=="dangerouslySetInnerHTML"?_=f:d=="value"?m=f:d=="checked"?b=f:l&&typeof f!="function"||h[d]===f||zo(e,d,f,h[d],r);if(_)l||p&&(_.__html==p.__html||_.__html==e.innerHTML)||(e.innerHTML=_.__html),t.__k=[];else if(p&&(e.innerHTML=""),Ns(t.type=="template"?e.content:e,eo(u)?u:[u],t,n,o,P=="foreignObject"?"http://www.w3.org/1999/xhtml":r,a,s,a?a[0]:n.__k&&Cn(n,0),l,c),a!=null)for(d=a.length;d--;)Aa(a[d]);l&&P!="textarea"||(d="value",P=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[d]||P=="progress"&&!m||P=="option"&&m!=h[d])&&zo(e,d,m,h[d],r),d="checked",b!=null&&b!=e[d]&&zo(e,d,b,h[d],r))}return e}function La(e,t,n){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&t==null||(e.__u=e(t))}else e.current=t}catch(r){ne.__e(r,n)}}function Hs(e,t,n){var o,r;if(ne.unmount&&ne.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||La(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(a){ne.__e(a,t)}o.base=o.__P=o.__n=null}if(o=e.__k)for(r=0;r<o.length;r++)o[r]&&Hs(o[r],t,n||typeof e.type!="function");n||Aa(e.__e),e.__c=e.__=e.__e=void 0}function dp(e,t,n){return this.constructor(e,n)}function on(e,t,n){var o,r,a,s;t==document&&(t=document.documentElement),ne.__&&ne.__(e,t),r=(o=typeof n=="function")?null:n&&n.__k||t.__k,a=[],s=[],Ma(t,e=(!o&&n||t).__k=Dt(me,null,[e]),r||Wo,Wo,t.namespaceURI,!o&&n?[n]:r?null:t.firstChild?jo.call(t.childNodes):null,a,!o&&n?n:r?r.__e:t.firstChild,o,s),Fs(a,e,s),e.props.children=null}jo=Go.slice,ne={__e:function(e,t,n,o){for(var r,a,s;t=t.__;)if((r=t.__c)&&!r.__)try{if((a=r.constructor)&&a.getDerivedStateFromError!=null&&(r.setState(a.getDerivedStateFromError(e)),s=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,o||{}),s=r.__d),s)return r.__E=r}catch(l){e=l}throw e}},Es=0,Ia=function(e){return e!=null&&e.constructor===void 0},st.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Nt({},this.state),typeof e=="function"&&(e=e(Nt({},n),this.props)),e&&Nt(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Rs(this))},st.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Rs(this))},st.prototype.render=me,Wt=[],As=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ms=function(e,t){return e.__v.__b-t.__v.__b},Ko.__r=0,Ca=Math.random().toString(8),qo="__d"+Ca,Zn="__a"+Ca,Ls=/(PointerCapture)$|Capture$/i,Ea=0,Ra=Is(!1),Ta=Is(!0),rp=0;var Rn="1.1.12";function Us(e){return`${C.cssPrefix}:${e}`}function no(e,t,n){e.dispatchEvent(new CustomEvent(Us(t),{detail:n}))}function zs(e,t){let o=Object.entries(t).map(([r,a])=>{let s=Us(r),l=c=>a(c.detail);return e.addEventListener(s,l),[s,l]});return()=>{for(let[r,a]of o)e.removeEventListener(r,a)}}function ft(){let e=Date.now(),t=new Uint8Array(16);t[0]=Math.floor(e/2**40)&255,t[1]=Math.floor(e/2**32)&255,t[2]=e>>>24&255,t[3]=e>>>16&255,t[4]=e>>>8&255,t[5]=e&255,up(t.subarray(6)),t[6]=t[6]&15|112,t[8]=t[8]&63|128;let n=Array.from(t,o=>o.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function up(e){if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){crypto.getRandomValues(e);return}for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*256)}var rn=Z.scope("persistence");function Gt(e,t=Do,n){let o=n?`${e}.${n}`:e,r=`${C.cssPrefix}.storageVersion`,a=t.get(r)??void 0,s=a?`.v${a}`:"",l=`${C.cssPrefix}.${o}${s}`,c=`${C.cssPrefix}${s}.visitorId`,d=`${l}.conversationId`,_=`${l}.userPrefs`,p=`${l}.panelOpen`,u=`${l}.panelSize`,f=`${l}.calloutDismissed`,m=`${l}.sidebarCollapsed`,b=`${l}.activeModule`,h=`${l}.historyCount`,x=`${l}.formsDone`,P={getVisitorId(){let v=t.get(c);if(v)return v;let y=ft();return t.set(c,y),y},setVisitorId(v){rn.debug("setVisitorId (rebind)",{id:v,scope:o}),t.set(c,v)},loadConversationId(){return t.get(d)??void 0},saveConversationId(v){rn.trace("saveConversationId",{id:v,scope:o}),v?t.set(d,v):t.remove(d)},loadDraft(v){return t.get(`${l}.draft.${v}`)??""},saveDraft(v,y){let k=`${l}.draft.${v}`;y?t.set(k,y):t.remove(k)},loadUserPrefs(){let v=t.get(_);if(!v)return{};try{let y=JSON.parse(v);return qs(y)?y:{}}catch(y){return rn.warn("loadUserPrefs parse failed",{error:y}),{}}},saveUserPrefs(v){try{t.set(_,JSON.stringify(v))}catch(y){rn.warn("saveUserPrefs serialise failed",{error:y})}},patchUserPrefs(v){let y=P.loadUserPrefs();P.saveUserPrefs({...y,...v})},loadPanelOpen(){let v=t.get(p);return v==="1"?!0:v==="0"?!1:null},savePanelOpen(v){t.set(p,v?"1":"0")},loadPanelSize(){let v=t.get(u);return v==="normal"||v==="expanded"||v==="fullscreen"?v:null},savePanelSize(v){t.set(u,v)},loadCalloutDismissed(v){if(!v)return!1;let y=t.get(f);return!!y&&y===v},saveCalloutDismissed(v){v?t.set(f,v):t.remove(f)},loadSidebarCollapsed(){let v=t.get(m);return v==="1"?!0:v==="0"?!1:null},saveSidebarCollapsed(v){t.set(m,v?"1":"0")},loadActiveModule(){return t.get(b)||null},saveActiveModule(v){t.set(b,v)},loadHistoryCount(){let v=t.get(h);if(!v)return null;let y=Number.parseInt(v,10);return Number.isFinite(y)&&y>=0?y:null},saveHistoryCount(v){t.set(h,String(v))},loadFormsDone(){let v=t.get(x);if(!v)return{};try{let y=JSON.parse(v);return qs(y)?y:{}}catch(y){return rn.warn("loadFormsDone parse failed",{error:y}),{}}},saveFormDone(v){try{let y=P.loadFormsDone();y[v]=Date.now(),t.set(x,JSON.stringify(y))}catch(y){rn.warn("saveFormDone serialise failed",{error:y})}},rememberStorageVersion(v){v&&v!==t.get(r)&&(rn.debug("rememberStorageVersion (force-reset on next load)",{version:v}),t.set(r,v))},clearConversation(){t.remove(d)}};return P}function qs(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Vs=`:host{--__P__-accent-user: __BRAND_ACCENT__;--__P__-accent: var(--__P__-accent-user);--__P__-accent-text-user: __BRAND_ACCENT_TEXT__;--__P__-accent-text: var(--__P__-accent-text-user);--__P__-accent-fg: var(--__P__-accent);--__P__-radius: __BRAND_RADIUS__;--__P__-radius-sm: 8px;--__P__-radius-md: 10px;--__P__-radius-lg: 16px;--__P__-font: __BRAND_FONT__;--__P__-font-display: var(--__P__-font);--__P__-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;--__P__-bg: oklch(1 0 0);--__P__-bg-elevated: oklch(.9789 .0029 278.3);--__P__-surface: var(--__P__-bg-elevated);--__P__-muted: var(--__P__-fg-muted);--__P__-hover: oklch(.1686 .011 278.3 / .06);--__P__-fg: oklch(.1686 .011 278.3);--__P__-fg-muted: oklch(.4932 .0301 278.3);--__P__-border: oklch(.9312 .0084 278.3);--__P__-border-strong: oklch(.8757 .0131 278.3);--__P__-bubble-user: var(--__P__-accent);--__P__-bubble-user-text: var(--__P__-accent-text);--__P__-bubble-assistant: oklch(.9638 .0058 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-on-accent: var(--__P__-accent-text);--__P__-success: oklch(.6456 .1654 151.53);--__P__-warning: oklch(.7135 .1494 74.05);--__P__-danger: oklch(.5966 .1818 24.51);--__P__-danger-text: oklch(.5054 .1905 27.52);--__P__-danger-bg: oklch(.5966 .1818 24.51 / .1);--__P__-neutral: oklch(.7137 .0192 278.3);--__P__-pill-l-min: .3;--__P__-pill-l-max: .46;--__P__-focus: var(--__P__-accent);--__P__-shadow-panel: 0 8px 24px -8px rgba(13, 15, 20, .18), 0 24px 64px -24px rgba(13, 15, 20, .24);--__P__-shadow-card: 0 1px 2px rgba(13, 15, 20, .06), 0 4px 12px -6px rgba(13, 15, 20, .12);--__P__-backdrop: oklch(.1686 .011 278.3 / .55);--__P__-shadow-fab: 0 6px 16px -4px color-mix(in oklch, var(--__P__-accent) 45%, transparent), 0 12px 32px -12px rgba(13, 15, 20, .25);--__P__-z-fab: 2147483600;--__P__-z-panel: 2147483601;--__P__-panel-w: 380px;--__P__-panel-h: 600px;--__P__-fab-size: 56px;--__P__-conversation-max: 768px;--__P__-space-1: 4px;--__P__-space-2: 8px;--__P__-space-3: 12px;--__P__-space-4: 16px;--__P__-space-5: 20px;--__P__-space-6: 24px;--__P__-space-8: 32px;--__P__-text-scale: 1;--__P__-text-xs: calc(12px * var(--__P__-text-scale));--__P__-text-sm: calc(13px * var(--__P__-text-scale));--__P__-text-base: calc(15px * var(--__P__-text-scale));--__P__-text-md: calc(16px * var(--__P__-text-scale));--__P__-text-lg: calc(18px * var(--__P__-text-scale));--__P__-text-xl: calc(22px * var(--__P__-text-scale));--__P__-text-2xl: calc(30px * var(--__P__-text-scale))}:host([data-mode="modal"]),:host([data-mode="drawer"]){--__P__-conversation-max: 100%}:host([data-text-size="small"]){--__P__-text-scale: .9}:host([data-text-size="large"]){--__P__-text-scale: 1.15}:host{--__P__-ease: cubic-bezier(.2, .7, .2, 1);--__P__-ease-out: cubic-bezier(.2, .7, .2, 1);--__P__-ease-in: cubic-bezier(.4, 0, 1, 1);--__P__-ease-in-out: cubic-bezier(.65, 0, .35, 1);--__P__-dur-quick: .12s;--__P__-dur-base: .22s;--__P__-dur-slow: .32s;font-family:var(--__P__-font);color:var(--__P__-fg);color-scheme:light;--__P__-color-scheme: light}:host([data-theme="dark"]){--__P__-bg: oklch(.1783 .0128 278.3);--__P__-bg-elevated: oklch(.2232 .0182 278.3);--__P__-fg: oklch(.9368 .01 278.3);--__P__-fg-muted: oklch(.7048 .0296 278.3);--__P__-border: oklch(.2752 .0266 278.3);--__P__-border-strong: oklch(.335 .0291 278.3);--__P__-hover: oklch(.9368 .01 278.3 / .08);--__P__-bubble-assistant: oklch(.2474 .0311 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-danger-text: oklch(.8077 .1035 19.57);--__P__-danger-bg: oklch(.5966 .1818 24.51 / .18);--__P__-shadow-panel: 0 8px 24px -8px rgba(0, 0, 0, .6), 0 24px 64px -24px rgba(0, 0, 0, .7);--__P__-shadow-card: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 12px -6px rgba(0, 0, 0, .5);--__P__-backdrop: rgba(0, 0, 0, .65);--__P__-pill-l-min: .75;--__P__-pill-l-max: .92;color-scheme:dark;--__P__-color-scheme: dark}@media(prefers-color-scheme:dark){:host([data-theme="auto"]){--__P__-bg: oklch(.1783 .0128 278.3);--__P__-bg-elevated: oklch(.2232 .0182 278.3);--__P__-fg: oklch(.9368 .01 278.3);--__P__-fg-muted: oklch(.7048 .0296 278.3);--__P__-border: oklch(.2752 .0266 278.3);--__P__-border-strong: oklch(.335 .0291 278.3);--__P__-hover: oklch(.9368 .01 278.3 / .08);--__P__-bubble-assistant: oklch(.2474 .0311 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-pill-l-min: .75;--__P__-pill-l-max: .92;--__P__-shadow-panel: 0 8px 24px -8px rgba(0, 0, 0, .6), 0 24px 64px -24px rgba(0, 0, 0, .7);color-scheme:dark;--__P__-color-scheme: dark}}@supports (color: oklch(from red l c h)){:host{--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.3, l, .62) c h);--__P__-accent-text: oklch(from var(--__P__-accent) clamp(0, (l / .623 - 1) * -infinity, 1) 0 h);--__P__-accent-fg: oklch(from var(--__P__-accent-user) clamp(.3, l, .46) c h)}:host([data-theme="dark"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h);--__P__-accent-fg: var(--__P__-accent)}@media(prefers-color-scheme:dark){:host([data-theme="auto"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h);--__P__-accent-fg: var(--__P__-accent)}}}@media(prefers-reduced-motion:reduce){:host{--__P__-dur-quick: 1ms;--__P__-dur-base: 1ms;--__P__-dur-slow: 1ms}}
|
|
2
|
-
`;var
|
|
3
|
-
`;var Gs=`.__P__-anchor{color-scheme:var(--__P__-color-scheme, light);right:16px;bottom:16px}.__P__-surface{display:contents}.__P__-surface[hidden]{display:none}:host([data-position="bottom-left"]) .__P__-anchor,:host([data-position="top-left"]) .__P__-anchor{right:auto;left:16px}:host([data-position="top-right"]) .__P__-anchor,:host([data-position="top-left"]) .__P__-anchor{bottom:auto;top:16px}.__P__-anchor{position:fixed;display:flex;flex-direction:column;align-items:flex-end;gap:var(--__P__-space-3);pointer-events:none}.__P__-anchor{--__P__-fab-size: 56px}.__P__-anchor[data-launcher-size=sm]{--__P__-fab-size: 44px}.__P__-anchor[data-launcher-size=md]{--__P__-fab-size: 56px}.__P__-anchor[data-launcher-size=lg]{--__P__-fab-size: 68px}.__P__-anchor>*{pointer-events:auto}.__P__-fab[data-size=sm]{--__P__-fab-size: 44px;font-size:var(--__P__-text-sm)}.__P__-fab[data-size=md]{--__P__-fab-size: 56px;font-size:calc(14px * var(--__P__-text-scale))}.__P__-fab[data-size=lg]{--__P__-fab-size: 68px;font-size:var(--__P__-text-base)}.__P__-fab{display:inline-flex;align-items:center;justify-content:center;gap:var(--__P__-space-2);color:var(--__P__-accent-text);background:var(--__P__-accent);box-shadow:var(--__P__-shadow-fab);font-weight:600;line-height:1;transform-origin:bottom right;animation:__P__-fab-in var(--__P__-dur-base) var(--__P__-ease) both;transition:transform var(--__P__-dur-base) var(--__P__-ease),opacity var(--__P__-dur-base) var(--__P__-ease),box-shadow var(--__P__-dur-base) var(--__P__-ease)}.__P__-fab:hover{transform:translateY(-2px)}.__P__-fab:active{transform:translateY(0)}.__P__-fab:focus-visible{outline:2px solid var(--__P__-on-accent);outline-offset:3px}.__P__-fab svg{width:24px;height:24px;flex-shrink:0}@keyframes __P__-fab-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:none}}.__P__-fab[data-leaving]{position:absolute;right:0;bottom:0;animation:__P__-fab-out var(--__P__-dur-quick) var(--__P__-ease) forwards;pointer-events:none}:host([data-position^="top-"]) .__P__-fab[data-leaving]{bottom:auto;top:0}:host([data-position$="-left"]) .__P__-fab[data-leaving]{right:auto;left:0}@keyframes __P__-fab-out{0%{opacity:1;transform:none}to{opacity:0;transform:scale(.85)}}.__P__-fab[data-variant=circle]{width:var(--__P__-fab-size);height:var(--__P__-fab-size);border-radius:999px}.__P__-fab[data-variant=circle] .__P__-fab-label{display:none}.__P__-fab[data-variant=pill]{height:var(--__P__-fab-size);padding:0 18px 0 16px;border-radius:999px}.__P__-fab[data-variant=bar]{height:var(--__P__-fab-size);padding:0 22px;border-radius:var(--__P__-radius)}.__P__-fab[data-variant=minimal]{height:var(--__P__-fab-size);padding:0 var(--__P__-space-4);border-radius:999px;background:transparent;color:var(--__P__-accent-fg);box-shadow:none;border:1px solid currentColor}.__P__-fab[data-variant=minimal]:hover{background:color-mix(in srgb,var(--__P__-accent) 12%,transparent)}.__P__-callout{--__P__-callout-fab-h: var(--__P__-fab-size, 56px);--__P__-callout-gap: clamp(12px, calc(var(--__P__-callout-fab-h) * .25), 22px);--__P__-callout-nudge-direction: -1;position:absolute;display:inline-flex;align-items:center;gap:var(--__P__-space-2);padding:10px 14px;background:var(--__P__-fg);color:var(--__P__-bg);border-radius:999px;font-size:var(--__P__-text-sm);font-weight:600;line-height:1.2;box-shadow:0 10px 30px -8px #00000059;pointer-events:auto;animation:__P__-callout-in var(--__P__-dur-slow) var(--__P__-ease);z-index:1;max-width:240px;white-space:nowrap}.__P__-callout[data-position=left]{right:calc(100% + var(--__P__-callout-gap));bottom:calc(var(--__P__-callout-fab-h) / 2);transform:translateY(50%)}.__P__-callout[data-position=right]{left:calc(100% + var(--__P__-callout-gap));bottom:calc(var(--__P__-callout-fab-h) / 2);transform:translateY(50%);--__P__-callout-nudge-direction: 1}.__P__-callout[data-position=top]{bottom:calc(100% + var(--__P__-callout-gap));right:0;max-width:min(280px,calc(100vw - 32px))}.__P__-callout[data-position=bottom]{top:calc(100% + var(--__P__-callout-gap));right:0;max-width:min(280px,calc(100vw - 32px))}:host([data-position$="-left"]) .__P__-callout[data-position=top],:host([data-position$="-left"]) .__P__-callout[data-position=bottom]{right:auto;left:0}.__P__-callout[data-shape=bubble]{border-radius:var(--__P__-radius-md);white-space:normal;width:max-content;max-width:min(280px,calc(100vw - 32px))}.__P__-callout[data-shape=callout]{padding:12px 18px;font-size:calc(14px * var(--__P__-text-scale));background:var(--__P__-accent);color:var(--__P__-accent-text)}.__P__-callout:after{content:"";position:absolute;width:12px;height:12px;background:inherit;border-radius:2px;transform:rotate(45deg)}.__P__-callout[data-position=left]:after{right:-5px;top:50%;margin-top:-6px}.__P__-callout[data-position=right]:after{left:-5px;top:50%;margin-top:-6px}.__P__-callout[data-position=top]:after{bottom:-5px;right:calc(var(--__P__-fab-size, 56px) / 2 - 6px)}.__P__-callout[data-position=bottom]:after{top:-5px;right:calc(var(--__P__-fab-size, 56px) / 2 - 6px)}:host([data-position$="-left"]) .__P__-callout[data-position=top]:after,:host([data-position$="-left"]) .__P__-callout[data-position=bottom]:after{right:auto;left:calc(var(--__P__-fab-size, 56px) / 2 - 6px)}.__P__-callout[data-animated]{animation:__P__-callout-in var(--__P__-dur-slow) var(--__P__-ease),__P__-callout-nudge 1.6s var(--__P__-ease-in-out) var(--__P__-dur-slow) infinite}@keyframes __P__-callout-in{0%{opacity:0}to{opacity:1}}@keyframes __P__-callout-nudge{0%,to{margin-left:0;margin-right:0}50%{margin-left:calc(6px * var(--__P__-callout-nudge-direction));margin-right:calc(-6px * var(--__P__-callout-nudge-direction))}}@media(prefers-reduced-motion:reduce){.__P__-callout[data-animated]{animation:__P__-callout-in 1ms var(--__P__-ease)}.__P__-icon-btn[data-recording=true],.__P__-typing span{animation:none}}.__P__-callout-close{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:999px;color:inherit;opacity:.7;cursor:pointer}.__P__-callout-close:hover{opacity:1;background:color-mix(in srgb,currentColor 15%,transparent)}.__P__-callout-close:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-callout-close svg{width:12px;height:12px}.__P__-panel{width:var(--__P__-panel-w);height:var(--__P__-panel-h);max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);background:var(--__P__-bg);color:var(--__P__-fg);border-radius:var(--__P__-radius-lg);box-shadow:var(--__P__-shadow-panel);display:flex;flex-direction:column;overflow:hidden;overscroll-behavior:none;transform-origin:bottom right;animation:__P__-panel-in var(--__P__-dur-slow) var(--__P__-ease);border:1px solid var(--__P__-border)}@media(prefers-reduced-motion:no-preference){.__P__-panel{transition:width var(--__P__-dur-base) var(--__P__-ease),height var(--__P__-dur-base) var(--__P__-ease),max-width var(--__P__-dur-base) var(--__P__-ease),max-height var(--__P__-dur-base) var(--__P__-ease)}.__P__-panel[data-resizing]{transition:none}}:host([data-mode="open"]) .__P__-panel{width:var(--__P__-widget-w, var(--__P__-panel-w));height:var(--__P__-widget-h, var(--__P__-panel-h));min-width:var(--__P__-resize-min-w, auto);min-height:var(--__P__-resize-min-h, auto);max-width:var(--__P__-resize-max-w, calc(100vw - 32px) );max-height:var(--__P__-resize-max-h, calc(100dvh - 32px) )}@keyframes __P__-panel-in{0%{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:none}}:host([data-mode="expanded"]) .__P__-panel{width:var(--__P__-expanded-w, 640px);height:var(--__P__-expanded-h, 820px);max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px)}:host([data-mode="fullscreen"]){z-index:var(--__P__-z-panel)!important}:host([data-mode="fullscreen"]) .__P__-anchor{inset:var(--__P__-visual-viewport-top, 0px) 0 auto;height:var(--__P__-visual-viewport-height, 100dvh);padding:0;justify-content:flex-end;align-items:flex-end}:host([data-mode="fullscreen"][data-position*="top"]) .__P__-anchor{justify-content:flex-start}:host([data-mode="fullscreen"][data-position*="left"]) .__P__-anchor{align-items:flex-start}:host([data-mode="fullscreen"]) .__P__-panel{width:100vw;height:100%;max-width:none;max-height:none;border-radius:0;border:0}:host([data-mode="fullscreen"]) .__P__-fab{display:none}@media(max-width:640px){:host([data-mode="open"]) .__P__-anchor,:host([data-mode="expanded"]) .__P__-anchor{inset:var(--__P__-visual-viewport-top, 0px) 0 auto;align-items:stretch;height:var(--__P__-visual-viewport-height, 100dvh);padding:0}:host([data-mode="open"]) .__P__-panel,:host([data-mode="expanded"]) .__P__-panel{width:100vw;height:100%;max-width:none;max-height:none;border-radius:0;border:0}}:host([data-mode="inline"]) .__P__-anchor,:host([data-mode="standalone"]) .__P__-anchor{position:static;inset:auto;padding:0;align-items:stretch;width:100%;height:100%;min-height:0}:host([data-mode="inline"]) .__P__-panel,:host([data-mode="standalone"]) .__P__-panel{width:100%;height:100%;min-width:0;min-height:0;max-width:none;max-height:none;animation:none}:host([data-mode="inline"]) .__P__-fab,:host([data-mode="standalone"]) .__P__-fab{display:none}:host([data-mode="inline"]){min-height:320px}:host([data-mode="inline"]) .__P__-panel{border-radius:var(--__P__-radius)}:host([data-mode="standalone"]) .__P__-panel{border-radius:0;border:0;box-shadow:none}:host([data-mode="modal"]){position:fixed!important;inset:0!important;z-index:var(--__P__-z-panel)!important;display:block!important;width:100vw;height:100dvh;background:var(--__P__-modal-backdrop, var(--__P__-backdrop));animation:__P__-backdrop-in var(--__P__-dur-base) var(--__P__-ease) both;--__P__-panel-w: min(960px, 92vw);--__P__-panel-h: min(720px, 88dvh)}:host([data-mode="modal"]) .__P__-anchor{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:var(--__P__-space-6);pointer-events:none}:host([data-mode="modal"]) .__P__-panel{pointer-events:auto;width:var(--__P__-widget-w, var(--__P__-panel-w));height:var(--__P__-widget-h, var(--__P__-panel-h));max-width:calc(100vw - 48px);max-height:calc(100dvh - 48px);min-width:0;min-height:0;border-radius:var(--__P__-radius);box-shadow:var(--__P__-shadow-panel);animation:__P__-modal-in var(--__P__-dur-base) var(--__P__-ease);translate:var(--__P__-modal-dx, 0px) var(--__P__-modal-dy, 0px)}:host([data-mode="modal"]) .__P__-header,:host([data-mode="modal"]) .__P__-back-header,:host([data-mode="modal"]) .__P__-home-hero{cursor:grab;touch-action:none}:host([data-mode="modal"]) .__P__-panel[data-dragging]{cursor:grabbing;user-select:none}:host([data-mode="modal"]) .__P__-panel[data-dragging] *{cursor:grabbing}:host([data-mode="modal"]) .__P__-fab{display:none}@keyframes __P__-backdrop-in{0%{background:#0000}to{background:var(--__P__-modal-backdrop, var(--__P__-backdrop))}}@keyframes __P__-modal-in{0%{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}:host([data-mode="drawer"]){--__P__-panel-w: min(440px, calc(100vw - 32px) );--__P__-panel-h: 100dvh}:host([data-mode="drawer"]) .__P__-anchor{position:fixed;--__P__-inset-x: var(--__P__-panel-inset, 12px);--__P__-inset-y: var(--__P__-panel-inset, 3dvh);top:var(--__P__-inset-y);bottom:auto;right:var(--__P__-inset-x);left:auto;width:min(var(--__P__-widget-w, var(--__P__-panel-w)),calc(100vw - var(--__P__-inset-x) * 2));height:min(var(--__P__-widget-h, var(--__P__-panel-h)),calc(100dvh - var(--__P__-inset-y) * 2));padding:0;display:block;pointer-events:auto}:host([data-mode="drawer"][data-position$="-left"]) .__P__-anchor{right:auto;left:var(--__P__-inset-x)}:host([data-mode="drawer"][data-position^="bottom-"]) .__P__-anchor{top:auto;bottom:var(--__P__-inset-y)}:host([data-mode="drawer"]) .__P__-panel{width:100%;height:100%;max-width:none;max-height:none;min-width:0;min-height:0;border-radius:var(--__P__-radius, 12px);border:1px solid var(--__P__-border);box-shadow:-8px 16px 32px -12px #00000038;animation:__P__-drawer-in var(--__P__-dur-base) var(--__P__-ease)}:host([data-mode="drawer"][data-position$="-left"]) .__P__-panel{box-shadow:8px 16px 32px -12px #00000038;animation:__P__-drawer-in-left var(--__P__-dur-base) var(--__P__-ease)}.__P__-fab[data-edge-tab]{display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--__P__-space-2);position:fixed;top:50%;height:140px;width:auto;min-width:0;padding:10px 8px;writing-mode:vertical-rl;text-orientation:mixed;transform:translateY(-50%);transform-origin:center;animation:__P__-edge-tab-in var(--__P__-dur-base) var(--__P__-ease) both}.__P__-fab[data-edge-tab] svg{writing-mode:horizontal-tb}.__P__-fab[data-edge-tab]:hover{transform:translateY(-50%) scale(1.03)}.__P__-fab[data-edge-tab]:active{transform:translateY(-50%) scale(.97)}:host([data-position$="-right"]) .__P__-fab[data-edge-tab]{right:0;left:auto;border-radius:12px 0 0 12px;box-shadow:-6px 0 18px -8px #0000004d}:host([data-position$="-left"]) .__P__-fab[data-edge-tab]{left:0;right:auto;border-radius:0 12px 12px 0;box-shadow:6px 0 18px -8px #0000004d}.__P__-fab[data-edge-tab][data-leaving]{position:fixed;top:50%;bottom:auto;animation:__P__-edge-tab-out var(--__P__-dur-quick) var(--__P__-ease) forwards}@keyframes __P__-edge-tab-in{0%{opacity:0;transform:translateY(-50%) scale(.9)}to{opacity:1;transform:translateY(-50%) scale(1)}}@keyframes __P__-edge-tab-out{0%{opacity:1;transform:translateY(-50%) scale(1)}to{opacity:0;transform:translateY(-50%) scale(.85)}}@keyframes __P__-drawer-in{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes __P__-drawer-in-left{0%{transform:translate(-100%)}to{transform:translate(0)}}@media(prefers-reduced-motion:reduce){:host([data-mode="drawer"]) .__P__-panel,.__P__-fab[data-edge-tab]{animation:none}}.__P__-header{display:flex;align-items:center;gap:var(--__P__-space-2);padding:10px 12px;border-bottom:1px solid var(--__P__-border);background:var(--__P__-bg)}.__P__-header h1{font-size:calc(14px * var(--__P__-text-scale));font-weight:600;flex:1;letter-spacing:-.01em}.__P__-header-actions{margin-inline-start:auto;display:flex;align-items:center;gap:var(--__P__-space-1);flex-shrink:0}.__P__-agent{flex:1;display:inline-flex;align-items:center;gap:10px;min-width:0}.__P__-agent-avatar{position:relative;width:32px;height:32px;border-radius:999px;background:var(--__P__-bg-elevated);color:var(--__P__-fg-muted);display:inline-flex;align-items:center;justify-content:center;font-weight:700;font-size:var(--__P__-text-xs);overflow:hidden;flex-shrink:0}.__P__-agent-avatar img{width:100%;height:100%;object-fit:cover}.__P__-agent-avatar:after{content:"";position:absolute;right:-1px;bottom:-1px;width:10px;height:10px;border-radius:999px;border:2px solid var(--__P__-bg);background:var(--__P__-neutral)}.__P__-agent-avatar[data-status=online]:after{background:var(--__P__-success)}.__P__-agent-avatar[data-status=away]:after{background:var(--__P__-warning)}.__P__-agent-avatar[data-status=offline]:after{background:var(--__P__-neutral)}.__P__-agent-meta{display:flex;flex-direction:column;line-height:1.15;min-width:0}.__P__-agent-meta strong{font-size:calc(14px * var(--__P__-text-scale));font-weight:600;letter-spacing:-.01em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-agent-meta span{font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-suggestions{display:flex;flex-wrap:nowrap;gap:var(--__P__-space-2);padding:6px 14px 10px;overflow-x:auto;overflow-y:hidden;scroll-behavior:smooth;scroll-snap-type:x proximity;scrollbar-width:none;-ms-overflow-style:none;min-width:0}.__P__-suggestions::-webkit-scrollbar{display:none}.__P__-suggestions:before,.__P__-suggestions:after{content:"";flex:1 1 0;min-width:0}.__P__-suggestion{flex:0 0 auto;scroll-snap-align:center;padding:7px 14px;border-radius:999px;background:var(--__P__-bg-elevated);border:1px solid var(--__P__-border);color:var(--__P__-fg);font-size:var(--__P__-text-sm);font-weight:500;white-space:nowrap;transition:background var(--__P__-dur-quick) var(--__P__-ease),border-color var(--__P__-dur-quick) var(--__P__-ease),transform var(--__P__-dur-quick) var(--__P__-ease)}.__P__-suggestion:hover{border-color:var(--__P__-accent);color:var(--__P__-accent-fg);transform:translateY(-1px)}.__P__-suggestion:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px;border-color:var(--__P__-accent)}.__P__-suggestion:active{transform:translateY(0)}.__P__-icon-btn{width:32px;height:32px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;color:var(--__P__-fg-muted);transition:background var(--__P__-dur-quick) var(--__P__-ease),color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-icon-btn:hover{background:var(--__P__-bg-elevated);color:var(--__P__-fg)}.__P__-icon-btn:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-icon-btn:active{background:var(--__P__-border)}.__P__-icon-btn:disabled{opacity:.45;cursor:not-allowed}.__P__-icon-btn:before{content:"";position:absolute;inset:-6px}.__P__-icon-btn{position:relative}.__P__-icon-btn svg{width:18px;height:18px}.__P__-icon-btn[data-recording=true]{color:var(--__P__-accent-fg);background:color-mix(in srgb,var(--__P__-accent) 12%,transparent);animation:__P__-pulse 1.2s var(--__P__-ease) infinite}@keyframes __P__-pulse{0%,to{box-shadow:0 0 color-mix(in srgb,var(--__P__-accent) 40%,transparent)}50%{box-shadow:0 0 0 6px color-mix(in srgb,var(--__P__-accent) 0%,transparent)}}.__P__-list,.__P__-history,.__P__-module-scroll,.__P__-home-scroll,.__P__-help-list,.__P__-toolui-code,.__P__-sidebar-conversations{scrollbar-width:thin;scrollbar-color:var(--__P__-border-strong) transparent;overscroll-behavior:contain;scrollbar-gutter:stable}.__P__-list::-webkit-scrollbar,.__P__-history::-webkit-scrollbar,.__P__-module-scroll::-webkit-scrollbar,.__P__-home-scroll::-webkit-scrollbar,.__P__-help-list::-webkit-scrollbar,.__P__-toolui-code::-webkit-scrollbar,.__P__-sidebar-conversations::-webkit-scrollbar{width:8px}.__P__-list::-webkit-scrollbar-thumb,.__P__-history::-webkit-scrollbar-thumb,.__P__-module-scroll::-webkit-scrollbar-thumb,.__P__-home-scroll::-webkit-scrollbar-thumb,.__P__-help-list::-webkit-scrollbar-thumb,.__P__-toolui-code::-webkit-scrollbar-thumb,.__P__-sidebar-conversations::-webkit-scrollbar-thumb{background:var(--__P__-border-strong);border-radius:8px}.__P__-list-wrap{position:relative;flex:1;min-height:0;display:flex;flex-direction:column}.__P__-jump{position:absolute;inset-inline-end:14px;bottom:14px;z-index:2;display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;border-radius:999px;border:1px solid var(--__P__-border);background:var(--__P__-bg-elevated);color:var(--__P__-fg);box-shadow:var(--__P__-shadow-panel);cursor:pointer;opacity:.85;transition:opacity var(--__P__-dur-quick) var(--__P__-ease),transform var(--__P__-dur-quick) var(--__P__-ease);animation:__P__-bubble-in var(--__P__-dur-base) var(--__P__-ease)}.__P__-jump:hover{opacity:1}.__P__-jump:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;opacity:1}.__P__-jump:active{transform:translateY(1px)}.__P__-jump svg{width:18px;height:18px}.__P__-list{flex:1;min-height:0;overflow-y:auto;padding:var(--__P__-space-4);padding-bottom:var(--__P__-space-8);display:flex;flex-direction:column;gap:14px}.__P__-list--fade{--__P__-fade-size: 20px;--__P__-fade-top: 0px;--__P__-fade-bottom: 0px;-webkit-mask-image:linear-gradient(to bottom,transparent 0,#000 var(--__P__-fade-top),#000 calc(100% - var(--__P__-fade-bottom)),transparent 100%);mask-image:linear-gradient(to bottom,transparent 0,#000 var(--__P__-fade-top),#000 calc(100% - var(--__P__-fade-bottom)),transparent 100%)}.__P__-list--fade[data-fade-top=true]{--__P__-fade-top: var(--__P__-fade-size)}.__P__-list--fade[data-fade-bottom=true]{--__P__-fade-bottom: var(--__P__-fade-size)}.__P__-list>*{width:100%;max-width:var(--__P__-conversation-max, 768px);margin-inline:auto}.__P__-load-previous,.__P__-history-more{display:flex;justify-content:center}.__P__-load-previous button,.__P__-history-more button{border:0;padding:4px 8px;background:transparent;color:var(--__P__-accent);font:inherit;font-size:var(--__P__-text-sm);font-weight:600;cursor:pointer}.__P__-load-previous button:hover,.__P__-history-more button:hover{text-decoration:underline}.__P__-load-previous button:focus-visible,.__P__-history-more button:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;border-radius:var(--__P__-radius-sm)}.__P__-load-previous button:disabled,.__P__-history-more button:disabled{cursor:wait;opacity:.6}.__P__-date-divider{display:flex;justify-content:center;margin-block:var(--__P__-space-3)}.__P__-date-pill{padding:3px 10px;border-radius:999px;font-size:calc(11px * var(--__P__-text-scale));font-weight:600;color:var(--__P__-fg-muted);background:var(--__P__-bg-elevated);border:1px solid var(--__P__-border);box-shadow:var(--__P__-shadow-card)}.__P__-bubble-row{display:flex}.__P__-bubble-row[data-role=user]{justify-content:flex-end}.__P__-bubble-row[data-role=assistant]{justify-content:flex-start}.__P__-bubble{max-width:100%;min-width:0;padding:var(--__P__-space-3) var(--__P__-space-4);border-radius:var(--__P__-radius);line-height:1.6;font-size:calc(14px * var(--__P__-text-scale));word-wrap:break-word;overflow-wrap:break-word;box-shadow:0 1px 2px #0000000a,0 1px 8px -4px #0000000f;animation:__P__-bubble-in var(--__P__-dur-base) var(--__P__-ease)}.__P__-bubble ::selection{background:color-mix(in srgb,var(--__P__-accent) 30%,transparent)}.__P__-bubble-row[data-role=user] .__P__-bubble ::selection{background:#fff6;color:var(--__P__-bubble-user-text)}@keyframes __P__-bubble-in{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}.__P__-bubble-row[data-role=user] .__P__-bubble{background:var(--__P__-bubble-user);color:var(--__P__-bubble-user-text);border-end-end-radius:5px}.__P__-bubble-row[data-role=assistant] .__P__-bubble{background:var(--__P__-bubble-assistant);color:var(--__P__-bubble-assistant-text);border:1px solid var(--__P__-border);border-end-start-radius:5px}.__P__-bubble-row[data-role=operator] .__P__-bubble{display:flex;align-items:stretch;padding:0;overflow:hidden;background:var(--__P__-bubble-assistant);color:var(--__P__-bubble-assistant-text);border-end-start-radius:5px}.__P__-bubble-row[data-role=operator] .__P__-bubble-col{align-items:flex-start}.__P__-bubble-author{display:flex;flex:0 0 auto;align-items:center;padding:0 .875rem;border-inline-end:1px solid color-mix(in oklab,var(--__P__-accent),transparent 60%);color:var(--__P__-accent);font-size:calc(13px * var(--__P__-text-scale));font-weight:600;letter-spacing:.025em;user-select:none}.__P__-bubble-row[data-role=operator] .__P__-bubble-body{flex:1 1 auto;min-width:0;padding:var(--__P__-space-3) var(--__P__-space-4)}.__P__-bubble-col{display:flex;flex-direction:column;max-width:85%;min-width:0}.__P__-bubble-row[data-role=user] .__P__-bubble-col{align-items:flex-end}.__P__-bubble-row[data-role=assistant] .__P__-bubble-col{align-items:flex-start}.__P__-bubble-row[data-role=assistant] .__P__-bubble-col:has(.__P__-toolui){width:100%}.__P__-bubble-row[data-role=assistant] .__P__-bubble-col:has(.__P__-toolui) .__P__-bubble{width:100%}@media(max-width:640px){.__P__-bubble-col{max-width:92%}.__P__-toolui:not(.__P__-toolui-collapsible){padding:var(--__P__-space-3);gap:var(--__P__-space-2)}details.__P__-toolui-collapsible>summary{padding:var(--__P__-space-2) var(--__P__-space-3)}details.__P__-toolui-collapsible>.__P__-toolui-section{margin:var(--__P__-space-3)}.__P__-toolui-section,.__P__-toolui-desc{padding:var(--__P__-space-2) var(--__P__-space-3)}}.__P__-bubble-meta{display:flex;align-items:center;gap:8px;margin-top:2px;padding:0 2px;min-height:24px}.__P__-bubble-actions{display:flex;align-items:center;gap:2px}.__P__-bubble-time{font-size:calc(11px * var(--__P__-text-scale));line-height:1;color:var(--__P__-fg-muted);user-select:none}.__P__-feedback{display:flex;align-items:center;gap:2px}.__P__-msg-action{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border:0;border-radius:var(--__P__-radius-sm);background:transparent;color:var(--__P__-fg-muted);cursor:pointer;opacity:.65;transition:opacity var(--__P__-dur-quick) var(--__P__-ease),background var(--__P__-dur-quick) var(--__P__-ease),color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-msg-action:hover{opacity:1;background:var(--__P__-bg-elevated);color:var(--__P__-fg)}.__P__-msg-action:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;opacity:1}.__P__-msg-action[data-active=true]{opacity:1;color:var(--__P__-accent-fg)}.__P__-msg-action svg{width:15px;height:15px}.__P__-md>*:first-child{margin-top:0}.__P__-md>*:last-child{margin-bottom:0}.__P__-md p{margin:10px 0}.__P__-md h1,.__P__-md h2,.__P__-md h3,.__P__-md h4,.__P__-md h5,.__P__-md h6{margin:18px 0 8px;line-height:1.3;letter-spacing:-.01em;font-weight:700}.__P__-md h1{font-size:1.4em}.__P__-md h2{font-size:1.22em}.__P__-md h3{font-size:1.08em}.__P__-md h4,.__P__-md h5,.__P__-md h6{font-size:1em}.__P__-md>h1:first-child,.__P__-md>h2:first-child,.__P__-md>h3:first-child,.__P__-md>h4:first-child,.__P__-md>h5:first-child,.__P__-md>h6:first-child{margin-top:0}.__P__-md ul,.__P__-md ol{padding-inline-start:1.5em;margin:10px 0}.__P__-md ul{list-style:disc}.__P__-md ol{list-style:decimal}.__P__-md li{margin:6px 0;padding-inline-start:2px}.__P__-md li::marker{color:var(--__P__-fg-muted)}.__P__-md li>p{margin:6px 0}.__P__-md li>ul,.__P__-md li>ol{margin:6px 0}.__P__-md strong,.__P__-md b{font-weight:650;letter-spacing:-.005em}.__P__-md em,.__P__-md i{font-style:italic}.__P__-md code{font-family:var(--__P__-font-mono);font-size:.86em;padding:1px 6px;border-radius:5px;background:color-mix(in srgb,var(--__P__-accent) 10%,transparent);color:var(--__P__-fg);border:1px solid color-mix(in srgb,var(--__P__-accent) 16%,transparent)}.__P__-md pre{font-family:var(--__P__-font-mono);font-size:calc(12.5px * var(--__P__-text-scale));padding:12px 14px;border-radius:var(--__P__-radius-sm);background:#7f7f7f1f;overflow-x:auto;margin:var(--__P__-space-3) 0;line-height:1.5}.__P__-md pre code{padding:0;background:none}.__P__-md a{color:inherit;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px}.__P__-md a:hover{text-decoration-thickness:2px}.__P__-md blockquote{margin:14px 0;padding:6px 14px;border-inline-start:3px solid color-mix(in srgb,var(--__P__-accent) 50%,transparent);background:color-mix(in srgb,var(--__P__-accent) 5%,transparent);border-start-end-radius:var(--__P__-radius-sm);border-end-end-radius:var(--__P__-radius-sm);color:var(--__P__-fg-muted)}.__P__-md blockquote>:first-child{margin-top:0}.__P__-md blockquote>:last-child{margin-bottom:0}.__P__-md hr{border:0;height:1px;background:color-mix(in srgb,currentColor 18%,transparent);margin:var(--__P__-space-4) 0}.__P__-md table{border-collapse:collapse;margin:var(--__P__-space-3) 0;font-size:.95em;display:block;overflow-x:auto;max-width:100%;font-variant-numeric:tabular-nums}.__P__-md th,.__P__-md td{padding:6px 10px;border-bottom:1px solid color-mix(in srgb,currentColor 12%,transparent);text-align:start}.__P__-md th{font-weight:700;background:color-mix(in srgb,currentColor 6%,transparent)}.__P__-md h1+ul,.__P__-md h1+ol,.__P__-md h2+ul,.__P__-md h2+ol,.__P__-md h3+ul,.__P__-md h3+ol,.__P__-md h4+ul,.__P__-md h4+ol{margin-top:var(--__P__-space-1)}.__P__-loading{display:inline-flex;align-items:center;gap:var(--__P__-space-2);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm)}.__P__-loading-spinner{width:14px;height:14px;border-radius:999px;border:2px solid currentColor;border-top-color:transparent;animation:__P__-spin .8s linear infinite}@keyframes __P__-spin{to{transform:rotate(1turn)}}.__P__-typing{display:inline-flex;gap:var(--__P__-space-1);padding:var(--__P__-space-1) 0}.__P__-typing span{width:5px;height:5px;border-radius:999px;background:currentColor;opacity:.4;animation:__P__-blink 1.2s var(--__P__-ease) infinite}.__P__-typing span:nth-child(2){animation-delay:.2s}.__P__-typing span:nth-child(3){animation-delay:.4s}@keyframes __P__-blink{0%,80%,to{opacity:.3;transform:translateY(0)}40%{opacity:1;transform:translateY(-2px)}}.__P__-reasoning{margin:var(--__P__-space-1) 0 var(--__P__-space-2);padding-inline-start:var(--__P__-space-3);border-inline-start:2px solid var(--__P__-border-strong)}.__P__-reasoning-summary{display:inline-flex;align-items:center;gap:var(--__P__-space-1);cursor:pointer;list-style:none;user-select:none;color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs);font-weight:600}.__P__-reasoning-summary:hover{color:var(--__P__-fg)}.__P__-reasoning-summary:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;border-radius:var(--__P__-radius-sm)}.__P__-reasoning-summary::-webkit-details-marker{display:none}.__P__-reasoning-summary:before{content:"";width:5px;height:5px;border-inline-end:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(-45deg);opacity:.7;transition:transform var(--__P__-dur-quick) var(--__P__-ease)}.__P__-reasoning[open] .__P__-reasoning-summary:before{transform:rotate(45deg)}.__P__-reasoning[data-active=true] .__P__-reasoning-label{animation:__P__-reasoning-pulse 1.4s var(--__P__-ease) infinite}@keyframes __P__-reasoning-pulse{0%,to{opacity:.5}50%{opacity:1}}@media(prefers-reduced-motion:reduce){.__P__-reasoning[data-active=true] .__P__-reasoning-label{animation:none}}.__P__-reasoning-body{margin-top:var(--__P__-space-1);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm)}.__P__-reasoning-body>:first-child{margin-top:0}.__P__-reasoning-body>:last-child{margin-bottom:0}.__P__-source{display:inline-flex;align-items:center;gap:6px;max-width:100%;margin-top:6px;margin-inline-end:6px;padding:var(--__P__-space-1) var(--__P__-space-2);border-radius:999px;background:var(--__P__-bg-elevated);border:1px solid var(--__P__-border);color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs);text-decoration:none}a.__P__-source:hover{color:var(--__P__-fg);border-color:var(--__P__-accent)}.__P__-source-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-composer{border-top:1px solid var(--__P__-border);padding:10px 12px;background:var(--__P__-bg);display:flex;flex-direction:column;gap:var(--__P__-space-2)}.__P__-composer>*{width:100%;max-width:var(--__P__-conversation-max, 768px);margin-inline:auto}.__P__-composer-row{display:flex;align-items:flex-end;gap:6px}.__P__-textarea{flex:1;--__P__-textarea-base-height: 40px;height:var(--__P__-textarea-base-height);max-height:160px;padding:10px 12px;border-radius:var(--__P__-radius);background:var(--__P__-bg-elevated);border:1px solid transparent;font-size:calc(14px * var(--__P__-text-scale));line-height:1.4;transition:height var(--__P__-dur-quick) var(--__P__-ease),border-color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-textarea:focus-visible{outline:none;border-color:var(--__P__-focus)}@media(pointer:coarse){.__P__-textarea{--__P__-textarea-base-height: 44px}}.__P__-send{width:40px;height:40px;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;transition:opacity var(--__P__-dur-quick) var(--__P__-ease),transform var(--__P__-dur-quick) var(--__P__-ease),background var(--__P__-dur-quick) var(--__P__-ease)}.__P__-send[data-shape=circle]{border-radius:999px}.__P__-send[data-shape=square]{border-radius:var(--__P__-radius-sm)}.__P__-send[data-shape=pill]{width:auto;padding:0 18px;border-radius:999px}.__P__-send[data-variant=filled]{background:var(--__P__-accent);color:var(--__P__-accent-text)}.__P__-send[data-variant=outline]{background:transparent;color:var(--__P__-accent-fg);border-color:var(--__P__-accent)}.__P__-send[data-variant=outline]:not(:disabled):hover{background:color-mix(in srgb,var(--__P__-accent) 10%,transparent)}.__P__-send[data-variant=ghost]{background:transparent;color:var(--__P__-accent-fg)}.__P__-send[data-variant=ghost]:not(:disabled):hover{background:color-mix(in srgb,var(--__P__-accent) 8%,transparent)}.__P__-send:disabled{opacity:.4;cursor:not-allowed}.__P__-send:not(:disabled):hover{transform:translateY(-1px)}.__P__-send:not(:disabled):active{transform:translateY(0)}.__P__-send:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-send svg{width:18px;height:18px}.__P__-composer-actions{display:flex;gap:var(--__P__-space-1);flex-wrap:wrap}.__P__-attachments{display:flex;flex-wrap:wrap;gap:6px}.__P__-attachment-chip{display:inline-flex;align-items:center;gap:6px;padding:var(--__P__-space-1) var(--__P__-space-2) var(--__P__-space-1) var(--__P__-space-1);border-radius:999px;background:var(--__P__-bg-elevated);border:1px solid var(--__P__-border);font-size:var(--__P__-text-xs);max-width:200px}.__P__-attachment-thumb{width:24px;height:24px;border-radius:999px;object-fit:cover;background:var(--__P__-border)}.__P__-attachment-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.__P__-attachment-remove{width:18px;height:18px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;color:var(--__P__-fg-muted)}.__P__-attachment-remove:hover{background:var(--__P__-border);color:var(--__P__-fg)}.__P__-dropzone{position:absolute;inset:8px;border:2px dashed var(--__P__-accent);border-radius:var(--__P__-radius);background:color-mix(in srgb,var(--__P__-accent) 8%,transparent);display:flex;align-items:center;justify-content:center;font-weight:600;color:var(--__P__-accent-fg);pointer-events:none;z-index:10;animation:__P__-fade-in var(--__P__-dur-quick) var(--__P__-ease)}@keyframes __P__-fade-in{0%{opacity:0}to{opacity:1}}.__P__-error{margin-top:var(--__P__-space-1);padding:8px 12px;border-radius:var(--__P__-radius-sm);background:color-mix(in oklab,var(--__P__-danger) 8%,var(--__P__-bg-elevated));border:1px solid color-mix(in oklab,var(--__P__-danger) 20%,transparent);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);display:flex;align-items:center;gap:var(--__P__-space-2)}.__P__-error span{min-width:0}.__P__-error button{margin-inline-start:auto;flex-shrink:0;border:0;background:none;padding:0;color:var(--__P__-accent-fg);font:inherit;font-size:var(--__P__-text-sm);font-weight:600;text-decoration:underline;white-space:nowrap;cursor:pointer}.__P__-history{flex:1;overflow-y:auto;padding:var(--__P__-space-2) var(--__P__-space-1) var(--__P__-space-3)}.__P__-history-footer{flex:none;padding:var(--__P__-space-2) var(--__P__-space-3) var(--__P__-space-3);border-top:1px solid var(--__P__-border);background:var(--__P__-surface)}.__P__-history-new{width:100%;display:flex;align-items:center;justify-content:center;gap:var(--__P__-space-2);padding:var(--__P__-space-2) var(--__P__-space-3);border:none;border-radius:var(--__P__-radius-md);background:var(--__P__-accent);color:var(--__P__-on-accent);cursor:pointer;font-size:var(--__P__-text-sm);font-weight:600;transition:filter var(--__P__-dur-quick) var(--__P__-ease-out),transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-history-new svg{width:16px;height:16px}.__P__-history-new:hover{filter:brightness(1.08)}.__P__-history-new:active{transform:translateY(1px)}.__P__-history-new:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-history-empty{flex:1;display:flex;align-items:center;justify-content:center;padding:40px 16px;color:var(--__P__-fg-muted);font-size:calc(14px * var(--__P__-text-scale));text-align:center}.__P__-history-group{display:flex;flex-direction:column;padding:0 var(--__P__-space-3)}.__P__-history-heading{font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted);padding:14px 4px 8px;text-transform:uppercase;letter-spacing:.04em}.__P__-history-card{display:flex;flex-direction:column;background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-lg, 14px);overflow:hidden}.__P__-history-item{all:unset;display:flex;align-items:center;gap:var(--__P__-space-3);padding:12px var(--__P__-space-3);cursor:pointer;transition:background var(--__P__-dur-base) var(--__P__-ease)}.__P__-history-item+.__P__-history-item{border-top:1px solid var(--__P__-border)}.__P__-history-item:hover{background:var(--__P__-bg-elevated)}.__P__-history-item:focus-visible{background:var(--__P__-bg-elevated);outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-history-avatar{flex:none;display:grid;place-items:center;width:36px;height:36px;border-radius:50%;background:color-mix(in oklab,var(--__P__-accent) 12%,transparent);color:var(--__P__-accent-fg)}.__P__-history-avatar svg{width:18px;height:18px}.__P__-history-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.__P__-history-row{display:flex;align-items:center;justify-content:space-between;gap:var(--__P__-space-2)}.__P__-history-title{flex:1;min-width:0;font-size:calc(14px * var(--__P__-text-scale));font-weight:500;color:var(--__P__-fg);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-history-time{flex:none;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted)}.__P__-history-preview{flex:1;min-width:0;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-history-dot{flex:none;width:8px;height:8px;border-radius:50%;background:var(--__P__-accent)}.__P__-history-item[data-unread=true] .__P__-history-title{font-weight:600}.__P__-history-item[data-closed=true] .__P__-history-title{color:var(--__P__-fg-muted)}.__P__-history-item-skeleton{cursor:default;pointer-events:none}.__P__-skeleton{display:block;border-radius:4px;background:linear-gradient(90deg,color-mix(in oklab,var(--__P__-fg) 9%,transparent) 30%,color-mix(in oklab,var(--__P__-fg) 17%,transparent),color-mix(in oklab,var(--__P__-fg) 9%,transparent) 70%);background-size:200% 100%;animation:__P__-skeleton-shimmer 1.8s ease-in-out infinite}.__P__-history-avatar.__P__-skeleton{border-radius:50%}.__P__-skeleton-heading{width:52px;height:8px}.__P__-skeleton-title{width:55%;height:12px}.__P__-skeleton-time{width:34px;height:10px}.__P__-skeleton-preview{width:80%;height:10px}@keyframes __P__-skeleton-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media(prefers-reduced-motion:reduce){.__P__-skeleton{animation:none}}.__P__-list-loading{margin:auto;padding:var(--__P__-space-6) var(--__P__-space-4);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);text-align:center}.__P__-readonly-banner{display:flex;flex-direction:column;align-items:center;gap:10px;padding:14px 12px;margin:0 var(--__P__-space-3) var(--__P__-space-3);border-radius:var(--__P__-radius-md);background:var(--__P__-bg-elevated);color:var(--__P__-fg-muted);text-align:center;font-size:var(--__P__-text-sm)}.__P__-readonly-label{line-height:1.4}.__P__-readonly-cta{appearance:none;border:0;cursor:pointer;padding:var(--__P__-space-2) var(--__P__-space-4);border-radius:999px;background:var(--__P__-accent);color:var(--__P__-accent-text, #fff);font:inherit;font-weight:600;font-size:var(--__P__-text-sm);transition:filter var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-readonly-cta:hover,.__P__-readonly-cta:focus-visible{filter:brightness(1.1)}.__P__-operator-banner{display:flex;align-items:center;justify-content:center;gap:8px;margin:0 var(--__P__-space-3) var(--__P__-space-1);padding:8px 12px;border-radius:var(--__P__-radius-md);background:color-mix(in oklab,var(--__P__-bg-elevated),var(--__P__-accent) 6%);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);line-height:1.3;text-align:center}.__P__-operator-pulse{flex:0 0 auto;width:8px;height:8px;border-radius:50%;background:var(--__P__-accent)}.__P__-operator-banner[data-mode=awaiting_operator] .__P__-operator-pulse{animation:__P__-operator-pulse 1.4s var(--__P__-ease-out) infinite}.__P__-cancel-operator-request{flex:0 0 auto;padding:0;border:0;background:none;color:var(--__P__-accent);font:inherit;font-weight:600;text-decoration:underline;text-underline-offset:2px;cursor:pointer}.__P__-cancel-operator-request:hover{opacity:.8}.__P__-cancel-operator-request:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px;border-radius:var(--__P__-radius-sm)}@keyframes __P__-operator-pulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.4;transform:scale(.7)}}.__P__-readonly-cta:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px}.__P__-composer-footer{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:10px 16px;margin:0 var(--__P__-space-3);border-top:1px solid var(--__P__-border);text-align:center;font-size:calc(11px * var(--__P__-text-scale));line-height:1.4;color:var(--__P__-fg-muted)}.__P__-disclaimer{max-width:320px;margin:0 auto;opacity:.9;letter-spacing:.01em}.__P__-poweredby{display:inline-flex;align-items:center;justify-content:center;gap:6px;color:inherit;text-decoration:none;opacity:.7;transition:opacity var(--__P__-dur-base) var(--__P__-ease);font-size:calc(11px * var(--__P__-text-scale));letter-spacing:.02em}.__P__-poweredby:hover{opacity:1}.__P__-poweredby-logo{height:12px;width:auto;display:inline-block;vertical-align:middle}.__P__-poweredby-bar{flex:none;display:flex;align-items:center;justify-content:center;padding:6px 16px;border-top:1px solid var(--__P__-border);background:var(--__P__-bg-elevated)}.__P__-menu-wrap{position:relative;display:inline-flex}.__P__-menu{position:absolute;top:100%;inset-inline-end:0;margin-top:6px;min-width:200px;padding:6px;background:var(--__P__-bg);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);box-shadow:var(--__P__-shadow-panel);z-index:10;display:flex;flex-direction:column;gap:2px;animation:__P__-menu-in var(--__P__-dur-base) var(--__P__-ease)}@media(prefers-reduced-motion:reduce){.__P__-menu{animation:none}}@keyframes __P__-menu-in{0%{opacity:0;transform:translateY(-4px) scale(.98);transform-origin:top right}to{opacity:1;transform:none}}.__P__-menu-item{all:unset;display:flex;align-items:center;gap:10px;padding:8px 10px;font-size:var(--__P__-text-sm);color:var(--__P__-fg);border-radius:var(--__P__-radius-sm);cursor:pointer;user-select:none}.__P__-menu-item:hover{background:var(--__P__-bg-elevated)}.__P__-menu-item:focus-visible{background:var(--__P__-bg-elevated);outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-menu-item[disabled]{opacity:.45;cursor:not-allowed}.__P__-menu-icon{display:inline-flex;width:16px;height:16px;color:var(--__P__-fg-muted)}.__P__-menu-icon svg{width:16px;height:16px}.__P__-menu-label{flex:1}.__P__-menu-check{display:inline-flex;color:var(--__P__-accent-fg)}.__P__-menu-check svg{width:14px;height:14px}.__P__-menu-item-segmented{cursor:default}.__P__-menu-item-segmented:hover{background:transparent}.__P__-segmented{display:inline-flex;gap:2px;padding:2px;background:var(--__P__-bg-elevated);border-radius:var(--__P__-radius-sm)}.__P__-segment{all:unset;min-width:26px;padding:3px 8px;font-size:var(--__P__-text-xs);font-weight:600;letter-spacing:.02em;text-align:center;color:var(--__P__-fg-muted);border-radius:calc(var(--__P__-radius-sm) - 2px);cursor:pointer;transition:color .12s ease,background .12s ease}.__P__-segment:hover{color:var(--__P__-fg)}.__P__-segment[data-on=true]{background:var(--__P__-bg);color:var(--__P__-accent-fg);box-shadow:var(--__P__-shadow-card)}.__P__-segment:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-resize-grip{position:absolute;width:18px;height:18px;display:flex;align-items:center;justify-content:center;color:var(--__P__-fg-muted);opacity:.45;transition:opacity var(--__P__-dur-base) var(--__P__-ease);z-index:2;touch-action:none;user-select:none}.__P__-resize-grip:hover,.__P__-resize-grip:focus-visible{opacity:1}.__P__-resize-grip svg{width:10px;height:10px}.__P__-resize-grip--bottom-left{bottom:2px;left:2px;cursor:nesw-resize;transform:scaleX(-1)}.__P__-resize-grip--bottom-right{bottom:2px;right:2px;cursor:nwse-resize}.__P__-resize-grip--top-left{top:2px;left:2px;cursor:nwse-resize;transform:rotate(180deg)}.__P__-resize-grip--top-right{top:2px;right:2px;cursor:nesw-resize;transform:scaleY(-1)}:host(:not([data-mode="open"])) .__P__-resize-grip{display:none}.__P__-messenger{display:flex;flex-direction:column;overflow:hidden}.__P__-messenger-body,.__P__-messenger-pane{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.__P__-messenger-pane[hidden]{display:none}@keyframes __P__-view-in{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}.__P__-module{display:flex;flex-direction:column;height:100%;min-height:0}@media(prefers-reduced-motion:no-preference){.__P__-module,.__P__-history{animation:__P__-view-in .18s var(--__P__-ease-out)}}.__P__-module-scroll{flex:1;min-height:0;overflow-y:auto;padding:var(--__P__-space-3);display:flex;flex-direction:column;gap:var(--__P__-space-3)}.__P__-home{container-type:inline-size;background:radial-gradient(125% 65% at 88% 0%,color-mix(in srgb,#fff 16%,transparent),transparent 55%),linear-gradient(180deg,var(--__P__-accent) 0%,var(--__P__-accent) 22%,color-mix(in srgb,var(--__P__-accent) 28%,var(--__P__-surface)) 44%,var(--__P__-surface) 70%);border-radius:var(--__P__-radius-lg) var(--__P__-radius-lg) 0 0}.__P__-home-scroll{flex:1;min-height:0;overflow-y:auto;display:flex;flex-direction:column;background:transparent}.__P__-home-cards{display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:4px 14px 16px}.__P__-module-pad{padding:var(--__P__-space-3) var(--__P__-space-3) 0}.__P__-module-empty{display:flex;flex-direction:column;align-items:center;gap:var(--__P__-space-3);padding:var(--__P__-space-8) var(--__P__-space-4);text-align:center;color:var(--__P__-fg-muted);font-size:var(--__P__-text-base)}.__P__-module-retry{padding:var(--__P__-space-2) var(--__P__-space-4);border:1px solid var(--__P__-border-strong);border-radius:var(--__P__-radius-sm);color:var(--__P__-fg);font-weight:600;cursor:pointer;transition:background var(--__P__-dur-quick) var(--__P__-ease-out),border-color var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-module-retry:hover{background:var(--__P__-hover);border-color:var(--__P__-accent)}.__P__-module-retry:active{background:var(--__P__-border)}.__P__-module-retry:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-help-list{flex:1;min-height:0;overflow-y:auto;padding-bottom:var(--__P__-space-3)}.__P__-help-group{display:flex;flex-direction:column}.__P__-help-section-title{position:sticky;top:0;z-index:1;margin:0;padding:var(--__P__-space-3) var(--__P__-space-5) var(--__P__-space-2);font-size:var(--__P__-text-xs);font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--__P__-fg-muted);background:var(--__P__-bg)}.__P__-help-card{margin:0 var(--__P__-space-3) var(--__P__-space-3);background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);overflow:hidden}.__P__-help-card .__P__-list-row{border-bottom:0;border-radius:0}.__P__-help-card .__P__-list-row+.__P__-list-row{border-top:1px solid var(--__P__-border)}.__P__-tabbar{display:flex;border-top:1px solid var(--__P__-border);background:var(--__P__-bg-elevated);flex-shrink:0}.__P__-tab{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--__P__-space-1);min-height:48px;padding:var(--__P__-space-2) var(--__P__-space-1);color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs);font-weight:600;transition:color var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-tab:hover{color:var(--__P__-fg)}.__P__-tab[aria-selected=true]{color:var(--__P__-accent-fg)}.__P__-tab:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-tab:active{background:var(--__P__-hover)}.__P__-tab-icon{position:relative;display:inline-flex}.__P__-tab-icon svg{width:22px;height:22px}.__P__-tab-badge{position:absolute;top:-2px;left:calc(50% + 6px);width:8px;height:8px;border-radius:50%;background:var(--__P__-accent);box-shadow:0 0 0 2px var(--__P__-bg-elevated)}.__P__-home-hero{flex-shrink:0;padding:var(--__P__-space-5) var(--__P__-space-5) var(--__P__-space-3);color:var(--__P__-on-accent);--__P__-focus: var(--__P__-on-accent)}.__P__-home-hero-top{display:flex;align-items:center;justify-content:space-between;gap:var(--__P__-space-3);min-height:32px}.__P__-home-brand{font-size:clamp(calc(12px * var(--__P__-text-scale)),calc(3.2cqi * var(--__P__-text-scale)),calc(14px * var(--__P__-text-scale)));font-weight:600;letter-spacing:.01em;color:color-mix(in srgb,#fff 82%,transparent);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.__P__-home-brand-spacer{flex:1}.__P__-home-hero-actions{display:flex;align-items:center;gap:var(--__P__-space-2);flex-shrink:0}.__P__-home-hero-actions .__P__-icon-btn{color:#fff}.__P__-home-hero-actions .__P__-icon-btn:hover{background:color-mix(in srgb,#fff 18%,transparent);color:#fff}.__P__-home-hero-actions .__P__-icon-btn:active{background:color-mix(in srgb,#fff 26%,transparent)}.__P__-home-greeting{margin:28px 0 0;font-family:var(--__P__-font-display);font-size:clamp(calc(19px * var(--__P__-text-scale)),calc(5.5cqi * var(--__P__-text-scale)),var(--__P__-text-2xl));font-weight:800;line-height:1.18;letter-spacing:-.01em;overflow-wrap:anywhere}.__P__-home-lead{margin:10px 0 0;font-family:var(--__P__-font-display);font-size:clamp(calc(15px * var(--__P__-text-scale)),calc(4.2cqi * var(--__P__-text-scale)),var(--__P__-text-xl));font-weight:600;line-height:1.25;letter-spacing:-.005em;color:color-mix(in srgb,var(--__P__-on-accent) 78%,transparent);overflow-wrap:anywhere}.__P__-home-avatars{display:flex}.__P__-home-avatar{width:30px;height:30px;border-radius:999px;overflow:hidden;margin-inline-start:-10px;border:2px solid color-mix(in srgb,#fff 92%,transparent);box-shadow:0 1px 3px #0000002e;background:var(--__P__-surface);display:inline-flex;align-items:center;justify-content:center;font-size:var(--__P__-text-xs);font-weight:700;color:var(--__P__-fg)}.__P__-home-avatar:first-child{margin-inline-start:0}.__P__-home-avatar img{width:100%;height:100%;object-fit:cover}.__P__-home-content{background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);box-shadow:var(--__P__-shadow-card);overflow:hidden}.__P__-home-content-title{padding:var(--__P__-space-4) var(--__P__-space-4) var(--__P__-space-3);font-size:var(--__P__-text-sm);font-weight:700}.__P__-home-content-list{display:flex;flex-direction:column;padding:0 var(--__P__-space-2) var(--__P__-space-2)}.__P__-home-content-list .__P__-list-row+.__P__-list-row{border-top:1px solid var(--__P__-border)}.__P__-home-card{display:block;width:100%;text-align:start;background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);padding:var(--__P__-space-4);box-shadow:var(--__P__-shadow-card)}.__P__-home-card[data-interactive=true]{cursor:pointer;transition:background var(--__P__-dur-quick) var(--__P__-ease-out),transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-home-card[data-interactive=true]:hover{background:var(--__P__-bg-elevated)}.__P__-home-card[data-interactive=true]:active{transform:translateY(1px)}.__P__-home-card[data-interactive=true]:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-home-recent-row{display:flex;align-items:center;gap:var(--__P__-space-3)}.__P__-home-recent-avatar{display:inline-flex;align-items:center;justify-content:center;width:38px;height:38px;flex-shrink:0;border-radius:999px;background:color-mix(in oklch,var(--__P__-accent) 14%,transparent);color:var(--__P__-accent-fg)}.__P__-home-recent-avatar svg{width:20px;height:20px}.__P__-home-recent-body{display:flex;flex-direction:column;gap:3px;min-width:0;flex:1}.__P__-home-recent-title{font-weight:600;font-size:calc(14px * var(--__P__-text-scale))}.__P__-home-recent-preview{color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.__P__-home-recent-dot{width:8px;height:8px;border-radius:999px;background:var(--__P__-accent);flex-shrink:0}.__P__-home-recent-row[data-unread=true] .__P__-home-recent-title{font-weight:700}.__P__-home-status{display:flex;align-items:center;gap:var(--__P__-space-3)}.__P__-home-status-icon svg{width:22px;height:22px;color:var(--__P__-success)}.__P__-home-status[data-level=degraded] .__P__-home-status-icon svg{color:var(--__P__-warning)}.__P__-home-status[data-level=down] .__P__-home-status-icon svg{color:var(--__P__-danger)}.__P__-home-status-text{font-weight:600;font-size:calc(14px * var(--__P__-text-scale))}.__P__-home-search{display:flex;align-items:center;gap:var(--__P__-space-2);width:100%;padding:var(--__P__-space-3) var(--__P__-space-4);border-radius:var(--__P__-radius);border:1px solid var(--__P__-border);background:var(--__P__-surface);text-align:start}.__P__-home-search[data-input=true]{background:var(--__P__-bg-elevated)}.__P__-home-search:hover{border-color:var(--__P__-border-strong)}.__P__-home-search:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-home-search[data-input=true]:focus-within{outline:none;border-color:var(--__P__-focus)}.__P__-home-search-text{flex:1;color:var(--__P__-fg-muted);font-size:calc(14px * var(--__P__-text-scale))}.__P__-home-search-input{flex:1;border:0;background:transparent;font-size:calc(14px * var(--__P__-text-scale));color:var(--__P__-fg);outline:none}.__P__-home-search-input:focus-visible{outline:none}.__P__-home-search-icon svg{width:18px;height:18px;color:var(--__P__-accent-fg)}.__P__-list-row{display:flex;align-items:center;gap:var(--__P__-space-3);width:100%;min-height:44px;text-align:start;padding:var(--__P__-space-3) var(--__P__-space-2);border-radius:var(--__P__-radius-sm)}.__P__-list-row:hover{background:var(--__P__-hover)}.__P__-list-row:active{background:var(--__P__-border)}.__P__-list-row:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-list-row-body{display:flex;flex-direction:column;min-width:0;flex:1}.__P__-list-row-title{font-weight:600;font-size:var(--__P__-text-md);line-height:1.35}.__P__-list-row-sub{color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);margin-top:var(--__P__-space-1);line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.__P__-list-row-chevron svg{width:18px;height:18px;color:var(--__P__-accent-fg);flex-shrink:0}.__P__-back-header{display:flex;align-items:center;gap:var(--__P__-space-2);padding:10px 12px;border-bottom:1px solid var(--__P__-border);flex-shrink:0}.__P__-back-title{flex:1;text-align:center;font-size:var(--__P__-text-md);font-weight:700;margin:0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-back-spacer{width:32px;height:1px}.__P__-history>*,.__P__-home-scroll>*,.__P__-module-scroll>*,.__P__-help-list>*,.__P__-history-footer>*,.__P__-module-pad{width:100%;max-width:var(--__P__-conversation-max, 768px);margin-inline:auto}.__P__-header,.__P__-back-header{padding-inline:max(12px,calc((100% - var(--__P__-conversation-max, 768px)) / 2))}.__P__-tabbar{padding-inline:max(0px,calc((100% - var(--__P__-conversation-max, 768px)) / 2))}.__P__-content{display:flex;flex-direction:column;gap:14px;width:100%;max-width:68ch;margin:0 auto}.__P__-content-hero{width:100%;border-radius:var(--__P__-radius)}.__P__-content-subtitle{color:var(--__P__-fg-muted);margin:0}.__P__-content-frame{flex:1;min-height:0;width:100%;border:0;background:#fff}.__P__-news-list{display:flex;flex-direction:column;gap:var(--__P__-space-3)}.__P__-news-card{display:block;width:100%;text-align:start;border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);overflow:hidden;background:var(--__P__-surface)}.__P__-news-card{transition:background var(--__P__-dur-quick) var(--__P__-ease-out),transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-news-card:hover{background:var(--__P__-bg-elevated)}.__P__-news-card:active{transform:translateY(1px)}.__P__-news-card:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-news-hero{width:100%;display:block}.__P__-news-body{display:flex;flex-direction:column;gap:6px;padding:14px 16px}.__P__-news-title{font-weight:700;font-size:var(--__P__-text-md)}.__P__-news-summary{color:var(--__P__-fg-muted);font-size:calc(14px * var(--__P__-text-scale));display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.__P__-modules-empty{display:flex;align-items:center;justify-content:center;position:relative}.__P__-modules-empty-close{position:absolute;top:12px;inset-inline-end:12px}.__P__-modules-empty-text{color:var(--__P__-fg-muted);font-size:var(--__P__-text-base)}.__P__-form{display:flex;flex-direction:column;gap:var(--__P__-space-4)}.__P__-field{display:flex;flex-direction:column;gap:6px}.__P__-field-head{display:flex;flex-wrap:wrap;align-items:baseline;gap:var(--__P__-space-2)}.__P__-field-label{font-size:var(--__P__-text-sm);font-weight:600;color:var(--__P__-fg)}.__P__-field-req{color:var(--__P__-danger)}.__P__-field-type{flex-shrink:0;align-self:center;margin-inline-start:auto;border:1px solid var(--__P__-border);border-radius:5px;background:color-mix(in oklab,var(--__P__-fg-muted) 9%,transparent);padding:1px 7px;font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted);white-space:nowrap}.__P__-field-input{width:100%;min-width:0;max-width:100%;box-sizing:border-box;padding:10px var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);color:var(--__P__-fg);font:inherit;font-size:var(--__P__-text-sm);resize:vertical;transition:border-color var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-field-input:focus-visible{outline:none;border-color:var(--__P__-accent)}.__P__-field[data-invalid=true] .__P__-field-input{border-color:var(--__P__-danger)}.__P__-field-input[type=date],.__P__-field-input[type=time]{appearance:none;-webkit-appearance:none}@media(pointer:coarse){.__P__-textarea,.__P__-home-search-input,.__P__-field-input{font-size:max(16px,calc(16px * var(--__P__-text-scale)))}}.__P__-field-hint{font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted)}.__P__-field-error{font-size:var(--__P__-text-xs);color:var(--__P__-danger)}.__P__-field-choices{display:flex;flex-direction:column;gap:10px;padding-top:2px}.__P__-choice{display:flex;align-items:flex-start;gap:10px;font-size:var(--__P__-text-sm);color:var(--__P__-fg);cursor:pointer}.__P__-choice input{margin-top:2px;accent-color:var(--__P__-accent)}.__P__-form-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:var(--__P__-space-2);margin-top:var(--__P__-space-2)}.__P__-form-hint{flex:1 1 auto;min-width:6rem;margin-inline-end:auto;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted)}.__P__-form-submit{padding:var(--__P__-space-2) var(--__P__-space-4);border:none;border-radius:var(--__P__-radius-md);background:var(--__P__-accent);color:var(--__P__-accent-text, #fff);font:inherit;font-weight:600;font-size:var(--__P__-text-sm);white-space:nowrap;flex-shrink:0;cursor:pointer;transition:filter var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-form-submit:hover:not(:disabled){filter:brightness(1.06)}.__P__-form-submit:disabled{opacity:.6;cursor:default}.__P__-form-skip{padding:var(--__P__-space-2) var(--__P__-space-4);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:transparent;color:var(--__P__-fg-muted);font:inherit;font-size:var(--__P__-text-sm);white-space:nowrap;flex-shrink:0;cursor:pointer;transition:background var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-form-skip:hover:not(:disabled){background:var(--__P__-bg-elevated)}@media(max-width:640px){.__P__-form-hint{flex-basis:100%;margin-inline-end:0;font-size:var(--__P__-text-xs)}.__P__-form-submit,.__P__-form-skip{flex:1 1 0;text-align:center}}.__P__-form-gate{display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:var(--__P__-space-4);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:var(--__P__-bg-elevated)}.__P__-form-gate-title{margin:0;font-size:var(--__P__-text-base);font-weight:700;color:var(--__P__-fg)}.__P__-form-gate-desc{margin:0 0 var(--__P__-space-1);font-size:var(--__P__-text-sm);color:var(--__P__-fg-muted)}.__P__-form-done{display:flex;align-items:center;justify-content:center;gap:6px;padding:6px 12px;border:1px dashed var(--__P__-border);border-radius:999px;align-self:center;font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted)}.__P__-form-done svg{width:14px;height:14px;color:var(--__P__-success, #22c55e)}.__P__-form-done[data-outcome=skipped] svg{color:var(--__P__-fg-muted)}.__P__-form-done-fill{border:0;background:none;padding:0 2px;cursor:pointer;font:inherit;font-weight:600;color:var(--__P__-accent-fg)}.__P__-form-done-fill:hover{text-decoration:underline}details.__P__-form-done{display:block;padding:0;border-radius:var(--__P__-radius-md)}details[open].__P__-form-done{width:min(100%,420px);background:var(--__P__-surface)}.__P__-form-done-summary{display:flex;align-items:center;justify-content:center;gap:6px;padding:8px 12px;cursor:pointer;list-style:none}.__P__-form-done-summary::-webkit-details-marker{display:none}.__P__-form-done-summary>svg:last-child{color:var(--__P__-fg-muted);transition:transform .15s var(--__P__-ease)}details[open]>.__P__-form-done-summary>svg:last-child{transform:rotate(90deg)}.__P__-form-answers{margin:0;padding:var(--__P__-space-2) var(--__P__-space-3) var(--__P__-space-3);display:grid;gap:var(--__P__-space-3);text-align:start}.__P__-form-answer{display:grid;gap:6px}.__P__-form-answer dt{font-size:var(--__P__-text-sm);font-weight:600;color:var(--__P__-fg)}.__P__-form-answer dd{margin:0;padding:10px var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);font-size:var(--__P__-text-sm);font-weight:400;color:var(--__P__-fg);overflow-wrap:anywhere}.__P__-toolui{margin-block:var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-lg, 14px);background:var(--__P__-bg-elevated);font-size:var(--__P__-text-sm)}.__P__-toolui:not(.__P__-toolui-collapsible){display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:var(--__P__-space-4)}.__P__-toolui-group{display:flex;flex-direction:column;gap:var(--__P__-space-3);margin-block:var(--__P__-space-3)}.__P__-toolui-group>.__P__-toolui{margin-block:0}.__P__-toolui-stale{opacity:.7}details.__P__-toolui-collapsible>summary{display:flex;align-items:center;gap:var(--__P__-space-2);padding:var(--__P__-space-3) var(--__P__-space-4);cursor:pointer;list-style:none;-webkit-tap-highlight-color:transparent;user-select:none}details.__P__-toolui-collapsible>summary::-webkit-details-marker{display:none}details.__P__-toolui-collapsible[open]>summary{border-bottom:1px solid var(--__P__-border)}details.__P__-toolui-collapsible>.__P__-toolui-section{margin:var(--__P__-space-4)}details.__P__-toolui-collapsible>.__P__-toolui-section~.__P__-toolui-section{margin-top:calc(-1 * var(--__P__-space-2))}.__P__-toolui-name-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-toolui-chevron{display:inline-flex;color:var(--__P__-fg-muted);transition:transform var(--__P__-dur-quick) var(--__P__-ease-out)}details.__P__-toolui-collapsible>summary .__P__-toolui-status{margin-inline-start:auto}.__P__-toolui-chevron svg{width:16px;height:16px}details.__P__-toolui-collapsible[open]>summary .__P__-toolui-chevron{transform:rotate(180deg)}.__P__-toolui-badge,.__P__-toolui-name-pill,.__P__-toolui-q-pill{--__P__-pill: var(--__P__-fg-muted);display:inline-flex;min-width:0;align-items:center;gap:5px;padding:3px 7px;border-radius:5px;border:1px solid var(--__P__-border);background:color-mix(in oklab,var(--__P__-fg-muted) 9%,transparent);color:var(--__P__-pill);font-size:var(--__P__-text-xs);font-weight:600;white-space:nowrap}.__P__-toolui-badge svg,.__P__-toolui-name-pill svg,.__P__-toolui-q-pill svg{flex-shrink:0;width:14px;height:14px}.__P__-toolui-status-icon{display:inline-flex}.__P__-toolui-name-pill{--__P__-pill: oklch(.68 .13 233)}.__P__-toolui-q-pill{--__P__-pill: oklch(.66 .12 195)}.__P__-toolui-status[data-status=completed]{--__P__-pill: var(--__P__-success, #16a34a)}.__P__-toolui-status[data-status=responded]{--__P__-pill: oklch(.62 .15 255)}.__P__-toolui-status[data-status=awaiting]{--__P__-pill: var(--__P__-warning, #f59e0b)}.__P__-toolui-status[data-status=denied]{--__P__-pill: oklch(.66 .16 45)}.__P__-toolui-status[data-status=error]{--__P__-pill: var(--__P__-danger, #dc2626)}.__P__-toolui-status[data-status=superseded]{--__P__-pill: var(--__P__-fg-muted)}@supports (color: oklch(from red l c h)){.__P__-toolui-badge,.__P__-toolui-name-pill,.__P__-toolui-q-pill{color:oklch(from var(--__P__-pill) clamp(var(--__P__-pill-l-min),l,var(--__P__-pill-l-max)) c h)}}.__P__-toolui-head{display:flex;align-items:center;flex-wrap:wrap;gap:var(--__P__-space-2)}.__P__-toolui-head-end{display:inline-flex;align-items:center;gap:var(--__P__-space-2);margin-inline-start:auto}.__P__-toolui-collapse-body{display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:var(--__P__-space-4)}.__P__-toolui-summary{display:flex;flex-direction:column;gap:var(--__P__-space-3)}.__P__-toolui-collapse-body>.__P__-form{gap:var(--__P__-space-3)}.__P__-toolui-collapse-body>.__P__-form>.__P__-field,.__P__-toolui-summary>.__P__-field{padding:10px var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:color-mix(in oklab,var(--__P__-bg) 80%,transparent);line-height:1.5}.__P__-toolui-collapse-body>.__P__-form>.__P__-field{gap:var(--__P__-space-2)}.__P__-toolui-summary>.__P__-field{gap:var(--__P__-space-1)}.__P__-toolui-summary .__P__-field-label{color:var(--__P__-fg-muted)}.__P__-toolui-answer{margin:0;font-size:var(--__P__-text-sm);color:var(--__P__-fg-muted);overflow-wrap:anywhere;white-space:pre-wrap}.__P__-toolui-footer{display:flex;align-items:center;justify-content:space-between;gap:var(--__P__-space-3);margin-inline:calc(-1 * var(--__P__-space-4));padding:var(--__P__-space-3) var(--__P__-space-4) 0;border-top:1px solid var(--__P__-border)}.__P__-toolui-options-toggle{display:inline-flex;align-items:center;gap:4px;border:0;background:transparent;padding:0;cursor:pointer;font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted);transition:color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-toolui-options-toggle:hover{color:var(--__P__-fg)}.__P__-toolui-options-chevron{display:inline-flex;transition:transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-toolui-options-chevron svg{width:14px;height:14px}.__P__-toolui-options-chevron.__P__-open{transform:rotate(180deg)}.__P__-toolui-desc{margin:0;padding:var(--__P__-space-3);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);border:1px solid var(--__P__-border);color:var(--__P__-fg-muted);line-height:1.5}.__P__-toolui-section{display:flex;flex-direction:column;gap:8px;padding:var(--__P__-space-3);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);border:1px solid var(--__P__-border)}.__P__-toolui:not(.__P__-toolui-collapsible) .__P__-toolui-section,.__P__-toolui:not(.__P__-toolui-collapsible) .__P__-toolui-desc{padding:0;background:none;border:0;border-radius:0}.__P__-toolui-label{font-size:var(--__P__-text-xs);font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--__P__-fg-muted)}.__P__-toolui-code{margin:0;max-height:240px;overflow:auto;color:var(--__P__-fg);font-family:var(--__P__-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);font-size:var(--__P__-text-xs);line-height:1.5;white-space:pre-wrap;word-break:break-word}.__P__-toolui-code[data-error=true]{color:var(--__P__-danger, #dc2626)}.__P__-toolui-body{gap:6px}.__P__-toolui-prompt{margin:0;font-weight:600;color:var(--__P__-fg);overflow-wrap:anywhere}.__P__-toolui-subtle{margin:0;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted);line-height:1.5}.__P__-toolui-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:var(--__P__-space-2);margin-top:var(--__P__-space-2)}:host([dir="rtl"]) .__P__-icon-dir{transform:scaleX(-1)}:host([dir="rtl"]) .__P__-field-input[type=date],:host([dir="rtl"]) .__P__-field-input[type=time]{position:relative;text-align:right;padding-left:34px}:host([dir="rtl"]) .__P__-field-input[type=date]::-webkit-datetime-edit,:host([dir="rtl"]) .__P__-field-input[type=time]::-webkit-datetime-edit{text-align:right}:host([dir="rtl"]) .__P__-field-input[type=date]::-webkit-calendar-picker-indicator,:host([dir="rtl"]) .__P__-field-input[type=time]::-webkit-calendar-picker-indicator{position:absolute;left:var(--__P__-space-3);margin:0}
|
|
1
|
+
"use strict";var HelpAI=(()=>{var ca=Object.defineProperty;var h_=Object.getOwnPropertyDescriptor;var b_=Object.getOwnPropertyNames;var y_=Object.prototype.hasOwnProperty;var P_=(e,t,n)=>t in e?ca(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var x_=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of b_(t))!y_.call(e,r)&&r!==n&&ca(e,r,{get:()=>t[r],enumerable:!(o=h_(t,r))||o.enumerable});return e};var S_=e=>x_(ca({},"__esModule",{value:!0}),e);var se=(e,t,n)=>P_(e,typeof t!="symbol"?t+"":t,n);var xv={};var R={id:"help-ai",name:"@helpai/elements",global:"HelpAI",tagName:"web-ai-chat",cssPrefix:"helpai",defaultBaseUrl:"https://help.ai",displayName:"Help AI",domain:"help.ai",siteUrl:"https://help.ai"};var Qi={attach:"Attach files",attachmentMimeRejected:"File type not supported",attachmentTooLarge:"File is too large",attachmentTooMany:"Attachment limit reached",conversationClosed:"This chat is closed",conversationLoading:"Loading chat\u2026",loadPreviousMessages:"Load previous messages",close:"Close",collapse:"Collapse",collapseSidebar:"Collapse sidebar",composerPlaceholder:"Type a message\u2026",dateLastWeek:"Last 7 days",dateOlder:"Older",dateToday:"Today",dateYesterday:"Yesterday",dropZone:"Drop files to attach",errorGeneric:"Something went wrong",errorRateLimited:"Too many requests \u2014 please try again in a moment.",errorRetry:"Retry",expand:"Expand",expandSidebar:"Expand sidebar",exitFullscreen:"Exit fullscreen",fullscreen:"Fullscreen",history:"History",historyBack:"Back to chat",historyEmpty:"No previous chats yet",historyLoading:"Loading your chats\u2026",historyContinue:"Continue the chat",historyTitle:"Chat history",loadMoreConversations:"Load more conversations",language:"Language",launcherOpen:"Open chat",launcherLabel:"Chat with us",micStart:"Start voice input",micStop:"Stop voice input",micUnsupported:"Voice input is not supported in this browser",moreActions:"More actions",newConversation:"New chat",panelTitle:"Chat",popOut:"Open in new tab",resizeHandle:"Drag to resize",scrollToBottom:"Scroll to latest",send:"Send",soundOff:"Sound off",soundOn:"Sound on",startNewConversation:"Start a new chat",talkToOperator:"Talk to an operator",connectingOperator:"Connecting you to an operator\u2026",noOperatorAvailable:"No one's available right now \u2014 leave your details and we'll follow up.",chattingWithOperator:"You're chatting with {operator}",cancelOperatorRequest:"Keep chatting with the AI",stop:"Stop",theme:"Theme",themeAuto:"Auto",themeDark:"Dark",themeLight:"Light",textSize:"Text size",textSizeSmall:"Small",textSizeNormal:"Normal",textSizeLarge:"Large",loading:"Loading\u2026",thinking:"Thinking\u2026",thoughts:"Thoughts",toolResult:"Result",sources:"Sources",feedbackUp:"Good response",feedbackDown:"Bad response",feedbackThanks:"Thanks for your feedback",copy:"Copy",copied:"Copied",tabHome:"Home",tabConversations:"Chats",tabHelp:"Help",tabNews:"News",modulesEmpty:"Nothing here yet",moduleBack:"Back",contentLoading:"Loading\u2026",homeGreeting:"How can we help?",homeGreetingNamed:"Hi {name} \u{1F44B}",homeGreetingLead:"How can we help?",homeSearchPlaceholder:"Search for help",homeContentTitle:"Popular articles",homeStatus:"Status",helpTitle:"Help",helpSearchPlaceholder:"Search for help",helpEmpty:"No help articles yet",helpLoading:"Loading help\u2026",helpSearchEmpty:"No results found",newsTitle:"News",newsEmpty:"No news yet",newsLoading:"Loading news\u2026",newsBack:"Back to news",newsPublishedAt:"Published {date}",formSubmit:"Submit",formSkip:"Maybe later",formSubmitted:"Completed",formSkipped:"Maybe later",formFillOut:"Fill out",formRequired:"This field is required",formInvalidEmail:"Enter a valid email address",formInvalidTel:"Enter a valid phone number",formInvalidUrl:"Enter a valid URL",formInvalidNumber:"Enter a valid number",formTooShort:"Too short (min {min} characters)",formTooLong:"Too long (max {max} characters)",formNumberTooSmall:"Must be at least {min}",formNumberTooLarge:"Must be at most {max}",formPatternMismatch:"Please match the requested format",formChooseAtLeast:"Choose at least {min}",formChooseAtMost:"Choose at most {max}",formOther:"Other",formOtherPlaceholder:"Type your answer\u2026",inputRequired:"Questions for you",inputBadge:"Questions",inputAnswered:"Answered",inputSkipped:"Skipped",showOptions:"Show options",hideOptions:"Hide options",qtypeText:"Your answer",qtypeEmail:"Email address",qtypePhone:"Phone number",qtypeNumber:"Number",qtypeDate:"Date",qtypeChooseOne:"Pick one",qtypeChooseAny:"Pick any",qtypeBoolean:"Yes / No",inputSubmit:"Submit answers",inputSubmitHint:"Enter to send \xB7 Shift+Enter = new line",inputSkip:"Skip",confirmYes:"Yes",confirmNo:"No",approve:"Approve",reject:"Reject",approvalPrompt:"{tool} requires your approval to execute.",approvalBody:"Review the tool input above and decide whether to allow this action.",approvalYourResponse:"Your response: {decision}",approvalEditHint:"You can edit this response until this step continues.",approvalSubmitting:"Response submitted. Request in progress\u2026",edit:"Edit",toolParameters:"Parameters",statusAwaiting:"Awaiting Approval",statusResponded:"Submitted",statusRunning:"Running",statusCompleted:"Completed",statusDenied:"Denied",statusError:"Error",statusSuperseded:"Skipped"},k_={attach:"Joindre des fichiers",attachmentMimeRejected:"Type de fichier non pris en charge",attachmentTooLarge:"Le fichier est trop volumineux",attachmentTooMany:"Limite de pi\xE8ces jointes atteinte",conversationClosed:"Ce chat est ferm\xE9",conversationLoading:"Chargement du chat\u2026",loadPreviousMessages:"Charger les messages pr\xE9c\xE9dents",close:"Fermer",collapse:"R\xE9duire",collapseSidebar:"R\xE9duire la barre lat\xE9rale",composerPlaceholder:"\xC9crivez un message\u2026",dateLastWeek:"7 derniers jours",dateOlder:"Plus ancien",dateToday:"Aujourd'hui",dateYesterday:"Hier",dropZone:"D\xE9posez les fichiers \xE0 joindre",errorGeneric:"Une erreur s'est produite",errorRateLimited:"Trop de requ\xEAtes \u2014 veuillez r\xE9essayer dans un instant.",errorRetry:"R\xE9essayer",expand:"Agrandir",expandSidebar:"D\xE9velopper la barre lat\xE9rale",exitFullscreen:"Quitter le plein \xE9cran",fullscreen:"Plein \xE9cran",history:"Historique",historyBack:"Retour au chat",historyEmpty:"Aucun chat pour le moment",historyContinue:"Poursuivre le chat",historyLoading:"Chargement de vos chats\u2026",historyTitle:"Historique des chats",loadMoreConversations:"Charger plus de conversations",language:"Langue",launcherOpen:"Ouvrir le chat",launcherLabel:"Discuter avec nous",micStart:"D\xE9marrer la saisie vocale",micStop:"Arr\xEAter la saisie vocale",micUnsupported:"La saisie vocale n'est pas prise en charge par ce navigateur",moreActions:"Plus d'actions",newConversation:"Nouveau chat",panelTitle:"Chat",popOut:"Ouvrir dans un nouvel onglet",resizeHandle:"Glisser pour redimensionner",scrollToBottom:"Aller au plus r\xE9cent",send:"Envoyer",soundOff:"Son d\xE9sactiv\xE9",soundOn:"Son activ\xE9",startNewConversation:"D\xE9marrer un nouveau chat",talkToOperator:"Parler \xE0 un op\xE9rateur",connectingOperator:"Mise en relation avec un op\xE9rateur\u2026",noOperatorAvailable:"Personne n'est disponible pour le moment \u2014 laissez vos coordonn\xE9es et nous reviendrons vers vous.",chattingWithOperator:"Vous discutez avec {operator}",cancelOperatorRequest:"Continuer avec l'IA",stop:"Arr\xEAter",theme:"Th\xE8me",themeAuto:"Auto",themeDark:"Sombre",themeLight:"Clair",textSize:"Taille du texte",textSizeSmall:"Petite",textSizeNormal:"Normale",textSizeLarge:"Grande",loading:"Chargement\u2026",thinking:"R\xE9flexion\u2026",thoughts:"R\xE9flexions",toolResult:"R\xE9sultat",sources:"Sources",feedbackUp:"Bonne r\xE9ponse",feedbackDown:"Mauvaise r\xE9ponse",feedbackThanks:"Merci pour votre retour",copy:"Copier",copied:"Copi\xE9",tabHome:"Accueil",tabConversations:"Chats",tabHelp:"Aide",tabNews:"Actualit\xE9s",modulesEmpty:"Rien pour le moment",moduleBack:"Retour",contentLoading:"Chargement\u2026",homeGreeting:"Comment pouvons-nous vous aider ?",homeGreetingNamed:"Bonjour {name} \u{1F44B}",homeGreetingLead:"Comment pouvons-nous vous aider ?",homeSearchPlaceholder:"Rechercher de l'aide",homeContentTitle:"Articles populaires",homeStatus:"Statut",helpTitle:"Aide",helpSearchPlaceholder:"Rechercher de l'aide",helpEmpty:"Aucun article d'aide pour le moment",helpLoading:"Chargement de l'aide\u2026",helpSearchEmpty:"Aucun r\xE9sultat trouv\xE9",newsTitle:"Actualit\xE9s",newsEmpty:"Aucune actualit\xE9 pour le moment",newsLoading:"Chargement des actualit\xE9s\u2026",newsBack:"Retour aux actualit\xE9s",newsPublishedAt:"Publi\xE9 le {date}",formSubmit:"Envoyer",formSkip:"Plus tard",formSubmitted:"Termin\xE9",formSkipped:"Plus tard",formFillOut:"Remplir",formRequired:"Ce champ est obligatoire",formInvalidEmail:"Saisissez une adresse e-mail valide",formInvalidTel:"Saisissez un num\xE9ro de t\xE9l\xE9phone valide",formInvalidUrl:"Saisissez une URL valide",formInvalidNumber:"Saisissez un nombre valide",formTooShort:"Trop court (min. {min} caract\xE8res)",formTooLong:"Trop long (max. {max} caract\xE8res)",formNumberTooSmall:"Doit \xEAtre au moins {min}",formNumberTooLarge:"Doit \xEAtre au plus {max}",formPatternMismatch:"Veuillez respecter le format demand\xE9",formChooseAtLeast:"Choisissez au moins {min}",formChooseAtMost:"Choisissez au plus {max}",formOther:"Autre",formOtherPlaceholder:"Saisissez votre r\xE9ponse\u2026",inputRequired:"Questions pour vous",inputBadge:"Questions",inputAnswered:"R\xE9pondu",inputSkipped:"Ignor\xE9",showOptions:"Afficher les options",hideOptions:"Masquer les options",qtypeText:"Votre r\xE9ponse",qtypeEmail:"Adresse e-mail",qtypePhone:"Num\xE9ro de t\xE9l\xE9phone",qtypeNumber:"Nombre",qtypeDate:"Date",qtypeChooseOne:"Choisir une",qtypeChooseAny:"Choisir plusieurs",qtypeBoolean:"Oui / Non",inputSubmit:"Envoyer les r\xE9ponses",inputSubmitHint:"Entr\xE9e pour envoyer \xB7 Maj+Entr\xE9e = saut de ligne",inputSkip:"Ignorer",confirmYes:"Oui",confirmNo:"Non",approve:"Approuver",reject:"Refuser",approvalPrompt:"{tool} n\xE9cessite votre approbation pour s'ex\xE9cuter.",approvalBody:"V\xE9rifiez les param\xE8tres ci-dessus et d\xE9cidez d'autoriser ou non cette action.",approvalYourResponse:"Votre r\xE9ponse : {decision}",approvalEditHint:"Vous pouvez modifier votre r\xE9ponse jusqu'\xE0 la reprise de cette \xE9tape.",approvalSubmitting:"R\xE9ponse envoy\xE9e. Traitement en cours\u2026",edit:"Modifier",toolParameters:"Param\xE8tres",statusAwaiting:"En attente d'approbation",statusResponded:"Envoy\xE9",statusRunning:"En cours",statusCompleted:"Termin\xE9",statusDenied:"Refus\xE9",statusError:"Erreur",statusSuperseded:"Ignor\xE9"},w_={attach:"\u0625\u0631\u0641\u0627\u0642 \u0645\u0644\u0641\u0627\u062A",attachmentMimeRejected:"\u0646\u0648\u0639 \u0627\u0644\u0645\u0644\u0641 \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645",attachmentTooLarge:"\u062D\u062C\u0645 \u0627\u0644\u0645\u0644\u0641 \u0643\u0628\u064A\u0631 \u062C\u062F\u064B\u0627",attachmentTooMany:"\u062A\u0645 \u0628\u0644\u0648\u063A \u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 \u0644\u0644\u0645\u0631\u0641\u0642\u0627\u062A",conversationClosed:"\u062A\u0645 \u0625\u063A\u0644\u0627\u0642 \u0647\u0630\u0647 \u0627\u0644\u062F\u0631\u062F\u0634\u0629",conversationLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u062F\u0631\u062F\u0634\u0629\u2026",loadPreviousMessages:"\u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0631\u0633\u0627\u0626\u0644 \u0627\u0644\u0633\u0627\u0628\u0642\u0629",close:"\u0625\u063A\u0644\u0627\u0642",collapse:"\u0637\u064A\u0651",collapseSidebar:"\u0637\u064A\u0651 \u0627\u0644\u0634\u0631\u064A\u0637 \u0627\u0644\u062C\u0627\u0646\u0628\u064A",composerPlaceholder:"\u0627\u0643\u062A\u0628 \u0631\u0633\u0627\u0644\u0629\u2026",dateLastWeek:"\u0622\u062E\u0631 \u0667 \u0623\u064A\u0627\u0645",dateOlder:"\u0623\u0642\u062F\u0645",dateToday:"\u0627\u0644\u064A\u0648\u0645",dateYesterday:"\u0623\u0645\u0633",dropZone:"\u0623\u0641\u0644\u062A \u0627\u0644\u0645\u0644\u0641\u0627\u062A \u0644\u0625\u0631\u0641\u0627\u0642\u0647\u0627",errorGeneric:"\u062D\u062F\u062B \u062E\u0637\u0623 \u0645\u0627",errorRateLimited:"\u0637\u0644\u0628\u0627\u062A \u0643\u062B\u064A\u0631\u0629 \u062C\u062F\u064B\u0627 \u2014 \u064A\u0631\u062C\u0649 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629 \u0628\u0639\u062F \u0644\u062D\u0638\u0629.",errorRetry:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629",expand:"\u062A\u0648\u0633\u064A\u0639",expandSidebar:"\u062A\u0648\u0633\u064A\u0639 \u0627\u0644\u0634\u0631\u064A\u0637 \u0627\u0644\u062C\u0627\u0646\u0628\u064A",exitFullscreen:"\u0625\u0646\u0647\u0627\u0621 \u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629",fullscreen:"\u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629",history:"\u0627\u0644\u0633\u062C\u0644",historyBack:"\u0627\u0644\u0639\u0648\u062F\u0629 \u0625\u0644\u0649 \u0627\u0644\u062F\u0631\u062F\u0634\u0629",historyEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u062F\u0631\u062F\u0634\u0627\u062A \u0633\u0627\u0628\u0642\u0629 \u0628\u0639\u062F",historyContinue:"\u0645\u062A\u0627\u0628\u0639\u0629 \u0627\u0644\u062F\u0631\u062F\u0634\u0629",historyLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u062F\u0631\u062F\u0634\u0627\u062A\u0643\u2026",historyTitle:"\u0633\u062C\u0644 \u0627\u0644\u062F\u0631\u062F\u0634\u0627\u062A",loadMoreConversations:"\u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u0632\u064A\u062F \u0645\u0646 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0627\u062A",language:"\u0627\u0644\u0644\u063A\u0629",launcherOpen:"\u0641\u062A\u062D \u0627\u0644\u062F\u0631\u062F\u0634\u0629",launcherLabel:"\u062A\u062D\u062F\u062B \u0645\u0639\u0646\u0627",micStart:"\u0628\u062F\u0621 \u0627\u0644\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0635\u0648\u062A\u064A",micStop:"\u0625\u064A\u0642\u0627\u0641 \u0627\u0644\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0635\u0648\u062A\u064A",micUnsupported:"\u0627\u0644\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0635\u0648\u062A\u064A \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645 \u0641\u064A \u0647\u0630\u0627 \u0627\u0644\u0645\u062A\u0635\u0641\u062D",moreActions:"\u0625\u062C\u0631\u0627\u0621\u0627\u062A \u0625\u0636\u0627\u0641\u064A\u0629",newConversation:"\u062F\u0631\u062F\u0634\u0629 \u062C\u062F\u064A\u062F\u0629",panelTitle:"\u0627\u0644\u062F\u0631\u062F\u0634\u0629",popOut:"\u0641\u062A\u062D \u0641\u064A \u0639\u0644\u0627\u0645\u0629 \u062A\u0628\u0648\u064A\u0628 \u062C\u062F\u064A\u062F\u0629",resizeHandle:"\u0627\u0633\u062D\u0628 \u0644\u062A\u063A\u064A\u064A\u0631 \u0627\u0644\u062D\u062C\u0645",scrollToBottom:"\u0627\u0644\u0627\u0646\u062A\u0642\u0627\u0644 \u0625\u0644\u0649 \u0627\u0644\u0623\u062D\u062F\u062B",send:"\u0625\u0631\u0633\u0627\u0644",soundOff:"\u0643\u062A\u0645 \u0627\u0644\u0635\u0648\u062A",soundOn:"\u062A\u0634\u063A\u064A\u0644 \u0627\u0644\u0635\u0648\u062A",startNewConversation:"\u0628\u062F\u0621 \u062F\u0631\u062F\u0634\u0629 \u062C\u062F\u064A\u062F\u0629",talkToOperator:"\u0627\u0644\u062A\u062D\u062F\u062B \u0625\u0644\u0649 \u0645\u0648\u0638\u0641",connectingOperator:"\u062C\u0627\u0631\u064A \u062A\u0648\u0635\u064A\u0644\u0643 \u0628\u0623\u062D\u062F \u0627\u0644\u0645\u0648\u0638\u0641\u064A\u0646\u2026",noOperatorAvailable:"\u0644\u0627 \u064A\u0648\u062C\u062F \u0645\u0648\u0638\u0641\u0648\u0646 \u0645\u062A\u0627\u062D\u0648\u0646 \u0627\u0644\u0622\u0646 \u2014 \u0627\u062A\u0631\u0643 \u0628\u064A\u0627\u0646\u0627\u062A\u0643 \u0648\u0633\u0646\u062A\u0648\u0627\u0635\u0644 \u0645\u0639\u0643.",chattingWithOperator:"\u0623\u0646\u062A \u062A\u062A\u062D\u062F\u062B \u0645\u0639 {operator}",cancelOperatorRequest:"\u0645\u062A\u0627\u0628\u0639\u0629 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629 \u0645\u0639 \u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A",stop:"\u0625\u064A\u0642\u0627\u0641",theme:"\u0627\u0644\u0645\u0638\u0647\u0631",themeAuto:"\u062A\u0644\u0642\u0627\u0626\u064A",themeDark:"\u062F\u0627\u0643\u0646",themeLight:"\u0641\u0627\u062A\u062D",textSize:"\u062D\u062C\u0645 \u0627\u0644\u0646\u0635",textSizeSmall:"\u0635\u063A\u064A\u0631",textSizeNormal:"\u0639\u0627\u062F\u064A",textSizeLarge:"\u0643\u0628\u064A\u0631",loading:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026",thinking:"\u064A\u0641\u0643\u0651\u0631\u2026",thoughts:"\u0627\u0644\u0623\u0641\u0643\u0627\u0631",toolResult:"\u0627\u0644\u0646\u062A\u064A\u062C\u0629",sources:"\u0627\u0644\u0645\u0635\u0627\u062F\u0631",feedbackUp:"\u0631\u062F \u062C\u064A\u062F",feedbackDown:"\u0631\u062F \u0633\u064A\u0626",feedbackThanks:"\u0634\u0643\u0631\u064B\u0627 \u0639\u0644\u0649 \u0645\u0644\u0627\u062D\u0638\u0627\u062A\u0643",copy:"\u0646\u0633\u062E",copied:"\u062A\u0645 \u0627\u0644\u0646\u0633\u062E",tabHome:"\u0627\u0644\u0631\u0626\u064A\u0633\u064A\u0629",tabConversations:"\u0627\u0644\u062F\u0631\u062F\u0634\u0627\u062A",tabHelp:"\u0627\u0644\u0645\u0633\u0627\u0639\u062F\u0629",tabNews:"\u0627\u0644\u0623\u062E\u0628\u0627\u0631",modulesEmpty:"\u0644\u0627 \u0634\u064A\u0621 \u0647\u0646\u0627 \u0628\u0639\u062F",moduleBack:"\u0631\u062C\u0648\u0639",contentLoading:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026",homeGreeting:"\u0643\u064A\u0641 \u064A\u0645\u0643\u0646\u0646\u0627 \u0645\u0633\u0627\u0639\u062F\u062A\u0643\u061F",homeGreetingNamed:"\u0645\u0631\u062D\u0628\u064B\u0627 {name} \u{1F44B}",homeGreetingLead:"\u0643\u064A\u0641 \u064A\u0645\u0643\u0646\u0646\u0627 \u0645\u0633\u0627\u0639\u062F\u062A\u0643\u061F",homeSearchPlaceholder:"\u0627\u0628\u062D\u062B \u0639\u0646 \u0645\u0633\u0627\u0639\u062F\u0629",homeContentTitle:"\u0645\u0642\u0627\u0644\u0627\u062A \u0634\u0627\u0626\u0639\u0629",homeStatus:"\u0627\u0644\u062D\u0627\u0644\u0629",helpTitle:"\u0627\u0644\u0645\u0633\u0627\u0639\u062F\u0629",helpSearchPlaceholder:"\u0627\u0628\u062D\u062B \u0639\u0646 \u0645\u0633\u0627\u0639\u062F\u0629",helpEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0645\u0642\u0627\u0644\u0627\u062A \u0645\u0633\u0627\u0639\u062F\u0629 \u0628\u0639\u062F",helpLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u0633\u0627\u0639\u062F\u0629\u2026",helpSearchEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0646\u062A\u0627\u0626\u062C",newsTitle:"\u0627\u0644\u0623\u062E\u0628\u0627\u0631",newsEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0623\u062E\u0628\u0627\u0631 \u0628\u0639\u062F",newsLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0623\u062E\u0628\u0627\u0631\u2026",newsBack:"\u0627\u0644\u0639\u0648\u062F\u0629 \u0625\u0644\u0649 \u0627\u0644\u0623\u062E\u0628\u0627\u0631",newsPublishedAt:"\u0646\u064F\u0634\u0631 \u0641\u064A {date}",formSubmit:"\u0625\u0631\u0633\u0627\u0644",formSkip:"\u0644\u0627\u062D\u0642\u064B\u0627",formSubmitted:"\u062A\u0645",formSkipped:"\u0644\u0627\u062D\u0642\u064B\u0627",formFillOut:"\u062A\u0639\u0628\u0626\u0629",formRequired:"\u0647\u0630\u0627 \u0627\u0644\u062D\u0642\u0644 \u0645\u0637\u0644\u0648\u0628",formInvalidEmail:"\u0623\u062F\u062E\u0644 \u0628\u0631\u064A\u062F\u064B\u0627 \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",formInvalidTel:"\u0623\u062F\u062E\u0644 \u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0635\u062D\u064A\u062D\u064B\u0627",formInvalidUrl:"\u0623\u062F\u062E\u0644 \u0631\u0627\u0628\u0637\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",formInvalidNumber:"\u0623\u062F\u062E\u0644 \u0631\u0642\u0645\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",formTooShort:"\u0642\u0635\u064A\u0631 \u062C\u062F\u064B\u0627 (\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u062F\u0646\u0649 {min} \u062D\u0631\u0641\u064B\u0627)",formTooLong:"\u0637\u0648\u064A\u0644 \u062C\u062F\u064B\u0627 (\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 {max} \u062D\u0631\u0641\u064B\u0627)",formNumberTooSmall:"\u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0642\u0644 \u0639\u0646 {min}",formNumberTooLarge:"\u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0632\u064A\u062F \u0639\u0646 {max}",formPatternMismatch:"\u064A\u0631\u062C\u0649 \u0645\u0637\u0627\u0628\u0642\u0629 \u0627\u0644\u0635\u064A\u063A\u0629 \u0627\u0644\u0645\u0637\u0644\u0648\u0628\u0629",formChooseAtLeast:"\u0627\u062E\u062A\u0631 {min} \u0639\u0644\u0649 \u0627\u0644\u0623\u0642\u0644",formChooseAtMost:"\u0627\u062E\u062A\u0631 {max} \u0639\u0644\u0649 \u0627\u0644\u0623\u0643\u062B\u0631",formOther:"\u0623\u062E\u0631\u0649",formOtherPlaceholder:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643\u2026",inputRequired:"\u0623\u0633\u0626\u0644\u0629 \u0644\u0643",inputBadge:"\u0623\u0633\u0626\u0644\u0629",inputAnswered:"\u062A\u0645\u062A \u0627\u0644\u0625\u062C\u0627\u0628\u0629",inputSkipped:"\u062A\u0645 \u0627\u0644\u062A\u062E\u0637\u064A",showOptions:"\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A",hideOptions:"\u0625\u062E\u0641\u0627\u0621 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A",qtypeText:"\u0625\u062C\u0627\u0628\u062A\u0643",qtypeEmail:"\u0639\u0646\u0648\u0627\u0646 \u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",qtypePhone:"\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062A\u0641",qtypeNumber:"\u0631\u0642\u0645",qtypeDate:"\u062A\u0627\u0631\u064A\u062E",qtypeChooseOne:"\u0627\u062E\u062A\u0631 \u0648\u0627\u062D\u062F\u064B\u0627",qtypeChooseAny:"\u0627\u062E\u062A\u0631 \u0623\u064A\u064B\u0627",qtypeBoolean:"\u0646\u0639\u0645 / \u0644\u0627",inputSubmit:"\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A",inputSubmitHint:"Enter \u0644\u0644\u0625\u0631\u0633\u0627\u0644 \xB7 Shift+Enter = \u0633\u0637\u0631 \u062C\u062F\u064A\u062F",inputSkip:"\u062A\u062E\u0637\u064D\u0651",confirmYes:"\u0646\u0639\u0645",confirmNo:"\u0644\u0627",approve:"\u0645\u0648\u0627\u0641\u0642\u0629",reject:"\u0631\u0641\u0636",approvalPrompt:"\u062A\u062A\u0637\u0644\u0628 {tool} \u0645\u0648\u0627\u0641\u0642\u062A\u0643 \u0644\u0644\u062A\u0646\u0641\u064A\u0630.",approvalBody:"\u0631\u0627\u062C\u0639 \u0645\u064F\u0639\u0637\u064A\u0627\u062A \u0627\u0644\u0623\u062F\u0627\u0629 \u0623\u0639\u0644\u0627\u0647 \u0648\u0642\u0631\u0651\u0631 \u0627\u0644\u0633\u0645\u0627\u062D \u0628\u0647\u0630\u0627 \u0627\u0644\u0625\u062C\u0631\u0627\u0621 \u0623\u0648 \u0631\u0641\u0636\u0647.",approvalYourResponse:"\u0631\u062F\u0651\u0643: {decision}",approvalEditHint:"\u064A\u0645\u0643\u0646\u0643 \u062A\u0639\u062F\u064A\u0644 \u0631\u062F\u0651\u0643 \u062D\u062A\u0649 \u062A\u0633\u062A\u0623\u0646\u0641 \u0647\u0630\u0647 \u0627\u0644\u062E\u0637\u0648\u0629.",approvalSubmitting:"\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0631\u062F. \u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0646\u0641\u064A\u0630\u2026",edit:"\u062A\u0639\u062F\u064A\u0644",toolParameters:"\u0627\u0644\u0645\u0639\u0637\u064A\u0627\u062A",statusAwaiting:"\u0628\u0627\u0646\u062A\u0638\u0627\u0631 \u0627\u0644\u0645\u0648\u0627\u0641\u0642\u0629",statusResponded:"\u062A\u0645 \u0627\u0644\u0625\u0631\u0633\u0627\u0644",statusRunning:"\u0642\u064A\u062F \u0627\u0644\u062A\u0646\u0641\u064A\u0630",statusCompleted:"\u0645\u0643\u062A\u0645\u0644",statusDenied:"\u0645\u0631\u0641\u0648\u0636",statusError:"\u062E\u0637\u0623",statusSuperseded:"\u062A\u0645 \u0627\u0644\u062A\u062E\u0637\u064A"},C_={attach:"Adjuntar archivos",attachmentMimeRejected:"Tipo de archivo no admitido",attachmentTooLarge:"El archivo es demasiado grande",attachmentTooMany:"Se alcanz\xF3 el l\xEDmite de adjuntos",conversationClosed:"Este chat est\xE1 cerrado",conversationLoading:"Cargando chat\u2026",loadPreviousMessages:"Cargar mensajes anteriores",close:"Cerrar",collapse:"Contraer",collapseSidebar:"Contraer la barra lateral",composerPlaceholder:"Escribe un mensaje\u2026",dateLastWeek:"\xDAltimos 7 d\xEDas",dateOlder:"Anteriores",dateToday:"Hoy",dateYesterday:"Ayer",dropZone:"Suelta los archivos para adjuntarlos",errorGeneric:"Algo sali\xF3 mal",errorRateLimited:"Demasiadas solicitudes: int\xE9ntalo de nuevo en un momento.",errorRetry:"Reintentar",expand:"Ampliar",expandSidebar:"Expandir la barra lateral",exitFullscreen:"Salir de pantalla completa",fullscreen:"Pantalla completa",history:"Historial",historyBack:"Volver al chat",historyEmpty:"A\xFAn no tienes chats",historyContinue:"Continuar el chat",historyLoading:"Cargando tus chats\u2026",historyTitle:"Historial de chats",loadMoreConversations:"Cargar m\xE1s conversaciones",language:"Idioma",launcherOpen:"Abrir el chat",launcherLabel:"Chatea con nosotros",micStart:"Iniciar entrada de voz",micStop:"Detener entrada de voz",micUnsupported:"Este navegador no admite la entrada de voz",moreActions:"M\xE1s acciones",newConversation:"Nuevo chat",panelTitle:"Chat",popOut:"Abrir en una pesta\xF1a nueva",resizeHandle:"Arrastra para cambiar el tama\xF1o",scrollToBottom:"Ir a lo m\xE1s reciente",send:"Enviar",soundOff:"Sonido desactivado",soundOn:"Sonido activado",startNewConversation:"Iniciar un chat nuevo",talkToOperator:"Hablar con un operador",connectingOperator:"Conect\xE1ndote con un operador\u2026",noOperatorAvailable:"Nadie est\xE1 disponible ahora \u2014 deja tus datos y te contactaremos.",chattingWithOperator:"Est\xE1s chateando con {operator}",cancelOperatorRequest:"Seguir con la IA",stop:"Detener",theme:"Tema",themeAuto:"Autom\xE1tico",themeDark:"Oscuro",themeLight:"Claro",textSize:"Tama\xF1o del texto",textSizeSmall:"Peque\xF1o",textSizeNormal:"Normal",textSizeLarge:"Grande",loading:"Cargando\u2026",thinking:"Pensando\u2026",thoughts:"Razonamiento",toolResult:"Resultado",sources:"Fuentes",feedbackUp:"Buena respuesta",feedbackDown:"Mala respuesta",feedbackThanks:"Gracias por tu opini\xF3n",copy:"Copiar",copied:"Copiado",tabHome:"Inicio",tabConversations:"Chats",tabHelp:"Ayuda",tabNews:"Novedades",modulesEmpty:"A\xFAn no hay nada aqu\xED",moduleBack:"Atr\xE1s",contentLoading:"Cargando\u2026",homeGreeting:"\xBFC\xF3mo podemos ayudarte?",homeGreetingNamed:"Hola, {name} \u{1F44B}",homeGreetingLead:"\xBFC\xF3mo podemos ayudarte?",homeSearchPlaceholder:"Buscar ayuda",homeContentTitle:"Art\xEDculos populares",homeStatus:"Estado",helpTitle:"Ayuda",helpSearchPlaceholder:"Buscar ayuda",helpEmpty:"A\xFAn no hay art\xEDculos de ayuda",helpLoading:"Cargando la ayuda\u2026",helpSearchEmpty:"No se encontraron resultados",newsTitle:"Novedades",newsEmpty:"A\xFAn no hay novedades",newsLoading:"Cargando novedades\u2026",newsBack:"Volver a novedades",newsPublishedAt:"Publicado el {date}",formSubmit:"Enviar",formSkip:"Quiz\xE1 m\xE1s tarde",formSubmitted:"Completado",formSkipped:"Quiz\xE1 m\xE1s tarde",formFillOut:"Completar",formRequired:"Este campo es obligatorio",formInvalidEmail:"Introduce un correo electr\xF3nico v\xE1lido",formInvalidTel:"Introduce un n\xFAmero de tel\xE9fono v\xE1lido",formInvalidUrl:"Introduce una URL v\xE1lida",formInvalidNumber:"Introduce un n\xFAmero v\xE1lido",formTooShort:"Demasiado corto (m\xEDn. {min} caracteres)",formTooLong:"Demasiado largo (m\xE1x. {max} caracteres)",formNumberTooSmall:"Debe ser al menos {min}",formNumberTooLarge:"Debe ser como m\xE1ximo {max}",formPatternMismatch:"Respeta el formato solicitado",formChooseAtLeast:"Elige al menos {min}",formChooseAtMost:"Elige como m\xE1ximo {max}",formOther:"Otro",formOtherPlaceholder:"Escribe tu respuesta\u2026",inputRequired:"Preguntas para ti",inputBadge:"Preguntas",inputAnswered:"Respondido",inputSkipped:"Omitido",showOptions:"Mostrar opciones",hideOptions:"Ocultar opciones",qtypeText:"Tu respuesta",qtypeEmail:"Correo electr\xF3nico",qtypePhone:"N\xFAmero de tel\xE9fono",qtypeNumber:"N\xFAmero",qtypeDate:"Fecha",qtypeChooseOne:"Elige una",qtypeChooseAny:"Elige varias",qtypeBoolean:"S\xED / No",inputSubmit:"Enviar respuestas",inputSubmitHint:"Enter para enviar \xB7 May\xFAs+Enter = nueva l\xEDnea",inputSkip:"Omitir",confirmYes:"S\xED",confirmNo:"No",approve:"Aprobar",reject:"Rechazar",approvalPrompt:"{tool} requiere tu aprobaci\xF3n para ejecutarse.",approvalBody:"Revisa los par\xE1metros de arriba y decide si permites esta acci\xF3n.",approvalYourResponse:"Tu respuesta: {decision}",approvalEditHint:"Puedes cambiar tu respuesta hasta que este paso contin\xFAe.",approvalSubmitting:"Respuesta enviada. Procesando\u2026",edit:"Editar",toolParameters:"Par\xE1metros",statusAwaiting:"Esperando aprobaci\xF3n",statusResponded:"Enviado",statusRunning:"En curso",statusCompleted:"Completado",statusDenied:"Denegado",statusError:"Error",statusSuperseded:"Omitido"},R_={attach:"\u05E6\u05D9\u05E8\u05D5\u05E3 \u05E7\u05D1\u05E6\u05D9\u05DD",attachmentMimeRejected:"\u05E1\u05D5\u05D2 \u05D4\u05E7\u05D5\u05D1\u05E5 \u05D0\u05D9\u05E0\u05D5 \u05E0\u05EA\u05DE\u05DA",attachmentTooLarge:"\u05D4\u05E7\u05D5\u05D1\u05E5 \u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9",attachmentTooMany:"\u05D4\u05D2\u05E2\u05EA \u05DC\u05DE\u05E1\u05E4\u05E8 \u05D4\u05DE\u05E8\u05D1\u05D9 \u05E9\u05DC \u05E7\u05D1\u05E6\u05D9\u05DD \u05DE\u05E6\u05D5\u05E8\u05E4\u05D9\u05DD",conversationClosed:"\u05D4\u05E6\u05F3\u05D0\u05D8 \u05D4\u05D6\u05D4 \u05E0\u05E1\u05D2\u05E8",conversationLoading:"\u05D8\u05D5\u05E2\u05DF \u05E6\u05F3\u05D0\u05D8\u2026",loadPreviousMessages:"\u05D8\u05E2\u05D9\u05E0\u05EA \u05D4\u05D5\u05D3\u05E2\u05D5\u05EA \u05E7\u05D5\u05D3\u05DE\u05D5\u05EA",close:"\u05E1\u05D2\u05D9\u05E8\u05D4",collapse:"\u05DB\u05D9\u05D5\u05D5\u05E5",collapseSidebar:"\u05DB\u05D9\u05D5\u05D5\u05E5 \u05E1\u05E8\u05D2\u05DC \u05D4\u05E6\u05D3",composerPlaceholder:"\u05DB\u05EA\u05D5\u05D1 \u05D4\u05D5\u05D3\u05E2\u05D4\u2026",dateLastWeek:"7 \u05D4\u05D9\u05DE\u05D9\u05DD \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D9\u05DD",dateOlder:"\u05D9\u05E9\u05DF \u05D9\u05D5\u05EA\u05E8",dateToday:"\u05D4\u05D9\u05D5\u05DD",dateYesterday:"\u05D0\u05EA\u05DE\u05D5\u05DC",dropZone:"\u05E9\u05D7\u05E8\u05E8 \u05E7\u05D1\u05E6\u05D9\u05DD \u05DB\u05D3\u05D9 \u05DC\u05E6\u05E8\u05E3",errorGeneric:"\u05DE\u05E9\u05D4\u05D5 \u05D4\u05E9\u05EA\u05D1\u05E9",errorRateLimited:"\u05D9\u05D5\u05EA\u05E8 \u05DE\u05D3\u05D9 \u05D1\u05E7\u05E9\u05D5\u05EA \u2014 \u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1 \u05D1\u05E2\u05D5\u05D3 \u05E8\u05D2\u05E2.",errorRetry:"\u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1",expand:"\u05D4\u05E8\u05D7\u05D1\u05D4",expandSidebar:"\u05D4\u05E8\u05D7\u05D1\u05EA \u05E1\u05E8\u05D2\u05DC \u05D4\u05E6\u05D3",exitFullscreen:"\u05D9\u05E6\u05D9\u05D0\u05D4 \u05DE\u05DE\u05E1\u05DA \u05DE\u05DC\u05D0",fullscreen:"\u05DE\u05E1\u05DA \u05DE\u05DC\u05D0",history:"\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D4",historyBack:"\u05D7\u05D6\u05E8\u05D4 \u05DC\u05E6\u05F3\u05D0\u05D8",historyEmpty:"\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05E6\u05F3\u05D0\u05D8\u05D9\u05DD \u05E7\u05D5\u05D3\u05DE\u05D9\u05DD",historyContinue:"\u05D4\u05DE\u05E9\u05DA \u05E6\u05F3\u05D0\u05D8",historyLoading:"\u05D8\u05D5\u05E2\u05DF \u05D0\u05EA \u05D4\u05E6\u05F3\u05D0\u05D8\u05D9\u05DD \u05E9\u05DC\u05DA\u2026",historyTitle:"\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05E6\u05F3\u05D0\u05D8\u05D9\u05DD",loadMoreConversations:"\u05D8\u05E2\u05D9\u05E0\u05EA \u05E9\u05D9\u05D7\u05D5\u05EA \u05E0\u05D5\u05E1\u05E4\u05D5\u05EA",language:"\u05E9\u05E4\u05D4",launcherOpen:"\u05E4\u05EA\u05D9\u05D7\u05EA \u05E6\u05F3\u05D0\u05D8",launcherLabel:"\u05D3\u05D1\u05E8\u05D5 \u05D0\u05D9\u05EA\u05E0\u05D5",micStart:"\u05D4\u05EA\u05D7\u05DC\u05EA \u05E7\u05DC\u05D8 \u05E7\u05D5\u05DC\u05D9",micStop:"\u05E2\u05E6\u05D9\u05E8\u05EA \u05E7\u05DC\u05D8 \u05E7\u05D5\u05DC\u05D9",micUnsupported:"\u05E7\u05DC\u05D8 \u05E7\u05D5\u05DC\u05D9 \u05D0\u05D9\u05E0\u05D5 \u05E0\u05EA\u05DE\u05DA \u05D1\u05D3\u05E4\u05D3\u05E4\u05DF \u05D6\u05D4",moreActions:"\u05E4\u05E2\u05D5\u05DC\u05D5\u05EA \u05E0\u05D5\u05E1\u05E4\u05D5\u05EA",newConversation:"\u05E6\u05F3\u05D0\u05D8 \u05D7\u05D3\u05E9",panelTitle:"\u05E6\u05F3\u05D0\u05D8",popOut:"\u05E4\u05EA\u05D9\u05D7\u05D4 \u05D1\u05DB\u05E8\u05D8\u05D9\u05E1\u05D9\u05D9\u05D4 \u05D7\u05D3\u05E9\u05D4",resizeHandle:"\u05D2\u05E8\u05D5\u05E8 \u05DC\u05E9\u05D9\u05E0\u05D5\u05D9 \u05D4\u05D2\u05D5\u05D3\u05DC",scrollToBottom:"\u05DE\u05E2\u05D1\u05E8 \u05DC\u05D7\u05D3\u05E9 \u05D1\u05D9\u05D5\u05EA\u05E8",send:"\u05E9\u05DC\u05D9\u05D7\u05D4",soundOff:"\u05D4\u05E9\u05EA\u05E7\u05EA \u05D4\u05E6\u05DC\u05D9\u05DC",soundOn:"\u05D4\u05E4\u05E2\u05DC\u05EA \u05D4\u05E6\u05DC\u05D9\u05DC",startNewConversation:"\u05D4\u05EA\u05D7\u05DC\u05EA \u05E6\u05F3\u05D0\u05D8 \u05D7\u05D3\u05E9",talkToOperator:"\u05D3\u05D1\u05E8 \u05E2\u05DD \u05E0\u05E6\u05D9\u05D2",connectingOperator:"\u05DE\u05D7\u05D1\u05E8 \u05D0\u05D5\u05EA\u05DA \u05DC\u05E0\u05E6\u05D9\u05D2\u2026",noOperatorAvailable:"\u05D0\u05D9\u05DF \u05E0\u05E6\u05D9\u05D2\u05D9\u05DD \u05D6\u05DE\u05D9\u05E0\u05D9\u05DD \u05DB\u05E2\u05EA \u2014 \u05D4\u05E9\u05D0\u05E8 \u05D0\u05EA \u05D4\u05E4\u05E8\u05D8\u05D9\u05DD \u05E9\u05DC\u05DA \u05D5\u05E0\u05D7\u05D6\u05D5\u05E8 \u05D0\u05DC\u05D9\u05DA.",chattingWithOperator:"\u05D0\u05EA\u05D4 \u05DE\u05E6\u05F3\u05D5\u05D8\u05D8 \u05E2\u05DD {operator}",cancelOperatorRequest:"\u05D4\u05DE\u05E9\u05DA \u05DC\u05E9\u05D5\u05D7\u05D7 \u05E2\u05DD \u05D4-AI",stop:"\u05E2\u05E6\u05D9\u05E8\u05D4",theme:"\u05E2\u05E8\u05DB\u05EA \u05E0\u05D5\u05E9\u05D0",themeAuto:"\u05D0\u05D5\u05D8\u05D5\u05DE\u05D8\u05D9",themeDark:"\u05DB\u05D4\u05D4",themeLight:"\u05D1\u05D4\u05D9\u05E8",textSize:"\u05D2\u05D5\u05D3\u05DC \u05D8\u05E7\u05E1\u05D8",textSizeSmall:"\u05E7\u05D8\u05DF",textSizeNormal:"\u05E8\u05D2\u05D9\u05DC",textSizeLarge:"\u05D2\u05D3\u05D5\u05DC",loading:"\u05D8\u05D5\u05E2\u05DF\u2026",thinking:"\u05D7\u05D5\u05E9\u05D1\u2026",thoughts:"\u05DE\u05D7\u05E9\u05D1\u05D5\u05EA",toolResult:"\u05EA\u05D5\u05E6\u05D0\u05D4",sources:"\u05DE\u05E7\u05D5\u05E8\u05D5\u05EA",feedbackUp:"\u05EA\u05E9\u05D5\u05D1\u05D4 \u05D8\u05D5\u05D1\u05D4",feedbackDown:"\u05EA\u05E9\u05D5\u05D1\u05D4 \u05D2\u05E8\u05D5\u05E2\u05D4",feedbackThanks:"\u05EA\u05D5\u05D3\u05D4 \u05E2\u05DC \u05D4\u05DE\u05E9\u05D5\u05D1",copy:"\u05D4\u05E2\u05EA\u05E7",copied:"\u05D4\u05D5\u05E2\u05EA\u05E7",tabHome:"\u05D1\u05D9\u05EA",tabConversations:"\u05E6\u05F3\u05D0\u05D8\u05D9\u05DD",tabHelp:"\u05E2\u05D6\u05E8\u05D4",tabNews:"\u05D7\u05D3\u05E9\u05D5\u05EA",modulesEmpty:"\u05D0\u05D9\u05DF \u05DB\u05D0\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05DB\u05DC\u05D5\u05DD",moduleBack:"\u05D7\u05D6\u05E8\u05D4",contentLoading:"\u05D8\u05D5\u05E2\u05DF\u2026",homeGreeting:"\u05DB\u05D9\u05E6\u05D3 \u05E0\u05D5\u05DB\u05DC \u05DC\u05E2\u05D6\u05D5\u05E8?",homeGreetingNamed:"\u05E9\u05DC\u05D5\u05DD {name} \u{1F44B}",homeGreetingLead:"\u05DB\u05D9\u05E6\u05D3 \u05E0\u05D5\u05DB\u05DC \u05DC\u05E2\u05D6\u05D5\u05E8?",homeSearchPlaceholder:"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05E2\u05D6\u05E8\u05D4",homeContentTitle:"\u05DE\u05D0\u05DE\u05E8\u05D9\u05DD \u05E4\u05D5\u05E4\u05D5\u05DC\u05E8\u05D9\u05D9\u05DD",homeStatus:"\u05E1\u05D8\u05D8\u05D5\u05E1",helpTitle:"\u05E2\u05D6\u05E8\u05D4",helpSearchPlaceholder:"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05E2\u05D6\u05E8\u05D4",helpEmpty:"\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05DE\u05D0\u05DE\u05E8\u05D9 \u05E2\u05D6\u05E8\u05D4",helpLoading:"\u05D8\u05D5\u05E2\u05DF \u05E2\u05D6\u05E8\u05D4\u2026",helpSearchEmpty:"\u05DC\u05D0 \u05E0\u05DE\u05E6\u05D0\u05D5 \u05EA\u05D5\u05E6\u05D0\u05D5\u05EA",newsTitle:"\u05D7\u05D3\u05E9\u05D5\u05EA",newsEmpty:"\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05D7\u05D3\u05E9\u05D5\u05EA",newsLoading:"\u05D8\u05D5\u05E2\u05DF \u05D7\u05D3\u05E9\u05D5\u05EA\u2026",newsBack:"\u05D7\u05D6\u05E8\u05D4 \u05DC\u05D7\u05D3\u05E9\u05D5\u05EA",newsPublishedAt:"\u05E4\u05D5\u05E8\u05E1\u05DD \u05D1-{date}",formSubmit:"\u05E9\u05DC\u05D9\u05D7\u05D4",formSkip:"\u05D0\u05D7\u05E8 \u05DB\u05DA",formSubmitted:"\u05E0\u05E9\u05DC\u05D7",formSkipped:"\u05D3\u05D5\u05DC\u05D2",formFillOut:"\u05DE\u05D9\u05DC\u05D5\u05D9",formRequired:"\u05E9\u05D3\u05D4 \u05D7\u05D5\u05D1\u05D4",formInvalidEmail:"\u05D4\u05D6\u05DF \u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC \u05EA\u05E7\u05D9\u05E0\u05D4",formInvalidTel:"\u05D4\u05D6\u05DF \u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF \u05EA\u05E7\u05D9\u05DF",formInvalidUrl:"\u05D4\u05D6\u05DF \u05DB\u05EA\u05D5\u05D1\u05EA URL \u05EA\u05E7\u05D9\u05E0\u05D4",formInvalidNumber:"\u05D4\u05D6\u05DF \u05DE\u05E1\u05E4\u05E8 \u05EA\u05E7\u05D9\u05DF",formTooShort:"\u05E7\u05E6\u05E8 \u05DE\u05D3\u05D9 (\u05DC\u05E4\u05D7\u05D5\u05EA {min} \u05EA\u05D5\u05D5\u05D9\u05DD)",formTooLong:"\u05D0\u05E8\u05D5\u05DA \u05DE\u05D3\u05D9 (\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max} \u05EA\u05D5\u05D5\u05D9\u05DD)",formNumberTooSmall:"\u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DC\u05E4\u05D7\u05D5\u05EA {min}",formNumberTooLarge:"\u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max}",formPatternMismatch:"\u05D4\u05EA\u05D0\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA \u05D4\u05E0\u05D3\u05E8\u05E9\u05EA",formChooseAtLeast:"\u05D1\u05D7\u05E8 \u05DC\u05E4\u05D7\u05D5\u05EA {min}",formChooseAtMost:"\u05D1\u05D7\u05E8 \u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max}",formOther:"\u05D0\u05D7\u05E8",formOtherPlaceholder:"\u05DB\u05EA\u05D5\u05D1 \u05D0\u05EA \u05EA\u05E9\u05D5\u05D1\u05EA\u05DA\u2026",inputRequired:"\u05E9\u05D0\u05DC\u05D5\u05EA \u05E2\u05D1\u05D5\u05E8\u05DA",inputBadge:"\u05E9\u05D0\u05DC\u05D5\u05EA",inputAnswered:"\u05E0\u05E2\u05E0\u05D4",inputSkipped:"\u05D3\u05D5\u05DC\u05D2",showOptions:"\u05D4\u05E6\u05D2 \u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA",hideOptions:"\u05D4\u05E1\u05EA\u05E8 \u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA",qtypeText:"\u05D4\u05EA\u05E9\u05D5\u05D1\u05D4 \u05E9\u05DC\u05DA",qtypeEmail:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",qtypePhone:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF",qtypeNumber:"\u05DE\u05E1\u05E4\u05E8",qtypeDate:"\u05EA\u05D0\u05E8\u05D9\u05DA",qtypeChooseOne:"\u05D1\u05D7\u05E8 \u05D0\u05D7\u05EA",qtypeChooseAny:"\u05D1\u05D7\u05E8 \u05DB\u05DE\u05D4",qtypeBoolean:"\u05DB\u05DF / \u05DC\u05D0",inputSubmit:"\u05E9\u05DC\u05D9\u05D7\u05EA \u05EA\u05E9\u05D5\u05D1\u05D5\u05EA",inputSubmitHint:"Enter \u05DC\u05E9\u05DC\u05D9\u05D7\u05D4 \xB7 Shift+Enter = \u05E9\u05D5\u05E8\u05D4 \u05D7\u05D3\u05E9\u05D4",inputSkip:"\u05D3\u05D9\u05DC\u05D5\u05D2",confirmYes:"\u05DB\u05DF",confirmNo:"\u05DC\u05D0",approve:"\u05D0\u05D9\u05E9\u05D5\u05E8",reject:"\u05D3\u05D7\u05D9\u05D9\u05D4",approvalPrompt:"\u05D4\u05DB\u05DC\u05D9 {tool} \u05D3\u05D5\u05E8\u05E9 \u05D0\u05EA \u05D0\u05D9\u05E9\u05D5\u05E8\u05DA \u05DB\u05D3\u05D9 \u05DC\u05E4\u05E2\u05D5\u05DC.",approvalBody:"\u05D1\u05D3\u05D5\u05E7 \u05D0\u05EA \u05E4\u05E8\u05DE\u05D8\u05E8\u05D9 \u05D4\u05DB\u05DC\u05D9 \u05E9\u05DC\u05DE\u05E2\u05DC\u05D4 \u05D5\u05D4\u05D7\u05DC\u05D8 \u05D0\u05DD \u05DC\u05D0\u05E9\u05E8 \u05E4\u05E2\u05D5\u05DC\u05D4 \u05D6\u05D5.",approvalYourResponse:"\u05D4\u05EA\u05D2\u05D5\u05D1\u05D4 \u05E9\u05DC\u05DA: {decision}",approvalEditHint:"\u05E0\u05D9\u05EA\u05DF \u05DC\u05E2\u05E8\u05D5\u05DA \u05D0\u05EA \u05EA\u05D2\u05D5\u05D1\u05EA\u05DA \u05E2\u05D3 \u05E9\u05D4\u05E9\u05DC\u05D1 \u05D4\u05D6\u05D4 \u05D9\u05EA\u05D7\u05D3\u05E9.",approvalSubmitting:"\u05D4\u05EA\u05D2\u05D5\u05D1\u05D4 \u05E0\u05E9\u05DC\u05D7\u05D4. \u05DE\u05D1\u05E6\u05E2\u2026",edit:"\u05E2\u05E8\u05D9\u05DB\u05D4",toolParameters:"\u05E4\u05E8\u05DE\u05D8\u05E8\u05D9\u05DD",statusAwaiting:"\u05DE\u05DE\u05EA\u05D9\u05DF \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8",statusResponded:"\u05E0\u05E9\u05DC\u05D7",statusRunning:"\u05E4\u05D5\u05E2\u05DC",statusCompleted:"\u05D4\u05D5\u05E9\u05DC\u05DD",statusDenied:"\u05E0\u05D3\u05D7\u05D4",statusError:"\u05E9\u05D2\u05D9\u05D0\u05D4",statusSuperseded:"\u05D3\u05D5\u05DC\u05D2"},T_={en:Qi,fr:k_,ar:w_,es:C_,he:R_};function Eo(e,t){let n=Zi(e),o=Ao(t),r=n==="en"?{}:T_[n]??{},a=o?t[n]??{}:t??{},s=o?t.en??{}:{};return{...Qi,...r,...s,...a}}function Zi(e){return(e.split("-")[0]??"en").toLowerCase()}var I_=new Set(["ar","he","iw","fa","ur","ps","sd","ug","yi","dv","ckb","ks","nqo","prs","syr"]);function es(e){return I_.has(Zi(e))}function Qe(e,t){return e[t]??t}function Ao(e){if(!e)return!1;for(let t of Object.values(e))if(t&&typeof t=="object")return!0;return!1}function ts(e,t){if(!(!e?.length||!t))return e.find(n=>n.locale===t)}function ns(e,t){let{translations:n,defaultLocale:o,...r}=e,a=ts(n,t);return a?{...r,title:a.title??r.title,description:a.description??r.description,content:a.content??r.content}:r}function os(e,t){let{translations:n,defaultLocale:o,...r}=e,a=ts(n,t);if(!a)return r;let s=new Map((a.fields??[]).map(c=>[c.name,c])),l=r.fields.map(c=>{let d=s.get(c.name);if(!d)return c;let p=new Map((d.options??[]).map(_=>[_.value,_]));return{...c,label:d.label??c.label,placeholder:d.placeholder??c.placeholder,validationHint:d.validationHint??c.validationHint,options:c.options?.map(_=>{let u=p.get(_.value);return u?{..._,label:u.label??_.label,description:u.description??_.description}:_})}});return{...r,title:a.title??r.title,description:a.description??r.description,submitLabel:a.submitLabel??r.submitLabel,fields:l}}var da=class{get(t){try{return localStorage.getItem(t)}catch{return null}}set(t,n){try{localStorage.setItem(t,n)}catch{}}remove(t){try{localStorage.removeItem(t)}catch{}}},Mo=new da;var pa=["off","error","warn","info","debug","trace"],fa=R.cssPrefix,rs=`${fa}.debug`,E_=`__${R.global}_DEBUG__`,A_=`${fa}-debug`,Lo=2,ua=null;function M_(){if(typeof window>"u")return 2;try{let e=new URLSearchParams(window.location.search).get(A_);if(e!==null){let t=_a(e);if(t>=0)return t}}catch{}try{let e=window.localStorage?.getItem(rs);if(e){let t=_a(e);if(t>=0)return t}}catch{}return Reflect.get(window,E_)?4:2}function _a(e){if(e===!0||e==="1"||e==="true")return 4;if(e===!1||e==="0"||e==="false"||e==="off")return 0;if(typeof e=="number")return Math.max(0,Math.min(5,Math.floor(e)));if(typeof e=="string"){let t=pa.indexOf(e);if(t>=0)return t}return-1}function Oo(e){let t=_a(e);if(!(t<0)){Lo=t;try{window.localStorage?.setItem(rs,pa[t])}catch{}}}function Wn(){return pa[Lo]}Lo=M_();function as(e){let t=`[${fa}:${e}]`,n=(o,r,a)=>(s,l)=>{if(!(Lo<o)&&(l===void 0?console[r](t,s):console[r](t,s,l),ua))try{ua({level:a,scope:e,message:s,payload:l})}catch{}};return{error:n(1,"error","error"),warn:n(2,"warn","warn"),info:n(3,"info","info"),debug:n(4,"debug","debug"),trace:n(5,"debug","trace"),scope:o=>as(`${e}:${o}`)}}var ee=as("core");function Kn(e){ua=e}var Yt=ee.scope("context"),L_=new Set(["visitorId","conversationId","conversationId","jwt","token","authorization","password"]),is=50,ma=1024,O_=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function ga(e){return ss(e,"userContext",!0)}function va(e){return ss(e,"pageContext",!1)}function ss(e,t,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){Yt.warn(`ignored ${t} \u2014 expected an object`,{type:Array.isArray(e)?"array":typeof e});return}let o={},r=0;for(let[a,s]of Object.entries(e)){if(L_.has(a)){Yt.warn(`dropped reserved ${t} key "${a}" \u2014 managed by the widget, not host-settable`);continue}if(s==null)continue;if(r>=is){Yt.warn(`${t} truncated at ${is} keys \u2014 dropped "${a}"`);continue}let l=N_(t,a,s);l!==void 0&&(o[a]=l,r++)}return n&&typeof o.email=="string"&&!O_.test(o.email)&&(Yt.warn(`dropped malformed ${t}.email "${o.email}"`),delete o.email),Object.keys(o).length>0?o:void 0}function N_(e,t,n){if(typeof n=="boolean")return n;if(typeof n=="number"){if(!Number.isFinite(n)){Yt.warn(`dropped non-finite ${e}.${t}`);return}return n}if(typeof n=="string"){let o=n.trim();return o===""?void 0:o.length>ma?(Yt.warn(`truncated ${e}.${t} to ${ma} chars`),o.slice(0,ma)):o}Yt.warn(`dropped ${e}.${t} \u2014 only string/number/boolean values are allowed`,{type:typeof n})}var No={maxBytes:10485760,maxCount:10,accept:"*/*"},ls={voice:"local"},cs={list:[],byTrigger:{}},ha={enabled:!0,sampleRate:1},Do={upload:"/pai/upload-file",transcribe:"/pai/transcribe-audio",submitForm:"/pai/submit-form"},bn={variant:"circle",size:"md",label:void 0,icon:"chat",hidden:!1},ds={floating:["theme","textSize","history","close","clear","expand","fullscreen","popOut","sound","language"],inline:["theme","textSize","history","close","clear","fullscreen","popOut","sound","language"],standalone:["theme","textSize","history","clear","sound","language"],page:["theme","textSize","history","clear","sound","language"],modal:["theme","textSize","history","close","clear","fullscreen","popOut","sound","language"],drawer:["theme","textSize","history","close","clear","fullscreen","popOut","sound","language"]},ba={enabled:!0,volume:.3,events:void 0},us={enabled:!0,events:void 0},_s=[{label:"tabConversations",layout:"chat"}];function Bt(e){let t=e!==null&&typeof e=="object"?e:{},n=t.presentation??{},o=t.behavior??{},r=t.i18n??{},a=t.feedback??{},s=t.footer??{},l=t.header??{},{themeMode:c,themeOverrides:d}=D_(t.theme),p=n.mode??"floating",_=$_(r.defaultLocale),u=r.availableLocales??[r.locale??_],f=yn(r.locale??_,u,_),m=(t.baseUrl??R.defaultBaseUrl).replace(/\/$/,""),g=(t.agentApiBaseUrl??`${m}/api/agent`).replace(/\/$/,""),y=(t.dataApiBaseUrl??`${m}/api/data`).replace(/\/$/,"");return{widgetId:t.widgetId??"default",publicKey:t.publicKey,aiAgentDeploymentId:t.aiAgentDeploymentId,baseUrl:m,agentApiBaseUrl:g,dataApiBaseUrl:y,userContext:ga(t.userContext),pageContext:va(t.pageContext),position:n.position??"bottom-right",themeMode:c,textSize:"normal",themeOverrides:d,mode:p,iframe:n.iframe??!1,responseMode:o.responseMode??"streaming",showReasoning:o.showReasoning??!1,showToolCalls:o.showToolCalls??!1,showSources:o.showSources??!1,enableMessageFeedback:!(o.disableMessageFeedback??!1),autoSendSuggestions:o.autoSendSuggestions??!1,popOutUrl:o.popOutUrl,features:{voice:t.features?.voice??ls.voice,fileUpload:!(t.features?.disableFileUpload??!1),humanInLoop:!(t.features?.disableHumanInLoop??!1),operatorRequest:t.features?.enableOperatorRequest===!0},forms:Gn(t.forms,f),endpoints:{upload:t.endpoints?.upload??Do.upload,transcribe:t.endpoints?.transcribe??Do.transcribe,submitForm:t.endpoints?.submitForm??Do.submitForm},attachments:{accept:t.composer?.attachments?.accept??No.accept,maxBytes:t.composer?.attachments?.maxBytes??No.maxBytes,maxCount:t.composer?.attachments?.maxCount??No.maxCount},locale:f,defaultLocale:_,availableLocales:u,startMinimized:o.startMinimized??!0,actions:F_(p,l.actions),size:n.size??{},launcher:K_(t.launcher),sound:B_(a.sound),haptics:H_(a.haptics),strings:Eo(f,r.strings),stringsOverride:r.strings,composerDisclaimer:s.composerDisclaimer??"",poweredBy:z_(s.poweredBy),composer:q_(t.composer),modules:V_(t.modules),tracking:U_(t.tracking,y),storage:t.storage??Mo,onMessage:t.onMessage,onOpen:t.onOpen,onClose:t.onClose,onError:t.onError}}function D_(e){return typeof e=="string"?{themeMode:e,themeOverrides:{}}:e&&typeof e=="object"?{themeMode:"auto",themeOverrides:e}:{themeMode:"auto",themeOverrides:{}}}function $_(e){return e&&e!=="auto"?e:typeof navigator<"u"&&navigator.language?navigator.language:"en"}function yn(e,t,n){return t.length<=1||t.includes(e)?e:t.includes(n)?n:t[0]??e}function F_(e,t){return t??ds[e]}function B_(e){return{enabled:e?.enabled??ba.enabled,volume:e?.volume??ba.volume,events:e?.events}}function H_(e){return{enabled:e?.enabled??us.enabled,events:e?.events}}function U_(e,t){let n=e?.sampleRate??ha.sampleRate;return{enabled:e?.enabled??ha.enabled,endpoint:e?.endpoint??`${t}/pai/elements-px.gif`,sampleRate:Math.min(1,Math.max(0,Number.isFinite(n)?n:1)),token:e?.token}}function z_(e){let n={...{text:`Powered by ${R.displayName}`,href:R.siteUrl},...e};return!!(n.text||n.logoUrl)?n:null}function q_(e){let t=e?.sendButton;return{sendButton:{shape:t?.shape??"circle",icon:t?.icon??"arrowUp",variant:t?.variant??"filled"}}}function V_(e){let t=e===void 0?_s:e,n=new Set,o=[];for(let a of t.slice(0,4)){if(!a?.label||!a?.layout)continue;let s=a.contentTags?.filter(Boolean),l=a.id??s?.[0]??a.layout;for(;n.has(l);)l=`${l}-${o.length}`;n.add(l);let c={id:l,label:a.label,layout:a.layout};s&&s.length>0&&(c.contentTags=s),a.layout==="home"&&(c.brandName=a.brandName,c.greetingText=a.greetingText,c.showGreeting=!(a.hideGreeting??!1),c.showSearchBar=!(a.hideSearchBar??!1),c.showRecentConversations=!(a.hideRecentConversations??!1),a.userAvatars&&a.userAvatars.length>0&&(c.userAvatars=a.userAvatars),a.status&&(c.status=a.status),c.contentBlockTitle=a.contentBlockTitle),o.push(c)}let r=Object.fromEntries(o.map(a=>[a.id,a]));return{list:o,byId:r}}function Gn(e,t){var a;if(!e?.length)return cs;let n=[],o=new Set;for(let s of e){if(!s?.id||o.has(s.id))continue;let l=os(s,t),c=(l.fields??[]).filter(p=>!!(p&&p.name&&p.label&&p.type)),d=(Array.isArray(l.on)?l.on:[l.on]).map(W_).filter(p=>p!==null);c.length===0||d.length===0||(o.add(l.id),n.push({id:l.id,triggers:d,when:l.when,fields:c,title:l.title,description:l.description,submitLabel:l.submitLabel,skippable:l.skippable??!1,frequency:l.frequency??"once",mirrorToContext:l.mirrorToContext??!0,reopenable:l.reopenable??!0,reviewable:l.reviewable??!0}))}let r={};for(let s of n)for(let l of s.triggers)(r[a=l.kind]??(r[a]=[])).push(s);return{list:n,byTrigger:r}}function W_(e){if(typeof e!="string")return null;if(e==="pre-chat"||e==="conversation-closed"||e==="panel-close"||e==="manual")return{kind:e};let[t,n]=e.split(":",2);if(t==="after-messages"){let o=Number(n);return Number.isFinite(o)&&o>0?{kind:"after-messages",param:o}:null}if(t==="idle"){let o=Number(n);return Number.isFinite(o)&&o>0?{kind:"idle",param:o}:null}return t==="page-area"&&n?{kind:"page-area",param:n}:null}function K_(e){let t=e?.callout?.text?{shape:"pill",position:"auto",delayMs:1200,autoDismissMs:0,animated:!0,persistent:!0,...e.callout}:null;return{variant:e?.variant??bn.variant,size:e?.size??bn.size,label:e?.label??bn.label,icon:e?.icon??bn.icon,hidden:e?.hidden??bn.hidden,callout:t}}function ya(e,t,n,o){let r=yn(t,e.availableLocales,e.defaultLocale);if(r===e.locale&&n===e.themeMode&&o===e.textSize)return e;let a={...e};return r!==e.locale&&(a.locale=r,a.strings=Eo(r,e.stringsOverride)),n!==e.themeMode&&(a.themeMode=n),o!==e.textSize&&(a.textSize=o),a}var G_=["presentation","behavior","theme","launcher","header","composer","feedback","i18n","footer","features","tracking","endpoints"];function Pa(e,t){if(!t)return e;let n={...e};for(let a of G_){let s=t[a];if(s===void 0)continue;let l=e[a];if(a==="theme"){l===void 0&&(n[a]=s);continue}a!=="i18n"&&(n[a]=ps(s,l))}t.modules!==void 0&&e.modules===void 0&&(n.modules=t.modules),t.dataApiBaseUrl!==void 0&&e.dataApiBaseUrl===void 0&&(n.dataApiBaseUrl=t.dataApiBaseUrl);let o=e.i18n,r=t.i18n;if(o||r){let a=ps(r??{},o);r?.availableLocales!==void 0&&(a.availableLocales=r.availableLocales),r?.defaultLocale!==void 0&&(a.defaultLocale=r.defaultLocale);let s=o?.strings,l=r?.strings;(s||l)&&(a.strings=j_(l,s)),n.i18n=a}return n}function ps(e,t){if(!t)return e;let n={...e};for(let[o,r]of Object.entries(t))r!==void 0&&(n[o]=r);return n}function j_(e,t){if(!e)return t;if(!t)return e;let n=Ao(e),o=Ao(t);if(!n&&!o)return{...e,...t};let r={},a=n?e:{en:e},s=o?t:{en:t};for(let[l,c]of Object.entries(a))r[l]={...c};for(let[l,c]of Object.entries(s))r[l]={...r[l],...c};return r}var X_=["clear","expand","fullscreen","popOut","sound","history","language","theme","textSize","close"],Tt=e=>e!=="false",Y_=e=>e.split(",").map(t=>t.trim()).filter(Boolean),ms=[["public-key","publicKey"],["ai-agent-deployment-id","aiAgentDeploymentId"],["base-url","baseUrl"],["agent-api-base-url","agentApiBaseUrl"],["data-api-base-url","dataApiBaseUrl"],["theme","theme",e=>e]],gs=[["mode","mode",e=>e],["position","position",e=>e],["iframe","iframe",Tt]],vs=[["width","width"],["height","height"]],hs=[["response-mode","responseMode",e=>e],["start-minimized","startMinimized",Tt],["show-reasoning","showReasoning",Tt],["show-tool-calls","showToolCalls",Tt],["show-sources","showSources",Tt],["disable-message-feedback","disableMessageFeedback",Tt],["auto-send-suggestions","autoSendSuggestions",Tt],["pop-out-url","popOutUrl"]],bs=[["locale","locale"]],J_=new Set(X_),Q_=e=>Y_(e).filter(t=>J_.has(t)),ys=[["launcher-variant","variant",e=>e],["launcher-size","size",e=>e],["launcher-icon","icon"],["launcher-hidden","hidden",Tt]],Ps=[["features-disable-file-upload","disableFileUpload",Tt],["features-voice","voice",e=>e]],xs=[["endpoint-upload","upload"],["endpoint-transcribe","transcribe"]],Ss=[["user-id","id"],["user-email","email"],["user-name","name"]],ks=[["page-area","area"],["page-url","url"],["page-path","path"],["page-title","title"]],Z_=["launcher-label","callout-text","callout-delay","actions","user-context","page-context"],ep=[ms,gs,vs,hs,bs,ys,Ps,xs,Ss,ks],tp=new Set(["iframe","start-minimized"]),xa=[...ep.flatMap(e=>e.map(([t])=>t).filter(t=>!tp.has(t))),...Z_];function $o(e){let t={},n=f=>{let m=e(f);return m===null||m===""?void 0:m};for(let[f,m,g]of ms){let y=n(f);y!==void 0&&(t[m]=g?g(y):y)}let o=Jt(n,gs),r=Jt(n,vs);(o||r)&&(t.presentation={...o,...r?{size:r}:{}});let a=Jt(n,hs);a&&(t.behavior=a);let s=Jt(n,bs);s&&(t.i18n=s);let l=op(e,n);l&&(t.launcher=l);let c=Jt(n,Ps);c&&(t.features=c);let d=Jt(n,xs);d&&(t.endpoints=d);let p=fs(n,Ss,"user-context");p&&(t.userContext=p);let _=fs(n,ks,"page-context");_&&(t.pageContext=_);let u=n("actions");return u!==void 0&&(t.header={actions:Q_(u)}),t}function Sa(e){return e?$o(t=>e[np(t==="data-api-base-url"?"api-base-url":t)]??null):{}}function np(e){return e.replaceAll(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Jt(e,t){let n={};for(let[o,r,a]of t){let s=e(o);s!==void 0&&(n[r]=a?a(s):s)}return Object.keys(n).length>0?n:null}function fs(e,t,n){let o={};for(let[l,c]of t){let d=e(l);d!==void 0&&(o[c]=d)}let r={},a=e(n);if(a)try{let l=JSON.parse(a);l&&typeof l=="object"&&!Array.isArray(l)&&(r=l)}catch{}let s={...r,...o};return Object.keys(s).length>0?s:null}function op(e,t){let n=Jt(t,ys)??{},o=e("launcher-label");o!==null&&(n.label=o);let r=t("callout-text");if(r){let a=Number.parseInt(t("callout-delay")??"",10);n.callout={text:r,...Number.isFinite(a)?{delayMs:a}:{}}}return Object.keys(n).length>0?n:null}var Vo,ne,Is,Ra,Ht,ws,Es,As,ka,Bo,jn,Ms,Ta,wa,Ca,rp,Uo={},zo=[],ap=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Xn=Array.isArray;function It(e,t){for(var n in t)e[n]=t[n];return e}function Ia(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Et(e,t,n){var o,r,a,s={};for(a in t)a=="key"?o=t[a]:a=="ref"?r=t[a]:s[a]=t[a];if(arguments.length>2&&(s.children=arguments.length>3?Vo.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)s[a]===void 0&&(s[a]=e.defaultProps[a]);return Ho(e,s,o,r,null)}function Ho(e,t,n,o,r){var a={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Is,__i:-1,__u:0};return r==null&&ne.vnode!=null&&ne.vnode(a),a}function de(e){return e.children}function tt(e,t){this.props=e,this.context=t}function Pn(e,t){if(t==null)return e.__?Pn(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Pn(e):null}function ip(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],r=[],a=It({},t);a.__v=t.__v+1,ne.vnode&&ne.vnode(a),Ea(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??Pn(t),!!(32&t.__u),r),a.__v=t.__v,a.__.__k[a.__i]=a,$s(o,a,r),t.__e=t.__=null,a.__e!=n&&Ls(a)}}function Ls(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Ls(e)}function Cs(e){(!e.__d&&(e.__d=!0)&&Ht.push(e)&&!qo.__r++||ws!=ne.debounceRendering)&&((ws=ne.debounceRendering)||Es)(qo)}function qo(){try{for(var e,t=1;Ht.length;)Ht.length>t&&Ht.sort(As),e=Ht.shift(),t=Ht.length,ip(e)}finally{Ht.length=qo.__r=0}}function Os(e,t,n,o,r,a,s,l,c,d,p){var _,u,f,m,g,y,k,S=o&&o.__k||zo,b=t.length;for(c=sp(n,t,S,c,b),_=0;_<b;_++)(f=n.__k[_])!=null&&(u=f.__i!=-1&&S[f.__i]||Uo,f.__i=_,y=Ea(e,f,u,r,a,s,l,c,d,p),m=f.__e,f.ref&&u.ref!=f.ref&&(u.ref&&Aa(u.ref,null,f),p.push(f.ref,f.__c||m,f)),g==null&&m!=null&&(g=m),(k=!!(4&f.__u))||u.__k===f.__k?(c=Ns(f,c,e,k),k&&u.__e&&(u.__e=null)):typeof f.type=="function"&&y!==void 0?c=y:m&&(c=m.nextSibling),f.__u&=-7);return n.__e=g,c}function sp(e,t,n,o,r){var a,s,l,c,d,p=n.length,_=p,u=0;for(e.__k=new Array(r),a=0;a<r;a++)(s=t[a])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[a]=Ho(null,s,null,null,null):Xn(s)?s=e.__k[a]=Ho(de,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[a]=Ho(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[a]=s,c=a+u,s.__=e,s.__b=e.__b+1,l=null,(d=s.__i=lp(s,n,c,_))!=-1&&(_--,(l=n[d])&&(l.__u|=2)),l==null||l.__v==null?(d==-1&&(r>p?u--:r<p&&u++),typeof s.type!="function"&&(s.__u|=4)):d!=c&&(d==c-1?u--:d==c+1?u++:(d>c?u--:u++,s.__u|=4))):e.__k[a]=null;if(_)for(a=0;a<p;a++)(l=n[a])!=null&&(2&l.__u)==0&&(l.__e==o&&(o=Pn(l)),Bs(l,l));return o}function Ns(e,t,n,o){var r,a;if(typeof e.type=="function"){for(r=e.__k,a=0;r&&a<r.length;a++)r[a]&&(r[a].__=e,t=Ns(r[a],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=Pn(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Yn(e,t){return t=t||[],e==null||typeof e=="boolean"||(Xn(e)?e.some(function(n){Yn(n,t)}):t.push(e)),t}function lp(e,t,n,o){var r,a,s,l=e.key,c=e.type,d=t[n],p=d!=null&&(2&d.__u)==0;if(d===null&&l==null||p&&l==d.key&&c==d.type)return n;if(o>(p?1:0)){for(r=n-1,a=n+1;r>=0||a<t.length;)if((d=t[s=r>=0?r--:a++])!=null&&(2&d.__u)==0&&l==d.key&&c==d.type)return s}return-1}function Rs(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||ap.test(t)?n:n+"px"}function Fo(e,t,n,o,r){var a,s;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||Rs(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||Rs(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")a=t!=(t=t.replace(Ms,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+a]=n,n?o?n[jn]=o[jn]:(n[jn]=Ta,e.addEventListener(t,a?Ca:wa,a)):e.removeEventListener(t,a?Ca:wa,a);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Ts(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Bo]==null)t[Bo]=Ta++;else if(t[Bo]<n[jn])return;return n(ne.event?ne.event(t):t)}}}function Ea(e,t,n,o,r,a,s,l,c,d){var p,_,u,f,m,g,y,k,S,b,x,P,w,D,q,B,M=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[l=t.__e=n.__e]),(p=ne.__b)&&p(t);e:if(typeof M=="function"){_=s.length;try{if(S=t.props,b=M.prototype&&M.prototype.render,x=(p=M.contextType)&&o[p.__c],P=p?x?x.props.value:p.__:o,n.__c?k=(u=t.__c=n.__c).__=u.__E:(b?t.__c=u=new M(S,P):(t.__c=u=new tt(S,P),u.constructor=M,u.render=dp),x&&x.sub(u),u.state||(u.state={}),u.__n=o,f=u.__d=!0,u.__h=[],u._sb=[]),b&&u.__s==null&&(u.__s=u.state),b&&M.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=It({},u.__s)),It(u.__s,M.getDerivedStateFromProps(S,u.__s))),m=u.props,g=u.state,u.__v=t,f)b&&M.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),b&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(b&&M.getDerivedStateFromProps==null&&S!==m&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(S,P),t.__v==n.__v||!u.__e&&u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(S,u.__s,P)===!1){t.__v!=n.__v&&(u.props=S,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(F){F&&(F.__=t)}),zo.push.apply(u.__h,u._sb),u._sb=[],u.__h.length&&s.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(S,u.__s,P),b&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(m,g,y)})}if(u.context=P,u.props=S,u.__P=e,u.__e=!1,w=ne.__r,D=0,b)u.state=u.__s,u.__d=!1,w&&w(t),p=u.render(u.props,u.state,u.context),zo.push.apply(u.__h,u._sb),u._sb=[];else do u.__d=!1,w&&w(t),p=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++D<25);u.state=u.__s,u.getChildContext!=null&&(o=It(It({},o),u.getChildContext())),b&&!f&&u.getSnapshotBeforeUpdate!=null&&(y=u.getSnapshotBeforeUpdate(m,g)),q=p!=null&&p.type===de&&p.key==null?Fs(p.props.children):p,l=Os(e,Xn(q)?q:[q],t,n,o,r,a,s,l,c,d),u.base=t.__e,t.__u&=-161,u.__h.length&&s.push(u),k&&(u.__E=u.__=null)}catch(F){if(s.length=_,t.__v=null,c||a!=null){if(F.then){for(t.__u|=c?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;a!=null&&(a[a.indexOf(l)]=null),t.__e=l}else if(a!=null)for(B=a.length;B--;)Ia(a[B])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),F.then||Ds(t),ne.__e(F,t,n)}}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=cp(n.__e,t,n,o,r,a,s,c,d);return(p=ne.diffed)&&p(t),128&t.__u?void 0:l}function Ds(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Ds))}function $s(e,t,n){for(var o=0;o<n.length;o++)Aa(n[o],n[++o],n[++o]);ne.__c&&ne.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(a){a.call(r)})}catch(a){ne.__e(a,r.__v)}})}function Fs(e){return typeof e!="object"||e==null||e.__b>0?e:Xn(e)?e.map(Fs):e.constructor!==void 0?null:It({},e)}function cp(e,t,n,o,r,a,s,l,c){var d,p,_,u,f,m,g,y=n.props||Uo,k=t.props,S=t.type;if(S=="svg"?r="http://www.w3.org/2000/svg":S=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),a!=null){for(d=0;d<a.length;d++)if((f=a[d])&&"setAttribute"in f==!!S&&(S?f.localName==S:f.nodeType==3)){e=f,a[d]=null;break}}if(e==null){if(S==null)return document.createTextNode(k);e=document.createElementNS(r,S,k.is&&k),l&&(ne.__m&&ne.__m(t,a),l=!1),a=null}if(S==null)y===k||l&&e.data==k||(e.data=k);else{if(a=S=="textarea"&&k.defaultValue!=null?null:a&&Vo.call(e.childNodes),!l&&a!=null)for(y={},d=0;d<e.attributes.length;d++)y[(f=e.attributes[d]).name]=f.value;for(d in y)f=y[d],d=="dangerouslySetInnerHTML"?_=f:d=="children"||d in k||d=="value"&&"defaultValue"in k||d=="checked"&&"defaultChecked"in k||Fo(e,d,null,f,r);for(d in k)f=k[d],d=="children"?u=f:d=="dangerouslySetInnerHTML"?p=f:d=="value"?m=f:d=="checked"?g=f:l&&typeof f!="function"||y[d]===f||Fo(e,d,f,y[d],r);if(p)l||_&&(p.__html==_.__html||p.__html==e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(_&&(e.innerHTML=""),Os(t.type=="template"?e.content:e,Xn(u)?u:[u],t,n,o,S=="foreignObject"?"http://www.w3.org/1999/xhtml":r,a,s,a?a[0]:n.__k&&Pn(n,0),l,c),a!=null)for(d=a.length;d--;)Ia(a[d]);l&&S!="textarea"||(d="value",S=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[d]||S=="progress"&&!m||S=="option"&&m!=y[d])&&Fo(e,d,m,y[d],r),d="checked",g!=null&&g!=e[d]&&Fo(e,d,g,y[d],r))}return e}function Aa(e,t,n){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&t==null||(e.__u=e(t))}else e.current=t}catch(r){ne.__e(r,n)}}function Bs(e,t,n){var o,r;if(ne.unmount&&ne.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||Aa(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(a){ne.__e(a,t)}o.base=o.__P=o.__n=null}if(o=e.__k)for(r=0;r<o.length;r++)o[r]&&Bs(o[r],t,n||typeof e.type!="function");n||Ia(e.__e),e.__c=e.__=e.__e=void 0}function dp(e,t,n){return this.constructor(e,n)}function Qt(e,t,n){var o,r,a,s;t==document&&(t=document.documentElement),ne.__&&ne.__(e,t),r=(o=typeof n=="function")?null:n&&n.__k||t.__k,a=[],s=[],Ea(t,e=(!o&&n||t).__k=Et(de,null,[e]),r||Uo,Uo,t.namespaceURI,!o&&n?[n]:r?null:t.firstChild?Vo.call(t.childNodes):null,a,!o&&n?n:r?r.__e:t.firstChild,o,s),$s(a,e,s),e.props.children=null}Vo=zo.slice,ne={__e:function(e,t,n,o){for(var r,a,s;t=t.__;)if((r=t.__c)&&!r.__)try{if((a=r.constructor)&&a.getDerivedStateFromError!=null&&(r.setState(a.getDerivedStateFromError(e)),s=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,o||{}),s=r.__d),s)return r.__E=r}catch(l){e=l}throw e}},Is=0,Ra=function(e){return e!=null&&e.constructor===void 0},tt.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=It({},this.state),typeof e=="function"&&(e=e(It({},n),this.props)),e&&It(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Cs(this))},tt.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Cs(this))},tt.prototype.render=de,Ht=[],Es=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,As=function(e,t){return e.__v.__b-t.__v.__b},qo.__r=0,ka=Math.random().toString(8),Bo="__d"+ka,jn="__a"+ka,Ms=/(PointerCapture)$|Capture$/i,Ta=0,wa=Ts(!1),Ca=Ts(!0),rp=0;var xn="1.1.14";function Hs(e){return`${R.cssPrefix}:${e}`}function Jn(e,t,n){e.dispatchEvent(new CustomEvent(Hs(t),{detail:n}))}function Us(e,t){let o=Object.entries(t).map(([r,a])=>{let s=Hs(r),l=c=>a(c.detail);return e.addEventListener(s,l),[s,l]});return()=>{for(let[r,a]of o)e.removeEventListener(r,a)}}function dt(){let e=Date.now(),t=new Uint8Array(16);t[0]=Math.floor(e/2**40)&255,t[1]=Math.floor(e/2**32)&255,t[2]=e>>>24&255,t[3]=e>>>16&255,t[4]=e>>>8&255,t[5]=e&255,up(t.subarray(6)),t[6]=t[6]&15|112,t[8]=t[8]&63|128;let n=Array.from(t,o=>o.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function up(e){if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){crypto.getRandomValues(e);return}for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*256)}var Zt=ee.scope("persistence");function Ut(e,t=Mo,n){let o=n?`${e}.${n}`:e,r=`${R.cssPrefix}.storageVersion`,a=t.get(r)??void 0,s=a?`.v${a}`:"",l=`${R.cssPrefix}.${o}${s}`,c=`${R.cssPrefix}${s}.visitorId`,d=`${l}.conversationId`,p=`${l}.userPrefs`,_=`${l}.panelOpen`,u=`${l}.panelSize`,f=`${l}.calloutDismissed`,m=`${l}.sidebarCollapsed`,g=`${l}.activeModule`,y=`${l}.historyCount`,k=`${l}.formsDone`,S={getVisitorId(){let b=t.get(c);if(b)return b;let x=dt();return t.set(c,x),x},setVisitorId(b){Zt.debug("setVisitorId (rebind)",{id:b,scope:o}),t.set(c,b)},loadConversationId(){return t.get(d)??void 0},saveConversationId(b){Zt.trace("saveConversationId",{id:b,scope:o}),b?t.set(d,b):t.remove(d)},loadDraft(b){return t.get(`${l}.draft.${b}`)??""},saveDraft(b,x){let P=`${l}.draft.${b}`;x?t.set(P,x):t.remove(P)},loadUserPrefs(){let b=t.get(p);if(!b)return{};try{let x=JSON.parse(b);return zs(x)?x:{}}catch(x){return Zt.warn("loadUserPrefs parse failed",{error:x}),{}}},saveUserPrefs(b){try{t.set(p,JSON.stringify(b))}catch(x){Zt.warn("saveUserPrefs serialise failed",{error:x})}},patchUserPrefs(b){let x=S.loadUserPrefs();S.saveUserPrefs({...x,...b})},loadPanelOpen(){let b=t.get(_);return b==="1"?!0:b==="0"?!1:null},savePanelOpen(b){t.set(_,b?"1":"0")},loadPanelSize(){let b=t.get(u);return b==="normal"||b==="expanded"||b==="fullscreen"?b:null},savePanelSize(b){t.set(u,b)},loadCalloutDismissed(b){if(!b)return!1;let x=t.get(f);return!!x&&x===b},saveCalloutDismissed(b){b?t.set(f,b):t.remove(f)},loadSidebarCollapsed(){let b=t.get(m);return b==="1"?!0:b==="0"?!1:null},saveSidebarCollapsed(b){t.set(m,b?"1":"0")},loadActiveModule(){return t.get(g)||null},saveActiveModule(b){t.set(g,b)},loadHistoryCount(){let b=t.get(y);if(!b)return null;let x=Number.parseInt(b,10);return Number.isFinite(x)&&x>=0?x:null},saveHistoryCount(b){t.set(y,String(b))},loadFormsDone(){let b=t.get(k);if(!b)return{};try{let x=JSON.parse(b);return zs(x)?x:{}}catch(x){return Zt.warn("loadFormsDone parse failed",{error:x}),{}}},saveFormDone(b){try{let x=S.loadFormsDone();x[b]=Date.now(),t.set(k,JSON.stringify(x))}catch(x){Zt.warn("saveFormDone serialise failed",{error:x})}},rememberStorageVersion(b){b&&b!==t.get(r)&&(Zt.debug("rememberStorageVersion (force-reset on next load)",{version:b}),t.set(r,b))},clearConversation(){t.remove(d)}};return S}function zs(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var qs=`:host{--__P__-accent-user: __BRAND_ACCENT__;--__P__-accent: var(--__P__-accent-user);--__P__-accent-text-user: __BRAND_ACCENT_TEXT__;--__P__-accent-text: var(--__P__-accent-text-user);--__P__-accent-fg: var(--__P__-accent);--__P__-radius: __BRAND_RADIUS__;--__P__-radius-sm: 8px;--__P__-radius-md: 10px;--__P__-radius-lg: 16px;--__P__-font: __BRAND_FONT__;--__P__-font-display: var(--__P__-font);--__P__-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;--__P__-bg: oklch(1 0 0);--__P__-bg-elevated: oklch(.9789 .0029 278.3);--__P__-surface: var(--__P__-bg-elevated);--__P__-muted: var(--__P__-fg-muted);--__P__-hover: oklch(.1686 .011 278.3 / .06);--__P__-fg: oklch(.1686 .011 278.3);--__P__-fg-muted: oklch(.4932 .0301 278.3);--__P__-border: oklch(.9312 .0084 278.3);--__P__-border-strong: oklch(.8757 .0131 278.3);--__P__-bubble-user: var(--__P__-accent);--__P__-bubble-user-text: var(--__P__-accent-text);--__P__-bubble-assistant: oklch(.9638 .0058 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-on-accent: var(--__P__-accent-text);--__P__-success: oklch(.6456 .1654 151.53);--__P__-warning: oklch(.7135 .1494 74.05);--__P__-danger: oklch(.5966 .1818 24.51);--__P__-danger-text: oklch(.5054 .1905 27.52);--__P__-danger-bg: oklch(.5966 .1818 24.51 / .1);--__P__-neutral: oklch(.7137 .0192 278.3);--__P__-pill-l-min: .3;--__P__-pill-l-max: .46;--__P__-focus: var(--__P__-accent);--__P__-shadow-panel: 0 8px 24px -8px rgba(13, 15, 20, .18), 0 24px 64px -24px rgba(13, 15, 20, .24);--__P__-shadow-card: 0 1px 2px rgba(13, 15, 20, .06), 0 4px 12px -6px rgba(13, 15, 20, .12);--__P__-backdrop: oklch(.1686 .011 278.3 / .55);--__P__-shadow-fab: 0 6px 16px -4px color-mix(in oklch, var(--__P__-accent) 45%, transparent), 0 12px 32px -12px rgba(13, 15, 20, .25);--__P__-z-fab: 2147483600;--__P__-z-panel: 2147483601;--__P__-panel-w: 380px;--__P__-panel-h: 600px;--__P__-fab-size: 56px;--__P__-conversation-max: 768px;--__P__-space-1: 4px;--__P__-space-2: 8px;--__P__-space-3: 12px;--__P__-space-4: 16px;--__P__-space-5: 20px;--__P__-space-6: 24px;--__P__-space-8: 32px;--__P__-text-scale: 1;--__P__-text-xs: calc(12px * var(--__P__-text-scale));--__P__-text-sm: calc(13px * var(--__P__-text-scale));--__P__-text-base: calc(15px * var(--__P__-text-scale));--__P__-text-md: calc(16px * var(--__P__-text-scale));--__P__-text-lg: calc(18px * var(--__P__-text-scale));--__P__-text-xl: calc(22px * var(--__P__-text-scale));--__P__-text-2xl: calc(30px * var(--__P__-text-scale))}:host([data-mode="modal"]),:host([data-mode="drawer"]){--__P__-conversation-max: 100%}:host([data-text-size="small"]){--__P__-text-scale: .9}:host([data-text-size="large"]){--__P__-text-scale: 1.15}:host{--__P__-ease: cubic-bezier(.2, .7, .2, 1);--__P__-ease-out: cubic-bezier(.2, .7, .2, 1);--__P__-ease-in: cubic-bezier(.4, 0, 1, 1);--__P__-ease-in-out: cubic-bezier(.65, 0, .35, 1);--__P__-dur-quick: .12s;--__P__-dur-base: .22s;--__P__-dur-slow: .32s;font-family:var(--__P__-font);color:var(--__P__-fg);color-scheme:light;--__P__-color-scheme: light}:host([data-theme="dark"]){--__P__-bg: oklch(.1783 .0128 278.3);--__P__-bg-elevated: oklch(.2232 .0182 278.3);--__P__-fg: oklch(.9368 .01 278.3);--__P__-fg-muted: oklch(.7048 .0296 278.3);--__P__-border: oklch(.2752 .0266 278.3);--__P__-border-strong: oklch(.335 .0291 278.3);--__P__-hover: oklch(.9368 .01 278.3 / .08);--__P__-bubble-assistant: oklch(.2474 .0311 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-danger-text: oklch(.8077 .1035 19.57);--__P__-danger-bg: oklch(.5966 .1818 24.51 / .18);--__P__-shadow-panel: 0 8px 24px -8px rgba(0, 0, 0, .6), 0 24px 64px -24px rgba(0, 0, 0, .7);--__P__-shadow-card: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 12px -6px rgba(0, 0, 0, .5);--__P__-backdrop: rgba(0, 0, 0, .65);--__P__-pill-l-min: .75;--__P__-pill-l-max: .92;color-scheme:dark;--__P__-color-scheme: dark}@media(prefers-color-scheme:dark){:host([data-theme="auto"]){--__P__-bg: oklch(.1783 .0128 278.3);--__P__-bg-elevated: oklch(.2232 .0182 278.3);--__P__-fg: oklch(.9368 .01 278.3);--__P__-fg-muted: oklch(.7048 .0296 278.3);--__P__-border: oklch(.2752 .0266 278.3);--__P__-border-strong: oklch(.335 .0291 278.3);--__P__-hover: oklch(.9368 .01 278.3 / .08);--__P__-bubble-assistant: oklch(.2474 .0311 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-pill-l-min: .75;--__P__-pill-l-max: .92;--__P__-shadow-panel: 0 8px 24px -8px rgba(0, 0, 0, .6), 0 24px 64px -24px rgba(0, 0, 0, .7);color-scheme:dark;--__P__-color-scheme: dark}}@supports (color: oklch(from red l c h)){:host{--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.3, l, .62) c h);--__P__-accent-text: oklch(from var(--__P__-accent) clamp(0, (l / .623 - 1) * -infinity, 1) 0 h);--__P__-accent-fg: oklch(from var(--__P__-accent-user) clamp(.3, l, .46) c h)}:host([data-theme="dark"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h);--__P__-accent-fg: var(--__P__-accent)}@media(prefers-color-scheme:dark){:host([data-theme="auto"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h);--__P__-accent-fg: var(--__P__-accent)}}}@media(prefers-reduced-motion:reduce){:host{--__P__-dur-quick: 1ms;--__P__-dur-base: 1ms;--__P__-dur-slow: 1ms}}
|
|
2
|
+
`;var Vs=`*,*:before,*:after{box-sizing:border-box;margin:0;padding:0;border:0}button{font:inherit;color:inherit;background:none;cursor:pointer;-webkit-appearance:none;appearance:none;line-height:1}button:focus-visible,[tabindex]:focus-visible,textarea:focus-visible,input:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px}textarea,input{font:inherit;color:inherit;background:none;border:0;outline:0;resize:none}a{color:var(--__P__-accent-fg);text-decoration:underline;text-underline-offset:2px}img,svg{display:block;max-width:100%}ul,ol{list-style:none}.__P__-app{display:block;width:100%;height:100%;font-family:var(--__P__-font);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-feature-settings:"cv11","ss01","ss03"}.__P__-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
|
|
3
|
+
`;var Ws=`.__P__-anchor{color-scheme:var(--__P__-color-scheme, light);right:16px;bottom:16px}.__P__-surface{display:contents}.__P__-surface[hidden]{display:none}:host([data-position="bottom-left"]) .__P__-anchor,:host([data-position="top-left"]) .__P__-anchor{right:auto;left:16px}:host([data-position="top-right"]) .__P__-anchor,:host([data-position="top-left"]) .__P__-anchor{bottom:auto;top:16px}.__P__-anchor{position:fixed;display:flex;flex-direction:column;align-items:flex-end;gap:var(--__P__-space-3);pointer-events:none}.__P__-anchor{--__P__-fab-size: 56px}.__P__-anchor[data-launcher-size=sm]{--__P__-fab-size: 44px}.__P__-anchor[data-launcher-size=md]{--__P__-fab-size: 56px}.__P__-anchor[data-launcher-size=lg]{--__P__-fab-size: 68px}.__P__-anchor>*{pointer-events:auto}.__P__-fab[data-size=sm]{--__P__-fab-size: 44px;font-size:var(--__P__-text-sm)}.__P__-fab[data-size=md]{--__P__-fab-size: 56px;font-size:calc(14px * var(--__P__-text-scale))}.__P__-fab[data-size=lg]{--__P__-fab-size: 68px;font-size:var(--__P__-text-base)}.__P__-fab{display:inline-flex;align-items:center;justify-content:center;gap:var(--__P__-space-2);color:var(--__P__-accent-text);background:var(--__P__-accent);box-shadow:var(--__P__-shadow-fab);font-weight:600;line-height:1;transform-origin:bottom right;animation:__P__-fab-in var(--__P__-dur-base) var(--__P__-ease) both;transition:transform var(--__P__-dur-base) var(--__P__-ease),opacity var(--__P__-dur-base) var(--__P__-ease),box-shadow var(--__P__-dur-base) var(--__P__-ease)}.__P__-fab:hover{transform:translateY(-2px)}.__P__-fab:active{transform:translateY(0)}.__P__-fab:focus-visible{outline:2px solid var(--__P__-on-accent);outline-offset:3px}.__P__-fab svg{width:24px;height:24px;flex-shrink:0}@keyframes __P__-fab-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:none}}.__P__-fab[data-leaving]{position:absolute;right:0;bottom:0;animation:__P__-fab-out var(--__P__-dur-quick) var(--__P__-ease) forwards;pointer-events:none}:host([data-position^="top-"]) .__P__-fab[data-leaving]{bottom:auto;top:0}:host([data-position$="-left"]) .__P__-fab[data-leaving]{right:auto;left:0}@keyframes __P__-fab-out{0%{opacity:1;transform:none}to{opacity:0;transform:scale(.85)}}.__P__-fab[data-variant=circle]{width:var(--__P__-fab-size);height:var(--__P__-fab-size);border-radius:999px}.__P__-fab[data-variant=circle] .__P__-fab-label{display:none}.__P__-fab[data-variant=pill]{height:var(--__P__-fab-size);padding:0 18px 0 16px;border-radius:999px}.__P__-fab[data-variant=bar]{height:var(--__P__-fab-size);padding:0 22px;border-radius:var(--__P__-radius)}.__P__-fab[data-variant=minimal]{height:var(--__P__-fab-size);padding:0 var(--__P__-space-4);border-radius:999px;background:transparent;color:var(--__P__-accent-fg);box-shadow:none;border:1px solid currentColor}.__P__-fab[data-variant=minimal]:hover{background:color-mix(in srgb,var(--__P__-accent) 12%,transparent)}.__P__-callout{--__P__-callout-fab-h: var(--__P__-fab-size, 56px);--__P__-callout-gap: clamp(12px, calc(var(--__P__-callout-fab-h) * .25), 22px);--__P__-callout-nudge-direction: -1;position:absolute;display:inline-flex;align-items:center;gap:var(--__P__-space-2);padding:10px 14px;background:var(--__P__-fg);color:var(--__P__-bg);border-radius:999px;font-size:var(--__P__-text-sm);font-weight:600;line-height:1.2;box-shadow:0 10px 30px -8px #00000059;pointer-events:auto;animation:__P__-callout-in var(--__P__-dur-slow) var(--__P__-ease);z-index:1;max-width:240px;white-space:nowrap}.__P__-callout[data-position=left]{right:calc(100% + var(--__P__-callout-gap));bottom:calc(var(--__P__-callout-fab-h) / 2);transform:translateY(50%)}.__P__-callout[data-position=right]{left:calc(100% + var(--__P__-callout-gap));bottom:calc(var(--__P__-callout-fab-h) / 2);transform:translateY(50%);--__P__-callout-nudge-direction: 1}.__P__-callout[data-position=top]{bottom:calc(100% + var(--__P__-callout-gap));right:0;max-width:min(280px,calc(100vw - 32px))}.__P__-callout[data-position=bottom]{top:calc(100% + var(--__P__-callout-gap));right:0;max-width:min(280px,calc(100vw - 32px))}:host([data-position$="-left"]) .__P__-callout[data-position=top],:host([data-position$="-left"]) .__P__-callout[data-position=bottom]{right:auto;left:0}.__P__-callout[data-shape=bubble]{border-radius:var(--__P__-radius-md);white-space:normal;width:max-content;max-width:min(280px,calc(100vw - 32px))}.__P__-callout[data-shape=callout]{padding:12px 18px;font-size:calc(14px * var(--__P__-text-scale));background:var(--__P__-accent);color:var(--__P__-accent-text)}.__P__-callout:after{content:"";position:absolute;width:12px;height:12px;background:inherit;border-radius:2px;transform:rotate(45deg)}.__P__-callout[data-position=left]:after{right:-5px;top:50%;margin-top:-6px}.__P__-callout[data-position=right]:after{left:-5px;top:50%;margin-top:-6px}.__P__-callout[data-position=top]:after{bottom:-5px;right:calc(var(--__P__-fab-size, 56px) / 2 - 6px)}.__P__-callout[data-position=bottom]:after{top:-5px;right:calc(var(--__P__-fab-size, 56px) / 2 - 6px)}:host([data-position$="-left"]) .__P__-callout[data-position=top]:after,:host([data-position$="-left"]) .__P__-callout[data-position=bottom]:after{right:auto;left:calc(var(--__P__-fab-size, 56px) / 2 - 6px)}.__P__-callout[data-animated]{animation:__P__-callout-in var(--__P__-dur-slow) var(--__P__-ease),__P__-callout-nudge 1.6s var(--__P__-ease-in-out) var(--__P__-dur-slow) infinite}@keyframes __P__-callout-in{0%{opacity:0}to{opacity:1}}@keyframes __P__-callout-nudge{0%,to{margin-left:0;margin-right:0}50%{margin-left:calc(6px * var(--__P__-callout-nudge-direction));margin-right:calc(-6px * var(--__P__-callout-nudge-direction))}}@media(prefers-reduced-motion:reduce){.__P__-callout[data-animated]{animation:__P__-callout-in 1ms var(--__P__-ease)}.__P__-icon-btn[data-recording=true],.__P__-typing span{animation:none}}.__P__-callout-close{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:999px;color:inherit;opacity:.7;cursor:pointer}.__P__-callout-close:hover{opacity:1;background:color-mix(in srgb,currentColor 15%,transparent)}.__P__-callout-close:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-callout-close svg{width:12px;height:12px}.__P__-panel{width:var(--__P__-panel-w);height:var(--__P__-panel-h);max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);background:var(--__P__-bg);color:var(--__P__-fg);border-radius:var(--__P__-radius-lg);box-shadow:var(--__P__-shadow-panel);display:flex;flex-direction:column;overflow:hidden;overscroll-behavior:none;transform-origin:bottom right;animation:__P__-panel-in var(--__P__-dur-slow) var(--__P__-ease);border:1px solid var(--__P__-border)}@media(prefers-reduced-motion:no-preference){.__P__-panel{transition:width var(--__P__-dur-base) var(--__P__-ease),height var(--__P__-dur-base) var(--__P__-ease),max-width var(--__P__-dur-base) var(--__P__-ease),max-height var(--__P__-dur-base) var(--__P__-ease)}.__P__-panel[data-resizing]{transition:none}}:host([data-mode="open"]) .__P__-panel{width:var(--__P__-widget-w, var(--__P__-panel-w));height:var(--__P__-widget-h, var(--__P__-panel-h));min-width:var(--__P__-resize-min-w, auto);min-height:var(--__P__-resize-min-h, auto);max-width:var(--__P__-resize-max-w, calc(100vw - 32px) );max-height:var(--__P__-resize-max-h, calc(100dvh - 32px) )}@keyframes __P__-panel-in{0%{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:none}}:host([data-mode="expanded"]) .__P__-panel{width:var(--__P__-expanded-w, 640px);height:var(--__P__-expanded-h, 820px);max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px)}:host([data-mode="fullscreen"]){z-index:var(--__P__-z-panel)!important}:host([data-mode="fullscreen"]) .__P__-anchor{inset:var(--__P__-visual-viewport-top, 0px) 0 auto;height:var(--__P__-visual-viewport-height, 100dvh);padding:0;justify-content:flex-end;align-items:flex-end}:host([data-mode="fullscreen"][data-position*="top"]) .__P__-anchor{justify-content:flex-start}:host([data-mode="fullscreen"][data-position*="left"]) .__P__-anchor{align-items:flex-start}:host([data-mode="fullscreen"]) .__P__-panel{width:100vw;height:100%;max-width:none;max-height:none;border-radius:0;border:0}:host([data-mode="fullscreen"]) .__P__-fab{display:none}@media(max-width:640px){:host([data-mode="open"]) .__P__-anchor,:host([data-mode="expanded"]) .__P__-anchor{inset:var(--__P__-visual-viewport-top, 0px) 0 auto;align-items:stretch;height:var(--__P__-visual-viewport-height, 100dvh);padding:0}:host([data-mode="open"]) .__P__-panel,:host([data-mode="expanded"]) .__P__-panel{width:100vw;height:100%;max-width:none;max-height:none;border-radius:0;border:0}}:host([data-mode="inline"]) .__P__-anchor,:host([data-mode="standalone"]) .__P__-anchor{position:static;inset:auto;padding:0;align-items:stretch;width:100%;height:100%;min-height:0}:host([data-mode="inline"]) .__P__-panel,:host([data-mode="standalone"]) .__P__-panel{width:100%;height:100%;min-width:0;min-height:0;max-width:none;max-height:none;animation:none}:host([data-mode="inline"]) .__P__-fab,:host([data-mode="standalone"]) .__P__-fab{display:none}:host([data-mode="inline"]){min-height:320px}:host([data-mode="inline"]) .__P__-panel{border-radius:var(--__P__-radius)}:host([data-mode="standalone"]) .__P__-panel{border-radius:0;border:0;box-shadow:none}:host([data-mode="modal"]){position:fixed!important;inset:0!important;z-index:var(--__P__-z-panel)!important;display:block!important;width:100vw;height:100dvh;background:var(--__P__-modal-backdrop, var(--__P__-backdrop));animation:__P__-backdrop-in var(--__P__-dur-base) var(--__P__-ease) both;--__P__-panel-w: min(960px, 92vw);--__P__-panel-h: min(720px, 88dvh)}:host([data-mode="modal"]) .__P__-anchor{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:var(--__P__-space-6);pointer-events:none}:host([data-mode="modal"]) .__P__-panel{pointer-events:auto;width:var(--__P__-widget-w, var(--__P__-panel-w));height:var(--__P__-widget-h, var(--__P__-panel-h));max-width:calc(100vw - 48px);max-height:calc(100dvh - 48px);min-width:0;min-height:0;border-radius:var(--__P__-radius);box-shadow:var(--__P__-shadow-panel);animation:__P__-modal-in var(--__P__-dur-base) var(--__P__-ease);translate:var(--__P__-modal-dx, 0px) var(--__P__-modal-dy, 0px)}:host([data-mode="modal"]) .__P__-header,:host([data-mode="modal"]) .__P__-back-header,:host([data-mode="modal"]) .__P__-home-hero{cursor:grab;touch-action:none}:host([data-mode="modal"]) .__P__-panel[data-dragging]{cursor:grabbing;user-select:none}:host([data-mode="modal"]) .__P__-panel[data-dragging] *{cursor:grabbing}:host([data-mode="modal"]) .__P__-fab{display:none}@keyframes __P__-backdrop-in{0%{background:#0000}to{background:var(--__P__-modal-backdrop, var(--__P__-backdrop))}}@keyframes __P__-modal-in{0%{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}:host([data-mode="drawer"]){--__P__-panel-w: min(440px, calc(100vw - 32px) );--__P__-panel-h: 100dvh}:host([data-mode="drawer"]) .__P__-anchor{position:fixed;--__P__-inset-x: var(--__P__-panel-inset, 12px);--__P__-inset-y: var(--__P__-panel-inset, 3dvh);top:var(--__P__-inset-y);bottom:auto;right:var(--__P__-inset-x);left:auto;width:min(var(--__P__-widget-w, var(--__P__-panel-w)),calc(100vw - var(--__P__-inset-x) * 2));height:min(var(--__P__-widget-h, var(--__P__-panel-h)),calc(100dvh - var(--__P__-inset-y) * 2));padding:0;display:block;pointer-events:auto}:host([data-mode="drawer"][data-position$="-left"]) .__P__-anchor{right:auto;left:var(--__P__-inset-x)}:host([data-mode="drawer"][data-position^="bottom-"]) .__P__-anchor{top:auto;bottom:var(--__P__-inset-y)}:host([data-mode="drawer"]) .__P__-panel{width:100%;height:100%;max-width:none;max-height:none;min-width:0;min-height:0;border-radius:var(--__P__-radius, 12px);border:1px solid var(--__P__-border);box-shadow:-8px 16px 32px -12px #00000038;animation:__P__-drawer-in var(--__P__-dur-base) var(--__P__-ease)}:host([data-mode="drawer"][data-position$="-left"]) .__P__-panel{box-shadow:8px 16px 32px -12px #00000038;animation:__P__-drawer-in-left var(--__P__-dur-base) var(--__P__-ease)}.__P__-fab[data-edge-tab]{display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--__P__-space-2);position:fixed;top:50%;height:140px;width:auto;min-width:0;padding:10px 8px;writing-mode:vertical-rl;text-orientation:mixed;transform:translateY(-50%);transform-origin:center;animation:__P__-edge-tab-in var(--__P__-dur-base) var(--__P__-ease) both}.__P__-fab[data-edge-tab] svg{writing-mode:horizontal-tb}.__P__-fab[data-edge-tab]:hover{transform:translateY(-50%) scale(1.03)}.__P__-fab[data-edge-tab]:active{transform:translateY(-50%) scale(.97)}:host([data-position$="-right"]) .__P__-fab[data-edge-tab]{right:0;left:auto;border-radius:12px 0 0 12px;box-shadow:-6px 0 18px -8px #0000004d}:host([data-position$="-left"]) .__P__-fab[data-edge-tab]{left:0;right:auto;border-radius:0 12px 12px 0;box-shadow:6px 0 18px -8px #0000004d}.__P__-fab[data-edge-tab][data-leaving]{position:fixed;top:50%;bottom:auto;animation:__P__-edge-tab-out var(--__P__-dur-quick) var(--__P__-ease) forwards}@keyframes __P__-edge-tab-in{0%{opacity:0;transform:translateY(-50%) scale(.9)}to{opacity:1;transform:translateY(-50%) scale(1)}}@keyframes __P__-edge-tab-out{0%{opacity:1;transform:translateY(-50%) scale(1)}to{opacity:0;transform:translateY(-50%) scale(.85)}}@keyframes __P__-drawer-in{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes __P__-drawer-in-left{0%{transform:translate(-100%)}to{transform:translate(0)}}@media(prefers-reduced-motion:reduce){:host([data-mode="drawer"]) .__P__-panel,.__P__-fab[data-edge-tab]{animation:none}}.__P__-header{display:flex;align-items:center;gap:var(--__P__-space-2);padding:10px 12px;border-bottom:1px solid var(--__P__-border);background:var(--__P__-bg)}.__P__-header h1{font-size:calc(14px * var(--__P__-text-scale));font-weight:600;flex:1;letter-spacing:-.01em}.__P__-header-actions{margin-inline-start:auto;display:flex;align-items:center;gap:var(--__P__-space-1);flex-shrink:0}.__P__-agent{flex:1;display:inline-flex;align-items:center;gap:10px;min-width:0}.__P__-agent-avatar{position:relative;width:32px;height:32px;border-radius:999px;background:var(--__P__-bg-elevated);color:var(--__P__-fg-muted);display:inline-flex;align-items:center;justify-content:center;font-weight:700;font-size:var(--__P__-text-xs);overflow:hidden;flex-shrink:0}.__P__-agent-avatar img{width:100%;height:100%;object-fit:cover}.__P__-agent-avatar:after{content:"";position:absolute;right:-1px;bottom:-1px;width:10px;height:10px;border-radius:999px;border:2px solid var(--__P__-bg);background:var(--__P__-neutral)}.__P__-agent-avatar[data-status=online]:after{background:var(--__P__-success)}.__P__-agent-avatar[data-status=away]:after{background:var(--__P__-warning)}.__P__-agent-avatar[data-status=offline]:after{background:var(--__P__-neutral)}.__P__-agent-meta{display:flex;flex-direction:column;line-height:1.15;min-width:0}.__P__-agent-meta strong{font-size:calc(14px * var(--__P__-text-scale));font-weight:600;letter-spacing:-.01em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-agent-meta span{font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-suggestions{display:flex;flex-wrap:nowrap;gap:var(--__P__-space-2);padding:6px 14px 10px;overflow-x:auto;overflow-y:hidden;scroll-behavior:smooth;scroll-snap-type:x proximity;scrollbar-width:none;-ms-overflow-style:none;min-width:0}.__P__-suggestions::-webkit-scrollbar{display:none}.__P__-suggestions:before,.__P__-suggestions:after{content:"";flex:1 1 0;min-width:0}.__P__-suggestion{flex:0 0 auto;scroll-snap-align:center;padding:7px 14px;border-radius:999px;background:var(--__P__-bg-elevated);border:1px solid var(--__P__-border);color:var(--__P__-fg);font-size:var(--__P__-text-sm);font-weight:500;white-space:nowrap;transition:background var(--__P__-dur-quick) var(--__P__-ease),border-color var(--__P__-dur-quick) var(--__P__-ease),transform var(--__P__-dur-quick) var(--__P__-ease)}.__P__-suggestion:hover{border-color:var(--__P__-accent);color:var(--__P__-accent-fg);transform:translateY(-1px)}.__P__-suggestion:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px;border-color:var(--__P__-accent)}.__P__-suggestion:active{transform:translateY(0)}.__P__-icon-btn{width:32px;height:32px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;color:var(--__P__-fg-muted);transition:background var(--__P__-dur-quick) var(--__P__-ease),color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-icon-btn:hover{background:var(--__P__-bg-elevated);color:var(--__P__-fg)}.__P__-icon-btn:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-icon-btn:active{background:var(--__P__-border)}.__P__-icon-btn:disabled{opacity:.45;cursor:not-allowed}.__P__-icon-btn:before{content:"";position:absolute;inset:-6px}.__P__-icon-btn{position:relative}.__P__-icon-btn svg{width:18px;height:18px}.__P__-icon-btn[data-recording=true]{color:var(--__P__-accent-fg);background:color-mix(in srgb,var(--__P__-accent) 12%,transparent);animation:__P__-pulse 1.2s var(--__P__-ease) infinite}@keyframes __P__-pulse{0%,to{box-shadow:0 0 color-mix(in srgb,var(--__P__-accent) 40%,transparent)}50%{box-shadow:0 0 0 6px color-mix(in srgb,var(--__P__-accent) 0%,transparent)}}.__P__-list,.__P__-history,.__P__-module-scroll,.__P__-home-scroll,.__P__-help-list,.__P__-toolui-code,.__P__-sidebar-conversations{scrollbar-width:thin;scrollbar-color:var(--__P__-border-strong) transparent;overscroll-behavior:contain;scrollbar-gutter:stable}.__P__-list::-webkit-scrollbar,.__P__-history::-webkit-scrollbar,.__P__-module-scroll::-webkit-scrollbar,.__P__-home-scroll::-webkit-scrollbar,.__P__-help-list::-webkit-scrollbar,.__P__-toolui-code::-webkit-scrollbar,.__P__-sidebar-conversations::-webkit-scrollbar{width:8px}.__P__-list::-webkit-scrollbar-thumb,.__P__-history::-webkit-scrollbar-thumb,.__P__-module-scroll::-webkit-scrollbar-thumb,.__P__-home-scroll::-webkit-scrollbar-thumb,.__P__-help-list::-webkit-scrollbar-thumb,.__P__-toolui-code::-webkit-scrollbar-thumb,.__P__-sidebar-conversations::-webkit-scrollbar-thumb{background:var(--__P__-border-strong);border-radius:8px}.__P__-list-wrap{position:relative;flex:1;min-height:0;display:flex;flex-direction:column}.__P__-jump{position:absolute;inset-inline-end:14px;bottom:14px;z-index:2;display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;border-radius:999px;border:1px solid var(--__P__-border);background:var(--__P__-bg-elevated);color:var(--__P__-fg);box-shadow:var(--__P__-shadow-panel);cursor:pointer;opacity:.85;transition:opacity var(--__P__-dur-quick) var(--__P__-ease),transform var(--__P__-dur-quick) var(--__P__-ease);animation:__P__-bubble-in var(--__P__-dur-base) var(--__P__-ease)}.__P__-jump:hover{opacity:1}.__P__-jump:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;opacity:1}.__P__-jump:active{transform:translateY(1px)}.__P__-jump svg{width:18px;height:18px}.__P__-list{flex:1;min-height:0;overflow-y:auto;padding:var(--__P__-space-4);padding-bottom:var(--__P__-space-8);display:flex;flex-direction:column;gap:14px}.__P__-list--fade{--__P__-fade-size: 20px;--__P__-fade-top: 0px;--__P__-fade-bottom: 0px;-webkit-mask-image:linear-gradient(to bottom,transparent 0,#000 var(--__P__-fade-top),#000 calc(100% - var(--__P__-fade-bottom)),transparent 100%);mask-image:linear-gradient(to bottom,transparent 0,#000 var(--__P__-fade-top),#000 calc(100% - var(--__P__-fade-bottom)),transparent 100%)}.__P__-list--fade[data-fade-top=true]{--__P__-fade-top: var(--__P__-fade-size)}.__P__-list--fade[data-fade-bottom=true]{--__P__-fade-bottom: var(--__P__-fade-size)}.__P__-list>*{width:100%;max-width:var(--__P__-conversation-max, 768px);margin-inline:auto}.__P__-load-previous,.__P__-history-more{display:flex;justify-content:center}.__P__-load-previous button,.__P__-history-more button{border:0;padding:4px 8px;background:transparent;color:var(--__P__-accent);font:inherit;font-size:var(--__P__-text-sm);font-weight:600;cursor:pointer}.__P__-load-previous button:hover,.__P__-history-more button:hover{text-decoration:underline}.__P__-load-previous button:focus-visible,.__P__-history-more button:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;border-radius:var(--__P__-radius-sm)}.__P__-load-previous button:disabled,.__P__-history-more button:disabled{cursor:wait;opacity:.6}.__P__-date-divider{display:flex;justify-content:center;margin-block:var(--__P__-space-3)}.__P__-date-pill{padding:3px 10px;border-radius:999px;font-size:calc(11px * var(--__P__-text-scale));font-weight:600;color:var(--__P__-fg-muted);background:var(--__P__-bg-elevated);border:1px solid var(--__P__-border);box-shadow:var(--__P__-shadow-card)}.__P__-bubble-row{display:flex}.__P__-bubble-row[data-role=user]{justify-content:flex-end}.__P__-bubble-row[data-role=assistant]{justify-content:flex-start}.__P__-bubble{max-width:100%;min-width:0;padding:var(--__P__-space-3) var(--__P__-space-4);border-radius:var(--__P__-radius);line-height:1.6;font-size:calc(14px * var(--__P__-text-scale));word-wrap:break-word;overflow-wrap:break-word;box-shadow:0 1px 2px #0000000a,0 1px 8px -4px #0000000f;animation:__P__-bubble-in var(--__P__-dur-base) var(--__P__-ease)}.__P__-bubble ::selection{background:color-mix(in srgb,var(--__P__-accent) 30%,transparent)}.__P__-bubble-row[data-role=user] .__P__-bubble ::selection{background:#fff6;color:var(--__P__-bubble-user-text)}@keyframes __P__-bubble-in{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}.__P__-bubble-row[data-role=user] .__P__-bubble{background:var(--__P__-bubble-user);color:var(--__P__-bubble-user-text);border-end-end-radius:5px}.__P__-bubble-row[data-role=assistant] .__P__-bubble{background:var(--__P__-bubble-assistant);color:var(--__P__-bubble-assistant-text);border:1px solid var(--__P__-border);border-end-start-radius:5px}.__P__-bubble-row[data-role=operator] .__P__-bubble{display:flex;align-items:stretch;padding:0;overflow:hidden;background:var(--__P__-bubble-assistant);color:var(--__P__-bubble-assistant-text);border-end-start-radius:5px}.__P__-bubble-row[data-role=operator] .__P__-bubble-col{align-items:flex-start}.__P__-bubble-author{display:flex;flex:0 0 auto;align-items:center;padding:0 .875rem;border-inline-end:1px solid color-mix(in oklab,var(--__P__-accent),transparent 60%);color:var(--__P__-accent);font-size:calc(13px * var(--__P__-text-scale));font-weight:600;letter-spacing:.025em;user-select:none}.__P__-bubble-row[data-role=operator] .__P__-bubble-body{flex:1 1 auto;min-width:0;padding:var(--__P__-space-3) var(--__P__-space-4)}.__P__-bubble-col{display:flex;flex-direction:column;max-width:85%;min-width:0}.__P__-bubble-row[data-role=user] .__P__-bubble-col{align-items:flex-end}.__P__-bubble-row[data-role=assistant] .__P__-bubble-col{align-items:flex-start}.__P__-bubble-row[data-role=assistant] .__P__-bubble-col:has(.__P__-toolui){width:100%}.__P__-bubble-row[data-role=assistant] .__P__-bubble-col:has(.__P__-toolui) .__P__-bubble{width:100%}@media(max-width:640px){.__P__-bubble-col{max-width:92%}.__P__-toolui:not(.__P__-toolui-collapsible){padding:var(--__P__-space-3);gap:var(--__P__-space-2)}details.__P__-toolui-collapsible>summary{padding:var(--__P__-space-2) var(--__P__-space-3)}details.__P__-toolui-collapsible>.__P__-toolui-section{margin:var(--__P__-space-3)}.__P__-toolui-section,.__P__-toolui-desc{padding:var(--__P__-space-2) var(--__P__-space-3)}}.__P__-bubble-meta{display:flex;align-items:center;gap:8px;margin-top:2px;padding:0 2px;min-height:24px}.__P__-bubble-actions{display:flex;align-items:center;gap:2px}.__P__-bubble-time{font-size:calc(11px * var(--__P__-text-scale));line-height:1;color:var(--__P__-fg-muted);user-select:none}.__P__-feedback{display:flex;align-items:center;gap:2px}.__P__-msg-action{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border:0;border-radius:var(--__P__-radius-sm);background:transparent;color:var(--__P__-fg-muted);cursor:pointer;opacity:.65;transition:opacity var(--__P__-dur-quick) var(--__P__-ease),background var(--__P__-dur-quick) var(--__P__-ease),color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-msg-action:hover{opacity:1;background:var(--__P__-bg-elevated);color:var(--__P__-fg)}.__P__-msg-action:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;opacity:1}.__P__-msg-action[data-active=true]{opacity:1;color:var(--__P__-accent-fg)}.__P__-msg-action svg{width:15px;height:15px}.__P__-md>*:first-child{margin-top:0}.__P__-md>*:last-child{margin-bottom:0}.__P__-md p{margin:10px 0}.__P__-md h1,.__P__-md h2,.__P__-md h3,.__P__-md h4,.__P__-md h5,.__P__-md h6{margin:18px 0 8px;line-height:1.3;letter-spacing:-.01em;font-weight:700}.__P__-md h1{font-size:1.4em}.__P__-md h2{font-size:1.22em}.__P__-md h3{font-size:1.08em}.__P__-md h4,.__P__-md h5,.__P__-md h6{font-size:1em}.__P__-md>h1:first-child,.__P__-md>h2:first-child,.__P__-md>h3:first-child,.__P__-md>h4:first-child,.__P__-md>h5:first-child,.__P__-md>h6:first-child{margin-top:0}.__P__-md ul,.__P__-md ol{padding-inline-start:1.5em;margin:10px 0}.__P__-md ul{list-style:disc}.__P__-md ol{list-style:decimal}.__P__-md li{margin:6px 0;padding-inline-start:2px}.__P__-md li::marker{color:var(--__P__-fg-muted)}.__P__-md li>p{margin:6px 0}.__P__-md li>ul,.__P__-md li>ol{margin:6px 0}.__P__-md strong,.__P__-md b{font-weight:650;letter-spacing:-.005em}.__P__-md em,.__P__-md i{font-style:italic}.__P__-md code{font-family:var(--__P__-font-mono);font-size:.86em;padding:1px 6px;border-radius:5px;background:color-mix(in srgb,var(--__P__-accent) 10%,transparent);color:var(--__P__-fg);border:1px solid color-mix(in srgb,var(--__P__-accent) 16%,transparent)}.__P__-md pre{font-family:var(--__P__-font-mono);font-size:calc(12.5px * var(--__P__-text-scale));padding:12px 14px;border-radius:var(--__P__-radius-sm);background:#7f7f7f1f;overflow-x:auto;margin:var(--__P__-space-3) 0;line-height:1.5}.__P__-md pre code{padding:0;background:none}.__P__-md a{color:inherit;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px}.__P__-md a:hover{text-decoration-thickness:2px}.__P__-md blockquote{margin:14px 0;padding:6px 14px;border-inline-start:3px solid color-mix(in srgb,var(--__P__-accent) 50%,transparent);background:color-mix(in srgb,var(--__P__-accent) 5%,transparent);border-start-end-radius:var(--__P__-radius-sm);border-end-end-radius:var(--__P__-radius-sm);color:var(--__P__-fg-muted)}.__P__-md blockquote>:first-child{margin-top:0}.__P__-md blockquote>:last-child{margin-bottom:0}.__P__-md hr{border:0;height:1px;background:color-mix(in srgb,currentColor 18%,transparent);margin:var(--__P__-space-4) 0}.__P__-md table{border-collapse:collapse;margin:var(--__P__-space-3) 0;font-size:.95em;display:block;overflow-x:auto;max-width:100%;font-variant-numeric:tabular-nums}.__P__-md th,.__P__-md td{padding:6px 10px;border-bottom:1px solid color-mix(in srgb,currentColor 12%,transparent);text-align:start}.__P__-md th{font-weight:700;background:color-mix(in srgb,currentColor 6%,transparent)}.__P__-md h1+ul,.__P__-md h1+ol,.__P__-md h2+ul,.__P__-md h2+ol,.__P__-md h3+ul,.__P__-md h3+ol,.__P__-md h4+ul,.__P__-md h4+ol{margin-top:var(--__P__-space-1)}.__P__-loading{display:inline-flex;align-items:center;gap:var(--__P__-space-2);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm)}.__P__-loading-spinner{width:14px;height:14px;border-radius:999px;border:2px solid currentColor;border-top-color:transparent;animation:__P__-spin .8s linear infinite}@keyframes __P__-spin{to{transform:rotate(1turn)}}.__P__-typing{display:inline-flex;gap:var(--__P__-space-1);padding:var(--__P__-space-1) 0}.__P__-typing span{width:5px;height:5px;border-radius:999px;background:currentColor;opacity:.4;animation:__P__-blink 1.2s var(--__P__-ease) infinite}.__P__-typing span:nth-child(2){animation-delay:.2s}.__P__-typing span:nth-child(3){animation-delay:.4s}@keyframes __P__-blink{0%,80%,to{opacity:.3;transform:translateY(0)}40%{opacity:1;transform:translateY(-2px)}}.__P__-reasoning{margin:var(--__P__-space-1) 0 var(--__P__-space-2);padding-inline-start:var(--__P__-space-3);border-inline-start:2px solid var(--__P__-border-strong)}.__P__-reasoning-summary{display:inline-flex;align-items:center;gap:var(--__P__-space-1);cursor:pointer;list-style:none;user-select:none;color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs);font-weight:600}.__P__-reasoning-summary:hover{color:var(--__P__-fg)}.__P__-reasoning-summary:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;border-radius:var(--__P__-radius-sm)}.__P__-reasoning-summary::-webkit-details-marker{display:none}.__P__-reasoning-summary:before{content:"";width:5px;height:5px;border-inline-end:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(-45deg);opacity:.7;transition:transform var(--__P__-dur-quick) var(--__P__-ease)}.__P__-reasoning[open] .__P__-reasoning-summary:before{transform:rotate(45deg)}.__P__-reasoning[data-active=true] .__P__-reasoning-label{animation:__P__-reasoning-pulse 1.4s var(--__P__-ease) infinite}@keyframes __P__-reasoning-pulse{0%,to{opacity:.5}50%{opacity:1}}@media(prefers-reduced-motion:reduce){.__P__-reasoning[data-active=true] .__P__-reasoning-label{animation:none}}.__P__-reasoning-body{margin-top:var(--__P__-space-1);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm)}.__P__-reasoning-body>:first-child{margin-top:0}.__P__-reasoning-body>:last-child{margin-bottom:0}.__P__-source{display:inline-flex;align-items:center;gap:6px;max-width:100%;margin-top:6px;margin-inline-end:6px;padding:var(--__P__-space-1) var(--__P__-space-2);border-radius:999px;background:var(--__P__-bg-elevated);border:1px solid var(--__P__-border);color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs);text-decoration:none}a.__P__-source:hover{color:var(--__P__-fg);border-color:var(--__P__-accent)}.__P__-source-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-composer{border-top:1px solid var(--__P__-border);padding:10px 12px;background:var(--__P__-bg);display:flex;flex-direction:column;gap:var(--__P__-space-2)}.__P__-composer>*{width:100%;max-width:var(--__P__-conversation-max, 768px);margin-inline:auto}.__P__-composer-row{display:flex;align-items:flex-end;gap:6px}.__P__-textarea{flex:1;--__P__-textarea-base-height: 40px;height:var(--__P__-textarea-base-height);max-height:160px;padding:10px 12px;border-radius:var(--__P__-radius);background:var(--__P__-bg-elevated);border:1px solid transparent;font-size:calc(14px * var(--__P__-text-scale));line-height:1.4;transition:height var(--__P__-dur-quick) var(--__P__-ease),border-color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-textarea:focus-visible{outline:none;border-color:var(--__P__-focus)}@media(pointer:coarse){.__P__-textarea{--__P__-textarea-base-height: 44px}}.__P__-send{width:40px;height:40px;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;transition:opacity var(--__P__-dur-quick) var(--__P__-ease),transform var(--__P__-dur-quick) var(--__P__-ease),background var(--__P__-dur-quick) var(--__P__-ease)}.__P__-send[data-shape=circle]{border-radius:999px}.__P__-send[data-shape=square]{border-radius:var(--__P__-radius-sm)}.__P__-send[data-shape=pill]{width:auto;padding:0 18px;border-radius:999px}.__P__-send[data-variant=filled]{background:var(--__P__-accent);color:var(--__P__-accent-text)}.__P__-send[data-variant=outline]{background:transparent;color:var(--__P__-accent-fg);border-color:var(--__P__-accent)}.__P__-send[data-variant=outline]:not(:disabled):hover{background:color-mix(in srgb,var(--__P__-accent) 10%,transparent)}.__P__-send[data-variant=ghost]{background:transparent;color:var(--__P__-accent-fg)}.__P__-send[data-variant=ghost]:not(:disabled):hover{background:color-mix(in srgb,var(--__P__-accent) 8%,transparent)}.__P__-send:disabled{opacity:.4;cursor:not-allowed}.__P__-send:not(:disabled):hover{transform:translateY(-1px)}.__P__-send:not(:disabled):active{transform:translateY(0)}.__P__-send:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-send svg{width:18px;height:18px}.__P__-composer-actions{display:flex;gap:var(--__P__-space-1);flex-wrap:wrap}.__P__-attachments{display:flex;flex-wrap:wrap;gap:6px}.__P__-attachment-chip{display:inline-flex;align-items:center;gap:6px;padding:var(--__P__-space-1) var(--__P__-space-2) var(--__P__-space-1) var(--__P__-space-1);border-radius:999px;background:var(--__P__-bg-elevated);border:1px solid var(--__P__-border);font-size:var(--__P__-text-xs);max-width:200px}.__P__-attachment-thumb{width:24px;height:24px;border-radius:999px;object-fit:cover;background:var(--__P__-border)}.__P__-attachment-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.__P__-attachment-remove{width:18px;height:18px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;color:var(--__P__-fg-muted)}.__P__-attachment-remove:hover{background:var(--__P__-border);color:var(--__P__-fg)}.__P__-dropzone{position:absolute;inset:8px;border:2px dashed var(--__P__-accent);border-radius:var(--__P__-radius);background:color-mix(in srgb,var(--__P__-accent) 8%,transparent);display:flex;align-items:center;justify-content:center;font-weight:600;color:var(--__P__-accent-fg);pointer-events:none;z-index:10;animation:__P__-fade-in var(--__P__-dur-quick) var(--__P__-ease)}@keyframes __P__-fade-in{0%{opacity:0}to{opacity:1}}.__P__-error{margin-top:var(--__P__-space-1);padding:8px 12px;border-radius:var(--__P__-radius-sm);background:color-mix(in oklab,var(--__P__-danger) 8%,var(--__P__-bg-elevated));border:1px solid color-mix(in oklab,var(--__P__-danger) 20%,transparent);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);display:flex;align-items:center;gap:var(--__P__-space-2)}.__P__-error span{min-width:0}.__P__-error button{margin-inline-start:auto;flex-shrink:0;border:0;background:none;padding:0;color:var(--__P__-accent-fg);font:inherit;font-size:var(--__P__-text-sm);font-weight:600;text-decoration:underline;white-space:nowrap;cursor:pointer}.__P__-history{flex:1;overflow-y:auto;padding:var(--__P__-space-2) var(--__P__-space-1) var(--__P__-space-3)}.__P__-history-footer{flex:none;padding:var(--__P__-space-2) var(--__P__-space-3) var(--__P__-space-3);border-top:1px solid var(--__P__-border);background:var(--__P__-surface)}.__P__-history-new{width:100%;display:flex;align-items:center;justify-content:center;gap:var(--__P__-space-2);padding:var(--__P__-space-2) var(--__P__-space-3);border:none;border-radius:var(--__P__-radius-md);background:var(--__P__-accent);color:var(--__P__-on-accent);cursor:pointer;font-size:var(--__P__-text-sm);font-weight:600;transition:filter var(--__P__-dur-quick) var(--__P__-ease-out),transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-history-new svg{width:16px;height:16px}.__P__-history-new:hover{filter:brightness(1.08)}.__P__-history-new:active{transform:translateY(1px)}.__P__-history-new:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-history-empty{flex:1;display:flex;align-items:center;justify-content:center;padding:40px 16px;color:var(--__P__-fg-muted);font-size:calc(14px * var(--__P__-text-scale));text-align:center}.__P__-history-group{display:flex;flex-direction:column;padding:0 var(--__P__-space-3)}.__P__-history-heading{font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted);padding:14px 4px 8px;text-transform:uppercase;letter-spacing:.04em}.__P__-history-card{display:flex;flex-direction:column;background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-lg, 14px);overflow:hidden}.__P__-history-item{all:unset;display:flex;align-items:center;gap:var(--__P__-space-3);padding:12px var(--__P__-space-3);cursor:pointer;transition:background var(--__P__-dur-base) var(--__P__-ease)}.__P__-history-item+.__P__-history-item{border-top:1px solid var(--__P__-border)}.__P__-history-item:hover{background:var(--__P__-bg-elevated)}.__P__-history-item:focus-visible{background:var(--__P__-bg-elevated);outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-history-avatar{flex:none;display:grid;place-items:center;width:36px;height:36px;border-radius:50%;background:color-mix(in oklab,var(--__P__-accent) 12%,transparent);color:var(--__P__-accent-fg)}.__P__-history-avatar svg{width:18px;height:18px}.__P__-history-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.__P__-history-row{display:flex;align-items:center;justify-content:space-between;gap:var(--__P__-space-2)}.__P__-history-title{flex:1;min-width:0;font-size:calc(14px * var(--__P__-text-scale));font-weight:500;color:var(--__P__-fg);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-history-time{flex:none;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted)}.__P__-history-preview{flex:1;min-width:0;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-history-dot{flex:none;width:8px;height:8px;border-radius:50%;background:var(--__P__-accent)}.__P__-history-item[data-unread=true] .__P__-history-title{font-weight:600}.__P__-history-item[data-closed=true] .__P__-history-title{color:var(--__P__-fg-muted)}.__P__-history-item-skeleton{cursor:default;pointer-events:none}.__P__-skeleton{display:block;border-radius:4px;background:linear-gradient(90deg,color-mix(in oklab,var(--__P__-fg) 9%,transparent) 30%,color-mix(in oklab,var(--__P__-fg) 17%,transparent),color-mix(in oklab,var(--__P__-fg) 9%,transparent) 70%);background-size:200% 100%;animation:__P__-skeleton-shimmer 1.8s ease-in-out infinite}.__P__-history-avatar.__P__-skeleton{border-radius:50%}.__P__-skeleton-heading{width:52px;height:8px}.__P__-skeleton-title{width:55%;height:12px}.__P__-skeleton-time{width:34px;height:10px}.__P__-skeleton-preview{width:80%;height:10px}@keyframes __P__-skeleton-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media(prefers-reduced-motion:reduce){.__P__-skeleton{animation:none}}.__P__-list-loading{margin:auto;padding:var(--__P__-space-6) var(--__P__-space-4);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);text-align:center}.__P__-readonly-banner{display:flex;flex-direction:column;align-items:center;gap:10px;padding:14px 12px;margin:0 var(--__P__-space-3) var(--__P__-space-3);border-radius:var(--__P__-radius-md);background:var(--__P__-bg-elevated);color:var(--__P__-fg-muted);text-align:center;font-size:var(--__P__-text-sm)}.__P__-readonly-label{line-height:1.4}.__P__-readonly-cta{appearance:none;border:0;cursor:pointer;padding:var(--__P__-space-2) var(--__P__-space-4);border-radius:999px;background:var(--__P__-accent);color:var(--__P__-accent-text, #fff);font:inherit;font-weight:600;font-size:var(--__P__-text-sm);transition:filter var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-readonly-cta:hover,.__P__-readonly-cta:focus-visible{filter:brightness(1.1)}.__P__-operator-banner{display:flex;align-items:center;justify-content:center;gap:8px;margin:0 var(--__P__-space-3) var(--__P__-space-1);padding:8px 12px;border-radius:var(--__P__-radius-md);background:color-mix(in oklab,var(--__P__-bg-elevated),var(--__P__-accent) 6%);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);line-height:1.3;text-align:center}.__P__-operator-pulse{flex:0 0 auto;width:8px;height:8px;border-radius:50%;background:var(--__P__-accent)}.__P__-operator-banner[data-mode=awaiting_operator] .__P__-operator-pulse{animation:__P__-operator-pulse 1.4s var(--__P__-ease-out) infinite}.__P__-cancel-operator-request{flex:0 0 auto;padding:0;border:0;background:none;color:var(--__P__-accent);font:inherit;font-weight:600;text-decoration:underline;text-underline-offset:2px;cursor:pointer}.__P__-cancel-operator-request:hover{opacity:.8}.__P__-cancel-operator-request:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px;border-radius:var(--__P__-radius-sm)}@keyframes __P__-operator-pulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.4;transform:scale(.7)}}.__P__-readonly-cta:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px}.__P__-composer-footer{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:10px 16px;margin:0 var(--__P__-space-3);border-top:1px solid var(--__P__-border);text-align:center;font-size:calc(11px * var(--__P__-text-scale));line-height:1.4;color:var(--__P__-fg-muted)}.__P__-disclaimer{max-width:320px;margin:0 auto;opacity:.9;letter-spacing:.01em}.__P__-poweredby{display:inline-flex;align-items:center;justify-content:center;gap:6px;color:inherit;text-decoration:none;opacity:.7;transition:opacity var(--__P__-dur-base) var(--__P__-ease);font-size:calc(11px * var(--__P__-text-scale));letter-spacing:.02em}.__P__-poweredby:hover{opacity:1}.__P__-poweredby-logo{height:12px;width:auto;display:inline-block;vertical-align:middle}.__P__-poweredby-bar{flex:none;display:flex;align-items:center;justify-content:center;padding:6px 16px;border-top:1px solid var(--__P__-border);background:var(--__P__-bg-elevated)}.__P__-menu-wrap{position:relative;display:inline-flex}.__P__-menu{position:absolute;top:100%;inset-inline-end:0;margin-top:6px;min-width:200px;padding:6px;background:var(--__P__-bg);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);box-shadow:var(--__P__-shadow-panel);z-index:10;display:flex;flex-direction:column;gap:2px;animation:__P__-menu-in var(--__P__-dur-base) var(--__P__-ease)}@media(prefers-reduced-motion:reduce){.__P__-menu{animation:none}}@keyframes __P__-menu-in{0%{opacity:0;transform:translateY(-4px) scale(.98);transform-origin:top right}to{opacity:1;transform:none}}.__P__-menu-item{all:unset;display:flex;align-items:center;gap:10px;padding:8px 10px;font-size:var(--__P__-text-sm);color:var(--__P__-fg);border-radius:var(--__P__-radius-sm);cursor:pointer;user-select:none}.__P__-menu-item:hover{background:var(--__P__-bg-elevated)}.__P__-menu-item:focus-visible{background:var(--__P__-bg-elevated);outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-menu-item[disabled]{opacity:.45;cursor:not-allowed}.__P__-menu-icon{display:inline-flex;width:16px;height:16px;color:var(--__P__-fg-muted)}.__P__-menu-icon svg{width:16px;height:16px}.__P__-menu-label{flex:1}.__P__-menu-check{display:inline-flex;color:var(--__P__-accent-fg)}.__P__-menu-check svg{width:14px;height:14px}.__P__-menu-item-segmented{cursor:default}.__P__-menu-item-segmented:hover{background:transparent}.__P__-segmented{display:inline-flex;gap:2px;padding:2px;background:var(--__P__-bg-elevated);border-radius:var(--__P__-radius-sm)}.__P__-segment{all:unset;min-width:26px;padding:3px 8px;font-size:var(--__P__-text-xs);font-weight:600;letter-spacing:.02em;text-align:center;color:var(--__P__-fg-muted);border-radius:calc(var(--__P__-radius-sm) - 2px);cursor:pointer;transition:color .12s ease,background .12s ease}.__P__-segment:hover{color:var(--__P__-fg)}.__P__-segment[data-on=true]{background:var(--__P__-bg);color:var(--__P__-accent-fg);box-shadow:var(--__P__-shadow-card)}.__P__-segment:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-resize-grip{position:absolute;width:18px;height:18px;display:flex;align-items:center;justify-content:center;color:var(--__P__-fg-muted);opacity:.45;transition:opacity var(--__P__-dur-base) var(--__P__-ease);z-index:2;touch-action:none;user-select:none}.__P__-resize-grip:hover,.__P__-resize-grip:focus-visible{opacity:1}.__P__-resize-grip svg{width:10px;height:10px}.__P__-resize-grip--bottom-left{bottom:2px;left:2px;cursor:nesw-resize;transform:scaleX(-1)}.__P__-resize-grip--bottom-right{bottom:2px;right:2px;cursor:nwse-resize}.__P__-resize-grip--top-left{top:2px;left:2px;cursor:nwse-resize;transform:rotate(180deg)}.__P__-resize-grip--top-right{top:2px;right:2px;cursor:nesw-resize;transform:scaleY(-1)}:host(:not([data-mode="open"])) .__P__-resize-grip{display:none}.__P__-messenger{display:flex;flex-direction:column;overflow:hidden}.__P__-messenger-body,.__P__-messenger-pane{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.__P__-messenger-pane[hidden]{display:none}@keyframes __P__-view-in{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}.__P__-module{display:flex;flex-direction:column;height:100%;min-height:0}@media(prefers-reduced-motion:no-preference){.__P__-module,.__P__-history{animation:__P__-view-in .18s var(--__P__-ease-out)}}.__P__-module-scroll{flex:1;min-height:0;overflow-y:auto;padding:var(--__P__-space-3);display:flex;flex-direction:column;gap:var(--__P__-space-3)}.__P__-home{container-type:inline-size;background:radial-gradient(125% 65% at 88% 0%,color-mix(in srgb,#fff 16%,transparent),transparent 55%),linear-gradient(180deg,var(--__P__-accent) 0%,var(--__P__-accent) 22%,color-mix(in srgb,var(--__P__-accent) 28%,var(--__P__-surface)) 44%,var(--__P__-surface) 70%);border-radius:var(--__P__-radius-lg) var(--__P__-radius-lg) 0 0}.__P__-home-scroll{flex:1;min-height:0;overflow-y:auto;display:flex;flex-direction:column;background:transparent}.__P__-home-cards{display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:4px 14px 16px}.__P__-module-pad{padding:var(--__P__-space-3) var(--__P__-space-3) 0}.__P__-module-empty{display:flex;flex-direction:column;align-items:center;gap:var(--__P__-space-3);padding:var(--__P__-space-8) var(--__P__-space-4);text-align:center;color:var(--__P__-fg-muted);font-size:var(--__P__-text-base)}.__P__-module-retry{padding:var(--__P__-space-2) var(--__P__-space-4);border:1px solid var(--__P__-border-strong);border-radius:var(--__P__-radius-sm);color:var(--__P__-fg);font-weight:600;cursor:pointer;transition:background var(--__P__-dur-quick) var(--__P__-ease-out),border-color var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-module-retry:hover{background:var(--__P__-hover);border-color:var(--__P__-accent)}.__P__-module-retry:active{background:var(--__P__-border)}.__P__-module-retry:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-help-list{flex:1;min-height:0;overflow-y:auto;padding-bottom:var(--__P__-space-3)}.__P__-help-group{display:flex;flex-direction:column}.__P__-help-section-title{position:sticky;top:0;z-index:1;margin:0;padding:var(--__P__-space-3) var(--__P__-space-5) var(--__P__-space-2);font-size:var(--__P__-text-xs);font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--__P__-fg-muted);background:var(--__P__-bg)}.__P__-help-card{margin:0 var(--__P__-space-3) var(--__P__-space-3);background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);overflow:hidden}.__P__-help-card .__P__-list-row{border-bottom:0;border-radius:0}.__P__-help-card .__P__-list-row+.__P__-list-row{border-top:1px solid var(--__P__-border)}.__P__-tabbar{display:flex;border-top:1px solid var(--__P__-border);background:var(--__P__-bg-elevated);flex-shrink:0}.__P__-tab{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--__P__-space-1);min-height:48px;padding:var(--__P__-space-2) var(--__P__-space-1);color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs);font-weight:600;transition:color var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-tab:hover{color:var(--__P__-fg)}.__P__-tab[aria-selected=true]{color:var(--__P__-accent-fg)}.__P__-tab:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-tab:active{background:var(--__P__-hover)}.__P__-tab-icon{position:relative;display:inline-flex}.__P__-tab-icon svg{width:22px;height:22px}.__P__-tab-badge{position:absolute;top:-2px;left:calc(50% + 6px);width:8px;height:8px;border-radius:50%;background:var(--__P__-accent);box-shadow:0 0 0 2px var(--__P__-bg-elevated)}.__P__-home-hero{flex-shrink:0;padding:var(--__P__-space-5) var(--__P__-space-5) var(--__P__-space-3);color:var(--__P__-on-accent);--__P__-focus: var(--__P__-on-accent)}.__P__-home-hero-top{display:flex;align-items:center;justify-content:space-between;gap:var(--__P__-space-3);min-height:32px}.__P__-home-brand{font-size:clamp(calc(12px * var(--__P__-text-scale)),calc(3.2cqi * var(--__P__-text-scale)),calc(14px * var(--__P__-text-scale)));font-weight:600;letter-spacing:.01em;color:color-mix(in srgb,#fff 82%,transparent);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.__P__-home-brand-spacer{flex:1}.__P__-home-hero-actions{display:flex;align-items:center;gap:var(--__P__-space-2);flex-shrink:0}.__P__-home-hero-actions .__P__-icon-btn{color:#fff}.__P__-home-hero-actions .__P__-icon-btn:hover{background:color-mix(in srgb,#fff 18%,transparent);color:#fff}.__P__-home-hero-actions .__P__-icon-btn:active{background:color-mix(in srgb,#fff 26%,transparent)}.__P__-home-greeting{margin:28px 0 0;font-family:var(--__P__-font-display);font-size:clamp(calc(19px * var(--__P__-text-scale)),calc(5.5cqi * var(--__P__-text-scale)),var(--__P__-text-2xl));font-weight:800;line-height:1.18;letter-spacing:-.01em;overflow-wrap:anywhere}.__P__-home-lead{margin:10px 0 0;font-family:var(--__P__-font-display);font-size:clamp(calc(15px * var(--__P__-text-scale)),calc(4.2cqi * var(--__P__-text-scale)),var(--__P__-text-xl));font-weight:600;line-height:1.25;letter-spacing:-.005em;color:color-mix(in srgb,var(--__P__-on-accent) 78%,transparent);overflow-wrap:anywhere}.__P__-home-avatars{display:flex}.__P__-home-avatar{width:30px;height:30px;border-radius:999px;overflow:hidden;margin-inline-start:-10px;border:2px solid color-mix(in srgb,#fff 92%,transparent);box-shadow:0 1px 3px #0000002e;background:var(--__P__-surface);display:inline-flex;align-items:center;justify-content:center;font-size:var(--__P__-text-xs);font-weight:700;color:var(--__P__-fg)}.__P__-home-avatar:first-child{margin-inline-start:0}.__P__-home-avatar img{width:100%;height:100%;object-fit:cover}.__P__-home-content{background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);box-shadow:var(--__P__-shadow-card);overflow:hidden}.__P__-home-content-title{padding:var(--__P__-space-4) var(--__P__-space-4) var(--__P__-space-3);font-size:var(--__P__-text-sm);font-weight:700}.__P__-home-content-list{display:flex;flex-direction:column;padding:0 var(--__P__-space-2) var(--__P__-space-2)}.__P__-home-content-list .__P__-list-row+.__P__-list-row{border-top:1px solid var(--__P__-border)}.__P__-home-card{display:block;width:100%;text-align:start;background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);padding:var(--__P__-space-4);box-shadow:var(--__P__-shadow-card)}.__P__-home-card[data-interactive=true]{cursor:pointer;transition:background var(--__P__-dur-quick) var(--__P__-ease-out),transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-home-card[data-interactive=true]:hover{background:var(--__P__-bg-elevated)}.__P__-home-card[data-interactive=true]:active{transform:translateY(1px)}.__P__-home-card[data-interactive=true]:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-home-recent-row{display:flex;align-items:center;gap:var(--__P__-space-3)}.__P__-home-recent-avatar{display:inline-flex;align-items:center;justify-content:center;width:38px;height:38px;flex-shrink:0;border-radius:999px;background:color-mix(in oklch,var(--__P__-accent) 14%,transparent);color:var(--__P__-accent-fg)}.__P__-home-recent-avatar svg{width:20px;height:20px}.__P__-home-recent-body{display:flex;flex-direction:column;gap:3px;min-width:0;flex:1}.__P__-home-recent-title{font-weight:600;font-size:calc(14px * var(--__P__-text-scale))}.__P__-home-recent-preview{color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.__P__-home-recent-dot{width:8px;height:8px;border-radius:999px;background:var(--__P__-accent);flex-shrink:0}.__P__-home-recent-row[data-unread=true] .__P__-home-recent-title{font-weight:700}.__P__-home-status{display:flex;align-items:center;gap:var(--__P__-space-3)}.__P__-home-status-icon svg{width:22px;height:22px;color:var(--__P__-success)}.__P__-home-status[data-level=degraded] .__P__-home-status-icon svg{color:var(--__P__-warning)}.__P__-home-status[data-level=down] .__P__-home-status-icon svg{color:var(--__P__-danger)}.__P__-home-status-text{font-weight:600;font-size:calc(14px * var(--__P__-text-scale))}.__P__-home-search{display:flex;align-items:center;gap:var(--__P__-space-2);width:100%;padding:var(--__P__-space-3) var(--__P__-space-4);border-radius:var(--__P__-radius);border:1px solid var(--__P__-border);background:var(--__P__-surface);text-align:start}.__P__-home-search[data-input=true]{background:var(--__P__-bg-elevated)}.__P__-home-search:hover{border-color:var(--__P__-border-strong)}.__P__-home-search:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-home-search[data-input=true]:focus-within{outline:none;border-color:var(--__P__-focus)}.__P__-home-search-text{flex:1;color:var(--__P__-fg-muted);font-size:calc(14px * var(--__P__-text-scale))}.__P__-home-search-input{flex:1;border:0;background:transparent;font-size:calc(14px * var(--__P__-text-scale));color:var(--__P__-fg);outline:none}.__P__-home-search-input:focus-visible{outline:none}.__P__-home-search-icon svg{width:18px;height:18px;color:var(--__P__-accent-fg)}.__P__-list-row{display:flex;align-items:center;gap:var(--__P__-space-3);width:100%;min-height:44px;text-align:start;padding:var(--__P__-space-3) var(--__P__-space-2);border-radius:var(--__P__-radius-sm)}.__P__-list-row:hover{background:var(--__P__-hover)}.__P__-list-row:active{background:var(--__P__-border)}.__P__-list-row:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-list-row-body{display:flex;flex-direction:column;min-width:0;flex:1}.__P__-list-row-title{font-weight:600;font-size:var(--__P__-text-md);line-height:1.35}.__P__-list-row-sub{color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);margin-top:var(--__P__-space-1);line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.__P__-list-row-chevron svg{width:18px;height:18px;color:var(--__P__-accent-fg);flex-shrink:0}.__P__-back-header{display:flex;align-items:center;gap:var(--__P__-space-2);padding:10px 12px;border-bottom:1px solid var(--__P__-border);flex-shrink:0}.__P__-back-title{flex:1;text-align:center;font-size:var(--__P__-text-md);font-weight:700;margin:0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-back-spacer{width:32px;height:1px}.__P__-history>*,.__P__-home-scroll>*,.__P__-module-scroll>*,.__P__-help-list>*,.__P__-history-footer>*,.__P__-module-pad{width:100%;max-width:var(--__P__-conversation-max, 768px);margin-inline:auto}.__P__-header,.__P__-back-header{padding-inline:max(12px,calc((100% - var(--__P__-conversation-max, 768px)) / 2))}.__P__-tabbar{padding-inline:max(0px,calc((100% - var(--__P__-conversation-max, 768px)) / 2))}.__P__-content{display:flex;flex-direction:column;gap:14px;width:100%;max-width:68ch;margin:0 auto}.__P__-content-hero{width:100%;border-radius:var(--__P__-radius)}.__P__-content-subtitle{color:var(--__P__-fg-muted);margin:0}.__P__-content-frame{flex:1;min-height:0;width:100%;border:0;background:#fff}.__P__-news-list{display:flex;flex-direction:column;gap:var(--__P__-space-3)}.__P__-news-card{display:block;width:100%;text-align:start;border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);overflow:hidden;background:var(--__P__-surface)}.__P__-news-card{transition:background var(--__P__-dur-quick) var(--__P__-ease-out),transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-news-card:hover{background:var(--__P__-bg-elevated)}.__P__-news-card:active{transform:translateY(1px)}.__P__-news-card:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-news-hero{width:100%;display:block}.__P__-news-body{display:flex;flex-direction:column;gap:6px;padding:14px 16px}.__P__-news-title{font-weight:700;font-size:var(--__P__-text-md)}.__P__-news-summary{color:var(--__P__-fg-muted);font-size:calc(14px * var(--__P__-text-scale));display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.__P__-modules-empty{display:flex;align-items:center;justify-content:center;position:relative}.__P__-modules-empty-close{position:absolute;top:12px;inset-inline-end:12px}.__P__-modules-empty-text{color:var(--__P__-fg-muted);font-size:var(--__P__-text-base)}.__P__-form{display:flex;flex-direction:column;gap:var(--__P__-space-4)}.__P__-field{display:flex;flex-direction:column;gap:6px}.__P__-field-head{display:flex;flex-wrap:wrap;align-items:baseline;gap:var(--__P__-space-2)}.__P__-field-label{font-size:var(--__P__-text-sm);font-weight:600;color:var(--__P__-fg)}.__P__-field-req{color:var(--__P__-danger)}.__P__-field-type{flex-shrink:0;align-self:center;margin-inline-start:auto;border:1px solid var(--__P__-border);border-radius:5px;background:color-mix(in oklab,var(--__P__-fg-muted) 9%,transparent);padding:1px 7px;font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted);white-space:nowrap}.__P__-field-input{width:100%;min-width:0;max-width:100%;box-sizing:border-box;padding:10px var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);color:var(--__P__-fg);font:inherit;font-size:var(--__P__-text-sm);resize:vertical;transition:border-color var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-field-input:focus-visible{outline:none;border-color:var(--__P__-accent)}.__P__-field[data-invalid=true] .__P__-field-input{border-color:var(--__P__-danger)}.__P__-field-input[type=date],.__P__-field-input[type=time]{appearance:none;-webkit-appearance:none}@media(pointer:coarse){.__P__-textarea,.__P__-home-search-input,.__P__-field-input{font-size:max(16px,calc(16px * var(--__P__-text-scale)))}}.__P__-field-hint{font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted)}.__P__-field-error{font-size:var(--__P__-text-xs);color:var(--__P__-danger)}.__P__-field-choices{display:flex;flex-direction:column;gap:10px;padding-top:2px}.__P__-choice{display:flex;align-items:flex-start;gap:10px;font-size:var(--__P__-text-sm);color:var(--__P__-fg);cursor:pointer}.__P__-choice input{margin-top:2px;accent-color:var(--__P__-accent)}.__P__-form-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:var(--__P__-space-2);margin-top:var(--__P__-space-2)}.__P__-form-hint{flex:1 1 auto;min-width:6rem;margin-inline-end:auto;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted)}.__P__-form-submit{padding:var(--__P__-space-2) var(--__P__-space-4);border:none;border-radius:var(--__P__-radius-md);background:var(--__P__-accent);color:var(--__P__-accent-text, #fff);font:inherit;font-weight:600;font-size:var(--__P__-text-sm);white-space:nowrap;flex-shrink:0;cursor:pointer;transition:filter var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-form-submit:hover:not(:disabled){filter:brightness(1.06)}.__P__-form-submit:disabled{opacity:.6;cursor:default}.__P__-form-skip{padding:var(--__P__-space-2) var(--__P__-space-4);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:transparent;color:var(--__P__-fg-muted);font:inherit;font-size:var(--__P__-text-sm);white-space:nowrap;flex-shrink:0;cursor:pointer;transition:background var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-form-skip:hover:not(:disabled){background:var(--__P__-bg-elevated)}@media(max-width:640px){.__P__-form-hint{flex-basis:100%;margin-inline-end:0;font-size:var(--__P__-text-xs)}.__P__-form-submit,.__P__-form-skip{flex:1 1 0;text-align:center}}.__P__-form-gate{display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:var(--__P__-space-4);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:var(--__P__-bg-elevated)}.__P__-form-gate-title{margin:0;font-size:var(--__P__-text-base);font-weight:700;color:var(--__P__-fg)}.__P__-form-gate-desc{margin:0 0 var(--__P__-space-1);font-size:var(--__P__-text-sm);color:var(--__P__-fg-muted)}.__P__-form-done{display:flex;align-items:center;justify-content:center;gap:6px;padding:6px 12px;border:1px dashed var(--__P__-border);border-radius:999px;align-self:center;font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted)}.__P__-form-done svg{width:14px;height:14px;color:var(--__P__-success, #22c55e)}.__P__-form-done[data-outcome=skipped] svg{color:var(--__P__-fg-muted)}.__P__-form-done-fill{border:0;background:none;padding:0 2px;cursor:pointer;font:inherit;font-weight:600;color:var(--__P__-accent-fg)}.__P__-form-done-fill:hover{text-decoration:underline}details.__P__-form-done{display:block;padding:0;border-radius:var(--__P__-radius-md)}details[open].__P__-form-done{width:min(100%,420px);background:var(--__P__-surface)}.__P__-form-done-summary{display:flex;align-items:center;justify-content:center;gap:6px;padding:8px 12px;cursor:pointer;list-style:none}.__P__-form-done-summary::-webkit-details-marker{display:none}.__P__-form-done-summary>svg:last-child{color:var(--__P__-fg-muted);transition:transform .15s var(--__P__-ease)}details[open]>.__P__-form-done-summary>svg:last-child{transform:rotate(90deg)}.__P__-form-answers{margin:0;padding:var(--__P__-space-2) var(--__P__-space-3) var(--__P__-space-3);display:grid;gap:var(--__P__-space-3);text-align:start}.__P__-form-answer{display:grid;gap:6px}.__P__-form-answer dt{font-size:var(--__P__-text-sm);font-weight:600;color:var(--__P__-fg)}.__P__-form-answer dd{margin:0;padding:10px var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);font-size:var(--__P__-text-sm);font-weight:400;color:var(--__P__-fg);overflow-wrap:anywhere}.__P__-toolui{margin-block:var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-lg, 14px);background:var(--__P__-bg-elevated);font-size:var(--__P__-text-sm)}.__P__-toolui:not(.__P__-toolui-collapsible){display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:var(--__P__-space-4)}.__P__-toolui-group{display:flex;flex-direction:column;gap:var(--__P__-space-3);margin-block:var(--__P__-space-3)}.__P__-toolui-group>.__P__-toolui{margin-block:0}.__P__-toolui-stale{opacity:.7}details.__P__-toolui-collapsible>summary{display:flex;align-items:center;gap:var(--__P__-space-2);padding:var(--__P__-space-3) var(--__P__-space-4);cursor:pointer;list-style:none;-webkit-tap-highlight-color:transparent;user-select:none}details.__P__-toolui-collapsible>summary::-webkit-details-marker{display:none}details.__P__-toolui-collapsible[open]>summary{border-bottom:1px solid var(--__P__-border)}details.__P__-toolui-collapsible>.__P__-toolui-section{margin:var(--__P__-space-4)}details.__P__-toolui-collapsible>.__P__-toolui-section~.__P__-toolui-section{margin-top:calc(-1 * var(--__P__-space-2))}.__P__-toolui-name-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-toolui-chevron{display:inline-flex;color:var(--__P__-fg-muted);transition:transform var(--__P__-dur-quick) var(--__P__-ease-out)}details.__P__-toolui-collapsible>summary .__P__-toolui-status{margin-inline-start:auto}.__P__-toolui-chevron svg{width:16px;height:16px}details.__P__-toolui-collapsible[open]>summary .__P__-toolui-chevron{transform:rotate(180deg)}.__P__-toolui-badge,.__P__-toolui-name-pill,.__P__-toolui-q-pill{--__P__-pill: var(--__P__-fg-muted);display:inline-flex;min-width:0;align-items:center;gap:5px;padding:3px 7px;border-radius:5px;border:1px solid var(--__P__-border);background:color-mix(in oklab,var(--__P__-fg-muted) 9%,transparent);color:var(--__P__-pill);font-size:var(--__P__-text-xs);font-weight:600;white-space:nowrap}.__P__-toolui-badge svg,.__P__-toolui-name-pill svg,.__P__-toolui-q-pill svg{flex-shrink:0;width:14px;height:14px}.__P__-toolui-status-icon{display:inline-flex}.__P__-toolui-name-pill{--__P__-pill: oklch(.68 .13 233)}.__P__-toolui-q-pill{--__P__-pill: oklch(.66 .12 195)}.__P__-toolui-status[data-status=completed]{--__P__-pill: var(--__P__-success, #16a34a)}.__P__-toolui-status[data-status=responded]{--__P__-pill: oklch(.62 .15 255)}.__P__-toolui-status[data-status=awaiting]{--__P__-pill: var(--__P__-warning, #f59e0b)}.__P__-toolui-status[data-status=denied]{--__P__-pill: oklch(.66 .16 45)}.__P__-toolui-status[data-status=error]{--__P__-pill: var(--__P__-danger, #dc2626)}.__P__-toolui-status[data-status=superseded]{--__P__-pill: var(--__P__-fg-muted)}@supports (color: oklch(from red l c h)){.__P__-toolui-badge,.__P__-toolui-name-pill,.__P__-toolui-q-pill{color:oklch(from var(--__P__-pill) clamp(var(--__P__-pill-l-min),l,var(--__P__-pill-l-max)) c h)}}.__P__-toolui-head{display:flex;align-items:center;flex-wrap:wrap;gap:var(--__P__-space-2)}.__P__-toolui-head-end{display:inline-flex;align-items:center;gap:var(--__P__-space-2);margin-inline-start:auto}.__P__-toolui-collapse-body{display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:var(--__P__-space-4)}.__P__-toolui-summary{display:flex;flex-direction:column;gap:var(--__P__-space-3)}.__P__-toolui-collapse-body>.__P__-form{gap:var(--__P__-space-3)}.__P__-toolui-collapse-body>.__P__-form>.__P__-field,.__P__-toolui-summary>.__P__-field{padding:10px var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:color-mix(in oklab,var(--__P__-bg) 80%,transparent);line-height:1.5}.__P__-toolui-collapse-body>.__P__-form>.__P__-field{gap:var(--__P__-space-2)}.__P__-toolui-summary>.__P__-field{gap:var(--__P__-space-1)}.__P__-toolui-summary .__P__-field-label{color:var(--__P__-fg-muted)}.__P__-toolui-answer{margin:0;font-size:var(--__P__-text-sm);color:var(--__P__-fg-muted);overflow-wrap:anywhere;white-space:pre-wrap}.__P__-toolui-footer{display:flex;align-items:center;justify-content:space-between;gap:var(--__P__-space-3);margin-inline:calc(-1 * var(--__P__-space-4));padding:var(--__P__-space-3) var(--__P__-space-4) 0;border-top:1px solid var(--__P__-border)}.__P__-toolui-options-toggle{display:inline-flex;align-items:center;gap:4px;border:0;background:transparent;padding:0;cursor:pointer;font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted);transition:color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-toolui-options-toggle:hover{color:var(--__P__-fg)}.__P__-toolui-options-chevron{display:inline-flex;transition:transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-toolui-options-chevron svg{width:14px;height:14px}.__P__-toolui-options-chevron.__P__-open{transform:rotate(180deg)}.__P__-toolui-desc{margin:0;padding:var(--__P__-space-3);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);border:1px solid var(--__P__-border);color:var(--__P__-fg-muted);line-height:1.5}.__P__-toolui-section{display:flex;flex-direction:column;gap:8px;padding:var(--__P__-space-3);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);border:1px solid var(--__P__-border)}.__P__-toolui:not(.__P__-toolui-collapsible) .__P__-toolui-section,.__P__-toolui:not(.__P__-toolui-collapsible) .__P__-toolui-desc{padding:0;background:none;border:0;border-radius:0}.__P__-toolui-label{font-size:var(--__P__-text-xs);font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--__P__-fg-muted)}.__P__-toolui-code{margin:0;max-height:240px;overflow:auto;color:var(--__P__-fg);font-family:var(--__P__-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);font-size:var(--__P__-text-xs);line-height:1.5;white-space:pre-wrap;word-break:break-word}.__P__-toolui-code[data-error=true]{color:var(--__P__-danger, #dc2626)}.__P__-toolui-body{gap:6px}.__P__-toolui-prompt{margin:0;font-weight:600;color:var(--__P__-fg);overflow-wrap:anywhere}.__P__-toolui-subtle{margin:0;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted);line-height:1.5}.__P__-toolui-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:var(--__P__-space-2);margin-top:var(--__P__-space-2)}:host([dir="rtl"]) .__P__-icon-dir{transform:scaleX(-1)}:host([dir="rtl"]) .__P__-field-input[type=date],:host([dir="rtl"]) .__P__-field-input[type=time]{position:relative;text-align:right;padding-left:34px}:host([dir="rtl"]) .__P__-field-input[type=date]::-webkit-datetime-edit,:host([dir="rtl"]) .__P__-field-input[type=time]::-webkit-datetime-edit{text-align:right}:host([dir="rtl"]) .__P__-field-input[type=date]::-webkit-calendar-picker-indicator,:host([dir="rtl"]) .__P__-field-input[type=time]::-webkit-calendar-picker-indicator{position:absolute;left:var(--__P__-space-3);margin:0}
|
|
4
4
|
`;var Ks=`.__P__-standalone-page{margin:0;height:100vh;background:var(--__P__-bg, #fff);display:grid;place-items:stretch}
|
|
5
|
-
`;var
|
|
6
|
-
`;var vp="helpai",hp="#5B5BD6",bp="#FFFFFF",yp="12px",Pp="Inter, system-ui, -apple-system, 'Segoe UI', sans-serif",
|
|
7
|
-
`).replace(/__P__/g,vp).replaceAll("__BRAND_ACCENT_TEXT__",bp).replaceAll("__BRAND_ACCENT__",hp).replaceAll("__BRAND_RADIUS__",yp).replaceAll("__BRAND_FONT__",Pp);var xp=Z.scope("mount"),Xs=new WeakMap,Ys={floating:"all: initial; position: fixed; z-index: 2147483600;",flow:"all: initial; display: block; position: relative; width: 100%; height: 100%; z-index: 1; contain: size;",viewport:"all: initial; display: block; position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1;"};function Js(e,t){e.style.cssText=Ys[t]}function an(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function Tn(e={}){let t=e.position??"flow";xp.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${C.cssPrefix}-chat-host`;typeof customElements<"u"&&!customElements.get(n)&&customElements.define(n,class extends HTMLElement{});let o;e.existingHost?o=e.existingHost:(o=document.createElement(n),(e.target??document.body).appendChild(o)),o.setAttribute("data-brand",C.id),o.style.cssText=Ys[t];let r=o.shadowRoot??o.attachShadow({mode:"open"}),a=o.ownerDocument;if(!Sp(r,a)){let l=a.createElement("style");l.textContent=Oa,r.appendChild(l)}let s=document.createElement("div");return s.className=`${C.cssPrefix}-app`,r.appendChild(s),{appRoot:s,destroy:()=>o.remove(),hostElement:o,shadowRoot:r}}function Sp(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let o=Xs.get(t);if(!o)try{o=new n.CSSStyleSheet,o.replaceSync(Oa),Xs.set(t,o)}catch{return!1}try{return e.adoptedStyleSheets=[o],!0}catch{return!1}}function kp(e,t){let n=C.cssPrefix;t.accent&&e.style.setProperty(`--${n}-accent-user`,t.accent),t.accentText&&e.style.setProperty(`--${n}-accent-text-user`,t.accentText),t.radius&&e.style.setProperty(`--${n}-radius`,t.radius),t.fontFamily&&e.style.setProperty(`--${n}-font`,t.fontFamily),t.contentMaxWidth&&e.style.setProperty(`--${n}-conversation-max`,t.contentMaxWidth)}function wp(e,t){e.dataset.theme=t}function Cp(e,t){let n=C.cssPrefix;t.width!==void 0&&e.style.setProperty(`--${n}-panel-w`,t.width),t.height!==void 0&&e.style.setProperty(`--${n}-panel-h`,t.height),t.expanded?.width!==void 0&&e.style.setProperty(`--${n}-expanded-w`,t.expanded.width),t.expanded?.height!==void 0&&e.style.setProperty(`--${n}-expanded-h`,t.expanded.height),t.inset!==void 0&&e.style.setProperty(`--${n}-panel-inset`,t.inset)}function Rp(e,t){e.dataset.position=t}function Xo(e,t){e.dataset.mode=t}function Qs(e,t){wp(e,t.themeMode),kp(e,t.themeOverrides),Rp(e,t.position),Cp(e,t.size)}var Tp=Z.scope("iframe"),Ip='<!doctype html><html><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;background:transparent;overflow:hidden}</style></head><body></body></html>';function tl(e,t,n="closed",o="floating",r=null){Tp.debug("createIframeMount",{position:t,initialMode:n,layoutMode:o,hasTarget:!!r});let a=document.createElement("iframe");a.title=`${C.name} chat`,a.setAttribute("allow","microphone; clipboard-write"),el(a,t,n,o),(o==="inline"&&r?r:document.body).appendChild(a);let l=a.contentDocument;if(!l)throw new Error("iframe contentDocument unavailable (cross-origin?)");l.open(),l.write(Ip),l.close();let c=Tn({...e,target:l.body}),d=new MutationObserver(()=>{el(a,t,c.hostElement.dataset.mode??"closed",o)});return d.observe(c.hostElement,{attributes:!0,attributeFilter:["data-mode"]}),{...c,iframeElement:a,destroy(){d.disconnect(),c.destroy(),a.remove()}}}var Yo="border:0;background:transparent;z-index:2147483647;pointer-events:auto;",Zs={closed:{w:"88px",h:"88px"},expanded:{w:"min(calc(100vw - 32px), 680px)",h:"min(calc(100vh - 32px), 860px)"},open:{w:"min(calc(100vw - 32px), 440px)",h:"min(calc(100vh - 32px), 700px)"}};function el(e,t,n,o){if(n==="fullscreen"||o==="standalone"){e.style.cssText=`${Yo}position:fixed;inset:0;width:100vw;height:100vh;`;return}if(o==="inline"){e.style.cssText=`${Yo}position:static;display:block;width:100%;height:100%;`;return}if(typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches&&(n==="open"||n==="expanded")){e.style.cssText=`${Yo}position:fixed;inset:0;width:100vw;height:100vh;`;return}let a=t.startsWith("top-")?"top":"bottom",s=t.endsWith("-left")?"left":"right",{w:l,h:c}=Zs[n]??Zs.open;e.style.cssText=`${Yo}position:fixed;${a}:16px;${s}:16px;width:${l};height:${c};`}var In=class{constructor(){le(this,"handlers",new Map)}on(t,n){let o=this.handlers.get(t);return o||(o=new Set,this.handlers.set(t,o)),o.add(n),()=>this.handlers.get(t)?.delete(n)}emit(t,n){let o=this.handlers.get(t);if(o)for(let r of o)try{r(n)}catch{}}clear(){this.handlers.clear()}};var En,Le,Na,nl,oo=0,dl=[],$e=ne,ol=$e.__b,rl=$e.__r,al=$e.diffed,il=$e.__c,sl=$e.unmount,ll=$e.__;function Qo(e,t){$e.__h&&$e.__h(Le,e,oo||t),oo=0;var n=Le.__H||(Le.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function B(e){return oo=1,ul(_l,e)}function ul(e,t,n){var o=Qo(En++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):_l(void 0,t),function(l){var c=o.__N?o.__N[0]:o.__[0],d=o.t(c,l);c!==d&&(o.__N=[d,o.__[1]],o.__c.setState({}))}],o.__c=Le,!Le.__f)){var r=function(l,c,d){if(!o.__c.__H)return!0;var _=!1,p=o.__c.props!==l;if(o.__c.__H.__.some(function(f){if(f.__N){_=!0;var m=f.__[0];f.__=f.__N,f.__N=void 0,m!==f.__[0]&&(p=!0)}}),a){var u=a.call(this,l,c,d);return _?u||p:u}return!_||p};Le.__f=!0;var a=Le.shouldComponentUpdate,s=Le.componentWillUpdate;Le.componentWillUpdate=function(l,c,d){if(this.__e){var _=a;a=void 0,r(l,c,d),a=_}s&&s.call(this,l,c,d)},Le.shouldComponentUpdate=r}return o.__N||o.__}function O(e,t){var n=Qo(En++,3);!$e.__s&&$a(n.__H,t)&&(n.__=e,n.u=t,Le.__H.__h.push(n))}function kt(e,t){var n=Qo(En++,4);!$e.__s&&$a(n.__H,t)&&(n.__=e,n.u=t,Le.__h.push(n))}function M(e){return oo=5,se(function(){return{current:e}},[])}function se(e,t){var n=Qo(En++,7);return $a(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function L(e,t){return oo=8,se(function(){return e},t)}function Ep(){for(var e;e=dl.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Jo),t.__h.some(Da),t.__h=[]}catch(n){t.__h=[],$e.__e(n,e.__v)}}}$e.__b=function(e){Le=null,ol&&ol(e)},$e.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ll&&ll(e,t)},$e.__r=function(e){rl&&rl(e),En=0;var t=(Le=e.__c).__H;t&&(Na===Le?(t.__h=[],Le.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Jo),t.__h.some(Da),t.__h=[],En=0)),Na=Le},$e.diffed=function(e){al&&al(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(dl.push(t)!==1&&nl===$e.requestAnimationFrame||((nl=$e.requestAnimationFrame)||Ap)(Ep)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Na=Le=null},$e.__c=function(e,t){t.some(function(n){try{n.__h.some(Jo),n.__h=n.__h.filter(function(o){return!o.__||Da(o)})}catch(o){t.some(function(r){r.__h&&(r.__h=[])}),t=[],$e.__e(o,n.__v)}}),il&&il(e,t)},$e.unmount=function(e){sl&&sl(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(o){try{Jo(o)}catch(r){t=r}}),n.__H=void 0,t&&$e.__e(t,n.__v))};var cl=typeof requestAnimationFrame=="function";function Ap(e){var t,n=function(){clearTimeout(o),cl&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);cl&&(t=requestAnimationFrame(n))}function Jo(e){var t=Le,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Le=t}function Da(e){var t=Le;e.__c=e.__(),Le=t}function $a(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function _l(e,t){return typeof t=="function"?t(e):t}var Mp=Symbol.for("preact-signals");function nr(){if($t>1)$t--;else{var e,t=!1;for((function(){var r=er;for(er=void 0;r!==void 0;){var a=r.S;if(a.v===r.v)for(var s=a.t;s!==void 0;s=s.x)s.i===r.i&&(s.i=a.i);r=r.o}})();ao!==void 0;){var n=ao;for(ao=void 0,Zo++;n!==void 0;){var o=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&fl(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(Zo=0,$t--,t)throw e}}function ht(e){if($t>0)return e();Fa=++Lp,$t++;try{return e()}finally{nr()}}var ro,Ae=void 0;function io(e){var t=Ae,n=ro;Ae=void 0,ro=void 0;try{return e()}finally{Ae=t,ro=n}}var ao=void 0,$t=0,Zo=0,Lp=0,Fa=0,er=void 0,tr=0;function pl(e){if(Ae!==void 0){var t=e.n;if(t===void 0||t.t!==Ae)return t={i:0,S:e,p:Ae.s,n:void 0,t:Ae,e:void 0,x:void 0,r:t},Ae.s!==void 0&&(Ae.s.n=t),Ae.s=t,e.n=t,32&Ae.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=Ae.s,t.n=void 0,Ae.s.n=t,Ae.s=t),t}}function Ve(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}Ve.prototype.brand=Mp;Ve.prototype.h=function(){return!0};Ve.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n!==void 0?n.e=e:io(function(){var o;(o=t.W)==null||o.call(t)}))};Ve.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,o=e.x;n!==void 0&&(n.x=o,e.e=void 0),o!==void 0&&(o.e=n,e.x=void 0),e===this.t&&(this.t=o,o===void 0&&io(function(){var r;(r=t.Z)==null||r.call(t)}))}};Ve.prototype.subscribe=function(e){var t=this;return Ft(function(){var n=t.value;io(function(){return e(n)})},{name:"sub"})};Ve.prototype.valueOf=function(){return this.value};Ve.prototype.toString=function(){return this.value+""};Ve.prototype.toJSON=function(){return this.value};Ve.prototype.peek=function(){var e=this;return io(function(){return e.value})};Object.defineProperty(Ve.prototype,"value",{get:function(){var e=pl(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Zo>100)throw new Error("Cycle detected");(function(n){$t!==0&&Zo===0&&n.l!==Fa&&(n.l=Fa,er={S:n,v:n.v,i:n.i,o:er})})(this),this.v=e,this.i++,tr++,$t++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{nr()}}}});function ae(e,t){return new Ve(e,t)}function fl(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function ml(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function gl(e){for(var t=e.s,n=void 0;t!==void 0;){var o=t.p;t.i===-1?(t.S.U(t),o!==void 0&&(o.n=t.n),t.n!==void 0&&(t.n.p=o)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=o}e.s=n}function sn(e,t){Ve.call(this,void 0,t),this.x=e,this.s=void 0,this.g=tr-1,this.f=4}sn.prototype=new Ve;sn.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===tr))return!0;if(this.g=tr,this.f|=1,this.i>0&&!fl(this))return this.f&=-2,!0;var e=Ae;try{ml(this),Ae=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return Ae=e,gl(this),this.f&=-2,!0};sn.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}Ve.prototype.S.call(this,e)};sn.prototype.U=function(e){if(this.t!==void 0&&(Ve.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};sn.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(sn.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=pl(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function be(e,t){return new sn(e,t)}function vl(e){var t=e.m;if(e.m=void 0,typeof t=="function"){$t++;var n=Ae;Ae=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,Ba(e),o}finally{Ae=n,nr()}}}function Ba(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,vl(e)}function Op(e){if(Ae!==this)throw new Error("Out-of-order effect");gl(this),Ae=e,this.f&=-2,8&this.f&&Ba(this),nr()}function An(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,ro&&ro.push(this)}An.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.m=t)}finally{e()}};An.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,vl(this),ml(this),$t++;var e=Ae;return Ae=this,Op.bind(this,e)};An.prototype.N=function(){2&this.f||(this.f|=2,this.u=ao,ao=this)};An.prototype.d=function(){this.f|=8,1&this.f||Ba(this)};An.prototype.dispose=function(){this.d()};function Ft(e,t){var n=new An(e,t);try{n.c()}catch(r){throw n.d(),r}var o=n.d.bind(n);return o[Symbol.dispose]=o,o}var hl,ar,or,Np=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var bl=[];Ft(function(){hl=this.N})();function Mn(e,t){ne[e]=t.bind(null,ne[e]||function(){})}function rr(e){if(or){var t=or;or=void 0,t()}or=e&&e.S()}function yl(e){var t=this,n=e.data,o=bt(n);o.value=n;var r=se(function(){for(var l=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var d=be(function(){var f=o.value.value;return f===0?0:f===!0?"":f||""}),_=be(function(){return!Array.isArray(d.value)&&!Ia(d.value)}),p=Ft(function(){if(this.N=Pl,_.value){var f=d.value;l.__v&&l.__v.__e&&l.__v.__e.nodeType===3&&(l.__v.__e.data=f)}}),u=t.__$u.d;return t.__$u.d=function(){p(),u.call(this)},[_,d]},[]),a=r[0],s=r[1];return a.value?s.peek():s.value}yl.displayName="ReactiveTextNode";Object.defineProperties(Ve.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:yl},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});Mn("__b",function(e,t){if(typeof t.type=="string"){var n,o=t.props;for(var r in o)if(r!=="children"){var a=o[r];a instanceof Ve&&(n||(t.__np=n={}),n[r]=a,o[r]=a.peek())}}e(t)});Mn("__r",function(e,t){if(e(t),t.type!==me){rr();var n,o=t.__c;o&&(o.__$f&=-2,(n=o.__$u)===void 0&&(o.__$u=n=(function(r,a){var s;return Ft(function(){s=this},{name:a}),s.c=r,s})(function(){var r;Np&&((r=n.y)==null||r.call(n)),o.__$f|=1,o.setState({})},typeof t.type=="function"?t.type.displayName||t.type.name:""))),ar=o,rr(n)}});Mn("__e",function(e,t,n,o){rr(),ar=void 0,e(t,n,o)});Mn("diffed",function(e,t){rr(),ar=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var o=t.__np,r=t.props,a=n.U;if(a)for(var s in a){var l=a[s];l===void 0||o&&s in o||(l.d(),a[s]=void 0)}if(o){a||(a={},n.U=a);for(var c in o){var d=a[c],_=o[c];d===void 0?(d=Dp(n,c,_,r),a[c]=d):d.o(_,r)}}}e(t)});function Dp(e,t,n,o){var r=t in e&&e.ownerSVGElement===void 0,a=ae(n);return{o:function(s,l){a.value=s,o=l},d:Ft(function(){this.N=Pl;var s=a.value.value;o[t]!==s&&(o[t]=s,r?e[t]=s:s!=null&&(s!==!1||t[4]==="-")?e.setAttribute(t,s):e.removeAttribute(t))})}}Mn("unmount",function(e,t){if(typeof t.type=="string"){var n=t.__e;if(n){var o=n.U;if(o){n.U=void 0;for(var r in o){var a=o[r];a&&a.d()}}}var s=t.__np;if(s){var l=t.props;for(var c in s)l[c]=s[c]}t.__np=void 0}else{var d=t.__c;if(d){var _=d.__$u;_&&(d.__$u=void 0,_.d())}}e(t)});Mn("__h",function(e,t,n,o){o<3&&(t.__$f|=2),e(t,n,o)});st.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,o=n&&n.s!==void 0;for(var r in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var a=2&this.__$f;if(!(o||a||4&this.__$f)||1&this.__$f)return!0}else if(!(o||4&this.__$f)||3&this.__$f)return!0;for(var s in e)if(s!=="__source"&&e[s]!==this.props[s])return!0;for(var l in this.props)if(!(l in e))return!0;return!1};function bt(e,t){return se(function(){return ae(e,t)},[])}function mt(e,t){var n=M(e);return n.current=e,ar.__$f|=4,se(function(){return be(function(){return n.current()},t)},[])}var $p=function(e){queueMicrotask(function(){queueMicrotask(e)})};function Fp(){ht(function(){for(var e;e=bl.shift();)hl.call(e)})}function Pl(){bl.push(this)===1&&(ne.requestAnimationFrame||$p)(Fp)}function xl(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Sl(e){return xl(e)}function kl(e){return!(!xl(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}function ir(e,t,n){return e==="page"?"page":e==="standalone"?"standalone":e==="inline"?t==="fullscreen"?"fullscreen":"inline":e==="modal"||e==="drawer"?n?t==="fullscreen"?"fullscreen":e:"closed":n?t==="fullscreen"?"fullscreen":t==="expanded"?"expanded":"open":"closed"}var Bp=900,Hp=640;function Ha(e,t,n){if(e==="standalone"||e==="page")return"fullscreen";let o=t.initialSize;return o==="expanded"||o==="fullscreen"||o==="normal"?o:n>0&&n<Hp?"fullscreen":n>=(t.autoSizeBreakpoint??Bp)?"expanded":"normal"}function so(e,t,n,o=null){let a=e.mode==="inline"||e.mode==="standalone"||e.mode==="page"||(n??!e.startMinimized),l=e.mode!=="standalone"&&e.mode!=="page"&&e.mode!=="inline"&&o?o:Ha(e.mode,e.size,t);return{panelOpen:a,panelSize:l}}function Ln(){return typeof window>"u"?0:window.innerWidth}var Up="x-public-key",zp="x-ai-agent-deployment-id";function wl(e){return{headers(){let t={};return e.aiAgentDeploymentId&&(t[zp]=e.aiAgentDeploymentId),e.publicKey&&(t[e.publicKeyHeader??Up]=e.publicKey),t}}}function lo(e,t){return new Promise(n=>{if(t?.aborted)return n();let o=setTimeout(a,e),r=()=>a();t?.addEventListener("abort",r,{once:!0});function a(){clearTimeout(o),t?.removeEventListener("abort",r),n()}})}var We=class extends Error{constructor(n,o,r,a){super(n);le(this,"code",o);le(this,"status",r);le(this,"cause",a);this.name="StreamError"}};var Cl=Z.scope("parser");async function*Rl(e,t,n){if(!e.ok){let o=await e.text().catch(()=>"");throw new We(`server responded ${e.status}: ${o.slice(0,200)}`,"server",e.status)}for await(let o of qp(e,t)){let r=Vp(o,n);if(r==="done")return;r&&(yield r)}}async function*qp(e,t){if(!e.body)throw new We("response has no body","no-body");let n=e.body.pipeThrough(new TextDecoderStream).getReader(),o="";try{for(;;){if(t.aborted)throw new DOMException("aborted","AbortError");let{done:r,value:a}=await n.read();if(r){let l=o.trim();l&&(yield l);return}o+=a;let s;for(;(s=o.indexOf(`
|
|
5
|
+
`;var Gs=`:host([data-mode="page"]){min-height:0}:host([data-mode="page"]) .__P__-page-shell{display:grid;grid-template-columns:280px 1fr;width:100%;height:100%;min-height:0;background:var(--__P__-bg);color:var(--__P__-fg);transition:grid-template-columns var(--__P__-dur-base) var(--__P__-ease-in-out)}:host([data-mode="page"]) .__P__-page-shell[data-sidebar-collapsed=true]{grid-template-columns:48px 1fr}:host([data-mode="page"]) .__P__-page-chat{display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden}:host([data-mode="page"]) .__P__-anchor{position:static;inset:auto;padding:0;align-items:stretch;width:100%;height:100%;min-width:0;min-height:0;flex:1 1 0}:host([data-mode="page"]) .__P__-panel{width:100%;height:100%;min-width:0;min-height:0;max-width:none;max-height:none;border-radius:0;border:0;box-shadow:none;animation:none}:host([data-mode="page"]) .__P__-sidebar{border-inline-end:1px solid var(--__P__-border);display:flex;flex-direction:column;overflow:hidden;background:var(--__P__-surface)}:host([data-mode="page"]) .__P__-sidebar-header{padding:var(--__P__-space-4) var(--__P__-space-5);border-bottom:1px solid var(--__P__-border);display:flex;align-items:center;justify-content:space-between;gap:var(--__P__-space-2);min-height:56px;box-sizing:border-box}:host([data-mode="page"]) .__P__-sidebar[data-collapsed=true] .__P__-sidebar-header{padding:var(--__P__-space-4) var(--__P__-space-2);justify-content:center}:host([data-mode="page"]) .__P__-sidebar[data-collapsed=true] .__P__-sidebar-logo,:host([data-mode="page"]) .__P__-sidebar[data-collapsed=true] .__P__-sidebar-title{display:none}:host([data-mode="page"]) .__P__-sidebar-toggle{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:1px solid var(--__P__-border);border-radius:6px;background:transparent;color:var(--__P__-fg);cursor:pointer;transition:background .12s,border-color .12s}:host([data-mode="page"]) .__P__-sidebar-toggle:hover{background:var(--__P__-hover);border-color:var(--__P__-accent)}:host([data-mode="page"]) .__P__-sidebar-toggle:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px}:host([data-mode="page"]) .__P__-sidebar-logo{height:32px;display:block}:host([data-mode="page"]) .__P__-sidebar-title{font-size:var(--__P__-text-md);font-weight:600}:host([data-mode="page"]) .__P__-sidebar-section{padding:var(--__P__-space-3) var(--__P__-space-4);border-bottom:1px solid var(--__P__-border)}:host([data-mode="page"]) .__P__-sidebar-nav{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}:host([data-mode="page"]) .__P__-sidebar-nav-item{display:flex;align-items:center;gap:10px;padding:var(--__P__-space-2) var(--__P__-space-3);border-radius:var(--__P__-radius-sm);color:var(--__P__-fg);text-decoration:none;font-size:calc(14px * var(--__P__-text-scale));transition:background var(--__P__-dur-quick) var(--__P__-ease-out)}:host([data-mode="page"]) .__P__-sidebar-nav-item:hover{background:var(--__P__-hover)}:host([data-mode="page"]) .__P__-sidebar-nav-item:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:-2px}:host([data-mode="page"]) .__P__-sidebar-cards{display:grid;grid-template-columns:1fr;gap:var(--__P__-space-2)}:host([data-mode="page"]) .__P__-sidebar-card{display:block;padding:10px 12px;border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-sm);text-decoration:none;color:var(--__P__-fg);transition:border-color var(--__P__-dur-quick) var(--__P__-ease-out)}:host([data-mode="page"]) .__P__-sidebar-card:hover{border-color:var(--__P__-accent)}:host([data-mode="page"]) .__P__-sidebar-card:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}:host([data-mode="page"]) .__P__-sidebar-card-label{font-weight:600;font-size:calc(14px * var(--__P__-text-scale))}:host([data-mode="page"]) .__P__-sidebar-card-desc{font-size:var(--__P__-text-xs);color:var(--__P__-muted);margin-top:2px}:host([data-mode="page"]) .__P__-sidebar-conversations{flex:1 1 auto;overflow-y:auto;padding:var(--__P__-space-3) var(--__P__-space-4)}:host([data-mode="page"]) .__P__-page-chat{display:flex;flex-direction:column;overflow:hidden}@media(max-width:768px){:host([data-mode="page"]) .__P__-page-shell{grid-template-columns:1fr}:host([data-mode="page"]) .__P__-sidebar{display:none}}
|
|
6
|
+
`;var vp="helpai",hp="#5B5BD6",bp="#FFFFFF",yp="12px",Pp="Inter, system-ui, -apple-system, 'Segoe UI', sans-serif",Ma=[qs,Vs,Ws,Ks,Gs].join(`
|
|
7
|
+
`).replace(/__P__/g,vp).replaceAll("__BRAND_ACCENT_TEXT__",bp).replaceAll("__BRAND_ACCENT__",hp).replaceAll("__BRAND_RADIUS__",yp).replaceAll("__BRAND_FONT__",Pp);var xp=ee.scope("mount"),js=new WeakMap,Xs={floating:"all: initial; position: fixed; z-index: 2147483600;",flow:"all: initial; display: block; position: relative; width: 100%; height: 100%; z-index: 1; contain: size;",viewport:"all: initial; display: block; position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1;"};function Ys(e,t){e.style.cssText=Xs[t]}function en(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function Sn(e={}){let t=e.position??"flow";xp.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${R.cssPrefix}-chat-host`;typeof customElements<"u"&&!customElements.get(n)&&customElements.define(n,class extends HTMLElement{});let o;e.existingHost?o=e.existingHost:(o=document.createElement(n),(e.target??document.body).appendChild(o)),o.setAttribute("data-brand",R.id),o.style.cssText=Xs[t];let r=o.shadowRoot??o.attachShadow({mode:"open"}),a=o.ownerDocument;if(!Sp(r,a)){let l=a.createElement("style");l.textContent=Ma,r.appendChild(l)}let s=document.createElement("div");return s.className=`${R.cssPrefix}-app`,r.appendChild(s),{appRoot:s,destroy:()=>o.remove(),hostElement:o,shadowRoot:r}}function Sp(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let o=js.get(t);if(!o)try{o=new n.CSSStyleSheet,o.replaceSync(Ma),js.set(t,o)}catch{return!1}try{return e.adoptedStyleSheets=[o],!0}catch{return!1}}function kp(e,t){let n=R.cssPrefix;t.accent&&e.style.setProperty(`--${n}-accent-user`,t.accent),t.accentText&&e.style.setProperty(`--${n}-accent-text-user`,t.accentText),t.radius&&e.style.setProperty(`--${n}-radius`,t.radius),t.fontFamily&&e.style.setProperty(`--${n}-font`,t.fontFamily),t.contentMaxWidth&&e.style.setProperty(`--${n}-conversation-max`,t.contentMaxWidth)}function wp(e,t){e.dataset.theme=t}function Cp(e,t){let n=R.cssPrefix;t.width!==void 0&&e.style.setProperty(`--${n}-panel-w`,t.width),t.height!==void 0&&e.style.setProperty(`--${n}-panel-h`,t.height),t.expanded?.width!==void 0&&e.style.setProperty(`--${n}-expanded-w`,t.expanded.width),t.expanded?.height!==void 0&&e.style.setProperty(`--${n}-expanded-h`,t.expanded.height),t.inset!==void 0&&e.style.setProperty(`--${n}-panel-inset`,t.inset)}function Rp(e,t){e.dataset.position=t}function Wo(e,t){e.dataset.mode=t}function Js(e,t){wp(e,t.themeMode),kp(e,t.themeOverrides),Rp(e,t.position),Cp(e,t.size)}var Tp=ee.scope("iframe"),Ip='<!doctype html><html><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;background:transparent;overflow:hidden}</style></head><body></body></html>';function el(e,t,n="closed",o="floating",r=null){Tp.debug("createIframeMount",{position:t,initialMode:n,layoutMode:o,hasTarget:!!r});let a=document.createElement("iframe");a.title=`${R.name} chat`,a.setAttribute("allow","microphone; clipboard-write"),Zs(a,t,n,o),(o==="inline"&&r?r:document.body).appendChild(a);let l=a.contentDocument;if(!l)throw new Error("iframe contentDocument unavailable (cross-origin?)");l.open(),l.write(Ip),l.close();let c=Sn({...e,target:l.body}),d=new MutationObserver(()=>{Zs(a,t,c.hostElement.dataset.mode??"closed",o)});return d.observe(c.hostElement,{attributes:!0,attributeFilter:["data-mode"]}),{...c,iframeElement:a,destroy(){d.disconnect(),c.destroy(),a.remove()}}}var Ko="border:0;background:transparent;z-index:2147483647;pointer-events:auto;",Qs={closed:{w:"88px",h:"88px"},expanded:{w:"min(calc(100vw - 32px), 680px)",h:"min(calc(100vh - 32px), 860px)"},open:{w:"min(calc(100vw - 32px), 440px)",h:"min(calc(100vh - 32px), 700px)"}};function Zs(e,t,n,o){if(n==="fullscreen"||o==="standalone"){e.style.cssText=`${Ko}position:fixed;inset:0;width:100vw;height:100vh;`;return}if(o==="inline"){e.style.cssText=`${Ko}position:static;display:block;width:100%;height:100%;`;return}if(typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches&&(n==="open"||n==="expanded")){e.style.cssText=`${Ko}position:fixed;inset:0;width:100vw;height:100vh;`;return}let a=t.startsWith("top-")?"top":"bottom",s=t.endsWith("-left")?"left":"right",{w:l,h:c}=Qs[n]??Qs.open;e.style.cssText=`${Ko}position:fixed;${a}:16px;${s}:16px;width:${l};height:${c};`}var kn=class{constructor(){se(this,"handlers",new Map)}on(t,n){let o=this.handlers.get(t);return o||(o=new Set,this.handlers.set(t,o)),o.add(n),()=>this.handlers.get(t)?.delete(n)}emit(t,n){let o=this.handlers.get(t);if(o)for(let r of o)try{r(n)}catch{}}clear(){this.handlers.clear()}};var wn,Ae,La,tl,Qn=0,cl=[],Ne=ne,nl=Ne.__b,ol=Ne.__r,rl=Ne.diffed,al=Ne.__c,il=Ne.unmount,sl=Ne.__;function jo(e,t){Ne.__h&&Ne.__h(Ae,e,Qn||t),Qn=0;var n=Ae.__H||(Ae.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function $(e){return Qn=1,dl(ul,e)}function dl(e,t,n){var o=jo(wn++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):ul(void 0,t),function(l){var c=o.__N?o.__N[0]:o.__[0],d=o.t(c,l);c!==d&&(o.__N=[d,o.__[1]],o.__c.setState({}))}],o.__c=Ae,!Ae.__f)){var r=function(l,c,d){if(!o.__c.__H)return!0;var p=!1,_=o.__c.props!==l;if(o.__c.__H.__.some(function(f){if(f.__N){p=!0;var m=f.__[0];f.__=f.__N,f.__N=void 0,m!==f.__[0]&&(_=!0)}}),a){var u=a.call(this,l,c,d);return p?u||_:u}return!p||_};Ae.__f=!0;var a=Ae.shouldComponentUpdate,s=Ae.componentWillUpdate;Ae.componentWillUpdate=function(l,c,d){if(this.__e){var p=a;a=void 0,r(l,c,d),a=p}s&&s.call(this,l,c,d)},Ae.shouldComponentUpdate=r}return o.__N||o.__}function L(e,t){var n=jo(wn++,3);!Ne.__s&&Na(n.__H,t)&&(n.__=e,n.u=t,Ae.__H.__h.push(n))}function ht(e,t){var n=jo(wn++,4);!Ne.__s&&Na(n.__H,t)&&(n.__=e,n.u=t,Ae.__h.push(n))}function O(e){return Qn=5,ie(function(){return{current:e}},[])}function ie(e,t){var n=jo(wn++,7);return Na(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function N(e,t){return Qn=8,ie(function(){return e},t)}function Ep(){for(var e;e=cl.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Go),t.__h.some(Oa),t.__h=[]}catch(n){t.__h=[],Ne.__e(n,e.__v)}}}Ne.__b=function(e){Ae=null,nl&&nl(e)},Ne.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),sl&&sl(e,t)},Ne.__r=function(e){ol&&ol(e),wn=0;var t=(Ae=e.__c).__H;t&&(La===Ae?(t.__h=[],Ae.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Go),t.__h.some(Oa),t.__h=[],wn=0)),La=Ae},Ne.diffed=function(e){rl&&rl(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(cl.push(t)!==1&&tl===Ne.requestAnimationFrame||((tl=Ne.requestAnimationFrame)||Ap)(Ep)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),La=Ae=null},Ne.__c=function(e,t){t.some(function(n){try{n.__h.some(Go),n.__h=n.__h.filter(function(o){return!o.__||Oa(o)})}catch(o){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Ne.__e(o,n.__v)}}),al&&al(e,t)},Ne.unmount=function(e){il&&il(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(o){try{Go(o)}catch(r){t=r}}),n.__H=void 0,t&&Ne.__e(t,n.__v))};var ll=typeof requestAnimationFrame=="function";function Ap(e){var t,n=function(){clearTimeout(o),ll&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);ll&&(t=requestAnimationFrame(n))}function Go(e){var t=Ae,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Ae=t}function Oa(e){var t=Ae;e.__c=e.__(),Ae=t}function Na(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function ul(e,t){return typeof t=="function"?t(e):t}var Mp=Symbol.for("preact-signals");function Qo(){if(At>1)At--;else{var e,t=!1;for((function(){var r=Yo;for(Yo=void 0;r!==void 0;){var a=r.S;if(a.v===r.v)for(var s=a.t;s!==void 0;s=s.x)s.i===r.i&&(s.i=a.i);r=r.o}})();eo!==void 0;){var n=eo;for(eo=void 0,Xo++;n!==void 0;){var o=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&pl(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(Xo=0,At--,t)throw e}}function ft(e){if(At>0)return e();Da=++Lp,At++;try{return e()}finally{Qo()}}var Zn,Ie=void 0;function to(e){var t=Ie,n=Zn;Ie=void 0,Zn=void 0;try{return e()}finally{Ie=t,Zn=n}}var eo=void 0,At=0,Xo=0,Lp=0,Da=0,Yo=void 0,Jo=0;function _l(e){if(Ie!==void 0){var t=e.n;if(t===void 0||t.t!==Ie)return t={i:0,S:e,p:Ie.s,n:void 0,t:Ie,e:void 0,x:void 0,r:t},Ie.s!==void 0&&(Ie.s.n=t),Ie.s=t,e.n=t,32&Ie.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=Ie.s,t.n=void 0,Ie.s.n=t,Ie.s=t),t}}function Be(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}Be.prototype.brand=Mp;Be.prototype.h=function(){return!0};Be.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n!==void 0?n.e=e:to(function(){var o;(o=t.W)==null||o.call(t)}))};Be.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,o=e.x;n!==void 0&&(n.x=o,e.e=void 0),o!==void 0&&(o.e=n,e.x=void 0),e===this.t&&(this.t=o,o===void 0&&to(function(){var r;(r=t.Z)==null||r.call(t)}))}};Be.prototype.subscribe=function(e){var t=this;return Mt(function(){var n=t.value;to(function(){return e(n)})},{name:"sub"})};Be.prototype.valueOf=function(){return this.value};Be.prototype.toString=function(){return this.value+""};Be.prototype.toJSON=function(){return this.value};Be.prototype.peek=function(){var e=this;return to(function(){return e.value})};Object.defineProperty(Be.prototype,"value",{get:function(){var e=_l(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Xo>100)throw new Error("Cycle detected");(function(n){At!==0&&Xo===0&&n.l!==Da&&(n.l=Da,Yo={S:n,v:n.v,i:n.i,o:Yo})})(this),this.v=e,this.i++,Jo++,At++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Qo()}}}});function oe(e,t){return new Be(e,t)}function pl(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function fl(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function ml(e){for(var t=e.s,n=void 0;t!==void 0;){var o=t.p;t.i===-1?(t.S.U(t),o!==void 0&&(o.n=t.n),t.n!==void 0&&(t.n.p=o)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=o}e.s=n}function tn(e,t){Be.call(this,void 0,t),this.x=e,this.s=void 0,this.g=Jo-1,this.f=4}tn.prototype=new Be;tn.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Jo))return!0;if(this.g=Jo,this.f|=1,this.i>0&&!pl(this))return this.f&=-2,!0;var e=Ie;try{fl(this),Ie=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return Ie=e,ml(this),this.f&=-2,!0};tn.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}Be.prototype.S.call(this,e)};tn.prototype.U=function(e){if(this.t!==void 0&&(Be.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};tn.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(tn.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=_l(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function fe(e,t){return new tn(e,t)}function gl(e){var t=e.m;if(e.m=void 0,typeof t=="function"){At++;var n=Ie;Ie=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,$a(e),o}finally{Ie=n,Qo()}}}function $a(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,gl(e)}function Op(e){if(Ie!==this)throw new Error("Out-of-order effect");ml(this),Ie=e,this.f&=-2,8&this.f&&$a(this),Qo()}function Cn(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Zn&&Zn.push(this)}Cn.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.m=t)}finally{e()}};Cn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,gl(this),fl(this),At++;var e=Ie;return Ie=this,Op.bind(this,e)};Cn.prototype.N=function(){2&this.f||(this.f|=2,this.u=eo,eo=this)};Cn.prototype.d=function(){this.f|=8,1&this.f||$a(this)};Cn.prototype.dispose=function(){this.d()};function Mt(e,t){var n=new Cn(e,t);try{n.c()}catch(r){throw n.d(),r}var o=n.d.bind(n);return o[Symbol.dispose]=o,o}var vl,tr,Zo,Np=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var hl=[];Mt(function(){vl=this.N})();function Rn(e,t){ne[e]=t.bind(null,ne[e]||function(){})}function er(e){if(Zo){var t=Zo;Zo=void 0,t()}Zo=e&&e.S()}function bl(e){var t=this,n=e.data,o=mt(n);o.value=n;var r=ie(function(){for(var l=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var d=fe(function(){var f=o.value.value;return f===0?0:f===!0?"":f||""}),p=fe(function(){return!Array.isArray(d.value)&&!Ra(d.value)}),_=Mt(function(){if(this.N=yl,p.value){var f=d.value;l.__v&&l.__v.__e&&l.__v.__e.nodeType===3&&(l.__v.__e.data=f)}}),u=t.__$u.d;return t.__$u.d=function(){_(),u.call(this)},[p,d]},[]),a=r[0],s=r[1];return a.value?s.peek():s.value}bl.displayName="ReactiveTextNode";Object.defineProperties(Be.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:bl},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});Rn("__b",function(e,t){if(typeof t.type=="string"){var n,o=t.props;for(var r in o)if(r!=="children"){var a=o[r];a instanceof Be&&(n||(t.__np=n={}),n[r]=a,o[r]=a.peek())}}e(t)});Rn("__r",function(e,t){if(e(t),t.type!==de){er();var n,o=t.__c;o&&(o.__$f&=-2,(n=o.__$u)===void 0&&(o.__$u=n=(function(r,a){var s;return Mt(function(){s=this},{name:a}),s.c=r,s})(function(){var r;Np&&((r=n.y)==null||r.call(n)),o.__$f|=1,o.setState({})},typeof t.type=="function"?t.type.displayName||t.type.name:""))),tr=o,er(n)}});Rn("__e",function(e,t,n,o){er(),tr=void 0,e(t,n,o)});Rn("diffed",function(e,t){er(),tr=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var o=t.__np,r=t.props,a=n.U;if(a)for(var s in a){var l=a[s];l===void 0||o&&s in o||(l.d(),a[s]=void 0)}if(o){a||(a={},n.U=a);for(var c in o){var d=a[c],p=o[c];d===void 0?(d=Dp(n,c,p,r),a[c]=d):d.o(p,r)}}}e(t)});function Dp(e,t,n,o){var r=t in e&&e.ownerSVGElement===void 0,a=oe(n);return{o:function(s,l){a.value=s,o=l},d:Mt(function(){this.N=yl;var s=a.value.value;o[t]!==s&&(o[t]=s,r?e[t]=s:s!=null&&(s!==!1||t[4]==="-")?e.setAttribute(t,s):e.removeAttribute(t))})}}Rn("unmount",function(e,t){if(typeof t.type=="string"){var n=t.__e;if(n){var o=n.U;if(o){n.U=void 0;for(var r in o){var a=o[r];a&&a.d()}}}var s=t.__np;if(s){var l=t.props;for(var c in s)l[c]=s[c]}t.__np=void 0}else{var d=t.__c;if(d){var p=d.__$u;p&&(d.__$u=void 0,p.d())}}e(t)});Rn("__h",function(e,t,n,o){o<3&&(t.__$f|=2),e(t,n,o)});tt.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,o=n&&n.s!==void 0;for(var r in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var a=2&this.__$f;if(!(o||a||4&this.__$f)||1&this.__$f)return!0}else if(!(o||4&this.__$f)||3&this.__$f)return!0;for(var s in e)if(s!=="__source"&&e[s]!==this.props[s])return!0;for(var l in this.props)if(!(l in e))return!0;return!1};function mt(e,t){return ie(function(){return oe(e,t)},[])}function ut(e,t){var n=O(e);return n.current=e,tr.__$f|=4,ie(function(){return fe(function(){return n.current()},t)},[])}var $p=function(e){queueMicrotask(function(){queueMicrotask(e)})};function Fp(){ft(function(){for(var e;e=hl.shift();)vl.call(e)})}function yl(){hl.push(this)===1&&(ne.requestAnimationFrame||$p)(Fp)}function Pl(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function xl(e){return Pl(e)}function Sl(e){return!(!Pl(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}function nr(e,t,n){return e==="page"?"page":e==="standalone"?"standalone":e==="inline"?t==="fullscreen"?"fullscreen":"inline":e==="modal"||e==="drawer"?n?t==="fullscreen"?"fullscreen":e:"closed":n?t==="fullscreen"?"fullscreen":t==="expanded"?"expanded":"open":"closed"}var Bp=900,Hp=640;function Fa(e,t,n){if(e==="standalone"||e==="page")return"fullscreen";let o=t.initialSize;return o==="expanded"||o==="fullscreen"||o==="normal"?o:n>0&&n<Hp?"fullscreen":n>=(t.autoSizeBreakpoint??Bp)?"expanded":"normal"}function no(e,t,n,o=null){let a=e.mode==="inline"||e.mode==="standalone"||e.mode==="page"||(n??!e.startMinimized),l=e.mode!=="standalone"&&e.mode!=="page"&&e.mode!=="inline"&&o?o:Fa(e.mode,e.size,t);return{panelOpen:a,panelSize:l}}function Tn(){return typeof window>"u"?0:window.innerWidth}var Up="x-public-key",zp="x-ai-agent-deployment-id";function kl(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");return{headers(){let t={[zp]:e.aiAgentDeploymentId};return e.publicKey&&(t[e.publicKeyHeader??Up]=e.publicKey),t}}}function oo(e,t){return new Promise(n=>{if(t?.aborted)return n();let o=setTimeout(a,e),r=()=>a();t?.addEventListener("abort",r,{once:!0});function a(){clearTimeout(o),t?.removeEventListener("abort",r),n()}})}var He=class extends Error{constructor(n,o,r,a){super(n);se(this,"code",o);se(this,"status",r);se(this,"cause",a);this.name="StreamError"}};var wl=ee.scope("parser");async function*Cl(e,t,n){if(!e.ok){let o=await e.text().catch(()=>"");throw new He(`server responded ${e.status}: ${o.slice(0,200)}`,"server",e.status)}for await(let o of qp(e,t)){let r=Vp(o,n);if(r==="done")return;r&&(yield r)}}async function*qp(e,t){if(!e.body)throw new He("response has no body","no-body");let n=e.body.pipeThrough(new TextDecoderStream).getReader(),o="";try{for(;;){if(t.aborted)throw new DOMException("aborted","AbortError");let{done:r,value:a}=await n.read();if(r){let l=o.trim();l&&(yield l);return}o+=a;let s;for(;(s=o.indexOf(`
|
|
8
8
|
|
|
9
9
|
`))!==-1;){let l=o.slice(0,s);o=o.slice(s+2),yield l}}}finally{n.releaseLock()}}function Vp(e,t){let n="",o;for(let r of e.split(`
|
|
10
10
|
`))if(r!==""){if(r.startsWith(":")){t?.(r.slice(1).trim());continue}if(r.startsWith("data:")){let a=r.slice(5).replace(/^ /,"");n=n?`${n}
|
|
11
|
-
${a}`:a;continue}r.startsWith("id:")&&(o=r.slice(3).trim())}if(n==="[DONE]")return"done";if(!n)return null;try{let r=JSON.parse(n);return Cl.trace("chunk",{type:r.type,eventId:o}),{chunk:r,eventId:o}}catch(r){throw Cl.trace("frame parse failed",{err:r,payload:n.slice(0,200)}),new We("invalid SSE frame","network",void 0,r)}}function Wp(e){let t=new TextEncoder().encode(e),n="";for(let o of t)n+=String.fromCharCode(o);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}var Tl=e=>e&&Object.keys(e).length>0?e:void 0;function Il(e,t){let n=Tl(e),o=Tl(t);if(!n&&!o)return;let r={};return n&&(r.user=n),o&&(r.page=o),Wp(JSON.stringify(r))}function sr(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function Gp(e){return`tool-${e.startsWith("tool:")?e.slice(5):e}`}function El(e){return e.startsWith("tool-")?e.slice(5):e}var lt={handshake:"/pai/handshake",streamMessage:"/pai/stream-message",streamResume:"/pai/stream-resume",cancelStream:"/pai/cancel-stream",listConversations:"/pai/list-conversations",listMessages:"/pai/list-messages",updateSettings:"/pai/update-settings",markRead:"/pai/mark-read",messageFeedback:"/pai/message-feedback",requestOperator:"/pai/request-operator",cancelOperatorRequest:"/pai/cancel-request-operator",bootstrap:"/pai/bootstrap",content:"/pai/content",submitForm:"/pai/submit-form"},Al="context";function Kt(e){let t=e??{},n=t.controlMode;return{controlMode:n==="awaiting_operator"||n==="operator"?n:"ai-agent",controlRevision:typeof t.controlRevision=="number"&&Number.isSafeInteger(t.controlRevision)&&t.controlRevision>=0?t.controlRevision:void 0,assignedOperatorInitials:typeof t.assignedOperatorInitials=="string"&&t.assignedOperatorInitials?t.assignedOperatorInitials:void 0,operatorAvailable:typeof t.operatorAvailable=="boolean"?t.operatorAvailable:void 0}}function lr(e){let t=e?.suggestions;if(!Array.isArray(t))return[];let n=[];for(let o of t){if(!o||typeof o!="object")continue;let{id:r,label:a,text:s}=o;typeof a!="string"||!a||n.push({id:typeof r=="string"&&r?r:`s${n.length}`,label:a,text:typeof s=="string"&&s?s:a})}return n}function Ua(e){let n={messages:e.messages.map(o=>({id:o.serverMessageId??o.id,parts:jp(o),role:o.role,createdAt:o.createdAt!==void 0?new Date(o.createdAt).toISOString():void 0})),conversationId:e.conversationId,responseType:"ack"};return e.visitorId&&(n.visitorId=e.visitorId),e.userPrefs&&(n.userPrefs=e.userPrefs),n}function Kp(e){return e.state==="output-available"||e.state==="output-error"||e.state==="output-denied"||e.approval?.approved!==void 0}function jp(e){let t=[];for(let n of e.parts)if(n.kind==="step-start"&&t.push({type:"step-start"}),n.kind==="reasoning"&&n.text&&t.push({type:"reasoning",text:n.text,state:n.done?"done":"streaming"}),n.kind==="text"&&n.text&&t.push({text:n.text,type:"text"}),n.kind==="file"&&n.url&&t.push({mediaType:n.mediaType,type:"file",url:n.url}),n.kind==="tool"&&Kp(n)){let o=n.dynamic?{type:"dynamic-tool",toolName:n.toolName,toolCallId:n.toolCallId,state:n.state}:{type:Gp(n.toolName),toolCallId:n.toolCallId,state:n.state};n.input!==void 0&&(o.input=n.input),n.output!==void 0&&(o.output=n.output),n.error!==void 0&&(o.errorText=n.error),n.approval&&n.approval.approved!==void 0&&(o.approval=n.approval),t.push(o)}for(let n of e.attachments??[])n.url&&t.push({type:"file",url:n.url,mediaType:n.mediaType,filename:n.name,fileId:n.id,fileSize:n.size});return t}var Re=Z.scope("transport"),Xp=6e4,Yp=1e4,qa=50,Dl=new WeakMap;function On(e){return Dl.get(e)}function co(e,t){return Dl.set(e,t),e}function Ml(e){return Math.max(e?.upsertRevision??0,e?.read?.revision??0)}function Jp(e,t){return e.conversationId===t.conversationId&&e.title===t.title&&e.lastMessageAt===t.lastMessageAt&&e.preview===t.preview&&e.canContinue===t.canContinue&&e.hasUnread===t.hasUnread&&e.controlState===t.controlState}function Bt(e,t,n=!0){switch(t.type){case"snapshot":{let o=new Map(e.map(s=>[s.conversationId,s])),r=e.filter(s=>(On(s)?.activityRevision??0)>t.requestedRevision).toSorted((s,l)=>On(l).activityRevision-On(s).activityRevision),a=new Set(r.map(s=>s.conversationId));return[...r,...t.result.conversations.filter(s=>!a.has(s.conversationId)).map(s=>{let l=o.get(s.conversationId);if(!l)return s;let c=On(l);return(c?.upsertRevision??0)>t.requestedRevision?l:c?.read&&!l.hasUnread&&c.read.lastMessageAt===s.lastMessageAt?co({...s,hasUnread:!1},{upsertRevision:0,read:c.read}):s})]}case"read":{let o=e.findIndex(c=>c.conversationId===t.conversationId&&(t.lastMessageAt===void 0||c.lastMessageAt===t.lastMessageAt));if(o<0)return e;let r=e[o],a=On(r);if(Ml(a)>t.revision)return e;let s=t.lastMessageAt??r.lastMessageAt,l={upsertRevision:a?.upsertRevision??0,...a?.activityRevision===void 0?{}:{activityRevision:a.activityRevision},read:{revision:t.revision,...s?{lastMessageAt:s}:{}}};return r.hasUnread?e.map((c,d)=>d===o?co({...c,hasUnread:!1},l):c):(co(r,l),e)}case"upsert":{let o=e.findIndex(d=>d.conversationId===t.conversation.conversationId);if(o<0&&!n)return e;let r=o<0?void 0:e[o],a=r?On(r):void 0;if(Ml(a)>t.revision)return e;let s=t.activity?t.revision:a?.activityRevision,l={upsertRevision:t.revision,...s===void 0?{}:{activityRevision:s},...!t.conversation.hasUnread&&a?.read?{read:a.read}:{}},c=r?{...r,...t.conversation,title:r.title}:{...t.conversation};return r&&Jp(r,c)?(co(r,l),e):(co(c,l),t.activity?[c,...e.filter(d=>d.conversationId!==c.conversationId)]:r?e.map((d,_)=>_===o?c:d):[...e,c])}default:return t}}var Ll=3,Qp=400,Zp=3e4,ef=1e4,tf=6e4,nf=15e3,of=1024*1024,Ol=new Set([408,425,429,500,502,503,504]);function Nl(e){return Qp*2**e+Math.floor(Math.random()*250)}function rf(e){return tf+Math.ceil(e/of)*nf}function af(e){let t=e.get("retry-after");if(!t)return null;let n=Number(t),o=Number.isFinite(n)?n*1e3:Date.parse(t)-Date.now();return Number.isFinite(o)&&o>=0?Math.min(o,3e4):null}var cr=class{constructor(t){le(this,"ttlMs",t);le(this,"map",new Map)}getOrFetch(t,n){let o=this.map.get(t);if(o&&Date.now()-o.at<this.ttlMs)return o.result;let r={at:Date.now(),result:n().then(a=>(r.value=a,a)).catch(a=>{throw this.map.get(t)===r&&this.map.delete(t),a})};return this.map.set(t,r),r.result}peek(t){let n=this.map.get(t);if(n?.value!==void 0&&Date.now()-n.at<this.ttlMs)return n.value}update(t){for(let n of this.map.values()){if(n.value!==void 0){let o=t(n.value);n.value=o,n.result=Promise.resolve(o);continue}n.result=n.result.then(o=>{let r=t(o);return n.value=r,r})}}delete(t){this.map.delete(t)}},dr=class{constructor(t){le(this,"opts",t);le(this,"conversationListeners",new Set);le(this,"conversationRevision",0);le(this,"visitorId");le(this,"conversationId");le(this,"userContext");le(this,"pageContext");le(this,"locale");le(this,"conversationsCache",new cr(Yp));le(this,"contentCache",new cr(Xp))}setContext(t,n){this.userContext=t,this.pageContext=n}setLocale(t){this.locale=t}primeIdentity(t,n){t&&(this.visitorId=t),n&&(this.conversationId=n)}envelope(){let t={_ev:Rn};this.visitorId&&(t.visitorId=this.visitorId),this.conversationId&&(t.conversationId=this.conversationId),this.locale&&(t.locale=this.locale);let n=Il(this.userContext,this.pageContext);return n&&(t[Al]=n),t}withEnvelope(t){return{...this.envelope(),...t}}appendEnvelope(t){for(let[n,o]of Object.entries(this.envelope()))t.append(n,o);return t}withEnvelopeQuery(t){let n=new URL(this.url(t));for(let[o,r]of Object.entries(this.envelope()))n.searchParams.has(o)||n.searchParams.set(o,r);return n.toString()}async handshake(t){Re.debug("handshake \u2192",{visitorId:t.visitorId,conversationId:t.conversationId,locale:t.locale});let n=await this.postJson(lt.handshake,t,"handshake");return Re.debug("handshake \u2190",{visitorId:n.visitorId,conversationId:n.conversationId,hasWelcome:!!n.welcome,hasConfig:!!n.config,rebind:n.rebind}),cf(n)||Re.warn("handshake response did not match expected shape; using raw response",{response:n}),this.visitorId=n.visitorId??t.visitorId,this.conversationId=n.conversationId,n}async uploadFile(t,n){Re.debug("uploadFile \u2192",{name:t.name,size:t.size,type:t.type});let o=new FormData;o.append("file",t,t.name);let r=await this.postForm(this.uploadPath,o,"upload",n,rf(t.size));return Re.debug("uploadFile \u2190",{id:r.id,url:r.url}),r}async transcribe(t,n="audio/webm"){Re.debug("transcribe \u2192",{size:t.size,mimeType:n});let o=new FormData;o.append("audio",t,`voice.${sf(n)}`),o.append("mimeType",n);let r=await this.postForm(this.transcribePath,o,"transcribe");return Re.debug("transcribe \u2190",{textLen:r.text.length}),r}subscribeConversationChanges(t){return this.conversationListeners.add(t),()=>this.conversationListeners.delete(t)}publishConversation(t,n=!1){let o={type:"upsert",conversation:t,revision:++this.conversationRevision,...n?{activity:!0}:{}};this.conversationsCache.update(r=>{let a=r.pagination.page===1,s=r.conversations.some(p=>p.conversationId===t.conversationId),l=Bt(r.conversations,o,a&&n),c=a&&l.length>r.pagination.limit?l.slice(0,r.pagination.limit):l;if(!a||!n||s||r.pagination.hasNext)return c===r.conversations?r:{...r,conversations:c};let d=Math.max(r.pagination.total,r.conversations.length)+1,_=Math.ceil(d/r.pagination.limit);return{...r,conversations:c,pagination:{...r.pagination,total:d,totalPages:_,hasNext:r.pagination.page<_}}});for(let r of this.conversationListeners)r(o)}localeCacheKey(t){return`${this.locale??""}|${JSON.stringify(t,Object.keys(t).toSorted())}`}peekConversations(t={}){return this.conversationsCache.peek(this.localeCacheKey(t))}listConversations(t={},n=!1){if((t.page??1)>1)return this.fetchConversations(t);let o=this.localeCacheKey(t),r=this.conversationRevision;n&&this.conversationsCache.delete(o);let a=this.conversationsCache.getOrFetch(o,()=>this.fetchConversations(t));return n?a.then(s=>{let l={type:"snapshot",result:s,requestedRevision:r};for(let c of this.conversationListeners)c(l);return s}):a}async fetchConversations(t){let n=new URL(this.url(lt.listConversations));return t.visitorId&&n.searchParams.set("visitorId",t.visitorId),t.page&&n.searchParams.set("page",String(t.page)),t.limit&&n.searchParams.set("limit",String(t.limit)),t.ids?.length&&n.searchParams.set("ids",t.ids.join(",")),this.getJson(n.toString(),"listConversations")}async loadConversation(t,{ids:n=[],beforeId:o}={}){let r=new URL(this.url(lt.listMessages));r.searchParams.set("conversationId",t),r.searchParams.set("limit",String(qa)),r.searchParams.set("sortBy","_id"),r.searchParams.set("sortOrder","desc"),n.length>0&&r.searchParams.set("ids",n.join(",")),o&&r.searchParams.set("beforeId",o);let a=await this.getJson(r.toString(),"loadConversation"),s=(a.messages??[]).toReversed();return{...a,messages:s,canContinue:a.canContinue??!0}}async markRead(t,n){if(!this.visitorId||!t)return!1;let o={type:"read",conversationId:t,...n===void 0?{}:{lastMessageAt:n},revision:++this.conversationRevision};this.conversationsCache.update(r=>{let a=Bt(r.conversations,o);return a===r.conversations?r:{...r,conversations:a}});for(let r of this.conversationListeners)r(o);try{return await this.postJson(lt.markRead,{conversationId:t},"markRead",!0),!0}catch(r){return Re.debug("markRead failed (non-fatal)",{err:r}),!1}}async requestOperator(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(lt.requestOperator,{},"requestOperator")).controlState}catch(t){Re.debug("requestOperator failed (non-fatal)",{err:t});return}}async cancelOperatorRequest(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(lt.cancelOperatorRequest,{},"cancelOperatorRequest")).controlState}catch(t){Re.debug("cancelOperatorRequest failed (non-fatal)",{err:t});return}}listContent(t={}){return this.contentCache.getOrFetch(this.localeCacheKey(t),()=>this.fetchContent(t))}async fetchContent(t){let n=new URL(this.dataUrl(lt.content));for(let[a,s]of Object.entries(t))s!==void 0&&n.searchParams.set(a,Array.isArray(s)?s.join(","):String(s));let o=await this.getJson(n.toString(),"listContent"),r=(o.items??[]).map(a=>os(a,this.locale));return{...o,items:r}}async bootstrap(t){let n=new URL(this.dataUrl(lt.bootstrap));t&&n.searchParams.set("conversationId",t);let o=await this.getJson(n.toString(),"bootstrap"),r=o.forms??[],a=o.formSubmissions??[];return{forms:r,formSubmissions:a}}async saveUserPrefs(t){return this.postJson(lt.updateSettings,{userPrefs:t},"saveUserPrefs")}get uploadPath(){return this.opts.endpoints?.upload??"/pai/upload-file"}get transcribePath(){return this.opts.endpoints?.transcribe??"/pai/transcribe-audio"}get submitFormPath(){return this.opts.endpoints?.submitForm??lt.submitForm}async submitForm(t){Re.debug("submitForm \u2192",{formId:t.formId,trigger:t.trigger,fields:Object.keys(t.values).length});try{await this.postJson(this.dataUrl(this.submitFormPath),t,"submitForm")}catch(n){Re.debug("submitForm failed (non-fatal)",{err:n})}}async submitFeedback(t){Re.debug("submitFeedback \u2192",{messageId:t.messageId,value:t.value});try{await this.postJson(lt.messageFeedback,{messageId:t.messageId,set:{feedback:t.value}},"submitFeedback")}catch(n){Re.debug("submitFeedback failed (non-fatal)",{err:n})}}async sendTurn(t){Re.debug("message \u2192",{conversationId:t.conversationId,visitorId:t.visitorId,messageCount:t.messages.length});try{return await this.runWithAbort(async n=>{let o=await this.fetchImpl(this.url(lt.streamMessage),{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope(t)),signal:n});if(o.status!==202)throw new We(`sendTurn failed: expected 202, received ${o.status}`,"server",o.status);let r;try{r=await o.json()}catch(a){throw n?.aborted?a:new We("sendTurn failed: invalid acknowledgement","server",o.status,a)}if(!lf(r))throw new We("sendTurn failed: invalid acknowledgement","server",o.status);return r},void 0,Zp)}catch(n){throw n instanceof We?n:new We("sendTurn failed: network error","network",void 0,n)}}cancelTurn(t,n){!this.visitorId||!t||!n||(Re.debug("cancel stream",{conversationId:t,runId:n,visitorId:this.visitorId}),this.fetchImpl(this.url(lt.cancelStream),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope({conversationId:t,runId:n})),keepalive:!0}).catch(o=>Re.debug("cancel POST failed (non-fatal)",{err:o})))}async connectResumeStream(t){let n=new AbortController,o=()=>n.abort(t.signal.reason);t.signal.aborted?o():t.signal.addEventListener("abort",o,{once:!0});let r=setTimeout(()=>n.abort(),ef),a=()=>{clearTimeout(r),t.signal.removeEventListener("abort",o)},s;try{s=await this.fetchImpl(this.resumeUrl(),{method:"GET",credentials:"omit",headers:{accept:"text/event-stream",...this.opts.auth.headers()},signal:n.signal})}catch(c){return a(),t.signal.aborted||Re.debug("resume-stream fetch failed \u2014 reconnecting",{err:c}),"held"}if(!s.ok)return a(),s.status===409||Ol.has(s.status)?(Re.debug("resume-stream \u2192 transient response; reconnecting",{status:s.status}),"held"):(Re.debug("resume-stream \u2192 endpoint unavailable",{status:s.status}),"unavailable");if(!s.body)return a(),Re.debug("resume-stream \u2192 bodyless response; stopping",{status:s.status}),"unavailable";if(!(s.headers.get("content-type")??"").includes("text/event-stream"))return a(),Re.debug("resume-stream \u2192 non-SSE response; stopping"),"unavailable";let l=!1;try{for await(let{chunk:c}of Rl(s,n.signal,d=>{l||d!=="connected"||(l=!0,clearTimeout(r),t.onConnected())})){if(t.signal.aborted)return"held";t.onChunk(c)}}catch(c){if(t.signal.aborted)return"held";Re.debug("resume-stream segment dropped \u2014 reconnecting",{err:c})}finally{a()}return"held"}resumeUrl(){return this.withEnvelopeQuery(lt.streamResume)}async postJson(t,n,o,r=!1){let a=await this.fetchWithRetry(()=>[this.url(t),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope(n)),...r?{keepalive:!0}:{}}],o);return this.assertOk(a,o)}async postForm(t,n,o,r,a){return this.runWithAbort(async s=>{let l=await this.fetchImpl(this.url(t),{method:"POST",credentials:"omit",headers:this.opts.auth.headers(),body:this.appendEnvelope(n),signal:s});return this.assertOk(l,o)},r,a)}async runWithAbort(t,n,o){if(!n&&o===void 0)return t();let r=new AbortController,a=()=>r.abort(n?.reason);n?.aborted?a():n?.addEventListener("abort",a,{once:!0});let s=o===void 0?void 0:setTimeout(()=>r.abort(),o);try{return await t(r.signal)}finally{s!==void 0&&clearTimeout(s),n?.removeEventListener("abort",a)}}async getJson(t,n){let o=await this.fetchWithRetry(()=>[this.withEnvelopeQuery(t),{method:"GET",credentials:"omit",headers:{accept:"application/json",...this.opts.auth.headers()}}],n);return this.assertOk(o,n)}async fetchWithRetry(t,n){for(let o=0;;o++){let[r,a]=t(),s;try{s=await this.fetchImpl(r,a)}catch(c){if(o>=Ll)throw new We(`${n} failed: network error`,"network",void 0,c);Re.debug("request network error \u2014 retrying",{label:n,attempt:o}),await lo(Nl(o));continue}if(s.ok||!Ol.has(s.status)||o>=Ll)return s;let l=af(s.headers)??Nl(o);Re.debug("request retryable status \u2014 retrying",{label:n,status:s.status,attempt:o,wait:l}),await lo(l)}}async assertOk(t,n){if(!t.ok)throw new We(`${n} failed: ${t.status}`,"server",t.status);return await t.json()}url(t){return/^https?:\/\//i.test(t)?t:`${this.opts.agentApiBaseUrl}${t}`}dataUrl(t){return/^https?:\/\//i.test(t)?t:`${this.opts.dataApiBaseUrl}${t}`}get fetchImpl(){return this.opts.fetchImpl??globalThis.fetch.bind(globalThis)}};function sf(e){return e.includes("webm")?"webm":e.includes("ogg")?"ogg":e.includes("mp4")||e.includes("m4a")?"m4a":e.includes("mpeg")?"mp3":e.includes("wav")?"wav":"bin"}function lf(e){if(typeof e!="object"||e===null)return!1;let t=Reflect.get(e,"status"),n=Reflect.get(e,"conversationId"),o=Reflect.get(e,"runId");return t==="accepted"&&typeof n=="string"&&n.length>0&&(o===void 0||typeof o=="string"&&o.length>0)}function cf(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.visitorId=="string"&&typeof t.conversationId=="string"}function Wa(e,t){let n=e?[{kind:"text",id:"t0",textSig:ae(e),doneSig:ae(!0)}]:[];return{id:ft(),role:"user",createdAt:Date.now(),status:"complete",attachments:t,partsSig:ae(n)}}function Ht(){return{id:ft(),role:"assistant",createdAt:Date.now(),status:"streaming",partsSig:ae([])}}function Fl(e){let t=ft();return df({id:t,role:e.role,createdAt:Date.now(),status:"complete",ephemeral:!0,parts:[{kind:"text",id:`${t}-t0`,text:e.text,done:!0}]})}function df(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,canceled:e.canceled,errorText:e.errorText,finishReason:e.finishReason,serverMessageId:e.serverMessageId,ephemeral:e.ephemeral,attachments:e.attachments,feedback:e.feedback,partsSig:ae(e.parts.map(vf))}}var Bl=new Set(["completed","failed","canceled"]);function uf(e){return e.status==="failed"?"error":e.role==="assistant"&&e.status!=null&&!Bl.has(e.status)?"streaming":"complete"}function Ga(e){let t=new Set,n=e.parts.map((r,a)=>r.type==="text"?{kind:"text",id:`${e.id}-t${a}`,textSig:ae(r.text),doneSig:ae(!0)}:r.type==="reasoning"?{kind:"reasoning",id:`${e.id}-r${a}`,textSig:ae(r.text),doneSig:ae(r.state!=="streaming")}:r.type==="step-start"?{kind:"step-start",id:`${e.id}-ss${a}`}:r.type==="file"?{kind:"file",url:r.url,mediaType:r.mediaType}:r.type==="source-url"?{kind:"source",sourceId:r.sourceId,url:r.url,title:r.title}:r.type==="source-document"?{kind:"source",sourceId:r.sourceId,title:r.title,filename:r.filename,mediaType:r.mediaType}:r.type==="data-suggestions"?null:r.type==="dynamic-tool"||r.type.startsWith("tool-")?{kind:"tool",toolCallId:r.toolCallId,toolName:r.type==="dynamic-tool"?r.toolName:El(r.type),dynamic:r.type==="dynamic-tool"?!0:void 0,inputPartialSig:ae(""),inputSig:ae(r.input),outputSig:ae(r.output),errorSig:ae(r.errorText),stateSig:ae(r.state),approvalSig:ae(r.approval)}:null).filter(r=>r!==null).filter(r=>r.kind!=="source"?!0:t.has(r.sourceId)?!1:(t.add(r.sourceId),!0)),o=e.parts.find(r=>r.type==="data-suggestions");return{id:e.id,role:e.role,operatorInitials:e.operatorInitials,suggestions:o?.type==="data-suggestions"?lr(o.data):void 0,serverMessageId:e.id,createdAt:sr(e.createdAt)??Date.now(),status:uf(e),canceled:e.status==="canceled",feedback:e.feedback??null,partsSig:ae(n)}}function _f(e){return!e.parts.some(t=>t.type==="text"&&t.text.trim()!==""||t.type==="dynamic-tool"||t.type.startsWith("tool-")||t.type==="file"||t.type==="source-url"||t.type==="source-document")}function pf(e){return e.role==="assistant"&&e.status!=null&&!Bl.has(e.status)&&_f(e)}function jt(e){let t=e.length-1;return e.filter((n,o)=>o===t||!pf(n)).map(Ga)}function Hl(e,t){let n=!t&&e.at(-1)?.role==="assistant"?-2:-1,o=e.at(n);return!o||o.ephemeral?[]:[o]}function Ka(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,canceled:e.canceled,errorText:e.errorText,finishReason:e.finishReason,serverMessageId:e.serverMessageId,ephemeral:e.ephemeral,attachments:e.attachments,parts:e.partsSig.value.map(hf)}}function Fe(e){let t="";for(let n of e.partsSig.value)n.kind==="text"&&(t+=n.textSig.value);return t}function ur(e,t,n,o,r,a=t.createdAt){let s=e.find(_=>_.role==="user"&&!_.ephemeral),l=(_,p)=>Fe(_).replace(/\s+/g," ").trim().slice(0,p),c=s?l(s,80):"",d=l(t,120);return{conversationId:n,title:c||o,lastMessageAt:new Date(a).toISOString(),preview:d||void 0,canContinue:r}}function wt(e){return Fe(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file"||t.kind==="source")}function ff(e){return Fe(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file")}function ja(e){return e==="approval-responded"||e==="output-available"||e==="output-denied"||e==="output-error"}var Nn=e=>e.kind==="tool",Ul=e=>e.kind==="text"&&e.textSig.value.trim()!==""||e.kind==="file";function uo(e){let t=e.partsSig.value,n=t.findLastIndex(o=>o.kind==="tool");return t.slice(n+1).some(Ul)}function dn(e){if(e.role!=="assistant")return!1;let t=e.partsSig.value.filter(Nn);return t.length>0&&t.every(n=>ja(n.stateSig.value))}function un(e){return e.role!=="assistant"?!1:e.partsSig.value.some(t=>t.kind==="tool")&&!uo(e)}function _r(e,t){return!e.partsSig.value.slice(t+1).some(n=>n.kind==="step-start"||Ul(n))}function pr(e){return e.partsSig.value.some(t=>Nn(t)&&!ja(t.stateSig.value))}function zl(e,t){if(t.length===0)return e;let n=new Set;for(let s of e)n.add(s.id),s.serverMessageId&&n.add(s.serverMessageId);let o=t.filter(s=>{let l=[s.id,s.serverMessageId].filter(c=>c!==void 0);return l.some(c=>n.has(c))?!1:(l.forEach(c=>n.add(c)),!0)});if(o.length===0)return e;let r=e.findIndex(s=>!s.ephemeral),a=r<0?e.length:r;return[...e.slice(0,a),...o,...e.slice(a)]}function ln(e,t){return t.id=e.id,e.canceled&&(t.canceled=!0),e.feedback!==void 0&&(t.feedback=e.feedback),t.suggestions??(t.suggestions=e.suggestions),t}function ql(e,t,n,o){if(!Xa(e))return;if(t.length===0){let s=Math.max(...o.values());return n.find(l=>l.role==="assistant"&&o.get(l.serverMessageId??l.id)===s&&Fe(l).length>=Fe(e).length)}let r=t.at(-1);if(r?.role!=="user")return;let a=o.get(r.serverMessageId??r.id);if(a!==void 0)return n.find(s=>s.role==="assistant"&&o.get(s.serverMessageId??s.id)===a+1&&Fe(s).length>=Fe(e).length)}function Xa(e){return e?.role==="assistant"&&e.status==="streaming"&&e.serverMessageId===void 0}function mf(e,t){let n=new Map(t.partsSig.value.filter(Nn).filter(a=>ja(a.stateSig.value)).map(a=>[a.toolCallId,a]));if(n.size===0)return;let o=!1,r=e.partsSig.value.map(a=>{if(!Nn(a))return a;let s=n.get(a.toolCallId);if(!s)return a;let l=a.approvalSig.value,c=s.approvalSig.value,d=l===void 0||l.approved===void 0&&c?.approved!==void 0?s.approvalSig:a.approvalSig,_=a.inputSig.value===void 0?s.inputSig:a.inputSig,p=a.toolName==="tool"?s.toolName:a.toolName,u=a.dynamic??s.dynamic;return d===a.approvalSig&&_===a.inputSig&&p===a.toolName&&u===a.dynamic?a:(o=!0,{...a,toolName:p,dynamic:u,inputSig:_,approvalSig:d})});o&&(e.partsSig.value=r)}function Ya(e,t){let n=t.filter(p=>!p.ephemeral&&(p.status==="streaming"||p.status==="pending"||p.status==="error"||p.retryAction!==void 0||(p.attachments?.length??0)>0||wt(p))),o=new Map;for(let p of n)o.set(p.id,p),p.serverMessageId!==void 0&&o.set(p.serverMessageId,p);let r=new Set,a=[],s=e.map(p=>{let u=(p.serverMessageId!==void 0?o.get(p.serverMessageId):void 0)??o.get(p.id);return u===void 0?(a.push(p),p):(r.add(u),u.role!==p.role?p:u.role==="user"&&u.serverMessageId===void 0&&(u.status==="pending"||u.status==="error")?ln(u,p):u.status==="streaming"||Fe(u).length>=Fe(p).length?(mf(u,p),u.suggestions??(u.suggestions=p.suggestions),u.feedback===void 0&&(u.feedback=p.feedback),p.canceled&&(u.canceled=!0),u):ln(u,p))}),l=n.filter(p=>!r.has(p)),c=l.findLast(Xa),d=new Map;e.forEach((p,u)=>{d.set(p.id,u),p.serverMessageId!==void 0&&d.set(p.serverMessageId,u)});let _=ql(c,c?n.slice(0,n.indexOf(c)):[],a,d);if(c&&_){let p=s.indexOf(_);p>=0&&(s[p]=ln(c,_)),l=l.filter(u=>u!==c)}return[...s,...l]}function _o(e,t){let n=new Map(t.filter(p=>p.serverMessageId!==void 0).map(p=>[p.serverMessageId,p])),o=new Map;t.forEach((p,u)=>{o.set(p.id,u),p.serverMessageId!==void 0&&o.set(p.serverMessageId,u)});let r=new Set(e.flatMap(p=>[p.serverMessageId,p.id].filter(u=>u!==void 0))),a=!1,s=e.map(p=>{let u=n.get(p.serverMessageId??p.id);if(u===void 0||u.role!==p.role)return p;if(p.role==="user"&&p.serverMessageId===void 0)return a=!0,ln(p,u);if(p.serverMessageId===void 0)return p;let f=Fe(u),m=Fe(p),b=u.status!=="streaming"&&f.length>=m.length&&Va(p,u);if(f.length>m.length||f===m&&u.partsSig.value.length>p.partsSig.value.length||b)return a=!0,ln(p,u);if(p.status==="streaming"&&u.status!=="streaming"&&gf(p,u)){if(p.continuationStreaming&&pr(u))return p;if(!Va(u,p))return a=!0,ln(p,u)}return p}),l=[...n.values()].filter(p=>!r.has(p.serverMessageId)),c=s.findLastIndex(Xa),d=s[c],_=ql(d,s.slice(0,c),l,o);if(d!==void 0&&_!==void 0&&Fe(_).length>=Fe(d).length&&(ln(d,_),s[c]=_,l.splice(l.indexOf(_),1),a=!0),l.length===0)return{messages:a?s:e,changed:a};for(let p of l){let u=o.get(p.serverMessageId??p.id),f=!1,m=s.findIndex(b=>{let h=o.get(b.serverMessageId??b.id);return u===void 0?!1:h===void 0?f:h>u?!0:(f=!0,!1)});m===-1?s.push(p):s.splice(m,0,p)}return{messages:s,changed:!0}}function Vl(e,t){if(e.role!==t.role)return!1;let n=Fe(t),o=Fe(e);return n.length>o.length||t.partsSig.value.length>e.partsSig.value.length||Va(e,t)}function gf(e,t){let n=e.partsSig.value,o=t.partsSig.value;return n.length!==o.length?!1:n.every((r,a)=>{let s=o[a];switch(r.kind){case"text":return s?.kind==="text"&&s.textSig.value===r.textSig.value;case"reasoning":return s?.kind==="reasoning"&&s.textSig.value===r.textSig.value;case"step-start":return s?.kind==="step-start";case"tool":return s?.kind==="tool"&&s.toolCallId===r.toolCallId&&fr(s.toolName,r.toolName);case"file":return s?.kind==="file"&&s.url===r.url&&s.mediaType===r.mediaType;case"source":return s?.kind==="source"&&s.sourceId===r.sourceId&&s.url===r.url&&s.title===r.title&&s.filename===r.filename&&s.mediaType===r.mediaType;default:return r}})}function fr(e,t){let n=e.startsWith("tool:")?e.slice(5):e,o=t.startsWith("tool:")?t.slice(5):t;return n===o}var $l={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function Va(e,t){let n=new Map(e.partsSig.value.filter(Nn).map(o=>[o.toolCallId,o]));return t.partsSig.value.filter(Nn).some(o=>{let r=n.get(o.toolCallId);if(!r||$l[o.stateSig.value]>$l[r.stateSig.value])return!0;let a=o.approvalSig.value?.approved;return a!==void 0&&a!==r.approvalSig.value?.approved})}function cn(e){return e.role==="assistant"&&e.status!=="streaming"&&!wt(e)}function mr(e,t){if(!e.includes(t)||t.retryAction===null)return;if(t.retryAction)return t.retryAction;if(t!==e.at(-1)||t.role!=="assistant"||t.serverMessageId===void 0||t.status!=="error"&&!cn(t))return;let n=e.indexOf(t);for(let o=n-1;o>=0;o--){let r=e[o];if(r?.role==="user"&&!r.ephemeral)return{kind:"repeat-user",messageId:r.id}}}function Wl(e){return e.canceled===!0&&e.role==="assistant"&&e.status!=="streaming"&&!ff(e)}function Gl(e,t){return e.operatorRoutedTurn?cn(e)?"drop":"complete-operator-routed":t||cn(e)?"error":"complete"}function vf(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,textSig:ae(e.text),doneSig:ae(e.done)}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,dynamic:e.dynamic,inputPartialSig:ae(e.inputPartial),inputSig:ae(e.input),outputSig:ae(e.output),errorSig:ae(e.error),stateSig:ae(e.state),approvalSig:ae(e.approval)}:e}function hf(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,text:e.textSig.value,done:e.doneSig.value}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,dynamic:e.dynamic,inputPartial:e.inputPartialSig.value,input:e.inputSig.value,output:e.outputSig.value,error:e.errorSig.value,state:e.stateSig.value,approval:e.approvalSig.value}:e}var Kl=Z.scope("feedback:audio"),gr=class{constructor(){le(this,"ctx",null);le(this,"master",null);le(this,"buffers",new Map)}unlock(){if(this.ctx){this.ctx.state==="suspended"&&this.ctx.resume();return}let t=globalThis.AudioContext??globalThis.webkitAudioContext;if(t)try{this.ctx=new t,this.master=this.ctx.createGain(),this.master.gain.value=1,this.master.connect(this.ctx.destination)}catch(n){Kl.warn("AudioContext init failed",{err:n})}}setVolume(t){if(!this.master||!this.ctx)return;let n=Math.max(0,Math.min(1,t));this.master.gain.setTargetAtTime(n,this.ctx.currentTime,.01)}playTone(t){let n=this.ctx,o=this.master;if(!n||!o||n.state!=="running")return;let r=n.currentTime,a=t.noteMs/1e3;t.notes.forEach((s,l)=>{let c=n.createOscillator();c.type=t.type,c.frequency.value=s;let d=n.createGain(),_=r+l*a;d.gain.setValueAtTime(1e-4,_),d.gain.exponentialRampToValueAtTime(t.peakGain,_+.005),d.gain.exponentialRampToValueAtTime(1e-4,_+a),c.connect(d).connect(o),c.start(_),c.stop(_+a+.01)})}async playUrl(t){let n=this.ctx,o=this.master;if(!n||!o||n.state!=="running")return;let r=await this.getBuffer(t);if(!r)return;let a=n.createBufferSource();a.buffer=r,a.connect(o),a.start()}destroy(){this.ctx&&this.ctx.close().catch(()=>{}),this.ctx=null,this.master=null,this.buffers.clear()}async getBuffer(t){if(!this.ctx)return null;let n=this.buffers.get(t);if(n)return n instanceof Promise,n;let o=this.ctx,r=fetch(t).then(a=>a.ok?a.arrayBuffer():Promise.reject(new Error(`fetch ${a.status}`))).then(a=>o.decodeAudioData(a)).then(a=>(this.buffers.set(t,a),a)).catch(a=>(Kl.warn("audio fetch/decode failed",{url:t,err:a}),this.buffers.delete(t),null));return this.buffers.set(t,r),r}};var jl={messageReceived:10,messageSent:0,error:[20,40,20],voiceStart:10,voiceStop:0},Xl={messageReceived:{notes:[880,1318.51],noteMs:90,type:"sine",peakGain:.45},messageSent:{notes:[1568],noteMs:60,type:"sine",peakGain:.25},error:{notes:[523.25,392],noteMs:120,type:"triangle",peakGain:.55},voiceStart:{notes:[1318.51],noteMs:50,type:"sine",peakGain:.3},voiceStop:{notes:[880],noteMs:50,type:"sine",peakGain:.3}};var Xt=null,vr=0;function bf(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}function yf(){if(typeof document>"u")return null;let e=document.createElement("input");e.type="checkbox",e.setAttribute("switch",""),e.setAttribute("aria-hidden","true"),e.tabIndex=-1,e.id=`__${C.cssPrefix}_haptic_${Math.random().toString(36).slice(2)}`;let t=document.createElement("label");t.htmlFor=e.id,t.setAttribute("aria-hidden","true");let n="position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;opacity:0!important;pointer-events:none!important;";return e.style.cssText=n,t.style.cssText=n,document.body.append(e,t),{input:e,label:t}}function Yl(e){if(!(e===0||Array.isArray(e)&&e.every(t=>t===0))){if(bf())try{navigator.vibrate(e);return}catch{}if(Xt||(Xt=yf()),!!Xt)try{Xt.label.click()}catch{}}}function Jl(){vr++;let e=!1;return()=>{e||(e=!0,vr=Math.max(0,vr-1),vr===0&&Xt&&(Xt.input.remove(),Xt.label.remove(),Xt=null))}}var Pf=Z.scope("feedback"),xf=100,hr=class{constructor(t,n){le(this,"mutedSig",ae(!1));le(this,"audio",new gr);le(this,"releaseHaptics");le(this,"sound");le(this,"haptics");le(this,"lastPlayed",new Map);le(this,"reducedMotionMq",null);this.sound=t,this.haptics=n,this.releaseHaptics=Jl(),this.audio.setVolume(this.effectiveVolume()),typeof matchMedia<"u"&&(this.reducedMotionMq=matchMedia("(prefers-reduced-motion: reduce)"))}unlock(){this.audio.unlock(),this.audio.setVolume(this.effectiveVolume())}update(t,n){this.sound=t,this.haptics=n,this.audio.setVolume(this.effectiveVolume())}setMuted(t){this.mutedSig.value!==t&&(this.mutedSig.value=t)}toggleMuted(){this.mutedSig.value=!this.mutedSig.value}play(t){this.mutedSig.value||this.isDeduped(t)||(this.lastPlayed.set(t,performance.now()),this.sound.enabled&&this.playSound(t),this.haptics.enabled&&this.isTouchDevice()&&this.playHaptic(t))}destroy(){this.audio.destroy(),this.releaseHaptics()}isDeduped(t){let n=this.lastPlayed.get(t);return n===void 0?!1:performance.now()-n<xf}playSound(t){let n=this.sound.events?.[t];if(n===!1)return;if(typeof n=="string"){this.audio.playUrl(n).catch(r=>Pf.warn("audio play failed",{err:r,url:n}));return}let o=Xl[t];o&&this.audio.playTone(o)}playHaptic(t){if(this.reducedMotionMq?.matches)return;let n=this.haptics.events?.[t];if(n===!1)return;let o=n===!0||n===void 0?jl[t]:n;Yl(o)}effectiveVolume(){let t=this.sound.volume??.3;return this.reducedMotionMq?.matches?t*.5:t}isTouchDevice(){return typeof window>"u"?!1:matchMedia("(hover: none) and (pointer: coarse)").matches}};var Sf=0;function i(e,t,n,o,r,a){t||(t={});var s,l,c=t;if("ref"in c)for(l in c={},t)l=="ref"?s=t[l]:c[l]=t[l];var d={type:e,props:c,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Sf,__i:-1,__u:0,__source:r,__self:a};if(typeof e=="function"&&(s=e.defaultProps))for(l in s)c[l]===void 0&&(c[l]=s[l]);return ne.vnode&&ne.vnode(d),d}var Q={fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24"},po=`${C.cssPrefix}-icon-dir`,Ja=()=>i("svg",{...Q,"aria-hidden":"true",children:i("path",{d:"M21 12a8 8 0 0 1-12 6.93L3 21l1.65-5.16A8 8 0 1 1 21 12Z"})}),Tt=()=>i("svg",{...Q,"aria-hidden":"true",children:i("path",{d:"M18 6 6 18M6 6l12 12"})}),Ql=()=>i("svg",{...Q,"aria-hidden":"true",children:i("path",{d:"M12 5v14M5 12h14"})}),Zl=()=>i("svg",{...Q,class:po,"aria-hidden":"true",children:[i("path",{d:"m22 2-7 20-4-9-9-4Z"}),i("path",{d:"M22 2 11 13"})]}),ec=()=>i("svg",{...Q,"aria-hidden":"true",children:i("path",{d:"M12 19V5M5 12l7-7 7 7"})}),tc=()=>i("svg",{...Q,class:po,"aria-hidden":"true",children:i("path",{d:"M3 20V4l18 8-18 8Z"})}),Dn=()=>i("svg",{...Q,class:po,"aria-hidden":"true",children:i("path",{d:"m9 18 6-6-6-6"})}),nc=()=>i("svg",{...Q,"aria-hidden":"true",children:i("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),oc=()=>i("svg",{...Q,"aria-hidden":"true",children:i("path",{d:"m21 11-9 9a5.5 5.5 0 0 1-7.78-7.78l8.49-8.49a3.67 3.67 0 0 1 5.19 5.19l-8.49 8.49a1.83 1.83 0 0 1-2.6-2.6l7.78-7.78"})}),rc=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),i("path",{d:"M5 10a7 7 0 0 0 14 0M12 19v3"})]}),ac=()=>i("svg",{...Q,"aria-hidden":"true",children:i("path",{d:"M3 8V3h5M21 8V3h-5M3 16v5h5M21 16v5h-5"})}),ic=()=>i("svg",{...Q,"aria-hidden":"true",children:i("path",{d:"M8 3v5H3M16 3v5h5M8 21v-5H3M16 21v-5h5"})}),sc=()=>i("svg",{...Q,"aria-hidden":"true",children:i("path",{d:"M3 3h7v2H5v5H3zM21 3h-7v2h5v5h2zM3 21h7v-2H5v-5H3zM21 21h-7v-2h5v-5h2z"})}),lc=()=>i("svg",{...Q,"aria-hidden":"true",children:i("path",{d:"M10 3v5H3M14 3v5h7M10 21v-5H3M14 21v-5h7"})}),cc=()=>i("svg",{...Q,"aria-hidden":"true",viewBox:"0 0 10 10",children:i("path",{d:"M9 1L1 9M9 5L5 9M9 9H9",strokeWidth:"1.5"})}),dc=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"5",r:"1.5",fill:"currentColor",stroke:"none"}),i("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),i("circle",{cx:"12",cy:"19",r:"1.5",fill:"currentColor",stroke:"none"})]}),uc=()=>i("svg",{...Q,"aria-hidden":"true",children:i("path",{d:"M11 5 6 9H2v6h4l5 4zM15 9a5 5 0 0 1 0 6M18 7a9 9 0 0 1 0 10"})}),_c=()=>i("svg",{...Q,"aria-hidden":"true",children:i("path",{d:"M11 5 6 9H2v6h4l5 4zM22 9l-6 6M16 9l6 6"})}),pc=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("path",{d:"M3 18 8 6l5 12M4.7 14h6.6"}),i("path",{d:"M14.5 18l3.2-7 3.2 7M15.6 15.8h4.2"})]}),fc=()=>i("svg",{...Q,class:po,"aria-hidden":"true",children:i("path",{d:"m5 6 6 6-6 6M13 6l6 6-6 6"})}),_n=()=>i("svg",{...Q,"aria-hidden":"true",children:i("path",{d:"M20 6 9 17l-5-5"})}),mc=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("path",{d:"M3 3v6h6"}),i("path",{d:"M3.05 13A9 9 0 1 0 6 5.3L3 9"}),i("path",{d:"M12 7v5l3 2"})]}),gc=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("path",{d:"M2 12h20"}),i("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]}),fo=()=>i("svg",{...Q,class:po,"aria-hidden":"true",children:i("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),vc=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("path",{d:"M12 20h9"}),i("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]}),pn=()=>i("svg",{...Q,"aria-hidden":"true",children:i("path",{d:"m6 9 6 6 6-6"})}),hc=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),i("path",{d:"M14 2v6h6"})]}),kf=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("path",{d:"m12 3-1.5 4.5L6 9l4.5 1.5L12 15l1.5-4.5L18 9l-4.5-1.5Z"}),i("path",{d:"M19 15v4M17 17h4M5 3v2M4 4h2"})]}),Qa=()=>i("svg",{...Q,"aria-hidden":"true",children:i("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z"})}),mo=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),i("path",{d:"M12 17h.01"})]}),wf=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("path",{d:"m15 4 3 3-9 9-3-3z"}),i("path",{d:"M18 2v2M20 4h2M3 20l3-3M3 16h2M5 14v2"})]}),Cf=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("rect",{x:"4",y:"8",width:"16",height:"12",rx:"2"}),i("path",{d:"M12 8V4"}),i("circle",{cx:"12",cy:"3",r:"1"}),i("path",{d:"M2 14h2M20 14h2M9 13h.01M15 13h.01M9.5 17h5"})]}),Za=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("path",{d:"M4 14v-2a8 8 0 0 1 16 0v2"}),i("rect",{x:"2",y:"14",width:"4",height:"6",rx:"1.5"}),i("rect",{x:"18",y:"14",width:"4",height:"6",rx:"1.5"}),i("path",{d:"M20 20v1a3 3 0 0 1-3 3h-5"})]}),Rf=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("circle",{cx:"12",cy:"12",r:"4"}),i("path",{d:"m4.93 4.93 4.24 4.24M14.83 14.83l4.24 4.24M14.83 9.17l4.24-4.24M4.93 19.07l4.24-4.24"})]}),ei=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("circle",{cx:"11",cy:"11",r:"7"}),i("path",{d:"m21 21-4.3-4.3"})]}),bc=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]}),yc=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("path",{d:"M3 9.5 12 3l9 6.5"}),i("path",{d:"M5 9v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9"})]}),Pc=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("path",{d:"m3 11 15-5v12L3 13z"}),i("path",{d:"M3 11v2a2 2 0 0 0 2 2h1V9H5a2 2 0 0 0-2 2z"}),i("path",{d:"M7 15v3a2 2 0 0 0 4 0v-2"}),i("path",{d:"M21 10a3 3 0 0 1 0 4"})]}),go=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z"}),i("path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1"})]}),xc=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"4"}),i("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}),Sc=()=>i("svg",{...Q,"aria-hidden":"true",children:i("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),kc=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"M12 3v18"}),i("path",{d:"M12 3a9 9 0 0 1 0 18z",fill:"currentColor",stroke:"none"})]}),Tf=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("circle",{cx:"10.5",cy:"10.5",r:"6.5"}),i("path",{d:"M8 11a2.5 2.5 0 0 0 5 0"}),i("path",{d:"m20 20-4.4-4.4"})]}),If=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("path",{d:"M12 3.5 13.6 9 19 10.5 13.6 12 12 17.5 10.4 12 5 10.5 10.4 9z"}),i("path",{d:"M18.5 4v3M20 5.5h-3M5.5 16v2.5M6.75 17.25h-2.5"})]}),Ef=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("path",{d:"M4 18h16"}),i("path",{d:"M5 18a7 7 0 0 1 14 0"}),i("path",{d:"M12 8V6"}),i("path",{d:"M10 6h4"})]}),Af=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("path",{d:"M7 11V6.5a1.5 1.5 0 0 1 3 0V10"}),i("path",{d:"M10 10V5.5a1.5 1.5 0 0 1 3 0V10"}),i("path",{d:"M13 10V6.5a1.5 1.5 0 0 1 3 0V12"}),i("path",{d:"M16 9.5a1.5 1.5 0 0 1 3 0v2.5a7 7 0 0 1-7 7 7 7 0 0 1-6.4-4.2L4 12.5a1.5 1.5 0 0 1 2.6-1.5L7 11"})]}),wc=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),i("path",{d:"M5 15a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2"})]}),Cc=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("path",{d:"M7 10v11H4a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1z"}),i("path",{d:"M7 10l4-7a2.5 2.5 0 0 1 2.5 2.5V8h5a2 2 0 0 1 2 2.3l-1.2 8A2 2 0 0 1 17.3 20H7"})]}),Rc=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("path",{d:"M17 14V3h3a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1z"}),i("path",{d:"M17 14l-4 7a2.5 2.5 0 0 1-2.5-2.5V16h-5a2 2 0 0 1-2-2.3l1.2-8A2 2 0 0 1 6.7 4H17"})]}),Tc=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"3.5"}),i("path",{d:"M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M19.1 4.9l-2.1 2.1M7 17l-2.1 2.1"})]}),Ic=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"M12 7v5l3 2"})]}),br=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]}),yr=()=>i("svg",{...Q,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"m15 9-6 6M9 9l6 6"})]}),Ec={chat:Ja,message:Qa,bubbles:go,spark:kf,wand:wf,bot:Cf,help:mo,lifebuoy:Rf,headset:Za,search:Tf,sparkles:If,concierge:Ef,wave:Af};var H=C.cssPrefix,E={launcher:`${H}-launcher`,callout:`${H}-callout`,calloutDismiss:`${H}-callout-dismiss`,panel:`${H}-panel`,panelHeader:`${H}-panel-header`,resizeGrip:`${H}-resize-grip`,scrollToBottom:`${H}-scroll-to-bottom`,loadPreviousMessages:`${H}-load-previous-messages`,actionHistory:`${H}-action-history`,actionClose:`${H}-action-close`,langSegment:`${H}-lang-segment`,composer:`${H}-composer`,composerInput:`${H}-composer-input`,composerSend:`${H}-composer-send`,composerStop:`${H}-composer-stop`,composerAttach:`${H}-composer-attach`,composerFileInput:`${H}-composer-file-input`,composerVoice:`${H}-composer-voice`,attachmentChip:`${H}-attachment-chip`,attachmentRemove:`${H}-attachment-remove`,suggestion:`${H}-suggestion`,messageBubble:`${H}-message`,messageRetry:`${H}-message-retry`,messageFeedback:`${H}-message-feedback`,feedbackUp:`${H}-feedback-up`,feedbackDown:`${H}-feedback-down`,messageCopy:`${H}-message-copy`,historyPane:`${H}-history-pane`,historyBack:`${H}-history-back`,historyItem:`${H}-history-item`,historyLoadMore:`${H}-history-load-more`,sidebar:`${H}-sidebar`,sidebarToggle:`${H}-sidebar-toggle`,sidebarNewConversation:`${H}-sidebar-new-conversation`,sidebarItem:`${H}-sidebar-item`,messengerHome:`${H}-messenger-home`,modulesEmpty:`${H}-modules-empty`,tab:`${H}-tab`,tabBadge:`${H}-tab-badge`,homeView:`${H}-home-view`,homeGreeting:`${H}-home-greeting`,homeBrand:`${H}-home-brand`,backHeader:`${H}-back-header`,contentView:`${H}-content-view`,contentScroll:`${H}-content-scroll`,homeSearch:`${H}-home-search`,helpSearch:`${H}-help-search`,homeRecent:`${H}-home-recent`,homeContentRow:`${H}-home-content-row`,helpArticle:`${H}-help-article`,newsItem:`${H}-news-item`,formGate:`${H}-form-gate`,formDone:`${H}-form-done`,formDoneToggle:`${H}-form-done-toggle`,formAnswers:`${H}-form-answers`,formFill:`${H}-form-fill`,formSubmit:`${H}-form-submit`,formSkip:`${H}-form-skip`,formField:`${H}-form-field`,toolAskQuestions:`${H}-tool-ask-questions`,toolInputSubmit:`${H}-tool-input-submit`,toolInputSkip:`${H}-tool-input-skip`,toolApproval:`${H}-tool-approval`,toolApprove:`${H}-tool-approve`,toolReject:`${H}-tool-reject`,toolEdit:`${H}-tool-edit`,toolDecision:`${H}-tool-decision`,typingDots:`${H}-typing-dots`,reasoning:`${H}-reasoning`,toolAskSummary:`${H}-ask-questions-summary`,toolAskOptions:`${H}-ask-questions-options-toggle`,toolCall:`${H}-tool-call`,source:`${H}-source`,operatorRequest:`${H}-operator-request`,operatorBanner:`${H}-operator-banner`,cancelOperatorRequest:`${H}-cancel-operator-request`};function Ge(e,t){return`${e}-${t}`}var Pr=C.cssPrefix;function Ac({onToggle:e,launcher:t,strings:n,leaving:o,edgeTab:r}){let a=t.variant!=="circle"&&!!t.label;return i("button",{type:"button",class:`${Pr}-fab`,"data-variant":t.variant,"data-size":t.size,"data-edge-tab":r?"true":void 0,"data-leaving":o?"true":void 0,"data-testid":E.launcher,onClick:e,"aria-label":n.launcherOpen,children:[Mf(t.icon),a?i("span",{class:`${Pr}-fab-label`,children:rt(n,t.label??"")}):null]})}function Mf(e){let t=Ec[e];return t?i(t,{}):i(Lf,{source:e})}function Lf({source:e}){return i("span",{ref:t=>{t&&Of(t,e)},"aria-hidden":"true"})}function Of(e,t){if(e.dataset.svgMounted!==t)try{let o=new DOMParser().parseFromString(t,"image/svg+xml").documentElement;o&&o.tagName.toLowerCase()==="svg"&&(e.replaceChildren(document.importNode(o,!0)),e.dataset.svgMounted=t)}catch{}}function Mc({callout:e,launcherPosition:t,strings:n,closeLabel:o,onDismiss:r}){let[a,s]=B(!1);return O(()=>{let l=setTimeout(()=>s(!0),e.delayMs);return()=>clearTimeout(l)},[e.delayMs]),O(()=>{if(!a||e.autoDismissMs<=0)return;let l=setTimeout(r,e.autoDismissMs);return()=>clearTimeout(l)},[a,e.autoDismissMs,r]),a?i("div",{class:`${Pr}-callout`,role:"status","data-shape":e.shape,"data-position":Nf(e.position,t),"data-animated":e.animated?"true":void 0,"data-testid":E.callout,children:[i("span",{children:rt(n,e.text)}),i("button",{type:"button",class:`${Pr}-callout-close`,onClick:r,"aria-label":o,title:o,"data-testid":E.calloutDismiss,children:i(Tt,{})})]}):null}function Nf(e,t){let n=t.endsWith("-right"),o=t.startsWith("bottom-");return e==="vertical"?o?"top":"bottom":n?"left":"right"}function xr({panelEl:e,resize:t,position:n,initialSize:o,onSizeChange:r,strings:a}){let s=C.cssPrefix,l=M(null);if(O(()=>{if(!e)return;let m=e.style;t.minWidth&&m.setProperty(`--${s}-resize-min-w`,t.minWidth),t.maxWidth&&m.setProperty(`--${s}-resize-max-w`,t.maxWidth),t.minHeight&&m.setProperty(`--${s}-resize-min-h`,t.minHeight),t.maxHeight&&m.setProperty(`--${s}-resize-max-h`,t.maxHeight),o&&(m.setProperty(`--${s}-widget-w`,`${o.width}px`),m.setProperty(`--${s}-widget-h`,`${o.height}px`))},[e,t.minWidth,t.maxWidth,t.minHeight,t.maxHeight,s,o]),!e)return null;let c=n.startsWith("top-"),d=n.endsWith("-right"),_=`${s}-resize-grip ${s}-resize-grip--${c?"bottom":"top"}-${d?"left":"right"}`,p=m=>{if(!e)return;let b=m.currentTarget,h=e.getBoundingClientRect();l.current={pointerId:m.pointerId,startX:m.clientX,startY:m.clientY,startW:h.width,startH:h.height,dirX:d?-1:1,dirY:c?1:-1},b.setPointerCapture(m.pointerId),e.setAttribute("data-resizing",""),m.preventDefault()},u=m=>{let b=l.current;if(!b||m.pointerId!==b.pointerId||!e)return;let h=(m.clientX-b.startX)*b.dirX,x=(m.clientY-b.startY)*b.dirY;e.style.setProperty(`--${s}-widget-w`,`${b.startW+h}px`),e.style.setProperty(`--${s}-widget-h`,`${b.startH+x}px`)},f=m=>{let b=l.current;if(!b||m.pointerId!==b.pointerId||!e)return;m.currentTarget.releasePointerCapture(m.pointerId),e.removeAttribute("data-resizing");let h=e.getBoundingClientRect();r({width:Math.round(h.width),height:Math.round(h.height)}),l.current=null};return i("div",{class:_,role:"separator","aria-orientation":"vertical","aria-label":a.resizeHandle,title:a.resizeHandle,onPointerDown:p,onPointerMove:u,onPointerUp:f,onPointerCancel:f,"data-testid":E.resizeGrip,children:i(cc,{})})}var fn=C.cssPrefix,Df=`.${fn}-header, .${fn}-back-header, .${fn}-home-hero`,$f='button, a, input, textarea, select, [role="tab"], [contenteditable]',Lc=56;function Sr(e,t){O(()=>{if(!t||!e)return;let n=c=>Number.parseFloat(c)||0,o=(c,d)=>Math.min(d,Math.max(-d,c)),r=null,a=c=>{let d=c.target;if(!(d instanceof Element)||!d.closest(Df)||d.closest($f))return;let _=e.getBoundingClientRect();r={id:c.pointerId,x:c.clientX,y:c.clientY,dx:n(e.style.getPropertyValue(`--${fn}-modal-dx`)),dy:n(e.style.getPropertyValue(`--${fn}-modal-dy`)),maxX:(window.innerWidth+_.width)/2-Lc,maxY:(window.innerHeight+_.height)/2-Lc},e.dataset.dragging="true",c.preventDefault()},s=c=>{if(!r||c.pointerId!==r.id)return;let d=o(r.dx+c.clientX-r.x,r.maxX),_=o(r.dy+c.clientY-r.y,r.maxY);e.style.setProperty(`--${fn}-modal-dx`,`${d}px`),e.style.setProperty(`--${fn}-modal-dy`,`${_}px`)},l=c=>{!r||c.pointerId!==r.id||(r=null,delete e.dataset.dragging)};return e.addEventListener("pointerdown",a),window.addEventListener("pointermove",s),window.addEventListener("pointerup",l),window.addEventListener("pointercancel",l),()=>{e.removeEventListener("pointerdown",a),window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",l),window.removeEventListener("pointercancel",l)}},[e,t])}function vo(e,t,n){switch(e){case"clear":case"sound":case"history":case"language":case"theme":case"textSize":return!0;case"expand":return t==="floating";case"fullscreen":return t!=="standalone";case"close":return t==="standalone"||t==="page"?!1:t==="inline"?n==="fullscreen":!0}}function kr(e,t,n){return vo("close",e,t)?n.includes("close"):!1}function Oc(e,t){return e==="inline"&&t==="fullscreen"?"exit-fullscreen":"close"}var Ff='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function wr(e){let t=n=>{if(n.key!=="Tab")return;let o=[...e.querySelectorAll(Ff)].filter(l=>l.offsetParent!==null||l===document.activeElement);if(o.length===0){n.preventDefault();return}let r=o[0],a=o[o.length-1];if(!r||!a)return;let s=e.getRootNode().activeElement;n.shiftKey&&s===r?(n.preventDefault(),a.focus()):!n.shiftKey&&s===a&&(n.preventDefault(),r.focus())};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}function Cr(e){return e.trim().split(/\s+/).slice(0,2).map(t=>t.charAt(0).toUpperCase()).join("")}var ti=C.cssPrefix;function Nc({agent:e,strings:t}){let n=e.status??"online",o=rt(t,e.name),r=e.title?rt(t,e.title):null;return i("div",{class:`${ti}-agent`,children:[i("div",{class:`${ti}-agent-avatar`,"data-status":n,children:e.avatar?i("img",{src:e.avatar,alt:""}):i("span",{children:Cr(o)})}),i("div",{class:`${ti}-agent-meta`,children:[i("strong",{children:o}),r?i("span",{children:r}):null]})]})}var Dc=Z.scope("attachments");function Rr(e,t,n){let o=Hf(e),r=[],a=[],s=qf(n.accept),l=t.reduce((d,_)=>d+_.size,0),c=t.length;for(let d of o){let _=Bf(d,c,l,n,s);if(_){a.push({file:d,reason:_});continue}r.push(zf(d)),l+=d.size,c+=1}return(r.length||a.length)&&Dc.debug("ingest",{accepted:r.length,rejected:a.map(d=>({name:d.file.name,reason:d.reason}))}),{accepted:r,rejected:a}}function Tr(e){try{URL.revokeObjectURL(e.previewUrl)}catch(t){Dc.debug("revokeObjectURL failed",{error:t})}}function Bf(e,t,n,o,r){return t>=o.maxCount?"count":n+e.size>o.maxBytes?"bytes":Vf(e,r)?null:"mime"}function Hf(e){return e?Array.isArray(e)?e.filter(t=>t instanceof File):[...e].map(t=>t instanceof File?t:Uf(t)).filter(t=>t!==null):[]}function Uf(e){let t=e;return!t?.getAsFile||t.kind!=="file"?null:t.getAsFile()}function zf(e){return{file:e,id:ft(),mediaType:e.type||"application/octet-stream",name:e.name||"pasted-file",previewUrl:URL.createObjectURL(e),size:e.size}}function qf(e){return e.split(",").map(t=>t.trim().toLowerCase()).filter(Boolean).map(t=>{if(t.startsWith("."))return{kind:"ext",ext:t};let[n="*",o="*"]=t.split("/");return{kind:"mime",type:n,subtype:o}})}function Vf(e,t){if(t.length===0)return!0;let[n="*",o="*"]=(e.type||"").toLowerCase().split("/"),r=(e.name||"").toLowerCase();return t.some(a=>a.kind==="ext"?r.endsWith(a.ext):(a.type==="*"||a.type===n)&&(a.subtype==="*"||a.subtype===o))}var ho=C.cssPrefix;function $c({attachment:e,onRemove:t,disabled:n=!1}){let o=e.mediaType.startsWith("image/");return i("span",{class:`${ho}-attachment-chip`,title:e.name,"data-testid":Ge(E.attachmentChip,e.id),children:[o?i("img",{class:`${ho}-attachment-thumb`,src:e.previewUrl,alt:""}):i("span",{class:`${ho}-attachment-thumb`,"aria-hidden":"true",children:i(hc,{})}),i("span",{class:`${ho}-attachment-name`,children:e.name}),i("button",{type:"button",class:`${ho}-attachment-remove`,onClick:t,disabled:n,"aria-label":`Remove ${e.name}`,"data-testid":Ge(E.attachmentRemove,e.id),children:i(Tt,{})})]})}var ni={isSupported:!1,start:()=>{},stop:()=>{},cancel:()=>{}};function oi(e,t,n){return e==="disabled"?ni:e==="server"?jf(n):Wf(t)}function Wf(e){let t=Gf();if(!t)return ni;let n=null,o=0;return{isSupported:!0,start(r,a){let s=n,l=++o;n=null,s?.abort();let c=new t;n=c,c.continuous=!0,c.interimResults=!0,c.lang=e;let d=!1;c.addEventListener("result",p=>{if(o!==l||n!==c)return;let u=p,f="",m=!1;for(let b=u.resultIndex;b<u.results.length;b++){let h=u.results[b];h&&(f+=h[0].transcript,h.isFinal&&(m=!0))}r(f,m)});let _=()=>{d||o!==l||n!==c||(d=!0,n=null,a())};c.addEventListener("end",_),c.addEventListener("error",_);try{c.start()}catch{_()}},stop(){n?.stop()},cancel(){o++;let r=n;n=null,r?.abort()}}}function Gf(){return window.SpeechRecognition??window.webkitSpeechRecognition}var Kf=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];function jf(e){if(typeof MediaRecorder>"u"||!navigator?.mediaDevices?.getUserMedia)return ni;let t=0,n=null,o=s=>{for(let l of s.stream?.getTracks()??[])l.stop();s.stream=null},r=()=>{t++;let s=n;n=null,s&&(o(s),s.recorder?.state!=="inactive"&&s.recorder?.stop())},a=async s=>{if(s.finishing)return;s.finishing=!0;let l=s.recorder?.mimeType??"audio/webm";o(s);let c=new Blob(s.chunks,{type:l});s.chunks=[];try{let{text:d}=await e(c,l);n===s&&t===s.generation&&d&&s.onText(d,!0)}catch{}finally{n===s&&t===s.generation&&(n=null,s.onEnd())}};return{isSupported:!0,async start(s,l){r();let c={generation:t,recorder:null,stream:null,chunks:[],onText:s,onEnd:l,finishing:!1};n=c;try{let d=await navigator.mediaDevices.getUserMedia({audio:!0});if(n!==c||t!==c.generation){for(let u of d.getTracks())u.stop();return}c.stream=d;let _=Xf(),p=new MediaRecorder(d,_?{mimeType:_}:void 0);c.recorder=p,p.addEventListener("dataavailable",u=>{n===c&&t===c.generation&&u.data.size>0&&c.chunks.push(u.data)}),p.addEventListener("stop",()=>{n===c&&t===c.generation&&a(c)}),p.start()}catch{o(c),n===c&&t===c.generation&&(n=null,l())}},stop(){let s=n;if(s){if(!s.recorder){r();return}s.recorder.state!=="inactive"&&s.recorder.stop()}},cancel(){r()}}}function Xf(){for(let e of Kf)if(MediaRecorder.isTypeSupported(e))return e}var dt=C.cssPrefix,$n=Z.scope("composer");function Fn(e){return e.reduce((t,n)=>t+n.size,0)}var Yf={arrowUp:ec,paperPlane:Zl,send:tc,chevron:Dn};function Fc(e){return"activeElement"in e}function Jf(e){return"host"in e&&"activeElement"in e}function Bc({options:e,transport:t,feedback:n,bus:o,persistence:r,conversationId:a,isStreaming:s,active:l=!0,isPreparing:c=!1,operatorRequestEnabled:d,canRequestOperator:_=!1,controlMode:p,onRequestOperator:u,onSend:f,onStop:m,attachApiRef:b}){let h=e.strings,[x,P]=B(()=>r.loadDraft(a)),[v,y]=B([]),[k,w]=B(!1),[$,ie]=B(!1),z=M(!1),T=M(null),D=M(null),G=M(null),F=M(0),ee=M(a);ee.current=a;let I=M(l);I.current=l;let U=M(c);U.current=c;let V=$||c||!l,pe=L(q=>{P(W=>{let oe=typeof q=="function"?q(W):q;return oe===W?W:(r.saveDraft(ee.current,oe),oe)})},[r]),te=e.features.fileUpload,ue=e.features.voice,[we,_t]=B(()=>oi(ue,e.locale,(q,W)=>t.transcribe(q,W))),et=M(we);et.current=we;let Je=M({mode:ue,locale:e.locale,transport:t});O(()=>{let q=Je.current;q.mode===ue&&q.locale===e.locale&&q.transport===t||(Je.current={mode:ue,locale:e.locale,transport:t},F.current++,et.current.cancel(),G.current=null,w(!1),_t(oi(ue,e.locale,(W,oe)=>t.transcribe(W,oe))))},[e.locale,ue,t]),O(()=>()=>{F.current++,we.cancel()},[we]);let Ue=L(q=>{let W=G.current;if(W===null)return!1;let oe=Date.now()-W;return $n[q]("voiceStop",{durationMs:oe}),o.emit("voiceStop",{durationMs:oe}),G.current=null,!0},[o]),Qe=L(()=>{G.current!==null&&(we.stop(),w(!1),Ue("info")&&n.play("voiceStop"))},[Ue,n,we]),pt=L(()=>{F.current++,we.cancel(),w(!1),Ue("info")&&n.play("voiceStop")},[Ue,n,we]);O(()=>{(c||!l)&&pt()},[l,pt,c]),O(()=>{let q=T.current;if(!q)return;let W=q.getRootNode(),oe=Fc(W)?W.activeElement:null;oe&&q.closest(`.${dt}-panel`)?.contains(oe)||q.focus({preventScroll:!0})},[]),O(()=>{let q=T.current;if(!q)return;if(x.length===0){q.style.height="";return}q.style.height="auto";let W=getComputedStyle(q),oe=Number.parseFloat(W.getPropertyValue(`--${dt}-textarea-base-height`)),_e=Number.parseFloat(W.borderTopWidth)+Number.parseFloat(W.borderBottomWidth),S=Math.min(q.scrollHeight+_e,Number.parseFloat(W.maxHeight)),X=Number.parseFloat(W.fontSize)*.7;q.style.height=`${S<oe+X?oe:S}px`},[x]);let tt=M(v);tt.current=v,O(()=>()=>tt.current.forEach(Tr),[]),O(()=>{if(b)return b.current={attachFromDrop:q=>{if(!te||!I.current||z.current||U.current)return;let W=Rr(q,tt.current,e.attachments);W.accepted.length!==0&&($n.info("attach (drop)",{count:W.accepted.length,totalBytes:Fn(W.accepted)}),o.emit("attach",{count:W.accepted.length,totalBytes:Fn(W.accepted)}),y(oe=>[...oe,...W.accepted]))},fill:q=>{if(!I.current||z.current||U.current)return;pe(q);let W=T.current;W&&(W.focus({preventScroll:!0}),requestAnimationFrame(()=>W.setSelectionRange(W.value.length,W.value.length)))}},()=>{b.current&&(b.current=null)}},[b,te,c,e.attachments,pe]),O(()=>{let q=T.current;if(!q)return;let W=q.closest(`.${dt}-panel`);if(!W)return;let oe=_e=>{if(!I.current||z.current||U.current)return;let S=_e.clipboardData;if(!S)return;let X=_e.target?.closest?.("input, textarea, [contenteditable]:not([contenteditable='false'])");if(X&&X!==q)return;if(te){let re=Rr(S.items,tt.current,e.attachments);if(re.accepted.length>0){_e.preventDefault(),$n.info("attach (paste)",{count:re.accepted.length,totalBytes:Fn(re.accepted)}),o.emit("attach",{count:re.accepted.length,totalBytes:Fn(re.accepted)}),y(Pe=>[...Pe,...re.accepted]);return}}if(X===q)return;let fe=S.getData("text/plain");fe&&(_e.preventDefault(),pe(re=>re+fe),q.focus())};return W.addEventListener("paste",oe),()=>W.removeEventListener("paste",oe)},[te,e.attachments,pe]);let nt=async()=>{let q=x.trim();if(!q&&v.length===0||!l||s||z.current||c)return;pt(),z.current=!0,ie(!0);let W=x,oe=v;try{await f(q,oe)&&(pe(_e=>_e===W?"":_e),y(_e=>_e!==oe?_e:(oe.forEach(Tr),tt.current=[],[])))}finally{z.current=!1,ie(!1),requestAnimationFrame(()=>{let _e=T.current;if(!_e||_e.disabled||!I.current)return;let S=_e.getRootNode(),X=Fc(S)?S.activeElement:null,fe=X?.getAttribute("data-testid");if(!(X&&X!==_e&&fe!==E.composerSend&&fe!==E.composerStop)){if(Jf(S)){let re=S.host.ownerDocument;if(!re.hasFocus())return;let Pe=re.activeElement;if(Pe&&Pe!==S.host&&Pe!==re.body)return}_e.focus({preventScroll:!0})}})}},ge=q=>{q.key!=="Enter"||q.shiftKey||q.isComposing||(q.preventDefault(),s?m():nt())},at=q=>{let W=q.target;if(!l||z.current||c){W.value="";return}let oe=Rr(W.files,v,e.attachments);oe.accepted.length>0&&($n.info("attach (file picker)",{count:oe.accepted.length,totalBytes:Fn(oe.accepted)}),o.emit("attach",{count:oe.accepted.length,totalBytes:Fn(oe.accepted)}),y(_e=>[..._e,...oe.accepted])),W.value=""},Xe=q=>{!l||z.current||c||($n.info("removeAttachment",{id:q}),o.emit("removeAttachment",{id:q}),y(W=>{let oe=W.find(_e=>_e.id===q);return oe&&Tr(oe),W.filter(_e=>_e.id!==q)}))},ze=()=>{if(k){Qe();return}if(!l||!we.isSupported||z.current||c)return;let q=++F.current;G.current=Date.now(),$n.info("voiceStart"),o.emit("voiceStart",void 0),w(!0),n.play("voiceStart"),we.start((W,oe)=>{F.current!==q||!I.current||U.current||z.current||!oe||pe(_e=>`${_e}${W} `)},()=>{F.current!==q||!I.current||(w(!1),Ue("debug"))})},xt=Yf[e.composer.sendButton.icon];return i("div",{class:`${dt}-composer`,"data-testid":E.composer,children:[v.length>0?i("div",{class:`${dt}-attachments`,children:v.map(q=>i($c,{attachment:q,onRemove:()=>Xe(q.id),disabled:V},q.id))}):null,i("div",{class:`${dt}-composer-row`,children:[i("div",{class:`${dt}-composer-actions`,children:[te?i("button",{type:"button",class:`${dt}-icon-btn`,onClick:()=>D.current?.click(),disabled:V,"aria-label":h.attach,"data-testid":E.composerAttach,children:i(oc,{})}):null,we.isSupported?i("button",{type:"button",class:`${dt}-icon-btn`,onClick:ze,disabled:V,"aria-label":k?h.micStop:h.micStart,"aria-pressed":k,"data-recording":k?"true":void 0,"data-testid":E.composerVoice,children:i(rc,{})}):null]}),i("textarea",{ref:T,name:"message",class:`${dt}-textarea`,rows:1,value:x,placeholder:h.composerPlaceholder,onInput:q=>pe(q.currentTarget.value),onKeyDown:ge,disabled:V,"aria-label":h.composerPlaceholder,"data-testid":E.composerInput}),s?i("button",{type:"button",class:`${dt}-send`,onClick:m,disabled:V,"aria-label":h.stop,"data-testid":E.composerStop,children:i(nc,{})}):i("button",{type:"button",class:`${dt}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:()=>{nt()},disabled:V||!x.trim()&&v.length===0,"aria-label":h.send,"data-testid":E.composerSend,children:i(xt,{})}),d&&p==="ai-agent"&&u?i("button",{type:"button",class:`${dt}-icon-btn`,onClick:u,disabled:V||!_,"aria-label":h.talkToOperator,title:h.talkToOperator,"data-testid":E.operatorRequest,children:i(Za,{})}):null]}),i("input",{ref:D,name:"attachments",type:"file",multiple:!0,accept:e.attachments.accept,onChange:at,disabled:V,class:`${dt}-sr-only`,"data-testid":E.composerFileInput})]})}var Qf=C.cssPrefix;function Hc({visible:e,strings:t}){return e?i("div",{class:`${Qf}-dropzone`,role:"status","aria-live":"polite",children:t.dropZone}):null}function Ir({containerRef:e,onDrop:t,disabled:n=!1}){let[o,r]=B(!1);return O(()=>{if(n){r(!1);return}let a=e.current;if(!a)return;let s=0,l=p=>{s+=1,p.dataTransfer?.types.includes("Files")&&(p.preventDefault(),r(!0))},c=()=>{s-=1,!(s>0)&&(s=0,r(!1))},d=p=>{p.dataTransfer?.types.includes("Files")&&p.preventDefault()},_=p=>{s=0,r(!1),p.dataTransfer&&(p.preventDefault(),t(p.dataTransfer.items))};return a.addEventListener("dragenter",l),a.addEventListener("dragleave",c),a.addEventListener("dragover",d),a.addEventListener("drop",_),()=>{a.removeEventListener("dragenter",l),a.removeEventListener("dragleave",c),a.removeEventListener("dragover",d),a.removeEventListener("drop",_)}},[e,n,t]),{visible:n?!1:o}}function Uc({itemCount:e,initialFocusIndex:t}){let[n,o]=B(!1),r=M(null),a=M(null),[s,l]=B(-1),c=L(()=>{o(!1),l(-1),r.current?.focus()},[]),d=L(()=>o(u=>!u),[]);O(()=>{if(!n)return;let u=f=>{let m=a.current,b=r.current;if(!m||!b)return;let h=f.composedPath();h.includes(m)||h.includes(b)||(o(!1),l(-1))};return document.addEventListener("click",u,!0),()=>document.removeEventListener("click",u,!0)},[n]),O(()=>{if(!n||e===0)return;let u=t?.()??0,f=u<0||u>=e?0:u;l(f)},[n,e,t]),O(()=>{if(!n||s<0)return;a.current?.querySelectorAll("[role='menuitem']")?.[s]?.focus()},[n,s]);let _=L(u=>{(u.key==="ArrowDown"||u.key==="Enter"||u.key===" ")&&(u.preventDefault(),o(!0))},[]),p=L(u=>{if(e!==0)switch(u.key){case"Escape":u.preventDefault(),c();return;case"ArrowDown":u.preventDefault(),l(f=>(f+1)%e);return;case"ArrowUp":u.preventDefault(),l(f=>(f-1+e)%e);return;case"Home":u.preventDefault(),l(0);return;case"End":u.preventDefault(),l(e-1)}},[e,c]);return{open:n,focusIndex:s,triggerRef:r,menuRef:a,toggle:d,close:c,onTriggerKey:_,onMenuKey:p}}function zc({items:e,triggerLabel:t}){let n=C.cssPrefix,o=Uc({itemCount:e.length}),r=l=>{l.disabled||(l.onSelect?.(),l.keepOpen||o.close())},a=(l,c)=>l.onSelectValue?.(c),s=(l,c)=>{let d=c.segments;if(!d?.length)return;let _=Math.max(0,d.findIndex(u=>u.value===c.value)),p=-1;if(l.key==="ArrowRight"||l.key==="Enter"||l.key===" ")p=(_+1)%d.length;else if(l.key==="ArrowLeft")p=(_-1+d.length)%d.length;else return;l.preventDefault(),l.stopPropagation(),a(c,d[p].value)};return i("div",{class:`${n}-menu-wrap`,children:[i("button",{ref:o.triggerRef,type:"button",class:`${n}-icon-btn`,"aria-label":t,"aria-haspopup":"menu","aria-expanded":o.open,title:t,onClick:o.toggle,onKeyDown:o.onTriggerKey,children:i(dc,{})}),o.open?i("div",{ref:o.menuRef,class:`${n}-menu`,role:"menu","aria-label":t,onKeyDown:o.onMenuKey,tabIndex:-1,children:e.map(l=>l.segments?i("div",{role:"menuitem",class:`${n}-menu-item ${n}-menu-item-segmented`,"aria-label":l.label,tabIndex:-1,onKeyDown:c=>s(c,l),children:[l.icon?i("span",{class:`${n}-menu-icon`,children:l.icon}):null,i("span",{class:`${n}-menu-label`,children:l.label}),i("span",{class:`${n}-segmented`,role:"group","aria-label":l.label,children:l.segments.map(c=>{let d=c.value===l.value;return i("button",{type:"button",role:"menuitemradio","aria-checked":d,class:`${n}-segment`,"data-on":d?"true":void 0,lang:c.lang,title:c.value,tabIndex:-1,"data-testid":`${E.langSegment}-${c.value}`,onClick:()=>a(l,c.value),children:c.label},c.value)})})]},l.id):i("button",{type:"button",role:"menuitem",class:`${n}-menu-item`,"aria-pressed":l.type==="switch"?l.on:void 0,disabled:l.disabled,onClick:()=>r(l),children:[l.icon?i("span",{class:`${n}-menu-icon`,children:l.icon}):null,i("span",{class:`${n}-menu-label`,children:l.label}),l.type==="switch"&&l.on?i("span",{class:`${n}-menu-check`,"aria-hidden":"true",children:i(_n,{})}):null]},l.id))}):null]})}var ri=C.cssPrefix;function Zf(e){let t=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)").matches:!0;return e==="auto"?t?"light":"dark":t?e==="light"?"dark":"auto":e==="dark"?"light":"auto"}var em={normal:"large",large:"small",small:"normal"};function tm(e){return e==="light"?i(xc,{}):e==="dark"?i(Sc,{}):i(kc,{})}function nm(e){return(e.split("-")[0]??e).toUpperCase()}function It({panelProps:e,variant:t}){let{options:n,panelSize:o,feedback:r,onClose:a,onClear:s,onExpand:l,onFullscreen:c,onSoundToggle:d}=e,{onToggleHistory:_,onLocaleChange:p,onThemeChange:u,onTextSizeChange:f}=e,m=n.strings,b=n.mode,h=t==="chat",x=mt(()=>r.mutedSig.value).value,P=new Set(n.actions),v=F=>P.has(F),y=typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches,k=F=>y?!1:vo(F,b,o),w=n.themeMode,$={auto:m.themeAuto,light:m.themeLight,dark:m.themeDark},ie=n.textSize,z={small:m.textSizeSmall,normal:m.textSizeNormal,large:m.textSizeLarge},T=[];if(h&&v("clear")&&T.push({id:"clear",icon:i(vc,{}),label:m.newConversation,onSelect:s}),v("expand")&&k("expand")){let F=o==="expanded";T.push({id:"expand",icon:F?i(ic,{}):i(ac,{}),label:F?m.collapse:m.expand,type:"switch",on:F,onSelect:l})}if(v("fullscreen")&&k("fullscreen")){let F=o==="fullscreen";T.push({id:"fullscreen",icon:F?i(lc,{}):i(sc,{}),label:F?m.exitFullscreen:m.fullscreen,type:"switch",on:F,onSelect:c})}h&&v("sound")&&T.push({id:"sound",icon:x?i(_c,{}):i(uc,{}),label:x?m.soundOff:m.soundOn,type:"switch",on:!x,onSelect:d}),v("theme")&&T.push({id:"theme",icon:tm(w),label:`${m.theme}: ${$[w]}`,onSelect:()=>u(Zf(w)),keepOpen:!0}),v("textSize")&&T.push({id:"textSize",icon:i(pc,{}),label:`${m.textSize}: ${z[ie]}`,onSelect:()=>f(em[ie]),keepOpen:!0}),v("language")&&n.availableLocales.length>1&&T.push({id:"language",icon:i(gc,{}),label:m.language,segments:n.availableLocales.map(F=>({value:F,label:nm(F),lang:F})),value:n.locale,onSelectValue:p});let D=!!a&&kr(b,o,n.actions),G=h&&v("history");return i("div",{class:`${ri}-header-actions`,children:[G?i("button",{type:"button",class:`${ri}-icon-btn`,onClick:_,"aria-label":m.history,title:m.history,"data-testid":E.actionHistory,children:i(mc,{})}):null,T.length>0?i(zc,{items:T,triggerLabel:m.moreActions}):null,D?i("button",{type:"button",class:`${ri}-icon-btn`,onClick:a,"aria-label":m.close,title:m.close,"data-testid":E.actionClose,children:i(Tt,{})}):null]})}var om=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,rm=/^https?:\/\/[^\s.]+\.[^\s]+$/i,am=/^[+]?[\d\s().-]{6,}$/;function Bn(e,t){return e.replace(/\{(\w+)\}/g,(n,o)=>String(t[o]??`{${o}}`))}function im(e){return Array.isArray(e)?e.length:e&&e.trim()?1:0}function sm(e,t,n){let o=e.required??!0,r=e.validation;if(e.type==="multiselect"){let s=im(t);return o&&s===0?n.formRequired:s===0?void 0:r?.minSelections!=null&&s<r.minSelections?Bn(n.formChooseAtLeast,{min:r.minSelections}):r?.maxSelections!=null&&s>r.maxSelections?Bn(n.formChooseAtMost,{max:r.maxSelections}):void 0}let a=typeof t=="string"?t.trim():"";if(!a)return o?n.formRequired:void 0;switch(e.type){case"email":if(!om.test(a))return n.formInvalidEmail;break;case"url":if(!rm.test(a))return n.formInvalidUrl;break;case"tel":if(!am.test(a))return n.formInvalidTel;break;case"number":{let s=Number(a);if(!Number.isFinite(s))return n.formInvalidNumber;if(r?.min!=null&&s<r.min)return Bn(n.formNumberTooSmall,{min:r.min});if(r?.max!=null&&s>r.max)return Bn(n.formNumberTooLarge,{max:r.max});break}default:break}if(r?.minLength!=null&&a.length<r.minLength)return Bn(n.formTooShort,{min:r.minLength});if(r?.maxLength!=null&&a.length>r.maxLength)return Bn(n.formTooLong,{max:r.maxLength});if(r?.pattern)try{if(!new RegExp(r.pattern).test(a))return n.formPatternMismatch}catch{}}function qc(e,t,n){let o={};for(let r of e){let a=sm(r,t[r.name],n);a&&(o[r.name]=a)}return o}function Vc(e){let t={};for(let[n,o]of Object.entries(e)){let r=Array.isArray(o)?o.join(", "):o;r&&r.trim()&&(t[n]=r.trim())}return t}var Te=C.cssPrefix,Er="__other__";function bo({fields:e,strings:t,submitLabel:n,onSubmit:o,skipLabel:r,onSkip:a,footerHint:s,submitOnEnter:l,disabled:c,initialValues:d,hideActions:_,fieldTypeLabels:p,rootTestId:u,submitTestId:f,skipTestId:m}){let[b,h]=B(()=>({...um(e),...d})),[x,P]=B({}),[v,y]=B({}),k=T=>{v[T]&&y(D=>({...D,[T]:""}))},w=(T,D)=>{h(G=>({...G,[T]:D})),k(T)},$=(T,D)=>{P(G=>({...G,[T]:D})),k(T)},ie=T=>{if(T.preventDefault(),c)return;let D=_m(e,b,x),G=qc(e,D,t);if(Object.keys(G).length>0){y(G);return}o(Vc(D))},z=T=>{!l||T.key!=="Enter"||T.shiftKey||T.isComposing||T.target?.tagName==="TEXTAREA"&&ie(T)};return i("form",{class:`${Te}-form`,onSubmit:ie,onKeyDown:z,"data-testid":u,noValidate:!0,children:[e.map(T=>i(lm,{field:T,value:b[T.name],otherText:x[T.name]??"",error:v[T.name],disabled:c,typeLabel:p?.[T.name],strings:t,onChange:D=>w(T.name,D),onOtherChange:D=>$(T.name,D)},T.name)),_?null:i("div",{class:`${Te}-form-actions`,children:[s?i("span",{class:`${Te}-form-hint`,children:s}):null,r&&a?i("button",{type:"button",class:`${Te}-form-skip`,onClick:a,disabled:c,"data-testid":m,children:r}):null,i("button",{type:"submit",class:`${Te}-form-submit`,disabled:c,"data-testid":f,children:n})]})]})}function lm({field:e,value:t,otherText:n,error:o,disabled:r,typeLabel:a,strings:s,onChange:l,onOtherChange:c}){let d=Ge(E.formField,e.name),_=cm({field:e,value:t,otherText:n,disabled:r,strings:s,onChange:l,onOtherChange:c,fieldTid:d});return i("label",{class:`${Te}-field`,"data-field":e.name,"data-invalid":o?"true":void 0,children:[i("span",{class:`${Te}-field-head`,children:[i("span",{class:`${Te}-field-label`,children:[e.label,e.required??!0?i("span",{class:`${Te}-field-req`,"aria-hidden":"true",children:" *"}):null]}),a?i("span",{class:`${Te}-field-type`,children:a}):null]}),_,e.validationHint&&!o?i("span",{class:`${Te}-field-hint`,children:e.validationHint}):null,o?i("span",{class:`${Te}-field-error`,role:"alert",children:o}):null]})}function cm(e){let{field:t,value:n,otherText:o,disabled:r,strings:a,onChange:s,onOtherChange:l,fieldTid:c}=e,d=typeof n=="string"?n:"";switch(t.type){case"textarea":return i("textarea",{class:`${Te}-field-input`,rows:3,value:d,placeholder:t.placeholder,disabled:r,onInput:_=>s(_.target.value),"data-testid":c});case"select":return i("select",{class:`${Te}-field-input`,value:d,disabled:r,onChange:_=>s(_.target.value),"data-testid":c,children:[i("option",{value:"",children:t.placeholder??"\u2014"}),(t.options??[]).map(_=>i("option",{value:_.value,children:_.label??_.value},_.value))]});case"radio":{let _=t.allowOther&&d===Er;return i("div",{class:`${Te}-field-choices`,role:"radiogroup","data-testid":c,children:[(t.options??[]).map(p=>i("label",{class:`${Te}-choice`,children:[i("input",{type:"radio",name:`${Te}-${t.name}`,checked:d===p.value,disabled:r,onChange:()=>s(p.value)}),i("span",{children:p.label??p.value})]},p.value)),t.allowOther?i("label",{class:`${Te}-choice`,children:[i("input",{type:"radio",name:`${Te}-${t.name}`,checked:d===Er,disabled:r,onChange:()=>s(Er)}),i("span",{children:a.formOther})]}):null,_?i("input",{class:`${Te}-field-input`,value:o,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:r,onInput:p=>l(p.target.value)}):null]})}case"checkbox":return i("label",{class:`${Te}-choice`,children:[i("input",{type:"checkbox",checked:d==="true",disabled:r,onChange:_=>s(_.target.checked?"true":""),"data-testid":c}),i("span",{children:t.placeholder??t.label})]});case"multiselect":{let _=Array.isArray(n)?n:[],p=(u,f)=>s(f?[..._,u]:_.filter(m=>m!==u));return i("div",{class:`${Te}-field-choices`,"data-testid":c,children:[(t.options??[]).map(u=>i("label",{class:`${Te}-choice`,children:[i("input",{type:"checkbox",checked:_.includes(u.value),disabled:r,onChange:f=>p(u.value,f.target.checked)}),i("span",{children:u.label??u.value})]},u.value)),t.allowOther||(t.options??[]).length===0?i("textarea",{class:`${Te}-field-input`,rows:2,value:o,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:r,onInput:u=>l(u.target.value)}):null]})}default:return i("input",{class:`${Te}-field-input`,type:dm(t.type),value:d,placeholder:t.placeholder,disabled:r,onInput:_=>s(_.target.value),"data-testid":c})}}function dm(e){switch(e){case"number":case"email":case"tel":case"url":case"date":case"time":return e;default:return"text"}}function um(e){let t={};for(let n of e)n.defaultValue!=null&&(t[n.name]=n.type==="multiselect"?n.defaultValue.split(",").map(o=>o.trim()).filter(Boolean):n.defaultValue);return t}function _m(e,t,n){let o={...t};for(let r of e){let a=n[r.name]?.trim();if(r.type==="radio"&&r.allowOther&&t[r.name]===Er)o[r.name]=a??"";else if(r.type==="multiselect"&&a){let s=a.split(/[,\n;]+/).map(c=>c.trim()).filter(Boolean),l=Array.isArray(t[r.name])?t[r.name]:[];o[r.name]=[...l,...s]}}return o}var Et=C.cssPrefix;function ai({form:e,strings:t,onSubmit:n,onSkip:o}){return i("div",{class:`${Et}-form-gate`,"data-testid":E.formGate,children:[e.title?i("h3",{class:`${Et}-form-gate-title`,children:e.title}):null,e.description?i("p",{class:`${Et}-form-gate-desc`,children:e.description}):null,i(bo,{fields:e.fields,strings:t,submitLabel:e.submitLabel??t.formSubmit,onSubmit:n,skipLabel:e.skippable?t.formSkip:void 0,onSkip:e.skippable?o:void 0,submitTestId:E.formSubmit,skipTestId:E.formSkip})]})}function Wc({marker:e,strings:t,onFill:n}){let o=e.outcome==="skipped",r=o?t.formSkipped:t.formSubmitted,a=e.title?i(me,{children:[i("span",{children:e.title}),i("span",{class:`${Et}-sr-only`,children:r})]}):i("span",{children:r}),s=e.form?.reviewable??!1,l=!o&&s&&e.values&&Object.keys(e.values).length>0?e.values:null;if(l){let c=d=>e.form?.fields.find(_=>_.name===d)?.label??d;return i("details",{class:`${Et}-form-done`,"data-outcome":e.outcome,"data-testid":E.formDone,children:[i("summary",{class:`${Et}-form-done-summary`,"data-testid":E.formDoneToggle,children:[i(_n,{}),a,i(Dn,{})]}),i("dl",{class:`${Et}-form-answers`,"data-testid":E.formAnswers,children:Object.entries(l).map(([d,_])=>i("div",{class:`${Et}-form-answer`,children:[i("dt",{children:c(d)}),i("dd",{children:_})]},d))})]})}return i("div",{class:`${Et}-form-done`,"data-outcome":e.outcome,"data-testid":E.formDone,role:"status",children:[o?i(fc,{}):i(_n,{}),a,o&&e.form?.reopenable&&n?i("button",{type:"button",class:`${Et}-form-done-fill`,"data-testid":E.formFill,onClick:n,children:t.formFillOut}):null]})}function mm(e,t){for(var n in t)e[n]=t[n];return e}function si(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var o in t)if(o!=="__source"&&e[o]!==t[o])return!0;return!1}function Gc(e,t){this.props=e,this.context=t}function ed(e,t){function n(r){var a=this.props.ref;return a!=r.ref&&a&&(typeof a=="function"?a(null):a.current=null),t?!t(this.props,r)||a!=r.ref:si(this.props,r)}function o(r){return this.shouldComponentUpdate=n,Dt(e,r)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.__f=o.prototype.isReactComponent=!0,o.type=e,o}(Gc.prototype=new st).isPureReactComponent=!0,Gc.prototype.shouldComponentUpdate=function(e,t){return si(this.props,e)||si(this.state,t)};var Kc=ne.__b;ne.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Kc&&Kc(e)};var dP=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var gm=ne.__e;ne.__e=function(e,t,n,o){if(e.then){for(var r,a=t;a=a.__;)if((r=a.__c)&&r.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k||[]),r.__c(e,t)}gm(e,t,n,o)};var jc=ne.unmount;function td(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(o){typeof o.__c=="function"&&o.__c()}),e.__c.__H=null),(e=mm({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(o){return td(o,t,n)})),e}function nd(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(o){return nd(o,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function ii(){this.__u=0,this.o=null,this.__b=null}function od(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Ar(){this.i=null,this.l=null}ne.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),jc&&jc(e)},(ii.prototype=new st).__c=function(e,t){var n=t.__c,o=this;o.o==null&&(o.o=[]),o.o.push(n);var r=od(o.__v),a=!1,s=function(){a||o.__z||(a=!0,n.__R=null,r?r(c):c())};n.__R=s;var l=n.__P;n.__P=null;var c=function(){if(!--o.__u){if(o.state.__a){var d=o.state.__a;o.__v.__k[0]=nd(d,d.__c.__P,d.__c.__O)}var _;for(o.setState({__a:o.__b=null});_=o.o.pop();)_.__P=l,_.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(s,s)},ii.prototype.componentWillUnmount=function(){this.o=[]},ii.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=td(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&Dt(me,null,e.fallback);return r&&(r.__u&=-33),[Dt(me,null,t.__a?null:e.children),r]};var Xc=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(Ar.prototype=new st).__a=function(e){var t=this,n=od(t.__v),o=t.l.get(e);return o[0]++,function(r){var a=function(){t.props.revealOrder?(o.push(r),Xc(t,e,o)):r()};n?n(a):a()}},Ar.prototype.render=function(e){this.i=null,this.l=new Map;var t=to(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Ar.prototype.componentDidUpdate=Ar.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Xc(e,n,t)})};var vm=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,hm=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,bm=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,ym=/[A-Z0-9]/g,Pm=typeof document<"u",xm=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};st.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(st.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Yc=ne.event;ne.event=function(e){return Yc&&(e=Yc(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var rd,Sm={configurable:!0,get:function(){return this.class}},Jc=ne.vnode;ne.vnode=function(e){typeof e.type=="string"&&(function(t){var n=t.props,o=t.type,r={},a=o.indexOf("-")==-1;for(var s in n){var l=n[s];if(!(s==="value"&&"defaultValue"in n&&l==null||Pm&&s==="children"&&o==="noscript"||s==="class"||s==="className")){var c=s.toLowerCase();s==="defaultValue"&&"value"in n&&n.value==null?s="value":s==="download"&&l===!0?l="":c==="translate"&&l==="no"?l=!1:c[0]==="o"&&c[1]==="n"?c==="ondoubleclick"?s="ondblclick":c!=="onchange"||o!=="input"&&o!=="textarea"||xm(n.type)?c==="onfocus"?s="onfocusin":c==="onblur"?s="onfocusout":bm.test(s)&&(s=c):c=s="oninput":a&&hm.test(s)?s=s.replace(ym,"-$&").toLowerCase():l===null&&(l=void 0),c==="oninput"&&r[s=c]&&(s="oninputCapture"),r[s]=l}}o=="select"&&(r.multiple&&Array.isArray(r.value)&&(r.value=to(n.children).forEach(function(d){d.props.selected=r.value.indexOf(d.props.value)!=-1})),r.defaultValue!=null&&(r.value=to(n.children).forEach(function(d){d.props.selected=r.multiple?r.defaultValue.indexOf(d.props.value)!=-1:r.defaultValue==d.props.value}))),n.class&&!n.className?(r.class=n.class,Object.defineProperty(r,"className",Sm)):n.className&&(r.class=r.className=n.className),t.props=r})(e),e.$$typeof=vm,Jc&&Jc(e)};var Qc=ne.__r;ne.__r=function(e){Qc&&Qc(e),rd=e.__c};var Zc=ne.diffed;ne.diffed=function(e){Zc&&Zc(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value),rd=null};function Mr(e){if(!e)return!1;let t=e.startsWith("tool:")?e.slice(5):e;return t==="ask-user-questions"||t==="ask_user_questions"}var yt=C.cssPrefix;function ci(e){return e.startsWith("tool:")||e.startsWith("tool-")?e.slice(5):e}function Lr(e,t){let n=e==="output-available"||e==="output-error"||e==="output-denied",o=e==="approval-responded"||t?.approved!==void 0;return{terminal:n,responded:o,decided:n||o}}function di({status:e,icon:t,label:n}){return i("span",{class:`${yt}-toolui-badge ${yt}-toolui-status`,"data-status":e,children:[i("span",{class:`${yt}-toolui-status-icon`,children:t}),n]})}function km(e,t){return e==="output-error"?"error":e==="output-denied"||t?.approved===!1?"denied":e==="output-available"?"completed":e==="approval-responded"||t?.approved===!0?"responded":e==="approval-requested"?"awaiting":"running"}function ui(e,t,n={}){return n.submitted?"responded":Rm(km(e,t),n.superseded,n.live??!0)}function wm({status:e}){return e==="denied"||e==="error"||e==="superseded"?i(yr,{}):e==="completed"||e==="responded"?i(br,{}):i(Ic,{})}function Cm(e,t){switch(e){case"awaiting":return t.statusAwaiting;case"responded":return t.statusResponded;case"completed":return t.statusCompleted;case"denied":return t.statusDenied;case"error":return t.statusError;case"superseded":return t.statusSuperseded;default:return t.statusRunning}}function Rm(e,t,n){return t&&(e==="awaiting"||e==="running")?"superseded":!n&&e==="running"?"error":e}function Tm({state:e,approval:t,strings:n,superseded:o,live:r=!0,submitted:a=!1}){let s=ui(e,t,{superseded:o,live:r,submitted:a});return i(di,{status:s,icon:i(wm,{status:s}),label:Cm(s,n)})}function Im({name:e,state:t,approval:n,strings:o,superseded:r,live:a,submitted:s}){return i(me,{children:[i("span",{class:`${yt}-toolui-name-pill`,children:[i(Tc,{}),i("span",{class:`${yt}-toolui-name-text`,children:e})]}),i(Tm,{state:t,approval:n,strings:o,superseded:r,live:a,submitted:s}),i("span",{class:`${yt}-toolui-chevron`,children:i(pn,{})})]})}function Or({part:e,strings:t,testid:n,superseded:o,live:r,submitted:a}){let s=se(()=>be(()=>e.inputSig.value),[e]),l=se(()=>be(()=>e.outputSig.value),[e]),c=se(()=>be(()=>e.errorSig.value),[e]),d=se(()=>be(()=>e.stateSig.value),[e]),_=se(()=>be(()=>e.approvalSig.value),[e]);return i("details",{class:`${yt}-toolui ${yt}-toolui-collapsible`,"data-testid":n,children:[i("summary",{class:`${yt}-toolui-head`,children:i(Im,{name:ci(e.toolName),state:d.value,approval:_.value,strings:t,superseded:o,live:r,submitted:a})}),i(li,{label:t.toolParameters,value:s.value}),l.value!==void 0?i(li,{label:t.toolResult,value:l.value}):null,c.value?i(li,{label:t.statusError,value:c.value,error:!0}):null]})}function li({label:e,value:t,error:n}){let o=n?String(t??""):Nr(_i(t));return o?i("div",{class:`${yt}-toolui-section`,children:[i("span",{class:`${yt}-toolui-label`,children:e}),i("pre",{class:`${yt}-toolui-code`,"data-error":n?"true":void 0,children:o})]}):null}function _i(e){if(e&&typeof e=="object"){let t=e;if(t.storage==="tool-result-ref"&&"summary"in t)return t.summary}return e}function Nr(e){if(e==null)return"";try{let t=typeof e=="string"?e:JSON.stringify(e,null,2);return!t||t==="{}"||t==="[]"||t==='""'?"":t.length>800?`${t.slice(0,800)}\u2026`:t}catch{return""}}function ad(e){return e.partsSig.value.some(t=>t.kind==="text"&&t.textSig.value.length>0)}function id(e){return e.partsSig.value.some(t=>t.kind==="reasoning")}function Em(e){return e.streaming&&!e.bufferedHold&&!(e.reasoningVisible&&e.working)}function sd(e){let{streaming:t,reasoningVisible:n,emptyReply:o,hidden:r}=e,a=e.responseMode==="buffered"&&t,s=t&&!e.hasAnswerText;return{streaming:t,bufferedHold:a,reasoningVisible:n,working:s,showStreamDots:Em({streaming:t,bufferedHold:a,reasoningVisible:n,working:s}),emptyReply:o,hidden:r}}function ld(e,t){let n=e.stateSig.value,o=e.approvalSig.value,{terminal:r,responded:a,decided:s}=Lr(n,o),l=t.continuationStreaming===!0&&!s,c=t.superseded&&!s&&!l;return{pill:ui(n,o,{superseded:c,live:t.live,submitted:l}),state:n,terminal:r,decided:s||l,showApproveReject:!s&&!t.superseded&&!l,showAnswered:a&&!r&&!c,showSubmitted:l,showEdit:a&&t.active&&!r,skipped:c,answeredApproved:o?.approved}}var mi=1,dd=2,ud=4,_d=8,pd=16;function Am(e){switch(e){case mi:return"href";case dd:return"src";case ud:return"class";case _d:return"checked";case pd:return"start"}}var Mm=e=>{switch(e){case 1:return 3;case 2:return 4;case 3:return 5;case 4:return 6;case 5:return 7;default:return 8}},Lm=Mm;var cd=24;function vi(e){let t=new Uint32Array(cd);return t[0]=1,{renderer:e,text:"",pending:"",tokens:t,len:0,token:1,fence_end:0,blockquote_idx:0,hr_char:"",hr_chars:0,fence_start:0,spaces:new Uint8Array(cd),indent:"",indent_len:0,table_state:0}}function fd(e){e.pending.length>0&&Ye(e,`
|
|
12
|
-
`)}function
|
|
13
|
-
`:if(console.assert(e.pending.length===1),e.tokens[e.len]===25&&e.token===21){
|
|
14
|
-
`:if(e.hr_chars<3)break;
|
|
15
|
-
`:{
|
|
16
|
-
`:e.table_state=2,e.pending="";continue;default:
|
|
17
|
-
`:
|
|
18
|
-
`:
|
|
11
|
+
${a}`:a;continue}r.startsWith("id:")&&(o=r.slice(3).trim())}if(n==="[DONE]")return"done";if(!n)return null;try{let r=JSON.parse(n);return wl.trace("chunk",{type:r.type,eventId:o}),{chunk:r,eventId:o}}catch(r){throw wl.trace("frame parse failed",{err:r,payload:n.slice(0,200)}),new He("invalid SSE frame","network",void 0,r)}}function Wp(e){let t=new TextEncoder().encode(e),n="";for(let o of t)n+=String.fromCharCode(o);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}var Rl=e=>e&&Object.keys(e).length>0?e:void 0;function Tl(e,t){let n=Rl(e),o=Rl(t);if(!n&&!o)return;let r={};return n&&(r.user=n),o&&(r.page=o),Wp(JSON.stringify(r))}function or(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function Kp(e){return`tool-${e.startsWith("tool:")?e.slice(5):e}`}function Il(e){return e.startsWith("tool-")?e.slice(5):e}var nt={handshake:"/pai/handshake",streamMessage:"/pai/stream-message",streamResume:"/pai/stream-resume",cancelStream:"/pai/cancel-stream",listConversations:"/pai/list-conversations",listMessages:"/pai/list-messages",updateSettings:"/pai/update-settings",markRead:"/pai/mark-read",messageFeedback:"/pai/message-feedback",requestOperator:"/pai/request-operator",cancelOperatorRequest:"/pai/cancel-request-operator",bootstrap:"/pai/bootstrap",content:"/pai/content",submitForm:"/pai/submit-form"},El="context";function zt(e){let t=e??{},n=t.controlMode;return{controlMode:n==="awaiting_operator"||n==="operator"?n:"ai-agent",controlRevision:typeof t.controlRevision=="number"&&Number.isSafeInteger(t.controlRevision)&&t.controlRevision>=0?t.controlRevision:void 0,assignedOperatorInitials:typeof t.assignedOperatorInitials=="string"&&t.assignedOperatorInitials?t.assignedOperatorInitials:void 0,operatorAvailable:typeof t.operatorAvailable=="boolean"?t.operatorAvailable:void 0}}function rr(e){let t=e?.suggestions;if(!Array.isArray(t))return[];let n=[];for(let o of t){if(!o||typeof o!="object")continue;let{id:r,label:a,text:s}=o;typeof a!="string"||!a||n.push({id:typeof r=="string"&&r?r:`s${n.length}`,label:a,text:typeof s=="string"&&s?s:a})}return n}function Ba(e){let n={messages:e.messages.map(o=>({id:o.serverMessageId??o.id,parts:jp(o),role:o.role,createdAt:o.createdAt!==void 0?new Date(o.createdAt).toISOString():void 0})),conversationId:e.conversationId,responseType:"ack"};return e.visitorId&&(n.visitorId=e.visitorId),e.userPrefs&&(n.userPrefs=e.userPrefs),n}function Gp(e){return e.state==="output-available"||e.state==="output-error"||e.state==="output-denied"||e.approval?.approved!==void 0}function jp(e){let t=[];for(let n of e.parts)if(n.kind==="step-start"&&t.push({type:"step-start"}),n.kind==="reasoning"&&n.text&&t.push({type:"reasoning",text:n.text,state:n.done?"done":"streaming"}),n.kind==="text"&&n.text&&t.push({text:n.text,type:"text"}),n.kind==="file"&&n.url&&t.push({mediaType:n.mediaType,type:"file",url:n.url}),n.kind==="tool"&&Gp(n)){let o=n.dynamic?{type:"dynamic-tool",toolName:n.toolName,toolCallId:n.toolCallId,state:n.state}:{type:Kp(n.toolName),toolCallId:n.toolCallId,state:n.state};n.input!==void 0&&(o.input=n.input),n.output!==void 0&&(o.output=n.output),n.error!==void 0&&(o.errorText=n.error),n.approval&&n.approval.approved!==void 0&&(o.approval=n.approval),t.push(o)}for(let n of e.attachments??[])n.url&&t.push({type:"file",url:n.url,mediaType:n.mediaType,filename:n.name,fileId:n.id,fileSize:n.size});return t}var Ce=ee.scope("transport"),Xp=6e4,Yp=1e4,Ua=50,Nl=new WeakMap;function In(e){return Nl.get(e)}function ro(e,t){return Nl.set(e,t),e}function Al(e){return Math.max(e?.upsertRevision??0,e?.read?.revision??0)}function Jp(e,t){return e.conversationId===t.conversationId&&e.title===t.title&&e.lastMessageAt===t.lastMessageAt&&e.preview===t.preview&&e.canContinue===t.canContinue&&e.hasUnread===t.hasUnread&&e.controlState===t.controlState}function Lt(e,t,n=!0){switch(t.type){case"snapshot":{let o=new Map(e.map(s=>[s.conversationId,s])),r=e.filter(s=>(In(s)?.activityRevision??0)>t.requestedRevision).toSorted((s,l)=>In(l).activityRevision-In(s).activityRevision),a=new Set(r.map(s=>s.conversationId));return[...r,...t.result.conversations.filter(s=>!a.has(s.conversationId)).map(s=>{let l=o.get(s.conversationId);if(!l)return s;let c=In(l);return(c?.upsertRevision??0)>t.requestedRevision?l:c?.read&&!l.hasUnread&&c.read.lastMessageAt===s.lastMessageAt?ro({...s,hasUnread:!1},{upsertRevision:0,read:c.read}):s})]}case"read":{let o=e.findIndex(c=>c.conversationId===t.conversationId&&(t.lastMessageAt===void 0||c.lastMessageAt===t.lastMessageAt));if(o<0)return e;let r=e[o],a=In(r);if(Al(a)>t.revision)return e;let s=t.lastMessageAt??r.lastMessageAt,l={upsertRevision:a?.upsertRevision??0,...a?.activityRevision===void 0?{}:{activityRevision:a.activityRevision},read:{revision:t.revision,...s?{lastMessageAt:s}:{}}};return r.hasUnread?e.map((c,d)=>d===o?ro({...c,hasUnread:!1},l):c):(ro(r,l),e)}case"upsert":{let o=e.findIndex(d=>d.conversationId===t.conversation.conversationId);if(o<0&&!n)return e;let r=o<0?void 0:e[o],a=r?In(r):void 0;if(Al(a)>t.revision)return e;let s=t.activity?t.revision:a?.activityRevision,l={upsertRevision:t.revision,...s===void 0?{}:{activityRevision:s},...!t.conversation.hasUnread&&a?.read?{read:a.read}:{}},c=r?{...r,...t.conversation,title:r.title}:{...t.conversation};return r&&Jp(r,c)?(ro(r,l),e):(ro(c,l),t.activity?[c,...e.filter(d=>d.conversationId!==c.conversationId)]:r?e.map((d,p)=>p===o?c:d):[...e,c])}default:return t}}var Ml=3,Qp=400,Zp=3e4,ef=1e4,tf=6e4,nf=15e3,of=1024*1024,Ll=new Set([408,425,429,500,502,503,504]);function Ol(e){return Qp*2**e+Math.floor(Math.random()*250)}function rf(e){return tf+Math.ceil(e/of)*nf}function af(e){let t=e.get("retry-after");if(!t)return null;let n=Number(t),o=Number.isFinite(n)?n*1e3:Date.parse(t)-Date.now();return Number.isFinite(o)&&o>=0?Math.min(o,3e4):null}var ar=class{constructor(t){se(this,"ttlMs",t);se(this,"map",new Map)}getOrFetch(t,n){let o=this.map.get(t);if(o&&Date.now()-o.at<this.ttlMs)return o.result;let r={at:Date.now(),result:n().then(a=>(r.value=a,a)).catch(a=>{throw this.map.get(t)===r&&this.map.delete(t),a})};return this.map.set(t,r),r.result}peek(t){let n=this.map.get(t);if(n?.value!==void 0&&Date.now()-n.at<this.ttlMs)return n.value}update(t){for(let n of this.map.values()){if(n.value!==void 0){let o=t(n.value);n.value=o,n.result=Promise.resolve(o);continue}n.result=n.result.then(o=>{let r=t(o);return n.value=r,r})}}delete(t){this.map.delete(t)}},ir=class{constructor(t){se(this,"opts",t);se(this,"conversationListeners",new Set);se(this,"conversationRevision",0);se(this,"visitorId");se(this,"conversationId");se(this,"userContext");se(this,"pageContext");se(this,"locale");se(this,"conversationsCache",new ar(Yp));se(this,"contentCache",new ar(Xp))}setContext(t,n){this.userContext=t,this.pageContext=n}setLocale(t){this.locale=t}primeIdentity(t,n){t&&(this.visitorId=t),n&&(this.conversationId=n)}envelope(){let t={_ev:xn};this.visitorId&&(t.visitorId=this.visitorId),this.conversationId&&(t.conversationId=this.conversationId),this.locale&&(t.locale=this.locale);let n=Tl(this.userContext,this.pageContext);return n&&(t[El]=n),t}withEnvelope(t){return{...this.envelope(),...t}}appendEnvelope(t){for(let[n,o]of Object.entries(this.envelope()))t.append(n,o);return t}withEnvelopeQuery(t){let n=new URL(this.url(t));for(let[o,r]of Object.entries(this.envelope()))n.searchParams.has(o)||n.searchParams.set(o,r);return n.toString()}async handshake(t){Ce.debug("handshake \u2192",{visitorId:t.visitorId,conversationId:t.conversationId,locale:t.locale});let n=await this.postJson(nt.handshake,t,"handshake");return Ce.debug("handshake \u2190",{visitorId:n.visitorId,conversationId:n.conversationId,hasWelcome:!!n.welcome,hasConfig:!!n.config,rebind:n.rebind}),cf(n)||Ce.warn("handshake response did not match expected shape; using raw response",{response:n}),this.visitorId=n.visitorId??t.visitorId,this.conversationId=n.conversationId,n}async uploadFile(t,n){Ce.debug("uploadFile \u2192",{name:t.name,size:t.size,type:t.type});let o=new FormData;o.append("file",t,t.name);let r=await this.postForm(this.uploadPath,o,"upload",n,rf(t.size));return Ce.debug("uploadFile \u2190",{id:r.id,url:r.url}),r}async transcribe(t,n="audio/webm"){Ce.debug("transcribe \u2192",{size:t.size,mimeType:n});let o=new FormData;o.append("audio",t,`voice.${sf(n)}`),o.append("mimeType",n);let r=await this.postForm(this.transcribePath,o,"transcribe");return Ce.debug("transcribe \u2190",{textLen:r.text.length}),r}subscribeConversationChanges(t){return this.conversationListeners.add(t),()=>this.conversationListeners.delete(t)}publishConversation(t,n=!1){let o={type:"upsert",conversation:t,revision:++this.conversationRevision,...n?{activity:!0}:{}};this.conversationsCache.update(r=>{let a=r.pagination.page===1,s=r.conversations.some(_=>_.conversationId===t.conversationId),l=Lt(r.conversations,o,a&&n),c=a&&l.length>r.pagination.limit?l.slice(0,r.pagination.limit):l;if(!a||!n||s||r.pagination.hasNext)return c===r.conversations?r:{...r,conversations:c};let d=Math.max(r.pagination.total,r.conversations.length)+1,p=Math.ceil(d/r.pagination.limit);return{...r,conversations:c,pagination:{...r.pagination,total:d,totalPages:p,hasNext:r.pagination.page<p}}});for(let r of this.conversationListeners)r(o)}localeCacheKey(t){return`${this.locale??""}|${JSON.stringify(t,Object.keys(t).toSorted())}`}peekConversations(t={}){return this.conversationsCache.peek(this.localeCacheKey(t))}listConversations(t={},n=!1){if((t.page??1)>1)return this.fetchConversations(t);let o=this.localeCacheKey(t),r=this.conversationRevision;n&&this.conversationsCache.delete(o);let a=this.conversationsCache.getOrFetch(o,()=>this.fetchConversations(t));return n?a.then(s=>{let l={type:"snapshot",result:s,requestedRevision:r};for(let c of this.conversationListeners)c(l);return s}):a}async fetchConversations(t){let n=new URL(this.url(nt.listConversations));return t.visitorId&&n.searchParams.set("visitorId",t.visitorId),t.page&&n.searchParams.set("page",String(t.page)),t.limit&&n.searchParams.set("limit",String(t.limit)),t.ids?.length&&n.searchParams.set("ids",t.ids.join(",")),this.getJson(n.toString(),"listConversations")}async loadConversation(t,{ids:n=[],beforeId:o}={}){let r=new URL(this.url(nt.listMessages));r.searchParams.set("conversationId",t),r.searchParams.set("limit",String(Ua)),r.searchParams.set("sortBy","_id"),r.searchParams.set("sortOrder","desc"),n.length>0&&r.searchParams.set("ids",n.join(",")),o&&r.searchParams.set("beforeId",o);let a=await this.getJson(r.toString(),"loadConversation"),s=(a.messages??[]).toReversed();return{...a,messages:s,canContinue:a.canContinue??!0}}async markRead(t,n){if(!this.visitorId||!t)return;let o={type:"read",conversationId:t,...n===void 0?{}:{lastMessageAt:n},revision:++this.conversationRevision};this.conversationsCache.update(r=>{let a=Lt(r.conversations,o);return a===r.conversations?r:{...r,conversations:a}});for(let r of this.conversationListeners)r(o);try{await this.postJson(nt.markRead,{conversationId:t},"markRead",!0)}catch(r){Ce.debug("markRead failed (non-fatal)",{err:r})}}async requestOperator(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(nt.requestOperator,{},"requestOperator")).controlState}catch(t){Ce.debug("requestOperator failed (non-fatal)",{err:t});return}}async cancelOperatorRequest(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(nt.cancelOperatorRequest,{},"cancelOperatorRequest")).controlState}catch(t){Ce.debug("cancelOperatorRequest failed (non-fatal)",{err:t});return}}listContent(t={}){return this.contentCache.getOrFetch(this.localeCacheKey(t),()=>this.fetchContent(t))}async fetchContent(t){let n=new URL(this.dataUrl(nt.content));for(let[a,s]of Object.entries(t))s!==void 0&&n.searchParams.set(a,Array.isArray(s)?s.join(","):String(s));let o=await this.getJson(n.toString(),"listContent"),r=(o.items??[]).map(a=>ns(a,this.locale));return{...o,items:r}}async bootstrap(t){let n=new URL(this.dataUrl(nt.bootstrap));t&&n.searchParams.set("conversationId",t);let o=await this.getJson(n.toString(),"bootstrap"),r=o.forms??[],a=o.formSubmissions??[];return{forms:r,formSubmissions:a}}async saveUserPrefs(t){return this.postJson(nt.updateSettings,{userPrefs:t},"saveUserPrefs")}get uploadPath(){return this.opts.endpoints?.upload??"/pai/upload-file"}get transcribePath(){return this.opts.endpoints?.transcribe??"/pai/transcribe-audio"}get submitFormPath(){return this.opts.endpoints?.submitForm??nt.submitForm}async submitForm(t){Ce.debug("submitForm \u2192",{formId:t.formId,trigger:t.trigger,fields:Object.keys(t.values).length});try{await this.postJson(this.dataUrl(this.submitFormPath),t,"submitForm")}catch(n){Ce.debug("submitForm failed (non-fatal)",{err:n})}}async submitFeedback(t){Ce.debug("submitFeedback \u2192",{messageId:t.messageId,value:t.value});try{await this.postJson(nt.messageFeedback,{messageId:t.messageId,set:{feedback:t.value}},"submitFeedback")}catch(n){Ce.debug("submitFeedback failed (non-fatal)",{err:n})}}async sendTurn(t){Ce.debug("message \u2192",{conversationId:t.conversationId,visitorId:t.visitorId,messageCount:t.messages.length});try{return await this.runWithAbort(async n=>{let o=await this.fetchImpl(this.url(nt.streamMessage),{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope(t)),signal:n});if(o.status!==202)throw new He(`sendTurn failed: expected 202, received ${o.status}`,"server",o.status);let r;try{r=await o.json()}catch(a){throw n?.aborted?a:new He("sendTurn failed: invalid acknowledgement","server",o.status,a)}if(!lf(r))throw new He("sendTurn failed: invalid acknowledgement","server",o.status);return r},void 0,Zp)}catch(n){throw n instanceof He?n:new He("sendTurn failed: network error","network",void 0,n)}}cancelTurn(t,n){!this.visitorId||!t||!n||(Ce.debug("cancel stream",{conversationId:t,runId:n,visitorId:this.visitorId}),this.fetchImpl(this.url(nt.cancelStream),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope({conversationId:t,runId:n})),keepalive:!0}).catch(o=>Ce.debug("cancel POST failed (non-fatal)",{err:o})))}async connectResumeStream(t){let n=new AbortController,o=()=>n.abort(t.signal.reason);t.signal.aborted?o():t.signal.addEventListener("abort",o,{once:!0});let r=setTimeout(()=>n.abort(),ef),a=()=>{clearTimeout(r),t.signal.removeEventListener("abort",o)},s;try{s=await this.fetchImpl(this.resumeUrl(),{method:"GET",credentials:"omit",headers:{accept:"text/event-stream",...this.opts.auth.headers()},signal:n.signal})}catch(c){return a(),t.signal.aborted||Ce.debug("resume-stream fetch failed \u2014 reconnecting",{err:c}),"held"}if(!s.ok)return a(),s.status===409||Ll.has(s.status)?(Ce.debug("resume-stream \u2192 transient response; reconnecting",{status:s.status}),"held"):(Ce.debug("resume-stream \u2192 endpoint unavailable",{status:s.status}),"unavailable");if(!s.body)return a(),Ce.debug("resume-stream \u2192 bodyless response; stopping",{status:s.status}),"unavailable";if(!(s.headers.get("content-type")??"").includes("text/event-stream"))return a(),Ce.debug("resume-stream \u2192 non-SSE response; stopping"),"unavailable";let l=!1;try{for await(let{chunk:c}of Cl(s,n.signal,d=>{l||d!=="connected"||(l=!0,clearTimeout(r),t.onConnected())})){if(t.signal.aborted)return"held";t.onChunk(c)}}catch(c){if(t.signal.aborted)return"held";Ce.debug("resume-stream segment dropped \u2014 reconnecting",{err:c})}finally{a()}return"held"}resumeUrl(){return this.withEnvelopeQuery(nt.streamResume)}async postJson(t,n,o,r=!1){let a=await this.fetchWithRetry(()=>[this.url(t),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope(n)),...r?{keepalive:!0}:{}}],o);return this.assertOk(a,o)}async postForm(t,n,o,r,a){return this.runWithAbort(async s=>{let l=await this.fetchImpl(this.url(t),{method:"POST",credentials:"omit",headers:this.opts.auth.headers(),body:this.appendEnvelope(n),signal:s});return this.assertOk(l,o)},r,a)}async runWithAbort(t,n,o){if(!n&&o===void 0)return t();let r=new AbortController,a=()=>r.abort(n?.reason);n?.aborted?a():n?.addEventListener("abort",a,{once:!0});let s=o===void 0?void 0:setTimeout(()=>r.abort(),o);try{return await t(r.signal)}finally{s!==void 0&&clearTimeout(s),n?.removeEventListener("abort",a)}}async getJson(t,n){let o=await this.fetchWithRetry(()=>[this.withEnvelopeQuery(t),{method:"GET",credentials:"omit",headers:{accept:"application/json",...this.opts.auth.headers()}}],n);return this.assertOk(o,n)}async fetchWithRetry(t,n){for(let o=0;;o++){let[r,a]=t(),s;try{s=await this.fetchImpl(r,a)}catch(c){if(o>=Ml)throw new He(`${n} failed: network error`,"network",void 0,c);Ce.debug("request network error \u2014 retrying",{label:n,attempt:o}),await oo(Ol(o));continue}if(s.ok||!Ll.has(s.status)||o>=Ml)return s;let l=af(s.headers)??Ol(o);Ce.debug("request retryable status \u2014 retrying",{label:n,status:s.status,attempt:o,wait:l}),await oo(l)}}async assertOk(t,n){if(!t.ok)throw new He(`${n} failed: ${t.status}`,"server",t.status);return await t.json()}url(t){return/^https?:\/\//i.test(t)?t:`${this.opts.agentApiBaseUrl}${t}`}dataUrl(t){return/^https?:\/\//i.test(t)?t:`${this.opts.dataApiBaseUrl}${t}`}get fetchImpl(){return this.opts.fetchImpl??globalThis.fetch.bind(globalThis)}};function sf(e){return e.includes("webm")?"webm":e.includes("ogg")?"ogg":e.includes("mp4")||e.includes("m4a")?"m4a":e.includes("mpeg")?"mp3":e.includes("wav")?"wav":"bin"}function lf(e){if(typeof e!="object"||e===null)return!1;let t=Reflect.get(e,"status"),n=Reflect.get(e,"conversationId"),o=Reflect.get(e,"runId");return t==="accepted"&&typeof n=="string"&&n.length>0&&(o===void 0||typeof o=="string"&&o.length>0)}function cf(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.visitorId=="string"&&typeof t.conversationId=="string"}function qa(e,t){let n=e?[{kind:"text",id:"t0",textSig:oe(e),doneSig:oe(!0)}]:[];return{id:dt(),role:"user",createdAt:Date.now(),status:"complete",attachments:t,partsSig:oe(n)}}function Ot(){return{id:dt(),role:"assistant",createdAt:Date.now(),status:"streaming",partsSig:oe([])}}function $l(e){let t=dt();return df({id:t,role:e.role,createdAt:Date.now(),status:"complete",ephemeral:!0,parts:[{kind:"text",id:`${t}-t0`,text:e.text,done:!0}]})}function df(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,canceled:e.canceled,errorText:e.errorText,finishReason:e.finishReason,serverMessageId:e.serverMessageId,ephemeral:e.ephemeral,attachments:e.attachments,feedback:e.feedback,partsSig:oe(e.parts.map(vf))}}var Fl=new Set(["completed","failed","canceled"]);function uf(e){return e.status==="failed"?"error":e.role==="assistant"&&e.status!=null&&!Fl.has(e.status)?"streaming":"complete"}function Va(e){let t=new Set,n=e.parts.map((r,a)=>r.type==="text"?{kind:"text",id:`${e.id}-t${a}`,textSig:oe(r.text),doneSig:oe(!0)}:r.type==="reasoning"?{kind:"reasoning",id:`${e.id}-r${a}`,textSig:oe(r.text),doneSig:oe(r.state!=="streaming")}:r.type==="step-start"?{kind:"step-start",id:`${e.id}-ss${a}`}:r.type==="file"?{kind:"file",url:r.url,mediaType:r.mediaType}:r.type==="source-url"?{kind:"source",sourceId:r.sourceId,url:r.url,title:r.title}:r.type==="source-document"?{kind:"source",sourceId:r.sourceId,title:r.title,filename:r.filename,mediaType:r.mediaType}:r.type==="data-suggestions"?null:r.type==="dynamic-tool"||r.type.startsWith("tool-")?{kind:"tool",toolCallId:r.toolCallId,toolName:r.type==="dynamic-tool"?r.toolName:Il(r.type),dynamic:r.type==="dynamic-tool"?!0:void 0,inputPartialSig:oe(""),inputSig:oe(r.input),outputSig:oe(r.output),errorSig:oe(r.errorText),stateSig:oe(r.state),approvalSig:oe(r.approval)}:null).filter(r=>r!==null).filter(r=>r.kind!=="source"?!0:t.has(r.sourceId)?!1:(t.add(r.sourceId),!0)),o=e.parts.find(r=>r.type==="data-suggestions");return{id:e.id,role:e.role,operatorInitials:e.operatorInitials,suggestions:o?.type==="data-suggestions"?rr(o.data):void 0,serverMessageId:e.id,createdAt:or(e.createdAt)??Date.now(),status:uf(e),canceled:e.status==="canceled",feedback:e.feedback??null,partsSig:oe(n)}}function _f(e){return!e.parts.some(t=>t.type==="text"&&t.text.trim()!==""||t.type==="dynamic-tool"||t.type.startsWith("tool-")||t.type==="file"||t.type==="source-url"||t.type==="source-document")}function pf(e){return e.role==="assistant"&&e.status!=null&&!Fl.has(e.status)&&_f(e)}function qt(e){let t=e.length-1;return e.filter((n,o)=>o===t||!pf(n)).map(Va)}function Bl(e,t){let n=!t&&e.at(-1)?.role==="assistant"?-2:-1,o=e.at(n);return!o||o.ephemeral?[]:[o]}function Wa(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,canceled:e.canceled,errorText:e.errorText,finishReason:e.finishReason,serverMessageId:e.serverMessageId,ephemeral:e.ephemeral,attachments:e.attachments,parts:e.partsSig.value.map(hf)}}function De(e){let t="";for(let n of e.partsSig.value)n.kind==="text"&&(t+=n.textSig.value);return t}function sr(e,t,n,o,r,a=t.createdAt){let s=e.find(p=>p.role==="user"&&!p.ephemeral),l=(p,_)=>De(p).replace(/\s+/g," ").trim().slice(0,_),c=s?l(s,80):"",d=l(t,120);return{conversationId:n,title:c||o,lastMessageAt:new Date(a).toISOString(),preview:d||void 0,canContinue:r}}function bt(e){return De(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file"||t.kind==="source")}function ff(e){return De(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file")}function Ka(e){return e==="approval-responded"||e==="output-available"||e==="output-denied"||e==="output-error"}var En=e=>e.kind==="tool",Hl=e=>e.kind==="text"&&e.textSig.value.trim()!==""||e.kind==="file";function ao(e){let t=e.partsSig.value,n=t.findLastIndex(o=>o.kind==="tool");return t.slice(n+1).some(Hl)}function rn(e){if(e.role!=="assistant")return!1;let t=e.partsSig.value.filter(En);return t.length>0&&t.every(n=>Ka(n.stateSig.value))}function an(e){return e.role!=="assistant"?!1:e.partsSig.value.some(t=>t.kind==="tool")&&!ao(e)}function lr(e,t){return!e.partsSig.value.slice(t+1).some(n=>n.kind==="step-start"||Hl(n))}function cr(e){return e.partsSig.value.some(t=>En(t)&&!Ka(t.stateSig.value))}function Ul(e,t){if(t.length===0)return e;let n=new Set;for(let s of e)n.add(s.id),s.serverMessageId&&n.add(s.serverMessageId);let o=t.filter(s=>{let l=[s.id,s.serverMessageId].filter(c=>c!==void 0);return l.some(c=>n.has(c))?!1:(l.forEach(c=>n.add(c)),!0)});if(o.length===0)return e;let r=e.findIndex(s=>!s.ephemeral),a=r<0?e.length:r;return[...e.slice(0,a),...o,...e.slice(a)]}function nn(e,t){return t.id=e.id,e.canceled&&(t.canceled=!0),e.feedback!==void 0&&(t.feedback=e.feedback),t.suggestions??(t.suggestions=e.suggestions),t}function zl(e,t,n,o){if(!Ga(e))return;if(t.length===0){let s=Math.max(...o.values());return n.find(l=>l.role==="assistant"&&o.get(l.serverMessageId??l.id)===s&&De(l).length>=De(e).length)}let r=t.at(-1);if(r?.role!=="user")return;let a=o.get(r.serverMessageId??r.id);if(a!==void 0)return n.find(s=>s.role==="assistant"&&o.get(s.serverMessageId??s.id)===a+1&&De(s).length>=De(e).length)}function Ga(e){return e?.role==="assistant"&&e.status==="streaming"&&e.serverMessageId===void 0}function mf(e,t){let n=new Map(t.partsSig.value.filter(En).filter(a=>Ka(a.stateSig.value)).map(a=>[a.toolCallId,a]));if(n.size===0)return;let o=!1,r=e.partsSig.value.map(a=>{if(!En(a))return a;let s=n.get(a.toolCallId);if(!s)return a;let l=a.approvalSig.value,c=s.approvalSig.value,d=l===void 0||l.approved===void 0&&c?.approved!==void 0?s.approvalSig:a.approvalSig,p=a.inputSig.value===void 0?s.inputSig:a.inputSig,_=a.toolName==="tool"?s.toolName:a.toolName,u=a.dynamic??s.dynamic;return d===a.approvalSig&&p===a.inputSig&&_===a.toolName&&u===a.dynamic?a:(o=!0,{...a,toolName:_,dynamic:u,inputSig:p,approvalSig:d})});o&&(e.partsSig.value=r)}function ja(e,t){let n=t.filter(_=>!_.ephemeral&&(_.status==="streaming"||_.status==="pending"||_.status==="error"||_.retryAction!==void 0||(_.attachments?.length??0)>0||bt(_))),o=new Map;for(let _ of n)o.set(_.id,_),_.serverMessageId!==void 0&&o.set(_.serverMessageId,_);let r=new Set,a=[],s=e.map(_=>{let u=(_.serverMessageId!==void 0?o.get(_.serverMessageId):void 0)??o.get(_.id);return u===void 0?(a.push(_),_):(r.add(u),u.role!==_.role?_:u.role==="user"&&u.serverMessageId===void 0&&(u.status==="pending"||u.status==="error")?nn(u,_):u.status==="streaming"||De(u).length>=De(_).length?(mf(u,_),u.suggestions??(u.suggestions=_.suggestions),u.feedback===void 0&&(u.feedback=_.feedback),_.canceled&&(u.canceled=!0),u):nn(u,_))}),l=n.filter(_=>!r.has(_)),c=l.findLast(Ga),d=new Map;e.forEach((_,u)=>{d.set(_.id,u),_.serverMessageId!==void 0&&d.set(_.serverMessageId,u)});let p=zl(c,c?n.slice(0,n.indexOf(c)):[],a,d);if(c&&p){let _=s.indexOf(p);_>=0&&(s[_]=nn(c,p)),l=l.filter(u=>u!==c)}return[...s,...l]}function io(e,t){let n=new Map(t.filter(_=>_.serverMessageId!==void 0).map(_=>[_.serverMessageId,_])),o=new Map;t.forEach((_,u)=>{o.set(_.id,u),_.serverMessageId!==void 0&&o.set(_.serverMessageId,u)});let r=new Set(e.flatMap(_=>[_.serverMessageId,_.id].filter(u=>u!==void 0))),a=!1,s=e.map(_=>{let u=n.get(_.serverMessageId??_.id);if(u===void 0||u.role!==_.role)return _;if(_.role==="user"&&_.serverMessageId===void 0)return a=!0,nn(_,u);if(_.serverMessageId===void 0)return _;let f=De(u),m=De(_),g=u.status!=="streaming"&&f.length>=m.length&&za(_,u);if(f.length>m.length||f===m&&u.partsSig.value.length>_.partsSig.value.length||g)return a=!0,nn(_,u);if(_.status==="streaming"&&u.status!=="streaming"&&gf(_,u)){if(_.continuationStreaming&&cr(u))return _;if(!za(u,_))return a=!0,nn(_,u)}return _}),l=[...n.values()].filter(_=>!r.has(_.serverMessageId)),c=s.findLastIndex(Ga),d=s[c],p=zl(d,s.slice(0,c),l,o);if(d!==void 0&&p!==void 0&&De(p).length>=De(d).length&&(nn(d,p),s[c]=p,l.splice(l.indexOf(p),1),a=!0),l.length===0)return{messages:a?s:e,changed:a};for(let _ of l){let u=o.get(_.serverMessageId??_.id),f=!1,m=s.findIndex(g=>{let y=o.get(g.serverMessageId??g.id);return u===void 0?!1:y===void 0?f:y>u?!0:(f=!0,!1)});m===-1?s.push(_):s.splice(m,0,_)}return{messages:s,changed:!0}}function ql(e,t){if(e.role!==t.role)return!1;let n=De(t),o=De(e);return n.length>o.length||t.partsSig.value.length>e.partsSig.value.length||za(e,t)}function gf(e,t){let n=e.partsSig.value,o=t.partsSig.value;return n.length!==o.length?!1:n.every((r,a)=>{let s=o[a];switch(r.kind){case"text":return s?.kind==="text"&&s.textSig.value===r.textSig.value;case"reasoning":return s?.kind==="reasoning"&&s.textSig.value===r.textSig.value;case"step-start":return s?.kind==="step-start";case"tool":return s?.kind==="tool"&&s.toolCallId===r.toolCallId&&dr(s.toolName,r.toolName);case"file":return s?.kind==="file"&&s.url===r.url&&s.mediaType===r.mediaType;case"source":return s?.kind==="source"&&s.sourceId===r.sourceId&&s.url===r.url&&s.title===r.title&&s.filename===r.filename&&s.mediaType===r.mediaType;default:return r}})}function dr(e,t){let n=e.startsWith("tool:")?e.slice(5):e,o=t.startsWith("tool:")?t.slice(5):t;return n===o}var Dl={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function za(e,t){let n=new Map(e.partsSig.value.filter(En).map(o=>[o.toolCallId,o]));return t.partsSig.value.filter(En).some(o=>{let r=n.get(o.toolCallId);if(!r||Dl[o.stateSig.value]>Dl[r.stateSig.value])return!0;let a=o.approvalSig.value?.approved;return a!==void 0&&a!==r.approvalSig.value?.approved})}function on(e){return e.role==="assistant"&&e.status!=="streaming"&&!bt(e)}function ur(e,t){if(!e.includes(t)||t.retryAction===null)return;if(t.retryAction)return t.retryAction;if(t!==e.at(-1)||t.role!=="assistant"||t.serverMessageId===void 0||t.status!=="error"&&!on(t))return;let n=e.indexOf(t);for(let o=n-1;o>=0;o--){let r=e[o];if(r?.role==="user"&&!r.ephemeral)return{kind:"repeat-user",messageId:r.id}}}function Vl(e){return e.canceled===!0&&e.role==="assistant"&&e.status!=="streaming"&&!ff(e)}function Wl(e,t){return e.operatorRoutedTurn?on(e)?"drop":"complete-operator-routed":t||on(e)?"error":"complete"}function vf(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,textSig:oe(e.text),doneSig:oe(e.done)}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,dynamic:e.dynamic,inputPartialSig:oe(e.inputPartial),inputSig:oe(e.input),outputSig:oe(e.output),errorSig:oe(e.error),stateSig:oe(e.state),approvalSig:oe(e.approval)}:e}function hf(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,text:e.textSig.value,done:e.doneSig.value}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,dynamic:e.dynamic,inputPartial:e.inputPartialSig.value,input:e.inputSig.value,output:e.outputSig.value,error:e.errorSig.value,state:e.stateSig.value,approval:e.approvalSig.value}:e}var Kl=ee.scope("feedback:audio"),_r=class{constructor(){se(this,"ctx",null);se(this,"master",null);se(this,"buffers",new Map)}unlock(){if(this.ctx){this.ctx.state==="suspended"&&this.ctx.resume();return}let t=globalThis.AudioContext??globalThis.webkitAudioContext;if(t)try{this.ctx=new t,this.master=this.ctx.createGain(),this.master.gain.value=1,this.master.connect(this.ctx.destination)}catch(n){Kl.warn("AudioContext init failed",{err:n})}}setVolume(t){if(!this.master||!this.ctx)return;let n=Math.max(0,Math.min(1,t));this.master.gain.setTargetAtTime(n,this.ctx.currentTime,.01)}playTone(t){let n=this.ctx,o=this.master;if(!n||!o||n.state!=="running")return;let r=n.currentTime,a=t.noteMs/1e3;t.notes.forEach((s,l)=>{let c=n.createOscillator();c.type=t.type,c.frequency.value=s;let d=n.createGain(),p=r+l*a;d.gain.setValueAtTime(1e-4,p),d.gain.exponentialRampToValueAtTime(t.peakGain,p+.005),d.gain.exponentialRampToValueAtTime(1e-4,p+a),c.connect(d).connect(o),c.start(p),c.stop(p+a+.01)})}async playUrl(t){let n=this.ctx,o=this.master;if(!n||!o||n.state!=="running")return;let r=await this.getBuffer(t);if(!r)return;let a=n.createBufferSource();a.buffer=r,a.connect(o),a.start()}destroy(){this.ctx&&this.ctx.close().catch(()=>{}),this.ctx=null,this.master=null,this.buffers.clear()}async getBuffer(t){if(!this.ctx)return null;let n=this.buffers.get(t);if(n)return n instanceof Promise,n;let o=this.ctx,r=fetch(t).then(a=>a.ok?a.arrayBuffer():Promise.reject(new Error(`fetch ${a.status}`))).then(a=>o.decodeAudioData(a)).then(a=>(this.buffers.set(t,a),a)).catch(a=>(Kl.warn("audio fetch/decode failed",{url:t,err:a}),this.buffers.delete(t),null));return this.buffers.set(t,r),r}};var Gl={messageReceived:10,messageSent:0,error:[20,40,20],voiceStart:10,voiceStop:0},jl={messageReceived:{notes:[880,1318.51],noteMs:90,type:"sine",peakGain:.45},messageSent:{notes:[1568],noteMs:60,type:"sine",peakGain:.25},error:{notes:[523.25,392],noteMs:120,type:"triangle",peakGain:.55},voiceStart:{notes:[1318.51],noteMs:50,type:"sine",peakGain:.3},voiceStop:{notes:[880],noteMs:50,type:"sine",peakGain:.3}};var Vt=null,pr=0;function bf(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}function yf(){if(typeof document>"u")return null;let e=document.createElement("input");e.type="checkbox",e.setAttribute("switch",""),e.setAttribute("aria-hidden","true"),e.tabIndex=-1,e.id=`__${R.cssPrefix}_haptic_${Math.random().toString(36).slice(2)}`;let t=document.createElement("label");t.htmlFor=e.id,t.setAttribute("aria-hidden","true");let n="position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;opacity:0!important;pointer-events:none!important;";return e.style.cssText=n,t.style.cssText=n,document.body.append(e,t),{input:e,label:t}}function Xl(e){if(!(e===0||Array.isArray(e)&&e.every(t=>t===0))){if(bf())try{navigator.vibrate(e);return}catch{}if(Vt||(Vt=yf()),!!Vt)try{Vt.label.click()}catch{}}}function Yl(){pr++;let e=!1;return()=>{e||(e=!0,pr=Math.max(0,pr-1),pr===0&&Vt&&(Vt.input.remove(),Vt.label.remove(),Vt=null))}}var Pf=ee.scope("feedback"),xf=100,fr=class{constructor(t,n){se(this,"mutedSig",oe(!1));se(this,"audio",new _r);se(this,"releaseHaptics");se(this,"sound");se(this,"haptics");se(this,"lastPlayed",new Map);se(this,"reducedMotionMq",null);this.sound=t,this.haptics=n,this.releaseHaptics=Yl(),this.audio.setVolume(this.effectiveVolume()),typeof matchMedia<"u"&&(this.reducedMotionMq=matchMedia("(prefers-reduced-motion: reduce)"))}unlock(){this.audio.unlock(),this.audio.setVolume(this.effectiveVolume())}update(t,n){this.sound=t,this.haptics=n,this.audio.setVolume(this.effectiveVolume())}setMuted(t){this.mutedSig.value!==t&&(this.mutedSig.value=t)}toggleMuted(){this.mutedSig.value=!this.mutedSig.value}play(t){this.mutedSig.value||this.isDeduped(t)||(this.lastPlayed.set(t,performance.now()),this.sound.enabled&&this.playSound(t),this.haptics.enabled&&this.isTouchDevice()&&this.playHaptic(t))}destroy(){this.audio.destroy(),this.releaseHaptics()}isDeduped(t){let n=this.lastPlayed.get(t);return n===void 0?!1:performance.now()-n<xf}playSound(t){let n=this.sound.events?.[t];if(n===!1)return;if(typeof n=="string"){this.audio.playUrl(n).catch(r=>Pf.warn("audio play failed",{err:r,url:n}));return}let o=jl[t];o&&this.audio.playTone(o)}playHaptic(t){if(this.reducedMotionMq?.matches)return;let n=this.haptics.events?.[t];if(n===!1)return;let o=n===!0||n===void 0?Gl[t]:n;Xl(o)}effectiveVolume(){let t=this.sound.volume??.3;return this.reducedMotionMq?.matches?t*.5:t}isTouchDevice(){return typeof window>"u"?!1:matchMedia("(hover: none) and (pointer: coarse)").matches}};var Sf=0;function i(e,t,n,o,r,a){t||(t={});var s,l,c=t;if("ref"in c)for(l in c={},t)l=="ref"?s=t[l]:c[l]=t[l];var d={type:e,props:c,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Sf,__i:-1,__u:0,__source:r,__self:a};if(typeof e=="function"&&(s=e.defaultProps))for(l in s)c[l]===void 0&&(c[l]=s[l]);return ne.vnode&&ne.vnode(d),d}var Y={fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24"},so=`${R.cssPrefix}-icon-dir`,Xa=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M21 12a8 8 0 0 1-12 6.93L3 21l1.65-5.16A8 8 0 1 1 21 12Z"})}),yt=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M18 6 6 18M6 6l12 12"})}),Jl=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M12 5v14M5 12h14"})}),Ql=()=>i("svg",{...Y,class:so,"aria-hidden":"true",children:[i("path",{d:"m22 2-7 20-4-9-9-4Z"}),i("path",{d:"M22 2 11 13"})]}),Zl=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M12 19V5M5 12l7-7 7 7"})}),ec=()=>i("svg",{...Y,class:so,"aria-hidden":"true",children:i("path",{d:"M3 20V4l18 8-18 8Z"})}),An=()=>i("svg",{...Y,class:so,"aria-hidden":"true",children:i("path",{d:"m9 18 6-6-6-6"})}),tc=()=>i("svg",{...Y,"aria-hidden":"true",children:i("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),nc=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"m21 11-9 9a5.5 5.5 0 0 1-7.78-7.78l8.49-8.49a3.67 3.67 0 0 1 5.19 5.19l-8.49 8.49a1.83 1.83 0 0 1-2.6-2.6l7.78-7.78"})}),oc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),i("path",{d:"M5 10a7 7 0 0 0 14 0M12 19v3"})]}),rc=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M3 8V3h5M21 8V3h-5M3 16v5h5M21 16v5h-5"})}),ac=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M8 3v5H3M16 3v5h5M8 21v-5H3M16 21v-5h5"})}),ic=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M3 3h7v2H5v5H3zM21 3h-7v2h5v5h2zM3 21h7v-2H5v-5H3zM21 21h-7v-2h5v-5h2z"})}),sc=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M10 3v5H3M14 3v5h7M10 21v-5H3M14 21v-5h7"})}),lc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M14 3h7v7M21 3l-9 9"}),i("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]}),cc=()=>i("svg",{...Y,"aria-hidden":"true",viewBox:"0 0 10 10",children:i("path",{d:"M9 1L1 9M9 5L5 9M9 9H9",strokeWidth:"1.5"})}),dc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"5",r:"1.5",fill:"currentColor",stroke:"none"}),i("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),i("circle",{cx:"12",cy:"19",r:"1.5",fill:"currentColor",stroke:"none"})]}),uc=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M11 5 6 9H2v6h4l5 4zM15 9a5 5 0 0 1 0 6M18 7a9 9 0 0 1 0 10"})}),_c=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M11 5 6 9H2v6h4l5 4zM22 9l-6 6M16 9l6 6"})}),pc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M3 18 8 6l5 12M4.7 14h6.6"}),i("path",{d:"M14.5 18l3.2-7 3.2 7M15.6 15.8h4.2"})]}),fc=()=>i("svg",{...Y,class:so,"aria-hidden":"true",children:i("path",{d:"m5 6 6 6-6 6M13 6l6 6-6 6"})}),sn=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M20 6 9 17l-5-5"})}),mc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M3 3v6h6"}),i("path",{d:"M3.05 13A9 9 0 1 0 6 5.3L3 9"}),i("path",{d:"M12 7v5l3 2"})]}),gc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("path",{d:"M2 12h20"}),i("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]}),lo=()=>i("svg",{...Y,class:so,"aria-hidden":"true",children:i("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),vc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M12 20h9"}),i("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]}),ln=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"m6 9 6 6 6-6"})}),hc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),i("path",{d:"M14 2v6h6"})]}),kf=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"m12 3-1.5 4.5L6 9l4.5 1.5L12 15l1.5-4.5L18 9l-4.5-1.5Z"}),i("path",{d:"M19 15v4M17 17h4M5 3v2M4 4h2"})]}),Ya=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z"})}),co=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),i("path",{d:"M12 17h.01"})]}),wf=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"m15 4 3 3-9 9-3-3z"}),i("path",{d:"M18 2v2M20 4h2M3 20l3-3M3 16h2M5 14v2"})]}),Cf=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("rect",{x:"4",y:"8",width:"16",height:"12",rx:"2"}),i("path",{d:"M12 8V4"}),i("circle",{cx:"12",cy:"3",r:"1"}),i("path",{d:"M2 14h2M20 14h2M9 13h.01M15 13h.01M9.5 17h5"})]}),Ja=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M4 14v-2a8 8 0 0 1 16 0v2"}),i("rect",{x:"2",y:"14",width:"4",height:"6",rx:"1.5"}),i("rect",{x:"18",y:"14",width:"4",height:"6",rx:"1.5"}),i("path",{d:"M20 20v1a3 3 0 0 1-3 3h-5"})]}),Rf=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("circle",{cx:"12",cy:"12",r:"4"}),i("path",{d:"m4.93 4.93 4.24 4.24M14.83 14.83l4.24 4.24M14.83 9.17l4.24-4.24M4.93 19.07l4.24-4.24"})]}),Qa=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"11",cy:"11",r:"7"}),i("path",{d:"m21 21-4.3-4.3"})]}),bc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]}),yc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M3 9.5 12 3l9 6.5"}),i("path",{d:"M5 9v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9"})]}),Pc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"m3 11 15-5v12L3 13z"}),i("path",{d:"M3 11v2a2 2 0 0 0 2 2h1V9H5a2 2 0 0 0-2 2z"}),i("path",{d:"M7 15v3a2 2 0 0 0 4 0v-2"}),i("path",{d:"M21 10a3 3 0 0 1 0 4"})]}),uo=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z"}),i("path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1"})]}),xc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"4"}),i("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}),Sc=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),kc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"M12 3v18"}),i("path",{d:"M12 3a9 9 0 0 1 0 18z",fill:"currentColor",stroke:"none"})]}),Tf=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"10.5",cy:"10.5",r:"6.5"}),i("path",{d:"M8 11a2.5 2.5 0 0 0 5 0"}),i("path",{d:"m20 20-4.4-4.4"})]}),If=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M12 3.5 13.6 9 19 10.5 13.6 12 12 17.5 10.4 12 5 10.5 10.4 9z"}),i("path",{d:"M18.5 4v3M20 5.5h-3M5.5 16v2.5M6.75 17.25h-2.5"})]}),Ef=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M4 18h16"}),i("path",{d:"M5 18a7 7 0 0 1 14 0"}),i("path",{d:"M12 8V6"}),i("path",{d:"M10 6h4"})]}),Af=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M7 11V6.5a1.5 1.5 0 0 1 3 0V10"}),i("path",{d:"M10 10V5.5a1.5 1.5 0 0 1 3 0V10"}),i("path",{d:"M13 10V6.5a1.5 1.5 0 0 1 3 0V12"}),i("path",{d:"M16 9.5a1.5 1.5 0 0 1 3 0v2.5a7 7 0 0 1-7 7 7 7 0 0 1-6.4-4.2L4 12.5a1.5 1.5 0 0 1 2.6-1.5L7 11"})]}),wc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),i("path",{d:"M5 15a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2"})]}),Cc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M7 10v11H4a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1z"}),i("path",{d:"M7 10l4-7a2.5 2.5 0 0 1 2.5 2.5V8h5a2 2 0 0 1 2 2.3l-1.2 8A2 2 0 0 1 17.3 20H7"})]}),Rc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M17 14V3h3a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1z"}),i("path",{d:"M17 14l-4 7a2.5 2.5 0 0 1-2.5-2.5V16h-5a2 2 0 0 1-2-2.3l1.2-8A2 2 0 0 1 6.7 4H17"})]}),Tc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"3.5"}),i("path",{d:"M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M19.1 4.9l-2.1 2.1M7 17l-2.1 2.1"})]}),Ic=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"M12 7v5l3 2"})]}),mr=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]}),gr=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"m15 9-6 6M9 9l6 6"})]}),Ec={chat:Xa,message:Ya,bubbles:uo,spark:kf,wand:wf,bot:Cf,help:co,lifebuoy:Rf,headset:Ja,search:Tf,sparkles:If,concierge:Ef,wave:Af};var U=R.cssPrefix,T={launcher:`${U}-launcher`,callout:`${U}-callout`,calloutDismiss:`${U}-callout-dismiss`,panel:`${U}-panel`,panelHeader:`${U}-panel-header`,resizeGrip:`${U}-resize-grip`,scrollToBottom:`${U}-scroll-to-bottom`,loadPreviousMessages:`${U}-load-previous-messages`,actionHistory:`${U}-action-history`,actionClose:`${U}-action-close`,langSegment:`${U}-lang-segment`,composer:`${U}-composer`,composerInput:`${U}-composer-input`,composerSend:`${U}-composer-send`,composerStop:`${U}-composer-stop`,composerAttach:`${U}-composer-attach`,composerFileInput:`${U}-composer-file-input`,composerVoice:`${U}-composer-voice`,attachmentChip:`${U}-attachment-chip`,attachmentRemove:`${U}-attachment-remove`,suggestion:`${U}-suggestion`,messageBubble:`${U}-message`,messageRetry:`${U}-message-retry`,messageFeedback:`${U}-message-feedback`,feedbackUp:`${U}-feedback-up`,feedbackDown:`${U}-feedback-down`,messageCopy:`${U}-message-copy`,historyPane:`${U}-history-pane`,historyBack:`${U}-history-back`,historyItem:`${U}-history-item`,historyLoadMore:`${U}-history-load-more`,sidebar:`${U}-sidebar`,sidebarToggle:`${U}-sidebar-toggle`,sidebarNewConversation:`${U}-sidebar-new-conversation`,sidebarItem:`${U}-sidebar-item`,messengerHome:`${U}-messenger-home`,modulesEmpty:`${U}-modules-empty`,tab:`${U}-tab`,tabBadge:`${U}-tab-badge`,homeView:`${U}-home-view`,homeGreeting:`${U}-home-greeting`,homeBrand:`${U}-home-brand`,backHeader:`${U}-back-header`,contentView:`${U}-content-view`,contentScroll:`${U}-content-scroll`,homeSearch:`${U}-home-search`,helpSearch:`${U}-help-search`,homeRecent:`${U}-home-recent`,homeContentRow:`${U}-home-content-row`,helpArticle:`${U}-help-article`,newsItem:`${U}-news-item`,formGate:`${U}-form-gate`,formDone:`${U}-form-done`,formDoneToggle:`${U}-form-done-toggle`,formAnswers:`${U}-form-answers`,formFill:`${U}-form-fill`,formSubmit:`${U}-form-submit`,formSkip:`${U}-form-skip`,formField:`${U}-form-field`,toolAskQuestions:`${U}-tool-ask-questions`,toolInputSubmit:`${U}-tool-input-submit`,toolInputSkip:`${U}-tool-input-skip`,toolApproval:`${U}-tool-approval`,toolApprove:`${U}-tool-approve`,toolReject:`${U}-tool-reject`,toolEdit:`${U}-tool-edit`,toolDecision:`${U}-tool-decision`,typingDots:`${U}-typing-dots`,reasoning:`${U}-reasoning`,toolAskSummary:`${U}-ask-questions-summary`,toolAskOptions:`${U}-ask-questions-options-toggle`,toolCall:`${U}-tool-call`,source:`${U}-source`,operatorRequest:`${U}-operator-request`,operatorBanner:`${U}-operator-banner`,cancelOperatorRequest:`${U}-cancel-operator-request`};function Ue(e,t){return`${e}-${t}`}var vr=R.cssPrefix;function Ac({onToggle:e,launcher:t,strings:n,leaving:o,edgeTab:r}){let a=t.variant!=="circle"&&!!t.label;return i("button",{type:"button",class:`${vr}-fab`,"data-variant":t.variant,"data-size":t.size,"data-edge-tab":r?"true":void 0,"data-leaving":o?"true":void 0,"data-testid":T.launcher,onClick:e,"aria-label":n.launcherOpen,children:[Mf(t.icon),a?i("span",{class:`${vr}-fab-label`,children:Qe(n,t.label??"")}):null]})}function Mf(e){let t=Ec[e];return t?i(t,{}):i(Lf,{source:e})}function Lf({source:e}){return i("span",{ref:t=>{t&&Of(t,e)},"aria-hidden":"true"})}function Of(e,t){if(e.dataset.svgMounted!==t)try{let o=new DOMParser().parseFromString(t,"image/svg+xml").documentElement;o&&o.tagName.toLowerCase()==="svg"&&(e.replaceChildren(document.importNode(o,!0)),e.dataset.svgMounted=t)}catch{}}function Mc({callout:e,launcherPosition:t,strings:n,closeLabel:o,onDismiss:r}){let[a,s]=$(!1);return L(()=>{let l=setTimeout(()=>s(!0),e.delayMs);return()=>clearTimeout(l)},[e.delayMs]),L(()=>{if(!a||e.autoDismissMs<=0)return;let l=setTimeout(r,e.autoDismissMs);return()=>clearTimeout(l)},[a,e.autoDismissMs,r]),a?i("div",{class:`${vr}-callout`,role:"status","data-shape":e.shape,"data-position":Nf(e.position,t),"data-animated":e.animated?"true":void 0,"data-testid":T.callout,children:[i("span",{children:Qe(n,e.text)}),i("button",{type:"button",class:`${vr}-callout-close`,onClick:r,"aria-label":o,title:o,"data-testid":T.calloutDismiss,children:i(yt,{})})]}):null}function Nf(e,t){let n=t.endsWith("-right"),o=t.startsWith("bottom-");return e==="vertical"?o?"top":"bottom":n?"left":"right"}function hr({panelEl:e,resize:t,position:n,initialSize:o,onSizeChange:r,strings:a}){let s=R.cssPrefix,l=O(null);if(L(()=>{if(!e)return;let m=e.style;t.minWidth&&m.setProperty(`--${s}-resize-min-w`,t.minWidth),t.maxWidth&&m.setProperty(`--${s}-resize-max-w`,t.maxWidth),t.minHeight&&m.setProperty(`--${s}-resize-min-h`,t.minHeight),t.maxHeight&&m.setProperty(`--${s}-resize-max-h`,t.maxHeight),o&&(m.setProperty(`--${s}-widget-w`,`${o.width}px`),m.setProperty(`--${s}-widget-h`,`${o.height}px`))},[e,t.minWidth,t.maxWidth,t.minHeight,t.maxHeight,s,o]),!e)return null;let c=n.startsWith("top-"),d=n.endsWith("-right"),p=`${s}-resize-grip ${s}-resize-grip--${c?"bottom":"top"}-${d?"left":"right"}`,_=m=>{if(!e)return;let g=m.currentTarget,y=e.getBoundingClientRect();l.current={pointerId:m.pointerId,startX:m.clientX,startY:m.clientY,startW:y.width,startH:y.height,dirX:d?-1:1,dirY:c?1:-1},g.setPointerCapture(m.pointerId),e.setAttribute("data-resizing",""),m.preventDefault()},u=m=>{let g=l.current;if(!g||m.pointerId!==g.pointerId||!e)return;let y=(m.clientX-g.startX)*g.dirX,k=(m.clientY-g.startY)*g.dirY;e.style.setProperty(`--${s}-widget-w`,`${g.startW+y}px`),e.style.setProperty(`--${s}-widget-h`,`${g.startH+k}px`)},f=m=>{let g=l.current;if(!g||m.pointerId!==g.pointerId||!e)return;m.currentTarget.releasePointerCapture(m.pointerId),e.removeAttribute("data-resizing");let y=e.getBoundingClientRect();r({width:Math.round(y.width),height:Math.round(y.height)}),l.current=null};return i("div",{class:p,role:"separator","aria-orientation":"vertical","aria-label":a.resizeHandle,title:a.resizeHandle,onPointerDown:_,onPointerMove:u,onPointerUp:f,onPointerCancel:f,"data-testid":T.resizeGrip,children:i(cc,{})})}var cn=R.cssPrefix,Df=`.${cn}-header, .${cn}-back-header, .${cn}-home-hero`,$f='button, a, input, textarea, select, [role="tab"], [contenteditable]',Lc=56;function br(e,t){L(()=>{if(!t||!e)return;let n=c=>Number.parseFloat(c)||0,o=(c,d)=>Math.min(d,Math.max(-d,c)),r=null,a=c=>{let d=c.target;if(!(d instanceof Element)||!d.closest(Df)||d.closest($f))return;let p=e.getBoundingClientRect();r={id:c.pointerId,x:c.clientX,y:c.clientY,dx:n(e.style.getPropertyValue(`--${cn}-modal-dx`)),dy:n(e.style.getPropertyValue(`--${cn}-modal-dy`)),maxX:(window.innerWidth+p.width)/2-Lc,maxY:(window.innerHeight+p.height)/2-Lc},e.dataset.dragging="true",c.preventDefault()},s=c=>{if(!r||c.pointerId!==r.id)return;let d=o(r.dx+c.clientX-r.x,r.maxX),p=o(r.dy+c.clientY-r.y,r.maxY);e.style.setProperty(`--${cn}-modal-dx`,`${d}px`),e.style.setProperty(`--${cn}-modal-dy`,`${p}px`)},l=c=>{!r||c.pointerId!==r.id||(r=null,delete e.dataset.dragging)};return e.addEventListener("pointerdown",a),window.addEventListener("pointermove",s),window.addEventListener("pointerup",l),window.addEventListener("pointercancel",l),()=>{e.removeEventListener("pointerdown",a),window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",l),window.removeEventListener("pointercancel",l)}},[e,t])}function Mn(e,t,n){switch(e){case"clear":case"sound":case"history":case"language":case"theme":case"textSize":return!0;case"popOut":return t!=="standalone"&&t!=="page";case"expand":return t==="floating";case"fullscreen":return t!=="standalone";case"close":return t==="standalone"||t==="page"?!1:t==="inline"?n==="fullscreen":!0}}function yr(e,t,n){return Mn("close",e,t)?n.includes("close"):!1}function Oc(e,t){return e==="inline"&&t==="fullscreen"?"exit-fullscreen":"close"}var Ff='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function Pr(e){let t=n=>{if(n.key!=="Tab")return;let o=[...e.querySelectorAll(Ff)].filter(l=>l.offsetParent!==null||l===document.activeElement);if(o.length===0){n.preventDefault();return}let r=o[0],a=o[o.length-1];if(!r||!a)return;let s=e.getRootNode().activeElement;n.shiftKey&&s===r?(n.preventDefault(),a.focus()):!n.shiftKey&&s===a&&(n.preventDefault(),r.focus())};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}function xr(e){return e.trim().split(/\s+/).slice(0,2).map(t=>t.charAt(0).toUpperCase()).join("")}var Za=R.cssPrefix;function Nc({agent:e,strings:t}){let n=e.status??"online",o=Qe(t,e.name),r=e.title?Qe(t,e.title):null;return i("div",{class:`${Za}-agent`,children:[i("div",{class:`${Za}-agent-avatar`,"data-status":n,children:e.avatar?i("img",{src:e.avatar,alt:""}):i("span",{children:xr(o)})}),i("div",{class:`${Za}-agent-meta`,children:[i("strong",{children:o}),r?i("span",{children:r}):null]})]})}var Dc=ee.scope("attachments");function Sr(e,t,n){let o=Hf(e),r=[],a=[],s=qf(n.accept),l=t.reduce((d,p)=>d+p.size,0),c=t.length;for(let d of o){let p=Bf(d,c,l,n,s);if(p){a.push({file:d,reason:p});continue}r.push(zf(d)),l+=d.size,c+=1}return(r.length||a.length)&&Dc.debug("ingest",{accepted:r.length,rejected:a.map(d=>({name:d.file.name,reason:d.reason}))}),{accepted:r,rejected:a}}function kr(e){try{URL.revokeObjectURL(e.previewUrl)}catch(t){Dc.debug("revokeObjectURL failed",{error:t})}}function Bf(e,t,n,o,r){return t>=o.maxCount?"count":n+e.size>o.maxBytes?"bytes":Vf(e,r)?null:"mime"}function Hf(e){return e?Array.isArray(e)?e.filter(t=>t instanceof File):[...e].map(t=>t instanceof File?t:Uf(t)).filter(t=>t!==null):[]}function Uf(e){let t=e;return!t?.getAsFile||t.kind!=="file"?null:t.getAsFile()}function zf(e){return{file:e,id:dt(),mediaType:e.type||"application/octet-stream",name:e.name||"pasted-file",previewUrl:URL.createObjectURL(e),size:e.size}}function qf(e){return e.split(",").map(t=>t.trim().toLowerCase()).filter(Boolean).map(t=>{if(t.startsWith("."))return{kind:"ext",ext:t};let[n="*",o="*"]=t.split("/");return{kind:"mime",type:n,subtype:o}})}function Vf(e,t){if(t.length===0)return!0;let[n="*",o="*"]=(e.type||"").toLowerCase().split("/"),r=(e.name||"").toLowerCase();return t.some(a=>a.kind==="ext"?r.endsWith(a.ext):(a.type==="*"||a.type===n)&&(a.subtype==="*"||a.subtype===o))}var _o=R.cssPrefix;function $c({attachment:e,onRemove:t,disabled:n=!1}){let o=e.mediaType.startsWith("image/");return i("span",{class:`${_o}-attachment-chip`,title:e.name,"data-testid":Ue(T.attachmentChip,e.id),children:[o?i("img",{class:`${_o}-attachment-thumb`,src:e.previewUrl,alt:""}):i("span",{class:`${_o}-attachment-thumb`,"aria-hidden":"true",children:i(hc,{})}),i("span",{class:`${_o}-attachment-name`,children:e.name}),i("button",{type:"button",class:`${_o}-attachment-remove`,onClick:t,disabled:n,"aria-label":`Remove ${e.name}`,"data-testid":Ue(T.attachmentRemove,e.id),children:i(yt,{})})]})}var ei={isSupported:!1,start:()=>{},stop:()=>{},cancel:()=>{}};function ti(e,t,n){return e==="disabled"?ei:e==="server"?jf(n):Wf(t)}function Wf(e){let t=Kf();if(!t)return ei;let n=null,o=0;return{isSupported:!0,start(r,a){let s=n,l=++o;n=null,s?.abort();let c=new t;n=c,c.continuous=!0,c.interimResults=!0,c.lang=e;let d=!1;c.addEventListener("result",_=>{if(o!==l||n!==c)return;let u=_,f="",m=!1;for(let g=u.resultIndex;g<u.results.length;g++){let y=u.results[g];y&&(f+=y[0].transcript,y.isFinal&&(m=!0))}r(f,m)});let p=()=>{d||o!==l||n!==c||(d=!0,n=null,a())};c.addEventListener("end",p),c.addEventListener("error",p);try{c.start()}catch{p()}},stop(){n?.stop()},cancel(){o++;let r=n;n=null,r?.abort()}}}function Kf(){return window.SpeechRecognition??window.webkitSpeechRecognition}var Gf=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];function jf(e){if(typeof MediaRecorder>"u"||!navigator?.mediaDevices?.getUserMedia)return ei;let t=0,n=null,o=s=>{for(let l of s.stream?.getTracks()??[])l.stop();s.stream=null},r=()=>{t++;let s=n;n=null,s&&(o(s),s.recorder?.state!=="inactive"&&s.recorder?.stop())},a=async s=>{if(s.finishing)return;s.finishing=!0;let l=s.recorder?.mimeType??"audio/webm";o(s);let c=new Blob(s.chunks,{type:l});s.chunks=[];try{let{text:d}=await e(c,l);n===s&&t===s.generation&&d&&s.onText(d,!0)}catch{}finally{n===s&&t===s.generation&&(n=null,s.onEnd())}};return{isSupported:!0,async start(s,l){r();let c={generation:t,recorder:null,stream:null,chunks:[],onText:s,onEnd:l,finishing:!1};n=c;try{let d=await navigator.mediaDevices.getUserMedia({audio:!0});if(n!==c||t!==c.generation){for(let u of d.getTracks())u.stop();return}c.stream=d;let p=Xf(),_=new MediaRecorder(d,p?{mimeType:p}:void 0);c.recorder=_,_.addEventListener("dataavailable",u=>{n===c&&t===c.generation&&u.data.size>0&&c.chunks.push(u.data)}),_.addEventListener("stop",()=>{n===c&&t===c.generation&&a(c)}),_.start()}catch{o(c),n===c&&t===c.generation&&(n=null,l())}},stop(){let s=n;if(s){if(!s.recorder){r();return}s.recorder.state!=="inactive"&&s.recorder.stop()}},cancel(){r()}}}function Xf(){for(let e of Gf)if(MediaRecorder.isTypeSupported(e))return e}var st=R.cssPrefix,Ln=ee.scope("composer");function On(e){return e.reduce((t,n)=>t+n.size,0)}var Yf={arrowUp:Zl,paperPlane:Ql,send:ec,chevron:An};function Fc(e){return"activeElement"in e}function Jf(e){return"host"in e&&"activeElement"in e}function Bc({options:e,transport:t,feedback:n,bus:o,persistence:r,conversationId:a,isStreaming:s,active:l=!0,isPreparing:c=!1,operatorRequestEnabled:d,canRequestOperator:p=!1,controlMode:_,onRequestOperator:u,onSend:f,onStop:m,attachApiRef:g}){let y=e.strings,[k,S]=$(()=>r.loadDraft(a)),[b,x]=$([]),[P,w]=$(!1),[D,q]=$(!1),B=O(!1),M=O(null),F=O(null),H=O(null),V=O(0),te=O(a);te.current=a;let W=O(l);W.current=l;let le=O(c);le.current=c;let ae=D||c||!l,xe=N(z=>{S(G=>{let J=typeof z=="function"?z(G):z;return J===G?G:(r.saveDraft(te.current,J),J)})},[r]),ue=e.features.fileUpload,ye=e.features.voice,[pe,Ze]=$(()=>ti(ye,e.locale,(z,G)=>t.transcribe(z,G))),ot=O(pe);ot.current=pe;let ct=O({mode:ye,locale:e.locale,transport:t});L(()=>{let z=ct.current;z.mode===ye&&z.locale===e.locale&&z.transport===t||(ct.current={mode:ye,locale:e.locale,transport:t},V.current++,ot.current.cancel(),H.current=null,w(!1),Ze(ti(ye,e.locale,(G,J)=>t.transcribe(G,J))))},[e.locale,ye,t]),L(()=>()=>{V.current++,pe.cancel()},[pe]);let Ge=N(z=>{let G=H.current;if(G===null)return!1;let J=Date.now()-G;return Ln[z]("voiceStop",{durationMs:J}),o.emit("voiceStop",{durationMs:J}),H.current=null,!0},[o]),je=N(()=>{H.current!==null&&(pe.stop(),w(!1),Ge("info")&&n.play("voiceStop"))},[Ge,n,pe]),Ye=N(()=>{V.current++,pe.cancel(),w(!1),Ge("info")&&n.play("voiceStop")},[Ge,n,pe]);L(()=>{(c||!l)&&Ye()},[l,Ye,c]),L(()=>{let z=M.current;if(!z)return;let G=z.getRootNode(),J=Fc(G)?G.activeElement:null;J&&z.closest(`.${st}-panel`)?.contains(J)||z.focus({preventScroll:!0})},[]),L(()=>{let z=M.current;if(!z)return;if(k.length===0){z.style.height="";return}z.style.height="auto";let G=getComputedStyle(z),J=Number.parseFloat(G.getPropertyValue(`--${st}-textarea-base-height`)),C=Number.parseFloat(G.borderTopWidth)+Number.parseFloat(G.borderBottomWidth),v=Math.min(z.scrollHeight+C,Number.parseFloat(G.maxHeight)),E=Number.parseFloat(G.fontSize)*.7;z.style.height=`${v<J+E?J:v}px`},[k]);let Je=O(b);Je.current=b,L(()=>()=>Je.current.forEach(kr),[]),L(()=>{if(g)return g.current={attachFromDrop:z=>{if(!ue||!W.current||B.current||le.current)return;let G=Sr(z,Je.current,e.attachments);G.accepted.length!==0&&(Ln.info("attach (drop)",{count:G.accepted.length,totalBytes:On(G.accepted)}),o.emit("attach",{count:G.accepted.length,totalBytes:On(G.accepted)}),x(J=>[...J,...G.accepted]))},fill:z=>{if(!W.current||B.current||le.current)return;xe(z);let G=M.current;G&&(G.focus({preventScroll:!0}),requestAnimationFrame(()=>G.setSelectionRange(G.value.length,G.value.length)))}},()=>{g.current&&(g.current=null)}},[g,ue,c,e.attachments,xe]),L(()=>{let z=M.current;if(!z)return;let G=z.closest(`.${st}-panel`);if(!G)return;let J=C=>{if(!W.current||B.current||le.current)return;let v=C.clipboardData;if(!v)return;let E=C.target?.closest?.("input, textarea, [contenteditable]:not([contenteditable='false'])");if(E&&E!==z)return;if(ue){let j=Sr(v.items,Je.current,e.attachments);if(j.accepted.length>0){C.preventDefault(),Ln.info("attach (paste)",{count:j.accepted.length,totalBytes:On(j.accepted)}),o.emit("attach",{count:j.accepted.length,totalBytes:On(j.accepted)}),x(Z=>[...Z,...j.accepted]);return}}if(E===z)return;let Q=v.getData("text/plain");Q&&(C.preventDefault(),xe(j=>j+Q),z.focus())};return G.addEventListener("paste",J),()=>G.removeEventListener("paste",J)},[ue,e.attachments,xe]);let _t=async()=>{let z=k.trim();if(!z&&b.length===0||!l||s||B.current||c)return;Ye(),B.current=!0,q(!0);let G=k,J=b;try{await f(z,J)&&(xe(C=>C===G?"":C),x(C=>C!==J?C:(J.forEach(kr),Je.current=[],[])))}finally{B.current=!1,q(!1),requestAnimationFrame(()=>{let C=M.current;if(!C||C.disabled||!W.current)return;let v=C.getRootNode(),E=Fc(v)?v.activeElement:null,Q=E?.getAttribute("data-testid");if(!(E&&E!==C&&Q!==T.composerSend&&Q!==T.composerStop)){if(Jf(v)){let j=v.host.ownerDocument;if(!j.hasFocus())return;let Z=j.activeElement;if(Z&&Z!==v.host&&Z!==j.body)return}C.focus({preventScroll:!0})}})}},Pe=z=>{z.key!=="Enter"||z.shiftKey||z.isComposing||(z.preventDefault(),s?m():_t())},Fe=z=>{let G=z.target;if(!l||B.current||c){G.value="";return}let J=Sr(G.files,b,e.attachments);J.accepted.length>0&&(Ln.info("attach (file picker)",{count:J.accepted.length,totalBytes:On(J.accepted)}),o.emit("attach",{count:J.accepted.length,totalBytes:On(J.accepted)}),x(C=>[...C,...J.accepted])),G.value=""},Ve=z=>{!l||B.current||c||(Ln.info("removeAttachment",{id:z}),o.emit("removeAttachment",{id:z}),x(G=>{let J=G.find(C=>C.id===z);return J&&kr(J),G.filter(C=>C.id!==z)}))},et=()=>{if(P){je();return}if(!l||!pe.isSupported||B.current||c)return;let z=++V.current;H.current=Date.now(),Ln.info("voiceStart"),o.emit("voiceStart",void 0),w(!0),n.play("voiceStart"),pe.start((G,J)=>{V.current!==z||!W.current||le.current||B.current||!J||xe(C=>`${C}${G} `)},()=>{V.current!==z||!W.current||(w(!1),Ge("debug"))})},pt=Yf[e.composer.sendButton.icon];return i("div",{class:`${st}-composer`,"data-testid":T.composer,children:[b.length>0?i("div",{class:`${st}-attachments`,children:b.map(z=>i($c,{attachment:z,onRemove:()=>Ve(z.id),disabled:ae},z.id))}):null,i("div",{class:`${st}-composer-row`,children:[i("div",{class:`${st}-composer-actions`,children:[ue?i("button",{type:"button",class:`${st}-icon-btn`,onClick:()=>F.current?.click(),disabled:ae,"aria-label":y.attach,"data-testid":T.composerAttach,children:i(nc,{})}):null,pe.isSupported?i("button",{type:"button",class:`${st}-icon-btn`,onClick:et,disabled:ae,"aria-label":P?y.micStop:y.micStart,"aria-pressed":P,"data-recording":P?"true":void 0,"data-testid":T.composerVoice,children:i(oc,{})}):null]}),i("textarea",{ref:M,name:"message",class:`${st}-textarea`,rows:1,value:k,placeholder:y.composerPlaceholder,onInput:z=>xe(z.currentTarget.value),onKeyDown:Pe,disabled:ae,"aria-label":y.composerPlaceholder,"data-testid":T.composerInput}),s?i("button",{type:"button",class:`${st}-send`,onClick:m,disabled:ae,"aria-label":y.stop,"data-testid":T.composerStop,children:i(tc,{})}):i("button",{type:"button",class:`${st}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:()=>{_t()},disabled:ae||!k.trim()&&b.length===0,"aria-label":y.send,"data-testid":T.composerSend,children:i(pt,{})}),d&&_==="ai-agent"&&u?i("button",{type:"button",class:`${st}-icon-btn`,onClick:u,disabled:ae||!p,"aria-label":y.talkToOperator,title:y.talkToOperator,"data-testid":T.operatorRequest,children:i(Ja,{})}):null]}),i("input",{ref:F,name:"attachments",type:"file",multiple:!0,accept:e.attachments.accept,onChange:Fe,disabled:ae,class:`${st}-sr-only`,"data-testid":T.composerFileInput})]})}var Qf=R.cssPrefix;function Hc({visible:e,strings:t}){return e?i("div",{class:`${Qf}-dropzone`,role:"status","aria-live":"polite",children:t.dropZone}):null}function wr({containerRef:e,onDrop:t,disabled:n=!1}){let[o,r]=$(!1);return L(()=>{if(n){r(!1);return}let a=e.current;if(!a)return;let s=0,l=_=>{s+=1,_.dataTransfer?.types.includes("Files")&&(_.preventDefault(),r(!0))},c=()=>{s-=1,!(s>0)&&(s=0,r(!1))},d=_=>{_.dataTransfer?.types.includes("Files")&&_.preventDefault()},p=_=>{s=0,r(!1),_.dataTransfer&&(_.preventDefault(),t(_.dataTransfer.items))};return a.addEventListener("dragenter",l),a.addEventListener("dragleave",c),a.addEventListener("dragover",d),a.addEventListener("drop",p),()=>{a.removeEventListener("dragenter",l),a.removeEventListener("dragleave",c),a.removeEventListener("dragover",d),a.removeEventListener("drop",p)}},[e,n,t]),{visible:n?!1:o}}function Uc({itemCount:e,initialFocusIndex:t}){let[n,o]=$(!1),r=O(null),a=O(null),[s,l]=$(-1),c=N(()=>{o(!1),l(-1),r.current?.focus()},[]),d=N(()=>o(u=>!u),[]);L(()=>{if(!n)return;let u=f=>{let m=a.current,g=r.current;if(!m||!g)return;let y=f.composedPath();y.includes(m)||y.includes(g)||(o(!1),l(-1))};return document.addEventListener("click",u,!0),()=>document.removeEventListener("click",u,!0)},[n]),L(()=>{if(!n||e===0)return;let u=t?.()??0,f=u<0||u>=e?0:u;l(f)},[n,e,t]),L(()=>{if(!n||s<0)return;a.current?.querySelectorAll("[role='menuitem']")?.[s]?.focus()},[n,s]);let p=N(u=>{(u.key==="ArrowDown"||u.key==="Enter"||u.key===" ")&&(u.preventDefault(),o(!0))},[]),_=N(u=>{if(e!==0)switch(u.key){case"Escape":u.preventDefault(),c();return;case"ArrowDown":u.preventDefault(),l(f=>(f+1)%e);return;case"ArrowUp":u.preventDefault(),l(f=>(f-1+e)%e);return;case"Home":u.preventDefault(),l(0);return;case"End":u.preventDefault(),l(e-1)}},[e,c]);return{open:n,focusIndex:s,triggerRef:r,menuRef:a,toggle:d,close:c,onTriggerKey:p,onMenuKey:_}}function zc({items:e,triggerLabel:t}){let n=R.cssPrefix,o=Uc({itemCount:e.length}),r=l=>{l.disabled||(l.onSelect?.(),l.keepOpen||o.close())},a=(l,c)=>l.onSelectValue?.(c),s=(l,c)=>{let d=c.segments;if(!d?.length)return;let p=Math.max(0,d.findIndex(u=>u.value===c.value)),_=-1;if(l.key==="ArrowRight"||l.key==="Enter"||l.key===" ")_=(p+1)%d.length;else if(l.key==="ArrowLeft")_=(p-1+d.length)%d.length;else return;l.preventDefault(),l.stopPropagation(),a(c,d[_].value)};return i("div",{class:`${n}-menu-wrap`,children:[i("button",{ref:o.triggerRef,type:"button",class:`${n}-icon-btn`,"aria-label":t,"aria-haspopup":"menu","aria-expanded":o.open,title:t,onClick:o.toggle,onKeyDown:o.onTriggerKey,children:i(dc,{})}),o.open?i("div",{ref:o.menuRef,class:`${n}-menu`,role:"menu","aria-label":t,onKeyDown:o.onMenuKey,tabIndex:-1,children:e.map(l=>l.segments?i("div",{role:"menuitem",class:`${n}-menu-item ${n}-menu-item-segmented`,"aria-label":l.label,tabIndex:-1,onKeyDown:c=>s(c,l),children:[l.icon?i("span",{class:`${n}-menu-icon`,children:l.icon}):null,i("span",{class:`${n}-menu-label`,children:l.label}),i("span",{class:`${n}-segmented`,role:"group","aria-label":l.label,children:l.segments.map(c=>{let d=c.value===l.value;return i("button",{type:"button",role:"menuitemradio","aria-checked":d,class:`${n}-segment`,"data-on":d?"true":void 0,lang:c.lang,title:c.value,tabIndex:-1,"data-testid":`${T.langSegment}-${c.value}`,onClick:()=>a(l,c.value),children:c.label},c.value)})})]},l.id):i("button",{type:"button",role:"menuitem",class:`${n}-menu-item`,"aria-pressed":l.type==="switch"?l.on:void 0,disabled:l.disabled,onClick:()=>r(l),children:[l.icon?i("span",{class:`${n}-menu-icon`,children:l.icon}):null,i("span",{class:`${n}-menu-label`,children:l.label}),l.type==="switch"&&l.on?i("span",{class:`${n}-menu-check`,"aria-hidden":"true",children:i(sn,{})}):null]},l.id))}):null]})}var ni=R.cssPrefix;function Zf(e){let t=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)").matches:!0;return e==="auto"?t?"light":"dark":t?e==="light"?"dark":"auto":e==="dark"?"light":"auto"}var em={normal:"large",large:"small",small:"normal"};function tm(e){return e==="light"?i(xc,{}):e==="dark"?i(Sc,{}):i(kc,{})}function nm(e){return(e.split("-")[0]??e).toUpperCase()}function om(e,t){let n;try{n=new URL(e,window.location.href)}catch{return}if(!(n.protocol!=="http:"&&n.protocol!=="https:"))return t.conversationId&&n.searchParams.set("chat",t.conversationId),n.searchParams.set("widgetId",t.widgetId),t.publicKey&&n.searchParams.set("public_key",t.publicKey),n.searchParams.set("ai_agent_deployment_id",t.aiAgentDeploymentId),n.href}function Pt({panelProps:e,variant:t}){let{options:n,panelSize:o,feedback:r,onClose:a,onClear:s,onExpand:l,onFullscreen:c,onSoundToggle:d}=e,{onToggleHistory:p,onLocaleChange:_,onThemeChange:u,onTextSizeChange:f}=e,m=n.strings,g=n.mode,y=t==="chat",k=ut(()=>r.mutedSig.value).value,S=new Set(n.actions),b=W=>S.has(W),x=typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches,P=W=>x?!1:Mn(W,g,o),w=n.themeMode,D={auto:m.themeAuto,light:m.themeLight,dark:m.themeDark},q=n.textSize,B={small:m.textSizeSmall,normal:m.textSizeNormal,large:m.textSizeLarge},M=[];if(y&&b("clear")&&M.push({id:"clear",icon:i(vc,{}),label:m.newConversation,onSelect:s}),b("expand")&&P("expand")){let W=o==="expanded";M.push({id:"expand",icon:W?i(ac,{}):i(rc,{}),label:W?m.collapse:m.expand,type:"switch",on:W,onSelect:l})}if(b("fullscreen")&&P("fullscreen")){let W=o==="fullscreen";M.push({id:"fullscreen",icon:W?i(sc,{}):i(ic,{}),label:W?m.exitFullscreen:m.fullscreen,type:"switch",on:W,onSelect:c})}let F=n.popOutUrl,H=n.aiAgentDeploymentId;b("popOut")&&F&&H&&Mn("popOut",g,o)&&M.push({id:"popOut",icon:i(lc,{}),label:m.popOut,onSelect:()=>{let W=om(F,{conversationId:e.conversationId,widgetId:n.widgetId,publicKey:n.publicKey,aiAgentDeploymentId:H});W&&window.open(W,"_blank","noopener,noreferrer")}}),y&&b("sound")&&M.push({id:"sound",icon:k?i(_c,{}):i(uc,{}),label:k?m.soundOff:m.soundOn,type:"switch",on:!k,onSelect:d}),b("theme")&&M.push({id:"theme",icon:tm(w),label:`${m.theme}: ${D[w]}`,onSelect:()=>u(Zf(w)),keepOpen:!0}),b("textSize")&&M.push({id:"textSize",icon:i(pc,{}),label:`${m.textSize}: ${B[q]}`,onSelect:()=>f(em[q]),keepOpen:!0}),b("language")&&n.availableLocales.length>1&&M.push({id:"language",icon:i(gc,{}),label:m.language,segments:n.availableLocales.map(W=>({value:W,label:nm(W),lang:W})),value:n.locale,onSelectValue:_});let V=!!a&&yr(g,o,n.actions),te=y&&b("history");return i("div",{class:`${ni}-header-actions`,children:[te?i("button",{type:"button",class:`${ni}-icon-btn`,onClick:p,"aria-label":m.history,title:m.history,"data-testid":T.actionHistory,children:i(mc,{})}):null,M.length>0?i(zc,{items:M,triggerLabel:m.moreActions}):null,V?i("button",{type:"button",class:`${ni}-icon-btn`,onClick:a,"aria-label":m.close,title:m.close,"data-testid":T.actionClose,children:i(yt,{})}):null]})}var rm=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,am=/^https?:\/\/[^\s.]+\.[^\s]+$/i,im=/^[+]?[\d\s().-]{6,}$/;function Nn(e,t){return e.replace(/\{(\w+)\}/g,(n,o)=>String(t[o]??`{${o}}`))}function sm(e){return Array.isArray(e)?e.length:e&&e.trim()?1:0}function lm(e,t,n){let o=e.required??!0,r=e.validation;if(e.type==="multiselect"){let s=sm(t);return o&&s===0?n.formRequired:s===0?void 0:r?.minSelections!=null&&s<r.minSelections?Nn(n.formChooseAtLeast,{min:r.minSelections}):r?.maxSelections!=null&&s>r.maxSelections?Nn(n.formChooseAtMost,{max:r.maxSelections}):void 0}let a=typeof t=="string"?t.trim():"";if(!a)return o?n.formRequired:void 0;switch(e.type){case"email":if(!rm.test(a))return n.formInvalidEmail;break;case"url":if(!am.test(a))return n.formInvalidUrl;break;case"tel":if(!im.test(a))return n.formInvalidTel;break;case"number":{let s=Number(a);if(!Number.isFinite(s))return n.formInvalidNumber;if(r?.min!=null&&s<r.min)return Nn(n.formNumberTooSmall,{min:r.min});if(r?.max!=null&&s>r.max)return Nn(n.formNumberTooLarge,{max:r.max});break}default:break}if(r?.minLength!=null&&a.length<r.minLength)return Nn(n.formTooShort,{min:r.minLength});if(r?.maxLength!=null&&a.length>r.maxLength)return Nn(n.formTooLong,{max:r.maxLength});if(r?.pattern)try{if(!new RegExp(r.pattern).test(a))return n.formPatternMismatch}catch{}}function qc(e,t,n){let o={};for(let r of e){let a=lm(r,t[r.name],n);a&&(o[r.name]=a)}return o}function Vc(e){let t={};for(let[n,o]of Object.entries(e)){let r=Array.isArray(o)?o.join(", "):o;r&&r.trim()&&(t[n]=r.trim())}return t}var Re=R.cssPrefix,Cr="__other__";function po({fields:e,strings:t,submitLabel:n,onSubmit:o,skipLabel:r,onSkip:a,footerHint:s,submitOnEnter:l,disabled:c,initialValues:d,hideActions:p,fieldTypeLabels:_,rootTestId:u,submitTestId:f,skipTestId:m}){let[g,y]=$(()=>({..._m(e),...d})),[k,S]=$({}),[b,x]=$({}),P=M=>{b[M]&&x(F=>({...F,[M]:""}))},w=(M,F)=>{y(H=>({...H,[M]:F})),P(M)},D=(M,F)=>{S(H=>({...H,[M]:F})),P(M)},q=M=>{if(M.preventDefault(),c)return;let F=pm(e,g,k),H=qc(e,F,t);if(Object.keys(H).length>0){x(H);return}o(Vc(F))},B=M=>{!l||M.key!=="Enter"||M.shiftKey||M.isComposing||M.target?.tagName==="TEXTAREA"&&q(M)};return i("form",{class:`${Re}-form`,onSubmit:q,onKeyDown:B,"data-testid":u,noValidate:!0,children:[e.map(M=>i(cm,{field:M,value:g[M.name],otherText:k[M.name]??"",error:b[M.name],disabled:c,typeLabel:_?.[M.name],strings:t,onChange:F=>w(M.name,F),onOtherChange:F=>D(M.name,F)},M.name)),p?null:i("div",{class:`${Re}-form-actions`,children:[s?i("span",{class:`${Re}-form-hint`,children:s}):null,r&&a?i("button",{type:"button",class:`${Re}-form-skip`,onClick:a,disabled:c,"data-testid":m,children:r}):null,i("button",{type:"submit",class:`${Re}-form-submit`,disabled:c,"data-testid":f,children:n})]})]})}function cm({field:e,value:t,otherText:n,error:o,disabled:r,typeLabel:a,strings:s,onChange:l,onOtherChange:c}){let d=Ue(T.formField,e.name),p=dm({field:e,value:t,otherText:n,disabled:r,strings:s,onChange:l,onOtherChange:c,fieldTid:d});return i("label",{class:`${Re}-field`,"data-field":e.name,"data-invalid":o?"true":void 0,children:[i("span",{class:`${Re}-field-head`,children:[i("span",{class:`${Re}-field-label`,children:[e.label,e.required??!0?i("span",{class:`${Re}-field-req`,"aria-hidden":"true",children:" *"}):null]}),a?i("span",{class:`${Re}-field-type`,children:a}):null]}),p,e.validationHint&&!o?i("span",{class:`${Re}-field-hint`,children:e.validationHint}):null,o?i("span",{class:`${Re}-field-error`,role:"alert",children:o}):null]})}function dm(e){let{field:t,value:n,otherText:o,disabled:r,strings:a,onChange:s,onOtherChange:l,fieldTid:c}=e,d=typeof n=="string"?n:"";switch(t.type){case"textarea":return i("textarea",{class:`${Re}-field-input`,rows:3,value:d,placeholder:t.placeholder,disabled:r,onInput:p=>s(p.target.value),"data-testid":c});case"select":return i("select",{class:`${Re}-field-input`,value:d,disabled:r,onChange:p=>s(p.target.value),"data-testid":c,children:[i("option",{value:"",children:t.placeholder??"\u2014"}),(t.options??[]).map(p=>i("option",{value:p.value,children:p.label??p.value},p.value))]});case"radio":{let p=t.allowOther&&d===Cr;return i("div",{class:`${Re}-field-choices`,role:"radiogroup","data-testid":c,children:[(t.options??[]).map(_=>i("label",{class:`${Re}-choice`,children:[i("input",{type:"radio",name:`${Re}-${t.name}`,checked:d===_.value,disabled:r,onChange:()=>s(_.value)}),i("span",{children:_.label??_.value})]},_.value)),t.allowOther?i("label",{class:`${Re}-choice`,children:[i("input",{type:"radio",name:`${Re}-${t.name}`,checked:d===Cr,disabled:r,onChange:()=>s(Cr)}),i("span",{children:a.formOther})]}):null,p?i("input",{class:`${Re}-field-input`,value:o,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:r,onInput:_=>l(_.target.value)}):null]})}case"checkbox":return i("label",{class:`${Re}-choice`,children:[i("input",{type:"checkbox",checked:d==="true",disabled:r,onChange:p=>s(p.target.checked?"true":""),"data-testid":c}),i("span",{children:t.placeholder??t.label})]});case"multiselect":{let p=Array.isArray(n)?n:[],_=(u,f)=>s(f?[...p,u]:p.filter(m=>m!==u));return i("div",{class:`${Re}-field-choices`,"data-testid":c,children:[(t.options??[]).map(u=>i("label",{class:`${Re}-choice`,children:[i("input",{type:"checkbox",checked:p.includes(u.value),disabled:r,onChange:f=>_(u.value,f.target.checked)}),i("span",{children:u.label??u.value})]},u.value)),t.allowOther||(t.options??[]).length===0?i("textarea",{class:`${Re}-field-input`,rows:2,value:o,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:r,onInput:u=>l(u.target.value)}):null]})}default:return i("input",{class:`${Re}-field-input`,type:um(t.type),value:d,placeholder:t.placeholder,disabled:r,onInput:p=>s(p.target.value),"data-testid":c})}}function um(e){switch(e){case"number":case"email":case"tel":case"url":case"date":case"time":return e;default:return"text"}}function _m(e){let t={};for(let n of e)n.defaultValue!=null&&(t[n.name]=n.type==="multiselect"?n.defaultValue.split(",").map(o=>o.trim()).filter(Boolean):n.defaultValue);return t}function pm(e,t,n){let o={...t};for(let r of e){let a=n[r.name]?.trim();if(r.type==="radio"&&r.allowOther&&t[r.name]===Cr)o[r.name]=a??"";else if(r.type==="multiselect"&&a){let s=a.split(/[,\n;]+/).map(c=>c.trim()).filter(Boolean),l=Array.isArray(t[r.name])?t[r.name]:[];o[r.name]=[...l,...s]}}return o}var xt=R.cssPrefix;function oi({form:e,strings:t,onSubmit:n,onSkip:o}){return i("div",{class:`${xt}-form-gate`,"data-testid":T.formGate,children:[e.title?i("h3",{class:`${xt}-form-gate-title`,children:e.title}):null,e.description?i("p",{class:`${xt}-form-gate-desc`,children:e.description}):null,i(po,{fields:e.fields,strings:t,submitLabel:e.submitLabel??t.formSubmit,onSubmit:n,skipLabel:e.skippable?t.formSkip:void 0,onSkip:e.skippable?o:void 0,submitTestId:T.formSubmit,skipTestId:T.formSkip})]})}function Wc({marker:e,strings:t,onFill:n}){let o=e.outcome==="skipped",r=o?t.formSkipped:t.formSubmitted,a=e.title?i(de,{children:[i("span",{children:e.title}),i("span",{class:`${xt}-sr-only`,children:r})]}):i("span",{children:r}),s=e.form?.reviewable??!1,l=!o&&s&&e.values&&Object.keys(e.values).length>0?e.values:null;if(l){let c=d=>e.form?.fields.find(p=>p.name===d)?.label??d;return i("details",{class:`${xt}-form-done`,"data-outcome":e.outcome,"data-testid":T.formDone,children:[i("summary",{class:`${xt}-form-done-summary`,"data-testid":T.formDoneToggle,children:[i(sn,{}),a,i(An,{})]}),i("dl",{class:`${xt}-form-answers`,"data-testid":T.formAnswers,children:Object.entries(l).map(([d,p])=>i("div",{class:`${xt}-form-answer`,children:[i("dt",{children:c(d)}),i("dd",{children:p})]},d))})]})}return i("div",{class:`${xt}-form-done`,"data-outcome":e.outcome,"data-testid":T.formDone,role:"status",children:[o?i(fc,{}):i(sn,{}),a,o&&e.form?.reopenable&&n?i("button",{type:"button",class:`${xt}-form-done-fill`,"data-testid":T.formFill,onClick:n,children:t.formFillOut}):null]})}function gm(e,t){for(var n in t)e[n]=t[n];return e}function ai(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var o in t)if(o!=="__source"&&e[o]!==t[o])return!0;return!1}function Kc(e,t){this.props=e,this.context=t}function ed(e,t){function n(r){var a=this.props.ref;return a!=r.ref&&a&&(typeof a=="function"?a(null):a.current=null),t?!t(this.props,r)||a!=r.ref:ai(this.props,r)}function o(r){return this.shouldComponentUpdate=n,Et(e,r)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.__f=o.prototype.isReactComponent=!0,o.type=e,o}(Kc.prototype=new tt).isPureReactComponent=!0,Kc.prototype.shouldComponentUpdate=function(e,t){return ai(this.props,e)||ai(this.state,t)};var Gc=ne.__b;ne.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Gc&&Gc(e)};var dP=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var vm=ne.__e;ne.__e=function(e,t,n,o){if(e.then){for(var r,a=t;a=a.__;)if((r=a.__c)&&r.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k||[]),r.__c(e,t)}vm(e,t,n,o)};var jc=ne.unmount;function td(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(o){typeof o.__c=="function"&&o.__c()}),e.__c.__H=null),(e=gm({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(o){return td(o,t,n)})),e}function nd(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(o){return nd(o,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function ri(){this.__u=0,this.o=null,this.__b=null}function od(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Rr(){this.i=null,this.l=null}ne.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),jc&&jc(e)},(ri.prototype=new tt).__c=function(e,t){var n=t.__c,o=this;o.o==null&&(o.o=[]),o.o.push(n);var r=od(o.__v),a=!1,s=function(){a||o.__z||(a=!0,n.__R=null,r?r(c):c())};n.__R=s;var l=n.__P;n.__P=null;var c=function(){if(!--o.__u){if(o.state.__a){var d=o.state.__a;o.__v.__k[0]=nd(d,d.__c.__P,d.__c.__O)}var p;for(o.setState({__a:o.__b=null});p=o.o.pop();)p.__P=l,p.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(s,s)},ri.prototype.componentWillUnmount=function(){this.o=[]},ri.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=td(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&Et(de,null,e.fallback);return r&&(r.__u&=-33),[Et(de,null,t.__a?null:e.children),r]};var Xc=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(Rr.prototype=new tt).__a=function(e){var t=this,n=od(t.__v),o=t.l.get(e);return o[0]++,function(r){var a=function(){t.props.revealOrder?(o.push(r),Xc(t,e,o)):r()};n?n(a):a()}},Rr.prototype.render=function(e){this.i=null,this.l=new Map;var t=Yn(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Rr.prototype.componentDidUpdate=Rr.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Xc(e,n,t)})};var hm=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,bm=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,ym=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Pm=/[A-Z0-9]/g,xm=typeof document<"u",Sm=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};tt.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(tt.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Yc=ne.event;ne.event=function(e){return Yc&&(e=Yc(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var rd,km={configurable:!0,get:function(){return this.class}},Jc=ne.vnode;ne.vnode=function(e){typeof e.type=="string"&&(function(t){var n=t.props,o=t.type,r={},a=o.indexOf("-")==-1;for(var s in n){var l=n[s];if(!(s==="value"&&"defaultValue"in n&&l==null||xm&&s==="children"&&o==="noscript"||s==="class"||s==="className")){var c=s.toLowerCase();s==="defaultValue"&&"value"in n&&n.value==null?s="value":s==="download"&&l===!0?l="":c==="translate"&&l==="no"?l=!1:c[0]==="o"&&c[1]==="n"?c==="ondoubleclick"?s="ondblclick":c!=="onchange"||o!=="input"&&o!=="textarea"||Sm(n.type)?c==="onfocus"?s="onfocusin":c==="onblur"?s="onfocusout":ym.test(s)&&(s=c):c=s="oninput":a&&bm.test(s)?s=s.replace(Pm,"-$&").toLowerCase():l===null&&(l=void 0),c==="oninput"&&r[s=c]&&(s="oninputCapture"),r[s]=l}}o=="select"&&(r.multiple&&Array.isArray(r.value)&&(r.value=Yn(n.children).forEach(function(d){d.props.selected=r.value.indexOf(d.props.value)!=-1})),r.defaultValue!=null&&(r.value=Yn(n.children).forEach(function(d){d.props.selected=r.multiple?r.defaultValue.indexOf(d.props.value)!=-1:r.defaultValue==d.props.value}))),n.class&&!n.className?(r.class=n.class,Object.defineProperty(r,"className",km)):n.className&&(r.class=r.className=n.className),t.props=r})(e),e.$$typeof=hm,Jc&&Jc(e)};var Qc=ne.__r;ne.__r=function(e){Qc&&Qc(e),rd=e.__c};var Zc=ne.diffed;ne.diffed=function(e){Zc&&Zc(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value),rd=null};function Tr(e){if(!e)return!1;let t=e.startsWith("tool:")?e.slice(5):e;return t==="ask-user-questions"||t==="ask_user_questions"}var gt=R.cssPrefix;function si(e){return e.startsWith("tool:")||e.startsWith("tool-")?e.slice(5):e}function Ir(e,t){let n=e==="output-available"||e==="output-error"||e==="output-denied",o=e==="approval-responded"||t?.approved!==void 0;return{terminal:n,responded:o,decided:n||o}}function li({status:e,icon:t,label:n}){return i("span",{class:`${gt}-toolui-badge ${gt}-toolui-status`,"data-status":e,children:[i("span",{class:`${gt}-toolui-status-icon`,children:t}),n]})}function wm(e,t){return e==="output-error"?"error":e==="output-denied"||t?.approved===!1?"denied":e==="output-available"?"completed":e==="approval-responded"||t?.approved===!0?"responded":e==="approval-requested"?"awaiting":"running"}function ci(e,t,n={}){return n.submitted?"responded":Tm(wm(e,t),n.superseded,n.live??!0)}function Cm({status:e}){return e==="denied"||e==="error"||e==="superseded"?i(gr,{}):e==="completed"||e==="responded"?i(mr,{}):i(Ic,{})}function Rm(e,t){switch(e){case"awaiting":return t.statusAwaiting;case"responded":return t.statusResponded;case"completed":return t.statusCompleted;case"denied":return t.statusDenied;case"error":return t.statusError;case"superseded":return t.statusSuperseded;default:return t.statusRunning}}function Tm(e,t,n){return t&&(e==="awaiting"||e==="running")?"superseded":!n&&e==="running"?"error":e}function Im({state:e,approval:t,strings:n,superseded:o,live:r=!0,submitted:a=!1}){let s=ci(e,t,{superseded:o,live:r,submitted:a});return i(li,{status:s,icon:i(Cm,{status:s}),label:Rm(s,n)})}function Em({name:e,state:t,approval:n,strings:o,superseded:r,live:a,submitted:s}){return i(de,{children:[i("span",{class:`${gt}-toolui-name-pill`,children:[i(Tc,{}),i("span",{class:`${gt}-toolui-name-text`,children:e})]}),i(Im,{state:t,approval:n,strings:o,superseded:r,live:a,submitted:s}),i("span",{class:`${gt}-toolui-chevron`,children:i(ln,{})})]})}function Er({part:e,strings:t,testid:n,superseded:o,live:r,submitted:a}){let s=ie(()=>fe(()=>e.inputSig.value),[e]),l=ie(()=>fe(()=>e.outputSig.value),[e]),c=ie(()=>fe(()=>e.errorSig.value),[e]),d=ie(()=>fe(()=>e.stateSig.value),[e]),p=ie(()=>fe(()=>e.approvalSig.value),[e]);return i("details",{class:`${gt}-toolui ${gt}-toolui-collapsible`,"data-testid":n,children:[i("summary",{class:`${gt}-toolui-head`,children:i(Em,{name:si(e.toolName),state:d.value,approval:p.value,strings:t,superseded:o,live:r,submitted:a})}),i(ii,{label:t.toolParameters,value:s.value}),l.value!==void 0?i(ii,{label:t.toolResult,value:l.value}):null,c.value?i(ii,{label:t.statusError,value:c.value,error:!0}):null]})}function ii({label:e,value:t,error:n}){let o=n?String(t??""):Ar(di(t));return o?i("div",{class:`${gt}-toolui-section`,children:[i("span",{class:`${gt}-toolui-label`,children:e}),i("pre",{class:`${gt}-toolui-code`,"data-error":n?"true":void 0,children:o})]}):null}function di(e){if(e&&typeof e=="object"){let t=e;if(t.storage==="tool-result-ref"&&"summary"in t)return t.summary}return e}function Ar(e){if(e==null)return"";try{let t=typeof e=="string"?e:JSON.stringify(e,null,2);return!t||t==="{}"||t==="[]"||t==='""'?"":t.length>800?`${t.slice(0,800)}\u2026`:t}catch{return""}}function ad(e){return e.partsSig.value.some(t=>t.kind==="text"&&t.textSig.value.length>0)}function id(e){return e.partsSig.value.some(t=>t.kind==="reasoning")}function Am(e){return e.streaming&&!e.bufferedHold&&!(e.reasoningVisible&&e.working)}function sd(e){let{streaming:t,reasoningVisible:n,emptyReply:o,hidden:r}=e,a=e.responseMode==="buffered"&&t,s=t&&!e.hasAnswerText;return{streaming:t,bufferedHold:a,reasoningVisible:n,working:s,showStreamDots:Am({streaming:t,bufferedHold:a,reasoningVisible:n,working:s}),emptyReply:o,hidden:r}}function ld(e,t){let n=e.stateSig.value,o=e.approvalSig.value,{terminal:r,responded:a,decided:s}=Ir(n,o),l=t.continuationStreaming===!0&&!s,c=t.superseded&&!s&&!l;return{pill:ci(n,o,{superseded:c,live:t.live,submitted:l}),state:n,terminal:r,decided:s||l,showApproveReject:!s&&!t.superseded&&!l,showAnswered:a&&!r&&!c,showSubmitted:l,showEdit:a&&t.active&&!r,skipped:c,answeredApproved:o?.approved}}var pi=1,dd=2,ud=4,_d=8,pd=16;function Mm(e){switch(e){case pi:return"href";case dd:return"src";case ud:return"class";case _d:return"checked";case pd:return"start"}}var Lm=e=>{switch(e){case 1:return 3;case 2:return 4;case 3:return 5;case 4:return 6;case 5:return 7;default:return 8}},Om=Lm;var cd=24;function mi(e){let t=new Uint32Array(cd);return t[0]=1,{renderer:e,text:"",pending:"",tokens:t,len:0,token:1,fence_end:0,blockquote_idx:0,hr_char:"",hr_chars:0,fence_start:0,spaces:new Uint8Array(cd),indent:"",indent_len:0,table_state:0}}function fd(e){e.pending.length>0&&Ke(e,`
|
|
12
|
+
`)}function me(e){e.text.length!==0&&(console.assert(e.len>0,"Never adding text to root"),e.renderer.add_text(e.renderer.data,e.text),e.text="")}function Me(e){console.assert(e.len>0,"No nodes to end"),e.len-=1,e.token=e.tokens[e.len],e.renderer.end_token(e.renderer.data)}function ve(e,t){(e.tokens[e.len]===24||e.tokens[e.len]===23)&&t!==25&&Me(e),e.len+=1,e.tokens[e.len]=t,e.token=t,e.renderer.add_token(e.renderer.data,t)}function Nm(e,t,n){for(;n<=e.len;){if(e.tokens[n]===t)return n;n+=1}return-1}function dn(e,t){for(e.fence_start=0;e.len>t;)Me(e)}function Mr(e,t){let n=0;for(let o=0;o<=e.len&&(t-=e.spaces[o],!(t<0));o+=1)switch(e.tokens[o]){case 9:case 10:case 20:case 25:n=o;break}for(;e.len>n;)Me(e);return t}function ui(e,t){let n=-1,o=-1;for(let r=e.blockquote_idx+1;r<=e.len;r+=1)if(e.tokens[r]===25){if(e.indent_len<e.spaces[r]){o=-1;break}o=r}else e.tokens[r]===t&&(n=r);return o===-1?n===-1?(dn(e,e.blockquote_idx),ve(e,t),!0):(dn(e,n),!1):(dn(e,o),ve(e,t),!0)}function _i(e,t){ve(e,25),e.spaces[e.len]=e.indent_len+t,Nt(e),e.token=103}function Nt(e){e.indent="",e.indent_len=0,e.pending=""}function fi(e){switch(e){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return!0;default:return!1}}function Dm(e){switch(e){case 32:case 58:case 59:case 41:case 44:case 33:case 46:case 63:case 93:case 10:return!0;default:return!1}}function $m(e){return fi(e)||Dm(e)}function Ke(e,t){for(let n of t){if(e.token===101){switch(n){case" ":e.indent_len+=1;continue;case" ":e.indent_len+=4;continue}let r=Mr(e,e.indent_len);e.indent_len=0,e.token=e.tokens[e.len],r>0&&Ke(e," ".repeat(r))}let o=e.pending+n;switch(e.token){case 21:case 1:case 20:case 24:case 23:switch(console.assert(e.text.length===0,"Root should not have any text"),e.pending[0]){case void 0:e.pending=n;continue;case" ":console.assert(e.pending.length===1),e.pending=n,e.indent+=" ",e.indent_len+=1;continue;case" ":console.assert(e.pending.length===1),e.pending=n,e.indent+=" ",e.indent_len+=4;continue;case`
|
|
13
|
+
`:if(console.assert(e.pending.length===1),e.tokens[e.len]===25&&e.token===21){Me(e),Nt(e),e.pending=n;continue}dn(e,e.blockquote_idx),Nt(e),e.blockquote_idx=0,e.fence_start=0,e.pending=n;continue;case"#":switch(n){case"#":if(e.pending.length<6){e.pending=o;continue}break;case" ":Mr(e,e.indent_len),ve(e,Om(e.pending.length)),Nt(e);continue}break;case">":{let a=Nm(e,20,e.blockquote_idx+1);a===-1?(dn(e,e.blockquote_idx),e.blockquote_idx+=1,e.fence_start=0,ve(e,20)):e.blockquote_idx=a,Nt(e),e.pending=n;continue}case"-":case"*":case"_":if(e.hr_chars===0&&(console.assert(e.pending.length===1,"Pending should be one character"),e.hr_chars=1,e.hr_char=e.pending),e.hr_chars>0){switch(n){case e.hr_char:e.hr_chars+=1,e.pending=o;continue;case" ":e.pending=o;continue;case`
|
|
14
|
+
`:if(e.hr_chars<3)break;Mr(e,e.indent_len),e.renderer.add_token(e.renderer.data,22),e.renderer.end_token(e.renderer.data),Nt(e),e.hr_chars=0;continue}e.hr_chars=0}if(e.pending[0]!=="_"&&e.pending[1]===" "){ui(e,23),_i(e,2),Ke(e,o.slice(2));continue}break;case"`":if(e.pending.length<3){if(n==="`"){e.pending=o,e.fence_start=o.length;continue}e.fence_start=0;break}switch(n){case"`":e.pending.length===e.fence_start?(e.pending=o,e.fence_start=o.length):(ve(e,2),Nt(e),e.fence_start=0,Ke(e,o));continue;case`
|
|
15
|
+
`:{Mr(e,e.indent_len),ve(e,10),e.pending.length>e.fence_start&&e.renderer.set_attr(e.renderer.data,ud,e.pending.slice(e.fence_start)),Nt(e),e.token=101;continue}default:e.pending=o;continue}case"+":if(n!==" ")break;ui(e,23),_i(e,2);continue;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":if(e.pending[e.pending.length-1]==="."){if(n!==" ")break;ui(e,24)&&e.pending!=="1."&&e.renderer.set_attr(e.renderer.data,pd,e.pending.slice(0,-1)),_i(e,e.pending.length+1);continue}else{let a=n.charCodeAt(0);if(a===46||fi(a)){e.pending=o;continue}}break;case"|":dn(e,e.blockquote_idx),ve(e,27),ve(e,28),e.pending="",Ke(e,n);continue}let r=o;if(e.token===21)e.token=e.tokens[e.len],e.renderer.add_token(e.renderer.data,21),e.renderer.end_token(e.renderer.data);else if(e.indent_len>=4){let a=0;for(;a<4;a+=1)if(e.indent[a]===" "){a=a+1;break}r=e.indent.slice(a)+o,ve(e,9)}else ve(e,2);Nt(e),Ke(e,r);continue;case 27:if(e.table_state===1)switch(n){case"-":case" ":case"|":case":":e.pending=o;continue;case`
|
|
16
|
+
`:e.table_state=2,e.pending="";continue;default:Me(e),e.table_state=0;break}else switch(e.pending){case"|":ve(e,28),e.pending="",Ke(e,n);continue;case`
|
|
17
|
+
`:Me(e),e.pending="",e.table_state=0,Ke(e,n);continue}break;case 28:switch(e.pending){case"":break;case"|":ve(e,29),Me(e),e.pending="",Ke(e,n);continue;case`
|
|
18
|
+
`:Me(e),e.table_state=Math.min(e.table_state+1,2),e.pending="",Ke(e,n);continue;default:ve(e,29),Ke(e,n);continue}break;case 29:if(e.pending==="|"){me(e),Me(e),e.pending="",Ke(e,n);continue}break;case 9:switch(o){case`
|
|
19
19
|
`:case`
|
|
20
20
|
`:case`
|
|
21
21
|
`:case`
|
|
@@ -25,18 +25,18 @@ ${a}`:a;continue}r.startsWith("id:")&&(o=r.slice(3).trim())}if(n==="[DONE]")retu
|
|
|
25
25
|
`:case`
|
|
26
26
|
`:case`
|
|
27
27
|
`:case`
|
|
28
|
-
`:e.pending=o;continue;default:e.pending.length!==0?(
|
|
29
|
-
`:if(o.length===e.fence_start+e.fence_end+1){
|
|
30
|
-
`){e.pending=o,e.fence_end+=1;continue}break}e.text+=e.pending,e.pending=n,e.fence_end=1;continue;case 11:switch(n){case"`":o.length===e.fence_start+ +(e.pending[0]===" ")?(
|
|
31
|
-
`:e.text+=e.pending,e.pending="",e.token=21,e.blockquote_idx=0,
|
|
32
|
-
`?(
|
|
33
|
-
`||n==="\\"?(e.renderer.set_attr(e.renderer.data,
|
|
34
|
-
`:e.pending=n;continue;default:let r=n.charCodeAt(0);e.pending="",e.text+=
|
|
35
|
-
`:switch(e.token){case 19:case 30:case 31:break;case 3:case 4:case 5:case 6:case 7:case 8:
|
|
28
|
+
`:e.pending=o;continue;default:e.pending.length!==0?(me(e),Me(e),e.pending=n):e.text+=n;continue}case 10:switch(n){case"`":e.pending=o;continue;case`
|
|
29
|
+
`:if(o.length===e.fence_start+e.fence_end+1){me(e),Me(e),e.pending="",e.fence_start=0,e.fence_end=0,e.token=101;continue}e.token=101;break;case" ":if(e.pending[0]===`
|
|
30
|
+
`){e.pending=o,e.fence_end+=1;continue}break}e.text+=e.pending,e.pending=n,e.fence_end=1;continue;case 11:switch(n){case"`":o.length===e.fence_start+ +(e.pending[0]===" ")?(me(e),Me(e),e.pending="",e.fence_start=0):e.pending=o;continue;case`
|
|
31
|
+
`:e.text+=e.pending,e.pending="",e.token=21,e.blockquote_idx=0,me(e);continue;case" ":e.text+=e.pending,e.pending=n;continue;default:e.text+=o,e.pending="";continue}case 103:switch(e.pending.length){case 0:if(n!=="[")break;e.pending=o;continue;case 1:if(n!==" "&&n!=="x")break;e.pending=o;continue;case 2:if(n!=="]")break;e.pending=o;continue;case 3:if(n!==" ")break;e.renderer.add_token(e.renderer.data,26),e.pending[1]==="x"&&e.renderer.set_attr(e.renderer.data,_d,""),e.renderer.end_token(e.renderer.data),e.pending=" ";continue}e.token=e.tokens[e.len],e.pending="",Ke(e,o);continue;case 14:case 15:{let a="*",s=12;if(e.token===15&&(a="_",s=13),a===e.pending){if(me(e),a===n){Me(e),e.pending="";continue}ve(e,s),e.pending=n;continue}break}case 12:case 13:{let a="*",s=14;switch(e.token===13&&(a="_",s=15),e.pending){case a:a===n?e.tokens[e.len-1]===s?e.pending=o:(me(e),ve(e,s),e.pending=""):(me(e),Me(e),e.pending=n);continue;case a+a:let l=e.token;me(e),Me(e),Me(e),a!==n?(ve(e,l),e.pending=n):e.pending="";continue}break}case 16:if(o==="~~"){me(e),Me(e),e.pending="";continue}break;case 105:n===`
|
|
32
|
+
`?(me(e),ve(e,30),e.pending=""):(e.token=e.tokens[e.len],e.pending[0]==="\\"?e.text+="[":e.text+="$$",e.pending="",Ke(e,n));continue;case 30:if(o==="\\]"||o==="$$"){me(e),Me(e),e.pending="";continue}break;case 31:if(o==="\\)"||e.pending[0]==="$"){me(e),Me(e),n===")"?e.pending="":e.pending=n;continue}break;case 102:o==="http://"||o==="https://"?(me(e),ve(e,18),e.pending=o,e.text=o):"http:/"[e.pending.length]===n||"https:/"[e.pending.length]===n?e.pending=o:(e.token=e.tokens[e.len],Ke(e,n));continue;case 17:case 19:if(e.pending==="]"){me(e),n==="("?e.pending=o:(Me(e),e.pending=n);continue}if(e.pending[0]==="]"&&e.pending[1]==="("){if(n===")"){let a=e.token===17?pi:dd,s=e.pending.slice(2);e.renderer.set_attr(e.renderer.data,a,s),Me(e),e.pending=""}else e.pending+=n;continue}break;case 18:n===" "||n===`
|
|
33
|
+
`||n==="\\"?(e.renderer.set_attr(e.renderer.data,pi,e.pending),me(e),Me(e),e.pending=n):(e.text+=n,e.pending=o);continue;case 104:if(o.startsWith("<br")){if(o.length===3||n===" "||n==="/"&&(o.length===4||e.pending[e.pending.length-1]===" ")){e.pending=o;continue}if(n===">"){me(e),e.token=e.tokens[e.len],e.renderer.add_token(e.renderer.data,21),e.renderer.end_token(e.renderer.data),e.pending="";continue}}e.token=e.tokens[e.len],e.text+="<",e.pending=e.pending.slice(1),Ke(e,n);continue}switch(e.pending[0]){case"\\":if(e.token===19||e.token===30||e.token===31)break;switch(n){case"(":me(e),ve(e,31),e.pending="";continue;case"[":e.token=105,e.pending=o;continue;case`
|
|
34
|
+
`:e.pending=n;continue;default:let r=n.charCodeAt(0);e.pending="",e.text+=fi(r)||r>=65&&r<=90||r>=97&&r<=122?o:n;continue}case`
|
|
35
|
+
`:switch(e.token){case 19:case 30:case 31:break;case 3:case 4:case 5:case 6:case 7:case 8:me(e),dn(e,e.blockquote_idx),e.blockquote_idx=0,e.pending=n;continue;default:me(e),e.pending=n,e.token=21,e.blockquote_idx=0;continue}break;case"<":if(e.token!==19&&e.token!==30&&e.token!==31){me(e),e.pending=o,e.token=104;continue}break;case"`":if(e.token===19)break;n==="`"?(e.fence_start+=1,e.pending=o):(e.fence_start+=1,me(e),ve(e,11),e.text=n===" "||n===`
|
|
36
36
|
`?"":n,e.pending="");continue;case"_":case"*":{if(e.token===19||e.token===30||e.token===31||e.token===14)break;let r=12,a=14,s=e.pending[0];if(s==="_"&&(r=13,a=15),e.pending.length===1){if(s===n){e.pending=o;continue}if(n!==" "&&n!==`
|
|
37
|
-
`){
|
|
38
|
-
`){
|
|
39
|
-
`){ye(e),Se(e,16),e.pending=n;continue}}break;case"$":if(e.token!==19&&e.token!==16&&e.pending==="$")if(n==="$"){e.token=105,e.pending=o;continue}else{if(Dm(n.charCodeAt(0)))break;ye(e),Se(e,31),e.pending=n;continue}break;case"[":if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n!=="]"){ye(e),Se(e,17),e.pending=n;continue}break;case"!":if(e.token!==19&&n==="["){ye(e),Se(e,19),e.pending="";continue}break;case" ":if(e.pending.length===1&&n===" ")continue;break}if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n==="h"&&(e.pending===" "||e.pending==="")){e.text+=e.pending,e.pending=n,e.token=102;continue}e.text+=e.pending,e.pending=n}ye(e)}function hi(e){return{add_token:$m,end_token:Fm,add_text:Bm,set_attr:Hm,data:{nodes:[e,,,,,],index:0}}}function $m(e,t){let n=e.nodes[e.index],o;switch(t){case 1:return;case 20:o=document.createElement("blockquote");break;case 2:o=document.createElement("p");break;case 21:o=document.createElement("br");break;case 22:o=document.createElement("hr");break;case 3:o=document.createElement("h1");break;case 4:o=document.createElement("h2");break;case 5:o=document.createElement("h3");break;case 6:o=document.createElement("h4");break;case 7:o=document.createElement("h5");break;case 8:o=document.createElement("h6");break;case 12:case 13:o=document.createElement("em");break;case 14:case 15:o=document.createElement("strong");break;case 16:o=document.createElement("s");break;case 11:o=document.createElement("code");break;case 18:case 17:o=document.createElement("a");break;case 19:o=document.createElement("img");break;case 23:o=document.createElement("ul");break;case 24:o=document.createElement("ol");break;case 25:o=document.createElement("li");break;case 26:let r=o=document.createElement("input");r.type="checkbox",r.disabled=!0;break;case 9:case 10:n=n.appendChild(document.createElement("pre")),o=document.createElement("code");break;case 27:o=document.createElement("table");break;case 28:switch(n.children.length){case 0:n=n.appendChild(document.createElement("thead"));break;case 1:n=n.appendChild(document.createElement("tbody"));break;default:n=n.children[1]}o=document.createElement("tr");break;case 29:o=document.createElement(n.parentElement?.tagName==="THEAD"?"th":"td");break;case 30:o=document.createElement("equation-block");break;case 31:o=document.createElement("equation-inline");break}e.nodes[++e.index]=n.appendChild(o)}function Fm(e){e.index-=1}function Bm(e,t){e.nodes[e.index].appendChild(document.createTextNode(t))}function Hm(e,t,n){e.nodes[e.index].setAttribute(Am(t),n)}function $r({textSig:e,doneSig:t}){let n=M(null);return kt(()=>{let o=n.current;if(!o)return;o.classList.add(`${C.cssPrefix}-md`),o.replaceChildren();let r=hi(o),a=vi(r),s=0,l=Ft(()=>{let _=e.value,p=t.value;_.length<s&&(o.replaceChildren(),r=hi(o),a=vi(r),s=0);let u=_.slice(s);u&&Ye(a,u),s=_.length,p&&fd(a)}),c=new MutationObserver(_=>{for(let p of _)for(let u of p.addedNodes){if(!(u instanceof HTMLElement))continue;let f=u.matches?.("a")?[u]:[...u.querySelectorAll?.("a")??[]];for(let m of f)md(m)}});c.observe(o,{childList:!0,subtree:!0});for(let _ of o.querySelectorAll("a"))md(_);let d=_=>{let p=_.target?.closest?.("a");if(!p||!(p instanceof HTMLAnchorElement))return;let u=p.getAttribute("href")??"";!u||u.startsWith("#")||(_.preventDefault(),window.open(u,"_blank","noopener,noreferrer"))};return o.addEventListener("click",d),()=>{l(),c.disconnect(),o.removeEventListener("click",d)}},[e,t]),i("div",{ref:n})}function gd({text:e}){let t=se(()=>ae(e),[e]),n=se(()=>ae(!0),[]);return i($r,{textSig:t,doneSig:n})}function md(e){let t=e.getAttribute("href")??"";if(!t||t.startsWith("#"))return;e.target!=="_blank"&&(e.target="_blank");let n=new Set((e.rel||"").split(/\s+/).filter(Boolean));n.add("noopener"),n.add("noreferrer"),e.rel=[...n].join(" ")}var Fr=C.cssPrefix;function vd({messageId:e,initial:t,strings:n,onFeedback:o}){let[r,a]=B(t);O(()=>a(t),[e,t]);let s=l=>{let c=r===l?null:l;a(c),o(e,c)};return i("div",{class:`${Fr}-feedback`,role:"group","data-testid":E.messageFeedback,children:[i("button",{type:"button",class:`${Fr}-msg-action`,"data-active":r==="up"?"true":void 0,"aria-pressed":r==="up","aria-label":n.feedbackUp,title:n.feedbackUp,onClick:()=>s("up"),"data-testid":E.feedbackUp,children:i(Cc,{})}),i("button",{type:"button",class:`${Fr}-msg-action`,"data-active":r==="down"?"true":void 0,"aria-pressed":r==="down","aria-label":n.feedbackDown,title:n.feedbackDown,onClick:()=>s("down"),"data-testid":E.feedbackDown,children:i(Rc,{})}),i("span",{class:`${Fr}-sr-only`,role:"status","aria-live":"polite",children:r?n.feedbackThanks:""})]})}var Hn=C.cssPrefix;function hd({part:e,strings:t}){let n=e.title||e.filename||e.url||t.sources;return e.url?i("a",{class:`${Hn}-source`,href:e.url,target:"_blank",rel:"noreferrer noopener","data-testid":E.source,children:[i("span",{class:`${Hn}-source-icon`,"aria-hidden":"true",children:"\u{1F517}"}),i("span",{class:`${Hn}-source-label`,children:n})]}):i("span",{class:`${Hn}-source`,"data-testid":E.source,children:[i("span",{class:`${Hn}-source-icon`,"aria-hidden":"true",children:"\u{1F4C4}"}),i("span",{class:`${Hn}-source-label`,children:n})]})}var ut=C.cssPrefix;function bd({part:e,strings:t,active:n,superseded:o=!1,continuationStreaming:r=!1,onDecision:a,onEdit:s}){let l=se(()=>be(()=>e.approvalSig.value),[e]),c=se(()=>be(()=>ld(e,{active:n,superseded:o,continuationStreaming:r})),[e,n,o,r]).value,{terminal:d,showApproveReject:_,showAnswered:p,showSubmitted:u,showEdit:f,skipped:m}=c,b=ci(e.toolName),h=c.answeredApproved,x=e.toolCallId,P=i(me,{children:[i("p",{class:`${ut}-toolui-prompt`,children:t.approvalPrompt.replace("{tool}",b)}),i("p",{class:`${ut}-toolui-subtle`,children:t.approvalBody})]});u?P=i("p",{class:`${ut}-toolui-subtle`,children:t.approvalSubmitting}):p&&h!==!1?P=i(me,{children:[i("p",{class:`${ut}-toolui-prompt`,children:[t.approvalYourResponse.replace("{decision}",h?t.approve:t.reject),l.value?.reason?` \u2014 ${l.value.reason}`:""]}),f?i("p",{class:`${ut}-toolui-subtle`,children:t.approvalEditHint}):null,f?null:i("p",{class:`${ut}-toolui-subtle`,children:t.approvalSubmitting})]}):p&&(P=i(me,{}));let v=_||u||f||p&&h!==!1;return i("div",{class:`${ut}-toolui-group`,"data-testid":c.decided?E.toolDecision:E.toolApproval,children:[i(Or,{part:e,strings:t,superseded:m,submitted:u}),m||d||!v?null:i("div",{class:`${ut}-toolui ${ut}-toolui-body`,children:[P,_?i("div",{class:`${ut}-toolui-actions`,children:[i("button",{type:"button",class:`${ut}-form-skip`,disabled:!n,onClick:()=>a(x,!1),"data-testid":E.toolReject,children:t.reject}),i("button",{type:"button",class:`${ut}-form-submit`,disabled:!n,onClick:()=>a(x,!0),"data-testid":E.toolApprove,children:t.approve})]}):null,f?i("div",{class:`${ut}-toolui-actions`,children:i("button",{type:"button",class:`${ut}-form-skip`,onClick:()=>s(x),"data-testid":E.toolEdit,children:t.edit})}):null]})]})}var zm=new Set(["text","email","phone","number","date","single-select","multi-select","boolean"]);function yd(e){let t=e&&typeof e=="object"?e:{},o=(Array.isArray(t.questions)?t.questions:[]).map(qm).filter(r=>r!==null);return{intro:Br(t.intro),questions:o}}function qm(e,t){if(!e||typeof e!="object")return null;let n=e,o=zm.has(n.type)?n.type:"text";return{key:Br(n.key)??`q${t+1}`,question:Br(n.question)??"Please provide the missing information.",type:o,options:Array.isArray(n.options)?n.options.filter(r=>typeof r=="string"&&r.trim().length>0):void 0,required:typeof n.required=="boolean"?n.required:void 0,helpText:Br(n.helpText)}}function Vm(e){switch(e){case"text":return"textarea";case"phone":return"tel";case"single-select":case"boolean":return"radio";case"multi-select":return"multiselect";default:return e}}function bi(e,t,n){return e.questions.map(o=>{let r=Vm(o.type),a=o.type==="boolean"?[{value:"yes",label:t},{value:"no",label:n}]:(o.options??[]).map(s=>({value:s,label:s}));return{name:o.key,label:o.question,type:r,required:o.required??!1,options:a.length>0?a:void 0,validationHint:o.helpText}})}function Br(e){return typeof e=="string"&&e.trim()?e.trim():void 0}var Be=C.cssPrefix,Wm={text:"qtypeText",email:"qtypeEmail",phone:"qtypePhone",number:"qtypeNumber",date:"qtypeDate","single-select":"qtypeChooseOne","multi-select":"qtypeChooseAny",boolean:"qtypeBoolean"};function Pd(e,t){let n={};for(let o of e)n[o.key]=t[Wm[o.type]];return n}function xd({part:e,strings:t,active:n,superseded:o=!1,continuationStreaming:r=!1,onDecision:a,onEdit:s}){let l=se(()=>be(()=>e.stateSig.value),[e]).value,c=se(()=>be(()=>e.approvalSig.value),[e]).value,d=se(()=>be(()=>yd(e.inputSig.value)),[e]).value,{terminal:_,decided:p}=Lr(l,c),u=p&&c?.approved===!0,f=r&&!p,m=!p&&!o&&!f,b=!m&&!u&&!f,h=u&&n&&!_,x=d.questions,[P,v]=B(null),k=P??(m||u||f),[w,$]=B(!1),ie=x.length>1?Ja:mo,z=m?t.inputRequired:t.inputBadge,T=f?i("p",{class:`${Be}-toolui-subtle`,children:t.approvalSubmitting}):m?i(Gm,{req:d,strings:t,active:n,resolve:(F,ee)=>a(e.toolCallId,ee,F)}):w?i(bo,{fields:bi(d,t.confirmYes,t.confirmNo),strings:t,submitLabel:t.inputSubmit,onSubmit:()=>{},disabled:!0,hideActions:!0,fieldTypeLabels:Pd(x,t),initialValues:u?Jm(x,c?.reason):void 0}):i(Km,{questions:x,answers:u?Ym(c?.reason):{},strings:t}),D="completed",G=t.inputAnswered;return b?(D="superseded",G=t.inputSkipped):f&&(D="responded",G=t.statusResponded),i("details",{class:`${Be}-toolui ${Be}-toolui-collapsible${o?` ${Be}-toolui-stale`:""}`,open:k,onToggle:F=>{let ee=F.currentTarget.open;ee!==k&&v(ee)},"data-testid":m?E.toolAskQuestions:E.toolDecision,children:[i("summary",{class:`${Be}-toolui-head`,children:[i("span",{class:`${Be}-toolui-q-pill`,children:[i(ie,{}),z]}),i("span",{class:`${Be}-toolui-head-end`,children:[m?null:i(di,{status:D,icon:b?i(yr,{}):i(br,{}),label:G}),i("span",{class:`${Be}-toolui-chevron`,children:i(pn,{})})]})]}),i("div",{class:`${Be}-toolui-collapse-body`,children:[d.intro?i("div",{class:`${Be}-toolui-desc`,children:d.intro}):null,T,m||f?null:i("div",{class:`${Be}-toolui-footer`,children:[i("button",{type:"button",class:`${Be}-toolui-options-toggle`,onClick:()=>$(F=>!F),"data-testid":E.toolAskOptions,children:[i("span",{class:`${Be}-toolui-options-chevron${w?` ${Be}-open`:""}`,children:i(pn,{})}),w?t.hideOptions:t.showOptions]}),h?i("button",{type:"button",class:`${Be}-form-skip`,onClick:()=>s(e.toolCallId),"data-testid":E.toolEdit,children:t.edit}):null]})]})]})}function Gm({req:e,strings:t,active:n,resolve:o}){let r=bi(e,t.confirmYes,t.confirmNo),a=e.questions.length===1&&e.questions[0]?.type==="text";return i(bo,{fields:r,strings:t,disabled:!n,submitLabel:t.inputSubmit,footerHint:a?t.inputSubmitHint:void 0,onSubmit:s=>o(Xm(e.questions,s),!0),skipLabel:t.inputSkip,onSkip:()=>o(void 0,!1),submitOnEnter:a,fieldTypeLabels:Pd(e.questions,t),submitTestId:E.toolInputSubmit,skipTestId:E.toolInputSkip})}function Km({questions:e,answers:t,strings:n}){return i("div",{class:`${Be}-toolui-summary`,"data-testid":E.toolAskSummary,children:e.map(o=>i("div",{class:`${Be}-field`,children:[i("span",{class:`${Be}-field-head`,children:i("span",{class:`${Be}-field-label`,children:[o.question,o.required?i("span",{class:`${Be}-field-req`,"aria-hidden":"true",children:" *"}):null]})}),i("p",{class:`${Be}-toolui-answer`,children:jm(o,t[o.key],n)||"\u2014"})]},o.key))})}function jm(e,t,n){return e.type!=="boolean"?t??"":t==="yes"?n.confirmYes:t==="no"?n.confirmNo:t??""}function Xm(e,t){let n=e.flatMap(o=>{let r=t[o.key];if(r==null||r.trim()==="")return[];let a=o.type==="multi-select"?r.split(",").map(s=>s.trim()).filter(Boolean):r;return[{key:o.key,value:a}]});return JSON.stringify({answers:n})}function Sd(e){if(!e)return{};let n=(()=>{try{return JSON.parse(e)}catch{return}})()?.answers;if(!Array.isArray(n))return{};let o={};for(let r of n)if(r&&typeof r=="object"&&"key"in r){let{key:a,value:s}=r;if(typeof a!="string")continue;typeof s=="string"?o[a]=s:Array.isArray(s)&&(o[a]=s.filter(l=>typeof l=="string"))}return o}function Ym(e){let t=Sd(e),n={};for(let[o,r]of Object.entries(t))n[o]=Array.isArray(r)?r.join(", "):r;return n}function Jm(e,t){let n=Sd(t),o={};for(let r of e){let a=n[r.key];a!==void 0&&(r.type==="multi-select"?o[r.key]=Array.isArray(a)?a:[a]:o[r.key]=Array.isArray(a)?a[0]??"":a)}return o}function kd({part:e,strings:t,live:n}){let o=se(()=>be(()=>e.inputSig.value),[e]),r=se(()=>be(()=>e.outputSig.value),[e]),a=se(()=>be(()=>e.errorSig.value),[e]);return se(()=>be(()=>!!Nr(o.value)||!!a.value||!!Nr(_i(r.value))),[o,r,a]).value?i(Or,{part:e,strings:t,testid:E.toolCall,live:n}):null}var Ke=C.cssPrefix,wd=ed(Qm);function Qm({message:e,status:t,strings:n,responseMode:o,showReasoning:r,showToolCalls:a,showSources:s,interactive:l=!1,superseded:c=!1,tool:d,onRetry:_,enableMessageFeedback:p=!1,onFeedback:u}){let m=se(()=>be(()=>e.partsSig.value),[e]).value,b=se(()=>be(()=>cn(e)),[e]),h=se(()=>be(()=>Wl(e)),[e]),x=se(()=>be(()=>ad(e)),[e]),P=se(()=>be(()=>r&&id(e)),[e,r]),v=t==="streaming",y=e.role==="assistant"&&v,k=sd({streaming:y,responseMode:o,reasoningVisible:P.value,hasAnswerText:x.value,emptyReply:b.value,hidden:h.value}),{bufferedHold:w,working:$,showStreamDots:ie}=k;if(k.hidden)return null;let z=eg(e.createdAt),T=e.role==="assistant"||e.role==="operator",D=p&&!!u&&!!e.serverMessageId&&T&&!v&&t!=="error"&&!b.value,G=v?"":m.filter(I=>I.kind==="text").map(I=>I.textSig.peek()).join(`
|
|
37
|
+
`){me(e),ve(e,r),e.pending=n;continue}}else{if(s===n){me(e),ve(e,a),ve(e,r),e.pending="";continue}if(n!==" "&&n!==`
|
|
38
|
+
`){me(e),ve(e,a),e.pending=n;continue}}break}case"~":if(e.token!==19&&e.token!==16){if(e.pending==="~"){if(n==="~"){e.pending=o;continue}}else if(n!==" "&&n!==`
|
|
39
|
+
`){me(e),ve(e,16),e.pending=n;continue}}break;case"$":if(e.token!==19&&e.token!==16&&e.pending==="$")if(n==="$"){e.token=105,e.pending=o;continue}else{if($m(n.charCodeAt(0)))break;me(e),ve(e,31),e.pending=n;continue}break;case"[":if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n!=="]"){me(e),ve(e,17),e.pending=n;continue}break;case"!":if(e.token!==19&&n==="["){me(e),ve(e,19),e.pending="";continue}break;case" ":if(e.pending.length===1&&n===" ")continue;break}if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n==="h"&&(e.pending===" "||e.pending==="")){e.text+=e.pending,e.pending=n,e.token=102;continue}e.text+=e.pending,e.pending=n}me(e)}function gi(e){return{add_token:Fm,end_token:Bm,add_text:Hm,set_attr:Um,data:{nodes:[e,,,,,],index:0}}}function Fm(e,t){let n=e.nodes[e.index],o;switch(t){case 1:return;case 20:o=document.createElement("blockquote");break;case 2:o=document.createElement("p");break;case 21:o=document.createElement("br");break;case 22:o=document.createElement("hr");break;case 3:o=document.createElement("h1");break;case 4:o=document.createElement("h2");break;case 5:o=document.createElement("h3");break;case 6:o=document.createElement("h4");break;case 7:o=document.createElement("h5");break;case 8:o=document.createElement("h6");break;case 12:case 13:o=document.createElement("em");break;case 14:case 15:o=document.createElement("strong");break;case 16:o=document.createElement("s");break;case 11:o=document.createElement("code");break;case 18:case 17:o=document.createElement("a");break;case 19:o=document.createElement("img");break;case 23:o=document.createElement("ul");break;case 24:o=document.createElement("ol");break;case 25:o=document.createElement("li");break;case 26:let r=o=document.createElement("input");r.type="checkbox",r.disabled=!0;break;case 9:case 10:n=n.appendChild(document.createElement("pre")),o=document.createElement("code");break;case 27:o=document.createElement("table");break;case 28:switch(n.children.length){case 0:n=n.appendChild(document.createElement("thead"));break;case 1:n=n.appendChild(document.createElement("tbody"));break;default:n=n.children[1]}o=document.createElement("tr");break;case 29:o=document.createElement(n.parentElement?.tagName==="THEAD"?"th":"td");break;case 30:o=document.createElement("equation-block");break;case 31:o=document.createElement("equation-inline");break}e.nodes[++e.index]=n.appendChild(o)}function Bm(e){e.index-=1}function Hm(e,t){e.nodes[e.index].appendChild(document.createTextNode(t))}function Um(e,t,n){e.nodes[e.index].setAttribute(Mm(t),n)}function Lr({textSig:e,doneSig:t}){let n=O(null);return ht(()=>{let o=n.current;if(!o)return;o.classList.add(`${R.cssPrefix}-md`),o.replaceChildren();let r=gi(o),a=mi(r),s=0,l=Mt(()=>{let p=e.value,_=t.value;p.length<s&&(o.replaceChildren(),r=gi(o),a=mi(r),s=0);let u=p.slice(s);u&&Ke(a,u),s=p.length,_&&fd(a)}),c=new MutationObserver(p=>{for(let _ of p)for(let u of _.addedNodes){if(!(u instanceof HTMLElement))continue;let f=u.matches?.("a")?[u]:[...u.querySelectorAll?.("a")??[]];for(let m of f)md(m)}});c.observe(o,{childList:!0,subtree:!0});for(let p of o.querySelectorAll("a"))md(p);let d=p=>{let _=p.target?.closest?.("a");if(!_||!(_ instanceof HTMLAnchorElement))return;let u=_.getAttribute("href")??"";!u||u.startsWith("#")||(p.preventDefault(),window.open(u,"_blank","noopener,noreferrer"))};return o.addEventListener("click",d),()=>{l(),c.disconnect(),o.removeEventListener("click",d)}},[e,t]),i("div",{ref:n})}function gd({text:e}){let t=ie(()=>oe(e),[e]),n=ie(()=>oe(!0),[]);return i(Lr,{textSig:t,doneSig:n})}function md(e){let t=e.getAttribute("href")??"";if(!t||t.startsWith("#"))return;e.target!=="_blank"&&(e.target="_blank");let n=new Set((e.rel||"").split(/\s+/).filter(Boolean));n.add("noopener"),n.add("noreferrer"),e.rel=[...n].join(" ")}var Or=R.cssPrefix;function vd({messageId:e,initial:t,strings:n,onFeedback:o}){let[r,a]=$(t);L(()=>a(t),[e,t]);let s=l=>{let c=r===l?null:l;a(c),o(e,c)};return i("div",{class:`${Or}-feedback`,role:"group","data-testid":T.messageFeedback,children:[i("button",{type:"button",class:`${Or}-msg-action`,"data-active":r==="up"?"true":void 0,"aria-pressed":r==="up","aria-label":n.feedbackUp,title:n.feedbackUp,onClick:()=>s("up"),"data-testid":T.feedbackUp,children:i(Cc,{})}),i("button",{type:"button",class:`${Or}-msg-action`,"data-active":r==="down"?"true":void 0,"aria-pressed":r==="down","aria-label":n.feedbackDown,title:n.feedbackDown,onClick:()=>s("down"),"data-testid":T.feedbackDown,children:i(Rc,{})}),i("span",{class:`${Or}-sr-only`,role:"status","aria-live":"polite",children:r?n.feedbackThanks:""})]})}var Dn=R.cssPrefix;function hd({part:e,strings:t}){let n=e.title||e.filename||e.url||t.sources;return e.url?i("a",{class:`${Dn}-source`,href:e.url,target:"_blank",rel:"noreferrer noopener","data-testid":T.source,children:[i("span",{class:`${Dn}-source-icon`,"aria-hidden":"true",children:"\u{1F517}"}),i("span",{class:`${Dn}-source-label`,children:n})]}):i("span",{class:`${Dn}-source`,"data-testid":T.source,children:[i("span",{class:`${Dn}-source-icon`,"aria-hidden":"true",children:"\u{1F4C4}"}),i("span",{class:`${Dn}-source-label`,children:n})]})}var lt=R.cssPrefix;function bd({part:e,strings:t,active:n,superseded:o=!1,continuationStreaming:r=!1,onDecision:a,onEdit:s}){let l=ie(()=>fe(()=>e.approvalSig.value),[e]),c=ie(()=>fe(()=>ld(e,{active:n,superseded:o,continuationStreaming:r})),[e,n,o,r]).value,{terminal:d,showApproveReject:p,showAnswered:_,showSubmitted:u,showEdit:f,skipped:m}=c,g=si(e.toolName),y=c.answeredApproved,k=e.toolCallId,S=i(de,{children:[i("p",{class:`${lt}-toolui-prompt`,children:t.approvalPrompt.replace("{tool}",g)}),i("p",{class:`${lt}-toolui-subtle`,children:t.approvalBody})]});u?S=i("p",{class:`${lt}-toolui-subtle`,children:t.approvalSubmitting}):_&&y!==!1?S=i(de,{children:[i("p",{class:`${lt}-toolui-prompt`,children:[t.approvalYourResponse.replace("{decision}",y?t.approve:t.reject),l.value?.reason?` \u2014 ${l.value.reason}`:""]}),f?i("p",{class:`${lt}-toolui-subtle`,children:t.approvalEditHint}):null,f?null:i("p",{class:`${lt}-toolui-subtle`,children:t.approvalSubmitting})]}):_&&(S=i(de,{}));let b=p||u||f||_&&y!==!1;return i("div",{class:`${lt}-toolui-group`,"data-testid":c.decided?T.toolDecision:T.toolApproval,children:[i(Er,{part:e,strings:t,superseded:m,submitted:u}),m||d||!b?null:i("div",{class:`${lt}-toolui ${lt}-toolui-body`,children:[S,p?i("div",{class:`${lt}-toolui-actions`,children:[i("button",{type:"button",class:`${lt}-form-skip`,disabled:!n,onClick:()=>a(k,!1),"data-testid":T.toolReject,children:t.reject}),i("button",{type:"button",class:`${lt}-form-submit`,disabled:!n,onClick:()=>a(k,!0),"data-testid":T.toolApprove,children:t.approve})]}):null,f?i("div",{class:`${lt}-toolui-actions`,children:i("button",{type:"button",class:`${lt}-form-skip`,onClick:()=>s(k),"data-testid":T.toolEdit,children:t.edit})}):null]})]})}var qm=new Set(["text","email","phone","number","date","single-select","multi-select","boolean"]);function yd(e){let t=e&&typeof e=="object"?e:{},o=(Array.isArray(t.questions)?t.questions:[]).map(Vm).filter(r=>r!==null);return{intro:Nr(t.intro),questions:o}}function Vm(e,t){if(!e||typeof e!="object")return null;let n=e,o=qm.has(n.type)?n.type:"text";return{key:Nr(n.key)??`q${t+1}`,question:Nr(n.question)??"Please provide the missing information.",type:o,options:Array.isArray(n.options)?n.options.filter(r=>typeof r=="string"&&r.trim().length>0):void 0,required:typeof n.required=="boolean"?n.required:void 0,helpText:Nr(n.helpText)}}function Wm(e){switch(e){case"text":return"textarea";case"phone":return"tel";case"single-select":case"boolean":return"radio";case"multi-select":return"multiselect";default:return e}}function vi(e,t,n){return e.questions.map(o=>{let r=Wm(o.type),a=o.type==="boolean"?[{value:"yes",label:t},{value:"no",label:n}]:(o.options??[]).map(s=>({value:s,label:s}));return{name:o.key,label:o.question,type:r,required:o.required??!1,options:a.length>0?a:void 0,validationHint:o.helpText}})}function Nr(e){return typeof e=="string"&&e.trim()?e.trim():void 0}var $e=R.cssPrefix,Km={text:"qtypeText",email:"qtypeEmail",phone:"qtypePhone",number:"qtypeNumber",date:"qtypeDate","single-select":"qtypeChooseOne","multi-select":"qtypeChooseAny",boolean:"qtypeBoolean"};function Pd(e,t){let n={};for(let o of e)n[o.key]=t[Km[o.type]];return n}function xd({part:e,strings:t,active:n,superseded:o=!1,continuationStreaming:r=!1,onDecision:a,onEdit:s}){let l=ie(()=>fe(()=>e.stateSig.value),[e]).value,c=ie(()=>fe(()=>e.approvalSig.value),[e]).value,d=ie(()=>fe(()=>yd(e.inputSig.value)),[e]).value,{terminal:p,decided:_}=Ir(l,c),u=_&&c?.approved===!0,f=r&&!_,m=!_&&!o&&!f,g=!m&&!u&&!f,y=u&&n&&!p,k=d.questions,[S,b]=$(null),P=S??(m||u||f),[w,D]=$(!1),q=k.length>1?Xa:co,B=m?t.inputRequired:t.inputBadge,M=f?i("p",{class:`${$e}-toolui-subtle`,children:t.approvalSubmitting}):m?i(Gm,{req:d,strings:t,active:n,resolve:(V,te)=>a(e.toolCallId,te,V)}):w?i(po,{fields:vi(d,t.confirmYes,t.confirmNo),strings:t,submitLabel:t.inputSubmit,onSubmit:()=>{},disabled:!0,hideActions:!0,fieldTypeLabels:Pd(k,t),initialValues:u?Qm(k,c?.reason):void 0}):i(jm,{questions:k,answers:u?Jm(c?.reason):{},strings:t}),F="completed",H=t.inputAnswered;return g?(F="superseded",H=t.inputSkipped):f&&(F="responded",H=t.statusResponded),i("details",{class:`${$e}-toolui ${$e}-toolui-collapsible${o?` ${$e}-toolui-stale`:""}`,open:P,onToggle:V=>{let te=V.currentTarget.open;te!==P&&b(te)},"data-testid":m?T.toolAskQuestions:T.toolDecision,children:[i("summary",{class:`${$e}-toolui-head`,children:[i("span",{class:`${$e}-toolui-q-pill`,children:[i(q,{}),B]}),i("span",{class:`${$e}-toolui-head-end`,children:[m?null:i(li,{status:F,icon:g?i(gr,{}):i(mr,{}),label:H}),i("span",{class:`${$e}-toolui-chevron`,children:i(ln,{})})]})]}),i("div",{class:`${$e}-toolui-collapse-body`,children:[d.intro?i("div",{class:`${$e}-toolui-desc`,children:d.intro}):null,M,m||f?null:i("div",{class:`${$e}-toolui-footer`,children:[i("button",{type:"button",class:`${$e}-toolui-options-toggle`,onClick:()=>D(V=>!V),"data-testid":T.toolAskOptions,children:[i("span",{class:`${$e}-toolui-options-chevron${w?` ${$e}-open`:""}`,children:i(ln,{})}),w?t.hideOptions:t.showOptions]}),y?i("button",{type:"button",class:`${$e}-form-skip`,onClick:()=>s(e.toolCallId),"data-testid":T.toolEdit,children:t.edit}):null]})]})]})}function Gm({req:e,strings:t,active:n,resolve:o}){let r=vi(e,t.confirmYes,t.confirmNo),a=e.questions.length===1&&e.questions[0]?.type==="text";return i(po,{fields:r,strings:t,disabled:!n,submitLabel:t.inputSubmit,footerHint:a?t.inputSubmitHint:void 0,onSubmit:s=>o(Ym(e.questions,s),!0),skipLabel:t.inputSkip,onSkip:()=>o(void 0,!1),submitOnEnter:a,fieldTypeLabels:Pd(e.questions,t),submitTestId:T.toolInputSubmit,skipTestId:T.toolInputSkip})}function jm({questions:e,answers:t,strings:n}){return i("div",{class:`${$e}-toolui-summary`,"data-testid":T.toolAskSummary,children:e.map(o=>i("div",{class:`${$e}-field`,children:[i("span",{class:`${$e}-field-head`,children:i("span",{class:`${$e}-field-label`,children:[o.question,o.required?i("span",{class:`${$e}-field-req`,"aria-hidden":"true",children:" *"}):null]})}),i("p",{class:`${$e}-toolui-answer`,children:Xm(o,t[o.key],n)||"\u2014"})]},o.key))})}function Xm(e,t,n){return e.type!=="boolean"?t??"":t==="yes"?n.confirmYes:t==="no"?n.confirmNo:t??""}function Ym(e,t){let n=e.flatMap(o=>{let r=t[o.key];if(r==null||r.trim()==="")return[];let a=o.type==="multi-select"?r.split(",").map(s=>s.trim()).filter(Boolean):r;return[{key:o.key,value:a}]});return JSON.stringify({answers:n})}function Sd(e){if(!e)return{};let n=(()=>{try{return JSON.parse(e)}catch{return}})()?.answers;if(!Array.isArray(n))return{};let o={};for(let r of n)if(r&&typeof r=="object"&&"key"in r){let{key:a,value:s}=r;if(typeof a!="string")continue;typeof s=="string"?o[a]=s:Array.isArray(s)&&(o[a]=s.filter(l=>typeof l=="string"))}return o}function Jm(e){let t=Sd(e),n={};for(let[o,r]of Object.entries(t))n[o]=Array.isArray(r)?r.join(", "):r;return n}function Qm(e,t){let n=Sd(t),o={};for(let r of e){let a=n[r.key];a!==void 0&&(r.type==="multi-select"?o[r.key]=Array.isArray(a)?a:[a]:o[r.key]=Array.isArray(a)?a[0]??"":a)}return o}function kd({part:e,strings:t,live:n}){let o=ie(()=>fe(()=>e.inputSig.value),[e]),r=ie(()=>fe(()=>e.outputSig.value),[e]),a=ie(()=>fe(()=>e.errorSig.value),[e]);return ie(()=>fe(()=>!!Ar(o.value)||!!a.value||!!Ar(di(r.value))),[o,r,a]).value?i(Er,{part:e,strings:t,testid:T.toolCall,live:n}):null}var ze=R.cssPrefix,wd=ed(Zm);function Zm({message:e,status:t,strings:n,responseMode:o,showReasoning:r,showToolCalls:a,showSources:s,interactive:l=!1,superseded:c=!1,tool:d,onRetry:p,enableMessageFeedback:_=!1,onFeedback:u}){let m=ie(()=>fe(()=>e.partsSig.value),[e]).value,g=ie(()=>fe(()=>on(e)),[e]),y=ie(()=>fe(()=>Vl(e)),[e]),k=ie(()=>fe(()=>ad(e)),[e]),S=ie(()=>fe(()=>r&&id(e)),[e,r]),b=t==="streaming",x=e.role==="assistant"&&b,P=sd({streaming:x,responseMode:o,reasoningVisible:S.value,hasAnswerText:k.value,emptyReply:g.value,hidden:y.value}),{bufferedHold:w,working:D,showStreamDots:q}=P;if(P.hidden)return null;let B=tg(e.createdAt),M=e.role==="assistant"||e.role==="operator",F=_&&!!u&&!!e.serverMessageId&&M&&!b&&t!=="error"&&!g.value,H=b?"":m.filter(W=>W.kind==="text").map(W=>W.textSig.peek()).join(`
|
|
40
40
|
|
|
41
|
-
`).trim(),F=!v&&t!=="error"&&!b.value&&G.length>0,ee=D||F;return i("div",{class:`${Ke}-bubble-row`,"data-role":e.role,"data-testid":Ge(E.messageBubble,e.serverMessageId??e.id),children:i("div",{class:`${Ke}-bubble-col`,children:[i("div",{class:`${Ke}-bubble`,children:[e.role==="operator"&&e.operatorInitials?i("span",{class:`${Ke}-bubble-author`,children:e.operatorInitials}):null,i("div",{class:`${Ke}-bubble-body`,children:[w?i(ig,{label:n.loading}):m.map((I,U)=>i(tg,{part:I,active:$,live:y,strings:n,showReasoning:r,showToolCalls:a,showSources:s,interactive:l&&t==="complete"&&(I.kind!=="tool"||_r(e,U)),superseded:c,continuationStreaming:e.continuationStreaming===!0,tool:d},`${rg(I)}#${U}`)),ie&&i(ag,{}),t==="error"||b.value?i("div",{class:`${Ke}-error`,role:"alert",children:[i("span",{children:e.errorText??n.errorGeneric}),_?i("button",{type:"button",class:`${Ke}-error-retry`,onClick:()=>_(e),"data-testid":E.messageRetry,children:n.errorRetry}):null]}):null]})]}),z||ee?i("div",{class:`${Ke}-bubble-meta`,children:[z?i("time",{class:`${Ke}-bubble-time`,dateTime:z.iso,title:z.full,children:z.short}):null,ee?i("div",{class:`${Ke}-bubble-actions`,children:[D&&e.serverMessageId?i(vd,{messageId:e.serverMessageId,initial:e.feedback??null,strings:n,onFeedback:u}):null,F?i(Zm,{text:G,strings:n}):null]}):null]}):null]})})}function Zm({text:e,strings:t}){let[n,o]=B(!1),r=()=>{navigator.clipboard?.writeText(e).then(()=>{o(!0),setTimeout(()=>o(!1),1500)}).catch(()=>{})},a=n?t.copied:t.copy;return i("button",{type:"button",class:`${Ke}-msg-action`,"data-active":n?"true":void 0,"aria-label":a,title:a,onClick:r,"data-testid":E.messageCopy,children:n?i(_n,{}):i(wc,{})})}function eg(e){if(typeof e!="number"||!Number.isFinite(e))return null;try{let t=new Date(e);return{short:t.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}),full:t.toLocaleString(void 0,{dateStyle:"full",timeStyle:"short"}),iso:t.toISOString()}}catch{return null}}function tg({part:e,active:t,live:n,strings:o,showReasoning:r,showToolCalls:a,showSources:s,interactive:l,superseded:c,continuationStreaming:d,tool:_}){switch(e.kind){case"step-start":return null;case"text":return i($r,{textSig:e.textSig,doneSig:e.doneSig});case"reasoning":return r?i(og,{part:e,active:t,strings:o}):null;case"tool":return i(ng,{part:e,strings:o,showToolCalls:a,interactive:l,superseded:c,continuationStreaming:d,live:n,tool:_});case"file":return e.mediaType.startsWith("image/")?i("img",{src:e.url,alt:"",loading:"lazy"}):i("a",{href:e.url,target:"_blank",rel:"noreferrer noopener",children:e.url});case"source":return s?i(hd,{part:e,strings:o}):null}}function ng({part:e,strings:t,showToolCalls:n,interactive:o,superseded:r,continuationStreaming:a,live:s,tool:l}){let c=se(()=>be(()=>e.approvalSig.value!==void 0),[e]);return l?.humanInLoop&&c.value?Mr(e.toolName)?i(xd,{part:e,strings:t,active:o,superseded:r,continuationStreaming:a,onDecision:l.onDecision,onEdit:l.onEdit}):i(bd,{part:e,strings:t,active:o,superseded:r,continuationStreaming:a,onDecision:l.onDecision,onEdit:l.onEdit}):n?i(kd,{part:e,strings:t,live:s}):null}function og({part:e,active:t,strings:n}){return i("details",{class:`${Ke}-reasoning`,"data-testid":E.reasoning,open:t,"data-active":t?"true":void 0,children:[i("summary",{class:`${Ke}-reasoning-summary`,children:i("span",{class:`${Ke}-reasoning-label`,children:t?n.thinking:n.thoughts})}),i("div",{class:`${Ke}-reasoning-body`,children:i($r,{textSig:e.textSig,doneSig:e.doneSig})})]})}function rg(e){switch(e.kind){case"text":case"reasoning":case"step-start":return`${e.kind}:${e.id}`;case"tool":return`tool:${e.toolCallId}`;case"file":return`file:${e.url}`;case"source":return`source:${e.sourceId}`}}function ag(){return i("span",{class:`${Ke}-typing`,"data-testid":E.typingDots,"aria-hidden":"true",children:[i("span",{}),i("span",{}),i("span",{})]})}function ig({label:e}){return i("span",{class:`${Ke}-loading`,role:"status",children:[i("span",{class:`${Ke}-loading-spinner`,"aria-hidden":"true"}),i("span",{class:`${Ke}-loading-label`,children:e})]})}var Yt=C.cssPrefix,yi=120,sg=350;function Cd({messagesSig:e,strings:t,responseMode:n,showReasoning:o,showToolCalls:r,showSources:a,enableMessageFeedback:s,onFeedback:l,loading:c,onLoadPreviousMessages:d,idle:_,controlMode:p="ai-agent",tool:u,onRetry:f,form:m,formMarkers:b,onFillForm:h}){let x=M(null),P=mt(()=>e.value),[v,y]=B(!1),[k,w]=B(!1),$=M(!1),ie=M(!1),[z,T]=B(),D=M(!1),G=M(!1),F=M(!1),ee=M(0),I=()=>F.current||performance.now()-ee.current<sg,U=M(0),V=S=>{let X=S.scrollHeight-S.clientHeight>1;S.dataset.fadeTop=X&&S.scrollTop>1?"true":"false",S.dataset.fadeBottom=X&&S.scrollHeight-S.scrollTop-S.clientHeight>1?"true":"false"},pe=S=>y(S.scrollHeight-S.scrollTop-S.clientHeight>yi*2),te=S=>{U.current=performance.now(),S.scrollTop=S.scrollHeight,V(S)},ue=(S,X)=>{te(S);let fe=X,re=0,Pe=()=>{G.current||I()||(te(S),--fe>0&&(re=requestAnimationFrame(Pe)))};return X>0&&(re=requestAnimationFrame(Pe)),()=>cancelAnimationFrame(re)},we=(S,X)=>{let fe,re,Pe,R=-1,ce=()=>{fe.disconnect(),re.disconnect(),clearTimeout(Pe)},J=()=>{if(G.current||I()||R>=0&&S.scrollTop<R-4)return ce();te(S),R=S.scrollTop};return fe=new ResizeObserver(J),re=new MutationObserver(J),J(),fe.observe(S),re.observe(S,{childList:!0,subtree:!0,characterData:!0}),Pe=setTimeout(ce,X),ce},_t=P.value[0]?.id;kt(()=>{let S=x.current;if(S&&P.value.length!==0&&!ie.current&&(D.current=!0,!!P.value.some(X=>X.role==="user")))return we(S,300)},[_t]);let et=M(0);O(()=>{let S=x.current,X=P.value,fe=et.current;if(et.current=X.length,!S||!D.current||ie.current)return;if(X.slice(fe).some(Pe=>Pe.role==="user"))return G.current=!1,ue(S,3);if(!X.some(Pe=>Pe.role==="user")||G.current||I())return;S.scrollHeight-S.scrollTop-S.clientHeight<yi&&te(S)},[P.value.length]);let Je=M(null);O(()=>{let S=x.current,X=P.value.at(-1),fe=Je.current;if(Je.current=X?{id:X.id,streaming:X.status==="streaming"}:null,!!S&&D.current&&!(!X||X.id!==fe?.id||fe.streaming||X.status!=="streaming"))return G.current=!1,ue(S,3)},[P.value]),O(()=>{let S=x.current;if(!S)return;let X=P.value.at(-1);if(!X||X.status!=="streaming"&&!P.value.some(Pe=>Pe.role==="user"))return;let fe=()=>{if(G.current||I())return;S.scrollHeight-S.scrollTop-S.clientHeight<yi*2&&te(S)};if(X.status!=="streaming")return we(S,300);fe();let re=new MutationObserver(fe);return re.observe(S,{childList:!0,subtree:!0,characterData:!0}),()=>re.disconnect()},[P.value]);let Ue=m?.form.id,Qe=!!m&&(b??[]).some(S=>S.formId===m.form.id);kt(()=>{let S=x.current;!S||!Ue||G.current||P.value.some(X=>X.role==="user")&&(Qe?S.querySelector(`[data-testid="${E.formGate}"]`)?.scrollIntoView({block:"nearest"}):te(S))},[Ue,Qe]),O(()=>{let S=x.current;if(!S)return;let X=()=>{pe(S),V(S),performance.now()-U.current>150&&(G.current=S.scrollHeight-S.scrollTop-S.clientHeight>8)},fe=()=>{G.current=!0},re=he=>{he.deltaY<0&&fe()},Pe=0,R=he=>{Pe=he.touches[0]?.clientY??0,F.current=!0},ce=he=>{(he.touches[0]?.clientY??0)>Pe+4&&fe()},J=()=>{F.current=!1,ee.current=performance.now()},xe=()=>{F.current=!0};return S.addEventListener("scroll",X,{passive:!0}),S.addEventListener("wheel",re,{passive:!0}),S.addEventListener("touchstart",R,{passive:!0}),S.addEventListener("touchmove",ce,{passive:!0}),S.addEventListener("touchend",J,{passive:!0}),S.addEventListener("touchcancel",J,{passive:!0}),S.addEventListener("pointerdown",xe,{passive:!0}),window.addEventListener("pointerup",J,{passive:!0}),window.addEventListener("pointercancel",J,{passive:!0}),pe(S),()=>{S.removeEventListener("scroll",X),S.removeEventListener("wheel",re),S.removeEventListener("touchstart",R),S.removeEventListener("touchmove",ce),S.removeEventListener("touchend",J),S.removeEventListener("touchcancel",J),S.removeEventListener("pointerdown",xe),window.removeEventListener("pointerup",J),window.removeEventListener("pointercancel",J)}},[]);let pt=()=>{let S=x.current;S&&(G.current=!1,te(S))},tt=P.value.filter(S=>!S.ephemeral),nt=tt[0],ge=nt?.serverMessageId??nt?.id,at=!!(d&&tt.length>=qa&&ge!==z),Xe=async()=>{if(!d||$.current)return;let S=x.current,X=S?.scrollHeight??0,fe=S?.scrollTop??0;$.current=!0,ie.current=!0,w(!0);try{let re=await d();re===!1&&ge&&T(ge),re&&S&&(await new Promise(Pe=>requestAnimationFrame(()=>requestAnimationFrame(()=>Pe()))),S.scrollTop=fe+S.scrollHeight-X,V(S),pe(S))}finally{ie.current=!1,$.current=!1,w(!1)}},ze=[],xt="",q=P.value.at(-1)?.id,W=[...b??[]].toSorted((S,X)=>(S.createdAt??1/0)-(X.createdAt??1/0)),oe=S=>m&&S.formId===m.form.id?i(ai,{form:m.form,strings:t,onSubmit:m.onSubmit,onSkip:m.onSkip},`gate:${S.formId}`):i(Wc,{marker:S,strings:t,onFill:!m&&h?()=>h(S.formId):void 0},S.key),_e=S=>{for(let X=W[0];X?.createdAt!==void 0&&!(S!==void 0&&X.createdAt>S);X=W[0])W.shift(),ze.push(oe(X))};for(let S of P.value){if(S.role==="assistant"&&S.id!==q&&cn(S))continue;_e(S.createdAt);let X=lg(S.createdAt);X&&X!==xt&&(ze.push(i("div",{class:`${Yt}-date-divider`,children:i("span",{class:`${Yt}-date-pill`,title:cg(S.createdAt),children:dg(S.createdAt,t)})},`day:${X}`)),xt=X);let re=S.retryAction!==void 0||S.role==="assistant"&&S.id===q?mr(P.value,S):void 0,Pe=re!==void 0&&(re.kind!=="continue-assistant"||p==="ai-agent");ze.push(i(wd,{message:S,status:S.status,strings:t,responseMode:n,showReasoning:o,showToolCalls:r,showSources:a,interactive:!!_&&p==="ai-agent"&&S.id===q,superseded:S.id!==q,tool:u,onRetry:_&&Pe&&(S.role==="user"||S.id===q)?f:void 0,enableMessageFeedback:s,onFeedback:l},S.id))}for(let S of W)ze.push(oe(S));return i("div",{class:`${Yt}-list-wrap`,children:[i("div",{ref:x,class:`${Yt}-list ${Yt}-list--fade`,role:"log","aria-live":"polite","aria-relevant":"additions text",children:[c&&P.value.length===0?i("div",{class:`${Yt}-list-loading`,role:"status",children:t.conversationLoading}):null,at?i("div",{class:`${Yt}-load-previous`,children:i("button",{type:"button",onClick:Xe,disabled:k,"aria-busy":k,"data-testid":E.loadPreviousMessages,children:t.loadPreviousMessages})}):null,ze,m&&!Qe?i(ai,{form:m.form,strings:t,onSubmit:m.onSubmit,onSkip:m.onSkip}):null]}),v?i("button",{type:"button",class:`${Yt}-jump`,onClick:pt,"aria-label":t.scrollToBottom,title:t.scrollToBottom,"data-testid":E.scrollToBottom,children:i(pn,{})}):null]})}function lg(e){if(typeof e!="number"||!Number.isFinite(e))return"";let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function cg(e){if(typeof e!="number"||!Number.isFinite(e))return"";try{return new Date(e).toLocaleDateString(void 0,{dateStyle:"full"})}catch{return""}}function dg(e,t){let n=new Date(e),o=a=>new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime(),r=Math.round((o(new Date)-o(n))/864e5);return r<=0?t.dateToday:r===1?t.dateYesterday:r<7?n.toLocaleDateString(void 0,{weekday:"long"}):n.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"})}var ug=["today","yesterday","lastWeek","older"];function _g(e,t){let n=Date.parse(t);if(!Number.isFinite(n))return"older";let o=Math.floor((Rd(e)-Rd(n))/(1440*60*1e3));return o<=0?"today":o===1?"yesterday":o<7?"lastWeek":"older"}function Td(e,t){let n=new Map;for(let o of t){let r=_g(e,o.lastMessageAt),a=n.get(r);a?a.push(o):n.set(r,[o])}return ug.filter(o=>n.has(o)).map(o=>({bucket:o,conversations:n.get(o)}))}function Rd(e){let t=new Date(e);return t.setUTCHours(0,0,0,0),t.getTime()}var Id=Z.scope("history"),pg=3,fg=6,mg={today:"dateToday",yesterday:"dateYesterday",lastWeek:"dateLastWeek",older:"dateOlder"};function Ed(e,t){let n=t.type!=="upsert"||t.activity===!0;if(t.type==="snapshot"&&t.result.pagination.page===1&&e.pagination.page>1){let r=Bt(e.conversations.slice(0,t.result.pagination.limit),t,n);if(t.result.conversations.length===0){if(r.length===0)return t.result;let d=Math.max(t.result.pagination.total,r.length);return{...t.result,conversations:r,pagination:{...t.result.pagination,total:d,totalPages:Math.ceil(d/t.result.pagination.limit)}}}let a=new Set(r.map(d=>d.conversationId)),s=e.conversations.slice(t.result.pagination.limit).filter(d=>!a.has(d.conversationId)),l=e.pagination.page,c={...t.result.pagination,page:l,hasPrev:l>1,hasNext:l<t.result.pagination.totalPages};return{conversations:[...r,...s],pagination:c}}let o=Bt(e.conversations,t,n);return o===e.conversations?e:{...t.type==="snapshot"?t.result:e,conversations:o}}function gg(e,t,n){let o=Date.parse(e);return Number.isFinite(o)?new Date(o).toDateString()===new Date(t).toDateString()?new Intl.DateTimeFormat(n,{hour:"numeric",minute:"2-digit"}).format(o):t-o<10080*60*1e3?new Intl.DateTimeFormat(n,{weekday:"short"}).format(o):new Intl.DateTimeFormat(n,{month:"short",day:"numeric"}).format(o):""}function Hr({transport:e,strings:t,locale:n,persistence:o,onSelect:r,onNewConversation:a}){let s=C.cssPrefix,l=e.peekConversations({limit:50}),[c,d]=B(l?"loaded":"loading"),[_,p]=B(l),[u,f]=B(!1),m=M(),b=_?.conversations??[],h=_?.pagination;O(()=>{let k=!1,w=!0,$=[],ie=e.subscribeConversationChanges(T=>{w&&$.push(T),p(D=>D&&Ed(D,T))});m.current=void 0,f(!1);let z=e.peekConversations({limit:50});return p(z),d(z?"loaded":"loading"),e.listConversations({limit:50}).then(T=>{if(k)return;let D=T;for(let G of $)D=Ed(D,G);$=[],w=!1,p(D),d("loaded"),o.saveHistoryCount(D.conversations.length)}).catch(T=>{k||($=[],w=!1,Id.warn("listConversations failed",{err:T}),d("error"))}),()=>{k=!0,ie(),m.current=void 0}},[e,o,n]);let x=async()=>{if(m.current||!h?.hasNext)return;let k={};m.current=k,f(!0);try{let w=await e.listConversations({page:h.page+1,limit:h.limit});if(m.current!==k)return;p($=>{if(!$)return $;let ie=new Set($.conversations.map(D=>D.conversationId)),z=w.conversations.filter(D=>ie.has(D.conversationId)?!1:(ie.add(D.conversationId),!0)),T={conversations:[...$.conversations,...z],pagination:w.pagination};return o.saveHistoryCount(T.conversations.length),T})}catch(w){if(m.current!==k)return;Id.warn("listConversations page failed",{err:w,page:h.page+1})}finally{m.current===k&&(m.current=void 0,f(!1))}},P=a?i("div",{class:`${s}-history-footer`,children:i("button",{type:"button",class:`${s}-history-new`,onClick:a,"data-testid":E.sidebarNewConversation,children:[i(Ql,{}),t.newConversation]})}):null;if(c==="loading"){let k=Math.min(o.loadHistoryCount()??pg,fg);return i(me,{children:[i("div",{class:`${s}-history`,"aria-busy":"true","aria-label":t.historyLoading,children:i("div",{class:`${s}-history-group`,"aria-hidden":"true",children:[i("div",{class:`${s}-history-heading`,children:i("span",{class:`${s}-skeleton ${s}-skeleton-heading`})}),i("div",{class:`${s}-history-card`,children:Array.from({length:Math.max(1,k)},(w,$)=>i("div",{class:`${s}-history-item ${s}-history-item-skeleton`,children:[i("span",{class:`${s}-history-avatar ${s}-skeleton`}),i("span",{class:`${s}-history-body`,children:[i("span",{class:`${s}-history-row`,children:[i("span",{class:`${s}-history-title`,children:i("span",{class:`${s}-skeleton ${s}-skeleton-title`})}),i("span",{class:`${s}-history-time`,children:i("span",{class:`${s}-skeleton ${s}-skeleton-time`})})]}),i("span",{class:`${s}-history-row`,children:i("span",{class:`${s}-history-preview`,children:i("span",{class:`${s}-skeleton ${s}-skeleton-preview`})})})]})]},$))})]})}),P]})}if(c==="error"||b.length===0)return i(me,{children:[i("div",{class:`${s}-history-empty`,children:t.historyEmpty}),P]});let v=Date.now(),y=Td(v,b);return i(me,{children:[i("div",{class:`${s}-history`,role:"list",children:[y.map(k=>i("div",{class:`${s}-history-group`,children:[i("div",{class:`${s}-history-heading`,children:t[mg[k.bucket]]}),i("div",{class:`${s}-history-card`,children:k.conversations.map(w=>i("button",{type:"button",role:"listitem",class:`${s}-history-item`,onClick:()=>r(w),"data-closed":w.canContinue?void 0:"true","data-unread":w.hasUnread?"true":void 0,"data-testid":Ge(E.historyItem,w.conversationId),children:[i("span",{class:`${s}-history-avatar`,"aria-hidden":"true",children:i(Qa,{})}),i("span",{class:`${s}-history-body`,children:[i("span",{class:`${s}-history-row`,children:[i("span",{class:`${s}-history-title`,children:w.title}),i("span",{class:`${s}-history-time`,children:gg(w.lastMessageAt,v,n)})]}),i("span",{class:`${s}-history-row`,children:[i("span",{class:`${s}-history-preview`,children:w.preview??(w.canContinue?t.historyContinue:t.conversationClosed)}),w.hasUnread?i("span",{class:`${s}-history-dot`}):null]})]})]},w.conversationId))})]},k.bucket)),h?.hasNext?i("div",{class:`${s}-history-more`,children:i("button",{type:"button",onClick:x,disabled:u,"aria-busy":u,"data-testid":E.historyLoadMore,children:t.loadMoreConversations})}):null]}),P]})}var Ad=C.cssPrefix;function Md({suggestions:e,onPick:t,disabled:n=!1}){return e.length===0?null:i("div",{class:`${Ad}-suggestions`,role:"group","aria-label":"Suggested replies",children:e.map((o,r)=>i("button",{type:"button",class:`${Ad}-suggestion`,onClick:()=>t(o),disabled:n,"data-testid":Ge(E.suggestion,r),children:o.label},o.id))})}var je=C.cssPrefix;function Ld(e){let{options:t,onClose:n}=e,o=t.strings,r=M(null);O(()=>{let d=r.current;if(!d)return;let _=wr(d),p=u=>{u.key==="Escape"&&n?.()};return d.addEventListener("keydown",p),()=>{_(),d.removeEventListener("keydown",p)}},[n]);let a=e.composerApiRef,s=e.composerActive&&e.view==="chat"&&e.canSend&&!e.activeForm&&!e.sendPreparing&&e.options.features.fileUpload,l=L(d=>{s&&a.current?.attachFromDrop(d)},[a,s]),{visible:c}=Ir({containerRef:r,onDrop:l,disabled:!s});return Sr(r.current,t.mode==="modal"),i("div",{ref:r,class:`${je}-panel`,role:"dialog","aria-modal":"false","aria-label":o.panelTitle,style:{position:"relative"},"data-testid":E.panel,children:[i(Pi,{...e,containerEl:r.current,dragOver:c,composerAttachApiRef:a}),i(xi,{poweredBy:e.options.poweredBy})]})}function Pi(e){let{options:t,transport:n,feedback:o,bus:r,persistence:a,conversationId:s,composerKey:l,panelSize:c,view:d,canSend:_,isStreaming:p,sendPreparing:u,controlMode:f,assignedOperatorInitials:m,operatorAvailable:b,operatorRequestEnabled:h,onRequestOperator:x,onCancelOperatorRequest:P,loadingMessages:v,onLoadPreviousMessages:y,messagesSig:k,agent:w,suggestions:$,initialWidgetSize:ie,onClose:z,onBack:T,onClear:D,onToggleHistory:G,onSelectHistoryConversation:F,onNewConversation:ee,onWidgetSizeChange:I,onSend:U,onStop:V,onSuggestion:pe,activeForm:te,formMarkers:ue,onFormSubmit:we,onFormSkip:_t,onFormFill:et,tool:Je,onRetry:Ue,onMessageFeedback:Qe,containerEl:pt,dragOver:tt,composerAttachApiRef:nt}=e,ge=t.strings,at=mt(()=>k.value.some(ze=>!ze.ephemeral&&ze.role!=="system")).value,Xe;return te?Xe=null:_?Xe=i(me,{children:[f&&f!=="ai-agent"?i(bg,{controlMode:f,operatorInitials:m,operatorAvailable:b,onCancelOperatorRequest:P,strings:ge}):null,!p&&f==="ai-agent"&&i(Md,{suggestions:$,onPick:pe,disabled:u}),i(Bc,{options:t,transport:n,feedback:o,bus:r,persistence:a,conversationId:s,isStreaming:p,active:e.composerActive&&d==="chat",isPreparing:u,operatorRequestEnabled:h,canRequestOperator:at,controlMode:f,onRequestOperator:x,onSend:U,onStop:V,attachApiRef:nt},l)]}):Xe=i(hg,{label:ge.conversationClosed,ctaLabel:ge.startNewConversation,onNewConversation:D}),i(me,{children:[d==="history"?i(vg,{strings:ge,onBack:G,onClose:z,showClose:kr(t.mode,c,t.actions)}):i("header",{class:`${je}-header`,"data-testid":E.panelHeader,children:[T?i("button",{type:"button",class:`${je}-icon-btn`,onClick:T,"aria-label":ge.moduleBack,title:ge.moduleBack,children:i(fo,{})}):null,w?i(Nc,{agent:w,strings:ge}):i("h1",{children:ge.panelTitle}),i(It,{panelProps:e,variant:"chat"})]}),d==="history"?i(Hr,{transport:n,strings:ge,locale:t.locale,persistence:a,onSelect:F,onNewConversation:ee}):i(me,{children:[i(Hc,{visible:tt,strings:ge}),i(Cd,{messagesSig:k,strings:ge,responseMode:t.responseMode,showReasoning:t.showReasoning,showToolCalls:t.showToolCalls,showSources:t.showSources,enableMessageFeedback:t.enableMessageFeedback,onFeedback:Qe,loading:v,onLoadPreviousMessages:y,idle:!p&&!u&&_&&!te,controlMode:f,tool:Je,onRetry:Ue,form:te?{form:te,onSubmit:we,onSkip:_t}:null,formMarkers:ue,onFillForm:et}),Xe,i(Pg,{disclaimer:t.composerDisclaimer})]}),t.size.resize?.enabled?i(xr,{panelEl:pt,resize:t.size.resize,position:t.position,initialSize:ie,onSizeChange:I,strings:ge}):null]})}function vg({strings:e,onBack:t,onClose:n,showClose:o}){return i("header",{class:`${je}-header`,children:[i("button",{type:"button",class:`${je}-icon-btn`,onClick:t,"aria-label":e.historyBack,title:e.historyBack,children:i(fo,{})}),i("h1",{children:e.historyTitle}),o?i("button",{type:"button",class:`${je}-icon-btn`,onClick:n,"aria-label":e.close,title:e.close,children:i(Tt,{})}):null]})}function hg({label:e,ctaLabel:t,onNewConversation:n}){return i("div",{class:`${je}-readonly-banner`,role:"note",children:[i("span",{class:`${je}-readonly-label`,children:e}),i("button",{type:"button",class:`${je}-readonly-cta`,onClick:n,children:t})]})}function bg({controlMode:e,operatorInitials:t,operatorAvailable:n,onCancelOperatorRequest:o,strings:r}){let a=yg(e,t,n,r);return i("div",{class:`${je}-operator-banner`,role:"status","data-mode":e,"data-testid":E.operatorBanner,children:[i("span",{class:`${je}-operator-pulse`,"aria-hidden":"true"}),i("span",{class:`${je}-operator-label`,children:a}),e==="awaiting_operator"&&o?i("button",{type:"button",class:`${je}-cancel-operator-request`,"data-testid":E.cancelOperatorRequest,onClick:o,children:r.cancelOperatorRequest}):null]})}function yg(e,t,n,o){return e==="operator"?o.chattingWithOperator.replace("{operator}",t??""):n===!1?o.noOperatorAvailable:o.connectingOperator}function Pg({disclaimer:e}){return e?i("div",{class:`${je}-composer-footer`,children:i("div",{class:`${je}-disclaimer`,children:e})}):null}function xi({poweredBy:e}){return e?i("div",{class:`${je}-poweredby-bar`,children:i(xg,{logoUrl:e.logoUrl,text:e.text,href:e.href})}):null}function xg({logoUrl:e,text:t,href:n}){let o=i(me,{children:[e?i("img",{class:`${je}-poweredby-logo`,src:e,alt:"",loading:"lazy"}):null,t?i("span",{children:t}):null]});return n?i("a",{class:`${je}-poweredby`,href:n,target:"_blank",rel:"noopener noreferrer",children:o}):i("span",{class:`${je}-poweredby`,children:o})}function Od(e){let t=M(e);t.current=e;let n=M(null);return n.current??(n.current=Sg(t)),n.current}function Sg(e){let t=ae(null),n=new Set,o=c=>`${e.current.conversationId()??""}:${c}`,r=c=>c.frequency==="always"?!1:c.frequency==="conversation"?n.has(o(c.id)):c.id in e.current.persistence.loadFormsDone(),a=(c,d)=>{if(t.value)return;let _=e.current;if(c==="manual"){let p=_.forms.list.find(u=>u.id===d);p&&(t.value={form:p,trigger:"manual"});return}for(let p of _.forms.byTrigger[c]??[]){let u=p.triggers.find(f=>f.kind===c);if(!(!u||!kg(u,_)||r(p)||!wg(p,_))){t.value={form:p,trigger:c};return}}},s=(c,d)=>{let _=t.value;if(!_)return;t.value=null;let{form:p,trigger:u}=_;p.frequency==="conversation"?n.add(o(p.id)):p.frequency!=="always"&&e.current.persistence.saveFormDone(p.id),e.current.onComplete(p,u,c,d)};return{activeForm:t,fire:a,refresh:()=>{let c=t.value;if(!c)return;let d=e.current.forms.list.find(_=>_.id===c.form.id);d&&d!==c.form&&(t.value={form:d,trigger:c.trigger})},complete:c=>s(c,!1),skip:()=>s({},!0)}}function kg(e,t){return e.kind==="after-messages"?t.messageCount()>=Number(e.param??0):e.kind==="page-area"?t.pageArea()===e.param:!0}function wg(e,t){let n=e.when;if(!n)return!0;if(n.missingContext?.length){let r=t.userContext()??{};if(n.missingContext.some(a=>r[a]!==void 0&&r[a]!==""))return!1}if(n.pageArea&&!(Array.isArray(n.pageArea)?n.pageArea:[n.pageArea]).includes(t.pageArea()??""))return!1;let o=t.messageCount();return!(n.minMessages!=null&&o<n.minMessages||n.maxMessages!=null&&o>n.maxMessages)}function Nd(e){let t=C.cssPrefix,{site:n,blocks:o,strings:r,collapsed:a}=e,s=o?.navigation??[],l=o?.linkCards??[],c=a?r.expandSidebar:r.collapseSidebar;return i("aside",{class:`${t}-sidebar`,"data-collapsed":a?"true":"false","data-testid":E.sidebar,children:[i("div",{class:`${t}-sidebar-header`,children:[i(Cg,{site:n}),i("button",{type:"button",class:`${t}-sidebar-toggle`,"aria-label":c,"aria-expanded":a?"false":"true",title:c,onClick:e.onToggleCollapsed,"data-testid":E.sidebarToggle,children:i(Rg,{collapsed:a})})]}),a?null:i(me,{children:[s.length>0?i("nav",{class:`${t}-sidebar-section`,"data-section":"navigation",children:i(Tg,{items:s})}):null,l.length>0?i("div",{class:`${t}-sidebar-section`,"data-section":"link-cards",children:i(Ig,{items:l})}):null,e.showConversations?i("div",{class:`${t}-sidebar-conversations`,children:i(Hr,{transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,onSelect:e.onSelectConversation,onNewConversation:e.onNewConversation})}):null]})]})}function Cg({site:e}){let t=C.cssPrefix;if(e?.logo?.url){let n=e.logo.alt??e.title??"Logo";return i("picture",{children:[e.logoDark?.url?i("source",{srcset:e.logoDark.url,media:"(prefers-color-scheme: dark)"}):null,i("img",{class:`${t}-sidebar-logo`,src:e.logo.url,alt:n})]})}return i("div",{class:`${t}-sidebar-title`,children:e?.title??C.name})}function Rg({collapsed:e}){return i("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true",children:e?i("polyline",{points:"9 6 15 12 9 18"}):i("polyline",{points:"15 6 9 12 15 18"})})}function Tg({items:e}){let t=C.cssPrefix;return i("ul",{class:`${t}-sidebar-nav`,children:e.map(n=>i("li",{children:i("a",{class:`${t}-sidebar-nav-item`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[n.icon?i("span",{class:`${t}-sidebar-nav-icon`,"data-icon":n.icon}):null,i("span",{class:`${t}-sidebar-nav-label`,children:n.label})]})},n.id??n.label))})}function Ig({items:e}){let t=C.cssPrefix;return i("div",{class:`${t}-sidebar-cards`,children:e.map(n=>i("a",{class:`${t}-sidebar-card`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[i("div",{class:`${t}-sidebar-card-label`,children:n.label}),n.description?i("div",{class:`${t}-sidebar-card-desc`,children:n.description}):null]},n.id??n.label))})}var Dd=C.cssPrefix;function $d(e){return i("main",{class:`${Dd}-page-shell`,"data-sidebar-collapsed":e.sidebarCollapsed?"true":"false",children:[i(Nd,{site:e.site,blocks:e.blocks,transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,showConversations:e.showConversations,onSelectConversation:e.onSelectConversation,onNewConversation:e.onNewConversation,collapsed:e.sidebarCollapsed,onToggleCollapsed:e.onToggleSidebarCollapsed}),i("section",{class:`${Dd}-page-chat`,"aria-label":"Chat",children:e.children})]})}var Fd=e=>Object.fromEntries(e.map(t=>[t,[]]));function Si(e,t,n){return e.includes(t)?t:e.includes(n)?n:e[0]??""}function Bd(e,t,n){let o=[...new Set(t)],r=Si(o,e,""),a=ae({activeTab:r,stacks:Fd(o)});return{sig:a,reconcile(s,l){let c=[...new Set(s)],d=a.value,_=Si(c,d.activeTab,l),p=Object.fromEntries(c.map(f=>[f,d.stacks[f]??[]])),u=_===d.activeTab&&c.length===Object.keys(d.stacks).length&&c.every(f=>d.stacks[f]===p[f]);o=c,!u&&(a.value={activeTab:_,stacks:p},_!==d.activeTab&&_&&n?.(_))},switchTab(s){!(s in a.value.stacks)||a.value.activeTab===s||(a.value={...a.value,activeTab:s},n?.(s))},push(s){let l=a.value,c=l.stacks[l.activeTab]??[];a.value={...l,stacks:{...l.stacks,[l.activeTab]:[...c,s]}}},pop(){let s=a.value,l=s.stacks[s.activeTab]??[];l.length!==0&&(a.value={...s,stacks:{...s.stacks,[s.activeTab]:l.slice(0,-1)}})},reset(s){a.value={activeTab:Si(o,s,""),stacks:Fd(o)}}}}var Hd=e=>e.stacks[e.activeTab]??[],Ud=e=>Hd(e).at(-1),zd=e=>Hd(e).length===0;var qd={Icon:go};var Jt=C.cssPrefix;function Ur({title:e,actions:t}){return i("header",{class:`${Jt}-back-header`,"data-variant":"title",children:[i("span",{class:`${Jt}-back-spacer`,"aria-hidden":"true"}),i("h1",{class:`${Jt}-back-title`,children:e}),t??i("span",{class:`${Jt}-back-spacer`,"aria-hidden":"true"})]})}function zr({title:e,backLabel:t,onBack:n,actions:o,testid:r}){return i("header",{class:`${Jt}-back-header`,"data-testid":r,children:[i("button",{type:"button",class:`${Jt}-icon-btn`,onClick:n,"aria-label":t,title:t,children:i(fo,{})}),i("h1",{class:`${Jt}-back-title`,children:e}),o??i("span",{class:`${Jt}-back-spacer`,"aria-hidden":"true"})]})}function gn(e,t){return e instanceof We&&e.status===429?t.errorRateLimited:t.errorGeneric}var Un=C.cssPrefix;function Vd({placeholder:e,onActivate:t}){return i("button",{type:"button",class:`${Un}-home-search`,onClick:t,"data-testid":E.homeSearch,children:[i("span",{class:`${Un}-home-search-text`,children:e}),i("span",{class:`${Un}-home-search-icon`,"aria-hidden":"true",children:i(ei,{})})]})}function Wd({placeholder:e,value:t,onInput:n}){return i("div",{class:`${Un}-home-search`,"data-input":"true",children:[i("input",{type:"search",class:`${Un}-home-search-input`,placeholder:e,value:t,onInput:o=>n(o.currentTarget.value),"data-testid":E.helpSearch}),i("span",{class:`${Un}-home-search-icon`,"aria-hidden":"true",children:i(ei,{})})]})}var yo=C.cssPrefix;function qr({title:e,subtitle:t,onClick:n,testid:o}){return i("button",{type:"button",class:`${yo}-list-row`,onClick:n,"data-testid":o,children:[i("span",{class:`${yo}-list-row-body`,children:[i("span",{class:`${yo}-list-row-title`,children:e}),t?i("span",{class:`${yo}-list-row-sub`,children:t}):null]}),i("span",{class:`${yo}-list-row-chevron`,"aria-hidden":"true",children:i(Dn,{})})]})}var Gd=C.cssPrefix;function Pt({tone:e="info",message:t,onRetry:n,strings:o}){return i("div",{class:`${Gd}-module-empty`,role:e==="error"?"alert":"status","aria-live":"polite",children:[i("span",{children:t}),n?i("button",{type:"button",class:`${Gd}-module-retry`,onClick:n,children:o.errorRetry}):null]})}var vn=C.cssPrefix,Eg=Z.scope("help"),Ag=(e,t)=>t.url?e.push({kind:"iframe",url:t.url,title:t.title}):e.push({kind:"content",id:t.id,title:t.title});function Mg(e){let t=new Map;for(let n of e){let o=n.categories?.[0]??"";(t.get(o)??t.set(o,[]).get(o)).push(n)}return[...t.entries()]}function Kd(e,t){let n=t.toLowerCase(),o=n.indexOf(e);if(o!==-1)return 100-Math.min(o,99);let r=0;for(let a of e){if(r=n.indexOf(a,r),r===-1)return 0;r+=1}return 1}function Lg(e,t){let n=t.toLowerCase().trim();return n?e.map(o=>({item:o,score:Math.max(Kd(n,o.title)*2,Kd(n,o.description??""))})).filter(o=>o.score>0).toSorted((o,r)=>r.score-o.score).map(o=>o.item):[]}function jd({article:e,nav:t}){return i(qr,{title:e.title,subtitle:e.description,onClick:()=>Ag(t,e),testid:Ge(E.helpArticle,e.id)})}function Og({transport:e,strings:t,config:n,nav:o,bus:r,panelProps:a}){let s=n.contentTags,[l,c]=B("loading"),[d,_]=B(t.errorGeneric),[p,u]=B([]),[f,m]=B(""),[b,h]=B(0);O(()=>{let v=!1;return c("loading"),e.listContent({tags:s,sortBy:"order",limit:100}).then(y=>{if(v)return;let k=y.items??[];u(k),c("loaded"),r.emit("contentView",{section:"help",tags:s?.join(","),count:k.length})}).catch(y=>{v||(Eg.warn("listContent (help) failed",{err:y}),_(gn(y,t)),c("error"))}),()=>{v=!0}},[e,s,b,r]);let x=se(()=>Lg(p,f),[p,f]);O(()=>{let v=f.trim();if(!v)return;let y=setTimeout(()=>r.emit("contentSearch",{queryLength:v.length,hitCount:x.length}),600);return()=>clearTimeout(y)},[f,x,r]);function P(){return f.trim().length>0?x.length===0?i(Pt,{message:t.helpSearchEmpty,strings:t}):i("div",{class:`${vn}-help-card`,children:x.map(v=>i(jd,{article:v,nav:o},v.id))}):l==="loading"?i(Pt,{message:t.helpLoading,strings:t}):l==="error"?i(Pt,{tone:"error",message:d,onRetry:()=>h(v=>v+1),strings:t}):p.length===0?i(Pt,{message:t.helpEmpty,strings:t}):Mg(p).map(([v,y])=>i("section",{class:`${vn}-help-group`,children:[v?i("h2",{class:`${vn}-help-section-title`,children:v}):null,i("div",{class:`${vn}-help-card`,children:y.map(k=>i(jd,{article:k,nav:o},k.id))})]},v))}return i("div",{class:`${vn}-module`,children:[i(Ur,{title:t.helpTitle,actions:i(It,{panelProps:a,variant:"plain"})}),i("div",{class:`${vn}-module-pad`,children:i(Wd,{placeholder:t.helpSearchPlaceholder,value:f,onInput:m})}),i("div",{class:`${vn}-help-list`,children:P()})]})}var Xd={Icon:mo,Root:e=>i(Og,{...e})};var Yd=C.cssPrefix;function ki({onClick:e,children:t,testid:n}){return e?i("button",{type:"button",class:`${Yd}-home-card`,"data-interactive":"true",onClick:e,"data-testid":n,children:t}):i("div",{class:`${Yd}-home-card`,"data-testid":n,children:t})}var Ie=C.cssPrefix,Jd=Z.scope("home");function Ng(e){let t=e.options.userContext?.name,n=e.config.greetingText?rt(e.strings,e.config.greetingText):void 0;return n?{title:t?n.replace("{name}",t):n.replace(/\s*\{name\}\s*/," ").trim(),subtitle:e.strings.homeGreetingLead}:t?{title:e.strings.homeGreetingNamed.replace("{name}",t),subtitle:e.strings.homeGreetingLead}:{title:e.strings.homeGreeting}}var Dg=(e,t)=>t.url?e.push({kind:"iframe",url:t.url,title:t.title}):e.push({kind:"content",id:t.id,title:t.title});function Qd(e,t){return Bt(e,t,t.type!=="upsert"||t.activity===!0)}function $g(e){let{transport:t,strings:n,config:o,nav:r,bus:a,panelProps:s}=e,[l,c]=B(null),[d,_]=B([]),p=o.contentTags?.join(","),u=e.options.modules.list.some(P=>P.layout==="chat");O(()=>{if(o.showRecentConversations===!1)return;let P=!1,v=!0,y=[],k=t.subscribeConversationChanges(w=>{v&&y.push(w),c($=>Qd($?[$]:[],w)[0]??null)});return t.listConversations({limit:u?50:1}).then(w=>{if(P)return;let $=y.reduce(Qd,w.conversations);y=[],v=!1,c($[0]??null)}).catch(w=>{P||(y=[],v=!1,Jd.warn("listConversations (home) failed",{err:w}))}),()=>{P=!0,k()}},[t,o.showRecentConversations,u]),O(()=>{if(!o.contentTags?.length)return;let P=!1;return t.listContent({tags:o.contentTags,limit:6}).then(v=>{if(P)return;let y=v.items??[];_(y),a.emit("contentView",{section:"home",tags:p,count:y.length})}).catch(v=>!P&&Jd.warn("listContent (home) failed",{err:v})),()=>{P=!0}},[t,p,a]);let f=Ng(e),m=o.userAvatars??[],b=o.status,h=b?.text?rt(n,b.text):n.homeStatus,x=o.contentBlockTitle?rt(n,o.contentBlockTitle):n.homeContentTitle;return i("div",{class:`${Ie}-module ${Ie}-home`,"data-testid":E.homeView,children:i("div",{class:`${Ie}-home-scroll`,children:[i("div",{class:`${Ie}-home-hero`,children:[i("div",{class:`${Ie}-home-hero-top`,children:[o.brandName?i("span",{class:`${Ie}-home-brand`,"data-testid":E.homeBrand,children:o.brandName}):i("span",{class:`${Ie}-home-brand-spacer`,"aria-hidden":"true"}),i("div",{class:`${Ie}-home-hero-actions`,children:[m.length>0?i("div",{class:`${Ie}-home-avatars`,children:m.map(P=>i("span",{class:`${Ie}-home-avatar`,title:P.role?`${P.name} \xB7 ${P.role}`:P.name,children:P.avatar?i("img",{src:P.avatar,alt:"",loading:"lazy"}):i("span",{children:Cr(P.name)})},P.name))}):null,i(It,{panelProps:s,variant:"plain"})]})]}),o.showGreeting!==!1?i(me,{children:[i("h1",{class:`${Ie}-home-greeting`,"data-testid":E.homeGreeting,children:f.title}),f.subtitle?i("p",{class:`${Ie}-home-lead`,children:f.subtitle}):null]}):null]}),i("div",{class:`${Ie}-home-cards`,children:[o.showSearchBar!==!1?i(Vd,{placeholder:n.homeSearchPlaceholder,onActivate:()=>r.switchToLayout("help")}):null,l?i(ki,{onClick:()=>r.selectConversation(l),testid:E.homeRecent,children:i("div",{class:`${Ie}-home-recent-row`,"data-unread":l.hasUnread?"true":void 0,children:[i("span",{class:`${Ie}-home-recent-avatar`,"aria-hidden":"true",children:i(go,{})}),i("span",{class:`${Ie}-home-recent-body`,children:[i("span",{class:`${Ie}-home-recent-title`,children:l.title}),l.preview?i("span",{class:`${Ie}-home-recent-preview`,children:l.preview}):null]}),l.hasUnread?i("span",{class:`${Ie}-home-recent-dot`,"aria-label":"Unread"}):null]})}):null,b?i(ki,{onClick:b.url?()=>r.push({kind:"iframe",url:b.url,title:h}):void 0,children:i("div",{class:`${Ie}-home-status`,"data-level":b.level??"operational",children:[i("span",{class:`${Ie}-home-status-icon`,"aria-hidden":"true",children:i(bc,{})}),i("span",{class:`${Ie}-home-status-text`,children:h})]})}):null,d.length>0?i("section",{class:`${Ie}-home-content`,children:[i("div",{class:`${Ie}-home-content-title`,children:x}),i("div",{class:`${Ie}-home-content-list`,children:d.map(P=>i(qr,{title:P.title,subtitle:P.description,onClick:()=>Dg(r,P),testid:Ge(E.homeContentRow,P.id)},P.id))})]}):null]})]})})}var Zd={Icon:yc,Root:e=>i($g,{...e})};var Qt=C.cssPrefix,Fg=Z.scope("news");function Bg({transport:e,strings:t,config:n,nav:o,bus:r,panelProps:a}){let s=n.contentTags,[l,c]=B("loading"),[d,_]=B(t.errorGeneric),[p,u]=B([]),[f,m]=B(0);O(()=>{let h=!1;return c("loading"),e.listContent({tags:s,sortBy:"publishedAt",sortOrder:"desc"}).then(x=>{if(h)return;let P=x.items??[];u(P),c("loaded"),r.emit("contentView",{section:"news",tags:s?.join(","),count:P.length})}).catch(x=>{h||(Fg.warn("listContent (news) failed",{err:x}),_(gn(x,t)),c("error"))}),()=>{h=!0}},[e,s,f,r]);function b(){return l==="loading"?i(Pt,{message:t.newsLoading,strings:t}):l==="error"?i(Pt,{tone:"error",message:d,onRetry:()=>m(h=>h+1),strings:t}):p.length===0?i(Pt,{message:t.newsEmpty,strings:t}):i("div",{class:`${Qt}-news-list`,children:p.map(h=>i("button",{type:"button",class:`${Qt}-news-card`,onClick:()=>o.push({kind:"content",id:h.id,title:h.title}),"data-testid":Ge(E.newsItem,h.id),children:[h.image?i("img",{class:`${Qt}-news-hero`,src:h.image,alt:"",loading:"lazy"}):null,i("span",{class:`${Qt}-news-body`,children:[i("span",{class:`${Qt}-news-title`,children:h.title}),h.description?i("span",{class:`${Qt}-news-summary`,children:h.description}):null]})]},h.id))})}return i("div",{class:`${Qt}-module`,children:[i(Ur,{title:t.newsTitle,actions:i(It,{panelProps:a,variant:"plain"})}),i("div",{class:`${Qt}-module-scroll`,children:b()})]})}var eu={Icon:Pc,Root:e=>i(Bg,{...e})};var Vr={chat:qd,home:Zd,help:Xd,news:eu};var Po=C.cssPrefix;function tu({modules:e,activeTab:t,strings:n,hasUnread:o,onSelect:r}){return i("nav",{class:`${Po}-tabbar`,role:"tablist","aria-label":n.panelTitle,children:e.map(a=>{let s=Vr[a.layout].Icon,l=a.id===t,c=a.layout==="chat"&&o;return i("button",{type:"button",role:"tab","aria-selected":l,class:`${Po}-tab`,onClick:()=>r(a.id),"data-testid":Ge(E.tab,a.id),children:[i("span",{class:`${Po}-tab-icon`,"aria-hidden":"true",children:[i(s,{}),c?i("span",{class:`${Po}-tab-badge`,"data-testid":E.tabBadge,"aria-label":"Unread"}):null]}),i("span",{class:`${Po}-tab-label`,children:rt(n,a.label)})]},a.id)})})}var nu=C.cssPrefix,Hg="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads";function ou({url:e,title:t,strings:n,onBack:o,actions:r}){return i("div",{class:`${nu}-module`,children:[i(zr,{title:t||n.moduleBack,backLabel:n.moduleBack,onBack:o,actions:r}),i("iframe",{class:`${nu}-content-frame`,src:e,title:t||"content",sandbox:Hg,referrerpolicy:"no-referrer",loading:"lazy",allow:"fullscreen"})]})}var xo=C.cssPrefix,Ug=Z.scope("content"),zg=5e3;function ru({id:e,title:t,transport:n,strings:o,bus:r,onBack:a,actions:s}){let[l,c]=B(null),[d,_]=B(!1),[p,u]=B(0),f=L(()=>{_(!1),c(null),u(h=>h+1)},[]);O(()=>{let h=!1;return n.listContent({ids:[e],limit:1}).then(x=>{if(h)return;let P=x.items[0];P?(c(P),r.emit("contentOpen",{contentId:e,tags:P.tags?.length?P.tags.join(","):void 0})):_(!0)}).catch(x=>{h||(Ug.warn("listContent (reader) failed",{err:x}),_(!0))}),()=>{h=!0}},[n,e,p,r]),O(()=>{if(!l)return;let h=setTimeout(()=>r.emit("contentRead",{contentId:e}),zg);return()=>clearTimeout(h)},[l,e,r]);let m=L(h=>{let P=h.target?.closest?.("a")?.getAttribute("href")??"";P&&!P.startsWith("#")&&r.emit("contentLinkClick",{contentId:e})},[r,e]);function b(){return d?i(Pt,{tone:"error",message:o.errorGeneric,onRetry:f,strings:o}):l===null?i(Pt,{message:o.contentLoading,strings:o}):i("article",{class:`${xo}-content`,"data-testid":E.contentView,onClick:m,children:[l.image?i("img",{class:`${xo}-content-hero`,src:l.image,alt:"",loading:"lazy"}):null,l.description?i("p",{class:`${xo}-content-subtitle`,children:l.description}):null,i(gd,{text:l.content??""})]})}return i("div",{class:`${xo}-module`,children:[i(zr,{title:l?.title||t||o.moduleBack,backLabel:o.moduleBack,onBack:a,actions:s,testid:E.backHeader}),i("div",{class:`${xo}-module-scroll`,"data-testid":E.contentScroll,children:b()})]})}var Wr=C.cssPrefix;function au({panelProps:e,enabledModules:t,nav:n,bus:o,hasUnread:r,onSelectConversation:a,onStartNewConversation:s,onSetPanelSize:l}){let c=e.options,d=c.strings,_=M(null),p=M(new Set);O(()=>{let F=_.current;if(!F)return;let ee=wr(F),I=U=>{U.key==="Escape"&&e.onClose?.()};return F.addEventListener("keydown",I),()=>{ee(),F.removeEventListener("keydown",I)}},[e.onClose]);let u=mt(()=>n.sig.value).value,f=Ud(u),m=c.modules.byId[u.activeTab],b=e.composerActive&&m?.layout==="chat"&&f===void 0,h=e.composerApiRef,x=b&&e.view==="chat"&&e.canSend&&!e.activeForm&&!e.sendPreparing&&e.options.features.fileUpload,P=L(F=>{x&&h.current?.attachFromDrop(F)},[h,x]),{visible:v}=Ir({containerRef:_,onDrop:P,disabled:!x});Sr(_.current,c.mode==="modal");let y=f?.kind==="iframe"||f?.kind==="content",k=t.length>1&&(zd(u)||!y),w=M(null);O(()=>{if(y&&w.current===null)w.current=e.panelSize,e.panelSize==="normal"&&l("expanded");else if(!y&&w.current!==null){let F=w.current;w.current=null,l(F)}},[y]);let $={push:n.push,pop:n.pop,switchTab:n.switchTab,switchToLayout:F=>{let ee=t.find(I=>I.layout===F);ee&&n.switchTab(ee.id)},selectConversation:a,startNewConversation:s},ie=F=>({options:c,transport:e.transport,strings:d,config:F,nav:$,bus:o,panelProps:e}),z=i(It,{panelProps:e,variant:"plain"});m&&p.current.add(m.id);let T=t.filter(F=>p.current.has(F.id)),D=F=>{if(F.layout==="chat")return i(Pi,{...e,composerActive:b,containerEl:_.current,dragOver:v,composerAttachApiRef:h});let ee=Vr[F.layout].Root;return ee?i(ee,{...ie(F)}):null},G=()=>f?.kind==="iframe"?i(ou,{url:f.url,title:f.title,strings:d,onBack:n.pop,actions:z}):f?.kind==="content"?i(ru,{id:f.id,title:f.title,transport:e.transport,strings:d,bus:o,onBack:n.pop,actions:z}):null;return i("div",{ref:_,class:`${Wr}-panel ${Wr}-messenger`,role:"dialog","aria-modal":"false","aria-label":d.panelTitle,style:{position:"relative"},"data-testid":E.messengerHome,children:[i("div",{class:`${Wr}-messenger-body`,children:[T.map(F=>i("div",{class:`${Wr}-messenger-pane`,hidden:y||F.id!==m?.id,children:D(F)},F.id)),G()]}),k?i(tu,{modules:t,activeTab:u.activeTab,strings:d,hasUnread:r,onSelect:n.switchTab}):null,i(xi,{poweredBy:c.poweredBy}),c.size.resize?.enabled&&!(m?.layout==="chat"&&!f)?i(xr,{panelEl:_.current,resize:c.size.resize,position:c.position,initialSize:e.initialWidgetSize,onSizeChange:e.onWidgetSizeChange,strings:d}):null]})}var So=C.cssPrefix;function iu({strings:e,onClose:t}){return i("div",{class:`${So}-panel ${So}-modules-empty`,role:"dialog","aria-label":e.panelTitle,"data-testid":E.modulesEmpty,children:[t?i("button",{type:"button",class:`${So}-icon-btn ${So}-modules-empty-close`,onClick:t,"aria-label":e.close,title:e.close,children:i(Tt,{})}):null,i("p",{class:`${So}-modules-empty-text`,children:e.modulesEmpty})]})}function zn(e,t,n,o){let r={role:n,text:o};e.emit("message",r),t.onMessage?.(r)}var wi=Z.scope("hitl");function su(e){let{streaming:t,controlModeSig:n,messagesSig:o,sendAiTurn:r,bus:a,humanInLoop:s}=e,l=M(t);l.current=t;let c=L((u,f,m)=>{if(l.current||n.value!=="ai-agent")return!1;let b=o.value.at(-1),h=b?.partsSig.value.findIndex(P=>P.kind==="tool"&&P.toolCallId===u)??-1,x=b?.partsSig.value[h];return!b||x?.kind!=="tool"?(wi.warn("decideTool: tool part not found",{toolCallId:u}),!1):b.status!=="complete"||!_r(b,h)||!f(x)?!1:(m(x),b.partsSig.value=[...b.partsSig.value],dn(b)&&(b.status="streaming",b.retryAction={kind:"continue-assistant",messageId:b.serverMessageId??b.id},b.awaitingContinuation=!0,o.value=[...o.value],r({continueExisting:!0})),!0)},[n,o,r]),d=L((u,f,m)=>{let b=!1;if(c(u,x=>x.stateSig.value==="approval-requested",x=>{b=Mr(x.toolName);let P=x.approvalSig.value?.id??u;x.approvalSig.value={id:P,approved:f,reason:m},x.stateSig.value="approval-responded"})){if(b){wi.info("toolResult",{toolCallId:u}),a.emit("toolResult",{toolCallId:u});return}wi.info("toolDecision",{toolCallId:u,approved:f}),a.emit("toolDecision",{toolCallId:u,approved:f})}},[a,c]),_=L(u=>{c(u,f=>f.stateSig.value==="approval-responded"&&f.approvalSig.value?.approved!==void 0,f=>{let m=f.approvalSig.value?.id??u;f.approvalSig.value={id:m},f.stateSig.value="approval-requested"})},[c]);return{toolInteraction:se(()=>({humanInLoop:s,onDecision:d,onEdit:_}),[s,d,_])}}function lu({callout:e,persistence:t}){let n=e?.text??"",o=e?.persistent??!0,[r,a]=B(()=>o?!1:t.loadCalloutDismissed(n));O(()=>{a(o?!1:t.loadCalloutDismissed(n))},[n,o,t]);let s=L(()=>{a(!0),o||t.saveCalloutDismissed(n)},[t,n,o]);return{dismissed:r,dismissCallout:s}}function cu(e){let{transport:t,conversationIdSig:n}=e,o=bt("ai-agent"),r=bt(void 0),a=bt(void 0),s=M(),l=L(p=>{let u=p.controlRevision??0,f=s.current;f&&f.conversationId===n.value&&u<f.revision||(s.current={conversationId:n.value,revision:u},o.value=p.controlMode,r.value=p.assignedOperatorInitials,p.controlMode!=="awaiting_operator"?a.value=void 0:p.operatorAvailable!==void 0&&(a.value=p.operatorAvailable))},[n,o,r,a]),c=L(p=>{p.type==="data-control-state"&&l(Kt(p.data))},[l]),d=L(async()=>{let p=n.value,u=await t.requestOperator();u&&n.value===p&&l(Kt(u))},[t,n,l]),_=L(async()=>{let p=n.value,u=await t.cancelOperatorRequest();u&&n.value===p&&l(Kt(u))},[t,n,l]);return{controlModeSig:o,assignedOperatorInitialsSig:r,operatorAvailableSig:a,applyControlState:l,adoptControlStateChunk:c,requestOperator:d,cancelOperatorRequest:_}}var Gr=C.cssPrefix,du=`--${Gr}-visual-viewport-height`,uu=`--${Gr}-visual-viewport-top`;function _u(e){let{hostElement:t,mode:n,panelSize:o,isOpen:r,surfaceReady:a,setIsOpen:s}=e;kt(()=>{Xo(t,ir(n,o,r))},[t,r,o,n]),kt(()=>{if(!r||!a)return;let l=t.ownerDocument.defaultView,c=l?.visualViewport,d=t.shadowRoot?.querySelector(`.${Gr}-anchor`);if(!l||!c||!d)return;let _=()=>{d.style.setProperty(du,`${c.height}px`),d.style.setProperty(uu,`${c.offsetTop}px`)},p=0,u=()=>{l.cancelAnimationFrame(p),p=l.requestAnimationFrame(()=>{p=l.requestAnimationFrame(_)})};return _(),c.addEventListener("resize",u),c.addEventListener("scroll",u),()=>{l.cancelAnimationFrame(p),c.removeEventListener("resize",u),c.removeEventListener("scroll",u),d.style.removeProperty(du),d.style.removeProperty(uu)}},[t,r,a]),O(()=>{if(n!=="modal"||!r)return;let l=c=>{c.composedPath().some(_=>_ instanceof HTMLElement&&_.classList.contains(`${Gr}-panel`))||s(!1)};return t.addEventListener("click",l),()=>t.removeEventListener("click",l)},[t,r,n,s]),O(()=>{if(n!=="drawer"||!r)return;let l=c=>{c.key==="Escape"&&s(!1)};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[r,n,s])}var Ci=Z.scope("reducer"),Kr=class{constructor(t,n){le(this,"messagesSig",t);le(this,"onReconcileNeeded",n);le(this,"active",null);le(this,"openTextParts",new Map);le(this,"partSeq",0);le(this,"replay",null)}attach(t){this.active=t,this.openTextParts.clear()}detach(){this.active=null,this.replay=null,this.openTextParts.clear()}beginReplay(t,n){let o=Ht();o.id=t.id;let r=hn(t)||un(t)&&(t.status!=="streaming"||dn(t)),a=t.status==="streaming"&&dn(t)&&uo(t);this.replay={baseline:t,shadow:o,chunks:[n],probeContinuation:r,continuationTailReplay:a,liveCatchUp:t.status==="streaming"&&!r},this.attach(o),this.apply(n)}refreshReplayBaseline(){let t=this.replay;if(!t)return null;let n=t.shadow.serverMessageId??t.baseline.serverMessageId,o=this.messagesSig.value,r=o.at(-1),a=r===t.baseline||r?.id===t.baseline.id||n!==void 0&&r?.serverMessageId===n?r:o.find(l=>l===t.baseline)??o.find(l=>l.id===t.baseline.id||n!==void 0&&l.serverMessageId===n);if(!a)return this.detach(),null;if(a===t.baseline)return t;let s=t.baseline;return t.baseline=a,pu(s,a),t.liveCatchUp&&hn(t.shadow)&&(a.status==="streaming"||un(a))?(t.probeContinuation=!1,t.continuationTailReplay=!1,t):(t.probeContinuation=hn(a)||un(a)&&(a.status!=="streaming"||dn(a)),t.continuationTailReplay=a.status==="streaming"&&dn(a)&&uo(a),t.liveCatchUp=a.status==="streaming"&&!t.probeContinuation,t)}refreshActive(){let t=this.active;if(!t)return null;let n=t.serverMessageId,o=this.messagesSig.value,r=o.at(-1),a=r===t||r?.id===t.id||n!==void 0&&r?.serverMessageId===n?r:o.find(l=>l===t)??o.find(l=>l.id===t.id||n!==void 0&&l.serverMessageId===n);if(!a)return this.detach(),null;if(a===t)return t;pu(t,a);let s=hn(t)&&un(a);return a.status!=="streaming"&&!s?(this.detach(),null):(this.replay={baseline:a,shadow:t,chunks:[],probeContinuation:!1,continuationTailReplay:!1,liveCatchUp:!0},t)}promoteReplay(){let{baseline:t,shadow:n}=this.replay;return ht(()=>{t.role=n.role,t.serverMessageId=n.serverMessageId,t.operatorInitials=n.operatorInitials,t.status=n.status,n.canceled&&(t.canceled=!0),t.finishReason=n.finishReason,t.errorText=n.errorText,t.suggestions=n.suggestions??t.suggestions,t.partsSig.value=n.partsSig.value,this.messagesSig.value=[...this.messagesSig.value]}),this.replay=null,this.active=t,t}promoteContinuation(t=!1){let{baseline:n,chunks:o}=this.replay,r=pr(n);return this.replay=null,ht(()=>{if(t){let a=n.partsSig.value.findLastIndex(s=>s.kind==="tool");n.partsSig.value=n.partsSig.value.slice(0,a+1)}n.awaitingContinuation=!1,n.status="streaming",n.finishReason=void 0,n.errorText=void 0,n.suggestions=void 0,this.attach(n);for(let a of o)this.apply(a);n.continuationStreaming=r||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}settleOwnedContinuation(t){let{baseline:n}=this.replay,o=pr(n);return this.replay=null,ht(()=>{n.awaitingContinuation=!1,n.status="streaming",n.finishReason=void 0,n.errorText=void 0,n.suggestions=void 0,this.attach(n),this.apply(t),n.continuationStreaming=o||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}applyResume(t){if(t.type==="start"){let r=(this.replay?.baseline??this.active)?.serverMessageId;r!==void 0&&t.messageId!==void 0&&r!==t.messageId&&this.onReconcileNeeded?.({messageId:r}),this.detach();let a=t.messageId,s=a!==void 0?this.messagesSig.value.find(_=>_.serverMessageId===a||_.id===a):void 0;if(s!==void 0)return t.messageMetadata?.senderRole==="visitor"&&s.role==="user"&&(s.status==="pending"||s.status==="error")&&(s.serverMessageId=a,s.status="complete",s.errorText=void 0,s.retryAction=void 0,this.messagesSig.value=[...this.messagesSig.value]),this.beginReplay(s,t),null;let l=t.messageMetadata?.senderRole,c=this.messagesSig.value.at(-1);if(l===void 0&&c?.role==="assistant"&&c.status==="streaming"&&c.serverMessageId===void 0&&!wt(c))return this.attach(c),this.apply(t),null;let d=Ht();return this.attach(d),this.messagesSig.value=[...this.messagesSig.value,d],this.apply(t),null}if(this.replay){let o=this.refreshReplayBaseline();if(!o)return null;o.chunks.push(t),t.type==="data-control-state"&&(o.baseline.operatorRoutedTurn=t.data.controlMode!=="ai-agent"),this.apply(t);let{baseline:r,shadow:a,probeContinuation:s,continuationTailReplay:l,liveCatchUp:c}=o,d=t.type==="finish"||t.type==="error"||t.type==="abort";if(s){if(!Wg(r,a,t))return d&&(Xg(r,a)&&(r.continuationStreaming=!0,this.messagesSig.value=[...this.messagesSig.value],this.onReconcileNeeded?.({messageId:r.serverMessageId??r.id})),this.detach()),null;let p=hn(r)&&d?this.settleOwnedContinuation(t):this.promoteContinuation();return d?(p.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:p.serverMessageId??p.id}):p.continuationStreaming=!1),this.detach(),p):null}if(l&&Vg(r,a)){let p=this.promoteContinuation(!0);return d?(this.detach(),p):null}if(!c)return d&&this.detach(),null;if(d&&!wt(r)&&wt(a)){let p=this.promoteReplay();return this.detach(),p}if(!qg(r,a))return d&&(this.onReconcileNeeded?.({messageId:r.serverMessageId??r.id}),this.detach()),null;let _=this.promoteReplay();return d?(this.detach(),_):null}let n=this.refreshActive();if(!n)return null;if(this.replay)return this.applyResume(t);if(this.apply(t),t.type==="finish"||t.type==="error"||t.type==="abort"){let o=n;return o.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:o.serverMessageId??o.id}):o.continuationStreaming=!1),this.detach(),o}return null}ensureTextPart(t,n,o){let r=`${n}:${o}`,a=this.openTextParts.get(r);if(a)return a;let s={kind:n,id:`${o}#${this.partSeq++}`,textSig:ae(""),doneSig:ae(!1)};return this.openTextParts.set(r,s),ko(t,s),s}apply(t){let n=this.active;if(n)switch(t.type){case"start":{t.messageId&&(n.serverMessageId=t.messageId);let o=t.messageMetadata;o?.senderRole==="operator"?(n.role="operator",o.operatorInitials&&(n.operatorInitials=o.operatorInitials)):o?.senderRole==="visitor"&&(n.role="user");return}case"finish-step":this.openTextParts.clear();return;case"start-step":ko(n,{kind:"step-start",id:`ss-${this.partSeq++}`});return;case"finish":Ci.debug("finish",{reason:t.finishReason,canContinue:t.canContinue}),n.status="complete",n.retryAction=void 0,t.finishReason&&(n.finishReason=t.finishReason),this.bumpDone(n);return;case"error":Ci.warn("stream error chunk",{errorText:t.errorText}),n.status="error",n.errorText=t.errorText,this.bumpDone(n);return;case"abort":Ci.debug("stream abort chunk (canceled)"),n.status="complete",n.canceled=!0,n.retryAction=void 0,this.bumpDone(n);return;case"text-start":this.ensureTextPart(n,"text",t.id);return;case"text-delta":{let o=this.ensureTextPart(n,"text",t.id);o.textSig.value+=t.delta;return}case"text-end":this.ensureTextPart(n,"text",t.id).doneSig.value=!0;return;case"reasoning-start":this.ensureTextPart(n,"reasoning",t.id).doneSig.value=!1;return;case"reasoning-delta":{let o=this.ensureTextPart(n,"reasoning",t.id);o.textSig.value+=t.delta;return}case"reasoning-end":this.ensureTextPart(n,"reasoning",t.id).doneSig.value=!0;return;case"tool-input-start":case"tool-input-delta":case"tool-input-available":case"tool-input-error":case"tool-output-available":case"tool-output-error":case"tool-output-denied":case"tool-approval-request":Yg(n,t);return;case"file":ko(n,{kind:"file",url:t.url,mediaType:t.mediaType});return;case"source-url":fu(n,{kind:"source",sourceId:t.sourceId,url:t.url,title:t.title});return;case"source-document":fu(n,{kind:"source",sourceId:t.sourceId,title:t.title,filename:t.filename,mediaType:t.mediaType});return;case"data-suggestions":n.suggestions=lr(t.data);return;case"data-control-state":n.operatorRoutedTurn=t.data.controlMode!=="ai-agent";return;default:{let o=t}}}bumpDone(t){ht(()=>{t.partsSig.value=[...t.partsSig.value],this.messagesSig.value.includes(t)&&(this.messagesSig.value=[...this.messagesSig.value])})}},Ri={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function hn(e){return e.awaitingContinuation===!0||e.continuationStreaming===!0||e.retryAction?.kind==="continue-assistant"}function pu(e,t){e.canceled&&(t.canceled=!0),!(!hn(e)||t.status!=="streaming"&&!un(t))&&(t.awaitingContinuation??(t.awaitingContinuation=e.awaitingContinuation),t.continuationStreaming??(t.continuationStreaming=e.continuationStreaming),t.retryAction===void 0&&(t.retryAction=e.retryAction))}function qg(e,t){let n=e.partsSig.value,o=t.partsSig.value;return e.role!==t.role||o.length<n.length?!1:n.every((r,a)=>mu(r,o[a]))}function Vg(e,t){let n=e.partsSig.value,o=n.findLastIndex(l=>l.kind==="tool"),r=new Set(n.slice(0,o+1).flatMap(l=>l.kind==="tool"?[l.toolCallId]:[])),a=t.partsSig.value.filter(l=>l.kind!=="tool"||!r.has(l.toolCallId)),s=n.slice(o+1);return a.length<s.length?!1:s.every((l,c)=>mu(l,a[c]))}function mu(e,t){switch(e.kind){case"text":case"reasoning":return t?.kind===e.kind&&t.textSig.value.startsWith(e.textSig.value);case"step-start":return t?.kind==="step-start";case"tool":{if(t?.kind!=="tool"||t.toolCallId!==e.toolCallId||!fr(t.toolName,e.toolName)||Ri[t.stateSig.value]<Ri[e.stateSig.value])return!1;let n=e.approvalSig.value?.approved;return n===void 0||t.approvalSig.value?.approved===n}case"file":return t?.kind==="file"&&t.url===e.url&&t.mediaType===e.mediaType;case"source":return t?.kind==="source"&&t.sourceId===e.sourceId&&t.url===e.url&&t.title===e.title&&t.filename===e.filename&&t.mediaType===e.mediaType;default:return e}}function Wg(e,t,n){return Gg(e,n)||!Kg(e,t)?!0:n.type!=="finish"&&n.type!=="error"&&n.type!=="abort"?!1:uo(t)||e.awaitingContinuation===!0&&n.type!=="finish"?!0:e.awaitingContinuation===!0&&t.partsSig.value.every(o=>o.kind==="step-start")}function Gg(e,t){if(t.type!=="tool-output-available"&&t.type!=="tool-output-error"&&t.type!=="tool-output-denied")return!1;let n=e.partsSig.value.find(o=>o.kind==="tool"&&o.toolCallId===t.toolCallId);return n!==void 0&&Ri[n.stateSig.value]<4}function Kg(e,t){let n=t.partsSig.value;if(n.length===0)return!0;let o=e.partsSig.value;return o.some((r,a)=>n.every((s,l)=>jg(o[a+l],s)))}function jg(e,t){switch(t.kind){case"text":case"reasoning":return e?.kind===t.kind&&e.textSig.value.startsWith(t.textSig.value);case"step-start":return e?.kind==="step-start";case"tool":return e?.kind==="tool"&&e.toolCallId===t.toolCallId&&(t.toolName==="tool"||fr(e.toolName,t.toolName));case"file":return e?.kind==="file"&&e.url===t.url&&e.mediaType===t.mediaType;case"source":return e?.kind==="source"&&e.sourceId===t.sourceId&&e.url===t.url&&e.title===t.title&&e.filename===t.filename&&e.mediaType===t.mediaType;default:return t}}function Xg(e,t){if(hn(e)||!un(e))return!1;let n=new Set(e.partsSig.value.filter(r=>r.kind==="tool").map(r=>r.toolCallId));return!t.partsSig.value.some(r=>r.kind==="tool"&&n.has(r.toolCallId))}function Zt(e,t,n,o){let r=e.partsSig.value.find(s=>s.kind==="tool"&&s.toolCallId===t);if(r)return o&&(r.dynamic=!0),r;let a={kind:"tool",toolCallId:t,toolName:n??"tool",dynamic:o?!0:void 0,inputPartialSig:ae(""),inputSig:ae(void 0),outputSig:ae(void 0),errorSig:ae(void 0),stateSig:ae("input-streaming"),approvalSig:ae(void 0)};return ko(e,a),a}function ko(e,t){e.partsSig.value=[...e.partsSig.value,t]}function fu(e,t){e.partsSig.value.some(n=>n.kind==="source"&&n.sourceId===t.sourceId)||ko(e,t)}function Yg(e,t){switch(t.type){case"tool-input-start":Zt(e,t.toolCallId,t.toolName,t.dynamic);return;case"tool-input-delta":{let n=Zt(e,t.toolCallId);n.inputPartialSig.value+=t.inputTextDelta;return}case"tool-input-available":{let n=Zt(e,t.toolCallId,t.toolName,t.dynamic);n.inputSig.value=t.input,n.stateSig.value="input-available";return}case"tool-input-error":{let n=Zt(e,t.toolCallId,t.toolName,t.dynamic);n.inputSig.value=t.input,n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-approval-request":{let n=Zt(e,t.toolCallId,t.toolName);n.approvalSig.value={id:t.approvalId},n.stateSig.value="approval-requested";return}case"tool-output-available":{let n=Zt(e,t.toolCallId,void 0,t.dynamic);n.outputSig.value=t.output,n.stateSig.value="output-available";return}case"tool-output-error":{let n=Zt(e,t.toolCallId,void 0,t.dynamic);n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-output-denied":{let n=Zt(e,t.toolCallId);n.stateSig.value="output-denied";return}default:return}}async function gu(e){let t=1e3,n=!1,o=!1,r=!1,a=()=>{r||e.signal.aborted||(r=!0,e.onInitialBoundaryReady())};for(;!e.signal.aborted;){let s,l="held";try{l=await e.connect(()=>{if(e.signal.aborted)return;s=e.now();let c=n||o;n=!0,o=!1,r?c&&e.backfill():a()})}catch{}if(e.signal.aborted||(!n&&s===void 0&&(o=!0,a()),l==="unavailable"))return;s!==void 0&&e.now()-s>=1e3&&(t=1e3),await e.sleep(t),t=Math.min(t*2,15e3)}}var Jg=120;function vu(e){let{activated:t,conversationReady:n,conversationIdSig:o,messagesSig:r,optionsRef:a,transport:s,visitorId:l,adoptControlStateChunk:c,settleSuggestions:d,beginConversationReply:_,finishConversationReply:p,recordConversationReply:u,transcriptRecoverySig:f,beginConversationTranscript:m,commitConversationTranscript:b,failConversationTranscript:h,onReplyLanded:x,runCancellation:P,canContinueRef:v,setCanSend:y,feedback:k,bus:w,loadInitialThread:$,shouldReconcileOnConnect:ie}=e,z=M(0);O(()=>{if(!t||!n||!o.value)return;let T=o.value,D=new AbortController,G=R=>{},F=new Kr(r,R=>G(R));s.primeIdentity(l,T);let ee=!1,I=!1,U,V=!1,pe,te=0,ue=v.current,we,_t,et=Date.now(),Je=!1,Ue,Qe=!1,pt=!1,tt=()=>{Je||(Je=!0,_(T))},nt=(R=!0)=>{Je=!1,p(T,R)},ge=(R,ce,J)=>{if(!wt(R))return;let xe=r.value.findLast(Ne=>!Ne.ephemeral),he=R.serverMessageId??R.id;if(!(xe&&(xe.serverMessageId??xe.id)!==he))return ur(r.value,R,T,a.current.strings.newConversation,ce,J)},at=(R,ce,J,xe)=>{let he=ge(R,ce,xe);if(!he)return;let He=`${R.serverMessageId??R.id}:${J}:${he.preview??""}`;He!==_t&&(_t=He,s.publishConversation({...he,hasUnread:!0},!0))},Xe,ze=()=>{Xe&&(clearTimeout(Xe.timer),Xe=void 0)},xt=()=>{let R=Xe;if(!R)return;clearTimeout(R.timer),Xe=void 0;let ce=r.value.find(J=>(J.serverMessageId??J.id)===R.replyId);ce?.role!=="assistant"&&ce?.role!=="operator"||at(ce,R.canContinue,R.generation,R.activityAt)},q=(R,ce,J,xe)=>{ze(),Xe={replyId:R.serverMessageId??R.id,canContinue:ce,generation:J,activityAt:xe,timer:setTimeout(xt,Jg)}},W=(R,ce,J,xe=Date.now(),he=!0)=>{ze();let Ne=ge(R,ce,xe);if(!Ne){nt(!1);return}let qe=`${R.serverMessageId??R.id}:${J}`;if(qe===we){nt(!1);return}we=qe,Je=!1,u(Ne),he&&Ue&&(Qe=!0)},oe=(R,ce)=>{(R||!P.localSendRef.current)&&P.settle(ce),R&&x()},_e=(R,ce=[],J=!1,xe,he=ue,Ne=te,He=Date.now(),qe=!0)=>{let gt=a.current;if(R.canceled){W(R,he,Ne,He,qe),oe(J,xe);return}let Ee=!0,Ct=R.status==="error";switch(Gl(R,Ct)){case"drop":r.value=r.value.filter(it=>it!==R),Ee=!1;break;case"complete-operator-routed":R.status="complete",J&&(k.play("messageReceived"),zn(w,gt,"assistant",Fe(R)));break;case"error":{if(R.status="error",R.errorText=gt.strings.errorGeneric,J){k.play("error");let it=new Error(Ct?"stream error chunk":"empty reply");w.emit("error",it),gt.onError?.(it)}break}case"complete":R.status="complete",J&&(k.play("messageReceived"),zn(w,gt,"assistant",Fe(R))),d(R,ce);break}Ee?W(R,he,Ne,He,qe):nt(!1),oe(J,xe)},S=R=>{if(D.signal.aborted||o.value!==T)return;if(c(R),R.type==="start"){xt(),Je&&nt(!1);let it=R.messageId===void 0?void 0:r.value.find(ct=>ct.serverMessageId===R.messageId||ct.id===R.messageId);V=it!==void 0&&it.status!=="streaming";let bn=pe?.senderRole==="visitor"?pe.messageId:void 0;if(pe={messageId:R.messageId,senderRole:R.messageMetadata?.senderRole},te+=1,et=Date.now(),_t=void 0,ee=R.messageMetadata?.senderRole===void 0,I=!1,U=ee?R.messageMetadata?.runId:void 0,R.messageMetadata?.senderRole!=="visitor"&&!V&&tt(),ee){let ct=R.messageId!==void 0&&r.value.some(St=>St.serverMessageId===R.messageId||St.id===R.messageId),qt=r.value.at(-1),de=R.messageId!==void 0&&(qt?.serverMessageId===R.messageId||qt?.id===R.messageId),ot=P.localSendRef.current&&(!ct||de)&&qt?.role==="assistant"&&qt.status==="streaming"&&(de||qt.serverMessageId===void 0&&qt.partsSig.value.length===0);I=P.captureStart(T,R,ot,bn)}}let ce=ee&&(R.type==="finish"||R.type==="error"||R.type==="abort"),J=ce?U:void 0,xe=ce&&(I||P.ownsLocalRun(J)),he=te,Ne=V;R.type==="finish"&&R.canContinue!==void 0&&(ue=R.canContinue);let He=ue;ce&&(ee=!1,I=!1,U=void 0);let qe=F.applyResume(R),gt=pe?.messageId,Ee=gt===void 0?void 0:r.value.find(it=>it.serverMessageId===gt||it.id===gt);V&&pe?.senderRole!=="visitor"&&(qe!==null||Ee?.status==="streaming")&&(V=!1,Ne=!1,tt());let Ct=!V&&(Ee?.role==="assistant"||Ee?.role==="operator");if(R.type==="text-delta"&&Ct&&q(Ee,ue,te,et),R.type==="text-end"&&(ze(),Ct&&at(Ee,ue,te,et)),R.type==="finish"&&R.canContinue===!1&&y(!1),!qe){ce&&(xe||!P.localSendRef.current)&&P.settle(J);return}if(qe.role==="operator"){Ne||(k.play("messageReceived"),zn(w,a.current,"operator",Fe(qe))),W(qe,He,he,et),V=!1,ce&&(xe||!P.localSendRef.current)&&P.settle(J);return}qe.role==="assistant"&&(_e(qe,[],xe,J,He,he,et),V=!1)},X=async R=>{let ce=te,J=await s.loadConversation(T,R?{ids:[R]}:void 0).catch(()=>null);if(D.signal.aborted||o.value!==T||!J)return!1;J.controlState&&c({type:"data-control-state",data:J.controlState});let xe=r.value.at(-1),he=ce===te&&(R===void 0||xe!==void 0&&(xe.serverMessageId===R||xe.id===R));if(!J.messages?.length)return!0;he&&(ue=J.canContinue??ue,y(ue));let Ne=r.value,He=R===void 0?Ne.at(-1):Ne.find(ct=>ct.serverMessageId===R||ct.id===R),{messages:qe,changed:gt}=_o(Ne,jt(J.messages));if(!gt)return!0;r.value=qe;let Ee=R===void 0?qe.at(-1):qe.find(ct=>ct.serverMessageId===R||ct.id===R),Ct=He!==void 0&&Ee!==void 0&&(He.id===Ee.id||He.serverMessageId!==void 0&&He.serverMessageId===Ee.serverMessageId),it=Ee!==void 0&&Ee.status!=="streaming"&&(!Ct||He?.status==="streaming"),bn=Ct&&He?.status==="streaming"?Date.now():Ee?.createdAt;return he&&it&&Ee.role==="assistant"?_e(Ee,J.suggestions??[],P.localSendRef.current,void 0,J.canContinue??ue,ce,bn,!1):he&&it&&Ee.role==="operator"?W(Ee,J.canContinue??ue,ce,bn,!1):he&&Ee?.role==="assistant"&&Ee.status!=="streaming"&&d(Ee,J.suggestions??[]),!0},fe=new Set;G=({messageId:R})=>{if(fe.has(R)||!r.value.some(J=>J.serverMessageId===R||J.id===R))return;fe.add(R);let ce=()=>fe.delete(R);X(R).then(ce,ce)};let re=(R=!1)=>{if(D.signal.aborted||o.value!==T){Qe=!1;return}if(Ue){Qe=!0;return}let ce=R?$(T)??(ie()?X():void 0):X();if(!ce)return;m(T),Ue=ce;let J=(xe=!1)=>{if(Ue===ce){if(Ue=void 0,Qe){Qe=!1,re();return}xe?b(T):h(T)}};ce.then(J,()=>J(!1))},Pe=f.subscribe(R=>{R<=z.current||(z.current=R,pt&&re())});return gu({signal:D.signal,now:()=>performance.now(),sleep:R=>lo(R,D.signal),connect:R=>s.connectResumeStream({signal:D.signal,onChunk:S,onConnected:R}),onInitialBoundaryReady:()=>{pt=!0,re(!0)},backfill:()=>re()}),()=>{D.abort(),ze(),Pe(),F.detach(),p(T,!1)}},[t,n,o,o.value,l,s,c,d,_,p,u,f,m,b,h,x,P,v,y,r,w,k,$,ie])}var Qg=32;function hu(e){let{transport:t,setStreaming:n}=e,o=M(),r=M(),a=M(!1),s=M(),l=M(!1),c=M(new Map),d=M(new Set),_=L((k,w)=>{let $=`${k}:${w}`;s.current!==$&&(s.current=$,t.cancelTurn(k,w))},[t]),p=L(k=>{o.current=void 0,r.current=k,a.current=!1,s.current=void 0,l.current=!0,n(!0)},[n]),u=L((k,w)=>{c.current.set(k,{messageId:w})},[]),f=L(k=>{k!==void 0&&(d.current.add(k),d.current.size>Qg&&d.current.delete(d.current.values().next().value)),!(k!==void 0&&o.current?.runId!==k)&&(o.current=void 0,r.current=void 0,a.current=!1,l.current=!1,n(!1))},[n]),m=L((k,w)=>r.current!==k?w.runId&&o.current?.runId===w.runId?(o.current={conversationId:w.conversationId,runId:w.runId},a.current&&_(w.conversationId,w.runId),!0):!1:(r.current=void 0,w.runId?(o.current={conversationId:w.conversationId,runId:w.runId},n(!0),a.current&&_(w.conversationId,w.runId),!0):(f(),!0)),[_,n,f]),b=L((k,w)=>{let $=c.current.get(k);return $?(c.current.delete(k),!w.runId||d.current.has(w.runId)?!0:$.runId!==void 0?($.runId!==w.runId||o.current?.runId===w.runId&&(o.current={conversationId:w.conversationId,runId:w.runId},a.current&&_(w.conversationId,w.runId)),!0):(l.current||r.current||(o.current={conversationId:w.conversationId,runId:w.runId},r.current=void 0,a.current=!1,s.current=void 0,l.current=!0,n(!0)),!0)):!1},[_,n]),h=L(k=>r.current!==k?!1:(f(),!0),[f]),x=L(k=>{let w=c.current.get(k);return w?(c.current.delete(k),w.runId===void 0):!1},[]),P=L((k,w,$,ie)=>{let z=w.messageMetadata?.runId;if(w.messageMetadata?.senderRole!==void 0||typeof z!="string"||!z||d.current.has(z))return!1;if(o.current?.runId===z)return l.current;if(l.current)return o.current||!$?!1:(r.current=void 0,o.current={conversationId:k,runId:z},n(!0),a.current&&_(k,z),!0);let D=[...c.current.values()].filter(G=>G.runId===void 0).find(G=>G.messageId===ie);return D?(D.runId=z,o.current={conversationId:k,runId:z},r.current=void 0,a.current=!1,s.current=void 0,l.current=!0,n(!0),!0):(r.current=void 0,o.current={conversationId:k,runId:z},n(!0),a.current&&_(k,z),l.current)},[_,n]),v=L(k=>typeof k=="string"&&o.current?.runId===k&&l.current,[]),y=L(()=>{let k=o.current;if(k)return a.current=!0,_(k.conversationId,k.runId),!0;let w=r.current;return w?(a.current=!0,w.then($=>{$.runId&&_($.conversationId,$.runId)}).catch(()=>{}),!0):!1},[_]);return se(()=>({localSendRef:l,begin:p,beginRouted:u,acceptAck:m,acceptRoutedAck:b,reject:h,rejectRouted:x,captureStart:P,ownsLocalRun:v,settle:f,stop:y}),[m,b,p,u,P,v,h,x,f,y])}var Zg=Z.scope("send");function yu(e,t,n,o,r,a=!0){e.publishConversation({...ur(t,n,o,r,a),hasUnread:!1},!0)}function Pu(e,t){return e.id===t.id||(e.serverMessageId??e.id)===(t.serverMessageId??t.id)}function xu(e){return e.findLast(t=>!t.ephemeral&&t.role!=="system"&&(t.role==="user"||t.status!=="streaming"||wt(t)))}function wo(e,t,n,o,r){let a=xu(t);!a||a.role!=="user"||!Pu(a,n)||yu(e,t,a,o,r)}function bu(e){return!(e instanceof We)||e.code==="network"||e.status===void 0||e.status===202?!0:e.status===408||e.status===425||e.status===429||e.status>=500&&e.status<600}function Su(e){let{transport:t,messagesSig:n,conversationIdSig:o,options:r,bus:a,feedback:s,persistence:l,visitorId:c,adoptConversationId:d,applyControlState:_,setCanSend:p,settleSuggestions:u,runCancellation:f}=e,m=L(()=>{let x=o.value??ft();return o.value||(o.value=x,l.saveConversationId(x)),x},[o,l]),b=L(async({continueExisting:x,turn:P})=>{let v=m(),y=n.value.at(-1),k=P?[P]:Hl(n.value,x),w=k[0],$=Ua({messages:k.map(Ka),conversationId:v,visitorId:c,userPrefs:l.loadUserPrefs()}),ie=t.sendTurn($);f.begin(ie);try{let z=await ie;if(o.value!==v||!f.acceptAck(ie,z))return;if(d(z.conversationId),z.runId&&w?.role==="user"&&wo(t,n.value,w,z.conversationId,r.strings.newConversation),!z.runId){let T=await t.loadConversation(z.conversationId).catch(()=>null);if(o.value!==z.conversationId)return;if(T){T.controlState&&_(T.controlState),p(T.canContinue??!0);let D=jt(T.messages??[]),{messages:G,changed:F}=_o(n.value,D);F&&(n.value=G);let ee=D.findLast(V=>!V.ephemeral&&V.role!=="system"),I=xu(n.value);I&&ee&&Pu(I,ee)&&yu(t,n.value,I,z.conversationId,r.strings.newConversation,T.canContinue??!0);let U=y?n.value.find(V=>V.id===y.id&&V.role==="assistant"&&V.status!=="streaming"):void 0;U&&u(U,T.suggestions??[]),!x&&y?.role==="assistant"&&n.value.includes(y)&&y.serverMessageId===void 0&&!wt(y)&&(n.value=n.value.filter(V=>V!==y))}else y?.role==="assistant"&&n.value.includes(y)&&(y.status="error",y.errorText=r.strings.errorGeneric,x?y.retryAction={kind:"continue-assistant",messageId:y.serverMessageId??y.id}:y.retryAction=w?.role==="user"?{kind:"resend-user",messageId:w.id}:null,n.value=[...n.value])}}catch(z){if(o.value!==v)return;if(!f.reject(ie)){w?.role==="user"&&wo(t,n.value,w,v,r.strings.newConversation);return}let T=gn(z,r.strings),D=bu(z),G=P?.role==="assistant"?P:n.value.at(-1);if(x&&G?.role==="assistant"&&z instanceof We&&z.status===409){let F=G.serverMessageId??G.id,ee=await t.loadConversation(v,{ids:[F]}).catch(()=>null);if(o.value!==v)return;if(ee){ee.controlState&&_(ee.controlState),p(ee.canContinue??!0);let I=jt(ee.messages??[]),U=I.find(V=>(V.serverMessageId??V.id)===F);if(U&&Vl(G,U)){let{messages:V,changed:pe}=_o(n.value,I),te=V.find(ue=>(ue.serverMessageId??ue.id)===F);if(pe&&te&&te!==G){te.awaitingContinuation=!1,te.continuationStreaming=void 0,te.retryAction=null,n.value=V,te.status!=="streaming"&&u(te,ee.suggestions??[]);return}}}if(!n.value.includes(G)||G.status!=="streaming")return;G.continuationStreaming=!0}if(x&&G?.role==="assistant")G.status="error",G.errorText=T,G.retryAction=D?{kind:"continue-assistant",messageId:G.serverMessageId??G.id}:null,n.value=[...n.value];else if(y?.role==="assistant"&&n.value.includes(y)){y.status="error",y.errorText=T;let F=k[0];y.retryAction=D&&F?.role==="user"?{kind:"resend-user",messageId:F.id}:null,n.value=[...n.value]}else{let F=Ht();F.status="error",F.errorText=T;let ee=k[0];F.retryAction=D&&ee?.role==="user"?{kind:"resend-user",messageId:ee.id}:null,n.value=[...n.value,F]}s.play("error"),a.emit("error",z),r.onError?.(z)}},[t,n,r,a,s,l,c,d,_,p,u,m,f]),h=L(async x=>{let P=m();x.status="pending",x.errorText=void 0,x.retryAction=void 0,n.value.includes(x)&&(n.value=[...n.value]);let v=Ua({messages:[Ka(x)],conversationId:P,visitorId:c,userPrefs:l.loadUserPrefs()}),y=t.sendTurn(v);f.beginRouted(y,x.id);try{let k=await y;if(o.value!==P){f.rejectRouted(y);return}if(!f.acceptRoutedAck(y,k))return;d(k.conversationId),wo(t,n.value,x,k.conversationId,r.strings.newConversation),x.status==="pending"&&(x.status="complete",n.value.includes(x)&&(n.value=[...n.value]))}catch(k){let w=f.rejectRouted(y);if(o.value!==P)return;if(!w){wo(t,n.value,x,P,r.strings.newConversation),x.status==="pending"&&(x.status="complete",n.value.includes(x)&&(n.value=[...n.value]));return}if(x.status!=="pending"){wo(t,n.value,x,P,r.strings.newConversation);return}Zg.debug("operator-routed send failed",{error:k});let $=k instanceof Error?k:new Error(String(k));x.status="error",x.errorText=gn(k,r.strings),x.retryAction=bu(k)?{kind:"resend-user",messageId:x.id}:null,n.value.includes(x)&&(n.value=[...n.value]),s.play("error"),a.emit("error",$),r.onError?.($)}},[t,n,r,a,s,l,c,d,m,f]);return{sendAiTurn:b,sendRoutedTurn:h}}var ev=Z.scope("unread"),tv=300;function ku(e){let{transport:t,options:n,conversationIdSig:o,isConversationVisibleRef:r,activated:a,conversationReady:s}=e,l=bt(!1),c=bt(0),d=M([]),_=M(new Map),p=M(new Set),u=M(new Map),f=M(),m=M(),b=M(!1),h=M(!1);O(()=>()=>{for(let I of u.current.values())clearTimeout(I.timer);u.current.clear()},[]);let x=L(()=>{let I=o.value,U=r.current()&&(f.current===I||I!==void 0&&u.current.has(I))?I:void 0;l.value=d.current.some(V=>V.hasUnread&&V.conversationId!==U)},[o,l,r]),P=L(I=>{let U=u.current.get(I);clearTimeout(U?.timer),u.current.delete(I)},[]),v=L(I=>{let U=o.value,V=d.current.find(we=>we.conversationId===U),pe=Bt(d.current,I),te=pe.find(we=>we.conversationId===U),ue=I.type==="snapshot"&&U!==void 0&&te?.hasUnread===!0&&m.current!==U&&(f.current!==U||V===void 0||V.lastMessageAt!==te.lastMessageAt);ue&&(P(U),m.current=U,f.current=void 0),d.current=pe,x(),ue&&(c.value+=1)},[P,o,x,c]),y=L((I,U)=>{let V=U??null;U!==void 0&&_.current.get(I)===U||(_.current.set(I,V),t.markRead(I,U).then(pe=>{if(_.current.get(I)!==V||pe)return;_.current.delete(I);let te=d.current.find(ue=>ue.conversationId===I);!te||U&&te.lastMessageAt!==U||t.publishConversation({...te,hasUnread:!0})}))},[t]),k=L(I=>{let U=u.current.get(I);if(!U||U.timer)return;let V=()=>{U.timer=void 0,!(f.current!==I||!r.current()||o.value!==I||p.current.has(I))&&(u.current.delete(I),y(I,U.lastMessageAt))},pe=Math.max(0,U.notBefore-Date.now());pe===0?V():U.timer=setTimeout(V,pe)},[o,r,y]),w=L(()=>{if(x(),!r.current())return;let I=o.value;if(!I||f.current!==I||p.current.has(I))return;if(u.current.has(I)){k(I);return}let U=d.current.find(V=>V.conversationId===I);U?.hasUnread&&y(I,U.lastMessageAt)},[o,r,x,k,y]),$=L(I=>{o.value===I&&(m.current=I,f.current=void 0,x())},[o,x]),ie=L(I=>{o.value===I&&(m.current===I&&(m.current=void 0),f.current=I,w())},[o,w]),z=L(I=>{m.current===I&&(m.current=void 0,x())},[x]),T=L((I=!1)=>{if(!n.modules.list.some(V=>V.layout==="chat"))return;if(b.current){h.current||(h.current=I);return}let U=V=>{b.current=!0,t.listConversations({limit:50},V).then(pe=>{V||v({type:"snapshot",result:pe,requestedRevision:0}),w()}).catch(pe=>ev.debug("refreshUnread failed (non-fatal)",{err:pe})).finally(()=>{b.current=!1,h.current&&(h.current=!1,U(!0))})};U(I)},[v,w,n.modules,t]),D=L(I=>{p.current.add(I),P(I)},[P]),G=L((I,U=!0)=>{p.current.delete(I),U&&w()},[w]),F=L(I=>{let U=I.conversationId;p.current.delete(U),P(U),o.value===U&&m.current!==U&&(f.current=U),u.current.set(U,{lastMessageAt:I.lastMessageAt,notBefore:Date.now()+tv}),t.publishConversation({...I,hasUnread:!0},!0),r.current()&&o.value===U&&k(U)},[P,o,r,k,t]);O(()=>t.subscribeConversationChanges(v),[v,t]);let ee=M(!1);return O(()=>{!a||!s||ee.current||(ee.current=!0,T())},[a,s,T]),O(()=>{if(!a)return;let I=()=>{document.visibilityState==="visible"&&(w(),T(!0))};return document.addEventListener("visibilitychange",I),()=>document.removeEventListener("visibilitychange",I)},[a,w,T]),{hasUnreadSig:l,transcriptRecoverySig:c,refreshUnread:T,markVisibleConversationRead:w,beginConversationTranscript:$,commitConversationTranscript:ie,failConversationTranscript:z,beginConversationReply:D,finishConversationReply:G,recordConversationReply:F}}var Co=Z.scope("settings");function wu(e){let{options:t,persistence:n,transport:o,feedback:r,hostElement:a,bus:s}=e,l=n.loadUserPrefs(),[c,d]=B(()=>l.locale??t.locale),[_,p]=B(()=>l.themeMode??t.themeMode),[u,f]=B(()=>l.textSize??t.textSize),m=L(y=>{n.patchUserPrefs(y),o.saveUserPrefs(n.loadUserPrefs()).catch(k=>Co.warn("saveUserPrefs failed",{err:k}))},[n,o]);O(()=>{l.soundMuted!==void 0&&r.setMuted(l.soundMuted)},[]),O(()=>{a.dataset.theme=_},[a,_,t]),O(()=>{a.dataset.textSize=u},[a,u,t]),O(()=>{let y=!0;return r.mutedSig.subscribe(k=>{if(y){y=!1;return}m({soundMuted:k})})},[r,m]);let b=wn(c,t.availableLocales,t.defaultLocale);O(()=>{o.setLocale(b)},[o,b]),O(()=>{a.dir=ts(b)?"rtl":"ltr"},[a,b]),O(()=>{b!==c&&d(b)},[b,c]);let h=L(y=>{Co.info("localeChange",{locale:y}),d(y),m({locale:y}),s.emit("localeChange",y)},[m,s]),x=L(y=>{Co.info("themeChange",{mode:y}),p(y),a.dataset.theme=y,m({themeMode:y}),s.emit("themeChange",y)},[a,m,s]),P=L(y=>{Co.info("textSizeChange",{size:y}),f(y),a.dataset.textSize=y,m({textSize:y}),s.emit("textSizeChange",y)},[a,m,s]),v=L(()=>{r.toggleMuted();let y=r.mutedSig.value;Co.info("soundToggle",{muted:y}),s.emit("soundToggle",{muted:y})},[r,s]);return{activeLocale:c,activeThemeMode:_,activeTextSize:u,effectiveLocale:b,setActiveLocale:d,setActiveThemeMode:p,setActiveTextSize:f,patchAndSync:m,handleLocaleChange:h,handleThemeChange:x,handleTextSizeChange:P,handleSoundToggle:v}}var ke=Z.scope("app"),jr=C.cssPrefix;function Cu(e,t){return Fl({...e,text:rt(t,e.text)})}function Ru({options:e,hostElement:t,bus:n}){let[o]=B(()=>Gt(e.widgetId,e.storage,e.aiAgentDeploymentId)),[r,a]=B(()=>o.getVisitorId()),s=o.loadUserPrefs(),l=bt(o.loadConversationId()),c=M(l.value!==void 0),d=bt(l.value??""),_=bt([]),[p,u]=B(!1),f=M(),[m,b]=B([]);function h(){let g=e.modules.list,A=new Set(g.map(K=>K.id)),Y=o.loadActiveModule();return Y&&A.has(Y)?Y:g[0]?.id??""}function x(){return e.modules.list.find(g=>g.layout==="chat")?.id}function P(){let g=x();return g?e.modules.list.length===1?!0:y.sig.value.activeTab===g:!1}let v=M();if(!v.current){let g=e.modules.list.map(Y=>Y.id),A=o.loadActiveModule()??g[0]??"";v.current=Bd(A,A?[...g,A]:g,Y=>o.saveActiveModule(Y))}let y=v.current,k=mt(()=>y.sig.value.activeTab).value,w=mt(()=>l.value).value,[$,ie]=B(!1),[z,T]=B(null),[D,G]=B(!1),F=e.mode==="standalone"||e.mode==="inline",ee=M(so(e,Ln(),o.loadPanelOpen(),o.loadPanelSize())),[I,U]=B(ee.current.panelOpen),[V,pe]=B(ee.current.panelOpen),te=M(),ue=M(),we=M(!1),_t=M(void 0);O(()=>{I&&pe(!0)},[I]);let et=M(!1),[Je,Ue]=B(!1),{dismissed:Qe,dismissCallout:pt}=lu({callout:e.launcher.callout,persistence:o}),tt=e.launcher.callout?.persistent??!0,nt=L(()=>{ke.info("calloutDismiss"),n.emit("calloutDismiss",void 0),pt()},[n,pt]),[ge,at]=B(ee.current.panelSize),Xe=M(!1),[ze,xt]=B("chat"),q=M(()=>!1);q.current=()=>I&&ze==="chat"&&!document.hidden&&P();let[W,oe]=B(!0),_e=M(W);_e.current=W;let[S,X]=B(!1),fe=M(S);fe.current=S;let re=M(null),[Pe,R]=B(!1),[ce,J]=B(null),[xe,he]=B([]),Ne=M(e.strings),He=M(e);He.current=e;let[qe,gt]=B(void 0),[Ee,Ct]=B(void 0),[it,bn]=B(()=>o.loadSidebarCollapsed()??!1),[ct,qt]=B({}),[de]=B(()=>new dr({agentApiBaseUrl:e.agentApiBaseUrl,dataApiBaseUrl:e.dataApiBaseUrl,auth:wl({publicKey:e.publicKey,aiAgentDeploymentId:e.aiAgentDeploymentId,publicKeyHeader:"x-public-key"}),endpoints:e.endpoints})),[ot]=B(()=>new hr(e.sound,e.haptics)),St=hu({transport:de,setStreaming:X}),{activeLocale:Ro,activeThemeMode:$i,activeTextSize:Fi,effectiveLocale:yn,setActiveLocale:$u,setActiveThemeMode:Fu,setActiveTextSize:Bu,patchAndSync:Bi,handleLocaleChange:Hu,handleThemeChange:Uu,handleTextSizeChange:zu,handleSoundToggle:qu}=wu({options:e,persistence:o,transport:de,feedback:ot,hostElement:t,bus:n}),{controlModeSig:Mt,assignedOperatorInitialsSig:Vu,operatorAvailableSig:Wu,applyControlState:Pn,adoptControlStateChunk:Gu,requestOperator:Ku,cancelOperatorRequest:ju}=cu({transport:de,conversationIdSig:l}),{hasUnreadSig:Xu,transcriptRecoverySig:Yu,refreshUnread:Hi,markVisibleConversationRead:Ui,beginConversationTranscript:Zr,commitConversationTranscript:qn,failConversationTranscript:Ju,beginConversationReply:Qu,finishConversationReply:Zu,recordConversationReply:e_}=ku({transport:de,options:e,conversationIdSig:l,isConversationVisibleRef:q,activated:V,conversationReady:$});O(()=>{Ui()},[k,I,ze,w,Ui]),O(()=>{ot.update(e.sound,e.haptics)},[ot,e.sound,e.haptics]),O(()=>()=>ot.destroy(),[ot]),O(()=>{Xe.current||!e.size.initialSize||(Xe.current=!0,!o.loadPanelSize()&&at(Ha(e.mode,e.size,Ln())))},[e.mode,e.size,o]),O(()=>{if(!$||et.current)return;et.current=!0;let g=so(e,Ln(),o.loadPanelOpen(),o.loadPanelSize());U(g.panelOpen),at(g.panelSize)},[$,e,o]);let zi=M(null);O(()=>{$&&y.reconcile(e.modules.list.map(g=>g.id),h())},[$,e.modules.list,y]);let To=L(g=>{!g||g.length===0||(_.value=g.map(A=>Cu(A,Ne.current)))},[_]),ea=M(null),Io=L(async g=>{try{let{formSubmissions:A}=await(g?de.bootstrap(g):ea.current??de.bootstrap()),Y=new Map;return A.forEach((K,j)=>Y.set(K.formId,j)),A.filter((K,j)=>!K.skipped||Y.get(K.formId)===j).map((K,j)=>({key:`wire:${K.formId}:${K.createdAt??j}`,formId:K.formId,outcome:K.skipped?"skipped":"submitted",createdAt:sr(K.createdAt),values:K.values}))}catch(A){return ke.debug("bootstrap failed \u2014 no form markers (non-fatal)",{err:A}),[]}},[de]),Vn=M(0),Lt=M(0),ta=L((g,A)=>{if(g===l.value)return;let Y=l.value;Lt.current++,u(!1),Y&&(o.saveDraft(g,o.loadDraft(Y)),o.saveDraft(Y,"")),l.value=g,o.saveConversationId(g),de.primeIdentity(void 0,g),ke.info("conversation rebound",{previous:Y,current:g,reason:A}),Y&&n.emit("conversationRebound",{previous:Y,current:g,...A?{reason:A}:{}})},[n,l,o,de]),Eo=L((g,A)=>{let Y=[...g.map(N=>N.createdAt),...A.map(N=>N.createdAt)].filter(N=>N!==void 0),K=(Y.length?Math.min(...Y):Date.now())-1;return[...(_t.current?.messages??[]).map(N=>{let De=Cu(N,Ne.current);return De.createdAt=K,De}),...g]},[]),qi=L(async g=>{let A=Lt.current,Y=()=>A!==Lt.current||l.value!==g;ue.current===g&&(ue.current=void 0),u(!0);try{let[K,j]=await Promise.all([de.loadConversation(g),Io()]);if(Y())return!1;let N=jt(K.messages??[]);b(j);let De=Eo(Ya(N,_.value),j);if(_.value=De,ue.current=De.some(Ce=>Ce.role==="user")?void 0:g,N.length>0||K.controlState!==void 0){oe(K.canContinue??!0),Pn(Kt(K.controlState));let Ce=N.findLast(vt=>vt.role==="assistant"&&!vt.ephemeral);he(Ce?.suggestions??K.suggestions??[])}return!0}catch(K){return Y()||(ke.warn("loadThread failed; keeping conversation active",{err:K,conversationId:g}),n.emit("error",K),He.current.onError?.(K)),!1}finally{Y()||u(!1)}},[de,Io,_,l,Eo,n]),t_=L(g=>{if(te.current===g)return te.current=void 0,qi(g)},[qi]),n_=L(()=>{if(f.current)return Promise.resolve(void 0);let g=l.value,A=_.value.find(N=>!N.ephemeral),Y=A?.serverMessageId??A?.id;if(!g||!Y)return Promise.resolve(void 0);let K=Lt.current,j={};return f.current=j,(async()=>{try{let N=await de.loadConversation(g,{beforeId:Y});if(f.current!==j||Lt.current!==K||l.value!==g)return;if(N.messages.length===0)return!1;let De=N.messages.map(Ga),ve=_.value,Ce=zl(ve,De);if(Ce!==ve){let vt=Math.min(...De.map(Rt=>Rt.createdAt??1/0),...m.map(Rt=>Rt.createdAt??1/0));if(Number.isFinite(vt))for(let Rt of ve){if(!Rt.ephemeral)break;(Rt.createdAt??1/0)>=vt&&(Rt.createdAt=vt-1)}_.value=Ce}return!0}catch(N){if(f.current!==j||Lt.current!==K||l.value!==g)return;ke.warn("load previous messages failed",{err:N,conversationId:g,beforeId:Y}),n.emit("error",N),e.onError?.(N);return}finally{f.current===j&&(f.current=void 0)}})()},[n,l,m,_,e,de]),Wn=L(async({newConversation:g})=>{let A=++Vn.current,Y=()=>A!==Vn.current,K=l.value,j=g||!K?ft():K;j!==K&&(Lt.current++,u(!1),ht(()=>{l.value=j,d.value=j}),o.saveConversationId(j)),de.primeIdentity(r,j);let N;try{N=await de.handshake({visitorId:r,conversationId:j,userPrefs:o.loadUserPrefs(),locale:Ro})}catch(ve){if(Y())return;n.emit("error",ve),e.onError?.(ve),g||ie(!0);return}if(Y())return;if(N.visitorId&&N.visitorId!==r&&(ke.info("visitor rebound",{previous:r,current:N.visitorId,reason:N.rebind?.visitorId}),o.setVisitorId(N.visitorId),a(N.visitorId),n.emit("visitorRebound",{previous:r,current:N.visitorId,reason:N.rebind?.visitorId})),N.conversationId!==j&&ta(N.conversationId,N.rebind?.conversationId),N.agent&&J(N.agent),Pn(Kt(N.controlState)),e.mode==="page"&&(N.site&&Sl(N.site)?gt(N.site):N.site&&ke.warn("invalid site config, using fallback",{site:N.site}),N.blocks&&kl(N.blocks)?Ct(N.blocks):N.blocks&&ke.warn("invalid blocks config, using fallback",{blocks:N.blocks})),N.userPrefs&&!g&&(o.saveUserPrefs(N.userPrefs),N.userPrefs.locale&&$u(N.userPrefs.locale),N.userPrefs.soundMuted!==void 0&&ot.setMuted(N.userPrefs.soundMuted),N.userPrefs.themeMode&&Fu(N.userPrefs.themeMode),N.userPrefs.textSize&&Bu(N.userPrefs.textSize)),_t.current=N.welcome,g||n.emit("handshake",N),N.welcome?.suggestions){let ve=Ne.current;he(N.welcome.suggestions.map(Ce=>({...Ce,label:rt(ve,Ce.label),...Ce.text===void 0?{}:{text:rt(ve,Ce.text)}})))}let De=!g&&K&&N.conversationId===K;c.current=!!De,De?we.current||(te.current=N.conversationId):(ue.current=N.conversationId,To(N.welcome?.messages),qn(N.conversationId)),g||ie(!0)},[de,r,o,e,n,l,d,ot,To,Ro,ta,qn]),Gn=JSON.stringify(e.userContext??null),o_=JSON.stringify(e.pageContext??null),r_=JSON.stringify(ct);O(()=>{let g=Object.keys(ct).length?{...ct,...e.userContext}:e.userContext;de.setContext(g,nv(e.pageContext))},[de,Gn,o_,r_]);let Vi=L((g,A=[])=>he(g.suggestions??A),[]);O(()=>(de.primeIdentity(r,l.value),Wn({newConversation:!1}),()=>{Vn.current++,Lt.current++}),[]),O(()=>{!V||!$||we.current||(we.current=!0,ea.current=de.bootstrap(),(async()=>{try{let g=await ea.current;T(Qn((g??{forms:[]}).forms,yn))}catch(g){ke.debug("bootstrap failed \u2014 treating as no forms",{err:g})}finally{G(!0)}})(),te.current===l.value&&u(!0))},[V,$]);let Ao=M(null);O(()=>{if(!V||!$)return;if(Ao.current===null){Ao.current=yn;return}if(Ao.current===yn)return;Ao.current=yn;let g=!1;return de.bootstrap().then(A=>{g||T(Qn((A??{forms:[]}).forms,yn))}).catch(A=>ke.debug("forms re-localize failed \u2014 keeping current copy",{err:A})),()=>{g=!0}},[V,$,yn,de]);let Wi=M(Gn);O(()=>{!$||Wi.current===Gn||(Wi.current=Gn,Wn({newConversation:!1}))},[Gn,$,Wn]),_u({hostElement:t,mode:e.mode,panelSize:ge,isOpen:I,surfaceReady:$,setIsOpen:U});let{sendAiTurn:en,sendRoutedTurn:Kn}=Su({transport:de,messagesSig:_,conversationIdSig:l,options:e,bus:n,feedback:ot,persistence:o,visitorId:r,adoptConversationId:ta,applyControlState:Pn,setCanSend:oe,settleSuggestions:Vi,runCancellation:St}),{toolInteraction:a_}=su({streaming:S,controlModeSig:Mt,messagesSig:_,sendAiTurn:en,bus:n,humanInLoop:e.features.humanInLoop}),i_=L((g,A)=>{let Y=_.value.find(K=>K.serverMessageId===g);Y&&(Y.feedback=A),ke.info("messageFeedback",{messageId:g,value:A}),n.emit("messageFeedback",{messageId:g,value:A}),de.submitFeedback({messageId:g,value:A})},[n,_,de]),s_=()=>_.value.reduce((g,A)=>g+(A.role==="user"?1:0),0),xn=e.forms.list.length>0?e.forms:z??e.forms,Me=Od({forms:xn,persistence:o,userContext:()=>e.userContext,messageCount:s_,pageArea:()=>e.pageContext?.area?String(e.pageContext.area):void 0,conversationId:()=>l.value,onComplete:(g,A,Y,K)=>{ke.info("formSubmit",{formId:g.id,trigger:A,skipped:K}),n.emit("formSubmit",{formId:g.id,values:Y,skipped:K}),b(N=>{let ve=N.find(Ce=>Ce.formId===g.id&&Ce.outcome==="skipped")?.createdAt??Date.now();return[...N.filter(Ce=>!(Ce.formId===g.id&&Ce.outcome==="skipped")),{key:`local:${g.id}:${ve}`,formId:g.id,outcome:K?"skipped":"submitted",createdAt:ve,...K?{}:{values:Y}}]});let j=l.value??ft();l.value||(l.value=j,o.saveConversationId(j),de.primeIdentity(void 0,j)),!K&&g.mirrorToContext&&qt(N=>({...N,...Y})),de.submitForm({formId:g.id,conversationId:j,trigger:A,values:Y,skipped:K})}}),na=mt(()=>Me.activeForm.value),l_=L(()=>Me.fire("after-messages"),[Me]),c_=L(()=>c.current||_.value.some(g=>!g.ephemeral&&g.role==="user"),[_]);vu({activated:V,conversationReady:$,conversationIdSig:l,messagesSig:_,optionsRef:He,transport:de,visitorId:r,adoptControlStateChunk:Gu,settleSuggestions:Vi,beginConversationReply:Qu,finishConversationReply:Zu,recordConversationReply:e_,transcriptRecoverySig:Yu,beginConversationTranscript:Zr,commitConversationTranscript:qn,failConversationTranscript:Ju,onReplyLanded:l_,runCancellation:St,canContinueRef:_e,setCanSend:oe,feedback:ot,bus:n,loadInitialThread:t_,shouldReconcileOnConnect:c_}),O(()=>{Me.refresh()},[xn,Me]);let Gi=e.pageContext?.area?String(e.pageContext.area):void 0,d_=mt(()=>_.value.length);O(()=>{$&&D&&Me.fire("pre-chat")},[$,D,Me]),O(()=>{D&&!W&&Me.fire("conversation-closed")},[D,W,Me]),O(()=>{$&&D&&Gi&&Me.fire("page-area")},[$,D,Gi,Me]);let oa=se(()=>{let g=xn.list.flatMap(A=>A.triggers).filter(A=>A.kind==="idle").map(A=>Number(A.param));return g.length?Math.min(...g)*1e3:0},[xn]);O(()=>{if(!oa||!I)return;let g=setTimeout(()=>Me.fire("idle"),oa);return()=>clearTimeout(g)},[oa,I,Me,d_.value]);let Ki=L(async(g,A)=>{if(re.current)return!1;let Y=l.value,K=Mt.value!=="ai-agent";if(ke.info("send",{textLen:g.length,attachments:A.length,streaming:fe.current,routedToOperator:K}),fe.current&&!K)return!1;let j=new AbortController,N={conversationId:Y,controller:j};re.current=N,R(!0);try{ot.unlock();let De=await rv(de,A,j.signal,vt=>{j.signal.aborted||(ke.warn("upload failed",{err:vt}),n.emit("error",vt),e.onError?.(vt))});if(j.signal.aborted||l.value!==Y||!_e.current||Me.activeForm.value)return!1;let ve=Mt.value!=="ai-agent";if(fe.current&&!ve||!g&&De.length===0)return!1;n.emit("send",{text:g,attachmentCount:A.length}),xe.length>0&&he([]),ot.play("messageSent");let Ce=Wa(g,De);return zn(n,e,"user",g),ve?(_.value=[..._.value,Ce],Kn(Ce),!0):(_.value=[..._.value,Ce,Ht()],en({continueExisting:!1}),!0)}finally{re.current===N&&(re.current=null,R(!1))}},[de,n,e,xe.length,_,l,en,Kn,Mt]);O(()=>{let g=l.value;return()=>{let A=re.current;!A||A.conversationId!==g||(re.current=null,R(!1),A.controller.abort())}},[l.value]),O(()=>{W&&!na.value||re.current?.controller.abort()},[na.value,W]);let u_=L(()=>{if(!St.stop())return;ke.info("stop"),n.emit("stop",void 0);let g=_.value.at(-1);g&&g.role!=="user"&&g.status==="streaming"&&(g.canceled=!0,_.value=[..._.value])},[St,n,_]),__=L(g=>{if(S)return;let A=_.value,Y=mr(A,g);if(Y)switch(ke.info("retry",{kind:Y.kind,messageId:Y.messageId}),Y.kind){case"continue-assistant":{if(Mt.value!=="ai-agent"||g.role!=="assistant"||(g.serverMessageId??g.id)!==Y.messageId)return;g.status="streaming",g.errorText=void 0,g.retryAction=void 0,g.awaitingContinuation=!0,_.value=[...A],en({continueExisting:!0,turn:g});return}case"resend-user":{let K=A.find(N=>N.role==="user"&&N.id===Y.messageId);if(!K)return;if(K.status="complete",K.errorText=void 0,K.retryAction=void 0,Mt.value!=="ai-agent"){_.value=g.role==="assistant"?A.filter(N=>N!==g):[...A],Kn(K);return}let j=Ht();_.value=g.role==="assistant"?A.map(N=>N===g?j:N):[...A,j],en({continueExisting:!1,turn:K});return}case"repeat-user":{let K=A.find(ve=>ve.role==="user"&&ve.id===Y.messageId);if(!K)return;let j=Wa(Fe(K),K.attachments?.map(ve=>({...ve}))??[]),N=new Set(j.attachments?.flatMap(ve=>ve.url?[ve.url]:[])??[]),De=K.partsSig.value.flatMap(ve=>ve.kind==="file"&&!N.has(ve.url)?[{...ve}]:[]);if(De.length>0&&(j.partsSig.value=[...j.partsSig.value,...De]),Mt.value!=="ai-agent"){_.value=[...A,j],Kn(j);return}_.value=[...A,j,Ht()],en({continueExisting:!1,turn:j});return}default:return Y}},[S,_,Mt,en,Kn]),jn=L(()=>{if(Oc(e.mode,ge)==="exit-fullscreen"){ke.info("close \u2192 exit-fullscreen",{mode:e.mode}),at("normal"),n.emit("fullscreen",!1);return}ke.info("close \u2192 panel closed",{mode:e.mode}),Me.fire("panel-close"),U(!1),o.savePanelOpen(!1),n.emit("close",void 0),e.onClose?.()},[n,e,o,ge,Me]),ra=L(()=>{ke.info("open",{mode:e.mode}),ot.unlock(),Ue(!0),U(!0),o.savePanelOpen(!0),!Qe&&!tt&&nt(),setTimeout(()=>Ue(!1),ov),V&&Hi(),n.emit("open",void 0),e.onOpen?.()},[n,e,ot,o,Qe,tt,nt,V,Hi]),aa=L(()=>{let g=_.value.some(A=>A.role==="user");if(ue.current===l.value&&!g&&W&&l.value){ke.info("clear \u2192 reusing empty conversation",{conversationId:l.value}),_.value.length===0&&To(_t.current?.messages);return}ke.info("clear \u2192 new conversation",{wasStreaming:S}),n.emit("clear",void 0),St.settle(),c.current=!1,te.current=void 0,ue.current=void 0,ht(()=>{_.value=[],l.value=void 0,Pn({controlMode:"ai-agent",controlRevision:0})}),o.clearConversation(),oe(!0),b([]),he([]),Wn({newConversation:!0})},[S,_,l,o,Wn,n,W,To,St,Pn]),ia=L(()=>{aa(),xt("chat");let g=e.modules.list.find(A=>A.layout==="chat")?.id;g&&y.switchTab(g)},[aa,y,e]),sa=L(()=>{let g=ge==="expanded"?"normal":"expanded";ke.info("expand",{from:ge,expanded:g==="expanded"}),at(g),o.savePanelSize(g),n.emit("expand",g==="expanded")},[n,ge,o]),la=L(()=>{let g=ge==="fullscreen"?"normal":"fullscreen";ke.info("fullscreen",{from:ge,fullscreen:g==="fullscreen"}),at(g),o.savePanelSize(g),n.emit("fullscreen",g==="fullscreen")},[n,ge,o]),p_=L(()=>{xt(g=>{let A=g==="history"?"chat":"history";return ke.info("toggleHistory",{view:A}),n.emit("toggleHistory",{view:A}),A})},[n]),f_=L(()=>{bn(g=>{let A=!g;return ke.info("sidebarToggle",{collapsed:A}),o.saveSidebarCollapsed(A),n.emit("sidebarToggle",{collapsed:A}),A})},[o,n]),m_=L(g=>{ke.info("resize",g),Bi({widgetSize:g}),n.emit("resize",g)},[Bi,n]),g_=L(async g=>{let A=g.conversationId,Y=++Vn.current;Lt.current++,u(!1);let K=()=>Y!==Vn.current;ke.info("selectConversation",{conversationId:A,wasStreaming:S}),n.emit("selectConversation",{conversationId:A}),de.publishConversation(g);try{let[j,N]=await Promise.all([de.loadConversation(A),Io(A)]);if(K())return;St.settle(),c.current=!0,te.current=void 0;let De=jt(j.messages),ve=j.conversationId!==l.value,Ce=ve?De:Ya(De,_.value);ue.current=Ce.some(Lo=>Lo.role==="user")?void 0:j.conversationId,ht(()=>{_.value=Eo(Ce,N),ve&&(d.value=j.conversationId),l.value=j.conversationId}),b(N),o.saveConversationId(j.conversationId),de.primeIdentity(r,j.conversationId),j.agent&&J(j.agent),oe(j.canContinue),Pn(Kt(j.controlState));let vt=Ce.findLast(Lo=>Lo.role==="assistant"&&!Lo.ephemeral);he(vt?.suggestions??j.suggestions??[]),ve?Zr(j.conversationId):qn(j.conversationId),xt("chat");let Rt=x();Rt&&y.switchTab(Rt)}catch(j){if(K())return;n.emit("error",j),e.onError?.(j)}},[de,_,l,d,n,e,o,Io,Eo,S,r,St,Zr,qn,y]),Mo=M(null),ji=L(g=>{typeof g=="string"&&(D?Me.fire("manual",g):Mo.current=g)},[D,Me]);O(()=>{!D||!Mo.current||(Me.fire("manual",Mo.current),Mo.current=null)},[D,Me]);let Sn=M({handleOpen:ra,handleClose:jn,handleExpand:sa,handleFullscreen:la,openForm:ji});Sn.current={handleOpen:ra,handleClose:jn,handleExpand:sa,handleFullscreen:la,openForm:ji},kt(()=>zs(t,{open:()=>Sn.current.handleOpen(),close:()=>Sn.current.handleClose(),expand:()=>Sn.current.handleExpand(),fullscreen:()=>Sn.current.handleFullscreen(),openForm:g=>Sn.current.openForm(g)}),[t]);let Ze=se(()=>xa(e,Ro,$i,Fi),[e,Ro,$i,Fi]);Ne.current=Ze.strings;let v_=se(()=>m.map(g=>{let A=xn.list.find(Y=>Y.id===g.formId);return{...g,title:A?.title,form:A}}),[m,xn]),ca=g=>{g_(g)},Xi={options:Ze,transport:de,feedback:ot,bus:n,persistence:o,conversationId:l.value??"",composerKey:d.value,composerApiRef:zi,view:ze,canSend:W,isStreaming:S,sendPreparing:Pe,composerActive:Ze.mode==="page"||Ze.mode==="inline"||Ze.mode==="standalone"||I,controlMode:Mt.value,assignedOperatorInitials:Vu.value,operatorAvailable:Wu.value,operatorRequestEnabled:e.features.operatorRequest,onRequestOperator:Ku,onCancelOperatorRequest:ju,loadingMessages:p,onLoadPreviousMessages:n_,messagesSig:_,agent:ce,suggestions:xe,initialWidgetSize:s.widgetSize??null,onClose:jn,onClear:aa,onExpand:sa,onFullscreen:la,onSoundToggle:qu,onToggleHistory:p_,onSelectHistoryConversation:ca,onNewConversation:ia,onLocaleChange:Hu,onThemeChange:Uu,onTextSizeChange:zu,onWidgetSizeChange:m_,onSend:Ki,onStop:u_,onSuggestion:g=>{if(re.current)return;let A=g.text??g.label;ke.info("suggestion",{text:A,autoSend:e.autoSendSuggestions}),n.emit("suggestion",{text:A}),e.autoSendSuggestions?Ki(A,[]):zi.current?.fill(A)},activeForm:na.value?.form??null,formMarkers:v_,onFormSubmit:Me.complete,onFormSkip:Me.skip,onFormFill:g=>Me.fire("manual",g),tool:a_,onRetry:__,onMessageFeedback:i_};if(!$)return null;let Xn=Ze.modules.list,da=g=>{let A=vo("close",Ze.mode,g);return Xn.length===0?i(iu,{strings:Ze.strings,onClose:A?jn:void 0}):Xn.length===1&&Xn[0]?.layout==="chat"?i(Ld,{...Xi,panelSize:g}):i(au,{panelProps:{...Xi,panelSize:g,onClose:A?jn:void 0},enabledModules:Xn,nav:y,bus:n,hasUnread:Xu.value,onSelectConversation:ca,onStartNewConversation:ia,onSetPanelSize:at})};if(e.mode==="page"){let g=Xn.some(A=>A.layout==="chat");return i("div",{class:`${jr}-anchor`,children:i($d,{site:qe,blocks:Ee,transport:de,strings:Ze.strings,locale:Ze.locale,persistence:o,showConversations:g,onSelectConversation:ca,onNewConversation:ia,sidebarCollapsed:it,onToggleSidebarCollapsed:f_,children:da("fullscreen")})})}if(F){let g=e.mode==="standalone"?"fullscreen":ge;return i("div",{class:`${jr}-anchor`,children:da(g)})}let Yi=e.mode==="drawer",Ji=!(e.mode==="modal")&&!e.launcher.hidden&&(!I||Je),Qi=Ji&&!Je&&!Qe&&!Yi?Ze.launcher.callout:null;return i("div",{class:`${jr}-anchor`,"data-launcher-size":Ze.launcher.size,children:[I||V?i("div",{class:`${jr}-surface`,hidden:!I,children:da(ge)}):null,Ji?i(Ac,{onToggle:ra,launcher:Ze.launcher,strings:Ze.strings,leaving:Je,edgeTab:Yi}):null,Qi?i(Mc,{callout:Qi,launcherPosition:Ze.position,strings:Ze.strings,closeLabel:Ze.strings.close,onDismiss:nt}):null]})}function nv(e){let t=e?.url??(typeof location<"u"?location.href:void 0);if(!(!e&&!t))return{...e,...t?{url:t}:{}}}var ov=120;async function rv(e,t,n,o){return(await Promise.all(t.map(async a=>{try{let{id:s,url:l}=await e.uploadFile(a.file,n);return{id:s,name:a.name,mediaType:a.mediaType,size:a.size,url:l}}catch(s){o(s);return}}))).filter(a=>a!==void 0)}var av=Z.scope("error-boundary"),Xr=class extends st{constructor(){super(...arguments);le(this,"state",{crashed:!1})}componentDidCatch(n,o){av.error("widget render crashed",{error:n,componentStack:o?.componentStack}),this.setState({crashed:!0}),this.props.onError(n,o?.componentStack)}render(){return this.state.crashed?this.props.fallback:this.props.children}};var iv="1",sv=60,lv=2e3,Tu={open:()=>{},close:()=>{},expand:e=>({on:e}),fullscreen:e=>({on:e}),send:e=>({attachments:e.attachmentCount}),message:e=>({role:e.role}),stop:()=>{},clear:()=>{},suggestion:()=>{},toggleHistory:e=>({view:e.view}),handshake:()=>{},formSubmit:e=>({formId:e.formId,skipped:e.skipped}),toolResult:()=>{},toolDecision:e=>({approved:e.approved}),messageFeedback:e=>({value:e.value??"none"}),contentView:e=>({section:e.section,tags:e.tags,count:e.count}),contentOpen:e=>({contentId:e.contentId,tags:e.tags}),contentSearch:e=>({qlen:e.queryLength,hits:e.hitCount}),contentRead:e=>({contentId:e.contentId}),contentLinkClick:e=>({contentId:e.contentId}),attach:e=>({count:e.count,bytes:e.totalBytes}),voiceStart:()=>{},voiceStop:e=>({ms:e.durationMs}),voiceCancel:()=>{},localeChange:e=>({locale:e}),themeChange:e=>({theme:e}),textSizeChange:e=>({size:e}),soundToggle:e=>({muted:e.muted}),sidebarToggle:e=>({collapsed:e.collapsed}),calloutDismiss:()=>{},error:()=>{}};function cv(){let e=navigator;return e.globalPrivacyControl===!0||e.doNotTrack==="1"}function dv(){return location.origin+location.pathname}function uv(){try{return document.referrer?new URL(document.referrer).origin:""}catch{return""}}function Iu(e,t){let n=Math.random(),o=0,r=0,a=new Set,s=(c,d)=>{let{tracking:_,publicKey:p,aiAgentDeploymentId:u,mode:f,themeMode:m}=t.getOptions();if(!_.enabled||cv()||n>=_.sampleRate)return;let b=performance.now();if(b-o>6e4&&(o=b,r=0),++r>sv)return;let h=new URLSearchParams;h.set("v",iv),h.set("_ev",Rn),h.set("e",c),_.token&&h.set("tk",_.token),p&&h.set("pk",p),u&&h.set("dep",u),h.set("vid",t.getVisitorId());let x=t.getConversationId();x&&h.set("cid",x),h.set("url",dv());let P=uv();P&&h.set("ref",P),h.set("sw",String(screen.width)),h.set("sh",String(screen.height)),h.set("vw",String(innerWidth)),h.set("vh",String(innerHeight)),h.set("dpr",String(devicePixelRatio)),h.set("lang",navigator.language);try{h.set("tz",Intl.DateTimeFormat().resolvedOptions().timeZone)}catch{}if(h.set("m",f),h.set("th",m),d)for(let[w,$]of Object.entries(d))$!==void 0&&h.set(w,String($));h.set("ts",String(Date.now()));let v=`${_.endpoint}?${h}`;if(v.length>lv)return;let y=new Image(1,1);a.add(y);let k=()=>a.delete(y);y.addEventListener("load",k,{once:!0}),y.addEventListener("error",k,{once:!0}),y.src=v},l=Object.keys(Tu).map(c=>e.on(c,d=>s(c,Tu[c]?.(d))));return()=>{for(let c of l)c();a.clear()}}function Yr(e){let{bus:t,host:n,appRoot:o,persistence:r,reportError:a}=e,s=e.initialRaw,l,c=Vt(s),d=!0,_=()=>{c=Vt(l?Sa(s,l):s)},p=()=>{Js(n,an(c.mode));let m=r.loadUserPrefs().themeMode;Qs(n,m?{...c,themeMode:m}:c),d&&(Xo(n,Ti(c)),d=!1)},u=()=>{p(),on(Dt(Xr,{onError:a},Dt(Ru,{bus:t,hostElement:n,options:c})),o)};t.on("handshake",m=>{m.config&&(m.config.storageVersion&&r.rememberStorageVersion(m.config.storageVersion),l=m.config,_(),u())});let f=Iu(t,{getOptions:()=>c,getVisitorId:()=>r.getVisitorId(),getConversationId:()=>r.loadConversationId()});return{getOptions:()=>c,getUserOptions:()=>s,render:u,setUserOptions:m=>{s=m,_(),u()},patchUserOptions:m=>{s={...s,...m},_(),u()},destroy:()=>f()}}function Ti(e){if(e.mode==="standalone")return"standalone";if(e.mode==="inline")return"inline";let t=Gt(e.widgetId,e.storage,e.aiAgentDeploymentId),{panelOpen:n,panelSize:o}=so(e,Ln(),t.loadPanelOpen(),t.loadPanelSize());return ir(e.mode,o,n)}var _v=Z.scope("hooks"),Ei="*",Ii=new Set;function Ai(e,t,n){let o={widgetId:e,event:t,listener:n};return Ii.add(o),()=>{Ii.delete(o)}}function pv(e,t,n){let o=[...Ii];for(let r of o)if(fv(r.widgetId,e.widgetId)&&!(r.event!==Ei&&r.event!==t))try{r.listener(e,t,n)}catch(a){_v.warn("hook listener threw",{event:t,error:a})}}function Eu(e,t){let n=[];for(let o of mv)n.push(t.on(o,r=>{pv(e,o,r)}));return()=>{for(let o of n)o()}}function Mi(e){if(Array.isArray(e))for(let t of e){let n=gv(t);n&&Ai(n.widgetId,n.event,n.listener)}}function fv(e,t){return e===Ei||e===t}var mv=["open","close","expand","fullscreen","resize","message","send","stop","clear","selectConversation","suggestion","toggleHistory","formSubmit","toolResult","toolDecision","messageFeedback","contentView","contentOpen","contentSearch","contentRead","contentLinkClick","attach","removeAttachment","voiceStart","voiceStop","voiceCancel","localeChange","themeChange","textSizeChange","soundToggle","sidebarToggle","calloutDismiss","error","handshake","visitorRebound","conversationRebound"];function gv(e){let t,n,o;if(Array.isArray(e))[t,n,o]=e;else if(e&&typeof e=="object")({widgetId:t,event:n,listener:o}=e);else return null;return typeof t!="string"||typeof n!="string"||typeof o!="function"?null:{widgetId:t,event:n,listener:o}}var zt=new Map;function Jr(e){e.debug!==void 0&&Fo(e.debug);let t=Z.scope("mount");t.info("mount",{widgetId:e.widgetId,publicKey:e.publicKey,mode:e.presentation?.mode});let n=Vt(e),o=n.widgetId,r=zt.get(o);r&&(t.debug("destroy existing instance at slot",{widgetId:o}),r.destroy());let a=Ti(n),s=n.iframe?tl({position:an(n.mode)},n.position,a,n.mode,e.target??null):Tn({position:an(n.mode),target:e.target??null});s.hostElement.dataset.widgetId=o;let l=new In,c=Gt(o,n.storage,n.aiAgentDeploymentId),d=b=>{l.emit("error",b),_.getOptions().onError?.(b)},_=Yr({bus:l,host:s.hostElement,appRoot:s.appRoot,persistence:c,initialRaw:e,reportError:d});_.render();let p=s.hostElement,u=null,f=b=>{b.debug!==void 0&&Fo(b.debug),_.patchUserOptions(b)},m={widgetId:o,open:()=>no(p,"open"),close:()=>no(p,"close"),expand:()=>no(p,"expand"),openForm:b=>no(p,"openForm",b),on:(b,h)=>l.on(b,h),update:b=>{t.debug("update",{patch:b}),f(b)},setUserContext:b=>{t.debug("setUserContext",{keys:Object.keys(b)}),f({userContext:{..._.getUserOptions().userContext,...b}})},clearUserContext:()=>{t.debug("clearUserContext"),f({userContext:void 0})},setPageContext:b=>{t.debug("setPageContext",{keys:Object.keys(b)}),f({pageContext:{..._.getUserOptions().pageContext,...b}})},clearPageContext:()=>{t.debug("clearPageContext"),f({pageContext:void 0})},setDebug:b=>{Fo(b),t.info("debug level set",{level:Yn()})},debugLevel:()=>Yn(),onLog:b=>Jn(b),destroy:()=>{t.info("destroy",{widgetId:o}),u?.(),_.destroy(),l.clear(),on(null,s.appRoot),s.destroy(),zt.get(o)===m&&zt.delete(o)}};return u=Eu(m,l),zt.set(o,m),m}function Qr(e){let t=e.widgetId??"default",n=zt.get(t);return n?(n.update(e),n):Jr(e)}function Li(e){if(e!==void 0){zt.get(e)?.destroy();return}let t=[...zt.values()];for(let n of t)n.destroy()}function At(e="default"){return zt.get(e)??null}function Au(){return[...zt.values()]}function Oi(e,t,n){return Ai(e,t,n)}var Mu=Rn;var Ni=class extends HTMLElement{constructor(){super(...arguments);le(this,"bus",new In);le(this,"mountResult",null);le(this,"runtime",null)}static get observedAttributes(){return ka}connectedCallback(){this.boot()}disconnectedCallback(){this.mountResult&&(this.runtime?.destroy(),this.runtime=null,on(null,this.mountResult.appRoot),this.bus.clear())}attributeChangedCallback(){this.isConnected&&this.boot()}boot(){let n=Uo(a=>this.getAttribute(a));if(this.runtime){this.runtime.setUserOptions(n);return}let o=Vt(n);this.mountResult||(this.mountResult=Tn({existingHost:this,position:an(o.mode)}));let r=Gt(o.widgetId,o.storage,o.aiAgentDeploymentId);this.runtime=Yr({bus:this.bus,host:this.mountResult.hostElement,appRoot:this.mountResult.appRoot,persistence:r,initialRaw:n,reportError:a=>this.bus.emit("error",a)}),this.runtime.render()}},Lu=!1;function Di(){if(Lu||typeof customElements>"u")return;let e=C.tagName;customElements.get(e)||customElements.define(e,Ni),Lu=!0}typeof customElements<"u"&&Di();var Ou=Z.scope("iife"),Nu={close:()=>At()?.close(),destroy:()=>Li(),expand:()=>At()?.expand(),hook:(e,t,n)=>typeof e=="string"&&typeof t=="string"&&typeof n=="function"?Oi(e,t,n):void 0,init:e=>Qr(e),mount:e=>Jr(e),on:(e,t)=>At()?.on(e,t),onLog:e=>Jn(e),open:()=>At()?.open(),setDebug:e=>At()?.setDebug(e),update:e=>At()?.update(e)};function Du(e,...t){let n=Nu[e];if(!n){Ou.warn("unknown command",{command:e});return}return n(...t)}function vv(){let e=((t,...n)=>Du(t,...n));e.init=Qr,e.mount=Jr,e.destroy=Li,e.getInstance=At,e.getAllInstances=Au,e.version=Mu,e.hook=Oi,e.debugLevel=()=>Yn(),e.onLog=Jn;for(let t of["close","expand","on","open","setDebug","update"])Reflect.set(e,t,Nu[t]);return e}function hv(e){let t=e?.q;if(t)for(let n of t){let o=[...n],[r,...a]=o;if(typeof r=="string")try{Du(r,...a)}catch(s){Ou.warn("queued command failed",{command:r,error:s})}}}function bv(){let e=[],t=e.push.bind(e);return e.push=(...n)=>(Mi(n),t(...n)),e}function yv(){let e=document.scripts;for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.src.includes("elements"))return n}return null}function Pv(){if(typeof window>"u"||typeof document>"u")return;let e=globalThis[C.global],t=vv();globalThis[C.global]=t,Di();let n=`${C.global}Hooks`,o=globalThis[n];if(Mi(o),globalThis[n]=bv(),hv(e),At())return;let r=document.currentScript??yv(),a=wa(r?.dataset);if(!a.publicKey)return;let s=()=>{At()||Qr(a)};if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",s,{once:!0});return}s()}Pv();return S_(xv);})();
|
|
41
|
+
`).trim(),V=!b&&t!=="error"&&!g.value&&H.length>0,te=F||V;return i("div",{class:`${ze}-bubble-row`,"data-role":e.role,"data-testid":Ue(T.messageBubble,e.serverMessageId??e.id),children:i("div",{class:`${ze}-bubble-col`,children:[i("div",{class:`${ze}-bubble`,children:[e.role==="operator"&&e.operatorInitials?i("span",{class:`${ze}-bubble-author`,children:e.operatorInitials}):null,i("div",{class:`${ze}-bubble-body`,children:[w?i(sg,{label:n.loading}):m.map((W,le)=>i(ng,{part:W,active:D,live:x,strings:n,showReasoning:r,showToolCalls:a,showSources:s,interactive:l&&t==="complete"&&(W.kind!=="tool"||lr(e,le)),superseded:c,continuationStreaming:e.continuationStreaming===!0,tool:d},`${ag(W)}#${le}`)),q&&i(ig,{}),t==="error"||g.value?i("div",{class:`${ze}-error`,role:"alert",children:[i("span",{children:e.errorText??n.errorGeneric}),p?i("button",{type:"button",class:`${ze}-error-retry`,onClick:()=>p(e),"data-testid":T.messageRetry,children:n.errorRetry}):null]}):null]})]}),B||te?i("div",{class:`${ze}-bubble-meta`,children:[B?i("time",{class:`${ze}-bubble-time`,dateTime:B.iso,title:B.full,children:B.short}):null,te?i("div",{class:`${ze}-bubble-actions`,children:[F&&e.serverMessageId?i(vd,{messageId:e.serverMessageId,initial:e.feedback??null,strings:n,onFeedback:u}):null,V?i(eg,{text:H,strings:n}):null]}):null]}):null]})})}function eg({text:e,strings:t}){let[n,o]=$(!1),r=()=>{navigator.clipboard?.writeText(e).then(()=>{o(!0),setTimeout(()=>o(!1),1500)}).catch(()=>{})},a=n?t.copied:t.copy;return i("button",{type:"button",class:`${ze}-msg-action`,"data-active":n?"true":void 0,"aria-label":a,title:a,onClick:r,"data-testid":T.messageCopy,children:n?i(sn,{}):i(wc,{})})}function tg(e){if(typeof e!="number"||!Number.isFinite(e))return null;try{let t=new Date(e);return{short:t.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}),full:t.toLocaleString(void 0,{dateStyle:"full",timeStyle:"short"}),iso:t.toISOString()}}catch{return null}}function ng({part:e,active:t,live:n,strings:o,showReasoning:r,showToolCalls:a,showSources:s,interactive:l,superseded:c,continuationStreaming:d,tool:p}){switch(e.kind){case"step-start":return null;case"text":return i(Lr,{textSig:e.textSig,doneSig:e.doneSig});case"reasoning":return r?i(rg,{part:e,active:t,strings:o}):null;case"tool":return i(og,{part:e,strings:o,showToolCalls:a,interactive:l,superseded:c,continuationStreaming:d,live:n,tool:p});case"file":return e.mediaType.startsWith("image/")?i("img",{src:e.url,alt:"",loading:"lazy"}):i("a",{href:e.url,target:"_blank",rel:"noreferrer noopener",children:e.url});case"source":return s?i(hd,{part:e,strings:o}):null}}function og({part:e,strings:t,showToolCalls:n,interactive:o,superseded:r,continuationStreaming:a,live:s,tool:l}){let c=ie(()=>fe(()=>e.approvalSig.value!==void 0),[e]);return l?.humanInLoop&&c.value?Tr(e.toolName)?i(xd,{part:e,strings:t,active:o,superseded:r,continuationStreaming:a,onDecision:l.onDecision,onEdit:l.onEdit}):i(bd,{part:e,strings:t,active:o,superseded:r,continuationStreaming:a,onDecision:l.onDecision,onEdit:l.onEdit}):n?i(kd,{part:e,strings:t,live:s}):null}function rg({part:e,active:t,strings:n}){return i("details",{class:`${ze}-reasoning`,"data-testid":T.reasoning,open:t,"data-active":t?"true":void 0,children:[i("summary",{class:`${ze}-reasoning-summary`,children:i("span",{class:`${ze}-reasoning-label`,children:t?n.thinking:n.thoughts})}),i("div",{class:`${ze}-reasoning-body`,children:i(Lr,{textSig:e.textSig,doneSig:e.doneSig})})]})}function ag(e){switch(e.kind){case"text":case"reasoning":case"step-start":return`${e.kind}:${e.id}`;case"tool":return`tool:${e.toolCallId}`;case"file":return`file:${e.url}`;case"source":return`source:${e.sourceId}`}}function ig(){return i("span",{class:`${ze}-typing`,"data-testid":T.typingDots,"aria-hidden":"true",children:[i("span",{}),i("span",{}),i("span",{})]})}function sg({label:e}){return i("span",{class:`${ze}-loading`,role:"status",children:[i("span",{class:`${ze}-loading-spinner`,"aria-hidden":"true"}),i("span",{class:`${ze}-loading-label`,children:e})]})}var Wt=R.cssPrefix,hi=120,lg=350;function Cd({messagesSig:e,strings:t,responseMode:n,showReasoning:o,showToolCalls:r,showSources:a,enableMessageFeedback:s,onFeedback:l,loading:c,onLoadPreviousMessages:d,idle:p,controlMode:_="ai-agent",tool:u,onRetry:f,form:m,formMarkers:g,onFillForm:y}){let k=O(null),S=ut(()=>e.value),[b,x]=$(!1),[P,w]=$(!1),D=O(!1),q=O(!1),[B,M]=$(),F=O(!1),H=O(!1),V=O(!1),te=O(0),W=()=>V.current||performance.now()-te.current<lg,le=O(0),ae=v=>{let E=v.scrollHeight-v.clientHeight>1;v.dataset.fadeTop=E&&v.scrollTop>1?"true":"false",v.dataset.fadeBottom=E&&v.scrollHeight-v.scrollTop-v.clientHeight>1?"true":"false"},xe=v=>x(v.scrollHeight-v.scrollTop-v.clientHeight>hi*2),ue=v=>{le.current=performance.now(),v.scrollTop=v.scrollHeight,ae(v)},ye=(v,E)=>{ue(v);let Q=E,j=0,Z=()=>{H.current||W()||(ue(v),--Q>0&&(j=requestAnimationFrame(Z)))};return E>0&&(j=requestAnimationFrame(Z)),()=>cancelAnimationFrame(j)},pe=(v,E)=>{let Q,j,Z,Se=-1,ge=()=>{Q.disconnect(),j.disconnect(),clearTimeout(Z)},ke=()=>{if(H.current||W()||Se>=0&&v.scrollTop<Se-4)return ge();ue(v),Se=v.scrollTop};return Q=new ResizeObserver(ke),j=new MutationObserver(ke),ke(),Q.observe(v),j.observe(v,{childList:!0,subtree:!0,characterData:!0}),Z=setTimeout(ge,E),ge},Ze=S.value[0]?.id;ht(()=>{let v=k.current;if(v&&S.value.length!==0&&!q.current&&(F.current=!0,!!S.value.some(E=>E.role==="user")))return pe(v,300)},[Ze]);let ot=O(0);L(()=>{let v=k.current,E=S.value,Q=ot.current;if(ot.current=E.length,!v||!F.current||q.current)return;if(E.slice(Q).some(Z=>Z.role==="user"))return H.current=!1,ye(v,3);if(!E.some(Z=>Z.role==="user")||H.current||W())return;v.scrollHeight-v.scrollTop-v.clientHeight<hi&&ue(v)},[S.value.length]);let ct=O(null);L(()=>{let v=k.current,E=S.value.at(-1),Q=ct.current;if(ct.current=E?{id:E.id,streaming:E.status==="streaming"}:null,!!v&&F.current&&!(!E||E.id!==Q?.id||Q.streaming||E.status!=="streaming"))return H.current=!1,ye(v,3)},[S.value]),L(()=>{let v=k.current;if(!v)return;let E=S.value.at(-1);if(!E||E.status!=="streaming"&&!S.value.some(Z=>Z.role==="user"))return;let Q=()=>{if(H.current||W())return;v.scrollHeight-v.scrollTop-v.clientHeight<hi*2&&ue(v)};if(E.status!=="streaming")return pe(v,300);Q();let j=new MutationObserver(Q);return j.observe(v,{childList:!0,subtree:!0,characterData:!0}),()=>j.disconnect()},[S.value]);let Ge=m?.form.id,je=!!m&&(g??[]).some(v=>v.formId===m.form.id);ht(()=>{let v=k.current;!v||!Ge||H.current||S.value.some(E=>E.role==="user")&&(je?v.querySelector(`[data-testid="${T.formGate}"]`)?.scrollIntoView({block:"nearest"}):ue(v))},[Ge,je]),L(()=>{let v=k.current;if(!v)return;let E=()=>{xe(v),ae(v),performance.now()-le.current>150&&(H.current=v.scrollHeight-v.scrollTop-v.clientHeight>8)},Q=()=>{H.current=!0},j=We=>{We.deltaY<0&&Q()},Z=0,Se=We=>{Z=We.touches[0]?.clientY??0,V.current=!0},ge=We=>{(We.touches[0]?.clientY??0)>Z+4&&Q()},ke=()=>{V.current=!1,te.current=performance.now()},be=()=>{V.current=!0};return v.addEventListener("scroll",E,{passive:!0}),v.addEventListener("wheel",j,{passive:!0}),v.addEventListener("touchstart",Se,{passive:!0}),v.addEventListener("touchmove",ge,{passive:!0}),v.addEventListener("touchend",ke,{passive:!0}),v.addEventListener("touchcancel",ke,{passive:!0}),v.addEventListener("pointerdown",be,{passive:!0}),window.addEventListener("pointerup",ke,{passive:!0}),window.addEventListener("pointercancel",ke,{passive:!0}),xe(v),()=>{v.removeEventListener("scroll",E),v.removeEventListener("wheel",j),v.removeEventListener("touchstart",Se),v.removeEventListener("touchmove",ge),v.removeEventListener("touchend",ke),v.removeEventListener("touchcancel",ke),v.removeEventListener("pointerdown",be),window.removeEventListener("pointerup",ke),window.removeEventListener("pointercancel",ke)}},[]);let Ye=()=>{let v=k.current;v&&(H.current=!1,ue(v))},Je=S.value.filter(v=>!v.ephemeral),_t=Je[0],Pe=_t?.serverMessageId??_t?.id,Fe=!!(d&&Je.length>=Ua&&Pe!==B),Ve=async()=>{if(!d||D.current)return;let v=k.current,E=v?.scrollHeight??0,Q=v?.scrollTop??0;D.current=!0,q.current=!0,w(!0);try{let j=await d();j===!1&&Pe&&M(Pe),j&&v&&(await new Promise(Z=>requestAnimationFrame(()=>requestAnimationFrame(()=>Z()))),v.scrollTop=Q+v.scrollHeight-E,ae(v),xe(v))}finally{q.current=!1,D.current=!1,w(!1)}},et=[],pt="",z=S.value.at(-1)?.id,G=[...g??[]].toSorted((v,E)=>(v.createdAt??1/0)-(E.createdAt??1/0)),J=v=>m&&v.formId===m.form.id?i(oi,{form:m.form,strings:t,onSubmit:m.onSubmit,onSkip:m.onSkip},`gate:${v.formId}`):i(Wc,{marker:v,strings:t,onFill:!m&&y?()=>y(v.formId):void 0},v.key),C=v=>{for(let E=G[0];E?.createdAt!==void 0&&!(v!==void 0&&E.createdAt>v);E=G[0])G.shift(),et.push(J(E))};for(let v of S.value){if(v.role==="assistant"&&v.id!==z&&on(v))continue;C(v.createdAt);let E=cg(v.createdAt);E&&E!==pt&&(et.push(i("div",{class:`${Wt}-date-divider`,children:i("span",{class:`${Wt}-date-pill`,title:dg(v.createdAt),children:ug(v.createdAt,t)})},`day:${E}`)),pt=E);let j=v.retryAction!==void 0||v.role==="assistant"&&v.id===z?ur(S.value,v):void 0,Z=j!==void 0&&(j.kind!=="continue-assistant"||_==="ai-agent");et.push(i(wd,{message:v,status:v.status,strings:t,responseMode:n,showReasoning:o,showToolCalls:r,showSources:a,interactive:!!p&&_==="ai-agent"&&v.id===z,superseded:v.id!==z,tool:u,onRetry:p&&Z&&(v.role==="user"||v.id===z)?f:void 0,enableMessageFeedback:s,onFeedback:l},v.id))}for(let v of G)et.push(J(v));return i("div",{class:`${Wt}-list-wrap`,children:[i("div",{ref:k,class:`${Wt}-list ${Wt}-list--fade`,role:"log","aria-live":"polite","aria-relevant":"additions text",children:[c&&S.value.length===0?i("div",{class:`${Wt}-list-loading`,role:"status",children:t.conversationLoading}):null,Fe?i("div",{class:`${Wt}-load-previous`,children:i("button",{type:"button",onClick:Ve,disabled:P,"aria-busy":P,"data-testid":T.loadPreviousMessages,children:t.loadPreviousMessages})}):null,et,m&&!je?i(oi,{form:m.form,strings:t,onSubmit:m.onSubmit,onSkip:m.onSkip}):null]}),b?i("button",{type:"button",class:`${Wt}-jump`,onClick:Ye,"aria-label":t.scrollToBottom,title:t.scrollToBottom,"data-testid":T.scrollToBottom,children:i(ln,{})}):null]})}function cg(e){if(typeof e!="number"||!Number.isFinite(e))return"";let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function dg(e){if(typeof e!="number"||!Number.isFinite(e))return"";try{return new Date(e).toLocaleDateString(void 0,{dateStyle:"full"})}catch{return""}}function ug(e,t){let n=new Date(e),o=a=>new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime(),r=Math.round((o(new Date)-o(n))/864e5);return r<=0?t.dateToday:r===1?t.dateYesterday:r<7?n.toLocaleDateString(void 0,{weekday:"long"}):n.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"})}var _g=["today","yesterday","lastWeek","older"];function pg(e,t){let n=Date.parse(t);if(!Number.isFinite(n))return"older";let o=Math.floor((Rd(e)-Rd(n))/(1440*60*1e3));return o<=0?"today":o===1?"yesterday":o<7?"lastWeek":"older"}function Td(e,t){let n=new Map;for(let o of t){let r=pg(e,o.lastMessageAt),a=n.get(r);a?a.push(o):n.set(r,[o])}return _g.filter(o=>n.has(o)).map(o=>({bucket:o,conversations:n.get(o)}))}function Rd(e){let t=new Date(e);return t.setUTCHours(0,0,0,0),t.getTime()}var Id=ee.scope("history"),fg=3,mg=6,gg={today:"dateToday",yesterday:"dateYesterday",lastWeek:"dateLastWeek",older:"dateOlder"};function Ed(e,t){let n=t.type!=="upsert"||t.activity===!0;if(t.type==="snapshot"&&t.result.pagination.page===1&&e.pagination.page>1){let r=Lt(e.conversations.slice(0,t.result.pagination.limit),t,n);if(t.result.conversations.length===0){if(r.length===0)return t.result;let d=Math.max(t.result.pagination.total,r.length);return{...t.result,conversations:r,pagination:{...t.result.pagination,total:d,totalPages:Math.ceil(d/t.result.pagination.limit)}}}let a=new Set(r.map(d=>d.conversationId)),s=e.conversations.slice(t.result.pagination.limit).filter(d=>!a.has(d.conversationId)),l=e.pagination.page,c={...t.result.pagination,page:l,hasPrev:l>1,hasNext:l<t.result.pagination.totalPages};return{conversations:[...r,...s],pagination:c}}let o=Lt(e.conversations,t,n);return o===e.conversations?e:{...t.type==="snapshot"?t.result:e,conversations:o}}function vg(e,t,n){let o=Date.parse(e);return Number.isFinite(o)?new Date(o).toDateString()===new Date(t).toDateString()?new Intl.DateTimeFormat(n,{hour:"numeric",minute:"2-digit"}).format(o):t-o<10080*60*1e3?new Intl.DateTimeFormat(n,{weekday:"short"}).format(o):new Intl.DateTimeFormat(n,{month:"short",day:"numeric"}).format(o):""}function Dr({transport:e,strings:t,locale:n,persistence:o,onSelect:r,onNewConversation:a}){let s=R.cssPrefix,l=e.peekConversations({limit:50}),[c,d]=$(l?"loaded":"loading"),[p,_]=$(l),[u,f]=$(!1),m=O(),g=p?.conversations??[],y=p?.pagination;L(()=>{let P=!1,w=!0,D=[],q=e.subscribeConversationChanges(M=>{w&&D.push(M),_(F=>F&&Ed(F,M))});m.current=void 0,f(!1);let B=e.peekConversations({limit:50});return _(B),d(B?"loaded":"loading"),e.listConversations({limit:50}).then(M=>{if(P)return;let F=M;for(let H of D)F=Ed(F,H);D=[],w=!1,_(F),d("loaded"),o.saveHistoryCount(F.conversations.length)}).catch(M=>{P||(D=[],w=!1,Id.warn("listConversations failed",{err:M}),d("error"))}),()=>{P=!0,q(),m.current=void 0}},[e,o,n]);let k=async()=>{if(m.current||!y?.hasNext)return;let P={};m.current=P,f(!0);try{let w=await e.listConversations({page:y.page+1,limit:y.limit});if(m.current!==P)return;_(D=>{if(!D)return D;let q=new Set(D.conversations.map(F=>F.conversationId)),B=w.conversations.filter(F=>q.has(F.conversationId)?!1:(q.add(F.conversationId),!0)),M={conversations:[...D.conversations,...B],pagination:w.pagination};return o.saveHistoryCount(M.conversations.length),M})}catch(w){if(m.current!==P)return;Id.warn("listConversations page failed",{err:w,page:y.page+1})}finally{m.current===P&&(m.current=void 0,f(!1))}},S=a?i("div",{class:`${s}-history-footer`,children:i("button",{type:"button",class:`${s}-history-new`,onClick:a,"data-testid":T.sidebarNewConversation,children:[i(Jl,{}),t.newConversation]})}):null;if(c==="loading"){let P=Math.min(o.loadHistoryCount()??fg,mg);return i(de,{children:[i("div",{class:`${s}-history`,"aria-busy":"true","aria-label":t.historyLoading,children:i("div",{class:`${s}-history-group`,"aria-hidden":"true",children:[i("div",{class:`${s}-history-heading`,children:i("span",{class:`${s}-skeleton ${s}-skeleton-heading`})}),i("div",{class:`${s}-history-card`,children:Array.from({length:Math.max(1,P)},(w,D)=>i("div",{class:`${s}-history-item ${s}-history-item-skeleton`,children:[i("span",{class:`${s}-history-avatar ${s}-skeleton`}),i("span",{class:`${s}-history-body`,children:[i("span",{class:`${s}-history-row`,children:[i("span",{class:`${s}-history-title`,children:i("span",{class:`${s}-skeleton ${s}-skeleton-title`})}),i("span",{class:`${s}-history-time`,children:i("span",{class:`${s}-skeleton ${s}-skeleton-time`})})]}),i("span",{class:`${s}-history-row`,children:i("span",{class:`${s}-history-preview`,children:i("span",{class:`${s}-skeleton ${s}-skeleton-preview`})})})]})]},D))})]})}),S]})}if(c==="error"||g.length===0)return i(de,{children:[i("div",{class:`${s}-history-empty`,children:t.historyEmpty}),S]});let b=Date.now(),x=Td(b,g);return i(de,{children:[i("div",{class:`${s}-history`,role:"list",children:[x.map(P=>i("div",{class:`${s}-history-group`,children:[i("div",{class:`${s}-history-heading`,children:t[gg[P.bucket]]}),i("div",{class:`${s}-history-card`,children:P.conversations.map(w=>i("button",{type:"button",role:"listitem",class:`${s}-history-item`,onClick:()=>r(w),"data-closed":w.canContinue?void 0:"true","data-unread":w.hasUnread?"true":void 0,"data-testid":Ue(T.historyItem,w.conversationId),children:[i("span",{class:`${s}-history-avatar`,"aria-hidden":"true",children:i(Ya,{})}),i("span",{class:`${s}-history-body`,children:[i("span",{class:`${s}-history-row`,children:[i("span",{class:`${s}-history-title`,children:w.title}),i("span",{class:`${s}-history-time`,children:vg(w.lastMessageAt,b,n)})]}),i("span",{class:`${s}-history-row`,children:[i("span",{class:`${s}-history-preview`,children:w.preview??(w.canContinue?t.historyContinue:t.conversationClosed)}),w.hasUnread?i("span",{class:`${s}-history-dot`}):null]})]})]},w.conversationId))})]},P.bucket)),y?.hasNext?i("div",{class:`${s}-history-more`,children:i("button",{type:"button",onClick:k,disabled:u,"aria-busy":u,"data-testid":T.historyLoadMore,children:t.loadMoreConversations})}):null]}),S]})}var Ad=R.cssPrefix;function Md({suggestions:e,onPick:t,disabled:n=!1}){return e.length===0?null:i("div",{class:`${Ad}-suggestions`,role:"group","aria-label":"Suggested replies",children:e.map((o,r)=>i("button",{type:"button",class:`${Ad}-suggestion`,onClick:()=>t(o),disabled:n,"data-testid":Ue(T.suggestion,r),children:o.label},o.id))})}var qe=R.cssPrefix;function Ld(e){let{options:t,onClose:n}=e,o=t.strings,r=O(null);L(()=>{let d=r.current;if(!d)return;let p=Pr(d),_=u=>{u.key==="Escape"&&n?.()};return d.addEventListener("keydown",_),()=>{p(),d.removeEventListener("keydown",_)}},[n]);let a=e.composerApiRef,s=e.composerActive&&e.view==="chat"&&e.canSend&&!e.activeForm&&!e.sendPreparing&&e.options.features.fileUpload,l=N(d=>{s&&a.current?.attachFromDrop(d)},[a,s]),{visible:c}=wr({containerRef:r,onDrop:l,disabled:!s});return br(r.current,t.mode==="modal"),i("div",{ref:r,class:`${qe}-panel`,role:"dialog","aria-modal":"false","aria-label":o.panelTitle,style:{position:"relative"},"data-testid":T.panel,children:[i(bi,{...e,containerEl:r.current,dragOver:c,composerAttachApiRef:a}),i(yi,{poweredBy:e.options.poweredBy})]})}function bi(e){let{options:t,transport:n,feedback:o,bus:r,persistence:a,conversationId:s,composerKey:l,panelSize:c,view:d,canSend:p,isStreaming:_,sendPreparing:u,controlMode:f,assignedOperatorInitials:m,operatorAvailable:g,operatorRequestEnabled:y,onRequestOperator:k,onCancelOperatorRequest:S,loadingMessages:b,onLoadPreviousMessages:x,messagesSig:P,agent:w,suggestions:D,initialWidgetSize:q,onClose:B,onBack:M,onClear:F,onToggleHistory:H,onSelectHistoryConversation:V,onNewConversation:te,onWidgetSizeChange:W,onSend:le,onStop:ae,onSuggestion:xe,activeForm:ue,formMarkers:ye,onFormSubmit:pe,onFormSkip:Ze,onFormFill:ot,tool:ct,onRetry:Ge,onMessageFeedback:je,containerEl:Ye,dragOver:Je,composerAttachApiRef:_t}=e,Pe=t.strings,Fe=ut(()=>P.value.some(et=>!et.ephemeral&&et.role!=="system")).value,Ve;return ue?Ve=null:p?Ve=i(de,{children:[f&&f!=="ai-agent"?i(yg,{controlMode:f,operatorInitials:m,operatorAvailable:g,onCancelOperatorRequest:S,strings:Pe}):null,!_&&f==="ai-agent"&&i(Md,{suggestions:D,onPick:xe,disabled:u}),i(Bc,{options:t,transport:n,feedback:o,bus:r,persistence:a,conversationId:s,isStreaming:_,active:e.composerActive&&d==="chat",isPreparing:u,operatorRequestEnabled:y,canRequestOperator:Fe,controlMode:f,onRequestOperator:k,onSend:le,onStop:ae,attachApiRef:_t},l)]}):Ve=i(bg,{label:Pe.conversationClosed,ctaLabel:Pe.startNewConversation,onNewConversation:F}),i(de,{children:[d==="history"?i(hg,{strings:Pe,onBack:H,onClose:B,showClose:yr(t.mode,c,t.actions)}):i("header",{class:`${qe}-header`,"data-testid":T.panelHeader,children:[M?i("button",{type:"button",class:`${qe}-icon-btn`,onClick:M,"aria-label":Pe.moduleBack,title:Pe.moduleBack,children:i(lo,{})}):null,w?i(Nc,{agent:w,strings:Pe}):i("h1",{children:Pe.panelTitle}),i(Pt,{panelProps:e,variant:"chat"})]}),d==="history"?i(Dr,{transport:n,strings:Pe,locale:t.locale,persistence:a,onSelect:V,onNewConversation:te}):i(de,{children:[i(Hc,{visible:Je,strings:Pe}),i(Cd,{messagesSig:P,strings:Pe,responseMode:t.responseMode,showReasoning:t.showReasoning,showToolCalls:t.showToolCalls,showSources:t.showSources,enableMessageFeedback:t.enableMessageFeedback,onFeedback:je,loading:b,onLoadPreviousMessages:x,idle:!_&&!u&&p&&!ue,controlMode:f,tool:ct,onRetry:Ge,form:ue?{form:ue,onSubmit:pe,onSkip:Ze}:null,formMarkers:ye,onFillForm:ot}),Ve,i(xg,{disclaimer:t.composerDisclaimer})]}),t.size.resize?.enabled?i(hr,{panelEl:Ye,resize:t.size.resize,position:t.position,initialSize:q,onSizeChange:W,strings:Pe}):null]})}function hg({strings:e,onBack:t,onClose:n,showClose:o}){return i("header",{class:`${qe}-header`,children:[i("button",{type:"button",class:`${qe}-icon-btn`,onClick:t,"aria-label":e.historyBack,title:e.historyBack,children:i(lo,{})}),i("h1",{children:e.historyTitle}),o?i("button",{type:"button",class:`${qe}-icon-btn`,onClick:n,"aria-label":e.close,title:e.close,children:i(yt,{})}):null]})}function bg({label:e,ctaLabel:t,onNewConversation:n}){return i("div",{class:`${qe}-readonly-banner`,role:"note",children:[i("span",{class:`${qe}-readonly-label`,children:e}),i("button",{type:"button",class:`${qe}-readonly-cta`,onClick:n,children:t})]})}function yg({controlMode:e,operatorInitials:t,operatorAvailable:n,onCancelOperatorRequest:o,strings:r}){let a=Pg(e,t,n,r);return i("div",{class:`${qe}-operator-banner`,role:"status","data-mode":e,"data-testid":T.operatorBanner,children:[i("span",{class:`${qe}-operator-pulse`,"aria-hidden":"true"}),i("span",{class:`${qe}-operator-label`,children:a}),e==="awaiting_operator"&&o?i("button",{type:"button",class:`${qe}-cancel-operator-request`,"data-testid":T.cancelOperatorRequest,onClick:o,children:r.cancelOperatorRequest}):null]})}function Pg(e,t,n,o){return e==="operator"?o.chattingWithOperator.replace("{operator}",t??""):n===!1?o.noOperatorAvailable:o.connectingOperator}function xg({disclaimer:e}){return e?i("div",{class:`${qe}-composer-footer`,children:i("div",{class:`${qe}-disclaimer`,children:e})}):null}function yi({poweredBy:e}){return e?i("div",{class:`${qe}-poweredby-bar`,children:i(Sg,{logoUrl:e.logoUrl,text:e.text,href:e.href})}):null}function Sg({logoUrl:e,text:t,href:n}){let o=i(de,{children:[e?i("img",{class:`${qe}-poweredby-logo`,src:e,alt:"",loading:"lazy"}):null,t?i("span",{children:t}):null]});return n?i("a",{class:`${qe}-poweredby`,href:n,target:"_blank",rel:"noopener noreferrer",children:o}):i("span",{class:`${qe}-poweredby`,children:o})}function Od(e){let t=O(e);t.current=e;let n=O(null);return n.current??(n.current=kg(t)),n.current}function kg(e){let t=oe(null),n=new Set,o=c=>`${e.current.conversationId()??""}:${c}`,r=c=>c.frequency==="always"?!1:c.frequency==="conversation"?n.has(o(c.id)):c.id in e.current.persistence.loadFormsDone(),a=(c,d)=>{if(t.value)return;let p=e.current;if(c==="manual"){let _=p.forms.list.find(u=>u.id===d);_&&(t.value={form:_,trigger:"manual"});return}for(let _ of p.forms.byTrigger[c]??[]){let u=_.triggers.find(f=>f.kind===c);if(!(!u||!wg(u,p)||r(_)||!Cg(_,p))){t.value={form:_,trigger:c};return}}},s=(c,d)=>{let p=t.value;if(!p)return;t.value=null;let{form:_,trigger:u}=p;_.frequency==="conversation"?n.add(o(_.id)):_.frequency!=="always"&&e.current.persistence.saveFormDone(_.id),e.current.onComplete(_,u,c,d)};return{activeForm:t,fire:a,refresh:()=>{let c=t.value;if(!c)return;let d=e.current.forms.list.find(p=>p.id===c.form.id);d&&d!==c.form&&(t.value={form:d,trigger:c.trigger})},complete:c=>s(c,!1),skip:()=>s({},!0)}}function wg(e,t){return e.kind==="after-messages"?t.messageCount()>=Number(e.param??0):e.kind==="page-area"?t.pageArea()===e.param:!0}function Cg(e,t){let n=e.when;if(!n)return!0;if(n.missingContext?.length){let r=t.userContext()??{};if(n.missingContext.some(a=>r[a]!==void 0&&r[a]!==""))return!1}if(n.pageArea&&!(Array.isArray(n.pageArea)?n.pageArea:[n.pageArea]).includes(t.pageArea()??""))return!1;let o=t.messageCount();return!(n.minMessages!=null&&o<n.minMessages||n.maxMessages!=null&&o>n.maxMessages)}function Nd(e){let t=R.cssPrefix,{site:n,blocks:o,strings:r,collapsed:a}=e,s=o?.navigation??[],l=o?.linkCards??[],c=a?r.expandSidebar:r.collapseSidebar;return i("aside",{class:`${t}-sidebar`,"data-collapsed":a?"true":"false","data-testid":T.sidebar,children:[i("div",{class:`${t}-sidebar-header`,children:[i(Rg,{site:n}),i("button",{type:"button",class:`${t}-sidebar-toggle`,"aria-label":c,"aria-expanded":a?"false":"true",title:c,onClick:e.onToggleCollapsed,"data-testid":T.sidebarToggle,children:i(Tg,{collapsed:a})})]}),a?null:i(de,{children:[s.length>0?i("nav",{class:`${t}-sidebar-section`,"data-section":"navigation",children:i(Ig,{items:s})}):null,l.length>0?i("div",{class:`${t}-sidebar-section`,"data-section":"link-cards",children:i(Eg,{items:l})}):null,e.showConversations?i("div",{class:`${t}-sidebar-conversations`,children:i(Dr,{transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,onSelect:e.onSelectConversation,onNewConversation:e.onNewConversation})}):null]})]})}function Rg({site:e}){let t=R.cssPrefix;if(e?.logo?.url){let n=e.logo.alt??e.title??"Logo";return i("picture",{children:[e.logoDark?.url?i("source",{srcset:e.logoDark.url,media:"(prefers-color-scheme: dark)"}):null,i("img",{class:`${t}-sidebar-logo`,src:e.logo.url,alt:n})]})}return i("div",{class:`${t}-sidebar-title`,children:e?.title??R.name})}function Tg({collapsed:e}){return i("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true",children:e?i("polyline",{points:"9 6 15 12 9 18"}):i("polyline",{points:"15 6 9 12 15 18"})})}function Ig({items:e}){let t=R.cssPrefix;return i("ul",{class:`${t}-sidebar-nav`,children:e.map(n=>i("li",{children:i("a",{class:`${t}-sidebar-nav-item`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[n.icon?i("span",{class:`${t}-sidebar-nav-icon`,"data-icon":n.icon}):null,i("span",{class:`${t}-sidebar-nav-label`,children:n.label})]})},n.id??n.label))})}function Eg({items:e}){let t=R.cssPrefix;return i("div",{class:`${t}-sidebar-cards`,children:e.map(n=>i("a",{class:`${t}-sidebar-card`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[i("div",{class:`${t}-sidebar-card-label`,children:n.label}),n.description?i("div",{class:`${t}-sidebar-card-desc`,children:n.description}):null]},n.id??n.label))})}var Dd=R.cssPrefix;function $d(e){return i("main",{class:`${Dd}-page-shell`,"data-sidebar-collapsed":e.sidebarCollapsed?"true":"false",children:[i(Nd,{site:e.site,blocks:e.blocks,transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,showConversations:e.showConversations,onSelectConversation:e.onSelectConversation,onNewConversation:e.onNewConversation,collapsed:e.sidebarCollapsed,onToggleCollapsed:e.onToggleSidebarCollapsed}),i("section",{class:`${Dd}-page-chat`,"aria-label":"Chat",children:e.children})]})}var Fd=e=>Object.fromEntries(e.map(t=>[t,[]]));function Pi(e,t,n){return e.includes(t)?t:e.includes(n)?n:e[0]??""}function Bd(e,t,n){let o=[...new Set(t)],r=Pi(o,e,""),a=oe({activeTab:r,stacks:Fd(o)});return{sig:a,reconcile(s,l){let c=[...new Set(s)],d=a.value,p=Pi(c,d.activeTab,l),_=Object.fromEntries(c.map(f=>[f,d.stacks[f]??[]])),u=p===d.activeTab&&c.length===Object.keys(d.stacks).length&&c.every(f=>d.stacks[f]===_[f]);o=c,!u&&(a.value={activeTab:p,stacks:_},p!==d.activeTab&&p&&n?.(p))},switchTab(s){!(s in a.value.stacks)||a.value.activeTab===s||(a.value={...a.value,activeTab:s},n?.(s))},push(s){let l=a.value,c=l.stacks[l.activeTab]??[];a.value={...l,stacks:{...l.stacks,[l.activeTab]:[...c,s]}}},pop(){let s=a.value,l=s.stacks[s.activeTab]??[];l.length!==0&&(a.value={...s,stacks:{...s.stacks,[s.activeTab]:l.slice(0,-1)}})},reset(s){a.value={activeTab:Pi(o,s,""),stacks:Fd(o)}}}}var Hd=e=>e.stacks[e.activeTab]??[],Ud=e=>Hd(e).at(-1),zd=e=>Hd(e).length===0;var qd={Icon:uo};var Kt=R.cssPrefix;function $r({title:e,actions:t}){return i("header",{class:`${Kt}-back-header`,"data-variant":"title",children:[i("span",{class:`${Kt}-back-spacer`,"aria-hidden":"true"}),i("h1",{class:`${Kt}-back-title`,children:e}),t??i("span",{class:`${Kt}-back-spacer`,"aria-hidden":"true"})]})}function Fr({title:e,backLabel:t,onBack:n,actions:o,testid:r}){return i("header",{class:`${Kt}-back-header`,"data-testid":r,children:[i("button",{type:"button",class:`${Kt}-icon-btn`,onClick:n,"aria-label":t,title:t,children:i(lo,{})}),i("h1",{class:`${Kt}-back-title`,children:e}),o??i("span",{class:`${Kt}-back-spacer`,"aria-hidden":"true"})]})}function un(e,t){return e instanceof He&&e.status===429?t.errorRateLimited:t.errorGeneric}var $n=R.cssPrefix;function Vd({placeholder:e,onActivate:t}){return i("button",{type:"button",class:`${$n}-home-search`,onClick:t,"data-testid":T.homeSearch,children:[i("span",{class:`${$n}-home-search-text`,children:e}),i("span",{class:`${$n}-home-search-icon`,"aria-hidden":"true",children:i(Qa,{})})]})}function Wd({placeholder:e,value:t,onInput:n}){return i("div",{class:`${$n}-home-search`,"data-input":"true",children:[i("input",{type:"search",class:`${$n}-home-search-input`,placeholder:e,value:t,onInput:o=>n(o.currentTarget.value),"data-testid":T.helpSearch}),i("span",{class:`${$n}-home-search-icon`,"aria-hidden":"true",children:i(Qa,{})})]})}var fo=R.cssPrefix;function Br({title:e,subtitle:t,onClick:n,testid:o}){return i("button",{type:"button",class:`${fo}-list-row`,onClick:n,"data-testid":o,children:[i("span",{class:`${fo}-list-row-body`,children:[i("span",{class:`${fo}-list-row-title`,children:e}),t?i("span",{class:`${fo}-list-row-sub`,children:t}):null]}),i("span",{class:`${fo}-list-row-chevron`,"aria-hidden":"true",children:i(An,{})})]})}var Kd=R.cssPrefix;function vt({tone:e="info",message:t,onRetry:n,strings:o}){return i("div",{class:`${Kd}-module-empty`,role:e==="error"?"alert":"status","aria-live":"polite",children:[i("span",{children:t}),n?i("button",{type:"button",class:`${Kd}-module-retry`,onClick:n,children:o.errorRetry}):null]})}var _n=R.cssPrefix,Ag=ee.scope("help"),Mg=(e,t)=>t.url?e.push({kind:"iframe",url:t.url,title:t.title}):e.push({kind:"content",id:t.id,title:t.title});function Lg(e){let t=new Map;for(let n of e){let o=n.categories?.[0]??"";(t.get(o)??t.set(o,[]).get(o)).push(n)}return[...t.entries()]}function Gd(e,t){let n=t.toLowerCase(),o=n.indexOf(e);if(o!==-1)return 100-Math.min(o,99);let r=0;for(let a of e){if(r=n.indexOf(a,r),r===-1)return 0;r+=1}return 1}function Og(e,t){let n=t.toLowerCase().trim();return n?e.map(o=>({item:o,score:Math.max(Gd(n,o.title)*2,Gd(n,o.description??""))})).filter(o=>o.score>0).toSorted((o,r)=>r.score-o.score).map(o=>o.item):[]}function jd({article:e,nav:t}){return i(Br,{title:e.title,subtitle:e.description,onClick:()=>Mg(t,e),testid:Ue(T.helpArticle,e.id)})}function Ng({transport:e,strings:t,config:n,nav:o,bus:r,panelProps:a}){let s=n.contentTags,[l,c]=$("loading"),[d,p]=$(t.errorGeneric),[_,u]=$([]),[f,m]=$(""),[g,y]=$(0);L(()=>{let b=!1;return c("loading"),e.listContent({tags:s,sortBy:"order",limit:100}).then(x=>{if(b)return;let P=x.items??[];u(P),c("loaded"),r.emit("contentView",{section:"help",tags:s?.join(","),count:P.length})}).catch(x=>{b||(Ag.warn("listContent (help) failed",{err:x}),p(un(x,t)),c("error"))}),()=>{b=!0}},[e,s,g,r]);let k=ie(()=>Og(_,f),[_,f]);L(()=>{let b=f.trim();if(!b)return;let x=setTimeout(()=>r.emit("contentSearch",{queryLength:b.length,hitCount:k.length}),600);return()=>clearTimeout(x)},[f,k,r]);function S(){return f.trim().length>0?k.length===0?i(vt,{message:t.helpSearchEmpty,strings:t}):i("div",{class:`${_n}-help-card`,children:k.map(b=>i(jd,{article:b,nav:o},b.id))}):l==="loading"?i(vt,{message:t.helpLoading,strings:t}):l==="error"?i(vt,{tone:"error",message:d,onRetry:()=>y(b=>b+1),strings:t}):_.length===0?i(vt,{message:t.helpEmpty,strings:t}):Lg(_).map(([b,x])=>i("section",{class:`${_n}-help-group`,children:[b?i("h2",{class:`${_n}-help-section-title`,children:b}):null,i("div",{class:`${_n}-help-card`,children:x.map(P=>i(jd,{article:P,nav:o},P.id))})]},b))}return i("div",{class:`${_n}-module`,children:[i($r,{title:t.helpTitle,actions:i(Pt,{panelProps:a,variant:"plain"})}),i("div",{class:`${_n}-module-pad`,children:i(Wd,{placeholder:t.helpSearchPlaceholder,value:f,onInput:m})}),i("div",{class:`${_n}-help-list`,children:S()})]})}var Xd={Icon:co,Root:e=>i(Ng,{...e})};var Yd=R.cssPrefix;function xi({onClick:e,children:t,testid:n}){return e?i("button",{type:"button",class:`${Yd}-home-card`,"data-interactive":"true",onClick:e,"data-testid":n,children:t}):i("div",{class:`${Yd}-home-card`,"data-testid":n,children:t})}var Te=R.cssPrefix,Jd=ee.scope("home");function Dg(e){let t=e.options.userContext?.name,n=e.config.greetingText?Qe(e.strings,e.config.greetingText):void 0;return n?{title:t?n.replace("{name}",t):n.replace(/\s*\{name\}\s*/," ").trim(),subtitle:e.strings.homeGreetingLead}:t?{title:e.strings.homeGreetingNamed.replace("{name}",t),subtitle:e.strings.homeGreetingLead}:{title:e.strings.homeGreeting}}var $g=(e,t)=>t.url?e.push({kind:"iframe",url:t.url,title:t.title}):e.push({kind:"content",id:t.id,title:t.title});function Qd(e,t){return Lt(e,t,t.type!=="upsert"||t.activity===!0)}function Fg(e){let{transport:t,strings:n,config:o,nav:r,bus:a,panelProps:s}=e,[l,c]=$(null),[d,p]=$([]),_=o.contentTags?.join(","),u=e.options.modules.list.some(S=>S.layout==="chat");L(()=>{if(o.showRecentConversations===!1)return;let S=!1,b=!0,x=[],P=t.subscribeConversationChanges(w=>{b&&x.push(w),c(D=>Qd(D?[D]:[],w)[0]??null)});return t.listConversations({limit:u?50:1}).then(w=>{if(S)return;let D=x.reduce(Qd,w.conversations);x=[],b=!1,c(D[0]??null)}).catch(w=>{S||(x=[],b=!1,Jd.warn("listConversations (home) failed",{err:w}))}),()=>{S=!0,P()}},[t,o.showRecentConversations,u]),L(()=>{if(!o.contentTags?.length)return;let S=!1;return t.listContent({tags:o.contentTags,limit:6}).then(b=>{if(S)return;let x=b.items??[];p(x),a.emit("contentView",{section:"home",tags:_,count:x.length})}).catch(b=>!S&&Jd.warn("listContent (home) failed",{err:b})),()=>{S=!0}},[t,_,a]);let f=Dg(e),m=o.userAvatars??[],g=o.status,y=g?.text?Qe(n,g.text):n.homeStatus,k=o.contentBlockTitle?Qe(n,o.contentBlockTitle):n.homeContentTitle;return i("div",{class:`${Te}-module ${Te}-home`,"data-testid":T.homeView,children:i("div",{class:`${Te}-home-scroll`,children:[i("div",{class:`${Te}-home-hero`,children:[i("div",{class:`${Te}-home-hero-top`,children:[o.brandName?i("span",{class:`${Te}-home-brand`,"data-testid":T.homeBrand,children:o.brandName}):i("span",{class:`${Te}-home-brand-spacer`,"aria-hidden":"true"}),i("div",{class:`${Te}-home-hero-actions`,children:[m.length>0?i("div",{class:`${Te}-home-avatars`,children:m.map(S=>i("span",{class:`${Te}-home-avatar`,title:S.role?`${S.name} \xB7 ${S.role}`:S.name,children:S.avatar?i("img",{src:S.avatar,alt:"",loading:"lazy"}):i("span",{children:xr(S.name)})},S.name))}):null,i(Pt,{panelProps:s,variant:"plain"})]})]}),o.showGreeting!==!1?i(de,{children:[i("h1",{class:`${Te}-home-greeting`,"data-testid":T.homeGreeting,children:f.title}),f.subtitle?i("p",{class:`${Te}-home-lead`,children:f.subtitle}):null]}):null]}),i("div",{class:`${Te}-home-cards`,children:[o.showSearchBar!==!1?i(Vd,{placeholder:n.homeSearchPlaceholder,onActivate:()=>r.switchToLayout("help")}):null,l?i(xi,{onClick:()=>r.selectConversation(l),testid:T.homeRecent,children:i("div",{class:`${Te}-home-recent-row`,"data-unread":l.hasUnread?"true":void 0,children:[i("span",{class:`${Te}-home-recent-avatar`,"aria-hidden":"true",children:i(uo,{})}),i("span",{class:`${Te}-home-recent-body`,children:[i("span",{class:`${Te}-home-recent-title`,children:l.title}),l.preview?i("span",{class:`${Te}-home-recent-preview`,children:l.preview}):null]}),l.hasUnread?i("span",{class:`${Te}-home-recent-dot`,"aria-label":"Unread"}):null]})}):null,g?i(xi,{onClick:g.url?()=>r.push({kind:"iframe",url:g.url,title:y}):void 0,children:i("div",{class:`${Te}-home-status`,"data-level":g.level??"operational",children:[i("span",{class:`${Te}-home-status-icon`,"aria-hidden":"true",children:i(bc,{})}),i("span",{class:`${Te}-home-status-text`,children:y})]})}):null,d.length>0?i("section",{class:`${Te}-home-content`,children:[i("div",{class:`${Te}-home-content-title`,children:k}),i("div",{class:`${Te}-home-content-list`,children:d.map(S=>i(Br,{title:S.title,subtitle:S.description,onClick:()=>$g(r,S),testid:Ue(T.homeContentRow,S.id)},S.id))})]}):null]})]})})}var Zd={Icon:yc,Root:e=>i(Fg,{...e})};var Gt=R.cssPrefix,Bg=ee.scope("news");function Hg({transport:e,strings:t,config:n,nav:o,bus:r,panelProps:a}){let s=n.contentTags,[l,c]=$("loading"),[d,p]=$(t.errorGeneric),[_,u]=$([]),[f,m]=$(0);L(()=>{let y=!1;return c("loading"),e.listContent({tags:s,sortBy:"publishedAt",sortOrder:"desc"}).then(k=>{if(y)return;let S=k.items??[];u(S),c("loaded"),r.emit("contentView",{section:"news",tags:s?.join(","),count:S.length})}).catch(k=>{y||(Bg.warn("listContent (news) failed",{err:k}),p(un(k,t)),c("error"))}),()=>{y=!0}},[e,s,f,r]);function g(){return l==="loading"?i(vt,{message:t.newsLoading,strings:t}):l==="error"?i(vt,{tone:"error",message:d,onRetry:()=>m(y=>y+1),strings:t}):_.length===0?i(vt,{message:t.newsEmpty,strings:t}):i("div",{class:`${Gt}-news-list`,children:_.map(y=>i("button",{type:"button",class:`${Gt}-news-card`,onClick:()=>o.push({kind:"content",id:y.id,title:y.title}),"data-testid":Ue(T.newsItem,y.id),children:[y.image?i("img",{class:`${Gt}-news-hero`,src:y.image,alt:"",loading:"lazy"}):null,i("span",{class:`${Gt}-news-body`,children:[i("span",{class:`${Gt}-news-title`,children:y.title}),y.description?i("span",{class:`${Gt}-news-summary`,children:y.description}):null]})]},y.id))})}return i("div",{class:`${Gt}-module`,children:[i($r,{title:t.newsTitle,actions:i(Pt,{panelProps:a,variant:"plain"})}),i("div",{class:`${Gt}-module-scroll`,children:g()})]})}var eu={Icon:Pc,Root:e=>i(Hg,{...e})};var Hr={chat:qd,home:Zd,help:Xd,news:eu};var mo=R.cssPrefix;function tu({modules:e,activeTab:t,strings:n,hasUnread:o,onSelect:r}){return i("nav",{class:`${mo}-tabbar`,role:"tablist","aria-label":n.panelTitle,children:e.map(a=>{let s=Hr[a.layout].Icon,l=a.id===t,c=a.layout==="chat"&&o;return i("button",{type:"button",role:"tab","aria-selected":l,class:`${mo}-tab`,onClick:()=>r(a.id),"data-testid":Ue(T.tab,a.id),children:[i("span",{class:`${mo}-tab-icon`,"aria-hidden":"true",children:[i(s,{}),c?i("span",{class:`${mo}-tab-badge`,"data-testid":T.tabBadge,"aria-label":"Unread"}):null]}),i("span",{class:`${mo}-tab-label`,children:Qe(n,a.label)})]},a.id)})})}var nu=R.cssPrefix,Ug="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads";function ou({url:e,title:t,strings:n,onBack:o,actions:r}){return i("div",{class:`${nu}-module`,children:[i(Fr,{title:t||n.moduleBack,backLabel:n.moduleBack,onBack:o,actions:r}),i("iframe",{class:`${nu}-content-frame`,src:e,title:t||"content",sandbox:Ug,referrerpolicy:"no-referrer",loading:"lazy",allow:"fullscreen"})]})}var go=R.cssPrefix,zg=ee.scope("content"),qg=5e3;function ru({id:e,title:t,transport:n,strings:o,bus:r,onBack:a,actions:s}){let[l,c]=$(null),[d,p]=$(!1),[_,u]=$(0),f=N(()=>{p(!1),c(null),u(y=>y+1)},[]);L(()=>{let y=!1;return n.listContent({ids:[e],limit:1}).then(k=>{if(y)return;let S=k.items[0];S?(c(S),r.emit("contentOpen",{contentId:e,tags:S.tags?.length?S.tags.join(","):void 0})):p(!0)}).catch(k=>{y||(zg.warn("listContent (reader) failed",{err:k}),p(!0))}),()=>{y=!0}},[n,e,_,r]),L(()=>{if(!l)return;let y=setTimeout(()=>r.emit("contentRead",{contentId:e}),qg);return()=>clearTimeout(y)},[l,e,r]);let m=N(y=>{let S=y.target?.closest?.("a")?.getAttribute("href")??"";S&&!S.startsWith("#")&&r.emit("contentLinkClick",{contentId:e})},[r,e]);function g(){return d?i(vt,{tone:"error",message:o.errorGeneric,onRetry:f,strings:o}):l===null?i(vt,{message:o.contentLoading,strings:o}):i("article",{class:`${go}-content`,"data-testid":T.contentView,onClick:m,children:[l.image?i("img",{class:`${go}-content-hero`,src:l.image,alt:"",loading:"lazy"}):null,l.description?i("p",{class:`${go}-content-subtitle`,children:l.description}):null,i(gd,{text:l.content??""})]})}return i("div",{class:`${go}-module`,children:[i(Fr,{title:l?.title||t||o.moduleBack,backLabel:o.moduleBack,onBack:a,actions:s,testid:T.backHeader}),i("div",{class:`${go}-module-scroll`,"data-testid":T.contentScroll,children:g()})]})}var Ur=R.cssPrefix;function au({panelProps:e,enabledModules:t,nav:n,bus:o,hasUnread:r,onSelectConversation:a,onStartNewConversation:s,onSetPanelSize:l}){let c=e.options,d=c.strings,p=O(null),_=O(new Set);L(()=>{let V=p.current;if(!V)return;let te=Pr(V),W=le=>{le.key==="Escape"&&e.onClose?.()};return V.addEventListener("keydown",W),()=>{te(),V.removeEventListener("keydown",W)}},[e.onClose]);let u=ut(()=>n.sig.value).value,f=Ud(u),m=c.modules.byId[u.activeTab],g=e.composerActive&&m?.layout==="chat"&&f===void 0,y=e.composerApiRef,k=g&&e.view==="chat"&&e.canSend&&!e.activeForm&&!e.sendPreparing&&e.options.features.fileUpload,S=N(V=>{k&&y.current?.attachFromDrop(V)},[y,k]),{visible:b}=wr({containerRef:p,onDrop:S,disabled:!k});br(p.current,c.mode==="modal");let x=f?.kind==="iframe"||f?.kind==="content",P=t.length>1&&(zd(u)||!x),w=O(null);L(()=>{if(x&&w.current===null)w.current=e.panelSize,e.panelSize==="normal"&&l("expanded");else if(!x&&w.current!==null){let V=w.current;w.current=null,l(V)}},[x]);let D={push:n.push,pop:n.pop,switchTab:n.switchTab,switchToLayout:V=>{let te=t.find(W=>W.layout===V);te&&n.switchTab(te.id)},selectConversation:a,startNewConversation:s},q=V=>({options:c,transport:e.transport,strings:d,config:V,nav:D,bus:o,panelProps:e}),B=i(Pt,{panelProps:e,variant:"plain"});m&&_.current.add(m.id);let M=t.filter(V=>_.current.has(V.id)),F=V=>{if(V.layout==="chat")return i(bi,{...e,composerActive:g,containerEl:p.current,dragOver:b,composerAttachApiRef:y});let te=Hr[V.layout].Root;return te?i(te,{...q(V)}):null},H=()=>f?.kind==="iframe"?i(ou,{url:f.url,title:f.title,strings:d,onBack:n.pop,actions:B}):f?.kind==="content"?i(ru,{id:f.id,title:f.title,transport:e.transport,strings:d,bus:o,onBack:n.pop,actions:B}):null;return i("div",{ref:p,class:`${Ur}-panel ${Ur}-messenger`,role:"dialog","aria-modal":"false","aria-label":d.panelTitle,style:{position:"relative"},"data-testid":T.messengerHome,children:[i("div",{class:`${Ur}-messenger-body`,children:[M.map(V=>i("div",{class:`${Ur}-messenger-pane`,hidden:x||V.id!==m?.id,children:F(V)},V.id)),H()]}),P?i(tu,{modules:t,activeTab:u.activeTab,strings:d,hasUnread:r,onSelect:n.switchTab}):null,i(yi,{poweredBy:c.poweredBy}),c.size.resize?.enabled&&!(m?.layout==="chat"&&!f)?i(hr,{panelEl:p.current,resize:c.size.resize,position:c.position,initialSize:e.initialWidgetSize,onSizeChange:e.onWidgetSizeChange,strings:d}):null]})}var vo=R.cssPrefix;function iu({strings:e,onClose:t}){return i("div",{class:`${vo}-panel ${vo}-modules-empty`,role:"dialog","aria-label":e.panelTitle,"data-testid":T.modulesEmpty,children:[t?i("button",{type:"button",class:`${vo}-icon-btn ${vo}-modules-empty-close`,onClick:t,"aria-label":e.close,title:e.close,children:i(yt,{})}):null,i("p",{class:`${vo}-modules-empty-text`,children:e.modulesEmpty})]})}function Fn(e,t,n,o){let r={role:n,text:o};e.emit("message",r),t.onMessage?.(r)}var Si=ee.scope("hitl");function su(e){let{streaming:t,controlModeSig:n,messagesSig:o,sendAiTurn:r,bus:a,humanInLoop:s}=e,l=O(t);l.current=t;let c=N((u,f,m)=>{if(l.current||n.value!=="ai-agent")return!1;let g=o.value.at(-1),y=g?.partsSig.value.findIndex(S=>S.kind==="tool"&&S.toolCallId===u)??-1,k=g?.partsSig.value[y];return!g||k?.kind!=="tool"?(Si.warn("decideTool: tool part not found",{toolCallId:u}),!1):g.status!=="complete"||!lr(g,y)||!f(k)?!1:(m(k),g.partsSig.value=[...g.partsSig.value],rn(g)&&(g.status="streaming",g.retryAction={kind:"continue-assistant",messageId:g.serverMessageId??g.id},g.awaitingContinuation=!0,o.value=[...o.value],r({continueExisting:!0})),!0)},[n,o,r]),d=N((u,f,m)=>{let g=!1;if(c(u,k=>k.stateSig.value==="approval-requested",k=>{g=Tr(k.toolName);let S=k.approvalSig.value?.id??u;k.approvalSig.value={id:S,approved:f,reason:m},k.stateSig.value="approval-responded"})){if(g){Si.info("toolResult",{toolCallId:u}),a.emit("toolResult",{toolCallId:u});return}Si.info("toolDecision",{toolCallId:u,approved:f}),a.emit("toolDecision",{toolCallId:u,approved:f})}},[a,c]),p=N(u=>{c(u,f=>f.stateSig.value==="approval-responded"&&f.approvalSig.value?.approved!==void 0,f=>{let m=f.approvalSig.value?.id??u;f.approvalSig.value={id:m},f.stateSig.value="approval-requested"})},[c]);return{toolInteraction:ie(()=>({humanInLoop:s,onDecision:d,onEdit:p}),[s,d,p])}}function lu({callout:e,persistence:t}){let n=e?.text??"",o=e?.persistent??!0,[r,a]=$(()=>o?!1:t.loadCalloutDismissed(n));L(()=>{a(o?!1:t.loadCalloutDismissed(n))},[n,o,t]);let s=N(()=>{a(!0),o||t.saveCalloutDismissed(n)},[t,n,o]);return{dismissed:r,dismissCallout:s}}function cu(e){let{transport:t,conversationIdSig:n}=e,o=mt("ai-agent"),r=mt(void 0),a=mt(void 0),s=O(),l=N(_=>{let u=_.controlRevision??0,f=s.current;f&&f.conversationId===n.value&&u<f.revision||(s.current={conversationId:n.value,revision:u},o.value=_.controlMode,r.value=_.assignedOperatorInitials,_.controlMode!=="awaiting_operator"?a.value=void 0:_.operatorAvailable!==void 0&&(a.value=_.operatorAvailable))},[n,o,r,a]),c=N(_=>{_.type==="data-control-state"&&l(zt(_.data))},[l]),d=N(async()=>{let _=n.value,u=await t.requestOperator();u&&n.value===_&&l(zt(u))},[t,n,l]),p=N(async()=>{let _=n.value,u=await t.cancelOperatorRequest();u&&n.value===_&&l(zt(u))},[t,n,l]);return{controlModeSig:o,assignedOperatorInitialsSig:r,operatorAvailableSig:a,applyControlState:l,adoptControlStateChunk:c,requestOperator:d,cancelOperatorRequest:p}}var zr=R.cssPrefix,du=`--${zr}-visual-viewport-height`,uu=`--${zr}-visual-viewport-top`;function _u(e){let{hostElement:t,mode:n,panelSize:o,isOpen:r,surfaceReady:a,setIsOpen:s}=e;ht(()=>{Wo(t,nr(n,o,r))},[t,r,o,n]),ht(()=>{if(!r||!a)return;let l=t.ownerDocument.defaultView,c=l?.visualViewport,d=t.shadowRoot?.querySelector(`.${zr}-anchor`);if(!l||!c||!d)return;let p=()=>{d.style.setProperty(du,`${c.height}px`),d.style.setProperty(uu,`${c.offsetTop}px`)},_=0,u=()=>{l.cancelAnimationFrame(_),_=l.requestAnimationFrame(()=>{_=l.requestAnimationFrame(p)})};return p(),c.addEventListener("resize",u),c.addEventListener("scroll",u),()=>{l.cancelAnimationFrame(_),c.removeEventListener("resize",u),c.removeEventListener("scroll",u),d.style.removeProperty(du),d.style.removeProperty(uu)}},[t,r,a]),L(()=>{if(n!=="modal"||!r)return;let l=c=>{c.composedPath().some(p=>p instanceof HTMLElement&&p.classList.contains(`${zr}-panel`))||s(!1)};return t.addEventListener("click",l),()=>t.removeEventListener("click",l)},[t,r,n,s]),L(()=>{if(n!=="drawer"||!r)return;let l=c=>{c.key==="Escape"&&s(!1)};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[r,n,s])}var ki=ee.scope("reducer"),qr=class{constructor(t,n){se(this,"messagesSig",t);se(this,"onReconcileNeeded",n);se(this,"active",null);se(this,"openTextParts",new Map);se(this,"partSeq",0);se(this,"replay",null)}attach(t){this.active=t,this.openTextParts.clear()}detach(){this.active=null,this.replay=null,this.openTextParts.clear()}beginReplay(t,n){let o=Ot();o.id=t.id;let r=pn(t)||an(t)&&(t.status!=="streaming"||rn(t)),a=t.status==="streaming"&&rn(t)&&ao(t);this.replay={baseline:t,shadow:o,chunks:[n],probeContinuation:r,continuationTailReplay:a,liveCatchUp:t.status==="streaming"&&!r},this.attach(o),this.apply(n)}refreshReplayBaseline(){let t=this.replay;if(!t)return null;let n=t.shadow.serverMessageId??t.baseline.serverMessageId,o=this.messagesSig.value,r=o.at(-1),a=r===t.baseline||r?.id===t.baseline.id||n!==void 0&&r?.serverMessageId===n?r:o.find(l=>l===t.baseline)??o.find(l=>l.id===t.baseline.id||n!==void 0&&l.serverMessageId===n);if(!a)return this.detach(),null;if(a===t.baseline)return t;let s=t.baseline;return t.baseline=a,pu(s,a),t.liveCatchUp&&pn(t.shadow)&&(a.status==="streaming"||an(a))?(t.probeContinuation=!1,t.continuationTailReplay=!1,t):(t.probeContinuation=pn(a)||an(a)&&(a.status!=="streaming"||rn(a)),t.continuationTailReplay=a.status==="streaming"&&rn(a)&&ao(a),t.liveCatchUp=a.status==="streaming"&&!t.probeContinuation,t)}refreshActive(){let t=this.active;if(!t)return null;let n=t.serverMessageId,o=this.messagesSig.value,r=o.at(-1),a=r===t||r?.id===t.id||n!==void 0&&r?.serverMessageId===n?r:o.find(l=>l===t)??o.find(l=>l.id===t.id||n!==void 0&&l.serverMessageId===n);if(!a)return this.detach(),null;if(a===t)return t;pu(t,a);let s=pn(t)&&an(a);return a.status!=="streaming"&&!s?(this.detach(),null):(this.replay={baseline:a,shadow:t,chunks:[],probeContinuation:!1,continuationTailReplay:!1,liveCatchUp:!0},t)}promoteReplay(){let{baseline:t,shadow:n}=this.replay;return ft(()=>{t.role=n.role,t.serverMessageId=n.serverMessageId,t.operatorInitials=n.operatorInitials,t.status=n.status,n.canceled&&(t.canceled=!0),t.finishReason=n.finishReason,t.errorText=n.errorText,t.suggestions=n.suggestions??t.suggestions,t.partsSig.value=n.partsSig.value,this.messagesSig.value=[...this.messagesSig.value]}),this.replay=null,this.active=t,t}promoteContinuation(t=!1){let{baseline:n,chunks:o}=this.replay,r=cr(n);return this.replay=null,ft(()=>{if(t){let a=n.partsSig.value.findLastIndex(s=>s.kind==="tool");n.partsSig.value=n.partsSig.value.slice(0,a+1)}n.awaitingContinuation=!1,n.status="streaming",n.finishReason=void 0,n.errorText=void 0,n.suggestions=void 0,this.attach(n);for(let a of o)this.apply(a);n.continuationStreaming=r||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}settleOwnedContinuation(t){let{baseline:n}=this.replay,o=cr(n);return this.replay=null,ft(()=>{n.awaitingContinuation=!1,n.status="streaming",n.finishReason=void 0,n.errorText=void 0,n.suggestions=void 0,this.attach(n),this.apply(t),n.continuationStreaming=o||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}applyResume(t){if(t.type==="start"){let r=(this.replay?.baseline??this.active)?.serverMessageId;r!==void 0&&t.messageId!==void 0&&r!==t.messageId&&this.onReconcileNeeded?.({messageId:r}),this.detach();let a=t.messageId,s=a!==void 0?this.messagesSig.value.find(p=>p.serverMessageId===a||p.id===a):void 0;if(s!==void 0)return t.messageMetadata?.senderRole==="visitor"&&s.role==="user"&&(s.status==="pending"||s.status==="error")&&(s.serverMessageId=a,s.status="complete",s.errorText=void 0,s.retryAction=void 0,this.messagesSig.value=[...this.messagesSig.value]),this.beginReplay(s,t),null;let l=t.messageMetadata?.senderRole,c=this.messagesSig.value.at(-1);if(l===void 0&&c?.role==="assistant"&&c.status==="streaming"&&c.serverMessageId===void 0&&!bt(c))return this.attach(c),this.apply(t),null;let d=Ot();return this.attach(d),this.messagesSig.value=[...this.messagesSig.value,d],this.apply(t),null}if(this.replay){let o=this.refreshReplayBaseline();if(!o)return null;o.chunks.push(t),t.type==="data-control-state"&&(o.baseline.operatorRoutedTurn=t.data.controlMode!=="ai-agent"),this.apply(t);let{baseline:r,shadow:a,probeContinuation:s,continuationTailReplay:l,liveCatchUp:c}=o,d=t.type==="finish"||t.type==="error"||t.type==="abort";if(s){if(!Kg(r,a,t))return d&&(Yg(r,a)&&(r.continuationStreaming=!0,this.messagesSig.value=[...this.messagesSig.value],this.onReconcileNeeded?.({messageId:r.serverMessageId??r.id})),this.detach()),null;let _=pn(r)&&d?this.settleOwnedContinuation(t):this.promoteContinuation();return d?(_.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:_.serverMessageId??_.id}):_.continuationStreaming=!1),this.detach(),_):null}if(l&&Wg(r,a)){let _=this.promoteContinuation(!0);return d?(this.detach(),_):null}if(!c)return d&&this.detach(),null;if(d&&!bt(r)&&bt(a)){let _=this.promoteReplay();return this.detach(),_}if(!Vg(r,a))return d&&(this.onReconcileNeeded?.({messageId:r.serverMessageId??r.id}),this.detach()),null;let p=this.promoteReplay();return d?(this.detach(),p):null}let n=this.refreshActive();if(!n)return null;if(this.replay)return this.applyResume(t);if(this.apply(t),t.type==="finish"||t.type==="error"||t.type==="abort"){let o=n;return o.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:o.serverMessageId??o.id}):o.continuationStreaming=!1),this.detach(),o}return null}ensureTextPart(t,n,o){let r=`${n}:${o}`,a=this.openTextParts.get(r);if(a)return a;let s={kind:n,id:`${o}#${this.partSeq++}`,textSig:oe(""),doneSig:oe(!1)};return this.openTextParts.set(r,s),ho(t,s),s}apply(t){let n=this.active;if(n)switch(t.type){case"start":{t.messageId&&(n.serverMessageId=t.messageId);let o=t.messageMetadata;o?.senderRole==="operator"?(n.role="operator",o.operatorInitials&&(n.operatorInitials=o.operatorInitials)):o?.senderRole==="visitor"&&(n.role="user");return}case"finish-step":this.openTextParts.clear();return;case"start-step":ho(n,{kind:"step-start",id:`ss-${this.partSeq++}`});return;case"finish":ki.debug("finish",{reason:t.finishReason,canContinue:t.canContinue}),n.status="complete",n.retryAction=void 0,t.finishReason&&(n.finishReason=t.finishReason),this.bumpDone(n);return;case"error":ki.warn("stream error chunk",{errorText:t.errorText}),n.status="error",n.errorText=t.errorText,this.bumpDone(n);return;case"abort":ki.debug("stream abort chunk (canceled)"),n.status="complete",n.canceled=!0,n.retryAction=void 0,this.bumpDone(n);return;case"text-start":this.ensureTextPart(n,"text",t.id);return;case"text-delta":{let o=this.ensureTextPart(n,"text",t.id);o.textSig.value+=t.delta;return}case"text-end":this.ensureTextPart(n,"text",t.id).doneSig.value=!0;return;case"reasoning-start":this.ensureTextPart(n,"reasoning",t.id).doneSig.value=!1;return;case"reasoning-delta":{let o=this.ensureTextPart(n,"reasoning",t.id);o.textSig.value+=t.delta;return}case"reasoning-end":this.ensureTextPart(n,"reasoning",t.id).doneSig.value=!0;return;case"tool-input-start":case"tool-input-delta":case"tool-input-available":case"tool-input-error":case"tool-output-available":case"tool-output-error":case"tool-output-denied":case"tool-approval-request":Jg(n,t);return;case"file":ho(n,{kind:"file",url:t.url,mediaType:t.mediaType});return;case"source-url":fu(n,{kind:"source",sourceId:t.sourceId,url:t.url,title:t.title});return;case"source-document":fu(n,{kind:"source",sourceId:t.sourceId,title:t.title,filename:t.filename,mediaType:t.mediaType});return;case"data-suggestions":n.suggestions=rr(t.data);return;case"data-control-state":n.operatorRoutedTurn=t.data.controlMode!=="ai-agent";return;default:{let o=t}}}bumpDone(t){ft(()=>{t.partsSig.value=[...t.partsSig.value],this.messagesSig.value.includes(t)&&(this.messagesSig.value=[...this.messagesSig.value])})}},wi={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function pn(e){return e.awaitingContinuation===!0||e.continuationStreaming===!0||e.retryAction?.kind==="continue-assistant"}function pu(e,t){e.canceled&&(t.canceled=!0),!(!pn(e)||t.status!=="streaming"&&!an(t))&&(t.awaitingContinuation??(t.awaitingContinuation=e.awaitingContinuation),t.continuationStreaming??(t.continuationStreaming=e.continuationStreaming),t.retryAction===void 0&&(t.retryAction=e.retryAction))}function Vg(e,t){let n=e.partsSig.value,o=t.partsSig.value;return e.role!==t.role||o.length<n.length?!1:n.every((r,a)=>mu(r,o[a]))}function Wg(e,t){let n=e.partsSig.value,o=n.findLastIndex(l=>l.kind==="tool"),r=new Set(n.slice(0,o+1).flatMap(l=>l.kind==="tool"?[l.toolCallId]:[])),a=t.partsSig.value.filter(l=>l.kind!=="tool"||!r.has(l.toolCallId)),s=n.slice(o+1);return a.length<s.length?!1:s.every((l,c)=>mu(l,a[c]))}function mu(e,t){switch(e.kind){case"text":case"reasoning":return t?.kind===e.kind&&t.textSig.value.startsWith(e.textSig.value);case"step-start":return t?.kind==="step-start";case"tool":{if(t?.kind!=="tool"||t.toolCallId!==e.toolCallId||!dr(t.toolName,e.toolName)||wi[t.stateSig.value]<wi[e.stateSig.value])return!1;let n=e.approvalSig.value?.approved;return n===void 0||t.approvalSig.value?.approved===n}case"file":return t?.kind==="file"&&t.url===e.url&&t.mediaType===e.mediaType;case"source":return t?.kind==="source"&&t.sourceId===e.sourceId&&t.url===e.url&&t.title===e.title&&t.filename===e.filename&&t.mediaType===e.mediaType;default:return e}}function Kg(e,t,n){return Gg(e,n)||!jg(e,t)?!0:n.type!=="finish"&&n.type!=="error"&&n.type!=="abort"?!1:ao(t)||e.awaitingContinuation===!0&&n.type!=="finish"?!0:e.awaitingContinuation===!0&&t.partsSig.value.every(o=>o.kind==="step-start")}function Gg(e,t){if(t.type!=="tool-output-available"&&t.type!=="tool-output-error"&&t.type!=="tool-output-denied")return!1;let n=e.partsSig.value.find(o=>o.kind==="tool"&&o.toolCallId===t.toolCallId);return n!==void 0&&wi[n.stateSig.value]<4}function jg(e,t){let n=t.partsSig.value;if(n.length===0)return!0;let o=e.partsSig.value;return o.some((r,a)=>n.every((s,l)=>Xg(o[a+l],s)))}function Xg(e,t){switch(t.kind){case"text":case"reasoning":return e?.kind===t.kind&&e.textSig.value.startsWith(t.textSig.value);case"step-start":return e?.kind==="step-start";case"tool":return e?.kind==="tool"&&e.toolCallId===t.toolCallId&&(t.toolName==="tool"||dr(e.toolName,t.toolName));case"file":return e?.kind==="file"&&e.url===t.url&&e.mediaType===t.mediaType;case"source":return e?.kind==="source"&&e.sourceId===t.sourceId&&e.url===t.url&&e.title===t.title&&e.filename===t.filename&&e.mediaType===t.mediaType;default:return t}}function Yg(e,t){if(pn(e)||!an(e))return!1;let n=new Set(e.partsSig.value.filter(r=>r.kind==="tool").map(r=>r.toolCallId));return!t.partsSig.value.some(r=>r.kind==="tool"&&n.has(r.toolCallId))}function jt(e,t,n,o){let r=e.partsSig.value.find(s=>s.kind==="tool"&&s.toolCallId===t);if(r)return o&&(r.dynamic=!0),r;let a={kind:"tool",toolCallId:t,toolName:n??"tool",dynamic:o?!0:void 0,inputPartialSig:oe(""),inputSig:oe(void 0),outputSig:oe(void 0),errorSig:oe(void 0),stateSig:oe("input-streaming"),approvalSig:oe(void 0)};return ho(e,a),a}function ho(e,t){e.partsSig.value=[...e.partsSig.value,t]}function fu(e,t){e.partsSig.value.some(n=>n.kind==="source"&&n.sourceId===t.sourceId)||ho(e,t)}function Jg(e,t){switch(t.type){case"tool-input-start":jt(e,t.toolCallId,t.toolName,t.dynamic);return;case"tool-input-delta":{let n=jt(e,t.toolCallId);n.inputPartialSig.value+=t.inputTextDelta;return}case"tool-input-available":{let n=jt(e,t.toolCallId,t.toolName,t.dynamic);n.inputSig.value=t.input,n.stateSig.value="input-available";return}case"tool-input-error":{let n=jt(e,t.toolCallId,t.toolName,t.dynamic);n.inputSig.value=t.input,n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-approval-request":{let n=jt(e,t.toolCallId,t.toolName);n.approvalSig.value={id:t.approvalId},n.stateSig.value="approval-requested";return}case"tool-output-available":{let n=jt(e,t.toolCallId,void 0,t.dynamic);n.outputSig.value=t.output,n.stateSig.value="output-available";return}case"tool-output-error":{let n=jt(e,t.toolCallId,void 0,t.dynamic);n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-output-denied":{let n=jt(e,t.toolCallId);n.stateSig.value="output-denied";return}default:return}}async function gu(e){let t=1e3,n=!1,o=!1,r=!1,a=()=>{r||e.signal.aborted||(r=!0,e.onInitialBoundaryReady())};for(;!e.signal.aborted;){let s,l="held";try{l=await e.connect(()=>{if(e.signal.aborted)return;s=e.now();let c=n||o;n=!0,o=!1,r?c&&e.backfill():a()})}catch{}if(e.signal.aborted||(!n&&s===void 0&&(o=!0,a()),l==="unavailable"))return;s!==void 0&&e.now()-s>=1e3&&(t=1e3),await e.sleep(t),t=Math.min(t*2,15e3)}}var Qg=120;function vu(e){let{activated:t,conversationReady:n,conversationIdSig:o,messagesSig:r,optionsRef:a,transport:s,visitorId:l,adoptControlStateChunk:c,settleSuggestions:d,recordConversationReply:p,transcriptRecoverySig:_,beginConversationTranscript:u,commitConversationTranscript:f,onReplyLanded:m,runCancellation:g,canContinueRef:y,setCanSend:k,feedback:S,bus:b,loadInitialThread:x,shouldReconcileOnConnect:P}=e,w=O(0);L(()=>{if(!t||!n||!o.value)return;let D=o.value,q=new AbortController,B=C=>{},M=new qr(r,C=>B(C));s.primeIdentity(l,D);let F=!1,H=!1,V,te=!1,W,le=0,ae=y.current,xe,ue,ye=Date.now(),pe,Ze=!1,ot=!1,ct=(C,v,E)=>{if(!bt(C))return;let Q=r.value.findLast(Z=>!Z.ephemeral),j=C.serverMessageId??C.id;if(!(Q&&(Q.serverMessageId??Q.id)!==j))return sr(r.value,C,D,a.current.strings.newConversation,v,E)},Ge=(C,v,E,Q)=>{let j=ct(C,v,Q);if(!j)return;let Se=`${C.serverMessageId??C.id}:${E}:${j.preview??""}`;Se!==ue&&(ue=Se,s.publishConversation({...j,hasUnread:!0},!0))},je,Ye=()=>{je&&(clearTimeout(je.timer),je=void 0)},Je=()=>{let C=je;if(!C)return;clearTimeout(C.timer),je=void 0;let v=r.value.find(E=>(E.serverMessageId??E.id)===C.replyId);v?.role!=="assistant"&&v?.role!=="operator"||Ge(v,C.canContinue,C.generation,C.activityAt)},_t=(C,v,E,Q)=>{Ye(),je={replyId:C.serverMessageId??C.id,canContinue:v,generation:E,activityAt:Q,timer:setTimeout(Je,Qg)}},Pe=(C,v,E,Q=Date.now(),j=!0)=>{Ye();let Z=ct(C,v,Q);if(!Z)return;let ge=`${C.serverMessageId??C.id}:${E}`;ge!==xe&&(xe=ge,p(Z),j&&pe&&(Ze=!0))},Fe=(C,v)=>{(C||!g.localSendRef.current)&&g.settle(v),C&&m()},Ve=(C,v=[],E=!1,Q,j=ae,Z=le,Se=Date.now(),ge=!0)=>{let ke=a.current;if(C.canceled){Pe(C,j,Z,Se,ge),Fe(E,Q);return}let be=!0,We=C.status==="error";switch(Wl(C,We)){case"drop":r.value=r.value.filter(Le=>Le!==C),be=!1;break;case"complete-operator-routed":C.status="complete",E&&(S.play("messageReceived"),Fn(b,ke,"assistant",De(C)));break;case"error":{if(C.status="error",C.errorText=ke.strings.errorGeneric,E){S.play("error");let Le=new Error(We?"stream error chunk":"empty reply");b.emit("error",Le),ke.onError?.(Le)}break}case"complete":C.status="complete",E&&(S.play("messageReceived"),Fn(b,ke,"assistant",De(C))),d(C,v);break}be&&Pe(C,j,Z,Se,ge),Fe(E,Q)},et=C=>{if(q.signal.aborted||o.value!==D)return;if(c(C),C.type==="start"){Je();let Le=C.messageId===void 0?void 0:r.value.find(rt=>rt.serverMessageId===C.messageId||rt.id===C.messageId);te=Le!==void 0&&Le.status!=="streaming";let kt=W?.senderRole==="visitor"?W.messageId:void 0;if(W={messageId:C.messageId,senderRole:C.messageMetadata?.senderRole},le+=1,ye=Date.now(),ue=void 0,F=C.messageMetadata?.senderRole===void 0,H=!1,V=F?C.messageMetadata?.runId:void 0,F){let rt=C.messageId!==void 0&&r.value.some(xo=>xo.serverMessageId===C.messageId||xo.id===C.messageId),$t=r.value.at(-1),Po=C.messageId!==void 0&&($t?.serverMessageId===C.messageId||$t?.id===C.messageId),Xr=g.localSendRef.current&&(!rt||Po)&&$t?.role==="assistant"&&$t.status==="streaming"&&(Po||$t.serverMessageId===void 0&&$t.partsSig.value.length===0);H=g.captureStart(D,C,Xr,kt)}}let v=F&&(C.type==="finish"||C.type==="error"||C.type==="abort"),E=v?V:void 0,Q=v&&(H||g.ownsLocalRun(E)),j=le,Z=te;C.type==="finish"&&C.canContinue!==void 0&&(ae=C.canContinue);let Se=ae;v&&(F=!1,H=!1,V=void 0);let ge=M.applyResume(C),ke=W?.messageId,be=ke===void 0?void 0:r.value.find(Le=>Le.serverMessageId===ke||Le.id===ke);te&&W?.senderRole!=="visitor"&&(ge!==null||be?.status==="streaming")&&(te=!1,Z=!1);let We=!te&&(be?.role==="assistant"||be?.role==="operator");if(C.type==="text-delta"&&We&&_t(be,ae,le,ye),C.type==="text-end"&&(Ye(),We&&Ge(be,ae,le,ye)),C.type==="finish"&&C.canContinue===!1&&k(!1),!ge){v&&(Q||!g.localSendRef.current)&&g.settle(E);return}if(ge.role==="operator"){Z||(S.play("messageReceived"),Fn(b,a.current,"operator",De(ge))),Pe(ge,Se,j,ye),te=!1,v&&(Q||!g.localSendRef.current)&&g.settle(E);return}ge.role==="assistant"&&(Ve(ge,[],Q,E,Se,j,ye),te=!1)},pt=async C=>{let v=le,E=await s.loadConversation(D,C?{ids:[C]}:void 0).catch(()=>null);if(q.signal.aborted||o.value!==D||!E)return!1;E.controlState&&c({type:"data-control-state",data:E.controlState});let Q=r.value.at(-1),j=v===le&&(C===void 0||Q!==void 0&&(Q.serverMessageId===C||Q.id===C));if(!E.messages?.length)return!0;j&&(ae=E.canContinue??ae,k(ae));let Z=r.value,Se=C===void 0?Z.at(-1):Z.find(rt=>rt.serverMessageId===C||rt.id===C),{messages:ge,changed:ke}=io(Z,qt(E.messages));if(!ke)return!0;r.value=ge;let be=C===void 0?ge.at(-1):ge.find(rt=>rt.serverMessageId===C||rt.id===C),We=Se!==void 0&&be!==void 0&&(Se.id===be.id||Se.serverMessageId!==void 0&&Se.serverMessageId===be.serverMessageId),Le=be!==void 0&&be.status!=="streaming"&&(!We||Se?.status==="streaming"),kt=We&&Se?.status==="streaming"?Date.now():be?.createdAt;return j&&Le&&be.role==="assistant"?Ve(be,E.suggestions??[],g.localSendRef.current,void 0,E.canContinue??ae,v,kt,!1):j&&Le&&be.role==="operator"?Pe(be,E.canContinue??ae,v,kt,!1):j&&be?.role==="assistant"&&be.status!=="streaming"&&d(be,E.suggestions??[]),!0},z=new Set;B=({messageId:C})=>{if(z.has(C)||!r.value.some(E=>E.serverMessageId===C||E.id===C))return;z.add(C);let v=()=>z.delete(C);pt(C).then(v,v)};let G=(C=!1)=>{if(q.signal.aborted||o.value!==D){Ze=!1;return}if(pe){Ze=!0;return}let v=C?x(D)??(P()?pt():void 0):pt();if(!v)return;u(D),pe=v;let E=(Q=!1)=>{if(pe===v){if(pe=void 0,Ze){Ze=!1,G();return}Q&&f(D)}};v.then(E,()=>E(!1))},J=_.subscribe(C=>{C<=w.current||(w.current=C,ot&&G())});return gu({signal:q.signal,now:()=>performance.now(),sleep:C=>oo(C,q.signal),connect:C=>s.connectResumeStream({signal:q.signal,onChunk:et,onConnected:C}),onInitialBoundaryReady:()=>{ot=!0,G(!0)},backfill:()=>G()}),()=>{q.abort(),Ye(),J(),M.detach()}},[t,n,o,o.value,l,s,c,d,p,_,u,f,m,g,y,k,r,b,S,x,P])}var Zg=32;function hu(e){let{transport:t,setStreaming:n}=e,o=O(),r=O(),a=O(!1),s=O(),l=O(!1),c=O(new Map),d=O(new Set),p=N((P,w)=>{let D=`${P}:${w}`;s.current!==D&&(s.current=D,t.cancelTurn(P,w))},[t]),_=N(P=>{o.current=void 0,r.current=P,a.current=!1,s.current=void 0,l.current=!0,n(!0)},[n]),u=N((P,w)=>{c.current.set(P,{messageId:w})},[]),f=N(P=>{P!==void 0&&(d.current.add(P),d.current.size>Zg&&d.current.delete(d.current.values().next().value)),!(P!==void 0&&o.current?.runId!==P)&&(o.current=void 0,r.current=void 0,a.current=!1,l.current=!1,n(!1))},[n]),m=N((P,w)=>r.current!==P?w.runId&&o.current?.runId===w.runId?(o.current={conversationId:w.conversationId,runId:w.runId},a.current&&p(w.conversationId,w.runId),!0):!1:(r.current=void 0,w.runId?(o.current={conversationId:w.conversationId,runId:w.runId},n(!0),a.current&&p(w.conversationId,w.runId),!0):(f(),!0)),[p,n,f]),g=N((P,w)=>{let D=c.current.get(P);return D?(c.current.delete(P),!w.runId||d.current.has(w.runId)?!0:D.runId!==void 0?(D.runId!==w.runId||o.current?.runId===w.runId&&(o.current={conversationId:w.conversationId,runId:w.runId},a.current&&p(w.conversationId,w.runId)),!0):(l.current||r.current||(o.current={conversationId:w.conversationId,runId:w.runId},r.current=void 0,a.current=!1,s.current=void 0,l.current=!0,n(!0)),!0)):!1},[p,n]),y=N(P=>r.current!==P?!1:(f(),!0),[f]),k=N(P=>{let w=c.current.get(P);return w?(c.current.delete(P),w.runId===void 0):!1},[]),S=N((P,w,D,q)=>{let B=w.messageMetadata?.runId;if(w.messageMetadata?.senderRole!==void 0||typeof B!="string"||!B||d.current.has(B))return!1;if(o.current?.runId===B)return l.current;if(l.current)return o.current||!D?!1:(r.current=void 0,o.current={conversationId:P,runId:B},n(!0),a.current&&p(P,B),!0);let F=[...c.current.values()].filter(H=>H.runId===void 0).find(H=>H.messageId===q);return F?(F.runId=B,o.current={conversationId:P,runId:B},r.current=void 0,a.current=!1,s.current=void 0,l.current=!0,n(!0),!0):(r.current=void 0,o.current={conversationId:P,runId:B},n(!0),a.current&&p(P,B),l.current)},[p,n]),b=N(P=>typeof P=="string"&&o.current?.runId===P&&l.current,[]),x=N(()=>{let P=o.current;if(P)return a.current=!0,p(P.conversationId,P.runId),!0;let w=r.current;return w?(a.current=!0,w.then(D=>{D.runId&&p(D.conversationId,D.runId)}).catch(()=>{}),!0):!1},[p]);return ie(()=>({localSendRef:l,begin:_,beginRouted:u,acceptAck:m,acceptRoutedAck:g,reject:y,rejectRouted:k,captureStart:S,ownsLocalRun:b,settle:f,stop:x}),[m,g,_,u,S,b,y,k,f,x])}var ev=ee.scope("send");function yu(e,t,n,o,r,a=!0){e.publishConversation({...sr(t,n,o,r,a),hasUnread:!1},!0)}function Pu(e,t){return e.id===t.id||(e.serverMessageId??e.id)===(t.serverMessageId??t.id)}function xu(e){return e.findLast(t=>!t.ephemeral&&t.role!=="system"&&(t.role==="user"||t.status!=="streaming"||bt(t)))}function bo(e,t,n,o,r){let a=xu(t);!a||a.role!=="user"||!Pu(a,n)||yu(e,t,a,o,r)}function bu(e){return!(e instanceof He)||e.code==="network"||e.status===void 0||e.status===202?!0:e.status===408||e.status===425||e.status===429||e.status>=500&&e.status<600}function Su(e){let{transport:t,messagesSig:n,conversationIdSig:o,options:r,bus:a,feedback:s,persistence:l,visitorId:c,adoptConversationId:d,applyControlState:p,setCanSend:_,settleSuggestions:u,runCancellation:f}=e,m=N(()=>{let k=o.value??dt();return o.value||(o.value=k,l.saveConversationId(k)),k},[o,l]),g=N(async({continueExisting:k,turn:S})=>{let b=m(),x=n.value.at(-1),P=S?[S]:Bl(n.value,k),w=P[0],D=Ba({messages:P.map(Wa),conversationId:b,visitorId:c,userPrefs:l.loadUserPrefs()}),q=t.sendTurn(D);f.begin(q);try{let B=await q;if(o.value!==b||!f.acceptAck(q,B))return;if(d(B.conversationId),B.runId&&w?.role==="user"&&bo(t,n.value,w,B.conversationId,r.strings.newConversation),!B.runId){let M=await t.loadConversation(B.conversationId).catch(()=>null);if(o.value!==B.conversationId)return;if(M){M.controlState&&p(M.controlState),_(M.canContinue??!0);let F=qt(M.messages??[]),{messages:H,changed:V}=io(n.value,F);V&&(n.value=H);let te=F.findLast(ae=>!ae.ephemeral&&ae.role!=="system"),W=xu(n.value);W&&te&&Pu(W,te)&&yu(t,n.value,W,B.conversationId,r.strings.newConversation,M.canContinue??!0);let le=x?n.value.find(ae=>ae.id===x.id&&ae.role==="assistant"&&ae.status!=="streaming"):void 0;le&&u(le,M.suggestions??[]),!k&&x?.role==="assistant"&&n.value.includes(x)&&x.serverMessageId===void 0&&!bt(x)&&(n.value=n.value.filter(ae=>ae!==x))}else x?.role==="assistant"&&n.value.includes(x)&&(x.status="error",x.errorText=r.strings.errorGeneric,k?x.retryAction={kind:"continue-assistant",messageId:x.serverMessageId??x.id}:x.retryAction=w?.role==="user"?{kind:"resend-user",messageId:w.id}:null,n.value=[...n.value])}}catch(B){if(o.value!==b)return;if(!f.reject(q)){w?.role==="user"&&bo(t,n.value,w,b,r.strings.newConversation);return}let M=un(B,r.strings),F=bu(B),H=S?.role==="assistant"?S:n.value.at(-1);if(k&&H?.role==="assistant"&&B instanceof He&&B.status===409){let V=H.serverMessageId??H.id,te=await t.loadConversation(b,{ids:[V]}).catch(()=>null);if(o.value!==b)return;if(te){te.controlState&&p(te.controlState),_(te.canContinue??!0);let W=qt(te.messages??[]),le=W.find(ae=>(ae.serverMessageId??ae.id)===V);if(le&&ql(H,le)){let{messages:ae,changed:xe}=io(n.value,W),ue=ae.find(ye=>(ye.serverMessageId??ye.id)===V);if(xe&&ue&&ue!==H){ue.awaitingContinuation=!1,ue.continuationStreaming=void 0,ue.retryAction=null,n.value=ae,ue.status!=="streaming"&&u(ue,te.suggestions??[]);return}}}if(!n.value.includes(H)||H.status!=="streaming")return;H.continuationStreaming=!0}if(k&&H?.role==="assistant")H.status="error",H.errorText=M,H.retryAction=F?{kind:"continue-assistant",messageId:H.serverMessageId??H.id}:null,n.value=[...n.value];else if(x?.role==="assistant"&&n.value.includes(x)){x.status="error",x.errorText=M;let V=P[0];x.retryAction=F&&V?.role==="user"?{kind:"resend-user",messageId:V.id}:null,n.value=[...n.value]}else{let V=Ot();V.status="error",V.errorText=M;let te=P[0];V.retryAction=F&&te?.role==="user"?{kind:"resend-user",messageId:te.id}:null,n.value=[...n.value,V]}s.play("error"),a.emit("error",B),r.onError?.(B)}},[t,n,r,a,s,l,c,d,p,_,u,m,f]),y=N(async k=>{let S=m();k.status="pending",k.errorText=void 0,k.retryAction=void 0,n.value.includes(k)&&(n.value=[...n.value]);let b=Ba({messages:[Wa(k)],conversationId:S,visitorId:c,userPrefs:l.loadUserPrefs()}),x=t.sendTurn(b);f.beginRouted(x,k.id);try{let P=await x;if(o.value!==S){f.rejectRouted(x);return}if(!f.acceptRoutedAck(x,P))return;d(P.conversationId),bo(t,n.value,k,P.conversationId,r.strings.newConversation),k.status==="pending"&&(k.status="complete",n.value.includes(k)&&(n.value=[...n.value]))}catch(P){let w=f.rejectRouted(x);if(o.value!==S)return;if(!w){bo(t,n.value,k,S,r.strings.newConversation),k.status==="pending"&&(k.status="complete",n.value.includes(k)&&(n.value=[...n.value]));return}if(k.status!=="pending"){bo(t,n.value,k,S,r.strings.newConversation);return}ev.debug("operator-routed send failed",{error:P});let D=P instanceof Error?P:new Error(String(P));k.status="error",k.errorText=un(P,r.strings),k.retryAction=bu(P)?{kind:"resend-user",messageId:k.id}:null,n.value.includes(k)&&(n.value=[...n.value]),s.play("error"),a.emit("error",D),r.onError?.(D)}},[t,n,r,a,s,l,c,d,m,f]);return{sendAiTurn:g,sendRoutedTurn:y}}var tv=ee.scope("unread");function ku(e){let{transport:t,options:n,conversationIdSig:o,isConversationVisibleRef:r,activated:a,conversationReady:s}=e,l=mt(!1),c=mt(0),d=O([]),p=O(),_=O(!1),u=N(()=>{let P=o.value,w=r.current()&&p.current===P?P:void 0;l.value=d.current.some(D=>D.hasUnread&&D.conversationId!==w)},[o,l,r]),f=N(P=>{let w=o.value,D=d.current.find(F=>F.conversationId===w),q=Lt(d.current,P),B=q.find(F=>F.conversationId===w),M=P.type==="snapshot"&&w!==void 0&&B?.hasUnread===!0&&p.current===w&&D!==void 0&&D.lastMessageAt!==B.lastMessageAt;M&&(p.current=void 0),d.current=q,u(),M&&(c.value+=1)},[o,u,c]),m=N(()=>{if(u(),!r.current())return;let P=o.value;if(!P||p.current!==P)return;let w=d.current.find(D=>D.conversationId===P);w?.hasUnread&&t.markRead(P,w.lastMessageAt)},[o,r,u,t]),g=N(P=>{o.value===P&&(p.current=void 0,u())},[o,u]),y=N(P=>{o.value===P&&(p.current=P,m())},[o,m]),k=N(P=>p.current===P,[]),S=N((P=!1)=>{n.modules.list.some(w=>w.layout==="chat")&&(_.current||(_.current=!0,t.listConversations({limit:50},P).then(w=>{P||f({type:"snapshot",result:w,requestedRevision:0}),m()}).catch(w=>tv.debug("refreshUnread failed (non-fatal)",{err:w})).finally(()=>{_.current=!1})))},[f,m,n.modules,t]),b=N(P=>{let w=P.conversationId,D=r.current()&&o.value===w&&p.current===w,q=d.current.find(M=>M.conversationId===w),B=D&&(q?.lastMessageAt!==P.lastMessageAt||q.hasUnread);t.publishConversation({...P,hasUnread:!D},!0),B&&t.markRead(w,P.lastMessageAt)},[o,r,t]);L(()=>t.subscribeConversationChanges(f),[f,t]);let x=O(!1);return L(()=>{!a||!s||x.current||(x.current=!0,S())},[a,s,S]),L(()=>{if(!a)return;let P=()=>{document.visibilityState==="visible"&&(m(),S(!0))};return document.addEventListener("visibilitychange",P),()=>document.removeEventListener("visibilitychange",P)},[a,m,S]),{hasUnreadSig:l,transcriptRecoverySig:c,markVisibleConversationRead:m,beginConversationTranscript:g,commitConversationTranscript:y,isConversationTranscriptCommitted:k,recordConversationReply:b}}var yo=ee.scope("settings");function wu(e){let{options:t,persistence:n,transport:o,feedback:r,hostElement:a,bus:s}=e,l=n.loadUserPrefs(),[c,d]=$(()=>l.locale??t.locale),[p,_]=$(()=>l.themeMode??t.themeMode),[u,f]=$(()=>l.textSize??t.textSize),m=N(x=>{n.patchUserPrefs(x),o.saveUserPrefs(n.loadUserPrefs()).catch(P=>yo.warn("saveUserPrefs failed",{err:P}))},[n,o]);L(()=>{l.soundMuted!==void 0&&r.setMuted(l.soundMuted)},[]),L(()=>{a.dataset.theme=p},[a,p,t]),L(()=>{a.dataset.textSize=u},[a,u,t]),L(()=>{let x=!0;return r.mutedSig.subscribe(P=>{if(x){x=!1;return}m({soundMuted:P})})},[r,m]);let g=yn(c,t.availableLocales,t.defaultLocale);L(()=>{o.setLocale(g)},[o,g]),L(()=>{a.dir=es(g)?"rtl":"ltr"},[a,g]),L(()=>{g!==c&&d(g)},[g,c]);let y=N(x=>{yo.info("localeChange",{locale:x}),d(x),m({locale:x}),s.emit("localeChange",x)},[m,s]),k=N(x=>{yo.info("themeChange",{mode:x}),_(x),a.dataset.theme=x,m({themeMode:x}),s.emit("themeChange",x)},[a,m,s]),S=N(x=>{yo.info("textSizeChange",{size:x}),f(x),a.dataset.textSize=x,m({textSize:x}),s.emit("textSizeChange",x)},[a,m,s]),b=N(()=>{r.toggleMuted();let x=r.mutedSig.value;yo.info("soundToggle",{muted:x}),s.emit("soundToggle",{muted:x})},[r,s]);return{activeLocale:c,activeThemeMode:p,activeTextSize:u,effectiveLocale:g,setActiveLocale:d,setActiveThemeMode:_,setActiveTextSize:f,patchAndSync:m,handleLocaleChange:y,handleThemeChange:k,handleTextSizeChange:S,handleSoundToggle:b}}var he=ee.scope("app"),Vr=R.cssPrefix;function Cu(e,t){return $l({...e,text:Qe(t,e.text)})}function Ru({options:e,hostElement:t,bus:n}){let o=e.aiAgentDeploymentId;if(!o)throw new Error("aiAgentDeploymentId is required");let[r]=$(()=>Ut(e.widgetId,e.storage,e.aiAgentDeploymentId)),[a,s]=$(()=>r.getVisitorId()),l=r.loadUserPrefs(),c=mt(r.loadConversationId()),d=O(c.value!==void 0),p=mt(c.value??""),_=mt([]),[u,f]=$(!1),m=O(),[g,y]=$([]);function k(){let h=e.modules.list,A=new Set(h.map(K=>K.id)),X=r.loadActiveModule();return X&&A.has(X)?X:h[0]?.id??""}function S(){return e.modules.list.find(h=>h.layout==="chat")?.id}function b(){let h=S();return h?e.modules.list.length===1?!0:P.sig.value.activeTab===h:!1}let x=O();if(!x.current){let h=e.modules.list.map(X=>X.id),A=r.loadActiveModule()??h[0]??"";x.current=Bd(A,A?[...h,A]:h,X=>r.saveActiveModule(X))}let P=x.current,w=ut(()=>P.sig.value.activeTab).value,D=ut(()=>c.value).value,[q,B]=$(!1),[M,F]=$(null),[H,V]=$(!1),te=e.mode==="standalone"||e.mode==="inline",W=O(no(e,Tn(),r.loadPanelOpen(),r.loadPanelSize())),[le,ae]=$(W.current.panelOpen),[xe,ue]=$(W.current.panelOpen),ye=O(),pe=O(),Ze=O(!1),ot=O(void 0);L(()=>{le&&ue(!0)},[le]);let ct=O(!1),[Ge,je]=$(!1),{dismissed:Ye,dismissCallout:Je}=lu({callout:e.launcher.callout,persistence:r}),_t=e.launcher.callout?.persistent??!0,Pe=N(()=>{he.info("calloutDismiss"),n.emit("calloutDismiss",void 0),Je()},[n,Je]),[Fe,Ve]=$(W.current.panelSize),et=O(!1),[pt,z]=$("chat"),G=O(()=>!1);G.current=()=>le&&pt==="chat"&&!document.hidden&&b();let[J,C]=$(!0),v=O(J);v.current=J;let[E,Q]=$(!1),j=O(E);j.current=E;let Z=O(null),[Se,ge]=$(!1),[ke,be]=$(null),[We,Le]=$([]),kt=O(e.strings),rt=O(e);rt.current=e;let[$t,Po]=$(void 0),[Xr,xo]=$(void 0),[$u,Fu]=$(()=>r.loadSidebarCollapsed()??!1),[Yr,Bu]=$({}),[ce]=$(()=>new ir({agentApiBaseUrl:e.agentApiBaseUrl,dataApiBaseUrl:e.dataApiBaseUrl,auth:kl({publicKey:e.publicKey,aiAgentDeploymentId:o,publicKeyHeader:"x-public-key"}),endpoints:e.endpoints})),[at]=$(()=>new fr(e.sound,e.haptics)),Ft=hu({transport:ce,setStreaming:Q}),{activeLocale:So,activeThemeMode:Ni,activeTextSize:Di,effectiveLocale:fn,setActiveLocale:Hu,setActiveThemeMode:Uu,setActiveTextSize:zu,patchAndSync:$i,handleLocaleChange:qu,handleThemeChange:Vu,handleTextSizeChange:Wu,handleSoundToggle:Ku}=wu({options:e,persistence:r,transport:ce,feedback:at,hostElement:t,bus:n}),{controlModeSig:wt,assignedOperatorInitialsSig:Gu,operatorAvailableSig:ju,applyControlState:mn,adoptControlStateChunk:Xu,requestOperator:Yu,cancelOperatorRequest:Ju}=cu({transport:ce,conversationIdSig:c}),{hasUnreadSig:Qu,transcriptRecoverySig:Zu,markVisibleConversationRead:Fi,beginConversationTranscript:Jr,commitConversationTranscript:gn,isConversationTranscriptCommitted:Bi,recordConversationReply:e_}=ku({transport:ce,options:e,conversationIdSig:c,isConversationVisibleRef:G,activated:xe,conversationReady:q});L(()=>{Fi()},[w,le,pt,D,Fi]),L(()=>{at.update(e.sound,e.haptics)},[at,e.sound,e.haptics]),L(()=>()=>at.destroy(),[at]),L(()=>{et.current||!e.size.initialSize||(et.current=!0,!r.loadPanelSize()&&Ve(Fa(e.mode,e.size,Tn())))},[e.mode,e.size,r]),L(()=>{if(!q||ct.current)return;ct.current=!0;let h=no(e,Tn(),r.loadPanelOpen(),r.loadPanelSize());ae(h.panelOpen),Ve(h.panelSize)},[q,e,r]);let Hi=O(null);L(()=>{q&&P.reconcile(e.modules.list.map(h=>h.id),k())},[q,e.modules.list,P]);let ko=N(h=>{!h||h.length===0||(_.value=h.map(A=>Cu(A,kt.current)))},[_]),Qr=O(null),wo=N(async h=>{try{let{formSubmissions:A}=await(h?ce.bootstrap(h):Qr.current??ce.bootstrap()),X=new Map;return A.forEach((K,re)=>X.set(K.formId,re)),A.filter((K,re)=>!K.skipped||X.get(K.formId)===re).map((K,re)=>({key:`wire:${K.formId}:${K.createdAt??re}`,formId:K.formId,outcome:K.skipped?"skipped":"submitted",createdAt:or(K.createdAt),values:K.values}))}catch(A){return he.debug("bootstrap failed \u2014 no form markers (non-fatal)",{err:A}),[]}},[ce]),Bn=O(0),Ct=O(0),Zr=N((h,A)=>{if(h===c.value)return;let X=c.value;Ct.current++,f(!1),X&&(r.saveDraft(h,r.loadDraft(X)),r.saveDraft(X,"")),c.value=h,r.saveConversationId(h),ce.primeIdentity(void 0,h),he.info("conversation rebound",{previous:X,current:h,reason:A}),X&&n.emit("conversationRebound",{previous:X,current:h,...A?{reason:A}:{}})},[n,c,r,ce]),Co=N((h,A)=>{let X=[...h.map(I=>I.createdAt),...A.map(I=>I.createdAt)].filter(I=>I!==void 0),K=(X.length?Math.min(...X):Date.now())-1;return[...(ot.current?.messages??[]).map(I=>{let Oe=Cu(I,kt.current);return Oe.createdAt=K,Oe}),...h]},[]),Ui=N(async h=>{let A=Ct.current,X=()=>A!==Ct.current||c.value!==h;pe.current===h&&(pe.current=void 0),f(!0);try{let[K,re]=await Promise.all([ce.loadConversation(h),wo()]);if(X())return!1;let I=qt(K.messages??[]);y(re);let Oe=Co(ja(I,_.value),re);if(_.value=Oe,pe.current=Oe.some(we=>we.role==="user")?void 0:h,I.length>0||K.controlState!==void 0){C(K.canContinue??!0),mn(zt(K.controlState));let we=I.findLast(it=>it.role==="assistant"&&!it.ephemeral);Le(we?.suggestions??K.suggestions??[])}return!0}catch(K){return X()||(he.warn("loadThread failed; keeping conversation active",{err:K,conversationId:h}),n.emit("error",K),rt.current.onError?.(K)),!1}finally{X()||f(!1)}},[ce,wo,_,c,Co,n]),t_=N(h=>{if(ye.current===h)return ye.current=void 0,Ui(h)},[Ui]),n_=N(()=>{if(m.current)return Promise.resolve(void 0);let h=c.value,A=_.value.find(I=>!I.ephemeral),X=A?.serverMessageId??A?.id;if(!h||!X)return Promise.resolve(void 0);let K=Ct.current,re={};return m.current=re,(async()=>{try{let I=await ce.loadConversation(h,{beforeId:X});if(m.current!==re||Ct.current!==K||c.value!==h)return;if(I.messages.length===0)return!1;let Oe=I.messages.map(Va),_e=_.value,we=Ul(_e,Oe);if(we!==_e){let it=Math.min(...Oe.map(Rt=>Rt.createdAt??1/0),...g.map(Rt=>Rt.createdAt??1/0));if(Number.isFinite(it))for(let Rt of _e){if(!Rt.ephemeral)break;(Rt.createdAt??1/0)>=it&&(Rt.createdAt=it-1)}_.value=we}return!0}catch(I){if(m.current!==re||Ct.current!==K||c.value!==h)return;he.warn("load previous messages failed",{err:I,conversationId:h,beforeId:X}),n.emit("error",I),e.onError?.(I);return}finally{m.current===re&&(m.current=void 0)}})()},[n,c,g,_,e,ce]),Hn=N(async({newConversation:h})=>{let A=++Bn.current,X=()=>A!==Bn.current,K=c.value,re=h||!K?dt():K;re!==K&&(Ct.current++,f(!1),ft(()=>{c.value=re,p.value=re}),r.saveConversationId(re)),ce.primeIdentity(a,re);let I;try{I=await ce.handshake({visitorId:a,conversationId:re,userPrefs:r.loadUserPrefs(),locale:So})}catch(_e){if(X())return;n.emit("error",_e),e.onError?.(_e),h||B(!0);return}if(X())return;if(I.visitorId&&I.visitorId!==a&&(he.info("visitor rebound",{previous:a,current:I.visitorId,reason:I.rebind?.visitorId}),r.setVisitorId(I.visitorId),s(I.visitorId),n.emit("visitorRebound",{previous:a,current:I.visitorId,reason:I.rebind?.visitorId})),I.conversationId!==re&&Zr(I.conversationId,I.rebind?.conversationId),I.agent&&be(I.agent),mn(zt(I.controlState)),e.mode==="page"&&(I.site&&xl(I.site)?Po(I.site):I.site&&he.warn("invalid site config, using fallback",{site:I.site}),I.blocks&&Sl(I.blocks)?xo(I.blocks):I.blocks&&he.warn("invalid blocks config, using fallback",{blocks:I.blocks})),I.userPrefs&&!h&&(r.saveUserPrefs(I.userPrefs),I.userPrefs.locale&&Hu(I.userPrefs.locale),I.userPrefs.soundMuted!==void 0&&at.setMuted(I.userPrefs.soundMuted),I.userPrefs.themeMode&&Uu(I.userPrefs.themeMode),I.userPrefs.textSize&&zu(I.userPrefs.textSize)),ot.current=I.welcome,h||n.emit("handshake",I),I.welcome?.suggestions){let _e=kt.current;Le(I.welcome.suggestions.map(we=>({...we,label:Qe(_e,we.label),...we.text===void 0?{}:{text:Qe(_e,we.text)}})))}let Oe=!h&&K&&I.conversationId===K;d.current=!!Oe,Oe?Ze.current||(ye.current=I.conversationId):(pe.current=I.conversationId,ko(I.welcome?.messages),gn(I.conversationId)),h||B(!0)},[ce,a,r,e,n,c,p,at,ko,So,Zr,gn]),Un=JSON.stringify(e.userContext??null),o_=JSON.stringify(e.pageContext??null),r_=JSON.stringify(Yr);L(()=>{let h=Object.keys(Yr).length?{...Yr,...e.userContext}:e.userContext;ce.setContext(h,nv(e.pageContext))},[ce,Un,o_,r_]);let zi=N((h,A=[])=>Le(h.suggestions??A),[]);L(()=>(ce.primeIdentity(a,c.value),Hn({newConversation:!1}),()=>{Bn.current++,Ct.current++}),[]),L(()=>{!xe||!q||Ze.current||(Ze.current=!0,Qr.current=ce.bootstrap(),(async()=>{try{let h=await Qr.current;F(Gn((h??{forms:[]}).forms,fn))}catch(h){he.debug("bootstrap failed \u2014 treating as no forms",{err:h})}finally{V(!0)}})(),ye.current===c.value&&f(!0))},[xe,q]);let Ro=O(null);L(()=>{if(!xe||!q)return;if(Ro.current===null){Ro.current=fn;return}if(Ro.current===fn)return;Ro.current=fn;let h=!1;return ce.bootstrap().then(A=>{h||F(Gn((A??{forms:[]}).forms,fn))}).catch(A=>he.debug("forms re-localize failed \u2014 keeping current copy",{err:A})),()=>{h=!0}},[xe,q,fn,ce]);let qi=O(Un);L(()=>{!q||qi.current===Un||(qi.current=Un,Hn({newConversation:!1}))},[Un,q,Hn]),_u({hostElement:t,mode:e.mode,panelSize:Fe,isOpen:le,surfaceReady:q,setIsOpen:ae});let{sendAiTurn:Xt,sendRoutedTurn:zn}=Su({transport:ce,messagesSig:_,conversationIdSig:c,options:e,bus:n,feedback:at,persistence:r,visitorId:a,adoptConversationId:Zr,applyControlState:mn,setCanSend:C,settleSuggestions:zi,runCancellation:Ft}),{toolInteraction:a_}=su({streaming:E,controlModeSig:wt,messagesSig:_,sendAiTurn:Xt,bus:n,humanInLoop:e.features.humanInLoop}),i_=N((h,A)=>{let X=_.value.find(K=>K.serverMessageId===h);X&&(X.feedback=A),he.info("messageFeedback",{messageId:h,value:A}),n.emit("messageFeedback",{messageId:h,value:A}),ce.submitFeedback({messageId:h,value:A})},[n,_,ce]),s_=()=>_.value.reduce((h,A)=>h+(A.role==="user"?1:0),0),vn=e.forms.list.length>0?e.forms:M??e.forms,Ee=Od({forms:vn,persistence:r,userContext:()=>e.userContext,messageCount:s_,pageArea:()=>e.pageContext?.area?String(e.pageContext.area):void 0,conversationId:()=>c.value,onComplete:(h,A,X,K)=>{he.info("formSubmit",{formId:h.id,trigger:A,skipped:K}),n.emit("formSubmit",{formId:h.id,values:X,skipped:K}),y(I=>{let _e=I.find(we=>we.formId===h.id&&we.outcome==="skipped")?.createdAt??Date.now();return[...I.filter(we=>!(we.formId===h.id&&we.outcome==="skipped")),{key:`local:${h.id}:${_e}`,formId:h.id,outcome:K?"skipped":"submitted",createdAt:_e,...K?{}:{values:X}}]});let re=c.value??dt();c.value||(c.value=re,r.saveConversationId(re),ce.primeIdentity(void 0,re)),!K&&h.mirrorToContext&&Bu(I=>({...I,...X})),ce.submitForm({formId:h.id,conversationId:re,trigger:A,values:X,skipped:K})}}),ea=ut(()=>Ee.activeForm.value),l_=N(()=>Ee.fire("after-messages"),[Ee]),c_=N(()=>d.current||_.value.some(h=>!h.ephemeral&&h.role==="user"),[_]);vu({activated:xe,conversationReady:q,conversationIdSig:c,messagesSig:_,optionsRef:rt,transport:ce,visitorId:a,adoptControlStateChunk:Xu,settleSuggestions:zi,recordConversationReply:e_,transcriptRecoverySig:Zu,beginConversationTranscript:Jr,commitConversationTranscript:gn,onReplyLanded:l_,runCancellation:Ft,canContinueRef:v,setCanSend:C,feedback:at,bus:n,loadInitialThread:t_,shouldReconcileOnConnect:c_}),L(()=>{Ee.refresh()},[vn,Ee]);let Vi=e.pageContext?.area?String(e.pageContext.area):void 0,d_=ut(()=>_.value.length);L(()=>{q&&H&&Ee.fire("pre-chat")},[q,H,Ee]),L(()=>{H&&!J&&Ee.fire("conversation-closed")},[H,J,Ee]),L(()=>{q&&H&&Vi&&Ee.fire("page-area")},[q,H,Vi,Ee]);let ta=ie(()=>{let h=vn.list.flatMap(A=>A.triggers).filter(A=>A.kind==="idle").map(A=>Number(A.param));return h.length?Math.min(...h)*1e3:0},[vn]);L(()=>{if(!ta||!le)return;let h=setTimeout(()=>Ee.fire("idle"),ta);return()=>clearTimeout(h)},[ta,le,Ee,d_.value]);let Wi=N(async(h,A)=>{if(Z.current)return!1;let X=c.value,K=wt.value!=="ai-agent";if(he.info("send",{textLen:h.length,attachments:A.length,streaming:j.current,routedToOperator:K}),j.current&&!K)return!1;let re=new AbortController,I={conversationId:X,controller:re};Z.current=I,ge(!0);try{at.unlock();let Oe=await rv(ce,A,re.signal,it=>{re.signal.aborted||(he.warn("upload failed",{err:it}),n.emit("error",it),e.onError?.(it))});if(re.signal.aborted||c.value!==X||!v.current||Ee.activeForm.value)return!1;let _e=wt.value!=="ai-agent";if(j.current&&!_e||!h&&Oe.length===0)return!1;n.emit("send",{text:h,attachmentCount:A.length}),We.length>0&&Le([]),at.play("messageSent");let we=qa(h,Oe);return Fn(n,e,"user",h),_e?(_.value=[..._.value,we],zn(we),!0):(_.value=[..._.value,we,Ot()],Xt({continueExisting:!1}),!0)}finally{Z.current===I&&(Z.current=null,ge(!1))}},[ce,n,e,We.length,_,c,Xt,zn,wt]);L(()=>{let h=c.value;return()=>{let A=Z.current;!A||A.conversationId!==h||(Z.current=null,ge(!1),A.controller.abort())}},[c.value]),L(()=>{J&&!ea.value||Z.current?.controller.abort()},[ea.value,J]);let u_=N(()=>{if(!Ft.stop())return;he.info("stop"),n.emit("stop",void 0);let h=_.value.at(-1);h&&h.role!=="user"&&h.status==="streaming"&&(h.canceled=!0,_.value=[..._.value])},[Ft,n,_]),__=N(h=>{if(E)return;let A=_.value,X=ur(A,h);if(X)switch(he.info("retry",{kind:X.kind,messageId:X.messageId}),X.kind){case"continue-assistant":{if(wt.value!=="ai-agent"||h.role!=="assistant"||(h.serverMessageId??h.id)!==X.messageId)return;h.status="streaming",h.errorText=void 0,h.retryAction=void 0,h.awaitingContinuation=!0,_.value=[...A],Xt({continueExisting:!0,turn:h});return}case"resend-user":{let K=A.find(I=>I.role==="user"&&I.id===X.messageId);if(!K)return;if(K.status="complete",K.errorText=void 0,K.retryAction=void 0,wt.value!=="ai-agent"){_.value=h.role==="assistant"?A.filter(I=>I!==h):[...A],zn(K);return}let re=Ot();_.value=h.role==="assistant"?A.map(I=>I===h?re:I):[...A,re],Xt({continueExisting:!1,turn:K});return}case"repeat-user":{let K=A.find(_e=>_e.role==="user"&&_e.id===X.messageId);if(!K)return;let re=qa(De(K),K.attachments?.map(_e=>({..._e}))??[]),I=new Set(re.attachments?.flatMap(_e=>_e.url?[_e.url]:[])??[]),Oe=K.partsSig.value.flatMap(_e=>_e.kind==="file"&&!I.has(_e.url)?[{..._e}]:[]);if(Oe.length>0&&(re.partsSig.value=[...re.partsSig.value,...Oe]),wt.value!=="ai-agent"){_.value=[...A,re],zn(re);return}_.value=[...A,re,Ot()],Xt({continueExisting:!1,turn:re});return}default:return X}},[E,_,wt,Xt,zn]),qn=N(()=>{if(Oc(e.mode,Fe)==="exit-fullscreen"){he.info("close \u2192 exit-fullscreen",{mode:e.mode}),Ve("normal"),n.emit("fullscreen",!1);return}he.info("close \u2192 panel closed",{mode:e.mode}),Ee.fire("panel-close"),ae(!1),r.savePanelOpen(!1),n.emit("close",void 0),e.onClose?.()},[n,e,r,Fe,Ee]),na=N(()=>{he.info("open",{mode:e.mode}),at.unlock(),je(!0),ae(!0),r.savePanelOpen(!0),!Ye&&!_t&&Pe(),setTimeout(()=>je(!1),ov),n.emit("open",void 0),e.onOpen?.()},[n,e,at,r,Ye,_t,Pe]),oa=N(()=>{let h=_.value.some(A=>A.role==="user");if(pe.current===c.value&&!h&&J&&c.value){he.info("clear \u2192 reusing empty conversation",{conversationId:c.value}),_.value.length===0&&ko(ot.current?.messages);return}he.info("clear \u2192 new conversation",{wasStreaming:E}),n.emit("clear",void 0),Ft.settle(),d.current=!1,ye.current=void 0,pe.current=void 0,ft(()=>{_.value=[],c.value=void 0,mn({controlMode:"ai-agent",controlRevision:0})}),r.clearConversation(),C(!0),y([]),Le([]),Hn({newConversation:!0})},[E,_,c,r,Hn,n,J,ko,Ft,mn]),ra=N(()=>{oa(),z("chat");let h=e.modules.list.find(A=>A.layout==="chat")?.id;h&&P.switchTab(h)},[oa,P,e]),aa=N(()=>{let h=Fe==="expanded"?"normal":"expanded";he.info("expand",{from:Fe,expanded:h==="expanded"}),Ve(h),r.savePanelSize(h),n.emit("expand",h==="expanded")},[n,Fe,r]),ia=N(()=>{let h=Fe==="fullscreen"?"normal":"fullscreen";he.info("fullscreen",{from:Fe,fullscreen:h==="fullscreen"}),Ve(h),r.savePanelSize(h),n.emit("fullscreen",h==="fullscreen")},[n,Fe,r]),p_=N(()=>{z(h=>{let A=h==="history"?"chat":"history";return he.info("toggleHistory",{view:A}),n.emit("toggleHistory",{view:A}),A})},[n]),f_=N(()=>{Fu(h=>{let A=!h;return he.info("sidebarToggle",{collapsed:A}),r.saveSidebarCollapsed(A),n.emit("sidebarToggle",{collapsed:A}),A})},[r,n]),m_=N(h=>{he.info("resize",h),$i({widgetSize:h}),n.emit("resize",h)},[$i,n]),g_=N(async h=>{let A=h.conversationId;if(A===c.value&&Bi(A)){he.info("selectConversation",{conversationId:A,cached:!0}),n.emit("selectConversation",{conversationId:A}),ce.publishConversation(h),z("chat");let I=S();I&&P.switchTab(I),gn(A);return}let K=++Bn.current;Ct.current++,f(!1);let re=()=>K!==Bn.current;he.info("selectConversation",{conversationId:A,wasStreaming:E}),n.emit("selectConversation",{conversationId:A}),ce.publishConversation(h);try{let[I,Oe]=await Promise.all([ce.loadConversation(A),wo(A)]);if(re())return;Ft.settle(),d.current=!0,ye.current=void 0;let _e=qt(I.messages),we=I.conversationId!==c.value,it=we?_e:ja(_e,_.value);pe.current=it.some(Io=>Io.role==="user")?void 0:I.conversationId,ft(()=>{_.value=Co(it,Oe),we&&(p.value=I.conversationId),c.value=I.conversationId}),y(Oe),r.saveConversationId(I.conversationId),ce.primeIdentity(a,I.conversationId),I.agent&&be(I.agent),C(I.canContinue),mn(zt(I.controlState));let Rt=it.findLast(Io=>Io.role==="assistant"&&!Io.ephemeral);Le(Rt?.suggestions??I.suggestions??[]),we?Jr(I.conversationId):gn(I.conversationId),z("chat");let Ji=S();Ji&&P.switchTab(Ji)}catch(I){if(re())return;n.emit("error",I),e.onError?.(I)}},[ce,_,c,p,n,e,r,wo,Co,E,a,Ft,Jr,gn,Bi,P]),To=O(null),Ki=N(h=>{typeof h=="string"&&(H?Ee.fire("manual",h):To.current=h)},[H,Ee]);L(()=>{!H||!To.current||(Ee.fire("manual",To.current),To.current=null)},[H,Ee]);let hn=O({handleOpen:na,handleClose:qn,handleExpand:aa,handleFullscreen:ia,openForm:Ki});hn.current={handleOpen:na,handleClose:qn,handleExpand:aa,handleFullscreen:ia,openForm:Ki},ht(()=>Us(t,{open:()=>hn.current.handleOpen(),close:()=>hn.current.handleClose(),expand:()=>hn.current.handleExpand(),fullscreen:()=>hn.current.handleFullscreen(),openForm:h=>hn.current.openForm(h)}),[t]);let Xe=ie(()=>ya(e,So,Ni,Di),[e,So,Ni,Di]);kt.current=Xe.strings;let v_=ie(()=>g.map(h=>{let A=vn.list.find(X=>X.id===h.formId);return{...h,title:A?.title,form:A}}),[g,vn]),sa=h=>{g_(h)},Gi={options:Xe,transport:ce,feedback:at,bus:n,persistence:r,conversationId:c.value??"",composerKey:p.value,composerApiRef:Hi,view:pt,canSend:J,isStreaming:E,sendPreparing:Se,composerActive:Xe.mode==="page"||Xe.mode==="inline"||Xe.mode==="standalone"||le,controlMode:wt.value,assignedOperatorInitials:Gu.value,operatorAvailable:ju.value,operatorRequestEnabled:e.features.operatorRequest,onRequestOperator:Yu,onCancelOperatorRequest:Ju,loadingMessages:u,onLoadPreviousMessages:n_,messagesSig:_,agent:ke,suggestions:We,initialWidgetSize:l.widgetSize??null,onClose:qn,onClear:oa,onExpand:aa,onFullscreen:ia,onSoundToggle:Ku,onToggleHistory:p_,onSelectHistoryConversation:sa,onNewConversation:ra,onLocaleChange:qu,onThemeChange:Vu,onTextSizeChange:Wu,onWidgetSizeChange:m_,onSend:Wi,onStop:u_,onSuggestion:h=>{if(Z.current)return;let A=h.text??h.label;he.info("suggestion",{text:A,autoSend:e.autoSendSuggestions}),n.emit("suggestion",{text:A}),e.autoSendSuggestions?Wi(A,[]):Hi.current?.fill(A)},activeForm:ea.value?.form??null,formMarkers:v_,onFormSubmit:Ee.complete,onFormSkip:Ee.skip,onFormFill:h=>Ee.fire("manual",h),tool:a_,onRetry:__,onMessageFeedback:i_};if(!q)return null;let Vn=Xe.modules.list,la=h=>{let A=Mn("close",Xe.mode,h);return Vn.length===0?i(iu,{strings:Xe.strings,onClose:A?qn:void 0}):Vn.length===1&&Vn[0]?.layout==="chat"?i(Ld,{...Gi,panelSize:h}):i(au,{panelProps:{...Gi,panelSize:h,onClose:A?qn:void 0},enabledModules:Vn,nav:P,bus:n,hasUnread:Qu.value,onSelectConversation:sa,onStartNewConversation:ra,onSetPanelSize:Ve})};if(e.mode==="page"){let h=Vn.some(A=>A.layout==="chat");return i("div",{class:`${Vr}-anchor`,children:i($d,{site:$t,blocks:Xr,transport:ce,strings:Xe.strings,locale:Xe.locale,persistence:r,showConversations:h,onSelectConversation:sa,onNewConversation:ra,sidebarCollapsed:$u,onToggleSidebarCollapsed:f_,children:la("fullscreen")})})}if(te){let h=e.mode==="standalone"?"fullscreen":Fe;return i("div",{class:`${Vr}-anchor`,children:la(h)})}let ji=e.mode==="drawer",Xi=!(e.mode==="modal")&&!e.launcher.hidden&&(!le||Ge),Yi=Xi&&!Ge&&!Ye&&!ji?Xe.launcher.callout:null;return i("div",{class:`${Vr}-anchor`,"data-launcher-size":Xe.launcher.size,children:[le||xe?i("div",{class:`${Vr}-surface`,hidden:!le,children:la(Fe)}):null,Xi?i(Ac,{onToggle:na,launcher:Xe.launcher,strings:Xe.strings,leaving:Ge,edgeTab:ji}):null,Yi?i(Mc,{callout:Yi,launcherPosition:Xe.position,strings:Xe.strings,closeLabel:Xe.strings.close,onDismiss:Pe}):null]})}function nv(e){let t=e?.url??(typeof location<"u"?location.href:void 0);if(!(!e&&!t))return{...e,...t?{url:t}:{}}}var ov=120;async function rv(e,t,n,o){return(await Promise.all(t.map(async a=>{try{let{id:s,url:l}=await e.uploadFile(a.file,n);return{id:s,name:a.name,mediaType:a.mediaType,size:a.size,url:l}}catch(s){o(s);return}}))).filter(a=>a!==void 0)}var av=ee.scope("error-boundary"),Wr=class extends tt{constructor(){super(...arguments);se(this,"state",{crashed:!1})}componentDidCatch(n,o){av.error("widget render crashed",{error:n,componentStack:o?.componentStack}),this.setState({crashed:!0}),this.props.onError(n,o?.componentStack)}render(){return this.state.crashed?this.props.fallback:this.props.children}};var iv="1",sv=60,lv=2e3,Tu={open:()=>{},close:()=>{},expand:e=>({on:e}),fullscreen:e=>({on:e}),send:e=>({attachments:e.attachmentCount}),message:e=>({role:e.role}),stop:()=>{},clear:()=>{},suggestion:()=>{},toggleHistory:e=>({view:e.view}),handshake:()=>{},formSubmit:e=>({formId:e.formId,skipped:e.skipped}),toolResult:()=>{},toolDecision:e=>({approved:e.approved}),messageFeedback:e=>({value:e.value??"none"}),contentView:e=>({section:e.section,tags:e.tags,count:e.count}),contentOpen:e=>({contentId:e.contentId,tags:e.tags}),contentSearch:e=>({qlen:e.queryLength,hits:e.hitCount}),contentRead:e=>({contentId:e.contentId}),contentLinkClick:e=>({contentId:e.contentId}),attach:e=>({count:e.count,bytes:e.totalBytes}),voiceStart:()=>{},voiceStop:e=>({ms:e.durationMs}),voiceCancel:()=>{},localeChange:e=>({locale:e}),themeChange:e=>({theme:e}),textSizeChange:e=>({size:e}),soundToggle:e=>({muted:e.muted}),sidebarToggle:e=>({collapsed:e.collapsed}),calloutDismiss:()=>{},error:()=>{}};function cv(){let e=navigator;return e.globalPrivacyControl===!0||e.doNotTrack==="1"}function dv(){return location.origin+location.pathname}function uv(){try{return document.referrer?new URL(document.referrer).origin:""}catch{return""}}function Iu(e,t){let n=Math.random(),o=0,r=0,a=new Set,s=(c,d)=>{let{tracking:p,publicKey:_,aiAgentDeploymentId:u,mode:f,themeMode:m}=t.getOptions();if(!p.enabled||cv()||n>=p.sampleRate)return;let g=performance.now();if(g-o>6e4&&(o=g,r=0),++r>sv)return;let y=new URLSearchParams;y.set("v",iv),y.set("_ev",xn),y.set("e",c),p.token&&y.set("tk",p.token),_&&y.set("pk",_),u&&y.set("dep",u),y.set("vid",t.getVisitorId());let k=t.getConversationId();k&&y.set("cid",k),y.set("url",dv());let S=uv();S&&y.set("ref",S),y.set("sw",String(screen.width)),y.set("sh",String(screen.height)),y.set("vw",String(innerWidth)),y.set("vh",String(innerHeight)),y.set("dpr",String(devicePixelRatio)),y.set("lang",navigator.language);try{y.set("tz",Intl.DateTimeFormat().resolvedOptions().timeZone)}catch{}if(y.set("m",f),y.set("th",m),d)for(let[w,D]of Object.entries(d))D!==void 0&&y.set(w,String(D));y.set("ts",String(Date.now()));let b=`${p.endpoint}?${y}`;if(b.length>lv)return;let x=new Image(1,1);a.add(x);let P=()=>a.delete(x);x.addEventListener("load",P,{once:!0}),x.addEventListener("error",P,{once:!0}),x.src=b},l=Object.keys(Tu).map(c=>e.on(c,d=>s(c,Tu[c]?.(d))));return()=>{for(let c of l)c();a.clear()}}function Kr(e){let{bus:t,host:n,appRoot:o,persistence:r,reportError:a}=e,s=e.initialRaw,l,c=Bt(s),d=!0,p=()=>{c=Bt(l?Pa(s,l):s)},_=()=>{Ys(n,en(c.mode));let m=r.loadUserPrefs().themeMode;Js(n,m?{...c,themeMode:m}:c),d&&(Wo(n,Ci(c)),d=!1)},u=()=>{_(),Qt(Et(Wr,{onError:a},Et(Ru,{bus:t,hostElement:n,options:c})),o)};t.on("handshake",m=>{m.config&&(m.config.storageVersion&&r.rememberStorageVersion(m.config.storageVersion),l=m.config,p(),u())});let f=Iu(t,{getOptions:()=>c,getVisitorId:()=>r.getVisitorId(),getConversationId:()=>r.loadConversationId()});return{getOptions:()=>c,getUserOptions:()=>s,render:u,setUserOptions:m=>{s=m,p(),u()},patchUserOptions:m=>{s={...s,...m},p(),u()},destroy:()=>f()}}function Ci(e){if(e.mode==="standalone")return"standalone";if(e.mode==="inline")return"inline";let t=Ut(e.widgetId,e.storage,e.aiAgentDeploymentId),{panelOpen:n,panelSize:o}=no(e,Tn(),t.loadPanelOpen(),t.loadPanelSize());return nr(e.mode,o,n)}var _v=ee.scope("hooks"),Ti="*",Ri=new Set;function Ii(e,t,n){let o={widgetId:e,event:t,listener:n};return Ri.add(o),()=>{Ri.delete(o)}}function pv(e,t,n){let o=[...Ri];for(let r of o)if(fv(r.widgetId,e.widgetId)&&!(r.event!==Ti&&r.event!==t))try{r.listener(e,t,n)}catch(a){_v.warn("hook listener threw",{event:t,error:a})}}function Eu(e,t){let n=[];for(let o of mv)n.push(t.on(o,r=>{pv(e,o,r)}));return()=>{for(let o of n)o()}}function Ei(e){if(Array.isArray(e))for(let t of e){let n=gv(t);n&&Ii(n.widgetId,n.event,n.listener)}}function fv(e,t){return e===Ti||e===t}var mv=["open","close","expand","fullscreen","resize","message","send","stop","clear","selectConversation","suggestion","toggleHistory","formSubmit","toolResult","toolDecision","messageFeedback","contentView","contentOpen","contentSearch","contentRead","contentLinkClick","attach","removeAttachment","voiceStart","voiceStop","voiceCancel","localeChange","themeChange","textSizeChange","soundToggle","sidebarToggle","calloutDismiss","error","handshake","visitorRebound","conversationRebound"];function gv(e){let t,n,o;if(Array.isArray(e))[t,n,o]=e;else if(e&&typeof e=="object")({widgetId:t,event:n,listener:o}=e);else return null;return typeof t!="string"||typeof n!="string"||typeof o!="function"?null:{widgetId:t,event:n,listener:o}}var Dt=new Map;function Gr(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");e.debug!==void 0&&Oo(e.debug);let t=ee.scope("mount");t.info("mount",{widgetId:e.widgetId,publicKey:e.publicKey,mode:e.presentation?.mode});let n=Bt(e),o=n.widgetId,r=Dt.get(o);r&&(t.debug("destroy existing instance at slot",{widgetId:o}),r.destroy());let a=Ci(n),s=n.iframe?el({position:en(n.mode)},n.position,a,n.mode,e.target??null):Sn({position:en(n.mode),target:e.target??null});s.hostElement.dataset.widgetId=o;let l=new kn,c=Ut(o,n.storage,n.aiAgentDeploymentId),d=g=>{l.emit("error",g),p.getOptions().onError?.(g)},p=Kr({bus:l,host:s.hostElement,appRoot:s.appRoot,persistence:c,initialRaw:e,reportError:d});p.render();let _=s.hostElement,u=null,f=g=>{g.debug!==void 0&&Oo(g.debug),p.patchUserOptions(g)},m={widgetId:o,open:()=>Jn(_,"open"),close:()=>Jn(_,"close"),expand:()=>Jn(_,"expand"),openForm:g=>Jn(_,"openForm",g),on:(g,y)=>l.on(g,y),update:g=>{t.debug("update",{patch:g}),f(g)},setUserContext:g=>{t.debug("setUserContext",{keys:Object.keys(g)}),f({userContext:{...p.getUserOptions().userContext,...g}})},clearUserContext:()=>{t.debug("clearUserContext"),f({userContext:void 0})},setPageContext:g=>{t.debug("setPageContext",{keys:Object.keys(g)}),f({pageContext:{...p.getUserOptions().pageContext,...g}})},clearPageContext:()=>{t.debug("clearPageContext"),f({pageContext:void 0})},setDebug:g=>{Oo(g),t.info("debug level set",{level:Wn()})},debugLevel:()=>Wn(),onLog:g=>Kn(g),destroy:()=>{t.info("destroy",{widgetId:o}),u?.(),p.destroy(),l.clear(),Qt(null,s.appRoot),s.destroy(),Dt.get(o)===m&&Dt.delete(o)}};return u=Eu(m,l),Dt.set(o,m),m}function jr(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");let t=e.widgetId??"default",n=Dt.get(t);return n?(n.update(e),n):Gr(e)}function Ai(e){if(e!==void 0){Dt.get(e)?.destroy();return}let t=[...Dt.values()];for(let n of t)n.destroy()}function St(e="default"){return Dt.get(e)??null}function Au(){return[...Dt.values()]}function Mi(e,t,n){return Ii(e,t,n)}var Mu=xn;var Li=class extends HTMLElement{constructor(){super(...arguments);se(this,"bus",new kn);se(this,"mountResult",null);se(this,"runtime",null)}static get observedAttributes(){return xa}connectedCallback(){this.boot()}disconnectedCallback(){this.mountResult&&(this.runtime?.destroy(),this.runtime=null,Qt(null,this.mountResult.appRoot),this.bus.clear())}attributeChangedCallback(){this.isConnected&&this.boot()}boot(){let n=$o(a=>this.getAttribute(a));if(!n.aiAgentDeploymentId)throw new Error("ai-agent-deployment-id is required");if(this.runtime){this.runtime.setUserOptions(n);return}let o=Bt(n);this.mountResult||(this.mountResult=Sn({existingHost:this,position:en(o.mode)}));let r=Ut(o.widgetId,o.storage,o.aiAgentDeploymentId);this.runtime=Kr({bus:this.bus,host:this.mountResult.hostElement,appRoot:this.mountResult.appRoot,persistence:r,initialRaw:n,reportError:a=>this.bus.emit("error",a)}),this.runtime.render()}},Lu=!1;function Oi(){if(Lu||typeof customElements>"u")return;let e=R.tagName;customElements.get(e)||customElements.define(e,Li),Lu=!0}typeof customElements<"u"&&Oi();var Ou=ee.scope("iife"),Nu={close:()=>St()?.close(),destroy:()=>Ai(),expand:()=>St()?.expand(),hook:(e,t,n)=>typeof e=="string"&&typeof t=="string"&&typeof n=="function"?Mi(e,t,n):void 0,init:e=>jr(e),mount:e=>Gr(e),on:(e,t)=>St()?.on(e,t),onLog:e=>Kn(e),open:()=>St()?.open(),setDebug:e=>St()?.setDebug(e),update:e=>St()?.update(e)};function Du(e,...t){let n=Nu[e];if(!n){Ou.warn("unknown command",{command:e});return}return n(...t)}function vv(){let e=((t,...n)=>Du(t,...n));e.init=jr,e.mount=Gr,e.destroy=Ai,e.getInstance=St,e.getAllInstances=Au,e.version=Mu,e.hook=Mi,e.debugLevel=()=>Wn(),e.onLog=Kn;for(let t of["close","expand","on","open","setDebug","update"])Reflect.set(e,t,Nu[t]);return e}function hv(e){let t=e?.q;if(t)for(let n of t){let o=[...n],[r,...a]=o;if(typeof r=="string")try{Du(r,...a)}catch(s){Ou.warn("queued command failed",{command:r,error:s})}}}function bv(){let e=[],t=e.push.bind(e);return e.push=(...n)=>(Ei(n),t(...n)),e}function yv(){let e=document.scripts;for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.src.includes("elements"))return n}return null}function Pv(){if(typeof window>"u"||typeof document>"u")return;let e=globalThis[R.global],t=vv();globalThis[R.global]=t,Oi();let n=`${R.global}Hooks`,o=globalThis[n];if(Ei(o),globalThis[n]=bv(),hv(e),St())return;let r=document.currentScript??yv(),a=Sa(r?.dataset),s=a.aiAgentDeploymentId;if(!s)return;let l=()=>{St()||jr({...a,aiAgentDeploymentId:s})};if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",l,{once:!0});return}l()}Pv();return S_(xv);})();
|
|
42
42
|
//# sourceMappingURL=elements.js.map
|