@donkit-ai/design-system 1.4.40 → 1.4.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +3 -3
- package/dist/index.es.js +331 -289
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),g=require("lucide-react"),ue=require("react-dom"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),g=require("lucide-react"),ue=require("react-dom"),A={1:16,2:20,3:24,4:28,5:48};var he={exports:{}},ce={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var ye;function Ve(){return ye||(ye=1,process.env.NODE_ENV!=="production"&&function(){function s(c){if(c==null)return null;if(typeof c=="function")return c.$$typeof===O?null:c.displayName||c.name||null;if(typeof c=="string")return c;switch(c){case S:return"Fragment";case B:return"Profiler";case
|
|
17
|
+
*/var ye;function Ve(){return ye||(ye=1,process.env.NODE_ENV!=="production"&&function(){function s(c){if(c==null)return null;if(typeof c=="function")return c.$$typeof===O?null:c.displayName||c.name||null;if(typeof c=="string")return c;switch(c){case S:return"Fragment";case B:return"Profiler";case $:return"StrictMode";case I:return"Suspense";case V:return"SuspenseList";case w:return"Activity"}if(typeof c=="object")switch(typeof c.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),c.$$typeof){case _:return"Portal";case R:return c.displayName||"Context";case E:return(c._context.displayName||"Context")+".Consumer";case L:var y=c.render;return c=c.displayName,c||(c=y.displayName||y.name||"",c=c!==""?"ForwardRef("+c+")":"ForwardRef"),c;case H:return y=c.displayName||null,y!==null?y:s(c.type)||"Memo";case C:y=c._payload,c=c._init;try{return s(c(y))}catch{}}return null}function t(c){return""+c}function n(c){try{t(c);var y=!1}catch{y=!0}if(y){y=console;var M=y.error,z=typeof Symbol=="function"&&Symbol.toStringTag&&c[Symbol.toStringTag]||c.constructor.name||"Object";return M.call(y,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",z),t(c)}}function o(c){if(c===S)return"<>";if(typeof c=="object"&&c!==null&&c.$$typeof===C)return"<...>";try{var y=s(c);return y?"<"+y+">":"<...>"}catch{return"<...>"}}function a(){var c=q.A;return c===null?null:c.getOwner()}function r(){return Error("react-stack-top-frame")}function i(c){if(W.call(c,"key")){var y=Object.getOwnPropertyDescriptor(c,"key").get;if(y&&y.isReactWarning)return!1}return c.key!==void 0}function l(c,y){function M(){T||(T=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",y))}M.isReactWarning=!0,Object.defineProperty(c,"key",{get:M,configurable:!0})}function m(){var c=s(this.type);return P[c]||(P[c]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),c=this.props.ref,c!==void 0?c:null}function d(c,y,M,z,ee,te){var F=M.ref;return c={$$typeof:j,type:c,key:y,props:M,_owner:z},(F!==void 0?F:null)!==null?Object.defineProperty(c,"ref",{enumerable:!1,get:m}):Object.defineProperty(c,"ref",{enumerable:!1,value:null}),c._store={},Object.defineProperty(c._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(c,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(c,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ee}),Object.defineProperty(c,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:te}),Object.freeze&&(Object.freeze(c.props),Object.freeze(c)),c}function f(c,y,M,z,ee,te){var F=y.children;if(F!==void 0)if(z)if(b(F)){for(z=0;z<F.length;z++)h(F[z]);Object.freeze&&Object.freeze(F)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else h(F);if(W.call(y,"key")){F=s(c);var J=Object.keys(y).filter(function(me){return me!=="key"});z=0<J.length?"{key: someKey, "+J.join(": ..., ")+": ...}":"{key: someKey}",k[F+z]||(J=0<J.length?"{"+J.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,F,C,J,C),k[C+F]=!0)}if(C=null,M!==void 0&&(n(M),C=""+M),i(y)&&(n(y.key),C=""+y.key),"key"in y){M={};for(var ne in y)ne!=="key"&&(M[ne]=y[ne])}else M=y;return C&&l(M,typeof c=="function"?c.displayName||c.name||"Unknown":c),d(c,C,M,a(),ee,te)}function h(c){x(c)?c._store&&(c._store.validated=1):typeof c=="object"&&c!==null&&c.$$typeof===z&&(c._payload.status==="fulfilled"?x(c._payload.value)&&c._payload.value._store&&(c._payload.value._store.validated=1):c._store&&(c._store.validated=1))}function x(c){return typeof c=="object"&&c!==null&&c.$$typeof===_}var m=u,_=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),$=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),V=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),N=Symbol.for("react.activity"),O=Symbol.for("react.client.reference"),q=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=Object.prototype.hasOwnProperty,b=Array.isArray,w=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(c){return c()}};var T,P={},Y=m.react_stack_bottom_frame.bind(m,r)(),X=w(o(r)),k={};de.Fragment=S,de.jsx=function(c,y,M){var F=1e4>q.recentlyCreatedOwnerStacks++;return f(c,y,M,!1,F?Error("react-stack-top-frame"):Y,F?w(o(c)):X)},de.jsxs=function(c,y,M){var F=1e4>q.recentlyCreatedOwnerStacks++;return f(c,y,M,!0,F?Error("react-stack-top-frame"):Y,F?w(o(c)):X)}}()),de}process.env.NODE_ENV==="production"?he.exports=Ue():he.exports=Ve();var e=he.exports;function Se({size:s="m",color:t="default",className:n="",...o}){return e.jsx("span",{className:["ds-spinner",`ds-spinner--${s}`,`ds-spinner--${t}`,n].filter(Boolean).join(" "),role:"status","aria-label":"Loading",...o})}const He={xs:12,s:14,m:16,l:20};function ie({children:s,variant:t="primary",size:n="m",fullWidth:o=!1,icon:a,disabled:r=!1,state:i="idle",onClick:l,type:p="button",href:d,"aria-label":f,className:h="",...x}){const m=a&&!s,_=i==="loading",j=i==="success",S=i==="error",R=_||j||S,B=n==="xs"?"s":"m",E=t==="danger"?"on-accent":"default",$=He[n]??16,L=_?e.jsx(Se,{size:B,color:E}):j?e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:e.jsx(g.Check,{size:$,strokeWidth:2.5})}):S?e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:e.jsx(g.X,{size:$,strokeWidth:2.5})}):null,I=["ds-button",`ds-button--${t}`,`ds-button--${n}`,o&&"ds-button--full",m&&"ds-button--icon-only",h].filter(Boolean).join(" "),V=i!=="idle"?i:void 0,H=e.jsxs(e.Fragment,{children:[R?L:a&&e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:a}),s]});if(d){const z=N=>{if(r||_){N.preventDefault();return}N.metaKey||N.ctrlKey||N.button===1||(N.preventDefault(),l==null||l(N))};return e.jsx("a",{className:I,href:r||_?void 0:d,onClick:z,"aria-label":f,"aria-disabled":r||_?"true":void 0,"aria-busy":_?"true":void 0,"data-state":V,...x,children:H})}return e.jsx("button",{type:p,className:I,disabled:r,onClick:_?void 0:l,"aria-label":f,"aria-busy":_?"true":void 0,"data-state":V,...x,children:H})}function Ye({label:s,error:t,hint:n,fullWidth:o=!0,icon:a,iconRight:r,onIconRightClick:i,size:l="m",disabled:p,id:d,...f}){const h=d||`input-${u.useId()}`,x=n?`${h}-hint`:void 0,m=t?`${h}-error`:void 0,_=m||x;return e.jsxs("div",{className:`ds-input-wrapper ${o?"ds-input-wrapper--full":""} ${p?"ds-input-wrapper--disabled":""} ${t?"ds-input-wrapper--error":""}`,children:[s&&e.jsx("label",{className:"ds-input-label",htmlFor:h,children:s}),e.jsxs("div",{className:"ds-input-container",children:[a&&e.jsx("span",{className:`ds-input-icon ds-input-icon--${l}`,"aria-hidden":"true",children:a}),e.jsx("input",{id:h,className:`ds-input ds-input--${l} ${a?"ds-input--with-icon":""} ${r?"ds-input--with-icon-right":""} ${t?"ds-input--error":""}`,disabled:p,"aria-invalid":t?"true":"false","aria-describedby":_,...f}),r&&e.jsx("button",{type:"button",className:`ds-input-icon-right ds-input-icon-right--${l}`,onClick:i,tabIndex:-1,"aria-label":"Toggle visibility",children:r})]}),n&&!t&&e.jsx("span",{id:x,className:"ds-input-hint",children:n}),e.jsx("div",{className:"ds-input-error-wrap",children:e.jsx("div",{className:"ds-input-error-inner",children:t&&e.jsx("span",{id:m,className:"ds-input-error",role:"alert",children:t})})})]})}function qe({label:s,error:t,hint:n,fullWidth:o=!0,size:a="m",disabled:r,id:i,resize:l=!0,rows:p=3,...d}){const f=i||`textarea-${u.useId()}`,h=n?`${f}-hint`:void 0,x=t?`${f}-error`:void 0,m=x||h;return e.jsxs("div",{className:`ds-textarea-wrapper ${o?"ds-textarea-wrapper--full":""} ${r?"ds-textarea-wrapper--disabled":""}`,children:[s&&e.jsx("label",{className:"ds-textarea-label",htmlFor:f,children:s}),e.jsx("textarea",{id:f,className:`ds-textarea ds-textarea--${a} ${t?"ds-textarea--error":""} ${l?"":"ds-textarea--no-resize"}`,disabled:r,"aria-invalid":t?"true":"false","aria-describedby":m,rows:p,...d}),n&&!t&&e.jsx("span",{id:h,className:"ds-textarea-hint",children:n}),t&&e.jsx("span",{id:x,className:"ds-textarea-error",role:"alert",children:t})]})}function Xe({label:s,value:t,onChange:n,options:o=[],placeholder:a="Select option",error:r,fullWidth:i=!0,size:l="m",disabled:p=!1,id:d,...f}){const[h,x]=u.useState(!1),[m,_]=u.useState(!1),[j,S]=u.useState({}),[R,B]=u.useState("down"),[E,$]=u.useState(-1),L=u.useRef(null),I=u.useRef(null),V=u.useRef(null),H=u.useRef(null),z=d||`select-${u.useId()}`,N=`${z}-label`,O=r?`${z}-error`:void 0,q=150,W=(k=!1)=>{m||(_(!0),$(-1),H.current=setTimeout(()=>{var c;x(!1),_(!1),k&&((c=V.current)==null||c.focus())},q))},b=k=>{clearTimeout(H.current),_(!1);const c=k!==void 0?k:Math.max(o.findIndex(y=>y.value===t),0);$(c),x(!0)};u.useEffect(()=>()=>clearTimeout(H.current),[]);const w=()=>{var te;const k=(te=L.current)==null?void 0:te.getBoundingClientRect();if(!k)return;const c=window.innerHeight,y=c-k.bottom,M=k.top,ee=y<300&&M>y;B(ee?"up":"down"),S(ee?{bottom:c-k.top+4,left:k.left,width:k.width}:{top:k.bottom+4,left:k.left,width:k.width})};u.useEffect(()=>{if(h)return w(),window.addEventListener("scroll",w,!0),window.addEventListener("resize",w),()=>{window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w)}},[h]),u.useEffect(()=>{const k=c=>{L.current&&!L.current.contains(c.target)&&I.current&&!I.current.contains(c.target)&&W()};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[m]),u.useEffect(()=>{var c;if(!h||E<0||!I.current)return;(c=I.current.querySelectorAll(".ds-select-option")[E])==null||c.scrollIntoView({block:"nearest"})},[E,h]);const T=k=>{switch(k.key){case"ArrowDown":k.preventDefault(),h?$(c=>Math.min(c+1,o.length-1)):b();break;case"ArrowUp":k.preventDefault(),h?$(c=>Math.max(c-1,0)):b(o.length-1);break;case"Home":h&&(k.preventDefault(),$(0));break;case"End":h&&(k.preventDefault(),$(o.length-1));break;case"Enter":case" ":k.preventDefault(),h?E>=0&&(n==null||n(o[E].value),W(!0)):b();break;case"Escape":h&&(k.preventDefault(),W(!0));break;case"Tab":h&&W(!1);break}},P=o.find(k=>k.value===t),Y=l==="xs"?D[1]:l==="small"?D[2]:D[3],X=h&&e.jsx("div",{ref:I,role:"listbox","aria-labelledby":s?N:void 0,tabIndex:-1,className:["ds-select-dropdown",`ds-select-dropdown--${l}`,`ds-select-dropdown--${R}`,m&&"ds-select-dropdown--closing"].filter(Boolean).join(" "),style:j,children:o.map((k,c)=>e.jsx("button",{id:`${z}-opt-${c}`,type:"button",role:"option",tabIndex:-1,"aria-selected":t===k.value,className:["ds-select-option",`ds-select-option--${l}`,t===k.value&&"ds-select-option--selected",c===E&&"ds-select-option--active"].filter(Boolean).join(" "),onClick:()=>{n==null||n(k.value),W(!0)},children:k.label},k.value))});return e.jsxs("div",{className:`ds-select-wrapper ${i?"ds-select-wrapper--full":""} ${p?"ds-select-wrapper--disabled":""}`,children:[s&&e.jsx("label",{id:N,className:"ds-select-label",children:s}),e.jsx("div",{className:"ds-select-container",ref:L,children:e.jsxs("button",{ref:V,type:"button",id:z,role:"combobox","aria-haspopup":"listbox","aria-expanded":h,"aria-activedescendant":h&&E>=0?`${z}-opt-${E}`:void 0,"aria-labelledby":s?N:void 0,"aria-invalid":r?"true":"false","aria-describedby":O,className:`ds-select-trigger ds-select-trigger--${l} ${r?"ds-select-trigger--error":""}`,onClick:()=>{p||(h?W():b())},onKeyDown:T,disabled:p,...f,children:[e.jsx("span",{className:P?"":"ds-select-placeholder",children:(P==null?void 0:P.label)||a}),e.jsx(g.ChevronDown,{size:Y,strokeWidth:1.5,className:`ds-select-icon ${h&&R==="down"?"ds-select-icon--open":""} ${h&&R==="up"?"ds-select-icon--up":""}`,"aria-hidden":"true"})]})}),r&&e.jsx("span",{id:O,className:"ds-select-error",role:"alert",children:r}),typeof document<"u"&&ue.createPortal(X,document.body)]})}function Ke({label:s,value:t=0,onChange:n,min:o=0,max:a=100,step:r=1,size:i="m",disabled:l=!1,hint:p,error:d,...f}){const h=()=>{if(l)return;const R=Math.min(Number(t)+r,a);n==null||n(R)},x=()=>{if(l)return;const R=Math.max(Number(t)-r,o);n==null||n(R)},m=R=>{if(l)return;const B=R.target.value;if(B===""){n==null||n(o);return}const E=Number(B);if(!isNaN(E)){const $=Math.min(Math.max(E,o),a);n==null||n($)}},_=["ds-stepper-wrapper",l&&"ds-stepper-wrapper--disabled",d&&"ds-stepper-wrapper--error"].filter(Boolean).join(" "),j=["ds-stepper",`ds-stepper--${i}`,l&&"ds-stepper--disabled"].filter(Boolean).join(" "),S=i==="xs"?D[1]:i==="small"?D[2]:D[3];return e.jsxs("div",{className:_,children:[s&&e.jsx("label",{className:"ds-stepper-label",children:s}),e.jsxs("div",{className:j,children:[e.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--minus",onClick:x,disabled:l||t<=o,"aria-label":"Decrease",children:e.jsx(g.Minus,{size:S,strokeWidth:1.5})}),e.jsx("input",{type:"number",className:"ds-stepper-input",value:t,onChange:m,min:o,max:a,step:r,disabled:l,...f}),e.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--plus",onClick:h,disabled:l||t>=a,"aria-label":"Increase",children:e.jsx(g.Plus,{size:S,strokeWidth:1.5})})]}),p&&!d&&e.jsx("div",{className:"ds-stepper-hint",children:p}),d&&e.jsx("div",{className:"ds-stepper-error",children:d})]})}function Ge({children:s,padding:t="m",variant:n="info",hover:o=!1,onClick:a,href:r,disabled:i=!1,...l}){const d=(o?"interactive":n)==="interactive"||a||r,f=["ds-card",`ds-card--${t}`,d&&"ds-card--interactive"].filter(Boolean).join(" ");if(r){const m=_=>{if(i){_.preventDefault();return}_.metaKey||_.ctrlKey||_.button===1||(_.preventDefault(),a==null||a(_))};return e.jsx("a",{className:f,href:i?void 0:r,onClick:m,"aria-disabled":i?"true":void 0,...l,children:s})}const h=d&&a?"button":"div",x=d&&a?{type:"button",onClick:a,disabled:i}:{};return e.jsx(h,{className:f,role:d&&!a?"article":void 0,...x,...l,children:s})}function Je({children:s,...t}){return e.jsx("h1",{className:"ds-h1",...t,children:s})}function Ze({children:s,...t}){return e.jsx("h2",{className:"ds-h2",...t,children:s})}function Qe({children:s,...t}){return e.jsx("h3",{className:"ds-h3",...t,children:s})}function es({children:s,...t}){return e.jsx("h4",{className:"ds-h4",...t,children:s})}function ss({children:s,secondary:t=!1,...n}){return e.jsx("p",{className:`ds-p1 ${t?"ds-p1--secondary":""}`,...n,children:s})}function Ae({children:s,secondary:t=!1,...n}){return e.jsx("p",{className:`ds-p2 ${t?"ds-p2--secondary":""}`,...n,children:s})}function ve({children:s,secondary:t=!1,...n}){return e.jsx("p",{className:`ds-p3 ${t?"ds-p3--secondary":""}`,...n,children:s})}function ae({children:s,variant:t="default",size:n="m",role:o,...a}){const r=["ds-badge",`ds-badge--${t}`,`ds-badge--${n}`].filter(Boolean).join(" "),i=o||(["info","success","warning","error"].includes(t)?"status":void 0);return e.jsx("span",{className:r,role:i,...a,children:s})}const ts={info:g.Info,success:g.CheckCircle,warning:g.AlertTriangle,error:g.XCircle};function ns({children:s,variant:t="info",title:n,onClose:o,role:a,...r}){const i=ts[t],l=a||(t==="error"?"alert":"status");return e.jsxs("div",{className:`ds-alert ds-alert--${t} ${n?"":"ds-alert--no-title"}`,role:l,...r,children:[i&&e.jsx("div",{className:"ds-alert__icon",children:e.jsx(i,{size:D[3],strokeWidth:1.5})}),e.jsxs("div",{className:"ds-alert__content",children:[n&&e.jsx("div",{className:"ds-alert__title",children:n}),s&&e.jsx("div",{className:"ds-alert__message",children:s})]}),o&&e.jsx("button",{type:"button",className:"ds-alert__close",onClick:o,"aria-label":"Close alert",children:e.jsx(g.X,{size:D[3],strokeWidth:1.5})})]})}const rs=200;function as({children:s,title:t,onClose:n,size:o="m",scrollable:a=!1,subHeader:r,...i}){const l=u.useRef(null),p=u.useId(),[d,f]=u.useState(!1),h=()=>{!n||d||(f(!0),setTimeout(()=>{f(!1),n()},rs))};u.useEffect(()=>{const j=R=>{R.key==="Escape"&&h()},S=R=>{l.current&&!l.current.contains(R.target)&&h()};return document.addEventListener("keydown",j),document.addEventListener("mousedown",S),()=>{document.removeEventListener("keydown",j),document.removeEventListener("mousedown",S)}},[n,d]);const x=u.Children.toArray(s),m=x.find(j=>(j==null?void 0:j.type)===xe),_=x.filter(j=>(j==null?void 0:j.type)!==xe);return e.jsx("div",{className:["ds-modal-overlay",d&&"ds-modal-overlay--closing"].filter(Boolean).join(" "),...i,children:e.jsxs("div",{className:[`ds-modal ds-modal--${o}`,a&&"ds-modal--scrollable"].filter(Boolean).join(" "),ref:l,role:"dialog","aria-modal":"true","aria-labelledby":t?p:void 0,children:[(t||n||r)&&e.jsxs("div",{className:"ds-modal__header",children:[(t||n)&&e.jsxs("div",{className:"ds-modal__header-row",children:[t&&e.jsx("h3",{id:p,className:"ds-modal__title",children:t}),n&&e.jsx(ie,{variant:"ghost",size:"small",icon:e.jsx(g.X,{size:D[2],strokeWidth:1.5}),onClick:h,"aria-label":"Close modal"})]}),r&&e.jsx("div",{className:"ds-modal__subheader",children:r})]}),e.jsx("div",{className:"ds-modal__body",children:_}),m]})})}function xe({children:s}){return!s||u.Children.count(s)===0?null:e.jsx("div",{className:"ds-modal__footer",children:s})}function De({children:s,title:t="Code",defaultExpanded:n=!1,expanded:o,onToggle:a,padding:r="s",className:i="",...l}){const[p,d]=u.useState(n),f=o!==void 0,h=f?o:p,x=()=>{f?a==null||a(!o):d(_=>!_)},m=["ds-code-accordion",`ds-code-accordion--${r}`,h&&"ds-code-accordion--expanded",i].filter(Boolean).join(" ");return e.jsxs("div",{className:m,...l,children:[e.jsxs("button",{type:"button",className:"ds-code-accordion__header",onClick:x,"aria-expanded":h,children:[e.jsx("span",{className:"ds-code-accordion__title",children:t}),e.jsx(g.ChevronDown,{size:D[2],strokeWidth:1.5,className:`ds-code-accordion__icon ${h?"ds-code-accordion__icon--expanded":""}`})]}),e.jsx("div",{className:"ds-code-accordion__content",children:e.jsx("div",{className:"ds-code-accordion__inner",children:e.jsx("pre",{className:"ds-code-accordion__pre",children:e.jsx("code",{children:s})})})})]})}function os({children:s,block:t=!1,collapsible:n=!1,title:o="Code",defaultExpanded:a=!1,...r}){return t?n?e.jsx(De,{title:o,defaultExpanded:a,...r,children:s}):e.jsx("pre",{className:"ds-code-block",...r,children:e.jsx("code",{children:s})}):e.jsx("code",{className:"ds-code-inline",...r,children:s})}function is({href:s,children:t,onClick:n,target:o,rel:a,...r}){const l=o==="_blank"?a?`${a} noopener noreferrer`:"noopener noreferrer":a;return e.jsx("a",{href:s,className:"ds-link",onClick:n,target:o,rel:l,...r,children:t})}function ls({children:s,size:t="m",variant:n="ghost",...o}){return e.jsx("div",{className:"ds-tabs",role:"tablist",...o,children:u.Children.map(s,a=>u.isValidElement(a)?u.cloneElement(a,{size:t,variant:n}):a)})}function cs({children:s,selected:t=!1,onClick:n,size:o="m",variant:a="ghost",disabled:r=!1,icon:i,href:l,...p}){const d=i&&!s,f=["ds-tab",`ds-tab--${o}`,`ds-tab--${a}`,t&&"ds-tab--selected",d&&"ds-tab--icon-only"].filter(Boolean).join(" "),h=e.jsxs(e.Fragment,{children:[i&&e.jsx("span",{className:"ds-tab-icon",children:i}),s]});if(l){const x=m=>{if(r){m.preventDefault();return}m.metaKey||m.ctrlKey||m.button===1||(m.preventDefault(),n==null||n(m))};return e.jsx("a",{role:"tab","aria-current":t?"page":void 0,"aria-disabled":r?"true":void 0,className:f,href:r?void 0:l,onClick:x,...p,children:h})}return e.jsx("button",{role:"tab","aria-selected":t,className:f,onClick:n,disabled:r,...p,children:h})}function ds({options:s,value:t,onChange:n,size:o="m",disabled:a=!1}){const r=u.useRef(null),i=u.useRef(null),[l,p]=u.useState(!1),d=u.useRef(!1),f=u.useRef(null),h=u.useRef(null),x=()=>{if(!r.current)return;const m=r.current.querySelector(`[data-value="${t}"]`);if(!m)return;const _=r.current.getBoundingClientRect(),j=m.getBoundingClientRect(),S=j.left-_.left,R=j.width;i.current?(i.current.style.transition=d.current?"left var(--transition-normal), width var(--transition-normal)":"none",i.current.style.left=S+"px",i.current.style.width=R+"px",d.current=!1):(p(!0),requestAnimationFrame(()=>{if(!i.current||!r.current)return;const B=r.current.querySelector(`[data-value="${t}"]`);if(!B)return;const E=r.current.getBoundingClientRect(),$=B.getBoundingClientRect();i.current.style.transition="none",i.current.style.left=$.left-E.left+"px",i.current.style.width=$.width+"px"}))};return h.current=x,u.useLayoutEffect(()=>{const m=f.current!==t;f.current=t,d.current=l&&m,x()}),u.useEffect(()=>{if(!r.current)return;const m=new ResizeObserver(()=>{d.current=!1,h.current()});return m.observe(r.current),()=>m.disconnect()},[]),e.jsxs("div",{className:["ds-seg",`ds-seg--${o}`,a&&"ds-seg--disabled"].filter(Boolean).join(" "),ref:r,role:"group",children:[l&&e.jsx("div",{ref:i,className:"ds-seg__pill","aria-hidden":"true"}),s.map(m=>e.jsxs("button",{type:"button","data-value":m.value,className:["ds-seg__btn",t===m.value&&"ds-seg__btn--active"].filter(Boolean).join(" "),onClick:()=>!a&&n(m.value),"aria-pressed":t===m.value,disabled:a,children:[m.icon&&e.jsx("span",{className:"ds-seg__btn-icon","aria-hidden":"true",children:m.icon}),m.label]},m.value))]})}function fe({children:s,title:t,defaultExpanded:n=!1,expanded:o,onToggle:a,padding:r="m",...i}){const[l,p]=u.useState(n),d=o!==void 0,f=d?o:l,h=()=>{d?a==null||a(!o):p(m=>!m)},x=["ds-accordion",`ds-accordion--${r}`,f&&"ds-accordion--expanded"].filter(Boolean).join(" ");return e.jsxs("div",{className:x,...i,children:[e.jsxs("button",{type:"button",className:"ds-accordion__header",onClick:h,"aria-expanded":f,children:[e.jsx("span",{className:"ds-accordion__title",children:t}),e.jsx(g.ChevronDown,{size:D[2],strokeWidth:1.5,className:`ds-accordion__icon ${f?"ds-accordion__icon--expanded":""}`})]}),e.jsx("div",{className:"ds-accordion__content",children:e.jsx("div",{className:"ds-accordion__content-inner",children:e.jsx("div",{className:"ds-accordion__content-body",children:s})})})]})}const se=8,oe=8;function us(s,t,n){const o=window.innerWidth;let a,r;switch(s){case"top":a=t.top-n.height-se,r=t.left+t.width/2-n.width/2;break;case"bottom":a=t.bottom+se,r=t.left+t.width/2-n.width/2;break;case"left":a=t.top+t.height/2-n.height/2,r=t.left-n.width-se;break;case"right":a=t.top+t.height/2-n.height/2,r=t.right+se;break;default:a=t.bottom+se,r=t.left}const i=Math.max(oe,Math.min(o-n.width-oe,r)),l=r-i;return{top:a,left:i,arrowOffset:l}}function fs(s,t,n){const o=window.innerWidth,a=window.innerHeight;if(s.top>=t+se+oe)return"top";if(a-s.bottom>=t+se+oe)return"bottom";if(o-s.right>=n+se+oe)return"right";if(s.left>=n+se+oe)return"left";const r=Math.max(s.top,a-s.bottom,s.left,o-s.right);return r===s.top?"top":r===a-s.bottom?"bottom":r===o-s.right?"right":"left"}function ms({children:s,content:t,position:n,...o}){const[a,r]=u.useState(!1),[i,l]=u.useState({visibility:"hidden"}),[p,d]=u.useState(n||"top"),f=u.useRef(null),h=u.useRef(null),x=u.useRef(!1),m=()=>{if(!f.current||!h.current)return;const j=f.current.getBoundingClientRect(),S=h.current.getBoundingClientRect(),R=n||fs(j,S.height,S.width),{top:B,left:E,arrowOffset:$}=us(R,j,S);d(R),l({position:"fixed",top:B,left:E,visibility:"visible","--arrow-offset":`${$}px`})};if(u.useEffect(()=>{if(!a)return;l({position:"fixed",visibility:"hidden"});const j=requestAnimationFrame(m);return window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),()=>{cancelAnimationFrame(j),window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}},[a,n]),u.useEffect(()=>{if(!a)return;const j=S=>{f.current&&!f.current.contains(S.target)&&r(!1)};return document.addEventListener("touchstart",j),()=>document.removeEventListener("touchstart",j)},[a]),!t)return s;const _=a&&e.jsx("div",{ref:h,className:`ds-tooltip ds-tooltip--${p}`,role:"tooltip",style:i,children:t});return e.jsxs("div",{ref:f,className:"ds-tooltip-wrapper",onMouseEnter:()=>{x.current||r(!0)},onMouseLeave:()=>{x.current||r(!1)},onTouchStart:()=>{x.current=!0,r(j=>!j)},...o,children:[s,typeof document<"u"&&ue.createPortal(_,document.body)]})}function ps({checked:s=!1,onChange:t,size:n="m",disabled:o=!1,label:a,id:r,...i}){const l=r||`toggle-${u.useId()}`,p=["ds-toggle",`ds-toggle--${n}`,o&&"ds-toggle--disabled"].filter(Boolean).join(" ");return e.jsxs("label",{className:p,htmlFor:l,children:[e.jsx("input",{type:"checkbox",id:l,className:"ds-toggle__input",checked:s,onChange:d=>t==null?void 0:t(d.target.checked),disabled:o,...i}),e.jsx("span",{className:"ds-toggle__track",children:e.jsx("span",{className:"ds-toggle__thumb"})}),a&&e.jsx("span",{className:"ds-toggle__label",children:a})]})}function hs({checked:s=!1,onChange:t,size:n="m",disabled:o=!1,label:a,id:r,...i}){const l=r||`checkbox-${u.useId()}`,p=["ds-checkbox",`ds-checkbox--${n}`,o&&"ds-checkbox--disabled"].filter(Boolean).join(" "),d=n==="xs"?10:n==="small"?14:n==="large"?20:16;return e.jsxs("label",{className:p,htmlFor:l,children:[e.jsx("input",{type:"checkbox",id:l,className:"ds-checkbox__input",checked:s,onChange:f=>t==null?void 0:t(f.target.checked),disabled:o,...i}),e.jsx("span",{className:"ds-checkbox__box",children:s&&e.jsx(g.Check,{size:d,strokeWidth:2.5,className:"ds-checkbox__icon"})}),a&&e.jsx("span",{className:"ds-checkbox__label",children:a})]})}function xs({checked:s=!1,onChange:t,size:n="m",disabled:o=!1,label:a,name:r,value:i,id:l,...p}){const d=l||`radio-${u.useId()}`,f=["ds-radio",`ds-radio--${n}`,o&&"ds-radio--disabled"].filter(Boolean).join(" ");return e.jsxs("label",{className:f,htmlFor:d,children:[e.jsx("input",{type:"radio",id:d,className:"ds-radio__input",checked:s,onChange:h=>t==null?void 0:t(h.target.checked),disabled:o,name:r,value:i,...p}),e.jsx("span",{className:"ds-radio__circle",children:e.jsx("span",{className:"ds-radio__dot"})}),a&&e.jsx("span",{className:"ds-radio__label",children:a})]})}function Ie({width:s,height:t,shape:n="rect",aspectRatio:o,className:a="",style:r={},...i}){return e.jsx("span",{className:["ds-skeleton",`ds-skeleton--${n}`,a].filter(Boolean).join(" "),style:{width:s,height:t,aspectRatio:o,...r},"aria-hidden":"true",...i})}function bs({lines:s=1,lastLineWidth:t="70%",gap:n,className:o="",style:a={},...r}){return e.jsx("span",{className:["ds-skeleton-text",o].filter(Boolean).join(" "),style:{gap:n,...a},"aria-hidden":"true",...r,children:Array.from({length:s},(i,l)=>e.jsx("span",{className:"ds-skeleton ds-skeleton--text",style:l===s-1&&s>1?{width:t}:void 0},l))})}Ie.Text=bs;function _s(s){let t=2166136261;for(let n=0;n<s.length;n++)t^=s.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t%360}function js(s){if(!s)return"";const t=s.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():s[0].toUpperCase()}function vs({seed:s,icon:t,src:n,size:o=32,className:a="",style:r={},...i}){const l=_s(s??""),[p,d]=u.useState(!1),f=t??e.jsx("span",{className:"ds-avatar__initials",children:js(s)});return e.jsx("div",{className:["ds-avatar",a].filter(Boolean).join(" "),style:{width:o,height:o,"--ds-avatar-h":l,...r},"aria-hidden":"true",...i,children:n&&!p?e.jsx("img",{src:n,alt:"",onError:()=>d(!0)}):f})}function Ns({children:s,size:t="compact",stickyTop:n,maxHeight:o,className:a="",style:r={},...i}){const l={...o?{maxHeight:o}:{},...n!==void 0?{"--ds-table-sticky-top":typeof n=="number"?`${n}px`:n}:{},...r};return e.jsx("div",{className:["ds-table-wrap",o?"ds-table-wrap--scroll":""].filter(Boolean).join(" "),style:l,children:e.jsx("table",{className:["ds-table",`ds-table--${t}`,a].filter(Boolean).join(" "),...i,children:s})})}function ws({children:s,...t}){return e.jsx("thead",{...t,children:s})}function gs({children:s,...t}){return e.jsx("tbody",{...t,children:s})}function ys({children:s,interactive:t,selected:n,subheader:o,exiting:a,updated:r,className:i="",onClick:l,...p}){return e.jsx("tr",{className:["ds-table-row",t||l?"ds-table-row--interactive":"",n?"ds-table-row--selected":"",o?"ds-table-row--subheader":"",a?"ds-table-row--exiting":"",r?"ds-table-row--updated":"",i].filter(Boolean).join(" "),onClick:l,...p,children:s})}function ks({children:s,colSpan:t=999,...n}){return e.jsx("tr",{className:"ds-table-row ds-table-row--subheader",...n,children:e.jsx("td",{colSpan:t,children:s})})}function Es({children:s,align:t="left",sortDir:n,onSort:o,width:a,className:r="",style:i={},...l}){const p=!!o||n!==void 0,d=n==="asc"?g.ChevronUp:n==="desc"?g.ChevronDown:g.ChevronsUpDown;return e.jsx("th",{className:["ds-th",p?"ds-th--sortable":"",n?"ds-th--sorted":"",t!=="left"?`ds-table-cell--${t}`:"",r].filter(Boolean).join(" "),onClick:o,style:{width:a,...i},...l,children:p?e.jsxs("span",{className:"ds-th__inner",children:[s,e.jsx("span",{className:"ds-th__sort-icon",children:e.jsx(d,{size:11,strokeWidth:2.5})})]}):s})}function Ts({children:s,align:t="left",secondary:n,muted:o,truncate:a,nowrap:r,className:i="",...l}){return e.jsx("td",{className:["ds-td",t!=="left"?`ds-table-cell--${t}`:"",n?"ds-table-cell--secondary":"",o?"ds-table-cell--muted":"",a?"ds-table-cell--truncate":"",r?"ds-table-cell--nowrap":"",i].filter(Boolean).join(" "),...l,children:s})}function Rs({icon:s,title:t,description:n,action:o,size:a="m",className:r="",...i}){return e.jsxs("div",{className:["ds-empty-state",`ds-empty-state--${a}`,r].filter(Boolean).join(" "),...i,children:[s&&e.jsx("div",{className:"ds-empty-state__icon",children:s}),e.jsx("div",{className:"ds-empty-state__title",children:t}),n&&e.jsx("div",{className:"ds-empty-state__description",children:n}),o&&e.jsx("div",{className:"ds-empty-state__action",children:o})]})}function $s({label:s,hint:t,error:n,required:o=!1,disabled:a=!1,htmlFor:r,children:i,className:l="",style:p,...d}){const f=u.useId(),h=r??f,x=`${h}-hint`,m=`${h}-error`;return e.jsxs("div",{className:`ds-field${l?` ${l}`:""}`,"data-state":n?"error":void 0,"data-required":o?"":void 0,"data-disabled":a?"":void 0,style:p,...d,children:[s&&e.jsx("label",{className:"ds-field-label",htmlFor:h,children:s}),e.jsx("div",{className:"ds-field-control",children:i}),t&&!n&&e.jsx("p",{className:"ds-field-hint",id:x,children:t}),n&&e.jsx("p",{className:"ds-field-error",id:m,role:"alert",children:n})]})}function Ss({label:s,value:t,delta:n,size:o="m",inline:a=!1,className:r="",style:i,...l}){const p=n!=null&&n.startsWith("+")?"up":n!=null&&n.startsWith("-")?"down":"neutral";return e.jsxs("div",{className:["ds-stat",`ds-stat--${o}`,a&&"ds-stat--inline",r].filter(Boolean).join(" "),style:i,...l,children:[s&&e.jsx("span",{className:"ds-stat-label",children:s}),t!=null&&e.jsx("span",{className:"ds-stat-value",children:t}),n!=null&&e.jsx("span",{className:`ds-stat-delta ds-stat-delta--${p}`,children:n})]})}function As({children:s,separator:t="/","aria-label":n="Breadcrumb",className:o="",style:a,...r}){const i=u.Children.toArray(s).filter(Boolean);return e.jsx("nav",{className:`ds-breadcrumb${o?` ${o}`:""}`,"aria-label":n,style:a,...r,children:e.jsx("ol",{className:"ds-breadcrumb-list",children:i.map((l,p)=>e.jsxs("li",{className:"ds-breadcrumb-item",children:[l,p<i.length-1&&e.jsx("span",{className:"ds-breadcrumb-sep","aria-hidden":"true",children:t})]},p))})})}function Ds({page:s,total:t,onChange:n,siblings:o=1,"aria-label":a="Pagination",className:r="",style:i,...l}){const p=Is(s,t,o);return e.jsxs("nav",{className:`ds-pagination${r?` ${r}`:""}`,"aria-label":a,style:i,...l,children:[e.jsx("button",{className:"ds-pagination-arrow",onClick:()=>n==null?void 0:n(s-1),disabled:s<=1,"aria-label":"Previous page",children:e.jsx(g.ChevronLeft,{size:16})}),p.map((d,f)=>d==="…"?e.jsx("span",{className:"ds-pagination-gap","aria-hidden":"true",children:"…"},`gap-${f}`):e.jsx("button",{className:`ds-pagination-page${d===s?" ds-pagination-page--current":""}`,onClick:()=>d!==s&&(n==null?void 0:n(d)),"aria-current":d===s?"page":void 0,"aria-label":`Page ${d}`,children:d},d)),e.jsx("button",{className:"ds-pagination-arrow",onClick:()=>n==null?void 0:n(s+1),disabled:s>=t,"aria-label":"Next page",children:e.jsx(g.ChevronRight,{size:16})})]})}function Is(s,t,n){if(t<=7)return Array.from({length:t},(i,l)=>l+1);const o=Math.max(2,s-n),a=Math.min(t-1,s+n),r=[1];o>2&&r.push("…");for(let i=o;i<=a;i++)r.push(i);return a<t-1&&r.push("…"),r.push(t),r}const Bs=200;function Ps({children:s,title:t,onClose:n,side:o="right",...a}){const r=u.useRef(null),i=u.useId(),[l,p]=u.useState(!1),d=()=>{!n||l||(p(!0),setTimeout(()=>{p(!1),n()},Bs))};u.useEffect(()=>{const m=j=>{j.key==="Escape"&&d()},_=j=>{r.current&&!r.current.contains(j.target)&&d()};return document.addEventListener("keydown",m),document.addEventListener("mousedown",_),()=>{document.removeEventListener("keydown",m),document.removeEventListener("mousedown",_)}},[n,l]);const f=u.Children.toArray(s),h=f.find(m=>(m==null?void 0:m.type)===be),x=f.filter(m=>(m==null?void 0:m.type)!==be);return e.jsx("div",{className:["ds-drawer-overlay",l&&"ds-drawer-overlay--closing"].filter(Boolean).join(" "),...a,children:e.jsxs("aside",{className:["ds-drawer",l&&"ds-drawer--closing"].filter(Boolean).join(" "),"data-side":o,ref:r,role:"dialog","aria-modal":"true","aria-labelledby":t?i:void 0,children:[e.jsxs("header",{className:"ds-drawer-header",children:[t&&e.jsx("h3",{id:i,className:"ds-drawer-title",children:t}),n&&e.jsx("button",{className:"ds-drawer-close",onClick:d,"aria-label":"Close drawer",children:e.jsx(g.X,{size:D[2],strokeWidth:1.5})})]}),e.jsx("div",{className:"ds-drawer-body",children:x}),h]})})}function be({children:s}){return e.jsx("footer",{className:"ds-drawer-footer",children:s})}const Ms={info:g.Info,success:g.CheckCircle,warning:g.AlertTriangle,error:g.XCircle};function Ls({children:s,variant:t="info",action:n,onAction:o,onDismiss:a,role:r,...i}){const l=Ms[t],p=r||(t==="error"?"alert":"status");return e.jsxs("div",{className:`ds-banner ds-banner--${t}`,role:p,...i,children:[l&&e.jsx("span",{className:"ds-banner-icon","aria-hidden":"true",children:e.jsx(l,{size:D[2],strokeWidth:1.5})}),e.jsx("span",{className:"ds-banner-text",children:s}),n&&e.jsx("button",{type:"button",className:"ds-banner-action",onClick:o,children:n}),a&&e.jsx("button",{type:"button",className:"ds-banner-dismiss",onClick:a,"aria-label":"Dismiss",children:e.jsx(g.X,{size:D[2],strokeWidth:1.5})})]})}function Fs({trigger:s,items:t=[],open:n,onOpenChange:o,align:a="left",className:r="",style:i,...l}){const[p,d]=u.useState(!1),[f,h]=u.useState(!1),x=n!==void 0,m=x?n:p,_=u.useRef(null),j=u.useRef(null),S=u.useRef(null),R=u.useRef(null),[B,E]=u.useState({}),$=u.useRef(null),L=150,I=()=>{if(x)o==null||o(!1);else{if(f)return;h(!0),$.current=setTimeout(()=>{d(!1),h(!1)},L)}},V=()=>{const b=!m;x?o==null||o(b):b?(clearTimeout($.current),h(!1),d(!0)):I()},H=()=>{m||(x?o==null||o(!0):(clearTimeout($.current),h(!1),d(!0)))};u.useEffect(()=>()=>clearTimeout($.current),[]),u.useEffect(()=>{if(!m)return;const b=300,w=()=>{var X;const T=(X=_.current)==null?void 0:X.getBoundingClientRect();if(!T)return;const P=window.innerHeight-T.bottom,Y=P<b+8&&T.top>P;E(a==="right"?Y?{bottom:window.innerHeight-T.top+4,top:"auto",right:window.innerWidth-T.right}:{top:T.bottom+4,bottom:"auto",right:window.innerWidth-T.right}:Y?{bottom:window.innerHeight-T.top+4,top:"auto",left:T.left}:{top:T.bottom+4,bottom:"auto",left:T.left})};return w(),window.addEventListener("scroll",w,!0),window.addEventListener("resize",w),()=>{window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w)}},[m,a]);const z=()=>{var w;const b=(w=S.current)==null?void 0:w.querySelector('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"]), input, select, textarea');b==null||b.focus()};u.useEffect(()=>{if(!m)return;const b=T=>{var P,Y;!((P=_.current)!=null&&P.contains(T.target))&&!((Y=j.current)!=null&&Y.contains(T.target))&&I()},w=T=>{T.key==="Escape"&&(I(),z())};return document.addEventListener("mousedown",b),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",w)}},[m]),u.useEffect(()=>{if(!m||!R.current||!j.current)return;const b=N(),w=R.current==="last"?b[b.length-1]:b[0];w==null||w.focus(),R.current=null},[m]);const N=()=>j.current?[...j.current.querySelectorAll('button:not([disabled]), a[href]:not([aria-disabled="true"]), [tabindex]:not([tabindex="-1"])')]:[],O=b=>{var w,T;if(b.key==="ArrowDown")b.preventDefault(),m?(w=N()[0])==null||w.focus():(R.current="first",H());else if(b.key==="ArrowUp")if(b.preventDefault(),!m)R.current="last",H();else{const P=N();(T=P[P.length-1])==null||T.focus()}},q=b=>{var P,Y,X,k;const w=N(),T=w.findIndex(c=>c===document.activeElement);switch(b.key){case"ArrowDown":b.preventDefault(),(P=w[Math.min(T+1,w.length-1)])==null||P.focus();break;case"ArrowUp":b.preventDefault(),T<=0?z():(Y=w[T-1])==null||Y.focus();break;case"Home":b.preventDefault(),(X=w[0])==null||X.focus();break;case"End":b.preventDefault(),(k=w[w.length-1])==null||k.focus();break;case"Tab":I();break}},W=m&&e.jsx("div",{ref:j,role:"menu",className:["ds-dropdown__menu",`ds-dropdown__menu--${a}`,f&&"ds-dropdown__menu--closing"].filter(Boolean).join(" "),style:B,onKeyDown:q,children:t.map((b,w)=>{if(b.separator)return e.jsx("div",{className:"ds-dropdown__separator"},w);if(b.type==="section")return e.jsxs("div",{className:"ds-dropdown__section",children:[b.label&&e.jsx("div",{className:"ds-dropdown__section-label",children:b.label}),e.jsx("div",{className:"ds-dropdown__section-content",children:b.content})]},w);const T=!!b.href,P=T?"a":"button",Y=T?{href:b.disabled?void 0:b.href,"aria-disabled":b.disabled?"true":void 0}:{type:"button",disabled:b.disabled};return e.jsxs(P,{role:"menuitem",className:["ds-dropdown__item",b.danger&&"ds-dropdown__item--danger"].filter(Boolean).join(" "),...Y,onClick:()=>{var X;(X=b.onClick)==null||X.call(b),I()},children:[b.icon&&e.jsx("span",{className:"ds-dropdown__item-icon",children:b.icon}),e.jsx("span",{className:"ds-dropdown__item-label",children:b.label}),b.shortcut&&e.jsx("span",{className:"ds-dropdown__item-shortcut",children:b.shortcut})]},w)})});return e.jsxs("div",{ref:_,className:["ds-dropdown",r].filter(Boolean).join(" "),style:i,...l,children:[e.jsx("div",{ref:S,className:"ds-dropdown__trigger",onClick:V,onKeyDown:O,children:s}),typeof document<"u"&&ue.createPortal(W,document.body)]})}function zs({value:s=0,size:t="m",variant:n="default",showValue:o=!1,min:a=2,animate:r=!0}){const i=Math.min(100,Math.max(0,s)),l=Math.max(a,i),p=n==="auto"?i>=70?"success":i>=50?"warning":"danger":n;return e.jsxs("div",{className:["ds-progress",`ds-progress--${t}`,!r&&"ds-progress--instant"].filter(Boolean).join(" "),role:"progressbar","aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,children:[e.jsx("div",{className:"ds-progress__track",children:e.jsx("div",{className:`ds-progress__fill ds-progress__fill--${p}`,style:{width:`${l}%`}})}),o&&e.jsxs("span",{className:"ds-progress__value",children:[Math.round(i),"%"]})]})}const Cs=s=>1-Math.pow(1-s,3),Os=()=>typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function Be(s,{duration:t=600}={}){const[n,o]=u.useState(s),a=u.useRef(s),r=u.useRef(null);return u.useEffect(()=>{if(Os()){o(s),a.current=s;return}const i=a.current,l=s-i;if(l===0)return;let p=null;const d=f=>{p||(p=f);const h=Math.min((f-p)/t,1);o(i+l*Cs(h)),h<1?r.current=requestAnimationFrame(d):a.current=s};return r.current=requestAnimationFrame(d),()=>cancelAnimationFrame(r.current)},[s,t]),n}function Ws({value:s,duration:t=600,decimals:n=0,prefix:o="",suffix:a=""}){const i=Be(s,{duration:t}).toFixed(n);return`${o}${i}${a}`}function Pe({threshold:s=.1,rootMargin:t="0px",once:n=!1}={}){const o=u.useRef(null),[a,r]=u.useState(!1);return u.useEffect(()=>{const i=o.current;if(!i)return;const l=new IntersectionObserver(([p])=>{p.isIntersecting?(r(!0),n&&l.disconnect()):n||r(!1)},{threshold:s,rootMargin:t});return l.observe(i),()=>l.disconnect()},[s,t,n]),{ref:o,inView:a}}function Us({children:s,as:t="div",once:n=!1,threshold:o=.1,rootMargin:a="0px",onEnter:r,onLeave:i,...l}){const{ref:p,inView:d}=Pe({threshold:o,rootMargin:a,once:n}),f=u.useRef(!1);return u.useEffect(()=>{d&&!f.current&&(r==null||r()),!d&&f.current&&(i==null||i()),f.current=d},[d]),e.jsx(t,{ref:p,...l,children:typeof s=="function"?s(d):s})}const ke={default:g.Info,success:g.CheckCircle,warning:g.AlertTriangle,error:g.XCircle};let le=[];const _e=new Set;function Me(){_e.forEach(s=>s([...le]))}function Vs(s){le=[...le,s],Me()}function Hs(s){le=le.filter(t=>t.id!==s),Me()}function Ys(){const s=(t,n={})=>{Vs({id:`${Date.now()}-${Math.random()}`,message:t,type:"default",duration:4e3,...n})};return s.success=(t,n)=>s(t,{...n,type:"success"}),s.error=(t,n)=>s(t,{...n,type:"error"}),s.warning=(t,n)=>s(t,{...n,type:"warning"}),{toast:s}}function qs({data:s,onDismiss:t}){const[n,o]=u.useState(!1),a=u.useRef(null);u.useEffect(()=>(requestAnimationFrame(()=>o(!0)),s.duration>0&&(a.current=setTimeout(()=>r(),s.duration)),()=>clearTimeout(a.current)),[]);function r(){o(!1),setTimeout(()=>t(s.id),250)}const i=ke[s.type]??ke.default;return e.jsxs("div",{className:["ds-toast",`ds-toast--${s.type}`,n&&"ds-toast--visible"].filter(Boolean).join(" "),role:s.type==="error"?"alert":"status","aria-live":"polite",children:[e.jsx("div",{className:"ds-toast__icon",children:e.jsx(i,{size:D[3],strokeWidth:1.5})}),e.jsx("span",{className:"ds-toast__message",children:s.message}),e.jsx("button",{className:"ds-toast__close",onClick:r,"aria-label":"Закрыть",children:e.jsx(g.X,{size:D[3],strokeWidth:1.5})})]})}function Xs({position:s="bottom-right"}){const[t,n]=u.useState(()=>[...le]);return u.useEffect(()=>(_e.add(n),()=>_e.delete(n)),[]),!t.length||typeof document>"u"?null:ue.createPortal(e.jsx("div",{className:["ds-toast-container",`ds-toast-container--${s}`].join(" "),children:t.map(o=>e.jsx(qs,{data:o,onDismiss:Hs},o.id))}),document.body)}const Ks={running:e.jsx(ae,{size:"xs",variant:"info",children:"Running..."}),success:e.jsx(ae,{size:"xs",variant:"success",children:"Done"}),error:e.jsx(ae,{size:"xs",variant:"error",children:"Error"})};function Le({label:s,status:t="idle",icon:n,badge:o,defaultExpanded:a=!1,expanded:r,onToggle:i,children:l,className:p="",...d}){const f=t==="running",h=e.jsxs("span",{className:"ds-tool-card__title-row",children:[n&&e.jsx("span",{className:"ds-tool-card__icon",children:n}),e.jsx("span",{className:"ds-tool-card__label",children:s}),Ks[t],o]});return l?e.jsx("div",{className:["ds-tool-card",f&&"ds-tool-card--running",p].filter(Boolean).join(" "),...d,children:e.jsx(fe,{title:h,padding:"s",defaultExpanded:a,expanded:f?!1:r,onToggle:f?void 0:i,children:e.jsx("div",{className:"ds-tool-card__body",children:l})})}):e.jsx("div",{className:["ds-tool-card","ds-tool-card--bubble",p].filter(Boolean).join(" "),...d,children:h})}function Fe({text:s,size:t="xs",timeout:n=800,"aria-label":o="Copy to clipboard",...a}){const[r,i]=u.useState(!1),l=p=>{p.currentTarget.blur(),navigator.clipboard.writeText(s).then(()=>{i(!0),setTimeout(()=>i(!1),n)})};return e.jsx(ie,{variant:"ghost",size:t,state:r?"success":"idle",icon:e.jsx(g.Copy,{size:D[1],strokeWidth:1.5}),"aria-label":o,onClick:l,...a})}function Gs({content:s,streaming:t=!1,...n}){const[o,a]=u.useState(t);return u.useEffect(()=>{a(!!t)},[t]),e.jsx(fe,{expanded:o,onToggle:a,padding:"s",title:e.jsxs("div",{className:"ds-reasoning__title",children:[e.jsx(g.Brain,{size:D[1],strokeWidth:1.5,className:"ds-reasoning__icon"}),e.jsx(Ae,{secondary:!0,children:"Thinking"})]}),...n,children:e.jsxs(ve,{secondary:!0,style:{whiteSpace:"pre-wrap"},children:[s,t&&e.jsx("span",{className:"ds-cursor ds-cursor--line"})]})})}function Js({count:s,current:t=0,done:n=[],onChange:o,showCounter:a=!0,className:r="","aria-label":i="Steps",...l}){return e.jsxs("div",{className:["ds-step-indicator",r].filter(Boolean).join(" "),...l,children:[e.jsx("div",{className:"ds-step-indicator__dots",role:"tablist","aria-label":i,children:Array.from({length:s},(p,d)=>{const f=d===t,h=n.includes(d)&&!f,x=o&&(d<=t||n.includes(d)),m=["ds-step-indicator__dot",f&&"ds-step-indicator__dot--active",h&&"ds-step-indicator__dot--done"].filter(Boolean).join(" ");return e.jsx("button",{type:"button",className:m,role:"tab","aria-selected":f,"aria-label":`Step ${d+1}`,disabled:!x||d===t,onClick:()=>o==null?void 0:o(d),children:h?e.jsx(g.Check,{size:8,strokeWidth:3}):null},d)})}),a&&e.jsxs(ve,{secondary:!0,className:"ds-step-indicator__counter",children:[t+1," / ",s]})]})}function Zs({content:s,isStreaming:t=!1,cursor:n="line",onChunk:o,className:a="",...r}){const i=u.useRef(s);return u.useEffect(()=>{s!==i.current&&(o==null||o(s),i.current=s)},[s,o]),e.jsxs("span",{className:["ds-streaming-text",a].filter(Boolean).join(" "),...r,children:[s,t&&n!=="none"&&e.jsx("span",{className:`ds-cursor ds-cursor--${n}`,"aria-hidden":"true"})]})}function Qs({role:s="assistant",header:t,footer:n,attachments:o,isStreaming:a=!1,children:r,className:i="",...l}){const p=["ds-chat-message",`ds-chat-message--${s}`,a&&"ds-chat-message--streaming",i].filter(Boolean).join(" ");return s==="system"?e.jsx("div",{className:p,...l,children:e.jsx("span",{className:"ds-chat-message__system-label",children:r})}):s==="user"?e.jsxs("div",{className:p,...l,children:[o&&e.jsx("div",{className:"ds-chat-message__attachments",children:o}),e.jsx("div",{className:"ds-chat-message__bubble",children:r}),n&&e.jsx("div",{className:"ds-chat-message__footer",children:n})]}):e.jsxs("div",{className:p,...l,children:[t&&e.jsx("div",{className:"ds-chat-message__header",children:t}),o&&e.jsx("div",{className:"ds-chat-message__attachments",children:o}),e.jsx("div",{className:"ds-chat-message__body",children:r}),n&&e.jsx("div",{className:"ds-chat-message__footer",children:n})]})}function et(s,{containerRef:t,smartPause:n=!0}={}){const o=u.useRef(!1),a=u.useRef(0);u.useEffect(()=>{const r=t==null?void 0:t.current;if(!r)return;const i=()=>{const l=r.scrollHeight-r.scrollTop-r.clientHeight<64;!l&&r.scrollTop<a.current&&(o.current=!0),l&&(o.current=!1),a.current=r.scrollTop};return r.addEventListener("scroll",i,{passive:!0}),()=>r.removeEventListener("scroll",i)},[t]),u.useEffect(()=>{const r=t==null?void 0:t.current;r&&(n&&o.current||(r.scrollTop=r.scrollHeight))},s)}function ze({prompts:s,enabled:t,typingSpeed:n=38,erasingSpeed:o=18,holdTime:a=2200,betweenTime:r=380,manualPauseMs:i=5e3}){const[l,p]=u.useState(0),[d,f]=u.useState(""),h=u.useRef("typing"),x=u.useRef(0),m=u.useRef(0),_=u.useRef(null),j=u.useRef(0);u.useEffect(()=>{m.current=l},[l]),u.useEffect(()=>{if(_.current&&(clearTimeout(_.current),_.current=null),!t||s.length===0){f(""),x.current=0,h.current="typing";return}const $=()=>{const L=Date.now();if(j.current>L){_.current=setTimeout($,j.current-L);return}const I=s[m.current%s.length]??"";h.current==="typing"?(x.current+=1,f(I.slice(0,x.current)),x.current>=I.length?(h.current="holding",_.current=setTimeout($,a)):_.current=setTimeout($,n+Math.random()*28)):h.current==="holding"?(h.current="erasing",_.current=setTimeout($,o)):(x.current=Math.max(0,x.current-1),f(I.slice(0,x.current)),x.current<=0?(h.current="typing",m.current=(m.current+1)%s.length,p(m.current),_.current=setTimeout($,r)):_.current=setTimeout($,o))};return _.current=setTimeout($,260),()=>{_.current&&clearTimeout(_.current)}},[t,s,n,o,a,r]);const S=$=>{if(s.length===0)return;const L=($%s.length+s.length)%s.length,I=s[L];m.current=L,x.current=I.length,h.current="holding",j.current=Date.now()+i,p(L),f(I)},R=()=>S(m.current+1),B=()=>S(m.current-1),E=s[l%s.length]??"";return{displayed:d,currentPrompt:E,index:l,next:R,prev:B}}let st=0;function tt({value:s="",onChange:t,onSubmit:n,onStop:o,onKeyDown:a,loading:r=!1,disabled:i=!1,placeholder:l="Let's get things done...",animatedPlaceholders:p,attachments:d,images:f,onAttachFiles:h,onAttachImages:x,onRemoveAttachment:m,onRemoveImage:_,acceptImage:j,acceptFile:S,maxImages:R,maxImageSize:B,leftSlot:E,rightSlot:$,className:L="",...I}){const V=u.useRef(null),H=u.useRef(null),z=u.useRef(0),[N,O]=u.useState(!1),[q,W]=u.useState([]),b=v=>{const A=++st;W(U=>[...U,{id:A,msg:v}]),setTimeout(()=>W(U=>U.filter(K=>K.id!==A)),6e3)},w=v=>W(A=>A.filter(U=>U.id!==v)),T=v=>v.type.startsWith("image/"),P=()=>!0,Y=j??T,X=S??P,k=v=>{const A=[],U=[],K=[],G=[];let Z=0,re=R!=null?R-((f==null?void 0:f.length)??0):1/0;for(const Q of v)Y(Q)?B&&Q.size>B?K.push(Q.name):re>0?(A.push(Q),re--):Z++:X(Q)?U.push(Q):G.push(Q.name);return{imageFiles:A,docFiles:U,tooLarge:K,skipped:G,limitExceeded:Z}},c=v=>{const{imageFiles:A,docFiles:U,tooLarge:K,skipped:G,limitExceeded:Z}=k(v);K.length&&b(`File${K.length>1?"s":""} too large${B?` (max ${B/1024/1024}MB)`:""}: ${K.join(", ")}`),G.length&&b(`Skipped unsupported file${G.length>1?"s":""}: ${G.join(", ")}`),Z&&b(`Max ${R} images per message`),x&&A.length&&x(A);const re=U.concat(x?[]:A);h&&re.length&&h(re)};u.useEffect(()=>{const v=H.current;v&&(v.style.height="auto",v.style.height=`${Math.min(v.scrollHeight,200)}px`)},[s]),u.useEffect(()=>{const v=A=>{var K,G,Z;if(r||i)return;const U=(K=A.target)==null?void 0:K.tagName;U==="INPUT"||U==="TEXTAREA"||U==="SELECT"||(G=A.target)!=null&&G.isContentEditable||A.ctrlKey||A.metaKey||A.altKey||A.key.length!==1&&A.key!=="Backspace"&&A.key!=="Delete"||(Z=H.current)==null||Z.focus()};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[r,i]);const y=v=>{v.preventDefault(),z.current++,v.dataTransfer.types.includes("Files")&&O(!0)},M=v=>{v.preventDefault(),z.current--,z.current===0&&O(!1)},F=v=>v.preventDefault(),ee=v=>{v.preventDefault(),z.current=0,O(!1);const A=Array.from(v.dataTransfer.files);A.length&&c(A)},te=v=>{const A=Array.from(v.target.files||[]);V.current&&(V.current.value=""),A.length&&c(A)},C=v=>{var Q;if(!x)return;const A=(Q=v.clipboardData)==null?void 0:Q.items;if(!A)return;const U=[];for(const We of A){const we=We.getAsFile();we&&U.push(we)}if(U.length===0)return;const{imageFiles:K,tooLarge:G,skipped:Z,limitExceeded:re}=k(U);G.length&&b(`File${G.length>1?"s":""} too large: ${G.join(", ")}`),Z.length&&b(`Skipped unsupported file${Z.length>1?"s":""}: ${Z.join(", ")}`),re&&b(`Max ${R} images per message`),K.length&&(v.preventDefault(),x(K))},J=!r&&!i&&!!(p!=null&&p.length)&&s.length===0,ne=ze({prompts:p??[],enabled:J}),me=v=>{if(J){if(v.key==="ArrowDown"||v.key==="ArrowRight"){v.preventDefault(),ne.next();return}if(v.key==="ArrowUp"||v.key==="ArrowLeft"){v.preventDefault(),ne.prev();return}if(v.key==="Tab"&&!v.shiftKey){v.preventDefault(),t==null||t(ne.currentPrompt);return}}a==null||a(v)},Oe=(s.trim()||(f==null?void 0:f.length)>0||(d==null?void 0:d.length)>0)&&!i,Ne=h||x;return e.jsxs("div",{className:["ds-prompt-input",L].filter(Boolean).join(" "),...I,children:[Ne&&e.jsx("input",{ref:V,type:"file",multiple:!0,accept:"*/*",className:"ds-prompt-input__file-input",onChange:te}),e.jsxs("div",{className:["ds-prompt-input__box",N&&"ds-prompt-input__box--dragging"].filter(Boolean).join(" "),onDragEnter:y,onDragLeave:M,onDragOver:F,onDrop:ee,children:[N&&e.jsx("div",{className:"ds-prompt-input__drag-overlay",children:"Drop files here"}),e.jsx("textarea",{ref:H,value:s,onChange:v=>t==null?void 0:t(v.target.value),onKeyDown:me,onPaste:C,placeholder:J?"":l,disabled:r||i,rows:1,className:["ds-prompt-input__textarea",J&&"ds-prompt-input__textarea--anim"].filter(Boolean).join(" ")}),J&&e.jsxs("div",{className:"ds-prompt-input__anim","aria-hidden":"true",children:[e.jsx("span",{className:"ds-prompt-input__anim-text",children:ne.displayed}),e.jsx("span",{className:"ds-prompt-input__anim-cursor"})]}),f&&f.length>0&&e.jsx("div",{className:"ds-prompt-input__images",children:f.map((v,A)=>e.jsxs("div",{className:"ds-prompt-input__image-thumb",children:[e.jsx("img",{src:v.preview,alt:""}),e.jsx("button",{className:"ds-prompt-input__image-remove",onClick:()=>_==null?void 0:_(A),"aria-label":"Remove image",type:"button",children:e.jsx(g.X,{size:12,strokeWidth:2})})]},A))}),q.length>0&&e.jsx("div",{className:"ds-prompt-input__warnings",children:q.map(v=>e.jsxs("div",{className:"ds-prompt-input__warning",role:"alert",children:[e.jsx("span",{children:v.msg}),e.jsx("button",{type:"button",className:"ds-prompt-input__warning-close",onClick:()=>w(v.id),"aria-label":"Dismiss",children:e.jsx(g.X,{size:D[1],strokeWidth:1.5})})]},v.id))}),d&&d.length>0&&e.jsx("div",{className:"ds-prompt-input__attachments",children:d.map((v,A)=>e.jsx(ae,{size:"xs",children:e.jsxs("span",{className:"ds-prompt-input__badge-content",children:[v.uploading?e.jsx(g.Loader,{size:D[1],strokeWidth:1.5,className:"spin"}):e.jsx(g.Paperclip,{size:D[1],strokeWidth:1.5}),v.filename,v.uploading?e.jsx("span",{className:"ds-prompt-input__uploading",children:"Uploading..."}):e.jsx("button",{type:"button",className:"ds-prompt-input__remove-btn",onClick:()=>m==null?void 0:m(A),children:e.jsx(g.X,{size:D[1],strokeWidth:1.5})})]})},A))}),e.jsxs("div",{className:"ds-prompt-input__toolbar",children:[Ne&&e.jsx(ie,{variant:"ghost",size:"xs",icon:e.jsx(g.Paperclip,{size:D[2],strokeWidth:1.5}),"aria-label":"Attach files",onClick:()=>{var v;return(v=V.current)==null?void 0:v.click()}}),E,$,e.jsx("div",{className:"ds-prompt-input__spacer"}),r?e.jsx(ie,{variant:"primary",size:"xs",icon:e.jsx(g.Square,{size:D[2],strokeWidth:1.5}),onClick:o,"aria-label":"Stop"}):e.jsx(ie,{variant:"primary",size:"xs",icon:e.jsx(g.ArrowUp,{size:D[2],strokeWidth:1.5}),onClick:n,disabled:!Oe,"aria-label":"Send"})]})]})]})}const Ee={fast:0,standard:1,premium:2},Te={fast:"data-5",standard:"data-3",premium:"data-6"};function nt({models:s=[],value:t,onChange:n,size:o="xs",minTier:a,showAutoOption:r=!1,groupByTier:i=!0,className:l="",...p}){const[d,f]=u.useState(!1),h=u.useRef(null),x=u.useRef(null),m=u.useRef(null),[_,j]=u.useState({}),S=s.filter(N=>!a||N.name==="auto"?!0:(Ee[N.tier]??1)>=(Ee[a]??1)),R=S.find(N=>N.name==="auto"),B=S.filter(N=>N.name!=="auto"),E=s.find(N=>N.name===t),L=new Set(B.map(N=>N.tier).filter(Boolean)).size>1;u.useEffect(()=>{if(!d)return;const N=320,O=()=>{var P;const b=(P=x.current)==null?void 0:P.getBoundingClientRect();if(!b)return;const w=window.innerHeight-b.bottom,T=w<N+8&&b.top>w;j({position:"fixed",zIndex:"var(--z-dropdown, 500)",left:b.left,...T?{bottom:window.innerHeight-b.top+4,top:"auto"}:{top:b.bottom+4,bottom:"auto"}})};O(),window.addEventListener("scroll",O,!0),window.addEventListener("resize",O);const q=b=>{var w,T;!((w=h.current)!=null&&w.contains(b.target))&&!((T=m.current)!=null&&T.contains(b.target))&&f(!1)},W=b=>{b.key==="Escape"&&f(!1)};return document.addEventListener("mousedown",q),document.addEventListener("keydown",W),()=>{window.removeEventListener("scroll",O,!0),window.removeEventListener("resize",O),document.removeEventListener("mousedown",q),document.removeEventListener("keydown",W)}},[d]);const I=N=>{n==null||n(N),f(!1)},V=N=>e.jsxs("button",{type:"button",className:["ds-model-picker__item",N.name===t&&"ds-model-picker__item--active"].filter(Boolean).join(" "),onClick:()=>I(N.name),children:[N.icon?e.jsx("span",{className:"ds-model-picker__item-icon",children:N.icon}):e.jsx(g.Cpu,{size:12,strokeWidth:1.5,className:"ds-model-picker__item-icon"}),e.jsx("span",{className:"ds-model-picker__item-name",children:N.displayName||N.name}),L&&N.tier&&e.jsx(ae,{size:"xs",variant:Te[N.tier]||"default",children:N.tier})]},N.name),H=()=>!i||!L?B.map(V):["fast","standard","premium"].flatMap(N=>{const O=B.filter(q=>q.tier===N);return O.length?[e.jsx("div",{className:"ds-model-picker__group-label","data-tier":N,children:N.charAt(0).toUpperCase()+N.slice(1)},`lbl-${N}`),...O.map(V)]:[]}),z=d&&e.jsxs("div",{ref:m,className:"ds-model-picker__menu",style:_,children:[r&&R&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:["ds-model-picker__item","ds-model-picker__item--auto",t==="auto"&&"ds-model-picker__item--active"].filter(Boolean).join(" "),onClick:()=>I("auto"),children:[e.jsx(g.Zap,{size:12,strokeWidth:1.5,className:"ds-model-picker__item-icon"}),e.jsx("span",{className:"ds-model-picker__item-name",children:"Auto (smart routing)"})]}),B.length>0&&e.jsx("div",{className:"ds-model-picker__separator"})]}),H()]});return e.jsxs("div",{ref:h,className:["ds-model-picker",l].filter(Boolean).join(" "),...p,children:[e.jsxs("button",{ref:x,type:"button",className:"ds-model-picker__trigger",onClick:()=>f(N=>!N),"aria-haspopup":"listbox","aria-expanded":d,children:[E!=null&&E.icon?e.jsx("span",{children:E.icon}):e.jsx(g.Cpu,{size:12,strokeWidth:1.5}),e.jsx("span",{className:"ds-model-picker__trigger-name",children:(E==null?void 0:E.displayName)||(E==null?void 0:E.name)||t}),L&&(E==null?void 0:E.tier)&&e.jsx(ae,{size:"xs",variant:Te[E.tier]||"default",children:E.tier})]}),typeof document<"u"&&ue.createPortal(z,document.body)]})}const rt=({filename:s,pages:t})=>e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"var(--space-2)",minWidth:0},children:[e.jsx("span",{className:"ds-sources-panel__filename",children:s}),t.length>0&&e.jsx("span",{className:"ds-sources-panel__pages",children:je(t)})]});function je(s){return s!=null&&s.length?"p. "+s.join(", "):null}function at(s){const t=new Map;for(const n of s)t.has(n.filename)||t.set(n.filename,{filename:n.filename,url:n.url,items:[]}),t.get(n.filename).items.push(n);return[...t.values()]}function ot({sources:s=[],layout:t="list",title:n="Sources",maxVisible:o=5,onSourceClick:a}){const[r,i]=u.useState(!1),l=at(s),p=l.length>o,d=r?l:l.slice(0,o),f=s.some(x=>x.snippet),h=["ds-sources-panel",t==="compact"&&"ds-sources-panel--compact"].filter(Boolean).join(" ");return t==="compact"?e.jsxs("div",{className:h,children:[d.map(x=>{const m=x.items.map(j=>j.page).filter(Boolean),_=!!a;return e.jsxs("div",{className:`ds-sources-panel__compact-row${_?" ds-sources-panel__compact-row--clickable":""}`,onClick:_?()=>a(x.items[0]):void 0,children:[e.jsx(g.FileText,{size:D[1],strokeWidth:1.5,className:"ds-sources-panel__compact-icon"}),e.jsx("span",{className:"ds-sources-panel__filename",children:x.filename}),m.length>0&&e.jsx("span",{className:"ds-sources-panel__pages",children:je(m)})]},x.filename)}),p&&!r&&e.jsxs("button",{className:"ds-sources-panel__more",onClick:()=>i(!0),children:["+",l.length-o," more sources"]})]}):e.jsxs("div",{className:h,children:[n&&e.jsx("div",{className:"ds-sources-panel__title",children:n}),d.map(x=>{const m=x.items.map(j=>j.page).filter(Boolean),_=!!a;return f?e.jsx(fe,{title:e.jsx(rt,{filename:x.filename,pages:m}),padding:"s",children:x.items.map((j,S)=>e.jsx("div",{className:`ds-sources-panel__snippet${_?" ds-sources-panel__snippet--clickable":""}`,onClick:_?()=>a(j):void 0,children:j.snippet??`p. ${j.page}`},S))},x.filename):e.jsxs("div",{className:`ds-sources-panel__row${_?" ds-sources-panel__row--clickable":""}`,onClick:_?()=>a(x.items[0]):void 0,children:[e.jsx("span",{className:"ds-sources-panel__filename",children:x.filename}),m.length>0&&e.jsx("span",{className:"ds-sources-panel__pages",children:je(m)})]},x.filename)}),p&&!r&&e.jsxs("button",{className:"ds-sources-panel__more",onClick:()=>i(!0),children:["+",l.length-o," more sources"]})]})}function Re(s){return s>=1e6?(s/1e6).toFixed(1).replace(/\.0$/,"")+"M":s>=1e3?(s/1e3).toFixed(1).replace(/\.0$/,"")+"K":String(s)}function it({used:s,limit:t,size:n="s",showCount:o=!0,showPercent:a=!1,warningThreshold:r=.8,errorThreshold:i=1}){const l=t>0?s/t:0,p=Math.min(l*100,100),d=l>=i?"error":l>=r?"warning":"normal";return e.jsxs("div",{className:`ds-token-counter ds-token-counter--${n}`,role:"meter","aria-valuenow":s,"aria-valuemax":t,children:[e.jsx("div",{className:"ds-token-counter__track",children:e.jsx("div",{className:`ds-token-counter__fill ds-token-counter__fill--${d}`,style:{width:`${p}%`}})}),(o||a)&&e.jsxs("div",{className:`ds-token-counter__label ds-token-counter__label--${d}`,children:[o&&e.jsxs("span",{children:[Re(s)," / ",Re(t)," tokens"]}),a&&e.jsxs("span",{children:[Math.round(l*100),"%"]})]})]})}const $e=5;function lt(s){return s<.34?"low":s<.67?"medium":"high"}function ct({value:s=0,size:t="xs",showLabel:n="none",layout:o="inline"}){const a=Math.max(0,Math.min(1,s)),r=Math.round(a*$e),i=lt(a);return e.jsxs("div",{className:["ds-confidence-bar",`ds-confidence-bar--${t}`,`ds-confidence-bar--${i}`,o==="block"&&"ds-confidence-bar--block"].filter(Boolean).join(" "),children:[e.jsx("div",{className:"ds-confidence-bar__segments","aria-hidden":"true",children:Array.from({length:$e},(l,p)=>e.jsx("div",{className:`ds-confidence-bar__seg${p<r?" ds-confidence-bar__seg--filled":""}`},p))}),n==="text"&&e.jsx("span",{className:"ds-confidence-bar__label",children:i})]})}const dt={add:"+",remove:"-",context:" "};function pe({line:s,lineNumbers:t}){return e.jsxs("div",{className:`ds-diff-view__line ds-diff-view__line--${s.type}`,children:[t&&s.lineNo!=null&&e.jsx("span",{className:"ds-diff-view__lineno",children:s.lineNo}),e.jsx("span",{className:"ds-diff-view__prefix",children:dt[s.type]}),e.jsx("span",{className:"ds-diff-view__text",children:s.text})]})}function ut({lines:s=[],layout:t="inline",wordWrap:n=!1,lineNumbers:o=!0,maxHeight:a,title:r}){const i=["ds-diff-view",`ds-diff-view--${t}`,n&&"ds-diff-view--wrap"].filter(Boolean).join(" "),l=a?{maxHeight:a,overflowY:"auto"}:void 0;if(t==="split"){const p=s.filter(f=>f.type==="remove"||f.type==="context"),d=s.filter(f=>f.type==="add"||f.type==="context");return e.jsxs("div",{className:i,children:[r&&e.jsx("div",{className:"ds-diff-view__title",children:r}),e.jsxs("div",{className:"ds-diff-view__body",style:l,children:[e.jsx("div",{className:"ds-diff-view__split-col",children:p.map((f,h)=>e.jsx(pe,{line:f,lineNumbers:o},h))}),e.jsx("div",{className:"ds-diff-view__split-col",children:d.map((f,h)=>e.jsx(pe,{line:f,lineNumbers:o},h))})]})]})}return e.jsxs("div",{className:i,children:[r&&e.jsx("div",{className:"ds-diff-view__title",children:r}),e.jsx("div",{className:"ds-diff-view__body",style:l,children:s.map((p,d)=>e.jsx(pe,{line:p,lineNumbers:o},d))})]})}function Ce({value:s="idle",onLike:t,onDislike:n,className:o="",...a}){const r=s!=="idle";return e.jsxs("div",{className:["ds-message-feedback",r&&"ds-message-feedback--voted",o].filter(Boolean).join(" "),...a,children:[(!r||s==="liked")&&e.jsx("button",{className:["ds-message-feedback__btn",s==="liked"&&"ds-message-feedback__btn--liked"].filter(Boolean).join(" "),onClick:t,disabled:r,"aria-label":"Like","aria-pressed":s==="liked",children:e.jsx(g.ThumbsUp,{size:D[1],strokeWidth:1.5,fill:s==="liked"?"currentColor":"none"})}),(!r||s==="disliked")&&e.jsx("button",{className:["ds-message-feedback__btn",s==="disliked"&&"ds-message-feedback__btn--disliked"].filter(Boolean).join(" "),onClick:n,disabled:r,"aria-label":"Dislike","aria-pressed":s==="disliked",children:e.jsx(g.ThumbsDown,{size:D[1],strokeWidth:1.5,fill:s==="disliked"?"currentColor":"none"})})]})}function ft(s){const t=s instanceof Date?s:new Date(s);if(isNaN(t))return null;const n=new Date,o=t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),a=new Date(n.getFullYear(),n.getMonth(),n.getDate()),r=new Date(a-864e5);if(t>=a)return o;if(t>=r)return`Yesterday ${o}`;const i=t.getDate(),l=t.toLocaleString([],{month:"short"});return`${i} ${l} ${o}`}function mt({role:s="assistant",text:t,timestamp:n,feedbackValue:o="idle",onLike:a,onDislike:r,className:i="",...l}){const p=s==="assistant"&&(a||r),d=!!t,f=n?ft(n):null;return!p&&!d&&!f?null:e.jsxs("div",{className:["ds-message-footer",`ds-message-footer--${s}`,i].filter(Boolean).join(" "),...l,children:[s==="user"&&f&&e.jsx("span",{className:"ds-message-footer__timestamp ds-message-action",children:f}),p&&e.jsx(Ce,{className:"ds-message-action",value:o,onLike:a,onDislike:r}),d&&e.jsx(Fe,{className:"ds-message-action",text:t}),s==="assistant"&&f&&e.jsx("span",{className:"ds-message-footer__timestamp ds-message-action",children:f})]})}function pt({label:s,className:t="",...n}){return e.jsxs("span",{className:["ds-thinking-dot",t].filter(Boolean).join(" "),...n,children:[e.jsx("span",{className:"ds-thinking-dot__pulse"}),s&&e.jsx("span",{className:"ds-thinking-dot__label",children:s})]})}exports.Accordion=fe;exports.Alert=ns;exports.AnimatedNumber=Ws;exports.Avatar=vs;exports.Badge=ae;exports.Banner=Ls;exports.Breadcrumb=As;exports.Button=ie;exports.Card=Ge;exports.ChatMessage=Qs;exports.Checkbox=hs;exports.Code=os;exports.CodeAccordion=De;exports.ConfidenceBar=ct;exports.CopyButton=Fe;exports.DiffView=ut;exports.Drawer=Ps;exports.DrawerFooter=be;exports.Dropdown=Fs;exports.EmptyState=Rs;exports.FormField=$s;exports.H1=Je;exports.H2=Ze;exports.H3=Qe;exports.H4=es;exports.InView=Us;exports.Input=Ye;exports.Link=is;exports.MessageFeedback=Ce;exports.MessageFooter=mt;exports.Modal=as;exports.ModalFooter=xe;exports.ModelPicker=nt;exports.P1=ss;exports.P2=Ae;exports.P3=ve;exports.Pagination=Ds;exports.ProgressBar=zs;exports.PromptInput=tt;exports.Radio=xs;exports.ReasoningBlock=Gs;exports.SegmentedControl=ds;exports.Select=Xe;exports.Skeleton=Ie;exports.SourcesPanel=ot;exports.Spinner=Se;exports.Stat=Ss;exports.StepIndicator=Js;exports.Stepper=Ke;exports.StreamingText=Zs;exports.Tab=cs;exports.Table=Ns;exports.TableBody=gs;exports.TableHead=ws;exports.TableRow=ys;exports.TableSubheaderRow=ks;exports.Tabs=ls;exports.Td=Ts;exports.Textarea=qe;exports.Th=Es;exports.ThinkingDot=pt;exports.ToastContainer=Xs;exports.Toggle=ps;exports.TokenCounter=it;exports.ToolCallBubble=Le;exports.ToolCallCard=Le;exports.Tooltip=ms;exports.iconSizes=D;exports.useAnimatedNumber=Be;exports.useAnimatedPlaceholder=ze;exports.useInView=Pe;exports.useStreamScroll=et;exports.useToast=Ys;
|
|
22
|
+
<%s key={someKey} {...props} />`,z,F,J,F),k[F+z]=!0)}if(F=null,M!==void 0&&(n(M),F=""+M),i(y)&&(n(y.key),F=""+y.key),"key"in y){M={};for(var ne in y)ne!=="key"&&(M[ne]=y[ne])}else M=y;return F&&l(M,typeof c=="function"?c.displayName||c.name||"Unknown":c),d(c,F,M,a(),ee,te)}function h(c){x(c)?c._store&&(c._store.validated=1):typeof c=="object"&&c!==null&&c.$$typeof===C&&(c._payload.status==="fulfilled"?x(c._payload.value)&&c._payload.value._store&&(c._payload.value._store.validated=1):c._store&&(c._store.validated=1))}function x(c){return typeof c=="object"&&c!==null&&c.$$typeof===j}var p=u,j=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),$=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),R=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),V=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),O=Symbol.for("react.client.reference"),q=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=Object.prototype.hasOwnProperty,b=Array.isArray,N=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function(c){return c()}};var T,P={},Y=p.react_stack_bottom_frame.bind(p,r)(),X=N(o(r)),k={};de.Fragment=S,de.jsx=function(c,y,M){var z=1e4>q.recentlyCreatedOwnerStacks++;return f(c,y,M,!1,z?Error("react-stack-top-frame"):Y,z?N(o(c)):X)},de.jsxs=function(c,y,M){var z=1e4>q.recentlyCreatedOwnerStacks++;return f(c,y,M,!0,z?Error("react-stack-top-frame"):Y,z?N(o(c)):X)}}()),de}process.env.NODE_ENV==="production"?he.exports=Ue():he.exports=Ve();var e=he.exports;function Se({size:s="m",color:t="default",className:n="",...o}){return e.jsx("span",{className:["ds-spinner",`ds-spinner--${s}`,`ds-spinner--${t}`,n].filter(Boolean).join(" "),role:"status","aria-label":"Loading",...o})}const He={xs:12,s:14,m:16,l:20};function ie({children:s,variant:t="primary",size:n="m",fullWidth:o=!1,icon:a,disabled:r=!1,state:i="idle",onClick:l,type:m="button",href:d,"aria-label":f,className:h="",...x}){const p=a&&!s,j=i==="loading",_=i==="success",S=i==="error",$=j||_||S,B=n==="xs"?"s":"m",E=t==="danger"?"on-accent":"default",R=He[n]??16,L=j?e.jsx(Se,{size:B,color:E}):_?e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:e.jsx(g.Check,{size:R,strokeWidth:2.5})}):S?e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:e.jsx(g.X,{size:R,strokeWidth:2.5})}):null,I=["ds-button",`ds-button--${t}`,`ds-button--${n}`,o&&"ds-button--full",p&&"ds-button--icon-only",h].filter(Boolean).join(" "),V=i!=="idle"?i:void 0,H=e.jsxs(e.Fragment,{children:[$?L:a&&e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:a}),s]});if(d){const C=w=>{if(r||j){w.preventDefault();return}w.metaKey||w.ctrlKey||w.button===1||(w.preventDefault(),l==null||l(w))};return e.jsx("a",{className:I,href:r||j?void 0:d,onClick:C,"aria-label":f,"aria-disabled":r||j?"true":void 0,"aria-busy":j?"true":void 0,"data-state":V,...x,children:H})}return e.jsx("button",{type:m,className:I,disabled:r,onClick:j?void 0:l,"aria-label":f,"aria-busy":j?"true":void 0,"data-state":V,...x,children:H})}function Ye({label:s,error:t,hint:n,fullWidth:o=!0,icon:a,iconRight:r,onIconRightClick:i,size:l="m",disabled:m,id:d,...f}){const h=d||`input-${u.useId()}`,x=n?`${h}-hint`:void 0,p=t?`${h}-error`:void 0,j=p||x;return e.jsxs("div",{className:`ds-input-wrapper ${o?"ds-input-wrapper--full":""} ${m?"ds-input-wrapper--disabled":""} ${t?"ds-input-wrapper--error":""}`,children:[s&&e.jsx("label",{className:"ds-input-label",htmlFor:h,children:s}),e.jsxs("div",{className:"ds-input-container",children:[a&&e.jsx("span",{className:`ds-input-icon ds-input-icon--${l}`,"aria-hidden":"true",children:a}),e.jsx("input",{id:h,className:`ds-input ds-input--${l} ${a?"ds-input--with-icon":""} ${r?"ds-input--with-icon-right":""} ${t?"ds-input--error":""}`,disabled:m,"aria-invalid":t?"true":"false","aria-describedby":j,...f}),r&&e.jsx("button",{type:"button",className:`ds-input-icon-right ds-input-icon-right--${l}`,onClick:i,tabIndex:-1,"aria-label":"Toggle visibility",children:r})]}),n&&!t&&e.jsx("span",{id:x,className:"ds-input-hint",children:n}),e.jsx("div",{className:"ds-input-error-wrap",children:e.jsx("div",{className:"ds-input-error-inner",children:t&&e.jsx("span",{id:p,className:"ds-input-error",role:"alert",children:t})})})]})}function qe({label:s,error:t,hint:n,fullWidth:o=!0,size:a="m",disabled:r,id:i,resize:l=!0,rows:m=3,...d}){const f=i||`textarea-${u.useId()}`,h=n?`${f}-hint`:void 0,x=t?`${f}-error`:void 0,p=x||h;return e.jsxs("div",{className:`ds-textarea-wrapper ${o?"ds-textarea-wrapper--full":""} ${r?"ds-textarea-wrapper--disabled":""}`,children:[s&&e.jsx("label",{className:"ds-textarea-label",htmlFor:f,children:s}),e.jsx("textarea",{id:f,className:`ds-textarea ds-textarea--${a} ${t?"ds-textarea--error":""} ${l?"":"ds-textarea--no-resize"}`,disabled:r,"aria-invalid":t?"true":"false","aria-describedby":p,rows:m,...d}),n&&!t&&e.jsx("span",{id:h,className:"ds-textarea-hint",children:n}),t&&e.jsx("span",{id:x,className:"ds-textarea-error",role:"alert",children:t})]})}function Xe({label:s,value:t,onChange:n,options:o=[],placeholder:a="Select option",error:r,fullWidth:i=!0,size:l="m",disabled:m=!1,id:d,...f}){const[h,x]=u.useState(!1),[p,j]=u.useState(!1),[_,S]=u.useState({}),[$,B]=u.useState("down"),[E,R]=u.useState(-1),L=u.useRef(null),I=u.useRef(null),V=u.useRef(null),H=u.useRef(null),C=d||`select-${u.useId()}`,w=`${C}-label`,O=r?`${C}-error`:void 0,q=150,W=(k=!1)=>{p||(j(!0),R(-1),H.current=setTimeout(()=>{var c;x(!1),j(!1),k&&((c=V.current)==null||c.focus())},q))},b=k=>{clearTimeout(H.current),j(!1);const c=k!==void 0?k:Math.max(o.findIndex(y=>y.value===t),0);R(c),x(!0)};u.useEffect(()=>()=>clearTimeout(H.current),[]);const N=()=>{var te;const k=(te=L.current)==null?void 0:te.getBoundingClientRect();if(!k)return;const c=window.innerHeight,y=c-k.bottom,M=k.top,ee=y<300&&M>y;B(ee?"up":"down"),S(ee?{bottom:c-k.top+4,left:k.left,width:k.width}:{top:k.bottom+4,left:k.left,width:k.width})};u.useEffect(()=>{if(h)return N(),window.addEventListener("scroll",N,!0),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",N)}},[h]),u.useEffect(()=>{const k=c=>{L.current&&!L.current.contains(c.target)&&I.current&&!I.current.contains(c.target)&&W()};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[p]),u.useEffect(()=>{var c;if(!h||E<0||!I.current)return;(c=I.current.querySelectorAll(".ds-select-option")[E])==null||c.scrollIntoView({block:"nearest"})},[E,h]);const T=k=>{switch(k.key){case"ArrowDown":k.preventDefault(),h?R(c=>Math.min(c+1,o.length-1)):b();break;case"ArrowUp":k.preventDefault(),h?R(c=>Math.max(c-1,0)):b(o.length-1);break;case"Home":h&&(k.preventDefault(),R(0));break;case"End":h&&(k.preventDefault(),R(o.length-1));break;case"Enter":case" ":k.preventDefault(),h?E>=0&&(n==null||n(o[E].value),W(!0)):b();break;case"Escape":h&&(k.preventDefault(),W(!0));break;case"Tab":h&&W(!1);break}},P=o.find(k=>k.value===t),Y=l==="xs"?A[1]:l==="small"?A[2]:A[3],X=h&&e.jsx("div",{ref:I,role:"listbox","aria-labelledby":s?w:void 0,tabIndex:-1,className:["ds-select-dropdown",`ds-select-dropdown--${l}`,`ds-select-dropdown--${$}`,p&&"ds-select-dropdown--closing"].filter(Boolean).join(" "),style:_,children:o.map((k,c)=>e.jsx("button",{id:`${C}-opt-${c}`,type:"button",role:"option",tabIndex:-1,"aria-selected":t===k.value,className:["ds-select-option",`ds-select-option--${l}`,t===k.value&&"ds-select-option--selected",c===E&&"ds-select-option--active"].filter(Boolean).join(" "),onClick:()=>{n==null||n(k.value),W(!0)},children:k.label},k.value))});return e.jsxs("div",{className:`ds-select-wrapper ${i?"ds-select-wrapper--full":""} ${m?"ds-select-wrapper--disabled":""}`,children:[s&&e.jsx("label",{id:w,className:"ds-select-label",children:s}),e.jsx("div",{className:"ds-select-container",ref:L,children:e.jsxs("button",{ref:V,type:"button",id:C,role:"combobox","aria-haspopup":"listbox","aria-expanded":h,"aria-activedescendant":h&&E>=0?`${C}-opt-${E}`:void 0,"aria-labelledby":s?w:void 0,"aria-invalid":r?"true":"false","aria-describedby":O,className:`ds-select-trigger ds-select-trigger--${l} ${r?"ds-select-trigger--error":""}`,onClick:()=>{m||(h?W():b())},onKeyDown:T,disabled:m,...f,children:[e.jsx("span",{className:P?"":"ds-select-placeholder",children:(P==null?void 0:P.label)||a}),e.jsx(g.ChevronDown,{size:Y,strokeWidth:1.5,className:`ds-select-icon ${h&&$==="down"?"ds-select-icon--open":""} ${h&&$==="up"?"ds-select-icon--up":""}`,"aria-hidden":"true"})]})}),r&&e.jsx("span",{id:O,className:"ds-select-error",role:"alert",children:r}),typeof document<"u"&&ue.createPortal(X,document.body)]})}function Ge({label:s,value:t=0,onChange:n,min:o=0,max:a=100,step:r=1,size:i="m",disabled:l=!1,hint:m,error:d,...f}){const h=()=>{if(l)return;const $=Math.min(Number(t)+r,a);n==null||n($)},x=()=>{if(l)return;const $=Math.max(Number(t)-r,o);n==null||n($)},p=$=>{if(l)return;const B=$.target.value;if(B===""){n==null||n(o);return}const E=Number(B);if(!isNaN(E)){const R=Math.min(Math.max(E,o),a);n==null||n(R)}},j=["ds-stepper-wrapper",l&&"ds-stepper-wrapper--disabled",d&&"ds-stepper-wrapper--error"].filter(Boolean).join(" "),_=["ds-stepper",`ds-stepper--${i}`,l&&"ds-stepper--disabled"].filter(Boolean).join(" "),S=i==="xs"?A[1]:i==="small"?A[2]:A[3];return e.jsxs("div",{className:j,children:[s&&e.jsx("label",{className:"ds-stepper-label",children:s}),e.jsxs("div",{className:_,children:[e.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--minus",onClick:x,disabled:l||t<=o,"aria-label":"Decrease",children:e.jsx(g.Minus,{size:S,strokeWidth:1.5})}),e.jsx("input",{type:"number",className:"ds-stepper-input",value:t,onChange:p,min:o,max:a,step:r,disabled:l,...f}),e.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--plus",onClick:h,disabled:l||t>=a,"aria-label":"Increase",children:e.jsx(g.Plus,{size:S,strokeWidth:1.5})})]}),m&&!d&&e.jsx("div",{className:"ds-stepper-hint",children:m}),d&&e.jsx("div",{className:"ds-stepper-error",children:d})]})}function Ke({children:s,padding:t="m",variant:n="info",hover:o=!1,onClick:a,href:r,disabled:i=!1,...l}){const d=(o?"interactive":n)==="interactive"||a||r,f=["ds-card",`ds-card--${t}`,d&&"ds-card--interactive"].filter(Boolean).join(" ");if(r){const p=j=>{if(i){j.preventDefault();return}j.metaKey||j.ctrlKey||j.button===1||(j.preventDefault(),a==null||a(j))};return e.jsx("a",{className:f,href:i?void 0:r,onClick:p,"aria-disabled":i?"true":void 0,...l,children:s})}const h=d&&a?"button":"div",x=d&&a?{type:"button",onClick:a,disabled:i}:{};return e.jsx(h,{className:f,role:d&&!a?"article":void 0,...x,...l,children:s})}function Je({children:s,...t}){return e.jsx("h1",{className:"ds-h1",...t,children:s})}function Ze({children:s,...t}){return e.jsx("h2",{className:"ds-h2",...t,children:s})}function Qe({children:s,...t}){return e.jsx("h3",{className:"ds-h3",...t,children:s})}function es({children:s,...t}){return e.jsx("h4",{className:"ds-h4",...t,children:s})}function ss({children:s,secondary:t=!1,...n}){return e.jsx("p",{className:`ds-p1 ${t?"ds-p1--secondary":""}`,...n,children:s})}function De({children:s,secondary:t=!1,...n}){return e.jsx("p",{className:`ds-p2 ${t?"ds-p2--secondary":""}`,...n,children:s})}function ve({children:s,secondary:t=!1,...n}){return e.jsx("p",{className:`ds-p3 ${t?"ds-p3--secondary":""}`,...n,children:s})}function ae({children:s,variant:t="default",size:n="m",role:o,...a}){const r=["ds-badge",`ds-badge--${t}`,`ds-badge--${n}`].filter(Boolean).join(" "),i=o||(["info","success","warning","error"].includes(t)?"status":void 0);return e.jsx("span",{className:r,role:i,...a,children:s})}const ts={info:g.Info,success:g.CheckCircle,warning:g.AlertTriangle,error:g.XCircle};function ns({children:s,variant:t="info",title:n,onClose:o,role:a,...r}){const i=ts[t],l=a||(t==="error"?"alert":"status");return e.jsxs("div",{className:`ds-alert ds-alert--${t} ${n?"":"ds-alert--no-title"}`,role:l,...r,children:[i&&e.jsx("div",{className:"ds-alert__icon",children:e.jsx(i,{size:A[3],strokeWidth:1.5})}),e.jsxs("div",{className:"ds-alert__content",children:[n&&e.jsx("div",{className:"ds-alert__title",children:n}),s&&e.jsx("div",{className:"ds-alert__message",children:s})]}),o&&e.jsx("button",{type:"button",className:"ds-alert__close",onClick:o,"aria-label":"Close alert",children:e.jsx(g.X,{size:A[3],strokeWidth:1.5})})]})}const rs=200;function as({children:s,title:t,onClose:n,size:o="m",scrollable:a=!1,subHeader:r,...i}){const l=u.useRef(null),m=u.useId(),[d,f]=u.useState(!1),h=()=>{!n||d||(f(!0),setTimeout(()=>{f(!1),n()},rs))};u.useEffect(()=>{const _=$=>{$.key==="Escape"&&h()},S=$=>{l.current&&!l.current.contains($.target)&&h()};return document.addEventListener("keydown",_),document.addEventListener("mousedown",S),()=>{document.removeEventListener("keydown",_),document.removeEventListener("mousedown",S)}},[n,d]);const x=u.Children.toArray(s),p=x.find(_=>(_==null?void 0:_.type)===xe),j=x.filter(_=>(_==null?void 0:_.type)!==xe);return e.jsx("div",{className:["ds-modal-overlay",d&&"ds-modal-overlay--closing"].filter(Boolean).join(" "),...i,children:e.jsxs("div",{className:[`ds-modal ds-modal--${o}`,a&&"ds-modal--scrollable"].filter(Boolean).join(" "),ref:l,role:"dialog","aria-modal":"true","aria-labelledby":t?m:void 0,children:[(t||n||r)&&e.jsxs("div",{className:"ds-modal__header",children:[(t||n)&&e.jsxs("div",{className:"ds-modal__header-row",children:[t&&e.jsx("h3",{id:m,className:"ds-modal__title",children:t}),n&&e.jsx(ie,{variant:"ghost",size:"small",icon:e.jsx(g.X,{size:A[2],strokeWidth:1.5}),onClick:h,"aria-label":"Close modal"})]}),r&&e.jsx("div",{className:"ds-modal__subheader",children:r})]}),e.jsx("div",{className:"ds-modal__body",children:j}),p]})})}function xe({children:s}){return!s||u.Children.count(s)===0?null:e.jsx("div",{className:"ds-modal__footer",children:s})}function Ae({children:s,title:t="Code",defaultExpanded:n=!1,expanded:o,onToggle:a,padding:r="s",className:i="",...l}){const[m,d]=u.useState(n),f=o!==void 0,h=f?o:m,x=()=>{f?a==null||a(!o):d(j=>!j)},p=["ds-code-accordion",`ds-code-accordion--${r}`,h&&"ds-code-accordion--expanded",i].filter(Boolean).join(" ");return e.jsxs("div",{className:p,...l,children:[e.jsxs("button",{type:"button",className:"ds-code-accordion__header",onClick:x,"aria-expanded":h,children:[e.jsx("span",{className:"ds-code-accordion__title",children:t}),e.jsx(g.ChevronDown,{size:A[2],strokeWidth:1.5,className:`ds-code-accordion__icon ${h?"ds-code-accordion__icon--expanded":""}`})]}),e.jsx("div",{className:"ds-code-accordion__content",children:e.jsx("div",{className:"ds-code-accordion__inner",children:e.jsx("pre",{className:"ds-code-accordion__pre",children:e.jsx("code",{children:s})})})})]})}function os({children:s,block:t=!1,collapsible:n=!1,title:o="Code",defaultExpanded:a=!1,...r}){return t?n?e.jsx(Ae,{title:o,defaultExpanded:a,...r,children:s}):e.jsx("pre",{className:"ds-code-block",...r,children:e.jsx("code",{children:s})}):e.jsx("code",{className:"ds-code-inline",...r,children:s})}function is({href:s,children:t,onClick:n,target:o,rel:a,...r}){const l=o==="_blank"?a?`${a} noopener noreferrer`:"noopener noreferrer":a;return e.jsx("a",{href:s,className:"ds-link",onClick:n,target:o,rel:l,...r,children:t})}function ls({children:s,size:t="m",variant:n="ghost",...o}){return e.jsx("div",{className:"ds-tabs",role:"tablist",...o,children:u.Children.map(s,a=>u.isValidElement(a)?u.cloneElement(a,{size:t,variant:n}):a)})}function cs({children:s,selected:t=!1,onClick:n,size:o="m",variant:a="ghost",disabled:r=!1,icon:i,href:l,...m}){const d=i&&!s,f=["ds-tab",`ds-tab--${o}`,`ds-tab--${a}`,t&&"ds-tab--selected",d&&"ds-tab--icon-only"].filter(Boolean).join(" "),h=e.jsxs(e.Fragment,{children:[i&&e.jsx("span",{className:"ds-tab-icon",children:i}),s]});if(l){const x=p=>{if(r){p.preventDefault();return}p.metaKey||p.ctrlKey||p.button===1||(p.preventDefault(),n==null||n(p))};return e.jsx("a",{role:"tab","aria-current":t?"page":void 0,"aria-disabled":r?"true":void 0,className:f,href:r?void 0:l,onClick:x,...m,children:h})}return e.jsx("button",{role:"tab","aria-selected":t,className:f,onClick:n,disabled:r,...m,children:h})}function ds({options:s,value:t,onChange:n,size:o="m",disabled:a=!1}){const r=u.useRef(null),i=u.useRef(null),[l,m]=u.useState(!1),d=u.useRef(!1),f=u.useRef(null),h=u.useRef(null),x=()=>{if(!r.current)return;const p=r.current.querySelector(`[data-value="${t}"]`);if(!p)return;const j=r.current.getBoundingClientRect(),_=p.getBoundingClientRect(),S=_.left-j.left,$=_.width;i.current?(i.current.style.transition=d.current?"left var(--transition-normal), width var(--transition-normal)":"none",i.current.style.left=S+"px",i.current.style.width=$+"px",d.current=!1):(m(!0),requestAnimationFrame(()=>{if(!i.current||!r.current)return;const B=r.current.querySelector(`[data-value="${t}"]`);if(!B)return;const E=r.current.getBoundingClientRect(),R=B.getBoundingClientRect();i.current.style.transition="none",i.current.style.left=R.left-E.left+"px",i.current.style.width=R.width+"px"}))};return h.current=x,u.useLayoutEffect(()=>{const p=f.current!==t;f.current=t,d.current=l&&p,x()}),u.useEffect(()=>{if(!r.current)return;const p=new ResizeObserver(()=>{d.current=!1,h.current()});return p.observe(r.current),()=>p.disconnect()},[]),e.jsxs("div",{className:["ds-seg",`ds-seg--${o}`,a&&"ds-seg--disabled"].filter(Boolean).join(" "),ref:r,role:"group",children:[l&&e.jsx("div",{ref:i,className:"ds-seg__pill","aria-hidden":"true"}),s.map(p=>e.jsxs("button",{type:"button","data-value":p.value,className:["ds-seg__btn",t===p.value&&"ds-seg__btn--active"].filter(Boolean).join(" "),onClick:()=>!a&&n(p.value),"aria-pressed":t===p.value,disabled:a,children:[p.icon&&e.jsx("span",{className:"ds-seg__btn-icon","aria-hidden":"true",children:p.icon}),p.label]},p.value))]})}function fe({children:s,title:t,defaultExpanded:n=!1,expanded:o,onToggle:a,padding:r="m",...i}){const[l,m]=u.useState(n),d=o!==void 0,f=d?o:l,h=()=>{d?a==null||a(!o):m(p=>!p)},x=["ds-accordion",`ds-accordion--${r}`,f&&"ds-accordion--expanded"].filter(Boolean).join(" ");return e.jsxs("div",{className:x,...i,children:[e.jsxs("button",{type:"button",className:"ds-accordion__header",onClick:h,"aria-expanded":f,children:[e.jsx("span",{className:"ds-accordion__title",children:t}),e.jsx(g.ChevronDown,{size:A[2],strokeWidth:1.5,className:`ds-accordion__icon ${f?"ds-accordion__icon--expanded":""}`})]}),e.jsx("div",{className:"ds-accordion__content",children:e.jsx("div",{className:"ds-accordion__content-inner",children:e.jsx("div",{className:"ds-accordion__content-body",children:s})})})]})}const se=8,oe=8;function us(s,t,n){const o=window.innerWidth;let a,r;switch(s){case"top":a=t.top-n.height-se,r=t.left+t.width/2-n.width/2;break;case"bottom":a=t.bottom+se,r=t.left+t.width/2-n.width/2;break;case"left":a=t.top+t.height/2-n.height/2,r=t.left-n.width-se;break;case"right":a=t.top+t.height/2-n.height/2,r=t.right+se;break;default:a=t.bottom+se,r=t.left}const i=Math.max(oe,Math.min(o-n.width-oe,r)),l=r-i;return{top:a,left:i,arrowOffset:l}}function fs(s,t,n){const o=window.innerWidth,a=window.innerHeight;if(s.top>=t+se+oe)return"top";if(a-s.bottom>=t+se+oe)return"bottom";if(o-s.right>=n+se+oe)return"right";if(s.left>=n+se+oe)return"left";const r=Math.max(s.top,a-s.bottom,s.left,o-s.right);return r===s.top?"top":r===a-s.bottom?"bottom":r===o-s.right?"right":"left"}function ms({children:s,content:t,position:n,...o}){const[a,r]=u.useState(!1),[i,l]=u.useState({visibility:"hidden"}),[m,d]=u.useState(n||"top"),f=u.useRef(null),h=u.useRef(null),x=u.useRef(!1),p=()=>{if(!f.current||!h.current)return;const _=f.current.getBoundingClientRect(),S=h.current.getBoundingClientRect(),$=n||fs(_,S.height,S.width),{top:B,left:E,arrowOffset:R}=us($,_,S);d($),l({position:"fixed",top:B,left:E,visibility:"visible","--arrow-offset":`${R}px`})};if(u.useEffect(()=>{if(!a)return;l({position:"fixed",visibility:"hidden"});const _=requestAnimationFrame(p);return window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{cancelAnimationFrame(_),window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}},[a,n]),u.useEffect(()=>{if(!a)return;const _=S=>{f.current&&!f.current.contains(S.target)&&r(!1)};return document.addEventListener("touchstart",_),()=>document.removeEventListener("touchstart",_)},[a]),!t)return s;const j=a&&e.jsx("div",{ref:h,className:`ds-tooltip ds-tooltip--${m}`,role:"tooltip",style:i,children:t});return e.jsxs("div",{ref:f,className:"ds-tooltip-wrapper",onMouseEnter:()=>{x.current||r(!0)},onMouseLeave:()=>{x.current||r(!1)},onTouchStart:()=>{x.current=!0,r(_=>!_)},...o,children:[s,typeof document<"u"&&ue.createPortal(j,document.body)]})}function ps({checked:s=!1,onChange:t,size:n="m",disabled:o=!1,label:a,id:r,...i}){const l=r||`toggle-${u.useId()}`,m=["ds-toggle",`ds-toggle--${n}`,o&&"ds-toggle--disabled"].filter(Boolean).join(" ");return e.jsxs("label",{className:m,htmlFor:l,children:[e.jsx("input",{type:"checkbox",id:l,className:"ds-toggle__input",checked:s,onChange:d=>t==null?void 0:t(d.target.checked),disabled:o,...i}),e.jsx("span",{className:"ds-toggle__track",children:e.jsx("span",{className:"ds-toggle__thumb"})}),a&&e.jsx("span",{className:"ds-toggle__label",children:a})]})}function hs({checked:s=!1,onChange:t,size:n="m",disabled:o=!1,label:a,id:r,...i}){const l=r||`checkbox-${u.useId()}`,m=["ds-checkbox",`ds-checkbox--${n}`,o&&"ds-checkbox--disabled"].filter(Boolean).join(" "),d=n==="xs"?10:n==="small"?14:n==="large"?20:16;return e.jsxs("label",{className:m,htmlFor:l,children:[e.jsx("input",{type:"checkbox",id:l,className:"ds-checkbox__input",checked:s,onChange:f=>t==null?void 0:t(f.target.checked),disabled:o,...i}),e.jsx("span",{className:"ds-checkbox__box",children:s&&e.jsx(g.Check,{size:d,strokeWidth:2.5,className:"ds-checkbox__icon"})}),a&&e.jsx("span",{className:"ds-checkbox__label",children:a})]})}function xs({checked:s=!1,onChange:t,size:n="m",disabled:o=!1,label:a,name:r,value:i,id:l,...m}){const d=l||`radio-${u.useId()}`,f=["ds-radio",`ds-radio--${n}`,o&&"ds-radio--disabled"].filter(Boolean).join(" ");return e.jsxs("label",{className:f,htmlFor:d,children:[e.jsx("input",{type:"radio",id:d,className:"ds-radio__input",checked:s,onChange:h=>t==null?void 0:t(h.target.checked),disabled:o,name:r,value:i,...m}),e.jsx("span",{className:"ds-radio__circle",children:e.jsx("span",{className:"ds-radio__dot"})}),a&&e.jsx("span",{className:"ds-radio__label",children:a})]})}function Ie({width:s,height:t,shape:n="rect",aspectRatio:o,className:a="",style:r={},...i}){return e.jsx("span",{className:["ds-skeleton",`ds-skeleton--${n}`,a].filter(Boolean).join(" "),style:{width:s,height:t,aspectRatio:o,...r},"aria-hidden":"true",...i})}function bs({lines:s=1,lastLineWidth:t="70%",gap:n,className:o="",style:a={},...r}){return e.jsx("span",{className:["ds-skeleton-text",o].filter(Boolean).join(" "),style:{gap:n,...a},"aria-hidden":"true",...r,children:Array.from({length:s},(i,l)=>e.jsx("span",{className:"ds-skeleton ds-skeleton--text",style:l===s-1&&s>1?{width:t}:void 0},l))})}Ie.Text=bs;function js(s){let t=2166136261;for(let n=0;n<s.length;n++)t^=s.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t%360}function _s(s){if(!s)return"";const t=s.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():s[0].toUpperCase()}function vs({seed:s,icon:t,src:n,size:o=32,className:a="",style:r={},...i}){const l=js(s??""),[m,d]=u.useState(!1),f=t??e.jsx("span",{className:"ds-avatar__initials",children:_s(s)});return e.jsx("div",{className:["ds-avatar",a].filter(Boolean).join(" "),style:{width:o,height:o,"--ds-avatar-h":l,...r},"aria-hidden":"true",...i,children:n&&!m?e.jsx("img",{src:n,alt:"",onError:()=>d(!0)}):f})}function ws({children:s,size:t="compact",stickyTop:n,maxHeight:o,className:a="",style:r={},...i}){const l={...o?{maxHeight:o}:{},...n!==void 0?{"--ds-table-sticky-top":typeof n=="number"?`${n}px`:n}:{},...r};return e.jsx("div",{className:["ds-table-wrap",o?"ds-table-wrap--scroll":""].filter(Boolean).join(" "),style:l,children:e.jsx("table",{className:["ds-table",`ds-table--${t}`,a].filter(Boolean).join(" "),...i,children:s})})}function Ns({children:s,...t}){return e.jsx("thead",{...t,children:s})}function gs({children:s,...t}){return e.jsx("tbody",{...t,children:s})}function ys({children:s,interactive:t,selected:n,subheader:o,exiting:a,updated:r,className:i="",onClick:l,...m}){return e.jsx("tr",{className:["ds-table-row",t||l?"ds-table-row--interactive":"",n?"ds-table-row--selected":"",o?"ds-table-row--subheader":"",a?"ds-table-row--exiting":"",r?"ds-table-row--updated":"",i].filter(Boolean).join(" "),onClick:l,...m,children:s})}function ks({children:s,colSpan:t=999,...n}){return e.jsx("tr",{className:"ds-table-row ds-table-row--subheader",...n,children:e.jsx("td",{colSpan:t,children:s})})}function Es({children:s,align:t="left",sortDir:n,onSort:o,width:a,className:r="",style:i={},...l}){const m=!!o||n!==void 0,d=n==="asc"?g.ChevronUp:n==="desc"?g.ChevronDown:g.ChevronsUpDown;return e.jsx("th",{className:["ds-th",m?"ds-th--sortable":"",n?"ds-th--sorted":"",t!=="left"?`ds-table-cell--${t}`:"",r].filter(Boolean).join(" "),onClick:o,style:{width:a,...i},...l,children:m?e.jsxs("span",{className:"ds-th__inner",children:[s,e.jsx("span",{className:"ds-th__sort-icon",children:e.jsx(d,{size:11,strokeWidth:2.5})})]}):s})}function Ts({children:s,align:t="left",secondary:n,muted:o,truncate:a,nowrap:r,className:i="",...l}){return e.jsx("td",{className:["ds-td",t!=="left"?`ds-table-cell--${t}`:"",n?"ds-table-cell--secondary":"",o?"ds-table-cell--muted":"",a?"ds-table-cell--truncate":"",r?"ds-table-cell--nowrap":"",i].filter(Boolean).join(" "),...l,children:s})}function $s({icon:s,title:t,description:n,action:o,size:a="m",className:r="",...i}){return e.jsxs("div",{className:["ds-empty-state",`ds-empty-state--${a}`,r].filter(Boolean).join(" "),...i,children:[s&&e.jsx("div",{className:"ds-empty-state__icon",children:s}),e.jsx("div",{className:"ds-empty-state__title",children:t}),n&&e.jsx("div",{className:"ds-empty-state__description",children:n}),o&&e.jsx("div",{className:"ds-empty-state__action",children:o})]})}function Rs({label:s,hint:t,error:n,required:o=!1,disabled:a=!1,htmlFor:r,children:i,className:l="",style:m,...d}){const f=u.useId(),h=r??f,x=`${h}-hint`,p=`${h}-error`;return e.jsxs("div",{className:`ds-field${l?` ${l}`:""}`,"data-state":n?"error":void 0,"data-required":o?"":void 0,"data-disabled":a?"":void 0,style:m,...d,children:[s&&e.jsx("label",{className:"ds-field-label",htmlFor:h,children:s}),e.jsx("div",{className:"ds-field-control",children:i}),t&&!n&&e.jsx("p",{className:"ds-field-hint",id:x,children:t}),n&&e.jsx("p",{className:"ds-field-error",id:p,role:"alert",children:n})]})}function Ss({label:s,value:t,delta:n,size:o="m",inline:a=!1,className:r="",style:i,...l}){const m=n!=null&&n.startsWith("+")?"up":n!=null&&n.startsWith("-")?"down":"neutral";return e.jsxs("div",{className:["ds-stat",`ds-stat--${o}`,a&&"ds-stat--inline",r].filter(Boolean).join(" "),style:i,...l,children:[s&&e.jsx("span",{className:"ds-stat-label",children:s}),t!=null&&e.jsx("span",{className:"ds-stat-value",children:t}),n!=null&&e.jsx("span",{className:`ds-stat-delta ds-stat-delta--${m}`,children:n})]})}function Ds({children:s,separator:t="/","aria-label":n="Breadcrumb",className:o="",style:a,...r}){const i=u.Children.toArray(s).filter(Boolean);return e.jsx("nav",{className:`ds-breadcrumb${o?` ${o}`:""}`,"aria-label":n,style:a,...r,children:e.jsx("ol",{className:"ds-breadcrumb-list",children:i.map((l,m)=>e.jsxs("li",{className:"ds-breadcrumb-item",children:[l,m<i.length-1&&e.jsx("span",{className:"ds-breadcrumb-sep","aria-hidden":"true",children:t})]},m))})})}function As({page:s,total:t,onChange:n,siblings:o=1,"aria-label":a="Pagination",className:r="",style:i,...l}){const m=Is(s,t,o);return e.jsxs("nav",{className:`ds-pagination${r?` ${r}`:""}`,"aria-label":a,style:i,...l,children:[e.jsx("button",{className:"ds-pagination-arrow",onClick:()=>n==null?void 0:n(s-1),disabled:s<=1,"aria-label":"Previous page",children:e.jsx(g.ChevronLeft,{size:16})}),m.map((d,f)=>d==="…"?e.jsx("span",{className:"ds-pagination-gap","aria-hidden":"true",children:"…"},`gap-${f}`):e.jsx("button",{className:`ds-pagination-page${d===s?" ds-pagination-page--current":""}`,onClick:()=>d!==s&&(n==null?void 0:n(d)),"aria-current":d===s?"page":void 0,"aria-label":`Page ${d}`,children:d},d)),e.jsx("button",{className:"ds-pagination-arrow",onClick:()=>n==null?void 0:n(s+1),disabled:s>=t,"aria-label":"Next page",children:e.jsx(g.ChevronRight,{size:16})})]})}function Is(s,t,n){if(t<=7)return Array.from({length:t},(i,l)=>l+1);const o=Math.max(2,s-n),a=Math.min(t-1,s+n),r=[1];o>2&&r.push("…");for(let i=o;i<=a;i++)r.push(i);return a<t-1&&r.push("…"),r.push(t),r}const Bs=200;function Ps({children:s,title:t,onClose:n,side:o="right",...a}){const r=u.useRef(null),i=u.useId(),[l,m]=u.useState(!1),d=()=>{!n||l||(m(!0),setTimeout(()=>{m(!1),n()},Bs))};u.useEffect(()=>{const p=_=>{_.key==="Escape"&&d()},j=_=>{r.current&&!r.current.contains(_.target)&&d()};return document.addEventListener("keydown",p),document.addEventListener("mousedown",j),()=>{document.removeEventListener("keydown",p),document.removeEventListener("mousedown",j)}},[n,l]);const f=u.Children.toArray(s),h=f.find(p=>(p==null?void 0:p.type)===be),x=f.filter(p=>(p==null?void 0:p.type)!==be);return e.jsx("div",{className:["ds-drawer-overlay",l&&"ds-drawer-overlay--closing"].filter(Boolean).join(" "),...a,children:e.jsxs("aside",{className:["ds-drawer",l&&"ds-drawer--closing"].filter(Boolean).join(" "),"data-side":o,ref:r,role:"dialog","aria-modal":"true","aria-labelledby":t?i:void 0,children:[e.jsxs("header",{className:"ds-drawer-header",children:[t&&e.jsx("h3",{id:i,className:"ds-drawer-title",children:t}),n&&e.jsx("button",{className:"ds-drawer-close",onClick:d,"aria-label":"Close drawer",children:e.jsx(g.X,{size:A[2],strokeWidth:1.5})})]}),e.jsx("div",{className:"ds-drawer-body",children:x}),h]})})}function be({children:s}){return e.jsx("footer",{className:"ds-drawer-footer",children:s})}const Ms={info:g.Info,success:g.CheckCircle,warning:g.AlertTriangle,error:g.XCircle};function Ls({children:s,variant:t="info",action:n,onAction:o,onDismiss:a,role:r,...i}){const l=Ms[t],m=r||(t==="error"?"alert":"status");return e.jsxs("div",{className:`ds-banner ds-banner--${t}`,role:m,...i,children:[l&&e.jsx("span",{className:"ds-banner-icon","aria-hidden":"true",children:e.jsx(l,{size:A[2],strokeWidth:1.5})}),e.jsx("span",{className:"ds-banner-text",children:s}),n&&e.jsx("button",{type:"button",className:"ds-banner-action",onClick:o,children:n}),a&&e.jsx("button",{type:"button",className:"ds-banner-dismiss",onClick:a,"aria-label":"Dismiss",children:e.jsx(g.X,{size:A[2],strokeWidth:1.5})})]})}function zs({trigger:s,items:t=[],open:n,onOpenChange:o,align:a="left",className:r="",style:i,...l}){const[m,d]=u.useState(!1),[f,h]=u.useState(!1),x=n!==void 0,p=x?n:m,j=u.useRef(null),_=u.useRef(null),S=u.useRef(null),$=u.useRef(null),[B,E]=u.useState({}),R=u.useRef(null),L=150,I=()=>{if(x)o==null||o(!1);else{if(f)return;h(!0),R.current=setTimeout(()=>{d(!1),h(!1)},L)}},V=()=>{const b=!p;x?o==null||o(b):b?(clearTimeout(R.current),h(!1),d(!0)):I()},H=()=>{p||(x?o==null||o(!0):(clearTimeout(R.current),h(!1),d(!0)))};u.useEffect(()=>()=>clearTimeout(R.current),[]),u.useEffect(()=>{if(!p)return;const b=300,N=()=>{var X;const T=(X=j.current)==null?void 0:X.getBoundingClientRect();if(!T)return;const P=window.innerHeight-T.bottom,Y=P<b+8&&T.top>P;E(a==="right"?Y?{bottom:window.innerHeight-T.top+4,top:"auto",right:window.innerWidth-T.right}:{top:T.bottom+4,bottom:"auto",right:window.innerWidth-T.right}:Y?{bottom:window.innerHeight-T.top+4,top:"auto",left:T.left}:{top:T.bottom+4,bottom:"auto",left:T.left})};return N(),window.addEventListener("scroll",N,!0),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",N)}},[p,a]);const C=()=>{var N;const b=(N=S.current)==null?void 0:N.querySelector('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"]), input, select, textarea');b==null||b.focus()};u.useEffect(()=>{if(!p)return;const b=T=>{var P,Y;!((P=j.current)!=null&&P.contains(T.target))&&!((Y=_.current)!=null&&Y.contains(T.target))&&I()},N=T=>{T.key==="Escape"&&(I(),C())};return document.addEventListener("mousedown",b),document.addEventListener("keydown",N),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",N)}},[p]),u.useEffect(()=>{if(!p||!$.current||!_.current)return;const b=w(),N=$.current==="last"?b[b.length-1]:b[0];N==null||N.focus(),$.current=null},[p]);const w=()=>_.current?[..._.current.querySelectorAll('button:not([disabled]), a[href]:not([aria-disabled="true"]), [tabindex]:not([tabindex="-1"])')]:[],O=b=>{var N,T;if(b.key==="ArrowDown")b.preventDefault(),p?(N=w()[0])==null||N.focus():($.current="first",H());else if(b.key==="ArrowUp")if(b.preventDefault(),!p)$.current="last",H();else{const P=w();(T=P[P.length-1])==null||T.focus()}},q=b=>{var P,Y,X,k;const N=w(),T=N.findIndex(c=>c===document.activeElement);switch(b.key){case"ArrowDown":b.preventDefault(),(P=N[Math.min(T+1,N.length-1)])==null||P.focus();break;case"ArrowUp":b.preventDefault(),T<=0?C():(Y=N[T-1])==null||Y.focus();break;case"Home":b.preventDefault(),(X=N[0])==null||X.focus();break;case"End":b.preventDefault(),(k=N[N.length-1])==null||k.focus();break;case"Tab":I();break}},W=p&&e.jsx("div",{ref:_,role:"menu",className:["ds-dropdown__menu",`ds-dropdown__menu--${a}`,f&&"ds-dropdown__menu--closing"].filter(Boolean).join(" "),style:B,onKeyDown:q,children:t.map((b,N)=>{if(b.separator)return e.jsx("div",{className:"ds-dropdown__separator"},N);if(b.type==="section")return e.jsxs("div",{className:"ds-dropdown__section",children:[b.label&&e.jsx("div",{className:"ds-dropdown__section-label",children:b.label}),e.jsx("div",{className:"ds-dropdown__section-content",children:b.content})]},N);const T=!!b.href,P=T?"a":"button",Y=T?{href:b.disabled?void 0:b.href,"aria-disabled":b.disabled?"true":void 0}:{type:"button",disabled:b.disabled};return e.jsxs(P,{role:"menuitem",className:["ds-dropdown__item",b.danger&&"ds-dropdown__item--danger"].filter(Boolean).join(" "),...Y,onClick:()=>{var X;(X=b.onClick)==null||X.call(b),I()},children:[b.icon&&e.jsx("span",{className:"ds-dropdown__item-icon",children:b.icon}),e.jsx("span",{className:"ds-dropdown__item-label",children:b.label}),b.shortcut&&e.jsx("span",{className:"ds-dropdown__item-shortcut",children:b.shortcut})]},N)})});return e.jsxs("div",{ref:j,className:["ds-dropdown",r].filter(Boolean).join(" "),style:i,...l,children:[e.jsx("div",{ref:S,className:"ds-dropdown__trigger",onClick:V,onKeyDown:O,children:s}),typeof document<"u"&&ue.createPortal(W,document.body)]})}function Cs({value:s=0,size:t="m",variant:n="default",showValue:o=!1,min:a=2,animate:r=!0}){const i=Math.min(100,Math.max(0,s)),l=Math.max(a,i),m=n==="auto"?i>=70?"success":i>=50?"warning":"danger":n;return e.jsxs("div",{className:["ds-progress",`ds-progress--${t}`,!r&&"ds-progress--instant"].filter(Boolean).join(" "),role:"progressbar","aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,children:[e.jsx("div",{className:"ds-progress__track",children:e.jsx("div",{className:`ds-progress__fill ds-progress__fill--${m}`,style:{width:`${l}%`}})}),o&&e.jsxs("span",{className:"ds-progress__value",children:[Math.round(i),"%"]})]})}const Fs=s=>1-Math.pow(1-s,3),Os=()=>typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function Be(s,{duration:t=600}={}){const[n,o]=u.useState(s),a=u.useRef(s),r=u.useRef(null);return u.useEffect(()=>{if(Os()){o(s),a.current=s;return}const i=a.current,l=s-i;if(l===0)return;let m=null;const d=f=>{m||(m=f);const h=Math.min((f-m)/t,1);o(i+l*Fs(h)),h<1?r.current=requestAnimationFrame(d):a.current=s};return r.current=requestAnimationFrame(d),()=>cancelAnimationFrame(r.current)},[s,t]),n}function Ws({value:s,duration:t=600,decimals:n=0,prefix:o="",suffix:a=""}){const i=Be(s,{duration:t}).toFixed(n);return`${o}${i}${a}`}function Pe({threshold:s=.1,rootMargin:t="0px",once:n=!1}={}){const o=u.useRef(null),[a,r]=u.useState(!1);return u.useEffect(()=>{const i=o.current;if(!i)return;const l=new IntersectionObserver(([m])=>{m.isIntersecting?(r(!0),n&&l.disconnect()):n||r(!1)},{threshold:s,rootMargin:t});return l.observe(i),()=>l.disconnect()},[s,t,n]),{ref:o,inView:a}}function Us({children:s,as:t="div",once:n=!1,threshold:o=.1,rootMargin:a="0px",onEnter:r,onLeave:i,...l}){const{ref:m,inView:d}=Pe({threshold:o,rootMargin:a,once:n}),f=u.useRef(!1);return u.useEffect(()=>{d&&!f.current&&(r==null||r()),!d&&f.current&&(i==null||i()),f.current=d},[d]),e.jsx(t,{ref:m,...l,children:typeof s=="function"?s(d):s})}const ke={default:g.Info,success:g.CheckCircle,warning:g.AlertTriangle,error:g.XCircle};let le=[];const je=new Set;function Me(){je.forEach(s=>s([...le]))}function Vs(s){le=[...le,s],Me()}function Hs(s){le=le.filter(t=>t.id!==s),Me()}function Ys(){const s=(t,n={})=>{Vs({id:`${Date.now()}-${Math.random()}`,message:t,type:"default",duration:4e3,...n})};return s.success=(t,n)=>s(t,{...n,type:"success"}),s.error=(t,n)=>s(t,{...n,type:"error"}),s.warning=(t,n)=>s(t,{...n,type:"warning"}),{toast:s}}function qs({data:s,onDismiss:t}){const[n,o]=u.useState(!1),a=u.useRef(null);u.useEffect(()=>(requestAnimationFrame(()=>o(!0)),s.duration>0&&(a.current=setTimeout(()=>r(),s.duration)),()=>clearTimeout(a.current)),[]);function r(){o(!1),setTimeout(()=>t(s.id),250)}const i=ke[s.type]??ke.default;return e.jsxs("div",{className:["ds-toast",`ds-toast--${s.type}`,n&&"ds-toast--visible"].filter(Boolean).join(" "),role:s.type==="error"?"alert":"status","aria-live":"polite",children:[e.jsx("div",{className:"ds-toast__icon",children:e.jsx(i,{size:A[3],strokeWidth:1.5})}),e.jsx("span",{className:"ds-toast__message",children:s.message}),e.jsx("button",{className:"ds-toast__close",onClick:r,"aria-label":"Закрыть",children:e.jsx(g.X,{size:A[3],strokeWidth:1.5})})]})}function Xs({position:s="bottom-right"}){const[t,n]=u.useState(()=>[...le]);return u.useEffect(()=>(je.add(n),()=>je.delete(n)),[]),!t.length||typeof document>"u"?null:ue.createPortal(e.jsx("div",{className:["ds-toast-container",`ds-toast-container--${s}`].join(" "),children:t.map(o=>e.jsx(qs,{data:o,onDismiss:Hs},o.id))}),document.body)}const Gs={running:e.jsx(ae,{size:"xs",variant:"info",children:"Running..."}),success:e.jsx(ae,{size:"xs",variant:"success",children:"Done"}),error:e.jsx(ae,{size:"xs",variant:"error",children:"Error"})};function Le({label:s,status:t="idle",icon:n,badge:o,defaultExpanded:a=!1,expanded:r,onToggle:i,children:l,className:m="",...d}){const f=t==="running",h=e.jsxs("span",{className:"ds-tool-card__title-row",children:[n&&e.jsx("span",{className:"ds-tool-card__icon",children:n}),e.jsx("span",{className:"ds-tool-card__label",children:s}),Gs[t],o]});return l?e.jsx("div",{className:["ds-tool-card",f&&"ds-tool-card--running",m].filter(Boolean).join(" "),...d,children:e.jsx(fe,{title:h,padding:"s",defaultExpanded:a,expanded:f?!1:r,onToggle:f?void 0:i,children:e.jsx("div",{className:"ds-tool-card__body",children:l})})}):e.jsx("div",{className:["ds-tool-card","ds-tool-card--bubble",m].filter(Boolean).join(" "),...d,children:h})}function ze({text:s,size:t="xs",timeout:n=800,"aria-label":o="Copy to clipboard",...a}){const[r,i]=u.useState(!1),l=m=>{m.currentTarget.blur(),navigator.clipboard.writeText(s).then(()=>{i(!0),setTimeout(()=>i(!1),n)})};return e.jsx(ie,{variant:"ghost",size:t,state:r?"success":"idle",icon:e.jsx(g.Copy,{size:A[1],strokeWidth:1.5}),"aria-label":o,onClick:l,...a})}function Ks({content:s,streaming:t=!1,...n}){const[o,a]=u.useState(t);return u.useEffect(()=>{a(!!t)},[t]),e.jsx(fe,{expanded:o,onToggle:a,padding:"s",title:e.jsxs("div",{className:"ds-reasoning__title",children:[e.jsx(g.Brain,{size:A[1],strokeWidth:1.5,className:"ds-reasoning__icon"}),e.jsx(De,{secondary:!0,children:"Thinking"})]}),...n,children:e.jsxs(ve,{secondary:!0,style:{whiteSpace:"pre-wrap"},children:[s,t&&e.jsx("span",{className:"ds-cursor ds-cursor--line"})]})})}function Js({count:s,current:t=0,done:n=[],onChange:o,showCounter:a=!0,className:r="","aria-label":i="Steps",...l}){return e.jsxs("div",{className:["ds-step-indicator",r].filter(Boolean).join(" "),...l,children:[e.jsx("div",{className:"ds-step-indicator__dots",role:"tablist","aria-label":i,children:Array.from({length:s},(m,d)=>{const f=d===t,h=n.includes(d)&&!f,x=o&&(d<=t||n.includes(d)),p=["ds-step-indicator__dot",f&&"ds-step-indicator__dot--active",h&&"ds-step-indicator__dot--done"].filter(Boolean).join(" ");return e.jsx("button",{type:"button",className:p,role:"tab","aria-selected":f,"aria-label":`Step ${d+1}`,disabled:!x||d===t,onClick:()=>o==null?void 0:o(d),children:h?e.jsx(g.Check,{size:8,strokeWidth:3}):null},d)})}),a&&e.jsxs(ve,{secondary:!0,className:"ds-step-indicator__counter",children:[t+1," / ",s]})]})}function Zs({content:s,isStreaming:t=!1,cursor:n="line",onChunk:o,className:a="",...r}){const i=u.useRef(s);return u.useEffect(()=>{s!==i.current&&(o==null||o(s),i.current=s)},[s,o]),e.jsxs("span",{className:["ds-streaming-text",a].filter(Boolean).join(" "),...r,children:[s,t&&n!=="none"&&e.jsx("span",{className:`ds-cursor ds-cursor--${n}`,"aria-hidden":"true"})]})}function Qs({role:s="assistant",header:t,footer:n,attachments:o,isStreaming:a=!1,children:r,className:i="",...l}){const m=["ds-chat-message",`ds-chat-message--${s}`,a&&"ds-chat-message--streaming",i].filter(Boolean).join(" ");return s==="system"?e.jsx("div",{className:m,...l,children:e.jsx("span",{className:"ds-chat-message__system-label",children:r})}):s==="user"?e.jsxs("div",{className:m,...l,children:[o&&e.jsx("div",{className:"ds-chat-message__attachments",children:o}),e.jsx("div",{className:"ds-chat-message__bubble",children:r}),n&&e.jsx("div",{className:"ds-chat-message__footer",children:n})]}):e.jsxs("div",{className:m,...l,children:[t&&e.jsx("div",{className:"ds-chat-message__header",children:t}),o&&e.jsx("div",{className:"ds-chat-message__attachments",children:o}),e.jsx("div",{className:"ds-chat-message__body",children:r}),n&&e.jsx("div",{className:"ds-chat-message__footer",children:n})]})}function et(s,{containerRef:t,smartPause:n=!0}={}){const o=u.useRef(!1),a=u.useRef(0);u.useEffect(()=>{const r=t==null?void 0:t.current;if(!r)return;const i=()=>{const l=r.scrollHeight-r.scrollTop-r.clientHeight<64;!l&&r.scrollTop<a.current&&(o.current=!0),l&&(o.current=!1),a.current=r.scrollTop};return r.addEventListener("scroll",i,{passive:!0}),()=>r.removeEventListener("scroll",i)},[t]),u.useEffect(()=>{const r=t==null?void 0:t.current;r&&(n&&o.current||(r.scrollTop=r.scrollHeight))},s)}function Ce({prompts:s,enabled:t,typingSpeed:n=38,erasingSpeed:o=18,holdTime:a=2200,betweenTime:r=380,manualPauseMs:i=5e3}){const[l,m]=u.useState(0),[d,f]=u.useState(""),h=u.useRef("typing"),x=u.useRef(0),p=u.useRef(0),j=u.useRef(null),_=u.useRef(0);u.useEffect(()=>{p.current=l},[l]),u.useEffect(()=>{if(j.current&&(clearTimeout(j.current),j.current=null),!t||s.length===0){f(""),x.current=0,h.current="typing";return}const R=()=>{const L=Date.now();if(_.current>L){j.current=setTimeout(R,_.current-L);return}const I=s[p.current%s.length]??"";h.current==="typing"?(x.current+=1,f(I.slice(0,x.current)),x.current>=I.length?(h.current="holding",j.current=setTimeout(R,a)):j.current=setTimeout(R,n+Math.random()*28)):h.current==="holding"?(h.current="erasing",j.current=setTimeout(R,o)):(x.current=Math.max(0,x.current-1),f(I.slice(0,x.current)),x.current<=0?(h.current="typing",p.current=(p.current+1)%s.length,m(p.current),j.current=setTimeout(R,r)):j.current=setTimeout(R,o))};return j.current=setTimeout(R,260),()=>{j.current&&clearTimeout(j.current)}},[t,s,n,o,a,r]);const S=R=>{if(s.length===0)return;const L=(R%s.length+s.length)%s.length,I=s[L];p.current=L,x.current=I.length,h.current="holding",_.current=Date.now()+i,m(L),f(I)},$=()=>S(p.current+1),B=()=>S(p.current-1),E=s[l%s.length]??"";return{displayed:d,currentPrompt:E,index:l,next:$,prev:B}}let st=0;function tt({value:s="",onChange:t,onSubmit:n,onStop:o,onKeyDown:a,loading:r=!1,disabled:i=!1,placeholder:l="Let's get things done...",animatedPlaceholders:m,attachments:d,images:f,onAttachFiles:h,onAttachImages:x,onRemoveAttachment:p,onRemoveImage:j,acceptImage:_,acceptFile:S,maxImages:$,maxImageSize:B,leftSlot:E,rightSlot:R,className:L="",...I}){const V=u.useRef(null),H=u.useRef(null),C=u.useRef(0),[w,O]=u.useState(!1),[q,W]=u.useState([]),b=v=>{const D=++st;W(U=>[...U,{id:D,msg:v}]),setTimeout(()=>W(U=>U.filter(G=>G.id!==D)),6e3)},N=v=>W(D=>D.filter(U=>U.id!==v)),T=v=>v.type.startsWith("image/"),P=()=>!0,Y=_??T,X=S??P,k=v=>{const D=[],U=[],G=[],K=[];let Z=0,re=$!=null?$-((f==null?void 0:f.length)??0):1/0;for(const Q of v)Y(Q)?B&&Q.size>B?G.push(Q.name):re>0?(D.push(Q),re--):Z++:X(Q)?U.push(Q):K.push(Q.name);return{imageFiles:D,docFiles:U,tooLarge:G,skipped:K,limitExceeded:Z}},c=v=>{const{imageFiles:D,docFiles:U,tooLarge:G,skipped:K,limitExceeded:Z}=k(v);G.length&&b(`File${G.length>1?"s":""} too large${B?` (max ${B/1024/1024}MB)`:""}: ${G.join(", ")}`),K.length&&b(`Skipped unsupported file${K.length>1?"s":""}: ${K.join(", ")}`),Z&&b(`Max ${$} images per message`),x&&D.length&&x(D);const re=U.concat(x?[]:D);h&&re.length&&h(re)};u.useEffect(()=>{const v=H.current;v&&(v.style.height="auto",v.style.height=`${Math.min(v.scrollHeight,200)}px`)},[s]),u.useEffect(()=>{const v=D=>{var G,K,Z;if(r||i)return;const U=(G=D.target)==null?void 0:G.tagName;U==="INPUT"||U==="TEXTAREA"||U==="SELECT"||(K=D.target)!=null&&K.isContentEditable||D.ctrlKey||D.metaKey||D.altKey||D.key.length!==1&&D.key!=="Backspace"&&D.key!=="Delete"||(Z=H.current)==null||Z.focus()};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[r,i]);const y=v=>{v.preventDefault(),C.current++,v.dataTransfer.types.includes("Files")&&O(!0)},M=v=>{v.preventDefault(),C.current--,C.current===0&&O(!1)},z=v=>v.preventDefault(),ee=v=>{v.preventDefault(),C.current=0,O(!1);const D=Array.from(v.dataTransfer.files);D.length&&c(D)},te=v=>{const D=Array.from(v.target.files||[]);V.current&&(V.current.value=""),D.length&&c(D)},F=v=>{var Q;if(!x)return;const D=(Q=v.clipboardData)==null?void 0:Q.items;if(!D)return;const U=[];for(const We of D){const Ne=We.getAsFile();Ne&&U.push(Ne)}if(U.length===0)return;const{imageFiles:G,tooLarge:K,skipped:Z,limitExceeded:re}=k(U);K.length&&b(`File${K.length>1?"s":""} too large: ${K.join(", ")}`),Z.length&&b(`Skipped unsupported file${Z.length>1?"s":""}: ${Z.join(", ")}`),re&&b(`Max ${$} images per message`),G.length&&(v.preventDefault(),x(G))},J=!r&&!i&&!!(m!=null&&m.length)&&s.length===0,ne=Ce({prompts:m??[],enabled:J}),me=v=>{if(J){if(v.key==="ArrowDown"||v.key==="ArrowRight"){v.preventDefault(),ne.next();return}if(v.key==="ArrowUp"||v.key==="ArrowLeft"){v.preventDefault(),ne.prev();return}if(v.key==="Tab"&&!v.shiftKey){v.preventDefault(),t==null||t(ne.currentPrompt);return}}a==null||a(v)},Oe=(s.trim()||(f==null?void 0:f.length)>0||(d==null?void 0:d.length)>0)&&!i,we=h||x;return e.jsxs("div",{className:["ds-prompt-input",L].filter(Boolean).join(" "),...I,children:[we&&e.jsx("input",{ref:V,type:"file",multiple:!0,accept:"*/*",className:"ds-prompt-input__file-input",onChange:te}),e.jsxs("div",{className:["ds-prompt-input__box",w&&"ds-prompt-input__box--dragging"].filter(Boolean).join(" "),onDragEnter:y,onDragLeave:M,onDragOver:z,onDrop:ee,children:[w&&e.jsx("div",{className:"ds-prompt-input__drag-overlay",children:"Drop files here"}),e.jsx("textarea",{ref:H,value:s,onChange:v=>t==null?void 0:t(v.target.value),onKeyDown:me,onPaste:F,placeholder:J?"":l,disabled:r||i,rows:1,className:["ds-prompt-input__textarea",J&&"ds-prompt-input__textarea--anim"].filter(Boolean).join(" ")}),J&&e.jsxs("div",{className:"ds-prompt-input__anim","aria-hidden":"true",children:[e.jsx("span",{className:"ds-prompt-input__anim-text",children:ne.displayed}),e.jsx("span",{className:"ds-prompt-input__anim-cursor"})]}),f&&f.length>0&&e.jsx("div",{className:"ds-prompt-input__images",children:f.map((v,D)=>e.jsxs("div",{className:"ds-prompt-input__image-thumb",children:[e.jsx("img",{src:v.preview,alt:""}),e.jsx("button",{className:"ds-prompt-input__image-remove",onClick:()=>j==null?void 0:j(D),"aria-label":"Remove image",type:"button",children:e.jsx(g.X,{size:12,strokeWidth:2})})]},D))}),q.length>0&&e.jsx("div",{className:"ds-prompt-input__warnings",children:q.map(v=>e.jsxs("div",{className:"ds-prompt-input__warning",role:"alert",children:[e.jsx("span",{children:v.msg}),e.jsx("button",{type:"button",className:"ds-prompt-input__warning-close",onClick:()=>N(v.id),"aria-label":"Dismiss",children:e.jsx(g.X,{size:A[1],strokeWidth:1.5})})]},v.id))}),d&&d.length>0&&e.jsx("div",{className:"ds-prompt-input__attachments",children:d.map((v,D)=>e.jsx(ae,{size:"xs",children:e.jsxs("span",{className:"ds-prompt-input__badge-content",children:[v.uploading?e.jsx(g.Loader,{size:A[1],strokeWidth:1.5,className:"spin"}):e.jsx(g.Paperclip,{size:A[1],strokeWidth:1.5}),v.filename,v.uploading?e.jsx("span",{className:"ds-prompt-input__uploading",children:"Uploading..."}):e.jsx("button",{type:"button",className:"ds-prompt-input__remove-btn",onClick:()=>p==null?void 0:p(D),children:e.jsx(g.X,{size:A[1],strokeWidth:1.5})})]})},D))}),e.jsxs("div",{className:"ds-prompt-input__toolbar",children:[we&&e.jsx(ie,{variant:"ghost",size:"xs",icon:e.jsx(g.Paperclip,{size:A[2],strokeWidth:1.5}),"aria-label":"Attach files",onClick:()=>{var v;return(v=V.current)==null?void 0:v.click()}}),E,R,e.jsx("div",{className:"ds-prompt-input__spacer"}),r?e.jsx(ie,{variant:"primary",size:"xs",icon:e.jsx(g.Square,{size:A[2],strokeWidth:1.5}),onClick:o,"aria-label":"Stop"}):e.jsx(ie,{variant:"primary",size:"xs",icon:e.jsx(g.ArrowUp,{size:A[2],strokeWidth:1.5}),onClick:n,disabled:!Oe,"aria-label":"Send"})]})]})]})}const Ee={fast:0,standard:1,premium:2},Te={fast:"data-5",standard:"data-3",premium:"data-6"};function nt({models:s=[],value:t,onChange:n,size:o="xs",minTier:a,showAutoOption:r=!1,groupByTier:i=!0,className:l="",...m}){const[d,f]=u.useState(!1),h=u.useRef(null),x=u.useRef(null),p=u.useRef(null),[j,_]=u.useState({}),S=s.filter(w=>!a||w.name==="auto"?!0:(Ee[w.tier]??1)>=(Ee[a]??1)),$=S.find(w=>w.name==="auto"),B=S.filter(w=>w.name!=="auto"),E=s.find(w=>w.name===t),L=new Set(B.map(w=>w.tier).filter(Boolean)).size>1;u.useEffect(()=>{if(!d)return;const w=320,O=()=>{var P;const b=(P=x.current)==null?void 0:P.getBoundingClientRect();if(!b)return;const N=window.innerHeight-b.bottom,T=N<w+8&&b.top>N;_({position:"fixed",zIndex:"var(--z-dropdown, 500)",left:b.left,...T?{bottom:window.innerHeight-b.top+4,top:"auto"}:{top:b.bottom+4,bottom:"auto"}})};O(),window.addEventListener("scroll",O,!0),window.addEventListener("resize",O);const q=b=>{var N,T;!((N=h.current)!=null&&N.contains(b.target))&&!((T=p.current)!=null&&T.contains(b.target))&&f(!1)},W=b=>{b.key==="Escape"&&f(!1)};return document.addEventListener("mousedown",q),document.addEventListener("keydown",W),()=>{window.removeEventListener("scroll",O,!0),window.removeEventListener("resize",O),document.removeEventListener("mousedown",q),document.removeEventListener("keydown",W)}},[d]);const I=w=>{n==null||n(w),f(!1)},V=w=>e.jsxs("button",{type:"button",className:["ds-model-picker__item",w.name===t&&"ds-model-picker__item--active"].filter(Boolean).join(" "),onClick:()=>I(w.name),children:[w.icon?e.jsx("span",{className:"ds-model-picker__item-icon",children:w.icon}):e.jsx(g.Cpu,{size:12,strokeWidth:1.5,className:"ds-model-picker__item-icon"}),e.jsx("span",{className:"ds-model-picker__item-name",children:w.displayName||w.name}),L&&w.tier&&e.jsx(ae,{size:"xs",variant:Te[w.tier]||"default",children:w.tier})]},w.name),H=()=>!i||!L?B.map(V):["fast","standard","premium"].flatMap(w=>{const O=B.filter(q=>q.tier===w);return O.length?[e.jsx("div",{className:"ds-model-picker__group-label","data-tier":w,children:w.charAt(0).toUpperCase()+w.slice(1)},`lbl-${w}`),...O.map(V)]:[]}),C=d&&e.jsxs("div",{ref:p,className:"ds-model-picker__menu",style:j,children:[r&&$&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:["ds-model-picker__item","ds-model-picker__item--auto",t==="auto"&&"ds-model-picker__item--active"].filter(Boolean).join(" "),onClick:()=>I("auto"),children:[e.jsx(g.Zap,{size:12,strokeWidth:1.5,className:"ds-model-picker__item-icon"}),e.jsx("span",{className:"ds-model-picker__item-name",children:"Auto (smart routing)"})]}),B.length>0&&e.jsx("div",{className:"ds-model-picker__separator"})]}),H()]});return e.jsxs("div",{ref:h,className:["ds-model-picker",l].filter(Boolean).join(" "),...m,children:[e.jsxs("button",{ref:x,type:"button",className:"ds-model-picker__trigger",onClick:()=>f(w=>!w),"aria-haspopup":"listbox","aria-expanded":d,children:[E!=null&&E.icon?e.jsx("span",{children:E.icon}):e.jsx(g.Cpu,{size:12,strokeWidth:1.5}),e.jsx("span",{className:"ds-model-picker__trigger-name",children:(E==null?void 0:E.displayName)||(E==null?void 0:E.name)||t}),L&&(E==null?void 0:E.tier)&&e.jsx(ae,{size:"xs",variant:Te[E.tier]||"default",children:E.tier})]}),typeof document<"u"&&ue.createPortal(C,document.body)]})}const rt=({filename:s,pages:t})=>e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"var(--space-2)",minWidth:0},children:[e.jsx("span",{className:"ds-sources-panel__filename",children:s}),t.length>0&&e.jsx("span",{className:"ds-sources-panel__pages",children:_e(t)})]});function _e(s){return s!=null&&s.length?"p. "+s.join(", "):null}function at(s){const t=new Map;for(const n of s)t.has(n.filename)||t.set(n.filename,{filename:n.filename,url:n.url,items:[]}),t.get(n.filename).items.push(n);return[...t.values()]}function ot({sources:s=[],layout:t="list",title:n="Sources",maxVisible:o=5,onSourceClick:a}){const[r,i]=u.useState(!1),l=at(s),m=l.length>o,d=r?l:l.slice(0,o),f=s.some(x=>x.snippet),h=["ds-sources-panel",t==="compact"&&"ds-sources-panel--compact"].filter(Boolean).join(" ");return t==="compact"?e.jsxs("div",{className:h,children:[d.map(x=>{const p=x.items.map(_=>_.page).filter(Boolean),j=!!a;return e.jsxs("div",{className:`ds-sources-panel__compact-row${j?" ds-sources-panel__compact-row--clickable":""}`,onClick:j?()=>a(x.items[0]):void 0,children:[e.jsx(g.FileText,{size:A[1],strokeWidth:1.5,className:"ds-sources-panel__compact-icon"}),e.jsx("span",{className:"ds-sources-panel__filename",children:x.filename}),p.length>0&&e.jsx("span",{className:"ds-sources-panel__pages",children:_e(p)})]},x.filename)}),m&&!r&&e.jsxs("button",{className:"ds-sources-panel__more",onClick:()=>i(!0),children:["+",l.length-o," more sources"]})]}):e.jsxs("div",{className:h,children:[n&&e.jsx("div",{className:"ds-sources-panel__title",children:n}),d.map(x=>{const p=x.items.map(_=>_.page).filter(Boolean),j=!!a;return f?e.jsx(fe,{title:e.jsx(rt,{filename:x.filename,pages:p}),padding:"s",children:x.items.map((_,S)=>e.jsx("div",{className:`ds-sources-panel__snippet${j?" ds-sources-panel__snippet--clickable":""}`,onClick:j?()=>a(_):void 0,children:_.snippet??`p. ${_.page}`},S))},x.filename):e.jsxs("div",{className:`ds-sources-panel__row${j?" ds-sources-panel__row--clickable":""}`,onClick:j?()=>a(x.items[0]):void 0,children:[e.jsx("span",{className:"ds-sources-panel__filename",children:x.filename}),p.length>0&&e.jsx("span",{className:"ds-sources-panel__pages",children:_e(p)})]},x.filename)}),m&&!r&&e.jsxs("button",{className:"ds-sources-panel__more",onClick:()=>i(!0),children:["+",l.length-o," more sources"]})]})}function $e(s){return s>=1e6?(s/1e6).toFixed(1).replace(/\.0$/,"")+"M":s>=1e3?(s/1e3).toFixed(1).replace(/\.0$/,"")+"K":String(s)}function it({used:s,limit:t,size:n="s",showCount:o=!0,showPercent:a=!1,warningThreshold:r=.8,errorThreshold:i=1}){const l=t>0?s/t:0,m=Math.min(l*100,100),d=l>=i?"error":l>=r?"warning":"normal";return e.jsxs("div",{className:`ds-token-counter ds-token-counter--${n}`,role:"meter","aria-valuenow":s,"aria-valuemax":t,children:[e.jsx("div",{className:"ds-token-counter__track",children:e.jsx("div",{className:`ds-token-counter__fill ds-token-counter__fill--${d}`,style:{width:`${m}%`}})}),(o||a)&&e.jsxs("div",{className:`ds-token-counter__label ds-token-counter__label--${d}`,children:[o&&e.jsxs("span",{children:[$e(s)," / ",$e(t)," tokens"]}),a&&e.jsxs("span",{children:[Math.round(l*100),"%"]})]})]})}const Re=5;function lt(s){return s<.34?"low":s<.67?"medium":"high"}function ct({value:s=0,size:t="xs",showLabel:n="none",layout:o="inline"}){const a=Math.max(0,Math.min(1,s)),r=Math.round(a*Re),i=lt(a);return e.jsxs("div",{className:["ds-confidence-bar",`ds-confidence-bar--${t}`,`ds-confidence-bar--${i}`,o==="block"&&"ds-confidence-bar--block"].filter(Boolean).join(" "),children:[e.jsx("div",{className:"ds-confidence-bar__segments","aria-hidden":"true",children:Array.from({length:Re},(l,m)=>e.jsx("div",{className:`ds-confidence-bar__seg${m<r?" ds-confidence-bar__seg--filled":""}`},m))}),n==="text"&&e.jsx("span",{className:"ds-confidence-bar__label",children:i})]})}const dt={add:"+",remove:"-",context:" "};function pe({line:s,lineNumbers:t}){return e.jsxs("div",{className:`ds-diff-view__line ds-diff-view__line--${s.type}`,children:[t&&s.lineNo!=null&&e.jsx("span",{className:"ds-diff-view__lineno",children:s.lineNo}),e.jsx("span",{className:"ds-diff-view__prefix",children:dt[s.type]}),e.jsx("span",{className:"ds-diff-view__text",children:s.text})]})}function ut({lines:s=[],layout:t="inline",wordWrap:n=!1,lineNumbers:o=!0,maxHeight:a,title:r}){const i=["ds-diff-view",`ds-diff-view--${t}`,n&&"ds-diff-view--wrap"].filter(Boolean).join(" "),l=a?{maxHeight:a,overflowY:"auto"}:void 0;if(t==="split"){const m=s.filter(f=>f.type==="remove"||f.type==="context"),d=s.filter(f=>f.type==="add"||f.type==="context");return e.jsxs("div",{className:i,children:[r&&e.jsx("div",{className:"ds-diff-view__title",children:r}),e.jsxs("div",{className:"ds-diff-view__body",style:l,children:[e.jsx("div",{className:"ds-diff-view__split-col",children:m.map((f,h)=>e.jsx(pe,{line:f,lineNumbers:o},h))}),e.jsx("div",{className:"ds-diff-view__split-col",children:d.map((f,h)=>e.jsx(pe,{line:f,lineNumbers:o},h))})]})]})}return e.jsxs("div",{className:i,children:[r&&e.jsx("div",{className:"ds-diff-view__title",children:r}),e.jsx("div",{className:"ds-diff-view__body",style:l,children:s.map((m,d)=>e.jsx(pe,{line:m,lineNumbers:o},d))})]})}function Fe({value:s="idle",onLike:t,onDislike:n,className:o="",...a}){const r=s!=="idle";return e.jsxs("div",{className:["ds-message-feedback",r&&"ds-message-feedback--voted",o].filter(Boolean).join(" "),...a,children:[(!r||s==="liked")&&e.jsx("button",{className:["ds-message-feedback__btn",s==="liked"&&"ds-message-feedback__btn--liked"].filter(Boolean).join(" "),onClick:t,disabled:r,"aria-label":"Like","aria-pressed":s==="liked",children:e.jsx(g.ThumbsUp,{size:A[1],strokeWidth:1.5,fill:s==="liked"?"currentColor":"none"})}),(!r||s==="disliked")&&e.jsx("button",{className:["ds-message-feedback__btn",s==="disliked"&&"ds-message-feedback__btn--disliked"].filter(Boolean).join(" "),onClick:n,disabled:r,"aria-label":"Dislike","aria-pressed":s==="disliked",children:e.jsx(g.ThumbsDown,{size:A[1],strokeWidth:1.5,fill:s==="disliked"?"currentColor":"none"})})]})}function ft(s){const t=s instanceof Date?s:new Date(s);if(isNaN(t))return null;const n=new Date,o=t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),a=new Date(n.getFullYear(),n.getMonth(),n.getDate()),r=new Date(a-864e5);if(t>=a)return o;if(t>=r)return`Yesterday ${o}`;const i=t.getDate(),l=t.toLocaleString([],{month:"short"});return`${i} ${l} ${o}`}function mt({role:s="assistant",text:t,timestamp:n,feedbackValue:o="idle",onLike:a,onDislike:r,className:i="",...l}){const m=s==="assistant"&&(a||r),d=!!t,f=n?ft(n):null;return!m&&!d&&!f?null:e.jsxs("div",{className:["ds-message-footer",`ds-message-footer--${s}`,i].filter(Boolean).join(" "),...l,children:[s==="user"&&f&&e.jsx("span",{className:"ds-message-footer__timestamp ds-message-action",children:f}),m&&e.jsx(Fe,{className:"ds-message-action",value:o,onLike:a,onDislike:r}),d&&e.jsx(ze,{className:"ds-message-action",text:t}),s==="assistant"&&f&&e.jsx("span",{className:"ds-message-footer__timestamp ds-message-action",children:f})]})}function pt({label:s,className:t="",...n}){return e.jsxs("span",{className:["ds-thinking-dot",t].filter(Boolean).join(" "),...n,children:[e.jsx("span",{className:"ds-thinking-dot__pulse"}),s&&e.jsx("span",{className:"ds-thinking-dot__label",children:s})]})}function ht({variant:s="light",glow:t,mask:n=!0,style:o,...a}){const r=s==="dark",i=t??r,l=r?"rgba(255,250,250,0.05)":"var(--color-border-light)",m=r?"rgba(255,250,250,0.025)":"color-mix(in srgb, var(--color-border-light) 50%, transparent)";return e.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none",overflow:"hidden",zIndex:0,...i&&{background:"radial-gradient(ellipse 1000px 500px at 50% 30%, rgba(234,100,100,0.18), transparent 70%)"},...o},...a,children:e.jsx("div",{style:{position:"absolute",inset:0,backgroundImage:[`linear-gradient(${l} 1px, transparent 1px)`,`linear-gradient(90deg, ${l} 1px, transparent 1px)`,`linear-gradient(${m} 1px, transparent 1px)`,`linear-gradient(90deg, ${m} 1px, transparent 1px)`].join(", "),backgroundSize:"80px 80px, 80px 80px, 16px 16px, 16px 16px",backgroundPosition:"-1px -1px, -1px -1px, -1px -1px, -1px -1px",...n&&{WebkitMaskImage:"radial-gradient(ellipse at center, #000 30%, transparent 85%)",maskImage:"radial-gradient(ellipse at center, #000 30%, transparent 85%)"}}})})}exports.Accordion=fe;exports.Alert=ns;exports.AnimatedNumber=Ws;exports.Avatar=vs;exports.Badge=ae;exports.Banner=Ls;exports.Breadcrumb=Ds;exports.Button=ie;exports.Card=Ke;exports.ChatMessage=Qs;exports.Checkbox=hs;exports.Code=os;exports.CodeAccordion=Ae;exports.ConfidenceBar=ct;exports.CopyButton=ze;exports.DiffView=ut;exports.Drawer=Ps;exports.DrawerFooter=be;exports.Dropdown=zs;exports.EmptyState=$s;exports.EngineerGrid=ht;exports.FormField=Rs;exports.H1=Je;exports.H2=Ze;exports.H3=Qe;exports.H4=es;exports.InView=Us;exports.Input=Ye;exports.Link=is;exports.MessageFeedback=Fe;exports.MessageFooter=mt;exports.Modal=as;exports.ModalFooter=xe;exports.ModelPicker=nt;exports.P1=ss;exports.P2=De;exports.P3=ve;exports.Pagination=As;exports.ProgressBar=Cs;exports.PromptInput=tt;exports.Radio=xs;exports.ReasoningBlock=Ks;exports.SegmentedControl=ds;exports.Select=Xe;exports.Skeleton=Ie;exports.SourcesPanel=ot;exports.Spinner=Se;exports.Stat=Ss;exports.StepIndicator=Js;exports.Stepper=Ge;exports.StreamingText=Zs;exports.Tab=cs;exports.Table=ws;exports.TableBody=gs;exports.TableHead=Ns;exports.TableRow=ys;exports.TableSubheaderRow=ks;exports.Tabs=ls;exports.Td=Ts;exports.Textarea=qe;exports.Th=Es;exports.ThinkingDot=pt;exports.ToastContainer=Xs;exports.Toggle=ps;exports.TokenCounter=it;exports.ToolCallBubble=Le;exports.ToolCallCard=Le;exports.Tooltip=ms;exports.iconSizes=A;exports.useAnimatedNumber=Be;exports.useAnimatedPlaceholder=Ce;exports.useInView=Pe;exports.useStreamScroll=et;exports.useToast=Ys;
|