@alxxsck/ai-assistant 3.4.2 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Avatar-KB7fiXTT.js → Avatar-DvAwP_HS.js} +310 -305
- package/dist/{ChatWidgetContent-BK1Po0Bb.js → ChatWidgetContent-DBiBwNjJ.js} +2143 -1959
- package/dist/ai-assistant.css +1 -0
- package/dist/api/messages.api.types.d.ts +3 -0
- package/dist/avatar/Avatar.d.ts +3 -0
- package/dist/bridge-ai-chat-widget.es.js +1 -1
- package/dist/domain/message/scenario-photo-content.d.ts +1 -0
- package/dist/domain/ui/widget-geometry.d.ts +4 -3
- package/dist/i18n/messages.d.ts +12 -1
- package/dist/index-BcPWKJOI.js +2913 -0
- package/dist/{mount-eQG3ZeqK.js → mount-j9dyEXzG.js} +5928 -5750
- package/dist/ui/components/AvatarRotationControl.d.ts +1 -0
- package/dist/ui/components/ChatSurfaceFrameContext.d.ts +2 -0
- package/dist/ui/components/ScenarioPhotoCard.d.ts +4 -0
- package/package.json +1 -1
- package/dist/index-BdLdThTz.js +0 -2913
|
@@ -0,0 +1,2913 @@
|
|
|
1
|
+
const _t = '@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0;--chat-veil-alpha-start:1;--chat-veil-alpha-upper:1;--chat-veil-alpha-middle:1;--chat-veil-alpha-lower:1}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-blue-500:oklch(62.3% .214 259.815);--color-violet-200:oklch(89.4% .057 293.283);--color-rose-200:oklch(89.2% .058 10.001);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--ease-in:cubic-bezier(.4,0,1,1);--ease-out:cubic-bezier(0,0,.2,1);--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--blur-xs:4px;--blur-md:12px;--blur-xl:24px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components{.btn-preview{border-style:var(--tw-border-style);border-width:5px;border-color:var(--color-blue-500);border-radius:3.40282e38px}.message{background:var(--chat-surface-agent);max-width:100%;color:var(--chat-text-primary);border:0;border-radius:17px;padding:7px 11px;font-size:14px;font-weight:400;line-height:20px;box-shadow:0 6px 18px #00000029}.chat-message-row[data-author=customer]>.message,.message[data-author=customer]{background:var(--chat-surface-customer)}.bridge-ai-chat-widget [class~=text-start]{text-align:left;text-align:start}.bridge-ai-chat-widget[dir=rtl] [class~=text-start]{text-align:right;text-align:start}.chat-message-row[data-author=agent]>.message,.message[data-author=agent],.chat-message-skeleton-bubble.self-start{border-bottom-left-radius:5px}.chat-message-row[data-author=customer]>.message,.message[data-author=customer],.chat-message-skeleton-bubble.self-end{border-bottom-right-radius:5px}.bridge-ai-chat-widget[dir=rtl] .chat-message-row[data-author=agent]>.message,.bridge-ai-chat-widget[dir=rtl] .message[data-author=agent],.bridge-ai-chat-widget[dir=rtl] .chat-message-skeleton-bubble.self-start{border-bottom-right-radius:5px;border-bottom-left-radius:17px}.bridge-ai-chat-widget[dir=rtl] .chat-message-row[data-author=customer]>.message,.bridge-ai-chat-widget[dir=rtl] .message[data-author=customer],.bridge-ai-chat-widget[dir=rtl] .chat-message-skeleton-bubble.self-end{border-bottom-right-radius:17px;border-bottom-left-radius:5px}.message[data-author=agent]{margin-left:8px}.message[data-author=customer]{margin-right:8px}.bridge-ai-chat-widget[dir=rtl] .message[data-author=agent]{margin-left:0;margin-right:8px}.bridge-ai-chat-widget[dir=rtl] .message[data-author=customer]{margin-left:8px;margin-right:0}.chat-message-row[data-author=agent]+.chat-message-row[data-author=agent],.chat-message-row[data-author=customer]+.chat-message-row[data-author=customer]{margin-top:-4px}.chat-message-content p+p{margin-top:8px}.chat-message-author{color:#ffffffb8;letter-spacing:.01em;align-items:center;gap:6px;padding-inline:4px;font-size:11px;font-weight:600;display:inline-flex}.chat-message-author img{object-fit:cover;background:#0e131bcc;border:1px solid #68d8ff5c;border-radius:9999px;width:18px;height:18px}.chat-message-author[data-author-kind=operator] img{border-color:#d7ff6480}.chat-attachments{flex-direction:column;gap:6px;max-width:100%;display:flex}.chat-message-row[data-author=customer] .chat-attachments{justify-content:flex-end;align-self:flex-end}.chat-attachment-card,.chat-attachment-placeholder{width:min(250px,100%);max-width:100%;color:var(--chat-text-primary);background:linear-gradient(135deg,#68d8ff0e,#0000 58%),#050a1094;border:1px solid #ffffff1f;border-radius:13px;align-items:center;gap:8px;padding:7px;text-decoration:none;display:flex;box-shadow:inset 0 1px #ffffff09}.chat-attachment-card__icon,.chat-attachment-card__thumbnail{color:#87e2ffe0;background:#68d8ff14;border:1px solid #68d8ff2e;border-radius:9px;flex:none;width:34px;height:34px}.chat-attachment-card__icon{justify-content:center;align-items:center;display:flex}.chat-attachment-card__thumbnail{object-fit:cover}.chat-attachment-card__action{color:#ffffff94;border-radius:9px;justify-content:center;align-items:center;width:36px;height:36px;transition:color .14s,background-color .14s,transform .14s;display:inline-flex}.chat-attachment-card__action:hover{color:#a0eaff;background:#68d8ff1c}.chat-attachment-card__action:active{transform:scale(.94)}.chat-attachment-card__action:focus-visible{outline-offset:1px;outline:2px solid #68d8ffb8}.chat-message-receipt{color:#68d8ffc7;align-self:flex-end;padding-inline:4px;font-size:10px;line-height:1.2}.chat-composer-attachments{flex-direction:column;gap:6px;max-height:148px;padding:4px 4px 6px;display:flex;overflow-y:auto}.chat-composer-attachment{color:#ffffffd6;background:linear-gradient(90deg,#68d8ff0e,#0000 62%),#05090f80;border:1px solid #ffffff1a;border-radius:12px;align-items:center;gap:8px;width:100%;max-width:100%;padding:6px;font-size:11px;animation:.18s ease-out both chat-attachment-ready-in;display:flex;position:relative;overflow:visible;box-shadow:inset 0 1px #ffffff09}.chat-composer-attachment__preview{color:#87e2ffcc;background:#68d8ff12;border:1px solid #68d8ff2b;border-radius:9px;flex:none;justify-content:center;align-items:center;width:36px;height:36px;display:flex;overflow:hidden}.chat-composer-attachment__preview img{object-fit:cover;width:100%;height:100%}.chat-composer-attachment__progress{background:#ffffff14;border-radius:99px;height:2px;margin-top:5px;overflow:hidden}.chat-composer-attachment__progress span{border-radius:inherit;background:linear-gradient(90deg,#36bfe9,#8be7ff);height:100%;transition:width .16s;display:block;box-shadow:0 0 8px #68d8ff80}.chat-composer-attachment__progress span.is-scanning{background:linear-gradient(90deg,#f6c65b,#fff0af);width:36%;animation:1.2s ease-in-out infinite chat-attachment-scan;box-shadow:0 0 8px #f6c65b59}.chat-composer-attachment__action{border-radius:9px;flex:none;justify-content:center;align-items:center;width:36px;height:36px;transition:color .14s,background-color .14s,transform .14s;display:flex}.chat-composer-attachment__action:hover{color:#fff;background:#ffffff14}.chat-composer-attachment__action:disabled{cursor:wait;opacity:.62}.chat-composer-attachment__action:disabled:hover{background:0 0}.chat-composer-attachment__action:active{transform:scale(.94)}.chat-composer-attachment__action:focus-visible,.chat-attach-button:focus-visible{outline-offset:1px;outline:2px solid #68d8ffb8}.chat-attachment-dropzone{z-index:50;color:#b3edff;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:#060d15db;border:1px dashed #68d8ffad;border-radius:18px;justify-content:center;align-items:center;animation:.15s ease-out both chat-attachment-drop-in;display:flex;position:absolute;inset:6px 8px 52px;box-shadow:inset 0 0 42px #68d8ff14,0 16px 38px #0000005c}.chat-attachment-dropzone__content{text-align:center;flex-direction:column;align-items:center;gap:7px;font-size:13px;font-weight:650;display:flex}.chat-attachment-dropzone__content small{color:#ffffff80;font-size:10px;font-weight:450}@keyframes chat-attachment-ready-in{0%{opacity:0;transform:translateY(4px)scale(.99)}}@keyframes chat-attachment-scan{0%{transform:translate(-110%)}50%{transform:translate(90%)}to{transform:translate(290%)}}@keyframes chat-attachment-drop-in{0%{opacity:0;transform:scale(.985)}}@media(pointer:coarse){.chat-attachment-card__action,.chat-composer-attachment__action,.chat-attach-button{width:40px;height:40px}}.chat-message-content strong{font-weight:650}.chat-message-content h1,.chat-message-content h2,.chat-message-content h3,.chat-message-content h4,.chat-message-content h5,.chat-message-content h6{margin:8px 0 4px;font-weight:650;line-height:1.3}.chat-message-content h1,.chat-message-content h2{font-size:1.12em}.chat-message-content ul,.chat-message-content ol{padding-left:20px;margin:6px 0;padding-inline-start:20px}.bridge-ai-chat-widget[dir=rtl] .chat-message-content ul,.bridge-ai-chat-widget[dir=rtl] .chat-message-content ol{padding-left:0;padding-right:20px}.chat-message-content ul{list-style:outside}.chat-message-content ol{list-style:decimal}.chat-message-content blockquote{color:#f3f0f4c2;border-left:2px solid #68d8ff7a;padding-left:9px;border-inline-start:2px solid #68d8ff7a;margin:6px 0;padding-inline-start:9px}.bridge-ai-chat-widget[dir=rtl] .chat-message-content blockquote{border-left:0;border-right:2px solid #68d8ff7a;padding-left:0;padding-right:9px}.chat-message-content code{background:#ffffff17;border-radius:4px;padding:1px 4px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:.88em}.chat-message-content pre{background:#0003;border:1px solid #ffffff14;border-radius:8px;max-width:100%;margin:7px 0;padding:8px;overflow-x:auto}.chat-message-content pre code{background:0 0;padding:0}.chat-message-link{color:var(--chat-accent-cyan);text-underline-offset:2px;-webkit-text-decoration:underline #68d8ff61;text-decoration:underline #68d8ff61}.chat-message-link:hover{text-decoration-color:currentColor}.chat-message-link:focus-visible{outline:2px solid var(--chat-accent-cyan);outline-offset:2px;border-radius:2px}.chat-citation{vertical-align:super;margin-left:1px;margin-inline-start:1px;font-size:.72em;line-height:0}.bridge-ai-chat-widget[dir=rtl] .chat-citation{margin-left:0;margin-right:1px}.chat-citation .chat-message-link{text-decoration:none}.chat-icon-button{color:#ffffffd6;-webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px);width:36px;height:36px;transition:color .16s ease,border-color .16s ease,background-color .16s ease,transform .14s var(--chat-ease-out);background:#0c0f157a;border:1px solid #ffffff1a;border-radius:9999px;justify-content:center;align-items:center;display:flex;box-shadow:inset 0 1px #ffffff0a}@media(hover:hover)and (pointer:fine){.chat-icon-button:hover{color:var(--chat-accent-cyan);background:#141921c7;border-color:#68d8ff57}}.chat-icon-button:active{transform:scale(.97)}.chat-icon-button:focus-visible,.chat-launcher:focus-visible,.chat-composer-action:focus-visible,.chat-microphone-button:focus-visible{outline:2px solid var(--chat-accent-cyan);outline-offset:2px}[data-lola-widget-shell]{backface-visibility:hidden;visibility:hidden;opacity:0;pointer-events:none;transform-origin:50% 100%;transition:visibility 0s linear .2s,opacity .14s var(--chat-ease-out),transform .18s var(--chat-ease-out);transform:translateY(10px)scale(.985);box-shadow:0 24px 64px #00000052,0 8px 24px #0003}[data-lola-widget-shell][data-state=open]{visibility:visible;opacity:1;pointer-events:auto;transition:visibility 0s,opacity .18s var(--chat-ease-out),transform .24s var(--chat-ease-out);transform:translate(0)scale(1)}[data-lola-widget-shell][data-layout=fullscreen]{width:100vw;height:100vh}@supports (width:100dvw) and (height:100dvh){[data-lola-widget-shell][data-layout=fullscreen]{width:100dvw;height:100dvh}}[data-lola-widget-shell][data-layout=fullscreen] .chat-widget-panel{padding-top:env(safe-area-inset-top,0px);padding-right:env(safe-area-inset-right,0px);padding-bottom:env(safe-area-inset-bottom,0px);padding-left:env(safe-area-inset-left,0px)}.chat-widget-panel{background:var(--chat-immersive-surface);transform:translateZ(0)}[data-lola-widget-shell][data-layout=compact]{box-shadow:0 18px 48px #0000004d,0 0 28px #68d8ff14,0 0 36px #ff28b712}[data-lola-widget-shell][data-layout=compact] .chat-widget-panel{-webkit-backdrop-filter:blur(4px)saturate(1.08);backdrop-filter:blur(4px)saturate(1.08);background:#17161b4d;border:1px solid #ffffff1a}.full-assistant-layer,.compact-assistant-layer{visibility:hidden;opacity:0;pointer-events:none;transition:visibility 0s linear .18s,opacity .14s var(--chat-ease-out),transform .18s var(--chat-ease-out);transform:translateY(6px)scale(.985)}.chat-widget-panel[data-assistant-mode=full] .full-assistant-layer,.chat-widget-panel[data-assistant-mode=compact] .compact-assistant-layer{visibility:visible;opacity:1;pointer-events:auto;transition:visibility 0s,opacity .18s var(--chat-ease-out),transform .24s var(--chat-ease-out);transform:translate(0)scale(1)}.chat-avatar-stage{contain:layout paint style;isolation:isolate}.chat-avatar-stage__backdrop{z-index:-2;background:var(--chat-immersive-surface);opacity:0;transition:opacity .22s var(--chat-ease-out)}.chat-avatar-stage__backdrop:after{content:"";opacity:0;transition:opacity .22s var(--chat-ease-out);background:#00000070;position:absolute;inset:0}.chat-avatar-stage[data-immersive=true] .chat-avatar-stage__backdrop,.chat-avatar-stage[data-support-visuals=true] .chat-avatar-stage__backdrop:after{opacity:1}.chat-avatar-stage__cloud{z-index:-1;opacity:0;transform-origin:50% 52%;transition:opacity .24s var(--chat-ease-out),transform .28s var(--chat-ease-out);background:radial-gradient(66% 32% at 50% 43%,#1193c24d,#0e65b030 38%,#14378512 64%,#0000 86%),radial-gradient(58% 23% at 48% 31%,#19b5db54,#1371b324 52%,#0000 82%),radial-gradient(48% 22% at 29% 51%,#296ac036,#3c3fa414 60%,#0000 82%),radial-gradient(50% 22% at 72% 53%,#3156b930,#4a369d12 60%,#0000 82%),radial-gradient(58% 18% at 50% 66%,#4d34a129,#6830890d 62%,#0000 84%),radial-gradient(34% 14% at 65% 66%,#88318f12,#0000 80%);transform:scale(.94)}.chat-avatar-stage[data-immersive=true] .chat-avatar-stage__cloud{opacity:1;transition-delay:40ms;transform:scale(1)}.chat-avatar-stage[data-compact=true] .chat-avatar-stage__backdrop{opacity:0;background:0 0}.chat-avatar-stage[data-compact=true] .chat-avatar-stage__cloud{opacity:1;background:radial-gradient(72% 35% at 45% 73%,#ff28b770,#ff28b721 48%,#0000 78%),radial-gradient(68% 42% at 48% 58%,#06e1fd61,#06e1fd1c 52%,#0000 82%);transform:scale(1.05)}.chat-avatar-stage[data-support-visuals=true] .chat-avatar-stage__cloud{opacity:.22;transition-delay:0s;transform:scale(.98)}.chat-avatar-stage__canvas{--chat-avatar-active-clearance:0px;--chat-avatar-active-lift:0px;opacity:1;visibility:visible;transition:opacity .18s var(--chat-ease-out),visibility 0s;inset:0;overflow:hidden}.chat-avatar-stage[data-immersive=true] .chat-avatar-stage__canvas{--chat-avatar-active-clearance:calc(var(--chat-avatar-controls-clearance) + var(--lola-safe-area-inset-bottom));--chat-avatar-active-lift:var(--chat-avatar-lift);bottom:var(--chat-avatar-active-clearance)}.chat-avatar-stage[data-compact=true] .chat-avatar-stage__canvas{--chat-avatar-active-clearance:0px;--chat-avatar-active-lift:0px;inset:0 0 20px;-webkit-mask-image:linear-gradient(#000 0% 70%,#000000e6 78%,#0000006b 90%,#0000 100%);mask-image:linear-gradient(#000 0% 70%,#000000e6 78%,#0000006b 90%,#0000);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.chat-avatar-stage[data-compact=true] .chat-avatar-stage__render-surface{height:100%;transform:translateY(4px)}.chat-avatar-stage[data-compact=true] .chat-avatar-stage__loading{text-align:center;background:#1113;padding:38px 12px 52px;font-size:11px}.compact-assistant{border-radius:inherit;isolation:isolate;outline:none;width:100%;height:100%;position:relative;overflow:hidden}.compact-assistant:focus-visible{outline:2px solid var(--chat-accent-cyan);outline-offset:-3px}.compact-assistant__close,.compact-assistant__resize{z-index:5;color:#fff;opacity:.94;width:32px;height:32px;transition:opacity .14s var(--chat-ease-out),transform .16s var(--chat-ease-out);background:0 0;border:0;border-radius:14px;place-items:center;display:grid;position:absolute;top:8px}.compact-assistant__close{right:8px}.compact-assistant__resize{left:8px}.compact-assistant__close svg,.compact-assistant__resize svg{width:14px;height:14px}.compact-assistant__close:before,.compact-assistant__resize:before{content:"";position:absolute;inset:-6px}.compact-assistant__controls{z-index:6;height:44px;position:absolute;bottom:8px;left:0;right:0}.compact-assistant__voice.voice-composer{width:44px;min-width:44px;height:44px;min-height:44px;box-shadow:none;background:0 0;border:0;border-radius:50%;padding:0;display:block;position:absolute;top:0;left:50%;overflow:visible;transform:translate(-50%)}.compact-assistant__voice .voice-composer__orb,.compact-assistant__loader.voice-composer__loader{left:50%}.compact-assistant__voice .voice-composer__orb{width:44px;height:44px}.compact-assistant__voice .voice-composer__orb-surface_active,.compact-assistant__voice .voice-composer__orb-surface_muted{transition:border-color .16s var(--chat-ease-out),box-shadow .16s var(--chat-ease-out),opacity 90ms linear;background:linear-gradient(145deg,#000000c2,#0000 96%);border:1px solid #ffffff1a;box-shadow:inset 0 1px #ffffff14}.compact-assistant[data-voice-active=true] .compact-assistant__voice[data-voice-muted=false] .voice-composer__orb-surface_active{border-color:#a5fc4c6b;box-shadow:inset 0 1px #ffffff24,0 0 0 2px #a5fc4c12}.compact-assistant__voice .voice-composer__orb-surface_muted{background:linear-gradient(145deg,#323236e0,#202024 96%);border-color:#ffffff1f}.compact-assistant__voice .voice-composer__orb-aura{filter:blur(7px);background:radial-gradient(circle,#a5fc4c6b 0 24%,#a5fc4c29 44%,#0000 72%),conic-gradient(from 210deg,#06e1fd3d,#a5fc4c52,#ff28b72e,#06e1fd3d);inset:-12px}.compact-assistant__loader .voice-composer__loader-bar{background:linear-gradient(#06e1fd,#ff28b7)}.compact-assistant__secondary{color:#fff;width:38px;height:38px;transition:border-color .16s var(--chat-ease-out),transform .16s var(--chat-ease-out);background:linear-gradient(145deg,#000000c2,#0000 96%);border:1px solid #ffffff1a;border-radius:15px;place-items:center;display:grid;position:absolute;top:3px;right:8px;overflow:visible;box-shadow:inset 0 1px #ffffff14}.compact-assistant__secondary:before{content:"";position:absolute;inset:-3px}.compact-assistant__secondary-icon{transition:opacity .16s var(--chat-ease-in-out),transform .22s var(--chat-ease-in-out);will-change:opacity,transform;place-items:center;display:grid;position:absolute}.compact-assistant__secondary-icon svg{width:24px;height:24px}.compact-assistant__secondary-icon_close svg{width:16px;height:16px}.compact-assistant__secondary-icon_chat{opacity:1;transform:rotate(0)scale(1)}.compact-assistant__secondary-icon_close{opacity:0;transform:rotate(-70deg)scale(.7)}.compact-assistant__secondary[data-voice-active=true] .compact-assistant__secondary-icon_chat{opacity:0;transform:rotate(70deg)scale(.7)}.compact-assistant__secondary[data-voice-active=true] .compact-assistant__secondary-icon_close{opacity:1;transform:rotate(0)scale(1)}.compact-assistant__secondary .chat-unread-indicator{top:-3px;right:-3px}.compact-assistant__close:active,.compact-assistant__resize:active,.compact-assistant__secondary:active{transform:scale(.97)}.compact-assistant__close:focus-visible,.compact-assistant__resize:focus-visible,.compact-assistant__secondary:focus-visible{outline:2px solid var(--chat-accent-cyan);outline-offset:2px}@media(hover:hover)and (pointer:fine){.compact-assistant__close:hover,.compact-assistant__resize:hover{opacity:1}.compact-assistant__secondary:hover{border-color:#ffffff38}}.chat-avatar-stage__render-surface{height:calc(100% + var(--chat-avatar-active-clearance));transform:translateY(calc(-1*var(--chat-avatar-active-lift)));top:0;left:0;right:0}.chat-avatar-stage__canvas[data-hidden=true]{opacity:0;visibility:hidden;transition:opacity .18s var(--chat-ease-out),visibility 0s linear .18s}.chat-avatar-stage__loading{transition:opacity .16s var(--chat-ease-out);background:0 0}.chat-message-viewport[data-message-veil=on],.chat-message-viewport[data-message-veil=revealing]{-webkit-mask-image:linear-gradient(to bottom,rgb(0 0 0/var(--chat-veil-alpha-start))0%,rgb(0 0 0/var(--chat-veil-alpha-upper))16%,rgb(0 0 0/var(--chat-veil-alpha-middle))30%,rgb(0 0 0/var(--chat-veil-alpha-lower))42%,#000 var(--chat-veil-opaque-start),#000 100%);mask-image:linear-gradient(to bottom,rgb(0 0 0/var(--chat-veil-alpha-start))0%,rgb(0 0 0/var(--chat-veil-alpha-upper))16%,rgb(0 0 0/var(--chat-veil-alpha-middle))30%,rgb(0 0 0/var(--chat-veil-alpha-lower))42%,#000 var(--chat-veil-opaque-start),#000 100%);transition:--chat-veil-alpha-start .22s var(--chat-ease-out),--chat-veil-alpha-upper .22s var(--chat-ease-out),--chat-veil-alpha-middle .22s var(--chat-ease-out),--chat-veil-alpha-lower .22s var(--chat-ease-out);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.chat-message-viewport[data-message-veil=on]{--chat-veil-alpha-start:0;--chat-veil-alpha-upper:.06;--chat-veil-alpha-middle:.3;--chat-veil-alpha-lower:.7}.chat-message-viewport[data-message-veil=revealing],.chat-message-viewport:has(:focus-visible){--chat-veil-alpha-start:1;--chat-veil-alpha-upper:1;--chat-veil-alpha-middle:1;--chat-veil-alpha-lower:1}.chat-message-veil-spacer{flex:0 0 var(--chat-veil-opaque-start);pointer-events:none}.chat-message-viewport[data-message-veil=off]>.chat-message-veil-spacer{flex-basis:0}.chat-top-controls .chat-icon-button,.chat-history-back-button{color:#fff;-webkit-backdrop-filter:none;backdrop-filter:none;border-color:#242424;border-radius:13px;flex:none;width:32px;height:32px;position:relative}.chat-top-controls .chat-icon-button{box-shadow:none;background:0 0;border-color:#2a2a2a}.avatar-rotation-control{touch-action:none;color:#ffffffb8;cursor:ew-resize;-webkit-user-select:none;user-select:none;width:58px;height:32px;transition:border-color .16s var(--chat-ease-out),color .16s var(--chat-ease-out),transform .14s var(--chat-ease-out);background:0 0;border:1px solid #2a2a2a;border-radius:13px;flex:none;justify-content:center;align-items:center;gap:5px;display:flex}.avatar-rotation-control>svg{flex:none;width:14px;height:14px}.avatar-rotation-control__track{background:#fff3;border-radius:9999px;width:24px;height:2px;display:block;position:relative}.avatar-rotation-control__thumb{background:var(--chat-accent-cyan);border-radius:50%;width:5px;height:5px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);box-shadow:0 0 8px #68d8ff70}.avatar-rotation-control:active{transform:scale(.98)}.avatar-rotation-control:focus-visible{outline:2px solid var(--chat-accent-cyan);outline-offset:2px}.chat-history-back-button{background:#1a1a1a;box-shadow:inset 0 1px #ffffff09}@media(hover:hover)and (pointer:fine){.chat-top-controls .chat-icon-button:hover,.chat-history-back-button:hover,.avatar-rotation-control:hover{color:#fff;border-color:#343434}.chat-top-controls .chat-icon-button:hover{background:0 0}.chat-history-back-button:hover{background:#202020}}.compact-preview-anchor{width:min(320px,calc(100vw - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px) - 24px));contain:layout style}.compact-preview-anchor[data-suspended=true]{opacity:0;pointer-events:none}.compact-preview-anchor[data-suspended=true] :is(.compact-scenario-preview,.compact-scenario-preview *),.compact-preview-anchor[data-suspended=true] .compact-scenario-preview__action:after{animation-play-state:paused!important}.chat-launcher-menu{overscroll-behavior:contain;background:#121417f5;border:1px solid #ffffff24;border-radius:14px;width:max-content;min-width:168px;display:grid;overflow:hidden auto;box-shadow:0 12px 32px #00000052}.chat-launcher-menu>button{min-height:44px;color:var(--chat-text-primary);font:inherit;text-align:start;background:0 0;border:0;padding:10px 14px}.chat-launcher-menu>button:hover,.chat-launcher-menu>button:focus-visible{background:#ffffff1a}.chat-launcher-menu>button:focus-visible{outline:2px solid var(--chat-accent-cyan);outline-offset:-3px}.bridge-ai-chat-widget.is-interacting .chat-launcher,.bridge-ai-chat-widget.is-interacting [data-lola-widget-shell]{transition:none}.bridge-ai-chat-widget[data-preview-active=true] .chat-launcher__portrait,.bridge-ai-chat-widget[data-preview-active=true] .chat-launcher__aura,.bridge-ai-chat-widget.is-interacting .chat-launcher__portrait,.bridge-ai-chat-widget.is-interacting .chat-launcher__aura{animation-play-state:paused}.chat-launcher{visibility:visible;opacity:1;transition:visibility,opacity .14s ease-out,transform .18s ease-out;transform:translateZ(0)scale(1)}.chat-launcher[aria-expanded=true]{visibility:hidden;opacity:0;pointer-events:none;transition:visibility 0s linear .16s,opacity .12s var(--chat-ease-out),transform .16s var(--chat-ease-out);transform:translateZ(0)scale(.88)}.chat-launcher{color:#fff;cursor:grab;isolation:isolate;touch-action:none;background:#090f16e0;border:0;border-radius:9999px;place-items:center;padding:3px;display:grid}.chat-launcher:active{cursor:grabbing}.chat-launcher__portrait{z-index:2;border:3px solid var(--chat-accent-cyan);background:radial-gradient(circle at 50% 35%,#3d4c5d,#0c1219 72%);border-radius:9999px;width:46px;height:46px;animation:2.8s ease-in-out infinite lola-launcher-breathe;display:block;position:relative;overflow:hidden;box-shadow:inset 0 0 0 1px #ffffff3d,0 0 13px #68d8ffa3,0 0 30px #45bdff42}.chat-launcher__portrait img{width:100%;max-height:inherit;object-fit:cover;object-position:50% 20%;-webkit-user-select:none;user-select:none;height:100%;transform:scale(1.22)translateY(6%)}.chat-launcher__aura{z-index:1;filter:blur(7px);opacity:.7;background:conic-gradient(from 45deg,#68d8ff47,#775cff14,#68d8ff5c,#775cff14,#68d8ff47);border:1px solid #68d8ff61;border-radius:9999px;animation:3.6s ease-in-out infinite lola-launcher-aura;position:absolute;inset:-7px}.chat-widget-resize-corner:after{content:"";border-top:2px solid #68d8ffc2;border-left:2px solid #68d8ffc2;border-radius:3px 0 0;width:8px;height:8px;position:absolute;top:5px;left:5px}.chat-widget-resize-corner[data-corner=left]:after{border-left:0;border-right:2px solid #68d8ffc2;border-radius:0 3px 0 0;left:auto;right:5px}@keyframes lola-launcher-breathe{0%,to{transform:scale(1)}50%{transform:scale(1.045)}}@keyframes lola-launcher-aura{0%,to{opacity:.48;transform:scale(.94)rotate(0)}50%{opacity:.82;transform:scale(1.08)rotate(18deg)}}.chat-composer{box-sizing:border-box;background:#141414;border:1px solid #222;border-radius:31px;gap:8px;width:calc(100% - 8px);min-height:62px;margin-inline:4px;padding:10px 9px;box-shadow:inset 0 1px #ffffff03}.chat-composer:focus-within{border-color:#222}.chat-composer__input{box-sizing:border-box;min-height:40px;transition:border-color .18s var(--chat-ease-out),box-shadow .2s var(--chat-ease-out);background:#191919;border:1px solid #222;border-radius:20px}.chat-composer__input:focus-within{border-color:#8fff3752;box-shadow:0 0 0 1px #8fff370e,0 0 18px #8fff3721}.chat-composer__actions{gap:8px;height:40px}.chat-composer textarea::placeholder{font-size:14px}.chat-composer-action{isolation:isolate;color:#818181;width:40px;height:40px;transition:color .16s ease,border-color .16s ease,background-color .16s ease,transform .12s var(--chat-ease-out);background:#191919;border:1px solid #222;border-radius:20px;flex:0 0 40px;place-items:center;display:grid;position:relative;overflow:hidden}@media(hover:hover)and (pointer:fine){.chat-composer-action:hover:not(:disabled){border-color:#2d2d2d}.chat-composer-action:hover:not(:disabled):not([data-mode=send]){color:#9a9a9a}}.chat-composer-action:active:not(:disabled){transform:scale(.97)}.chat-composer-action:disabled{cursor:default}.chat-attach-button:disabled{color:#606060;opacity:.42}.chat-attach-button{animation:chat-composer-attachment-in .16s var(--chat-ease-out)both}@keyframes chat-composer-attachment-in{0%{opacity:0}}.chat-composer-primary-action[data-mode=send]{color:var(--chat-action-primary);background-color:#202718;box-shadow:inset 0 1px #8fff370a}.chat-composer-primary-action__icon{z-index:1;opacity:0;pointer-events:none;filter:blur(1.25px);transition:opacity .15s var(--chat-ease-out),transform .19s var(--chat-ease-in-out),filter .15s var(--chat-ease-out);will-change:opacity,transform,filter;grid-area:1/1;place-items:center;display:grid;transform:scale(.9)rotate(-6deg)}.chat-composer-primary-action__icon[data-icon=send]{transform:scale(.9)rotate(6deg)}.chat-composer-primary-action__icon[data-active=true]{opacity:1;filter:blur();transform:scale(1)rotate(0)}.chat-composer-primary-action[data-mode=send]:disabled{background-color:#20271875}.chat-composer-primary-action:disabled .chat-composer-primary-action__icon[data-icon=send]{opacity:.42}.voice-composer{box-sizing:border-box;isolation:isolate;background:#141414;border:1px solid #222;border-radius:31px;flex:0 0 62px;align-items:center;gap:8px;width:100%;height:62px;min-height:62px;padding:10px 9px;display:flex;position:relative;box-shadow:inset 0 1px #ffffff03}.voice-composer__track{background:#1a1a1a;border:1px solid #222;border-radius:20px;flex:auto;min-width:0;height:40px;position:relative;overflow:visible}.voice-composer__wave-canvas{z-index:4;contain:strict;opacity:1;pointer-events:none;width:calc(100% + 2px);height:54px;transition:opacity .12s var(--chat-ease-out);will-change:opacity;display:block;position:absolute;top:-8px;left:-1px}.voice-composer[data-voice-phase=connecting] .voice-composer__wave-canvas{opacity:0}.voice-composer__loader{z-index:5;opacity:0;pointer-events:none;height:24px;transition:opacity .12s var(--chat-ease-out),transform .16s var(--chat-ease-out);align-items:center;gap:4px;display:flex;position:absolute;top:50%;left:calc(50% + 7px);transform:translate(-50%,-50%)scale(.92)}.voice-composer[data-voice-phase=connecting] .voice-composer__loader{opacity:1;transform:translate(-50%,-50%)scale(1)}.voice-composer__loader-bar{opacity:.42;transform-origin:50%;background:#8b889b;border-radius:2px;width:3px;height:16px;transform:scaleY(.5)}.voice-composer__loader-bar:first-child,.voice-composer__loader-bar:nth-child(5){height:8px}.voice-composer__loader-bar:nth-child(3){height:24px}.voice-composer[data-voice-phase=connecting] .voice-composer__loader-bar{animation:voice-composer-loader-bar .8s var(--chat-ease-in-out)infinite alternate}.voice-composer[data-voice-phase=connecting] .voice-composer__loader-bar:first-child{animation-delay:-.32s}.voice-composer[data-voice-phase=connecting] .voice-composer__loader-bar:nth-child(2){animation-delay:-.16s}.voice-composer[data-voice-phase=connecting] .voice-composer__loader-bar:nth-child(4){animation-delay:-.24s}.voice-composer[data-voice-phase=connecting] .voice-composer__loader-bar:nth-child(5){animation-delay:-80ms}.voice-composer__orb{z-index:3;color:#fff;isolation:isolate;width:54px;height:54px;transition:opacity .16s var(--chat-ease-out),transform .2s var(--chat-ease-out);will-change:opacity,transform;background:0 0;border:0;border-radius:50%;place-items:center;display:grid;position:absolute;top:50%;left:calc(50% + 7px);overflow:visible;transform:translate(-50%,-50%)}.voice-composer[data-voice-phase=connecting] .voice-composer__orb{opacity:0;pointer-events:none;transform:translate(-50%,-50%)scale(.92)}.voice-composer__orb-aura{z-index:0;opacity:0;pointer-events:none;will-change:opacity,transform;background:radial-gradient(circle,#8fff3794,#8fff3747 38%,#8fff371a 58%,#8fff3700 76%);border-radius:50%;transition:opacity 70ms linear,transform 70ms linear;position:absolute;inset:-16px;transform:scale(.9)}.voice-composer__orb-surface{z-index:1;border-radius:inherit;pointer-events:none;will-change:opacity;transition:opacity 90ms linear;position:absolute;inset:0}.voice-composer__orb-surface_active{background:var(--chat-action-primary);opacity:1;box-shadow:inset 0 1px #fff3,0 2px 12px #8fff3752}.voice-composer__orb-surface_muted{opacity:0;background:linear-gradient(#343434,#242424);box-shadow:inset 0 0 0 1px #3b3b3b}.voice-composer[data-voice-muted=true] .voice-composer__orb-surface_active,.voice-composer[data-voice-muted=true] .voice-composer__orb-aura{opacity:0!important}.voice-composer[data-voice-muted=true] .voice-composer__orb-surface_muted{opacity:1}.voice-composer__mic-icon{z-index:2;color:#fff;pointer-events:none;transition:opacity .12s var(--chat-ease-out),transform .16s var(--chat-ease-out);will-change:opacity,transform;position:absolute}.voice-composer__mic-icon_active{opacity:1;width:15px;height:22px;transform:scale(1)}.voice-composer__mic-icon_muted{opacity:0;width:17px;height:22px;transform:scale(.9)}.voice-composer[data-voice-muted=true] .voice-composer__mic-icon_active{opacity:0;transform:scale(.9)}.voice-composer[data-voice-muted=true] .voice-composer__mic-icon_muted{opacity:1;transform:scale(1)}.voice-composer__orb:active:not(:disabled){transform:translate(-50%,-50%)scale(.97)}.voice-composer__orb:disabled{cursor:default}.voice-composer__close{z-index:6;color:#fff;width:30px;height:40px;transition:background-color .16s var(--chat-ease-out),transform .14s var(--chat-ease-out);background:0 0;border:0;border-radius:20px;flex:0 0 30px;place-items:center;display:grid;position:relative}.voice-composer__close svg{width:16px;height:16px}@media(hover:hover)and (pointer:fine){.voice-composer__close:hover{background:#ffffff0e}}.voice-composer__close:active{transform:scale(.94)}.voice-composer__orb:focus-visible,.voice-composer__close:focus-visible{outline:2px solid var(--chat-accent-cyan);outline-offset:2px}@keyframes voice-composer-loader-bar{0%{opacity:.32;transform:scaleY(.42)}to{opacity:.92;transform:scaleY(1)}}.chat-unread-indicator{right:-2px}.bridge-ai-chat-widget[dir=rtl] .chat-unread-indicator{left:-2px;right:auto}.chat-cta-primary,.chat-cta-secondary{isolation:isolate;border-radius:9999px;justify-content:center;align-items:center;min-width:44px;min-height:44px;padding:10px 16px;font-size:14px;font-weight:600;line-height:16px;transition:background-color .16s,border-color .16s,transform .16s;display:inline-flex;position:relative}.chat-cta-primary{background:var(--chat-action-primary);color:#081207;border:0;box-shadow:0 6px 18px #8fff372e}.chat-cta-action{background:var(--chat-action-primary);color:#081207;box-shadow:0 8px 24px #8fff373d,inset 0 1px #ffffff47}.chat-cta-secondary{color:#ffffffb8;background:#fff1;border:1px solid #ffffff1f}.chat-cta-secondary:hover{background:#68d8ff14;border-color:#68d8ff47}.chat-choice-option{isolation:isolate;color:#ffffffe6;text-align:center;-webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px);background:#00000047;border:1px solid #ffffff29;border-radius:22px;justify-content:center;align-items:center;min-width:44px;min-height:30px;padding:4px 12px;font-size:12px;font-weight:600;line-height:20px;transition:color .14s,background-color .14s,border-color .14s,opacity .14s,transform .12s;display:inline-flex;position:relative}.chat-choice-option:before{content:"";pointer-events:auto;background:0 0;position:absolute;inset-block:-5px;inset-inline:0}.chat-choice-option[data-presentation=PRIMARY]{background:var(--chat-action-primary);color:#081207;border-color:#0000}.chat-choice-option[data-presentation=TERTIARY]{color:#ffffffc2;background:#ffffff13;border-color:#ffffff1f}.chat-choice-option--selected,.chat-choice-option:focus-visible,.chat-cta-primary:focus-visible,.chat-cta-secondary:focus-visible{outline:2px solid var(--chat-accent-cyan);outline-offset:2px}.chat-choice-option:active:not(:disabled),.chat-cta-primary:active:not(:disabled),.chat-cta-secondary:active:not(:disabled){transform:scale(.97)}.chat-attention-nudge-once:after{z-index:-1;border-radius:inherit;content:"";opacity:0;pointer-events:none;background:#8fff377a;animation:3s ease-out 3s infinite both compact-scenario-preview-nudge-glow;position:absolute;inset:-4px;transform:scale(.97)}.chat-attention-nudge-once{animation:3s ease-out 3s infinite both compact-scenario-preview-nudge}.chat-attention-nudge-once:active:not(:disabled){animation:none;transform:scale(.97)}.chat-attention-nudge-once:active:not(:disabled):after{opacity:0;animation:none}.chat-voice-card{-webkit-backdrop-filter:blur(22px)saturate(135%);backdrop-filter:blur(22px)saturate(135%);background:#0d1016c7;border:1px solid #ffffff1c;border-radius:20px;box-shadow:0 12px 36px #0000003d}.chat-microphone-button{color:#fff;-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);background:#0d1016a6;border:1px solid #ffffff21;border-radius:9999px;justify-content:center;align-items:center;width:68px;height:68px;transition:transform .16s,border-color .16s,background-color .16s;display:flex;position:relative;box-shadow:0 12px 32px #0000003d,inset 0 1px #ffffff0f}.chat-microphone-button:hover{border-color:#68d8ff6b;transform:translateY(-1px)}.chat-microphone-button_active{background:#68d8ff2e;border-color:#68d8ff75;box-shadow:0 12px 32px #0000003d,0 0 0 6px #68d8ff0f}.chat-list-surface{box-shadow:none;background:#111}.chat-list-header{border-bottom:1px solid #ffffff09}.chat-list-new-button{background:#1c2315;border-color:#a5fc4c1f}.chat-list-item{background:#141414;border-color:#222}@media(hover:hover)and (pointer:fine){.chat-list-new-button:hover{background:#232c1a;border-color:#a5fc4c3d}.chat-list-item:hover{background:#191919;border-color:#ffffff24}}.chat-list-item_selected{background:#171a15;border-color:#a5fc4c57;box-shadow:inset 0 0 0 1px #a5fc4c0f}.chat-list-entry{content-visibility:auto;contain-intrinsic-block-size:88px}.chat-route-stage{border-radius:inherit;isolation:isolate;overflow:hidden}.chat-route-page{border-radius:inherit;height:100%;position:absolute;inset:0;overflow:hidden}.chat-route-page_background{z-index:1}.chat-route-pane{z-index:2;backface-visibility:hidden;contain:layout paint;will-change:transform,opacity}.chat-route-pane_exit{pointer-events:none}.chat-route-pane.chat-route-pane_mode{will-change:auto}.chat-route-pane_mode .chat-mode-content{backface-visibility:hidden;will-change:opacity,transform}.chat-route-pane_enter.chat-route-pane_forward{animation:chat-route-forward-enter .2s var(--chat-ease-out)both}.chat-route-pane_exit.chat-route-pane_backward{animation:chat-route-backward-exit .16s var(--chat-ease-out)both}.chat-route-pane_mode.chat-route-pane_enter.chat-route-pane_forward{z-index:2;animation:none}.chat-route-pane_mode.chat-route-pane_enter.chat-route-pane_forward .chat-mode-content{transform-origin:50% 100%;animation:chat-mode-voice-enter .22s var(--chat-ease-out)both}.chat-route-pane_mode.chat-route-pane_exit.chat-route-pane_forward{z-index:1;animation:none}.chat-route-pane_mode.chat-route-pane_exit.chat-route-pane_forward .chat-mode-content{animation:chat-mode-text-exit .18s var(--chat-ease-out)both}.chat-route-pane_mode.chat-route-pane_enter.chat-route-pane_backward{z-index:1;animation:none}.chat-route-pane_mode.chat-route-pane_enter.chat-route-pane_backward .chat-mode-content{animation:chat-mode-text-enter .16s var(--chat-ease-out)both}.chat-route-pane_mode.chat-route-pane_exit.chat-route-pane_backward{z-index:2;animation:none}.chat-route-pane_mode.chat-route-pane_exit.chat-route-pane_backward .chat-mode-content{transform-origin:50% 100%;animation:chat-mode-voice-exit .16s var(--chat-ease-out)both}@keyframes chat-route-forward-enter{0%{opacity:.88;transform:translate3d(var(--chat-route-offset-x),0,0)}to{opacity:1;transform:translate(0)}}@keyframes chat-route-backward-exit{0%{opacity:1;transform:translate(0)}to{opacity:.94;transform:translate3d(var(--chat-route-offset-x),0,0)}}@keyframes chat-mode-voice-enter{0%{opacity:0;transform:translateY(6px)scale(.992)}to{opacity:1;transform:translate(0)scale(1)}}@keyframes chat-mode-text-exit{0%{opacity:1;transform:translate(0)}to{opacity:0;transform:translateY(-3px)}}@keyframes chat-mode-text-enter{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translate(0)}}@keyframes chat-mode-voice-exit{0%{opacity:1;transform:translate(0)scale(1)}to{opacity:0;transform:translateY(4px)scale(.995)}}.chat-message-skeleton{justify-content:flex-end;min-height:min(420px,62vh)}.chat-message-skeleton-bubble{animation:1.2s ease-in-out infinite alternate chat-message-skeleton-pulse;animation-delay:var(--chat-skeleton-delay);will-change:opacity;position:relative;overflow:hidden}.chat-message-skeleton-bubble:after{content:"";pointer-events:none;animation:1.45s cubic-bezier(.4,0,.2,1) infinite chat-message-skeleton-shimmer;animation-delay:var(--chat-skeleton-delay);will-change:transform;background:linear-gradient(105deg,#0000 24%,#ffffff16,#0000 72%);position:absolute;inset:-1px;transform:translate(-125%)}.chat-inline-progress-dot{animation:.9s linear infinite chat-inline-progress-dot;animation-delay:var(--chat-skeleton-delay);will-change:opacity}.chat-avatar-ring{background:linear-gradient(145deg,var(--chat-accent-cherry),var(--chat-accent-cyan));border-radius:9999px;padding:1px;display:inline-flex;box-shadow:0 4px 14px #0003}.chat-scrollbar{overscroll-behavior:contain;scrollbar-color:transparent transparent;scrollbar-width:thin;touch-action:pan-y}.chat-scrollbar:hover{scrollbar-color:#ffffff38 transparent}.chat-scrollbar::-webkit-scrollbar{width:4px;height:4px}.chat-scrollbar::-webkit-scrollbar-track{background:0 0}.chat-scrollbar::-webkit-scrollbar-thumb{background:0 0;border-radius:9999px}.chat-scrollbar:hover::-webkit-scrollbar-thumb{background:#ffffff38}.no-scrollbar{scrollbar-width:none;-ms-overflow-style:none}.no-scrollbar::-webkit-scrollbar{display:none}.chat-pending-assistant-message{transform-origin:0 100%;animation:.22s cubic-bezier(.22,1,.36,1) both chat-pending-assistant-message-in}.bridge-ai-chat-widget[dir=rtl] .chat-pending-assistant-message{transform-origin:100% 100%}.chat-typing-indicator{align-items:center;gap:5px;display:flex}.chat-typing-indicator__dot{background-color:var(--chat-accent-cyan);opacity:.38;border-radius:50%;width:7px;height:7px;animation:1.2s cubic-bezier(.45,0,.55,1) infinite both chat-typing-dot;transform:translateY(0)scale(.82)}.chat-typing-indicator__dot_left{animation-delay:0s}.chat-typing-indicator__dot_center{animation-delay:.14s}.chat-typing-indicator__dot_right{animation-delay:.28s}.chat-stream-markdown--animated{animation:.12s cubic-bezier(.22,1,.36,1) both chat-stream-markdown-in}.chat-support-message-enter{transform-origin:0 100%;animation:.18s cubic-bezier(.22,1,.36,1) chat-support-message-in}.bridge-ai-chat-widget[dir=rtl] .chat-support-message-enter{transform-origin:100% 100%}@keyframes chat-support-message-in{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}@keyframes chat-stream-markdown-in{0%{opacity:.15}to{opacity:1}}@keyframes chat-message-skeleton-pulse{0%{opacity:.58}to{opacity:1}}@keyframes chat-message-skeleton-shimmer{to{transform:translate(125%)}}@keyframes chat-inline-progress-dot{0%,to{opacity:.32}50%{opacity:1}}@media(prefers-reduced-motion:reduce){[data-lola-widget-shell],.chat-widget-panel,.chat-launcher,.full-assistant-layer,.compact-assistant-layer,.compact-assistant__close,.compact-assistant__resize,.compact-assistant__secondary,.compact-assistant__secondary-icon,.avatar-rotation-control,.chat-composer__input,.chat-composer-action{transition:none}.chat-composer-action:active:not(:disabled){transform:none}.voice-composer__wave-canvas,.voice-composer__loader,.voice-composer__orb,.voice-composer__orb-aura,.voice-composer__orb-surface,.voice-composer__mic-icon,.voice-composer__close{will-change:auto;transition:none}.voice-composer[data-voice-phase=connecting] .voice-composer__loader-bar{opacity:.72;animation:none;transform:scaleY(.72)}.voice-composer__orb:active:not(:disabled){transform:translate(-50%,-50%)}.voice-composer__close:active{transform:none}.chat-composer-primary-action__icon{filter:none;will-change:auto;transition:opacity 80ms linear;transform:none}.chat-attach-button{animation-duration:80ms;animation-timing-function:linear}.chat-launcher__portrait,.chat-launcher__aura{animation:none}.chat-avatar-stage__backdrop,.chat-avatar-stage__backdrop:after,.chat-avatar-stage__cloud,.chat-avatar-stage__canvas,.chat-message-viewport{transition-duration:.14s}.chat-avatar-stage__cloud{transform:none}.chat-pending-assistant-message,.chat-typing-indicator__dot,.chat-composer-attachment,.chat-composer-attachment__progress span.is-scanning,.chat-attachment-dropzone{animation:none}.chat-route-pane{animation-duration:1ms!important}.chat-route-pane_mode .chat-mode-content{will-change:auto;animation-duration:1ms!important;transform:none!important}.chat-typing-indicator__dot{opacity:.72;transform:none}.chat-stream-markdown--animated{animation:none}.chat-support-message-enter{animation:none;transform:none}.chat-message-skeleton-bubble{opacity:.82;will-change:auto;animation:none}.chat-message-skeleton-bubble:after{will-change:auto;animation:none;display:none}.chat-inline-progress-dot{opacity:.72;will-change:auto;animation:none}}@keyframes chat-pending-assistant-message-in{0%{opacity:0;transform:translateY(4px)scale(.96)}to{opacity:1;transform:translateY(0)scale(1)}}@keyframes chat-typing-dot{0%,60%,to{opacity:.38;transform:translateY(0)scale(.82)}30%{opacity:1;transform:translateY(-3px)scale(1.05)}}.compact-scenario-preview{isolation:isolate;box-sizing:border-box;max-height:inherit;width:100%;max-width:calc(100vw - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px) - 24px);border:1px solid var(--lola-compact-preview-border,#ffffff1a);background:var(--lola-compact-preview-surface,#121214fe);color:var(--lola-compact-preview-text,var(--chat-text-primary));transform-origin:100% 100%;border-radius:26px 26px 8px;flex-direction:column;padding:18px 54px 18px 18px;display:flex;position:relative;overflow:visible;box-shadow:0 14px 38px #0000004d}.compact-scenario-preview:before{z-index:-1;border-right:1px solid var(--lola-compact-preview-border,#ffffff1a);border-bottom:1px solid var(--lola-compact-preview-border,#ffffff1a);background:var(--lola-compact-preview-surface,#121214fe);content:"";width:16px;height:16px;position:absolute;bottom:-7px;right:18px;transform:rotate(45deg)}.compact-preview-anchor[data-side=left] .compact-scenario-preview{transform-origin:0 100%;border-radius:26px 26px 26px 8px}.compact-preview-anchor[data-side=left] .compact-scenario-preview:before{left:18px;right:auto}.compact-preview-anchor[data-side=right] .compact-scenario-preview{transform-origin:100% 100%;border-radius:26px 26px 8px}.compact-preview-anchor[data-placement=below][data-side=right] .compact-scenario-preview{transform-origin:100% 0;border-radius:26px 8px 26px 26px}.compact-preview-anchor[data-placement=below][data-side=left] .compact-scenario-preview{transform-origin:0 0;border-radius:8px 26px 26px}.compact-preview-anchor[data-placement=below] .compact-scenario-preview:before{border-top:1px solid var(--lola-compact-preview-border,#ffffff1a);border-bottom:0;border-right:0;border-left:1px solid var(--lola-compact-preview-border,#ffffff1a);top:-7px;bottom:auto}.compact-scenario-preview[data-kind=CHOICE]{padding-right:18px}.compact-scenario-preview[data-phase=ENTERING]{animation:.22s cubic-bezier(.16,1,.3,1) both compact-scenario-preview-in}.compact-scenario-preview[data-phase=EXITING]{pointer-events:none;animation:.16s cubic-bezier(.4,0,.7,.2) both compact-scenario-preview-out}.compact-scenario-preview__copy{overflow-wrap:anywhere;overscroll-behavior:contain;scrollbar-width:thin;min-width:0;min-height:0;font-size:15px;font-weight:500;line-height:1.45;overflow-y:auto}.compact-scenario-preview__copy[data-action=open-chat]{cursor:pointer;border-radius:10px}.compact-scenario-preview__copy[data-action=open-chat][aria-disabled=true]{cursor:default}.compact-scenario-preview__copy :where(p,ul,ol,blockquote,pre){margin:0}.compact-scenario-preview__copy :where(p,ul,ol,blockquote,pre)+:where(p,ul,ol,blockquote,pre){margin-top:8px}.compact-scenario-preview__copy :where(ul,ol){padding-inline-start:20px}.compact-scenario-preview__copy :where(code,pre){font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace}.compact-scenario-preview__link-text{color:var(--lola-compact-preview-link,var(--chat-accent-cyan));text-underline-offset:2px;text-decoration:underline;text-decoration-thickness:1px}.compact-scenario-preview__coalesced{width:max-content;max-width:100%;color:var(--lola-compact-preview-muted,#ffffffb3);background:#ffffff14;border-radius:9999px;margin:10px 0 0;padding:4px 9px;font-size:12px;font-weight:600;line-height:16px}.compact-scenario-preview__phrase{display:inline}.compact-scenario-preview[data-phase=ENTERING] .compact-scenario-preview__phrase{opacity:0;animation:.28s cubic-bezier(.22,1,.36,1) both compact-scenario-preview-phrase-in;animation-delay:var(--compact-preview-phrase-delay,90ms)}.compact-scenario-preview__dismiss{width:44px;min-width:44px;height:44px;min-height:44px;color:var(--lola-compact-preview-dismiss,#ffffffa8);background:0 0;border:0;border-radius:9999px;place-items:center;font-size:30px;font-weight:300;line-height:1;transition:color .14s,background-color .14s,transform .12s;display:grid;position:absolute;top:4px;right:4px}.compact-scenario-preview__actions{grid-template-columns:minmax(0,1fr);gap:8px;margin-top:16px;display:grid}.compact-scenario-preview[data-kind=CHOICE] .compact-scenario-preview__actions{overscroll-behavior:contain;scrollbar-width:thin;min-height:0;margin:10px -2px -2px;padding:5px 2px;overflow-y:auto}.compact-scenario-preview[data-phase=ENTERING] .compact-scenario-preview__actions{opacity:0;animation:.17s cubic-bezier(.22,1,.36,1) both compact-scenario-preview-actions-in;animation-delay:var(--compact-preview-actions-delay,.42s);transform:translateY(5px)}.compact-scenario-preview[data-kind=CTA] .compact-scenario-preview__copy.compact-scenario-preview__sr-only~.compact-scenario-preview__actions{margin-top:0}.compact-scenario-preview__choice-group{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;display:grid}.compact-scenario-preview__action{isolation:isolate;overflow-wrap:anywhere;text-align:center;border:1px solid #0000;border-radius:9999px;justify-content:center;align-items:center;min-width:44px;min-height:44px;padding:10px 16px;font-size:14px;font-weight:650;line-height:20px;transition:color .14s,background-color .14s,border-color .14s,opacity .14s,transform .12s;display:inline-flex;position:relative}.compact-scenario-preview[data-kind=CHOICE] .compact-scenario-preview__action{border-radius:22px;min-height:30px;padding:4px 12px;font-size:12px;line-height:20px}.compact-scenario-preview[data-kind=CHOICE] .compact-scenario-preview__action:before{content:"";pointer-events:auto;background:0 0;position:absolute;inset-block:-5px;inset-inline:0}.compact-scenario-preview__action[data-presentation=PRIMARY]{border-color:var(--lola-compact-preview-primary-border,transparent);background:var(--lola-compact-preview-primary-background,var(--chat-action-primary));color:var(--lola-compact-preview-primary-foreground,#081207)}.compact-scenario-preview__action[data-presentation=TERTIARY]{border-color:var(--lola-compact-preview-tertiary-border,#fff6);background:var(--lola-compact-preview-tertiary-background,#ffffff1f);color:var(--lola-compact-preview-tertiary-foreground,#ffffffb8)}.compact-scenario-preview__action[data-presentation=PRIMARY]:after{z-index:-1;border-radius:inherit;background:var(--lola-compact-preview-primary-attention,#8fff377a);content:"";opacity:0;pointer-events:none;position:absolute;inset:-4px;transform:scale(.92)}.compact-scenario-preview__action[data-presentation=PRIMARY][data-attention=NUDGE_ONCE]:after{animation:3s ease-out 3s infinite both compact-scenario-preview-nudge-glow}.compact-scenario-preview__action[data-presentation=PRIMARY][data-attention=NUDGE_ONCE]{animation:3s ease-out 3s infinite both compact-scenario-preview-nudge}.compact-scenario-preview__action[data-presentation=PRIMARY][data-attention=NUDGE_ONCE]:active:not(:disabled){animation:none;transform:scale(.97)}.compact-scenario-preview__action[data-presentation=PRIMARY][data-attention=NUDGE_ONCE]:active:not(:disabled):after{opacity:0;animation:none}.compact-scenario-preview__feedback{color:var(--lola-compact-preview-error,#fecaca);margin:10px 0 0;font-size:12px;line-height:1.4}.compact-scenario-preview__copy[data-action=open-chat]:focus-visible,.compact-scenario-preview__dismiss:focus-visible,.compact-scenario-preview__action:focus-visible{outline:2px solid var(--lola-compact-preview-focus,var(--chat-accent-cyan));outline-offset:2px}.compact-scenario-preview__dismiss:active:not(:disabled),.compact-scenario-preview__action:active:not(:disabled){transform:scale(.97)}.compact-scenario-preview__dismiss:disabled,.compact-scenario-preview__action:disabled{opacity:.48}.compact-scenario-preview__sr-only{clip:rect(0,0,0,0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}@media(hover:hover){.compact-scenario-preview__dismiss:hover:not(:disabled){background:var(--lola-compact-preview-dismiss-hover-background,#ffffff14);color:var(--lola-compact-preview-dismiss-hover,white)}.compact-scenario-preview__action[data-presentation=PRIMARY]:hover:not(:disabled){background:var(--lola-compact-preview-primary-hover-background,#a5ff62)}.compact-scenario-preview__action[data-presentation=TERTIARY]:hover:not(:disabled){border-color:var(--lola-compact-preview-tertiary-hover-border,#68d8ff4d);background:var(--lola-compact-preview-tertiary-hover-background,#68d8ff17)}}@keyframes compact-scenario-preview-in{0%{opacity:0;transform:translateY(9px)scale(.975)}to{opacity:1;transform:translate(0)scale(1)}}@keyframes compact-scenario-preview-out{0%{opacity:1;transform:translate(0)scale(1)}to{opacity:0;transform:translateY(5px)scale(.985)}}@keyframes compact-scenario-preview-phrase-in{0%{opacity:0}to{opacity:1}}@keyframes compact-scenario-preview-actions-in{0%{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translate(0)}}@keyframes compact-scenario-preview-nudge-glow{0%,12%,to{opacity:0;transform:scale(.97)}6%{opacity:.24;transform:scale(1.04)}}@keyframes compact-scenario-preview-nudge{0%,12%,to{transform:translate(0)scale(1)}3%{transform:translate(-1px)scale(1.006)}6%{transform:translate(1px)scale(1.012)}9%{transform:translate(-.5px)scale(1.006)}}@media(prefers-reduced-motion:reduce){.compact-scenario-preview,.compact-scenario-preview__phrase,.compact-scenario-preview__actions,.compact-scenario-preview__action,.compact-scenario-preview__action:after,.chat-attention-nudge-once,.chat-attention-nudge-once:after{transition:none!important;animation:none!important}.compact-scenario-preview,.compact-scenario-preview__phrase,.compact-scenario-preview__actions,.compact-scenario-preview__action,.compact-scenario-preview__action:after{transform:none}.compact-scenario-preview,.compact-scenario-preview__phrase,.compact-scenario-preview__actions{opacity:1}.compact-scenario-preview__action:after{opacity:0}}@media(forced-colors:active){.compact-scenario-preview,.compact-scenario-preview__action,.compact-scenario-preview__dismiss{color:canvastext;background:canvas;border:1px solid canvastext}.compact-scenario-preview__action:after{display:none}}}@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.-end-0\\.5{inset-inline-end:calc(var(--spacing)*-.5)}.-top-0\\.5{top:calc(var(--spacing)*-.5)}.top-0{top:calc(var(--spacing)*0)}.top-1\\/2{top:50%}.top-2{top:calc(var(--spacing)*2)}.top-5{top:calc(var(--spacing)*5)}.top-16{top:calc(var(--spacing)*16)}.right-0{right:calc(var(--spacing)*0)}.right-5{right:calc(var(--spacing)*5)}.bottom-0{bottom:calc(var(--spacing)*0)}.bottom-5{bottom:calc(var(--spacing)*5)}.left-0{left:calc(var(--spacing)*0)}.left-1\\/2{left:50%}.left-5{left:calc(var(--spacing)*5)}.z-0{z-index:0}.z-1{z-index:1}.z-5{z-index:5}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-51{z-index:51}.z-\\[70\\]{z-index:70}.z-\\[9999999\\]{z-index:9999999}.\\!container{width:100%!important}@media(min-width:40rem){.\\!container{max-width:40rem!important}}@media(min-width:48rem){.\\!container{max-width:48rem!important}}@media(min-width:64rem){.\\!container{max-width:64rem!important}}@media(min-width:80rem){.\\!container{max-width:80rem!important}}@media(min-width:96rem){.\\!container{max-width:96rem!important}}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.mx-auto{margin-inline:auto}.my-2{margin-block:calc(var(--spacing)*2)}.ms-2{margin-inline-start:calc(var(--spacing)*2)}.me-2{margin-inline-end:calc(var(--spacing)*2)}.mt-0\\.5{margin-top:calc(var(--spacing)*.5)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-auto{margin-top:auto}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.box-content{box-sizing:content-box}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.h-0{height:calc(var(--spacing)*0)}.h-1{height:calc(var(--spacing)*1)}.h-1\\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-3{height:calc(var(--spacing)*3)}.h-3\\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-4\\.5{height:calc(var(--spacing)*4.5)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-14{height:calc(var(--spacing)*14)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-24{height:calc(var(--spacing)*24)}.h-\\[18px\\]{height:18px}.h-\\[19px\\]{height:19px}.h-\\[38px\\]{height:38px}.h-\\[50\\%\\]{height:50%}.h-\\[52\\%\\]{height:52%}.h-\\[66vh\\]{height:66vh}.h-\\[88px\\]{height:88px}.h-\\[650px\\]{height:650px}.h-\\[calc\\(100\\%-64px\\)\\]{height:calc(100% - 64px)}.h-fit{height:fit-content}.h-full{height:100%}.h-px{height:1px}.max-h-\\[66vh\\]{max-height:66vh}.max-h-\\[min\\(82vh\\,760px\\)\\]{max-height:min(82vh,760px)}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-8{min-height:calc(var(--spacing)*8)}.min-h-9{min-height:calc(var(--spacing)*9)}.min-h-14{min-height:calc(var(--spacing)*14)}.min-h-16{min-height:calc(var(--spacing)*16)}.min-h-64{min-height:calc(var(--spacing)*64)}.min-h-96{min-height:calc(var(--spacing)*96)}.min-h-\\[38px\\]{min-height:38px}.min-h-full{min-height:100%}.w-1{width:calc(var(--spacing)*1)}.w-1\\.5{width:calc(var(--spacing)*1.5)}.w-2{width:calc(var(--spacing)*2)}.w-3{width:calc(var(--spacing)*3)}.w-3\\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-4\\.5{width:calc(var(--spacing)*4.5)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-12{width:calc(var(--spacing)*12)}.w-14{width:calc(var(--spacing)*14)}.w-\\[18px\\]{width:18px}.w-\\[21px\\]{width:21px}.w-\\[42\\%\\]{width:42%}.w-\\[48\\%\\]{width:48%}.w-\\[50\\%\\]{width:50%}.w-\\[52\\%\\]{width:52%}.w-\\[56\\%\\]{width:56%}.w-\\[58\\%\\]{width:58%}.w-\\[62\\%\\]{width:62%}.w-\\[64\\%\\]{width:64%}.w-\\[66\\%\\]{width:66%}.w-\\[68\\%\\]{width:68%}.w-\\[70\\%\\]{width:70%}.w-\\[72\\%\\]{width:72%}.w-\\[74\\%\\]{width:74%}.w-\\[76\\%\\]{width:76%}.w-\\[78\\%\\]{width:78%}.w-\\[86\\%\\]{width:86%}.w-\\[390px\\]{width:390px}.w-\\[min\\(92vw\\,920px\\)\\]{width:min(92vw,920px)}.w-\\[min\\(232px\\,calc\\(100\\%-2rem\\)\\)\\]{width:min(232px,100% - 2rem)}.w-\\[min\\(232px\\,calc\\(100\\%-208px\\)\\)\\]{width:min(232px,100% - 208px)}.w-fit{width:fit-content}.w-full{width:100%}.max-w-70{max-width:calc(var(--spacing)*70)}.max-w-72{max-width:calc(var(--spacing)*72)}.max-w-\\[86\\%\\]{max-width:86%}.max-w-\\[232px\\]{max-width:232px}.max-w-\\[calc\\(100vw-32px\\)\\]{max-width:calc(100vw - 32px)}.max-w-full{max-width:100%}.max-w-none{max-width:none}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:calc(var(--spacing)*0)}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.-translate-x-1\\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1{--tw-translate-y:calc(var(--spacing)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-0{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-1{--tw-translate-y:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-1\\.5{--tw-translate-y:calc(var(--spacing)*1.5);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-2{--tw-translate-y:calc(var(--spacing)*2);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-3{--tw-translate-y:calc(var(--spacing)*3);translate:var(--tw-translate-x)var(--tw-translate-y)}.scale-100{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x)var(--tw-scale-y)}.-scale-x-100{--tw-scale-x: -100% ;scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-\\[0\\.98\\]{scale:.98}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-grab{cursor:grab}.cursor-n-resize{cursor:n-resize}.cursor-nesw-resize{cursor:nesw-resize}.cursor-nwse-resize{cursor:nwse-resize}.cursor-w-resize{cursor:w-resize}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.appearance-none{appearance:none}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.place-items-center{place-items:center}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-2\\.5{gap:calc(var(--spacing)*2.5)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-5{gap:calc(var(--spacing)*5)}.gap-\\[3px\\]{gap:3px}.gap-\\[10px\\]{gap:10px}.self-center{align-self:center}.self-end{align-self:flex-end}.self-start{align-self:flex-start}.justify-self-end{justify-self:flex-end}.justify-self-start{justify-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:calc(var(--radius) + 8px)}.rounded-3xl{border-radius:calc(var(--radius) + 12px)}.rounded-\\[13px\\]{border-radius:13px}.rounded-\\[17px\\]{border-radius:17px}.rounded-\\[20px\\]{border-radius:20px}.rounded-\\[24px\\]{border-radius:24px}.rounded-\\[28px\\]{border-radius:28px}.rounded-\\[32px\\]{border-radius:32px}.rounded-\\[inherit\\]{border-radius:inherit}.rounded-full{border-radius:3.40282e38px}.rounded-none{border-radius:0}.rounded-xl{border-radius:calc(var(--radius) + 4px)}.rounded-ee-\\[5px\\]{border-end-end-radius:5px}.rounded-es-\\[5px\\]{border-end-start-radius:5px}.rounded-br-\\[5px\\]{border-bottom-right-radius:5px}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-none{--tw-border-style:none;border-style:none}.border-\\[\\#68d8ff\\]\\/10{border-color:#68d8ff1a}.border-\\[\\#68d8ff\\]\\/24{border-color:#68d8ff3d}.border-\\[\\#68d8ff\\]\\/35{border-color:#68d8ff59}.border-\\[\\#161616\\]{border-color:#161616}.border-\\[var\\(--chat-action-primary\\)\\],.border-\\[var\\(--chat-action-primary\\)\\]\\/12{border-color:var(--chat-action-primary)}@supports (color:color-mix(in lab,red,red)){.border-\\[var\\(--chat-action-primary\\)\\]\\/12{border-color:color-mix(in oklab,var(--chat-action-primary)12%,transparent)}}.border-red-200\\/10{border-color:#ffcaca1a}@supports (color:color-mix(in lab,red,red)){.border-red-200\\/10{border-color:color-mix(in oklab,var(--color-red-200)10%,transparent)}}.border-white\\/8{border-color:#ffffff14}@supports (color:color-mix(in lab,red,red)){.border-white\\/8{border-color:color-mix(in oklab,var(--color-white)8%,transparent)}}.border-white\\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.border-white\\/12{border-color:#ffffff1f}@supports (color:color-mix(in lab,red,red)){.border-white\\/12{border-color:color-mix(in oklab,var(--color-white)12%,transparent)}}.border-white\\/14{border-color:#ffffff24}@supports (color:color-mix(in lab,red,red)){.border-white\\/14{border-color:color-mix(in oklab,var(--color-white)14%,transparent)}}.border-white\\/\\[0\\.05\\]{border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.border-white\\/\\[0\\.05\\]{border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.border-white\\/\\[0\\.06\\]{border-color:#ffffff0f}@supports (color:color-mix(in lab,red,red)){.border-white\\/\\[0\\.06\\]{border-color:color-mix(in oklab,var(--color-white)6%,transparent)}}.border-white\\/\\[0\\.08\\]{border-color:#ffffff14}@supports (color:color-mix(in lab,red,red)){.border-white\\/\\[0\\.08\\]{border-color:color-mix(in oklab,var(--color-white)8%,transparent)}}.border-white\\/\\[0\\.045\\]{border-color:#ffffff0b}@supports (color:color-mix(in lab,red,red)){.border-white\\/\\[0\\.045\\]{border-color:color-mix(in oklab,var(--color-white)4.5%,transparent)}}.bg-\\[\\#0c1119\\]\\/96{background-color:#0c1119f5}.bg-\\[\\#5b405f\\]{background-color:#5b405f}.bg-\\[\\#5b405f\\]\\/70{background-color:#5b405fb3}.bg-\\[\\#8fff37\\]{background-color:#8fff37}.bg-\\[\\#68d8ff\\]{background-color:#68d8ff}.bg-\\[\\#68d8ff\\]\\/10,.bg-\\[\\#68d8ff\\]\\/\\[0\\.1\\]{background-color:#68d8ff1a}.bg-\\[\\#68d8ff\\]\\/\\[0\\.13\\]{background-color:#68d8ff21}.bg-\\[\\#090b10\\]\\/58{background-color:#090b1094}.bg-\\[\\#171b15\\]{background-color:#171b15}.bg-\\[\\#05080d\\]\\/82{background-color:#05080dd1}.bg-\\[\\#111111\\]{background-color:#111}.bg-\\[\\#111319\\]{background-color:#111319}.bg-\\[\\#111923\\]{background-color:#111923}.bg-\\[\\#161616\\]\\/92{background-color:#161616eb}.bg-\\[\\#ef6b7f\\]{background-color:#ef6b7f}.bg-\\[radial-gradient\\(circle_at_50\\%_20\\%\\,rgba\\(104\\,216\\,255\\,\\.08\\)\\,transparent_46\\%\\)\\,\\#080c12\\]{background-color:radial-gradient(circle at 50% 20%,#68d8ff14,transparent 46%),#080c12}.bg-\\[var\\(--chat-action-primary\\)\\],.bg-\\[var\\(--chat-action-primary\\)\\]\\/10{background-color:var(--chat-action-primary)}@supports (color:color-mix(in lab,red,red)){.bg-\\[var\\(--chat-action-primary\\)\\]\\/10{background-color:color-mix(in oklab,var(--chat-action-primary)10%,transparent)}}.bg-\\[var\\(--chat-surface-agent\\)\\]{background-color:var(--chat-surface-agent)}.bg-black{background-color:var(--color-black)}.bg-black\\/8{background-color:#00000014}@supports (color:color-mix(in lab,red,red)){.bg-black\\/8{background-color:color-mix(in oklab,var(--color-black)8%,transparent)}}.bg-black\\/20{background-color:#0003}@supports (color:color-mix(in lab,red,red)){.bg-black\\/20{background-color:color-mix(in oklab,var(--color-black)20%,transparent)}}.bg-black\\/32{background-color:#00000052}@supports (color:color-mix(in lab,red,red)){.bg-black\\/32{background-color:color-mix(in oklab,var(--color-black)32%,transparent)}}.bg-black\\/35{background-color:#00000059}@supports (color:color-mix(in lab,red,red)){.bg-black\\/35{background-color:color-mix(in oklab,var(--color-black)35%,transparent)}}.bg-black\\/45{background-color:#00000073}@supports (color:color-mix(in lab,red,red)){.bg-black\\/45{background-color:color-mix(in oklab,var(--color-black)45%,transparent)}}.bg-current{background-color:currentColor}.bg-red-300\\/8{background-color:#ffa3a314}@supports (color:color-mix(in lab,red,red)){.bg-red-300\\/8{background-color:color-mix(in oklab,var(--color-red-300)8%,transparent)}}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\\/5{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.bg-white\\/\\[0\\.04\\]{background-color:#ffffff0a}@supports (color:color-mix(in lab,red,red)){.bg-white\\/\\[0\\.04\\]{background-color:color-mix(in oklab,var(--color-white)4%,transparent)}}.bg-white\\/\\[0\\.06\\]{background-color:#ffffff0f}@supports (color:color-mix(in lab,red,red)){.bg-white\\/\\[0\\.06\\]{background-color:color-mix(in oklab,var(--color-white)6%,transparent)}}.bg-white\\/\\[0\\.07\\]{background-color:#ffffff12}@supports (color:color-mix(in lab,red,red)){.bg-white\\/\\[0\\.07\\]{background-color:color-mix(in oklab,var(--color-white)7%,transparent)}}.bg-white\\/\\[0\\.09\\]{background-color:#ffffff17}@supports (color:color-mix(in lab,red,red)){.bg-white\\/\\[0\\.09\\]{background-color:color-mix(in oklab,var(--color-white)9%,transparent)}}.bg-white\\/\\[0\\.11\\]{background-color:#ffffff1c}@supports (color:color-mix(in lab,red,red)){.bg-white\\/\\[0\\.11\\]{background-color:color-mix(in oklab,var(--color-white)11%,transparent)}}.bg-white\\/\\[0\\.025\\]{background-color:#ffffff06}@supports (color:color-mix(in lab,red,red)){.bg-white\\/\\[0\\.025\\]{background-color:color-mix(in oklab,var(--color-white)2.5%,transparent)}}.bg-white\\/\\[0\\.035\\]{background-color:#ffffff09}@supports (color:color-mix(in lab,red,red)){.bg-white\\/\\[0\\.035\\]{background-color:color-mix(in oklab,var(--color-white)3.5%,transparent)}}.bg-\\[linear-gradient\\(145deg\\,\\#684d6d_0\\%\\,\\#3f3348_100\\%\\)\\]{background-image:linear-gradient(145deg,#684d6d,#3f3348)}.bg-\\[linear-gradient\\(180deg\\,rgba\\(25\\,22\\,28\\,0\\.97\\)\\,rgba\\(14\\,13\\,16\\,0\\.98\\)\\)\\]{background-image:linear-gradient(#19161cf7,#0e0d10fa)}.bg-\\[linear-gradient\\(to_bottom\\,rgba\\(0\\,0\\,0\\,0\\.7\\)_0\\%\\,rgba\\(0\\,0\\,0\\,0\\.7\\)_20\\%\\,rgba\\(0\\,0\\,0\\,0\\.2\\)_60\\%\\,rgba\\(0\\,0\\,0\\,0\\)_100\\%\\)\\]{background-image:linear-gradient(#000000b3 0% 20%,#0003 60%,#0000)}.bg-\\[linear-gradient\\(to_top\\,rgba\\(8\\,10\\,15\\,0\\.78\\)_0\\%\\,rgba\\(8\\,10\\,15\\,0\\.42\\)_42\\%\\,rgba\\(8\\,10\\,15\\,0\\)_100\\%\\)\\]{background-image:linear-gradient(#080a0f00,#080a0f6b 58%,#080a0fc7)}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.object-\\[50\\%_20\\%\\]{object-position:50% 20%}.p-0{padding:calc(var(--spacing)*0)}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-2\\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-\\[11px\\]{padding-inline:11px}.py-0{padding-block:calc(var(--spacing)*0)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-6{padding-block:calc(var(--spacing)*6)}.py-\\[7px\\]{padding-block:7px}.py-\\[9px\\]{padding-block:9px}.ps-0{padding-inline-start:calc(var(--spacing)*0)}.ps-0\\.5{padding-inline-start:calc(var(--spacing)*.5)}.ps-1{padding-inline-start:calc(var(--spacing)*1)}.pe-0{padding-inline-end:calc(var(--spacing)*0)}.pe-3{padding-inline-end:calc(var(--spacing)*3)}.pt-0\\.5{padding-top:calc(var(--spacing)*.5)}.pt-1{padding-top:calc(var(--spacing)*1)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-5{padding-top:calc(var(--spacing)*5)}.pt-6{padding-top:calc(var(--spacing)*6)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-3{padding-bottom:calc(var(--spacing)*3)}.pb-5{padding-bottom:calc(var(--spacing)*5)}.pb-\\[max\\(16px\\,var\\(--lola-safe-area-inset-bottom\\)\\)\\]{padding-bottom:max(16px,var(--lola-safe-area-inset-bottom))}.text-center{text-align:center}.text-start{text-align:start}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\\[10\\.5px\\]{font-size:10.5px}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.text-\\[12px\\]{font-size:12px}.text-\\[13px\\]{font-size:13px}.text-\\[14px\\]{font-size:14px}.text-\\[15px\\]{font-size:15px}.text-\\[16px\\]{font-size:16px}.text-\\[20px\\]{font-size:20px}.leading-3\\.5{--tw-leading:calc(var(--spacing)*3.5);line-height:calc(var(--spacing)*3.5)}.leading-4{--tw-leading:calc(var(--spacing)*4);line-height:calc(var(--spacing)*4)}.leading-5{--tw-leading:calc(var(--spacing)*5);line-height:calc(var(--spacing)*5)}.leading-6{--tw-leading:calc(var(--spacing)*6);line-height:calc(var(--spacing)*6)}.leading-\\[13px\\]{--tw-leading:13px;line-height:13px}.leading-\\[18px\\]{--tw-leading:18px;line-height:18px}.leading-\\[19px\\]{--tw-leading:19px;line-height:19px}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\\[-0\\.01em\\]{--tw-tracking:-.01em;letter-spacing:-.01em}.tracking-\\[-0\\.02em\\]{--tw-tracking:-.02em;letter-spacing:-.02em}.tracking-\\[-0\\.005em\\]{--tw-tracking:-.005em;letter-spacing:-.005em}.tracking-\\[-0\\.012em\\]{--tw-tracking:-.012em;letter-spacing:-.012em}.tracking-\\[0\\.01em\\]{--tw-tracking:.01em;letter-spacing:.01em}.tracking-\\[0\\.08em\\]{--tw-tracking:.08em;letter-spacing:.08em}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\\[\\#8b889b\\]{color:#8b889b}.text-\\[\\#8df0c8\\]{color:#8df0c8}.text-\\[\\#68d8ff\\]{color:#68d8ff}.text-\\[\\#a5fc4c\\]{color:#a5fc4c}.text-\\[\\#a6ebce\\]{color:#a6ebce}.text-\\[\\#a9eaff\\]{color:#a9eaff}.text-\\[\\#bcecff\\]{color:#bcecff}.text-\\[\\#f3f0f4\\]{color:#f3f0f4}.text-\\[var\\(--chat-action-primary\\)\\]{color:var(--chat-action-primary)}.text-amber-100\\/74{color:#fef3c6bd}@supports (color:color-mix(in lab,red,red)){.text-amber-100\\/74{color:color-mix(in oklab,var(--color-amber-100)74%,transparent)}}.text-amber-100\\/86{color:#fef3c6db}@supports (color:color-mix(in lab,red,red)){.text-amber-100\\/86{color:color-mix(in oklab,var(--color-amber-100)86%,transparent)}}.text-amber-200{color:var(--color-amber-200)}.text-current{color:currentColor}.text-red-100\\/80{color:#ffe2e2cc}@supports (color:color-mix(in lab,red,red)){.text-red-100\\/80{color:color-mix(in oklab,var(--color-red-100)80%,transparent)}}.text-red-100\\/88{color:#ffe2e2e0}@supports (color:color-mix(in lab,red,red)){.text-red-100\\/88{color:color-mix(in oklab,var(--color-red-100)88%,transparent)}}.text-red-200{color:var(--color-red-200)}.text-rose-200\\/82{color:#ffccd3d1}@supports (color:color-mix(in lab,red,red)){.text-rose-200\\/82{color:color-mix(in oklab,var(--color-rose-200)82%,transparent)}}.text-violet-200{color:var(--color-violet-200)}.text-white{color:var(--color-white)}.text-white\\/35{color:#ffffff59}@supports (color:color-mix(in lab,red,red)){.text-white\\/35{color:color-mix(in oklab,var(--color-white)35%,transparent)}}.text-white\\/38{color:#ffffff61}@supports (color:color-mix(in lab,red,red)){.text-white\\/38{color:color-mix(in oklab,var(--color-white)38%,transparent)}}.text-white\\/40{color:#fff6}@supports (color:color-mix(in lab,red,red)){.text-white\\/40{color:color-mix(in oklab,var(--color-white)40%,transparent)}}.text-white\\/42{color:#ffffff6b}@supports (color:color-mix(in lab,red,red)){.text-white\\/42{color:color-mix(in oklab,var(--color-white)42%,transparent)}}.text-white\\/44{color:#ffffff70}@supports (color:color-mix(in lab,red,red)){.text-white\\/44{color:color-mix(in oklab,var(--color-white)44%,transparent)}}.text-white\\/48{color:#ffffff7a}@supports (color:color-mix(in lab,red,red)){.text-white\\/48{color:color-mix(in oklab,var(--color-white)48%,transparent)}}.text-white\\/50{color:#ffffff80}@supports (color:color-mix(in lab,red,red)){.text-white\\/50{color:color-mix(in oklab,var(--color-white)50%,transparent)}}.text-white\\/52{color:#ffffff85}@supports (color:color-mix(in lab,red,red)){.text-white\\/52{color:color-mix(in oklab,var(--color-white)52%,transparent)}}.text-white\\/55{color:#ffffff8c}@supports (color:color-mix(in lab,red,red)){.text-white\\/55{color:color-mix(in oklab,var(--color-white)55%,transparent)}}.text-white\\/56{color:#ffffff8f}@supports (color:color-mix(in lab,red,red)){.text-white\\/56{color:color-mix(in oklab,var(--color-white)56%,transparent)}}.text-white\\/58{color:#ffffff94}@supports (color:color-mix(in lab,red,red)){.text-white\\/58{color:color-mix(in oklab,var(--color-white)58%,transparent)}}.text-white\\/60{color:#fff9}@supports (color:color-mix(in lab,red,red)){.text-white\\/60{color:color-mix(in oklab,var(--color-white)60%,transparent)}}.text-white\\/62{color:#ffffff9e}@supports (color:color-mix(in lab,red,red)){.text-white\\/62{color:color-mix(in oklab,var(--color-white)62%,transparent)}}.text-white\\/64{color:#ffffffa3}@supports (color:color-mix(in lab,red,red)){.text-white\\/64{color:color-mix(in oklab,var(--color-white)64%,transparent)}}.text-white\\/65{color:#ffffffa6}@supports (color:color-mix(in lab,red,red)){.text-white\\/65{color:color-mix(in oklab,var(--color-white)65%,transparent)}}.text-white\\/68{color:#ffffffad}@supports (color:color-mix(in lab,red,red)){.text-white\\/68{color:color-mix(in oklab,var(--color-white)68%,transparent)}}.text-white\\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.text-white\\/70{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.text-white\\/72{color:#ffffffb8}@supports (color:color-mix(in lab,red,red)){.text-white\\/72{color:color-mix(in oklab,var(--color-white)72%,transparent)}}.text-white\\/75{color:#ffffffbf}@supports (color:color-mix(in lab,red,red)){.text-white\\/75{color:color-mix(in oklab,var(--color-white)75%,transparent)}}.text-white\\/78{color:#ffffffc7}@supports (color:color-mix(in lab,red,red)){.text-white\\/78{color:color-mix(in oklab,var(--color-white)78%,transparent)}}.text-white\\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\\/80{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.text-white\\/82{color:#ffffffd1}@supports (color:color-mix(in lab,red,red)){.text-white\\/82{color:color-mix(in oklab,var(--color-white)82%,transparent)}}.text-white\\/86{color:#ffffffdb}@supports (color:color-mix(in lab,red,red)){.text-white\\/86{color:color-mix(in oklab,var(--color-white)86%,transparent)}}.text-white\\/88{color:#ffffffe0}@supports (color:color-mix(in lab,red,red)){.text-white\\/88{color:color-mix(in oklab,var(--color-white)88%,transparent)}}.text-white\\/90{color:#ffffffe6}@supports (color:color-mix(in lab,red,red)){.text-white\\/90{color:color-mix(in oklab,var(--color-white)90%,transparent)}}.text-white\\/92{color:#ffffffeb}@supports (color:color-mix(in lab,red,red)){.text-white\\/92{color:color-mix(in oklab,var(--color-white)92%,transparent)}}.text-white\\/94{color:#fffffff0}@supports (color:color-mix(in lab,red,red)){.text-white\\/94{color:color-mix(in oklab,var(--color-white)94%,transparent)}}.text-white\\/95{color:#fffffff2}@supports (color:color-mix(in lab,red,red)){.text-white\\/95{color:color-mix(in oklab,var(--color-white)95%,transparent)}}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.italic{font-style:italic}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.opacity-0{opacity:0}.opacity-80{opacity:.8}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[0_0_10px_rgba\\(143\\,255\\,55\\,0\\.32\\)\\]{--tw-shadow:0 0 10px var(--tw-shadow-color,#8fff3752);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[0_6px_18px_rgba\\(0\\,0\\,0\\,0\\.16\\)\\]{--tw-shadow:0 6px 18px var(--tw-shadow-color,#00000029);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[0_8px_24px_rgb\\(0_0_0\\/0\\.26\\)\\]{--tw-shadow:0 8px 24px var(--tw-shadow-color,#00000042);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[0_28px_80px_rgba\\(0\\,0\\,0\\,0\\.48\\)\\]{--tw-shadow:0 28px 80px var(--tw-shadow-color,#0000007a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[0_30px_90px_rgba\\(0\\,0\\,0\\,\\.58\\)\\,0_0_0_1px_rgba\\(104\\,216\\,255\\,\\.05\\)\\]{--tw-shadow:0 30px 90px var(--tw-shadow-color,#00000094),0 0 0 1px var(--tw-shadow-color,#68d8ff0d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[inset_0_0_0_1px_rgba\\(0\\,0\\,0\\,0\\.1\\)\\]{--tw-shadow:inset 0 0 0 1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[inset_0_0_0_1px_rgba\\(165\\,252\\,76\\,0\\.24\\)\\,0_0_18px_rgba\\(165\\,252\\,76\\,0\\.1\\)\\]{--tw-shadow:inset 0 0 0 1px var(--tw-shadow-color,#a5fc4c3d),0 0 18px var(--tw-shadow-color,#a5fc4c1a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[inset_0_0_0_1px_rgba\\(239\\,107\\,127\\,0\\.22\\)\\,0_5px_18px_rgba\\(0\\,0\\,0\\,0\\.14\\)\\]{--tw-shadow:inset 0 0 0 1px var(--tw-shadow-color,#ef6b7f38),0 5px 18px var(--tw-shadow-color,#00000024);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[inset_0_0_0_1px_rgba\\(255\\,255\\,255\\,0\\.09\\)\\,0_5px_18px_rgba\\(0\\,0\\,0\\,0\\.14\\)\\]{--tw-shadow:inset 0 0 0 1px var(--tw-shadow-color,#ffffff17),0 5px 18px var(--tw-shadow-color,#00000024);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[inset_0_0_0_1px_rgba\\(255\\,255\\,255\\,0\\.11\\)\\]{--tw-shadow:inset 0 0 0 1px var(--tw-shadow-color,#ffffff1c);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.outline-2{outline-style:var(--tw-outline-style);outline-width:2px}.outline-\\[\\#111319\\]{outline-color:#111319}.outline-black\\/9{outline-color:#00000017}@supports (color:color-mix(in lab,red,red)){.outline-black\\/9{outline-color:color-mix(in oklab,var(--color-black)9%,transparent)}}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.grayscale{--tw-grayscale:grayscale(100%);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-xs{--tw-backdrop-blur:blur(var(--blur-xs));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.\\!transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events!important;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))!important;transition-duration:var(--tw-duration,var(--default-transition-duration))!important}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[background-color\\,border-color\\,transform\\]{transition-property:background-color,border-color,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[background-color\\,transform\\]{transition-property:background-color,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[height\\]{transition-property:height;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[opacity\\,transform\\]{transition-property:opacity,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.delay-75{transition-delay:75ms}.duration-100{--tw-duration:.1s;transition-duration:.1s}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-\\[120ms\\]{--tw-duration:.12s;transition-duration:.12s}.duration-\\[140ms\\]{--tw-duration:.14s;transition-duration:.14s}.duration-\\[160ms\\]{--tw-duration:.16s;transition-duration:.16s}.duration-\\[180ms\\]{--tw-duration:.18s;transition-duration:.18s}.duration-\\[220ms\\]{--tw-duration:.22s;transition-duration:.22s}.ease-\\[var\\(--chat-ease-out\\)\\]{--tw-ease:var(--chat-ease-out);transition-timing-function:var(--chat-ease-out)}.ease-in{--tw-ease:var(--ease-in);transition-timing-function:var(--ease-in)}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.delay-75{--tw-animation-delay:75ms;animation-delay:75ms}.outline-none{--tw-outline-style:none;outline-style:none}.outline-solid{--tw-outline-style:solid;outline-style:solid}.select-none{-webkit-user-select:none;user-select:none}.\\!paused{animation-play-state:paused!important}.\\[overflow-anchor\\:none\\]{overflow-anchor:none}.paused{animation-play-state:paused}.running{animation-play-state:running}@media(hover:hover){.group-hover\\:block:is(:where(.group):hover *){display:block}.group-hover\\:hidden:is(:where(.group):hover *){display:none}.group-hover\\:opacity-70:is(:where(.group):hover *){opacity:.7}}.group-aria-\\[current\\=page\\]\\:opacity-100:is(:where(.group)[aria-current=page] *){opacity:1}.placeholder\\:text-\\[14px\\]::placeholder{font-size:14px}.placeholder\\:text-\\[\\#858585\\]::placeholder{color:#858585}.placeholder\\:text-white\\/38::placeholder{color:#ffffff61}@supports (color:color-mix(in lab,red,red)){.placeholder\\:text-white\\/38::placeholder{color:color-mix(in oklab,var(--color-white)38%,transparent)}}@media(hover:hover){.hover\\:border-\\[\\#68d8ff\\]\\/30:hover{border-color:#68d8ff4d}.hover\\:border-\\[var\\(--chat-action-primary\\)\\]\\/30:hover{border-color:var(--chat-action-primary)}@supports (color:color-mix(in lab,red,red)){.hover\\:border-\\[var\\(--chat-action-primary\\)\\]\\/30:hover{border-color:color-mix(in oklab,var(--chat-action-primary)30%,transparent)}}.hover\\:bg-white\\/6:hover{background-color:#ffffff0f}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-white\\/6:hover{background-color:color-mix(in oklab,var(--color-white)6%,transparent)}}.hover\\:bg-white\\/10:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-white\\/10:hover{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.hover\\:text-\\[\\#68d8ff\\]:hover{color:#68d8ff}.hover\\:text-white\\/90:hover{color:#ffffffe6}@supports (color:color-mix(in lab,red,red)){.hover\\:text-white\\/90:hover{color:color-mix(in oklab,var(--color-white)90%,transparent)}}}.focus-visible\\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\\:outline-offset-\\[-2px\\]:focus-visible{outline-offset:-2px}.focus-visible\\:outline-\\[\\#68d8ff\\]:focus-visible{outline-color:#68d8ff}.focus-visible\\:outline-\\[var\\(--chat-action-primary\\)\\]:focus-visible{outline-color:var(--chat-action-primary)}.active\\:scale-\\[0\\.97\\]:active{scale:.97}.active\\:scale-\\[0\\.992\\]:active{scale:.992}.active\\:cursor-grabbing:active{cursor:grabbing}.active\\:bg-white\\/8:active{background-color:#ffffff14}@supports (color:color-mix(in lab,red,red)){.active\\:bg-white\\/8:active{background-color:color-mix(in oklab,var(--color-white)8%,transparent)}}.active\\:bg-white\\/\\[0\\.055\\]:active{background-color:#ffffff0e}@supports (color:color-mix(in lab,red,red)){.active\\:bg-white\\/\\[0\\.055\\]:active{background-color:color-mix(in oklab,var(--color-white)5.5%,transparent)}}.disabled\\:opacity-40:disabled{opacity:.4}.data-disabled\\:opacity-50[data-disabled]{opacity:.5}.data-focus\\:ring-2[data-focus]{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-focus\\:ring-\\[\\#68d8ff\\]\\/65[data-focus]{--tw-ring-color:oklab(83.1484% -.0833826 -.0797253/.65)}.data-hover\\:border-\\[\\#68d8ff\\]\\/42[data-hover]{border-color:#68d8ff6b}.data-hover\\:bg-\\[\\#68d8ff\\]\\/10[data-hover]{background-color:#68d8ff1a}.data-hover\\:bg-\\[\\#68d8ff\\]\\/16[data-hover]{background-color:#68d8ff29}.data-hover\\:bg-white\\/8[data-hover]{background-color:#ffffff14}@supports (color:color-mix(in lab,red,red)){.data-hover\\:bg-white\\/8[data-hover]{background-color:color-mix(in oklab,var(--color-white)8%,transparent)}}.data-hover\\:text-white[data-hover]{color:var(--color-white)}@media(prefers-reduced-motion:reduce){.motion-reduce\\:translate-y-0{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.motion-reduce\\:transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.motion-reduce\\:transition-none{transition-property:none}.motion-reduce\\:delay-0{transition-delay:0s}.motion-reduce\\:duration-75{--tw-duration:75ms;transition-duration:75ms}.motion-reduce\\:duration-100{--tw-duration:.1s;transition-duration:.1s}.motion-reduce\\:delay-0{--tw-animation-delay:0s;animation-delay:0s}.motion-reduce\\:active\\:scale-100:active{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x)var(--tw-scale-y)}}@media(min-width:40rem){.sm\\:inline{display:inline}.sm\\:p-5{padding:calc(var(--spacing)*5)}.sm\\:p-6{padding:calc(var(--spacing)*6)}}}@property --tw-animation-delay{syntax:"*";inherits:false;initial-value:0s}@property --tw-animation-direction{syntax:"*";inherits:false;initial-value:normal}@property --tw-animation-duration{syntax:"*";inherits:false}@property --tw-animation-fill-mode{syntax:"*";inherits:false;initial-value:none}@property --tw-animation-iteration-count{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-translate-y{syntax:"*";inherits:false;initial-value:0}@property --chat-veil-alpha-start{syntax:"<number>";inherits:false;initial-value:1}@property --chat-veil-alpha-upper{syntax:"<number>";inherits:false;initial-value:1}@property --chat-veil-alpha-middle{syntax:"<number>";inherits:false;initial-value:1}@property --chat-veil-alpha-lower{syntax:"<number>";inherits:false;initial-value:1}.bridge-ai-chat-widget{--spacing:4px;--lola-safe-area-inset-top:env(safe-area-inset-top,0px);--lola-safe-area-inset-right:env(safe-area-inset-right,0px);--lola-safe-area-inset-bottom:env(safe-area-inset-bottom,0px);--lola-safe-area-inset-left:env(safe-area-inset-left,0px);--radius:.625rem;--chat-accent-cherry:#ef6b7f;--chat-accent-cyan:#68d8ff;--chat-accent-lime:#d7ff64;--chat-action-primary:#8fff37;--chat-surface-agent:#1a191bd1;--chat-surface-customer:#5b405f;--chat-text-primary:#f3f0f4;--chat-immersive-surface:#111;--chat-control-surface:#191919;--chat-control-border:#2a2a2a;--chat-presence:#a5fc4c;--chat-avatar-controls-clearance:74px;--chat-avatar-lift:6px;--chat-veil-opaque-start:54%;--chat-ease-out:cubic-bezier(.23,1,.32,1);--chat-ease-in-out:cubic-bezier(.77,0,.175,1);--chat-route-offset-x:12px;--chat-route-enter-easing:linear(0,.062 5%,.192 10%,.338 15%,.477 20%,.596 25%,.694 30%,.771 35%,.831 40%,.877 45%,.911 50%,.937 55%,.955 60%,.969 65%,.979 70%,.986 75%,.991 80%,.994 85%,.997 90%,.999 95%,1);color-scheme:dark;font-synthesis:none;letter-spacing:-.006em;-webkit-text-size-adjust:100%;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Lola Inter,Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.bridge-ai-chat-widget[dir=rtl]{--chat-route-offset-x:-12px}.bridge-ai-chat-widget button,.bridge-ai-chat-widget textarea{font-family:inherit}.bridge-ai-chat-widget .chat-responder-avatar{background:linear-gradient(#101713,#101713) padding-box padding-box,linear-gradient(#8fff37,#569921) border-box;border:2px solid #0000;box-shadow:0 0 8px #8fff372e}.bridge-ai-chat-widget .chat-responder-name,.bridge-ai-chat-widget .chat-composer textarea{letter-spacing:0;font-family:Lola Roboto,Roboto,Arial,sans-serif}.bridge-ai-chat-widget .chat-responder-status{letter-spacing:0;font-family:Lola Inter,Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.bridge-ai-chat-widget :where(button:not(:disabled),[role=button]:not([aria-disabled=true]),a[href]){cursor:pointer}.bridge-ai-chat-widget button:disabled{cursor:not-allowed}.bridge-ai-chat-widget .chat-launcher,.bridge-ai-chat-widget [data-lola-drag-handle]{cursor:grab}.bridge-ai-chat-widget [data-lola-drag-handle]{touch-action:none}.bridge-ai-chat-widget .chat-launcher:active,.bridge-ai-chat-widget [data-lola-drag-handle]:active{cursor:grabbing}.bridge-ai-chat-widget [data-lola-resize=top]{cursor:n-resize}.bridge-ai-chat-widget [data-lola-resize=left]{cursor:w-resize}.bridge-ai-chat-widget [data-lola-resize=corner]{cursor:nwse-resize}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}';
|
|
2
|
+
var kt = typeof global == "object" && global && global.Object === Object && global, Et = typeof self == "object" && self && self.Object === Object && self, dt = kt || Et || Function("return this")(), O = dt.Symbol, ht = Object.prototype, St = ht.hasOwnProperty, It = ht.toString, T = O ? O.toStringTag : void 0;
|
|
3
|
+
function Tt(r) {
|
|
4
|
+
var t = St.call(r, T), e = r[T];
|
|
5
|
+
try {
|
|
6
|
+
r[T] = void 0;
|
|
7
|
+
var a = !0;
|
|
8
|
+
} catch {
|
|
9
|
+
}
|
|
10
|
+
var i = It.call(r);
|
|
11
|
+
return a && (t ? r[T] = e : delete r[T]), i;
|
|
12
|
+
}
|
|
13
|
+
var At = Object.prototype, Rt = At.toString;
|
|
14
|
+
function Ct(r) {
|
|
15
|
+
return Rt.call(r);
|
|
16
|
+
}
|
|
17
|
+
var Ot = "[object Null]", Nt = "[object Undefined]", j = O ? O.toStringTag : void 0;
|
|
18
|
+
function Pt(r) {
|
|
19
|
+
return r == null ? r === void 0 ? Nt : Ot : j && j in Object(r) ? Tt(r) : Ct(r);
|
|
20
|
+
}
|
|
21
|
+
function Dt(r) {
|
|
22
|
+
return r != null && typeof r == "object";
|
|
23
|
+
}
|
|
24
|
+
var Lt = "[object Symbol]";
|
|
25
|
+
function Ut(r) {
|
|
26
|
+
return typeof r == "symbol" || Dt(r) && Pt(r) == Lt;
|
|
27
|
+
}
|
|
28
|
+
var Ht = /\s/;
|
|
29
|
+
function zt(r) {
|
|
30
|
+
for (var t = r.length; t-- && Ht.test(r.charAt(t)); )
|
|
31
|
+
;
|
|
32
|
+
return t;
|
|
33
|
+
}
|
|
34
|
+
var Mt = /^\s+/;
|
|
35
|
+
function qt(r) {
|
|
36
|
+
return r && r.slice(0, zt(r) + 1).replace(Mt, "");
|
|
37
|
+
}
|
|
38
|
+
function U(r) {
|
|
39
|
+
var t = typeof r;
|
|
40
|
+
return r != null && (t == "object" || t == "function");
|
|
41
|
+
}
|
|
42
|
+
var V = NaN, jt = /^[-+]0x[0-9a-f]+$/i, Vt = /^0b[01]+$/i, Gt = /^0o[0-7]+$/i, Ft = parseInt;
|
|
43
|
+
function G(r) {
|
|
44
|
+
if (typeof r == "number")
|
|
45
|
+
return r;
|
|
46
|
+
if (Ut(r))
|
|
47
|
+
return V;
|
|
48
|
+
if (U(r)) {
|
|
49
|
+
var t = typeof r.valueOf == "function" ? r.valueOf() : r;
|
|
50
|
+
r = U(t) ? t + "" : t;
|
|
51
|
+
}
|
|
52
|
+
if (typeof r != "string")
|
|
53
|
+
return r === 0 ? r : +r;
|
|
54
|
+
r = qt(r);
|
|
55
|
+
var e = Vt.test(r);
|
|
56
|
+
return e || Gt.test(r) ? Ft(r.slice(2), e ? 2 : 8) : jt.test(r) ? V : +r;
|
|
57
|
+
}
|
|
58
|
+
var D = function() {
|
|
59
|
+
return dt.Date.now();
|
|
60
|
+
}, Wt = "Expected a function", Bt = Math.max, Kt = Math.min;
|
|
61
|
+
function Yt(r, t, e) {
|
|
62
|
+
var a, i, o, n, s, c, l = 0, d = !1, u = !1, p = !0;
|
|
63
|
+
if (typeof r != "function")
|
|
64
|
+
throw new TypeError(Wt);
|
|
65
|
+
t = G(t) || 0, U(e) && (d = !0, u = "maxWait" in e, o = u ? Bt(G(e.maxWait) || 0, t) : o, p = "trailing" in e ? !!e.trailing : p);
|
|
66
|
+
function g(w) {
|
|
67
|
+
var E = a, I = i;
|
|
68
|
+
return a = i = void 0, l = w, n = r.apply(I, E), n;
|
|
69
|
+
}
|
|
70
|
+
function b(w) {
|
|
71
|
+
return l = w, s = setTimeout(x, t), d ? g(w) : n;
|
|
72
|
+
}
|
|
73
|
+
function m(w) {
|
|
74
|
+
var E = w - c, I = w - l, q = t - E;
|
|
75
|
+
return u ? Kt(q, o - I) : q;
|
|
76
|
+
}
|
|
77
|
+
function k(w) {
|
|
78
|
+
var E = w - c, I = w - l;
|
|
79
|
+
return c === void 0 || E >= t || E < 0 || u && I >= o;
|
|
80
|
+
}
|
|
81
|
+
function x() {
|
|
82
|
+
var w = D();
|
|
83
|
+
if (k(w))
|
|
84
|
+
return y(w);
|
|
85
|
+
s = setTimeout(x, m(w));
|
|
86
|
+
}
|
|
87
|
+
function y(w) {
|
|
88
|
+
return s = void 0, p && a ? g(w) : (a = i = void 0, n);
|
|
89
|
+
}
|
|
90
|
+
function A() {
|
|
91
|
+
s !== void 0 && clearTimeout(s), l = 0, a = c = i = s = void 0;
|
|
92
|
+
}
|
|
93
|
+
function N() {
|
|
94
|
+
return s === void 0 ? n : y(D());
|
|
95
|
+
}
|
|
96
|
+
function P() {
|
|
97
|
+
var w = D(), E = k(w);
|
|
98
|
+
if (a = arguments, i = this, c = w, E) {
|
|
99
|
+
if (s === void 0)
|
|
100
|
+
return b(c);
|
|
101
|
+
if (u)
|
|
102
|
+
return clearTimeout(s), s = setTimeout(x, t), g(c);
|
|
103
|
+
}
|
|
104
|
+
return s === void 0 && (s = setTimeout(x, t)), n;
|
|
105
|
+
}
|
|
106
|
+
return P.cancel = A, P.flush = N, P;
|
|
107
|
+
}
|
|
108
|
+
const F = {
|
|
109
|
+
debug: 0,
|
|
110
|
+
info: 1,
|
|
111
|
+
warn: 2,
|
|
112
|
+
error: 3
|
|
113
|
+
};
|
|
114
|
+
class $t {
|
|
115
|
+
level;
|
|
116
|
+
prefix;
|
|
117
|
+
debugOwnerCount = 0;
|
|
118
|
+
constructor(t = "Widget", e = "info") {
|
|
119
|
+
this.prefix = `[${t}]`, this.level = F[e];
|
|
120
|
+
}
|
|
121
|
+
enableDebug() {
|
|
122
|
+
this.debugOwnerCount += 1;
|
|
123
|
+
let t = !0;
|
|
124
|
+
return () => {
|
|
125
|
+
t && (t = !1, this.debugOwnerCount -= 1);
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
isEnabled(t) {
|
|
129
|
+
return this.debugOwnerCount > 0 || this.level <= F[t];
|
|
130
|
+
}
|
|
131
|
+
debug(...t) {
|
|
132
|
+
this.isEnabled("debug") && console.debug(this.prefix, ...t);
|
|
133
|
+
}
|
|
134
|
+
info(...t) {
|
|
135
|
+
this.isEnabled("info") && console.info(this.prefix, ...t);
|
|
136
|
+
}
|
|
137
|
+
warn(...t) {
|
|
138
|
+
this.isEnabled("warn") && console.warn(this.prefix, ...t);
|
|
139
|
+
}
|
|
140
|
+
error(...t) {
|
|
141
|
+
this.isEnabled("error") && console.error(this.prefix, ...t);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const Xt = "warn", f = new $t("Lola-Widget", Xt), La = "audio/wav", W = "audio/pcm";
|
|
145
|
+
class h extends Error {
|
|
146
|
+
constructor(t, e = "failed", a) {
|
|
147
|
+
super(t, a), this.code = t, this.status = e;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
const Zt = [
|
|
151
|
+
"show_assistant",
|
|
152
|
+
"hide_assistant",
|
|
153
|
+
"open_chat",
|
|
154
|
+
"close_chat",
|
|
155
|
+
"play_animation",
|
|
156
|
+
"highlight_element",
|
|
157
|
+
"remove_highlight",
|
|
158
|
+
"show_cta",
|
|
159
|
+
"connect_telegram",
|
|
160
|
+
"speak_text",
|
|
161
|
+
"start_voice_conversation",
|
|
162
|
+
"open_page",
|
|
163
|
+
"open_modal"
|
|
164
|
+
], Jt = [
|
|
165
|
+
"keep",
|
|
166
|
+
"collapseOnSuccess",
|
|
167
|
+
"immersive"
|
|
168
|
+
], Qt = /^[a-zA-Z0-9_.:-]{1,200}$/, te = /* @__PURE__ */ new Set([
|
|
169
|
+
"button",
|
|
170
|
+
"element",
|
|
171
|
+
"modal",
|
|
172
|
+
"page"
|
|
173
|
+
]), ee = new Set(
|
|
174
|
+
Jt
|
|
175
|
+
), ae = "collapseOnSuccess";
|
|
176
|
+
class ie {
|
|
177
|
+
constructor(t = {}, e = {}, a = {}) {
|
|
178
|
+
this.actionPolicies = a;
|
|
179
|
+
for (const [i, o] of Object.entries(t))
|
|
180
|
+
this.registerTarget(i, o);
|
|
181
|
+
for (const [i, o] of Object.entries(a))
|
|
182
|
+
if (this.assertTargetCode(i), !o || typeof o != "object" || !ee.has(o.mobileDisposition))
|
|
183
|
+
throw new h("TARGET_INVALID");
|
|
184
|
+
Object.assign(this.handlers, e);
|
|
185
|
+
}
|
|
186
|
+
targets = /* @__PURE__ */ new Map();
|
|
187
|
+
handlers = {};
|
|
188
|
+
registerTarget(t, e) {
|
|
189
|
+
return this.assertTargetCode(t), this.assertLegacyTarget(e), this.targets.set(t, e), () => {
|
|
190
|
+
this.targets.get(t) === e && this.targets.delete(t);
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
getTarget(t) {
|
|
194
|
+
return this.targets.get(t);
|
|
195
|
+
}
|
|
196
|
+
getHandler(t) {
|
|
197
|
+
return this.handlers[t];
|
|
198
|
+
}
|
|
199
|
+
registerHandler(t, e) {
|
|
200
|
+
return this.handlers[t] = e, () => {
|
|
201
|
+
this.handlers[t] === e && delete this.handlers[t];
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
resolveAction(t, e, a) {
|
|
205
|
+
return a !== void 0 ? this.resolveCanonicalAction(t, a) : this.resolveLegacyAction(t, e);
|
|
206
|
+
}
|
|
207
|
+
resolveHighlightPresentation(t) {
|
|
208
|
+
return this.assertTargetCode(t), Object.freeze({
|
|
209
|
+
kind: "element",
|
|
210
|
+
code: t,
|
|
211
|
+
mobileDisposition: this.mobileDisposition(t)
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
async execute(t, e, a, i) {
|
|
215
|
+
const o = this.resolveAction(t, a, i);
|
|
216
|
+
await this.executeAction(o, e, a);
|
|
217
|
+
}
|
|
218
|
+
async executeAction(t, e, a) {
|
|
219
|
+
if (t.kind === "page") {
|
|
220
|
+
const o = this.handlers.openPage;
|
|
221
|
+
if (o) {
|
|
222
|
+
await o({
|
|
223
|
+
commandId: e,
|
|
224
|
+
pageCode: t.code,
|
|
225
|
+
route: t.route,
|
|
226
|
+
payload: a
|
|
227
|
+
});
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
this.applyUrlFallback(t.route);
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
const i = this.handlers.openModal;
|
|
234
|
+
if (i && t.modalName) {
|
|
235
|
+
await i({
|
|
236
|
+
commandId: e,
|
|
237
|
+
modalCode: t.code,
|
|
238
|
+
modalName: t.modalName,
|
|
239
|
+
payload: a
|
|
240
|
+
});
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (t.selector) {
|
|
244
|
+
const o = document.querySelector(t.selector);
|
|
245
|
+
if (o instanceof HTMLDialogElement) {
|
|
246
|
+
o.showModal();
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
if (!t.url) throw new h("TARGET_NOT_FOUND");
|
|
250
|
+
}
|
|
251
|
+
if (t.url) {
|
|
252
|
+
this.applyUrlFallback(t.url);
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
throw new h("HANDLER_UNSUPPORTED", "unsupported");
|
|
256
|
+
}
|
|
257
|
+
canExecute(t) {
|
|
258
|
+
return t.kind === "page" ? !!(this.handlers.openPage || this.isSameOriginUrl(t.route)) : !!(this.handlers.openModal && t.modalName || t.selector || t.url);
|
|
259
|
+
}
|
|
260
|
+
resolveCanonicalAction(t, e) {
|
|
261
|
+
if (!e || typeof e != "object")
|
|
262
|
+
throw new h("TARGET_INVALID");
|
|
263
|
+
const a = this.requireNonEmptyString(e.id), i = this.requireNonEmptyString(e.code);
|
|
264
|
+
if (this.assertTargetCode(i), t === "open_page") {
|
|
265
|
+
if (e.kind !== "page")
|
|
266
|
+
throw new h("TARGET_INVALID");
|
|
267
|
+
const n = this.requireNonEmptyString(e.route);
|
|
268
|
+
return Object.freeze({
|
|
269
|
+
kind: "page",
|
|
270
|
+
code: i,
|
|
271
|
+
route: n,
|
|
272
|
+
mobileDisposition: this.mobileDisposition(i),
|
|
273
|
+
target: Object.freeze({
|
|
274
|
+
...e,
|
|
275
|
+
id: a,
|
|
276
|
+
code: i,
|
|
277
|
+
route: n
|
|
278
|
+
})
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
if (e.kind !== "modal")
|
|
282
|
+
throw new h("TARGET_INVALID");
|
|
283
|
+
const o = this.requireNonEmptyString(e.modalName);
|
|
284
|
+
return Object.freeze({
|
|
285
|
+
kind: "modal",
|
|
286
|
+
code: i,
|
|
287
|
+
mobileDisposition: this.mobileDisposition(i),
|
|
288
|
+
modalName: o,
|
|
289
|
+
target: Object.freeze({
|
|
290
|
+
...e,
|
|
291
|
+
id: a,
|
|
292
|
+
code: i,
|
|
293
|
+
modalName: o
|
|
294
|
+
})
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
resolveLegacyAction(t, e) {
|
|
298
|
+
const a = t === "open_page" ? e.pageId ?? e.pageCode : e.modalId ?? e.modalCode, i = this.requireNonEmptyString(a);
|
|
299
|
+
this.assertTargetCode(i);
|
|
300
|
+
const o = this.targets.get(i), n = t === "open_page" ? "page" : "modal";
|
|
301
|
+
if (o && o.kind !== n)
|
|
302
|
+
throw new h("TARGET_INVALID");
|
|
303
|
+
if (t === "open_page") {
|
|
304
|
+
const l = this.targetUrl(o);
|
|
305
|
+
if (!l) throw new h("TARGET_INVALID");
|
|
306
|
+
return Object.freeze({
|
|
307
|
+
kind: "page",
|
|
308
|
+
code: i,
|
|
309
|
+
route: l,
|
|
310
|
+
mobileDisposition: this.mobileDisposition(i)
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
if (!o) throw new h("TARGET_INVALID");
|
|
314
|
+
const s = this.targetUrl(o), c = o.modalName ?? (this.handlers.openModal ? i : void 0);
|
|
315
|
+
if (!c && !o.selector && !s)
|
|
316
|
+
throw new h("TARGET_INVALID");
|
|
317
|
+
return Object.freeze({
|
|
318
|
+
kind: "modal",
|
|
319
|
+
code: i,
|
|
320
|
+
mobileDisposition: this.mobileDisposition(i),
|
|
321
|
+
modalName: c,
|
|
322
|
+
url: s,
|
|
323
|
+
selector: o.selector
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
assertLegacyTarget(t) {
|
|
327
|
+
if (!t || typeof t != "object" || !te.has(t.kind))
|
|
328
|
+
throw new h("TARGET_INVALID");
|
|
329
|
+
for (const e of [
|
|
330
|
+
t.selector,
|
|
331
|
+
t.route,
|
|
332
|
+
t.modalName,
|
|
333
|
+
t.url
|
|
334
|
+
])
|
|
335
|
+
if (e !== void 0 && !this.requireNonEmptyString(e))
|
|
336
|
+
throw new h("TARGET_INVALID");
|
|
337
|
+
if (t.query !== void 0 && (!t.query || typeof t.query != "object" || Array.isArray(t.query) || Object.values(t.query).some(
|
|
338
|
+
(e) => e !== null && typeof e != "string"
|
|
339
|
+
)))
|
|
340
|
+
throw new h("TARGET_INVALID");
|
|
341
|
+
}
|
|
342
|
+
targetUrl(t) {
|
|
343
|
+
if (!t) return;
|
|
344
|
+
const e = t.url ?? t.route;
|
|
345
|
+
if (!e && !t.query) return;
|
|
346
|
+
let a;
|
|
347
|
+
try {
|
|
348
|
+
a = new URL(e ?? window.location.href, window.location.href);
|
|
349
|
+
} catch {
|
|
350
|
+
throw new h("TARGET_INVALID");
|
|
351
|
+
}
|
|
352
|
+
for (const [i, o] of Object.entries(t.query ?? {}))
|
|
353
|
+
o === null ? a.searchParams.delete(i) : a.searchParams.set(i, o);
|
|
354
|
+
if (a.origin !== window.location.origin)
|
|
355
|
+
throw new h("TARGET_INVALID");
|
|
356
|
+
return `${a.pathname}${a.search}${a.hash}`;
|
|
357
|
+
}
|
|
358
|
+
mobileDisposition(t) {
|
|
359
|
+
return this.actionPolicies[t]?.mobileDisposition ?? ae;
|
|
360
|
+
}
|
|
361
|
+
applyUrlFallback(t) {
|
|
362
|
+
let e;
|
|
363
|
+
try {
|
|
364
|
+
e = new URL(t, window.location.href);
|
|
365
|
+
} catch {
|
|
366
|
+
throw new h("TARGET_INVALID");
|
|
367
|
+
}
|
|
368
|
+
if (!this.isSameOriginUrl(e))
|
|
369
|
+
throw new h("TARGET_INVALID");
|
|
370
|
+
window.history.pushState(null, "", e), window.dispatchEvent(new PopStateEvent("popstate", { state: null }));
|
|
371
|
+
}
|
|
372
|
+
isSameOriginUrl(t) {
|
|
373
|
+
try {
|
|
374
|
+
return (t instanceof URL ? t : new URL(t, window.location.href)).origin === window.location.origin;
|
|
375
|
+
} catch {
|
|
376
|
+
return !1;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
requireNonEmptyString(t) {
|
|
380
|
+
if (typeof t != "string" || !t.trim())
|
|
381
|
+
throw new h("TARGET_INVALID");
|
|
382
|
+
return t.trim();
|
|
383
|
+
}
|
|
384
|
+
assertTargetCode(t) {
|
|
385
|
+
if (!Qt.test(t))
|
|
386
|
+
throw new h("TARGET_INVALID");
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
const B = /* @__PURE__ */ new Set([
|
|
390
|
+
"succeeded",
|
|
391
|
+
"failed",
|
|
392
|
+
"expired",
|
|
393
|
+
"unsupported"
|
|
394
|
+
]), re = 600 * 1e3, oe = 256, ne = /^[a-zA-Z0-9_.:-]{1,200}$/, se = "rgba(167, 139, 250, 0.82)", ce = "rgba(196, 181, 253, 1)", le = "0 0 0 1px rgba(255, 255, 255, 0.12), 0 0 0 4px rgba(139, 92, 246, 0.12), 0 0 18px 2px rgba(124, 58, 237, 0.28), inset 0 0 12px rgba(139, 92, 246, 0.06)", de = "0 0 0 1px rgba(255, 255, 255, 0.28), 0 0 0 5px rgba(139, 92, 246, 0.2), 0 0 26px 4px rgba(124, 58, 237, 0.5), inset 0 0 14px rgba(139, 92, 246, 0.12)";
|
|
395
|
+
class he {
|
|
396
|
+
constructor(t = {}, e = {}, a, i, o = {}) {
|
|
397
|
+
this.onStatus = a, this.scenarioInteractions = i, this.uiCommands = new ie(t, e, o), this.internalHandlersReady = new Promise((n) => {
|
|
398
|
+
this.resolveInternalHandlers = n;
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
uiCommands;
|
|
402
|
+
internalHandlers = {};
|
|
403
|
+
internalHandlersReady;
|
|
404
|
+
resolveInternalHandlers;
|
|
405
|
+
completed = /* @__PURE__ */ new Map();
|
|
406
|
+
inFlight = /* @__PURE__ */ new Map();
|
|
407
|
+
completedCtaActions = /* @__PURE__ */ new Set();
|
|
408
|
+
terminalCtaActions = /* @__PURE__ */ new Map();
|
|
409
|
+
ctaActionRetentionOrder = /* @__PURE__ */ new Set();
|
|
410
|
+
inFlightCtaActions = /* @__PURE__ */ new Map();
|
|
411
|
+
highlights = /* @__PURE__ */ new Map();
|
|
412
|
+
targetObservationCleanups = /* @__PURE__ */ new Map();
|
|
413
|
+
targetActivationOwners = /* @__PURE__ */ new Map();
|
|
414
|
+
activeCustomHighlights = /* @__PURE__ */ new Map();
|
|
415
|
+
targetHighlightOperations = /* @__PURE__ */ new Map();
|
|
416
|
+
principalSessionId = null;
|
|
417
|
+
principalGeneration = 0;
|
|
418
|
+
destroyed = !1;
|
|
419
|
+
registerTarget(t, e) {
|
|
420
|
+
return this.uiCommands.registerTarget(t, e);
|
|
421
|
+
}
|
|
422
|
+
registerHostHandler(t, e) {
|
|
423
|
+
return this.uiCommands.registerHandler(t, e);
|
|
424
|
+
}
|
|
425
|
+
setInternalHandlers(t) {
|
|
426
|
+
return Object.assign(this.internalHandlers, t), this.resolveInternalHandlers(), () => {
|
|
427
|
+
for (const [e, a] of Object.entries(t))
|
|
428
|
+
this.internalHandlers[e] === a && delete this.internalHandlers[e];
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
async execute(t, e, a) {
|
|
432
|
+
const i = t?.data?.commandId;
|
|
433
|
+
if (typeof i != "string" || !i) {
|
|
434
|
+
f.warn("Ignored command without commandId", t);
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
if (this.destroyed) return;
|
|
438
|
+
const o = this.ensurePrincipal(e, !1);
|
|
439
|
+
if (o === null) {
|
|
440
|
+
const l = {
|
|
441
|
+
commandId: i,
|
|
442
|
+
status: "failed",
|
|
443
|
+
errorCode: "SESSION_MISMATCH"
|
|
444
|
+
};
|
|
445
|
+
this.onStatus?.({ ...l, commandType: t.data.commandType }), await a(l);
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
this.loadCompleted(e);
|
|
449
|
+
const n = this.completed.get(i);
|
|
450
|
+
if (n) {
|
|
451
|
+
await a(this.toAck(n));
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
const s = this.inFlight.get(i);
|
|
455
|
+
if (s) {
|
|
456
|
+
await a({ commandId: i, status: "received" });
|
|
457
|
+
try {
|
|
458
|
+
await s;
|
|
459
|
+
} catch (d) {
|
|
460
|
+
if (!this.completed.has(i)) throw d;
|
|
461
|
+
}
|
|
462
|
+
const l = this.completed.get(i);
|
|
463
|
+
l && await a(this.toAck(l));
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
const c = this.executeOnce(t, e, a, o);
|
|
467
|
+
this.inFlight.set(i, c);
|
|
468
|
+
try {
|
|
469
|
+
await c;
|
|
470
|
+
} finally {
|
|
471
|
+
this.inFlight.get(i) === c && this.inFlight.delete(i);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
updateSession(t) {
|
|
475
|
+
this.destroyed || this.ensurePrincipal(t, !0);
|
|
476
|
+
}
|
|
477
|
+
async executeCtaAction(t) {
|
|
478
|
+
if (this.completedCtaActions.has(t.commandId)) return "COMPLETED";
|
|
479
|
+
const e = this.terminalCtaActions.get(t.commandId);
|
|
480
|
+
if (e) return e;
|
|
481
|
+
const a = this.inFlightCtaActions.get(t.commandId);
|
|
482
|
+
if (a) return a;
|
|
483
|
+
const i = this.principalGeneration;
|
|
484
|
+
let o;
|
|
485
|
+
const n = new Promise((s) => {
|
|
486
|
+
o = s;
|
|
487
|
+
});
|
|
488
|
+
return this.inFlightCtaActions.set(t.commandId, n), this.executeCtaActionOnce(t, i).then(
|
|
489
|
+
(s) => {
|
|
490
|
+
this.inFlightCtaActions.get(t.commandId) === n && (this.inFlightCtaActions.delete(t.commandId), this.isCurrentPrincipal(i) && (s === "COMPLETED" ? (this.completedCtaActions.add(t.commandId), this.retainCtaAction(t.commandId)) : s === "TERMINAL_FAILURE" && (this.terminalCtaActions.set(t.commandId, n), this.retainCtaAction(t.commandId)))), o(s);
|
|
491
|
+
},
|
|
492
|
+
(s) => {
|
|
493
|
+
this.inFlightCtaActions.get(t.commandId) === n && (this.inFlightCtaActions.delete(t.commandId), this.isCurrentPrincipal(i) && (this.terminalCtaActions.set(t.commandId, n), this.retainCtaAction(t.commandId))), f.error("CTA action failed", s), o("TERMINAL_FAILURE");
|
|
494
|
+
}
|
|
495
|
+
), n;
|
|
496
|
+
}
|
|
497
|
+
async executeCtaActionOnce(t, e) {
|
|
498
|
+
if (t.expiresAt && Number.isFinite(Date.parse(t.expiresAt)) && Date.parse(t.expiresAt) <= Date.now())
|
|
499
|
+
throw new Error("CTA expired before activation");
|
|
500
|
+
if (t.action === "none") return "COMPLETED";
|
|
501
|
+
if (t.action === "connect_telegram") {
|
|
502
|
+
const i = this.requireInternal("connectTelegram");
|
|
503
|
+
try {
|
|
504
|
+
return await i(t);
|
|
505
|
+
} catch (o) {
|
|
506
|
+
return f.error("Retryable CTA action failed", o), "RETRYABLE_FAILURE";
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
const a = t.uiAction ?? this.uiCommands.resolveAction(t.action, t.payload);
|
|
510
|
+
return await this.executeUiAction(
|
|
511
|
+
a,
|
|
512
|
+
t.commandId,
|
|
513
|
+
t.payload,
|
|
514
|
+
e,
|
|
515
|
+
"CTA"
|
|
516
|
+
), "COMPLETED";
|
|
517
|
+
}
|
|
518
|
+
async executeUiAction(t, e, a, i, o) {
|
|
519
|
+
return this.executeWithUiActionHandoff(
|
|
520
|
+
t,
|
|
521
|
+
e,
|
|
522
|
+
i,
|
|
523
|
+
o,
|
|
524
|
+
() => this.uiCommands.executeAction(t, e, a)
|
|
525
|
+
);
|
|
526
|
+
}
|
|
527
|
+
async executeWithUiActionHandoff(t, e, a, i, o) {
|
|
528
|
+
let n;
|
|
529
|
+
try {
|
|
530
|
+
n = this.internalHandlers.prepareUiActionHandoff?.(
|
|
531
|
+
t,
|
|
532
|
+
e,
|
|
533
|
+
i
|
|
534
|
+
);
|
|
535
|
+
} catch (s) {
|
|
536
|
+
f.warn("UI action presentation handoff preparation failed", s);
|
|
537
|
+
}
|
|
538
|
+
try {
|
|
539
|
+
await o();
|
|
540
|
+
} catch (s) {
|
|
541
|
+
try {
|
|
542
|
+
n?.cancel();
|
|
543
|
+
} catch (c) {
|
|
544
|
+
f.warn(
|
|
545
|
+
"UI action presentation handoff cancellation failed",
|
|
546
|
+
c
|
|
547
|
+
);
|
|
548
|
+
}
|
|
549
|
+
throw s;
|
|
550
|
+
}
|
|
551
|
+
if (!this.isCurrentPrincipal(a)) {
|
|
552
|
+
try {
|
|
553
|
+
n?.cancel();
|
|
554
|
+
} catch (s) {
|
|
555
|
+
f.warn(
|
|
556
|
+
"UI action presentation handoff cancellation failed",
|
|
557
|
+
s
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
try {
|
|
563
|
+
n?.complete();
|
|
564
|
+
} catch (s) {
|
|
565
|
+
f.warn("UI action presentation handoff failed", s);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
retainCtaAction(t) {
|
|
569
|
+
for (this.ctaActionRetentionOrder.delete(t), this.ctaActionRetentionOrder.add(t); this.ctaActionRetentionOrder.size > oe; ) {
|
|
570
|
+
const e = this.ctaActionRetentionOrder.values().next().value;
|
|
571
|
+
if (e === void 0) break;
|
|
572
|
+
this.ctaActionRetentionOrder.delete(e), this.completedCtaActions.delete(e), this.terminalCtaActions.delete(e);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
destroy() {
|
|
576
|
+
this.destroyed || (this.destroyed = !0, this.resetPrincipalState(), this.principalSessionId = null);
|
|
577
|
+
}
|
|
578
|
+
async executeOnce(t, e, a, i) {
|
|
579
|
+
const { commandId: o, commandType: n, interactionSessionId: s, expiresAt: c } = t.data, l = e.interactionSessionId;
|
|
580
|
+
if (s !== l) {
|
|
581
|
+
await this.finish(
|
|
582
|
+
{ commandId: o, status: "failed", errorCode: "SESSION_MISMATCH" },
|
|
583
|
+
e,
|
|
584
|
+
a,
|
|
585
|
+
n,
|
|
586
|
+
i
|
|
587
|
+
);
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
if (c && Date.parse(c) <= Date.now()) {
|
|
591
|
+
await this.finish(
|
|
592
|
+
{ commandId: o, status: "expired", errorCode: "COMMAND_EXPIRED" },
|
|
593
|
+
e,
|
|
594
|
+
a,
|
|
595
|
+
n,
|
|
596
|
+
i
|
|
597
|
+
);
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
if (await a({ commandId: o, status: "received" }), this.onStatus?.({ commandId: o, status: "received", commandType: n }), !this.isCurrentPrincipal(i)) return;
|
|
601
|
+
const d = t.data.contractVersion;
|
|
602
|
+
if (d !== void 0 && d !== 1 || t.data.target !== void 0 && d !== 1) {
|
|
603
|
+
await this.finish(
|
|
604
|
+
{
|
|
605
|
+
commandId: o,
|
|
606
|
+
status: "unsupported",
|
|
607
|
+
errorCode: "CONTRACT_VERSION_UNSUPPORTED"
|
|
608
|
+
},
|
|
609
|
+
e,
|
|
610
|
+
a,
|
|
611
|
+
n,
|
|
612
|
+
i
|
|
613
|
+
);
|
|
614
|
+
return;
|
|
615
|
+
}
|
|
616
|
+
if (!Zt.includes(n)) {
|
|
617
|
+
await this.finish(
|
|
618
|
+
{ commandId: o, status: "unsupported", errorCode: "COMMAND_UNSUPPORTED" },
|
|
619
|
+
e,
|
|
620
|
+
a,
|
|
621
|
+
n,
|
|
622
|
+
i
|
|
623
|
+
);
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
if (!t.data.payload || typeof t.data.payload != "object" || Array.isArray(t.data.payload)) {
|
|
627
|
+
await this.finish(
|
|
628
|
+
{ commandId: o, status: "failed", errorCode: "PAYLOAD_INVALID" },
|
|
629
|
+
e,
|
|
630
|
+
a,
|
|
631
|
+
n,
|
|
632
|
+
i
|
|
633
|
+
);
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
let u;
|
|
637
|
+
try {
|
|
638
|
+
await this.dispatch(
|
|
639
|
+
n,
|
|
640
|
+
t.data.payload,
|
|
641
|
+
o,
|
|
642
|
+
t.data.target,
|
|
643
|
+
c,
|
|
644
|
+
t.data.scenarioRunId,
|
|
645
|
+
i
|
|
646
|
+
), u = { commandId: o, status: "succeeded" };
|
|
647
|
+
} catch (p) {
|
|
648
|
+
const g = p instanceof h ? p : new h("HANDLER_FAILED");
|
|
649
|
+
f.warn(`Command ${o} failed`, p);
|
|
650
|
+
const b = p instanceof h && p.cause instanceof Error ? p.cause : p instanceof Error && !(p instanceof h) ? p : null;
|
|
651
|
+
u = {
|
|
652
|
+
commandId: o,
|
|
653
|
+
status: g.status,
|
|
654
|
+
errorCode: g.code,
|
|
655
|
+
details: b ? { message: b.message } : void 0
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
await this.finish(u, e, a, n, i);
|
|
659
|
+
}
|
|
660
|
+
async dispatch(t, e, a, i, o, n = "", s = this.principalGeneration) {
|
|
661
|
+
if ([
|
|
662
|
+
"show_assistant",
|
|
663
|
+
"hide_assistant",
|
|
664
|
+
"open_chat",
|
|
665
|
+
"close_chat",
|
|
666
|
+
"play_animation",
|
|
667
|
+
"show_cta",
|
|
668
|
+
"connect_telegram",
|
|
669
|
+
"speak_text",
|
|
670
|
+
"start_voice_conversation"
|
|
671
|
+
].includes(t) && await this.internalHandlersReady, !!this.isCurrentPrincipal(s))
|
|
672
|
+
switch (t) {
|
|
673
|
+
case "show_assistant":
|
|
674
|
+
return this.requireInternal("setAssistantVisible")(!0, a);
|
|
675
|
+
case "hide_assistant":
|
|
676
|
+
return this.requireInternal("setAssistantVisible")(!1, a);
|
|
677
|
+
case "open_chat":
|
|
678
|
+
return this.requireInternal("setChatOpen")(!0, a);
|
|
679
|
+
case "close_chat":
|
|
680
|
+
return this.requireInternal("setChatOpen")(!1, a);
|
|
681
|
+
case "play_animation": {
|
|
682
|
+
const c = this.requireString(
|
|
683
|
+
e.animation,
|
|
684
|
+
"ANIMATION_INVALID"
|
|
685
|
+
);
|
|
686
|
+
return this.requireInternal("playAnimation")(c, o);
|
|
687
|
+
}
|
|
688
|
+
case "highlight_element":
|
|
689
|
+
case "remove_highlight": {
|
|
690
|
+
const c = i !== void 0 ? this.requireEnvelopeTarget(i, ["button", "element"]) : this.requireTarget(
|
|
691
|
+
this.firstDefined(e.target, e.interfaceElementId),
|
|
692
|
+
["button", "element"]
|
|
693
|
+
), l = t === "highlight_element", d = () => this.executeHighlight(
|
|
694
|
+
c,
|
|
695
|
+
l,
|
|
696
|
+
e,
|
|
697
|
+
a,
|
|
698
|
+
t,
|
|
699
|
+
s
|
|
700
|
+
);
|
|
701
|
+
return l ? this.executeWithUiActionHandoff(
|
|
702
|
+
this.uiCommands.resolveHighlightPresentation(c),
|
|
703
|
+
a,
|
|
704
|
+
s,
|
|
705
|
+
"COMMAND",
|
|
706
|
+
d
|
|
707
|
+
) : d();
|
|
708
|
+
}
|
|
709
|
+
case "show_cta":
|
|
710
|
+
return this.executeShowCta(
|
|
711
|
+
e,
|
|
712
|
+
a,
|
|
713
|
+
n,
|
|
714
|
+
o ?? null,
|
|
715
|
+
i
|
|
716
|
+
);
|
|
717
|
+
case "connect_telegram":
|
|
718
|
+
return this.executeConnectTelegram(
|
|
719
|
+
e,
|
|
720
|
+
a,
|
|
721
|
+
n,
|
|
722
|
+
o ?? null
|
|
723
|
+
);
|
|
724
|
+
case "speak_text": {
|
|
725
|
+
const c = this.requireString(
|
|
726
|
+
e.audioPath,
|
|
727
|
+
"SPEECH_AUDIO_INVALID"
|
|
728
|
+
);
|
|
729
|
+
if (c !== `/scenario-commands/${a}/audio` || e.method !== "POST" || e.mimeType !== W || e.format !== "pcm16" || e.sampleRate !== 24e3 || e.channels !== 1)
|
|
730
|
+
throw new h("SPEECH_AUDIO_INVALID");
|
|
731
|
+
const l = this.readLipSyncDescriptor(e.lipSync, a);
|
|
732
|
+
try {
|
|
733
|
+
return await this.requireInternal("speakText")({
|
|
734
|
+
commandId: a,
|
|
735
|
+
commandType: t,
|
|
736
|
+
audioPath: c,
|
|
737
|
+
method: "POST",
|
|
738
|
+
mimeType: W,
|
|
739
|
+
format: "pcm16",
|
|
740
|
+
sampleRate: 24e3,
|
|
741
|
+
channels: 1,
|
|
742
|
+
...l ? { lipSync: l } : {}
|
|
743
|
+
});
|
|
744
|
+
} catch (d) {
|
|
745
|
+
throw new h("AUDIO_PLAYBACK_FAILED", "failed", {
|
|
746
|
+
cause: d
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
case "start_voice_conversation": {
|
|
751
|
+
const c = this.requireString(
|
|
752
|
+
e.voiceSessionId,
|
|
753
|
+
"VOICE_INVITATION_INVALID"
|
|
754
|
+
), l = this.requireString(
|
|
755
|
+
e.introAudioPath,
|
|
756
|
+
"VOICE_INVITATION_INVALID"
|
|
757
|
+
), d = `/voice/sessions/${c}`;
|
|
758
|
+
if (e.requiresUserGesture !== !0 || l !== `${d}/intro-audio`)
|
|
759
|
+
throw new h("VOICE_INVITATION_INVALID");
|
|
760
|
+
return this.requireInternal("startVoiceConversation")({
|
|
761
|
+
commandId: a,
|
|
762
|
+
commandType: t,
|
|
763
|
+
voiceSessionId: c,
|
|
764
|
+
conversationId: this.requireString(
|
|
765
|
+
e.conversationId,
|
|
766
|
+
"VOICE_INVITATION_INVALID"
|
|
767
|
+
),
|
|
768
|
+
messageId: this.requireString(
|
|
769
|
+
e.messageId,
|
|
770
|
+
"VOICE_INVITATION_INVALID"
|
|
771
|
+
),
|
|
772
|
+
text: this.requireString(e.text, "VOICE_INVITATION_INVALID"),
|
|
773
|
+
voice: this.requireString(e.voice, "VOICE_INVITATION_INVALID"),
|
|
774
|
+
requiresUserGesture: !0,
|
|
775
|
+
introAudioPath: l
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
case "open_page":
|
|
779
|
+
case "open_modal": {
|
|
780
|
+
const c = this.uiCommands.resolveAction(
|
|
781
|
+
t,
|
|
782
|
+
e,
|
|
783
|
+
i
|
|
784
|
+
);
|
|
785
|
+
return this.executeUiAction(
|
|
786
|
+
c,
|
|
787
|
+
a,
|
|
788
|
+
e,
|
|
789
|
+
s,
|
|
790
|
+
"COMMAND"
|
|
791
|
+
);
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
async executeHighlight(t, e, a, i, o, n) {
|
|
796
|
+
const c = (this.targetHighlightOperations.get(t) ?? Promise.resolve()).catch(() => {
|
|
797
|
+
}).then(
|
|
798
|
+
() => this.executeHighlightSerial(
|
|
799
|
+
t,
|
|
800
|
+
e,
|
|
801
|
+
a,
|
|
802
|
+
i,
|
|
803
|
+
o,
|
|
804
|
+
n
|
|
805
|
+
)
|
|
806
|
+
);
|
|
807
|
+
this.targetHighlightOperations.set(t, c);
|
|
808
|
+
try {
|
|
809
|
+
await c;
|
|
810
|
+
} finally {
|
|
811
|
+
this.targetHighlightOperations.get(t) === c && this.targetHighlightOperations.delete(t);
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
async executeHighlightSerial(t, e, a, i, o, n) {
|
|
815
|
+
if (!this.isCurrentPrincipal(n)) return;
|
|
816
|
+
const s = this.uiCommands.getTarget(t), c = this.findTargetElement(t, s), l = this.uiCommands.getHandler("highlight");
|
|
817
|
+
if (l) {
|
|
818
|
+
const d = {
|
|
819
|
+
handler: l,
|
|
820
|
+
commandId: i,
|
|
821
|
+
target: t,
|
|
822
|
+
payload: a,
|
|
823
|
+
...c ? { element: c } : {}
|
|
824
|
+
};
|
|
825
|
+
if (this.activeCustomHighlights.has(t)) {
|
|
826
|
+
if (!e) {
|
|
827
|
+
await this.removeCustomHighlightForCommand(
|
|
828
|
+
t,
|
|
829
|
+
d
|
|
830
|
+
);
|
|
831
|
+
return;
|
|
832
|
+
}
|
|
833
|
+
if (await this.deactivateCustomHighlight(t), !this.isCurrentPrincipal(n)) return;
|
|
834
|
+
}
|
|
835
|
+
this.removeTargetTracking(t);
|
|
836
|
+
const u = e ? this.createTargetActivationReporter(t, i) : () => {
|
|
837
|
+
};
|
|
838
|
+
try {
|
|
839
|
+
await this.invokeCustomHighlight(
|
|
840
|
+
d,
|
|
841
|
+
e,
|
|
842
|
+
o,
|
|
843
|
+
u
|
|
844
|
+
);
|
|
845
|
+
} catch (p) {
|
|
846
|
+
if (this.targetActivationOwners.get(t) === i && this.removeTargetTracking(t), e)
|
|
847
|
+
try {
|
|
848
|
+
await this.invokeCustomHighlight(
|
|
849
|
+
d,
|
|
850
|
+
!1,
|
|
851
|
+
"remove_highlight",
|
|
852
|
+
() => {
|
|
853
|
+
}
|
|
854
|
+
);
|
|
855
|
+
} catch (g) {
|
|
856
|
+
f.warn("Custom highlight rollback failed", g);
|
|
857
|
+
}
|
|
858
|
+
throw p;
|
|
859
|
+
}
|
|
860
|
+
if (!this.isCurrentPrincipal(n)) {
|
|
861
|
+
if (this.removeTargetTracking(t), e)
|
|
862
|
+
try {
|
|
863
|
+
await this.invokeCustomHighlight(
|
|
864
|
+
d,
|
|
865
|
+
!1,
|
|
866
|
+
"remove_highlight",
|
|
867
|
+
() => {
|
|
868
|
+
}
|
|
869
|
+
);
|
|
870
|
+
} catch (p) {
|
|
871
|
+
f.warn("Custom highlight cleanup failed", p);
|
|
872
|
+
}
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
875
|
+
e && this.targetActivationOwners.get(t) === i && (this.activeCustomHighlights.set(t, d), c && this.observeTarget(t, c, i));
|
|
876
|
+
return;
|
|
877
|
+
}
|
|
878
|
+
if (!e && this.highlights.has(t)) {
|
|
879
|
+
this.removeDefaultHighlight(t);
|
|
880
|
+
return;
|
|
881
|
+
}
|
|
882
|
+
if (!c) throw new h("TARGET_NOT_FOUND");
|
|
883
|
+
e ? (this.applyDefaultHighlight(t, c, a), this.observeTarget(t, c, i)) : this.removeDefaultHighlight(t);
|
|
884
|
+
}
|
|
885
|
+
async executeShowCta(t, e, a, i, o) {
|
|
886
|
+
const n = this.requireString(t.label, "CTA_INVALID"), s = t.action;
|
|
887
|
+
if (s !== "none" && s !== "open_modal" && s !== "open_page" && s !== "connect_telegram")
|
|
888
|
+
throw new h("CTA_INVALID");
|
|
889
|
+
const c = s === "none" || s === "connect_telegram" ? void 0 : this.uiCommands.resolveAction(s, t, o);
|
|
890
|
+
if (c && !this.uiCommands.canExecute(c))
|
|
891
|
+
throw new h("HANDLER_UNSUPPORTED", "unsupported");
|
|
892
|
+
const l = c?.code, d = t.text === void 0 ? void 0 : this.requireString(t.text, "CTA_INVALID", 1e3), u = t.conversationId === void 0 ? void 0 : this.requireString(t.conversationId, "CTA_INVALID", 200), p = {
|
|
893
|
+
commandId: e,
|
|
894
|
+
commandType: "show_cta",
|
|
895
|
+
label: n,
|
|
896
|
+
...d ? { text: d } : {},
|
|
897
|
+
action: s,
|
|
898
|
+
...u ? { conversationId: u } : {},
|
|
899
|
+
scenarioRunId: a,
|
|
900
|
+
expiresAt: i,
|
|
901
|
+
presentation: "PRIMARY",
|
|
902
|
+
attention: t.attention === "NUDGE_ONCE" ? "NUDGE_ONCE" : "NONE",
|
|
903
|
+
target: l,
|
|
904
|
+
uiAction: c,
|
|
905
|
+
payload: t
|
|
906
|
+
}, g = this.internalHandlers.showCta;
|
|
907
|
+
if (!g)
|
|
908
|
+
throw new h("HANDLER_UNSUPPORTED", "unsupported");
|
|
909
|
+
await g(p);
|
|
910
|
+
}
|
|
911
|
+
async executeConnectTelegram(t, e, a, i) {
|
|
912
|
+
const o = this.requireString(t.label, "CTA_INVALID"), n = t.text === void 0 ? void 0 : this.requireString(t.text, "CTA_INVALID", 1e3), s = t.conversationId === void 0 ? void 0 : this.requireString(t.conversationId, "CTA_INVALID", 200), c = {
|
|
913
|
+
commandId: e,
|
|
914
|
+
commandType: "connect_telegram",
|
|
915
|
+
label: o,
|
|
916
|
+
...n ? { text: n } : {},
|
|
917
|
+
action: "connect_telegram",
|
|
918
|
+
...s ? { conversationId: s } : {},
|
|
919
|
+
scenarioRunId: a,
|
|
920
|
+
expiresAt: i,
|
|
921
|
+
presentation: "PRIMARY",
|
|
922
|
+
attention: t.attention === "NUDGE_ONCE" ? "NUDGE_ONCE" : "NONE",
|
|
923
|
+
payload: t
|
|
924
|
+
}, l = this.internalHandlers.showCta;
|
|
925
|
+
if (!l)
|
|
926
|
+
throw new h("HANDLER_UNSUPPORTED", "unsupported");
|
|
927
|
+
await l(c);
|
|
928
|
+
}
|
|
929
|
+
requireTarget(t, e) {
|
|
930
|
+
const a = t && typeof t == "object" ? t.code ?? t.id : t, i = this.requireString(a, "TARGET_INVALID");
|
|
931
|
+
if (!ne.test(i))
|
|
932
|
+
throw new h("TARGET_INVALID");
|
|
933
|
+
const o = this.uiCommands.getTarget(i);
|
|
934
|
+
if (o && !e.includes(o.kind))
|
|
935
|
+
throw new h("TARGET_INVALID");
|
|
936
|
+
return i;
|
|
937
|
+
}
|
|
938
|
+
readLipSyncDescriptor(t, e) {
|
|
939
|
+
if (t === void 0) return;
|
|
940
|
+
if (!t || typeof t != "object" || Array.isArray(t))
|
|
941
|
+
throw new h("SPEECH_AUDIO_INVALID");
|
|
942
|
+
const a = t, i = a.audio, o = a.transport;
|
|
943
|
+
if (a.contractVersion !== 1 || a.playbackId !== e || a.cueTimebase !== "milliseconds" || !i || i.encoding !== "pcm_s16le" || i.sampleRate !== 24e3 || i.channels !== 1 || !o || o.socketIoEvent !== "lip_sync.cues" || o.cableField !== "lipSyncCues")
|
|
944
|
+
throw new h("SPEECH_AUDIO_INVALID");
|
|
945
|
+
return t;
|
|
946
|
+
}
|
|
947
|
+
requireEnvelopeTarget(t, e) {
|
|
948
|
+
if (!t || typeof t != "object")
|
|
949
|
+
throw new h("TARGET_INVALID");
|
|
950
|
+
if (this.requireString(t.id, "TARGET_INVALID"), !e.includes(t.kind))
|
|
951
|
+
throw new h("TARGET_INVALID");
|
|
952
|
+
return this.requireTarget(t.code, e);
|
|
953
|
+
}
|
|
954
|
+
findTargetElement(t, e) {
|
|
955
|
+
if (e?.selector) return document.querySelector(e.selector);
|
|
956
|
+
const a = typeof CSS < "u" && CSS.escape ? CSS.escape(t) : t;
|
|
957
|
+
return document.querySelector(
|
|
958
|
+
`[data-lola="${a}"], [data-lola-action="${a}"]`
|
|
959
|
+
);
|
|
960
|
+
}
|
|
961
|
+
applyDefaultHighlight(t, e, a) {
|
|
962
|
+
this.removeDefaultHighlight(t), e.scrollIntoView({ behavior: "smooth", block: "center" }), e.setAttribute("data-lola-highlighted", "true");
|
|
963
|
+
const i = this.applyHighlightEffect(e), o = typeof a.durationMs == "number" && Number.isFinite(a.durationMs) ? Math.max(0, a.durationMs) : 0, n = o ? window.setTimeout(() => this.removeDefaultHighlight(t), o) : void 0;
|
|
964
|
+
this.highlights.set(t, {
|
|
965
|
+
element: e,
|
|
966
|
+
timer: n,
|
|
967
|
+
cleanupEffect: i
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
applyHighlightEffect(t) {
|
|
971
|
+
const e = window.getComputedStyle(t).boxShadow, a = (d, u) => [
|
|
972
|
+
`inset 0 0 0 2px ${d}`,
|
|
973
|
+
u,
|
|
974
|
+
...e && e !== "none" ? [e] : []
|
|
975
|
+
].join(", "), i = a(
|
|
976
|
+
se,
|
|
977
|
+
le
|
|
978
|
+
), o = a(
|
|
979
|
+
ce,
|
|
980
|
+
de
|
|
981
|
+
);
|
|
982
|
+
if (!(typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) && typeof t.animate == "function") {
|
|
983
|
+
const d = t.animate(
|
|
984
|
+
[
|
|
985
|
+
{ boxShadow: i },
|
|
986
|
+
{ boxShadow: o },
|
|
987
|
+
{ boxShadow: i }
|
|
988
|
+
],
|
|
989
|
+
{
|
|
990
|
+
duration: 1800,
|
|
991
|
+
easing: "ease-in-out",
|
|
992
|
+
iterations: 1 / 0
|
|
993
|
+
}
|
|
994
|
+
);
|
|
995
|
+
return () => d.cancel();
|
|
996
|
+
}
|
|
997
|
+
const s = t instanceof HTMLElement || typeof SVGElement < "u" && t instanceof SVGElement ? t.style : void 0;
|
|
998
|
+
if (!s) return () => {
|
|
999
|
+
};
|
|
1000
|
+
const c = s.getPropertyValue("box-shadow"), l = s.getPropertyPriority("box-shadow");
|
|
1001
|
+
return s.setProperty("box-shadow", i, "important"), () => {
|
|
1002
|
+
c ? s.setProperty("box-shadow", c, l) : s.removeProperty("box-shadow");
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
removeDefaultHighlight(t) {
|
|
1006
|
+
const e = this.highlights.get(t);
|
|
1007
|
+
e?.timer && window.clearTimeout(e.timer), e?.cleanupEffect(), e?.element.removeAttribute("data-lola-highlighted"), this.highlights.delete(t), this.removeTargetTracking(t);
|
|
1008
|
+
}
|
|
1009
|
+
observeTarget(t, e, a) {
|
|
1010
|
+
this.removeTargetObservation(t);
|
|
1011
|
+
const i = this.scenarioInteractions?.observeHighlightedTarget({
|
|
1012
|
+
element: e,
|
|
1013
|
+
commandId: a
|
|
1014
|
+
});
|
|
1015
|
+
i && this.targetObservationCleanups.set(t, i);
|
|
1016
|
+
}
|
|
1017
|
+
createTargetActivationReporter(t, e) {
|
|
1018
|
+
this.targetActivationOwners.set(t, e);
|
|
1019
|
+
const a = this.scenarioInteractions?.getSurfaceEpisodeId() ?? null;
|
|
1020
|
+
let i = !1;
|
|
1021
|
+
return () => {
|
|
1022
|
+
i || this.targetActivationOwners.get(t) !== e || (i = !0, this.scenarioInteractions?.recordTargetActivation(
|
|
1023
|
+
e,
|
|
1024
|
+
a
|
|
1025
|
+
));
|
|
1026
|
+
};
|
|
1027
|
+
}
|
|
1028
|
+
removeTargetObservation(t) {
|
|
1029
|
+
this.targetObservationCleanups.get(t)?.(), this.targetObservationCleanups.delete(t);
|
|
1030
|
+
}
|
|
1031
|
+
removeTargetTracking(t) {
|
|
1032
|
+
this.removeTargetObservation(t), this.targetActivationOwners.delete(t);
|
|
1033
|
+
}
|
|
1034
|
+
async deactivateCustomHighlight(t) {
|
|
1035
|
+
const e = this.activeCustomHighlights.get(t);
|
|
1036
|
+
e && (this.removeTargetTracking(t), await this.invokeCustomHighlight(
|
|
1037
|
+
e,
|
|
1038
|
+
!1,
|
|
1039
|
+
"remove_highlight",
|
|
1040
|
+
() => {
|
|
1041
|
+
}
|
|
1042
|
+
), this.activeCustomHighlights.get(t) === e && this.activeCustomHighlights.delete(t));
|
|
1043
|
+
}
|
|
1044
|
+
async removeCustomHighlightForCommand(t, e) {
|
|
1045
|
+
const a = this.activeCustomHighlights.get(t);
|
|
1046
|
+
a && (this.removeTargetTracking(t), await this.invokeCustomHighlight(
|
|
1047
|
+
e,
|
|
1048
|
+
!1,
|
|
1049
|
+
"remove_highlight",
|
|
1050
|
+
() => {
|
|
1051
|
+
}
|
|
1052
|
+
), this.activeCustomHighlights.get(t) === a && this.activeCustomHighlights.delete(t));
|
|
1053
|
+
}
|
|
1054
|
+
invokeCustomHighlight(t, e, a, i) {
|
|
1055
|
+
return t.handler({
|
|
1056
|
+
commandId: t.commandId,
|
|
1057
|
+
commandType: a,
|
|
1058
|
+
target: t.target,
|
|
1059
|
+
payload: t.payload,
|
|
1060
|
+
active: e,
|
|
1061
|
+
...t.element ? { element: t.element } : {},
|
|
1062
|
+
reportActivation: i
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
queueCustomHighlightCleanup(t, e) {
|
|
1066
|
+
const i = (this.targetHighlightOperations.get(t) ?? Promise.resolve()).catch(() => {
|
|
1067
|
+
}).then(async () => {
|
|
1068
|
+
try {
|
|
1069
|
+
await this.invokeCustomHighlight(
|
|
1070
|
+
e,
|
|
1071
|
+
!1,
|
|
1072
|
+
"remove_highlight",
|
|
1073
|
+
() => {
|
|
1074
|
+
}
|
|
1075
|
+
);
|
|
1076
|
+
} catch (o) {
|
|
1077
|
+
f.warn("Custom highlight cleanup failed", o);
|
|
1078
|
+
}
|
|
1079
|
+
});
|
|
1080
|
+
this.targetHighlightOperations.set(t, i), i.finally(() => {
|
|
1081
|
+
this.targetHighlightOperations.get(t) === i && this.targetHighlightOperations.delete(t);
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
clearCustomHighlights() {
|
|
1085
|
+
for (const [t, e] of this.activeCustomHighlights)
|
|
1086
|
+
this.activeCustomHighlights.delete(t), this.removeTargetTracking(t), this.queueCustomHighlightCleanup(t, e);
|
|
1087
|
+
}
|
|
1088
|
+
requireInternal(t) {
|
|
1089
|
+
const e = this.internalHandlers[t];
|
|
1090
|
+
if (!e)
|
|
1091
|
+
throw new h("HANDLER_UNSUPPORTED", "unsupported");
|
|
1092
|
+
return e;
|
|
1093
|
+
}
|
|
1094
|
+
requireString(t, e, a) {
|
|
1095
|
+
const i = typeof t == "string" ? t.trim() : "";
|
|
1096
|
+
if (typeof t != "string" || !i || a !== void 0 && [...i].length > a)
|
|
1097
|
+
throw new h(e);
|
|
1098
|
+
return i;
|
|
1099
|
+
}
|
|
1100
|
+
firstDefined(...t) {
|
|
1101
|
+
return t.find((e) => e != null);
|
|
1102
|
+
}
|
|
1103
|
+
async finish(t, e, a, i, o = this.principalGeneration) {
|
|
1104
|
+
this.isCurrentPrincipal(o) && (B.has(t.status) && (this.completed.set(t.commandId, {
|
|
1105
|
+
...t,
|
|
1106
|
+
storedUntil: Date.now() + re
|
|
1107
|
+
}), this.saveCompleted(e)), this.onStatus?.({ ...t, commandType: i }), await a(t));
|
|
1108
|
+
}
|
|
1109
|
+
ensurePrincipal(t, e) {
|
|
1110
|
+
if (this.principalSessionId === null)
|
|
1111
|
+
return this.principalSessionId = t.interactionSessionId, this.principalGeneration;
|
|
1112
|
+
if (this.principalSessionId !== t.interactionSessionId) {
|
|
1113
|
+
if (!e) return null;
|
|
1114
|
+
this.resetPrincipalState(), this.principalSessionId = t.interactionSessionId;
|
|
1115
|
+
}
|
|
1116
|
+
return this.principalGeneration;
|
|
1117
|
+
}
|
|
1118
|
+
resetPrincipalState() {
|
|
1119
|
+
this.principalGeneration += 1, this.clearCustomHighlights();
|
|
1120
|
+
for (const t of [...this.highlights.keys()])
|
|
1121
|
+
this.removeDefaultHighlight(t);
|
|
1122
|
+
for (const t of this.targetObservationCleanups.values()) t();
|
|
1123
|
+
this.targetObservationCleanups.clear(), this.targetActivationOwners.clear(), this.completed.clear(), this.inFlight.clear(), this.completedCtaActions.clear(), this.terminalCtaActions.clear(), this.ctaActionRetentionOrder.clear(), this.inFlightCtaActions.clear();
|
|
1124
|
+
}
|
|
1125
|
+
isCurrentPrincipal(t) {
|
|
1126
|
+
return t === this.principalGeneration;
|
|
1127
|
+
}
|
|
1128
|
+
storageKey(t) {
|
|
1129
|
+
return `bridge-lola-command-dedup:${t.interactionSessionId}`;
|
|
1130
|
+
}
|
|
1131
|
+
loadCompleted(t) {
|
|
1132
|
+
try {
|
|
1133
|
+
const e = window.sessionStorage.getItem(this.storageKey(t)), a = e ? JSON.parse(e) : [];
|
|
1134
|
+
for (const i of a)
|
|
1135
|
+
i.storedUntil > Date.now() && B.has(i.status) && this.completed.set(i.commandId, i);
|
|
1136
|
+
} catch {
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
saveCompleted(t) {
|
|
1140
|
+
const e = [...this.completed.values()].filter(
|
|
1141
|
+
(a) => a.storedUntil > Date.now()
|
|
1142
|
+
);
|
|
1143
|
+
try {
|
|
1144
|
+
window.sessionStorage.setItem(
|
|
1145
|
+
this.storageKey(t),
|
|
1146
|
+
JSON.stringify(e)
|
|
1147
|
+
);
|
|
1148
|
+
} catch {
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
toAck(t) {
|
|
1152
|
+
return {
|
|
1153
|
+
commandId: t.commandId,
|
|
1154
|
+
status: t.status,
|
|
1155
|
+
errorCode: t.errorCode,
|
|
1156
|
+
details: t.details
|
|
1157
|
+
};
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
const pt = (r) => r.replace(/\/$/, ""), M = pt(
|
|
1161
|
+
"https://api.retenive.com/api/v1"
|
|
1162
|
+
), pe = "wss://api.retenive.com/cable", ue = pt(
|
|
1163
|
+
"https://cdn.qucdtech.com/3d-assistant/docs"
|
|
1164
|
+
), Ua = (r) => {
|
|
1165
|
+
const t = new URL(pe);
|
|
1166
|
+
return t.searchParams.set("access_token", r), t.toString();
|
|
1167
|
+
}, ut = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu, ft = () => {
|
|
1168
|
+
try {
|
|
1169
|
+
if (typeof globalThis.crypto?.randomUUID == "function")
|
|
1170
|
+
return globalThis.crypto.randomUUID();
|
|
1171
|
+
} catch {
|
|
1172
|
+
}
|
|
1173
|
+
if (typeof globalThis.crypto?.getRandomValues != "function")
|
|
1174
|
+
throw new Error("Secure UUID generation is unavailable");
|
|
1175
|
+
const r = globalThis.crypto.getRandomValues(new Uint8Array(16));
|
|
1176
|
+
r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128;
|
|
1177
|
+
const t = [...r].map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
1178
|
+
return `${t.slice(0, 8)}-${t.slice(8, 12)}-${t.slice(12, 16)}-${t.slice(16, 20)}-${t.slice(20)}`;
|
|
1179
|
+
};
|
|
1180
|
+
class fe {
|
|
1181
|
+
constructor(t, e, a) {
|
|
1182
|
+
this.getSession = t, this.onSessionExpired = e, this.clientEnvironment = a;
|
|
1183
|
+
}
|
|
1184
|
+
destroyed = !1;
|
|
1185
|
+
async track(t) {
|
|
1186
|
+
try {
|
|
1187
|
+
if (this.destroyed) return;
|
|
1188
|
+
if (!t || typeof t.event != "string" || !t.event.trim())
|
|
1189
|
+
throw new TypeError("Event tracking requires a non-empty event name");
|
|
1190
|
+
const { event: e, params: a = {} } = t;
|
|
1191
|
+
if (typeof a != "object" || a === null || Array.isArray(a))
|
|
1192
|
+
throw new TypeError("Event tracking params must be a record");
|
|
1193
|
+
const i = this.getSession();
|
|
1194
|
+
if (Date.parse(i.expiresAt) <= Date.now()) {
|
|
1195
|
+
this.onSessionExpired();
|
|
1196
|
+
return;
|
|
1197
|
+
}
|
|
1198
|
+
const o = (/* @__PURE__ */ new Date()).toISOString(), n = window.location.pathname, s = JSON.parse(
|
|
1199
|
+
JSON.stringify({
|
|
1200
|
+
eventCode: e,
|
|
1201
|
+
occurredAt: o,
|
|
1202
|
+
payload: a,
|
|
1203
|
+
context: { route: n }
|
|
1204
|
+
})
|
|
1205
|
+
);
|
|
1206
|
+
let c = null;
|
|
1207
|
+
try {
|
|
1208
|
+
c = await this.clientEnvironment.ensureForEvent(
|
|
1209
|
+
i.interactionSessionId
|
|
1210
|
+
);
|
|
1211
|
+
} catch (b) {
|
|
1212
|
+
f.debug("Client Environment attribution failed", b);
|
|
1213
|
+
}
|
|
1214
|
+
if (this.destroyed) return;
|
|
1215
|
+
const l = this.getSession(), d = l.interactionSessionId === i.interactionSessionId ? l : i;
|
|
1216
|
+
if (Date.parse(d.expiresAt) <= Date.now()) {
|
|
1217
|
+
l.interactionSessionId === i.interactionSessionId && this.onSessionExpired();
|
|
1218
|
+
return;
|
|
1219
|
+
}
|
|
1220
|
+
const u = l.interactionSessionId === i.interactionSessionId ? c : null, p = await fetch(`${M}/events/client`, {
|
|
1221
|
+
method: "POST",
|
|
1222
|
+
headers: {
|
|
1223
|
+
Authorization: `Bearer ${d.accessToken}`,
|
|
1224
|
+
"Content-Type": "application/json",
|
|
1225
|
+
"Idempotency-Key": ft()
|
|
1226
|
+
},
|
|
1227
|
+
body: JSON.stringify({
|
|
1228
|
+
...s,
|
|
1229
|
+
...u ? {
|
|
1230
|
+
clientEnvironmentObservationRef: u
|
|
1231
|
+
} : {}
|
|
1232
|
+
})
|
|
1233
|
+
}), g = this.getSession();
|
|
1234
|
+
if (p.status === 401 && g.accessToken === d.accessToken && g.interactionSessionId === d.interactionSessionId && this.onSessionExpired(), !p.ok) {
|
|
1235
|
+
const b = await p.json().catch(() => null), m = b?.error?.code || `LOLA_HTTP_${p.status}`, k = b?.error?.message || p.statusText || "Lola event request failed";
|
|
1236
|
+
throw new Error(`${m}: ${k}`);
|
|
1237
|
+
}
|
|
1238
|
+
} catch (e) {
|
|
1239
|
+
f.warn("Event tracking failed", e);
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
destroy() {
|
|
1243
|
+
this.destroyed = !0;
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
const H = 300 * 1e3;
|
|
1247
|
+
function Ha(r, t = Date.now()) {
|
|
1248
|
+
const e = Date.parse(r.expiresAt);
|
|
1249
|
+
return !Number.isFinite(e) || e <= t + H;
|
|
1250
|
+
}
|
|
1251
|
+
const mt = 1, me = [
|
|
1252
|
+
"SURFACE_STATE_CHANGED",
|
|
1253
|
+
"EXPERIENCE_PRESENTED",
|
|
1254
|
+
"EXPERIENCE_ENGAGED"
|
|
1255
|
+
], ge = [
|
|
1256
|
+
"CHAT_OPENED",
|
|
1257
|
+
"CHAT_CLOSED",
|
|
1258
|
+
"MESSAGE_PRESENTED",
|
|
1259
|
+
"CHOICE_PRESENTED",
|
|
1260
|
+
"CTA_PRESENTED",
|
|
1261
|
+
"CTA_CLICKED",
|
|
1262
|
+
"CTA_DISMISSED",
|
|
1263
|
+
"TARGET_PRESENTED",
|
|
1264
|
+
"TARGET_ACTIVATED"
|
|
1265
|
+
], be = [
|
|
1266
|
+
"USER",
|
|
1267
|
+
"SCENARIO",
|
|
1268
|
+
"HOST"
|
|
1269
|
+
], we = [
|
|
1270
|
+
"SURFACE",
|
|
1271
|
+
"MESSAGE",
|
|
1272
|
+
"CHOICE",
|
|
1273
|
+
"CTA",
|
|
1274
|
+
"TARGET"
|
|
1275
|
+
], ve = ["SUCCEEDED", "FAILED"], xe = [
|
|
1276
|
+
"USER_LAUNCHER",
|
|
1277
|
+
"USER_CLOSE_BUTTON",
|
|
1278
|
+
"HOST_SET_OPEN",
|
|
1279
|
+
"SCENARIO_COMMAND",
|
|
1280
|
+
"UNKNOWN"
|
|
1281
|
+
], ye = ["CHAT", "COMPACT_PREVIEW"], _e = "/scenario-interactions/capabilities", ke = "/scenario-interactions/batch", Ee = 160, Se = 16, Ie = 1500, Te = 1e4, Ae = 60 * 1024, Re = 2147483647, K = 60 * 6e4, Ce = 100, R = [1e3, 2e3, 5e3, 1e4, 3e4], Oe = 3e4, Ne = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i, gt = new Set(me), bt = new Set(ge), wt = new Set(be), Pe = new Set(we), De = new Set(ve), Le = new Set(xe), Ue = new Set(ye), He = /* @__PURE__ */ new Set([
|
|
1282
|
+
"ACCEPTED",
|
|
1283
|
+
"DUPLICATE",
|
|
1284
|
+
"IGNORED_NO_INTEREST",
|
|
1285
|
+
"REJECTED"
|
|
1286
|
+
]), ze = (r) => {
|
|
1287
|
+
if (r) return r;
|
|
1288
|
+
const t = globalThis.fetch;
|
|
1289
|
+
if (typeof t != "function")
|
|
1290
|
+
throw new Error(
|
|
1291
|
+
"Scenario interaction collection requires a global or injected fetch"
|
|
1292
|
+
);
|
|
1293
|
+
return t.bind(globalThis);
|
|
1294
|
+
}, Me = (r) => new TextEncoder().encode(r).length, Y = (r) => r === 408 || r === 425 || r === 429 || r >= 500, qe = (r) => {
|
|
1295
|
+
if (!r || typeof r != "object" || Array.isArray(r)) return null;
|
|
1296
|
+
const t = r;
|
|
1297
|
+
return t.version !== mt || !Number.isSafeInteger(t.maxBatchItems) || t.maxBatchItems < 1 || !Number.isSafeInteger(t.maxRequestBytes) || t.maxRequestBytes < 1 || !Number.isSafeInteger(t.sessionHourlyLimit) || t.sessionHourlyLimit < 1 || !Number.isSafeInteger(t.retentionDays) || t.retentionDays < 1 || !Array.isArray(t.kinds) || !t.kinds.every((e) => typeof e == "string") || !Array.isArray(t.types) || !t.types.every((e) => typeof e == "string") || !Array.isArray(t.actors) || !t.actors.every((e) => typeof e == "string") || typeof t.attributionHandleSupported != "boolean" ? null : {
|
|
1298
|
+
version: t.version,
|
|
1299
|
+
maxBatchItems: t.maxBatchItems,
|
|
1300
|
+
maxRequestBytes: t.maxRequestBytes,
|
|
1301
|
+
sessionHourlyLimit: t.sessionHourlyLimit,
|
|
1302
|
+
retentionDays: t.retentionDays,
|
|
1303
|
+
kinds: t.kinds.filter((e) => gt.has(e)),
|
|
1304
|
+
types: t.types.filter((e) => bt.has(e)),
|
|
1305
|
+
actors: t.actors.filter((e) => wt.has(e)),
|
|
1306
|
+
attributionHandleSupported: t.attributionHandleSupported
|
|
1307
|
+
};
|
|
1308
|
+
}, je = (r) => {
|
|
1309
|
+
if (!r || typeof r != "object" || Array.isArray(r)) return null;
|
|
1310
|
+
const t = r.receipts;
|
|
1311
|
+
if (!Array.isArray(t)) return null;
|
|
1312
|
+
for (const e of t)
|
|
1313
|
+
if (!e || typeof e != "object" || typeof e.clientObservationId != "string" || !e.clientObservationId.length || e.clientObservationId.length > 128 || !He.has(e.status))
|
|
1314
|
+
return null;
|
|
1315
|
+
return t;
|
|
1316
|
+
};
|
|
1317
|
+
class Ve {
|
|
1318
|
+
constructor(t, e, a = {}) {
|
|
1319
|
+
this.getSession = t, this.onSessionExpired = e, this.baseUrl = a.baseUrl ?? M, this.queueLimit = a.queueLimit ?? Ee, this.batchLimit = a.batchLimit ?? Se, this.flushIntervalMs = a.flushIntervalMs ?? Ie, this.requestTimeoutMs = Math.max(
|
|
1320
|
+
1,
|
|
1321
|
+
a.requestTimeoutMs ?? Te
|
|
1322
|
+
), this.fetchImpl = ze(a.fetch), this.createId = a.createId ?? (() => crypto.randomUUID()), this.now = a.now ?? Date.now, this.random = a.random ?? Math.random;
|
|
1323
|
+
const i = t();
|
|
1324
|
+
this.principalSessionId = i.interactionSessionId, this.principalAccessToken = i.accessToken, this.principalExpiresAt = i.expiresAt, this.admissionWindowStartedAt = this.now();
|
|
1325
|
+
}
|
|
1326
|
+
queue = [];
|
|
1327
|
+
baseUrl;
|
|
1328
|
+
queueLimit;
|
|
1329
|
+
batchLimit;
|
|
1330
|
+
flushIntervalMs;
|
|
1331
|
+
requestTimeoutMs;
|
|
1332
|
+
fetchImpl;
|
|
1333
|
+
createId;
|
|
1334
|
+
now;
|
|
1335
|
+
random;
|
|
1336
|
+
sequence = 0;
|
|
1337
|
+
capabilities;
|
|
1338
|
+
capabilityRequest = null;
|
|
1339
|
+
flushRequest = null;
|
|
1340
|
+
capabilityRequestControl = null;
|
|
1341
|
+
batchRequestControl = null;
|
|
1342
|
+
batchRequestUsesKeepalive = !1;
|
|
1343
|
+
flushTimer;
|
|
1344
|
+
retryTimer;
|
|
1345
|
+
capabilityRetryTimer;
|
|
1346
|
+
retryAttempt = 0;
|
|
1347
|
+
capabilityRetryAttempt = 0;
|
|
1348
|
+
batchRetriesSuspended = !1;
|
|
1349
|
+
capabilityRetriesSuspended = !1;
|
|
1350
|
+
nextUserRecoveryProbeAt = 0;
|
|
1351
|
+
awaitingRenewalToken = null;
|
|
1352
|
+
sessionGeneration = 0;
|
|
1353
|
+
quotaBlockedUntil = 0;
|
|
1354
|
+
admissionWindowStartedAt;
|
|
1355
|
+
admissionCount = 0;
|
|
1356
|
+
started = !1;
|
|
1357
|
+
destroyed = !1;
|
|
1358
|
+
principalSessionId;
|
|
1359
|
+
principalAccessToken;
|
|
1360
|
+
principalExpiresAt;
|
|
1361
|
+
start() {
|
|
1362
|
+
this.started || this.destroyed || (this.started = !0, window.addEventListener("online", this.onOnlineOrFocus), window.addEventListener("focus", this.onOnlineOrFocus), window.addEventListener("pagehide", this.onPageHide), document.addEventListener("visibilitychange", this.onVisibilityChange), this.ensureCapabilities());
|
|
1363
|
+
}
|
|
1364
|
+
destroy() {
|
|
1365
|
+
this.destroyed = !0, this.started = !1, this.abortPendingRequests(), this.clearTimers(), window.removeEventListener("online", this.onOnlineOrFocus), window.removeEventListener("focus", this.onOnlineOrFocus), window.removeEventListener("pagehide", this.onPageHide), document.removeEventListener("visibilitychange", this.onVisibilityChange), this.queue.length = 0;
|
|
1366
|
+
}
|
|
1367
|
+
updateSession(t) {
|
|
1368
|
+
if (t.interactionSessionId !== this.principalSessionId)
|
|
1369
|
+
return this.principalSessionId = t.interactionSessionId, this.principalAccessToken = t.accessToken, this.principalExpiresAt = t.expiresAt, this.queue.length = 0, this.sequence = 0, this.capabilities = void 0, this.sessionGeneration += 1, this.abortPendingRequests(), this.awaitingRenewalToken = null, this.resetRecoveryState(), this.quotaBlockedUntil = 0, this.admissionWindowStartedAt = this.now(), this.admissionCount = 0, this.clearFlushTimer(), this.started && this.ensureCapabilities(), !0;
|
|
1370
|
+
if (t.accessToken !== this.principalAccessToken) {
|
|
1371
|
+
const n = this.capabilities;
|
|
1372
|
+
return this.principalAccessToken = t.accessToken, this.principalExpiresAt = t.expiresAt, this.sessionGeneration += 1, this.abortPendingRequests(), this.awaitingRenewalToken = null, this.resetRecoveryState(), this.clearFlushTimer(), n ? (this.capabilities = n, this.started && this.scheduleFlush(0)) : (this.capabilities = void 0, this.started && this.ensureCapabilities()), !1;
|
|
1373
|
+
}
|
|
1374
|
+
const a = Date.parse(this.principalExpiresAt), i = Date.parse(t.expiresAt), o = i > a;
|
|
1375
|
+
return this.principalExpiresAt = t.expiresAt, this.awaitingRenewalToken && (t.accessToken !== this.awaitingRenewalToken || i > this.now()) && (this.awaitingRenewalToken = null, this.retryAttempt = 0, this.capabilities ? this.scheduleFlush(0) : this.ensureCapabilities()), this.started && o && i > this.now() && (this.capabilityRetryTimer !== void 0 || this.retryTimer !== void 0 || this.capabilityRetriesSuspended || this.batchRetriesSuspended) && this.resumeAfterStrongSignal(), !1;
|
|
1376
|
+
}
|
|
1377
|
+
enqueue(t) {
|
|
1378
|
+
if (this.destroyed || this.capabilities === null || typeof t.kind != "string" || !gt.has(t.kind) || typeof t.type != "string" || !bt.has(t.type) || typeof t.actor != "string" || !wt.has(t.actor))
|
|
1379
|
+
return null;
|
|
1380
|
+
const e = this.nextSequence();
|
|
1381
|
+
if (e === null)
|
|
1382
|
+
return f.warn(
|
|
1383
|
+
"Scenario interaction sequence is exhausted; observation dropped"
|
|
1384
|
+
), null;
|
|
1385
|
+
const a = this.buildObservation(t, e);
|
|
1386
|
+
if (this.capabilities && !this.isSupported(a, this.capabilities))
|
|
1387
|
+
return null;
|
|
1388
|
+
this.capabilities && !this.capabilities.attributionHandleSupported && delete a.attributionHandle;
|
|
1389
|
+
const i = a.kind !== "SURFACE_STATE_CHANGED" || a.type === "CHAT_CLOSED" && !!a.attributionHandle;
|
|
1390
|
+
let o = -1;
|
|
1391
|
+
if (this.queue.length >= this.queueLimit) {
|
|
1392
|
+
if (!i) return null;
|
|
1393
|
+
if (o = this.queue.findIndex(
|
|
1394
|
+
(n) => !n.protectedFromRoutineEviction
|
|
1395
|
+
), o < 0)
|
|
1396
|
+
return f.warn("Scenario interaction queue is full; observation dropped"), null;
|
|
1397
|
+
}
|
|
1398
|
+
return this.capabilities && !this.admitWithinSessionQuota(this.capabilities) ? null : (o >= 0 && this.queue.splice(o, 1), this.queue.push({ observation: a, protectedFromRoutineEviction: i }), this.probeAfterUserObservation(a), this.capabilities ? this.scheduleFlush() : this.started && !this.capabilityRetriesSuspended && this.ensureCapabilities(), a.clientObservationId);
|
|
1399
|
+
}
|
|
1400
|
+
getQueueSnapshot() {
|
|
1401
|
+
return this.queue.map(({ observation: t }) => t);
|
|
1402
|
+
}
|
|
1403
|
+
isSendingEnabled() {
|
|
1404
|
+
return !!this.capabilities;
|
|
1405
|
+
}
|
|
1406
|
+
getPrincipalSessionId() {
|
|
1407
|
+
return this.principalSessionId;
|
|
1408
|
+
}
|
|
1409
|
+
async flush(t = {}) {
|
|
1410
|
+
if (this.destroyed || this.batchRetriesSuspended) return;
|
|
1411
|
+
this.clearRetryTimer();
|
|
1412
|
+
const e = !!t.keepalive;
|
|
1413
|
+
if (this.flushRequest) {
|
|
1414
|
+
if (!e || this.batchRequestUsesKeepalive)
|
|
1415
|
+
return this.flushRequest;
|
|
1416
|
+
this.batchRequestControl?.controller.abort(), this.flushRequest = null;
|
|
1417
|
+
}
|
|
1418
|
+
const a = this.sessionGeneration, i = this.createRequestControl();
|
|
1419
|
+
this.batchRequestControl = i, this.batchRequestUsesKeepalive = e;
|
|
1420
|
+
const o = this.flushOnce(e, a, i).finally(
|
|
1421
|
+
() => {
|
|
1422
|
+
this.finishRequestControl(i), this.flushRequest === o && (this.flushRequest = null), this.batchRequestControl === i && (this.batchRequestControl = null, this.batchRequestUsesKeepalive = !1);
|
|
1423
|
+
}
|
|
1424
|
+
);
|
|
1425
|
+
return this.flushRequest = o, o;
|
|
1426
|
+
}
|
|
1427
|
+
onOnlineOrFocus = () => {
|
|
1428
|
+
this.resumeAfterStrongSignal();
|
|
1429
|
+
};
|
|
1430
|
+
resumeAfterStrongSignal() {
|
|
1431
|
+
this.destroyed || (this.resetRecoveryState(), this.capabilities === void 0 ? this.ensureCapabilities() : this.capabilities && this.scheduleFlush(0));
|
|
1432
|
+
}
|
|
1433
|
+
probeAfterUserObservation(t) {
|
|
1434
|
+
if (!this.started || t.actor !== "USER" || !this.capabilityRetriesSuspended && !this.batchRetriesSuspended)
|
|
1435
|
+
return;
|
|
1436
|
+
const e = this.now();
|
|
1437
|
+
if (!(e < this.nextUserRecoveryProbeAt)) {
|
|
1438
|
+
if (this.nextUserRecoveryProbeAt = e + Oe, this.capabilityRetriesSuspended && this.capabilities === void 0) {
|
|
1439
|
+
this.capabilityRetriesSuspended = !1, this.ensureCapabilities();
|
|
1440
|
+
return;
|
|
1441
|
+
}
|
|
1442
|
+
this.batchRetriesSuspended && this.capabilities && (this.batchRetriesSuspended = !1, this.scheduleFlush(0));
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
onVisibilityChange = () => {
|
|
1446
|
+
document.visibilityState === "hidden" ? this.flush({ keepalive: !0 }) : document.visibilityState === "visible" && this.resumeAfterStrongSignal();
|
|
1447
|
+
};
|
|
1448
|
+
onPageHide = () => {
|
|
1449
|
+
this.flush({ keepalive: !0 });
|
|
1450
|
+
};
|
|
1451
|
+
buildObservation(t, e) {
|
|
1452
|
+
const a = t.attributionHandle && Ne.test(t.attributionHandle) ? t.attributionHandle : void 0;
|
|
1453
|
+
return {
|
|
1454
|
+
clientObservationId: this.createId().slice(0, 128),
|
|
1455
|
+
version: mt,
|
|
1456
|
+
kind: t.kind,
|
|
1457
|
+
type: t.type,
|
|
1458
|
+
actor: t.actor,
|
|
1459
|
+
occurredAt: new Date(this.now()).toISOString(),
|
|
1460
|
+
sequence: e,
|
|
1461
|
+
...typeof t.surfaceEpisodeId == "string" && t.surfaceEpisodeId ? { surfaceEpisodeId: t.surfaceEpisodeId.slice(0, 128) } : {},
|
|
1462
|
+
...typeof t.subjectKind == "string" && Pe.has(t.subjectKind) && typeof t.subjectId == "string" && t.subjectId ? {
|
|
1463
|
+
subjectKind: t.subjectKind,
|
|
1464
|
+
subjectId: t.subjectId.slice(0, 255)
|
|
1465
|
+
} : {},
|
|
1466
|
+
...typeof t.result == "string" && De.has(t.result) ? { result: t.result } : {},
|
|
1467
|
+
...typeof t.reason == "string" && Le.has(t.reason) ? { reason: t.reason } : {},
|
|
1468
|
+
...a ? { attributionHandle: a } : {},
|
|
1469
|
+
...this.buildDetails(t)
|
|
1470
|
+
};
|
|
1471
|
+
}
|
|
1472
|
+
buildDetails(t) {
|
|
1473
|
+
if (!t.details) return {};
|
|
1474
|
+
const e = {};
|
|
1475
|
+
return typeof t.details.surface == "string" && Ue.has(t.details.surface) && (e.surface = t.details.surface), Number.isSafeInteger(t.details.presentationOrdinal) && t.details.presentationOrdinal >= 0 && t.details.presentationOrdinal <= 1e4 && (e.presentationOrdinal = t.details.presentationOrdinal), Object.keys(e).length ? { details: e } : {};
|
|
1476
|
+
}
|
|
1477
|
+
async ensureCapabilities() {
|
|
1478
|
+
if (this.destroyed || this.capabilityRetriesSuspended || this.capabilityRetryTimer !== void 0 || this.capabilities !== void 0 || this.capabilityRequest)
|
|
1479
|
+
return this.capabilityRequest ?? Promise.resolve();
|
|
1480
|
+
this.clearCapabilityRetryTimer();
|
|
1481
|
+
const t = this.sessionGeneration, e = this.createRequestControl();
|
|
1482
|
+
this.capabilityRequestControl = e;
|
|
1483
|
+
const a = this.loadCapabilities(t, e).finally(() => {
|
|
1484
|
+
this.finishRequestControl(e), this.capabilityRequest === a && (this.capabilityRequest = null), this.capabilityRequestControl === e && (this.capabilityRequestControl = null), !this.destroyed && t !== this.sessionGeneration && this.capabilities === void 0 && this.ensureCapabilities();
|
|
1485
|
+
});
|
|
1486
|
+
return this.capabilityRequest = a, a;
|
|
1487
|
+
}
|
|
1488
|
+
async loadCapabilities(t, e) {
|
|
1489
|
+
const { signal: a } = e.controller, i = this.getSession();
|
|
1490
|
+
if (!this.sessionNeedsRenewal(i))
|
|
1491
|
+
try {
|
|
1492
|
+
const o = await this.fetchImpl(
|
|
1493
|
+
`${this.baseUrl}${_e}`,
|
|
1494
|
+
{
|
|
1495
|
+
// A conditional 304 has no JSON body and cannot negotiate the
|
|
1496
|
+
// collector contract. Always request a complete representation.
|
|
1497
|
+
cache: "no-store",
|
|
1498
|
+
headers: { Authorization: `Bearer ${i.accessToken}` },
|
|
1499
|
+
signal: a
|
|
1500
|
+
}
|
|
1501
|
+
);
|
|
1502
|
+
if (!this.isCurrentGeneration(t) || a.aborted) return;
|
|
1503
|
+
if (o.status === 401) {
|
|
1504
|
+
this.handleUnauthorized(i);
|
|
1505
|
+
return;
|
|
1506
|
+
}
|
|
1507
|
+
if (!o.ok) {
|
|
1508
|
+
o.status === 304 || Y(o.status) ? (this.capabilities = void 0, this.scheduleCapabilityRetry()) : this.disableSending(
|
|
1509
|
+
`Scenario interaction capability request was rejected with ${o.status}`
|
|
1510
|
+
);
|
|
1511
|
+
return;
|
|
1512
|
+
}
|
|
1513
|
+
const n = qe(await o.json());
|
|
1514
|
+
if (!this.isCurrentGeneration(t) || a.aborted) return;
|
|
1515
|
+
if (!n) {
|
|
1516
|
+
this.disableSending("Scenario interaction capabilities are invalid");
|
|
1517
|
+
return;
|
|
1518
|
+
}
|
|
1519
|
+
this.capabilities = n, this.resetCapabilityRecoveryState(), this.nextUserRecoveryProbeAt = 0, this.dropUnsupportedObservations(n), this.admissionCount = Math.max(this.admissionCount, this.queue.length), this.queue.length && this.scheduleFlush(0);
|
|
1520
|
+
} catch (o) {
|
|
1521
|
+
if (!this.isCurrentGeneration(t) || a.aborted && !e.timedOut)
|
|
1522
|
+
return;
|
|
1523
|
+
this.capabilities = void 0, this.scheduleCapabilityRetry(), f.debug("Scenario interaction capability request failed", o);
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
async flushOnce(t, e, a) {
|
|
1527
|
+
const { signal: i } = a.controller;
|
|
1528
|
+
this.clearFlushTimer();
|
|
1529
|
+
const o = this.capabilities;
|
|
1530
|
+
if (this.isQuotaBlocked()) {
|
|
1531
|
+
this.scheduleFlush(this.quotaBlockedUntil - this.now());
|
|
1532
|
+
return;
|
|
1533
|
+
}
|
|
1534
|
+
if (this.destroyed || !o || !this.queue.length || this.awaitingRenewalToken || typeof navigator < "u" && !navigator.onLine)
|
|
1535
|
+
return;
|
|
1536
|
+
const n = this.getSession();
|
|
1537
|
+
if (n.interactionSessionId !== this.principalSessionId) {
|
|
1538
|
+
this.updateSession(n);
|
|
1539
|
+
return;
|
|
1540
|
+
}
|
|
1541
|
+
if (this.sessionNeedsRenewal(n)) return;
|
|
1542
|
+
const s = this.selectBatch(o, t);
|
|
1543
|
+
if (!s.length) return;
|
|
1544
|
+
const c = JSON.stringify({
|
|
1545
|
+
items: s.map(({ observation: l }) => l)
|
|
1546
|
+
});
|
|
1547
|
+
try {
|
|
1548
|
+
const l = await this.fetchImpl(`${this.baseUrl}${ke}`, {
|
|
1549
|
+
method: "POST",
|
|
1550
|
+
headers: {
|
|
1551
|
+
Authorization: `Bearer ${n.accessToken}`,
|
|
1552
|
+
"Content-Type": "application/json"
|
|
1553
|
+
},
|
|
1554
|
+
body: c,
|
|
1555
|
+
signal: i,
|
|
1556
|
+
...t ? { keepalive: !0 } : {}
|
|
1557
|
+
});
|
|
1558
|
+
if (!this.isCurrentGeneration(e) || i.aborted) return;
|
|
1559
|
+
if (l.status === 401) {
|
|
1560
|
+
this.handleUnauthorized(n);
|
|
1561
|
+
return;
|
|
1562
|
+
}
|
|
1563
|
+
if (!l.ok) {
|
|
1564
|
+
Y(l.status) ? this.scheduleRetry() : this.disableSending(
|
|
1565
|
+
`Scenario interaction batch was rejected with ${l.status}`
|
|
1566
|
+
);
|
|
1567
|
+
return;
|
|
1568
|
+
}
|
|
1569
|
+
const d = je(await l.json());
|
|
1570
|
+
if (!this.isCurrentGeneration(e) || i.aborted) return;
|
|
1571
|
+
if (!d) {
|
|
1572
|
+
this.scheduleRetry();
|
|
1573
|
+
return;
|
|
1574
|
+
}
|
|
1575
|
+
const u = new Set(
|
|
1576
|
+
s.map(({ observation: m }) => m.clientObservationId)
|
|
1577
|
+
), p = new Set(
|
|
1578
|
+
d.filter((m) => u.has(m.clientObservationId)).map((m) => m.clientObservationId)
|
|
1579
|
+
), g = d.some(
|
|
1580
|
+
(m) => u.has(m.clientObservationId) && m.status === "REJECTED" && m.code === "SESSION_HOURLY_QUOTA_EXCEEDED"
|
|
1581
|
+
);
|
|
1582
|
+
if (p.size)
|
|
1583
|
+
for (let m = this.queue.length - 1; m >= 0; m -= 1)
|
|
1584
|
+
p.has(
|
|
1585
|
+
this.queue[m].observation.clientObservationId
|
|
1586
|
+
) && this.queue.splice(m, 1);
|
|
1587
|
+
this.resetBatchRecoveryState(), this.nextUserRecoveryProbeAt = 0, g && (this.quotaBlockedUntil = this.now() + K), s.some(
|
|
1588
|
+
({ observation: m }) => !p.has(m.clientObservationId)
|
|
1589
|
+
) ? this.scheduleRetry() : this.queue.length && this.scheduleFlush(Ce);
|
|
1590
|
+
} catch (l) {
|
|
1591
|
+
if (!this.isCurrentGeneration(e) || i.aborted && !a.timedOut)
|
|
1592
|
+
return;
|
|
1593
|
+
this.scheduleRetry(), f.debug("Scenario interaction batch request failed", l);
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
selectBatch(t, e) {
|
|
1597
|
+
const a = Math.max(
|
|
1598
|
+
1,
|
|
1599
|
+
Math.min(this.batchLimit, t.maxBatchItems)
|
|
1600
|
+
), i = Math.min(
|
|
1601
|
+
t.maxRequestBytes,
|
|
1602
|
+
e ? Ae : t.maxRequestBytes
|
|
1603
|
+
);
|
|
1604
|
+
for (; this.queue.length; ) {
|
|
1605
|
+
const o = this.queue.slice(0, a);
|
|
1606
|
+
for (; o.length && Me(
|
|
1607
|
+
JSON.stringify({
|
|
1608
|
+
items: o.map(({ observation: n }) => n)
|
|
1609
|
+
})
|
|
1610
|
+
) > i; )
|
|
1611
|
+
o.pop();
|
|
1612
|
+
if (o.length) return o;
|
|
1613
|
+
this.queue.shift(), f.warn(
|
|
1614
|
+
"Scenario interaction observation exceeds the server request limit; observation dropped"
|
|
1615
|
+
);
|
|
1616
|
+
}
|
|
1617
|
+
return [];
|
|
1618
|
+
}
|
|
1619
|
+
dropUnsupportedObservations(t) {
|
|
1620
|
+
for (let e = this.queue.length - 1; e >= 0; e -= 1) {
|
|
1621
|
+
const a = this.queue[e].observation;
|
|
1622
|
+
this.isSupported(a, t) ? t.attributionHandleSupported || delete a.attributionHandle : this.queue.splice(e, 1);
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
isSupported(t, e) {
|
|
1626
|
+
return e.kinds.includes(t.kind) && e.types.includes(t.type) && e.actors.includes(t.actor);
|
|
1627
|
+
}
|
|
1628
|
+
sessionNeedsRenewal(t) {
|
|
1629
|
+
return Date.parse(t.expiresAt) > this.now() ? !1 : (this.awaitingRenewalToken = t.accessToken, this.onSessionExpired(), !0);
|
|
1630
|
+
}
|
|
1631
|
+
isCurrentGeneration(t) {
|
|
1632
|
+
return !this.destroyed && t === this.sessionGeneration;
|
|
1633
|
+
}
|
|
1634
|
+
nextSequence() {
|
|
1635
|
+
if (this.sequence > Re) return null;
|
|
1636
|
+
const t = this.sequence;
|
|
1637
|
+
return this.sequence += 1, t;
|
|
1638
|
+
}
|
|
1639
|
+
abortPendingRequests() {
|
|
1640
|
+
this.capabilityRequestControl?.controller.abort(), this.batchRequestControl?.controller.abort(), this.finishRequestControl(this.capabilityRequestControl), this.finishRequestControl(this.batchRequestControl), this.capabilityRequestControl = null, this.batchRequestControl = null, this.batchRequestUsesKeepalive = !1, this.capabilityRequest = null, this.flushRequest = null;
|
|
1641
|
+
}
|
|
1642
|
+
createRequestControl() {
|
|
1643
|
+
const t = {
|
|
1644
|
+
controller: new AbortController(),
|
|
1645
|
+
timedOut: !1,
|
|
1646
|
+
timeoutId: 0
|
|
1647
|
+
};
|
|
1648
|
+
return t.timeoutId = window.setTimeout(() => {
|
|
1649
|
+
t.timedOut = !0, t.controller.abort();
|
|
1650
|
+
}, this.requestTimeoutMs), t;
|
|
1651
|
+
}
|
|
1652
|
+
finishRequestControl(t) {
|
|
1653
|
+
t && window.clearTimeout(t.timeoutId);
|
|
1654
|
+
}
|
|
1655
|
+
handleUnauthorized(t) {
|
|
1656
|
+
const e = this.getSession();
|
|
1657
|
+
if (e.interactionSessionId === t.interactionSessionId && e.accessToken === t.accessToken) {
|
|
1658
|
+
this.awaitingRenewalToken = t.accessToken, this.onSessionExpired();
|
|
1659
|
+
return;
|
|
1660
|
+
}
|
|
1661
|
+
this.scheduleRetry();
|
|
1662
|
+
}
|
|
1663
|
+
scheduleFlush(t = this.flushIntervalMs) {
|
|
1664
|
+
if (this.destroyed || this.flushTimer !== void 0 || this.retryTimer !== void 0 || this.batchRetriesSuspended || this.awaitingRenewalToken)
|
|
1665
|
+
return;
|
|
1666
|
+
const e = this.isQuotaBlocked() ? Math.max(t, this.quotaBlockedUntil - this.now()) : t;
|
|
1667
|
+
this.flushTimer = window.setTimeout(() => {
|
|
1668
|
+
this.flushTimer = void 0, this.flush();
|
|
1669
|
+
}, e);
|
|
1670
|
+
}
|
|
1671
|
+
scheduleRetry() {
|
|
1672
|
+
if (this.destroyed || this.retryTimer !== void 0)
|
|
1673
|
+
return;
|
|
1674
|
+
if (this.retryAttempt >= R.length) {
|
|
1675
|
+
this.batchRetriesSuspended = !0;
|
|
1676
|
+
return;
|
|
1677
|
+
}
|
|
1678
|
+
const t = this.retryDelay(this.retryAttempt);
|
|
1679
|
+
this.retryAttempt += 1, this.retryTimer = window.setTimeout(() => {
|
|
1680
|
+
this.retryTimer = void 0, this.flush();
|
|
1681
|
+
}, t);
|
|
1682
|
+
}
|
|
1683
|
+
scheduleCapabilityRetry() {
|
|
1684
|
+
if (this.destroyed || this.capabilityRetryTimer !== void 0)
|
|
1685
|
+
return;
|
|
1686
|
+
if (this.capabilityRetryAttempt >= R.length) {
|
|
1687
|
+
this.capabilityRetriesSuspended = !0;
|
|
1688
|
+
return;
|
|
1689
|
+
}
|
|
1690
|
+
const t = this.retryDelay(this.capabilityRetryAttempt);
|
|
1691
|
+
this.capabilityRetryAttempt += 1, this.capabilityRetryTimer = window.setTimeout(() => {
|
|
1692
|
+
this.capabilityRetryTimer = void 0, this.capabilities = void 0, this.ensureCapabilities();
|
|
1693
|
+
}, t);
|
|
1694
|
+
}
|
|
1695
|
+
clearFlushTimer() {
|
|
1696
|
+
this.flushTimer !== void 0 && (window.clearTimeout(this.flushTimer), this.flushTimer = void 0);
|
|
1697
|
+
}
|
|
1698
|
+
clearTimers() {
|
|
1699
|
+
this.clearFlushTimer(), this.clearRetryTimer(), this.clearCapabilityRetryTimer();
|
|
1700
|
+
}
|
|
1701
|
+
resetRecoveryState() {
|
|
1702
|
+
this.resetBatchRecoveryState(), this.resetCapabilityRecoveryState(), this.nextUserRecoveryProbeAt = 0;
|
|
1703
|
+
}
|
|
1704
|
+
resetBatchRecoveryState() {
|
|
1705
|
+
this.clearRetryTimer(), this.retryAttempt = 0, this.batchRetriesSuspended = !1;
|
|
1706
|
+
}
|
|
1707
|
+
resetCapabilityRecoveryState() {
|
|
1708
|
+
this.clearCapabilityRetryTimer(), this.capabilityRetryAttempt = 0, this.capabilityRetriesSuspended = !1;
|
|
1709
|
+
}
|
|
1710
|
+
clearRetryTimer() {
|
|
1711
|
+
this.retryTimer !== void 0 && window.clearTimeout(this.retryTimer), this.retryTimer = void 0;
|
|
1712
|
+
}
|
|
1713
|
+
clearCapabilityRetryTimer() {
|
|
1714
|
+
this.capabilityRetryTimer !== void 0 && window.clearTimeout(this.capabilityRetryTimer), this.capabilityRetryTimer = void 0;
|
|
1715
|
+
}
|
|
1716
|
+
retryDelay(t) {
|
|
1717
|
+
const e = R[Math.min(t, R.length - 1)], a = 0.75 + Math.min(1, Math.max(0, this.random())) * 0.5;
|
|
1718
|
+
return Math.max(1, Math.round(e * a));
|
|
1719
|
+
}
|
|
1720
|
+
disableSending(t) {
|
|
1721
|
+
this.capabilities = null, this.queue.length = 0, this.nextUserRecoveryProbeAt = 0, this.clearTimers(), f.debug(t);
|
|
1722
|
+
}
|
|
1723
|
+
admitWithinSessionQuota(t) {
|
|
1724
|
+
if (this.isQuotaBlocked()) return !1;
|
|
1725
|
+
const e = this.now();
|
|
1726
|
+
return e - this.admissionWindowStartedAt >= K && (this.admissionWindowStartedAt = e, this.admissionCount = 0), this.admissionCount >= t.sessionHourlyLimit ? !1 : (this.admissionCount += 1, !0);
|
|
1727
|
+
}
|
|
1728
|
+
isQuotaBlocked() {
|
|
1729
|
+
return this.quotaBlockedUntil <= this.now() ? (this.quotaBlockedUntil = 0, !1) : !0;
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
const Ge = (r) => {
|
|
1733
|
+
switch (r.reason) {
|
|
1734
|
+
case "USER_LAUNCHER":
|
|
1735
|
+
case "USER_CLOSE_BUTTON":
|
|
1736
|
+
case "HOST_SET_OPEN":
|
|
1737
|
+
case "SCENARIO_COMMAND":
|
|
1738
|
+
return r.reason;
|
|
1739
|
+
default:
|
|
1740
|
+
return "UNKNOWN";
|
|
1741
|
+
}
|
|
1742
|
+
};
|
|
1743
|
+
class Fe {
|
|
1744
|
+
constructor(t, e = () => crypto.randomUUID()) {
|
|
1745
|
+
this.observe = t, this.createId = e;
|
|
1746
|
+
}
|
|
1747
|
+
state = "CLOSED";
|
|
1748
|
+
episode = null;
|
|
1749
|
+
transition(t, e) {
|
|
1750
|
+
const a = this.state;
|
|
1751
|
+
if (a === t)
|
|
1752
|
+
return {
|
|
1753
|
+
changed: !1,
|
|
1754
|
+
from: a,
|
|
1755
|
+
to: t,
|
|
1756
|
+
episodeId: this.episode?.id ?? null,
|
|
1757
|
+
context: e
|
|
1758
|
+
};
|
|
1759
|
+
t === "OPEN" && (this.episode = { id: this.createId(), openedBy: e });
|
|
1760
|
+
const i = this.episode;
|
|
1761
|
+
if (this.state = t, e.actor !== "SYSTEM") {
|
|
1762
|
+
const o = e.sourceCommandId ?? i?.latestScenarioHandle ?? i?.openedBy.sourceCommandId;
|
|
1763
|
+
this.observe({
|
|
1764
|
+
kind: "SURFACE_STATE_CHANGED",
|
|
1765
|
+
type: t === "OPEN" ? "CHAT_OPENED" : "CHAT_CLOSED",
|
|
1766
|
+
actor: e.actor,
|
|
1767
|
+
reason: Ge(e),
|
|
1768
|
+
...i ? { surfaceEpisodeId: i.id } : {},
|
|
1769
|
+
...o ? { attributionHandle: o } : {},
|
|
1770
|
+
subjectKind: "SURFACE",
|
|
1771
|
+
subjectId: "assistant_chat"
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
|
+
return t === "CLOSED" && (this.episode = null), {
|
|
1775
|
+
changed: !0,
|
|
1776
|
+
from: a,
|
|
1777
|
+
to: t,
|
|
1778
|
+
episodeId: t === "OPEN" ? i?.id ?? null : null,
|
|
1779
|
+
context: e
|
|
1780
|
+
};
|
|
1781
|
+
}
|
|
1782
|
+
getState() {
|
|
1783
|
+
return this.state;
|
|
1784
|
+
}
|
|
1785
|
+
getEpisodeId() {
|
|
1786
|
+
return this.episode?.id ?? null;
|
|
1787
|
+
}
|
|
1788
|
+
markScenarioContext(t) {
|
|
1789
|
+
!this.episode || this.state !== "OPEN" || (this.episode.latestScenarioHandle = t);
|
|
1790
|
+
}
|
|
1791
|
+
replacePrincipal() {
|
|
1792
|
+
if (this.state === "OPEN") {
|
|
1793
|
+
this.episode = {
|
|
1794
|
+
id: this.createId(),
|
|
1795
|
+
openedBy: { actor: "SYSTEM", reason: "SYSTEM_RESTORE" }
|
|
1796
|
+
};
|
|
1797
|
+
return;
|
|
1798
|
+
}
|
|
1799
|
+
this.episode = null;
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
const We = 0.5, Be = 500, Ke = ({
|
|
1803
|
+
element: r,
|
|
1804
|
+
isActive: t,
|
|
1805
|
+
isPresentable: e = () => !0,
|
|
1806
|
+
onPresented: a,
|
|
1807
|
+
intersectionRatio: i = We,
|
|
1808
|
+
dwellMs: o = Be
|
|
1809
|
+
}) => {
|
|
1810
|
+
if (typeof IntersectionObserver != "function") {
|
|
1811
|
+
const y = (() => {
|
|
1812
|
+
});
|
|
1813
|
+
return y.pause = () => {
|
|
1814
|
+
}, y.resume = () => {
|
|
1815
|
+
}, y.refresh = () => {
|
|
1816
|
+
}, y;
|
|
1817
|
+
}
|
|
1818
|
+
let n = 0, s = !1, c = !1, l, d = 0, u = o;
|
|
1819
|
+
const p = (y = !1) => {
|
|
1820
|
+
l !== void 0 && (window.clearTimeout(l), l = void 0, y ? u = Math.max(
|
|
1821
|
+
0,
|
|
1822
|
+
u - (Date.now() - d)
|
|
1823
|
+
) : u = o);
|
|
1824
|
+
}, g = () => !s && !c && document.visibilityState === "visible" && t() && e() && n >= i, b = () => {
|
|
1825
|
+
if (!g()) {
|
|
1826
|
+
p();
|
|
1827
|
+
return;
|
|
1828
|
+
}
|
|
1829
|
+
l === void 0 && (d = Date.now(), l = window.setTimeout(() => {
|
|
1830
|
+
l = void 0, g() && (s = !0, m.disconnect(), k.disconnect(), document.removeEventListener("visibilitychange", b), a());
|
|
1831
|
+
}, u));
|
|
1832
|
+
}, m = new IntersectionObserver(
|
|
1833
|
+
(y) => {
|
|
1834
|
+
const A = y.find(({ target: N }) => N === r);
|
|
1835
|
+
n = A?.isIntersecting ? A.intersectionRatio : 0, b();
|
|
1836
|
+
},
|
|
1837
|
+
{ threshold: [0, i, 1] }
|
|
1838
|
+
);
|
|
1839
|
+
m.observe(r);
|
|
1840
|
+
const k = new MutationObserver(b);
|
|
1841
|
+
k.observe(r, {
|
|
1842
|
+
childList: !0,
|
|
1843
|
+
characterData: !0,
|
|
1844
|
+
subtree: !0
|
|
1845
|
+
}), document.addEventListener("visibilitychange", b);
|
|
1846
|
+
const x = (() => {
|
|
1847
|
+
s = !0, p(), m.disconnect(), k.disconnect(), document.removeEventListener("visibilitychange", b);
|
|
1848
|
+
});
|
|
1849
|
+
return x.pause = () => {
|
|
1850
|
+
c || s || (c = !0, p(!0));
|
|
1851
|
+
}, x.resume = () => {
|
|
1852
|
+
!c || s || (c = !1, b());
|
|
1853
|
+
}, x.refresh = b, x;
|
|
1854
|
+
};
|
|
1855
|
+
class Ye {
|
|
1856
|
+
collector;
|
|
1857
|
+
surfaceController;
|
|
1858
|
+
compactSurfaceEpisode = null;
|
|
1859
|
+
presented = /* @__PURE__ */ new Set();
|
|
1860
|
+
engaged = /* @__PURE__ */ new Set();
|
|
1861
|
+
constructor(t, e, a) {
|
|
1862
|
+
this.collector = new Ve(
|
|
1863
|
+
t,
|
|
1864
|
+
e,
|
|
1865
|
+
a
|
|
1866
|
+
), this.surfaceController = new Fe((i) => {
|
|
1867
|
+
this.collector.enqueue(i);
|
|
1868
|
+
});
|
|
1869
|
+
}
|
|
1870
|
+
start() {
|
|
1871
|
+
this.collector.start();
|
|
1872
|
+
}
|
|
1873
|
+
destroy() {
|
|
1874
|
+
this.collector.destroy(), this.compactSurfaceEpisode = null, this.presented.clear(), this.engaged.clear();
|
|
1875
|
+
}
|
|
1876
|
+
updateSession(t) {
|
|
1877
|
+
this.collector.updateSession(t) && (this.compactSurfaceEpisode = null, this.presented.clear(), this.engaged.clear(), this.surfaceController.replacePrincipal());
|
|
1878
|
+
}
|
|
1879
|
+
transitionSurface(t, e) {
|
|
1880
|
+
const a = this.getSurfaceEpisodeId(), i = this.surfaceController.transition(t, e);
|
|
1881
|
+
return i.changed && a !== this.getSurfaceEpisodeId() && (this.presented.clear(), this.engaged.clear()), i;
|
|
1882
|
+
}
|
|
1883
|
+
getSurfaceState() {
|
|
1884
|
+
return this.surfaceController.getState();
|
|
1885
|
+
}
|
|
1886
|
+
getSurfaceEpisodeId() {
|
|
1887
|
+
return this.surfaceController.getEpisodeId();
|
|
1888
|
+
}
|
|
1889
|
+
openCompactSurfaceEpisode(t) {
|
|
1890
|
+
return (!this.compactSurfaceEpisode || t && this.compactSurfaceEpisode.id !== t) && (this.compactSurfaceEpisode = {
|
|
1891
|
+
id: t ?? crypto.randomUUID(),
|
|
1892
|
+
presented: /* @__PURE__ */ new Set(),
|
|
1893
|
+
engaged: /* @__PURE__ */ new Set()
|
|
1894
|
+
}), this.compactSurfaceEpisode.id;
|
|
1895
|
+
}
|
|
1896
|
+
closeCompactSurfaceEpisode(t = this.compactSurfaceEpisode?.id) {
|
|
1897
|
+
return !t || t !== this.compactSurfaceEpisode?.id ? !1 : (this.compactSurfaceEpisode = null, !0);
|
|
1898
|
+
}
|
|
1899
|
+
getCompactSurfaceEpisodeId() {
|
|
1900
|
+
return this.compactSurfaceEpisode?.id ?? null;
|
|
1901
|
+
}
|
|
1902
|
+
recordCompactPresented(t, e = this.compactSurfaceEpisode?.id) {
|
|
1903
|
+
const a = this.compactSurfaceEpisode;
|
|
1904
|
+
if (!a || !e || e !== a.id)
|
|
1905
|
+
return !1;
|
|
1906
|
+
const i = [
|
|
1907
|
+
e,
|
|
1908
|
+
t.subjectKind,
|
|
1909
|
+
t.subjectId
|
|
1910
|
+
].join(":");
|
|
1911
|
+
if (a.presented.has(i)) return !1;
|
|
1912
|
+
const o = `${t.subjectKind}_PRESENTED`;
|
|
1913
|
+
return this.collector.enqueue({
|
|
1914
|
+
kind: "EXPERIENCE_PRESENTED",
|
|
1915
|
+
type: o,
|
|
1916
|
+
actor: t.actor ?? "SCENARIO",
|
|
1917
|
+
surfaceEpisodeId: e,
|
|
1918
|
+
subjectKind: t.subjectKind,
|
|
1919
|
+
subjectId: t.subjectId,
|
|
1920
|
+
...t.attributionHandle ? { attributionHandle: t.attributionHandle } : {},
|
|
1921
|
+
details: {
|
|
1922
|
+
surface: "COMPACT_PREVIEW",
|
|
1923
|
+
...t.presentationOrdinal !== void 0 ? { presentationOrdinal: t.presentationOrdinal } : {}
|
|
1924
|
+
}
|
|
1925
|
+
}) ? (a.presented.add(i), !0) : !1;
|
|
1926
|
+
}
|
|
1927
|
+
recordCompactEngagement(t, e = this.compactSurfaceEpisode?.id) {
|
|
1928
|
+
const a = this.compactSurfaceEpisode;
|
|
1929
|
+
if (!a || !e || e !== a.id)
|
|
1930
|
+
return !1;
|
|
1931
|
+
const i = [
|
|
1932
|
+
e,
|
|
1933
|
+
t.type,
|
|
1934
|
+
t.subjectKind,
|
|
1935
|
+
t.subjectId
|
|
1936
|
+
].join(":");
|
|
1937
|
+
return a.engaged.has(i) || !this.collector.enqueue({
|
|
1938
|
+
kind: "EXPERIENCE_ENGAGED",
|
|
1939
|
+
type: t.type,
|
|
1940
|
+
actor: "USER",
|
|
1941
|
+
surfaceEpisodeId: e,
|
|
1942
|
+
subjectKind: t.subjectKind,
|
|
1943
|
+
subjectId: t.subjectId,
|
|
1944
|
+
...t.attributionHandle ? { attributionHandle: t.attributionHandle } : {},
|
|
1945
|
+
...t.result ? { result: t.result } : {},
|
|
1946
|
+
details: { surface: "COMPACT_PREVIEW" }
|
|
1947
|
+
}) ? !1 : (a.engaged.add(i), !0);
|
|
1948
|
+
}
|
|
1949
|
+
getPrincipalSessionId() {
|
|
1950
|
+
return this.collector.getPrincipalSessionId();
|
|
1951
|
+
}
|
|
1952
|
+
recordPresented(t, e = this.getSurfaceEpisodeId()) {
|
|
1953
|
+
if (!e || e !== this.getSurfaceEpisodeId() || this.getSurfaceState() !== "OPEN")
|
|
1954
|
+
return !1;
|
|
1955
|
+
const a = [
|
|
1956
|
+
e,
|
|
1957
|
+
t.subjectKind,
|
|
1958
|
+
t.subjectId
|
|
1959
|
+
].join(":");
|
|
1960
|
+
if (this.presented.has(a)) return !1;
|
|
1961
|
+
const i = `${t.subjectKind}_PRESENTED`;
|
|
1962
|
+
return this.collector.enqueue({
|
|
1963
|
+
kind: "EXPERIENCE_PRESENTED",
|
|
1964
|
+
type: i,
|
|
1965
|
+
actor: t.actor ?? "SCENARIO",
|
|
1966
|
+
surfaceEpisodeId: e,
|
|
1967
|
+
subjectKind: t.subjectKind,
|
|
1968
|
+
subjectId: t.subjectId,
|
|
1969
|
+
...t.attributionHandle ? { attributionHandle: t.attributionHandle } : {},
|
|
1970
|
+
...t.presentationOrdinal !== void 0 ? { details: { presentationOrdinal: t.presentationOrdinal } } : {}
|
|
1971
|
+
}) ? (this.presented.add(a), t.attributionHandle && this.surfaceController.markScenarioContext(t.attributionHandle), !0) : !1;
|
|
1972
|
+
}
|
|
1973
|
+
recordEngagement(t) {
|
|
1974
|
+
const e = this.getSurfaceEpisodeId();
|
|
1975
|
+
if (!e || this.getSurfaceState() !== "OPEN") return !1;
|
|
1976
|
+
const a = [
|
|
1977
|
+
e,
|
|
1978
|
+
t.type,
|
|
1979
|
+
t.subjectKind,
|
|
1980
|
+
t.subjectId
|
|
1981
|
+
].join(":");
|
|
1982
|
+
return this.engaged.has(a) || !this.collector.enqueue({
|
|
1983
|
+
kind: "EXPERIENCE_ENGAGED",
|
|
1984
|
+
type: t.type,
|
|
1985
|
+
actor: "USER",
|
|
1986
|
+
surfaceEpisodeId: e,
|
|
1987
|
+
subjectKind: t.subjectKind,
|
|
1988
|
+
subjectId: t.subjectId,
|
|
1989
|
+
...t.attributionHandle ? { attributionHandle: t.attributionHandle } : {},
|
|
1990
|
+
...t.result ? { result: t.result } : {}
|
|
1991
|
+
}) ? !1 : (this.engaged.add(a), t.attributionHandle && this.surfaceController.markScenarioContext(t.attributionHandle), !0);
|
|
1992
|
+
}
|
|
1993
|
+
recordTargetPresented(t, e = this.getSurfaceEpisodeId()) {
|
|
1994
|
+
return this.collector.enqueue({
|
|
1995
|
+
kind: "EXPERIENCE_PRESENTED",
|
|
1996
|
+
type: "TARGET_PRESENTED",
|
|
1997
|
+
actor: "SCENARIO",
|
|
1998
|
+
...e ? { surfaceEpisodeId: e } : {},
|
|
1999
|
+
subjectKind: "TARGET",
|
|
2000
|
+
subjectId: t,
|
|
2001
|
+
attributionHandle: t
|
|
2002
|
+
}) ? (this.markCurrentTargetContext(t, e), !0) : !1;
|
|
2003
|
+
}
|
|
2004
|
+
recordTargetActivation(t, e = this.getSurfaceEpisodeId()) {
|
|
2005
|
+
return this.collector.enqueue({
|
|
2006
|
+
kind: "EXPERIENCE_ENGAGED",
|
|
2007
|
+
type: "TARGET_ACTIVATED",
|
|
2008
|
+
actor: "USER",
|
|
2009
|
+
...e ? { surfaceEpisodeId: e } : {},
|
|
2010
|
+
subjectKind: "TARGET",
|
|
2011
|
+
subjectId: t,
|
|
2012
|
+
attributionHandle: t
|
|
2013
|
+
}) ? (this.markCurrentTargetContext(t, e), !0) : !1;
|
|
2014
|
+
}
|
|
2015
|
+
observeHighlightedTarget(t) {
|
|
2016
|
+
const e = this.getSurfaceEpisodeId(), a = this.getPrincipalSessionId();
|
|
2017
|
+
let i = !0;
|
|
2018
|
+
const o = Ke({
|
|
2019
|
+
element: t.element,
|
|
2020
|
+
isActive: () => i && this.getPrincipalSessionId() === a,
|
|
2021
|
+
onPresented: () => this.recordTargetPresented(t.commandId, e)
|
|
2022
|
+
});
|
|
2023
|
+
return () => {
|
|
2024
|
+
i = !1, o();
|
|
2025
|
+
};
|
|
2026
|
+
}
|
|
2027
|
+
markCurrentTargetContext(t, e) {
|
|
2028
|
+
e && this.getSurfaceState() === "OPEN" && this.getSurfaceEpisodeId() === e && this.surfaceController.markScenarioContext(t);
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
const $e = "3.5.0", Xe = 1, Ze = 1, vt = 35, Je = 10, Qe = 64, ta = 64, S = 32768, ea = 32, $ = 840, X = 0.1, Z = 16, L = 64, J = 32, aa = 0.25, xt = 0.1, Q = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i, tt = "lola-ai-assistant:client-environment:browser-instance:v1", v = (r) => {
|
|
2032
|
+
try {
|
|
2033
|
+
return r();
|
|
2034
|
+
} catch {
|
|
2035
|
+
return null;
|
|
2036
|
+
}
|
|
2037
|
+
}, C = (r, t) => typeof r != "string" || r.length === 0 ? null : Array.from(r).slice(0, t).join(""), _ = (r, t, e, a = !1) => {
|
|
2038
|
+
if (typeof r != "number" || !Number.isFinite(r)) return null;
|
|
2039
|
+
const i = a ? Math.round(r) : r;
|
|
2040
|
+
return !Number.isInteger(i) || i < t || i > e ? null : Object.is(i, -0) ? 0 : i;
|
|
2041
|
+
}, et = (r, t, e) => typeof r != "number" || !Number.isFinite(r) || r < t || r > e ? null : Object.is(r, -0) ? 0 : r, at = (r) => typeof r == "boolean" ? r : null, ia = (r) => {
|
|
2042
|
+
if (!Array.isArray(r)) return [];
|
|
2043
|
+
const t = [], e = /* @__PURE__ */ new Set();
|
|
2044
|
+
for (const a of r) {
|
|
2045
|
+
const i = C(a, vt);
|
|
2046
|
+
if (!(i === null || e.has(i)) && (t.push(i), e.add(i), t.length === Je))
|
|
2047
|
+
break;
|
|
2048
|
+
}
|
|
2049
|
+
return t;
|
|
2050
|
+
}, ra = (r) => r instanceof Date && Number.isFinite(r.getTime()) ? r.toISOString() : (/* @__PURE__ */ new Date(0)).toISOString(), oa = (r, t, e) => {
|
|
2051
|
+
if (typeof r == "string") {
|
|
2052
|
+
const a = r.toLowerCase();
|
|
2053
|
+
if (a.startsWith("portrait")) return "portrait";
|
|
2054
|
+
if (a.startsWith("landscape")) return "landscape";
|
|
2055
|
+
}
|
|
2056
|
+
return t === null || e === null || t === e ? "unknown" : t > e ? "landscape" : "portrait";
|
|
2057
|
+
}, yt = {
|
|
2058
|
+
now: () => /* @__PURE__ */ new Date(),
|
|
2059
|
+
language: () => typeof navigator > "u" ? null : navigator.language,
|
|
2060
|
+
languages: () => typeof navigator > "u" ? null : navigator.languages,
|
|
2061
|
+
timeZone: () => typeof Intl > "u" ? null : Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
2062
|
+
timeZoneOffsetMinutes: () => (/* @__PURE__ */ new Date()).getTimezoneOffset(),
|
|
2063
|
+
screenWidth: () => typeof window > "u" ? null : window.screen.width,
|
|
2064
|
+
screenHeight: () => typeof window > "u" ? null : window.screen.height,
|
|
2065
|
+
screenAvailableWidth: () => typeof window > "u" ? null : window.screen.availWidth,
|
|
2066
|
+
screenAvailableHeight: () => typeof window > "u" ? null : window.screen.availHeight,
|
|
2067
|
+
devicePixelRatio: () => typeof window > "u" ? null : window.devicePixelRatio,
|
|
2068
|
+
screenOrientationType: () => typeof window > "u" ? null : window.screen.orientation?.type,
|
|
2069
|
+
viewportWidth: () => typeof window > "u" ? null : window.innerWidth,
|
|
2070
|
+
viewportHeight: () => typeof window > "u" ? null : window.innerHeight,
|
|
2071
|
+
visualViewportWidth: () => typeof window > "u" ? null : window.visualViewport?.width,
|
|
2072
|
+
visualViewportHeight: () => typeof window > "u" ? null : window.visualViewport?.height,
|
|
2073
|
+
visualViewportScale: () => typeof window > "u" ? null : window.visualViewport?.scale,
|
|
2074
|
+
maxTouchPoints: () => typeof navigator > "u" ? null : navigator.maxTouchPoints,
|
|
2075
|
+
coarsePointer: () => typeof window > "u" || typeof window.matchMedia != "function" ? null : window.matchMedia("(pointer: coarse)").matches,
|
|
2076
|
+
hoverSupported: () => typeof window > "u" || typeof window.matchMedia != "function" ? null : window.matchMedia("(hover: hover)").matches,
|
|
2077
|
+
storage: () => typeof window > "u" ? null : window.localStorage,
|
|
2078
|
+
randomUuid: () => typeof globalThis.crypto?.randomUUID != "function" ? null : globalThis.crypto.randomUUID()
|
|
2079
|
+
}, na = (r = yt) => {
|
|
2080
|
+
try {
|
|
2081
|
+
const t = r.storage();
|
|
2082
|
+
if (!t) return null;
|
|
2083
|
+
const e = t.getItem(
|
|
2084
|
+
tt
|
|
2085
|
+
);
|
|
2086
|
+
if (e !== null && Q.test(e)) return e;
|
|
2087
|
+
const a = r.randomUuid();
|
|
2088
|
+
return typeof a != "string" || !Q.test(a) ? null : (t.setItem(tt, a), a);
|
|
2089
|
+
} catch {
|
|
2090
|
+
return null;
|
|
2091
|
+
}
|
|
2092
|
+
}, sa = (r, t = yt) => {
|
|
2093
|
+
const e = _(
|
|
2094
|
+
v(t.screenWidth),
|
|
2095
|
+
0,
|
|
2096
|
+
S,
|
|
2097
|
+
!0
|
|
2098
|
+
), a = _(
|
|
2099
|
+
v(t.screenHeight),
|
|
2100
|
+
0,
|
|
2101
|
+
S,
|
|
2102
|
+
!0
|
|
2103
|
+
), i = _(
|
|
2104
|
+
v(t.timeZoneOffsetMinutes),
|
|
2105
|
+
-$,
|
|
2106
|
+
$
|
|
2107
|
+
);
|
|
2108
|
+
return {
|
|
2109
|
+
schemaVersion: Xe,
|
|
2110
|
+
clientObservationId: r.clientObservationId,
|
|
2111
|
+
clientRuntimeId: r.clientRuntimeId,
|
|
2112
|
+
clientSequence: r.clientSequence,
|
|
2113
|
+
browserInstanceId: na(t),
|
|
2114
|
+
collectedAt: ra(v(t.now)),
|
|
2115
|
+
sdk: {
|
|
2116
|
+
name: "lola-ai-assistant",
|
|
2117
|
+
version: C(r.sdkVersion, ta) ?? "unknown"
|
|
2118
|
+
},
|
|
2119
|
+
locale: {
|
|
2120
|
+
language: C(v(t.language), vt),
|
|
2121
|
+
languages: ia(v(t.languages)),
|
|
2122
|
+
timeZone: C(v(t.timeZone), Qe),
|
|
2123
|
+
localUtcOffsetMinutes: i === null ? null : Object.is(-i, -0) ? 0 : -i
|
|
2124
|
+
},
|
|
2125
|
+
screen: {
|
|
2126
|
+
widthCssPx: e,
|
|
2127
|
+
heightCssPx: a,
|
|
2128
|
+
availableWidthCssPx: _(
|
|
2129
|
+
v(t.screenAvailableWidth),
|
|
2130
|
+
0,
|
|
2131
|
+
S,
|
|
2132
|
+
!0
|
|
2133
|
+
),
|
|
2134
|
+
availableHeightCssPx: _(
|
|
2135
|
+
v(t.screenAvailableHeight),
|
|
2136
|
+
0,
|
|
2137
|
+
S,
|
|
2138
|
+
!0
|
|
2139
|
+
),
|
|
2140
|
+
devicePixelRatio: et(
|
|
2141
|
+
v(t.devicePixelRatio),
|
|
2142
|
+
X,
|
|
2143
|
+
Z
|
|
2144
|
+
),
|
|
2145
|
+
orientation: oa(
|
|
2146
|
+
v(t.screenOrientationType),
|
|
2147
|
+
e,
|
|
2148
|
+
a
|
|
2149
|
+
)
|
|
2150
|
+
},
|
|
2151
|
+
viewport: {
|
|
2152
|
+
widthCssPx: _(
|
|
2153
|
+
v(t.viewportWidth),
|
|
2154
|
+
0,
|
|
2155
|
+
S,
|
|
2156
|
+
!0
|
|
2157
|
+
),
|
|
2158
|
+
heightCssPx: _(
|
|
2159
|
+
v(t.viewportHeight),
|
|
2160
|
+
0,
|
|
2161
|
+
S,
|
|
2162
|
+
!0
|
|
2163
|
+
),
|
|
2164
|
+
visualWidthCssPx: _(
|
|
2165
|
+
v(t.visualViewportWidth),
|
|
2166
|
+
0,
|
|
2167
|
+
S,
|
|
2168
|
+
!0
|
|
2169
|
+
),
|
|
2170
|
+
visualHeightCssPx: _(
|
|
2171
|
+
v(t.visualViewportHeight),
|
|
2172
|
+
0,
|
|
2173
|
+
S,
|
|
2174
|
+
!0
|
|
2175
|
+
),
|
|
2176
|
+
visualScale: et(
|
|
2177
|
+
v(t.visualViewportScale),
|
|
2178
|
+
X,
|
|
2179
|
+
Z
|
|
2180
|
+
)
|
|
2181
|
+
},
|
|
2182
|
+
interaction: {
|
|
2183
|
+
maxTouchPoints: _(
|
|
2184
|
+
v(t.maxTouchPoints),
|
|
2185
|
+
0,
|
|
2186
|
+
ea
|
|
2187
|
+
),
|
|
2188
|
+
coarsePointer: at(v(t.coarsePointer)),
|
|
2189
|
+
hoverSupported: at(v(t.hoverSupported))
|
|
2190
|
+
}
|
|
2191
|
+
};
|
|
2192
|
+
}, it = (r, t) => {
|
|
2193
|
+
if (r === null) return null;
|
|
2194
|
+
const e = t === xt ? 1 : 2;
|
|
2195
|
+
return Number((Math.round(r / t) * t).toFixed(e));
|
|
2196
|
+
}, ca = (r, t) => {
|
|
2197
|
+
if (r === null) return null;
|
|
2198
|
+
const e = Math.floor(r / L) * L;
|
|
2199
|
+
if (t === null) return e;
|
|
2200
|
+
const a = Math.max(
|
|
2201
|
+
0,
|
|
2202
|
+
t - J
|
|
2203
|
+
), i = t + L + J;
|
|
2204
|
+
return r >= a && r < i ? t : e;
|
|
2205
|
+
}, la = (r, t = null) => ({
|
|
2206
|
+
projectionVersion: Ze,
|
|
2207
|
+
browserInstanceId: r.browserInstanceId,
|
|
2208
|
+
language: r.locale.language,
|
|
2209
|
+
languages: r.locale.languages,
|
|
2210
|
+
timeZone: r.locale.timeZone,
|
|
2211
|
+
localUtcOffsetMinutes: r.locale.localUtcOffsetMinutes,
|
|
2212
|
+
screenWidthCssPx: r.screen.widthCssPx,
|
|
2213
|
+
screenHeightCssPx: r.screen.heightCssPx,
|
|
2214
|
+
screenAvailableWidthCssPx: r.screen.availableWidthCssPx,
|
|
2215
|
+
screenAvailableHeightCssPx: r.screen.availableHeightCssPx,
|
|
2216
|
+
devicePixelRatio: it(
|
|
2217
|
+
r.screen.devicePixelRatio,
|
|
2218
|
+
aa
|
|
2219
|
+
),
|
|
2220
|
+
orientation: r.screen.orientation,
|
|
2221
|
+
viewportWidthBucketCssPx: ca(
|
|
2222
|
+
r.viewport.widthCssPx,
|
|
2223
|
+
t?.viewportWidthBucketCssPx ?? null
|
|
2224
|
+
),
|
|
2225
|
+
visualScale: it(r.viewport.visualScale, xt),
|
|
2226
|
+
maxTouchPoints: r.interaction.maxTouchPoints,
|
|
2227
|
+
coarsePointer: r.interaction.coarsePointer,
|
|
2228
|
+
hoverSupported: r.interaction.hoverSupported
|
|
2229
|
+
}), da = "/client-environment/observations", ha = 250, pa = 1e3, ua = 1e4, rt = [250, 1e3, 3e3], fa = 0.2, ma = 3e4, ga = 2147483647, ba = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.\d{1,9})?(?:Z|[+-](\d{2}):(\d{2}))$/u, wa = "00000000-0000-4000-8000-000000000000", ot = () => {
|
|
2230
|
+
let r;
|
|
2231
|
+
const t = new Promise((a) => {
|
|
2232
|
+
r = a;
|
|
2233
|
+
});
|
|
2234
|
+
let e = !1;
|
|
2235
|
+
return {
|
|
2236
|
+
promise: t,
|
|
2237
|
+
resolve: (a) => {
|
|
2238
|
+
e || (e = !0, r(a));
|
|
2239
|
+
}
|
|
2240
|
+
};
|
|
2241
|
+
}, va = (r) => r || ((t, e) => globalThis.fetch(t, e)), nt = (r) => JSON.stringify(r), xa = (r) => r === 408 || r === 429 || r >= 500, ya = (r) => {
|
|
2242
|
+
const t = ba.exec(r);
|
|
2243
|
+
if (!t) return !1;
|
|
2244
|
+
const [
|
|
2245
|
+
,
|
|
2246
|
+
e,
|
|
2247
|
+
a,
|
|
2248
|
+
i,
|
|
2249
|
+
o,
|
|
2250
|
+
n,
|
|
2251
|
+
s
|
|
2252
|
+
] = t, c = Number(e), l = Number(a), d = Number(i), u = Number(o), p = Number(n), g = Number(s), b = Number(t[7] ?? 0), m = Number(t[8] ?? 0), x = [
|
|
2253
|
+
31,
|
|
2254
|
+
c % 4 === 0 && (c % 100 !== 0 || c % 400 === 0) ? 29 : 28,
|
|
2255
|
+
31,
|
|
2256
|
+
30,
|
|
2257
|
+
31,
|
|
2258
|
+
30,
|
|
2259
|
+
31,
|
|
2260
|
+
31,
|
|
2261
|
+
30,
|
|
2262
|
+
31,
|
|
2263
|
+
30,
|
|
2264
|
+
31
|
|
2265
|
+
];
|
|
2266
|
+
return l >= 1 && l <= 12 && d >= 1 && d <= x[l - 1] && u <= 23 && p <= 59 && g <= 59 && b <= 23 && m <= 59 && Number.isFinite(Date.parse(r));
|
|
2267
|
+
}, _a = async (r, t) => {
|
|
2268
|
+
let e;
|
|
2269
|
+
try {
|
|
2270
|
+
e = await r.json();
|
|
2271
|
+
} catch (a) {
|
|
2272
|
+
if (a instanceof SyntaxError || a instanceof Error && a.name === "SyntaxError")
|
|
2273
|
+
return null;
|
|
2274
|
+
throw a;
|
|
2275
|
+
}
|
|
2276
|
+
return !e || e.schemaVersion !== 1 || e.clientObservationId !== t.clientObservationId || typeof e.observationRef != "string" || !ut.test(e.observationRef) || typeof e.receivedAt != "string" || !ya(e.receivedAt) || typeof e.duplicate != "boolean" || r.status === 201 && e.duplicate !== !1 || r.status === 200 && e.duplicate !== !0 ? null : { observationRef: e.observationRef };
|
|
2277
|
+
};
|
|
2278
|
+
class ka {
|
|
2279
|
+
constructor(t, e, a = {}) {
|
|
2280
|
+
this.getSession = t, this.onSessionExpired = e;
|
|
2281
|
+
const i = t();
|
|
2282
|
+
this.sessionId = i.interactionSessionId, this.accessToken = i.accessToken, this.baseUrl = a.baseUrl ?? M, this.fetchImpl = va(a.fetch), this.collect = a.collect ?? sa, this.project = a.project ?? la, this.createId = a.createId ?? ft, this.runtimeId = this.safeCreateId(), this.now = a.now ?? Date.now, this.random = a.random ?? Math.random, this.sdkVersion = a.sdkVersion ?? $e;
|
|
2283
|
+
}
|
|
2284
|
+
baseUrl;
|
|
2285
|
+
fetchImpl;
|
|
2286
|
+
collect;
|
|
2287
|
+
project;
|
|
2288
|
+
createId;
|
|
2289
|
+
now;
|
|
2290
|
+
random;
|
|
2291
|
+
sdkVersion;
|
|
2292
|
+
sessionId;
|
|
2293
|
+
accessToken;
|
|
2294
|
+
generation = 1;
|
|
2295
|
+
runtimeId;
|
|
2296
|
+
nextSequence = 1;
|
|
2297
|
+
latestFenceRevision = 0;
|
|
2298
|
+
lastStartedAt = Number.NEGATIVE_INFINITY;
|
|
2299
|
+
cooldownUntil = 0;
|
|
2300
|
+
lastCollectedProjection = null;
|
|
2301
|
+
acknowledged = null;
|
|
2302
|
+
active = null;
|
|
2303
|
+
pending = null;
|
|
2304
|
+
recovery = null;
|
|
2305
|
+
awaitingRenewalToken = null;
|
|
2306
|
+
currentProjectionUncertain = !1;
|
|
2307
|
+
suppressedProjectionKey = null;
|
|
2308
|
+
pumpTimer;
|
|
2309
|
+
eventWaiters = /* @__PURE__ */ new Set();
|
|
2310
|
+
started = !1;
|
|
2311
|
+
destroyed = !1;
|
|
2312
|
+
start() {
|
|
2313
|
+
this.started || this.destroyed || (this.started = !0, this.requestCurrentObservation());
|
|
2314
|
+
}
|
|
2315
|
+
async ensureForEvent(t) {
|
|
2316
|
+
if (!this.started && !this.destroyed && this.start(), this.destroyed || !this.started || t !== this.sessionId || this.getSession().interactionSessionId !== t)
|
|
2317
|
+
return null;
|
|
2318
|
+
const e = this.generation, a = this.requestCurrentObservation();
|
|
2319
|
+
return this.withEventDeadline(a, e, t);
|
|
2320
|
+
}
|
|
2321
|
+
updateSession(t) {
|
|
2322
|
+
if (this.destroyed) return;
|
|
2323
|
+
if (t.interactionSessionId !== this.sessionId) {
|
|
2324
|
+
this.resetGeneration(t), this.started && this.requestCurrentObservation();
|
|
2325
|
+
return;
|
|
2326
|
+
}
|
|
2327
|
+
const e = t.accessToken !== this.accessToken;
|
|
2328
|
+
this.accessToken = t.accessToken;
|
|
2329
|
+
const a = e && this.awaitingRenewalToken !== null && t.accessToken !== this.awaitingRenewalToken;
|
|
2330
|
+
if (a && (this.awaitingRenewalToken = null), a && this.recovery?.reason === "authentication" && this.recovery.projectionKey === nt(this.lastCollectedProjection ?? this.recovery.projection)) {
|
|
2331
|
+
const i = this.recovery;
|
|
2332
|
+
this.recovery = null, this.startRecovery(i);
|
|
2333
|
+
} else a && this.started && (this.recovery = null, this.requestCurrentObservation());
|
|
2334
|
+
}
|
|
2335
|
+
destroy() {
|
|
2336
|
+
this.destroyed || (this.destroyed = !0, this.started = !1, this.cancelGeneration(), this.acknowledged = null, this.recovery = null, this.awaitingRenewalToken = null, this.currentProjectionUncertain = !1, this.lastCollectedProjection = null);
|
|
2337
|
+
}
|
|
2338
|
+
requestCurrentObservation() {
|
|
2339
|
+
if (this.destroyed || !this.started) return Promise.resolve(null);
|
|
2340
|
+
const t = this.getSession();
|
|
2341
|
+
if (t.interactionSessionId !== this.sessionId && this.resetGeneration(t), this.nextSequence > ga || (this.runtimeId || (this.runtimeId = this.safeCreateId()), !this.runtimeId)) return Promise.resolve(null);
|
|
2342
|
+
const e = this.runtimeId;
|
|
2343
|
+
let a, i;
|
|
2344
|
+
try {
|
|
2345
|
+
a = this.collect({
|
|
2346
|
+
clientObservationId: wa,
|
|
2347
|
+
clientRuntimeId: e,
|
|
2348
|
+
clientSequence: this.nextSequence,
|
|
2349
|
+
sdkVersion: this.sdkVersion
|
|
2350
|
+
}), i = this.project(a, this.lastCollectedProjection);
|
|
2351
|
+
} catch (d) {
|
|
2352
|
+
return f.debug("Client Environment collection failed", d), Promise.resolve(null);
|
|
2353
|
+
}
|
|
2354
|
+
this.lastCollectedProjection = i;
|
|
2355
|
+
const o = nt(i);
|
|
2356
|
+
if (this.awaitingRenewalToken !== null && t.accessToken === this.awaitingRenewalToken)
|
|
2357
|
+
return this.recovery?.projectionKey !== o && (this.recovery = null), Promise.resolve(null);
|
|
2358
|
+
if (this.recovery)
|
|
2359
|
+
if (this.recovery.projectionKey !== o)
|
|
2360
|
+
this.recovery.reason === "transient" && (this.currentProjectionUncertain = !0), this.recovery = null;
|
|
2361
|
+
else {
|
|
2362
|
+
if (this.recovery.reason === "authentication")
|
|
2363
|
+
return Promise.resolve(null);
|
|
2364
|
+
if (this.now() < this.cooldownUntil)
|
|
2365
|
+
return Promise.resolve(null);
|
|
2366
|
+
{
|
|
2367
|
+
const d = this.recovery;
|
|
2368
|
+
return this.recovery = null, this.startRecovery(d);
|
|
2369
|
+
}
|
|
2370
|
+
}
|
|
2371
|
+
if (this.now() < this.cooldownUntil)
|
|
2372
|
+
return this.currentProjectionUncertain = !0, !this.active && !this.pending && this.acknowledged?.projectionKey === o ? Promise.resolve(this.acknowledged.observationRef) : Promise.resolve(null);
|
|
2373
|
+
const n = this.currentProjectionUncertain;
|
|
2374
|
+
let s = !1;
|
|
2375
|
+
if (this.pending) {
|
|
2376
|
+
if (this.pending.projectionKey === o)
|
|
2377
|
+
return this.pending.deferred.promise;
|
|
2378
|
+
this.pending.deferred.resolve(null), this.pending = null, s = !0;
|
|
2379
|
+
}
|
|
2380
|
+
if (this.active?.projectionKey === o)
|
|
2381
|
+
return s && (this.active.fenceRevision = ++this.latestFenceRevision), this.active.deferred.promise;
|
|
2382
|
+
if (!n && !this.active && this.acknowledged?.projectionKey === o)
|
|
2383
|
+
return this.suppressedProjectionKey = null, Promise.resolve(this.acknowledged.observationRef);
|
|
2384
|
+
if (this.suppressedProjectionKey === o) return Promise.resolve(null);
|
|
2385
|
+
this.suppressedProjectionKey = null;
|
|
2386
|
+
const c = this.safeCreateId();
|
|
2387
|
+
if (!c) return Promise.resolve(null);
|
|
2388
|
+
a = {
|
|
2389
|
+
...a,
|
|
2390
|
+
clientObservationId: c
|
|
2391
|
+
}, this.nextSequence += 1;
|
|
2392
|
+
const l = {
|
|
2393
|
+
generation: this.generation,
|
|
2394
|
+
observation: a,
|
|
2395
|
+
projection: i,
|
|
2396
|
+
projectionKey: o,
|
|
2397
|
+
fenceRevision: ++this.latestFenceRevision,
|
|
2398
|
+
deferred: ot(),
|
|
2399
|
+
controller: null
|
|
2400
|
+
};
|
|
2401
|
+
return this.currentProjectionUncertain = !1, this.pending = l, this.pump(), l.deferred.promise;
|
|
2402
|
+
}
|
|
2403
|
+
startRecovery(t) {
|
|
2404
|
+
if (this.destroyed || t.generation !== this.generation)
|
|
2405
|
+
return Promise.resolve(null);
|
|
2406
|
+
const e = {
|
|
2407
|
+
...t,
|
|
2408
|
+
fenceRevision: ++this.latestFenceRevision,
|
|
2409
|
+
deferred: ot(),
|
|
2410
|
+
controller: null
|
|
2411
|
+
};
|
|
2412
|
+
return this.active = e, this.upload(e), e.deferred.promise;
|
|
2413
|
+
}
|
|
2414
|
+
pump() {
|
|
2415
|
+
if (this.destroyed || this.active || !this.pending) return;
|
|
2416
|
+
const t = Math.max(
|
|
2417
|
+
0,
|
|
2418
|
+
this.lastStartedAt + pa - this.now()
|
|
2419
|
+
);
|
|
2420
|
+
if (t > 0) {
|
|
2421
|
+
if (this.pumpTimer !== void 0) return;
|
|
2422
|
+
this.pumpTimer = window.setTimeout(() => {
|
|
2423
|
+
this.pumpTimer = void 0, this.pump();
|
|
2424
|
+
}, t);
|
|
2425
|
+
return;
|
|
2426
|
+
}
|
|
2427
|
+
const e = this.pending;
|
|
2428
|
+
this.pending = null, this.active = e, this.lastStartedAt = this.now(), this.upload(e);
|
|
2429
|
+
}
|
|
2430
|
+
async upload(t) {
|
|
2431
|
+
const e = new AbortController();
|
|
2432
|
+
t.controller = e;
|
|
2433
|
+
const a = await this.runAttempts(t, e.signal);
|
|
2434
|
+
if (this.destroyed || t.generation !== this.generation || this.active !== t) {
|
|
2435
|
+
t.deferred.resolve(null);
|
|
2436
|
+
return;
|
|
2437
|
+
}
|
|
2438
|
+
if (this.active = null, t.controller = null, a.kind === "acknowledged") {
|
|
2439
|
+
const i = t.observation.clientSequence;
|
|
2440
|
+
(!this.acknowledged || i > this.acknowledged.clientSequence) && (this.acknowledged = {
|
|
2441
|
+
...t,
|
|
2442
|
+
clientSequence: i,
|
|
2443
|
+
observationRef: a.receipt.observationRef
|
|
2444
|
+
});
|
|
2445
|
+
const o = t.fenceRevision === this.latestFenceRevision && !this.pending;
|
|
2446
|
+
t.deferred.resolve(
|
|
2447
|
+
o ? a.receipt.observationRef : null
|
|
2448
|
+
), this.cooldownUntil = 0, this.recovery = null, this.awaitingRenewalToken = null, this.currentProjectionUncertain = !1;
|
|
2449
|
+
} else if (a.kind === "transient-exhausted") {
|
|
2450
|
+
const i = this.pending ?? t;
|
|
2451
|
+
this.pending?.deferred.resolve(null), this.pending = null, this.recovery = {
|
|
2452
|
+
generation: i.generation,
|
|
2453
|
+
observation: i.observation,
|
|
2454
|
+
projection: i.projection,
|
|
2455
|
+
projectionKey: i.projectionKey,
|
|
2456
|
+
reason: "transient"
|
|
2457
|
+
}, this.cooldownUntil = this.now() + ma, this.currentProjectionUncertain = !1, t.deferred.resolve(null);
|
|
2458
|
+
} else if (a.kind === "authentication") {
|
|
2459
|
+
const i = this.pending ?? t;
|
|
2460
|
+
this.pending?.deferred.resolve(null), this.pending = null;
|
|
2461
|
+
const o = {
|
|
2462
|
+
generation: i.generation,
|
|
2463
|
+
observation: i.observation,
|
|
2464
|
+
projection: i.projection,
|
|
2465
|
+
projectionKey: i.projectionKey,
|
|
2466
|
+
reason: "authentication"
|
|
2467
|
+
};
|
|
2468
|
+
t.deferred.resolve(null), this.getSession().accessToken !== a.rejectedAccessToken ? (this.awaitingRenewalToken = null, this.recovery = null, this.startRecovery(o)) : (this.recovery = o, this.awaitingRenewalToken = a.rejectedAccessToken);
|
|
2469
|
+
} else a.kind === "permanent" && (this.suppressedProjectionKey = t.projectionKey, this.currentProjectionUncertain = !1), t.deferred.resolve(null);
|
|
2470
|
+
this.pending && this.pump();
|
|
2471
|
+
}
|
|
2472
|
+
async runAttempts(t, e) {
|
|
2473
|
+
const a = JSON.stringify(t.observation);
|
|
2474
|
+
let i = 0, o = 0;
|
|
2475
|
+
for (; !e.aborted; ) {
|
|
2476
|
+
const n = await this.sendOnce(t, a, e);
|
|
2477
|
+
if (n.kind === "acknowledged" || n.kind === "cancelled" || n.kind === "authentication" || n.kind === "permanent") return n;
|
|
2478
|
+
if (n.kind === "authentication-refreshed") {
|
|
2479
|
+
if (o += 1, o > 1)
|
|
2480
|
+
return {
|
|
2481
|
+
kind: "authentication",
|
|
2482
|
+
rejectedAccessToken: n.rejectedAccessToken
|
|
2483
|
+
};
|
|
2484
|
+
continue;
|
|
2485
|
+
}
|
|
2486
|
+
if (i >= rt.length)
|
|
2487
|
+
return { kind: "transient-exhausted" };
|
|
2488
|
+
const s = rt[i];
|
|
2489
|
+
i += 1;
|
|
2490
|
+
const c = Math.floor(
|
|
2491
|
+
s * fa * Math.min(1, Math.max(0, this.random()))
|
|
2492
|
+
);
|
|
2493
|
+
if (!await this.delay(s + c, e))
|
|
2494
|
+
return { kind: "cancelled" };
|
|
2495
|
+
}
|
|
2496
|
+
return { kind: "cancelled" };
|
|
2497
|
+
}
|
|
2498
|
+
async sendOnce(t, e, a) {
|
|
2499
|
+
if (a.aborted || t.generation !== this.generation || this.destroyed)
|
|
2500
|
+
return { kind: "cancelled" };
|
|
2501
|
+
const i = this.getSession();
|
|
2502
|
+
if (i.interactionSessionId !== this.sessionId)
|
|
2503
|
+
return { kind: "cancelled" };
|
|
2504
|
+
if (Date.parse(i.expiresAt) <= this.now())
|
|
2505
|
+
return this.onSessionExpired(), {
|
|
2506
|
+
kind: "authentication",
|
|
2507
|
+
rejectedAccessToken: i.accessToken
|
|
2508
|
+
};
|
|
2509
|
+
const o = new AbortController(), n = () => o.abort();
|
|
2510
|
+
a.addEventListener("abort", n, { once: !0 });
|
|
2511
|
+
const s = window.setTimeout(() => {
|
|
2512
|
+
o.abort();
|
|
2513
|
+
}, ua);
|
|
2514
|
+
try {
|
|
2515
|
+
const c = await this.fetchImpl(
|
|
2516
|
+
`${this.baseUrl}${da}`,
|
|
2517
|
+
{
|
|
2518
|
+
method: "POST",
|
|
2519
|
+
headers: {
|
|
2520
|
+
Authorization: `Bearer ${i.accessToken}`,
|
|
2521
|
+
"Content-Type": "application/json"
|
|
2522
|
+
},
|
|
2523
|
+
body: e,
|
|
2524
|
+
signal: o.signal
|
|
2525
|
+
}
|
|
2526
|
+
);
|
|
2527
|
+
if (a.aborted || t.generation !== this.generation || this.destroyed)
|
|
2528
|
+
return { kind: "cancelled" };
|
|
2529
|
+
if (c.status === 200 || c.status === 201) {
|
|
2530
|
+
const l = await _a(c, t.observation);
|
|
2531
|
+
return l ? { kind: "acknowledged", receipt: l } : { kind: "permanent" };
|
|
2532
|
+
}
|
|
2533
|
+
if (c.status === 401) {
|
|
2534
|
+
const l = this.getSession();
|
|
2535
|
+
return l.interactionSessionId === this.sessionId && l.accessToken !== i.accessToken ? {
|
|
2536
|
+
kind: "authentication-refreshed",
|
|
2537
|
+
rejectedAccessToken: i.accessToken
|
|
2538
|
+
} : (l.interactionSessionId === this.sessionId && l.accessToken === i.accessToken && this.onSessionExpired(), {
|
|
2539
|
+
kind: "authentication",
|
|
2540
|
+
rejectedAccessToken: i.accessToken
|
|
2541
|
+
});
|
|
2542
|
+
}
|
|
2543
|
+
return xa(c.status) ? { kind: "retryable" } : { kind: "permanent" };
|
|
2544
|
+
} catch (c) {
|
|
2545
|
+
return a.aborted ? { kind: "cancelled" } : (f.debug("Client Environment observation request failed", c), { kind: "retryable" });
|
|
2546
|
+
} finally {
|
|
2547
|
+
window.clearTimeout(s), a.removeEventListener("abort", n);
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2550
|
+
withEventDeadline(t, e, a) {
|
|
2551
|
+
return new Promise((i) => {
|
|
2552
|
+
let o = !1;
|
|
2553
|
+
const n = (l) => {
|
|
2554
|
+
if (o) return;
|
|
2555
|
+
o = !0, window.clearTimeout(c), this.eventWaiters.delete(s);
|
|
2556
|
+
const d = this.getSession();
|
|
2557
|
+
i(
|
|
2558
|
+
!this.destroyed && e === this.generation && a === this.sessionId && d.interactionSessionId === a ? l : null
|
|
2559
|
+
);
|
|
2560
|
+
}, s = () => n(null), c = window.setTimeout(s, ha);
|
|
2561
|
+
this.eventWaiters.add(s), t.then(n, s);
|
|
2562
|
+
});
|
|
2563
|
+
}
|
|
2564
|
+
delay(t, e) {
|
|
2565
|
+
return new Promise((a) => {
|
|
2566
|
+
if (e.aborted) {
|
|
2567
|
+
a(!1);
|
|
2568
|
+
return;
|
|
2569
|
+
}
|
|
2570
|
+
const i = () => o(!1), o = (s) => {
|
|
2571
|
+
window.clearTimeout(n), e.removeEventListener("abort", i), a(s);
|
|
2572
|
+
}, n = window.setTimeout(() => o(!0), t);
|
|
2573
|
+
e.addEventListener("abort", i, { once: !0 });
|
|
2574
|
+
});
|
|
2575
|
+
}
|
|
2576
|
+
resetGeneration(t) {
|
|
2577
|
+
this.cancelGeneration(), this.generation += 1, this.sessionId = t.interactionSessionId, this.accessToken = t.accessToken, this.runtimeId = this.safeCreateId(), this.nextSequence = 1, this.latestFenceRevision = 0, this.lastStartedAt = Number.NEGATIVE_INFINITY, this.cooldownUntil = 0, this.lastCollectedProjection = null, this.acknowledged = null, this.recovery = null, this.awaitingRenewalToken = null, this.currentProjectionUncertain = !1, this.suppressedProjectionKey = null;
|
|
2578
|
+
}
|
|
2579
|
+
safeCreateId() {
|
|
2580
|
+
try {
|
|
2581
|
+
const t = this.createId();
|
|
2582
|
+
if (ut.test(t)) return t;
|
|
2583
|
+
f.debug("Client Environment UUID generation returned an invalid ID");
|
|
2584
|
+
} catch (t) {
|
|
2585
|
+
f.debug("Client Environment UUID generation failed", t);
|
|
2586
|
+
}
|
|
2587
|
+
return null;
|
|
2588
|
+
}
|
|
2589
|
+
cancelGeneration() {
|
|
2590
|
+
this.pumpTimer !== void 0 && (window.clearTimeout(this.pumpTimer), this.pumpTimer = void 0), this.active?.controller?.abort(), this.active?.deferred.resolve(null), this.pending?.deferred.resolve(null), this.active = null, this.pending = null;
|
|
2591
|
+
for (const t of [...this.eventWaiters]) t(null);
|
|
2592
|
+
this.eventWaiters.clear();
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
const Ea = "new", Sa = [
|
|
2596
|
+
"deposit",
|
|
2597
|
+
"excited",
|
|
2598
|
+
"fix_hair",
|
|
2599
|
+
"kiss",
|
|
2600
|
+
"spin",
|
|
2601
|
+
"win_small"
|
|
2602
|
+
];
|
|
2603
|
+
function za(r) {
|
|
2604
|
+
return Sa.includes(r);
|
|
2605
|
+
}
|
|
2606
|
+
const Ia = [
|
|
2607
|
+
"ru",
|
|
2608
|
+
"uz",
|
|
2609
|
+
"en",
|
|
2610
|
+
"it",
|
|
2611
|
+
"es",
|
|
2612
|
+
"de",
|
|
2613
|
+
"fr",
|
|
2614
|
+
"pl",
|
|
2615
|
+
"pt",
|
|
2616
|
+
"bn",
|
|
2617
|
+
"sw",
|
|
2618
|
+
"so",
|
|
2619
|
+
"ar"
|
|
2620
|
+
], Ta = new Set(Ia), Aa = /^(?:(?:[a-z]{2,3}(?:-[a-z]{3}){0,3}|[a-z]{4}|[a-z]{5,8})(?:-[a-z]{4})?(?:-(?:[a-z]{2}|[0-9]{3}))?(?:-(?:[a-z0-9]{5,8}|[0-9][a-z0-9]{3}))*(?:-[0-9a-wy-z](?:-[a-z0-9]{2,8})+)*(?:-x(?:-[a-z0-9]{1,8})+)?|x(?:-[a-z0-9]{1,8})+)$/i;
|
|
2621
|
+
function Ma(r) {
|
|
2622
|
+
const t = r?.trim().replace(/_/g, "-");
|
|
2623
|
+
if (!t || !Aa.test(t)) return "en";
|
|
2624
|
+
const e = t.split("-", 1)[0].toLowerCase();
|
|
2625
|
+
return Ta.has(e) ? e : "en";
|
|
2626
|
+
}
|
|
2627
|
+
const z = (r) => !!r && typeof r == "object" && !Array.isArray(r), Ra = (r) => typeof r == "string" && r.trim() ? r : void 0, Ca = (r) => {
|
|
2628
|
+
if (!z(r)) return null;
|
|
2629
|
+
const t = Ra(r.conversationId), e = r.actor;
|
|
2630
|
+
return !t || e !== "ASSISTANT" && e !== "ADMIN" || typeof r.active != "boolean" ? null : {
|
|
2631
|
+
conversationId: t,
|
|
2632
|
+
actor: e,
|
|
2633
|
+
active: r.active
|
|
2634
|
+
};
|
|
2635
|
+
}, qa = (r) => {
|
|
2636
|
+
const t = z(r) && z(r.event) ? r.event : {};
|
|
2637
|
+
return {
|
|
2638
|
+
typing: Ca(t.messageTyping)
|
|
2639
|
+
};
|
|
2640
|
+
}, Oa = (r) => r.startsWith("image/") ? "image" : "document", Na = (r) => {
|
|
2641
|
+
try {
|
|
2642
|
+
return URL.createObjectURL(r);
|
|
2643
|
+
} catch {
|
|
2644
|
+
return `mock://attachment/${encodeURIComponent(r.name)}`;
|
|
2645
|
+
}
|
|
2646
|
+
}, ja = () => ({
|
|
2647
|
+
async upload({ file: r, signal: t, onProgress: e, onStage: a }) {
|
|
2648
|
+
if (t?.aborted) throw new DOMException("Upload aborted", "AbortError");
|
|
2649
|
+
if (a?.("preparing"), e?.(0), await Promise.resolve(), t?.aborted) throw new DOMException("Upload aborted", "AbortError");
|
|
2650
|
+
a?.("uploading"), e?.(1), a?.("scanning");
|
|
2651
|
+
const i = Na(r);
|
|
2652
|
+
return {
|
|
2653
|
+
id: crypto.randomUUID(),
|
|
2654
|
+
fileName: r.name,
|
|
2655
|
+
mediaType: r.type || "application/octet-stream",
|
|
2656
|
+
size: r.size,
|
|
2657
|
+
kind: Oa(r.type || "application/octet-stream"),
|
|
2658
|
+
downloadUrl: i,
|
|
2659
|
+
...r.type.startsWith("image/") ? { previewUrl: i } : {}
|
|
2660
|
+
};
|
|
2661
|
+
}
|
|
2662
|
+
}), st = ue, Pa = _t, ct = 3e4, Da = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?(?:Z|[+-]\d{2}:\d{2})$/, lt = (r) => {
|
|
2663
|
+
f.error("Session renewal callback failed", r);
|
|
2664
|
+
};
|
|
2665
|
+
class Va extends EventTarget {
|
|
2666
|
+
root = null;
|
|
2667
|
+
hostElement;
|
|
2668
|
+
shadowRoot;
|
|
2669
|
+
config;
|
|
2670
|
+
setOpenImpl = null;
|
|
2671
|
+
pendingOpenState = null;
|
|
2672
|
+
playAnimationImpl = null;
|
|
2673
|
+
avatarLoadError = null;
|
|
2674
|
+
avatarLoadGeneration = 0;
|
|
2675
|
+
pendingAvatarAnimations = /* @__PURE__ */ new Set();
|
|
2676
|
+
destroyed = !1;
|
|
2677
|
+
disableDebugLogging = null;
|
|
2678
|
+
releaseFontStyles = null;
|
|
2679
|
+
resolveAssetPath;
|
|
2680
|
+
setSessionImpl = null;
|
|
2681
|
+
setLocaleImpl = null;
|
|
2682
|
+
commandRuntime;
|
|
2683
|
+
clientEnvironmentRuntime;
|
|
2684
|
+
eventTracker;
|
|
2685
|
+
scenarioInteractionRuntime;
|
|
2686
|
+
onSessionExpired = Yt(
|
|
2687
|
+
() => {
|
|
2688
|
+
this.destroyed || this.runRenewSessionCallback();
|
|
2689
|
+
},
|
|
2690
|
+
H,
|
|
2691
|
+
{ leading: !0, maxWait: H }
|
|
2692
|
+
);
|
|
2693
|
+
runRenewSessionCallback() {
|
|
2694
|
+
try {
|
|
2695
|
+
Promise.resolve(this.config.onRenewSession?.()).catch(
|
|
2696
|
+
lt
|
|
2697
|
+
);
|
|
2698
|
+
} catch (t) {
|
|
2699
|
+
lt(t);
|
|
2700
|
+
}
|
|
2701
|
+
}
|
|
2702
|
+
addEventListener(t, e, a) {
|
|
2703
|
+
super.addEventListener(t, e, a);
|
|
2704
|
+
}
|
|
2705
|
+
constructor(t) {
|
|
2706
|
+
if (super(), this.validateCustomerInteractionSession(t.customerInteractionSession), this.config = t, this.clientEnvironmentRuntime = new ka(
|
|
2707
|
+
() => this.config.customerInteractionSession,
|
|
2708
|
+
this.onSessionExpired
|
|
2709
|
+
), this.eventTracker = new fe(
|
|
2710
|
+
() => this.config.customerInteractionSession,
|
|
2711
|
+
this.onSessionExpired,
|
|
2712
|
+
this.clientEnvironmentRuntime
|
|
2713
|
+
), this.scenarioInteractionRuntime = new Ye(
|
|
2714
|
+
() => this.config.customerInteractionSession,
|
|
2715
|
+
this.onSessionExpired
|
|
2716
|
+
), this.commandRuntime = new he(
|
|
2717
|
+
{},
|
|
2718
|
+
t.handlers,
|
|
2719
|
+
this.onCommandStatus,
|
|
2720
|
+
this.scenarioInteractionRuntime,
|
|
2721
|
+
t.uiActionPolicies
|
|
2722
|
+
), !document.body)
|
|
2723
|
+
throw new Error("ChatWidget: document.body is not available");
|
|
2724
|
+
this.hostElement = document.createElement("div"), this.hostElement.dataset.lolaWidgetHost = "", this.hostElement.dataset.lolaAssistantUi = Ea, document.body.appendChild(this.hostElement), this.shadowRoot = this.hostElement.attachShadow({ mode: "open" }), this.injectStyles(this.shadowRoot);
|
|
2725
|
+
const e = document.createElement("div");
|
|
2726
|
+
this.shadowRoot.appendChild(e), this.disableDebugLogging = t.debug ? f.enableDebug() : null;
|
|
2727
|
+
const a = this.init(e, t);
|
|
2728
|
+
Promise.resolve().then(() => {
|
|
2729
|
+
this.destroyed || this.clientEnvironmentRuntime.start();
|
|
2730
|
+
}).catch((i) => {
|
|
2731
|
+
f.debug("Client Environment startup failed", i);
|
|
2732
|
+
}), a.catch((i) => {
|
|
2733
|
+
this.destroyed || f.error("Initialization failed", i);
|
|
2734
|
+
});
|
|
2735
|
+
}
|
|
2736
|
+
async init(t, e) {
|
|
2737
|
+
const [a, { mountWidget: i }, { installWidgetFontStyles: o }] = await Promise.all([
|
|
2738
|
+
fetch(`${st}/manifest.json`),
|
|
2739
|
+
import("./mount-j9dyEXzG.js").then((c) => c.aJ),
|
|
2740
|
+
import("./widget-fonts-CFulYNmT.js")
|
|
2741
|
+
]);
|
|
2742
|
+
if (this.destroyed) return;
|
|
2743
|
+
if (!a.ok)
|
|
2744
|
+
throw new Error(
|
|
2745
|
+
`Asset manifest request failed: ${a.status} ${a.statusText}`
|
|
2746
|
+
);
|
|
2747
|
+
const n = await a.json();
|
|
2748
|
+
if (this.destroyed) return;
|
|
2749
|
+
const s = o(document);
|
|
2750
|
+
this.releaseFontStyles = s;
|
|
2751
|
+
try {
|
|
2752
|
+
this.resolveAssetPath = (d) => `${st}/${n[d]}`, this.config = e, this.scenarioInteractionRuntime.start();
|
|
2753
|
+
const c = {
|
|
2754
|
+
onAvatarLoadStarted: this.onAvatarLoadStarted,
|
|
2755
|
+
onAvatarReady: this.onAvatarReady,
|
|
2756
|
+
onAvatarLoadFailed: this.onAvatarLoadFailed,
|
|
2757
|
+
playAvatarAnimation: this.playAvatarAnimation,
|
|
2758
|
+
onSessionExpired: this.onSessionExpired,
|
|
2759
|
+
registerSetOpen: (d) => {
|
|
2760
|
+
this.setOpenImpl = d, d && this.pendingOpenState !== null && (d(this.pendingOpenState), this.pendingOpenState = null);
|
|
2761
|
+
},
|
|
2762
|
+
resolveAssetPath: this.resolveAssetPath,
|
|
2763
|
+
registerSetSession: (d) => {
|
|
2764
|
+
this.setSessionImpl = d;
|
|
2765
|
+
},
|
|
2766
|
+
registerSetLocale: (d) => {
|
|
2767
|
+
this.setLocaleImpl = d;
|
|
2768
|
+
},
|
|
2769
|
+
commandRuntime: this.commandRuntime,
|
|
2770
|
+
scenarioInteractionRuntime: this.scenarioInteractionRuntime
|
|
2771
|
+
};
|
|
2772
|
+
if (this.destroyed) return;
|
|
2773
|
+
const l = i(t, this.config, c);
|
|
2774
|
+
if (this.destroyed) {
|
|
2775
|
+
l.unmount();
|
|
2776
|
+
return;
|
|
2777
|
+
}
|
|
2778
|
+
this.root = l;
|
|
2779
|
+
} catch (c) {
|
|
2780
|
+
throw this.releaseFontStyles === s && (s(), this.releaseFontStyles = null), c;
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2783
|
+
onAvatarReady = (t) => {
|
|
2784
|
+
if (!this.destroyed) {
|
|
2785
|
+
this.avatarLoadError = null, this.playAnimationImpl = t;
|
|
2786
|
+
for (const e of this.pendingAvatarAnimations) {
|
|
2787
|
+
if (window.clearTimeout(e.timeoutId), e.expiresAtMs !== void 0 && e.expiresAtMs <= Date.now()) {
|
|
2788
|
+
e.reject(new h("COMMAND_EXPIRED", "expired"));
|
|
2789
|
+
continue;
|
|
2790
|
+
}
|
|
2791
|
+
try {
|
|
2792
|
+
Promise.resolve(t(e.name)).then(
|
|
2793
|
+
e.resolve,
|
|
2794
|
+
e.reject
|
|
2795
|
+
);
|
|
2796
|
+
} catch (a) {
|
|
2797
|
+
e.reject(
|
|
2798
|
+
a instanceof Error ? a : new Error("Animation playback failed")
|
|
2799
|
+
);
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2802
|
+
this.pendingAvatarAnimations.clear();
|
|
2803
|
+
}
|
|
2804
|
+
};
|
|
2805
|
+
onAvatarLoadStarted = () => {
|
|
2806
|
+
const t = ++this.avatarLoadGeneration;
|
|
2807
|
+
return this.playAnimationImpl = null, this.avatarLoadError = null, {
|
|
2808
|
+
onAvatarReady: (e) => {
|
|
2809
|
+
t === this.avatarLoadGeneration && this.onAvatarReady(e);
|
|
2810
|
+
},
|
|
2811
|
+
onAvatarLoadFailed: (e) => {
|
|
2812
|
+
t === this.avatarLoadGeneration && this.onAvatarLoadFailed(e);
|
|
2813
|
+
}
|
|
2814
|
+
};
|
|
2815
|
+
};
|
|
2816
|
+
onAvatarLoadFailed = (t) => {
|
|
2817
|
+
if (this.destroyed) return;
|
|
2818
|
+
const e = t instanceof Error ? t : new Error("Avatar loading failed");
|
|
2819
|
+
this.playAnimationImpl = null, this.avatarLoadError = e;
|
|
2820
|
+
for (const a of this.pendingAvatarAnimations)
|
|
2821
|
+
window.clearTimeout(a.timeoutId), a.reject(e);
|
|
2822
|
+
this.pendingAvatarAnimations.clear(), f.error("Avatar loading failed", e);
|
|
2823
|
+
};
|
|
2824
|
+
playAvatarAnimation = (t, e) => {
|
|
2825
|
+
if (this.destroyed)
|
|
2826
|
+
return Promise.reject(new Error("Widget was destroyed"));
|
|
2827
|
+
const a = e ? Date.parse(e) : NaN, i = Number.isFinite(a) ? a : void 0;
|
|
2828
|
+
if (i !== void 0 && i <= Date.now())
|
|
2829
|
+
return Promise.reject(
|
|
2830
|
+
new h("COMMAND_EXPIRED", "expired")
|
|
2831
|
+
);
|
|
2832
|
+
if (this.avatarLoadError) return Promise.reject(this.avatarLoadError);
|
|
2833
|
+
if (this.playAnimationImpl)
|
|
2834
|
+
try {
|
|
2835
|
+
return Promise.resolve(this.playAnimationImpl(t));
|
|
2836
|
+
} catch (o) {
|
|
2837
|
+
return Promise.reject(
|
|
2838
|
+
o instanceof Error ? o : new Error("Animation playback failed")
|
|
2839
|
+
);
|
|
2840
|
+
}
|
|
2841
|
+
return new Promise((o, n) => {
|
|
2842
|
+
const s = i !== void 0 ? i - Date.now() : void 0, c = s !== void 0 ? Math.max(0, Math.min(ct, s)) : ct, l = {
|
|
2843
|
+
name: t,
|
|
2844
|
+
resolve: o,
|
|
2845
|
+
reject: n,
|
|
2846
|
+
timeoutId: 0,
|
|
2847
|
+
expiresAtMs: i
|
|
2848
|
+
};
|
|
2849
|
+
l.timeoutId = window.setTimeout(() => {
|
|
2850
|
+
this.pendingAvatarAnimations.delete(l), n(
|
|
2851
|
+
i !== void 0 && i <= Date.now() ? new h("COMMAND_EXPIRED", "expired") : new Error("Avatar readiness timed out")
|
|
2852
|
+
);
|
|
2853
|
+
}, c), this.pendingAvatarAnimations.add(l);
|
|
2854
|
+
});
|
|
2855
|
+
};
|
|
2856
|
+
onCommandStatus = (t) => {
|
|
2857
|
+
this.dispatchEvent(new CustomEvent(`command_${t.status}`, { detail: t }));
|
|
2858
|
+
};
|
|
2859
|
+
injectStyles(t) {
|
|
2860
|
+
const e = document.createElement("style");
|
|
2861
|
+
e.textContent = Pa, t.appendChild(e);
|
|
2862
|
+
}
|
|
2863
|
+
validateCustomerInteractionSession(t) {
|
|
2864
|
+
if (!t?.accessToken?.trim())
|
|
2865
|
+
throw new Error(
|
|
2866
|
+
"ChatWidget: customerInteractionSession.accessToken is invalid"
|
|
2867
|
+
);
|
|
2868
|
+
if (!t.interactionSessionId?.trim())
|
|
2869
|
+
throw new Error(
|
|
2870
|
+
"ChatWidget: customerInteractionSession.interactionSessionId is invalid"
|
|
2871
|
+
);
|
|
2872
|
+
if (!Da.test(t.expiresAt) || !Number.isFinite(Date.parse(t.expiresAt)))
|
|
2873
|
+
throw new Error(
|
|
2874
|
+
"ChatWidget: customerInteractionSession.expiresAt is invalid"
|
|
2875
|
+
);
|
|
2876
|
+
}
|
|
2877
|
+
//widget api for external use
|
|
2878
|
+
setOpen(t) {
|
|
2879
|
+
this.setOpenImpl ? this.setOpenImpl(t) : (this.pendingOpenState = t, f.debug(`setOpen(${t}) queued until the widget is initialized`));
|
|
2880
|
+
}
|
|
2881
|
+
setCustomerInteractionSession(t) {
|
|
2882
|
+
this.validateCustomerInteractionSession(t), this.onSessionExpired.cancel(), this.config.customerInteractionSession = t, this.clientEnvironmentRuntime.updateSession(t), this.scenarioInteractionRuntime.updateSession(t), this.commandRuntime.updateSession(t), this.setSessionImpl?.(t);
|
|
2883
|
+
}
|
|
2884
|
+
setLocale(t) {
|
|
2885
|
+
this.config.locale = t, this.setLocaleImpl?.(t);
|
|
2886
|
+
}
|
|
2887
|
+
track(t) {
|
|
2888
|
+
return this.destroyed ? Promise.resolve() : this.eventTracker.track(t);
|
|
2889
|
+
}
|
|
2890
|
+
destroy() {
|
|
2891
|
+
this.destroyed = !0;
|
|
2892
|
+
const t = new Error("Widget was destroyed");
|
|
2893
|
+
for (const e of this.pendingAvatarAnimations)
|
|
2894
|
+
window.clearTimeout(e.timeoutId), e.reject(t);
|
|
2895
|
+
this.pendingAvatarAnimations.clear(), this.onSessionExpired.cancel(), this.setOpenImpl = null, this.pendingOpenState = null, this.playAnimationImpl = null, this.setSessionImpl = null, this.setLocaleImpl = null, this.commandRuntime.destroy(), this.eventTracker.destroy(), this.clientEnvironmentRuntime.destroy(), this.scenarioInteractionRuntime.destroy(), this.disableDebugLogging?.(), this.disableDebugLogging = null, this.releaseFontStyles?.(), this.releaseFontStyles = null, this.root?.unmount?.(), this.shadowRoot.innerHTML = "", this.hostElement.remove();
|
|
2896
|
+
}
|
|
2897
|
+
}
|
|
2898
|
+
export {
|
|
2899
|
+
Va as C,
|
|
2900
|
+
Sa as E,
|
|
2901
|
+
M as L,
|
|
2902
|
+
La as P,
|
|
2903
|
+
Ia as S,
|
|
2904
|
+
Oa as a,
|
|
2905
|
+
za as b,
|
|
2906
|
+
qa as c,
|
|
2907
|
+
ja as d,
|
|
2908
|
+
Ua as g,
|
|
2909
|
+
Ha as i,
|
|
2910
|
+
f as l,
|
|
2911
|
+
Ma as n,
|
|
2912
|
+
Ke as o
|
|
2913
|
+
};
|