@tenancy.nz/chat-ui 0.1.32 → 0.1.33

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/esm/index.js CHANGED
@@ -14,7 +14,7 @@ var wn = (n, t, e, i) => ({
14
14
  }
15
15
  });
16
16
  import * as Ut from "react";
17
- import kt, { useState as fe, useCallback as Bn, isValidElement as Wy, cloneElement as Fm, useEffect as si, useMemo as ja, useRef as Ve } from "react";
17
+ import kt, { useState as fe, useCallback as Bn, isValidElement as Wy, cloneElement as Fm, useEffect as si, useMemo as ja, useRef as Fe } from "react";
18
18
  import * as Mf from "react-dom";
19
19
  import Jh, { createPortal as jx } from "react-dom";
20
20
  const WO = ':root{--bg: #f7f9fc;--panel: #ffffff;--text: #0b1324;--muted: #64748b;--accent: #1a73e8;--accent-2: #1a73e8;--danger: #e11d48;--border: #e5e7eb;--pdf-citations-width: 260px;--brand-blue: #0445B7;--brand-pink: #DB2C73;--brand-green: #0CC1A3}*{box-sizing:border-box}html,body{font-family:Montserrat,Inter,ui-sans-serif,system-ui;overflow-x:hidden;width:100%;margin:0}.app{display:grid;grid-template-rows:auto 1fr auto;min-height:100%}.app,.chat-container{overflow-x:hidden}.app-header{padding:16px 20px;border-bottom:1px solid var(--border);background:var(--panel);position:sticky;top:0}.app-header h1{margin:0;font-size:18px;letter-spacing:.2px;color:#111827}.app-header .subtitle{margin:4px 0 0;color:var(--muted);font-size:12px}.app-main{display:grid;grid-template-columns:1fr;padding:0}.app-footer{padding:10px 16px;color:var(--muted);border-top:1px solid var(--border);font-size:12px;background:var(--panel)}.chat-container{width:100%;max-width:none;background:var(--panel);border-top:1px solid var(--border);border-bottom:1px solid var(--border);border-radius:0;overflow:hidden;box-shadow:none}.chat-layout{display:grid;grid-template-columns:300px 1fr;height:calc(100vh - 65px);min-height:calc(100vh - 65px)}.sidebar{border-right:1px solid var(--border);background:#fff;padding:10px;display:flex;flex-direction:column;gap:10px}.sidebar-header{display:flex;align-items:center;justify-content:space-between;font-weight:600;color:#0f172a;padding:8px 20px 8px 12px;border-radius:12px;border:1px solid transparent;background:linear-gradient(#fff,#fff) padding-box,linear-gradient(180deg,#0445b7,#0cc1a3) border-box;margin-top:6px;margin-right:6px}.sidebar-new{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:linear-gradient(180deg,#0445b7,#0cc1a3);border:0;color:#fff;width:32px;height:32px;display:inline-grid;place-items:center;border-radius:9999px;cursor:pointer;font-size:18px;font-weight:700;box-shadow:0 0 #0445b738,0 6px 14px #0445b747;transition:transform .12s ease,box-shadow .12s ease,filter .12s ease}.sidebar-new:hover{transform:translateY(-1px);box-shadow:0 0 0 6px #0445b71f,0 8px 16px #0445b757;filter:saturate(110%)}.sidebar-new:active{transform:translateY(0);box-shadow:0 4px 10px #0445b738}.sidebar-new:focus-visible{outline:2px solid #7fb3ff;outline-offset:2px}.sr-only{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.thread-list{overflow-y:auto;overflow-x:hidden;display:grid;gap:6px;padding:6px 20px 26px 8px;box-sizing:border-box;scrollbar-gutter:stable both-edges;max-height:100vh}.thread-group{display:grid;gap:6px}.thread-group-title{color:#94a3b8;font-size:11px;padding:8px 6px 0;text-transform:uppercase;letter-spacing:.04em}.thread-empty{color:var(--muted);font-size:12px;padding:12px 8px}.sidebar-loading{padding:8px 6px;display:grid;gap:8px}.sidebar-error{padding:8px;border:1px solid #fecaca;background:#fff1f2;color:#7f1d1d;border-radius:8px;display:grid;gap:8px}.sidebar-error .sidebar-error-text{font-size:12px}.thread-item{display:flex;align-items:center;gap:12px;padding:12px 18px 12px 12px;border:none;background:none;color:var(--text);text-align:left;cursor:pointer;border-radius:12px;width:calc(100% - 6px);transition:all .2s ease;margin-right:6px;overflow:hidden}.thread-item:hover{background:#f1f5f9}.thread-item.active{background:#e0f2fe}.thread-icon{flex-shrink:0}.thread-text{flex:1;min-width:0;overflow:hidden;width:100%}.thread-title{display:block;font-size:14px;font-weight:600;color:var(--text);margin-bottom:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}.thread-date{font-size:12px;color:var(--accent);font-weight:500}.messages-main{display:flex;flex-direction:column;overflow:auto;position:relative;height:100vh;min-height:100vh}.messages{overflow:auto;padding:28px 40px 100px;display:flex;flex-direction:column;gap:20px;background:#fff;position:relative;margin:0 auto;overflow:visible;width:100%;max-width:1280px;min-height:100vh}.messages-loading{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;background:#fffc;-webkit-backdrop-filter:blur(2px) saturate(110%);backdrop-filter:blur(2px) saturate(110%);z-index:5;min-height:100vh}.messages-loading .loading-inner{display:inline-flex;align-items:center;gap:10px;padding:10px 14px;border-radius:999px;border:1px solid rgba(0,0,0,.06);background:#fff;box-shadow:0 8px 18px #00000014;color:#374151;font-size:13px}.messages-error{position:absolute;top:0;right:0;bottom:0;left:0;display:grid;place-items:center;background:#ffffffd9;-webkit-backdrop-filter:blur(2px) saturate(110%);backdrop-filter:blur(2px) saturate(110%);z-index:6}.messages-error .messages-error-card{display:grid;gap:10px;max-width:520px;width:calc(100% - 40px);padding:14px 16px;border-radius:12px;border:1px solid #fee2e2;background:#fff1f2;color:#7f1d1d;box-shadow:0 10px 24px #00000014;text-align:center}.messages-error .messages-error-text{font-size:14px}.messages-error .messages-error-actions{display:inline-flex;gap:8px;justify-content:center}.message{display:flex;gap:12px;align-items:flex-start;animation:messageSlideIn .3s ease-out;flex-wrap:wrap}.messages>:last-child{padding-bottom:200px}.message.user{flex-direction:row-reverse}.message.assistant{flex-direction:row}.message .msg-subdivider,.message .sources-copy,.message .sources-hud{flex-basis:100%}.message.assistant .msg-subdivider,.message.assistant .sources-copy,.message.assistant .sources-hud{flex:0 0 auto;align-self:flex-start;margin-left:40px;width:100%;max-width:min(72ch,calc(100% - 40px))}@keyframes messageSlideIn{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@media (max-width: 1100px) and (min-width: 641px){.message.assistant>.ai-avatar{flex:0 0 36px}.message.assistant>.bubble-plain{flex:1 1 0;min-width:0;max-width:calc(100% - 48px);overflow-wrap:anywhere;word-break:break-word}.message.user>.user-avatar,.message.user>.user-avatar-img{flex:0 0 36px}.message.user>.bubble{flex:1 1 auto;min-width:0;max-width:calc(100% - 48px)}}@media (max-width: 640px){.messages{height:calc(100dvh - 96px);padding:16px 12px 160px;scrollbar-gutter:stable both-edges;overscroll-behavior:contain}.message{gap:8px}.message.assistant>.ai-avatar{flex:0 0 36px}.message.assistant>.bubble-plain{flex:1 1 0;min-width:0;max-width:calc(100% - 44px);overflow-wrap:anywhere;word-break:break-word}.message.user>.user-avatar,.message.user>.user-avatar-img{flex:0 0 36px}.message.user>.bubble{flex:1 1 auto;min-width:0;max-width:calc(100% - 44px)!important}.message.assistant .msg-subdivider,.message.assistant .sources-copy,.message.assistant .sources-hud{margin-left:0;max-width:100%}.sources-hud{margin-top:8px}}.ai-avatar{flex-shrink:0;width:36px;height:36px;display:flex;align-items:center;justify-content:center;border-radius:50%;background:linear-gradient(135deg,#0445b7,#0cc1a3);border:1px solid rgba(255,255,255,.2);box-shadow:0 2px 8px #0445b726}.user-avatar,.user-avatar-img{flex-shrink:0;width:36px;height:36px;border-radius:50%;background:#fff;border:1px solid #e5e7eb;box-shadow:0 1px 3px #0000000f}.user-avatar{display:grid;place-items:center;color:#0b1324;font-weight:600;font-size:13px;background:transparent}.user-avatar-img{object-fit:cover}.bubble{max-width:80%;padding:12px 14px;border-radius:12px;line-height:1.6;white-space:normal;word-wrap:break-word;font-size:14px;color:#1f2937;font-family:Montserrat,Inter,ui-sans-serif,system-ui}.message.user .bubble{background:linear-gradient(#fff,#fff) padding-box,linear-gradient(180deg,#0445b7,#0cc1a3) border-box;color:#0b1324;border:1px solid transparent;border-bottom-right-radius:4px}.message.assistant .bubble{background:#fff;border:1px solid #e5e7eb;color:#0b1324;border-bottom-left-radius:4px}.message.assistant .bubble-plain{background:transparent;border:0;padding:0;max-width:72ch;font-size:14px;color:#0b1324;font-family:Montserrat,Inter,ui-sans-serif,system-ui;line-height:1.55;overflow-wrap:anywhere;word-break:break-word;min-width:0}.message.assistant .bubble-plain h1,.message.assistant .bubble-plain h2,.message.assistant .bubble-plain h3,.message.assistant .bubble-plain h4,.message.assistant .bubble-plain h5,.message.assistant .bubble-plain h6{color:#0b1324;font-weight:600}.message.assistant .bubble-plain p{color:#0b1324}.message.assistant .bubble-plain p,.bubble p{margin:0 0 8px}.bubble>*:first-child{margin-top:0}.bubble>*:last-child{margin-bottom:0}.bubble p{margin:0 0 8px}.bubble ul,.bubble ol{margin:8px 0 8px 18px;padding:0}.bubble li{margin:4px 0}.bubble h1,.bubble h2,.bubble h3,.bubble h4,.bubble h5,.bubble h6{margin:10px 0 6px;line-height:1.3}.bubble pre{margin:8px 0;padding:10px;background:#f8fafc;border:1px solid #e5e7eb;border-radius:8px;overflow:auto}.bubble code:not(pre code){background:#f3f4f6;padding:1px 4px;border-radius:4px}.bubble table{border-collapse:collapse;margin:8px 0}.bubble th,.bubble td{border:1px solid #e5e7eb;padding:6px 8px}.message.assistant .bubble-plain a{color:var(--accent);text-decoration:underline;text-underline-offset:2px}.message.assistant .bubble-plain{line-height:1.65}.message.assistant .bubble-plain p{margin:0 0 12px}.message.assistant .bubble-plain ul,.message.assistant .bubble-plain ol{margin:0 0 12px 20px;padding:0}.message.assistant .bubble-plain li+li{margin-top:4px}.message.assistant .bubble-plain blockquote{margin:12px 0;padding:10px 12px;border-left:4px solid #dbeafe;background:#f8fafc;color:#0b1324;border-radius:6px}.message.assistant .bubble-plain h1{font-size:20px;margin:0 0 16px}.message.assistant .bubble-plain h2{font-size:18px;margin:0 0 16px}.message.assistant .bubble-plain h3{font-size:16px;margin:14px 0 6px}.message.assistant .bubble-plain h4,.message.assistant .bubble-plain h5,.message.assistant .bubble-plain h6{font-size:14px;margin:0 0 16px}.message.assistant .bubble-plain pre{margin:12px 0;padding:12px;background:#0b132405;border:1px solid #e5e7eb;border-radius:8px;overflow:auto;-webkit-overflow-scrolling:touch}.message.assistant .bubble-plain code{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:12.5px}.message.assistant .bubble-plain table{width:100%;border-collapse:collapse;margin:12px 0}.message.assistant .bubble-plain th{background:#f3f4f6;font-weight:600}.message.assistant .bubble-plain th,.message.assistant .bubble-plain td{border:1px solid #e5e7eb;padding:6px 8px}.message.assistant .bubble-plain tr:nth-child(2n) td{background:#fafafa}.message.assistant .bubble-plain img{max-width:100%;height:auto;border-radius:6px}.message.assistant .bubble-plain hr{border:0;border-top:1px solid #e5e7eb;margin:14px 0}.avatar{width:28px;height:28px;border-radius:9999px;background:transparent;border:0;display:grid;place-items:center;color:var(--accent);font-size:14px;margin-top:3px}.avatar-star{transform:rotate(12deg)}.bubble-pending{opacity:.8;font-style:italic}.msg-toolbar{display:flex;align-items:center;gap:12px;margin-left:40px}.msg-divider{height:1px;background:#e5e7eb;flex:1}.btn-copy{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:8px;padding:4px 8px;font-size:12px;cursor:pointer;display:inline-flex;align-items:center;gap:6px}.btn-copy:hover{color:#111827;border-color:#cfd8e3}.sources-hud{margin-top:0;border:1px solid #dbe7ff;background:#f8fafc;padding:6px 6px 8px;border-radius:8px;width:100%}.sources-copy{display:flex;align-items:center;gap:6px;margin:0 0 6px}.msg-subdivider{height:1px;background:#f3f3f3;margin:10px 0 6px}.sources-header{display:flex;align-items:baseline;justify-content:space-between;gap:8px;margin-bottom:6px}.sources-title{font-size:10px;color:#6b7280;margin:0;text-transform:uppercase;letter-spacing:.04em}.sources-list{list-style:none;padding:0;margin:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:6px}.source-item{display:flex;align-items:center;gap:4px}.source-link{display:inline-flex;align-items:center;gap:6px;border:1px solid #e5e7eb;background:#fff;border-radius:8px;padding:6px 8px;font-size:11px;cursor:pointer;min-width:160px;max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.source-link:hover{border-color:#d1d5db;background:#f9fafb}.source-rank{font-weight:600;color:var(--accent)}.source-name{font-weight:500;color:#0b1324;overflow:hidden;text-overflow:ellipsis}.source-page{color:#6b7280}.source-score{margin-left:auto;font-variant-numeric:tabular-nums;color:#6b7280}.source-open{text-decoration:none;font-size:10px}.btn-copy-inline{border:0;background:transparent;padding:0;color:#1a73e8;display:inline-flex;align-items:center;gap:6px;font-size:12px}.btn-copy-inline:hover{text-decoration:underline}.message-divider{height:1px;background:#f3f3f3;margin:10px 0 2px 40px}.message.user{align-items:center;gap:8px}.user-bubble{background:#e8f0fe;border:1px solid #dbe7ff;color:#0b1324;box-shadow:0 1px 2px #0000000a,0 3px 10px #0445b71a}.user-avatar{width:36px;height:36px;border-radius:50%;background:linear-gradient(#e2e8f0,#e2e8f0) padding-box,linear-gradient(180deg,#0445b7,#0cc1a3) border-box;color:#274a9a;display:grid;place-items:center;font-size:13px;font-weight:600;font-family:Montserrat,Inter,ui-sans-serif,system-ui;border:1px solid transparent;flex-shrink:0}.user-avatar-img{width:36px;height:36px;border-radius:50%;object-fit:cover;display:inline-block;flex-shrink:0}.modal{position:fixed;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;padding:2vh 2vw;z-index:1000;visibility:hidden;opacity:0;pointer-events:none;background:#ffffff8c;-webkit-backdrop-filter:blur(8px) saturate(120%);backdrop-filter:blur(8px) saturate(120%);transition:opacity .12s ease-in-out,visibility .12s ease-in-out}.modal.open{visibility:visible;opacity:1;pointer-events:auto}.modal-content{background:#fff;width:min(92vw,800px);max-width:min(92vw,800px);max-height:680px;border:1px solid #e5e7eb;border-radius:12px;box-shadow:0 8px 24px #0000001f;overflow:hidden;display:flex;flex-direction:column}.modal-header{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid rgba(0,0,0,.06)}.modal-title{font-weight:600;color:#111827}.modal-close{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;color:#6b7280;border:0;font-size:20px;line-height:1;width:28px;height:28px;display:inline-grid;place-items:center;border-radius:6px;cursor:pointer}.modal-body{height:680px;overflow:hidden;position:relative;padding:0}.modal-body.panning{cursor:grabbing}.pdf-stage canvas{display:block}.pdf-viewer{position:relative;min-height:320px}.pdf-blocker{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;background:#fff;z-index:5}.pdf-loading{display:flex;align-items:center;justify-content:center;height:320px}.spinner{width:28px;height:28px;border:3px solid #e5e7eb;border-top-color:var(--accent);border-radius:50%;animation:spin .9s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.composer{padding:0;background:transparent;position:fixed;width:calc(100% - 540px);bottom:30px}.composer-field{position:relative;display:flex;align-items:stretch;gap:0;max-width:1280px;margin:0 auto;padding:0 40px}.composer-field textarea{flex:1;padding:14px 18px;border:1px solid var(--border);border-radius:12px 0 0 12px;border-right:0;background:var(--bg);color:var(--text);font-size:15px;line-height:1.4;resize:none;outline:none;font-family:inherit;max-height:80px;min-height:48px;transition:all .2s ease}.composer-field textarea:focus{border-color:var(--accent)}.composer-field:focus-within textarea{border-color:var(--accent)}.composer-field:focus-within .composer-send{border-color:var(--accent)}.composer-send:hover{border-color:var(--accent)}.composer-field textarea::placeholder{color:var(--muted)}.composer-send{padding:0 14px;border:1px solid var(--border);border-left:0;border-radius:0 12px 12px 0;background:#0e0044;color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s ease;min-width:48px;height:auto;align-self:stretch}.composer .composer-send{background:#0e0044!important;color:#fff!important;-webkit-appearance:none;-moz-appearance:none;appearance:none}.composer-send:hover:not(:disabled){background:#160060;transform:translateY(-1px);box-shadow:0 4px 12px #0e004459}.composer-send:disabled{background:#0e0044;opacity:.6;cursor:not-allowed;transform:none;box-shadow:none}.empty-hero{display:grid;place-items:center;margin-top:0;min-height:calc(100% - 56px);width:100%;overflow-x:visible;max-width:100vw}.empty-hero-inner{text-align:center;max-width:min(900px,100%);width:100%;margin:0 auto;animation:heroIn .6s cubic-bezier(.22,.61,.36,1) both;overflow:visible;max-width:100vw}.empty-hero-logo{position:relative;display:flex;justify-content:center;align-items:center;margin-bottom:16px;overflow:visible;z-index:0}.empty-hero-logo svg{width:clamp(112px,17.6vw,176px);height:auto;overflow:visible;filter:drop-shadow(0 10px 24px rgba(4,69,183,.18))}.empty-hero-logo>svg,.empty-hero-logo svg{position:relative;z-index:0}.empty-hero h1,.empty-hero p,.empty-hero .chip-row{position:relative;z-index:2}.empty-hero-logo svg>g{transform-box:view-box;transform-origin:center;transform:rotate(var(--g, 0deg));will-change:transform}.empty-hero h1{margin:0;font-family:Montserrat,Inter,ui-sans-serif;font-weight:800;color:#0b1324;font-size:36px;letter-spacing:.2px}.empty-hero h1.typewriter{display:block;max-width:100%;width:100%;overflow:visible;contain:layout paint}.empty-hero h1.typewriter span{display:inline-block;white-space:nowrap;overflow:hidden;width:0ch;position:relative;padding-right:0;--caret-opacity: 1;--chars: 23;box-shadow:none;animation:typing 2.6s steps(var(--chars),end) forwards,caretBlink 2.6s step-end 1 both,postType 1ms linear 2.6s forwards,shineSlide 8s ease-in-out infinite;background:linear-gradient(90deg,var(--brand-pink) 0%,var(--brand-blue) 100%);-webkit-background-clip:text;background-clip:text;color:transparent;-webkit-text-fill-color:transparent;background-size:300% 100%}.empty-hero h1.typewriter span:after{content:"";position:absolute;right:0;top:0;bottom:0;width:2px;background:var(--text);opacity:var(--caret-opacity);z-index:1}.empty-hero p{margin:0 0 24px;color:#64748b;font-size:16px}@keyframes typing{0%{width:0ch}to{width:calc(var(--chars) * 1ch)}}@keyframes caretBlink{0%,to{--caret-opacity: 1}50%{--caret-opacity: 0}}@keyframes postType{to{white-space:normal;width:auto;max-width:100%;overflow:visible;--caret-opacity: 0}}@keyframes shineSlide{0%{background-position:200% 0}to{background-position:-100% 0}}@keyframes heroIn{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion: reduce){.empty-hero h1.typewriter span{animation:none;width:auto;border-right:0}.empty-hero-inner{animation:none}}@media (max-width: 640px){.empty-hero h1.typewriter{overflow:visible}.empty-hero h1.typewriter span{animation:shineSlide 8s ease-in-out infinite;width:auto;max-width:100%;white-space:normal;padding-right:0}.empty-hero h1.typewriter span:after{display:none}}.chip-row{display:flex;flex-wrap:wrap;gap:10px;justify-content:center;max-width:800px;margin:0 auto}.chip{transition:transform .14s ease,box-shadow .14s ease,filter .14s ease}.chip:hover{transform:translateY(-1px);box-shadow:0 10px 24px #0445b724;filter:saturate(108%)}.chip:active{transform:translateY(0);box-shadow:0 6px 14px #0445b71f}.chip{-webkit-appearance:none;-moz-appearance:none;appearance:none;color:#0b1324;border-radius:9999px;padding:8px 14px;font-size:13px;cursor:pointer;border:1px solid transparent;box-shadow:0 1px 2px #00000005;background:linear-gradient(#fff,#fff) padding-box,linear-gradient(180deg,#0445b7,#0cc1a3) border-box;font-family:Montserrat,Inter,ui-sans-serif,system-ui;transition:transform .15s ease,box-shadow .15s ease;animation:chipIn .5s ease-out both}.chip:hover{transform:translateY(-1px);box-shadow:0 3px 8px #0000000f}.chip:active{transform:translateY(0);box-shadow:0 1px 2px #00000008}@keyframes chipIn{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}.chip-row .chip:nth-child(1){animation-delay:.02s}.chip-row .chip:nth-child(2){animation-delay:.06s}.chip-row .chip:nth-child(3){animation-delay:.1s}.chip-row .chip:nth-child(4){animation-delay:.14s}.chip-row .chip:nth-child(5){animation-delay:.18s}.chip:hover{background:linear-gradient(#f8fbff,#f8fbff) padding-box,linear-gradient(180deg,#0445b7,#0cc1a3) border-box}.skeleton{position:relative;overflow:hidden;background:#f3f4f6}.skeleton:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;transform:translate(-100%);background:linear-gradient(90deg,#fff0,#fff9,#fff0);animation:shimmer 1.2s infinite}@keyframes shimmer{to{transform:translate(100%)}}.skeleton-line{height:12px;border-radius:6px;margin:8px 0}.skeleton-line.sm{height:10px}.skeleton-line.lg{height:14px}.w40{width:40%}.w60{width:60%}.w80{width:80%}.w100{width:100%}.pdf-thumbs{width:130px;min-width:110px;max-width:160px;border-left:1px solid #eef2f7;background:#fbfbfb;overflow:auto}.pdf-thumbs-list{list-style:none;margin:0;padding:8px;display:grid;gap:8px}.pdf-thumb{display:grid;gap:6px;width:100%;border:1px solid #e5e7eb;background:#fff;border-radius:8px;padding:6px;cursor:pointer}.pdf-thumb.active{outline:2px solid #1a73e8;outline-offset:0}.pdf-thumb img{display:block;width:100%;height:auto;border-radius:4px}.thumb-label{font-size:11px;color:#6b7280;justify-self:center}.thumb-skeleton{background:#f3f4f6;border-radius:6px;position:relative;overflow:hidden}.thumb-skeleton:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;transform:translate(-100%);background:linear-gradient(90deg,#fff0,#fff9,#fff0);animation:shimmer 1.2s infinite}.pdf-citations{flex:0 0 var(--pdf-citations-width);width:var(--pdf-citations-width);border-right:1px solid #eef2f7;background:#fbfbfb;overflow-y:auto;overflow-x:hidden;padding:8px 12px 12px 8px;box-sizing:border-box}.pdf-citations *{max-width:100%;word-break:break-word}.pdf-container{display:flex;width:100%;height:100%;gap:0}.pdf-content{flex:1;min-width:0;overflow:hidden;padding:0 16px}.pdf-toolbar{position:sticky;bottom:0;z-index:5;display:flex;align-items:center;justify-content:space-between;gap:12px;background:#fff;border-top:1px solid rgba(0,0,0,.06);box-shadow:0 -4px 8px #00000008;padding:8px 12px}.pdf-toolbar-left{display:flex;gap:8px}.pdf-btn{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:linear-gradient(180deg,#fff,#f7f7f7);border:1px solid rgba(0,0,0,.12);color:#111827;width:34px;height:34px;display:inline-grid;place-items:center;border-radius:8px;cursor:pointer}.pdf-btn:disabled{opacity:.5;cursor:not-allowed}.pdf-page-label{font-size:13px;color:#374151}.typing-hud{display:flex;justify-content:flex-start;align-items:flex-start;margin:16px 0;animation:typingSlideIn .3s ease-out}.typing-hud-inner{display:inline-flex;align-items:center;gap:8px;padding:6px 12px;border-radius:999px;border:1px solid rgba(0,0,0,.06);background:#fff;box-shadow:0 8px 18px #00000014;color:#374151;font-size:13px}.typing-dot{width:10px;height:10px;border-radius:50%;background:linear-gradient(180deg,#5446e6,#1a73e8);box-shadow:0 0 0 2px #1a73e81f;animation:pulseDot 1.4s ease-in-out infinite}.typing-text{opacity:.9}@keyframes typingSlideIn{0%{opacity:0;transform:translate(-50%) translateY(10px) scale(.95)}to{opacity:1;transform:translate(-50%) translateY(0) scale(1)}}@keyframes pulseDot{0%,80%,to{transform:scale(.8);opacity:.5}40%{transform:scale(1.2);opacity:1}}.pdf-sources{width:100%}.pdf-sources-title{padding:10px 10px 6px;font-size:12px;font-weight:600;color:#374151}.pdf-sources-list{list-style:none;margin:0;padding:0 12px 12px 8px;display:flex;flex-direction:column;gap:8px;box-sizing:border-box}.pdf-source-item{display:flex;width:100%;text-align:left;gap:8px;padding:10px 12px;border-radius:8px;border:1px solid rgba(0,0,0,.08);background:transparent;color:#111827;cursor:pointer}.pdf-source-item.active{background:#1976d214}.pdf-source-rank{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:6px;background:linear-gradient(180deg,#fff,#f7f7f7);border:1px solid rgba(0,0,0,.12);font-size:12px;color:#374151}.pdf-source-text{display:inline-block;overflow:hidden}.pdf-source-filename{display:block;font-size:12px;font-weight:600;color:#111827}.pdf-source-page{display:block;font-size:11px;color:#6b7280}.pdf-source-snippet{display:block;font-size:11px;color:#6b7280;margin-top:2px;max-width:200px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@media (max-width: 1280px){.modal-content{width:95vw}}@media (max-width: 1024px){.pdf-thumbs,.pdf-citations{display:none}.modal-content{width:96vw;height:92vh}}@media (max-width: 640px){.modal-content{width:98vw;height:92vh;border-radius:10px}}@media (max-width: 900px){.chat-layout{grid-template-columns:1fr;position:relative}.sidebar{position:fixed;top:0;bottom:0;left:0;width:min(86vw,320px);max-width:92vw;transform:translate(-100%);transition:transform .2s ease-in-out;z-index:1000;box-shadow:0 10px 30px #0000002e}.chat-container.drawer-open .sidebar{transform:translate(0)}.drawer-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background:#0000005c;-webkit-backdrop-filter:saturate(120%) blur(2px);backdrop-filter:saturate(120%) blur(2px);z-index:900}.mobile-bar{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--border);background:#fff;position:sticky;top:0;z-index:10}.sidebar-toggle{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:#fff;color:#111827;border:1px solid #e5e7eb;border-radius:8px;width:36px;height:36px;display:inline-grid;place-items:center;cursor:pointer}}@media (min-width: 901px){.mobile-bar{display:none}}.older-messages{display:flex;justify-content:center;margin:8px 0}.toasts{position:fixed;top:16px;right:16px;display:grid;gap:8px;z-index:2000}.toast{background:#111827;color:#fff;border-radius:8px;padding:10px 12px;font-size:13px;box-shadow:0 10px 20px #0003}.toast.error{background:#b91c1c}.toast.success{background:#065f46}';
