@cas0570/chat-widget 0.0.7 → 0.0.9

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.
@@ -1,289 +1,360 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode(':root{--gcw-color-white: #fff;--gcw-color-gray-50: #f9fafb;--gcw-color-gray-100: #f3f4f6;--gcw-color-gray-200: #e5e7eb;--gcw-color-gray-300: #d1d5db;--gcw-color-gray-400: #9ca3af;--gcw-color-gray-500: #6b7280;--gcw-color-gray-600: #4b5563;--gcw-color-gray-700: #374151;--gcw-color-gray-800: #1f2937;--gcw-color-gray-900: #111827;--gcw-color-primary: #3b82f6;--gcw-color-primary-hover: #2563eb;--gcw-color-primary-light: #eff6ff;--gcw-color-error: #ef4444;--gcw-color-success: #22c55e;--gcw-font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;--gcw-font-size-xs: .625rem;--gcw-font-size-sm: .75rem;--gcw-font-size-base: .875rem;--gcw-font-size-lg: 1rem;--gcw-spacing-1: .25rem;--gcw-spacing-2: .5rem;--gcw-spacing-3: .75rem;--gcw-spacing-4: 1rem;--gcw-spacing-6: 1.5rem;--gcw-spacing-8: 2rem;--gcw-spacing-10: 2.5rem;--gcw-spacing-12: 3rem;--gcw-spacing-16: 4rem;--gcw-spacing-20: 5rem;--gcw-radius-sm: .25rem;--gcw-radius-md: .5rem;--gcw-radius-lg: .75rem;--gcw-radius-xl: 1rem;--gcw-radius-2xl: 1.25rem;--gcw-radius-full: 9999px;--gcw-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / .05);--gcw-shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--gcw-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--gcw-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--gcw-shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / .25);--gcw-transition-fast: .15s ease;--gcw-transition-base: .2s ease;--gcw-transition-slow: .3s ease;--gcw-z-widget: 9999}.gcw-widget,.gcw-widget *,.gcw-widget *:before,.gcw-widget *:after{box-sizing:border-box;margin:0;padding:0;font-family:var(--gcw-font-family);line-height:1.5}.gcw-widget{font-family:var(--gcw-font-family);font-size:var(--gcw-font-size-base);line-height:1.5;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color:var(--gcw-color-gray-800);text-align:left;letter-spacing:normal;word-spacing:normal;text-transform:none;text-indent:0;text-shadow:none;font-weight:400;font-style:normal}.gcw-container{position:fixed;z-index:var(--gcw-z-widget);display:flex;gap:var(--gcw-spacing-4)}.gcw-container--bottom-right{right:var(--gcw-spacing-4);bottom:var(--gcw-spacing-4);flex-direction:column-reverse;align-items:flex-end}.gcw-container--bottom-left{left:var(--gcw-spacing-4);bottom:var(--gcw-spacing-4);flex-direction:column-reverse;align-items:flex-start}.gcw-container--top-right{right:var(--gcw-spacing-4);top:var(--gcw-spacing-4);flex-direction:column;align-items:flex-end}.gcw-container--top-left{left:var(--gcw-spacing-4);top:var(--gcw-spacing-4);flex-direction:column;align-items:flex-start}.gcw-container--custom{flex-direction:column-reverse;align-items:flex-end}.gcw-container--custom.gcw-container--align-left{align-items:flex-start}.gcw-container--custom.gcw-container--flow-down{flex-direction:column}.gcw-toggle{position:relative;width:3.5rem;height:3.5rem;border:none;border-radius:var(--gcw-radius-full);background-color:var(--gcw-color-primary);color:var(--gcw-color-white);cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:var(--gcw-shadow-lg);transition:transform var(--gcw-transition-base),box-shadow var(--gcw-transition-base)}.gcw-toggle:hover{transform:scale(1.1);box-shadow:var(--gcw-shadow-xl)}.gcw-toggle:active{transform:scale(.95)}.gcw-toggle__icon{width:1.5rem;height:1.5rem;transition:transform var(--gcw-transition-slow)}.gcw-toggle__badge{position:absolute;top:-.25rem;right:-.25rem;width:1rem;height:1rem;border-radius:var(--gcw-radius-full);display:flex;align-items:center;justify-content:center;font-size:var(--gcw-font-size-xs);font-weight:700;animation:gcw-pulse 2s infinite}.gcw-toggle__badge--unread{background-color:var(--gcw-color-error);color:var(--gcw-color-white)}.gcw-toggle__badge--popout{background-color:var(--gcw-color-success)}.gcw-window{position:relative;display:flex;flex-direction:column;background-color:var(--gcw-color-white);border-radius:var(--gcw-radius-2xl);box-shadow:var(--gcw-shadow-2xl);border:1px solid var(--gcw-color-gray-200);overflow:hidden;animation:gcw-slide-up var(--gcw-transition-slow) ease-out}.gcw-window--small{width:365px;height:450px}.gcw-window--medium{width:380px;height:560px}.gcw-window--large{width:480px;height:680px}.gcw-window--fullscreen{width:calc(100vw - 2rem);height:calc(100vh - 6rem);max-width:56rem}.gcw-window{max-height:90vh;transition:width var(--gcw-transition-base),height var(--gcw-transition-base)}.gcw-header{display:flex;align-items:center;justify-content:space-between;padding:var(--gcw-spacing-3) var(--gcw-spacing-4);color:var(--gcw-color-white);flex-shrink:0}.gcw-header__left{display:flex;align-items:center;gap:var(--gcw-spacing-3)}.gcw-header__avatar{width:2.5rem;height:2.5rem;border-radius:var(--gcw-radius-full);background-color:#fff3;display:flex;align-items:center;justify-content:center}.gcw-header__avatar-icon{width:1.25rem;height:1.25rem}.gcw-header__info{display:flex;flex-direction:column;min-width:0;flex:1}.gcw-header__title{font-size:var(--gcw-font-size-base);font-weight:600;line-height:1.4;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gcw-header__subtitle{font-size:var(--gcw-font-size-sm);font-weight:400;line-height:1.4;opacity:.9;margin:0;word-wrap:break-word;overflow-wrap:break-word}.gcw-header__actions{display:flex;align-items:center;gap:.125rem}.gcw-header__btn{width:2rem;height:2rem;border:none;border-radius:var(--gcw-radius-full);background-color:transparent;color:inherit;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background-color var(--gcw-transition-fast)}.gcw-header__btn:hover{background-color:#fff3}.gcw-header__btn-icon{width:1rem;height:1rem}.gcw-header-menu{position:relative}.gcw-header-menu__dropdown{position:absolute;top:calc(100% + .25rem);right:0;min-width:12rem;background-color:var(--gcw-color-white);border-radius:var(--gcw-radius-lg);box-shadow:var(--gcw-shadow-xl);border:1px solid var(--gcw-color-gray-200);padding:var(--gcw-spacing-1) 0;z-index:10;animation:gcw-menu-appear var(--gcw-transition-fast) ease-out}.gcw-header-menu__item{display:flex;align-items:center;gap:var(--gcw-spacing-3);width:100%;padding:var(--gcw-spacing-2) var(--gcw-spacing-3);border:none;background:none;color:var(--gcw-color-gray-700);font-family:var(--gcw-font-family);font-size:var(--gcw-font-size-sm);cursor:pointer;transition:background-color var(--gcw-transition-fast);text-align:left;white-space:nowrap}.gcw-header-menu__item:hover{background-color:var(--gcw-color-gray-100)}.gcw-header-menu__item--danger{color:var(--gcw-color-error)}.gcw-header-menu__item--danger:hover{background-color:#fef2f2}.gcw-header-menu__icon{width:1rem;height:1rem;flex-shrink:0}.gcw-header-menu__divider{height:1px;background-color:var(--gcw-color-gray-200);margin:var(--gcw-spacing-1) 0}@keyframes gcw-menu-appear{0%{opacity:0;transform:translateY(-.25rem)}to{opacity:1;transform:translateY(0)}}.gcw-messages{flex:1;overflow-y:auto;padding:var(--gcw-spacing-4);display:flex;flex-direction:column;gap:var(--gcw-spacing-4)}.gcw-messages::-webkit-scrollbar{width:6px}.gcw-messages::-webkit-scrollbar-track{background:transparent}.gcw-messages::-webkit-scrollbar-thumb{background-color:var(--gcw-color-gray-300);border-radius:3px}.gcw-messages::-webkit-scrollbar-thumb:hover{background-color:var(--gcw-color-gray-400)}.gcw-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:var(--gcw-spacing-6);color:var(--gcw-color-gray-400);text-align:center}.gcw-empty__icon{width:4rem;height:4rem;margin-bottom:var(--gcw-spacing-4);opacity:.5}.gcw-empty__text{font-size:var(--gcw-font-size-base);font-weight:400;line-height:1.5;margin:0}.gcw-session-loading{display:flex;flex-direction:column;align-items:center;gap:var(--gcw-spacing-3)}.gcw-session-loading__spinner{width:2rem;height:2rem;border:3px solid var(--gcw-color-gray-200);border-top-color:var(--gcw-color-primary);border-radius:50%;animation:gcw-spin .8s linear infinite}@keyframes gcw-spin{to{transform:rotate(360deg)}}.gcw-bubble-row{display:flex}.gcw-bubble-row--user{justify-content:flex-end}.gcw-bubble-row--assistant{justify-content:flex-start}.gcw-bubble-wrapper{max-width:85%;display:flex;flex-direction:column}.gcw-bubble-wrapper--user{align-items:flex-end}.gcw-bubble-wrapper--assistant{align-items:flex-start}.gcw-bubble{padding:var(--gcw-spacing-2) var(--gcw-spacing-4);border-radius:var(--gcw-radius-2xl);font-size:var(--gcw-font-size-base);font-weight:400;line-height:1.6;letter-spacing:normal;word-wrap:break-word}.gcw-bubble--user{color:var(--gcw-color-white);border-bottom-right-radius:var(--gcw-radius-sm)}.gcw-bubble--assistant{background-color:var(--gcw-color-gray-100);color:var(--gcw-color-gray-800);border-bottom-left-radius:var(--gcw-radius-sm)}.gcw-bubble__timestamp{font-size:var(--gcw-font-size-xs);color:var(--gcw-color-gray-400);margin-top:var(--gcw-spacing-1);padding:0 var(--gcw-spacing-1)}.gcw-content p{margin-bottom:var(--gcw-spacing-2)}.gcw-content p:last-child{margin-bottom:0}.gcw-content strong{font-weight:600}.gcw-content em{font-style:italic}.gcw-content ul,.gcw-content ol{margin:var(--gcw-spacing-2) 0;padding-left:var(--gcw-spacing-6)}.gcw-content li{margin-bottom:var(--gcw-spacing-1)}.gcw-content code{background-color:#0000001a;padding:.125rem .375rem;border-radius:var(--gcw-radius-sm);font-size:.875em;font-family:SF Mono,Monaco,Consolas,monospace}.gcw-bubble--user .gcw-content code{background-color:#fff3}.gcw-content pre{background-color:var(--gcw-color-gray-800);color:var(--gcw-color-gray-100);padding:var(--gcw-spacing-3);border-radius:var(--gcw-radius-md);overflow-x:auto;margin:var(--gcw-spacing-2) 0}.gcw-content pre code{background-color:transparent;padding:0;font-size:var(--gcw-font-size-sm)}.gcw-content a{color:var(--gcw-color-primary);text-decoration:underline}.gcw-content a:hover{color:var(--gcw-color-primary-hover)}.gcw-bubble--user .gcw-content a{color:#ffffffe6}.gcw-md-heading{font-weight:600;margin-top:var(--gcw-spacing-3);margin-bottom:var(--gcw-spacing-1)}.gcw-md-heading--h2{font-size:var(--gcw-font-size-lg);font-weight:700}.gcw-md-heading--h3,.gcw-md-heading--h4{font-size:var(--gcw-font-size-base)}.gcw-md-heading--h5{font-size:var(--gcw-font-size-sm)}.gcw-md-paragraph{margin-bottom:var(--gcw-spacing-2)}.gcw-md-paragraph:last-child{margin-bottom:0}.gcw-md-list{margin:var(--gcw-spacing-2) 0;padding-left:var(--gcw-spacing-4)}.gcw-md-list--ul{list-style-type:disc}.gcw-md-list--ol{list-style-type:decimal}.gcw-md-list__item{font-size:var(--gcw-font-size-base);margin-bottom:var(--gcw-spacing-1)}.gcw-md-bold{font-weight:600}.gcw-md-italic{font-style:italic}.gcw-md-code{background-color:var(--gcw-color-gray-200);padding:.125rem var(--gcw-spacing-2);border-radius:var(--gcw-radius-sm);font-size:var(--gcw-font-size-sm);font-family:SF Mono,Monaco,Consolas,monospace}.gcw-bubble--user .gcw-md-code{background-color:#fff3}.gcw-md-code-block{background-color:var(--gcw-color-gray-800);color:var(--gcw-color-gray-100);padding:var(--gcw-spacing-3);border-radius:var(--gcw-radius-lg);font-size:var(--gcw-font-size-sm);overflow-x:auto;margin:var(--gcw-spacing-2) 0}.gcw-md-code-block code{font-family:SF Mono,Monaco,Consolas,monospace}.gcw-md-link{color:var(--gcw-color-primary);text-decoration:underline}.gcw-md-link:hover{color:var(--gcw-color-primary-hover)}.gcw-bubble--user .gcw-md-link{color:#ffffffe6}.gcw-sources{display:flex;flex-wrap:wrap;gap:var(--gcw-spacing-2);margin-top:var(--gcw-spacing-2)}.gcw-source{display:inline-flex;align-items:center;gap:var(--gcw-spacing-1);padding:var(--gcw-spacing-1) var(--gcw-spacing-2);border-radius:var(--gcw-radius-full);background-color:var(--gcw-color-primary-light);color:var(--gcw-color-primary);font-size:var(--gcw-font-size-sm);text-decoration:none;transition:background-color var(--gcw-transition-fast)}.gcw-source:hover{background-color:#dbeafe}.gcw-source__icon{width:.75rem;height:.75rem}.gcw-typing{display:flex;justify-content:flex-start}.gcw-typing__bubble{background-color:var(--gcw-color-gray-100);padding:var(--gcw-spacing-3) var(--gcw-spacing-4);border-radius:var(--gcw-radius-2xl);border-bottom-left-radius:var(--gcw-radius-sm)}.gcw-typing__dots{display:flex;gap:var(--gcw-spacing-1)}.gcw-typing__dot{width:.5rem;height:.5rem;background-color:var(--gcw-color-gray-400);border-radius:var(--gcw-radius-full);animation:gcw-typing-bounce 1.4s infinite ease-in-out both}.gcw-typing__dot:nth-child(1){animation-delay:-.32s}.gcw-typing__dot:nth-child(2){animation-delay:-.16s}.gcw-input-area{padding:var(--gcw-spacing-3);border-top:1px solid var(--gcw-color-gray-200);background-color:var(--gcw-color-white);flex-shrink:0}.gcw-input-row{display:flex;align-items:flex-end;gap:var(--gcw-spacing-2)}.gcw-input{flex:1;min-height:44px;max-height:120px;padding:var(--gcw-spacing-2) var(--gcw-spacing-4);border:1px solid var(--gcw-color-gray-200);border-radius:var(--gcw-radius-xl);background-color:var(--gcw-color-white);color:var(--gcw-color-gray-800);font-family:var(--gcw-font-family);font-size:var(--gcw-font-size-base);font-weight:400;line-height:1.5;letter-spacing:normal;resize:none;outline:none;transition:border-color var(--gcw-transition-fast),box-shadow var(--gcw-transition-fast)}.gcw-input:focus{border-color:var(--gcw-color-primary);box-shadow:0 0 0 3px #3b82f61a}.gcw-input:disabled{background-color:var(--gcw-color-gray-50);cursor:not-allowed}.gcw-input::placeholder{color:var(--gcw-color-gray-400)}.gcw-send-btn{width:2.5rem;height:2.5rem;flex-shrink:0;border:none;border-radius:var(--gcw-radius-lg);color:var(--gcw-color-white);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:opacity var(--gcw-transition-fast),transform var(--gcw-transition-fast)}.gcw-send-btn:hover:not(:disabled){opacity:.9}.gcw-send-btn:active:not(:disabled){transform:scale(.95)}.gcw-send-btn:disabled{opacity:.5;cursor:not-allowed}.gcw-send-btn__icon{width:1.25rem;height:1.25rem}.gcw-input-hint{font-size:var(--gcw-font-size-xs);color:var(--gcw-color-gray-400);text-align:center;margin-top:var(--gcw-spacing-2)}@keyframes gcw-slide-up{0%{opacity:0;transform:translateY(1rem)}to{opacity:1;transform:translateY(0)}}@keyframes gcw-pulse{0%,to{opacity:1}50%{opacity:.5}}@keyframes gcw-typing-bounce{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}@keyframes gcw-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.gcw-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.gcw-spin{animation:gcw-spin 1s linear infinite}.gcw-history{display:flex;flex-direction:column;flex:1;overflow:hidden;animation:gcw-slide-in-left var(--gcw-transition-base) ease-out}.gcw-history__header{display:flex;align-items:center;gap:var(--gcw-spacing-3);padding:var(--gcw-spacing-2) var(--gcw-spacing-3);color:var(--gcw-color-white);flex-shrink:0}.gcw-history__title{flex:1;font-size:var(--gcw-font-size-base);font-weight:600;margin:0}.gcw-history__list{flex:1;overflow-y:auto;padding:var(--gcw-spacing-2) 0}.gcw-history__list::-webkit-scrollbar{width:6px}.gcw-history__list::-webkit-scrollbar-track{background:transparent}.gcw-history__list::-webkit-scrollbar-thumb{background-color:var(--gcw-color-gray-300);border-radius:3px}.gcw-history__loading{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--gcw-spacing-3);padding:var(--gcw-spacing-8);color:var(--gcw-color-gray-400);font-size:var(--gcw-font-size-sm)}.gcw-history__empty{display:flex;align-items:center;justify-content:center;padding:var(--gcw-spacing-8);color:var(--gcw-color-gray-400);font-size:var(--gcw-font-size-sm)}.gcw-history__item{display:flex;align-items:center;justify-content:space-between;gap:var(--gcw-spacing-2);width:100%;padding:var(--gcw-spacing-3) var(--gcw-spacing-4);border:none;border-left:3px solid transparent;background:none;cursor:pointer;text-align:left;transition:background-color var(--gcw-transition-fast);font-family:var(--gcw-font-family)}.gcw-history__item:hover{background-color:var(--gcw-color-gray-50)}.gcw-history__item--active{background-color:var(--gcw-color-primary-light)}.gcw-history__item-content{display:flex;flex-direction:column;gap:.125rem;min-width:0;flex:1}.gcw-history__item-title{font-size:var(--gcw-font-size-sm);font-weight:500;color:var(--gcw-color-gray-800);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gcw-history__item-meta{font-size:var(--gcw-font-size-xs);color:var(--gcw-color-gray-400)}.gcw-history__item-delete{flex-shrink:0;width:1.75rem;height:1.75rem;border:none;border-radius:var(--gcw-radius-md);background:transparent;color:var(--gcw-color-gray-300);cursor:pointer;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity var(--gcw-transition-fast),color var(--gcw-transition-fast),background-color var(--gcw-transition-fast)}.gcw-history__item:hover .gcw-history__item-delete{opacity:1}.gcw-history__item-delete:hover{color:var(--gcw-color-error);background-color:#ef44441a}.gcw-history__item-delete-icon{width:.875rem;height:.875rem}@keyframes gcw-slide-in-left{0%{opacity:0;transform:translate(-1rem)}to{opacity:1;transform:translate(0)}}.gcw-modal-overlay{position:absolute;top:0;right:0;bottom:0;left:0;background:#0006;display:flex;align-items:center;justify-content:center;z-index:100;animation:gcw-fade-in .15s ease-out;border-radius:var(--gcw-radius-2xl)}.gcw-modal{background:#fff;border-radius:.75rem;padding:1.25rem;margin:1rem;max-width:20rem;width:100%;box-shadow:0 8px 24px #00000026;animation:gcw-scale-in .15s ease-out}.gcw-modal__title{font-size:.9375rem;font-weight:600;color:#1f2937;margin:0 0 .5rem}.gcw-modal__message{font-size:.8125rem;color:#6b7280;line-height:1.5;margin:0 0 1.25rem}.gcw-modal__actions{display:flex;gap:.5rem;justify-content:flex-end}.gcw-modal__btn{padding:.4375rem .875rem;border-radius:.375rem;font-size:.8125rem;font-weight:500;cursor:pointer;border:1px solid #e5e7eb;transition:background-color .15s,border-color .15s}.gcw-modal__btn--cancel{background:#fff;color:#374151}.gcw-modal__btn--cancel:hover{background:#f9fafb;border-color:#d1d5db}.gcw-modal__btn--confirm{background:#3b82f6;color:#fff;border-color:#3b82f6}.gcw-modal__btn--confirm:hover{background:#2563eb;border-color:#2563eb}.gcw-modal__btn--danger{background:#ef4444;border-color:#ef4444}.gcw-modal__btn--danger:hover{background:#dc2626;border-color:#dc2626}@keyframes gcw-fade-in{0%{opacity:0}to{opacity:1}}@keyframes gcw-scale-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}')),document.head.appendChild(r)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
2
- import { jsxs as d, jsx as t, Fragment as ge } from "react/jsx-runtime";
3
- import pe, { useState as x, useRef as H, useCallback as $, useEffect as C } from "react";
4
- const fe = "gcw_session_", we = "gcw_popout_", be = "gcw_read_";
5
- function q(e) {
6
- return `${fe}${e || "default"}`;
1
+ (function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode(':root{--gcw-color-white: #fff;--gcw-color-gray-50: #f9fafb;--gcw-color-gray-100: #f3f4f6;--gcw-color-gray-200: #e5e7eb;--gcw-color-gray-300: #d1d5db;--gcw-color-gray-400: #9ca3af;--gcw-color-gray-500: #6b7280;--gcw-color-gray-600: #4b5563;--gcw-color-gray-700: #374151;--gcw-color-gray-800: #1f2937;--gcw-color-gray-900: #111827;--gcw-color-primary: #3b82f6;--gcw-color-primary-hover: #2563eb;--gcw-color-primary-light: #eff6ff;--gcw-color-error: #ef4444;--gcw-color-success: #22c55e;--gcw-font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;--gcw-font-size-xs: .625rem;--gcw-font-size-sm: .75rem;--gcw-font-size-base: .875rem;--gcw-font-size-lg: 1rem;--gcw-spacing-1: .25rem;--gcw-spacing-2: .5rem;--gcw-spacing-3: .75rem;--gcw-spacing-4: 1rem;--gcw-spacing-6: 1.5rem;--gcw-spacing-8: 2rem;--gcw-spacing-10: 2.5rem;--gcw-spacing-12: 3rem;--gcw-spacing-16: 4rem;--gcw-spacing-20: 5rem;--gcw-radius-sm: .25rem;--gcw-radius-md: .5rem;--gcw-radius-lg: .75rem;--gcw-radius-xl: 1rem;--gcw-radius-2xl: 1.25rem;--gcw-radius-full: 9999px;--gcw-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / .05);--gcw-shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--gcw-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--gcw-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--gcw-shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / .25);--gcw-transition-fast: .15s ease;--gcw-transition-base: .2s ease;--gcw-transition-slow: .3s ease;--gcw-z-widget: 9999}.gcw-widget,.gcw-widget *,.gcw-widget *:before,.gcw-widget *:after{box-sizing:border-box;margin:0;padding:0;font-family:var(--gcw-font-family);line-height:1.5}.gcw-widget{font-family:var(--gcw-font-family);font-size:var(--gcw-font-size-base);line-height:1.5;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color:var(--gcw-color-gray-800);text-align:left;letter-spacing:normal;word-spacing:normal;text-transform:none;text-indent:0;text-shadow:none;font-weight:400;font-style:normal}.gcw-container{position:fixed;z-index:var(--gcw-z-widget);display:flex;gap:var(--gcw-spacing-4)}.gcw-container--bottom-right{right:var(--gcw-spacing-4);bottom:var(--gcw-spacing-4);flex-direction:column-reverse;align-items:flex-end}.gcw-container--bottom-left{left:var(--gcw-spacing-4);bottom:var(--gcw-spacing-4);flex-direction:column-reverse;align-items:flex-start}.gcw-container--top-right{right:var(--gcw-spacing-4);top:var(--gcw-spacing-4);flex-direction:column;align-items:flex-end}.gcw-container--top-left{left:var(--gcw-spacing-4);top:var(--gcw-spacing-4);flex-direction:column;align-items:flex-start}.gcw-container--custom{flex-direction:column-reverse;align-items:flex-end}.gcw-container--custom.gcw-container--align-left{align-items:flex-start}.gcw-container--custom.gcw-container--flow-down{flex-direction:column}.gcw-toggle{position:relative;width:3.5rem;height:3.5rem;border:none;border-radius:var(--gcw-radius-full);background-color:var(--gcw-color-primary);color:var(--gcw-color-white);cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:var(--gcw-shadow-lg);transition:transform var(--gcw-transition-base),box-shadow var(--gcw-transition-base)}.gcw-toggle:hover{transform:scale(1.1);box-shadow:var(--gcw-shadow-xl)}.gcw-toggle:active{transform:scale(.95)}.gcw-toggle__icon{width:1.5rem;height:1.5rem;transition:transform var(--gcw-transition-slow)}.gcw-toggle__badge{position:absolute;top:-.25rem;right:-.25rem;width:1rem;height:1rem;border-radius:var(--gcw-radius-full);display:flex;align-items:center;justify-content:center;font-size:var(--gcw-font-size-xs);font-weight:700;animation:gcw-pulse 2s infinite}.gcw-toggle__badge--unread{background-color:var(--gcw-color-error);color:var(--gcw-color-white)}.gcw-toggle__badge--popout{background-color:var(--gcw-color-success)}.gcw-window{position:relative;display:flex;flex-direction:column;background-color:var(--gcw-color-white);border-radius:var(--gcw-radius-2xl);box-shadow:var(--gcw-shadow-2xl);border:1px solid var(--gcw-color-gray-200);overflow:hidden;animation:gcw-slide-up var(--gcw-transition-slow) ease-out}.gcw-window--small{width:365px;height:450px}.gcw-window--medium{width:380px;height:560px}.gcw-window--large{width:480px;height:680px}.gcw-window--fullscreen{width:calc(100vw - 2rem);height:calc(100vh - 6rem);max-width:56rem}.gcw-window{max-height:90vh;transition:width var(--gcw-transition-base),height var(--gcw-transition-base)}.gcw-header{display:flex;align-items:center;justify-content:space-between;padding:var(--gcw-spacing-3) var(--gcw-spacing-4);color:var(--gcw-color-white);flex-shrink:0}.gcw-header__left{display:flex;align-items:center;gap:var(--gcw-spacing-3)}.gcw-header__avatar{width:2.5rem;height:2.5rem;border-radius:var(--gcw-radius-full);background-color:#fff3;display:flex;align-items:center;justify-content:center}.gcw-header__avatar-icon{width:1.25rem;height:1.25rem}.gcw-header__info{display:flex;flex-direction:column;min-width:0;flex:1}.gcw-header__title{font-size:var(--gcw-font-size-base);font-weight:600;line-height:1.4;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gcw-header__subtitle{font-size:var(--gcw-font-size-sm);font-weight:400;line-height:1.4;opacity:.9;margin:0;word-wrap:break-word;overflow-wrap:break-word}.gcw-header__actions{display:flex;align-items:center;gap:.125rem}.gcw-header__btn{width:2rem;height:2rem;border:none;border-radius:var(--gcw-radius-full);background-color:transparent;color:inherit;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background-color var(--gcw-transition-fast)}.gcw-header__btn:hover{background-color:#fff3}.gcw-header__btn-icon{width:1rem;height:1rem}.gcw-header-menu{position:relative}.gcw-header-menu__dropdown{position:absolute;top:calc(100% + .25rem);right:0;min-width:12rem;background-color:var(--gcw-color-white);border-radius:var(--gcw-radius-lg);box-shadow:var(--gcw-shadow-xl);border:1px solid var(--gcw-color-gray-200);padding:var(--gcw-spacing-1) 0;z-index:10;animation:gcw-menu-appear var(--gcw-transition-fast) ease-out}.gcw-header-menu__item{display:flex;align-items:center;gap:var(--gcw-spacing-3);width:100%;padding:var(--gcw-spacing-2) var(--gcw-spacing-3);border:none;background:none;color:var(--gcw-color-gray-700);font-family:var(--gcw-font-family);font-size:var(--gcw-font-size-sm);cursor:pointer;transition:background-color var(--gcw-transition-fast);text-align:left;white-space:nowrap}.gcw-header-menu__item:hover{background-color:var(--gcw-color-gray-100)}.gcw-header-menu__item--danger{color:var(--gcw-color-error)}.gcw-header-menu__item--danger:hover{background-color:#fef2f2}.gcw-header-menu__icon{width:1rem;height:1rem;flex-shrink:0}.gcw-header-menu__divider{height:1px;background-color:var(--gcw-color-gray-200);margin:var(--gcw-spacing-1) 0}@keyframes gcw-menu-appear{0%{opacity:0;transform:translateY(-.25rem)}to{opacity:1;transform:translateY(0)}}.gcw-messages{flex:1;overflow-y:auto;padding:var(--gcw-spacing-4);display:flex;flex-direction:column;gap:var(--gcw-spacing-4)}.gcw-messages::-webkit-scrollbar{width:6px}.gcw-messages::-webkit-scrollbar-track{background:transparent}.gcw-messages::-webkit-scrollbar-thumb{background-color:var(--gcw-color-gray-300);border-radius:3px}.gcw-messages::-webkit-scrollbar-thumb:hover{background-color:var(--gcw-color-gray-400)}.gcw-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:var(--gcw-spacing-6);color:var(--gcw-color-gray-400);text-align:center}.gcw-empty__icon{width:4rem;height:4rem;margin-bottom:var(--gcw-spacing-4);opacity:.5}.gcw-empty__text{font-size:var(--gcw-font-size-base);font-weight:400;line-height:1.5;margin:0}.gcw-session-loading{display:flex;flex-direction:column;align-items:center;gap:var(--gcw-spacing-3)}.gcw-session-loading__spinner{width:2rem;height:2rem;border:3px solid var(--gcw-color-gray-200);border-top-color:var(--gcw-color-primary);border-radius:50%;animation:gcw-spin .8s linear infinite}.gcw-bubble-row{display:flex}.gcw-bubble-row--user{justify-content:flex-end}.gcw-bubble-row--assistant{justify-content:flex-start}.gcw-bubble-wrapper{max-width:85%;display:flex;flex-direction:column}.gcw-bubble-wrapper--user{align-items:flex-end}.gcw-bubble-wrapper--assistant{align-items:flex-start}.gcw-bubble{padding:var(--gcw-spacing-2) var(--gcw-spacing-4);border-radius:var(--gcw-radius-2xl);font-size:var(--gcw-font-size-base);font-weight:400;line-height:1.6;letter-spacing:normal;word-wrap:break-word}.gcw-bubble--user{color:var(--gcw-color-white);border-bottom-right-radius:var(--gcw-radius-sm)}.gcw-bubble--assistant{background-color:var(--gcw-color-gray-100);color:var(--gcw-color-gray-800);border-bottom-left-radius:var(--gcw-radius-sm)}.gcw-bubble__timestamp{font-size:var(--gcw-font-size-xs);color:var(--gcw-color-gray-400);margin-top:var(--gcw-spacing-1);padding:0 var(--gcw-spacing-1)}.gcw-content p{margin-bottom:var(--gcw-spacing-2)}.gcw-content p:last-child{margin-bottom:0}.gcw-content strong{font-weight:600}.gcw-content em{font-style:italic}.gcw-content ul,.gcw-content ol{margin:var(--gcw-spacing-2) 0;padding-left:var(--gcw-spacing-6)}.gcw-content li{margin-bottom:var(--gcw-spacing-1)}.gcw-content code{background-color:#0000001a;padding:.125rem .375rem;border-radius:var(--gcw-radius-sm);font-size:.875em;font-family:SF Mono,Monaco,Consolas,monospace}.gcw-bubble--user .gcw-content code{background-color:#fff3}.gcw-content pre{background-color:var(--gcw-color-gray-800);color:var(--gcw-color-gray-100);padding:var(--gcw-spacing-3);border-radius:var(--gcw-radius-md);overflow-x:auto;margin:var(--gcw-spacing-2) 0}.gcw-content pre code{background-color:transparent;padding:0;font-size:var(--gcw-font-size-sm)}.gcw-content a{color:var(--gcw-color-primary);text-decoration:underline}.gcw-content a:hover{color:var(--gcw-color-primary-hover)}.gcw-bubble--user .gcw-content a{color:#ffffffe6}.gcw-md-heading{font-weight:600;margin-top:var(--gcw-spacing-3);margin-bottom:var(--gcw-spacing-1)}.gcw-md-heading--h2{font-size:var(--gcw-font-size-lg);font-weight:700}.gcw-md-heading--h3,.gcw-md-heading--h4{font-size:var(--gcw-font-size-base)}.gcw-md-heading--h5{font-size:var(--gcw-font-size-sm)}.gcw-md-paragraph{margin-bottom:var(--gcw-spacing-2)}.gcw-md-paragraph:last-child{margin-bottom:0}.gcw-md-list{margin:var(--gcw-spacing-2) 0;padding-left:var(--gcw-spacing-4)}.gcw-md-list--ul{list-style-type:disc}.gcw-md-list--ol{list-style-type:decimal}.gcw-md-list__item{font-size:var(--gcw-font-size-base);margin-bottom:var(--gcw-spacing-1)}.gcw-md-bold{font-weight:600}.gcw-md-italic{font-style:italic}.gcw-md-code{background-color:var(--gcw-color-gray-200);padding:.125rem var(--gcw-spacing-2);border-radius:var(--gcw-radius-sm);font-size:var(--gcw-font-size-sm);font-family:SF Mono,Monaco,Consolas,monospace}.gcw-bubble--user .gcw-md-code{background-color:#fff3}.gcw-md-code-block{background-color:var(--gcw-color-gray-800);color:var(--gcw-color-gray-100);padding:var(--gcw-spacing-3);border-radius:var(--gcw-radius-lg);font-size:var(--gcw-font-size-sm);overflow-x:auto;margin:var(--gcw-spacing-2) 0}.gcw-md-code-block code{font-family:SF Mono,Monaco,Consolas,monospace}.gcw-md-link{color:var(--gcw-color-primary);text-decoration:underline}.gcw-md-link:hover{color:var(--gcw-color-primary-hover)}.gcw-bubble--user .gcw-md-link{color:#ffffffe6}.gcw-sources{display:flex;flex-wrap:wrap;gap:var(--gcw-spacing-2);margin-top:var(--gcw-spacing-2)}.gcw-source{display:inline-flex;align-items:center;gap:var(--gcw-spacing-1);padding:var(--gcw-spacing-1) var(--gcw-spacing-2);border-radius:var(--gcw-radius-full);background-color:var(--gcw-color-primary-light);color:var(--gcw-color-primary);font-size:var(--gcw-font-size-sm);text-decoration:none;transition:background-color var(--gcw-transition-fast)}.gcw-source:hover{background-color:#dbeafe}.gcw-source__icon{width:.75rem;height:.75rem}.gcw-typing{display:flex;justify-content:flex-start}.gcw-typing__bubble{background-color:var(--gcw-color-gray-100);padding:var(--gcw-spacing-3) var(--gcw-spacing-4);border-radius:var(--gcw-radius-2xl);border-bottom-left-radius:var(--gcw-radius-sm)}.gcw-typing__dots{display:flex;gap:var(--gcw-spacing-1)}.gcw-typing__dot{width:.5rem;height:.5rem;background-color:var(--gcw-color-gray-400);border-radius:var(--gcw-radius-full);animation:gcw-typing-bounce 1.4s infinite ease-in-out both}.gcw-typing__dot:nth-child(1){animation-delay:-.32s}.gcw-typing__dot:nth-child(2){animation-delay:-.16s}.gcw-input-area{padding:var(--gcw-spacing-3);border-top:1px solid var(--gcw-color-gray-200);background-color:var(--gcw-color-white);flex-shrink:0}.gcw-input-row{display:flex;align-items:flex-end;gap:var(--gcw-spacing-2)}.gcw-input{flex:1;min-height:44px;max-height:120px;padding:var(--gcw-spacing-2) var(--gcw-spacing-4);border:1px solid var(--gcw-color-gray-200);border-radius:var(--gcw-radius-xl);background-color:var(--gcw-color-white);color:var(--gcw-color-gray-800);font-family:var(--gcw-font-family);font-size:var(--gcw-font-size-base);font-weight:400;line-height:1.5;letter-spacing:normal;resize:none;outline:none;transition:border-color var(--gcw-transition-fast),box-shadow var(--gcw-transition-fast)}.gcw-input:focus{border-color:var(--gcw-color-primary);box-shadow:0 0 0 3px #3b82f61a}.gcw-input:disabled{background-color:var(--gcw-color-gray-50);cursor:not-allowed}.gcw-input::placeholder{color:var(--gcw-color-gray-400)}.gcw-send-btn{width:2.5rem;height:2.5rem;flex-shrink:0;border:none;border-radius:var(--gcw-radius-lg);color:var(--gcw-color-white);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:opacity var(--gcw-transition-fast),transform var(--gcw-transition-fast)}.gcw-send-btn:hover:not(:disabled){opacity:.9}.gcw-send-btn:active:not(:disabled){transform:scale(.95)}.gcw-send-btn:disabled{opacity:.5;cursor:not-allowed}.gcw-send-btn__icon{width:1.25rem;height:1.25rem}.gcw-input-hint{font-size:var(--gcw-font-size-xs);color:var(--gcw-color-gray-400);text-align:center;margin-top:var(--gcw-spacing-2)}@keyframes gcw-slide-up{0%{opacity:0;transform:translateY(1rem)}to{opacity:1;transform:translateY(0)}}@keyframes gcw-pulse{0%,to{opacity:1}50%{opacity:.5}}@keyframes gcw-typing-bounce{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}@keyframes gcw-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.gcw-spin{animation:gcw-spin 1s linear infinite}.gcw-history{display:flex;flex-direction:column;flex:1;overflow:hidden;animation:gcw-slide-in-left var(--gcw-transition-base) ease-out}.gcw-history__header{display:flex;align-items:center;gap:var(--gcw-spacing-3);padding:var(--gcw-spacing-2) var(--gcw-spacing-3);color:var(--gcw-color-white);flex-shrink:0}.gcw-history__title{flex:1;font-size:var(--gcw-font-size-base);font-weight:600;margin:0}.gcw-history__list{flex:1;overflow-y:auto;padding:var(--gcw-spacing-2) 0}.gcw-history__list::-webkit-scrollbar{width:6px}.gcw-history__list::-webkit-scrollbar-track{background:transparent}.gcw-history__list::-webkit-scrollbar-thumb{background-color:var(--gcw-color-gray-300);border-radius:3px}.gcw-history__loading{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--gcw-spacing-3);padding:var(--gcw-spacing-8);color:var(--gcw-color-gray-400);font-size:var(--gcw-font-size-sm)}.gcw-history__empty{display:flex;align-items:center;justify-content:center;padding:var(--gcw-spacing-8);color:var(--gcw-color-gray-400);font-size:var(--gcw-font-size-sm)}.gcw-history__item{display:flex;align-items:center;justify-content:space-between;gap:var(--gcw-spacing-2);width:100%;padding:var(--gcw-spacing-3) var(--gcw-spacing-4);border:none;border-left:3px solid transparent;background:none;cursor:pointer;text-align:left;transition:background-color var(--gcw-transition-fast);font-family:var(--gcw-font-family)}.gcw-history__item:hover{background-color:var(--gcw-color-gray-50)}.gcw-history__item--active{background-color:var(--gcw-color-primary-light)}.gcw-history__item-content{display:flex;flex-direction:column;gap:.125rem;min-width:0;flex:1}.gcw-history__item-title{font-size:var(--gcw-font-size-sm);font-weight:500;color:var(--gcw-color-gray-800);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gcw-history__item-meta{font-size:var(--gcw-font-size-xs);color:var(--gcw-color-gray-400)}.gcw-history__item-delete{flex-shrink:0;width:1.75rem;height:1.75rem;border:none;border-radius:var(--gcw-radius-md);background:transparent;color:var(--gcw-color-gray-300);cursor:pointer;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity var(--gcw-transition-fast),color var(--gcw-transition-fast),background-color var(--gcw-transition-fast)}.gcw-history__item:hover .gcw-history__item-delete{opacity:1}.gcw-history__item-delete:hover{color:var(--gcw-color-error);background-color:#ef44441a}.gcw-history__item-delete-icon{width:.875rem;height:.875rem}@keyframes gcw-slide-in-left{0%{opacity:0;transform:translate(-1rem)}to{opacity:1;transform:translate(0)}}.gcw-modal-overlay{position:absolute;top:0;right:0;bottom:0;left:0;background:#0006;display:flex;align-items:center;justify-content:center;z-index:100;animation:gcw-fade-in .15s ease-out;border-radius:var(--gcw-radius-2xl)}.gcw-modal{background:#fff;border-radius:.75rem;padding:1.25rem;margin:1rem;max-width:20rem;width:100%;box-shadow:0 8px 24px #00000026;animation:gcw-scale-in .15s ease-out}.gcw-modal__title{font-size:.9375rem;font-weight:600;color:#1f2937;margin:0 0 .5rem}.gcw-modal__message{font-size:.8125rem;color:#6b7280;line-height:1.5;margin:0 0 1.25rem}.gcw-modal__actions{display:flex;gap:.5rem;justify-content:flex-end}.gcw-modal__btn{padding:.4375rem .875rem;border-radius:.375rem;font-size:.8125rem;font-weight:500;cursor:pointer;border:1px solid #e5e7eb;transition:background-color .15s,border-color .15s}.gcw-modal__btn--cancel{background:#fff;color:#374151}.gcw-modal__btn--cancel:hover{background:#f9fafb;border-color:#d1d5db}.gcw-modal__btn--confirm{background:#3b82f6;color:#fff;border-color:#3b82f6}.gcw-modal__btn--confirm:hover{background:#2563eb;border-color:#2563eb}.gcw-modal__btn--danger{background:#ef4444;border-color:#ef4444}.gcw-modal__btn--danger:hover{background:#dc2626;border-color:#dc2626}@keyframes gcw-fade-in{0%{opacity:0}to{opacity:1}}@keyframes gcw-scale-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}')),document.head.appendChild(r)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
2
+ import { jsxs as u, jsx as n, Fragment as ke } from "react/jsx-runtime";
3
+ import _e, { useState as v, useCallback as L, useEffect as M, useRef as O } from "react";
4
+ const xe = "gcw_session_", Ne = "gcw_popout_", Se = "gcw_read_";
5
+ function ee(e) {
6
+ return `${xe}${e || "default"}`;
7
7
  }
8
- function ve(e, s) {
8
+ function Me(e, s) {
9
9
  try {
10
- const n = q(s);
11
- e ? localStorage.setItem(n, e) : localStorage.removeItem(n);
12
- } catch (n) {
13
- console.warn("Failed to save session ID:", n);
10
+ const t = ee(s);
11
+ e ? localStorage.setItem(t, e) : localStorage.removeItem(t);
12
+ } catch (t) {
13
+ console.warn("Failed to save session ID:", t);
14
14
  }
15
15
  }
16
- function ye(e) {
16
+ function Ie(e) {
17
17
  try {
18
- return localStorage.getItem(q(e));
18
+ return localStorage.getItem(ee(e));
19
19
  } catch {
20
20
  return null;
21
21
  }
22
22
  }
23
- function W(e) {
23
+ function P(e) {
24
24
  try {
25
- localStorage.removeItem(q(e)), localStorage.removeItem(Y(e));
25
+ localStorage.removeItem(ee(e)), localStorage.removeItem(Q(e));
26
26
  } catch (s) {
27
27
  console.warn("Failed to clear session:", s);
28
28
  }
29
29
  }
30
- function ke(e, s) {
31
- const n = q(e), a = (i) => {
32
- i.key === n && s(i.newValue);
30
+ function Ce(e, s) {
31
+ const t = ee(e), a = (i) => {
32
+ i.key === t && s(i.newValue);
33
33
  };
34
34
  return window.addEventListener("storage", a), () => window.removeEventListener("storage", a);
35
35
  }
36
- function ee(e) {
37
- return `${we}${e || "default"}`;
36
+ function oe(e) {
37
+ return `${Ne}${e || "default"}`;
38
38
  }
39
- function G(e, s) {
39
+ function Y(e, s) {
40
40
  try {
41
- e ? localStorage.setItem(ee(s), "true") : localStorage.removeItem(ee(s));
42
- } catch (n) {
43
- console.warn("Failed to save popout state:", n);
41
+ e ? localStorage.setItem(oe(s), "true") : localStorage.removeItem(oe(s));
42
+ } catch (t) {
43
+ console.warn("Failed to save popout state:", t);
44
44
  }
45
45
  }
46
- function _e(e) {
46
+ function Le(e) {
47
47
  try {
48
- return localStorage.getItem(ee(e)) === "true";
48
+ return localStorage.getItem(oe(e)) === "true";
49
49
  } catch {
50
50
  return !1;
51
51
  }
52
52
  }
53
- function Y(e) {
54
- return `${be}${e || "default"}`;
53
+ function Q(e) {
54
+ return `${Se}${e || "default"}`;
55
55
  }
56
- function X(e, s) {
56
+ function q(e, s) {
57
57
  try {
58
- e > 0 ? localStorage.setItem(Y(s), String(e)) : localStorage.removeItem(Y(s));
59
- } catch (n) {
60
- console.warn("Failed to save read state:", n);
58
+ e > 0 ? localStorage.setItem(Q(s), String(e)) : localStorage.removeItem(Q(s));
59
+ } catch (t) {
60
+ console.warn("Failed to save read state:", t);
61
61
  }
62
62
  }
63
- function Me(e) {
63
+ function Ee(e) {
64
64
  try {
65
- const s = localStorage.getItem(Y(e));
65
+ const s = localStorage.getItem(Q(e));
66
66
  return s && parseInt(s, 10) || 0;
67
67
  } catch {
68
68
  return 0;
69
69
  }
70
70
  }
71
- function xe(e) {
72
- const { apiUrl: s, tenantId: n, sessionId: a, headers: i = {}, onError: o, persist: r = !0 } = e, [h, c] = x([]), [l, m] = x(!1), [f, N] = x(!1), [j, w] = x(null), [g, v] = x(() => a || (r ? ye(n) : null)), u = H(null), y = H(!1), S = $(() => s.replace(/\/chat\/?$/, ""), [s]), L = $(async (p) => {
73
- N(!0);
71
+ function U(e) {
72
+ if (!e)
73
+ return console.log("test"), {};
74
+ try {
75
+ const s = sessionStorage.getItem(e);
76
+ if (console.log("raw", s), !s) return {};
77
+ const t = JSON.parse(s);
78
+ if (console.log("token", t), t != null && t.access_token)
79
+ return { Authorization: `Bearer ${t.access_token}` };
80
+ console.log("No access_token found in token object");
81
+ } catch {
82
+ }
83
+ return {};
84
+ }
85
+ const se = /* @__PURE__ */ new Map();
86
+ function Te(e) {
87
+ return {
88
+ id: e.Id ?? e.id ?? "",
89
+ email: e.Email ?? e.email ?? "",
90
+ fullName: e.FullName ?? e.fullName ?? "",
91
+ roles: Array.isArray(e.Roles ?? e.roles) ? (e.Roles ?? e.roles).map(
92
+ (s) => typeof s == "string" ? s : s.name ?? ""
93
+ ) : []
94
+ };
95
+ }
96
+ function $e(e, s) {
97
+ const t = se.get(e);
98
+ if (t) return t;
99
+ const a = (async () => {
74
100
  try {
75
- const k = S(), E = await fetch(`${k}/sessions/${p}`, {
101
+ const i = await fetch(e, {
102
+ method: "GET",
103
+ headers: {
104
+ Accept: "application/json",
105
+ ...U(s)
106
+ }
107
+ });
108
+ if (i.ok) {
109
+ const r = await i.json();
110
+ return { ok: !0, user: Te(r), error: null };
111
+ }
112
+ return {
113
+ ok: !1,
114
+ user: null,
115
+ error: i.status === 401 ? "Niet ingelogd" : "Geen toegang"
116
+ };
117
+ } catch {
118
+ return { ok: !1, user: null, error: "Authenticatie verificatie mislukt" };
119
+ }
120
+ })();
121
+ return se.set(e, a), a.finally(() => se.delete(e)), a;
122
+ }
123
+ function je({ authUrl: e, tokenStorageKey: s }) {
124
+ const [t, a] = v(!e), [i, r] = v(!!e), [o, m] = v(null), [c, l] = v(null), d = L((f) => {
125
+ m(f.user), a(f.ok), l(f.error);
126
+ }, []), g = L(async () => {
127
+ if (!e) return !0;
128
+ const f = await $e(e, s);
129
+ return d(f), f.ok;
130
+ }, [e, s, d]);
131
+ M(() => {
132
+ if (!e) return;
133
+ let f = !1;
134
+ return (async () => {
135
+ r(!0), await g(), f || r(!1);
136
+ })(), () => {
137
+ f = !0;
138
+ };
139
+ }, [e, g]);
140
+ const S = L(async () => g(), [g]);
141
+ return { isAuthenticated: t, isLoading: i, user: o, error: c, recheckAuth: S };
142
+ }
143
+ function De(e) {
144
+ const { apiUrl: s, tenantId: t, sessionId: a, tokenStorageKey: i, onError: r, persist: o = !0 } = e, [m, c] = v([]), [l, d] = v(!1), [g, S] = v(!1), [f, w] = v(null), [b, x] = v(() => a || (o ? Ie(t) : null)), h = O(null), k = O(!1), p = L(() => s.replace(/\/chat\/?$/, ""), [s]), z = L(async (y) => {
145
+ S(!0);
146
+ try {
147
+ const _ = p(), T = await fetch(`${_}/sessions/${y}`, {
76
148
  method: "GET",
77
149
  headers: {
78
150
  "Content-Type": "application/json",
79
- ...n && { "X-Tenant-ID": n },
80
- ...i
151
+ ...t && { "X-Tenant-ID": t },
152
+ ...U(i)
81
153
  }
82
154
  });
83
- if (E.status === 500)
155
+ if (T.status === 500)
84
156
  return console.error("Server error while loading session, will retry later"), !1;
85
- if (E.status === 401)
86
- return console.info("Unauthorized while loading session, clearing session"), r && W(n), v(null), !1;
87
- if (E.status === 404)
88
- return console.info("Session not found, starting fresh"), r && W(n), v(null), !1;
89
- if (E.status === 429)
157
+ if (T.status === 401)
158
+ return console.info("Unauthorized while loading session, clearing session"), o && P(t), x(null), !1;
159
+ if (T.status === 404)
160
+ return console.info("Session not found, starting fresh"), o && P(t), x(null), !1;
161
+ if (T.status === 429)
90
162
  return console.info("Rate limited while loading session, will retry later"), !1;
91
- if (!E.ok)
92
- throw new Error(`Failed to load session: ${E.status}`);
93
- const I = (await E.json()).messages.map((B) => {
94
- var z;
163
+ if (!T.ok)
164
+ throw new Error(`Failed to load session: ${T.status}`);
165
+ const $ = (await T.json()).messages.map((B) => {
166
+ var R;
95
167
  return {
96
168
  id: B.id,
97
169
  role: B.role,
98
170
  content: B.content,
99
171
  timestamp: new Date(B.timestamp),
100
- sources: (z = B.citations) == null ? void 0 : z.map((M) => ({
101
- title: M.title,
102
- url: M.url,
103
- relevance: M.relevance_score
172
+ sources: (R = B.citations) == null ? void 0 : R.map((C) => ({
173
+ title: C.title,
174
+ url: C.url,
175
+ relevance: C.relevance_score
104
176
  }))
105
177
  };
106
178
  });
107
- return c(I), v(p), !0;
108
- } catch (k) {
109
- return console.error("Failed to load session:", k), r && W(n), v(null), !1;
179
+ return c($), x(y), !0;
180
+ } catch (_) {
181
+ return console.error("Failed to load session:", _), o && P(t), x(null), !1;
110
182
  } finally {
111
- N(!1);
112
- }
113
- }, [S, n, i, r]);
114
- C(() => {
115
- y.current || (y.current = !0, g && L(g));
116
- }, []), C(() => {
117
- r && ve(g, n);
118
- }, [g, n, r]), C(() => r ? ke(n, (k) => {
119
- k && k !== g ? L(k) : k || (c([]), v(null));
120
- }) : void 0, [n, r, g, L]);
121
- const b = $(async (p) => {
122
- var E;
123
- if (!p.trim() || l) return;
124
- u.current && u.current.abort(), u.current = new AbortController();
125
- const k = {
183
+ S(!1);
184
+ }
185
+ }, [p, t, o]);
186
+ M(() => {
187
+ k.current || (k.current = !0, b && z(b));
188
+ }, []), M(() => {
189
+ o && Me(b, t);
190
+ }, [b, t, o]), M(() => o ? Ce(t, (_) => {
191
+ _ && _ !== b ? z(_) : _ || (c([]), x(null));
192
+ }) : void 0, [t, o, b, z]);
193
+ const H = L(async (y) => {
194
+ var T;
195
+ if (!y.trim() || l) return;
196
+ h.current && h.current.abort(), h.current = new AbortController();
197
+ const _ = {
126
198
  id: `temp_${Date.now()}`,
127
199
  role: "user",
128
- content: p.trim(),
200
+ content: y.trim(),
129
201
  timestamp: /* @__PURE__ */ new Date()
130
202
  };
131
- c((_) => [..._, k]), m(!0), w(null);
203
+ c((I) => [...I, _]), d(!0), w(null);
132
204
  try {
133
- const _ = await fetch(s, {
205
+ const I = await fetch(s, {
134
206
  method: "POST",
135
207
  headers: {
136
208
  "Content-Type": "application/json",
137
- ...n && { "X-Tenant-ID": n },
138
- ...i
209
+ ...t && { "X-Tenant-ID": t },
210
+ ...U(i)
139
211
  },
140
212
  body: JSON.stringify({
141
- message: p.trim(),
142
- session_id: g
213
+ message: y.trim(),
214
+ session_id: b
143
215
  }),
144
- signal: u.current.signal
216
+ signal: h.current.signal
145
217
  });
146
- if (!_.ok) {
147
- if (_.status === 500) {
148
- console.error("Server error while sending message");
149
- const O = {
218
+ if (!I.ok) {
219
+ if (I.status === 500) {
220
+ const j = {
150
221
  id: `temp_${Date.now()}_servererror`,
151
222
  role: "assistant",
152
223
  content: "Er is een fout opgetreden bij het verwerken van je bericht. Probeer het later opnieuw.",
153
224
  timestamp: /* @__PURE__ */ new Date()
154
225
  };
155
- c((V) => [...V, O]);
226
+ c((W) => [...W, j]);
156
227
  return;
157
228
  }
158
- if (_.status === 401) {
159
- const O = {
229
+ if (I.status === 401) {
230
+ const j = {
160
231
  id: `temp_${Date.now()}_unauthorized`,
161
232
  role: "assistant",
162
233
  content: "Je sessie is verlopen of je hebt geen toegang. Vernieuw de pagina om opnieuw te verbinden.",
163
234
  timestamp: /* @__PURE__ */ new Date()
164
235
  };
165
- c((V) => [...V, O]), r && W(n), v(null);
236
+ c((W) => [...W, j]), o && P(t), x(null);
166
237
  return;
167
238
  }
168
- if (_.status === 429) {
169
- const O = {
239
+ if (I.status === 429) {
240
+ const j = {
170
241
  id: `temp_${Date.now()}_ratelimit`,
171
242
  role: "assistant",
172
243
  content: "Je stuurt te veel berichten achter elkaar. Wacht even en probeer het dan opnieuw.",
173
244
  timestamp: /* @__PURE__ */ new Date()
174
245
  };
175
- c((V) => [...V, O]);
246
+ c((W) => [...W, j]);
176
247
  return;
177
248
  }
178
- const M = await _.json().catch(() => ({}));
179
- throw new Error(M.detail || `Request failed with status ${_.status}`);
249
+ const C = await I.json().catch(() => ({}));
250
+ throw new Error(C.detail || `Request failed with status ${I.status}`);
180
251
  }
181
- const I = await _.json(), B = (E = I.message.citations) == null ? void 0 : E.map((M) => ({
182
- title: M.title,
183
- url: M.url,
184
- relevance: M.relevance_score
185
- })), z = {
252
+ const $ = await I.json(), B = (T = $.message.citations) == null ? void 0 : T.map((C) => ({
253
+ title: C.title,
254
+ url: C.url,
255
+ relevance: C.relevance_score
256
+ })), R = {
186
257
  id: `temp_${Date.now()}_assistant`,
187
258
  role: "assistant",
188
- content: I.message.content,
259
+ content: $.message.content,
189
260
  timestamp: /* @__PURE__ */ new Date(),
190
261
  sources: B
191
262
  };
192
- c((M) => [...M, z]), I.session_id && v(I.session_id);
193
- } catch (_) {
194
- if (_.name === "AbortError")
263
+ c((C) => [...C, R]), $.session_id && x($.session_id);
264
+ } catch (I) {
265
+ if (I.name === "AbortError")
195
266
  return;
196
- const I = _ instanceof Error ? _ : new Error("An error occurred");
197
- w(I), o == null || o(I);
267
+ const $ = I instanceof Error ? I : new Error("An error occurred");
268
+ w($), r == null || r($);
198
269
  } finally {
199
- m(!1), u.current = null;
270
+ d(!1), h.current = null;
200
271
  }
201
- }, [s, n, g, i, l, o]), F = $(() => {
202
- c([]), v(null), w(null), y.current = !1, r && W(n);
203
- }, [r, n]), P = $(async () => {
204
- if (g)
272
+ }, [s, t, b, l, r]), J = L(() => {
273
+ c([]), x(null), w(null), k.current = !1, o && P(t);
274
+ }, [o, t]), F = L(async () => {
275
+ if (b)
205
276
  try {
206
- const p = S();
207
- await fetch(`${p}/sessions/${g}`, {
277
+ const y = p();
278
+ await fetch(`${y}/sessions/${b}`, {
208
279
  method: "DELETE",
209
280
  headers: {
210
281
  "Content-Type": "application/json",
211
- ...n && { "X-Tenant-ID": n },
212
- ...i
282
+ ...t && { "X-Tenant-ID": t },
283
+ ...U(i)
213
284
  }
214
285
  });
215
- } catch (p) {
216
- console.error("Failed to delete session:", p);
286
+ } catch (y) {
287
+ console.error("Failed to delete session:", y);
217
288
  }
218
- c([]), v(null), w(null), y.current = !1, r && W(n);
219
- }, [g, S, n, i, r]), R = $(async (p) => {
289
+ c([]), x(null), w(null), k.current = !1, o && P(t);
290
+ }, [b, p, t, o]), A = L(async (y) => {
220
291
  try {
221
- const k = S();
222
- await fetch(`${k}/sessions/${p}`, {
292
+ const _ = p();
293
+ await fetch(`${_}/sessions/${y}`, {
223
294
  method: "DELETE",
224
295
  headers: {
225
296
  "Content-Type": "application/json",
226
- ...n && { "X-Tenant-ID": n },
227
- ...i
297
+ ...t && { "X-Tenant-ID": t },
298
+ ...U(i)
228
299
  }
229
300
  });
230
- } catch (k) {
231
- console.error("Failed to delete session:", k);
232
- }
233
- p === g && (c([]), v(null), w(null), y.current = !1, r && W(n));
234
- }, [S, n, i, g, r]), U = $(() => {
235
- c([]), v(null), w(null), y.current = !1, r && W(n);
236
- }, [r, n]), Z = $(async (p) => {
237
- await L(p);
238
- }, [L]), Q = $(async () => {
301
+ } catch (_) {
302
+ console.error("Failed to delete session:", _);
303
+ }
304
+ y === b && (c([]), x(null), w(null), k.current = !1, o && P(t));
305
+ }, [p, t, b, o]), N = L(() => {
306
+ c([]), x(null), w(null), k.current = !1, o && P(t);
307
+ }, [o, t]), te = L(async (y) => {
308
+ await z(y);
309
+ }, [z]), ne = L(async () => {
239
310
  try {
240
- const p = S(), k = await fetch(`${p}/sessions`, {
311
+ const y = p(), _ = await fetch(`${y}/sessions`, {
241
312
  method: "GET",
242
313
  headers: {
243
314
  "Content-Type": "application/json",
244
- ...n && { "X-Tenant-ID": n },
245
- ...i
315
+ ...t && { "X-Tenant-ID": t },
316
+ ...U(i)
246
317
  }
247
318
  });
248
- return k.ok ? await k.json() : (console.error("Failed to list sessions:", k.status), []);
249
- } catch (p) {
250
- return console.error("Failed to list sessions:", p), [];
319
+ return _.ok ? await _.json() : (console.error("Failed to list sessions:", _.status), []);
320
+ } catch (y) {
321
+ return console.error("Failed to list sessions:", y), [];
251
322
  }
252
- }, [S, n, i]);
323
+ }, [p, t]);
253
324
  return {
254
- messages: h,
325
+ messages: m,
255
326
  isLoading: l,
256
- isLoadingSession: f,
257
- error: j,
258
- sendMessage: b,
259
- clearMessages: F,
260
- deleteSession: P,
261
- deleteSessionById: R,
262
- startNewSession: U,
263
- switchSession: Z,
264
- listSessions: Q,
265
- sessionId: g
327
+ isLoadingSession: g,
328
+ error: f,
329
+ sendMessage: H,
330
+ clearMessages: J,
331
+ deleteSession: F,
332
+ deleteSessionById: A,
333
+ startNewSession: N,
334
+ switchSession: te,
335
+ listSessions: ne,
336
+ sessionId: b
266
337
  };
267
338
  }
268
- let K = null;
269
- function Ne(e, s, n) {
270
- const [a, i] = x(() => _e(e.tenantId)), o = H(K);
271
- C(() => {
272
- if (a && !o.current) {
339
+ let X = null;
340
+ function ze(e, s, t) {
341
+ const [a, i] = v(() => Le(e.tenantId)), r = O(X);
342
+ M(() => {
343
+ if (a && !r.current) {
273
344
  const l = window.open("", "GeoAppsChatPopout");
274
- l && l.location.href !== "about:blank" && !l.closed ? (o.current = l, K = l) : (i(!1), G(!1, e.tenantId));
345
+ l && l.location.href !== "about:blank" && !l.closed ? (r.current = l, X = l) : (i(!1), Y(!1, e.tenantId));
275
346
  }
276
- }, [a, e.tenantId]), C(() => {
277
- if (!o.current) return;
347
+ }, [a, e.tenantId]), M(() => {
348
+ if (!r.current) return;
278
349
  const l = setInterval(() => {
279
- var m;
280
- (m = o.current) != null && m.closed && (i(!1), o.current = null, K = null, G(!1, e.tenantId), n == null || n());
350
+ var d;
351
+ (d = r.current) != null && d.closed && (i(!1), r.current = null, X = null, Y(!1, e.tenantId), t == null || t());
281
352
  }, 500);
282
353
  return () => clearInterval(l);
283
- }, [e.tenantId, n]);
284
- const r = $(() => {
285
- if (o.current && !o.current.closed) {
286
- o.current.focus();
354
+ }, [e.tenantId, t]);
355
+ const o = L(() => {
356
+ if (r.current && !r.current.closed) {
357
+ r.current.focus();
287
358
  return;
288
359
  }
289
360
  const l = {
@@ -291,240 +362,253 @@ function Ne(e, s, n) {
291
362
  medium: { width: 440, height: 660 },
292
363
  large: { width: 560, height: 780 },
293
364
  fullscreen: { width: 700, height: 800 }
294
- }, { width: m, height: f } = l[s], N = (window.screen.width - m) / 2, j = (window.screen.height - f) / 2, w = window.open(
365
+ }, { width: d, height: g } = l[s], S = (window.screen.width - d) / 2, f = (window.screen.height - g) / 2, w = window.open(
295
366
  "",
296
367
  "GeoAppsChatPopout",
297
- `width=${m},height=${f},left=${N},top=${j},resizable=yes,scrollbars=no`
368
+ `width=${d},height=${g},left=${S},top=${f},resizable=yes,scrollbars=no`
298
369
  );
299
370
  if (!w) {
300
371
  console.error("Failed to open popup window. Check if popups are blocked.");
301
372
  return;
302
373
  }
303
- w.__CHAT_CONFIG__ = e, w.document.write(Ae(e)), w.document.close(), o.current = w, K = w, i(!0), G(!0, e.tenantId);
304
- }, [e, s]), h = $(() => {
305
- o.current && !o.current.closed && o.current.close(), o.current = null, K = null, i(!1), G(!1, e.tenantId);
306
- }, [e.tenantId]), c = $(() => {
307
- o.current && !o.current.closed && o.current.focus();
374
+ w.__CHAT_CONFIG__ = e, w.document.write(Ze(e)), w.document.close(), r.current = w, X = w, i(!0), Y(!0, e.tenantId);
375
+ }, [e, s]), m = L(() => {
376
+ r.current && !r.current.closed && r.current.close(), r.current = null, X = null, i(!1), Y(!1, e.tenantId);
377
+ }, [e.tenantId]), c = L(() => {
378
+ r.current && !r.current.closed && r.current.focus();
308
379
  }, []);
309
380
  return {
310
381
  isPoppedOut: a,
311
- openPopout: r,
312
- closePopout: h,
382
+ openPopout: o,
383
+ closePopout: m,
313
384
  focusPopout: c
314
385
  };
315
386
  }
316
- const Se = ["bottom-right", "bottom-left", "top-right", "top-left"];
317
- function Ce(e) {
318
- return typeof e == "string" && Se.includes(e);
387
+ const Ae = ["bottom-right", "bottom-left", "top-right", "top-left"];
388
+ function Be(e) {
389
+ return typeof e == "string" && Ae.includes(e);
319
390
  }
320
- function Ie(e) {
321
- if (Ce(e))
391
+ function He(e) {
392
+ if (Be(e))
322
393
  return { className: `gcw-container--${e}`, style: {} };
323
- const s = e, n = {}, a = ["gcw-container--custom"];
324
- return s.top != null && (n.top = s.top), s.bottom != null && (n.bottom = s.bottom), s.left != null && (n.left = s.left), s.right != null && (n.right = s.right), s.top != null && s.bottom == null && a.push("gcw-container--flow-down"), s.left != null && s.right == null && a.push("gcw-container--align-left"), { className: a.join(" "), style: n };
394
+ const s = e, t = {}, a = ["gcw-container--custom"];
395
+ return s.top != null && (t.top = s.top), s.bottom != null && (t.bottom = s.bottom), s.left != null && (t.left = s.left), s.right != null && (t.right = s.right), s.top != null && s.bottom == null && a.push("gcw-container--flow-down"), s.left != null && s.right == null && a.push("gcw-container--align-left"), { className: a.join(" "), style: t };
325
396
  }
326
- function et({
397
+ function dt({
327
398
  apiUrl: e,
328
- tenantId: s,
329
- title: n = "Chat Assistent",
330
- subtitle: a = "Hoe kan ik je helpen?",
331
- placeholder: i = "Typ een bericht...",
399
+ authUrl: s,
400
+ tenantId: t,
401
+ title: a = "Chat Assistent",
402
+ subtitle: i = "Hoe kan ik je helpen?",
403
+ placeholder: r = "Typ een bericht...",
332
404
  greeting: o,
333
- primaryColor: r = "#3b82f6",
334
- position: h = "bottom-right",
335
- defaultOpen: c = !1,
336
- defaultSize: l = "medium",
337
- headers: m,
338
- onOpen: f,
339
- onClose: N,
340
- onMessageSent: j,
341
- onResponseReceived: w
405
+ primaryColor: m = "#3b82f6",
406
+ position: c = "bottom-right",
407
+ defaultOpen: l = !1,
408
+ defaultSize: d = "medium",
409
+ tokenStorageKey: g = "geoapps-token",
410
+ onOpen: S,
411
+ onClose: f,
412
+ onMessageSent: w,
413
+ onResponseReceived: b
342
414
  }) {
343
- const [g, v] = x(c), [u, y] = x(l), [S, L] = x(!1), { messages: b, isLoading: F, isLoadingSession: P, sendMessage: R, deleteSession: U, deleteSessionById: Z, startNewSession: Q, switchSession: p, listSessions: k, sessionId: E } = xe({
415
+ const { isAuthenticated: x, isLoading: h, recheckAuth: k } = je({ authUrl: s, tokenStorageKey: g }), [p, z] = v(l), [H, J] = v(d), [F, A] = v(!1), { messages: N, isLoading: te, isLoadingSession: ne, sendMessage: y, deleteSession: _, deleteSessionById: T, startNewSession: I, switchSession: $, listSessions: B, sessionId: R } = De({
344
416
  apiUrl: e,
345
- tenantId: s,
346
- headers: m
347
- }), [_, I] = x(() => b.length > 0), [B, z] = x([]);
348
- C(() => {
349
- g && o && !_ && b.length === 0 && I(!0);
350
- }, [g, o, _, b.length]), C(() => {
351
- b.length > 0 && I(!0);
352
- }, [b.length]), C(() => {
353
- _ && o && b.length === 0 ? z([
417
+ tenantId: t,
418
+ tokenStorageKey: g
419
+ }), [C, j] = v(() => N.length > 0), [W, K] = v([]);
420
+ M(() => {
421
+ p && o && !C && N.length === 0 && j(!0);
422
+ }, [p, o, C, N.length]), M(() => {
423
+ N.length > 0 && j(!0);
424
+ }, [N.length]), M(() => {
425
+ C && o && N.length === 0 ? K([
354
426
  {
355
427
  id: "greeting",
356
428
  role: "assistant",
357
429
  content: o,
358
430
  timestamp: /* @__PURE__ */ new Date()
359
431
  }
360
- ]) : o && b.length > 0 ? z([
432
+ ]) : o && N.length > 0 ? K([
361
433
  {
362
434
  id: "greeting",
363
435
  role: "assistant",
364
436
  content: o,
365
437
  timestamp: /* @__PURE__ */ new Date()
366
438
  },
367
- ...b
368
- ]) : z(b);
369
- }, [b, _, o]);
370
- const { isPoppedOut: M, openPopout: O, focusPopout: V } = Ne(
439
+ ...N
440
+ ]) : K(N);
441
+ }, [N, C, o]);
442
+ const { isPoppedOut: V, openPopout: de, focusPopout: ue } = ze(
371
443
  {
372
444
  apiUrl: e,
373
- tenantId: s,
374
- title: n,
375
- subtitle: a,
376
- placeholder: i,
377
- primaryColor: r,
378
- sessionId: E,
379
- messages: B,
380
- headers: m
445
+ tenantId: t,
446
+ title: a,
447
+ subtitle: i,
448
+ placeholder: r,
449
+ primaryColor: m,
450
+ sessionId: R,
451
+ messages: W,
452
+ tokenStorageKey: g
381
453
  },
382
- u,
454
+ H,
383
455
  () => {
384
456
  }
385
457
  );
386
- C(() => {
387
- const T = b.filter((D) => D.role === "assistant").length;
388
- if (T === 0) {
389
- L(!1);
458
+ M(() => {
459
+ const E = N.filter((D) => D.role === "assistant").length;
460
+ if (E === 0) {
461
+ A(!1);
390
462
  return;
391
463
  }
392
- if (g || M)
393
- X(T, s), L(!1);
464
+ if (p || V)
465
+ q(E, t), A(!1);
394
466
  else {
395
- const D = Me(s);
396
- L(T > D);
467
+ const D = Ee(t);
468
+ A(E > D);
397
469
  }
398
- }, [g, M, b, s]);
399
- const te = () => {
400
- if (M) {
401
- V();
470
+ }, [p, V, N, t]);
471
+ const re = () => {
472
+ if (V) {
473
+ ue();
402
474
  return;
403
475
  }
404
- const T = !g;
405
- if (v(T), T) {
406
- f == null || f();
407
- const D = b.filter((he) => he.role === "assistant").length;
408
- D > 0 && X(D, s), L(!1);
476
+ const E = !p;
477
+ if (z(E), E) {
478
+ S == null || S();
479
+ const D = N.filter((ie) => ie.role === "assistant").length;
480
+ D > 0 && q(D, t), A(!1);
409
481
  } else
410
- N == null || N();
411
- }, oe = async (T) => {
412
- j == null || j(T), await R(T);
413
- const D = b[b.length - 1];
414
- (D == null ? void 0 : D.role) === "assistant" && (w == null || w(D.content));
415
- }, ie = async () => {
416
- await U(), I(!1), z([]), L(!1), X(0, s);
417
- }, ae = () => {
418
- Q(), I(!1), z([]), L(!1), X(0, s);
419
- }, le = async (T) => {
420
- await p(T), I(!0);
421
- }, ce = (T) => {
422
- y(T);
423
- }, de = () => {
424
- v(!1), O();
425
- }, { className: ue, style: me } = Ie(h);
426
- return /* @__PURE__ */ d("div", { className: `gcw-widget gcw-container ${ue}`, style: me, children: [
427
- /* @__PURE__ */ t(
428
- We,
482
+ f == null || f();
483
+ }, me = async (E) => {
484
+ if (s && !await k()) {
485
+ K((ve) => [
486
+ ...ve,
487
+ {
488
+ id: `auth-error-${Date.now()}`,
489
+ role: "assistant",
490
+ content: "Je sessie is verlopen of je hebt geen toegang. Vernieuw de pagina om opnieuw te verbinden.",
491
+ timestamp: /* @__PURE__ */ new Date()
492
+ }
493
+ ]);
494
+ return;
495
+ }
496
+ w == null || w(E), await y(E);
497
+ const D = N[N.length - 1];
498
+ (D == null ? void 0 : D.role) === "assistant" && (b == null || b(D.content));
499
+ }, he = async () => {
500
+ await _(), j(!1), K([]), A(!1), q(0, t);
501
+ }, ge = () => {
502
+ I(), j(!1), K([]), A(!1), q(0, t);
503
+ }, pe = async (E) => {
504
+ await $(E), j(!0);
505
+ }, fe = (E) => {
506
+ J(E);
507
+ }, we = () => {
508
+ z(!1), de();
509
+ }, { className: be, style: ye } = He(c);
510
+ return h || !x ? null : /* @__PURE__ */ u("div", { className: `gcw-widget gcw-container ${be}`, style: ye, children: [
511
+ /* @__PURE__ */ n(
512
+ Ue,
429
513
  {
430
- isOpen: g,
431
- onClick: te,
432
- primaryColor: r,
433
- hasUnread: S && !g && !M,
434
- isPoppedOut: M
514
+ isOpen: p,
515
+ onClick: re,
516
+ primaryColor: m,
517
+ hasUnread: F && !p && !V,
518
+ isPoppedOut: V
435
519
  }
436
520
  ),
437
- g && !M && /* @__PURE__ */ t(
438
- Ee,
521
+ p && !V && /* @__PURE__ */ n(
522
+ Pe,
439
523
  {
440
- title: n,
441
- subtitle: a,
442
- placeholder: i,
443
- messages: B,
444
- isLoading: F,
445
- isLoadingSession: P,
446
- onSendMessage: oe,
447
- onClose: te,
448
- onClear: ie,
449
- onSizeChange: ce,
450
- onPopout: de,
451
- onNewSession: ae,
452
- onSelectSession: le,
453
- onListSessions: k,
454
- onDeleteSession: Z,
455
- currentSessionId: E,
456
- primaryColor: r,
457
- size: u
524
+ title: a,
525
+ subtitle: i,
526
+ placeholder: r,
527
+ messages: W,
528
+ isLoading: te,
529
+ isLoadingSession: ne,
530
+ onSendMessage: me,
531
+ onClose: re,
532
+ onClear: he,
533
+ onSizeChange: fe,
534
+ onPopout: we,
535
+ onNewSession: ge,
536
+ onSelectSession: pe,
537
+ onListSessions: B,
538
+ onDeleteSession: T,
539
+ currentSessionId: R,
540
+ primaryColor: m,
541
+ size: H
458
542
  }
459
543
  )
460
544
  ] });
461
545
  }
462
- const Le = {
546
+ const We = {
463
547
  small: "gcw-window--small",
464
548
  medium: "gcw-window--medium",
465
549
  large: "gcw-window--large",
466
550
  fullscreen: "gcw-window--fullscreen"
467
551
  };
468
- function Ee({
552
+ function Pe({
469
553
  title: e,
470
554
  subtitle: s,
471
- placeholder: n,
555
+ placeholder: t,
472
556
  messages: a,
473
557
  isLoading: i,
474
- isLoadingSession: o = !1,
475
- onSendMessage: r,
476
- onClose: h,
558
+ isLoadingSession: r = !1,
559
+ onSendMessage: o,
560
+ onClose: m,
477
561
  onClear: c,
478
562
  onSizeChange: l,
479
- onPopout: m,
480
- onNewSession: f,
481
- onSelectSession: N,
482
- onListSessions: j,
563
+ onPopout: d,
564
+ onNewSession: g,
565
+ onSelectSession: S,
566
+ onListSessions: f,
483
567
  onDeleteSession: w,
484
- currentSessionId: g,
485
- primaryColor: v,
486
- size: u
568
+ currentSessionId: b,
569
+ primaryColor: x,
570
+ size: h
487
571
  }) {
488
- const [y, S] = x(!1), [L, b] = x(!1), F = () => {
489
- const P = ["small", "medium", "large", "fullscreen"], U = (P.indexOf(u) + 1) % P.length;
490
- l(P[U]);
572
+ const [k, p] = v(!1), [z, H] = v(!1), J = () => {
573
+ const F = ["small", "medium", "large", "fullscreen"], N = (F.indexOf(h) + 1) % F.length;
574
+ l(F[N]);
491
575
  };
492
- return /* @__PURE__ */ d("div", { className: `gcw-window ${Le[u]}`, children: [
493
- /* @__PURE__ */ d("div", { className: "gcw-header", style: { backgroundColor: v }, children: [
494
- /* @__PURE__ */ d("div", { className: "gcw-header__left", children: [
495
- /* @__PURE__ */ t("div", { className: "gcw-header__avatar", children: /* @__PURE__ */ t(Je, { className: "gcw-header__avatar-icon" }) }),
496
- /* @__PURE__ */ d("div", { className: "gcw-header__info", children: [
497
- /* @__PURE__ */ t("h3", { className: "gcw-header__title", children: e }),
498
- /* @__PURE__ */ t("p", { className: "gcw-header__subtitle", children: s })
576
+ return /* @__PURE__ */ u("div", { className: `gcw-window ${We[h]}`, children: [
577
+ /* @__PURE__ */ u("div", { className: "gcw-header", style: { backgroundColor: x }, children: [
578
+ /* @__PURE__ */ u("div", { className: "gcw-header__left", children: [
579
+ /* @__PURE__ */ n("div", { className: "gcw-header__avatar", children: /* @__PURE__ */ n(rt, { className: "gcw-header__avatar-icon" }) }),
580
+ /* @__PURE__ */ u("div", { className: "gcw-header__info", children: [
581
+ /* @__PURE__ */ n("h3", { className: "gcw-header__title", children: e }),
582
+ /* @__PURE__ */ n("p", { className: "gcw-header__subtitle", children: s })
499
583
  ] })
500
584
  ] }),
501
- /* @__PURE__ */ d("div", { className: "gcw-header__actions", children: [
502
- /* @__PURE__ */ t(
503
- Ke,
585
+ /* @__PURE__ */ u("div", { className: "gcw-header__actions", children: [
586
+ /* @__PURE__ */ n(
587
+ tt,
504
588
  {
505
- size: u,
506
- onCycleSize: F,
507
- onPopout: m,
508
- onClear: () => b(!0),
589
+ size: h,
590
+ onCycleSize: J,
591
+ onPopout: d,
592
+ onClear: () => H(!0),
509
593
  onNewSession: () => {
510
- f(), S(!1);
594
+ g(), p(!1);
511
595
  },
512
- onShowHistory: () => S(!0)
596
+ onShowHistory: () => p(!0)
513
597
  }
514
598
  ),
515
- /* @__PURE__ */ t(
599
+ /* @__PURE__ */ n(
516
600
  "button",
517
601
  {
518
- onClick: h,
602
+ onClick: m,
519
603
  className: "gcw-header__btn",
520
604
  title: "Sluiten",
521
- children: /* @__PURE__ */ t(Xe, { className: "gcw-header__btn-icon" })
605
+ children: /* @__PURE__ */ n(ot, { className: "gcw-header__btn-icon" })
522
606
  }
523
607
  )
524
608
  ] })
525
609
  ] }),
526
- L && /* @__PURE__ */ t(
527
- ne,
610
+ z && /* @__PURE__ */ n(
611
+ ae,
528
612
  {
529
613
  title: "Chat verwijderen",
530
614
  message: "Weet je zeker dat je dit gesprek wilt verwijderen? Dit kan niet ongedaan worden gemaakt.",
@@ -532,65 +616,65 @@ function Ee({
532
616
  cancelLabel: "Annuleren",
533
617
  variant: "danger",
534
618
  onConfirm: () => {
535
- b(!1), c();
619
+ H(!1), c();
536
620
  },
537
- onCancel: () => b(!1)
621
+ onCancel: () => H(!1)
538
622
  }
539
623
  ),
540
- y ? /* @__PURE__ */ t(
541
- Pe,
624
+ k ? /* @__PURE__ */ n(
625
+ Xe,
542
626
  {
543
- currentSessionId: g,
544
- onBack: () => S(!1),
545
- onSelectSession: N,
546
- onNewSession: f,
547
- onListSessions: j,
627
+ currentSessionId: b,
628
+ onBack: () => p(!1),
629
+ onSelectSession: S,
630
+ onNewSession: g,
631
+ onListSessions: f,
548
632
  onDeleteSession: w,
549
- primaryColor: v
633
+ primaryColor: x
550
634
  }
551
- ) : /* @__PURE__ */ d(ge, { children: [
552
- /* @__PURE__ */ t(
553
- Be,
635
+ ) : /* @__PURE__ */ u(ke, { children: [
636
+ /* @__PURE__ */ n(
637
+ Ke,
554
638
  {
555
639
  messages: a,
556
640
  isLoading: i,
557
- isLoadingSession: o,
558
- primaryColor: v
641
+ isLoadingSession: r,
642
+ primaryColor: x
559
643
  }
560
644
  ),
561
- /* @__PURE__ */ t(
562
- ze,
645
+ /* @__PURE__ */ n(
646
+ Ve,
563
647
  {
564
- placeholder: n,
648
+ placeholder: t,
565
649
  isLoading: i,
566
- onSendMessage: r,
567
- primaryColor: v
650
+ onSendMessage: o,
651
+ primaryColor: x
568
652
  }
569
653
  )
570
654
  ] })
571
655
  ] });
572
656
  }
573
- function Te({ className: e }) {
574
- return /* @__PURE__ */ t("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1" }) });
657
+ function Oe({ className: e }) {
658
+ return /* @__PURE__ */ n("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1" }) });
575
659
  }
576
- function je(e) {
660
+ function Fe(e) {
577
661
  return e.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
578
662
  }
579
- function $e(e, s) {
663
+ function Re(e, s) {
580
664
  return e.length <= s ? e : e.slice(0, s - 3) + "...";
581
665
  }
582
- function De({ message: e, primaryColor: s }) {
583
- const n = e.role === "user", a = n ? "user" : "assistant";
584
- return /* @__PURE__ */ t("div", { className: `gcw-bubble-row gcw-bubble-row--${a}`, children: /* @__PURE__ */ d("div", { className: `gcw-bubble-wrapper gcw-bubble-wrapper--${a}`, children: [
585
- /* @__PURE__ */ t(
666
+ function Ge({ message: e, primaryColor: s }) {
667
+ const t = e.role === "user", a = t ? "user" : "assistant";
668
+ return /* @__PURE__ */ n("div", { className: `gcw-bubble-row gcw-bubble-row--${a}`, children: /* @__PURE__ */ u("div", { className: `gcw-bubble-wrapper gcw-bubble-wrapper--${a}`, children: [
669
+ /* @__PURE__ */ n(
586
670
  "div",
587
671
  {
588
672
  className: `gcw-bubble gcw-bubble--${a}`,
589
- style: n ? { backgroundColor: s } : void 0,
590
- children: /* @__PURE__ */ t(Oe, { content: e.content, className: "gcw-content" })
673
+ style: t ? { backgroundColor: s } : void 0,
674
+ children: /* @__PURE__ */ n(Ye, { content: e.content, className: "gcw-content" })
591
675
  }
592
676
  ),
593
- e.sources && e.sources.length > 0 && /* @__PURE__ */ t("div", { className: "gcw-sources", children: e.sources.slice(0, 3).map((i, o) => /* @__PURE__ */ d(
677
+ e.sources && e.sources.length > 0 && /* @__PURE__ */ n("div", { className: "gcw-sources", children: e.sources.slice(0, 3).map((i, r) => /* @__PURE__ */ u(
594
678
  "a",
595
679
  {
596
680
  href: i.url,
@@ -598,59 +682,59 @@ function De({ message: e, primaryColor: s }) {
598
682
  rel: "noopener noreferrer",
599
683
  className: "gcw-source",
600
684
  children: [
601
- /* @__PURE__ */ t(Te, { className: "gcw-source__icon" }),
602
- $e(i.title, 25)
685
+ /* @__PURE__ */ n(Oe, { className: "gcw-source__icon" }),
686
+ Re(i.title, 25)
603
687
  ]
604
688
  },
605
- o
689
+ r
606
690
  )) }),
607
- /* @__PURE__ */ t("span", { className: "gcw-bubble__timestamp", children: je(e.timestamp) })
691
+ /* @__PURE__ */ n("span", { className: "gcw-bubble__timestamp", children: Fe(e.timestamp) })
608
692
  ] }) });
609
693
  }
610
- function Be({ messages: e, isLoading: s, isLoadingSession: n = !1, primaryColor: a }) {
611
- var o;
612
- const i = H(null);
613
- return C(() => {
614
- var r;
615
- (r = i.current) == null || r.scrollIntoView({ behavior: "smooth" });
616
- }, [e, s]), n ? /* @__PURE__ */ t("div", { className: "gcw-empty", children: /* @__PURE__ */ d("div", { className: "gcw-session-loading", children: [
617
- /* @__PURE__ */ t("div", { className: "gcw-session-loading__spinner" }),
618
- /* @__PURE__ */ t("p", { className: "gcw-empty__text", children: "Chatgeschiedenis laden..." })
619
- ] }) }) : e.length === 0 && !s ? /* @__PURE__ */ d("div", { className: "gcw-empty", children: [
620
- /* @__PURE__ */ t("svg", { className: "gcw-empty__icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" }) }),
621
- /* @__PURE__ */ t("p", { className: "gcw-empty__text", children: "Begin een gesprek door hieronder een bericht te typen" })
622
- ] }) : /* @__PURE__ */ d("div", { className: "gcw-messages", children: [
623
- e.map((r) => /* @__PURE__ */ t(
624
- De,
694
+ function Ke({ messages: e, isLoading: s, isLoadingSession: t = !1, primaryColor: a }) {
695
+ var r;
696
+ const i = O(null);
697
+ return M(() => {
698
+ var o;
699
+ (o = i.current) == null || o.scrollIntoView({ behavior: "smooth" });
700
+ }, [e, s]), t ? /* @__PURE__ */ n("div", { className: "gcw-empty", children: /* @__PURE__ */ u("div", { className: "gcw-session-loading", children: [
701
+ /* @__PURE__ */ n("div", { className: "gcw-session-loading__spinner" }),
702
+ /* @__PURE__ */ n("p", { className: "gcw-empty__text", children: "Chatgeschiedenis laden..." })
703
+ ] }) }) : e.length === 0 && !s ? /* @__PURE__ */ u("div", { className: "gcw-empty", children: [
704
+ /* @__PURE__ */ n("svg", { className: "gcw-empty__icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" }) }),
705
+ /* @__PURE__ */ n("p", { className: "gcw-empty__text", children: "Begin een gesprek door hieronder een bericht te typen" })
706
+ ] }) : /* @__PURE__ */ u("div", { className: "gcw-messages", children: [
707
+ e.map((o) => /* @__PURE__ */ n(
708
+ Ge,
625
709
  {
626
- message: r,
710
+ message: o,
627
711
  primaryColor: a
628
712
  },
629
- r.id
713
+ o.id
630
714
  )),
631
- s && ((o = e[e.length - 1]) == null ? void 0 : o.role) !== "assistant" && /* @__PURE__ */ t(Fe, {}),
632
- /* @__PURE__ */ t("div", { ref: i })
715
+ s && ((r = e[e.length - 1]) == null ? void 0 : r.role) !== "assistant" && /* @__PURE__ */ n(Qe, {}),
716
+ /* @__PURE__ */ n("div", { ref: i })
633
717
  ] });
634
718
  }
635
- function ze({ placeholder: e, isLoading: s, onSendMessage: n, primaryColor: a }) {
636
- const [i, o] = x(""), r = H(null);
637
- C(() => {
638
- const l = r.current;
719
+ function Ve({ placeholder: e, isLoading: s, onSendMessage: t, primaryColor: a }) {
720
+ const [i, r] = v(""), o = O(null);
721
+ M(() => {
722
+ const l = o.current;
639
723
  l && (l.style.height = "auto", l.style.height = `${Math.min(l.scrollHeight, 120)}px`);
640
724
  }, [i]);
641
- const h = () => {
642
- i.trim() && !s && (n(i), o(""), r.current && (r.current.style.height = "auto"));
725
+ const m = () => {
726
+ i.trim() && !s && (t(i), r(""), o.current && (o.current.style.height = "auto"));
643
727
  };
644
- return /* @__PURE__ */ d("div", { className: "gcw-input-area", children: [
645
- /* @__PURE__ */ d("div", { className: "gcw-input-row", children: [
646
- /* @__PURE__ */ t(
728
+ return /* @__PURE__ */ u("div", { className: "gcw-input-area", children: [
729
+ /* @__PURE__ */ u("div", { className: "gcw-input-row", children: [
730
+ /* @__PURE__ */ n(
647
731
  "textarea",
648
732
  {
649
- ref: r,
733
+ ref: o,
650
734
  value: i,
651
- onChange: (l) => o(l.target.value),
735
+ onChange: (l) => r(l.target.value),
652
736
  onKeyDown: (l) => {
653
- l.key === "Enter" && !l.shiftKey && (l.preventDefault(), h());
737
+ l.key === "Enter" && !l.shiftKey && (l.preventDefault(), m());
654
738
  },
655
739
  placeholder: e,
656
740
  disabled: s,
@@ -658,84 +742,84 @@ function ze({ placeholder: e, isLoading: s, onSendMessage: n, primaryColor: a })
658
742
  className: "gcw-input"
659
743
  }
660
744
  ),
661
- /* @__PURE__ */ t(
745
+ /* @__PURE__ */ n(
662
746
  "button",
663
747
  {
664
- onClick: h,
748
+ onClick: m,
665
749
  disabled: !i.trim() || s,
666
750
  className: "gcw-send-btn",
667
751
  style: { backgroundColor: a },
668
752
  title: "Verstuur bericht",
669
- children: s ? /* @__PURE__ */ d("svg", { className: "gcw-send-btn__icon gcw-spin", fill: "none", viewBox: "0 0 24 24", children: [
670
- /* @__PURE__ */ t("circle", { style: { opacity: 0.25 }, cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
671
- /* @__PURE__ */ t("path", { style: { opacity: 0.75 }, fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
672
- ] }) : /* @__PURE__ */ t("svg", { className: "gcw-send-btn__icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 19l9 2-9-18-9 18 9-2zm0 0v-8" }) })
753
+ children: s ? /* @__PURE__ */ u("svg", { className: "gcw-send-btn__icon gcw-spin", fill: "none", viewBox: "0 0 24 24", children: [
754
+ /* @__PURE__ */ n("circle", { style: { opacity: 0.25 }, cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
755
+ /* @__PURE__ */ n("path", { style: { opacity: 0.75 }, fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
756
+ ] }) : /* @__PURE__ */ n("svg", { className: "gcw-send-btn__icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 19l9 2-9-18-9 18 9-2zm0 0v-8" }) })
673
757
  }
674
758
  )
675
759
  ] }),
676
- /* @__PURE__ */ t("p", { className: "gcw-input-hint", children: "Druk op Enter om te verzenden, Shift+Enter voor een nieuwe regel" })
760
+ /* @__PURE__ */ n("p", { className: "gcw-input-hint", children: "Druk op Enter om te verzenden, Shift+Enter voor een nieuwe regel" })
677
761
  ] });
678
762
  }
679
- function We({ isOpen: e, onClick: s, primaryColor: n, hasUnread: a, isPoppedOut: i }) {
680
- return /* @__PURE__ */ d(
763
+ function Ue({ isOpen: e, onClick: s, primaryColor: t, hasUnread: a, isPoppedOut: i }) {
764
+ return /* @__PURE__ */ u(
681
765
  "button",
682
766
  {
683
767
  onClick: s,
684
768
  className: "gcw-toggle",
685
- style: { backgroundColor: n },
769
+ style: { backgroundColor: t },
686
770
  title: i ? "Chat is open in een ander venster" : e ? "Sluit chat" : "Open chat",
687
771
  children: [
688
- a && !e && /* @__PURE__ */ t("span", { className: "gcw-toggle__badge gcw-toggle__badge--unread", children: "!" }),
689
- i && /* @__PURE__ */ t("span", { className: "gcw-toggle__badge gcw-toggle__badge--popout" }),
690
- /* @__PURE__ */ t("div", { className: "gcw-toggle__icon", children: i ? /* @__PURE__ */ t("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) }) : e ? /* @__PURE__ */ t("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) : /* @__PURE__ */ t("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" }) }) })
772
+ a && !e && /* @__PURE__ */ n("span", { className: "gcw-toggle__badge gcw-toggle__badge--unread", children: "!" }),
773
+ i && /* @__PURE__ */ n("span", { className: "gcw-toggle__badge gcw-toggle__badge--popout" }),
774
+ /* @__PURE__ */ n("div", { className: "gcw-toggle__icon", children: i ? /* @__PURE__ */ n("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) }) : e ? /* @__PURE__ */ n("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) : /* @__PURE__ */ n("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" }) }) })
691
775
  ]
692
776
  }
693
777
  );
694
778
  }
695
- function He(e) {
696
- const s = new Date(e), a = (/* @__PURE__ */ new Date()).getTime() - s.getTime(), i = Math.floor(a / 6e4), o = Math.floor(a / 36e5), r = Math.floor(a / 864e5);
697
- return i < 1 ? "Zojuist" : i < 60 ? `${i} min geleden` : o < 24 ? `${o} uur geleden` : r < 7 ? `${r} ${r === 1 ? "dag" : "dagen"} geleden` : s.toLocaleDateString("nl-NL", { day: "numeric", month: "short" });
779
+ function Je(e) {
780
+ const s = new Date(e), a = (/* @__PURE__ */ new Date()).getTime() - s.getTime(), i = Math.floor(a / 6e4), r = Math.floor(a / 36e5), o = Math.floor(a / 864e5);
781
+ return i < 1 ? "Zojuist" : i < 60 ? `${i} min geleden` : r < 24 ? `${r} uur geleden` : o < 7 ? `${o} ${o === 1 ? "dag" : "dagen"} geleden` : s.toLocaleDateString("nl-NL", { day: "numeric", month: "short" });
698
782
  }
699
- function Pe({
783
+ function Xe({
700
784
  currentSessionId: e,
701
785
  onBack: s,
702
- onSelectSession: n,
786
+ onSelectSession: t,
703
787
  onNewSession: a,
704
788
  onDeleteSession: i,
705
- onListSessions: o,
706
- primaryColor: r
789
+ onListSessions: r,
790
+ primaryColor: o
707
791
  }) {
708
- const [h, c] = x([]), [l, m] = x(!0), [f, N] = x(null);
709
- C(() => {
710
- let u = !1;
711
- return m(!0), o().then((y) => {
712
- u || (c(y), m(!1));
792
+ const [m, c] = v([]), [l, d] = v(!0), [g, S] = v(null);
793
+ M(() => {
794
+ let h = !1;
795
+ return d(!0), r().then((k) => {
796
+ h || (c(k), d(!1));
713
797
  }), () => {
714
- u = !0;
798
+ h = !0;
715
799
  };
716
- }, [o]);
717
- const j = (u) => {
718
- n(u), s();
719
- }, w = (u, y) => {
720
- u.stopPropagation(), N(y);
721
- }, g = async () => {
722
- if (!f) return;
723
- const u = f;
724
- N(null), await i(u), c((y) => y.filter((S) => S.id !== u));
800
+ }, [r]);
801
+ const f = (h) => {
802
+ t(h), s();
803
+ }, w = (h, k) => {
804
+ h.stopPropagation(), S(k);
805
+ }, b = async () => {
806
+ if (!g) return;
807
+ const h = g;
808
+ S(null), await i(h), c((k) => k.filter((p) => p.id !== h));
725
809
  };
726
- return /* @__PURE__ */ d("div", { className: "gcw-history", children: [
727
- /* @__PURE__ */ d("div", { className: "gcw-history__header", style: { backgroundColor: r }, children: [
728
- /* @__PURE__ */ t(
810
+ return /* @__PURE__ */ u("div", { className: "gcw-history", children: [
811
+ /* @__PURE__ */ u("div", { className: "gcw-history__header", style: { backgroundColor: o }, children: [
812
+ /* @__PURE__ */ n(
729
813
  "button",
730
814
  {
731
815
  className: "gcw-header__btn",
732
816
  onClick: s,
733
817
  title: "Terug",
734
- children: /* @__PURE__ */ t(qe, { className: "gcw-header__btn-icon" })
818
+ children: /* @__PURE__ */ n(at, { className: "gcw-header__btn-icon" })
735
819
  }
736
820
  ),
737
- /* @__PURE__ */ t("h3", { className: "gcw-history__title", children: "Gesprekken" }),
738
- /* @__PURE__ */ t(
821
+ /* @__PURE__ */ n("h3", { className: "gcw-history__title", children: "Gesprekken" }),
822
+ /* @__PURE__ */ n(
739
823
  "button",
740
824
  {
741
825
  className: "gcw-header__btn",
@@ -743,223 +827,223 @@ function Pe({
743
827
  a(), s();
744
828
  },
745
829
  title: "Nieuw gesprek",
746
- children: /* @__PURE__ */ t(re, { className: "gcw-header__btn-icon" })
830
+ children: /* @__PURE__ */ n(ce, { className: "gcw-header__btn-icon" })
747
831
  }
748
832
  )
749
833
  ] }),
750
- /* @__PURE__ */ t("div", { className: "gcw-history__list", children: l ? /* @__PURE__ */ d("div", { className: "gcw-history__loading", children: [
751
- /* @__PURE__ */ t("div", { className: "gcw-session-loading__spinner" }),
752
- /* @__PURE__ */ t("span", { children: "Gesprekken laden..." })
753
- ] }) : h.length === 0 ? /* @__PURE__ */ t("div", { className: "gcw-history__empty", children: /* @__PURE__ */ t("p", { children: "Geen eerdere gesprekken" }) }) : h.map((u) => /* @__PURE__ */ d(
834
+ /* @__PURE__ */ n("div", { className: "gcw-history__list", children: l ? /* @__PURE__ */ u("div", { className: "gcw-history__loading", children: [
835
+ /* @__PURE__ */ n("div", { className: "gcw-session-loading__spinner" }),
836
+ /* @__PURE__ */ n("span", { children: "Gesprekken laden..." })
837
+ ] }) : m.length === 0 ? /* @__PURE__ */ n("div", { className: "gcw-history__empty", children: /* @__PURE__ */ n("p", { children: "Geen eerdere gesprekken" }) }) : m.map((h) => /* @__PURE__ */ u(
754
838
  "div",
755
839
  {
756
- className: `gcw-history__item ${u.id === e ? "gcw-history__item--active" : ""}`,
757
- onClick: () => j(u.id),
758
- style: u.id === e ? { borderLeftColor: r } : void 0,
840
+ className: `gcw-history__item ${h.id === e ? "gcw-history__item--active" : ""}`,
841
+ onClick: () => f(h.id),
842
+ style: h.id === e ? { borderLeftColor: o } : void 0,
759
843
  role: "button",
760
844
  tabIndex: 0,
761
- onKeyDown: (y) => {
762
- y.key === "Enter" && j(u.id);
845
+ onKeyDown: (k) => {
846
+ k.key === "Enter" && f(h.id);
763
847
  },
764
848
  children: [
765
- /* @__PURE__ */ d("div", { className: "gcw-history__item-content", children: [
766
- /* @__PURE__ */ t("span", { className: "gcw-history__item-title", children: u.title || "Naamloos gesprek" }),
767
- /* @__PURE__ */ d("span", { className: "gcw-history__item-meta", children: [
768
- u.message_count,
849
+ /* @__PURE__ */ u("div", { className: "gcw-history__item-content", children: [
850
+ /* @__PURE__ */ n("span", { className: "gcw-history__item-title", children: h.title || "Naamloos gesprek" }),
851
+ /* @__PURE__ */ u("span", { className: "gcw-history__item-meta", children: [
852
+ h.message_count,
769
853
  " ",
770
- u.message_count === 1 ? "bericht" : "berichten",
854
+ h.message_count === 1 ? "bericht" : "berichten",
771
855
  " · ",
772
- He(u.updated_at)
856
+ Je(h.updated_at)
773
857
  ] })
774
858
  ] }),
775
- /* @__PURE__ */ t(
859
+ /* @__PURE__ */ n(
776
860
  "button",
777
861
  {
778
862
  className: "gcw-history__item-delete",
779
- onClick: (y) => w(y, u.id),
863
+ onClick: (k) => w(k, h.id),
780
864
  title: "Verwijder gesprek",
781
- children: /* @__PURE__ */ t(se, { className: "gcw-history__item-delete-icon" })
865
+ children: /* @__PURE__ */ n(le, { className: "gcw-history__item-delete-icon" })
782
866
  }
783
867
  )
784
868
  ]
785
869
  },
786
- u.id
870
+ h.id
787
871
  )) }),
788
- f && /* @__PURE__ */ t(
789
- ne,
872
+ g && /* @__PURE__ */ n(
873
+ ae,
790
874
  {
791
875
  title: "Gesprek verwijderen",
792
876
  message: "Weet je zeker dat je dit gesprek wilt verwijderen? Dit kan niet ongedaan worden gemaakt.",
793
877
  confirmLabel: "Verwijderen",
794
878
  cancelLabel: "Annuleren",
795
879
  variant: "danger",
796
- onConfirm: g,
797
- onCancel: () => N(null)
880
+ onConfirm: b,
881
+ onCancel: () => S(null)
798
882
  }
799
883
  )
800
884
  ] });
801
885
  }
802
- function ne({
886
+ function ae({
803
887
  title: e,
804
888
  message: s,
805
- confirmLabel: n = "Bevestigen",
889
+ confirmLabel: t = "Bevestigen",
806
890
  cancelLabel: a = "Annuleren",
807
891
  onConfirm: i,
808
- onCancel: o,
809
- variant: r = "default"
892
+ onCancel: r,
893
+ variant: o = "default"
810
894
  }) {
811
- const h = H(null), c = H(null);
812
- return C(() => {
813
- var m;
814
- (m = c.current) == null || m.focus();
815
- }, []), C(() => {
816
- const m = (f) => {
817
- f.key === "Escape" && o();
895
+ const m = O(null), c = O(null);
896
+ return M(() => {
897
+ var d;
898
+ (d = c.current) == null || d.focus();
899
+ }, []), M(() => {
900
+ const d = (g) => {
901
+ g.key === "Escape" && r();
818
902
  };
819
- return document.addEventListener("keydown", m), () => document.removeEventListener("keydown", m);
820
- }, [o]), /* @__PURE__ */ t("div", { className: "gcw-modal-overlay", ref: h, onClick: (m) => {
821
- m.target === h.current && o();
822
- }, children: /* @__PURE__ */ d("div", { className: "gcw-modal", role: "dialog", "aria-modal": "true", "aria-labelledby": "gcw-modal-title", children: [
823
- /* @__PURE__ */ t("h4", { className: "gcw-modal__title", id: "gcw-modal-title", children: e }),
824
- /* @__PURE__ */ t("p", { className: "gcw-modal__message", children: s }),
825
- /* @__PURE__ */ d("div", { className: "gcw-modal__actions", children: [
826
- /* @__PURE__ */ t("button", { className: "gcw-modal__btn gcw-modal__btn--cancel", onClick: o, children: a }),
827
- /* @__PURE__ */ t(
903
+ return document.addEventListener("keydown", d), () => document.removeEventListener("keydown", d);
904
+ }, [r]), /* @__PURE__ */ n("div", { className: "gcw-modal-overlay", ref: m, onClick: (d) => {
905
+ d.target === m.current && r();
906
+ }, children: /* @__PURE__ */ u("div", { className: "gcw-modal", role: "dialog", "aria-modal": "true", "aria-labelledby": "gcw-modal-title", children: [
907
+ /* @__PURE__ */ n("h4", { className: "gcw-modal__title", id: "gcw-modal-title", children: e }),
908
+ /* @__PURE__ */ n("p", { className: "gcw-modal__message", children: s }),
909
+ /* @__PURE__ */ u("div", { className: "gcw-modal__actions", children: [
910
+ /* @__PURE__ */ n("button", { className: "gcw-modal__btn gcw-modal__btn--cancel", onClick: r, children: a }),
911
+ /* @__PURE__ */ n(
828
912
  "button",
829
913
  {
830
- className: `gcw-modal__btn gcw-modal__btn--confirm ${r === "danger" ? "gcw-modal__btn--danger" : ""}`,
914
+ className: `gcw-modal__btn gcw-modal__btn--confirm ${o === "danger" ? "gcw-modal__btn--danger" : ""}`,
831
915
  onClick: i,
832
916
  ref: c,
833
- children: n
917
+ children: t
834
918
  }
835
919
  )
836
920
  ] })
837
921
  ] }) });
838
922
  }
839
- function Oe({ content: e, className: s }) {
923
+ function Ye({ content: e, className: s }) {
840
924
  if (!e) return null;
841
- const n = Ve(e);
842
- return /* @__PURE__ */ t("div", { className: s, children: n.map((a, i) => /* @__PURE__ */ t(pe.Fragment, { children: a }, i)) });
925
+ const t = qe(e);
926
+ return /* @__PURE__ */ n("div", { className: s, children: t.map((a, i) => /* @__PURE__ */ n(_e.Fragment, { children: a }, i)) });
843
927
  }
844
- function Ve(e) {
928
+ function qe(e) {
845
929
  const s = e.split(`
846
- `), n = [];
930
+ `), t = [];
847
931
  let a = null;
848
932
  const i = () => {
849
- a && (a.type === "ul" ? n.push(
850
- /* @__PURE__ */ t("ul", { className: "gcw-md-list gcw-md-list--ul", children: a.items.map((o, r) => /* @__PURE__ */ t("li", { className: "gcw-md-list__item", children: o }, r)) }, `list-${n.length}`)
851
- ) : n.push(
852
- /* @__PURE__ */ t("ol", { className: "gcw-md-list gcw-md-list--ol", children: a.items.map((o, r) => /* @__PURE__ */ t("li", { className: "gcw-md-list__item", children: o }, r)) }, `list-${n.length}`)
933
+ a && (a.type === "ul" ? t.push(
934
+ /* @__PURE__ */ n("ul", { className: "gcw-md-list gcw-md-list--ul", children: a.items.map((r, o) => /* @__PURE__ */ n("li", { className: "gcw-md-list__item", children: r }, o)) }, `list-${t.length}`)
935
+ ) : t.push(
936
+ /* @__PURE__ */ n("ol", { className: "gcw-md-list gcw-md-list--ol", children: a.items.map((r, o) => /* @__PURE__ */ n("li", { className: "gcw-md-list__item", children: r }, o)) }, `list-${t.length}`)
853
937
  ), a = null);
854
938
  };
855
- for (let o = 0; o < s.length; o++) {
856
- const r = s[o];
857
- if (r.startsWith("#### ")) {
858
- i(), n.push(
859
- /* @__PURE__ */ t("h5", { className: "gcw-md-heading gcw-md-heading--h5", children: A(r.slice(5)) }, o)
939
+ for (let r = 0; r < s.length; r++) {
940
+ const o = s[r];
941
+ if (o.startsWith("#### ")) {
942
+ i(), t.push(
943
+ /* @__PURE__ */ n("h5", { className: "gcw-md-heading gcw-md-heading--h5", children: G(o.slice(5)) }, r)
860
944
  );
861
945
  continue;
862
946
  }
863
- if (r.startsWith("### ")) {
864
- i(), n.push(
865
- /* @__PURE__ */ t("h4", { className: "gcw-md-heading gcw-md-heading--h4", children: A(r.slice(4)) }, o)
947
+ if (o.startsWith("### ")) {
948
+ i(), t.push(
949
+ /* @__PURE__ */ n("h4", { className: "gcw-md-heading gcw-md-heading--h4", children: G(o.slice(4)) }, r)
866
950
  );
867
951
  continue;
868
952
  }
869
- if (r.startsWith("## ")) {
870
- i(), n.push(
871
- /* @__PURE__ */ t("h3", { className: "gcw-md-heading gcw-md-heading--h3", children: A(r.slice(3)) }, o)
953
+ if (o.startsWith("## ")) {
954
+ i(), t.push(
955
+ /* @__PURE__ */ n("h3", { className: "gcw-md-heading gcw-md-heading--h3", children: G(o.slice(3)) }, r)
872
956
  );
873
957
  continue;
874
958
  }
875
- if (r.startsWith("# ")) {
876
- i(), n.push(
877
- /* @__PURE__ */ t("h2", { className: "gcw-md-heading gcw-md-heading--h2", children: A(r.slice(2)) }, o)
959
+ if (o.startsWith("# ")) {
960
+ i(), t.push(
961
+ /* @__PURE__ */ n("h2", { className: "gcw-md-heading gcw-md-heading--h2", children: G(o.slice(2)) }, r)
878
962
  );
879
963
  continue;
880
964
  }
881
- const h = r.match(/^[\s]*[-*•]\s+(.+)/);
882
- if (h) {
883
- (!a || a.type !== "ul") && (i(), a = { type: "ul", items: [] }), a.items.push(A(h[1]));
965
+ const m = o.match(/^[\s]*[-*•]\s+(.+)/);
966
+ if (m) {
967
+ (!a || a.type !== "ul") && (i(), a = { type: "ul", items: [] }), a.items.push(G(m[1]));
884
968
  continue;
885
969
  }
886
- const c = r.match(/^[\s]*(\d+)[.)]\s+(.+)/);
970
+ const c = o.match(/^[\s]*(\d+)[.)]\s+(.+)/);
887
971
  if (c) {
888
- (!a || a.type !== "ol") && (i(), a = { type: "ol", items: [] }), a.items.push(A(c[2]));
972
+ (!a || a.type !== "ol") && (i(), a = { type: "ol", items: [] }), a.items.push(G(c[2]));
889
973
  continue;
890
974
  }
891
- if (r.startsWith("```")) {
975
+ if (o.startsWith("```")) {
892
976
  i();
893
977
  const l = [];
894
- for (o++; o < s.length && !s[o].startsWith("```"); )
895
- l.push(s[o]), o++;
896
- n.push(
897
- /* @__PURE__ */ t("pre", { className: "gcw-md-code-block", children: /* @__PURE__ */ t("code", { children: l.join(`
898
- `) }) }, `code-${n.length}`)
978
+ for (r++; r < s.length && !s[r].startsWith("```"); )
979
+ l.push(s[r]), r++;
980
+ t.push(
981
+ /* @__PURE__ */ n("pre", { className: "gcw-md-code-block", children: /* @__PURE__ */ n("code", { children: l.join(`
982
+ `) }) }, `code-${t.length}`)
899
983
  );
900
984
  continue;
901
985
  }
902
- if (r.trim() === "") {
986
+ if (o.trim() === "") {
903
987
  i();
904
988
  continue;
905
989
  }
906
- i(), n.push(
907
- /* @__PURE__ */ t("p", { className: "gcw-md-paragraph", children: A(r) }, o)
990
+ i(), t.push(
991
+ /* @__PURE__ */ n("p", { className: "gcw-md-paragraph", children: G(o) }, r)
908
992
  );
909
993
  }
910
- return i(), n;
994
+ return i(), t;
911
995
  }
912
- function A(e) {
996
+ function G(e) {
913
997
  if (!e) return null;
914
998
  const s = [];
915
- let n = e, a = 0;
916
- for (; n.length > 0; ) {
917
- const i = n.match(/^\*\*(.+?)\*\*/);
999
+ let t = e, a = 0;
1000
+ for (; t.length > 0; ) {
1001
+ const i = t.match(/^\*\*(.+?)\*\*/);
918
1002
  if (i) {
919
- s.push(/* @__PURE__ */ t("strong", { className: "gcw-md-bold", children: i[1] }, a++)), n = n.slice(i[0].length);
1003
+ s.push(/* @__PURE__ */ n("strong", { className: "gcw-md-bold", children: i[1] }, a++)), t = t.slice(i[0].length);
920
1004
  continue;
921
1005
  }
922
- const o = n.match(/^\*([^*]+?)\*/);
923
- if (o) {
924
- s.push(/* @__PURE__ */ t("em", { className: "gcw-md-italic", children: o[1] }, a++)), n = n.slice(o[0].length);
1006
+ const r = t.match(/^\*([^*]+?)\*/);
1007
+ if (r) {
1008
+ s.push(/* @__PURE__ */ n("em", { className: "gcw-md-italic", children: r[1] }, a++)), t = t.slice(r[0].length);
925
1009
  continue;
926
1010
  }
927
- const r = n.match(/^`([^`]+)`/);
928
- if (r) {
1011
+ const o = t.match(/^`([^`]+)`/);
1012
+ if (o) {
929
1013
  s.push(
930
- /* @__PURE__ */ t("code", { className: "gcw-md-code", children: r[1] }, a++)
931
- ), n = n.slice(r[0].length);
1014
+ /* @__PURE__ */ n("code", { className: "gcw-md-code", children: o[1] }, a++)
1015
+ ), t = t.slice(o[0].length);
932
1016
  continue;
933
1017
  }
934
- const h = n.match(/^\[([^\]]+)\]\(([^)]+)\)/);
935
- if (h) {
1018
+ const m = t.match(/^\[([^\]]+)\]\(([^)]+)\)/);
1019
+ if (m) {
936
1020
  s.push(
937
- /* @__PURE__ */ t(
1021
+ /* @__PURE__ */ n(
938
1022
  "a",
939
1023
  {
940
- href: h[2],
1024
+ href: m[2],
941
1025
  target: "_blank",
942
1026
  rel: "noopener noreferrer",
943
1027
  className: "gcw-md-link",
944
- children: h[1]
1028
+ children: m[1]
945
1029
  },
946
1030
  a++
947
1031
  )
948
- ), n = n.slice(h[0].length);
1032
+ ), t = t.slice(m[0].length);
949
1033
  continue;
950
1034
  }
951
- const c = n.search(/[\*`\[]/);
1035
+ const c = t.search(/[\*`\[]/);
952
1036
  if (c === -1) {
953
- s.push(n);
1037
+ s.push(t);
954
1038
  break;
955
- } else c === 0 ? (s.push(n[0]), n = n.slice(1)) : (s.push(n.slice(0, c)), n = n.slice(c));
1039
+ } else c === 0 ? (s.push(t[0]), t = t.slice(1)) : (s.push(t.slice(0, c)), t = t.slice(c));
956
1040
  }
957
1041
  return s.length === 1 ? s[0] : s;
958
1042
  }
959
- function Ae(e) {
960
- const s = e.messages.map((n) => ({
961
- ...n,
962
- timestamp: n.timestamp.toISOString()
1043
+ function Ze(e) {
1044
+ const s = e.messages.map((t) => ({
1045
+ ...t,
1046
+ timestamp: t.timestamp.toISOString()
963
1047
  }));
964
1048
  return `
965
1049
  <!DOCTYPE html>
@@ -967,7 +1051,7 @@ function Ae(e) {
967
1051
  <head>
968
1052
  <meta charset="UTF-8">
969
1053
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
970
- <title>${J(e.title)}</title>
1054
+ <title>${Z(e.title)}</title>
971
1055
  <style>
972
1056
  * { margin: 0; padding: 0; box-sizing: border-box; }
973
1057
  html, body, #chat-root { height: 100%; width: 100%; }
@@ -1242,8 +1326,8 @@ function Ae(e) {
1242
1326
  </svg>
1243
1327
  </div>
1244
1328
  <div class="popout-header-info">
1245
- <div class="popout-title">${J(e.title)}</div>
1246
- <div class="popout-subtitle">${J(e.subtitle)}</div>
1329
+ <div class="popout-title">${Z(e.title)}</div>
1330
+ <div class="popout-subtitle">${Z(e.subtitle)}</div>
1247
1331
  </div>
1248
1332
  </div>
1249
1333
  <div class="popout-messages" id="messages-container"></div>
@@ -1252,7 +1336,7 @@ function Ae(e) {
1252
1336
  <textarea
1253
1337
  class="popout-textarea"
1254
1338
  id="message-input"
1255
- placeholder="${J(e.placeholder)}"
1339
+ placeholder="${Z(e.placeholder)}"
1256
1340
  rows="1"
1257
1341
  ></textarea>
1258
1342
  <button
@@ -1276,8 +1360,19 @@ function Ae(e) {
1276
1360
  tenantId: e.tenantId,
1277
1361
  sessionId: e.sessionId,
1278
1362
  primaryColor: e.primaryColor,
1279
- headers: e.headers || {}
1363
+ tokenStorageKey: e.tokenStorageKey || "geoapps-token"
1280
1364
  })};
1365
+
1366
+ function getAuthHeaders() {
1367
+ try {
1368
+ const raw = window.opener?.sessionStorage?.getItem(config.tokenStorageKey)
1369
+ || sessionStorage.getItem(config.tokenStorageKey);
1370
+ if (!raw) return {};
1371
+ const token = JSON.parse(raw);
1372
+ if (token?.access_token) return { Authorization: 'Bearer ' + token.access_token };
1373
+ } catch (e) {}
1374
+ return {};
1375
+ }
1281
1376
 
1282
1377
  const STORAGE_KEY = 'gcw_chat_' + (config.tenantId || 'default');
1283
1378
 
@@ -1447,7 +1542,7 @@ function Ae(e) {
1447
1542
  headers: {
1448
1543
  'Content-Type': 'application/json',
1449
1544
  ...(config.tenantId && { 'X-Tenant-ID': config.tenantId }),
1450
- ...config.headers
1545
+ ...getAuthHeaders()
1451
1546
  },
1452
1547
  body: JSON.stringify({
1453
1548
  message: content.trim(),
@@ -1531,199 +1626,184 @@ function Ae(e) {
1531
1626
  </html>
1532
1627
  `;
1533
1628
  }
1534
- function J(e) {
1629
+ function Z(e) {
1535
1630
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
1536
1631
  }
1537
- function Fe() {
1538
- return /* @__PURE__ */ t("div", { className: "gcw-typing", children: /* @__PURE__ */ t("div", { className: "gcw-typing__bubble", children: /* @__PURE__ */ d("div", { className: "gcw-typing__dots", children: [
1539
- /* @__PURE__ */ t("span", { className: "gcw-typing__dot" }),
1540
- /* @__PURE__ */ t("span", { className: "gcw-typing__dot" }),
1541
- /* @__PURE__ */ t("span", { className: "gcw-typing__dot" })
1632
+ function Qe() {
1633
+ return /* @__PURE__ */ n("div", { className: "gcw-typing", children: /* @__PURE__ */ n("div", { className: "gcw-typing__bubble", children: /* @__PURE__ */ u("div", { className: "gcw-typing__dots", children: [
1634
+ /* @__PURE__ */ n("span", { className: "gcw-typing__dot" }),
1635
+ /* @__PURE__ */ n("span", { className: "gcw-typing__dot" }),
1636
+ /* @__PURE__ */ n("span", { className: "gcw-typing__dot" })
1542
1637
  ] }) }) });
1543
1638
  }
1544
- const Ue = {
1639
+ const et = {
1545
1640
  small: "Klein",
1546
1641
  medium: "Middel",
1547
1642
  large: "Groot",
1548
1643
  fullscreen: "Volledig scherm"
1549
1644
  };
1550
- function Ke({ size: e, onCycleSize: s, onPopout: n, onClear: a, onNewSession: i, onShowHistory: o }) {
1551
- const [r, h] = x(!1), c = H(null);
1552
- C(() => {
1553
- if (!r) return;
1554
- const m = (N) => {
1555
- c.current && !c.current.contains(N.target) && h(!1);
1556
- }, f = setTimeout(() => {
1557
- document.addEventListener("click", m);
1645
+ function tt({ size: e, onCycleSize: s, onPopout: t, onClear: a, onNewSession: i, onShowHistory: r }) {
1646
+ const [o, m] = v(!1), c = O(null);
1647
+ M(() => {
1648
+ if (!o) return;
1649
+ const d = (S) => {
1650
+ c.current && !c.current.contains(S.target) && m(!1);
1651
+ }, g = setTimeout(() => {
1652
+ document.addEventListener("click", d);
1558
1653
  }, 0);
1559
1654
  return () => {
1560
- clearTimeout(f), document.removeEventListener("click", m);
1655
+ clearTimeout(g), document.removeEventListener("click", d);
1561
1656
  };
1562
- }, [r]), C(() => {
1563
- if (!r) return;
1564
- const m = (f) => {
1565
- f.key === "Escape" && h(!1);
1657
+ }, [o]), M(() => {
1658
+ if (!o) return;
1659
+ const d = (g) => {
1660
+ g.key === "Escape" && m(!1);
1566
1661
  };
1567
- return document.addEventListener("keydown", m), () => document.removeEventListener("keydown", m);
1568
- }, [r]);
1569
- const l = (m) => {
1570
- m(), h(!1);
1662
+ return document.addEventListener("keydown", d), () => document.removeEventListener("keydown", d);
1663
+ }, [o]);
1664
+ const l = (d) => {
1665
+ d(), m(!1);
1571
1666
  };
1572
- return /* @__PURE__ */ d("div", { className: "gcw-header-menu", ref: c, children: [
1573
- /* @__PURE__ */ t(
1667
+ return /* @__PURE__ */ u("div", { className: "gcw-header-menu", ref: c, children: [
1668
+ /* @__PURE__ */ n(
1574
1669
  "button",
1575
1670
  {
1576
- onClick: () => h(!r),
1671
+ onClick: () => m(!o),
1577
1672
  className: "gcw-header__btn",
1578
1673
  title: "Menu",
1579
- "aria-expanded": r,
1674
+ "aria-expanded": o,
1580
1675
  "aria-haspopup": "true",
1581
- children: /* @__PURE__ */ d("svg", { className: "gcw-header__btn-icon", fill: "currentColor", viewBox: "0 0 24 24", children: [
1582
- /* @__PURE__ */ t("circle", { cx: "12", cy: "5", r: "2" }),
1583
- /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "2" }),
1584
- /* @__PURE__ */ t("circle", { cx: "12", cy: "19", r: "2" })
1676
+ children: /* @__PURE__ */ u("svg", { className: "gcw-header__btn-icon", fill: "currentColor", viewBox: "0 0 24 24", children: [
1677
+ /* @__PURE__ */ n("circle", { cx: "12", cy: "5", r: "2" }),
1678
+ /* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "2" }),
1679
+ /* @__PURE__ */ n("circle", { cx: "12", cy: "19", r: "2" })
1585
1680
  ] })
1586
1681
  }
1587
1682
  ),
1588
- r && /* @__PURE__ */ d("div", { className: "gcw-header-menu__dropdown", role: "menu", children: [
1589
- /* @__PURE__ */ d(
1683
+ o && /* @__PURE__ */ u("div", { className: "gcw-header-menu__dropdown", role: "menu", children: [
1684
+ /* @__PURE__ */ u(
1590
1685
  "button",
1591
1686
  {
1592
1687
  className: "gcw-header-menu__item",
1593
1688
  onClick: () => l(i),
1594
1689
  role: "menuitem",
1595
1690
  children: [
1596
- /* @__PURE__ */ t(re, { className: "gcw-header-menu__icon" }),
1597
- /* @__PURE__ */ t("span", { children: "Nieuwe chat" })
1691
+ /* @__PURE__ */ n(ce, { className: "gcw-header-menu__icon" }),
1692
+ /* @__PURE__ */ n("span", { children: "Nieuwe chat" })
1598
1693
  ]
1599
1694
  }
1600
1695
  ),
1601
- /* @__PURE__ */ d(
1696
+ /* @__PURE__ */ u(
1602
1697
  "button",
1603
1698
  {
1604
1699
  className: "gcw-header-menu__item",
1605
- onClick: () => l(o),
1700
+ onClick: () => l(r),
1606
1701
  role: "menuitem",
1607
1702
  children: [
1608
- /* @__PURE__ */ t(Ye, { className: "gcw-header-menu__icon" }),
1609
- /* @__PURE__ */ t("span", { children: "Chat geschiedenis" })
1703
+ /* @__PURE__ */ n(it, { className: "gcw-header-menu__icon" }),
1704
+ /* @__PURE__ */ n("span", { children: "Chat geschiedenis" })
1610
1705
  ]
1611
1706
  }
1612
1707
  ),
1613
- /* @__PURE__ */ t("div", { className: "gcw-header-menu__divider" }),
1614
- /* @__PURE__ */ d(
1708
+ /* @__PURE__ */ n("div", { className: "gcw-header-menu__divider" }),
1709
+ /* @__PURE__ */ u(
1615
1710
  "button",
1616
1711
  {
1617
1712
  className: "gcw-header-menu__item",
1618
1713
  onClick: () => l(s),
1619
1714
  role: "menuitem",
1620
1715
  children: [
1621
- /* @__PURE__ */ t(Re, { size: e, className: "gcw-header-menu__icon" }),
1622
- /* @__PURE__ */ d("span", { children: [
1716
+ /* @__PURE__ */ n(nt, { size: e, className: "gcw-header-menu__icon" }),
1717
+ /* @__PURE__ */ u("span", { children: [
1623
1718
  "Grootte: ",
1624
- Ue[e]
1719
+ et[e]
1625
1720
  ] })
1626
1721
  ]
1627
1722
  }
1628
1723
  ),
1629
- /* @__PURE__ */ d(
1724
+ /* @__PURE__ */ u(
1630
1725
  "button",
1631
1726
  {
1632
1727
  className: "gcw-header-menu__item",
1633
- onClick: () => l(n),
1728
+ onClick: () => l(t),
1634
1729
  role: "menuitem",
1635
1730
  children: [
1636
- /* @__PURE__ */ t(Ge, { className: "gcw-header-menu__icon" }),
1637
- /* @__PURE__ */ t("span", { children: "Open in nieuw venster" })
1731
+ /* @__PURE__ */ n(st, { className: "gcw-header-menu__icon" }),
1732
+ /* @__PURE__ */ n("span", { children: "Open in nieuw venster" })
1638
1733
  ]
1639
1734
  }
1640
1735
  ),
1641
- /* @__PURE__ */ t("div", { className: "gcw-header-menu__divider" }),
1642
- /* @__PURE__ */ d(
1736
+ /* @__PURE__ */ n("div", { className: "gcw-header-menu__divider" }),
1737
+ /* @__PURE__ */ u(
1643
1738
  "button",
1644
1739
  {
1645
1740
  className: "gcw-header-menu__item gcw-header-menu__item--danger",
1646
1741
  onClick: () => l(a),
1647
1742
  role: "menuitem",
1648
1743
  children: [
1649
- /* @__PURE__ */ t(se, { className: "gcw-header-menu__icon" }),
1650
- /* @__PURE__ */ t("span", { children: "Chat verwijderen" })
1744
+ /* @__PURE__ */ n(le, { className: "gcw-header-menu__icon" }),
1745
+ /* @__PURE__ */ n("span", { children: "Chat verwijderen" })
1651
1746
  ]
1652
1747
  }
1653
1748
  )
1654
1749
  ] })
1655
1750
  ] });
1656
1751
  }
1657
- function Re({ size: e, className: s = "gcw-w-4 gcw-h-4" }) {
1658
- switch (e) {
1659
- case "small":
1660
- return /* @__PURE__ */ t("svg", { className: s, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4" }) });
1661
- case "medium":
1662
- return /* @__PURE__ */ t("svg", { className: s, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4" }) });
1663
- case "large":
1664
- return /* @__PURE__ */ t("svg", { className: s, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4" }) });
1665
- case "fullscreen":
1666
- return /* @__PURE__ */ t("svg", { className: s, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25" }) });
1667
- }
1668
- }
1669
- function tt({ className: e = "gcw-w-4 gcw-h-4" }) {
1670
- return /* @__PURE__ */ t("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4" }) });
1671
- }
1672
- function nt({ className: e = "gcw-w-4 gcw-h-4" }) {
1673
- return /* @__PURE__ */ t("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25" }) });
1752
+ function nt({ size: e, className: s }) {
1753
+ return /* @__PURE__ */ n("svg", { className: s, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: e === "fullscreen" ? "M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25" : "M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4" }) });
1674
1754
  }
1675
- function Ge({ className: e = "gcw-w-4 gcw-h-4" }) {
1676
- return /* @__PURE__ */ t("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) });
1755
+ function st({ className: e }) {
1756
+ return /* @__PURE__ */ n("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) });
1677
1757
  }
1678
- function Xe({ className: e = "gcw-w-4 gcw-h-4" }) {
1679
- return /* @__PURE__ */ t("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) });
1758
+ function ot({ className: e }) {
1759
+ return /* @__PURE__ */ n("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) });
1680
1760
  }
1681
- function se({ className: e = "gcw-w-4 gcw-h-4" }) {
1682
- return /* @__PURE__ */ t("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" }) });
1761
+ function le({ className: e }) {
1762
+ return /* @__PURE__ */ n("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" }) });
1683
1763
  }
1684
- function Je({ className: e = "gcw-w-6 gcw-h-6" }) {
1685
- return /* @__PURE__ */ t("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z" }) });
1764
+ function rt({ className: e }) {
1765
+ return /* @__PURE__ */ n("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z" }) });
1686
1766
  }
1687
- function re({ className: e = "gcw-w-4 gcw-h-4" }) {
1688
- return /* @__PURE__ */ t("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" }) });
1767
+ function ce({ className: e }) {
1768
+ return /* @__PURE__ */ n("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" }) });
1689
1769
  }
1690
- function Ye({ className: e = "gcw-w-4 gcw-h-4" }) {
1691
- return /* @__PURE__ */ t("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" }) });
1770
+ function it({ className: e }) {
1771
+ return /* @__PURE__ */ n("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" }) });
1692
1772
  }
1693
- function qe({ className: e = "gcw-w-4 gcw-h-4" }) {
1694
- return /* @__PURE__ */ t("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 19l-7-7m0 0l7-7m-7 7h18" }) });
1773
+ function at({ className: e }) {
1774
+ return /* @__PURE__ */ n("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 19l-7-7m0 0l7-7m-7 7h18" }) });
1695
1775
  }
1696
1776
  export {
1697
- qe as ArrowLeftIcon,
1698
- De as ChatBubble,
1699
- Je as ChatIcon,
1700
- et as ChatWidget,
1701
- Ee as ChatWindow,
1702
- Xe as CloseIcon,
1703
- ne as ConfirmModal,
1704
- nt as ContractIcon,
1705
- tt as ExpandIcon,
1706
- Ke as HeaderMenu,
1707
- Ye as HistoryIcon,
1708
- Oe as MarkdownRenderer,
1709
- ze as MessageInput,
1710
- Be as MessageList,
1711
- re as NewChatIcon,
1712
- Ge as PopoutIcon,
1713
- Re as ResizeIcon,
1714
- Pe as SessionHistory,
1715
- We as ToggleButton,
1716
- se as TrashIcon,
1717
- Fe as TypingIndicator,
1718
- W as clearSession,
1719
- Ae as getPopoutHTML,
1720
- _e as loadPopoutState,
1721
- Me as loadSeenAssistantCount,
1722
- ye as loadSessionId,
1723
- G as savePopoutState,
1724
- X as saveSeenAssistantCount,
1725
- ve as saveSessionId,
1726
- ke as subscribeToSessionChanges,
1727
- xe as useChat,
1728
- Ne as usePopout
1777
+ at as ArrowLeftIcon,
1778
+ Ge as ChatBubble,
1779
+ rt as ChatIcon,
1780
+ dt as ChatWidget,
1781
+ Pe as ChatWindow,
1782
+ ot as CloseIcon,
1783
+ ae as ConfirmModal,
1784
+ tt as HeaderMenu,
1785
+ it as HistoryIcon,
1786
+ Ye as MarkdownRenderer,
1787
+ Ve as MessageInput,
1788
+ Ke as MessageList,
1789
+ ce as NewChatIcon,
1790
+ st as PopoutIcon,
1791
+ nt as ResizeIcon,
1792
+ Xe as SessionHistory,
1793
+ Ue as ToggleButton,
1794
+ le as TrashIcon,
1795
+ Qe as TypingIndicator,
1796
+ P as clearSession,
1797
+ U as getAuthHeaders,
1798
+ Ze as getPopoutHTML,
1799
+ Le as loadPopoutState,
1800
+ Ee as loadSeenAssistantCount,
1801
+ Ie as loadSessionId,
1802
+ Y as savePopoutState,
1803
+ q as saveSeenAssistantCount,
1804
+ Me as saveSessionId,
1805
+ Ce as subscribeToSessionChanges,
1806
+ je as useAuth,
1807
+ De as useChat,
1808
+ ze as usePopout
1729
1809
  };