@tenancy.nz/chat-ui 0.1.32 → 0.1.34

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,117 @@ 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(() => {
5468
+ var b, w;
5466
5469
  if (!n) {
5467
- o(!1);
5470
+ a(!1);
5468
5471
  return;
5469
5472
  }
5470
- let a = 0, l = 0;
5471
- return a = requestAnimationFrame(() => {
5472
- l = requestAnimationFrame(() => o(!0));
5473
- }), () => {
5473
+ const l = ((w = (b = i.current) == null ? void 0 : b.getRootNode) == null ? void 0 : w.call(b)) || document, u = (E) => {
5474
+ var T;
5474
5475
  try {
5475
- cancelAnimationFrame(a);
5476
+ return ((T = l.querySelector) == null ? void 0 : T.call(l, E)) ?? null;
5476
5477
  } catch {
5478
+ return null;
5477
5479
  }
5480
+ }, h = e.map((E) => typeof E.target == "string" ? E.target : "").filter(Boolean), d = () => h.some((E) => !!u(E));
5481
+ let f = 0, p = 0, g = null, m = null;
5482
+ const v = () => {
5483
+ f = requestAnimationFrame(() => {
5484
+ p = requestAnimationFrame(() => a(!0));
5485
+ });
5486
+ };
5487
+ if (d())
5488
+ v();
5489
+ else {
5490
+ const E = l instanceof Document ? l.documentElement : l;
5478
5491
  try {
5479
- cancelAnimationFrame(l);
5492
+ g = new MutationObserver(() => {
5493
+ if (d()) {
5494
+ try {
5495
+ g && g.disconnect();
5496
+ } catch {
5497
+ }
5498
+ v();
5499
+ }
5500
+ }), g.observe(E, { childList: !0, subtree: !0 });
5480
5501
  } catch {
5481
5502
  }
5482
- };
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
5503
+ m = setTimeout(() => {
5504
+ try {
5505
+ g && g.disconnect();
5506
+ } catch {
5498
5507
  }
5499
- },
5500
- spotlightClicks: !0,
5501
- callback: r
5508
+ v();
5509
+ }, 2e3);
5502
5510
  }
5503
- ) });
5511
+ return () => {
5512
+ try {
5513
+ cancelAnimationFrame(f);
5514
+ } catch {
5515
+ }
5516
+ try {
5517
+ cancelAnimationFrame(p);
5518
+ } catch {
5519
+ }
5520
+ try {
5521
+ g && g.disconnect();
5522
+ } catch {
5523
+ }
5524
+ try {
5525
+ clearTimeout(m);
5526
+ } catch {
5527
+ }
5528
+ };
5529
+ }, [n, e]), /* @__PURE__ */ I.jsxs(I.Fragment, { children: [
5530
+ /* @__PURE__ */ I.jsx("span", { ref: i, style: { position: "absolute", inset: 0, pointerEvents: "none" }, "aria-hidden": !0 }),
5531
+ n && o && /* @__PURE__ */ I.jsx(
5532
+ $S,
5533
+ {
5534
+ steps: r,
5535
+ run: n,
5536
+ continuous: !0,
5537
+ showSkipButton: !0,
5538
+ showProgress: !0,
5539
+ disableOverlayClose: !0,
5540
+ disableScrolling: !0,
5541
+ scrollToFirstStep: !0,
5542
+ styles: {
5543
+ options: {
5544
+ primaryColor: "#0445B7",
5545
+ zIndex: 1e4
5546
+ }
5547
+ },
5548
+ spotlightClicks: !0,
5549
+ callback: s
5550
+ }
5551
+ )
5552
+ ] });
5504
5553
  }
