@donkit-ai/design-system 1.4.10 → 1.4.12
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.d.ts +1 -9
- package/dist/index.es.js +284 -304
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var ge;function
|
|
9
|
+
*/var ge;function Ue(){if(ge)return ce;ge=1;var s=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(o,a,n){var i=null;if(n!==void 0&&(i=""+n),a.key!==void 0&&(i=""+a.key),"key"in a){n={};for(var l in a)l!=="key"&&(n[l]=a[l])}else n=a;return a=n.ref,{$$typeof:s,type:o,key:i,ref:a!==void 0?a:null,props:n}}return ce.Fragment=t,ce.jsx=r,ce.jsxs=r,ce}var de={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -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
|
|
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===C?null:c.displayName||c.name||null;if(typeof c=="string")return c;switch(c){case A:return"Fragment";case B:return"Profiler";case S:return"StrictMode";case I:return"Suspense";case V:return"SuspenseList";case N: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 v:return"Portal";case R:return c.displayName||"Context";case E:return(c._context.displayName||"Context")+".Consumer";case F:var y=c.render;return c=c.displayName,c||(c=y.displayName||y.name||"",c=c!==""?"ForwardRef("+c+")":"ForwardRef"),c;case Y:return y=c.displayName||null,y!==null?y:s(c.type)||"Memo";case P:y=c._payload,c=c._init;try{return s(c(y))}catch{}}return null}function t(c){return""+c}function r(c){try{t(c);var y=!1}catch{y=!0}if(y){y=console;var L=y.error,z=typeof Symbol=="function"&&Symbol.toStringTag&&c[Symbol.toStringTag]||c.constructor.name||"Object";return L.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===A)return"<>";if(typeof c=="object"&&c!==null&&c.$$typeof===P)return"<...>";try{var y=s(c);return y?"<"+y+">":"<...>"}catch{return"<...>"}}function a(){var c=q.A;return c===null?null:c.getOwner()}function n(){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 L(){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))}L.isReactWarning=!0,Object.defineProperty(c,"key",{get:L,configurable:!0})}function p(){var c=s(this.type);return M[c]||(M[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,L,z,ee,te){var O=L.ref;return c={$$typeof:_,type:c,key:y,props:L,_owner:z},(O!==void 0?O:null)!==null?Object.defineProperty(c,"ref",{enumerable:!1,get:p}):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 m(c,y,L,z,ee,te){var O=y.children;if(O!==void 0)if(z)if(b(O)){for(z=0;z<O.length;z++)h(O[z]);Object.freeze&&Object.freeze(O)}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(O);if(W.call(y,"key")){O=s(c);var J=Object.keys(y).filter(function(me){return me!=="key"});z=0<J.length?"{key: someKey, "+J.join(": ..., ")+": ...}":"{key: someKey}",k[O+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,L!==void 0&&(r(L),C=""+L),i(y)&&(r(y.key),C=""+y.key),"key"in y){L={};for(var ne in y)ne!=="key"&&(L[ne]=y[ne])}else L=y;return C&&l(L,typeof c=="function"?c.displayName||c.name||"Unknown":c),d(c,C,L,a(),se,re)}function h(c){x(c)?c._store&&(c._store.validated=1):typeof c=="object"&&c!==null&&c.$$typeof===P&&(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 u=f,_=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),$=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),V=Symbol.for("react.suspense_list"),Y=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),O=Symbol.for("react.client.reference"),q=u.__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};u={react_stack_bottom_frame:function(c){return c()}};var T,M={},H=u.react_stack_bottom_frame.bind(u,n)(),X=N(o(n)),k={};de.Fragment=A,de.jsx=function(c,y,L){var F=1e4>q.recentlyCreatedOwnerStacks++;return m(c,y,L,!1,F?Error("react-stack-top-frame"):H,F?N(o(c)):X)},de.jsxs=function(c,y,L){var F=1e4>q.recentlyCreatedOwnerStacks++;return m(c,y,L,!0,F?Error("react-stack-top-frame"):H,F?N(o(c)):X)}}()),de}process.env.NODE_ENV==="production"?he.exports=We():he.exports=Ue();var e=he.exports;function Se({size:s="m",color:t="default",className:r="",...o}){return e.jsx("span",{className:["ds-spinner",`ds-spinner--${s}`,`ds-spinner--${t}`,r].filter(Boolean).join(" "),role:"status","aria-label":"Loading",...o})}const Ve={xs:12,s:14,m:16,l:20};function ie({children:s,variant:t="primary",size:r="m",fullWidth:o=!1,icon:a,disabled:n=!1,state:i="idle",onClick:l,type:p="button",href:d,"aria-label":m,className:h="",...x}){const u=a&&!s,_=i==="loading",v=i==="success",A=i==="error",S=_||v||A,B=r==="xs"?"s":"m",E=Ve[r]??16,$=_?e.jsx(Se,{size:B}):v?e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:e.jsx(g.Check,{size:E,strokeWidth:2.5})}):A?e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:e.jsx(g.X,{size:E,strokeWidth:2.5})}):null,z=["ds-button",`ds-button--${t}`,`ds-button--${r}`,o&&"ds-button--full",u&&"ds-button--icon-only",h].filter(Boolean).join(" "),I=i!=="idle"?i:void 0,V=e.jsxs(e.Fragment,{children:[S?$:a&&e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:a}),s]});if(d){const Y=P=>{if(n||_){P.preventDefault();return}P.metaKey||P.ctrlKey||P.button===1||(P.preventDefault(),l==null||l(P))};return e.jsx("a",{className:z,href:n||_?void 0:d,onClick:Y,"aria-label":m,"aria-disabled":n||_?"true":void 0,"aria-busy":_?"true":void 0,"data-state":I,...x,children:V})}return e.jsx("button",{type:p,className:z,disabled:n,onClick:_?void 0:l,"aria-label":m,"aria-busy":_?"true":void 0,"data-state":I,...x,children:V})}function He({label:s,error:t,hint:r,fullWidth:o=!0,icon:a,iconRight:n,onIconRightClick:i,size:l="m",disabled:p,id:d,...m}){const h=d||`input-${f.useId()}`,x=r?`${h}-hint`:void 0,u=t?`${h}-error`:void 0,_=u||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":""} ${n?"ds-input--with-icon-right":""} ${t?"ds-input--error":""}`,disabled:p,"aria-invalid":t?"true":"false","aria-describedby":_,...m}),n&&e.jsx("button",{type:"button",className:`ds-input-icon-right ds-input-icon-right--${l}`,onClick:i,tabIndex:-1,"aria-label":"Toggle visibility",children:n})]}),r&&!t&&e.jsx("span",{id:x,className:"ds-input-hint",children:r}),e.jsx("div",{className:"ds-input-error-wrap",children:e.jsx("div",{className:"ds-input-error-inner",children:t&&e.jsx("span",{id:u,className:"ds-input-error",role:"alert",children:t})})})]})}function Ye({label:s,error:t,hint:r,fullWidth:o=!0,size:a="m",disabled:n,id:i,resize:l=!0,rows:p=3,...d}){const m=i||`textarea-${f.useId()}`,h=r?`${m}-hint`:void 0,x=t?`${m}-error`:void 0,u=x||h;return e.jsxs("div",{className:`ds-textarea-wrapper ${o?"ds-textarea-wrapper--full":""} ${n?"ds-textarea-wrapper--disabled":""}`,children:[s&&e.jsx("label",{className:"ds-textarea-label",htmlFor:m,children:s}),e.jsx("textarea",{id:m,className:`ds-textarea ds-textarea--${a} ${t?"ds-textarea--error":""} ${l?"":"ds-textarea--no-resize"}`,disabled:n,"aria-invalid":t?"true":"false","aria-describedby":u,rows:p,...d}),r&&!t&&e.jsx("span",{id:h,className:"ds-textarea-hint",children:r}),t&&e.jsx("span",{id:x,className:"ds-textarea-error",role:"alert",children:t})]})}function qe({label:s,value:t,onChange:r,options:o=[],placeholder:a="Select option",error:n,fullWidth:i=!0,size:l="m",disabled:p=!1,id:d,...m}){const[h,x]=f.useState(!1),[u,_]=f.useState(!1),[v,A]=f.useState({}),[S,B]=f.useState("down"),[E,$]=f.useState(-1),z=f.useRef(null),I=f.useRef(null),V=f.useRef(null),Y=f.useRef(null),P=d||`select-${f.useId()}`,w=`${P}-label`,O=n?`${P}-error`:void 0,q=150,W=(k=!1)=>{u||(_(!0),$(-1),Y.current=setTimeout(()=>{var c;x(!1),_(!1),k&&((c=V.current)==null||c.focus())},q))},b=k=>{clearTimeout(Y.current),_(!1);const c=k!==void 0?k:Math.max(o.findIndex(y=>y.value===t),0);$(c),x(!0)};f.useEffect(()=>()=>clearTimeout(Y.current),[]);const N=()=>{var re;const k=(re=z.current)==null?void 0:re.getBoundingClientRect();if(!k)return;const c=window.innerHeight,y=c-k.bottom,L=k.top,se=y<300&&L>y;B(se?"up":"down"),A(se?{bottom:c-k.top+4,left:k.left,width:k.width}:{top:k.bottom+4,left:k.left,width:k.width})};f.useEffect(()=>{if(h)return N(),window.addEventListener("scroll",N,!0),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",N)}},[h]),f.useEffect(()=>{const k=c=>{z.current&&!z.current.contains(c.target)&&I.current&&!I.current.contains(c.target)&&W()};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[u]),f.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&&(r==null||r(o[E].value),W(!0)):b();break;case"Escape":h&&(k.preventDefault(),W(!0));break;case"Tab":h&&W(!1);break}},M=o.find(k=>k.value===t),H=l==="xs"?D[1]:l==="small"?D[2]:D[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--${S}`,u&&"ds-select-dropdown--closing"].filter(Boolean).join(" "),style:v,children:o.map((k,c)=>e.jsx("button",{id:`${P}-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:()=>{r==null||r(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:w,className:"ds-select-label",children:s}),e.jsx("div",{className:"ds-select-container",ref:z,children:e.jsxs("button",{ref:V,type:"button",id:P,role:"combobox","aria-haspopup":"listbox","aria-expanded":h,"aria-activedescendant":h&&E>=0?`${P}-opt-${E}`:void 0,"aria-labelledby":s?w:void 0,"aria-invalid":n?"true":"false","aria-describedby":O,className:`ds-select-trigger ds-select-trigger--${l} ${n?"ds-select-trigger--error":""}`,onClick:()=>{p||(h?W():b())},onKeyDown:T,disabled:p,...m,children:[e.jsx("span",{className:M?"":"ds-select-placeholder",children:(M==null?void 0:M.label)||a}),e.jsx(g.ChevronDown,{size:H,strokeWidth:1.5,className:`ds-select-icon ${h&&S==="down"?"ds-select-icon--open":""} ${h&&S==="up"?"ds-select-icon--up":""}`,"aria-hidden":"true"})]})}),n&&e.jsx("span",{id:O,className:"ds-select-error",role:"alert",children:n}),typeof document<"u"&&ue.createPortal(X,document.body)]})}function Xe({label:s,value:t=0,onChange:r,min:o=0,max:a=100,step:n=1,size:i="m",disabled:l=!1,hint:p,error:d,...m}){const h=()=>{if(l)return;const S=Math.min(Number(t)+n,a);r==null||r(S)},x=()=>{if(l)return;const S=Math.max(Number(t)-n,o);r==null||r(S)},u=S=>{if(l)return;const B=S.target.value;if(B===""){r==null||r(o);return}const E=Number(B);if(!isNaN(E)){const $=Math.min(Math.max(E,o),a);r==null||r($)}},_=["ds-stepper-wrapper",l&&"ds-stepper-wrapper--disabled",d&&"ds-stepper-wrapper--error"].filter(Boolean).join(" "),v=["ds-stepper",`ds-stepper--${i}`,l&&"ds-stepper--disabled"].filter(Boolean).join(" "),A=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:v,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:A,strokeWidth:1.5})}),e.jsx("input",{type:"number",className:"ds-stepper-input",value:t,onChange:u,min:o,max:a,step:n,disabled:l,...m}),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:A,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 Ke({children:s,padding:t="m",variant:r="info",hover:o=!1,onClick:a,href:n,disabled:i=!1,...l}){const d=(o?"interactive":r)==="interactive"||a||n,m=["ds-card",`ds-card--${t}`,d&&"ds-card--interactive"].filter(Boolean).join(" ");if(n){const u=_=>{if(i){_.preventDefault();return}_.metaKey||_.ctrlKey||_.button===1||(_.preventDefault(),a==null||a(_))};return e.jsx("a",{className:m,href:i?void 0:n,onClick:u,"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:m,role:d&&!a?"article":void 0,...x,...l,children:s})}function Ge({children:s,...t}){return e.jsx("h1",{className:"ds-h1",...t,children:s})}function Je({children:s,...t}){return e.jsx("h2",{className:"ds-h2",...t,children:s})}function Ze({children:s,...t}){return e.jsx("h3",{className:"ds-h3",...t,children:s})}function Qe({children:s,...t}){return e.jsx("h4",{className:"ds-h4",...t,children:s})}function es({children:s,secondary:t=!1,...r}){return e.jsx("p",{className:`ds-p1 ${t?"ds-p1--secondary":""}`,...r,children:s})}function Ae({children:s,secondary:t=!1,...r}){return e.jsx("p",{className:`ds-p2 ${t?"ds-p2--secondary":""}`,...r,children:s})}function ve({children:s,secondary:t=!1,...r}){return e.jsx("p",{className:`ds-p3 ${t?"ds-p3--secondary":""}`,...r,children:s})}function ee({children:s,variant:t="default",size:r="m",role:o,...a}){const n=["ds-badge",`ds-badge--${t}`,`ds-badge--${r}`].filter(Boolean).join(" "),i=o||(["info","success","warning","error"].includes(t)?"status":void 0);return e.jsx("span",{className:n,role:i,...a,children:s})}const ss={info:g.Info,success:g.CheckCircle,warning:g.AlertTriangle,error:g.XCircle};function ts({children:s,variant:t="info",title:r,onClose:o,role:a,...n}){const i=ss[t],l=a||(t==="error"?"alert":"status");return e.jsxs("div",{className:`ds-alert ds-alert--${t} ${r?"":"ds-alert--no-title"}`,role:l,...n,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:[r&&e.jsx("div",{className:"ds-alert__title",children:r}),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 ns({children:s,title:t,onClose:r,size:o="m",...a}){const n=f.useRef(null),i=f.useId(),[l,p]=f.useState(!1),d=()=>{!r||l||(p(!0),setTimeout(()=>{p(!1),r()},rs))};f.useEffect(()=>{const u=v=>{v.key==="Escape"&&d()},_=v=>{n.current&&!n.current.contains(v.target)&&d()};return document.addEventListener("keydown",u),document.addEventListener("mousedown",_),()=>{document.removeEventListener("keydown",u),document.removeEventListener("mousedown",_)}},[r,l]);const m=f.Children.toArray(s),h=m.find(u=>(u==null?void 0:u.type)===xe),x=m.filter(u=>(u==null?void 0:u.type)!==xe);return e.jsx("div",{className:["ds-modal-overlay",l&&"ds-modal-overlay--closing"].filter(Boolean).join(" "),...a,children:e.jsxs("div",{className:`ds-modal ds-modal--${o}`,ref:n,role:"dialog","aria-modal":"true","aria-labelledby":t?i:void 0,children:[(t||r)&&e.jsxs("div",{className:"ds-modal__header",children:[t&&e.jsx("h3",{id:i,className:"ds-modal__title",children:t}),r&&e.jsx(ie,{variant:"ghost",size:"small",icon:e.jsx(g.X,{size:D[2],strokeWidth:1.5}),onClick:d,"aria-label":"Close modal"})]}),e.jsx("div",{className:"ds-modal__body",children:x}),h]})})}function xe({children:s}){return e.jsx("div",{className:"ds-modal__footer",children:s})}function De({children:s,title:t="Code",defaultExpanded:r=!1,expanded:o,onToggle:a,padding:n="s",className:i="",...l}){const[p,d]=f.useState(r),m=o!==void 0,h=m?o:p,x=()=>{m?a==null||a(!o):d(_=>!_)},u=["ds-code-accordion",`ds-code-accordion--${n}`,h&&"ds-code-accordion--expanded",i].filter(Boolean).join(" ");return e.jsxs("div",{className:u,...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 as({children:s,block:t=!1,collapsible:r=!1,title:o="Code",defaultExpanded:a=!1,...n}){return t?r?e.jsx(De,{title:o,defaultExpanded:a,...n,children:s}):e.jsx("pre",{className:"ds-code-block",...n,children:e.jsx("code",{children:s})}):e.jsx("code",{className:"ds-code-inline",...n,children:s})}function os({href:s,children:t,onClick:r,target:o,rel:a,...n}){const l=o==="_blank"?a?`${a} noopener noreferrer`:"noopener noreferrer":a;return e.jsx("a",{href:s,className:"ds-link",onClick:r,target:o,rel:l,...n,children:t})}function is({children:s,size:t="m",variant:r="ghost",...o}){return e.jsx("div",{className:"ds-tabs",role:"tablist",...o,children:f.Children.map(s,a=>f.isValidElement(a)?f.cloneElement(a,{size:t,variant:r}):a)})}function ls({children:s,selected:t=!1,onClick:r,size:o="m",variant:a="ghost",disabled:n=!1,icon:i,href:l,...p}){const d=i&&!s,m=["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=u=>{if(n){u.preventDefault();return}u.metaKey||u.ctrlKey||u.button===1||(u.preventDefault(),r==null||r(u))};return e.jsx("a",{role:"tab","aria-current":t?"page":void 0,"aria-disabled":n?"true":void 0,className:m,href:n?void 0:l,onClick:x,...p,children:h})}return e.jsx("button",{role:"tab","aria-selected":t,className:m,onClick:r,disabled:n,...p,children:h})}function cs({options:s,value:t,onChange:r,size:o="m",disabled:a=!1}){const n=f.useRef(null),i=f.useRef(null),[l,p]=f.useState(!1),d=f.useRef(!1),m=f.useRef(null),h=f.useRef(null),x=()=>{if(!n.current)return;const u=n.current.querySelector(`[data-value="${t}"]`);if(!u)return;const _=n.current.getBoundingClientRect(),v=u.getBoundingClientRect(),A=v.left-_.left,S=v.width;i.current?(i.current.style.transition=d.current?"left var(--transition-normal), width var(--transition-normal)":"none",i.current.style.left=A+"px",i.current.style.width=S+"px",d.current=!1):(p(!0),requestAnimationFrame(()=>{if(!i.current||!n.current)return;const B=n.current.querySelector(`[data-value="${t}"]`);if(!B)return;const E=n.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,f.useLayoutEffect(()=>{const u=m.current!==t;m.current=t,d.current=l&&u,x()}),f.useEffect(()=>{if(!n.current)return;const u=new ResizeObserver(()=>{d.current=!1,h.current()});return u.observe(n.current),()=>u.disconnect()},[]),e.jsxs("div",{className:["ds-seg",`ds-seg--${o}`,a&&"ds-seg--disabled"].filter(Boolean).join(" "),ref:n,role:"group",children:[l&&e.jsx("div",{ref:i,className:"ds-seg__pill","aria-hidden":"true"}),s.map(u=>e.jsxs("button",{type:"button","data-value":u.value,className:["ds-seg__btn",t===u.value&&"ds-seg__btn--active"].filter(Boolean).join(" "),onClick:()=>!a&&r(u.value),"aria-pressed":t===u.value,disabled:a,children:[u.icon&&e.jsx("span",{className:"ds-seg__btn-icon","aria-hidden":"true",children:u.icon}),u.label]},u.value))]})}function fe({children:s,title:t,defaultExpanded:r=!1,expanded:o,onToggle:a,padding:n="m",...i}){const[l,p]=f.useState(r),d=o!==void 0,m=d?o:l,h=()=>{d?a==null||a(!o):p(u=>!u)},x=["ds-accordion",`ds-accordion--${n}`,m&&"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":m,children:[e.jsx("span",{className:"ds-accordion__title",children:t}),e.jsx(g.ChevronDown,{size:D[2],strokeWidth:1.5,className:`ds-accordion__icon ${m?"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 te=8,oe=8;function ds(s,t,r){const o=window.innerWidth;let a,n;switch(s){case"top":a=t.top-r.height-te,n=t.left+t.width/2-r.width/2;break;case"bottom":a=t.bottom+te,n=t.left+t.width/2-r.width/2;break;case"left":a=t.top+t.height/2-r.height/2,n=t.left-r.width-te;break;case"right":a=t.top+t.height/2-r.height/2,n=t.right+te;break;default:a=t.bottom+te,n=t.left}const i=Math.max(oe,Math.min(o-r.width-oe,n)),l=n-i;return{top:a,left:i,arrowOffset:l}}function us(s,t,r){const o=window.innerWidth,a=window.innerHeight;if(s.top>=t+te+oe)return"top";if(a-s.bottom>=t+te+oe)return"bottom";if(o-s.right>=r+te+oe)return"right";if(s.left>=r+te+oe)return"left";const n=Math.max(s.top,a-s.bottom,s.left,o-s.right);return n===s.top?"top":n===a-s.bottom?"bottom":n===o-s.right?"right":"left"}function fs({children:s,content:t,position:r,...o}){const[a,n]=f.useState(!1),[i,l]=f.useState({visibility:"hidden"}),[p,d]=f.useState(r||"top"),m=f.useRef(null),h=f.useRef(null),x=f.useRef(!1),u=()=>{if(!m.current||!h.current)return;const v=m.current.getBoundingClientRect(),A=h.current.getBoundingClientRect(),S=r||us(v,A.height,A.width),{top:B,left:E,arrowOffset:$}=ds(S,v,A);d(S),l({position:"fixed",top:B,left:E,visibility:"visible","--arrow-offset":`${$}px`})};if(f.useEffect(()=>{if(!a)return;l({position:"fixed",visibility:"hidden"});const v=requestAnimationFrame(u);return window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),()=>{cancelAnimationFrame(v),window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u)}},[a,r]),f.useEffect(()=>{if(!a)return;const v=A=>{m.current&&!m.current.contains(A.target)&&n(!1)};return document.addEventListener("touchstart",v),()=>document.removeEventListener("touchstart",v)},[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:m,className:"ds-tooltip-wrapper",onMouseEnter:()=>{x.current||n(!0)},onMouseLeave:()=>{x.current||n(!1)},onTouchStart:()=>{x.current=!0,n(v=>!v)},...o,children:[s,typeof document<"u"&&ue.createPortal(_,document.body)]})}function ms({checked:s=!1,onChange:t,size:r="m",disabled:o=!1,label:a,id:n,...i}){const l=n||`toggle-${f.useId()}`,p=["ds-toggle",`ds-toggle--${r}`,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 ps({checked:s=!1,onChange:t,size:r="m",disabled:o=!1,label:a,id:n,...i}){const l=n||`checkbox-${f.useId()}`,p=["ds-checkbox",`ds-checkbox--${r}`,o&&"ds-checkbox--disabled"].filter(Boolean).join(" "),d=r==="xs"?10:r==="small"?14:r==="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:m=>t==null?void 0:t(m.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 hs({checked:s=!1,onChange:t,size:r="m",disabled:o=!1,label:a,name:n,value:i,id:l,...p}){const d=l||`radio-${f.useId()}`,m=["ds-radio",`ds-radio--${r}`,o&&"ds-radio--disabled"].filter(Boolean).join(" ");return e.jsxs("label",{className:m,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:n,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:r="rect",aspectRatio:o,className:a="",style:n={},...i}){return e.jsx("span",{className:["ds-skeleton",`ds-skeleton--${r}`,a].filter(Boolean).join(" "),style:{width:s,height:t,aspectRatio:o,...n},"aria-hidden":"true",...i})}function xs({lines:s=1,lastLineWidth:t="70%",gap:r,className:o="",style:a={},...n}){return e.jsx("span",{className:["ds-skeleton-text",o].filter(Boolean).join(" "),style:{gap:r,...a},"aria-hidden":"true",...n,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=xs;function bs(s){let t=2166136261;for(let r=0;r<s.length;r++)t^=s.charCodeAt(r),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 js({seed:s,icon:t,src:r,size:o=32,className:a="",style:n={},...i}){const l=bs(s??""),[p,d]=f.useState(!1),m=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,...n},"aria-hidden":"true",...i,children:r&&!p?e.jsx("img",{src:r,alt:"",onError:()=>d(!0)}):m})}function vs({children:s,size:t="compact",stickyTop:r,maxHeight:o,className:a="",style:n={},...i}){const l={...o?{maxHeight:o}:{},...r!==void 0?{"--ds-table-sticky-top":typeof r=="number"?`${r}px`:r}:{},...n};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 ws({children:s,...t}){return e.jsx("tbody",{...t,children:s})}function gs({children:s,interactive:t,selected:r,subheader:o,exiting:a,updated:n,className:i="",onClick:l,...p}){return e.jsx("tr",{className:["ds-table-row",t||l?"ds-table-row--interactive":"",r?"ds-table-row--selected":"",o?"ds-table-row--subheader":"",a?"ds-table-row--exiting":"",n?"ds-table-row--updated":"",i].filter(Boolean).join(" "),onClick:l,...p,children:s})}function ys({children:s,colSpan:t=999,...r}){return e.jsx("tr",{className:"ds-table-row ds-table-row--subheader",...r,children:e.jsx("td",{colSpan:t,children:s})})}function ks({children:s,align:t="left",sortDir:r,onSort:o,width:a,className:n="",style:i={},...l}){const p=!!o||r!==void 0,d=r==="asc"?g.ChevronUp:r==="desc"?g.ChevronDown:g.ChevronsUpDown;return e.jsx("th",{className:["ds-th",p?"ds-th--sortable":"",r?"ds-th--sorted":"",t!=="left"?`ds-table-cell--${t}`:"",n].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 Es({children:s,align:t="left",secondary:r,muted:o,truncate:a,nowrap:n,className:i="",...l}){return e.jsx("td",{className:["ds-td",t!=="left"?`ds-table-cell--${t}`:"",r?"ds-table-cell--secondary":"",o?"ds-table-cell--muted":"",a?"ds-table-cell--truncate":"",n?"ds-table-cell--nowrap":"",i].filter(Boolean).join(" "),...l,children:s})}function Ts({icon:s,title:t,description:r,action:o,size:a="m",className:n="",...i}){return e.jsxs("div",{className:["ds-empty-state",`ds-empty-state--${a}`,n].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}),r&&e.jsx("div",{className:"ds-empty-state__description",children:r}),o&&e.jsx("div",{className:"ds-empty-state__action",children:o})]})}function $s({label:s,hint:t,error:r,required:o=!1,disabled:a=!1,htmlFor:n,children:i,className:l="",style:p,...d}){const m=f.useId(),h=n??m,x=`${h}-hint`,u=`${h}-error`;return e.jsxs("div",{className:`ds-field${l?` ${l}`:""}`,"data-state":r?"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&&!r&&e.jsx("p",{className:"ds-field-hint",id:x,children:t}),r&&e.jsx("p",{className:"ds-field-error",id:u,role:"alert",children:r})]})}function Rs({label:s,value:t,delta:r,size:o="m",inline:a=!1,className:n="",style:i,...l}){const p=r!=null&&r.startsWith("+")?"up":r!=null&&r.startsWith("-")?"down":"neutral";return e.jsxs("div",{className:["ds-stat",`ds-stat--${o}`,a&&"ds-stat--inline",n].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}),r!=null&&e.jsx("span",{className:`ds-stat-delta ds-stat-delta--${p}`,children:r})]})}function Ss({children:s,separator:t="/","aria-label":r="Breadcrumb",className:o="",style:a,...n}){const i=f.Children.toArray(s).filter(Boolean);return e.jsx("nav",{className:`ds-breadcrumb${o?` ${o}`:""}`,"aria-label":r,style:a,...n,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 As({page:s,total:t,onChange:r,siblings:o=1,"aria-label":a="Pagination",className:n="",style:i,...l}){const p=Ds(s,t,o);return e.jsxs("nav",{className:`ds-pagination${n?` ${n}`:""}`,"aria-label":a,style:i,...l,children:[e.jsx("button",{className:"ds-pagination-arrow",onClick:()=>r==null?void 0:r(s-1),disabled:s<=1,"aria-label":"Previous page",children:e.jsx(g.ChevronLeft,{size:16})}),p.map((d,m)=>d==="…"?e.jsx("span",{className:"ds-pagination-gap","aria-hidden":"true",children:"…"},`gap-${m}`):e.jsx("button",{className:`ds-pagination-page${d===s?" ds-pagination-page--current":""}`,onClick:()=>d!==s&&(r==null?void 0:r(d)),"aria-current":d===s?"page":void 0,"aria-label":`Page ${d}`,children:d},d)),e.jsx("button",{className:"ds-pagination-arrow",onClick:()=>r==null?void 0:r(s+1),disabled:s>=t,"aria-label":"Next page",children:e.jsx(g.ChevronRight,{size:16})})]})}function Ds(s,t,r){if(t<=7)return Array.from({length:t},(i,l)=>l+1);const o=Math.max(2,s-r),a=Math.min(t-1,s+r),n=[1];o>2&&n.push("…");for(let i=o;i<=a;i++)n.push(i);return a<t-1&&n.push("…"),n.push(t),n}const Is=200;function Bs({children:s,title:t,onClose:r,side:o="right",...a}){const n=f.useRef(null),i=f.useId(),[l,p]=f.useState(!1),d=()=>{!r||l||(p(!0),setTimeout(()=>{p(!1),r()},Is))};f.useEffect(()=>{const u=v=>{v.key==="Escape"&&d()},_=v=>{n.current&&!n.current.contains(v.target)&&d()};return document.addEventListener("keydown",u),document.addEventListener("mousedown",_),()=>{document.removeEventListener("keydown",u),document.removeEventListener("mousedown",_)}},[r,l]);const m=f.Children.toArray(s),h=m.find(u=>(u==null?void 0:u.type)===be),x=m.filter(u=>(u==null?void 0:u.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:n,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}),r&&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 Ps={info:g.Info,success:g.CheckCircle,warning:g.AlertTriangle,error:g.XCircle};function Ms({children:s,variant:t="info",action:r,onAction:o,onDismiss:a,role:n,...i}){const l=Ps[t],p=n||(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}),r&&e.jsx("button",{type:"button",className:"ds-banner-action",onClick:o,children:r}),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 Ls({trigger:s,items:t=[],open:r,onOpenChange:o,align:a="left",className:n="",style:i,...l}){const[p,d]=f.useState(!1),[m,h]=f.useState(!1),x=r!==void 0,u=x?r:p,_=f.useRef(null),v=f.useRef(null),A=f.useRef(null),S=f.useRef(null),[B,E]=f.useState({}),$=f.useRef(null),z=150,I=()=>{if(x)o==null||o(!1);else{if(m)return;h(!0),$.current=setTimeout(()=>{d(!1),h(!1)},z)}},V=()=>{const b=!u;x?o==null||o(b):b?(clearTimeout($.current),h(!1),d(!0)):I()},Y=()=>{u||(x?o==null||o(!0):(clearTimeout($.current),h(!1),d(!0)))};f.useEffect(()=>()=>clearTimeout($.current),[]),f.useEffect(()=>{if(!u)return;const b=300,N=()=>{var X;const T=(X=_.current)==null?void 0:X.getBoundingClientRect();if(!T)return;const M=window.innerHeight-T.bottom,H=M<b+8&&T.top>M;E(a==="right"?H?{bottom:window.innerHeight-T.top+4,top:"auto",right:window.innerWidth-T.right}:{top:T.bottom+4,bottom:"auto",right:window.innerWidth-T.right}:H?{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)}},[u,a]);const P=()=>{var N;const b=(N=A.current)==null?void 0:N.querySelector('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"]), input, select, textarea');b==null||b.focus()};f.useEffect(()=>{if(!u)return;const b=T=>{var M,H;!((M=_.current)!=null&&M.contains(T.target))&&!((H=v.current)!=null&&H.contains(T.target))&&I()},N=T=>{T.key==="Escape"&&(I(),P())};return document.addEventListener("mousedown",b),document.addEventListener("keydown",N),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",N)}},[u]),f.useEffect(()=>{if(!u||!S.current||!v.current)return;const b=w(),N=S.current==="last"?b[b.length-1]:b[0];N==null||N.focus(),S.current=null},[u]);const w=()=>v.current?[...v.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(),u?(N=w()[0])==null||N.focus():(S.current="first",Y());else if(b.key==="ArrowUp")if(b.preventDefault(),!u)S.current="last",Y();else{const M=w();(T=M[M.length-1])==null||T.focus()}},q=b=>{var M,H,X,k;const N=w(),T=N.findIndex(c=>c===document.activeElement);switch(b.key){case"ArrowDown":b.preventDefault(),(M=N[Math.min(T+1,N.length-1)])==null||M.focus();break;case"ArrowUp":b.preventDefault(),T<=0?P():(H=N[T-1])==null||H.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=u&&e.jsx("div",{ref:v,role:"menu",className:["ds-dropdown__menu",`ds-dropdown__menu--${a}`,m&&"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,M=T?"a":"button",H=T?{href:b.disabled?void 0:b.href,"aria-disabled":b.disabled?"true":void 0}:{type:"button",disabled:b.disabled};return e.jsxs(M,{role:"menuitem",className:["ds-dropdown__item",b.danger&&"ds-dropdown__item--danger"].filter(Boolean).join(" "),...H,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:_,className:["ds-dropdown",n].filter(Boolean).join(" "),style:i,...l,children:[e.jsx("div",{ref:A,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:r="default",showValue:o=!1,min:a=2,animate:n=!0}){const i=Math.min(100,Math.max(0,s)),l=Math.max(a,i),p=r==="auto"?i>=70?"success":i>=50?"warning":"danger":r;return e.jsxs("div",{className:["ds-progress",`ds-progress--${t}`,!n&&"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 Fs=s=>1-Math.pow(1-s,3),Cs=()=>typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function Be(s,{duration:t=600}={}){const[r,o]=f.useState(s),a=f.useRef(s),n=f.useRef(null);return f.useEffect(()=>{if(Cs()){o(s),a.current=s;return}const i=a.current,l=s-i;if(l===0)return;let p=null;const d=m=>{p||(p=m);const h=Math.min((m-p)/t,1);o(i+l*Fs(h)),h<1?n.current=requestAnimationFrame(d):a.current=s};return n.current=requestAnimationFrame(d),()=>cancelAnimationFrame(n.current)},[s,t]),r}function Os({value:s,duration:t=600,decimals:r=0,prefix:o="",suffix:a=""}){const i=Be(s,{duration:t}).toFixed(r);return`${o}${i}${a}`}function Pe({threshold:s=.1,rootMargin:t="0px",once:r=!1}={}){const o=f.useRef(null),[a,n]=f.useState(!1);return f.useEffect(()=>{const i=o.current;if(!i)return;const l=new IntersectionObserver(([p])=>{p.isIntersecting?(n(!0),r&&l.disconnect()):r||n(!1)},{threshold:s,rootMargin:t});return l.observe(i),()=>l.disconnect()},[s,t,r]),{ref:o,inView:a}}function Ws({children:s,as:t="div",once:r=!1,threshold:o=.1,rootMargin:a="0px",onEnter:n,onLeave:i,...l}){const{ref:p,inView:d}=Pe({threshold:o,rootMargin:a,once:r}),m=f.useRef(!1);return f.useEffect(()=>{d&&!m.current&&(n==null||n()),!d&&m.current&&(i==null||i()),m.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 Us(s){le=[...le,s],Me()}function Vs(s){le=le.filter(t=>t.id!==s),Me()}function Hs(){const s=(t,r={})=>{Us({id:`${Date.now()}-${Math.random()}`,message:t,type:"default",duration:4e3,...r})};return s.success=(t,r)=>s(t,{...r,type:"success"}),s.error=(t,r)=>s(t,{...r,type:"error"}),s.warning=(t,r)=>s(t,{...r,type:"warning"}),{toast:s}}function Ys({data:s,onDismiss:t}){const[r,o]=f.useState(!1),a=f.useRef(null);f.useEffect(()=>(requestAnimationFrame(()=>o(!0)),s.duration>0&&(a.current=setTimeout(()=>n(),s.duration)),()=>clearTimeout(a.current)),[]);function n(){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}`,r&&"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:n,"aria-label":"Закрыть",children:e.jsx(g.X,{size:D[3],strokeWidth:1.5})})]})}function qs({position:s="bottom-right"}){const[t,r]=f.useState(()=>[...le]);return f.useEffect(()=>(_e.add(r),()=>_e.delete(r)),[]),!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(Ys,{data:o,onDismiss:Vs},o.id))}),document.body)}const Xs={running:e.jsx(ee,{size:"xs",variant:"info",children:"Running..."}),success:e.jsx(ee,{size:"xs",variant:"success",children:"Done"}),error:e.jsx(ee,{size:"xs",variant:"error",children:"Error"})};function Ks({label:s,status:t="idle",icon:r,badge:o,defaultExpanded:a=!1,expanded:n,onToggle:i,children:l,className:p="",...d}){const m=e.jsxs("span",{className:"ds-tool-card__title-row",children:[r&&e.jsx("span",{className:"ds-tool-card__icon",children:r}),e.jsx("span",{className:"ds-tool-card__label",children:s}),Xs[t],o]});return e.jsx("div",{className:["ds-tool-card",p].filter(Boolean).join(" "),...d,children:e.jsx(fe,{title:m,padding:"s",defaultExpanded:a,expanded:n,onToggle:i,children:e.jsx("div",{className:"ds-tool-card__body",children:l})})})}function Le({text:s,size:t="xs",timeout:r=800,"aria-label":o="Copy to clipboard",...a}){const[n,i]=f.useState(!1),l=p=>{p.currentTarget.blur(),navigator.clipboard.writeText(s).then(()=>{i(!0),setTimeout(()=>i(!1),r)})};return e.jsx(ie,{variant:"ghost",size:t,state:n?"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,...r}){const[o,a]=f.useState(t);return f.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"})]}),...r,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:r=[],onChange:o,showCounter:a=!0,className:n="","aria-label":i="Steps",...l}){return e.jsxs("div",{className:["ds-step-indicator",n].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 m=d===t,h=r.includes(d)&&!m,x=o&&(d<=t||r.includes(d)),u=["ds-step-indicator__dot",m&&"ds-step-indicator__dot--active",h&&"ds-step-indicator__dot--done"].filter(Boolean).join(" ");return e.jsx("button",{type:"button",className:u,role:"tab","aria-selected":m,"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:r="line",onChunk:o,className:a="",...n}){const i=f.useRef(s);return f.useEffect(()=>{s!==i.current&&(o==null||o(s),i.current=s)},[s,o]),e.jsxs("span",{className:["ds-streaming-text",a].filter(Boolean).join(" "),...n,children:[s,t&&r!=="none"&&e.jsx("span",{className:`ds-cursor ds-cursor--${r}`,"aria-hidden":"true"})]})}function Qs({role:s="assistant",header:t,footer:r,attachments:o,isStreaming:a=!1,children:n,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:n})}):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:n}),r&&e.jsx("div",{className:"ds-chat-message__footer",children:r})]}):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:n}),r&&e.jsx("div",{className:"ds-chat-message__footer",children:r})]})}function et(s,{containerRef:t,smartPause:r=!0}={}){const o=f.useRef(!1),a=f.useRef(0);f.useEffect(()=>{const n=t==null?void 0:t.current;if(!n)return;const i=()=>{const l=n.scrollHeight-n.scrollTop-n.clientHeight<64;!l&&n.scrollTop<a.current&&(o.current=!0),l&&(o.current=!1),a.current=n.scrollTop};return n.addEventListener("scroll",i,{passive:!0}),()=>n.removeEventListener("scroll",i)},[t]),f.useEffect(()=>{const n=t==null?void 0:t.current;n&&(r&&o.current||(n.scrollTop=n.scrollHeight))},s)}function ze({prompts:s,enabled:t,typingSpeed:r=38,erasingSpeed:o=18,holdTime:a=2200,betweenTime:n=380,manualPauseMs:i=5e3}){const[l,p]=f.useState(0),[d,m]=f.useState(""),h=f.useRef("typing"),x=f.useRef(0),u=f.useRef(0),_=f.useRef(null),v=f.useRef(0);f.useEffect(()=>{u.current=l},[l]),f.useEffect(()=>{if(_.current&&(clearTimeout(_.current),_.current=null),!t||s.length===0){m(""),x.current=0,h.current="typing";return}const $=()=>{const z=Date.now();if(v.current>z){_.current=setTimeout($,v.current-z);return}const I=s[u.current%s.length]??"";h.current==="typing"?(x.current+=1,m(I.slice(0,x.current)),x.current>=I.length?(h.current="holding",_.current=setTimeout($,a)):_.current=setTimeout($,r+Math.random()*28)):h.current==="holding"?(h.current="erasing",_.current=setTimeout($,o)):(x.current=Math.max(0,x.current-1),m(I.slice(0,x.current)),x.current<=0?(h.current="typing",u.current=(u.current+1)%s.length,p(u.current),_.current=setTimeout($,n)):_.current=setTimeout($,o))};return _.current=setTimeout($,260),()=>{_.current&&clearTimeout(_.current)}},[t,s,r,o,a,n]);const A=$=>{if(s.length===0)return;const z=($%s.length+s.length)%s.length,I=s[z];u.current=z,x.current=I.length,h.current="holding",v.current=Date.now()+i,p(z),m(I)},S=()=>A(u.current+1),B=()=>A(u.current-1),E=s[l%s.length]??"";return{displayed:d,currentPrompt:E,index:l,next:S,prev:B}}let st=0;function tt({value:s="",onChange:t,onSubmit:r,onStop:o,onKeyDown:a,loading:n=!1,disabled:i=!1,placeholder:l="Let's get things done...",animatedPlaceholders:p,attachments:d,images:m,onAttachFiles:h,onAttachImages:x,onRemoveAttachment:u,onRemoveImage:_,acceptImage:v,acceptFile:A,maxImages:S,maxImageSize:B,leftSlot:E,rightSlot:$,className:z="",...I}){const V=f.useRef(null),Y=f.useRef(null),P=f.useRef(0),[w,O]=f.useState(!1),[q,W]=f.useState([]),b=j=>{const R=++st;W(U=>[...U,{id:R,msg:j}]),setTimeout(()=>W(U=>U.filter(K=>K.id!==R)),6e3)},N=j=>W(R=>R.filter(U=>U.id!==j)),T=j=>j.type.startsWith("image/"),M=()=>!0,H=v??T,X=A??M,k=j=>{const R=[],U=[],K=[],G=[];let Z=0,ae=S!=null?S-((m==null?void 0:m.length)??0):1/0;for(const Q of j)H(Q)?B&&Q.size>B?K.push(Q.name):ae>0?(R.push(Q),ae--):Z++:X(Q)?U.push(Q):G.push(Q.name);return{imageFiles:R,docFiles:U,tooLarge:K,skipped:G,limitExceeded:Z}},c=j=>{const{imageFiles:R,docFiles:U,tooLarge:K,skipped:G,limitExceeded:Z}=k(j);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 ${S} images per message`),x&&R.length&&x(R);const ae=U.concat(x?[]:R);h&&ae.length&&h(ae)};f.useEffect(()=>{const j=Y.current;j&&(j.style.height="auto",j.style.height=`${Math.min(j.scrollHeight,200)}px`)},[s]),f.useEffect(()=>{const j=R=>{var K,G,Z;if(n||i)return;const U=(K=R.target)==null?void 0:K.tagName;U==="INPUT"||U==="TEXTAREA"||U==="SELECT"||(G=R.target)!=null&&G.isContentEditable||R.ctrlKey||R.metaKey||R.altKey||R.key.length!==1&&R.key!=="Backspace"&&R.key!=="Delete"||(Z=Y.current)==null||Z.focus()};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[n,i]);const y=j=>{j.preventDefault(),P.current++,j.dataTransfer.types.includes("Files")&&O(!0)},L=j=>{j.preventDefault(),P.current--,P.current===0&&O(!1)},F=j=>j.preventDefault(),se=j=>{j.preventDefault(),P.current=0,O(!1);const R=Array.from(j.dataTransfer.files);R.length&&c(R)},re=j=>{const R=Array.from(j.target.files||[]);V.current&&(V.current.value=""),R.length&&c(R)},C=j=>{var Q;if(!x)return;const R=(Q=j.clipboardData)==null?void 0:Q.items;if(!R)return;const U=[];for(const Oe of R){const we=Oe.getAsFile();we&&U.push(we)}if(U.length===0)return;const{imageFiles:K,tooLarge:G,skipped:Z,limitExceeded:ae}=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(", ")}`),ae&&b(`Max ${S} images per message`),K.length&&(j.preventDefault(),x(K))},J=!n&&!i&&!!(p!=null&&p.length)&&s.length===0,ne=ze({prompts:p??[],enabled:J}),me=j=>{if(J){if(j.key==="ArrowDown"||j.key==="ArrowRight"){j.preventDefault(),ne.next();return}if(j.key==="ArrowUp"||j.key==="ArrowLeft"){j.preventDefault(),ne.prev();return}if(j.key==="Tab"&&!j.shiftKey){j.preventDefault(),t==null||t(ne.currentPrompt);return}}a==null||a(j)},Ce=(s.trim()||(m==null?void 0:m.length)>0||(d==null?void 0:d.length)>0)&&!i,Ne=h||x;return e.jsxs("div",{className:["ds-prompt-input",z].filter(Boolean).join(" "),...I,children:[Ne&&e.jsx("input",{ref:V,type:"file",multiple:!0,accept:"*/*",className:"ds-prompt-input__file-input",onChange:re}),e.jsxs("div",{className:["ds-prompt-input__box",w&&"ds-prompt-input__box--dragging"].filter(Boolean).join(" "),onDragEnter:y,onDragLeave:L,onDragOver:F,onDrop:se,children:[w&&e.jsx("div",{className:"ds-prompt-input__drag-overlay",children:"Drop files here"}),e.jsx("textarea",{ref:Y,value:s,onChange:j=>t==null?void 0:t(j.target.value),onKeyDown:me,onPaste:C,placeholder:J?"":l,disabled:n||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"})]}),m&&m.length>0&&e.jsx("div",{className:"ds-prompt-input__images",children:m.map((j,R)=>e.jsxs("div",{className:"ds-prompt-input__image-thumb",children:[e.jsx("img",{src:j.preview,alt:""}),e.jsx("button",{className:"ds-prompt-input__image-remove",onClick:()=>_==null?void 0:_(R),"aria-label":"Remove image",type:"button",children:e.jsx(g.X,{size:12,strokeWidth:2})})]},R))}),q.length>0&&e.jsx("div",{className:"ds-prompt-input__warnings",children:q.map(j=>e.jsxs("div",{className:"ds-prompt-input__warning",role:"alert",children:[e.jsx("span",{children:j.msg}),e.jsx("button",{type:"button",className:"ds-prompt-input__warning-close",onClick:()=>N(j.id),"aria-label":"Dismiss",children:e.jsx(g.X,{size:D[1],strokeWidth:1.5})})]},j.id))}),d&&d.length>0&&e.jsx("div",{className:"ds-prompt-input__attachments",children:d.map((j,R)=>e.jsx(ee,{size:"xs",children:e.jsxs("span",{className:"ds-prompt-input__badge-content",children:[j.uploading?e.jsx(g.Loader,{size:D[1],strokeWidth:1.5,className:"spin"}):e.jsx(g.Paperclip,{size:D[1],strokeWidth:1.5}),j.filename,j.uploading?e.jsx("span",{className:"ds-prompt-input__uploading",children:"Uploading..."}):e.jsx("button",{type:"button",className:"ds-prompt-input__remove-btn",onClick:()=>u==null?void 0:u(R),children:e.jsx(g.X,{size:D[1],strokeWidth:1.5})})]})},R))}),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 j;return(j=V.current)==null?void 0:j.click()}}),E,$,e.jsx("div",{className:"ds-prompt-input__spacer"}),n?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:r,disabled:!Ce,"aria-label":"Send"})]})]})]})}const Ee={fast:0,standard:1,premium:2},Te={fast:"data-5",standard:"data-3",premium:"data-6"};function rt({models:s=[],value:t,onChange:r,size:o="xs",minTier:a,showAutoOption:n=!1,groupByTier:i=!0,className:l="",...p}){const[d,m]=f.useState(!1),h=f.useRef(null),x=f.useRef(null),u=f.useRef(null),[_,v]=f.useState({}),A=s.filter(w=>!a||w.name==="auto"?!0:(Ee[w.tier]??1)>=(Ee[a]??1)),S=A.find(w=>w.name==="auto"),B=A.filter(w=>w.name!=="auto"),E=s.find(w=>w.name===t),z=new Set(B.map(w=>w.tier).filter(Boolean)).size>1;f.useEffect(()=>{if(!d)return;const w=320,O=()=>{var M;const b=(M=x.current)==null?void 0:M.getBoundingClientRect();if(!b)return;const N=window.innerHeight-b.bottom,T=N<w+8&&b.top>N;v({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=u.current)!=null&&T.contains(b.target))&&m(!1)},W=b=>{b.key==="Escape"&&m(!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=>{r==null||r(w),m(!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}),z&&w.tier&&e.jsx(ee,{size:"xs",variant:Te[w.tier]||"default",children:w.tier})]},w.name),Y=()=>!i||!z?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)]:[]}),P=d&&e.jsxs("div",{ref:u,className:"ds-model-picker__menu",style:_,children:[n&&S&&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"})]}),Y()]});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:()=>m(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}),z&&(E==null?void 0:E.tier)&&e.jsx(ee,{size:"xs",variant:Te[E.tier]||"default",children:E.tier})]}),typeof document<"u"&&ue.createPortal(P,document.body)]})}const nt=({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 r of s)t.has(r.filename)||t.set(r.filename,{filename:r.filename,url:r.url,items:[]}),t.get(r.filename).items.push(r);return[...t.values()]}function ot({sources:s=[],layout:t="list",title:r="Sources",maxVisible:o=5,onSourceClick:a}){const[n,i]=f.useState(!1),l=at(s),p=l.length>o,d=n?l:l.slice(0,o),m=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 u=x.items.map(v=>v.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}),u.length>0&&e.jsx("span",{className:"ds-sources-panel__pages",children:je(u)})]},x.filename)}),p&&!n&&e.jsxs("button",{className:"ds-sources-panel__more",onClick:()=>i(!0),children:["+",l.length-o," more sources"]})]}):e.jsxs("div",{className:h,children:[r&&e.jsx("div",{className:"ds-sources-panel__title",children:r}),d.map(x=>{const u=x.items.map(v=>v.page).filter(Boolean),_=!!a;return m?e.jsx(fe,{title:e.jsx(nt,{filename:x.filename,pages:u}),padding:"s",children:x.items.map((v,A)=>e.jsx("div",{className:`ds-sources-panel__snippet${_?" ds-sources-panel__snippet--clickable":""}`,onClick:_?()=>a(v):void 0,children:v.snippet??`p. ${v.page}`},A))},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}),u.length>0&&e.jsx("span",{className:"ds-sources-panel__pages",children:je(u)})]},x.filename)}),p&&!n&&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:r="s",showCount:o=!0,showPercent:a=!1,warningThreshold:n=.8,errorThreshold:i=1}){const l=t>0?s/t:0,p=Math.min(l*100,100),d=l>=i?"error":l>=n?"warning":"normal";return e.jsxs("div",{className:`ds-token-counter ds-token-counter--${r}`,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:[$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:r="none",layout:o="inline"}){const a=Math.max(0,Math.min(1,s)),n=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,p)=>e.jsx("div",{className:`ds-confidence-bar__seg${p<n?" ds-confidence-bar__seg--filled":""}`},p))}),r==="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:r=!1,lineNumbers:o=!0,maxHeight:a,title:n}){const i=["ds-diff-view",`ds-diff-view--${t}`,r&&"ds-diff-view--wrap"].filter(Boolean).join(" "),l=a?{maxHeight:a,overflowY:"auto"}:void 0;if(t==="split"){const p=s.filter(m=>m.type==="remove"||m.type==="context"),d=s.filter(m=>m.type==="add"||m.type==="context");return e.jsxs("div",{className:i,children:[n&&e.jsx("div",{className:"ds-diff-view__title",children:n}),e.jsxs("div",{className:"ds-diff-view__body",style:l,children:[e.jsx("div",{className:"ds-diff-view__split-col",children:p.map((m,h)=>e.jsx(pe,{line:m,lineNumbers:o},h))}),e.jsx("div",{className:"ds-diff-view__split-col",children:d.map((m,h)=>e.jsx(pe,{line:m,lineNumbers:o},h))})]})]})}return e.jsxs("div",{className:i,children:[n&&e.jsx("div",{className:"ds-diff-view__title",children:n}),e.jsx("div",{className:"ds-diff-view__body",style:l,children:s.map((p,d)=>e.jsx(pe,{line:p,lineNumbers:o},d))})]})}const ft={running:e.jsx(ee,{size:"xs",variant:"info",children:"Running…"}),success:e.jsx(ee,{size:"xs",variant:"success",children:"Done"}),error:e.jsx(ee,{size:"xs",variant:"error",children:"Error"})};function mt({label:s,status:t="idle",icon:r,badge:o,className:a="",...n}){return e.jsxs("div",{className:["ds-tool-bubble",a].filter(Boolean).join(" "),...n,children:[r&&e.jsx("span",{className:"ds-tool-bubble__icon",children:r}),e.jsx("span",{className:"ds-tool-bubble__label",children:s}),ft[t],o]})}function Fe({value:s="idle",onLike:t,onDislike:r,className:o="",...a}){const n=s!=="idle";return e.jsxs("div",{className:["ds-message-feedback",n&&"ds-message-feedback--voted",o].filter(Boolean).join(" "),...a,children:[(!n||s==="liked")&&e.jsx("button",{className:["ds-message-feedback__btn",s==="liked"&&"ds-message-feedback__btn--liked"].filter(Boolean).join(" "),onClick:t,disabled:n,"aria-label":"Like","aria-pressed":s==="liked",children:e.jsx(g.ThumbsUp,{size:D[1],strokeWidth:1.5,fill:s==="liked"?"currentColor":"none"})}),(!n||s==="disliked")&&e.jsx("button",{className:["ds-message-feedback__btn",s==="disliked"&&"ds-message-feedback__btn--disliked"].filter(Boolean).join(" "),onClick:r,disabled:n,"aria-label":"Dislike","aria-pressed":s==="disliked",children:e.jsx(g.ThumbsDown,{size:D[1],strokeWidth:1.5,fill:s==="disliked"?"currentColor":"none"})})]})}function pt(s){const t=s instanceof Date?s:new Date(s);if(isNaN(t))return null;const r=new Date,o=t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),a=new Date(r.getFullYear(),r.getMonth(),r.getDate()),n=new Date(a-864e5);if(t>=a)return o;if(t>=n)return`Yesterday ${o}`;const i=t.getDate(),l=t.toLocaleString([],{month:"short"});return`${i} ${l} ${o}`}function ht({role:s="assistant",text:t,timestamp:r,feedbackValue:o="idle",onLike:a,onDislike:n,className:i="",...l}){const p=s==="assistant"&&(a||n),d=!!t,m=r?pt(r):null;return!p&&!d&&!m?null:e.jsxs("div",{className:["ds-message-footer",`ds-message-footer--${s}`,i].filter(Boolean).join(" "),...l,children:[s==="user"&&m&&e.jsx("span",{className:"ds-message-footer__timestamp ds-message-action",children:m}),p&&e.jsx(Fe,{className:"ds-message-action",value:o,onLike:a,onDislike:n}),d&&e.jsx(Le,{className:"ds-message-action",text:t}),s==="assistant"&&m&&e.jsx("span",{className:"ds-message-footer__timestamp ds-message-action",children:m})]})}exports.Accordion=fe;exports.Alert=ts;exports.AnimatedNumber=Os;exports.Avatar=js;exports.Badge=ee;exports.Banner=Ms;exports.Breadcrumb=Ss;exports.Button=ie;exports.Card=Ke;exports.ChatMessage=Qs;exports.Checkbox=ps;exports.Code=as;exports.CodeAccordion=De;exports.ConfidenceBar=ct;exports.CopyButton=Le;exports.DiffView=ut;exports.Drawer=Bs;exports.DrawerFooter=be;exports.Dropdown=Ls;exports.EmptyState=Ts;exports.FormField=$s;exports.H1=Ge;exports.H2=Je;exports.H3=Ze;exports.H4=Qe;exports.InView=Ws;exports.Input=He;exports.Link=os;exports.MessageFeedback=Fe;exports.MessageFooter=ht;exports.Modal=ns;exports.ModalFooter=xe;exports.ModelPicker=rt;exports.P1=es;exports.P2=Ae;exports.P3=ve;exports.Pagination=As;exports.ProgressBar=zs;exports.PromptInput=tt;exports.Radio=hs;exports.ReasoningBlock=Gs;exports.SegmentedControl=cs;exports.Select=qe;exports.Skeleton=Ie;exports.SourcesPanel=ot;exports.Spinner=Se;exports.Stat=Rs;exports.StepIndicator=Js;exports.Stepper=Xe;exports.StreamingText=Zs;exports.Tab=ls;exports.Table=vs;exports.TableBody=ws;exports.TableHead=Ns;exports.TableRow=gs;exports.TableSubheaderRow=ys;exports.Tabs=is;exports.Td=Es;exports.Textarea=Ye;exports.Th=ks;exports.ToastContainer=qs;exports.Toggle=ms;exports.TokenCounter=it;exports.ToolCallBubble=mt;exports.ToolCallCard=Ks;exports.Tooltip=fs;exports.iconSizes=D;exports.useAnimatedNumber=Be;exports.useAnimatedPlaceholder=ze;exports.useInView=Pe;exports.useStreamScroll=et;exports.useToast=Hs;
|
|
22
|
+
<%s key={someKey} {...props} />`,z,O,J,O),k[O+z]=!0)}if(O=null,L!==void 0&&(r(L),O=""+L),i(y)&&(r(y.key),O=""+y.key),"key"in y){L={};for(var re in y)re!=="key"&&(L[re]=y[re])}else L=y;return O&&l(L,typeof c=="function"?c.displayName||c.name||"Unknown":c),d(c,O,L,a(),ee,te)}function h(c){x(c)?c._store&&(c._store.validated=1):typeof c=="object"&&c!==null&&c.$$typeof===P&&(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 u=f,_=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),R=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),V=Symbol.for("react.suspense_list"),Y=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),N=Symbol.for("react.activity"),C=Symbol.for("react.client.reference"),q=u.__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};u={react_stack_bottom_frame:function(c){return c()}};var T,M={},H=u.react_stack_bottom_frame.bind(u,n)(),X=w(o(n)),k={};de.Fragment=A,de.jsx=function(c,y,L){var z=1e4>q.recentlyCreatedOwnerStacks++;return m(c,y,L,!1,z?Error("react-stack-top-frame"):H,z?w(o(c)):X)},de.jsxs=function(c,y,L){var z=1e4>q.recentlyCreatedOwnerStacks++;return m(c,y,L,!0,z?Error("react-stack-top-frame"):H,z?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:r="",...o}){return e.jsx("span",{className:["ds-spinner",`ds-spinner--${s}`,`ds-spinner--${t}`,r].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:r="m",fullWidth:o=!1,icon:a,disabled:n=!1,state:i="idle",onClick:l,type:p="button",href:d,"aria-label":m,className:h="",...x}){const u=a&&!s,_=i==="loading",v=i==="success",A=i==="error",S=_||v||A,B=r==="xs"?"s":"m",E=He[r]??16,R=_?e.jsx(Se,{size:B}):v?e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:e.jsx(g.Check,{size:E,strokeWidth:2.5})}):A?e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:e.jsx(g.X,{size:E,strokeWidth:2.5})}):null,F=["ds-button",`ds-button--${t}`,`ds-button--${r}`,o&&"ds-button--full",u&&"ds-button--icon-only",h].filter(Boolean).join(" "),I=i!=="idle"?i:void 0,V=e.jsxs(e.Fragment,{children:[S?R:a&&e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:a}),s]});if(d){const Y=P=>{if(n||_){P.preventDefault();return}P.metaKey||P.ctrlKey||P.button===1||(P.preventDefault(),l==null||l(P))};return e.jsx("a",{className:F,href:n||_?void 0:d,onClick:Y,"aria-label":m,"aria-disabled":n||_?"true":void 0,"aria-busy":_?"true":void 0,"data-state":I,...x,children:V})}return e.jsx("button",{type:p,className:F,disabled:n,onClick:_?void 0:l,"aria-label":m,"aria-busy":_?"true":void 0,"data-state":I,...x,children:V})}function Ye({label:s,error:t,hint:r,fullWidth:o=!0,icon:a,iconRight:n,onIconRightClick:i,size:l="m",disabled:p,id:d,...m}){const h=d||`input-${f.useId()}`,x=r?`${h}-hint`:void 0,u=t?`${h}-error`:void 0,_=u||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":""} ${n?"ds-input--with-icon-right":""} ${t?"ds-input--error":""}`,disabled:p,"aria-invalid":t?"true":"false","aria-describedby":_,...m}),n&&e.jsx("button",{type:"button",className:`ds-input-icon-right ds-input-icon-right--${l}`,onClick:i,tabIndex:-1,"aria-label":"Toggle visibility",children:n})]}),r&&!t&&e.jsx("span",{id:x,className:"ds-input-hint",children:r}),e.jsx("div",{className:"ds-input-error-wrap",children:e.jsx("div",{className:"ds-input-error-inner",children:t&&e.jsx("span",{id:u,className:"ds-input-error",role:"alert",children:t})})})]})}function qe({label:s,error:t,hint:r,fullWidth:o=!0,size:a="m",disabled:n,id:i,resize:l=!0,rows:p=3,...d}){const m=i||`textarea-${f.useId()}`,h=r?`${m}-hint`:void 0,x=t?`${m}-error`:void 0,u=x||h;return e.jsxs("div",{className:`ds-textarea-wrapper ${o?"ds-textarea-wrapper--full":""} ${n?"ds-textarea-wrapper--disabled":""}`,children:[s&&e.jsx("label",{className:"ds-textarea-label",htmlFor:m,children:s}),e.jsx("textarea",{id:m,className:`ds-textarea ds-textarea--${a} ${t?"ds-textarea--error":""} ${l?"":"ds-textarea--no-resize"}`,disabled:n,"aria-invalid":t?"true":"false","aria-describedby":u,rows:p,...d}),r&&!t&&e.jsx("span",{id:h,className:"ds-textarea-hint",children:r}),t&&e.jsx("span",{id:x,className:"ds-textarea-error",role:"alert",children:t})]})}function Xe({label:s,value:t,onChange:r,options:o=[],placeholder:a="Select option",error:n,fullWidth:i=!0,size:l="m",disabled:p=!1,id:d,...m}){const[h,x]=f.useState(!1),[u,_]=f.useState(!1),[v,A]=f.useState({}),[S,B]=f.useState("down"),[E,R]=f.useState(-1),F=f.useRef(null),I=f.useRef(null),V=f.useRef(null),Y=f.useRef(null),P=d||`select-${f.useId()}`,N=`${P}-label`,C=n?`${P}-error`:void 0,q=150,W=(k=!1)=>{u||(_(!0),R(-1),Y.current=setTimeout(()=>{var c;x(!1),_(!1),k&&((c=V.current)==null||c.focus())},q))},b=k=>{clearTimeout(Y.current),_(!1);const c=k!==void 0?k:Math.max(o.findIndex(y=>y.value===t),0);R(c),x(!0)};f.useEffect(()=>()=>clearTimeout(Y.current),[]);const w=()=>{var te;const k=(te=F.current)==null?void 0:te.getBoundingClientRect();if(!k)return;const c=window.innerHeight,y=c-k.bottom,L=k.top,ee=y<300&&L>y;B(ee?"up":"down"),A(ee?{bottom:c-k.top+4,left:k.left,width:k.width}:{top:k.bottom+4,left:k.left,width:k.width})};f.useEffect(()=>{if(h)return w(),window.addEventListener("scroll",w,!0),window.addEventListener("resize",w),()=>{window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w)}},[h]),f.useEffect(()=>{const k=c=>{F.current&&!F.current.contains(c.target)&&I.current&&!I.current.contains(c.target)&&W()};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[u]),f.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&&(r==null||r(o[E].value),W(!0)):b();break;case"Escape":h&&(k.preventDefault(),W(!0));break;case"Tab":h&&W(!1);break}},M=o.find(k=>k.value===t),H=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--${S}`,u&&"ds-select-dropdown--closing"].filter(Boolean).join(" "),style:v,children:o.map((k,c)=>e.jsx("button",{id:`${P}-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:()=>{r==null||r(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:F,children:e.jsxs("button",{ref:V,type:"button",id:P,role:"combobox","aria-haspopup":"listbox","aria-expanded":h,"aria-activedescendant":h&&E>=0?`${P}-opt-${E}`:void 0,"aria-labelledby":s?N:void 0,"aria-invalid":n?"true":"false","aria-describedby":C,className:`ds-select-trigger ds-select-trigger--${l} ${n?"ds-select-trigger--error":""}`,onClick:()=>{p||(h?W():b())},onKeyDown:T,disabled:p,...m,children:[e.jsx("span",{className:M?"":"ds-select-placeholder",children:(M==null?void 0:M.label)||a}),e.jsx(g.ChevronDown,{size:H,strokeWidth:1.5,className:`ds-select-icon ${h&&S==="down"?"ds-select-icon--open":""} ${h&&S==="up"?"ds-select-icon--up":""}`,"aria-hidden":"true"})]})}),n&&e.jsx("span",{id:C,className:"ds-select-error",role:"alert",children:n}),typeof document<"u"&&ue.createPortal(X,document.body)]})}function Ke({label:s,value:t=0,onChange:r,min:o=0,max:a=100,step:n=1,size:i="m",disabled:l=!1,hint:p,error:d,...m}){const h=()=>{if(l)return;const S=Math.min(Number(t)+n,a);r==null||r(S)},x=()=>{if(l)return;const S=Math.max(Number(t)-n,o);r==null||r(S)},u=S=>{if(l)return;const B=S.target.value;if(B===""){r==null||r(o);return}const E=Number(B);if(!isNaN(E)){const R=Math.min(Math.max(E,o),a);r==null||r(R)}},_=["ds-stepper-wrapper",l&&"ds-stepper-wrapper--disabled",d&&"ds-stepper-wrapper--error"].filter(Boolean).join(" "),v=["ds-stepper",`ds-stepper--${i}`,l&&"ds-stepper--disabled"].filter(Boolean).join(" "),A=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:v,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:A,strokeWidth:1.5})}),e.jsx("input",{type:"number",className:"ds-stepper-input",value:t,onChange:u,min:o,max:a,step:n,disabled:l,...m}),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:A,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:r="info",hover:o=!1,onClick:a,href:n,disabled:i=!1,...l}){const d=(o?"interactive":r)==="interactive"||a||n,m=["ds-card",`ds-card--${t}`,d&&"ds-card--interactive"].filter(Boolean).join(" ");if(n){const u=_=>{if(i){_.preventDefault();return}_.metaKey||_.ctrlKey||_.button===1||(_.preventDefault(),a==null||a(_))};return e.jsx("a",{className:m,href:i?void 0:n,onClick:u,"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:m,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,...r}){return e.jsx("p",{className:`ds-p1 ${t?"ds-p1--secondary":""}`,...r,children:s})}function Ae({children:s,secondary:t=!1,...r}){return e.jsx("p",{className:`ds-p2 ${t?"ds-p2--secondary":""}`,...r,children:s})}function ve({children:s,secondary:t=!1,...r}){return e.jsx("p",{className:`ds-p3 ${t?"ds-p3--secondary":""}`,...r,children:s})}function ae({children:s,variant:t="default",size:r="m",role:o,...a}){const n=["ds-badge",`ds-badge--${t}`,`ds-badge--${r}`].filter(Boolean).join(" "),i=o||(["info","success","warning","error"].includes(t)?"status":void 0);return e.jsx("span",{className:n,role:i,...a,children:s})}const ts={info:g.Info,success:g.CheckCircle,warning:g.AlertTriangle,error:g.XCircle};function rs({children:s,variant:t="info",title:r,onClose:o,role:a,...n}){const i=ts[t],l=a||(t==="error"?"alert":"status");return e.jsxs("div",{className:`ds-alert ds-alert--${t} ${r?"":"ds-alert--no-title"}`,role:l,...n,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:[r&&e.jsx("div",{className:"ds-alert__title",children:r}),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 ns=200;function as({children:s,title:t,onClose:r,size:o="m",...a}){const n=f.useRef(null),i=f.useId(),[l,p]=f.useState(!1),d=()=>{!r||l||(p(!0),setTimeout(()=>{p(!1),r()},ns))};f.useEffect(()=>{const u=v=>{v.key==="Escape"&&d()},_=v=>{n.current&&!n.current.contains(v.target)&&d()};return document.addEventListener("keydown",u),document.addEventListener("mousedown",_),()=>{document.removeEventListener("keydown",u),document.removeEventListener("mousedown",_)}},[r,l]);const m=f.Children.toArray(s),h=m.find(u=>(u==null?void 0:u.type)===xe),x=m.filter(u=>(u==null?void 0:u.type)!==xe);return e.jsx("div",{className:["ds-modal-overlay",l&&"ds-modal-overlay--closing"].filter(Boolean).join(" "),...a,children:e.jsxs("div",{className:`ds-modal ds-modal--${o}`,ref:n,role:"dialog","aria-modal":"true","aria-labelledby":t?i:void 0,children:[(t||r)&&e.jsxs("div",{className:"ds-modal__header",children:[t&&e.jsx("h3",{id:i,className:"ds-modal__title",children:t}),r&&e.jsx(ie,{variant:"ghost",size:"small",icon:e.jsx(g.X,{size:D[2],strokeWidth:1.5}),onClick:d,"aria-label":"Close modal"})]}),e.jsx("div",{className:"ds-modal__body",children:x}),h]})})}function xe({children:s}){return e.jsx("div",{className:"ds-modal__footer",children:s})}function De({children:s,title:t="Code",defaultExpanded:r=!1,expanded:o,onToggle:a,padding:n="s",className:i="",...l}){const[p,d]=f.useState(r),m=o!==void 0,h=m?o:p,x=()=>{m?a==null||a(!o):d(_=>!_)},u=["ds-code-accordion",`ds-code-accordion--${n}`,h&&"ds-code-accordion--expanded",i].filter(Boolean).join(" ");return e.jsxs("div",{className:u,...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:r=!1,title:o="Code",defaultExpanded:a=!1,...n}){return t?r?e.jsx(De,{title:o,defaultExpanded:a,...n,children:s}):e.jsx("pre",{className:"ds-code-block",...n,children:e.jsx("code",{children:s})}):e.jsx("code",{className:"ds-code-inline",...n,children:s})}function is({href:s,children:t,onClick:r,target:o,rel:a,...n}){const l=o==="_blank"?a?`${a} noopener noreferrer`:"noopener noreferrer":a;return e.jsx("a",{href:s,className:"ds-link",onClick:r,target:o,rel:l,...n,children:t})}function ls({children:s,size:t="m",variant:r="ghost",...o}){return e.jsx("div",{className:"ds-tabs",role:"tablist",...o,children:f.Children.map(s,a=>f.isValidElement(a)?f.cloneElement(a,{size:t,variant:r}):a)})}function cs({children:s,selected:t=!1,onClick:r,size:o="m",variant:a="ghost",disabled:n=!1,icon:i,href:l,...p}){const d=i&&!s,m=["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=u=>{if(n){u.preventDefault();return}u.metaKey||u.ctrlKey||u.button===1||(u.preventDefault(),r==null||r(u))};return e.jsx("a",{role:"tab","aria-current":t?"page":void 0,"aria-disabled":n?"true":void 0,className:m,href:n?void 0:l,onClick:x,...p,children:h})}return e.jsx("button",{role:"tab","aria-selected":t,className:m,onClick:r,disabled:n,...p,children:h})}function ds({options:s,value:t,onChange:r,size:o="m",disabled:a=!1}){const n=f.useRef(null),i=f.useRef(null),[l,p]=f.useState(!1),d=f.useRef(!1),m=f.useRef(null),h=f.useRef(null),x=()=>{if(!n.current)return;const u=n.current.querySelector(`[data-value="${t}"]`);if(!u)return;const _=n.current.getBoundingClientRect(),v=u.getBoundingClientRect(),A=v.left-_.left,S=v.width;i.current?(i.current.style.transition=d.current?"left var(--transition-normal), width var(--transition-normal)":"none",i.current.style.left=A+"px",i.current.style.width=S+"px",d.current=!1):(p(!0),requestAnimationFrame(()=>{if(!i.current||!n.current)return;const B=n.current.querySelector(`[data-value="${t}"]`);if(!B)return;const E=n.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,f.useLayoutEffect(()=>{const u=m.current!==t;m.current=t,d.current=l&&u,x()}),f.useEffect(()=>{if(!n.current)return;const u=new ResizeObserver(()=>{d.current=!1,h.current()});return u.observe(n.current),()=>u.disconnect()},[]),e.jsxs("div",{className:["ds-seg",`ds-seg--${o}`,a&&"ds-seg--disabled"].filter(Boolean).join(" "),ref:n,role:"group",children:[l&&e.jsx("div",{ref:i,className:"ds-seg__pill","aria-hidden":"true"}),s.map(u=>e.jsxs("button",{type:"button","data-value":u.value,className:["ds-seg__btn",t===u.value&&"ds-seg__btn--active"].filter(Boolean).join(" "),onClick:()=>!a&&r(u.value),"aria-pressed":t===u.value,disabled:a,children:[u.icon&&e.jsx("span",{className:"ds-seg__btn-icon","aria-hidden":"true",children:u.icon}),u.label]},u.value))]})}function fe({children:s,title:t,defaultExpanded:r=!1,expanded:o,onToggle:a,padding:n="m",...i}){const[l,p]=f.useState(r),d=o!==void 0,m=d?o:l,h=()=>{d?a==null||a(!o):p(u=>!u)},x=["ds-accordion",`ds-accordion--${n}`,m&&"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":m,children:[e.jsx("span",{className:"ds-accordion__title",children:t}),e.jsx(g.ChevronDown,{size:D[2],strokeWidth:1.5,className:`ds-accordion__icon ${m?"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,r){const o=window.innerWidth;let a,n;switch(s){case"top":a=t.top-r.height-se,n=t.left+t.width/2-r.width/2;break;case"bottom":a=t.bottom+se,n=t.left+t.width/2-r.width/2;break;case"left":a=t.top+t.height/2-r.height/2,n=t.left-r.width-se;break;case"right":a=t.top+t.height/2-r.height/2,n=t.right+se;break;default:a=t.bottom+se,n=t.left}const i=Math.max(oe,Math.min(o-r.width-oe,n)),l=n-i;return{top:a,left:i,arrowOffset:l}}function fs(s,t,r){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>=r+se+oe)return"right";if(s.left>=r+se+oe)return"left";const n=Math.max(s.top,a-s.bottom,s.left,o-s.right);return n===s.top?"top":n===a-s.bottom?"bottom":n===o-s.right?"right":"left"}function ms({children:s,content:t,position:r,...o}){const[a,n]=f.useState(!1),[i,l]=f.useState({visibility:"hidden"}),[p,d]=f.useState(r||"top"),m=f.useRef(null),h=f.useRef(null),x=f.useRef(!1),u=()=>{if(!m.current||!h.current)return;const v=m.current.getBoundingClientRect(),A=h.current.getBoundingClientRect(),S=r||fs(v,A.height,A.width),{top:B,left:E,arrowOffset:R}=us(S,v,A);d(S),l({position:"fixed",top:B,left:E,visibility:"visible","--arrow-offset":`${R}px`})};if(f.useEffect(()=>{if(!a)return;l({position:"fixed",visibility:"hidden"});const v=requestAnimationFrame(u);return window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),()=>{cancelAnimationFrame(v),window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u)}},[a,r]),f.useEffect(()=>{if(!a)return;const v=A=>{m.current&&!m.current.contains(A.target)&&n(!1)};return document.addEventListener("touchstart",v),()=>document.removeEventListener("touchstart",v)},[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:m,className:"ds-tooltip-wrapper",onMouseEnter:()=>{x.current||n(!0)},onMouseLeave:()=>{x.current||n(!1)},onTouchStart:()=>{x.current=!0,n(v=>!v)},...o,children:[s,typeof document<"u"&&ue.createPortal(_,document.body)]})}function ps({checked:s=!1,onChange:t,size:r="m",disabled:o=!1,label:a,id:n,...i}){const l=n||`toggle-${f.useId()}`,p=["ds-toggle",`ds-toggle--${r}`,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:r="m",disabled:o=!1,label:a,id:n,...i}){const l=n||`checkbox-${f.useId()}`,p=["ds-checkbox",`ds-checkbox--${r}`,o&&"ds-checkbox--disabled"].filter(Boolean).join(" "),d=r==="xs"?10:r==="small"?14:r==="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:m=>t==null?void 0:t(m.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:r="m",disabled:o=!1,label:a,name:n,value:i,id:l,...p}){const d=l||`radio-${f.useId()}`,m=["ds-radio",`ds-radio--${r}`,o&&"ds-radio--disabled"].filter(Boolean).join(" ");return e.jsxs("label",{className:m,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:n,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:r="rect",aspectRatio:o,className:a="",style:n={},...i}){return e.jsx("span",{className:["ds-skeleton",`ds-skeleton--${r}`,a].filter(Boolean).join(" "),style:{width:s,height:t,aspectRatio:o,...n},"aria-hidden":"true",...i})}function bs({lines:s=1,lastLineWidth:t="70%",gap:r,className:o="",style:a={},...n}){return e.jsx("span",{className:["ds-skeleton-text",o].filter(Boolean).join(" "),style:{gap:r,...a},"aria-hidden":"true",...n,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 r=0;r<s.length;r++)t^=s.charCodeAt(r),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:r,size:o=32,className:a="",style:n={},...i}){const l=_s(s??""),[p,d]=f.useState(!1),m=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,...n},"aria-hidden":"true",...i,children:r&&!p?e.jsx("img",{src:r,alt:"",onError:()=>d(!0)}):m})}function ws({children:s,size:t="compact",stickyTop:r,maxHeight:o,className:a="",style:n={},...i}){const l={...o?{maxHeight:o}:{},...r!==void 0?{"--ds-table-sticky-top":typeof r=="number"?`${r}px`:r}:{},...n};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:r,subheader:o,exiting:a,updated:n,className:i="",onClick:l,...p}){return e.jsx("tr",{className:["ds-table-row",t||l?"ds-table-row--interactive":"",r?"ds-table-row--selected":"",o?"ds-table-row--subheader":"",a?"ds-table-row--exiting":"",n?"ds-table-row--updated":"",i].filter(Boolean).join(" "),onClick:l,...p,children:s})}function ks({children:s,colSpan:t=999,...r}){return e.jsx("tr",{className:"ds-table-row ds-table-row--subheader",...r,children:e.jsx("td",{colSpan:t,children:s})})}function Es({children:s,align:t="left",sortDir:r,onSort:o,width:a,className:n="",style:i={},...l}){const p=!!o||r!==void 0,d=r==="asc"?g.ChevronUp:r==="desc"?g.ChevronDown:g.ChevronsUpDown;return e.jsx("th",{className:["ds-th",p?"ds-th--sortable":"",r?"ds-th--sorted":"",t!=="left"?`ds-table-cell--${t}`:"",n].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:r,muted:o,truncate:a,nowrap:n,className:i="",...l}){return e.jsx("td",{className:["ds-td",t!=="left"?`ds-table-cell--${t}`:"",r?"ds-table-cell--secondary":"",o?"ds-table-cell--muted":"",a?"ds-table-cell--truncate":"",n?"ds-table-cell--nowrap":"",i].filter(Boolean).join(" "),...l,children:s})}function Rs({icon:s,title:t,description:r,action:o,size:a="m",className:n="",...i}){return e.jsxs("div",{className:["ds-empty-state",`ds-empty-state--${a}`,n].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}),r&&e.jsx("div",{className:"ds-empty-state__description",children:r}),o&&e.jsx("div",{className:"ds-empty-state__action",children:o})]})}function $s({label:s,hint:t,error:r,required:o=!1,disabled:a=!1,htmlFor:n,children:i,className:l="",style:p,...d}){const m=f.useId(),h=n??m,x=`${h}-hint`,u=`${h}-error`;return e.jsxs("div",{className:`ds-field${l?` ${l}`:""}`,"data-state":r?"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&&!r&&e.jsx("p",{className:"ds-field-hint",id:x,children:t}),r&&e.jsx("p",{className:"ds-field-error",id:u,role:"alert",children:r})]})}function Ss({label:s,value:t,delta:r,size:o="m",inline:a=!1,className:n="",style:i,...l}){const p=r!=null&&r.startsWith("+")?"up":r!=null&&r.startsWith("-")?"down":"neutral";return e.jsxs("div",{className:["ds-stat",`ds-stat--${o}`,a&&"ds-stat--inline",n].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}),r!=null&&e.jsx("span",{className:`ds-stat-delta ds-stat-delta--${p}`,children:r})]})}function As({children:s,separator:t="/","aria-label":r="Breadcrumb",className:o="",style:a,...n}){const i=f.Children.toArray(s).filter(Boolean);return e.jsx("nav",{className:`ds-breadcrumb${o?` ${o}`:""}`,"aria-label":r,style:a,...n,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:r,siblings:o=1,"aria-label":a="Pagination",className:n="",style:i,...l}){const p=Is(s,t,o);return e.jsxs("nav",{className:`ds-pagination${n?` ${n}`:""}`,"aria-label":a,style:i,...l,children:[e.jsx("button",{className:"ds-pagination-arrow",onClick:()=>r==null?void 0:r(s-1),disabled:s<=1,"aria-label":"Previous page",children:e.jsx(g.ChevronLeft,{size:16})}),p.map((d,m)=>d==="…"?e.jsx("span",{className:"ds-pagination-gap","aria-hidden":"true",children:"…"},`gap-${m}`):e.jsx("button",{className:`ds-pagination-page${d===s?" ds-pagination-page--current":""}`,onClick:()=>d!==s&&(r==null?void 0:r(d)),"aria-current":d===s?"page":void 0,"aria-label":`Page ${d}`,children:d},d)),e.jsx("button",{className:"ds-pagination-arrow",onClick:()=>r==null?void 0:r(s+1),disabled:s>=t,"aria-label":"Next page",children:e.jsx(g.ChevronRight,{size:16})})]})}function Is(s,t,r){if(t<=7)return Array.from({length:t},(i,l)=>l+1);const o=Math.max(2,s-r),a=Math.min(t-1,s+r),n=[1];o>2&&n.push("…");for(let i=o;i<=a;i++)n.push(i);return a<t-1&&n.push("…"),n.push(t),n}const Bs=200;function Ps({children:s,title:t,onClose:r,side:o="right",...a}){const n=f.useRef(null),i=f.useId(),[l,p]=f.useState(!1),d=()=>{!r||l||(p(!0),setTimeout(()=>{p(!1),r()},Bs))};f.useEffect(()=>{const u=v=>{v.key==="Escape"&&d()},_=v=>{n.current&&!n.current.contains(v.target)&&d()};return document.addEventListener("keydown",u),document.addEventListener("mousedown",_),()=>{document.removeEventListener("keydown",u),document.removeEventListener("mousedown",_)}},[r,l]);const m=f.Children.toArray(s),h=m.find(u=>(u==null?void 0:u.type)===be),x=m.filter(u=>(u==null?void 0:u.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:n,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}),r&&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:r,onAction:o,onDismiss:a,role:n,...i}){const l=Ms[t],p=n||(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}),r&&e.jsx("button",{type:"button",className:"ds-banner-action",onClick:o,children:r}),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:r,onOpenChange:o,align:a="left",className:n="",style:i,...l}){const[p,d]=f.useState(!1),[m,h]=f.useState(!1),x=r!==void 0,u=x?r:p,_=f.useRef(null),v=f.useRef(null),A=f.useRef(null),S=f.useRef(null),[B,E]=f.useState({}),R=f.useRef(null),F=150,I=()=>{if(x)o==null||o(!1);else{if(m)return;h(!0),R.current=setTimeout(()=>{d(!1),h(!1)},F)}},V=()=>{const b=!u;x?o==null||o(b):b?(clearTimeout(R.current),h(!1),d(!0)):I()},Y=()=>{u||(x?o==null||o(!0):(clearTimeout(R.current),h(!1),d(!0)))};f.useEffect(()=>()=>clearTimeout(R.current),[]),f.useEffect(()=>{if(!u)return;const b=300,w=()=>{var X;const T=(X=_.current)==null?void 0:X.getBoundingClientRect();if(!T)return;const M=window.innerHeight-T.bottom,H=M<b+8&&T.top>M;E(a==="right"?H?{bottom:window.innerHeight-T.top+4,top:"auto",right:window.innerWidth-T.right}:{top:T.bottom+4,bottom:"auto",right:window.innerWidth-T.right}:H?{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)}},[u,a]);const P=()=>{var w;const b=(w=A.current)==null?void 0:w.querySelector('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"]), input, select, textarea');b==null||b.focus()};f.useEffect(()=>{if(!u)return;const b=T=>{var M,H;!((M=_.current)!=null&&M.contains(T.target))&&!((H=v.current)!=null&&H.contains(T.target))&&I()},w=T=>{T.key==="Escape"&&(I(),P())};return document.addEventListener("mousedown",b),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",w)}},[u]),f.useEffect(()=>{if(!u||!S.current||!v.current)return;const b=N(),w=S.current==="last"?b[b.length-1]:b[0];w==null||w.focus(),S.current=null},[u]);const N=()=>v.current?[...v.current.querySelectorAll('button:not([disabled]), a[href]:not([aria-disabled="true"]), [tabindex]:not([tabindex="-1"])')]:[],C=b=>{var w,T;if(b.key==="ArrowDown")b.preventDefault(),u?(w=N()[0])==null||w.focus():(S.current="first",Y());else if(b.key==="ArrowUp")if(b.preventDefault(),!u)S.current="last",Y();else{const M=N();(T=M[M.length-1])==null||T.focus()}},q=b=>{var M,H,X,k;const w=N(),T=w.findIndex(c=>c===document.activeElement);switch(b.key){case"ArrowDown":b.preventDefault(),(M=w[Math.min(T+1,w.length-1)])==null||M.focus();break;case"ArrowUp":b.preventDefault(),T<=0?P():(H=w[T-1])==null||H.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=u&&e.jsx("div",{ref:v,role:"menu",className:["ds-dropdown__menu",`ds-dropdown__menu--${a}`,m&&"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,M=T?"a":"button",H=T?{href:b.disabled?void 0:b.href,"aria-disabled":b.disabled?"true":void 0}:{type:"button",disabled:b.disabled};return e.jsxs(M,{role:"menuitem",className:["ds-dropdown__item",b.danger&&"ds-dropdown__item--danger"].filter(Boolean).join(" "),...H,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",n].filter(Boolean).join(" "),style:i,...l,children:[e.jsx("div",{ref:A,className:"ds-dropdown__trigger",onClick:V,onKeyDown:C,children:s}),typeof document<"u"&&ue.createPortal(W,document.body)]})}function zs({value:s=0,size:t="m",variant:r="default",showValue:o=!1,min:a=2,animate:n=!0}){const i=Math.min(100,Math.max(0,s)),l=Math.max(a,i),p=r==="auto"?i>=70?"success":i>=50?"warning":"danger":r;return e.jsxs("div",{className:["ds-progress",`ds-progress--${t}`,!n&&"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 Os=s=>1-Math.pow(1-s,3),Cs=()=>typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function Be(s,{duration:t=600}={}){const[r,o]=f.useState(s),a=f.useRef(s),n=f.useRef(null);return f.useEffect(()=>{if(Cs()){o(s),a.current=s;return}const i=a.current,l=s-i;if(l===0)return;let p=null;const d=m=>{p||(p=m);const h=Math.min((m-p)/t,1);o(i+l*Os(h)),h<1?n.current=requestAnimationFrame(d):a.current=s};return n.current=requestAnimationFrame(d),()=>cancelAnimationFrame(n.current)},[s,t]),r}function Ws({value:s,duration:t=600,decimals:r=0,prefix:o="",suffix:a=""}){const i=Be(s,{duration:t}).toFixed(r);return`${o}${i}${a}`}function Pe({threshold:s=.1,rootMargin:t="0px",once:r=!1}={}){const o=f.useRef(null),[a,n]=f.useState(!1);return f.useEffect(()=>{const i=o.current;if(!i)return;const l=new IntersectionObserver(([p])=>{p.isIntersecting?(n(!0),r&&l.disconnect()):r||n(!1)},{threshold:s,rootMargin:t});return l.observe(i),()=>l.disconnect()},[s,t,r]),{ref:o,inView:a}}function Us({children:s,as:t="div",once:r=!1,threshold:o=.1,rootMargin:a="0px",onEnter:n,onLeave:i,...l}){const{ref:p,inView:d}=Pe({threshold:o,rootMargin:a,once:r}),m=f.useRef(!1);return f.useEffect(()=>{d&&!m.current&&(n==null||n()),!d&&m.current&&(i==null||i()),m.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,r={})=>{Vs({id:`${Date.now()}-${Math.random()}`,message:t,type:"default",duration:4e3,...r})};return s.success=(t,r)=>s(t,{...r,type:"success"}),s.error=(t,r)=>s(t,{...r,type:"error"}),s.warning=(t,r)=>s(t,{...r,type:"warning"}),{toast:s}}function qs({data:s,onDismiss:t}){const[r,o]=f.useState(!1),a=f.useRef(null);f.useEffect(()=>(requestAnimationFrame(()=>o(!0)),s.duration>0&&(a.current=setTimeout(()=>n(),s.duration)),()=>clearTimeout(a.current)),[]);function n(){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}`,r&&"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:n,"aria-label":"Закрыть",children:e.jsx(g.X,{size:D[3],strokeWidth:1.5})})]})}function Xs({position:s="bottom-right"}){const[t,r]=f.useState(()=>[...le]);return f.useEffect(()=>(_e.add(r),()=>_e.delete(r)),[]),!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:r,badge:o,defaultExpanded:a=!1,expanded:n,onToggle:i,children:l,className:p="",...d}){const m=t==="running",h=e.jsxs("span",{className:"ds-tool-card__title-row",children:[r&&e.jsx("span",{className:"ds-tool-card__icon",children:r}),e.jsx("span",{className:"ds-tool-card__label",children:s}),Ks[t],o]});return l?e.jsx("div",{className:["ds-tool-card",m&&"ds-tool-card--running",p].filter(Boolean).join(" "),...d,children:e.jsx(fe,{title:h,padding:"s",defaultExpanded:a,expanded:m?!1:n,onToggle:m?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:r=800,"aria-label":o="Copy to clipboard",...a}){const[n,i]=f.useState(!1),l=p=>{p.currentTarget.blur(),navigator.clipboard.writeText(s).then(()=>{i(!0),setTimeout(()=>i(!1),r)})};return e.jsx(ie,{variant:"ghost",size:t,state:n?"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,...r}){const[o,a]=f.useState(t);return f.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"})]}),...r,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:r=[],onChange:o,showCounter:a=!0,className:n="","aria-label":i="Steps",...l}){return e.jsxs("div",{className:["ds-step-indicator",n].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 m=d===t,h=r.includes(d)&&!m,x=o&&(d<=t||r.includes(d)),u=["ds-step-indicator__dot",m&&"ds-step-indicator__dot--active",h&&"ds-step-indicator__dot--done"].filter(Boolean).join(" ");return e.jsx("button",{type:"button",className:u,role:"tab","aria-selected":m,"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:r="line",onChunk:o,className:a="",...n}){const i=f.useRef(s);return f.useEffect(()=>{s!==i.current&&(o==null||o(s),i.current=s)},[s,o]),e.jsxs("span",{className:["ds-streaming-text",a].filter(Boolean).join(" "),...n,children:[s,t&&r!=="none"&&e.jsx("span",{className:`ds-cursor ds-cursor--${r}`,"aria-hidden":"true"})]})}function Qs({role:s="assistant",header:t,footer:r,attachments:o,isStreaming:a=!1,children:n,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:n})}):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:n}),r&&e.jsx("div",{className:"ds-chat-message__footer",children:r})]}):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:n}),r&&e.jsx("div",{className:"ds-chat-message__footer",children:r})]})}function et(s,{containerRef:t,smartPause:r=!0}={}){const o=f.useRef(!1),a=f.useRef(0);f.useEffect(()=>{const n=t==null?void 0:t.current;if(!n)return;const i=()=>{const l=n.scrollHeight-n.scrollTop-n.clientHeight<64;!l&&n.scrollTop<a.current&&(o.current=!0),l&&(o.current=!1),a.current=n.scrollTop};return n.addEventListener("scroll",i,{passive:!0}),()=>n.removeEventListener("scroll",i)},[t]),f.useEffect(()=>{const n=t==null?void 0:t.current;n&&(r&&o.current||(n.scrollTop=n.scrollHeight))},s)}function ze({prompts:s,enabled:t,typingSpeed:r=38,erasingSpeed:o=18,holdTime:a=2200,betweenTime:n=380,manualPauseMs:i=5e3}){const[l,p]=f.useState(0),[d,m]=f.useState(""),h=f.useRef("typing"),x=f.useRef(0),u=f.useRef(0),_=f.useRef(null),v=f.useRef(0);f.useEffect(()=>{u.current=l},[l]),f.useEffect(()=>{if(_.current&&(clearTimeout(_.current),_.current=null),!t||s.length===0){m(""),x.current=0,h.current="typing";return}const R=()=>{const F=Date.now();if(v.current>F){_.current=setTimeout(R,v.current-F);return}const I=s[u.current%s.length]??"";h.current==="typing"?(x.current+=1,m(I.slice(0,x.current)),x.current>=I.length?(h.current="holding",_.current=setTimeout(R,a)):_.current=setTimeout(R,r+Math.random()*28)):h.current==="holding"?(h.current="erasing",_.current=setTimeout(R,o)):(x.current=Math.max(0,x.current-1),m(I.slice(0,x.current)),x.current<=0?(h.current="typing",u.current=(u.current+1)%s.length,p(u.current),_.current=setTimeout(R,n)):_.current=setTimeout(R,o))};return _.current=setTimeout(R,260),()=>{_.current&&clearTimeout(_.current)}},[t,s,r,o,a,n]);const A=R=>{if(s.length===0)return;const F=(R%s.length+s.length)%s.length,I=s[F];u.current=F,x.current=I.length,h.current="holding",v.current=Date.now()+i,p(F),m(I)},S=()=>A(u.current+1),B=()=>A(u.current-1),E=s[l%s.length]??"";return{displayed:d,currentPrompt:E,index:l,next:S,prev:B}}let st=0;function tt({value:s="",onChange:t,onSubmit:r,onStop:o,onKeyDown:a,loading:n=!1,disabled:i=!1,placeholder:l="Let's get things done...",animatedPlaceholders:p,attachments:d,images:m,onAttachFiles:h,onAttachImages:x,onRemoveAttachment:u,onRemoveImage:_,acceptImage:v,acceptFile:A,maxImages:S,maxImageSize:B,leftSlot:E,rightSlot:R,className:F="",...I}){const V=f.useRef(null),Y=f.useRef(null),P=f.useRef(0),[N,C]=f.useState(!1),[q,W]=f.useState([]),b=j=>{const $=++st;W(U=>[...U,{id:$,msg:j}]),setTimeout(()=>W(U=>U.filter(K=>K.id!==$)),6e3)},w=j=>W($=>$.filter(U=>U.id!==j)),T=j=>j.type.startsWith("image/"),M=()=>!0,H=v??T,X=A??M,k=j=>{const $=[],U=[],K=[],G=[];let Z=0,ne=S!=null?S-((m==null?void 0:m.length)??0):1/0;for(const Q of j)H(Q)?B&&Q.size>B?K.push(Q.name):ne>0?($.push(Q),ne--):Z++:X(Q)?U.push(Q):G.push(Q.name);return{imageFiles:$,docFiles:U,tooLarge:K,skipped:G,limitExceeded:Z}},c=j=>{const{imageFiles:$,docFiles:U,tooLarge:K,skipped:G,limitExceeded:Z}=k(j);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 ${S} images per message`),x&&$.length&&x($);const ne=U.concat(x?[]:$);h&&ne.length&&h(ne)};f.useEffect(()=>{const j=Y.current;j&&(j.style.height="auto",j.style.height=`${Math.min(j.scrollHeight,200)}px`)},[s]),f.useEffect(()=>{const j=$=>{var K,G,Z;if(n||i)return;const U=(K=$.target)==null?void 0:K.tagName;U==="INPUT"||U==="TEXTAREA"||U==="SELECT"||(G=$.target)!=null&&G.isContentEditable||$.ctrlKey||$.metaKey||$.altKey||$.key.length!==1&&$.key!=="Backspace"&&$.key!=="Delete"||(Z=Y.current)==null||Z.focus()};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[n,i]);const y=j=>{j.preventDefault(),P.current++,j.dataTransfer.types.includes("Files")&&C(!0)},L=j=>{j.preventDefault(),P.current--,P.current===0&&C(!1)},z=j=>j.preventDefault(),ee=j=>{j.preventDefault(),P.current=0,C(!1);const $=Array.from(j.dataTransfer.files);$.length&&c($)},te=j=>{const $=Array.from(j.target.files||[]);V.current&&(V.current.value=""),$.length&&c($)},O=j=>{var Q;if(!x)return;const $=(Q=j.clipboardData)==null?void 0:Q.items;if(!$)return;const U=[];for(const We of $){const Ne=We.getAsFile();Ne&&U.push(Ne)}if(U.length===0)return;const{imageFiles:K,tooLarge:G,skipped:Z,limitExceeded:ne}=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(", ")}`),ne&&b(`Max ${S} images per message`),K.length&&(j.preventDefault(),x(K))},J=!n&&!i&&!!(p!=null&&p.length)&&s.length===0,re=ze({prompts:p??[],enabled:J}),me=j=>{if(J){if(j.key==="ArrowDown"||j.key==="ArrowRight"){j.preventDefault(),re.next();return}if(j.key==="ArrowUp"||j.key==="ArrowLeft"){j.preventDefault(),re.prev();return}if(j.key==="Tab"&&!j.shiftKey){j.preventDefault(),t==null||t(re.currentPrompt);return}}a==null||a(j)},Ce=(s.trim()||(m==null?void 0:m.length)>0||(d==null?void 0:d.length)>0)&&!i,we=h||x;return e.jsxs("div",{className:["ds-prompt-input",F].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",N&&"ds-prompt-input__box--dragging"].filter(Boolean).join(" "),onDragEnter:y,onDragLeave:L,onDragOver:z,onDrop:ee,children:[N&&e.jsx("div",{className:"ds-prompt-input__drag-overlay",children:"Drop files here"}),e.jsx("textarea",{ref:Y,value:s,onChange:j=>t==null?void 0:t(j.target.value),onKeyDown:me,onPaste:O,placeholder:J?"":l,disabled:n||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:re.displayed}),e.jsx("span",{className:"ds-prompt-input__anim-cursor"})]}),m&&m.length>0&&e.jsx("div",{className:"ds-prompt-input__images",children:m.map((j,$)=>e.jsxs("div",{className:"ds-prompt-input__image-thumb",children:[e.jsx("img",{src:j.preview,alt:""}),e.jsx("button",{className:"ds-prompt-input__image-remove",onClick:()=>_==null?void 0:_($),"aria-label":"Remove image",type:"button",children:e.jsx(g.X,{size:12,strokeWidth:2})})]},$))}),q.length>0&&e.jsx("div",{className:"ds-prompt-input__warnings",children:q.map(j=>e.jsxs("div",{className:"ds-prompt-input__warning",role:"alert",children:[e.jsx("span",{children:j.msg}),e.jsx("button",{type:"button",className:"ds-prompt-input__warning-close",onClick:()=>w(j.id),"aria-label":"Dismiss",children:e.jsx(g.X,{size:D[1],strokeWidth:1.5})})]},j.id))}),d&&d.length>0&&e.jsx("div",{className:"ds-prompt-input__attachments",children:d.map((j,$)=>e.jsx(ae,{size:"xs",children:e.jsxs("span",{className:"ds-prompt-input__badge-content",children:[j.uploading?e.jsx(g.Loader,{size:D[1],strokeWidth:1.5,className:"spin"}):e.jsx(g.Paperclip,{size:D[1],strokeWidth:1.5}),j.filename,j.uploading?e.jsx("span",{className:"ds-prompt-input__uploading",children:"Uploading..."}):e.jsx("button",{type:"button",className:"ds-prompt-input__remove-btn",onClick:()=>u==null?void 0:u($),children:e.jsx(g.X,{size:D[1],strokeWidth:1.5})})]})},$))}),e.jsxs("div",{className:"ds-prompt-input__toolbar",children:[we&&e.jsx(ie,{variant:"ghost",size:"xs",icon:e.jsx(g.Paperclip,{size:D[2],strokeWidth:1.5}),"aria-label":"Attach files",onClick:()=>{var j;return(j=V.current)==null?void 0:j.click()}}),E,R,e.jsx("div",{className:"ds-prompt-input__spacer"}),n?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:r,disabled:!Ce,"aria-label":"Send"})]})]})]})}const Ee={fast:0,standard:1,premium:2},Te={fast:"data-5",standard:"data-3",premium:"data-6"};function rt({models:s=[],value:t,onChange:r,size:o="xs",minTier:a,showAutoOption:n=!1,groupByTier:i=!0,className:l="",...p}){const[d,m]=f.useState(!1),h=f.useRef(null),x=f.useRef(null),u=f.useRef(null),[_,v]=f.useState({}),A=s.filter(N=>!a||N.name==="auto"?!0:(Ee[N.tier]??1)>=(Ee[a]??1)),S=A.find(N=>N.name==="auto"),B=A.filter(N=>N.name!=="auto"),E=s.find(N=>N.name===t),F=new Set(B.map(N=>N.tier).filter(Boolean)).size>1;f.useEffect(()=>{if(!d)return;const N=320,C=()=>{var M;const b=(M=x.current)==null?void 0:M.getBoundingClientRect();if(!b)return;const w=window.innerHeight-b.bottom,T=w<N+8&&b.top>w;v({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"}})};C(),window.addEventListener("scroll",C,!0),window.addEventListener("resize",C);const q=b=>{var w,T;!((w=h.current)!=null&&w.contains(b.target))&&!((T=u.current)!=null&&T.contains(b.target))&&m(!1)},W=b=>{b.key==="Escape"&&m(!1)};return document.addEventListener("mousedown",q),document.addEventListener("keydown",W),()=>{window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C),document.removeEventListener("mousedown",q),document.removeEventListener("keydown",W)}},[d]);const I=N=>{r==null||r(N),m(!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}),F&&N.tier&&e.jsx(ae,{size:"xs",variant:Te[N.tier]||"default",children:N.tier})]},N.name),Y=()=>!i||!F?B.map(V):["fast","standard","premium"].flatMap(N=>{const C=B.filter(q=>q.tier===N);return C.length?[e.jsx("div",{className:"ds-model-picker__group-label","data-tier":N,children:N.charAt(0).toUpperCase()+N.slice(1)},`lbl-${N}`),...C.map(V)]:[]}),P=d&&e.jsxs("div",{ref:u,className:"ds-model-picker__menu",style:_,children:[n&&S&&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"})]}),Y()]});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:()=>m(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}),F&&(E==null?void 0:E.tier)&&e.jsx(ae,{size:"xs",variant:Te[E.tier]||"default",children:E.tier})]}),typeof document<"u"&&ue.createPortal(P,document.body)]})}const nt=({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 r of s)t.has(r.filename)||t.set(r.filename,{filename:r.filename,url:r.url,items:[]}),t.get(r.filename).items.push(r);return[...t.values()]}function ot({sources:s=[],layout:t="list",title:r="Sources",maxVisible:o=5,onSourceClick:a}){const[n,i]=f.useState(!1),l=at(s),p=l.length>o,d=n?l:l.slice(0,o),m=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 u=x.items.map(v=>v.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}),u.length>0&&e.jsx("span",{className:"ds-sources-panel__pages",children:je(u)})]},x.filename)}),p&&!n&&e.jsxs("button",{className:"ds-sources-panel__more",onClick:()=>i(!0),children:["+",l.length-o," more sources"]})]}):e.jsxs("div",{className:h,children:[r&&e.jsx("div",{className:"ds-sources-panel__title",children:r}),d.map(x=>{const u=x.items.map(v=>v.page).filter(Boolean),_=!!a;return m?e.jsx(fe,{title:e.jsx(nt,{filename:x.filename,pages:u}),padding:"s",children:x.items.map((v,A)=>e.jsx("div",{className:`ds-sources-panel__snippet${_?" ds-sources-panel__snippet--clickable":""}`,onClick:_?()=>a(v):void 0,children:v.snippet??`p. ${v.page}`},A))},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}),u.length>0&&e.jsx("span",{className:"ds-sources-panel__pages",children:je(u)})]},x.filename)}),p&&!n&&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:r="s",showCount:o=!0,showPercent:a=!1,warningThreshold:n=.8,errorThreshold:i=1}){const l=t>0?s/t:0,p=Math.min(l*100,100),d=l>=i?"error":l>=n?"warning":"normal";return e.jsxs("div",{className:`ds-token-counter ds-token-counter--${r}`,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:r="none",layout:o="inline"}){const a=Math.max(0,Math.min(1,s)),n=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<n?" ds-confidence-bar__seg--filled":""}`},p))}),r==="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:r=!1,lineNumbers:o=!0,maxHeight:a,title:n}){const i=["ds-diff-view",`ds-diff-view--${t}`,r&&"ds-diff-view--wrap"].filter(Boolean).join(" "),l=a?{maxHeight:a,overflowY:"auto"}:void 0;if(t==="split"){const p=s.filter(m=>m.type==="remove"||m.type==="context"),d=s.filter(m=>m.type==="add"||m.type==="context");return e.jsxs("div",{className:i,children:[n&&e.jsx("div",{className:"ds-diff-view__title",children:n}),e.jsxs("div",{className:"ds-diff-view__body",style:l,children:[e.jsx("div",{className:"ds-diff-view__split-col",children:p.map((m,h)=>e.jsx(pe,{line:m,lineNumbers:o},h))}),e.jsx("div",{className:"ds-diff-view__split-col",children:d.map((m,h)=>e.jsx(pe,{line:m,lineNumbers:o},h))})]})]})}return e.jsxs("div",{className:i,children:[n&&e.jsx("div",{className:"ds-diff-view__title",children:n}),e.jsx("div",{className:"ds-diff-view__body",style:l,children:s.map((p,d)=>e.jsx(pe,{line:p,lineNumbers:o},d))})]})}function Oe({value:s="idle",onLike:t,onDislike:r,className:o="",...a}){const n=s!=="idle";return e.jsxs("div",{className:["ds-message-feedback",n&&"ds-message-feedback--voted",o].filter(Boolean).join(" "),...a,children:[(!n||s==="liked")&&e.jsx("button",{className:["ds-message-feedback__btn",s==="liked"&&"ds-message-feedback__btn--liked"].filter(Boolean).join(" "),onClick:t,disabled:n,"aria-label":"Like","aria-pressed":s==="liked",children:e.jsx(g.ThumbsUp,{size:D[1],strokeWidth:1.5,fill:s==="liked"?"currentColor":"none"})}),(!n||s==="disliked")&&e.jsx("button",{className:["ds-message-feedback__btn",s==="disliked"&&"ds-message-feedback__btn--disliked"].filter(Boolean).join(" "),onClick:r,disabled:n,"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 r=new Date,o=t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),a=new Date(r.getFullYear(),r.getMonth(),r.getDate()),n=new Date(a-864e5);if(t>=a)return o;if(t>=n)return`Yesterday ${o}`;const i=t.getDate(),l=t.toLocaleString([],{month:"short"});return`${i} ${l} ${o}`}function mt({role:s="assistant",text:t,timestamp:r,feedbackValue:o="idle",onLike:a,onDislike:n,className:i="",...l}){const p=s==="assistant"&&(a||n),d=!!t,m=r?ft(r):null;return!p&&!d&&!m?null:e.jsxs("div",{className:["ds-message-footer",`ds-message-footer--${s}`,i].filter(Boolean).join(" "),...l,children:[s==="user"&&m&&e.jsx("span",{className:"ds-message-footer__timestamp ds-message-action",children:m}),p&&e.jsx(Oe,{className:"ds-message-action",value:o,onLike:a,onDislike:n}),d&&e.jsx(Fe,{className:"ds-message-action",text:t}),s==="assistant"&&m&&e.jsx("span",{className:"ds-message-footer__timestamp ds-message-action",children:m})]})}exports.Accordion=fe;exports.Alert=rs;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=Oe;exports.MessageFooter=mt;exports.Modal=as;exports.ModalFooter=xe;exports.ModelPicker=rt;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=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.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;
|
package/dist/index.d.ts
CHANGED
|
@@ -837,15 +837,7 @@ export declare function DiffView(props: DiffViewProps): JSX.Element;
|
|
|
837
837
|
|
|
838
838
|
// ─── ToolCallBubble ───────────────────────────────────────────────────────────
|
|
839
839
|
|
|
840
|
-
export
|
|
841
|
-
label: string;
|
|
842
|
-
status?: 'idle' | 'running' | 'success' | 'error';
|
|
843
|
-
icon?: ReactNode;
|
|
844
|
-
badge?: ReactNode;
|
|
845
|
-
className?: string;
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
export declare function ToolCallBubble(props: ToolCallBubbleProps): JSX.Element;
|
|
840
|
+
export declare function ToolCallBubble(props: ToolCallCardProps): JSX.Element;
|
|
849
841
|
|
|
850
842
|
// ─── MessageFeedback ──────────────────────────────────────────────────────────
|
|
851
843
|
|