@@ -307,7 +307,7 @@ function Bx() {
307
307
  var V = P.prototype;
308
308
  return !!(V && V.isReactComponent);
309
309
  }
310
- function ze(P, V, it) {
310
+ function Be(P, V, it) {
311
311
  if (P == null)
312
312
  return "";
313
313
  if (typeof P == "function")
@@ -325,11 +325,11 @@ function Bx() {
325
325
  case l:
326
326
  return ve(P.render);
327
327
  case d:
328
- return ze(P.type, V, it);
328
+ return Be(P.type, V, it);
329
329
  case f: {
330
330
  var At = P, Xt = At._payload, Jt = At._init;
331
331
  try {
332
- return ze(Jt(Xt), V, it);
332
+ return Be(Jt(Xt), V, it);
333
333
  } catch {
334
334
  }
335
335
  }
@@ -339,7 +339,7 @@ function Bx() {
339
339
  var ge = Object.prototype.hasOwnProperty, ci = {}, Ei = b.ReactDebugCurrentFrame;
340
340
  function oe(P) {
341
341
  if (P) {
342
- var V = P._owner, it = ze(P.type, P._source, V ? V.type : null);
342
+ var V = P._owner, it = Be(P.type, P._source, V ? V.type : null);
343
343
  Ei.setExtraStackFrame(it);
344
344
  } else
345
345
  Ei.setExtraStackFrame(null);
@@ -484,7 +484,7 @@ function Bx() {
484
484
  var he = b.ReactCurrentOwner, kr = b.ReactDebugCurrentFrame;
485
485
  function _r(P) {
486
486
  if (P) {
487
- var V = P._owner, it = ze(P.type, P._source, V ? V.type : null);
487
+ var V = P._owner, it = Be(P.type, P._source, V ? V.type : null);
488
488
  kr.setExtraStackFrame(it);
489
489
  } else
490
490
  kr.setExtraStackFrame(null);
@@ -510,7 +510,7 @@ Check the render method of \`` + P + "`.";
510
510
  return "";
511
511
  }
512
512
  var Un = {};
513
- function Be(P) {
513
+ function $e(P) {
514
514
  {
515
515
  var V = zt();
516
516
  if (!V) {
@@ -527,7 +527,7 @@ Check the top-level render call using <` + it + ">.");
527
527
  if (!P._store || P._store.validated || P.key != null)
528
528
  return;
529
529
  P._store.validated = !0;
530
- var it = Be(V);
530
+ var it = $e(V);
531
531
  if (Un[it])
532
532
  return;
533
533
  Un[it] = !0;
@@ -1440,14 +1440,14 @@ function L1() {
1440
1440
  case d:
1441
1441
  return ue;
1442
1442
  default:
1443
- var ze = ue && ue.$$typeof;
1444
- switch (ze) {
1443
+ var Be = ue && ue.$$typeof;
1444
+ switch (Be) {
1445
1445
  case a:
1446
1446
  case h:
1447
1447
  case g:
1448
1448
  case p:
1449
1449
  case o:
1450
- return ze;
1450
+ return Be;
1451
1451
  default:
1452
1452
  return ve;
1453
1453
  }
@@ -5375,26 +5375,26 @@ const R0 = "chatui_tour_done_v1", HS = () => {
5375
5375
  function WS() {
5376
5376
  const [n, t] = fe(HS());
5377
5377
  si(() => {
5378
- const a = () => t(!0);
5379
- return window.addEventListener("start-chat-tour", a), () => window.removeEventListener("start-chat-tour", a);
5378
+ const l = () => t(!0);
5379
+ return window.addEventListener("start-chat-tour", l), () => window.removeEventListener("start-chat-tour", l);
5380
5380
  }, []), si(() => {
5381
- var u;
5381
+ var h;
5382
5382
  if (!n) return;
5383
- const a = "tour-overflow-fix";
5384
- let l = document.getElementById(a);
5385
- l || (l = document.createElement("style"), l.id = a, l.textContent = ".messages-main{overflow:auto !important;}", document.head.appendChild(l));
5383
+ const l = "tour-overflow-fix";
5384
+ let u = document.getElementById(l);
5385
+ u || (u = document.createElement("style"), u.id = l, u.textContent = ".messages-main{overflow:auto !important;}", document.head.appendChild(u));
5386
5386
  try {
5387
- (u = document.querySelector(".messages-main")) == null || u.style.removeProperty("overflow");
5387
+ (h = document.querySelector(".messages-main")) == null || h.style.removeProperty("overflow");
5388
5388
  } catch {
5389
5389
  }
5390
5390
  return () => {
5391
- var h;
5391
+ var d;
5392
5392
  try {
5393
- l && l.remove();
5393
+ u && u.remove();
5394
5394
  } catch {
5395
5395
  }
5396
5396
  try {
5397
- (h = document.querySelector(".messages-main")) == null || h.style.removeProperty("overflow");
5397
+ (d = document.querySelector(".messages-main")) == null || d.style.removeProperty("overflow");
5398
5398
  } catch {
5399
5399
  }
5400
5400
  };
@@ -5439,68 +5439,73 @@ function WS() {
5439
5439
  content: "Create a fresh conversation anytime to keep topics organized.",
5440
5440
  placement: "right"
5441
5441
  }
5442
- ], []), i = ja(() => {
5443
- const a = (u) => {
5442
+ ], []), i = Fe(null), r = ja(() => {
5443
+ var d, f;
5444
+ const l = ((f = (d = i.current) == null ? void 0 : d.getRootNode) == null ? void 0 : f.call(d)) || document, u = (p) => {
5445
+ var g;
5444
5446
  try {
5445
- return !!document.querySelector(u);
5447
+ return ((g = l.querySelector) == null ? void 0 : g.call(l, p)) ?? null;
5446
5448
  } catch {
5447
- return !1;
5449
+ return null;
5448
5450
  }
5449
- };
5450
- return e.map((u, h) => {
5451
- const d = typeof u.target == "string" ? u.target : "";
5452
- return d && a(d) ? u : (console.debug("[tour] step", h, "missing target:", d, "-> fallback to .chat-container"), { ...u, target: ".chat-container", placement: "center" });
5451
+ }, h = u(".chat-container") || i.current;
5452
+ return e.map((p, g) => {
5453
+ const m = typeof p.target == "string" ? p.target : "", v = m ? u(m) : null;
5454
+ return v ? { ...p, target: v } : (console.debug("[tour] step", g, "missing target in root:", m, "-> fallback to chat container"), { ...p, target: h ?? document.body, placement: "center" });
5453
5455
  });
5454
- }, [e, n]), r = Bn((a) => {
5455
- var h;
5456
- const { status: l } = a;
5457
- if (l === Nt.FINISHED || l === Nt.SKIPPED) {
5456
+ }, [e, n]), s = Bn((l) => {
5457
+ var d;
5458
+ const { status: u } = l;
5459
+ if (u === Nt.FINISHED || u === Nt.SKIPPED) {
5458
5460
  US(), t(!1);
5459
5461
  try {
5460
- (h = document.querySelector(".messages-main")) == null || h.style.removeProperty("overflow");
5462
+ (d = document.querySelector(".messages-main")) == null || d.style.removeProperty("overflow");
5461
5463
  } catch {
5462
5464
  }
5463
5465
  }
5464
- }, []), [s, o] = fe(!1);
5466
+ }, []), [o, a] = fe(!1);
5465
5467
  return si(() => {
5466
5468
  if (!n) {
5467
- o(!1);
5469
+ a(!1);
5468
5470
  return;
5469
5471
  }
5470
- let a = 0, l = 0;
5471
- return a = requestAnimationFrame(() => {
5472
- l = requestAnimationFrame(() => o(!0));
5472
+ let l = 0, u = 0;
5473
+ return l = requestAnimationFrame(() => {
5474
+ u = requestAnimationFrame(() => a(!0));
5473
5475
  }), () => {
5474
5476
  try {
5475
- cancelAnimationFrame(a);
5477
+ cancelAnimationFrame(l);
5476
5478
  } catch {
5477
5479
  }
5478
5480
  try {
5479
- cancelAnimationFrame(l);
5481
+ cancelAnimationFrame(u);
5480
5482
  } catch {
5481
5483
  }
5482
5484
  };
5483
- }, [n]), /* @__PURE__ */ I.jsx(I.Fragment, { children: n && s && /* @__PURE__ */ I.jsx(
5484
- $S,
5485
- {
5486
- steps: i,
5487
- run: n,
5488
- continuous: !0,
5489
- showSkipButton: !0,
5490
- showProgress: !0,
5491
- disableOverlayClose: !0,
5492
- disableScrolling: !0,
5493
- scrollToFirstStep: !0,
5494
- styles: {
5495
- options: {
5496
- primaryColor: "#0445B7",
5497
- zIndex: 1e4
5498
- }
5499
- },
5500
- spotlightClicks: !0,
5501
- callback: r
5502
- }
5503
- ) });
5485
+ }, [n]), /* @__PURE__ */ I.jsxs(I.Fragment, { children: [
5486
+ /* @__PURE__ */ I.jsx("span", { ref: i, style: { position: "absolute", inset: 0, pointerEvents: "none" }, "aria-hidden": !0 }),
5487
+ n && o && /* @__PURE__ */ I.jsx(
5488
+ $S,
5489
+ {
5490
+ steps: r,
5491
+ run: n,
5492
+ continuous: !0,
5493
+ showSkipButton: !0,
5494
+ showProgress: !0,
5495
+ disableOverlayClose: !0,
5496
+ disableScrolling: !0,
5497
+ scrollToFirstStep: !0,
5498
+ styles: {
5499
+ options: {
5500
+ primaryColor: "#0445B7",
5501
+ zIndex: 1e4
5502
+ }
5503
+ },
5504
+ spotlightClicks: !0,
5505
+ callback: s
5506
+ }
5507
+ )
5508
+ ] });
5504
5509
  }
5505
5510
  function VS(n, t) {
5506
5511
  const e = {};
@@ -9518,7 +9523,7 @@ function eC(n) {
9518
9523
  autolink: s(oe),
9519
9524
  autolinkProtocol: B,
9520
9525
  autolinkEmail: B,
9521
- atxHeading: s(ze),
9526
+ atxHeading: s(Be),
9522
9527
  blockQuote: s(bt),
9523
9528
  characterEscape: B,
9524
9529
  characterReference: B,
@@ -9553,7 +9558,7 @@ function eC(n) {
9553
9558
  referenceString: o,
9554
9559
  resourceDestinationString: o,
9555
9560
  resourceTitleString: o,
9556
- setextHeading: s(ze),
9561
+ setextHeading: s(Be),
9557
9562
  strong: s(oc),
9558
9563
  thematicBreak: s(Xi)
9559
9564
  },
@@ -9950,7 +9955,7 @@ function eC(n) {
9950
9955
  children: []
9951
9956
  };
9952
9957
  }
9953
- function ze() {
9958
+ function Be() {
9954
9959
  return {
9955
9960
  type: "heading",
9956
9961
  // @ts-expect-error `depth` will be set later.
@@ -14549,7 +14554,7 @@ const mn = typeof process == "object" && process + "" == "[object process]" && !
14549
14554
  GRAYSCALE_1BPP: 1,
14550
14555
  RGB_24BPP: 2,
14551
14556
  RGBA_32BPP: 3
14552
- }, $e = {
14557
+ }, He = {
14553
14558
  TEXT: 1,
14554
14559
  LINK: 2,
14555
14560
  FREETEXT: 3,
@@ -14689,7 +14694,7 @@ function Rt(n) {
14689
14694
  function le(n) {
14690
14695
  throw new Error(n);
14691
14696
  }
14692
- function Fe(n, t) {
14697
+ function je(n, t) {
14693
14698
  n || le(t);
14694
14699
  }
14695
14700
  function $R(n) {
@@ -15648,13 +15653,13 @@ const Jd = class Jd {
15648
15653
  };
15649
15654
  ft(Jd, "_colorsMapping", /* @__PURE__ */ new Map([["CanvasText", [0, 0, 0]], ["Canvas", [255, 255, 255]]]));
15650
15655
  let zp = Jd;
15651
- var qa, Vn, Ue, tn, Ga, Mr, Ya, di, vs, bo, Xa, yo, nr, Pi, vo, ou, au, Ka, lu, ir, ws, Ja, xs, rr, Qd, As, cu, Ss, wo, uu, hu, Ye, ne, Lr, xo, du, fu, Es, sr, Dr, pu, fi, et, sd, Bp, qv, Gv, od, Yv, Xv, Kv, $p, Jv, Hp, Up, Qv, xn, Pr, Zv, tw, Wp, ew, Ec, Vp;
15656
+ var qa, Vn, We, tn, Ga, Mr, Ya, di, vs, bo, Xa, yo, nr, Pi, vo, ou, au, Ka, lu, ir, ws, Ja, xs, rr, Qd, As, cu, Ss, wo, uu, hu, Ye, ne, Lr, xo, du, fu, Es, sr, Dr, pu, fi, et, sd, Bp, qv, Gv, od, Yv, Xv, Kv, $p, Jv, Hp, Up, Qv, xn, Pr, Zv, tw, Wp, ew, Ec, Vp;
15652
15657
  const za = class za {
15653
15658
  constructor(t, e, i, r, s, o, a, l, u, h, d, f, p) {
15654
15659
  x(this, et);
15655
15660
  x(this, qa, new AbortController());
15656
15661
  x(this, Vn, null);
15657
- x(this, Ue, /* @__PURE__ */ new Map());
15662
+ x(this, We, /* @__PURE__ */ new Map());
15658
15663
  x(this, tn, /* @__PURE__ */ new Map());
15659
15664
  x(this, Ga, null);
15660
15665
  x(this, Mr, null);
@@ -15779,7 +15784,7 @@ const za = class za {
15779
15784
  (t = c(this, fi)) == null || t.resolve(), y(this, fi, null), (e = c(this, qa)) == null || e.abort(), y(this, qa, null), this._signal = null;
15780
15785
  for (const o of c(this, tn).values())
15781
15786
  o.destroy();
15782
- c(this, tn).clear(), c(this, Ue).clear(), c(this, vo).clear(), y(this, Vn, null), c(this, ne).clear(), c(this, di).destroy(), (i = c(this, Ga)) == null || i.destroy(), (r = c(this, rr)) == null || r.hide(), y(this, rr, null), c(this, ir) && (clearTimeout(c(this, ir)), y(this, ir, null)), c(this, sr) && (clearTimeout(c(this, sr)), y(this, sr, null)), (s = this._editorUndoBar) == null || s.destroy();
15787
+ c(this, tn).clear(), c(this, We).clear(), c(this, vo).clear(), y(this, Vn, null), c(this, ne).clear(), c(this, di).destroy(), (i = c(this, Ga)) == null || i.destroy(), (r = c(this, rr)) == null || r.hide(), y(this, rr, null), c(this, ir) && (clearTimeout(c(this, ir)), y(this, ir, null)), c(this, sr) && (clearTimeout(c(this, sr)), y(this, sr, null)), (s = this._editorUndoBar) == null || s.destroy();
15783
15788
  }
15784
15789
  combinedSignal(t) {
15785
15790
  return AbortSignal.any([this._signal, t.signal]);
@@ -16102,7 +16107,7 @@ const za = class za {
16102
16107
  i && this.addNewEditorFromKeyboard(), c(this, fi).resolve();
16103
16108
  return;
16104
16109
  }
16105
- for (const s of c(this, Ue).values())
16110
+ for (const s of c(this, We).values())
16106
16111
  s.annotationElementId === e ? (this.setSelected(s), s.enterInEditMode()) : s.unselect();
16107
16112
  c(this, fi).resolve();
16108
16113
  }
@@ -16147,7 +16152,7 @@ const za = class za {
16147
16152
  }
16148
16153
  showAllEditors(t, e, i = !1) {
16149
16154
  var s;
16150
- for (const o of c(this, Ue).values())
16155
+ for (const o of c(this, We).values())
16151
16156
  o.editorType === t && o.show(e);
16152
16157
  (((s = c(this, du)) == null ? void 0 : s.get($t.HIGHLIGHT_SHOW_ALL)) ?? !0) !== e && A(this, et, Pr).call(this, [[$t.HIGHLIGHT_SHOW_ALL, e]]);
16153
16158
  }
@@ -16160,21 +16165,21 @@ const za = class za {
16160
16165
  }
16161
16166
  getEditors(t) {
16162
16167
  const e = [];
16163
- for (const i of c(this, Ue).values())
16168
+ for (const i of c(this, We).values())
16164
16169
  i.pageIndex === t && e.push(i);
16165
16170
  return e;
16166
16171
  }
16167
16172
  getEditor(t) {
16168
- return c(this, Ue).get(t);
16173
+ return c(this, We).get(t);
16169
16174
  }
16170
16175
  addEditor(t) {
16171
- c(this, Ue).set(t.id, t);
16176
+ c(this, We).set(t.id, t);
16172
16177
  }
16173
16178
  removeEditor(t) {
16174
16179
  var e;
16175
16180
  t.div.contains(document.activeElement) && (c(this, ir) && clearTimeout(c(this, ir)), y(this, ir, setTimeout(() => {
16176
16181
  this.focusMainContainer(), y(this, ir, null);
16177
- }, 0))), c(this, Ue).delete(t.id), this.unselect(t), (!t.annotationElementId || !c(this, yo).has(t.annotationElementId)) && ((e = c(this, Mr)) == null || e.remove(t.id));
16182
+ }, 0))), c(this, We).delete(t.id), this.unselect(t), (!t.annotationElementId || !c(this, yo).has(t.annotationElementId)) && ((e = c(this, Mr)) == null || e.remove(t.id));
16178
16183
  }
16179
16184
  addDeletedAnnotationElement(t) {
16180
16185
  c(this, yo).add(t.annotationElementId), this.addChangedExistingAnnotation(t), t.deleted = !0;
@@ -16287,7 +16292,7 @@ const za = class za {
16287
16292
  selectAll() {
16288
16293
  for (const t of c(this, ne))
16289
16294
  t.commit();
16290
- A(this, et, Vp).call(this, c(this, Ue).values());
16295
+ A(this, et, Vp).call(this, c(this, We).values());
16291
16296
  }
16292
16297
  unselectAll() {
16293
16298
  var t;
@@ -16308,11 +16313,11 @@ const za = class za {
16308
16313
  y(this, sr, null), c(this, Es)[0] = c(this, Es)[1] = 0, this.addCommands({
16309
16314
  cmd: () => {
16310
16315
  for (const l of o)
16311
- c(this, Ue).has(l.id) && l.translateInPage(r, s);
16316
+ c(this, We).has(l.id) && l.translateInPage(r, s);
16312
16317
  },
16313
16318
  undo: () => {
16314
16319
  for (const l of o)
16315
- c(this, Ue).has(l.id) && l.translateInPage(-r, -s);
16320
+ c(this, We).has(l.id) && l.translateInPage(-r, -s);
16316
16321
  },
16317
16322
  mustExec: !1
16318
16323
  });
@@ -16350,7 +16355,7 @@ const za = class za {
16350
16355
  if (!e)
16351
16356
  return !1;
16352
16357
  const i = (r, s, o, a) => {
16353
- if (c(this, Ue).has(r.id)) {
16358
+ if (c(this, We).has(r.id)) {
16354
16359
  const l = c(this, tn).get(a);
16355
16360
  l ? r._setParentAndPosition(l, s, o) : (r.pageIndex = a, r.x = s, r.y = o);
16356
16361
  }
@@ -16486,7 +16491,7 @@ const za = class za {
16486
16491
  i && (c(this, Ye) === Pt.NONE && !i.hasBeenModified || i.renderAnnotationElement(t));
16487
16492
  }
16488
16493
  };
16489
- qa = new WeakMap(), Vn = new WeakMap(), Ue = new WeakMap(), tn = new WeakMap(), Ga = new WeakMap(), Mr = new WeakMap(), Ya = new WeakMap(), di = new WeakMap(), vs = new WeakMap(), bo = new WeakMap(), Xa = new WeakMap(), yo = new WeakMap(), nr = new WeakMap(), Pi = new WeakMap(), vo = new WeakMap(), ou = new WeakMap(), au = new WeakMap(), Ka = new WeakMap(), lu = new WeakMap(), ir = new WeakMap(), ws = new WeakMap(), Ja = new WeakMap(), xs = new WeakMap(), rr = new WeakMap(), Qd = new WeakMap(), As = new WeakMap(), cu = new WeakMap(), Ss = new WeakMap(), wo = new WeakMap(), uu = new WeakMap(), hu = new WeakMap(), Ye = new WeakMap(), ne = new WeakMap(), Lr = new WeakMap(), xo = new WeakMap(), du = new WeakMap(), fu = new WeakMap(), Es = new WeakMap(), sr = new WeakMap(), Dr = new WeakMap(), pu = new WeakMap(), fi = new WeakMap(), et = new WeakSet(), sd = function({
16494
+ qa = new WeakMap(), Vn = new WeakMap(), We = new WeakMap(), tn = new WeakMap(), Ga = new WeakMap(), Mr = new WeakMap(), Ya = new WeakMap(), di = new WeakMap(), vs = new WeakMap(), bo = new WeakMap(), Xa = new WeakMap(), yo = new WeakMap(), nr = new WeakMap(), Pi = new WeakMap(), vo = new WeakMap(), ou = new WeakMap(), au = new WeakMap(), Ka = new WeakMap(), lu = new WeakMap(), ir = new WeakMap(), ws = new WeakMap(), Ja = new WeakMap(), xs = new WeakMap(), rr = new WeakMap(), Qd = new WeakMap(), As = new WeakMap(), cu = new WeakMap(), Ss = new WeakMap(), wo = new WeakMap(), uu = new WeakMap(), hu = new WeakMap(), Ye = new WeakMap(), ne = new WeakMap(), Lr = new WeakMap(), xo = new WeakMap(), du = new WeakMap(), fu = new WeakMap(), Es = new WeakMap(), sr = new WeakMap(), Dr = new WeakMap(), pu = new WeakMap(), fi = new WeakMap(), et = new WeakSet(), sd = function({
16490
16495
  anchorNode: t
16491
16496
  }) {
16492
16497
  return t.nodeType === Node.TEXT_NODE ? t.parentElement : t;
@@ -16612,7 +16617,7 @@ qa = new WeakMap(), Vn = new WeakMap(), Ue = new WeakMap(), tn = new WeakMap(),
16612
16617
  for (const e of c(this, tn).values())
16613
16618
  t.push(e.enable());
16614
16619
  await Promise.all(t);
16615
- for (const e of c(this, Ue).values())
16620
+ for (const e of c(this, We).values())
16616
16621
  e.enable();
16617
16622
  }
16618
16623
  }, tw = function() {
@@ -16620,7 +16625,7 @@ qa = new WeakMap(), Vn = new WeakMap(), Ue = new WeakMap(), tn = new WeakMap(),
16620
16625
  y(this, As, !1);
16621
16626
  for (const t of c(this, tn).values())
16622
16627
  t.disable();
16623
- for (const t of c(this, Ue).values())
16628
+ for (const t of c(this, We).values())
16624
16629
  t.disable();
16625
16630
  }
16626
16631
  }, Wp = function(t) {
@@ -16632,10 +16637,10 @@ qa = new WeakMap(), Vn = new WeakMap(), Ue = new WeakMap(), tn = new WeakMap(),
16632
16637
  ;
16633
16638
  return t;
16634
16639
  }, Ec = function() {
16635
- if (c(this, Ue).size === 0)
16640
+ if (c(this, We).size === 0)
16636
16641
  return !0;
16637
- if (c(this, Ue).size === 1)
16638
- for (const t of c(this, Ue).values())
16642
+ if (c(this, We).size === 1)
16643
+ for (const t of c(this, We).values())
16639
16644
  return t.isEmpty();
16640
16645
  return !1;
16641
16646
  }, Vp = function(t) {
@@ -18079,7 +18084,7 @@ class sI {
18079
18084
  _inspectFont: e
18080
18085
  }) {
18081
18086
  if (!(!t || c(this, rl).has(t.loadedName))) {
18082
- if (Fe(!this.disableFontFace, "loadSystemFont shouldn't be called when `disableFontFace` is set."), this.isFontLoadingAPISupported) {
18087
+ if (je(!this.disableFontFace, "loadSystemFont shouldn't be called when `disableFontFace` is set."), this.isFontLoadingAPISupported) {
18083
18088
  const {
18084
18089
  loadedName: i,
18085
18090
  src: r,
@@ -18136,7 +18141,7 @@ class sI {
18136
18141
  }
18137
18142
  _queueLoadingCallback(t) {
18138
18143
  function e() {
18139
- for (Fe(!r.done, "completeRequest() cannot be called twice."), r.done = !0; i.length > 0 && i[0].done; ) {
18144
+ for (je(!r.done, "completeRequest() cannot be called twice."), r.done = !0; i.length > 0 && i[0].done; ) {
18140
18145
  const s = i.shift();
18141
18146
  setTimeout(s.callback, 0);
18142
18147
  }
@@ -18358,7 +18363,7 @@ class Cc {
18358
18363
  }), h.promise;
18359
18364
  },
18360
18365
  cancel: (u) => {
18361
- Fe(u instanceof Error, "cancel must have a valid reason");
18366
+ je(u instanceof Error, "cancel must have a valid reason");
18362
18367
  const h = Promise.withResolvers();
18363
18368
  return this.streamControllers[s].cancelCall = h, this.streamControllers[s].isClosed = !0, l.postMessage({
18364
18369
  sourceName: o,
@@ -18448,7 +18453,7 @@ sl = new WeakMap(), Si = new WeakSet(), mw = function({
18448
18453
  }), delete o.streamSinks[e]);
18449
18454
  },
18450
18455
  error(u) {
18451
- Fe(u instanceof Error, "error must have a valid reason"), !this.isCancelled && (this.isCancelled = !0, s.postMessage({
18456
+ je(u instanceof Error, "error must have a valid reason"), !this.isCancelled && (this.isCancelled = !0, s.postMessage({
18452
18457
  sourceName: i,
18453
18458
  targetName: r,
18454
18459
  stream: De.ERROR,
@@ -18519,17 +18524,17 @@ sl = new WeakMap(), Si = new WeakSet(), mw = function({
18519
18524
  });
18520
18525
  break;
18521
18526
  case De.ENQUEUE:
18522
- if (Fe(o, "enqueue should have stream controller"), o.isClosed)
18527
+ if (je(o, "enqueue should have stream controller"), o.isClosed)
18523
18528
  break;
18524
18529
  o.controller.enqueue(t.chunk);
18525
18530
  break;
18526
18531
  case De.CLOSE:
18527
- if (Fe(o, "close should have stream controller"), o.isClosed)
18532
+ if (je(o, "close should have stream controller"), o.isClosed)
18528
18533
  break;
18529
18534
  o.isClosed = !0, o.controller.close(), A(this, Si, ud).call(this, o, e);
18530
18535
  break;
18531
18536
  case De.ERROR:
18532
- Fe(o, "error should have stream controller"), o.controller.error(Ln(t.reason)), A(this, Si, ud).call(this, o, e);
18537
+ je(o, "error should have stream controller"), o.controller.error(Ln(t.reason)), A(this, Si, ud).call(this, o, e);
18533
18538
  break;
18534
18539
  case De.CANCEL_COMPLETE:
18535
18540
  t.success ? o.cancelCall.resolve() : o.cancelCall.reject(Ln(t.reason)), A(this, Si, ud).call(this, o, e);
@@ -20534,7 +20539,7 @@ class PI {
20534
20539
  disableRange: e = !1,
20535
20540
  disableStream: i = !1
20536
20541
  }) {
20537
- Fe(t, 'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');
20542
+ je(t, 'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');
20538
20543
  const {
20539
20544
  length: r,
20540
20545
  initialData: s,
@@ -20574,7 +20579,7 @@ class PI {
20574
20579
  const r = this._rangeReaders.some(function(s) {
20575
20580
  return s._begin !== t ? !1 : (s._enqueue(i), !0);
20576
20581
  });
20577
- Fe(r, "_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.");
20582
+ je(r, "_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.");
20578
20583
  }
20579
20584
  }
20580
20585
  get _progressiveDataLength() {
@@ -20599,7 +20604,7 @@ class PI {
20599
20604
  e >= 0 && this._rangeReaders.splice(e, 1);
20600
20605
  }
20601
20606
  getFullReader() {
20602
- Fe(!this._fullRequestReader, "PDFDataTransportStream.getFullReader can only be called once.");
20607
+ je(!this._fullRequestReader, "PDFDataTransportStream.getFullReader can only be called once.");
20603
20608
  const t = this._queuedChunks;
20604
20609
  return this._queuedChunks = null, new RI(this, t, this._progressiveDone, this._contentDispositionFilename);
20605
20610
  }
@@ -20885,7 +20890,7 @@ class jy {
20885
20890
  return ((t = this._fullRequestReader) == null ? void 0 : t._loaded) ?? 0;
20886
20891
  }
20887
20892
  getFullReader() {
20888
- return Fe(!this._fullRequestReader, "PDFFetchStream.getFullReader can only be called once."), this._fullRequestReader = new MI(this), this._fullRequestReader;
20893
+ return je(!this._fullRequestReader, "PDFFetchStream.getFullReader can only be called once."), this._fullRequestReader = new MI(this), this._fullRequestReader;
20889
20894
  }
20890
20895
  getRangeReader(t, e) {
20891
20896
  if (e <= this._progressiveDataLength)
@@ -21023,7 +21028,7 @@ class NI {
21023
21028
  e.open("GET", this.url), e.withCredentials = this.withCredentials;
21024
21029
  for (const [s, o] of this.headers)
21025
21030
  e.setRequestHeader(s, o);
21026
- return this.isHttp && "begin" in t && "end" in t ? (e.setRequestHeader("Range", `bytes=${t.begin}-${t.end - 1}`), r.expectedStatus = up) : r.expectedStatus = cp, e.responseType = "arraybuffer", Fe(t.onError, "Expected `onError` callback to be provided."), e.onerror = () => {
21031
+ return this.isHttp && "begin" in t && "end" in t ? (e.setRequestHeader("Range", `bytes=${t.begin}-${t.end - 1}`), r.expectedStatus = up) : r.expectedStatus = cp, e.responseType = "arraybuffer", je(t.onError, "Expected `onError` callback to be provided."), e.onerror = () => {
21027
21032
  t.onError(e.status);
21028
21033
  }, e.onreadystatechange = this.onStateChange.bind(this, i), e.onprogress = this.onProgress.bind(this, i), r.onHeadersReceived = t.onHeadersReceived, r.onDone = t.onDone, r.onError = t.onError, r.onProgress = t.onProgress, e.send(null), i;
21029
21034
  }
@@ -21080,7 +21085,7 @@ class FI {
21080
21085
  e >= 0 && this._rangeRequestReaders.splice(e, 1);
21081
21086
  }
21082
21087
  getFullReader() {
21083
- return Fe(!this._fullRequestReader, "PDFNetworkStream.getFullReader can only be called once."), this._fullRequestReader = new jI(this._manager, this._source), this._fullRequestReader;
21088
+ return je(!this._fullRequestReader, "PDFNetworkStream.getFullReader can only be called once."), this._fullRequestReader = new jI(this._manager, this._source), this._fullRequestReader;
21084
21089
  }
21085
21090
  getRangeReader(t, e) {
21086
21091
  const i = new zI(this._manager, t, e);
@@ -21271,14 +21276,14 @@ function $I(n) {
21271
21276
  }
21272
21277
  class HI {
21273
21278
  constructor(t) {
21274
- this.source = t, this.url = $I(t.url), Fe(this.url.protocol === "file:", "PDFNodeStream only supports file:// URLs."), this._fullRequestReader = null, this._rangeRequestReaders = [];
21279
+ this.source = t, this.url = $I(t.url), je(this.url.protocol === "file:", "PDFNodeStream only supports file:// URLs."), this._fullRequestReader = null, this._rangeRequestReaders = [];
21275
21280
  }
21276
21281
  get _progressiveDataLength() {
21277
21282
  var t;
21278
21283
  return ((t = this._fullRequestReader) == null ? void 0 : t._loaded) ?? 0;
21279
21284
  }
21280
21285
  getFullReader() {
21281
- return Fe(!this._fullRequestReader, "PDFNodeStream.getFullReader can only be called once."), this._fullRequestReader = new UI(this), this._fullRequestReader;
21286
+ return je(!this._fullRequestReader, "PDFNodeStream.getFullReader can only be called once."), this._fullRequestReader = new UI(this), this._fullRequestReader;
21282
21287
  }
21283
21288
  getRangeReader(t, e) {
21284
21289
  if (e <= this._progressiveDataLength)
@@ -21411,7 +21416,7 @@ class WI {
21411
21416
  }
21412
21417
  const VI = 1e5, On = 30, qI = 0.8;
21413
21418
  var Uy, Rs, Fn, Du, Nu, Fo, Hr, Fu, ju, jo, ul, hl, Is, dl, zu, fl, zo, Bu, $u, Bo, $o, Hu, Os, pl, cs, Mw, Lw, cg, li, dd, ug, Dw, Nw;
21414
- const He = class He {
21419
+ const Ue = class Ue {
21415
21420
  constructor({
21416
21421
  textContentSource: t,
21417
21422
  container: e,
@@ -21458,8 +21463,8 @@ const He = class He {
21458
21463
  pageX: o,
21459
21464
  pageY: a
21460
21465
  } = i.rawDims;
21461
- y(this, $u, [1, 0, 0, -1, -o, a + s]), y(this, ju, r), y(this, Fu, s), A(l = He, li, Dw).call(l), ya(e, i), c(this, Rs).promise.finally(() => {
21462
- c(He, pl).delete(this), y(this, Hr, null), y(this, dl, null);
21466
+ y(this, $u, [1, 0, 0, -1, -o, a + s]), y(this, ju, r), y(this, Fu, s), A(l = Ue, li, Dw).call(l), ya(e, i), c(this, Rs).promise.finally(() => {
21467
+ c(Ue, pl).delete(this), y(this, Hr, null), y(this, dl, null);
21463
21468
  }).catch(() => {
21464
21469
  });
21465
21470
  }
@@ -21483,7 +21488,7 @@ const He = class He {
21483
21488
  c(this, Fo) ?? y(this, Fo, e.lang), Object.assign(c(this, dl), e.styles), A(this, cs, Mw).call(this, e.items), t();
21484
21489
  }, c(this, Rs).reject);
21485
21490
  };
21486
- return y(this, jo, c(this, fl).getReader()), c(He, pl).add(this), t(), c(this, Rs).promise;
21491
+ return y(this, jo, c(this, fl).getReader()), c(Ue, pl).add(this), t(), c(this, Rs).promise;
21487
21492
  }
21488
21493
  update({
21489
21494
  viewport: t,
@@ -21498,7 +21503,7 @@ const He = class He {
21498
21503
  const o = {
21499
21504
  div: null,
21500
21505
  properties: null,
21501
- ctx: A(s = He, li, dd).call(s, c(this, Fo))
21506
+ ctx: A(s = Ue, li, dd).call(s, c(this, Fo))
21502
21507
  };
21503
21508
  for (const a of c(this, zo))
21504
21509
  o.properties = c(this, Bu).get(a), o.div = a, A(this, cs, cg).call(this, o);
@@ -21531,7 +21536,7 @@ Rs = new WeakMap(), Fn = new WeakMap(), Du = new WeakMap(), Nu = new WeakMap(),
21531
21536
  var r, s;
21532
21537
  if (c(this, Du))
21533
21538
  return;
21534
- (s = c(this, Hr)).ctx ?? (s.ctx = A(r = He, li, dd).call(r, c(this, Fo)));
21539
+ (s = c(this, Hr)).ctx ?? (s.ctx = A(r = Ue, li, dd).call(r, c(this, Fo)));
21535
21540
  const e = c(this, zo), i = c(this, zu);
21536
21541
  for (const o of t) {
21537
21542
  if (e.length > VI) {
@@ -21562,12 +21567,12 @@ Rs = new WeakMap(), Fn = new WeakMap(), Du = new WeakMap(), Nu = new WeakMap(),
21562
21567
  const o = c(this, dl)[t.fontName];
21563
21568
  o.vertical && (s += Math.PI / 2);
21564
21569
  let a = c(this, Nu) && o.fontSubstitution || o.fontFamily;
21565
- a = He.fontFamilyMap.get(a) || a;
21566
- const l = Math.hypot(r[2], r[3]), u = l * A(m = He, li, Nw).call(m, a, c(this, Fo));
21570
+ a = Ue.fontFamilyMap.get(a) || a;
21571
+ const l = Math.hypot(r[2], r[3]), u = l * A(m = Ue, li, Nw).call(m, a, c(this, Fo));
21567
21572
  let h, d;
21568
21573
  s === 0 ? (h = r[4], d = r[5] - u) : (h = r[4] + u * Math.sin(s), d = r[5] - u * Math.cos(s));
21569
21574
  const f = "calc(var(--scale-factor)*", p = e.style;
21570
- c(this, Fn) === c(this, ul) ? (p.left = `${(100 * h / c(this, ju)).toFixed(2)}%`, p.top = `${(100 * d / c(this, Fu)).toFixed(2)}%`) : (p.left = `${f}${h.toFixed(2)}px)`, p.top = `${f}${d.toFixed(2)}px)`), p.fontSize = `${f}${(c(He, Os) * l).toFixed(2)}px)`, p.fontFamily = a, i.fontSize = l, e.setAttribute("role", "presentation"), e.textContent = t.str, e.dir = t.dir, c(this, Nu) && (e.dataset.fontName = o.fontSubstitutionLoadedName || t.fontName), s !== 0 && (i.angle = s * (180 / Math.PI));
21575
+ c(this, Fn) === c(this, ul) ? (p.left = `${(100 * h / c(this, ju)).toFixed(2)}%`, p.top = `${(100 * d / c(this, Fu)).toFixed(2)}%`) : (p.left = `${f}${h.toFixed(2)}px)`, p.top = `${f}${d.toFixed(2)}px)`), p.fontSize = `${f}${(c(Ue, Os) * l).toFixed(2)}px)`, p.fontFamily = a, i.fontSize = l, e.setAttribute("role", "presentation"), e.textContent = t.str, e.dir = t.dir, c(this, Nu) && (e.dataset.fontName = o.fontSubstitutionLoadedName || t.fontName), s !== 0 && (i.angle = s * (180 / Math.PI));
21571
21576
  let g = !1;
21572
21577
  if (t.str.length > 1)
21573
21578
  g = !0;
@@ -21589,14 +21594,14 @@ Rs = new WeakMap(), Fn = new WeakMap(), Du = new WeakMap(), Nu = new WeakMap(),
21589
21594
  style: s
21590
21595
  } = e;
21591
21596
  let o = "";
21592
- if (c(He, Os) > 1 && (o = `scale(${1 / c(He, Os)})`), i.canvasWidth !== 0 && i.hasText) {
21597
+ if (c(Ue, Os) > 1 && (o = `scale(${1 / c(Ue, Os)})`), i.canvasWidth !== 0 && i.hasText) {
21593
21598
  const {
21594
21599
  fontFamily: l
21595
21600
  } = s, {
21596
21601
  canvasWidth: u,
21597
21602
  fontSize: h
21598
21603
  } = i;
21599
- A(a = He, li, ug).call(a, r, h * c(this, Is), l);
21604
+ A(a = Ue, li, ug).call(a, r, h * c(this, Is), l);
21600
21605
  const {
21601
21606
  width: d
21602
21607
  } = r.measureText(e.textContent);
@@ -21653,8 +21658,8 @@ Rs = new WeakMap(), Fn = new WeakMap(), Du = new WeakMap(), Nu = new WeakMap(),
21653
21658
  r.canvas.width = r.canvas.height = 0;
21654
21659
  const u = o ? o / (o + a) : qI;
21655
21660
  return c(this, Bo).set(t, u), u;
21656
- }, x(He, li), x(He, Bo, /* @__PURE__ */ new Map()), x(He, $o, /* @__PURE__ */ new Map()), x(He, Hu, /* @__PURE__ */ new WeakMap()), x(He, Os, null), x(He, pl, /* @__PURE__ */ new Set());
21657
- let Qc = He;
21661
+ }, x(Ue, li), x(Ue, Bo, /* @__PURE__ */ new Map()), x(Ue, $o, /* @__PURE__ */ new Map()), x(Ue, Hu, /* @__PURE__ */ new WeakMap()), x(Ue, Os, null), x(Ue, pl, /* @__PURE__ */ new Set());
21662
+ let Qc = Ue;
21658
21663
  class Zc {
21659
21664
  static textContent(t) {
21660
21665
  const e = [], i = {
@@ -22600,7 +22605,7 @@ class oO {
22600
22605
  loadingTask: e
22601
22606
  } = this;
22602
22607
  t.on("GetReader", (i, r) => {
22603
- Fe(this._networkStream, "GetReader - no `IPDFStream` instance available."), this._fullReader = this._networkStream.getFullReader(), this._fullReader.onProgress = (s) => {
22608
+ je(this._networkStream, "GetReader - no `IPDFStream` instance available."), this._fullReader = this._networkStream.getFullReader(), this._fullReader.onProgress = (s) => {
22604
22609
  this._lastProgress = {
22605
22610
  loaded: s.loaded,
22606
22611
  total: s.total
@@ -22614,7 +22619,7 @@ class oO {
22614
22619
  r.close();
22615
22620
  return;
22616
22621
  }
22617
- Fe(s instanceof ArrayBuffer, "GetReader - expected an ArrayBuffer."), r.enqueue(new Uint8Array(s), 1, [s]);
22622
+ je(s instanceof ArrayBuffer, "GetReader - expected an ArrayBuffer."), r.enqueue(new Uint8Array(s), 1, [s]);
22618
22623
  }).catch((s) => {
22619
22624
  r.error(s);
22620
22625
  });
@@ -22644,7 +22649,7 @@ class oO {
22644
22649
  contentLength: o
22645
22650
  };
22646
22651
  }), t.on("GetRangeReader", (i, r) => {
22647
- Fe(this._networkStream, "GetRangeReader - no `IPDFStream` instance available.");
22652
+ je(this._networkStream, "GetRangeReader - no `IPDFStream` instance available.");
22648
22653
  const s = this._networkStream.getRangeReader(i.begin, i.end);
22649
22654
  if (!s) {
22650
22655
  r.close();
@@ -22659,7 +22664,7 @@ class oO {
22659
22664
  r.close();
22660
22665
  return;
22661
22666
  }
22662
- Fe(o instanceof ArrayBuffer, "GetRangeReader - expected an ArrayBuffer."), r.enqueue(new Uint8Array(o), 1, [o]);
22667
+ je(o instanceof ArrayBuffer, "GetRangeReader - expected an ArrayBuffer."), r.enqueue(new Uint8Array(o), 1, [o]);
22663
22668
  }).catch((o) => {
22664
22669
  r.error(o);
22665
22670
  });
@@ -22731,7 +22736,7 @@ class oO {
22731
22736
  const {
22732
22737
  imageRef: f
22733
22738
  } = s;
22734
- Fe(f, "The imageRef must be defined.");
22739
+ je(f, "The imageRef must be defined.");
22735
22740
  for (const p of c(this, hr).values())
22736
22741
  for (const [, g] of p.objs)
22737
22742
  if ((g == null ? void 0 : g.ref) === f)
@@ -23325,11 +23330,11 @@ function Gs(n) {
23325
23330
  class dO {
23326
23331
  static create(t) {
23327
23332
  switch (t.data.annotationType) {
23328
- case $e.LINK:
23333
+ case He.LINK:
23329
23334
  return new Bw(t);
23330
- case $e.TEXT:
23335
+ case He.TEXT:
23331
23336
  return new fO(t);
23332
- case $e.WIDGET:
23337
+ case He.WIDGET:
23333
23338
  switch (t.data.fieldType) {
23334
23339
  case "Tx":
23335
23340
  return new pO(t);
@@ -23341,35 +23346,35 @@ class dO {
23341
23346
  return new gO(t);
23342
23347
  }
23343
23348
  return new ka(t);
23344
- case $e.POPUP:
23349
+ case He.POPUP:
23345
23350
  return new gg(t);
23346
- case $e.FREETEXT:
23351
+ case He.FREETEXT:
23347
23352
  return new Yw(t);
23348
- case $e.LINE:
23353
+ case He.LINE:
23349
23354
  return new wO(t);
23350
- case $e.SQUARE:
23355
+ case He.SQUARE:
23351
23356
  return new xO(t);
23352
- case $e.CIRCLE:
23357
+ case He.CIRCLE:
23353
23358
  return new AO(t);
23354
- case $e.POLYLINE:
23359
+ case He.POLYLINE:
23355
23360
  return new Xw(t);
23356
- case $e.CARET:
23361
+ case He.CARET:
23357
23362
  return new EO(t);
23358
- case $e.INK:
23363
+ case He.INK:
23359
23364
  return new Pm(t);
23360
- case $e.POLYGON:
23365
+ case He.POLYGON:
23361
23366
  return new SO(t);
23362
- case $e.HIGHLIGHT:
23367
+ case He.HIGHLIGHT:
23363
23368
  return new Kw(t);
23364
- case $e.UNDERLINE:
23369
+ case He.UNDERLINE:
23365
23370
  return new kO(t);
23366
- case $e.SQUIGGLY:
23371
+ case He.SQUIGGLY:
23367
23372
  return new _O(t);
23368
- case $e.STRIKEOUT:
23373
+ case He.STRIKEOUT:
23369
23374
  return new CO(t);
23370
- case $e.STAMP:
23375
+ case He.STAMP:
23371
23376
  return new Jw(t);
23372
- case $e.FILEATTACHMENT:
23377
+ case He.FILEATTACHMENT:
23373
23378
  return new TO(t);
23374
23379
  default:
23375
23380
  return new Me(t);
@@ -25057,7 +25062,7 @@ class PO {
25057
25062
  for (const a of e) {
25058
25063
  if (a.noHTML)
25059
25064
  continue;
25060
- const l = a.annotationType === $e.POPUP;
25065
+ const l = a.annotationType === He.POPUP;
25061
25066
  if (l) {
25062
25067
  const d = r.get(a.id);
25063
25068
  if (!d)
@@ -25123,14 +25128,14 @@ ih = new WeakMap(), Jo = new WeakMap(), Qo = new WeakMap(), rh = new WeakMap(),
25123
25128
  c(this, Jo).clear();
25124
25129
  };
25125
25130
  const Xh = /\r\n?|\n/g;
25126
- var Mi, Xn, sh, Zo, Kn, je, Zw, tx, ex, vd, as, wd, xd, nx, Ag, ix;
25131
+ var Mi, Xn, sh, Zo, Kn, ze, Zw, tx, ex, vd, as, wd, xd, nx, Ag, ix;
25127
25132
  const de = class de extends Ce {
25128
25133
  constructor(e) {
25129
25134
  super({
25130
25135
  ...e,
25131
25136
  name: "freeTextEditor"
25132
25137
  });
25133
- x(this, je);
25138
+ x(this, ze);
25134
25139
  x(this, Mi);
25135
25140
  x(this, Xn, "");
25136
25141
  x(this, sh, `${this.id}-editor`);
@@ -25186,10 +25191,10 @@ const de = class de extends Ce {
25186
25191
  updateParams(e, i) {
25187
25192
  switch (e) {
25188
25193
  case $t.FREETEXT_SIZE:
25189
- A(this, je, Zw).call(this, i);
25194
+ A(this, ze, Zw).call(this, i);
25190
25195
  break;
25191
25196
  case $t.FREETEXT_COLOR:
25192
- A(this, je, tx).call(this, i);
25197
+ A(this, ze, tx).call(this, i);
25193
25198
  break;
25194
25199
  }
25195
25200
  }
@@ -25249,7 +25254,7 @@ const de = class de extends Ce {
25249
25254
  if (!this.isInEditMode())
25250
25255
  return;
25251
25256
  super.commit(), this.disableEditMode();
25252
- const e = c(this, Xn), i = y(this, Xn, A(this, je, ex).call(this).trimEnd());
25257
+ const e = c(this, Xn), i = y(this, Xn, A(this, ze, ex).call(this).trimEnd());
25253
25258
  if (e === i)
25254
25259
  return;
25255
25260
  const r = (s) => {
@@ -25257,7 +25262,7 @@ const de = class de extends Ce {
25257
25262
  this.remove();
25258
25263
  return;
25259
25264
  }
25260
- A(this, je, xd).call(this), this._uiManager.rebuild(this), A(this, je, vd).call(this);
25265
+ A(this, ze, xd).call(this), this._uiManager.rebuild(this), A(this, ze, vd).call(this);
25261
25266
  };
25262
25267
  this.addCommands({
25263
25268
  cmd: () => {
@@ -25267,7 +25272,7 @@ const de = class de extends Ce {
25267
25272
  r(e);
25268
25273
  },
25269
25274
  mustExec: !1
25270
- }), A(this, je, vd).call(this);
25275
+ }), A(this, ze, vd).call(this);
25271
25276
  }
25272
25277
  shouldGetKeyboardEvents() {
25273
25278
  return this.isInEditMode();
@@ -25334,7 +25339,7 @@ const de = class de extends Ce {
25334
25339
  this.setAt(g * s, m * o, l, u);
25335
25340
  } else
25336
25341
  this.setAt(e * s, i * o, this.width * s, this.height * o);
25337
- A(this, je, xd).call(this), this._isDraggable = !0, this.editorDiv.contentEditable = !1;
25342
+ A(this, ze, xd).call(this), this._isDraggable = !0, this.editorDiv.contentEditable = !1;
25338
25343
  } else
25339
25344
  this._isDraggable = !1, this.editorDiv.contentEditable = !0;
25340
25345
  return this.div;
@@ -25385,7 +25390,7 @@ const de = class de extends Ce {
25385
25390
  }
25386
25391
  y(this, Xn, `${h.join(`
25387
25392
  `)}${s}${d.join(`
25388
- `)}`), A(this, je, xd).call(this);
25393
+ `)}`), A(this, ze, xd).call(this);
25389
25394
  const f = new Range();
25390
25395
  let p = h.reduce((b, w) => b + w.length, 0);
25391
25396
  for (const {
@@ -25456,13 +25461,13 @@ const de = class de extends Ce {
25456
25461
  annotationType: Pt.FREETEXT,
25457
25462
  color: s,
25458
25463
  fontSize: c(this, Kn),
25459
- value: A(this, je, nx).call(this),
25464
+ value: A(this, ze, nx).call(this),
25460
25465
  pageIndex: this.pageIndex,
25461
25466
  rect: r,
25462
25467
  rotation: this.rotation,
25463
25468
  structTreeParentId: this._structTreeParentId
25464
25469
  };
25465
- return e ? o : this.annotationElementId && !A(this, je, ix).call(this, o) ? null : (o.id = this.annotationElementId, o);
25470
+ return e ? o : this.annotationElementId && !A(this, ze, ix).call(this, o) ? null : (o.id = this.annotationElementId, o);
25466
25471
  }
25467
25472
  renderAnnotationElement(e) {
25468
25473
  const i = super.renderAnnotationElement(e);
@@ -25487,9 +25492,9 @@ const de = class de extends Ce {
25487
25492
  super.resetAnnotationElement(e), e.resetEdited();
25488
25493
  }
25489
25494
  };
25490
- Mi = new WeakMap(), Xn = new WeakMap(), sh = new WeakMap(), Zo = new WeakMap(), Kn = new WeakMap(), je = new WeakSet(), Zw = function(e) {
25495
+ Mi = new WeakMap(), Xn = new WeakMap(), sh = new WeakMap(), Zo = new WeakMap(), Kn = new WeakMap(), ze = new WeakSet(), Zw = function(e) {
25491
25496
  const i = (s) => {
25492
- this.editorDiv.style.fontSize = `calc(${s}px * var(--scale-factor))`, this.translate(0, -(s - c(this, Kn)) * this.parentScale), y(this, Kn, s), A(this, je, vd).call(this);
25497
+ this.editorDiv.style.fontSize = `calc(${s}px * var(--scale-factor))`, this.translate(0, -(s - c(this, Kn)) * this.parentScale), y(this, Kn, s), A(this, ze, vd).call(this);
25493
25498
  }, r = c(this, Kn);
25494
25499
  this.addCommands({
25495
25500
  cmd: i.bind(this, e),
@@ -25986,7 +25991,7 @@ class IO extends ux {
25986
25991
  return new kg(t, e, i, r, s, o);
25987
25992
  }
25988
25993
  }
25989
- var Ni, ia, Il, We, ph, Ol, gh, mh, js, Fi, Ml, bh, re, _g, Cg, Tg, oo, gx, ps;
25994
+ var Ni, ia, Il, Ve, ph, Ol, gh, mh, js, Fi, Ml, bh, re, _g, Cg, Tg, oo, gx, ps;
25990
25995
  const Dn = class Dn {
25991
25996
  constructor({
25992
25997
  editor: t = null,
@@ -25996,7 +26001,7 @@ const Dn = class Dn {
25996
26001
  x(this, Ni, null);
25997
26002
  x(this, ia, null);
25998
26003
  x(this, Il);
25999
- x(this, We, null);
26004
+ x(this, Ve, null);
26000
26005
  x(this, ph, !1);
26001
26006
  x(this, Ol, !1);
26002
26007
  x(this, gh, null);
@@ -26029,7 +26034,7 @@ const Dn = class Dn {
26029
26034
  return i.className = "swatch", i.setAttribute("aria-hidden", !0), i.style.backgroundColor = c(this, Il), t.append(i), t;
26030
26035
  }
26031
26036
  renderMainDropdown() {
26032
- const t = y(this, We, A(this, re, _g).call(this));
26037
+ const t = y(this, Ve, A(this, re, _g).call(this));
26033
26038
  return t.setAttribute("aria-orientation", "horizontal"), t.setAttribute("aria-labelledby", "highlightColorPickerLabel"), t;
26034
26039
  }
26035
26040
  _colorSelectFromKeyboard(t) {
@@ -26047,14 +26052,14 @@ const Dn = class Dn {
26047
26052
  return;
26048
26053
  }
26049
26054
  if (t.target === c(this, Ni)) {
26050
- (e = c(this, We).firstChild) == null || e.focus();
26055
+ (e = c(this, Ve).firstChild) == null || e.focus();
26051
26056
  return;
26052
26057
  }
26053
26058
  (i = t.target.nextSibling) == null || i.focus();
26054
26059
  }
26055
26060
  _moveToPrevious(t) {
26056
26061
  var e, i;
26057
- if (t.target === ((e = c(this, We)) == null ? void 0 : e.firstChild) || t.target === c(this, Ni)) {
26062
+ if (t.target === ((e = c(this, Ve)) == null ? void 0 : e.firstChild) || t.target === c(this, Ni)) {
26058
26063
  c(this, re, ps) && this._hideDropdownFromKeyboard();
26059
26064
  return;
26060
26065
  }
@@ -26066,7 +26071,7 @@ const Dn = class Dn {
26066
26071
  A(this, re, oo).call(this, t);
26067
26072
  return;
26068
26073
  }
26069
- (e = c(this, We).firstChild) == null || e.focus();
26074
+ (e = c(this, Ve).firstChild) == null || e.focus();
26070
26075
  }
26071
26076
  _moveToEnd(t) {
26072
26077
  var e;
@@ -26074,11 +26079,11 @@ const Dn = class Dn {
26074
26079
  A(this, re, oo).call(this, t);
26075
26080
  return;
26076
26081
  }
26077
- (e = c(this, We).lastChild) == null || e.focus();
26082
+ (e = c(this, Ve).lastChild) == null || e.focus();
26078
26083
  }
26079
26084
  hideDropdown() {
26080
26085
  var t, e;
26081
- (t = c(this, We)) == null || t.classList.add("hidden"), (e = c(this, js)) == null || e.abort(), y(this, js, null);
26086
+ (t = c(this, Ve)) == null || t.classList.add("hidden"), (e = c(this, js)) == null || e.abort(), y(this, js, null);
26082
26087
  }
26083
26088
  _hideDropdownFromKeyboard() {
26084
26089
  var t;
@@ -26094,18 +26099,18 @@ const Dn = class Dn {
26094
26099
  }
26095
26100
  }
26096
26101
  updateColor(t) {
26097
- if (c(this, ia) && (c(this, ia).style.backgroundColor = t), !c(this, We))
26102
+ if (c(this, ia) && (c(this, ia).style.backgroundColor = t), !c(this, Ve))
26098
26103
  return;
26099
26104
  const e = c(this, Fi).highlightColors.values();
26100
- for (const i of c(this, We).children)
26105
+ for (const i of c(this, Ve).children)
26101
26106
  i.setAttribute("aria-selected", e.next().value === t);
26102
26107
  }
26103
26108
  destroy() {
26104
26109
  var t, e;
26105
- (t = c(this, Ni)) == null || t.remove(), y(this, Ni, null), y(this, ia, null), (e = c(this, We)) == null || e.remove(), y(this, We, null);
26110
+ (t = c(this, Ni)) == null || t.remove(), y(this, Ni, null), y(this, ia, null), (e = c(this, Ve)) == null || e.remove(), y(this, Ve, null);
26106
26111
  }
26107
26112
  };
26108
- Ni = new WeakMap(), ia = new WeakMap(), Il = new WeakMap(), We = new WeakMap(), ph = new WeakMap(), Ol = new WeakMap(), gh = new WeakMap(), mh = new WeakMap(), js = new WeakMap(), Fi = new WeakMap(), Ml = new WeakMap(), bh = new WeakMap(), re = new WeakSet(), _g = function() {
26113
+ Ni = new WeakMap(), ia = new WeakMap(), Il = new WeakMap(), Ve = new WeakMap(), ph = new WeakMap(), Ol = new WeakMap(), gh = new WeakMap(), mh = new WeakMap(), js = new WeakMap(), Fi = new WeakMap(), Ml = new WeakMap(), bh = new WeakMap(), re = new WeakSet(), _g = function() {
26109
26114
  const t = document.createElement("div"), e = c(this, Fi)._signal;
26110
26115
  t.addEventListener("contextmenu", Wi, {
26111
26116
  signal: e
@@ -26136,17 +26141,17 @@ Ni = new WeakMap(), ia = new WeakMap(), Il = new WeakMap(), We = new WeakMap(),
26136
26141
  }
26137
26142
  if (y(this, ph, t.detail === 0), c(this, js) || (y(this, js, new AbortController()), window.addEventListener("pointerdown", A(this, re, gx).bind(this), {
26138
26143
  signal: c(this, Fi).combinedSignal(c(this, js))
26139
- })), c(this, We)) {
26140
- c(this, We).classList.remove("hidden");
26144
+ })), c(this, Ve)) {
26145
+ c(this, Ve).classList.remove("hidden");
26141
26146
  return;
26142
26147
  }
26143
- const e = y(this, We, A(this, re, _g).call(this));
26148
+ const e = y(this, Ve, A(this, re, _g).call(this));
26144
26149
  c(this, Ni).append(e);
26145
26150
  }, gx = function(t) {
26146
26151
  var e;
26147
- (e = c(this, We)) != null && e.contains(t.target) || this.hideDropdown();
26152
+ (e = c(this, Ve)) != null && e.contains(t.target) || this.hideDropdown();
26148
26153
  }, ps = function() {
26149
- return c(this, We) && !c(this, We).classList.contains("hidden");
26154
+ return c(this, Ve) && !c(this, Ve).classList.contains("hidden");
26150
26155
  }, x(Dn, bh, null);
26151
26156
  let Vd = Dn;
26152
26157
  var Ll, yh, Qr, ra, Dl, jn, vh, wh, sa, gi, Zn, nn, Nl, Zr, dn, Fl, mi, xh, Ct, Pg, Sd, mx, bx, yx, Rg, ao, xi, Na, vx, Ed, Lc, wx, xx, Ax, Sx, Ex;
@@ -28901,7 +28906,7 @@ function jO() {
28901
28906
  }
28902
28907
  const Hy = /* @__PURE__ */ new Map();
28903
28908
  function zO({ fileUrl: n, pageNumber: t, onMeta: e, scrollBehavior: i = "auto", highlights: r, clientId: s, apiKey: o, authToken: a }) {
28904
- const [l, u] = fe(0), [h, d] = fe(!0), [f, p] = fe(null), [g, m] = fe(0), v = Ve([]), b = Ve([]), w = Ve(null), E = Ve(null), T = Ve(!1), C = Ve(null), _ = Ve(null), O = Ve(1), U = Bn((D) => {
28909
+ const [l, u] = fe(0), [h, d] = fe(!0), [f, p] = fe(null), [g, m] = fe(0), v = Fe([]), b = Fe([]), w = Fe(null), E = Fe(null), T = Fe(!1), C = Fe(null), _ = Fe(null), O = Fe(1), U = Bn((D) => {
28905
28910
  try {
28906
28911
  return !D || /^https?:\/\//i.test(D) ? D : new URL(D, window.location.origin).href;
28907
28912
  } catch {
@@ -29008,8 +29013,8 @@ function zO({ fileUrl: n, pageNumber: t, onMeta: e, scrollBehavior: i = "auto",
29008
29013
  }));
29009
29014
  const k = Number(L.getAttribute("data-vw")) || nt.width / (window.devicePixelRatio || 1), J = Number(L.getAttribute("data-vh")) || nt.height / (window.devicePixelRatio || 1), ut = L.getBoundingClientRect(), Y = nt.getBoundingClientRect(), Z = Y.width || k, ht = Y.height || J * (Z / k), xt = Z / k, bt = ht / J, ee = await $.getPage(M), tt = (ee.rotate + 180) % 360, ve = ee.getViewport({ scale: 1, rotation: tt - 180 }), ue = document.createElement("div");
29010
29015
  ue.className = "hl-layer", ue.style.position = "absolute", ue.style.left = `${Y.left - ut.left}px`, ue.style.top = `${Y.top - ut.top}px`, ue.style.width = `${ve.width}px`, ue.style.height = `${ve.height}px`, ue.style.transformOrigin = "0 0", ue.style.transform = `scale(${xt}, ${bt})`, ue.style.pointerEvents = "none", ue.style.willChange = "transform", ue.style.zIndex = "2";
29011
- const ze = `page-${M}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
29012
- ue.setAttribute("data-highlight-id", ze), console.log(`SimplePdfViewer: Creating new highlight layer for page ${M} with ID: ${ze}`), L.style.userSelect = "none", L.style.webkitUserSelect = "none", L.style.mozUserSelect = "none", L.style.msUserSelect = "none";
29016
+ const Be = `page-${M}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
29017
+ ue.setAttribute("data-highlight-id", Be), console.log(`SimplePdfViewer: Creating new highlight layer for page ${M} with ID: ${Be}`), L.style.userSelect = "none", L.style.webkitUserSelect = "none", L.style.mozUserSelect = "none", L.style.msUserSelect = "none";
29013
29018
  const ge = L.querySelector("canvas"), ci = L.querySelector(".textLayer");
29014
29019
  ge && (ge.style.userSelect = "none", ge.style.webkitUserSelect = "none"), ci && (ci.style.userSelect = "none", ci.style.webkitUserSelect = "none", ci.style.pointerEvents = "none");
29015
29020
  const Ei = document.createElement("style");
@@ -29188,7 +29193,7 @@ function BO({
29188
29193
  onChangePage: h,
29189
29194
  onMeta: d
29190
29195
  }) {
29191
- const [f, p] = fe(!1), g = Ve(null), m = Ve(null), v = Ve(null);
29196
+ const [f, p] = fe(!1), g = Fe(null), m = Fe(null), v = Fe(null);
29192
29197
  return /* @__PURE__ */ I.jsx("div", { className: `modal ${n && t ? "open" : ""}`, onClick: u, children: /* @__PURE__ */ I.jsxs("div", { className: "modal-content", onClick: (b) => b.stopPropagation(), children: [
29193
29198
  /* @__PURE__ */ I.jsxs("div", { className: "modal-header", children: [
29194
29199
  /* @__PURE__ */ I.jsx("div", { className: "modal-title", children: e }),
@@ -29294,7 +29299,7 @@ function BO({
29294
29299
  }
29295
29300
  const hp = {};
29296
29301
  function VO({ user: n, generateToken: t, clientId: e, apiBase: i, docsBase: r }) {
29297
- const s = i || "https://fastify.tpsportal.co.nz/api/v1", o = r || "https://fastify.tpsportal.co.nz/api/v1/docs", a = hp == null ? void 0 : hp.VITE_API_KEY, [l, u] = fe([]), [h, d] = fe(""), [f, p] = fe(!1), [g, m] = fe(null), [v, b] = fe(null), [w, E] = fe([]), [T, C] = fe({}), [_, O] = fe({ open: !1 }), [U, B] = fe(null), R = Ve(null), z = Ve(!0), D = Ve(null), N = Ve(!0), $ = Ve(0), [W, M] = fe(!0), [L, nt] = fe(50), [gt, S] = fe(!1), [H, Q] = fe(!1), [k, J] = fe(null), [ut, Y] = fe(!1), [Z, ht] = fe(!0), [xt, bt] = fe(null), ee = Ve(null), tt = Ve(null), ve = Ve(null), { toasts: ue, pushToast: ze } = Vx(), ge = ja(() => Hx({ apiBase: s, generateToken: t, clientId: e }), [s, t, e]), [ci, Ei] = fe();
29302
+ const s = i || "https://fastify.tpsportal.co.nz/api/v1", o = r || "https://fastify.tpsportal.co.nz/api/v1/docs", a = hp == null ? void 0 : hp.VITE_API_KEY, [l, u] = fe([]), [h, d] = fe(""), [f, p] = fe(!1), [g, m] = fe(null), [v, b] = fe(null), [w, E] = fe([]), [T, C] = fe({}), [_, O] = fe({ open: !1 }), [U, B] = fe(null), R = Fe(null), z = Fe(!0), D = Fe(null), N = Fe(!0), $ = Fe(0), [W, M] = fe(!0), [L, nt] = fe(50), [gt, S] = fe(!1), [H, Q] = fe(!1), [k, J] = fe(null), [ut, Y] = fe(!1), [Z, ht] = fe(!0), [xt, bt] = fe(null), ee = Fe(null), tt = Fe(null), ve = Fe(null), { toasts: ue, pushToast: Be } = Vx(), ge = ja(() => Hx({ apiBase: s, generateToken: t, clientId: e }), [s, t, e]), [ci, Ei] = fe();
29298
29303
  si(() => {
29299
29304
  t && Promise.resolve(t()).then(Ei).catch(() => Ei(void 0));
29300
29305
  }, [t]);
@@ -29347,7 +29352,7 @@ function VO({ user: n, generateToken: t, clientId: e, apiBase: i, docsBase: r })
29347
29352
  if (!zt || !he) return;
29348
29353
  const me = he;
29349
29354
  C((Un) => {
29350
- const Be = Un[me], be = Be ? { ...Be, content: Be.content + zt } : { role: "assistant", content: zt, sources: Te || [], createdAt: Date.now() };
29355
+ const $e = Un[me], be = $e ? { ...$e, content: $e.content + zt } : { role: "assistant", content: zt, sources: Te || [], createdAt: Date.now() };
29351
29356
  return { ...Un, [me]: be };
29352
29357
  }), p(!1);
29353
29358
  }, _r = (zt) => {
@@ -29380,8 +29385,8 @@ function VO({ user: n, generateToken: t, clientId: e, apiBase: i, docsBase: r })
29380
29385
  (Ki = ve.current) == null || Ki.abort();
29381
29386
  } catch {
29382
29387
  }
29383
- const Be = new AbortController();
29384
- ve.current = Be, zt = (await ge.createConversation(mt.content.slice(0, 80), { signal: Be.signal })).id, b(zt), ge.listConversations().then(E).catch(() => {
29388
+ const $e = new AbortController();
29389
+ ve.current = $e, zt = (await ge.createConversation(mt.content.slice(0, 80), { signal: $e.signal })).id, b(zt), ge.listConversations().then(E).catch(() => {
29385
29390
  });
29386
29391
  }
29387
29392
  he = zt;
@@ -29394,15 +29399,15 @@ function VO({ user: n, generateToken: t, clientId: e, apiBase: i, docsBase: r })
29394
29399
  ve.current = Un, await ge.chatStream(
29395
29400
  { messages: me, conversationId: zt },
29396
29401
  {
29397
- onMetadata: (Be) => {
29398
- Te = Be || [], he && C((be) => {
29402
+ onMetadata: ($e) => {
29403
+ Te = $e || [], he && C((be) => {
29399
29404
  const Ge = be[he];
29400
29405
  return Ge ? { ...be, [he]: { ...Ge, sources: Te } } : be;
29401
29406
  });
29402
29407
  },
29403
- onText: (Be) => {
29408
+ onText: ($e) => {
29404
29409
  if (!N.current) return;
29405
- let be = qt + Be;
29410
+ let be = qt + $e;
29406
29411
  for (; ; ) {
29407
29412
  const Ge = _r(be);
29408
29413
  if (Ge === -1) {
@@ -29417,7 +29422,7 @@ function VO({ user: n, generateToken: t, clientId: e, apiBase: i, docsBase: r })
29417
29422
  }
29418
29423
  qt = be, qt.length >= ae && (kr(qt), qt = "");
29419
29424
  },
29420
- onComplete: (Be) => {
29425
+ onComplete: ($e) => {
29421
29426
  qt && kr(qt), qt = "", N.current && p(!1), he && C((be) => {
29422
29427
  const Ge = be[he];
29423
29428
  Ge && v === he && u((_a) => [..._a, Ge]);
@@ -29425,8 +29430,8 @@ function VO({ user: n, generateToken: t, clientId: e, apiBase: i, docsBase: r })
29425
29430
  return ds;
29426
29431
  });
29427
29432
  },
29428
- onError: (Be) => {
29429
- N.current && (m(Be), ze(Be, "error"), p(!1));
29433
+ onError: ($e) => {
29434
+ N.current && (m($e), Be($e, "error"), p(!1));
29430
29435
  }
29431
29436
  },
29432
29437
  { signal: Un.signal }
@@ -29434,9 +29439,9 @@ function VO({ user: n, generateToken: t, clientId: e, apiBase: i, docsBase: r })
29434
29439
  } catch (zt) {
29435
29440
  if (zt instanceof DOMException && zt.name === "AbortError") return;
29436
29441
  const me = zt instanceof Id ? zt.status === 429 ? "You're sending messages too quickly. Please retry in a moment." : zt.status >= 500 ? "Server error while processing your message." : zt.status === 401 || zt.status === 403 ? "Unauthorized. Please sign in." : zt.message || "Request failed" : zt instanceof Error ? zt.message : "Unknown error";
29437
- N.current && (m(me), ze(me, "error"), p(!1));
29442
+ N.current && (m(me), Be(me, "error"), p(!1));
29438
29443
  }
29439
- }, [ge, v, h, f, l, ze]);
29444
+ }, [ge, v, h, f, l, Be]);
29440
29445
  si(() => {
29441
29446
  if (f && z.current) {
29442
29447
  Ee();
@@ -29519,7 +29524,7 @@ function VO({ user: n, generateToken: t, clientId: e, apiBase: i, docsBase: r })
29519
29524
  if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
29520
29525
  q.classList.add("js-motion");
29521
29526
  let Ki = 0, Ji = 0;
29522
- const zt = Math.PI * 2, me = 16, Un = 8, Be = 28;
29527
+ const zt = Math.PI * 2, me = 16, Un = 8, $e = 28;
29523
29528
  let be = 40;
29524
29529
  try {
29525
29530
  be = parseFloat(qt[0].getAttribute("r") || "40");
@@ -29527,7 +29532,7 @@ function VO({ user: n, generateToken: t, clientId: e, apiBase: i, docsBase: r })
29527
29532
  }
29528
29533
  const ki = (2 * be + 8) / Math.sqrt(3), ds = Math.max(34, ki + 6), _a = 12, lc = (eo) => {
29529
29534
  Ji || (Ji = eo);
29530
- const cc = (eo - Ji) / 1e3, Rf = cc * 360 / me % 360, zh = ds + _a * (0.5 - 0.5 * Math.cos(zt * (cc / Un))), P = cc * 360 / Be % 360;
29535
+ const cc = (eo - Ji) / 1e3, Rf = cc * 360 / me % 360, zh = ds + _a * (0.5 - 0.5 * Math.cos(zt * (cc / Un))), P = cc * 360 / $e % 360;
29531
29536
  qt.forEach((V) => {
29532
29537
  const it = V.getAttribute("class") || "", At = kr(it), Jt = Rf * Math.PI / 180 + At, Bt = Te + zh * Math.cos(Jt), Lt = he + zh * Math.sin(Jt);
29533
29538
  V.setAttribute("cx", Bt.toFixed(2)), V.setAttribute("cy", Lt.toFixed(2));
@@ -29695,9 +29700,9 @@ function VO({ user: n, generateToken: t, clientId: e, apiBase: i, docsBase: r })
29695
29700
  },
29696
29701
  onCopy: async (Et) => {
29697
29702
  try {
29698
- await navigator.clipboard.writeText(Et), ze("Copied response to clipboard", "success");
29703
+ await navigator.clipboard.writeText(Et), Be("Copied response to clipboard", "success");
29699
29704
  } catch {
29700
- ze("Copy failed. Please try again.", "error");
29705
+ Be("Copy failed. Please try again.", "error");
29701
29706
  }
29702
29707
  }
29703
29708
  }