diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 9a528fe..18e9f06 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.17.1" + ".": "1.18.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index ad97b61..8c6a2f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,36 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.18.0](https://github.com/PMDevSolutions/Claudius/compare/v1.17.1...v1.18.0) (2026-09-29) + + +### Features + +* **cli:** widget.citations in client configs, snippets, and the schema ([806c0ef](https://github.com/PMDevSolutions/Claudius/commit/806c0ef71ae0530f3001b4f6c415ca476a608320)) +* inline citations and source cards for RAG results ([c899b84](https://github.com/PMDevSolutions/Claudius/commit/c899b84548bb2d1e942f70465279ef632aa4e0a9)) +* **widget:** citations option on the component, ClaudiusConfig, and <claudius-chat> ([a701de9](https://github.com/PMDevSolutions/Claudius/commit/a701de954e8cbc64e38b45b37a3978078215848c)) +* **widget:** collapsible source-card footer ([bdb9246](https://github.com/PMDevSolutions/Claudius/commit/bdb924671bee4667155bb027ebcc63062ec7de18)) +* **widget:** keep announced sources on the streaming reply ([0a45385](https://github.com/PMDevSolutions/Claudius/commit/0a45385989eaee325557367b7abd129b1f24a49b)) +* **widget:** pure helpers for citation markers and the citations option ([d7a8b17](https://github.com/PMDevSolutions/Claudius/commit/d7a8b1793c9776f43c930b7b95fccf05c9cbf150)) +* **widget:** render citation markers as chips with a source-card footer ([9408779](https://github.com/PMDevSolutions/Claudius/commit/94087797f1a8810ac1006bb90fc657898461ad11)) +* **widget:** request citations and read the early sources event ([67ab530](https://github.com/PMDevSolutions/Claudius/commit/67ab530fb6f7137c0b6401e79350e83196ecde15)) +* **widget:** strings for citation chips and the sources footer ([58e282a](https://github.com/PMDevSolutions/Claudius/commit/58e282adddb38380cabdeb55b471490cd771a77d)) +* **widget:** wire citations through the chat window and its live region ([0d6d131](https://github.com/PMDevSolutions/Claudius/commit/0d6d131daccffffe58e17cb81c0288e0269b8e8a)) +* **worker:** announce RAG sources before the first streamed chunk ([df5cc59](https://github.com/PMDevSolutions/Claudius/commit/df5cc59987d205415530b4a2e4832cfc5933d28d)) +* **worker:** attach a snippet to each RAG source ([b4fd0e6](https://github.com/PMDevSolutions/Claudius/commit/b4fd0e63a48b9860190cdaaee31314e0178ef8d8)) +* **worker:** number RAG excerpts and ask for citations when the request opts in ([10fdcf2](https://github.com/PMDevSolutions/Claudius/commit/10fdcf2d1a75bbe445789e6a287b94d02f84d8b4)) + + +### Bug Fixes + +* **widget:** detach a citation marker glued to the end of a URL ([659b71c](https://github.com/PMDevSolutions/Claudius/commit/659b71c62d22d371325dec4301c1b1d8f755b711)) +* **widget:** do not replay the last reveal when maxSources changes ([b6fdda0](https://github.com/PMDevSolutions/Claudius/commit/b6fdda00c79b5851a24718d80015970bc43e3bfd)) +* **widget:** hide an unfinished citation marker inside unclosed bold while streaming ([2c04566](https://github.com/PMDevSolutions/Claudius/commit/2c04566241198d58d35b95d172505b30ec5da5fd)) +* **widget:** keep source timing unchanged for widgets without citations ([5f92197](https://github.com/PMDevSolutions/Claudius/commit/5f92197dd54293424c5a18ac582a8ba2bdeb8676)) +* **widget:** wrap long unbroken snippets inside a source card ([3935ee1](https://github.com/PMDevSolutions/Claudius/commit/3935ee1c17e59dc29a3ddc1a7b94e0e9880f9cdc)) +* **worker:** announce sources with the first upstream event, not before it ([c796736](https://github.com/PMDevSolutions/Claudius/commit/c7967366f780f6a17981bccf5e5913c29fff4bd8)) +* **worker:** strip list markers, blockquotes, links, and italics from snippets ([9bd8262](https://github.com/PMDevSolutions/Claudius/commit/9bd8262b261527a3b21ccdb0c6bdfc816604fa57)) + ## [1.17.1](https://github.com/PMDevSolutions/Claudius/compare/v1.17.0...v1.17.1) (2026-09-20) diff --git a/cdn/claudius.css b/cdn/claudius.css index d2a049e..df70f6f 100644 --- a/cdn/claudius.css +++ b/cdn/claudius.css @@ -1 +1 @@ -*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.-right-1{right:-.25rem}.-right-1\.5{right:-.375rem}.-top-1{top:-.25rem}.-top-1\.5{top:-.375rem}.bottom-0{bottom:0}.bottom-20{bottom:5rem}.bottom-24{bottom:6rem}.bottom-6{bottom:1.5rem}.left-0{left:0}.left-3{left:.75rem}.left-4{left:1rem}.left-6{left:1.5rem}.right-0{right:0}.right-1{right:.25rem}.right-3{right:.75rem}.right-4{right:1rem}.right-6{right:1.5rem}.top-1{top:.25rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-20{top:5rem}.top-24{top:6rem}.top-6{top:1.5rem}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.mx-auto{margin-left:auto;margin-right:auto}.mb-2{margin-bottom:.5rem}.ml-auto{margin-left:auto}.mr-auto{margin-right:auto}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.hidden{display:none}.h-1{height:.25rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-\[90vh\]{height:90vh}.h-\[min\(500px\,calc\(100vh-7rem\)\)\]{height:min(500px,calc(100vh - 7rem))}.h-full{height:100%}.max-h-48{max-height:12rem}.min-h-\[40px\]{min-height:40px}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-2{width:.5rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-\[280px\]{width:280px}.w-\[calc\(100vw-1\.5rem\)\]{width:calc(100vw - 1.5rem)}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-4{min-width:1rem}.min-w-\[12rem\]{min-width:12rem}.max-w-\[220px\]{max-width:220px}.max-w-\[380px\]{max-width:380px}.max-w-\[85\%\]{max-width:85%}.max-w-\[90\%\]{max-width:90%}.max-w-full{max-width:100%}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-claudius-bubble{border-radius:var(--claudius-radius-bubble, var(--cl-radius-lg, 16px))}.rounded-claudius-full{border-radius:var(--cl-radius-full, 9999px)}.rounded-claudius-lg{border-radius:var(--claudius-radius-card, var(--cl-radius-lg, 16px))}.rounded-claudius-md{border-radius:var(--claudius-radius-button, var(--cl-radius-md, 12px))}.rounded-claudius-sm{border-radius:var(--cl-radius-sm, 8px)}.rounded-r-claudius-lg{border-top-right-radius:var(--claudius-radius-card, var(--cl-radius-lg, 16px));border-bottom-right-radius:var(--claudius-radius-card, var(--cl-radius-lg, 16px))}.rounded-t-claudius-lg{border-top-left-radius:var(--claudius-radius-card, var(--cl-radius-lg, 16px));border-top-right-radius:var(--claudius-radius-card, var(--cl-radius-lg, 16px))}.rounded-bl-claudius-tail{border-bottom-left-radius:var(--cl-radius-tail, 2px)}.rounded-br-claudius-tail{border-bottom-right-radius:var(--cl-radius-tail, 2px)}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-r-2{border-right-width:2px}.border-t{border-top-width:1px}.border-claudius-accent{border-color:var(--claudius-primary, var(--cl-color-accent, #2563eb))}.border-claudius-border{border-color:var(--claudius-border, var(--cl-color-border, #e2e8f0))}.bg-claudius-accent{background-color:var(--claudius-primary, var(--cl-color-accent, #2563eb))}.bg-claudius-accent-soft{background-color:var(--cl-color-accent-soft, rgb(255 255 255 / .2))}.bg-claudius-assistant-bubble{background-color:var(--claudius-assistant-bg, var(--cl-color-assistant-bubble, var(--cl-color-surface-muted, #f1f5f9)))}.bg-claudius-border{background-color:var(--claudius-border, var(--cl-color-border, #e2e8f0))}.bg-claudius-error{background-color:var(--claudius-error, var(--cl-color-error, #dc2626))}.bg-claudius-error-surface{background-color:var(--claudius-error-bg, var(--cl-color-error-surface, #fef2f2))}.bg-claudius-field{background-color:var(--cl-color-field, #ffffff)}.bg-claudius-scrim{background-color:var(--cl-color-scrim, rgb(0 0 0 / .5))}.bg-claudius-surface{background-color:var(--cl-color-surface, #ffffff)}.bg-claudius-surface-muted{background-color:var(--claudius-light, var(--cl-color-surface-muted, #f1f5f9))}.bg-claudius-text{background-color:var(--claudius-dark, var(--cl-color-text, #1e293b))}.bg-claudius-text-muted{background-color:var(--claudius-gray, var(--cl-color-text-muted, #64748b))}.bg-claudius-user-bubble{background-color:var(--claudius-user-bg, var(--cl-color-user-bubble, var(--cl-color-accent, #2563eb)))}.bg-transparent{background-color:transparent}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.pl-3{padding-left:.75rem}.pr-10{padding-right:2.5rem}.pr-3{padding-right:.75rem}.pr-8{padding-right:2rem}.pt-1{padding-top:.25rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-body{font-family:var(--claudius-font-body, var(--cl-font-body, system-ui)),sans-serif}.font-heading{font-family:var(--claudius-font-heading, var(--cl-font-heading, system-ui)),sans-serif}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-\[10px\]{font-size:10px}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.tracking-wide{letter-spacing:.025em}.text-claudius-accent{color:var(--claudius-primary, var(--cl-color-accent, #2563eb))}.text-claudius-accent-text{color:var(--cl-color-accent-text, #ffffff)}.text-claudius-accent-text-muted{color:var(--cl-color-accent-text-muted, rgb(255 255 255 / .7))}.text-claudius-assistant-bubble-text{color:var(--claudius-assistant-text, var(--cl-color-assistant-bubble-text, var(--cl-color-text, #1e293b)))}.text-claudius-error{color:var(--claudius-error, var(--cl-color-error, #dc2626))}.text-claudius-error-text{color:var(--cl-color-error-text, #ffffff)}.text-claudius-link{color:var(--cl-color-link, currentColor)}.text-claudius-surface{color:var(--cl-color-surface, #ffffff)}.text-claudius-text{color:var(--claudius-dark, var(--cl-color-text, #1e293b))}.text-claudius-text-muted{color:var(--claudius-gray, var(--cl-color-text-muted, #64748b))}.text-claudius-user-bubble-text{color:var(--claudius-user-text, var(--cl-color-user-bubble-text, #ffffff))}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.opacity-70{opacity:.7}.shadow-claudius-elevated{--tw-shadow: var(--cl-shadow-elevated, 0 25px 50px -12px rgb(0 0 0 / .25));--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-claudius-floating{--tw-shadow: var(--cl-shadow-floating, 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1));--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.ring{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-inset{--tw-ring-inset: inset}.ring-claudius-accent{--tw-ring-color: var(--claudius-primary, var(--cl-color-accent, #2563eb))}.ring-claudius-border{--tw-ring-color: var(--claudius-border, var(--cl-color-border, #e2e8f0))}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.sepia{--tw-sepia: sepia(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.\[animation-delay\:0ms\]{animation-delay:0ms}.\[animation-delay\:150ms\]{animation-delay:.15s}.\[animation-delay\:300ms\]{animation-delay:.3s}[data-claudius-dark=true]{--cl-color-accent: var(--cl-color-accent-dark, #2563eb);--cl-color-accent-text: var(--cl-color-accent-text-dark, #ffffff);--cl-color-accent-soft: var( --cl-color-accent-soft-dark, rgb(255 255 255 / .2) );--cl-color-accent-text-muted: var( --cl-color-accent-text-muted-dark, rgb(255 255 255 / .7) );--cl-color-surface: var(--cl-color-surface-dark, #111827);--cl-color-surface-muted: var(--cl-color-surface-muted-dark, #1f2937);--cl-color-text: var(--cl-color-text-dark, #f3f4f6);--cl-color-text-muted: var(--cl-color-text-muted-dark, #9ca3af);--cl-color-border: var(--cl-color-border-dark, #374151);--cl-color-user-bubble: var( --cl-color-user-bubble-dark, var(--cl-color-accent) );--cl-color-user-bubble-text: var(--cl-color-user-bubble-text-dark, #ffffff);--cl-color-assistant-bubble: var( --cl-color-assistant-bubble-dark, var(--cl-color-surface-muted) );--cl-color-assistant-bubble-text: var( --cl-color-assistant-bubble-text-dark, #e5e7eb );--cl-color-field: var(--cl-color-field-dark, #1f2937);--cl-color-error: var(--cl-color-error-dark, #f87171);--cl-color-error-surface: var( --cl-color-error-surface-dark, rgb(127 29 29 / .3) );--cl-color-error-text: var(--cl-color-error-text-dark, #ffffff);--cl-color-link: var(--cl-color-link-dark, #60a5fa);--cl-color-scrim: var(--cl-color-scrim-dark, rgb(0 0 0 / .5))}.claudius-bottom-sheet{transition:transform .3s cubic-bezier(.32,.72,0,1)}.claudius-bottom-sheet[data-dragging=true]{transition:none}.claudius-scrim{transition:opacity .3s ease}.claudius-voice-level>span{width:3px;height:100%;border-radius:9999px;background:currentColor;opacity:.5;transform:scaleY(.25);animation:claudius-voice-idle 1.2s ease-in-out infinite}.claudius-voice-level[data-claudius-voice-level=active]>span{opacity:1;animation:claudius-voice-active .6s ease-in-out infinite}.claudius-voice-level>span:nth-child(2){animation-delay:-.45s}.claudius-voice-level>span:nth-child(3){animation-delay:-.2s}.claudius-voice-level>span:nth-child(4){animation-delay:-.65s}@keyframes claudius-voice-idle{0%,to{transform:scaleY(.25)}50%{transform:scaleY(.4)}}@keyframes claudius-voice-active{0%,to{transform:scaleY(.3)}50%{transform:scaleY(1)}}@media(prefers-reduced-motion:reduce){.claudius-bottom-sheet{transition:opacity .2s ease;transform:none!important}.claudius-scrim{transition:opacity .15s ease}.claudius-voice-level>span,.claudius-voice-level[data-claudius-voice-level=active]>span{animation:none;transform:scaleY(.6)}}.placeholder\:text-claudius-text-muted::-moz-placeholder{color:var(--claudius-gray, var(--cl-color-text-muted, #64748b))}.placeholder\:text-claudius-text-muted::placeholder{color:var(--claudius-gray, var(--cl-color-text-muted, #64748b))}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:bg-claudius-accent-soft:hover{background-color:var(--cl-color-accent-soft, rgb(255 255 255 / .2))}.hover\:bg-claudius-border:hover{background-color:var(--claudius-border, var(--cl-color-border, #e2e8f0))}.hover\:bg-claudius-surface-muted:hover{background-color:var(--claudius-light, var(--cl-color-surface-muted, #f1f5f9))}.hover\:text-claudius-accent-text:hover{color:var(--cl-color-accent-text, #ffffff)}.hover\:text-claudius-text:hover{color:var(--claudius-dark, var(--cl-color-text, #1e293b))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-80:hover{opacity:.8}.hover\:opacity-90:hover{opacity:.9}.hover\:shadow-claudius-floating-hover:hover{--tw-shadow: var(--cl-shadow-floating-hover, 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1));--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:border-claudius-accent:focus{border-color:var(--claudius-primary, var(--cl-color-accent, #2563eb))}.focus\:bg-claudius-surface-muted:focus{background-color:var(--claudius-light, var(--cl-color-surface-muted, #f1f5f9))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-claudius-accent:focus{--tw-ring-color: var(--claudius-primary, var(--cl-color-accent, #2563eb))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus\:ring-offset-claudius-surface:focus{--tw-ring-offset-color: var(--cl-color-surface, #ffffff)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-claudius-accent:focus-visible{--tw-ring-color: var(--claudius-primary, var(--cl-color-accent, #2563eb))}.focus-visible\:ring-claudius-error:focus-visible{--tw-ring-color: var(--claudius-error, var(--cl-color-error, #dc2626))}.focus-visible\:ring-offset-1:focus-visible{--tw-ring-offset-width: 1px}.disabled\:cursor-default:disabled{cursor:default}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:hover\:opacity-100:hover:disabled{opacity:1}.aria-disabled\:cursor-default[aria-disabled=true]{cursor:default}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-disabled\:hover\:bg-transparent:hover[aria-disabled=true]{background-color:transparent}@media(prefers-reduced-motion:no-preference){@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.motion-safe\:animate-bounce{animation:bounce 1s infinite}}@media(min-width:640px){.sm\:left-6{left:1.5rem}.sm\:right-6{right:1.5rem}.sm\:max-w-\[400px\]{max-width:400px}}@media(min-width:768px){.md\:max-w-\[440px\]{max-width:440px}} +*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.-right-1{right:-.25rem}.-right-1\.5{right:-.375rem}.-top-1{top:-.25rem}.-top-1\.5{top:-.375rem}.bottom-0{bottom:0}.bottom-20{bottom:5rem}.bottom-24{bottom:6rem}.bottom-6{bottom:1.5rem}.left-0{left:0}.left-3{left:.75rem}.left-4{left:1rem}.left-6{left:1.5rem}.right-0{right:0}.right-1{right:.25rem}.right-3{right:.75rem}.right-4{right:1rem}.right-6{right:1.5rem}.top-1{top:.25rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-20{top:5rem}.top-24{top:6rem}.top-6{top:1.5rem}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.mx-auto{margin-left:auto;margin-right:auto}.mb-2{margin-bottom:.5rem}.ml-auto{margin-left:auto}.mr-auto{margin-right:auto}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.hidden{display:none}.h-1{height:.25rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-\[90vh\]{height:90vh}.h-\[min\(500px\,calc\(100vh-7rem\)\)\]{height:min(500px,calc(100vh - 7rem))}.h-full{height:100%}.max-h-48{max-height:12rem}.min-h-\[40px\]{min-height:40px}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-2{width:.5rem}.w-3\.5{width:.875rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-\[280px\]{width:280px}.w-\[calc\(100vw-1\.5rem\)\]{width:calc(100vw - 1.5rem)}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-4{min-width:1rem}.min-w-\[12rem\]{min-width:12rem}.max-w-\[220px\]{max-width:220px}.max-w-\[380px\]{max-width:380px}.max-w-\[85\%\]{max-width:85%}.max-w-\[90\%\]{max-width:90%}.max-w-full{max-width:100%}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-claudius-bubble{border-radius:var(--claudius-radius-bubble, var(--cl-radius-lg, 16px))}.rounded-claudius-full{border-radius:var(--cl-radius-full, 9999px)}.rounded-claudius-lg{border-radius:var(--claudius-radius-card, var(--cl-radius-lg, 16px))}.rounded-claudius-md{border-radius:var(--claudius-radius-button, var(--cl-radius-md, 12px))}.rounded-claudius-sm{border-radius:var(--cl-radius-sm, 8px)}.rounded-sm{border-radius:.125rem}.rounded-r-claudius-lg{border-top-right-radius:var(--claudius-radius-card, var(--cl-radius-lg, 16px));border-bottom-right-radius:var(--claudius-radius-card, var(--cl-radius-lg, 16px))}.rounded-t-claudius-lg{border-top-left-radius:var(--claudius-radius-card, var(--cl-radius-lg, 16px));border-top-right-radius:var(--claudius-radius-card, var(--cl-radius-lg, 16px))}.rounded-bl-claudius-tail{border-bottom-left-radius:var(--cl-radius-tail, 2px)}.rounded-br-claudius-tail{border-bottom-right-radius:var(--cl-radius-tail, 2px)}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-r-2{border-right-width:2px}.border-t{border-top-width:1px}.border-claudius-accent{border-color:var(--claudius-primary, var(--cl-color-accent, #2563eb))}.border-claudius-border{border-color:var(--claudius-border, var(--cl-color-border, #e2e8f0))}.bg-claudius-accent{background-color:var(--claudius-primary, var(--cl-color-accent, #2563eb))}.bg-claudius-accent-soft{background-color:var(--cl-color-accent-soft, rgb(255 255 255 / .2))}.bg-claudius-assistant-bubble{background-color:var(--claudius-assistant-bg, var(--cl-color-assistant-bubble, var(--cl-color-surface-muted, #f1f5f9)))}.bg-claudius-border{background-color:var(--claudius-border, var(--cl-color-border, #e2e8f0))}.bg-claudius-error{background-color:var(--claudius-error, var(--cl-color-error, #dc2626))}.bg-claudius-error-surface{background-color:var(--claudius-error-bg, var(--cl-color-error-surface, #fef2f2))}.bg-claudius-field{background-color:var(--cl-color-field, #ffffff)}.bg-claudius-scrim{background-color:var(--cl-color-scrim, rgb(0 0 0 / .5))}.bg-claudius-surface{background-color:var(--cl-color-surface, #ffffff)}.bg-claudius-surface-muted{background-color:var(--claudius-light, var(--cl-color-surface-muted, #f1f5f9))}.bg-claudius-text{background-color:var(--claudius-dark, var(--cl-color-text, #1e293b))}.bg-claudius-text-muted{background-color:var(--claudius-gray, var(--cl-color-text-muted, #64748b))}.bg-claudius-user-bubble{background-color:var(--claudius-user-bg, var(--cl-color-user-bubble, var(--cl-color-accent, #2563eb)))}.bg-transparent{background-color:transparent}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.pl-3{padding-left:.75rem}.pr-10{padding-right:2.5rem}.pr-3{padding-right:.75rem}.pr-8{padding-right:2rem}.pt-1{padding-top:.25rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-super{vertical-align:super}.font-body{font-family:var(--claudius-font-body, var(--cl-font-body, system-ui)),sans-serif}.font-heading{font-family:var(--claudius-font-heading, var(--cl-font-heading, system-ui)),sans-serif}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-\[10px\]{font-size:10px}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-wide{letter-spacing:.025em}.text-claudius-accent{color:var(--claudius-primary, var(--cl-color-accent, #2563eb))}.text-claudius-accent-text{color:var(--cl-color-accent-text, #ffffff)}.text-claudius-accent-text-muted{color:var(--cl-color-accent-text-muted, rgb(255 255 255 / .7))}.text-claudius-assistant-bubble-text{color:var(--claudius-assistant-text, var(--cl-color-assistant-bubble-text, var(--cl-color-text, #1e293b)))}.text-claudius-error{color:var(--claudius-error, var(--cl-color-error, #dc2626))}.text-claudius-error-text{color:var(--cl-color-error-text, #ffffff)}.text-claudius-link{color:var(--cl-color-link, currentColor)}.text-claudius-surface{color:var(--cl-color-surface, #ffffff)}.text-claudius-text{color:var(--claudius-dark, var(--cl-color-text, #1e293b))}.text-claudius-text-muted{color:var(--claudius-gray, var(--cl-color-text-muted, #64748b))}.text-claudius-user-bubble-text{color:var(--claudius-user-text, var(--cl-color-user-bubble-text, #ffffff))}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.opacity-70{opacity:.7}.shadow-claudius-elevated{--tw-shadow: var(--cl-shadow-elevated, 0 25px 50px -12px rgb(0 0 0 / .25));--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-claudius-floating{--tw-shadow: var(--cl-shadow-floating, 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1));--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.ring{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-inset{--tw-ring-inset: inset}.ring-claudius-accent{--tw-ring-color: var(--claudius-primary, var(--cl-color-accent, #2563eb))}.ring-claudius-border{--tw-ring-color: var(--claudius-border, var(--cl-color-border, #e2e8f0))}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.sepia{--tw-sepia: sepia(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.\[animation-delay\:0ms\]{animation-delay:0ms}.\[animation-delay\:150ms\]{animation-delay:.15s}.\[animation-delay\:300ms\]{animation-delay:.3s}[data-claudius-dark=true]{--cl-color-accent: var(--cl-color-accent-dark, #2563eb);--cl-color-accent-text: var(--cl-color-accent-text-dark, #ffffff);--cl-color-accent-soft: var( --cl-color-accent-soft-dark, rgb(255 255 255 / .2) );--cl-color-accent-text-muted: var( --cl-color-accent-text-muted-dark, rgb(255 255 255 / .7) );--cl-color-surface: var(--cl-color-surface-dark, #111827);--cl-color-surface-muted: var(--cl-color-surface-muted-dark, #1f2937);--cl-color-text: var(--cl-color-text-dark, #f3f4f6);--cl-color-text-muted: var(--cl-color-text-muted-dark, #9ca3af);--cl-color-border: var(--cl-color-border-dark, #374151);--cl-color-user-bubble: var( --cl-color-user-bubble-dark, var(--cl-color-accent) );--cl-color-user-bubble-text: var(--cl-color-user-bubble-text-dark, #ffffff);--cl-color-assistant-bubble: var( --cl-color-assistant-bubble-dark, var(--cl-color-surface-muted) );--cl-color-assistant-bubble-text: var( --cl-color-assistant-bubble-text-dark, #e5e7eb );--cl-color-field: var(--cl-color-field-dark, #1f2937);--cl-color-error: var(--cl-color-error-dark, #f87171);--cl-color-error-surface: var( --cl-color-error-surface-dark, rgb(127 29 29 / .3) );--cl-color-error-text: var(--cl-color-error-text-dark, #ffffff);--cl-color-link: var(--cl-color-link-dark, #60a5fa);--cl-color-scrim: var(--cl-color-scrim-dark, rgb(0 0 0 / .5))}.claudius-bottom-sheet{transition:transform .3s cubic-bezier(.32,.72,0,1)}.claudius-bottom-sheet[data-dragging=true]{transition:none}.claudius-scrim{transition:opacity .3s ease}.claudius-voice-level>span{width:3px;height:100%;border-radius:9999px;background:currentColor;opacity:.5;transform:scaleY(.25);animation:claudius-voice-idle 1.2s ease-in-out infinite}.claudius-voice-level[data-claudius-voice-level=active]>span{opacity:1;animation:claudius-voice-active .6s ease-in-out infinite}.claudius-voice-level>span:nth-child(2){animation-delay:-.45s}.claudius-voice-level>span:nth-child(3){animation-delay:-.2s}.claudius-voice-level>span:nth-child(4){animation-delay:-.65s}@keyframes claudius-voice-idle{0%,to{transform:scaleY(.25)}50%{transform:scaleY(.4)}}@keyframes claudius-voice-active{0%,to{transform:scaleY(.3)}50%{transform:scaleY(1)}}@media(prefers-reduced-motion:reduce){.claudius-bottom-sheet{transition:opacity .2s ease;transform:none!important}.claudius-scrim{transition:opacity .15s ease}.claudius-voice-level>span,.claudius-voice-level[data-claudius-voice-level=active]>span{animation:none;transform:scaleY(.6)}}.placeholder\:text-claudius-text-muted::-moz-placeholder{color:var(--claudius-gray, var(--cl-color-text-muted, #64748b))}.placeholder\:text-claudius-text-muted::placeholder{color:var(--claudius-gray, var(--cl-color-text-muted, #64748b))}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:bg-claudius-accent-soft:hover{background-color:var(--cl-color-accent-soft, rgb(255 255 255 / .2))}.hover\:bg-claudius-border:hover{background-color:var(--claudius-border, var(--cl-color-border, #e2e8f0))}.hover\:bg-claudius-surface-muted:hover{background-color:var(--claudius-light, var(--cl-color-surface-muted, #f1f5f9))}.hover\:text-claudius-accent-text:hover{color:var(--cl-color-accent-text, #ffffff)}.hover\:text-claudius-text:hover{color:var(--claudius-dark, var(--cl-color-text, #1e293b))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-80:hover{opacity:.8}.hover\:opacity-90:hover{opacity:.9}.hover\:shadow-claudius-floating-hover:hover{--tw-shadow: var(--cl-shadow-floating-hover, 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1));--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:border-claudius-accent:focus{border-color:var(--claudius-primary, var(--cl-color-accent, #2563eb))}.focus\:bg-claudius-surface-muted:focus{background-color:var(--claudius-light, var(--cl-color-surface-muted, #f1f5f9))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-claudius-accent:focus{--tw-ring-color: var(--claudius-primary, var(--cl-color-accent, #2563eb))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus\:ring-offset-claudius-surface:focus{--tw-ring-offset-color: var(--cl-color-surface, #ffffff)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-claudius-accent:focus-visible{--tw-ring-color: var(--claudius-primary, var(--cl-color-accent, #2563eb))}.focus-visible\:ring-claudius-error:focus-visible{--tw-ring-color: var(--claudius-error, var(--cl-color-error, #dc2626))}.focus-visible\:ring-offset-1:focus-visible{--tw-ring-offset-width: 1px}.disabled\:cursor-default:disabled{cursor:default}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:hover\:opacity-100:hover:disabled{opacity:1}.aria-disabled\:cursor-default[aria-disabled=true]{cursor:default}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-disabled\:hover\:bg-transparent:hover[aria-disabled=true]{background-color:transparent}@media(prefers-reduced-motion:no-preference){@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.motion-safe\:animate-bounce{animation:bounce 1s infinite}}@media(min-width:640px){.sm\:left-6{left:1.5rem}.sm\:right-6{right:1.5rem}.sm\:max-w-\[400px\]{max-width:400px}}@media(min-width:768px){.md\:max-w-\[440px\]{max-width:440px}} diff --git a/cdn/claudius.iife.js b/cdn/claudius.iife.js index cd7a134..0583702 100644 --- a/cdn/claudius.iife.js +++ b/cdn/claudius.iife.js @@ -1,4 +1,4 @@ -var Claudius=(function(Ot){"use strict";var Ph=Object.defineProperty;var Ah=(Ot,xt,jt)=>xt in Ot?Ph(Ot,xt,{enumerable:!0,configurable:!0,writable:!0,value:jt}):Ot[xt]=jt;var hn=(Ot,xt,jt)=>Ah(Ot,typeof xt!="symbol"?xt+"":xt,jt);var xt={exports:{}},jt={},ro={exports:{}},fe={};/** +var Claudius=(function(Ft){"use strict";var Zh=Object.defineProperty;var Jh=(Ft,St,At)=>St in Ft?Zh(Ft,St,{enumerable:!0,configurable:!0,writable:!0,value:At}):Ft[St]=At;var Kt=(Ft,St,At)=>Jh(Ft,typeof St!="symbol"?St+"":St,At);var St={exports:{}},At={},ro={exports:{}},de={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ var Claudius=(function(Ot){"use strict";var Ph=Object.defineProperty;var Ah=(Ot, * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var tu;function _c(){if(tu)return fe;tu=1;var u=Symbol.for("react.element"),a=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),p=Symbol.for("react.provider"),v=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),N=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),O=Symbol.iterator;function V(m){return m===null||typeof m!="object"?null:(m=O&&m[O]||m["@@iterator"],typeof m=="function"?m:null)}var I={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D=Object.assign,P={};function F(m,T,re){this.props=m,this.context=T,this.refs=P,this.updater=re||I}F.prototype.isReactComponent={},F.prototype.setState=function(m,T){if(typeof m!="object"&&typeof m!="function"&&m!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,m,T,"setState")},F.prototype.forceUpdate=function(m){this.updater.enqueueForceUpdate(this,m,"forceUpdate")};function $(){}$.prototype=F.prototype;function J(m,T,re){this.props=m,this.context=T,this.refs=P,this.updater=re||I}var B=J.prototype=new $;B.constructor=J,D(B,F.prototype),B.isPureReactComponent=!0;var Q=Array.isArray,ue=Object.prototype.hasOwnProperty,de={current:null},ae={key:!0,ref:!0,__self:!0,__source:!0};function Z(m,T,re){var le,se={},ne=null,ie=null;if(T!=null)for(le in T.ref!==void 0&&(ie=T.ref),T.key!==void 0&&(ne=""+T.key),T)ue.call(T,le)&&!ae.hasOwnProperty(le)&&(se[le]=T[le]);var K=arguments.length-2;if(K===1)se.children=re;else if(1>>1,T=z[m];if(0>>1;mf(se,C))nef(ie,se)?(z[m]=ie,z[ne]=C,m=ne):(z[m]=se,z[le]=C,m=le);else if(nef(ie,C))z[m]=ie,z[ne]=C,m=ne;else break e}}return X}function f(z,X){var C=z.sortIndex-X.sortIndex;return C!==0?C:z.id-X.id}if(typeof performance=="object"&&typeof performance.now=="function"){var p=performance;u.unstable_now=function(){return p.now()}}else{var v=Date,k=v.now();u.unstable_now=function(){return v.now()-k}}var S=[],N=[],j=1,O=null,V=3,I=!1,D=!1,P=!1,F=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,J=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function B(z){for(var X=i(N);X!==null;){if(X.callback===null)c(N);else if(X.startTime<=z)c(N),X.sortIndex=X.expirationTime,a(S,X);else break;X=i(N)}}function Q(z){if(P=!1,B(z),!D)if(i(S)!==null)D=!0,_e(ue);else{var X=i(N);X!==null&&ge(Q,X.startTime-z)}}function ue(z,X){D=!1,P&&(P=!1,$(Z),Z=-1),I=!0;var C=V;try{for(B(X),O=i(S);O!==null&&(!(O.expirationTime>X)||z&&!Se());){var m=O.callback;if(typeof m=="function"){O.callback=null,V=O.priorityLevel;var T=m(O.expirationTime<=X);X=u.unstable_now(),typeof T=="function"?O.callback=T:O===i(S)&&c(S),B(X)}else c(S);O=i(S)}if(O!==null)var re=!0;else{var le=i(N);le!==null&&ge(Q,le.startTime-X),re=!1}return re}finally{O=null,V=C,I=!1}}var de=!1,ae=null,Z=-1,xe=5,pe=-1;function Se(){return!(u.unstable_now()-pez||125m?(z.sortIndex=C,a(N,z),i(S)===null&&z===i(N)&&(P?($(Z),Z=-1):P=!0,ge(Q,C-m))):(z.sortIndex=T,a(S,z),D||I||(D=!0,_e(ue))),z},u.unstable_shouldYield=Se,u.unstable_wrapCallback=function(z){var X=V;return function(){var C=V;V=X;try{return z.apply(this,arguments)}finally{V=C}}}})(uo)),uo}var iu;function Ac(){return iu||(iu=1,io.exports=Pc()),io.exports}/** + */var iu;function zc(){return iu||(iu=1,(function(u){function s(z,q){var H=z.length;z.push(q);e:for(;0>>1,T=z[g];if(0>>1;gd(oe,H))ied(fe,oe)?(z[g]=fe,z[ie]=H,g=ie):(z[g]=oe,z[D]=H,g=D);else if(ied(fe,H))z[g]=fe,z[ie]=H,g=ie;else break e}}return q}function d(z,q){var H=z.sortIndex-q.sortIndex;return H!==0?H:z.id-q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var h=performance;u.unstable_now=function(){return h.now()}}else{var m=Date,w=m.now();u.unstable_now=function(){return m.now()-w}}var x=[],R=[],j=1,F=null,U=3,O=!1,L=!1,N=!1,B=typeof setTimeout=="function"?setTimeout:null,V=typeof clearTimeout=="function"?clearTimeout:null,K=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(z){for(var q=i(R);q!==null;){if(q.callback===null)c(R);else if(q.startTime<=z)c(R),q.sortIndex=q.expirationTime,s(x,q);else break;q=i(R)}}function $(z){if(N=!1,b(z),!L)if(i(x)!==null)L=!0,we(se);else{var q=i(R);q!==null&&ce($,q.startTime-z)}}function se(z,q){L=!1,N&&(N=!1,V(ae),ae=-1),O=!0;var H=U;try{for(b(q),F=i(x);F!==null&&(!(F.expirationTime>q)||z&&!me());){var g=F.callback;if(typeof g=="function"){F.callback=null,U=F.priorityLevel;var T=g(F.expirationTime<=q);q=u.unstable_now(),typeof T=="function"?F.callback=T:F===i(x)&&c(x),b(q)}else c(x);F=i(x)}if(F!==null)var Y=!0;else{var D=i(R);D!==null&&ce($,D.startTime-q),Y=!1}return Y}finally{F=null,U=H,O=!1}}var G=!1,ee=null,ae=-1,te=5,De=-1;function me(){return!(u.unstable_now()-Dez||125g?(z.sortIndex=H,s(R,z),i(x)===null&&z===i(R)&&(N?(V(ae),ae=-1):N=!0,ce($,H-g))):(z.sortIndex=T,s(x,z),L||O||(L=!0,we(se))),z},u.unstable_shouldYield=me,u.unstable_wrapCallback=function(z){var q=U;return function(){var H=U;U=q;try{return z.apply(this,arguments)}finally{U=H}}}})(uo)),uo}var uu;function Ic(){return uu||(uu=1,io.exports=zc()),io.exports}/** * @license React * react-dom.production.min.js * @@ -30,28 +30,28 @@ var Claudius=(function(Ot){"use strict";var Ph=Object.defineProperty;var Ah=(Ot, * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var uu;function Dc(){if(uu)return et;uu=1;var u=lo(),a=Ac();function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),S=Object.prototype.hasOwnProperty,N=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,j={},O={};function V(e){return S.call(O,e)?!0:S.call(j,e)?!1:N.test(e)?O[e]=!0:(j[e]=!0,!1)}function I(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function D(e,t,n,r){if(t===null||typeof t>"u"||I(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function P(e,t,n,r,l,o,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var F={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){F[e]=new P(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];F[t]=new P(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){F[e]=new P(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){F[e]=new P(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){F[e]=new P(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){F[e]=new P(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){F[e]=new P(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){F[e]=new P(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){F[e]=new P(e,5,!1,e.toLowerCase(),null,!1,!1)});var $=/[\-:]([a-z])/g;function J(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace($,J);F[t]=new P(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace($,J);F[t]=new P(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace($,J);F[t]=new P(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){F[e]=new P(e,1,!1,e.toLowerCase(),null,!1,!1)}),F.xlinkHref=new P("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){F[e]=new P(e,1,!1,e.toLowerCase(),null,!0,!0)});function B(e,t,n,r){var l=F.hasOwnProperty(t)?F[t]:null;(l!==null?l.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),x=Object.prototype.hasOwnProperty,R=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,j={},F={};function U(e){return x.call(F,e)?!0:x.call(j,e)?!1:R.test(e)?F[e]=!0:(j[e]=!0,!1)}function O(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function L(e,t,n,r){if(t===null||typeof t>"u"||O(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function N(e,t,n,r,l,o,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=a}var B={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){B[e]=new N(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];B[t]=new N(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){B[e]=new N(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){B[e]=new N(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){B[e]=new N(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){B[e]=new N(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){B[e]=new N(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){B[e]=new N(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){B[e]=new N(e,5,!1,e.toLowerCase(),null,!1,!1)});var V=/[\-:]([a-z])/g;function K(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(V,K);B[t]=new N(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(V,K);B[t]=new N(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(V,K);B[t]=new N(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){B[e]=new N(e,1,!1,e.toLowerCase(),null,!1,!1)}),B.xlinkHref=new N("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){B[e]=new N(e,1,!1,e.toLowerCase(),null,!0,!0)});function b(e,t,n,r){var l=B.hasOwnProperty(t)?B[t]:null;(l!==null?l.type!==0:r||!(2d||l[s]!==o[d]){var h=` -`+l[s].replace(" at new "," at ");return e.displayName&&h.includes("")&&(h=h.replace("",e.displayName)),h}while(1<=s&&0<=d);break}}}finally{re=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?T(e):""}function se(e){switch(e.tag){case 5:return T(e.type);case 16:return T("Lazy");case 13:return T("Suspense");case 19:return T("SuspenseList");case 0:case 2:case 15:return e=le(e.type,!1),e;case 11:return e=le(e.type.render,!1),e;case 1:return e=le(e.type,!0),e;default:return""}}function ne(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ae:return"Fragment";case de:return"Portal";case xe:return"Profiler";case Z:return"StrictMode";case ve:return"Suspense";case Re:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Se:return(e.displayName||"Context")+".Consumer";case pe:return(e._context.displayName||"Context")+".Provider";case Ce:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ye:return t=e.displayName||null,t!==null?t:ne(e.type)||"Memo";case _e:t=e._payload,e=e._init;try{return ne(e(t))}catch{}}return null}function ie(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ne(t);case 8:return t===Z?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function K(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function q(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ce(e){var t=q(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ae(e){e._valueTracker||(e._valueTracker=ce(e))}function Ze(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=q(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ft(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Fe(e,t){var n=t.checked;return C({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Kt(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=K(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function _t(e,t){t=t.checked,t!=null&&B(e,"checked",t,!1)}function Oe(e,t){_t(e,t);var n=K(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Mt(e,t.type,n):t.hasOwnProperty("defaultValue")&&Mt(e,t.type,K(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function pt(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Mt(e,t,n){(t!=="number"||ft(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ut=Array.isArray;function Ue(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Yr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function rr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var lr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Of=["Webkit","ms","Moz","O"];Object.keys(lr).forEach(function(e){Of.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),lr[t]=lr[e]})});function Wu(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||lr.hasOwnProperty(e)&&lr[e]?(""+t).trim():t+"px"}function Qu(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Wu(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var If=C({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function po(e,t){if(t){if(If[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(i(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(i(61))}if(t.style!=null&&typeof t.style!="object")throw Error(i(62))}}function ho(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var mo=null;function go(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var vo=null,_n=null,Mn=null;function Ku(e){if(e=Tr(e)){if(typeof vo!="function")throw Error(i(280));var t=e.stateNode;t&&(t=yl(t),vo(e.stateNode,e.type,t))}}function bu(e){_n?Mn?Mn.push(e):Mn=[e]:_n=e}function Gu(){if(_n){var e=_n,t=Mn;if(Mn=_n=null,Ku(e),t)for(e=0;e>>=0,e===0?32:31-(Gf(e)/Yf|0)|0}var el=64,tl=4194304;function sr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function nl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,s=n&268435455;if(s!==0){var d=s&~l;d!==0?r=sr(d):(o&=s,o!==0&&(r=sr(o)))}else s=n&~l,s!==0?r=sr(s):o!==0&&(r=sr(o));if(r===0)return 0;if(t!==0&&t!==r&&(t&l)===0&&(l=r&-r,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function ar(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-St(t),e[t]=n}function qf(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=vr),ks=" ",Es=!1;function Cs(e,t){switch(e){case"keyup":return Np.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Rs(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var An=!1;function _p(e,t){switch(e){case"compositionend":return Rs(t);case"keypress":return t.which!==32?null:(Es=!0,ks);case"textInput":return e=t.data,e===ks&&Es?null:e;default:return null}}function Mp(e,t){if(An)return e==="compositionend"||!zo&&Cs(e,t)?(e=gs(),ul=_o=Jt=null,An=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ps(n)}}function Ds(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ds(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function zs(){for(var e=window,t=ft();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ft(e.document)}return t}function Fo(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Up(e){var t=zs(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ds(n.ownerDocument.documentElement,n)){if(r!==null&&Fo(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,o=Math.min(r.start,l);r=r.end===void 0?o:Math.min(r.end,l),!e.extend&&o>r&&(l=r,r=o,o=l),l=As(n,o);var s=As(n,r);l&&s&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Dn=null,Uo=null,Sr=null,Bo=!1;function Os(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Bo||Dn==null||Dn!==ft(r)||(r=Dn,"selectionStart"in r&&Fo(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Sr&&xr(Sr,r)||(Sr=r,r=ml(Uo,"onSelect"),0Un||(e.current=Jo[Un],Jo[Un]=null,Un--)}function Ee(e,t){Un++,Jo[Un]=e.current,e.current=t}var nn={},be=tn(nn),nt=tn(!1),vn=nn;function Bn(e,t){var n=e.type.contextTypes;if(!n)return nn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function rt(e){return e=e.childContextTypes,e!=null}function wl(){Ne(nt),Ne(be)}function Zs(e,t,n){if(be.current!==nn)throw Error(i(168));Ee(be,t),Ee(nt,n)}function Js(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(i(108,ie(e)||"Unknown",l));return C({},n,r)}function xl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||nn,vn=be.current,Ee(be,e),Ee(nt,nt.current),!0}function qs(e,t,n){var r=e.stateNode;if(!r)throw Error(i(169));n?(e=Js(e,t,vn),r.__reactInternalMemoizedMergedChildContext=e,Ne(nt),Ne(be),Ee(be,e)):Ne(nt),Ee(nt,n)}var Ut=null,Sl=!1,qo=!1;function ea(e){Ut===null?Ut=[e]:Ut.push(e)}function Zp(e){Sl=!0,ea(e)}function rn(){if(!qo&&Ut!==null){qo=!0;var e=0,t=we;try{var n=Ut;for(we=1;e>=s,l-=s,Bt=1<<32-St(t)+l|n<oe?(We=te,te=null):We=te.sibling;var me=_(w,te,x[oe],A);if(me===null){te===null&&(te=We);break}e&&te&&me.alternate===null&&t(w,te),g=o(me,g,oe),ee===null?Y=me:ee.sibling=me,ee=me,te=We}if(oe===x.length)return n(w,te),je&&wn(w,oe),Y;if(te===null){for(;oeoe?(We=te,te=null):We=te.sibling;var pn=_(w,te,me.value,A);if(pn===null){te===null&&(te=We);break}e&&te&&pn.alternate===null&&t(w,te),g=o(pn,g,oe),ee===null?Y=pn:ee.sibling=pn,ee=pn,te=We}if(me.done)return n(w,te),je&&wn(w,oe),Y;if(te===null){for(;!me.done;oe++,me=x.next())me=L(w,me.value,A),me!==null&&(g=o(me,g,oe),ee===null?Y=me:ee.sibling=me,ee=me);return je&&wn(w,oe),Y}for(te=r(w,te);!me.done;oe++,me=x.next())me=U(te,w,oe,me.value,A),me!==null&&(e&&me.alternate!==null&&te.delete(me.key===null?oe:me.key),g=o(me,g,oe),ee===null?Y=me:ee.sibling=me,ee=me);return e&&te.forEach(function(Lh){return t(w,Lh)}),je&&wn(w,oe),Y}function ze(w,g,x,A){if(typeof x=="object"&&x!==null&&x.type===ae&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case ue:e:{for(var Y=x.key,ee=g;ee!==null;){if(ee.key===Y){if(Y=x.type,Y===ae){if(ee.tag===7){n(w,ee.sibling),g=l(ee,x.props.children),g.return=w,w=g;break e}}else if(ee.elementType===Y||typeof Y=="object"&&Y!==null&&Y.$$typeof===_e&&ia(Y)===ee.type){n(w,ee.sibling),g=l(ee,x.props),g.ref=Nr(w,ee,x),g.return=w,w=g;break e}n(w,ee);break}else t(w,ee);ee=ee.sibling}x.type===ae?(g=Nn(x.props.children,w.mode,A,x.key),g.return=w,w=g):(A=Yl(x.type,x.key,x.props,null,w.mode,A),A.ref=Nr(w,g,x),A.return=w,w=A)}return s(w);case de:e:{for(ee=x.key;g!==null;){if(g.key===ee)if(g.tag===4&&g.stateNode.containerInfo===x.containerInfo&&g.stateNode.implementation===x.implementation){n(w,g.sibling),g=l(g,x.children||[]),g.return=w,w=g;break e}else{n(w,g);break}else t(w,g);g=g.sibling}g=Xi(x,w.mode,A),g.return=w,w=g}return s(w);case _e:return ee=x._init,ze(w,g,ee(x._payload),A)}if(ut(x))return b(w,g,x,A);if(X(x))return G(w,g,x,A);Rl(w,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,g!==null&&g.tag===6?(n(w,g.sibling),g=l(g,x),g.return=w,w=g):(n(w,g),g=Yi(x,w.mode,A),g.return=w,w=g),s(w)):n(w,g)}return ze}var Wn=ua(!0),sa=ua(!1),Tl=tn(null),Nl=null,Qn=null,oi=null;function ii(){oi=Qn=Nl=null}function ui(e){var t=Tl.current;Ne(Tl),e._currentValue=t}function si(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Kn(e,t){Nl=e,oi=Qn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(lt=!0),e.firstContext=null)}function gt(e){var t=e._currentValue;if(oi!==e)if(e={context:e,memoizedValue:t,next:null},Qn===null){if(Nl===null)throw Error(i(308));Qn=e,Nl.dependencies={lanes:0,firstContext:e}}else Qn=Qn.next=e;return t}var xn=null;function ai(e){xn===null?xn=[e]:xn.push(e)}function aa(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,ai(t)):(n.next=l.next,l.next=n),t.interleaved=n,$t(e,r)}function $t(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var ln=!1;function ci(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ca(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Vt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function on(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(he&2)!==0){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,$t(e,n)}return l=r.interleaved,l===null?(t.next=t,ai(r)):(t.next=l.next,l.next=t),r.interleaved=t,$t(e,n)}function jl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Co(e,n)}}function da(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?l=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?l=o=t:o=o.next=t}else l=o=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function _l(e,t,n,r){var l=e.updateQueue;ln=!1;var o=l.firstBaseUpdate,s=l.lastBaseUpdate,d=l.shared.pending;if(d!==null){l.shared.pending=null;var h=d,E=h.next;h.next=null,s===null?o=E:s.next=E,s=h;var M=e.alternate;M!==null&&(M=M.updateQueue,d=M.lastBaseUpdate,d!==s&&(d===null?M.firstBaseUpdate=E:d.next=E,M.lastBaseUpdate=h))}if(o!==null){var L=l.baseState;s=0,M=E=h=null,d=o;do{var _=d.lane,U=d.eventTime;if((r&_)===_){M!==null&&(M=M.next={eventTime:U,lane:0,tag:d.tag,payload:d.payload,callback:d.callback,next:null});e:{var b=e,G=d;switch(_=t,U=n,G.tag){case 1:if(b=G.payload,typeof b=="function"){L=b.call(U,L,_);break e}L=b;break e;case 3:b.flags=b.flags&-65537|128;case 0:if(b=G.payload,_=typeof b=="function"?b.call(U,L,_):b,_==null)break e;L=C({},L,_);break e;case 2:ln=!0}}d.callback!==null&&d.lane!==0&&(e.flags|=64,_=l.effects,_===null?l.effects=[d]:_.push(d))}else U={eventTime:U,lane:_,tag:d.tag,payload:d.payload,callback:d.callback,next:null},M===null?(E=M=U,h=L):M=M.next=U,s|=_;if(d=d.next,d===null){if(d=l.shared.pending,d===null)break;_=d,d=_.next,_.next=null,l.lastBaseUpdate=_,l.shared.pending=null}}while(!0);if(M===null&&(h=L),l.baseState=h,l.firstBaseUpdate=E,l.lastBaseUpdate=M,t=l.shared.interleaved,t!==null){l=t;do s|=l.lane,l=l.next;while(l!==t)}else o===null&&(l.shared.lanes=0);En|=s,e.lanes=s,e.memoizedState=L}}function fa(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=mi.transition;mi.transition={};try{e(!1),t()}finally{we=n,mi.transition=r}}function La(){return vt().memoizedState}function th(e,t,n){var r=cn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Pa(e))Aa(t,n);else if(n=aa(e,t,n,r),n!==null){var l=qe();Nt(n,e,r,l),Da(n,t,r)}}function nh(e,t,n){var r=cn(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Pa(e))Aa(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var s=t.lastRenderedState,d=o(s,n);if(l.hasEagerState=!0,l.eagerState=d,kt(d,s)){var h=t.interleaved;h===null?(l.next=l,ai(t)):(l.next=h.next,h.next=l),t.interleaved=l;return}}catch{}finally{}n=aa(e,t,l,r),n!==null&&(l=qe(),Nt(n,e,r,l),Da(n,t,r))}}function Pa(e){var t=e.alternate;return e===Le||t!==null&&t===Le}function Aa(e,t){Lr=Pl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Da(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Co(e,n)}}var zl={readContext:gt,useCallback:Ge,useContext:Ge,useEffect:Ge,useImperativeHandle:Ge,useInsertionEffect:Ge,useLayoutEffect:Ge,useMemo:Ge,useReducer:Ge,useRef:Ge,useState:Ge,useDebugValue:Ge,useDeferredValue:Ge,useTransition:Ge,useMutableSource:Ge,useSyncExternalStore:Ge,useId:Ge,unstable_isNewReconciler:!1},rh={readContext:gt,useCallback:function(e,t){return Dt().memoizedState=[e,t===void 0?null:t],e},useContext:gt,useEffect:Ea,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Al(4194308,4,Ta.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Al(4194308,4,e,t)},useInsertionEffect:function(e,t){return Al(4,2,e,t)},useMemo:function(e,t){var n=Dt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Dt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=th.bind(null,Le,e),[r.memoizedState,e]},useRef:function(e){var t=Dt();return e={current:e},t.memoizedState=e},useState:Sa,useDebugValue:ki,useDeferredValue:function(e){return Dt().memoizedState=e},useTransition:function(){var e=Sa(!1),t=e[0];return e=eh.bind(null,e[1]),Dt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Le,l=Dt();if(je){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Ve===null)throw Error(i(349));(kn&30)!==0||ga(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,Ea(ya.bind(null,r,o,e),[e]),r.flags|=2048,Dr(9,va.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Dt(),t=Ve.identifierPrefix;if(je){var n=Ht,r=Bt;n=(r&~(1<<32-St(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Pr++,0f||l[a]!==o[f]){var v=` +`+l[a].replace(" at new "," at ");return e.displayName&&v.includes("")&&(v=v.replace("",e.displayName)),v}while(1<=a&&0<=f);break}}}finally{Y=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?T(e):""}function oe(e){switch(e.tag){case 5:return T(e.type);case 16:return T("Lazy");case 13:return T("Suspense");case 19:return T("SuspenseList");case 0:case 2:case 15:return e=D(e.type,!1),e;case 11:return e=D(e.type.render,!1),e;case 1:return e=D(e.type,!0),e;default:return""}}function ie(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ee:return"Fragment";case G:return"Portal";case te:return"Profiler";case ae:return"StrictMode";case Ee:return"Suspense";case Re:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case me:return(e.displayName||"Context")+".Consumer";case De:return(e._context.displayName||"Context")+".Provider";case ye:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ne:return t=e.displayName||null,t!==null?t:ie(e.type)||"Memo";case we:t=e._payload,e=e._init;try{return ie(e(t))}catch{}}return null}function fe(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ie(t);case 8:return t===ae?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ne(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function pe(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ce(e){var t=pe(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(a){r=""+a,o.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function he(e){e._valueTracker||(e._valueTracker=Ce(e))}function Me(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=pe(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Se(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Be(e,t){var n=t.checked;return H({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function lt(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ne(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function kt(e,t){t=t.checked,t!=null&&b(e,"checked",t,!1)}function Ye(e,t){kt(e,t);var n=ne(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Et(e,t.type,n):t.hasOwnProperty("defaultValue")&&Et(e,t.type,ne(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Gt(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Et(e,t,n){(t!=="number"||Se(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ze=Array.isArray;function Qe(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Yr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function or(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ir={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},tp=["Webkit","ms","Moz","O"];Object.keys(ir).forEach(function(e){tp.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ir[t]=ir[e]})});function Ku(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ir.hasOwnProperty(e)&&ir[e]?(""+t).trim():t+"px"}function Gu(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Ku(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var np=H({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ho(e,t){if(t){if(np[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(i(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(i(61))}if(t.style!=null&&typeof t.style!="object")throw Error(i(62))}}function mo(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var go=null;function vo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var yo=null,Mn=null,Ln=null;function Yu(e){if(e=jr(e)){if(typeof yo!="function")throw Error(i(280));var t=e.stateNode;t&&(t=yl(t),yo(e.stateNode,e.type,t))}}function Xu(e){Mn?Ln?Ln.push(e):Ln=[e]:Mn=e}function Zu(){if(Mn){var e=Mn,t=Ln;if(Ln=Mn=null,Yu(e),t)for(e=0;e>>=0,e===0?32:31-(pp(e)/hp|0)|0}var el=64,tl=4194304;function cr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function nl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,a=n&268435455;if(a!==0){var f=a&~l;f!==0?r=cr(f):(o&=a,o!==0&&(r=cr(o)))}else a=n&~l,a!==0?r=cr(a):o!==0&&(r=cr(o));if(r===0)return 0;if(t!==0&&t!==r&&(t&l)===0&&(l=r&-r,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function dr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Rt(t),e[t]=n}function yp(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=wr),Rs=" ",Ts=!1;function Ns(e,t){switch(e){case"keyup":return Qp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function js(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Dn=!1;function Gp(e,t){switch(e){case"compositionend":return js(t);case"keypress":return t.which!==32?null:(Ts=!0,Rs);case"textInput":return e=t.data,e===Rs&&Ts?null:e;default:return null}}function Yp(e,t){if(Dn)return e==="compositionend"||!Io&&Ns(e,t)?(e=ws(),ul=Mo=qt=null,Dn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=zs(n)}}function Os(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Os(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Fs(){for(var e=window,t=Se();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Se(e.document)}return t}function Uo(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function lh(e){var t=Fs(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Os(n.ownerDocument.documentElement,n)){if(r!==null&&Uo(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,o=Math.min(r.start,l);r=r.end===void 0?o:Math.min(r.end,l),!e.extend&&o>r&&(l=r,r=o,o=l),l=Is(n,o);var a=Is(n,r);l&&a&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,zn=null,Bo=null,Er=null,$o=!1;function Us(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;$o||zn==null||zn!==Se(r)||(r=zn,"selectionStart"in r&&Uo(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Er&&kr(Er,r)||(Er=r,r=ml(Bo,"onSelect"),0Bn||(e.current=qo[Bn],qo[Bn]=null,Bn--)}function Te(e,t){Bn++,qo[Bn]=e.current,e.current=t}var rn={},Xe=nn(rn),ot=nn(!1),vn=rn;function $n(e,t){var n=e.type.contextTypes;if(!n)return rn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function it(e){return e=e.childContextTypes,e!=null}function wl(){_e(ot),_e(Xe)}function ea(e,t,n){if(Xe.current!==rn)throw Error(i(168));Te(Xe,t),Te(ot,n)}function ta(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(i(108,fe(e)||"Unknown",l));return H({},n,r)}function xl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||rn,vn=Xe.current,Te(Xe,e),Te(ot,ot.current),!0}function na(e,t,n){var r=e.stateNode;if(!r)throw Error(i(169));n?(e=ta(e,t,vn),r.__reactInternalMemoizedMergedChildContext=e,_e(ot),_e(Xe),Te(Xe,e)):_e(ot),Te(ot,n)}var Bt=null,Sl=!1,ei=!1;function ra(e){Bt===null?Bt=[e]:Bt.push(e)}function gh(e){Sl=!0,ra(e)}function ln(){if(!ei&&Bt!==null){ei=!0;var e=0,t=ke;try{var n=Bt;for(ke=1;e>=a,l-=a,$t=1<<32-Rt(t)+l|n<ue?(We=le,le=null):We=le.sibling;var ve=_(S,le,k[ue],P);if(ve===null){le===null&&(le=We);break}e&&le&&ve.alternate===null&&t(S,le),y=o(ve,y,ue),re===null?J=ve:re.sibling=ve,re=ve,le=We}if(ue===k.length)return n(S,le),Le&&wn(S,ue),J;if(le===null){for(;ueue?(We=le,le=null):We=le.sibling;var hn=_(S,le,ve.value,P);if(hn===null){le===null&&(le=We);break}e&&le&&hn.alternate===null&&t(S,le),y=o(hn,y,ue),re===null?J=hn:re.sibling=hn,re=hn,le=We}if(ve.done)return n(S,le),Le&&wn(S,ue),J;if(le===null){for(;!ve.done;ue++,ve=k.next())ve=A(S,ve.value,P),ve!==null&&(y=o(ve,y,ue),re===null?J=ve:re.sibling=ve,re=ve);return Le&&wn(S,ue),J}for(le=r(S,le);!ve.done;ue++,ve=k.next())ve=W(le,S,ue,ve.value,P),ve!==null&&(e&&ve.alternate!==null&&le.delete(ve.key===null?ue:ve.key),y=o(ve,y,ue),re===null?J=ve:re.sibling=ve,re=ve);return e&&le.forEach(function(Xh){return t(S,Xh)}),Le&&wn(S,ue),J}function Fe(S,y,k,P){if(typeof k=="object"&&k!==null&&k.type===ee&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case se:e:{for(var J=k.key,re=y;re!==null;){if(re.key===J){if(J=k.type,J===ee){if(re.tag===7){n(S,re.sibling),y=l(re,k.props.children),y.return=S,S=y;break e}}else if(re.elementType===J||typeof J=="object"&&J!==null&&J.$$typeof===we&&aa(J)===re.type){n(S,re.sibling),y=l(re,k.props),y.ref=_r(S,re,k),y.return=S,S=y;break e}n(S,re);break}else t(S,re);re=re.sibling}k.type===ee?(y=Nn(k.props.children,S.mode,P,k.key),y.return=S,S=y):(P=Yl(k.type,k.key,k.props,null,S.mode,P),P.ref=_r(S,y,k),P.return=S,S=P)}return a(S);case G:e:{for(re=k.key;y!==null;){if(y.key===re)if(y.tag===4&&y.stateNode.containerInfo===k.containerInfo&&y.stateNode.implementation===k.implementation){n(S,y.sibling),y=l(y,k.children||[]),y.return=S,S=y;break e}else{n(S,y);break}else t(S,y);y=y.sibling}y=Zi(k,S.mode,P),y.return=S,S=y}return a(S);case we:return re=k._init,Fe(S,y,re(k._payload),P)}if(ze(k))return X(S,y,k,P);if(q(k))return Z(S,y,k,P);Rl(S,k)}return typeof k=="string"&&k!==""||typeof k=="number"?(k=""+k,y!==null&&y.tag===6?(n(S,y.sibling),y=l(y,k),y.return=S,S=y):(n(S,y),y=Xi(k,S.mode,P),y.return=S,S=y),a(S)):n(S,y)}return Fe}var Wn=ca(!0),da=ca(!1),Tl=nn(null),Nl=null,Qn=null,ii=null;function ui(){ii=Qn=Nl=null}function si(e){var t=Tl.current;_e(Tl),e._currentValue=t}function ai(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Kn(e,t){Nl=e,ii=Qn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(ut=!0),e.firstContext=null)}function vt(e){var t=e._currentValue;if(ii!==e)if(e={context:e,memoizedValue:t,next:null},Qn===null){if(Nl===null)throw Error(i(308));Qn=e,Nl.dependencies={lanes:0,firstContext:e}}else Qn=Qn.next=e;return t}var xn=null;function ci(e){xn===null?xn=[e]:xn.push(e)}function fa(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,ci(t)):(n.next=l.next,l.next=n),t.interleaved=n,Vt(e,r)}function Vt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var on=!1;function di(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function pa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function bt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function un(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(ge&2)!==0){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Vt(e,n)}return l=r.interleaved,l===null?(t.next=t,ci(r)):(t.next=l.next,l.next=t),r.interleaved=t,Vt(e,n)}function jl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ro(e,n)}}function ha(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?l=o=a:o=o.next=a,n=n.next}while(n!==null);o===null?l=o=t:o=o.next=t}else l=o=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function _l(e,t,n,r){var l=e.updateQueue;on=!1;var o=l.firstBaseUpdate,a=l.lastBaseUpdate,f=l.shared.pending;if(f!==null){l.shared.pending=null;var v=f,C=v.next;v.next=null,a===null?o=C:a.next=C,a=v;var M=e.alternate;M!==null&&(M=M.updateQueue,f=M.lastBaseUpdate,f!==a&&(f===null?M.firstBaseUpdate=C:f.next=C,M.lastBaseUpdate=v))}if(o!==null){var A=l.baseState;a=0,M=C=v=null,f=o;do{var _=f.lane,W=f.eventTime;if((r&_)===_){M!==null&&(M=M.next={eventTime:W,lane:0,tag:f.tag,payload:f.payload,callback:f.callback,next:null});e:{var X=e,Z=f;switch(_=t,W=n,Z.tag){case 1:if(X=Z.payload,typeof X=="function"){A=X.call(W,A,_);break e}A=X;break e;case 3:X.flags=X.flags&-65537|128;case 0:if(X=Z.payload,_=typeof X=="function"?X.call(W,A,_):X,_==null)break e;A=H({},A,_);break e;case 2:on=!0}}f.callback!==null&&f.lane!==0&&(e.flags|=64,_=l.effects,_===null?l.effects=[f]:_.push(f))}else W={eventTime:W,lane:_,tag:f.tag,payload:f.payload,callback:f.callback,next:null},M===null?(C=M=W,v=A):M=M.next=W,a|=_;if(f=f.next,f===null){if(f=l.shared.pending,f===null)break;_=f,f=_.next,_.next=null,l.lastBaseUpdate=_,l.shared.pending=null}}while(!0);if(M===null&&(v=A),l.baseState=v,l.firstBaseUpdate=C,l.lastBaseUpdate=M,t=l.shared.interleaved,t!==null){l=t;do a|=l.lane,l=l.next;while(l!==t)}else o===null&&(l.shared.lanes=0);En|=a,e.lanes=a,e.memoizedState=A}}function ma(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=gi.transition;gi.transition={};try{e(!1),t()}finally{ke=n,gi.transition=r}}function Da(){return yt().memoizedState}function xh(e,t,n){var r=dn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},za(e))Ia(t,n);else if(n=fa(e,t,n,r),n!==null){var l=tt();Lt(n,e,r,l),Oa(n,t,r)}}function Sh(e,t,n){var r=dn(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(za(e))Ia(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var a=t.lastRenderedState,f=o(a,n);if(l.hasEagerState=!0,l.eagerState=f,Tt(f,a)){var v=t.interleaved;v===null?(l.next=l,ci(t)):(l.next=v.next,v.next=l),t.interleaved=l;return}}catch{}finally{}n=fa(e,t,l,r),n!==null&&(l=tt(),Lt(n,e,r,l),Oa(n,t,r))}}function za(e){var t=e.alternate;return e===Pe||t!==null&&t===Pe}function Ia(e,t){Pr=Al=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Oa(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ro(e,n)}}var zl={readContext:vt,useCallback:Ze,useContext:Ze,useEffect:Ze,useImperativeHandle:Ze,useInsertionEffect:Ze,useLayoutEffect:Ze,useMemo:Ze,useReducer:Ze,useRef:Ze,useState:Ze,useDebugValue:Ze,useDeferredValue:Ze,useTransition:Ze,useMutableSource:Ze,useSyncExternalStore:Ze,useId:Ze,unstable_isNewReconciler:!1},kh={readContext:vt,useCallback:function(e,t){return It().memoizedState=[e,t===void 0?null:t],e},useContext:vt,useEffect:Ta,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Pl(4194308,4,_a.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Pl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Pl(4,2,e,t)},useMemo:function(e,t){var n=It();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=It();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=xh.bind(null,Pe,e),[r.memoizedState,e]},useRef:function(e){var t=It();return e={current:e},t.memoizedState=e},useState:Ca,useDebugValue:Ei,useDeferredValue:function(e){return It().memoizedState=e},useTransition:function(){var e=Ca(!1),t=e[0];return e=wh.bind(null,e[1]),It().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Pe,l=It();if(Le){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),be===null)throw Error(i(349));(kn&30)!==0||wa(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,Ta(Sa.bind(null,r,o,e),[e]),r.flags|=2048,Ir(9,xa.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=It(),t=be.identifierPrefix;if(Le){var n=Ht,r=$t;n=(r&~(1<<32-Rt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Dr++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[Pt]=t,e[Rr]=r,ec(e,t,!1,!1),t.stateNode=e;e:{switch(s=ho(n,r),n){case"dialog":Te("cancel",e),Te("close",e),l=r;break;case"iframe":case"object":case"embed":Te("load",e),l=r;break;case"video":case"audio":for(l=0;lZn&&(t.flags|=128,r=!0,zr(o,!1),t.lanes=4194304)}else{if(!r)if(e=Ml(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),zr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!je)return Ye(t),null}else 2*De()-o.renderingStartTime>Zn&&n!==1073741824&&(t.flags|=128,r=!0,zr(o,!1),t.lanes=4194304);o.isBackwards?(s.sibling=t.child,t.child=s):(n=o.last,n!==null?n.sibling=s:t.child=s,o.last=s)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=De(),t.sibling=null,n=Me.current,Ee(Me,r?n&1|2:n&1),t):(Ye(t),null);case 22:case 23:return Ki(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(dt&1073741824)!==0&&(Ye(t),t.subtreeFlags&6&&(t.flags|=8192)):Ye(t),null;case 24:return null;case 25:return null}throw Error(i(156,t.tag))}function dh(e,t){switch(ti(t),t.tag){case 1:return rt(t.type)&&wl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return bn(),Ne(nt),Ne(be),hi(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return fi(t),null;case 13:if(Ne(Me),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Vn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ne(Me),null;case 4:return bn(),null;case 10:return ui(t.type._context),null;case 22:case 23:return Ki(),null;case 24:return null;default:return null}}var Ul=!1,Xe=!1,fh=typeof WeakSet=="function"?WeakSet:Set,W=null;function Yn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Pe(e,t,r)}else n.current=null}function Di(e,t,n){try{n()}catch(r){Pe(e,t,r)}}var rc=!1;function ph(e,t){if(Ko=ol,e=zs(),Fo(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,d=-1,h=-1,E=0,M=0,L=e,_=null;t:for(;;){for(var U;L!==n||l!==0&&L.nodeType!==3||(d=s+l),L!==o||r!==0&&L.nodeType!==3||(h=s+r),L.nodeType===3&&(s+=L.nodeValue.length),(U=L.firstChild)!==null;)_=L,L=U;for(;;){if(L===e)break t;if(_===n&&++E===l&&(d=s),_===o&&++M===r&&(h=s),(U=L.nextSibling)!==null)break;L=_,_=L.parentNode}L=U}n=d===-1||h===-1?null:{start:d,end:h}}else n=null}n=n||{start:0,end:0}}else n=null;for(bo={focusedElem:e,selectionRange:n},ol=!1,W=t;W!==null;)if(t=W,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,W=e;else for(;W!==null;){t=W;try{var b=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(b!==null){var G=b.memoizedProps,ze=b.memoizedState,w=t.stateNode,g=w.getSnapshotBeforeUpdate(t.elementType===t.type?G:Ct(t.type,G),ze);w.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(A){Pe(t,t.return,A)}if(e=t.sibling,e!==null){e.return=t.return,W=e;break}W=t.return}return b=rc,rc=!1,b}function Or(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&Di(t,n,o)}l=l.next}while(l!==r)}}function Bl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function zi(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function lc(e){var t=e.alternate;t!==null&&(e.alternate=null,lc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Pt],delete t[Rr],delete t[Zo],delete t[Yp],delete t[Xp])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function oc(e){return e.tag===5||e.tag===3||e.tag===4}function ic(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||oc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Oi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=vl));else if(r!==4&&(e=e.child,e!==null))for(Oi(e,t,n),e=e.sibling;e!==null;)Oi(e,t,n),e=e.sibling}function Ii(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Ii(e,t,n),e=e.sibling;e!==null;)Ii(e,t,n),e=e.sibling}var Qe=null,Rt=!1;function un(e,t,n){for(n=n.child;n!==null;)uc(e,t,n),n=n.sibling}function uc(e,t,n){if(Lt&&typeof Lt.onCommitFiberUnmount=="function")try{Lt.onCommitFiberUnmount(qr,n)}catch{}switch(n.tag){case 5:Xe||Yn(n,t);case 6:var r=Qe,l=Rt;Qe=null,un(e,t,n),Qe=r,Rt=l,Qe!==null&&(Rt?(e=Qe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Qe.removeChild(n.stateNode));break;case 18:Qe!==null&&(Rt?(e=Qe,n=n.stateNode,e.nodeType===8?Xo(e.parentNode,n):e.nodeType===1&&Xo(e,n),hr(e)):Xo(Qe,n.stateNode));break;case 4:r=Qe,l=Rt,Qe=n.stateNode.containerInfo,Rt=!0,un(e,t,n),Qe=r,Rt=l;break;case 0:case 11:case 14:case 15:if(!Xe&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,s=o.destroy;o=o.tag,s!==void 0&&((o&2)!==0||(o&4)!==0)&&Di(n,t,s),l=l.next}while(l!==r)}un(e,t,n);break;case 1:if(!Xe&&(Yn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(d){Pe(n,t,d)}un(e,t,n);break;case 21:un(e,t,n);break;case 22:n.mode&1?(Xe=(r=Xe)||n.memoizedState!==null,un(e,t,n),Xe=r):un(e,t,n);break;default:un(e,t,n)}}function sc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new fh),t.forEach(function(r){var l=kh.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Tt(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=s),r&=~o}if(r=l,r=De()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*mh(r/1960))-r,10e?16:e,an===null)var r=!1;else{if(e=an,an=null,Ql=0,(he&6)!==0)throw Error(i(331));var l=he;for(he|=4,W=e.current;W!==null;){var o=W,s=o.child;if((W.flags&16)!==0){var d=o.deletions;if(d!==null){for(var h=0;hDe()-Bi?Rn(e,0):Ui|=n),it(e,t)}function Sc(e,t){t===0&&((e.mode&1)===0?t=1:(t=tl,tl<<=1,(tl&130023424)===0&&(tl=4194304)));var n=qe();e=$t(e,t),e!==null&&(ar(e,t,n),it(e,n))}function Sh(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Sc(e,n)}function kh(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(i(314))}r!==null&&r.delete(t),Sc(e,n)}var kc;kc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||nt.current)lt=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return lt=!1,ah(e,t,n);lt=(e.flags&131072)!==0}else lt=!1,je&&(t.flags&1048576)!==0&&ta(t,El,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Fl(e,t),e=t.pendingProps;var l=Bn(t,be.current);Kn(t,n),l=vi(null,t,r,e,l,n);var o=yi();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,rt(r)?(o=!0,xl(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,ci(t),l.updater=Ol,t.stateNode=l,l._reactInternals=t,Ci(t,r,e,n),t=ji(null,t,r,!0,o,n)):(t.tag=0,je&&o&&ei(t),Je(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Fl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Ch(r),e=Ct(r,e),l){case 0:t=Ni(null,t,r,e,n);break e;case 1:t=Ga(null,t,r,e,n);break e;case 11:t=Va(null,t,r,e,n);break e;case 14:t=Wa(null,t,r,Ct(r.type,e),n);break e}throw Error(i(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ct(r,l),Ni(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ct(r,l),Ga(e,t,r,l,n);case 3:e:{if(Ya(t),e===null)throw Error(i(387));r=t.pendingProps,o=t.memoizedState,l=o.element,ca(e,t),_l(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=Gn(Error(i(423)),t),t=Xa(e,t,r,n,l);break e}else if(r!==l){l=Gn(Error(i(424)),t),t=Xa(e,t,r,n,l);break e}else for(ct=en(t.stateNode.containerInfo.firstChild),at=t,je=!0,Et=null,n=sa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Vn(),r===l){t=Wt(e,t,n);break e}Je(e,t,r,n)}t=t.child}return t;case 5:return pa(t),e===null&&ri(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,s=l.children,Go(r,l)?s=null:o!==null&&Go(r,o)&&(t.flags|=32),ba(e,t),Je(e,t,s,n),t.child;case 6:return e===null&&ri(t),null;case 13:return Za(e,t,n);case 4:return di(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Wn(t,null,r,n):Je(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ct(r,l),Va(e,t,r,l,n);case 7:return Je(e,t,t.pendingProps,n),t.child;case 8:return Je(e,t,t.pendingProps.children,n),t.child;case 12:return Je(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,s=l.value,Ee(Tl,r._currentValue),r._currentValue=s,o!==null)if(kt(o.value,s)){if(o.children===l.children&&!nt.current){t=Wt(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var d=o.dependencies;if(d!==null){s=o.child;for(var h=d.firstContext;h!==null;){if(h.context===r){if(o.tag===1){h=Vt(-1,n&-n),h.tag=2;var E=o.updateQueue;if(E!==null){E=E.shared;var M=E.pending;M===null?h.next=h:(h.next=M.next,M.next=h),E.pending=h}}o.lanes|=n,h=o.alternate,h!==null&&(h.lanes|=n),si(o.return,n,t),d.lanes|=n;break}h=h.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(i(341));s.lanes|=n,d=s.alternate,d!==null&&(d.lanes|=n),si(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}Je(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,Kn(t,n),l=gt(l),r=r(l),t.flags|=1,Je(e,t,r,n),t.child;case 14:return r=t.type,l=Ct(r,t.pendingProps),l=Ct(r.type,l),Wa(e,t,r,l,n);case 15:return Qa(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ct(r,l),Fl(e,t),t.tag=1,rt(r)?(e=!0,xl(t)):e=!1,Kn(t,n),Oa(t,r,l),Ci(t,r,l,n),ji(null,t,r,!0,e,n);case 19:return qa(e,t,n);case 22:return Ka(e,t,n)}throw Error(i(156,t.tag))};function Ec(e,t){return ns(e,t)}function Eh(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function wt(e,t,n,r){return new Eh(e,t,n,r)}function Gi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ch(e){if(typeof e=="function")return Gi(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ce)return 11;if(e===ye)return 14}return 2}function fn(e,t){var n=e.alternate;return n===null?(n=wt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Yl(e,t,n,r,l,o){var s=2;if(r=e,typeof e=="function")Gi(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case ae:return Nn(n.children,l,o,t);case Z:s=8,l|=8;break;case xe:return e=wt(12,n,t,l|2),e.elementType=xe,e.lanes=o,e;case ve:return e=wt(13,n,t,l),e.elementType=ve,e.lanes=o,e;case Re:return e=wt(19,n,t,l),e.elementType=Re,e.lanes=o,e;case ge:return Xl(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case pe:s=10;break e;case Se:s=9;break e;case Ce:s=11;break e;case ye:s=14;break e;case _e:s=16,r=null;break e}throw Error(i(130,e==null?e:typeof e,""))}return t=wt(s,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function Nn(e,t,n,r){return e=wt(7,e,r,t),e.lanes=n,e}function Xl(e,t,n,r){return e=wt(22,e,r,t),e.elementType=ge,e.lanes=n,e.stateNode={isHidden:!1},e}function Yi(e,t,n){return e=wt(6,e,null,t),e.lanes=n,e}function Xi(e,t,n){return t=wt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Rh(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Eo(0),this.expirationTimes=Eo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Eo(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Zi(e,t,n,r,l,o,s,d,h){return e=new Rh(e,t,n,d,h),t===1?(t=1,o===!0&&(t|=8)):t=0,o=wt(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ci(o),e}function Th(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(u)}catch(a){console.error(a)}}return u(),oo.exports=Dc(),oo.exports}var au;function Oc(){if(au)return Hr;au=1;var u=zc();return Hr.createRoot=u.createRoot,Hr.hydrateRoot=u.hydrateRoot,Hr}var cu=Oc(),R=lo();class tt extends Error{constructor(a,i,c,f){super(a),this.status=i,this.code=c,this.retryAfter=f,this.name="ChatApiError"}}class so extends Error{constructor(){super("Request debounced"),this.name="DebounceError"}}const Ic=3e4;function Fc(u,a){const i=atob(u),c=new Uint8Array(i.length);for(let f=0;f0&&Date.now()-this.lastSendTime({})),v=f.headers.get("Retry-After"),k=v?Number(v):void 0;if(i=new tt(p.error??`Request failed with status ${f.status}`,f.status,p.code,k),!this.isRetryable(f.status))throw i;if(c{var v;return(v=p.attachments)==null?void 0:v.some(k=>!!k.data)}))return{headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:a})};const c=new FormData,f=a.map(p=>p.attachments?{...p,attachments:p.attachments.map(v=>{const k={...v};return delete k.data,k})}:p);c.append("payload",JSON.stringify({messages:f}));for(const p of a)for(const v of p.attachments??[])v.data&&c.append(v.id,Fc(v.data,v.mediaType),v.name);return{body:c}}async streamMessage(a,i={}){var f;if(typeof ReadableStream>"u")return this.sendMessage(a);if(this.debounceMs>0&&Date.now()-this.lastSendTime({})),N=v.headers.get("Retry-After");if(c=new tt(S.error??`Request failed with status ${v.status}`,v.status,S.code,N?Number(N):void 0),!this.isRetryable(v.status))throw c;p{c.cancel().catch(()=>{})};(j=i.signal)==null||j.addEventListener("abort",N,{once:!0});try{for(;;){let $;try{$=await c.read()}catch(B){if((O=i.signal)!=null&&O.aborted)break;throw B}if((V=i.signal)!=null&&V.aborted||$.done)break;p+=f.decode($.value,{stream:!0});let J;for(;(J=p.indexOf(` +`+o.stack}return{value:e,source:t,stack:l,digest:null}}function Ti(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ni(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Rh=typeof WeakMap=="function"?WeakMap:Map;function $a(e,t,n){n=bt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Vl||(Vl=!0,Hi=r),Ni(e,t)},n}function Ha(e,t,n){n=bt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var l=t.value;n.payload=function(){return r(l)},n.callback=function(){Ni(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){Ni(e,t),typeof r!="function"&&(an===null?an=new Set([this]):an.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function Va(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Rh;var l=new Set;r.set(t,l)}else l=r.get(t),l===void 0&&(l=new Set,r.set(t,l));l.has(n)||(l.add(n),e=Uh.bind(null,e,t,n),t.then(e,e))}function ba(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Wa(e,t,n,r,l){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=bt(-1,1),t.tag=2,un(n,t,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=l,e)}var Th=$.ReactCurrentOwner,ut=!1;function et(e,t,n,r){t.child=e===null?da(t,null,n,r):Wn(t,e.child,n,r)}function Qa(e,t,n,r,l){n=n.render;var o=t.ref;return Kn(t,l),r=yi(e,t,n,r,o,l),n=wi(),e!==null&&!ut?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Wt(e,t,l)):(Le&&n&&ti(t),t.flags|=1,et(e,t,r,l),t.child)}function Ka(e,t,n,r,l){if(e===null){var o=n.type;return typeof o=="function"&&!Yi(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,Ga(e,t,o,r,l)):(e=Yl(n.type,null,r,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,(e.lanes&l)===0){var a=o.memoizedProps;if(n=n.compare,n=n!==null?n:kr,n(a,r)&&e.ref===t.ref)return Wt(e,t,l)}return t.flags|=1,e=pn(o,r),e.ref=t.ref,e.return=t,t.child=e}function Ga(e,t,n,r,l){if(e!==null){var o=e.memoizedProps;if(kr(o,r)&&e.ref===t.ref)if(ut=!1,t.pendingProps=r=o,(e.lanes&l)!==0)(e.flags&131072)!==0&&(ut=!0);else return t.lanes=e.lanes,Wt(e,t,l)}return ji(e,t,n,r,l)}function Ya(e,t,n){var r=t.pendingProps,l=r.children,o=e!==null?e.memoizedState:null;if(r.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Te(Zn,pt),pt|=n;else{if((n&1073741824)===0)return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Te(Zn,pt),pt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,Te(Zn,pt),pt|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,Te(Zn,pt),pt|=r;return et(e,t,l,n),t.child}function Xa(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function ji(e,t,n,r,l){var o=it(n)?vn:Xe.current;return o=$n(t,o),Kn(t,l),n=yi(e,t,n,r,o,l),r=wi(),e!==null&&!ut?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Wt(e,t,l)):(Le&&r&&ti(t),t.flags|=1,et(e,t,n,l),t.child)}function Za(e,t,n,r,l){if(it(n)){var o=!0;xl(t)}else o=!1;if(Kn(t,l),t.stateNode===null)Fl(e,t),Ua(t,n,r),Ri(t,n,r,l),r=!0;else if(e===null){var a=t.stateNode,f=t.memoizedProps;a.props=f;var v=a.context,C=n.contextType;typeof C=="object"&&C!==null?C=vt(C):(C=it(n)?vn:Xe.current,C=$n(t,C));var M=n.getDerivedStateFromProps,A=typeof M=="function"||typeof a.getSnapshotBeforeUpdate=="function";A||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(f!==r||v!==C)&&Ba(t,a,r,C),on=!1;var _=t.memoizedState;a.state=_,_l(t,r,a,l),v=t.memoizedState,f!==r||_!==v||ot.current||on?(typeof M=="function"&&(Ci(t,n,M,r),v=t.memoizedState),(f=on||Fa(t,n,f,r,_,v,C))?(A||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=v),a.props=r,a.state=v,a.context=C,r=f):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,pa(e,t),f=t.memoizedProps,C=t.type===t.elementType?f:jt(t.type,f),a.props=C,A=t.pendingProps,_=a.context,v=n.contextType,typeof v=="object"&&v!==null?v=vt(v):(v=it(n)?vn:Xe.current,v=$n(t,v));var W=n.getDerivedStateFromProps;(M=typeof W=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(f!==A||_!==v)&&Ba(t,a,r,v),on=!1,_=t.memoizedState,a.state=_,_l(t,r,a,l);var X=t.memoizedState;f!==A||_!==X||ot.current||on?(typeof W=="function"&&(Ci(t,n,W,r),X=t.memoizedState),(C=on||Fa(t,n,C,r,_,X,v)||!1)?(M||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,X,v),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,X,v)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||f===e.memoizedProps&&_===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&_===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=X),a.props=r,a.state=X,a.context=v,r=C):(typeof a.componentDidUpdate!="function"||f===e.memoizedProps&&_===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&_===e.memoizedState||(t.flags|=1024),r=!1)}return _i(e,t,n,r,o,l)}function _i(e,t,n,r,l,o){Xa(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return l&&na(t,n,!1),Wt(e,t,o);r=t.stateNode,Th.current=t;var f=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=Wn(t,e.child,null,o),t.child=Wn(t,null,f,o)):et(e,t,f,o),t.memoizedState=r.state,l&&na(t,n,!0),t.child}function Ja(e){var t=e.stateNode;t.pendingContext?ea(e,t.pendingContext,t.pendingContext!==t.context):t.context&&ea(e,t.context,!1),fi(e,t.containerInfo)}function qa(e,t,n,r,l){return bn(),oi(l),t.flags|=256,et(e,t,n,r),t.child}var Mi={dehydrated:null,treeContext:null,retryLane:0};function Li(e){return{baseLanes:e,cachePool:null,transitions:null}}function ec(e,t,n){var r=t.pendingProps,l=Ae.current,o=!1,a=(t.flags&128)!==0,f;if((f=a)||(f=e!==null&&e.memoizedState===null?!1:(l&2)!==0),f?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),Te(Ae,l&1),e===null)return li(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((t.mode&1)===0?t.lanes=1:e.data==="$!"?t.lanes=8:t.lanes=1073741824,null):(a=r.children,e=r.fallback,o?(r=t.mode,o=t.child,a={mode:"hidden",children:a},(r&1)===0&&o!==null?(o.childLanes=0,o.pendingProps=a):o=Xl(a,r,0,null),e=Nn(e,r,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=Li(n),t.memoizedState=Mi,e):Ai(t,a));if(l=e.memoizedState,l!==null&&(f=l.dehydrated,f!==null))return Nh(e,t,a,r,f,l,n);if(o){o=r.fallback,a=t.mode,l=e.child,f=l.sibling;var v={mode:"hidden",children:r.children};return(a&1)===0&&t.child!==l?(r=t.child,r.childLanes=0,r.pendingProps=v,t.deletions=null):(r=pn(l,v),r.subtreeFlags=l.subtreeFlags&14680064),f!==null?o=pn(f,o):(o=Nn(o,a,n,null),o.flags|=2),o.return=t,r.return=t,r.sibling=o,t.child=r,r=o,o=t.child,a=e.child.memoizedState,a=a===null?Li(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},o.memoizedState=a,o.childLanes=e.childLanes&~n,t.memoizedState=Mi,r}return o=e.child,e=o.sibling,r=pn(o,{mode:"visible",children:r.children}),(t.mode&1)===0&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Ai(e,t){return t=Xl({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Ol(e,t,n,r){return r!==null&&oi(r),Wn(t,e.child,null,n),e=Ai(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Nh(e,t,n,r,l,o,a){if(n)return t.flags&256?(t.flags&=-257,r=Ti(Error(i(422))),Ol(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=r.fallback,l=t.mode,r=Xl({mode:"visible",children:r.children},l,0,null),o=Nn(o,l,a,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,(t.mode&1)!==0&&Wn(t,e.child,null,a),t.child.memoizedState=Li(a),t.memoizedState=Mi,o);if((t.mode&1)===0)return Ol(e,t,a,null);if(l.data==="$!"){if(r=l.nextSibling&&l.nextSibling.dataset,r)var f=r.dgst;return r=f,o=Error(i(419)),r=Ti(o,r,void 0),Ol(e,t,a,r)}if(f=(a&e.childLanes)!==0,ut||f){if(r=be,r!==null){switch(a&-a){case 4:l=2;break;case 16:l=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:l=32;break;case 536870912:l=268435456;break;default:l=0}l=(l&(r.suspendedLanes|a))!==0?0:l,l!==0&&l!==o.retryLane&&(o.retryLane=l,Vt(e,l),Lt(r,e,l,-1))}return Gi(),r=Ti(Error(i(421))),Ol(e,t,a,r)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=Bh.bind(null,e),l._reactRetry=t,null):(e=o.treeContext,ft=tn(l.nextSibling),dt=t,Le=!0,Nt=null,e!==null&&(mt[gt++]=$t,mt[gt++]=Ht,mt[gt++]=yn,$t=e.id,Ht=e.overflow,yn=t),t=Ai(t,r.children),t.flags|=4096,t)}function tc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),ai(e.return,t,n)}function Pi(e,t,n,r,l){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:l}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=l)}function nc(e,t,n){var r=t.pendingProps,l=r.revealOrder,o=r.tail;if(et(e,t,r.children,n),r=Ae.current,(r&2)!==0)r=r&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&tc(e,n,t);else if(e.tag===19)tc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Te(Ae,r),(t.mode&1)===0)t.memoizedState=null;else switch(l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&Ml(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),Pi(t,!1,l,n,o);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&Ml(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}Pi(t,!0,n,null,o);break;case"together":Pi(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Fl(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Wt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),En|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=pn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=pn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function jh(e,t,n){switch(t.tag){case 3:Ja(t),bn();break;case 5:ga(t);break;case 1:it(t.type)&&xl(t);break;case 4:fi(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,l=t.memoizedProps.value;Te(Tl,r._currentValue),r._currentValue=l;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Te(Ae,Ae.current&1),t.flags|=128,null):(n&t.child.childLanes)!==0?ec(e,t,n):(Te(Ae,Ae.current&1),e=Wt(e,t,n),e!==null?e.sibling:null);Te(Ae,Ae.current&1);break;case 19:if(r=(n&t.childLanes)!==0,(e.flags&128)!==0){if(r)return nc(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),Te(Ae,Ae.current),r)break;return null;case 22:case 23:return t.lanes=0,Ya(e,t,n)}return Wt(e,t,n)}var rc,Di,lc,oc;rc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Di=function(){},lc=function(e,t,n,r){var l=e.memoizedProps;if(l!==r){e=t.stateNode,Sn(zt.current);var o=null;switch(n){case"input":l=Be(e,l),r=Be(e,r),o=[];break;case"select":l=H({},l,{value:void 0}),r=H({},r,{value:void 0}),o=[];break;case"textarea":l=ht(e,l),r=ht(e,r),o=[];break;default:typeof l.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=vl)}ho(n,r);var a;n=null;for(C in l)if(!r.hasOwnProperty(C)&&l.hasOwnProperty(C)&&l[C]!=null)if(C==="style"){var f=l[C];for(a in f)f.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else C!=="dangerouslySetInnerHTML"&&C!=="children"&&C!=="suppressContentEditableWarning"&&C!=="suppressHydrationWarning"&&C!=="autoFocus"&&(d.hasOwnProperty(C)?o||(o=[]):(o=o||[]).push(C,null));for(C in r){var v=r[C];if(f=l!=null?l[C]:void 0,r.hasOwnProperty(C)&&v!==f&&(v!=null||f!=null))if(C==="style")if(f){for(a in f)!f.hasOwnProperty(a)||v&&v.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in v)v.hasOwnProperty(a)&&f[a]!==v[a]&&(n||(n={}),n[a]=v[a])}else n||(o||(o=[]),o.push(C,n)),n=v;else C==="dangerouslySetInnerHTML"?(v=v?v.__html:void 0,f=f?f.__html:void 0,v!=null&&f!==v&&(o=o||[]).push(C,v)):C==="children"?typeof v!="string"&&typeof v!="number"||(o=o||[]).push(C,""+v):C!=="suppressContentEditableWarning"&&C!=="suppressHydrationWarning"&&(d.hasOwnProperty(C)?(v!=null&&C==="onScroll"&&je("scroll",e),o||f===v||(o=[])):(o=o||[]).push(C,v))}n&&(o=o||[]).push("style",n);var C=o;(t.updateQueue=C)&&(t.flags|=4)}},oc=function(e,t,n,r){n!==r&&(t.flags|=4)};function Or(e,t){if(!Le)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Je(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags&14680064,r|=l.flags&14680064,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags,r|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function _h(e,t,n){var r=t.pendingProps;switch(ni(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Je(t),null;case 1:return it(t.type)&&wl(),Je(t),null;case 3:return r=t.stateNode,Gn(),_e(ot),_e(Xe),mi(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Cl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Nt!==null&&(Wi(Nt),Nt=null))),Di(e,t),Je(t),null;case 5:pi(t);var l=Sn(Ar.current);if(n=t.type,e!==null&&t.stateNode!=null)lc(e,t,n,r,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Je(t),null}if(e=Sn(zt.current),Cl(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[Dt]=t,r[Nr]=o,e=(t.mode&1)!==0,n){case"dialog":je("cancel",r),je("close",r);break;case"iframe":case"object":case"embed":je("load",r);break;case"video":case"audio":for(l=0;l<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[Dt]=t,e[Nr]=r,rc(e,t,!1,!1),t.stateNode=e;e:{switch(a=mo(n,r),n){case"dialog":je("cancel",e),je("close",e),l=r;break;case"iframe":case"object":case"embed":je("load",e),l=r;break;case"video":case"audio":for(l=0;lJn&&(t.flags|=128,r=!0,Or(o,!1),t.lanes=4194304)}else{if(!r)if(e=Ml(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Or(o,!0),o.tail===null&&o.tailMode==="hidden"&&!a.alternate&&!Le)return Je(t),null}else 2*Oe()-o.renderingStartTime>Jn&&n!==1073741824&&(t.flags|=128,r=!0,Or(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(n=o.last,n!==null?n.sibling=a:t.child=a,o.last=a)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Oe(),t.sibling=null,n=Ae.current,Te(Ae,r?n&1|2:n&1),t):(Je(t),null);case 22:case 23:return Ki(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(pt&1073741824)!==0&&(Je(t),t.subtreeFlags&6&&(t.flags|=8192)):Je(t),null;case 24:return null;case 25:return null}throw Error(i(156,t.tag))}function Mh(e,t){switch(ni(t),t.tag){case 1:return it(t.type)&&wl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Gn(),_e(ot),_e(Xe),mi(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return pi(t),null;case 13:if(_e(Ae),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));bn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return _e(Ae),null;case 4:return Gn(),null;case 10:return si(t.type._context),null;case 22:case 23:return Ki(),null;case 24:return null;default:return null}}var Ul=!1,qe=!1,Lh=typeof WeakSet=="function"?WeakSet:Set,Q=null;function Xn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ie(e,t,r)}else n.current=null}function zi(e,t,n){try{n()}catch(r){Ie(e,t,r)}}var ic=!1;function Ah(e,t){if(Ko=ol,e=Fs(),Uo(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var a=0,f=-1,v=-1,C=0,M=0,A=e,_=null;t:for(;;){for(var W;A!==n||l!==0&&A.nodeType!==3||(f=a+l),A!==o||r!==0&&A.nodeType!==3||(v=a+r),A.nodeType===3&&(a+=A.nodeValue.length),(W=A.firstChild)!==null;)_=A,A=W;for(;;){if(A===e)break t;if(_===n&&++C===l&&(f=a),_===o&&++M===r&&(v=a),(W=A.nextSibling)!==null)break;A=_,_=A.parentNode}A=W}n=f===-1||v===-1?null:{start:f,end:v}}else n=null}n=n||{start:0,end:0}}else n=null;for(Go={focusedElem:e,selectionRange:n},ol=!1,Q=t;Q!==null;)if(t=Q,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Q=e;else for(;Q!==null;){t=Q;try{var X=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(X!==null){var Z=X.memoizedProps,Fe=X.memoizedState,S=t.stateNode,y=S.getSnapshotBeforeUpdate(t.elementType===t.type?Z:jt(t.type,Z),Fe);S.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var k=t.stateNode.containerInfo;k.nodeType===1?k.textContent="":k.nodeType===9&&k.documentElement&&k.removeChild(k.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(P){Ie(t,t.return,P)}if(e=t.sibling,e!==null){e.return=t.return,Q=e;break}Q=t.return}return X=ic,ic=!1,X}function Fr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&zi(t,n,o)}l=l.next}while(l!==r)}}function Bl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Ii(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function uc(e){var t=e.alternate;t!==null&&(e.alternate=null,uc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Dt],delete t[Nr],delete t[Jo],delete t[hh],delete t[mh])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function sc(e){return e.tag===5||e.tag===3||e.tag===4}function ac(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||sc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Oi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=vl));else if(r!==4&&(e=e.child,e!==null))for(Oi(e,t,n),e=e.sibling;e!==null;)Oi(e,t,n),e=e.sibling}function Fi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Fi(e,t,n),e=e.sibling;e!==null;)Fi(e,t,n),e=e.sibling}var Ke=null,_t=!1;function sn(e,t,n){for(n=n.child;n!==null;)cc(e,t,n),n=n.sibling}function cc(e,t,n){if(Pt&&typeof Pt.onCommitFiberUnmount=="function")try{Pt.onCommitFiberUnmount(qr,n)}catch{}switch(n.tag){case 5:qe||Xn(n,t);case 6:var r=Ke,l=_t;Ke=null,sn(e,t,n),Ke=r,_t=l,Ke!==null&&(_t?(e=Ke,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ke.removeChild(n.stateNode));break;case 18:Ke!==null&&(_t?(e=Ke,n=n.stateNode,e.nodeType===8?Zo(e.parentNode,n):e.nodeType===1&&Zo(e,n),gr(e)):Zo(Ke,n.stateNode));break;case 4:r=Ke,l=_t,Ke=n.stateNode.containerInfo,_t=!0,sn(e,t,n),Ke=r,_t=l;break;case 0:case 11:case 14:case 15:if(!qe&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,a=o.destroy;o=o.tag,a!==void 0&&((o&2)!==0||(o&4)!==0)&&zi(n,t,a),l=l.next}while(l!==r)}sn(e,t,n);break;case 1:if(!qe&&(Xn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(f){Ie(n,t,f)}sn(e,t,n);break;case 21:sn(e,t,n);break;case 22:n.mode&1?(qe=(r=qe)||n.memoizedState!==null,sn(e,t,n),qe=r):sn(e,t,n);break;default:sn(e,t,n)}}function dc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Lh),t.forEach(function(r){var l=$h.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Mt(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=a),r&=~o}if(r=l,r=Oe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Dh(r/1960))-r,10e?16:e,cn===null)var r=!1;else{if(e=cn,cn=null,Wl=0,(ge&6)!==0)throw Error(i(331));var l=ge;for(ge|=4,Q=e.current;Q!==null;){var o=Q,a=o.child;if((Q.flags&16)!==0){var f=o.deletions;if(f!==null){for(var v=0;vOe()-$i?Rn(e,0):Bi|=n),at(e,t)}function Cc(e,t){t===0&&((e.mode&1)===0?t=1:(t=tl,tl<<=1,(tl&130023424)===0&&(tl=4194304)));var n=tt();e=Vt(e,t),e!==null&&(dr(e,t,n),at(e,n))}function Bh(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Cc(e,n)}function $h(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(i(314))}r!==null&&r.delete(t),Cc(e,n)}var Rc;Rc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ot.current)ut=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return ut=!1,jh(e,t,n);ut=(e.flags&131072)!==0}else ut=!1,Le&&(t.flags&1048576)!==0&&la(t,El,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Fl(e,t),e=t.pendingProps;var l=$n(t,Xe.current);Kn(t,n),l=yi(null,t,r,e,l,n);var o=wi();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,it(r)?(o=!0,xl(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,di(t),l.updater=Il,t.stateNode=l,l._reactInternals=t,Ri(t,r,e,n),t=_i(null,t,r,!0,o,n)):(t.tag=0,Le&&o&&ti(t),et(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Fl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Vh(r),e=jt(r,e),l){case 0:t=ji(null,t,r,e,n);break e;case 1:t=Za(null,t,r,e,n);break e;case 11:t=Qa(null,t,r,e,n);break e;case 14:t=Ka(null,t,r,jt(r.type,e),n);break e}throw Error(i(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:jt(r,l),ji(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:jt(r,l),Za(e,t,r,l,n);case 3:e:{if(Ja(t),e===null)throw Error(i(387));r=t.pendingProps,o=t.memoizedState,l=o.element,pa(e,t),_l(t,r,null,n);var a=t.memoizedState;if(r=a.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=Yn(Error(i(423)),t),t=qa(e,t,r,n,l);break e}else if(r!==l){l=Yn(Error(i(424)),t),t=qa(e,t,r,n,l);break e}else for(ft=tn(t.stateNode.containerInfo.firstChild),dt=t,Le=!0,Nt=null,n=da(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(bn(),r===l){t=Wt(e,t,n);break e}et(e,t,r,n)}t=t.child}return t;case 5:return ga(t),e===null&&li(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,a=l.children,Yo(r,l)?a=null:o!==null&&Yo(r,o)&&(t.flags|=32),Xa(e,t),et(e,t,a,n),t.child;case 6:return e===null&&li(t),null;case 13:return ec(e,t,n);case 4:return fi(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Wn(t,null,r,n):et(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:jt(r,l),Qa(e,t,r,l,n);case 7:return et(e,t,t.pendingProps,n),t.child;case 8:return et(e,t,t.pendingProps.children,n),t.child;case 12:return et(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,a=l.value,Te(Tl,r._currentValue),r._currentValue=a,o!==null)if(Tt(o.value,a)){if(o.children===l.children&&!ot.current){t=Wt(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var f=o.dependencies;if(f!==null){a=o.child;for(var v=f.firstContext;v!==null;){if(v.context===r){if(o.tag===1){v=bt(-1,n&-n),v.tag=2;var C=o.updateQueue;if(C!==null){C=C.shared;var M=C.pending;M===null?v.next=v:(v.next=M.next,M.next=v),C.pending=v}}o.lanes|=n,v=o.alternate,v!==null&&(v.lanes|=n),ai(o.return,n,t),f.lanes|=n;break}v=v.next}}else if(o.tag===10)a=o.type===t.type?null:o.child;else if(o.tag===18){if(a=o.return,a===null)throw Error(i(341));a.lanes|=n,f=a.alternate,f!==null&&(f.lanes|=n),ai(a,n,t),a=o.sibling}else a=o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===t){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}et(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,Kn(t,n),l=vt(l),r=r(l),t.flags|=1,et(e,t,r,n),t.child;case 14:return r=t.type,l=jt(r,t.pendingProps),l=jt(r.type,l),Ka(e,t,r,l,n);case 15:return Ga(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:jt(r,l),Fl(e,t),t.tag=1,it(r)?(e=!0,xl(t)):e=!1,Kn(t,n),Ua(t,r,l),Ri(t,r,l,n),_i(null,t,r,!0,e,n);case 19:return nc(e,t,n);case 22:return Ya(e,t,n)}throw Error(i(156,t.tag))};function Tc(e,t){return os(e,t)}function Hh(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xt(e,t,n,r){return new Hh(e,t,n,r)}function Yi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Vh(e){if(typeof e=="function")return Yi(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ye)return 11;if(e===Ne)return 14}return 2}function pn(e,t){var n=e.alternate;return n===null?(n=xt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Yl(e,t,n,r,l,o){var a=2;if(r=e,typeof e=="function")Yi(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case ee:return Nn(n.children,l,o,t);case ae:a=8,l|=8;break;case te:return e=xt(12,n,t,l|2),e.elementType=te,e.lanes=o,e;case Ee:return e=xt(13,n,t,l),e.elementType=Ee,e.lanes=o,e;case Re:return e=xt(19,n,t,l),e.elementType=Re,e.lanes=o,e;case ce:return Xl(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case De:a=10;break e;case me:a=9;break e;case ye:a=11;break e;case Ne:a=14;break e;case we:a=16,r=null;break e}throw Error(i(130,e==null?e:typeof e,""))}return t=xt(a,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function Nn(e,t,n,r){return e=xt(7,e,r,t),e.lanes=n,e}function Xl(e,t,n,r){return e=xt(22,e,r,t),e.elementType=ce,e.lanes=n,e.stateNode={isHidden:!1},e}function Xi(e,t,n){return e=xt(6,e,null,t),e.lanes=n,e}function Zi(e,t,n){return t=xt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function bh(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Co(0),this.expirationTimes=Co(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Co(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Ji(e,t,n,r,l,o,a,f,v){return e=new bh(e,t,n,f,v),t===1?(t=1,o===!0&&(t|=8)):t=0,o=xt(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},di(o),e}function Wh(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(u)}catch(s){console.error(s)}}return u(),oo.exports=Oc(),oo.exports}var cu;function Uc(){if(cu)return Vr;cu=1;var u=Fc();return Vr.createRoot=u.createRoot,Vr.hydrateRoot=u.hydrateRoot,Vr}var du=Uc(),E=lo();class rt extends Error{constructor(s,i,c,d){super(s),this.status=i,this.code=c,this.retryAfter=d,this.name="ChatApiError"}}class so extends Error{constructor(){super("Request debounced"),this.name="DebounceError"}}const Bc=3e4;function $c(u,s){const i=atob(u),c=new Uint8Array(i.length);for(let d=0;d0&&Date.now()-this.lastSendTime({})),m=d.headers.get("Retry-After"),w=m?Number(m):void 0;if(i=new rt(h.error??`Request failed with status ${d.status}`,d.status,h.code,w),!this.isRetryable(d.status))throw i;if(c{var w;return(w=m.attachments)==null?void 0:w.some(x=>!!x.data)}),c=this.citations?{citations:!0}:{};if(!i)return{headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:s,...c})};const d=new FormData,h=s.map(m=>m.attachments?{...m,attachments:m.attachments.map(w=>{const x={...w};return delete x.data,x})}:m);d.append("payload",JSON.stringify({messages:h,...c}));for(const m of s)for(const w of m.attachments??[])w.data&&d.append(w.id,$c(w.data,w.mediaType),w.name);return{body:d}}async streamMessage(s,i={}){var d;if(typeof ReadableStream>"u")return this.sendMessage(s);if(this.debounceMs>0&&Date.now()-this.lastSendTime({})),R=m.headers.get("Retry-After");if(c=new rt(x.error??`Request failed with status ${m.status}`,m.status,x.code,R?Number(R):void 0),!this.isRetryable(m.status))throw c;h{c.cancel().catch(()=>{})};(F=i.signal)==null||F.addEventListener("abort",j,{once:!0});try{for(;;){let b;try{b=await c.read()}catch(se){if((U=i.signal)!=null&&U.aborted)break;throw se}if((O=i.signal)!=null&&O.aborted||b.done)break;h+=d.decode(b.value,{stream:!0});let $;for(;($=h.indexOf(` -`))!==-1;){const B=p.slice(0,J);p=p.slice(J+2);const Q=Bc(B);if(Q){if(Q.event==="chunk"){const ue=typeof Q.data.text=="string"?Q.data.text:"";ue&&(v+=ue,(I=i.onChunk)==null||I.call(i,ue,v))}else if(Q.event==="tool"){if(typeof Q.data.name=="string"){const ue=Q.data;k.push(ue),(D=i.onToolUse)==null||D.call(i,ue,k)}}else if(Q.event==="done"){const ue=Array.isArray(Q.data.toolUses)?Q.data.toolUses:k;S={reply:typeof Q.data.reply=="string"?Q.data.reply:v,sources:Q.data.sources,...ue.length>0?{toolUses:ue}:{},...Array.isArray(Q.data.attachments)?{attachments:Q.data.attachments}:{}}}else if(Q.event==="error")throw new tt(typeof Q.data.error=="string"?Q.data.error:"Something went wrong. Please try again.",0,"STREAM_ERROR")}}}}finally{(P=i.signal)==null||P.removeEventListener("abort",N),c.releaseLock()}if((F=i.signal)!=null&&F.aborted)return{reply:v,aborted:!0,...k.length>0?{toolUses:k}:{}};if(S)return S;throw new tt("Connection interrupted. Please try again.",0,"STREAM_ERROR")}async fetchStream(a,i){const c=new AbortController,f=()=>c.abort();i==null||i.addEventListener("abort",f,{once:!0});let p=!1;const v=this.timeoutMs>0?setTimeout(()=>{p=!0,c.abort()},this.timeoutMs):void 0,{headers:k,body:S}=this.buildRequest(a);try{return await fetch(`${this.baseUrl}/api/chat/stream`,{method:"POST",headers:k,body:S,signal:c.signal})}catch(N){throw p?new tt("Request timed out. Please try again.",0,"TIMEOUT"):N}finally{v!==void 0&&clearTimeout(v),i==null||i.removeEventListener("abort",f)}}async fetchWithTimeout(a){const{headers:i,body:c}=this.buildRequest(a);if(this.timeoutMs<=0)return fetch(`${this.baseUrl}/api/chat`,{method:"POST",headers:i,body:c});const f=new AbortController,p=setTimeout(()=>f.abort(),this.timeoutMs);try{return await fetch(`${this.baseUrl}/api/chat`,{method:"POST",headers:i,body:c,signal:f.signal})}catch(v){throw f.signal.aborted?new tt("Request timed out. Please try again.",0,"TIMEOUT"):v}finally{clearTimeout(p)}}isRetryable(a,i){return i==="TIMEOUT"||i==="NETWORK_ERROR"?!0:a===429||a===503}getRetryDelay(a,i){if(a&&a.status===429){const c=a.headers.get("Retry-After");if(c){const f=Number(c);return Math.min(f*1e3,6e4)}}return i===0?1e3:3e3}delay(a){return new Promise(i=>setTimeout(i,a))}}function Bc(u){let a="message";const i=[];for(const c of u.split(` -`))c.startsWith("event:")?a=c.slice(6).trim():c.startsWith("data:")&&i.push(c.slice(5).trimStart());if(i.length===0)return null;try{const c=JSON.parse(i.join(` -`));return typeof c!="object"||c===null?null:{event:a,data:c}}catch{return null}}function du(u){return typeof u=="string"?{content:u}:u}function ao(u,a,i){console.error(`[claudius] plugin "${u.name}" failed in ${a}:`,i)}async function Hc(u,a,i){let c=a;for(const f of u){if(!f.onBeforeSend)continue;let p=null;const v={...i,respondWith(k){p={type:"respond",message:c,reply:du(k)}},abort(k){p={type:"abort",reason:k}}};try{const k=await f.onBeforeSend(c,v);if(p)return p;k&&(c=k)}catch(k){ao(f,"onBeforeSend",k)}}return{type:"send",message:c}}async function $c(u,a,i){let c=a;for(const f of u)if(f.onAfterReceive)try{const p=await f.onAfterReceive(c,i);p&&(c=p)}catch(p){ao(f,"onAfterReceive",p)}return c}async function Vc(u,a,i){for(const c of u){if(!c.onError)continue;let f=null;const p={...i,respondWith(v){f=du(v)}};try{if(await c.onError(a,p),f)return f}catch(v){ao(c,"onError",v)}}return null}const $r={maxSizeBytes:5*1024*1024,maxCount:5,allowedTypes:["image/jpeg","image/png","image/gif","image/webp","application/pdf"]};function Wc(u){return u?u===!0?$r:{maxSizeBytes:u.maxSizeBytes??$r.maxSizeBytes,maxCount:u.maxCount??$r.maxCount,allowedTypes:(u.allowedTypes??$r.allowedTypes).map(a=>a.trim().toLowerCase()).filter(Boolean)}:null}function Vr(u){if(!Number.isFinite(u)||u<0)return"0 B";if(u<1024)return`${u} B`;const a=u/1024;if(a<1024)return`${Math.round(a)} KB`;const i=a/1024;return`${Number.isInteger(i)?i:i.toFixed(1)} MB`}const Qc={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",pdf:"application/pdf"};function fu(u){var c;const a=(u.type||"").trim().toLowerCase();if(a)return a;const i=((c=u.name.split(".").pop())==null?void 0:c.toLowerCase())??"";return Qc[i]??""}function Kc(u){return u.startsWith("image/")}function bc(u){if(Kc(u.mediaType)){if(u.url)try{const a=new URL(u.url);if(a.protocol==="http:"||a.protocol==="https:")return u.url}catch{}if(u.data)return`data:${u.mediaType};base64,${u.data}`}}function Gc(u,a,i){const c=[],f=[];let p=Math.max(0,i.maxCount-a);for(const v of u){const k=fu(v);!k||!i.allowedTypes.includes(k)?f.push({file:v,reason:"type"}):v.size>i.maxSizeBytes||v.size===0?f.push({file:v,reason:"size"}):p<=0?f.push({file:v,reason:"count"}):(c.push(v),p-=1)}return{accepted:c,rejected:f}}function Yc(u){return new Promise((a,i)=>{const c=new FileReader;c.onerror=()=>i(c.error??new Error("Failed to read file")),c.onload=()=>{const f=String(c.result??""),p=f.indexOf(",");a(p>=0?f.slice(p+1):f)},c.readAsDataURL(u)})}let pu=0;function Xc(){return pu+=1,`att-${Date.now().toString(36)}-${pu}`}async function Zc(u){const a=await Yc(u);return{id:Xc(),name:u.name||"attachment",mediaType:fu(u),size:u.size,data:a}}function hu(u){return u.map(a=>{var i;return(i=a.attachments)!=null&&i.some(c=>c.data)?{...a,attachments:a.attachments.map(c=>{if(!c.data)return c;const f={...c};return delete f.data,f})}:a})}function Jc(u,a){if(!a||a.length===0)return u;const i=new Map(a.map(c=>[c.id,c]));return u.map(c=>{var f;return(f=c.attachments)!=null&&f.some(p=>i.has(p.id))?{...c,attachments:c.attachments.map(p=>{const v=i.get(p.id);if(!v)return p;const k={...p,key:v.key,url:v.url,expiresAt:v.expiresAt};return delete k.data,k})}:c})}const qc=200,ed="claudius:messages",qn=()=>new Date().toISOString();function td(u,a){let i;try{i=new URL(a).host}catch{i=a}return`${u}:${i}`}function co(){try{return typeof sessionStorage<"u"?sessionStorage:null}catch{return null}}function nd(u){const a=co();if(!a)return[];try{const i=a.getItem(u);if(!i)return[];const c=JSON.parse(i);return Array.isArray(c)?c:[]}catch{return[]}}function rd({apiUrl:u,persistMessages:a=!0,storageKeyPrefix:i=ed,timeoutMs:c,translations:f,plugins:p,streaming:v=!0}){const k=R.useMemo(()=>new Uc(u,{debounceMs:0,timeoutMs:c}),[u,c]),S=td(i,u),N=a?nd(S):[],[j,O]=R.useState(N),[V,I]=R.useState(!1),[D,P]=R.useState(!1),[F,$]=R.useState(null),[J,B]=R.useState(null),[Q,ue]=R.useState(!1),de=R.useRef(N.length),ae=R.useRef(!1),Z=R.useRef(N),xe=R.useRef(null),pe=R.useRef(p??[]);pe.current=p??[];const Se=R.useCallback(C=>{if(!a)return;const m=co();if(m)try{const T=hu(C.slice(-qc));m.setItem(S,JSON.stringify(T))}catch{}},[a,S]),Ce=()=>(de.current+=1,`msg-${de.current}`),ve=R.useCallback((C,m)=>{if(!f)return m??"Something went wrong. Please try again.";switch(C){case"TIMEOUT":return f.errorTimeout;case"NETWORK_ERROR":return f.errorConnection;case"RATE_LIMITED":return m!=null&&m.includes("minute")?f.errorRateLimitMinute:f.errorRateLimitHour;case"ATTACHMENT_QUOTA_EXCEEDED":return f.errorAttachmentQuota;case"ATTACHMENTS_DISABLED":case"ATTACHMENT_INVALID":case"ATTACHMENT_TOO_LARGE":return f.errorAttachmentRejected;case"VALIDATION_ERROR":case"CONFIG_ERROR":case"SERVICE_ERROR":case"UNKNOWN_ERROR":default:return m??f.errorGeneric}},[f]),Re=R.useCallback(C=>!(C instanceof tt)||C.code==="TIMEOUT"||C.code==="NETWORK_ERROR"||C.code==="RATE_LIMITED"||C.code==="SERVICE_ERROR"||C.code==="UNKNOWN_ERROR"||C.status>=500||C.status===0,[]),ye=R.useCallback(async C=>{var se,ne,ie;I(!0),ae.current=!0,B(null),ue(!1);const m=v&&typeof k.streamMessage=="function";let T=null;const re=K=>{if(T===null){T=Ce(),$(T);const q=[...Z.current,{id:T,role:"assistant",content:"",createdAt:qn(),...K}];Z.current=q,O(q)}else{const q=T,ce=Z.current.map(Ae=>Ae.id===q?{...Ae,...K}:Ae);Z.current=ce,O(ce)}},le=()=>{if(T===null)return;const K=T,q=Z.current.filter(ce=>ce.id!==K);Z.current=q,O(q)};try{let K,q,ce,Ae,Ze=!1;if(m){const Oe=new AbortController;xe.current=Oe,P(!0);const pt=await k.streamMessage(C,{signal:Oe.signal,onChunk:(Mt,ut)=>re({content:ut}),onToolUse:(Mt,ut)=>re({toolUses:[...ut]})});K=pt.reply,q=pt.sources,ce=pt.toolUses,Ae=pt.attachments,Ze=pt.aborted??!1}else{const Oe=await k.sendMessage(C);K=Oe.reply,q=Oe.sources,ce=Oe.toolUses,Ae=Oe.attachments}if(Ze&&!K){le();return}const ft=((se=Z.current.find(Oe=>Oe.id===T))==null?void 0:se.createdAt)??qn();let Fe={id:T??Ce(),role:"assistant",content:K,createdAt:ft,sources:q,toolUses:ce};pe.current.length>0&&!Ze&&(Fe=await $c(pe.current,Fe,{messages:C,apiUrl:u}),Fe.createdAt||(Fe={...Fe,createdAt:ft}));const Kt=T!==null?Z.current.map(Oe=>Oe.id===Fe.id?Fe:Oe):[...C,Fe],_t=Jc(Kt,Ae);Z.current=_t,O(_t),Se(_t)}catch(K){if(K instanceof so)return;if(K instanceof tt&&((ne=K.code)!=null&&ne.startsWith("ATTACHMENT"))&&C.length>0){const q=C[C.length-1];if(q.role==="user"&&((ie=q.attachments)!=null&&ie.length)){const ce=C.slice(0,-1);Z.current=ce,O(ce),Se(ce)}}if(T!==null){Se(Z.current),K instanceof tt?B(ve(K.code,K.message)):B((f==null?void 0:f.errorConnection)??"Failed to connect. Please try again."),ue(!1);return}if(pe.current.length>0){const q=K instanceof Error?K:new Error(String(K)),ce=await Vc(pe.current,q,{messages:C,apiUrl:u});if(ce){const Ae={id:Ce(),role:"assistant",content:ce.content,createdAt:qn(),sources:ce.sources},Ze=[...C,Ae];Z.current=Ze,O(Ze),Se(Ze),B(null),ue(!1);return}}K instanceof tt?B(ve(K.code,K.message)):B((f==null?void 0:f.errorConnection)??"Failed to connect. Please try again."),ue(Re(K))}finally{I(!1),ae.current=!1,P(!1),$(null),xe.current=null}},[u,k,ve,Re,Se,v,f]),_e=R.useCallback(()=>{var C;(C=xe.current)==null||C.abort()},[]),ge=R.useCallback(async(C,m)=>{const T=C.trim(),re=(m==null?void 0:m.filter(ie=>ie&&ie.id))??[];if(!T&&re.length===0||ae.current)return;const le={id:Ce(),role:"user",content:T,createdAt:qn(),...re.length>0?{attachments:re}:{}};let se=le;if(pe.current.length>0){const ie=await Hc(pe.current,le,{messages:Z.current,apiUrl:u});if(ie.type==="abort")return;const K=q=>q.createdAt?q:{...q,createdAt:le.createdAt};if(ie.type==="respond"){const q={id:Ce(),role:"assistant",content:ie.reply.content,createdAt:qn(),sources:ie.reply.sources},ce=[...Z.current,K(ie.message),q];Z.current=ce,O(ce),Se(ce),B(null),ue(!1);return}se=K(ie.message)}const ne=[...Z.current,se];Z.current=ne,O(ne),Se(ne),await ye(ne)},[u,Se,ye]),z=R.useCallback(async()=>{if(ae.current)return;const C=Z.current[Z.current.length-1];!C||C.role!=="user"||await ye(Z.current)},[ye]),X=R.useCallback(()=>{if(Z.current=[],O([]),B(null),ue(!1),a){const C=co();if(!C)return;try{C.removeItem(S)}catch{}}},[a,S]);return{messages:j,isLoading:V,isStreaming:D,streamingMessageId:F,error:J,canRetry:Q,sendMessage:ge,stop:_e,retry:z,clearMessages:X}}function ld(u){const[a,i]=R.useState(()=>typeof window>"u"?!1:window.matchMedia(u).matches);return R.useEffect(()=>{const c=window.matchMedia(u);i(c.matches);const f=p=>i(p.matches);return c.addEventListener("change",f),()=>c.removeEventListener("change",f)},[u]),a}function Wr(u,a){return u instanceof RegExp?u.test(a):a.toLowerCase().includes(u.toLowerCase())}function od(){const u=document.documentElement,a=document.body,i=u.scrollTop||a.scrollTop||0,c=Math.max(u.scrollHeight,a.scrollHeight),f=u.clientHeight||window.innerHeight,p=c-f;return p<=0?100:i/p*100}function id({triggers:u,enabled:a,onOpen:i,onGreeting:c}){R.useEffect(()=>{if(!a||!u||u.length===0)return;const f=new Set,p=[],v=typeof window<"u"?window.location.href:"",k=(S,N)=>{f.has(S)||(f.add(S),N==="open"?i():c(N.greeting))};return u.forEach((S,N)=>{switch(S.on){case"url":{Wr(S.pattern,v)&&k(N,S.action);break}case"time":{if(S.matchUrl&&!Wr(S.matchUrl,v))return;const j=window.setTimeout(()=>k(N,S.action),Math.max(0,S.seconds*1e3));p.push(()=>window.clearTimeout(j));break}case"scroll":{if(S.matchUrl&&!Wr(S.matchUrl,v))return;const j=()=>{od()>=S.percent&&k(N,S.action)};j(),window.addEventListener("scroll",j,{passive:!0}),p.push(()=>window.removeEventListener("scroll",j));break}case"exit-intent":{if(S.matchUrl&&!Wr(S.matchUrl,v))return;const j=O=>{O.clientY<=0&&k(N,S.action)};document.addEventListener("mouseleave",j),p.push(()=>document.removeEventListener("mouseleave",j));break}}}),()=>{p.forEach(S=>S())}},[u,a,i,c])}const ud={"bottom-right":"bottom-6 right-6","bottom-left":"bottom-6 left-6","top-right":"top-6 right-6","top-left":"top-6 left-6"},sd=R.forwardRef(function({isOpen:a,onClick:i,position:c="bottom-right",translations:f},p){const v=a?(f==null?void 0:f.closeChat)??"Close chat":(f==null?void 0:f.openChat)??"Open chat";return y.jsx("button",{ref:p,onClick:i,"aria-label":v,className:`fixed ${ud[c]} z-50 flex h-14 w-14 items-center justify-center rounded-claudius-full bg-claudius-accent text-claudius-accent-text shadow-claudius-floating transition-transform hover:scale-105 focus:outline-none focus:ring-2 focus:ring-claudius-accent focus:ring-offset-2`,children:a?y.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),y.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}):y.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:y.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})})}),ad=R.memo(function({count:a,isActive:i,onClick:c}){return y.jsxs("button",{onClick:c,"aria-label":"View sources",title:"View sources",className:`group relative flex h-7 w-7 items-center justify-center rounded-claudius-full transition-colors ${i?"bg-claudius-accent text-claudius-accent-text":"text-claudius-text-muted hover:bg-claudius-surface-muted hover:text-claudius-text"}`,children:[y.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),y.jsx("polyline",{points:"14 2 14 8 20 8"}),y.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),y.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]}),y.jsx("span",{className:"absolute -right-1 -top-1 flex h-4 min-w-4 items-center justify-center rounded-claudius-full bg-claudius-accent px-1 text-[10px] font-bold text-claudius-accent-text",children:a})]})}),cd=["http:","https:"];function Qr(u){if(!u||typeof u!="string")return null;const a=u.trim();if(!a)return null;try{const i=new URL(a);return cd.includes(i.protocol)?a:null}catch{return null}}function dd(){return y.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),y.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function mu({label:u,onClick:a}){return y.jsx("button",{type:"button",onClick:a,"aria-label":u,className:"absolute -right-1.5 -top-1.5 flex h-5 w-5 items-center justify-center rounded-claudius-full bg-claudius-text text-claudius-surface shadow-claudius-floating hover:opacity-90 focus:outline-none focus-visible:ring-2 focus-visible:ring-claudius-accent",children:y.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round","aria-hidden":"true",children:[y.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),y.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}const gu=R.memo(function({attachment:a,variant:i,onRemove:c,removeLabel:f}){const p=bc(a),v=i==="composer",k=`${a.name} (${Vr(a.size)})`,S=a.url?Qr(a.url):null;if(p){const j=y.jsx("img",{src:p,alt:a.name,title:k,loading:"lazy",className:v?"h-12 w-12 rounded-claudius-sm border border-claudius-border object-cover":"max-h-48 max-w-full rounded-claudius-sm object-contain"});return y.jsxs("div",{className:"relative inline-block",children:[!v&&S?y.jsxs("a",{href:S,target:"_blank",rel:"noopener noreferrer",children:[j,y.jsxs("span",{className:"sr-only",children:[k," (opens in a new tab)"]})]}):j,c&&f&&y.jsx(mu,{label:f,onClick:c})]})}const N=y.jsxs("span",{title:k,className:`inline-flex max-w-[220px] items-center gap-1.5 rounded-claudius-sm border px-2 py-1 text-xs ${v?"border-claudius-border bg-claudius-field text-claudius-text":"border-current/30 bg-transparent"}`,children:[y.jsx(dd,{}),y.jsx("span",{className:"truncate",children:a.name}),y.jsx("span",{className:"shrink-0 opacity-70",children:Vr(a.size)})]});return y.jsxs("div",{className:"relative inline-block",children:[!v&&S?y.jsxs("a",{href:S,target:"_blank",rel:"noopener noreferrer",className:"underline-offset-2 hover:underline",children:[N,y.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]}):N,c&&f&&y.jsx(mu,{label:f,onClick:c})]})}),vu=R.forwardRef(function({label:a,onClick:i,children:c},f){return y.jsx("button",{ref:f,type:"button",onClick:i,"aria-label":a,title:a,className:"flex h-7 w-7 items-center justify-center rounded-claudius-full text-claudius-text-muted transition-colors hover:bg-claudius-surface-muted hover:text-claudius-text",children:y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c})})});function fd({state:u,labels:a,onPlay:i,onPause:c,onResume:f,onStop:p}){var j;const v=R.useRef(null),k=R.useRef(null),S=!!((j=v.current)!=null&&j.contains(document.activeElement));R.useEffect(()=>{var O,V;u==="idle"&&S&&!((O=v.current)!=null&&O.contains(document.activeElement))&&((V=k.current)==null||V.focus())},[u,S]);const N=u==="idle"?{label:a.play,onClick:i}:u==="paused"?{label:a.resume,onClick:f}:{label:a.pause,onClick:c};return y.jsxs("div",{ref:v,className:"flex items-center gap-1",children:[y.jsx(vu,{ref:k,...N,children:u==="idle"?y.jsxs(y.Fragment,{children:[y.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),y.jsx("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",fill:"none"}),y.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",fill:"none"})]}):u==="paused"?y.jsx("polygon",{points:"6 3 20 12 6 21 6 3"}):y.jsxs(y.Fragment,{children:[y.jsx("rect",{x:"6",y:"4",width:"4",height:"16",rx:"1"}),y.jsx("rect",{x:"14",y:"4",width:"4",height:"16",rx:"1"})]})}),u!=="idle"&&y.jsx(vu,{label:a.stop,onClick:p,children:y.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1.5"})})]})}function pd(u){const a=u.lastIndexOf(` -`),i=a===-1?"":u.slice(0,a+1);let c=a===-1?u:u.slice(a+1);return c=gd(c),c=vd(c),i+c}function hd(u){const a=[];for(let i=0;if(v=>!v),"aria-expanded":p?c:void 0,className:"flex items-center gap-1.5 rounded-claudius-full border border-claudius-border bg-claudius-surface px-2 py-0.5 hover:opacity-80 disabled:cursor-default disabled:hover:opacity-100",children:[y.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:y.jsx("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})}),y.jsxs("span",{children:[a," ",y.jsx("span",{className:"font-mono text-claudius-text",children:u.name}),u.isError&&y.jsx("span",{className:"text-claudius-error",children:" ✕"})]}),p&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"sr-only",children:i}),y.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:c?"rotate-180":void 0,children:y.jsx("polyline",{points:"6 9 12 15 18 9"})})]})]}),c&&p&&y.jsxs("div",{className:"mt-1 overflow-x-auto rounded-claudius-sm border border-claudius-border bg-claudius-field p-2 font-mono",children:[u.input!==void 0&&y.jsx("pre",{className:"whitespace-pre-wrap break-all",children:JSON.stringify(u.input,null,2)}),u.result!==void 0&&y.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-all border-t border-claudius-border pt-1",children:u.result})]})]})}const yu=/(https?:\/\/[^\s)]+)/,wu=/(\*\*[^*]+\*\*)/,xu=/(\*[^*]+\*)/;function wd(u,a){const i=u.match(/[.,;:!?'"]+$/),c=i?u.slice(0,-i[0].length):u,f=i?i[0]:"",p=Qr(c);return p?y.jsxs(y.Fragment,{children:[y.jsxs("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"underline font-medium hover:opacity-80 text-claudius-link",children:[p.replace(/^https?:\/\//,""),y.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]},a),f]}):u}function xd(u,a){const i=u.split(wu),c=[];return i.forEach((f,p)=>{if(wu.test(f)){const v=f.slice(2,-2);c.push(y.jsx("strong",{children:v},`${a}-b${p}`))}else f.split(xu).forEach((k,S)=>{if(xu.test(k)){const N=k.slice(1,-1);c.push(y.jsx("em",{children:N},`${a}-b${p}-i${S}`))}else k.split(yu).forEach((j,O)=>{yu.test(j)?c.push(wd(j,`${a}-b${p}-i${S}-u${O}`)):j&&c.push(j)})})}),c}function Sd(u){const a=u.split(` -`);return a.map((i,c)=>y.jsxs("span",{children:[xd(i,`l${c}`),c0,D=c?pd(i):i,P=V||i!==""||!(v!=null&&v.length);return y.jsxs("div",{className:`${V?"ml-auto":"mr-auto"} max-w-[85%]`,children:[P&&y.jsxs("div",{className:`rounded-claudius-bubble px-4 py-2.5 text-sm leading-relaxed font-body ${V?"bg-claudius-user-bubble text-claudius-user-bubble-text rounded-br-claudius-tail":"bg-claudius-assistant-bubble text-claudius-assistant-bubble-text rounded-bl-claudius-tail"}`,children:[I&&y.jsx("ul",{className:`flex flex-wrap gap-2 ${i?"mb-2":""}`,"aria-label":"Attachments",children:p.map(F=>y.jsx("li",{children:y.jsx(gu,{attachment:F,variant:"message"})},F.id))}),(i!==""||!I)&&Sd(D)]}),!V&&v&&v.length>0&&y.jsx("div",{className:"mt-1 space-y-1",children:v.map((F,$)=>y.jsx(yd,{toolUse:F,usedLabel:k,detailsLabel:S},`${F.name}-${$}`))}),!V&&f&&f.length>0&&N&&y.jsx("div",{className:"mt-1",children:y.jsx(ad,{count:f.length,isActive:j??!1,onClick:N})}),!V&&O&&y.jsx("div",{className:"mt-1",children:y.jsx(fd,{...O})})]})}),Su={title:"Chat",subtitle:"Ask me anything",welcomeMessage:"Hi! How can I help you today?",closeChat:"Close chat",chatMessages:"Chat messages",typingIndicator:"Assistant is typing",placeholder:"Type your message...",sendMessage:"Send message",stopGenerating:"Stop generating",toolUsed:"Used tool:",toolDetails:"Tool details",typeYourMessage:"Type your message",openChat:"Open chat",dismissGreeting:"Dismiss greeting",attachFile:"Attach a file",removeAttachment:"Remove attachment",attachmentsLabel:"Attachments",dropFilesHint:"Drop files to attach",attachmentTooLarge:"{name} is too large. The maximum size is {max}.",attachmentTypeNotAllowed:"{name} is not a supported file type.",attachmentTooMany:"You can attach up to {max} files per message.",voiceInput:"Voice input",voiceInputHold:"Hold to talk",voiceListening:"Listening...",voicePermissionDenied:"Microphone access is blocked. Allow it in your browser settings to use voice input.",voiceNoSpeech:"No speech was detected. Please try again.",voiceNoMicrophone:"No microphone was found.",voiceUnavailable:"Voice input is not available right now.",readAloud:"Read aloud",pauseReading:"Pause reading",resumeReading:"Resume reading",stopReading:"Stop reading",moreOptions:"More options",copyAsMarkdown:"Copy as Markdown",downloadAsMarkdown:"Download as Markdown",downloadAsJson:"Download as JSON",copiedToClipboard:"Copied to clipboard",copyFailed:"Could not copy. Try downloading instead.",transcriptTitle:"Chat transcript",transcriptExported:"Exported {date}",transcriptUser:"User",transcriptAssistant:"Assistant",transcriptAttachments:"Attachments:",transcriptSources:"Sources:",errorGeneric:"Something went wrong. Please try again.",errorConnection:"Failed to connect. Please try again.",errorTimeout:"Request timed out. Please try again.",errorRateLimitMinute:"Too many requests. Please wait a minute.",errorRateLimitHour:"Hourly limit reached. Please try again later.",errorAttachmentRejected:"An attachment was rejected. Please remove it and try again.",errorAttachmentQuota:"Upload limit reached. Please try again later.",errorRetry:"Retry"},ku=Su;function Eu(u){return u.key===" "||u.key==="Enter"}function Ed({mode:u,isListening:a,disabled:i=!1,onStart:c,onStop:f,label:p}){const v=u==="hold",k=R.useRef(!1),S=()=>{i||k.current||(k.current=!0,c({held:!0}))},N=()=>{k.current&&(k.current=!1,f())},j=D=>{v&&D.detail!==0||(a?f():c({held:!1}))},O=D=>{var P,F;!v||D.button!==0||((F=(P=D.currentTarget).setPointerCapture)==null||F.call(P,D.pointerId),S())},V=D=>{!v||!Eu(D)||(D.preventDefault(),D.repeat||S())},I=D=>{!v||!Eu(D)||(D.preventDefault(),N())};return y.jsx("button",{type:"button",disabled:i,"aria-label":p,"aria-pressed":a,title:p,onClick:j,onPointerDown:O,onPointerUp:N,onPointerCancel:N,onLostPointerCapture:N,onKeyDown:V,onKeyUp:I,onBlur:N,onContextMenu:v?D=>D.preventDefault():void 0,style:v?{WebkitTouchCallout:"none"}:void 0,className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-claudius-sm border transition-colors focus:outline-none focus:ring-1 focus:ring-claudius-accent disabled:opacity-50 ${a?"border-claudius-accent bg-claudius-accent text-claudius-accent-text focus:ring-2 focus:ring-offset-2 focus:ring-offset-claudius-surface":"border-claudius-border bg-claudius-field text-claudius-text-muted hover:text-claudius-text focus:border-claudius-accent"} ${v?"touch-none select-none":""}`,children:a&&!v?y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:y.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1.5"})}):y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"}),y.jsx("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),y.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"22"})]})})}function Cd({active:u}){return y.jsxs("span",{"aria-hidden":"true","data-claudius-voice-level":u?"active":"idle",className:"claudius-voice-level pointer-events-none absolute right-3 top-1/2 flex h-4 -translate-y-1/2 items-center gap-0.5 text-claudius-accent",children:[y.jsx("span",{}),y.jsx("span",{}),y.jsx("span",{}),y.jsx("span",{})]})}function Kr(u,a){return u.replace(/\{(\w+)\}/g,(i,c)=>c in a?String(a[c]):i)}const Rd={en:"en-US",es:"es-ES",fr:"fr-FR",de:"de-DE"},Td=["toggle","hold"];function Cu(u,a){if(!(!u||!u.includes("-")))return u.toLowerCase().split("-")[0]===a?u:void 0}function Ru(u,a){const i=a==null?void 0:a.trim();if(i)return i;const c=typeof document<"u"?Cu(document.documentElement.lang,u):void 0;if(c)return c;const f=typeof navigator<"u"?Cu(navigator.language,u):void 0;return f||Rd[u]}function Nd(u,a){const i=typeof u=="object"&&u!==null&&!Array.isArray(u);if(u!==!0&&!i)return null;const c=u===!0?{}:u,f={input:c.input??!0,output:c.output??!0,mode:Td.includes(c.mode)?c.mode:"toggle",autoSubmit:c.autoSubmit??!1,lang:Ru(a,c.lang)};return f.input||f.output?f:null}function jd(u){const a=u("voice");if(a===null)return;if(a==="false")return!1;const i={},c=N=>{const j=u(N);return j===null?void 0:j!=="false"},f=u("voice-mode");f!==null&&(i.mode=f);const p=c("voice-auto-submit");p!==void 0&&(i.autoSubmit=p);const v=c("voice-input");v!==void 0&&(i.input=v);const k=c("voice-output");k!==void 0&&(i.output=k);const S=u("voice-lang");return S!==null&&(i.lang=S),Object.keys(i).length>0?i:!0}function _d(u,a,i){const c=a.trim();if(!c)return u;const f=u.trimEnd();return(f?`${f} ${c}`:c).slice(0,i)}function Md(u){const a=[];let i=0;for(let c=0;c{const p=c.trim();p&&i.push(p),c=""};for(const p of Md(u)){if((c+p).trim().length<=a){c+=p;continue}if(f(),p.trim().length<=a){c=p;continue}for(let v of p.trim().split(/\s+/)){for(c&&`${c} ${v}`.length>a&&f();v.length>a;)i.push(v.slice(0,a)),v=v.slice(a);c=c?`${c} ${v}`:v}}return f(),i}function Tu(){if(typeof window>"u")return;const u=window;return u.SpeechRecognition??u.webkitSpeechRecognition}function Pd(u){switch(u){case"not-allowed":case"service-not-allowed":return"permission";case"no-speech":return"no-speech";case"audio-capture":return"no-microphone";default:return"unavailable"}}function Ad(u){const[a]=R.useState(()=>Tu()!==void 0),[i,c]=R.useState(!1),[f,p]=R.useState(!1),v=R.useRef(null),k=R.useRef(!1),S=R.useRef(u);R.useEffect(()=>{S.current=u});const N=R.useCallback(I=>{I.onstart=null,I.onend=null,I.onerror=null,I.onresult=null,I.onspeechstart=null,I.onspeechend=null,v.current===I&&(v.current=null),c(!1),p(!1)},[]),j=R.useCallback(()=>{const I=v.current;I&&(N(I),I.abort())},[N]),O=R.useCallback(()=>{const I=v.current;return I?(k.current?I.stop():j(),!0):!1},[j]),V=R.useCallback(()=>{var $,J;const I=Tu();if(!I||v.current)return!1;const D=new I;D.lang=S.current.lang,D.interimResults=!0,D.continuous=!1;let P="";const F=()=>{k.current=!0};D.onstart=F,D.onspeechstart=()=>{F(),p(!0)},D.onspeechend=()=>p(!1),D.onresult=B=>{var de,ae;let Q="",ue="";for(let Z=0;Z{var Q,ue;B.error!=="aborted"&&((ue=(Q=S.current).onError)==null||ue.call(Q,Pd(B.error))),N(D),D.abort()},D.onend=()=>{var B,Q;N(D),(Q=(B=S.current).onEnd)==null||Q.call(B,P)},v.current=D,k.current=!1,c(!0);try{D.start()}catch{return N(D),(J=($=S.current).onError)==null||J.call($,"unavailable"),!1}return!0},[N]);return R.useEffect(()=>j,[j]),{isSupported:a,isListening:i,isSpeechDetected:f,start:V,stop:O,abort:j}}const er=2e3,Dd=1800;function Nu(u){var i;const a=(i=u.dataTransfer)==null?void 0:i.types;return!!a&&Array.from(a).includes("Files")}function zd({onSend:u,isLoading:a,isStreaming:i=!1,onStop:c,placeholder:f,translations:p,attachments:v=null,voice:k=null,onVoiceStart:S,isReadingAloud:N=!1}){const j=p??ku,[O,V]=R.useState(""),[I,D]=R.useState([]),[P,F]=R.useState(null),[$,J]=R.useState(!1),[B,Q]=R.useState(null),ue=R.useRef(null),de=R.useRef(null),ae=R.useRef([]),Z=R.useRef(0),xe=R.useRef(""),pe=R.useRef(""),Se=R.useRef(!1),Ce=R.useRef(!1),ve=R.useRef(!1),Re=H=>{xe.current=H,V(H)},ye=O.length,_e=ye>=Dd,ge=ye>=er,z=f??j.placeholder,X=!!v&&I.length{var H;a||(H=ue.current)==null||H.focus()},[a]);const m=R.useCallback((H,ke)=>{if(!v)return"";switch(ke){case"size":return Kr(j.attachmentTooLarge,{name:H,max:Vr(v.maxSizeBytes)});case"type":return Kr(j.attachmentTypeNotAllowed,{name:H});case"count":return Kr(j.attachmentTooMany,{max:v.maxCount})}},[v,j]),T=R.useCallback(async H=>{if(!v||H.length===0)return;const{accepted:ke,rejected:It}=Gc(H,ae.current.length,v);if(F(It.length>0?m(It[0].file.name,It[0].reason):null),ke.length===0)return;const Gr=await Promise.all(ke.map(Zc));ae.current=[...ae.current,...Gr],D(ae.current)},[v,m]),re=R.useCallback(H=>{ae.current=ae.current.filter(ke=>ke.id!==H),D(ae.current),F(null)},[]),le=()=>{const H=xe.current.trim(),ke=ae.current;!H&&ke.length===0||xe.current.length>=er||(ke.length>0?u(H,ke):u(H),Re(""),ae.current=[],D([]),F(null),Q(null))},se=H=>{switch(H){case"permission":return j.voicePermissionDenied;case"no-speech":return j.voiceNoSpeech;case"no-microphone":return j.voiceNoMicrophone;case"unavailable":return j.voiceUnavailable}},ne=Ad({lang:(k==null?void 0:k.lang)??"en-US",onTranscript:H=>Re(_d(pe.current,H,er)),onEnd:H=>{const ke=H.trim()!=="";if(ke&&(Ce.current=!0),!Se.current){q();return}ke&&ce()},onError:H=>{H==="no-speech"&&Ce.current||(ve.current=!0,Q(se(H)))}}),ie=!!(k!=null&&k.input)&&ne.isSupported,K=ne.isListening;R.useEffect(()=>{const H=ue.current;K&&H&&(H.scrollLeft=H.scrollWidth)},[K,O]);const q=()=>{k!=null&&k.autoSubmit&&Ce.current&&!ve.current&&le()},ce=()=>{const H=xe.current;ne.start()&&(pe.current=H)},Ae=({held:H})=>{Q(null),Se.current=H,Ce.current=!1,ve.current=!1,S==null||S(),ce()},Ze=()=>{const H=Se.current;Se.current=!1,!ne.stop()&&H&&q()},ft=()=>{Se.current=!1,ne.abort()},{abort:Fe}=ne;R.useEffect(()=>{!a&&!N||(Se.current=!1,Fe())},[a,N,Fe]);const Kt=H=>{H.preventDefault(),ft(),le()},_t=H=>{const ke=H.target.value;ke.length<=er&&(ft(),Q(null),Re(ke))},Oe=H=>{const ke=Array.from(H.target.files??[]);H.target.value="",T(ke)},pt=H=>{var It;if(!v)return;const ke=Array.from(((It=H.clipboardData)==null?void 0:It.files)??[]);ke.length!==0&&(H.preventDefault(),T(ke))},Mt=H=>{!v||!Nu(H)||(H.preventDefault(),Z.current+=1,J(!0))},ut=H=>{!v||!Nu(H)||H.preventDefault()},Ue=()=>{v&&(Z.current=Math.max(0,Z.current-1),Z.current===0&&J(!1))},bt=H=>{var ke;v&&(H.preventDefault(),Z.current=0,J(!1),T(Array.from(((ke=H.dataTransfer)==null?void 0:ke.files)??[])))};return y.jsxs("form",{onSubmit:Kt,onDragEnter:Mt,onDragOver:ut,onDragLeave:Ue,onDrop:bt,"data-drag-over":$||void 0,className:`relative border-t border-claudius-border bg-claudius-surface p-3 ${$?"ring-2 ring-inset ring-claudius-accent":""}`,children:[$&&y.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-claudius-surface text-sm font-medium text-claudius-accent",children:j.dropFilesHint}),v&&I.length>0&&y.jsx("ul",{"aria-label":j.attachmentsLabel,className:"mb-2 flex flex-wrap gap-3 pt-1",children:I.map(H=>y.jsx("li",{children:y.jsx(gu,{attachment:H,variant:"composer",onRemove:()=>re(H.id),removeLabel:`${j.removeAttachment}: ${H.name}`})},H.id))}),y.jsxs("div",{className:"flex gap-2",children:[v&&y.jsxs(y.Fragment,{children:[y.jsx("input",{ref:de,type:"file",multiple:!0,hidden:!0,tabIndex:-1,accept:v.allowedTypes.join(","),onChange:Oe,"aria-label":j.attachFile}),y.jsx("button",{type:"button",onClick:()=>{var H;return(H=de.current)==null?void 0:H.click()},disabled:a||!X,"aria-label":j.attachFile,title:j.attachFile,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-claudius-sm border border-claudius-border bg-claudius-field text-claudius-text-muted transition-colors hover:text-claudius-text focus:border-claudius-accent focus:outline-none focus:ring-1 focus:ring-claudius-accent disabled:opacity-50",children:y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:y.jsx("path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"})})})]}),y.jsxs("div",{className:"relative min-w-0 flex-1",children:[y.jsx("input",{ref:ue,type:"text",value:O,onChange:_t,onPaste:pt,placeholder:K?j.voiceListening:z,disabled:a,"aria-label":j.typeYourMessage,"aria-describedby":_e?"char-count":void 0,className:`h-full w-full rounded-claudius-sm border border-claudius-border bg-claudius-field py-2 pl-3 text-sm font-body text-claudius-text placeholder:text-claudius-text-muted focus:border-claudius-accent focus:outline-none focus:ring-1 focus:ring-claudius-accent disabled:opacity-50 ${K?"pr-10":"pr-3"}`}),K&&y.jsx(Cd,{active:ne.isSpeechDetected})]}),ie&&k&&y.jsx(Ed,{mode:k.mode,isListening:K,disabled:a,onStart:Ae,onStop:Ze,label:k.mode==="hold"?j.voiceInputHold:j.voiceInput}),C?y.jsx("button",{type:"button",onClick:c,"aria-label":j.stopGenerating,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-claudius-sm bg-claudius-accent text-claudius-accent-text transition-colors hover:opacity-90",children:y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:y.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1.5"})})}):y.jsx("button",{type:"submit",disabled:a||ge,"aria-label":j.sendMessage,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-claudius-sm bg-claudius-accent text-claudius-accent-text transition-colors hover:opacity-90 disabled:opacity-50",children:y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),y.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),(P??B)&&y.jsx("div",{role:"alert",className:"mt-1 text-xs text-claudius-error",children:P??B}),_e&&y.jsxs("div",{id:"char-count",className:`mt-1 text-xs text-right ${ge?"text-claudius-error":"text-claudius-text-muted"}`,"aria-live":"polite",children:[ye,"/",er]})]})}const Od=["blog","page","external"],Id={blog:"Blog",page:"Page",external:"External"};function Fd(u){try{return new URL(u).hostname}catch{return u}}const Ud=R.memo(function({sources:a,onClose:i}){const c=Od.map(p=>({type:p,label:Id[p],items:a.filter(v=>v.type===p)})).filter(p=>p.items.length>0),f=a.length===1?"1 source found":`${a.length} sources found`;return y.jsxs("div",{className:"absolute inset-y-0 left-0 z-10 flex w-[280px] flex-col border-r-2 border-claudius-border bg-claudius-surface rounded-r-claudius-lg transition-transform duration-200 ease-out",children:[y.jsxs("div",{className:"flex items-center justify-between border-b border-claudius-border px-4 py-3",children:[y.jsxs("div",{children:[y.jsx("h3",{className:"text-sm font-heading font-semibold text-claudius-text",children:"Sources"}),y.jsx("p",{className:"text-xs text-claudius-text-muted",children:f})]}),y.jsx("button",{onClick:i,"aria-label":"Close sources",className:"flex h-7 w-7 items-center justify-center rounded-claudius-full text-claudius-text-muted transition-colors hover:bg-claudius-surface-muted hover:text-claudius-text",children:y.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),y.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),y.jsx("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-4",children:c.map(p=>y.jsxs("div",{children:[y.jsx("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-claudius-text-muted",children:p.label}),y.jsx("div",{className:"space-y-2",children:p.items.map(v=>{const k=Qr(v.url);return k?y.jsxs("a",{href:k,target:"_blank",rel:"noopener noreferrer",className:"block rounded-claudius-md border-2 border-claudius-border bg-claudius-surface-muted p-3 transition-colors hover:bg-claudius-border",children:[y.jsx("p",{className:"truncate text-sm font-medium text-claudius-text",children:v.title}),y.jsx("p",{className:"mt-0.5 text-xs text-claudius-text-muted",children:Fd(k)})]},k):null})})]},p.type))})]})});function Bd({title:u,subtitle:a,titleId:i,closeLabel:c,onClose:f,actions:p}){return y.jsxs("div",{className:"flex items-center gap-3 bg-claudius-accent px-5 py-4",children:[y.jsx("div",{"aria-hidden":"true",className:"flex h-8 w-8 items-center justify-center rounded-claudius-full bg-claudius-accent-soft text-sm font-bold text-claudius-accent-text",children:u.charAt(0).toUpperCase()}),y.jsxs("div",{className:"flex-1",children:[y.jsx("h2",{id:i,className:"text-sm font-heading font-semibold text-claudius-accent-text",children:u}),y.jsx("p",{className:"text-xs text-claudius-accent-text",children:a})]}),p,y.jsx("button",{onClick:f,"aria-label":c,className:"flex h-10 w-10 items-center justify-center rounded-claudius-full text-claudius-accent-text-muted transition-colors hover:bg-claudius-accent-soft hover:text-claudius-accent-text",children:y.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),y.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}function Hd({message:u,retryLabel:a,onRetry:i}){return y.jsxs("div",{role:"alert",className:"mx-auto flex max-w-[90%] flex-col items-center gap-2 rounded-claudius-sm bg-claudius-error-surface px-3 py-2 text-center text-xs text-claudius-error",children:[y.jsx("span",{children:u}),i&&y.jsx("button",{type:"button",onClick:i,className:"rounded-claudius-md bg-claudius-error px-3 py-1 text-xs font-semibold text-claudius-error-text transition-opacity hover:opacity-90 focus:outline-none focus-visible:ring-2 focus-visible:ring-claudius-error focus-visible:ring-offset-1",children:a})]})}function $d({label:u}){return y.jsx("div",{role:"status","aria-live":"polite","aria-label":u,className:"mr-auto flex max-w-[85%]",children:y.jsxs("div",{className:"flex gap-1 rounded-claudius-bubble rounded-bl-claudius-tail bg-claudius-assistant-bubble px-4 py-3",children:[y.jsx("span",{className:"h-2 w-2 motion-safe:animate-bounce rounded-claudius-full bg-claudius-text-muted [animation-delay:0ms]"}),y.jsx("span",{className:"h-2 w-2 motion-safe:animate-bounce rounded-claudius-full bg-claudius-text-muted [animation-delay:150ms]"}),y.jsx("span",{className:"h-2 w-2 motion-safe:animate-bounce rounded-claudius-full bg-claudius-text-muted [animation-delay:300ms]"})]})})}function Vd({label:u,items:a,onOpen:i}){const[c,f]=R.useState(!1),p=R.useId(),v=R.useId(),k=R.useRef(null),S=R.useRef(null),N=R.useRef([]),j=R.useRef(null),O=$=>{j.current=$,f(!0),i==null||i()},V=$=>{var J;f(!1),(J=S.current)==null||J.focus()};R.useEffect(()=>{var J;if(!c)return;j.current!==null&&((J=N.current[j.current])==null||J.focus(),j.current=null);const $=B=>{var Q;(Q=k.current)!=null&&Q.contains(B.target)||f(!1)};return document.addEventListener("pointerdown",$),()=>document.removeEventListener("pointerdown",$)},[c]);const I=$=>{var B;const J=a.length;(B=N.current[($+J)%J])==null||B.focus()},D=$=>{$.key==="ArrowDown"?($.preventDefault(),O(0)):$.key==="ArrowUp"&&($.preventDefault(),O(a.length-1))},P=$=>{const J=N.current.findIndex(B=>B===document.activeElement);switch($.key){case"ArrowDown":$.preventDefault(),I(J+1);break;case"ArrowUp":$.preventDefault(),I(J===-1?a.length-1:J-1);break;case"Home":$.preventDefault(),I(0);break;case"End":$.preventDefault(),I(a.length-1);break;case"Escape":$.preventDefault(),$.stopPropagation(),V();break;case"Tab":$.shiftKey&&($.preventDefault(),V());break}},F=$=>{var B;const J=$.relatedTarget;J&&((B=k.current)!=null&&B.contains(J)||f(!1))};return y.jsxs("div",{ref:k,className:"relative",children:[y.jsx("button",{ref:S,id:p,type:"button","aria-label":u,"aria-haspopup":"menu","aria-expanded":c,"aria-controls":c?v:void 0,onClick:()=>c?V():O(0),onKeyDown:D,className:"flex h-10 w-10 items-center justify-center rounded-claudius-full text-claudius-accent-text-muted transition-colors hover:bg-claudius-accent-soft hover:text-claudius-accent-text",children:y.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[y.jsx("circle",{cx:"12",cy:"5",r:"1.75"}),y.jsx("circle",{cx:"12",cy:"12",r:"1.75"}),y.jsx("circle",{cx:"12",cy:"19",r:"1.75"})]})}),c&&y.jsx("div",{id:v,role:"menu","aria-labelledby":p,tabIndex:-1,onKeyDown:P,onBlur:F,className:"absolute right-0 top-full z-20 mt-1 min-w-[12rem] rounded-claudius-md border border-claudius-border bg-claudius-surface py-1 shadow-claudius-elevated",children:a.map(($,J)=>y.jsx("button",{ref:B=>{N.current[J]=B},type:"button",role:"menuitem",tabIndex:-1,"aria-disabled":$.disabled||void 0,onClick:()=>{$.disabled||(V(),$.onSelect())},className:"flex min-h-[40px] w-full items-center whitespace-nowrap px-4 text-left text-sm text-claudius-text hover:bg-claudius-surface-muted focus:bg-claudius-surface-muted aria-disabled:cursor-default aria-disabled:opacity-50 aria-disabled:hover:bg-transparent",children:$.label},$.id))})]})}function Wd(u,a,i){const[c,f]=R.useState(0),p=R.useRef(0),v=R.useRef(0),k=R.useRef(0),S=R.useRef(!1);return R.useEffect(()=>{const N=u.current;if(!i||!N)return;const j=I=>{if(N.scrollTop>0){S.current=!1;return}S.current=!0,v.current=I.touches[0].clientY,k.current=Date.now()},O=I=>{if(!S.current)return;let D=I.touches[0].clientY-v.current;D<0&&(D=D*.3),p.current=D,f(D)},V=()=>{if(!S.current)return;S.current=!1;const I=p.current,D=(Date.now()-k.current)/1e3,P=N.getBoundingClientRect().height,F=D>.05&&I>0&&I/D>500,$=I>P*.3;F||$?a():(p.current=0,f(0))};return N.addEventListener("touchstart",j,{passive:!0}),N.addEventListener("touchmove",O,{passive:!0}),N.addEventListener("touchend",V),()=>{N.removeEventListener("touchstart",j),N.removeEventListener("touchmove",O),N.removeEventListener("touchend",V)}},[u,a,i]),{offsetY:c}}const Qd='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Kd(u,a){R.useEffect(()=>{const i=u.current;if(!i)return;const c=f=>{if(f.key!=="Tab")return;const p=Array.from(i.querySelectorAll(Qd)).filter(N=>!N.hasAttribute("aria-hidden"));if(p.length===0)return;const v=p[0],k=p[p.length-1],S=document.activeElement;f.shiftKey&&S===v?(f.preventDefault(),k.focus()):!f.shiftKey&&S===k&&(f.preventDefault(),v.focus())};return i.addEventListener("keydown",c),()=>i.removeEventListener("keydown",c)},[u,a])}function tr(){if(!(typeof window>"u")&&!(typeof window.SpeechSynthesisUtterance>"u"))return window.speechSynthesis??void 0}function bd(u){const[a]=R.useState(()=>tr()!==void 0),[i,c]=R.useState(null),[f,p]=R.useState(!1),v=R.useRef(0),k=R.useRef(!1),S=R.useRef([]),N=R.useCallback(()=>{v.current+=1,k.current=!1,S.current=[],c(null),p(!1)},[]),j=R.useCallback(()=>{const D=S.current.length>0;N();const P=tr();!D||!P||(P.cancel(),P.paused&&P.resume())},[N]),O=R.useCallback((D,P)=>{const F=tr();if(!F)return;N(),(F.speaking||F.pending)&&F.cancel(),F.paused&&F.resume();const $=Ld(P);if($.length===0)return;const J=v.current,B=()=>v.current===J;S.current=$.map((Q,ue)=>{const de=new SpeechSynthesisUtterance(Q);return de.lang=u,de.onerror=ae=>{if(!B())return;(ae.error==="interrupted"||ae.error==="canceled")&&!k.current?N():j()},de.onpause=()=>{B()&&p(!0)},de.onresume=()=>{B()&&p(!1)},de.onend=()=>{B()&&(k.current&&!F.paused?j():ue===$.length-1&&N())},de}),c(D);for(const Q of S.current)F.speak(Q)},[u,j,N]),V=R.useCallback(()=>{const D=tr();D&&(k.current=!0,D.pause(),D.paused&&p(!0))},[]),I=R.useCallback(()=>{const D=tr();D&&(k.current=!1,D.resume(),p(!1))},[]);return R.useEffect(()=>j,[j]),{isSupported:a,activeId:i,isPaused:f,speak:O,pause:V,resume:I,cancel:j}}const Gd=/^([ \t]*)(`{3,}|~{3,})(.*)$/,Yd=/^( {0,3})<(?![A-Za-z][A-Za-z0-9+.-]{1,31}:[^<>\s]*>|[A-Za-z0-9][^\s<>@]*@[^\s<>]+>)(?=[A-Za-z!?/])/,Xd=/^(?: {4}|\t)/;function ju(u){let a=0;for(const i of u)if(i===" ")a+=1;else if(i===" ")a+=4-a%4;else break;return a}function _u(u){let a=u.length;for(;a>0&&(u[a-1]===" "||u[a-1]===" ");)a-=1;return a===u.length?u:u.slice(0,a)}function Zd(u){const a=Gd.exec(u);if(!a)return null;const[,i,c,f]=a;return c[0]==="`"&&f.includes("`")?null:{indent:i,indentColumns:ju(i),char:c[0],length:c.length}}function Jd(u,a){const i=u.trim();if(i.length0?{toolUses:ee}:{},...Array.isArray(G.data.attachments)?{attachments:G.data.attachments}:{}}}else if(G.event==="error")throw new rt(typeof G.data.error=="string"?G.data.error:"Something went wrong. Please try again.",0,"STREAM_ERROR")}}}}finally{(V=i.signal)==null||V.removeEventListener("abort",j),c.releaseLock()}if((K=i.signal)!=null&&K.aborted)return{reply:m,aborted:!0,...w.length>0?{toolUses:w}:{},...x?{sources:x}:{}};if(R)return R;throw new rt("Connection interrupted. Please try again.",0,"STREAM_ERROR")}async fetchStream(s,i){const c=new AbortController,d=()=>c.abort();i==null||i.addEventListener("abort",d,{once:!0});let h=!1;const m=this.timeoutMs>0?setTimeout(()=>{h=!0,c.abort()},this.timeoutMs):void 0,{headers:w,body:x}=this.buildRequest(s);try{return await fetch(`${this.baseUrl}/api/chat/stream`,{method:"POST",headers:w,body:x,signal:c.signal})}catch(R){throw h?new rt("Request timed out. Please try again.",0,"TIMEOUT"):R}finally{m!==void 0&&clearTimeout(m),i==null||i.removeEventListener("abort",d)}}async fetchWithTimeout(s){const{headers:i,body:c}=this.buildRequest(s);if(this.timeoutMs<=0)return fetch(`${this.baseUrl}/api/chat`,{method:"POST",headers:i,body:c});const d=new AbortController,h=setTimeout(()=>d.abort(),this.timeoutMs);try{return await fetch(`${this.baseUrl}/api/chat`,{method:"POST",headers:i,body:c,signal:d.signal})}catch(m){throw d.signal.aborted?new rt("Request timed out. Please try again.",0,"TIMEOUT"):m}finally{clearTimeout(h)}}isRetryable(s,i){return i==="TIMEOUT"||i==="NETWORK_ERROR"?!0:s===429||s===503}getRetryDelay(s,i){if(s&&s.status===429){const c=s.headers.get("Retry-After");if(c){const d=Number(c);return Math.min(d*1e3,6e4)}}return i===0?1e3:3e3}delay(s){return new Promise(i=>setTimeout(i,s))}}function Vc(u){let s="message";const i=[];for(const c of u.split(` +`))c.startsWith("event:")?s=c.slice(6).trim():c.startsWith("data:")&&i.push(c.slice(5).trimStart());if(i.length===0)return null;try{const c=JSON.parse(i.join(` +`));return typeof c!="object"||c===null?null:{event:s,data:c}}catch{return null}}function fu(u){return typeof u=="string"?{content:u}:u}function ao(u,s,i){console.error(`[claudius] plugin "${u.name}" failed in ${s}:`,i)}async function bc(u,s,i){let c=s;for(const d of u){if(!d.onBeforeSend)continue;let h=null;const m={...i,respondWith(w){h={type:"respond",message:c,reply:fu(w)}},abort(w){h={type:"abort",reason:w}}};try{const w=await d.onBeforeSend(c,m);if(h)return h;w&&(c=w)}catch(w){ao(d,"onBeforeSend",w)}}return{type:"send",message:c}}async function Wc(u,s,i){let c=s;for(const d of u)if(d.onAfterReceive)try{const h=await d.onAfterReceive(c,i);h&&(c=h)}catch(h){ao(d,"onAfterReceive",h)}return c}async function Qc(u,s,i){for(const c of u){if(!c.onError)continue;let d=null;const h={...i,respondWith(m){d=fu(m)}};try{if(await c.onError(s,h),d)return d}catch(m){ao(c,"onError",m)}}return null}const br={maxSizeBytes:5*1024*1024,maxCount:5,allowedTypes:["image/jpeg","image/png","image/gif","image/webp","application/pdf"]};function Kc(u){return u?u===!0?br:{maxSizeBytes:u.maxSizeBytes??br.maxSizeBytes,maxCount:u.maxCount??br.maxCount,allowedTypes:(u.allowedTypes??br.allowedTypes).map(s=>s.trim().toLowerCase()).filter(Boolean)}:null}function Wr(u){if(!Number.isFinite(u)||u<0)return"0 B";if(u<1024)return`${u} B`;const s=u/1024;if(s<1024)return`${Math.round(s)} KB`;const i=s/1024;return`${Number.isInteger(i)?i:i.toFixed(1)} MB`}const Gc={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",pdf:"application/pdf"};function pu(u){var c;const s=(u.type||"").trim().toLowerCase();if(s)return s;const i=((c=u.name.split(".").pop())==null?void 0:c.toLowerCase())??"";return Gc[i]??""}function Yc(u){return u.startsWith("image/")}function Xc(u){if(Yc(u.mediaType)){if(u.url)try{const s=new URL(u.url);if(s.protocol==="http:"||s.protocol==="https:")return u.url}catch{}if(u.data)return`data:${u.mediaType};base64,${u.data}`}}function Zc(u,s,i){const c=[],d=[];let h=Math.max(0,i.maxCount-s);for(const m of u){const w=pu(m);!w||!i.allowedTypes.includes(w)?d.push({file:m,reason:"type"}):m.size>i.maxSizeBytes||m.size===0?d.push({file:m,reason:"size"}):h<=0?d.push({file:m,reason:"count"}):(c.push(m),h-=1)}return{accepted:c,rejected:d}}function Jc(u){return new Promise((s,i)=>{const c=new FileReader;c.onerror=()=>i(c.error??new Error("Failed to read file")),c.onload=()=>{const d=String(c.result??""),h=d.indexOf(",");s(h>=0?d.slice(h+1):d)},c.readAsDataURL(u)})}let hu=0;function qc(){return hu+=1,`att-${Date.now().toString(36)}-${hu}`}async function ed(u){const s=await Jc(u);return{id:qc(),name:u.name||"attachment",mediaType:pu(u),size:u.size,data:s}}function mu(u){return u.map(s=>{var i;return(i=s.attachments)!=null&&i.some(c=>c.data)?{...s,attachments:s.attachments.map(c=>{if(!c.data)return c;const d={...c};return delete d.data,d})}:s})}function td(u,s){if(!s||s.length===0)return u;const i=new Map(s.map(c=>[c.id,c]));return u.map(c=>{var d;return(d=c.attachments)!=null&&d.some(h=>i.has(h.id))?{...c,attachments:c.attachments.map(h=>{const m=i.get(h.id);if(!m)return h;const w={...h,key:m.key,url:m.url,expiresAt:m.expiresAt};return delete w.data,w})}:c})}const nd=200,rd="claudius:messages",er=()=>new Date().toISOString();function ld(u,s){let i;try{i=new URL(s).host}catch{i=s}return`${u}:${i}`}function co(){try{return typeof sessionStorage<"u"?sessionStorage:null}catch{return null}}function od(u){const s=co();if(!s)return[];try{const i=s.getItem(u);if(!i)return[];const c=JSON.parse(i);return Array.isArray(c)?c:[]}catch{return[]}}function id({apiUrl:u,persistMessages:s=!0,storageKeyPrefix:i=rd,timeoutMs:c,translations:d,plugins:h,streaming:m=!0,citations:w=!1}){const x=E.useMemo(()=>new Hc(u,{debounceMs:0,timeoutMs:c,citations:w}),[u,c,w]),R=ld(i,u),j=s?od(R):[],[F,U]=E.useState(j),[O,L]=E.useState(!1),[N,B]=E.useState(!1),[V,K]=E.useState(null),[b,$]=E.useState(null),[se,G]=E.useState(!1),ee=E.useRef(j.length),ae=E.useRef(!1),te=E.useRef(j),De=E.useRef(null),me=E.useRef(h??[]);me.current=h??[];const ye=E.useCallback(g=>{if(!s)return;const T=co();if(T)try{const Y=mu(g.slice(-nd));T.setItem(R,JSON.stringify(Y))}catch{}},[s,R]),Ee=()=>(ee.current+=1,`msg-${ee.current}`),Re=E.useCallback((g,T)=>{if(!d)return T??"Something went wrong. Please try again.";switch(g){case"TIMEOUT":return d.errorTimeout;case"NETWORK_ERROR":return d.errorConnection;case"RATE_LIMITED":return T!=null&&T.includes("minute")?d.errorRateLimitMinute:d.errorRateLimitHour;case"ATTACHMENT_QUOTA_EXCEEDED":return d.errorAttachmentQuota;case"ATTACHMENTS_DISABLED":case"ATTACHMENT_INVALID":case"ATTACHMENT_TOO_LARGE":return d.errorAttachmentRejected;case"VALIDATION_ERROR":case"CONFIG_ERROR":case"SERVICE_ERROR":case"UNKNOWN_ERROR":default:return T??d.errorGeneric}},[d]),Ne=E.useCallback(g=>!(g instanceof rt)||g.code==="TIMEOUT"||g.code==="NETWORK_ERROR"||g.code==="RATE_LIMITED"||g.code==="SERVICE_ERROR"||g.code==="UNKNOWN_ERROR"||g.status>=500||g.status===0,[]),we=E.useCallback(async g=>{var ne,pe,Ce;L(!0),ae.current=!0,$(null),G(!1);const T=m&&typeof x.streamMessage=="function";let Y=null,D;const oe=()=>w?D:void 0,ie=he=>{if(Y===null){Y=Ee(),K(Y);const Me=[...te.current,{id:Y,role:"assistant",content:"",createdAt:er(),...oe()?{sources:D}:{},...he}];te.current=Me,U(Me)}else{const Me=Y,Se=te.current.map(Be=>Be.id===Me?{...Be,...he}:Be);te.current=Se,U(Se)}},fe=()=>{if(Y===null)return;const he=Y,Me=te.current.filter(Se=>Se.id!==he);te.current=Me,U(Me)};try{let he,Me,Se,Be,lt=!1;if(T){const ze=new AbortController;De.current=ze,B(!0);const Qe=await x.streamMessage(g,{signal:ze.signal,onChunk:(ht,I)=>ie({content:I}),onToolUse:(ht,I)=>ie({toolUses:[...I]}),onSources:ht=>{D=ht,w&&Y!==null&&ie({sources:ht})}});he=Qe.reply,Me=Qe.sources??D,Se=Qe.toolUses,Be=Qe.attachments,lt=Qe.aborted??!1}else{const ze=await x.sendMessage(g);he=ze.reply,Me=ze.sources,Se=ze.toolUses,Be=ze.attachments}if(lt&&!he){fe();return}const kt=((ne=te.current.find(ze=>ze.id===Y))==null?void 0:ne.createdAt)??er();let Ye={id:Y??Ee(),role:"assistant",content:he,createdAt:kt,sources:Me,toolUses:Se};me.current.length>0&&!lt&&(Ye=await Wc(me.current,Ye,{messages:g,apiUrl:u}),Ye.createdAt||(Ye={...Ye,createdAt:kt}));const Gt=Y!==null?te.current.map(ze=>ze.id===Ye.id?Ye:ze):[...g,Ye],Et=td(Gt,Be);te.current=Et,U(Et),ye(Et)}catch(he){if(he instanceof so)return;if(he instanceof rt&&((pe=he.code)!=null&&pe.startsWith("ATTACHMENT"))&&g.length>0){const Me=g[g.length-1];if(Me.role==="user"&&((Ce=Me.attachments)!=null&&Ce.length)){const Se=g.slice(0,-1);te.current=Se,U(Se),ye(Se)}}if(Y!==null){ye(te.current),he instanceof rt?$(Re(he.code,he.message)):$((d==null?void 0:d.errorConnection)??"Failed to connect. Please try again."),G(!1);return}if(me.current.length>0){const Me=he instanceof Error?he:new Error(String(he)),Se=await Qc(me.current,Me,{messages:g,apiUrl:u});if(Se){const Be={id:Ee(),role:"assistant",content:Se.content,createdAt:er(),sources:Se.sources},lt=[...g,Be];te.current=lt,U(lt),ye(lt),$(null),G(!1);return}}he instanceof rt?$(Re(he.code,he.message)):$((d==null?void 0:d.errorConnection)??"Failed to connect. Please try again."),G(Ne(he))}finally{L(!1),ae.current=!1,B(!1),K(null),De.current=null}},[u,w,x,Re,Ne,ye,m,d]),ce=E.useCallback(()=>{var g;(g=De.current)==null||g.abort()},[]),z=E.useCallback(async(g,T)=>{const Y=g.trim(),D=(T==null?void 0:T.filter(ne=>ne&&ne.id))??[];if(!Y&&D.length===0||ae.current)return;const oe={id:Ee(),role:"user",content:Y,createdAt:er(),...D.length>0?{attachments:D}:{}};let ie=oe;if(me.current.length>0){const ne=await bc(me.current,oe,{messages:te.current,apiUrl:u});if(ne.type==="abort")return;const pe=Ce=>Ce.createdAt?Ce:{...Ce,createdAt:oe.createdAt};if(ne.type==="respond"){const Ce={id:Ee(),role:"assistant",content:ne.reply.content,createdAt:er(),sources:ne.reply.sources},he=[...te.current,pe(ne.message),Ce];te.current=he,U(he),ye(he),$(null),G(!1);return}ie=pe(ne.message)}const fe=[...te.current,ie];te.current=fe,U(fe),ye(fe),await we(fe)},[u,ye,we]),q=E.useCallback(async()=>{if(ae.current)return;const g=te.current[te.current.length-1];!g||g.role!=="user"||await we(te.current)},[we]),H=E.useCallback(()=>{if(te.current=[],U([]),$(null),G(!1),s){const g=co();if(!g)return;try{g.removeItem(R)}catch{}}},[s,R]);return{messages:F,isLoading:O,isStreaming:N,streamingMessageId:V,error:b,canRetry:se,sendMessage:z,stop:ce,retry:q,clearMessages:H}}function ud(u){const[s,i]=E.useState(()=>typeof window>"u"?!1:window.matchMedia(u).matches);return E.useEffect(()=>{const c=window.matchMedia(u);i(c.matches);const d=h=>i(h.matches);return c.addEventListener("change",d),()=>c.removeEventListener("change",d)},[u]),s}function Qr(u,s){return u instanceof RegExp?u.test(s):s.toLowerCase().includes(u.toLowerCase())}function sd(){const u=document.documentElement,s=document.body,i=u.scrollTop||s.scrollTop||0,c=Math.max(u.scrollHeight,s.scrollHeight),d=u.clientHeight||window.innerHeight,h=c-d;return h<=0?100:i/h*100}function ad({triggers:u,enabled:s,onOpen:i,onGreeting:c}){E.useEffect(()=>{if(!s||!u||u.length===0)return;const d=new Set,h=[],m=typeof window<"u"?window.location.href:"",w=(x,R)=>{d.has(x)||(d.add(x),R==="open"?i():c(R.greeting))};return u.forEach((x,R)=>{switch(x.on){case"url":{Qr(x.pattern,m)&&w(R,x.action);break}case"time":{if(x.matchUrl&&!Qr(x.matchUrl,m))return;const j=window.setTimeout(()=>w(R,x.action),Math.max(0,x.seconds*1e3));h.push(()=>window.clearTimeout(j));break}case"scroll":{if(x.matchUrl&&!Qr(x.matchUrl,m))return;const j=()=>{sd()>=x.percent&&w(R,x.action)};j(),window.addEventListener("scroll",j,{passive:!0}),h.push(()=>window.removeEventListener("scroll",j));break}case"exit-intent":{if(x.matchUrl&&!Qr(x.matchUrl,m))return;const j=F=>{F.clientY<=0&&w(R,x.action)};document.addEventListener("mouseleave",j),h.push(()=>document.removeEventListener("mouseleave",j));break}}}),()=>{h.forEach(x=>x())}},[u,s,i,c])}const cd={"bottom-right":"bottom-6 right-6","bottom-left":"bottom-6 left-6","top-right":"top-6 right-6","top-left":"top-6 left-6"},dd=E.forwardRef(function({isOpen:s,onClick:i,position:c="bottom-right",translations:d},h){const m=s?(d==null?void 0:d.closeChat)??"Close chat":(d==null?void 0:d.openChat)??"Open chat";return p.jsx("button",{ref:h,onClick:i,"aria-label":m,className:`fixed ${cd[c]} z-50 flex h-14 w-14 items-center justify-center rounded-claudius-full bg-claudius-accent text-claudius-accent-text shadow-claudius-floating transition-transform hover:scale-105 focus:outline-none focus:ring-2 focus:ring-claudius-accent focus:ring-offset-2`,children:s?p.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[p.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),p.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}):p.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:p.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})})}),fd=E.memo(function({count:s,isActive:i,onClick:c}){return p.jsxs("button",{onClick:c,"aria-label":"View sources",title:"View sources",className:`group relative flex h-7 w-7 items-center justify-center rounded-claudius-full transition-colors ${i?"bg-claudius-accent text-claudius-accent-text":"text-claudius-text-muted hover:bg-claudius-surface-muted hover:text-claudius-text"}`,children:[p.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[p.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),p.jsx("polyline",{points:"14 2 14 8 20 8"}),p.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),p.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]}),p.jsx("span",{className:"absolute -right-1 -top-1 flex h-4 min-w-4 items-center justify-center rounded-claudius-full bg-claudius-accent px-1 text-[10px] font-bold text-claudius-accent-text",children:s})]})}),pd=["http:","https:"];function tr(u){if(!u||typeof u!="string")return null;const s=u.trim();if(!s)return null;try{const i=new URL(s);return pd.includes(i.protocol)?s:null}catch{return null}}function jn(u,s){return u.replace(/\{(\w+)\}/g,(i,c)=>c in s?String(s[c]):i)}const hd={maxSources:5};function md(u){const s=typeof u=="object"&&u!==null&&!Array.isArray(u);if(u!==!0&&!s)return null;const i=u===!0?{}:u,c=i.maxSources;return{maxSources:typeof c=="number"&&Number.isInteger(c)&&c>=1?c:hd.maxSources,favicons:i.favicons!==!1}}function gd(u){const s=u("citations");if(s===null)return;const i=s.trim().toLowerCase();if(i!==""&&i!=="true")return!1;const c={},d=u("citations-max-sources");if(d!==null&&/^\s*\d+\s*$/.test(d)){const m=Number(d);m>=1&&(c.maxSources=m)}const h=u("citations-favicons");return h!==null&&h.trim().toLowerCase()==="false"&&(c.favicons=!1),Object.keys(c).length>0?c:!0}const vd=/\[([1-9]\d{0,2}(?:\s*,\s*[1-9]\d{0,2})*)\]/g;function gu(u,s){if(!u)return[];if(s<=0||!u.includes("["))return[{type:"text",value:u}];const i=[];let c=0;for(const d of u.matchAll(vd)){const h=d[1].split(",").map(w=>Number(w.trim()));if(h.some(w=>w>s))continue;const m=d.index??0;m>c&&i.push({type:"text",value:u.slice(c,m)}),i.push({type:"cite",indexes:[...new Set(h)].map(w=>w-1),raw:d[0]}),c=m+d[0].length}return c0?c.slice(0,d):c).replace(/[\s,;:]+$/,"")}…`}function kd(u){try{const s=new URL(u);return s.protocol!=="http:"&&s.protocol!=="https:"?null:`${s.origin}/favicon.ico`}catch{return null}}function Ed(u){try{return new URL(u).hostname}catch{return u}}const Cd=1500;function Rd(){return typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)").matches:!1}const vu="flex h-4 min-w-4 shrink-0 items-center justify-center rounded-claudius-full bg-claudius-accent px-1 text-[10px] font-bold leading-none text-claudius-accent-text",Td=E.forwardRef(function({source:s,number:i,favicons:c,labels:d,highlighted:h},m){const w=tr(s.url),[x,R]=E.useState(!1),j=c&&w?kd(w):null,F=s.snippet?Sd(s.snippet):"";return p.jsxs("li",{ref:m,tabIndex:-1,"data-highlight":h||void 0,className:`flex gap-2 rounded-claudius-md border bg-claudius-surface-muted p-2 focus:outline-none focus-visible:ring-2 focus-visible:ring-claudius-accent ${h?"border-claudius-accent ring-2 ring-claudius-accent":"border-claudius-border"}`,children:[p.jsx("span",{"aria-hidden":"true",className:`mt-0.5 ${vu}`,children:i}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsxs("div",{className:"flex items-center gap-1.5",children:[j&&!x?p.jsx("img",{src:j,alt:"",width:14,height:14,loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",onError:()=>R(!0),className:"h-3.5 w-3.5 shrink-0 rounded-sm"}):p.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:"shrink-0",children:[p.jsx("circle",{cx:"12",cy:"12",r:"10"}),p.jsx("path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}),p.jsx("path",{d:"M2 12h20"})]}),w?p.jsxs("a",{href:w,target:"_blank",rel:"noopener noreferrer",className:"truncate font-medium text-claudius-text hover:underline",children:[s.title,p.jsxs("span",{className:"sr-only",children:[" ",d.opensInNewTab]})]}):p.jsx("span",{className:"truncate font-medium text-claudius-text",children:s.title}),w&&p.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:"shrink-0",children:[p.jsx("path",{d:"M15 3h6v6"}),p.jsx("path",{d:"M10 14 21 3"}),p.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]})]}),F&&p.jsx("p",{className:"mt-0.5 break-words",children:F}),w&&p.jsx("p",{className:"mt-0.5 truncate",children:Ed(w)})]})]})}),Nd=E.memo(function({sources:s,maxSources:i,favicons:c,labels:d,reveal:h=null}){const m=E.useId(),[w,x]=E.useState(!1),[R,j]=E.useState(!1),[F,U]=E.useState(null),[O,L]=E.useState(null),N=E.useRef(new Map),B=E.useRef(i);B.current=i,E.useEffect(()=>{h&&(U(h),x(!0),h.index>=B.current&&j(!0))},[h]),E.useEffect(()=>{if(!F)return;const b=N.current.get(F.index);b&&(typeof b.scrollIntoView=="function"&&b.scrollIntoView({block:"nearest",behavior:Rd()?"auto":"smooth"}),b.focus({preventScroll:!0}),L(F),U(null))},[F]),E.useEffect(()=>{if(!O)return;const b=setTimeout(()=>L(null),Cd);return()=>clearTimeout(b)},[O]);const V=s.length,K=R?s:s.slice(0,i);return p.jsxs("div",{className:"mt-1 text-xs text-claudius-text-muted",children:[p.jsxs("button",{type:"button",onClick:()=>x(b=>!b),"aria-expanded":w,"aria-controls":w?m:void 0,className:"flex items-center gap-1.5 rounded-claudius-full border border-claudius-border bg-claudius-surface px-2 py-0.5 hover:opacity-80 focus:outline-none focus-visible:ring-2 focus-visible:ring-claudius-accent",children:[p.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[p.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),p.jsx("polyline",{points:"14 2 14 8 20 8"}),p.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),p.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]}),p.jsx("span",{children:d.sources}),p.jsx("span",{className:vu,children:V}),p.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:w?"rotate-180":void 0,children:p.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),w&&p.jsxs(p.Fragment,{children:[p.jsx("ol",{id:m,"aria-label":d.sources,className:"mt-1 space-y-1.5",children:K.map((b,$)=>p.jsx(Td,{ref:se=>{se?N.current.set($,se):N.current.delete($)},source:b,number:$+1,favicons:c,labels:d,highlighted:(O==null?void 0:O.index)===$},`${$}-${b.url}`))}),V>i&&p.jsx("button",{type:"button",onClick:()=>j(b=>!b),"aria-expanded":R,className:"mt-1 font-medium text-claudius-link underline hover:opacity-80 focus:outline-none focus-visible:ring-2 focus-visible:ring-claudius-accent",children:R?d.showFewerSources:jn(d.showAllSources,{count:V})})]})]})});function jd(){return p.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[p.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),p.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function yu({label:u,onClick:s}){return p.jsx("button",{type:"button",onClick:s,"aria-label":u,className:"absolute -right-1.5 -top-1.5 flex h-5 w-5 items-center justify-center rounded-claudius-full bg-claudius-text text-claudius-surface shadow-claudius-floating hover:opacity-90 focus:outline-none focus-visible:ring-2 focus-visible:ring-claudius-accent",children:p.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round","aria-hidden":"true",children:[p.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),p.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}const wu=E.memo(function({attachment:s,variant:i,onRemove:c,removeLabel:d}){const h=Xc(s),m=i==="composer",w=`${s.name} (${Wr(s.size)})`,x=s.url?tr(s.url):null;if(h){const j=p.jsx("img",{src:h,alt:s.name,title:w,loading:"lazy",className:m?"h-12 w-12 rounded-claudius-sm border border-claudius-border object-cover":"max-h-48 max-w-full rounded-claudius-sm object-contain"});return p.jsxs("div",{className:"relative inline-block",children:[!m&&x?p.jsxs("a",{href:x,target:"_blank",rel:"noopener noreferrer",children:[j,p.jsxs("span",{className:"sr-only",children:[w," (opens in a new tab)"]})]}):j,c&&d&&p.jsx(yu,{label:d,onClick:c})]})}const R=p.jsxs("span",{title:w,className:`inline-flex max-w-[220px] items-center gap-1.5 rounded-claudius-sm border px-2 py-1 text-xs ${m?"border-claudius-border bg-claudius-field text-claudius-text":"border-current/30 bg-transparent"}`,children:[p.jsx(jd,{}),p.jsx("span",{className:"truncate",children:s.name}),p.jsx("span",{className:"shrink-0 opacity-70",children:Wr(s.size)})]});return p.jsxs("div",{className:"relative inline-block",children:[!m&&x?p.jsxs("a",{href:x,target:"_blank",rel:"noopener noreferrer",className:"underline-offset-2 hover:underline",children:[R,p.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]}):R,c&&d&&p.jsx(yu,{label:d,onClick:c})]})}),xu=E.forwardRef(function({label:s,onClick:i,children:c},d){return p.jsx("button",{ref:d,type:"button",onClick:i,"aria-label":s,title:s,className:"flex h-7 w-7 items-center justify-center rounded-claudius-full text-claudius-text-muted transition-colors hover:bg-claudius-surface-muted hover:text-claudius-text",children:p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c})})});function _d({state:u,labels:s,onPlay:i,onPause:c,onResume:d,onStop:h}){var j;const m=E.useRef(null),w=E.useRef(null),x=!!((j=m.current)!=null&&j.contains(document.activeElement));E.useEffect(()=>{var F,U;u==="idle"&&x&&!((F=m.current)!=null&&F.contains(document.activeElement))&&((U=w.current)==null||U.focus())},[u,x]);const R=u==="idle"?{label:s.play,onClick:i}:u==="paused"?{label:s.resume,onClick:d}:{label:s.pause,onClick:c};return p.jsxs("div",{ref:m,className:"flex items-center gap-1",children:[p.jsx(xu,{ref:w,...R,children:u==="idle"?p.jsxs(p.Fragment,{children:[p.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),p.jsx("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",fill:"none"}),p.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",fill:"none"})]}):u==="paused"?p.jsx("polygon",{points:"6 3 20 12 6 21 6 3"}):p.jsxs(p.Fragment,{children:[p.jsx("rect",{x:"6",y:"4",width:"4",height:"16",rx:"1"}),p.jsx("rect",{x:"14",y:"4",width:"4",height:"16",rx:"1"})]})}),u!=="idle"&&p.jsx(xu,{label:s.stop,onClick:h,children:p.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1.5"})})]})}function Md(u){const s=u.lastIndexOf(` +`),i=s===-1?"":u.slice(0,s+1);let c=s===-1?u:u.slice(s+1);return c=Pd(c),c=Dd(c),i+c}function Ld(u){const s=[];for(let i=0;id(m=>!m),"aria-expanded":h?c:void 0,className:"flex items-center gap-1.5 rounded-claudius-full border border-claudius-border bg-claudius-surface px-2 py-0.5 hover:opacity-80 disabled:cursor-default disabled:hover:opacity-100",children:[p.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:p.jsx("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})}),p.jsxs("span",{children:[s," ",p.jsx("span",{className:"font-mono text-claudius-text",children:u.name}),u.isError&&p.jsx("span",{className:"text-claudius-error",children:" ✕"})]}),h&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"sr-only",children:i}),p.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:c?"rotate-180":void 0,children:p.jsx("polyline",{points:"6 9 12 15 18 9"})})]})]}),c&&h&&p.jsxs("div",{className:"mt-1 overflow-x-auto rounded-claudius-sm border border-claudius-border bg-claudius-field p-2 font-mono",children:[u.input!==void 0&&p.jsx("pre",{className:"whitespace-pre-wrap break-all",children:JSON.stringify(u.input,null,2)}),u.result!==void 0&&p.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-all border-t border-claudius-border pt-1",children:u.result})]})]})}const Su=/(https?:\/\/[^\s)]+)/,ku=/(\*\*[^*]+\*\*)/,Eu=/(\*[^*]+\*)/,Id=/(?:\[[1-9]\d{0,2}(?:\s*,\s*[1-9]\d{0,2})*\])+$/;function Od(u,s,i){const c=u.match(/[.,;:!?'"]+$/),d=c?u.slice(0,-c[0].length):u,h=c?c[0]:"",m=i.citations?d.match(Id):null,w=m?d.slice(0,-m[0].length):d,x=tr(w);return x?p.jsxs(E.Fragment,{children:[p.jsxs("a",{href:x,target:"_blank",rel:"noopener noreferrer",className:"underline font-medium hover:opacity-80 text-claudius-link",children:[x.replace(/^https?:\/\//,""),p.jsxs("span",{className:"sr-only",children:[" ",i.newTabLabel]})]}),m&&Cu(m[0],`${s}-m`,i),h]},s):u}function Cu(u,s,i){const c=i.citations;return c?gu(u,c.sources.length).map((d,h)=>d.type==="text"?d.value:p.jsx("span",{className:"inline-flex gap-0.5 align-super",children:d.indexes.map(m=>p.jsx("button",{type:"button",onClick:()=>c.onCite(m),"aria-label":jn(c.label,{n:m+1,title:c.sources[m].title}),title:c.sources[m].title,className:"inline-flex h-4 min-w-4 items-center justify-center rounded-claudius-full bg-claudius-accent px-1 text-[10px] font-semibold leading-none text-claudius-accent-text hover:opacity-80 focus:outline-none focus-visible:ring-2 focus-visible:ring-claudius-accent focus-visible:ring-offset-1",children:m+1},m))},`${s}-c${h}`)):u?[u]:[]}function fo(u,s,i){const c=[];return u.split(Su).forEach((d,h)=>{Su.test(d)?c.push(Od(d,`${s}-u${h}`,i)):d&&c.push(...Cu(d,`${s}-u${h}`,i))}),c}function Fd(u,s,i){const c=[];return u.split(ku).forEach((d,h)=>{if(ku.test(d)){c.push(p.jsx("strong",{children:fo(d.slice(2,-2),`${s}-b${h}`,i)},`${s}-b${h}`));return}d.split(Eu).forEach((m,w)=>{const x=`${s}-b${h}-i${w}`;Eu.test(m)?c.push(p.jsx("em",{children:fo(m.slice(1,-1),x,i)},x)):c.push(...fo(m,x,i))})}),c}function Ud(u,s){const i=u.split(` +`);return i.map((c,d)=>p.jsxs("span",{children:[Fd(c,`l${d}`,s),d0?{config:U,sources:d}:null,b=!!h&&h.length>0,$=c&&K?wd(i):i,se=c?Md($):$,G={newTabLabel:O,citations:K?{sources:K.sources,label:K.config.labels.citation,onCite:ae=>{V.current+=1,B({index:ae,key:V.current})}}:void 0},ee=L||i!==""||!(m!=null&&m.length);return p.jsxs("div",{className:`${L?"ml-auto":"mr-auto"} max-w-[85%]`,children:[ee&&p.jsxs("div",{className:`rounded-claudius-bubble px-4 py-2.5 text-sm leading-relaxed font-body ${L?"bg-claudius-user-bubble text-claudius-user-bubble-text rounded-br-claudius-tail":"bg-claudius-assistant-bubble text-claudius-assistant-bubble-text rounded-bl-claudius-tail"}`,children:[b&&p.jsx("ul",{className:`flex flex-wrap gap-2 ${i?"mb-2":""}`,"aria-label":"Attachments",children:h.map(ae=>p.jsx("li",{children:p.jsx(wu,{attachment:ae,variant:"message"})},ae.id))}),(i!==""||!b)&&Ud(se,G)]}),!L&&m&&m.length>0&&p.jsx("div",{className:"mt-1 space-y-1",children:m.map((ae,te)=>p.jsx(zd,{toolUse:ae,usedLabel:w,detailsLabel:x},`${ae.name}-${te}`))}),K?p.jsx(Nd,{sources:K.sources,maxSources:K.config.maxSources,favicons:K.config.favicons,labels:K.config.labels,reveal:N}):!L&&d&&d.length>0&&R&&p.jsx("div",{className:"mt-1",children:p.jsx(fd,{count:d.length,isActive:j??!1,onClick:R})}),!L&&F&&p.jsx("div",{className:"mt-1",children:p.jsx(_d,{...F})})]})}),Ru={title:"Chat",subtitle:"Ask me anything",welcomeMessage:"Hi! How can I help you today?",closeChat:"Close chat",chatMessages:"Chat messages",typingIndicator:"Assistant is typing",placeholder:"Type your message...",sendMessage:"Send message",stopGenerating:"Stop generating",toolUsed:"Used tool:",toolDetails:"Tool details",typeYourMessage:"Type your message",openChat:"Open chat",dismissGreeting:"Dismiss greeting",attachFile:"Attach a file",removeAttachment:"Remove attachment",attachmentsLabel:"Attachments",dropFilesHint:"Drop files to attach",attachmentTooLarge:"{name} is too large. The maximum size is {max}.",attachmentTypeNotAllowed:"{name} is not a supported file type.",attachmentTooMany:"You can attach up to {max} files per message.",voiceInput:"Voice input",voiceInputHold:"Hold to talk",voiceListening:"Listening...",voicePermissionDenied:"Microphone access is blocked. Allow it in your browser settings to use voice input.",voiceNoSpeech:"No speech was detected. Please try again.",voiceNoMicrophone:"No microphone was found.",voiceUnavailable:"Voice input is not available right now.",readAloud:"Read aloud",pauseReading:"Pause reading",resumeReading:"Resume reading",stopReading:"Stop reading",moreOptions:"More options",copyAsMarkdown:"Copy as Markdown",downloadAsMarkdown:"Download as Markdown",downloadAsJson:"Download as JSON",copiedToClipboard:"Copied to clipboard",copyFailed:"Could not copy. Try downloading instead.",transcriptTitle:"Chat transcript",transcriptExported:"Exported {date}",transcriptUser:"User",transcriptAssistant:"Assistant",transcriptAttachments:"Attachments:",transcriptSources:"Sources:",sources:"Sources",showAllSources:"Show all ({count})",showFewerSources:"Show fewer",citation:"Source {n}: {title}",opensInNewTab:"(opens in a new tab)",errorGeneric:"Something went wrong. Please try again.",errorConnection:"Failed to connect. Please try again.",errorTimeout:"Request timed out. Please try again.",errorRateLimitMinute:"Too many requests. Please wait a minute.",errorRateLimitHour:"Hourly limit reached. Please try again later.",errorAttachmentRejected:"An attachment was rejected. Please remove it and try again.",errorAttachmentQuota:"Upload limit reached. Please try again later.",errorRetry:"Retry"},Tu=Ru;function Nu(u){return u.key===" "||u.key==="Enter"}function $d({mode:u,isListening:s,disabled:i=!1,onStart:c,onStop:d,label:h}){const m=u==="hold",w=E.useRef(!1),x=()=>{i||w.current||(w.current=!0,c({held:!0}))},R=()=>{w.current&&(w.current=!1,d())},j=L=>{m&&L.detail!==0||(s?d():c({held:!1}))},F=L=>{var N,B;!m||L.button!==0||((B=(N=L.currentTarget).setPointerCapture)==null||B.call(N,L.pointerId),x())},U=L=>{!m||!Nu(L)||(L.preventDefault(),L.repeat||x())},O=L=>{!m||!Nu(L)||(L.preventDefault(),R())};return p.jsx("button",{type:"button",disabled:i,"aria-label":h,"aria-pressed":s,title:h,onClick:j,onPointerDown:F,onPointerUp:R,onPointerCancel:R,onLostPointerCapture:R,onKeyDown:U,onKeyUp:O,onBlur:R,onContextMenu:m?L=>L.preventDefault():void 0,style:m?{WebkitTouchCallout:"none"}:void 0,className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-claudius-sm border transition-colors focus:outline-none focus:ring-1 focus:ring-claudius-accent disabled:opacity-50 ${s?"border-claudius-accent bg-claudius-accent text-claudius-accent-text focus:ring-2 focus:ring-offset-2 focus:ring-offset-claudius-surface":"border-claudius-border bg-claudius-field text-claudius-text-muted hover:text-claudius-text focus:border-claudius-accent"} ${m?"touch-none select-none":""}`,children:s&&!m?p.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:p.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1.5"})}):p.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[p.jsx("path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"}),p.jsx("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),p.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"22"})]})})}function Hd({active:u}){return p.jsxs("span",{"aria-hidden":"true","data-claudius-voice-level":u?"active":"idle",className:"claudius-voice-level pointer-events-none absolute right-3 top-1/2 flex h-4 -translate-y-1/2 items-center gap-0.5 text-claudius-accent",children:[p.jsx("span",{}),p.jsx("span",{}),p.jsx("span",{}),p.jsx("span",{})]})}const Vd={en:"en-US",es:"es-ES",fr:"fr-FR",de:"de-DE"},bd=["toggle","hold"];function ju(u,s){if(!(!u||!u.includes("-")))return u.toLowerCase().split("-")[0]===s?u:void 0}function _u(u,s){const i=s==null?void 0:s.trim();if(i)return i;const c=typeof document<"u"?ju(document.documentElement.lang,u):void 0;if(c)return c;const d=typeof navigator<"u"?ju(navigator.language,u):void 0;return d||Vd[u]}function Wd(u,s){const i=typeof u=="object"&&u!==null&&!Array.isArray(u);if(u!==!0&&!i)return null;const c=u===!0?{}:u,d={input:c.input??!0,output:c.output??!0,mode:bd.includes(c.mode)?c.mode:"toggle",autoSubmit:c.autoSubmit??!1,lang:_u(s,c.lang)};return d.input||d.output?d:null}function Qd(u){const s=u("voice");if(s===null)return;if(s==="false")return!1;const i={},c=R=>{const j=u(R);return j===null?void 0:j!=="false"},d=u("voice-mode");d!==null&&(i.mode=d);const h=c("voice-auto-submit");h!==void 0&&(i.autoSubmit=h);const m=c("voice-input");m!==void 0&&(i.input=m);const w=c("voice-output");w!==void 0&&(i.output=w);const x=u("voice-lang");return x!==null&&(i.lang=x),Object.keys(i).length>0?i:!0}function Kd(u,s,i){const c=s.trim();if(!c)return u;const d=u.trimEnd();return(d?`${d} ${c}`:c).slice(0,i)}function Gd(u){const s=[];let i=0;for(let c=0;c{const h=c.trim();h&&i.push(h),c=""};for(const h of Gd(u)){if((c+h).trim().length<=s){c+=h;continue}if(d(),h.trim().length<=s){c=h;continue}for(let m of h.trim().split(/\s+/)){for(c&&`${c} ${m}`.length>s&&d();m.length>s;)i.push(m.slice(0,s)),m=m.slice(s);c=c?`${c} ${m}`:m}}return d(),i}function Mu(){if(typeof window>"u")return;const u=window;return u.SpeechRecognition??u.webkitSpeechRecognition}function Xd(u){switch(u){case"not-allowed":case"service-not-allowed":return"permission";case"no-speech":return"no-speech";case"audio-capture":return"no-microphone";default:return"unavailable"}}function Zd(u){const[s]=E.useState(()=>Mu()!==void 0),[i,c]=E.useState(!1),[d,h]=E.useState(!1),m=E.useRef(null),w=E.useRef(!1),x=E.useRef(u);E.useEffect(()=>{x.current=u});const R=E.useCallback(O=>{O.onstart=null,O.onend=null,O.onerror=null,O.onresult=null,O.onspeechstart=null,O.onspeechend=null,m.current===O&&(m.current=null),c(!1),h(!1)},[]),j=E.useCallback(()=>{const O=m.current;O&&(R(O),O.abort())},[R]),F=E.useCallback(()=>{const O=m.current;return O?(w.current?O.stop():j(),!0):!1},[j]),U=E.useCallback(()=>{var V,K;const O=Mu();if(!O||m.current)return!1;const L=new O;L.lang=x.current.lang,L.interimResults=!0,L.continuous=!1;let N="";const B=()=>{w.current=!0};L.onstart=B,L.onspeechstart=()=>{B(),h(!0)},L.onspeechend=()=>h(!1),L.onresult=b=>{var G,ee;let $="",se="";for(let ae=0;ae{var $,se;b.error!=="aborted"&&((se=($=x.current).onError)==null||se.call($,Xd(b.error))),R(L),L.abort()},L.onend=()=>{var b,$;R(L),($=(b=x.current).onEnd)==null||$.call(b,N)},m.current=L,w.current=!1,c(!0);try{L.start()}catch{return R(L),(K=(V=x.current).onError)==null||K.call(V,"unavailable"),!1}return!0},[R]);return E.useEffect(()=>j,[j]),{isSupported:s,isListening:i,isSpeechDetected:d,start:U,stop:F,abort:j}}const nr=2e3,Jd=1800;function Lu(u){var i;const s=(i=u.dataTransfer)==null?void 0:i.types;return!!s&&Array.from(s).includes("Files")}function qd({onSend:u,isLoading:s,isStreaming:i=!1,onStop:c,placeholder:d,translations:h,attachments:m=null,voice:w=null,onVoiceStart:x,isReadingAloud:R=!1}){const j=h??Tu,[F,U]=E.useState(""),[O,L]=E.useState([]),[N,B]=E.useState(null),[V,K]=E.useState(!1),[b,$]=E.useState(null),se=E.useRef(null),G=E.useRef(null),ee=E.useRef([]),ae=E.useRef(0),te=E.useRef(""),De=E.useRef(""),me=E.useRef(!1),ye=E.useRef(!1),Ee=E.useRef(!1),Re=I=>{te.current=I,U(I)},Ne=F.length,we=Ne>=Jd,ce=Ne>=nr,z=d??j.placeholder,q=!!m&&O.length{var I;s||(I=se.current)==null||I.focus()},[s]);const g=E.useCallback((I,xe)=>{if(!m)return"";switch(xe){case"size":return jn(j.attachmentTooLarge,{name:I,max:Wr(m.maxSizeBytes)});case"type":return jn(j.attachmentTypeNotAllowed,{name:I});case"count":return jn(j.attachmentTooMany,{max:m.maxCount})}},[m,j]),T=E.useCallback(async I=>{if(!m||I.length===0)return;const{accepted:xe,rejected:Ct}=Zc(I,ee.current.length,m);if(B(Ct.length>0?g(Ct[0].file.name,Ct[0].reason):null),xe.length===0)return;const Gr=await Promise.all(xe.map(ed));ee.current=[...ee.current,...Gr],L(ee.current)},[m,g]),Y=E.useCallback(I=>{ee.current=ee.current.filter(xe=>xe.id!==I),L(ee.current),B(null)},[]),D=()=>{const I=te.current.trim(),xe=ee.current;!I&&xe.length===0||te.current.length>=nr||(xe.length>0?u(I,xe):u(I),Re(""),ee.current=[],L([]),B(null),$(null))},oe=I=>{switch(I){case"permission":return j.voicePermissionDenied;case"no-speech":return j.voiceNoSpeech;case"no-microphone":return j.voiceNoMicrophone;case"unavailable":return j.voiceUnavailable}},ie=Zd({lang:(w==null?void 0:w.lang)??"en-US",onTranscript:I=>Re(Kd(De.current,I,nr)),onEnd:I=>{const xe=I.trim()!=="";if(xe&&(ye.current=!0),!me.current){pe();return}xe&&Ce()},onError:I=>{I==="no-speech"&&ye.current||(Ee.current=!0,$(oe(I)))}}),fe=!!(w!=null&&w.input)&&ie.isSupported,ne=ie.isListening;E.useEffect(()=>{const I=se.current;ne&&I&&(I.scrollLeft=I.scrollWidth)},[ne,F]);const pe=()=>{w!=null&&w.autoSubmit&&ye.current&&!Ee.current&&D()},Ce=()=>{const I=te.current;ie.start()&&(De.current=I)},he=({held:I})=>{$(null),me.current=I,ye.current=!1,Ee.current=!1,x==null||x(),Ce()},Me=()=>{const I=me.current;me.current=!1,!ie.stop()&&I&&pe()},Se=()=>{me.current=!1,ie.abort()},{abort:Be}=ie;E.useEffect(()=>{!s&&!R||(me.current=!1,Be())},[s,R,Be]);const lt=I=>{I.preventDefault(),Se(),D()},kt=I=>{const xe=I.target.value;xe.length<=nr&&(Se(),$(null),Re(xe))},Ye=I=>{const xe=Array.from(I.target.files??[]);I.target.value="",T(xe)},Gt=I=>{var Ct;if(!m)return;const xe=Array.from(((Ct=I.clipboardData)==null?void 0:Ct.files)??[]);xe.length!==0&&(I.preventDefault(),T(xe))},Et=I=>{!m||!Lu(I)||(I.preventDefault(),ae.current+=1,K(!0))},ze=I=>{!m||!Lu(I)||I.preventDefault()},Qe=()=>{m&&(ae.current=Math.max(0,ae.current-1),ae.current===0&&K(!1))},ht=I=>{var xe;m&&(I.preventDefault(),ae.current=0,K(!1),T(Array.from(((xe=I.dataTransfer)==null?void 0:xe.files)??[])))};return p.jsxs("form",{onSubmit:lt,onDragEnter:Et,onDragOver:ze,onDragLeave:Qe,onDrop:ht,"data-drag-over":V||void 0,className:`relative border-t border-claudius-border bg-claudius-surface p-3 ${V?"ring-2 ring-inset ring-claudius-accent":""}`,children:[V&&p.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-claudius-surface text-sm font-medium text-claudius-accent",children:j.dropFilesHint}),m&&O.length>0&&p.jsx("ul",{"aria-label":j.attachmentsLabel,className:"mb-2 flex flex-wrap gap-3 pt-1",children:O.map(I=>p.jsx("li",{children:p.jsx(wu,{attachment:I,variant:"composer",onRemove:()=>Y(I.id),removeLabel:`${j.removeAttachment}: ${I.name}`})},I.id))}),p.jsxs("div",{className:"flex gap-2",children:[m&&p.jsxs(p.Fragment,{children:[p.jsx("input",{ref:G,type:"file",multiple:!0,hidden:!0,tabIndex:-1,accept:m.allowedTypes.join(","),onChange:Ye,"aria-label":j.attachFile}),p.jsx("button",{type:"button",onClick:()=>{var I;return(I=G.current)==null?void 0:I.click()},disabled:s||!q,"aria-label":j.attachFile,title:j.attachFile,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-claudius-sm border border-claudius-border bg-claudius-field text-claudius-text-muted transition-colors hover:text-claudius-text focus:border-claudius-accent focus:outline-none focus:ring-1 focus:ring-claudius-accent disabled:opacity-50",children:p.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:p.jsx("path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"})})})]}),p.jsxs("div",{className:"relative min-w-0 flex-1",children:[p.jsx("input",{ref:se,type:"text",value:F,onChange:kt,onPaste:Gt,placeholder:ne?j.voiceListening:z,disabled:s,"aria-label":j.typeYourMessage,"aria-describedby":we?"char-count":void 0,className:`h-full w-full rounded-claudius-sm border border-claudius-border bg-claudius-field py-2 pl-3 text-sm font-body text-claudius-text placeholder:text-claudius-text-muted focus:border-claudius-accent focus:outline-none focus:ring-1 focus:ring-claudius-accent disabled:opacity-50 ${ne?"pr-10":"pr-3"}`}),ne&&p.jsx(Hd,{active:ie.isSpeechDetected})]}),fe&&w&&p.jsx($d,{mode:w.mode,isListening:ne,disabled:s,onStart:he,onStop:Me,label:w.mode==="hold"?j.voiceInputHold:j.voiceInput}),H?p.jsx("button",{type:"button",onClick:c,"aria-label":j.stopGenerating,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-claudius-sm bg-claudius-accent text-claudius-accent-text transition-colors hover:opacity-90",children:p.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:p.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1.5"})})}):p.jsx("button",{type:"submit",disabled:s||ce,"aria-label":j.sendMessage,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-claudius-sm bg-claudius-accent text-claudius-accent-text transition-colors hover:opacity-90 disabled:opacity-50",children:p.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[p.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),p.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),(N??b)&&p.jsx("div",{role:"alert",className:"mt-1 text-xs text-claudius-error",children:N??b}),we&&p.jsxs("div",{id:"char-count",className:`mt-1 text-xs text-right ${ce?"text-claudius-error":"text-claudius-text-muted"}`,"aria-live":"polite",children:[Ne,"/",nr]})]})}const ef=["blog","page","external"],tf={blog:"Blog",page:"Page",external:"External"};function nf(u){try{return new URL(u).hostname}catch{return u}}const rf=E.memo(function({sources:s,onClose:i}){const c=ef.map(h=>({type:h,label:tf[h],items:s.filter(m=>m.type===h)})).filter(h=>h.items.length>0),d=s.length===1?"1 source found":`${s.length} sources found`;return p.jsxs("div",{className:"absolute inset-y-0 left-0 z-10 flex w-[280px] flex-col border-r-2 border-claudius-border bg-claudius-surface rounded-r-claudius-lg transition-transform duration-200 ease-out",children:[p.jsxs("div",{className:"flex items-center justify-between border-b border-claudius-border px-4 py-3",children:[p.jsxs("div",{children:[p.jsx("h3",{className:"text-sm font-heading font-semibold text-claudius-text",children:"Sources"}),p.jsx("p",{className:"text-xs text-claudius-text-muted",children:d})]}),p.jsx("button",{onClick:i,"aria-label":"Close sources",className:"flex h-7 w-7 items-center justify-center rounded-claudius-full text-claudius-text-muted transition-colors hover:bg-claudius-surface-muted hover:text-claudius-text",children:p.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[p.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),p.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),p.jsx("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-4",children:c.map(h=>p.jsxs("div",{children:[p.jsx("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-claudius-text-muted",children:h.label}),p.jsx("div",{className:"space-y-2",children:h.items.map(m=>{const w=tr(m.url);return w?p.jsxs("a",{href:w,target:"_blank",rel:"noopener noreferrer",className:"block rounded-claudius-md border-2 border-claudius-border bg-claudius-surface-muted p-3 transition-colors hover:bg-claudius-border",children:[p.jsx("p",{className:"truncate text-sm font-medium text-claudius-text",children:m.title}),p.jsx("p",{className:"mt-0.5 text-xs text-claudius-text-muted",children:nf(w)})]},w):null})})]},h.type))})]})});function lf({title:u,subtitle:s,titleId:i,closeLabel:c,onClose:d,actions:h}){return p.jsxs("div",{className:"flex items-center gap-3 bg-claudius-accent px-5 py-4",children:[p.jsx("div",{"aria-hidden":"true",className:"flex h-8 w-8 items-center justify-center rounded-claudius-full bg-claudius-accent-soft text-sm font-bold text-claudius-accent-text",children:u.charAt(0).toUpperCase()}),p.jsxs("div",{className:"flex-1",children:[p.jsx("h2",{id:i,className:"text-sm font-heading font-semibold text-claudius-accent-text",children:u}),p.jsx("p",{className:"text-xs text-claudius-accent-text",children:s})]}),h,p.jsx("button",{onClick:d,"aria-label":c,className:"flex h-10 w-10 items-center justify-center rounded-claudius-full text-claudius-accent-text-muted transition-colors hover:bg-claudius-accent-soft hover:text-claudius-accent-text",children:p.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[p.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),p.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}function of({message:u,retryLabel:s,onRetry:i}){return p.jsxs("div",{role:"alert",className:"mx-auto flex max-w-[90%] flex-col items-center gap-2 rounded-claudius-sm bg-claudius-error-surface px-3 py-2 text-center text-xs text-claudius-error",children:[p.jsx("span",{children:u}),i&&p.jsx("button",{type:"button",onClick:i,className:"rounded-claudius-md bg-claudius-error px-3 py-1 text-xs font-semibold text-claudius-error-text transition-opacity hover:opacity-90 focus:outline-none focus-visible:ring-2 focus-visible:ring-claudius-error focus-visible:ring-offset-1",children:s})]})}function uf({label:u}){return p.jsx("div",{role:"status","aria-live":"polite","aria-label":u,className:"mr-auto flex max-w-[85%]",children:p.jsxs("div",{className:"flex gap-1 rounded-claudius-bubble rounded-bl-claudius-tail bg-claudius-assistant-bubble px-4 py-3",children:[p.jsx("span",{className:"h-2 w-2 motion-safe:animate-bounce rounded-claudius-full bg-claudius-text-muted [animation-delay:0ms]"}),p.jsx("span",{className:"h-2 w-2 motion-safe:animate-bounce rounded-claudius-full bg-claudius-text-muted [animation-delay:150ms]"}),p.jsx("span",{className:"h-2 w-2 motion-safe:animate-bounce rounded-claudius-full bg-claudius-text-muted [animation-delay:300ms]"})]})})}function sf({label:u,items:s,onOpen:i}){const[c,d]=E.useState(!1),h=E.useId(),m=E.useId(),w=E.useRef(null),x=E.useRef(null),R=E.useRef([]),j=E.useRef(null),F=V=>{j.current=V,d(!0),i==null||i()},U=V=>{var K;d(!1),(K=x.current)==null||K.focus()};E.useEffect(()=>{var K;if(!c)return;j.current!==null&&((K=R.current[j.current])==null||K.focus(),j.current=null);const V=b=>{var $;($=w.current)!=null&&$.contains(b.target)||d(!1)};return document.addEventListener("pointerdown",V),()=>document.removeEventListener("pointerdown",V)},[c]);const O=V=>{var b;const K=s.length;(b=R.current[(V+K)%K])==null||b.focus()},L=V=>{V.key==="ArrowDown"?(V.preventDefault(),F(0)):V.key==="ArrowUp"&&(V.preventDefault(),F(s.length-1))},N=V=>{const K=R.current.findIndex(b=>b===document.activeElement);switch(V.key){case"ArrowDown":V.preventDefault(),O(K+1);break;case"ArrowUp":V.preventDefault(),O(K===-1?s.length-1:K-1);break;case"Home":V.preventDefault(),O(0);break;case"End":V.preventDefault(),O(s.length-1);break;case"Escape":V.preventDefault(),V.stopPropagation(),U();break;case"Tab":V.shiftKey&&(V.preventDefault(),U());break}},B=V=>{var b;const K=V.relatedTarget;K&&((b=w.current)!=null&&b.contains(K)||d(!1))};return p.jsxs("div",{ref:w,className:"relative",children:[p.jsx("button",{ref:x,id:h,type:"button","aria-label":u,"aria-haspopup":"menu","aria-expanded":c,"aria-controls":c?m:void 0,onClick:()=>c?U():F(0),onKeyDown:L,className:"flex h-10 w-10 items-center justify-center rounded-claudius-full text-claudius-accent-text-muted transition-colors hover:bg-claudius-accent-soft hover:text-claudius-accent-text",children:p.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[p.jsx("circle",{cx:"12",cy:"5",r:"1.75"}),p.jsx("circle",{cx:"12",cy:"12",r:"1.75"}),p.jsx("circle",{cx:"12",cy:"19",r:"1.75"})]})}),c&&p.jsx("div",{id:m,role:"menu","aria-labelledby":h,tabIndex:-1,onKeyDown:N,onBlur:B,className:"absolute right-0 top-full z-20 mt-1 min-w-[12rem] rounded-claudius-md border border-claudius-border bg-claudius-surface py-1 shadow-claudius-elevated",children:s.map((V,K)=>p.jsx("button",{ref:b=>{R.current[K]=b},type:"button",role:"menuitem",tabIndex:-1,"aria-disabled":V.disabled||void 0,onClick:()=>{V.disabled||(U(),V.onSelect())},className:"flex min-h-[40px] w-full items-center whitespace-nowrap px-4 text-left text-sm text-claudius-text hover:bg-claudius-surface-muted focus:bg-claudius-surface-muted aria-disabled:cursor-default aria-disabled:opacity-50 aria-disabled:hover:bg-transparent",children:V.label},V.id))})]})}function af(u,s,i){const[c,d]=E.useState(0),h=E.useRef(0),m=E.useRef(0),w=E.useRef(0),x=E.useRef(!1);return E.useEffect(()=>{const R=u.current;if(!i||!R)return;const j=O=>{if(R.scrollTop>0){x.current=!1;return}x.current=!0,m.current=O.touches[0].clientY,w.current=Date.now()},F=O=>{if(!x.current)return;let L=O.touches[0].clientY-m.current;L<0&&(L=L*.3),h.current=L,d(L)},U=()=>{if(!x.current)return;x.current=!1;const O=h.current,L=(Date.now()-w.current)/1e3,N=R.getBoundingClientRect().height,B=L>.05&&O>0&&O/L>500,V=O>N*.3;B||V?s():(h.current=0,d(0))};return R.addEventListener("touchstart",j,{passive:!0}),R.addEventListener("touchmove",F,{passive:!0}),R.addEventListener("touchend",U),()=>{R.removeEventListener("touchstart",j),R.removeEventListener("touchmove",F),R.removeEventListener("touchend",U)}},[u,s,i]),{offsetY:c}}const cf='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function df(u,s){E.useEffect(()=>{const i=u.current;if(!i)return;const c=d=>{if(d.key!=="Tab")return;const h=Array.from(i.querySelectorAll(cf)).filter(R=>!R.hasAttribute("aria-hidden"));if(h.length===0)return;const m=h[0],w=h[h.length-1],x=document.activeElement;d.shiftKey&&x===m?(d.preventDefault(),w.focus()):!d.shiftKey&&x===w&&(d.preventDefault(),m.focus())};return i.addEventListener("keydown",c),()=>i.removeEventListener("keydown",c)},[u,s])}function rr(){if(!(typeof window>"u")&&!(typeof window.SpeechSynthesisUtterance>"u"))return window.speechSynthesis??void 0}function ff(u){const[s]=E.useState(()=>rr()!==void 0),[i,c]=E.useState(null),[d,h]=E.useState(!1),m=E.useRef(0),w=E.useRef(!1),x=E.useRef([]),R=E.useCallback(()=>{m.current+=1,w.current=!1,x.current=[],c(null),h(!1)},[]),j=E.useCallback(()=>{const L=x.current.length>0;R();const N=rr();!L||!N||(N.cancel(),N.paused&&N.resume())},[R]),F=E.useCallback((L,N)=>{const B=rr();if(!B)return;R(),(B.speaking||B.pending)&&B.cancel(),B.paused&&B.resume();const V=Yd(N);if(V.length===0)return;const K=m.current,b=()=>m.current===K;x.current=V.map(($,se)=>{const G=new SpeechSynthesisUtterance($);return G.lang=u,G.onerror=ee=>{if(!b())return;(ee.error==="interrupted"||ee.error==="canceled")&&!w.current?R():j()},G.onpause=()=>{b()&&h(!0)},G.onresume=()=>{b()&&h(!1)},G.onend=()=>{b()&&(w.current&&!B.paused?j():se===V.length-1&&R())},G}),c(L);for(const $ of x.current)B.speak($)},[u,j,R]),U=E.useCallback(()=>{const L=rr();L&&(w.current=!0,L.pause(),L.paused&&h(!0))},[]),O=E.useCallback(()=>{const L=rr();L&&(w.current=!1,L.resume(),h(!1))},[]);return E.useEffect(()=>j,[j]),{isSupported:s,activeId:i,isPaused:d,speak:F,pause:U,resume:O,cancel:j}}const pf=/^([ \t]*)(`{3,}|~{3,})(.*)$/,hf=/^( {0,3})<(?![A-Za-z][A-Za-z0-9+.-]{1,31}:[^<>\s]*>|[A-Za-z0-9][^\s<>@]*@[^\s<>]+>)(?=[A-Za-z!?/])/,mf=/^(?: {4}|\t)/;function Au(u){let s=0;for(const i of u)if(i===" ")s+=1;else if(i===" ")s+=4-s%4;else break;return s}function Pu(u){let s=u.length;for(;s>0&&(u[s-1]===" "||u[s-1]===" ");)s-=1;return s===u.length?u:u.slice(0,s)}function gf(u){const s=pf.exec(u);if(!s)return null;const[,i,c,d]=s;return c[0]==="`"&&d.includes("`")?null:{indent:i,indentColumns:Au(i),char:c[0],length:c.length}}function vf(u,s){const i=u.trim();if(i.length0&&i[i.length-1].trim()==="";)i.pop();i.length>0&&(i[i.length-1]=_u(i[i.length-1]))}return i.join(` -`)}const ef=/[\u00a0\u202f]/g;function tf(u){if(u.formatDate)return u.formatDate;const a=f=>new Intl.DateTimeFormat(f,{dateStyle:"medium",timeStyle:"short",timeZone:u.timeZone});let i=null;try{i=a(u.locale)}catch{try{i=a(void 0)}catch{i=null}}const c=i;return c?f=>c.format(f):f=>f.toISOString()}function nf(u){const a=tf(u);return i=>a(i).replace(ef," ")}function rf(u,a){var i;try{return((i=new Intl.DateTimeFormat("en",{timeZone:a,timeZoneName:"longOffset"}).formatToParts(u).find(f=>f.type==="timeZoneName"))==null?void 0:i.value)??""}catch{return""}}function Mu(u){const a=u.replace(/\s+/g," ").trim();if(a==="")return"";const i=Math.max(0,...(a.match(/`+/g)??[]).map(p=>p.length)),c="`".repeat(i+1),f=a.startsWith("`")||a.endsWith("`")?" ":"";return`${c}${f}${a}${f}${c}`}const lf={"(":"%28",")":"%29","<":"%3C",">":"%3E","\\":"%5C"};function of(u,a){const i=jn(u.title||u.url).replace(/\s+/g," ").trim().replace(/[\\[\]<]/g,"\\$&"),c=Qr(jn(u.url));if(!c)return`${a+1}. ${i}`;const f=c.replace(/[()<>\\]/g,p=>lf[p]).replace(/\s/g,"%20");return`${a+1}. [${i}](${f})`}function uf(u){const a=Mu(jn(u.name)),i=Vr(Number(u.size));return`- ${a} (${jn(u.mediaType)}, ${i})`}function jn(u){return typeof u=="string"?u:String(u??"")}function br(u){return Array.isArray(u)?u.filter(a=>a!==null&&typeof a=="object"):[]}function sf(u,a){const{labels:i}=a,c=nf(a),f=a.now??new Date,p=rf(f,a.timeZone),v=c(f)+(p?` (${p})`:""),k=[`# ${i.title}`,Kr(i.exported,{date:v})];for(const S of u){if(S===null||typeof S!="object")continue;const N=S.role==="user"?i.user:i.assistant,j=S.createdAt?new Date(S.createdAt):null,O=j&&!Number.isNaN(j.getTime())?` · ${c(j)}`:"";k.push(`## ${N}${O}`);const V=qd(jn(S.content));V&&k.push(V);const I=br(S.attachments);I.length&&k.push(i.attachments,I.map(uf).join(` -`));const D=br(S.toolUses);D.length&&k.push(D.map(F=>`${i.toolUsed} ${Mu(jn(F.name))}`).join(` -`));const P=br(S.sources);P.length&&k.push(i.sources,P.map(of).join(` -`))}return k.join(` +`),i=[];let c=null;for(let d=0;d0&&i[i.length-1].trim()==="";)i.pop();i.length>0&&(i[i.length-1]=Pu(i[i.length-1]))}return i.join(` +`)}const wf=/[\u00a0\u202f]/g;function xf(u){if(u.formatDate)return u.formatDate;const s=d=>new Intl.DateTimeFormat(d,{dateStyle:"medium",timeStyle:"short",timeZone:u.timeZone});let i=null;try{i=s(u.locale)}catch{try{i=s(void 0)}catch{i=null}}const c=i;return c?d=>c.format(d):d=>d.toISOString()}function Sf(u){const s=xf(u);return i=>s(i).replace(wf," ")}function kf(u,s){var i;try{return((i=new Intl.DateTimeFormat("en",{timeZone:s,timeZoneName:"longOffset"}).formatToParts(u).find(d=>d.type==="timeZoneName"))==null?void 0:i.value)??""}catch{return""}}function Du(u){const s=u.replace(/\s+/g," ").trim();if(s==="")return"";const i=Math.max(0,...(s.match(/`+/g)??[]).map(h=>h.length)),c="`".repeat(i+1),d=s.startsWith("`")||s.endsWith("`")?" ":"";return`${c}${d}${s}${d}${c}`}const Ef={"(":"%28",")":"%29","<":"%3C",">":"%3E","\\":"%5C"};function Cf(u,s){const i=_n(u.title||u.url).replace(/\s+/g," ").trim().replace(/[\\[\]<]/g,"\\$&"),c=tr(_n(u.url));if(!c)return`${s+1}. ${i}`;const d=c.replace(/[()<>\\]/g,h=>Ef[h]).replace(/\s/g,"%20");return`${s+1}. [${i}](${d})`}function Rf(u){const s=Du(_n(u.name)),i=Wr(Number(u.size));return`- ${s} (${_n(u.mediaType)}, ${i})`}function _n(u){return typeof u=="string"?u:String(u??"")}function Kr(u){return Array.isArray(u)?u.filter(s=>s!==null&&typeof s=="object"):[]}function Tf(u,s){const{labels:i}=s,c=Sf(s),d=s.now??new Date,h=kf(d,s.timeZone),m=c(d)+(h?` (${h})`:""),w=[`# ${i.title}`,jn(i.exported,{date:m})];for(const x of u){if(x===null||typeof x!="object")continue;const R=x.role==="user"?i.user:i.assistant,j=x.createdAt?new Date(x.createdAt):null,F=j&&!Number.isNaN(j.getTime())?` · ${c(j)}`:"";w.push(`## ${R}${F}`);const U=yf(_n(x.content));U&&w.push(U);const O=Kr(x.attachments);O.length&&w.push(i.attachments,O.map(Rf).join(` +`));const L=Kr(x.toolUses);L.length&&w.push(L.map(B=>`${i.toolUsed} ${Du(_n(B.name))}`).join(` +`));const N=Kr(x.sources);N.length&&w.push(i.sources,N.map(Cf).join(` +`))}return w.join(` `)+` -`}function af(u){const a=u.filter(i=>i!==null&&typeof i=="object").map(i=>i.attachments===void 0?i:{...i,attachments:br(i.attachments)});return JSON.stringify(hu(a),null,2)+` -`}function Lu(u,a={}){const i=a.now??new Date;let c;try{const f=new Intl.DateTimeFormat("en",{timeZone:a.timeZone,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(i),p=v=>{var k;return((k=f.find(S=>S.type===v))==null?void 0:k.value)??""};c=`${p("year")}-${p("month")}-${p("day")}`}catch{c=i.toISOString().slice(0,10)}return`chat-transcript-${c}.${u}`}function cf(u){const a=document.activeElement;let i=null;try{return i=document.createElement("textarea"),i.value=u,i.setAttribute("readonly",""),i.setAttribute("aria-hidden","true"),i.tabIndex=-1,i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.opacity="0",document.body.appendChild(i),i.focus({preventScroll:!0}),i.select(),document.execCommand("copy")}catch{return!1}finally{try{i==null||i.remove()}catch{}try{a==null||a.focus()}catch{}}}async function df(u){var a;try{if((a=navigator.clipboard)!=null&&a.writeText)return await navigator.clipboard.writeText(u),!0}catch{}try{return cf(u)}catch{return!1}}const ff=4e4;function Pu(u,a,i){const c=URL.createObjectURL(new Blob([a],{type:i})),f=document.createElement("a");f.href=c,f.download=u,f.style.display="none",document.body.appendChild(f),f.click(),f.remove(),setTimeout(()=>URL.revokeObjectURL(c),ff)}const pf=4e3;function hf({enabled:u,messages:a,busy:i,locale:c,translations:f}){const p=f??ku,[v,k]=R.useState(null),S=R.useRef(null),N=R.useRef(!0);R.useEffect(()=>(N.current=!0,()=>{N.current=!1,S.current&&clearTimeout(S.current)}),[]);const j=R.useCallback(()=>{S.current&&clearTimeout(S.current),S.current=null,k(null)},[]),O=R.useCallback(I=>{N.current&&(S.current&&clearTimeout(S.current),k(I),S.current=setTimeout(()=>{S.current=null,k(null)},pf))},[]);return{items:R.useMemo(()=>{if(!u)return[];const I=i||a.length===0,D=()=>sf(a,{locale:c,labels:{title:p.transcriptTitle,exported:p.transcriptExported,user:p.transcriptUser,assistant:p.transcriptAssistant,attachments:p.transcriptAttachments,sources:p.transcriptSources,toolUsed:p.toolUsed}});return[{id:"copy-markdown",label:p.copyAsMarkdown,disabled:I,onSelect:()=>{df(D()).then(P=>O(P?p.copiedToClipboard:p.copyFailed))}},{id:"download-markdown",label:p.downloadAsMarkdown,disabled:I,onSelect:()=>Pu(Lu("md"),D(),"text/markdown;charset=utf-8")},{id:"download-json",label:p.downloadAsJson,disabled:I,onSelect:()=>Pu(Lu("json"),af(a),"application/json")}]},[u,i,a,c,p,O]),status:v,clearStatus:j}}const mf=/\*\*([^*]+)\*\*/g,gf=/\*([^*]+)\*/g,vf=/https?:\/\/[^\s)]+/g;function Au(u){return u.replace(mf,"$1").replace(gf,"$1").replace(vf,a=>{var f;const i=((f=a.match(/[.,;:!?'"]+$/))==null?void 0:f[0])??"",c=i?a.slice(0,-i.length):a;try{return new URL(c).hostname+i}catch{return a}})}const yf={"bottom-right":"bottom-24 right-3 sm:right-6","bottom-left":"bottom-24 left-3 sm:left-6","top-right":"top-24 right-3 sm:right-6","top-left":"top-24 left-3 sm:left-6"};function wf({messages:u,isLoading:a,isStreaming:i=!1,streamingMessageId:c=null,error:f,canRetry:p=!1,onSend:v,onStop:k,onRetry:S,onClose:N,title:j="Chat",subtitle:O="Ask me anything",welcomeMessage:V="Hi! How can I help you today?",placeholder:I,position:D="bottom-right",translations:P,isMobile:F=!1,attachments:$=null,voice:J=null,conversationExport:B=!1,locale:Q="en-US"}){const ue=R.useId(),de=R.useRef(null),ae=R.useRef(null),[Z,xe]=R.useState(null);Kd(de,!0);const pe=bd((J==null?void 0:J.lang)??"en-US"),Se=!!(J!=null&&J.output)&&pe.isSupported,Ce={play:(P==null?void 0:P.readAloud)??"Read aloud",pause:(P==null?void 0:P.pauseReading)??"Pause reading",resume:(P==null?void 0:P.resumeReading)??"Resume reading",stop:(P==null?void 0:P.stopReading)??"Stop reading"},ve=hf({enabled:B,messages:u,busy:a,locale:Q,translations:P}),{offsetY:Re}=Wd(ae,N,F),ye=Re!==0,_e=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)").matches:!1;R.useEffect(()=>{const C=ae.current;C&&(C.scrollTop=C.scrollHeight)},[u,a]),R.useEffect(()=>{const C=m=>{m.key==="Escape"&&!m.isComposing&&!m.defaultPrevented&&N()};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[N]);const ge=(P==null?void 0:P.closeChat)??"Close chat",z=(P==null?void 0:P.chatMessages)??"Chat messages",X=[...u].reverse().find(C=>C.role==="assistant");return y.jsxs("div",{ref:de,role:"dialog","aria-modal":F?"true":void 0,"aria-labelledby":ue,className:F?"claudius-bottom-sheet fixed inset-x-0 bottom-0 z-50 flex h-[90vh] w-full flex-col overflow-hidden rounded-t-claudius-lg bg-claudius-surface shadow-claudius-elevated font-body":`fixed ${yf[D]} z-50 flex h-[min(500px,calc(100vh-7rem))] w-[calc(100vw-1.5rem)] max-w-[380px] sm:max-w-[400px] md:max-w-[440px] flex-col overflow-hidden rounded-claudius-lg bg-claudius-surface shadow-claudius-elevated font-body`,style:F&&!_e?{transform:`translateY(${Math.max(0,Re)}px)`}:void 0,"data-dragging":ye||void 0,children:[F&&y.jsx("div",{className:"flex justify-center py-2","aria-hidden":"true",children:y.jsx("div",{className:"h-1 w-8 rounded-claudius-full bg-claudius-border"})}),y.jsx(Bd,{title:j,subtitle:O,titleId:ue,closeLabel:ge,onClose:N,actions:B?y.jsx(Vd,{label:(P==null?void 0:P.moreOptions)??"More options",items:ve.items,onOpen:ve.clearStatus}):void 0}),y.jsxs("div",{className:"relative flex-1 overflow-hidden",children:[Z&&y.jsx(Ud,{sources:Z.sources,onClose:()=>xe(null)}),B&&y.jsx("div",{role:"status",className:"pointer-events-none absolute inset-x-0 top-2 z-10 flex justify-center px-4",children:ve.status&&y.jsx("span",{className:"rounded-claudius-full bg-claudius-text px-3 py-1 text-xs text-claudius-surface shadow-claudius-elevated",children:ve.status})}),y.jsxs("div",{ref:ae,role:"log","aria-label":z,className:"h-full space-y-3 overflow-y-auto px-4 py-4",children:[u.length===0&&!f&&y.jsx("div",{className:"mr-auto flex max-w-[85%]",children:y.jsx("div",{className:"rounded-claudius-bubble rounded-bl-claudius-tail bg-claudius-assistant-bubble px-4 py-2.5 text-sm leading-relaxed text-claudius-assistant-bubble-text",children:V})}),u.map(C=>y.jsx(kd,{role:C.role,content:C.content,isStreaming:C.id===c,sources:C.sources,attachments:C.attachments,toolUses:C.toolUses,toolUsedLabel:P==null?void 0:P.toolUsed,toolDetailsLabel:P==null?void 0:P.toolDetails,isSourceActive:(Z==null?void 0:Z.messageId)===C.id,onSourceClick:()=>{(Z==null?void 0:Z.messageId)===C.id?xe(null):C.sources&&C.sources.length>0&&xe({messageId:C.id,sources:C.sources})},speech:Se&&C.role==="assistant"&&C.id!==c&&C.content.trim()!==""?{state:pe.activeId!==C.id?"idle":pe.isPaused?"paused":"speaking",labels:Ce,onPlay:()=>pe.speak(C.id,Au(C.content)),onPause:pe.pause,onResume:pe.resume,onStop:pe.cancel}:void 0},C.id)),a&&!(c!==null&&u.some(C=>C.id===c&&C.content.length>0))&&y.jsx($d,{label:(P==null?void 0:P.typingIndicator)??"Assistant is typing"}),f&&y.jsx(Hd,{message:f,retryLabel:(P==null?void 0:P.errorRetry)??"Retry",onRetry:p&&S&&!a?S:void 0})]})]}),y.jsx("div",{"data-claudius-live":"assistant","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:X&&X.id!==c?Au(X.content):""}),y.jsx(zd,{onSend:v,isLoading:a,isStreaming:i,onStop:k,placeholder:I,translations:P,attachments:$,voice:J,onVoiceStart:pe.cancel,isReadingAloud:pe.activeId!==null})]})}function xf({message:u,position:a,onOpen:i,onDismiss:c,dismissLabel:f}){const p=a.startsWith("bottom"),v=a.endsWith("right"),k=["claudius-greeting-bubble","fixed z-40 max-w-xs",p?"bottom-20":"top-20",v?"right-4":"left-4"].join(" ");return y.jsxs("div",{className:k,role:"status","aria-live":"polite",children:[y.jsx("button",{type:"button",onClick:i,className:"block w-full rounded-claudius-lg bg-claudius-surface p-4 pr-8 text-left text-sm font-body text-claudius-text shadow-claudius-floating ring-1 ring-claudius-border transition hover:shadow-claudius-floating-hover focus:outline-none focus:ring-2 focus:ring-claudius-accent",children:u}),y.jsx("button",{type:"button",onClick:S=>{S.stopPropagation(),c()},"aria-label":f,className:"absolute right-1 top-1 flex h-6 w-6 items-center justify-center rounded-claudius-full text-claudius-text-muted hover:bg-claudius-surface-muted focus:outline-none focus:ring-2 focus:ring-claudius-accent",children:y.jsx("span",{"aria-hidden":"true",children:"×"})})]})}const Du={en:Su,es:{title:"Chat",subtitle:"Pregúntame lo que quieras",welcomeMessage:"¡Hola! ¿En qué puedo ayudarte hoy?",closeChat:"Cerrar chat",chatMessages:"Mensajes del chat",typingIndicator:"El asistente está escribiendo",placeholder:"Escribe tu mensaje...",sendMessage:"Enviar mensaje",stopGenerating:"Detener la respuesta",toolUsed:"Herramienta usada:",toolDetails:"Detalles de la herramienta",typeYourMessage:"Escribe tu mensaje",openChat:"Abrir chat",dismissGreeting:"Descartar saludo",attachFile:"Adjuntar un archivo",removeAttachment:"Quitar adjunto",attachmentsLabel:"Adjuntos",dropFilesHint:"Suelta los archivos para adjuntarlos",attachmentTooLarge:"{name} es demasiado grande. El tamaño máximo es {max}.",attachmentTypeNotAllowed:"{name} no es un tipo de archivo compatible.",attachmentTooMany:"Puedes adjuntar hasta {max} archivos por mensaje.",voiceInput:"Entrada de voz",voiceInputHold:"Mantén pulsado para hablar",voiceListening:"Escuchando...",voicePermissionDenied:"El acceso al micrófono está bloqueado. Permítelo en la configuración de tu navegador para usar la entrada de voz.",voiceNoSpeech:"No se detectó ninguna voz. Inténtalo de nuevo.",voiceNoMicrophone:"No se encontró ningún micrófono.",voiceUnavailable:"La entrada de voz no está disponible en este momento.",readAloud:"Leer en voz alta",pauseReading:"Pausar la lectura",resumeReading:"Reanudar la lectura",stopReading:"Detener la lectura",moreOptions:"Más opciones",copyAsMarkdown:"Copiar como Markdown",downloadAsMarkdown:"Descargar como Markdown",downloadAsJson:"Descargar como JSON",copiedToClipboard:"Copiado al portapapeles",copyFailed:"No se pudo copiar. Prueba a descargarlo.",transcriptTitle:"Transcripción del chat",transcriptExported:"Exportado el {date}",transcriptUser:"Usuario",transcriptAssistant:"Asistente",transcriptAttachments:"Adjuntos:",transcriptSources:"Fuentes:",errorGeneric:"Algo salió mal. Inténtalo de nuevo.",errorConnection:"No se pudo conectar. Inténtalo de nuevo.",errorTimeout:"La solicitud tardó demasiado. Inténtalo de nuevo.",errorRateLimitMinute:"Demasiadas solicitudes. Espera un minuto.",errorRateLimitHour:"Has alcanzado el límite por hora. Inténtalo más tarde.",errorAttachmentRejected:"Se rechazó un adjunto. Quítalo e inténtalo de nuevo.",errorAttachmentQuota:"Límite de subida alcanzado. Inténtalo más tarde.",errorRetry:"Reintentar"},fr:{title:"Chat",subtitle:"Posez-moi vos questions",welcomeMessage:"Bonjour ! Comment puis-je vous aider aujourd'hui ?",closeChat:"Fermer le chat",chatMessages:"Messages du chat",typingIndicator:"L'assistant écrit",placeholder:"Saisissez votre message...",sendMessage:"Envoyer le message",stopGenerating:"Arrêter la génération",toolUsed:"Outil utilisé :",toolDetails:"Détails de l'outil",typeYourMessage:"Saisissez votre message",openChat:"Ouvrir le chat",dismissGreeting:"Ignorer le message d'accueil",attachFile:"Joindre un fichier",removeAttachment:"Retirer la pièce jointe",attachmentsLabel:"Pièces jointes",dropFilesHint:"Déposez les fichiers pour les joindre",attachmentTooLarge:"{name} est trop volumineux. La taille maximale est de {max}.",attachmentTypeNotAllowed:"{name} n'est pas un type de fichier pris en charge.",attachmentTooMany:"Vous pouvez joindre jusqu'à {max} fichiers par message.",voiceInput:"Saisie vocale",voiceInputHold:"Maintenez pour parler",voiceListening:"Écoute en cours...",voicePermissionDenied:"L'accès au microphone est bloqué. Autorisez-le dans les paramètres de votre navigateur pour utiliser la saisie vocale.",voiceNoSpeech:"Aucune voix n'a été détectée. Veuillez réessayer.",voiceNoMicrophone:"Aucun microphone n'a été trouvé.",voiceUnavailable:"La saisie vocale n'est pas disponible pour le moment.",readAloud:"Lire à voix haute",pauseReading:"Mettre la lecture en pause",resumeReading:"Reprendre la lecture",stopReading:"Arrêter la lecture",moreOptions:"Plus d'options",copyAsMarkdown:"Copier en Markdown",downloadAsMarkdown:"Télécharger en Markdown",downloadAsJson:"Télécharger en JSON",copiedToClipboard:"Copié dans le presse-papiers",copyFailed:"Impossible de copier. Essayez plutôt de télécharger.",transcriptTitle:"Transcription du chat",transcriptExported:"Exporté le {date}",transcriptUser:"Utilisateur",transcriptAssistant:"Assistant",transcriptAttachments:"Pièces jointes :",transcriptSources:"Sources :",errorGeneric:"Une erreur s'est produite. Veuillez réessayer.",errorConnection:"Échec de la connexion. Veuillez réessayer.",errorTimeout:"La requête a expiré. Veuillez réessayer.",errorRateLimitMinute:"Trop de requêtes. Veuillez patienter une minute.",errorRateLimitHour:"Limite horaire atteinte. Veuillez réessayer plus tard.",errorAttachmentRejected:"Une pièce jointe a été refusée. Retirez-la et réessayez.",errorAttachmentQuota:"Limite d'envoi atteinte. Veuillez réessayer plus tard.",errorRetry:"Réessayer"},de:{title:"Chat",subtitle:"Fragen Sie mich alles",welcomeMessage:"Hallo! Wie kann ich Ihnen heute helfen?",closeChat:"Chat schließen",chatMessages:"Chat-Nachrichten",typingIndicator:"Der Assistent schreibt",placeholder:"Geben Sie Ihre Nachricht ein...",sendMessage:"Nachricht senden",stopGenerating:"Generierung stoppen",toolUsed:"Verwendetes Tool:",toolDetails:"Tool-Details",typeYourMessage:"Geben Sie Ihre Nachricht ein",openChat:"Chat öffnen",dismissGreeting:"Begrüßung schließen",attachFile:"Datei anhängen",removeAttachment:"Anhang entfernen",attachmentsLabel:"Anhänge",dropFilesHint:"Dateien hier ablegen, um sie anzuhängen",attachmentTooLarge:"{name} ist zu groß. Die maximale Größe beträgt {max}.",attachmentTypeNotAllowed:"{name} ist kein unterstützter Dateityp.",attachmentTooMany:"Sie können bis zu {max} Dateien pro Nachricht anhängen.",voiceInput:"Spracheingabe",voiceInputHold:"Zum Sprechen gedrückt halten",voiceListening:"Ich höre zu...",voicePermissionDenied:"Der Zugriff auf das Mikrofon ist blockiert. Erlauben Sie ihn in den Einstellungen Ihres Browsers, um die Spracheingabe zu nutzen.",voiceNoSpeech:"Es wurde keine Sprache erkannt. Bitte versuchen Sie es erneut.",voiceNoMicrophone:"Es wurde kein Mikrofon gefunden.",voiceUnavailable:"Die Spracheingabe ist momentan nicht verfügbar.",readAloud:"Vorlesen",pauseReading:"Vorlesen pausieren",resumeReading:"Vorlesen fortsetzen",stopReading:"Vorlesen beenden",moreOptions:"Weitere Optionen",copyAsMarkdown:"Als Markdown kopieren",downloadAsMarkdown:"Als Markdown herunterladen",downloadAsJson:"Als JSON herunterladen",copiedToClipboard:"In die Zwischenablage kopiert",copyFailed:"Kopieren nicht möglich. Bitte stattdessen herunterladen.",transcriptTitle:"Chat-Protokoll",transcriptExported:"Exportiert am {date}",transcriptUser:"Nutzer",transcriptAssistant:"Assistent",transcriptAttachments:"Anhänge:",transcriptSources:"Quellen:",errorGeneric:"Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut.",errorConnection:"Verbindung fehlgeschlagen. Bitte versuchen Sie es erneut.",errorTimeout:"Zeitüberschreitung der Anfrage. Bitte versuchen Sie es erneut.",errorRateLimitMinute:"Zu viele Anfragen. Bitte warten Sie eine Minute.",errorRateLimitHour:"Stündliches Limit erreicht. Bitte versuchen Sie es später erneut.",errorAttachmentRejected:"Ein Anhang wurde abgelehnt. Bitte entfernen Sie ihn und versuchen Sie es erneut.",errorAttachmentQuota:"Upload-Limit erreicht. Bitte versuchen Sie es später erneut.",errorRetry:"Erneut versuchen"}};function zu(u){if(!u)return;const a=u.toLowerCase().split("-")[0];return Object.prototype.hasOwnProperty.call(Du,a)?a:void 0}function Ou(){const u=typeof document<"u"?zu(document.documentElement.lang):void 0;if(u)return u;const a=typeof navigator<"u"?zu(navigator.language):void 0;return a||"en"}function Sf(u={}){const{locale:a,translations:i}=u,c=Du[a??Ou()];return i?{...c,...i}:{...c}}const Iu=["accent","accentText","accentSoft","accentTextMuted","surface","surfaceMuted","text","textMuted","border","userBubble","userBubbleText","assistantBubble","assistantBubbleText","field","error","errorSurface","errorText","link","scrim"],kf=["sm","md","lg","full","tail"],Ef=["elevated","floating","floatingHover"],Cf=["heading","body"],Fu={default:{name:"default"},minimal:{name:"minimal",colors:{accent:"#171717",accentText:"#ffffff",surface:"#ffffff",surfaceMuted:"#f5f5f5",text:"#171717",textMuted:"#737373",border:"#e5e5e5",link:"#171717"},colorsDark:{accent:"#fafafa",accentText:"#171717",surface:"#0a0a0a",surfaceMuted:"#1c1c1c",text:"#fafafa",textMuted:"#a3a3a3",border:"#2e2e2e",field:"#1c1c1c",link:"#fafafa"},radii:{sm:"4px",md:"6px",lg:"10px"},shadows:{elevated:"0 4px 16px rgb(0 0 0 / 0.12)",floating:"0 2px 8px rgb(0 0 0 / 0.12)",floatingHover:"0 4px 12px rgb(0 0 0 / 0.16)"}},playful:{name:"playful",colors:{accent:"#8b5cf6",surfaceMuted:"#f5f3ff",assistantBubbleText:"#4c1d95",link:"#7c3aed"},colorsDark:{accent:"#a78bfa",surfaceMuted:"#2e1065",assistantBubbleText:"#ede9fe",link:"#c4b5fd"},radii:{sm:"12px",md:"16px",lg:"24px",tail:"8px"},shadows:{elevated:"0 24px 48px -12px rgb(139 92 246 / 0.35)",floating:"0 10px 20px -5px rgb(139 92 246 / 0.4)",floatingHover:"0 16px 28px -6px rgb(139 92 246 / 0.5)"},fonts:{heading:"ui-rounded, 'Hiragino Maru Gothic ProN', system-ui",body:"ui-rounded, 'Hiragino Maru Gothic ProN', system-ui"}},corporate:{name:"corporate",colors:{accent:"#1e3a5f",surfaceMuted:"#f3f4f6",text:"#1f2937",textMuted:"#6b7280",border:"#d1d5db",link:"#1d4ed8"},colorsDark:{accent:"#2c5282",link:"#93c5fd"},radii:{sm:"4px",md:"6px",lg:"8px",tail:"2px"},shadows:{elevated:"0 8px 24px rgb(15 23 42 / 0.16)",floating:"0 4px 12px rgb(15 23 42 / 0.18)",floatingHover:"0 6px 16px rgb(15 23 42 / 0.24)"},fonts:{heading:"'Segoe UI', 'Helvetica Neue', Arial, system-ui",body:"'Segoe UI', 'Helvetica Neue', Arial, system-ui"}}};function Rf(u){return Object.prototype.hasOwnProperty.call(Fu,u)}const Tf=new Set(["light","dark","auto"]);function Nf(u){if(u===void 0)return{mode:"light"};if(typeof u=="string"){if(Tf.has(u))return{mode:u};if(Rf(u)){const a=Fu[u];return{mode:a.colorScheme??"light",theme:a}}return{mode:"light",url:u}}return{mode:u.colorScheme??"light",theme:u}}function jf(u){return u.replace(/[A-Z]/g,a=>`-${a.toLowerCase()}`)}function _f(u,a){console.warn(`[Claudius] Ignoring unknown theme token "${a}" in "${u}"`)}function nr(u,a,i,c,f,p=""){if(f)for(const[v,k]of Object.entries(f)){if(!c.includes(v)){_f(a,v);continue}typeof k=="string"&&(u[`${i}${jf(v)}${p}`]=k)}}function Mf(u){const a={};nr(a,"colors","--cl-color-",Iu,u.colors);for(const[i,c]of Object.entries({...a}))a[`${i}-dark`]=c;return nr(a,"colorsDark","--cl-color-",Iu,u.colorsDark,"-dark"),nr(a,"radii","--cl-radius-",kf,u.radii),nr(a,"shadows","--cl-shadow-",Ef,u.shadows),nr(a,"fonts","--cl-font-",Cf,u.fonts),a}function Lf(u){return typeof u=="object"&&u!==null&&!Array.isArray(u)}function Pf(u){const a=R.useMemo(()=>Nf(u),[u]),[i,c]=R.useState(null),f=a.url;R.useEffect(()=>{if(c(null),!f)return;const S=new AbortController;return fetch(f,{signal:S.signal}).then(N=>{if(!N.ok)throw new Error(`HTTP ${N.status}`);return N.json()}).then(N=>{if(!Lf(N))throw new Error("theme JSON must be an object");c(N)}).catch(N=>{S.signal.aborted||console.error(`[Claudius] Failed to load theme from ${f}:`,N)}),()=>S.abort()},[f]);const p=a.theme??i??null,v=(i==null?void 0:i.colorScheme)??a.mode,k=R.useMemo(()=>p?Mf(p):{},[p]);return{mode:v,cssVars:k}}const Uu="claudius:triggers:dismissed";function Af(){if(typeof window>"u")return!1;try{return window.sessionStorage.getItem(Uu)==="1"}catch{return!1}}function Df(){if(!(typeof window>"u"))try{window.sessionStorage.setItem(Uu,"1")}catch{}}function Bu({apiUrl:u,title:a,subtitle:i,welcomeMessage:c,placeholder:f,persistMessages:p,storageKeyPrefix:v,requestTimeoutMs:k,theme:S="light",accentColor:N,position:j="bottom-right",locale:O,translations:V,triggers:I,plugins:D,streaming:P=!0,attachments:F=!1,voice:$=!1,conversationExport:J=!1}){const[B,Q]=R.useState(!1),ue=R.useMemo(()=>Wc(F),[F]),de=R.useMemo(()=>O??Ou(),[O]),ae=R.useMemo(()=>Nd($,de),[$,de]),Z=R.useMemo(()=>Ru(de),[de]),[xe,pe]=R.useState(null),[Se,Ce]=R.useState(Af),ve=R.useRef(!1),Re=ld("(max-width: 639px)"),ye=R.useMemo(()=>Sf({locale:O,translations:V}),[O,V]),{messages:_e,isLoading:ge,isStreaming:z,streamingMessageId:X,error:C,canRetry:m,sendMessage:T,stop:re,retry:le}=rd({apiUrl:u,persistMessages:p,storageKeyPrefix:v,timeoutMs:k,translations:ye,plugins:D,streaming:P}),se=R.useRef(null),ne=R.useRef(B),{mode:ie,cssVars:K}=Pf(S),[q,ce]=R.useState(!1);R.useEffect(()=>{if(ie!=="auto")return;const Ue=window.matchMedia("(prefers-color-scheme: dark)");ce(Ue.matches);const bt=H=>ce(H.matches);return Ue.addEventListener("change",bt),()=>Ue.removeEventListener("change",bt)},[ie]),R.useEffect(()=>{var Ue;ne.current&&!B&&((Ue=se.current)==null||Ue.focus()),ne.current=B},[B]);const Ae=R.useCallback(()=>{Ce(!0),Df()},[]),Ze=R.useCallback(()=>{Q(!1),ve.current&&(ve.current=!1,Ae())},[Ae]),ft=R.useCallback(()=>{Q(Ue=>!Ue)},[]),Fe=R.useCallback(()=>{ve.current=!0,pe(null),Q(!0)},[]),Kt=R.useCallback(Ue=>{pe(Ue)},[]),_t=R.useCallback(()=>{pe(null),Fe()},[Fe]),Oe=R.useCallback(()=>{pe(null),Ae()},[Ae]);id({triggers:I,enabled:!Se&&!B,onOpen:Fe,onGreeting:Kt});const pt=ie==="dark"||ie==="auto"&&q,Mt={...K,...N?{"--cl-color-accent":N,"--cl-color-accent-dark":N}:{}},ut=Object.keys(Mt).length>0?Mt:void 0;return y.jsx("div",{className:"claudius-root",style:ut,children:y.jsxs("div",{"data-claudius-dark":pt?"true":"false",children:[B&&Re&&y.jsx("div",{className:"claudius-scrim fixed inset-0 z-40 bg-claudius-scrim",onClick:Ze,"aria-hidden":"true"}),B&&y.jsx(wf,{messages:_e,isLoading:ge,isStreaming:z,streamingMessageId:X,error:C,canRetry:m,onSend:T,onStop:re,onRetry:le,onClose:Ze,title:a??ye.title,subtitle:i??ye.subtitle,welcomeMessage:c??ye.welcomeMessage,placeholder:f??ye.placeholder,position:j,translations:ye,isMobile:Re,attachments:ue,voice:ae,conversationExport:J===!0,locale:Z}),!(B&&Re)&&y.jsx(sd,{ref:se,isOpen:B,onClick:ft,position:j,translations:ye}),!B&&xe&&y.jsx(xf,{message:xe,position:j,onOpen:_t,onDismiss:Oe,dismissLabel:ye.dismissGreeting})]})})}const zf="1.17.1";typeof window<"u"&&(window.ClaudiusWidgetVersion=zf);function Hu(){const u=window.ClaudiusConfig;if(!(u!=null&&u.apiUrl)){console.error("[Claudius] Missing ClaudiusConfig.apiUrl");return}const a=document.createElement("div");a.id="claudius-chat-widget",document.body.appendChild(a),cu.createRoot(a).render(y.jsx(Bu,{apiUrl:u.apiUrl,title:u.title,subtitle:u.subtitle,welcomeMessage:u.welcomeMessage,placeholder:u.placeholder,persistMessages:u.persistMessages,storageKeyPrefix:u.storageKeyPrefix,requestTimeoutMs:u.requestTimeoutMs,theme:u.theme,accentColor:u.accentColor,position:u.position,locale:u.locale,translations:u.translations,triggers:u.triggers,attachments:u.attachments,voice:u.voice,conversationExport:u.conversationExport}))}class $u extends HTMLElement{constructor(){super(...arguments);hn(this,"root",null);hn(this,"container",null)}static get observedAttributes(){return["api-url","title","subtitle","welcome-message","placeholder","persist-messages","storage-key-prefix","request-timeout-ms","theme","accent-color","position","attachments","conversation-export","voice","voice-mode","voice-auto-submit","voice-input","voice-output","voice-lang"]}connectedCallback(){this.container=document.createElement("div"),this.appendChild(this.container),this.root=cu.createRoot(this.container),this.render()}disconnectedCallback(){this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.remove(),this.container=null)}attributeChangedCallback(){this.render()}render(){if(!this.root)return;const i=this.getAttribute("api-url");if(!i){console.error("[Claudius] Missing api-url attribute on ");return}const c=this.getAttribute("persist-messages"),f=c===null?void 0:c!=="false",p=this.getAttribute("request-timeout-ms"),v=p===null?void 0:Number(p),k=this.getAttribute("attachments"),S=k===null?void 0:k!=="false",N=this.getAttribute("conversation-export"),j=N==null?void 0:N.trim().toLowerCase(),O=N===null?void 0:j===""||j==="true";this.root.render(y.jsx(Bu,{apiUrl:i,title:this.getAttribute("title")??void 0,subtitle:this.getAttribute("subtitle")??void 0,welcomeMessage:this.getAttribute("welcome-message")??void 0,placeholder:this.getAttribute("placeholder")??void 0,persistMessages:f,storageKeyPrefix:this.getAttribute("storage-key-prefix")??void 0,requestTimeoutMs:v!==void 0&&Number.isFinite(v)?v:void 0,theme:this.getAttribute("theme")??void 0,accentColor:this.getAttribute("accent-color")??void 0,position:this.getAttribute("position")??void 0,attachments:S,conversationExport:O,voice:jd(V=>this.getAttribute(V))}))}}return typeof customElements<"u"&&!customElements.get("claudius-chat")&&customElements.define("claudius-chat",$u),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Hu):Hu(),Ot.ClaudiusChat=$u,Object.defineProperty(Ot,Symbol.toStringTag,{value:"Module"}),Ot})({}); +`}function Nf(u){const s=u.filter(i=>i!==null&&typeof i=="object").map(i=>i.attachments===void 0?i:{...i,attachments:Kr(i.attachments)});return JSON.stringify(mu(s),null,2)+` +`}function zu(u,s={}){const i=s.now??new Date;let c;try{const d=new Intl.DateTimeFormat("en",{timeZone:s.timeZone,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(i),h=m=>{var w;return((w=d.find(x=>x.type===m))==null?void 0:w.value)??""};c=`${h("year")}-${h("month")}-${h("day")}`}catch{c=i.toISOString().slice(0,10)}return`chat-transcript-${c}.${u}`}function jf(u){const s=document.activeElement;let i=null;try{return i=document.createElement("textarea"),i.value=u,i.setAttribute("readonly",""),i.setAttribute("aria-hidden","true"),i.tabIndex=-1,i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.opacity="0",document.body.appendChild(i),i.focus({preventScroll:!0}),i.select(),document.execCommand("copy")}catch{return!1}finally{try{i==null||i.remove()}catch{}try{s==null||s.focus()}catch{}}}async function _f(u){var s;try{if((s=navigator.clipboard)!=null&&s.writeText)return await navigator.clipboard.writeText(u),!0}catch{}try{return jf(u)}catch{return!1}}const Mf=4e4;function Iu(u,s,i){const c=URL.createObjectURL(new Blob([s],{type:i})),d=document.createElement("a");d.href=c,d.download=u,d.style.display="none",document.body.appendChild(d),d.click(),d.remove(),setTimeout(()=>URL.revokeObjectURL(c),Mf)}const Lf=4e3;function Af({enabled:u,messages:s,busy:i,locale:c,translations:d}){const h=d??Tu,[m,w]=E.useState(null),x=E.useRef(null),R=E.useRef(!0);E.useEffect(()=>(R.current=!0,()=>{R.current=!1,x.current&&clearTimeout(x.current)}),[]);const j=E.useCallback(()=>{x.current&&clearTimeout(x.current),x.current=null,w(null)},[]),F=E.useCallback(O=>{R.current&&(x.current&&clearTimeout(x.current),w(O),x.current=setTimeout(()=>{x.current=null,w(null)},Lf))},[]);return{items:E.useMemo(()=>{if(!u)return[];const O=i||s.length===0,L=()=>Tf(s,{locale:c,labels:{title:h.transcriptTitle,exported:h.transcriptExported,user:h.transcriptUser,assistant:h.transcriptAssistant,attachments:h.transcriptAttachments,sources:h.transcriptSources,toolUsed:h.toolUsed}});return[{id:"copy-markdown",label:h.copyAsMarkdown,disabled:O,onSelect:()=>{_f(L()).then(N=>F(N?h.copiedToClipboard:h.copyFailed))}},{id:"download-markdown",label:h.downloadAsMarkdown,disabled:O,onSelect:()=>Iu(zu("md"),L(),"text/markdown;charset=utf-8")},{id:"download-json",label:h.downloadAsJson,disabled:O,onSelect:()=>Iu(zu("json"),Nf(s),"application/json")}]},[u,i,s,c,h,F]),status:m,clearStatus:j}}const Pf=/\*\*([^*]+)\*\*/g,Df=/\*([^*]+)\*/g,zf=/https?:\/\/[^\s)]+/g;function If(u){return u.replace(Pf,"$1").replace(Df,"$1").replace(zf,s=>{var d;const i=((d=s.match(/[.,;:!?'"]+$/))==null?void 0:d[0])??"",c=i?s.slice(0,-i.length):s;try{return new URL(c).hostname+i}catch{return s}})}const Of={"bottom-right":"bottom-24 right-3 sm:right-6","bottom-left":"bottom-24 left-3 sm:left-6","top-right":"top-24 right-3 sm:right-6","top-left":"top-24 left-3 sm:left-6"};function Ff({messages:u,isLoading:s,isStreaming:i=!1,streamingMessageId:c=null,error:d,canRetry:h=!1,onSend:m,onStop:w,onRetry:x,onClose:R,title:j="Chat",subtitle:F="Ask me anything",welcomeMessage:U="Hi! How can I help you today?",placeholder:O,position:L="bottom-right",translations:N,isMobile:B=!1,attachments:V=null,voice:K=null,conversationExport:b=!1,locale:$="en-US",citations:se=null}){const G=E.useId(),ee=E.useRef(null),ae=E.useRef(null),[te,De]=E.useState(null);df(ee,!0);const me=ff((K==null?void 0:K.lang)??"en-US"),ye=!!(K!=null&&K.output)&&me.isSupported,Ee={play:(N==null?void 0:N.readAloud)??"Read aloud",pause:(N==null?void 0:N.pauseReading)??"Pause reading",resume:(N==null?void 0:N.resumeReading)??"Resume reading",stop:(N==null?void 0:N.stopReading)??"Stop reading"},Re=Af({enabled:b,messages:u,busy:s,locale:$,translations:N}),Ne=(N==null?void 0:N.opensInNewTab)??"(opens in a new tab)",we=E.useMemo(()=>se?{...se,labels:{sources:(N==null?void 0:N.sources)??"Sources",showAllSources:(N==null?void 0:N.showAllSources)??"Show all ({count})",showFewerSources:(N==null?void 0:N.showFewerSources)??"Show fewer",citation:(N==null?void 0:N.citation)??"Source {n}: {title}",opensInNewTab:Ne}}:void 0,[se,N,Ne]),ce=D=>{var oe;return If(we&&((oe=D.sources)!=null&&oe.length)?yd(D.content,D.sources.length):D.content)},{offsetY:z}=af(ae,R,B),q=z!==0,H=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)").matches:!1;E.useEffect(()=>{const D=ae.current;D&&(D.scrollTop=D.scrollHeight)},[u,s]),E.useEffect(()=>{const D=oe=>{oe.key==="Escape"&&!oe.isComposing&&!oe.defaultPrevented&&R()};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[R]);const g=(N==null?void 0:N.closeChat)??"Close chat",T=(N==null?void 0:N.chatMessages)??"Chat messages",Y=[...u].reverse().find(D=>D.role==="assistant");return p.jsxs("div",{ref:ee,role:"dialog","aria-modal":B?"true":void 0,"aria-labelledby":G,className:B?"claudius-bottom-sheet fixed inset-x-0 bottom-0 z-50 flex h-[90vh] w-full flex-col overflow-hidden rounded-t-claudius-lg bg-claudius-surface shadow-claudius-elevated font-body":`fixed ${Of[L]} z-50 flex h-[min(500px,calc(100vh-7rem))] w-[calc(100vw-1.5rem)] max-w-[380px] sm:max-w-[400px] md:max-w-[440px] flex-col overflow-hidden rounded-claudius-lg bg-claudius-surface shadow-claudius-elevated font-body`,style:B&&!H?{transform:`translateY(${Math.max(0,z)}px)`}:void 0,"data-dragging":q||void 0,children:[B&&p.jsx("div",{className:"flex justify-center py-2","aria-hidden":"true",children:p.jsx("div",{className:"h-1 w-8 rounded-claudius-full bg-claudius-border"})}),p.jsx(lf,{title:j,subtitle:F,titleId:G,closeLabel:g,onClose:R,actions:b?p.jsx(sf,{label:(N==null?void 0:N.moreOptions)??"More options",items:Re.items,onOpen:Re.clearStatus}):void 0}),p.jsxs("div",{className:"relative flex-1 overflow-hidden",children:[te&&p.jsx(rf,{sources:te.sources,onClose:()=>De(null)}),b&&p.jsx("div",{role:"status",className:"pointer-events-none absolute inset-x-0 top-2 z-10 flex justify-center px-4",children:Re.status&&p.jsx("span",{className:"rounded-claudius-full bg-claudius-text px-3 py-1 text-xs text-claudius-surface shadow-claudius-elevated",children:Re.status})}),p.jsxs("div",{ref:ae,role:"log","aria-label":T,className:"h-full space-y-3 overflow-y-auto px-4 py-4",children:[u.length===0&&!d&&p.jsx("div",{className:"mr-auto flex max-w-[85%]",children:p.jsx("div",{className:"rounded-claudius-bubble rounded-bl-claudius-tail bg-claudius-assistant-bubble px-4 py-2.5 text-sm leading-relaxed text-claudius-assistant-bubble-text",children:U})}),u.map(D=>p.jsx(Bd,{role:D.role,content:D.content,isStreaming:D.id===c,sources:D.sources,attachments:D.attachments,toolUses:D.toolUses,toolUsedLabel:N==null?void 0:N.toolUsed,toolDetailsLabel:N==null?void 0:N.toolDetails,citations:we,linkNewTabLabel:Ne,isSourceActive:we?void 0:(te==null?void 0:te.messageId)===D.id,onSourceClick:we?void 0:()=>{(te==null?void 0:te.messageId)===D.id?De(null):D.sources&&D.sources.length>0&&De({messageId:D.id,sources:D.sources})},speech:ye&&D.role==="assistant"&&D.id!==c&&D.content.trim()!==""?{state:me.activeId!==D.id?"idle":me.isPaused?"paused":"speaking",labels:Ee,onPlay:()=>me.speak(D.id,ce(D)),onPause:me.pause,onResume:me.resume,onStop:me.cancel}:void 0},D.id)),s&&!(c!==null&&u.some(D=>D.id===c&&D.content.length>0))&&p.jsx(uf,{label:(N==null?void 0:N.typingIndicator)??"Assistant is typing"}),d&&p.jsx(of,{message:d,retryLabel:(N==null?void 0:N.errorRetry)??"Retry",onRetry:h&&x&&!s?x:void 0})]})]}),p.jsx("div",{"data-claudius-live":"assistant","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:Y&&Y.id!==c?ce(Y):""}),p.jsx(qd,{onSend:m,isLoading:s,isStreaming:i,onStop:w,placeholder:O,translations:N,attachments:V,voice:K,onVoiceStart:me.cancel,isReadingAloud:me.activeId!==null})]})}function Uf({message:u,position:s,onOpen:i,onDismiss:c,dismissLabel:d}){const h=s.startsWith("bottom"),m=s.endsWith("right"),w=["claudius-greeting-bubble","fixed z-40 max-w-xs",h?"bottom-20":"top-20",m?"right-4":"left-4"].join(" ");return p.jsxs("div",{className:w,role:"status","aria-live":"polite",children:[p.jsx("button",{type:"button",onClick:i,className:"block w-full rounded-claudius-lg bg-claudius-surface p-4 pr-8 text-left text-sm font-body text-claudius-text shadow-claudius-floating ring-1 ring-claudius-border transition hover:shadow-claudius-floating-hover focus:outline-none focus:ring-2 focus:ring-claudius-accent",children:u}),p.jsx("button",{type:"button",onClick:x=>{x.stopPropagation(),c()},"aria-label":d,className:"absolute right-1 top-1 flex h-6 w-6 items-center justify-center rounded-claudius-full text-claudius-text-muted hover:bg-claudius-surface-muted focus:outline-none focus:ring-2 focus:ring-claudius-accent",children:p.jsx("span",{"aria-hidden":"true",children:"×"})})]})}const Ou={en:Ru,es:{title:"Chat",subtitle:"Pregúntame lo que quieras",welcomeMessage:"¡Hola! ¿En qué puedo ayudarte hoy?",closeChat:"Cerrar chat",chatMessages:"Mensajes del chat",typingIndicator:"El asistente está escribiendo",placeholder:"Escribe tu mensaje...",sendMessage:"Enviar mensaje",stopGenerating:"Detener la respuesta",toolUsed:"Herramienta usada:",toolDetails:"Detalles de la herramienta",typeYourMessage:"Escribe tu mensaje",openChat:"Abrir chat",dismissGreeting:"Descartar saludo",attachFile:"Adjuntar un archivo",removeAttachment:"Quitar adjunto",attachmentsLabel:"Adjuntos",dropFilesHint:"Suelta los archivos para adjuntarlos",attachmentTooLarge:"{name} es demasiado grande. El tamaño máximo es {max}.",attachmentTypeNotAllowed:"{name} no es un tipo de archivo compatible.",attachmentTooMany:"Puedes adjuntar hasta {max} archivos por mensaje.",voiceInput:"Entrada de voz",voiceInputHold:"Mantén pulsado para hablar",voiceListening:"Escuchando...",voicePermissionDenied:"El acceso al micrófono está bloqueado. Permítelo en la configuración de tu navegador para usar la entrada de voz.",voiceNoSpeech:"No se detectó ninguna voz. Inténtalo de nuevo.",voiceNoMicrophone:"No se encontró ningún micrófono.",voiceUnavailable:"La entrada de voz no está disponible en este momento.",readAloud:"Leer en voz alta",pauseReading:"Pausar la lectura",resumeReading:"Reanudar la lectura",stopReading:"Detener la lectura",moreOptions:"Más opciones",copyAsMarkdown:"Copiar como Markdown",downloadAsMarkdown:"Descargar como Markdown",downloadAsJson:"Descargar como JSON",copiedToClipboard:"Copiado al portapapeles",copyFailed:"No se pudo copiar. Prueba a descargarlo.",transcriptTitle:"Transcripción del chat",transcriptExported:"Exportado el {date}",transcriptUser:"Usuario",transcriptAssistant:"Asistente",transcriptAttachments:"Adjuntos:",transcriptSources:"Fuentes:",sources:"Fuentes",showAllSources:"Mostrar todas ({count})",showFewerSources:"Mostrar menos",citation:"Fuente {n}: {title}",opensInNewTab:"(se abre en una pestaña nueva)",errorGeneric:"Algo salió mal. Inténtalo de nuevo.",errorConnection:"No se pudo conectar. Inténtalo de nuevo.",errorTimeout:"La solicitud tardó demasiado. Inténtalo de nuevo.",errorRateLimitMinute:"Demasiadas solicitudes. Espera un minuto.",errorRateLimitHour:"Has alcanzado el límite por hora. Inténtalo más tarde.",errorAttachmentRejected:"Se rechazó un adjunto. Quítalo e inténtalo de nuevo.",errorAttachmentQuota:"Límite de subida alcanzado. Inténtalo más tarde.",errorRetry:"Reintentar"},fr:{title:"Chat",subtitle:"Posez-moi vos questions",welcomeMessage:"Bonjour ! Comment puis-je vous aider aujourd'hui ?",closeChat:"Fermer le chat",chatMessages:"Messages du chat",typingIndicator:"L'assistant écrit",placeholder:"Saisissez votre message...",sendMessage:"Envoyer le message",stopGenerating:"Arrêter la génération",toolUsed:"Outil utilisé :",toolDetails:"Détails de l'outil",typeYourMessage:"Saisissez votre message",openChat:"Ouvrir le chat",dismissGreeting:"Ignorer le message d'accueil",attachFile:"Joindre un fichier",removeAttachment:"Retirer la pièce jointe",attachmentsLabel:"Pièces jointes",dropFilesHint:"Déposez les fichiers pour les joindre",attachmentTooLarge:"{name} est trop volumineux. La taille maximale est de {max}.",attachmentTypeNotAllowed:"{name} n'est pas un type de fichier pris en charge.",attachmentTooMany:"Vous pouvez joindre jusqu'à {max} fichiers par message.",voiceInput:"Saisie vocale",voiceInputHold:"Maintenez pour parler",voiceListening:"Écoute en cours...",voicePermissionDenied:"L'accès au microphone est bloqué. Autorisez-le dans les paramètres de votre navigateur pour utiliser la saisie vocale.",voiceNoSpeech:"Aucune voix n'a été détectée. Veuillez réessayer.",voiceNoMicrophone:"Aucun microphone n'a été trouvé.",voiceUnavailable:"La saisie vocale n'est pas disponible pour le moment.",readAloud:"Lire à voix haute",pauseReading:"Mettre la lecture en pause",resumeReading:"Reprendre la lecture",stopReading:"Arrêter la lecture",moreOptions:"Plus d'options",copyAsMarkdown:"Copier en Markdown",downloadAsMarkdown:"Télécharger en Markdown",downloadAsJson:"Télécharger en JSON",copiedToClipboard:"Copié dans le presse-papiers",copyFailed:"Impossible de copier. Essayez plutôt de télécharger.",transcriptTitle:"Transcription du chat",transcriptExported:"Exporté le {date}",transcriptUser:"Utilisateur",transcriptAssistant:"Assistant",transcriptAttachments:"Pièces jointes :",transcriptSources:"Sources :",sources:"Sources",showAllSources:"Tout afficher ({count})",showFewerSources:"Afficher moins",citation:"Source {n} : {title}",opensInNewTab:"(s'ouvre dans un nouvel onglet)",errorGeneric:"Une erreur s'est produite. Veuillez réessayer.",errorConnection:"Échec de la connexion. Veuillez réessayer.",errorTimeout:"La requête a expiré. Veuillez réessayer.",errorRateLimitMinute:"Trop de requêtes. Veuillez patienter une minute.",errorRateLimitHour:"Limite horaire atteinte. Veuillez réessayer plus tard.",errorAttachmentRejected:"Une pièce jointe a été refusée. Retirez-la et réessayez.",errorAttachmentQuota:"Limite d'envoi atteinte. Veuillez réessayer plus tard.",errorRetry:"Réessayer"},de:{title:"Chat",subtitle:"Fragen Sie mich alles",welcomeMessage:"Hallo! Wie kann ich Ihnen heute helfen?",closeChat:"Chat schließen",chatMessages:"Chat-Nachrichten",typingIndicator:"Der Assistent schreibt",placeholder:"Geben Sie Ihre Nachricht ein...",sendMessage:"Nachricht senden",stopGenerating:"Generierung stoppen",toolUsed:"Verwendetes Tool:",toolDetails:"Tool-Details",typeYourMessage:"Geben Sie Ihre Nachricht ein",openChat:"Chat öffnen",dismissGreeting:"Begrüßung schließen",attachFile:"Datei anhängen",removeAttachment:"Anhang entfernen",attachmentsLabel:"Anhänge",dropFilesHint:"Dateien hier ablegen, um sie anzuhängen",attachmentTooLarge:"{name} ist zu groß. Die maximale Größe beträgt {max}.",attachmentTypeNotAllowed:"{name} ist kein unterstützter Dateityp.",attachmentTooMany:"Sie können bis zu {max} Dateien pro Nachricht anhängen.",voiceInput:"Spracheingabe",voiceInputHold:"Zum Sprechen gedrückt halten",voiceListening:"Ich höre zu...",voicePermissionDenied:"Der Zugriff auf das Mikrofon ist blockiert. Erlauben Sie ihn in den Einstellungen Ihres Browsers, um die Spracheingabe zu nutzen.",voiceNoSpeech:"Es wurde keine Sprache erkannt. Bitte versuchen Sie es erneut.",voiceNoMicrophone:"Es wurde kein Mikrofon gefunden.",voiceUnavailable:"Die Spracheingabe ist momentan nicht verfügbar.",readAloud:"Vorlesen",pauseReading:"Vorlesen pausieren",resumeReading:"Vorlesen fortsetzen",stopReading:"Vorlesen beenden",moreOptions:"Weitere Optionen",copyAsMarkdown:"Als Markdown kopieren",downloadAsMarkdown:"Als Markdown herunterladen",downloadAsJson:"Als JSON herunterladen",copiedToClipboard:"In die Zwischenablage kopiert",copyFailed:"Kopieren nicht möglich. Bitte stattdessen herunterladen.",transcriptTitle:"Chat-Protokoll",transcriptExported:"Exportiert am {date}",transcriptUser:"Nutzer",transcriptAssistant:"Assistent",transcriptAttachments:"Anhänge:",transcriptSources:"Quellen:",sources:"Quellen",showAllSources:"Alle anzeigen ({count})",showFewerSources:"Weniger anzeigen",citation:"Quelle {n}: {title}",opensInNewTab:"(öffnet in einem neuen Tab)",errorGeneric:"Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut.",errorConnection:"Verbindung fehlgeschlagen. Bitte versuchen Sie es erneut.",errorTimeout:"Zeitüberschreitung der Anfrage. Bitte versuchen Sie es erneut.",errorRateLimitMinute:"Zu viele Anfragen. Bitte warten Sie eine Minute.",errorRateLimitHour:"Stündliches Limit erreicht. Bitte versuchen Sie es später erneut.",errorAttachmentRejected:"Ein Anhang wurde abgelehnt. Bitte entfernen Sie ihn und versuchen Sie es erneut.",errorAttachmentQuota:"Upload-Limit erreicht. Bitte versuchen Sie es später erneut.",errorRetry:"Erneut versuchen"}};function Fu(u){if(!u)return;const s=u.toLowerCase().split("-")[0];return Object.prototype.hasOwnProperty.call(Ou,s)?s:void 0}function Uu(){const u=typeof document<"u"?Fu(document.documentElement.lang):void 0;if(u)return u;const s=typeof navigator<"u"?Fu(navigator.language):void 0;return s||"en"}function Bf(u={}){const{locale:s,translations:i}=u,c=Ou[s??Uu()];return i?{...c,...i}:{...c}}const Bu=["accent","accentText","accentSoft","accentTextMuted","surface","surfaceMuted","text","textMuted","border","userBubble","userBubbleText","assistantBubble","assistantBubbleText","field","error","errorSurface","errorText","link","scrim"],$f=["sm","md","lg","full","tail"],Hf=["elevated","floating","floatingHover"],Vf=["heading","body"],$u={default:{name:"default"},minimal:{name:"minimal",colors:{accent:"#171717",accentText:"#ffffff",surface:"#ffffff",surfaceMuted:"#f5f5f5",text:"#171717",textMuted:"#737373",border:"#e5e5e5",link:"#171717"},colorsDark:{accent:"#fafafa",accentText:"#171717",surface:"#0a0a0a",surfaceMuted:"#1c1c1c",text:"#fafafa",textMuted:"#a3a3a3",border:"#2e2e2e",field:"#1c1c1c",link:"#fafafa"},radii:{sm:"4px",md:"6px",lg:"10px"},shadows:{elevated:"0 4px 16px rgb(0 0 0 / 0.12)",floating:"0 2px 8px rgb(0 0 0 / 0.12)",floatingHover:"0 4px 12px rgb(0 0 0 / 0.16)"}},playful:{name:"playful",colors:{accent:"#8b5cf6",surfaceMuted:"#f5f3ff",assistantBubbleText:"#4c1d95",link:"#7c3aed"},colorsDark:{accent:"#a78bfa",surfaceMuted:"#2e1065",assistantBubbleText:"#ede9fe",link:"#c4b5fd"},radii:{sm:"12px",md:"16px",lg:"24px",tail:"8px"},shadows:{elevated:"0 24px 48px -12px rgb(139 92 246 / 0.35)",floating:"0 10px 20px -5px rgb(139 92 246 / 0.4)",floatingHover:"0 16px 28px -6px rgb(139 92 246 / 0.5)"},fonts:{heading:"ui-rounded, 'Hiragino Maru Gothic ProN', system-ui",body:"ui-rounded, 'Hiragino Maru Gothic ProN', system-ui"}},corporate:{name:"corporate",colors:{accent:"#1e3a5f",surfaceMuted:"#f3f4f6",text:"#1f2937",textMuted:"#6b7280",border:"#d1d5db",link:"#1d4ed8"},colorsDark:{accent:"#2c5282",link:"#93c5fd"},radii:{sm:"4px",md:"6px",lg:"8px",tail:"2px"},shadows:{elevated:"0 8px 24px rgb(15 23 42 / 0.16)",floating:"0 4px 12px rgb(15 23 42 / 0.18)",floatingHover:"0 6px 16px rgb(15 23 42 / 0.24)"},fonts:{heading:"'Segoe UI', 'Helvetica Neue', Arial, system-ui",body:"'Segoe UI', 'Helvetica Neue', Arial, system-ui"}}};function bf(u){return Object.prototype.hasOwnProperty.call($u,u)}const Wf=new Set(["light","dark","auto"]);function Qf(u){if(u===void 0)return{mode:"light"};if(typeof u=="string"){if(Wf.has(u))return{mode:u};if(bf(u)){const s=$u[u];return{mode:s.colorScheme??"light",theme:s}}return{mode:"light",url:u}}return{mode:u.colorScheme??"light",theme:u}}function Kf(u){return u.replace(/[A-Z]/g,s=>`-${s.toLowerCase()}`)}function Gf(u,s){console.warn(`[Claudius] Ignoring unknown theme token "${s}" in "${u}"`)}function lr(u,s,i,c,d,h=""){if(d)for(const[m,w]of Object.entries(d)){if(!c.includes(m)){Gf(s,m);continue}typeof w=="string"&&(u[`${i}${Kf(m)}${h}`]=w)}}function Yf(u){const s={};lr(s,"colors","--cl-color-",Bu,u.colors);for(const[i,c]of Object.entries({...s}))s[`${i}-dark`]=c;return lr(s,"colorsDark","--cl-color-",Bu,u.colorsDark,"-dark"),lr(s,"radii","--cl-radius-",$f,u.radii),lr(s,"shadows","--cl-shadow-",Hf,u.shadows),lr(s,"fonts","--cl-font-",Vf,u.fonts),s}function Xf(u){return typeof u=="object"&&u!==null&&!Array.isArray(u)}function Zf(u){const s=E.useMemo(()=>Qf(u),[u]),[i,c]=E.useState(null),d=s.url;E.useEffect(()=>{if(c(null),!d)return;const x=new AbortController;return fetch(d,{signal:x.signal}).then(R=>{if(!R.ok)throw new Error(`HTTP ${R.status}`);return R.json()}).then(R=>{if(!Xf(R))throw new Error("theme JSON must be an object");c(R)}).catch(R=>{x.signal.aborted||console.error(`[Claudius] Failed to load theme from ${d}:`,R)}),()=>x.abort()},[d]);const h=s.theme??i??null,m=(i==null?void 0:i.colorScheme)??s.mode,w=E.useMemo(()=>h?Yf(h):{},[h]);return{mode:m,cssVars:w}}const Hu="claudius:triggers:dismissed";function Jf(){if(typeof window>"u")return!1;try{return window.sessionStorage.getItem(Hu)==="1"}catch{return!1}}function qf(){if(!(typeof window>"u"))try{window.sessionStorage.setItem(Hu,"1")}catch{}}function Vu({apiUrl:u,title:s,subtitle:i,welcomeMessage:c,placeholder:d,persistMessages:h,storageKeyPrefix:m,requestTimeoutMs:w,theme:x="light",accentColor:R,position:j="bottom-right",locale:F,translations:U,triggers:O,plugins:L,streaming:N=!0,attachments:B=!1,voice:V=!1,conversationExport:K=!1,citations:b=!1}){const[$,se]=E.useState(!1),G=E.useMemo(()=>Kc(B),[B]),ee=E.useMemo(()=>F??Uu(),[F]),ae=E.useMemo(()=>Wd(V,ee),[V,ee]),te=E.useMemo(()=>md(b),[b]),De=E.useMemo(()=>_u(ee),[ee]),[me,ye]=E.useState(null),[Ee,Re]=E.useState(Jf),Ne=E.useRef(!1),we=ud("(max-width: 639px)"),ce=E.useMemo(()=>Bf({locale:F,translations:U}),[F,U]),{messages:z,isLoading:q,isStreaming:H,streamingMessageId:g,error:T,canRetry:Y,sendMessage:D,stop:oe,retry:ie}=id({apiUrl:u,persistMessages:h,storageKeyPrefix:m,timeoutMs:w,translations:ce,plugins:L,streaming:N,citations:te!==null}),fe=E.useRef(null),ne=E.useRef($),{mode:pe,cssVars:Ce}=Zf(x),[he,Me]=E.useState(!1);E.useEffect(()=>{if(pe!=="auto")return;const I=window.matchMedia("(prefers-color-scheme: dark)");Me(I.matches);const xe=Ct=>Me(Ct.matches);return I.addEventListener("change",xe),()=>I.removeEventListener("change",xe)},[pe]),E.useEffect(()=>{var I;ne.current&&!$&&((I=fe.current)==null||I.focus()),ne.current=$},[$]);const Se=E.useCallback(()=>{Re(!0),qf()},[]),Be=E.useCallback(()=>{se(!1),Ne.current&&(Ne.current=!1,Se())},[Se]),lt=E.useCallback(()=>{se(I=>!I)},[]),kt=E.useCallback(()=>{Ne.current=!0,ye(null),se(!0)},[]),Ye=E.useCallback(I=>{ye(I)},[]),Gt=E.useCallback(()=>{ye(null),kt()},[kt]),Et=E.useCallback(()=>{ye(null),Se()},[Se]);ad({triggers:O,enabled:!Ee&&!$,onOpen:kt,onGreeting:Ye});const ze=pe==="dark"||pe==="auto"&&he,Qe={...Ce,...R?{"--cl-color-accent":R,"--cl-color-accent-dark":R}:{}},ht=Object.keys(Qe).length>0?Qe:void 0;return p.jsx("div",{className:"claudius-root",style:ht,children:p.jsxs("div",{"data-claudius-dark":ze?"true":"false",children:[$&&we&&p.jsx("div",{className:"claudius-scrim fixed inset-0 z-40 bg-claudius-scrim",onClick:Be,"aria-hidden":"true"}),$&&p.jsx(Ff,{messages:z,isLoading:q,isStreaming:H,streamingMessageId:g,error:T,canRetry:Y,onSend:D,onStop:oe,onRetry:ie,onClose:Be,title:s??ce.title,subtitle:i??ce.subtitle,welcomeMessage:c??ce.welcomeMessage,placeholder:d??ce.placeholder,position:j,translations:ce,isMobile:we,attachments:G,voice:ae,conversationExport:K===!0,locale:De,citations:te}),!($&&we)&&p.jsx(dd,{ref:fe,isOpen:$,onClick:lt,position:j,translations:ce}),!$&&me&&p.jsx(Uf,{message:me,position:j,onOpen:Gt,onDismiss:Et,dismissLabel:ce.dismissGreeting})]})})}const ep="1.18.0";typeof window<"u"&&(window.ClaudiusWidgetVersion=ep);function bu(){const u=window.ClaudiusConfig;if(!(u!=null&&u.apiUrl)){console.error("[Claudius] Missing ClaudiusConfig.apiUrl");return}const s=document.createElement("div");s.id="claudius-chat-widget",document.body.appendChild(s),du.createRoot(s).render(p.jsx(Vu,{apiUrl:u.apiUrl,title:u.title,subtitle:u.subtitle,welcomeMessage:u.welcomeMessage,placeholder:u.placeholder,persistMessages:u.persistMessages,storageKeyPrefix:u.storageKeyPrefix,requestTimeoutMs:u.requestTimeoutMs,theme:u.theme,accentColor:u.accentColor,position:u.position,locale:u.locale,translations:u.translations,triggers:u.triggers,attachments:u.attachments,voice:u.voice,conversationExport:u.conversationExport,citations:u.citations}))}class Wu extends HTMLElement{constructor(){super(...arguments);Kt(this,"root",null);Kt(this,"container",null)}static get observedAttributes(){return["api-url","title","subtitle","welcome-message","placeholder","persist-messages","storage-key-prefix","request-timeout-ms","theme","accent-color","position","attachments","conversation-export","citations","citations-max-sources","citations-favicons","voice","voice-mode","voice-auto-submit","voice-input","voice-output","voice-lang"]}connectedCallback(){this.container=document.createElement("div"),this.appendChild(this.container),this.root=du.createRoot(this.container),this.render()}disconnectedCallback(){this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.remove(),this.container=null)}attributeChangedCallback(){this.render()}render(){if(!this.root)return;const i=this.getAttribute("api-url");if(!i){console.error("[Claudius] Missing api-url attribute on ");return}const c=this.getAttribute("persist-messages"),d=c===null?void 0:c!=="false",h=this.getAttribute("request-timeout-ms"),m=h===null?void 0:Number(h),w=this.getAttribute("attachments"),x=w===null?void 0:w!=="false",R=this.getAttribute("conversation-export"),j=R==null?void 0:R.trim().toLowerCase(),F=R===null?void 0:j===""||j==="true";this.root.render(p.jsx(Vu,{apiUrl:i,title:this.getAttribute("title")??void 0,subtitle:this.getAttribute("subtitle")??void 0,welcomeMessage:this.getAttribute("welcome-message")??void 0,placeholder:this.getAttribute("placeholder")??void 0,persistMessages:d,storageKeyPrefix:this.getAttribute("storage-key-prefix")??void 0,requestTimeoutMs:m!==void 0&&Number.isFinite(m)?m:void 0,theme:this.getAttribute("theme")??void 0,accentColor:this.getAttribute("accent-color")??void 0,position:this.getAttribute("position")??void 0,attachments:x,conversationExport:F,voice:Qd(U=>this.getAttribute(U)),citations:gd(U=>this.getAttribute(U))}))}}return typeof customElements<"u"&&!customElements.get("claudius-chat")&&customElements.define("claudius-chat",Wu),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",bu):bu(),Ft.ClaudiusChat=Wu,Object.defineProperty(Ft,Symbol.toStringTag,{value:"Module"}),Ft})({}); diff --git a/create-claudius/package.json b/create-claudius/package.json index 00fb9b4..2131418 100644 --- a/create-claudius/package.json +++ b/create-claudius/package.json @@ -1,6 +1,6 @@ { "name": "create-claudius", - "version": "1.17.1", + "version": "1.18.0", "description": "Scaffold a Claudius AI chat widget project in one command.", "keywords": [ "claudius", diff --git a/docs/package.json b/docs/package.json index 5be0b45..3e7bd92 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,6 +1,6 @@ { "name": "claudius-docs", - "version": "1.17.1", + "version": "1.18.0", "private": true, "type": "module", "scripts": { diff --git a/package.json b/package.json index d863519..61eb0a7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "claudius", - "version": "1.17.1", + "version": "1.18.0", "description": "Embeddable AI chat widget for PMDS and client sites. React component + standalone script embed, powered by Cloudflare Workers and Claude.", "private": true, "type": "module", diff --git a/widget/package.json b/widget/package.json index d30bf4b..f5fcf2b 100644 --- a/widget/package.json +++ b/widget/package.json @@ -1,6 +1,6 @@ { "name": "claudius-chat-widget", - "version": "1.17.1", + "version": "1.18.0", "type": "module", "description": "Embeddable AI chat widget powered by Claude. Drop-in React component or standalone script embed, backed by a Cloudflare Worker.", "keywords": [ diff --git a/worker/package.json b/worker/package.json index 25684bd..b641d62 100644 --- a/worker/package.json +++ b/worker/package.json @@ -1,6 +1,6 @@ { "name": "claudius-chat-worker", - "version": "1.17.1", + "version": "1.18.0", "private": true, "type": "module", "scripts": {