@helpai/elements 1.13.1 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/elements.js CHANGED
@@ -1,17 +1,17 @@
1
- "use strict";(()=>{var gm=Object.defineProperty;var hm=(e,t,n)=>t in e?gm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var oe=(e,t,n)=>hm(e,typeof t!="symbol"?t+"":t,n);var E={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"};function Ui(e,t){if(!(!e?.length||!t))return e.find(n=>n.locale===t)}function cc(e,t){let{translations:n,defaultLocale:r,...o}=e,a=Ui(n,t);return a?{...o,title:a.title??o.title,description:a.description??o.description,content:a.content??o.content}:o}function uc(e,t){let{translations:n,defaultLocale:r,...o}=e,a=Ui(n,t);return a?{...o,title:a.title??o.title,description:a.description??o.description}:o}function dc(e,t){let{translations:n,defaultLocale:r,...o}=e,a=Ui(n,t);if(!a)return o;let i=new Map((a.fields??[]).map(c=>[c.name,c])),s=o.fields.map(c=>{let p=i.get(c.name);if(!p)return c;let _=new Map((p.options??[]).map(d=>[d.value,d]));return{...c,label:p.label??c.label,placeholder:p.placeholder??c.placeholder,validationHint:p.validationHint??c.validationHint,options:c.options?.map(d=>{let u=_.get(d.value);return u?{...d,label:u.label??d.label,description:u.description??d.description}:d})}});return{...o,title:a.title??o.title,description:a.description??o.description,submitLabel:a.submitLabel??o.submitLabel,fields:s}}var qo={attach:"Attach files",file:"File",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",queueMessage:"Queue message",removeQueuedMessage:"Remove queued message",compactingContext:"Optimizing conversation context\u2026",soundOff:"Sound off",soundOn:"Sound on",startNewConversation:"Start a new chat",talkToOperator:"Talk to a person",connectingOperator:"Connecting you to a person\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",visualPreparing:"Preparing visual\u2026",visualError:"This visual could not be displayed.",visualPartial:"Some parts of this visual could not be displayed.",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",contentHelpful:"Was this helpful?",homeGreeting:"How can we help?",homeGreetingNamed:"Hi {name} \u{1F44B}",homeGreetingLead:"How can we help?",homeSearchPlaceholder:"Search for help",homeAskPlaceholder:"Ask a question\u2026",homeWhatsNew:"What's new",homeContentTitle:"Popular articles",homeStatus:"Status",helpTitle:"Help",helpSearchPlaceholder:"Search for help",helpEmpty:"No help articles yet",helpLoading:"Loading help\u2026",helpSearchEmpty:"No results for \u201C{query}\u201D",helpShowMore:"Show more",newsTitle:"News",newsEmpty:"No news yet",newsLoading:"Loading news\u2026",newsBack:"Back to news",newsPublishedAt:"Published {date}",newsShowMore:"Show more",newsUnseen:"New post",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",statusIncomplete:"Not completed",toolStepsFailed:"{count} failed"},vm={attach:"Joindre des fichiers",file:"Fichier",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",queueMessage:"Mettre le message en attente",removeQueuedMessage:"Retirer le message en attente",compactingContext:"Optimisation du contexte de la conversation\u2026",soundOff:"Son d\xE9sactiv\xE9",soundOn:"Son activ\xE9",startNewConversation:"D\xE9marrer un nouveau chat",talkToOperator:"Parler \xE0 une personne",connectingOperator:"Mise en relation avec une personne\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",visualPreparing:"Pr\xE9paration du visuel\u2026",visualError:"Ce visuel n\u2019a pas pu \xEAtre affich\xE9.",visualPartial:"Certaines parties de ce visuel n\u2019ont pas pu \xEAtre affich\xE9es.",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",contentHelpful:"Cela vous a-t-il aid\xE9 ?",homeGreeting:"Comment pouvons-nous vous aider ?",homeGreetingNamed:"Bonjour {name} \u{1F44B}",homeGreetingLead:"Comment pouvons-nous vous aider ?",homeSearchPlaceholder:"Rechercher de l'aide",homeAskPlaceholder:"Posez une question\u2026",homeWhatsNew:"Nouveaut\xE9s",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 pour \xAB\xA0{query}\xA0\xBB",helpShowMore:"Afficher plus",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}",newsShowMore:"Afficher plus",newsUnseen:"Nouvelle publication",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",statusIncomplete:"Non termin\xE9",toolStepsFailed:"{count} en \xE9chec"},ym={attach:"\u0625\u0631\u0641\u0627\u0642 \u0645\u0644\u0641\u0627\u062A",file:"\u0645\u0644\u0641",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",queueMessage:"\u0625\u0636\u0627\u0641\u0629 \u0627\u0644\u0631\u0633\u0627\u0644\u0629 \u0625\u0644\u0649 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0627\u0646\u062A\u0638\u0627\u0631",removeQueuedMessage:"\u0625\u0632\u0627\u0644\u0629 \u0627\u0644\u0631\u0633\u0627\u0644\u0629 \u0645\u0646 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0627\u0646\u062A\u0638\u0627\u0631",compactingContext:"\u062C\u0627\u0631\u064D \u062A\u062D\u0633\u064A\u0646 \u0633\u064A\u0627\u0642 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629\u2026",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 \u0634\u062E\u0635",connectingOperator:"\u062C\u0627\u0631\u064D \u062A\u0648\u0635\u064A\u0644\u0643 \u0628\u0634\u062E\u0635\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",visualPreparing:"\u062C\u0627\u0631\u064D \u0625\u0639\u062F\u0627\u062F \u0627\u0644\u0645\u062D\u062A\u0648\u0649 \u0627\u0644\u0645\u0631\u0626\u064A\u2026",visualError:"\u062A\u0639\u0630\u0631 \u0639\u0631\u0636 \u0647\u0630\u0627 \u0627\u0644\u0645\u062D\u062A\u0648\u0649 \u0627\u0644\u0645\u0631\u0626\u064A.",visualPartial:"\u062A\u0639\u0630\u0631 \u0639\u0631\u0636 \u0628\u0639\u0636 \u0623\u062C\u0632\u0627\u0621 \u0647\u0630\u0627 \u0627\u0644\u0645\u062D\u062A\u0648\u0649 \u0627\u0644\u0645\u0631\u0626\u064A.",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",contentHelpful:"\u0647\u0644 \u0643\u0627\u0646 \u0647\u0630\u0627 \u0645\u0641\u064A\u062F\u064B\u0627\u061F",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",homeAskPlaceholder:"\u0627\u0637\u0631\u062D \u0633\u0624\u0627\u0644\u0627\u064B\u2026",homeWhatsNew:"\u0645\u0627 \u0627\u0644\u062C\u062F\u064A\u062F",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 \u0646\u062A\u0627\u0626\u062C \u0644\u0640 \xAB{query}\xBB",helpShowMore:"\u0639\u0631\u0636 \u0627\u0644\u0645\u0632\u064A\u062F",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}",newsShowMore:"\u0639\u0631\u0636 \u0627\u0644\u0645\u0632\u064A\u062F",newsUnseen:"\u0645\u0646\u0634\u0648\u0631 \u062C\u062F\u064A\u062F",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",statusIncomplete:"\u0644\u0645 \u064A\u0643\u062A\u0645\u0644",toolStepsFailed:"\u0641\u0634\u0644 {count}"},bm={attach:"Adjuntar archivos",file:"Archivo",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",queueMessage:"Poner mensaje en cola",removeQueuedMessage:"Quitar mensaje de la cola",compactingContext:"Optimizando el contexto de la conversaci\xF3n\u2026",soundOff:"Sonido desactivado",soundOn:"Sonido activado",startNewConversation:"Iniciar un chat nuevo",talkToOperator:"Hablar con una persona",connectingOperator:"Conect\xE1ndote con una persona\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",visualPreparing:"Preparando visualizaci\xF3n\u2026",visualError:"No se pudo mostrar esta visualizaci\xF3n.",visualPartial:"No se pudieron mostrar algunas partes de esta visualizaci\xF3n.",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",contentHelpful:"\xBFTe result\xF3 \xFAtil?",homeGreeting:"\xBFC\xF3mo podemos ayudarte?",homeGreetingNamed:"Hola, {name} \u{1F44B}",homeGreetingLead:"\xBFC\xF3mo podemos ayudarte?",homeSearchPlaceholder:"Buscar ayuda",homeAskPlaceholder:"Haz una pregunta\u2026",homeWhatsNew:"Lo nuevo",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:"Sin resultados para \xAB{query}\xBB",helpShowMore:"Mostrar m\xE1s",newsTitle:"Novedades",newsEmpty:"A\xFAn no hay novedades",newsLoading:"Cargando novedades\u2026",newsBack:"Volver a novedades",newsPublishedAt:"Publicado el {date}",newsShowMore:"Mostrar m\xE1s",newsUnseen:"Publicaci\xF3n nueva",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",statusIncomplete:"No completado",toolStepsFailed:"{count} con error"},Pm={attach:"\u05E6\u05D9\u05E8\u05D5\u05E3 \u05E7\u05D1\u05E6\u05D9\u05DD",file:"\u05E7\u05D5\u05D1\u05E5",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",queueMessage:"\u05D4\u05D5\u05E1\u05E4\u05EA \u05D4\u05D4\u05D5\u05D3\u05E2\u05D4 \u05DC\u05EA\u05D5\u05E8",removeQueuedMessage:"\u05D4\u05E1\u05E8\u05EA \u05D4\u05D4\u05D5\u05D3\u05E2\u05D4 \u05DE\u05D4\u05EA\u05D5\u05E8",compactingContext:"\u05DE\u05D1\u05E6\u05E2 \u05D0\u05D5\u05E4\u05D8\u05D9\u05DE\u05D9\u05D6\u05E6\u05D9\u05D4 \u05DC\u05D4\u05E7\u05E9\u05E8 \u05D4\u05E9\u05D9\u05D7\u05D4\u2026",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\u05D5 \u05E2\u05DD \u05D0\u05D3\u05DD",connectingOperator:"\u05DE\u05D7\u05D1\u05E8\u05D9\u05DD \u05D0\u05D5\u05EA\u05DA \u05DC\u05D0\u05D3\u05DD\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",visualPreparing:"\u05DE\u05DB\u05D9\u05DF \u05EA\u05E6\u05D5\u05D2\u05D4\u2026",visualError:"\u05DC\u05D0 \u05E0\u05D9\u05EA\u05DF \u05D4\u05D9\u05D4 \u05DC\u05D4\u05E6\u05D9\u05D2 \u05EA\u05E6\u05D5\u05D2\u05D4 \u05D6\u05D5.",visualPartial:"\u05DC\u05D0 \u05E0\u05D9\u05EA\u05DF \u05D4\u05D9\u05D4 \u05DC\u05D4\u05E6\u05D9\u05D2 \u05D7\u05DC\u05E7\u05D9\u05DD \u05DE\u05EA\u05E6\u05D5\u05D2\u05D4 \u05D6\u05D5.",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",contentHelpful:"\u05D4\u05D0\u05DD \u05D6\u05D4 \u05E2\u05D6\u05E8?",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",homeAskPlaceholder:"\u05E9\u05D0\u05DC\u05D5 \u05E9\u05D0\u05DC\u05D4\u2026",homeWhatsNew:"\u05DE\u05D4 \u05D7\u05D3\u05E9",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:"\u05D0\u05D9\u05DF \u05EA\u05D5\u05E6\u05D0\u05D5\u05EA \u05E2\u05D1\u05D5\u05E8 \u201E{query}\u201D",helpShowMore:"\u05D4\u05E6\u05D2\u05EA \u05E2\u05D5\u05D3",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}",newsShowMore:"\u05D4\u05E6\u05D2\u05EA \u05E2\u05D5\u05D3",newsUnseen:"\u05E4\u05D5\u05E1\u05D8 \u05D7\u05D3\u05E9",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",statusIncomplete:"\u05DC\u05D0 \u05D4\u05D5\u05E9\u05DC\u05DD",toolStepsFailed:"{count} \u05E0\u05DB\u05E9\u05DC\u05D5"},xm={en:qo,fr:vm,ar:ym,es:bm,he:Pm};function zo(e,t){let n=pc(e),r=jo(t),o=n==="en"?{}:xm[n]??{},a=r?t[n]??{}:t??{},i=r?t.en??{}:{};return{...qo,...o,...i,...a}}function pc(e){return(e.split("-")[0]??"en").toLowerCase()}var Sm=new Set(["ar","he","iw","fa","ur","ps","sd","ug","yi","dv","ckb","ks","nqo","prs","syr"]);function _c(e){return Sm.has(pc(e))}function bt(e,t){return e[t]??t}function jo(e){if(!e)return!1;for(let t of Object.values(e))if(t&&typeof t=="object")return!0;return!1}var Hi=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{}}},Vo=new Hi;var Wo={maxBytes:10485760,maxCount:10,accept:"*/*"},fc={voice:"local"},mc={list:[],byTrigger:{}},qi={enabled:!0,sampleRate:1},Go={upload:"/pai/upload-file",transcribe:"/pai/transcribe-audio",submitForm:"/pai/submit-form"},sr={variant:"circle",size:"md",label:void 0,icon:"chat",hidden:!1},gc={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"]},zi={enabled:!0,volume:.3,events:void 0},hc={enabled:!0,events:void 0},vc=[{label:"tabConversations",layout:"chat"}];var Wi=["off","error","warn","info","debug","trace"],Gi=E.cssPrefix,yc=`${Gi}.debug`,km=`__${E.global}_DEBUG__`,wm=`${Gi}-debug`,Ko=2,ji=null;function Cm(){if(typeof window>"u")return 2;try{let e=new URLSearchParams(window.location.search).get(wm);if(e!==null){let t=Vi(e);if(t>=0)return t}}catch{}try{let e=window.localStorage?.getItem(yc);if(e){let t=Vi(e);if(t>=0)return t}}catch{}return Reflect.get(window,km)?4:2}function Vi(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=Wi.findIndex(n=>n===e);if(t>=0)return t}return-1}function Qo(e){let t=Vi(e);if(!(t<0)){Ko=t;try{window.localStorage?.setItem(yc,Wi[t]??"off")}catch{}}}function zr(){return Wi[Ko]??"warn"}Ko=Cm();function bc(e){let t=`[${Gi}:${e}]`;function n(r,o,a){return(i,s)=>{if(!(Ko<r)&&(s===void 0?console[o](t,i):console[o](t,i,s),ji))try{ji({level:a,scope:e,message:i,payload:s})}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:r=>bc(`${e}:${r}`)}}var Z=bc("core");function jr(e){ji=e}var On=Z.scope("context"),Tm=new Set(["visitorId","conversationId","jwt","token","authorization","password"]),Pc=50,Ki=1024,Im=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Qi(e){return xc(e,"userContext",!0)}function Xi(e){return xc(e,"pageContext",!1)}function xc(e,t,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){On.warn(`ignored ${t} \u2014 expected an object`,{type:Array.isArray(e)?"array":typeof e});return}let r={},o=0;for(let[a,i]of Object.entries(e)){if(Tm.has(a)){On.warn(`dropped reserved ${t} key "${a}" \u2014 managed by the widget, not host-settable`);continue}if(i==null)continue;if(o>=Pc){On.warn(`${t} truncated at ${Pc} keys \u2014 dropped "${a}"`);continue}let s=Rm(t,a,i);s!==void 0&&(r[a]=s,o++)}return n&&typeof r.email=="string"&&!Im.test(r.email)&&(On.warn("dropped malformed context field",{field:`${t}.email`,reason:"invalid format"}),delete r.email),Object.keys(r).length>0?r:void 0}function Rm(e,t,n){if(typeof n=="boolean")return n;if(typeof n=="number"){if(!Number.isFinite(n)){On.warn(`dropped non-finite ${e}.${t}`);return}return n}if(typeof n=="string"){let r=n.trim();return r===""?void 0:r.length>Ki?(On.warn(`truncated ${e}.${t} to ${Ki} chars`),r.slice(0,Ki)):r}On.warn(`dropped ${e}.${t} \u2014 only string/number/boolean values are allowed`,{type:typeof n})}function vn(e){let t=e!==null&&typeof e=="object"?e:{},n=t.presentation??{},r=t.behavior??{},o=t.i18n??{},a=t.feedback??{},i=t.footer??{},s=t.header??{},c={enabled:t.history?.enabled??!0},{themeMode:p,themeOverrides:_}=Em(t.theme),d=n.mode??"floating",u=Am(o.defaultLocale),f=o.availableLocales??[o.locale??u],m=lr(o.locale??u,f,u),v=(t.baseUrl??E.defaultBaseUrl).replace(/\/$/,""),x=(t.agentApiBaseUrl??`${v}/api/agent`).replace(/\/$/,""),P=(t.dataApiBaseUrl??`${v}/api/data`).replace(/\/$/,"");return{widgetId:t.widgetId??"default",publicKey:t.publicKey,aiAgentDeploymentId:t.aiAgentDeploymentId,baseUrl:v,agentApiBaseUrl:x,dataApiBaseUrl:P,userContext:Qi(t.userContext),pageContext:Xi(t.pageContext),position:n.position??"bottom-right",themeMode:p,textSize:"normal",themeOverrides:_,mode:d,iframe:n.iframe??!1,responseMode:r.responseMode??"streaming",showReasoning:r.showReasoning??!1,showToolCalls:r.showToolCalls??!1,showSources:r.showSources??!1,enableMessageFeedback:!(r.disableMessageFeedback??!1),autoSendSuggestions:r.autoSendSuggestions??!1,popOutUrl:r.popOutUrl,features:{voice:t.features?.voice??fc.voice,fileUpload:!(t.features?.disableFileUpload??!1),humanInLoop:!(t.features?.disableHumanInLoop??!1),operatorRequest:t.features?.enableOperatorRequest===!0},forms:Vr(t.forms,m),endpoints:{upload:t.endpoints?.upload??Go.upload,transcribe:t.endpoints?.transcribe??Go.transcribe,submitForm:t.endpoints?.submitForm??Go.submitForm},attachments:{accept:t.composer?.attachments?.accept??Wo.accept,maxBytes:t.composer?.attachments?.maxBytes??Wo.maxBytes,maxCount:t.composer?.attachments?.maxCount??Wo.maxCount},locale:m,defaultLocale:u,availableLocales:f,startMinimized:r.startMinimized??!0,actions:Mm(d,s.actions,c.enabled),size:n.size??{},launcher:Um(t.launcher),sound:Lm(a.sound),haptics:Nm(a.haptics),strings:zo(m,o.strings),stringsOverride:o.strings,composerDisclaimer:i.composerDisclaimer??"",poweredBy:$m(i.poweredBy),composer:Dm(t.composer),modules:Fm(t.modules,c.enabled),tracking:Om(t.tracking,P),history:c,storage:t.storage??Vo,userToken:t.userToken,tools:t.tools,onMessage:t.onMessage,onOpen:t.onOpen,onClose:t.onClose,onError:t.onError}}function Em(e){if(typeof e=="string")return{themeMode:e,themeOverrides:{}};if(!e||typeof e!="object")return{themeMode:"auto",themeOverrides:{}};let{mode:t,...n}=e;return{themeMode:t??"auto",themeOverrides:n}}function Am(e){return e&&e!=="auto"?e:globalThis.navigator?.language||"en"}function lr(e,t,n){return t.length<=1||t.includes(e)?e:t.includes(n)?n:t[0]??e}function Mm(e,t,n){let r=t??gc[e];return n?r:r.filter(o=>o!=="history")}function Lm(e){return{enabled:e?.enabled??zi.enabled,volume:e?.volume??zi.volume,events:e?.events}}function Nm(e){return{enabled:e?.enabled??hc.enabled,events:e?.events}}function Om(e,t){let n=e?.sampleRate??qi.sampleRate;return{enabled:e?.enabled??qi.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 $m(e){let n={...{text:`Powered by ${E.displayName}`,href:E.siteUrl},...e};return!!(n.text||n.logoUrl)?n:null}function Dm(e){let t=e?.sendButton;return{sendButton:{shape:t?.shape??"circle",icon:t?.icon??"arrowUp",variant:t?.variant??"filled"}}}function Fm(e,t){let n=e??vc,r=new Set,o=[];for(let i of n.slice(0,4)){if(!i?.label||!i?.layout)continue;let s=i.contentCollectionIds?.filter(Boolean),c=i.id??s?.[0]??i.layout;for(;r.has(c);)c=`${c}-${o.length}`;r.add(c);let p={id:c,label:i.label,layout:i.layout};s?.length&&(p.contentCollectionIds=s),i.layout==="home"&&(p.brandName=i.brandName,p.greetingText=i.greetingText,p.showGreeting=!(i.hideGreeting??!1),p.showSearchBar=!(i.hideSearchBar??!1),p.showRecentConversations=t&&!(i.hideRecentConversations??!1),i.userAvatars?.length&&(p.userAvatars=i.userAvatars),i.status&&(p.status=i.status),p.contentBlockTitle=i.contentBlockTitle),o.push(p)}let a=Object.fromEntries(o.map(i=>[i.id,i]));return{list:o,byId:a}}function Vr(e,t){var a;if(!e?.length)return mc;let n=[],r=new Set;for(let i of e){if(!i?.id||r.has(i.id))continue;let s=dc(i,t),c=(s.fields??[]).filter(_=>!!(_?.name&&_.label&&_.type)),p=(Array.isArray(s.on)?s.on:[s.on]).map(Bm).filter(_=>_!==null);c.length===0||p.length===0||(r.add(s.id),n.push({id:s.id,triggers:p,when:s.when,fields:c,title:s.title,description:s.description,submitLabel:s.submitLabel,skippable:s.skippable??!1,blocking:s.blocking??!1,frequency:s.frequency??"once",mirrorToContext:s.mirrorToContext??!0,reopenable:s.reopenable??!0,reviewable:s.reviewable??!0}))}let o={};for(let i of n)for(let s of i.triggers)(o[a=s.kind]??(o[a]=[])).push(i);return{list:n,byTrigger:o}}function Bm(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 r=Number(n);return Number.isFinite(r)&&r>0?{kind:"after-messages",param:r}:null}if(t==="idle"){let r=Number(n);return Number.isFinite(r)&&r>0?{kind:"idle",param:r}:null}return t==="page-area"&&n?{kind:"page-area",param:n}:null}function Um(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??sr.variant,size:e?.size??sr.size,label:e?.label??sr.label,icon:e?.icon??sr.icon,hidden:e?.hidden??sr.hidden,callout:t}}function Ji(e,t,n,r){let o=lr(t,e.availableLocales,e.defaultLocale);if(o===e.locale&&n===e.themeMode&&r===e.textSize)return e;let a={...e};return o!==e.locale&&(a.locale=o,a.strings=zo(o,e.stringsOverride)),n!==e.themeMode&&(a.themeMode=n),r!==e.textSize&&(a.textSize=r),a}var Hm=["presentation","behavior","theme","launcher","header","composer","feedback","i18n","footer","features","tracking","endpoints","history"];function Yi(e,t){if(!t)return e;let n={...e};for(let a of Hm){let i=t[a];if(i===void 0)continue;let s=e[a];if(a==="theme"){s===void 0?n[a]=i:typeof s=="string"&&typeof i=="object"&&i!==null&&(n[a]={...i,mode:s});continue}a!=="i18n"&&(n[a]=Sc(i,s))}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 r=e.i18n,o=t.i18n;if(r||o){let a=Sc(o??{},r);o?.availableLocales!==void 0&&(a.availableLocales=o.availableLocales),o?.defaultLocale!==void 0&&(a.defaultLocale=o.defaultLocale);let i=r?.strings,s=o?.strings;(i||s)&&(a.strings=qm(s,i)),n.i18n=a}return n}function Sc(e,t){if(!t)return e;let n={...e};for(let[r,o]of Object.entries(t))o!==void 0&&(n[r]=o);return n}function qm(e,t){if(!e)return t;if(!t)return e;let n=jo(e),r=jo(t);if(!n&&!r)return{...e,...t};let o={},a=n?e:{en:e},i=r?t:{en:t};for(let[s,c]of Object.entries(a))o[s]={...c};for(let[s,c]of Object.entries(i))o[s]={...o[s],...c};return o}var zm=["clear","expand","fullscreen","popOut","sound","history","language","theme","textSize","close"];function rn(e){return e!=="false"}function jm(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}var wc=[["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]],Cc=[["mode","mode",e=>e],["position","position",e=>e],["iframe","iframe",rn]],Tc=[["width","width"],["height","height"]],Ic=[["response-mode","responseMode",e=>e],["start-minimized","startMinimized",rn],["show-reasoning","showReasoning",rn],["show-tool-calls","showToolCalls",rn],["show-sources","showSources",rn],["disable-message-feedback","disableMessageFeedback",rn],["auto-send-suggestions","autoSendSuggestions",rn],["pop-out-url","popOutUrl"]],Rc=[["locale","locale"]],Vm=new Set(zm);function Wm(e){return jm(e).filter(t=>Vm.has(t))}var Ec=[["launcher-variant","variant",e=>e],["launcher-size","size",e=>e],["launcher-icon","icon"],["launcher-hidden","hidden",rn]],Ac=[["features-disable-file-upload","disableFileUpload",rn],["features-voice","voice",e=>e]],Mc=[["endpoint-upload","upload"],["endpoint-transcribe","transcribe"]],Lc=[["user-id","id"],["user-email","email"],["user-name","name"]],Nc=[["page-area","area"],["page-url","url"],["page-path","path"],["page-title","title"]],Gm=["launcher-label","callout-text","callout-delay","actions","user-context","page-context"],Km=[wc,Cc,Tc,Ic,Rc,Ec,Ac,Mc,Lc,Nc],Qm=new Set(["iframe","start-minimized"]),Zi=[...Km.flatMap(e=>e.map(([t])=>t).filter(t=>!Qm.has(t))),...Gm];function Xo(e){let t={};function n(f){let m=e(f);return m===null||m===""?void 0:m}for(let[f,m,v]of wc){let x=n(f);x!==void 0&&(t[m]=v?v(x):x)}let r=$n(n,Cc),o=$n(n,Tc);(r||o)&&(t.presentation={...r,...o?{size:o}:{}});let a=$n(n,Ic);a&&(t.behavior=a);let i=$n(n,Rc);i&&(t.i18n=i);let s=Jm(e,n);s&&(t.launcher=s);let c=$n(n,Ac);c&&(t.features=c);let p=$n(n,Mc);p&&(t.endpoints=p);let _=kc(n,Lc,"user-context");_&&(t.userContext=_);let d=kc(n,Nc,"page-context");d&&(t.pageContext=d);let u=n("actions");return u!==void 0&&(t.header={actions:Wm(u)}),t}function es(e){return e?Xo(t=>e[Xm(t==="data-api-base-url"?"api-base-url":t)]??null):{}}function Xm(e){return e.replaceAll(/-([a-z])/g,(t,n)=>n.toUpperCase())}function $n(e,t){let n={};for(let[r,o,a]of t){let i=e(r);i!==void 0&&(n[o]=a?a(i):i)}return Object.keys(n).length>0?n:null}function kc(e,t,n){let r={};for(let[s,c]of t){let p=e(s);p!==void 0&&(r[c]=p)}let o={},a=e(n);if(a)try{let s=JSON.parse(a);s&&typeof s=="object"&&!Array.isArray(s)&&(o=s)}catch{}let i={...o,...r};return Object.keys(i).length>0?i:null}function Jm(e,t){let n=$n(t,Ec)??{},r=e("launcher-label");r!==null&&(n.label=r);let o=t("callout-text");if(o){let a=Number.parseInt(t("callout-delay")??"",10);n.callout={text:o,...Number.isFinite(a)?{delayMs:a}:{}}}return Object.keys(n).length>0?n:null}var yn={open:!1,ready:!1,unread:0},cr=class{constructor(){oe(this,"handlers",new Map)}on(t,n){let r=this.handlers.get(t);return r||(r=new Set,this.handlers.set(t,r)),r.add(n),()=>this.handlers.get(t)?.delete(n)}emit(t,n){let r=this.handlers.get(t);if(r)for(let o of r)try{o(n)}catch{}}clear(){this.handlers.clear()}};var Ym=Z.scope("hooks"),ns="*",ts=new Set;function rs(e,t,n){let r={widgetId:e,event:t,listener:n};return ts.add(r),()=>{ts.delete(r)}}function Zm(e,t,n){let r=[...ts];for(let o of r)if(eg(o.widgetId,e.widgetId)&&!(o.event!==ns&&o.event!==t))try{o.listener(e,t,n)}catch(a){Ym.warn("hook listener threw",{event:t,error:a})}}function Oc(e,t){let n=[];for(let r of tg)n.push(t.on(r,o=>{Zm(e,r,o)}));return()=>{for(let r of n)r()}}function os(e){if(Array.isArray(e))for(let t of e){let n=ng(t);n&&rs(n.widgetId,n.event,n.listener)}}function eg(e,t){return e===ns||e===t}var tg=["open","close","expand","fullscreen","resize","message","send","stop","clear","selectConversation","suggestion","toggleHistory","formSubmit","toolResult","toolDecision","hostEvent","messageFeedback","contentView","contentOpen","contentSearch","contentRead","contentLinkClick","attach","removeAttachment","voiceStart","voiceStop","voiceCancel","localeChange","themeChange","textSizeChange","soundToggle","sidebarToggle","calloutDismiss","error","handshake","conversationRebound","state","unread"];function ng(e){let t,n,r;if(Array.isArray(e))[t,n,r]=e;else if(e&&typeof e=="object")({widgetId:t,event:n,listener:r}=e);else return null;return typeof t!="string"||typeof n!="string"||typeof r!="function"?null:{widgetId:t,event:n,listener:r}}var rg=new Set(["home","chats","help","news"]);function $c(e){return typeof e!="object"||e===null||!("to"in e)||typeof e.to!="string"||!rg.has(e.to)?!1:!("id"in e)||e.id===void 0||typeof e.id=="string"}function Jo(e){let[t="",...n]=e.trim().split("/");if(t===""||t==="open")return;let r=n.join("/");return r?{to:t,id:r}:{to:t}}function on(e,t){return{text:e,send:typeof t=="object"&&t!==null&&"send"in t&&t.send===!0}}function Dc(e){if(typeof e!="object"||e===null||!("text"in e)||typeof e.text!="string")return;let t=e.text.trim();return t?{text:t,send:"send"in e&&e.send===!0}:void 0}function Fc(e){return`${E.cssPrefix}:${e}`}function st(e,t,n){e.dispatchEvent(new CustomEvent(Fc(t),{detail:n}))}function Bc(e,t){let r=Object.entries(t).map(([o,a])=>{let i=Fc(o);function s(c){return a(c.detail)}return e.addEventListener(i,s),[i,s]});return()=>{for(let[o,a]of r)e.removeEventListener(o,a)}}var Uc=Z.scope("track"),og=64,ag=256,ig=10;function ur(e,t){let n=typeof e=="string"?e.trim():"";if(!n||n.length>og){Uc.warn("track: ignored an event without a name of 1\u201364 characters",{name:e});return}let r=Object.fromEntries(Object.entries(typeof t=="object"&&t!==null?t:{}).filter(o=>typeof o[1]=="string"||typeof o[1]=="boolean"||Number.isFinite(o[1])));return JSON.stringify(r).length>ag?(Uc.warn("track: sent the event without its data, which is over 256 characters",{name:n}),{name:n}):Object.keys(r).length>0?{name:n,data:r}:{name:n}}function Hc(e){let t=[];return e.on("hostEvent",n=>{t.push({...n,at:Date.now()}),t.length>ig&&t.shift()}),t}var sg=new Set(["hidden","submit","button","reset","image","file","password"]);function zc(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement}function lg(e){return!zc(e)||e.name===""||e.disabled?!1:!(e instanceof HTMLInputElement&&sg.has(e.type))}function cg(e){let t=e.labels?.[0]?.textContent?.trim();return e.getAttribute("toolparamdescription")??(t||e.getAttribute("aria-description"))??void 0}function ug(e,t){let n=cg(e),r=n?{description:n}:{};return e instanceof HTMLSelectElement?{...r,type:"string",enum:[...e.options].map(o=>o.value)}:e instanceof HTMLTextAreaElement?{...r,type:"string"}:e.type==="checkbox"?{...r,type:"boolean"}:e.type==="radio"?{...r,type:"string",enum:t}:e.type==="number"||e.type==="range"?{...r,type:"number"}:{...r,type:"string"}}function dg(e,t){Object.getOwnPropertyDescriptor(Reflect.getPrototypeOf(e)??e,"value")?.set?.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function qc(e){return e==null?"":typeof e=="string"?e:JSON.stringify(e)}function pg(e,t){if(e instanceof HTMLInputElement&&e.type==="checkbox"){e.checked!==(t===!0||t==="true")&&e.click();return}if(e instanceof HTMLInputElement&&e.type==="radio"){e.value===qc(t)&&!e.checked&&e.click();return}dg(e,qc(t))}function _g(e,t,n){var i;let r=[...e.elements].filter(lg),o={},a=new Set;for(let s of r){let c=r.flatMap(p=>p instanceof HTMLInputElement&&p.type==="radio"&&p.name===s.name?[p.value]:[]);o[i=s.name]??(o[i]=ug(s,c)),s.required&&a.add(s.name)}return{name:t,description:n,inputSchema:{type:"object",properties:o,...a.size>0?{required:[...a]}:{}},execute(s){let c=typeof s=="object"&&s!==null?Object.entries(s):[];for(let[_,d]of c)for(let u of r)u.name===_&&pg(u,d);if(!e.hasAttribute("toolautosubmit"))return"Filled in the form. The visitor still needs to check it and press its submit button.";let p=[...new Set([...e.elements].flatMap(_=>zc(_)&&_.name&&!_.checkValidity()?[_.name]:[]))];return p.length>0?`Filled in the form, but it can't be submitted yet: ${p.join(", ")} still needs the visitor. Ask them to complete it and press the submit button.`:(setTimeout(()=>e.requestSubmit(),0),"Filled in the form and submitted it.")}}}function jc(){return[...document.querySelectorAll("form[toolname][tooldescription]")].flatMap(e=>{let t=e.getAttribute("toolname")?.trim()??"",n=e.getAttribute("tooldescription")?.trim()??"";return t&&n?[_g(e,t,n)]:[]})}var Vc=`${E.cssPrefix}.page-tools`,fg=20,mg=50;function Yo(e){return typeof e=="object"&&e!==null}function gg(e){return Yo(e)&&(e.state==="running"||e.state==="stopped"||e.state==="finished"&&Yo(e.outcome))}function hg(e){let t=e?JSON.parse(e):void 0;if(!Yo(t))return{sent:[],calls:{}};let n=Array.isArray(t.sent)?t.sent.filter(o=>typeof o=="string"):[],r=Object.fromEntries(Object.entries(Yo(t.calls)?t.calls:{}).filter(o=>gg(o[1])));return{sent:n,calls:r}}var is={sent:[],calls:{}};function Wr(){try{is=hg(sessionStorage.getItem(Vc))}catch{}return is}function as(e){is=e;try{sessionStorage.setItem(Vc,JSON.stringify(e))}catch{}}var Tt={markSent(e){let t=Wr();as({...t,sent:[...t.sent.filter(n=>n!==e),e].slice(-fg)})},sentHere(e){return Wr().sent.includes(e)},get(e){return Wr().calls[e]},set(e,t){let n=Wr(),r=Object.entries(n.calls).filter(([o])=>o!==e);as({...n,calls:Object.fromEntries([...r,[e,t]].slice(-mg))})},clear(e){let t=Wr();e.some(n=>n in t.calls)&&as({...t,calls:Object.fromEntries(Object.entries(t.calls).filter(([n])=>!e.includes(n)))})}};function Dn(e,t){return new Promise(n=>{if(t?.aborted)return n();let r=setTimeout(a,e);function o(){return a()}t?.addEventListener("abort",o,{once:!0});function a(){clearTimeout(r),t?.removeEventListener("abort",o),n()}})}var Xc=Z.scope("page-tools"),Wc="site__",Gc=3e4,vg=1e3,Kc=Symbol.for(`${E.cssPrefix}.page-tools`),ls={state:"output-error",errorText:"The page reloaded before this finished, so it may or may not have taken effect. Check with the visitor before trying it again."},Jc="The visitor stopped this before it finished.";function bn(e){return typeof e=="object"&&e!==null}function yg(e){return bn(e)&&Array.isArray(e.registered)&&e.runs instanceof Map}function Gr(){let e=Reflect.get(globalThis,Kc);if(yg(e))return e;let t={registered:[],runs:new Map};return Reflect.set(globalThis,Kc,t),t}function Fn(e,t){let n=bn(t)&&t.signal instanceof AbortSignal?t.signal:void 0;if(n?.aborted)return;let r=Gr().registered;r.push(e);function o(){let a=r.indexOf(e);a>=0&&r.splice(a,1)}n?.addEventListener("abort",o,{once:!0})}function Qc(e){return e.replace(/[^A-Za-z0-9_-]/g,"_").slice(0,58)}function Yc(e){if(!bn(e)||typeof e.name!="string"||!Qc(e.name))return;let t=[e.description,e.title].find(n=>typeof n=="string"&&n.trim()!=="")??e.name;return{name:Qc(e.name),description:t.trim().slice(0,1024),inputSchema:{properties:{},...bn(e.inputSchema)?e.inputSchema:{},type:"object"},consequential:bn(e.annotations)&&e.annotations.consequentialHint===!0}}function ss(e){return e.flatMap(t=>{let n=Yc(t),r=bn(t)?t.execute:void 0;return!n||typeof r!="function"?(Xc.warn("skipped a tool without a name or an execute function",t),[]):[{...n,run:(o,a)=>Reflect.apply(r,t,[o,{signal:a}])}]})}async function bg(){let e=Reflect.get(document,"modelContext")??Reflect.get(navigator,"modelContext");if(!bn(e)||typeof e.getTools!="function"||typeof e.executeTool!="function")return[];let t=e.getTools,n=e.executeTool,r=await Promise.race([Promise.resolve().then(()=>Reflect.apply(t,e,[])),Dn(vg).then(()=>[])]).catch(()=>[]);return(Array.isArray(r)?r:[]).flatMap(o=>{let a=Yc(o);return a?[{...a,run:(i,s)=>Reflect.apply(n,e,[o,i,{signal:s}])}]:[]})}async function Zo(e=[]){let t=ss(jc()),n=new Set(t.map(a=>a.name)),o=[...(await bg()).filter(a=>!n.has(a.name)),...t,...ss(e),...ss(Gr().registered)];return new Map(o.map(a=>[a.name,a]))}function cs(e){return[...e.values()].map(({name:t,description:n,inputSchema:r,consequential:o})=>o?{name:t,description:n,inputSchema:r,annotations:{consequentialHint:!0}}:{name:t,description:n,inputSchema:r})}function Vt(e){return e?.execution==="client"}function Kr(e){return e.startsWith(Wc)?e.slice(Wc.length):e}function Pg(e){if(e===void 0||typeof e=="function"||typeof e=="symbol")return null;let t=new WeakSet,n=JSON.stringify(e,(r,o)=>{if(typeof o=="bigint")return o.toString();if(!(typeof o=="function"||typeof o=="symbol"))return o instanceof Node?`[${o.nodeName.toLowerCase()}]`:bn(o)?t.has(o)?"[circular]":(t.add(o),o):o});return n.length>Gc?{truncated:!0,preview:n.slice(0,Gc)}:JSON.parse(n)}async function xg(e){let t=Kr(e.toolName),n=(await Zo(e.optionTools)).get(t);return n?Promise.resolve().then(()=>n.run(e.input,e.signal)).then(r=>({state:"output-available",output:Pg(r)})).catch(r=>(Xc.warn("a page tool failed",{name:t,error:r}),{state:"output-error",errorText:(r instanceof Error?r.message:String(r)).slice(0,1e3)||"The page tool failed."})):{state:"output-error",errorText:`This page doesn't offer "${t}" right now; the visitor may have moved on. Tell them, or continue without it.`}}function Zc(e){let{toolCallId:t}=e,n=Tt.get(t);if(n?.state==="finished")return Promise.resolve(n.outcome);let{runs:r}=Gr(),o=r.get(t);if(o)return o.outcome;if(n?.state==="running")return Tt.set(t,{state:"finished",outcome:ls}),e.onSettled("interrupted",0),Promise.resolve(ls);let a=new AbortController,i=performance.now();Tt.set(t,{state:"running"});let s=xg({...e,signal:a.signal}).then(c=>(r.delete(t),Tt.get(t)?.state!=="running"||(Tt.set(t,{state:"finished",outcome:c}),e.onSettled(c.state==="output-available"?"completed":"failed",Math.round(performance.now()-i))),c));return r.set(t,{outcome:s,controller:a}),s}function ea(e){return e===ls.errorText||e===Jc}function us(e){return Tt.set(e,{state:"stopped"}),Gr().runs.get(e)?.controller.abort(),Jc}function eu(e){Tt.clear([e]),Gr().runs.get(e)?.controller.abort()}var pe,ru,fs,Pn,ds,ra,ou,na,au,ms,ps,Sg,Xr=Symbol.for("pv"),oa={},aa=[],kg=/^m(i|n|o|s|text|space)$/,ia=Array.isArray,gs=aa.slice,Un=Object.assign;function Bn(e){e&&e.parentNode&&e.remove()}function Sn(e,t,n){var r,o,a,i={},s=arguments.length;for(a in t)a=="key"?r=t[a]:a=="ref"&&typeof e!="function"?o=t[a]:i[a]=t[a];return s>2&&(i.children=s>3?gs.call(arguments,2):n),Qr(e,i,r,o,null)}function Qr(e,t,n,r,o){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:Xr,__v:o||++ru,__i:-1,__u:0};return!o&&pe.vnode&&pe.vnode(a),a}function de(e){return e.children}function Ft(e,t){this.props=e,this.context=t,this.__g=0}function xn(e,t){if(t==null)return e.__&&xn(e.__,e.__i+1);for(var n;t<e.__k.length;t++)if((n=e.__k[t])&&n.__e)return n.__e;return typeof e.type!="function"||e.props.__P?null:xn(e)}function iu(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),iu(e)}function tu(e){(8&e.__g||(e.__g|=8,Pn.push(e),ra++))&&ds==pe.debounceRendering||((ds=pe.debounceRendering)||queueMicrotask)(su)}function su(){var e,t,n,r,o,a,i,s,c;try{for(t=1;Pn.length;)Pn.length>t&&Pn.sort(ou),e=Pn.shift(),t=Pn.length,8&e.__g&&(r=void 0,o=void 0,a=(o=(n=e).__v).__e,i=[],s=[],(c=n.__P)&&((r=Un({constructor:Xr},o)).__v=o.__v+1,pe.vnode&&pe.vnode(r),hs(c,r,o,n.__n,c.namespaceURI,32&o.__u?[a]:null,i,a||xn(o),32&o.__u,s),r.__v=o.__v,r.__.__k[r.__i]=r,du(i,r,s),o.__=o.__e=null,r.__e!=a&&iu(r)))}finally{(ra=Pn.length)&&(ds||queueMicrotask)(su)}}function lu(e,t,n,r,o,a,i,s,c,p,_){var d,u,f,m,v,x,P=r.__k||aa,b=t.length;for(c=wg(n,t,P,c,b),d=0;d<b;d++)(f=n.__k[d])!=null&&(u=~f.__i&&P[f.__i]||oa,f.__i=d,x=hs(e,f,u,o,a,i,s,c,p,_),m=f.__e,(u.ref!=f.ref||8&u.__u)&&(u.ref&&vs(u.ref,null,f,u),f.ref&&_.push(f.ref,f.__c||m,f)),v=v||m,4&f.__u?(c=cu(f,c,e,!u.__v),u.__e&&(u.__e=null)):typeof f.type=="function"&&x!==void 0?c=x:m&&(c=m.nextSibling),f.__u&=-21);return n.__e=v,c}function wg(e,t,n,r,o){var a,i,s,c,p,_,d,u,f,m=n.length,v=m,x=0,P=0,b=e.__k=Array(o);for(a=0;a<o;a++)(i=t[a])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i!="object"||i.constructor===String?i=b[a]=Qr(null,i):ia(i)?i=b[a]=Qr(de,{children:i}):i.constructor===Xr&&i.__b?i=b[a]=Qr(i.type,i.props,i.key,i.ref,i.__v):b[a]=i,c=a+x,i.__=e,i.__b=e.__b+1,s=null,~(p=i.__i=Cg(i,n,c,v))&&(v--,(s=n[p])&&(s.__u|=2)),s&&s.__v?(i.__u|=16,p==c-1?x--:p==c+1?x++:p!=c&&(p>c?x--:x++,P=1)):(~p||(o>m?x--:o<m&&x++),typeof i.type!="function"&&(i.__u|=4))):b[a]=null;if(P){for(_=[],d=[],a=0;a<o;a++)if((i=b[a])&&16&i.__u){for(x=0,u=_.length;x<u;)_[f=x+u>>1]<i.__i?x=f+1:u=f;_[x]=i.__i,d[a]=x+1}for(x=_.length;a--;)d[a]&&(d[a]==x?x--:b[a].__u|=4)}if(v)for(a=0;a<m;a++)!(s=n[a])||2&s.__u||(s.__e==r&&(r=xn(s)),ys(s,s));return r}function cu(e,t,n,r){var o,a,i,s;if(typeof e.type=="function"){if(e.props.__P)return t;if(o=e.__k)for(a=0;a<o.length;a++)o[a]&&(o[a].__=e,t=cu(o[a],t,n,!1));return t}for(t&&!t.parentNode&&(t=xn(e))&&!t.parentNode&&(t=null),i=e.__e,s=t;s&&s.nodeType==8;)s=s.nextSibling;for(i!=s&&(!r&&n.moveBefore&&i.parentNode?n.moveBefore(i,t):n.insertBefore(i,t||null)),t=i;(t=t&&t.nextSibling)&&t.nodeType==8&&!t.data.startsWith("$s"););return t}function sa(e,t){return t=t||[],e!=null&&typeof e!="boolean"&&(ia(e)?e.some(function(n){sa(n,t)}):t.push(e)),t}function Cg(e,t,n,r){var o,a=e.key,i=e.type,s=t[n],c=s&&!(2&s.__u);if(s===null&&a==null||c&&a==s.key&&i==s.type)return n;if(r>(c?1:0)){for(o=n-1;o>=0;o--)if((s=t[o])&&!(2&s.__u)&&a==s.key&&i==s.type)return o;for(o=n+1;o<t.length;o++)if((s=t[o])&&!(2&s.__u)&&a==s.key&&i==s.type)return o}return-1}function nu(e,t,n){n==null&&(n=""),t[0]=="-"?e.setProperty(t,n):e[t]=n}function ta(e,t,n,r,o){var a,i;if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||nu(e.style,t);if(n)for(t in n)r&&n[t]==r[t]||nu(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")(e.__e||(e.__e={}))[t]=n,n&&r||(i=ps[t]||(ps[t]=Tg(t)),(e.__a||(e.__a={}))[t]=ms,a=t!=(t=t.replace(au,"$1")),(t=t.slice(2))[0]<"a"&&(t=t.toLowerCase()),n?e.addEventListener(t,i,a):e.removeEventListener(t,i,a));else{if(o=="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{return void(e[t]=n??"")}catch{}if(typeof n=="function")return;n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n)}}function Tg(e){return function(t){var n=this.__e;if(n){if(n=n[e],t[na]==null)t[na]=ms++;else if(t[na]<this.__a[e])return;return n(pe.event?pe.event(t):t)}}}function hs(e,t,n,r,o,a,i,s,c,p){var _,d,u,f,m,v,x,P,b,C,h,g,k,w,T,A,M,N,O=t.type;if(t.constructor!==Xr)return null;128&n.__u&&(c=32&n.__u,_=n.__c.__z)&&(t.__u|=c,d=a=[],_.nodeType==8?s=_s(_,a):a.push(_),s=a[0]||s),(_=pe.__b)&&_(t);e:if(typeof O=="function"){u=i.length;try{if(P=t.props,b=(_=O.prototype)&&_.render,C=(_=O.contextType)&&r[_.__c],h=_?C?C.props.value:_.__:r,(f=n.__c)?(t.__c=f,2&f.__g&&(f.__g|=1)):(b?t.__c=f=new O(P,h):(t.__c=f=new Ft(P,h),f.constructor=O,f.render=Rg),C&&C.sub(f),f.state||(f.state={}),f.__n=r,f.__g|=8,f.__h=[],f.__k=[]),b&&(f.__s||(f.__s=f.state),O.getDerivedStateFromProps&&(f.__s==f.state&&(f.__s=Un({},f.__s)),Un(f.__s,O.getDerivedStateFromProps(P,f.__s)))),m=f.props,v=f.state,f.__v=t,n.__c){if(P!==m&&b&&!O.getDerivedStateFromProps&&f.componentWillReceiveProps&&f.componentWillReceiveProps(P,h),t.__v==n.__v&&!(8&f.__g)||!(4&f.__g)&&f.shouldComponentUpdate&&f.shouldComponentUpdate(P,f.__s,h)===!1){t.__v!=n.__v&&(f.props=P,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(z){z&&(z.__=t)}),aa.push.apply(f.__h,f.__k),f.__k=[],f.__h.length&&i.push(f),s=xn(n);break e}f.componentWillUpdate&&f.componentWillUpdate(P,f.__s,h),b&&f.componentDidUpdate&&f.__h.push(function(){f.componentDidUpdate(m,v,x)})}else b&&!O.getDerivedStateFromProps&&f.componentWillMount&&f.componentWillMount(),b&&f.componentDidMount&&f.__h.push(f.componentDidMount);if(f.context=h,f.props=P,f.__P=e,f.__g&=-5,g=pe.__r,k=0,b)f.state=f.__s,f.__g&=-9,g&&g(t),_=f.render(f.props,f.state,f.context),aa.push.apply(f.__h,f.__k),f.__k=[];else do f.__g&=-9,g&&g(t),_=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++k<25);f.state=f.__s,f.getChildContext&&(r=Un({},r,f.getChildContext())),b&&n.__c&&f.getSnapshotBeforeUpdate&&(x=f.getSnapshotBeforeUpdate(m,v)),w=_&&_.type===de&&_.key==null?_.props.children:_,P.__P&&(_=s,o=(e=P.__P).namespaceURI,c=a=null,n.props&&n.props.__P!=e&&(n.__k.some(function(z){z&&ys(z,z)}),n.__k=null),s=n.__k?xn(n,0):null),s=lu(e,ia(w)?w:[w],t,n,r,o,a,i,s,c,p),P.__P&&(t.__e=null,s=_),t.__u&=-161,d&&d.some(Bn),f.__h.length&&i.push(f),1&f.__g&&(f.__g&=-4)}catch(z){if(i.length=u,t.__v=null,c||a)if(z.then){if(T=0,t.__u|=128|c,a){for(~(M=a.indexOf(s||void 0))||(M=a.length);(N=a[M-1])&&N.nodeType==8;)M--;for(;M<a.length;M++)if(N=a[M]){if(a[M]=null,N.nodeType==8){if(N.data.startsWith("$s"))T++||(A=N);else if(T&&N.data.startsWith("/$s")&&!--T)break}else if(!T)break}}if(!A){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;A=s}(_=_s(A=t.__c.__z||(t.__c.__z=A)))?(t.__e=A,s=_):t.__e=s,s=s&&s.nextSibling}else a&&a.some(Bn);else t.__e=n.__e;t.__k||(t.__k=n.__k||[]),z.then||uu(t),pe.__e(z,t,n)}}else s=t.__e=Ig(n.__e,t,n,r,o,a,i,c,p,e);return(_=pe.diffed)&&_(t),s}function _s(e,t){if(e&&e.nodeType==8&&e.data.startsWith("$s"))for(var n=1;e=e.nextSibling;){if(e.nodeType==8){if(e.data.startsWith("$s"))n++;else if(e.data.startsWith("/$s")&&!--n)return e}t&&t.push(e)}}function uu(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(uu))}function du(e,t,n){for(var r=0;r<n.length;)vs(n[r++],n[r++],n[r++]);pe.__c&&pe.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(a){a.call(o)})}catch(a){pe.__e(a,o.__v)}})}function Ig(e,t,n,r,o,a,i,s,c,p){var _,d,u,f,m,v,x,P,b,C=n.props||oa,h=t.props,g=t.type;if(g=="svg"?o="http://www.w3.org/2000/svg":g=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),a){for(_=0;_<a.length;_++)if((m=a[_])&&(g?m.localName==g:m.nodeType==3)){e=m,a[_]=null;break}}if(!e){if(P=p.ownerDocument||document,!g)return P.createTextNode(h);e=P.createElementNS(o,g,h.is&&h),s&&(pe.__m&&pe.__m(t,a),s=!1),a=null}if(g){if(p=g=="template"?e.content:e,a=g=="textarea"&&h.defaultValue!=null?null:a&&gs.call(p.childNodes),!s&&a)for(C={},_=0;_<e.attributes.length;_++)C[(m=e.attributes[_]).name]=m.value;for(_ in C)m=C[_],_=="dangerouslySetInnerHTML"?u=m:_=="children"||_ in h||_=="value"&&"defaultValue"in h||_=="checked"&&"defaultChecked"in h||ta(e,_,null,m,o);for(_ in b=1&n.__u,h)m=h[_],_=="children"?f=m:_=="dangerouslySetInnerHTML"?d=m:_=="value"?v=m:_=="checked"?x=m:s&&typeof m!="function"||!(C[_]!==m||b&&m!=null)||ta(e,_,m,C[_],o);d?(s||u&&(d.__html==u.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[]):(u&&(e.textContent=""),(g=="foreignObject"||o=="http://www.w3.org/1998/Math/MathML"&&kg.test(g))&&(o="http://www.w3.org/1999/xhtml"),lu(p,ia(f)?f:[f],t,n,r,o,a,i,a?a[0]:n.__k&&xn(n,0),s,c),a&&a.some(Bn)),s&&g!="textarea"||(_="value",g=="progress"&&v==null?e.removeAttribute(_):v==null||v===e[_]&&(g!="progress"||v)||ta(e,_,v,C[_],o),_="checked",x!=null&&x!=e[_]&&ta(e,_,x,C[_],o))}else C===h||s&&e.data==h||(e.data=h);return e}function vs(e,t,n,r){try{typeof e=="function"?t?t.__x=e(t)||1:r&&(r=r.__c||r.__e)&&(t=r.__x)&&(r.__x=null,typeof t=="function"?t():e(null)):e.current=t}catch(o){pe.__e(o,n)}}function ys(e,t,n){var r,o,a,i;if(pe.unmount&&pe.unmount(e),!(r=e.ref)||r.current&&r.current!=e.__e||vs(r,null,t,e),r=e.__c){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(s){pe.__e(s,t)}r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&ys(r[i],t,typeof e.type!="function"||n&&!e.props.__P);!n&&(r=e.__c)&&(r=r.__z)&&(o=_s(r,a=[]))&&(r==e.__e&&a.some(Bn),Bn(o),Bn(r)),(r=e.__e)&&(n||Bn(r),r.__e&&(r.__e=null)),e.__e=e.__c=e.__=null}function Rg(e,t,n){return this.constructor(e,n)}function Qt(e,t){var n,r,o,a;pe.__&&pe.__(e,t),t.nodeType==9&&(t=t.documentElement),r=(n=e&&32&e.__u)?null:t.__k,t.__k=Qr(de,{children:[e]}),o=[],a=[],hs(t,t.__k,r||oa,oa,t.namespaceURI,r?null:t.firstChild?gs.call(t.childNodes):null,o,r?r.__e:t.firstChild,n,a),du(o,t.__k,a),t.__k.props.children=null}pe={__e:function(e,t,n,r){for(var o,a,i;t=t.__;)if((o=t.__c)&&!(1&o.__g)){o.__g|=4;try{if((i=(a=o.constructor)&&a.getDerivedStateFromError)&&o.setState(a.getDerivedStateFromError(e)),o.componentDidCatch&&(o.componentDidCatch(e,r||{}),i=1),i&&8&o.__g)return void(o.__g|=2)}catch(s){e=s}}throw ra=0,e}},ru=0,fs=function(e){return e!=null&&e.constructor===Xr},Ft.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=Un({},this.state)),typeof e=="function"&&(e=e(Un({},n),this.props)),e&&(Un(n,e),this.__v&&(t&&this.__k.push(t),tu(this)))},Ft.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),tu(this))},Ft.prototype.render=de,Pn=[],ra=0,ou=function(e,t){return e.__v.__b-t.__v.__b},na=Symbol(),au=/(PointerCapture)$|Capture$/i,ms=0,ps={},Sg=0;function It(){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,Eg(t.subarray(6)),t[6]=t[6]&15|112,t[8]=t[8]&63|128;let n=Array.from(t,r=>r.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 Eg(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 an=Z.scope("persistence");function kn(e,t=Vo,n){let r=n?`${e}.${n}`:e,o=`${E.cssPrefix}.storageVersion`,a=t.get(o)??void 0,i=a?`.v${a}`:"",s=`${E.cssPrefix}.${r}${i}`,c=`${E.cssPrefix}${i}.visitorId`,p=`${s}.conversationId`,_=`${s}.userPrefs`,d=`${s}.panelOpen`,u=`${s}.panelSize`,f=`${s}.calloutDismissed`,m=`${s}.sidebarCollapsed`,v=`${s}.activeModule`,x=`${s}.seenNewsId`,P=`${s}.historyCount`,b=`${s}.formsDone`,C={getVisitorId(){let h=t.get(c);if(h)return h;let g=It();return t.set(c,g),g},loadConversationId(){return t.get(p)??void 0},saveConversationId(h){an.trace("saveConversationId",{id:h,scope:r}),h?t.set(p,h):t.remove(p)},loadDraft(h){return t.get(`${s}.draft.${h}`)??""},saveDraft(h,g){let k=`${s}.draft.${h}`;g?t.set(k,g):t.remove(k)},loadMessageQueue(h){let g=t.get(`${s}.messageQueue.${h}`);if(!g)return[];try{let k=JSON.parse(g);return!Array.isArray(k)||!k.every(Ag)?[]:k}catch(k){return an.warn("loadMessageQueue parse failed",{error:k}),[]}},saveMessageQueue(h,g){let k=`${s}.messageQueue.${h}`;if(g.length===0){t.remove(k);return}try{t.set(k,JSON.stringify(g))}catch(w){an.warn("saveMessageQueue serialise failed",{error:w})}},loadUserPrefs(){let h=t.get(_);if(!h)return{};try{return bs(JSON.parse(h))}catch(g){return an.warn("loadUserPrefs parse failed",{error:g}),{}}},saveUserPrefs(h){try{t.set(_,JSON.stringify(h))}catch(g){an.warn("saveUserPrefs serialise failed",{error:g})}},patchUserPrefs(h){let g=C.loadUserPrefs();C.saveUserPrefs({...g,...h})},loadPanelOpen(){let h=t.get(d);return h==="1"?!0:h==="0"?!1:null},savePanelOpen(h){t.set(d,h?"1":"0")},loadPanelSize(){let h=t.get(u);return h==="normal"||h==="expanded"||h==="fullscreen"?h:null},savePanelSize(h){t.set(u,h)},loadCalloutDismissed(h){if(!h)return!1;let g=t.get(f);return!!g&&g===h},saveCalloutDismissed(h){h?t.set(f,h):t.remove(f)},loadSidebarCollapsed(){let h=t.get(m);return h==="1"?!0:h==="0"?!1:null},saveSidebarCollapsed(h){t.set(m,h?"1":"0")},loadActiveModule(){return t.get(v)||null},saveActiveModule(h){t.set(v,h)},loadSeenNewsId(){return t.get(x)||null},saveSeenNewsId(h){t.set(x,h)},loadHistoryCount(){let h=t.get(P);if(!h)return null;let g=Number.parseInt(h,10);return Number.isFinite(g)&&g>=0?g:null},saveHistoryCount(h){t.set(P,String(h))},loadFormsDone(){let h=t.get(b);if(!h)return{};try{let g=JSON.parse(h);return la(g)?Object.fromEntries(Object.entries(g).filter(k=>typeof k[1]=="number")):{}}catch(g){return an.warn("loadFormsDone parse failed",{error:g}),{}}},saveFormDone(h){try{let g=C.loadFormsDone();g[h]=Date.now(),t.set(b,JSON.stringify(g))}catch(g){an.warn("saveFormDone serialise failed",{error:g})}},rememberStorageVersion(h){h&&h!==t.get(o)&&(an.debug("rememberStorageVersion (force-reset on next load)",{version:h}),t.set(o,h))},clearConversation(){t.remove(p)},reset(){let h=t.get(p);h&&(t.remove(`${s}.draft.${h}`),t.remove(`${s}.messageQueue.${h}`));for(let g of[c,p,_,d,u,f,m,v,x,P,b])t.remove(g);an.info("reset: forgot the visitor",{scope:r})}};return C}function la(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ag(e){return la(e)&&typeof e.id=="string"&&e.id.length>0&&typeof e.text=="string"}function bs(e){if(!la(e))return{};let t={};return typeof e.locale=="string"&&(t.locale=e.locale),typeof e.soundMuted=="boolean"&&(t.soundMuted=e.soundMuted),(e.themeMode==="auto"||e.themeMode==="light"||e.themeMode==="dark")&&(t.themeMode=e.themeMode),(e.textSize==="small"||e.textSize==="normal"||e.textSize==="large")&&(t.textSize=e.textSize),la(e.widgetSize)&&typeof e.widgetSize.width=="number"&&typeof e.widgetSize.height=="number"&&(t.widgetSize={width:e.widgetSize.width,height:e.widgetSize.height}),t}var dr="1.13.1";var Mg="1",pu=60,Lg=2e3,_u={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}),hostEvent:e=>({name:e.name,data:e.data&&JSON.stringify(e.data)}),messageFeedback:e=>({value:e.value??"none"}),contentView:e=>({section:e.section,count:e.count}),contentOpen:e=>({contentId:e.contentId,contentCollectionId:e.contentCollectionId}),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 Ng(){let e=navigator;return e.globalPrivacyControl===!0||e.doNotTrack==="1"}function Og(){return location.origin+location.pathname}function $g(){try{return document.referrer?new URL(document.referrer).origin:""}catch{return""}}function fu(e,t){let n=Math.random(),r=0,o=0,a=new Set;function i(_,d){let{tracking:u,publicKey:f,aiAgentDeploymentId:m,mode:v,themeMode:x}=t.getOptions();if(!u.enabled||Ng()||n>=u.sampleRate)return;let P=performance.now();if(P-r>6e4&&(r=P,o=0),++o>pu)return;let b=new URLSearchParams;b.set("v",Mg),b.set("_ev",dr),b.set("e",_),u.token&&b.set("tk",u.token),f&&b.set("pk",f),m&&b.set("dep",m),b.set("vid",t.getVisitorId());let C=t.getConversationId();C&&b.set("cid",C),b.set("url",Og());let h=$g();h&&b.set("ref",h),b.set("sw",String(screen.width)),b.set("sh",String(screen.height)),b.set("vw",String(innerWidth)),b.set("vh",String(innerHeight)),b.set("dpr",String(devicePixelRatio)),b.set("lang",navigator.language);try{b.set("tz",Intl.DateTimeFormat().resolvedOptions().timeZone)}catch{}if(b.set("m",v),b.set("th",x),d)for(let[T,A]of Object.entries(d))A!==void 0&&b.set(T,String(A));b.set("ts",String(Date.now()));let g=`${u.endpoint}?${b}`;if(g.length>Lg)return;let k=new Image(1,1);a.add(k);function w(){return a.delete(k)}k.addEventListener("load",w,{once:!0}),k.addEventListener("error",w,{once:!0}),k.src=g}let s=[];function c(_,d){if(s&&_!=="handshake"){s.length<pu&&s.push([_,d]);return}let u=s??[];s=void 0;for(let[f,m]of u)i(f,m);i(_,d)}let p=Object.keys(_u).map(_=>e.on(_,d=>c(_,_u[_]?.(d))));return()=>{for(let _ of p)_();a.clear()}}var mu=`.__P__-generative-ui{display:grid;gap:var(--__P__-space-3);overflow-wrap:anywhere;white-space:pre-wrap}.__P__-generative-ui p{margin:0}.__P__-generative-ui-grid-container{container:__P__-generative-ui-grid / inline-size;min-width:0}.__P__-generative-ui-grid{display:grid;grid-template-columns:minmax(0,1fr);align-items:start;gap:16px}.__P__-generative-ui-cell{display:grid;align-content:start;min-width:0;gap:16px}@container __P__-generative-ui-grid (min-width: 496px){.__P__-generative-ui-grid:is([data-columns="2"],[data-columns="3"],[data-columns="4"]){grid-template-columns:repeat(2,minmax(0,1fr))}.__P__-generative-ui-grid:is([data-columns="2"],[data-columns="3"],[data-columns="4"])>.__P__-generative-ui-cell:is([data-span="2"],[data-span="3"],[data-span="4"]){grid-column:span 2}}@container __P__-generative-ui-grid (min-width: 752px){.__P__-generative-ui-grid:is([data-columns="3"],[data-columns="4"]){grid-template-columns:repeat(3,minmax(0,1fr))}.__P__-generative-ui-grid:is([data-columns="3"],[data-columns="4"])>.__P__-generative-ui-cell:is([data-span="3"],[data-span="4"]){grid-column:span 3}}@container __P__-generative-ui-grid (min-width: 1008px){.__P__-generative-ui-grid[data-columns="4"]{grid-template-columns:repeat(4,minmax(0,1fr))}.__P__-generative-ui-grid[data-columns="4"]>.__P__-generative-ui-cell[data-span="4"]{grid-column:span 4}}.__P__-generative-ui section{display:grid;gap:var(--__P__-space-2);padding:var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);min-width:0}.__P__-generative-ui-metric{font-size:1.6em;font-weight:700}.__P__-generative-ui-table{overflow-x:auto}.__P__-generative-ui table{width:100%;border-collapse:collapse;white-space:normal}.__P__-generative-ui caption{text-align:start;font-weight:600;padding-bottom:var(--__P__-space-2)}.__P__-generative-ui th,.__P__-generative-ui td{text-align:start;padding:var(--__P__-space-2);border-bottom:1px solid var(--__P__-border)}.__P__-generative-ui-chart{display:block;width:100%;color:var(--__P__-accent)}.__P__-generative-ui-axis{stroke:var(--__P__-border)}.__P__-generative-ui-data{display:flex;flex-wrap:wrap;gap:var(--__P__-space-2);font-size:.85em}
2
- `;var gu=`: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;border-radius:var(--__P__-radius-md)}: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}}
3
- `;var hu=`.__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:var(--__P__-radius-md);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);flex-shrink:0}.__P__-agent-avatar img{width:100%;height:100%;border-radius:inherit;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;position:relative;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 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__-file-image,.__P__-file-chip{margin-block:var(--__P__-space-1);border-radius:var(--__P__-radius-sm);color:inherit;text-decoration:none}.__P__-file-image{display:block;width:fit-content;max-width:min(100%,240px);overflow:hidden}.__P__-file-image img{max-height:240px;object-fit:cover}.__P__-file-chip{display:flex;align-items:center;gap:var(--__P__-space-2);max-width:min(100%,280px);padding:var(--__P__-space-2);border:1px solid color-mix(in srgb,currentColor 18%,transparent);background:color-mix(in srgb,currentColor 5%,transparent);transition:background var(--__P__-dur-base) var(--__P__-ease)}.__P__-file-chip:hover{background:color-mix(in srgb,currentColor 10%,transparent)}.__P__-file-image:focus-visible,.__P__-file-chip:focus-visible{outline:2px solid currentColor;outline-offset:2px}.__P__-file-chip-icon{flex:none;display:grid;place-items:center;width:32px;height:32px;border-radius:var(--__P__-radius-sm);background:color-mix(in srgb,currentColor 10%,transparent)}.__P__-file-chip-text{display:grid;min-width:0;line-height:1.35}.__P__-file-chip-name{font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.__P__-file-chip-meta{font-size:var(--__P__-text-xs);opacity:.75}.__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__-steps{margin:var(--__P__-space-1) 0 var(--__P__-space-2);font-size:var(--__P__-text-sm)}.__P__-steps-head,.__P__-steps-row-head{display:flex;align-items:center;gap:var(--__P__-space-2);width:100%;min-width:0;padding:var(--__P__-space-1) 0;border:0;background:none;color:var(--__P__-fg-muted);font:inherit;text-align:start;cursor:pointer;-webkit-tap-highlight-color:transparent}.__P__-steps-head:hover,.__P__-steps-row-head:hover{color:var(--__P__-fg)}.__P__-steps-head:focus-visible,.__P__-steps-row-head:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;border-radius:var(--__P__-radius-sm)}.__P__-steps-icon,.__P__-steps-row-icon{display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;width:16px;height:16px}.__P__-steps-icon svg,.__P__-steps-row-icon svg{width:14px;height:14px}.__P__-steps-label{display:flex;flex:1;align-items:center;gap:var(--__P__-space-1);min-width:0;overflow:hidden;white-space:nowrap}.__P__-steps-name{display:inline-flex;align-items:center;gap:var(--__P__-space-1);min-width:0}.__P__-steps-name-text,.__P__-steps-row-summary{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-steps-count,.__P__-steps-failed,.__P__-steps-denied{flex-shrink:0;font-variant-numeric:tabular-nums}.__P__-steps-failed{color:var(--__P__-danger-text)}.__P__-steps-denied{color:var(--__P__-fg-muted)}.__P__-steps-head .__P__-toolui-chevron[data-open=true]{transform:rotate(180deg)}.__P__-steps-list{display:flex;flex-direction:column;gap:var(--__P__-space-1);margin:var(--__P__-space-1) 0 0;padding:0;padding-inline-start:var(--__P__-space-2);border-inline-start:2px solid var(--__P__-border);list-style:none}.__P__-steps-row[data-status=error] .__P__-steps-row-icon{color:var(--__P__-danger-text)}.__P__-steps-row-name{flex-shrink:0;color:var(--__P__-fg);font-weight:500}.__P__-steps-row-body{display:flex;flex-direction:column;gap:var(--__P__-space-2);margin:var(--__P__-space-1) 0 var(--__P__-space-2)}.__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__-compaction-status{width:100%;padding:10px 14px;justify-content:center;font-size:var(--__P__-text-xs)}.__P__-message-queue{display:flex;max-height:112px;flex-direction:column;gap:var(--__P__-space-1);overflow-y:auto}.__P__-attachment-chip.__P__-queued-message{width:100%;max-width:none}.__P__-queued-text{min-width:0;flex:1}.__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-card>[role=listitem]{display:flex;flex-direction:column}.__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-card>*+*{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:var(--__P__-radius-md);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:var(--__P__-radius-md)}.__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__-help-more{justify-content:center;color:var(--__P__-accent-fg);font-weight:600}.__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)}@media(hover:hover){.__P__-tab:hover{background:var(--__P__-hover)}}.__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:var(--__P__-radius-md);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:var(--__P__-radius-md);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;line-height:1.45}.__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__-home-ask{padding-block:6px;padding-inline-end:6px}.__P__-home-ask .__P__-send{width:32px;height:32px;flex-shrink:0}.__P__-home-ask .__P__-send[data-shape=pill]{width:auto;padding:0 14px}.__P__-home-ask .__P__-send svg{width:16px;height:16px}.__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-vote{display:flex;align-items:center;flex-wrap:wrap;gap:var(--__P__-space-2);padding-top:var(--__P__-space-3);border-top:1px solid var(--__P__-border)}.__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;line-height:1.45;border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);overflow:hidden;background:var(--__P__-surface);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-meta{display:flex;flex-wrap:wrap;align-items:center;gap:6px;color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm)}.__P__-news-tag{padding:1px 8px;border-radius:6px;background:var(--__P__-hover);color:var(--__P__-fg);font-size:calc(12px * var(--__P__-text-scale));white-space:nowrap}.__P__-news-more{display:flex;align-items:center;justify-content:center;gap:var(--__P__-space-2);width:100%;min-height:44px;border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);background:var(--__P__-surface);color:var(--__P__-accent-fg);font-weight:600}.__P__-news-more:hover{background:var(--__P__-bg-elevated)}.__P__-news-more:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__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__-toolui-status[data-status=incomplete]{--__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-fields{display:grid;grid-template-columns:auto minmax(0,1fr);gap:2px var(--__P__-space-2);margin:0;font-size:var(--__P__-text-xs);line-height:1.5}.__P__-toolui-fields>div{display:contents}.__P__-toolui-fields dt{color:var(--__P__-fg-muted)}.__P__-toolui-fields dd{margin:0;min-width:0;overflow:hidden;color:var(--__P__-fg);font-family:var(--__P__-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);text-overflow:ellipsis;white-space:nowrap}.__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
- `;var vu=`*,*: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}
5
- `;var yu=`: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}}
6
- `;var qg="helpai",zg="#5B5BD6",jg="#FFFFFF",Vg="12px",Wg="Inter, system-ui, -apple-system, 'Segoe UI', sans-serif",xs=[yu,vu,hu,mu,gu].join(`
7
- `).replace(/__P__/g,qg).replaceAll("__BRAND_ACCENT_TEXT__",jg).replaceAll("__BRAND_ACCENT__",zg).replaceAll("__BRAND_RADIUS__",Vg).replaceAll("__BRAND_FONT__",Wg);var Pu=["data-theme","data-color-scheme","data-mode","data-bs-theme"];function bu(e){if(e){if(e.classList.contains("dark"))return"dark";if(e.classList.contains("light"))return"light";for(let t of Pu){let n=e.getAttribute(t);if(n==="dark"||n==="light")return n}}}function pr(e=document){let t=bu(e.documentElement)??bu(e.body);if(t)return t;let n=getComputedStyle(e.documentElement).colorScheme.trim();return n==="dark"||n==="light"?n:typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function xu(e,t=document){let n=pr(t);e(n);function r(){let s=pr(t);s!==n&&(n=s,e(s))}let o=new MutationObserver(r),a={attributes:!0,attributeFilter:["class","style",...Pu]};o.observe(t.documentElement,a),t.body&&o.observe(t.body,a);let i=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):void 0;return i?.addEventListener("change",r),()=>{o.disconnect(),i?.removeEventListener("change",r)}}var Gg=Z.scope("mount"),Su=new WeakMap,ku={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 wu(e,t){e.style.cssText=ku[t]}function Hn(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function _r(e={}){let t=e.position??"flow";Gg.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${E.cssPrefix}-chat-host`;typeof customElements<"u"&&!customElements.get(n)&&customElements.define(n,class extends HTMLElement{});let r;e.existingHost?r=e.existingHost:(r=document.createElement(n),(e.target??document.body).appendChild(r)),r.setAttribute("data-brand",E.id),r.style.cssText=ku[t];let o=r.shadowRoot??r.attachShadow({mode:"open"});for(let s of["keydown","keypress","keyup"])o.addEventListener(s,Kg);let a=r.ownerDocument;if(!Qg(o,a)){let s=a.createElement("style");s.textContent=xs,o.appendChild(s)}let i=document.createElement("div");return i.className=`${E.cssPrefix}-app`,o.appendChild(i),{appRoot:i,destroy:()=>r.remove(),hostElement:r,shadowRoot:o}}function Kg(e){let t=e.composedPath()[0];t instanceof HTMLElement&&(t.isContentEditable||t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT")&&e.stopPropagation()}function Qg(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let r=Su.get(t);if(!r)try{r=new n.CSSStyleSheet,r.replaceSync(xs),Su.set(t,r)}catch{return!1}try{return e.adoptedStyleSheets=[r],!0}catch{return!1}}function Xg(e,t){let n=E.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 Jg(e,t){e.dataset.theme=t==="host"?pr():t}function Yg(e,t){let n=E.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 Zg(e,t){e.dataset.position=t}function ca(e,t){e.dataset.mode=t}function Cu(e,t){Jg(e,t.themeMode),Xg(e,t.themeOverrides),Zg(e,t.position),Yg(e,t.size)}var fr,tt,Ss,Tu,ks=Object.is,Yr=0,$u=[],ws=[],Qe=pe,Iu=Qe.__b,Ru=Qe.__r,Eu=Qe.diffed,Au=Qe.__c,Mu=Qe.unmount,Lu=Qe.__;function ua(e,t){Qe.__h&&Qe.__h(tt,e,Yr||t),Yr=0;var n=tt.__H||(tt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function H(e){return Yr=1,Du(Fu,e)}function Du(e,t,n){var r=ua(fr++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Fu(void 0,t),function(a){var i=r.__N?r.__N[0]:r.__[0],s=r.t(i,a);ks(i,s)||(r.__N=[s,r.__[1]],r.__c.setState({}))}],r.__c=tt,!tt.__f)){tt.__f=!0;var o=tt.shouldComponentUpdate;tt.shouldComponentUpdate=function(a,i,s){var c=this.__H;if(!c)return!0;var p=!1,_=this.props!=a;if(c.__.some(function(u){u.__N&&(p=!0,ks(u.__[0],u.__N[0])||(_=!0))}),o){var d=o.call(this,a,i,s);return p?d||_:d}return!p||_}}return r.__}function D(e,t){var n=ua(fr++,3);!Qe.__s&&Ts(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,tt.__H.__h.push(n))}function Rt(e,t){var n=ua(fr++,4);!Qe.__s&&Ts(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,tt.__h.push(n))}function F(e){return Yr=5,ue(function(){return{current:e}},[])}function ue(e,t){var n=ua(fr++,7);return Ts(n.__H,t)&&(n.__=e(),n.__H=t),n.__}function $(e,t){return Yr=8,ue(function(){return e},t)}function eh(){var e;do{for(;e=ws.shift();)try{Jr(e)}catch(n){Qe.__e(n,{__:(e=e.__P)&&e.__v})}for(;e=$u.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Jr),t.__h.some(Cs),t.__h=[]}catch(n){t.__h=[],Qe.__e(n,e.__v)}}}while(ws.length)}Qe.__b=function(e){tt=null,Iu&&Iu(e)},Qe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Lu&&Lu(e,t)},Qe.__r=function(e){Ru&&Ru(e),fr=0;var t=(tt=e.__c).__H;t&&(Ss==tt?tt.__h=[]:(t.__h.some(Jr),t.__h.some(Cs),fr=0),t.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})),Ss=tt},Qe.diffed=function(e){Eu&&Eu(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&Ou($u.push(t)),t.__H.__.some(function(n){n.u&&(n.__H=n.u)})),Ss=tt=null},Qe.__c=function(e,t){t.some(function(n){try{n.__h.some(Jr),n.__h=n.__h.filter(function(r){return!r.__||Cs(r)})}catch(r){n.__h=[function(){throw r}]}}),Au&&Au(e,t)},Qe.unmount=function(e){Mu&&Mu(e);var t,n,r=e.__c;r&&r.__H&&(r.__H.__.some(function(o){try{if(o.__P&&o.__c){if(n===void 0){for(n=e.__;n&&(!n.__c||!n.__c.__P);)n=n.__;n=n&&n.__c}o.__P=n,Ou(ws.push(o))}else Jr(o)}catch(a){t=a}}),r.__H=void 0,t&&Qe.__e(t,r.__v))};var Nu=typeof requestAnimationFrame=="function";function th(e){var t,n=function(){clearTimeout(r),Nu&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Nu&&(t=requestAnimationFrame(n))}function Ou(e){e!=1&&Tu==Qe.requestAnimationFrame||((Tu=Qe.requestAnimationFrame)||th)(eh)}function Jr(e){var t=tt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),tt=t}function Cs(e){var t=tt;e.__c=e.__(),tt=t}function Ts(e,t){return!e||e.length!=t.length||t.some(function(n,r){return!ks(n,e[r])})}function Fu(e,t){return typeof t=="function"?t(e):t}var nh=Symbol.for("preact-signals");function fa(){if(sn>1)sn--;else{var e,t=!1;for((function(){var o=pa;for(pa=void 0;o!==void 0;){var a=o.S;if(a.v===o.v)for(var i=a.t;i!==void 0;i=i.x)i.i===o.i&&(i.i=a.i);o=o.o}})();eo!==void 0;){var n=eo;for(eo=void 0,da++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Uu(n))try{n.c()}catch(o){t||(e=o,t=!0)}n=r}}if(da=0,sn--,t)throw e}}function Bt(e){if(sn>0)return e();Is=++rh,sn++;try{return e()}finally{fa()}}var Zr,$e=void 0;function to(e){var t=$e,n=Zr;$e=void 0,Zr=void 0;try{return e()}finally{$e=t,Zr=n}}var eo=void 0,sn=0,da=0,rh=0,Is=0,pa=void 0,_a=0;function Bu(e){if($e!==void 0){var t=e.n;if(t===void 0||t.t!==$e)return t={i:0,S:e,p:$e.s,n:void 0,t:$e,e:void 0,x:void 0,r:t},$e.s!==void 0&&($e.s.n=t),$e.s=t,e.n=t,32&$e.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=$e.s,t.n=void 0,$e.s.n=t,$e.s=t),t}}function lt(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}lt.prototype.brand=nh;lt.prototype.h=function(){return!0};lt.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 r;(r=t.W)==null||r.call(t)}))};lt.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&to(function(){var o;(o=t.Z)==null||o.call(t)}))}};lt.prototype.subscribe=function(e){var t=this;return Wt(function(){var n=t.value;to(function(){return e(n)})},{name:"sub"})};lt.prototype.valueOf=function(){return this.value};lt.prototype.toString=function(){return this.value+""};lt.prototype.toJSON=function(){return this.value};lt.prototype.peek=function(){var e=this;return to(function(){return e.value})};Object.defineProperty(lt.prototype,"value",{get:function(){var e=Bu(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(da>100)throw new Error("Cycle detected");(function(n){sn!==0&&da===0&&n.l!==Is&&(n.l=Is,pa={S:n,v:n.v,i:n.i,o:pa})})(this),this.v=e,this.i++,_a++,sn++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{fa()}}}});function le(e,t){return new lt(e,t)}function Uu(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 Hu(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 qu(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function qn(e,t){lt.call(this,void 0,t),this.x=e,this.s=void 0,this.g=_a-1,this.f=4}qn.prototype=new lt;qn.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===_a))return!0;if(this.g=_a,this.f|=1,this.i>0&&!Uu(this))return this.f&=-2,!0;var e=$e;try{Hu(this),$e=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 $e=e,qu(this),this.f&=-2,!0};qn.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)}lt.prototype.S.call(this,e)};qn.prototype.U=function(e){if(this.t!==void 0&&(lt.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)}};qn.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(qn.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Bu(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Se(e,t){return new qn(e,t)}function zu(e){var t=e.j;if(e.j=void 0,typeof t=="function"){sn++;var n=$e;$e=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,Rs(e),r}finally{$e=n,fa()}}}function Rs(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,zu(e)}function oh(e){if($e!==this)throw new Error("Out-of-order effect");qu(this),$e=e,this.f&=-2;try{8&this.f&&Rs(this)}finally{fa()}}function mr(e,t){this.x=e,this.j=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Zr&&Zr.push(this)}mr.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.j=t)}finally{e()}};mr.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,zu(this),Hu(this),sn++;var e=$e;return $e=this,oh.bind(this,e)};mr.prototype.N=function(){2&this.f||(this.f|=2,this.u=eo,eo=this)};mr.prototype.d=function(){this.f|=8,1&this.f||Rs(this)};mr.prototype.dispose=function(){this.d()};function Wt(e,t){var n=new mr(e,t);try{n.c()}catch(o){throw n.d(),o}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var ju,ro,ma,ah=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var Vu=[];Wt(function(){ju=this.N})();function gr(e,t){pe[e]=t.bind(null,pe[e]||function(){})}function no(e){if(ma){var t=ma;ma=void 0,t()}ma=e&&e.S()}function Wu(e){var t=this,n=e.data,r=Ot(n);r.name="ReactiveDom",r.value=n;var o=ue(function(){for(var s=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var p=Se(function(){var f=r.value.value;return f===0?0:f===!0?"":f||""}),_=Se(function(){return!Array.isArray(p.value)&&!fs(p.value)}),d=Wt(function(){if(this.N=Gu,_.value){var f=p.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=f)}}),u=t.__$u.d;return t.__$u.d=function(){d(),u.call(this)},[_,p]},[]),a=o[0],i=o[1];return a.value?i.peek():i.value}Wu.displayName="ReactiveTextNode";Object.defineProperties(lt.prototype,{constructor:{configurable:!0,value:Sn(de,null).constructor},type:{configurable:!0,value:Wu},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});gr("__b",function(e,t){if(no(),ro=void 0,typeof t.type=="string"){var n,r=t.props;for(var o in r)if(o!=="children"){var a=r[o];a instanceof lt&&(n||(t.__np=n={}),n[o]=a,r[o]=a.peek())}}e(t)});gr("__r",function(e,t){if(e(t),t.type!==de){no();var n,r=t.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=(function(o,a){var i;return Wt(function(){i=this},{name:a}),i.c=o,i})((function(o){return function(){var a;ah&&((a=this.y)==null||a.call(this)),o.__$f|=1,o.setState({})}})(r),typeof t.type=="function"?t.type.displayName||t.type.name:""))),ro=r,no(n)}});gr("__e",function(e,t,n,r){no(),ro=void 0,e(t,n,r)});gr("diffed",function(e,t){no(),ro=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var r=t.__np,o=t.props,a=n.U;if(a)for(var i in a){var s=a[i];s===void 0||r&&i in r||(s.d(),a[i]=void 0)}if(r){a||(a={},n.U=a);for(var c in r){var p=a[c],_=r[c];p===void 0?(p=ih(n,c,_,o),a[c]=p):p.o(_,o)}}}e(t)});function ih(e,t,n,r){var o=t in e&&e.ownerSVGElement===void 0,a=le(n);return{o:function(i,s){a.value=i,r=s},d:Wt(function(){this.N=Gu;var i=a.value.value;r[t]!==i&&(r[t]=i,o?e[t]=i:i!=null&&(i!==!1||t[4]==="-")?e.setAttribute(t,i):e.removeAttribute(t))})}}gr("unmount",function(e,t){if(typeof t.type=="string"){var n=t.__e;if(n){var r=n.U;if(r){n.U=void 0;for(var o in r){var a=r[o];a&&a.d()}}}var i=t.__np;if(i){var s=t.props;for(var c in i)s[c]=i[c]}t.__np=void 0}else{var p=t.__c;if(p){p.__$f|=8;var _=p.__$u;_&&(p.__$u=void 0,_.d())}}e(t)});gr("__h",function(e,t,n,r){r<3&&(t.__$f|=2),e(t,n,r)});Ft.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,r=n&&n.s!==void 0;for(var o in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var a=2&this.__$f;if(!(r||a||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var i in e)if(i!=="__source"&&e[i]!==this.props[i])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function Ot(e,t){return ue(function(){return le(e,t)},[])}function Et(e,t){var n=F(e);return n.current=e,ro.__$f|=4,ue(function(){return Se(function(){return n.current()},t)},[])}var sh=function(e){queueMicrotask(function(){queueMicrotask(e)})};function lh(){Bt(function(){for(var e;e=Vu.shift();)ju.call(e)})}function Gu(){Vu.push(this)===1&&(pe.requestAnimationFrame||sh)(lh)}var ch="x-public-key",uh="x-ai-agent-deployment-id";function Ku(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");return{headers(){let t={[uh]:e.aiAgentDeploymentId};return e.publicKey&&(t[e.publicKeyHeader??ch]=e.publicKey),t}}}function ga(e,t){let n=[],r;for(let o of e){let a=new URLSearchParams(o);a.has(t)?r??(r=a.get(t)??""):n.push(o)}return{value:r,rest:n}}function Qu(e){let t=new URL(e),n=E.cssPrefix,r=`${E.cssPrefix}-ask`,o=t.search.slice(1).split("&").filter(Boolean),a=t.hash.slice(1).split("&").filter(Boolean),i=ga(o,n),s=ga(i.rest,r),c=ga(a,n),p=ga(c.rest,r),_=i.value??c.value,d=(s.value??p.value)?.trim()||void 0;if(!(_===void 0&&d===void 0))return t.search=s.rest.join("&"),t.hash=p.rest.join("&"),{target:_===void 0?void 0:Jo(_),...d?{ask:d}:{},url:t.toString()}}var Xu=Z.scope("feedback:audio"),ha=class{constructor(){oe(this,"ctx",null);oe(this,"master",null);oe(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){Xu.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,r=this.master;if(!n||!r||n.state!=="running")return;let o=n.currentTime,a=t.noteMs/1e3;t.notes.forEach((i,s)=>{let c=n.createOscillator();c.type=t.type,c.frequency.value=i;let p=n.createGain(),_=o+s*a;p.gain.setValueAtTime(1e-4,_),p.gain.exponentialRampToValueAtTime(t.peakGain,_+.005),p.gain.exponentialRampToValueAtTime(1e-4,_+a),c.connect(p).connect(r),c.start(_),c.stop(_+a+.01)})}async playUrl(t){let n=this.ctx,r=this.master;if(!n||!r||n.state!=="running")return;let o=await this.getBuffer(t);if(!o)return;let a=n.createBufferSource();a.buffer=o,a.connect(r),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 r=this.ctx,o=fetch(t).then(a=>a.ok?a.arrayBuffer():Promise.reject(new Error(`fetch ${a.status}`))).then(a=>r.decodeAudioData(a)).then(a=>(this.buffers.set(t,a),a)).catch(a=>(Xu.warn("audio fetch/decode failed",{url:t,err:a}),this.buffers.delete(t),null));return this.buffers.set(t,o),o}};var Ju={messageReceived:10,messageSent:0,error:[20,40,20],voiceStart:10,voiceStop:0},Yu={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 wn=null,va=0;function dh(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}function ph(){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=`__${E.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 Zu(e){if(!(e===0||Array.isArray(e)&&e.every(t=>t===0))){if(dh())try{navigator.vibrate(e);return}catch{}if(wn??(wn=ph()),!!wn)try{wn.label.click()}catch{}}}function ed(){va++;let e=!1;return()=>{e||(e=!0,va=Math.max(0,va-1),va===0&&wn&&(wn.input.remove(),wn.label.remove(),wn=null))}}var _h=Z.scope("feedback"),fh=100,ya=class{constructor(t,n){oe(this,"mutedSig",le(!1));oe(this,"audio",new ha);oe(this,"releaseHaptics");oe(this,"sound");oe(this,"haptics");oe(this,"lastPlayed",new Map);oe(this,"reducedMotionMq",null);this.sound=t,this.haptics=n,this.releaseHaptics=ed(),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<fh}playSound(t){let n=this.sound.events?.[t];if(n===!1)return;if(typeof n=="string"){this.audio.playUrl(n).catch(o=>_h.warn("audio play failed",{err:o,url:n}));return}let r=Yu[t];r&&this.audio.playTone(r)}playHaptic(t){if(this.reducedMotionMq?.matches)return;let n=this.haptics.events?.[t];if(n===!1)return;let r=n===!0||n===void 0?Ju[t]:n;Zu(r)}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}};function td(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function nd(e){return td(e)}function rd(e){return!(!td(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}var mh=Symbol.for("pv"),gh=0;function l(e,t,n,r,o,a){t||(t={});var i,s,c=t;if("ref"in c&&typeof e!="function")for(s in c={},t)s=="ref"?i=t[s]:c[s]=t[s];var p={type:e,props:c,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:mh,__v:--gh,__i:-1,__u:0};return(o||a)&&(p.__source=o,p.__self=a),pe.vnode&&pe.vnode(p),p}var Ms=1,ad=2,oo=4,id=8,sd=16;function hh(e){switch(e){case Ms:return"href";case ad:return"src";case oo:return"class";case id:return"checked";case sd:return"start"}}var vh=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}},yh=vh;var od=24;function hr(e){let t=new Uint32Array(od);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(od),indent:"",indent_len:0,table_state:0}}function ao(e){e.pending.length>0&&Xe(e,`
8
- `)}function ke(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 ze(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 Ce(e,t){(e.tokens[e.len]===24||e.tokens[e.len]===23)&&t!==25&&ze(e),e.len+=1,e.tokens[e.len]=t,e.token=t,e.renderer.add_token(e.renderer.data,t)}function bh(e,t,n){for(;n<=e.len;){if(e.tokens[n]===t)return n;n+=1}return-1}function zn(e,t){for(e.fence_start=0;e.len>t;)ze(e)}function ba(e,t){let n=0;for(let r=0;r<=e.len&&(t-=e.spaces[r],!(t<0));r+=1)switch(e.tokens[r]){case 9:case 10:case 20:case 25:n=r;break}for(;e.len>n;)ze(e);return t}function Es(e,t){let n=-1,r=-1;for(let o=e.blockquote_idx+1;o<=e.len;o+=1)if(e.tokens[o]===25){if(e.indent_len<e.spaces[o]){r=-1;break}r=o}else e.tokens[o]===t&&(n=o);return r===-1?n===-1?(zn(e,e.blockquote_idx),Ce(e,t),!0):(zn(e,n),!1):(zn(e,r),Ce(e,t),!0)}function As(e,t){Ce(e,25),e.spaces[e.len]=e.indent_len+t,ln(e),e.token=103}function ln(e){e.indent="",e.indent_len=0,e.pending=""}function Ls(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 Ph(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 xh(e){return Ls(e)||Ph(e)}function Xe(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 o=ba(e,e.indent_len);e.indent_len=0,e.token=e.tokens[e.len],o>0&&Xe(e," ".repeat(o))}let r=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`
9
- `:if(console.assert(e.pending.length===1),e.tokens[e.len]===25&&e.token===21){ze(e),ln(e),e.pending=n;continue}zn(e,e.blockquote_idx),ln(e),e.blockquote_idx=0,e.fence_start=0,e.pending=n;continue;case"#":switch(n){case"#":if(e.pending.length<6){e.pending=r;continue}break;case" ":ba(e,e.indent_len),Ce(e,yh(e.pending.length)),ln(e);continue}break;case">":{let a=bh(e,20,e.blockquote_idx+1);a===-1?(zn(e,e.blockquote_idx),e.blockquote_idx+=1,e.fence_start=0,Ce(e,20)):e.blockquote_idx=a,ln(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=r;continue;case" ":e.pending=r;continue;case`
10
- `:if(e.hr_chars<3)break;ba(e,e.indent_len),e.renderer.add_token(e.renderer.data,22),e.renderer.end_token(e.renderer.data),ln(e),e.hr_chars=0;continue}e.hr_chars=0}if(e.pending[0]!=="_"&&e.pending[1]===" "){Es(e,23),As(e,2),Xe(e,r.slice(2));continue}break;case"`":if(e.pending.length<3){if(n==="`"){e.pending=r,e.fence_start=r.length;continue}e.fence_start=0;break}switch(n){case"`":e.pending.length===e.fence_start?(e.pending=r,e.fence_start=r.length):(Ce(e,2),ln(e),e.fence_start=0,Xe(e,r));continue;case`
11
- `:{ba(e,e.indent_len),Ce(e,10),e.pending.length>e.fence_start&&e.renderer.set_attr(e.renderer.data,oo,e.pending.slice(e.fence_start)),ln(e),e.token=101;continue}default:e.pending=r;continue}case"+":if(n!==" ")break;Es(e,23),As(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;Es(e,24)&&e.pending!=="1."&&e.renderer.set_attr(e.renderer.data,sd,e.pending.slice(0,-1)),As(e,e.pending.length+1);continue}else{let a=n.charCodeAt(0);if(a===46||Ls(a)){e.pending=r;continue}}break;case"|":zn(e,e.blockquote_idx),Ce(e,27),Ce(e,28),e.pending="",Xe(e,n);continue}let o=r;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}o=e.indent.slice(a)+r,Ce(e,9)}else Ce(e,2);ln(e),Xe(e,o);continue;case 27:if(e.table_state===1)switch(n){case"-":case" ":case"|":case":":e.pending=r;continue;case`
12
- `:e.table_state=2,e.pending="";continue;default:ze(e),e.table_state=0;break}else switch(e.pending){case"|":Ce(e,28),e.pending="",Xe(e,n);continue;case`
13
- `:ze(e),e.pending="",e.table_state=0,Xe(e,n);continue}break;case 28:switch(e.pending){case"":break;case"|":Ce(e,29),ze(e),e.pending="",Xe(e,n);continue;case`
14
- `:ze(e),e.table_state=Math.min(e.table_state+1,2),e.pending="",Xe(e,n);continue;default:Ce(e,29),Xe(e,n);continue}break;case 29:if(e.pending==="|"){ke(e),ze(e),e.pending="",Xe(e,n);continue}break;case 9:switch(r){case`
1
+ "use strict";(()=>{var Cm=Object.defineProperty;var Tm=(e,t,n)=>t in e?Cm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var te=(e,t,n)=>Tm(e,typeof t!="symbol"?t+"":t,n);var M={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"};function ji(e,t){if(!(!e?.length||!t))return e.find(n=>n.locale===t)}function mc(e,t){let{translations:n,defaultLocale:r,...o}=e,a=ji(n,t);return a?{...o,title:a.title??o.title,description:a.description??o.description,content:a.content??o.content}:o}function gc(e,t){let{translations:n,defaultLocale:r,...o}=e,a=ji(n,t);return a?{...o,title:a.title??o.title,description:a.description??o.description}:o}function hc(e,t){let{translations:n,defaultLocale:r,...o}=e,a=ji(n,t);if(!a)return o;let i=new Map((a.fields??[]).map(c=>[c.name,c])),s=o.fields.map(c=>{let p=i.get(c.name);if(!p)return c;let _=new Map((p.options??[]).map(d=>[d.value,d]));return{...c,label:p.label??c.label,placeholder:p.placeholder??c.placeholder,validationHint:p.validationHint??c.validationHint,options:c.options?.map(d=>{let u=_.get(d.value);return u?{...d,label:u.label??d.label,description:u.description??d.description}:d})}});return{...o,title:a.title??o.title,description:a.description??o.description,submitLabel:a.submitLabel??o.submitLabel,fields:s}}var Vo={attach:"Attach files",file:"File",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.",errorRateLimitedIn:"Too many requests \u2014 please try again in {seconds} s.",errorOffline:"Can't reach the server. Check your connection and try again.",errorServer:"Something went wrong on our side. Please try again.",errorReconnecting:"Connection lost. Reconnecting\u2026",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",queueMessage:"Queue message",removeQueuedMessage:"Remove queued message",compactingContext:"Optimizing conversation context\u2026",soundOff:"Sound off",soundOn:"Sound on",startNewConversation:"Start a new chat",talkToOperator:"Talk to a person",connectingOperator:"Connecting you to a person\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",visualPreparing:"Preparing visual\u2026",visualError:"This visual could not be displayed.",visualPartial:"Some parts of this visual could not be displayed.",thinking:"Thinking\u2026",thought:"Thought",thoughtFor:"Thought for {time}",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",contentHelpful:"Was this helpful?",homeGreeting:"How can we help?",homeGreetingNamed:"Hi {name} \u{1F44B}",homeGreetingLead:"How can we help?",homeSearchPlaceholder:"Search for help",homeAskPlaceholder:"Ask a question\u2026",homeWhatsNew:"What's new",homeContentTitle:"Popular articles",homeStatus:"Status",helpTitle:"Help",helpSearchPlaceholder:"Search for help",helpEmpty:"No help articles yet",helpLoading:"Loading help\u2026",helpSearchEmpty:"No results for \u201C{query}\u201D",helpShowMore:"Show more",newsTitle:"News",newsEmpty:"No news yet",newsLoading:"Loading news\u2026",newsBack:"Back to news",newsPublishedAt:"Published {date}",newsShowMore:"Show more",newsUnseen:"New post",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",statusIncomplete:"Not completed",toolStepsFailed:"{count} failed",statusStopped:"Stopped",toolStepsStopped:"Stopped after {count} steps",toolStepsStoppedOne:"Stopped after 1 step",thoughtsShowMore:"Show more",thoughtsShowLess:"Show less"},Rm={attach:"Joindre des fichiers",file:"Fichier",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.",errorRateLimitedIn:"Trop de requ\xEAtes \u2014 veuillez r\xE9essayer dans {seconds} s.",errorOffline:"Impossible de joindre le serveur. V\xE9rifiez votre connexion et r\xE9essayez.",errorServer:"Un probl\xE8me est survenu de notre c\xF4t\xE9. Veuillez r\xE9essayer.",errorReconnecting:"Connexion perdue. Reconnexion\u2026",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",queueMessage:"Mettre le message en attente",removeQueuedMessage:"Retirer le message en attente",compactingContext:"Optimisation du contexte de la conversation\u2026",soundOff:"Son d\xE9sactiv\xE9",soundOn:"Son activ\xE9",startNewConversation:"D\xE9marrer un nouveau chat",talkToOperator:"Parler \xE0 une personne",connectingOperator:"Mise en relation avec une personne\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",visualPreparing:"Pr\xE9paration du visuel\u2026",visualError:"Ce visuel n\u2019a pas pu \xEAtre affich\xE9.",visualPartial:"Certaines parties de ce visuel n\u2019ont pas pu \xEAtre affich\xE9es.",thinking:"R\xE9flexion\u2026",thought:"R\xE9flexion",thoughtFor:"R\xE9flexion : {time}",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",contentHelpful:"Cela vous a-t-il aid\xE9 ?",homeGreeting:"Comment pouvons-nous vous aider ?",homeGreetingNamed:"Bonjour {name} \u{1F44B}",homeGreetingLead:"Comment pouvons-nous vous aider ?",homeSearchPlaceholder:"Rechercher de l'aide",homeAskPlaceholder:"Posez une question\u2026",homeWhatsNew:"Nouveaut\xE9s",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 pour \xAB\xA0{query}\xA0\xBB",helpShowMore:"Afficher plus",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}",newsShowMore:"Afficher plus",newsUnseen:"Nouvelle publication",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",statusIncomplete:"Non termin\xE9",toolStepsFailed:"{count} en \xE9chec",statusStopped:"Arr\xEAt\xE9",toolStepsStopped:"Arr\xEAt\xE9 apr\xE8s {count} \xE9tapes",toolStepsStoppedOne:"Arr\xEAt\xE9 apr\xE8s 1 \xE9tape",thoughtsShowMore:"Afficher plus",thoughtsShowLess:"Afficher moins"},Im={attach:"\u0625\u0631\u0641\u0627\u0642 \u0645\u0644\u0641\u0627\u062A",file:"\u0645\u0644\u0641",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.",errorRateLimitedIn:"\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 {seconds} \u062B.",errorOffline:"\u062A\u0639\u0630\u0651\u0631 \u0627\u0644\u0648\u0635\u0648\u0644 \u0625\u0644\u0649 \u0627\u0644\u062E\u0627\u062F\u0645. \u062A\u062D\u0642\u0651\u0642 \u0645\u0646 \u0627\u062A\u0635\u0627\u0644\u0643 \u0648\u062D\u0627\u0648\u0644 \u0645\u0631\u0629 \u0623\u062E\u0631\u0649.",errorServer:"\u062D\u062F\u062B \u062E\u0637\u0623 \u0645\u0646 \u062C\u0647\u062A\u0646\u0627. \u064A\u0631\u062C\u0649 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629 \u0645\u0631\u0629 \u0623\u062E\u0631\u0649.",errorReconnecting:"\u0627\u0646\u0642\u0637\u0639 \u0627\u0644\u0627\u062A\u0635\u0627\u0644. \u062C\u0627\u0631\u064D \u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u0627\u062A\u0635\u0627\u0644\u2026",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",queueMessage:"\u0625\u0636\u0627\u0641\u0629 \u0627\u0644\u0631\u0633\u0627\u0644\u0629 \u0625\u0644\u0649 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0627\u0646\u062A\u0638\u0627\u0631",removeQueuedMessage:"\u0625\u0632\u0627\u0644\u0629 \u0627\u0644\u0631\u0633\u0627\u0644\u0629 \u0645\u0646 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0627\u0646\u062A\u0638\u0627\u0631",compactingContext:"\u062C\u0627\u0631\u064D \u062A\u062D\u0633\u064A\u0646 \u0633\u064A\u0627\u0642 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629\u2026",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 \u0634\u062E\u0635",connectingOperator:"\u062C\u0627\u0631\u064D \u062A\u0648\u0635\u064A\u0644\u0643 \u0628\u0634\u062E\u0635\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",visualPreparing:"\u062C\u0627\u0631\u064D \u0625\u0639\u062F\u0627\u062F \u0627\u0644\u0645\u062D\u062A\u0648\u0649 \u0627\u0644\u0645\u0631\u0626\u064A\u2026",visualError:"\u062A\u0639\u0630\u0631 \u0639\u0631\u0636 \u0647\u0630\u0627 \u0627\u0644\u0645\u062D\u062A\u0648\u0649 \u0627\u0644\u0645\u0631\u0626\u064A.",visualPartial:"\u062A\u0639\u0630\u0631 \u0639\u0631\u0636 \u0628\u0639\u0636 \u0623\u062C\u0632\u0627\u0621 \u0647\u0630\u0627 \u0627\u0644\u0645\u062D\u062A\u0648\u0649 \u0627\u0644\u0645\u0631\u0626\u064A.",thinking:"\u064A\u0641\u0643\u0651\u0631\u2026",thought:"\u062A\u0641\u0643\u064A\u0631",thoughtFor:"\u0641\u0643\u0651\u0631 \u0644\u0645\u062F\u0629 {time}",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",contentHelpful:"\u0647\u0644 \u0643\u0627\u0646 \u0647\u0630\u0627 \u0645\u0641\u064A\u062F\u064B\u0627\u061F",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",homeAskPlaceholder:"\u0627\u0637\u0631\u062D \u0633\u0624\u0627\u0644\u0627\u064B\u2026",homeWhatsNew:"\u0645\u0627 \u0627\u0644\u062C\u062F\u064A\u062F",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 \u0646\u062A\u0627\u0626\u062C \u0644\u0640 \xAB{query}\xBB",helpShowMore:"\u0639\u0631\u0636 \u0627\u0644\u0645\u0632\u064A\u062F",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}",newsShowMore:"\u0639\u0631\u0636 \u0627\u0644\u0645\u0632\u064A\u062F",newsUnseen:"\u0645\u0646\u0634\u0648\u0631 \u062C\u062F\u064A\u062F",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",statusIncomplete:"\u0644\u0645 \u064A\u0643\u062A\u0645\u0644",toolStepsFailed:"\u0641\u0634\u0644 {count}",statusStopped:"\u0623\u064F\u0648\u0642\u0641",toolStepsStopped:"\u0623\u064F\u0648\u0642\u0641 \u0628\u0639\u062F {count} \u062E\u0637\u0648\u0627\u062A",toolStepsStoppedOne:"\u0623\u064F\u0648\u0642\u0641 \u0628\u0639\u062F \u062E\u0637\u0648\u0629 \u0648\u0627\u062D\u062F\u0629",thoughtsShowMore:"\u0639\u0631\u0636 \u0627\u0644\u0645\u0632\u064A\u062F",thoughtsShowLess:"\u0639\u0631\u0636 \u0623\u0642\u0644"},Em={attach:"Adjuntar archivos",file:"Archivo",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.",errorRateLimitedIn:"Demasiadas solicitudes: int\xE9ntalo de nuevo en {seconds} s.",errorOffline:"No se puede conectar con el servidor. Revisa tu conexi\xF3n e int\xE9ntalo de nuevo.",errorServer:"Algo sali\xF3 mal por nuestra parte. Int\xE9ntalo de nuevo.",errorReconnecting:"Se perdi\xF3 la conexi\xF3n. Reconectando\u2026",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",queueMessage:"Poner mensaje en cola",removeQueuedMessage:"Quitar mensaje de la cola",compactingContext:"Optimizando el contexto de la conversaci\xF3n\u2026",soundOff:"Sonido desactivado",soundOn:"Sonido activado",startNewConversation:"Iniciar un chat nuevo",talkToOperator:"Hablar con una persona",connectingOperator:"Conect\xE1ndote con una persona\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",visualPreparing:"Preparando visualizaci\xF3n\u2026",visualError:"No se pudo mostrar esta visualizaci\xF3n.",visualPartial:"No se pudieron mostrar algunas partes de esta visualizaci\xF3n.",thinking:"Pensando\u2026",thought:"Razonamiento",thoughtFor:"Razon\xF3 durante {time}",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",contentHelpful:"\xBFTe result\xF3 \xFAtil?",homeGreeting:"\xBFC\xF3mo podemos ayudarte?",homeGreetingNamed:"Hola, {name} \u{1F44B}",homeGreetingLead:"\xBFC\xF3mo podemos ayudarte?",homeSearchPlaceholder:"Buscar ayuda",homeAskPlaceholder:"Haz una pregunta\u2026",homeWhatsNew:"Lo nuevo",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:"Sin resultados para \xAB{query}\xBB",helpShowMore:"Mostrar m\xE1s",newsTitle:"Novedades",newsEmpty:"A\xFAn no hay novedades",newsLoading:"Cargando novedades\u2026",newsBack:"Volver a novedades",newsPublishedAt:"Publicado el {date}",newsShowMore:"Mostrar m\xE1s",newsUnseen:"Publicaci\xF3n nueva",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",statusIncomplete:"No completado",toolStepsFailed:"{count} con error",statusStopped:"Detenido",toolStepsStopped:"Detenido tras {count} pasos",toolStepsStoppedOne:"Detenido tras 1 paso",thoughtsShowMore:"Mostrar m\xE1s",thoughtsShowLess:"Mostrar menos"},Am={attach:"\u05E6\u05D9\u05E8\u05D5\u05E3 \u05E7\u05D1\u05E6\u05D9\u05DD",file:"\u05E7\u05D5\u05D1\u05E5",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.",errorRateLimitedIn:"\u05D9\u05D5\u05EA\u05E8 \u05DE\u05D3\u05D9 \u05D1\u05E7\u05E9\u05D5\u05EA \u2014 \u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1 \u05D1\u05E2\u05D5\u05D3 {seconds} \u05E9\u05E0\u05F3.",errorOffline:"\u05D0\u05D9\u05DF \u05D7\u05D9\u05D1\u05D5\u05E8 \u05DC\u05E9\u05E8\u05EA. \u05D1\u05D3\u05D5\u05E7 \u05D0\u05EA \u05D4\u05D7\u05D9\u05D1\u05D5\u05E8 \u05D5\u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1.",errorServer:"\u05DE\u05E9\u05D4\u05D5 \u05D4\u05E9\u05EA\u05D1\u05E9 \u05D0\u05E6\u05DC\u05E0\u05D5. \u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1.",errorReconnecting:"\u05D4\u05D7\u05D9\u05D1\u05D5\u05E8 \u05D0\u05D1\u05D3. \u05DE\u05EA\u05D7\u05D1\u05E8 \u05DE\u05D7\u05D3\u05E9\u2026",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",queueMessage:"\u05D4\u05D5\u05E1\u05E4\u05EA \u05D4\u05D4\u05D5\u05D3\u05E2\u05D4 \u05DC\u05EA\u05D5\u05E8",removeQueuedMessage:"\u05D4\u05E1\u05E8\u05EA \u05D4\u05D4\u05D5\u05D3\u05E2\u05D4 \u05DE\u05D4\u05EA\u05D5\u05E8",compactingContext:"\u05DE\u05D1\u05E6\u05E2 \u05D0\u05D5\u05E4\u05D8\u05D9\u05DE\u05D9\u05D6\u05E6\u05D9\u05D4 \u05DC\u05D4\u05E7\u05E9\u05E8 \u05D4\u05E9\u05D9\u05D7\u05D4\u2026",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\u05D5 \u05E2\u05DD \u05D0\u05D3\u05DD",connectingOperator:"\u05DE\u05D7\u05D1\u05E8\u05D9\u05DD \u05D0\u05D5\u05EA\u05DA \u05DC\u05D0\u05D3\u05DD\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",visualPreparing:"\u05DE\u05DB\u05D9\u05DF \u05EA\u05E6\u05D5\u05D2\u05D4\u2026",visualError:"\u05DC\u05D0 \u05E0\u05D9\u05EA\u05DF \u05D4\u05D9\u05D4 \u05DC\u05D4\u05E6\u05D9\u05D2 \u05EA\u05E6\u05D5\u05D2\u05D4 \u05D6\u05D5.",visualPartial:"\u05DC\u05D0 \u05E0\u05D9\u05EA\u05DF \u05D4\u05D9\u05D4 \u05DC\u05D4\u05E6\u05D9\u05D2 \u05D7\u05DC\u05E7\u05D9\u05DD \u05DE\u05EA\u05E6\u05D5\u05D2\u05D4 \u05D6\u05D5.",thinking:"\u05D7\u05D5\u05E9\u05D1\u2026",thought:"\u05DE\u05D7\u05E9\u05D1\u05D4",thoughtFor:"\u05D7\u05E9\u05D1 \u05D1\u05DE\u05E9\u05DA {time}",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",contentHelpful:"\u05D4\u05D0\u05DD \u05D6\u05D4 \u05E2\u05D6\u05E8?",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",homeAskPlaceholder:"\u05E9\u05D0\u05DC\u05D5 \u05E9\u05D0\u05DC\u05D4\u2026",homeWhatsNew:"\u05DE\u05D4 \u05D7\u05D3\u05E9",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:"\u05D0\u05D9\u05DF \u05EA\u05D5\u05E6\u05D0\u05D5\u05EA \u05E2\u05D1\u05D5\u05E8 \u201E{query}\u201D",helpShowMore:"\u05D4\u05E6\u05D2\u05EA \u05E2\u05D5\u05D3",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}",newsShowMore:"\u05D4\u05E6\u05D2\u05EA \u05E2\u05D5\u05D3",newsUnseen:"\u05E4\u05D5\u05E1\u05D8 \u05D7\u05D3\u05E9",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",statusIncomplete:"\u05DC\u05D0 \u05D4\u05D5\u05E9\u05DC\u05DD",toolStepsFailed:"{count} \u05E0\u05DB\u05E9\u05DC\u05D5",statusStopped:"\u05E0\u05E2\u05E6\u05E8",toolStepsStopped:"\u05E0\u05E2\u05E6\u05E8 \u05D0\u05D7\u05E8\u05D9 {count} \u05E9\u05DC\u05D1\u05D9\u05DD",toolStepsStoppedOne:"\u05E0\u05E2\u05E6\u05E8 \u05D0\u05D7\u05E8\u05D9 \u05E9\u05DC\u05D1 \u05D0\u05D7\u05D3",thoughtsShowMore:"\u05D4\u05E6\u05D2\u05EA \u05E2\u05D5\u05D3",thoughtsShowLess:"\u05D4\u05E6\u05D2\u05EA \u05E4\u05D7\u05D5\u05EA"},Mm={en:Vo,fr:Rm,ar:Im,es:Em,he:Am};function Wo(e,t){let n=vc(e),r=Go(t),o=n==="en"?{}:Mm[n]??{},a=r?t[n]??{}:t??{},i=r?t.en??{}:{};return{...Vo,...o,...i,...a}}function vc(e){return(e.split("-")[0]??"en").toLowerCase()}var Lm=new Set(["ar","he","iw","fa","ur","ps","sd","ug","yi","dv","ckb","ks","nqo","prs","syr"]);function bc(e){return Lm.has(vc(e))}function St(e,t){return e[t]??t}function Go(e){if(!e)return!1;for(let t of Object.values(e))if(t&&typeof t=="object")return!0;return!1}var Vi=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{}}},Ko=new Vi;var Qo={maxBytes:10485760,maxCount:10,accept:"*/*"},yc={voice:"local"},Pc={list:[],byTrigger:{}},Wi={enabled:!0,sampleRate:1},Xo={upload:"/pai/upload-file",transcribe:"/pai/transcribe-audio",submitForm:"/pai/submit-form"},cr={variant:"circle",size:"md",label:void 0,icon:"chat",hidden:!1},xc={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"]},Gi={enabled:!0,volume:.3,events:void 0},Sc={enabled:!0,events:void 0},kc=[{label:"tabConversations",layout:"chat"}];var Xi=["off","error","warn","info","debug","trace"],Ji=M.cssPrefix,wc=`${Ji}.debug`,Nm=`__${M.global}_DEBUG__`,Om=`${Ji}-debug`,Jo=2,Ki=null;function $m(){if(typeof window>"u")return 2;try{let e=new URLSearchParams(window.location.search).get(Om);if(e!==null){let t=Qi(e);if(t>=0)return t}}catch{}try{let e=window.localStorage?.getItem(wc);if(e){let t=Qi(e);if(t>=0)return t}}catch{}return Reflect.get(window,Nm)?4:2}function Qi(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=Xi.findIndex(n=>n===e);if(t>=0)return t}return-1}function Yo(e){let t=Qi(e);if(!(t<0)){Jo=t;try{window.localStorage?.setItem(wc,Xi[t]??"off")}catch{}}}function zr(){return Xi[Jo]??"warn"}Jo=$m();function Cc(e){let t=`[${Ji}:${e}]`;function n(r,o,a){return(i,s)=>{if(!(Jo<r)&&(s===void 0?console[o](t,i):console[o](t,i,s),Ki))try{Ki({level:a,scope:e,message:i,payload:s})}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:r=>Cc(`${e}:${r}`)}}var Z=Cc("core");function jr(e){Ki=e}var Dn=Z.scope("context"),Dm=new Set(["visitorId","conversationId","jwt","token","authorization","password"]),Tc=50,Yi=1024,Fm=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Zi(e){return Rc(e,"userContext",!0)}function es(e){return Rc(e,"pageContext",!1)}function Rc(e,t,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){Dn.warn(`ignored ${t} \u2014 expected an object`,{type:Array.isArray(e)?"array":typeof e});return}let r={},o=0;for(let[a,i]of Object.entries(e)){if(Dm.has(a)){Dn.warn(`dropped reserved ${t} key "${a}" \u2014 managed by the widget, not host-settable`);continue}if(i==null)continue;if(o>=Tc){Dn.warn(`${t} truncated at ${Tc} keys \u2014 dropped "${a}"`);continue}let s=Bm(t,a,i);s!==void 0&&(r[a]=s,o++)}return n&&typeof r.email=="string"&&!Fm.test(r.email)&&(Dn.warn("dropped malformed context field",{field:`${t}.email`,reason:"invalid format"}),delete r.email),Object.keys(r).length>0?r:void 0}function Bm(e,t,n){if(typeof n=="boolean")return n;if(typeof n=="number"){if(!Number.isFinite(n)){Dn.warn(`dropped non-finite ${e}.${t}`);return}return n}if(typeof n=="string"){let r=n.trim();return r===""?void 0:r.length>Yi?(Dn.warn(`truncated ${e}.${t} to ${Yi} chars`),r.slice(0,Yi)):r}Dn.warn(`dropped ${e}.${t} \u2014 only string/number/boolean values are allowed`,{type:typeof n})}function bn(e){let t=e!==null&&typeof e=="object"?e:{},n=t.presentation??{},r=t.behavior??{},o=t.i18n??{},a=t.feedback??{},i=t.footer??{},s=t.header??{},c={enabled:t.history?.enabled??!0},{themeMode:p,themeOverrides:_}=Hm(t.theme),d=n.mode??"floating",u=Um(o.defaultLocale),f=o.availableLocales??[o.locale??u],m=ur(o.locale??u,f,u),v=(t.baseUrl??M.defaultBaseUrl).replace(/\/$/,""),y=(t.agentApiBaseUrl??`${v}/api/agent`).replace(/\/$/,""),x=(t.dataApiBaseUrl??`${v}/api/data`).replace(/\/$/,"");return{widgetId:t.widgetId??"default",publicKey:t.publicKey,aiAgentDeploymentId:t.aiAgentDeploymentId,baseUrl:v,agentApiBaseUrl:y,dataApiBaseUrl:x,userContext:Zi(t.userContext),pageContext:es(t.pageContext),position:n.position??"bottom-right",themeMode:p,textSize:"normal",themeOverrides:_,mode:d,iframe:n.iframe??!1,responseMode:r.responseMode??"streaming",showReasoning:r.showReasoning??!1,showToolCalls:r.showToolCalls??!1,showSources:r.showSources??!1,enableMessageFeedback:!(r.disableMessageFeedback??!1),autoSendSuggestions:r.autoSendSuggestions??!1,popOutUrl:r.popOutUrl,features:{voice:t.features?.voice??yc.voice,fileUpload:!(t.features?.disableFileUpload??!1),humanInLoop:!(t.features?.disableHumanInLoop??!1),operatorRequest:t.features?.enableOperatorRequest===!0},forms:Vr(t.forms,m),endpoints:{upload:t.endpoints?.upload??Xo.upload,transcribe:t.endpoints?.transcribe??Xo.transcribe,submitForm:t.endpoints?.submitForm??Xo.submitForm},attachments:{accept:t.composer?.attachments?.accept??Qo.accept,maxBytes:t.composer?.attachments?.maxBytes??Qo.maxBytes,maxCount:t.composer?.attachments?.maxCount??Qo.maxCount},locale:m,defaultLocale:u,availableLocales:f,startMinimized:r.startMinimized??!0,actions:qm(d,s.actions,c.enabled),size:n.size??{},launcher:Xm(t.launcher),sound:zm(a.sound),haptics:jm(a.haptics),strings:Wo(m,o.strings),stringsOverride:o.strings,composerDisclaimer:i.composerDisclaimer??"",poweredBy:Wm(i.poweredBy),composer:Gm(t.composer),modules:Km(t.modules,c.enabled),tracking:Vm(t.tracking,x),history:c,storage:t.storage??Ko,userToken:t.userToken,tools:t.tools,onMessage:t.onMessage,onOpen:t.onOpen,onClose:t.onClose,onError:t.onError}}function Hm(e){if(typeof e=="string")return{themeMode:e,themeOverrides:{}};if(!e||typeof e!="object")return{themeMode:"auto",themeOverrides:{}};let{mode:t,...n}=e;return{themeMode:t??"auto",themeOverrides:n}}function Um(e){return e&&e!=="auto"?e:globalThis.navigator?.language||"en"}function ur(e,t,n){return t.length<=1||t.includes(e)?e:t.includes(n)?n:t[0]??e}function qm(e,t,n){let r=t??xc[e];return n?r:r.filter(o=>o!=="history")}function zm(e){return{enabled:e?.enabled??Gi.enabled,volume:e?.volume??Gi.volume,events:e?.events}}function jm(e){return{enabled:e?.enabled??Sc.enabled,events:e?.events}}function Vm(e,t){let n=e?.sampleRate??Wi.sampleRate;return{enabled:e?.enabled??Wi.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 Wm(e){let n={...{text:`Powered by ${M.displayName}`,href:M.siteUrl},...e};return!!(n.text||n.logoUrl)?n:null}function Gm(e){let t=e?.sendButton;return{sendButton:{shape:t?.shape??"circle",icon:t?.icon??"arrowUp",variant:t?.variant??"filled"}}}function Km(e,t){let n=e??kc,r=new Set,o=[];for(let i of n.slice(0,4)){if(!i?.label||!i?.layout)continue;let s=i.contentCollectionIds?.filter(Boolean),c=i.id??s?.[0]??i.layout;for(;r.has(c);)c=`${c}-${o.length}`;r.add(c);let p={id:c,label:i.label,layout:i.layout};s?.length&&(p.contentCollectionIds=s),i.layout==="home"&&(p.brandName=i.brandName,p.greetingText=i.greetingText,p.showGreeting=!(i.hideGreeting??!1),p.showSearchBar=!(i.hideSearchBar??!1),p.showRecentConversations=t&&!(i.hideRecentConversations??!1),i.userAvatars?.length&&(p.userAvatars=i.userAvatars),i.status&&(p.status=i.status),p.contentBlockTitle=i.contentBlockTitle),o.push(p)}let a=Object.fromEntries(o.map(i=>[i.id,i]));return{list:o,byId:a}}function Vr(e,t){var a;if(!e?.length)return Pc;let n=[],r=new Set;for(let i of e){if(!i?.id||r.has(i.id))continue;let s=hc(i,t),c=(s.fields??[]).filter(_=>!!(_?.name&&_.label&&_.type)),p=(Array.isArray(s.on)?s.on:[s.on]).map(Qm).filter(_=>_!==null);c.length===0||p.length===0||(r.add(s.id),n.push({id:s.id,triggers:p,when:s.when,fields:c,title:s.title,description:s.description,submitLabel:s.submitLabel,skippable:s.skippable??!1,blocking:s.blocking??!1,frequency:s.frequency??"once",mirrorToContext:s.mirrorToContext??!0,reopenable:s.reopenable??!0,reviewable:s.reviewable??!0}))}let o={};for(let i of n)for(let s of i.triggers)(o[a=s.kind]??(o[a]=[])).push(i);return{list:n,byTrigger:o}}function Qm(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 r=Number(n);return Number.isFinite(r)&&r>0?{kind:"after-messages",param:r}:null}if(t==="idle"){let r=Number(n);return Number.isFinite(r)&&r>0?{kind:"idle",param:r}:null}return t==="page-area"&&n?{kind:"page-area",param:n}:null}function Xm(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??cr.variant,size:e?.size??cr.size,label:e?.label??cr.label,icon:e?.icon??cr.icon,hidden:e?.hidden??cr.hidden,callout:t}}function ts(e,t,n,r){let o=ur(t,e.availableLocales,e.defaultLocale);if(o===e.locale&&n===e.themeMode&&r===e.textSize)return e;let a={...e};return o!==e.locale&&(a.locale=o,a.strings=Wo(o,e.stringsOverride)),n!==e.themeMode&&(a.themeMode=n),r!==e.textSize&&(a.textSize=r),a}var Jm=["presentation","behavior","theme","launcher","header","composer","feedback","i18n","footer","features","tracking","endpoints","history"];function ns(e,t){if(!t)return e;let n={...e};for(let a of Jm){let i=t[a];if(i===void 0)continue;let s=e[a];if(a==="theme"){s===void 0?n[a]=i:typeof s=="string"&&typeof i=="object"&&i!==null&&(n[a]={...i,mode:s});continue}a!=="i18n"&&(n[a]=Ic(i,s))}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 r=e.i18n,o=t.i18n;if(r||o){let a=Ic(o??{},r);o?.availableLocales!==void 0&&(a.availableLocales=o.availableLocales),o?.defaultLocale!==void 0&&(a.defaultLocale=o.defaultLocale);let i=r?.strings,s=o?.strings;(i||s)&&(a.strings=Ym(s,i)),n.i18n=a}return n}function Ic(e,t){if(!t)return e;let n={...e};for(let[r,o]of Object.entries(t))o!==void 0&&(n[r]=o);return n}function Ym(e,t){if(!e)return t;if(!t)return e;let n=Go(e),r=Go(t);if(!n&&!r)return{...e,...t};let o={},a=n?e:{en:e},i=r?t:{en:t};for(let[s,c]of Object.entries(a))o[s]={...c};for(let[s,c]of Object.entries(i))o[s]={...o[s],...c};return o}var Zm=["clear","expand","fullscreen","popOut","sound","history","language","theme","textSize","close"];function rn(e){return e!=="false"}function eg(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}var Ac=[["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]],Mc=[["mode","mode",e=>e],["position","position",e=>e],["iframe","iframe",rn]],Lc=[["width","width"],["height","height"]],Nc=[["response-mode","responseMode",e=>e],["start-minimized","startMinimized",rn],["show-reasoning","showReasoning",rn],["show-tool-calls","showToolCalls",rn],["show-sources","showSources",rn],["disable-message-feedback","disableMessageFeedback",rn],["auto-send-suggestions","autoSendSuggestions",rn],["pop-out-url","popOutUrl"]],Oc=[["locale","locale"]],tg=new Set(Zm);function ng(e){return eg(e).filter(t=>tg.has(t))}var $c=[["launcher-variant","variant",e=>e],["launcher-size","size",e=>e],["launcher-icon","icon"],["launcher-hidden","hidden",rn]],Dc=[["features-disable-file-upload","disableFileUpload",rn],["features-voice","voice",e=>e]],Fc=[["endpoint-upload","upload"],["endpoint-transcribe","transcribe"]],Bc=[["user-id","id"],["user-email","email"],["user-name","name"]],Hc=[["page-area","area"],["page-url","url"],["page-path","path"],["page-title","title"]],rg=["launcher-label","callout-text","callout-delay","actions","user-context","page-context"],og=[Ac,Mc,Lc,Nc,Oc,$c,Dc,Fc,Bc,Hc],ag=new Set(["iframe","start-minimized"]),rs=[...og.flatMap(e=>e.map(([t])=>t).filter(t=>!ag.has(t))),...rg];function Zo(e){let t={};function n(f){let m=e(f);return m===null||m===""?void 0:m}for(let[f,m,v]of Ac){let y=n(f);y!==void 0&&(t[m]=v?v(y):y)}let r=Fn(n,Mc),o=Fn(n,Lc);(r||o)&&(t.presentation={...r,...o?{size:o}:{}});let a=Fn(n,Nc);a&&(t.behavior=a);let i=Fn(n,Oc);i&&(t.i18n=i);let s=sg(e,n);s&&(t.launcher=s);let c=Fn(n,Dc);c&&(t.features=c);let p=Fn(n,Fc);p&&(t.endpoints=p);let _=Ec(n,Bc,"user-context");_&&(t.userContext=_);let d=Ec(n,Hc,"page-context");d&&(t.pageContext=d);let u=n("actions");return u!==void 0&&(t.header={actions:ng(u)}),t}function os(e){return e?Zo(t=>e[ig(t==="data-api-base-url"?"api-base-url":t)]??null):{}}function ig(e){return e.replaceAll(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Fn(e,t){let n={};for(let[r,o,a]of t){let i=e(r);i!==void 0&&(n[o]=a?a(i):i)}return Object.keys(n).length>0?n:null}function Ec(e,t,n){let r={};for(let[s,c]of t){let p=e(s);p!==void 0&&(r[c]=p)}let o={},a=e(n);if(a)try{let s=JSON.parse(a);s&&typeof s=="object"&&!Array.isArray(s)&&(o=s)}catch{}let i={...o,...r};return Object.keys(i).length>0?i:null}function sg(e,t){let n=Fn(t,$c)??{},r=e("launcher-label");r!==null&&(n.label=r);let o=t("callout-text");if(o){let a=Number.parseInt(t("callout-delay")??"",10);n.callout={text:o,...Number.isFinite(a)?{delayMs:a}:{}}}return Object.keys(n).length>0?n:null}var yn={open:!1,ready:!1,unread:0},dr=class{constructor(){te(this,"handlers",new Map)}on(t,n){let r=this.handlers.get(t);return r||(r=new Set,this.handlers.set(t,r)),r.add(n),()=>this.handlers.get(t)?.delete(n)}emit(t,n){let r=this.handlers.get(t);if(r)for(let o of r)try{o(n)}catch{}}clear(){this.handlers.clear()}};var lg=Z.scope("hooks"),is="*",as=new Set;function ss(e,t,n){let r={widgetId:e,event:t,listener:n};return as.add(r),()=>{as.delete(r)}}function cg(e,t,n){let r=[...as];for(let o of r)if(ug(o.widgetId,e.widgetId)&&!(o.event!==is&&o.event!==t))try{o.listener(e,t,n)}catch(a){lg.warn("hook listener threw",{event:t,error:a})}}function Uc(e,t){let n=[];for(let r of dg)n.push(t.on(r,o=>{cg(e,r,o)}));return()=>{for(let r of n)r()}}function ls(e){if(Array.isArray(e))for(let t of e){let n=pg(t);n&&ss(n.widgetId,n.event,n.listener)}}function ug(e,t){return e===is||e===t}var dg=["open","close","expand","fullscreen","resize","message","send","stop","clear","selectConversation","suggestion","toggleHistory","formSubmit","toolResult","toolDecision","hostEvent","messageFeedback","contentView","contentOpen","contentSearch","contentRead","contentLinkClick","attach","removeAttachment","voiceStart","voiceStop","voiceCancel","localeChange","themeChange","textSizeChange","soundToggle","sidebarToggle","calloutDismiss","error","handshake","conversationRebound","state","unread"];function pg(e){let t,n,r;if(Array.isArray(e))[t,n,r]=e;else if(e&&typeof e=="object")({widgetId:t,event:n,listener:r}=e);else return null;return typeof t!="string"||typeof n!="string"||typeof r!="function"?null:{widgetId:t,event:n,listener:r}}var _g=new Set(["home","chats","help","news"]);function qc(e){return typeof e!="object"||e===null||!("to"in e)||typeof e.to!="string"||!_g.has(e.to)?!1:!("id"in e)||e.id===void 0||typeof e.id=="string"}function ea(e){let[t="",...n]=e.trim().split("/");if(t===""||t==="open")return;let r=n.join("/");return r?{to:t,id:r}:{to:t}}function on(e,t){return{text:e,send:typeof t=="object"&&t!==null&&"send"in t&&t.send===!0}}function zc(e){if(typeof e!="object"||e===null||!("text"in e)||typeof e.text!="string")return;let t=e.text.trim();return t?{text:t,send:"send"in e&&e.send===!0}:void 0}function jc(e){return`${M.cssPrefix}:${e}`}function ut(e,t,n){e.dispatchEvent(new CustomEvent(jc(t),{detail:n}))}function Vc(e,t){let r=Object.entries(t).map(([o,a])=>{let i=jc(o);function s(c){return a(c.detail)}return e.addEventListener(i,s),[i,s]});return()=>{for(let[o,a]of r)e.removeEventListener(o,a)}}var Wc=Z.scope("track"),fg=64,mg=256,gg=10;function pr(e,t){let n=typeof e=="string"?e.trim():"";if(!n||n.length>fg){Wc.warn("track: ignored an event without a name of 1\u201364 characters",{name:e});return}let r=Object.fromEntries(Object.entries(typeof t=="object"&&t!==null?t:{}).filter(o=>typeof o[1]=="string"||typeof o[1]=="boolean"||Number.isFinite(o[1])));return JSON.stringify(r).length>mg?(Wc.warn("track: sent the event without its data, which is over 256 characters",{name:n}),{name:n}):Object.keys(r).length>0?{name:n,data:r}:{name:n}}function Gc(e){let t=[];return e.on("hostEvent",n=>{t.push({...n,at:Date.now()}),t.length>gg&&t.shift()}),t}var hg=new Set(["hidden","submit","button","reset","image","file","password"]);function Qc(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement}function vg(e){return!Qc(e)||e.name===""||e.disabled?!1:!(e instanceof HTMLInputElement&&hg.has(e.type))}function bg(e){let t=e.labels?.[0]?.textContent?.trim();return e.getAttribute("toolparamdescription")??(t||e.getAttribute("aria-description"))??void 0}function yg(e,t){let n=bg(e),r=n?{description:n}:{};return e instanceof HTMLSelectElement?{...r,type:"string",enum:[...e.options].map(o=>o.value)}:e instanceof HTMLTextAreaElement?{...r,type:"string"}:e.type==="checkbox"?{...r,type:"boolean"}:e.type==="radio"?{...r,type:"string",enum:t}:e.type==="number"||e.type==="range"?{...r,type:"number"}:{...r,type:"string"}}function Pg(e,t){Object.getOwnPropertyDescriptor(Reflect.getPrototypeOf(e)??e,"value")?.set?.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function Kc(e){return e==null?"":typeof e=="string"?e:JSON.stringify(e)}function xg(e,t){if(e instanceof HTMLInputElement&&e.type==="checkbox"){e.checked!==(t===!0||t==="true")&&e.click();return}if(e instanceof HTMLInputElement&&e.type==="radio"){e.value===Kc(t)&&!e.checked&&e.click();return}Pg(e,Kc(t))}function Sg(e,t,n){var i;let r=[...e.elements].filter(vg),o={},a=new Set;for(let s of r){let c=r.flatMap(p=>p instanceof HTMLInputElement&&p.type==="radio"&&p.name===s.name?[p.value]:[]);o[i=s.name]??(o[i]=yg(s,c)),s.required&&a.add(s.name)}return{name:t,description:n,inputSchema:{type:"object",properties:o,...a.size>0?{required:[...a]}:{}},execute(s){let c=typeof s=="object"&&s!==null?Object.entries(s):[];for(let[_,d]of c)for(let u of r)u.name===_&&xg(u,d);if(!e.hasAttribute("toolautosubmit"))return"Filled in the form. The visitor still needs to check it and press its submit button.";let p=[...new Set([...e.elements].flatMap(_=>Qc(_)&&_.name&&!_.checkValidity()?[_.name]:[]))];return p.length>0?`Filled in the form, but it can't be submitted yet: ${p.join(", ")} still needs the visitor. Ask them to complete it and press the submit button.`:(setTimeout(()=>e.requestSubmit(),0),"Filled in the form and submitted it.")}}}function Xc(){return[...document.querySelectorAll("form[toolname][tooldescription]")].flatMap(e=>{let t=e.getAttribute("toolname")?.trim()??"",n=e.getAttribute("tooldescription")?.trim()??"";return t&&n?[Sg(e,t,n)]:[]})}var Jc=`${M.cssPrefix}.page-tools`,kg=20,wg=50;function ta(e){return typeof e=="object"&&e!==null}function Cg(e){return ta(e)&&(e.state==="running"||e.state==="stopped"||e.state==="finished"&&ta(e.outcome))}function Tg(e){let t=e?JSON.parse(e):void 0;if(!ta(t))return{sent:[],calls:{}};let n=Array.isArray(t.sent)?t.sent.filter(o=>typeof o=="string"):[],r=Object.fromEntries(Object.entries(ta(t.calls)?t.calls:{}).filter(o=>Cg(o[1])));return{sent:n,calls:r}}var us={sent:[],calls:{}};function Wr(){try{us=Tg(sessionStorage.getItem(Jc))}catch{}return us}function cs(e){us=e;try{sessionStorage.setItem(Jc,JSON.stringify(e))}catch{}}var Tt={markSent(e){let t=Wr();cs({...t,sent:[...t.sent.filter(n=>n!==e),e].slice(-kg)})},sentHere(e){return Wr().sent.includes(e)},get(e){return Wr().calls[e]},set(e,t){let n=Wr(),r=Object.entries(n.calls).filter(([o])=>o!==e);cs({...n,calls:Object.fromEntries([...r,[e,t]].slice(-wg))})},clear(e){let t=Wr();e.some(n=>n in t.calls)&&cs({...t,calls:Object.fromEntries(Object.entries(t.calls).filter(([n])=>!e.includes(n)))})}};function Bn(e,t){return new Promise(n=>{if(t?.aborted)return n();let r=setTimeout(a,e);function o(){return a()}t?.addEventListener("abort",o,{once:!0});function a(){clearTimeout(r),t?.removeEventListener("abort",o),n()}})}var nu=Z.scope("page-tools"),Yc="site__",Zc=3e4,Rg=1e3,eu=Symbol.for(`${M.cssPrefix}.page-tools`),ps={state:"output-error",errorText:"The page reloaded before this finished, so it may or may not have taken effect. Check with the visitor before trying it again."},ru="The visitor stopped this before it finished.";function Pn(e){return typeof e=="object"&&e!==null}function Ig(e){return Pn(e)&&Array.isArray(e.registered)&&e.runs instanceof Map}function Gr(){let e=Reflect.get(globalThis,eu);if(Ig(e))return e;let t={registered:[],runs:new Map};return Reflect.set(globalThis,eu,t),t}function Hn(e,t){let n=Pn(t)&&t.signal instanceof AbortSignal?t.signal:void 0;if(n?.aborted)return;let r=Gr().registered;r.push(e);function o(){let a=r.indexOf(e);a>=0&&r.splice(a,1)}n?.addEventListener("abort",o,{once:!0})}function tu(e){return e.replace(/[^A-Za-z0-9_-]/g,"_").slice(0,58)}function ou(e){if(!Pn(e)||typeof e.name!="string"||!tu(e.name))return;let t=[e.description,e.title].find(n=>typeof n=="string"&&n.trim()!=="")??e.name;return{name:tu(e.name),description:t.trim().slice(0,1024),inputSchema:{properties:{},...Pn(e.inputSchema)?e.inputSchema:{},type:"object"},consequential:Pn(e.annotations)&&e.annotations.consequentialHint===!0}}function ds(e){return e.flatMap(t=>{let n=ou(t),r=Pn(t)?t.execute:void 0;return!n||typeof r!="function"?(nu.warn("skipped a tool without a name or an execute function",t),[]):[{...n,run:(o,a)=>Reflect.apply(r,t,[o,{signal:a}])}]})}async function Eg(){let e=Reflect.get(document,"modelContext")??Reflect.get(navigator,"modelContext");if(!Pn(e)||typeof e.getTools!="function"||typeof e.executeTool!="function")return[];let t=e.getTools,n=e.executeTool,r=await Promise.race([Promise.resolve().then(()=>Reflect.apply(t,e,[])),Bn(Rg).then(()=>[])]).catch(()=>[]);return(Array.isArray(r)?r:[]).flatMap(o=>{let a=ou(o);return a?[{...a,run:(i,s)=>Reflect.apply(n,e,[o,i,{signal:s}])}]:[]})}async function na(e=[]){let t=ds(Xc()),n=new Set(t.map(a=>a.name)),o=[...(await Eg()).filter(a=>!n.has(a.name)),...t,...ds(e),...ds(Gr().registered)];return new Map(o.map(a=>[a.name,a]))}function _s(e){return[...e.values()].map(({name:t,description:n,inputSchema:r,consequential:o})=>o?{name:t,description:n,inputSchema:r,annotations:{consequentialHint:!0}}:{name:t,description:n,inputSchema:r})}function Vt(e){return e?.execution==="client"}function Kr(e){return e.startsWith(Yc)?e.slice(Yc.length):e}function Ag(e){if(e===void 0||typeof e=="function"||typeof e=="symbol")return null;let t=new WeakSet,n=JSON.stringify(e,(r,o)=>{if(typeof o=="bigint")return o.toString();if(!(typeof o=="function"||typeof o=="symbol"))return o instanceof Node?`[${o.nodeName.toLowerCase()}]`:Pn(o)?t.has(o)?"[circular]":(t.add(o),o):o});return n.length>Zc?{truncated:!0,preview:n.slice(0,Zc)}:JSON.parse(n)}async function Mg(e){let t=Kr(e.toolName),n=(await na(e.optionTools)).get(t);return n?Promise.resolve().then(()=>n.run(e.input,e.signal)).then(r=>({state:"output-available",output:Ag(r)})).catch(r=>(nu.warn("a page tool failed",{name:t,error:r}),{state:"output-error",errorText:(r instanceof Error?r.message:String(r)).slice(0,1e3)||"The page tool failed."})):{state:"output-error",errorText:`This page doesn't offer "${t}" right now; the visitor may have moved on. Tell them, or continue without it.`}}function au(e){let{toolCallId:t}=e,n=Tt.get(t);if(n?.state==="finished")return Promise.resolve(n.outcome);let{runs:r}=Gr(),o=r.get(t);if(o)return o.outcome;if(n?.state==="running")return Tt.set(t,{state:"finished",outcome:ps}),e.onSettled("interrupted",0),Promise.resolve(ps);let a=new AbortController,i=performance.now();Tt.set(t,{state:"running"});let s=Mg({...e,signal:a.signal}).then(c=>(r.delete(t),Tt.get(t)?.state!=="running"||(Tt.set(t,{state:"finished",outcome:c}),e.onSettled(c.state==="output-available"?"completed":"failed",Math.round(performance.now()-i))),c));return r.set(t,{outcome:s,controller:a}),s}function ra(e){return e===ps.errorText||e===ru}function fs(e){return Tt.set(e,{state:"stopped"}),Gr().runs.get(e)?.controller.abort(),ru}function iu(e){Tt.clear([e]),Gr().runs.get(e)?.controller.abort()}var me,cu,vs,xn,ms,ia,uu,aa,du,bs,gs,Lg,Xr=Symbol.for("pv"),sa={},la=[],Ng=/^m(i|n|o|s|text|space)$/,ca=Array.isArray,ys=la.slice,qn=Object.assign;function Un(e){e&&e.parentNode&&e.remove()}function kn(e,t,n){var r,o,a,i={},s=arguments.length;for(a in t)a=="key"?r=t[a]:a=="ref"&&typeof e!="function"?o=t[a]:i[a]=t[a];return s>2&&(i.children=s>3?ys.call(arguments,2):n),Qr(e,i,r,o,null)}function Qr(e,t,n,r,o){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:Xr,__v:o||++cu,__i:-1,__u:0};return!o&&me.vnode&&me.vnode(a),a}function ue(e){return e.children}function Ht(e,t){this.props=e,this.context=t,this.__g=0}function Sn(e,t){if(t==null)return e.__&&Sn(e.__,e.__i+1);for(var n;t<e.__k.length;t++)if((n=e.__k[t])&&n.__e)return n.__e;return typeof e.type!="function"||e.props.__P?null:Sn(e)}function pu(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),pu(e)}function su(e){(8&e.__g||(e.__g|=8,xn.push(e),ia++))&&ms==me.debounceRendering||((ms=me.debounceRendering)||queueMicrotask)(_u)}function _u(){var e,t,n,r,o,a,i,s,c;try{for(t=1;xn.length;)xn.length>t&&xn.sort(uu),e=xn.shift(),t=xn.length,8&e.__g&&(r=void 0,o=void 0,a=(o=(n=e).__v).__e,i=[],s=[],(c=n.__P)&&((r=qn({constructor:Xr},o)).__v=o.__v+1,me.vnode&&me.vnode(r),Ps(c,r,o,n.__n,c.namespaceURI,32&o.__u?[a]:null,i,a||Sn(o),32&o.__u,s),r.__v=o.__v,r.__.__k[r.__i]=r,hu(i,r,s),o.__=o.__e=null,r.__e!=a&&pu(r)))}finally{(ia=xn.length)&&(ms||queueMicrotask)(_u)}}function fu(e,t,n,r,o,a,i,s,c,p,_){var d,u,f,m,v,y,x=r.__k||la,P=t.length;for(c=Og(n,t,x,c,P),d=0;d<P;d++)(f=n.__k[d])!=null&&(u=~f.__i&&x[f.__i]||sa,f.__i=d,y=Ps(e,f,u,o,a,i,s,c,p,_),m=f.__e,(u.ref!=f.ref||8&u.__u)&&(u.ref&&xs(u.ref,null,f,u),f.ref&&_.push(f.ref,f.__c||m,f)),v=v||m,4&f.__u?(c=mu(f,c,e,!u.__v),u.__e&&(u.__e=null)):typeof f.type=="function"&&y!==void 0?c=y:m&&(c=m.nextSibling),f.__u&=-21);return n.__e=v,c}function Og(e,t,n,r,o){var a,i,s,c,p,_,d,u,f,m=n.length,v=m,y=0,x=0,P=e.__k=Array(o);for(a=0;a<o;a++)(i=t[a])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i!="object"||i.constructor===String?i=P[a]=Qr(null,i):ca(i)?i=P[a]=Qr(ue,{children:i}):i.constructor===Xr&&i.__b?i=P[a]=Qr(i.type,i.props,i.key,i.ref,i.__v):P[a]=i,c=a+y,i.__=e,i.__b=e.__b+1,s=null,~(p=i.__i=$g(i,n,c,v))&&(v--,(s=n[p])&&(s.__u|=2)),s&&s.__v?(i.__u|=16,p==c-1?y--:p==c+1?y++:p!=c&&(p>c?y--:y++,x=1)):(~p||(o>m?y--:o<m&&y++),typeof i.type!="function"&&(i.__u|=4))):P[a]=null;if(x){for(_=[],d=[],a=0;a<o;a++)if((i=P[a])&&16&i.__u){for(y=0,u=_.length;y<u;)_[f=y+u>>1]<i.__i?y=f+1:u=f;_[y]=i.__i,d[a]=y+1}for(y=_.length;a--;)d[a]&&(d[a]==y?y--:P[a].__u|=4)}if(v)for(a=0;a<m;a++)!(s=n[a])||2&s.__u||(s.__e==r&&(r=Sn(s)),Ss(s,s));return r}function mu(e,t,n,r){var o,a,i,s;if(typeof e.type=="function"){if(e.props.__P)return t;if(o=e.__k)for(a=0;a<o.length;a++)o[a]&&(o[a].__=e,t=mu(o[a],t,n,!1));return t}for(t&&!t.parentNode&&(t=Sn(e))&&!t.parentNode&&(t=null),i=e.__e,s=t;s&&s.nodeType==8;)s=s.nextSibling;for(i!=s&&(!r&&n.moveBefore&&i.parentNode?n.moveBefore(i,t):n.insertBefore(i,t||null)),t=i;(t=t&&t.nextSibling)&&t.nodeType==8&&!t.data.startsWith("$s"););return t}function ua(e,t){return t=t||[],e!=null&&typeof e!="boolean"&&(ca(e)?e.some(function(n){ua(n,t)}):t.push(e)),t}function $g(e,t,n,r){var o,a=e.key,i=e.type,s=t[n],c=s&&!(2&s.__u);if(s===null&&a==null||c&&a==s.key&&i==s.type)return n;if(r>(c?1:0)){for(o=n-1;o>=0;o--)if((s=t[o])&&!(2&s.__u)&&a==s.key&&i==s.type)return o;for(o=n+1;o<t.length;o++)if((s=t[o])&&!(2&s.__u)&&a==s.key&&i==s.type)return o}return-1}function lu(e,t,n){n==null&&(n=""),t[0]=="-"?e.setProperty(t,n):e[t]=n}function oa(e,t,n,r,o){var a,i;if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||lu(e.style,t);if(n)for(t in n)r&&n[t]==r[t]||lu(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")(e.__e||(e.__e={}))[t]=n,n&&r||(i=gs[t]||(gs[t]=Dg(t)),(e.__a||(e.__a={}))[t]=bs,a=t!=(t=t.replace(du,"$1")),(t=t.slice(2))[0]<"a"&&(t=t.toLowerCase()),n?e.addEventListener(t,i,a):e.removeEventListener(t,i,a));else{if(o=="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{return void(e[t]=n??"")}catch{}if(typeof n=="function")return;n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n)}}function Dg(e){return function(t){var n=this.__e;if(n){if(n=n[e],t[aa]==null)t[aa]=bs++;else if(t[aa]<this.__a[e])return;return n(me.event?me.event(t):t)}}}function Ps(e,t,n,r,o,a,i,s,c,p){var _,d,u,f,m,v,y,x,P,k,g,h,b,w,A,R,E,N,j=t.type;if(t.constructor!==Xr)return null;128&n.__u&&(c=32&n.__u,_=n.__c.__z)&&(t.__u|=c,d=a=[],_.nodeType==8?s=hs(_,a):a.push(_),s=a[0]||s),(_=me.__b)&&_(t);e:if(typeof j=="function"){u=i.length;try{if(x=t.props,P=(_=j.prototype)&&_.render,k=(_=j.contextType)&&r[_.__c],g=_?k?k.props.value:_.__:r,(f=n.__c)?(t.__c=f,2&f.__g&&(f.__g|=1)):(P?t.__c=f=new j(x,g):(t.__c=f=new Ht(x,g),f.constructor=j,f.render=Bg),k&&k.sub(f),f.state||(f.state={}),f.__n=r,f.__g|=8,f.__h=[],f.__k=[]),P&&(f.__s||(f.__s=f.state),j.getDerivedStateFromProps&&(f.__s==f.state&&(f.__s=qn({},f.__s)),qn(f.__s,j.getDerivedStateFromProps(x,f.__s)))),m=f.props,v=f.state,f.__v=t,n.__c){if(x!==m&&P&&!j.getDerivedStateFromProps&&f.componentWillReceiveProps&&f.componentWillReceiveProps(x,g),t.__v==n.__v&&!(8&f.__g)||!(4&f.__g)&&f.shouldComponentUpdate&&f.shouldComponentUpdate(x,f.__s,g)===!1){t.__v!=n.__v&&(f.props=x,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(B){B&&(B.__=t)}),la.push.apply(f.__h,f.__k),f.__k=[],f.__h.length&&i.push(f),s=Sn(n);break e}f.componentWillUpdate&&f.componentWillUpdate(x,f.__s,g),P&&f.componentDidUpdate&&f.__h.push(function(){f.componentDidUpdate(m,v,y)})}else P&&!j.getDerivedStateFromProps&&f.componentWillMount&&f.componentWillMount(),P&&f.componentDidMount&&f.__h.push(f.componentDidMount);if(f.context=g,f.props=x,f.__P=e,f.__g&=-5,h=me.__r,b=0,P)f.state=f.__s,f.__g&=-9,h&&h(t),_=f.render(f.props,f.state,f.context),la.push.apply(f.__h,f.__k),f.__k=[];else do f.__g&=-9,h&&h(t),_=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++b<25);f.state=f.__s,f.getChildContext&&(r=qn({},r,f.getChildContext())),P&&n.__c&&f.getSnapshotBeforeUpdate&&(y=f.getSnapshotBeforeUpdate(m,v)),w=_&&_.type===ue&&_.key==null?_.props.children:_,x.__P&&(_=s,o=(e=x.__P).namespaceURI,c=a=null,n.props&&n.props.__P!=e&&(n.__k.some(function(B){B&&Ss(B,B)}),n.__k=null),s=n.__k?Sn(n,0):null),s=fu(e,ca(w)?w:[w],t,n,r,o,a,i,s,c,p),x.__P&&(t.__e=null,s=_),t.__u&=-161,d&&d.some(Un),f.__h.length&&i.push(f),1&f.__g&&(f.__g&=-4)}catch(B){if(i.length=u,t.__v=null,c||a)if(B.then){if(A=0,t.__u|=128|c,a){for(~(E=a.indexOf(s||void 0))||(E=a.length);(N=a[E-1])&&N.nodeType==8;)E--;for(;E<a.length;E++)if(N=a[E]){if(a[E]=null,N.nodeType==8){if(N.data.startsWith("$s"))A++||(R=N);else if(A&&N.data.startsWith("/$s")&&!--A)break}else if(!A)break}}if(!R){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;R=s}(_=hs(R=t.__c.__z||(t.__c.__z=R)))?(t.__e=R,s=_):t.__e=s,s=s&&s.nextSibling}else a&&a.some(Un);else t.__e=n.__e;t.__k||(t.__k=n.__k||[]),B.then||gu(t),me.__e(B,t,n)}}else s=t.__e=Fg(n.__e,t,n,r,o,a,i,c,p,e);return(_=me.diffed)&&_(t),s}function hs(e,t){if(e&&e.nodeType==8&&e.data.startsWith("$s"))for(var n=1;e=e.nextSibling;){if(e.nodeType==8){if(e.data.startsWith("$s"))n++;else if(e.data.startsWith("/$s")&&!--n)return e}t&&t.push(e)}}function gu(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(gu))}function hu(e,t,n){for(var r=0;r<n.length;)xs(n[r++],n[r++],n[r++]);me.__c&&me.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(a){a.call(o)})}catch(a){me.__e(a,o.__v)}})}function Fg(e,t,n,r,o,a,i,s,c,p){var _,d,u,f,m,v,y,x,P,k=n.props||sa,g=t.props,h=t.type;if(h=="svg"?o="http://www.w3.org/2000/svg":h=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),a){for(_=0;_<a.length;_++)if((m=a[_])&&(h?m.localName==h:m.nodeType==3)){e=m,a[_]=null;break}}if(!e){if(x=p.ownerDocument||document,!h)return x.createTextNode(g);e=x.createElementNS(o,h,g.is&&g),s&&(me.__m&&me.__m(t,a),s=!1),a=null}if(h){if(p=h=="template"?e.content:e,a=h=="textarea"&&g.defaultValue!=null?null:a&&ys.call(p.childNodes),!s&&a)for(k={},_=0;_<e.attributes.length;_++)k[(m=e.attributes[_]).name]=m.value;for(_ in k)m=k[_],_=="dangerouslySetInnerHTML"?u=m:_=="children"||_ in g||_=="value"&&"defaultValue"in g||_=="checked"&&"defaultChecked"in g||oa(e,_,null,m,o);for(_ in P=1&n.__u,g)m=g[_],_=="children"?f=m:_=="dangerouslySetInnerHTML"?d=m:_=="value"?v=m:_=="checked"?y=m:s&&typeof m!="function"||!(k[_]!==m||P&&m!=null)||oa(e,_,m,k[_],o);d?(s||u&&(d.__html==u.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[]):(u&&(e.textContent=""),(h=="foreignObject"||o=="http://www.w3.org/1998/Math/MathML"&&Ng.test(h))&&(o="http://www.w3.org/1999/xhtml"),fu(p,ca(f)?f:[f],t,n,r,o,a,i,a?a[0]:n.__k&&Sn(n,0),s,c),a&&a.some(Un)),s&&h!="textarea"||(_="value",h=="progress"&&v==null?e.removeAttribute(_):v==null||v===e[_]&&(h!="progress"||v)||oa(e,_,v,k[_],o),_="checked",y!=null&&y!=e[_]&&oa(e,_,y,k[_],o))}else k===g||s&&e.data==g||(e.data=g);return e}function xs(e,t,n,r){try{typeof e=="function"?t?t.__x=e(t)||1:r&&(r=r.__c||r.__e)&&(t=r.__x)&&(r.__x=null,typeof t=="function"?t():e(null)):e.current=t}catch(o){me.__e(o,n)}}function Ss(e,t,n){var r,o,a,i;if(me.unmount&&me.unmount(e),!(r=e.ref)||r.current&&r.current!=e.__e||xs(r,null,t,e),r=e.__c){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(s){me.__e(s,t)}r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Ss(r[i],t,typeof e.type!="function"||n&&!e.props.__P);!n&&(r=e.__c)&&(r=r.__z)&&(o=hs(r,a=[]))&&(r==e.__e&&a.some(Un),Un(o),Un(r)),(r=e.__e)&&(n||Un(r),r.__e&&(r.__e=null)),e.__e=e.__c=e.__=null}function Bg(e,t,n){return this.constructor(e,n)}function Xt(e,t){var n,r,o,a;me.__&&me.__(e,t),t.nodeType==9&&(t=t.documentElement),r=(n=e&&32&e.__u)?null:t.__k,t.__k=Qr(ue,{children:[e]}),o=[],a=[],Ps(t,t.__k,r||sa,sa,t.namespaceURI,r?null:t.firstChild?ys.call(t.childNodes):null,o,r?r.__e:t.firstChild,n,a),hu(o,t.__k,a),t.__k.props.children=null}me={__e:function(e,t,n,r){for(var o,a,i;t=t.__;)if((o=t.__c)&&!(1&o.__g)){o.__g|=4;try{if((i=(a=o.constructor)&&a.getDerivedStateFromError)&&o.setState(a.getDerivedStateFromError(e)),o.componentDidCatch&&(o.componentDidCatch(e,r||{}),i=1),i&&8&o.__g)return void(o.__g|=2)}catch(s){e=s}}throw ia=0,e}},cu=0,vs=function(e){return e!=null&&e.constructor===Xr},Ht.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=qn({},this.state)),typeof e=="function"&&(e=e(qn({},n),this.props)),e&&(qn(n,e),this.__v&&(t&&this.__k.push(t),su(this)))},Ht.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),su(this))},Ht.prototype.render=ue,xn=[],ia=0,uu=function(e,t){return e.__v.__b-t.__v.__b},aa=Symbol(),du=/(PointerCapture)$|Capture$/i,bs=0,gs={},Lg=0;function Rt(){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,Hg(t.subarray(6)),t[6]=t[6]&15|112,t[8]=t[8]&63|128;let n=Array.from(t,r=>r.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 Hg(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 an=Z.scope("persistence");function wn(e,t=Ko,n){let r=n?`${e}.${n}`:e,o=`${M.cssPrefix}.storageVersion`,a=t.get(o)??void 0,i=a?`.v${a}`:"",s=`${M.cssPrefix}.${r}${i}`,c=`${M.cssPrefix}${i}.visitorId`,p=`${s}.conversationId`,_=`${s}.userPrefs`,d=`${s}.panelOpen`,u=`${s}.panelSize`,f=`${s}.calloutDismissed`,m=`${s}.sidebarCollapsed`,v=`${s}.activeModule`,y=`${s}.seenNewsId`,x=`${s}.historyCount`,P=`${s}.formsDone`,k={getVisitorId(){let g=t.get(c);if(g)return g;let h=Rt();return t.set(c,h),h},loadConversationId(){return t.get(p)??void 0},saveConversationId(g){an.trace("saveConversationId",{id:g,scope:r}),g?t.set(p,g):t.remove(p)},loadDraft(g){return t.get(`${s}.draft.${g}`)??""},saveDraft(g,h){let b=`${s}.draft.${g}`;h?t.set(b,h):t.remove(b)},loadMessageQueue(g){let h=t.get(`${s}.messageQueue.${g}`);if(!h)return[];try{let b=JSON.parse(h);return!Array.isArray(b)||!b.every(Ug)?[]:b}catch(b){return an.warn("loadMessageQueue parse failed",{error:b}),[]}},saveMessageQueue(g,h){let b=`${s}.messageQueue.${g}`;if(h.length===0){t.remove(b);return}try{t.set(b,JSON.stringify(h))}catch(w){an.warn("saveMessageQueue serialise failed",{error:w})}},loadUserPrefs(){let g=t.get(_);if(!g)return{};try{return ks(JSON.parse(g))}catch(h){return an.warn("loadUserPrefs parse failed",{error:h}),{}}},saveUserPrefs(g){try{t.set(_,JSON.stringify(g))}catch(h){an.warn("saveUserPrefs serialise failed",{error:h})}},patchUserPrefs(g){let h=k.loadUserPrefs();k.saveUserPrefs({...h,...g})},loadPanelOpen(){let g=t.get(d);return g==="1"?!0:g==="0"?!1:null},savePanelOpen(g){t.set(d,g?"1":"0")},loadPanelSize(){let g=t.get(u);return g==="normal"||g==="expanded"||g==="fullscreen"?g:null},savePanelSize(g){t.set(u,g)},loadCalloutDismissed(g){if(!g)return!1;let h=t.get(f);return!!h&&h===g},saveCalloutDismissed(g){g?t.set(f,g):t.remove(f)},loadSidebarCollapsed(){let g=t.get(m);return g==="1"?!0:g==="0"?!1:null},saveSidebarCollapsed(g){t.set(m,g?"1":"0")},loadActiveModule(){return t.get(v)||null},saveActiveModule(g){t.set(v,g)},loadSeenNewsId(){return t.get(y)||null},saveSeenNewsId(g){t.set(y,g)},loadHistoryCount(){let g=t.get(x);if(!g)return null;let h=Number.parseInt(g,10);return Number.isFinite(h)&&h>=0?h:null},saveHistoryCount(g){t.set(x,String(g))},loadFormsDone(){let g=t.get(P);if(!g)return{};try{let h=JSON.parse(g);return da(h)?Object.fromEntries(Object.entries(h).filter(b=>typeof b[1]=="number")):{}}catch(h){return an.warn("loadFormsDone parse failed",{error:h}),{}}},saveFormDone(g){try{let h=k.loadFormsDone();h[g]=Date.now(),t.set(P,JSON.stringify(h))}catch(h){an.warn("saveFormDone serialise failed",{error:h})}},rememberStorageVersion(g){g&&g!==t.get(o)&&(an.debug("rememberStorageVersion (force-reset on next load)",{version:g}),t.set(o,g))},clearConversation(){t.remove(p)},reset(){let g=t.get(p);g&&(t.remove(`${s}.draft.${g}`),t.remove(`${s}.messageQueue.${g}`));for(let h of[c,p,_,d,u,f,m,v,y,x,P])t.remove(h);an.info("reset: forgot the visitor",{scope:r})}};return k}function da(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ug(e){return da(e)&&typeof e.id=="string"&&e.id.length>0&&typeof e.text=="string"}function ks(e){if(!da(e))return{};let t={};return typeof e.locale=="string"&&(t.locale=e.locale),typeof e.soundMuted=="boolean"&&(t.soundMuted=e.soundMuted),(e.themeMode==="auto"||e.themeMode==="light"||e.themeMode==="dark")&&(t.themeMode=e.themeMode),(e.textSize==="small"||e.textSize==="normal"||e.textSize==="large")&&(t.textSize=e.textSize),da(e.widgetSize)&&typeof e.widgetSize.width=="number"&&typeof e.widgetSize.height=="number"&&(t.widgetSize={width:e.widgetSize.width,height:e.widgetSize.height}),t}var _r="1.14.0";var qg="1",vu=60,zg=2e3,bu={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}),hostEvent:e=>({name:e.name,data:e.data&&JSON.stringify(e.data)}),messageFeedback:e=>({value:e.value??"none"}),contentView:e=>({section:e.section,count:e.count}),contentOpen:e=>({contentId:e.contentId,contentCollectionId:e.contentCollectionId}),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 jg(){let e=navigator;return e.globalPrivacyControl===!0||e.doNotTrack==="1"}function Vg(){return location.origin+location.pathname}function Wg(){try{return document.referrer?new URL(document.referrer).origin:""}catch{return""}}function yu(e,t){let n=Math.random(),r=0,o=0,a=new Set;function i(_,d){let{tracking:u,publicKey:f,aiAgentDeploymentId:m,mode:v,themeMode:y}=t.getOptions();if(!u.enabled||jg()||n>=u.sampleRate)return;let x=performance.now();if(x-r>6e4&&(r=x,o=0),++o>vu)return;let P=new URLSearchParams;P.set("v",qg),P.set("_ev",_r),P.set("e",_),u.token&&P.set("tk",u.token),f&&P.set("pk",f),m&&P.set("dep",m),P.set("vid",t.getVisitorId());let k=t.getConversationId();k&&P.set("cid",k),P.set("url",Vg());let g=Wg();g&&P.set("ref",g),P.set("sw",String(screen.width)),P.set("sh",String(screen.height)),P.set("vw",String(innerWidth)),P.set("vh",String(innerHeight)),P.set("dpr",String(devicePixelRatio)),P.set("lang",navigator.language);try{P.set("tz",Intl.DateTimeFormat().resolvedOptions().timeZone)}catch{}if(P.set("m",v),P.set("th",y),d)for(let[A,R]of Object.entries(d))R!==void 0&&P.set(A,String(R));P.set("ts",String(Date.now()));let h=`${u.endpoint}?${P}`;if(h.length>zg)return;let b=new Image(1,1);a.add(b);function w(){return a.delete(b)}b.addEventListener("load",w,{once:!0}),b.addEventListener("error",w,{once:!0}),b.src=h}let s=[];function c(_,d){if(s&&_!=="handshake"){s.length<vu&&s.push([_,d]);return}let u=s??[];s=void 0;for(let[f,m]of u)i(f,m);i(_,d)}let p=Object.keys(bu).map(_=>e.on(_,d=>c(_,bu[_]?.(d))));return()=>{for(let _ of p)_();a.clear()}}var Pu=`.__P__-generative-ui{display:grid;gap:var(--__P__-space-3);overflow-wrap:anywhere;white-space:pre-wrap}.__P__-generative-ui p{margin:0}.__P__-generative-ui-grid-container{container:__P__-generative-ui-grid / inline-size;min-width:0}.__P__-generative-ui-grid{display:grid;grid-template-columns:minmax(0,1fr);align-items:start;gap:16px}.__P__-generative-ui-cell{display:grid;align-content:start;min-width:0;gap:16px}@container __P__-generative-ui-grid (min-width: 496px){.__P__-generative-ui-grid:is([data-columns="2"],[data-columns="3"],[data-columns="4"]){grid-template-columns:repeat(2,minmax(0,1fr))}.__P__-generative-ui-grid:is([data-columns="2"],[data-columns="3"],[data-columns="4"])>.__P__-generative-ui-cell:is([data-span="2"],[data-span="3"],[data-span="4"]){grid-column:span 2}}@container __P__-generative-ui-grid (min-width: 752px){.__P__-generative-ui-grid:is([data-columns="3"],[data-columns="4"]){grid-template-columns:repeat(3,minmax(0,1fr))}.__P__-generative-ui-grid:is([data-columns="3"],[data-columns="4"])>.__P__-generative-ui-cell:is([data-span="3"],[data-span="4"]){grid-column:span 3}}@container __P__-generative-ui-grid (min-width: 1008px){.__P__-generative-ui-grid[data-columns="4"]{grid-template-columns:repeat(4,minmax(0,1fr))}.__P__-generative-ui-grid[data-columns="4"]>.__P__-generative-ui-cell[data-span="4"]{grid-column:span 4}}.__P__-generative-ui section{display:grid;gap:var(--__P__-space-2);padding:var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);min-width:0}.__P__-generative-ui-metric{font-size:1.6em;font-weight:700}.__P__-generative-ui-table{overflow-x:auto}.__P__-generative-ui table{width:100%;border-collapse:collapse;white-space:normal}.__P__-generative-ui caption{text-align:start;font-weight:600;padding-bottom:var(--__P__-space-2)}.__P__-generative-ui th,.__P__-generative-ui td{text-align:start;padding:var(--__P__-space-2);border-bottom:1px solid var(--__P__-border)}.__P__-generative-ui-chart{display:block;width:100%;color:var(--__P__-accent)}.__P__-generative-ui-axis{stroke:var(--__P__-border)}.__P__-generative-ui-data{display:flex;flex-wrap:wrap;gap:var(--__P__-space-2);font-size:.85em}
2
+ `;var xu=`: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;border-radius:var(--__P__-radius-md)}: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}}
3
+ `;var Su=`.__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:var(--__P__-radius-md);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);flex-shrink:0}.__P__-agent-avatar img{width:100%;height:100%;border-radius:inherit;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[data-cut-end=true]{mask-image:linear-gradient(to right,#000 calc(100% - 32px),transparent)}.__P__-suggestions[data-cut-start=true]{mask-image:linear-gradient(to right,transparent,#000 32px)}.__P__-suggestions[data-cut-start=true][data-cut-end=true]{mask-image:linear-gradient(to right,transparent,#000 32px,#000 calc(100% - 32px),transparent)}:host([dir="rtl"]) .__P__-suggestions[data-cut-end=true]{mask-image:linear-gradient(to left,#000 calc(100% - 32px),transparent)}:host([dir="rtl"]) .__P__-suggestions[data-cut-start=true]{mask-image:linear-gradient(to left,transparent,#000 32px)}:host([dir="rtl"]) .__P__-suggestions[data-cut-start=true][data-cut-end=true]{mask-image:linear-gradient(to left,transparent,#000 32px,#000 calc(100% - 32px),transparent)}.__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;position:relative;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 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-strip{display:flex;flex:none;justify-content:center;padding:var(--__P__-space-1) 0}.__P__-jump{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-body{display:flex;flex-wrap:wrap;align-items:flex-start;gap:var(--__P__-space-3) 6px;min-width:0}.__P__-bubble-body>*{flex:1 0 100%;min-width:0}.__P__-bubble-body>.__P__-source,.__P__-bubble-body>.__P__-typing{flex:0 1 auto}.__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,.__P__-steps){width:100%}.__P__-bubble-row[data-role=assistant] .__P__-bubble-col:has(.__P__-toolui,.__P__-steps) .__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__-file-image,.__P__-file-chip{border-radius:var(--__P__-radius-sm);color:inherit;text-decoration:none}.__P__-file-image{display:block;width:fit-content;max-width:min(100%,240px);overflow:hidden}.__P__-file-image img{max-height:240px;object-fit:cover}.__P__-file-chip{display:flex;align-items:center;gap:var(--__P__-space-2);max-width:min(100%,280px);padding:var(--__P__-space-2);border:1px solid color-mix(in srgb,currentColor 18%,transparent);background:color-mix(in srgb,currentColor 5%,transparent);transition:background var(--__P__-dur-base) var(--__P__-ease)}.__P__-file-chip:hover{background:color-mix(in srgb,currentColor 10%,transparent)}.__P__-file-image:focus-visible,.__P__-file-chip:focus-visible{outline:2px solid currentColor;outline-offset:2px}.__P__-file-chip-icon{flex:none;display:grid;place-items:center;width:32px;height:32px;border-radius:var(--__P__-radius-sm);background:color-mix(in srgb,currentColor 10%,transparent)}.__P__-file-chip-text{display:grid;min-width:0;line-height:1.35}.__P__-file-chip-name{font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.__P__-file-chip-meta{font-size:var(--__P__-text-xs);opacity:.75}.__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__-steps{min-width:0;font-size:var(--__P__-text-sm)}.__P__-steps-head,.__P__-steps-row-head,.__P__-steps-thought-more{display:inline-flex;align-items:center;gap:var(--__P__-space-2);max-width:100%;min-width:0;min-height:28px;padding:0;border:0;background:none;color:var(--__P__-fg-muted);font:inherit;text-align:start;cursor:pointer;-webkit-tap-highlight-color:transparent}.__P__-steps-head:hover,.__P__-steps-row-head:hover,.__P__-steps-thought-more:hover{color:var(--__P__-fg)}.__P__-steps-head:focus-visible,.__P__-steps-row-head:focus-visible,.__P__-steps-thought-more:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;border-radius:var(--__P__-radius-sm)}.__P__-steps-icon,.__P__-steps-row-icon{display:inline-flex;flex:none;align-items:center;justify-content:center;width:16px;height:16px}.__P__-steps-icon svg,.__P__-steps-row-icon svg{width:14px;height:14px}.__P__-steps-label,.__P__-steps-row-label{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-steps-sep{margin-inline:var(--__P__-space-1)}.__P__-steps-name .__P__-steps-count{margin-inline-start:var(--__P__-space-1)}.__P__-steps-count,.__P__-steps-failed,.__P__-steps-denied,.__P__-steps-time{flex:none;font-variant-numeric:tabular-nums}.__P__-steps-failed{color:var(--__P__-danger-text)}.__P__-steps-denied{color:var(--__P__-fg-muted)}.__P__-steps-chevron{display:inline-flex;flex:none;width:16px;height:16px;transition:transform var(--__P__-dur-quick) var(--__P__-ease)}.__P__-steps-chevron svg{width:16px;height:16px}.__P__-steps-chevron[data-open=true]{transform:rotate(180deg)}.__P__-steps-list{position:relative;display:flex;flex-direction:column;gap:var(--__P__-space-1);margin:var(--__P__-space-1) 0 0;padding:0;list-style:none}.__P__-steps-list:before{content:"";position:absolute;inset-block:0;inset-inline-start:7px;width:2px;border-radius:1px;background:var(--__P__-border)}.__P__-steps-row{position:relative;display:grid;grid-template-columns:16px minmax(0,1fr);column-gap:var(--__P__-space-2);align-items:start}.__P__-steps-row .__P__-steps-row-icon{margin-block:6px;border-radius:999px;background:var(--__P__-bubble-assistant);color:var(--__P__-fg-muted)}.__P__-steps-row[data-status=error] .__P__-steps-row-icon{color:var(--__P__-danger-text)}.__P__-steps-row-main{display:flex;flex-direction:column;align-items:flex-start;min-width:0}.__P__-steps-row-name{color:var(--__P__-fg);font-weight:500}.__P__-steps-row-summary{margin-inline-start:var(--__P__-space-2);color:var(--__P__-fg-muted)}.__P__-steps-row-body{display:flex;flex-direction:column;gap:var(--__P__-space-2);width:100%;margin:var(--__P__-space-1) 0 var(--__P__-space-2)}.__P__-steps-body{display:grid;grid-template-rows:0fr;transition:grid-template-rows .2s ease-out}.__P__-steps-body[data-open=true]{grid-template-rows:1fr}.__P__-steps-body-inner{min-height:0;overflow:hidden}.__P__-steps-live{min-width:0;overflow:hidden;text-overflow:ellipsis;background:linear-gradient(90deg,var(--__P__-fg-muted) 0%,var(--__P__-fg) 50%,var(--__P__-fg-muted) 100%) 0 0 / 200% 100%;background-clip:text;-webkit-background-clip:text;color:transparent;animation:__P__-steps-shimmer 2s linear infinite}@keyframes __P__-steps-shimmer{to{background-position:-200% 0}}@media(prefers-reduced-motion:reduce){.__P__-steps-body,.__P__-steps-chevron{transition:none}.__P__-steps-live{background:none;color:var(--__P__-fg-muted);animation:none}}.__P__-steps-thought-label,.__P__-steps-stopped-label{display:inline-flex;align-items:center;min-height:28px;color:var(--__P__-fg-muted)}.__P__-steps-thought-text{width:100%;color:var(--__P__-fg-muted)}.__P__-steps-thought-text[data-clamped=true]{max-height:calc(3 * 1.6em);overflow:hidden;mask-image:linear-gradient(to bottom,#000 60%,transparent)}.__P__-steps-thought-more{min-height:24px;font-size:var(--__P__-text-xs)}.__P__-reasoning-body{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%;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__-compaction-status{width:100%;padding:10px 14px;justify-content:center;font-size:var(--__P__-text-xs)}.__P__-message-queue{display:flex;max-height:112px;flex-direction:column;gap:var(--__P__-space-1);overflow-y:auto}.__P__-attachment-chip.__P__-queued-message{width:100%;max-width:none}.__P__-queued-text{min-width:0;flex:1}.__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{display:flex;align-items:center;gap:var(--__P__-space-2);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)}.__P__-error-icon{display:inline-flex;flex:none;width:16px;height:16px;color:var(--__P__-danger-text)}.__P__-error-icon svg{width:16px;height:16px}.__P__-error-text{min-width:0}.__P__-error-retry{flex:none;margin-inline-start:auto;min-height:28px;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__-error-retry:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;border-radius:var(--__P__-radius-sm)}.__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-card>[role=listitem]{display:flex;flex-direction:column}.__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-card>*+*{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:var(--__P__-radius-md);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:var(--__P__-radius-md)}.__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__-help-more{justify-content:center;color:var(--__P__-accent-fg);font-weight:600}.__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)}@media(hover:hover){.__P__-tab:hover{background:var(--__P__-hover)}}.__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:var(--__P__-radius-md);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:var(--__P__-radius-md);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;line-height:1.45}.__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__-home-ask{padding-block:6px;padding-inline-end:6px}.__P__-home-ask .__P__-send{width:32px;height:32px;flex-shrink:0}.__P__-home-ask .__P__-send[data-shape=pill]{width:auto;padding:0 14px}.__P__-home-ask .__P__-send svg{width:16px;height:16px}.__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-vote{display:flex;align-items:center;flex-wrap:wrap;gap:var(--__P__-space-2);padding-top:var(--__P__-space-3);border-top:1px solid var(--__P__-border)}.__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;line-height:1.45;border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);overflow:hidden;background:var(--__P__-surface);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-meta{display:flex;flex-wrap:wrap;align-items:center;gap:6px;color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm)}.__P__-news-tag{padding:1px 8px;border-radius:6px;background:var(--__P__-hover);color:var(--__P__-fg);font-size:calc(12px * var(--__P__-text-scale));white-space:nowrap}.__P__-news-more{display:flex;align-items:center;justify-content:center;gap:var(--__P__-space-2);width:100%;min-height:44px;border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);background:var(--__P__-surface);color:var(--__P__-accent-fg);font-weight:600}.__P__-news-more:hover{background:var(--__P__-bg-elevated)}.__P__-news-more:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__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{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)}.__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__-toolui-status[data-status=incomplete],.__P__-toolui-status[data-status=stopped]{--__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-fields{display:grid;grid-template-columns:auto minmax(0,1fr);gap:2px var(--__P__-space-2);margin:0;font-size:var(--__P__-text-xs);line-height:1.5}.__P__-toolui-fields>div{display:contents}.__P__-toolui-fields dt{color:var(--__P__-fg-muted)}.__P__-toolui-fields dd{margin:0;min-width:0;overflow:hidden;color:var(--__P__-fg);font-family:var(--__P__-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);text-overflow:ellipsis;white-space:nowrap}.__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
+ `;var ku=`*,*: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}
5
+ `;var wu=`: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}}
6
+ `;var Yg="helpai",Zg="#5B5BD6",eh="#FFFFFF",th="12px",nh="Inter, system-ui, -apple-system, 'Segoe UI', sans-serif",Cs=[wu,ku,Su,Pu,xu].join(`
7
+ `).replace(/__P__/g,Yg).replaceAll("__BRAND_ACCENT_TEXT__",eh).replaceAll("__BRAND_ACCENT__",Zg).replaceAll("__BRAND_RADIUS__",th).replaceAll("__BRAND_FONT__",nh);var Tu=["data-theme","data-color-scheme","data-mode","data-bs-theme"];function Cu(e){if(e){if(e.classList.contains("dark"))return"dark";if(e.classList.contains("light"))return"light";for(let t of Tu){let n=e.getAttribute(t);if(n==="dark"||n==="light")return n}}}function fr(e=document){let t=Cu(e.documentElement)??Cu(e.body);if(t)return t;let n=getComputedStyle(e.documentElement).colorScheme.trim();return n==="dark"||n==="light"?n:typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Ru(e,t=document){let n=fr(t);e(n);function r(){let s=fr(t);s!==n&&(n=s,e(s))}let o=new MutationObserver(r),a={attributes:!0,attributeFilter:["class","style",...Tu]};o.observe(t.documentElement,a),t.body&&o.observe(t.body,a);let i=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):void 0;return i?.addEventListener("change",r),()=>{o.disconnect(),i?.removeEventListener("change",r)}}var rh=Z.scope("mount"),Iu=new WeakMap,Eu={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 Au(e,t){e.style.cssText=Eu[t]}function zn(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function mr(e={}){let t=e.position??"flow";rh.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${M.cssPrefix}-chat-host`;typeof customElements<"u"&&!customElements.get(n)&&customElements.define(n,class extends HTMLElement{});let r;e.existingHost?r=e.existingHost:(r=document.createElement(n),(e.target??document.body).appendChild(r)),r.setAttribute("data-brand",M.id),r.style.cssText=Eu[t];let o=r.shadowRoot??r.attachShadow({mode:"open"});for(let s of["keydown","keypress","keyup"])o.addEventListener(s,oh);let a=r.ownerDocument;if(!ah(o,a)){let s=a.createElement("style");s.textContent=Cs,o.appendChild(s)}let i=document.createElement("div");return i.className=`${M.cssPrefix}-app`,o.appendChild(i),{appRoot:i,destroy:()=>r.remove(),hostElement:r,shadowRoot:o}}function oh(e){if(e instanceof KeyboardEvent&&(e.metaKey||e.ctrlKey))return;let t=e.composedPath()[0];t instanceof HTMLElement&&(t.isContentEditable||t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT")&&e.stopPropagation()}function ah(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let r=Iu.get(t);if(!r)try{r=new n.CSSStyleSheet,r.replaceSync(Cs),Iu.set(t,r)}catch{return!1}try{return e.adoptedStyleSheets=[r],!0}catch{return!1}}function ih(e,t){let n=M.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 sh(e,t){e.dataset.theme=t==="host"?fr():t}function lh(e,t){let n=M.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 ch(e,t){e.dataset.position=t}function pa(e,t){e.dataset.mode=t}function Mu(e,t){sh(e,t.themeMode),ih(e,t.themeOverrides),ch(e,t.position),lh(e,t.size)}var gr,at,Ts,Lu,Rs=Object.is,Yr=0,qu=[],Is=[],Ze=me,Nu=Ze.__b,Ou=Ze.__r,$u=Ze.diffed,Du=Ze.__c,Fu=Ze.unmount,Bu=Ze.__;function _a(e,t){Ze.__h&&Ze.__h(at,e,Yr||t),Yr=0;var n=at.__H||(at.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function H(e){return Yr=1,zu(ju,e)}function zu(e,t,n){var r=_a(gr++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):ju(void 0,t),function(a){var i=r.__N?r.__N[0]:r.__[0],s=r.t(i,a);Rs(i,s)||(r.__N=[s,r.__[1]],r.__c.setState({}))}],r.__c=at,!at.__f)){at.__f=!0;var o=at.shouldComponentUpdate;at.shouldComponentUpdate=function(a,i,s){var c=this.__H;if(!c)return!0;var p=!1,_=this.props!=a;if(c.__.some(function(u){u.__N&&(p=!0,Rs(u.__[0],u.__N[0])||(_=!0))}),o){var d=o.call(this,a,i,s);return p?d||_:d}return!p||_}}return r.__}function $(e,t){var n=_a(gr++,3);!Ze.__s&&As(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,at.__H.__h.push(n))}function It(e,t){var n=_a(gr++,4);!Ze.__s&&As(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,at.__h.push(n))}function D(e){return Yr=5,le(function(){return{current:e}},[])}function le(e,t){var n=_a(gr++,7);return As(n.__H,t)&&(n.__=e(),n.__H=t),n.__}function F(e,t){return Yr=8,le(function(){return e},t)}function uh(){var e;do{for(;e=Is.shift();)try{Jr(e)}catch(n){Ze.__e(n,{__:(e=e.__P)&&e.__v})}for(;e=qu.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Jr),t.__h.some(Es),t.__h=[]}catch(n){t.__h=[],Ze.__e(n,e.__v)}}}while(Is.length)}Ze.__b=function(e){at=null,Nu&&Nu(e)},Ze.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Bu&&Bu(e,t)},Ze.__r=function(e){Ou&&Ou(e),gr=0;var t=(at=e.__c).__H;t&&(Ts==at?at.__h=[]:(t.__h.some(Jr),t.__h.some(Es),gr=0),t.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})),Ts=at},Ze.diffed=function(e){$u&&$u(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&Uu(qu.push(t)),t.__H.__.some(function(n){n.u&&(n.__H=n.u)})),Ts=at=null},Ze.__c=function(e,t){t.some(function(n){try{n.__h.some(Jr),n.__h=n.__h.filter(function(r){return!r.__||Es(r)})}catch(r){n.__h=[function(){throw r}]}}),Du&&Du(e,t)},Ze.unmount=function(e){Fu&&Fu(e);var t,n,r=e.__c;r&&r.__H&&(r.__H.__.some(function(o){try{if(o.__P&&o.__c){if(n===void 0){for(n=e.__;n&&(!n.__c||!n.__c.__P);)n=n.__;n=n&&n.__c}o.__P=n,Uu(Is.push(o))}else Jr(o)}catch(a){t=a}}),r.__H=void 0,t&&Ze.__e(t,r.__v))};var Hu=typeof requestAnimationFrame=="function";function dh(e){var t,n=function(){clearTimeout(r),Hu&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Hu&&(t=requestAnimationFrame(n))}function Uu(e){e!=1&&Lu==Ze.requestAnimationFrame||((Lu=Ze.requestAnimationFrame)||dh)(uh)}function Jr(e){var t=at,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),at=t}function Es(e){var t=at;e.__c=e.__(),at=t}function As(e,t){return!e||e.length!=t.length||t.some(function(n,r){return!Rs(n,e[r])})}function ju(e,t){return typeof t=="function"?t(e):t}var ph=Symbol.for("preact-signals");function ha(){if(sn>1)sn--;else{var e,t=!1;for((function(){var o=ma;for(ma=void 0;o!==void 0;){var a=o.S;if(a.v===o.v)for(var i=a.t;i!==void 0;i=i.x)i.i===o.i&&(i.i=a.i);o=o.o}})();eo!==void 0;){var n=eo;for(eo=void 0,fa++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Wu(n))try{n.c()}catch(o){t||(e=o,t=!0)}n=r}}if(fa=0,sn--,t)throw e}}function Ut(e){if(sn>0)return e();Ms=++_h,sn++;try{return e()}finally{ha()}}var Zr,je=void 0;function to(e){var t=je,n=Zr;je=void 0,Zr=void 0;try{return e()}finally{je=t,Zr=n}}var eo=void 0,sn=0,fa=0,_h=0,Ms=0,ma=void 0,ga=0;function Vu(e){if(je!==void 0){var t=e.n;if(t===void 0||t.t!==je)return t={i:0,S:e,p:je.s,n:void 0,t:je,e:void 0,x:void 0,r:t},je.s!==void 0&&(je.s.n=t),je.s=t,e.n=t,32&je.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=je.s,t.n=void 0,je.s.n=t,je.s=t),t}}function dt(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}dt.prototype.brand=ph;dt.prototype.h=function(){return!0};dt.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 r;(r=t.W)==null||r.call(t)}))};dt.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&to(function(){var o;(o=t.Z)==null||o.call(t)}))}};dt.prototype.subscribe=function(e){var t=this;return Wt(function(){var n=t.value;to(function(){return e(n)})},{name:"sub"})};dt.prototype.valueOf=function(){return this.value};dt.prototype.toString=function(){return this.value+""};dt.prototype.toJSON=function(){return this.value};dt.prototype.peek=function(){var e=this;return to(function(){return e.value})};Object.defineProperty(dt.prototype,"value",{get:function(){var e=Vu(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(fa>100)throw new Error("Cycle detected");(function(n){sn!==0&&fa===0&&n.l!==Ms&&(n.l=Ms,ma={S:n,v:n.v,i:n.i,o:ma})})(this),this.v=e,this.i++,ga++,sn++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{ha()}}}});function se(e,t){return new dt(e,t)}function Wu(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 Gu(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 Ku(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function jn(e,t){dt.call(this,void 0,t),this.x=e,this.s=void 0,this.g=ga-1,this.f=4}jn.prototype=new dt;jn.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===ga))return!0;if(this.g=ga,this.f|=1,this.i>0&&!Wu(this))return this.f&=-2,!0;var e=je;try{Gu(this),je=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 je=e,Ku(this),this.f&=-2,!0};jn.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)}dt.prototype.S.call(this,e)};jn.prototype.U=function(e){if(this.t!==void 0&&(dt.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)}};jn.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(jn.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Vu(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function he(e,t){return new jn(e,t)}function Qu(e){var t=e.j;if(e.j=void 0,typeof t=="function"){sn++;var n=je;je=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,Ls(e),r}finally{je=n,ha()}}}function Ls(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Qu(e)}function fh(e){if(je!==this)throw new Error("Out-of-order effect");Ku(this),je=e,this.f&=-2;try{8&this.f&&Ls(this)}finally{ha()}}function hr(e,t){this.x=e,this.j=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Zr&&Zr.push(this)}hr.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.j=t)}finally{e()}};hr.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Qu(this),Gu(this),sn++;var e=je;return je=this,fh.bind(this,e)};hr.prototype.N=function(){2&this.f||(this.f|=2,this.u=eo,eo=this)};hr.prototype.d=function(){this.f|=8,1&this.f||Ls(this)};hr.prototype.dispose=function(){this.d()};function Wt(e,t){var n=new hr(e,t);try{n.c()}catch(o){throw n.d(),o}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var Xu,ro,va,mh=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var Ju=[];Wt(function(){Xu=this.N})();function vr(e,t){me[e]=t.bind(null,me[e]||function(){})}function no(e){if(va){var t=va;va=void 0,t()}va=e&&e.S()}function Yu(e){var t=this,n=e.data,r=Et(n);r.name="ReactiveDom",r.value=n;var o=le(function(){for(var s=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var p=he(function(){var f=r.value.value;return f===0?0:f===!0?"":f||""}),_=he(function(){return!Array.isArray(p.value)&&!vs(p.value)}),d=Wt(function(){if(this.N=Zu,_.value){var f=p.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=f)}}),u=t.__$u.d;return t.__$u.d=function(){d(),u.call(this)},[_,p]},[]),a=o[0],i=o[1];return a.value?i.peek():i.value}Yu.displayName="ReactiveTextNode";Object.defineProperties(dt.prototype,{constructor:{configurable:!0,value:kn(ue,null).constructor},type:{configurable:!0,value:Yu},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});vr("__b",function(e,t){if(no(),ro=void 0,typeof t.type=="string"){var n,r=t.props;for(var o in r)if(o!=="children"){var a=r[o];a instanceof dt&&(n||(t.__np=n={}),n[o]=a,r[o]=a.peek())}}e(t)});vr("__r",function(e,t){if(e(t),t.type!==ue){no();var n,r=t.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=(function(o,a){var i;return Wt(function(){i=this},{name:a}),i.c=o,i})((function(o){return function(){var a;mh&&((a=this.y)==null||a.call(this)),o.__$f|=1,o.setState({})}})(r),typeof t.type=="function"?t.type.displayName||t.type.name:""))),ro=r,no(n)}});vr("__e",function(e,t,n,r){no(),ro=void 0,e(t,n,r)});vr("diffed",function(e,t){no(),ro=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var r=t.__np,o=t.props,a=n.U;if(a)for(var i in a){var s=a[i];s===void 0||r&&i in r||(s.d(),a[i]=void 0)}if(r){a||(a={},n.U=a);for(var c in r){var p=a[c],_=r[c];p===void 0?(p=gh(n,c,_,o),a[c]=p):p.o(_,o)}}}e(t)});function gh(e,t,n,r){var o=t in e&&e.ownerSVGElement===void 0,a=se(n);return{o:function(i,s){a.value=i,r=s},d:Wt(function(){this.N=Zu;var i=a.value.value;r[t]!==i&&(r[t]=i,o?e[t]=i:i!=null&&(i!==!1||t[4]==="-")?e.setAttribute(t,i):e.removeAttribute(t))})}}vr("unmount",function(e,t){if(typeof t.type=="string"){var n=t.__e;if(n){var r=n.U;if(r){n.U=void 0;for(var o in r){var a=r[o];a&&a.d()}}}var i=t.__np;if(i){var s=t.props;for(var c in i)s[c]=i[c]}t.__np=void 0}else{var p=t.__c;if(p){p.__$f|=8;var _=p.__$u;_&&(p.__$u=void 0,_.d())}}e(t)});vr("__h",function(e,t,n,r){r<3&&(t.__$f|=2),e(t,n,r)});Ht.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,r=n&&n.s!==void 0;for(var o in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var a=2&this.__$f;if(!(r||a||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var i in e)if(i!=="__source"&&e[i]!==this.props[i])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function Et(e,t){return le(function(){return se(e,t)},[])}function At(e,t){var n=D(e);return n.current=e,ro.__$f|=4,le(function(){return he(function(){return n.current()},t)},[])}var hh=function(e){queueMicrotask(function(){queueMicrotask(e)})};function vh(){Ut(function(){for(var e;e=Ju.shift();)Xu.call(e)})}function Zu(){Ju.push(this)===1&&(me.requestAnimationFrame||hh)(vh)}var bh="x-public-key",yh="x-ai-agent-deployment-id";function ed(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");return{headers(){let t={[yh]:e.aiAgentDeploymentId};return e.publicKey&&(t[e.publicKeyHeader??bh]=e.publicKey),t}}}function ba(e,t){let n=[],r;for(let o of e){let a=new URLSearchParams(o);a.has(t)?r??(r=a.get(t)??""):n.push(o)}return{value:r,rest:n}}function td(e){let t=new URL(e),n=M.cssPrefix,r=`${M.cssPrefix}-ask`,o=t.search.slice(1).split("&").filter(Boolean),a=t.hash.slice(1).split("&").filter(Boolean),i=ba(o,n),s=ba(i.rest,r),c=ba(a,n),p=ba(c.rest,r),_=i.value??c.value,d=(s.value??p.value)?.trim()||void 0;if(!(_===void 0&&d===void 0))return t.search=s.rest.join("&"),t.hash=p.rest.join("&"),{target:_===void 0?void 0:ea(_),...d?{ask:d}:{},url:t.toString()}}var nd=Z.scope("feedback:audio"),ya=class{constructor(){te(this,"ctx",null);te(this,"master",null);te(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){nd.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,r=this.master;if(!n||!r||n.state!=="running")return;let o=n.currentTime,a=t.noteMs/1e3;t.notes.forEach((i,s)=>{let c=n.createOscillator();c.type=t.type,c.frequency.value=i;let p=n.createGain(),_=o+s*a;p.gain.setValueAtTime(1e-4,_),p.gain.exponentialRampToValueAtTime(t.peakGain,_+.005),p.gain.exponentialRampToValueAtTime(1e-4,_+a),c.connect(p).connect(r),c.start(_),c.stop(_+a+.01)})}async playUrl(t){let n=this.ctx,r=this.master;if(!n||!r||n.state!=="running")return;let o=await this.getBuffer(t);if(!o)return;let a=n.createBufferSource();a.buffer=o,a.connect(r),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 r=this.ctx,o=fetch(t).then(a=>a.ok?a.arrayBuffer():Promise.reject(new Error(`fetch ${a.status}`))).then(a=>r.decodeAudioData(a)).then(a=>(this.buffers.set(t,a),a)).catch(a=>(nd.warn("audio fetch/decode failed",{url:t,err:a}),this.buffers.delete(t),null));return this.buffers.set(t,o),o}};var rd={messageReceived:10,messageSent:0,error:[20,40,20],voiceStart:10,voiceStop:0},od={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 Cn=null,Pa=0;function Ph(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}function xh(){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=`__${M.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 ad(e){if(!(e===0||Array.isArray(e)&&e.every(t=>t===0))){if(Ph())try{navigator.vibrate(e);return}catch{}if(Cn??(Cn=xh()),!!Cn)try{Cn.label.click()}catch{}}}function id(){Pa++;let e=!1;return()=>{e||(e=!0,Pa=Math.max(0,Pa-1),Pa===0&&Cn&&(Cn.input.remove(),Cn.label.remove(),Cn=null))}}var Sh=Z.scope("feedback"),kh=100,xa=class{constructor(t,n){te(this,"mutedSig",se(!1));te(this,"audio",new ya);te(this,"releaseHaptics");te(this,"sound");te(this,"haptics");te(this,"lastPlayed",new Map);te(this,"reducedMotionMq",null);this.sound=t,this.haptics=n,this.releaseHaptics=id(),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<kh}playSound(t){let n=this.sound.events?.[t];if(n===!1)return;if(typeof n=="string"){this.audio.playUrl(n).catch(o=>Sh.warn("audio play failed",{err:o,url:n}));return}let r=od[t];r&&this.audio.playTone(r)}playHaptic(t){if(this.reducedMotionMq?.matches)return;let n=this.haptics.events?.[t];if(n===!1)return;let r=n===!0||n===void 0?rd[t]:n;ad(r)}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}};function sd(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function ld(e){return sd(e)}function cd(e){return!(!sd(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}var wh=Symbol.for("pv"),Ch=0;function l(e,t,n,r,o,a){t||(t={});var i,s,c=t;if("ref"in c&&typeof e!="function")for(s in c={},t)s=="ref"?i=t[s]:c[s]=t[s];var p={type:e,props:c,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:wh,__v:--Ch,__i:-1,__u:0};return(o||a)&&(p.__source=o,p.__self=a),me.vnode&&me.vnode(p),p}var $s=1,dd=2,oo=4,pd=8,_d=16;function Th(e){switch(e){case $s:return"href";case dd:return"src";case oo:return"class";case pd:return"checked";case _d:return"start"}}var Rh=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}},Ih=Rh;var ud=24;function br(e){let t=new Uint32Array(ud);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(ud),indent:"",indent_len:0,table_state:0}}function ao(e){e.pending.length>0&&et(e,`
8
+ `)}function Ce(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 Qe(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 Ae(e,t){(e.tokens[e.len]===24||e.tokens[e.len]===23)&&t!==25&&Qe(e),e.len+=1,e.tokens[e.len]=t,e.token=t,e.renderer.add_token(e.renderer.data,t)}function Eh(e,t,n){for(;n<=e.len;){if(e.tokens[n]===t)return n;n+=1}return-1}function Vn(e,t){for(e.fence_start=0;e.len>t;)Qe(e)}function Sa(e,t){let n=0;for(let r=0;r<=e.len&&(t-=e.spaces[r],!(t<0));r+=1)switch(e.tokens[r]){case 9:case 10:case 20:case 25:n=r;break}for(;e.len>n;)Qe(e);return t}function Ns(e,t){let n=-1,r=-1;for(let o=e.blockquote_idx+1;o<=e.len;o+=1)if(e.tokens[o]===25){if(e.indent_len<e.spaces[o]){r=-1;break}r=o}else e.tokens[o]===t&&(n=o);return r===-1?n===-1?(Vn(e,e.blockquote_idx),Ae(e,t),!0):(Vn(e,n),!1):(Vn(e,r),Ae(e,t),!0)}function Os(e,t){Ae(e,25),e.spaces[e.len]=e.indent_len+t,ln(e),e.token=103}function ln(e){e.indent="",e.indent_len=0,e.pending=""}function Ds(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 Ah(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 Mh(e){return Ds(e)||Ah(e)}function et(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 o=Sa(e,e.indent_len);e.indent_len=0,e.token=e.tokens[e.len],o>0&&et(e," ".repeat(o))}let r=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`
9
+ `:if(console.assert(e.pending.length===1),e.tokens[e.len]===25&&e.token===21){Qe(e),ln(e),e.pending=n;continue}Vn(e,e.blockquote_idx),ln(e),e.blockquote_idx=0,e.fence_start=0,e.pending=n;continue;case"#":switch(n){case"#":if(e.pending.length<6){e.pending=r;continue}break;case" ":Sa(e,e.indent_len),Ae(e,Ih(e.pending.length)),ln(e);continue}break;case">":{let a=Eh(e,20,e.blockquote_idx+1);a===-1?(Vn(e,e.blockquote_idx),e.blockquote_idx+=1,e.fence_start=0,Ae(e,20)):e.blockquote_idx=a,ln(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=r;continue;case" ":e.pending=r;continue;case`
10
+ `:if(e.hr_chars<3)break;Sa(e,e.indent_len),e.renderer.add_token(e.renderer.data,22),e.renderer.end_token(e.renderer.data),ln(e),e.hr_chars=0;continue}e.hr_chars=0}if(e.pending[0]!=="_"&&e.pending[1]===" "){Ns(e,23),Os(e,2),et(e,r.slice(2));continue}break;case"`":if(e.pending.length<3){if(n==="`"){e.pending=r,e.fence_start=r.length;continue}e.fence_start=0;break}switch(n){case"`":e.pending.length===e.fence_start?(e.pending=r,e.fence_start=r.length):(Ae(e,2),ln(e),e.fence_start=0,et(e,r));continue;case`
11
+ `:{Sa(e,e.indent_len),Ae(e,10),e.pending.length>e.fence_start&&e.renderer.set_attr(e.renderer.data,oo,e.pending.slice(e.fence_start)),ln(e),e.token=101;continue}default:e.pending=r;continue}case"+":if(n!==" ")break;Ns(e,23),Os(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;Ns(e,24)&&e.pending!=="1."&&e.renderer.set_attr(e.renderer.data,_d,e.pending.slice(0,-1)),Os(e,e.pending.length+1);continue}else{let a=n.charCodeAt(0);if(a===46||Ds(a)){e.pending=r;continue}}break;case"|":Vn(e,e.blockquote_idx),Ae(e,27),Ae(e,28),e.pending="",et(e,n);continue}let o=r;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}o=e.indent.slice(a)+r,Ae(e,9)}else Ae(e,2);ln(e),et(e,o);continue;case 27:if(e.table_state===1)switch(n){case"-":case" ":case"|":case":":e.pending=r;continue;case`
12
+ `:e.table_state=2,e.pending="";continue;default:Qe(e),e.table_state=0;break}else switch(e.pending){case"|":Ae(e,28),e.pending="",et(e,n);continue;case`
13
+ `:Qe(e),e.pending="",e.table_state=0,et(e,n);continue}break;case 28:switch(e.pending){case"":break;case"|":Ae(e,29),Qe(e),e.pending="",et(e,n);continue;case`
14
+ `:Qe(e),e.table_state=Math.min(e.table_state+1,2),e.pending="",et(e,n);continue;default:Ae(e,29),et(e,n);continue}break;case 29:if(e.pending==="|"){Ce(e),Qe(e),e.pending="",et(e,n);continue}break;case 9:switch(r){case`
15
15
  `:case`
16
16
  `:case`
17
17
  `:case`
@@ -21,44 +21,45 @@
21
21
  `:case`
22
22
  `:case`
23
23
  `:case`
24
- `:e.pending=r;continue;default:e.pending.length!==0?(ke(e),ze(e),e.pending=n):e.text+=n;continue}case 10:switch(n){case"`":e.pending=r;continue;case`
25
- `:if(r.length===e.fence_start+e.fence_end+1){ke(e),ze(e),e.pending="",e.fence_start=0,e.fence_end=0,e.token=101;continue}e.token=101;break;case" ":if(e.pending[0]===`
26
- `){e.pending=r,e.fence_end+=1;continue}break}e.text+=e.pending,e.pending=n,e.fence_end=1;continue;case 11:switch(n){case"`":r.length===e.fence_start+ +(e.pending[0]===" ")?(ke(e),ze(e),e.pending="",e.fence_start=0):e.pending=r;continue;case`
27
- `:e.text+=e.pending,e.pending="",e.token=21,e.blockquote_idx=0,ke(e);continue;case" ":e.text+=e.pending,e.pending=n;continue;default:e.text+=r,e.pending="";continue}case 103:switch(e.pending.length){case 0:if(n!=="[")break;e.pending=r;continue;case 1:if(n!==" "&&n!=="x")break;e.pending=r;continue;case 2:if(n!=="]")break;e.pending=r;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,id,""),e.renderer.end_token(e.renderer.data),e.pending=" ";continue}e.token=e.tokens[e.len],e.pending="",Xe(e,r);continue;case 14:case 15:{let a="*",i=12;if(e.token===15&&(a="_",i=13),a===e.pending){if(ke(e),a===n){ze(e),e.pending="";continue}Ce(e,i),e.pending=n;continue}break}case 12:case 13:{let a="*",i=14;switch(e.token===13&&(a="_",i=15),e.pending){case a:a===n?e.tokens[e.len-1]===i?e.pending=r:(ke(e),Ce(e,i),e.pending=""):(ke(e),ze(e),e.pending=n);continue;case a+a:let s=e.token;ke(e),ze(e),ze(e),a!==n?(Ce(e,s),e.pending=n):e.pending="";continue}break}case 16:if(r==="~~"){ke(e),ze(e),e.pending="";continue}break;case 105:n===`
28
- `?(ke(e),Ce(e,30),e.pending=""):(e.token=e.tokens[e.len],e.pending[0]==="\\"?e.text+="[":e.text+="$$",e.pending="",Xe(e,n));continue;case 30:if(r==="\\]"||r==="$$"){ke(e),ze(e),e.pending="";continue}break;case 31:if(r==="\\)"||e.pending[0]==="$"){ke(e),ze(e),n===")"?e.pending="":e.pending=n;continue}break;case 102:r==="http://"||r==="https://"?(ke(e),Ce(e,18),e.pending=r,e.text=r):"http:/"[e.pending.length]===n||"https:/"[e.pending.length]===n?e.pending=r:(e.token=e.tokens[e.len],Xe(e,n));continue;case 17:case 19:if(e.pending==="]"){ke(e),n==="("?e.pending=r:(ze(e),e.pending=n);continue}if(e.pending[0]==="]"&&e.pending[1]==="("){if(n===")"){let a=e.token===17?Ms:ad,i=e.pending.slice(2);e.renderer.set_attr(e.renderer.data,a,i),ze(e),e.pending=""}else e.pending+=n;continue}break;case 18:n===" "||n===`
29
- `||n==="\\"?(e.renderer.set_attr(e.renderer.data,Ms,e.pending),ke(e),ze(e),e.pending=n):(e.text+=n,e.pending=r);continue;case 104:if(r.startsWith("<br")){if(r.length===3||n===" "||n==="/"&&(r.length===4||e.pending[e.pending.length-1]===" ")){e.pending=r;continue}if(n===">"){ke(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),Xe(e,n);continue}switch(e.pending[0]){case"\\":if(e.token===19||e.token===30||e.token===31)break;switch(n){case"(":ke(e),Ce(e,31),e.pending="";continue;case"[":e.token=105,e.pending=r;continue;case`
30
- `:e.pending=n;continue;default:let o=n.charCodeAt(0);e.pending="",e.text+=Ls(o)||o>=65&&o<=90||o>=97&&o<=122?r:n;continue}case`
31
- `:switch(e.token){case 19:case 30:case 31:break;case 3:case 4:case 5:case 6:case 7:case 8:ke(e),zn(e,e.blockquote_idx),e.blockquote_idx=0,e.pending=n;continue;default:ke(e),e.pending=n,e.token=21,e.blockquote_idx=0;continue}break;case"<":if(e.token!==19&&e.token!==30&&e.token!==31){ke(e),e.pending=r,e.token=104;continue}break;case"`":if(e.token===19)break;n==="`"?(e.fence_start+=1,e.pending=r):(e.fence_start+=1,ke(e),Ce(e,11),e.text=n===" "||n===`
24
+ `:e.pending=r;continue;default:e.pending.length!==0?(Ce(e),Qe(e),e.pending=n):e.text+=n;continue}case 10:switch(n){case"`":e.pending=r;continue;case`
25
+ `:if(r.length===e.fence_start+e.fence_end+1){Ce(e),Qe(e),e.pending="",e.fence_start=0,e.fence_end=0,e.token=101;continue}e.token=101;break;case" ":if(e.pending[0]===`
26
+ `){e.pending=r,e.fence_end+=1;continue}break}e.text+=e.pending,e.pending=n,e.fence_end=1;continue;case 11:switch(n){case"`":r.length===e.fence_start+ +(e.pending[0]===" ")?(Ce(e),Qe(e),e.pending="",e.fence_start=0):e.pending=r;continue;case`
27
+ `:e.text+=e.pending,e.pending="",e.token=21,e.blockquote_idx=0,Ce(e);continue;case" ":e.text+=e.pending,e.pending=n;continue;default:e.text+=r,e.pending="";continue}case 103:switch(e.pending.length){case 0:if(n!=="[")break;e.pending=r;continue;case 1:if(n!==" "&&n!=="x")break;e.pending=r;continue;case 2:if(n!=="]")break;e.pending=r;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,pd,""),e.renderer.end_token(e.renderer.data),e.pending=" ";continue}e.token=e.tokens[e.len],e.pending="",et(e,r);continue;case 14:case 15:{let a="*",i=12;if(e.token===15&&(a="_",i=13),a===e.pending){if(Ce(e),a===n){Qe(e),e.pending="";continue}Ae(e,i),e.pending=n;continue}break}case 12:case 13:{let a="*",i=14;switch(e.token===13&&(a="_",i=15),e.pending){case a:a===n?e.tokens[e.len-1]===i?e.pending=r:(Ce(e),Ae(e,i),e.pending=""):(Ce(e),Qe(e),e.pending=n);continue;case a+a:let s=e.token;Ce(e),Qe(e),Qe(e),a!==n?(Ae(e,s),e.pending=n):e.pending="";continue}break}case 16:if(r==="~~"){Ce(e),Qe(e),e.pending="";continue}break;case 105:n===`
28
+ `?(Ce(e),Ae(e,30),e.pending=""):(e.token=e.tokens[e.len],e.pending[0]==="\\"?e.text+="[":e.text+="$$",e.pending="",et(e,n));continue;case 30:if(r==="\\]"||r==="$$"){Ce(e),Qe(e),e.pending="";continue}break;case 31:if(r==="\\)"||e.pending[0]==="$"){Ce(e),Qe(e),n===")"?e.pending="":e.pending=n;continue}break;case 102:r==="http://"||r==="https://"?(Ce(e),Ae(e,18),e.pending=r,e.text=r):"http:/"[e.pending.length]===n||"https:/"[e.pending.length]===n?e.pending=r:(e.token=e.tokens[e.len],et(e,n));continue;case 17:case 19:if(e.pending==="]"){Ce(e),n==="("?e.pending=r:(Qe(e),e.pending=n);continue}if(e.pending[0]==="]"&&e.pending[1]==="("){if(n===")"){let a=e.token===17?$s:dd,i=e.pending.slice(2);e.renderer.set_attr(e.renderer.data,a,i),Qe(e),e.pending=""}else e.pending+=n;continue}break;case 18:n===" "||n===`
29
+ `||n==="\\"?(e.renderer.set_attr(e.renderer.data,$s,e.pending),Ce(e),Qe(e),e.pending=n):(e.text+=n,e.pending=r);continue;case 104:if(r.startsWith("<br")){if(r.length===3||n===" "||n==="/"&&(r.length===4||e.pending[e.pending.length-1]===" ")){e.pending=r;continue}if(n===">"){Ce(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),et(e,n);continue}switch(e.pending[0]){case"\\":if(e.token===19||e.token===30||e.token===31)break;switch(n){case"(":Ce(e),Ae(e,31),e.pending="";continue;case"[":e.token=105,e.pending=r;continue;case`
30
+ `:e.pending=n;continue;default:let o=n.charCodeAt(0);e.pending="",e.text+=Ds(o)||o>=65&&o<=90||o>=97&&o<=122?r:n;continue}case`
31
+ `:switch(e.token){case 19:case 30:case 31:break;case 3:case 4:case 5:case 6:case 7:case 8:Ce(e),Vn(e,e.blockquote_idx),e.blockquote_idx=0,e.pending=n;continue;default:Ce(e),e.pending=n,e.token=21,e.blockquote_idx=0;continue}break;case"<":if(e.token!==19&&e.token!==30&&e.token!==31){Ce(e),e.pending=r,e.token=104;continue}break;case"`":if(e.token===19)break;n==="`"?(e.fence_start+=1,e.pending=r):(e.fence_start+=1,Ce(e),Ae(e,11),e.text=n===" "||n===`
32
32
  `?"":n,e.pending="");continue;case"_":case"*":{if(e.token===19||e.token===30||e.token===31||e.token===14)break;let o=12,a=14,i=e.pending[0];if(i==="_"&&(o=13,a=15),e.pending.length===1){if(i===n){e.pending=r;continue}if(n!==" "&&n!==`
33
- `){ke(e),Ce(e,o),e.pending=n;continue}}else{if(i===n){ke(e),Ce(e,a),Ce(e,o),e.pending="";continue}if(n!==" "&&n!==`
34
- `){ke(e),Ce(e,a),e.pending=n;continue}}break}case"~":if(e.token!==19&&e.token!==16){if(e.pending==="~"){if(n==="~"){e.pending=r;continue}}else if(n!==" "&&n!==`
35
- `){ke(e),Ce(e,16),e.pending=n;continue}}break;case"$":if(e.token!==19&&e.token!==16&&e.pending==="$")if(n==="$"){e.token=105,e.pending=r;continue}else{if(xh(n.charCodeAt(0)))break;ke(e),Ce(e,31),e.pending=n;continue}break;case"[":if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n!=="]"){ke(e),Ce(e,17),e.pending=n;continue}break;case"!":if(e.token!==19&&n==="["){ke(e),Ce(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}ke(e)}function io(e){return{add_token:Sh,end_token:Ns,add_text:Os,set_attr:$s,data:{nodes:[e,,,,,],index:0}}}function Sh(e,t){let n=e.nodes[e.index],r;switch(t){case 1:return;case 20:r=document.createElement("blockquote");break;case 2:r=document.createElement("p");break;case 21:r=document.createElement("br");break;case 22:r=document.createElement("hr");break;case 3:r=document.createElement("h1");break;case 4:r=document.createElement("h2");break;case 5:r=document.createElement("h3");break;case 6:r=document.createElement("h4");break;case 7:r=document.createElement("h5");break;case 8:r=document.createElement("h6");break;case 12:case 13:r=document.createElement("em");break;case 14:case 15:r=document.createElement("strong");break;case 16:r=document.createElement("s");break;case 11:r=document.createElement("code");break;case 18:case 17:r=document.createElement("a");break;case 19:r=document.createElement("img");break;case 23:r=document.createElement("ul");break;case 24:r=document.createElement("ol");break;case 25:r=document.createElement("li");break;case 26:let o=r=document.createElement("input");o.type="checkbox",o.disabled=!0;break;case 9:case 10:n=n.appendChild(document.createElement("pre")),r=document.createElement("code");break;case 27:r=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]}r=document.createElement("tr");break;case 29:r=document.createElement(n.parentElement?.tagName==="THEAD"?"th":"td");break;case 30:r=document.createElement("equation-block");break;case 31:r=document.createElement("equation-inline");break}e.nodes[++e.index]=n.appendChild(r)}function Ns(e){e.index-=1}function Os(e,t){e.nodes[e.index].appendChild(document.createTextNode(t))}function $s(e,t,n){e.nodes[e.index].setAttribute(hh(t),n)}var vr={root:"Root",schema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{Root:{$ref:"#/$defs/Root"},Grid:{$ref:"#/$defs/Grid"},Cell:{$ref:"#/$defs/Cell"},Text:{$ref:"#/$defs/Text"},Card:{$ref:"#/$defs/Card"},Metric:{$ref:"#/$defs/Metric"},Table:{$ref:"#/$defs/Table"},Chart:{$ref:"#/$defs/Chart"}},required:["Root","Grid","Cell","Text","Card","Metric","Table","Chart"],additionalProperties:!1,$defs:{Root:{type:"object",properties:{children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Grid"},{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}}},required:["children"],additionalProperties:!1},Grid:{type:"object",properties:{columns:{type:"integer",enum:[1,2,3,4],default:1},children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Cell"},{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}}},required:["columns","children"],additionalProperties:!1},Cell:{type:"object",properties:{children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}},span:{type:"integer",enum:[1,2,3,4],default:1}},required:["children"],additionalProperties:!1},Text:{type:"object",properties:{text:{type:"string"}},required:["text"],additionalProperties:!1},Card:{type:"object",properties:{title:{type:"string"},body:{type:"string"}},required:["title","body"],additionalProperties:!1},Metric:{type:"object",properties:{label:{type:"string"},value:{type:"string"},detail:{type:"string"}},required:["label","value","detail"],additionalProperties:!1},Table:{type:"object",properties:{title:{type:"string"},columns:{type:"array",items:{type:"string"}},rows:{type:"array",items:{type:"array",items:{type:"string"}}}},required:["title","columns","rows"],additionalProperties:!1},Chart:{type:"object",properties:{title:{type:"string"},type:{type:"string",enum:["bar","line"]},data:{type:"array",items:{type:"object",properties:{label:{type:"string"},value:{type:"number"}},required:["label","value"],additionalProperties:!1}}},required:["title","type","data"],additionalProperties:!1}}}};var cd=so;var kh={type:"object",properties:{typeName:{const:"Grid"},statementId:{type:"string"},props:{type:"object",properties:{columns:{type:"integer",enum:[1,2,3,4],default:1},children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Cell"},{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}}},required:["columns","children"],additionalProperties:!1}},required:["typeName","statementId","props"]},wh={type:"object",properties:{typeName:{const:"Cell"},statementId:{type:"string"},props:{type:"object",properties:{children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}},span:{type:"integer",enum:[1,2,3,4],default:1}},required:["children"],additionalProperties:!1}},required:["typeName","statementId","props"]};function rt(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=rt.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let _;if(e.typeName===void 0&&(_="typeName")||e.statementId===void 0&&(_="statementId")||e.props===void 0&&(_="props"))return rt.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:_}}],!1;if(e.typeName!==void 0){let d=s;if(e.typeName!=="Text")return rt.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Text"}}],!1;var p=d===s}else var p=!0;if(p){if(e.statementId!==void 0){let d=s;if(typeof e.statementId!="string")return rt.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=d===s}else var p=!0;if(p)if(e.props!==void 0){let d=e.props,u=s;if(s===u)if(d&&typeof d=="object"&&!Array.isArray(d)){let m;if(d.text===void 0&&(m="text"))return rt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:m}}],!1;{let v=s;for(let x in d)if(x!=="text"){return rt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:x}}],!1;break}if(v===s&&d.text!==void 0&&typeof d.text!="string")return rt.errors=[{instancePath:t+"/props/text",schemaPath:"#/properties/props/properties/text/type",keyword:"type",params:{type:"string"}}],!1}}else return rt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=u===s}else var p=!0}}else return rt.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return rt.errors=i,s===0}rt.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function Je(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Je.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let d;if(e.typeName===void 0&&(d="typeName")||e.statementId===void 0&&(d="statementId")||e.props===void 0&&(d="props"))return Je.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:d}}],!1;if(e.typeName!==void 0){let u=s;if(e.typeName!=="Card")return Je.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Card"}}],!1;var p=u===s}else var p=!0;if(p){if(e.statementId!==void 0){let u=s;if(typeof e.statementId!="string")return Je.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=u===s}else var p=!0;if(p)if(e.props!==void 0){let u=e.props,f=s;if(s===f)if(u&&typeof u=="object"&&!Array.isArray(u)){let v;if(u.title===void 0&&(v="title")||u.body===void 0&&(v="body"))return Je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:v}}],!1;{let x=s;for(let P in u)if(!(P==="title"||P==="body")){return Je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:P}}],!1;break}if(x===s){if(u.title!==void 0){let P=s;if(typeof u.title!="string")return Je.errors=[{instancePath:t+"/props/title",schemaPath:"#/properties/props/properties/title/type",keyword:"type",params:{type:"string"}}],!1;var _=P===s}else var _=!0;if(_)if(u.body!==void 0){let P=s;if(typeof u.body!="string")return Je.errors=[{instancePath:t+"/props/body",schemaPath:"#/properties/props/properties/body/type",keyword:"type",params:{type:"string"}}],!1;var _=P===s}else var _=!0}}}else return Je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=f===s}else var p=!0}}else return Je.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return Je.errors=i,s===0}Je.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function je(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=je.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let d;if(e.typeName===void 0&&(d="typeName")||e.statementId===void 0&&(d="statementId")||e.props===void 0&&(d="props"))return je.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:d}}],!1;if(e.typeName!==void 0){let u=s;if(e.typeName!=="Metric")return je.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Metric"}}],!1;var p=u===s}else var p=!0;if(p){if(e.statementId!==void 0){let u=s;if(typeof e.statementId!="string")return je.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=u===s}else var p=!0;if(p)if(e.props!==void 0){let u=e.props,f=s;if(s===f)if(u&&typeof u=="object"&&!Array.isArray(u)){let v;if(u.label===void 0&&(v="label")||u.value===void 0&&(v="value")||u.detail===void 0&&(v="detail"))return je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:v}}],!1;{let x=s;for(let P in u)if(!(P==="label"||P==="value"||P==="detail")){return je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:P}}],!1;break}if(x===s){if(u.label!==void 0){let P=s;if(typeof u.label!="string")return je.errors=[{instancePath:t+"/props/label",schemaPath:"#/properties/props/properties/label/type",keyword:"type",params:{type:"string"}}],!1;var _=P===s}else var _=!0;if(_){if(u.value!==void 0){let P=s;if(typeof u.value!="string")return je.errors=[{instancePath:t+"/props/value",schemaPath:"#/properties/props/properties/value/type",keyword:"type",params:{type:"string"}}],!1;var _=P===s}else var _=!0;if(_)if(u.detail!==void 0){let P=s;if(typeof u.detail!="string")return je.errors=[{instancePath:t+"/props/detail",schemaPath:"#/properties/props/properties/detail/type",keyword:"type",params:{type:"string"}}],!1;var _=P===s}else var _=!0}}}}else return je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=f===s}else var p=!0}}else return je.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return je.errors=i,s===0}je.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function Le(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Le.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let m;if(e.typeName===void 0&&(m="typeName")||e.statementId===void 0&&(m="statementId")||e.props===void 0&&(m="props"))return Le.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:m}}],!1;if(e.typeName!==void 0){let v=s;if(e.typeName!=="Table")return Le.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Table"}}],!1;var p=v===s}else var p=!0;if(p){if(e.statementId!==void 0){let v=s;if(typeof e.statementId!="string")return Le.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=v===s}else var p=!0;if(p)if(e.props!==void 0){let v=e.props,x=s;if(s===x)if(v&&typeof v=="object"&&!Array.isArray(v)){let b;if(v.title===void 0&&(b="title")||v.columns===void 0&&(b="columns")||v.rows===void 0&&(b="rows"))return Le.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:b}}],!1;{let C=s;for(let h in v)if(!(h==="title"||h==="columns"||h==="rows")){return Le.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:h}}],!1;break}if(C===s){if(v.title!==void 0){let h=s;if(typeof v.title!="string")return Le.errors=[{instancePath:t+"/props/title",schemaPath:"#/properties/props/properties/title/type",keyword:"type",params:{type:"string"}}],!1;var _=h===s}else var _=!0;if(_){if(v.columns!==void 0){let h=v.columns,g=s;if(s===g)if(Array.isArray(h)){var d=!0;let w=h.length;for(let T=0;T<w;T++){let A=s;if(typeof h[T]!="string")return Le.errors=[{instancePath:t+"/props/columns/"+T,schemaPath:"#/properties/props/properties/columns/items/type",keyword:"type",params:{type:"string"}}],!1;var d=A===s;if(!d)break}}else return Le.errors=[{instancePath:t+"/props/columns",schemaPath:"#/properties/props/properties/columns/type",keyword:"type",params:{type:"array"}}],!1;var _=g===s}else var _=!0;if(_)if(v.rows!==void 0){let h=v.rows,g=s;if(s===g)if(Array.isArray(h)){var u=!0;let w=h.length;for(let T=0;T<w;T++){let A=h[T],M=s;if(s===M)if(Array.isArray(A)){var f=!0;let O=A.length;for(let z=0;z<O;z++){let V=s;if(typeof A[z]!="string")return Le.errors=[{instancePath:t+"/props/rows/"+T+"/"+z,schemaPath:"#/properties/props/properties/rows/items/items/type",keyword:"type",params:{type:"string"}}],!1;var f=V===s;if(!f)break}}else return Le.errors=[{instancePath:t+"/props/rows/"+T,schemaPath:"#/properties/props/properties/rows/items/type",keyword:"type",params:{type:"array"}}],!1;var u=M===s;if(!u)break}}else return Le.errors=[{instancePath:t+"/props/rows",schemaPath:"#/properties/props/properties/rows/type",keyword:"type",params:{type:"array"}}],!1;var _=g===s}else var _=!0}}}}else return Le.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=x===s}else var p=!0}}else return Le.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return Le.errors=i,s===0}Le.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};var Ch={type:"object",properties:{typeName:{const:"Chart"},statementId:{type:"string"},props:{type:"object",properties:{title:{type:"string"},type:{type:"string",enum:["bar","line"]},data:{type:"array",items:{type:"object",properties:{label:{type:"string"},value:{type:"number"}},required:["label","value"],additionalProperties:!1}}},required:["title","type","data"],additionalProperties:!1}},required:["typeName","statementId","props"]};function Re(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Re.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let f;if(e.typeName===void 0&&(f="typeName")||e.statementId===void 0&&(f="statementId")||e.props===void 0&&(f="props"))return Re.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:f}}],!1;if(e.typeName!==void 0){let m=s;if(e.typeName!=="Chart")return Re.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Chart"}}],!1;var p=m===s}else var p=!0;if(p){if(e.statementId!==void 0){let m=s;if(typeof e.statementId!="string")return Re.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=m===s}else var p=!0;if(p)if(e.props!==void 0){let m=e.props,v=s;if(s===v)if(m&&typeof m=="object"&&!Array.isArray(m)){let P;if(m.title===void 0&&(P="title")||m.type===void 0&&(P="type")||m.data===void 0&&(P="data"))return Re.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:P}}],!1;{let b=s;for(let C in m)if(!(C==="title"||C==="type"||C==="data")){return Re.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:C}}],!1;break}if(b===s){if(m.title!==void 0){let C=s;if(typeof m.title!="string")return Re.errors=[{instancePath:t+"/props/title",schemaPath:"#/properties/props/properties/title/type",keyword:"type",params:{type:"string"}}],!1;var _=C===s}else var _=!0;if(_){if(m.type!==void 0){let C=m.type,h=s;if(typeof C!="string")return Re.errors=[{instancePath:t+"/props/type",schemaPath:"#/properties/props/properties/type/type",keyword:"type",params:{type:"string"}}],!1;if(!(C==="bar"||C==="line"))return Re.errors=[{instancePath:t+"/props/type",schemaPath:"#/properties/props/properties/type/enum",keyword:"enum",params:{allowedValues:Ch.properties.props.properties.type.enum}}],!1;var _=h===s}else var _=!0;if(_)if(m.data!==void 0){let C=m.data,h=s;if(s===h)if(Array.isArray(C)){var d=!0;let k=C.length;for(let w=0;w<k;w++){let T=C[w],A=s;if(s===A)if(T&&typeof T=="object"&&!Array.isArray(T)){let N;if(T.label===void 0&&(N="label")||T.value===void 0&&(N="value"))return Re.errors=[{instancePath:t+"/props/data/"+w,schemaPath:"#/properties/props/properties/data/items/required",keyword:"required",params:{missingProperty:N}}],!1;{let O=s;for(let z in T)if(!(z==="label"||z==="value")){return Re.errors=[{instancePath:t+"/props/data/"+w,schemaPath:"#/properties/props/properties/data/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:z}}],!1;break}if(O===s){if(T.label!==void 0){let z=s;if(typeof T.label!="string")return Re.errors=[{instancePath:t+"/props/data/"+w+"/label",schemaPath:"#/properties/props/properties/data/items/properties/label/type",keyword:"type",params:{type:"string"}}],!1;var u=z===s}else var u=!0;if(u)if(T.value!==void 0){let z=T.value,V=s;if(!(typeof z=="number"&&isFinite(z)))return Re.errors=[{instancePath:t+"/props/data/"+w+"/value",schemaPath:"#/properties/props/properties/data/items/properties/value/type",keyword:"type",params:{type:"number"}}],!1;var u=V===s}else var u=!0}}}else return Re.errors=[{instancePath:t+"/props/data/"+w,schemaPath:"#/properties/props/properties/data/items/type",keyword:"type",params:{type:"object"}}],!1;var d=A===s;if(!d)break}}else return Re.errors=[{instancePath:t+"/props/data",schemaPath:"#/properties/props/properties/data/type",keyword:"type",params:{type:"array"}}],!1;var _=h===s}else var _=!0}}}}else return Re.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=v===s}else var p=!0}}else return Re.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return Re.errors=i,s===0}Re.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function nt(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=nt.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let m;if(e.typeName===void 0&&(m="typeName")||e.statementId===void 0&&(m="statementId")||e.props===void 0&&(m="props"))return nt.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:m}}],!1;if(e.typeName!==void 0){let v=s;if(e.typeName!=="Cell")return nt.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Cell"}}],!1;var p=v===s}else var p=!0;if(p){if(e.statementId!==void 0){let v=s;if(typeof e.statementId!="string")return nt.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=v===s}else var p=!0;if(p)if(e.props!==void 0){let v=e.props,x=s;if(s===x)if(v&&typeof v=="object"&&!Array.isArray(v)){let b;if(v.children===void 0&&(b="children"))return nt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:b}}],!1;{let C=s;for(let h in v)if(!(h==="children"||h==="span")){return nt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:h}}],!1;break}if(C===s){if(v.children!==void 0){let h=v.children,g=s;if(s===g)if(Array.isArray(h)){var _=!0;let k=h.length;for(let w=0;w<k;w++){let T=h[w],A=s,M=s,N=!1,O=s;rt(T,{instancePath:t+"/props/children/"+w,parentData:h,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?rt.errors:i.concat(rt.errors),s=i.length);var u=O===s;if(N=N||u,u){var d={};d.typeName=!0,d.statementId=!0,d.props=!0}let z=s;Je(T,{instancePath:t+"/props/children/"+w,parentData:h,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?Je.errors:i.concat(Je.errors),s=i.length);var u=z===s;N=N||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0);let V=s;je(T,{instancePath:t+"/props/children/"+w,parentData:h,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?je.errors:i.concat(je.errors),s=i.length);var u=V===s;N=N||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0);let K=s;Le(T,{instancePath:t+"/props/children/"+w,parentData:h,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?Le.errors:i.concat(Le.errors),s=i.length);var u=K===s;N=N||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0);let ne=s;Re(T,{instancePath:t+"/props/children/"+w,parentData:h,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?Re.errors:i.concat(Re.errors),s=i.length);var u=ne===s;if(N=N||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0),N)s=M,i!==null&&(M?i.length=M:i=null);else{let Y={instancePath:t+"/props/children/"+w,schemaPath:"#/properties/props/properties/children/items/anyOf",keyword:"anyOf",params:{}};return i===null?i=[Y]:i.push(Y),s++,nt.errors=i,!1}var _=A===s;if(!_)break}}else return nt.errors=[{instancePath:t+"/props/children",schemaPath:"#/properties/props/properties/children/type",keyword:"type",params:{type:"array"}}],!1;var f=g===s}else var f=!0;if(f)if(v.span!==void 0){let h=v.span,g=s;if(!(typeof h=="number"&&!(h%1)&&!isNaN(h)&&isFinite(h)))return nt.errors=[{instancePath:t+"/props/span",schemaPath:"#/properties/props/properties/span/type",keyword:"type",params:{type:"integer"}}],!1;if(!(h===1||h===2||h===3||h===4))return nt.errors=[{instancePath:t+"/props/span",schemaPath:"#/properties/props/properties/span/enum",keyword:"enum",params:{allowedValues:wh.properties.props.properties.span.enum}}],!1;var f=g===s}else var f=!0}}}else return nt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=x===s}else var p=!0}}else return nt.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return nt.errors=i,s===0}nt.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function gt(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=gt.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let m;if(e.typeName===void 0&&(m="typeName")||e.statementId===void 0&&(m="statementId")||e.props===void 0&&(m="props"))return gt.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:m}}],!1;if(e.typeName!==void 0){let v=s;if(e.typeName!=="Grid")return gt.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Grid"}}],!1;var p=v===s}else var p=!0;if(p){if(e.statementId!==void 0){let v=s;if(typeof e.statementId!="string")return gt.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=v===s}else var p=!0;if(p)if(e.props!==void 0){let v=e.props,x=s;if(s===x)if(v&&typeof v=="object"&&!Array.isArray(v)){let b;if(v.columns===void 0&&(b="columns")||v.children===void 0&&(b="children"))return gt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:b}}],!1;{let C=s;for(let h in v)if(!(h==="columns"||h==="children")){return gt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:h}}],!1;break}if(C===s){if(v.columns!==void 0){let h=v.columns,g=s;if(!(typeof h=="number"&&!(h%1)&&!isNaN(h)&&isFinite(h)))return gt.errors=[{instancePath:t+"/props/columns",schemaPath:"#/properties/props/properties/columns/type",keyword:"type",params:{type:"integer"}}],!1;if(!(h===1||h===2||h===3||h===4))return gt.errors=[{instancePath:t+"/props/columns",schemaPath:"#/properties/props/properties/columns/enum",keyword:"enum",params:{allowedValues:kh.properties.props.properties.columns.enum}}],!1;var _=g===s}else var _=!0;if(_)if(v.children!==void 0){let h=v.children,g=s;if(s===g)if(Array.isArray(h)){var d=!0;let w=h.length;for(let T=0;T<w;T++){let A=h[T],M=s,N=s,O=!1,z=s;nt(A,{instancePath:t+"/props/children/"+T,parentData:h,parentDataProperty:T,rootData:o,dynamicAnchors:a})||(i=i===null?nt.errors:i.concat(nt.errors),s=i.length);var f=z===s;if(O=O||f,f){var u={};u.typeName=!0,u.statementId=!0,u.props=!0}let V=s;rt(A,{instancePath:t+"/props/children/"+T,parentData:h,parentDataProperty:T,rootData:o,dynamicAnchors:a})||(i=i===null?rt.errors:i.concat(rt.errors),s=i.length);var f=V===s;O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let K=s;Je(A,{instancePath:t+"/props/children/"+T,parentData:h,parentDataProperty:T,rootData:o,dynamicAnchors:a})||(i=i===null?Je.errors:i.concat(Je.errors),s=i.length);var f=K===s;O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let ne=s;je(A,{instancePath:t+"/props/children/"+T,parentData:h,parentDataProperty:T,rootData:o,dynamicAnchors:a})||(i=i===null?je.errors:i.concat(je.errors),s=i.length);var f=ne===s;O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let G=s;Le(A,{instancePath:t+"/props/children/"+T,parentData:h,parentDataProperty:T,rootData:o,dynamicAnchors:a})||(i=i===null?Le.errors:i.concat(Le.errors),s=i.length);var f=G===s;O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let Y=s;Re(A,{instancePath:t+"/props/children/"+T,parentData:h,parentDataProperty:T,rootData:o,dynamicAnchors:a})||(i=i===null?Re.errors:i.concat(Re.errors),s=i.length);var f=Y===s;if(O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0),O)s=N,i!==null&&(N?i.length=N:i=null);else{let _e={instancePath:t+"/props/children/"+T,schemaPath:"#/properties/props/properties/children/items/anyOf",keyword:"anyOf",params:{}};return i===null?i=[_e]:i.push(_e),s++,gt.errors=i,!1}var d=M===s;if(!d)break}}else return gt.errors=[{instancePath:t+"/props/children",schemaPath:"#/properties/props/properties/children/type",keyword:"type",params:{type:"array"}}],!1;var _=g===s}else var _=!0}}}else return gt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=x===s}else var p=!0}}else return gt.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return gt.errors=i,s===0}gt.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function so(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=so.evaluated;c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0);let p=s,_=!1,d=s;gt(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?gt.errors:i.concat(gt.errors),s=i.length);var C=d===s;if(_=_||C,C){var u={};u.typeName=!0,u.statementId=!0,u.props=!0}let f=s;nt(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?nt.errors:i.concat(nt.errors),s=i.length);var C=f===s;_=_||C,C&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let m=s;rt(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?rt.errors:i.concat(rt.errors),s=i.length);var C=m===s;_=_||C,C&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let v=s;Je(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?Je.errors:i.concat(Je.errors),s=i.length);var C=v===s;_=_||C,C&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let x=s;je(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?je.errors:i.concat(je.errors),s=i.length);var C=x===s;_=_||C,C&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let P=s;Le(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?Le.errors:i.concat(Le.errors),s=i.length);var C=P===s;_=_||C,C&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let b=s;Re(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?Re.errors:i.concat(Re.errors),s=i.length);var C=b===s;if(_=_||C,C&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0),_)s=p,i!==null&&(p?i.length=p:i=null);else{let h={instancePath:t,schemaPath:"#/anyOf",keyword:"anyOf",params:{}};return i===null?i=[h]:i.push(h),s++,so.errors=i,!1}return so.errors=i,c.props=u,s===0}so.evaluated={dynamicProps:!0,dynamicItems:!1};function ud(e){switch(e.k){case"StateRef":case"RuntimeRef":case"BinOp":case"UnaryOp":case"Ternary":case"Member":case"Index":case"Assign":return!0;default:return!1}}var Th=new Set(["Comp","Ref","StateRef","RuntimeRef","BinOp","UnaryOp","Ternary","Member","Index","Assign","Str","Num","Bool","Null","Arr","Obj","Ph"]);function jn(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Th.has(e.k)}function lo(e,t){let n=r=>{switch(t(r),r.k){case"Comp":r.args.forEach(n),Object.values(r.mappedProps??{}).forEach(n);break;case"Arr":r.els.forEach(n);break;case"Obj":r.entries.forEach(([,o])=>n(o));break;case"BinOp":n(r.left),n(r.right);break;case"UnaryOp":n(r.operand);break;case"Ternary":n(r.cond),n(r.then),n(r.else);break;case"Member":n(r.obj);break;case"Index":n(r.obj),n(r.index);break;case"Assign":n(r.value);break}};n(e)}function Pa(e){return e==null?{k:"Null"}:typeof e=="string"?{k:"Str",v:e}:typeof e=="number"?{k:"Num",v:e}:typeof e=="boolean"?{k:"Bool",v:e}:Array.isArray(e)?{k:"Arr",els:e.map(Pa)}:typeof e=="object"?{k:"Obj",entries:Object.entries(e).map(([t,n])=>[t,Pa(n)])}:{k:"Null"}}function xa(e){switch(e.k){case"Str":case"Num":case"Bool":return{v:e.v};case"Null":return{v:null};case"Arr":{let t=[];for(let n of e.els){let r=xa(n);if(!r)return;t.push(r.v)}return{v:t}}case"Obj":{let t={};for(let[n,r]of e.entries){let o=xa(r);if(!o)return;t[n]=o.v}return{v:t}}default:return}}var Sa=new Map([["Count",{kind:"function",params:[{name:"array",required:!1}],builtin:!0}],["First",{kind:"function",params:[{name:"array",required:!1}],builtin:!0}],["Last",{kind:"function",params:[{name:"array",required:!1}],builtin:!0}],["Sum",{kind:"function",params:[{name:"numbers",required:!1}],builtin:!0}],["Avg",{kind:"function",params:[{name:"numbers",required:!1}],builtin:!0}],["Min",{kind:"function",params:[{name:"numbers",required:!1}],builtin:!0}],["Max",{kind:"function",params:[{name:"numbers",required:!1}],builtin:!0}],["Sort",{kind:"function",params:[{name:"array",required:!1},{name:"field",required:!1},{name:"direction",required:!1}],builtin:!0}],["Filter",{kind:"function",params:[{name:"array",required:!1},{name:"field",required:!1},{name:"operator",required:!1},{name:"value",required:!1}],builtin:!0}],["Round",{kind:"function",params:[{name:"number",required:!1},{name:"decimals",required:!1}],builtin:!0}],["Abs",{kind:"function",params:[{name:"number",required:!1}],builtin:!0}],["Floor",{kind:"function",params:[{name:"number",required:!1}],builtin:!0}],["Ceil",{kind:"function",params:[{name:"number",required:!1}],builtin:!0}],["Each",{kind:"function",params:[{name:"array",required:!1},{name:"varName",required:!1},{name:"template",required:!1}],builtin:!0,lazy:!0}],["Run",{kind:"action",params:[{name:"ref",required:!1}],builtin:!0,lazy:!0}],["ToAssistant",{kind:"action",params:[{name:"message",required:!1},{name:"context",required:!1}],builtin:!0}],["OpenUrl",{kind:"action",params:[{name:"url",required:!1}],builtin:!0}],["Set",{kind:"action",params:[{name:"variable",required:!1},{name:"value",required:!1}],builtin:!0,lazy:!0}],["Reset",{kind:"action",params:[{name:"variable",required:!1}],builtin:!0,lazy:!0}],["Action",{kind:"action",params:[{name:"steps",required:!0}],builtin:!0,lazy:!0}]]),dd={ActionExpression:!0,OpenUrl:!0,ToAssistant:!0},Cn={Query:"Query",Mutation:"Mutation"};function co(e){return e?.callDefs??Sa}function uo(e){return Sa.has(e)}function yr(e){return e in Cn}var I;(function(e){e[e.Newline=0]="Newline",e[e.LParen=1]="LParen",e[e.RParen=2]="RParen",e[e.LBrack=3]="LBrack",e[e.RBrack=4]="RBrack",e[e.LBrace=5]="LBrace",e[e.RBrace=6]="RBrace",e[e.Comma=7]="Comma",e[e.Colon=8]="Colon",e[e.Equals=9]="Equals",e[e.True=10]="True",e[e.False=11]="False",e[e.Null=12]="Null",e[e.EOF=13]="EOF",e[e.Str=14]="Str",e[e.Num=15]="Num",e[e.Ident=16]="Ident",e[e.Type=17]="Type",e[e.StateVar=18]="StateVar",e[e.Dot=19]="Dot",e[e.Plus=20]="Plus",e[e.Minus=21]="Minus",e[e.Star=22]="Star",e[e.Slash=23]="Slash",e[e.Percent=24]="Percent",e[e.EqEq=25]="EqEq",e[e.NotEq=26]="NotEq",e[e.Greater=27]="Greater",e[e.Less=28]="Less",e[e.GreaterEq=29]="GreaterEq",e[e.LessEq=30]="LessEq",e[e.And=31]="And",e[e.Or=32]="Or",e[e.Not=33]="Not",e[e.Question=34]="Question",e[e.BuiltinCall=35]="BuiltinCall"})(I||(I={}));var Ih=1,pd=2,_d=3,Ds=4,po=5,Fs=6,ka=7,fd=8,Rh=9;function wa(e){let t=0,n=()=>e[t]??{t:I.EOF},r=()=>{let u=n();return t++,u},o=u=>{n().t===u&&t++};function a(u){switch(u.t){case I.Question:return Ih;case I.Or:return pd;case I.And:return _d;case I.EqEq:case I.NotEq:return Ds;case I.Greater:case I.Less:case I.GreaterEq:case I.LessEq:return po;case I.Plus:case I.Minus:return Fs;case I.Star:case I.Slash:case I.Percent:return ka;case I.Dot:case I.LBrack:return Rh;default:return 0}}function i(u=0){let f=s();for(;a(n())>u;)f=c(f);return f}function s(){let u=n();if(u.t===I.Str)return r(),{k:"Str",v:u.v};if(u.t===I.Num)return r(),{k:"Num",v:u.v};if(u.t===I.True)return r(),{k:"Bool",v:!0};if(u.t===I.False)return r(),{k:"Bool",v:!1};if(u.t===I.Null)return r(),{k:"Null"};if(u.t===I.LBrack)return _();if(u.t===I.LBrace)return d();if(u.t===I.StateVar){let f=u.v;if(r(),n().t===I.Equals){r();let m=i(0);return{k:"Assign",target:f,value:m}}return{k:"StateRef",n:f}}if(u.t===I.Type){let f=u.v;return e[t+1]?.t===I.LParen&&(!uo(f)||f==="Action")?p():(r(),{k:"Ref",n:f})}if(u.t===I.BuiltinCall){if(e[t+1]?.t===I.LParen){let f=p();return f.k==="Comp"&&!uo(f.name)&&(f.fn=!0),f}return r(),{k:"Ref",n:u.v}}if(u.t===I.Ident)return r(),{k:"Ref",n:u.v};if(u.t===I.Not)return r(),{k:"UnaryOp",op:"!",operand:i(fd)};if(u.t===I.Minus)return r(),{k:"UnaryOp",op:"-",operand:i(fd)};if(u.t===I.LParen){r();let f=i(0);return o(I.RParen),f}return r(),{k:"Null"}}function c(u){let f=n();if(f.t===I.Plus)return r(),{k:"BinOp",op:"+",left:u,right:i(Fs)};if(f.t===I.Minus)return r(),{k:"BinOp",op:"-",left:u,right:i(Fs)};if(f.t===I.Star)return r(),{k:"BinOp",op:"*",left:u,right:i(ka)};if(f.t===I.Slash)return r(),{k:"BinOp",op:"/",left:u,right:i(ka)};if(f.t===I.Percent)return r(),{k:"BinOp",op:"%",left:u,right:i(ka)};if(f.t===I.EqEq)return r(),{k:"BinOp",op:"==",left:u,right:i(Ds)};if(f.t===I.NotEq)return r(),{k:"BinOp",op:"!=",left:u,right:i(Ds)};if(f.t===I.Greater)return r(),{k:"BinOp",op:">",left:u,right:i(po)};if(f.t===I.Less)return r(),{k:"BinOp",op:"<",left:u,right:i(po)};if(f.t===I.GreaterEq)return r(),{k:"BinOp",op:">=",left:u,right:i(po)};if(f.t===I.LessEq)return r(),{k:"BinOp",op:"<=",left:u,right:i(po)};if(f.t===I.And)return r(),{k:"BinOp",op:"&&",left:u,right:i(_d)};if(f.t===I.Or)return r(),{k:"BinOp",op:"||",left:u,right:i(pd)};if(f.t===I.Question){r();let m=i(0);o(I.Colon);let v=i(0);return{k:"Ternary",cond:u,then:m,else:v}}if(f.t===I.Dot){r();let m=n(),v=m.t===I.Ident||m.t===I.Type||m.t===I.Str||m.t===I.Num?(r(),String(m.v)):m.t===I.StateVar?(r(),m.v.replace(/^\$/,"")):(r(),"?");return{k:"Member",obj:u,field:v}}if(f.t===I.LBrack){r();let m=i(0);return o(I.RBrack),{k:"Index",obj:u,index:m}}return u}function p(){let u=n().v;r(),o(I.LParen);let f=[];for(;n().t!==I.RParen&&n().t!==I.EOF;)f.push(i(0)),n().t===I.Comma&&r();return o(I.RParen),{k:"Comp",name:u,args:f}}function _(){r();let u=[];for(;n().t!==I.RBrack&&n().t!==I.EOF;)u.push(i(0)),n().t===I.Comma&&r();return o(I.RBrack),{k:"Arr",els:u}}function d(){r();let u=[];for(;n().t!==I.RBrace&&n().t!==I.EOF;){let f=n(),m=f.t===I.Ident||f.t===I.Str||f.t===I.Type||f.t===I.Num?(r(),String(f.v)):f.t===I.StateVar?(r(),f.v.replace(/^\$/,"")):(r(),"?");o(I.Colon),u.push([m,i(0)]),n().t===I.Comma&&r()}return o(I.RBrace),{k:"Obj",entries:u}}return i(0)}function Ca(e){let t=[],n=0,r=e.length;for(;n<r;){for(;n<r&&(e[n]===" "||e[n]===" "||e[n]==="\r");)n++;if(n>=r)break;let o=e[n];if(o===`
36
- `){t.push({t:I.Newline}),n++;continue}if(o==="("){t.push({t:I.LParen}),n++;continue}if(o===")"){t.push({t:I.RParen}),n++;continue}if(o==="["){t.push({t:I.LBrack}),n++;continue}if(o==="]"){t.push({t:I.RBrack}),n++;continue}if(o==="{"){t.push({t:I.LBrace}),n++;continue}if(o==="}"){t.push({t:I.RBrace}),n++;continue}if(o===","){t.push({t:I.Comma}),n++;continue}if(o===":"){t.push({t:I.Colon}),n++;continue}if(o==="="){n+1<r&&e[n+1]==="="?(t.push({t:I.EqEq}),n+=2):(t.push({t:I.Equals}),n++);continue}if(o==="!"){n+1<r&&e[n+1]==="="?(t.push({t:I.NotEq}),n+=2):(t.push({t:I.Not}),n++);continue}if(o===">"){n+1<r&&e[n+1]==="="?(t.push({t:I.GreaterEq}),n+=2):(t.push({t:I.Greater}),n++);continue}if(o==="<"){n+1<r&&e[n+1]==="="?(t.push({t:I.LessEq}),n+=2):(t.push({t:I.Less}),n++);continue}if(o==="&"){n+1<r&&e[n+1]==="&"?(t.push({t:I.And}),n+=2):(t.push({t:I.And}),n++);continue}if(o==="|"){n+1<r&&e[n+1]==="|"?(t.push({t:I.Or}),n+=2):(t.push({t:I.Or}),n++);continue}if(o==="."){t.push({t:I.Dot}),n++;continue}if(o==="?"){t.push({t:I.Question}),n++;continue}if(o==="+"){t.push({t:I.Plus}),n++;continue}if(o==="*"){t.push({t:I.Star}),n++;continue}if(o==="/"){t.push({t:I.Slash}),n++;continue}if(o==="%"){t.push({t:I.Percent}),n++;continue}if(o==='"'){let c=n;n++;let p=!1;for(;n<r;)if(e[n]==="\\")n+=2;else if(e[n]==='"'){n++,p=!0;break}else n++;let _=e.slice(c,n);try{let d=p?_:_+'"';t.push({t:I.Str,v:JSON.parse(d)})}catch{let d=_.replace(/^"|"$/g,"");t.push({t:I.Str,v:d})}continue}if(o==="'"){n++;let c="",p=!1;for(;n<r;)if(e[n]==="\\"){if(n++,n<r){let _=e[n];_==="'"?c+="'":_==="\\"?c+="\\":_==="n"?c+=`
37
- `:_==="t"?c+=" ":c+=_,n++}}else if(e[n]==="'"){n++,p=!0;break}else c+=e[n],n++;t.push({t:I.Str,v:c});continue}if(o==="-"){let c=t.length>0?t[t.length-1]:null;if(!(!(c!=null&&(c.t===I.Num||c.t===I.Str||c.t===I.Ident||c.t===I.Type||c.t===I.RParen||c.t===I.RBrack||c.t===I.True||c.t===I.False||c.t===I.Null||c.t===I.StateVar||c.t===I.BuiltinCall))&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9")){t.push({t:I.Minus}),n++;continue}}let a=o>="0"&&o<="9",i=o==="-"&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9";if(a||i){let c=n;for(e[n]==="-"&&n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;if(n<r&&e[n]==="."&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9")for(n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;if(n<r&&(e[n]==="e"||e[n]==="E"))for(n++,n<r&&(e[n]==="+"||e[n]==="-")&&n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;t.push({t:I.Num,v:+e.slice(c,n)});continue}if(o==="$"&&n+1<r&&(e[n+1]>="a"&&e[n+1]<="z"||e[n+1]>="A"&&e[n+1]<="Z"||e[n+1]==="_")){let c=n;for(n++;n<r&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;t.push({t:I.StateVar,v:e.slice(c,n)});continue}if(o>="a"&&o<="z"||o>="A"&&o<="Z"||o==="_"){let c=n;for(;n<r&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;let p=e.slice(c,n);if(p==="true"){t.push({t:I.True});continue}if(p==="false"){t.push({t:I.False});continue}if(p==="null"){t.push({t:I.Null});continue}let _=o>="A"&&o<="Z"?I.Type:I.Ident;t.push({t:_,v:p});continue}if(o==="@"&&n+1<r&&(e[n+1]>="a"&&e[n+1]<="z"||e[n+1]>="A"&&e[n+1]<="Z"||e[n+1]==="_")){n++;let c=n;for(;n<r&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;t.push({t:I.BuiltinCall,v:e.slice(c,n)});continue}n++}return t.push({t:I.EOF}),t}function Xt(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return t.type==="element"&&typeof t.typeName=="string"&&typeof t.props=="object"&&t.props!==null&&typeof t.partial=="boolean"}var md;(function(e){e.ContinueConversation="continue_conversation",e.OpenUrl="open_url"})(md||(md={}));var Eh={},Ah=[];function Ta(e){return Array.isArray(e)?"array":typeof e}function gd(e){return typeof e.$ref=="string"?e.$ref.split("/").pop():void 0}function hd(e){return"$ref"in e||"anyOf"in e||"oneOf"in e||"allOf"in e}function vd(e){if(Array.isArray(e.enum))return{enumValues:e.enum};if("const"in e)return{enumValues:[e.const]};switch(e.type){case"string":return{expectedType:"string"};case"number":case"integer":return{expectedType:"number"};case"boolean":return{expectedType:"boolean"};default:return{}}}function Ia(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e.default}function Bs(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e,n=gd(t);if(n)return n;let r=vd(t);return r.enumValues?r.enumValues.map(o=>JSON.stringify(o)).join("|"):r.expectedType?r.expectedType:typeof t.type=="string"?t.type:void 0}function Us(e,t){let n=t.map(r=>{let o=Bs(r.schema),a=r.required?`${r.name}*`:r.name;return o?`${a}: ${o}`:a}).join(", ");return`${e}(${n})`}function Mh(e,t){let n=typeof e;return t.enumValues?t.enumValues.includes(e)?null:{expected:`one of [${t.enumValues.map(r=>JSON.stringify(r)).join(", ")}]`,actual:Ta(e)}:t.expectedType&&t.expectedType!==n?{expected:t.expectedType,actual:Ta(e)}:null}function Lh(e,t,n){switch(n.code){case"type-mismatch":return`field "${t}" expects ${n.expected} but got ${n.actual}`;case"pruned-value":return`field "${t}" lost an unresolved or invalid value`;case"missing-required":return`missing required field "${t}"${n.signature?` \u2014 signature: ${n.signature}`:""}`;case"null-required":return`required field "${t}" cannot be null${n.signature?` \u2014 signature: ${n.signature}`:""}`;case"unknown-component":return`Unknown component "${e}" \u2014 not found in catalog or builtins${n.available?.length?`. Available components: ${n.available.join(", ")}`:""}`;case"inline-reserved":return`${e}() must be declared as a top-level statement, not used inline as a value`;case"excess-args":return`${e} takes ${n.declared} arg(s), got ${n.got} (${n.got-n.declared} excess dropped)`;case"unknown-function":return`Unknown function "@${e}": not a built-in or action step. The call evaluates to null`;case"no-root":return n.reason==="not-component"?"root does not evaluate to a component":n.reason==="fallback"?`No root statement. Rendering the first statement that calls the root component ${e}`:e?`No root statement, and no statement calls the root component ${e}`:"No root statement"}}function Be(e,t,n,r){e.errors.push({code:r.code,component:t,path:n,message:Lh(t,n,r),statementId:e.currentStatementId,...r.code==="no-root"&&r.reason==="fallback"&&{severity:"warning"}})}var Pt=Symbol("invalid");function Ra(e,t){return t!==void 0?t:e?Pt:void 0}function Nh(e,t,n,r,o){return hd(t)?!1:typeof t.type=="string"||Array.isArray(t.enum)||"const"in t?(Be(o,n,r,{code:"type-mismatch",expected:typeof t.type=="string"?t.type:"a literal value",actual:`component "${e.typeName}"`}),!0):!1}function yd(e){return(e.anyOf??e.oneOf??[e]).map(gd)}function Oh(e,t){let n=yd(e);return n.length>0&&n.every(r=>r!==void 0&&t.cat?.has(r))}function $h(e,t,n,r,o){if(typeof e!="object"||Array.isArray(e))return Be(o,n,r,{code:"type-mismatch",expected:"object",actual:Ta(e)}),Pt;let a=e,i,s=t.properties&&typeof t.properties=="object"?t.properties:Eh,c=Array.isArray(t.required)?t.required:Ah,p=!1;if(!o.partial)for(let _ of c){let d=_ in a;if(!d||a[_]==null){let u=Ia(s[_]);if(u!==void 0){(i??(i={...a}))[_]=u;continue}Be(o,n,`${r}/${_}`,{code:d?"null-required":"missing-required"}),p=!0}}for(let _ of Object.keys(s)){if(!(_ in a))continue;let d=s[_],u=_o(a[_],d,n,`${r}/${_}`,o);if(u===Pt&&(u=Ra(c.includes(_),Ia(d)),u===Pt)){p=!0;continue}u!==a[_]&&(i??(i={...a}),u===void 0?delete i[_]:i[_]=u)}return p?Pt:i??a}function Dh(e,t,n,r,o){if(!Array.isArray(e))return Be(o,n,r,{code:"type-mismatch",expected:"array",actual:Ta(e)}),Pt;let a=t.items;if(!a||typeof a!="object"||Array.isArray(a))return e;let i;for(let s=0;s<e.length;s++){let c=_o(e[s],a,n,`${r}/${s}`,o);c!==e[s]&&!i&&(i=e.slice(0,s)),i&&c!==Pt&&i.push(c)}return i??e}function Fh(e,t,n,r,o){let a=vd(t);if(a.expectedType==null&&a.enumValues==null||a.enumValues&&o.partial)return!1;let i=Mh(e,a);return i?(Be(o,n,r,{code:"type-mismatch",...i}),!0):!1}function _o(e,t,n,r,o){if(!t||typeof t!="object"||Array.isArray(t))return e;let a=t;if(e==null||jn(e))return e;if(Xt(e))return Nh(e,a,n,r,o)?Pt:e;if(hd(a))return Oh(a,o)?(Be(o,n,r,{code:"type-mismatch",expected:yd(a).join(" | "),actual:Array.isArray(e)?"array":typeof e=="object"?"plain object":typeof e}),Pt):e;let i=a.type;return i==="object"?$h(e,a,n,r,o):i==="array"?Dh(e,a,n,r,o):Fh(e,a,n,r,o)?Pt:e}function Ea(e){if(e==null||typeof e!="object")return!1;if(jn(e))return!0;if(Array.isArray(e))return e.some(Ea);if(Xt(e))return Object.values(e.props).some(Ea);let t=e;return Array.isArray(t.steps)?!0:Object.values(t).some(Ea)}function bd(e,t,n){if(t.visited.has(e))return t.unres.push(e),n==="expr"?{k:"Ph",n:e}:null;if(!t.syms.has(e))return t.unres.push(e),n==="expr"?{k:"Ph",n:e}:null;let r=t.syms.get(e);if(t.unreached?.delete(e),r.k==="Comp"&&yr(r.name)){let a=r.name===Cn.Mutation?"mutation":"query";return{k:"RuntimeRef",n:e,refType:a}}t.visited.add(e);let o=t.currentStatementId;t.currentStatementId=e;try{let a=n==="value"?Vn(r,t):Hs(r,t);return n==="value"&&Xt(a)&&(a.statementId=e),a}finally{t.currentStatementId=o,t.visited.delete(e)}}function Aa(e,t){return co(t.cat).has(e)||yr(e)}function qs(e,t){let n={};for(let r=0;r<t.length&&r<e.length;r++)n[t[r].name]=e[r];return n}function Pd(e,t,n,r){let{params:o}=n;t.length>o.length&&Be(r,e,"",{code:"excess-args",declared:o.length,got:t.length});let a=qs(t,o),i=!1,s=r.errors.length;for(let c of o){let p=a[c.name],_=p?xa(p):{v:void 0};if(!_)continue;if(_.v==null){if(!c.required||c.defaultValue!==void 0)continue;Be(r,e,`/${c.name}`,{code:p?"null-required":"missing-required",signature:Us(e,o)}),i=!0;continue}let d=_o(_.v,c.schema,e,`/${c.name}`,r);d===Pt&&(d=Ra(c.required,c.defaultValue)),d===Pt?i=!0:d===void 0?delete a[c.name]:d!==_.v&&(a[c.name]=Pa(d))}return n.kind==="action"&&r.errors.length>s&&(i=!0),i?null:a}function xd(e,t,n){let r=e.args.map(n),o=co(t.cat).get(e.name);if(!o||o.lazy)return{...e,args:r};let a=o.builtin?qs(r,o.params):Pd(e.name,r,o,t);return a?{...e,args:r,mappedProps:a}:o.kind==="action"?{k:"Comp",name:"Action",args:[{k:"Arr",els:[]}]}:{k:"Null"}}function zs(e,t,n){let r=t.currentStatementId;t.currentStatementId=n;let o=new Set;for(let a of e)lo(a,i=>{if(i.k!=="Comp"||o.has(i))return;o.add(i);let s=co(t.cat).get(i.name);if(!s||s.lazy)return;let c=s.builtin?null:Pd(i.name,i.args,s,t);i.mappedProps=c??qs(i.args,s.params)});t.currentStatementId=r}function Sd(e,t,n){let r=co(t.cat).get(e.name);if(r?.kind!=="function"||!r.lazy||e.args.length<3)return null;let o=e.args[1],a=o.k==="Ref"?o.n:o.k==="Str"?o.v:null;if(!a)return null;let i=new Set(n);i.add(a);let s=e.args.map((c,p)=>p===1?c:xt(c,t,i));return{...e,args:s}}function xt(e,t,n){switch(e.k){case"Ref":return n.has(e.n)?e:bd(e.n,t,"expr");case"Ph":return e;case"Comp":{if(e.fn&&!Aa(e.name,t))return Be(t,e.name,"",{code:"unknown-function"}),{k:"Null"};let r=Sd(e,t,n);if(r)return r;if(Aa(e.name,t))return xd(e,t,i=>xt(i,t,n));let o=e.args.map(i=>xt(i,t,n)),a=t.cat?.get(e.name);if(a){let i={};for(let s=0;s<a.params.length&&s<o.length;s++)i[a.params[s].name]=o[s];return{...e,args:o,mappedProps:i}}return Be(t,e.name,"",{code:"unknown-component",available:t.cat&&[...t.cat.keys()]}),{...e,args:o}}case"Arr":return{...e,els:e.els.map(r=>xt(r,t,n))};case"Obj":return{...e,entries:e.entries.map(([r,o])=>[r,xt(o,t,n)])};case"BinOp":return{...e,left:xt(e.left,t,n),right:xt(e.right,t,n)};case"UnaryOp":return{...e,operand:xt(e.operand,t,n)};case"Ternary":return{...e,cond:xt(e.cond,t,n),then:xt(e.then,t,n),else:xt(e.else,t,n)};case"Member":return{...e,obj:xt(e.obj,t,n)};case"Index":return{...e,obj:xt(e.obj,t,n),index:xt(e.index,t,n)};case"Assign":return{...e,value:xt(e.value,t,n)};default:return e}}function Hs(e,t){return xt(e,t,new Set)}function Vn(e,t){switch(e.k){case"Ref":return bd(e.n,t,"value");case"Str":return e.v;case"Num":return e.v;case"Bool":return e.v;case"Null":return null;case"Ph":return null;case"Arr":{let n=[];for(let r of e.els){if(r.k==="Ph"){t.prunedValues++;continue}let o=Vn(r,t);if(o===null&&(r.k==="Comp"||r.k==="Ref")){t.prunedValues++;continue}n.push(o)}return n}case"Obj":{let n={};for(let[r,o]of e.entries)n[r]=Vn(o,t);return n}case"Comp":{let{name:n,args:r}=e;if(e.fn&&!Aa(n,t))return Be(t,n,"",{code:"unknown-function"}),null;if(yr(n))return Be(t,n,"",{code:"inline-reserved"}),null;if(Aa(n,t)){let s=Sd(e,t,new Set);return s||xd(e,t,c=>Hs(c,t))}let o=t.cat?.get(n),a={};if(o){let s=!1;for(let p=0;p<o.params.length&&p<r.length;p++){let _=o.params[p],d=t.prunedValues,u=Vn(r[p],t);if(t.prunedValues>d&&Be(t,n,`/${_.name}`,{code:"pruned-value"}),a[_.name]=u,_.schema===void 0)continue;if(u==null&&_.defaultValue!==void 0){Be(t,n,`/${_.name}`,{code:"type-mismatch",expected:Bs(_.schema)??"a defined value",actual:u===null?"null":"undefined"}),a[_.name]=_.defaultValue,t.prunedValues=d;continue}let f=_o(u,_.schema,n,`/${_.name}`,t);f===Pt&&(f=Ra(_.required,_.defaultValue),_.defaultValue!==void 0&&(t.prunedValues=d),f===Pt?s=!0:f===void 0&&delete a[_.name]),f!==Pt&&f!==void 0&&(a[_.name]=f)}r.length>o.params.length&&Be(t,n,"",{code:"excess-args",declared:o.params.length,got:r.length});let c=o.params.filter(p=>p.required&&(!(p.name in a)||a[p.name]===null));if(c.length){let p=c.filter(_=>_.defaultValue!==void 0?(Be(t,n,`/${_.name}`,{code:_.name in a?"null-required":"missing-required"}),a[_.name]=_.defaultValue,!1):!0);if(p.length){for(let _ of p)Be(t,n,`/${_.name}`,{code:_.name in a?"null-required":"missing-required",signature:Us(n,o.params)});return null}}if(s)return null}else return Be(t,n,"",{code:"unknown-component",available:t.cat&&[...t.cat.keys()]}),null;let i=Object.values(a).some(s=>Ea(s));return{type:"element",typeName:n,props:a,partial:t.partial,hasDynamicProps:i}}default:return ud(e)?Hs(e,t):e}}function js(e){let t=[],n=!1,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(r){r=!1;continue}if(s==="\\"&&n){r=!0;continue}if(n){s===n&&(n=!1);continue}if(s==='"'||s==="'"){n=s;continue}s==="("||s==="["||s==="{"?t.push(s):(s===")"&&t[t.length-1]==="("||s==="]"&&t[t.length-1]==="["||s==="}"&&t[t.length-1]==="{")&&t.pop()}if(!(!!n||t.length>0))return{text:e,wasIncomplete:!1};let a=e;n&&(r&&(a+="\\"),a+=n);for(let i=t.length-1;i>=0;i--)a+=t[i]==="("?")":t[i]==="["?"]":"}";return{text:a,wasIncomplete:!0}}function Ma(e){let t=[],n=0;for(;n<e.length;){for(;n<e.length&&e[n].t===I.Newline;)n++;if(n>=e.length||e[n].t===I.EOF)break;let r=e[n];if(r.t!==I.Ident&&r.t!==I.Type&&r.t!==I.StateVar){for(;n<e.length&&e[n].t!==I.Newline&&e[n].t!==I.EOF;)n++;continue}let o=r.v,a=r.t;if(n++,n>=e.length||e[n].t!==I.Equals){for(;n<e.length&&e[n].t!==I.Newline&&e[n].t!==I.EOF;)n++;continue}n++;let i=[],s=0,c=0;for(;n<e.length&&e[n].t!==I.EOF;){let p=e[n].t;if(p===I.Newline&&s<=0&&c<=0){let _=n+1;for(;_<e.length&&e[_].t===I.Newline;)_++;let d=_<e.length?e[_].t:I.EOF;if(d===I.Question||d===I.Colon&&c>0){n++;continue}break}if(p===I.Newline){n++;continue}p===I.LParen||p===I.LBrack||p===I.LBrace?s++:(p===I.RParen||p===I.RBrack||p===I.RBrace)&&s>0?s--:p===I.Question&&s===0?c++:p===I.Colon&&s===0&&c>0&&c--,i.push(e[n++])}i.length&&t.push({id:o,idTokenType:a,tokens:i})}return t}function Na(e=!0){return{root:null,meta:{incomplete:e,unresolved:[],orphaned:[],statementCount:0,errors:[]},stateDeclarations:{},queryStatements:[],mutationStatements:[]}}function Cd(e){if(!jn(e))return[];let t=new Set;return lo(e,n=>{n.k==="StateRef"&&t.add(n.n)}),[...t]}function Ws(e,t){if(t.k==="Comp"&&t.name===Cn.Query){let n=Cd(t.args[1]);return{kind:"query",id:e.id,call:{callee:Cn.Query,args:t.args},expr:t,deps:n.length>0?n:void 0}}return t.k==="Comp"&&t.name===Cn.Mutation?{kind:"mutation",id:e.id,call:{callee:Cn.Mutation,args:t.args},expr:t}:e.idTokenType===I.StateVar?{kind:"state",id:e.id,init:t}:{kind:"value",id:e.id,expr:t}}function Bh(e,t,n){let r={},o=[],a=[];for(let i of e)switch(i.kind){case"state":r[i.id]=Vn(i.init,t);break;case"query":zs(i.call.args,t,i.id),o.push({statementId:i.id,toolAST:i.call.args[0]??null,argsAST:i.call.args[1]??null,defaultsAST:i.call.args[2]??null,refreshAST:i.call.args[3]??null,deps:i.deps,complete:!0});break;case"mutation":zs(i.call.args,t,i.id),a.push({statementId:i.id,toolAST:i.call.args[0]??null,argsAST:i.call.args[1]??null});break}for(let i of e){let s=i.kind==="state"?[i.init]:i.kind==="value"?[i.expr]:i.kind==="query"||i.kind==="mutation"?i.call.args:[];for(let c of s)for(let p of Cd(c))p===n?.name&&n.stmts.has(i)||p in r||(r[p]=null)}return{stateDeclarations:r,queryStatements:o,mutationStatements:a}}var kd="root";function Ks(e){return e?.k==="Comp"&&!e.fn&&!uo(e.name)&&!yr(e.name)}function Uh(e,t){if(e.has(kd))return{id:kd,fallback:!1};for(let n of e.values())if(n.kind==="value"&&Ks(n.expr)&&n.expr.name===t)return{id:n.id,fallback:!0};return null}function Hh(e,t){let n=new Set;for(;e?.k==="Ref"&&!n.has(e.n);)n.add(e.n),e=t.get(e.n);return Ks(e)}function qh(e){let t=!1;return lo(e,n=>{Ks(n)&&(t=!0)}),t}function La(e,t,n,r,o,a,i){let s=Uh(e,a),c=new Map;for(let[h,g]of e)c.set(h,g.kind==="state"?g.init:g.expr);let p=[],_=[],d=new Set;for(let[h,g]of e)h!==s?.id&&(g.kind==="state"||g.kind==="query"||g.kind==="mutation"||d.add(h));let u={syms:c,cat:o,errors:_,unres:p,prunedValues:0,visited:new Set,partial:n,currentStatementId:s?.id,unreached:d},f=null,m;if(s){let h=Vn(c.get(s.id),u);Xt(h)?(f=h,f.statementId=s.id):jn(h)&&qh(h)&&(m=h)}let{stateDeclarations:v,queryStatements:x,mutationStatements:P}=Bh(t,u,i);u.currentStatementId=s?.id;let b=a??"";s?!f&&!m&&!Hh(c.get(s.id),c)?Be(u,b,"",{code:"no-root",reason:"not-component"}):s.fallback&&Be(u,b,"",{code:"no-root",reason:f?"fallback":"missing"}):Be(u,b,"",{code:"no-root",reason:"missing"});let C=s?[...d]:[];return{root:f,...m?{rootExpression:m}:{},meta:{incomplete:n,unresolved:p,orphaned:C,statementCount:r,errors:_},stateDeclarations:v,queryStatements:x,mutationStatements:P}}function wd(e,t){if(e[t]!=='"')return t;let n=t+1;for(;n<e.length;){let r=e[n];if(r==="\\")n+=2;else{if(r==='"')return n+1;n++}}return n}function zh(e){let t=[],n=0;for(;n<e.length;){let r=-1;for(;n<e.length;){let s=wd(e,n);if(s>n){n=s;continue}if(e[n]==="`"&&n+1<e.length&&e[n+1]==="`"&&n+2<e.length&&e[n+2]==="`"){r=n;break}n++}if(r===-1)break;let o=r+3;for(;o<e.length&&e[o]!==`
38
- `;)o++;if(o>=e.length){t.push(e.slice(r+3).replace(/^[^\n]*\n?/,"")),n=e.length;break}o++;let a=-1,i=o;for(;i<e.length;){let s=wd(e,i);if(s>i){i=s;continue}if(e[i]==="`"&&i+1<e.length&&e[i+1]==="`"&&i+2<e.length&&e[i+2]==="`"){a=i;break}i++}a!==-1?(t.push(e.slice(o,a)),n=a+3):(t.push(e.slice(o)),n=e.length)}if(t.length>0)return t.join(`
33
+ `){Ce(e),Ae(e,o),e.pending=n;continue}}else{if(i===n){Ce(e),Ae(e,a),Ae(e,o),e.pending="";continue}if(n!==" "&&n!==`
34
+ `){Ce(e),Ae(e,a),e.pending=n;continue}}break}case"~":if(e.token!==19&&e.token!==16){if(e.pending==="~"){if(n==="~"){e.pending=r;continue}}else if(n!==" "&&n!==`
35
+ `){Ce(e),Ae(e,16),e.pending=n;continue}}break;case"$":if(e.token!==19&&e.token!==16&&e.pending==="$")if(n==="$"){e.token=105,e.pending=r;continue}else{if(Mh(n.charCodeAt(0)))break;Ce(e),Ae(e,31),e.pending=n;continue}break;case"[":if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n!=="]"){Ce(e),Ae(e,17),e.pending=n;continue}break;case"!":if(e.token!==19&&n==="["){Ce(e),Ae(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}Ce(e)}function io(e){return{add_token:Lh,end_token:Fs,add_text:Bs,set_attr:Hs,data:{nodes:[e,,,,,],index:0}}}function Lh(e,t){let n=e.nodes[e.index],r;switch(t){case 1:return;case 20:r=document.createElement("blockquote");break;case 2:r=document.createElement("p");break;case 21:r=document.createElement("br");break;case 22:r=document.createElement("hr");break;case 3:r=document.createElement("h1");break;case 4:r=document.createElement("h2");break;case 5:r=document.createElement("h3");break;case 6:r=document.createElement("h4");break;case 7:r=document.createElement("h5");break;case 8:r=document.createElement("h6");break;case 12:case 13:r=document.createElement("em");break;case 14:case 15:r=document.createElement("strong");break;case 16:r=document.createElement("s");break;case 11:r=document.createElement("code");break;case 18:case 17:r=document.createElement("a");break;case 19:r=document.createElement("img");break;case 23:r=document.createElement("ul");break;case 24:r=document.createElement("ol");break;case 25:r=document.createElement("li");break;case 26:let o=r=document.createElement("input");o.type="checkbox",o.disabled=!0;break;case 9:case 10:n=n.appendChild(document.createElement("pre")),r=document.createElement("code");break;case 27:r=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]}r=document.createElement("tr");break;case 29:r=document.createElement(n.parentElement?.tagName==="THEAD"?"th":"td");break;case 30:r=document.createElement("equation-block");break;case 31:r=document.createElement("equation-inline");break}e.nodes[++e.index]=n.appendChild(r)}function Fs(e){e.index-=1}function Bs(e,t){e.nodes[e.index].appendChild(document.createTextNode(t))}function Hs(e,t,n){e.nodes[e.index].setAttribute(Th(t),n)}var yr={root:"Root",schema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{Root:{$ref:"#/$defs/Root"},Grid:{$ref:"#/$defs/Grid"},Cell:{$ref:"#/$defs/Cell"},Text:{$ref:"#/$defs/Text"},Card:{$ref:"#/$defs/Card"},Metric:{$ref:"#/$defs/Metric"},Table:{$ref:"#/$defs/Table"},Chart:{$ref:"#/$defs/Chart"}},required:["Root","Grid","Cell","Text","Card","Metric","Table","Chart"],additionalProperties:!1,$defs:{Root:{type:"object",properties:{children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Grid"},{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}}},required:["children"],additionalProperties:!1},Grid:{type:"object",properties:{columns:{type:"integer",enum:[1,2,3,4],default:1},children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Cell"},{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}}},required:["columns","children"],additionalProperties:!1},Cell:{type:"object",properties:{children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}},span:{type:"integer",enum:[1,2,3,4],default:1}},required:["children"],additionalProperties:!1},Text:{type:"object",properties:{text:{type:"string"}},required:["text"],additionalProperties:!1},Card:{type:"object",properties:{title:{type:"string"},body:{type:"string"}},required:["title","body"],additionalProperties:!1},Metric:{type:"object",properties:{label:{type:"string"},value:{type:"string"},detail:{type:"string"}},required:["label","value","detail"],additionalProperties:!1},Table:{type:"object",properties:{title:{type:"string"},columns:{type:"array",items:{type:"string"}},rows:{type:"array",items:{type:"array",items:{type:"string"}}}},required:["title","columns","rows"],additionalProperties:!1},Chart:{type:"object",properties:{title:{type:"string"},type:{type:"string",enum:["bar","line"]},data:{type:"array",items:{type:"object",properties:{label:{type:"string"},value:{type:"number"}},required:["label","value"],additionalProperties:!1}}},required:["title","type","data"],additionalProperties:!1}}}};var md=so;var Nh={type:"object",properties:{typeName:{const:"Grid"},statementId:{type:"string"},props:{type:"object",properties:{columns:{type:"integer",enum:[1,2,3,4],default:1},children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Cell"},{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}}},required:["columns","children"],additionalProperties:!1}},required:["typeName","statementId","props"]},Oh={type:"object",properties:{typeName:{const:"Cell"},statementId:{type:"string"},props:{type:"object",properties:{children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}},span:{type:"integer",enum:[1,2,3,4],default:1}},required:["children"],additionalProperties:!1}},required:["typeName","statementId","props"]};function st(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=st.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let _;if(e.typeName===void 0&&(_="typeName")||e.statementId===void 0&&(_="statementId")||e.props===void 0&&(_="props"))return st.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:_}}],!1;if(e.typeName!==void 0){let d=s;if(e.typeName!=="Text")return st.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Text"}}],!1;var p=d===s}else var p=!0;if(p){if(e.statementId!==void 0){let d=s;if(typeof e.statementId!="string")return st.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=d===s}else var p=!0;if(p)if(e.props!==void 0){let d=e.props,u=s;if(s===u)if(d&&typeof d=="object"&&!Array.isArray(d)){let m;if(d.text===void 0&&(m="text"))return st.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:m}}],!1;{let v=s;for(let y in d)if(y!=="text"){return st.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:y}}],!1;break}if(v===s&&d.text!==void 0&&typeof d.text!="string")return st.errors=[{instancePath:t+"/props/text",schemaPath:"#/properties/props/properties/text/type",keyword:"type",params:{type:"string"}}],!1}}else return st.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=u===s}else var p=!0}}else return st.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return st.errors=i,s===0}st.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function tt(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=tt.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let d;if(e.typeName===void 0&&(d="typeName")||e.statementId===void 0&&(d="statementId")||e.props===void 0&&(d="props"))return tt.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:d}}],!1;if(e.typeName!==void 0){let u=s;if(e.typeName!=="Card")return tt.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Card"}}],!1;var p=u===s}else var p=!0;if(p){if(e.statementId!==void 0){let u=s;if(typeof e.statementId!="string")return tt.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=u===s}else var p=!0;if(p)if(e.props!==void 0){let u=e.props,f=s;if(s===f)if(u&&typeof u=="object"&&!Array.isArray(u)){let v;if(u.title===void 0&&(v="title")||u.body===void 0&&(v="body"))return tt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:v}}],!1;{let y=s;for(let x in u)if(!(x==="title"||x==="body")){return tt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:x}}],!1;break}if(y===s){if(u.title!==void 0){let x=s;if(typeof u.title!="string")return tt.errors=[{instancePath:t+"/props/title",schemaPath:"#/properties/props/properties/title/type",keyword:"type",params:{type:"string"}}],!1;var _=x===s}else var _=!0;if(_)if(u.body!==void 0){let x=s;if(typeof u.body!="string")return tt.errors=[{instancePath:t+"/props/body",schemaPath:"#/properties/props/properties/body/type",keyword:"type",params:{type:"string"}}],!1;var _=x===s}else var _=!0}}}else return tt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=f===s}else var p=!0}}else return tt.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return tt.errors=i,s===0}tt.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function Xe(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Xe.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let d;if(e.typeName===void 0&&(d="typeName")||e.statementId===void 0&&(d="statementId")||e.props===void 0&&(d="props"))return Xe.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:d}}],!1;if(e.typeName!==void 0){let u=s;if(e.typeName!=="Metric")return Xe.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Metric"}}],!1;var p=u===s}else var p=!0;if(p){if(e.statementId!==void 0){let u=s;if(typeof e.statementId!="string")return Xe.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=u===s}else var p=!0;if(p)if(e.props!==void 0){let u=e.props,f=s;if(s===f)if(u&&typeof u=="object"&&!Array.isArray(u)){let v;if(u.label===void 0&&(v="label")||u.value===void 0&&(v="value")||u.detail===void 0&&(v="detail"))return Xe.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:v}}],!1;{let y=s;for(let x in u)if(!(x==="label"||x==="value"||x==="detail")){return Xe.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:x}}],!1;break}if(y===s){if(u.label!==void 0){let x=s;if(typeof u.label!="string")return Xe.errors=[{instancePath:t+"/props/label",schemaPath:"#/properties/props/properties/label/type",keyword:"type",params:{type:"string"}}],!1;var _=x===s}else var _=!0;if(_){if(u.value!==void 0){let x=s;if(typeof u.value!="string")return Xe.errors=[{instancePath:t+"/props/value",schemaPath:"#/properties/props/properties/value/type",keyword:"type",params:{type:"string"}}],!1;var _=x===s}else var _=!0;if(_)if(u.detail!==void 0){let x=s;if(typeof u.detail!="string")return Xe.errors=[{instancePath:t+"/props/detail",schemaPath:"#/properties/props/properties/detail/type",keyword:"type",params:{type:"string"}}],!1;var _=x===s}else var _=!0}}}}else return Xe.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=f===s}else var p=!0}}else return Xe.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return Xe.errors=i,s===0}Xe.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function He(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=He.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let m;if(e.typeName===void 0&&(m="typeName")||e.statementId===void 0&&(m="statementId")||e.props===void 0&&(m="props"))return He.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:m}}],!1;if(e.typeName!==void 0){let v=s;if(e.typeName!=="Table")return He.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Table"}}],!1;var p=v===s}else var p=!0;if(p){if(e.statementId!==void 0){let v=s;if(typeof e.statementId!="string")return He.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=v===s}else var p=!0;if(p)if(e.props!==void 0){let v=e.props,y=s;if(s===y)if(v&&typeof v=="object"&&!Array.isArray(v)){let P;if(v.title===void 0&&(P="title")||v.columns===void 0&&(P="columns")||v.rows===void 0&&(P="rows"))return He.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:P}}],!1;{let k=s;for(let g in v)if(!(g==="title"||g==="columns"||g==="rows")){return He.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:g}}],!1;break}if(k===s){if(v.title!==void 0){let g=s;if(typeof v.title!="string")return He.errors=[{instancePath:t+"/props/title",schemaPath:"#/properties/props/properties/title/type",keyword:"type",params:{type:"string"}}],!1;var _=g===s}else var _=!0;if(_){if(v.columns!==void 0){let g=v.columns,h=s;if(s===h)if(Array.isArray(g)){var d=!0;let w=g.length;for(let A=0;A<w;A++){let R=s;if(typeof g[A]!="string")return He.errors=[{instancePath:t+"/props/columns/"+A,schemaPath:"#/properties/props/properties/columns/items/type",keyword:"type",params:{type:"string"}}],!1;var d=R===s;if(!d)break}}else return He.errors=[{instancePath:t+"/props/columns",schemaPath:"#/properties/props/properties/columns/type",keyword:"type",params:{type:"array"}}],!1;var _=h===s}else var _=!0;if(_)if(v.rows!==void 0){let g=v.rows,h=s;if(s===h)if(Array.isArray(g)){var u=!0;let w=g.length;for(let A=0;A<w;A++){let R=g[A],E=s;if(s===E)if(Array.isArray(R)){var f=!0;let j=R.length;for(let B=0;B<j;B++){let V=s;if(typeof R[B]!="string")return He.errors=[{instancePath:t+"/props/rows/"+A+"/"+B,schemaPath:"#/properties/props/properties/rows/items/items/type",keyword:"type",params:{type:"string"}}],!1;var f=V===s;if(!f)break}}else return He.errors=[{instancePath:t+"/props/rows/"+A,schemaPath:"#/properties/props/properties/rows/items/type",keyword:"type",params:{type:"array"}}],!1;var u=E===s;if(!u)break}}else return He.errors=[{instancePath:t+"/props/rows",schemaPath:"#/properties/props/properties/rows/type",keyword:"type",params:{type:"array"}}],!1;var _=h===s}else var _=!0}}}}else return He.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=y===s}else var p=!0}}else return He.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return He.errors=i,s===0}He.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};var $h={type:"object",properties:{typeName:{const:"Chart"},statementId:{type:"string"},props:{type:"object",properties:{title:{type:"string"},type:{type:"string",enum:["bar","line"]},data:{type:"array",items:{type:"object",properties:{label:{type:"string"},value:{type:"number"}},required:["label","value"],additionalProperties:!1}}},required:["title","type","data"],additionalProperties:!1}},required:["typeName","statementId","props"]};function Le(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Le.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let f;if(e.typeName===void 0&&(f="typeName")||e.statementId===void 0&&(f="statementId")||e.props===void 0&&(f="props"))return Le.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:f}}],!1;if(e.typeName!==void 0){let m=s;if(e.typeName!=="Chart")return Le.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Chart"}}],!1;var p=m===s}else var p=!0;if(p){if(e.statementId!==void 0){let m=s;if(typeof e.statementId!="string")return Le.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=m===s}else var p=!0;if(p)if(e.props!==void 0){let m=e.props,v=s;if(s===v)if(m&&typeof m=="object"&&!Array.isArray(m)){let x;if(m.title===void 0&&(x="title")||m.type===void 0&&(x="type")||m.data===void 0&&(x="data"))return Le.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:x}}],!1;{let P=s;for(let k in m)if(!(k==="title"||k==="type"||k==="data")){return Le.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:k}}],!1;break}if(P===s){if(m.title!==void 0){let k=s;if(typeof m.title!="string")return Le.errors=[{instancePath:t+"/props/title",schemaPath:"#/properties/props/properties/title/type",keyword:"type",params:{type:"string"}}],!1;var _=k===s}else var _=!0;if(_){if(m.type!==void 0){let k=m.type,g=s;if(typeof k!="string")return Le.errors=[{instancePath:t+"/props/type",schemaPath:"#/properties/props/properties/type/type",keyword:"type",params:{type:"string"}}],!1;if(!(k==="bar"||k==="line"))return Le.errors=[{instancePath:t+"/props/type",schemaPath:"#/properties/props/properties/type/enum",keyword:"enum",params:{allowedValues:$h.properties.props.properties.type.enum}}],!1;var _=g===s}else var _=!0;if(_)if(m.data!==void 0){let k=m.data,g=s;if(s===g)if(Array.isArray(k)){var d=!0;let b=k.length;for(let w=0;w<b;w++){let A=k[w],R=s;if(s===R)if(A&&typeof A=="object"&&!Array.isArray(A)){let N;if(A.label===void 0&&(N="label")||A.value===void 0&&(N="value"))return Le.errors=[{instancePath:t+"/props/data/"+w,schemaPath:"#/properties/props/properties/data/items/required",keyword:"required",params:{missingProperty:N}}],!1;{let j=s;for(let B in A)if(!(B==="label"||B==="value")){return Le.errors=[{instancePath:t+"/props/data/"+w,schemaPath:"#/properties/props/properties/data/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:B}}],!1;break}if(j===s){if(A.label!==void 0){let B=s;if(typeof A.label!="string")return Le.errors=[{instancePath:t+"/props/data/"+w+"/label",schemaPath:"#/properties/props/properties/data/items/properties/label/type",keyword:"type",params:{type:"string"}}],!1;var u=B===s}else var u=!0;if(u)if(A.value!==void 0){let B=A.value,V=s;if(!(typeof B=="number"&&isFinite(B)))return Le.errors=[{instancePath:t+"/props/data/"+w+"/value",schemaPath:"#/properties/props/properties/data/items/properties/value/type",keyword:"type",params:{type:"number"}}],!1;var u=V===s}else var u=!0}}}else return Le.errors=[{instancePath:t+"/props/data/"+w,schemaPath:"#/properties/props/properties/data/items/type",keyword:"type",params:{type:"object"}}],!1;var d=R===s;if(!d)break}}else return Le.errors=[{instancePath:t+"/props/data",schemaPath:"#/properties/props/properties/data/type",keyword:"type",params:{type:"array"}}],!1;var _=g===s}else var _=!0}}}}else return Le.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=v===s}else var p=!0}}else return Le.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return Le.errors=i,s===0}Le.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function it(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=it.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let m;if(e.typeName===void 0&&(m="typeName")||e.statementId===void 0&&(m="statementId")||e.props===void 0&&(m="props"))return it.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:m}}],!1;if(e.typeName!==void 0){let v=s;if(e.typeName!=="Cell")return it.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Cell"}}],!1;var p=v===s}else var p=!0;if(p){if(e.statementId!==void 0){let v=s;if(typeof e.statementId!="string")return it.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=v===s}else var p=!0;if(p)if(e.props!==void 0){let v=e.props,y=s;if(s===y)if(v&&typeof v=="object"&&!Array.isArray(v)){let P;if(v.children===void 0&&(P="children"))return it.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:P}}],!1;{let k=s;for(let g in v)if(!(g==="children"||g==="span")){return it.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:g}}],!1;break}if(k===s){if(v.children!==void 0){let g=v.children,h=s;if(s===h)if(Array.isArray(g)){var _=!0;let b=g.length;for(let w=0;w<b;w++){let A=g[w],R=s,E=s,N=!1,j=s;st(A,{instancePath:t+"/props/children/"+w,parentData:g,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?st.errors:i.concat(st.errors),s=i.length);var u=j===s;if(N=N||u,u){var d={};d.typeName=!0,d.statementId=!0,d.props=!0}let B=s;tt(A,{instancePath:t+"/props/children/"+w,parentData:g,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?tt.errors:i.concat(tt.errors),s=i.length);var u=B===s;N=N||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0);let V=s;Xe(A,{instancePath:t+"/props/children/"+w,parentData:g,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?Xe.errors:i.concat(Xe.errors),s=i.length);var u=V===s;N=N||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0);let X=s;He(A,{instancePath:t+"/props/children/"+w,parentData:g,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?He.errors:i.concat(He.errors),s=i.length);var u=X===s;N=N||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0);let pe=s;Le(A,{instancePath:t+"/props/children/"+w,parentData:g,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?Le.errors:i.concat(Le.errors),s=i.length);var u=pe===s;if(N=N||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0),N)s=E,i!==null&&(E?i.length=E:i=null);else{let ce={instancePath:t+"/props/children/"+w,schemaPath:"#/properties/props/properties/children/items/anyOf",keyword:"anyOf",params:{}};return i===null?i=[ce]:i.push(ce),s++,it.errors=i,!1}var _=R===s;if(!_)break}}else return it.errors=[{instancePath:t+"/props/children",schemaPath:"#/properties/props/properties/children/type",keyword:"type",params:{type:"array"}}],!1;var f=h===s}else var f=!0;if(f)if(v.span!==void 0){let g=v.span,h=s;if(!(typeof g=="number"&&!(g%1)&&!isNaN(g)&&isFinite(g)))return it.errors=[{instancePath:t+"/props/span",schemaPath:"#/properties/props/properties/span/type",keyword:"type",params:{type:"integer"}}],!1;if(!(g===1||g===2||g===3||g===4))return it.errors=[{instancePath:t+"/props/span",schemaPath:"#/properties/props/properties/span/enum",keyword:"enum",params:{allowedValues:Oh.properties.props.properties.span.enum}}],!1;var f=h===s}else var f=!0}}}else return it.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=y===s}else var p=!0}}else return it.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return it.errors=i,s===0}it.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function yt(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=yt.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let m;if(e.typeName===void 0&&(m="typeName")||e.statementId===void 0&&(m="statementId")||e.props===void 0&&(m="props"))return yt.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:m}}],!1;if(e.typeName!==void 0){let v=s;if(e.typeName!=="Grid")return yt.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Grid"}}],!1;var p=v===s}else var p=!0;if(p){if(e.statementId!==void 0){let v=s;if(typeof e.statementId!="string")return yt.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=v===s}else var p=!0;if(p)if(e.props!==void 0){let v=e.props,y=s;if(s===y)if(v&&typeof v=="object"&&!Array.isArray(v)){let P;if(v.columns===void 0&&(P="columns")||v.children===void 0&&(P="children"))return yt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:P}}],!1;{let k=s;for(let g in v)if(!(g==="columns"||g==="children")){return yt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:g}}],!1;break}if(k===s){if(v.columns!==void 0){let g=v.columns,h=s;if(!(typeof g=="number"&&!(g%1)&&!isNaN(g)&&isFinite(g)))return yt.errors=[{instancePath:t+"/props/columns",schemaPath:"#/properties/props/properties/columns/type",keyword:"type",params:{type:"integer"}}],!1;if(!(g===1||g===2||g===3||g===4))return yt.errors=[{instancePath:t+"/props/columns",schemaPath:"#/properties/props/properties/columns/enum",keyword:"enum",params:{allowedValues:Nh.properties.props.properties.columns.enum}}],!1;var _=h===s}else var _=!0;if(_)if(v.children!==void 0){let g=v.children,h=s;if(s===h)if(Array.isArray(g)){var d=!0;let w=g.length;for(let A=0;A<w;A++){let R=g[A],E=s,N=s,j=!1,B=s;it(R,{instancePath:t+"/props/children/"+A,parentData:g,parentDataProperty:A,rootData:o,dynamicAnchors:a})||(i=i===null?it.errors:i.concat(it.errors),s=i.length);var f=B===s;if(j=j||f,f){var u={};u.typeName=!0,u.statementId=!0,u.props=!0}let V=s;st(R,{instancePath:t+"/props/children/"+A,parentData:g,parentDataProperty:A,rootData:o,dynamicAnchors:a})||(i=i===null?st.errors:i.concat(st.errors),s=i.length);var f=V===s;j=j||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let X=s;tt(R,{instancePath:t+"/props/children/"+A,parentData:g,parentDataProperty:A,rootData:o,dynamicAnchors:a})||(i=i===null?tt.errors:i.concat(tt.errors),s=i.length);var f=X===s;j=j||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let pe=s;Xe(R,{instancePath:t+"/props/children/"+A,parentData:g,parentDataProperty:A,rootData:o,dynamicAnchors:a})||(i=i===null?Xe.errors:i.concat(Xe.errors),s=i.length);var f=pe===s;j=j||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let J=s;He(R,{instancePath:t+"/props/children/"+A,parentData:g,parentDataProperty:A,rootData:o,dynamicAnchors:a})||(i=i===null?He.errors:i.concat(He.errors),s=i.length);var f=J===s;j=j||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let ce=s;Le(R,{instancePath:t+"/props/children/"+A,parentData:g,parentDataProperty:A,rootData:o,dynamicAnchors:a})||(i=i===null?Le.errors:i.concat(Le.errors),s=i.length);var f=ce===s;if(j=j||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0),j)s=N,i!==null&&(N?i.length=N:i=null);else{let be={instancePath:t+"/props/children/"+A,schemaPath:"#/properties/props/properties/children/items/anyOf",keyword:"anyOf",params:{}};return i===null?i=[be]:i.push(be),s++,yt.errors=i,!1}var d=E===s;if(!d)break}}else return yt.errors=[{instancePath:t+"/props/children",schemaPath:"#/properties/props/properties/children/type",keyword:"type",params:{type:"array"}}],!1;var _=h===s}else var _=!0}}}else return yt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=y===s}else var p=!0}}else return yt.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return yt.errors=i,s===0}yt.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function so(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=so.evaluated;c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0);let p=s,_=!1,d=s;yt(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?yt.errors:i.concat(yt.errors),s=i.length);var k=d===s;if(_=_||k,k){var u={};u.typeName=!0,u.statementId=!0,u.props=!0}let f=s;it(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?it.errors:i.concat(it.errors),s=i.length);var k=f===s;_=_||k,k&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let m=s;st(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?st.errors:i.concat(st.errors),s=i.length);var k=m===s;_=_||k,k&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let v=s;tt(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?tt.errors:i.concat(tt.errors),s=i.length);var k=v===s;_=_||k,k&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let y=s;Xe(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?Xe.errors:i.concat(Xe.errors),s=i.length);var k=y===s;_=_||k,k&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let x=s;He(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?He.errors:i.concat(He.errors),s=i.length);var k=x===s;_=_||k,k&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let P=s;Le(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?Le.errors:i.concat(Le.errors),s=i.length);var k=P===s;if(_=_||k,k&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0),_)s=p,i!==null&&(p?i.length=p:i=null);else{let g={instancePath:t,schemaPath:"#/anyOf",keyword:"anyOf",params:{}};return i===null?i=[g]:i.push(g),s++,so.errors=i,!1}return so.errors=i,c.props=u,s===0}so.evaluated={dynamicProps:!0,dynamicItems:!1};function gd(e){switch(e.k){case"StateRef":case"RuntimeRef":case"BinOp":case"UnaryOp":case"Ternary":case"Member":case"Index":case"Assign":return!0;default:return!1}}var Dh=new Set(["Comp","Ref","StateRef","RuntimeRef","BinOp","UnaryOp","Ternary","Member","Index","Assign","Str","Num","Bool","Null","Arr","Obj","Ph"]);function Wn(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Dh.has(e.k)}function lo(e,t){let n=r=>{switch(t(r),r.k){case"Comp":r.args.forEach(n),Object.values(r.mappedProps??{}).forEach(n);break;case"Arr":r.els.forEach(n);break;case"Obj":r.entries.forEach(([,o])=>n(o));break;case"BinOp":n(r.left),n(r.right);break;case"UnaryOp":n(r.operand);break;case"Ternary":n(r.cond),n(r.then),n(r.else);break;case"Member":n(r.obj);break;case"Index":n(r.obj),n(r.index);break;case"Assign":n(r.value);break}};n(e)}function ka(e){return e==null?{k:"Null"}:typeof e=="string"?{k:"Str",v:e}:typeof e=="number"?{k:"Num",v:e}:typeof e=="boolean"?{k:"Bool",v:e}:Array.isArray(e)?{k:"Arr",els:e.map(ka)}:typeof e=="object"?{k:"Obj",entries:Object.entries(e).map(([t,n])=>[t,ka(n)])}:{k:"Null"}}function wa(e){switch(e.k){case"Str":case"Num":case"Bool":return{v:e.v};case"Null":return{v:null};case"Arr":{let t=[];for(let n of e.els){let r=wa(n);if(!r)return;t.push(r.v)}return{v:t}}case"Obj":{let t={};for(let[n,r]of e.entries){let o=wa(r);if(!o)return;t[n]=o.v}return{v:t}}default:return}}var Ca=new Map([["Count",{kind:"function",params:[{name:"array",required:!1}],builtin:!0}],["First",{kind:"function",params:[{name:"array",required:!1}],builtin:!0}],["Last",{kind:"function",params:[{name:"array",required:!1}],builtin:!0}],["Sum",{kind:"function",params:[{name:"numbers",required:!1}],builtin:!0}],["Avg",{kind:"function",params:[{name:"numbers",required:!1}],builtin:!0}],["Min",{kind:"function",params:[{name:"numbers",required:!1}],builtin:!0}],["Max",{kind:"function",params:[{name:"numbers",required:!1}],builtin:!0}],["Sort",{kind:"function",params:[{name:"array",required:!1},{name:"field",required:!1},{name:"direction",required:!1}],builtin:!0}],["Filter",{kind:"function",params:[{name:"array",required:!1},{name:"field",required:!1},{name:"operator",required:!1},{name:"value",required:!1}],builtin:!0}],["Round",{kind:"function",params:[{name:"number",required:!1},{name:"decimals",required:!1}],builtin:!0}],["Abs",{kind:"function",params:[{name:"number",required:!1}],builtin:!0}],["Floor",{kind:"function",params:[{name:"number",required:!1}],builtin:!0}],["Ceil",{kind:"function",params:[{name:"number",required:!1}],builtin:!0}],["Each",{kind:"function",params:[{name:"array",required:!1},{name:"varName",required:!1},{name:"template",required:!1}],builtin:!0,lazy:!0}],["Run",{kind:"action",params:[{name:"ref",required:!1}],builtin:!0,lazy:!0}],["ToAssistant",{kind:"action",params:[{name:"message",required:!1},{name:"context",required:!1}],builtin:!0}],["OpenUrl",{kind:"action",params:[{name:"url",required:!1}],builtin:!0}],["Set",{kind:"action",params:[{name:"variable",required:!1},{name:"value",required:!1}],builtin:!0,lazy:!0}],["Reset",{kind:"action",params:[{name:"variable",required:!1}],builtin:!0,lazy:!0}],["Action",{kind:"action",params:[{name:"steps",required:!0}],builtin:!0,lazy:!0}]]),hd={ActionExpression:!0,OpenUrl:!0,ToAssistant:!0},Tn={Query:"Query",Mutation:"Mutation"};function co(e){return e?.callDefs??Ca}function uo(e){return Ca.has(e)}function Pr(e){return e in Tn}var T;(function(e){e[e.Newline=0]="Newline",e[e.LParen=1]="LParen",e[e.RParen=2]="RParen",e[e.LBrack=3]="LBrack",e[e.RBrack=4]="RBrack",e[e.LBrace=5]="LBrace",e[e.RBrace=6]="RBrace",e[e.Comma=7]="Comma",e[e.Colon=8]="Colon",e[e.Equals=9]="Equals",e[e.True=10]="True",e[e.False=11]="False",e[e.Null=12]="Null",e[e.EOF=13]="EOF",e[e.Str=14]="Str",e[e.Num=15]="Num",e[e.Ident=16]="Ident",e[e.Type=17]="Type",e[e.StateVar=18]="StateVar",e[e.Dot=19]="Dot",e[e.Plus=20]="Plus",e[e.Minus=21]="Minus",e[e.Star=22]="Star",e[e.Slash=23]="Slash",e[e.Percent=24]="Percent",e[e.EqEq=25]="EqEq",e[e.NotEq=26]="NotEq",e[e.Greater=27]="Greater",e[e.Less=28]="Less",e[e.GreaterEq=29]="GreaterEq",e[e.LessEq=30]="LessEq",e[e.And=31]="And",e[e.Or=32]="Or",e[e.Not=33]="Not",e[e.Question=34]="Question",e[e.BuiltinCall=35]="BuiltinCall"})(T||(T={}));var Fh=1,vd=2,bd=3,Us=4,po=5,qs=6,Ta=7,yd=8,Bh=9;function Ra(e){let t=0,n=()=>e[t]??{t:T.EOF},r=()=>{let u=n();return t++,u},o=u=>{n().t===u&&t++};function a(u){switch(u.t){case T.Question:return Fh;case T.Or:return vd;case T.And:return bd;case T.EqEq:case T.NotEq:return Us;case T.Greater:case T.Less:case T.GreaterEq:case T.LessEq:return po;case T.Plus:case T.Minus:return qs;case T.Star:case T.Slash:case T.Percent:return Ta;case T.Dot:case T.LBrack:return Bh;default:return 0}}function i(u=0){let f=s();for(;a(n())>u;)f=c(f);return f}function s(){let u=n();if(u.t===T.Str)return r(),{k:"Str",v:u.v};if(u.t===T.Num)return r(),{k:"Num",v:u.v};if(u.t===T.True)return r(),{k:"Bool",v:!0};if(u.t===T.False)return r(),{k:"Bool",v:!1};if(u.t===T.Null)return r(),{k:"Null"};if(u.t===T.LBrack)return _();if(u.t===T.LBrace)return d();if(u.t===T.StateVar){let f=u.v;if(r(),n().t===T.Equals){r();let m=i(0);return{k:"Assign",target:f,value:m}}return{k:"StateRef",n:f}}if(u.t===T.Type){let f=u.v;return e[t+1]?.t===T.LParen&&(!uo(f)||f==="Action")?p():(r(),{k:"Ref",n:f})}if(u.t===T.BuiltinCall){if(e[t+1]?.t===T.LParen){let f=p();return f.k==="Comp"&&!uo(f.name)&&(f.fn=!0),f}return r(),{k:"Ref",n:u.v}}if(u.t===T.Ident)return r(),{k:"Ref",n:u.v};if(u.t===T.Not)return r(),{k:"UnaryOp",op:"!",operand:i(yd)};if(u.t===T.Minus)return r(),{k:"UnaryOp",op:"-",operand:i(yd)};if(u.t===T.LParen){r();let f=i(0);return o(T.RParen),f}return r(),{k:"Null"}}function c(u){let f=n();if(f.t===T.Plus)return r(),{k:"BinOp",op:"+",left:u,right:i(qs)};if(f.t===T.Minus)return r(),{k:"BinOp",op:"-",left:u,right:i(qs)};if(f.t===T.Star)return r(),{k:"BinOp",op:"*",left:u,right:i(Ta)};if(f.t===T.Slash)return r(),{k:"BinOp",op:"/",left:u,right:i(Ta)};if(f.t===T.Percent)return r(),{k:"BinOp",op:"%",left:u,right:i(Ta)};if(f.t===T.EqEq)return r(),{k:"BinOp",op:"==",left:u,right:i(Us)};if(f.t===T.NotEq)return r(),{k:"BinOp",op:"!=",left:u,right:i(Us)};if(f.t===T.Greater)return r(),{k:"BinOp",op:">",left:u,right:i(po)};if(f.t===T.Less)return r(),{k:"BinOp",op:"<",left:u,right:i(po)};if(f.t===T.GreaterEq)return r(),{k:"BinOp",op:">=",left:u,right:i(po)};if(f.t===T.LessEq)return r(),{k:"BinOp",op:"<=",left:u,right:i(po)};if(f.t===T.And)return r(),{k:"BinOp",op:"&&",left:u,right:i(bd)};if(f.t===T.Or)return r(),{k:"BinOp",op:"||",left:u,right:i(vd)};if(f.t===T.Question){r();let m=i(0);o(T.Colon);let v=i(0);return{k:"Ternary",cond:u,then:m,else:v}}if(f.t===T.Dot){r();let m=n(),v=m.t===T.Ident||m.t===T.Type||m.t===T.Str||m.t===T.Num?(r(),String(m.v)):m.t===T.StateVar?(r(),m.v.replace(/^\$/,"")):(r(),"?");return{k:"Member",obj:u,field:v}}if(f.t===T.LBrack){r();let m=i(0);return o(T.RBrack),{k:"Index",obj:u,index:m}}return u}function p(){let u=n().v;r(),o(T.LParen);let f=[];for(;n().t!==T.RParen&&n().t!==T.EOF;)f.push(i(0)),n().t===T.Comma&&r();return o(T.RParen),{k:"Comp",name:u,args:f}}function _(){r();let u=[];for(;n().t!==T.RBrack&&n().t!==T.EOF;)u.push(i(0)),n().t===T.Comma&&r();return o(T.RBrack),{k:"Arr",els:u}}function d(){r();let u=[];for(;n().t!==T.RBrace&&n().t!==T.EOF;){let f=n(),m=f.t===T.Ident||f.t===T.Str||f.t===T.Type||f.t===T.Num?(r(),String(f.v)):f.t===T.StateVar?(r(),f.v.replace(/^\$/,"")):(r(),"?");o(T.Colon),u.push([m,i(0)]),n().t===T.Comma&&r()}return o(T.RBrace),{k:"Obj",entries:u}}return i(0)}function Ia(e){let t=[],n=0,r=e.length;for(;n<r;){for(;n<r&&(e[n]===" "||e[n]===" "||e[n]==="\r");)n++;if(n>=r)break;let o=e[n];if(o===`
36
+ `){t.push({t:T.Newline}),n++;continue}if(o==="("){t.push({t:T.LParen}),n++;continue}if(o===")"){t.push({t:T.RParen}),n++;continue}if(o==="["){t.push({t:T.LBrack}),n++;continue}if(o==="]"){t.push({t:T.RBrack}),n++;continue}if(o==="{"){t.push({t:T.LBrace}),n++;continue}if(o==="}"){t.push({t:T.RBrace}),n++;continue}if(o===","){t.push({t:T.Comma}),n++;continue}if(o===":"){t.push({t:T.Colon}),n++;continue}if(o==="="){n+1<r&&e[n+1]==="="?(t.push({t:T.EqEq}),n+=2):(t.push({t:T.Equals}),n++);continue}if(o==="!"){n+1<r&&e[n+1]==="="?(t.push({t:T.NotEq}),n+=2):(t.push({t:T.Not}),n++);continue}if(o===">"){n+1<r&&e[n+1]==="="?(t.push({t:T.GreaterEq}),n+=2):(t.push({t:T.Greater}),n++);continue}if(o==="<"){n+1<r&&e[n+1]==="="?(t.push({t:T.LessEq}),n+=2):(t.push({t:T.Less}),n++);continue}if(o==="&"){n+1<r&&e[n+1]==="&"?(t.push({t:T.And}),n+=2):(t.push({t:T.And}),n++);continue}if(o==="|"){n+1<r&&e[n+1]==="|"?(t.push({t:T.Or}),n+=2):(t.push({t:T.Or}),n++);continue}if(o==="."){t.push({t:T.Dot}),n++;continue}if(o==="?"){t.push({t:T.Question}),n++;continue}if(o==="+"){t.push({t:T.Plus}),n++;continue}if(o==="*"){t.push({t:T.Star}),n++;continue}if(o==="/"){t.push({t:T.Slash}),n++;continue}if(o==="%"){t.push({t:T.Percent}),n++;continue}if(o==='"'){let c=n;n++;let p=!1;for(;n<r;)if(e[n]==="\\")n+=2;else if(e[n]==='"'){n++,p=!0;break}else n++;let _=e.slice(c,n);try{let d=p?_:_+'"';t.push({t:T.Str,v:JSON.parse(d)})}catch{let d=_.replace(/^"|"$/g,"");t.push({t:T.Str,v:d})}continue}if(o==="'"){n++;let c="",p=!1;for(;n<r;)if(e[n]==="\\"){if(n++,n<r){let _=e[n];_==="'"?c+="'":_==="\\"?c+="\\":_==="n"?c+=`
37
+ `:_==="t"?c+=" ":c+=_,n++}}else if(e[n]==="'"){n++,p=!0;break}else c+=e[n],n++;t.push({t:T.Str,v:c});continue}if(o==="-"){let c=t.length>0?t[t.length-1]:null;if(!(!(c!=null&&(c.t===T.Num||c.t===T.Str||c.t===T.Ident||c.t===T.Type||c.t===T.RParen||c.t===T.RBrack||c.t===T.True||c.t===T.False||c.t===T.Null||c.t===T.StateVar||c.t===T.BuiltinCall))&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9")){t.push({t:T.Minus}),n++;continue}}let a=o>="0"&&o<="9",i=o==="-"&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9";if(a||i){let c=n;for(e[n]==="-"&&n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;if(n<r&&e[n]==="."&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9")for(n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;if(n<r&&(e[n]==="e"||e[n]==="E"))for(n++,n<r&&(e[n]==="+"||e[n]==="-")&&n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;t.push({t:T.Num,v:+e.slice(c,n)});continue}if(o==="$"&&n+1<r&&(e[n+1]>="a"&&e[n+1]<="z"||e[n+1]>="A"&&e[n+1]<="Z"||e[n+1]==="_")){let c=n;for(n++;n<r&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;t.push({t:T.StateVar,v:e.slice(c,n)});continue}if(o>="a"&&o<="z"||o>="A"&&o<="Z"||o==="_"){let c=n;for(;n<r&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;let p=e.slice(c,n);if(p==="true"){t.push({t:T.True});continue}if(p==="false"){t.push({t:T.False});continue}if(p==="null"){t.push({t:T.Null});continue}let _=o>="A"&&o<="Z"?T.Type:T.Ident;t.push({t:_,v:p});continue}if(o==="@"&&n+1<r&&(e[n+1]>="a"&&e[n+1]<="z"||e[n+1]>="A"&&e[n+1]<="Z"||e[n+1]==="_")){n++;let c=n;for(;n<r&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;t.push({t:T.BuiltinCall,v:e.slice(c,n)});continue}n++}return t.push({t:T.EOF}),t}function Jt(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return t.type==="element"&&typeof t.typeName=="string"&&typeof t.props=="object"&&t.props!==null&&typeof t.partial=="boolean"}var Pd;(function(e){e.ContinueConversation="continue_conversation",e.OpenUrl="open_url"})(Pd||(Pd={}));var Hh={},Uh=[];function Ea(e){return Array.isArray(e)?"array":typeof e}function xd(e){return typeof e.$ref=="string"?e.$ref.split("/").pop():void 0}function Sd(e){return"$ref"in e||"anyOf"in e||"oneOf"in e||"allOf"in e}function kd(e){if(Array.isArray(e.enum))return{enumValues:e.enum};if("const"in e)return{enumValues:[e.const]};switch(e.type){case"string":return{expectedType:"string"};case"number":case"integer":return{expectedType:"number"};case"boolean":return{expectedType:"boolean"};default:return{}}}function Aa(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e.default}function zs(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e,n=xd(t);if(n)return n;let r=kd(t);return r.enumValues?r.enumValues.map(o=>JSON.stringify(o)).join("|"):r.expectedType?r.expectedType:typeof t.type=="string"?t.type:void 0}function js(e,t){let n=t.map(r=>{let o=zs(r.schema),a=r.required?`${r.name}*`:r.name;return o?`${a}: ${o}`:a}).join(", ");return`${e}(${n})`}function qh(e,t){let n=typeof e;return t.enumValues?t.enumValues.includes(e)?null:{expected:`one of [${t.enumValues.map(r=>JSON.stringify(r)).join(", ")}]`,actual:Ea(e)}:t.expectedType&&t.expectedType!==n?{expected:t.expectedType,actual:Ea(e)}:null}function zh(e,t,n){switch(n.code){case"type-mismatch":return`field "${t}" expects ${n.expected} but got ${n.actual}`;case"pruned-value":return`field "${t}" lost an unresolved or invalid value`;case"missing-required":return`missing required field "${t}"${n.signature?` \u2014 signature: ${n.signature}`:""}`;case"null-required":return`required field "${t}" cannot be null${n.signature?` \u2014 signature: ${n.signature}`:""}`;case"unknown-component":return`Unknown component "${e}" \u2014 not found in catalog or builtins${n.available?.length?`. Available components: ${n.available.join(", ")}`:""}`;case"inline-reserved":return`${e}() must be declared as a top-level statement, not used inline as a value`;case"excess-args":return`${e} takes ${n.declared} arg(s), got ${n.got} (${n.got-n.declared} excess dropped)`;case"unknown-function":return`Unknown function "@${e}": not a built-in or action step. The call evaluates to null`;case"no-root":return n.reason==="not-component"?"root does not evaluate to a component":n.reason==="fallback"?`No root statement. Rendering the first statement that calls the root component ${e}`:e?`No root statement, and no statement calls the root component ${e}`:"No root statement"}}function Ge(e,t,n,r){e.errors.push({code:r.code,component:t,path:n,message:zh(t,n,r),statementId:e.currentStatementId,...r.code==="no-root"&&r.reason==="fallback"&&{severity:"warning"}})}var kt=Symbol("invalid");function Ma(e,t){return t!==void 0?t:e?kt:void 0}function jh(e,t,n,r,o){return Sd(t)?!1:typeof t.type=="string"||Array.isArray(t.enum)||"const"in t?(Ge(o,n,r,{code:"type-mismatch",expected:typeof t.type=="string"?t.type:"a literal value",actual:`component "${e.typeName}"`}),!0):!1}function wd(e){return(e.anyOf??e.oneOf??[e]).map(xd)}function Vh(e,t){let n=wd(e);return n.length>0&&n.every(r=>r!==void 0&&t.cat?.has(r))}function Wh(e,t,n,r,o){if(typeof e!="object"||Array.isArray(e))return Ge(o,n,r,{code:"type-mismatch",expected:"object",actual:Ea(e)}),kt;let a=e,i,s=t.properties&&typeof t.properties=="object"?t.properties:Hh,c=Array.isArray(t.required)?t.required:Uh,p=!1;if(!o.partial)for(let _ of c){let d=_ in a;if(!d||a[_]==null){let u=Aa(s[_]);if(u!==void 0){(i??(i={...a}))[_]=u;continue}Ge(o,n,`${r}/${_}`,{code:d?"null-required":"missing-required"}),p=!0}}for(let _ of Object.keys(s)){if(!(_ in a))continue;let d=s[_],u=_o(a[_],d,n,`${r}/${_}`,o);if(u===kt&&(u=Ma(c.includes(_),Aa(d)),u===kt)){p=!0;continue}u!==a[_]&&(i??(i={...a}),u===void 0?delete i[_]:i[_]=u)}return p?kt:i??a}function Gh(e,t,n,r,o){if(!Array.isArray(e))return Ge(o,n,r,{code:"type-mismatch",expected:"array",actual:Ea(e)}),kt;let a=t.items;if(!a||typeof a!="object"||Array.isArray(a))return e;let i;for(let s=0;s<e.length;s++){let c=_o(e[s],a,n,`${r}/${s}`,o);c!==e[s]&&!i&&(i=e.slice(0,s)),i&&c!==kt&&i.push(c)}return i??e}function Kh(e,t,n,r,o){let a=kd(t);if(a.expectedType==null&&a.enumValues==null||a.enumValues&&o.partial)return!1;let i=qh(e,a);return i?(Ge(o,n,r,{code:"type-mismatch",...i}),!0):!1}function _o(e,t,n,r,o){if(!t||typeof t!="object"||Array.isArray(t))return e;let a=t;if(e==null||Wn(e))return e;if(Jt(e))return jh(e,a,n,r,o)?kt:e;if(Sd(a))return Vh(a,o)?(Ge(o,n,r,{code:"type-mismatch",expected:wd(a).join(" | "),actual:Array.isArray(e)?"array":typeof e=="object"?"plain object":typeof e}),kt):e;let i=a.type;return i==="object"?Wh(e,a,n,r,o):i==="array"?Gh(e,a,n,r,o):Kh(e,a,n,r,o)?kt:e}function La(e){if(e==null||typeof e!="object")return!1;if(Wn(e))return!0;if(Array.isArray(e))return e.some(La);if(Jt(e))return Object.values(e.props).some(La);let t=e;return Array.isArray(t.steps)?!0:Object.values(t).some(La)}function Cd(e,t,n){if(t.visited.has(e))return t.unres.push(e),n==="expr"?{k:"Ph",n:e}:null;if(!t.syms.has(e))return t.unres.push(e),n==="expr"?{k:"Ph",n:e}:null;let r=t.syms.get(e);if(t.unreached?.delete(e),r.k==="Comp"&&Pr(r.name)){let a=r.name===Tn.Mutation?"mutation":"query";return{k:"RuntimeRef",n:e,refType:a}}t.visited.add(e);let o=t.currentStatementId;t.currentStatementId=e;try{let a=n==="value"?Gn(r,t):Vs(r,t);return n==="value"&&Jt(a)&&(a.statementId=e),a}finally{t.currentStatementId=o,t.visited.delete(e)}}function Na(e,t){return co(t.cat).has(e)||Pr(e)}function Ws(e,t){let n={};for(let r=0;r<t.length&&r<e.length;r++)n[t[r].name]=e[r];return n}function Td(e,t,n,r){let{params:o}=n;t.length>o.length&&Ge(r,e,"",{code:"excess-args",declared:o.length,got:t.length});let a=Ws(t,o),i=!1,s=r.errors.length;for(let c of o){let p=a[c.name],_=p?wa(p):{v:void 0};if(!_)continue;if(_.v==null){if(!c.required||c.defaultValue!==void 0)continue;Ge(r,e,`/${c.name}`,{code:p?"null-required":"missing-required",signature:js(e,o)}),i=!0;continue}let d=_o(_.v,c.schema,e,`/${c.name}`,r);d===kt&&(d=Ma(c.required,c.defaultValue)),d===kt?i=!0:d===void 0?delete a[c.name]:d!==_.v&&(a[c.name]=ka(d))}return n.kind==="action"&&r.errors.length>s&&(i=!0),i?null:a}function Rd(e,t,n){let r=e.args.map(n),o=co(t.cat).get(e.name);if(!o||o.lazy)return{...e,args:r};let a=o.builtin?Ws(r,o.params):Td(e.name,r,o,t);return a?{...e,args:r,mappedProps:a}:o.kind==="action"?{k:"Comp",name:"Action",args:[{k:"Arr",els:[]}]}:{k:"Null"}}function Gs(e,t,n){let r=t.currentStatementId;t.currentStatementId=n;let o=new Set;for(let a of e)lo(a,i=>{if(i.k!=="Comp"||o.has(i))return;o.add(i);let s=co(t.cat).get(i.name);if(!s||s.lazy)return;let c=s.builtin?null:Td(i.name,i.args,s,t);i.mappedProps=c??Ws(i.args,s.params)});t.currentStatementId=r}function Id(e,t,n){let r=co(t.cat).get(e.name);if(r?.kind!=="function"||!r.lazy||e.args.length<3)return null;let o=e.args[1],a=o.k==="Ref"?o.n:o.k==="Str"?o.v:null;if(!a)return null;let i=new Set(n);i.add(a);let s=e.args.map((c,p)=>p===1?c:wt(c,t,i));return{...e,args:s}}function wt(e,t,n){switch(e.k){case"Ref":return n.has(e.n)?e:Cd(e.n,t,"expr");case"Ph":return e;case"Comp":{if(e.fn&&!Na(e.name,t))return Ge(t,e.name,"",{code:"unknown-function"}),{k:"Null"};let r=Id(e,t,n);if(r)return r;if(Na(e.name,t))return Rd(e,t,i=>wt(i,t,n));let o=e.args.map(i=>wt(i,t,n)),a=t.cat?.get(e.name);if(a){let i={};for(let s=0;s<a.params.length&&s<o.length;s++)i[a.params[s].name]=o[s];return{...e,args:o,mappedProps:i}}return Ge(t,e.name,"",{code:"unknown-component",available:t.cat&&[...t.cat.keys()]}),{...e,args:o}}case"Arr":return{...e,els:e.els.map(r=>wt(r,t,n))};case"Obj":return{...e,entries:e.entries.map(([r,o])=>[r,wt(o,t,n)])};case"BinOp":return{...e,left:wt(e.left,t,n),right:wt(e.right,t,n)};case"UnaryOp":return{...e,operand:wt(e.operand,t,n)};case"Ternary":return{...e,cond:wt(e.cond,t,n),then:wt(e.then,t,n),else:wt(e.else,t,n)};case"Member":return{...e,obj:wt(e.obj,t,n)};case"Index":return{...e,obj:wt(e.obj,t,n),index:wt(e.index,t,n)};case"Assign":return{...e,value:wt(e.value,t,n)};default:return e}}function Vs(e,t){return wt(e,t,new Set)}function Gn(e,t){switch(e.k){case"Ref":return Cd(e.n,t,"value");case"Str":return e.v;case"Num":return e.v;case"Bool":return e.v;case"Null":return null;case"Ph":return null;case"Arr":{let n=[];for(let r of e.els){if(r.k==="Ph"){t.prunedValues++;continue}let o=Gn(r,t);if(o===null&&(r.k==="Comp"||r.k==="Ref")){t.prunedValues++;continue}n.push(o)}return n}case"Obj":{let n={};for(let[r,o]of e.entries)n[r]=Gn(o,t);return n}case"Comp":{let{name:n,args:r}=e;if(e.fn&&!Na(n,t))return Ge(t,n,"",{code:"unknown-function"}),null;if(Pr(n))return Ge(t,n,"",{code:"inline-reserved"}),null;if(Na(n,t)){let s=Id(e,t,new Set);return s||Rd(e,t,c=>Vs(c,t))}let o=t.cat?.get(n),a={};if(o){let s=!1;for(let p=0;p<o.params.length&&p<r.length;p++){let _=o.params[p],d=t.prunedValues,u=Gn(r[p],t);if(t.prunedValues>d&&Ge(t,n,`/${_.name}`,{code:"pruned-value"}),a[_.name]=u,_.schema===void 0)continue;if(u==null&&_.defaultValue!==void 0){Ge(t,n,`/${_.name}`,{code:"type-mismatch",expected:zs(_.schema)??"a defined value",actual:u===null?"null":"undefined"}),a[_.name]=_.defaultValue,t.prunedValues=d;continue}let f=_o(u,_.schema,n,`/${_.name}`,t);f===kt&&(f=Ma(_.required,_.defaultValue),_.defaultValue!==void 0&&(t.prunedValues=d),f===kt?s=!0:f===void 0&&delete a[_.name]),f!==kt&&f!==void 0&&(a[_.name]=f)}r.length>o.params.length&&Ge(t,n,"",{code:"excess-args",declared:o.params.length,got:r.length});let c=o.params.filter(p=>p.required&&(!(p.name in a)||a[p.name]===null));if(c.length){let p=c.filter(_=>_.defaultValue!==void 0?(Ge(t,n,`/${_.name}`,{code:_.name in a?"null-required":"missing-required"}),a[_.name]=_.defaultValue,!1):!0);if(p.length){for(let _ of p)Ge(t,n,`/${_.name}`,{code:_.name in a?"null-required":"missing-required",signature:js(n,o.params)});return null}}if(s)return null}else return Ge(t,n,"",{code:"unknown-component",available:t.cat&&[...t.cat.keys()]}),null;let i=Object.values(a).some(s=>La(s));return{type:"element",typeName:n,props:a,partial:t.partial,hasDynamicProps:i}}default:return gd(e)?Vs(e,t):e}}function Ks(e){let t=[],n=!1,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(r){r=!1;continue}if(s==="\\"&&n){r=!0;continue}if(n){s===n&&(n=!1);continue}if(s==='"'||s==="'"){n=s;continue}s==="("||s==="["||s==="{"?t.push(s):(s===")"&&t[t.length-1]==="("||s==="]"&&t[t.length-1]==="["||s==="}"&&t[t.length-1]==="{")&&t.pop()}if(!(!!n||t.length>0))return{text:e,wasIncomplete:!1};let a=e;n&&(r&&(a+="\\"),a+=n);for(let i=t.length-1;i>=0;i--)a+=t[i]==="("?")":t[i]==="["?"]":"}";return{text:a,wasIncomplete:!0}}function Oa(e){let t=[],n=0;for(;n<e.length;){for(;n<e.length&&e[n].t===T.Newline;)n++;if(n>=e.length||e[n].t===T.EOF)break;let r=e[n];if(r.t!==T.Ident&&r.t!==T.Type&&r.t!==T.StateVar){for(;n<e.length&&e[n].t!==T.Newline&&e[n].t!==T.EOF;)n++;continue}let o=r.v,a=r.t;if(n++,n>=e.length||e[n].t!==T.Equals){for(;n<e.length&&e[n].t!==T.Newline&&e[n].t!==T.EOF;)n++;continue}n++;let i=[],s=0,c=0;for(;n<e.length&&e[n].t!==T.EOF;){let p=e[n].t;if(p===T.Newline&&s<=0&&c<=0){let _=n+1;for(;_<e.length&&e[_].t===T.Newline;)_++;let d=_<e.length?e[_].t:T.EOF;if(d===T.Question||d===T.Colon&&c>0){n++;continue}break}if(p===T.Newline){n++;continue}p===T.LParen||p===T.LBrack||p===T.LBrace?s++:(p===T.RParen||p===T.RBrack||p===T.RBrace)&&s>0?s--:p===T.Question&&s===0?c++:p===T.Colon&&s===0&&c>0&&c--,i.push(e[n++])}i.length&&t.push({id:o,idTokenType:a,tokens:i})}return t}function Da(e=!0){return{root:null,meta:{incomplete:e,unresolved:[],orphaned:[],statementCount:0,errors:[]},stateDeclarations:{},queryStatements:[],mutationStatements:[]}}function Md(e){if(!Wn(e))return[];let t=new Set;return lo(e,n=>{n.k==="StateRef"&&t.add(n.n)}),[...t]}function Xs(e,t){if(t.k==="Comp"&&t.name===Tn.Query){let n=Md(t.args[1]);return{kind:"query",id:e.id,call:{callee:Tn.Query,args:t.args},expr:t,deps:n.length>0?n:void 0}}return t.k==="Comp"&&t.name===Tn.Mutation?{kind:"mutation",id:e.id,call:{callee:Tn.Mutation,args:t.args},expr:t}:e.idTokenType===T.StateVar?{kind:"state",id:e.id,init:t}:{kind:"value",id:e.id,expr:t}}function Qh(e,t,n){let r={},o=[],a=[];for(let i of e)switch(i.kind){case"state":r[i.id]=Gn(i.init,t);break;case"query":Gs(i.call.args,t,i.id),o.push({statementId:i.id,toolAST:i.call.args[0]??null,argsAST:i.call.args[1]??null,defaultsAST:i.call.args[2]??null,refreshAST:i.call.args[3]??null,deps:i.deps,complete:!0});break;case"mutation":Gs(i.call.args,t,i.id),a.push({statementId:i.id,toolAST:i.call.args[0]??null,argsAST:i.call.args[1]??null});break}for(let i of e){let s=i.kind==="state"?[i.init]:i.kind==="value"?[i.expr]:i.kind==="query"||i.kind==="mutation"?i.call.args:[];for(let c of s)for(let p of Md(c))p===n?.name&&n.stmts.has(i)||p in r||(r[p]=null)}return{stateDeclarations:r,queryStatements:o,mutationStatements:a}}var Ed="root";function Ys(e){return e?.k==="Comp"&&!e.fn&&!uo(e.name)&&!Pr(e.name)}function Xh(e,t){if(e.has(Ed))return{id:Ed,fallback:!1};for(let n of e.values())if(n.kind==="value"&&Ys(n.expr)&&n.expr.name===t)return{id:n.id,fallback:!0};return null}function Jh(e,t){let n=new Set;for(;e?.k==="Ref"&&!n.has(e.n);)n.add(e.n),e=t.get(e.n);return Ys(e)}function Yh(e){let t=!1;return lo(e,n=>{Ys(n)&&(t=!0)}),t}function $a(e,t,n,r,o,a,i){let s=Xh(e,a),c=new Map;for(let[g,h]of e)c.set(g,h.kind==="state"?h.init:h.expr);let p=[],_=[],d=new Set;for(let[g,h]of e)g!==s?.id&&(h.kind==="state"||h.kind==="query"||h.kind==="mutation"||d.add(g));let u={syms:c,cat:o,errors:_,unres:p,prunedValues:0,visited:new Set,partial:n,currentStatementId:s?.id,unreached:d},f=null,m;if(s){let g=Gn(c.get(s.id),u);Jt(g)?(f=g,f.statementId=s.id):Wn(g)&&Yh(g)&&(m=g)}let{stateDeclarations:v,queryStatements:y,mutationStatements:x}=Qh(t,u,i);u.currentStatementId=s?.id;let P=a??"";s?!f&&!m&&!Jh(c.get(s.id),c)?Ge(u,P,"",{code:"no-root",reason:"not-component"}):s.fallback&&Ge(u,P,"",{code:"no-root",reason:f?"fallback":"missing"}):Ge(u,P,"",{code:"no-root",reason:"missing"});let k=s?[...d]:[];return{root:f,...m?{rootExpression:m}:{},meta:{incomplete:n,unresolved:p,orphaned:k,statementCount:r,errors:_},stateDeclarations:v,queryStatements:y,mutationStatements:x}}function Ad(e,t){if(e[t]!=='"')return t;let n=t+1;for(;n<e.length;){let r=e[n];if(r==="\\")n+=2;else{if(r==='"')return n+1;n++}}return n}function Zh(e){let t=[],n=0;for(;n<e.length;){let r=-1;for(;n<e.length;){let s=Ad(e,n);if(s>n){n=s;continue}if(e[n]==="`"&&n+1<e.length&&e[n+1]==="`"&&n+2<e.length&&e[n+2]==="`"){r=n;break}n++}if(r===-1)break;let o=r+3;for(;o<e.length&&e[o]!==`
38
+ `;)o++;if(o>=e.length){t.push(e.slice(r+3).replace(/^[^\n]*\n?/,"")),n=e.length;break}o++;let a=-1,i=o;for(;i<e.length;){let s=Ad(e,i);if(s>i){i=s;continue}if(e[i]==="`"&&i+1<e.length&&e[i+1]==="`"&&i+2<e.length&&e[i+2]==="`"){a=i;break}i++}a!==-1?(t.push(e.slice(o,a)),n=a+3):(t.push(e.slice(o)),n=e.length)}if(t.length>0)return t.join(`
39
39
  `);if(e.startsWith("```")){let r=3;for(;r<e.length&&e[r]!==`
40
- `;)r++;let o=r<e.length?r+1:3,a=e.slice(o),i=a.lastIndexOf("```");return i!==-1?a.slice(0,i):a}return e}function jh(e){let t=!1;return e.split(`
40
+ `;)r++;let o=r<e.length?r+1:3,a=e.slice(o),i=a.lastIndexOf("```");return i!==-1?a.slice(0,i):a}return e}function ev(e){let t=!1;return e.split(`
41
41
  `).map(n=>{for(let r=0;r<n.length;r++){let o=n[r];if(t){if(o==="\\"&&r+1<n.length){r++;continue}o===t&&(t=!1);continue}if(o==='"'||o==="'"){t=o;continue}if(o==="/"&&n[r+1]==="/"||o==="#")return n.substring(0,r).trimEnd()}return n}).join(`
42
- `)}function Td(e){return jh(zh(e.trim())).trim()}function Id(e,t,n){let r=Td(e);if(!r)return Na();let{text:o,wasIncomplete:a}=js(r),i=Ma(Ca(o));if(!i.length)return Na(a);let s=new Map;for(let p of i){let _=wa(p.tokens),d=Ws(p,_);s.set(p.id,d)}let c=[...s.values()];return La(s,c,a,s.size,t,n)}function Rd(e,t){let n="",r="",o=0,a=new Map,i=0;function s(u){let f=u.trim();if(f)for(let m of Ma(Ca(f))){let v=wa(m.tokens),x=Ws(m,v);a.set(m.id,x),i++}}function c(){let u=Td(n);u.startsWith(r.slice(0,o))||(o=0,a.clear(),i=0),r=u}function p(){let u=0,f=0,m=!1,v=!1,x=o;for(let P=o;P<r.length;P++){let b=r[P];if(v){v=!1;continue}if(b==="\\"&&m){v=!0;continue}if(m){b===m&&(m=!1);continue}if(b==='"'||b==="'"){m=b;continue}if(b==="("||b==="["||b==="{")u++;else if(b===")"||b==="]"||b==="}")u=Math.max(0,u-1);else if(b==="?"&&u===0)f++;else if(b===":"&&u===0&&f>0)f--;else if(b===`
43
- `&&u<=0&&f<=0){let C=P+1;for(;C<r.length&&(r[C]===" "||r[C]===" "||r[C]==="\r"||r[C]===`
44
- `);)C++;if(C<r.length&&(r[C]==="?"||r[C]===":"&&f>0))continue;let h=r.slice(x,P).trim();h&&s(h),x=P+1,o=P+1}}return x}function _(u=!1){c();let f=p(),m=r.slice(f).trim();if(!m)return i===0?Na():La(a,[...a.values()],!1,i,e,t);let{text:v,wasIncomplete:x}=js(m),P=Ma(Ca(v));if(!P.length)return i===0?Na(x):La(a,[...a.values()],x,i,e,t);let b=new Map(a),C=new Set;for(let w of P){if(a.has(w.id)&&x)continue;let T=wa(w.tokens),A=Ws(w,T);b.set(w.id,A),C.add(A)}let h=u?void 0:/\$\w+$/.exec(n)?.[0],g=h&&m.endsWith(h)&&!new RegExp(`\\${h}(?!\\w)`).test(m.slice(0,-h.length))?h:void 0,k=[...b.values()];return La(b,k,x,i+P.length,e,t,g?{name:g,stmts:C}:void 0)}function d(){n="",r="",o=0,a.clear(),i=0}return{push(u,f){return n+=u,_(f)},set(u,f){(u.length<n.length||!u.startsWith(n))&&d();let m=u.slice(n.length);return m&&(n+=m),_(f)},getResult:_}}function Gs(e,t){if(!e||typeof e!="object")return e;let n=e.$ref;if(typeof n=="string")return t.has(n)?Gs(t.get(n),t):e;let r=Array.isArray(e)?[...e]:{...e},o=!1;for(let[a,i]of Object.entries(r))r[a]=Gs(i,t),o||(o=r[a]!==i);return o?r:e}function Vs(e,t){let n=e.properties??{},r=e.required??[];return Object.keys(n).map(o=>({name:o,required:r.includes(o),defaultValue:Ia(n[o]),schema:t.size?Gs(n[o],t):n[o]}))}function Ed(e){let t=new Map,n=e.properties&&new Set(Object.keys(e.properties)),r=new Map;for(let o of[...Object.keys(dd),...Object.keys(e.actions??{})]){let a=e.$defs?.[o];a&&!n?.has(o)&&r.set(`#/$defs/${o}`,a)}for(let[o,a]of Object.entries(e.$defs??{}))(n?!n.has(o):r.has(`#/$defs/${o}`))||t.set(o,{params:Vs(a,r)});t.callDefs=new Map(Sa);for(let[o,a]of Object.entries(e.functions??{}))t.callDefs.set(o,{kind:"function",params:Vs(a.params,r)});for(let[o,a]of Object.entries(e.actions??{}))t.callDefs.set(o,{kind:"action",params:Vs(a.params,r)});return t}var Ad=Ed(vr.schema),Vh={parse(e){return Id(e,Ad,vr.root)}};function Md(){return Rd(Ad,vr.root)}function Qs(e,t){let n=e.root?.props.children,r=new Set,o=e.meta,a=e.meta.errors.some(f=>f.severity!=="warning"&&!(f.component==="Grid"&&f.path==="/columns"||f.component==="Cell"&&f.path==="/span"));function i(f,m,v){o===e.meta&&(o={...e.meta,errors:[...e.meta.errors]}),o.errors.push({code:"type-mismatch",component:f.typeName,path:m,message:v,statementId:f.statementId}),a=!0}function s(f,m,v){if(!Xt(f)||typeof f.statementId!="string"||r.has(f.statementId)){i(m,`/children/${v}`,"Child must be a valid, uniquely named component");return}if(f.typeName==="Root"||f.typeName==="Grid"&&m.typeName!=="Root"||f.typeName==="Cell"&&m.typeName==="Cell"){i(m,`/children/${v}`,"Component is not allowed at this nesting level");return}if(r.add(f.statementId),(f.typeName==="Chart"||f.typeName==="Table")&&e.meta.errors.some(b=>b.statementId===f.statementId&&b.severity!=="warning"))return;let x=(f.typeName==="Grid"||f.typeName==="Cell")&&Array.isArray(f.props.children)?f.props.children.flatMap((b,C)=>{let h=s(b,f,C);return h?[h]:[]}):void 0,P=x?{...f,props:{...f.props,children:x}}:f;if(!cd(P)){i(f,"","Component does not match the catalog");return}if(P.typeName==="Table"&&P.props.rows.some(b=>b.length!==P.props.columns.length)){i(f,"/rows","Every table row must contain one value per column");return}if(x?.length!==0&&!((P.typeName==="Chart"||P.typeName==="Table")&&(t||e.meta.incomplete)))return P}let c=e.root,p=c&&Array.isArray(n)?n.flatMap((f,m)=>{if(Xt(f)&&f.typeName==="Cell")return i(c,`/children/${m}`,"Cell must be inside a Grid"),[];let v=s(f,c,m);return v&&v.typeName!=="Cell"?[v]:[]}):[],_=c?.hasDynamicProps===!0||e.queryStatements.length>0||e.mutationStatements.length>0||Object.keys(e.stateDeclarations).length>0||e.meta.errors.some(f=>f.code==="unknown-function"||f.code==="inline-reserved");_&&c&&i(c,"","Executable content is not supported by the static catalog"),c&&c.typeName!==vr.root&&i(c,"","The block must use the catalog root component");let d=_||c!==null&&c.typeName!==vr.root||!t&&(!Array.isArray(n)||p.length===0),u=!t&&!d&&(a||e.meta.incomplete);return!t&&(d||o.errors.length>0||o.unresolved.length>0||o.incomplete)&&console.warn("Generative UI diagnostics",{error:d,partial:u,diagnostics:o}),{elements:d?[]:p,error:d,partial:u,diagnostics:o}}function Ld(e){return Qs(Vh.parse(e),!1).elements.flatMap(Nd).join(`
42
+ `)}function Ld(e){return ev(Zh(e.trim())).trim()}function Nd(e,t,n){let r=Ld(e);if(!r)return Da();let{text:o,wasIncomplete:a}=Ks(r),i=Oa(Ia(o));if(!i.length)return Da(a);let s=new Map;for(let p of i){let _=Ra(p.tokens),d=Xs(p,_);s.set(p.id,d)}let c=[...s.values()];return $a(s,c,a,s.size,t,n)}function Od(e,t){let n="",r="",o=0,a=new Map,i=0;function s(u){let f=u.trim();if(f)for(let m of Oa(Ia(f))){let v=Ra(m.tokens),y=Xs(m,v);a.set(m.id,y),i++}}function c(){let u=Ld(n);u.startsWith(r.slice(0,o))||(o=0,a.clear(),i=0),r=u}function p(){let u=0,f=0,m=!1,v=!1,y=o;for(let x=o;x<r.length;x++){let P=r[x];if(v){v=!1;continue}if(P==="\\"&&m){v=!0;continue}if(m){P===m&&(m=!1);continue}if(P==='"'||P==="'"){m=P;continue}if(P==="("||P==="["||P==="{")u++;else if(P===")"||P==="]"||P==="}")u=Math.max(0,u-1);else if(P==="?"&&u===0)f++;else if(P===":"&&u===0&&f>0)f--;else if(P===`
43
+ `&&u<=0&&f<=0){let k=x+1;for(;k<r.length&&(r[k]===" "||r[k]===" "||r[k]==="\r"||r[k]===`
44
+ `);)k++;if(k<r.length&&(r[k]==="?"||r[k]===":"&&f>0))continue;let g=r.slice(y,x).trim();g&&s(g),y=x+1,o=x+1}}return y}function _(u=!1){c();let f=p(),m=r.slice(f).trim();if(!m)return i===0?Da():$a(a,[...a.values()],!1,i,e,t);let{text:v,wasIncomplete:y}=Ks(m),x=Oa(Ia(v));if(!x.length)return i===0?Da(y):$a(a,[...a.values()],y,i,e,t);let P=new Map(a),k=new Set;for(let w of x){if(a.has(w.id)&&y)continue;let A=Ra(w.tokens),R=Xs(w,A);P.set(w.id,R),k.add(R)}let g=u?void 0:/\$\w+$/.exec(n)?.[0],h=g&&m.endsWith(g)&&!new RegExp(`\\${g}(?!\\w)`).test(m.slice(0,-g.length))?g:void 0,b=[...P.values()];return $a(P,b,y,i+x.length,e,t,h?{name:h,stmts:k}:void 0)}function d(){n="",r="",o=0,a.clear(),i=0}return{push(u,f){return n+=u,_(f)},set(u,f){(u.length<n.length||!u.startsWith(n))&&d();let m=u.slice(n.length);return m&&(n+=m),_(f)},getResult:_}}function Js(e,t){if(!e||typeof e!="object")return e;let n=e.$ref;if(typeof n=="string")return t.has(n)?Js(t.get(n),t):e;let r=Array.isArray(e)?[...e]:{...e},o=!1;for(let[a,i]of Object.entries(r))r[a]=Js(i,t),o||(o=r[a]!==i);return o?r:e}function Qs(e,t){let n=e.properties??{},r=e.required??[];return Object.keys(n).map(o=>({name:o,required:r.includes(o),defaultValue:Aa(n[o]),schema:t.size?Js(n[o],t):n[o]}))}function $d(e){let t=new Map,n=e.properties&&new Set(Object.keys(e.properties)),r=new Map;for(let o of[...Object.keys(hd),...Object.keys(e.actions??{})]){let a=e.$defs?.[o];a&&!n?.has(o)&&r.set(`#/$defs/${o}`,a)}for(let[o,a]of Object.entries(e.$defs??{}))(n?!n.has(o):r.has(`#/$defs/${o}`))||t.set(o,{params:Qs(a,r)});t.callDefs=new Map(Ca);for(let[o,a]of Object.entries(e.functions??{}))t.callDefs.set(o,{kind:"function",params:Qs(a.params,r)});for(let[o,a]of Object.entries(e.actions??{}))t.callDefs.set(o,{kind:"action",params:Qs(a.params,r)});return t}var Dd=$d(yr.schema),tv={parse(e){return Nd(e,Dd,yr.root)}};function Fd(){return Od(Dd,yr.root)}function Zs(e,t){let n=e.root?.props.children,r=new Set,o=e.meta,a=e.meta.errors.some(f=>f.severity!=="warning"&&!(f.component==="Grid"&&f.path==="/columns"||f.component==="Cell"&&f.path==="/span"));function i(f,m,v){o===e.meta&&(o={...e.meta,errors:[...e.meta.errors]}),o.errors.push({code:"type-mismatch",component:f.typeName,path:m,message:v,statementId:f.statementId}),a=!0}function s(f,m,v){if(!Jt(f)||typeof f.statementId!="string"||r.has(f.statementId)){i(m,`/children/${v}`,"Child must be a valid, uniquely named component");return}if(f.typeName==="Root"||f.typeName==="Grid"&&m.typeName!=="Root"||f.typeName==="Cell"&&m.typeName==="Cell"){i(m,`/children/${v}`,"Component is not allowed at this nesting level");return}if(r.add(f.statementId),(f.typeName==="Chart"||f.typeName==="Table")&&e.meta.errors.some(P=>P.statementId===f.statementId&&P.severity!=="warning"))return;let y=(f.typeName==="Grid"||f.typeName==="Cell")&&Array.isArray(f.props.children)?f.props.children.flatMap((P,k)=>{let g=s(P,f,k);return g?[g]:[]}):void 0,x=y?{...f,props:{...f.props,children:y}}:f;if(!md(x)){i(f,"","Component does not match the catalog");return}if(x.typeName==="Table"&&x.props.rows.some(P=>P.length!==x.props.columns.length)){i(f,"/rows","Every table row must contain one value per column");return}if(y?.length!==0&&!((x.typeName==="Chart"||x.typeName==="Table")&&(t||e.meta.incomplete)))return x}let c=e.root,p=c&&Array.isArray(n)?n.flatMap((f,m)=>{if(Jt(f)&&f.typeName==="Cell")return i(c,`/children/${m}`,"Cell must be inside a Grid"),[];let v=s(f,c,m);return v&&v.typeName!=="Cell"?[v]:[]}):[],_=c?.hasDynamicProps===!0||e.queryStatements.length>0||e.mutationStatements.length>0||Object.keys(e.stateDeclarations).length>0||e.meta.errors.some(f=>f.code==="unknown-function"||f.code==="inline-reserved");_&&c&&i(c,"","Executable content is not supported by the static catalog"),c&&c.typeName!==yr.root&&i(c,"","The block must use the catalog root component");let d=_||c!==null&&c.typeName!==yr.root||!t&&(!Array.isArray(n)||p.length===0),u=!t&&!d&&(a||e.meta.incomplete);return!t&&(d||o.errors.length>0||o.unresolved.length>0||o.incomplete)&&console.warn("Generative UI diagnostics",{error:d,partial:u,diagnostics:o}),{elements:d?[]:p,error:d,partial:u,diagnostics:o}}function Bd(e){return Zs(tv.parse(e),!1).elements.flatMap(Hd).join(`
45
45
 
46
- `)}function Nd(e){return e.typeName==="Grid"||e.typeName==="Cell"?e.props.children.flatMap(Nd):e.typeName==="Text"?[e.props.text]:e.typeName==="Card"?[`${e.props.title}
46
+ `)}function Hd(e){return e.typeName==="Grid"||e.typeName==="Cell"?e.props.children.flatMap(Hd):e.typeName==="Text"?[e.props.text]:e.typeName==="Card"?[`${e.props.title}
47
47
  ${e.props.body}`]:e.typeName==="Metric"?[[e.props.label,e.props.value,e.props.detail].filter(Boolean).join(`
48
48
  `)]:e.typeName==="Table"?[[e.props.title,e.props.columns.join(" "),...e.props.rows.map(t=>t.join(" "))].join(`
49
49
  `)]:[[e.props.title,...e.props.data.map(t=>`${t.label}: ${t.value}`)].join(`
50
- `)]}function Js(e,{cssPrefix:t,strings:n}){let r=[],o;return{...io(e),set_attr(a,i,s){if(i!==oo||s!=="openui"||a.index!==1)return $s(a,i,s);let c=document.createElement("div");a.nodes[a.index]?.parentElement?.replaceWith(c),o={textSig:le(""),doneSig:le(!1)},r.push(c),Qt(l(Gh,{cssPrefix:t,textSig:o.textSig,doneSig:o.doneSig,strings:n}),c)},add_text(a,i){o?o.textSig.value=o.textSig.peek()+i:Os(a,i)},end_token(a){o&&(o.doneSig.value=!0,o=void 0),Ns(a)},finish(){o&&(o.doneSig.value=!0)},dispose(){for(let a of r)Qt(null,a);r.length=0,o=void 0}}}function Gh({textSig:e,doneSig:t,cssPrefix:n,strings:r}){let o=ue(()=>{let a=Md();return Se(()=>Qs(a.set(e.value,t.value),!t.value))},[e,t]);return o.value.error?l("div",{role:"alert",children:r.visualError}):l("div",{class:`${n}-generative-ui`,"aria-busy":!t.value,children:[o.value.elements.map(a=>l(Xs,{element:a,cssPrefix:n},a.statementId)),o.value.partial&&l("p",{role:"status",children:r.visualPartial}),o.value.elements.length===0&&!t.value?l("span",{role:"status",children:r.visualPreparing}):null]})}function Xs({element:e,cssPrefix:t}){if(e.typeName==="Grid")return l("div",{class:`${t}-generative-ui-grid-container`,children:l("div",{class:`${t}-generative-ui-grid`,"data-columns":e.props.columns,children:e.props.children.map(n=>l("div",{class:`${t}-generative-ui-cell`,"data-span":n.typeName==="Cell"?n.props.span??1:1,children:n.typeName==="Cell"?n.props.children.map(r=>l(Xs,{element:r,cssPrefix:t},r.statementId)):l(Xs,{element:n,cssPrefix:t})},n.statementId))})});switch(e.typeName){case"Text":return l("p",{children:e.props.text});case"Card":return l("section",{children:[l("strong",{children:e.props.title}),l("p",{children:e.props.body})]});case"Metric":return l("section",{children:[l("strong",{children:e.props.label}),l("span",{class:`${t}-generative-ui-metric`,children:e.props.value}),e.props.detail&&l("p",{children:e.props.detail})]});case"Table":return l("section",{children:l("div",{class:`${t}-generative-ui-table`,children:l("table",{children:[l("caption",{children:e.props.title}),l("thead",{children:l("tr",{children:e.props.columns.map((n,r)=>l("th",{scope:"col",children:n},r))})}),l("tbody",{children:e.props.rows.map((n,r)=>l("tr",{children:n.map((o,a)=>l("td",{children:o},a))},r))})]})})});case"Chart":return l(Kh,{element:e,cssPrefix:t})}}function Kh({element:e,cssPrefix:t}){let n=Math.min(0,...e.props.data.map(s=>s.value)),o=Math.max(0,...e.props.data.map(s=>s.value))-n||1,a=148+n/o*136,i=e.props.data.map((s,c)=>({x:24+(c+.5)*272/e.props.data.length,y:148-(s.value-n)/o*136}));return l("section",{children:[l("strong",{children:e.props.title}),l("svg",{class:`${t}-generative-ui-chart`,viewBox:"0 0 320 168",role:"img","aria-label":`${e.props.title}. ${e.props.data.map(s=>`${s.label}: ${s.value}`).join(", ")}`,children:[l("line",{class:`${t}-generative-ui-axis`,x1:24,x2:296,y1:a,y2:a}),e.props.type==="line"&&l("polyline",{points:i.map(s=>`${s.x},${s.y}`).join(" "),fill:"none",stroke:"currentColor","stroke-width":3}),i.map((s,c)=>e.props.type==="bar"?l("rect",{x:s.x-96/e.props.data.length,y:Math.min(s.y,a),width:192/e.props.data.length,height:Math.abs(s.y-a),fill:"currentColor"},c):l("circle",{cx:s.x,cy:s.y,r:3,fill:"currentColor"},c))]}),l("div",{class:`${t}-generative-ui-data`,children:e.props.data.map((s,c)=>l("span",{children:[s.label,": ",s.value]},c))})]})}function Oa(e){if(!e.includes("```openui"))return e;let t="",n=0,r=0,o=0,a=0,i;function s(p){i?.language==="openui"&&(t+=e.slice(n,i.start)+Ld(i.source)+(e[p-1]===`
50
+ `)]}function tl(e,{cssPrefix:t,strings:n}){let r=[],o;return{...io(e),set_attr(a,i,s){if(i!==oo||s!=="openui"||a.index!==1)return Hs(a,i,s);let c=document.createElement("div");a.nodes[a.index]?.parentElement?.replaceWith(c),o={textSig:se(""),doneSig:se(!1)},r.push(c),Xt(l(rv,{cssPrefix:t,textSig:o.textSig,doneSig:o.doneSig,strings:n}),c)},add_text(a,i){o?o.textSig.value=o.textSig.peek()+i:Bs(a,i)},end_token(a){o&&(o.doneSig.value=!0,o=void 0),Fs(a)},finish(){o&&(o.doneSig.value=!0)},dispose(){for(let a of r)Xt(null,a);r.length=0,o=void 0}}}function rv({textSig:e,doneSig:t,cssPrefix:n,strings:r}){let o=le(()=>{let a=Fd();return he(()=>Zs(a.set(e.value,t.value),!t.value))},[e,t]);return o.value.error?l("div",{role:"alert",children:r.visualError}):l("div",{class:`${n}-generative-ui`,"aria-busy":!t.value,children:[o.value.elements.map(a=>l(el,{element:a,cssPrefix:n},a.statementId)),o.value.partial&&l("p",{role:"status",children:r.visualPartial}),o.value.elements.length===0&&!t.value?l("span",{role:"status",children:r.visualPreparing}):null]})}function el({element:e,cssPrefix:t}){if(e.typeName==="Grid")return l("div",{class:`${t}-generative-ui-grid-container`,children:l("div",{class:`${t}-generative-ui-grid`,"data-columns":e.props.columns,children:e.props.children.map(n=>l("div",{class:`${t}-generative-ui-cell`,"data-span":n.typeName==="Cell"?n.props.span??1:1,children:n.typeName==="Cell"?n.props.children.map(r=>l(el,{element:r,cssPrefix:t},r.statementId)):l(el,{element:n,cssPrefix:t})},n.statementId))})});switch(e.typeName){case"Text":return l("p",{children:e.props.text});case"Card":return l("section",{children:[l("strong",{children:e.props.title}),l("p",{children:e.props.body})]});case"Metric":return l("section",{children:[l("strong",{children:e.props.label}),l("span",{class:`${t}-generative-ui-metric`,children:e.props.value}),e.props.detail&&l("p",{children:e.props.detail})]});case"Table":return l("section",{children:l("div",{class:`${t}-generative-ui-table`,children:l("table",{children:[l("caption",{children:e.props.title}),l("thead",{children:l("tr",{children:e.props.columns.map((n,r)=>l("th",{scope:"col",children:n},r))})}),l("tbody",{children:e.props.rows.map((n,r)=>l("tr",{children:n.map((o,a)=>l("td",{children:o},a))},r))})]})})});case"Chart":return l(ov,{element:e,cssPrefix:t})}}function ov({element:e,cssPrefix:t}){let n=Math.min(0,...e.props.data.map(s=>s.value)),o=Math.max(0,...e.props.data.map(s=>s.value))-n||1,a=148+n/o*136,i=e.props.data.map((s,c)=>({x:24+(c+.5)*272/e.props.data.length,y:148-(s.value-n)/o*136}));return l("section",{children:[l("strong",{children:e.props.title}),l("svg",{class:`${t}-generative-ui-chart`,viewBox:"0 0 320 168",role:"img","aria-label":`${e.props.title}. ${e.props.data.map(s=>`${s.label}: ${s.value}`).join(", ")}`,children:[l("line",{class:`${t}-generative-ui-axis`,x1:24,x2:296,y1:a,y2:a}),e.props.type==="line"&&l("polyline",{points:i.map(s=>`${s.x},${s.y}`).join(" "),fill:"none",stroke:"currentColor","stroke-width":3}),i.map((s,c)=>e.props.type==="bar"?l("rect",{x:s.x-96/e.props.data.length,y:Math.min(s.y,a),width:192/e.props.data.length,height:Math.abs(s.y-a),fill:"currentColor"},c):l("circle",{cx:s.x,cy:s.y,r:3,fill:"currentColor"},c))]}),l("div",{class:`${t}-generative-ui-data`,children:e.props.data.map((s,c)=>l("span",{children:[s.label,": ",s.value]},c))})]})}function Fa(e){if(!e.includes("```openui"))return e;let t="",n=0,r=0,o=0,a=0,i;function s(p){i?.language==="openui"&&(t+=e.slice(n,i.start)+Bd(i.source)+(e[p-1]===`
51
51
  `?`
52
- `:""),n=p),i=void 0}let c=hr({data:void 0,add_token(p,_){a+=1,_===10&&a===1&&(i={start:o,source:"",language:""})},set_attr(p,_,d){i&&_===oo&&(i.language=d)},add_text(p,_){i&&(i.source+=_)},end_token(){i&&s(Math.min(r+1,e.length)),a-=1}});for(;r<e.length;r++)Xe(c,e.charAt(r)),e[r]===`
53
- `&&(o=r+1);return ao(c),i&&s(e.length),t+e.slice(n)}function Od(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function Qh(e){return`tool-${e.startsWith("tool:")?e.slice(5):e}`}function $d(e){return e.startsWith("tool-")?e.slice(5):e}var ct={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",contentCollections:"/pai/content/collection/list",contentVoteSet:"/pai/content/vote/set",submitForm:"/pai/submit-form"},Ys="context";function $a(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Dd(e){if(!$a(e))return;let t=e,n=t.controlMode,r=t.controlRevision;if(!(n!=="ai-agent"&&n!=="awaiting-operator"&&n!=="operator"||typeof r!="number"||!Number.isSafeInteger(r)||r<0))return{controlMode:n,controlRevision:r,assignedOperatorInitials:typeof t.assignedOperatorInitials=="string"&&t.assignedOperatorInitials?t.assignedOperatorInitials:void 0,operatorAvailable:typeof t.operatorAvailable=="boolean"?t.operatorAvailable:void 0}}function Fd(e){if(!$a(e))return;let t=e.status,n=e.postFinishSequence;if(!(t!=="compacting"&&t!=="ready"||typeof n!="number"||!Number.isSafeInteger(n)||n<0))return{status:t,postFinishSequence:n}}function Da(e){let t=$a(e)?e.suggestions:void 0;if(!Array.isArray(t))return[];let n=[];for(let r of t){if(!$a(r))continue;let{id:o,label:a,text:i}=r;typeof a!="string"||!a||n.push({id:typeof o=="string"&&o?o:`s${n.length}`,label:a,text:typeof i=="string"&&i?i:a})}return n}function Zs(e){let n={messages:e.messages.map(r=>({id:r.serverMessageId??r.id,parts:Jh(r),role:r.role})),conversationId:e.conversationId,responseType:"ack"};return e.visitorId&&(n.visitorId=e.visitorId),e.userPrefs&&(n.userPrefs=e.userPrefs),e.clientTools?.length&&(n.clientTools=e.clientTools),n}function Xh(e){return e.state==="output-available"||e.state==="output-error"||e.state==="output-denied"||e.approval?.approved!==void 0}function Jh(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,filename:n.filename,fileId:n.fileId,fileSize:n.fileSize}),n.kind==="tool"&&Xh(n)){let r=n.dynamic?{type:"dynamic-tool",toolName:n.toolName,toolCallId:n.toolCallId,state:n.state}:{type:Qh(n.toolName),toolCallId:n.toolCallId,state:n.state};n.input!==void 0&&(r.input=n.input),n.output!==void 0&&(r.output=n.output),n.error!==void 0&&(r.errorText=n.error),n.approval?.approved!==void 0&&(r.approval=n.approval),n.toolMetadata&&(r.toolMetadata=n.toolMetadata),t.push(r)}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}function tl(e,t,n=It()){let r=e?[{kind:"text",id:"t0",textSig:le(e),doneSig:le(!0)}]:[];return{id:n,role:"user",createdAt:Date.now(),status:"complete",attachments:t,partsSig:le(r)}}function un(){return{id:It(),role:"assistant",createdAt:Date.now(),status:"streaming",partsSig:le([])}}function Ud(e){let t=It();return Yh({id:t,role:e.role,createdAt:Date.now(),status:"complete",ephemeral:!0,parts:[{kind:"text",id:`${t}-t0`,text:e.text,done:!0}]})}function Yh(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:le(e.parts.map(iv))}}function Zh(e){return e.status==="failed"?"error":e.role==="assistant"&&e.status==="streaming"?"streaming":"complete"}function nl(e){let t=new Set,n=e.parts.map((o,a)=>o.type==="text"?{kind:"text",id:`${e.id}-t${a}`,textSig:le(o.text),doneSig:le(!0)}:o.type==="reasoning"?{kind:"reasoning",id:`${e.id}-r${a}`,textSig:le(o.text),doneSig:le(o.state!=="streaming")}:o.type==="step-start"?{kind:"step-start",id:`${e.id}-ss${a}`}:o.type==="file"?{kind:"file",url:o.url,mediaType:o.mediaType,filename:o.filename,fileId:o.fileId,fileSize:o.fileSize}:o.type==="source-url"?{kind:"source",sourceId:o.sourceId,url:o.url,title:o.title}:o.type==="source-document"?{kind:"source",sourceId:o.sourceId,title:o.title,filename:o.filename,mediaType:o.mediaType}:o.type==="data-suggestions"?null:o.type==="dynamic-tool"||o.type.startsWith("tool-")?{kind:"tool",toolCallId:o.toolCallId,toolName:o.type==="dynamic-tool"?o.toolName:$d(o.type),dynamic:o.type==="dynamic-tool"?!0:void 0,toolMetadata:o.toolMetadata,inputPartialSig:le(""),inputSig:le(o.input),outputSig:le(o.output),errorSig:le(o.errorText),stateSig:le(o.state),approvalSig:le(o.approval)}:null).filter(o=>o!==null).filter(o=>o.kind!=="source"?!0:t.has(o.sourceId)?!1:(t.add(o.sourceId),!0)),r=e.parts.find(o=>o.type==="data-suggestions");return{id:e.id,role:e.role,operatorInitials:e.operatorInitials,suggestions:r?.type==="data-suggestions"?Da(r.data):void 0,serverMessageId:e.id,createdAt:Date.parse(e.createdAt),status:Zh(e),canceled:e.status==="canceled",feedback:e.feedback??null,partsSig:le(n)}}function ev(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 tv(e){return e.role==="assistant"&&e.status==="streaming"&&ev(e)}function Tn(e){let t=e.length-1;return e.filter((n,r)=>r===t||!tv(n)).map(nl)}function Hd(e,t){let n=!t&&e.at(-1)?.role==="assistant"?-2:-1,r=e.at(n);return!r||r.ephemeral?[]:[r]}function rl(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(sv)}}function Ve(e){let t="";for(let n of e.partsSig.value)n.kind==="text"&&(t+=n.textSig.value);return t}function Fa(e,t,n,r,o,a=t.createdAt){let i=e.find(_=>_.role==="user"&&!_.ephemeral);function s(_,d){return(_.role==="assistant"?Oa(Ve(_)):Ve(_)).replace(/\s+/g," ").trim().slice(0,d)}let c=i?s(i,80):"",p=s(t,120);return{conversationId:n,title:c||r,lastMessageAt:new Date(a).toISOString(),preview:p||void 0,canContinue:o}}function Gt(e){return Ve(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file"||t.kind==="source")}function nv(e){return Ve(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file")}function ol(e){return e==="approval-responded"||e==="output-available"||e==="output-denied"||e==="output-error"}function cn(e){return e.kind==="tool"}function qd(e){return e.kind==="text"&&e.textSig.value.trim()!==""||e.kind==="file"}function fo(e){let t=e.partsSig.value,n=t.findLastIndex(r=>r.kind==="tool");return t.slice(n+1).some(qd)}function Kn(e){if(e.role!=="assistant")return!1;let t=e.partsSig.value.filter(cn);return t.length>0&&t.every(n=>ol(n.stateSig.value))}function Qn(e){return e.role!=="assistant"?!1:e.partsSig.value.some(t=>t.kind==="tool")&&!fo(e)}function Ba(e,t){return!e.partsSig.value.slice(t+1).some(n=>n.kind==="step-start"||qd(n))}function Ua(e){return e.partsSig.value.some(t=>cn(t)&&!ol(t.stateSig.value))}function zd(e,t){if(t.length===0)return e;let n=new Set;for(let i of e)n.add(i.id),i.serverMessageId&&n.add(i.serverMessageId);let r=t.filter(i=>{let s=[i.id,i.serverMessageId].filter(c=>c!==void 0);return s.some(c=>n.has(c))?!1:(s.forEach(c=>n.add(c)),!0)});if(r.length===0)return e;let o=e.findIndex(i=>!i.ephemeral),a=o<0?e.length:o;return[...e.slice(0,a),...r,...e.slice(a)]}function Wn(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 jd(e,t,n,r){if(!al(e))return;if(t.length===0){let i=Math.max(...r.values());return n.find(s=>s.role==="assistant"&&r.get(s.serverMessageId??s.id)===i&&Ve(s).length>=Ve(e).length)}let o=t.at(-1);if(o?.role!=="user")return;let a=r.get(o.serverMessageId??o.id);if(a!==void 0)return n.find(i=>i.role==="assistant"&&r.get(i.serverMessageId??i.id)===a+1&&Ve(i).length>=Ve(e).length)}function al(e){return e?.role==="assistant"&&e.status==="streaming"&&e.serverMessageId===void 0}function rv(e,t){let n=e.partsSig.value,r=t.partsSig.value,o=new Map(r.flatMap((c,p)=>cn(c)?[[c.toolCallId,p]]:[])),a=n.findIndex(c=>cn(c)&&o.has(c.toolCallId)),i=n[a];if(i===void 0||!cn(i))return;let s=(o.get(i.toolCallId)??0)-a;s>0&&(e.partsSig.value=[...r.slice(0,s),...n])}function ov(e,t){let n=new Map(t.partsSig.value.filter(cn).filter(a=>ol(a.stateSig.value)).map(a=>[a.toolCallId,a]));if(n.size===0)return;let r=!1,o=e.partsSig.value.map(a=>{if(!cn(a))return a;let i=n.get(a.toolCallId);if(!i)return a;let s=a.approvalSig.value,c=i.approvalSig.value,p=s===void 0||s.approved===void 0&&c?.approved!==void 0?i.approvalSig:a.approvalSig,_=a.inputSig.value===void 0?i.inputSig:a.inputSig,d=a.toolName==="tool"?i.toolName:a.toolName,u=a.dynamic??i.dynamic,f=a.toolMetadata??i.toolMetadata;return p===a.approvalSig&&_===a.inputSig&&d===a.toolName&&u===a.dynamic&&f===a.toolMetadata?a:(r=!0,{...a,toolName:d,dynamic:u,toolMetadata:f,inputSig:_,approvalSig:p})});r&&(e.partsSig.value=o)}function il(e,t){let n=t.filter(d=>!d.ephemeral&&(d.status==="streaming"||d.status==="pending"||d.status==="error"||d.retryAction!==void 0||(d.attachments?.length??0)>0||Gt(d))),r=new Map;for(let d of n)r.set(d.id,d),d.serverMessageId!==void 0&&r.set(d.serverMessageId,d);let o=new Set,a=[],i=e.map(d=>{let u=(d.serverMessageId!==void 0?r.get(d.serverMessageId):void 0)??r.get(d.id);return u===void 0?(a.push(d),d):(o.add(u),u.role!==d.role?d:u.role==="user"&&u.serverMessageId===void 0&&(u.status==="pending"||u.status==="error")?Wn(u,d):u.status==="streaming"||Ve(u).length>=Ve(d).length?(rv(u,d),ov(u,d),u.suggestions??(u.suggestions=d.suggestions),u.feedback===void 0&&(u.feedback=d.feedback),d.canceled&&(u.canceled=!0),u):Wn(u,d))}),s=n.filter(d=>!o.has(d)),c=s.findLast(al),p=new Map;e.forEach((d,u)=>{p.set(d.id,u),d.serverMessageId!==void 0&&p.set(d.serverMessageId,u)});let _=jd(c,c?n.slice(0,n.indexOf(c)):[],a,p);if(c&&_){let d=i.indexOf(_);d>=0&&(i[d]=Wn(c,_)),s=s.filter(u=>u!==c)}return[...i,...s]}function mo(e,t){let n=new Map(t.filter(d=>d.serverMessageId!==void 0).map(d=>[d.serverMessageId,d])),r=new Map;t.forEach((d,u)=>{r.set(d.id,u),d.serverMessageId!==void 0&&r.set(d.serverMessageId,u)});let o=new Set(e.flatMap(d=>[d.serverMessageId,d.id].filter(u=>u!==void 0))),a=!1,i=e.map(d=>{let u=n.get(d.serverMessageId??d.id);if(u===void 0||u.role!==d.role)return d;if(d.role==="user"&&d.serverMessageId===void 0)return a=!0,Wn(d,u);if(d.serverMessageId===void 0)return d;let f=Ve(u),m=Ve(d),v=u.status!=="streaming"&&f.length>=m.length&&el(d,u);if(f.length>m.length||f===m&&u.partsSig.value.length>d.partsSig.value.length||v)return a=!0,Wn(d,u);if(d.status==="streaming"&&u.status!=="streaming"&&av(d,u)){if(d.continuationStreaming&&Ua(u))return d;if(!el(u,d))return a=!0,Wn(d,u)}return d}),s=[...n.values()].filter(d=>!o.has(d.serverMessageId)),c=i.findLastIndex(al),p=i[c],_=jd(p,i.slice(0,c),s,r);if(p!==void 0&&_!==void 0&&Ve(_).length>=Ve(p).length&&(Wn(p,_),i[c]=_,s.splice(s.indexOf(_),1),a=!0),s.length===0)return{messages:a?i:e,changed:a};for(let d of s){let u=r.get(d.serverMessageId??d.id),f=!1,m=i.findIndex(v=>{let x=r.get(v.serverMessageId??v.id);return u===void 0?!1:x===void 0?f:x>u?!0:(f=!0,!1)});m===-1?i.push(d):i.splice(m,0,d)}return{messages:i,changed:!0}}function Vd(e,t){if(e.role!==t.role)return!1;let n=Ve(t),r=Ve(e);return n.length>r.length||t.partsSig.value.length>e.partsSig.value.length||el(e,t)}function av(e,t){let n=e.partsSig.value,r=t.partsSig.value;return n.length!==r.length?!1:n.every((o,a)=>{let i=r[a];switch(o.kind){case"text":return i?.kind==="text"&&i.textSig.value===o.textSig.value;case"reasoning":return i?.kind==="reasoning"&&i.textSig.value===o.textSig.value;case"step-start":return i?.kind==="step-start";case"tool":return i?.kind==="tool"&&i.toolCallId===o.toolCallId&&Ha(i.toolName,o.toolName);case"file":return i?.kind==="file"&&i.url===o.url&&i.mediaType===o.mediaType;case"source":return i?.kind==="source"&&i.sourceId===o.sourceId&&i.url===o.url&&i.title===o.title&&i.filename===o.filename&&i.mediaType===o.mediaType;default:return o}})}function Ha(e,t){let n=e.startsWith("tool:")?e.slice(5):e,r=t.startsWith("tool:")?t.slice(5):t;return n===r}var Bd={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function el(e,t){let n=new Map(e.partsSig.value.filter(cn).map(r=>[r.toolCallId,r]));return t.partsSig.value.filter(cn).some(r=>{let o=n.get(r.toolCallId);if(!o||Bd[r.stateSig.value]>Bd[o.stateSig.value])return!0;let a=r.approvalSig.value?.approved;return a!==void 0&&a!==o.approvalSig.value?.approved})}function Gn(e){return e.role==="assistant"&&e.status!=="streaming"&&!Gt(e)}function qa(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"&&!Gn(t))return;let n=e.indexOf(t);for(let r=n-1;r>=0;r--){let o=e[r];if(o?.role==="user"&&!o.ephemeral)return{kind:"repeat-user",messageId:o.id}}}function Wd(e){return e.canceled===!0&&e.role==="assistant"&&e.status!=="streaming"&&!nv(e)}function Gd(e,t){return e.operatorRoutedTurn?Gn(e)?"drop":"complete-operator-routed":t||Gn(e)?"error":"complete"}function iv(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,textSig:le(e.text),doneSig:le(e.done)}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,dynamic:e.dynamic,toolMetadata:e.toolMetadata,inputPartialSig:le(e.inputPartial),inputSig:le(e.input),outputSig:le(e.output),errorSig:le(e.error),stateSig:le(e.state),approvalSig:le(e.approval)}:e}function sv(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,toolMetadata:e.toolMetadata,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}function lv(e){let t=new TextEncoder().encode(e),n="";for(let r of t)n+=String.fromCharCode(r);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Kd(e){return e&&Object.keys(e).length>0?e:void 0}function sl(e,t,n=[]){let r=Kd(e),o=Kd(t),a=Date.now();for(let i=n.length;;i-=1){let s=n.slice(n.length-i).map(({name:_,data:d,at:u})=>({name:_,data:d,secondsAgo:Math.round((a-u)/1e3)})),c=s.length>0?{...o,recentEvents:s}:o;if(!r&&!c)return;let p=lv(JSON.stringify({...r&&{user:r},...c&&{page:c}}));if(p.length<=8192||i===0)return p}}var ut=class extends Error{constructor(n,r,o,a){super(n);oe(this,"code",r);oe(this,"status",o);oe(this,"cause",a);this.name="StreamError"}};var Qd=Z.scope("parser");async function*Xd(e,t,n){if(!e.ok){let r=await e.text().catch(()=>"");throw new ut(`server responded ${e.status}: ${r.slice(0,200)}`,"server",e.status)}for await(let r of cv(e,t)){let o=uv(r,n);if(o==="done")return;o&&(yield o)}}async function*cv(e,t){if(!e.body)throw new ut("response has no body","no-body");let n=e.body.pipeThrough(new TextDecoderStream).getReader(),r="";try{for(;;){if(t.aborted)throw new DOMException("aborted","AbortError");let{done:o,value:a}=await n.read();if(o){let s=r.trim();s&&(yield s);return}r+=a;let i;for(;(i=r.indexOf(`
52
+ `:""),n=p),i=void 0}let c=br({data:void 0,add_token(p,_){a+=1,_===10&&a===1&&(i={start:o,source:"",language:""})},set_attr(p,_,d){i&&_===oo&&(i.language=d)},add_text(p,_){i&&(i.source+=_)},end_token(){i&&s(Math.min(r+1,e.length)),a-=1}});for(;r<e.length;r++)et(c,e.charAt(r)),e[r]===`
53
+ `&&(o=r+1);return ao(c),i&&s(e.length),t+e.slice(n)}function Ud(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function av(e){return`tool-${e.startsWith("tool:")?e.slice(5):e}`}function qd(e){return e.startsWith("tool-")?e.slice(5):e}var pt={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",contentCollections:"/pai/content/collection/list",contentVoteSet:"/pai/content/vote/set",submitForm:"/pai/submit-form"},nl="context";function Ba(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function zd(e){if(!Ba(e))return;let t=e,n=t.controlMode,r=t.controlRevision;if(!(n!=="ai-agent"&&n!=="awaiting-operator"&&n!=="operator"||typeof r!="number"||!Number.isSafeInteger(r)||r<0))return{controlMode:n,controlRevision:r,assignedOperatorInitials:typeof t.assignedOperatorInitials=="string"&&t.assignedOperatorInitials?t.assignedOperatorInitials:void 0,operatorAvailable:typeof t.operatorAvailable=="boolean"?t.operatorAvailable:void 0}}function jd(e){if(!Ba(e))return;let t=e.status,n=e.postFinishSequence;if(!(t!=="compacting"&&t!=="ready"||typeof n!="number"||!Number.isSafeInteger(n)||n<0))return{status:t,postFinishSequence:n}}function Ha(e){let t=Ba(e)?e.suggestions:void 0;if(!Array.isArray(t))return[];let n=[];for(let r of t){if(!Ba(r))continue;let{id:o,label:a,text:i}=r;typeof a!="string"||!a||n.push({id:typeof o=="string"&&o?o:`s${n.length}`,label:a,text:typeof i=="string"&&i?i:a})}return n}function rl(e){let n={messages:e.messages.map(r=>({id:r.serverMessageId??r.id,parts:sv(r),role:r.role})),conversationId:e.conversationId,responseType:"ack"};return e.visitorId&&(n.visitorId=e.visitorId),e.userPrefs&&(n.userPrefs=e.userPrefs),e.clientTools?.length&&(n.clientTools=e.clientTools),n}function iv(e){return e.state==="output-available"||e.state==="output-error"||e.state==="output-denied"||e.approval?.approved!==void 0}function sv(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,filename:n.filename,fileId:n.fileId,fileSize:n.fileSize}),n.kind==="tool"&&iv(n)){let r=n.dynamic?{type:"dynamic-tool",toolName:n.toolName,toolCallId:n.toolCallId,state:n.state}:{type:av(n.toolName),toolCallId:n.toolCallId,state:n.state};n.input!==void 0&&(r.input=n.input),n.output!==void 0&&(r.output=n.output),n.error!==void 0&&(r.errorText=n.error),n.approval?.approved!==void 0&&(r.approval=n.approval),n.toolMetadata&&(r.toolMetadata=n.toolMetadata),t.push(r)}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}function al(e,t,n=Rt()){let r=e?[{kind:"text",id:"t0",textSig:se(e),doneSig:se(!0)}]:[];return{id:n,role:"user",createdAt:Date.now(),status:"complete",attachments:t,partsSig:se(r)}}function un(){return{id:Rt(),role:"assistant",createdAt:Date.now(),status:"streaming",partsSig:se([])}}function Gd(e){let t=Rt();return lv({id:t,role:e.role,createdAt:Date.now(),status:"complete",ephemeral:!0,parts:[{kind:"text",id:`${t}-t0`,text:e.text,done:!0}]})}function lv(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:se(e.parts.map(mv))}}function cv(e){return e.status==="failed"?"error":e.role==="assistant"&&e.status==="streaming"?"streaming":"complete"}function il(e){let t=new Set,n=e.parts.map((o,a)=>o.type==="text"?{kind:"text",id:`${e.id}-t${a}`,textSig:se(o.text),doneSig:se(!0)}:o.type==="reasoning"?{kind:"reasoning",id:`${e.id}-r${a}`,textSig:se(o.text),doneSig:se(o.state!=="streaming")}:o.type==="step-start"?{kind:"step-start",id:`${e.id}-ss${a}`}:o.type==="file"?{kind:"file",url:o.url,mediaType:o.mediaType,filename:o.filename,fileId:o.fileId,fileSize:o.fileSize}:o.type==="source-url"?{kind:"source",sourceId:o.sourceId,url:o.url,title:o.title}:o.type==="source-document"?{kind:"source",sourceId:o.sourceId,title:o.title,filename:o.filename,mediaType:o.mediaType}:o.type==="data-suggestions"?null:o.type==="dynamic-tool"||o.type.startsWith("tool-")?{kind:"tool",toolCallId:o.toolCallId,toolName:o.type==="dynamic-tool"?o.toolName:qd(o.type),dynamic:o.type==="dynamic-tool"?!0:void 0,toolMetadata:o.toolMetadata,inputPartialSig:se(""),inputSig:se(o.input),outputSig:se(o.output),errorSig:se(o.errorText),stateSig:se(o.state),approvalSig:se(o.approval)}:null).filter(o=>o!==null).filter(o=>o.kind!=="source"?!0:t.has(o.sourceId)?!1:(t.add(o.sourceId),!0)),r=e.parts.find(o=>o.type==="data-suggestions");return{id:e.id,role:e.role,operatorInitials:e.operatorInitials,suggestions:r?.type==="data-suggestions"?Ha(r.data):void 0,serverMessageId:e.id,createdAt:Date.parse(e.createdAt),status:cv(e),canceled:e.status==="canceled",feedback:e.feedback??null,stepTimings:Ua(e.metadata?.steps),partsSig:se(n)}}function Ua(e){if(!(!e?.length||!e.every(t=>Vd(t.durationMs))))return e.map(({durationMs:t,reasoningMs:n})=>({durationMs:Number(t),...Vd(n)?{reasoningMs:n}:{}}))}function Vd(e){return typeof e=="number"&&Number.isFinite(e)}function uv(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 dv(e){return e.role==="assistant"&&e.status==="streaming"&&uv(e)}function Rn(e){let t=e.length-1;return e.filter((n,r)=>r===t||!dv(n)).map(il)}function Kd(e,t){let n=!t&&e.at(-1)?.role==="assistant"?-2:-1,r=e.at(n);return!r||r.ephemeral?[]:[r]}function sl(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(gv)}}function Je(e){let t="";for(let n of e.partsSig.value)n.kind==="text"&&(t+=n.textSig.value);return t}function qa(e,t,n,r,o,a=t.createdAt){let i=e.find(_=>_.role==="user"&&!_.ephemeral);function s(_,d){return(_.role==="assistant"?Fa(Je(_)):Je(_)).replace(/\s+/g," ").trim().slice(0,d)}let c=i?s(i,80):"",p=s(t,120);return{conversationId:n,title:c||r,lastMessageAt:new Date(a).toISOString(),preview:p||void 0,canContinue:o}}function Gt(e){return Je(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file"||t.kind==="source")}function ll(e){return Je(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file")}function cl(e){return e==="approval-responded"||e==="output-available"||e==="output-denied"||e==="output-error"}function cn(e){return e.kind==="tool"}function Qd(e){return e.kind==="text"&&e.textSig.value.trim()!==""||e.kind==="file"}function fo(e){let t=e.partsSig.value,n=t.findLastIndex(r=>r.kind==="tool");return t.slice(n+1).some(Qd)}function Xn(e){if(e.role!=="assistant")return!1;let t=e.partsSig.value.filter(cn);return t.length>0&&t.every(n=>cl(n.stateSig.value))}function Jn(e){return e.role!=="assistant"?!1:e.partsSig.value.some(t=>t.kind==="tool")&&!fo(e)}function za(e,t){return!e.partsSig.value.slice(t+1).some(n=>n.kind==="step-start"||Qd(n))}function ja(e){return e.partsSig.value.some(t=>cn(t)&&!cl(t.stateSig.value))}function Xd(e,t){if(t.length===0)return e;let n=new Set;for(let i of e)n.add(i.id),i.serverMessageId&&n.add(i.serverMessageId);let r=t.filter(i=>{let s=[i.id,i.serverMessageId].filter(c=>c!==void 0);return s.some(c=>n.has(c))?!1:(s.forEach(c=>n.add(c)),!0)});if(r.length===0)return e;let o=e.findIndex(i=>!i.ephemeral),a=o<0?e.length:o;return[...e.slice(0,a),...r,...e.slice(a)]}function Kn(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 Jd(e,t,n,r){if(!ul(e))return;if(t.length===0){let i=Math.max(...r.values());return n.find(s=>s.role==="assistant"&&r.get(s.serverMessageId??s.id)===i&&Je(s).length>=Je(e).length)}let o=t.at(-1);if(o?.role!=="user")return;let a=r.get(o.serverMessageId??o.id);if(a!==void 0)return n.find(i=>i.role==="assistant"&&r.get(i.serverMessageId??i.id)===a+1&&Je(i).length>=Je(e).length)}function ul(e){return e?.role==="assistant"&&e.status==="streaming"&&e.serverMessageId===void 0}function pv(e,t){let n=e.partsSig.value,r=t.partsSig.value,o=new Map(r.flatMap((c,p)=>cn(c)?[[c.toolCallId,p]]:[])),a=n.findIndex(c=>cn(c)&&o.has(c.toolCallId)),i=n[a];if(i===void 0||!cn(i))return;let s=(o.get(i.toolCallId)??0)-a;s>0&&(e.partsSig.value=[...r.slice(0,s),...n])}function _v(e,t){let n=new Map(t.partsSig.value.filter(cn).filter(a=>cl(a.stateSig.value)).map(a=>[a.toolCallId,a]));if(n.size===0)return;let r=!1,o=e.partsSig.value.map(a=>{if(!cn(a))return a;let i=n.get(a.toolCallId);if(!i)return a;let s=a.approvalSig.value,c=i.approvalSig.value,p=s===void 0||s.approved===void 0&&c?.approved!==void 0?i.approvalSig:a.approvalSig,_=a.inputSig.value===void 0?i.inputSig:a.inputSig,d=a.toolName==="tool"?i.toolName:a.toolName,u=a.dynamic??i.dynamic,f=a.toolMetadata??i.toolMetadata;return p===a.approvalSig&&_===a.inputSig&&d===a.toolName&&u===a.dynamic&&f===a.toolMetadata?a:(r=!0,{...a,toolName:d,dynamic:u,toolMetadata:f,inputSig:_,approvalSig:p})});r&&(e.partsSig.value=o)}function dl(e,t){let n=t.filter(d=>!d.ephemeral&&(d.status==="streaming"||d.status==="pending"||d.status==="error"||d.retryAction!==void 0||(d.attachments?.length??0)>0||Gt(d))),r=new Map;for(let d of n)r.set(d.id,d),d.serverMessageId!==void 0&&r.set(d.serverMessageId,d);let o=new Set,a=[],i=e.map(d=>{let u=(d.serverMessageId!==void 0?r.get(d.serverMessageId):void 0)??r.get(d.id);return u===void 0?(a.push(d),d):(o.add(u),u.role!==d.role?d:u.role==="user"&&u.serverMessageId===void 0&&(u.status==="pending"||u.status==="error")?Kn(u,d):u.status==="streaming"||Je(u).length>=Je(d).length?(pv(u,d),_v(u,d),d.stepTimings&&(u.stepTimings=d.stepTimings),u.suggestions??(u.suggestions=d.suggestions),u.feedback===void 0&&(u.feedback=d.feedback),d.canceled&&(u.canceled=!0),u):Kn(u,d))}),s=n.filter(d=>!o.has(d)),c=s.findLast(ul),p=new Map;e.forEach((d,u)=>{p.set(d.id,u),d.serverMessageId!==void 0&&p.set(d.serverMessageId,u)});let _=Jd(c,c?n.slice(0,n.indexOf(c)):[],a,p);if(c&&_){let d=i.indexOf(_);d>=0&&(i[d]=Kn(c,_)),s=s.filter(u=>u!==c)}return[...i,...s]}function mo(e,t){let n=new Map(t.filter(d=>d.serverMessageId!==void 0).map(d=>[d.serverMessageId,d])),r=new Map;t.forEach((d,u)=>{r.set(d.id,u),d.serverMessageId!==void 0&&r.set(d.serverMessageId,u)});let o=new Set(e.flatMap(d=>[d.serverMessageId,d.id].filter(u=>u!==void 0))),a=!1,i=e.map(d=>{let u=n.get(d.serverMessageId??d.id);if(u===void 0||u.role!==d.role)return d;if(d.role==="user"&&d.serverMessageId===void 0)return a=!0,Kn(d,u);if(d.serverMessageId===void 0)return d;let f=Je(u),m=Je(d),v=u.status!=="streaming"&&f.length>=m.length&&ol(d,u);if(f.length>m.length||f===m&&u.partsSig.value.length>d.partsSig.value.length||v)return a=!0,Kn(d,u);if((u.stepTimings?.length??0)>(d.stepTimings?.length??0)&&(d.stepTimings=u.stepTimings,a=!0),d.status==="streaming"&&u.status!=="streaming"&&fv(d,u)){if(d.continuationStreaming&&ja(u))return d;if(!ol(u,d))return a=!0,Kn(d,u)}return d}),s=[...n.values()].filter(d=>!o.has(d.serverMessageId)),c=i.findLastIndex(ul),p=i[c],_=Jd(p,i.slice(0,c),s,r);if(p!==void 0&&_!==void 0&&Je(_).length>=Je(p).length&&(Kn(p,_),i[c]=_,s.splice(s.indexOf(_),1),a=!0),s.length===0)return{messages:a?i:e,changed:a};for(let d of s){let u=r.get(d.serverMessageId??d.id),f=!1,m=i.findIndex(v=>{let y=r.get(v.serverMessageId??v.id);return u===void 0?!1:y===void 0?f:y>u?!0:(f=!0,!1)});m===-1?i.push(d):i.splice(m,0,d)}return{messages:i,changed:!0}}function Yd(e,t){if(e.role!==t.role)return!1;let n=Je(t),r=Je(e);return n.length>r.length||t.partsSig.value.length>e.partsSig.value.length||ol(e,t)}function fv(e,t){let n=e.partsSig.value,r=t.partsSig.value;return n.length!==r.length?!1:n.every((o,a)=>{let i=r[a];switch(o.kind){case"text":return i?.kind==="text"&&i.textSig.value===o.textSig.value;case"reasoning":return i?.kind==="reasoning"&&i.textSig.value===o.textSig.value;case"step-start":return i?.kind==="step-start";case"tool":return i?.kind==="tool"&&i.toolCallId===o.toolCallId&&Va(i.toolName,o.toolName);case"file":return i?.kind==="file"&&i.url===o.url&&i.mediaType===o.mediaType;case"source":return i?.kind==="source"&&i.sourceId===o.sourceId&&i.url===o.url&&i.title===o.title&&i.filename===o.filename&&i.mediaType===o.mediaType;default:return o}})}function Va(e,t){let n=e.startsWith("tool:")?e.slice(5):e,r=t.startsWith("tool:")?t.slice(5):t;return n===r}var Wd={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function ol(e,t){let n=new Map(e.partsSig.value.filter(cn).map(r=>[r.toolCallId,r]));return t.partsSig.value.filter(cn).some(r=>{let o=n.get(r.toolCallId);if(!o||Wd[r.stateSig.value]>Wd[o.stateSig.value])return!0;let a=r.approvalSig.value?.approved;return a!==void 0&&a!==o.approvalSig.value?.approved})}function Qn(e){return e.role==="assistant"&&e.status!=="streaming"&&e.canceled!==!0&&!Gt(e)}function Wa(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"&&!Qn(t))return;let n=e.indexOf(t);for(let r=n-1;r>=0;r--){let o=e[r];if(o?.role==="user"&&!o.ephemeral)return{kind:"repeat-user",messageId:o.id}}}function Zd(e,t){return e.canceled===!0&&e.role==="assistant"&&e.status!=="streaming"&&!ll(e)&&!t}function ep(e,t){return e.operatorRoutedTurn?Qn(e)?"drop":"complete-operator-routed":t||Qn(e)?"error":"complete"}function mv(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,textSig:se(e.text),doneSig:se(e.done)}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,dynamic:e.dynamic,toolMetadata:e.toolMetadata,inputPartialSig:se(e.inputPartial),inputSig:se(e.input),outputSig:se(e.output),errorSig:se(e.error),stateSig:se(e.state),approvalSig:se(e.approval)}:e}function gv(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,toolMetadata:e.toolMetadata,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}function hv(e){let t=new TextEncoder().encode(e),n="";for(let r of t)n+=String.fromCharCode(r);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function tp(e){return e&&Object.keys(e).length>0?e:void 0}function pl(e,t,n=[]){let r=tp(e),o=tp(t),a=Date.now();for(let i=n.length;;i-=1){let s=n.slice(n.length-i).map(({name:_,data:d,at:u})=>({name:_,data:d,secondsAgo:Math.round((a-u)/1e3)})),c=s.length>0?{...o,recentEvents:s}:o;if(!r&&!c)return;let p=hv(JSON.stringify({...r&&{user:r},...c&&{page:c}}));if(p.length<=8192||i===0)return p}}var _t=class extends Error{constructor(n,r,o,a,i){super(n);te(this,"code",r);te(this,"status",o);te(this,"cause",a);te(this,"retryAfterSeconds",i);this.name="StreamError"}};var np=Z.scope("parser");async function*rp(e,t,n){if(!e.ok){let r=await e.text().catch(()=>"");throw new _t(`server responded ${e.status}: ${r.slice(0,200)}`,"server",e.status)}for await(let r of vv(e,t)){let o=bv(r,n);if(o==="done")return;o&&(yield o)}}async function*vv(e,t){if(!e.body)throw new _t("response has no body","no-body");let n=e.body.pipeThrough(new TextDecoderStream).getReader(),r="";try{for(;;){if(t.aborted)throw new DOMException("aborted","AbortError");let{done:o,value:a}=await n.read();if(o){let s=r.trim();s&&(yield s);return}r+=a;let i;for(;(i=r.indexOf(`
54
54
 
55
- `))!==-1;){let s=r.slice(0,i);r=r.slice(i+2),yield s}}}finally{n.releaseLock()}}function uv(e,t){let n="",r;for(let o of e.split(`
55
+ `))!==-1;){let s=r.slice(0,i);r=r.slice(i+2),yield s}}}finally{n.releaseLock()}}function bv(e,t){let n="",r;for(let o of e.split(`
56
56
  `))if(o!==""){if(o.startsWith(":")){t?.(o.slice(1).trim());continue}if(o.startsWith("data:")){let a=o.slice(5).replace(/^ /,"");n=n?`${n}
57
- ${a}`:a;continue}o.startsWith("id:")&&(r=o.slice(3).trim())}if(n==="[DONE]")return"done";if(!n)return null;try{let o=JSON.parse(n);return Qd.trace("chunk",{type:o.type,eventId:r}),{chunk:o,eventId:r}}catch(o){throw Qd.trace("frame parse failed",{errorType:o instanceof Error?o.name:typeof o,payloadLength:n.length}),new ut("invalid SSE frame","network",void 0,o)}}var Ae=Z.scope("transport"),dv="x-user-token",Jd=6e4,pv=1e4,ll=50,np=new WeakMap;function br(e){return np.get(e)}function go(e,t){return np.set(e,t),e}function Yd(e){return Math.max(e?.upsertRevision??0,e?.read?.revision??0)}function _v(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 dn(e,t,n=!0){switch(t.type){case"snapshot":{let r=new Map(e.map(i=>[i.conversationId,i])),o=e.filter(i=>(br(i)?.activityRevision??0)>t.requestedRevision).toSorted((i,s)=>br(s).activityRevision-br(i).activityRevision),a=new Set(o.map(i=>i.conversationId));return[...o,...t.result.conversations.filter(i=>!a.has(i.conversationId)).map(i=>{let s=r.get(i.conversationId);if(!s)return i;let c=br(s);return(c?.upsertRevision??0)>t.requestedRevision?s:c?.read&&!s.hasUnread&&c.read.lastMessageAt===i.lastMessageAt?go({...i,hasUnread:!1},{upsertRevision:0,read:c.read}):i})]}case"read":{let r=e.findIndex(c=>c.conversationId===t.conversationId&&(t.lastMessageAt===void 0||c.lastMessageAt===t.lastMessageAt));if(r<0)return e;let o=e[r],a=br(o);if(Yd(a)>t.revision)return e;let i=t.lastMessageAt??o.lastMessageAt,s={upsertRevision:a?.upsertRevision??0,...a?.activityRevision===void 0?{}:{activityRevision:a.activityRevision},read:{revision:t.revision,...i?{lastMessageAt:i}:{}}};return o.hasUnread?e.map((c,p)=>p===r?go({...c,hasUnread:!1},s):c):(go(o,s),e)}case"upsert":{let r=e.findIndex(p=>p.conversationId===t.conversation.conversationId);if(r<0&&!n)return e;let o=r<0?void 0:e[r],a=o?br(o):void 0;if(Yd(a)>t.revision)return e;let i=t.activity?t.revision:a?.activityRevision,s={upsertRevision:t.revision,...i===void 0?{}:{activityRevision:i},...!t.conversation.hasUnread&&a?.read?{read:a.read}:{}},c=o?{...o,...t.conversation,title:o.title}:{...t.conversation};return o&&_v(o,c)?(go(o,s),e):(go(c,s),t.activity?[c,...e.filter(p=>p.conversationId!==c.conversationId)]:o?e.map((p,_)=>_===r?c:p):[...e,c])}default:return t}}var Zd=3,fv=400,mv=3e4,gv=6e4,hv=1e4,vv=6e4,yv=15e3,bv=1024*1024,ep=new Set([408,425,429,500,502,503,504]);function tp(e){return fv*2**e+Math.floor(Math.random()*250)}function Pv(e){return vv+Math.ceil(e/bv)*yv}function xv(e){let t=e.get("retry-after");if(!t)return null;let n=Number(t),r=Number.isFinite(n)?n*1e3:Date.parse(t)-Date.now();return Number.isFinite(r)&&r>=0?Math.min(r,3e4):null}var ho=class{constructor(t){oe(this,"ttlMs",t);oe(this,"map",new Map)}getOrFetch(t,n){let r=this.map.get(t);if(r&&performance.now()-r.at<this.ttlMs)return r.result;let o={at:performance.now(),result:n().then(a=>(o.value=a,a)).catch(a=>{throw this.map.get(t)===o&&this.map.delete(t),a})};return this.map.set(t,o),o.result}peek(t){let n=this.map.get(t);if(n?.value!==void 0&&performance.now()-n.at<this.ttlMs)return n.value}update(t){for(let n of this.map.values()){if(n.value!==void 0){let r=t(n.value);n.value=r,n.result=Promise.resolve(r);continue}n.result=n.result.then(r=>{let o=t(r);return n.value=o,o})}}delete(t){this.map.delete(t)}},za=class{constructor(t){oe(this,"opts",t);oe(this,"conversationListeners",new Set);oe(this,"conversationRevision",0);oe(this,"visitorId");oe(this,"conversationId");oe(this,"userContext");oe(this,"pageContext");oe(this,"locale");oe(this,"userTokenSource");oe(this,"userToken");oe(this,"userTokenRequest");oe(this,"conversationsCache",new ho(pv));oe(this,"contentCache",new ho(Jd));oe(this,"contentCollectionsCache",new ho(Jd))}setUserToken(t){this.userTokenSource=t,this.userToken=typeof t=="string"&&t||void 0,this.userTokenRequest=typeof t=="function"?this.fetchUserToken():void 0}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:dr};this.visitorId&&(t.visitorId=this.visitorId),this.conversationId&&(t.conversationId=this.conversationId),this.locale&&(t.locale=this.locale);let n=sl(this.userContext,this.pageContext);return n&&(t[Ys]=n),t}withEnvelope(t){return{...this.envelope(),...t}}appendEnvelope(t){for(let[n,r]of Object.entries(this.envelope()))t.append(n,r);return t}withEnvelopeQuery(t){let n=new URL(this.url(t));for(let[r,o]of Object.entries(this.envelope()))n.searchParams.has(r)||n.searchParams.set(r,o);return n.toString()}async handshake(t){Ae.debug("handshake \u2192",{visitorId:t.visitorId,conversationId:t.conversationId,locale:t.locale}),this.userTokenRequest&&await this.userTokenRequest;let n=await this.postJson(ct.handshake,t,"handshake");return Ae.debug("handshake \u2190",{visitorId:n.visitorId,conversationId:n.conversationId,hasWelcome:!!n.welcome,hasConfig:!!n.config,rebind:n.rebind}),this.visitorId=t.visitorId,this.conversationId=n.conversationId,n}async uploadFile(t,n){Ae.debug("uploadFile \u2192",{name:t.name,size:t.size,type:t.type});let r=new FormData;r.append("file",t,t.name);let o=await this.postForm(this.uploadPath,r,"upload",n,Pv(t.size));return Ae.debug("uploadFile \u2190",{id:o.id,url:o.url}),o}async transcribe(t,n="audio/webm"){Ae.debug("transcribe \u2192",{size:t.size,mimeType:n});let r=new FormData;r.append("audio",t,`voice.${Sv(n)}`),r.append("mimeType",n);let o=await this.postForm(this.transcribePath,r,"transcribe");return Ae.debug("transcribe \u2190",{textLen:o.text.length}),o}subscribeConversationChanges(t){return this.conversationListeners.add(t),()=>this.conversationListeners.delete(t)}publishConversation(t,n=!1){let r={type:"upsert",conversation:t,revision:++this.conversationRevision,...n?{activity:!0}:{}};this.conversationsCache.update(o=>{let a=o.pagination.page===1,i=o.conversations.some(d=>d.conversationId===t.conversationId),s=dn(o.conversations,r,a&&n),c=a&&s.length>o.pagination.limit?s.slice(0,o.pagination.limit):s;if(!a||!n||i||o.pagination.hasNext)return c===o.conversations?o:{...o,conversations:c};let p=Math.max(o.pagination.total,o.conversations.length)+1,_=Math.ceil(p/o.pagination.limit);return{...o,conversations:c,pagination:{...o.pagination,total:p,totalPages:_,hasNext:o.pagination.page<_}}});for(let o of this.conversationListeners)o(r)}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 r=this.localeCacheKey(t),o=this.conversationRevision;n&&this.conversationsCache.delete(r);let a=this.conversationsCache.getOrFetch(r,()=>this.fetchConversations(t));return n?a.then(i=>{let s={type:"snapshot",result:i,requestedRevision:o};for(let c of this.conversationListeners)c(s);return i}):a}async fetchConversations(t){let n=new URL(this.url(ct.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:r,beforeCreatedAt:o}={}){let a=new URL(this.url(ct.listMessages));a.searchParams.set("conversationId",t),a.searchParams.set("limit",String(ll)),n.length>0&&a.searchParams.set("ids",n.join(",")),r&&a.searchParams.set("beforeId",r),o&&a.searchParams.set("beforeCreatedAt",o);let i=await this.getJson(a.toString(),"loadConversation");return{...i,messages:i.messages.toReversed()}}async markRead(t,n){if(!this.visitorId||!t)return;let r={type:"read",conversationId:t,...n===void 0?{}:{lastMessageAt:n},revision:++this.conversationRevision};this.conversationsCache.update(o=>{let a=dn(o.conversations,r);return a===o.conversations?o:{...o,conversations:a}});for(let o of this.conversationListeners)o(r);try{await this.postJson(ct.markRead,{conversationId:t},"markRead",!0)}catch(o){Ae.debug("markRead failed (non-fatal)",{err:o})}}async requestOperator(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(ct.requestOperator,{},"requestOperator")).controlState}catch(t){Ae.debug("requestOperator failed (non-fatal)",{err:t});return}}async cancelOperatorRequest(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(ct.cancelOperatorRequest,{},"cancelOperatorRequest")).controlState}catch(t){Ae.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(ct.content));for(let[a,i]of Object.entries(t))i!==void 0&&n.searchParams.set(a,Array.isArray(i)?i.join(","):String(i));let r=await this.getJson(n.toString(),"listContent"),o=r.items?.map(a=>cc(a,this.locale))??[];return{...r,items:o}}async setContentVote(t){try{await this.postJson(this.dataUrl(ct.contentVoteSet),t,"setContentVote")}catch{}}listContentCollections(t){return this.contentCollectionsCache.getOrFetch(this.localeCacheKey({ids:t}),()=>this.fetchContentCollections(t))}async fetchContentCollections(t){let n=new URL(this.dataUrl(ct.contentCollections));return t.length&&n.searchParams.set("ids",t.join(",")),{items:(await this.getJson(n.toString(),"listContentCollections")).items?.map(o=>uc(o,this.locale))??[]}}async bootstrap(t){let n=new URL(this.dataUrl(ct.bootstrap));t&&n.searchParams.set("conversationId",t);let r=await this.getJson(n.toString(),"bootstrap"),o=r.forms??[],a=r.formSubmissions??[];return{forms:o,formSubmissions:a}}async saveUserPrefs(t){return this.postJson(ct.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??ct.submitForm}async submitForm(t){Ae.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){Ae.debug("submitForm failed (non-fatal)",{err:n})}}async submitFeedback(t){Ae.debug("submitFeedback \u2192",{messageId:t.messageId,value:t.value});try{await this.postJson(ct.messageFeedback,{messageId:t.messageId,set:{feedback:t.value}},"submitFeedback")}catch(n){Ae.debug("submitFeedback failed (non-fatal)",{err:n})}}async sendTurn(t,n={}){Ae.debug("message \u2192",{conversationId:t.conversationId,visitorId:t.visitorId,messageCount:t.messages.length});let r=JSON.stringify({...this.withEnvelope(t),[Ys]:sl(this.userContext,this.pageContext,this.opts.recentHostEvents)}),o=n.keepalive===!0&&new Blob([r]).size<gv;try{return await this.runWithAbort(async a=>{let i=await this.withFreshUserToken(()=>this.fetchImpl(this.url(ct.streamMessage),{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json",...this.headersFor(this.url(ct.streamMessage))},body:r,keepalive:o,signal:a}));if(i.status!==202)throw new ut(`sendTurn failed: expected 202, received ${i.status}`,"server",i.status);let s;try{s=await i.json()}catch(c){throw a?.aborted?c:new ut("sendTurn failed: invalid acknowledgement","server",i.status,c)}if(!kv(s))throw new ut("sendTurn failed: invalid acknowledgement","server",i.status);return s},void 0,mv)}catch(a){throw a instanceof ut?a:new ut("sendTurn failed: network error","network",void 0,a)}}cancelTurn(t,n){!this.visitorId||!t||!n||(Ae.debug("cancel stream",{conversationId:t,runId:n,visitorId:this.visitorId}),this.fetchImpl(this.url(ct.cancelStream),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.headersFor(this.url(ct.cancelStream))},body:JSON.stringify(this.withEnvelope({conversationId:t,runId:n})),keepalive:!0}).catch(r=>Ae.debug("cancel POST failed (non-fatal)",{err:r})))}async connectResumeStream(t){let n=new AbortController;function r(){return n.abort(t.signal.reason)}t.signal.aborted?r():t.signal.addEventListener("abort",r,{once:!0});let o=setTimeout(()=>n.abort(),hv);function a(){clearTimeout(o),t.signal.removeEventListener("abort",r)}let i;try{this.userTokenRequest&&await this.userTokenRequest,i=await this.fetchImpl(this.resumeUrl(),{method:"GET",credentials:"omit",headers:{accept:"text/event-stream",...this.headersFor(this.resumeUrl())},signal:n.signal})}catch(c){return a(),t.signal.aborted||Ae.debug("resume-stream fetch failed \u2014 reconnecting",{err:c}),"held"}if(!i.ok)return a(),i.status===401&&typeof this.userTokenSource=="function"?(await this.fetchUserToken(),"held"):i.status===409||ep.has(i.status)?(Ae.debug("resume-stream \u2192 transient response; reconnecting",{status:i.status}),"held"):(Ae.debug("resume-stream \u2192 endpoint unavailable",{status:i.status}),"unavailable");if(!i.body)return a(),Ae.debug("resume-stream \u2192 bodyless response; stopping",{status:i.status}),"unavailable";if(!(i.headers.get("content-type")??"").includes("text/event-stream"))return a(),Ae.debug("resume-stream \u2192 non-SSE response; stopping"),"unavailable";let s=!1;try{for await(let{chunk:c}of Xd(i,n.signal,p=>{s||p!=="connected"||(s=!0,clearTimeout(o),t.onConnected())})){if(t.signal.aborted)return"held";t.onChunk(c)}}catch(c){if(t.signal.aborted)return"held";Ae.debug("resume-stream segment dropped \u2014 reconnecting",{err:c})}finally{a()}return"held"}resumeUrl(){return this.withEnvelopeQuery(ct.streamResume)}async postJson(t,n,r,o=!1){let a=await this.fetchWithRetry(()=>[this.url(t),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.headersFor(this.url(t))},body:JSON.stringify(this.withEnvelope(n)),...o?{keepalive:!0}:{}}],r);return this.assertOk(a,r)}async postForm(t,n,r,o,a){return this.runWithAbort(async i=>{let s=await this.withFreshUserToken(()=>this.fetchImpl(this.url(t),{method:"POST",credentials:"omit",headers:this.headersFor(this.url(t)),body:this.appendEnvelope(n),signal:i}));return this.assertOk(s,r)},o,a)}async runWithAbort(t,n,r){if(!n&&r===void 0)return t();let o=new AbortController;function a(){return o.abort(n?.reason)}n?.aborted?a():n?.addEventListener("abort",a,{once:!0});let i=r===void 0?void 0:setTimeout(()=>o.abort(),r);try{return await t(o.signal)}finally{i!==void 0&&clearTimeout(i),n?.removeEventListener("abort",a)}}async getJson(t,n){let r=await this.fetchWithRetry(()=>[this.withEnvelopeQuery(t),{method:"GET",credentials:"omit",headers:{accept:"application/json",...this.headersFor(this.url(t))}}],n);return this.assertOk(r,n)}async fetchWithRetry(t,n){for(let r=0;;r++){let o;try{o=await this.withFreshUserToken(()=>this.fetchImpl(...t()))}catch(i){if(r>=Zd)throw new ut(`${n} failed: network error`,"network",void 0,i);Ae.debug("request network error \u2014 retrying",{label:n,attempt:r}),await Dn(tp(r));continue}if(o.ok||!ep.has(o.status)||r>=Zd)return o;let a=xv(o.headers)??tp(r);Ae.debug("request retryable status \u2014 retrying",{label:n,status:o.status,attempt:r,wait:a}),await Dn(a)}}async assertOk(t,n){if(!t.ok)throw new ut(`${n} failed: ${t.status}`,"server",t.status);return await t.json()}fetchUserToken(){let t=this.userTokenSource;if(typeof t!="function")return Promise.resolve();let n=Promise.resolve().then(t).then(r=>{this.userTokenSource===t&&(this.userToken=r||void 0)},r=>{Ae.warn("userToken function failed; continuing as an anonymous visitor",{err:r})});return this.userTokenRequest=n,n}headersFor(t){let n=!/^https?:\/\//i.test(t)||t.startsWith(`${this.opts.agentApiBaseUrl}/`);return{...this.opts.auth.headers(),...n&&this.userToken?{[dv]:this.userToken}:{}}}async withFreshUserToken(t){let n=await t();return n.status!==401||!this.userTokenSource?n:typeof this.userTokenSource!="function"?(Ae.warn("userToken rejected as invalid or expired; pass a function so the widget can fetch a fresh one"),n):(await this.fetchUserToken(),t())}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 Sv(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 kv(e){if(typeof e!="object"||e===null)return!1;let t=Reflect.get(e,"status"),n=Reflect.get(e,"conversationId"),r=Reflect.get(e,"runId");return t==="accepted"&&typeof n=="string"&&n.length>0&&(r===void 0||typeof r=="string"&&r.length>0)}function Pr(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 ja(e,t,n){return Pr("close",e,t)?n.includes("close"):!1}function rp(e,t){return e==="inline"&&t==="fullscreen"?"exit-fullscreen":"close"}function xr(e,t,n,r){let o={role:n,text:r};e.emit("message",o),t.onMessage?.(o)}function op(e){let t=F(e);t.current=e;let n=F(null);return n.current??(n.current=wv(t)),n.current}function wv(e){let t=le(null),n=new Set;function r(c){return`${e.current.conversationId()??""}:${c}`}function o(c){return c.frequency==="always"?!1:c.frequency==="conversation"?n.has(r(c.id)):c.id in e.current.persistence.loadFormsDone()}function a(c,p){if(t.value)return;let _=e.current;if(c==="manual"){let d=_.forms.list.find(u=>u.id===p);d&&(t.value={form:d,trigger:"manual"});return}for(let d of _.forms.byTrigger[c]??[]){let u=d.triggers.find(f=>f.kind===c);if(!(!u||!Cv(u,_)||o(d)||!Tv(d,_))){t.value={form:d,trigger:c};return}}}function i(c,p){let _=t.value;if(!_)return;t.value=null;let{form:d,trigger:u}=_;d.frequency==="conversation"?n.add(r(d.id)):d.frequency!=="always"&&e.current.persistence.saveFormDone(d.id),e.current.onComplete(d,u,c,p)}function s(){let c=t.value;if(!c)return;let p=e.current.forms.list.find(_=>_.id===c.form.id);p&&p!==c.form&&(t.value={form:p,trigger:c.trigger})}return{activeForm:t,fire:a,refresh:s,complete:c=>i(c,!1),skip:()=>i({},!0)}}function Cv(e,t){return e.kind==="after-messages"?t.messageCount()>=Number(e.param??0):e.kind==="page-area"?t.pageArea()===e.param:!0}function Tv(e,t){let n=e.when;if(!n)return!0;if(n.missingContext?.length){let o=t.userContext()??{};if(n.missingContext.some(a=>o[a]!==void 0&&o[a]!==""))return!1}if(n.pageArea&&!(Array.isArray(n.pageArea)?n.pageArea:[n.pageArea]).includes(t.pageArea()??""))return!1;let r=t.messageCount();return!(n.minMessages!=null&&r<n.minMessages||n.maxMessages!=null&&r>n.maxMessages)}function ap(e){return Object.fromEntries(e.map(t=>[t,[]]))}function cl(e,t,n){return e.includes(t)?t:e.includes(n)?n:e[0]??""}function ip(e,t,n){let r=[...new Set(t)],o=cl(r,e,""),a=le({activeTab:o,stacks:ap(r)});return{sig:a,reconcile(i,s){let c=[...new Set(i)],p=a.value,_=cl(c,p.activeTab,s),d=Object.fromEntries(c.map(f=>[f,p.stacks[f]??[]])),u=_===p.activeTab&&c.length===Object.keys(p.stacks).length&&c.every(f=>p.stacks[f]===d[f]);r=c,!u&&(a.value={activeTab:_,stacks:d},_!==p.activeTab&&_&&n?.(_))},switchTab(i){!(i in a.value.stacks)||a.value.activeTab===i||(a.value={...a.value,activeTab:i},n?.(i))},open(i,s){let c=a.value;i in c.stacks&&(a.value={activeTab:i,stacks:{...c.stacks,[i]:s?[s]:[]}},c.activeTab!==i&&n?.(i))},push(i){let s=a.value,c=s.stacks[s.activeTab]??[];a.value={...s,stacks:{...s.stacks,[s.activeTab]:[...c,i]}}},pop(){let i=a.value,s=i.stacks[i.activeTab]??[];s.length!==0&&(a.value={...i,stacks:{...i.stacks,[i.activeTab]:s.slice(0,-1)}})},reset(i){a.value={activeTab:cl(r,i,""),stacks:ap(r)}}}}function sp(e){return e.stacks[e.activeTab]??[]}function lp(e){return sp(e).at(-1)}function cp(e){return sp(e).length===0}function Va(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 Iv=900,Rv=640;function ul(e,t,n){if(e==="standalone"||e==="page")return"fullscreen";let r=t.initialSize;return r==="expanded"||r==="fullscreen"||r==="normal"?r:n>0&&n<Rv?"fullscreen":n>=(t.autoSizeBreakpoint??Iv)?"expanded":"normal"}function vo(e,t,n,r=null){let a=e.mode==="inline"||e.mode==="standalone"||e.mode==="page"||(n??!e.startMinimized),s=e.mode!=="standalone"&&e.mode!=="page"&&e.mode!=="inline"&&r?r:ul(e.mode,e.size,t);return{panelOpen:a,panelSize:s}}function Sr(){return typeof window>"u"?0:window.innerWidth}var re={fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24"},yo=`${E.cssPrefix}-icon-dir`;function dl(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M21 12a8 8 0 0 1-12 6.93L3 21l1.65-5.16A8 8 0 1 1 21 12Z"})})}function Ut(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M18 6 6 18M6 6l12 12"})})}function up(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M12 5v14M5 12h14"})})}function dp(){return l("svg",{...re,class:yo,"aria-hidden":"true",children:[l("path",{d:"m22 2-7 20-4-9-9-4Z"}),l("path",{d:"M22 2 11 13"})]})}function pp(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M12 19V5M5 12l7-7 7 7"})})}function _p(){return l("svg",{...re,class:yo,"aria-hidden":"true",children:l("path",{d:"M3 20V4l18 8-18 8Z"})})}function kr(){return l("svg",{...re,class:yo,"aria-hidden":"true",children:l("path",{d:"m9 18 6-6-6-6"})})}function fp(){return l("svg",{...re,"aria-hidden":"true",children:l("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}function mp(){return l("svg",{...re,"aria-hidden":"true",children:l("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"})})}function gp(){return l("svg",{...re,"aria-hidden":"true",children:[l("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),l("path",{d:"M5 10a7 7 0 0 0 14 0M12 19v3"})]})}function hp(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M3 8V3h5M21 8V3h-5M3 16v5h5M21 16v5h-5"})})}function vp(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M8 3v5H3M16 3v5h5M8 21v-5H3M16 21v-5h5"})})}function yp(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M3 3h7v2H5v5H3zM21 3h-7v2h5v5h2zM3 21h7v-2H5v-5H3zM21 21h-7v-2h5v-5h2z"})})}function bp(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M10 3v5H3M14 3v5h7M10 21v-5H3M14 21v-5h7"})})}function Pp(){return l("svg",{...re,"aria-hidden":"true",children:[l("path",{d:"M14 3h7v7M21 3l-9 9"}),l("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]})}function xp(){return l("svg",{...re,"aria-hidden":"true",viewBox:"0 0 10 10",children:l("path",{d:"M9 1L1 9M9 5L5 9M9 9H9",strokeWidth:"1.5"})})}function Sp(){return l("svg",{...re,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"5",r:"1.5",fill:"currentColor",stroke:"none"}),l("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),l("circle",{cx:"12",cy:"19",r:"1.5",fill:"currentColor",stroke:"none"})]})}function kp(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M11 5 6 9H2v6h4l5 4zM15 9a5 5 0 0 1 0 6M18 7a9 9 0 0 1 0 10"})})}function wp(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M11 5 6 9H2v6h4l5 4zM22 9l-6 6M16 9l6 6"})})}function Cp(){return l("svg",{...re,"aria-hidden":"true",children:[l("path",{d:"M3 18 8 6l5 12M4.7 14h6.6"}),l("path",{d:"M14.5 18l3.2-7 3.2 7M15.6 15.8h4.2"})]})}function Tp(){return l("svg",{...re,class:yo,"aria-hidden":"true",children:l("path",{d:"m5 6 6 6-6 6M13 6l6 6-6 6"})})}function Xn(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M20 6 9 17l-5-5"})})}function Ip(){return l("svg",{...re,"aria-hidden":"true",children:[l("path",{d:"M3 3v6h6"}),l("path",{d:"M3.05 13A9 9 0 1 0 6 5.3L3 9"}),l("path",{d:"M12 7v5l3 2"})]})}function Rp(){return l("svg",{...re,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"10"}),l("path",{d:"M2 12h20"}),l("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"})]})}function bo(){return l("svg",{...re,class:yo,"aria-hidden":"true",children:l("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}function Ep(){return l("svg",{...re,"aria-hidden":"true",children:[l("path",{d:"M12 20h9"}),l("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function pn(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"m6 9 6 6 6-6"})})}function Wa(){return l("svg",{...re,"aria-hidden":"true",children:[l("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),l("path",{d:"M14 2v6h6"})]})}function Ev(){return l("svg",{...re,"aria-hidden":"true",children:[l("path",{d:"m12 3-1.5 4.5L6 9l4.5 1.5L12 15l1.5-4.5L18 9l-4.5-1.5Z"}),l("path",{d:"M19 15v4M17 17h4M5 3v2M4 4h2"})]})}function pl(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z"})})}function Po(){return l("svg",{...re,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"10"}),l("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),l("path",{d:"M12 17h.01"})]})}function Av(){return l("svg",{...re,"aria-hidden":"true",children:[l("path",{d:"m15 4 3 3-9 9-3-3z"}),l("path",{d:"M18 2v2M20 4h2M3 20l3-3M3 16h2M5 14v2"})]})}function Mv(){return l("svg",{...re,"aria-hidden":"true",children:[l("rect",{x:"4",y:"8",width:"16",height:"12",rx:"2"}),l("path",{d:"M12 8V4"}),l("circle",{cx:"12",cy:"3",r:"1"}),l("path",{d:"M2 14h2M20 14h2M9 13h.01M15 13h.01M9.5 17h5"})]})}function _l(){return l("svg",{...re,"aria-hidden":"true",children:[l("path",{d:"M4 14v-2a8 8 0 0 1 16 0v2"}),l("rect",{x:"2",y:"14",width:"4",height:"6",rx:"1.5"}),l("rect",{x:"18",y:"14",width:"4",height:"6",rx:"1.5"}),l("path",{d:"M20 20v1a3 3 0 0 1-3 3h-5"})]})}function Lv(){return l("svg",{...re,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"10"}),l("circle",{cx:"12",cy:"12",r:"4"}),l("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"})]})}function fl(){return l("svg",{...re,"aria-hidden":"true",children:[l("circle",{cx:"11",cy:"11",r:"7"}),l("path",{d:"m21 21-4.3-4.3"})]})}function Ap(){return l("svg",{...re,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]})}function Mp(){return l("svg",{...re,"aria-hidden":"true",children:[l("path",{d:"M3 9.5 12 3l9 6.5"}),l("path",{d:"M5 9v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9"})]})}function Ga(){return l("svg",{...re,"aria-hidden":"true",children:[l("path",{d:"m3 11 15-5v12L3 13z"}),l("path",{d:"M3 11v2a2 2 0 0 0 2 2h1V9H5a2 2 0 0 0-2 2z"}),l("path",{d:"M7 15v3a2 2 0 0 0 4 0v-2"}),l("path",{d:"M21 10a3 3 0 0 1 0 4"})]})}function xo(){return l("svg",{...re,"aria-hidden":"true",children:[l("path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z"}),l("path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1"})]})}function Lp(){return l("svg",{...re,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"4"}),l("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"})]})}function Np(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})}function Op(){return l("svg",{...re,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"M12 3v18"}),l("path",{d:"M12 3a9 9 0 0 1 0 18z",fill:"currentColor",stroke:"none"})]})}function Nv(){return l("svg",{...re,"aria-hidden":"true",children:[l("circle",{cx:"10.5",cy:"10.5",r:"6.5"}),l("path",{d:"M8 11a2.5 2.5 0 0 0 5 0"}),l("path",{d:"m20 20-4.4-4.4"})]})}function Ov(){return l("svg",{...re,"aria-hidden":"true",children:[l("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"}),l("path",{d:"M18.5 4v3M20 5.5h-3M5.5 16v2.5M6.75 17.25h-2.5"})]})}function $v(){return l("svg",{...re,"aria-hidden":"true",children:[l("path",{d:"M4 18h16"}),l("path",{d:"M5 18a7 7 0 0 1 14 0"}),l("path",{d:"M12 8V6"}),l("path",{d:"M10 6h4"})]})}function Dv(){return l("svg",{...re,"aria-hidden":"true",children:[l("path",{d:"M7 11V6.5a1.5 1.5 0 0 1 3 0V10"}),l("path",{d:"M10 10V5.5a1.5 1.5 0 0 1 3 0V10"}),l("path",{d:"M13 10V6.5a1.5 1.5 0 0 1 3 0V12"}),l("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"})]})}function $p(){return l("svg",{...re,"aria-hidden":"true",children:[l("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),l("path",{d:"M5 15a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2"})]})}function Dp(){return l("svg",{...re,"aria-hidden":"true",children:[l("path",{d:"M7 10v11H4a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1z"}),l("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"})]})}function Fp(){return l("svg",{...re,"aria-hidden":"true",children:[l("path",{d:"M17 14V3h3a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1z"}),l("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"})]})}function Ka(){return l("svg",{...re,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"3.5"}),l("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"})]})}function Bp(){return l("svg",{...re,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"M12 7v5l3 2"})]})}function wr(){return l("svg",{...re,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]})}function Cr(){return l("svg",{...re,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"m15 9-6 6M9 9l6 6"})]})}var Up={chat:dl,message:pl,bubbles:xo,spark:Ev,wand:Av,bot:Mv,help:Po,lifebuoy:Lv,headset:_l,search:Nv,sparkles:Ov,concierge:$v,wave:Dv};var q=E.cssPrefix,L={launcher:`${q}-launcher`,callout:`${q}-callout`,calloutDismiss:`${q}-callout-dismiss`,panel:`${q}-panel`,panelHeader:`${q}-panel-header`,resizeGrip:`${q}-resize-grip`,scrollToBottom:`${q}-scroll-to-bottom`,loadPreviousMessages:`${q}-load-previous-messages`,actionHistory:`${q}-action-history`,actionClose:`${q}-action-close`,langSegment:`${q}-lang-segment`,composer:`${q}-composer`,composerInput:`${q}-composer-input`,composerSend:`${q}-composer-send`,composerStop:`${q}-composer-stop`,compactionStatus:`${q}-compaction-status`,messageQueue:`${q}-message-queue`,queuedMessage:`${q}-queued-message`,queuedMessageRemove:`${q}-queued-message-remove`,composerAttach:`${q}-composer-attach`,composerFileInput:`${q}-composer-file-input`,composerVoice:`${q}-composer-voice`,attachmentChip:`${q}-attachment-chip`,attachmentRemove:`${q}-attachment-remove`,suggestion:`${q}-suggestion`,messageBubble:`${q}-message`,messageRetry:`${q}-message-retry`,messageFile:`${q}-message-file`,messageFeedback:`${q}-message-feedback`,feedbackUp:`${q}-feedback-up`,feedbackDown:`${q}-feedback-down`,messageCopy:`${q}-message-copy`,historyPane:`${q}-history-pane`,historyBack:`${q}-history-back`,historyItem:`${q}-history-item`,historyLoadMore:`${q}-history-load-more`,sidebar:`${q}-sidebar`,sidebarToggle:`${q}-sidebar-toggle`,sidebarNewConversation:`${q}-sidebar-new-conversation`,sidebarItem:`${q}-sidebar-item`,messengerHome:`${q}-messenger-home`,modulesEmpty:`${q}-modules-empty`,tab:`${q}-tab`,tabBadge:`${q}-tab-badge`,homeView:`${q}-home-view`,homeGreeting:`${q}-home-greeting`,homeBrand:`${q}-home-brand`,backHeader:`${q}-back-header`,contentView:`${q}-content-view`,contentScroll:`${q}-content-scroll`,homeSearch:`${q}-home-search`,helpSearch:`${q}-help-search`,homeRecent:`${q}-home-recent`,homeAsk:`${q}-home-ask`,homeWhatsNew:`${q}-home-whats-new`,homeContentRow:`${q}-home-content-row`,helpArticle:`${q}-help-article`,newsItem:`${q}-news-item`,newsMore:`${q}-news-more`,formGate:`${q}-form-gate`,formDone:`${q}-form-done`,formDoneToggle:`${q}-form-done-toggle`,formAnswers:`${q}-form-answers`,formFill:`${q}-form-fill`,formSubmit:`${q}-form-submit`,formSkip:`${q}-form-skip`,formField:`${q}-form-field`,toolAskQuestions:`${q}-tool-ask-questions`,toolInputSubmit:`${q}-tool-input-submit`,toolInputSkip:`${q}-tool-input-skip`,toolApproval:`${q}-tool-approval`,toolApprovalFields:`${q}-tool-approval-fields`,toolApprove:`${q}-tool-approve`,toolReject:`${q}-tool-reject`,toolEdit:`${q}-tool-edit`,toolDecision:`${q}-tool-decision`,typingDots:`${q}-typing-dots`,reasoning:`${q}-reasoning`,toolAskSummary:`${q}-ask-questions-summary`,toolAskOptions:`${q}-ask-questions-options-toggle`,toolCall:`${q}-tool-call`,toolSteps:`${q}-tool-steps`,toolStep:`${q}-tool-step`,source:`${q}-source`,operatorRequest:`${q}-operator-request`,operatorBanner:`${q}-operator-banner`,cancelOperatorRequest:`${q}-cancel-operator-request`};function dt(e,t){return`${e}-${t}`}var Qa=E.cssPrefix;function Hp({onToggle:e,launcher:t,strings:n,leaving:r,edgeTab:o}){let a=t.variant!=="circle"&&!!t.label;return l("button",{type:"button",class:`${Qa}-fab`,part:"launcher","data-variant":t.variant,"data-size":t.size,"data-edge-tab":o?"true":void 0,"data-leaving":r?"true":void 0,"data-testid":L.launcher,onClick:e,"aria-label":n.launcherOpen,children:[Fv(t.icon),a?l("span",{class:`${Qa}-fab-label`,children:bt(n,t.label??"")}):null]})}function Fv(e){let t=Up[e];return t?l(t,{}):l(Bv,{source:e})}function Bv({source:e}){return l("span",{ref:t=>{t&&Uv(t,e)},"aria-hidden":"true"})}function Uv(e,t){if(e.dataset.svgMounted!==t)try{let r=new DOMParser().parseFromString(t,"image/svg+xml").documentElement;r.tagName.toLowerCase()==="svg"&&(e.replaceChildren(document.importNode(r,!0)),e.dataset.svgMounted=t)}catch{}}function qp({callout:e,launcherPosition:t,strings:n,closeLabel:r,onDismiss:o}){let[a,i]=H(!1);return D(()=>{let s=setTimeout(()=>i(!0),e.delayMs);return()=>clearTimeout(s)},[e.delayMs]),D(()=>{if(!a||e.autoDismissMs<=0)return;let s=setTimeout(o,e.autoDismissMs);return()=>clearTimeout(s)},[a,e.autoDismissMs,o]),a?l("div",{class:`${Qa}-callout`,role:"status","data-shape":e.shape,"data-position":Hv(e.position,t),"data-animated":e.animated?"true":void 0,"data-testid":L.callout,children:[l("span",{children:bt(n,e.text)}),l("button",{type:"button",class:`${Qa}-callout-close`,onClick:o,"aria-label":r,title:r,"data-testid":L.calloutDismiss,children:l(Ut,{})})]}):null}function Hv(e,t){let n=t.endsWith("-right"),r=t.startsWith("bottom-");return e==="vertical"?r?"top":"bottom":n?"left":"right"}var qv='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function Xa(e){function t(n){if(n.key!=="Tab")return;let r=[...e.querySelectorAll(qv)].filter(s=>s.offsetParent!==null||s===document.activeElement);if(r.length===0){n.preventDefault();return}let o=r[0],a=r[r.length-1];if(!o||!a)return;let i=e.getRootNode().activeElement;n.shiftKey&&i===o?(n.preventDefault(),a.focus()):!n.shiftKey&&i===a&&(n.preventDefault(),o.focus())}return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}var In=E.cssPrefix;function Ja({title:e,actions:t}){return l("header",{class:`${In}-back-header`,part:"header","data-variant":"title",children:[l("span",{class:`${In}-back-spacer`,"aria-hidden":"true"}),l("h1",{class:`${In}-back-title`,children:e}),t??l("span",{class:`${In}-back-spacer`,"aria-hidden":"true"})]})}function Ya({title:e,backLabel:t,onBack:n,actions:r,testid:o}){return l("header",{class:`${In}-back-header`,part:"header","data-testid":o,children:[l("button",{type:"button",class:`${In}-icon-btn`,onClick:n,"aria-label":t,title:t,children:l(bo,{})}),l("h1",{class:`${In}-back-title`,children:e}),r??l("span",{class:`${In}-back-spacer`,"aria-hidden":"true"})]})}function Tr({textSig:e,doneSig:t,generativeUi:n=!1,strings:r=qo}){let o=F(null);return Rt(()=>{let a=o.current;if(!a)return;a.classList.add(`${E.cssPrefix}-md`),a.replaceChildren();let i=n?Js(a,{cssPrefix:E.cssPrefix,strings:r}):void 0,s=hr(i??io(a)),c=0,p=Wt(()=>{let u=e.value,f=t.value;u.length<c&&(i?.dispose(),a.replaceChildren(),i=n?Js(a,{cssPrefix:E.cssPrefix,strings:r}):void 0,s=hr(i??io(a)),c=0);let m=u.slice(c);m&&Xe(s,m),c=u.length,f&&(ao(s),i?.finish())}),_=new MutationObserver(()=>zp(a));_.observe(a,{childList:!0,subtree:!0}),zp(a);function d(u){let f=u.target?.closest?.("a");if(!f||!(f instanceof HTMLAnchorElement))return;let m=f.getAttribute("href")??"";!m||m.startsWith("#")||(u.preventDefault(),window.open(m,"_blank","noopener,noreferrer"))}return a.addEventListener("click",d),()=>{p(),i?.dispose(),_.disconnect(),a.removeEventListener("click",d)}},[e,t,n,r]),l("div",{ref:o})}function Vp({text:e}){let t=ue(()=>le(e),[e]),n=ue(()=>le(!0),[]);return l(Tr,{textSig:t,doneSig:n})}var Zv=/<(\/?)(?:(Note|Info|Tip|Warning|Danger|Check|Callout)|Tabs?|Steps?|AccordionGroup|Accordion|Expandable|Columns|CardGroup|Card|Frame|CodeGroup|Badge|Icon|Video|Embed|ParamField|ResponseField)\b((?:"[^"]*"|'[^']*'|[^>"'])*?)(\/?)>|(^|\n)([ \t]*)(```[^]*?(?:\n[ \t]*```|$))?/g;function Wp(e){let t=0,n="";return e.replace(Zv,(r,o,a,i,s,c,p,_)=>{if(o===void 0)return t?c+(_?.split(`
57
+ ${a}`:a;continue}o.startsWith("id:")&&(r=o.slice(3).trim())}if(n==="[DONE]")return"done";if(!n)return null;try{let o=JSON.parse(n);return np.trace("chunk",{type:o.type,eventId:r}),{chunk:o,eventId:r}}catch(o){throw np.trace("frame parse failed",{errorType:o instanceof Error?o.name:typeof o,payloadLength:n.length}),new _t("invalid SSE frame","network",void 0,o)}}var De=Z.scope("transport"),yv="x-user-token",op=6e4,Pv=1e4,_l=50,cp=new WeakMap;function xr(e){return cp.get(e)}function go(e,t){return cp.set(e,t),e}function ap(e){return Math.max(e?.upsertRevision??0,e?.read?.revision??0)}function xv(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 dn(e,t,n=!0){switch(t.type){case"snapshot":{let r=new Map(e.map(i=>[i.conversationId,i])),o=e.filter(i=>(xr(i)?.activityRevision??0)>t.requestedRevision).toSorted((i,s)=>xr(s).activityRevision-xr(i).activityRevision),a=new Set(o.map(i=>i.conversationId));return[...o,...t.result.conversations.filter(i=>!a.has(i.conversationId)).map(i=>{let s=r.get(i.conversationId);if(!s)return i;let c=xr(s);return(c?.upsertRevision??0)>t.requestedRevision?s:c?.read&&!s.hasUnread&&c.read.lastMessageAt===i.lastMessageAt?go({...i,hasUnread:!1},{upsertRevision:0,read:c.read}):i})]}case"read":{let r=e.findIndex(c=>c.conversationId===t.conversationId&&(t.lastMessageAt===void 0||c.lastMessageAt===t.lastMessageAt));if(r<0)return e;let o=e[r],a=xr(o);if(ap(a)>t.revision)return e;let i=t.lastMessageAt??o.lastMessageAt,s={upsertRevision:a?.upsertRevision??0,...a?.activityRevision===void 0?{}:{activityRevision:a.activityRevision},read:{revision:t.revision,...i?{lastMessageAt:i}:{}}};return o.hasUnread?e.map((c,p)=>p===r?go({...c,hasUnread:!1},s):c):(go(o,s),e)}case"upsert":{let r=e.findIndex(p=>p.conversationId===t.conversation.conversationId);if(r<0&&!n)return e;let o=r<0?void 0:e[r],a=o?xr(o):void 0;if(ap(a)>t.revision)return e;let i=t.activity?t.revision:a?.activityRevision,s={upsertRevision:t.revision,...i===void 0?{}:{activityRevision:i},...!t.conversation.hasUnread&&a?.read?{read:a.read}:{}},c=o?{...o,...t.conversation,title:o.title}:{...t.conversation};return o&&xv(o,c)?(go(o,s),e):(go(c,s),t.activity?[c,...e.filter(p=>p.conversationId!==c.conversationId)]:o?e.map((p,_)=>_===r?c:p):[...e,c])}default:return t}}var ip=3,Sv=400,kv=3e4,wv=6e4,Cv=1e4,Tv=6e4,Rv=15e3,Iv=1024*1024,sp=new Set([408,425,429,500,502,503,504]);function lp(e){return Sv*2**e+Math.floor(Math.random()*250)}function Ev(e){return Tv+Math.ceil(e/Iv)*Rv}function Av(e){let t=e.get("retry-after");if(!t)return null;let n=Number(t),r=Number.isFinite(n)?n*1e3:Date.parse(t)-Date.now();return Number.isFinite(r)&&r>=0?Math.min(r,3e4):null}var ho=class{constructor(t){te(this,"ttlMs",t);te(this,"map",new Map)}getOrFetch(t,n){let r=this.map.get(t);if(r&&performance.now()-r.at<this.ttlMs)return r.result;let o={at:performance.now(),result:n().then(a=>(o.value=a,a)).catch(a=>{throw this.map.get(t)===o&&this.map.delete(t),a})};return this.map.set(t,o),o.result}peek(t){let n=this.map.get(t);if(n?.value!==void 0&&performance.now()-n.at<this.ttlMs)return n.value}update(t){for(let n of this.map.values()){if(n.value!==void 0){let r=t(n.value);n.value=r,n.result=Promise.resolve(r);continue}n.result=n.result.then(r=>{let o=t(r);return n.value=o,o})}}delete(t){this.map.delete(t)}},Ga=class{constructor(t){te(this,"opts",t);te(this,"conversationListeners",new Set);te(this,"conversationRevision",0);te(this,"visitorId");te(this,"conversationId");te(this,"userContext");te(this,"pageContext");te(this,"locale");te(this,"userTokenSource");te(this,"userToken");te(this,"userTokenRequest");te(this,"conversationsCache",new ho(Pv));te(this,"contentCache",new ho(op));te(this,"contentCollectionsCache",new ho(op))}setUserToken(t){this.userTokenSource=t,this.userToken=typeof t=="string"&&t||void 0,this.userTokenRequest=typeof t=="function"?this.fetchUserToken():void 0}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:_r};this.visitorId&&(t.visitorId=this.visitorId),this.conversationId&&(t.conversationId=this.conversationId),this.locale&&(t.locale=this.locale);let n=pl(this.userContext,this.pageContext);return n&&(t[nl]=n),t}withEnvelope(t){return{...this.envelope(),...t}}appendEnvelope(t){for(let[n,r]of Object.entries(this.envelope()))t.append(n,r);return t}withEnvelopeQuery(t){let n=new URL(this.url(t));for(let[r,o]of Object.entries(this.envelope()))n.searchParams.has(r)||n.searchParams.set(r,o);return n.toString()}async handshake(t){De.debug("handshake \u2192",{visitorId:t.visitorId,conversationId:t.conversationId,locale:t.locale}),this.userTokenRequest&&await this.userTokenRequest;let n=await this.postJson(pt.handshake,t,"handshake");return De.debug("handshake \u2190",{visitorId:n.visitorId,conversationId:n.conversationId,hasWelcome:!!n.welcome,hasConfig:!!n.config,rebind:n.rebind}),this.visitorId=t.visitorId,this.conversationId=n.conversationId,n}async uploadFile(t,n){De.debug("uploadFile \u2192",{name:t.name,size:t.size,type:t.type});let r=new FormData;r.append("file",t,t.name);let o=await this.postForm(this.uploadPath,r,"upload",n,Ev(t.size));return De.debug("uploadFile \u2190",{id:o.id,url:o.url}),o}async transcribe(t,n="audio/webm"){De.debug("transcribe \u2192",{size:t.size,mimeType:n});let r=new FormData;r.append("audio",t,`voice.${Mv(n)}`),r.append("mimeType",n);let o=await this.postForm(this.transcribePath,r,"transcribe");return De.debug("transcribe \u2190",{textLen:o.text.length}),o}subscribeConversationChanges(t){return this.conversationListeners.add(t),()=>this.conversationListeners.delete(t)}publishConversation(t,n=!1){let r={type:"upsert",conversation:t,revision:++this.conversationRevision,...n?{activity:!0}:{}};this.conversationsCache.update(o=>{let a=o.pagination.page===1,i=o.conversations.some(d=>d.conversationId===t.conversationId),s=dn(o.conversations,r,a&&n),c=a&&s.length>o.pagination.limit?s.slice(0,o.pagination.limit):s;if(!a||!n||i||o.pagination.hasNext)return c===o.conversations?o:{...o,conversations:c};let p=Math.max(o.pagination.total,o.conversations.length)+1,_=Math.ceil(p/o.pagination.limit);return{...o,conversations:c,pagination:{...o.pagination,total:p,totalPages:_,hasNext:o.pagination.page<_}}});for(let o of this.conversationListeners)o(r)}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 r=this.localeCacheKey(t),o=this.conversationRevision;n&&this.conversationsCache.delete(r);let a=this.conversationsCache.getOrFetch(r,()=>this.fetchConversations(t));return n?a.then(i=>{let s={type:"snapshot",result:i,requestedRevision:o};for(let c of this.conversationListeners)c(s);return i}):a}async fetchConversations(t){let n=new URL(this.url(pt.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:r,beforeCreatedAt:o}={}){let a=new URL(this.url(pt.listMessages));a.searchParams.set("conversationId",t),a.searchParams.set("limit",String(_l)),n.length>0&&a.searchParams.set("ids",n.join(",")),r&&a.searchParams.set("beforeId",r),o&&a.searchParams.set("beforeCreatedAt",o);let i=await this.getJson(a.toString(),"loadConversation");return{...i,messages:i.messages.toReversed()}}async markRead(t,n){if(!this.visitorId||!t)return;let r={type:"read",conversationId:t,...n===void 0?{}:{lastMessageAt:n},revision:++this.conversationRevision};this.conversationsCache.update(o=>{let a=dn(o.conversations,r);return a===o.conversations?o:{...o,conversations:a}});for(let o of this.conversationListeners)o(r);try{await this.postJson(pt.markRead,{conversationId:t},"markRead",!0)}catch(o){De.debug("markRead failed (non-fatal)",{err:o})}}async requestOperator(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(pt.requestOperator,{},"requestOperator")).controlState}catch(t){De.debug("requestOperator failed (non-fatal)",{err:t});return}}async cancelOperatorRequest(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(pt.cancelOperatorRequest,{},"cancelOperatorRequest")).controlState}catch(t){De.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(pt.content));for(let[a,i]of Object.entries(t))i!==void 0&&n.searchParams.set(a,Array.isArray(i)?i.join(","):String(i));let r=await this.getJson(n.toString(),"listContent"),o=r.items?.map(a=>mc(a,this.locale))??[];return{...r,items:o}}async setContentVote(t){try{await this.postJson(this.dataUrl(pt.contentVoteSet),t,"setContentVote")}catch{}}listContentCollections(t){return this.contentCollectionsCache.getOrFetch(this.localeCacheKey({ids:t}),()=>this.fetchContentCollections(t))}async fetchContentCollections(t){let n=new URL(this.dataUrl(pt.contentCollections));return t.length&&n.searchParams.set("ids",t.join(",")),{items:(await this.getJson(n.toString(),"listContentCollections")).items?.map(o=>gc(o,this.locale))??[]}}async bootstrap(t){let n=new URL(this.dataUrl(pt.bootstrap));t&&n.searchParams.set("conversationId",t);let r=await this.getJson(n.toString(),"bootstrap"),o=r.forms??[],a=r.formSubmissions??[];return{forms:o,formSubmissions:a}}async saveUserPrefs(t){return this.postJson(pt.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??pt.submitForm}async submitForm(t){De.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){De.debug("submitForm failed (non-fatal)",{err:n})}}async submitFeedback(t){De.debug("submitFeedback \u2192",{messageId:t.messageId,value:t.value});try{await this.postJson(pt.messageFeedback,{messageId:t.messageId,set:{feedback:t.value}},"submitFeedback")}catch(n){De.debug("submitFeedback failed (non-fatal)",{err:n})}}async sendTurn(t,n={}){De.debug("message \u2192",{conversationId:t.conversationId,visitorId:t.visitorId,messageCount:t.messages.length});let r=JSON.stringify({...this.withEnvelope(t),[nl]:pl(this.userContext,this.pageContext,this.opts.recentHostEvents)}),o=n.keepalive===!0&&new Blob([r]).size<wv;try{return await this.runWithAbort(async a=>{let i=await this.withFreshUserToken(()=>this.fetchImpl(this.url(pt.streamMessage),{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json",...this.headersFor(this.url(pt.streamMessage))},body:r,keepalive:o,signal:a}));if(i.status!==202)throw new _t(`sendTurn failed: expected 202, received ${i.status}`,"server",i.status,void 0,Nv(i));let s;try{s=await i.json()}catch(c){throw a?.aborted?c:new _t("sendTurn failed: invalid acknowledgement","server",i.status,c)}if(!Lv(s))throw new _t("sendTurn failed: invalid acknowledgement","server",i.status);return s},void 0,kv)}catch(a){throw a instanceof _t?a:new _t("sendTurn failed: network error","network",void 0,a)}}cancelTurn(t,n){!this.visitorId||!t||!n||(De.debug("cancel stream",{conversationId:t,runId:n,visitorId:this.visitorId}),this.fetchImpl(this.url(pt.cancelStream),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.headersFor(this.url(pt.cancelStream))},body:JSON.stringify(this.withEnvelope({conversationId:t,runId:n})),keepalive:!0}).catch(r=>De.debug("cancel POST failed (non-fatal)",{err:r})))}async connectResumeStream(t){let n=new AbortController;function r(){return n.abort(t.signal.reason)}t.signal.aborted?r():t.signal.addEventListener("abort",r,{once:!0});let o=setTimeout(()=>n.abort(),Cv);function a(){clearTimeout(o),t.signal.removeEventListener("abort",r)}let i;try{this.userTokenRequest&&await this.userTokenRequest,i=await this.fetchImpl(this.resumeUrl(),{method:"GET",credentials:"omit",headers:{accept:"text/event-stream",...this.headersFor(this.resumeUrl())},signal:n.signal})}catch(c){return a(),t.signal.aborted||De.debug("resume-stream fetch failed \u2014 reconnecting",{err:c}),"held"}if(!i.ok)return a(),i.status===401&&typeof this.userTokenSource=="function"?(await this.fetchUserToken(),"held"):i.status===409||sp.has(i.status)?(De.debug("resume-stream \u2192 transient response; reconnecting",{status:i.status}),"held"):(De.debug("resume-stream \u2192 endpoint unavailable",{status:i.status}),"unavailable");if(!i.body)return a(),De.debug("resume-stream \u2192 bodyless response; stopping",{status:i.status}),"unavailable";if(!(i.headers.get("content-type")??"").includes("text/event-stream"))return a(),De.debug("resume-stream \u2192 non-SSE response; stopping"),"unavailable";let s=!1;try{for await(let{chunk:c}of rp(i,n.signal,p=>{s||p!=="connected"||(s=!0,clearTimeout(o),t.onConnected())})){if(t.signal.aborted)return"held";t.onChunk(c)}}catch(c){if(t.signal.aborted)return"held";De.debug("resume-stream segment dropped \u2014 reconnecting",{err:c})}finally{a()}return"held"}resumeUrl(){return this.withEnvelopeQuery(pt.streamResume)}async postJson(t,n,r,o=!1){let a=await this.fetchWithRetry(()=>[this.url(t),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.headersFor(this.url(t))},body:JSON.stringify(this.withEnvelope(n)),...o?{keepalive:!0}:{}}],r);return this.assertOk(a,r)}async postForm(t,n,r,o,a){return this.runWithAbort(async i=>{let s=await this.withFreshUserToken(()=>this.fetchImpl(this.url(t),{method:"POST",credentials:"omit",headers:this.headersFor(this.url(t)),body:this.appendEnvelope(n),signal:i}));return this.assertOk(s,r)},o,a)}async runWithAbort(t,n,r){if(!n&&r===void 0)return t();let o=new AbortController;function a(){return o.abort(n?.reason)}n?.aborted?a():n?.addEventListener("abort",a,{once:!0});let i=r===void 0?void 0:setTimeout(()=>o.abort(),r);try{return await t(o.signal)}finally{i!==void 0&&clearTimeout(i),n?.removeEventListener("abort",a)}}async getJson(t,n){let r=await this.fetchWithRetry(()=>[this.withEnvelopeQuery(t),{method:"GET",credentials:"omit",headers:{accept:"application/json",...this.headersFor(this.url(t))}}],n);return this.assertOk(r,n)}async fetchWithRetry(t,n){for(let r=0;;r++){let o;try{o=await this.withFreshUserToken(()=>this.fetchImpl(...t()))}catch(i){if(r>=ip)throw new _t(`${n} failed: network error`,"network",void 0,i);De.debug("request network error \u2014 retrying",{label:n,attempt:r}),await Bn(lp(r));continue}if(o.ok||!sp.has(o.status)||r>=ip)return o;let a=Av(o.headers)??lp(r);De.debug("request retryable status \u2014 retrying",{label:n,status:o.status,attempt:r,wait:a}),await Bn(a)}}async assertOk(t,n){if(!t.ok)throw new _t(`${n} failed: ${t.status}`,"server",t.status);return await t.json()}fetchUserToken(){let t=this.userTokenSource;if(typeof t!="function")return Promise.resolve();let n=Promise.resolve().then(t).then(r=>{this.userTokenSource===t&&(this.userToken=r||void 0)},r=>{De.warn("userToken function failed; continuing as an anonymous visitor",{err:r})});return this.userTokenRequest=n,n}headersFor(t){let n=!/^https?:\/\//i.test(t)||t.startsWith(`${this.opts.agentApiBaseUrl}/`);return{...this.opts.auth.headers(),...n&&this.userToken?{[yv]:this.userToken}:{}}}async withFreshUserToken(t){let n=await t();return n.status!==401||!this.userTokenSource?n:typeof this.userTokenSource!="function"?(De.warn("userToken rejected as invalid or expired; pass a function so the widget can fetch a fresh one"),n):(await this.fetchUserToken(),t())}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 Mv(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 Lv(e){if(typeof e!="object"||e===null)return!1;let t=Reflect.get(e,"status"),n=Reflect.get(e,"conversationId"),r=Reflect.get(e,"runId");return t==="accepted"&&typeof n=="string"&&n.length>0&&(r===void 0||typeof r=="string"&&r.length>0)}function Nv(e){let t=Number(e.headers.get("retry-after"));return Number.isInteger(t)&&t>0?t:void 0}function Sr(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 Ka(e,t,n){return Sr("close",e,t)?n.includes("close"):!1}function up(e,t){return e==="inline"&&t==="fullscreen"?"exit-fullscreen":"close"}function kr(e,t,n,r){let o={role:n,text:r};e.emit("message",o),t.onMessage?.(o)}function dp(e){let t=D(e);t.current=e;let n=D(null);return n.current??(n.current=Ov(t)),n.current}function Ov(e){let t=se(null),n=new Set;function r(c){return`${e.current.conversationId()??""}:${c}`}function o(c){return c.frequency==="always"?!1:c.frequency==="conversation"?n.has(r(c.id)):c.id in e.current.persistence.loadFormsDone()}function a(c,p){if(t.value)return;let _=e.current;if(c==="manual"){let d=_.forms.list.find(u=>u.id===p);d&&(t.value={form:d,trigger:"manual"});return}for(let d of _.forms.byTrigger[c]??[]){let u=d.triggers.find(f=>f.kind===c);if(!(!u||!$v(u,_)||o(d)||!Dv(d,_))){t.value={form:d,trigger:c};return}}}function i(c,p){let _=t.value;if(!_)return;t.value=null;let{form:d,trigger:u}=_;d.frequency==="conversation"?n.add(r(d.id)):d.frequency!=="always"&&e.current.persistence.saveFormDone(d.id),e.current.onComplete(d,u,c,p)}function s(){let c=t.value;if(!c)return;let p=e.current.forms.list.find(_=>_.id===c.form.id);p&&p!==c.form&&(t.value={form:p,trigger:c.trigger})}return{activeForm:t,fire:a,refresh:s,complete:c=>i(c,!1),skip:()=>i({},!0)}}function $v(e,t){return e.kind==="after-messages"?t.messageCount()>=Number(e.param??0):e.kind==="page-area"?t.pageArea()===e.param:!0}function Dv(e,t){let n=e.when;if(!n)return!0;if(n.missingContext?.length){let o=t.userContext()??{};if(n.missingContext.some(a=>o[a]!==void 0&&o[a]!==""))return!1}if(n.pageArea&&!(Array.isArray(n.pageArea)?n.pageArea:[n.pageArea]).includes(t.pageArea()??""))return!1;let r=t.messageCount();return!(n.minMessages!=null&&r<n.minMessages||n.maxMessages!=null&&r>n.maxMessages)}function pp(e){return Object.fromEntries(e.map(t=>[t,[]]))}function fl(e,t,n){return e.includes(t)?t:e.includes(n)?n:e[0]??""}function _p(e,t,n){let r=[...new Set(t)],o=fl(r,e,""),a=se({activeTab:o,stacks:pp(r)});return{sig:a,reconcile(i,s){let c=[...new Set(i)],p=a.value,_=fl(c,p.activeTab,s),d=Object.fromEntries(c.map(f=>[f,p.stacks[f]??[]])),u=_===p.activeTab&&c.length===Object.keys(p.stacks).length&&c.every(f=>p.stacks[f]===d[f]);r=c,!u&&(a.value={activeTab:_,stacks:d},_!==p.activeTab&&_&&n?.(_))},switchTab(i){!(i in a.value.stacks)||a.value.activeTab===i||(a.value={...a.value,activeTab:i},n?.(i))},open(i,s){let c=a.value;i in c.stacks&&(a.value={activeTab:i,stacks:{...c.stacks,[i]:s?[s]:[]}},c.activeTab!==i&&n?.(i))},push(i){let s=a.value,c=s.stacks[s.activeTab]??[];a.value={...s,stacks:{...s.stacks,[s.activeTab]:[...c,i]}}},pop(){let i=a.value,s=i.stacks[i.activeTab]??[];s.length!==0&&(a.value={...i,stacks:{...i.stacks,[i.activeTab]:s.slice(0,-1)}})},reset(i){a.value={activeTab:fl(r,i,""),stacks:pp(r)}}}}function fp(e){return e.stacks[e.activeTab]??[]}function mp(e){return fp(e).at(-1)}function gp(e){return fp(e).length===0}function Qa(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 Fv=900,Bv=640;function ml(e,t,n){if(e==="standalone"||e==="page")return"fullscreen";let r=t.initialSize;return r==="expanded"||r==="fullscreen"||r==="normal"?r:n>0&&n<Bv?"fullscreen":n>=(t.autoSizeBreakpoint??Fv)?"expanded":"normal"}function vo(e,t,n,r=null){let a=e.mode==="inline"||e.mode==="standalone"||e.mode==="page"||(n??!e.startMinimized),s=e.mode!=="standalone"&&e.mode!=="page"&&e.mode!=="inline"&&r?r:ml(e.mode,e.size,t);return{panelOpen:a,panelSize:s}}function wr(){return typeof window>"u"?0:window.innerWidth}var ee={fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24"},bo=`${M.cssPrefix}-icon-dir`;function gl(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M21 12a8 8 0 0 1-12 6.93L3 21l1.65-5.16A8 8 0 1 1 21 12Z"})})}function qt(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M18 6 6 18M6 6l12 12"})})}function hp(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M12 5v14M5 12h14"})})}function vp(){return l("svg",{...ee,class:bo,"aria-hidden":"true",children:[l("path",{d:"m22 2-7 20-4-9-9-4Z"}),l("path",{d:"M22 2 11 13"})]})}function bp(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M12 19V5M5 12l7-7 7 7"})})}function yp(){return l("svg",{...ee,class:bo,"aria-hidden":"true",children:l("path",{d:"M3 20V4l18 8-18 8Z"})})}function Cr(){return l("svg",{...ee,class:bo,"aria-hidden":"true",children:l("path",{d:"m9 18 6-6-6-6"})})}function pn(){return l("svg",{...ee,"aria-hidden":"true",children:l("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}function Pp(){return l("svg",{...ee,"aria-hidden":"true",children:l("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"})})}function xp(){return l("svg",{...ee,"aria-hidden":"true",children:[l("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),l("path",{d:"M5 10a7 7 0 0 0 14 0M12 19v3"})]})}function Sp(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M3 8V3h5M21 8V3h-5M3 16v5h5M21 16v5h-5"})})}function kp(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M8 3v5H3M16 3v5h5M8 21v-5H3M16 21v-5h5"})})}function wp(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M3 3h7v2H5v5H3zM21 3h-7v2h5v5h2zM3 21h7v-2H5v-5H3zM21 21h-7v-2h5v-5h2z"})})}function Cp(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M10 3v5H3M14 3v5h7M10 21v-5H3M14 21v-5h7"})})}function Tp(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"M14 3h7v7M21 3l-9 9"}),l("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]})}function Rp(){return l("svg",{...ee,"aria-hidden":"true",viewBox:"0 0 10 10",children:l("path",{d:"M9 1L1 9M9 5L5 9M9 9H9",strokeWidth:"1.5"})})}function Ip(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"5",r:"1.5",fill:"currentColor",stroke:"none"}),l("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),l("circle",{cx:"12",cy:"19",r:"1.5",fill:"currentColor",stroke:"none"})]})}function Ep(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M11 5 6 9H2v6h4l5 4zM15 9a5 5 0 0 1 0 6M18 7a9 9 0 0 1 0 10"})})}function Ap(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M11 5 6 9H2v6h4l5 4zM22 9l-6 6M16 9l6 6"})})}function Mp(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"M3 18 8 6l5 12M4.7 14h6.6"}),l("path",{d:"M14.5 18l3.2-7 3.2 7M15.6 15.8h4.2"})]})}function Lp(){return l("svg",{...ee,class:bo,"aria-hidden":"true",children:l("path",{d:"m5 6 6 6-6 6M13 6l6 6-6 6"})})}function Yn(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M20 6 9 17l-5-5"})})}function Np(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"M3 3v6h6"}),l("path",{d:"M3.05 13A9 9 0 1 0 6 5.3L3 9"}),l("path",{d:"M12 7v5l3 2"})]})}function Op(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"10"}),l("path",{d:"M2 12h20"}),l("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"})]})}function yo(){return l("svg",{...ee,class:bo,"aria-hidden":"true",children:l("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}function $p(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"M12 20h9"}),l("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function Kt(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"m6 9 6 6 6-6"})})}function Xa(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),l("path",{d:"M14 2v6h6"})]})}function Hv(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"m12 3-1.5 4.5L6 9l4.5 1.5L12 15l1.5-4.5L18 9l-4.5-1.5Z"}),l("path",{d:"M19 15v4M17 17h4M5 3v2M4 4h2"})]})}function hl(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z"})})}function Po(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"10"}),l("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),l("path",{d:"M12 17h.01"})]})}function Uv(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"m15 4 3 3-9 9-3-3z"}),l("path",{d:"M18 2v2M20 4h2M3 20l3-3M3 16h2M5 14v2"})]})}function qv(){return l("svg",{...ee,"aria-hidden":"true",children:[l("rect",{x:"4",y:"8",width:"16",height:"12",rx:"2"}),l("path",{d:"M12 8V4"}),l("circle",{cx:"12",cy:"3",r:"1"}),l("path",{d:"M2 14h2M20 14h2M9 13h.01M15 13h.01M9.5 17h5"})]})}function vl(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"M4 14v-2a8 8 0 0 1 16 0v2"}),l("rect",{x:"2",y:"14",width:"4",height:"6",rx:"1.5"}),l("rect",{x:"18",y:"14",width:"4",height:"6",rx:"1.5"}),l("path",{d:"M20 20v1a3 3 0 0 1-3 3h-5"})]})}function zv(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"10"}),l("circle",{cx:"12",cy:"12",r:"4"}),l("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"})]})}function bl(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"11",cy:"11",r:"7"}),l("path",{d:"m21 21-4.3-4.3"})]})}function Dp(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]})}function Fp(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"M3 9.5 12 3l9 6.5"}),l("path",{d:"M5 9v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9"})]})}function Ja(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"m3 11 15-5v12L3 13z"}),l("path",{d:"M3 11v2a2 2 0 0 0 2 2h1V9H5a2 2 0 0 0-2 2z"}),l("path",{d:"M7 15v3a2 2 0 0 0 4 0v-2"}),l("path",{d:"M21 10a3 3 0 0 1 0 4"})]})}function xo(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z"}),l("path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1"})]})}function Bp(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"4"}),l("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"})]})}function Hp(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})}function Up(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"M12 3v18"}),l("path",{d:"M12 3a9 9 0 0 1 0 18z",fill:"currentColor",stroke:"none"})]})}function jv(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"10.5",cy:"10.5",r:"6.5"}),l("path",{d:"M8 11a2.5 2.5 0 0 0 5 0"}),l("path",{d:"m20 20-4.4-4.4"})]})}function Vv(){return l("svg",{...ee,"aria-hidden":"true",children:[l("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"}),l("path",{d:"M18.5 4v3M20 5.5h-3M5.5 16v2.5M6.75 17.25h-2.5"})]})}function Wv(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"M4 18h16"}),l("path",{d:"M5 18a7 7 0 0 1 14 0"}),l("path",{d:"M12 8V6"}),l("path",{d:"M10 6h4"})]})}function Gv(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"M7 11V6.5a1.5 1.5 0 0 1 3 0V10"}),l("path",{d:"M10 10V5.5a1.5 1.5 0 0 1 3 0V10"}),l("path",{d:"M13 10V6.5a1.5 1.5 0 0 1 3 0V12"}),l("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"})]})}function qp(){return l("svg",{...ee,"aria-hidden":"true",children:[l("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),l("path",{d:"M5 15a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2"})]})}function zp(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"M7 10v11H4a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1z"}),l("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"})]})}function jp(){return l("svg",{...ee,"aria-hidden":"true",children:[l("path",{d:"M17 14V3h3a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1z"}),l("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"})]})}function Ya(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"3.5"}),l("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"})]})}function Vp(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"M12 7v5l3 2"})]})}function Tr(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]})}function Rr(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"m15 9-6 6M9 9l6 6"})]})}function Wp(){return l("svg",{...ee,"aria-hidden":"true",children:l("path",{d:"M12 18V5M15 13a4.17 4.17 0 01-3-4 4.17 4.17 0 01-3 4M17.707 6.294A3 3 0 1012 5a3 3 0 10-5.707 1.294M17.996 5.125a4 4 0 012.526 5.77M18 18a4 4 0 002-7.465M19.967 17.482a4 4 0 11-7.967.517 4 4 0 11-7.967-.517M6 18a4 4 0 01-2-7.465M6.004 5.125a4 4 0 00-2.526 5.77"})})}function Gp(){return l("svg",{...ee,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"10"}),l("path",{d:"M12 8v4M12 16h.01"})]})}var Kp={chat:gl,message:hl,bubbles:xo,spark:Hv,wand:Uv,bot:qv,help:Po,lifebuoy:zv,headset:vl,search:jv,sparkles:Vv,concierge:Wv,wave:Gv};var z=M.cssPrefix,L={launcher:`${z}-launcher`,callout:`${z}-callout`,calloutDismiss:`${z}-callout-dismiss`,panel:`${z}-panel`,panelHeader:`${z}-panel-header`,resizeGrip:`${z}-resize-grip`,scrollToBottom:`${z}-scroll-to-bottom`,loadPreviousMessages:`${z}-load-previous-messages`,actionHistory:`${z}-action-history`,actionClose:`${z}-action-close`,langSegment:`${z}-lang-segment`,composer:`${z}-composer`,composerInput:`${z}-composer-input`,composerSend:`${z}-composer-send`,composerStop:`${z}-composer-stop`,compactionStatus:`${z}-compaction-status`,messageQueue:`${z}-message-queue`,queuedMessage:`${z}-queued-message`,queuedMessageRemove:`${z}-queued-message-remove`,composerAttach:`${z}-composer-attach`,composerFileInput:`${z}-composer-file-input`,composerVoice:`${z}-composer-voice`,attachmentChip:`${z}-attachment-chip`,attachmentRemove:`${z}-attachment-remove`,suggestion:`${z}-suggestion`,messageBubble:`${z}-message`,messageRetry:`${z}-message-retry`,messageFile:`${z}-message-file`,messageFeedback:`${z}-message-feedback`,feedbackUp:`${z}-feedback-up`,feedbackDown:`${z}-feedback-down`,messageCopy:`${z}-message-copy`,historyPane:`${z}-history-pane`,historyBack:`${z}-history-back`,historyItem:`${z}-history-item`,historyLoadMore:`${z}-history-load-more`,sidebar:`${z}-sidebar`,sidebarToggle:`${z}-sidebar-toggle`,sidebarNewConversation:`${z}-sidebar-new-conversation`,sidebarItem:`${z}-sidebar-item`,messengerHome:`${z}-messenger-home`,modulesEmpty:`${z}-modules-empty`,tab:`${z}-tab`,tabBadge:`${z}-tab-badge`,homeView:`${z}-home-view`,homeGreeting:`${z}-home-greeting`,homeBrand:`${z}-home-brand`,backHeader:`${z}-back-header`,contentView:`${z}-content-view`,contentScroll:`${z}-content-scroll`,homeSearch:`${z}-home-search`,helpSearch:`${z}-help-search`,homeRecent:`${z}-home-recent`,homeAsk:`${z}-home-ask`,homeWhatsNew:`${z}-home-whats-new`,homeContentRow:`${z}-home-content-row`,helpArticle:`${z}-help-article`,newsItem:`${z}-news-item`,newsMore:`${z}-news-more`,formGate:`${z}-form-gate`,formDone:`${z}-form-done`,formDoneToggle:`${z}-form-done-toggle`,formAnswers:`${z}-form-answers`,formFill:`${z}-form-fill`,formSubmit:`${z}-form-submit`,formSkip:`${z}-form-skip`,formField:`${z}-form-field`,toolAskQuestions:`${z}-tool-ask-questions`,toolInputSubmit:`${z}-tool-input-submit`,toolInputSkip:`${z}-tool-input-skip`,toolApproval:`${z}-tool-approval`,toolApprovalFields:`${z}-tool-approval-fields`,toolApprove:`${z}-tool-approve`,toolReject:`${z}-tool-reject`,toolEdit:`${z}-tool-edit`,toolDecision:`${z}-tool-decision`,typingDots:`${z}-typing-dots`,reasoning:`${z}-reasoning`,replyStopped:`${z}-reply-stopped`,toolAskSummary:`${z}-ask-questions-summary`,toolAskOptions:`${z}-ask-questions-options-toggle`,toolCall:`${z}-tool-call`,toolSteps:`${z}-tool-steps`,toolStep:`${z}-tool-step`,source:`${z}-source`,operatorRequest:`${z}-operator-request`,operatorBanner:`${z}-operator-banner`,cancelOperatorRequest:`${z}-cancel-operator-request`};function ft(e,t){return`${e}-${t}`}var Za=M.cssPrefix;function Qp({onToggle:e,launcher:t,strings:n,leaving:r,edgeTab:o}){let a=t.variant!=="circle"&&!!t.label;return l("button",{type:"button",class:`${Za}-fab`,part:"launcher","data-variant":t.variant,"data-size":t.size,"data-edge-tab":o?"true":void 0,"data-leaving":r?"true":void 0,"data-testid":L.launcher,onClick:e,"aria-label":n.launcherOpen,children:[Kv(t.icon),a?l("span",{class:`${Za}-fab-label`,children:St(n,t.label??"")}):null]})}function Kv(e){let t=Kp[e];return t?l(t,{}):l(Qv,{source:e})}function Qv({source:e}){return l("span",{ref:t=>{t&&Xv(t,e)},"aria-hidden":"true"})}function Xv(e,t){if(e.dataset.svgMounted!==t)try{let r=new DOMParser().parseFromString(t,"image/svg+xml").documentElement;r.tagName.toLowerCase()==="svg"&&(e.replaceChildren(document.importNode(r,!0)),e.dataset.svgMounted=t)}catch{}}function Xp({callout:e,launcherPosition:t,strings:n,closeLabel:r,onDismiss:o}){let[a,i]=H(!1);return $(()=>{let s=setTimeout(()=>i(!0),e.delayMs);return()=>clearTimeout(s)},[e.delayMs]),$(()=>{if(!a||e.autoDismissMs<=0)return;let s=setTimeout(o,e.autoDismissMs);return()=>clearTimeout(s)},[a,e.autoDismissMs,o]),a?l("div",{class:`${Za}-callout`,role:"status","data-shape":e.shape,"data-position":Jv(e.position,t),"data-animated":e.animated?"true":void 0,"data-testid":L.callout,children:[l("span",{children:St(n,e.text)}),l("button",{type:"button",class:`${Za}-callout-close`,onClick:o,"aria-label":r,title:r,"data-testid":L.calloutDismiss,children:l(qt,{})})]}):null}function Jv(e,t){let n=t.endsWith("-right"),r=t.startsWith("bottom-");return e==="vertical"?r?"top":"bottom":n?"left":"right"}var Yv='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function ei(e){function t(n){if(n.key!=="Tab")return;let r=[...e.querySelectorAll(Yv)].filter(s=>s.offsetParent!==null||s===document.activeElement);if(r.length===0){n.preventDefault();return}let o=r[0],a=r[r.length-1];if(!o||!a)return;let i=e.getRootNode().activeElement;n.shiftKey&&i===o?(n.preventDefault(),a.focus()):!n.shiftKey&&i===a&&(n.preventDefault(),o.focus())}return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}var In=M.cssPrefix;function ti({title:e,actions:t}){return l("header",{class:`${In}-back-header`,part:"header","data-variant":"title",children:[l("span",{class:`${In}-back-spacer`,"aria-hidden":"true"}),l("h1",{class:`${In}-back-title`,children:e}),t??l("span",{class:`${In}-back-spacer`,"aria-hidden":"true"})]})}function ni({title:e,backLabel:t,onBack:n,actions:r,testid:o}){return l("header",{class:`${In}-back-header`,part:"header","data-testid":o,children:[l("button",{type:"button",class:`${In}-icon-btn`,onClick:n,"aria-label":t,title:t,children:l(yo,{})}),l("h1",{class:`${In}-back-title`,children:e}),r??l("span",{class:`${In}-back-spacer`,"aria-hidden":"true"})]})}function So({textSig:e,doneSig:t,generativeUi:n=!1,strings:r=Vo}){let o=D(null);return It(()=>{let a=o.current;if(!a)return;a.classList.add(`${M.cssPrefix}-md`),a.replaceChildren();let i=n?tl(a,{cssPrefix:M.cssPrefix,strings:r}):void 0,s=br(i??io(a)),c=0,p=Wt(()=>{let u=e.value,f=t.value;u.length<c&&(i?.dispose(),a.replaceChildren(),i=n?tl(a,{cssPrefix:M.cssPrefix,strings:r}):void 0,s=br(i??io(a)),c=0);let m=u.slice(c);m&&et(s,m),c=u.length,f&&(ao(s),i?.finish())}),_=new MutationObserver(()=>Jp(a));_.observe(a,{childList:!0,subtree:!0}),Jp(a);function d(u){let f=u.target?.closest?.("a");if(!f||!(f instanceof HTMLAnchorElement))return;let m=f.getAttribute("href")??"";!m||m.startsWith("#")||(u.preventDefault(),window.open(m,"_blank","noopener,noreferrer"))}return a.addEventListener("click",d),()=>{p(),i?.dispose(),_.disconnect(),a.removeEventListener("click",d)}},[e,t,n,r]),l("div",{ref:o})}function Zp({text:e}){let t=le(()=>se(e),[e]),n=le(()=>se(!0),[]);return l(So,{textSig:t,doneSig:n})}var cb=/<(\/?)(?:(Note|Info|Tip|Warning|Danger|Check|Callout)|Tabs?|Steps?|AccordionGroup|Accordion|Expandable|Columns|CardGroup|Card|Frame|CodeGroup|Badge|Icon|Video|Embed|ParamField|ResponseField)\b((?:"[^"]*"|'[^']*'|[^>"'])*?)(\/?)>|(^|\n)([ \t]*)(```[^]*?(?:\n[ \t]*```|$))?/g;function e_(e){let t=0,n="";return e.replace(cb,(r,o,a,i,s,c,p,_)=>{if(o===void 0)return t?c+(_?.split(`
58
58
  ${p}`).join(`
59
59
  `)??n):r;if(o)return t--,a&&(n=n.slice(2)),a?`
60
- ${n}`:"";s||(t++,a&&(n+="> "));let d={};i.replace(/(\w+)=(["'])(.*?)\2/g,(m,v,x,P)=>d[v]=P);let u=d.href??d.src,f=d.title??d.path??d.query??d.body??d.header??d.name??u;return(a?"> ":"")+(f?`**${u?`[${f}](${u})`:f}**${d.type?` \`${d.type}\``:""}
61
- ${n}`:"")})}function zp(e){for(let t of e.querySelectorAll("a")){let n=t.getAttribute("href")??"";!n||n.startsWith("#")||(t.target="_blank",t.rel="noopener noreferrer")}}var jp=new Set([11,12,13,14,15,16,17,18,19,31]);function Za(e){let t="",n=[],r=hr({data:void 0,add_token:(o,a)=>{n.push(a),jp.has(a)||(t+=" ")},end_token:()=>{let o=n.pop();o!==void 0&&!jp.has(o)&&(t+=" ")},add_text:(o,a)=>{t+=a},set_attr:()=>{}});return Xe(r,e),ao(r),t.replace(/\s+/g," ").trim()}var Gp=E.cssPrefix;function $t({tone:e="info",message:t,onRetry:n,strings:r}){return l("div",{class:`${Gp}-module-empty`,role:e==="error"?"alert":"status","aria-live":"polite",children:[l("span",{children:t}),n?l("button",{type:"button",class:`${Gp}-module-retry`,onClick:n,children:r.errorRetry}):null]})}var Rn=E.cssPrefix,ey=Z.scope("content"),ty=5e3;function Kp({id:e,title:t,transport:n,strings:r,bus:o,onBack:a,actions:i}){let[s,c]=H(null),[p,_]=H(!1),[d,u]=H(!1),[f,m]=H(0),[v,x]=H(null),P=$(()=>{u(!1),c(null),m(g=>g+1)},[]);D(()=>{let g=!1,k=n.listContentCollections([]).catch(()=>{});return Promise.all([n.listContent({ids:[e],limit:1}),k]).then(([w,T])=>{if(g)return;let A=w.items[0];A?(c(A),_(T?.items.find(M=>M.id===A.contentCollectionId)?.settings?.voteAccess==="portal"),o.emit("contentOpen",{contentId:e,contentCollectionId:A.contentCollectionId})):u(!0)}).catch(w=>{g||(ey.warn("listContent (reader) failed",{err:w}),u(!0))}),()=>{g=!0}},[n,e,f,o]),D(()=>{if(!s)return;let g=setTimeout(()=>o.emit("contentRead",{contentId:e}),ty);return()=>clearTimeout(g)},[s,e,o]);let b=$(g=>{let w=g.target?.closest?.("a")?.getAttribute("href")??"";w&&!w.startsWith("#")&&o.emit("contentLinkClick",{contentId:e})},[o,e]);function C(g){x(e),n.setContentVote({contentId:e,value:g})}function h(){return d?l($t,{tone:"error",message:r.errorGeneric,onRetry:P,strings:r}):s===null?l($t,{message:r.contentLoading,strings:r}):l("article",{class:`${Rn}-content`,"data-testid":L.contentView,onClick:b,children:[s.image?l("img",{class:`${Rn}-content-hero`,src:s.image,alt:"",loading:"lazy"}):null,s.description?l("p",{class:`${Rn}-content-subtitle`,children:s.description}):null,l(Vp,{text:Wp(s.content??"")}),p?l("div",{class:`${Rn}-content-vote`,"aria-live":"polite",children:v===e?r.feedbackThanks:l(de,{children:[l("span",{children:r.contentHelpful}),l("button",{type:"button",class:`${Rn}-module-retry`,onClick:()=>C(1),children:r.confirmYes}),l("button",{type:"button",class:`${Rn}-module-retry`,onClick:()=>C(0),children:r.confirmNo})]})}):null]})}return l("div",{class:`${Rn}-module`,children:[l(Ya,{title:s?.title||t||r.moduleBack,backLabel:r.moduleBack,onBack:a,actions:i,testid:L.backHeader}),l("div",{class:`${Rn}-module-scroll`,"data-testid":L.contentScroll,children:h()})]})}function Qp({itemCount:e,initialFocusIndex:t}){let[n,r]=H(!1),o=F(null),a=F(null),[i,s]=H(-1),c=$(()=>{r(!1),s(-1),o.current?.focus()},[]),p=$(()=>r(u=>!u),[]);D(()=>{if(!n)return;function u(f){let m=a.current,v=o.current;if(!m||!v)return;let x=f.composedPath();x.includes(m)||x.includes(v)||(r(!1),s(-1))}return document.addEventListener("click",u,!0),()=>document.removeEventListener("click",u,!0)},[n]),D(()=>{if(!n||e===0)return;let u=t?.()??0,f=u<0||u>=e?0:u;s(f)},[n,e,t]),D(()=>{if(!n||i<0)return;a.current?.querySelectorAll("[role='menuitem']")?.[i]?.focus()},[n,i]);let _=$(u=>{(u.key==="ArrowDown"||u.key==="Enter"||u.key===" ")&&(u.preventDefault(),r(!0))},[]),d=$(u=>{if(e!==0)switch(u.key){case"Escape":u.preventDefault(),c();return;case"ArrowDown":u.preventDefault(),s(f=>(f+1)%e);return;case"ArrowUp":u.preventDefault(),s(f=>(f-1+e)%e);return;case"Home":u.preventDefault(),s(0);return;case"End":u.preventDefault(),s(e-1)}},[e,c]);return{open:n,focusIndex:i,triggerRef:o,menuRef:a,toggle:p,close:c,onTriggerKey:_,onMenuKey:d}}function Xp({items:e,triggerLabel:t}){let n=E.cssPrefix,r=Qp({itemCount:e.length});function o(s){s.disabled||(s.onSelect?.(),s.keepOpen||r.close())}function a(s,c){return s.onSelectValue?.(c)}function i(s,c){let p=c.segments;if(!p?.length)return;let _=Math.max(0,p.findIndex(u=>u.value===c.value)),d=-1;if(s.key==="ArrowRight"||s.key==="Enter"||s.key===" ")d=(_+1)%p.length;else if(s.key==="ArrowLeft")d=(_-1+p.length)%p.length;else return;s.preventDefault(),s.stopPropagation(),a(c,p[d].value)}return l("div",{class:`${n}-menu-wrap`,children:[l("button",{ref:r.triggerRef,type:"button",class:`${n}-icon-btn`,"aria-label":t,"aria-haspopup":"menu","aria-expanded":r.open,title:t,onClick:r.toggle,onKeyDown:r.onTriggerKey,children:l(Sp,{})}),r.open?l("div",{ref:r.menuRef,class:`${n}-menu`,role:"menu","aria-label":t,onKeyDown:r.onMenuKey,tabIndex:-1,children:e.map(s=>s.segments?l("div",{role:"menuitem",class:`${n}-menu-item ${n}-menu-item-segmented`,"aria-label":s.label,tabIndex:-1,onKeyDown:c=>i(c,s),children:[s.icon?l("span",{class:`${n}-menu-icon`,children:s.icon}):null,l("span",{class:`${n}-menu-label`,children:s.label}),l("span",{class:`${n}-segmented`,role:"group","aria-label":s.label,children:s.segments.map(c=>{let p=c.value===s.value;return l("button",{type:"button",role:"menuitemradio","aria-checked":p,class:`${n}-segment`,"data-on":p?"true":void 0,lang:c.lang,title:c.value,tabIndex:-1,"data-testid":`${L.langSegment}-${c.value}`,onClick:()=>a(s,c.value),children:c.label},c.value)})})]},s.id):l("button",{type:"button",role:"menuitem",class:`${n}-menu-item`,"aria-pressed":s.type==="switch"?s.on:void 0,disabled:s.disabled,onClick:()=>o(s),children:[s.icon?l("span",{class:`${n}-menu-icon`,children:s.icon}):null,l("span",{class:`${n}-menu-label`,children:s.label}),s.type==="switch"&&s.on?l("span",{class:`${n}-menu-check`,"aria-hidden":"true",children:l(Xn,{})}):null]},s.id))}):null]})}var ml=E.cssPrefix;function ny(e){let t=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)").matches:!0;return e==="host"?pr()==="dark"?"light":"dark":e==="auto"?t?"light":"dark":t?e==="light"?"dark":"auto":e==="dark"?"light":"auto"}var ry={normal:"large",large:"small",small:"normal"};function oy(e){return e==="light"?l(Lp,{}):e==="dark"?l(Np,{}):l(Op,{})}function ay(e){return(e.split("-")[0]??e).toUpperCase()}function iy(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 Jt({panelProps:e,variant:t}){let{options:n,panelSize:r,feedback:o,onClose:a,onClear:i,onExpand:s,onFullscreen:c,onSoundToggle:p}=e,{onToggleHistory:_,onLocaleChange:d,onThemeChange:u,onTextSizeChange:f}=e,m=n.strings,v=n.mode,x=t==="chat",P=Et(()=>o.mutedSig.value).value,b=new Set(n.actions);function C(K){return b.has(K)}let h=typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches;function g(K){return h?!1:Pr(K,v,r)}let k=n.themeMode,w={auto:m.themeAuto,light:m.themeLight,dark:m.themeDark,host:m.themeAuto},T=n.textSize,A={small:m.textSizeSmall,normal:m.textSizeNormal,large:m.textSizeLarge},M=[];if(x&&C("clear")&&M.push({id:"clear",icon:l(Ep,{}),label:m.newConversation,onSelect:i}),C("expand")&&g("expand")){let K=r==="expanded";M.push({id:"expand",icon:K?l(vp,{}):l(hp,{}),label:K?m.collapse:m.expand,type:"switch",on:K,onSelect:s})}if(C("fullscreen")&&g("fullscreen")){let K=r==="fullscreen";M.push({id:"fullscreen",icon:K?l(bp,{}):l(yp,{}),label:K?m.exitFullscreen:m.fullscreen,type:"switch",on:K,onSelect:c})}let N=n.popOutUrl,O=n.aiAgentDeploymentId;C("popOut")&&N&&O&&Pr("popOut",v,r)&&M.push({id:"popOut",icon:l(Pp,{}),label:m.popOut,onSelect:()=>{let K=iy(N,{conversationId:e.conversationId,widgetId:n.widgetId,publicKey:n.publicKey,aiAgentDeploymentId:O});K&&window.open(K,"_blank","noopener,noreferrer")}}),x&&C("sound")&&M.push({id:"sound",icon:P?l(wp,{}):l(kp,{}),label:P?m.soundOff:m.soundOn,type:"switch",on:!P,onSelect:p}),C("theme")&&M.push({id:"theme",icon:oy(k),label:`${m.theme}: ${w[k]}`,onSelect:()=>u(ny(k)),keepOpen:!0}),C("textSize")&&M.push({id:"textSize",icon:l(Cp,{}),label:`${m.textSize}: ${A[T]}`,onSelect:()=>f(ry[T]),keepOpen:!0}),C("language")&&n.availableLocales.length>1&&M.push({id:"language",icon:l(Rp,{}),label:m.language,segments:n.availableLocales.map(K=>({value:K,label:ay(K),lang:K})),value:n.locale,onSelectValue:d});let z=!!a&&ja(v,r,n.actions),V=x&&C("history");return l("div",{class:`${ml}-header-actions`,children:[V?l("button",{type:"button",class:`${ml}-icon-btn`,onClick:_,"aria-label":m.history,title:m.history,"data-testid":L.actionHistory,children:l(Ip,{})}):null,M.length>0?l(Xp,{items:M,triggerLabel:m.moreActions}):null,z?l("button",{type:"button",class:`${ml}-icon-btn`,onClick:a,"aria-label":m.close,title:m.close,"data-testid":L.actionClose,children:l(Ut,{})}):null]})}var Jp={Icon:xo};function Jn(e,t){return e instanceof ut&&e.status===429?t.errorRateLimited:t.errorGeneric}var Ir=E.cssPrefix;function Yp({placeholder:e,onActivate:t}){return l("button",{type:"button",class:`${Ir}-home-search`,onClick:t,"data-testid":L.homeSearch,children:[l("span",{class:`${Ir}-home-search-text`,children:e}),l("span",{class:`${Ir}-home-search-icon`,"aria-hidden":"true",children:l(fl,{})})]})}function Zp({placeholder:e,value:t,onInput:n}){return l("div",{class:`${Ir}-home-search`,"data-input":"true",children:[l("input",{type:"search",class:`${Ir}-home-search-input`,placeholder:e,value:t,maxLength:200,onInput:r=>n(r.currentTarget.value),"data-testid":L.helpSearch}),l("span",{class:`${Ir}-home-search-icon`,"aria-hidden":"true",children:l(fl,{})})]})}var So=E.cssPrefix;function ei({title:e,subtitle:t,onClick:n,testid:r}){return l("button",{type:"button",class:`${So}-list-row`,onClick:n,"data-testid":r,children:[l("span",{class:`${So}-list-row-body`,children:[l("span",{class:`${So}-list-row-title`,children:e}),t?l("span",{class:`${So}-list-row-sub`,children:t}):null]}),l("span",{class:`${So}-list-row-chevron`,"aria-hidden":"true",children:l(kr,{})})]})}var Yt=E.cssPrefix,sy=Z.scope("help"),ly=20,cy=300;function uy(e,t,n){let r=new Map(n.map(o=>[o.id,o.title]));return t.map(o=>({id:o,title:r.get(o),rows:e.filter(a=>a.contentCollectionId===o)})).filter(o=>o.rows.length>0)}function e_({transport:e,strings:t,bus:n},r,o){let[a,i]=H(),s=F(void 0);function c(p){if(!r?.length)return;let _={};s.current=_,i(d=>({search:o,items:[],collections:[],...d,pagination:p>1?d?.pagination:void 0,loading:!0,error:void 0})),Promise.all([e.listContent({contentCollectionIds:r,sortBy:"order",page:p,limit:ly,search:o}),p>1?void 0:e.listContentCollections(r)]).then(([d,u])=>{s.current===_&&(i(f=>({search:o,items:[...p>1?f?.items??[]:[],...d.items],collections:u?.items??f?.collections??[],pagination:d.pagination,loading:!1})),!(p>1)&&(o?n.emit("contentSearch",{queryLength:o.length,hitCount:d.pagination.total}):n.emit("contentView",{section:"help",count:d.items.length})))}).catch(d=>{s.current===_&&(sy.warn("listContent (help) failed",{err:d,page:p}),i(u=>u&&{...u,loading:!1,error:Jn(d,t)}))})}return D(()=>{if(!r?.length){i(void 0);return}return c(1),()=>{s.current=void 0}},[e,r,o]),[a,()=>!a?.loading&&c((a?.pagination?.page??0)+1)]}function dy(e){let{strings:t,config:n,nav:r,panelProps:o}=e,a=n.contentCollectionIds,[i,s]=H(""),[c,p]=H(""),_=e_(e,a),d=e_(e,c?a:void 0,c),[u,f]=i.trim()?d:_;D(()=>{let v=setTimeout(()=>p(i.trim()),cy);return()=>clearTimeout(v)},[i]);function m(){if(!a?.length)return l($t,{message:t.helpEmpty,strings:t});let v=u?.error?l($t,{tone:"error",message:u.error,onRetry:f,strings:t}):null;return v&&!u?.pagination?v:!u||!u.pagination&&!u.items.length?l($t,{message:t.helpLoading,strings:t}):u.items.length?l(de,{children:[uy(u.items,a,u.collections).map(x=>l("section",{class:`${Yt}-help-group`,children:[x.title?l("h2",{class:`${Yt}-help-section-title`,children:x.title}):null,l("div",{class:`${Yt}-help-card`,children:x.rows.map(P=>l(ei,{title:P.title,subtitle:P.description,onClick:()=>r.push(P.url?{kind:"iframe",url:P.url,title:P.title}:{kind:"content",id:P.id,title:P.title}),testid:dt(L.helpArticle,P.id)},P.id))})]},x.id)),v,u.pagination?.hasNext&&!v?l("div",{children:l("div",{class:`${Yt}-help-card`,children:l("button",{type:"button",class:`${Yt}-list-row ${Yt}-help-more`,onClick:f,"aria-busy":u.loading,children:[u.loading?l("span",{class:`${Yt}-loading-spinner`,"aria-hidden":"true"}):null,t.helpShowMore]})})}):null]}):l($t,{message:u.search?t.helpSearchEmpty.replace("{query}",u.search):t.helpEmpty,strings:t})}return l("div",{class:`${Yt}-module`,children:[l(Ja,{title:t.helpTitle,actions:l(Jt,{panelProps:o,variant:"plain"})}),l("div",{class:`${Yt}-module-pad`,children:l(Zp,{placeholder:t.helpSearchPlaceholder,value:i,onInput:s})}),l("div",{class:`${Yt}-help-list`,children:m()})]})}var t_={Icon:Po,Root:e=>l(dy,{...e})};var n_=Z.scope("attachments");function ti(e,t,n){let r=_y(e),o=[],a=[],i=gy(n.accept),s=t.reduce((p,_)=>p+_.size,0),c=t.length;for(let p of r){let _=py(p,c,s,n,i);if(_){a.push({file:p,reason:_});continue}o.push(my(p)),s+=p.size,c+=1}return(o.length||a.length)&&n_.debug("ingest",{accepted:o.length,rejected:a.map(p=>({name:p.file.name,reason:p.reason}))}),{accepted:o,rejected:a}}function Rr(e){try{URL.revokeObjectURL(e.previewUrl)}catch(t){n_.debug("revokeObjectURL failed",{error:t})}}function py(e,t,n,r,o){return t>=r.maxCount?"count":n+e.size>r.maxBytes?"bytes":hy(e,o)?null:"mime"}function _y(e){return e?Array.isArray(e)?e.filter(t=>t instanceof File):[...e].map(t=>t instanceof File?t:fy(t)).filter(t=>t!==null):[]}function fy(e){let t=e;return!t?.getAsFile||t.kind!=="file"?null:t.getAsFile()}function my(e){return{file:e,id:It(),mediaType:e.type||"application/octet-stream",name:e.name||"pasted-file",previewUrl:URL.createObjectURL(e),size:e.size}}function gy(e){return e.split(",").map(t=>t.trim().toLowerCase()).filter(Boolean).map(t=>{if(t.startsWith("."))return{kind:"ext",ext:t};let[n="*",r="*"]=t.split("/");return{kind:"mime",type:n,subtype:r}})}function hy(e,t){if(t.length===0)return!0;let[n="*",r="*"]=(e.type||"").toLowerCase().split("/"),o=(e.name||"").toLowerCase();return t.some(a=>a.kind==="ext"?o.endsWith(a.ext):a.type==="image"&&a.subtype==="*"&&/\.(heic|heif|avif|bmp|tif|tiff)$/.test(o)?!0:(a.type==="*"||a.type===n)&&(a.subtype==="*"||a.subtype===r))}var ko=E.cssPrefix;function r_({attachment:e,onRemove:t,disabled:n=!1}){let r=/^image\/(jpeg|png|gif|webp|avif|bmp|x-ms-bmp|svg\+xml)$/i.test(e.mediaType);return l("span",{class:`${ko}-attachment-chip`,title:e.name,"data-testid":dt(L.attachmentChip,e.id),children:[r?l("img",{class:`${ko}-attachment-thumb`,src:e.previewUrl,alt:""}):l("span",{class:`${ko}-attachment-thumb`,"aria-hidden":"true",children:l(Wa,{})}),l("span",{class:`${ko}-attachment-name`,children:e.name}),l("button",{type:"button",class:`${ko}-attachment-remove`,onClick:t,disabled:n,"aria-label":`Remove ${e.name}`,"data-testid":dt(L.attachmentRemove,e.id),children:l(Ut,{})})]})}var gl={isSupported:!1,start:()=>{},stop:()=>{},cancel:()=>{}};function hl(e,t,n){return e==="disabled"?gl:e==="server"?Py(n):vy(t)}function vy(e){let t=yy();if(!t)return gl;let n=null,r=0;return{isSupported:!0,start(o,a){let i=n,s=++r;n=null,i?.abort();let c=new t;n=c,c.continuous=!0,c.interimResults=!0,c.lang=e;let p=!1;c.addEventListener("result",d=>{if(r!==s||n!==c)return;let u=d,f="",m=!1;for(let v=u.resultIndex;v<u.results.length;v++){let x=u.results[v];x&&(f+=x[0].transcript,x.isFinal&&(m=!0))}o(f,m)});function _(){p||r!==s||n!==c||(p=!0,n=null,a())}c.addEventListener("end",_),c.addEventListener("error",_);try{c.start()}catch{_()}},stop(){n?.stop()},cancel(){r++;let o=n;n=null,o?.abort()}}}function yy(){return window.SpeechRecognition??window.webkitSpeechRecognition}var by=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];function Py(e){if(typeof MediaRecorder>"u"||!navigator?.mediaDevices?.getUserMedia)return gl;let t=0,n=null;function r(i){for(let s of i.stream?.getTracks()??[])s.stop();i.stream=null}function o(){t++;let i=n;n=null,i&&(r(i),i.recorder?.state!=="inactive"&&i.recorder?.stop())}async function a(i){if(i.finishing)return;i.finishing=!0;let s=i.recorder?.mimeType??"audio/webm";r(i);let c=new Blob(i.chunks,{type:s});i.chunks=[];try{let{text:p}=await e(c,s);n===i&&t===i.generation&&p&&i.onText(p,!0)}catch{}finally{n===i&&t===i.generation&&(n=null,i.onEnd())}}return{isSupported:!0,async start(i,s){o();let c={generation:t,recorder:null,stream:null,chunks:[],onText:i,onEnd:s,finishing:!1};n=c;try{let p=await navigator.mediaDevices.getUserMedia({audio:!0});if(n!==c||t!==c.generation){for(let u of p.getTracks())u.stop();return}c.stream=p;let _=xy(),d=new MediaRecorder(p,_?{mimeType:_}:void 0);c.recorder=d,d.addEventListener("dataavailable",u=>{n===c&&t===c.generation&&u.data.size>0&&c.chunks.push(u.data)}),d.addEventListener("stop",()=>{n===c&&t===c.generation&&a(c)}),d.start()}catch{r(c),n===c&&t===c.generation&&(n=null,s())}},stop(){let i=n;if(i){if(!i.recorder){o();return}i.recorder.state!=="inactive"&&i.recorder.stop()}},cancel(){o()}}}function xy(){for(let e of by)if(MediaRecorder.isTypeSupported(e))return e}var Ye=E.cssPrefix,Er=Z.scope("composer");function Ar(e){return e.reduce((t,n)=>t+n.size,0)}var vl={arrowUp:pp,paperPlane:dp,send:_p,chevron:kr};function o_(e){return"activeElement"in e}function Sy(e){return"host"in e&&"activeElement"in e}function a_({options:e,transport:t,feedback:n,bus:r,persistence:o,conversationId:a,isStreaming:i,pageToolRunning:s=!1,isMemoryCompacting:c=!1,canReleaseQueuedMessages:p=!0,queueManualMessages:_=!1,active:d=!0,isPreparing:u=!1,operatorRequestEnabled:f,canRequestOperator:m=!1,controlMode:v="ai-agent",onRequestOperator:x,onSend:P,onStop:b,apiRef:C}){let h=e.strings,[g,k]=H(()=>o.loadDraft(a)),[w,T]=H([]),[A,M]=H(()=>o.loadMessageQueue(a).map(B=>({id:B.id,text:B.text,attachments:[]}))),N=F(A),O=F(!1),[z,V]=H(!1),[K,ne]=H(!1),G=F(!1),Y=F(null),De=F(null),_e=F(null),Te=F(0),et=F(a);et.current=a;let Ue=F(d);Ue.current=d;let ht=F(u);ht.current=u;let Ge=K||u||!d,vt=i&&v==="ai-agent",pt=vt||c&&v==="ai-agent",kt=v==="ai-agent"&&(pt||_||A.length>0),wt=$(B=>{M(Q=>{let te=B(Q);return o.saveMessageQueue(et.current,te.filter(me=>me.attachments.length===0).map(({id:me,text:it})=>({id:me,text:it}))),N.current=te,te})},[o]),Ee=$(B=>{wt(Q=>(Q.find(te=>te.id===B)?.attachments.forEach(Rr),Q.filter(te=>te.id!==B)))},[wt]),He=$(B=>{k(Q=>{let te=typeof B=="function"?B(Q):B;return te===Q?Q:(o.saveDraft(et.current,te),te)})},[o]),be=e.features.fileUpload,ot=e.features.voice,[ve,yt]=H(()=>hl(ot,e.locale,(B,Q)=>t.transcribe(B,Q))),Ke=F(ve);Ke.current=ve;let Dt=F({mode:ot,locale:e.locale,transport:t});D(()=>{let B=Dt.current;B.mode===ot&&B.locale===e.locale&&B.transport===t||(Dt.current={mode:ot,locale:e.locale,transport:t},Te.current++,Ke.current.cancel(),_e.current=null,V(!1),yt(hl(ot,e.locale,(Q,te)=>t.transcribe(Q,te))))},[e.locale,ot,t]),Rt(()=>()=>{Te.current++,ve.cancel()},[ve]);let y=$(B=>{let Q=_e.current;if(Q===null)return!1;let te=Math.round(performance.now()-Q);return Er[B]("voiceStop",{durationMs:te}),r.emit("voiceStop",{durationMs:te}),_e.current=null,!0},[r]),U=$(()=>{_e.current!==null&&(ve.stop(),V(!1),y("info")&&n.play("voiceStop"))},[y,n,ve]),J=$(()=>{Te.current++,ve.cancel(),V(!1),y("info")&&n.play("voiceStop")},[y,n,ve]);D(()=>{(u||!d)&&J()},[d,J,u]),D(()=>{let B=Y.current;if(!B)return;let Q=B.getRootNode(),te=o_(Q)?Q.activeElement:null;te&&B.closest(`.${Ye}-panel`)?.contains(te)||B.focus({preventScroll:!0})},[]),D(()=>{let B=Y.current;if(!B)return;if(g.length===0){B.style.height="";return}B.style.height="auto";let Q=getComputedStyle(B),te=Number.parseFloat(Q.getPropertyValue(`--${Ye}-textarea-base-height`)),me=Number.parseFloat(Q.borderTopWidth)+Number.parseFloat(Q.borderBottomWidth),it=Math.min(B.scrollHeight+me,Number.parseFloat(Q.maxHeight)),jt=Number.parseFloat(Q.fontSize)*.7;B.style.height=`${it<te+jt?te:it}px`},[g]);let ee=F(w);ee.current=w,D(()=>()=>{ee.current.forEach(Rr);for(let B of N.current)B.attachments.forEach(Rr)},[]),Rt(()=>{if(C)return C.current={attachFromDrop:B=>{if(!be||!Ue.current||G.current||ht.current)return;let Q=ti(B,ee.current,e.attachments);Q.accepted.length!==0&&(Er.info("attach (drop)",{count:Q.accepted.length,totalBytes:Ar(Q.accepted)}),r.emit("attach",{count:Q.accepted.length,totalBytes:Ar(Q.accepted)}),T(te=>[...te,...Q.accepted]))},fill:B=>{if(!Ue.current||G.current||ht.current)return;He(B);let Q=Y.current;Q&&(Q.focus({preventScroll:!0}),requestAnimationFrame(()=>Q.setSelectionRange(Q.value.length,Q.value.length)))},acceptQueuedMessage:Ee},()=>{C.current&&(C.current=null)}},[C,be,u,e.attachments,Ee,He]),D(()=>{let B=Y.current;if(!B)return;let Q=B.closest(`.${Ye}-panel`);if(!Q)return;let te=me=>{if(!Ue.current||G.current||ht.current)return;let it=me.clipboardData;if(!it)return;let jt=me.target?.closest?.("input, textarea, [contenteditable]:not([contenteditable='false'])");if(jt&&jt!==B)return;if(be){let Lt=ti(it.items,ee.current,e.attachments);if(Lt.accepted.length>0){me.preventDefault(),Er.info("attach (paste)",{count:Lt.accepted.length,totalBytes:Ar(Lt.accepted)}),r.emit("attach",{count:Lt.accepted.length,totalBytes:Ar(Lt.accepted)}),T(ce=>[...ce,...Lt.accepted]);return}}if(jt===B)return;let en=it.getData("text/plain");en&&(me.preventDefault(),He(Lt=>Lt+en),B.focus())};return Q.addEventListener("paste",te),()=>Q.removeEventListener("paste",te)},[be,e.attachments,He]);async function ie(){let B=g.trim();if(!B&&w.length===0||!d||vt||G.current||u)return;J(),G.current=!0,ne(!0);let Q=g,te=w;try{await P(B,te)&&(He(me=>me===Q?"":me),T(me=>me!==te?me:(te.forEach(Rr),ee.current=[],[])))}finally{G.current=!1,ne(!1),requestAnimationFrame(()=>{let me=Y.current;if(!me||me.disabled||!Ue.current)return;let it=me.getRootNode(),jt=o_(it)?it.activeElement:null,en=jt?.getAttribute("data-testid");if(!(jt&&jt!==me&&en!==L.composerSend&&en!==L.composerStop)){if(Sy(it)){let Lt=it.host.ownerDocument;if(!Lt.hasFocus())return;let ce=Lt.activeElement;if(ce&&ce!==it.host&&ce!==Lt.body)return}me.focus({preventScroll:!0})}})}}function Ie(){let B=g.trim();if(!B&&w.length===0||!d||!kt||G.current||u)return;J();let Q=w;wt(te=>[...te,{id:It(),text:B,attachments:Q}]),He(""),T(te=>te!==Q?te:(ee.current=[],[])),Y.current?.focus({preventScroll:!0})}D(()=>{pt&&(O.current=!1)},[pt]),D(()=>{let B=A[0];if(!B||!p||pt||O.current||K||u||!d)return;let Q=setTimeout(()=>{O.current=!0,P(B.text,B.attachments,B.id).then(te=>{if(te){Ee(B.id);return}O.current=!1})},300);return()=>clearTimeout(Q)},[d,p,u,P,pt,A,Ee,K]);function Pe(B){B.key!=="Enter"||B.shiftKey||B.isComposing||(B.preventDefault(),kt&&(g.trim()||w.length>0)?Ie():vt?b():ie())}function he(B){let Q=B.target;if(!d||G.current||u){Q.value="";return}let te=ti(Q.files,w,e.attachments);te.accepted.length>0&&(Er.info("attach (file picker)",{count:te.accepted.length,totalBytes:Ar(te.accepted)}),r.emit("attach",{count:te.accepted.length,totalBytes:Ar(te.accepted)}),T(me=>[...me,...te.accepted])),Q.value=""}function ft(B){!d||G.current||u||(Er.info("removeAttachment",{id:B}),r.emit("removeAttachment",{id:B}),T(Q=>{let te=Q.find(me=>me.id===B);return te&&Rr(te),Q.filter(me=>me.id!==B)}))}function fe(){if(z){U();return}if(!d||!ve.isSupported||G.current||u)return;let B=++Te.current;_e.current=performance.now(),Er.info("voiceStart"),r.emit("voiceStart",void 0),V(!0),n.play("voiceStart"),ve.start((Q,te)=>{Te.current!==B||!Ue.current||ht.current||G.current||!te||He(me=>`${me}${Q} `)},()=>{Te.current!==B||!Ue.current||(V(!1),y("debug"))})}let at=vl[e.composer.sendButton.icon],qe=!!(g.trim()||w.length>0),zt=vt||s&&!qe;return l("div",{class:`${Ye}-composer`,part:"composer","data-testid":L.composer,children:[A.length>0?l("div",{class:`${Ye}-message-queue`,"aria-label":h.queueMessage,"data-testid":L.messageQueue,children:A.map(B=>l("div",{class:`${Ye}-attachment-chip ${Ye}-queued-message`,"data-testid":`${L.queuedMessage}-${B.id}`,children:[l("span",{class:`${Ye}-attachment-name ${Ye}-queued-text`,children:B.text||B.attachments.map(Q=>Q.name).join(", ")}),l("button",{type:"button",class:`${Ye}-attachment-remove`,onClick:()=>Ee(B.id),"aria-label":h.removeQueuedMessage,title:h.removeQueuedMessage,"data-testid":`${L.queuedMessageRemove}-${B.id}`,children:l(Ut,{})})]},B.id))}):null,w.length>0?l("div",{class:`${Ye}-attachments`,children:w.map(B=>l(r_,{attachment:B,onRemove:()=>ft(B.id),disabled:Ge},B.id))}):null,l("div",{class:`${Ye}-composer-row`,children:[l("div",{class:`${Ye}-composer-actions`,children:[be?l("button",{type:"button",class:`${Ye}-icon-btn`,onClick:()=>De.current?.click(),disabled:Ge,"aria-label":h.attach,"data-testid":L.composerAttach,children:l(mp,{})}):null,ve.isSupported?l("button",{type:"button",class:`${Ye}-icon-btn`,onClick:fe,disabled:Ge,"aria-label":z?h.micStop:h.micStart,"aria-pressed":z,"data-recording":z?"true":void 0,"data-testid":L.composerVoice,children:l(gp,{})}):null]}),l("textarea",{ref:Y,name:"message",class:`${Ye}-textarea`,rows:1,value:g,placeholder:h.composerPlaceholder,onInput:B=>He(B.currentTarget.value),onKeyDown:Pe,disabled:Ge,"aria-label":h.composerPlaceholder,"data-testid":L.composerInput}),kt&&qe?l("button",{type:"button",class:`${Ye}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:Ie,disabled:Ge,"aria-label":h.queueMessage,title:h.queueMessage,"data-testid":L.composerSend,children:l(at,{})}):null,zt?l("button",{type:"button",class:`${Ye}-send`,onClick:b,disabled:Ge,"aria-label":h.stop,"data-testid":L.composerStop,children:l(fp,{})}):null,!zt&&(!kt||!qe)?l("button",{type:"button",class:`${Ye}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:()=>{ie()},disabled:Ge||!g.trim()&&w.length===0,"aria-label":h.send,"data-testid":L.composerSend,children:l(at,{})}):null,f&&v==="ai-agent"&&x?l("button",{type:"button",class:`${Ye}-icon-btn`,onClick:x,disabled:Ge||!m,"aria-label":h.talkToOperator,title:h.talkToOperator,"data-testid":L.operatorRequest,children:l(_l,{})}):null]}),l("input",{ref:De,name:"attachments",type:"file",multiple:!0,accept:e.attachments.accept,onChange:he,disabled:Ge,class:`${Ye}-sr-only`,"data-testid":L.composerFileInput})]})}var i_=E.cssPrefix;function ni({onClick:e,children:t,testid:n}){return e?l("button",{type:"button",class:`${i_}-home-card`,"data-interactive":"true",onClick:e,"data-testid":n,children:t}):l("div",{class:`${i_}-home-card`,"data-testid":n,children:t})}function ri(e){return e.trim().split(/\s+/).slice(0,2).map(t=>t.charAt(0).toUpperCase()).join("")}var Ht=E.cssPrefix,ky=Z.scope("news"),wy=10;function yl(e,t){let n=e?new Date(e):void 0;if(!(!n||Number.isNaN(n.getTime())))return new Intl.DateTimeFormat(t,{dateStyle:"medium"}).format(n)}function Cy({options:e,transport:t,strings:n,config:r,nav:o,bus:a,panelProps:i,latestNews:s}){let c=r.contentCollectionIds,[p,_]=H({items:[],loading:!0}),d=F(void 0);function u(x){if(!c?.length)return;let P={};d.current=P,_(b=>({...b,loading:!0,error:void 0})),t.listContent({contentCollectionIds:c,sortBy:"publishedAt",sortOrder:"desc",page:x,limit:wy}).then(b=>{if(d.current!==P||(_(h=>({items:x>1?[...h.items,...b.items]:b.items,pagination:b.pagination,loading:!1})),x>1))return;a.emit("contentView",{section:"news",count:b.items.length});let C=b.items[0];C&&s.markSeen(C.id)}).catch(b=>{d.current===P&&(ky.warn("listContent (news) failed",{err:b,page:x}),_(C=>({...C,loading:!1,error:Jn(b,n)})))})}function f(){p.loading||u((p.pagination?.page??0)+1)}D(()=>(_({items:[],loading:!0}),u(1),()=>{d.current=void 0}),[t,c]);function m(x){let P=yl(x.publishedAt,e.locale);return l("button",{type:"button",class:`${Ht}-news-card`,onClick:()=>o.push({kind:"content",id:x.id,title:x.title}),"data-testid":dt(L.newsItem,x.id),children:[x.image?l("img",{class:`${Ht}-news-hero`,src:x.image,alt:"",loading:"lazy"}):null,l("span",{class:`${Ht}-news-body`,children:[l("span",{class:`${Ht}-news-title`,children:x.title}),P||x.tags?.length?l("span",{class:`${Ht}-news-meta`,children:[P?l("time",{dateTime:x.publishedAt,children:P}):null,x.tags?.map(b=>l("span",{class:`${Ht}-news-tag`,children:b},b))]}):null,x.description?l("span",{class:`${Ht}-news-summary`,children:x.description}):null]})]},x.id)}function v(){if(!c?.length)return l($t,{message:n.newsEmpty,strings:n});let x=p.error?l($t,{tone:"error",message:p.error,onRetry:f,strings:n}):null;return x&&!p.pagination?x:p.pagination?p.items.length?l("div",{class:`${Ht}-news-list`,children:[p.items.map(m),x,p.pagination.hasNext&&!x?l("button",{type:"button",class:`${Ht}-news-more`,onClick:f,"aria-busy":p.loading,"data-testid":L.newsMore,children:[p.loading?l("span",{class:`${Ht}-loading-spinner`,"aria-hidden":"true"}):null,n.newsShowMore]}):null]}):l($t,{message:n.newsEmpty,strings:n}):l($t,{message:n.newsLoading,strings:n})}return l("div",{class:`${Ht}-module`,children:[l(Ja,{title:n.newsTitle,actions:l(Jt,{panelProps:i,variant:"plain"})}),l("div",{class:`${Ht}-module-scroll`,children:v()})]})}var s_={Icon:Ga,Root:e=>l(Cy,{...e})};var ge=E.cssPrefix,l_=Z.scope("home");function Ty(e){let t=e.options.userContext?.name,n=e.config.greetingText?bt(e.strings,e.config.greetingText):void 0;if(n){let r=t?n.replace("{name}",t):n.replace(/\s*\{name\}\s*/," ").trim(),o=e.strings.homeGreetingLead;return{title:r,subtitle:r.toLowerCase()===o.toLowerCase()?void 0:o}}return t?{title:e.strings.homeGreetingNamed.replace("{name}",t),subtitle:e.strings.homeGreetingLead}:{title:e.strings.homeGreeting}}function Iy(e,t){return t.url?e.push({kind:"iframe",url:t.url,title:t.title}):e.push({kind:"content",id:t.id,title:t.title})}function Ry({options:e,onAsk:t}){let[n,r]=H(""),{sendButton:o}=e.composer,a=vl[o.icon];function i(s){s.preventDefault();let c=n.trim();c&&(r(""),t(c))}return l("form",{class:`${ge}-home-search ${ge}-home-ask`,"data-input":"true",onSubmit:i,"data-testid":L.homeAsk,children:[l("input",{type:"text",class:`${ge}-home-search-input`,placeholder:e.strings.homeAskPlaceholder,"aria-label":e.strings.homeAskPlaceholder,value:n,enterKeyHint:"send",onInput:s=>r(s.currentTarget.value)}),l("button",{type:"submit",class:`${ge}-send`,"data-shape":o.shape,"data-variant":o.variant,disabled:!n.trim(),"aria-label":e.strings.send,children:l(a,{})})]})}function c_(e,t){return dn(e,t,t.type!=="upsert"||t.activity===!0)}function Ey(e){let{transport:t,strings:n,config:r,nav:o,bus:a,panelProps:i,latestNews:s}=e,[c,p]=H(null),[_,d]=H([]),u=r.contentCollectionIds?.join(","),f=e.options.modules.list.some(g=>g.layout==="chat");D(()=>{if(r.showRecentConversations===!1)return;let g=!1,k=!0,w=[],T=t.subscribeConversationChanges(A=>{k&&w.push(A),p(M=>c_(M?[M]:[],A)[0]??null)});return t.listConversations({limit:f?50:1}).then(A=>{if(g)return;let M=w.reduce(c_,A.conversations);w=[],k=!1,p(M[0]??null)}).catch(A=>{g||(w=[],k=!1,l_.warn("listConversations (home) failed",{err:A}))}),()=>{g=!0,T()}},[t,r.showRecentConversations,f]),D(()=>{if(!r.contentCollectionIds?.length)return;let g=!1;return t.listContent({contentCollectionIds:r.contentCollectionIds,pinned:!0,limit:6}).then(k=>{g||(d(k.items),a.emit("contentView",{section:"home",count:k.items.length}))}).catch(k=>!g&&l_.warn("listContent (home) failed",{err:k})),()=>{g=!0}},[t,u,a]);let m=Ty(e),v=r.userAvatars??[],x=r.status,P=x?.text?bt(n,x.text):n.homeStatus,b=r.contentBlockTitle?bt(n,r.contentBlockTitle):n.homeContentTitle,C=s.item,h=yl(C?.publishedAt,e.options.locale);return l("div",{class:`${ge}-module ${ge}-home`,"data-testid":L.homeView,children:l("div",{class:`${ge}-home-scroll`,children:[l("div",{class:`${ge}-home-hero`,children:[l("div",{class:`${ge}-home-hero-top`,children:[r.brandName?l("span",{class:`${ge}-home-brand`,"data-testid":L.homeBrand,children:r.brandName}):l("span",{class:`${ge}-home-brand-spacer`,"aria-hidden":"true"}),l("div",{class:`${ge}-home-hero-actions`,children:[v.length>0?l("div",{class:`${ge}-home-avatars`,children:v.map(g=>l("span",{class:`${ge}-home-avatar`,title:g.role?`${g.name} \xB7 ${g.role}`:g.name,children:g.avatar?l("img",{src:g.avatar,alt:"",loading:"lazy"}):l("span",{children:ri(g.name)})},g.name))}):null,l(Jt,{panelProps:i,variant:"plain"})]})]}),r.showGreeting!==!1?l(de,{children:[l("h1",{class:`${ge}-home-greeting`,"data-testid":L.homeGreeting,children:m.title}),m.subtitle?l("p",{class:`${ge}-home-lead`,children:m.subtitle}):null]}):null]}),l("div",{class:`${ge}-home-cards`,children:[f?l(Ry,{options:e.options,onAsk:g=>o.startNewConversation(g)}):null,r.showSearchBar!==!1?l(Yp,{placeholder:n.homeSearchPlaceholder,onActivate:()=>o.switchToLayout("help")}):null,C?l(ni,{onClick:()=>{s.markSeen(C.id),o.push({kind:"content",id:C.id,title:C.title})},testid:L.homeWhatsNew,children:l("div",{class:`${ge}-home-recent-row`,"data-unread":s.unseen?"true":void 0,children:[l("span",{class:`${ge}-home-recent-avatar`,"aria-hidden":"true",children:l(Ga,{})}),l("span",{class:`${ge}-home-recent-body`,children:[l("span",{class:`${ge}-home-recent-title`,children:n.homeWhatsNew}),l("span",{class:`${ge}-home-recent-preview`,children:h?`${C.title} \xB7 ${h}`:C.title})]}),s.unseen?l("span",{class:`${ge}-home-recent-dot`,role:"img","aria-label":n.newsUnseen}):null]})}):null,c?l(ni,{onClick:()=>o.selectConversation(c),testid:L.homeRecent,children:l("div",{class:`${ge}-home-recent-row`,"data-unread":c.hasUnread?"true":void 0,children:[l("span",{class:`${ge}-home-recent-avatar`,"aria-hidden":"true",children:l(xo,{})}),l("span",{class:`${ge}-home-recent-body`,children:[l("span",{class:`${ge}-home-recent-title`,children:c.title}),c.preview?l("span",{class:`${ge}-home-recent-preview`,children:Za(c.preview)}):null]}),c.hasUnread?l("span",{class:`${ge}-home-recent-dot`,"aria-label":"Unread"}):null]})}):null,x?l(ni,{onClick:x.url?()=>o.push({kind:"iframe",url:x.url,title:P}):void 0,children:l("div",{class:`${ge}-home-status`,"data-level":x.level??"operational",children:[l("span",{class:`${ge}-home-status-icon`,"aria-hidden":"true",children:l(Ap,{})}),l("span",{class:`${ge}-home-status-text`,children:P})]})}):null,_.length>0?l("section",{class:`${ge}-home-content`,children:[l("div",{class:`${ge}-home-content-title`,children:b}),l("div",{class:`${ge}-home-content-list`,children:_.map(g=>l(ei,{title:g.title,subtitle:g.description,onClick:()=>Iy(o,g),testid:dt(L.homeContentRow,g.id)},g.id))})]}):null]})]})})}var u_={Icon:Mp,Root:e=>l(Ey,{...e})};var oi={chat:Jp,home:u_,help:t_,news:s_};var wo=E.cssPrefix;function d_({modules:e,activeTab:t,strings:n,hasUnread:r,onSelect:o}){return l("nav",{class:`${wo}-tabbar`,role:"tablist","aria-label":n.panelTitle,children:e.map(a=>{let i=oi[a.layout].Icon,s=a.id===t,c=a.layout==="chat"&&r;return l("button",{type:"button",role:"tab","aria-selected":s,class:`${wo}-tab`,onClick:()=>o(a.id),"data-testid":dt(L.tab,a.id),children:[l("span",{class:`${wo}-tab-icon`,"aria-hidden":"true",children:[l(i,{}),c?l("span",{class:`${wo}-tab-badge`,"data-testid":L.tabBadge,"aria-label":"Unread"}):null]}),l("span",{class:`${wo}-tab-label`,children:bt(n,a.label)})]},a.id)})})}var p_=E.cssPrefix,Ay="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads";function __({url:e,title:t,strings:n,onBack:r,actions:o}){return l("div",{class:`${p_}-module`,children:[l(Ya,{title:t||n.moduleBack,backLabel:n.moduleBack,onBack:r,actions:o}),l("iframe",{class:`${p_}-content-frame`,src:e,title:t||"content",sandbox:Ay,referrerpolicy:"no-referrer",loading:"lazy",allow:"fullscreen"})]})}var bl=E.cssPrefix;function f_({agent:e,strings:t}){let n=e.status??"online",r=bt(t,e.name),o=e.title?bt(t,e.title):null;return l("div",{class:`${bl}-agent`,children:[l("div",{class:`${bl}-agent-avatar`,"data-status":n,children:e.avatar?l("img",{src:e.avatar,alt:""}):l("span",{children:ri(r)})}),l("div",{class:`${bl}-agent-meta`,children:[l("strong",{children:r}),o?l("span",{children:o}):null]})]})}var My=["today","yesterday","lastWeek","older"];function Ly(e,t){let n=Date.parse(t);if(!Number.isFinite(n))return"older";let r=Math.floor((m_(e)-m_(n))/(1440*60*1e3));return r<=0?"today":r===1?"yesterday":r<7?"lastWeek":"older"}function g_(e,t){let n=new Map;for(let r of t){let o=Ly(e,r.lastMessageAt),a=n.get(o);a?a.push(r):n.set(o,[r])}return My.filter(r=>n.has(r)).map(r=>({bucket:r,conversations:n.get(r)}))}function m_(e){let t=new Date(e);return t.setUTCHours(0,0,0,0),t.getTime()}var h_=Z.scope("history"),Ny=3,Oy=6,$y={today:"dateToday",yesterday:"dateYesterday",lastWeek:"dateLastWeek",older:"dateOlder"};function v_(e,t){let n=t.type!=="upsert"||t.activity===!0;if(t.type==="snapshot"&&t.result.pagination.page===1&&e.pagination.page>1){let o=dn(e.conversations.slice(0,t.result.pagination.limit),t,n);if(t.result.conversations.length===0){if(o.length===0)return t.result;let p=Math.max(t.result.pagination.total,o.length);return{...t.result,conversations:o,pagination:{...t.result.pagination,total:p,totalPages:Math.ceil(p/t.result.pagination.limit)}}}let a=new Set(o.map(p=>p.conversationId)),i=e.conversations.slice(t.result.pagination.limit).filter(p=>!a.has(p.conversationId)),s=e.pagination.page,c={...t.result.pagination,page:s,hasPrev:s>1,hasNext:s<t.result.pagination.totalPages};return{conversations:[...o,...i],pagination:c}}let r=dn(e.conversations,t,n);return r===e.conversations?e:{...t.type==="snapshot"?t.result:e,conversations:r}}function Dy(e,t,n){let r=Date.parse(e);return Number.isFinite(r)?new Date(r).toDateString()===new Date(t).toDateString()?new Intl.DateTimeFormat(n,{hour:"numeric",minute:"2-digit"}).format(r):t-r<10080*60*1e3?new Intl.DateTimeFormat(n,{weekday:"short"}).format(r):new Intl.DateTimeFormat(n,{month:"short",day:"numeric"}).format(r):""}function ai({transport:e,strings:t,locale:n,persistence:r,onSelect:o,onNewConversation:a}){let i=E.cssPrefix,s=e.peekConversations({limit:50}),[c,p]=H(s?"loaded":"loading"),[_,d]=H(s),[u,f]=H(!1),m=F(void 0),v=_?.conversations??[],x=_?.pagination;D(()=>{let g=!1,k=!0,w=[],T=e.subscribeConversationChanges(M=>{k&&w.push(M),d(N=>N&&v_(N,M))});m.current=void 0,f(!1);let A=e.peekConversations({limit:50});return d(A),p(A?"loaded":"loading"),e.listConversations({limit:50}).then(M=>{if(g)return;let N=M;for(let O of w)N=v_(N,O);w=[],k=!1,d(N),p("loaded"),r.saveHistoryCount(N.conversations.length)}).catch(M=>{g||(w=[],k=!1,h_.warn("listConversations failed",{err:M}),p("error"))}),()=>{g=!0,T(),m.current=void 0}},[e,r,n]);async function P(){if(m.current||!x?.hasNext)return;let g={};m.current=g,f(!0);try{let k=await e.listConversations({page:x.page+1,limit:x.limit});if(m.current!==g)return;d(w=>{if(!w)return w;let T=new Set(w.conversations.map(N=>N.conversationId)),A=k.conversations.filter(N=>T.has(N.conversationId)?!1:(T.add(N.conversationId),!0)),M={conversations:[...w.conversations,...A],pagination:k.pagination};return r.saveHistoryCount(M.conversations.length),M})}catch(k){if(m.current!==g)return;h_.warn("listConversations page failed",{err:k,page:x.page+1})}finally{m.current===g&&(m.current=void 0,f(!1))}}let b=a?l("div",{class:`${i}-history-footer`,children:l("button",{type:"button",class:`${i}-history-new`,onClick:a,"data-testid":L.sidebarNewConversation,children:[l(up,{}),t.newConversation]})}):null;if(c==="loading"){let g=Math.min(r.loadHistoryCount()??Ny,Oy);return l(de,{children:[l("div",{class:`${i}-history`,"aria-busy":"true","aria-label":t.historyLoading,children:l("div",{class:`${i}-history-group`,"aria-hidden":"true",children:[l("div",{class:`${i}-history-heading`,children:l("span",{class:`${i}-skeleton ${i}-skeleton-heading`})}),l("div",{class:`${i}-history-card`,children:Array.from({length:Math.max(1,g)},(k,w)=>l("div",{class:`${i}-history-item ${i}-history-item-skeleton`,children:[l("span",{class:`${i}-history-avatar ${i}-skeleton`}),l("span",{class:`${i}-history-body`,children:[l("span",{class:`${i}-history-row`,children:[l("span",{class:`${i}-history-title`,children:l("span",{class:`${i}-skeleton ${i}-skeleton-title`})}),l("span",{class:`${i}-history-time`,children:l("span",{class:`${i}-skeleton ${i}-skeleton-time`})})]}),l("span",{class:`${i}-history-row`,children:l("span",{class:`${i}-history-preview`,children:l("span",{class:`${i}-skeleton ${i}-skeleton-preview`})})})]})]},w))})]})}),b]})}if(c==="error"||v.length===0)return l(de,{children:[l("div",{class:`${i}-history-empty`,children:t.historyEmpty}),b]});let C=Date.now(),h=g_(C,v);return l(de,{children:[l("div",{class:`${i}-history`,role:"list",children:[h.map(g=>l("div",{class:`${i}-history-group`,children:[l("div",{class:`${i}-history-heading`,children:t[$y[g.bucket]]}),l("div",{class:`${i}-history-card`,children:g.conversations.map(k=>l("div",{role:"listitem",children:l("button",{type:"button",class:`${i}-history-item`,onClick:()=>o(k),"data-closed":k.canContinue?void 0:"true","data-unread":k.hasUnread?"true":void 0,"data-testid":dt(L.historyItem,k.conversationId),children:[l("span",{class:`${i}-history-avatar`,"aria-hidden":"true",children:l(pl,{})}),l("span",{class:`${i}-history-body`,children:[l("span",{class:`${i}-history-row`,children:[l("span",{class:`${i}-history-title`,children:k.title}),l("span",{class:`${i}-history-time`,children:Dy(k.lastMessageAt,C,n)})]}),l("span",{class:`${i}-history-row`,children:[l("span",{class:`${i}-history-preview`,children:k.preview&&Za(k.preview)||(k.canContinue?t.historyContinue:t.conversationClosed)}),k.hasUnread?l("span",{class:`${i}-history-dot`}):null]})]})]})},k.conversationId))})]},g.bucket)),x?.hasNext?l("div",{class:`${i}-history-more`,children:l("button",{type:"button",onClick:P,disabled:u,"aria-busy":u,"data-testid":L.historyLoadMore,children:t.loadMoreConversations})}):null]}),b]})}var Fy=E.cssPrefix;function y_({visible:e,strings:t}){return e?l("div",{class:`${Fy}-dropzone`,role:"status","aria-live":"polite",children:t.dropZone}):null}var By=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Uy=/^https?:\/\/[^\s.]+\.[^\s]+$/i,Hy=/^[+]?[\d\s().-]{6,}$/;function Mr(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??`{${r}}`))}function qy(e){return Array.isArray(e)?e.length:e?.trim()?1:0}function zy(e,t,n){let r=e.required??!0,o=e.validation;if(e.type==="multiselect"){let i=qy(t);return r&&i===0?n.formRequired:i===0?void 0:o?.minSelections!=null&&i<o.minSelections?Mr(n.formChooseAtLeast,{min:o.minSelections}):o?.maxSelections!=null&&i>o.maxSelections?Mr(n.formChooseAtMost,{max:o.maxSelections}):void 0}let a=typeof t=="string"?t.trim():"";if(!a)return r?n.formRequired:void 0;switch(e.type){case"email":if(!By.test(a))return n.formInvalidEmail;break;case"url":if(!Uy.test(a))return n.formInvalidUrl;break;case"tel":if(!Hy.test(a))return n.formInvalidTel;break;case"number":{let i=Number(a);if(!Number.isFinite(i))return n.formInvalidNumber;if(o?.min!=null&&i<o.min)return Mr(n.formNumberTooSmall,{min:o.min});if(o?.max!=null&&i>o.max)return Mr(n.formNumberTooLarge,{max:o.max});break}default:break}if(o?.minLength!=null&&a.length<o.minLength)return Mr(n.formTooShort,{min:o.minLength});if(o?.maxLength!=null&&a.length>o.maxLength)return Mr(n.formTooLong,{max:o.maxLength});if(o?.pattern)try{if(!new RegExp(o.pattern).test(a))return n.formPatternMismatch}catch{}}function b_(e,t,n){let r={};for(let o of e){let a=zy(o,t[o.name],n);a&&(r[o.name]=a)}return r}function P_(e){let t={};for(let[n,r]of Object.entries(e)){let o=Array.isArray(r)?r.join(", "):r;o.trim()&&(t[n]=o.trim())}return t}var Ne=E.cssPrefix,Co="__other__";function To({fields:e,strings:t,submitLabel:n,onSubmit:r,skipLabel:o,onSkip:a,footerHint:i,submitOnEnter:s,disabled:c,initialValues:p,hideActions:_,fieldTypeLabels:d,rootTestId:u,submitTestId:f,skipTestId:m}){let[v,x]=H(()=>({...Gy(e),...p})),[P,b]=H({}),[C,h]=H({});function g(M){C[M]&&h(N=>({...N,[M]:""}))}function k(M,N){x(O=>({...O,[M]:N})),g(M)}function w(M,N){b(O=>({...O,[M]:N})),g(M)}function T(M){if(M.preventDefault(),c)return;let N=Ky(e,v,P),O=b_(e,N,t);if(Object.keys(O).length>0){h(O);return}r(P_(N))}function A(M){!s||M.key!=="Enter"||M.shiftKey||M.isComposing||!M.target||!("tagName"in M.target)||M.target.tagName!=="TEXTAREA"||T(M)}return l("form",{class:`${Ne}-form`,onSubmit:T,onKeyDown:A,"data-testid":u,noValidate:!0,children:[e.map(M=>l(jy,{field:M,value:v[M.name],otherText:P[M.name]??"",error:C[M.name],disabled:c,typeLabel:d?.[M.name],strings:t,onChange:N=>k(M.name,N),onOtherChange:N=>w(M.name,N)},M.name)),_?null:l("div",{class:`${Ne}-form-actions`,children:[i?l("span",{class:`${Ne}-form-hint`,children:i}):null,o&&a?l("button",{type:"button",class:`${Ne}-form-skip`,onClick:a,disabled:c,"data-testid":m,children:o}):null,l("button",{type:"submit",class:`${Ne}-form-submit`,disabled:c,"data-testid":f,children:n})]})]})}function jy({field:e,value:t,otherText:n,error:r,disabled:o,typeLabel:a,strings:i,onChange:s,onOtherChange:c}){let p=dt(L.formField,e.name),_=Vy({field:e,value:t,otherText:n,disabled:o,strings:i,onChange:s,onOtherChange:c,fieldTid:p});return l("label",{class:`${Ne}-field`,"data-field":e.name,"data-invalid":r?"true":void 0,children:[l("span",{class:`${Ne}-field-head`,children:[l("span",{class:`${Ne}-field-label`,children:[e.label,e.required??!0?l("span",{class:`${Ne}-field-req`,"aria-hidden":"true",children:" *"}):null]}),a?l("span",{class:`${Ne}-field-type`,children:a}):null]}),_,e.validationHint&&!r?l("span",{class:`${Ne}-field-hint`,children:e.validationHint}):null,r?l("span",{class:`${Ne}-field-error`,role:"alert",children:r}):null]})}function Vy(e){let{field:t,value:n,otherText:r,disabled:o,strings:a,onChange:i,onOtherChange:s,fieldTid:c}=e,p=typeof n=="string"?n:"",_=t.type==="select"?a.formOtherPlaceholder:t.placeholder??a.formOtherPlaceholder,d=t.allowOther&&p===Co?l("input",{class:`${Ne}-field-input`,value:r,placeholder:_,disabled:o,onInput:f=>s(f.currentTarget.value)}):null;switch(t.type){case"textarea":return l("textarea",{class:`${Ne}-field-input`,rows:3,value:p,placeholder:t.placeholder,disabled:o,onInput:f=>i(f.currentTarget.value),"data-testid":c});case"select":return l(de,{children:[l("select",{class:`${Ne}-field-input`,value:p,disabled:o,onChange:f=>i(f.currentTarget.value),"data-testid":c,children:[l("option",{value:"",children:t.placeholder??"\u2014"}),(t.options??[]).map(f=>l("option",{value:f.value,children:f.label??f.value},f.value)),t.allowOther?l("option",{value:Co,children:a.formOther}):null]}),d]});case"radio":return l("div",{class:`${Ne}-field-choices`,role:"radiogroup","data-testid":c,children:[(t.options??[]).map(f=>l("label",{class:`${Ne}-choice`,children:[l("input",{type:"radio",name:`${Ne}-${t.name}`,checked:p===f.value,disabled:o,onChange:()=>i(f.value)}),l("span",{children:f.label??f.value})]},f.value)),t.allowOther?l("label",{class:`${Ne}-choice`,children:[l("input",{type:"radio",name:`${Ne}-${t.name}`,checked:p===Co,disabled:o,onChange:()=>i(Co)}),l("span",{children:a.formOther})]}):null,d]});case"checkbox":return l("label",{class:`${Ne}-choice`,children:[l("input",{type:"checkbox",checked:p==="true",disabled:o,onChange:f=>i(f.currentTarget.checked?"true":""),"data-testid":c}),l("span",{children:t.placeholder??t.label})]});case"multiselect":{let m=function(v,x){return i(x?[...f,v]:f.filter(P=>P!==v))};var u=m;let f=Array.isArray(n)?n:[];return l("div",{class:`${Ne}-field-choices`,"data-testid":c,children:[(t.options??[]).map(v=>l("label",{class:`${Ne}-choice`,children:[l("input",{type:"checkbox",checked:f.includes(v.value),disabled:o,onChange:x=>m(v.value,x.currentTarget.checked)}),l("span",{children:v.label??v.value})]},v.value)),t.allowOther||(t.options??[]).length===0?l("textarea",{class:`${Ne}-field-input`,rows:2,value:r,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:o,onInput:v=>s(v.currentTarget.value)}):null]})}default:return l("input",{...Wy(t.type),class:`${Ne}-field-input`,value:p,placeholder:t.placeholder,disabled:o,onInput:f=>i(f.currentTarget.value),"data-testid":c})}}function Wy(e){switch(e){case"number":return{type:e};case"email":return{type:e};case"tel":return{type:e};case"url":return{type:e};case"date":case"time":return{type:e};default:return{type:"text"}}}function Gy(e){let t={};for(let n of e)n.defaultValue!=null&&(t[n.name]=n.type==="multiselect"?n.defaultValue.split(",").map(r=>r.trim()).filter(Boolean):n.defaultValue);return t}function Ky(e,t,n){let r={...t};for(let o of e){let a=n[o.name]?.trim();if((o.type==="radio"||o.type==="select")&&o.allowOther&&t[o.name]===Co)r[o.name]=a??"";else if(o.type==="multiselect"&&a){let i=a.split(/[,\n;]+/).map(c=>c.trim()).filter(Boolean),s=t[o.name];r[o.name]=[...Array.isArray(s)?s:[],...i]}}return r}var Zt=E.cssPrefix;function Pl({form:e,strings:t,onSubmit:n,onSkip:r}){return l("div",{class:`${Zt}-form-gate`,"data-testid":L.formGate,children:[e.title?l("h3",{class:`${Zt}-form-gate-title`,children:e.title}):null,e.description?l("p",{class:`${Zt}-form-gate-desc`,children:e.description}):null,l(To,{fields:e.fields,strings:t,submitLabel:e.submitLabel??t.formSubmit,onSubmit:n,skipLabel:e.skippable?t.formSkip:void 0,onSkip:e.skippable?r:void 0,submitTestId:L.formSubmit,skipTestId:L.formSkip})]})}function x_({marker:e,strings:t,onFill:n}){let r=e.outcome==="skipped",o=r?t.formSkipped:t.formSubmitted,a=e.title?l(de,{children:[l("span",{children:e.title}),l("span",{class:`${Zt}-sr-only`,children:o})]}):l("span",{children:o}),i=e.form?.reviewable??!1,s=!r&&i&&e.values&&Object.keys(e.values).length>0?e.values:null;if(s){let p=function(_){return e.form?.fields.find(d=>d.name===_)?.label??_};var c=p;return l("details",{class:`${Zt}-form-done`,"data-outcome":e.outcome,"data-testid":L.formDone,children:[l("summary",{class:`${Zt}-form-done-summary`,"data-testid":L.formDoneToggle,children:[l(Xn,{}),a,l(kr,{})]}),l("dl",{class:`${Zt}-form-answers`,"data-testid":L.formAnswers,children:Object.entries(s).map(([_,d])=>l("div",{class:`${Zt}-form-answer`,children:[l("dt",{children:p(_)}),l("dd",{children:d})]},_))})]})}return l("div",{class:`${Zt}-form-done`,"data-outcome":e.outcome,"data-testid":L.formDone,role:"status",children:[r?l(Tp,{}):l(Xn,{}),a,r&&e.form?.reopenable&&n?l("button",{type:"button",class:`${Zt}-form-done-fill`,"data-testid":L.formFill,onClick:n,children:t.formFillOut}):null]})}var S_=Object.assign;function Jy(e,t){for(var n in e)if(n!="__source"&&e[n]!==t[n])return!0;for(var r in t)if(r!="__source"&&!(r in e))return!0;return!1}var Yy=/^(-|f[lo].*[^se]$|g.{5,}[^ps]$|z|o[pr]|(W.{5})?[lL]i.*(t|mp)$|an|(bo|s).{4}Im|sca|m.{6}[ds]|ta|c.*[st]$|wido|ini|asp|fill|st)/;function C_(e,t){function n(o){var a=this.props.ref;return a!=o.ref&&a&&(typeof a=="function"?a(null):a.current=null),t?!t(this.props,o)||a!=o.ref:Jy(this.props,o)}function r(o){return this.shouldComponentUpdate=n,Sn(e,o)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.type=e,r}var Zy=Symbol.for("react.element"),eb=/^(?: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]/,tb=/[A-Z0-9]/g,nb=typeof document<"u";var rb=function(e){return/fil|che|rad/.test(e)};Ft.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Ft.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var k_=pe.event;pe.event=function(e){return k_&&(e=k_(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var ob={configurable:!0,get:function(){return this.class}},w_=pe.vnode;pe.vnode=function(e){if(typeof e.type=="string")(function(r){var o=r.props,a=r.type,i={},s=a.indexOf("-")==-1;for(var c in o){var p=o[c];if(!(c=="value"&&"defaultValue"in o&&p==null||nb&&c=="children"&&a=="noscript"||c=="class"||c=="className")){if(c=="style"&&p&&p.constructor==Object){var _=void 0;for(var d in p)typeof p[d]!="number"||Yy.test(d)||(_||(_=p=S_({},p)),p[d]+="px")}else if(c=="defaultValue"&&"value"in o&&o.value==null)c="value";else if(c=="download"&&p===!0)p="";else if(c=="translate"&&p==="no")p=!1;else if(c[0]=="o"&&c[1]=="n"){var u=c.toLowerCase();u=="ondoubleclick"?c="ondblclick":u!="onchange"||a!="input"&&a!="textarea"||rb(o.type)?u=="onfocus"?c="onfocusin":u=="onblur"&&(c="onfocusout"):u=c="oninput",u=="oninput"&&i[c=u]&&(c="oninputCapture")}else s&&eb.test(c)?c=c.replace(tb,"-$&").toLowerCase():p===null&&(p=void 0);i[c]=p}}a=="select"&&(i.multiple&&Array.isArray(i.value)&&(i.value=sa(o.children).forEach(function(f){f.props.selected=i.value.indexOf(f.props.value)!=-1})),i.defaultValue!=null&&(i.value=sa(o.children).forEach(function(f){f.props.selected=i.multiple?i.defaultValue.indexOf(f.props.value)!=-1:i.defaultValue==f.props.value}))),o.class&&!o.className?(i.class=o.class,Object.defineProperty(i,"className",ob)):o.className&&(i.class=i.className=o.className),r.props=i})(e);else if(typeof e.type=="function"&&("ref"in e.props&&"prototype"in e.type&&e.type.prototype.render&&(e.ref=e.props.ref,delete e.props.ref),e.type.defaultProps)){var t=S_({},e.props);for(var n in e.type.defaultProps)t[n]===void 0&&(t[n]=e.type.defaultProps[n]);e.props=t}e.ref&&!("ref"in e.props)&&Object.defineProperty(e.props,"ref",{value:e.ref,configurable:!0,writable:!0}),e.$$typeof=Zy,w_&&w_(e)};var ii=E.cssPrefix;function T_({messageId:e,initial:t,strings:n,onFeedback:r}){let[o,a]=H(t);D(()=>a(t),[e,t]);function i(s){let c=o===s?null:s;a(c),r(e,c)}return l("div",{class:`${ii}-feedback`,role:"group","data-testid":L.messageFeedback,children:[l("button",{type:"button",class:`${ii}-msg-action`,"data-active":o==="up"?"true":void 0,"aria-pressed":o==="up","aria-label":n.feedbackUp,title:n.feedbackUp,onClick:()=>i("up"),"data-testid":L.feedbackUp,children:l(Dp,{})}),l("button",{type:"button",class:`${ii}-msg-action`,"data-active":o==="down"?"true":void 0,"aria-pressed":o==="down","aria-label":n.feedbackDown,title:n.feedbackDown,onClick:()=>i("down"),"data-testid":L.feedbackDown,children:l(Fp,{})}),l("span",{class:`${ii}-sr-only`,role:"status","aria-live":"polite",children:o?n.feedbackThanks:""})]})}var qt=E.cssPrefix;function xl(e){let t=e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim().toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}function Lr(e){if(e.startsWith("tool:")||e.startsWith("tool-"))return e.slice(5);let t=e.indexOf("__"),n=e.slice(t+2);return t>0&&n?`${xl(e.slice(0,t))} \xB7 ${xl(n)}`:e}function si(e){let t=e.indexOf("__"),n=e.slice(t+2);return t>0&&n?xl(n):Lr(e)}function li(e,t){let n=e==="output-available"||e==="output-error"||e==="output-denied",r=e==="approval-responded"||t?.approved!==void 0;return{terminal:n,responded:r,decided:n||r}}function kl({status:e,icon:t,label:n}){return l("span",{class:`${qt}-toolui-badge ${qt}-toolui-status`,"data-status":e,children:[l("span",{class:`${qt}-toolui-status-icon`,children:t}),n]})}function ab(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 Nr(e,t,n={}){return n.submitted?"responded":n.incomplete?"incomplete":lb(ab(e,t),n.superseded,n.live??!0)}function ib({status:e}){return e==="denied"||e==="error"||e==="superseded"||e==="incomplete"?l(Cr,{}):e==="completed"||e==="responded"?l(wr,{}):l(Bp,{})}function sb(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;case"incomplete":return t.statusIncomplete;default:return t.statusRunning}}function lb(e,t,n){return t&&(e==="awaiting"||e==="running")?"superseded":!n&&e==="running"?"error":e}function cb({state:e,approval:t,strings:n,superseded:r,live:o=!0,submitted:a=!1,incomplete:i=!1}){let s=Nr(e,t,{superseded:r,live:o,submitted:a,incomplete:i});return l(kl,{status:s,icon:l(ib,{status:s}),label:sb(s,n)})}function ub({name:e,state:t,approval:n,strings:r,superseded:o,live:a,submitted:i,incomplete:s}){return l(de,{children:[l("span",{class:`${qt}-toolui-name-pill`,children:[l(Ka,{}),l("span",{class:`${qt}-toolui-name-text`,children:e})]}),l(cb,{state:t,approval:n,strings:r,superseded:o,live:a,submitted:i,incomplete:s}),l("span",{class:`${qt}-toolui-chevron`,children:l(pn,{})})]})}function ci({part:e,strings:t,testid:n,superseded:r,live:o,submitted:a,incomplete:i}){let s=ue(()=>Se(()=>e.inputSig.value),[e]),c=ue(()=>Se(()=>e.outputSig.value),[e]),p=ue(()=>Se(()=>e.errorSig.value),[e]),_=ue(()=>Se(()=>e.stateSig.value),[e]),d=ue(()=>Se(()=>e.approvalSig.value),[e]),u=ue(()=>Se(()=>Vt(e.toolMetadata)&&ea(e.errorSig.value)),[e]),f=i===!0||u.value;return l("details",{class:`${qt}-toolui ${qt}-toolui-collapsible`,"data-testid":n,children:[l("summary",{class:`${qt}-toolui-head`,children:l(ub,{name:Lr(e.toolName),state:_.value,approval:d.value,strings:t,superseded:r,live:o,submitted:a,incomplete:f})}),l(Yn,{label:t.toolParameters,value:s.value}),c.value!==void 0?l(Yn,{label:t.toolResult,value:c.value}):null,p.value&&!f?l(Yn,{label:t.statusError,value:p.value,error:!0}):null]})}function Yn({label:e,value:t,error:n}){let r=n?typeof t=="string"?t:"":Sl(I_(t));return r?l("div",{class:`${qt}-toolui-section`,children:[l("span",{class:`${qt}-toolui-label`,children:e}),l("pre",{class:`${qt}-toolui-code`,"data-error":n?"true":void 0,children:r})]}):null}function ui(e){return!!Sl(e.inputSig.value)||!!e.errorSig.value||!!Sl(I_(e.outputSig.value))}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 Sl(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 R_(e){return e.partsSig.value.some(t=>t.kind==="text"&&t.textSig.value.length>0)}function E_(e){return e.partsSig.value.some(t=>t.kind==="reasoning")}function db(e){return e.streaming&&!e.bufferedHold&&!(e.reasoningVisible&&e.working)}function A_(e){let{streaming:t,reasoningVisible:n,emptyReply:r,hidden:o}=e,a=e.responseMode==="buffered"&&t,i=t&&!e.hasAnswerText;return{streaming:t,bufferedHold:a,reasoningVisible:n,working:i,showStreamDots:db({streaming:t,bufferedHold:a,reasoningVisible:n,working:i}),emptyReply:r,hidden:o}}function M_(e,t){let n=e.stateSig.value,r=e.approvalSig.value,{terminal:o,responded:a,decided:i}=li(n,r),s=t.continuationStreaming===!0&&!i,c=t.superseded&&!i&&!s;return{pill:Nr(n,r,{superseded:c,live:t.live,submitted:s,incomplete:Vt(e.toolMetadata)&&ea(e.errorSig.value)}),state:n,terminal:o,decided:i||s,showApproveReject:!i&&!t.superseded&&!s,showAnswered:a&&!o&&!c,showSubmitted:s,showEdit:a&&t.active&&!o,skipped:c,answeredApproved:r?.approved}}var Or=E.cssPrefix;function L_({part:e,strings:t}){let n=e.title||e.filename||e.url||t.sources;return e.url?l("a",{class:`${Or}-source`,href:e.url,target:"_blank",rel:"noreferrer noopener","data-testid":L.source,children:[l("span",{class:`${Or}-source-icon`,"aria-hidden":"true",children:"\u{1F517}"}),l("span",{class:`${Or}-source-label`,children:n})]}):l("span",{class:`${Or}-source`,"data-testid":L.source,children:[l("span",{class:`${Or}-source-icon`,"aria-hidden":"true",children:"\u{1F4C4}"}),l("span",{class:`${Or}-source-label`,children:n})]})}var At=E.cssPrefix,pb=4;function _b(e){return!e||typeof e!="object"||Array.isArray(e)?[]:Object.entries(e).flatMap(([t,n])=>typeof n=="string"?n.trim()?[{key:t,value:n.trim()}]:[]:typeof n=="number"||typeof n=="boolean"?[{key:t,value:String(n)}]:[]).slice(0,pb)}function N_({part:e,strings:t,active:n,superseded:r=!1,continuationStreaming:o=!1,onDecision:a,onEdit:i}){let s=ue(()=>Se(()=>e.approvalSig.value),[e]),c=ue(()=>Se(()=>M_(e,{active:n,superseded:r,continuationStreaming:o})),[e,n,r,o]).value,{terminal:p,showApproveReject:_,showAnswered:d,showSubmitted:u,showEdit:f,skipped:m}=c,v=Lr(e.toolName),x=c.answeredApproved,P=e.toolCallId,b=_b(e.inputSig.value),C=l(de,{children:[l("p",{class:`${At}-toolui-prompt`,children:t.approvalPrompt.replace("{tool}",v)}),b.length>0?l("dl",{class:`${At}-toolui-fields`,"data-testid":L.toolApprovalFields,children:b.map(({key:g,value:k})=>l("div",{children:[l("dt",{children:g}),l("dd",{title:k,children:k})]},g))}):null,l("p",{class:`${At}-toolui-subtle`,children:t.approvalBody})]});u?C=l("p",{class:`${At}-toolui-subtle`,children:t.approvalSubmitting}):d&&x!==!1?C=l(de,{children:[l("p",{class:`${At}-toolui-prompt`,children:[t.approvalYourResponse.replace("{decision}",x?t.approve:t.reject),s.value?.reason?` \u2014 ${s.value.reason}`:""]}),f?l("p",{class:`${At}-toolui-subtle`,children:t.approvalEditHint}):null,f?null:l("p",{class:`${At}-toolui-subtle`,children:t.approvalSubmitting})]}):d&&(C=l(de,{}));let h=_||u||f||d&&x!==!1;return l("div",{class:`${At}-toolui-group`,"data-testid":c.decided?L.toolDecision:L.toolApproval,children:[l(ci,{part:e,strings:t,superseded:m,submitted:u}),m||p||!h?null:l("div",{class:`${At}-toolui ${At}-toolui-body`,children:[C,_?l("div",{class:`${At}-toolui-actions`,children:[l("button",{type:"button",class:`${At}-form-skip`,disabled:!n,onClick:()=>a(P,!1),"data-testid":L.toolReject,children:t.reject}),l("button",{type:"button",class:`${At}-form-submit`,disabled:!n,onClick:()=>a(P,!0),"data-testid":L.toolApprove,children:t.approve})]}):null,f?l("div",{class:`${At}-toolui-actions`,children:l("button",{type:"button",class:`${At}-form-skip`,onClick:()=>i(P),"data-testid":L.toolEdit,children:t.edit})}):null]})]})}var fb=["text","email","phone","number","date","single-select","multi-select","boolean"];function O_(e){return e!==null&&typeof e=="object"}function $_(e){let t=O_(e)?e:{},r=(Array.isArray(t.questions)?t.questions:[]).map(mb).filter(o=>o!==null);return{intro:di(t.intro),questions:r}}function mb(e,t){if(!O_(e))return null;let n=fb.find(r=>r===e.type)??"text";return{key:di(e.key)??`q${t+1}`,question:di(e.question)??"Please provide the missing information.",type:n,options:Array.isArray(e.options)?e.options.filter(r=>typeof r=="string"&&r.trim().length>0):void 0,required:typeof e.required=="boolean"?e.required:void 0,helpText:di(e.helpText)}}function gb(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 wl(e,t,n){return e.questions.map(r=>{let o=gb(r.type),a=r.type==="boolean"?[{value:"yes",label:t},{value:"no",label:n}]:(r.options??[]).map(i=>({value:i,label:i}));return{name:r.key,label:r.question,type:o,required:r.required??!1,options:a.length>0?a:void 0,validationHint:r.helpText}})}function di(e){return typeof e=="string"&&e.trim()?e.trim():void 0}var Ze=E.cssPrefix;function hb({skipped:e,submitted:t,strings:n}){return e?{status:"superseded",statusLabel:n.inputSkipped}:t?{status:"responded",statusLabel:n.statusResponded}:{status:"completed",statusLabel:n.inputAnswered}}var vb={text:"qtypeText",email:"qtypeEmail",phone:"qtypePhone",number:"qtypeNumber",date:"qtypeDate","single-select":"qtypeChooseOne","multi-select":"qtypeChooseAny",boolean:"qtypeBoolean"};function D_(e,t){let n={};for(let r of e)n[r.key]=t[vb[r.type]];return n}function F_({part:e,strings:t,active:n,superseded:r=!1,continuationStreaming:o=!1,onDecision:a,onEdit:i}){let s=ue(()=>Se(()=>e.stateSig.value),[e]).value,c=ue(()=>Se(()=>e.approvalSig.value),[e]).value,p=ue(()=>Se(()=>$_(e.inputSig.value)),[e]).value,{terminal:_,decided:d}=li(s,c),u=d&&c?.approved===!0,f=o&&!d,m=!d&&!r&&!f,v=!m&&!u&&!f,x=u&&n&&!_,P=p.questions,[b,C]=H(null),g=b??(m||u||f),[k,w]=H(!1),T=P.length>1?dl:Po,A=m?t.inputRequired:t.inputBadge,M=f?l("p",{class:`${Ze}-toolui-subtle`,children:t.approvalSubmitting}):m?l(yb,{req:p,strings:t,active:n,resolve:(z,V)=>a(e.toolCallId,V,z)}):k?l(To,{fields:wl(p,t.confirmYes,t.confirmNo),strings:t,submitLabel:t.inputSubmit,onSubmit:()=>{},disabled:!0,hideActions:!0,fieldTypeLabels:D_(P,t),initialValues:u?kb(P,c?.reason):void 0}):l(bb,{questions:P,answers:u?Sb(c?.reason):{},strings:t}),{status:N,statusLabel:O}=hb({skipped:v,submitted:f,strings:t});return l("details",{class:`${Ze}-toolui ${Ze}-toolui-collapsible${r?` ${Ze}-toolui-stale`:""}`,open:g,onToggle:z=>{let V=z.currentTarget.open;V!==g&&C(V)},"data-testid":m?L.toolAskQuestions:L.toolDecision,children:[l("summary",{class:`${Ze}-toolui-head`,children:[l("span",{class:`${Ze}-toolui-q-pill`,children:[l(T,{}),A]}),l("span",{class:`${Ze}-toolui-head-end`,children:[m?null:l(kl,{status:N,icon:v?l(Cr,{}):l(wr,{}),label:O}),l("span",{class:`${Ze}-toolui-chevron`,children:l(pn,{})})]})]}),l("div",{class:`${Ze}-toolui-collapse-body`,children:[p.intro?l("div",{class:`${Ze}-toolui-desc`,children:p.intro}):null,M,m||f?null:l("div",{class:`${Ze}-toolui-footer`,children:[l("button",{type:"button",class:`${Ze}-toolui-options-toggle`,onClick:()=>w(z=>!z),"data-testid":L.toolAskOptions,children:[l("span",{class:`${Ze}-toolui-options-chevron${k?` ${Ze}-open`:""}`,children:l(pn,{})}),k?t.hideOptions:t.showOptions]}),x?l("button",{type:"button",class:`${Ze}-form-skip`,onClick:()=>i(e.toolCallId),"data-testid":L.toolEdit,children:t.edit}):null]})]})]})}function yb({req:e,strings:t,active:n,resolve:r}){let o=wl(e,t.confirmYes,t.confirmNo),a=e.questions.length===1&&e.questions[0]?.type==="text";return l(To,{fields:o,strings:t,disabled:!n,submitLabel:t.inputSubmit,footerHint:a?t.inputSubmitHint:void 0,onSubmit:i=>r(xb(e.questions,i),!0),skipLabel:t.inputSkip,onSkip:()=>r(void 0,!1),submitOnEnter:a,fieldTypeLabels:D_(e.questions,t),submitTestId:L.toolInputSubmit,skipTestId:L.toolInputSkip})}function bb({questions:e,answers:t,strings:n}){return l("div",{class:`${Ze}-toolui-summary`,"data-testid":L.toolAskSummary,children:e.map(r=>l("div",{class:`${Ze}-field`,children:[l("span",{class:`${Ze}-field-head`,children:l("span",{class:`${Ze}-field-label`,children:[r.question,r.required?l("span",{class:`${Ze}-field-req`,"aria-hidden":"true",children:" *"}):null]})}),l("p",{class:`${Ze}-toolui-answer`,children:Pb(r,t[r.key],n)||"\u2014"})]},r.key))})}function Pb(e,t,n){return e.type!=="boolean"?t??"":t==="yes"?n.confirmYes:t==="no"?n.confirmNo:t??""}function xb(e,t){let n=e.flatMap(r=>{let o=t[r.key];if(o==null||o.trim()==="")return[];let a=r.type==="multi-select"?o.split(",").map(i=>i.trim()).filter(Boolean):o;return[{key:r.key,value:a}]});return JSON.stringify({answers:n})}function B_(e){if(!e)return{};let n=(()=>{try{return JSON.parse(e)}catch{return}})()?.answers;if(!Array.isArray(n))return{};let r={};for(let o of n)if(o&&typeof o=="object"&&"key"in o){let{key:a,value:i}=o;if(typeof a!="string")continue;typeof i=="string"?r[a]=i:Array.isArray(i)&&(r[a]=i.filter(s=>typeof s=="string"))}return r}function Sb(e){let t=B_(e),n={};for(let[r,o]of Object.entries(t))n[r]=Array.isArray(o)?o.join(", "):o;return n}function kb(e,t){let n=B_(t),r={};for(let o of e){let a=n[o.key];a!==void 0&&(o.type==="multi-select"?r[o.key]=Array.isArray(a)?a:[a]:r[o.key]=Array.isArray(a)?a[0]??"":a)}return r}function U_({part:e,strings:t,live:n,superseded:r}){let o=Vt(e.toolMetadata);if(!ue(()=>Se(()=>ui(e)),[e]).value&&!o)return null;let i=e.outputSig.value===void 0&&!e.errorSig.value;return l(ci,{part:e,strings:t,testid:L.toolCall,live:n||o&&!r,incomplete:o&&r&&i})}var Me=E.cssPrefix;function H_(e){if(e.kind!=="tool")return!1;let t=e.stateSig.value;return t!=="approval-requested"&&t!=="approval-responded"&&!e.toolMetadata?.card&&!Vt(e.toolMetadata)}function q_(e,t){let n=[];for(let[r,o]of e.entries()){let a=n.at(-1);if(o.kind==="reasoning"&&t.showReasoning||H_(o)&&ui(o)){a?.kind==="steps"?(a.parts.push(o),a.indices.push(r)):n.push({kind:"steps",parts:[o],indices:[r]});continue}o.kind==="step-start"||o.kind==="reasoning"||o.kind==="source"&&!t.showSources||H_(o)||n.push({kind:"part",part:o,index:r})}return n}function wb(e){if(!(!e||typeof e!="object"))return Object.values(e).find(t=>typeof t=="string"&&t.trim().length>0)?.trim()}function z_({parts:e,strings:t,live:n,running:r}){let[o,a]=H(!1),i=e.filter(d=>d.kind==="tool"),s=i.filter(d=>Nr(d.stateSig.value,d.approvalSig.value,{live:n})==="error").length,c=new Map;for(let d of i)c.set(si(d.toolName),(c.get(si(d.toolName))??0)+1);let p=e.at(-1),_=p?.kind==="tool"?`${si(p.toolName)}\u2026`:t.thinking;return l("div",{class:`${Me}-steps`,"data-testid":L.toolSteps,"data-running":r?"true":void 0,children:[l("button",{type:"button",class:`${Me}-steps-head`,"aria-expanded":o,onClick:()=>a(!o),children:[l("span",{class:`${Me}-steps-icon`,"aria-hidden":"true",children:r?l("span",{class:`${Me}-loading-spinner`}):l(Ka,{})}),l("span",{class:`${Me}-steps-label`,children:r?_:[...c].map(([d,u],f)=>l("span",{class:`${Me}-steps-name`,children:[f>0?l("span",{"aria-hidden":"true",children:"\xB7"}):null,l("span",{class:`${Me}-steps-name-text`,children:d}),u>1?l("span",{class:`${Me}-steps-count`,children:["\xD7",u]}):null]},d))}),!r&&s>0?l("span",{class:`${Me}-steps-failed`,children:t.toolStepsFailed.replace("{count}",String(s))}):null,l("span",{class:`${Me}-toolui-chevron`,"data-open":o?"true":void 0,children:l(pn,{})})]}),l("span",{class:`${Me}-sr-only`,role:"status",children:r?_:""}),o?l("ol",{class:`${Me}-steps-list`,children:e.map((d,u)=>d.kind==="tool"?l(Cb,{part:d,strings:t,live:n},d.toolCallId):l(Ib,{part:d,strings:t},`${d.id}#${u}`))}):null]})}function Cb({part:e,strings:t,live:n}){let[r,o]=H(!1),a=Nr(e.stateSig.value,e.approvalSig.value,{live:n}),i=wb(e.inputSig.value);return l("li",{class:`${Me}-steps-row`,"data-testid":L.toolStep,"data-status":a,children:[l("button",{type:"button",class:`${Me}-steps-row-head`,"aria-expanded":r,onClick:()=>o(!r),children:[l("span",{class:`${Me}-steps-row-icon`,"aria-hidden":"true",children:l(Tb,{status:a})}),l("span",{class:`${Me}-steps-row-name`,children:Lr(e.toolName)}),i?l("span",{class:`${Me}-steps-row-summary`,children:i}):null,a==="error"?l("span",{class:`${Me}-steps-failed`,children:t.statusError}):null,a==="denied"?l("span",{class:`${Me}-steps-denied`,children:t.statusDenied}):null]}),r?l("div",{class:`${Me}-steps-row-body`,children:[l(Yn,{label:t.toolParameters,value:e.inputSig.value}),e.outputSig.value!==void 0?l(Yn,{label:t.toolResult,value:e.outputSig.value}):null,e.errorSig.value?l(Yn,{label:t.statusError,value:e.errorSig.value,error:!0}):null]}):null]})}function Tb({status:e}){return e==="running"?l("span",{class:`${Me}-loading-spinner`}):e==="error"||e==="denied"?l(Cr,{}):l(wr,{})}function Ib({part:e,strings:t}){let[n,r]=H(!1);return l("li",{class:`${Me}-steps-row`,"data-status":"thought",children:[l("button",{type:"button",class:`${Me}-steps-row-head`,"aria-expanded":n,onClick:()=>r(!n),children:l("span",{class:`${Me}-steps-row-name`,children:t.thoughts})}),n?l("div",{class:`${Me}-steps-row-body ${Me}-reasoning-body`,children:l(Tr,{textSig:e.textSig,doneSig:e.doneSig})}):null]})}var Oe=E.cssPrefix,j_=C_(Rb);function Rb({message:e,status:t,strings:n,responseMode:r,showReasoning:o,showToolCalls:a,showSources:i,interactive:s=!1,superseded:c=!1,tool:p,onRetry:_,enableMessageFeedback:d=!1,onFeedback:u}){let m=[...ue(()=>Se(()=>e.partsSig.value),[e]).value];for(let G of e.attachments??[])!G.url||m.some(Y=>Y.kind==="file"&&Y.url===G.url)||m.push({kind:"file",url:G.url,mediaType:G.mediaType,filename:G.name,fileId:G.id,fileSize:G.size});let v=ue(()=>Se(()=>Gn(e)),[e]),x=ue(()=>Se(()=>Wd(e)),[e]),P=ue(()=>Se(()=>R_(e)),[e]),b=ue(()=>Se(()=>o&&E_(e)),[e,o]),C=t==="streaming",h=e.role==="assistant"&&C,g=A_({streaming:h,responseMode:r,reasoningVisible:b.value,hasAnswerText:P.value,emptyReply:v.value,hidden:x.value}),{bufferedHold:k,working:w,showStreamDots:T}=g;if(g.hidden)return null;let A=Ab(e.createdAt),M=e.role==="assistant"||e.role==="operator",N=d&&!!u&&!!e.serverMessageId&&M&&!C&&t!=="error"&&!v.value,O=C?"":m.filter(G=>G.kind==="text").map(G=>e.role==="assistant"?Oa(G.textSig.peek()):G.textSig.peek()).join(`
60
+ ${n}`:"";s||(t++,a&&(n+="> "));let d={};i.replace(/(\w+)=(["'])(.*?)\2/g,(m,v,y,x)=>d[v]=x);let u=d.href??d.src,f=d.title??d.path??d.query??d.body??d.header??d.name??u;return(a?"> ":"")+(f?`**${u?`[${f}](${u})`:f}**${d.type?` \`${d.type}\``:""}
61
+ ${n}`:"")})}function Jp(e){for(let t of e.querySelectorAll("a")){let n=t.getAttribute("href")??"";!n||n.startsWith("#")||(t.target="_blank",t.rel="noopener noreferrer")}}var Yp=new Set([11,12,13,14,15,16,17,18,19,31]);function ri(e){let t="",n=[],r=br({data:void 0,add_token:(o,a)=>{n.push(a),Yp.has(a)||(t+=" ")},end_token:()=>{let o=n.pop();o!==void 0&&!Yp.has(o)&&(t+=" ")},add_text:(o,a)=>{t+=a},set_attr:()=>{}});return et(r,e),ao(r),t.replace(/\s+/g," ").trim()}var t_=M.cssPrefix;function Ft({tone:e="info",message:t,onRetry:n,strings:r}){return l("div",{class:`${t_}-module-empty`,role:e==="error"?"alert":"status","aria-live":"polite",children:[l("span",{children:t}),n?l("button",{type:"button",class:`${t_}-module-retry`,onClick:n,children:r.errorRetry}):null]})}var En=M.cssPrefix,ub=Z.scope("content"),db=5e3;function n_({id:e,title:t,transport:n,strings:r,bus:o,onBack:a,actions:i}){let[s,c]=H(null),[p,_]=H(!1),[d,u]=H(!1),[f,m]=H(0),[v,y]=H(null),x=F(()=>{u(!1),c(null),m(h=>h+1)},[]);$(()=>{let h=!1,b=n.listContentCollections([]).catch(()=>{});return Promise.all([n.listContent({ids:[e],limit:1}),b]).then(([w,A])=>{if(h)return;let R=w.items[0];R?(c(R),_(A?.items.find(E=>E.id===R.contentCollectionId)?.settings?.voteAccess==="portal"),o.emit("contentOpen",{contentId:e,contentCollectionId:R.contentCollectionId})):u(!0)}).catch(w=>{h||(ub.warn("listContent (reader) failed",{err:w}),u(!0))}),()=>{h=!0}},[n,e,f,o]),$(()=>{if(!s)return;let h=setTimeout(()=>o.emit("contentRead",{contentId:e}),db);return()=>clearTimeout(h)},[s,e,o]);let P=F(h=>{let w=h.target?.closest?.("a")?.getAttribute("href")??"";w&&!w.startsWith("#")&&o.emit("contentLinkClick",{contentId:e})},[o,e]);function k(h){y(e),n.setContentVote({contentId:e,value:h})}function g(){return d?l(Ft,{tone:"error",message:r.errorGeneric,onRetry:x,strings:r}):s===null?l(Ft,{message:r.contentLoading,strings:r}):l("article",{class:`${En}-content`,"data-testid":L.contentView,onClick:P,children:[s.image?l("img",{class:`${En}-content-hero`,src:s.image,alt:"",loading:"lazy"}):null,s.description?l("p",{class:`${En}-content-subtitle`,children:s.description}):null,l(Zp,{text:e_(s.content??"")}),p?l("div",{class:`${En}-content-vote`,"aria-live":"polite",children:v===e?r.feedbackThanks:l(ue,{children:[l("span",{children:r.contentHelpful}),l("button",{type:"button",class:`${En}-module-retry`,onClick:()=>k(1),children:r.confirmYes}),l("button",{type:"button",class:`${En}-module-retry`,onClick:()=>k(0),children:r.confirmNo})]})}):null]})}return l("div",{class:`${En}-module`,children:[l(ni,{title:s?.title||t||r.moduleBack,backLabel:r.moduleBack,onBack:a,actions:i,testid:L.backHeader}),l("div",{class:`${En}-module-scroll`,"data-testid":L.contentScroll,children:g()})]})}function r_({itemCount:e,initialFocusIndex:t}){let[n,r]=H(!1),o=D(null),a=D(null),[i,s]=H(-1),c=F(()=>{r(!1),s(-1),o.current?.focus()},[]),p=F(()=>r(u=>!u),[]);$(()=>{if(!n)return;function u(f){let m=a.current,v=o.current;if(!m||!v)return;let y=f.composedPath();y.includes(m)||y.includes(v)||(r(!1),s(-1))}return document.addEventListener("click",u,!0),()=>document.removeEventListener("click",u,!0)},[n]),$(()=>{if(!n||e===0)return;let u=t?.()??0,f=u<0||u>=e?0:u;s(f)},[n,e,t]),$(()=>{if(!n||i<0)return;a.current?.querySelectorAll("[role='menuitem']")?.[i]?.focus()},[n,i]);let _=F(u=>{(u.key==="ArrowDown"||u.key==="Enter"||u.key===" ")&&(u.preventDefault(),r(!0))},[]),d=F(u=>{if(e!==0)switch(u.key){case"Escape":u.preventDefault(),c();return;case"ArrowDown":u.preventDefault(),s(f=>(f+1)%e);return;case"ArrowUp":u.preventDefault(),s(f=>(f-1+e)%e);return;case"Home":u.preventDefault(),s(0);return;case"End":u.preventDefault(),s(e-1)}},[e,c]);return{open:n,focusIndex:i,triggerRef:o,menuRef:a,toggle:p,close:c,onTriggerKey:_,onMenuKey:d}}function o_({items:e,triggerLabel:t}){let n=M.cssPrefix,r=r_({itemCount:e.length});function o(s){s.disabled||(s.onSelect?.(),s.keepOpen||r.close())}function a(s,c){return s.onSelectValue?.(c)}function i(s,c){let p=c.segments;if(!p?.length)return;let _=Math.max(0,p.findIndex(u=>u.value===c.value)),d=-1;if(s.key==="ArrowRight"||s.key==="Enter"||s.key===" ")d=(_+1)%p.length;else if(s.key==="ArrowLeft")d=(_-1+p.length)%p.length;else return;s.preventDefault(),s.stopPropagation(),a(c,p[d].value)}return l("div",{class:`${n}-menu-wrap`,children:[l("button",{ref:r.triggerRef,type:"button",class:`${n}-icon-btn`,"aria-label":t,"aria-haspopup":"menu","aria-expanded":r.open,title:t,onClick:r.toggle,onKeyDown:r.onTriggerKey,children:l(Ip,{})}),r.open?l("div",{ref:r.menuRef,class:`${n}-menu`,role:"menu","aria-label":t,onKeyDown:r.onMenuKey,tabIndex:-1,children:e.map(s=>s.segments?l("div",{role:"menuitem",class:`${n}-menu-item ${n}-menu-item-segmented`,"aria-label":s.label,tabIndex:-1,onKeyDown:c=>i(c,s),children:[s.icon?l("span",{class:`${n}-menu-icon`,children:s.icon}):null,l("span",{class:`${n}-menu-label`,children:s.label}),l("span",{class:`${n}-segmented`,role:"group","aria-label":s.label,children:s.segments.map(c=>{let p=c.value===s.value;return l("button",{type:"button",role:"menuitemradio","aria-checked":p,class:`${n}-segment`,"data-on":p?"true":void 0,lang:c.lang,title:c.value,tabIndex:-1,"data-testid":`${L.langSegment}-${c.value}`,onClick:()=>a(s,c.value),children:c.label},c.value)})})]},s.id):l("button",{type:"button",role:"menuitem",class:`${n}-menu-item`,"aria-pressed":s.type==="switch"?s.on:void 0,disabled:s.disabled,onClick:()=>o(s),children:[s.icon?l("span",{class:`${n}-menu-icon`,children:s.icon}):null,l("span",{class:`${n}-menu-label`,children:s.label}),s.type==="switch"&&s.on?l("span",{class:`${n}-menu-check`,"aria-hidden":"true",children:l(Yn,{})}):null]},s.id))}):null]})}var yl=M.cssPrefix;function pb(e){let t=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)").matches:!0;return e==="host"?fr()==="dark"?"light":"dark":e==="auto"?t?"light":"dark":t?e==="light"?"dark":"auto":e==="dark"?"light":"auto"}var _b={normal:"large",large:"small",small:"normal"};function fb(e){return e==="light"?l(Bp,{}):e==="dark"?l(Hp,{}):l(Up,{})}function mb(e){return(e.split("-")[0]??e).toUpperCase()}function gb(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 Yt({panelProps:e,variant:t}){let{options:n,panelSize:r,feedback:o,onClose:a,onClear:i,onExpand:s,onFullscreen:c,onSoundToggle:p}=e,{onToggleHistory:_,onLocaleChange:d,onThemeChange:u,onTextSizeChange:f}=e,m=n.strings,v=n.mode,y=t==="chat",x=At(()=>o.mutedSig.value).value,P=new Set(n.actions);function k(X){return P.has(X)}let g=typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches;function h(X){return g?!1:Sr(X,v,r)}let b=n.themeMode,w={auto:m.themeAuto,light:m.themeLight,dark:m.themeDark,host:m.themeAuto},A=n.textSize,R={small:m.textSizeSmall,normal:m.textSizeNormal,large:m.textSizeLarge},E=[];if(y&&k("clear")&&E.push({id:"clear",icon:l($p,{}),label:m.newConversation,onSelect:i}),k("expand")&&h("expand")){let X=r==="expanded";E.push({id:"expand",icon:X?l(kp,{}):l(Sp,{}),label:X?m.collapse:m.expand,type:"switch",on:X,onSelect:s})}if(k("fullscreen")&&h("fullscreen")){let X=r==="fullscreen";E.push({id:"fullscreen",icon:X?l(Cp,{}):l(wp,{}),label:X?m.exitFullscreen:m.fullscreen,type:"switch",on:X,onSelect:c})}let N=n.popOutUrl,j=n.aiAgentDeploymentId;k("popOut")&&N&&j&&Sr("popOut",v,r)&&E.push({id:"popOut",icon:l(Tp,{}),label:m.popOut,onSelect:()=>{let X=gb(N,{conversationId:e.conversationId,widgetId:n.widgetId,publicKey:n.publicKey,aiAgentDeploymentId:j});X&&window.open(X,"_blank","noopener,noreferrer")}}),y&&k("sound")&&E.push({id:"sound",icon:x?l(Ap,{}):l(Ep,{}),label:x?m.soundOff:m.soundOn,type:"switch",on:!x,onSelect:p}),k("theme")&&E.push({id:"theme",icon:fb(b),label:`${m.theme}: ${w[b]}`,onSelect:()=>u(pb(b)),keepOpen:!0}),k("textSize")&&E.push({id:"textSize",icon:l(Mp,{}),label:`${m.textSize}: ${R[A]}`,onSelect:()=>f(_b[A]),keepOpen:!0}),k("language")&&n.availableLocales.length>1&&E.push({id:"language",icon:l(Op,{}),label:m.language,segments:n.availableLocales.map(X=>({value:X,label:mb(X),lang:X})),value:n.locale,onSelectValue:d});let B=!!a&&Ka(v,r,n.actions),V=y&&k("history");return l("div",{class:`${yl}-header-actions`,children:[V?l("button",{type:"button",class:`${yl}-icon-btn`,onClick:_,"aria-label":m.history,title:m.history,"data-testid":L.actionHistory,children:l(Np,{})}):null,E.length>0?l(o_,{items:E,triggerLabel:m.moreActions}):null,B?l("button",{type:"button",class:`${yl}-icon-btn`,onClick:a,"aria-label":m.close,title:m.close,"data-testid":L.actionClose,children:l(qt,{})}):null]})}var a_={Icon:xo};function Zn(e,t){return e instanceof _t?e.status===429?e.retryAfterSeconds?t.errorRateLimitedIn.replace("{seconds}",String(e.retryAfterSeconds)):t.errorRateLimited:e.code==="network"?t.errorOffline:e.status!==void 0&&e.status>=500?t.errorServer:t.errorGeneric:t.errorGeneric}var Ir=M.cssPrefix;function i_({placeholder:e,onActivate:t}){return l("button",{type:"button",class:`${Ir}-home-search`,onClick:t,"data-testid":L.homeSearch,children:[l("span",{class:`${Ir}-home-search-text`,children:e}),l("span",{class:`${Ir}-home-search-icon`,"aria-hidden":"true",children:l(bl,{})})]})}function s_({placeholder:e,value:t,onInput:n}){return l("div",{class:`${Ir}-home-search`,"data-input":"true",children:[l("input",{type:"search",class:`${Ir}-home-search-input`,placeholder:e,value:t,maxLength:200,onInput:r=>n(r.currentTarget.value),"data-testid":L.helpSearch}),l("span",{class:`${Ir}-home-search-icon`,"aria-hidden":"true",children:l(bl,{})})]})}var ko=M.cssPrefix;function oi({title:e,subtitle:t,onClick:n,testid:r}){return l("button",{type:"button",class:`${ko}-list-row`,onClick:n,"data-testid":r,children:[l("span",{class:`${ko}-list-row-body`,children:[l("span",{class:`${ko}-list-row-title`,children:e}),t?l("span",{class:`${ko}-list-row-sub`,children:t}):null]}),l("span",{class:`${ko}-list-row-chevron`,"aria-hidden":"true",children:l(Cr,{})})]})}var Zt=M.cssPrefix,hb=Z.scope("help"),vb=20,bb=300;function yb(e,t,n){let r=new Map(n.map(o=>[o.id,o.title]));return t.map(o=>({id:o,title:r.get(o),rows:e.filter(a=>a.contentCollectionId===o)})).filter(o=>o.rows.length>0)}function l_({transport:e,strings:t,bus:n},r,o){let[a,i]=H(),s=D(void 0);function c(p){if(!r?.length)return;let _={};s.current=_,i(d=>({search:o,items:[],collections:[],...d,pagination:p>1?d?.pagination:void 0,loading:!0,error:void 0})),Promise.all([e.listContent({contentCollectionIds:r,sortBy:"order",page:p,limit:vb,search:o}),p>1?void 0:e.listContentCollections(r)]).then(([d,u])=>{s.current===_&&(i(f=>({search:o,items:[...p>1?f?.items??[]:[],...d.items],collections:u?.items??f?.collections??[],pagination:d.pagination,loading:!1})),!(p>1)&&(o?n.emit("contentSearch",{queryLength:o.length,hitCount:d.pagination.total}):n.emit("contentView",{section:"help",count:d.items.length})))}).catch(d=>{s.current===_&&(hb.warn("listContent (help) failed",{err:d,page:p}),i(u=>u&&{...u,loading:!1,error:Zn(d,t)}))})}return $(()=>{if(!r?.length){i(void 0);return}return c(1),()=>{s.current=void 0}},[e,r,o]),[a,()=>!a?.loading&&c((a?.pagination?.page??0)+1)]}function Pb(e){let{strings:t,config:n,nav:r,panelProps:o}=e,a=n.contentCollectionIds,[i,s]=H(""),[c,p]=H(""),_=l_(e,a),d=l_(e,c?a:void 0,c),[u,f]=i.trim()?d:_;$(()=>{let v=setTimeout(()=>p(i.trim()),bb);return()=>clearTimeout(v)},[i]);function m(){if(!a?.length)return l(Ft,{message:t.helpEmpty,strings:t});let v=u?.error?l(Ft,{tone:"error",message:u.error,onRetry:f,strings:t}):null;return v&&!u?.pagination?v:!u||!u.pagination&&!u.items.length?l(Ft,{message:t.helpLoading,strings:t}):u.items.length?l(ue,{children:[yb(u.items,a,u.collections).map(y=>l("section",{class:`${Zt}-help-group`,children:[y.title?l("h2",{class:`${Zt}-help-section-title`,children:y.title}):null,l("div",{class:`${Zt}-help-card`,children:y.rows.map(x=>l(oi,{title:x.title,subtitle:x.description,onClick:()=>r.push(x.url?{kind:"iframe",url:x.url,title:x.title}:{kind:"content",id:x.id,title:x.title}),testid:ft(L.helpArticle,x.id)},x.id))})]},y.id)),v,u.pagination?.hasNext&&!v?l("div",{children:l("div",{class:`${Zt}-help-card`,children:l("button",{type:"button",class:`${Zt}-list-row ${Zt}-help-more`,onClick:f,"aria-busy":u.loading,children:[u.loading?l("span",{class:`${Zt}-loading-spinner`,"aria-hidden":"true"}):null,t.helpShowMore]})})}):null]}):l(Ft,{message:u.search?t.helpSearchEmpty.replace("{query}",u.search):t.helpEmpty,strings:t})}return l("div",{class:`${Zt}-module`,children:[l(ti,{title:t.helpTitle,actions:l(Yt,{panelProps:o,variant:"plain"})}),l("div",{class:`${Zt}-module-pad`,children:l(s_,{placeholder:t.helpSearchPlaceholder,value:i,onInput:s})}),l("div",{class:`${Zt}-help-list`,children:m()})]})}var c_={Icon:Po,Root:e=>l(Pb,{...e})};var u_=Z.scope("attachments");function ai(e,t,n){let r=Sb(e),o=[],a=[],i=Cb(n.accept),s=t.reduce((p,_)=>p+_.size,0),c=t.length;for(let p of r){let _=xb(p,c,s,n,i);if(_){a.push({file:p,reason:_});continue}o.push(wb(p)),s+=p.size,c+=1}return(o.length||a.length)&&u_.debug("ingest",{accepted:o.length,rejected:a.map(p=>({name:p.file.name,reason:p.reason}))}),{accepted:o,rejected:a}}function Er(e){try{URL.revokeObjectURL(e.previewUrl)}catch(t){u_.debug("revokeObjectURL failed",{error:t})}}function xb(e,t,n,r,o){return t>=r.maxCount?"count":n+e.size>r.maxBytes?"bytes":Tb(e,o)?null:"mime"}function Sb(e){return e?Array.isArray(e)?e.filter(t=>t instanceof File):[...e].map(t=>t instanceof File?t:kb(t)).filter(t=>t!==null):[]}function kb(e){let t=e;return!t?.getAsFile||t.kind!=="file"?null:t.getAsFile()}function wb(e){return{file:e,id:Rt(),mediaType:e.type||"application/octet-stream",name:e.name||"pasted-file",previewUrl:URL.createObjectURL(e),size:e.size}}function Cb(e){return e.split(",").map(t=>t.trim().toLowerCase()).filter(Boolean).map(t=>{if(t.startsWith("."))return{kind:"ext",ext:t};let[n="*",r="*"]=t.split("/");return{kind:"mime",type:n,subtype:r}})}function Tb(e,t){if(t.length===0)return!0;let[n="*",r="*"]=(e.type||"").toLowerCase().split("/"),o=(e.name||"").toLowerCase();return t.some(a=>a.kind==="ext"?o.endsWith(a.ext):a.type==="image"&&a.subtype==="*"&&/\.(heic|heif|avif|bmp|tif|tiff)$/.test(o)?!0:(a.type==="*"||a.type===n)&&(a.subtype==="*"||a.subtype===r))}var wo=M.cssPrefix;function d_({attachment:e,onRemove:t,disabled:n=!1}){let r=/^image\/(jpeg|png|gif|webp|avif|bmp|x-ms-bmp|svg\+xml)$/i.test(e.mediaType);return l("span",{class:`${wo}-attachment-chip`,title:e.name,"data-testid":ft(L.attachmentChip,e.id),children:[r?l("img",{class:`${wo}-attachment-thumb`,src:e.previewUrl,alt:""}):l("span",{class:`${wo}-attachment-thumb`,"aria-hidden":"true",children:l(Xa,{})}),l("span",{class:`${wo}-attachment-name`,children:e.name}),l("button",{type:"button",class:`${wo}-attachment-remove`,onClick:t,disabled:n,"aria-label":`Remove ${e.name}`,"data-testid":ft(L.attachmentRemove,e.id),children:l(qt,{})})]})}var Pl={isSupported:!1,start:()=>{},stop:()=>{},cancel:()=>{}};function xl(e,t,n){return e==="disabled"?Pl:e==="server"?Ab(n):Rb(t)}function Rb(e){let t=Ib();if(!t)return Pl;let n=null,r=0;return{isSupported:!0,start(o,a){let i=n,s=++r;n=null,i?.abort();let c=new t;n=c,c.continuous=!0,c.interimResults=!0,c.lang=e;let p=!1;c.addEventListener("result",d=>{if(r!==s||n!==c)return;let u=d,f="",m=!1;for(let v=u.resultIndex;v<u.results.length;v++){let y=u.results[v];y&&(f+=y[0].transcript,y.isFinal&&(m=!0))}o(f,m)});function _(){p||r!==s||n!==c||(p=!0,n=null,a())}c.addEventListener("end",_),c.addEventListener("error",_);try{c.start()}catch{_()}},stop(){n?.stop()},cancel(){r++;let o=n;n=null,o?.abort()}}}function Ib(){return window.SpeechRecognition??window.webkitSpeechRecognition}var Eb=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];function Ab(e){if(typeof MediaRecorder>"u"||!navigator?.mediaDevices?.getUserMedia)return Pl;let t=0,n=null;function r(i){for(let s of i.stream?.getTracks()??[])s.stop();i.stream=null}function o(){t++;let i=n;n=null,i&&(r(i),i.recorder?.state!=="inactive"&&i.recorder?.stop())}async function a(i){if(i.finishing)return;i.finishing=!0;let s=i.recorder?.mimeType??"audio/webm";r(i);let c=new Blob(i.chunks,{type:s});i.chunks=[];try{let{text:p}=await e(c,s);n===i&&t===i.generation&&p&&i.onText(p,!0)}catch{}finally{n===i&&t===i.generation&&(n=null,i.onEnd())}}return{isSupported:!0,async start(i,s){o();let c={generation:t,recorder:null,stream:null,chunks:[],onText:i,onEnd:s,finishing:!1};n=c;try{let p=await navigator.mediaDevices.getUserMedia({audio:!0});if(n!==c||t!==c.generation){for(let u of p.getTracks())u.stop();return}c.stream=p;let _=Mb(),d=new MediaRecorder(p,_?{mimeType:_}:void 0);c.recorder=d,d.addEventListener("dataavailable",u=>{n===c&&t===c.generation&&u.data.size>0&&c.chunks.push(u.data)}),d.addEventListener("stop",()=>{n===c&&t===c.generation&&a(c)}),d.start()}catch{r(c),n===c&&t===c.generation&&(n=null,s())}},stop(){let i=n;if(i){if(!i.recorder){o();return}i.recorder.state!=="inactive"&&i.recorder.stop()}},cancel(){o()}}}function Mb(){for(let e of Eb)if(MediaRecorder.isTypeSupported(e))return e}var nt=M.cssPrefix,Ar=Z.scope("composer");function Mr(e){return e.reduce((t,n)=>t+n.size,0)}var Sl={arrowUp:bp,paperPlane:vp,send:yp,chevron:Cr};function p_(e){return"activeElement"in e}function Lb(e){return"host"in e&&"activeElement"in e}function __({options:e,transport:t,feedback:n,bus:r,persistence:o,conversationId:a,isStreaming:i,pageToolRunning:s=!1,isMemoryCompacting:c=!1,canReleaseQueuedMessages:p=!0,queueManualMessages:_=!1,active:d=!0,isPreparing:u=!1,operatorRequestEnabled:f,canRequestOperator:m=!1,controlMode:v="ai-agent",onRequestOperator:y,onSend:x,onStop:P,apiRef:k}){let g=e.strings,[h,b]=H(()=>o.loadDraft(a)),[w,A]=H([]),[R,E]=H(()=>o.loadMessageQueue(a).map(U=>({id:U.id,text:U.text,attachments:[]}))),N=D(R),j=D(!1),[B,V]=H(!1),[X,pe]=H(!1),J=D(!1),ce=D(null),ke=D(null),be=D(null),Me=D(0),Fe=D(a);Fe.current=a;let ne=D(d);ne.current=d;let Pe=D(u);Pe.current=u;let Oe=X||u||!d,lt=i&&v==="ai-agent",ot=lt||c&&v==="ai-agent",ht=v==="ai-agent"&&(ot||_||R.length>0),Nt=F(U=>{E(K=>{let Y=U(K);return o.saveMessageQueue(Fe.current,Y.filter(ge=>ge.attachments.length===0).map(({id:ge,text:mt})=>({id:ge,text:mt}))),N.current=Y,Y})},[o]),vt=F(U=>{Nt(K=>(K.find(Y=>Y.id===U)?.attachments.forEach(Er),K.filter(Y=>Y.id!==U)))},[Nt]),Te=F(U=>{b(K=>{let Y=typeof U=="function"?U(K):U;return Y===K?K:(o.saveDraft(Fe.current,Y),Y)})},[o]),ct=e.features.fileUpload,Se=e.features.voice,[qe,ze]=H(()=>xl(Se,e.locale,(U,K)=>t.transcribe(U,K))),Ot=D(qe);Ot.current=qe;let Ve=D({mode:Se,locale:e.locale,transport:t});$(()=>{let U=Ve.current;U.mode===Se&&U.locale===e.locale&&U.transport===t||(Ve.current={mode:Se,locale:e.locale,transport:t},Me.current++,Ot.current.cancel(),be.current=null,V(!1),ze(xl(Se,e.locale,(K,Y)=>t.transcribe(K,Y))))},[e.locale,Se,t]),It(()=>()=>{Me.current++,qe.cancel()},[qe]);let Pt=F(U=>{let K=be.current;if(K===null)return!1;let Y=Math.round(performance.now()-K);return Ar[U]("voiceStop",{durationMs:Y}),r.emit("voiceStop",{durationMs:Y}),be.current=null,!0},[r]),O=F(()=>{be.current!==null&&(qe.stop(),V(!1),Pt("info")&&n.play("voiceStop"))},[Pt,n,qe]),C=F(()=>{Me.current++,qe.cancel(),V(!1),Pt("info")&&n.play("voiceStop")},[Pt,n,qe]);$(()=>{(u||!d)&&C()},[d,C,u]),$(()=>{let U=ce.current;if(!U)return;let K=U.getRootNode(),Y=p_(K)?K.activeElement:null;Y&&U.closest(`.${nt}-panel`)?.contains(Y)||U.focus({preventScroll:!0})},[]),$(()=>{let U=ce.current;if(!U)return;if(h.length===0){U.style.height="";return}U.style.height="auto";let K=getComputedStyle(U),Y=Number.parseFloat(K.getPropertyValue(`--${nt}-textarea-base-height`)),ge=Number.parseFloat(K.borderTopWidth)+Number.parseFloat(K.borderBottomWidth),mt=Math.min(U.scrollHeight+ge,Number.parseFloat(K.maxHeight)),$t=Number.parseFloat(K.fontSize)*.7;U.style.height=`${mt<Y+$t?Y:mt}px`},[h]);let q=D(w);q.current=w,$(()=>()=>{q.current.forEach(Er);for(let U of N.current)U.attachments.forEach(Er)},[]),It(()=>{if(k)return k.current={attachFromDrop:U=>{if(!ct||!ne.current||J.current||Pe.current)return;let K=ai(U,q.current,e.attachments);K.accepted.length!==0&&(Ar.info("attach (drop)",{count:K.accepted.length,totalBytes:Mr(K.accepted)}),r.emit("attach",{count:K.accepted.length,totalBytes:Mr(K.accepted)}),A(Y=>[...Y,...K.accepted]))},fill:U=>{if(!ne.current||J.current||Pe.current)return;Te(U);let K=ce.current;K&&(K.focus({preventScroll:!0}),requestAnimationFrame(()=>K.setSelectionRange(K.value.length,K.value.length)))},acceptQueuedMessage:vt},()=>{k.current&&(k.current=null)}},[k,ct,u,e.attachments,vt,Te]),$(()=>{let U=ce.current;if(!U)return;let K=U.closest(`.${nt}-panel`);if(!K)return;let Y=ge=>{if(!ne.current||J.current||Pe.current)return;let mt=ge.clipboardData;if(!mt)return;let $t=ge.target?.closest?.("input, textarea, [contenteditable]:not([contenteditable='false'])");if($t&&$t!==U)return;if(ct){let xt=ai(mt.items,q.current,e.attachments);if(xt.accepted.length>0){ge.preventDefault(),Ar.info("attach (paste)",{count:xt.accepted.length,totalBytes:Mr(xt.accepted)}),r.emit("attach",{count:xt.accepted.length,totalBytes:Mr(xt.accepted)}),A(Ln=>[...Ln,...xt.accepted]);return}}if($t===U)return;let Mn=mt.getData("text/plain");Mn&&(ge.preventDefault(),Te(xt=>xt+Mn),U.focus())};return K.addEventListener("paste",Y),()=>K.removeEventListener("paste",Y)},[ct,e.attachments,Te]);async function ae(){let U=h.trim();if(!U&&w.length===0||!d||lt||J.current||u)return;C(),J.current=!0,pe(!0);let K=h,Y=w;try{await x(U,Y)&&(Te(ge=>ge===K?"":ge),A(ge=>ge!==Y?ge:(Y.forEach(Er),q.current=[],[])))}finally{J.current=!1,pe(!1),requestAnimationFrame(()=>{let ge=ce.current;if(!ge||ge.disabled||!ne.current)return;let mt=ge.getRootNode(),$t=p_(mt)?mt.activeElement:null,Mn=$t?.getAttribute("data-testid");if(!($t&&$t!==ge&&Mn!==L.composerSend&&Mn!==L.composerStop)){if(Lb(mt)){let xt=mt.host.ownerDocument;if(!xt.hasFocus())return;let Ln=xt.activeElement;if(Ln&&Ln!==mt.host&&Ln!==xt.body)return}ge.focus({preventScroll:!0})}})}}function re(){let U=h.trim();if(!U&&w.length===0||!d||!ht||J.current||u)return;C();let K=w;Nt(Y=>[...Y,{id:Rt(),text:U,attachments:K}]),Te(""),A(Y=>Y!==K?Y:(q.current=[],[])),ce.current?.focus({preventScroll:!0})}$(()=>{ot&&(j.current=!1)},[ot]),$(()=>{let U=R[0];if(!U||!p||ot||j.current||X||u||!d)return;let K=setTimeout(()=>{j.current=!0,x(U.text,U.attachments,U.id).then(Y=>{if(Y){vt(U.id);return}j.current=!1})},300);return()=>clearTimeout(K)},[d,p,u,x,ot,R,vt,X]);function _e(U){U.key!=="Enter"||U.shiftKey||U.isComposing||(U.preventDefault(),ht&&(h.trim()||w.length>0)?re():lt?P():ae())}function Re(U){let K=U.target;if(!d||J.current||u){K.value="";return}let Y=ai(K.files,w,e.attachments);Y.accepted.length>0&&(Ar.info("attach (file picker)",{count:Y.accepted.length,totalBytes:Mr(Y.accepted)}),r.emit("attach",{count:Y.accepted.length,totalBytes:Mr(Y.accepted)}),A(ge=>[...ge,...Y.accepted])),K.value=""}function Ie(U){!d||J.current||u||(Ar.info("removeAttachment",{id:U}),r.emit("removeAttachment",{id:U}),A(K=>{let Y=K.find(ge=>ge.id===U);return Y&&Er(Y),K.filter(ge=>ge.id!==U)}))}function $e(){if(B){O();return}if(!d||!qe.isSupported||J.current||u)return;let U=++Me.current;be.current=performance.now(),Ar.info("voiceStart"),r.emit("voiceStart",void 0),V(!0),n.play("voiceStart"),qe.start((K,Y)=>{Me.current!==U||!ne.current||Pe.current||J.current||!Y||Te(ge=>`${ge}${K} `)},()=>{Me.current!==U||!ne.current||(V(!1),Pt("debug"))})}let ye=Sl[e.composer.sendButton.icon],Be=!!(h.trim()||w.length>0),Ke=lt||s&&!Be;return l("div",{class:`${nt}-composer`,part:"composer","data-testid":L.composer,children:[R.length>0?l("div",{class:`${nt}-message-queue`,"aria-label":g.queueMessage,"data-testid":L.messageQueue,children:R.map(U=>l("div",{class:`${nt}-attachment-chip ${nt}-queued-message`,"data-testid":`${L.queuedMessage}-${U.id}`,children:[l("span",{class:`${nt}-attachment-name ${nt}-queued-text`,children:U.text||U.attachments.map(K=>K.name).join(", ")}),l("button",{type:"button",class:`${nt}-attachment-remove`,onClick:()=>vt(U.id),"aria-label":g.removeQueuedMessage,title:g.removeQueuedMessage,"data-testid":`${L.queuedMessageRemove}-${U.id}`,children:l(qt,{})})]},U.id))}):null,w.length>0?l("div",{class:`${nt}-attachments`,children:w.map(U=>l(d_,{attachment:U,onRemove:()=>Ie(U.id),disabled:Oe},U.id))}):null,l("div",{class:`${nt}-composer-row`,children:[l("div",{class:`${nt}-composer-actions`,children:[ct?l("button",{type:"button",class:`${nt}-icon-btn`,onClick:()=>ke.current?.click(),disabled:Oe,"aria-label":g.attach,"data-testid":L.composerAttach,children:l(Pp,{})}):null,qe.isSupported?l("button",{type:"button",class:`${nt}-icon-btn`,onClick:$e,disabled:Oe,"aria-label":B?g.micStop:g.micStart,"aria-pressed":B,"data-recording":B?"true":void 0,"data-testid":L.composerVoice,children:l(xp,{})}):null]}),l("textarea",{ref:ce,name:"message",class:`${nt}-textarea`,rows:1,value:h,placeholder:g.composerPlaceholder,onInput:U=>Te(U.currentTarget.value),onKeyDown:_e,disabled:Oe,"aria-label":g.composerPlaceholder,"data-testid":L.composerInput}),ht&&Be?l("button",{type:"button",class:`${nt}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:re,disabled:Oe,"aria-label":g.queueMessage,title:g.queueMessage,"data-testid":L.composerSend,children:l(ye,{})}):null,Ke?l("button",{type:"button",class:`${nt}-send`,onClick:P,disabled:Oe,"aria-label":g.stop,"data-testid":L.composerStop,children:l(pn,{})}):null,!Ke&&(!ht||!Be)?l("button",{type:"button",class:`${nt}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:()=>{ae()},disabled:Oe||!h.trim()&&w.length===0,"aria-label":g.send,"data-testid":L.composerSend,children:l(ye,{})}):null,f&&v==="ai-agent"&&y?l("button",{type:"button",class:`${nt}-icon-btn`,onClick:y,disabled:Oe||!m,"aria-label":g.talkToOperator,title:g.talkToOperator,"data-testid":L.operatorRequest,children:l(vl,{})}):null]}),l("input",{ref:ke,name:"attachments",type:"file",multiple:!0,accept:e.attachments.accept,onChange:Re,disabled:Oe,class:`${nt}-sr-only`,"data-testid":L.composerFileInput})]})}var f_=M.cssPrefix;function ii({onClick:e,children:t,testid:n}){return e?l("button",{type:"button",class:`${f_}-home-card`,"data-interactive":"true",onClick:e,"data-testid":n,children:t}):l("div",{class:`${f_}-home-card`,"data-testid":n,children:t})}function si(e){return e.trim().split(/\s+/).slice(0,2).map(t=>t.charAt(0).toUpperCase()).join("")}var zt=M.cssPrefix,Nb=Z.scope("news"),Ob=10;function kl(e,t){let n=e?new Date(e):void 0;if(!(!n||Number.isNaN(n.getTime())))return new Intl.DateTimeFormat(t,{dateStyle:"medium"}).format(n)}function $b({options:e,transport:t,strings:n,config:r,nav:o,bus:a,panelProps:i,latestNews:s}){let c=r.contentCollectionIds,[p,_]=H({items:[],loading:!0}),d=D(void 0);function u(y){if(!c?.length)return;let x={};d.current=x,_(P=>({...P,loading:!0,error:void 0})),t.listContent({contentCollectionIds:c,sortBy:"publishedAt",sortOrder:"desc",page:y,limit:Ob}).then(P=>{if(d.current!==x||(_(g=>({items:y>1?[...g.items,...P.items]:P.items,pagination:P.pagination,loading:!1})),y>1))return;a.emit("contentView",{section:"news",count:P.items.length});let k=P.items[0];k&&s.markSeen(k.id)}).catch(P=>{d.current===x&&(Nb.warn("listContent (news) failed",{err:P,page:y}),_(k=>({...k,loading:!1,error:Zn(P,n)})))})}function f(){p.loading||u((p.pagination?.page??0)+1)}$(()=>(_({items:[],loading:!0}),u(1),()=>{d.current=void 0}),[t,c]);function m(y){let x=kl(y.publishedAt,e.locale);return l("button",{type:"button",class:`${zt}-news-card`,onClick:()=>o.push({kind:"content",id:y.id,title:y.title}),"data-testid":ft(L.newsItem,y.id),children:[y.image?l("img",{class:`${zt}-news-hero`,src:y.image,alt:"",loading:"lazy"}):null,l("span",{class:`${zt}-news-body`,children:[l("span",{class:`${zt}-news-title`,children:y.title}),x||y.tags?.length?l("span",{class:`${zt}-news-meta`,children:[x?l("time",{dateTime:y.publishedAt,children:x}):null,y.tags?.map(P=>l("span",{class:`${zt}-news-tag`,children:P},P))]}):null,y.description?l("span",{class:`${zt}-news-summary`,children:y.description}):null]})]},y.id)}function v(){if(!c?.length)return l(Ft,{message:n.newsEmpty,strings:n});let y=p.error?l(Ft,{tone:"error",message:p.error,onRetry:f,strings:n}):null;return y&&!p.pagination?y:p.pagination?p.items.length?l("div",{class:`${zt}-news-list`,children:[p.items.map(m),y,p.pagination.hasNext&&!y?l("button",{type:"button",class:`${zt}-news-more`,onClick:f,"aria-busy":p.loading,"data-testid":L.newsMore,children:[p.loading?l("span",{class:`${zt}-loading-spinner`,"aria-hidden":"true"}):null,n.newsShowMore]}):null]}):l(Ft,{message:n.newsEmpty,strings:n}):l(Ft,{message:n.newsLoading,strings:n})}return l("div",{class:`${zt}-module`,children:[l(ti,{title:n.newsTitle,actions:l(Yt,{panelProps:i,variant:"plain"})}),l("div",{class:`${zt}-module-scroll`,children:v()})]})}var m_={Icon:Ja,Root:e=>l($b,{...e})};var ve=M.cssPrefix,g_=Z.scope("home");function Db(e){let t=e.options.userContext?.name,n=e.config.greetingText?St(e.strings,e.config.greetingText):void 0;if(n){let r=t?n.replace("{name}",t):n.replace(/\s*\{name\}\s*/," ").trim(),o=e.strings.homeGreetingLead;return{title:r,subtitle:r.toLowerCase()===o.toLowerCase()?void 0:o}}return t?{title:e.strings.homeGreetingNamed.replace("{name}",t),subtitle:e.strings.homeGreetingLead}:{title:e.strings.homeGreeting}}function Fb(e,t){return t.url?e.push({kind:"iframe",url:t.url,title:t.title}):e.push({kind:"content",id:t.id,title:t.title})}function Bb({options:e,onAsk:t}){let[n,r]=H(""),{sendButton:o}=e.composer,a=Sl[o.icon];function i(s){s.preventDefault();let c=n.trim();c&&(r(""),t(c))}return l("form",{class:`${ve}-home-search ${ve}-home-ask`,"data-input":"true",onSubmit:i,"data-testid":L.homeAsk,children:[l("input",{type:"text",class:`${ve}-home-search-input`,placeholder:e.strings.homeAskPlaceholder,"aria-label":e.strings.homeAskPlaceholder,value:n,enterKeyHint:"send",onInput:s=>r(s.currentTarget.value)}),l("button",{type:"submit",class:`${ve}-send`,"data-shape":o.shape,"data-variant":o.variant,disabled:!n.trim(),"aria-label":e.strings.send,children:l(a,{})})]})}function h_(e,t){return dn(e,t,t.type!=="upsert"||t.activity===!0)}function Hb(e){let{transport:t,strings:n,config:r,nav:o,bus:a,panelProps:i,latestNews:s}=e,[c,p]=H(null),[_,d]=H([]),u=r.contentCollectionIds?.join(","),f=e.options.modules.list.some(h=>h.layout==="chat");$(()=>{if(r.showRecentConversations===!1)return;let h=!1,b=!0,w=[],A=t.subscribeConversationChanges(R=>{b&&w.push(R),p(E=>h_(E?[E]:[],R)[0]??null)});return t.listConversations({limit:f?50:1}).then(R=>{if(h)return;let E=w.reduce(h_,R.conversations);w=[],b=!1,p(E[0]??null)}).catch(R=>{h||(w=[],b=!1,g_.warn("listConversations (home) failed",{err:R}))}),()=>{h=!0,A()}},[t,r.showRecentConversations,f]),$(()=>{if(!r.contentCollectionIds?.length)return;let h=!1;return t.listContent({contentCollectionIds:r.contentCollectionIds,pinned:!0,limit:6}).then(b=>{h||(d(b.items),a.emit("contentView",{section:"home",count:b.items.length}))}).catch(b=>!h&&g_.warn("listContent (home) failed",{err:b})),()=>{h=!0}},[t,u,a]);let m=Db(e),v=r.userAvatars??[],y=r.status,x=y?.text?St(n,y.text):n.homeStatus,P=r.contentBlockTitle?St(n,r.contentBlockTitle):n.homeContentTitle,k=s.item,g=kl(k?.publishedAt,e.options.locale);return l("div",{class:`${ve}-module ${ve}-home`,"data-testid":L.homeView,children:l("div",{class:`${ve}-home-scroll`,children:[l("div",{class:`${ve}-home-hero`,children:[l("div",{class:`${ve}-home-hero-top`,children:[r.brandName?l("span",{class:`${ve}-home-brand`,"data-testid":L.homeBrand,children:r.brandName}):l("span",{class:`${ve}-home-brand-spacer`,"aria-hidden":"true"}),l("div",{class:`${ve}-home-hero-actions`,children:[v.length>0?l("div",{class:`${ve}-home-avatars`,children:v.map(h=>l("span",{class:`${ve}-home-avatar`,title:h.role?`${h.name} \xB7 ${h.role}`:h.name,children:h.avatar?l("img",{src:h.avatar,alt:"",loading:"lazy"}):l("span",{children:si(h.name)})},h.name))}):null,l(Yt,{panelProps:i,variant:"plain"})]})]}),r.showGreeting!==!1?l(ue,{children:[l("h1",{class:`${ve}-home-greeting`,"data-testid":L.homeGreeting,children:m.title}),m.subtitle?l("p",{class:`${ve}-home-lead`,children:m.subtitle}):null]}):null]}),l("div",{class:`${ve}-home-cards`,children:[f?l(Bb,{options:e.options,onAsk:h=>o.startNewConversation(h)}):null,r.showSearchBar!==!1?l(i_,{placeholder:n.homeSearchPlaceholder,onActivate:()=>o.switchToLayout("help")}):null,k?l(ii,{onClick:()=>{s.markSeen(k.id),o.push({kind:"content",id:k.id,title:k.title})},testid:L.homeWhatsNew,children:l("div",{class:`${ve}-home-recent-row`,"data-unread":s.unseen?"true":void 0,children:[l("span",{class:`${ve}-home-recent-avatar`,"aria-hidden":"true",children:l(Ja,{})}),l("span",{class:`${ve}-home-recent-body`,children:[l("span",{class:`${ve}-home-recent-title`,children:n.homeWhatsNew}),l("span",{class:`${ve}-home-recent-preview`,children:g?`${k.title} \xB7 ${g}`:k.title})]}),s.unseen?l("span",{class:`${ve}-home-recent-dot`,role:"img","aria-label":n.newsUnseen}):null]})}):null,c?l(ii,{onClick:()=>o.selectConversation(c),testid:L.homeRecent,children:l("div",{class:`${ve}-home-recent-row`,"data-unread":c.hasUnread?"true":void 0,children:[l("span",{class:`${ve}-home-recent-avatar`,"aria-hidden":"true",children:l(xo,{})}),l("span",{class:`${ve}-home-recent-body`,children:[l("span",{class:`${ve}-home-recent-title`,children:c.title}),c.preview?l("span",{class:`${ve}-home-recent-preview`,children:ri(c.preview)}):null]}),c.hasUnread?l("span",{class:`${ve}-home-recent-dot`,"aria-label":"Unread"}):null]})}):null,y?l(ii,{onClick:y.url?()=>o.push({kind:"iframe",url:y.url,title:x}):void 0,children:l("div",{class:`${ve}-home-status`,"data-level":y.level??"operational",children:[l("span",{class:`${ve}-home-status-icon`,"aria-hidden":"true",children:l(Dp,{})}),l("span",{class:`${ve}-home-status-text`,children:x})]})}):null,_.length>0?l("section",{class:`${ve}-home-content`,children:[l("div",{class:`${ve}-home-content-title`,children:P}),l("div",{class:`${ve}-home-content-list`,children:_.map(h=>l(oi,{title:h.title,subtitle:h.description,onClick:()=>Fb(o,h),testid:ft(L.homeContentRow,h.id)},h.id))})]}):null]})]})})}var v_={Icon:Fp,Root:e=>l(Hb,{...e})};var li={chat:a_,home:v_,help:c_,news:m_};var Co=M.cssPrefix;function b_({modules:e,activeTab:t,strings:n,hasUnread:r,onSelect:o}){return l("nav",{class:`${Co}-tabbar`,role:"tablist","aria-label":n.panelTitle,children:e.map(a=>{let i=li[a.layout].Icon,s=a.id===t,c=a.layout==="chat"&&r;return l("button",{type:"button",role:"tab","aria-selected":s,class:`${Co}-tab`,onClick:()=>o(a.id),"data-testid":ft(L.tab,a.id),children:[l("span",{class:`${Co}-tab-icon`,"aria-hidden":"true",children:[l(i,{}),c?l("span",{class:`${Co}-tab-badge`,"data-testid":L.tabBadge,"aria-label":"Unread"}):null]}),l("span",{class:`${Co}-tab-label`,children:St(n,a.label)})]},a.id)})})}var y_=M.cssPrefix,Ub="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads";function P_({url:e,title:t,strings:n,onBack:r,actions:o}){return l("div",{class:`${y_}-module`,children:[l(ni,{title:t||n.moduleBack,backLabel:n.moduleBack,onBack:r,actions:o}),l("iframe",{class:`${y_}-content-frame`,src:e,title:t||"content",sandbox:Ub,referrerpolicy:"no-referrer",loading:"lazy",allow:"fullscreen"})]})}var wl=M.cssPrefix;function x_({agent:e,strings:t}){let n=e.status??"online",r=St(t,e.name),o=e.title?St(t,e.title):null;return l("div",{class:`${wl}-agent`,children:[l("div",{class:`${wl}-agent-avatar`,"data-status":n,children:e.avatar?l("img",{src:e.avatar,alt:""}):l("span",{children:si(r)})}),l("div",{class:`${wl}-agent-meta`,children:[l("strong",{children:r}),o?l("span",{children:o}):null]})]})}var qb=["today","yesterday","lastWeek","older"];function zb(e,t){let n=Date.parse(t);if(!Number.isFinite(n))return"older";let r=Math.floor((S_(e)-S_(n))/(1440*60*1e3));return r<=0?"today":r===1?"yesterday":r<7?"lastWeek":"older"}function k_(e,t){let n=new Map;for(let r of t){let o=zb(e,r.lastMessageAt),a=n.get(o);a?a.push(r):n.set(o,[r])}return qb.filter(r=>n.has(r)).map(r=>({bucket:r,conversations:n.get(r)}))}function S_(e){let t=new Date(e);return t.setUTCHours(0,0,0,0),t.getTime()}var w_=Z.scope("history"),jb=3,Vb=6,Wb={today:"dateToday",yesterday:"dateYesterday",lastWeek:"dateLastWeek",older:"dateOlder"};function C_(e,t){let n=t.type!=="upsert"||t.activity===!0;if(t.type==="snapshot"&&t.result.pagination.page===1&&e.pagination.page>1){let o=dn(e.conversations.slice(0,t.result.pagination.limit),t,n);if(t.result.conversations.length===0){if(o.length===0)return t.result;let p=Math.max(t.result.pagination.total,o.length);return{...t.result,conversations:o,pagination:{...t.result.pagination,total:p,totalPages:Math.ceil(p/t.result.pagination.limit)}}}let a=new Set(o.map(p=>p.conversationId)),i=e.conversations.slice(t.result.pagination.limit).filter(p=>!a.has(p.conversationId)),s=e.pagination.page,c={...t.result.pagination,page:s,hasPrev:s>1,hasNext:s<t.result.pagination.totalPages};return{conversations:[...o,...i],pagination:c}}let r=dn(e.conversations,t,n);return r===e.conversations?e:{...t.type==="snapshot"?t.result:e,conversations:r}}function Gb(e,t,n){let r=Date.parse(e);return Number.isFinite(r)?new Date(r).toDateString()===new Date(t).toDateString()?new Intl.DateTimeFormat(n,{hour:"numeric",minute:"2-digit"}).format(r):t-r<10080*60*1e3?new Intl.DateTimeFormat(n,{weekday:"short"}).format(r):new Intl.DateTimeFormat(n,{month:"short",day:"numeric"}).format(r):""}function ci({transport:e,strings:t,locale:n,persistence:r,onSelect:o,onNewConversation:a}){let i=M.cssPrefix,s=e.peekConversations({limit:50}),[c,p]=H(s?"loaded":"loading"),[_,d]=H(s),[u,f]=H(!1),m=D(void 0),v=_?.conversations??[],y=_?.pagination;$(()=>{let h=!1,b=!0,w=[],A=e.subscribeConversationChanges(E=>{b&&w.push(E),d(N=>N&&C_(N,E))});m.current=void 0,f(!1);let R=e.peekConversations({limit:50});return d(R),p(R?"loaded":"loading"),e.listConversations({limit:50}).then(E=>{if(h)return;let N=E;for(let j of w)N=C_(N,j);w=[],b=!1,d(N),p("loaded"),r.saveHistoryCount(N.conversations.length)}).catch(E=>{h||(w=[],b=!1,w_.warn("listConversations failed",{err:E}),p("error"))}),()=>{h=!0,A(),m.current=void 0}},[e,r,n]);async function x(){if(m.current||!y?.hasNext)return;let h={};m.current=h,f(!0);try{let b=await e.listConversations({page:y.page+1,limit:y.limit});if(m.current!==h)return;d(w=>{if(!w)return w;let A=new Set(w.conversations.map(N=>N.conversationId)),R=b.conversations.filter(N=>A.has(N.conversationId)?!1:(A.add(N.conversationId),!0)),E={conversations:[...w.conversations,...R],pagination:b.pagination};return r.saveHistoryCount(E.conversations.length),E})}catch(b){if(m.current!==h)return;w_.warn("listConversations page failed",{err:b,page:y.page+1})}finally{m.current===h&&(m.current=void 0,f(!1))}}let P=a?l("div",{class:`${i}-history-footer`,children:l("button",{type:"button",class:`${i}-history-new`,onClick:a,"data-testid":L.sidebarNewConversation,children:[l(hp,{}),t.newConversation]})}):null;if(c==="loading"){let h=Math.min(r.loadHistoryCount()??jb,Vb);return l(ue,{children:[l("div",{class:`${i}-history`,"aria-busy":"true","aria-label":t.historyLoading,children:l("div",{class:`${i}-history-group`,"aria-hidden":"true",children:[l("div",{class:`${i}-history-heading`,children:l("span",{class:`${i}-skeleton ${i}-skeleton-heading`})}),l("div",{class:`${i}-history-card`,children:Array.from({length:Math.max(1,h)},(b,w)=>l("div",{class:`${i}-history-item ${i}-history-item-skeleton`,children:[l("span",{class:`${i}-history-avatar ${i}-skeleton`}),l("span",{class:`${i}-history-body`,children:[l("span",{class:`${i}-history-row`,children:[l("span",{class:`${i}-history-title`,children:l("span",{class:`${i}-skeleton ${i}-skeleton-title`})}),l("span",{class:`${i}-history-time`,children:l("span",{class:`${i}-skeleton ${i}-skeleton-time`})})]}),l("span",{class:`${i}-history-row`,children:l("span",{class:`${i}-history-preview`,children:l("span",{class:`${i}-skeleton ${i}-skeleton-preview`})})})]})]},w))})]})}),P]})}if(c==="error"||v.length===0)return l(ue,{children:[l("div",{class:`${i}-history-empty`,children:t.historyEmpty}),P]});let k=Date.now(),g=k_(k,v);return l(ue,{children:[l("div",{class:`${i}-history`,role:"list",children:[g.map(h=>l("div",{class:`${i}-history-group`,children:[l("div",{class:`${i}-history-heading`,children:t[Wb[h.bucket]]}),l("div",{class:`${i}-history-card`,children:h.conversations.map(b=>l("div",{role:"listitem",children:l("button",{type:"button",class:`${i}-history-item`,onClick:()=>o(b),"data-closed":b.canContinue?void 0:"true","data-unread":b.hasUnread?"true":void 0,"data-testid":ft(L.historyItem,b.conversationId),children:[l("span",{class:`${i}-history-avatar`,"aria-hidden":"true",children:l(hl,{})}),l("span",{class:`${i}-history-body`,children:[l("span",{class:`${i}-history-row`,children:[l("span",{class:`${i}-history-title`,children:b.title}),l("span",{class:`${i}-history-time`,children:Gb(b.lastMessageAt,k,n)})]}),l("span",{class:`${i}-history-row`,children:[l("span",{class:`${i}-history-preview`,children:b.preview&&ri(b.preview)||(b.canContinue?t.historyContinue:t.conversationClosed)}),b.hasUnread?l("span",{class:`${i}-history-dot`}):null]})]})]})},b.conversationId))})]},h.bucket)),y?.hasNext?l("div",{class:`${i}-history-more`,children:l("button",{type:"button",onClick:x,disabled:u,"aria-busy":u,"data-testid":L.historyLoadMore,children:t.loadMoreConversations})}):null]}),P]})}var Kb=M.cssPrefix;function T_({visible:e,strings:t}){return e?l("div",{class:`${Kb}-dropzone`,role:"status","aria-live":"polite",children:t.dropZone}):null}var Qb=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Xb=/^https?:\/\/[^\s.]+\.[^\s]+$/i,Jb=/^[+]?[\d\s().-]{6,}$/;function Lr(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??`{${r}}`))}function Yb(e){return Array.isArray(e)?e.length:e?.trim()?1:0}function Zb(e,t,n){let r=e.required??!0,o=e.validation;if(e.type==="multiselect"){let i=Yb(t);return r&&i===0?n.formRequired:i===0?void 0:o?.minSelections!=null&&i<o.minSelections?Lr(n.formChooseAtLeast,{min:o.minSelections}):o?.maxSelections!=null&&i>o.maxSelections?Lr(n.formChooseAtMost,{max:o.maxSelections}):void 0}let a=typeof t=="string"?t.trim():"";if(!a)return r?n.formRequired:void 0;switch(e.type){case"email":if(!Qb.test(a))return n.formInvalidEmail;break;case"url":if(!Xb.test(a))return n.formInvalidUrl;break;case"tel":if(!Jb.test(a))return n.formInvalidTel;break;case"number":{let i=Number(a);if(!Number.isFinite(i))return n.formInvalidNumber;if(o?.min!=null&&i<o.min)return Lr(n.formNumberTooSmall,{min:o.min});if(o?.max!=null&&i>o.max)return Lr(n.formNumberTooLarge,{max:o.max});break}default:break}if(o?.minLength!=null&&a.length<o.minLength)return Lr(n.formTooShort,{min:o.minLength});if(o?.maxLength!=null&&a.length>o.maxLength)return Lr(n.formTooLong,{max:o.maxLength});if(o?.pattern)try{if(!new RegExp(o.pattern).test(a))return n.formPatternMismatch}catch{}}function R_(e,t,n){let r={};for(let o of e){let a=Zb(o,t[o.name],n);a&&(r[o.name]=a)}return r}function I_(e){let t={};for(let[n,r]of Object.entries(e)){let o=Array.isArray(r)?r.join(", "):r;o.trim()&&(t[n]=o.trim())}return t}var Ue=M.cssPrefix,To="__other__";function Ro({fields:e,strings:t,submitLabel:n,onSubmit:r,skipLabel:o,onSkip:a,footerHint:i,submitOnEnter:s,disabled:c,initialValues:p,hideActions:_,fieldTypeLabels:d,rootTestId:u,submitTestId:f,skipTestId:m}){let[v,y]=H(()=>({...ry(e),...p})),[x,P]=H({}),[k,g]=H({});function h(E){k[E]&&g(N=>({...N,[E]:""}))}function b(E,N){y(j=>({...j,[E]:N})),h(E)}function w(E,N){P(j=>({...j,[E]:N})),h(E)}function A(E){if(E.preventDefault(),c)return;let N=oy(e,v,x),j=R_(e,N,t);if(Object.keys(j).length>0){g(j);return}r(I_(N))}function R(E){!s||E.key!=="Enter"||E.shiftKey||E.isComposing||!E.target||!("tagName"in E.target)||E.target.tagName!=="TEXTAREA"||A(E)}return l("form",{class:`${Ue}-form`,onSubmit:A,onKeyDown:R,"data-testid":u,noValidate:!0,children:[e.map(E=>l(ey,{field:E,value:v[E.name],otherText:x[E.name]??"",error:k[E.name],disabled:c,typeLabel:d?.[E.name],strings:t,onChange:N=>b(E.name,N),onOtherChange:N=>w(E.name,N)},E.name)),_?null:l("div",{class:`${Ue}-form-actions`,children:[i?l("span",{class:`${Ue}-form-hint`,children:i}):null,o&&a?l("button",{type:"button",class:`${Ue}-form-skip`,onClick:a,disabled:c,"data-testid":m,children:o}):null,l("button",{type:"submit",class:`${Ue}-form-submit`,disabled:c,"data-testid":f,children:n})]})]})}function ey({field:e,value:t,otherText:n,error:r,disabled:o,typeLabel:a,strings:i,onChange:s,onOtherChange:c}){let p=ft(L.formField,e.name),_=ty({field:e,value:t,otherText:n,disabled:o,strings:i,onChange:s,onOtherChange:c,fieldTid:p});return l("label",{class:`${Ue}-field`,"data-field":e.name,"data-invalid":r?"true":void 0,children:[l("span",{class:`${Ue}-field-head`,children:[l("span",{class:`${Ue}-field-label`,children:[e.label,e.required??!0?l("span",{class:`${Ue}-field-req`,"aria-hidden":"true",children:" *"}):null]}),a?l("span",{class:`${Ue}-field-type`,children:a}):null]}),_,e.validationHint&&!r?l("span",{class:`${Ue}-field-hint`,children:e.validationHint}):null,r?l("span",{class:`${Ue}-field-error`,role:"alert",children:r}):null]})}function ty(e){let{field:t,value:n,otherText:r,disabled:o,strings:a,onChange:i,onOtherChange:s,fieldTid:c}=e,p=typeof n=="string"?n:"",_=t.type==="select"?a.formOtherPlaceholder:t.placeholder??a.formOtherPlaceholder,d=t.allowOther&&p===To?l("input",{class:`${Ue}-field-input`,value:r,placeholder:_,disabled:o,onInput:f=>s(f.currentTarget.value)}):null;switch(t.type){case"textarea":return l("textarea",{class:`${Ue}-field-input`,rows:3,value:p,placeholder:t.placeholder,disabled:o,onInput:f=>i(f.currentTarget.value),"data-testid":c});case"select":return l(ue,{children:[l("select",{class:`${Ue}-field-input`,value:p,disabled:o,onChange:f=>i(f.currentTarget.value),"data-testid":c,children:[l("option",{value:"",children:t.placeholder??"\u2014"}),(t.options??[]).map(f=>l("option",{value:f.value,children:f.label??f.value},f.value)),t.allowOther?l("option",{value:To,children:a.formOther}):null]}),d]});case"radio":return l("div",{class:`${Ue}-field-choices`,role:"radiogroup","data-testid":c,children:[(t.options??[]).map(f=>l("label",{class:`${Ue}-choice`,children:[l("input",{type:"radio",name:`${Ue}-${t.name}`,checked:p===f.value,disabled:o,onChange:()=>i(f.value)}),l("span",{children:f.label??f.value})]},f.value)),t.allowOther?l("label",{class:`${Ue}-choice`,children:[l("input",{type:"radio",name:`${Ue}-${t.name}`,checked:p===To,disabled:o,onChange:()=>i(To)}),l("span",{children:a.formOther})]}):null,d]});case"checkbox":return l("label",{class:`${Ue}-choice`,children:[l("input",{type:"checkbox",checked:p==="true",disabled:o,onChange:f=>i(f.currentTarget.checked?"true":""),"data-testid":c}),l("span",{children:t.placeholder??t.label})]});case"multiselect":{let m=function(v,y){return i(y?[...f,v]:f.filter(x=>x!==v))};var u=m;let f=Array.isArray(n)?n:[];return l("div",{class:`${Ue}-field-choices`,"data-testid":c,children:[(t.options??[]).map(v=>l("label",{class:`${Ue}-choice`,children:[l("input",{type:"checkbox",checked:f.includes(v.value),disabled:o,onChange:y=>m(v.value,y.currentTarget.checked)}),l("span",{children:v.label??v.value})]},v.value)),t.allowOther||(t.options??[]).length===0?l("textarea",{class:`${Ue}-field-input`,rows:2,value:r,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:o,onInput:v=>s(v.currentTarget.value)}):null]})}default:return l("input",{...ny(t.type),class:`${Ue}-field-input`,value:p,placeholder:t.placeholder,disabled:o,onInput:f=>i(f.currentTarget.value),"data-testid":c})}}function ny(e){switch(e){case"number":return{type:e};case"email":return{type:e};case"tel":return{type:e};case"url":return{type:e};case"date":case"time":return{type:e};default:return{type:"text"}}}function ry(e){let t={};for(let n of e)n.defaultValue!=null&&(t[n.name]=n.type==="multiselect"?n.defaultValue.split(",").map(r=>r.trim()).filter(Boolean):n.defaultValue);return t}function oy(e,t,n){let r={...t};for(let o of e){let a=n[o.name]?.trim();if((o.type==="radio"||o.type==="select")&&o.allowOther&&t[o.name]===To)r[o.name]=a??"";else if(o.type==="multiselect"&&a){let i=a.split(/[,\n;]+/).map(c=>c.trim()).filter(Boolean),s=t[o.name];r[o.name]=[...Array.isArray(s)?s:[],...i]}}return r}var en=M.cssPrefix;function Cl({form:e,strings:t,onSubmit:n,onSkip:r}){return l("div",{class:`${en}-form-gate`,"data-testid":L.formGate,children:[e.title?l("h3",{class:`${en}-form-gate-title`,children:e.title}):null,e.description?l("p",{class:`${en}-form-gate-desc`,children:e.description}):null,l(Ro,{fields:e.fields,strings:t,submitLabel:e.submitLabel??t.formSubmit,onSubmit:n,skipLabel:e.skippable?t.formSkip:void 0,onSkip:e.skippable?r:void 0,submitTestId:L.formSubmit,skipTestId:L.formSkip})]})}function E_({marker:e,strings:t,onFill:n}){let r=e.outcome==="skipped",o=r?t.formSkipped:t.formSubmitted,a=e.title?l(ue,{children:[l("span",{children:e.title}),l("span",{class:`${en}-sr-only`,children:o})]}):l("span",{children:o}),i=e.form?.reviewable??!1,s=!r&&i&&e.values&&Object.keys(e.values).length>0?e.values:null;if(s){let p=function(_){return e.form?.fields.find(d=>d.name===_)?.label??_};var c=p;return l("details",{class:`${en}-form-done`,"data-outcome":e.outcome,"data-testid":L.formDone,children:[l("summary",{class:`${en}-form-done-summary`,"data-testid":L.formDoneToggle,children:[l(Yn,{}),a,l(Cr,{})]}),l("dl",{class:`${en}-form-answers`,"data-testid":L.formAnswers,children:Object.entries(s).map(([_,d])=>l("div",{class:`${en}-form-answer`,children:[l("dt",{children:p(_)}),l("dd",{children:d})]},_))})]})}return l("div",{class:`${en}-form-done`,"data-outcome":e.outcome,"data-testid":L.formDone,role:"status",children:[r?l(Lp,{}):l(Yn,{}),a,r&&e.form?.reopenable&&n?l("button",{type:"button",class:`${en}-form-done-fill`,"data-testid":L.formFill,onClick:n,children:t.formFillOut}):null]})}var A_=Object.assign;function sy(e,t){for(var n in e)if(n!="__source"&&e[n]!==t[n])return!0;for(var r in t)if(r!="__source"&&!(r in e))return!0;return!1}var ly=/^(-|f[lo].*[^se]$|g.{5,}[^ps]$|z|o[pr]|(W.{5})?[lL]i.*(t|mp)$|an|(bo|s).{4}Im|sca|m.{6}[ds]|ta|c.*[st]$|wido|ini|asp|fill|st)/;function N_(e,t){function n(o){var a=this.props.ref;return a!=o.ref&&a&&(typeof a=="function"?a(null):a.current=null),t?!t(this.props,o)||a!=o.ref:sy(this.props,o)}function r(o){return this.shouldComponentUpdate=n,kn(e,o)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.type=e,r}var cy=Symbol.for("react.element"),uy=/^(?: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]/,dy=/[A-Z0-9]/g,py=typeof document<"u";var _y=function(e){return/fil|che|rad/.test(e)};Ht.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Ht.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var M_=me.event;me.event=function(e){return M_&&(e=M_(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var fy={configurable:!0,get:function(){return this.class}},L_=me.vnode;me.vnode=function(e){if(typeof e.type=="string")(function(r){var o=r.props,a=r.type,i={},s=a.indexOf("-")==-1;for(var c in o){var p=o[c];if(!(c=="value"&&"defaultValue"in o&&p==null||py&&c=="children"&&a=="noscript"||c=="class"||c=="className")){if(c=="style"&&p&&p.constructor==Object){var _=void 0;for(var d in p)typeof p[d]!="number"||ly.test(d)||(_||(_=p=A_({},p)),p[d]+="px")}else if(c=="defaultValue"&&"value"in o&&o.value==null)c="value";else if(c=="download"&&p===!0)p="";else if(c=="translate"&&p==="no")p=!1;else if(c[0]=="o"&&c[1]=="n"){var u=c.toLowerCase();u=="ondoubleclick"?c="ondblclick":u!="onchange"||a!="input"&&a!="textarea"||_y(o.type)?u=="onfocus"?c="onfocusin":u=="onblur"&&(c="onfocusout"):u=c="oninput",u=="oninput"&&i[c=u]&&(c="oninputCapture")}else s&&uy.test(c)?c=c.replace(dy,"-$&").toLowerCase():p===null&&(p=void 0);i[c]=p}}a=="select"&&(i.multiple&&Array.isArray(i.value)&&(i.value=ua(o.children).forEach(function(f){f.props.selected=i.value.indexOf(f.props.value)!=-1})),i.defaultValue!=null&&(i.value=ua(o.children).forEach(function(f){f.props.selected=i.multiple?i.defaultValue.indexOf(f.props.value)!=-1:i.defaultValue==f.props.value}))),o.class&&!o.className?(i.class=o.class,Object.defineProperty(i,"className",fy)):o.className&&(i.class=i.className=o.className),r.props=i})(e);else if(typeof e.type=="function"&&("ref"in e.props&&"prototype"in e.type&&e.type.prototype.render&&(e.ref=e.props.ref,delete e.props.ref),e.type.defaultProps)){var t=A_({},e.props);for(var n in e.type.defaultProps)t[n]===void 0&&(t[n]=e.type.defaultProps[n]);e.props=t}e.ref&&!("ref"in e.props)&&Object.defineProperty(e.props,"ref",{value:e.ref,configurable:!0,writable:!0}),e.$$typeof=cy,L_&&L_(e)};var ui=M.cssPrefix;function O_({messageId:e,initial:t,strings:n,onFeedback:r}){let[o,a]=H(t);$(()=>a(t),[e,t]);function i(s){let c=o===s?null:s;a(c),r(e,c)}return l("div",{class:`${ui}-feedback`,role:"group","data-testid":L.messageFeedback,children:[l("button",{type:"button",class:`${ui}-msg-action`,"data-active":o==="up"?"true":void 0,"aria-pressed":o==="up","aria-label":n.feedbackUp,title:n.feedbackUp,onClick:()=>i("up"),"data-testid":L.feedbackUp,children:l(zp,{})}),l("button",{type:"button",class:`${ui}-msg-action`,"data-active":o==="down"?"true":void 0,"aria-pressed":o==="down","aria-label":n.feedbackDown,title:n.feedbackDown,onClick:()=>i("down"),"data-testid":L.feedbackDown,children:l(jp,{})}),l("span",{class:`${ui}-sr-only`,role:"status","aria-live":"polite",children:o?n.feedbackThanks:""})]})}var jt=M.cssPrefix;function Tl(e){let t=e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim().toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}function Nr(e){if(e.startsWith("tool:")||e.startsWith("tool-"))return e.slice(5);let t=e.indexOf("__"),n=e.slice(t+2);return t>0&&n?`${Tl(e.slice(0,t))} \xB7 ${Tl(n)}`:e}function Io(e){let t=e.indexOf("__"),n=e.slice(t+2);return t>0&&n?Tl(n):Nr(e)}function di(e,t){let n=e==="output-available"||e==="output-error"||e==="output-denied",r=e==="approval-responded"||t?.approved!==void 0;return{terminal:n,responded:r,decided:n||r}}function Il({status:e,icon:t,label:n}){return l("span",{class:`${jt}-toolui-badge ${jt}-toolui-status`,"data-status":e,children:[l("span",{class:`${jt}-toolui-status-icon`,children:t}),n]})}function my(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 Eo(e,t,n={}){return n.submitted?"responded":n.incomplete?"incomplete":vy(my(e,t),n.superseded,n.live??!0,n.stopped??!1)}function gy({status:e}){return e==="stopped"?l(pn,{}):e==="denied"||e==="error"||e==="superseded"||e==="incomplete"?l(Rr,{}):e==="completed"||e==="responded"?l(Tr,{}):l(Vp,{})}function hy(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;case"incomplete":return t.statusIncomplete;case"stopped":return t.statusStopped;default:return t.statusRunning}}function vy(e,t,n,r){return t&&(e==="awaiting"||e==="running")?"superseded":r&&(e==="running"||e==="responded")?"stopped":!n&&e==="running"?"error":e}function by({state:e,approval:t,strings:n,superseded:r,live:o=!0,submitted:a=!1,incomplete:i=!1,stopped:s=!1}){let c=Eo(e,t,{superseded:r,live:o,submitted:a,incomplete:i,stopped:s});return l(Il,{status:c,icon:l(gy,{status:c}),label:hy(c,n)})}function yy({name:e,state:t,approval:n,strings:r,superseded:o,live:a,submitted:i,incomplete:s,stopped:c}){return l(ue,{children:[l("span",{class:`${jt}-toolui-name-pill`,children:[l(Ya,{}),l("span",{class:`${jt}-toolui-name-text`,children:e})]}),l(by,{state:t,approval:n,strings:r,superseded:o,live:a,submitted:i,incomplete:s,stopped:c}),l("span",{class:`${jt}-toolui-chevron`,children:l(Kt,{})})]})}function pi({part:e,strings:t,testid:n,superseded:r,live:o,submitted:a,incomplete:i,stopped:s,open:c}){let p=le(()=>he(()=>e.inputSig.value),[e]),_=le(()=>he(()=>e.outputSig.value),[e]),d=le(()=>he(()=>e.errorSig.value),[e]),u=le(()=>he(()=>e.stateSig.value),[e]),f=le(()=>he(()=>e.approvalSig.value),[e]),m=le(()=>he(()=>Vt(e.toolMetadata)&&ra(e.errorSig.value)),[e]),v=i===!0||m.value;return l("details",{class:`${jt}-toolui ${jt}-toolui-collapsible`,"data-testid":n,open:c||void 0,children:[l("summary",{class:`${jt}-toolui-head`,children:l(yy,{name:Nr(e.toolName),state:u.value,approval:f.value,strings:t,superseded:r,live:o,submitted:a,incomplete:v,stopped:s})}),l(er,{label:t.toolParameters,value:p.value}),_.value!==void 0?l(er,{label:t.toolResult,value:_.value}):null,d.value&&!v?l(er,{label:t.statusError,value:d.value,error:!0}):null]})}function er({label:e,value:t,error:n}){let r=n?typeof t=="string"?t:"":Rl($_(t));return r?l("div",{class:`${jt}-toolui-section`,children:[l("span",{class:`${jt}-toolui-label`,children:e}),l("pre",{class:`${jt}-toolui-code`,"data-error":n?"true":void 0,children:r})]}):null}function _i(e){return!!Rl(e.inputSig.value)||!!e.errorSig.value||!!Rl($_(e.outputSig.value))}function $_(e){if(e&&typeof e=="object"){let t=e;if(t.storage==="tool-result-ref"&&"summary"in t)return t.summary}return e}function Rl(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 D_(e){return e.partsSig.value.some(t=>t.kind==="text"&&t.textSig.value.length>0)}function F_(e){return e.partsSig.value.some(t=>t.kind==="reasoning")}function Py(e){return e.streaming&&!e.bufferedHold&&!(e.reasoningVisible&&e.working)}function B_(e){let{streaming:t,reasoningVisible:n,emptyReply:r,hidden:o}=e,a=e.responseMode==="buffered"&&t,i=t&&!e.hasAnswerText;return{streaming:t,bufferedHold:a,reasoningVisible:n,working:i,showStreamDots:Py({streaming:t,bufferedHold:a,reasoningVisible:n,working:i}),emptyReply:r,hidden:o}}function H_(e,t){let n=e.stateSig.value,r=e.approvalSig.value,{terminal:o,responded:a,decided:i}=di(n,r),s=t.continuationStreaming===!0&&!i,c=t.superseded&&!i&&!s;return{pill:Eo(n,r,{superseded:c,live:t.live,submitted:s,incomplete:Vt(e.toolMetadata)&&ra(e.errorSig.value),stopped:t.stopped}),state:n,terminal:o,decided:i||s,showApproveReject:!i&&!t.superseded&&!s,showAnswered:a&&!o&&!c,showSubmitted:s,showEdit:a&&t.active&&!o,skipped:c,answeredApproved:r?.approved}}var Or=M.cssPrefix;function U_({part:e,strings:t}){let n=e.title||e.filename||e.url||t.sources;return e.url?l("a",{class:`${Or}-source`,href:e.url,target:"_blank",rel:"noreferrer noopener","data-testid":L.source,children:[l("span",{class:`${Or}-source-icon`,"aria-hidden":"true",children:"\u{1F517}"}),l("span",{class:`${Or}-source-label`,children:n})]}):l("span",{class:`${Or}-source`,"data-testid":L.source,children:[l("span",{class:`${Or}-source-icon`,"aria-hidden":"true",children:"\u{1F4C4}"}),l("span",{class:`${Or}-source-label`,children:n})]})}var Mt=M.cssPrefix,xy=4;function Sy(e){return!e||typeof e!="object"||Array.isArray(e)?[]:Object.entries(e).flatMap(([t,n])=>typeof n=="string"?n.trim()?[{key:t,value:n.trim()}]:[]:typeof n=="number"||typeof n=="boolean"?[{key:t,value:String(n)}]:[]).slice(0,xy)}function q_({part:e,strings:t,active:n,superseded:r=!1,continuationStreaming:o=!1,stopped:a=!1,onDecision:i,onEdit:s}){let c=le(()=>he(()=>e.approvalSig.value),[e]),p=le(()=>he(()=>H_(e,{active:n,superseded:r,continuationStreaming:o,stopped:a})),[e,n,r,o,a]).value,{terminal:_,showApproveReject:d,showAnswered:u,showSubmitted:f,showEdit:m,skipped:v}=p,y=Nr(e.toolName),x=p.answeredApproved,P=e.toolCallId,k=Sy(e.inputSig.value),g=l(ue,{children:[l("p",{class:`${Mt}-toolui-prompt`,children:t.approvalPrompt.replace("{tool}",y)}),k.length>0?l("dl",{class:`${Mt}-toolui-fields`,"data-testid":L.toolApprovalFields,children:k.map(({key:b,value:w})=>l("div",{children:[l("dt",{children:b}),l("dd",{title:w,children:w})]},b))}):null,l("p",{class:`${Mt}-toolui-subtle`,children:t.approvalBody})]});f?g=l("p",{class:`${Mt}-toolui-subtle`,children:t.approvalSubmitting}):u&&x!==!1?g=l(ue,{children:[l("p",{class:`${Mt}-toolui-prompt`,children:[t.approvalYourResponse.replace("{decision}",x?t.approve:t.reject),c.value?.reason?` \u2014 ${c.value.reason}`:""]}),m?l("p",{class:`${Mt}-toolui-subtle`,children:t.approvalEditHint}):null,m?null:l("p",{class:`${Mt}-toolui-subtle`,children:t.approvalSubmitting})]}):u&&(g=l(ue,{}));let h=d||f||m||u&&x!==!1;return l("div",{class:`${Mt}-toolui-group`,"data-testid":p.decided?L.toolDecision:L.toolApproval,children:[l(pi,{part:e,strings:t,superseded:v,submitted:f,stopped:a,open:d}),v||_||!h?null:l("div",{class:`${Mt}-toolui ${Mt}-toolui-body`,children:[g,d?l("div",{class:`${Mt}-toolui-actions`,children:[l("button",{type:"button",class:`${Mt}-form-skip`,disabled:!n,onClick:()=>i(P,!1),"data-testid":L.toolReject,children:t.reject}),l("button",{type:"button",class:`${Mt}-form-submit`,disabled:!n,onClick:()=>i(P,!0),"data-testid":L.toolApprove,children:t.approve})]}):null,m?l("div",{class:`${Mt}-toolui-actions`,children:l("button",{type:"button",class:`${Mt}-form-skip`,onClick:()=>s(P),"data-testid":L.toolEdit,children:t.edit})}):null]})]})}var ky=["text","email","phone","number","date","single-select","multi-select","boolean"];function z_(e){return e!==null&&typeof e=="object"}function j_(e){let t=z_(e)?e:{},r=(Array.isArray(t.questions)?t.questions:[]).map(wy).filter(o=>o!==null);return{intro:fi(t.intro),questions:r}}function wy(e,t){if(!z_(e))return null;let n=ky.find(r=>r===e.type)??"text";return{key:fi(e.key)??`q${t+1}`,question:fi(e.question)??"Please provide the missing information.",type:n,options:Array.isArray(e.options)?e.options.filter(r=>typeof r=="string"&&r.trim().length>0):void 0,required:typeof e.required=="boolean"?e.required:void 0,helpText:fi(e.helpText)}}function Cy(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 El(e,t,n){return e.questions.map(r=>{let o=Cy(r.type),a=r.type==="boolean"?[{value:"yes",label:t},{value:"no",label:n}]:(r.options??[]).map(i=>({value:i,label:i}));return{name:r.key,label:r.question,type:o,required:r.required??!1,options:a.length>0?a:void 0,validationHint:r.helpText}})}function fi(e){return typeof e=="string"&&e.trim()?e.trim():void 0}var rt=M.cssPrefix;function Ty({skipped:e,submitted:t,strings:n}){return e?{status:"superseded",statusLabel:n.inputSkipped}:t?{status:"responded",statusLabel:n.statusResponded}:{status:"completed",statusLabel:n.inputAnswered}}var Ry={text:"qtypeText",email:"qtypeEmail",phone:"qtypePhone",number:"qtypeNumber",date:"qtypeDate","single-select":"qtypeChooseOne","multi-select":"qtypeChooseAny",boolean:"qtypeBoolean"};function V_(e,t){let n={};for(let r of e)n[r.key]=t[Ry[r.type]];return n}function W_({part:e,strings:t,active:n,superseded:r=!1,continuationStreaming:o=!1,onDecision:a,onEdit:i}){let s=le(()=>he(()=>e.stateSig.value),[e]).value,c=le(()=>he(()=>e.approvalSig.value),[e]).value,p=le(()=>he(()=>j_(e.inputSig.value)),[e]).value,{terminal:_,decided:d}=di(s,c),u=d&&c?.approved===!0,f=o&&!d,m=!d&&!r&&!f,v=!m&&!u&&!f,y=u&&n&&!_,x=p.questions,[P,k]=H(null),h=P??(m||u||f),[b,w]=H(!1),A=x.length>1?gl:Po,R=m?t.inputRequired:t.inputBadge,E=f?l("p",{class:`${rt}-toolui-subtle`,children:t.approvalSubmitting}):m?l(Iy,{req:p,strings:t,active:n,resolve:(B,V)=>a(e.toolCallId,V,B)}):b?l(Ro,{fields:El(p,t.confirmYes,t.confirmNo),strings:t,submitLabel:t.inputSubmit,onSubmit:()=>{},disabled:!0,hideActions:!0,fieldTypeLabels:V_(x,t),initialValues:u?Ny(x,c?.reason):void 0}):l(Ey,{questions:x,answers:u?Ly(c?.reason):{},strings:t}),{status:N,statusLabel:j}=Ty({skipped:v,submitted:f,strings:t});return l("details",{class:`${rt}-toolui ${rt}-toolui-collapsible${r?` ${rt}-toolui-stale`:""}`,open:h,onToggle:B=>{let V=B.currentTarget.open;V!==h&&k(V)},"data-testid":m?L.toolAskQuestions:L.toolDecision,children:[l("summary",{class:`${rt}-toolui-head`,children:[l("span",{class:`${rt}-toolui-q-pill`,children:[l(A,{}),R]}),l("span",{class:`${rt}-toolui-head-end`,children:[m?null:l(Il,{status:N,icon:v?l(Rr,{}):l(Tr,{}),label:j}),l("span",{class:`${rt}-toolui-chevron`,children:l(Kt,{})})]})]}),l("div",{class:`${rt}-toolui-collapse-body`,children:[p.intro?l("div",{class:`${rt}-toolui-desc`,children:p.intro}):null,E,m||f?null:l("div",{class:`${rt}-toolui-footer`,children:[l("button",{type:"button",class:`${rt}-toolui-options-toggle`,onClick:()=>w(B=>!B),"data-testid":L.toolAskOptions,children:[l("span",{class:`${rt}-toolui-options-chevron${b?` ${rt}-open`:""}`,children:l(Kt,{})}),b?t.hideOptions:t.showOptions]}),y?l("button",{type:"button",class:`${rt}-form-skip`,onClick:()=>i(e.toolCallId),"data-testid":L.toolEdit,children:t.edit}):null]})]})]})}function Iy({req:e,strings:t,active:n,resolve:r}){let o=El(e,t.confirmYes,t.confirmNo),a=e.questions.length===1&&e.questions[0]?.type==="text";return l(Ro,{fields:o,strings:t,disabled:!n,submitLabel:t.inputSubmit,footerHint:a?t.inputSubmitHint:void 0,onSubmit:i=>r(My(e.questions,i),!0),skipLabel:t.inputSkip,onSkip:()=>r(void 0,!1),submitOnEnter:a,fieldTypeLabels:V_(e.questions,t),submitTestId:L.toolInputSubmit,skipTestId:L.toolInputSkip})}function Ey({questions:e,answers:t,strings:n}){return l("div",{class:`${rt}-toolui-summary`,"data-testid":L.toolAskSummary,children:e.map(r=>l("div",{class:`${rt}-field`,children:[l("span",{class:`${rt}-field-head`,children:l("span",{class:`${rt}-field-label`,children:[r.question,r.required?l("span",{class:`${rt}-field-req`,"aria-hidden":"true",children:" *"}):null]})}),l("p",{class:`${rt}-toolui-answer`,children:Ay(r,t[r.key],n)||"\u2014"})]},r.key))})}function Ay(e,t,n){return e.type!=="boolean"?t??"":t==="yes"?n.confirmYes:t==="no"?n.confirmNo:t??""}function My(e,t){let n=e.flatMap(r=>{let o=t[r.key];if(o==null||o.trim()==="")return[];let a=r.type==="multi-select"?o.split(",").map(i=>i.trim()).filter(Boolean):o;return[{key:r.key,value:a}]});return JSON.stringify({answers:n})}function G_(e){if(!e)return{};let n=(()=>{try{return JSON.parse(e)}catch{return}})()?.answers;if(!Array.isArray(n))return{};let r={};for(let o of n)if(o&&typeof o=="object"&&"key"in o){let{key:a,value:i}=o;if(typeof a!="string")continue;typeof i=="string"?r[a]=i:Array.isArray(i)&&(r[a]=i.filter(s=>typeof s=="string"))}return r}function Ly(e){let t=G_(e),n={};for(let[r,o]of Object.entries(t))n[r]=Array.isArray(o)?o.join(", "):o;return n}function Ny(e,t){let n=G_(t),r={};for(let o of e){let a=n[o.key];a!==void 0&&(o.type==="multi-select"?r[o.key]=Array.isArray(a)?a:[a]:r[o.key]=Array.isArray(a)?a[0]??"":a)}return r}function K_({part:e,strings:t,live:n,superseded:r,stopped:o=!1}){let a=Vt(e.toolMetadata);if(!le(()=>he(()=>_i(e)),[e]).value&&!a)return null;let s=e.outputSig.value===void 0&&!e.errorSig.value;return l(pi,{part:e,strings:t,testid:L.toolCall,live:n||a&&!r,incomplete:a&&r&&s,stopped:o})}var de=M.cssPrefix,Oy=200;function mi(e){if(e.kind!=="tool")return!1;let t=e.stateSig.value;return t!=="approval-requested"&&t!=="approval-responded"&&!e.toolMetadata?.card&&!Vt(e.toolMetadata)}function Q_(e,t){let n=[];for(let[r,o]of e.entries()){let a=n.at(-1);if(o.kind==="reasoning"&&t.showReasoning||mi(o)&&_i(o)){a?.kind==="steps"?(a.parts.push(o),a.indices.push(r)):n.push({kind:"steps",parts:[o],indices:[r]});continue}o.kind==="step-start"||o.kind==="reasoning"||o.kind==="source"&&!t.showSources||mi(o)||n.push({kind:"part",part:o,index:r})}return n}function $y(e){if(!(!e||typeof e!="object"))return Object.values(e).find(t=>typeof t=="string"&&t.trim().length>0)?.trim()}function Dy(e,t){let n=[...new Set(t)];if(!(!e||n.length===0||n.some(r=>r<0||r>=e.length)))return n.reduce((r,o)=>r+(e[o]?.durationMs??0),0)}function X_(e){let t=[];for(let n of e)t.push((t.at(-1)??-1)+(n.kind==="step-start"?1:0));return t}function Fy(e,t){return e.streaming?t.thinking:e.reasoningMs===void 0?t.thought:t.thoughtFor.replace("{time}",J_(e.reasoningMs))}function J_(e){if(e<1e4)return`${Number((e/1e3).toFixed(1))} s`;let t=Math.round(e/1e3);return t<60?`${t} s`:`${Math.floor(t/60)} m ${t%60} s`}function By(e){return e.split(`
62
+ `).map(t=>t.trim()).findLast(t=>/^\*\*[^*].*\*\*$/.test(t))?.slice(2,-2).trim()}function Hy(e,t){return e?.kind==="tool"?`${Io(e.toolName)}\u2026`:(e&&By(e.textSig.value))??t.thinking}function Uy(e,t){let n=e.map(s=>s.kind==="tool"?{kind:"tool",part:s,name:Nr(s.toolName),summary:$y(s.inputSig.value),status:Eo(s.stateSig.value,s.approvalSig.value,{live:t.live,stopped:t.stopped})}:{kind:"thought",part:s}),r=n.flatMap(s=>s.kind==="tool"?[s]:[]),o=new Map;for(let s of r)o.set(Io(s.part.toolName),(o.get(Io(s.part.toolName))??0)+1);let a=r.some(s=>s.status==="stopped"),[i]=r;return{tools:[...o].map(([s,c])=>({name:s,count:c})),...r.length===1&&i?{single:{name:Io(i.part.toolName),...i.summary?{summary:i.summary}:{}}}:{},failed:r.filter(s=>s.status==="error").length,...t.stopped&&a?{stopped:{finished:r.filter(s=>s.status!=="stopped").length}}:{},rows:n}}function Y_({parts:e,steps:t=[],stepTimings:n,timed:r=!0,strings:o,live:a,running:i,stopped:s=!1,runStartedAt:c}){let[p,_]=H(!1),[d,u]=H(!1),f=Uy(e,{live:a,stopped:s}),m=e.at(-1),v=le(()=>he(()=>Hy(m,o)),[m,o]).value,y=r?Dy(n,t):void 0;function x(){_(!p),u(!0)}return l("div",{class:`${de}-steps`,"data-testid":L.toolSteps,"data-running":i?"true":void 0,"data-stopped":f.stopped?"true":void 0,children:[l("button",{type:"button",class:`${de}-steps-head`,"aria-expanded":p,onClick:x,children:[l("span",{class:`${de}-steps-icon`,"aria-hidden":"true",children:l(zy,{running:i,stopped:f.stopped!==void 0})}),l("span",{class:`${de}-steps-label`,children:i?l("span",{class:`${de}-steps-live`,children:v}):l(Vy,{view:f,strings:o})}),!i&&f.failed>0?l("span",{class:`${de}-steps-failed`,children:o.toolStepsFailed.replace("{count}",String(f.failed))}):null,i&&c?l(qy,{since:c}):null,!i&&y!==void 0?l("span",{class:`${de}-steps-time`,children:J_(y)}):null,l("span",{class:`${de}-steps-chevron`,"data-open":p?"true":void 0,children:l(Kt,{})})]}),l("span",{class:`${de}-sr-only`,role:"status",children:i?v:""}),l("div",{class:`${de}-steps-body`,"data-open":p?"true":void 0,inert:!p,children:l("div",{class:`${de}-steps-body-inner`,children:d?l("ol",{class:`${de}-steps-list`,children:f.rows.map((P,k)=>P.kind==="tool"?l(Wy,{row:P,strings:o},P.part.toolCallId):l(Al,{part:P.part,current:i&&k===f.rows.length-1,reasoningMs:n?.[t[k]??-1]?.reasoningMs,strings:o},`${P.part.id}#${k}`))}):null})})]})}function qy({since:e}){let[t,n]=H(()=>Date.now());$(()=>{let o=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(o)},[]);let r=Math.max(0,Math.floor((t-Date.parse(e))/1e3));return l("span",{class:`${de}-steps-time`,children:r<60?`${r} s`:`${Math.floor(r/60)} m ${r%60} s`})}function zy({running:e,stopped:t}){return e?l("span",{class:`${de}-loading-spinner`}):t?l(pn,{}):l(Ya,{})}function jy(e,t){return e===0?t.statusStopped:e===1?t.toolStepsStoppedOne:t.toolStepsStopped.replace("{count}",String(e))}function Vy({view:e,strings:t}){return e.stopped?l(ue,{children:jy(e.stopped.finished,t)}):e.single?l(ue,{children:[e.single.name,e.single.summary?l(ue,{children:[l("span",{class:`${de}-steps-sep`,"aria-hidden":"true",children:"\xB7"}),l("span",{class:`${de}-steps-summary`,children:e.single.summary})]}):null]}):l(ue,{children:e.tools.map(({name:n,count:r},o)=>l("span",{class:`${de}-steps-name`,children:[o>0?l("span",{class:`${de}-steps-sep`,"aria-hidden":"true",children:"\xB7"}):null,n,r>1?l("span",{class:`${de}-steps-count`,children:["\xD7",r]}):null]},n))})}function Wy({row:e,strings:t}){let[n,r]=H(!1),{part:o,name:a,summary:i,status:s}=e;return l("li",{class:`${de}-steps-row`,"data-testid":L.toolStep,"data-status":s,children:[l("span",{class:`${de}-steps-row-icon`,"aria-hidden":"true",children:l(Gy,{status:s})}),l("div",{class:`${de}-steps-row-main`,children:[l("button",{type:"button",class:`${de}-steps-row-head`,"aria-expanded":n,onClick:()=>r(!n),children:[l("span",{class:`${de}-steps-row-label`,children:[l("span",{class:`${de}-steps-row-name`,children:a}),i?l("span",{class:`${de}-steps-row-summary`,children:i}):null]}),s==="error"?l("span",{class:`${de}-steps-failed`,children:t.statusError}):null,s==="denied"?l("span",{class:`${de}-steps-denied`,children:t.statusDenied}):null,s==="stopped"?l("span",{class:`${de}-steps-denied`,children:t.statusStopped}):null,l("span",{class:`${de}-steps-chevron`,"data-open":n?"true":void 0,children:l(Kt,{})})]}),n?l("div",{class:`${de}-steps-row-body`,children:[l(er,{label:t.toolParameters,value:o.inputSig.value}),o.outputSig.value!==void 0?l(er,{label:t.toolResult,value:o.outputSig.value}):null,o.errorSig.value?l(er,{label:t.statusError,value:o.errorSig.value,error:!0}):null]}):null]})]})}function Gy({status:e}){return e==="running"?l("span",{class:`${de}-loading-spinner`}):e==="stopped"?l(pn,{}):e==="error"||e==="denied"?l(Rr,{}):l(Tr,{})}function Al({part:e,current:t,reasoningMs:n,strings:r,standalone:o=!1}){let[a,i]=H(!1),s=le(()=>he(()=>e.textSig.value.trim()===""),[e]).value,c=le(()=>he(()=>e.textSig.value.length>Oy),[e]).value,p=Fy({streaming:t,reasoningMs:n},r);return l(o?"div":"li",{class:`${de}-steps-row ${de}-steps-thought`,"data-status":"thought","data-testid":o?L.reasoning:void 0,children:[l("span",{class:`${de}-steps-row-icon`,"aria-hidden":"true",children:l(Wp,{})}),l("div",{class:`${de}-steps-row-main`,children:[l("span",{class:t?`${de}-steps-thought-label ${de}-steps-live`:`${de}-steps-thought-label`,children:p}),s?null:l("div",{class:`${de}-steps-thought-text ${de}-reasoning-body`,"data-clamped":c&&!a?"true":void 0,children:l(So,{textSig:e.textSig,doneSig:e.doneSig})}),c&&!s?l("button",{type:"button",class:`${de}-steps-thought-more`,"aria-expanded":a,onClick:()=>i(!a),children:[a?r.thoughtsShowLess:r.thoughtsShowMore,l("span",{class:`${de}-steps-chevron`,"data-open":a?"true":void 0,children:l(Kt,{})})]}):null]})]})}var Ne=M.cssPrefix,ef=N_(Ky);function Ky({message:e,status:t,strings:n,responseMode:r,showReasoning:o,showToolCalls:a,showSources:i,interactive:s=!1,superseded:c=!1,tool:p,onRetry:_,enableMessageFeedback:d=!1,onFeedback:u,reconnecting:f=!1}){let v=[...le(()=>he(()=>e.partsSig.value),[e]).value];for(let ne of e.attachments??[])!ne.url||v.some(Pe=>Pe.kind==="file"&&Pe.url===ne.url)||v.push({kind:"file",url:ne.url,mediaType:ne.mediaType,filename:ne.name,fileId:ne.id,fileSize:ne.size});let y=le(()=>he(()=>Qn(e)),[e]),x=le(()=>he(()=>D_(e)),[e]),P=le(()=>he(()=>o&&F_(e)),[e,o]),k=le(()=>he(()=>Zd(e,P.value)),[e,P]),g=le(()=>he(()=>!ll(e)),[e]),h=t==="streaming",b=e.role==="assistant"&&h,w=B_({streaming:b,responseMode:r,reasoningVisible:P.value,hasAnswerText:x.value,emptyReply:y.value,hidden:k.value}),{bufferedHold:A,showStreamDots:R}=w;if(w.hidden)return null;let E=Xy(e.createdAt),N=e.role==="assistant"||e.role==="operator",j=d&&!!u&&!!e.serverMessageId&&N&&!h&&t!=="error"&&!y.value,B=h?"":v.filter(ne=>ne.kind==="text").map(ne=>e.role==="assistant"?Fa(ne.textSig.peek()):ne.textSig.peek()).join(`
62
63
 
63
- `).trim(),z=!C&&t!=="error"&&!v.value&&O.length>0,V=a?q_(m,{showReasoning:o,showSources:i}):m.map((G,Y)=>({kind:"part",part:G,index:Y}));function K(G,Y){return l(Mb,{part:G,generativeUi:e.role==="assistant",active:w,live:h,strings:n,showReasoning:o,showToolCalls:a,showSources:i,interactive:s&&t==="complete"&&(G.kind!=="tool"||Ba(e,Y)),superseded:c,continuationStreaming:e.continuationStreaming===!0,tool:p},`${Db(G)}#${Y}`)}let ne=N||z;return l("div",{class:`${Oe}-bubble-row`,"data-role":e.role,"data-testid":dt(L.messageBubble,e.serverMessageId??e.id),children:l("div",{class:`${Oe}-bubble-col`,children:[l("div",{class:`${Oe}-bubble`,children:[e.role==="operator"&&e.operatorInitials?l("span",{class:`${Oe}-bubble-author`,children:e.operatorInitials}):null,l("div",{class:`${Oe}-bubble-body`,children:[k?l(Bb,{label:n.loading}):V.flatMap((G,Y)=>G.kind==="part"?[K(G.part,G.index)]:G.parts.some(De=>De.kind==="tool")?[l(z_,{parts:G.parts,strings:n,live:h,running:h&&Y===V.length-1},`steps#${G.indices[0]}`)]:G.parts.map((De,_e)=>K(De,G.indices[_e]??_e))),T&&l(Fb,{}),t==="error"||v.value?l("div",{class:`${Oe}-error`,role:"alert",children:[l("span",{children:e.errorText??n.errorGeneric}),_?l("button",{type:"button",class:`${Oe}-error-retry`,onClick:()=>_(e),"data-testid":L.messageRetry,children:n.errorRetry}):null]}):null]})]}),A||ne?l("div",{class:`${Oe}-bubble-meta`,children:[A?l("time",{class:`${Oe}-bubble-time`,dateTime:A.iso,title:A.full,children:A.short}):null,ne?l("div",{class:`${Oe}-bubble-actions`,children:[N&&e.serverMessageId?l(T_,{messageId:e.serverMessageId,initial:e.feedback??null,strings:n,onFeedback:u}):null,z?l(Eb,{text:O,strings:n}):null]}):null]}):null]})})}function Eb({text:e,strings:t}){let[n,r]=H(!1);function o(){navigator.clipboard?.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)}).catch(()=>{})}let a=n?t.copied:t.copy;return l("button",{type:"button",class:`${Oe}-msg-action`,"data-active":n?"true":void 0,"aria-label":a,title:a,onClick:o,"data-testid":L.messageCopy,children:n?l(Xn,{}):l($p,{})})}function Ab(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 Mb({part:e,generativeUi:t,active:n,live:r,strings:o,showReasoning:a,showToolCalls:i,showSources:s,interactive:c,superseded:p,continuationStreaming:_,tool:d}){switch(e.kind){case"step-start":return null;case"text":return l(Tr,{textSig:e.textSig,doneSig:e.doneSig,generativeUi:t,strings:o});case"reasoning":return a?l($b,{part:e,active:n,strings:o}):null;case"tool":return l(Ob,{part:e,strings:o,showToolCalls:i,interactive:c,superseded:p,continuationStreaming:_,live:r,tool:d});case"file":return l(Lb,{part:e,strings:o});case"source":return s?l(L_,{part:e,strings:o}):null}}function Lb({part:e,strings:t}){let n=e.filename??t.file;if(e.mediaType.startsWith("image/"))return l("a",{class:`${Oe}-file-image`,href:e.url,target:"_blank",rel:"noreferrer noopener",title:n,"data-testid":L.messageFile,children:l("img",{src:e.url,alt:n,loading:"lazy"})});let r=(n.includes(".")?n.split(".").pop():e.mediaType.split("/").pop())?.toUpperCase(),o=e.fileSize===void 0?void 0:Nb(e.fileSize);return l("a",{class:`${Oe}-file-chip`,href:e.url,target:"_blank",rel:"noreferrer noopener",title:n,"data-testid":L.messageFile,children:[l("span",{class:`${Oe}-file-chip-icon`,"aria-hidden":"true",children:l(Wa,{})}),l("span",{class:`${Oe}-file-chip-text`,children:[l("span",{class:`${Oe}-file-chip-name`,children:n}),l("span",{class:`${Oe}-file-chip-meta`,children:[r,o].filter(Boolean).join(" \xB7 ")})]})]})}function Nb(e){let t=Math.min(Math.floor(Math.log10(Math.max(e,1))/3),2);return new Intl.NumberFormat(void 0,{style:"unit",unit:["byte","kilobyte","megabyte"][t],unitDisplay:"narrow",maximumFractionDigits:1}).format(e/1e3**t)}function Ob({part:e,strings:t,showToolCalls:n,interactive:r,superseded:o,continuationStreaming:a,live:i,tool:s}){let c=ue(()=>Se(()=>e.approvalSig.value!==void 0),[e]);return s?.humanInLoop&&c.value?e.toolMetadata?.card==="questions"?l(F_,{part:e,strings:t,active:r,superseded:o,continuationStreaming:a,onDecision:s.onDecision,onEdit:s.onEdit}):l(N_,{part:e,strings:t,active:r,superseded:o,continuationStreaming:a,onDecision:s.onDecision,onEdit:s.onEdit}):n?l(U_,{part:e,strings:t,live:i,superseded:o}):null}function $b({part:e,active:t,strings:n}){return l("details",{class:`${Oe}-reasoning`,"data-testid":L.reasoning,open:t,"data-active":t?"true":void 0,children:[l("summary",{class:`${Oe}-reasoning-summary`,children:l("span",{class:`${Oe}-reasoning-label`,children:t?n.thinking:n.thoughts})}),l("div",{class:`${Oe}-reasoning-body`,children:l(Tr,{textSig:e.textSig,doneSig:e.doneSig})})]})}function Db(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 Fb(){return l("span",{class:`${Oe}-typing`,"data-testid":L.typingDots,"aria-hidden":"true",children:[l("span",{}),l("span",{}),l("span",{})]})}function Bb({label:e}){return l("span",{class:`${Oe}-loading`,role:"status",children:[l("span",{class:`${Oe}-loading-spinner`,"aria-hidden":"true"}),l("span",{class:`${Oe}-loading-label`,children:e})]})}var En=E.cssPrefix,Cl=120,Ub=350;function V_({messagesSig:e,strings:t,responseMode:n,showReasoning:r,showToolCalls:o,showSources:a,enableMessageFeedback:i,onFeedback:s,loading:c,onLoadPreviousMessages:p,idle:_,controlMode:d="ai-agent",tool:u,onRetry:f,form:m,formMarkers:v,onFillForm:x}){let P=F(null),b=Et(()=>e.value),[C,h]=H(!1),[g,k]=H(!1),w=F(!1),T=F(!1),[A,M]=H(),N=F(!1),O=F(!1),z=F(!1),V=F(0);function K(){return z.current||performance.now()-V.current<Ub}let ne=F(0);function G(y){let U=y.scrollHeight-y.clientHeight>1;y.dataset.fadeTop=U&&y.scrollTop>1?"true":"false",y.dataset.fadeBottom=U&&y.scrollHeight-y.scrollTop-y.clientHeight>1?"true":"false"}function Y(y){return h(y.scrollHeight-y.scrollTop-y.clientHeight>Cl*2)}function De(y){ne.current=performance.now(),y.scrollTop=y.scrollHeight,G(y)}function _e(y,U){De(y);let J=U,ee=0;function ie(){O.current||K()||(De(y),--J>0&&(ee=requestAnimationFrame(ie)))}return U>0&&(ee=requestAnimationFrame(ie)),()=>cancelAnimationFrame(ee)}function Te(y,U){let J,ee,ie,Ie=-1;function Pe(){J.disconnect(),ee.disconnect(),clearTimeout(ie)}function he(){if(O.current||K()||Ie>=0&&y.scrollTop<Ie-4)return Pe();De(y),Ie=y.scrollTop}return J=new ResizeObserver(he),ee=new MutationObserver(he),he(),J.observe(y),ee.observe(y,{childList:!0,subtree:!0,characterData:!0}),ie=setTimeout(Pe,U),Pe}let et=b.value[0]?.id;Rt(()=>{let y=P.current;if(y&&b.value.length!==0&&!T.current&&(N.current=!0,!!b.value.some(U=>U.role==="user")))return Te(y,300)},[et]);let Ue=F(0);D(()=>{let y=P.current,U=b.value,J=Ue.current;if(Ue.current=U.length,!y||!N.current||T.current)return;if(U.slice(J).some(ie=>ie.role==="user"))return O.current=!1,_e(y,3);if(!U.some(ie=>ie.role==="user")||O.current||K())return;y.scrollHeight-y.scrollTop-y.clientHeight<Cl&&De(y)},[b.value.length]);let ht=F(null);D(()=>{let y=P.current,U=b.value.at(-1),J=ht.current;if(ht.current=U?{id:U.id,streaming:U.status==="streaming"}:null,!!y&&N.current&&!(!U||U.id!==J?.id||J.streaming||U.status!=="streaming"))return O.current=!1,_e(y,3)},[b.value]),D(()=>{let y=P.current;if(!y)return;let U=b.value.at(-1);if(!U||U.status!=="streaming"&&!b.value.some(ie=>ie.role==="user"))return;let J=()=>{if(O.current||K())return;y.scrollHeight-y.scrollTop-y.clientHeight<Cl*2&&De(y)};if(U.status!=="streaming")return Te(y,300);J();let ee=new MutationObserver(J);return ee.observe(y,{childList:!0,subtree:!0,characterData:!0}),()=>ee.disconnect()},[b.value]);let Ge=m?.form.id,vt=!!m&&(v??[]).some(y=>y.formId===m.form.id);Rt(()=>{let y=P.current;!y||!Ge||O.current||b.value.some(U=>U.role==="user")&&(vt?y.querySelector(`[data-testid="${L.formGate}"]`)?.scrollIntoView({block:"nearest"}):De(y))},[Ge,vt]),D(()=>{let y=P.current;if(!y)return;let U=()=>{Y(y),G(y),performance.now()-ne.current>150&&(O.current=y.scrollHeight-y.scrollTop-y.clientHeight>8)};function J(){O.current=!0}function ee(fe){fe.deltaY<0&&J()}let ie=0;function Ie(fe){ie=fe.touches[0]?.clientY??0,z.current=!0}function Pe(fe){(fe.touches[0]?.clientY??0)>ie+4&&J()}function he(){z.current=!1,V.current=performance.now()}function ft(){z.current=!0}return y.addEventListener("scroll",U,{passive:!0}),y.addEventListener("wheel",ee,{passive:!0}),y.addEventListener("touchstart",Ie,{passive:!0}),y.addEventListener("touchmove",Pe,{passive:!0}),y.addEventListener("touchend",he,{passive:!0}),y.addEventListener("touchcancel",he,{passive:!0}),y.addEventListener("pointerdown",ft,{passive:!0}),window.addEventListener("pointerup",he,{passive:!0}),window.addEventListener("pointercancel",he,{passive:!0}),Y(y),()=>{y.removeEventListener("scroll",U),y.removeEventListener("wheel",ee),y.removeEventListener("touchstart",Ie),y.removeEventListener("touchmove",Pe),y.removeEventListener("touchend",he),y.removeEventListener("touchcancel",he),y.removeEventListener("pointerdown",ft),window.removeEventListener("pointerup",he),window.removeEventListener("pointercancel",he)}},[]);function St(){let y=P.current;y&&(O.current=!1,De(y))}let pt=b.value.filter(y=>!y.ephemeral),kt=pt[0],wt=kt?.serverMessageId??kt?.id,Ee=!!(p&&pt.length>=ll&&wt!==A);async function He(){if(!p||w.current)return;let y=P.current,U=y?.scrollHeight??0,J=y?.scrollTop??0;w.current=!0,T.current=!0,k(!0);try{let ee=await p();ee===!1&&wt&&M(wt),ee&&y&&(await new Promise(ie=>requestAnimationFrame(()=>requestAnimationFrame(()=>ie()))),y.scrollTop=J+y.scrollHeight-U,G(y),Y(y))}finally{T.current=!1,w.current=!1,k(!1)}}let be=[],ot="",ve=b.value.at(-1)?.id,yt=[...v??[]].toSorted((y,U)=>(y.createdAt??1/0)-(U.createdAt??1/0));function Ke(y){return m&&y.formId===m.form.id?l(Pl,{form:m.form,strings:t,onSubmit:m.onSubmit,onSkip:m.onSkip},`gate:${y.formId}`):l(x_,{marker:y,strings:t,onFill:!m&&x?()=>x(y.formId):void 0},y.key)}function Dt(y){for(let U=yt[0];U?.createdAt!==void 0&&!(y!==void 0&&U.createdAt>y);U=yt[0])yt.shift(),be.push(Ke(U))}for(let y of b.value){if(y.role==="assistant"&&y.id!==ve&&Gn(y))continue;Dt(y.createdAt);let U=Hb(y.createdAt);U&&U!==ot&&(be.push(l("div",{class:`${En}-date-divider`,children:l("span",{class:`${En}-date-pill`,title:qb(y.createdAt),children:zb(y.createdAt,t)})},`day:${U}`)),ot=U);let ee=y.retryAction!==void 0||y.role==="assistant"&&y.id===ve?qa(b.value,y):void 0,ie=ee!==void 0&&(ee.kind!=="continue-assistant"||d==="ai-agent");be.push(l(j_,{message:y,status:y.status,strings:t,responseMode:n,showReasoning:r,showToolCalls:o,showSources:a,interactive:!!_&&d==="ai-agent"&&y.id===ve,superseded:y.id!==ve,tool:u,onRetry:_&&ie&&(y.role==="user"||y.id===ve)?f:void 0,enableMessageFeedback:i,onFeedback:s},y.id))}for(let y of yt)be.push(Ke(y));return l("div",{class:`${En}-list-wrap`,children:[l("div",{ref:P,class:`${En}-list ${En}-list--fade`,part:"messages",role:"log","aria-live":"polite","aria-relevant":"additions text",children:[c&&b.value.length===0?l("div",{class:`${En}-list-loading`,role:"status",children:t.conversationLoading}):null,Ee?l("div",{class:`${En}-load-previous`,children:l("button",{type:"button",onClick:He,disabled:g,"aria-busy":g,"data-testid":L.loadPreviousMessages,children:t.loadPreviousMessages})}):null,be,m&&!vt?l(Pl,{form:m.form,strings:t,onSubmit:m.onSubmit,onSkip:m.onSkip}):null]}),C?l("button",{type:"button",class:`${En}-jump`,onClick:St,"aria-label":t.scrollToBottom,title:t.scrollToBottom,"data-testid":L.scrollToBottom,children:l(pn,{})}):null]})}function Hb(e){if(typeof e!="number"||!Number.isFinite(e))return"";let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function qb(e){if(typeof e!="number"||!Number.isFinite(e))return"";try{return new Date(e).toLocaleDateString(void 0,{dateStyle:"full"})}catch{return""}}function zb(e,t){let n=new Date(e);function r(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime()}let o=Math.round((r(new Date)-r(n))/864e5);return o<=0?t.dateToday:o===1?t.dateYesterday:o<7?n.toLocaleDateString(void 0,{weekday:"long"}):n.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"})}function pi({panelEl:e,resize:t,position:n,initialSize:r,onSizeChange:o,strings:a}){let i=E.cssPrefix,s=F(null);if(D(()=>{if(!e)return;let m=e.style;t.minWidth&&m.setProperty(`--${i}-resize-min-w`,t.minWidth),t.maxWidth&&m.setProperty(`--${i}-resize-max-w`,t.maxWidth),t.minHeight&&m.setProperty(`--${i}-resize-min-h`,t.minHeight),t.maxHeight&&m.setProperty(`--${i}-resize-max-h`,t.maxHeight),r&&(m.setProperty(`--${i}-widget-w`,`${r.width}px`),m.setProperty(`--${i}-widget-h`,`${r.height}px`))},[e,t.minWidth,t.maxWidth,t.minHeight,t.maxHeight,i,r]),!e)return null;let c=n.startsWith("top-"),p=n.endsWith("-right"),_=`${i}-resize-grip ${i}-resize-grip--${c?"bottom":"top"}-${p?"left":"right"}`;function d(m){if(!e)return;let v=m.currentTarget,x=e.getBoundingClientRect();s.current={pointerId:m.pointerId,startX:m.clientX,startY:m.clientY,startW:x.width,startH:x.height,dirX:p?-1:1,dirY:c?1:-1},v.setPointerCapture(m.pointerId),e.setAttribute("data-resizing",""),m.preventDefault()}function u(m){let v=s.current;if(!v||m.pointerId!==v.pointerId||!e)return;let x=(m.clientX-v.startX)*v.dirX,P=(m.clientY-v.startY)*v.dirY;e.style.setProperty(`--${i}-widget-w`,`${v.startW+x}px`),e.style.setProperty(`--${i}-widget-h`,`${v.startH+P}px`)}function f(m){let v=s.current;if(!v||m.pointerId!==v.pointerId||!e)return;m.currentTarget.releasePointerCapture(m.pointerId),e.removeAttribute("data-resizing");let x=e.getBoundingClientRect();o({width:Math.round(x.width),height:Math.round(x.height)}),s.current=null}return l("div",{class:_,role:"separator","aria-orientation":"vertical","aria-label":a.resizeHandle,title:a.resizeHandle,onPointerDown:d,onPointerMove:u,onPointerUp:f,onPointerCancel:f,"data-testid":L.resizeGrip,children:l(xp,{})})}var W_=E.cssPrefix;function G_({suggestions:e,onPick:t,disabled:n=!1}){return e.length===0?null:l("div",{class:`${W_}-suggestions`,role:"group","aria-label":"Suggested replies",children:e.map((r,o)=>l("button",{type:"button",class:`${W_}-suggestion`,onClick:()=>t(r),disabled:n,"data-testid":dt(L.suggestion,o),children:r.label},r.id))})}var Zn=E.cssPrefix,jb=`.${Zn}-header, .${Zn}-back-header, .${Zn}-home-hero`,Vb='button, a, input, textarea, select, [role="tab"], [contenteditable]',K_=56;function _i(e,t){D(()=>{if(!t||!e)return;function n(c){return Number.parseFloat(c)||0}function r(c,p){return Math.min(p,Math.max(-p,c))}let o=null,a=c=>{let p=c.target;if(!(p instanceof Element)||!p.closest(jb)||p.closest(Vb))return;let _=e.getBoundingClientRect();o={id:c.pointerId,x:c.clientX,y:c.clientY,dx:n(e.style.getPropertyValue(`--${Zn}-modal-dx`)),dy:n(e.style.getPropertyValue(`--${Zn}-modal-dy`)),maxX:(window.innerWidth+_.width)/2-K_,maxY:(window.innerHeight+_.height)/2-K_},e.dataset.dragging="true",c.preventDefault()},i=c=>{if(!o||c.pointerId!==o.id)return;let p=r(o.dx+c.clientX-o.x,o.maxX),_=r(o.dy+c.clientY-o.y,o.maxY);e.style.setProperty(`--${Zn}-modal-dx`,`${p}px`),e.style.setProperty(`--${Zn}-modal-dy`,`${_}px`)},s=c=>{!o||c.pointerId!==o.id||(o=null,delete e.dataset.dragging)};return e.addEventListener("pointerdown",a),window.addEventListener("pointermove",i),window.addEventListener("pointerup",s),window.addEventListener("pointercancel",s),()=>{e.removeEventListener("pointerdown",a),window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s)}},[e,t])}function fi({containerRef:e,onDrop:t,disabled:n=!1}){let[r,o]=H(!1);return D(()=>{if(n){o(!1);return}let a=e.current;if(!a)return;let i=0;function s(d){i+=1,d.dataTransfer?.types.includes("Files")&&(d.preventDefault(),o(!0))}function c(){i-=1,!(i>0)&&(i=0,o(!1))}function p(d){d.dataTransfer?.types.includes("Files")&&d.preventDefault()}function _(d){i=0,o(!1),d.dataTransfer&&(d.preventDefault(),t(d.dataTransfer.items))}return a.addEventListener("dragenter",s),a.addEventListener("dragleave",c),a.addEventListener("dragover",p),a.addEventListener("drop",_),()=>{a.removeEventListener("dragenter",s),a.removeEventListener("dragleave",c),a.removeEventListener("dragover",p),a.removeEventListener("drop",_)}},[e,n,t]),{visible:n?!1:r}}var We=E.cssPrefix;function Q_(e){let{options:t,onClose:n}=e,r=t.strings,o=F(null);D(()=>{let p=o.current;if(!p)return;let _=Xa(p);function d(u){u.key==="Escape"&&n?.()}return p.addEventListener("keydown",d),()=>{_(),p.removeEventListener("keydown",d)}},[n]);let a=e.composerApiRef,i=e.composerActive&&e.view==="chat"&&e.canSend&&!e.activeForm?.blocking&&!e.sendPreparing&&e.options.features.fileUpload,s=$(p=>{i&&a.current?.attachFromDrop(p)},[a,i]),{visible:c}=fi({containerRef:o,onDrop:s,disabled:!i});return _i(o.current,t.mode==="modal"),l("div",{ref:o,class:`${We}-panel`,part:"panel",role:"dialog","aria-modal":"false","aria-label":r.panelTitle,style:{position:"relative"},"data-testid":L.panel,children:[l(Tl,{...e,containerEl:o.current,dragOver:c}),l(Il,{poweredBy:e.options.poweredBy})]})}function Tl(e){let{options:t,transport:n,feedback:r,bus:o,persistence:a,conversationId:i,composerKey:s,panelSize:c,view:p,canSend:_,isStreaming:d,isMemoryCompacting:u,canReleaseQueuedMessages:f,queueManualMessages:m,sendPreparing:v,controlMode:x,assignedOperatorInitials:P,operatorAvailable:b,operatorRequestEnabled:C,onRequestOperator:h,onCancelOperatorRequest:g,loadingMessages:k,onLoadPreviousMessages:w,messagesSig:T,agent:A,suggestions:M,initialWidgetSize:N,onClose:O,onBack:z,onClear:V,onToggleHistory:K,onSelectHistoryConversation:ne,onNewConversation:G,onWidgetSizeChange:Y,onSend:De,onStop:_e,onSuggestion:Te,activeForm:et,formMarkers:Ue,onFormSubmit:ht,onFormSkip:Ge,onFormFill:vt,tool:St,onRetry:pt,onMessageFeedback:kt,containerEl:wt,dragOver:Ee,composerApiRef:He}=e,be=t.strings,ot=Et(()=>T.value.some(yt=>!yt.ephemeral&&yt.role!=="system")).value,ve;return et?.blocking?ve=null:_?ve=l(de,{children:[x&&x!=="ai-agent"?l(Kb,{controlMode:x,operatorInitials:P,operatorAvailable:b,onCancelOperatorRequest:g,strings:be}):null,u&&x==="ai-agent"?l("div",{class:`${We}-loading ${We}-compaction-status`,role:"status","data-testid":L.compactionStatus,children:[l("span",{class:`${We}-loading-spinner`,"aria-hidden":"true"}),be.compactingContext]}):null,!d&&!u&&x==="ai-agent"&&l(G_,{suggestions:M,onPick:Te,disabled:v}),l(a_,{options:t,transport:n,feedback:r,bus:o,persistence:a,conversationId:i,isStreaming:d,pageToolRunning:e.pageToolRunning,isMemoryCompacting:u,canReleaseQueuedMessages:f,queueManualMessages:m,active:e.composerActive&&p==="chat",isPreparing:v,operatorRequestEnabled:C,canRequestOperator:ot,controlMode:x,onRequestOperator:h,onSend:De,onStop:_e,apiRef:He},s)]}):ve=l(Gb,{label:be.conversationClosed,ctaLabel:be.startNewConversation,onNewConversation:V}),l(de,{children:[p==="history"?l(Wb,{strings:be,onBack:K,onClose:O,showClose:ja(t.mode,c,t.actions)}):l("header",{class:`${We}-header`,part:"header","data-testid":L.panelHeader,children:[z?l("button",{type:"button",class:`${We}-icon-btn`,onClick:z,"aria-label":be.moduleBack,title:be.moduleBack,children:l(bo,{})}):null,A?l(f_,{agent:A,strings:be}):l("h1",{children:be.panelTitle}),l(Jt,{panelProps:e,variant:"chat"})]}),p==="history"?l(ai,{transport:n,strings:be,locale:t.locale,persistence:a,onSelect:ne,onNewConversation:G}):l(de,{children:[l(y_,{visible:Ee,strings:be}),l(V_,{messagesSig:T,strings:be,responseMode:t.responseMode,showReasoning:t.showReasoning,showToolCalls:t.showToolCalls,showSources:t.showSources,enableMessageFeedback:t.enableMessageFeedback,onFeedback:kt,loading:k,onLoadPreviousMessages:w,idle:!d&&!v&&_&&!et?.blocking,controlMode:x,tool:St,onRetry:pt,form:et?{form:et,onSubmit:ht,onSkip:Ge}:null,formMarkers:Ue,onFillForm:vt}),ve,l(Xb,{disclaimer:t.composerDisclaimer})]}),t.size.resize?.enabled?l(pi,{panelEl:wt,resize:t.size.resize,position:t.position,initialSize:N,onSizeChange:Y,strings:be}):null]})}function Wb({strings:e,onBack:t,onClose:n,showClose:r}){return l("header",{class:`${We}-header`,part:"header",children:[l("button",{type:"button",class:`${We}-icon-btn`,onClick:t,"aria-label":e.historyBack,title:e.historyBack,children:l(bo,{})}),l("h1",{children:e.historyTitle}),r?l("button",{type:"button",class:`${We}-icon-btn`,onClick:n,"aria-label":e.close,title:e.close,children:l(Ut,{})}):null]})}function Gb({label:e,ctaLabel:t,onNewConversation:n}){return l("div",{class:`${We}-readonly-banner`,role:"note",children:[l("span",{class:`${We}-readonly-label`,children:e}),l("button",{type:"button",class:`${We}-readonly-cta`,onClick:n,children:t})]})}function Kb({controlMode:e,operatorInitials:t,operatorAvailable:n,onCancelOperatorRequest:r,strings:o}){let a=Qb(e,t,n,o);return l("div",{class:`${We}-operator-banner`,role:"status","data-mode":e,"data-testid":L.operatorBanner,children:[l("span",{class:`${We}-operator-pulse`,"aria-hidden":"true"}),l("span",{class:`${We}-operator-label`,children:a}),e==="awaiting-operator"&&r?l("button",{type:"button",class:`${We}-cancel-operator-request`,"data-testid":L.cancelOperatorRequest,onClick:r,children:o.cancelOperatorRequest}):null]})}function Qb(e,t,n,r){return e==="operator"?r.chattingWithOperator.replace("{operator}",t??""):n===!1?r.noOperatorAvailable:r.connectingOperator}function Xb({disclaimer:e}){return e?l("div",{class:`${We}-composer-footer`,children:l("div",{class:`${We}-disclaimer`,children:e})}):null}function Il({poweredBy:e}){return e?l("div",{class:`${We}-poweredby-bar`,children:l(Jb,{logoUrl:e.logoUrl,text:e.text,href:e.href})}):null}function Jb({logoUrl:e,text:t,href:n}){let r=l(de,{children:[e?l("img",{class:`${We}-poweredby-logo`,src:e,alt:"",loading:"lazy"}):null,t?l("span",{children:t}):null]});return n?l("a",{class:`${We}-poweredby`,href:n,target:"_blank",rel:"noopener noreferrer",children:r}):l("span",{class:`${We}-poweredby`,children:r})}var mi=E.cssPrefix;function X_({panelProps:e,enabledModules:t,nav:n,bus:r,hasUnread:o,latestNews:a,onSelectConversation:i,onStartNewConversation:s,onSetPanelSize:c}){let p=e.options,_=p.strings,d=F(null),u=F(new Set);D(()=>{let V=d.current;if(!V)return;let K=Xa(V);function ne(G){G.key==="Escape"&&e.onClose?.()}return V.addEventListener("keydown",ne),()=>{K(),V.removeEventListener("keydown",ne)}},[e.onClose]);let f=Et(()=>n.sig.value).value,m=lp(f),v=p.modules.byId[f.activeTab],x=e.composerActive&&v?.layout==="chat"&&m===void 0,P=e.composerApiRef,b=x&&e.view==="chat"&&e.canSend&&!e.activeForm?.blocking&&!e.sendPreparing&&e.options.features.fileUpload,C=$(V=>{b&&P.current?.attachFromDrop(V)},[P,b]),{visible:h}=fi({containerRef:d,onDrop:C,disabled:!b});_i(d.current,p.mode==="modal");let g=m?.kind==="iframe"||m?.kind==="content",k=t.length>1&&(cp(f)||!g),w=F(null);D(()=>{if(g&&w.current===null)w.current=e.panelSize,e.panelSize==="normal"&&c("expanded");else if(!g&&w.current!==null){let V=w.current;w.current=null,c(V)}},[g]);let T={push:V=>n.push(V),pop:()=>n.pop(),switchTab:V=>n.switchTab(V),switchToLayout:V=>{let K=t.find(ne=>ne.layout===V);K&&n.switchTab(K.id)},selectConversation:i,startNewConversation:s};function A(V){return{options:p,transport:e.transport,strings:_,config:V,nav:T,bus:r,panelProps:e,latestNews:a}}let M=l(Jt,{panelProps:e,variant:"plain"});v&&u.current.add(v.id);let N=t.filter(V=>u.current.has(V.id));function O(V){if(V.layout==="chat")return l(Tl,{...e,composerActive:x,containerEl:d.current,dragOver:h});let K=oi[V.layout].Root;return K?l(K,{...A(V)}):null}function z(){return m?.kind==="iframe"?l(__,{url:m.url,title:m.title,strings:_,onBack:()=>n.pop(),actions:M}):m?.kind==="content"?l(Kp,{id:m.id,title:m.title,transport:e.transport,strings:_,bus:r,onBack:()=>n.pop(),actions:M}):null}return l("div",{ref:d,class:`${mi}-panel ${mi}-messenger`,part:"panel",role:"dialog","aria-modal":"false","aria-label":_.panelTitle,style:{position:"relative"},"data-testid":L.messengerHome,children:[l("div",{class:`${mi}-messenger-body`,children:[N.map(V=>l("div",{class:`${mi}-messenger-pane`,hidden:g||V.id!==v?.id,children:O(V)},V.id)),z()]}),k?l(d_,{modules:t,activeTab:f.activeTab,strings:_,hasUnread:o,onSelect:V=>n.switchTab(V)}):null,l(Il,{poweredBy:p.poweredBy}),p.size.resize?.enabled&&!(v?.layout==="chat"&&!m)?l(pi,{panelEl:d.current,resize:p.size.resize,position:p.position,initialSize:e.initialWidgetSize,onSizeChange:e.onWidgetSizeChange,strings:_}):null]})}var Io=E.cssPrefix;function J_({strings:e,onClose:t}){return l("div",{class:`${Io}-panel ${Io}-modules-empty`,part:"panel",role:"dialog","aria-label":e.panelTitle,"data-testid":L.modulesEmpty,children:[t?l("button",{type:"button",class:`${Io}-icon-btn ${Io}-modules-empty-close`,onClick:t,"aria-label":e.close,title:e.close,children:l(Ut,{})}):null,l("p",{class:`${Io}-modules-empty-text`,children:e.modulesEmpty})]})}function Y_(e){let t=E.cssPrefix,{site:n,blocks:r,strings:o,collapsed:a}=e,i=r?.navigation??[],s=r?.linkCards??[],c=a?o.expandSidebar:o.collapseSidebar;return l("aside",{class:`${t}-sidebar`,"data-collapsed":a?"true":"false","data-testid":L.sidebar,children:[l("div",{class:`${t}-sidebar-header`,children:[l(Yb,{site:n}),l("button",{type:"button",class:`${t}-sidebar-toggle`,"aria-label":c,"aria-expanded":a?"false":"true",title:c,onClick:e.onToggleCollapsed,"data-testid":L.sidebarToggle,children:l(Zb,{collapsed:a})})]}),a?null:l(de,{children:[i.length>0?l("nav",{class:`${t}-sidebar-section`,"data-section":"navigation",children:l(eP,{items:i})}):null,s.length>0?l("div",{class:`${t}-sidebar-section`,"data-section":"link-cards",children:l(tP,{items:s})}):null,e.showConversations?l("div",{class:`${t}-sidebar-conversations`,children:l(ai,{transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,onSelect:e.onSelectConversation,onNewConversation:e.onNewConversation})}):null]})]})}function Yb({site:e}){let t=E.cssPrefix;if(e?.logo?.url){let n=e.logo.alt??e.title??"Logo";return l("picture",{children:[e.logoDark?.url?l("source",{srcset:e.logoDark.url,media:"(prefers-color-scheme: dark)"}):null,l("img",{class:`${t}-sidebar-logo`,src:e.logo.url,alt:n})]})}return l("div",{class:`${t}-sidebar-title`,children:e?.title??E.name})}function Zb({collapsed:e}){return l("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true",children:e?l("polyline",{points:"9 6 15 12 9 18"}):l("polyline",{points:"15 6 9 12 15 18"})})}function eP({items:e}){let t=E.cssPrefix;return l("ul",{class:`${t}-sidebar-nav`,children:e.map(n=>l("li",{children:l("a",{class:`${t}-sidebar-nav-item`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[n.icon?l("span",{class:`${t}-sidebar-nav-icon`,"data-icon":n.icon}):null,l("span",{class:`${t}-sidebar-nav-label`,children:n.label})]})},n.id??n.label))})}function tP({items:e}){let t=E.cssPrefix;return l("div",{class:`${t}-sidebar-cards`,children:e.map(n=>l("a",{class:`${t}-sidebar-card`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[l("div",{class:`${t}-sidebar-card-label`,children:n.label}),n.description?l("div",{class:`${t}-sidebar-card-desc`,children:n.description}):null]},n.id??n.label))})}var Z_=E.cssPrefix;function ef(e){return l("main",{class:`${Z_}-page-shell`,"data-sidebar-collapsed":e.sidebarCollapsed?"true":"false",children:[l(Y_,{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}),l("section",{class:`${Z_}-page-chat`,"aria-label":e.strings.panelTitle,children:e.children})]})}var Ro=Z.scope("hitl");function gi(e){return e.kind==="tool"&&Vt(e.toolMetadata)&&(e.stateSig.value==="input-available"||e.stateSig.value==="approval-responded"&&e.approvalSig.value?.approved===!0)}function tf(e,t){t.errorSig.value=us(t.toolCallId),t.stateSig.value="output-error",e.partsSig.value=[...e.partsSig.value]}function nP(e,t){let n=e.slice(0,e.indexOf(t)).findLast(r=>r.role==="user");return n!==void 0&&Tt.sentHere(n.id)}function nf(e){let{streaming:t,controlModeSig:n,messagesSig:r,sendAiTurn:o,bus:a,humanInLoop:i,tools:s}=e,c=F(t);c.current=t;let p=F(s);p.current=s;let _=F(new Map),[d,u]=H(!1),f=$((h,g,k)=>{if(c.current||n.value!=="ai-agent")return!1;let w=r.value.at(-1),T=w?.partsSig.value.findIndex(N=>N.kind==="tool"&&N.toolCallId===h)??-1,A=w?.partsSig.value[T];if(!w||A?.kind!=="tool")return Ro.warn("decideTool: tool part not found",{toolCallId:h}),!1;if(w.status!=="complete"||!Ba(w,T)||!g(A))return!1;if(k(A),w.partsSig.value=[...w.partsSig.value],!Kn(w)||w.partsSig.value.some(gi))return!0;w.status="streaming",w.retryAction={kind:"continue-assistant",messageId:w.serverMessageId??w.id},w.awaitingContinuation=!0,r.value=[...r.value];let M=w.partsSig.value.flatMap(N=>N.kind==="tool"?[N.toolCallId]:[]);return o({continueExisting:!0}).then(N=>N&&Tt.clear(M)),!0},[n,r,o]),m=$((h,g)=>{let{toolCallId:k,toolName:w}=g;_.current.has(k)||(_.current.set(k,h),u(!0),Zc({toolCallId:k,toolName:w,input:g.inputSig.value,optionTools:p.current??[],onSettled:(T,A)=>{Ro.info("toolResult",{toolCallId:k,status:T}),a.emit("toolResult",{toolCallId:k,name:Kr(w),status:T,durationMs:A})}}).then(T=>{_.current.delete(k)&&(u(_.current.size>0),f(k,gi,A=>{T.state==="output-available"?A.outputSig.value=T.output:A.errorSig.value=T.errorText,A.stateSig.value=T.state}))}))},[a,f]),v=$(()=>{let h=r.value;for(let[w,T]of _.current){let A=h.findIndex(M=>M.id===T);A<0||A===h.length-1||(_.current.delete(w),eu(w),u(_.current.size>0))}let g=h.at(-1);if(c.current||g?.role!=="assistant"||g.status!=="complete")return;let k=g.partsSig.value.filter(w=>gi(w)&&w.stateSig.value==="input-available");if(!(k.length===0||!nP(h,g)))for(let w of k)Tt.get(w.toolCallId)?.state==="stopped"?tf(g,w):m(g.id,w)},[r,m]);D(()=>v(),[t,v]),D(()=>r.subscribe(()=>v()),[r,v]);let x=$((h,g,k)=>{let w=!1,T;if(!f(h,N=>N.stateSig.value==="approval-requested",N=>{Vt(N.toolMetadata)&&(T=N),w=N.toolMetadata?.card==="questions";let O=N.approvalSig.value?.id??h;N.approvalSig.value={id:O,approved:g,reason:k},N.stateSig.value="approval-responded"}))return;let M=r.value.at(-1);if(T&&g&&M&&m(M.id,T),T&&!g&&a.emit("toolResult",{toolCallId:h,name:Kr(T.toolName),status:"declined",durationMs:0}),w){Ro.info("toolResult",{toolCallId:h}),a.emit("toolResult",{toolCallId:h});return}Ro.info("toolDecision",{toolCallId:h,approved:g}),a.emit("toolDecision",{toolCallId:h,approved:g})},[a,f,r,m]),P=$(h=>{f(h,g=>g.stateSig.value==="approval-responded"&&g.approvalSig.value?.approved!==void 0&&!gi(g),g=>{let k=g.approvalSig.value?.id??h;g.approvalSig.value={id:k},g.stateSig.value="approval-requested"})},[f]),b=ue(()=>({humanInLoop:i,onDecision:x,onEdit:P}),[i,x,P]),C=$(()=>{let h=r.value.at(-1);for(let g of _.current.keys()){let k=h?.partsSig.value.find(w=>w.kind==="tool"&&w.toolCallId===g);h&&k?tf(h,k):us(g),Ro.info("toolResult",{toolCallId:g,status:"stopped"}),a.emit("toolResult",{toolCallId:g,name:k?Kr(k.toolName):void 0,status:"stopped",durationMs:0})}_.current.clear(),u(!1)},[a,r]);return{toolInteraction:b,pageToolsRunning:d,stopPageTools:C}}var rP=Z.scope("latest-news");function rf({transport:e,options:t,persistence:n,enabled:r}){let o=t.modules.list.find(d=>d.layout==="news")?.contentCollectionIds,a=o?.join(","),[i,s]=H(),[c,p]=H(()=>n.loadSeenNewsId());D(()=>{if(!r||!o?.length)return;let d=!1;return e.listContent({contentCollectionIds:o,sortBy:"publishedAt",sortOrder:"desc",limit:1}).then(u=>{d||s(u.items[0])}).catch(u=>rP.debug("listContent (latest news) failed (non-fatal)",{err:u})),()=>{d=!0}},[e,r,a]);let _=$(d=>{n.saveSeenNewsId(d),p(d)},[n]);return{item:i,unseen:i!==void 0&&i.id!==c,markSeen:_}}function of({callout:e,persistence:t}){let n=e?.text??"",r=e?.persistent??!0,[o,a]=H(()=>r?!1:t.loadCalloutDismissed(n));D(()=>{a(r?!1:t.loadCalloutDismissed(n))},[n,r,t]);let i=$(()=>{a(!0),r||t.saveCalloutDismissed(n)},[t,n,r]);return{dismissed:o,dismissCallout:i}}function af(e){let{transport:t,conversationIdSig:n}=e,r=Ot("ai-agent"),o=Ot(void 0),a=Ot(void 0),i=F(void 0),s=$(d=>{let u=d.controlRevision,f=i.current;f&&f.conversationId===n.value&&u<f.revision||(i.current={conversationId:n.value,revision:u},r.value=d.controlMode,o.value=d.assignedOperatorInitials,d.controlMode!=="awaiting-operator"?a.value=void 0:d.operatorAvailable!==void 0&&(a.value=d.operatorAvailable))},[n,r,o,a]),c=$(d=>{if(d.type!=="data-control-state")return;let u=Dd(d.data);u&&s(u)},[s]),p=$(async()=>{let d=n.value,u=await t.requestOperator();u&&n.value===d&&s(u)},[t,n,s]),_=$(async()=>{let d=n.value,u=await t.cancelOperatorRequest();u&&n.value===d&&s(u)},[t,n,s]);return{controlModeSig:r,assignedOperatorInitialsSig:o,operatorAvailableSig:a,applyControlState:s,adoptControlStateChunk:c,requestOperator:p,cancelOperatorRequest:_}}var hi=E.cssPrefix,sf=`--${hi}-visual-viewport-height`,lf=`--${hi}-visual-viewport-top`;function cf(e){let{hostElement:t,mode:n,panelSize:r,isOpen:o,surfaceReady:a,setIsOpen:i}=e;Rt(()=>{ca(t,Va(n,r,o))},[t,o,r,n]),Rt(()=>{if(!o||!a)return;let s=t.ownerDocument.defaultView,c=s?.visualViewport,p=t.shadowRoot?.querySelector(`.${hi}-anchor`);if(!s||!c||!p)return;let _=()=>{p.style.setProperty(sf,`${c.height}px`),p.style.setProperty(lf,`${c.offsetTop}px`)},d=0,u=()=>{s.cancelAnimationFrame(d),d=s.requestAnimationFrame(()=>{d=s.requestAnimationFrame(_)})};return _(),c.addEventListener("resize",u),c.addEventListener("scroll",u),()=>{s.cancelAnimationFrame(d),c.removeEventListener("resize",u),c.removeEventListener("scroll",u),p.style.removeProperty(sf),p.style.removeProperty(lf)}},[t,o,a]),D(()=>{if(n!=="modal"||!o)return;function s(c){c.composedPath().some(_=>_ instanceof HTMLElement&&_.classList.contains(`${hi}-panel`))||i(!1)}return t.addEventListener("click",s),()=>t.removeEventListener("click",s)},[t,o,n,i]),D(()=>{if(n!=="drawer"||!o)return;function s(c){c.key==="Escape"&&i(!1)}return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[o,n,i])}var Rl=Z.scope("reducer"),vi=class{constructor(t,n){oe(this,"messagesSig",t);oe(this,"onReconcileNeeded",n);oe(this,"active",null);oe(this,"openTextParts",new Map);oe(this,"partSeq",0);oe(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 r=un();r.id=t.id;let o=er(t)||Qn(t)&&(t.status!=="streaming"||Kn(t)),a=t.status==="streaming"&&Kn(t)&&fo(t);this.replay={baseline:t,shadow:r,chunks:[n],probeContinuation:o,continuationTailReplay:a,liveCatchUp:t.status==="streaming"&&!o},this.attach(r),this.apply(n)}refreshReplayBaseline(){let t=this.replay;if(!t)return null;let n=t.shadow.serverMessageId??t.baseline.serverMessageId,r=this.messagesSig.value,o=r.at(-1),a=o===t.baseline||o?.id===t.baseline.id||n!==void 0&&o?.serverMessageId===n?o:r.find(s=>s===t.baseline)??r.find(s=>s.id===t.baseline.id||n!==void 0&&s.serverMessageId===n);if(!a)return this.detach(),null;if(a===t.baseline)return t;let i=t.baseline;return t.baseline=a,uf(i,a),t.liveCatchUp&&er(t.shadow)&&(a.status==="streaming"||Qn(a))?(t.probeContinuation=!1,t.continuationTailReplay=!1,t):(t.probeContinuation=er(a)||Qn(a)&&(a.status!=="streaming"||Kn(a)),t.continuationTailReplay=a.status==="streaming"&&Kn(a)&&fo(a),t.liveCatchUp=a.status==="streaming"&&!t.probeContinuation,t)}refreshActive(){let t=this.active;if(!t)return null;let n=t.serverMessageId,r=this.messagesSig.value,o=r.at(-1),a=o===t||o?.id===t.id||n!==void 0&&o?.serverMessageId===n?o:r.find(s=>s===t)??r.find(s=>s.id===t.id||n!==void 0&&s.serverMessageId===n);if(!a)return this.detach(),null;if(a===t)return t;uf(t,a);let i=er(t)&&Qn(a);return a.status!=="streaming"&&!i?(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 Bt(()=>{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:r}=this.replay,o=Ua(n);return this.replay=null,Bt(()=>{if(t){let a=n.partsSig.value.findLastIndex(i=>i.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 r)this.apply(a);n.continuationStreaming=o||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}settleOwnedContinuation(t){let{baseline:n}=this.replay,r=Ua(n);return this.replay=null,Bt(()=>{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=r||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}applyResume(t){if(t.type==="start"){let o=(this.replay?.baseline??this.active)?.serverMessageId;o!==void 0&&t.messageId!==void 0&&o!==t.messageId&&this.onReconcileNeeded?.({messageId:o}),this.detach();let a=t.messageId,i=a!==void 0?this.messagesSig.value.find(_=>_.serverMessageId===a||_.id===a):void 0;if(i!==void 0)return t.messageMetadata?.senderRole==="visitor"&&i.role==="user"&&(i.status==="pending"||i.status==="error")&&(i.serverMessageId=a,i.status="complete",i.errorText=void 0,i.retryAction=void 0,this.messagesSig.value=[...this.messagesSig.value]),this.beginReplay(i,t),null;let s=t.messageMetadata?.senderRole,c=this.messagesSig.value.at(-1);if(s===void 0&&c?.role==="assistant"&&c.status==="streaming"&&c.serverMessageId===void 0&&!Gt(c))return this.attach(c),this.apply(t),null;let p=un();return this.attach(p),this.messagesSig.value=[...this.messagesSig.value,p],this.apply(t),null}if(this.replay){let r=this.refreshReplayBaseline();if(!r)return null;r.chunks.push(t),t.type==="data-control-state"&&(r.baseline.operatorRoutedTurn=t.data.controlMode!=="ai-agent"),this.apply(t);let{baseline:o,shadow:a,probeContinuation:i,continuationTailReplay:s,liveCatchUp:c}=r,p=t.type==="finish"||t.type==="error"||t.type==="abort";if(i){if(!iP(o,a,t))return p&&(uP(o,a)&&(o.continuationStreaming=!0,this.messagesSig.value=[...this.messagesSig.value],this.onReconcileNeeded?.({messageId:o.serverMessageId??o.id})),this.detach()),null;let d=er(o)&&p?this.settleOwnedContinuation(t):this.promoteContinuation();return p?(d.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:d.serverMessageId??d.id}):d.continuationStreaming=!1),this.detach(),d):null}if(s&&aP(o,a)){let d=this.promoteContinuation(!0);return p?(this.detach(),d):null}if(!c)return p&&this.detach(),null;if(p&&!Gt(o)&&Gt(a)){let d=this.promoteReplay();return this.detach(),d}if(!oP(o,a))return p&&(this.onReconcileNeeded?.({messageId:o.serverMessageId??o.id}),this.detach()),null;let _=this.promoteReplay();return p?(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 r=n;return r.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:r.serverMessageId??r.id}):r.continuationStreaming=!1),this.detach(),r}return null}ensureTextPart(t,n,r){let o=`${n}:${r}`,a=this.openTextParts.get(o);if(a)return a;let i={kind:n,id:`${r}#${this.partSeq++}`,textSig:le(""),doneSig:le(!1)};return this.openTextParts.set(o,i),Eo(t,i),i}apply(t){let n=this.active;if(n)switch(t.type){case"start":{t.messageId&&(n.serverMessageId=t.messageId);let r=t.messageMetadata;r?.senderRole==="operator"?(n.role="operator",r.operatorInitials&&(n.operatorInitials=r.operatorInitials)):r?.senderRole==="visitor"&&(n.role="user");return}case"finish-step":this.openTextParts.clear();return;case"start-step":Eo(n,{kind:"step-start",id:`ss-${this.partSeq++}`});return;case"finish":Rl.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":Rl.warn("stream error chunk",{errorText:t.errorText}),n.status="error",n.errorText=t.errorText,this.bumpDone(n);return;case"abort":Rl.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 r=this.ensureTextPart(n,"text",t.id);r.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 r=this.ensureTextPart(n,"reasoning",t.id);r.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":dP(n,t);return;case"file":Eo(n,{kind:"file",url:t.url,mediaType:t.mediaType});return;case"source-url":df(n,{kind:"source",sourceId:t.sourceId,url:t.url,title:t.title});return;case"source-document":df(n,{kind:"source",sourceId:t.sourceId,title:t.title,filename:t.filename,mediaType:t.mediaType});return;case"data-suggestions":n.suggestions=Da(t.data);return;case"data-control-state":n.operatorRoutedTurn=t.data.controlMode!=="ai-agent";return;case"data-memory-compaction-state":return;default:{let r=t}}}bumpDone(t){Bt(()=>{t.partsSig.value=[...t.partsSig.value],this.messagesSig.value.includes(t)&&(this.messagesSig.value=[...this.messagesSig.value])})}},El={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function er(e){return e.awaitingContinuation===!0||e.continuationStreaming===!0||e.retryAction?.kind==="continue-assistant"}function uf(e,t){e.canceled&&(t.canceled=!0),!(!er(e)||t.status!=="streaming"&&!Qn(t))&&(t.awaitingContinuation??(t.awaitingContinuation=e.awaitingContinuation),t.continuationStreaming??(t.continuationStreaming=e.continuationStreaming),t.retryAction===void 0&&(t.retryAction=e.retryAction))}function oP(e,t){let n=e.partsSig.value,r=t.partsSig.value;return e.role!==t.role||r.length<n.length?!1:n.every((o,a)=>pf(o,r[a]))}function aP(e,t){let n=e.partsSig.value,r=n.findLastIndex(s=>s.kind==="tool"),o=new Set(n.slice(0,r+1).flatMap(s=>s.kind==="tool"?[s.toolCallId]:[])),a=t.partsSig.value.filter(s=>s.kind!=="tool"||!o.has(s.toolCallId)),i=n.slice(r+1);return a.length<i.length?!1:i.every((s,c)=>pf(s,a[c]))}function pf(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||!Ha(t.toolName,e.toolName)||El[t.stateSig.value]<El[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 iP(e,t,n){return sP(e,n)||!lP(e,t)?!0:n.type!=="finish"&&n.type!=="error"&&n.type!=="abort"?!1:fo(t)||e.awaitingContinuation===!0&&n.type!=="finish"?!0:e.awaitingContinuation===!0&&t.partsSig.value.every(r=>r.kind==="step-start")}function sP(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(r=>r.kind==="tool"&&r.toolCallId===t.toolCallId);return n!==void 0&&El[n.stateSig.value]<4}function lP(e,t){let n=t.partsSig.value;if(n.length===0)return!0;let r=e.partsSig.value;return r.some((o,a)=>n.every((i,s)=>cP(r[a+s],i)))}function cP(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"||Ha(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 uP(e,t){if(er(e)||!Qn(e))return!1;let n=new Set(e.partsSig.value.filter(o=>o.kind==="tool").map(o=>o.toolCallId));return!t.partsSig.value.some(o=>o.kind==="tool"&&n.has(o.toolCallId))}function An(e,t,n,r,o){let a=e.partsSig.value.find(s=>s.kind==="tool"&&s.toolCallId===t);if(a)return r&&(a.dynamic=!0),a.toolMetadata??(a.toolMetadata=o),a;let i={kind:"tool",toolCallId:t,toolName:n??"tool",dynamic:r?!0:void 0,toolMetadata:o,inputPartialSig:le(""),inputSig:le(void 0),outputSig:le(void 0),errorSig:le(void 0),stateSig:le("input-streaming"),approvalSig:le(void 0)};return Eo(e,i),i}function Eo(e,t){e.partsSig.value=[...e.partsSig.value,t]}function df(e,t){e.partsSig.value.some(n=>n.kind==="source"&&n.sourceId===t.sourceId)||Eo(e,t)}function dP(e,t){switch(t.type){case"tool-input-start":An(e,t.toolCallId,t.toolName,t.dynamic,t.toolMetadata);return;case"tool-input-delta":{let n=An(e,t.toolCallId);n.inputPartialSig.value+=t.inputTextDelta;return}case"tool-input-available":{let n=An(e,t.toolCallId,t.toolName,t.dynamic,t.toolMetadata);n.inputSig.value=t.input,n.stateSig.value="input-available";return}case"tool-input-error":{let n=An(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=An(e,t.toolCallId,t.toolName);n.approvalSig.value={id:t.approvalId},n.stateSig.value="approval-requested";return}case"tool-output-available":{let n=An(e,t.toolCallId,void 0,t.dynamic);n.outputSig.value=t.output,n.stateSig.value="output-available";return}case"tool-output-error":{let n=An(e,t.toolCallId,void 0,t.dynamic);n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-output-denied":{let n=An(e,t.toolCallId);n.stateSig.value="output-denied";return}default:return}}async function _f(e){let t=1e3,n=!1,r=!1,o=!1;function a(){o||e.signal.aborted||(o=!0,e.onInitialBoundaryReady())}for(;!e.signal.aborted;){let i,s="held";try{s=await e.connect(()=>{if(e.signal.aborted)return;i=e.now();let c=n||r;n=!0,r=!1,o?c&&e.backfill():a()})}catch{}if(e.signal.aborted||(!n&&i===void 0&&(r=!0,a()),s==="unavailable"))return;i!==void 0&&e.now()-i>=1e3&&(t=1e3),await e.sleep(t),t=Math.min(t*2,15e3)}}var pP=120;function ff(e){let{activated:t,conversationReady:n,conversationIdSig:r,messagesSig:o,optionsRef:a,transport:i,visitorId:s,adoptControlStateChunk:c,adoptMemoryCompactionStateChunk:p,settleSuggestions:_,recordConversationReply:d,transcriptRecoverySig:u,beginConversationTranscript:f,commitConversationTranscript:m,onReplyLanded:v,runCancellation:x,canContinueRef:P,setCanSend:b,feedback:C,bus:h,loadInitialThread:g,shouldReconcileOnConnect:k}=e,w=F(0);D(()=>{if(!t||!n||!r.value)return;let T=r.value,A=new AbortController,M=y=>{},N=new vi(o,y=>M(y));i.primeIdentity(s,T);let O=!1,z=!1,V,K=!1,ne,G=0,Y=P.current,De,_e,Te=Date.now(),et,Ue=!1,ht=!1;function Ge(y,U,J){if(!Gt(y))return;let ee=o.value.findLast(Ie=>!Ie.ephemeral),ie=y.serverMessageId??y.id;if(!(ee&&(ee.serverMessageId??ee.id)!==ie))return Fa(o.value,y,T,a.current.strings.newConversation,U,J)}function vt(y,U,J,ee){let ie=Ge(y,U,ee);if(!ie)return;let Pe=`${y.serverMessageId??y.id}:${J}:${ie.preview??""}`;Pe!==_e&&(_e=Pe,i.publishConversation({...ie,hasUnread:!0},!0))}let St;function pt(){St&&(clearTimeout(St.timer),St=void 0)}function kt(){let y=St;if(!y)return;clearTimeout(y.timer),St=void 0;let U=o.value.find(J=>(J.serverMessageId??J.id)===y.replyId);U?.role!=="assistant"&&U?.role!=="operator"||vt(U,y.canContinue,y.generation,y.activityAt)}function wt(y,U,J,ee){pt(),St={replyId:y.serverMessageId??y.id,canContinue:U,generation:J,activityAt:ee,timer:setTimeout(kt,pP)}}function Ee(y,U,J,ee=Date.now(),ie=!0){pt();let Ie=Ge(y,U,ee);if(!Ie)return;let he=`${y.serverMessageId??y.id}:${J}`;he!==De&&(De=he,d(Ie),ie&&et&&(Ue=!0))}function He(y,U){(y||!x.localSendRef.current)&&x.settle(U),y&&v()}function be(y,U=[],J=!1,ee,ie=Y,Ie=G,Pe=Date.now(),he=!0){let ft=a.current;if(y.canceled){Ee(y,ie,Ie,Pe,he),He(J,ee);return}let fe=!0,at=y.status==="error";switch(Gd(y,at)){case"drop":o.value=o.value.filter(qe=>qe!==y),fe=!1;break;case"complete-operator-routed":y.status="complete",J&&(C.play("messageReceived"),xr(h,ft,"assistant",Ve(y)));break;case"error":{if(y.status="error",y.errorText=ft.strings.errorGeneric,J){C.play("error");let qe=new Error(at?"stream error chunk":"empty reply");h.emit("error",qe),ft.onError?.(qe)}break}case"complete":y.status="complete",J&&(C.play("messageReceived"),xr(h,ft,"assistant",Ve(y))),_(y,U);break}fe&&Ee(y,ie,Ie,Pe,he),He(J,ee)}function ot(y){if(A.signal.aborted||r.value!==T)return;if(c(y),p?.(y),y.type==="start"){kt();let qe=y.messageId===void 0?void 0:o.value.find(B=>B.serverMessageId===y.messageId||B.id===y.messageId);K=qe!==void 0&&qe.status!=="streaming";let zt=ne?.senderRole==="visitor"?ne.messageId:void 0;if(ne={messageId:y.messageId,senderRole:y.messageMetadata?.senderRole},G+=1,Te=Date.now(),_e=void 0,O=y.messageMetadata?.senderRole===void 0,z=!1,V=O?y.messageMetadata?.runId:void 0,O){let B=y.messageId!==void 0&&o.value.some(it=>it.serverMessageId===y.messageId||it.id===y.messageId),Q=o.value.at(-1),te=y.messageId!==void 0&&(Q?.serverMessageId===y.messageId||Q?.id===y.messageId),me=x.localSendRef.current&&(!B||te)&&Q?.role==="assistant"&&Q.status==="streaming"&&(te||Q.serverMessageId===void 0&&Q.partsSig.value.length===0);z=x.captureStart(T,y,me,zt)}}let U=O&&(y.type==="finish"||y.type==="error"||y.type==="abort"),J=U?V:void 0,ee=U&&(z||x.ownsLocalRun(J)),ie=G,Ie=K;y.type==="finish"&&y.canContinue!==void 0&&(Y=y.canContinue);let Pe=Y;U&&(O=!1,z=!1,V=void 0);let he=N.applyResume(y),ft=ne?.messageId,fe=ft===void 0?void 0:o.value.find(qe=>qe.serverMessageId===ft||qe.id===ft);K&&ne?.senderRole!=="visitor"&&(he!==null||fe?.status==="streaming")&&(K=!1,Ie=!1);let at=!K&&(fe?.role==="assistant"||fe?.role==="operator");if(y.type==="text-delta"&&at&&wt(fe,Y,G,Te),y.type==="text-end"&&(pt(),at&&vt(fe,Y,G,Te)),y.type==="finish"&&y.canContinue===!1&&b(!1),!he){U&&(ee||!x.localSendRef.current)&&x.settle(J);return}if(he.role==="operator"){Ie||(C.play("messageReceived"),xr(h,a.current,"operator",Ve(he))),Ee(he,Pe,ie,Te),K=!1,U&&(ee||!x.localSendRef.current)&&x.settle(J);return}he.role==="assistant"&&(be(he,[],ee,J,Pe,ie,Te),K=!1)}async function ve(y){let U=G,J=await i.loadConversation(T,y?{ids:[y]}:void 0).catch(()=>null);if(A.signal.aborted||r.value!==T||!J)return!1;J.controlState&&c({type:"data-control-state",data:J.controlState});let ee=o.value.at(-1),ie=U===G&&(y===void 0||ee!==void 0&&(ee.serverMessageId===y||ee.id===y));if(J.messages.length===0)return!0;ie&&(Y=J.canContinue,b(Y));let Ie=o.value,Pe=y===void 0?Ie.at(-1):Ie.find(B=>B.serverMessageId===y||B.id===y),{messages:he,changed:ft}=mo(Ie,Tn(J.messages));if(!ft)return!0;o.value=he;let fe=y===void 0?he.at(-1):he.find(B=>B.serverMessageId===y||B.id===y),at=Pe!==void 0&&fe!==void 0&&(Pe.id===fe.id||Pe.serverMessageId!==void 0&&Pe.serverMessageId===fe.serverMessageId),qe=fe!==void 0&&fe.status!=="streaming"&&(!at||Pe?.status==="streaming"),zt=at&&Pe?.status==="streaming"?Date.now():fe?.createdAt;return ie&&qe&&fe.role==="assistant"?be(fe,fe.suggestions??[],x.localSendRef.current,void 0,J.canContinue,U,zt,!1):ie&&qe&&fe.role==="operator"?Ee(fe,J.canContinue,U,zt,!1):ie&&fe?.role==="assistant"&&fe.status!=="streaming"&&_(fe,fe.suggestions??[]),!0}let yt=new Set;M=({messageId:y})=>{if(yt.has(y)||!o.value.some(J=>J.serverMessageId===y||J.id===y))return;yt.add(y);function U(){return yt.delete(y)}ve(y).then(U,U)};function Ke(y=!1){if(A.signal.aborted||r.value!==T){Ue=!1;return}if(et){Ue=!0;return}let U=y?g(T)??(k()?ve():void 0):ve();if(!U)return;f(T),et=U;function J(ee=!1){if(et===U){if(et=void 0,Ue){Ue=!1,Ke();return}ee&&m(T)}}U.then(J,()=>J(!1))}let Dt=u.subscribe(y=>{y<=w.current||(w.current=y,ht&&Ke())});return _f({signal:A.signal,now:()=>performance.now(),sleep:y=>Dn(y,A.signal),connect:y=>i.connectResumeStream({signal:A.signal,onChunk:ot,onConnected:y}),onInitialBoundaryReady:()=>{ht=!0,Ke(!0)},backfill:()=>Ke()}),()=>{A.abort(),pt(),Dt(),N.detach()}},[t,n,r,r.value,s,i,c,p,_,d,u,f,m,v,x,P,b,o,h,C,g,k])}var _P=32;function mf(e){let{transport:t,setStreaming:n}=e,r=F(void 0),o=F(void 0),a=F(!1),i=F(void 0),s=F(!1),c=F(new Map),p=F(new Set),_=$((g,k)=>{let w=`${g}:${k}`;i.current!==w&&(i.current=w,t.cancelTurn(g,k))},[t]),d=$(g=>{r.current=void 0,o.current=g,a.current=!1,i.current=void 0,s.current=!0,n(!0)},[n]),u=$((g,k)=>{c.current.set(g,{messageId:k})},[]),f=$(g=>{g!==void 0&&(p.current.add(g),p.current.size>_P&&p.current.delete(p.current.values().next().value)),!(g!==void 0&&r.current?.runId!==g)&&(r.current=void 0,o.current=void 0,a.current=!1,s.current=!1,n(!1))},[n]),m=$((g,k)=>o.current!==g?k.runId&&r.current?.runId===k.runId?(r.current={conversationId:k.conversationId,runId:k.runId},a.current&&_(k.conversationId,k.runId),!0):!1:(o.current=void 0,k.runId?(r.current={conversationId:k.conversationId,runId:k.runId},n(!0),a.current&&_(k.conversationId,k.runId),!0):(f(),!0)),[_,n,f]),v=$((g,k)=>{let w=c.current.get(g);return w?(c.current.delete(g),!k.runId||p.current.has(k.runId)?!0:w.runId!==void 0?(w.runId!==k.runId||r.current?.runId===k.runId&&(r.current={conversationId:k.conversationId,runId:k.runId},a.current&&_(k.conversationId,k.runId)),!0):(s.current||o.current||(r.current={conversationId:k.conversationId,runId:k.runId},o.current=void 0,a.current=!1,i.current=void 0,s.current=!0,n(!0)),!0)):!1},[_,n]),x=$(g=>o.current!==g?!1:(f(),!0),[f]),P=$(g=>{let k=c.current.get(g);return k?(c.current.delete(g),k.runId===void 0):!1},[]),b=$((g,k,w,T)=>{let A=k.messageMetadata?.runId;if(k.messageMetadata?.senderRole!==void 0||typeof A!="string"||!A||p.current.has(A))return!1;if(r.current?.runId===A)return s.current;if(s.current)return r.current||!w?!1:(o.current=void 0,r.current={conversationId:g,runId:A},n(!0),a.current&&_(g,A),!0);let N=[...c.current.values()].filter(O=>O.runId===void 0).find(O=>O.messageId===T);return N?(N.runId=A,r.current={conversationId:g,runId:A},o.current=void 0,a.current=!1,i.current=void 0,s.current=!0,n(!0),!0):(o.current=void 0,r.current={conversationId:g,runId:A},n(!0),a.current&&_(g,A),s.current)},[_,n]),C=$(g=>typeof g=="string"&&r.current?.runId===g&&s.current,[]),h=$(()=>{let g=r.current;if(g)return a.current=!0,_(g.conversationId,g.runId),!0;let k=o.current;return k?(a.current=!0,k.then(w=>{w.runId&&_(w.conversationId,w.runId)}).catch(()=>{}),!0):!1},[_]);return ue(()=>({localSendRef:s,begin:d,beginRouted:u,acceptAck:m,acceptRoutedAck:v,reject:x,rejectRouted:P,captureStart:b,ownsLocalRun:C,settle:f,stop:h}),[m,v,d,u,b,C,x,P,f,h])}var fP=Z.scope("send");function hf(e,t,n,r,o,a=!0){e.publishConversation({...Fa(t,n,r,o,a),hasUnread:!1},!0)}function vf(e,t){return e.id===t.id||(e.serverMessageId??e.id)===(t.serverMessageId??t.id)}function yf(e){return e.findLast(t=>!t.ephemeral&&t.role!=="system"&&(t.role==="user"||t.status!=="streaming"||Gt(t)))}function Ao(e,t,n,r,o){let a=yf(t);a?.role!=="user"||!vf(a,n)||hf(e,t,a,r,o)}function gf(e){return!(e instanceof ut)||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 bf(e){let{transport:t,messagesSig:n,conversationIdSig:r,options:o,bus:a,feedback:i,persistence:s,visitorId:c,adoptConversationId:p,applyControlState:_,setCanSend:d,settleSuggestions:u,runCancellation:f}=e,m=$(()=>{let P=r.value??It();return r.value||(r.value=P,s.saveConversationId(P)),P},[r,s]),v=$(async({continueExisting:P,turn:b})=>{let C=m(),h=n.value.at(-1),g=b?[b]:Hd(n.value,P),k=g[0];k?.role==="user"&&Tt.markSent(k.id);let w=g.map(rl),T=s.loadUserPrefs(),A=Zo(o.tools).then(M=>t.sendTurn(Zs({messages:w,conversationId:C,visitorId:c,userPrefs:T,clientTools:cs(M)}),{keepalive:P}));f.begin(A);try{let M=await A;if(r.value!==C||!f.acceptAck(A,M))return!1;if(p(M.conversationId),M.runId&&k?.role==="user"&&Ao(t,n.value,k,M.conversationId,o.strings.newConversation),!M.runId){let N=await t.loadConversation(M.conversationId).catch(()=>null);if(r.value!==M.conversationId)return!0;if(N){N.controlState&&_(N.controlState),d(N.canContinue);let O=Tn(N.messages),{messages:z,changed:V}=mo(n.value,O);V&&(n.value=z);let K=O.findLast(Y=>!Y.ephemeral&&Y.role!=="system"),ne=yf(n.value);ne&&K&&vf(ne,K)&&hf(t,n.value,ne,M.conversationId,o.strings.newConversation,N.canContinue);let G=h?n.value.find(Y=>Y.id===h.id&&Y.role==="assistant"&&Y.status!=="streaming"):void 0;G&&u(G,G.suggestions??[]),!P&&h?.role==="assistant"&&n.value.includes(h)&&h.serverMessageId===void 0&&!Gt(h)&&(n.value=n.value.filter(Y=>Y!==h))}else h?.role==="assistant"&&n.value.includes(h)&&(h.status="error",h.errorText=o.strings.errorGeneric,P?h.retryAction={kind:"continue-assistant",messageId:h.serverMessageId??h.id}:h.retryAction=k?.role==="user"?{kind:"resend-user",messageId:k.id}:null,n.value=[...n.value])}return!0}catch(M){if(r.value!==C)return!1;if(!f.reject(A))return k?.role==="user"&&Ao(t,n.value,k,C,o.strings.newConversation),!0;let N=Jn(M,o.strings),O=gf(M),z=b?.role==="assistant"?b:n.value.at(-1);if(P&&z?.role==="assistant"&&M instanceof ut&&M.status===409){let V=z.serverMessageId??z.id,K=await t.loadConversation(C,{ids:[V]}).catch(()=>null);if(r.value!==C)return!1;if(K){K.controlState&&_(K.controlState),d(K.canContinue);let ne=Tn(K.messages),G=ne.find(Y=>(Y.serverMessageId??Y.id)===V);if(G&&Vd(z,G)){let{messages:Y,changed:De}=mo(n.value,ne),_e=Y.find(Te=>(Te.serverMessageId??Te.id)===V);if(De&&_e&&_e!==z)return _e.awaitingContinuation=!1,_e.continuationStreaming=void 0,_e.retryAction=null,n.value=Y,_e.status!=="streaming"&&u(_e,_e.suggestions??[]),!0}}if(!n.value.includes(z)||z.status!=="streaming")return!1;z.continuationStreaming=!0}if(P&&z?.role==="assistant")z.status="error",z.errorText=N,z.retryAction=O?{kind:"continue-assistant",messageId:z.serverMessageId??z.id}:null,n.value=[...n.value];else if(h?.role==="assistant"&&n.value.includes(h)){h.status="error",h.errorText=N;let V=g[0];h.retryAction=O&&V?.role==="user"?{kind:"resend-user",messageId:V.id}:null,n.value=[...n.value]}else{let V=un();V.status="error",V.errorText=N;let K=g[0];V.retryAction=O&&K?.role==="user"?{kind:"resend-user",messageId:K.id}:null,n.value=[...n.value,V]}return i.play("error"),a.emit("error",M),o.onError?.(M),!1}},[t,n,o,a,i,s,c,p,_,d,u,m,f]),x=$(async P=>{let b=m();P.status="pending",P.errorText=void 0,P.retryAction=void 0,n.value.includes(P)&&(n.value=[...n.value]),Tt.markSent(P.id);let C=[rl(P)],h=s.loadUserPrefs(),g=Zo(o.tools).then(k=>t.sendTurn(Zs({messages:C,conversationId:b,visitorId:c,userPrefs:h,clientTools:cs(k)})));f.beginRouted(g,P.id);try{let k=await g;return r.value!==b?(f.rejectRouted(g),!1):f.acceptRoutedAck(g,k)?(p(k.conversationId),Ao(t,n.value,P,k.conversationId,o.strings.newConversation),P.status==="pending"&&(P.status="complete",n.value.includes(P)&&(n.value=[...n.value])),!0):!1}catch(k){let w=f.rejectRouted(g);if(r.value!==b)return!1;if(!w)return Ao(t,n.value,P,b,o.strings.newConversation),P.status==="pending"&&(P.status="complete",n.value.includes(P)&&(n.value=[...n.value])),!0;if(P.status!=="pending")return Ao(t,n.value,P,b,o.strings.newConversation),!0;fP.debug("operator-routed send failed",{error:k});let T=k instanceof Error?k:new Error(String(k));return P.status="error",P.errorText=Jn(k,o.strings),P.retryAction=gf(k)?{kind:"resend-user",messageId:P.id}:null,n.value.includes(P)&&(n.value=[...n.value]),i.play("error"),a.emit("error",T),o.onError?.(T),!1}},[t,n,o,a,i,s,c,p,m,f]);return{sendAiTurn:v,sendRoutedTurn:x}}var mP=Z.scope("unread");function Pf(e){let{transport:t,options:n,conversationIdSig:r,isConversationVisibleRef:o,activated:a,conversationReady:i}=e,s=Ot(!1),c=Ot(0),p=Ot(0),_=F([]),d=F(void 0),u=F(!1),f=$(()=>{let k=r.value,w=o.current()&&d.current===k?k:void 0,T=_.current.filter(A=>A.hasUnread&&A.conversationId!==w).length;c.value=T,s.value=T>0},[r,s,c,o]),m=$(k=>{let w=r.value,T=_.current.find(O=>O.conversationId===w),A=dn(_.current,k),M=A.find(O=>O.conversationId===w),N=k.type==="snapshot"&&w!==void 0&&M?.hasUnread===!0&&d.current===w&&T!==void 0&&T.lastMessageAt!==M.lastMessageAt;N&&(d.current=void 0),_.current=A,f(),N&&(p.value+=1)},[r,f,p]),v=$(()=>{if(f(),!o.current())return;let k=r.value;if(!k||d.current!==k)return;let w=_.current.find(T=>T.conversationId===k);w?.hasUnread&&t.markRead(k,w.lastMessageAt)},[r,o,f,t]),x=$(k=>{r.value===k&&(d.current=void 0,f())},[r,f]),P=$(k=>{r.value===k&&(d.current=k,v())},[r,v]),b=$(k=>d.current===k,[]),C=$((k=!1)=>{!n.history.enabled||!n.modules.list.some(w=>w.layout==="chat")||u.current||(u.current=!0,t.listConversations({limit:50},k).then(w=>{k||m({type:"snapshot",result:w,requestedRevision:0}),v()}).catch(w=>mP.debug("refreshUnread failed (non-fatal)",{err:w})).finally(()=>{u.current=!1}))},[m,v,n.history.enabled,n.modules,t]),h=$(k=>{let w=k.conversationId,T=o.current()&&r.value===w&&d.current===w,A=_.current.find(N=>N.conversationId===w),M=T&&(A?.lastMessageAt!==k.lastMessageAt||A.hasUnread);t.publishConversation({...k,hasUnread:!T},!0),M&&t.markRead(w,k.lastMessageAt)},[r,o,t]);D(()=>t.subscribeConversationChanges(m),[m,t]);let g=F(!1);return D(()=>{!a||!i||g.current||(g.current=!0,C())},[a,i,C]),D(()=>{if(!a)return;function k(){document.visibilityState==="visible"&&(v(),C(!0))}return document.addEventListener("visibilitychange",k),()=>document.removeEventListener("visibilitychange",k)},[a,v,C]),{hasUnreadSig:s,unreadCountSig:c,transcriptRecoverySig:p,markVisibleConversationRead:v,beginConversationTranscript:x,commitConversationTranscript:P,isConversationTranscriptCommitted:b,recordConversationReply:h}}var Mo=Z.scope("settings");function xf(e){let{options:t,persistence:n,transport:r,feedback:o,hostElement:a,bus:i}=e,s=n.loadUserPrefs(),[c,p]=H(()=>s.locale??t.locale),[_,d]=H(s.themeMode),u=_??t.themeMode,[f,m]=H(()=>s.textSize??t.textSize),v=$(g=>{n.patchUserPrefs(g),r.saveUserPrefs(n.loadUserPrefs()).catch(k=>Mo.warn("saveUserPrefs failed",{err:k}))},[n,r]);D(()=>{s.soundMuted!==void 0&&o.setMuted(s.soundMuted)},[]),D(()=>{if(u!=="host"){a.dataset.theme=u;return}return xu(g=>{a.dataset.theme=g})},[a,u,t]),D(()=>{a.dataset.textSize=f},[a,f,t]),D(()=>{let g=!0;return o.mutedSig.subscribe(k=>{if(g){g=!1;return}v({soundMuted:k})})},[o,v]);let x=lr(c,t.availableLocales,t.defaultLocale);D(()=>{r.setLocale(x)},[r,x]),D(()=>{a.dir=_c(x)?"rtl":"ltr"},[a,x]),D(()=>{x!==c&&p(x)},[x,c]);let P=$(g=>{Mo.info("localeChange",{locale:g}),p(g),v({locale:g}),i.emit("localeChange",g)},[v,i]),b=$(g=>{Mo.info("themeChange",{mode:g}),d(g),a.dataset.theme=g,v({themeMode:g}),i.emit("themeChange",g)},[a,v,i]),C=$(g=>{Mo.info("textSizeChange",{size:g}),m(g),a.dataset.textSize=g,v({textSize:g}),i.emit("textSizeChange",g)},[a,v,i]),h=$(()=>{o.toggleMuted();let g=o.mutedSig.value;Mo.info("soundToggle",{muted:g}),i.emit("soundToggle",{muted:g})},[o,i]);return{activeLocale:c,activeThemeMode:u,activeTextSize:f,effectiveLocale:x,setActiveLocale:p,setActiveThemeMode:d,setActiveTextSize:m,patchAndSync:v,handleLocaleChange:P,handleThemeChange:b,handleTextSizeChange:C,handleSoundToggle:h}}var ye=Z.scope("app"),yi=E.cssPrefix,gP={home:"home",chats:"chat",help:"help",news:"news"};function Sf(e,t){return Ud({...e,text:bt(t,e.text)})}function kf({options:e,hostElement:t,bus:n,recentHostEvents:r}){let o=e.aiAgentDeploymentId;if(!o)throw new Error("aiAgentDeploymentId is required");let[a]=H(()=>kn(e.widgetId,e.storage,e.aiAgentDeploymentId)),[i]=H(()=>a.getVisitorId()),s=a.loadUserPrefs(),c=Ot(a.loadConversationId()),p=F(c.value!==void 0),_=Ot(c.value??""),d=Ot([]),[u,f]=H(!1),m=F(void 0),[v,x]=H([]);function P(){let S=e.modules.list,R=new Set(S.map(j=>j.id)),X=a.loadActiveModule();return X&&R.has(X)?X:S[0]?.id??""}function b(){return e.modules.list.find(S=>S.layout==="chat")?.id}function C(){let S=b();return S?e.modules.list.length===1?!0:g.sig.value.activeTab===S:!1}let h=F(void 0);if(!h.current){let S=e.modules.list.map(X=>X.id),R=a.loadActiveModule()??S[0]??"";h.current=ip(R,R?[...S,R]:S,X=>a.saveActiveModule(X))}let g=h.current,k=Et(()=>g.sig.value.activeTab).value,w=Et(()=>c.value).value,[T,A]=H(!1),[M,N]=H(null),[O,z]=H(!1),V=e.mode==="standalone"||e.mode==="inline",K=F(vo(e,Sr(),a.loadPanelOpen(),a.loadPanelSize())),[ne,G]=H(K.current.panelOpen),[Y,De]=H(K.current.panelOpen),_e=F(void 0),Te=F(void 0),et=F(!1),Ue=F(void 0);D(()=>{ne&&De(!0)},[ne]);let ht=F(!1),[Ge,vt]=H(!1),{dismissed:St,dismissCallout:pt}=of({callout:e.launcher.callout,persistence:a}),kt=e.launcher.callout?.persistent??!0,wt=$(()=>{ye.info("calloutDismiss"),n.emit("calloutDismiss",void 0),pt()},[n,pt]),[Ee,He]=H(K.current.panelSize),be=F(!1),[ot,ve]=H("chat"),yt=F(()=>!1);yt.current=()=>ne&&ot==="chat"&&!document.hidden&&C();let[Ke,Dt]=H(!0),y=F(Ke);y.current=Ke;let[U,J]=H(!1),ee=F(U);ee.current=U;let ie=F(null),[Ie,Pe]=H(!1),[he,ft]=H(null),[fe,at]=H([]),qe=F(e.strings),zt=F(e);zt.current=e;let[B,Q]=H(void 0),[te,me]=H(void 0),[it,jt]=H(()=>a.loadSidebarCollapsed()??!1),[en,Lt]=H({}),[ce]=H(()=>new za({agentApiBaseUrl:e.agentApiBaseUrl,dataApiBaseUrl:e.dataApiBaseUrl,auth:Ku({publicKey:e.publicKey,aiAgentDeploymentId:o,publicKeyHeader:"x-public-key"}),endpoints:e.endpoints,recentHostEvents:r})),[Nt]=H(()=>new ya(e.sound,e.haptics)),fn=mf({transport:ce,setStreaming:J}),{activeLocale:Lo,activeThemeMode:Ol,activeTextSize:$l,effectiveLocale:tr,setActiveLocale:Nf,setActiveThemeMode:Of,setActiveTextSize:$f,patchAndSync:Dl,handleLocaleChange:Df,handleThemeChange:Ff,handleTextSizeChange:Bf,handleSoundToggle:Uf}=xf({options:e,persistence:a,transport:ce,feedback:Nt,hostElement:t,bus:n}),{controlModeSig:Kt,assignedOperatorInitialsSig:Hf,operatorAvailableSig:qf,applyControlState:$r,adoptControlStateChunk:zf,requestOperator:jf,cancelOperatorRequest:Vf}=af({transport:ce,conversationIdSig:c}),mn=Ot(new Map),Wf=$(S=>{if(S.type!=="data-memory-compaction-state")return;let R=c.value;if(!R)return;let X=Fd(S.data);if(!X)return;let j=mn.value.get(R);if(j&&(X.postFinishSequence<j.postFinishSequence||X.postFinishSequence===j.postFinishSequence&&(j.status==="ready"||j.status===X.status)))return;let ae=new Map(mn.value);ae.set(R,X),mn.value=ae},[c,mn]),{hasUnreadSig:Gf,unreadCountSig:Fl,transcriptRecoverySig:Kf,markVisibleConversationRead:Bl,beginConversationTranscript:Ti,commitConversationTranscript:nr,isConversationTranscriptCommitted:Ul,recordConversationReply:Qf}=Pf({transport:ce,options:e,conversationIdSig:c,isConversationVisibleRef:yt,activated:Y,conversationReady:T}),Xf=ne&&e.modules.byId[k]?.layout==="home",Jf=rf({transport:ce,options:e,persistence:a,enabled:T&&Xf});D(()=>{Bl()},[k,ne,ot,w,Bl]),D(()=>{Nt.update(e.sound,e.haptics)},[Nt,e.sound,e.haptics]),D(()=>()=>Nt.destroy(),[Nt]),D(()=>{be.current||!e.size.initialSize||(be.current=!0,!a.loadPanelSize()&&He(ul(e.mode,e.size,Sr())))},[e.mode,e.size,a]),D(()=>{if(!T||ht.current)return;ht.current=!0;let S=vo(e,Sr(),a.loadPanelOpen(),a.loadPanelSize());G(S.panelOpen),He(S.panelSize)},[T,e,a]);let rr=F(null);D(()=>{T&&g.reconcile(e.modules.list.map(S=>S.id),P())},[T,e.modules.list,g]);let No=$(S=>{!S||S.length===0||(d.value=S.map(R=>Sf(R,qe.current)))},[d]),Ii=F(null),Oo=$(async S=>{try{let{formSubmissions:R}=await(S?ce.bootstrap(S):Ii.current??ce.bootstrap()),X=new Map;return R.forEach((j,ae)=>X.set(j.formId,ae)),R.filter((j,ae)=>!j.skipped||X.get(j.formId)===ae).map((j,ae)=>({key:`wire:${j.formId}:${j.createdAt??ae}`,formId:j.formId,outcome:j.skipped?"skipped":"submitted",createdAt:Od(j.createdAt),values:j.values}))}catch(R){return ye.debug("bootstrap failed \u2014 no form markers (non-fatal)",{err:R}),[]}},[ce]),Dr=F(0),tn=F(0),Ri=$(S=>{if(S===c.value)return;let R=c.value;tn.current++,f(!1),R&&(a.saveDraft(S,a.loadDraft(R)),a.saveDraft(R,""),a.saveMessageQueue(S,a.loadMessageQueue(R)),a.saveMessageQueue(R,[])),c.value=S,a.saveConversationId(S),ce.primeIdentity(void 0,S),ye.info("conversation rebound",{previous:R,current:S}),R&&n.emit("conversationRebound",{previous:R,current:S})},[n,c,a,ce]),$o=$((S,R)=>{let X=[...S.map(W=>W.createdAt),...R.map(W=>W.createdAt)].filter(W=>W!==void 0),j=(X.length?Math.min(...X):Date.now())-1;return[...(Ue.current?.messages??[]).map(W=>{let se=Sf(W,qe.current);return se.createdAt=j,se}),...S]},[]),Hl=$(async S=>{let R=tn.current;function X(){return R!==tn.current||c.value!==S}Te.current===S&&(Te.current=void 0),f(!0);try{let[j,ae]=await Promise.all([ce.loadConversation(S),Oo()]);if(X())return!1;let W=Tn(j.messages);x(ae);let se=$o(il(W,d.value),ae);if(d.value=se,Te.current=se.some(we=>we.role==="user")?void 0:S,W.length>0||j.controlState!==void 0){Dt(j.canContinue),j.controlState&&$r(j.controlState);let we=W.findLast(_t=>_t.role==="assistant"&&!_t.ephemeral);at(we?.suggestions??[])}return!0}catch(j){return X()||(ye.warn("loadThread failed; keeping conversation active",{err:j,conversationId:S}),n.emit("error",j),zt.current.onError?.(j)),!1}finally{X()||f(!1)}},[ce,Oo,d,c,$o,n]),Yf=$(S=>{if(_e.current===S)return _e.current=void 0,Hl(S)},[Hl]),Zf=$(()=>{if(m.current)return Promise.resolve(void 0);let S=c.value,R=d.value.find(se=>se.serverMessageId!==void 0),X=R?.serverMessageId,j=R?new Date(R.createdAt).toISOString():void 0;if(!S||!X||!j)return Promise.resolve(void 0);let ae=tn.current,W={};return m.current=W,(async()=>{try{let se=await ce.loadConversation(S,{beforeId:X,beforeCreatedAt:j});if(m.current!==W||tn.current!==ae||c.value!==S)return;if(se.messages.length===0)return!1;let xe=se.messages.map(nl),we=d.value,_t=zd(we,xe);if(_t!==we){let nn=Math.min(...xe.map(Ct=>Ct.createdAt??1/0),...v.map(Ct=>Ct.createdAt??1/0));if(Number.isFinite(nn))for(let Ct of we){if(!Ct.ephemeral)break;(Ct.createdAt??1/0)>=nn&&(Ct.createdAt=nn-1)}d.value=_t}return!0}catch(se){if(m.current!==W||tn.current!==ae||c.value!==S)return;ye.warn("load previous messages failed",{err:se,conversationId:S,beforeId:X}),n.emit("error",se),e.onError?.(se);return}finally{m.current===W&&(m.current=void 0)}})()},[n,c,v,d,e,ce]),Fr=$(async({newConversation:S})=>{let R=++Dr.current;function X(){return R!==Dr.current}let j=c.value,ae=S||!j?It():j;ae!==j&&(tn.current++,f(!1),Bt(()=>{c.value=ae,_.value=ae}),a.saveConversationId(ae)),ce.primeIdentity(i,ae);let W;try{W=await ce.handshake({visitorId:i,conversationId:ae,userPrefs:a.loadUserPrefs(),locale:Lo})}catch(we){if(X())return;n.emit("error",we),e.onError?.(we),S||A(!0);return}if(X())return;W.conversationId!==ae&&Ri(W.conversationId),ft(W.agent),W.site&&nd(W.site)?Q(W.site):W.site&&ye.warn("invalid site config, using fallback",{site:W.site}),W.blocks&&rd(W.blocks)?me(W.blocks):W.blocks&&ye.warn("invalid blocks config, using fallback",{blocks:W.blocks});let se=bs(W.userPrefs);if(Object.keys(se).length>0&&!S&&(a.saveUserPrefs(se),se.locale&&Nf(se.locale),se.soundMuted!==void 0&&Nt.setMuted(se.soundMuted),se.themeMode&&Of(se.themeMode),se.textSize&&$f(se.textSize)),Ue.current=W.welcome,S||n.emit("handshake",W),W.welcome?.suggestions){let we=qe.current;at(W.welcome.suggestions.map(_t=>({..._t,label:bt(we,_t.label),..._t.text===void 0?{}:{text:bt(we,_t.text)}})))}let xe=!S&&j&&W.conversationId===j;p.current=!!xe,xe?et.current||(_e.current=W.conversationId):(Te.current=W.conversationId,No(W.welcome?.messages),nr(W.conversationId)),S||A(!0)},[ce,i,a,e,n,c,_,Nt,No,Lo,Ri,nr]),Br=JSON.stringify(e.userContext??null),em=JSON.stringify(e.pageContext??null),tm=JSON.stringify(en);D(()=>{let S=Object.keys(en).length?{...en,...e.userContext}:e.userContext;ce.setContext(S,hP(e.pageContext))},[ce,Br,em,tm]),D(()=>ce.setUserToken(e.userToken),[ce,e.userToken]);let ql=$((S,R=[])=>at(S.suggestions??R),[]);D(()=>(ce.primeIdentity(i,c.value),Fr({newConversation:!1}),()=>{Dr.current++,tn.current++}),[]),D(()=>{!Y||!T||et.current||(et.current=!0,Ii.current=ce.bootstrap(),(async()=>{try{let S=await Ii.current;N(Vr((S??{forms:[]}).forms,tr))}catch(S){ye.debug("bootstrap failed \u2014 treating as no forms",{err:S})}finally{z(!0)}})(),_e.current===c.value&&f(!0))},[Y,T]);let Ur=F(null);D(()=>{if(!Y||!T||(Ur.current??(Ur.current=tr),Ur.current===tr))return;Ur.current=tr;let S=!1;return ce.bootstrap().then(R=>{S||N(Vr((R??{forms:[]}).forms,tr))}).catch(R=>ye.debug("forms re-localize failed \u2014 keeping current copy",{err:R})),()=>{S=!0}},[Y,T,tr,ce]);let zl=F(Br);D(()=>{!T||zl.current===Br||(zl.current=Br,Fr({newConversation:!1}))},[Br,T,Fr]),cf({hostElement:t,mode:e.mode,panelSize:Ee,isOpen:ne,surfaceReady:T,setIsOpen:G});let{sendAiTurn:gn,sendRoutedTurn:or}=bf({transport:ce,messagesSig:d,conversationIdSig:c,options:e,bus:n,feedback:Nt,persistence:a,visitorId:i,adoptConversationId:Ri,applyControlState:$r,setCanSend:Dt,settleSuggestions:ql,runCancellation:fn}),{toolInteraction:nm,pageToolsRunning:Ei,stopPageTools:jl}=nf({streaming:U,controlModeSig:Kt,messagesSig:d,sendAiTurn:gn,bus:n,humanInLoop:e.features.humanInLoop,tools:e.tools}),rm=$((S,R)=>{let X=d.value.find(j=>j.serverMessageId===S);X&&(X.feedback=R),ye.info("messageFeedback",{messageId:S,value:R}),n.emit("messageFeedback",{messageId:S,value:R}),ce.submitFeedback({messageId:S,value:R})},[n,d,ce]);function om(){return d.value.reduce((S,R)=>S+(R.role==="user"?1:0),0)}let ar=e.forms.list.length>0?e.forms:M??e.forms,Fe=op({forms:ar,persistence:a,userContext:()=>e.userContext,messageCount:om,pageArea:()=>e.pageContext?.area?String(e.pageContext.area):void 0,conversationId:()=>c.value,onComplete:(S,R,X,j)=>{ye.info("formSubmit",{formId:S.id,trigger:R,skipped:j}),n.emit("formSubmit",{formId:S.id,values:X,skipped:j}),x(W=>{let xe=W.find(we=>we.formId===S.id&&we.outcome==="skipped")?.createdAt??Date.now();return[...W.filter(we=>!(we.formId===S.id&&we.outcome==="skipped")),{key:`local:${S.id}:${xe}`,formId:S.id,outcome:j?"skipped":"submitted",createdAt:xe,...j?{}:{values:X}}]});let ae=c.value??It();c.value||(c.value=ae,a.saveConversationId(ae),ce.primeIdentity(void 0,ae)),!j&&S.mirrorToContext&&Lt(W=>({...W,...X})),ce.submitForm({formId:S.id,conversationId:ae,trigger:R,values:X,skipped:j})}}),Vl=Et(()=>Fe.activeForm.value),Do=Vl.value?.form.blocking??!1,am=$(()=>Fe.fire("after-messages"),[Fe]),im=$(()=>p.current||d.value.some(S=>!S.ephemeral&&S.role==="user"),[d]);ff({activated:Y,conversationReady:T,conversationIdSig:c,messagesSig:d,optionsRef:zt,transport:ce,visitorId:i,adoptControlStateChunk:zf,adoptMemoryCompactionStateChunk:Wf,settleSuggestions:ql,recordConversationReply:Qf,transcriptRecoverySig:Kf,beginConversationTranscript:Ti,commitConversationTranscript:nr,onReplyLanded:am,runCancellation:fn,canContinueRef:y,setCanSend:Dt,feedback:Nt,bus:n,loadInitialThread:Yf,shouldReconcileOnConnect:im}),D(()=>{Fe.refresh()},[ar,Fe]);let Wl=e.pageContext?.area?String(e.pageContext.area):void 0,sm=Et(()=>d.value.length),Fo=F(null);D(()=>{!O||!Fo.current||(Fe.fire("manual",Fo.current),Fo.current=null)},[O,Fe]),D(()=>{T&&O&&Fe.fire("pre-chat")},[T,O,Fe]),D(()=>{O&&!Ke&&Fe.fire("conversation-closed")},[O,Ke,Fe]),D(()=>{T&&O&&Wl&&Fe.fire("page-area")},[T,O,Wl,Fe]);let Ai=ue(()=>{let S=ar.list.flatMap(R=>R.triggers).filter(R=>R.kind==="idle").map(R=>Number(R.param));return S.length?Math.min(...S)*1e3:0},[ar]);D(()=>{if(!Ai||!ne)return;let S=setTimeout(()=>Fe.fire("idle"),Ai);return()=>clearTimeout(S)},[Ai,ne,Fe,sm.value]);let ir=$(async(S,R,X)=>{if(ie.current)return!1;let j=c.value,ae=j?mn.value.get(j):void 0,W=Kt.value!=="ai-agent";if(!W&&ae?.status==="compacting"||(ye.info("send",{textLen:S.length,attachments:R.length,streaming:ee.current,routedToOperator:W}),ee.current&&!W))return!1;let se=new AbortController,xe={conversationId:j,controller:se};ie.current=xe,Pe(!0);try{Nt.unlock();let we=await yP(ce,R,se.signal,hn=>{se.signal.aborted||(ye.warn("upload failed",{err:hn}),n.emit("error",hn),e.onError?.(hn))});if(se.signal.aborted||c.value!==j||!y.current||Fe.activeForm.value?.form.blocking)return!1;let _t=j?mn.value.get(j):void 0,nn=Kt.value!=="ai-agent";if(!nn&&_t?.status==="compacting"||ee.current&&!nn||!S&&we.length===0)return!1;n.emit("send",{text:S,attachmentCount:R.length}),fe.length>0&&at([]),Nt.play("messageSent");let Ct=tl(S,we,X);return xr(n,e,"user",S),nn?(d.value=[...d.value,Ct],X?await or(Ct):(or(Ct),!0)):(d.value=[...d.value,Ct,un()],X?await gn({continueExisting:!1}):(gn({continueExisting:!1}),!0))}finally{ie.current===xe&&(ie.current=null,Pe(!1))}},[ce,n,e,fe.length,d,c,mn,gn,or,Kt]),Gl=F(ir);Gl.current=ir;let Kl=c.value,Ql=(Kl?mn.value.get(Kl):void 0)?.status==="compacting",Mi=Kt.value==="ai-agent",Xl=Et(()=>{let S=d.value.at(-1);return S?.role==="assistant"&&S.partsSig.value.some(R=>R.kind==="tool"&&R.stateSig.value==="approval-requested")}),Jl=Et(()=>d.value.some(S=>S.retryAction?.kind==="resend-user"||S.retryAction?.kind==="continue-assistant"));Rt(()=>{let S=c.value;return()=>{let R=ie.current;!R||R.conversationId!==S||(ie.current=null,Pe(!1),R.controller.abort())}},[c.value]),D(()=>{Ke&&!Do||ie.current?.controller.abort()},[Do,Ke]);let lm=$(()=>{if(Ei){ye.info("stop page tools"),n.emit("stop",void 0),jl();return}if(!fn.stop())return;ye.info("stop"),n.emit("stop",void 0);let S=d.value.at(-1);S&&S.role!=="user"&&S.status==="streaming"&&(S.canceled=!0,d.value=[...d.value])},[fn,n,d,Ei,jl]),cm=$(S=>{if(U)return;let R=d.value,X=qa(R,S);if(X)switch(ye.info("retry",{kind:X.kind,messageId:X.messageId}),X.kind){case"continue-assistant":{if(Kt.value!=="ai-agent"||S.role!=="assistant"||(S.serverMessageId??S.id)!==X.messageId)return;S.status="streaming",S.errorText=void 0,S.retryAction=void 0,S.awaitingContinuation=!0,d.value=[...R],gn({continueExisting:!0,turn:S});return}case"resend-user":{let j=R.find(se=>se.role==="user"&&se.id===X.messageId);if(!j)return;let ae=se=>{se&&rr.current?.acceptQueuedMessage(X.messageId)};if(j.status="complete",j.errorText=void 0,j.retryAction=void 0,Kt.value!=="ai-agent"){d.value=S.role==="assistant"?R.filter(se=>se!==S):[...R],or(j).then(ae);return}let W=un();d.value=S.role==="assistant"?R.map(se=>se===S?W:se):[...R,W],gn({continueExisting:!1,turn:j}).then(ae);return}case"repeat-user":{let j=R.find(xe=>xe.role==="user"&&xe.id===X.messageId);if(!j)return;let ae=tl(Ve(j),j.attachments?.map(xe=>({...xe}))??[]),W=new Set(ae.attachments?.flatMap(xe=>xe.url?[xe.url]:[])??[]),se=j.partsSig.value.flatMap(xe=>xe.kind==="file"&&!W.has(xe.url)?[{...xe}]:[]);if(se.length>0&&(ae.partsSig.value=[...ae.partsSig.value,...se]),Kt.value!=="ai-agent"){d.value=[...R,ae],or(ae);return}d.value=[...R,ae,un()],gn({continueExisting:!1,turn:ae});return}default:return X}},[U,d,Kt,gn,or]),Hr=$(()=>{if(rp(e.mode,Ee)==="exit-fullscreen"){ye.info("close \u2192 exit-fullscreen",{mode:e.mode}),He("normal"),n.emit("fullscreen",!1);return}ye.info("close \u2192 panel closed",{mode:e.mode}),Fe.fire("panel-close"),G(!1),a.savePanelOpen(!1),n.emit("close",void 0),e.onClose?.()},[n,e,a,Ee,Fe]),Mn=$(()=>{ye.info("open",{mode:e.mode}),Nt.unlock(),vt(!0),G(!0),a.savePanelOpen(!0),!St&&!kt&&wt(),setTimeout(()=>vt(!1),vP),n.emit("open",void 0),e.onOpen?.()},[n,e,Nt,a,St,kt,wt]),Li=$(()=>{let S=d.value.some(R=>R.role==="user");if(Te.current===c.value&&!S&&Ke&&c.value){ye.info("clear \u2192 reusing empty conversation",{conversationId:c.value}),d.value.length===0&&No(Ue.current?.messages);return}return ye.info("clear \u2192 new conversation",{wasStreaming:U}),n.emit("clear",void 0),fn.settle(),p.current=!1,_e.current=void 0,Te.current=void 0,Bt(()=>{d.value=[],c.value=void 0,$r({controlMode:"ai-agent",controlRevision:0})}),a.clearConversation(),Dt(!0),x([]),at([]),Fr({newConversation:!0})},[U,d,c,a,Fr,n,Ke,No,fn,$r]),Bo=$(()=>{let S=Li();ve("chat");let R=e.modules.list.find(X=>X.layout==="chat")?.id;return R&&g.switchTab(R),S},[Li,g,e]),um=$(async S=>{await Bo(),await Gl.current(S,[])||rr.current?.fill(S)},[Bo]),Ni=$(()=>{let S=Ee==="expanded"?"normal":"expanded";ye.info("expand",{from:Ee,expanded:S==="expanded"}),He(S),a.savePanelSize(S),n.emit("expand",S==="expanded")},[n,Ee,a]),Oi=$(()=>{let S=Ee==="fullscreen"?"normal":"fullscreen";ye.info("fullscreen",{from:Ee,fullscreen:S==="fullscreen"}),He(S),a.savePanelSize(S),n.emit("fullscreen",S==="fullscreen")},[n,Ee,a]),dm=$(()=>{ve(S=>{let R=S==="history"?"chat":"history";return ye.info("toggleHistory",{view:R}),n.emit("toggleHistory",{view:R}),R})},[n]),pm=$(()=>{jt(S=>{let R=!S;return ye.info("sidebarToggle",{collapsed:R}),a.saveSidebarCollapsed(R),n.emit("sidebarToggle",{collapsed:R}),R})},[a,n]),_m=$(S=>{ye.info("resize",S),Dl({widgetSize:S}),n.emit("resize",S)},[Dl,n]),fm=$(async S=>{let R=S.conversationId;if(R===c.value&&Ul(R)){ye.info("selectConversation",{conversationId:R,cached:!0}),n.emit("selectConversation",{conversationId:R}),ce.publishConversation(S),ve("chat");let W=b();W&&g.switchTab(W),nr(R);return}let j=++Dr.current;tn.current++,f(!1);function ae(){return j!==Dr.current}ye.info("selectConversation",{conversationId:R,wasStreaming:U}),n.emit("selectConversation",{conversationId:R}),ce.publishConversation(S);try{let[W,se]=await Promise.all([ce.loadConversation(R),Oo(R)]);if(ae())return;fn.settle(),p.current=!0,_e.current=void 0;let xe=Tn(W.messages),we=W.conversationId!==c.value,_t=we?xe:il(xe,d.value);Te.current=_t.some(hn=>hn.role==="user")?void 0:W.conversationId,Bt(()=>{d.value=$o(_t,se),we&&(_.value=W.conversationId),c.value=W.conversationId}),x(se),a.saveConversationId(W.conversationId),ce.primeIdentity(i,W.conversationId),Dt(W.canContinue),W.controlState&&$r(W.controlState);let nn=_t.findLast(hn=>hn.role==="assistant"&&!hn.ephemeral);at(nn?.suggestions??[]),we?Ti(W.conversationId):nr(W.conversationId),ve("chat");let Ct=b();Ct&&g.switchTab(Ct)}catch(W){if(ae())return;n.emit("error",W),e.onError?.(W)}},[ce,d,c,_,n,e,a,Oo,$o,U,i,fn,Ti,nr,Ul,g]),Yl=$(S=>{if(typeof S!="string")return;ne||Mn(),ve("chat");let R=b();R&&g.switchTab(R),O?Fe.fire("manual",S):Fo.current=S},[ne,Mn,e.modules,g,O,Fe]),Uo=F(void 0),Ho=$(S=>{let R=e.modules.list.find(j=>j.layout===gP[S.to]);if(!R){ye.warn("open: the widget has no such tab",{to:S.to});return}let X=S.id&&(R.layout==="help"||R.layout==="news")?{kind:"content",id:S.id,title:""}:void 0;g.open(R.id,X)},[e.modules,g]),Zl=$(S=>{if(ne||Mn(),S!==void 0){if(!$c(S)){ye.warn("open: unknown target",{detail:S});return}T?Ho(S):Uo.current=S}},[ne,Mn,T,Ho]);D(()=>{!T||!Uo.current||(Ho(Uo.current),Uo.current=void 0)},[T,Ho]);let ec=T&&!u&&!Do&&(!Mi||!Xl.value&&!Jl.value),[Ln,$i]=H(),tc=$(S=>{let R=Dc(S);if(!R){ye.warn("ask: expected { text, send? } with non-empty text",{detail:S});return}ne||Mn(),$i(R)},[ne,Mn]),Di=ne&&O&&Ke&&T&&!u&&!Do,nc=Di&&ec&&!Ie&&!(Mi&&(U||Ql));D(()=>{if(Ln===void 0||!(Ln.send?nc:Di))return;let S=b();if(!S){ye.warn("ask: the widget has no chat"),$i(void 0);return}if(ot!=="chat"||!C()){ve("chat"),g.switchTab(S);return}if($i(void 0),!Ln.send){rr.current?.fill(Ln.text);return}ir(Ln.text,[]).then(R=>{R||rr.current?.fill(Ln.text)})},[Ln,Di,nc,ot,k,e.modules,g,ir]),D(()=>{if(e.widgetId!=="default")return;let S=`data-${E.cssPrefix}-`,R=["ask","open","close","form"].map(j=>S+j);function X(j){let ae=j.composedPath().find(we=>we instanceof Element&&R.some(_t=>we.hasAttribute(_t)));if(!(ae instanceof Element))return;j.preventDefault();let W=ae.getAttribute(`${S}ask`),se=ae.getAttribute(`${S}open`),xe=ae.getAttribute(`${S}form`);W!==null?st(t,"ask",on(W||(ae.textContent??""),{send:ae.hasAttribute(`${S}send`)})):se!==null?st(t,"open",Jo(se)):xe!==null?st(t,"openForm",xe):st(t,"close")}return document.addEventListener("click",X),()=>document.removeEventListener("click",X)},[e.widgetId,t]),D(()=>{if(e.widgetId!=="default")return;let S=Qu(location.href);S&&(history.replaceState(history.state,"",S.url),S.ask?st(t,"ask",on(S.ask)):st(t,"open",S.target))},[e.widgetId,t]);let rc=F(yn),oc=e.mode==="page"||e.mode==="inline"||e.mode==="standalone";D(()=>Wt(()=>{let S=c.value,R={open:oc||ne,ready:T,unread:Fl.value,...S?{conversationId:S}:{}},X=rc.current;R.open===X.open&&R.ready===X.ready&&R.unread===X.unread&&R.conversationId===X.conversationId||(rc.current=R,n.emit("state",R),R.unread!==X.unread&&n.emit("unread",R.unread))}),[n,oc,ne,T,Fl,c]);let Nn=F({handleOpenCommand:Zl,handleClose:Hr,handleExpand:Ni,handleFullscreen:Oi,openForm:Yl,handleAskCommand:tc});Nn.current={handleOpenCommand:Zl,handleClose:Hr,handleExpand:Ni,handleFullscreen:Oi,openForm:Yl,handleAskCommand:tc},Rt(()=>Bc(t,{open:S=>Nn.current.handleOpenCommand(S),close:()=>Nn.current.handleClose(),expand:()=>Nn.current.handleExpand(),fullscreen:()=>Nn.current.handleFullscreen(),openForm:S=>Nn.current.openForm(S),ask:S=>Nn.current.handleAskCommand(S)}),[t]);let mt=ue(()=>Ji(e,Lo,Ol,$l),[e,Lo,Ol,$l]);qe.current=mt.strings;let mm=ue(()=>v.map(S=>{let R=ar.list.find(X=>X.id===S.formId);return{...S,title:R?.title,form:R}}),[v,ar]);function Fi(S){fm(S)}let ac={options:mt,transport:ce,feedback:Nt,bus:n,persistence:a,conversationId:c.value??"",composerKey:_.value,composerApiRef:rr,view:ot,canSend:Ke,isStreaming:U,pageToolRunning:Ei,isMemoryCompacting:Ql,canReleaseQueuedMessages:ec,queueManualMessages:Mi&&(Xl.value||Jl.value),sendPreparing:Ie,composerActive:mt.mode==="page"||mt.mode==="inline"||mt.mode==="standalone"||ne,controlMode:Kt.value,assignedOperatorInitials:Hf.value,operatorAvailable:qf.value,operatorRequestEnabled:e.features.operatorRequest,onRequestOperator:jf,onCancelOperatorRequest:Vf,loadingMessages:u,onLoadPreviousMessages:Zf,messagesSig:d,agent:he,suggestions:fe,initialWidgetSize:s.widgetSize??null,onClose:Hr,onClear:Li,onExpand:Ni,onFullscreen:Oi,onSoundToggle:Uf,onToggleHistory:dm,onSelectHistoryConversation:Fi,onNewConversation:Bo,onLocaleChange:Df,onThemeChange:Ff,onTextSizeChange:Bf,onWidgetSizeChange:_m,onSend:ir,onStop:lm,onSuggestion:S=>{if(ie.current)return;let R=S.text??S.label;ye.info("suggestion",{text:R,autoSend:e.autoSendSuggestions}),n.emit("suggestion",{text:R}),e.autoSendSuggestions?ir(R,[]):rr.current?.fill(R)},activeForm:Vl.value?.form??null,formMarkers:mm,onFormSubmit:Fe.complete,onFormSkip:Fe.skip,onFormFill:S=>Fe.fire("manual",S),tool:nm,onRetry:cm,onMessageFeedback:rm};if(!T)return null;let qr=mt.modules.list;function Bi(S){let R=Pr("close",mt.mode,S);return qr.length===0?l(J_,{strings:mt.strings,onClose:R?Hr:void 0}):qr.length===1&&qr[0]?.layout==="chat"?l(Q_,{...ac,panelSize:S}):l(X_,{panelProps:{...ac,panelSize:S,onClose:R?Hr:void 0},enabledModules:qr,nav:g,bus:n,hasUnread:Gf.value,latestNews:Jf,onSelectConversation:Fi,onStartNewConversation:um,onSetPanelSize:He})}if(e.mode==="page"){let S=e.history.enabled&&qr.some(R=>R.layout==="chat");return l("div",{class:`${yi}-anchor`,children:l(ef,{site:B,blocks:te,transport:ce,strings:mt.strings,locale:mt.locale,persistence:a,showConversations:S,onSelectConversation:Fi,onNewConversation:Bo,sidebarCollapsed:it,onToggleSidebarCollapsed:pm,children:Bi("fullscreen")})})}if(V){let S=e.mode==="standalone"?"fullscreen":Ee;return l("div",{class:`${yi}-anchor`,children:Bi(S)})}let ic=e.mode==="drawer",sc=!(e.mode==="modal")&&!e.launcher.hidden&&(!ne||Ge),lc=sc&&!Ge&&!St&&!ic?mt.launcher.callout:null;return l("div",{class:`${yi}-anchor`,"data-launcher-size":mt.launcher.size,children:[ne||Y?l("div",{class:`${yi}-surface`,hidden:!ne,children:Bi(Ee)}):null,sc?l(Hp,{onToggle:Mn,launcher:mt.launcher,strings:mt.strings,leaving:Ge,edgeTab:ic}):null,lc?l(qp,{callout:lc,launcherPosition:mt.position,strings:mt.strings,closeLabel:mt.strings.close,onDismiss:wt}):null]})}function hP(e){let t=e?.url??(typeof location<"u"?location.href:void 0);if(!(!e&&!t))return{...e,...t?{url:t}:{}}}var vP=120;async function yP(e,t,n,r){return(await Promise.all(t.map(async a=>{try{let{id:i,url:s,originalName:c,mimeType:p,fileSize:_}=await e.uploadFile(a.file,n);return{id:i,name:c,mediaType:p,size:_,url:s}}catch(i){r(i);return}}))).filter(a=>a!==void 0)}var bP=Z.scope("error-boundary"),bi=class extends Ft{constructor(){super(...arguments);oe(this,"state",{crashed:!1})}componentDidCatch(n,r){bP.error("widget render crashed",{error:n,componentStack:r?.componentStack}),this.setState({crashed:!0}),this.props.onError(n,r?.componentStack)}render(){return this.state.crashed?this.props.fallback:this.props.children}};function Pi(e){let{bus:t,host:n,appRoot:r,persistence:o,reportError:a}=e,i=e.initialRaw,s,c=vn(i),p=!0,_=0,d=Hc(t);function u(){c=vn(s?Yi(i,s):i)}function f(){wu(n,Hn(c.mode));let P=o.loadUserPrefs().themeMode;Cu(n,P?{...c,themeMode:P}:c),p&&(ca(n,Al(c)),p=!1)}function m(){f(),Qt(Sn(bi,{onError:a},Sn(kf,{key:_,bus:t,hostElement:n,options:c,recentHostEvents:d})),r)}t.on("handshake",P=>{P.config&&(P.config.storageVersion&&o.rememberStorageVersion(P.config.storageVersion),s=P.config,u(),m())});let v=fu(t,{getOptions:()=>c,getVisitorId:()=>o.getVisitorId(),getConversationId:()=>o.loadConversationId()});function x(P={}){o.reset(),i={...i,userContext:void 0,userToken:void 0,...P},d.length=0,_+=1,p=!0,u(),m()}return{getOptions:()=>c,getUserOptions:()=>i,render:m,setUserOptions:P=>{i=P,u(),m()},patchUserOptions:P=>{let b="userToken"in P&&P.userToken!==i.userToken;if(b&&i.userToken){x(P);return}b&&(_+=1),i={...i,...P},u(),m()},reset:()=>x(),destroy:()=>v()}}function Al(e){if(e.mode==="standalone")return"standalone";if(e.mode==="inline")return"inline";let t=kn(e.widgetId,e.storage,e.aiAgentDeploymentId),{panelOpen:n,panelSize:r}=vo(e,Sr(),t.loadPanelOpen(),t.loadPanelSize());return Va(e.mode,r,n)}var PP=Z.scope("iframe"),xP='<!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 Tf(e,t,n="closed",r="floating",o=null){PP.debug("createIframeMount",{position:t,initialMode:n,layoutMode:r,hasTarget:!!o});let a=document.createElement("iframe");a.title=`${E.name} chat`,a.setAttribute("allow","microphone; clipboard-write"),Cf(a,t,n,r),(r==="inline"&&o?o:document.body).appendChild(a);let s=a.contentDocument;if(!s)throw new Error("iframe contentDocument unavailable (cross-origin?)");s.open(),s.write(xP),s.close();let c=_r({...e,target:s.body}),p=new MutationObserver(()=>{Cf(a,t,c.hostElement.dataset.mode??"closed",r)});return p.observe(c.hostElement,{attributes:!0,attributeFilter:["data-mode"]}),{...c,iframeElement:a,destroy(){p.disconnect(),c.destroy(),a.remove()}}}var xi="border:0;background:transparent;z-index:2147483647;pointer-events:auto;",wf={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 Cf(e,t,n,r){if(n==="fullscreen"||r==="standalone"){e.style.cssText=`${xi}position:fixed;inset:0;width:100vw;height:100vh;`;return}if(r==="inline"){e.style.cssText=`${xi}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=`${xi}position:fixed;inset:0;width:100vw;height:100vh;`;return}let a=t.startsWith("top-")?"top":"bottom",i=t.endsWith("-left")?"left":"right",{w:s,h:c}=wf[n]??wf.open;e.style.cssText=`${xi}position:fixed;${a}:16px;${i}:16px;width:${s};height:${c};`}var _n=new Map;function Si(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");e.debug!==void 0&&Qo(e.debug);let t=Z.scope("mount");t.info("mount",{widgetId:e.widgetId,publicKey:e.publicKey,mode:e.presentation?.mode});let n=vn(e),r=n.widgetId,o=_n.get(r);o&&(t.debug("destroy existing instance at slot",{widgetId:r}),o.destroy());let a=Al(n),i=n.iframe?Tf({position:Hn(n.mode)},n.position,a,n.mode,e.target??null):_r({position:Hn(n.mode),target:e.target??null});i.hostElement.dataset.widgetId=r;let s=new cr,c=kn(r,n.storage,n.aiAgentDeploymentId);function p(b){s.emit("error",b),_.getOptions().onError?.(b)}let _=Pi({bus:s,host:i.hostElement,appRoot:i.appRoot,persistence:c,initialRaw:e,reportError:p}),d=yn,u=()=>{},f=new Promise(b=>{u=b});s.on("state",b=>{d=b,b.ready&&u()}),_.render();let m=i.hostElement,v=null;function x(b){b.debug!==void 0&&Qo(b.debug),_.patchUserOptions(b)}let P={widgetId:r,open:b=>st(m,"open",b),close:()=>st(m,"close"),expand:()=>st(m,"expand"),openForm:b=>st(m,"openForm",b),ask:(b,C)=>st(m,"ask",on(b,C)),on:(b,C)=>s.on(b,C),update:b=>{t.debug("update",{patch:b}),x(b)},setUserContext:b=>{t.debug("setUserContext",{keys:Object.keys(b)}),x({userContext:{..._.getUserOptions().userContext,...b}})},clearUserContext:()=>{t.debug("clearUserContext"),x({userContext:void 0})},setPageContext:b=>{t.debug("setPageContext",{keys:Object.keys(b)}),x({pageContext:{..._.getUserOptions().pageContext,...b}})},clearPageContext:()=>{t.debug("clearPageContext"),x({pageContext:void 0})},get state(){return d},ready:f,reset:()=>{t.info("reset",{widgetId:r}),_.reset()},login:b=>{t.info("login",{widgetId:r}),x({userToken:b})},track:(b,C)=>{let h=ur(b,C);h&&s.emit("hostEvent",h)},registerTool:Fn,setDebug:b=>{Qo(b),t.info("debug level set",{level:zr()})},debugLevel:()=>zr(),onLog:b=>jr(b),destroy:()=>{t.info("destroy",{widgetId:r}),s.emit("state",yn),v?.(),_.destroy(),s.clear(),Qt(null,i.appRoot),i.destroy(),_n.get(r)===P&&_n.delete(r)}};return v=Oc(P,s),_n.set(r,P),P}function ki(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");let t=e.widgetId??"default",n=_n.get(t);return n?(n.update(e),n):Si(e)}function Ml(e){if(e!==void 0){_n.get(e)?.destroy();return}let t=[..._n.values()];for(let n of t)n.destroy()}function Mt(e="default"){return _n.get(e)??null}function If(){return[..._n.values()]}function wi(e,t,n){return rs(e,t,n)}var Rf=dr;var Ll=class extends HTMLElement{constructor(){super(...arguments);oe(this,"bus",new cr);oe(this,"widgetState",yn);oe(this,"userToken");oe(this,"pageTools",[]);oe(this,"markReady",()=>{});oe(this,"ready",new Promise(n=>{this.markReady=n}));oe(this,"mountResult",null);oe(this,"runtime",null)}static get observedAttributes(){return Zi}connectedCallback(){if(Object.hasOwn(this,"tools")){let n=Reflect.get(this,"tools");Reflect.deleteProperty(this,"tools"),this.pageTools=Array.isArray(n)?n:[]}this.boot()}disconnectedCallback(){this.mountResult&&(this.runtime?.destroy(),this.runtime=null,Qt(null,this.mountResult.appRoot),this.bus.clear(),this.widgetState=yn)}attributeChangedCallback(){this.isConnected&&this.boot()}open(n){st(this,"open",n)}close(){st(this,"close")}expand(){st(this,"expand")}openForm(n){st(this,"openForm",n)}ask(n,r){st(this,"ask",on(n,r))}get state(){return this.widgetState}reset(){this.userToken=void 0,this.runtime?.reset()}login(n){this.userToken=n,this.runtime?.patchUserOptions({userToken:n})}track(n,r){let o=ur(n,r);o&&this.bus.emit("hostEvent",o)}get tools(){return this.pageTools}set tools(n){this.pageTools=n,this.runtime?.patchUserOptions({tools:n})}registerTool(n,r){Fn(n,r)}on(n,r){return this.bus.on(n,r)}boot(){let n={...Xo(a=>this.getAttribute(a)),...this.userToken?{userToken:this.userToken}:{},tools:this.pageTools};if(!n.aiAgentDeploymentId)throw new Error("ai-agent-deployment-id is required");if(this.runtime){this.runtime.setUserOptions(n);return}let r=vn(n);this.mountResult??(this.mountResult=_r({existingHost:this,position:Hn(r.mode)}));let o=kn(r.widgetId,r.storage,r.aiAgentDeploymentId);this.bus.on("state",a=>{this.widgetState=a,a.ready&&this.markReady()}),this.runtime=Pi({bus:this.bus,host:this.mountResult.hostElement,appRoot:this.mountResult.appRoot,persistence:o,initialRaw:n,reportError:a=>this.bus.emit("error",a)}),this.runtime.render()}},Ef=!1;function Nl(){if(Ef||typeof customElements>"u")return;let e=E.tagName;customElements.get(e)||customElements.define(e,Ll),Ef=!0}typeof customElements<"u"&&Nl();var Af=Z.scope("iife");function SP(e){return typeof e=="string"||typeof e=="function"}function Ci(){return new Promise(e=>{let t=Mt();if(t){t.ready.then(()=>e(t));return}let n=wi("default","state",r=>{n(),r.ready.then(()=>e(r))})})}var Mf={ask:(e,t)=>typeof e=="string"?Mt()?.ask(e,on(e,t)):void 0,close:()=>Mt()?.close(),ready:e=>Ci().then(t=>typeof e=="function"?e(t):void 0),reset:()=>Mt()?.reset(),login:e=>{if(!SP(e))return;let t=Mt();return t?t.login(e):Ci().then(n=>n.login(e))},destroy:()=>Ml(),expand:()=>Mt()?.expand(),track:(e,t)=>{let n=ur(e,t);if(!n)return;let r=Mt();return r?r.track(n.name,n.data):Ci().then(o=>o.track(n.name,n.data))},hook:(e,t,n)=>typeof e=="string"&&typeof t=="string"&&typeof n=="function"?wi(e,t,n):void 0,init:e=>ki(e),mount:e=>Si(e),on:(e,t)=>Mt()?.on(e,t),onLog:e=>jr(e),registerTool:Fn,open:e=>Mt()?.open(e),setDebug:e=>Mt()?.setDebug(e),update:e=>Mt()?.update(e)};function Lf(e,...t){let n=Mf[e];if(!n){Af.warn("unknown command",{command:e});return}return n(...t)}function kP(){let e=((t,...n)=>Lf(t,...n));e.init=ki,e.mount=Si,e.destroy=Ml,e.getInstance=Mt,e.getAllInstances=If,e.version=Rf,e.ready=Ci,e.hook=wi,e.debugLevel=()=>zr(),e.onLog=jr,e.registerTool=Fn;for(let t of["ask","close","expand","login","on","open","reset","setDebug","track","update"])Reflect.set(e,t,Mf[t]);return e}function wP(e){let t=e?.q;if(t)for(let n of t){let r=[...n],[o,...a]=r;if(typeof o=="string")try{Lf(o,...a)}catch(i){Af.warn("queued command failed",{command:o,error:i})}}}function CP(){let e=[],t=e.push.bind(e);return e.push=(...n)=>(os(n),t(...n)),e}function TP(){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 IP(){if(typeof window>"u"||typeof document>"u")return;let e=globalThis[E.global],t=kP();globalThis[E.global]=t,Nl();let n=`${E.global}Hooks`,r=globalThis[n];if(os(r),globalThis[n]=CP(),wP(e),Mt())return;let o=document.currentScript??TP(),a=es(o?.dataset),i=a.aiAgentDeploymentId;if(!i)return;let s=()=>{Mt()||ki({...a,aiAgentDeploymentId:i})};if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",s,{once:!0});return}s()}IP();})();
64
+ `).trim(),V=!h&&t!=="error"&&!y.value&&B.length>0,X=a?Q_(v,{showReasoning:o,showSources:i}):v.map((ne,Pe)=>({kind:"part",part:ne,index:Pe})),pe=X_(v),J=e.canceled===!0||t==="error",ce=e.canceled===!0&&!h&&g.value&&P.value,ke=X.at(-1),be=ke?.kind==="steps"?ke.indices.at(-1):ke?.index;function Me(ne,Pe){return l(Jy,{part:ne,generativeUi:e.role==="assistant",live:b,current:b&&Pe===be,reasoningMs:e.stepTimings?.[pe[Pe]??-1]?.reasoningMs,strings:n,showReasoning:o,showToolCalls:a,showSources:i,interactive:s&&t==="complete"&&(ne.kind!=="tool"||za(e,Pe)),superseded:c,continuationStreaming:e.continuationStreaming===!0,stopped:J,tool:p},`${nP(ne)}#${Pe}`)}let Fe=j||V;return l("div",{class:`${Ne}-bubble-row`,"data-role":e.role,"data-testid":ft(L.messageBubble,e.serverMessageId??e.id),children:l("div",{class:`${Ne}-bubble-col`,children:[l("div",{class:`${Ne}-bubble`,children:[e.role==="operator"&&e.operatorInitials?l("span",{class:`${Ne}-bubble-author`,children:e.operatorInitials}):null,l("div",{class:`${Ne}-bubble-body`,children:[A?l(oP,{label:n.loading}):X.flatMap((ne,Pe)=>ne.kind==="part"?[Me(ne.part,ne.index)]:ne.parts.some(Oe=>Oe.kind==="tool")?[l(Y_,{parts:ne.parts,steps:ne.indices.map(Oe=>pe[Oe]??-1),stepTimings:e.stepTimings,timed:!J,strings:n,live:b,running:b&&Pe===X.length-1,stopped:J&&Pe===X.length-1,runStartedAt:e.runStartedAt},`steps#${ne.indices[0]}`)]:ne.parts.map((Oe,lt)=>Me(Oe,ne.indices[lt]??lt))),ce?l("div",{class:`${Ne}-steps-row`,"data-status":"stopped","data-testid":L.replyStopped,children:[l("span",{class:`${Ne}-steps-row-icon`,"aria-hidden":"true",children:l(pn,{})}),l("div",{class:`${Ne}-steps-row-main`,children:l("span",{class:`${Ne}-steps-stopped-label`,children:n.statusStopped})})]}):null,R&&!f&&l(rP,{}),t==="error"||y.value?l(Z_,{text:tP(e,t,n),retryLabel:n.errorRetry,onRetry:_?()=>_(e):void 0}):null,f&&b?l(Z_,{text:n.errorReconnecting}):null]})]}),E||Fe?l("div",{class:`${Ne}-bubble-meta`,children:[E?l("time",{class:`${Ne}-bubble-time`,dateTime:E.iso,title:E.full,children:E.short}):null,Fe?l("div",{class:`${Ne}-bubble-actions`,children:[j&&e.serverMessageId?l(O_,{messageId:e.serverMessageId,initial:e.feedback??null,strings:n,onFeedback:u}):null,V?l(Qy,{text:B,strings:n}):null]}):null]}):null]})})}function Qy({text:e,strings:t}){let[n,r]=H(!1);function o(){navigator.clipboard?.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)}).catch(()=>{})}let a=n?t.copied:t.copy;return l("button",{type:"button",class:`${Ne}-msg-action`,"data-active":n?"true":void 0,"aria-label":a,title:a,onClick:o,"data-testid":L.messageCopy,children:n?l(Yn,{}):l(qp,{})})}function Xy(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 Jy({part:e,generativeUi:t,live:n,current:r,reasoningMs:o,strings:a,showReasoning:i,showToolCalls:s,showSources:c,interactive:p,superseded:_,continuationStreaming:d,stopped:u,tool:f}){switch(e.kind){case"step-start":return null;case"text":return l(So,{textSig:e.textSig,doneSig:e.doneSig,generativeUi:t,strings:a});case"reasoning":return i?l(Al,{part:e,current:r,reasoningMs:o,strings:a,standalone:!0}):null;case"tool":return l(eP,{part:e,strings:a,showToolCalls:s,interactive:p,superseded:_,continuationStreaming:d,live:n,stopped:u,tool:f});case"file":return l(Yy,{part:e,strings:a});case"source":return c?l(U_,{part:e,strings:a}):null}}function Yy({part:e,strings:t}){let n=e.filename??t.file;if(e.mediaType.startsWith("image/"))return l("a",{class:`${Ne}-file-image`,href:e.url,target:"_blank",rel:"noreferrer noopener",title:n,"data-testid":L.messageFile,children:l("img",{src:e.url,alt:n,loading:"lazy"})});let r=(n.includes(".")?n.split(".").pop():e.mediaType.split("/").pop())?.toUpperCase(),o=e.fileSize===void 0?void 0:Zy(e.fileSize);return l("a",{class:`${Ne}-file-chip`,href:e.url,target:"_blank",rel:"noreferrer noopener",title:n,"data-testid":L.messageFile,children:[l("span",{class:`${Ne}-file-chip-icon`,"aria-hidden":"true",children:l(Xa,{})}),l("span",{class:`${Ne}-file-chip-text`,children:[l("span",{class:`${Ne}-file-chip-name`,children:n}),l("span",{class:`${Ne}-file-chip-meta`,children:[r,o].filter(Boolean).join(" \xB7 ")})]})]})}function Zy(e){let t=Math.min(Math.floor(Math.log10(Math.max(e,1))/3),2);return new Intl.NumberFormat(void 0,{style:"unit",unit:["byte","kilobyte","megabyte"][t],unitDisplay:"narrow",maximumFractionDigits:1}).format(e/1e3**t)}function eP({part:e,strings:t,showToolCalls:n,interactive:r,superseded:o,continuationStreaming:a,live:i,stopped:s,tool:c}){let p=le(()=>he(()=>e.approvalSig.value!==void 0),[e]),_=le(()=>he(()=>!mi(e)),[e]);return!n&&!_.value?null:c?.humanInLoop&&p.value?e.toolMetadata?.card==="questions"?l(W_,{part:e,strings:t,active:r,superseded:o,continuationStreaming:a,onDecision:c.onDecision,onEdit:c.onEdit}):l(q_,{part:e,strings:t,active:r,superseded:o,continuationStreaming:a,stopped:s,onDecision:c.onDecision,onEdit:c.onEdit}):n?l(K_,{part:e,strings:t,live:i,superseded:o,stopped:s}):null}function tP(e,t,n){return e.errorText?e.errorText:t==="error"&&e.role==="assistant"?n.errorServer:n.errorGeneric}function Z_({text:e,retryLabel:t,onRetry:n}){return l("div",{class:`${Ne}-error`,role:"alert",children:[l("span",{class:`${Ne}-error-icon`,"aria-hidden":"true",children:l(Gp,{})}),l("span",{class:`${Ne}-error-text`,children:e}),n&&t?l("button",{type:"button",class:`${Ne}-error-retry`,onClick:n,"data-testid":L.messageRetry,children:t}):null]})}function nP(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 rP(){return l("span",{class:`${Ne}-typing`,"data-testid":L.typingDots,"aria-hidden":"true",children:[l("span",{}),l("span",{}),l("span",{})]})}function oP({label:e}){return l("span",{class:`${Ne}-loading`,role:"status",children:[l("span",{class:`${Ne}-loading-spinner`,"aria-hidden":"true"}),l("span",{class:`${Ne}-loading-label`,children:e})]})}var _n=M.cssPrefix,Ml=120,aP=350;function tf({messagesSig:e,reconnectingSig:t,strings:n,responseMode:r,showReasoning:o,showToolCalls:a,showSources:i,enableMessageFeedback:s,onFeedback:c,loading:p,onLoadPreviousMessages:_,idle:d,controlMode:u="ai-agent",tool:f,onRetry:m,form:v,formMarkers:y,onFillForm:x}){let P=D(null),k=At(()=>e.value),[g,h]=H(!1),[b,w]=H(!1),A=D(!1),R=D(!1),[E,N]=H(),j=D(!1),B=D(!1),V=D(!1),X=D(0);function pe(){return V.current||performance.now()-X.current<aP}let J=D(0);function ce(C){let q=C.scrollHeight-C.clientHeight>1;C.dataset.fadeTop=q&&C.scrollTop>1?"true":"false",C.dataset.fadeBottom=q&&C.scrollHeight-C.scrollTop-C.clientHeight>1?"true":"false"}function ke(C){return h(C.scrollHeight-C.scrollTop-C.clientHeight>Ml*2)}function be(C){J.current=performance.now(),C.scrollTop=C.scrollHeight,ce(C)}function Me(C,q){be(C);let ae=q,re=0;function _e(){B.current||pe()||(be(C),--ae>0&&(re=requestAnimationFrame(_e)))}return q>0&&(re=requestAnimationFrame(_e)),()=>cancelAnimationFrame(re)}function Fe(C,q){let ae,re,_e,Re=-1;function Ie(){ae.disconnect(),re.disconnect(),clearTimeout(_e)}function $e(){if(B.current||pe()||Re>=0&&C.scrollTop<Re-4)return Ie();be(C),Re=C.scrollTop}return ae=new ResizeObserver($e),re=new MutationObserver($e),$e(),ae.observe(C),re.observe(C,{childList:!0,subtree:!0,characterData:!0}),_e=setTimeout(Ie,q),Ie}let ne=k.value[0]?.id;It(()=>{let C=P.current;if(C&&k.value.length!==0&&!R.current&&(j.current=!0,!!k.value.some(q=>q.role==="user")))return Fe(C,300)},[ne]);let Pe=D(0);$(()=>{let C=P.current,q=k.value,ae=Pe.current;if(Pe.current=q.length,!C||!j.current||R.current)return;if(q.slice(ae).some(_e=>_e.role==="user"))return B.current=!1,Me(C,3);if(!q.some(_e=>_e.role==="user")||B.current||pe())return;C.scrollHeight-C.scrollTop-C.clientHeight<Ml&&be(C)},[k.value.length]);let Oe=D(null);$(()=>{let C=P.current,q=k.value.at(-1),ae=Oe.current;if(Oe.current=q?{id:q.id,streaming:q.status==="streaming"}:null,!!C&&j.current&&!(!q||q.id!==ae?.id||ae.streaming||q.status!=="streaming"))return B.current=!1,Me(C,3)},[k.value]),$(()=>{let C=P.current;if(!C)return;let q=k.value.at(-1);if(!q||q.status!=="streaming"&&!k.value.some(_e=>_e.role==="user"))return;let ae=()=>{if(B.current||pe())return;C.scrollHeight-C.scrollTop-C.clientHeight<Ml*2&&be(C)};if(q.status!=="streaming")return Fe(C,300);ae();let re=new MutationObserver(ae);return re.observe(C,{childList:!0,subtree:!0,characterData:!0}),()=>re.disconnect()},[k.value]);let lt=v?.form.id,Bt=!!v&&(y??[]).some(C=>C.formId===v.form.id);It(()=>{let C=P.current;!C||!lt||B.current||k.value.some(q=>q.role==="user")&&(Bt?C.querySelector(`[data-testid="${L.formGate}"]`)?.scrollIntoView({block:"nearest"}):be(C))},[lt,Bt]),$(()=>{let C=P.current;if(!C)return;let q=()=>{ke(C),ce(C),performance.now()-J.current>150&&(B.current=C.scrollHeight-C.scrollTop-C.clientHeight>8)};function ae(){B.current=!0}function re(Be){Be.deltaY<0&&ae()}let _e=0;function Re(Be){_e=Be.touches[0]?.clientY??0,V.current=!0}function Ie(Be){(Be.touches[0]?.clientY??0)>_e+4&&ae()}function $e(){V.current=!1,X.current=performance.now()}function ye(){V.current=!0}return C.addEventListener("scroll",q,{passive:!0}),C.addEventListener("wheel",re,{passive:!0}),C.addEventListener("touchstart",Re,{passive:!0}),C.addEventListener("touchmove",Ie,{passive:!0}),C.addEventListener("touchend",$e,{passive:!0}),C.addEventListener("touchcancel",$e,{passive:!0}),C.addEventListener("pointerdown",ye,{passive:!0}),window.addEventListener("pointerup",$e,{passive:!0}),window.addEventListener("pointercancel",$e,{passive:!0}),ke(C),()=>{C.removeEventListener("scroll",q),C.removeEventListener("wheel",re),C.removeEventListener("touchstart",Re),C.removeEventListener("touchmove",Ie),C.removeEventListener("touchend",$e),C.removeEventListener("touchcancel",$e),C.removeEventListener("pointerdown",ye),window.removeEventListener("pointerup",$e),window.removeEventListener("pointercancel",$e)}},[]);function ot(){let C=P.current;C&&(B.current=!1,be(C))}let ht=k.value.filter(C=>!C.ephemeral),Nt=ht[0],vt=Nt?.serverMessageId??Nt?.id,Te=!!(_&&ht.length>=_l&&vt!==E);async function ct(){if(!_||A.current)return;let C=P.current,q=C?.scrollHeight??0,ae=C?.scrollTop??0;A.current=!0,R.current=!0,w(!0);try{let re=await _();re===!1&&vt&&N(vt),re&&C&&(await new Promise(_e=>requestAnimationFrame(()=>requestAnimationFrame(()=>_e()))),C.scrollTop=ae+C.scrollHeight-q,ce(C),ke(C))}finally{R.current=!1,A.current=!1,w(!1)}}let Se=[],qe="",ze=k.value.at(-1)?.id,Ot=t?.value===!0,Ve=[...y??[]].toSorted((C,q)=>(C.createdAt??1/0)-(q.createdAt??1/0));function Pt(C){return v&&C.formId===v.form.id?l(Cl,{form:v.form,strings:n,onSubmit:v.onSubmit,onSkip:v.onSkip},`gate:${C.formId}`):l(E_,{marker:C,strings:n,onFill:!v&&x?()=>x(C.formId):void 0},C.key)}function O(C){for(let q=Ve[0];q?.createdAt!==void 0&&!(C!==void 0&&q.createdAt>C);q=Ve[0])Ve.shift(),Se.push(Pt(q))}for(let C of k.value){if(C.role==="assistant"&&C.id!==ze&&Qn(C))continue;O(C.createdAt);let q=iP(C.createdAt);q&&q!==qe&&(Se.push(l("div",{class:`${_n}-date-divider`,children:l("span",{class:`${_n}-date-pill`,title:sP(C.createdAt),children:lP(C.createdAt,n)})},`day:${q}`)),qe=q);let re=C.retryAction!==void 0||C.role==="assistant"&&C.id===ze?Wa(k.value,C):void 0,_e=re!==void 0&&(re.kind!=="continue-assistant"||u==="ai-agent");Se.push(l(ef,{message:C,status:C.status,strings:n,responseMode:r,showReasoning:o,showToolCalls:a,showSources:i,interactive:!!d&&u==="ai-agent"&&C.id===ze,superseded:C.id!==ze,tool:f,onRetry:d&&_e&&(C.role==="user"||C.id===ze)?m:void 0,enableMessageFeedback:s,onFeedback:c,reconnecting:Ot&&C.id===ze},C.id))}for(let C of Ve)Se.push(Pt(C));return l("div",{class:`${_n}-list-wrap`,children:[l("div",{ref:P,class:`${_n}-list ${_n}-list--fade`,part:"messages",role:"log","aria-live":"polite","aria-relevant":"additions text",children:[p&&k.value.length===0?l("div",{class:`${_n}-list-loading`,role:"status",children:n.conversationLoading}):null,Te?l("div",{class:`${_n}-load-previous`,children:l("button",{type:"button",onClick:ct,disabled:b,"aria-busy":b,"data-testid":L.loadPreviousMessages,children:n.loadPreviousMessages})}):null,Se,v&&!Bt?l(Cl,{form:v.form,strings:n,onSubmit:v.onSubmit,onSkip:v.onSkip}):null]}),g?l("div",{class:`${_n}-jump-strip`,children:l("button",{type:"button",class:`${_n}-jump`,onClick:ot,"aria-label":n.scrollToBottom,title:n.scrollToBottom,"data-testid":L.scrollToBottom,children:l(Kt,{})})}):null]})}function iP(e){if(typeof e!="number"||!Number.isFinite(e))return"";let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function sP(e){if(typeof e!="number"||!Number.isFinite(e))return"";try{return new Date(e).toLocaleDateString(void 0,{dateStyle:"full"})}catch{return""}}function lP(e,t){let n=new Date(e);function r(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime()}let o=Math.round((r(new Date)-r(n))/864e5);return o<=0?t.dateToday:o===1?t.dateYesterday:o<7?n.toLocaleDateString(void 0,{weekday:"long"}):n.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"})}function gi({panelEl:e,resize:t,position:n,initialSize:r,onSizeChange:o,strings:a}){let i=M.cssPrefix,s=D(null);if($(()=>{if(!e)return;let m=e.style;t.minWidth&&m.setProperty(`--${i}-resize-min-w`,t.minWidth),t.maxWidth&&m.setProperty(`--${i}-resize-max-w`,t.maxWidth),t.minHeight&&m.setProperty(`--${i}-resize-min-h`,t.minHeight),t.maxHeight&&m.setProperty(`--${i}-resize-max-h`,t.maxHeight),r&&(m.setProperty(`--${i}-widget-w`,`${r.width}px`),m.setProperty(`--${i}-widget-h`,`${r.height}px`))},[e,t.minWidth,t.maxWidth,t.minHeight,t.maxHeight,i,r]),!e)return null;let c=n.startsWith("top-"),p=n.endsWith("-right"),_=`${i}-resize-grip ${i}-resize-grip--${c?"bottom":"top"}-${p?"left":"right"}`;function d(m){if(!e)return;let v=m.currentTarget,y=e.getBoundingClientRect();s.current={pointerId:m.pointerId,startX:m.clientX,startY:m.clientY,startW:y.width,startH:y.height,dirX:p?-1:1,dirY:c?1:-1},v.setPointerCapture(m.pointerId),e.setAttribute("data-resizing",""),m.preventDefault()}function u(m){let v=s.current;if(!v||m.pointerId!==v.pointerId||!e)return;let y=(m.clientX-v.startX)*v.dirX,x=(m.clientY-v.startY)*v.dirY;e.style.setProperty(`--${i}-widget-w`,`${v.startW+y}px`),e.style.setProperty(`--${i}-widget-h`,`${v.startH+x}px`)}function f(m){let v=s.current;if(!v||m.pointerId!==v.pointerId||!e)return;m.currentTarget.releasePointerCapture(m.pointerId),e.removeAttribute("data-resizing");let y=e.getBoundingClientRect();o({width:Math.round(y.width),height:Math.round(y.height)}),s.current=null}return l("div",{class:_,role:"separator","aria-orientation":"vertical","aria-label":a.resizeHandle,title:a.resizeHandle,onPointerDown:d,onPointerMove:u,onPointerUp:f,onPointerCancel:f,"data-testid":L.resizeGrip,children:l(Rp,{})})}var nf=M.cssPrefix;function rf({suggestions:e,onPick:t,disabled:n=!1}){let r=D(null),[o,a]=H({start:!1,end:!1});return $(()=>{let i=r.current;if(!i)return;function s(){if(!i)return;let p=Math.abs(i.scrollLeft),_=p>1,d=p<i.scrollWidth-i.clientWidth-1;a(u=>u.start===_&&u.end===d?u:{start:_,end:d})}s(),i.addEventListener("scroll",s,{passive:!0});let c=typeof ResizeObserver>"u"?void 0:new ResizeObserver(s);return c?.observe(i),()=>{i.removeEventListener("scroll",s),c?.disconnect()}},[e]),e.length===0?null:l("div",{ref:r,class:`${nf}-suggestions`,role:"group","aria-label":"Suggested replies","data-cut-start":o.start?"true":void 0,"data-cut-end":o.end?"true":void 0,children:e.map((i,s)=>l("button",{type:"button",class:`${nf}-suggestion`,onClick:()=>t(i),disabled:n,"data-testid":ft(L.suggestion,s),children:i.label},i.id))})}var tr=M.cssPrefix,cP=`.${tr}-header, .${tr}-back-header, .${tr}-home-hero`,uP='button, a, input, textarea, select, [role="tab"], [contenteditable]',of=56;function hi(e,t){$(()=>{if(!t||!e)return;function n(c){return Number.parseFloat(c)||0}function r(c,p){return Math.min(p,Math.max(-p,c))}let o=null,a=c=>{let p=c.target;if(!(p instanceof Element)||!p.closest(cP)||p.closest(uP))return;let _=e.getBoundingClientRect();o={id:c.pointerId,x:c.clientX,y:c.clientY,dx:n(e.style.getPropertyValue(`--${tr}-modal-dx`)),dy:n(e.style.getPropertyValue(`--${tr}-modal-dy`)),maxX:(window.innerWidth+_.width)/2-of,maxY:(window.innerHeight+_.height)/2-of},e.dataset.dragging="true",c.preventDefault()},i=c=>{if(!o||c.pointerId!==o.id)return;let p=r(o.dx+c.clientX-o.x,o.maxX),_=r(o.dy+c.clientY-o.y,o.maxY);e.style.setProperty(`--${tr}-modal-dx`,`${p}px`),e.style.setProperty(`--${tr}-modal-dy`,`${_}px`)},s=c=>{!o||c.pointerId!==o.id||(o=null,delete e.dataset.dragging)};return e.addEventListener("pointerdown",a),window.addEventListener("pointermove",i),window.addEventListener("pointerup",s),window.addEventListener("pointercancel",s),()=>{e.removeEventListener("pointerdown",a),window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s)}},[e,t])}function vi({containerRef:e,onDrop:t,disabled:n=!1}){let[r,o]=H(!1);return $(()=>{if(n){o(!1);return}let a=e.current;if(!a)return;let i=0;function s(d){i+=1,d.dataTransfer?.types.includes("Files")&&(d.preventDefault(),o(!0))}function c(){i-=1,!(i>0)&&(i=0,o(!1))}function p(d){d.dataTransfer?.types.includes("Files")&&d.preventDefault()}function _(d){i=0,o(!1),d.dataTransfer&&(d.preventDefault(),t(d.dataTransfer.items))}return a.addEventListener("dragenter",s),a.addEventListener("dragleave",c),a.addEventListener("dragover",p),a.addEventListener("drop",_),()=>{a.removeEventListener("dragenter",s),a.removeEventListener("dragleave",c),a.removeEventListener("dragover",p),a.removeEventListener("drop",_)}},[e,n,t]),{visible:n?!1:r}}var Ye=M.cssPrefix;function af(e){let{options:t,onClose:n}=e,r=t.strings,o=D(null);$(()=>{let p=o.current;if(!p)return;let _=ei(p);function d(u){u.key==="Escape"&&n?.()}return p.addEventListener("keydown",d),()=>{_(),p.removeEventListener("keydown",d)}},[n]);let a=e.composerApiRef,i=e.composerActive&&e.view==="chat"&&e.canSend&&!e.activeForm?.blocking&&!e.sendPreparing&&e.options.features.fileUpload,s=F(p=>{i&&a.current?.attachFromDrop(p)},[a,i]),{visible:c}=vi({containerRef:o,onDrop:s,disabled:!i});return hi(o.current,t.mode==="modal"),l("div",{ref:o,class:`${Ye}-panel`,part:"panel",role:"dialog","aria-modal":"false","aria-label":r.panelTitle,style:{position:"relative"},"data-testid":L.panel,children:[l(Ll,{...e,containerEl:o.current,dragOver:c}),l(Nl,{poweredBy:e.options.poweredBy})]})}function Ll(e){let{options:t,transport:n,feedback:r,bus:o,persistence:a,conversationId:i,composerKey:s,panelSize:c,view:p,canSend:_,isStreaming:d,isMemoryCompacting:u,canReleaseQueuedMessages:f,queueManualMessages:m,sendPreparing:v,controlMode:y,assignedOperatorInitials:x,operatorAvailable:P,operatorRequestEnabled:k,onRequestOperator:g,onCancelOperatorRequest:h,loadingMessages:b,onLoadPreviousMessages:w,messagesSig:A,reconnectingSig:R,agent:E,suggestions:N,initialWidgetSize:j,onClose:B,onBack:V,onClear:X,onToggleHistory:pe,onSelectHistoryConversation:J,onNewConversation:ce,onWidgetSizeChange:ke,onSend:be,onStop:Me,onSuggestion:Fe,activeForm:ne,formMarkers:Pe,onFormSubmit:Oe,onFormSkip:lt,onFormFill:Bt,tool:ot,onRetry:ht,onMessageFeedback:Nt,containerEl:vt,dragOver:Te,composerApiRef:ct}=e,Se=t.strings,qe=At(()=>A.value.some(Ot=>!Ot.ephemeral&&Ot.role!=="system")).value,ze;return ne?.blocking?ze=null:_?ze=l(ue,{children:[y&&y!=="ai-agent"?l(_P,{controlMode:y,operatorInitials:x,operatorAvailable:P,onCancelOperatorRequest:h,strings:Se}):null,u&&y==="ai-agent"?l("div",{class:`${Ye}-loading ${Ye}-compaction-status`,role:"status","data-testid":L.compactionStatus,children:[l("span",{class:`${Ye}-loading-spinner`,"aria-hidden":"true"}),Se.compactingContext]}):null,!d&&!u&&y==="ai-agent"&&l(rf,{suggestions:N,onPick:Fe,disabled:v}),l(__,{options:t,transport:n,feedback:r,bus:o,persistence:a,conversationId:i,isStreaming:d,pageToolRunning:e.pageToolRunning,isMemoryCompacting:u,canReleaseQueuedMessages:f,queueManualMessages:m,active:e.composerActive&&p==="chat",isPreparing:v,operatorRequestEnabled:k,canRequestOperator:qe,controlMode:y,onRequestOperator:g,onSend:be,onStop:Me,apiRef:ct},s)]}):ze=l(pP,{label:Se.conversationClosed,ctaLabel:Se.startNewConversation,onNewConversation:X}),l(ue,{children:[p==="history"?l(dP,{strings:Se,onBack:pe,onClose:B,showClose:Ka(t.mode,c,t.actions)}):l("header",{class:`${Ye}-header`,part:"header","data-testid":L.panelHeader,children:[V?l("button",{type:"button",class:`${Ye}-icon-btn`,onClick:V,"aria-label":Se.moduleBack,title:Se.moduleBack,children:l(yo,{})}):null,E?l(x_,{agent:E,strings:Se}):l("h1",{children:Se.panelTitle}),l(Yt,{panelProps:e,variant:"chat"})]}),p==="history"?l(ci,{transport:n,strings:Se,locale:t.locale,persistence:a,onSelect:J,onNewConversation:ce}):l(ue,{children:[l(T_,{visible:Te,strings:Se}),l(tf,{messagesSig:A,reconnectingSig:R,strings:Se,responseMode:t.responseMode,showReasoning:t.showReasoning,showToolCalls:t.showToolCalls,showSources:t.showSources,enableMessageFeedback:t.enableMessageFeedback,onFeedback:Nt,loading:b,onLoadPreviousMessages:w,idle:!d&&!v&&_&&!ne?.blocking,controlMode:y,tool:ot,onRetry:ht,form:ne?{form:ne,onSubmit:Oe,onSkip:lt}:null,formMarkers:Pe,onFillForm:Bt}),ze,l(mP,{disclaimer:t.composerDisclaimer})]}),t.size.resize?.enabled?l(gi,{panelEl:vt,resize:t.size.resize,position:t.position,initialSize:j,onSizeChange:ke,strings:Se}):null]})}function dP({strings:e,onBack:t,onClose:n,showClose:r}){return l("header",{class:`${Ye}-header`,part:"header",children:[l("button",{type:"button",class:`${Ye}-icon-btn`,onClick:t,"aria-label":e.historyBack,title:e.historyBack,children:l(yo,{})}),l("h1",{children:e.historyTitle}),r?l("button",{type:"button",class:`${Ye}-icon-btn`,onClick:n,"aria-label":e.close,title:e.close,children:l(qt,{})}):null]})}function pP({label:e,ctaLabel:t,onNewConversation:n}){return l("div",{class:`${Ye}-readonly-banner`,role:"note",children:[l("span",{class:`${Ye}-readonly-label`,children:e}),l("button",{type:"button",class:`${Ye}-readonly-cta`,onClick:n,children:t})]})}function _P({controlMode:e,operatorInitials:t,operatorAvailable:n,onCancelOperatorRequest:r,strings:o}){let a=fP(e,t,n,o);return l("div",{class:`${Ye}-operator-banner`,role:"status","data-mode":e,"data-testid":L.operatorBanner,children:[l("span",{class:`${Ye}-operator-pulse`,"aria-hidden":"true"}),l("span",{class:`${Ye}-operator-label`,children:a}),e==="awaiting-operator"&&r?l("button",{type:"button",class:`${Ye}-cancel-operator-request`,"data-testid":L.cancelOperatorRequest,onClick:r,children:o.cancelOperatorRequest}):null]})}function fP(e,t,n,r){return e==="operator"?r.chattingWithOperator.replace("{operator}",t??""):n===!1?r.noOperatorAvailable:r.connectingOperator}function mP({disclaimer:e}){return e?l("div",{class:`${Ye}-composer-footer`,children:l("div",{class:`${Ye}-disclaimer`,children:e})}):null}function Nl({poweredBy:e}){return e?l("div",{class:`${Ye}-poweredby-bar`,children:l(gP,{logoUrl:e.logoUrl,text:e.text,href:e.href})}):null}function gP({logoUrl:e,text:t,href:n}){let r=l(ue,{children:[e?l("img",{class:`${Ye}-poweredby-logo`,src:e,alt:"",loading:"lazy"}):null,t?l("span",{children:t}):null]});return n?l("a",{class:`${Ye}-poweredby`,href:n,target:"_blank",rel:"noopener noreferrer",children:r}):l("span",{class:`${Ye}-poweredby`,children:r})}var bi=M.cssPrefix;function sf({panelProps:e,enabledModules:t,nav:n,bus:r,hasUnread:o,latestNews:a,onSelectConversation:i,onStartNewConversation:s,onSetPanelSize:c}){let p=e.options,_=p.strings,d=D(null),u=D(new Set);$(()=>{let V=d.current;if(!V)return;let X=ei(V);function pe(J){J.key==="Escape"&&e.onClose?.()}return V.addEventListener("keydown",pe),()=>{X(),V.removeEventListener("keydown",pe)}},[e.onClose]);let f=At(()=>n.sig.value).value,m=mp(f),v=p.modules.byId[f.activeTab],y=e.composerActive&&v?.layout==="chat"&&m===void 0,x=e.composerApiRef,P=y&&e.view==="chat"&&e.canSend&&!e.activeForm?.blocking&&!e.sendPreparing&&e.options.features.fileUpload,k=F(V=>{P&&x.current?.attachFromDrop(V)},[x,P]),{visible:g}=vi({containerRef:d,onDrop:k,disabled:!P});hi(d.current,p.mode==="modal");let h=m?.kind==="iframe"||m?.kind==="content",b=t.length>1&&(gp(f)||!h),w=D(null);$(()=>{if(h&&w.current===null)w.current=e.panelSize,e.panelSize==="normal"&&c("expanded");else if(!h&&w.current!==null){let V=w.current;w.current=null,c(V)}},[h]);let A={push:V=>n.push(V),pop:()=>n.pop(),switchTab:V=>n.switchTab(V),switchToLayout:V=>{let X=t.find(pe=>pe.layout===V);X&&n.switchTab(X.id)},selectConversation:i,startNewConversation:s};function R(V){return{options:p,transport:e.transport,strings:_,config:V,nav:A,bus:r,panelProps:e,latestNews:a}}let E=l(Yt,{panelProps:e,variant:"plain"});v&&u.current.add(v.id);let N=t.filter(V=>u.current.has(V.id));function j(V){if(V.layout==="chat")return l(Ll,{...e,composerActive:y,containerEl:d.current,dragOver:g});let X=li[V.layout].Root;return X?l(X,{...R(V)}):null}function B(){return m?.kind==="iframe"?l(P_,{url:m.url,title:m.title,strings:_,onBack:()=>n.pop(),actions:E}):m?.kind==="content"?l(n_,{id:m.id,title:m.title,transport:e.transport,strings:_,bus:r,onBack:()=>n.pop(),actions:E}):null}return l("div",{ref:d,class:`${bi}-panel ${bi}-messenger`,part:"panel",role:"dialog","aria-modal":"false","aria-label":_.panelTitle,style:{position:"relative"},"data-testid":L.messengerHome,children:[l("div",{class:`${bi}-messenger-body`,children:[N.map(V=>l("div",{class:`${bi}-messenger-pane`,hidden:h||V.id!==v?.id,children:j(V)},V.id)),B()]}),b?l(b_,{modules:t,activeTab:f.activeTab,strings:_,hasUnread:o,onSelect:V=>n.switchTab(V)}):null,l(Nl,{poweredBy:p.poweredBy}),p.size.resize?.enabled&&!(v?.layout==="chat"&&!m)?l(gi,{panelEl:d.current,resize:p.size.resize,position:p.position,initialSize:e.initialWidgetSize,onSizeChange:e.onWidgetSizeChange,strings:_}):null]})}var Ao=M.cssPrefix;function lf({strings:e,onClose:t}){return l("div",{class:`${Ao}-panel ${Ao}-modules-empty`,part:"panel",role:"dialog","aria-label":e.panelTitle,"data-testid":L.modulesEmpty,children:[t?l("button",{type:"button",class:`${Ao}-icon-btn ${Ao}-modules-empty-close`,onClick:t,"aria-label":e.close,title:e.close,children:l(qt,{})}):null,l("p",{class:`${Ao}-modules-empty-text`,children:e.modulesEmpty})]})}function cf(e){let t=M.cssPrefix,{site:n,blocks:r,strings:o,collapsed:a}=e,i=r?.navigation??[],s=r?.linkCards??[],c=a?o.expandSidebar:o.collapseSidebar;return l("aside",{class:`${t}-sidebar`,"data-collapsed":a?"true":"false","data-testid":L.sidebar,children:[l("div",{class:`${t}-sidebar-header`,children:[l(hP,{site:n}),l("button",{type:"button",class:`${t}-sidebar-toggle`,"aria-label":c,"aria-expanded":a?"false":"true",title:c,onClick:e.onToggleCollapsed,"data-testid":L.sidebarToggle,children:l(vP,{collapsed:a})})]}),a?null:l(ue,{children:[i.length>0?l("nav",{class:`${t}-sidebar-section`,"data-section":"navigation",children:l(bP,{items:i})}):null,s.length>0?l("div",{class:`${t}-sidebar-section`,"data-section":"link-cards",children:l(yP,{items:s})}):null,e.showConversations?l("div",{class:`${t}-sidebar-conversations`,children:l(ci,{transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,onSelect:e.onSelectConversation,onNewConversation:e.onNewConversation})}):null]})]})}function hP({site:e}){let t=M.cssPrefix;if(e?.logo?.url){let n=e.logo.alt??e.title??"Logo";return l("picture",{children:[e.logoDark?.url?l("source",{srcset:e.logoDark.url,media:"(prefers-color-scheme: dark)"}):null,l("img",{class:`${t}-sidebar-logo`,src:e.logo.url,alt:n})]})}return l("div",{class:`${t}-sidebar-title`,children:e?.title??M.name})}function vP({collapsed:e}){return l("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true",children:e?l("polyline",{points:"9 6 15 12 9 18"}):l("polyline",{points:"15 6 9 12 15 18"})})}function bP({items:e}){let t=M.cssPrefix;return l("ul",{class:`${t}-sidebar-nav`,children:e.map(n=>l("li",{children:l("a",{class:`${t}-sidebar-nav-item`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[n.icon?l("span",{class:`${t}-sidebar-nav-icon`,"data-icon":n.icon}):null,l("span",{class:`${t}-sidebar-nav-label`,children:n.label})]})},n.id??n.label))})}function yP({items:e}){let t=M.cssPrefix;return l("div",{class:`${t}-sidebar-cards`,children:e.map(n=>l("a",{class:`${t}-sidebar-card`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[l("div",{class:`${t}-sidebar-card-label`,children:n.label}),n.description?l("div",{class:`${t}-sidebar-card-desc`,children:n.description}):null]},n.id??n.label))})}var uf=M.cssPrefix;function df(e){return l("main",{class:`${uf}-page-shell`,"data-sidebar-collapsed":e.sidebarCollapsed?"true":"false",children:[l(cf,{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}),l("section",{class:`${uf}-page-chat`,"aria-label":e.strings.panelTitle,children:e.children})]})}var Mo=Z.scope("hitl");function yi(e){return e.kind==="tool"&&Vt(e.toolMetadata)&&(e.stateSig.value==="input-available"||e.stateSig.value==="approval-responded"&&e.approvalSig.value?.approved===!0)}function pf(e,t){t.errorSig.value=fs(t.toolCallId),t.stateSig.value="output-error",e.partsSig.value=[...e.partsSig.value]}function PP(e,t){let n=e.slice(0,e.indexOf(t)).findLast(r=>r.role==="user");return n!==void 0&&Tt.sentHere(n.id)}function _f(e){let{streaming:t,controlModeSig:n,messagesSig:r,sendAiTurn:o,bus:a,humanInLoop:i,tools:s}=e,c=D(t);c.current=t;let p=D(s);p.current=s;let _=D(new Map),[d,u]=H(!1),f=F((g,h,b)=>{if(c.current||n.value!=="ai-agent")return!1;let w=r.value.at(-1),A=w?.partsSig.value.findIndex(N=>N.kind==="tool"&&N.toolCallId===g)??-1,R=w?.partsSig.value[A];if(!w||R?.kind!=="tool")return Mo.warn("decideTool: tool part not found",{toolCallId:g}),!1;if(w.status!=="complete"||!za(w,A)||!h(R))return!1;if(b(R),w.partsSig.value=[...w.partsSig.value],!Xn(w)||w.partsSig.value.some(yi))return!0;w.status="streaming",w.retryAction={kind:"continue-assistant",messageId:w.serverMessageId??w.id},w.awaitingContinuation=!0,r.value=[...r.value];let E=w.partsSig.value.flatMap(N=>N.kind==="tool"?[N.toolCallId]:[]);return o({continueExisting:!0}).then(N=>N&&Tt.clear(E)),!0},[n,r,o]),m=F((g,h)=>{let{toolCallId:b,toolName:w}=h;_.current.has(b)||(_.current.set(b,g),u(!0),au({toolCallId:b,toolName:w,input:h.inputSig.value,optionTools:p.current??[],onSettled:(A,R)=>{Mo.info("toolResult",{toolCallId:b,status:A}),a.emit("toolResult",{toolCallId:b,name:Kr(w),status:A,durationMs:R})}}).then(A=>{_.current.delete(b)&&(u(_.current.size>0),f(b,yi,R=>{A.state==="output-available"?R.outputSig.value=A.output:R.errorSig.value=A.errorText,R.stateSig.value=A.state}))}))},[a,f]),v=F(()=>{let g=r.value;for(let[w,A]of _.current){let R=g.findIndex(E=>E.id===A);R<0||R===g.length-1||(_.current.delete(w),iu(w),u(_.current.size>0))}let h=g.at(-1);if(c.current||h?.role!=="assistant"||h.status!=="complete")return;let b=h.partsSig.value.filter(w=>yi(w)&&w.stateSig.value==="input-available");if(!(b.length===0||!PP(g,h)))for(let w of b)Tt.get(w.toolCallId)?.state==="stopped"?pf(h,w):m(h.id,w)},[r,m]);$(()=>v(),[t,v]),$(()=>r.subscribe(()=>v()),[r,v]);let y=F((g,h,b)=>{let w=!1,A;if(!f(g,N=>N.stateSig.value==="approval-requested",N=>{Vt(N.toolMetadata)&&(A=N),w=N.toolMetadata?.card==="questions";let j=N.approvalSig.value?.id??g;N.approvalSig.value={id:j,approved:h,reason:b},N.stateSig.value="approval-responded"}))return;let E=r.value.at(-1);if(A&&h&&E&&m(E.id,A),A&&!h&&a.emit("toolResult",{toolCallId:g,name:Kr(A.toolName),status:"declined",durationMs:0}),w){Mo.info("toolResult",{toolCallId:g}),a.emit("toolResult",{toolCallId:g});return}Mo.info("toolDecision",{toolCallId:g,approved:h}),a.emit("toolDecision",{toolCallId:g,approved:h})},[a,f,r,m]),x=F(g=>{f(g,h=>h.stateSig.value==="approval-responded"&&h.approvalSig.value?.approved!==void 0&&!yi(h),h=>{let b=h.approvalSig.value?.id??g;h.approvalSig.value={id:b},h.stateSig.value="approval-requested"})},[f]),P=le(()=>({humanInLoop:i,onDecision:y,onEdit:x}),[i,y,x]),k=F(()=>{let g=r.value.at(-1);for(let h of _.current.keys()){let b=g?.partsSig.value.find(w=>w.kind==="tool"&&w.toolCallId===h);g&&b?pf(g,b):fs(h),Mo.info("toolResult",{toolCallId:h,status:"stopped"}),a.emit("toolResult",{toolCallId:h,name:b?Kr(b.toolName):void 0,status:"stopped",durationMs:0})}_.current.clear(),u(!1)},[a,r]);return{toolInteraction:P,pageToolsRunning:d,stopPageTools:k}}var xP=Z.scope("latest-news");function ff({transport:e,options:t,persistence:n,enabled:r}){let o=t.modules.list.find(d=>d.layout==="news")?.contentCollectionIds,a=o?.join(","),[i,s]=H(),[c,p]=H(()=>n.loadSeenNewsId());$(()=>{if(!r||!o?.length)return;let d=!1;return e.listContent({contentCollectionIds:o,sortBy:"publishedAt",sortOrder:"desc",limit:1}).then(u=>{d||s(u.items[0])}).catch(u=>xP.debug("listContent (latest news) failed (non-fatal)",{err:u})),()=>{d=!0}},[e,r,a]);let _=F(d=>{n.saveSeenNewsId(d),p(d)},[n]);return{item:i,unseen:i!==void 0&&i.id!==c,markSeen:_}}function mf({callout:e,persistence:t}){let n=e?.text??"",r=e?.persistent??!0,[o,a]=H(()=>r?!1:t.loadCalloutDismissed(n));$(()=>{a(r?!1:t.loadCalloutDismissed(n))},[n,r,t]);let i=F(()=>{a(!0),r||t.saveCalloutDismissed(n)},[t,n,r]);return{dismissed:o,dismissCallout:i}}function gf(e){let{transport:t,conversationIdSig:n}=e,r=Et("ai-agent"),o=Et(void 0),a=Et(void 0),i=D(void 0),s=F(d=>{let u=d.controlRevision,f=i.current;f&&f.conversationId===n.value&&u<f.revision||(i.current={conversationId:n.value,revision:u},r.value=d.controlMode,o.value=d.assignedOperatorInitials,d.controlMode!=="awaiting-operator"?a.value=void 0:d.operatorAvailable!==void 0&&(a.value=d.operatorAvailable))},[n,r,o,a]),c=F(d=>{if(d.type!=="data-control-state")return;let u=zd(d.data);u&&s(u)},[s]),p=F(async()=>{let d=n.value,u=await t.requestOperator();u&&n.value===d&&s(u)},[t,n,s]),_=F(async()=>{let d=n.value,u=await t.cancelOperatorRequest();u&&n.value===d&&s(u)},[t,n,s]);return{controlModeSig:r,assignedOperatorInitialsSig:o,operatorAvailableSig:a,applyControlState:s,adoptControlStateChunk:c,requestOperator:p,cancelOperatorRequest:_}}var Pi=M.cssPrefix,hf=`--${Pi}-visual-viewport-height`,vf=`--${Pi}-visual-viewport-top`;function bf(e){let{hostElement:t,mode:n,panelSize:r,isOpen:o,surfaceReady:a,setIsOpen:i}=e;It(()=>{pa(t,Qa(n,r,o))},[t,o,r,n]),It(()=>{if(!o||!a)return;let s=t.ownerDocument.defaultView,c=s?.visualViewport,p=t.shadowRoot?.querySelector(`.${Pi}-anchor`);if(!s||!c||!p)return;let _=()=>{p.style.setProperty(hf,`${c.height}px`),p.style.setProperty(vf,`${c.offsetTop}px`)},d=0,u=()=>{s.cancelAnimationFrame(d),d=s.requestAnimationFrame(()=>{d=s.requestAnimationFrame(_)})};return _(),c.addEventListener("resize",u),c.addEventListener("scroll",u),()=>{s.cancelAnimationFrame(d),c.removeEventListener("resize",u),c.removeEventListener("scroll",u),p.style.removeProperty(hf),p.style.removeProperty(vf)}},[t,o,a]),$(()=>{if(n!=="modal"||!o)return;function s(c){c.composedPath().some(_=>_ instanceof HTMLElement&&_.classList.contains(`${Pi}-panel`))||i(!1)}return t.addEventListener("click",s),()=>t.removeEventListener("click",s)},[t,o,n,i]),$(()=>{if(n!=="drawer"||!o)return;function s(c){c.key==="Escape"&&i(!1)}return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[o,n,i])}var Ol=Z.scope("reducer"),xi=class{constructor(t,n){te(this,"messagesSig",t);te(this,"onReconcileNeeded",n);te(this,"active",null);te(this,"openTextParts",new Map);te(this,"partSeq",0);te(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 r=un();r.id=t.id;let o=nr(t)||Jn(t)&&(t.status!=="streaming"||Xn(t)),a=t.status==="streaming"&&Xn(t)&&fo(t);this.replay={baseline:t,shadow:r,chunks:[n],probeContinuation:o,continuationTailReplay:a,liveCatchUp:t.status==="streaming"&&!o},this.attach(r),this.apply(n)}refreshReplayBaseline(){let t=this.replay;if(!t)return null;let n=t.shadow.serverMessageId??t.baseline.serverMessageId,r=this.messagesSig.value,o=r.at(-1),a=o===t.baseline||o?.id===t.baseline.id||n!==void 0&&o?.serverMessageId===n?o:r.find(s=>s===t.baseline)??r.find(s=>s.id===t.baseline.id||n!==void 0&&s.serverMessageId===n);if(!a)return this.detach(),null;if(a===t.baseline)return t;let i=t.baseline;return t.baseline=a,yf(i,a),t.liveCatchUp&&nr(t.shadow)&&(a.status==="streaming"||Jn(a))?(t.probeContinuation=!1,t.continuationTailReplay=!1,t):(t.probeContinuation=nr(a)||Jn(a)&&(a.status!=="streaming"||Xn(a)),t.continuationTailReplay=a.status==="streaming"&&Xn(a)&&fo(a),t.liveCatchUp=a.status==="streaming"&&!t.probeContinuation,t)}refreshActive(){let t=this.active;if(!t)return null;let n=t.serverMessageId,r=this.messagesSig.value,o=r.at(-1),a=o===t||o?.id===t.id||n!==void 0&&o?.serverMessageId===n?o:r.find(s=>s===t)??r.find(s=>s.id===t.id||n!==void 0&&s.serverMessageId===n);if(!a)return this.detach(),null;if(a===t)return t;yf(t,a);let i=nr(t)&&Jn(a);return a.status!=="streaming"&&!i?(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 Ut(()=>{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.runStartedAt=n.runStartedAt??t.runStartedAt,t.stepTimings=n.stepTimings??t.stepTimings,t.partsSig.value=n.partsSig.value,this.messagesSig.value=[...this.messagesSig.value]}),this.replay=null,this.active=t,t}promoteContinuation(){let{baseline:t,chunks:n}=this.replay,r=ja(t);return this.replay=null,Ut(()=>{t.partsSig.value=t.partsSig.value.slice(0,SP(t,n)+1),t.awaitingContinuation=!1,t.status="streaming",t.finishReason=void 0,t.errorText=void 0,t.suggestions=void 0,this.attach(t);for(let o of n)this.apply(o);t.continuationStreaming=r||void 0,this.messagesSig.value=[...this.messagesSig.value]}),t}settleOwnedContinuation(t){let{baseline:n}=this.replay,r=ja(n);return this.replay=null,Ut(()=>{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=r||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}applyResume(t){if(t.type==="start"){let o=(this.replay?.baseline??this.active)?.serverMessageId;o!==void 0&&t.messageId!==void 0&&o!==t.messageId&&this.onReconcileNeeded?.({messageId:o}),this.detach();let a=t.messageId,i=a!==void 0?this.messagesSig.value.find(_=>_.serverMessageId===a||_.id===a):void 0;if(i!==void 0)return t.messageMetadata?.senderRole==="visitor"&&i.role==="user"&&(i.status==="pending"||i.status==="error")&&(i.serverMessageId=a,i.status="complete",i.errorText=void 0,i.retryAction=void 0,this.messagesSig.value=[...this.messagesSig.value]),this.beginReplay(i,t),null;let s=t.messageMetadata?.senderRole,c=this.messagesSig.value.at(-1);if(s===void 0&&c?.role==="assistant"&&c.status==="streaming"&&c.serverMessageId===void 0&&!Gt(c))return this.attach(c),this.apply(t),null;let p=un();return this.attach(p),this.messagesSig.value=[...this.messagesSig.value,p],this.apply(t),null}if(this.replay){let r=this.refreshReplayBaseline();if(!r)return null;r.chunks.push(t),t.type==="data-control-state"&&(r.baseline.operatorRoutedTurn=t.data.controlMode!=="ai-agent"),this.apply(t);let{baseline:o,shadow:a,probeContinuation:i,continuationTailReplay:s,liveCatchUp:c}=r,p=t.type==="finish"||t.type==="error"||t.type==="abort";if(i){if(!CP(o,a,t)){if(p){if(o.status==="streaming"&&o.awaitingContinuation!==!0){let u=this.settleOwnedContinuation(t);return this.detach(),u}EP(o,a)&&(o.continuationStreaming=!0,this.messagesSig.value=[...this.messagesSig.value],this.onReconcileNeeded?.({messageId:o.serverMessageId??o.id})),this.detach()}return null}let d=nr(o)&&p?this.settleOwnedContinuation(t):this.promoteContinuation();return p?(d.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:d.serverMessageId??d.id}):d.continuationStreaming=!1),this.detach(),d):null}if(s&&wP(o,a)){let d=this.promoteContinuation();return p?(this.detach(),d):null}if(!c)return p&&this.detach(),null;if(p&&!Gt(o)&&Gt(a)){let d=this.promoteReplay();return this.detach(),d}if(!kP(o,a))return p&&(this.onReconcileNeeded?.({messageId:o.serverMessageId??o.id}),this.detach()),null;let _=this.promoteReplay();return p?(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 r=n;return r.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:r.serverMessageId??r.id}):r.continuationStreaming=!1),this.detach(),r}return null}ensureTextPart(t,n,r){let o=`${n}:${r}`,a=this.openTextParts.get(o);if(a)return a;let i={kind:n,id:`${r}#${this.partSeq++}`,textSig:se(""),doneSig:se(!1)};return this.openTextParts.set(o,i),Lo(t,i),i}apply(t){let n=this.active;if(n)switch(t.type){case"start":{t.messageId&&(n.serverMessageId=t.messageId);let r=t.messageMetadata;r?.runStartedAt&&(n.runStartedAt=r.runStartedAt),r?.senderRole==="operator"?(n.role="operator",r.operatorInitials&&(n.operatorInitials=r.operatorInitials)):r?.senderRole==="visitor"&&(n.role="user");return}case"finish-step":this.openTextParts.clear();return;case"start-step":Lo(n,{kind:"step-start",id:`ss-${this.partSeq++}`});return;case"message-metadata":n.stepTimings=Ua(t.messageMetadata?.steps)??n.stepTimings;return;case"finish":Ol.debug("finish",{reason:t.finishReason,canContinue:t.canContinue}),n.stepTimings=Ua(t.messageMetadata?.steps)??n.stepTimings,n.status="complete",n.retryAction=void 0,t.finishReason&&(n.finishReason=t.finishReason),this.bumpDone(n);return;case"error":Ol.warn("stream error chunk",{errorText:t.errorText}),n.status="error",n.errorText=void 0,this.bumpDone(n);return;case"abort":Ol.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 r=this.ensureTextPart(n,"text",t.id);r.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 r=this.ensureTextPart(n,"reasoning",t.id);r.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":AP(n,t);return;case"file":Lo(n,{kind:"file",url:t.url,mediaType:t.mediaType});return;case"source-url":Pf(n,{kind:"source",sourceId:t.sourceId,url:t.url,title:t.title});return;case"source-document":Pf(n,{kind:"source",sourceId:t.sourceId,title:t.title,filename:t.filename,mediaType:t.mediaType});return;case"data-suggestions":n.suggestions=Ha(t.data);return;case"data-control-state":n.operatorRoutedTurn=t.data.controlMode!=="ai-agent";return;case"data-memory-compaction-state":return;default:{let r=t}}}bumpDone(t){Ut(()=>{t.partsSig.value=[...t.partsSig.value],this.messagesSig.value.includes(t)&&(this.messagesSig.value=[...this.messagesSig.value])})}},$l={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function nr(e){return e.awaitingContinuation===!0||e.continuationStreaming===!0||e.retryAction?.kind==="continue-assistant"}function yf(e,t){e.canceled&&(t.canceled=!0),!(!nr(e)||t.status!=="streaming"&&!Jn(t))&&(t.awaitingContinuation??(t.awaitingContinuation=e.awaitingContinuation),t.continuationStreaming??(t.continuationStreaming=e.continuationStreaming),t.retryAction===void 0&&(t.retryAction=e.retryAction))}function SP(e,t){let n=e.partsSig.value,r=t.findIndex(s=>s.type==="start-step"),o=new Set(t.slice(0,r<0?t.length:r).flatMap(s=>"toolCallId"in s&&s.type.startsWith("tool-output")?[s.toolCallId]:[])),a=n.findLastIndex(s=>s.kind==="tool"&&(s.stateSig.value==="approval-requested"||s.stateSig.value==="approval-responded"||o.has(s.toolCallId)));if(a>=0)return a;let i=new Set(t.flatMap(s=>s.type==="tool-input-start"||s.type==="tool-input-available"?[s.toolCallId]:[]));return n.some(s=>s.kind==="tool"&&i.has(s.toolCallId))?-1:n.findLastIndex(s=>s.kind==="tool")}function kP(e,t){let n=e.partsSig.value,r=t.partsSig.value;return e.role!==t.role||r.length<n.length?!1:n.every((o,a)=>xf(o,r[a]))}function wP(e,t){let n=e.partsSig.value,r=n.findLastIndex(s=>s.kind==="tool"),o=new Set(n.slice(0,r+1).flatMap(s=>s.kind==="tool"?[s.toolCallId]:[])),a=t.partsSig.value.filter(s=>s.kind!=="tool"||!o.has(s.toolCallId)),i=n.slice(r+1);return a.length<i.length?!1:i.every((s,c)=>xf(s,a[c]))}function xf(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||!Va(t.toolName,e.toolName)||$l[t.stateSig.value]<$l[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 CP(e,t,n){return TP(e,n)||!RP(e,t)?!0:n.type!=="finish"&&n.type!=="error"&&n.type!=="abort"?!1:fo(t)||e.awaitingContinuation===!0&&n.type!=="finish"?!0:e.awaitingContinuation===!0&&t.partsSig.value.every(r=>r.kind==="step-start")}function TP(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(r=>r.kind==="tool"&&r.toolCallId===t.toolCallId);return n!==void 0&&$l[n.stateSig.value]<4}function RP(e,t){let n=t.partsSig.value;if(n.length===0)return!0;let r=e.partsSig.value;return r.some((o,a)=>n.every((i,s)=>IP(r[a+s],i)))}function IP(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"||Va(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 EP(e,t){if(nr(e)||!Jn(e))return!1;let n=new Set(e.partsSig.value.filter(o=>o.kind==="tool").map(o=>o.toolCallId));return!t.partsSig.value.some(o=>o.kind==="tool"&&n.has(o.toolCallId))}function An(e,t,n,r,o){let a=e.partsSig.value.find(s=>s.kind==="tool"&&s.toolCallId===t);if(a)return r&&(a.dynamic=!0),a.toolMetadata??(a.toolMetadata=o),a;let i={kind:"tool",toolCallId:t,toolName:n??"tool",dynamic:r?!0:void 0,toolMetadata:o,inputPartialSig:se(""),inputSig:se(void 0),outputSig:se(void 0),errorSig:se(void 0),stateSig:se("input-streaming"),approvalSig:se(void 0)};return Lo(e,i),i}function Lo(e,t){e.partsSig.value=[...e.partsSig.value,t]}function Pf(e,t){e.partsSig.value.some(n=>n.kind==="source"&&n.sourceId===t.sourceId)||Lo(e,t)}function AP(e,t){switch(t.type){case"tool-input-start":An(e,t.toolCallId,t.toolName,t.dynamic,t.toolMetadata);return;case"tool-input-delta":{let n=An(e,t.toolCallId);n.inputPartialSig.value+=t.inputTextDelta;return}case"tool-input-available":{let n=An(e,t.toolCallId,t.toolName,t.dynamic,t.toolMetadata);n.inputSig.value=t.input,n.stateSig.value="input-available";return}case"tool-input-error":{let n=An(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=An(e,t.toolCallId,t.toolName);n.approvalSig.value={id:t.approvalId},n.stateSig.value="approval-requested";return}case"tool-output-available":{let n=An(e,t.toolCallId,void 0,t.dynamic);n.outputSig.value=t.output,n.stateSig.value="output-available";return}case"tool-output-error":{let n=An(e,t.toolCallId,void 0,t.dynamic);n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-output-denied":{let n=An(e,t.toolCallId);n.stateSig.value="output-denied";return}default:return}}async function Sf(e){let t=1e3,n=!1,r=!1,o=!1;function a(){o||e.signal.aborted||(o=!0,e.onInitialBoundaryReady())}for(;!e.signal.aborted;){let i,s="held";try{s=await e.connect(()=>{if(e.signal.aborted)return;i=e.now();let c=n||r;n=!0,r=!1,o?c&&e.backfill():a()})}catch{}if(e.signal.aborted||(!n&&i===void 0&&(r=!0,a()),s==="unavailable"))return;e.onDropped?.(),i!==void 0&&e.now()-i>=1e3&&(t=1e3),await e.sleep(t),t=Math.min(t*2,15e3)}}var MP=120;function kf(e){let{activated:t,conversationReady:n,conversationIdSig:r,messagesSig:o,optionsRef:a,transport:i,visitorId:s,adoptControlStateChunk:c,adoptMemoryCompactionStateChunk:p,settleSuggestions:_,recordConversationReply:d,transcriptRecoverySig:u,beginConversationTranscript:f,commitConversationTranscript:m,onReplyLanded:v,runCancellation:y,canContinueRef:x,setCanSend:P,feedback:k,bus:g,loadInitialThread:h,shouldReconcileOnConnect:b,reconnectingSig:w}=e,A=D(0);$(()=>{if(!t||!n||!r.value)return;let R=r.value,E=new AbortController,N=O=>{},j=new xi(o,O=>N(O));i.primeIdentity(s,R);let B=!1,V=!1,X,pe=!1,J,ce=0,ke=x.current,be,Me,Fe=Date.now(),ne,Pe=!1,Oe=!1;function lt(O,C,q){if(!Gt(O))return;let ae=o.value.findLast(_e=>!_e.ephemeral),re=O.serverMessageId??O.id;if(!(ae&&(ae.serverMessageId??ae.id)!==re))return qa(o.value,O,R,a.current.strings.newConversation,C,q)}function Bt(O,C,q,ae){let re=lt(O,C,ae);if(!re)return;let Re=`${O.serverMessageId??O.id}:${q}:${re.preview??""}`;Re!==Me&&(Me=Re,i.publishConversation({...re,hasUnread:!0},!0))}let ot;function ht(){ot&&(clearTimeout(ot.timer),ot=void 0)}function Nt(){let O=ot;if(!O)return;clearTimeout(O.timer),ot=void 0;let C=o.value.find(q=>(q.serverMessageId??q.id)===O.replyId);C?.role!=="assistant"&&C?.role!=="operator"||Bt(C,O.canContinue,O.generation,O.activityAt)}function vt(O,C,q,ae){ht(),ot={replyId:O.serverMessageId??O.id,canContinue:C,generation:q,activityAt:ae,timer:setTimeout(Nt,MP)}}function Te(O,C,q,ae=Date.now(),re=!0){ht();let _e=lt(O,C,ae);if(!_e)return;let Ie=`${O.serverMessageId??O.id}:${q}`;Ie!==be&&(be=Ie,d(_e),re&&ne&&(Pe=!0))}function ct(O,C){(O||!y.localSendRef.current)&&y.settle(C),O&&v()}function Se(O,C=[],q=!1,ae,re=ke,_e=ce,Re=Date.now(),Ie=!0){let $e=a.current;if(O.canceled){Te(O,re,_e,Re,Ie),ct(q,ae);return}let ye=!0,Be=O.status==="error";switch(ep(O,Be)){case"drop":o.value=o.value.filter(Ke=>Ke!==O),ye=!1;break;case"complete-operator-routed":O.status="complete",q&&(k.play("messageReceived"),kr(g,$e,"assistant",Je(O)));break;case"error":{if(O.status="error",q){k.play("error");let Ke=new Error(Be?"stream error chunk":"empty reply");g.emit("error",Ke),$e.onError?.(Ke)}break}case"complete":O.status="complete",q&&(k.play("messageReceived"),kr(g,$e,"assistant",Je(O))),_(O,C);break}ye&&Te(O,re,_e,Re,Ie),ct(q,ae)}function qe(O){if(E.signal.aborted||r.value!==R)return;if(c(O),p?.(O),O.type==="start"){Nt();let Ke=O.messageId===void 0?void 0:o.value.find(K=>K.serverMessageId===O.messageId||K.id===O.messageId);pe=Ke!==void 0&&Ke.status!=="streaming";let U=J?.senderRole==="visitor"?J.messageId:void 0;if(J={messageId:O.messageId,senderRole:O.messageMetadata?.senderRole},ce+=1,Fe=Date.now(),Me=void 0,B=O.messageMetadata?.senderRole===void 0,V=!1,X=B?O.messageMetadata?.runId:void 0,B){let K=O.messageId!==void 0&&o.value.some($t=>$t.serverMessageId===O.messageId||$t.id===O.messageId),Y=o.value.at(-1),ge=O.messageId!==void 0&&(Y?.serverMessageId===O.messageId||Y?.id===O.messageId),mt=y.localSendRef.current&&(!K||ge)&&Y?.role==="assistant"&&Y.status==="streaming"&&(ge||Y.serverMessageId===void 0&&Y.partsSig.value.length===0);V=y.captureStart(R,O,mt,U)}}let C=B&&(O.type==="finish"||O.type==="error"||O.type==="abort"),q=C?X:void 0,ae=C&&(V||y.ownsLocalRun(q)),re=ce,_e=pe;O.type==="finish"&&O.canContinue!==void 0&&(ke=O.canContinue);let Re=ke;C&&(B=!1,V=!1,X=void 0);let Ie=j.applyResume(O),$e=J?.messageId,ye=$e===void 0?void 0:o.value.find(Ke=>Ke.serverMessageId===$e||Ke.id===$e);pe&&J?.senderRole!=="visitor"&&(Ie!==null||ye?.status==="streaming")&&(pe=!1,_e=!1);let Be=!pe&&(ye?.role==="assistant"||ye?.role==="operator");if(O.type==="text-delta"&&Be&&vt(ye,ke,ce,Fe),O.type==="text-end"&&(ht(),Be&&Bt(ye,ke,ce,Fe)),O.type==="finish"&&O.canContinue===!1&&P(!1),!Ie){C&&(ae||!y.localSendRef.current)&&y.settle(q);return}if(Ie.role==="operator"){_e||(k.play("messageReceived"),kr(g,a.current,"operator",Je(Ie))),Te(Ie,Re,re,Fe),pe=!1,C&&(ae||!y.localSendRef.current)&&y.settle(q);return}Ie.role==="assistant"&&(Se(Ie,[],ae,q,Re,re,Fe),pe=!1)}async function ze(O){let C=ce,q=await i.loadConversation(R,O?{ids:[O]}:void 0).catch(()=>null);if(E.signal.aborted||r.value!==R||!q)return!1;q.controlState&&c({type:"data-control-state",data:q.controlState});let ae=o.value.at(-1),re=C===ce&&(O===void 0||ae!==void 0&&(ae.serverMessageId===O||ae.id===O));if(q.messages.length===0)return!0;re&&(ke=q.canContinue,P(ke));let _e=o.value,Re=O===void 0?_e.at(-1):_e.find(K=>K.serverMessageId===O||K.id===O),{messages:Ie,changed:$e}=mo(_e,Rn(q.messages));if(!$e)return!0;o.value=Ie;let ye=O===void 0?Ie.at(-1):Ie.find(K=>K.serverMessageId===O||K.id===O),Be=Re!==void 0&&ye!==void 0&&(Re.id===ye.id||Re.serverMessageId!==void 0&&Re.serverMessageId===ye.serverMessageId),Ke=ye!==void 0&&ye.status!=="streaming"&&(!Be||Re?.status==="streaming"),U=Be&&Re?.status==="streaming"?Date.now():ye?.createdAt;return re&&Ke&&ye.role==="assistant"?Se(ye,ye.suggestions??[],y.localSendRef.current,void 0,q.canContinue,C,U,!1):re&&Ke&&ye.role==="operator"?Te(ye,q.canContinue,C,U,!1):re&&ye?.role==="assistant"&&ye.status!=="streaming"&&_(ye,ye.suggestions??[]),!0}let Ot=new Set;N=({messageId:O})=>{if(Ot.has(O)||!o.value.some(q=>q.serverMessageId===O||q.id===O))return;Ot.add(O);function C(){return Ot.delete(O)}ze(O).then(C,C)};function Ve(O=!1){if(E.signal.aborted||r.value!==R){Pe=!1;return}if(ne){Pe=!0;return}let C=O?h(R)??(b()?ze():void 0):ze();if(!C)return;f(R),ne=C;function q(ae=!1){if(ne===C){if(ne=void 0,Pe){Pe=!1,Ve();return}ae&&m(R)}}C.then(q,()=>q(!1))}let Pt=u.subscribe(O=>{O<=A.current||(A.current=O,Oe&&Ve())});return Sf({signal:E.signal,now:()=>performance.now(),sleep:O=>Bn(O,E.signal),connect:O=>i.connectResumeStream({signal:E.signal,onChunk:qe,onConnected:()=>{w.value=!1,O()}}),onDropped:()=>{w.value=!0},onInitialBoundaryReady:()=>{Oe=!0,Ve(!0)},backfill:()=>Ve()}),()=>{E.abort(),w.value=!1,ht(),Pt(),j.detach()}},[t,n,r,r.value,s,i,c,p,_,d,u,f,m,v,y,x,P,o,g,k,h,b,w])}var LP=32;function wf(e){let{transport:t,setStreaming:n}=e,r=D(void 0),o=D(void 0),a=D(!1),i=D(void 0),s=D(!1),c=D(new Map),p=D(new Set),_=F((h,b)=>{let w=`${h}:${b}`;i.current!==w&&(i.current=w,t.cancelTurn(h,b))},[t]),d=F(h=>{r.current=void 0,o.current=h,a.current=!1,i.current=void 0,s.current=!0,n(!0)},[n]),u=F((h,b)=>{c.current.set(h,{messageId:b})},[]),f=F(h=>{h!==void 0&&(p.current.add(h),p.current.size>LP&&p.current.delete(p.current.values().next().value)),!(h!==void 0&&r.current?.runId!==h)&&(r.current=void 0,o.current=void 0,a.current=!1,s.current=!1,n(!1))},[n]),m=F((h,b)=>o.current!==h?b.runId&&r.current?.runId===b.runId?(r.current={conversationId:b.conversationId,runId:b.runId},a.current&&_(b.conversationId,b.runId),!0):!1:(o.current=void 0,b.runId?(r.current={conversationId:b.conversationId,runId:b.runId},n(!0),a.current&&_(b.conversationId,b.runId),!0):(f(),!0)),[_,n,f]),v=F((h,b)=>{let w=c.current.get(h);return w?(c.current.delete(h),!b.runId||p.current.has(b.runId)?!0:w.runId!==void 0?(w.runId!==b.runId||r.current?.runId===b.runId&&(r.current={conversationId:b.conversationId,runId:b.runId},a.current&&_(b.conversationId,b.runId)),!0):(s.current||o.current||(r.current={conversationId:b.conversationId,runId:b.runId},o.current=void 0,a.current=!1,i.current=void 0,s.current=!0,n(!0)),!0)):!1},[_,n]),y=F(h=>o.current!==h?!1:(f(),!0),[f]),x=F(h=>{let b=c.current.get(h);return b?(c.current.delete(h),b.runId===void 0):!1},[]),P=F((h,b,w,A)=>{let R=b.messageMetadata?.runId;if(b.messageMetadata?.senderRole!==void 0||typeof R!="string"||!R||p.current.has(R))return!1;if(r.current?.runId===R)return s.current;if(s.current)return r.current||!w?!1:(o.current=void 0,r.current={conversationId:h,runId:R},n(!0),a.current&&_(h,R),!0);let N=[...c.current.values()].filter(j=>j.runId===void 0).find(j=>j.messageId===A);return N?(N.runId=R,r.current={conversationId:h,runId:R},o.current=void 0,a.current=!1,i.current=void 0,s.current=!0,n(!0),!0):(o.current=void 0,r.current={conversationId:h,runId:R},n(!0),a.current&&_(h,R),s.current)},[_,n]),k=F(h=>typeof h=="string"&&r.current?.runId===h&&s.current,[]),g=F(()=>{let h=r.current;if(h)return a.current=!0,_(h.conversationId,h.runId),!0;let b=o.current;return b?(a.current=!0,b.then(w=>{w.runId&&_(w.conversationId,w.runId)}).catch(()=>{}),!0):!1},[_]);return le(()=>({localSendRef:s,begin:d,beginRouted:u,acceptAck:m,acceptRoutedAck:v,reject:y,rejectRouted:x,captureStart:P,ownsLocalRun:k,settle:f,stop:g}),[m,v,d,u,P,k,y,x,f,g])}var NP=Z.scope("send");function Tf(e,t,n,r,o,a=!0){e.publishConversation({...qa(t,n,r,o,a),hasUnread:!1},!0)}function Rf(e,t){return e.id===t.id||(e.serverMessageId??e.id)===(t.serverMessageId??t.id)}function If(e){return e.findLast(t=>!t.ephemeral&&t.role!=="system"&&(t.role==="user"||t.status!=="streaming"||Gt(t)))}function No(e,t,n,r,o){let a=If(t);a?.role!=="user"||!Rf(a,n)||Tf(e,t,a,r,o)}function Cf(e){return!(e instanceof _t)||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 Ef(e){let{transport:t,messagesSig:n,conversationIdSig:r,options:o,bus:a,feedback:i,persistence:s,visitorId:c,adoptConversationId:p,applyControlState:_,setCanSend:d,settleSuggestions:u,runCancellation:f}=e,m=F(()=>{let x=r.value??Rt();return r.value||(r.value=x,s.saveConversationId(x)),x},[r,s]),v=F(async({continueExisting:x,turn:P})=>{let k=m(),g=n.value.at(-1),h=P?[P]:Kd(n.value,x),b=h[0];b?.role==="user"&&Tt.markSent(b.id);let w=h.map(sl),A=s.loadUserPrefs(),R=na(o.tools).then(E=>t.sendTurn(rl({messages:w,conversationId:k,visitorId:c,userPrefs:A,clientTools:_s(E)}),{keepalive:x}));f.begin(R);try{let E=await R;if(r.value!==k||!f.acceptAck(R,E))return!1;if(p(E.conversationId),E.runId&&b?.role==="user"&&No(t,n.value,b,E.conversationId,o.strings.newConversation),!E.runId){let N=await t.loadConversation(E.conversationId).catch(()=>null);if(r.value!==E.conversationId)return!0;if(N){N.controlState&&_(N.controlState),d(N.canContinue);let j=Rn(N.messages),{messages:B,changed:V}=mo(n.value,j);V&&(n.value=B);let X=j.findLast(ce=>!ce.ephemeral&&ce.role!=="system"),pe=If(n.value);pe&&X&&Rf(pe,X)&&Tf(t,n.value,pe,E.conversationId,o.strings.newConversation,N.canContinue);let J=g?n.value.find(ce=>ce.id===g.id&&ce.role==="assistant"&&ce.status!=="streaming"):void 0;J&&u(J,J.suggestions??[]),!x&&g?.role==="assistant"&&n.value.includes(g)&&g.serverMessageId===void 0&&!Gt(g)&&(n.value=n.value.filter(ce=>ce!==g))}else g?.role==="assistant"&&n.value.includes(g)&&(g.status="error",g.errorText=o.strings.errorGeneric,x?g.retryAction={kind:"continue-assistant",messageId:g.serverMessageId??g.id}:g.retryAction=b?.role==="user"?{kind:"resend-user",messageId:b.id}:null,n.value=[...n.value])}return!0}catch(E){if(r.value!==k)return!1;if(!f.reject(R))return b?.role==="user"&&No(t,n.value,b,k,o.strings.newConversation),!0;let N=Zn(E,o.strings),j=Cf(E),B=P?.role==="assistant"?P:n.value.at(-1);if(x&&B?.role==="assistant"&&E instanceof _t&&E.status===409){let V=B.serverMessageId??B.id,X=await t.loadConversation(k,{ids:[V]}).catch(()=>null);if(r.value!==k)return!1;if(X){X.controlState&&_(X.controlState),d(X.canContinue);let pe=Rn(X.messages),J=pe.find(ce=>(ce.serverMessageId??ce.id)===V);if(J&&Yd(B,J)){let{messages:ce,changed:ke}=mo(n.value,pe),be=ce.find(Me=>(Me.serverMessageId??Me.id)===V);if(ke&&be&&be!==B)return be.awaitingContinuation=!1,be.continuationStreaming=void 0,be.retryAction=null,n.value=ce,be.status!=="streaming"&&u(be,be.suggestions??[]),!0}}if(!n.value.includes(B)||B.status!=="streaming")return!1;B.continuationStreaming=!0}if(x&&B?.role==="assistant")B.status="error",B.errorText=N,B.retryAction=j?{kind:"continue-assistant",messageId:B.serverMessageId??B.id}:null,n.value=[...n.value];else if(g?.role==="assistant"&&n.value.includes(g)){g.status="error",g.errorText=N;let V=h[0];g.retryAction=j&&V?.role==="user"?{kind:"resend-user",messageId:V.id}:null,n.value=[...n.value]}else{let V=un();V.status="error",V.errorText=N;let X=h[0];V.retryAction=j&&X?.role==="user"?{kind:"resend-user",messageId:X.id}:null,n.value=[...n.value,V]}return i.play("error"),a.emit("error",E),o.onError?.(E),!1}},[t,n,o,a,i,s,c,p,_,d,u,m,f]),y=F(async x=>{let P=m();x.status="pending",x.errorText=void 0,x.retryAction=void 0,n.value.includes(x)&&(n.value=[...n.value]),Tt.markSent(x.id);let k=[sl(x)],g=s.loadUserPrefs(),h=na(o.tools).then(b=>t.sendTurn(rl({messages:k,conversationId:P,visitorId:c,userPrefs:g,clientTools:_s(b)})));f.beginRouted(h,x.id);try{let b=await h;return r.value!==P?(f.rejectRouted(h),!1):f.acceptRoutedAck(h,b)?(p(b.conversationId),No(t,n.value,x,b.conversationId,o.strings.newConversation),x.status==="pending"&&(x.status="complete",n.value.includes(x)&&(n.value=[...n.value])),!0):!1}catch(b){let w=f.rejectRouted(h);if(r.value!==P)return!1;if(!w)return No(t,n.value,x,P,o.strings.newConversation),x.status==="pending"&&(x.status="complete",n.value.includes(x)&&(n.value=[...n.value])),!0;if(x.status!=="pending")return No(t,n.value,x,P,o.strings.newConversation),!0;NP.debug("operator-routed send failed",{error:b});let A=b instanceof Error?b:new Error(String(b));return x.status="error",x.errorText=Zn(b,o.strings),x.retryAction=Cf(b)?{kind:"resend-user",messageId:x.id}:null,n.value.includes(x)&&(n.value=[...n.value]),i.play("error"),a.emit("error",A),o.onError?.(A),!1}},[t,n,o,a,i,s,c,p,m,f]);return{sendAiTurn:v,sendRoutedTurn:y}}var OP=Z.scope("unread");function Af(e){let{transport:t,options:n,conversationIdSig:r,isConversationVisibleRef:o,activated:a,conversationReady:i}=e,s=Et(!1),c=Et(0),p=Et(0),_=D([]),d=D(void 0),u=D(!1),f=F(()=>{let b=r.value,w=o.current()&&d.current===b?b:void 0,A=_.current.filter(R=>R.hasUnread&&R.conversationId!==w).length;c.value=A,s.value=A>0},[r,s,c,o]),m=F(b=>{let w=r.value,A=_.current.find(j=>j.conversationId===w),R=dn(_.current,b),E=R.find(j=>j.conversationId===w),N=b.type==="snapshot"&&w!==void 0&&E?.hasUnread===!0&&d.current===w&&A!==void 0&&A.lastMessageAt!==E.lastMessageAt;N&&(d.current=void 0),_.current=R,f(),N&&(p.value+=1)},[r,f,p]),v=F(()=>{if(f(),!o.current())return;let b=r.value;if(!b||d.current!==b)return;let w=_.current.find(A=>A.conversationId===b);w?.hasUnread&&t.markRead(b,w.lastMessageAt)},[r,o,f,t]),y=F(b=>{r.value===b&&(d.current=void 0,f())},[r,f]),x=F(b=>{r.value===b&&(d.current=b,v())},[r,v]),P=F(b=>d.current===b,[]),k=F((b=!1)=>{!n.history.enabled||!n.modules.list.some(w=>w.layout==="chat")||u.current||(u.current=!0,t.listConversations({limit:50},b).then(w=>{b||m({type:"snapshot",result:w,requestedRevision:0}),v()}).catch(w=>OP.debug("refreshUnread failed (non-fatal)",{err:w})).finally(()=>{u.current=!1}))},[m,v,n.history.enabled,n.modules,t]),g=F(b=>{let w=b.conversationId,A=o.current()&&r.value===w&&d.current===w,R=_.current.find(N=>N.conversationId===w),E=A&&(R?.lastMessageAt!==b.lastMessageAt||R.hasUnread);t.publishConversation({...b,hasUnread:!A},!0),E&&t.markRead(w,b.lastMessageAt)},[r,o,t]);$(()=>t.subscribeConversationChanges(m),[m,t]);let h=D(!1);return $(()=>{!a||!i||h.current||(h.current=!0,k())},[a,i,k]),$(()=>{if(!a)return;function b(){document.visibilityState==="visible"&&(v(),k(!0))}return document.addEventListener("visibilitychange",b),()=>document.removeEventListener("visibilitychange",b)},[a,v,k]),{hasUnreadSig:s,unreadCountSig:c,transcriptRecoverySig:p,markVisibleConversationRead:v,beginConversationTranscript:y,commitConversationTranscript:x,isConversationTranscriptCommitted:P,recordConversationReply:g}}var Oo=Z.scope("settings");function Mf(e){let{options:t,persistence:n,transport:r,feedback:o,hostElement:a,bus:i}=e,s=n.loadUserPrefs(),[c,p]=H(()=>s.locale??t.locale),[_,d]=H(s.themeMode),u=_??t.themeMode,[f,m]=H(()=>s.textSize??t.textSize),v=F(h=>{n.patchUserPrefs(h),r.saveUserPrefs(n.loadUserPrefs()).catch(b=>Oo.warn("saveUserPrefs failed",{err:b}))},[n,r]);$(()=>{s.soundMuted!==void 0&&o.setMuted(s.soundMuted)},[]),$(()=>{if(u!=="host"){a.dataset.theme=u;return}return Ru(h=>{a.dataset.theme=h})},[a,u,t]),$(()=>{a.dataset.textSize=f},[a,f,t]),$(()=>{let h=!0;return o.mutedSig.subscribe(b=>{if(h){h=!1;return}v({soundMuted:b})})},[o,v]);let y=ur(c,t.availableLocales,t.defaultLocale);$(()=>{r.setLocale(y)},[r,y]),$(()=>{a.dir=bc(y)?"rtl":"ltr"},[a,y]),$(()=>{y!==c&&p(y)},[y,c]);let x=F(h=>{Oo.info("localeChange",{locale:h}),p(h),v({locale:h}),i.emit("localeChange",h)},[v,i]),P=F(h=>{Oo.info("themeChange",{mode:h}),d(h),a.dataset.theme=h,v({themeMode:h}),i.emit("themeChange",h)},[a,v,i]),k=F(h=>{Oo.info("textSizeChange",{size:h}),m(h),a.dataset.textSize=h,v({textSize:h}),i.emit("textSizeChange",h)},[a,v,i]),g=F(()=>{o.toggleMuted();let h=o.mutedSig.value;Oo.info("soundToggle",{muted:h}),i.emit("soundToggle",{muted:h})},[o,i]);return{activeLocale:c,activeThemeMode:u,activeTextSize:f,effectiveLocale:y,setActiveLocale:p,setActiveThemeMode:d,setActiveTextSize:m,patchAndSync:v,handleLocaleChange:x,handleThemeChange:P,handleTextSizeChange:k,handleSoundToggle:g}}var xe=Z.scope("app"),Si=M.cssPrefix,$P={home:"home",chats:"chat",help:"help",news:"news"};function Lf(e,t){return Gd({...e,text:St(t,e.text)})}function Nf({options:e,hostElement:t,bus:n,recentHostEvents:r}){let o=e.aiAgentDeploymentId;if(!o)throw new Error("aiAgentDeploymentId is required");let[a]=H(()=>wn(e.widgetId,e.storage,e.aiAgentDeploymentId)),[i]=H(()=>a.getVisitorId()),s=a.loadUserPrefs(),c=Et(a.loadConversationId()),p=D(c.value!==void 0),_=Et(c.value??""),d=Et([]),u=Et(!1),[f,m]=H(!1),v=D(void 0),[y,x]=H([]);function P(){let S=e.modules.list,I=new Set(S.map(W=>W.id)),Q=a.loadActiveModule();return Q&&I.has(Q)?Q:S[0]?.id??""}function k(){return e.modules.list.find(S=>S.layout==="chat")?.id}function g(){let S=k();return S?e.modules.list.length===1?!0:b.sig.value.activeTab===S:!1}let h=D(void 0);if(!h.current){let S=e.modules.list.map(Q=>Q.id),I=a.loadActiveModule()??S[0]??"";h.current=_p(I,I?[...S,I]:S,Q=>a.saveActiveModule(Q))}let b=h.current,w=At(()=>b.sig.value.activeTab).value,A=At(()=>c.value).value,[R,E]=H(!1),[N,j]=H(null),[B,V]=H(!1),X=e.mode==="standalone"||e.mode==="inline",pe=D(vo(e,wr(),a.loadPanelOpen(),a.loadPanelSize())),[J,ce]=H(pe.current.panelOpen),[ke,be]=H(pe.current.panelOpen),Me=D(void 0),Fe=D(void 0),ne=D(!1),Pe=D(void 0);$(()=>{J&&be(!0)},[J]);let Oe=D(!1),[lt,Bt]=H(!1),{dismissed:ot,dismissCallout:ht}=mf({callout:e.launcher.callout,persistence:a}),Nt=e.launcher.callout?.persistent??!0,vt=F(()=>{xe.info("calloutDismiss"),n.emit("calloutDismiss",void 0),ht()},[n,ht]),[Te,ct]=H(pe.current.panelSize),Se=D(!1),[qe,ze]=H("chat"),Ot=D(()=>!1);Ot.current=()=>J&&qe==="chat"&&!document.hidden&&g();let[Ve,Pt]=H(!0),O=D(Ve);O.current=Ve;let[C,q]=H(!1),ae=D(C);ae.current=C;let re=D(null),[_e,Re]=H(!1),[Ie,$e]=H(null),[ye,Be]=H([]),Ke=D(e.strings),U=D(e);U.current=e;let[K,Y]=H(void 0),[ge,mt]=H(void 0),[$t,Mn]=H(()=>a.loadSidebarCollapsed()??!1),[xt,Ln]=H({}),[fe]=H(()=>new Ga({agentApiBaseUrl:e.agentApiBaseUrl,dataApiBaseUrl:e.dataApiBaseUrl,auth:ed({publicKey:e.publicKey,aiAgentDeploymentId:o,publicKeyHeader:"x-public-key"}),endpoints:e.endpoints,recentHostEvents:r})),[Dt]=H(()=>new xa(e.sound,e.haptics)),mn=wf({transport:fe,setStreaming:q}),{activeLocale:$o,activeThemeMode:Ul,activeTextSize:ql,effectiveLocale:rr,setActiveLocale:jf,setActiveThemeMode:Vf,setActiveTextSize:Wf,patchAndSync:zl,handleLocaleChange:Gf,handleThemeChange:Kf,handleTextSizeChange:Qf,handleSoundToggle:Xf}=Mf({options:e,persistence:a,transport:fe,feedback:Dt,hostElement:t,bus:n}),{controlModeSig:Qt,assignedOperatorInitialsSig:Jf,operatorAvailableSig:Yf,applyControlState:$r,adoptControlStateChunk:Zf,requestOperator:em,cancelOperatorRequest:tm}=gf({transport:fe,conversationIdSig:c}),gn=Et(new Map),nm=F(S=>{if(S.type!=="data-memory-compaction-state")return;let I=c.value;if(!I)return;let Q=jd(S.data);if(!Q)return;let W=gn.value.get(I);if(W&&(Q.postFinishSequence<W.postFinishSequence||Q.postFinishSequence===W.postFinishSequence&&(W.status==="ready"||W.status===Q.status)))return;let oe=new Map(gn.value);oe.set(I,Q),gn.value=oe},[c,gn]),{hasUnreadSig:rm,unreadCountSig:jl,transcriptRecoverySig:om,markVisibleConversationRead:Vl,beginConversationTranscript:Ai,commitConversationTranscript:or,isConversationTranscriptCommitted:Wl,recordConversationReply:am}=Af({transport:fe,options:e,conversationIdSig:c,isConversationVisibleRef:Ot,activated:ke,conversationReady:R}),im=J&&e.modules.byId[w]?.layout==="home",sm=ff({transport:fe,options:e,persistence:a,enabled:R&&im});$(()=>{Vl()},[w,J,qe,A,Vl]),$(()=>{Dt.update(e.sound,e.haptics)},[Dt,e.sound,e.haptics]),$(()=>()=>Dt.destroy(),[Dt]),$(()=>{Se.current||!e.size.initialSize||(Se.current=!0,!a.loadPanelSize()&&ct(ml(e.mode,e.size,wr())))},[e.mode,e.size,a]),$(()=>{if(!R||Oe.current)return;Oe.current=!0;let S=vo(e,wr(),a.loadPanelOpen(),a.loadPanelSize());ce(S.panelOpen),ct(S.panelSize)},[R,e,a]);let ar=D(null);$(()=>{R&&b.reconcile(e.modules.list.map(S=>S.id),P())},[R,e.modules.list,b]);let Do=F(S=>{!S||S.length===0||(d.value=S.map(I=>Lf(I,Ke.current)))},[d]),Mi=D(null),Fo=F(async S=>{try{let{formSubmissions:I}=await(S?fe.bootstrap(S):Mi.current??fe.bootstrap()),Q=new Map;return I.forEach((W,oe)=>Q.set(W.formId,oe)),I.filter((W,oe)=>!W.skipped||Q.get(W.formId)===oe).map((W,oe)=>({key:`wire:${W.formId}:${W.createdAt??oe}`,formId:W.formId,outcome:W.skipped?"skipped":"submitted",createdAt:Ud(W.createdAt),values:W.values}))}catch(I){return xe.debug("bootstrap failed \u2014 no form markers (non-fatal)",{err:I}),[]}},[fe]),Dr=D(0),tn=D(0),Li=F(S=>{if(S===c.value)return;let I=c.value;tn.current++,m(!1),I&&(a.saveDraft(S,a.loadDraft(I)),a.saveDraft(I,""),a.saveMessageQueue(S,a.loadMessageQueue(I)),a.saveMessageQueue(I,[])),c.value=S,a.saveConversationId(S),fe.primeIdentity(void 0,S),xe.info("conversation rebound",{previous:I,current:S}),I&&n.emit("conversationRebound",{previous:I,current:S})},[n,c,a,fe]),Bo=F((S,I)=>{let Q=[...S.map(G=>G.createdAt),...I.map(G=>G.createdAt)].filter(G=>G!==void 0),W=(Q.length?Math.min(...Q):Date.now())-1;return[...(Pe.current?.messages??[]).map(G=>{let ie=Lf(G,Ke.current);return ie.createdAt=W,ie}),...S]},[]),Gl=F(async S=>{let I=tn.current;function Q(){return I!==tn.current||c.value!==S}Fe.current===S&&(Fe.current=void 0),m(!0);try{let[W,oe]=await Promise.all([fe.loadConversation(S),Fo()]);if(Q())return!1;let G=Rn(W.messages);x(oe);let ie=Bo(dl(G,d.value),oe);if(d.value=ie,Fe.current=ie.some(Ee=>Ee.role==="user")?void 0:S,G.length>0||W.controlState!==void 0){Pt(W.canContinue),W.controlState&&$r(W.controlState);let Ee=G.findLast(gt=>gt.role==="assistant"&&!gt.ephemeral);Be(Ee?.suggestions??[])}return!0}catch(W){return Q()||(xe.warn("loadThread failed; keeping conversation active",{err:W,conversationId:S}),n.emit("error",W),U.current.onError?.(W)),!1}finally{Q()||m(!1)}},[fe,Fo,d,c,Bo,n]),lm=F(S=>{if(Me.current===S)return Me.current=void 0,Gl(S)},[Gl]),cm=F(()=>{if(v.current)return Promise.resolve(void 0);let S=c.value,I=d.value.find(ie=>ie.serverMessageId!==void 0),Q=I?.serverMessageId,W=I?new Date(I.createdAt).toISOString():void 0;if(!S||!Q||!W)return Promise.resolve(void 0);let oe=tn.current,G={};return v.current=G,(async()=>{try{let ie=await fe.loadConversation(S,{beforeId:Q,beforeCreatedAt:W});if(v.current!==G||tn.current!==oe||c.value!==S)return;if(ie.messages.length===0)return!1;let we=ie.messages.map(il),Ee=d.value,gt=Xd(Ee,we);if(gt!==Ee){let nn=Math.min(...we.map(Ct=>Ct.createdAt??1/0),...y.map(Ct=>Ct.createdAt??1/0));if(Number.isFinite(nn))for(let Ct of Ee){if(!Ct.ephemeral)break;(Ct.createdAt??1/0)>=nn&&(Ct.createdAt=nn-1)}d.value=gt}return!0}catch(ie){if(v.current!==G||tn.current!==oe||c.value!==S)return;xe.warn("load previous messages failed",{err:ie,conversationId:S,beforeId:Q}),n.emit("error",ie),e.onError?.(ie);return}finally{v.current===G&&(v.current=void 0)}})()},[n,c,y,d,e,fe]),Fr=F(async({newConversation:S})=>{let I=++Dr.current;function Q(){return I!==Dr.current}let W=c.value,oe=S||!W?Rt():W;oe!==W&&(tn.current++,m(!1),Ut(()=>{c.value=oe,_.value=oe}),a.saveConversationId(oe)),fe.primeIdentity(i,oe);let G;try{G=await fe.handshake({visitorId:i,conversationId:oe,userPrefs:a.loadUserPrefs(),locale:$o})}catch(Ee){if(Q())return;n.emit("error",Ee),e.onError?.(Ee),S||E(!0);return}if(Q())return;G.conversationId!==oe&&Li(G.conversationId),$e(G.agent),G.site&&ld(G.site)?Y(G.site):G.site&&xe.warn("invalid site config, using fallback",{site:G.site}),G.blocks&&cd(G.blocks)?mt(G.blocks):G.blocks&&xe.warn("invalid blocks config, using fallback",{blocks:G.blocks});let ie=ks(G.userPrefs);if(Object.keys(ie).length>0&&!S&&(a.saveUserPrefs(ie),ie.locale&&jf(ie.locale),ie.soundMuted!==void 0&&Dt.setMuted(ie.soundMuted),ie.themeMode&&Vf(ie.themeMode),ie.textSize&&Wf(ie.textSize)),Pe.current=G.welcome,S||n.emit("handshake",G),G.welcome?.suggestions){let Ee=Ke.current;Be(G.welcome.suggestions.map(gt=>({...gt,label:St(Ee,gt.label),...gt.text===void 0?{}:{text:St(Ee,gt.text)}})))}let we=!S&&W&&G.conversationId===W;p.current=!!we,we?ne.current||(Me.current=G.conversationId):(Fe.current=G.conversationId,Do(G.welcome?.messages),or(G.conversationId)),S||E(!0)},[fe,i,a,e,n,c,_,Dt,Do,$o,Li,or]),Br=JSON.stringify(e.userContext??null),um=JSON.stringify(e.pageContext??null),dm=JSON.stringify(xt);$(()=>{let S=Object.keys(xt).length?{...xt,...e.userContext}:e.userContext;fe.setContext(S,DP(e.pageContext))},[fe,Br,um,dm]),$(()=>fe.setUserToken(e.userToken),[fe,e.userToken]);let Kl=F((S,I=[])=>Be(S.suggestions??I),[]);$(()=>(fe.primeIdentity(i,c.value),Fr({newConversation:!1}),()=>{Dr.current++,tn.current++}),[]),$(()=>{!ke||!R||ne.current||(ne.current=!0,Mi.current=fe.bootstrap(),(async()=>{try{let S=await Mi.current;j(Vr((S??{forms:[]}).forms,rr))}catch(S){xe.debug("bootstrap failed \u2014 treating as no forms",{err:S})}finally{V(!0)}})(),Me.current===c.value&&m(!0))},[ke,R]);let Hr=D(null);$(()=>{if(!ke||!R||(Hr.current??(Hr.current=rr),Hr.current===rr))return;Hr.current=rr;let S=!1;return fe.bootstrap().then(I=>{S||j(Vr((I??{forms:[]}).forms,rr))}).catch(I=>xe.debug("forms re-localize failed \u2014 keeping current copy",{err:I})),()=>{S=!0}},[ke,R,rr,fe]);let Ql=D(Br);$(()=>{!R||Ql.current===Br||(Ql.current=Br,Fr({newConversation:!1}))},[Br,R,Fr]),bf({hostElement:t,mode:e.mode,panelSize:Te,isOpen:J,surfaceReady:R,setIsOpen:ce});let{sendAiTurn:hn,sendRoutedTurn:ir}=Ef({transport:fe,messagesSig:d,conversationIdSig:c,options:e,bus:n,feedback:Dt,persistence:a,visitorId:i,adoptConversationId:Li,applyControlState:$r,setCanSend:Pt,settleSuggestions:Kl,runCancellation:mn}),{toolInteraction:pm,pageToolsRunning:Ni,stopPageTools:Xl}=_f({streaming:C,controlModeSig:Qt,messagesSig:d,sendAiTurn:hn,bus:n,humanInLoop:e.features.humanInLoop,tools:e.tools}),_m=F((S,I)=>{let Q=d.value.find(W=>W.serverMessageId===S);Q&&(Q.feedback=I),xe.info("messageFeedback",{messageId:S,value:I}),n.emit("messageFeedback",{messageId:S,value:I}),fe.submitFeedback({messageId:S,value:I})},[n,d,fe]);function fm(){return d.value.reduce((S,I)=>S+(I.role==="user"?1:0),0)}let sr=e.forms.list.length>0?e.forms:N??e.forms,We=dp({forms:sr,persistence:a,userContext:()=>e.userContext,messageCount:fm,pageArea:()=>e.pageContext?.area?String(e.pageContext.area):void 0,conversationId:()=>c.value,onComplete:(S,I,Q,W)=>{xe.info("formSubmit",{formId:S.id,trigger:I,skipped:W}),n.emit("formSubmit",{formId:S.id,values:Q,skipped:W}),x(G=>{let we=G.find(Ee=>Ee.formId===S.id&&Ee.outcome==="skipped")?.createdAt??Date.now();return[...G.filter(Ee=>!(Ee.formId===S.id&&Ee.outcome==="skipped")),{key:`local:${S.id}:${we}`,formId:S.id,outcome:W?"skipped":"submitted",createdAt:we,...W?{}:{values:Q}}]});let oe=c.value??Rt();c.value||(c.value=oe,a.saveConversationId(oe),fe.primeIdentity(void 0,oe)),!W&&S.mirrorToContext&&Ln(G=>({...G,...Q})),fe.submitForm({formId:S.id,conversationId:oe,trigger:I,values:Q,skipped:W})}}),Jl=At(()=>We.activeForm.value),Ho=Jl.value?.form.blocking??!1,mm=F(()=>We.fire("after-messages"),[We]),gm=F(()=>p.current||d.value.some(S=>!S.ephemeral&&S.role==="user"),[d]);kf({activated:ke,conversationReady:R,conversationIdSig:c,messagesSig:d,optionsRef:U,transport:fe,visitorId:i,adoptControlStateChunk:Zf,adoptMemoryCompactionStateChunk:nm,settleSuggestions:Kl,recordConversationReply:am,transcriptRecoverySig:om,beginConversationTranscript:Ai,commitConversationTranscript:or,onReplyLanded:mm,runCancellation:mn,canContinueRef:O,setCanSend:Pt,feedback:Dt,bus:n,loadInitialThread:lm,shouldReconcileOnConnect:gm,reconnectingSig:u}),$(()=>{We.refresh()},[sr,We]);let Yl=e.pageContext?.area?String(e.pageContext.area):void 0,hm=At(()=>d.value.length),Uo=D(null);$(()=>{!B||!Uo.current||(We.fire("manual",Uo.current),Uo.current=null)},[B,We]),$(()=>{R&&B&&We.fire("pre-chat")},[R,B,We]),$(()=>{B&&!Ve&&We.fire("conversation-closed")},[B,Ve,We]),$(()=>{R&&B&&Yl&&We.fire("page-area")},[R,B,Yl,We]);let Oi=le(()=>{let S=sr.list.flatMap(I=>I.triggers).filter(I=>I.kind==="idle").map(I=>Number(I.param));return S.length?Math.min(...S)*1e3:0},[sr]);$(()=>{if(!Oi||!J)return;let S=setTimeout(()=>We.fire("idle"),Oi);return()=>clearTimeout(S)},[Oi,J,We,hm.value]);let lr=F(async(S,I,Q)=>{if(re.current)return!1;let W=c.value,oe=W?gn.value.get(W):void 0,G=Qt.value!=="ai-agent";if(!G&&oe?.status==="compacting"||(xe.info("send",{textLen:S.length,attachments:I.length,streaming:ae.current,routedToOperator:G}),ae.current&&!G))return!1;let ie=new AbortController,we={conversationId:W,controller:ie};re.current=we,Re(!0);try{Dt.unlock();let Ee=await BP(fe,I,ie.signal,vn=>{ie.signal.aborted||(xe.warn("upload failed",{err:vn}),n.emit("error",vn),e.onError?.(vn))});if(ie.signal.aborted||c.value!==W||!O.current||We.activeForm.value?.form.blocking)return!1;let gt=W?gn.value.get(W):void 0,nn=Qt.value!=="ai-agent";if(!nn&&gt?.status==="compacting"||ae.current&&!nn||!S&&Ee.length===0)return!1;n.emit("send",{text:S,attachmentCount:I.length}),ye.length>0&&Be([]),Dt.play("messageSent");let Ct=al(S,Ee,Q);return kr(n,e,"user",S),nn?(d.value=[...d.value,Ct],Q?await ir(Ct):(ir(Ct),!0)):(d.value=[...d.value,Ct,un()],Q?await hn({continueExisting:!1}):(hn({continueExisting:!1}),!0))}finally{re.current===we&&(re.current=null,Re(!1))}},[fe,n,e,ye.length,d,c,gn,hn,ir,Qt]),Zl=D(lr);Zl.current=lr;let ec=c.value,tc=(ec?gn.value.get(ec):void 0)?.status==="compacting",$i=Qt.value==="ai-agent",nc=At(()=>{let S=d.value.at(-1);return S?.role==="assistant"&&S.partsSig.value.some(I=>I.kind==="tool"&&I.stateSig.value==="approval-requested")}),rc=At(()=>d.value.some(S=>S.retryAction?.kind==="resend-user"||S.retryAction?.kind==="continue-assistant"));It(()=>{let S=c.value;return()=>{let I=re.current;!I||I.conversationId!==S||(re.current=null,Re(!1),I.controller.abort())}},[c.value]),$(()=>{Ve&&!Ho||re.current?.controller.abort()},[Ho,Ve]);let vm=F(()=>{if(Ni){xe.info("stop page tools"),n.emit("stop",void 0),Xl();return}if(!mn.stop())return;xe.info("stop"),n.emit("stop",void 0);let S=d.value.at(-1);S&&S.role!=="user"&&S.status==="streaming"&&(S.canceled=!0,d.value=[...d.value])},[mn,n,d,Ni,Xl]),bm=F(S=>{if(C)return;let I=d.value,Q=Wa(I,S);if(Q)switch(xe.info("retry",{kind:Q.kind,messageId:Q.messageId}),Q.kind){case"continue-assistant":{if(Qt.value!=="ai-agent"||S.role!=="assistant"||(S.serverMessageId??S.id)!==Q.messageId)return;S.status="streaming",S.errorText=void 0,S.retryAction=void 0,S.awaitingContinuation=!0,d.value=[...I],hn({continueExisting:!0,turn:S});return}case"resend-user":{let W=I.find(ie=>ie.role==="user"&&ie.id===Q.messageId);if(!W)return;let oe=ie=>{ie&&ar.current?.acceptQueuedMessage(Q.messageId)};if(W.status="complete",W.errorText=void 0,W.retryAction=void 0,Qt.value!=="ai-agent"){d.value=S.role==="assistant"?I.filter(ie=>ie!==S):[...I],ir(W).then(oe);return}let G=un();d.value=S.role==="assistant"?I.map(ie=>ie===S?G:ie):[...I,G],hn({continueExisting:!1,turn:W}).then(oe);return}case"repeat-user":{let W=I.find(we=>we.role==="user"&&we.id===Q.messageId);if(!W)return;let oe=al(Je(W),W.attachments?.map(we=>({...we}))??[]),G=new Set(oe.attachments?.flatMap(we=>we.url?[we.url]:[])??[]),ie=W.partsSig.value.flatMap(we=>we.kind==="file"&&!G.has(we.url)?[{...we}]:[]);if(ie.length>0&&(oe.partsSig.value=[...oe.partsSig.value,...ie]),Qt.value!=="ai-agent"){d.value=[...I,oe],ir(oe);return}d.value=[...I,oe,un()],hn({continueExisting:!1,turn:oe});return}default:return Q}},[C,d,Qt,hn,ir]),Ur=F(()=>{if(up(e.mode,Te)==="exit-fullscreen"){xe.info("close \u2192 exit-fullscreen",{mode:e.mode}),ct("normal"),n.emit("fullscreen",!1);return}xe.info("close \u2192 panel closed",{mode:e.mode}),We.fire("panel-close"),ce(!1),a.savePanelOpen(!1),n.emit("close",void 0),e.onClose?.()},[n,e,a,Te,We]),Nn=F(()=>{xe.info("open",{mode:e.mode}),Dt.unlock(),Bt(!0),ce(!0),a.savePanelOpen(!0),!ot&&!Nt&&vt(),setTimeout(()=>Bt(!1),FP),n.emit("open",void 0),e.onOpen?.()},[n,e,Dt,a,ot,Nt,vt]),Di=F(()=>{let S=d.value.some(I=>I.role==="user");if(Fe.current===c.value&&!S&&Ve&&c.value){xe.info("clear \u2192 reusing empty conversation",{conversationId:c.value}),d.value.length===0&&Do(Pe.current?.messages);return}return xe.info("clear \u2192 new conversation",{wasStreaming:C}),n.emit("clear",void 0),mn.settle(),p.current=!1,Me.current=void 0,Fe.current=void 0,Ut(()=>{d.value=[],c.value=void 0,$r({controlMode:"ai-agent",controlRevision:0})}),a.clearConversation(),Pt(!0),x([]),Be([]),Fr({newConversation:!0})},[C,d,c,a,Fr,n,Ve,Do,mn,$r]),qo=F(()=>{let S=Di();ze("chat");let I=e.modules.list.find(Q=>Q.layout==="chat")?.id;return I&&b.switchTab(I),S},[Di,b,e]),ym=F(async S=>{await qo(),await Zl.current(S,[])||ar.current?.fill(S)},[qo]),Fi=F(()=>{let S=Te==="expanded"?"normal":"expanded";xe.info("expand",{from:Te,expanded:S==="expanded"}),ct(S),a.savePanelSize(S),n.emit("expand",S==="expanded")},[n,Te,a]),Bi=F(()=>{let S=Te==="fullscreen"?"normal":"fullscreen";xe.info("fullscreen",{from:Te,fullscreen:S==="fullscreen"}),ct(S),a.savePanelSize(S),n.emit("fullscreen",S==="fullscreen")},[n,Te,a]),Pm=F(()=>{ze(S=>{let I=S==="history"?"chat":"history";return xe.info("toggleHistory",{view:I}),n.emit("toggleHistory",{view:I}),I})},[n]),xm=F(()=>{Mn(S=>{let I=!S;return xe.info("sidebarToggle",{collapsed:I}),a.saveSidebarCollapsed(I),n.emit("sidebarToggle",{collapsed:I}),I})},[a,n]),Sm=F(S=>{xe.info("resize",S),zl({widgetSize:S}),n.emit("resize",S)},[zl,n]),km=F(async S=>{let I=S.conversationId;if(I===c.value&&Wl(I)){xe.info("selectConversation",{conversationId:I,cached:!0}),n.emit("selectConversation",{conversationId:I}),fe.publishConversation(S),ze("chat");let G=k();G&&b.switchTab(G),or(I);return}let W=++Dr.current;tn.current++,m(!1);function oe(){return W!==Dr.current}xe.info("selectConversation",{conversationId:I,wasStreaming:C}),n.emit("selectConversation",{conversationId:I}),fe.publishConversation(S);try{let[G,ie]=await Promise.all([fe.loadConversation(I),Fo(I)]);if(oe())return;mn.settle(),p.current=!0,Me.current=void 0;let we=Rn(G.messages),Ee=G.conversationId!==c.value,gt=Ee?we:dl(we,d.value);Fe.current=gt.some(vn=>vn.role==="user")?void 0:G.conversationId,Ut(()=>{d.value=Bo(gt,ie),Ee&&(_.value=G.conversationId),c.value=G.conversationId}),x(ie),a.saveConversationId(G.conversationId),fe.primeIdentity(i,G.conversationId),Pt(G.canContinue),G.controlState&&$r(G.controlState);let nn=gt.findLast(vn=>vn.role==="assistant"&&!vn.ephemeral);Be(nn?.suggestions??[]),Ee?Ai(G.conversationId):or(G.conversationId),ze("chat");let Ct=k();Ct&&b.switchTab(Ct)}catch(G){if(oe())return;n.emit("error",G),e.onError?.(G)}},[fe,d,c,_,n,e,a,Fo,Bo,C,i,mn,Ai,or,Wl,b]),oc=F(S=>{if(typeof S!="string")return;J||Nn(),ze("chat");let I=k();I&&b.switchTab(I),B?We.fire("manual",S):Uo.current=S},[J,Nn,e.modules,b,B,We]),zo=D(void 0),jo=F(S=>{let I=e.modules.list.find(W=>W.layout===$P[S.to]);if(!I){xe.warn("open: the widget has no such tab",{to:S.to});return}let Q=S.id&&(I.layout==="help"||I.layout==="news")?{kind:"content",id:S.id,title:""}:void 0;b.open(I.id,Q)},[e.modules,b]),ac=F(S=>{if(J||Nn(),S!==void 0){if(!qc(S)){xe.warn("open: unknown target",{detail:S});return}R?jo(S):zo.current=S}},[J,Nn,R,jo]);$(()=>{!R||!zo.current||(jo(zo.current),zo.current=void 0)},[R,jo]);let ic=R&&!f&&!Ho&&(!$i||!nc.value&&!rc.value),[On,Hi]=H(),sc=F(S=>{let I=zc(S);if(!I){xe.warn("ask: expected { text, send? } with non-empty text",{detail:S});return}J||Nn(),Hi(I)},[J,Nn]),Ui=J&&B&&Ve&&R&&!f&&!Ho,lc=Ui&&ic&&!_e&&!($i&&(C||tc));$(()=>{if(On===void 0||!(On.send?lc:Ui))return;let S=k();if(!S){xe.warn("ask: the widget has no chat"),Hi(void 0);return}if(qe!=="chat"||!g()){ze("chat"),b.switchTab(S);return}if(Hi(void 0),!On.send){ar.current?.fill(On.text);return}lr(On.text,[]).then(I=>{I||ar.current?.fill(On.text)})},[On,Ui,lc,qe,w,e.modules,b,lr]),$(()=>{if(e.widgetId!=="default")return;let S=`data-${M.cssPrefix}-`,I=["ask","open","close","form"].map(W=>S+W);function Q(W){let oe=W.composedPath().find(Ee=>Ee instanceof Element&&I.some(gt=>Ee.hasAttribute(gt)));if(!(oe instanceof Element))return;W.preventDefault();let G=oe.getAttribute(`${S}ask`),ie=oe.getAttribute(`${S}open`),we=oe.getAttribute(`${S}form`);G!==null?ut(t,"ask",on(G||(oe.textContent??""),{send:oe.hasAttribute(`${S}send`)})):ie!==null?ut(t,"open",ea(ie)):we!==null?ut(t,"openForm",we):ut(t,"close")}return document.addEventListener("click",Q),()=>document.removeEventListener("click",Q)},[e.widgetId,t]),$(()=>{if(e.widgetId!=="default")return;let S=td(location.href);S&&(history.replaceState(history.state,"",S.url),S.ask?ut(t,"ask",on(S.ask)):ut(t,"open",S.target))},[e.widgetId,t]);let cc=D(yn),uc=e.mode==="page"||e.mode==="inline"||e.mode==="standalone";$(()=>Wt(()=>{let S=c.value,I={open:uc||J,ready:R,unread:jl.value,...S?{conversationId:S}:{}},Q=cc.current;I.open===Q.open&&I.ready===Q.ready&&I.unread===Q.unread&&I.conversationId===Q.conversationId||(cc.current=I,n.emit("state",I),I.unread!==Q.unread&&n.emit("unread",I.unread))}),[n,uc,J,R,jl,c]);let $n=D({handleOpenCommand:ac,handleClose:Ur,handleExpand:Fi,handleFullscreen:Bi,openForm:oc,handleAskCommand:sc});$n.current={handleOpenCommand:ac,handleClose:Ur,handleExpand:Fi,handleFullscreen:Bi,openForm:oc,handleAskCommand:sc},It(()=>Vc(t,{open:S=>$n.current.handleOpenCommand(S),close:()=>$n.current.handleClose(),expand:()=>$n.current.handleExpand(),fullscreen:()=>$n.current.handleFullscreen(),openForm:S=>$n.current.openForm(S),ask:S=>$n.current.handleAskCommand(S)}),[t]);let bt=le(()=>ts(e,$o,Ul,ql),[e,$o,Ul,ql]);Ke.current=bt.strings;let wm=le(()=>y.map(S=>{let I=sr.list.find(Q=>Q.id===S.formId);return{...S,title:I?.title,form:I}}),[y,sr]);function qi(S){km(S)}let dc={options:bt,transport:fe,feedback:Dt,bus:n,persistence:a,conversationId:c.value??"",composerKey:_.value,composerApiRef:ar,view:qe,canSend:Ve,isStreaming:C,pageToolRunning:Ni,isMemoryCompacting:tc,canReleaseQueuedMessages:ic,queueManualMessages:$i&&(nc.value||rc.value),sendPreparing:_e,composerActive:bt.mode==="page"||bt.mode==="inline"||bt.mode==="standalone"||J,controlMode:Qt.value,assignedOperatorInitials:Jf.value,operatorAvailable:Yf.value,operatorRequestEnabled:e.features.operatorRequest,onRequestOperator:em,onCancelOperatorRequest:tm,loadingMessages:f,onLoadPreviousMessages:cm,messagesSig:d,reconnectingSig:u,agent:Ie,suggestions:ye,initialWidgetSize:s.widgetSize??null,onClose:Ur,onClear:Di,onExpand:Fi,onFullscreen:Bi,onSoundToggle:Xf,onToggleHistory:Pm,onSelectHistoryConversation:qi,onNewConversation:qo,onLocaleChange:Gf,onThemeChange:Kf,onTextSizeChange:Qf,onWidgetSizeChange:Sm,onSend:lr,onStop:vm,onSuggestion:S=>{if(re.current)return;let I=S.text??S.label;xe.info("suggestion",{text:I,autoSend:e.autoSendSuggestions}),n.emit("suggestion",{text:I}),e.autoSendSuggestions?lr(I,[]):ar.current?.fill(I)},activeForm:Jl.value?.form??null,formMarkers:wm,onFormSubmit:We.complete,onFormSkip:We.skip,onFormFill:S=>We.fire("manual",S),tool:pm,onRetry:bm,onMessageFeedback:_m};if(!R)return null;let qr=bt.modules.list;function zi(S){let I=Sr("close",bt.mode,S);return qr.length===0?l(lf,{strings:bt.strings,onClose:I?Ur:void 0}):qr.length===1&&qr[0]?.layout==="chat"?l(af,{...dc,panelSize:S}):l(sf,{panelProps:{...dc,panelSize:S,onClose:I?Ur:void 0},enabledModules:qr,nav:b,bus:n,hasUnread:rm.value,latestNews:sm,onSelectConversation:qi,onStartNewConversation:ym,onSetPanelSize:ct})}if(e.mode==="page"){let S=e.history.enabled&&qr.some(I=>I.layout==="chat");return l("div",{class:`${Si}-anchor`,children:l(df,{site:K,blocks:ge,transport:fe,strings:bt.strings,locale:bt.locale,persistence:a,showConversations:S,onSelectConversation:qi,onNewConversation:qo,sidebarCollapsed:$t,onToggleSidebarCollapsed:xm,children:zi("fullscreen")})})}if(X){let S=e.mode==="standalone"?"fullscreen":Te;return l("div",{class:`${Si}-anchor`,children:zi(S)})}let pc=e.mode==="drawer",_c=!(e.mode==="modal")&&!e.launcher.hidden&&(!J||lt),fc=_c&&!lt&&!ot&&!pc?bt.launcher.callout:null;return l("div",{class:`${Si}-anchor`,"data-launcher-size":bt.launcher.size,children:[J||ke?l("div",{class:`${Si}-surface`,hidden:!J,children:zi(Te)}):null,_c?l(Qp,{onToggle:Nn,launcher:bt.launcher,strings:bt.strings,leaving:lt,edgeTab:pc}):null,fc?l(Xp,{callout:fc,launcherPosition:bt.position,strings:bt.strings,closeLabel:bt.strings.close,onDismiss:vt}):null]})}function DP(e){let t=e?.url??(typeof location<"u"?location.href:void 0);if(!(!e&&!t))return{...e,...t?{url:t}:{}}}var FP=120;async function BP(e,t,n,r){return(await Promise.all(t.map(async a=>{try{let{id:i,url:s,originalName:c,mimeType:p,fileSize:_}=await e.uploadFile(a.file,n);return{id:i,name:c,mediaType:p,size:_,url:s}}catch(i){r(i);return}}))).filter(a=>a!==void 0)}var HP=Z.scope("error-boundary"),ki=class extends Ht{constructor(){super(...arguments);te(this,"state",{crashed:!1})}componentDidCatch(n,r){HP.error("widget render crashed",{error:n,componentStack:r?.componentStack}),this.setState({crashed:!0}),this.props.onError(n,r?.componentStack)}render(){return this.state.crashed?this.props.fallback:this.props.children}};function wi(e){let{bus:t,host:n,appRoot:r,persistence:o,reportError:a}=e,i=e.initialRaw,s,c=bn(i),p=!0,_=0,d=Gc(t);function u(){c=bn(s?ns(i,s):i)}function f(){Au(n,zn(c.mode));let x=o.loadUserPrefs().themeMode;Mu(n,x?{...c,themeMode:x}:c),p&&(pa(n,Dl(c)),p=!1)}function m(){f(),Xt(kn(ki,{onError:a},kn(Nf,{key:_,bus:t,hostElement:n,options:c,recentHostEvents:d})),r)}t.on("handshake",x=>{x.config&&(x.config.storageVersion&&o.rememberStorageVersion(x.config.storageVersion),s=x.config,u(),m())});let v=yu(t,{getOptions:()=>c,getVisitorId:()=>o.getVisitorId(),getConversationId:()=>o.loadConversationId()});function y(x={}){o.reset(),i={...i,userContext:void 0,userToken:void 0,...x},d.length=0,_+=1,p=!0,u(),m()}return{getOptions:()=>c,getUserOptions:()=>i,render:m,setUserOptions:x=>{i=x,u(),m()},patchUserOptions:x=>{let P="userToken"in x&&x.userToken!==i.userToken;if(P&&i.userToken){y(x);return}P&&(_+=1),i={...i,...x},u(),m()},reset:()=>y(),destroy:()=>v()}}function Dl(e){if(e.mode==="standalone")return"standalone";if(e.mode==="inline")return"inline";let t=wn(e.widgetId,e.storage,e.aiAgentDeploymentId),{panelOpen:n,panelSize:r}=vo(e,wr(),t.loadPanelOpen(),t.loadPanelSize());return Qa(e.mode,r,n)}var UP=Z.scope("iframe"),qP='<!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 Df(e,t,n="closed",r="floating",o=null){UP.debug("createIframeMount",{position:t,initialMode:n,layoutMode:r,hasTarget:!!o});let a=document.createElement("iframe");a.title=`${M.name} chat`,a.setAttribute("allow","microphone; clipboard-write"),$f(a,t,n,r),(r==="inline"&&o?o:document.body).appendChild(a);let s=a.contentDocument;if(!s)throw new Error("iframe contentDocument unavailable (cross-origin?)");s.open(),s.write(qP),s.close();let c=mr({...e,target:s.body}),p=new MutationObserver(()=>{$f(a,t,c.hostElement.dataset.mode??"closed",r)});return p.observe(c.hostElement,{attributes:!0,attributeFilter:["data-mode"]}),{...c,iframeElement:a,destroy(){p.disconnect(),c.destroy(),a.remove()}}}var Ci="border:0;background:transparent;z-index:2147483647;pointer-events:auto;",Of={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 $f(e,t,n,r){if(n==="fullscreen"||r==="standalone"){e.style.cssText=`${Ci}position:fixed;inset:0;width:100vw;height:100vh;`;return}if(r==="inline"){e.style.cssText=`${Ci}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=`${Ci}position:fixed;inset:0;width:100vw;height:100vh;`;return}let a=t.startsWith("top-")?"top":"bottom",i=t.endsWith("-left")?"left":"right",{w:s,h:c}=Of[n]??Of.open;e.style.cssText=`${Ci}position:fixed;${a}:16px;${i}:16px;width:${s};height:${c};`}var fn=new Map;function Ti(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");e.debug!==void 0&&Yo(e.debug);let t=Z.scope("mount");t.info("mount",{widgetId:e.widgetId,publicKey:e.publicKey,mode:e.presentation?.mode});let n=bn(e),r=n.widgetId,o=fn.get(r);o&&(t.debug("destroy existing instance at slot",{widgetId:r}),o.destroy());let a=Dl(n),i=n.iframe?Df({position:zn(n.mode)},n.position,a,n.mode,e.target??null):mr({position:zn(n.mode),target:e.target??null});i.hostElement.dataset.widgetId=r;let s=new dr,c=wn(r,n.storage,n.aiAgentDeploymentId);function p(P){s.emit("error",P),_.getOptions().onError?.(P)}let _=wi({bus:s,host:i.hostElement,appRoot:i.appRoot,persistence:c,initialRaw:e,reportError:p}),d=yn,u=()=>{},f=new Promise(P=>{u=P});s.on("state",P=>{d=P,P.ready&&u()}),_.render();let m=i.hostElement,v=null;function y(P){P.debug!==void 0&&Yo(P.debug),_.patchUserOptions(P)}let x={widgetId:r,open:P=>ut(m,"open",P),close:()=>ut(m,"close"),expand:()=>ut(m,"expand"),openForm:P=>ut(m,"openForm",P),ask:(P,k)=>ut(m,"ask",on(P,k)),on:(P,k)=>s.on(P,k),update:P=>{t.debug("update",{patch:P}),y(P)},setUserContext:P=>{t.debug("setUserContext",{keys:Object.keys(P)}),y({userContext:{..._.getUserOptions().userContext,...P}})},clearUserContext:()=>{t.debug("clearUserContext"),y({userContext:void 0})},setPageContext:P=>{t.debug("setPageContext",{keys:Object.keys(P)}),y({pageContext:{..._.getUserOptions().pageContext,...P}})},clearPageContext:()=>{t.debug("clearPageContext"),y({pageContext:void 0})},get state(){return d},ready:f,reset:()=>{t.info("reset",{widgetId:r}),_.reset()},login:P=>{t.info("login",{widgetId:r}),y({userToken:P})},track:(P,k)=>{let g=pr(P,k);g&&s.emit("hostEvent",g)},registerTool:Hn,setDebug:P=>{Yo(P),t.info("debug level set",{level:zr()})},debugLevel:()=>zr(),onLog:P=>jr(P),destroy:()=>{t.info("destroy",{widgetId:r}),s.emit("state",yn),v?.(),_.destroy(),s.clear(),Xt(null,i.appRoot),i.destroy(),fn.get(r)===x&&fn.delete(r)}};return v=Uc(x,s),fn.set(r,x),x}function Ri(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");let t=e.widgetId??"default",n=fn.get(t);return n?(n.update(e),n):Ti(e)}function Fl(e){if(e!==void 0){fn.get(e)?.destroy();return}let t=[...fn.values()];for(let n of t)n.destroy()}function Lt(e="default"){return fn.get(e)??null}function Ff(){return[...fn.values()]}function Ii(e,t,n){return ss(e,t,n)}var Bf=_r;var Bl=class extends HTMLElement{constructor(){super(...arguments);te(this,"bus",new dr);te(this,"widgetState",yn);te(this,"userToken");te(this,"pageTools",[]);te(this,"markReady",()=>{});te(this,"ready",new Promise(n=>{this.markReady=n}));te(this,"mountResult",null);te(this,"runtime",null)}static get observedAttributes(){return rs}connectedCallback(){if(Object.hasOwn(this,"tools")){let n=Reflect.get(this,"tools");Reflect.deleteProperty(this,"tools"),this.pageTools=Array.isArray(n)?n:[]}this.boot()}disconnectedCallback(){this.mountResult&&(this.runtime?.destroy(),this.runtime=null,Xt(null,this.mountResult.appRoot),this.bus.clear(),this.widgetState=yn)}attributeChangedCallback(){this.isConnected&&this.boot()}open(n){ut(this,"open",n)}close(){ut(this,"close")}expand(){ut(this,"expand")}openForm(n){ut(this,"openForm",n)}ask(n,r){ut(this,"ask",on(n,r))}get state(){return this.widgetState}reset(){this.userToken=void 0,this.runtime?.reset()}login(n){this.userToken=n,this.runtime?.patchUserOptions({userToken:n})}track(n,r){let o=pr(n,r);o&&this.bus.emit("hostEvent",o)}get tools(){return this.pageTools}set tools(n){this.pageTools=n,this.runtime?.patchUserOptions({tools:n})}registerTool(n,r){Hn(n,r)}on(n,r){return this.bus.on(n,r)}boot(){let n={...Zo(a=>this.getAttribute(a)),...this.userToken?{userToken:this.userToken}:{},tools:this.pageTools};if(!n.aiAgentDeploymentId)throw new Error("ai-agent-deployment-id is required");if(this.runtime){this.runtime.setUserOptions(n);return}let r=bn(n);this.mountResult??(this.mountResult=mr({existingHost:this,position:zn(r.mode)}));let o=wn(r.widgetId,r.storage,r.aiAgentDeploymentId);this.bus.on("state",a=>{this.widgetState=a,a.ready&&this.markReady()}),this.runtime=wi({bus:this.bus,host:this.mountResult.hostElement,appRoot:this.mountResult.appRoot,persistence:o,initialRaw:n,reportError:a=>this.bus.emit("error",a)}),this.runtime.render()}},Hf=!1;function Hl(){if(Hf||typeof customElements>"u")return;let e=M.tagName;customElements.get(e)||customElements.define(e,Bl),Hf=!0}typeof customElements<"u"&&Hl();var Uf=Z.scope("iife");function zP(e){return typeof e=="string"||typeof e=="function"}function Ei(){return new Promise(e=>{let t=Lt();if(t){t.ready.then(()=>e(t));return}let n=Ii("default","state",r=>{n(),r.ready.then(()=>e(r))})})}var qf={ask:(e,t)=>typeof e=="string"?Lt()?.ask(e,on(e,t)):void 0,close:()=>Lt()?.close(),ready:e=>Ei().then(t=>typeof e=="function"?e(t):void 0),reset:()=>Lt()?.reset(),login:e=>{if(!zP(e))return;let t=Lt();return t?t.login(e):Ei().then(n=>n.login(e))},destroy:()=>Fl(),expand:()=>Lt()?.expand(),track:(e,t)=>{let n=pr(e,t);if(!n)return;let r=Lt();return r?r.track(n.name,n.data):Ei().then(o=>o.track(n.name,n.data))},hook:(e,t,n)=>typeof e=="string"&&typeof t=="string"&&typeof n=="function"?Ii(e,t,n):void 0,init:e=>Ri(e),mount:e=>Ti(e),on:(e,t)=>Lt()?.on(e,t),onLog:e=>jr(e),registerTool:Hn,open:e=>Lt()?.open(e),setDebug:e=>Lt()?.setDebug(e),update:e=>Lt()?.update(e)};function zf(e,...t){let n=qf[e];if(!n){Uf.warn("unknown command",{command:e});return}return n(...t)}function jP(){let e=((t,...n)=>zf(t,...n));e.init=Ri,e.mount=Ti,e.destroy=Fl,e.getInstance=Lt,e.getAllInstances=Ff,e.version=Bf,e.ready=Ei,e.hook=Ii,e.debugLevel=()=>zr(),e.onLog=jr,e.registerTool=Hn;for(let t of["ask","close","expand","login","on","open","reset","setDebug","track","update"])Reflect.set(e,t,qf[t]);return e}function VP(e){let t=e?.q;if(t)for(let n of t){let r=[...n],[o,...a]=r;if(typeof o=="string")try{zf(o,...a)}catch(i){Uf.warn("queued command failed",{command:o,error:i})}}}function WP(){let e=[],t=e.push.bind(e);return e.push=(...n)=>(ls(n),t(...n)),e}function GP(){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 KP(){if(typeof window>"u"||typeof document>"u")return;let e=globalThis[M.global],t=jP();globalThis[M.global]=t,Hl();let n=`${M.global}Hooks`,r=globalThis[n];if(ls(r),globalThis[n]=WP(),VP(e),Lt())return;let o=document.currentScript??GP(),a=os(o?.dataset),i=a.aiAgentDeploymentId;if(!i)return;let s=()=>{Lt()||Ri({...a,aiAgentDeploymentId:i})};if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",s,{once:!0});return}s()}KP();})();
64
65
  //# sourceMappingURL=elements.js.map