5505
5554
  function VS(n, t) {
5506
5555
  const e = {};
@@ -9518,7 +9567,7 @@ function eC(n) {
9518
9567
  autolink: s(oe),
9519
9568
  autolinkProtocol: B,
9520
9569
  autolinkEmail: B,
9521
- atxHeading: s(ze),
9570
+ atxHeading: s(Be),
9522
9571
  blockQuote: s(bt),
9523
9572
  characterEscape: B,
9524
9573
  characterReference: B,
@@ -9553,7 +9602,7 @@ function eC(n) {
9553
9602
  referenceString: o,
9554
9603
  resourceDestinationString: o,
9555
9604
  resourceTitleString: o,
9556
- setextHeading: s(ze),
9605
+ setextHeading: s(Be),
9557
9606
  strong: s(oc),
9558
9607
  thematicBreak: s(Xi)
9559
9608
  },
@@ -9950,7 +9999,7 @@ function eC(n) {
9950
9999
  children: []
9951
10000
  };
9952
10001
  }
9953
- function ze() {
10002
+ function Be() {
9954
10003
  return {
9955
10004
  type: "heading",
9956
10005
  // @ts-expect-error `depth` will be set later.
@@ -14549,7 +14598,7 @@ const mn = typeof process == "object" && process + "" == "[object process]" && !
14549
14598
  GRAYSCALE_1BPP: 1,
14550
14599
  RGB_24BPP: 2,
14551
14600
  RGBA_32BPP: 3
14552
- }, $e = {
14601
+ }, He = {
14553
14602
  TEXT: 1,
14554
14603
  LINK: 2,
14555
14604
  FREETEXT: 3,
@@ -14689,7 +14738,7 @@ function Rt(n) {
14689
14738
  function le(n) {
14690
14739
  throw new Error(n);
14691
14740
  }
14692
- function Fe(n, t) {
14741
+ function je(n, t) {
14693
14742
  n || le(t);
14694
14743
  }
14695
14744
  function $R(n) {
@@ -15648,13 +15697,13 @@ const Jd = class Jd {
15648
15697
  };
15649
15698
  ft(Jd, "_colorsMapping", /* @__PURE__ */ new Map([["CanvasText", [0, 0, 0]], ["Canvas", [255, 255, 255]]]));
15650
15699
  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;
15700
+ 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
15701
  const za = class za {
15653
15702
  constructor(t, e, i, r, s, o, a, l, u, h, d, f, p) {
15654
15703
  x(this, et);
15655
15704
  x(this, qa, new AbortController());
15656
15705
  x(this, Vn, null);
15657
- x(this, Ue, /* @__PURE__ */ new Map());
15706
+ x(this, We, /* @__PURE__ */ new Map());
15658
15707
  x(this, tn, /* @__PURE__ */ new Map());
15659
15708
  x(this, Ga, null);
15660
15709
  x(this, Mr, null);
@@ -15779,7 +15828,7 @@ const za = class za {
15779
15828
  (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
15829
  for (const o of c(this, tn).values())
15781
15830
  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();
15831
+ 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
15832
  }
15784
15833
  combinedSignal(t) {
15785
15834
  return AbortSignal.any([this._signal, t.signal]);
@@ -16102,7 +16151,7 @@ const za = class za {
16102
16151
  i && this.addNewEditorFromKeyboard(), c(this, fi).resolve();
16103
16152
  return;
16104
16153
  }
16105
- for (const s of c(this, Ue).values())
16154
+ for (const s of c(this, We).values())
16106
16155
  s.annotationElementId === e ? (this.setSelected(s), s.enterInEditMode()) : s.unselect();
16107
16156
  c(this, fi).resolve();
16108
16157
  }
@@ -16147,7 +16196,7 @@ const za = class za {
16147
16196
  }
16148
16197
  showAllEditors(t, e, i = !1) {
16149
16198
  var s;
16150
- for (const o of c(this, Ue).values())
16199
+ for (const o of c(this, We).values())
16151
16200
  o.editorType === t && o.show(e);
16152
16201
  (((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
16202
  }
@@ -16160,21 +16209,21 @@ const za = class za {
16160
16209
  }
16161
16210
  getEditors(t) {
16162
16211
  const e = [];
16163
- for (const i of c(this, Ue).values())
16212
+ for (const i of c(this, We).values())
16164
16213
  i.pageIndex === t && e.push(i);
16165
16214
  return e;
16166
16215
  }
16167
16216
  getEditor(t) {
16168
- return c(this, Ue).get(t);
16217
+ return c(this, We).get(t);
16169
16218
  }
16170
16219
  addEditor(t) {
16171
- c(this, Ue).set(t.id, t);
16220
+ c(this, We).set(t.id, t);
16172
16221
  }
16173
16222
  removeEditor(t) {
16174
16223
  var e;
16175
16224
  t.div.contains(document.activeElement) && (c(this, ir) && clearTimeout(c(this, ir)), y(this, ir, setTimeout(() => {
16176
16225
  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));
16226
+ }, 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
16227
  }
16179
16228
  addDeletedAnnotationElement(t) {
16180
16229
  c(this, yo).add(t.annotationElementId), this.addChangedExistingAnnotation(t), t.deleted = !0;
@@ -16287,7 +16336,7 @@ const za = class za {
16287
16336
  selectAll() {
16288
16337
  for (const t of c(this, ne))
16289
16338
  t.commit();
16290
- A(this, et, Vp).call(this, c(this, Ue).values());
16339
+ A(this, et, Vp).call(this, c(this, We).values());
16291
16340
  }
16292
16341
  unselectAll() {
16293
16342
  var t;
@@ -16308,11 +16357,11 @@ const za = class za {
16308
16357
  y(this, sr, null), c(this, Es)[0] = c(this, Es)[1] = 0, this.addCommands({
16309
16358
  cmd: () => {
16310
16359
  for (const l of o)
16311
- c(this, Ue).has(l.id) && l.translateInPage(r, s);
16360
+ c(this, We).has(l.id) && l.translateInPage(r, s);
16312
16361
  },
16313
16362
  undo: () => {
16314
16363
  for (const l of o)
16315
- c(this, Ue).has(l.id) && l.translateInPage(-r, -s);
16364
+ c(this, We).has(l.id) && l.translateInPage(-r, -s);
16316
16365
  },
16317
16366
  mustExec: !1
16318
16367
  });
@@ -16350,7 +16399,7 @@ const za = class za {
16350
16399
  if (!e)
16351
16400
  return !1;
16352
16401
  const i = (r, s, o, a) => {
16353
- if (c(this, Ue).has(r.id)) {
16402
+ if (c(this, We).has(r.id)) {
16354
16403
  const l = c(this, tn).get(a);
16355
16404
  l ? r._setParentAndPosition(l, s, o) : (r.pageIndex = a, r.x = s, r.y = o);
16356
16405
  }
@@ -16486,7 +16535,7 @@ const za = class za {
16486
16535
  i && (c(this, Ye) === Pt.NONE && !i.hasBeenModified || i.renderAnnotationElement(t));
16487
16536
  }
16488
16537
  };
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({
16538
+ 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
16539
  anchorNode: t
16491
16540
  }) {
16492
16541
  return t.nodeType === Node.TEXT_NODE ? t.parentElement : t;
@@ -16612,7 +16661,7 @@ qa = new WeakMap(), Vn = new WeakMap(), Ue = new WeakMap(), tn = new WeakMap(),
16612
16661
  for (const e of c(this, tn).values())
16613
16662
  t.push(e.enable());
16614
16663
  await Promise.all(t);
16615
- for (const e of c(this, Ue).values())
16664
+ for (const e of c(this, We).values())
16616
16665
  e.enable();
16617
16666
  }
16618
16667
  }, tw = function() {
@@ -16620,7 +16669,7 @@ qa = new WeakMap(), Vn = new WeakMap(), Ue = new WeakMap(), tn = new WeakMap(),
16620
16669
  y(this, As, !1);
16621
16670
  for (const t of c(this, tn).values())
16622
16671
  t.disable();
16623
- for (const t of c(this, Ue).values())
16672
+ for (const t of c(this, We).values())
16624
16673
  t.disable();
16625
16674
  }
16626
16675
  }, Wp = function(t) {
@@ -16632,10 +16681,10 @@ qa = new WeakMap(), Vn = new WeakMap(), Ue = new WeakMap(), tn = new WeakMap(),
16632
16681
  ;
16633
16682
  return t;
16634
16683
  }, Ec = function() {
16635
- if (c(this, Ue).size === 0)
16684
+ if (c(this, We).size === 0)
16636
16685
  return !0;
16637
- if (c(this, Ue).size === 1)
16638
- for (const t of c(this, Ue).values())
16686
+ if (c(this, We).size === 1)
16687
+ for (const t of c(this, We).values())
16639
16688
  return t.isEmpty();
16640
16689
  return !1;
16641
16690
  }, Vp = function(t) {
@@ -18079,7 +18128,7 @@ class sI {
18079
18128
  _inspectFont: e
18080
18129
  }) {
18081
18130
  if (!(!t || c(this, rl).has(t.loadedName))) {
18082
- if (Fe(!this.disableFontFace, "loadSystemFont shouldn't be called when `disableFontFace` is set."), this.isFontLoadingAPISupported) {
18131
+ if (je(!this.disableFontFace, "loadSystemFont shouldn't be called when `disableFontFace` is set."), this.isFontLoadingAPISupported) {
18083
18132
  const {
18084
18133
  loadedName: i,
18085
18134
  src: r,
@@ -18136,7 +18185,7 @@ class sI {
18136
18185
  }
18137
18186
  _queueLoadingCallback(t) {
18138
18187
  function e() {
18139
- for (Fe(!r.done, "completeRequest() cannot be called twice."), r.done = !0; i.length > 0 && i[0].done; ) {
18188
+ for (je(!r.done, "completeRequest() cannot be called twice."), r.done = !0; i.length > 0 && i[0].done; ) {
18140
18189
  const s = i.shift();
18141
18190
  setTimeout(s.callback, 0);
18142
18191
  }
@@ -18358,7 +18407,7 @@ class Cc {
18358
18407
  }), h.promise;
18359
18408
  },
18360
18409
  cancel: (u) => {
18361
- Fe(u instanceof Error, "cancel must have a valid reason");
18410
+ je(u instanceof Error, "cancel must have a valid reason");
18362
18411
  const h = Promise.withResolvers();
18363
18412
  return this.streamControllers[s].cancelCall = h, this.streamControllers[s].isClosed = !0, l.postMessage({
18364
18413
  sourceName: o,
@@ -18448,7 +18497,7 @@ sl = new WeakMap(), Si = new WeakSet(), mw = function({
18448
18497
  }), delete o.streamSinks[e]);
18449
18498
  },
18450
18499
  error(u) {
18451
- Fe(u instanceof Error, "error must have a valid reason"), !this.isCancelled && (this.isCancelled = !0, s.postMessage({
18500
+ je(u instanceof Error, "error must have a valid reason"), !this.isCancelled && (this.isCancelled = !0, s.postMessage({
18452
18501
  sourceName: i,
18453
18502
  targetName: r,
18454
18503
  stream: De.ERROR,
@@ -18519,17 +18568,17 @@ sl = new WeakMap(), Si = new WeakSet(), mw = function({
18519
18568
  });
18520
18569
  break;
18521
18570
  case De.ENQUEUE:
18522
- if (Fe(o, "enqueue should have stream controller"), o.isClosed)
18571
+ if (je(o, "enqueue should have stream controller"), o.isClosed)
18523
18572
  break;
18524
18573
  o.controller.enqueue(t.chunk);
18525
18574
  break;
18526
18575
  case De.CLOSE:
18527
- if (Fe(o, "close should have stream controller"), o.isClosed)
18576
+ if (je(o, "close should have stream controller"), o.isClosed)
18528
18577
  break;
18529
18578
  o.isClosed = !0, o.controller.close(), A(this, Si, ud).call(this, o, e);
18530
18579
  break;
18531
18580
  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);
18581
+ je(o, "error should have stream controller"), o.controller.error(Ln(t.reason)), A(this, Si, ud).call(this, o, e);
18533
18582
  break;
18534
18583
  case De.CANCEL_COMPLETE:
18535
18584
  t.success ? o.cancelCall.resolve() : o.cancelCall.reject(Ln(t.reason)), A(this, Si, ud).call(this, o, e);
@@ -20534,7 +20583,7 @@ class PI {
20534
20583
  disableRange: e = !1,
20535
20584
  disableStream: i = !1
20536
20585
  }) {
20537
- Fe(t, 'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');
20586
+ je(t, 'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');
20538
20587
  const {
20539
20588
  length: r,
20540
20589
  initialData: s,
@@ -20574,7 +20623,7 @@ class PI {
20574
20623
  const r = this._rangeReaders.some(function(s) {
20575
20624
  return s._begin !== t ? !1 : (s._enqueue(i), !0);
20576
20625
  });
20577
- Fe(r, "_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.");
20626
+ je(r, "_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.");
20578
20627
  }
20579
20628
  }
20580
20629
  get _progressiveDataLength() {
@@ -20599,7 +20648,7 @@ class PI {
20599
20648
  e >= 0 && this._rangeReaders.splice(e, 1);
20600
20649
  }
20601
20650
  getFullReader() {
20602
- Fe(!this._fullRequestReader, "PDFDataTransportStream.getFullReader can only be called once.");
20651
+ je(!this._fullRequestReader, "PDFDataTransportStream.getFullReader can only be called once.");
20603
20652
  const t = this._queuedChunks;
20604
20653
  return this._queuedChunks = null, new RI(this, t, this._progressiveDone, this._contentDispositionFilename);
20605
20654
  }
@@ -20885,7 +20934,7 @@ class jy {
20885
20934
  return ((t = this._fullRequestReader) == null ? void 0 : t._loaded) ?? 0;
20886
20935
  }
20887
20936
  getFullReader() {
20888
- return Fe(!this._fullRequestReader, "PDFFetchStream.getFullReader can only be called once."), this._fullRequestReader = new MI(this), this._fullRequestReader;
20937
+ return je(!this._fullRequestReader, "PDFFetchStream.getFullReader can only be called once."), this._fullRequestReader = new MI(this), this._fullRequestReader;
20889
20938
  }
20890
20939
  getRangeReader(t, e) {
20891
20940
  if (e <= this._progressiveDataLength)
@@ -21023,7 +21072,7 @@ class NI {
21023
21072
  e.open("GET", this.url), e.withCredentials = this.withCredentials;
21024
21073
  for (const [s, o] of this.headers)
21025
21074
  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 = () => {
21075
+ 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
21076
  t.onError(e.status);
21028
21077
  }, 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
21078
  }
@@ -21080,7 +21129,7 @@ class FI {
21080
21129
  e >= 0 && this._rangeRequestReaders.splice(e, 1);
21081
21130
  }
21082
21131
  getFullReader() {
21083
- return Fe(!this._fullRequestReader, "PDFNetworkStream.getFullReader can only be called once."), this._fullRequestReader = new jI(this._manager, this._source), this._fullRequestReader;
21132
+ return je(!this._fullRequestReader, "PDFNetworkStream.getFullReader can only be called once."), this._fullRequestReader = new jI(this._manager, this._source), this._fullRequestReader;
21084
21133
  }
21085
21134
  getRangeReader(t, e) {
21086
21135
  const i = new zI(this._manager, t, e);
@@ -21271,14 +21320,14 @@ function $I(n) {
21271
21320
  }
21272
21321
  class HI {
21273
21322
  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 = [];
21323
+ this.source = t, this.url = $I(t.url), je(this.url.protocol === "file:", "PDFNodeStream only supports file:// URLs."), this._fullRequestReader = null, this._rangeRequestReaders = [];
21275
21324
  }
21276
21325
  get _progressiveDataLength() {
21277
21326
  var t;
21278
21327
  return ((t = this._fullRequestReader) == null ? void 0 : t._loaded) ?? 0;
21279
21328
  }
21280
21329
  getFullReader() {
21281
- return Fe(!this._fullRequestReader, "PDFNodeStream.getFullReader can only be called once."), this._fullRequestReader = new UI(this), this._fullRequestReader;
21330
+ return je(!this._fullRequestReader, "PDFNodeStream.getFullReader can only be called once."), this._fullRequestReader = new UI(this), this._fullRequestReader;
21282
21331
  }
21283
21332
  getRangeReader(t, e) {
21284
21333
  if (e <= this._progressiveDataLength)
@@ -21411,7 +21460,7 @@ class WI {
21411
21460
  }
21412
21461
  const VI = 1e5, On = 30, qI = 0.8;
21413
21462
  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 {
21463
+ const Ue = class Ue {
21415
21464
  constructor({
21416
21465
  textContentSource: t,
21417
21466
  container: e,
@@ -21458,8 +21507,8 @@ const He = class He {
21458
21507
  pageX: o,
21459
21508
  pageY: a
21460
21509
  } = 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);
21510
+ 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(() => {
21511
+ c(Ue, pl).delete(this), y(this, Hr, null), y(this, dl, null);
21463
21512
  }).catch(() => {
21464
21513
  });
21465
21514
  }
@@ -21483,7 +21532,7 @@ const He = class He {
21483
21532
  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
21533
  }, c(this, Rs).reject);
21485
21534
  };
21486
- return y(this, jo, c(this, fl).getReader()), c(He, pl).add(this), t(), c(this, Rs).promise;
21535
+ return y(this, jo, c(this, fl).getReader()), c(Ue, pl).add(this), t(), c(this, Rs).promise;
21487
21536
  }
21488
21537
  update({
21489
21538
  viewport: t,
@@ -21498,7 +21547,7 @@ const He = class He {
21498
21547
  const o = {
21499
21548
  div: null,
21500
21549
  properties: null,
21501
- ctx: A(s = He, li, dd).call(s, c(this, Fo))
21550
+ ctx: A(s = Ue, li, dd).call(s, c(this, Fo))
21502
21551
  };
21503
21552
  for (const a of c(this, zo))
21504
21553
  o.properties = c(this, Bu).get(a), o.div = a, A(this, cs, cg).call(this, o);
@@ -21531,7 +21580,7 @@ Rs = new WeakMap(), Fn = new WeakMap(), Du = new WeakMap(), Nu = new WeakMap(),
21531
21580
  var r, s;
21532
21581
  if (c(this, Du))
21533
21582
  return;
21534
- (s = c(this, Hr)).ctx ?? (s.ctx = A(r = He, li, dd).call(r, c(this, Fo)));
21583
+ (s = c(this, Hr)).ctx ?? (s.ctx = A(r = Ue, li, dd).call(r, c(this, Fo)));
21535
21584
  const e = c(this, zo), i = c(this, zu);
21536
21585
  for (const o of t) {
21537
21586
  if (e.length > VI) {
@@ -21562,12 +21611,12 @@ Rs = new WeakMap(), Fn = new WeakMap(), Du = new WeakMap(), Nu = new WeakMap(),
21562
21611
  const o = c(this, dl)[t.fontName];
21563
21612
  o.vertical && (s += Math.PI / 2);
21564
21613
  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));
21614
+ a = Ue.fontFamilyMap.get(a) || a;
21615
+ const l = Math.hypot(r[2], r[3]), u = l * A(m = Ue, li, Nw).call(m, a, c(this, Fo));
21567
21616
  let h, d;
21568
21617
  s === 0 ? (h = r[4], d = r[5] - u) : (h = r[4] + u * Math.sin(s), d = r[5] - u * Math.cos(s));
21569
21618
  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));
21619
+ 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
21620
  let g = !1;
21572
21621
  if (t.str.length > 1)
21573
21622
  g = !0;
@@ -21589,14 +21638,14 @@ Rs = new WeakMap(), Fn = new WeakMap(), Du = new WeakMap(), Nu = new WeakMap(),
21589
21638
  style: s
21590
21639
  } = e;
21591
21640
  let o = "";
21592
- if (c(He, Os) > 1 && (o = `scale(${1 / c(He, Os)})`), i.canvasWidth !== 0 && i.hasText) {
21641
+ if (c(Ue, Os) > 1 && (o = `scale(${1 / c(Ue, Os)})`), i.canvasWidth !== 0 && i.hasText) {
21593
21642
  const {
21594
21643
  fontFamily: l
21595
21644
  } = s, {
21596
21645
  canvasWidth: u,
21597
21646
  fontSize: h
21598
21647
  } = i;
21599
- A(a = He, li, ug).call(a, r, h * c(this, Is), l);
21648
+ A(a = Ue, li, ug).call(a, r, h * c(this, Is), l);
21600
21649
  const {
21601
21650
  width: d
21602
21651
  } = r.measureText(e.textContent);
@@ -21653,8 +21702,8 @@ Rs = new WeakMap(), Fn = new WeakMap(), Du = new WeakMap(), Nu = new WeakMap(),
21653
21702
  r.canvas.width = r.canvas.height = 0;
21654
21703
  const u = o ? o / (o + a) : qI;
21655
21704
  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;
21705
+ }, 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());
21706
+ let Qc = Ue;
21658
21707
  class Zc {
21659
21708
  static textContent(t) {
21660
21709
  const e = [], i = {
@@ -22600,7 +22649,7 @@ class oO {
22600
22649
  loadingTask: e
22601
22650
  } = this;
22602
22651
  t.on("GetReader", (i, r) => {
22603
- Fe(this._networkStream, "GetReader - no `IPDFStream` instance available."), this._fullReader = this._networkStream.getFullReader(), this._fullReader.onProgress = (s) => {
22652
+ je(this._networkStream, "GetReader - no `IPDFStream` instance available."), this._fullReader = this._networkStream.getFullReader(), this._fullReader.onProgress = (s) => {
22604
22653
  this._lastProgress = {
22605
22654
  loaded: s.loaded,
22606
22655
  total: s.total
@@ -22614,7 +22663,7 @@ class oO {
22614
22663
  r.close();
22615
22664
  return;
22616
22665
  }
22617
- Fe(s instanceof ArrayBuffer, "GetReader - expected an ArrayBuffer."), r.enqueue(new Uint8Array(s), 1, [s]);
22666
+ je(s instanceof ArrayBuffer, "GetReader - expected an ArrayBuffer."), r.enqueue(new Uint8Array(s), 1, [s]);
22618
22667
  }).catch((s) => {
22619
22668
  r.error(s);
22620
22669
  });
@@ -22644,7 +22693,7 @@ class oO {
22644
22693
  contentLength: o
22645
22694
  };
22646
22695
  }), t.on("GetRangeReader", (i, r) => {
22647
- Fe(this._networkStream, "GetRangeReader - no `IPDFStream` instance available.");
22696
+ je(this._networkStream, "GetRangeReader - no `IPDFStream` instance available.");
22648
22697
  const s = this._networkStream.getRangeReader(i.begin, i.end);
22649
22698
  if (!s) {
22650
22699
  r.close();
@@ -22659,7 +22708,7 @@ class oO {
22659
22708
  r.close();
22660
22709
  return;
22661
22710
  }
22662
- Fe(o instanceof ArrayBuffer, "GetRangeReader - expected an ArrayBuffer."), r.enqueue(new Uint8Array(o), 1, [o]);
22711
+ je(o instanceof ArrayBuffer, "GetRangeReader - expected an ArrayBuffer."), r.enqueue(new Uint8Array(o), 1, [o]);
22663
22712
  }).catch((o) => {
22664
22713
  r.error(o);
22665
22714
  });
@@ -22731,7 +22780,7 @@ class oO {
22731
22780
  const {
22732
22781
  imageRef: f
22733
22782
  } = s;
22734
- Fe(f, "The imageRef must be defined.");
22783
+ je(f, "The imageRef must be defined.");
22735
22784
  for (const p of c(this, hr).values())
22736
22785
  for (const [, g] of p.objs)
22737
22786
  if ((g == null ? void 0 : g.ref) === f)
@@ -23325,11 +23374,11 @@ function Gs(n) {
23325
23374
  class dO {
23326
23375
  static create(t) {
23327
23376
  switch (t.data.annotationType) {
23328
- case $e.LINK:
23377
+ case He.LINK:
23329
23378
  return new Bw(t);
23330
- case $e.TEXT:
23379
+ case He.TEXT:
23331
23380
  return new fO(t);
23332
- case $e.WIDGET:
23381
+ case He.WIDGET:
23333
23382
  switch (t.data.fieldType) {
23334
23383
  case "Tx":
23335
23384
  return new pO(t);
@@ -23341,35 +23390,35 @@ class dO {
23341
23390
  return new gO(t);
23342
23391
  }
23343
23392
  return new ka(t);
23344
- case $e.POPUP:
23393
+ case He.POPUP:
23345
23394
  return new gg(t);
23346
- case $e.FREETEXT:
23395
+ case He.FREETEXT:
23347
23396
  return new Yw(t);
23348
- case $e.LINE:
23397
+ case He.LINE:
23349
23398
  return new wO(t);
23350
- case $e.SQUARE:
23399
+ case He.SQUARE:
23351
23400
  return new xO(t);
23352
- case $e.CIRCLE:
23401
+ case He.CIRCLE:
23353
23402
  return new AO(t);
23354
- case $e.POLYLINE:
23403
+ case He.POLYLINE:
23355
23404
  return new Xw(t);
23356
- case $e.CARET:
23405
+ case He.CARET:
23357
23406
  return new EO(t);
23358
- case $e.INK:
23407
+ case He.INK:
23359
23408
  return new Pm(t);
23360
- case $e.POLYGON:
23409
+ case He.POLYGON:
23361
23410
  return new SO(t);
23362
- case $e.HIGHLIGHT:
23411
+ case He.HIGHLIGHT:
23363
23412
  return new Kw(t);
23364
- case $e.UNDERLINE:
23413
+ case He.UNDERLINE:
23365
23414
  return new kO(t);
23366
- case $e.SQUIGGLY:
23415
+ case He.SQUIGGLY:
23367
23416
  return new _O(t);
23368
- case $e.STRIKEOUT:
23417
+ case He.STRIKEOUT:
23369
23418
  return new CO(t);
23370
- case $e.STAMP:
23419
+ case He.STAMP:
23371
23420
  return new Jw(t);
23372
- case $e.FILEATTACHMENT:
23421
+ case He.FILEATTACHMENT:
23373
23422
  return new TO(t);
23374
23423
  default:
23375
23424
  return new Me(t);
@@ -25057,7 +25106,7 @@ class PO {
25057
25106
  for (const a of e) {
25058
25107
  if (a.noHTML)
25059
25108
  continue;
25060
- const l = a.annotationType === $e.POPUP;
25109
+ const l = a.annotationType === He.POPUP;
25061
25110
  if (l) {
25062
25111
  const d = r.get(a.id);
25063
25112
  if (!d)
@@ -25123,14 +25172,14 @@ ih = new WeakMap(), Jo = new WeakMap(), Qo = new WeakMap(), rh = new WeakMap(),
25123
25172
  c(this, Jo).clear();
25124
25173
  };
25125
25174
  const Xh = /\r\n?|\n/g;
25126
- var Mi, Xn, sh, Zo, Kn, je, Zw, tx, ex, vd, as, wd, xd, nx, Ag, ix;
25175
+ var Mi, Xn, sh, Zo, Kn, ze, Zw, tx, ex, vd, as, wd, xd, nx, Ag, ix;
25127
25176
  const de = class de extends Ce {
25128
25177
  constructor(e) {
25129
25178
  super({
25130
25179
  ...e,
25131
25180
  name: "freeTextEditor"
25132
25181
  });
25133
- x(this, je);
25182
+ x(this, ze);
25134
25183
  x(this, Mi);
25135
25184
  x(this, Xn, "");
25136
25185
  x(this, sh, `${this.id}-editor`);
@@ -25186,10 +25235,10 @@ const de = class de extends Ce {
25186
25235
  updateParams(e, i) {
25187
25236
  switch (e) {
25188
25237
  case $t.FREETEXT_SIZE:
25189
- A(this, je, Zw).call(this, i);
25238
+ A(this, ze, Zw).call(this, i);
25190
25239
  break;
25191
25240
  case $t.FREETEXT_COLOR:
25192
- A(this, je, tx).call(this, i);
25241
+ A(this, ze, tx).call(this, i);
25193
25242
  break;
25194
25243
  }
25195
25244
  }
@@ -25249,7 +25298,7 @@ const de = class de extends Ce {
25249
25298
  if (!this.isInEditMode())
25250
25299
  return;
25251
25300
  super.commit(), this.disableEditMode();
25252
- const e = c(this, Xn), i = y(this, Xn, A(this, je, ex).call(this).trimEnd());
25301
+ const e = c(this, Xn), i = y(this, Xn, A(this, ze, ex).call(this).trimEnd());
25253
25302
  if (e === i)
25254
25303
  return;
25255
25304
  const r = (s) => {
@@ -25257,7 +25306,7 @@ const de = class de extends Ce {
25257
25306
  this.remove();
25258
25307
  return;
25259
25308
  }
25260
- A(this, je, xd).call(this), this._uiManager.rebuild(this), A(this, je, vd).call(this);
25309
+ A(this, ze, xd).call(this), this._uiManager.rebuild(this), A(this, ze, vd).call(this);
25261
25310
  };
25262
25311
  this.addCommands({
25263
25312
  cmd: () => {
@@ -25267,7 +25316,7 @@ const de = class de extends Ce {
25267
25316
  r(e);
25268
25317
  },
25269
25318
  mustExec: !1
25270
- }), A(this, je, vd).call(this);
25319
+ }), A(this, ze, vd).call(this);
25271
25320
  }
25272
25321
  shouldGetKeyboardEvents() {
25273
25322
  return this.isInEditMode();
@@ -25334,7 +25383,7 @@ const de = class de extends Ce {
25334
25383
  this.setAt(g * s, m * o, l, u);
25335
25384
  } else
25336
25385
  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;
25386
+ A(this, ze, xd).call(this), this._isDraggable = !0, this.editorDiv.contentEditable = !1;
25338
25387
  } else
25339
25388
  this._isDraggable = !1, this.editorDiv.contentEditable = !0;
25340
25389
  return this.div;
@@ -25385,7 +25434,7 @@ const de = class de extends Ce {
25385
25434
  }
25386
25435
  y(this, Xn, `${h.join(`
25387
25436
  `)}${s}${d.join(`
25388
- `)}`), A(this, je, xd).call(this);
25437
+ `)}`), A(this, ze, xd).call(this);
25389
25438
  const f = new Range();
25390
25439
  let p = h.reduce((b, w) => b + w.length, 0);
25391
25440
  for (const {
@@ -25456,13 +25505,13 @@ const de = class de extends Ce {
25456
25505
  annotationType: Pt.FREETEXT,
25457
25506
  color: s,
25458
25507
  fontSize: c(this, Kn),
25459
- value: A(this, je, nx).call(this),
25508
+ value: A(this, ze, nx).call(this),
25460
25509
  pageIndex: this.pageIndex,
25461
25510
  rect: r,
25462
25511
  rotation: this.rotation,
25463
25512
  structTreeParentId: this._structTreeParentId
25464
25513
  };
25465
- return e ? o : this.annotationElementId && !A(this, je, ix).call(this, o) ? null : (o.id = this.annotationElementId, o);
25514
+ return e ? o : this.annotationElementId && !A(this, ze, ix).call(this, o) ? null : (o.id = this.annotationElementId, o);
25466
25515
  }
25467
25516
  renderAnnotationElement(e) {
25468
25517
  const i = super.renderAnnotationElement(e);
@@ -25487,9 +25536,9 @@ const de = class de extends Ce {
25487
25536
  super.resetAnnotationElement(e), e.resetEdited();
25488
25537
  }
25489
25538
  };
25490
- Mi = new WeakMap(), Xn = new WeakMap(), sh = new WeakMap(), Zo = new WeakMap(), Kn = new WeakMap(), je = new WeakSet(), Zw = function(e) {
25539
+ Mi = new WeakMap(), Xn = new WeakMap(), sh = new WeakMap(), Zo = new WeakMap(), Kn = new WeakMap(), ze = new WeakSet(), Zw = function(e) {
25491
25540
  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);
25541
+ 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
25542
  }, r = c(this, Kn);
25494
25543
  this.addCommands({
25495
25544
  cmd: i.bind(this, e),
@@ -25986,7 +26035,7 @@ class IO extends ux {
25986
26035
  return new kg(t, e, i, r, s, o);
25987
26036
  }
25988
26037
  }
25989
- var Ni, ia, Il, We, ph, Ol, gh, mh, js, Fi, Ml, bh, re, _g, Cg, Tg, oo, gx, ps;
26038
+ var Ni, ia, Il, Ve, ph, Ol, gh, mh, js, Fi, Ml, bh, re, _g, Cg, Tg, oo, gx, ps;
25990
26039
  const Dn = class Dn {
25991
26040
  constructor({
25992
26041
  editor: t = null,
@@ -25996,7 +26045,7 @@ const Dn = class Dn {
25996
26045
  x(this, Ni, null);
25997
26046
  x(this, ia, null);
25998
26047
  x(this, Il);
25999
- x(this, We, null);
26048
+ x(this, Ve, null);
26000
26049
  x(this, ph, !1);
26001
26050
  x(this, Ol, !1);
26002
26051
  x(this, gh, null);
@@ -26029,7 +26078,7 @@ const Dn = class Dn {
26029
26078
  return i.className = "swatch", i.setAttribute("aria-hidden", !0), i.style.backgroundColor = c(this, Il), t.append(i), t;
26030
26079
  }
26031
26080
  renderMainDropdown() {
26032
- const t = y(this, We, A(this, re, _g).call(this));
26081
+ const t = y(this, Ve, A(this, re, _g).call(this));
26033
26082
  return t.setAttribute("aria-orientation", "horizontal"), t.setAttribute("aria-labelledby", "highlightColorPickerLabel"), t;
26034
26083
  }
26035
26084
  _colorSelectFromKeyboard(t) {
@@ -26047,14 +26096,14 @@ const Dn = class Dn {
26047
26096
  return;
26048
26097
  }
26049
26098
  if (t.target === c(this, Ni)) {
26050
- (e = c(this, We).firstChild) == null || e.focus();
26099
+ (e = c(this, Ve).firstChild) == null || e.focus();
26051
26100
  return;
26052
26101
  }
26053
26102
  (i = t.target.nextSibling) == null || i.focus();
26054
26103
  }
26055
26104
  _moveToPrevious(t) {
26056
26105
  var e, i;
26057
- if (t.target === ((e = c(this, We)) == null ? void 0 : e.firstChild) || t.target === c(this, Ni)) {
26106
+ if (t.target === ((e = c(this, Ve)) == null ? void 0 : e.firstChild) || t.target === c(this, Ni)) {
26058
26107
  c(this, re, ps) && this._hideDropdownFromKeyboard();
26059
26108
  return;
26060
26109
  }
@@ -26066,7 +26115,7 @@ const Dn = class Dn {
26066
26115
  A(this, re, oo).call(this, t);
26067
26116
  return;
26068
26117
  }
26069
- (e = c(this, We).firstChild) == null || e.focus();
26118
+ (e = c(this, Ve).firstChild) == null || e.focus();
26070
26119
  }
26071
26120
  _moveToEnd(t) {
26072
26121
  var e;
@@ -26074,11 +26123,11 @@ const Dn = class Dn {
26074
26123
  A(this, re, oo).call(this, t);
26075
26124
  return;
26076
26125
  }
26077
- (e = c(this, We).lastChild) == null || e.focus();
26126
+ (e = c(this, Ve).lastChild) == null || e.focus();
26078
26127
  }
26079
26128
  hideDropdown() {
26080
26129
  var t, e;
26081
- (t = c(this, We)) == null || t.classList.add("hidden"), (e = c(this, js)) == null || e.abort(), y(this, js, null);
26130
+ (t = c(this, Ve)) == null || t.classList.add("hidden"), (e = c(this, js)) == null || e.abort(), y(this, js, null);
26082
26131
  }
26083
26132
  _hideDropdownFromKeyboard() {
26084
26133
  var t;
@@ -26094,18 +26143,18 @@ const Dn = class Dn {
26094
26143
  }
26095
26144
  }
26096
26145
  updateColor(t) {
26097
- if (c(this, ia) && (c(this, ia).style.backgroundColor = t), !c(this, We))
26146
+ if (c(this, ia) && (c(this, ia).style.backgroundColor = t), !c(this, Ve))
26098
26147
  return;
26099
26148
  const e = c(this, Fi).highlightColors.values();
26100
- for (const i of c(this, We).children)
26149
+ for (const i of c(this, Ve).children)
26101
26150
  i.setAttribute("aria-selected", e.next().value === t);
26102
26151
  }
26103
26152
  destroy() {
26104
26153
  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);
26154
+ (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
26155
  }
26107
26156
  };
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() {
26157
+ 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
26158
  const t = document.createElement("div"), e = c(this, Fi)._signal;
26110
26159
  t.addEventListener("contextmenu", Wi, {
26111
26160
  signal: e
@@ -26136,17 +26185,17 @@ Ni = new WeakMap(), ia = new WeakMap(), Il = new WeakMap(), We = new WeakMap(),
26136
26185
  }
26137
26186
  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
26187
  signal: c(this, Fi).combinedSignal(c(this, js))
26139
- })), c(this, We)) {
26140
- c(this, We).classList.remove("hidden");
26188
+ })), c(this, Ve)) {
26189
+ c(this, Ve).classList.remove("hidden");
26141
26190
  return;
26142
26191
  }
26143
- const e = y(this, We, A(this, re, _g).call(this));
26192
+ const e = y(this, Ve, A(this, re, _g).call(this));
26144
26193
  c(this, Ni).append(e);
26145
26194
  }, gx = function(t) {
26146
26195
  var e;
26147
- (e = c(this, We)) != null && e.contains(t.target) || this.hideDropdown();
26196
+ (e = c(this, Ve)) != null && e.contains(t.target) || this.hideDropdown();
26148
26197
  }, ps = function() {
26149
- return c(this, We) && !c(this, We).classList.contains("hidden");
26198
+ return c(this, Ve) && !c(this, Ve).classList.contains("hidden");
26150
26199
  }, x(Dn, bh, null);
26151
26200
  let Vd = Dn;
26152
26201
  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 +28950,7 @@ function jO() {
28901
28950
  }
28902
28951
  const Hy = /* @__PURE__ */ new Map();
28903
28952
  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) => {
28953
+ 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
28954
  try {
28906
28955
  return !D || /^https?:\/\//i.test(D) ? D : new URL(D, window.location.origin).href;
28907
28956
  } catch {
@@ -29008,8 +29057,8 @@ function zO({ fileUrl: n, pageNumber: t, onMeta: e, scrollBehavior: i = "auto",
29008
29057
  }));
29009
29058
  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
29059
  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";
29060
+ const Be = `page-${M}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
29061
+ 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
29062
  const ge = L.querySelector("canvas"), ci = L.querySelector(".textLayer");
29014
29063
  ge && (ge.style.userSelect = "none", ge.style.webkitUserSelect = "none"), ci && (ci.style.userSelect = "none", ci.style.webkitUserSelect = "none", ci.style.pointerEvents = "none");
29015
29064
  const Ei = document.createElement("style");
@@ -29188,7 +29237,7 @@ function BO({
29188
29237
  onChangePage: h,
29189
29238
  onMeta: d
29190
29239
  }) {
29191
- const [f, p] = fe(!1), g = Ve(null), m = Ve(null), v = Ve(null);
29240
+ const [f, p] = fe(!1), g = Fe(null), m = Fe(null), v = Fe(null);
29192
29241
  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
29242
  /* @__PURE__ */ I.jsxs("div", { className: "modal-header", children: [
29194
29243
  /* @__PURE__ */ I.jsx("div", { className: "modal-title", children: e }),
@@ -29294,7 +29343,7 @@ function BO({
29294
29343
  }
29295
29344
  const hp = {};
29296
29345
  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();
29346
+ 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
29347
  si(() => {
29299
29348
  t && Promise.resolve(t()).then(Ei).catch(() => Ei(void 0));
29300
29349
  }, [t]);
@@ -29347,7 +29396,7 @@ function VO({ user: n, generateToken: t, clientId: e, apiBase: i, docsBase: r })
29347
29396
  if (!zt || !he) return;
29348
29397
  const me = he;
29349
29398
  C((Un) => {
29350
- const Be = Un[me], be = Be ? { ...Be, content: Be.content + zt } : { role: "assistant", content: zt, sources: Te || [], createdAt: Date.now() };
29399
+ const $e = Un[me], be = $e ? { ...$e, content: $e.content + zt } : { role: "assistant", content: zt, sources: Te || [], createdAt: Date.now() };
29351
29400
  return { ...Un, [me]: be };
29352
29401
  }), p(!1);
29353
29402
  }, _r = (zt) => {
@@ -29380,8 +29429,8 @@ function VO({ user: n, generateToken: t, clientId: e, apiBase: i, docsBase: r })
29380
29429
  (Ki = ve.current) == null || Ki.abort();
29381
29430
  } catch {
29382
29431
  }
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(() => {
29432
+ const $e = new AbortController();
29433
+ ve.current = $e, zt = (await ge.createConversation(mt.content.slice(0, 80), { signal: $e.signal })).id, b(zt), ge.listConversations().then(E).catch(() => {
29385
29434
  });
29386
29435
  }
29387
29436
  he = zt;
@@ -29394,15 +29443,15 @@ function VO({ user: n, generateToken: t, clientId: e, apiBase: i, docsBase: r })
29394
29443
  ve.current = Un, await ge.chatStream(
29395
29444
  { messages: me, conversationId: zt },
29396
29445
  {
29397
- onMetadata: (Be) => {
29398
- Te = Be || [], he && C((be) => {
29446
+ onMetadata: ($e) => {
29447
+ Te = $e || [], he && C((be) => {
29399
29448
  const Ge = be[he];
29400
29449
  return Ge ? { ...be, [he]: { ...Ge, sources: Te } } : be;
29401
29450
  });
29402
29451
  },
29403
- onText: (Be) => {
29452
+ onText: ($e) => {
29404
29453
  if (!N.current) return;
29405
- let be = qt + Be;
29454
+ let be = qt + $e;
29406
29455
  for (; ; ) {
29407
29456
  const Ge = _r(be);
29408
29457
  if (Ge === -1) {
@@ -29417,7 +29466,7 @@ function VO({ user: n, generateToken: t, clientId: e, apiBase: i, docsBase: r })
29417
29466
  }
29418
29467
  qt = be, qt.length >= ae && (kr(qt), qt = "");
29419
29468
  },
29420
- onComplete: (Be) => {
29469
+ onComplete: ($e) => {
29421
29470
  qt && kr(qt), qt = "", N.current && p(!1), he && C((be) => {
29422
29471
  const Ge = be[he];
29423
29472
  Ge && v === he && u((_a) => [..._a, Ge]);
@@ -29425,8 +29474,8 @@ function VO({ user: n, generateToken: t, clientId: e, apiBase: i, docsBase: r })
29425
29474
  return ds;
29426
29475
  });
29427
29476
  },
29428
- onError: (Be) => {
29429
- N.current && (m(Be), ze(Be, "error"), p(!1));
29477
+ onError: ($e) => {
29478
+ N.current && (m($e), Be($e, "error"), p(!1));
29430
29479
  }
29431
29480
  },
29432
29481
  { signal: Un.signal }
@@ -29434,9 +29483,9 @@ function VO({ user: n, generateToken: t, clientId: e, apiBase: i, docsBase: r })
29434
29483
  } catch (zt) {
29435
29484
  if (zt instanceof DOMException && zt.name === "AbortError") return;
29436
29485
  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));
29486
+ N.current && (m(me), Be(me, "error"), p(!1));
29438
29487
  }
29439
- }, [ge, v, h, f, l, ze]);
29488
+ }, [ge, v, h, f, l, Be]);
29440
29489
  si(() => {
29441
29490
  if (f && z.current) {
29442
29491
  Ee();
@@ -29519,7 +29568,7 @@ function VO({ user: n, generateToken: t, clientId: e, apiBase: i, docsBase: r })
29519
29568
  if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
29520
29569
  q.classList.add("js-motion");
29521
29570
  let Ki = 0, Ji = 0;
29522
- const zt = Math.PI * 2, me = 16, Un = 8, Be = 28;
29571
+ const zt = Math.PI * 2, me = 16, Un = 8, $e = 28;
29523
29572
  let be = 40;
29524
29573
  try {
29525
29574
  be = parseFloat(qt[0].getAttribute("r") || "40");
@@ -29527,7 +29576,7 @@ function VO({ user: n, generateToken: t, clientId: e, apiBase: i, docsBase: r })
29527
29576
  }
29528
29577
  const ki = (2 * be + 8) / Math.sqrt(3), ds = Math.max(34, ki + 6), _a = 12, lc = (eo) => {
29529
29578
  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;
29579
+ 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
29580
  qt.forEach((V) => {
29532
29581
  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
29582
  V.setAttribute("cx", Bt.toFixed(2)), V.setAttribute("cy", Lt.toFixed(2));
@@ -29695,9 +29744,9 @@ function VO({ user: n, generateToken: t, clientId: e, apiBase: i, docsBase: r })
29695
29744
  },
29696
29745
  onCopy: async (Et) => {
29697
29746
  try {
29698
- await navigator.clipboard.writeText(Et), ze("Copied response to clipboard", "success");
29747
+ await navigator.clipboard.writeText(Et), Be("Copied response to clipboard", "success");
29699
29748
  } catch {
29700
- ze("Copy failed. Please try again.", "error");
29749
+ Be("Copy failed. Please try again.", "error");
29701
29750
  }
29702
29751
  }
29703
29752
  }