@cas0570/chat-widget 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/geoapps-chat-widget.js +234 -238
- package/dist/geoapps-chat-widget.umd.cjs +5 -5
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
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)}})();
|
|
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;text-transform:none}.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;text-transform:none}.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
2
|
import { jsxs as u, jsx as n, Fragment as ke } from "react/jsx-runtime";
|
|
3
3
|
import _e, { useState as v, useCallback as L, useEffect as M, useRef as O } from "react";
|
|
4
4
|
const xe = "gcw_session_", Ne = "gcw_popout_", Se = "gcw_read_";
|
|
@@ -33,19 +33,19 @@ function Ce(e, s) {
|
|
|
33
33
|
};
|
|
34
34
|
return window.addEventListener("storage", a), () => window.removeEventListener("storage", a);
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function re(e) {
|
|
37
37
|
return `${Ne}${e || "default"}`;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function X(e, s) {
|
|
40
40
|
try {
|
|
41
|
-
e ? localStorage.setItem(
|
|
41
|
+
e ? localStorage.setItem(re(s), "true") : localStorage.removeItem(re(s));
|
|
42
42
|
} catch (t) {
|
|
43
43
|
console.warn("Failed to save popout state:", t);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
function Le(e) {
|
|
47
47
|
try {
|
|
48
|
-
return localStorage.getItem(
|
|
48
|
+
return localStorage.getItem(re(e)) === "true";
|
|
49
49
|
} catch {
|
|
50
50
|
return !1;
|
|
51
51
|
}
|
|
@@ -53,7 +53,7 @@ function Le(e) {
|
|
|
53
53
|
function Q(e) {
|
|
54
54
|
return `${Se}${e || "default"}`;
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function Y(e, s) {
|
|
57
57
|
try {
|
|
58
58
|
e > 0 ? localStorage.setItem(Q(s), String(e)) : localStorage.removeItem(Q(s));
|
|
59
59
|
} catch (t) {
|
|
@@ -70,14 +70,13 @@ function Ee(e) {
|
|
|
70
70
|
}
|
|
71
71
|
function U(e) {
|
|
72
72
|
if (!e)
|
|
73
|
-
return
|
|
73
|
+
return {};
|
|
74
74
|
try {
|
|
75
75
|
const s = sessionStorage.getItem(e);
|
|
76
|
-
if (
|
|
76
|
+
if (!s) return {};
|
|
77
77
|
const t = JSON.parse(s);
|
|
78
|
-
if (
|
|
78
|
+
if (t != null && t.access_token)
|
|
79
79
|
return { Authorization: `Bearer ${t.access_token}` };
|
|
80
|
-
console.log("No access_token found in token object");
|
|
81
80
|
} catch {
|
|
82
81
|
}
|
|
83
82
|
return {};
|
|
@@ -106,8 +105,8 @@ function $e(e, s) {
|
|
|
106
105
|
}
|
|
107
106
|
});
|
|
108
107
|
if (i.ok) {
|
|
109
|
-
const
|
|
110
|
-
return { ok: !0, user: Te(
|
|
108
|
+
const o = await i.json();
|
|
109
|
+
return { ok: !0, user: Te(o), error: null };
|
|
111
110
|
}
|
|
112
111
|
return {
|
|
113
112
|
ok: !1,
|
|
@@ -121,30 +120,30 @@ function $e(e, s) {
|
|
|
121
120
|
return se.set(e, a), a.finally(() => se.delete(e)), a;
|
|
122
121
|
}
|
|
123
122
|
function je({ authUrl: e, tokenStorageKey: s }) {
|
|
124
|
-
const [t, a] = v(!e), [i,
|
|
125
|
-
m(
|
|
123
|
+
const [t, a] = v(!e), [i, o] = v(!!e), [r, m] = v(null), [l, c] = v(null), d = L((w) => {
|
|
124
|
+
m(w.user), a(w.ok), c(w.error);
|
|
126
125
|
}, []), g = L(async () => {
|
|
127
126
|
if (!e) return !0;
|
|
128
|
-
const
|
|
129
|
-
return d(
|
|
127
|
+
const w = await $e(e, s);
|
|
128
|
+
return d(w), w.ok;
|
|
130
129
|
}, [e, s, d]);
|
|
131
130
|
M(() => {
|
|
132
131
|
if (!e) return;
|
|
133
|
-
let
|
|
132
|
+
let w = !1;
|
|
134
133
|
return (async () => {
|
|
135
|
-
|
|
134
|
+
o(!0), await g(), w || o(!1);
|
|
136
135
|
})(), () => {
|
|
137
|
-
|
|
136
|
+
w = !0;
|
|
138
137
|
};
|
|
139
138
|
}, [e, g]);
|
|
140
139
|
const S = L(async () => g(), [g]);
|
|
141
|
-
return { isAuthenticated: t, isLoading: i, user:
|
|
140
|
+
return { isAuthenticated: t, isLoading: i, user: r, error: l, recheckAuth: S };
|
|
142
141
|
}
|
|
143
142
|
function De(e) {
|
|
144
|
-
const { apiUrl: s, tenantId: t, sessionId: a, tokenStorageKey: i, onError:
|
|
143
|
+
const { apiUrl: s, tenantId: t, sessionId: a, tokenStorageKey: i, onError: o, persist: r = !0 } = e, [m, l] = v([]), [c, d] = v(!1), [g, S] = v(!1), [w, p] = v(null), [b, x] = v(() => a || (r ? Ie(t) : null)), h = O(null), k = O(!1), f = L(() => s.replace(/\/chat\/?$/, ""), [s]), z = L(async (y) => {
|
|
145
144
|
S(!0);
|
|
146
145
|
try {
|
|
147
|
-
const _ =
|
|
146
|
+
const _ = f(), T = await fetch(`${_}/sessions/${y}`, {
|
|
148
147
|
method: "GET",
|
|
149
148
|
headers: {
|
|
150
149
|
"Content-Type": "application/json",
|
|
@@ -155,9 +154,9 @@ function De(e) {
|
|
|
155
154
|
if (T.status === 500)
|
|
156
155
|
return console.error("Server error while loading session, will retry later"), !1;
|
|
157
156
|
if (T.status === 401)
|
|
158
|
-
return console.info("Unauthorized while loading session, clearing session"),
|
|
157
|
+
return console.info("Unauthorized while loading session, clearing session"), r && P(t), x(null), !1;
|
|
159
158
|
if (T.status === 404)
|
|
160
|
-
return console.info("Session not found, starting fresh"),
|
|
159
|
+
return console.info("Session not found, starting fresh"), r && P(t), x(null), !1;
|
|
161
160
|
if (T.status === 429)
|
|
162
161
|
return console.info("Rate limited while loading session, will retry later"), !1;
|
|
163
162
|
if (!T.ok)
|
|
@@ -176,23 +175,23 @@ function De(e) {
|
|
|
176
175
|
}))
|
|
177
176
|
};
|
|
178
177
|
});
|
|
179
|
-
return
|
|
178
|
+
return l($), x(y), !0;
|
|
180
179
|
} catch (_) {
|
|
181
|
-
return console.error("Failed to load session:", _),
|
|
180
|
+
return console.error("Failed to load session:", _), r && P(t), x(null), !1;
|
|
182
181
|
} finally {
|
|
183
182
|
S(!1);
|
|
184
183
|
}
|
|
185
|
-
}, [
|
|
184
|
+
}, [f, t, r]);
|
|
186
185
|
M(() => {
|
|
187
186
|
k.current || (k.current = !0, b && z(b));
|
|
188
187
|
}, []), M(() => {
|
|
189
|
-
|
|
190
|
-
}, [b, t,
|
|
191
|
-
_ && _ !== b ? z(_) : _ || (
|
|
192
|
-
}) : void 0, [t,
|
|
188
|
+
r && Me(b, t);
|
|
189
|
+
}, [b, t, r]), M(() => r ? Ce(t, (_) => {
|
|
190
|
+
_ && _ !== b ? z(_) : _ || (l([]), x(null));
|
|
191
|
+
}) : void 0, [t, r, b, z]);
|
|
193
192
|
const H = L(async (y) => {
|
|
194
193
|
var T;
|
|
195
|
-
if (!y.trim() ||
|
|
194
|
+
if (!y.trim() || c) return;
|
|
196
195
|
h.current && h.current.abort(), h.current = new AbortController();
|
|
197
196
|
const _ = {
|
|
198
197
|
id: `temp_${Date.now()}`,
|
|
@@ -200,7 +199,7 @@ function De(e) {
|
|
|
200
199
|
content: y.trim(),
|
|
201
200
|
timestamp: /* @__PURE__ */ new Date()
|
|
202
201
|
};
|
|
203
|
-
|
|
202
|
+
l((I) => [...I, _]), d(!0), p(null);
|
|
204
203
|
try {
|
|
205
204
|
const I = await fetch(s, {
|
|
206
205
|
method: "POST",
|
|
@@ -223,7 +222,7 @@ function De(e) {
|
|
|
223
222
|
content: "Er is een fout opgetreden bij het verwerken van je bericht. Probeer het later opnieuw.",
|
|
224
223
|
timestamp: /* @__PURE__ */ new Date()
|
|
225
224
|
};
|
|
226
|
-
|
|
225
|
+
l((W) => [...W, j]);
|
|
227
226
|
return;
|
|
228
227
|
}
|
|
229
228
|
if (I.status === 401) {
|
|
@@ -233,7 +232,7 @@ function De(e) {
|
|
|
233
232
|
content: "Je sessie is verlopen of je hebt geen toegang. Vernieuw de pagina om opnieuw te verbinden.",
|
|
234
233
|
timestamp: /* @__PURE__ */ new Date()
|
|
235
234
|
};
|
|
236
|
-
|
|
235
|
+
l((W) => [...W, j]), r && P(t), x(null);
|
|
237
236
|
return;
|
|
238
237
|
}
|
|
239
238
|
if (I.status === 429) {
|
|
@@ -243,7 +242,7 @@ function De(e) {
|
|
|
243
242
|
content: "Je stuurt te veel berichten achter elkaar. Wacht even en probeer het dan opnieuw.",
|
|
244
243
|
timestamp: /* @__PURE__ */ new Date()
|
|
245
244
|
};
|
|
246
|
-
|
|
245
|
+
l((W) => [...W, j]);
|
|
247
246
|
return;
|
|
248
247
|
}
|
|
249
248
|
const C = await I.json().catch(() => ({}));
|
|
@@ -260,21 +259,21 @@ function De(e) {
|
|
|
260
259
|
timestamp: /* @__PURE__ */ new Date(),
|
|
261
260
|
sources: B
|
|
262
261
|
};
|
|
263
|
-
|
|
262
|
+
l((C) => [...C, R]), $.session_id && x($.session_id);
|
|
264
263
|
} catch (I) {
|
|
265
264
|
if (I.name === "AbortError")
|
|
266
265
|
return;
|
|
267
266
|
const $ = I instanceof Error ? I : new Error("An error occurred");
|
|
268
|
-
|
|
267
|
+
p($), o == null || o($);
|
|
269
268
|
} finally {
|
|
270
269
|
d(!1), h.current = null;
|
|
271
270
|
}
|
|
272
|
-
}, [s, t, b,
|
|
273
|
-
|
|
274
|
-
}, [
|
|
271
|
+
}, [s, t, b, c, o]), J = L(() => {
|
|
272
|
+
l([]), x(null), p(null), k.current = !1, r && P(t);
|
|
273
|
+
}, [r, t]), F = L(async () => {
|
|
275
274
|
if (b)
|
|
276
275
|
try {
|
|
277
|
-
const y =
|
|
276
|
+
const y = f();
|
|
278
277
|
await fetch(`${y}/sessions/${b}`, {
|
|
279
278
|
method: "DELETE",
|
|
280
279
|
headers: {
|
|
@@ -286,10 +285,10 @@ function De(e) {
|
|
|
286
285
|
} catch (y) {
|
|
287
286
|
console.error("Failed to delete session:", y);
|
|
288
287
|
}
|
|
289
|
-
|
|
290
|
-
}, [b,
|
|
288
|
+
l([]), x(null), p(null), k.current = !1, r && P(t);
|
|
289
|
+
}, [b, f, t, r]), A = L(async (y) => {
|
|
291
290
|
try {
|
|
292
|
-
const _ =
|
|
291
|
+
const _ = f();
|
|
293
292
|
await fetch(`${_}/sessions/${y}`, {
|
|
294
293
|
method: "DELETE",
|
|
295
294
|
headers: {
|
|
@@ -301,14 +300,14 @@ function De(e) {
|
|
|
301
300
|
} catch (_) {
|
|
302
301
|
console.error("Failed to delete session:", _);
|
|
303
302
|
}
|
|
304
|
-
y === b && (
|
|
305
|
-
}, [
|
|
306
|
-
|
|
307
|
-
}, [
|
|
303
|
+
y === b && (l([]), x(null), p(null), k.current = !1, r && P(t));
|
|
304
|
+
}, [f, t, b, r]), N = L(() => {
|
|
305
|
+
l([]), x(null), p(null), k.current = !1, r && P(t);
|
|
306
|
+
}, [r, t]), te = L(async (y) => {
|
|
308
307
|
await z(y);
|
|
309
308
|
}, [z]), ne = L(async () => {
|
|
310
309
|
try {
|
|
311
|
-
const y =
|
|
310
|
+
const y = f(), _ = await fetch(`${y}/sessions`, {
|
|
312
311
|
method: "GET",
|
|
313
312
|
headers: {
|
|
314
313
|
"Content-Type": "application/json",
|
|
@@ -320,12 +319,12 @@ function De(e) {
|
|
|
320
319
|
} catch (y) {
|
|
321
320
|
return console.error("Failed to list sessions:", y), [];
|
|
322
321
|
}
|
|
323
|
-
}, [
|
|
322
|
+
}, [f, t]);
|
|
324
323
|
return {
|
|
325
324
|
messages: m,
|
|
326
|
-
isLoading:
|
|
325
|
+
isLoading: c,
|
|
327
326
|
isLoadingSession: g,
|
|
328
|
-
error:
|
|
327
|
+
error: w,
|
|
329
328
|
sendMessage: H,
|
|
330
329
|
clearMessages: J,
|
|
331
330
|
deleteSession: F,
|
|
@@ -336,52 +335,49 @@ function De(e) {
|
|
|
336
335
|
sessionId: b
|
|
337
336
|
};
|
|
338
337
|
}
|
|
339
|
-
let
|
|
338
|
+
let q = null;
|
|
340
339
|
function ze(e, s, t) {
|
|
341
|
-
const [a, i] = v(() => Le(e.tenantId)),
|
|
340
|
+
const [a, i] = v(() => Le(e.tenantId)), o = O(q);
|
|
342
341
|
M(() => {
|
|
343
|
-
|
|
344
|
-
const l = window.open("", "GeoAppsChatPopout");
|
|
345
|
-
l && l.location.href !== "about:blank" && !l.closed ? (r.current = l, X = l) : (i(!1), Y(!1, e.tenantId));
|
|
346
|
-
}
|
|
342
|
+
a && !o.current && (i(!1), X(!1, e.tenantId));
|
|
347
343
|
}, [a, e.tenantId]), M(() => {
|
|
348
|
-
if (!
|
|
349
|
-
const
|
|
344
|
+
if (!o.current) return;
|
|
345
|
+
const c = setInterval(() => {
|
|
350
346
|
var d;
|
|
351
|
-
(d =
|
|
347
|
+
(d = o.current) != null && d.closed && (i(!1), o.current = null, q = null, X(!1, e.tenantId), t == null || t());
|
|
352
348
|
}, 500);
|
|
353
|
-
return () => clearInterval(
|
|
354
|
-
}, [e.tenantId, t]);
|
|
355
|
-
const
|
|
356
|
-
if (
|
|
357
|
-
|
|
349
|
+
return () => clearInterval(c);
|
|
350
|
+
}, [a, e.tenantId, t]);
|
|
351
|
+
const r = L(() => {
|
|
352
|
+
if (o.current && !o.current.closed) {
|
|
353
|
+
o.current.focus();
|
|
358
354
|
return;
|
|
359
355
|
}
|
|
360
|
-
const
|
|
356
|
+
const c = {
|
|
361
357
|
small: { width: 380, height: 520 },
|
|
362
358
|
medium: { width: 440, height: 660 },
|
|
363
359
|
large: { width: 560, height: 780 },
|
|
364
360
|
fullscreen: { width: 700, height: 800 }
|
|
365
|
-
}, { width: d, height: g } =
|
|
361
|
+
}, { width: d, height: g } = c[s], S = (window.screen.width - d) / 2, w = (window.screen.height - g) / 2, p = window.open(
|
|
366
362
|
"",
|
|
367
363
|
"GeoAppsChatPopout",
|
|
368
|
-
`width=${d},height=${g},left=${S},top=${
|
|
364
|
+
`width=${d},height=${g},left=${S},top=${w},resizable=yes,scrollbars=no`
|
|
369
365
|
);
|
|
370
|
-
if (!
|
|
366
|
+
if (!p) {
|
|
371
367
|
console.error("Failed to open popup window. Check if popups are blocked.");
|
|
372
368
|
return;
|
|
373
369
|
}
|
|
374
|
-
|
|
370
|
+
p.__CHAT_CONFIG__ = e, p.document.open(), p.document.write(Ze(e)), p.document.close(), o.current = p, q = p, i(!0), X(!0, e.tenantId);
|
|
375
371
|
}, [e, s]), m = L(() => {
|
|
376
|
-
|
|
377
|
-
}, [e.tenantId]),
|
|
378
|
-
|
|
372
|
+
o.current && !o.current.closed && o.current.close(), o.current = null, q = null, i(!1), X(!1, e.tenantId);
|
|
373
|
+
}, [e.tenantId]), l = L(() => {
|
|
374
|
+
o.current && !o.current.closed && o.current.focus();
|
|
379
375
|
}, []);
|
|
380
376
|
return {
|
|
381
377
|
isPoppedOut: a,
|
|
382
|
-
openPopout:
|
|
378
|
+
openPopout: r,
|
|
383
379
|
closePopout: m,
|
|
384
|
-
focusPopout:
|
|
380
|
+
focusPopout: l
|
|
385
381
|
};
|
|
386
382
|
}
|
|
387
383
|
const Ae = ["bottom-right", "bottom-left", "top-right", "top-left"];
|
|
@@ -400,52 +396,52 @@ function dt({
|
|
|
400
396
|
tenantId: t,
|
|
401
397
|
title: a = "Chat Assistent",
|
|
402
398
|
subtitle: i = "Hoe kan ik je helpen?",
|
|
403
|
-
placeholder:
|
|
404
|
-
greeting:
|
|
399
|
+
placeholder: o = "Typ een bericht...",
|
|
400
|
+
greeting: r,
|
|
405
401
|
primaryColor: m = "#3b82f6",
|
|
406
|
-
position:
|
|
407
|
-
defaultOpen:
|
|
402
|
+
position: l = "bottom-right",
|
|
403
|
+
defaultOpen: c = !1,
|
|
408
404
|
defaultSize: d = "medium",
|
|
409
405
|
tokenStorageKey: g = "geoapps-token",
|
|
410
406
|
onOpen: S,
|
|
411
|
-
onClose:
|
|
412
|
-
onMessageSent:
|
|
407
|
+
onClose: w,
|
|
408
|
+
onMessageSent: p,
|
|
413
409
|
onResponseReceived: b
|
|
414
410
|
}) {
|
|
415
|
-
const { isAuthenticated: x, isLoading: h, recheckAuth: k } = je({ authUrl: s, tokenStorageKey: g }), [
|
|
411
|
+
const { isAuthenticated: x, isLoading: h, recheckAuth: k } = je({ authUrl: s, tokenStorageKey: g }), [f, z] = v(c), [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({
|
|
416
412
|
apiUrl: e,
|
|
417
413
|
tenantId: t,
|
|
418
414
|
tokenStorageKey: g
|
|
419
|
-
}), [C, j] = v(() => N.length > 0), [W,
|
|
415
|
+
}), [C, j] = v(() => N.length > 0), [W, G] = v([]);
|
|
420
416
|
M(() => {
|
|
421
|
-
|
|
422
|
-
}, [
|
|
417
|
+
f && r && !C && N.length === 0 && j(!0);
|
|
418
|
+
}, [f, r, C, N.length]), M(() => {
|
|
423
419
|
N.length > 0 && j(!0);
|
|
424
420
|
}, [N.length]), M(() => {
|
|
425
|
-
C &&
|
|
421
|
+
C && r && N.length === 0 ? G([
|
|
426
422
|
{
|
|
427
423
|
id: "greeting",
|
|
428
424
|
role: "assistant",
|
|
429
|
-
content:
|
|
425
|
+
content: r,
|
|
430
426
|
timestamp: /* @__PURE__ */ new Date()
|
|
431
427
|
}
|
|
432
|
-
]) :
|
|
428
|
+
]) : r && N.length > 0 ? G([
|
|
433
429
|
{
|
|
434
430
|
id: "greeting",
|
|
435
431
|
role: "assistant",
|
|
436
|
-
content:
|
|
432
|
+
content: r,
|
|
437
433
|
timestamp: /* @__PURE__ */ new Date()
|
|
438
434
|
},
|
|
439
435
|
...N
|
|
440
|
-
]) :
|
|
441
|
-
}, [N, C,
|
|
436
|
+
]) : G(N);
|
|
437
|
+
}, [N, C, r]);
|
|
442
438
|
const { isPoppedOut: V, openPopout: de, focusPopout: ue } = ze(
|
|
443
439
|
{
|
|
444
440
|
apiUrl: e,
|
|
445
441
|
tenantId: t,
|
|
446
442
|
title: a,
|
|
447
443
|
subtitle: i,
|
|
448
|
-
placeholder:
|
|
444
|
+
placeholder: o,
|
|
449
445
|
primaryColor: m,
|
|
450
446
|
sessionId: R,
|
|
451
447
|
messages: W,
|
|
@@ -461,28 +457,28 @@ function dt({
|
|
|
461
457
|
A(!1);
|
|
462
458
|
return;
|
|
463
459
|
}
|
|
464
|
-
if (
|
|
465
|
-
|
|
460
|
+
if (f || V)
|
|
461
|
+
Y(E, t), A(!1);
|
|
466
462
|
else {
|
|
467
463
|
const D = Ee(t);
|
|
468
464
|
A(E > D);
|
|
469
465
|
}
|
|
470
|
-
}, [
|
|
471
|
-
const
|
|
466
|
+
}, [f, V, N, t]);
|
|
467
|
+
const oe = () => {
|
|
472
468
|
if (V) {
|
|
473
469
|
ue();
|
|
474
470
|
return;
|
|
475
471
|
}
|
|
476
|
-
const E = !
|
|
472
|
+
const E = !f;
|
|
477
473
|
if (z(E), E) {
|
|
478
474
|
S == null || S();
|
|
479
475
|
const D = N.filter((ie) => ie.role === "assistant").length;
|
|
480
|
-
D > 0 &&
|
|
476
|
+
D > 0 && Y(D, t), A(!1);
|
|
481
477
|
} else
|
|
482
|
-
|
|
478
|
+
w == null || w();
|
|
483
479
|
}, me = async (E) => {
|
|
484
480
|
if (s && !await k()) {
|
|
485
|
-
|
|
481
|
+
G((ve) => [
|
|
486
482
|
...ve,
|
|
487
483
|
{
|
|
488
484
|
id: `auth-error-${Date.now()}`,
|
|
@@ -493,42 +489,42 @@ function dt({
|
|
|
493
489
|
]);
|
|
494
490
|
return;
|
|
495
491
|
}
|
|
496
|
-
|
|
492
|
+
p == null || p(E), await y(E);
|
|
497
493
|
const D = N[N.length - 1];
|
|
498
494
|
(D == null ? void 0 : D.role) === "assistant" && (b == null || b(D.content));
|
|
499
495
|
}, he = async () => {
|
|
500
|
-
await _(), j(!1),
|
|
496
|
+
await _(), j(!1), G([]), A(!1), Y(0, t);
|
|
501
497
|
}, ge = () => {
|
|
502
|
-
I(), j(!1),
|
|
498
|
+
I(), j(!1), G([]), A(!1), Y(0, t);
|
|
503
499
|
}, pe = async (E) => {
|
|
504
500
|
await $(E), j(!0);
|
|
505
501
|
}, fe = (E) => {
|
|
506
502
|
J(E);
|
|
507
503
|
}, we = () => {
|
|
508
504
|
z(!1), de();
|
|
509
|
-
}, { className: be, style: ye } = He(
|
|
505
|
+
}, { className: be, style: ye } = He(l);
|
|
510
506
|
return h || !x ? null : /* @__PURE__ */ u("div", { className: `gcw-widget gcw-container ${be}`, style: ye, children: [
|
|
511
507
|
/* @__PURE__ */ n(
|
|
512
508
|
Ue,
|
|
513
509
|
{
|
|
514
|
-
isOpen:
|
|
515
|
-
onClick:
|
|
510
|
+
isOpen: f,
|
|
511
|
+
onClick: oe,
|
|
516
512
|
primaryColor: m,
|
|
517
|
-
hasUnread: F && !
|
|
513
|
+
hasUnread: F && !f && !V,
|
|
518
514
|
isPoppedOut: V
|
|
519
515
|
}
|
|
520
516
|
),
|
|
521
|
-
|
|
517
|
+
f && !V && /* @__PURE__ */ n(
|
|
522
518
|
Pe,
|
|
523
519
|
{
|
|
524
520
|
title: a,
|
|
525
521
|
subtitle: i,
|
|
526
|
-
placeholder:
|
|
522
|
+
placeholder: o,
|
|
527
523
|
messages: W,
|
|
528
524
|
isLoading: te,
|
|
529
525
|
isLoadingSession: ne,
|
|
530
526
|
onSendMessage: me,
|
|
531
|
-
onClose:
|
|
527
|
+
onClose: oe,
|
|
532
528
|
onClear: he,
|
|
533
529
|
onSizeChange: fe,
|
|
534
530
|
onPopout: we,
|
|
@@ -555,28 +551,28 @@ function Pe({
|
|
|
555
551
|
placeholder: t,
|
|
556
552
|
messages: a,
|
|
557
553
|
isLoading: i,
|
|
558
|
-
isLoadingSession:
|
|
559
|
-
onSendMessage:
|
|
554
|
+
isLoadingSession: o = !1,
|
|
555
|
+
onSendMessage: r,
|
|
560
556
|
onClose: m,
|
|
561
|
-
onClear:
|
|
562
|
-
onSizeChange:
|
|
557
|
+
onClear: l,
|
|
558
|
+
onSizeChange: c,
|
|
563
559
|
onPopout: d,
|
|
564
560
|
onNewSession: g,
|
|
565
561
|
onSelectSession: S,
|
|
566
|
-
onListSessions:
|
|
567
|
-
onDeleteSession:
|
|
562
|
+
onListSessions: w,
|
|
563
|
+
onDeleteSession: p,
|
|
568
564
|
currentSessionId: b,
|
|
569
565
|
primaryColor: x,
|
|
570
566
|
size: h
|
|
571
567
|
}) {
|
|
572
|
-
const [k,
|
|
568
|
+
const [k, f] = v(!1), [z, H] = v(!1), J = () => {
|
|
573
569
|
const F = ["small", "medium", "large", "fullscreen"], N = (F.indexOf(h) + 1) % F.length;
|
|
574
|
-
|
|
570
|
+
c(F[N]);
|
|
575
571
|
};
|
|
576
572
|
return /* @__PURE__ */ u("div", { className: `gcw-window ${We[h]}`, children: [
|
|
577
573
|
/* @__PURE__ */ u("div", { className: "gcw-header", style: { backgroundColor: x }, children: [
|
|
578
574
|
/* @__PURE__ */ u("div", { className: "gcw-header__left", children: [
|
|
579
|
-
/* @__PURE__ */ n("div", { className: "gcw-header__avatar", children: /* @__PURE__ */ n(
|
|
575
|
+
/* @__PURE__ */ n("div", { className: "gcw-header__avatar", children: /* @__PURE__ */ n(ot, { className: "gcw-header__avatar-icon" }) }),
|
|
580
576
|
/* @__PURE__ */ u("div", { className: "gcw-header__info", children: [
|
|
581
577
|
/* @__PURE__ */ n("h3", { className: "gcw-header__title", children: e }),
|
|
582
578
|
/* @__PURE__ */ n("p", { className: "gcw-header__subtitle", children: s })
|
|
@@ -591,9 +587,9 @@ function Pe({
|
|
|
591
587
|
onPopout: d,
|
|
592
588
|
onClear: () => H(!0),
|
|
593
589
|
onNewSession: () => {
|
|
594
|
-
g(),
|
|
590
|
+
g(), f(!1);
|
|
595
591
|
},
|
|
596
|
-
onShowHistory: () =>
|
|
592
|
+
onShowHistory: () => f(!0)
|
|
597
593
|
}
|
|
598
594
|
),
|
|
599
595
|
/* @__PURE__ */ n(
|
|
@@ -602,7 +598,7 @@ function Pe({
|
|
|
602
598
|
onClick: m,
|
|
603
599
|
className: "gcw-header__btn",
|
|
604
600
|
title: "Sluiten",
|
|
605
|
-
children: /* @__PURE__ */ n(
|
|
601
|
+
children: /* @__PURE__ */ n(rt, { className: "gcw-header__btn-icon" })
|
|
606
602
|
}
|
|
607
603
|
)
|
|
608
604
|
] })
|
|
@@ -616,7 +612,7 @@ function Pe({
|
|
|
616
612
|
cancelLabel: "Annuleren",
|
|
617
613
|
variant: "danger",
|
|
618
614
|
onConfirm: () => {
|
|
619
|
-
H(!1),
|
|
615
|
+
H(!1), l();
|
|
620
616
|
},
|
|
621
617
|
onCancel: () => H(!1)
|
|
622
618
|
}
|
|
@@ -625,20 +621,20 @@ function Pe({
|
|
|
625
621
|
Xe,
|
|
626
622
|
{
|
|
627
623
|
currentSessionId: b,
|
|
628
|
-
onBack: () =>
|
|
624
|
+
onBack: () => f(!1),
|
|
629
625
|
onSelectSession: S,
|
|
630
626
|
onNewSession: g,
|
|
631
|
-
onListSessions:
|
|
632
|
-
onDeleteSession:
|
|
627
|
+
onListSessions: w,
|
|
628
|
+
onDeleteSession: p,
|
|
633
629
|
primaryColor: x
|
|
634
630
|
}
|
|
635
631
|
) : /* @__PURE__ */ u(ke, { children: [
|
|
636
632
|
/* @__PURE__ */ n(
|
|
637
|
-
|
|
633
|
+
Ge,
|
|
638
634
|
{
|
|
639
635
|
messages: a,
|
|
640
636
|
isLoading: i,
|
|
641
|
-
isLoadingSession:
|
|
637
|
+
isLoadingSession: o,
|
|
642
638
|
primaryColor: x
|
|
643
639
|
}
|
|
644
640
|
),
|
|
@@ -647,7 +643,7 @@ function Pe({
|
|
|
647
643
|
{
|
|
648
644
|
placeholder: t,
|
|
649
645
|
isLoading: i,
|
|
650
|
-
onSendMessage:
|
|
646
|
+
onSendMessage: r,
|
|
651
647
|
primaryColor: x
|
|
652
648
|
}
|
|
653
649
|
)
|
|
@@ -663,7 +659,7 @@ function Fe(e) {
|
|
|
663
659
|
function Re(e, s) {
|
|
664
660
|
return e.length <= s ? e : e.slice(0, s - 3) + "...";
|
|
665
661
|
}
|
|
666
|
-
function
|
|
662
|
+
function Ke({ message: e, primaryColor: s }) {
|
|
667
663
|
const t = e.role === "user", a = t ? "user" : "assistant";
|
|
668
664
|
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
665
|
/* @__PURE__ */ n(
|
|
@@ -674,7 +670,7 @@ function Ge({ message: e, primaryColor: s }) {
|
|
|
674
670
|
children: /* @__PURE__ */ n(Ye, { content: e.content, className: "gcw-content" })
|
|
675
671
|
}
|
|
676
672
|
),
|
|
677
|
-
e.sources && e.sources.length > 0 && /* @__PURE__ */ n("div", { className: "gcw-sources", children: e.sources.slice(0, 3).map((i,
|
|
673
|
+
e.sources && e.sources.length > 0 && /* @__PURE__ */ n("div", { className: "gcw-sources", children: e.sources.slice(0, 3).map((i, o) => /* @__PURE__ */ u(
|
|
678
674
|
"a",
|
|
679
675
|
{
|
|
680
676
|
href: i.url,
|
|
@@ -686,17 +682,17 @@ function Ge({ message: e, primaryColor: s }) {
|
|
|
686
682
|
Re(i.title, 25)
|
|
687
683
|
]
|
|
688
684
|
},
|
|
689
|
-
|
|
685
|
+
o
|
|
690
686
|
)) }),
|
|
691
687
|
/* @__PURE__ */ n("span", { className: "gcw-bubble__timestamp", children: Fe(e.timestamp) })
|
|
692
688
|
] }) });
|
|
693
689
|
}
|
|
694
|
-
function
|
|
695
|
-
var
|
|
690
|
+
function Ge({ messages: e, isLoading: s, isLoadingSession: t = !1, primaryColor: a }) {
|
|
691
|
+
var o;
|
|
696
692
|
const i = O(null);
|
|
697
693
|
return M(() => {
|
|
698
|
-
var
|
|
699
|
-
(
|
|
694
|
+
var r;
|
|
695
|
+
(r = i.current) == null || r.scrollIntoView({ behavior: "smooth" });
|
|
700
696
|
}, [e, s]), t ? /* @__PURE__ */ n("div", { className: "gcw-empty", children: /* @__PURE__ */ u("div", { className: "gcw-session-loading", children: [
|
|
701
697
|
/* @__PURE__ */ n("div", { className: "gcw-session-loading__spinner" }),
|
|
702
698
|
/* @__PURE__ */ n("p", { className: "gcw-empty__text", children: "Chatgeschiedenis laden..." })
|
|
@@ -704,37 +700,37 @@ function Ke({ messages: e, isLoading: s, isLoadingSession: t = !1, primaryColor:
|
|
|
704
700
|
/* @__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
701
|
/* @__PURE__ */ n("p", { className: "gcw-empty__text", children: "Begin een gesprek door hieronder een bericht te typen" })
|
|
706
702
|
] }) : /* @__PURE__ */ u("div", { className: "gcw-messages", children: [
|
|
707
|
-
e.map((
|
|
708
|
-
|
|
703
|
+
e.map((r) => /* @__PURE__ */ n(
|
|
704
|
+
Ke,
|
|
709
705
|
{
|
|
710
|
-
message:
|
|
706
|
+
message: r,
|
|
711
707
|
primaryColor: a
|
|
712
708
|
},
|
|
713
|
-
|
|
709
|
+
r.id
|
|
714
710
|
)),
|
|
715
|
-
s && ((
|
|
711
|
+
s && ((o = e[e.length - 1]) == null ? void 0 : o.role) !== "assistant" && /* @__PURE__ */ n(Qe, {}),
|
|
716
712
|
/* @__PURE__ */ n("div", { ref: i })
|
|
717
713
|
] });
|
|
718
714
|
}
|
|
719
715
|
function Ve({ placeholder: e, isLoading: s, onSendMessage: t, primaryColor: a }) {
|
|
720
|
-
const [i,
|
|
716
|
+
const [i, o] = v(""), r = O(null);
|
|
721
717
|
M(() => {
|
|
722
|
-
const
|
|
723
|
-
|
|
718
|
+
const c = r.current;
|
|
719
|
+
c && (c.style.height = "auto", c.style.height = `${Math.min(c.scrollHeight, 120)}px`);
|
|
724
720
|
}, [i]);
|
|
725
721
|
const m = () => {
|
|
726
|
-
i.trim() && !s && (t(i),
|
|
722
|
+
i.trim() && !s && (t(i), o(""), r.current && (r.current.style.height = "auto"));
|
|
727
723
|
};
|
|
728
724
|
return /* @__PURE__ */ u("div", { className: "gcw-input-area", children: [
|
|
729
725
|
/* @__PURE__ */ u("div", { className: "gcw-input-row", children: [
|
|
730
726
|
/* @__PURE__ */ n(
|
|
731
727
|
"textarea",
|
|
732
728
|
{
|
|
733
|
-
ref:
|
|
729
|
+
ref: r,
|
|
734
730
|
value: i,
|
|
735
|
-
onChange: (
|
|
736
|
-
onKeyDown: (
|
|
737
|
-
|
|
731
|
+
onChange: (c) => o(c.target.value),
|
|
732
|
+
onKeyDown: (c) => {
|
|
733
|
+
c.key === "Enter" && !c.shiftKey && (c.preventDefault(), m());
|
|
738
734
|
},
|
|
739
735
|
placeholder: e,
|
|
740
736
|
disabled: s,
|
|
@@ -777,8 +773,8 @@ function Ue({ isOpen: e, onClick: s, primaryColor: t, hasUnread: a, isPoppedOut:
|
|
|
777
773
|
);
|
|
778
774
|
}
|
|
779
775
|
function Je(e) {
|
|
780
|
-
const s = new Date(e), a = (/* @__PURE__ */ new Date()).getTime() - s.getTime(), i = Math.floor(a / 6e4),
|
|
781
|
-
return i < 1 ? "Zojuist" : i < 60 ? `${i} min geleden` :
|
|
776
|
+
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);
|
|
777
|
+
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" });
|
|
782
778
|
}
|
|
783
779
|
function Xe({
|
|
784
780
|
currentSessionId: e,
|
|
@@ -786,29 +782,29 @@ function Xe({
|
|
|
786
782
|
onSelectSession: t,
|
|
787
783
|
onNewSession: a,
|
|
788
784
|
onDeleteSession: i,
|
|
789
|
-
onListSessions:
|
|
790
|
-
primaryColor:
|
|
785
|
+
onListSessions: o,
|
|
786
|
+
primaryColor: r
|
|
791
787
|
}) {
|
|
792
|
-
const [m,
|
|
788
|
+
const [m, l] = v([]), [c, d] = v(!0), [g, S] = v(null);
|
|
793
789
|
M(() => {
|
|
794
790
|
let h = !1;
|
|
795
|
-
return d(!0),
|
|
796
|
-
h || (
|
|
791
|
+
return d(!0), o().then((k) => {
|
|
792
|
+
h || (l(k), d(!1));
|
|
797
793
|
}), () => {
|
|
798
794
|
h = !0;
|
|
799
795
|
};
|
|
800
|
-
}, [
|
|
801
|
-
const
|
|
796
|
+
}, [o]);
|
|
797
|
+
const w = (h) => {
|
|
802
798
|
t(h), s();
|
|
803
|
-
},
|
|
799
|
+
}, p = (h, k) => {
|
|
804
800
|
h.stopPropagation(), S(k);
|
|
805
801
|
}, b = async () => {
|
|
806
802
|
if (!g) return;
|
|
807
803
|
const h = g;
|
|
808
|
-
S(null), await i(h),
|
|
804
|
+
S(null), await i(h), l((k) => k.filter((f) => f.id !== h));
|
|
809
805
|
};
|
|
810
806
|
return /* @__PURE__ */ u("div", { className: "gcw-history", children: [
|
|
811
|
-
/* @__PURE__ */ u("div", { className: "gcw-history__header", style: { backgroundColor:
|
|
807
|
+
/* @__PURE__ */ u("div", { className: "gcw-history__header", style: { backgroundColor: r }, children: [
|
|
812
808
|
/* @__PURE__ */ n(
|
|
813
809
|
"button",
|
|
814
810
|
{
|
|
@@ -831,19 +827,19 @@ function Xe({
|
|
|
831
827
|
}
|
|
832
828
|
)
|
|
833
829
|
] }),
|
|
834
|
-
/* @__PURE__ */ n("div", { className: "gcw-history__list", children:
|
|
830
|
+
/* @__PURE__ */ n("div", { className: "gcw-history__list", children: c ? /* @__PURE__ */ u("div", { className: "gcw-history__loading", children: [
|
|
835
831
|
/* @__PURE__ */ n("div", { className: "gcw-session-loading__spinner" }),
|
|
836
832
|
/* @__PURE__ */ n("span", { children: "Gesprekken laden..." })
|
|
837
833
|
] }) : m.length === 0 ? /* @__PURE__ */ n("div", { className: "gcw-history__empty", children: /* @__PURE__ */ n("p", { children: "Geen eerdere gesprekken" }) }) : m.map((h) => /* @__PURE__ */ u(
|
|
838
834
|
"div",
|
|
839
835
|
{
|
|
840
836
|
className: `gcw-history__item ${h.id === e ? "gcw-history__item--active" : ""}`,
|
|
841
|
-
onClick: () =>
|
|
842
|
-
style: h.id === e ? { borderLeftColor:
|
|
837
|
+
onClick: () => w(h.id),
|
|
838
|
+
style: h.id === e ? { borderLeftColor: r } : void 0,
|
|
843
839
|
role: "button",
|
|
844
840
|
tabIndex: 0,
|
|
845
841
|
onKeyDown: (k) => {
|
|
846
|
-
k.key === "Enter" &&
|
|
842
|
+
k.key === "Enter" && w(h.id);
|
|
847
843
|
},
|
|
848
844
|
children: [
|
|
849
845
|
/* @__PURE__ */ u("div", { className: "gcw-history__item-content", children: [
|
|
@@ -860,7 +856,7 @@ function Xe({
|
|
|
860
856
|
"button",
|
|
861
857
|
{
|
|
862
858
|
className: "gcw-history__item-delete",
|
|
863
|
-
onClick: (k) =>
|
|
859
|
+
onClick: (k) => p(k, h.id),
|
|
864
860
|
title: "Verwijder gesprek",
|
|
865
861
|
children: /* @__PURE__ */ n(le, { className: "gcw-history__item-delete-icon" })
|
|
866
862
|
}
|
|
@@ -889,31 +885,31 @@ function ae({
|
|
|
889
885
|
confirmLabel: t = "Bevestigen",
|
|
890
886
|
cancelLabel: a = "Annuleren",
|
|
891
887
|
onConfirm: i,
|
|
892
|
-
onCancel:
|
|
893
|
-
variant:
|
|
888
|
+
onCancel: o,
|
|
889
|
+
variant: r = "default"
|
|
894
890
|
}) {
|
|
895
|
-
const m = O(null),
|
|
891
|
+
const m = O(null), l = O(null);
|
|
896
892
|
return M(() => {
|
|
897
893
|
var d;
|
|
898
|
-
(d =
|
|
894
|
+
(d = l.current) == null || d.focus();
|
|
899
895
|
}, []), M(() => {
|
|
900
896
|
const d = (g) => {
|
|
901
|
-
g.key === "Escape" &&
|
|
897
|
+
g.key === "Escape" && o();
|
|
902
898
|
};
|
|
903
899
|
return document.addEventListener("keydown", d), () => document.removeEventListener("keydown", d);
|
|
904
|
-
}, [
|
|
905
|
-
d.target === m.current &&
|
|
900
|
+
}, [o]), /* @__PURE__ */ n("div", { className: "gcw-modal-overlay", ref: m, onClick: (d) => {
|
|
901
|
+
d.target === m.current && o();
|
|
906
902
|
}, children: /* @__PURE__ */ u("div", { className: "gcw-modal", role: "dialog", "aria-modal": "true", "aria-labelledby": "gcw-modal-title", children: [
|
|
907
903
|
/* @__PURE__ */ n("h4", { className: "gcw-modal__title", id: "gcw-modal-title", children: e }),
|
|
908
904
|
/* @__PURE__ */ n("p", { className: "gcw-modal__message", children: s }),
|
|
909
905
|
/* @__PURE__ */ u("div", { className: "gcw-modal__actions", children: [
|
|
910
|
-
/* @__PURE__ */ n("button", { className: "gcw-modal__btn gcw-modal__btn--cancel", onClick:
|
|
906
|
+
/* @__PURE__ */ n("button", { className: "gcw-modal__btn gcw-modal__btn--cancel", onClick: o, children: a }),
|
|
911
907
|
/* @__PURE__ */ n(
|
|
912
908
|
"button",
|
|
913
909
|
{
|
|
914
|
-
className: `gcw-modal__btn gcw-modal__btn--confirm ${
|
|
910
|
+
className: `gcw-modal__btn gcw-modal__btn--confirm ${r === "danger" ? "gcw-modal__btn--danger" : ""}`,
|
|
915
911
|
onClick: i,
|
|
916
|
-
ref:
|
|
912
|
+
ref: l,
|
|
917
913
|
children: t
|
|
918
914
|
}
|
|
919
915
|
)
|
|
@@ -931,69 +927,69 @@ function qe(e) {
|
|
|
931
927
|
let a = null;
|
|
932
928
|
const i = () => {
|
|
933
929
|
a && (a.type === "ul" ? t.push(
|
|
934
|
-
/* @__PURE__ */ n("ul", { className: "gcw-md-list gcw-md-list--ul", children: a.items.map((
|
|
930
|
+
/* @__PURE__ */ n("ul", { className: "gcw-md-list gcw-md-list--ul", children: a.items.map((o, r) => /* @__PURE__ */ n("li", { className: "gcw-md-list__item", children: o }, r)) }, `list-${t.length}`)
|
|
935
931
|
) : t.push(
|
|
936
|
-
/* @__PURE__ */ n("ol", { className: "gcw-md-list gcw-md-list--ol", children: a.items.map((
|
|
932
|
+
/* @__PURE__ */ n("ol", { className: "gcw-md-list gcw-md-list--ol", children: a.items.map((o, r) => /* @__PURE__ */ n("li", { className: "gcw-md-list__item", children: o }, r)) }, `list-${t.length}`)
|
|
937
933
|
), a = null);
|
|
938
934
|
};
|
|
939
|
-
for (let
|
|
940
|
-
const
|
|
941
|
-
if (
|
|
935
|
+
for (let o = 0; o < s.length; o++) {
|
|
936
|
+
const r = s[o];
|
|
937
|
+
if (r.startsWith("#### ")) {
|
|
942
938
|
i(), t.push(
|
|
943
|
-
/* @__PURE__ */ n("h5", { className: "gcw-md-heading gcw-md-heading--h5", children:
|
|
939
|
+
/* @__PURE__ */ n("h5", { className: "gcw-md-heading gcw-md-heading--h5", children: K(r.slice(5)) }, o)
|
|
944
940
|
);
|
|
945
941
|
continue;
|
|
946
942
|
}
|
|
947
|
-
if (
|
|
943
|
+
if (r.startsWith("### ")) {
|
|
948
944
|
i(), t.push(
|
|
949
|
-
/* @__PURE__ */ n("h4", { className: "gcw-md-heading gcw-md-heading--h4", children:
|
|
945
|
+
/* @__PURE__ */ n("h4", { className: "gcw-md-heading gcw-md-heading--h4", children: K(r.slice(4)) }, o)
|
|
950
946
|
);
|
|
951
947
|
continue;
|
|
952
948
|
}
|
|
953
|
-
if (
|
|
949
|
+
if (r.startsWith("## ")) {
|
|
954
950
|
i(), t.push(
|
|
955
|
-
/* @__PURE__ */ n("h3", { className: "gcw-md-heading gcw-md-heading--h3", children:
|
|
951
|
+
/* @__PURE__ */ n("h3", { className: "gcw-md-heading gcw-md-heading--h3", children: K(r.slice(3)) }, o)
|
|
956
952
|
);
|
|
957
953
|
continue;
|
|
958
954
|
}
|
|
959
|
-
if (
|
|
955
|
+
if (r.startsWith("# ")) {
|
|
960
956
|
i(), t.push(
|
|
961
|
-
/* @__PURE__ */ n("h2", { className: "gcw-md-heading gcw-md-heading--h2", children:
|
|
957
|
+
/* @__PURE__ */ n("h2", { className: "gcw-md-heading gcw-md-heading--h2", children: K(r.slice(2)) }, o)
|
|
962
958
|
);
|
|
963
959
|
continue;
|
|
964
960
|
}
|
|
965
|
-
const m =
|
|
961
|
+
const m = r.match(/^[\s]*[-*•]\s+(.+)/);
|
|
966
962
|
if (m) {
|
|
967
|
-
(!a || a.type !== "ul") && (i(), a = { type: "ul", items: [] }), a.items.push(
|
|
963
|
+
(!a || a.type !== "ul") && (i(), a = { type: "ul", items: [] }), a.items.push(K(m[1]));
|
|
968
964
|
continue;
|
|
969
965
|
}
|
|
970
|
-
const
|
|
971
|
-
if (
|
|
972
|
-
(!a || a.type !== "ol") && (i(), a = { type: "ol", items: [] }), a.items.push(
|
|
966
|
+
const l = r.match(/^[\s]*(\d+)[.)]\s+(.+)/);
|
|
967
|
+
if (l) {
|
|
968
|
+
(!a || a.type !== "ol") && (i(), a = { type: "ol", items: [] }), a.items.push(K(l[2]));
|
|
973
969
|
continue;
|
|
974
970
|
}
|
|
975
|
-
if (
|
|
971
|
+
if (r.startsWith("```")) {
|
|
976
972
|
i();
|
|
977
|
-
const
|
|
978
|
-
for (
|
|
979
|
-
|
|
973
|
+
const c = [];
|
|
974
|
+
for (o++; o < s.length && !s[o].startsWith("```"); )
|
|
975
|
+
c.push(s[o]), o++;
|
|
980
976
|
t.push(
|
|
981
|
-
/* @__PURE__ */ n("pre", { className: "gcw-md-code-block", children: /* @__PURE__ */ n("code", { children:
|
|
977
|
+
/* @__PURE__ */ n("pre", { className: "gcw-md-code-block", children: /* @__PURE__ */ n("code", { children: c.join(`
|
|
982
978
|
`) }) }, `code-${t.length}`)
|
|
983
979
|
);
|
|
984
980
|
continue;
|
|
985
981
|
}
|
|
986
|
-
if (
|
|
982
|
+
if (r.trim() === "") {
|
|
987
983
|
i();
|
|
988
984
|
continue;
|
|
989
985
|
}
|
|
990
986
|
i(), t.push(
|
|
991
|
-
/* @__PURE__ */ n("p", { className: "gcw-md-paragraph", children:
|
|
987
|
+
/* @__PURE__ */ n("p", { className: "gcw-md-paragraph", children: K(r) }, o)
|
|
992
988
|
);
|
|
993
989
|
}
|
|
994
990
|
return i(), t;
|
|
995
991
|
}
|
|
996
|
-
function
|
|
992
|
+
function K(e) {
|
|
997
993
|
if (!e) return null;
|
|
998
994
|
const s = [];
|
|
999
995
|
let t = e, a = 0;
|
|
@@ -1003,16 +999,16 @@ function G(e) {
|
|
|
1003
999
|
s.push(/* @__PURE__ */ n("strong", { className: "gcw-md-bold", children: i[1] }, a++)), t = t.slice(i[0].length);
|
|
1004
1000
|
continue;
|
|
1005
1001
|
}
|
|
1006
|
-
const
|
|
1007
|
-
if (
|
|
1008
|
-
s.push(/* @__PURE__ */ n("em", { className: "gcw-md-italic", children:
|
|
1002
|
+
const o = t.match(/^\*([^*]+?)\*/);
|
|
1003
|
+
if (o) {
|
|
1004
|
+
s.push(/* @__PURE__ */ n("em", { className: "gcw-md-italic", children: o[1] }, a++)), t = t.slice(o[0].length);
|
|
1009
1005
|
continue;
|
|
1010
1006
|
}
|
|
1011
|
-
const
|
|
1012
|
-
if (
|
|
1007
|
+
const r = t.match(/^`([^`]+)`/);
|
|
1008
|
+
if (r) {
|
|
1013
1009
|
s.push(
|
|
1014
|
-
/* @__PURE__ */ n("code", { className: "gcw-md-code", children:
|
|
1015
|
-
), t = t.slice(
|
|
1010
|
+
/* @__PURE__ */ n("code", { className: "gcw-md-code", children: r[1] }, a++)
|
|
1011
|
+
), t = t.slice(r[0].length);
|
|
1016
1012
|
continue;
|
|
1017
1013
|
}
|
|
1018
1014
|
const m = t.match(/^\[([^\]]+)\]\(([^)]+)\)/);
|
|
@@ -1032,11 +1028,11 @@ function G(e) {
|
|
|
1032
1028
|
), t = t.slice(m[0].length);
|
|
1033
1029
|
continue;
|
|
1034
1030
|
}
|
|
1035
|
-
const
|
|
1036
|
-
if (
|
|
1031
|
+
const l = t.search(/[\*`\[]/);
|
|
1032
|
+
if (l === -1) {
|
|
1037
1033
|
s.push(t);
|
|
1038
1034
|
break;
|
|
1039
|
-
} else
|
|
1035
|
+
} else l === 0 ? (s.push(t[0]), t = t.slice(1)) : (s.push(t.slice(0, l)), t = t.slice(l));
|
|
1040
1036
|
}
|
|
1041
1037
|
return s.length === 1 ? s[0] : s;
|
|
1042
1038
|
}
|
|
@@ -1642,36 +1638,36 @@ const et = {
|
|
|
1642
1638
|
large: "Groot",
|
|
1643
1639
|
fullscreen: "Volledig scherm"
|
|
1644
1640
|
};
|
|
1645
|
-
function tt({ size: e, onCycleSize: s, onPopout: t, onClear: a, onNewSession: i, onShowHistory:
|
|
1646
|
-
const [
|
|
1641
|
+
function tt({ size: e, onCycleSize: s, onPopout: t, onClear: a, onNewSession: i, onShowHistory: o }) {
|
|
1642
|
+
const [r, m] = v(!1), l = O(null);
|
|
1647
1643
|
M(() => {
|
|
1648
|
-
if (!
|
|
1644
|
+
if (!r) return;
|
|
1649
1645
|
const d = (S) => {
|
|
1650
|
-
|
|
1646
|
+
l.current && !l.current.contains(S.target) && m(!1);
|
|
1651
1647
|
}, g = setTimeout(() => {
|
|
1652
1648
|
document.addEventListener("click", d);
|
|
1653
1649
|
}, 0);
|
|
1654
1650
|
return () => {
|
|
1655
1651
|
clearTimeout(g), document.removeEventListener("click", d);
|
|
1656
1652
|
};
|
|
1657
|
-
}, [
|
|
1658
|
-
if (!
|
|
1653
|
+
}, [r]), M(() => {
|
|
1654
|
+
if (!r) return;
|
|
1659
1655
|
const d = (g) => {
|
|
1660
1656
|
g.key === "Escape" && m(!1);
|
|
1661
1657
|
};
|
|
1662
1658
|
return document.addEventListener("keydown", d), () => document.removeEventListener("keydown", d);
|
|
1663
|
-
}, [
|
|
1664
|
-
const
|
|
1659
|
+
}, [r]);
|
|
1660
|
+
const c = (d) => {
|
|
1665
1661
|
d(), m(!1);
|
|
1666
1662
|
};
|
|
1667
|
-
return /* @__PURE__ */ u("div", { className: "gcw-header-menu", ref:
|
|
1663
|
+
return /* @__PURE__ */ u("div", { className: "gcw-header-menu", ref: l, children: [
|
|
1668
1664
|
/* @__PURE__ */ n(
|
|
1669
1665
|
"button",
|
|
1670
1666
|
{
|
|
1671
|
-
onClick: () => m(!
|
|
1667
|
+
onClick: () => m(!r),
|
|
1672
1668
|
className: "gcw-header__btn",
|
|
1673
1669
|
title: "Menu",
|
|
1674
|
-
"aria-expanded":
|
|
1670
|
+
"aria-expanded": r,
|
|
1675
1671
|
"aria-haspopup": "true",
|
|
1676
1672
|
children: /* @__PURE__ */ u("svg", { className: "gcw-header__btn-icon", fill: "currentColor", viewBox: "0 0 24 24", children: [
|
|
1677
1673
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "5", r: "2" }),
|
|
@@ -1680,12 +1676,12 @@ function tt({ size: e, onCycleSize: s, onPopout: t, onClear: a, onNewSession: i,
|
|
|
1680
1676
|
] })
|
|
1681
1677
|
}
|
|
1682
1678
|
),
|
|
1683
|
-
|
|
1679
|
+
r && /* @__PURE__ */ u("div", { className: "gcw-header-menu__dropdown", role: "menu", children: [
|
|
1684
1680
|
/* @__PURE__ */ u(
|
|
1685
1681
|
"button",
|
|
1686
1682
|
{
|
|
1687
1683
|
className: "gcw-header-menu__item",
|
|
1688
|
-
onClick: () =>
|
|
1684
|
+
onClick: () => c(i),
|
|
1689
1685
|
role: "menuitem",
|
|
1690
1686
|
children: [
|
|
1691
1687
|
/* @__PURE__ */ n(ce, { className: "gcw-header-menu__icon" }),
|
|
@@ -1697,7 +1693,7 @@ function tt({ size: e, onCycleSize: s, onPopout: t, onClear: a, onNewSession: i,
|
|
|
1697
1693
|
"button",
|
|
1698
1694
|
{
|
|
1699
1695
|
className: "gcw-header-menu__item",
|
|
1700
|
-
onClick: () =>
|
|
1696
|
+
onClick: () => c(o),
|
|
1701
1697
|
role: "menuitem",
|
|
1702
1698
|
children: [
|
|
1703
1699
|
/* @__PURE__ */ n(it, { className: "gcw-header-menu__icon" }),
|
|
@@ -1710,7 +1706,7 @@ function tt({ size: e, onCycleSize: s, onPopout: t, onClear: a, onNewSession: i,
|
|
|
1710
1706
|
"button",
|
|
1711
1707
|
{
|
|
1712
1708
|
className: "gcw-header-menu__item",
|
|
1713
|
-
onClick: () =>
|
|
1709
|
+
onClick: () => c(s),
|
|
1714
1710
|
role: "menuitem",
|
|
1715
1711
|
children: [
|
|
1716
1712
|
/* @__PURE__ */ n(nt, { size: e, className: "gcw-header-menu__icon" }),
|
|
@@ -1725,7 +1721,7 @@ function tt({ size: e, onCycleSize: s, onPopout: t, onClear: a, onNewSession: i,
|
|
|
1725
1721
|
"button",
|
|
1726
1722
|
{
|
|
1727
1723
|
className: "gcw-header-menu__item",
|
|
1728
|
-
onClick: () =>
|
|
1724
|
+
onClick: () => c(t),
|
|
1729
1725
|
role: "menuitem",
|
|
1730
1726
|
children: [
|
|
1731
1727
|
/* @__PURE__ */ n(st, { className: "gcw-header-menu__icon" }),
|
|
@@ -1738,7 +1734,7 @@ function tt({ size: e, onCycleSize: s, onPopout: t, onClear: a, onNewSession: i,
|
|
|
1738
1734
|
"button",
|
|
1739
1735
|
{
|
|
1740
1736
|
className: "gcw-header-menu__item gcw-header-menu__item--danger",
|
|
1741
|
-
onClick: () =>
|
|
1737
|
+
onClick: () => c(a),
|
|
1742
1738
|
role: "menuitem",
|
|
1743
1739
|
children: [
|
|
1744
1740
|
/* @__PURE__ */ n(le, { className: "gcw-header-menu__icon" }),
|
|
@@ -1755,13 +1751,13 @@ function nt({ size: e, className: s }) {
|
|
|
1755
1751
|
function st({ className: e }) {
|
|
1756
1752
|
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" }) });
|
|
1757
1753
|
}
|
|
1758
|
-
function
|
|
1754
|
+
function rt({ className: e }) {
|
|
1759
1755
|
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" }) });
|
|
1760
1756
|
}
|
|
1761
1757
|
function le({ className: e }) {
|
|
1762
1758
|
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" }) });
|
|
1763
1759
|
}
|
|
1764
|
-
function
|
|
1760
|
+
function ot({ className: e }) {
|
|
1765
1761
|
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" }) });
|
|
1766
1762
|
}
|
|
1767
1763
|
function ce({ className: e }) {
|
|
@@ -1775,17 +1771,17 @@ function at({ className: e }) {
|
|
|
1775
1771
|
}
|
|
1776
1772
|
export {
|
|
1777
1773
|
at as ArrowLeftIcon,
|
|
1778
|
-
|
|
1779
|
-
|
|
1774
|
+
Ke as ChatBubble,
|
|
1775
|
+
ot as ChatIcon,
|
|
1780
1776
|
dt as ChatWidget,
|
|
1781
1777
|
Pe as ChatWindow,
|
|
1782
|
-
|
|
1778
|
+
rt as CloseIcon,
|
|
1783
1779
|
ae as ConfirmModal,
|
|
1784
1780
|
tt as HeaderMenu,
|
|
1785
1781
|
it as HistoryIcon,
|
|
1786
1782
|
Ye as MarkdownRenderer,
|
|
1787
1783
|
Ve as MessageInput,
|
|
1788
|
-
|
|
1784
|
+
Ge as MessageList,
|
|
1789
1785
|
ce as NewChatIcon,
|
|
1790
1786
|
st as PopoutIcon,
|
|
1791
1787
|
nt as ResizeIcon,
|
|
@@ -1799,8 +1795,8 @@ export {
|
|
|
1799
1795
|
Le as loadPopoutState,
|
|
1800
1796
|
Ee as loadSeenAssistantCount,
|
|
1801
1797
|
Ie as loadSessionId,
|
|
1802
|
-
|
|
1803
|
-
|
|
1798
|
+
X as savePopoutState,
|
|
1799
|
+
Y as saveSeenAssistantCount,
|
|
1804
1800
|
Me as saveSessionId,
|
|
1805
1801
|
Ce as subscribeToSessionChanges,
|
|
1806
1802
|
je as useAuth,
|