@donkit-ai/design-system 1.3.12 → 1.3.14
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 +4 -4
- package/dist/index.d.ts +80 -0
- package/dist/index.es.js +1500 -1135
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),w=require("lucide-react"),ue=require("react-dom"),I={1:16,2:20,3:24,4:28,5:48};var me={exports:{}},ce={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -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
|
|
9
|
+
*/var _e;function Le(){if(_e)return ce;_e=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 c in a)c!=="key"&&(n[c]=a[c])}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 le={};/**
|
|
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
|
|
17
|
+
*/var Ne;function Me(){return Ne||(Ne=1,process.env.NODE_ENV!=="production"&&function(){function s(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===H?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case $:return"Fragment";case E:return"Profiler";case T:return"StrictMode";case D:return"Suspense";case N:return"SuspenseList";case U:return"Activity"}if(typeof l=="object")switch(typeof l.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),l.$$typeof){case _:return"Portal";case R:return l.displayName||"Context";case A:return(l._context.displayName||"Context")+".Consumer";case M:var y=l.render;return l=l.displayName,l||(l=y.displayName||y.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case P:return y=l.displayName||null,y!==null?y:s(l.type)||"Memo";case O:y=l._payload,l=l._init;try{return s(l(y))}catch{}}return null}function t(l){return""+l}function r(l){try{t(l);var y=!1}catch{y=!0}if(y){y=console;var B=y.error,C=typeof Symbol=="function"&&Symbol.toStringTag&&l[Symbol.toStringTag]||l.constructor.name||"Object";return B.call(y,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",C),t(l)}}function o(l){if(l===$)return"<>";if(typeof l=="object"&&l!==null&&l.$$typeof===O)return"<...>";try{var y=s(l);return y?"<"+y+">":"<...>"}catch{return"<...>"}}function a(){var l=X.A;return l===null?null:l.getOwner()}function n(){return Error("react-stack-top-frame")}function i(l){if(W.call(l,"key")){var y=Object.getOwnPropertyDescriptor(l,"key").get;if(y&&y.isReactWarning)return!1}return l.key!==void 0}function c(l,y){function B(){L||(L=!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))}B.isReactWarning=!0,Object.defineProperty(l,"key",{get:B,configurable:!0})}function h(){var l=s(this.type);return z[l]||(z[l]=!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.")),l=this.props.ref,l!==void 0?l:null}function f(l,y,B,C,ee,se){var F=B.ref;return l={$$typeof:j,type:l,key:y,props:B,_owner:C},(F!==void 0?F:null)!==null?Object.defineProperty(l,"ref",{enumerable:!1,get:h}):Object.defineProperty(l,"ref",{enumerable:!1,value:null}),l._store={},Object.defineProperty(l._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(l,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(l,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ee}),Object.defineProperty(l,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:se}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l}function p(l,y,B,C,ee,se){var F=y.children;if(F!==void 0)if(C)if(b(F)){for(C=0;C<F.length;C++)m(F[C]);Object.freeze&&Object.freeze(F)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else m(F);if(W.call(y,"key")){F=s(l);var J=Object.keys(y).filter(function(fe){return fe!=="key"});C=0<J.length?"{key: someKey, "+J.join(": ..., ")+": ...}":"{key: someKey}",g[F+C]||(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} />`,I,A,K,A),_[A+I]=!0)}if(A=null,k!==void 0&&(r(k),A=""+k),c(v)&&(r(v.key),A=""+v.key),"key"in v){k={};for(var te in v)te!=="key"&&(k[te]=v[te])}else k=v;return A&&l(k,typeof i=="function"?i.displayName||i.name||"Unknown":i),f(i,A,k,o(),Y,X)}function m(i){x(i)?i._store&&(i._store.validated=1):typeof i=="object"&&i!==null&&i.$$typeof===C&&(i._payload.status==="fulfilled"?x(i._payload.value)&&i._payload.value._store&&(i._payload.value._store.validated=1):i._store&&(i._store.validated=1))}function x(i){return typeof i=="object"&&i!==null&&i.$$typeof===w}var d=u,w=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),R=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),z=Symbol.for("react.activity"),q=Symbol.for("react.client.reference"),H=d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,b=Array.isArray,j=console.createTask?console.createTask:function(){return null};d={react_stack_bottom_frame:function(i){return i()}};var S,B={},M=d.react_stack_bottom_frame.bind(d,n)(),W=j(a(n)),_={};Q.Fragment=g,Q.jsx=function(i,v,k){var I=1e4>H.recentlyCreatedOwnerStacks++;return h(i,v,k,!1,I?Error("react-stack-top-frame"):M,I?j(a(i)):W)},Q.jsxs=function(i,v,k){var I=1e4>H.recentlyCreatedOwnerStacks++;return h(i,v,k,!0,I?Error("react-stack-top-frame"):M,I?j(a(i)):W)}}()),Q}process.env.NODE_ENV==="production"?re.exports=Ne():re.exports=ye();var e=re.exports;function fe({size:t="m",color:s="default",className:r="",...a}){return e.jsx("span",{className:["ds-spinner",`ds-spinner--${t}`,`ds-spinner--${s}`,r].filter(Boolean).join(" "),role:"status","aria-label":"Loading",...a})}const Ee={xs:12,s:14,m:16,l:20};function ce({children:t,variant:s="primary",size:r="m",fullWidth:a=!1,icon:o,disabled:n=!1,state:c="idle",onClick:l,type:p="button",href:f,"aria-label":h,...m}){const x=o&&!t,d=c==="loading",w=c==="success",N=c==="error",g=d||w||N,E=r==="xs"?"s":"m",D=Ee[r]??16,T=d?e.jsx(fe,{size:E}):w?e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:e.jsx(y.Check,{size:D,strokeWidth:2.5})}):N?e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:e.jsx(y.X,{size:D,strokeWidth:2.5})}):null,R=["ds-button",`ds-button--${s}`,`ds-button--${r}`,a&&"ds-button--full",x&&"ds-button--icon-only"].filter(Boolean).join(" "),L=c!=="idle"?c:void 0,P=e.jsxs(e.Fragment,{children:[g?T:o&&e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:o}),t]});if(f){const U=O=>{if(n||d){O.preventDefault();return}O.metaKey||O.ctrlKey||O.button===1||(O.preventDefault(),l==null||l(O))};return e.jsx("a",{className:R,href:n||d?void 0:f,onClick:U,"aria-label":h,"aria-disabled":n||d?"true":void 0,"aria-busy":d?"true":void 0,"data-state":L,...m,children:P})}return e.jsx("button",{type:p,className:R,disabled:n,onClick:d?void 0:l,"aria-label":h,"aria-busy":d?"true":void 0,"data-state":L,...m,children:P})}function ke({label:t,error:s,hint:r,fullWidth:a=!0,icon:o,iconRight:n,onIconRightClick:c,size:l="m",disabled:p,id:f,...h}){const m=f||`input-${u.useId()}`,x=r?`${m}-hint`:void 0,d=s?`${m}-error`:void 0,w=d||x;return e.jsxs("div",{className:`ds-input-wrapper ${a?"ds-input-wrapper--full":""} ${p?"ds-input-wrapper--disabled":""} ${s?"ds-input-wrapper--error":""}`,children:[t&&e.jsx("label",{className:"ds-input-label",htmlFor:m,children:t}),e.jsxs("div",{className:"ds-input-container",children:[o&&e.jsx("span",{className:`ds-input-icon ds-input-icon--${l}`,"aria-hidden":"true",children:o}),e.jsx("input",{id:m,className:`ds-input ds-input--${l} ${o?"ds-input--with-icon":""} ${n?"ds-input--with-icon-right":""} ${s?"ds-input--error":""}`,disabled:p,"aria-invalid":s?"true":"false","aria-describedby":w,...h}),n&&e.jsx("button",{type:"button",className:`ds-input-icon-right ds-input-icon-right--${l}`,onClick:c,tabIndex:-1,"aria-label":"Toggle visibility",children:n})]}),r&&!s&&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:s&&e.jsx("span",{id:d,className:"ds-input-error",role:"alert",children:s})})})]})}function ge({label:t,error:s,hint:r,fullWidth:a=!0,size:o="m",disabled:n,id:c,resize:l=!0,rows:p=3,...f}){const h=c||`textarea-${u.useId()}`,m=r?`${h}-hint`:void 0,x=s?`${h}-error`:void 0,d=x||m;return e.jsxs("div",{className:`ds-textarea-wrapper ${a?"ds-textarea-wrapper--full":""} ${n?"ds-textarea-wrapper--disabled":""}`,children:[t&&e.jsx("label",{className:"ds-textarea-label",htmlFor:h,children:t}),e.jsx("textarea",{id:h,className:`ds-textarea ds-textarea--${o} ${s?"ds-textarea--error":""} ${l?"":"ds-textarea--no-resize"}`,disabled:n,"aria-invalid":s?"true":"false","aria-describedby":d,rows:p,...f}),r&&!s&&e.jsx("span",{id:m,className:"ds-textarea-hint",children:r}),s&&e.jsx("span",{id:x,className:"ds-textarea-error",role:"alert",children:s})]})}function Re({label:t,value:s,onChange:r,options:a=[],placeholder:o="Select option",error:n,fullWidth:c=!0,size:l="m",disabled:p=!1,id:f,...h}){const[m,x]=u.useState(!1),[d,w]=u.useState(!1),[N,g]=u.useState({}),[E,D]=u.useState("down"),[T,R]=u.useState(-1),L=u.useRef(null),P=u.useRef(null),U=u.useRef(null),O=u.useRef(null),C=f||`select-${u.useId()}`,z=`${C}-label`,q=n?`${C}-error`:void 0,H=150,F=(_=!1)=>{d||(w(!0),R(-1),O.current=setTimeout(()=>{var i;x(!1),w(!1),_&&((i=U.current)==null||i.focus())},H))},b=_=>{clearTimeout(O.current),w(!1);const i=_!==void 0?_:Math.max(a.findIndex(v=>v.value===s),0);R(i),x(!0)};u.useEffect(()=>()=>clearTimeout(O.current),[]);const j=()=>{var X;const _=(X=L.current)==null?void 0:X.getBoundingClientRect();if(!_)return;const i=window.innerHeight,v=i-_.bottom,k=_.top,Y=v<300&&k>v;D(Y?"up":"down"),g(Y?{bottom:i-_.top+4,left:_.left,width:_.width}:{top:_.bottom+4,left:_.left,width:_.width})};u.useEffect(()=>{if(m)return j(),window.addEventListener("scroll",j,!0),window.addEventListener("resize",j),()=>{window.removeEventListener("scroll",j,!0),window.removeEventListener("resize",j)}},[m]),u.useEffect(()=>{const _=i=>{L.current&&!L.current.contains(i.target)&&P.current&&!P.current.contains(i.target)&&F()};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[d]),u.useEffect(()=>{var i;if(!m||T<0||!P.current)return;(i=P.current.querySelectorAll(".ds-select-option")[T])==null||i.scrollIntoView({block:"nearest"})},[T,m]);const S=_=>{switch(_.key){case"ArrowDown":_.preventDefault(),m?R(i=>Math.min(i+1,a.length-1)):b();break;case"ArrowUp":_.preventDefault(),m?R(i=>Math.max(i-1,0)):b(a.length-1);break;case"Home":m&&(_.preventDefault(),R(0));break;case"End":m&&(_.preventDefault(),R(a.length-1));break;case"Enter":case" ":_.preventDefault(),m?T>=0&&(r==null||r(a[T].value),F(!0)):b();break;case"Escape":m&&(_.preventDefault(),F(!0));break;case"Tab":m&&F(!1);break}},B=a.find(_=>_.value===s),M=l==="xs"?$[1]:l==="small"?$[2]:$[3],W=m&&e.jsx("div",{ref:P,role:"listbox","aria-labelledby":t?z:void 0,tabIndex:-1,className:["ds-select-dropdown",`ds-select-dropdown--${l}`,`ds-select-dropdown--${E}`,d&&"ds-select-dropdown--closing"].filter(Boolean).join(" "),style:N,children:a.map((_,i)=>e.jsx("button",{id:`${C}-opt-${i}`,type:"button",role:"option",tabIndex:-1,"aria-selected":s===_.value,className:["ds-select-option",`ds-select-option--${l}`,s===_.value&&"ds-select-option--selected",i===T&&"ds-select-option--active"].filter(Boolean).join(" "),onClick:()=>{r==null||r(_.value),F(!0)},children:_.label},_.value))});return e.jsxs("div",{className:`ds-select-wrapper ${c?"ds-select-wrapper--full":""} ${p?"ds-select-wrapper--disabled":""}`,children:[t&&e.jsx("label",{id:z,className:"ds-select-label",children:t}),e.jsx("div",{className:"ds-select-container",ref:L,children:e.jsxs("button",{ref:U,type:"button",id:C,role:"combobox","aria-haspopup":"listbox","aria-expanded":m,"aria-activedescendant":m&&T>=0?`${C}-opt-${T}`:void 0,"aria-labelledby":t?z:void 0,"aria-invalid":n?"true":"false","aria-describedby":q,className:`ds-select-trigger ds-select-trigger--${l} ${n?"ds-select-trigger--error":""}`,onClick:()=>{p||(m?F():b())},onKeyDown:S,disabled:p,...h,children:[e.jsx("span",{className:B?"":"ds-select-placeholder",children:(B==null?void 0:B.label)||o}),e.jsx(y.ChevronDown,{size:M,strokeWidth:1.5,className:`ds-select-icon ${m&&E==="down"?"ds-select-icon--open":""} ${m&&E==="up"?"ds-select-icon--up":""}`,"aria-hidden":"true"})]})}),n&&e.jsx("span",{id:q,className:"ds-select-error",role:"alert",children:n}),typeof document<"u"&&se.createPortal(W,document.body)]})}function Se({label:t,value:s=0,onChange:r,min:a=0,max:o=100,step:n=1,size:c="m",disabled:l=!1,hint:p,error:f,...h}){const m=()=>{if(l)return;const E=Math.min(Number(s)+n,o);r==null||r(E)},x=()=>{if(l)return;const E=Math.max(Number(s)-n,a);r==null||r(E)},d=E=>{if(l)return;const D=E.target.value;if(D===""){r==null||r(a);return}const T=Number(D);if(!isNaN(T)){const R=Math.min(Math.max(T,a),o);r==null||r(R)}},w=["ds-stepper-wrapper",l&&"ds-stepper-wrapper--disabled",f&&"ds-stepper-wrapper--error"].filter(Boolean).join(" "),N=["ds-stepper",`ds-stepper--${c}`,l&&"ds-stepper--disabled"].filter(Boolean).join(" "),g=c==="xs"?$[1]:c==="small"?$[2]:$[3];return e.jsxs("div",{className:w,children:[t&&e.jsx("label",{className:"ds-stepper-label",children:t}),e.jsxs("div",{className:N,children:[e.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--minus",onClick:x,disabled:l||s<=a,"aria-label":"Decrease",children:e.jsx(y.Minus,{size:g,strokeWidth:1.5})}),e.jsx("input",{type:"number",className:"ds-stepper-input",value:s,onChange:d,min:a,max:o,step:n,disabled:l,...h}),e.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--plus",onClick:m,disabled:l||s>=o,"aria-label":"Increase",children:e.jsx(y.Plus,{size:g,strokeWidth:1.5})})]}),p&&!f&&e.jsx("div",{className:"ds-stepper-hint",children:p}),f&&e.jsx("div",{className:"ds-stepper-error",children:f})]})}function me({children:t,padding:s="m",variant:r="info",hover:a=!1,onClick:o,href:n,disabled:c=!1,...l}){const f=(a?"interactive":r)==="interactive"||o||n,h=["ds-card",`ds-card--${s}`,f&&"ds-card--interactive"].filter(Boolean).join(" ");if(n){const d=w=>{if(c){w.preventDefault();return}w.metaKey||w.ctrlKey||w.button===1||(w.preventDefault(),o==null||o(w))};return e.jsx("a",{className:h,href:c?void 0:n,onClick:d,"aria-disabled":c?"true":void 0,...l,children:t})}const m=f&&o?"button":"div",x=f&&o?{type:"button",onClick:o,disabled:c}:{};return e.jsx(m,{className:h,role:f&&!o?"article":void 0,...x,...l,children:t})}function Te({children:t,...s}){return e.jsx("h1",{className:"ds-h1",...s,children:t})}function $e({children:t,...s}){return e.jsx("h2",{className:"ds-h2",...s,children:t})}function Ie({children:t,...s}){return e.jsx("h3",{className:"ds-h3",...s,children:t})}function Ae({children:t,...s}){return e.jsx("h4",{className:"ds-h4",...s,children:t})}function Be({children:t,secondary:s=!1,...r}){return e.jsx("p",{className:`ds-p1 ${s?"ds-p1--secondary":""}`,...r,children:t})}function pe({children:t,secondary:s=!1,...r}){return e.jsx("p",{className:`ds-p2 ${s?"ds-p2--secondary":""}`,...r,children:t})}function ie({children:t,secondary:s=!1,...r}){return e.jsx("p",{className:`ds-p3 ${s?"ds-p3--secondary":""}`,...r,children:t})}function ee({children:t,variant:s="default",size:r="m",role:a,...o}){const n=["ds-badge",`ds-badge--${s}`,`ds-badge--${r}`].filter(Boolean).join(" "),c=a||(["info","success","warning","error"].includes(s)?"status":void 0);return e.jsx("span",{className:n,role:c,...o,children:t})}const De={info:y.Info,success:y.CheckCircle,warning:y.AlertTriangle,error:y.XCircle};function Pe({children:t,variant:s="info",title:r,onClose:a,role:o,...n}){const c=De[s],l=o||(s==="error"?"alert":"status");return e.jsxs("div",{className:`ds-alert ds-alert--${s} ${r?"":"ds-alert--no-title"}`,role:l,...n,children:[c&&e.jsx("div",{className:"ds-alert__icon",children:e.jsx(c,{size:$[3],strokeWidth:1.5})}),e.jsxs("div",{className:"ds-alert__content",children:[r&&e.jsx("div",{className:"ds-alert__title",children:r}),t&&e.jsx("div",{className:"ds-alert__message",children:t})]}),a&&e.jsx("button",{type:"button",className:"ds-alert__close",onClick:a,"aria-label":"Close alert",children:e.jsx(y.X,{size:$[3],strokeWidth:1.5})})]})}const Oe=200;function Ce({children:t,title:s,onClose:r,size:a="m",...o}){const n=u.useRef(null),c=u.useId(),[l,p]=u.useState(!1),f=()=>{!r||l||(p(!0),setTimeout(()=>{p(!1),r()},Oe))};u.useEffect(()=>{const d=N=>{N.key==="Escape"&&f()},w=N=>{n.current&&!n.current.contains(N.target)&&f()};return document.addEventListener("keydown",d),document.addEventListener("mousedown",w),()=>{document.removeEventListener("keydown",d),document.removeEventListener("mousedown",w)}},[r,l]);const h=u.Children.toArray(t),m=h.find(d=>(d==null?void 0:d.type)===ne),x=h.filter(d=>(d==null?void 0:d.type)!==ne);return e.jsx("div",{className:["ds-modal-overlay",l&&"ds-modal-overlay--closing"].filter(Boolean).join(" "),...o,children:e.jsxs("div",{className:`ds-modal ds-modal--${a}`,ref:n,role:"dialog","aria-modal":"true","aria-labelledby":s?c:void 0,children:[(s||r)&&e.jsxs("div",{className:"ds-modal__header",children:[s&&e.jsx("h3",{id:c,className:"ds-modal__title",children:s}),r&&e.jsx(ce,{variant:"ghost",size:"small",icon:e.jsx(y.X,{size:$[2],strokeWidth:1.5}),onClick:f,"aria-label":"Close modal"})]}),e.jsx("div",{className:"ds-modal__body",children:x}),m]})})}function ne({children:t}){return e.jsx("div",{className:"ds-modal__footer",children:t})}function he({children:t,title:s="Code",defaultExpanded:r=!1,expanded:a,onToggle:o,padding:n="s",className:c="",...l}){const[p,f]=u.useState(r),h=a!==void 0,m=h?a:p,x=()=>{h?o==null||o(!a):f(w=>!w)},d=["ds-code-accordion",`ds-code-accordion--${n}`,m&&"ds-code-accordion--expanded",c].filter(Boolean).join(" ");return e.jsxs("div",{className:d,...l,children:[e.jsxs("button",{type:"button",className:"ds-code-accordion__header",onClick:x,"aria-expanded":m,children:[e.jsx("span",{className:"ds-code-accordion__title",children:s}),e.jsx(y.ChevronDown,{size:$[2],strokeWidth:1.5,className:`ds-code-accordion__icon ${m?"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:t})})})})]})}function Me({children:t,block:s=!1,collapsible:r=!1,title:a="Code",defaultExpanded:o=!1,...n}){return s?r?e.jsx(he,{title:a,defaultExpanded:o,...n,children:t}):e.jsx("pre",{className:"ds-code-block",...n,children:e.jsx("code",{children:t})}):e.jsx("code",{className:"ds-code-inline",...n,children:t})}function Le({href:t,children:s,onClick:r,target:a,rel:o,...n}){const l=a==="_blank"?o?`${o} noopener noreferrer`:"noopener noreferrer":o;return e.jsx("a",{href:t,className:"ds-link",onClick:r,target:a,rel:l,...n,children:s})}function Fe({children:t,size:s="m",variant:r="ghost",...a}){return e.jsx("div",{className:"ds-tabs",role:"tablist",...a,children:u.Children.map(t,o=>u.isValidElement(o)?u.cloneElement(o,{size:s,variant:r}):o)})}function ze({children:t,selected:s=!1,onClick:r,size:a="m",variant:o="ghost",disabled:n=!1,icon:c,href:l,...p}){const f=c&&!t,h=["ds-tab",`ds-tab--${a}`,`ds-tab--${o}`,s&&"ds-tab--selected",f&&"ds-tab--icon-only"].filter(Boolean).join(" "),m=e.jsxs(e.Fragment,{children:[c&&e.jsx("span",{className:"ds-tab-icon",children:c}),t]});if(l){const x=d=>{if(n){d.preventDefault();return}d.metaKey||d.ctrlKey||d.button===1||(d.preventDefault(),r==null||r(d))};return e.jsx("a",{role:"tab","aria-current":s?"page":void 0,"aria-disabled":n?"true":void 0,className:h,href:n?void 0:l,onClick:x,...p,children:m})}return e.jsx("button",{role:"tab","aria-selected":s,className:h,onClick:r,disabled:n,...p,children:m})}function We({options:t,value:s,onChange:r,size:a="m",disabled:o=!1}){const n=u.useRef(null),c=u.useRef(null),[l,p]=u.useState(!1),f=u.useRef(!1),h=u.useRef(null),m=u.useRef(null),x=()=>{if(!n.current)return;const d=n.current.querySelector(`[data-value="${s}"]`);if(!d)return;const w=n.current.getBoundingClientRect(),N=d.getBoundingClientRect(),g=N.left-w.left,E=N.width;c.current?(c.current.style.transition=f.current?"left var(--transition-normal), width var(--transition-normal)":"none",c.current.style.left=g+"px",c.current.style.width=E+"px",f.current=!1):(p(!0),requestAnimationFrame(()=>{if(!c.current||!n.current)return;const D=n.current.querySelector(`[data-value="${s}"]`);if(!D)return;const T=n.current.getBoundingClientRect(),R=D.getBoundingClientRect();c.current.style.transition="none",c.current.style.left=R.left-T.left+"px",c.current.style.width=R.width+"px"}))};return m.current=x,u.useLayoutEffect(()=>{const d=h.current!==s;h.current=s,f.current=l&&d,x()}),u.useEffect(()=>{if(!n.current)return;const d=new ResizeObserver(()=>{f.current=!1,m.current()});return d.observe(n.current),()=>d.disconnect()},[]),e.jsxs("div",{className:["ds-seg",`ds-seg--${a}`,o&&"ds-seg--disabled"].filter(Boolean).join(" "),ref:n,role:"group",children:[l&&e.jsx("div",{ref:c,className:"ds-seg__pill","aria-hidden":"true"}),t.map(d=>e.jsxs("button",{type:"button","data-value":d.value,className:["ds-seg__btn",s===d.value&&"ds-seg__btn--active"].filter(Boolean).join(" "),onClick:()=>!o&&r(d.value),"aria-pressed":s===d.value,disabled:o,children:[d.icon&&e.jsx("span",{className:"ds-seg__btn-icon","aria-hidden":"true",children:d.icon}),d.label]},d.value))]})}function be({children:t,title:s,defaultExpanded:r=!1,expanded:a,onToggle:o,padding:n="m",...c}){const[l,p]=u.useState(r),f=a!==void 0,h=f?a:l,m=()=>{f?o==null||o(!a):p(d=>!d)},x=["ds-accordion",`ds-accordion--${n}`,h&&"ds-accordion--expanded"].filter(Boolean).join(" ");return e.jsxs("div",{className:x,...c,children:[e.jsxs("button",{type:"button",className:"ds-accordion__header",onClick:m,"aria-expanded":h,children:[e.jsx("span",{className:"ds-accordion__title",children:s}),e.jsx(y.ChevronDown,{size:$[2],strokeWidth:1.5,className:`ds-accordion__icon ${h?"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:t})})})]})}const V=8,G=8;function Ve(t,s,r){const a=window.innerWidth;let o,n;switch(t){case"top":o=s.top-r.height-V,n=s.left+s.width/2-r.width/2;break;case"bottom":o=s.bottom+V,n=s.left+s.width/2-r.width/2;break;case"left":o=s.top+s.height/2-r.height/2,n=s.left-r.width-V;break;case"right":o=s.top+s.height/2-r.height/2,n=s.right+V;break;default:o=s.bottom+V,n=s.left}const c=Math.max(G,Math.min(a-r.width-G,n)),l=n-c;return{top:o,left:c,arrowOffset:l}}function Ue(t,s,r){const a=window.innerWidth,o=window.innerHeight;if(t.top>=s+V+G)return"top";if(o-t.bottom>=s+V+G)return"bottom";if(a-t.right>=r+V+G)return"right";if(t.left>=r+V+G)return"left";const n=Math.max(t.top,o-t.bottom,t.left,a-t.right);return n===t.top?"top":n===o-t.bottom?"bottom":n===a-t.right?"right":"left"}function He({children:t,content:s,position:r,...a}){const[o,n]=u.useState(!1),[c,l]=u.useState({visibility:"hidden"}),[p,f]=u.useState(r||"top"),h=u.useRef(null),m=u.useRef(null),x=u.useRef(!1),d=()=>{if(!h.current||!m.current)return;const N=h.current.getBoundingClientRect(),g=m.current.getBoundingClientRect(),E=r||Ue(N,g.height,g.width),{top:D,left:T,arrowOffset:R}=Ve(E,N,g);f(E),l({position:"fixed",top:D,left:T,visibility:"visible","--arrow-offset":`${R}px`})};if(u.useEffect(()=>{if(!o)return;l({position:"fixed",visibility:"hidden"});const N=requestAnimationFrame(d);return window.addEventListener("scroll",d,!0),window.addEventListener("resize",d),()=>{cancelAnimationFrame(N),window.removeEventListener("scroll",d,!0),window.removeEventListener("resize",d)}},[o,r]),u.useEffect(()=>{if(!o)return;const N=g=>{h.current&&!h.current.contains(g.target)&&n(!1)};return document.addEventListener("touchstart",N),()=>document.removeEventListener("touchstart",N)},[o]),!s)return t;const w=o&&e.jsx("div",{ref:m,className:`ds-tooltip ds-tooltip--${p}`,role:"tooltip",style:c,children:s});return e.jsxs("div",{ref:h,className:"ds-tooltip-wrapper",onMouseEnter:()=>{x.current||n(!0)},onMouseLeave:()=>{x.current||n(!1)},onTouchStart:()=>{x.current=!0,n(N=>!N)},...a,children:[t,typeof document<"u"&&se.createPortal(w,document.body)]})}function Ye({checked:t=!1,onChange:s,size:r="m",disabled:a=!1,label:o,id:n,...c}){const l=n||`toggle-${u.useId()}`,p=["ds-toggle",`ds-toggle--${r}`,a&&"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:t,onChange:f=>s==null?void 0:s(f.target.checked),disabled:a,...c}),e.jsx("span",{className:"ds-toggle__track",children:e.jsx("span",{className:"ds-toggle__thumb"})}),o&&e.jsx("span",{className:"ds-toggle__label",children:o})]})}function qe({checked:t=!1,onChange:s,size:r="m",disabled:a=!1,label:o,id:n,...c}){const l=n||`checkbox-${u.useId()}`,p=["ds-checkbox",`ds-checkbox--${r}`,a&&"ds-checkbox--disabled"].filter(Boolean).join(" "),f=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:t,onChange:h=>s==null?void 0:s(h.target.checked),disabled:a,...c}),e.jsx("span",{className:"ds-checkbox__box",children:t&&e.jsx(y.Check,{size:f,strokeWidth:2.5,className:"ds-checkbox__icon"})}),o&&e.jsx("span",{className:"ds-checkbox__label",children:o})]})}function Xe({checked:t=!1,onChange:s,size:r="m",disabled:a=!1,label:o,name:n,value:c,id:l,...p}){const f=l||`radio-${u.useId()}`,h=["ds-radio",`ds-radio--${r}`,a&&"ds-radio--disabled"].filter(Boolean).join(" ");return e.jsxs("label",{className:h,htmlFor:f,children:[e.jsx("input",{type:"radio",id:f,className:"ds-radio__input",checked:t,onChange:m=>s==null?void 0:s(m.target.checked),disabled:a,name:n,value:c,...p}),e.jsx("span",{className:"ds-radio__circle",children:e.jsx("span",{className:"ds-radio__dot"})}),o&&e.jsx("span",{className:"ds-radio__label",children:o})]})}function xe({width:t,height:s,shape:r="rect",aspectRatio:a,className:o="",style:n={},...c}){return e.jsx("span",{className:["ds-skeleton",`ds-skeleton--${r}`,o].filter(Boolean).join(" "),style:{width:t,height:s,aspectRatio:a,...n},"aria-hidden":"true",...c})}function Ke({lines:t=1,lastLineWidth:s="70%",gap:r,className:a="",style:o={},...n}){return e.jsx("span",{className:["ds-skeleton-text",a].filter(Boolean).join(" "),style:{gap:r,...o},"aria-hidden":"true",...n,children:Array.from({length:t},(c,l)=>e.jsx("span",{className:"ds-skeleton ds-skeleton--text",style:l===t-1&&t>1?{width:s}:void 0},l))})}xe.Text=Ke;function Ge(t){let s=2166136261;for(let r=0;r<t.length;r++)s^=t.charCodeAt(r),s=Math.imul(s,16777619)>>>0;return s%360}function Je(t){if(!t)return"";const s=t.trim().split(/\s+/);return s.length>=2?(s[0][0]+s[1][0]).toUpperCase():t[0].toUpperCase()}function Ze({seed:t,icon:s,src:r,size:a=32,className:o="",style:n={},...c}){const l=Ge(t??""),[p,f]=u.useState(!1),h=s??e.jsx("span",{className:"ds-avatar__initials",children:Je(t)});return e.jsx("div",{className:["ds-avatar",o].filter(Boolean).join(" "),style:{width:a,height:a,"--ds-avatar-h":l,...n},"aria-hidden":"true",...c,children:r&&!p?e.jsx("img",{src:r,alt:"",onError:()=>f(!0)}):h})}function Qe({children:t,size:s="compact",stickyTop:r,maxHeight:a,className:o="",style:n={},...c}){const l={...a?{maxHeight:a}:{},...r!==void 0?{"--ds-table-sticky-top":typeof r=="number"?`${r}px`:r}:{},...n};return e.jsx("div",{className:["ds-table-wrap",a?"ds-table-wrap--scroll":""].filter(Boolean).join(" "),style:l,children:e.jsx("table",{className:["ds-table",`ds-table--${s}`,o].filter(Boolean).join(" "),...c,children:t})})}function es({children:t,...s}){return e.jsx("thead",{...s,children:t})}function ss({children:t,...s}){return e.jsx("tbody",{...s,children:t})}function ts({children:t,interactive:s,selected:r,subheader:a,className:o="",onClick:n,...c}){return e.jsx("tr",{className:["ds-table-row",s||n?"ds-table-row--interactive":"",r?"ds-table-row--selected":"",a?"ds-table-row--subheader":"",o].filter(Boolean).join(" "),onClick:n,...c,children:t})}function rs({children:t,colSpan:s=999,...r}){return e.jsx("tr",{className:"ds-table-row ds-table-row--subheader",...r,children:e.jsx("td",{colSpan:s,children:t})})}function ns({children:t,align:s="left",sortDir:r,onSort:a,width:o,className:n="",style:c={},...l}){const p=!!a||r!==void 0,f=r==="asc"?y.ChevronUp:r==="desc"?y.ChevronDown:y.ChevronsUpDown;return e.jsx("th",{className:["ds-th",p?"ds-th--sortable":"",r?"ds-th--sorted":"",s!=="left"?`ds-table-cell--${s}`:"",n].filter(Boolean).join(" "),onClick:a,style:{width:o,...c},...l,children:p?e.jsxs("span",{className:"ds-th__inner",children:[t,e.jsx("span",{className:"ds-th__sort-icon",children:e.jsx(f,{size:11,strokeWidth:2.5})})]}):t})}function as({children:t,align:s="left",secondary:r,muted:a,truncate:o,nowrap:n,className:c="",...l}){return e.jsx("td",{className:["ds-td",s!=="left"?`ds-table-cell--${s}`:"",r?"ds-table-cell--secondary":"",a?"ds-table-cell--muted":"",o?"ds-table-cell--truncate":"",n?"ds-table-cell--nowrap":"",c].filter(Boolean).join(" "),...l,children:t})}function os({icon:t,title:s,description:r,action:a,size:o="m",className:n="",...c}){return e.jsxs("div",{className:["ds-empty-state",`ds-empty-state--${o}`,n].filter(Boolean).join(" "),...c,children:[t&&e.jsx("div",{className:"ds-empty-state__icon",children:t}),e.jsx("div",{className:"ds-empty-state__title",children:s}),r&&e.jsx("div",{className:"ds-empty-state__description",children:r}),a&&e.jsx("div",{className:"ds-empty-state__action",children:a})]})}function cs({label:t,hint:s,error:r,required:a=!1,disabled:o=!1,htmlFor:n,children:c,className:l="",style:p,...f}){const h=u.useId(),m=n??h,x=`${m}-hint`,d=`${m}-error`;return e.jsxs("div",{className:`ds-field${l?` ${l}`:""}`,"data-state":r?"error":void 0,"data-required":a?"":void 0,"data-disabled":o?"":void 0,style:p,...f,children:[t&&e.jsx("label",{className:"ds-field-label",htmlFor:m,children:t}),e.jsx("div",{className:"ds-field-control",children:c}),s&&!r&&e.jsx("p",{className:"ds-field-hint",id:x,children:s}),r&&e.jsx("p",{className:"ds-field-error",id:d,role:"alert",children:r})]})}function is({label:t,value:s,delta:r,size:a="m",inline:o=!1,className:n="",style:c,...l}){const p=r!=null&&r.startsWith("+")?"up":r!=null&&r.startsWith("-")?"down":"neutral";return e.jsxs("div",{className:["ds-stat",`ds-stat--${a}`,o&&"ds-stat--inline",n].filter(Boolean).join(" "),style:c,...l,children:[t&&e.jsx("span",{className:"ds-stat-label",children:t}),s!=null&&e.jsx("span",{className:"ds-stat-value",children:s}),r!=null&&e.jsx("span",{className:`ds-stat-delta ds-stat-delta--${p}`,children:r})]})}function ls({children:t,separator:s="/","aria-label":r="Breadcrumb",className:a="",style:o,...n}){const c=u.Children.toArray(t).filter(Boolean);return e.jsx("nav",{className:`ds-breadcrumb${a?` ${a}`:""}`,"aria-label":r,style:o,...n,children:e.jsx("ol",{className:"ds-breadcrumb-list",children:c.map((l,p)=>e.jsxs("li",{className:"ds-breadcrumb-item",children:[l,p<c.length-1&&e.jsx("span",{className:"ds-breadcrumb-sep","aria-hidden":"true",children:s})]},p))})})}function ds({page:t,total:s,onChange:r,siblings:a=1,"aria-label":o="Pagination",className:n="",style:c,...l}){const p=us(t,s,a);return e.jsxs("nav",{className:`ds-pagination${n?` ${n}`:""}`,"aria-label":o,style:c,...l,children:[e.jsx("button",{className:"ds-pagination-arrow",onClick:()=>r==null?void 0:r(t-1),disabled:t<=1,"aria-label":"Previous page",children:e.jsx(y.ChevronLeft,{size:16})}),p.map((f,h)=>f==="…"?e.jsx("span",{className:"ds-pagination-gap","aria-hidden":"true",children:"…"},`gap-${h}`):e.jsx("button",{className:`ds-pagination-page${f===t?" ds-pagination-page--current":""}`,onClick:()=>f!==t&&(r==null?void 0:r(f)),"aria-current":f===t?"page":void 0,"aria-label":`Page ${f}`,children:f},f)),e.jsx("button",{className:"ds-pagination-arrow",onClick:()=>r==null?void 0:r(t+1),disabled:t>=s,"aria-label":"Next page",children:e.jsx(y.ChevronRight,{size:16})})]})}function us(t,s,r){if(s<=7)return Array.from({length:s},(c,l)=>l+1);const a=Math.max(2,t-r),o=Math.min(s-1,t+r),n=[1];a>2&&n.push("…");for(let c=a;c<=o;c++)n.push(c);return o<s-1&&n.push("…"),n.push(s),n}const fs=200;function ms({children:t,title:s,onClose:r,side:a="right",...o}){const n=u.useRef(null),c=u.useId(),[l,p]=u.useState(!1),f=()=>{!r||l||(p(!0),setTimeout(()=>{p(!1),r()},fs))};u.useEffect(()=>{const d=N=>{N.key==="Escape"&&f()},w=N=>{n.current&&!n.current.contains(N.target)&&f()};return document.addEventListener("keydown",d),document.addEventListener("mousedown",w),()=>{document.removeEventListener("keydown",d),document.removeEventListener("mousedown",w)}},[r,l]);const h=u.Children.toArray(t),m=h.find(d=>(d==null?void 0:d.type)===ae),x=h.filter(d=>(d==null?void 0:d.type)!==ae);return e.jsx("div",{className:["ds-drawer-overlay",l&&"ds-drawer-overlay--closing"].filter(Boolean).join(" "),...o,children:e.jsxs("aside",{className:["ds-drawer",l&&"ds-drawer--closing"].filter(Boolean).join(" "),"data-side":a,ref:n,role:"dialog","aria-modal":"true","aria-labelledby":s?c:void 0,children:[e.jsxs("header",{className:"ds-drawer-header",children:[s&&e.jsx("h3",{id:c,className:"ds-drawer-title",children:s}),r&&e.jsx("button",{className:"ds-drawer-close",onClick:f,"aria-label":"Close drawer",children:e.jsx(y.X,{size:$[2],strokeWidth:1.5})})]}),e.jsx("div",{className:"ds-drawer-body",children:x}),m]})})}function ae({children:t}){return e.jsx("footer",{className:"ds-drawer-footer",children:t})}const ps={info:y.Info,success:y.CheckCircle,warning:y.AlertTriangle,error:y.XCircle};function hs({children:t,variant:s="info",action:r,onAction:a,onDismiss:o,role:n,...c}){const l=ps[s],p=n||(s==="error"?"alert":"status");return e.jsxs("div",{className:`ds-banner ds-banner--${s}`,role:p,...c,children:[l&&e.jsx("span",{className:"ds-banner-icon","aria-hidden":"true",children:e.jsx(l,{size:$[2],strokeWidth:1.5})}),e.jsx("span",{className:"ds-banner-text",children:t}),r&&e.jsx("button",{type:"button",className:"ds-banner-action",onClick:a,children:r}),o&&e.jsx("button",{type:"button",className:"ds-banner-dismiss",onClick:o,"aria-label":"Dismiss",children:e.jsx(y.X,{size:$[2],strokeWidth:1.5})})]})}function bs({trigger:t,items:s=[],open:r,onOpenChange:a,align:o="left",className:n="",style:c,...l}){const[p,f]=u.useState(!1),[h,m]=u.useState(!1),x=r!==void 0,d=x?r:p,w=u.useRef(null),N=u.useRef(null),g=u.useRef(null),E=u.useRef(null),[D,T]=u.useState({}),R=u.useRef(null),L=150,P=()=>{if(x)a==null||a(!1);else{if(h)return;m(!0),R.current=setTimeout(()=>{f(!1),m(!1)},L)}},U=()=>{const b=!d;x?a==null||a(b):b?(clearTimeout(R.current),m(!1),f(!0)):P()},O=()=>{d||(x?a==null||a(!0):(clearTimeout(R.current),m(!1),f(!0)))};u.useEffect(()=>()=>clearTimeout(R.current),[]),u.useEffect(()=>{if(!d)return;const b=()=>{var S;const j=(S=w.current)==null?void 0:S.getBoundingClientRect();j&&T(o==="right"?{top:j.bottom+4,right:window.innerWidth-j.right}:{top:j.bottom+4,left:j.left})};return b(),window.addEventListener("scroll",b,!0),window.addEventListener("resize",b),()=>{window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",b)}},[d,o]);const C=()=>{var j;const b=(j=g.current)==null?void 0:j.querySelector('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"]), input, select, textarea');b==null||b.focus()};u.useEffect(()=>{if(!d)return;const b=S=>{var B,M;!((B=w.current)!=null&&B.contains(S.target))&&!((M=N.current)!=null&&M.contains(S.target))&&P()},j=S=>{S.key==="Escape"&&(P(),C())};return document.addEventListener("mousedown",b),document.addEventListener("keydown",j),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",j)}},[d]),u.useEffect(()=>{if(!d||!E.current||!N.current)return;const b=z(),j=E.current==="last"?b[b.length-1]:b[0];j==null||j.focus(),E.current=null},[d]);const z=()=>N.current?[...N.current.querySelectorAll('button:not([disabled]), a[href]:not([aria-disabled="true"]), [tabindex]:not([tabindex="-1"])')]:[],q=b=>{var j,S;if(b.key==="ArrowDown")b.preventDefault(),d?(j=z()[0])==null||j.focus():(E.current="first",O());else if(b.key==="ArrowUp")if(b.preventDefault(),!d)E.current="last",O();else{const B=z();(S=B[B.length-1])==null||S.focus()}},H=b=>{var B,M,W,_;const j=z(),S=j.findIndex(i=>i===document.activeElement);switch(b.key){case"ArrowDown":b.preventDefault(),(B=j[Math.min(S+1,j.length-1)])==null||B.focus();break;case"ArrowUp":b.preventDefault(),S<=0?C():(M=j[S-1])==null||M.focus();break;case"Home":b.preventDefault(),(W=j[0])==null||W.focus();break;case"End":b.preventDefault(),(_=j[j.length-1])==null||_.focus();break;case"Tab":P();break}},F=d&&e.jsx("div",{ref:N,role:"menu",className:["ds-dropdown__menu",`ds-dropdown__menu--${o}`,h&&"ds-dropdown__menu--closing"].filter(Boolean).join(" "),style:D,onKeyDown:H,children:s.map((b,j)=>{if(b.separator)return e.jsx("div",{className:"ds-dropdown__separator"},j);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})]},j);const S=!!b.href,B=S?"a":"button",M=S?{href:b.disabled?void 0:b.href,"aria-disabled":b.disabled?"true":void 0}:{type:"button",disabled:b.disabled};return e.jsxs(B,{role:"menuitem",className:["ds-dropdown__item",b.danger&&"ds-dropdown__item--danger"].filter(Boolean).join(" "),...M,onClick:()=>{var W;(W=b.onClick)==null||W.call(b),P()},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})]},j)})});return e.jsxs("div",{ref:w,className:["ds-dropdown",n].filter(Boolean).join(" "),style:c,...l,children:[e.jsx("div",{ref:g,className:"ds-dropdown__trigger",onClick:U,onKeyDown:q,children:t}),typeof document<"u"&&se.createPortal(F,document.body)]})}function xs({value:t=0,size:s="m",variant:r="default",showValue:a=!1,min:o=2,animate:n=!0}){const c=Math.min(100,Math.max(0,t)),l=Math.max(o,c),p=r==="auto"?c>=70?"success":c>=50?"warning":"danger":r;return e.jsxs("div",{className:["ds-progress",`ds-progress--${s}`,!n&&"ds-progress--instant"].filter(Boolean).join(" "),role:"progressbar","aria-valuenow":c,"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}%`}})}),a&&e.jsxs("span",{className:"ds-progress__value",children:[Math.round(c),"%"]})]})}const vs=t=>1-Math.pow(1-t,3),js=()=>typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function ve(t,{duration:s=600}={}){const[r,a]=u.useState(t),o=u.useRef(t),n=u.useRef(null);return u.useEffect(()=>{if(js()){a(t),o.current=t;return}const c=o.current,l=t-c;if(l===0)return;let p=null;const f=h=>{p||(p=h);const m=Math.min((h-p)/s,1);a(c+l*vs(m)),m<1?n.current=requestAnimationFrame(f):o.current=t};return n.current=requestAnimationFrame(f),()=>cancelAnimationFrame(n.current)},[t,s]),r}function _s({value:t,duration:s=600,decimals:r=0,prefix:a="",suffix:o=""}){const c=ve(t,{duration:s}).toFixed(r);return`${a}${c}${o}`}function je({threshold:t=.1,rootMargin:s="0px",once:r=!1}={}){const a=u.useRef(null),[o,n]=u.useState(!1);return u.useEffect(()=>{const c=a.current;if(!c)return;const l=new IntersectionObserver(([p])=>{p.isIntersecting?(n(!0),r&&l.disconnect()):r||n(!1)},{threshold:t,rootMargin:s});return l.observe(c),()=>l.disconnect()},[t,s,r]),{ref:a,inView:o}}function ws({children:t,as:s="div",once:r=!1,threshold:a=.1,rootMargin:o="0px",onEnter:n,onLeave:c,...l}){const{ref:p,inView:f}=je({threshold:a,rootMargin:o,once:r}),h=u.useRef(!1);return u.useEffect(()=>{f&&!h.current&&(n==null||n()),!f&&h.current&&(c==null||c()),h.current=f},[f]),e.jsx(s,{ref:p,...l,children:typeof t=="function"?t(f):t})}const ue={default:y.Info,success:y.CheckCircle,warning:y.AlertTriangle,error:y.XCircle};let J=[];const oe=new Set;function _e(){oe.forEach(t=>t([...J]))}function Ns(t){J=[...J,t],_e()}function ys(t){J=J.filter(s=>s.id!==t),_e()}function Es(){const t=(s,r={})=>{Ns({id:`${Date.now()}-${Math.random()}`,message:s,type:"default",duration:4e3,...r})};return t.success=(s,r)=>t(s,{...r,type:"success"}),t.error=(s,r)=>t(s,{...r,type:"error"}),t.warning=(s,r)=>t(s,{...r,type:"warning"}),{toast:t}}function ks({data:t,onDismiss:s}){const[r,a]=u.useState(!1),o=u.useRef(null);u.useEffect(()=>(requestAnimationFrame(()=>a(!0)),t.duration>0&&(o.current=setTimeout(()=>n(),t.duration)),()=>clearTimeout(o.current)),[]);function n(){a(!1),setTimeout(()=>s(t.id),250)}const c=ue[t.type]??ue.default;return e.jsxs("div",{className:["ds-toast",`ds-toast--${t.type}`,r&&"ds-toast--visible"].filter(Boolean).join(" "),role:t.type==="error"?"alert":"status","aria-live":"polite",children:[e.jsx("div",{className:"ds-toast__icon",children:e.jsx(c,{size:$[3],strokeWidth:1.5})}),e.jsx("span",{className:"ds-toast__message",children:t.message}),e.jsx("button",{className:"ds-toast__close",onClick:n,"aria-label":"Закрыть",children:e.jsx(y.X,{size:$[3],strokeWidth:1.5})})]})}function gs({position:t="bottom-right"}){const[s,r]=u.useState(()=>[...J]);return u.useEffect(()=>(oe.add(r),()=>oe.delete(r)),[]),!s.length||typeof document>"u"?null:se.createPortal(e.jsx("div",{className:["ds-toast-container",`ds-toast-container--${t}`].join(" "),children:s.map(a=>e.jsx(ks,{data:a,onDismiss:ys},a.id))}),document.body)}const Rs={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 Ss({label:t,status:s="idle",icon:r,badge:a,defaultExpanded:o=!1,expanded:n,onToggle:c,padding:l="s",children:p,...f}){const m=`tc-body-${u.useId().replace(/:/g,"")}`,[x,d]=u.useState(o),w=n!==void 0,N=w?n:x,g=()=>{w?c==null||c(!n):d(E=>!E)};return e.jsxs(me,{padding:l,...f,children:[e.jsxs("button",{type:"button",className:"ds-tool-card__header",onClick:g,"aria-expanded":N,"aria-controls":m,children:[e.jsx(y.ChevronRight,{size:$[1],strokeWidth:1.5,className:`ds-tool-card__chevron${N?" ds-tool-card__chevron--expanded":""}`}),r&&e.jsx("span",{className:"ds-tool-card__icon",children:r}),e.jsx("span",{className:"ds-tool-card__label",children:t}),Rs[s],a]}),N&&e.jsx("div",{id:m,className:"ds-tool-card__body",children:p})]})}function Ts({text:t,size:s="xs",timeout:r=2e3,"aria-label":a="Copy to clipboard",...o}){const[n,c]=u.useState(!1),l=()=>{navigator.clipboard.writeText(t).then(()=>{c(!0),setTimeout(()=>c(!1),r)})};return e.jsx(ce,{variant:"ghost",size:s,icon:n?e.jsx(y.Check,{size:$[1],strokeWidth:1.5}):e.jsx(y.Copy,{size:$[1],strokeWidth:1.5}),"aria-label":a,onClick:l,...o})}function $s({content:t,streaming:s=!1,...r}){const[a,o]=u.useState(s);return u.useEffect(()=>{o(!!s)},[s]),e.jsx(be,{expanded:a,onToggle:o,padding:"s",title:e.jsxs("div",{className:"ds-reasoning__title",children:[e.jsx(y.Brain,{size:$[1],strokeWidth:1.5,className:"ds-reasoning__icon"}),e.jsx(pe,{secondary:!0,children:"Thinking"})]}),...r,children:e.jsxs(ie,{secondary:!0,style:{whiteSpace:"pre-wrap"},children:[t,s&&e.jsx("span",{className:"ds-cursor ds-cursor--line"})]})})}function Is({count:t,current:s=0,done:r=[],onChange:a,showCounter:o=!0,className:n="","aria-label":c="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":c,children:Array.from({length:t},(p,f)=>{const h=f===s,m=r.includes(f)&&!h,x=a&&(f<=s||r.includes(f)),d=["ds-step-indicator__dot",h&&"ds-step-indicator__dot--active",m&&"ds-step-indicator__dot--done"].filter(Boolean).join(" ");return e.jsx("button",{type:"button",className:d,role:"tab","aria-selected":h,"aria-label":`Step ${f+1}`,disabled:!x||f===s,onClick:()=>a==null?void 0:a(f),children:m?e.jsx(y.Check,{size:8,strokeWidth:3}):null},f)})}),o&&e.jsxs(ie,{secondary:!0,className:"ds-step-indicator__counter",children:[s+1," / ",t]})]})}function As({content:t,isStreaming:s=!1,cursor:r="line",onChunk:a,className:o="",...n}){const c=u.useRef(t);return u.useEffect(()=>{t!==c.current&&(a==null||a(t),c.current=t)},[t,a]),e.jsxs("span",{className:["ds-streaming-text",o].filter(Boolean).join(" "),...n,children:[t,s&&r!=="none"&&e.jsx("span",{className:`ds-cursor ds-cursor--${r}`,"aria-hidden":"true"})]})}function Bs({role:t="assistant",header:s,footer:r,attachments:a,isStreaming:o=!1,children:n,className:c="",...l}){const p=["ds-chat-message",`ds-chat-message--${t}`,o&&"ds-chat-message--streaming",c].filter(Boolean).join(" ");return t==="system"?e.jsx("div",{className:p,...l,children:e.jsx("span",{className:"ds-chat-message__system-label",children:n})}):t==="user"?e.jsxs("div",{className:p,...l,children:[a&&e.jsx("div",{className:"ds-chat-message__attachments",children:a}),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:[s&&e.jsx("div",{className:"ds-chat-message__header",children:s}),a&&e.jsx("div",{className:"ds-chat-message__attachments",children:a}),e.jsx("div",{className:"ds-chat-message__body",children:n}),r&&e.jsx("div",{className:"ds-chat-message__footer",children:r})]})}function Ds(t,{containerRef:s,smartPause:r=!0}={}){const a=u.useRef(!1),o=u.useRef(0);u.useEffect(()=>{const n=s==null?void 0:s.current;if(!n)return;const c=()=>{const l=n.scrollHeight-n.scrollTop-n.clientHeight<64;!l&&n.scrollTop<o.current&&(a.current=!0),l&&(a.current=!1),o.current=n.scrollTop};return n.addEventListener("scroll",c,{passive:!0}),()=>n.removeEventListener("scroll",c)},[s]),u.useEffect(()=>{const n=s==null?void 0:s.current;n&&(r&&a.current||(n.scrollTop=n.scrollHeight))},t)}exports.Accordion=be;exports.Alert=Pe;exports.AnimatedNumber=_s;exports.Avatar=Ze;exports.Badge=ee;exports.Banner=hs;exports.Breadcrumb=ls;exports.Button=ce;exports.Card=me;exports.ChatMessage=Bs;exports.Checkbox=qe;exports.Code=Me;exports.CodeAccordion=he;exports.CopyButton=Ts;exports.Drawer=ms;exports.DrawerFooter=ae;exports.Dropdown=bs;exports.EmptyState=os;exports.FormField=cs;exports.H1=Te;exports.H2=$e;exports.H3=Ie;exports.H4=Ae;exports.InView=ws;exports.Input=ke;exports.Link=Le;exports.Modal=Ce;exports.ModalFooter=ne;exports.P1=Be;exports.P2=pe;exports.P3=ie;exports.Pagination=ds;exports.ProgressBar=xs;exports.Radio=Xe;exports.ReasoningBlock=$s;exports.SegmentedControl=We;exports.Select=Re;exports.Skeleton=xe;exports.Spinner=fe;exports.Stat=is;exports.StepIndicator=Is;exports.Stepper=Se;exports.StreamingText=As;exports.Tab=ze;exports.Table=Qe;exports.TableBody=ss;exports.TableHead=es;exports.TableRow=ts;exports.TableSubheaderRow=rs;exports.Tabs=Fe;exports.Td=as;exports.Textarea=ge;exports.Th=ns;exports.ToastContainer=gs;exports.Toggle=Ye;exports.ToolCallCard=Ss;exports.Tooltip=He;exports.iconSizes=$;exports.useAnimatedNumber=ve;exports.useInView=je;exports.useStreamScroll=Ds;exports.useToast=Es;
|
|
22
|
+
<%s key={someKey} {...props} />`,C,F,J,F),g[F+C]=!0)}if(F=null,B!==void 0&&(r(B),F=""+B),i(y)&&(r(y.key),F=""+y.key),"key"in y){B={};for(var re in y)re!=="key"&&(B[re]=y[re])}else B=y;return F&&c(B,typeof l=="function"?l.displayName||l.name||"Unknown":l),f(l,F,B,a(),ee,se)}function m(l){x(l)?l._store&&(l._store.validated=1):typeof l=="object"&&l!==null&&l.$$typeof===O&&(l._payload.status==="fulfilled"?x(l._payload.value)&&l._payload.value._store&&(l._payload.value._store.validated=1):l._store&&(l._store.validated=1))}function x(l){return typeof l=="object"&&l!==null&&l.$$typeof===j}var d=u,j=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),$=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),R=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),H=Symbol.for("react.client.reference"),X=d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=Object.prototype.hasOwnProperty,b=Array.isArray,k=console.createTask?console.createTask:function(){return null};d={react_stack_bottom_frame:function(l){return l()}};var L,z={},q=d.react_stack_bottom_frame.bind(d,n)(),G=k(o(n)),g={};le.Fragment=$,le.jsx=function(l,y,B){var C=1e4>X.recentlyCreatedOwnerStacks++;return p(l,y,B,!1,C?Error("react-stack-top-frame"):q,C?k(o(l)):G)},le.jsxs=function(l,y,B){var C=1e4>X.recentlyCreatedOwnerStacks++;return p(l,y,B,!0,C?Error("react-stack-top-frame"):q,C?k(o(l)):G)}}()),le}process.env.NODE_ENV==="production"?me.exports=Le():me.exports=Me();var e=me.exports;function ge({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 Oe={xs:12,s:14,m:16,l:20};function oe({children:s,variant:t="primary",size:r="m",fullWidth:o=!1,icon:a,disabled:n=!1,state:i="idle",onClick:c,type:h="button",href:f,"aria-label":p,...m}){const x=a&&!s,d=i==="loading",j=i==="success",_=i==="error",$=d||j||_,T=r==="xs"?"s":"m",E=Oe[r]??16,A=d?e.jsx(ge,{size:T}):j?e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:e.jsx(w.Check,{size:E,strokeWidth:2.5})}):_?e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:e.jsx(w.X,{size:E,strokeWidth:2.5})}):null,R=["ds-button",`ds-button--${t}`,`ds-button--${r}`,o&&"ds-button--full",x&&"ds-button--icon-only"].filter(Boolean).join(" "),M=i!=="idle"?i:void 0,D=e.jsxs(e.Fragment,{children:[$?A:a&&e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:a}),s]});if(f){const N=P=>{if(n||d){P.preventDefault();return}P.metaKey||P.ctrlKey||P.button===1||(P.preventDefault(),c==null||c(P))};return e.jsx("a",{className:R,href:n||d?void 0:f,onClick:N,"aria-label":p,"aria-disabled":n||d?"true":void 0,"aria-busy":d?"true":void 0,"data-state":M,...m,children:D})}return e.jsx("button",{type:h,className:R,disabled:n,onClick:d?void 0:c,"aria-label":p,"aria-busy":d?"true":void 0,"data-state":M,...m,children:D})}function Ce({label:s,error:t,hint:r,fullWidth:o=!0,icon:a,iconRight:n,onIconRightClick:i,size:c="m",disabled:h,id:f,...p}){const m=f||`input-${u.useId()}`,x=r?`${m}-hint`:void 0,d=t?`${m}-error`:void 0,j=d||x;return e.jsxs("div",{className:`ds-input-wrapper ${o?"ds-input-wrapper--full":""} ${h?"ds-input-wrapper--disabled":""} ${t?"ds-input-wrapper--error":""}`,children:[s&&e.jsx("label",{className:"ds-input-label",htmlFor:m,children:s}),e.jsxs("div",{className:"ds-input-container",children:[a&&e.jsx("span",{className:`ds-input-icon ds-input-icon--${c}`,"aria-hidden":"true",children:a}),e.jsx("input",{id:m,className:`ds-input ds-input--${c} ${a?"ds-input--with-icon":""} ${n?"ds-input--with-icon-right":""} ${t?"ds-input--error":""}`,disabled:h,"aria-invalid":t?"true":"false","aria-describedby":j,...p}),n&&e.jsx("button",{type:"button",className:`ds-input-icon-right ds-input-icon-right--${c}`,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:d,className:"ds-input-error",role:"alert",children:t})})})]})}function Fe({label:s,error:t,hint:r,fullWidth:o=!0,size:a="m",disabled:n,id:i,resize:c=!0,rows:h=3,...f}){const p=i||`textarea-${u.useId()}`,m=r?`${p}-hint`:void 0,x=t?`${p}-error`:void 0,d=x||m;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:p,children:s}),e.jsx("textarea",{id:p,className:`ds-textarea ds-textarea--${a} ${t?"ds-textarea--error":""} ${c?"":"ds-textarea--no-resize"}`,disabled:n,"aria-invalid":t?"true":"false","aria-describedby":d,rows:h,...f}),r&&!t&&e.jsx("span",{id:m,className:"ds-textarea-hint",children:r}),t&&e.jsx("span",{id:x,className:"ds-textarea-error",role:"alert",children:t})]})}function ze({label:s,value:t,onChange:r,options:o=[],placeholder:a="Select option",error:n,fullWidth:i=!0,size:c="m",disabled:h=!1,id:f,...p}){const[m,x]=u.useState(!1),[d,j]=u.useState(!1),[_,$]=u.useState({}),[T,E]=u.useState("down"),[A,R]=u.useState(-1),M=u.useRef(null),D=u.useRef(null),N=u.useRef(null),P=u.useRef(null),O=f||`select-${u.useId()}`,U=`${O}-label`,H=n?`${O}-error`:void 0,X=150,W=(g=!1)=>{d||(j(!0),R(-1),P.current=setTimeout(()=>{var l;x(!1),j(!1),g&&((l=N.current)==null||l.focus())},X))},b=g=>{clearTimeout(P.current),j(!1);const l=g!==void 0?g:Math.max(o.findIndex(y=>y.value===t),0);R(l),x(!0)};u.useEffect(()=>()=>clearTimeout(P.current),[]);const k=()=>{var se;const g=(se=M.current)==null?void 0:se.getBoundingClientRect();if(!g)return;const l=window.innerHeight,y=l-g.bottom,B=g.top,ee=y<300&&B>y;E(ee?"up":"down"),$(ee?{bottom:l-g.top+4,left:g.left,width:g.width}:{top:g.bottom+4,left:g.left,width:g.width})};u.useEffect(()=>{if(m)return k(),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[m]),u.useEffect(()=>{const g=l=>{M.current&&!M.current.contains(l.target)&&D.current&&!D.current.contains(l.target)&&W()};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[d]),u.useEffect(()=>{var l;if(!m||A<0||!D.current)return;(l=D.current.querySelectorAll(".ds-select-option")[A])==null||l.scrollIntoView({block:"nearest"})},[A,m]);const L=g=>{switch(g.key){case"ArrowDown":g.preventDefault(),m?R(l=>Math.min(l+1,o.length-1)):b();break;case"ArrowUp":g.preventDefault(),m?R(l=>Math.max(l-1,0)):b(o.length-1);break;case"Home":m&&(g.preventDefault(),R(0));break;case"End":m&&(g.preventDefault(),R(o.length-1));break;case"Enter":case" ":g.preventDefault(),m?A>=0&&(r==null||r(o[A].value),W(!0)):b();break;case"Escape":m&&(g.preventDefault(),W(!0));break;case"Tab":m&&W(!1);break}},z=o.find(g=>g.value===t),q=c==="xs"?I[1]:c==="small"?I[2]:I[3],G=m&&e.jsx("div",{ref:D,role:"listbox","aria-labelledby":s?U:void 0,tabIndex:-1,className:["ds-select-dropdown",`ds-select-dropdown--${c}`,`ds-select-dropdown--${T}`,d&&"ds-select-dropdown--closing"].filter(Boolean).join(" "),style:_,children:o.map((g,l)=>e.jsx("button",{id:`${O}-opt-${l}`,type:"button",role:"option",tabIndex:-1,"aria-selected":t===g.value,className:["ds-select-option",`ds-select-option--${c}`,t===g.value&&"ds-select-option--selected",l===A&&"ds-select-option--active"].filter(Boolean).join(" "),onClick:()=>{r==null||r(g.value),W(!0)},children:g.label},g.value))});return e.jsxs("div",{className:`ds-select-wrapper ${i?"ds-select-wrapper--full":""} ${h?"ds-select-wrapper--disabled":""}`,children:[s&&e.jsx("label",{id:U,className:"ds-select-label",children:s}),e.jsx("div",{className:"ds-select-container",ref:M,children:e.jsxs("button",{ref:N,type:"button",id:O,role:"combobox","aria-haspopup":"listbox","aria-expanded":m,"aria-activedescendant":m&&A>=0?`${O}-opt-${A}`:void 0,"aria-labelledby":s?U:void 0,"aria-invalid":n?"true":"false","aria-describedby":H,className:`ds-select-trigger ds-select-trigger--${c} ${n?"ds-select-trigger--error":""}`,onClick:()=>{h||(m?W():b())},onKeyDown:L,disabled:h,...p,children:[e.jsx("span",{className:z?"":"ds-select-placeholder",children:(z==null?void 0:z.label)||a}),e.jsx(w.ChevronDown,{size:q,strokeWidth:1.5,className:`ds-select-icon ${m&&T==="down"?"ds-select-icon--open":""} ${m&&T==="up"?"ds-select-icon--up":""}`,"aria-hidden":"true"})]})}),n&&e.jsx("span",{id:H,className:"ds-select-error",role:"alert",children:n}),typeof document<"u"&&ue.createPortal(G,document.body)]})}function We({label:s,value:t=0,onChange:r,min:o=0,max:a=100,step:n=1,size:i="m",disabled:c=!1,hint:h,error:f,...p}){const m=()=>{if(c)return;const T=Math.min(Number(t)+n,a);r==null||r(T)},x=()=>{if(c)return;const T=Math.max(Number(t)-n,o);r==null||r(T)},d=T=>{if(c)return;const E=T.target.value;if(E===""){r==null||r(o);return}const A=Number(E);if(!isNaN(A)){const R=Math.min(Math.max(A,o),a);r==null||r(R)}},j=["ds-stepper-wrapper",c&&"ds-stepper-wrapper--disabled",f&&"ds-stepper-wrapper--error"].filter(Boolean).join(" "),_=["ds-stepper",`ds-stepper--${i}`,c&&"ds-stepper--disabled"].filter(Boolean).join(" "),$=i==="xs"?I[1]:i==="small"?I[2]:I[3];return e.jsxs("div",{className:j,children:[s&&e.jsx("label",{className:"ds-stepper-label",children:s}),e.jsxs("div",{className:_,children:[e.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--minus",onClick:x,disabled:c||t<=o,"aria-label":"Decrease",children:e.jsx(w.Minus,{size:$,strokeWidth:1.5})}),e.jsx("input",{type:"number",className:"ds-stepper-input",value:t,onChange:d,min:o,max:a,step:n,disabled:c,...p}),e.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--plus",onClick:m,disabled:c||t>=a,"aria-label":"Increase",children:e.jsx(w.Plus,{size:$,strokeWidth:1.5})})]}),h&&!f&&e.jsx("div",{className:"ds-stepper-hint",children:h}),f&&e.jsx("div",{className:"ds-stepper-error",children:f})]})}function ke({children:s,padding:t="m",variant:r="info",hover:o=!1,onClick:a,href:n,disabled:i=!1,...c}){const f=(o?"interactive":r)==="interactive"||a||n,p=["ds-card",`ds-card--${t}`,f&&"ds-card--interactive"].filter(Boolean).join(" ");if(n){const d=j=>{if(i){j.preventDefault();return}j.metaKey||j.ctrlKey||j.button===1||(j.preventDefault(),a==null||a(j))};return e.jsx("a",{className:p,href:i?void 0:n,onClick:d,"aria-disabled":i?"true":void 0,...c,children:s})}const m=f&&a?"button":"div",x=f&&a?{type:"button",onClick:a,disabled:i}:{};return e.jsx(m,{className:p,role:f&&!a?"article":void 0,...x,...c,children:s})}function Ve({children:s,...t}){return e.jsx("h1",{className:"ds-h1",...t,children:s})}function Ue({children:s,...t}){return e.jsx("h2",{className:"ds-h2",...t,children:s})}function He({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 Ye({children:s,secondary:t=!1,...r}){return e.jsx("p",{className:`ds-p1 ${t?"ds-p1--secondary":""}`,...r,children:s})}function Ee({children:s,secondary:t=!1,...r}){return e.jsx("p",{className:`ds-p2 ${t?"ds-p2--secondary":""}`,...r,children:s})}function be({children:s,secondary:t=!1,...r}){return e.jsx("p",{className:`ds-p3 ${t?"ds-p3--secondary":""}`,...r,children:s})}function de({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 Xe={info:w.Info,success:w.CheckCircle,warning:w.AlertTriangle,error:w.XCircle};function Ke({children:s,variant:t="info",title:r,onClose:o,role:a,...n}){const i=Xe[t],c=a||(t==="error"?"alert":"status");return e.jsxs("div",{className:`ds-alert ds-alert--${t} ${r?"":"ds-alert--no-title"}`,role:c,...n,children:[i&&e.jsx("div",{className:"ds-alert__icon",children:e.jsx(i,{size:I[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(w.X,{size:I[3],strokeWidth:1.5})})]})}const Ge=200;function Je({children:s,title:t,onClose:r,size:o="m",...a}){const n=u.useRef(null),i=u.useId(),[c,h]=u.useState(!1),f=()=>{!r||c||(h(!0),setTimeout(()=>{h(!1),r()},Ge))};u.useEffect(()=>{const d=_=>{_.key==="Escape"&&f()},j=_=>{n.current&&!n.current.contains(_.target)&&f()};return document.addEventListener("keydown",d),document.addEventListener("mousedown",j),()=>{document.removeEventListener("keydown",d),document.removeEventListener("mousedown",j)}},[r,c]);const p=u.Children.toArray(s),m=p.find(d=>(d==null?void 0:d.type)===pe),x=p.filter(d=>(d==null?void 0:d.type)!==pe);return e.jsx("div",{className:["ds-modal-overlay",c&&"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(oe,{variant:"ghost",size:"small",icon:e.jsx(w.X,{size:I[2],strokeWidth:1.5}),onClick:f,"aria-label":"Close modal"})]}),e.jsx("div",{className:"ds-modal__body",children:x}),m]})})}function pe({children:s}){return e.jsx("div",{className:"ds-modal__footer",children:s})}function Re({children:s,title:t="Code",defaultExpanded:r=!1,expanded:o,onToggle:a,padding:n="s",className:i="",...c}){const[h,f]=u.useState(r),p=o!==void 0,m=p?o:h,x=()=>{p?a==null||a(!o):f(j=>!j)},d=["ds-code-accordion",`ds-code-accordion--${n}`,m&&"ds-code-accordion--expanded",i].filter(Boolean).join(" ");return e.jsxs("div",{className:d,...c,children:[e.jsxs("button",{type:"button",className:"ds-code-accordion__header",onClick:x,"aria-expanded":m,children:[e.jsx("span",{className:"ds-code-accordion__title",children:t}),e.jsx(w.ChevronDown,{size:I[2],strokeWidth:1.5,className:`ds-code-accordion__icon ${m?"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 Ze({children:s,block:t=!1,collapsible:r=!1,title:o="Code",defaultExpanded:a=!1,...n}){return t?r?e.jsx(Re,{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 Qe({href:s,children:t,onClick:r,target:o,rel:a,...n}){const c=o==="_blank"?a?`${a} noopener noreferrer`:"noopener noreferrer":a;return e.jsx("a",{href:s,className:"ds-link",onClick:r,target:o,rel:c,...n,children:t})}function et({children:s,size:t="m",variant:r="ghost",...o}){return e.jsx("div",{className:"ds-tabs",role:"tablist",...o,children:u.Children.map(s,a=>u.isValidElement(a)?u.cloneElement(a,{size:t,variant:r}):a)})}function tt({children:s,selected:t=!1,onClick:r,size:o="m",variant:a="ghost",disabled:n=!1,icon:i,href:c,...h}){const f=i&&!s,p=["ds-tab",`ds-tab--${o}`,`ds-tab--${a}`,t&&"ds-tab--selected",f&&"ds-tab--icon-only"].filter(Boolean).join(" "),m=e.jsxs(e.Fragment,{children:[i&&e.jsx("span",{className:"ds-tab-icon",children:i}),s]});if(c){const x=d=>{if(n){d.preventDefault();return}d.metaKey||d.ctrlKey||d.button===1||(d.preventDefault(),r==null||r(d))};return e.jsx("a",{role:"tab","aria-current":t?"page":void 0,"aria-disabled":n?"true":void 0,className:p,href:n?void 0:c,onClick:x,...h,children:m})}return e.jsx("button",{role:"tab","aria-selected":t,className:p,onClick:r,disabled:n,...h,children:m})}function st({options:s,value:t,onChange:r,size:o="m",disabled:a=!1}){const n=u.useRef(null),i=u.useRef(null),[c,h]=u.useState(!1),f=u.useRef(!1),p=u.useRef(null),m=u.useRef(null),x=()=>{if(!n.current)return;const d=n.current.querySelector(`[data-value="${t}"]`);if(!d)return;const j=n.current.getBoundingClientRect(),_=d.getBoundingClientRect(),$=_.left-j.left,T=_.width;i.current?(i.current.style.transition=f.current?"left var(--transition-normal), width var(--transition-normal)":"none",i.current.style.left=$+"px",i.current.style.width=T+"px",f.current=!1):(h(!0),requestAnimationFrame(()=>{if(!i.current||!n.current)return;const E=n.current.querySelector(`[data-value="${t}"]`);if(!E)return;const A=n.current.getBoundingClientRect(),R=E.getBoundingClientRect();i.current.style.transition="none",i.current.style.left=R.left-A.left+"px",i.current.style.width=R.width+"px"}))};return m.current=x,u.useLayoutEffect(()=>{const d=p.current!==t;p.current=t,f.current=c&&d,x()}),u.useEffect(()=>{if(!n.current)return;const d=new ResizeObserver(()=>{f.current=!1,m.current()});return d.observe(n.current),()=>d.disconnect()},[]),e.jsxs("div",{className:["ds-seg",`ds-seg--${o}`,a&&"ds-seg--disabled"].filter(Boolean).join(" "),ref:n,role:"group",children:[c&&e.jsx("div",{ref:i,className:"ds-seg__pill","aria-hidden":"true"}),s.map(d=>e.jsxs("button",{type:"button","data-value":d.value,className:["ds-seg__btn",t===d.value&&"ds-seg__btn--active"].filter(Boolean).join(" "),onClick:()=>!a&&r(d.value),"aria-pressed":t===d.value,disabled:a,children:[d.icon&&e.jsx("span",{className:"ds-seg__btn-icon","aria-hidden":"true",children:d.icon}),d.label]},d.value))]})}function Te({children:s,title:t,defaultExpanded:r=!1,expanded:o,onToggle:a,padding:n="m",...i}){const[c,h]=u.useState(r),f=o!==void 0,p=f?o:c,m=()=>{f?a==null||a(!o):h(d=>!d)},x=["ds-accordion",`ds-accordion--${n}`,p&&"ds-accordion--expanded"].filter(Boolean).join(" ");return e.jsxs("div",{className:x,...i,children:[e.jsxs("button",{type:"button",className:"ds-accordion__header",onClick:m,"aria-expanded":p,children:[e.jsx("span",{className:"ds-accordion__title",children:t}),e.jsx(w.ChevronDown,{size:I[2],strokeWidth:1.5,className:`ds-accordion__icon ${p?"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,ae=8;function rt(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(ae,Math.min(o-r.width-ae,n)),c=n-i;return{top:a,left:i,arrowOffset:c}}function nt(s,t,r){const o=window.innerWidth,a=window.innerHeight;if(s.top>=t+te+ae)return"top";if(a-s.bottom>=t+te+ae)return"bottom";if(o-s.right>=r+te+ae)return"right";if(s.left>=r+te+ae)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 at({children:s,content:t,position:r,...o}){const[a,n]=u.useState(!1),[i,c]=u.useState({visibility:"hidden"}),[h,f]=u.useState(r||"top"),p=u.useRef(null),m=u.useRef(null),x=u.useRef(!1),d=()=>{if(!p.current||!m.current)return;const _=p.current.getBoundingClientRect(),$=m.current.getBoundingClientRect(),T=r||nt(_,$.height,$.width),{top:E,left:A,arrowOffset:R}=rt(T,_,$);f(T),c({position:"fixed",top:E,left:A,visibility:"visible","--arrow-offset":`${R}px`})};if(u.useEffect(()=>{if(!a)return;c({position:"fixed",visibility:"hidden"});const _=requestAnimationFrame(d);return window.addEventListener("scroll",d,!0),window.addEventListener("resize",d),()=>{cancelAnimationFrame(_),window.removeEventListener("scroll",d,!0),window.removeEventListener("resize",d)}},[a,r]),u.useEffect(()=>{if(!a)return;const _=$=>{p.current&&!p.current.contains($.target)&&n(!1)};return document.addEventListener("touchstart",_),()=>document.removeEventListener("touchstart",_)},[a]),!t)return s;const j=a&&e.jsx("div",{ref:m,className:`ds-tooltip ds-tooltip--${h}`,role:"tooltip",style:i,children:t});return e.jsxs("div",{ref:p,className:"ds-tooltip-wrapper",onMouseEnter:()=>{x.current||n(!0)},onMouseLeave:()=>{x.current||n(!1)},onTouchStart:()=>{x.current=!0,n(_=>!_)},...o,children:[s,typeof document<"u"&&ue.createPortal(j,document.body)]})}function ot({checked:s=!1,onChange:t,size:r="m",disabled:o=!1,label:a,id:n,...i}){const c=n||`toggle-${u.useId()}`,h=["ds-toggle",`ds-toggle--${r}`,o&&"ds-toggle--disabled"].filter(Boolean).join(" ");return e.jsxs("label",{className:h,htmlFor:c,children:[e.jsx("input",{type:"checkbox",id:c,className:"ds-toggle__input",checked:s,onChange:f=>t==null?void 0:t(f.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 it({checked:s=!1,onChange:t,size:r="m",disabled:o=!1,label:a,id:n,...i}){const c=n||`checkbox-${u.useId()}`,h=["ds-checkbox",`ds-checkbox--${r}`,o&&"ds-checkbox--disabled"].filter(Boolean).join(" "),f=r==="xs"?10:r==="small"?14:r==="large"?20:16;return e.jsxs("label",{className:h,htmlFor:c,children:[e.jsx("input",{type:"checkbox",id:c,className:"ds-checkbox__input",checked:s,onChange:p=>t==null?void 0:t(p.target.checked),disabled:o,...i}),e.jsx("span",{className:"ds-checkbox__box",children:s&&e.jsx(w.Check,{size:f,strokeWidth:2.5,className:"ds-checkbox__icon"})}),a&&e.jsx("span",{className:"ds-checkbox__label",children:a})]})}function ct({checked:s=!1,onChange:t,size:r="m",disabled:o=!1,label:a,name:n,value:i,id:c,...h}){const f=c||`radio-${u.useId()}`,p=["ds-radio",`ds-radio--${r}`,o&&"ds-radio--disabled"].filter(Boolean).join(" ");return e.jsxs("label",{className:p,htmlFor:f,children:[e.jsx("input",{type:"radio",id:f,className:"ds-radio__input",checked:s,onChange:m=>t==null?void 0:t(m.target.checked),disabled:o,name:n,value:i,...h}),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 Se({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 lt({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,c)=>e.jsx("span",{className:"ds-skeleton ds-skeleton--text",style:c===s-1&&s>1?{width:t}:void 0},c))})}Se.Text=lt;function dt(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 ut(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 ft({seed:s,icon:t,src:r,size:o=32,className:a="",style:n={},...i}){const c=dt(s??""),[h,f]=u.useState(!1),p=t??e.jsx("span",{className:"ds-avatar__initials",children:ut(s)});return e.jsx("div",{className:["ds-avatar",a].filter(Boolean).join(" "),style:{width:o,height:o,"--ds-avatar-h":c,...n},"aria-hidden":"true",...i,children:r&&!h?e.jsx("img",{src:r,alt:"",onError:()=>f(!0)}):p})}function mt({children:s,size:t="compact",stickyTop:r,maxHeight:o,className:a="",style:n={},...i}){const c={...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:c,children:e.jsx("table",{className:["ds-table",`ds-table--${t}`,a].filter(Boolean).join(" "),...i,children:s})})}function pt({children:s,...t}){return e.jsx("thead",{...t,children:s})}function ht({children:s,...t}){return e.jsx("tbody",{...t,children:s})}function xt({children:s,interactive:t,selected:r,subheader:o,className:a="",onClick:n,...i}){return e.jsx("tr",{className:["ds-table-row",t||n?"ds-table-row--interactive":"",r?"ds-table-row--selected":"",o?"ds-table-row--subheader":"",a].filter(Boolean).join(" "),onClick:n,...i,children:s})}function bt({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 jt({children:s,align:t="left",sortDir:r,onSort:o,width:a,className:n="",style:i={},...c}){const h=!!o||r!==void 0,f=r==="asc"?w.ChevronUp:r==="desc"?w.ChevronDown:w.ChevronsUpDown;return e.jsx("th",{className:["ds-th",h?"ds-th--sortable":"",r?"ds-th--sorted":"",t!=="left"?`ds-table-cell--${t}`:"",n].filter(Boolean).join(" "),onClick:o,style:{width:a,...i},...c,children:h?e.jsxs("span",{className:"ds-th__inner",children:[s,e.jsx("span",{className:"ds-th__sort-icon",children:e.jsx(f,{size:11,strokeWidth:2.5})})]}):s})}function vt({children:s,align:t="left",secondary:r,muted:o,truncate:a,nowrap:n,className:i="",...c}){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(" "),...c,children:s})}function _t({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 Nt({label:s,hint:t,error:r,required:o=!1,disabled:a=!1,htmlFor:n,children:i,className:c="",style:h,...f}){const p=u.useId(),m=n??p,x=`${m}-hint`,d=`${m}-error`;return e.jsxs("div",{className:`ds-field${c?` ${c}`:""}`,"data-state":r?"error":void 0,"data-required":o?"":void 0,"data-disabled":a?"":void 0,style:h,...f,children:[s&&e.jsx("label",{className:"ds-field-label",htmlFor:m,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:d,role:"alert",children:r})]})}function wt({label:s,value:t,delta:r,size:o="m",inline:a=!1,className:n="",style:i,...c}){const h=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,...c,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--${h}`,children:r})]})}function yt({children:s,separator:t="/","aria-label":r="Breadcrumb",className:o="",style:a,...n}){const i=u.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((c,h)=>e.jsxs("li",{className:"ds-breadcrumb-item",children:[c,h<i.length-1&&e.jsx("span",{className:"ds-breadcrumb-sep","aria-hidden":"true",children:t})]},h))})})}function gt({page:s,total:t,onChange:r,siblings:o=1,"aria-label":a="Pagination",className:n="",style:i,...c}){const h=kt(s,t,o);return e.jsxs("nav",{className:`ds-pagination${n?` ${n}`:""}`,"aria-label":a,style:i,...c,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(w.ChevronLeft,{size:16})}),h.map((f,p)=>f==="…"?e.jsx("span",{className:"ds-pagination-gap","aria-hidden":"true",children:"…"},`gap-${p}`):e.jsx("button",{className:`ds-pagination-page${f===s?" ds-pagination-page--current":""}`,onClick:()=>f!==s&&(r==null?void 0:r(f)),"aria-current":f===s?"page":void 0,"aria-label":`Page ${f}`,children:f},f)),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(w.ChevronRight,{size:16})})]})}function kt(s,t,r){if(t<=7)return Array.from({length:t},(i,c)=>c+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 Et=200;function Rt({children:s,title:t,onClose:r,side:o="right",...a}){const n=u.useRef(null),i=u.useId(),[c,h]=u.useState(!1),f=()=>{!r||c||(h(!0),setTimeout(()=>{h(!1),r()},Et))};u.useEffect(()=>{const d=_=>{_.key==="Escape"&&f()},j=_=>{n.current&&!n.current.contains(_.target)&&f()};return document.addEventListener("keydown",d),document.addEventListener("mousedown",j),()=>{document.removeEventListener("keydown",d),document.removeEventListener("mousedown",j)}},[r,c]);const p=u.Children.toArray(s),m=p.find(d=>(d==null?void 0:d.type)===he),x=p.filter(d=>(d==null?void 0:d.type)!==he);return e.jsx("div",{className:["ds-drawer-overlay",c&&"ds-drawer-overlay--closing"].filter(Boolean).join(" "),...a,children:e.jsxs("aside",{className:["ds-drawer",c&&"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:f,"aria-label":"Close drawer",children:e.jsx(w.X,{size:I[2],strokeWidth:1.5})})]}),e.jsx("div",{className:"ds-drawer-body",children:x}),m]})})}function he({children:s}){return e.jsx("footer",{className:"ds-drawer-footer",children:s})}const Tt={info:w.Info,success:w.CheckCircle,warning:w.AlertTriangle,error:w.XCircle};function St({children:s,variant:t="info",action:r,onAction:o,onDismiss:a,role:n,...i}){const c=Tt[t],h=n||(t==="error"?"alert":"status");return e.jsxs("div",{className:`ds-banner ds-banner--${t}`,role:h,...i,children:[c&&e.jsx("span",{className:"ds-banner-icon","aria-hidden":"true",children:e.jsx(c,{size:I[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(w.X,{size:I[2],strokeWidth:1.5})})]})}function $t({trigger:s,items:t=[],open:r,onOpenChange:o,align:a="left",className:n="",style:i,...c}){const[h,f]=u.useState(!1),[p,m]=u.useState(!1),x=r!==void 0,d=x?r:h,j=u.useRef(null),_=u.useRef(null),$=u.useRef(null),T=u.useRef(null),[E,A]=u.useState({}),R=u.useRef(null),M=150,D=()=>{if(x)o==null||o(!1);else{if(p)return;m(!0),R.current=setTimeout(()=>{f(!1),m(!1)},M)}},N=()=>{const b=!d;x?o==null||o(b):b?(clearTimeout(R.current),m(!1),f(!0)):D()},P=()=>{d||(x?o==null||o(!0):(clearTimeout(R.current),m(!1),f(!0)))};u.useEffect(()=>()=>clearTimeout(R.current),[]),u.useEffect(()=>{if(!d)return;const b=()=>{var L;const k=(L=j.current)==null?void 0:L.getBoundingClientRect();k&&A(a==="right"?{top:k.bottom+4,right:window.innerWidth-k.right}:{top:k.bottom+4,left:k.left})};return b(),window.addEventListener("scroll",b,!0),window.addEventListener("resize",b),()=>{window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",b)}},[d,a]);const O=()=>{var k;const b=(k=$.current)==null?void 0:k.querySelector('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"]), input, select, textarea');b==null||b.focus()};u.useEffect(()=>{if(!d)return;const b=L=>{var z,q;!((z=j.current)!=null&&z.contains(L.target))&&!((q=_.current)!=null&&q.contains(L.target))&&D()},k=L=>{L.key==="Escape"&&(D(),O())};return document.addEventListener("mousedown",b),document.addEventListener("keydown",k),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",k)}},[d]),u.useEffect(()=>{if(!d||!T.current||!_.current)return;const b=U(),k=T.current==="last"?b[b.length-1]:b[0];k==null||k.focus(),T.current=null},[d]);const U=()=>_.current?[..._.current.querySelectorAll('button:not([disabled]), a[href]:not([aria-disabled="true"]), [tabindex]:not([tabindex="-1"])')]:[],H=b=>{var k,L;if(b.key==="ArrowDown")b.preventDefault(),d?(k=U()[0])==null||k.focus():(T.current="first",P());else if(b.key==="ArrowUp")if(b.preventDefault(),!d)T.current="last",P();else{const z=U();(L=z[z.length-1])==null||L.focus()}},X=b=>{var z,q,G,g;const k=U(),L=k.findIndex(l=>l===document.activeElement);switch(b.key){case"ArrowDown":b.preventDefault(),(z=k[Math.min(L+1,k.length-1)])==null||z.focus();break;case"ArrowUp":b.preventDefault(),L<=0?O():(q=k[L-1])==null||q.focus();break;case"Home":b.preventDefault(),(G=k[0])==null||G.focus();break;case"End":b.preventDefault(),(g=k[k.length-1])==null||g.focus();break;case"Tab":D();break}},W=d&&e.jsx("div",{ref:_,role:"menu",className:["ds-dropdown__menu",`ds-dropdown__menu--${a}`,p&&"ds-dropdown__menu--closing"].filter(Boolean).join(" "),style:E,onKeyDown:X,children:t.map((b,k)=>{if(b.separator)return e.jsx("div",{className:"ds-dropdown__separator"},k);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})]},k);const L=!!b.href,z=L?"a":"button",q=L?{href:b.disabled?void 0:b.href,"aria-disabled":b.disabled?"true":void 0}:{type:"button",disabled:b.disabled};return e.jsxs(z,{role:"menuitem",className:["ds-dropdown__item",b.danger&&"ds-dropdown__item--danger"].filter(Boolean).join(" "),...q,onClick:()=>{var G;(G=b.onClick)==null||G.call(b),D()},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})]},k)})});return e.jsxs("div",{ref:j,className:["ds-dropdown",n].filter(Boolean).join(" "),style:i,...c,children:[e.jsx("div",{ref:$,className:"ds-dropdown__trigger",onClick:N,onKeyDown:H,children:s}),typeof document<"u"&&ue.createPortal(W,document.body)]})}function At({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)),c=Math.max(a,i),h=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--${h}`,style:{width:`${c}%`}})}),o&&e.jsxs("span",{className:"ds-progress__value",children:[Math.round(i),"%"]})]})}const It=s=>1-Math.pow(1-s,3),Dt=()=>typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function $e(s,{duration:t=600}={}){const[r,o]=u.useState(s),a=u.useRef(s),n=u.useRef(null);return u.useEffect(()=>{if(Dt()){o(s),a.current=s;return}const i=a.current,c=s-i;if(c===0)return;let h=null;const f=p=>{h||(h=p);const m=Math.min((p-h)/t,1);o(i+c*It(m)),m<1?n.current=requestAnimationFrame(f):a.current=s};return n.current=requestAnimationFrame(f),()=>cancelAnimationFrame(n.current)},[s,t]),r}function Bt({value:s,duration:t=600,decimals:r=0,prefix:o="",suffix:a=""}){const i=$e(s,{duration:t}).toFixed(r);return`${o}${i}${a}`}function Ae({threshold:s=.1,rootMargin:t="0px",once:r=!1}={}){const o=u.useRef(null),[a,n]=u.useState(!1);return u.useEffect(()=>{const i=o.current;if(!i)return;const c=new IntersectionObserver(([h])=>{h.isIntersecting?(n(!0),r&&c.disconnect()):r||n(!1)},{threshold:s,rootMargin:t});return c.observe(i),()=>c.disconnect()},[s,t,r]),{ref:o,inView:a}}function Pt({children:s,as:t="div",once:r=!1,threshold:o=.1,rootMargin:a="0px",onEnter:n,onLeave:i,...c}){const{ref:h,inView:f}=Ae({threshold:o,rootMargin:a,once:r}),p=u.useRef(!1);return u.useEffect(()=>{f&&!p.current&&(n==null||n()),!f&&p.current&&(i==null||i()),p.current=f},[f]),e.jsx(t,{ref:h,...c,children:typeof s=="function"?s(f):s})}const we={default:w.Info,success:w.CheckCircle,warning:w.AlertTriangle,error:w.XCircle};let ie=[];const xe=new Set;function Ie(){xe.forEach(s=>s([...ie]))}function Lt(s){ie=[...ie,s],Ie()}function Mt(s){ie=ie.filter(t=>t.id!==s),Ie()}function Ot(){const s=(t,r={})=>{Lt({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 Ct({data:s,onDismiss:t}){const[r,o]=u.useState(!1),a=u.useRef(null);u.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=we[s.type]??we.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:I[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(w.X,{size:I[3],strokeWidth:1.5})})]})}function Ft({position:s="bottom-right"}){const[t,r]=u.useState(()=>[...ie]);return u.useEffect(()=>(xe.add(r),()=>xe.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(Ct,{data:o,onDismiss:Mt},o.id))}),document.body)}const zt={running:e.jsx(de,{size:"xs",variant:"info",children:"Running..."}),success:e.jsx(de,{size:"xs",variant:"success",children:"Done"}),error:e.jsx(de,{size:"xs",variant:"error",children:"Error"})};function Wt({label:s,status:t="idle",icon:r,badge:o,defaultExpanded:a=!1,expanded:n,onToggle:i,padding:c="s",children:h,...f}){const m=`tc-body-${u.useId().replace(/:/g,"")}`,[x,d]=u.useState(a),j=n!==void 0,_=j?n:x,$=()=>{j?i==null||i(!n):d(T=>!T)};return e.jsxs(ke,{padding:c,...f,children:[e.jsxs("button",{type:"button",className:"ds-tool-card__header",onClick:$,"aria-expanded":_,"aria-controls":m,children:[e.jsx(w.ChevronRight,{size:I[1],strokeWidth:1.5,className:`ds-tool-card__chevron${_?" ds-tool-card__chevron--expanded":""}`}),r&&e.jsx("span",{className:"ds-tool-card__icon",children:r}),e.jsx("span",{className:"ds-tool-card__label",children:s}),zt[t],o]}),_&&e.jsx("div",{id:m,className:"ds-tool-card__body",children:h})]})}function Vt({text:s,size:t="xs",timeout:r=2e3,"aria-label":o="Copy to clipboard",...a}){const[n,i]=u.useState(!1),c=()=>{navigator.clipboard.writeText(s).then(()=>{i(!0),setTimeout(()=>i(!1),r)})};return e.jsx(oe,{variant:"ghost",size:t,icon:n?e.jsx(w.Check,{size:I[1],strokeWidth:1.5}):e.jsx(w.Copy,{size:I[1],strokeWidth:1.5}),"aria-label":o,onClick:c,...a})}function Ut({content:s,streaming:t=!1,...r}){const[o,a]=u.useState(t);return u.useEffect(()=>{a(!!t)},[t]),e.jsx(Te,{expanded:o,onToggle:a,padding:"s",title:e.jsxs("div",{className:"ds-reasoning__title",children:[e.jsx(w.Brain,{size:I[1],strokeWidth:1.5,className:"ds-reasoning__icon"}),e.jsx(Ee,{secondary:!0,children:"Thinking"})]}),...r,children:e.jsxs(be,{secondary:!0,style:{whiteSpace:"pre-wrap"},children:[s,t&&e.jsx("span",{className:"ds-cursor ds-cursor--line"})]})})}function Ht({count:s,current:t=0,done:r=[],onChange:o,showCounter:a=!0,className:n="","aria-label":i="Steps",...c}){return e.jsxs("div",{className:["ds-step-indicator",n].filter(Boolean).join(" "),...c,children:[e.jsx("div",{className:"ds-step-indicator__dots",role:"tablist","aria-label":i,children:Array.from({length:s},(h,f)=>{const p=f===t,m=r.includes(f)&&!p,x=o&&(f<=t||r.includes(f)),d=["ds-step-indicator__dot",p&&"ds-step-indicator__dot--active",m&&"ds-step-indicator__dot--done"].filter(Boolean).join(" ");return e.jsx("button",{type:"button",className:d,role:"tab","aria-selected":p,"aria-label":`Step ${f+1}`,disabled:!x||f===t,onClick:()=>o==null?void 0:o(f),children:m?e.jsx(w.Check,{size:8,strokeWidth:3}):null},f)})}),a&&e.jsxs(be,{secondary:!0,className:"ds-step-indicator__counter",children:[t+1," / ",s]})]})}function qt({content:s,isStreaming:t=!1,cursor:r="line",onChunk:o,className:a="",...n}){const i=u.useRef(s);return u.useEffect(()=>{s!==i.current&&(o==null||o(s),i.current=s)},[s,o]),e.jsxs("span",{className:["ds-streaming-text",a].filter(Boolean).join(" "),...n,children:[s,t&&r!=="none"&&e.jsx("span",{className:`ds-cursor ds-cursor--${r}`,"aria-hidden":"true"})]})}function Yt({role:s="assistant",header:t,footer:r,attachments:o,isStreaming:a=!1,children:n,className:i="",...c}){const h=["ds-chat-message",`ds-chat-message--${s}`,a&&"ds-chat-message--streaming",i].filter(Boolean).join(" ");return s==="system"?e.jsx("div",{className:h,...c,children:e.jsx("span",{className:"ds-chat-message__system-label",children:n})}):s==="user"?e.jsxs("div",{className:h,...c,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:h,...c,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 Xt(s,{containerRef:t,smartPause:r=!0}={}){const o=u.useRef(!1),a=u.useRef(0);u.useEffect(()=>{const n=t==null?void 0:t.current;if(!n)return;const i=()=>{const c=n.scrollHeight-n.scrollTop-n.clientHeight<64;!c&&n.scrollTop<a.current&&(o.current=!0),c&&(o.current=!1),a.current=n.scrollTop};return n.addEventListener("scroll",i,{passive:!0}),()=>n.removeEventListener("scroll",i)},[t]),u.useEffect(()=>{const n=t==null?void 0:t.current;n&&(r&&o.current||(n.scrollTop=n.scrollHeight))},s)}function De({prompts:s,enabled:t,typingSpeed:r=38,erasingSpeed:o=18,holdTime:a=2200,betweenTime:n=380,manualPauseMs:i=5e3}){const[c,h]=u.useState(0),[f,p]=u.useState(""),m=u.useRef("typing"),x=u.useRef(0),d=u.useRef(0),j=u.useRef(null),_=u.useRef(0);u.useEffect(()=>{d.current=c},[c]),u.useEffect(()=>{if(j.current&&(clearTimeout(j.current),j.current=null),!t||s.length===0){p(""),x.current=0,m.current="typing";return}const R=()=>{const M=Date.now();if(_.current>M){j.current=setTimeout(R,_.current-M);return}const D=s[d.current%s.length]??"";m.current==="typing"?(x.current+=1,p(D.slice(0,x.current)),x.current>=D.length?(m.current="holding",j.current=setTimeout(R,a)):j.current=setTimeout(R,r+Math.random()*28)):m.current==="holding"?(m.current="erasing",j.current=setTimeout(R,o)):(x.current=Math.max(0,x.current-1),p(D.slice(0,x.current)),x.current<=0?(m.current="typing",d.current=(d.current+1)%s.length,h(d.current),j.current=setTimeout(R,n)):j.current=setTimeout(R,o))};return j.current=setTimeout(R,260),()=>{j.current&&clearTimeout(j.current)}},[t,s,r,o,a,n]);const $=R=>{if(s.length===0)return;const M=(R%s.length+s.length)%s.length,D=s[M];d.current=M,x.current=D.length,m.current="holding",_.current=Date.now()+i,h(M),p(D)},T=()=>$(d.current+1),E=()=>$(d.current-1),A=s[c%s.length]??"";return{displayed:f,currentPrompt:A,index:c,next:T,prev:E}}let Kt=0;function Gt({value:s="",onChange:t,onSubmit:r,onStop:o,onKeyDown:a,loading:n=!1,disabled:i=!1,placeholder:c="Let's get things done...",animatedPlaceholders:h,attachments:f,images:p,onAttachFiles:m,onAttachImages:x,onRemoveAttachment:d,onRemoveImage:j,acceptImage:_,acceptFile:$,maxImages:T,maxImageSize:E,leftSlot:A,rightSlot:R,className:M="",...D}){const N=u.useRef(null),P=u.useRef(null),O=u.useRef(0),[U,H]=u.useState(!1),[X,W]=u.useState([]),b=v=>{const S=++Kt;W(V=>[...V,{id:S,msg:v}]),setTimeout(()=>W(V=>V.filter(Y=>Y.id!==S)),6e3)},k=v=>W(S=>S.filter(V=>V.id!==v)),L=v=>v.type.startsWith("image/"),z=()=>!0,q=_??L,G=$??z,g=v=>{const S=[],V=[],Y=[],K=[];let Z=0,ne=T!=null?T-((p==null?void 0:p.length)??0):1/0;for(const Q of v)q(Q)?E&&Q.size>E?Y.push(Q.name):ne>0?(S.push(Q),ne--):Z++:G(Q)?V.push(Q):K.push(Q.name);return{imageFiles:S,docFiles:V,tooLarge:Y,skipped:K,limitExceeded:Z}},l=v=>{const{imageFiles:S,docFiles:V,tooLarge:Y,skipped:K,limitExceeded:Z}=g(v);Y.length&&b(`File${Y.length>1?"s":""} too large${E?` (max ${E/1024/1024}MB)`:""}: ${Y.join(", ")}`),K.length&&b(`Skipped unsupported file${K.length>1?"s":""}: ${K.join(", ")}`),Z&&b(`Max ${T} images per message`),x&&S.length&&x(S);const ne=V.concat(x?[]:S);m&&ne.length&&m(ne)};u.useEffect(()=>{const v=P.current;v&&(v.style.height="auto",v.style.height=`${Math.min(v.scrollHeight,200)}px`)},[s]),u.useEffect(()=>{const v=S=>{var Y,K,Z;if(n||i)return;const V=(Y=S.target)==null?void 0:Y.tagName;V==="INPUT"||V==="TEXTAREA"||V==="SELECT"||(K=S.target)!=null&&K.isContentEditable||S.ctrlKey||S.metaKey||S.altKey||S.key.length!==1&&S.key!=="Backspace"&&S.key!=="Delete"||(Z=P.current)==null||Z.focus()};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[n,i]);const y=v=>{v.preventDefault(),O.current++,v.dataTransfer.types.includes("Files")&&H(!0)},B=v=>{v.preventDefault(),O.current--,O.current===0&&H(!1)},C=v=>v.preventDefault(),ee=v=>{v.preventDefault(),O.current=0,H(!1);const S=Array.from(v.dataTransfer.files);S.length&&l(S)},se=v=>{const S=Array.from(v.target.files||[]);N.current&&(N.current.value=""),S.length&&l(S)},F=v=>{var Q;if(!x)return;const S=(Q=v.clipboardData)==null?void 0:Q.items;if(!S)return;const V=[];for(const Pe of S){const ve=Pe.getAsFile();ve&&V.push(ve)}if(V.length===0)return;const{imageFiles:Y,tooLarge:K,skipped:Z,limitExceeded:ne}=g(V);K.length&&b(`File${K.length>1?"s":""} too large: ${K.join(", ")}`),Z.length&&b(`Skipped unsupported file${Z.length>1?"s":""}: ${Z.join(", ")}`),ne&&b(`Max ${T} images per message`),Y.length&&(v.preventDefault(),x(Y))},J=!n&&!i&&!!(h!=null&&h.length)&&s.length===0,re=De({prompts:h??[],enabled:J}),fe=v=>{if(J){if(v.key==="ArrowDown"||v.key==="ArrowRight"){v.preventDefault(),re.next();return}if(v.key==="ArrowUp"||v.key==="ArrowLeft"){v.preventDefault(),re.prev();return}if(v.key==="Tab"&&!v.shiftKey){v.preventDefault(),t==null||t(re.currentPrompt);return}}a==null||a(v)},Be=(s.trim()||(p==null?void 0:p.length)>0||(f==null?void 0:f.length)>0)&&!i,je=m||x;return e.jsxs("div",{className:["ds-prompt-input",M].filter(Boolean).join(" "),...D,children:[je&&e.jsx("input",{ref:N,type:"file",multiple:!0,accept:"*/*",className:"ds-prompt-input__file-input",onChange:se}),e.jsxs("div",{className:["ds-prompt-input__box",U&&"ds-prompt-input__box--dragging"].filter(Boolean).join(" "),onDragEnter:y,onDragLeave:B,onDragOver:C,onDrop:ee,children:[U&&e.jsx("div",{className:"ds-prompt-input__drag-overlay",children:"Drop files here"}),e.jsx("textarea",{ref:P,value:s,onChange:v=>t==null?void 0:t(v.target.value),onKeyDown:fe,onPaste:F,placeholder:J?"":c,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"})]}),p&&p.length>0&&e.jsx("div",{className:"ds-prompt-input__images",children:p.map((v,S)=>e.jsxs("div",{className:"ds-prompt-input__image-thumb",children:[e.jsx("img",{src:v.preview,alt:""}),e.jsx("button",{className:"ds-prompt-input__image-remove",onClick:()=>j==null?void 0:j(S),"aria-label":"Remove image",type:"button",children:e.jsx(w.X,{size:12,strokeWidth:2})})]},S))}),X.length>0&&e.jsx("div",{className:"ds-prompt-input__warnings",children:X.map(v=>e.jsxs("div",{className:"ds-prompt-input__warning",role:"alert",children:[e.jsx("span",{children:v.msg}),e.jsx("button",{type:"button",className:"ds-prompt-input__warning-close",onClick:()=>k(v.id),"aria-label":"Dismiss",children:e.jsx(w.X,{size:I[1],strokeWidth:1.5})})]},v.id))}),f&&f.length>0&&e.jsx("div",{className:"ds-prompt-input__attachments",children:f.map((v,S)=>e.jsx(de,{size:"xs",children:e.jsxs("span",{className:"ds-prompt-input__badge-content",children:[v.uploading?e.jsx(w.Loader,{size:I[1],strokeWidth:1.5,className:"spin"}):e.jsx(w.Paperclip,{size:I[1],strokeWidth:1.5}),v.filename,v.uploading?e.jsx("span",{className:"ds-prompt-input__uploading",children:"Uploading..."}):e.jsx("button",{type:"button",className:"ds-prompt-input__remove-btn",onClick:()=>d==null?void 0:d(S),children:e.jsx(w.X,{size:I[1],strokeWidth:1.5})})]})},S))}),e.jsxs("div",{className:"ds-prompt-input__toolbar",children:[je&&e.jsx(oe,{variant:"ghost",size:"xs",icon:e.jsx(w.Paperclip,{size:I[2],strokeWidth:1.5}),"aria-label":"Attach files",onClick:()=>{var v;return(v=N.current)==null?void 0:v.click()}}),A,R,e.jsx("div",{className:"ds-prompt-input__spacer"}),n?e.jsx(oe,{variant:"primary",size:"xs",icon:e.jsx(w.Square,{size:I[2],strokeWidth:1.5}),onClick:o,"aria-label":"Stop"}):e.jsx(oe,{variant:"primary",size:"xs",icon:e.jsx(w.ArrowUp,{size:I[2],strokeWidth:1.5}),onClick:r,disabled:!Be,"aria-label":"Send"})]})]})]})}const ye={fast:0,standard:1,premium:2};function Jt({models:s=[],value:t,onChange:r,size:o="xs",minTier:a,showAutoOption:n=!1,groupByTier:i=!0,className:c="",...h}){const[f,p]=u.useState(!1),m=u.useRef(null),x=u.useRef(null),[d,j]=u.useState({}),_=s.filter(N=>!a||N.name==="auto"?!0:(ye[N.tier]??1)>=(ye[a]??1)),$=_.find(N=>N.name==="auto"),T=_.filter(N=>N.name!=="auto"),E=s.find(N=>N.name===t);u.useEffect(()=>{var U;if(!f)return;const N=(U=m.current)==null?void 0:U.getBoundingClientRect();N&&j({position:"fixed",zIndex:"var(--z-dropdown, 500)",top:N.bottom+4,right:window.innerWidth-N.right});const P=H=>{var X,W;!((X=m.current)!=null&&X.contains(H.target))&&!((W=x.current)!=null&&W.contains(H.target))&&p(!1)},O=H=>{H.key==="Escape"&&p(!1)};return document.addEventListener("mousedown",P),document.addEventListener("keydown",O),()=>{document.removeEventListener("mousedown",P),document.removeEventListener("keydown",O)}},[f]);const A=N=>{r==null||r(N),p(!1)},R=N=>e.jsxs("button",{type:"button",className:["ds-model-picker__item",N.name===t&&"ds-model-picker__item--active"].filter(Boolean).join(" "),onClick:()=>A(N.name),children:[N.icon?e.jsx("span",{className:"ds-model-picker__item-icon",children:N.icon}):e.jsx(w.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}),N.tier&&e.jsx("span",{className:"ds-model-picker__tier-badge","data-tier":N.tier,children:N.tier})]},N.name),M=()=>i?["fast","standard","premium"].flatMap(N=>{const P=T.filter(O=>O.tier===N);return P.length?[e.jsx("div",{className:"ds-model-picker__group-label","data-tier":N,children:N.charAt(0).toUpperCase()+N.slice(1)},`lbl-${N}`),...P.map(R)]:[]}):T.map(R),D=f&&e.jsxs("div",{ref:x,className:"ds-model-picker__menu",style:d,children:[n&&$&&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:()=>A("auto"),children:[e.jsx(w.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)"})]}),T.length>0&&e.jsx("div",{className:"ds-model-picker__separator"})]}),M()]});return e.jsxs("div",{ref:m,className:["ds-model-picker",c].filter(Boolean).join(" "),...h,children:[e.jsxs("button",{type:"button",className:"ds-model-picker__trigger",onClick:()=>p(N=>!N),"aria-haspopup":"listbox","aria-expanded":f,children:[E!=null&&E.icon?e.jsx("span",{children:E.icon}):e.jsx(w.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}),(E==null?void 0:E.tier)&&e.jsx("span",{className:"ds-model-picker__tier-badge","data-tier":E.tier,children:E.tier})]}),typeof document<"u"&&ue.createPortal(D,document.body)]})}exports.Accordion=Te;exports.Alert=Ke;exports.AnimatedNumber=Bt;exports.Avatar=ft;exports.Badge=de;exports.Banner=St;exports.Breadcrumb=yt;exports.Button=oe;exports.Card=ke;exports.ChatMessage=Yt;exports.Checkbox=it;exports.Code=Ze;exports.CodeAccordion=Re;exports.CopyButton=Vt;exports.Drawer=Rt;exports.DrawerFooter=he;exports.Dropdown=$t;exports.EmptyState=_t;exports.FormField=Nt;exports.H1=Ve;exports.H2=Ue;exports.H3=He;exports.H4=qe;exports.InView=Pt;exports.Input=Ce;exports.Link=Qe;exports.Modal=Je;exports.ModalFooter=pe;exports.ModelPicker=Jt;exports.P1=Ye;exports.P2=Ee;exports.P3=be;exports.Pagination=gt;exports.ProgressBar=At;exports.PromptInput=Gt;exports.Radio=ct;exports.ReasoningBlock=Ut;exports.SegmentedControl=st;exports.Select=ze;exports.Skeleton=Se;exports.Spinner=ge;exports.Stat=wt;exports.StepIndicator=Ht;exports.Stepper=We;exports.StreamingText=qt;exports.Tab=tt;exports.Table=mt;exports.TableBody=ht;exports.TableHead=pt;exports.TableRow=xt;exports.TableSubheaderRow=bt;exports.Tabs=et;exports.Td=vt;exports.Textarea=Fe;exports.Th=jt;exports.ToastContainer=Ft;exports.Toggle=ot;exports.ToolCallCard=Wt;exports.Tooltip=at;exports.iconSizes=I;exports.useAnimatedNumber=$e;exports.useAnimatedPlaceholder=De;exports.useInView=Ae;exports.useStreamScroll=Xt;exports.useToast=Ot;
|
package/dist/index.d.ts
CHANGED
|
@@ -690,3 +690,83 @@ export interface UseStreamScrollOptions {
|
|
|
690
690
|
}
|
|
691
691
|
|
|
692
692
|
export declare function useStreamScroll(deps: any[], options?: UseStreamScrollOptions): void;
|
|
693
|
+
|
|
694
|
+
// ─── PromptInput ──────────────────────────────────────────────────────────────
|
|
695
|
+
|
|
696
|
+
export interface PromptAttachment {
|
|
697
|
+
filename: string;
|
|
698
|
+
uploading?: boolean;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
export interface PromptImage {
|
|
702
|
+
preview: string;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
export interface PromptInputProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'onKeyDown'> {
|
|
706
|
+
value?: string;
|
|
707
|
+
onChange?: (value: string) => void;
|
|
708
|
+
onSubmit?: () => void;
|
|
709
|
+
onStop?: () => void;
|
|
710
|
+
onKeyDown?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
|
711
|
+
loading?: boolean;
|
|
712
|
+
disabled?: boolean;
|
|
713
|
+
placeholder?: string;
|
|
714
|
+
animatedPlaceholders?: string[];
|
|
715
|
+
attachments?: PromptAttachment[];
|
|
716
|
+
images?: PromptImage[];
|
|
717
|
+
onAttachFiles?: (files: File[]) => void;
|
|
718
|
+
onAttachImages?: (files: File[]) => void;
|
|
719
|
+
onRemoveAttachment?: (index: number) => void;
|
|
720
|
+
onRemoveImage?: (index: number) => void;
|
|
721
|
+
acceptImage?: (file: File) => boolean;
|
|
722
|
+
acceptFile?: (file: File) => boolean;
|
|
723
|
+
maxImages?: number;
|
|
724
|
+
maxImageSize?: number;
|
|
725
|
+
leftSlot?: ReactNode;
|
|
726
|
+
rightSlot?: ReactNode;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
export declare function PromptInput(props: PromptInputProps): JSX.Element;
|
|
730
|
+
|
|
731
|
+
// ─── ModelPicker ──────────────────────────────────────────────────────────────
|
|
732
|
+
|
|
733
|
+
export interface PickerModel {
|
|
734
|
+
name: string;
|
|
735
|
+
displayName?: string;
|
|
736
|
+
tier?: 'fast' | 'standard' | 'premium' | string;
|
|
737
|
+
icon?: ReactNode;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
export interface ModelPickerProps extends HTMLAttributes<HTMLDivElement> {
|
|
741
|
+
models: PickerModel[];
|
|
742
|
+
value: string;
|
|
743
|
+
onChange?: (name: string) => void;
|
|
744
|
+
size?: 'xs' | 's' | 'm';
|
|
745
|
+
minTier?: 'fast' | 'standard' | 'premium';
|
|
746
|
+
showAutoOption?: boolean;
|
|
747
|
+
groupByTier?: boolean;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
export declare function ModelPicker(props: ModelPickerProps): JSX.Element;
|
|
751
|
+
|
|
752
|
+
// ─── useAnimatedPlaceholder ───────────────────────────────────────────────────
|
|
753
|
+
|
|
754
|
+
export interface UseAnimatedPlaceholderOptions {
|
|
755
|
+
prompts: string[];
|
|
756
|
+
enabled: boolean;
|
|
757
|
+
typingSpeed?: number;
|
|
758
|
+
erasingSpeed?: number;
|
|
759
|
+
holdTime?: number;
|
|
760
|
+
betweenTime?: number;
|
|
761
|
+
manualPauseMs?: number;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
export interface UseAnimatedPlaceholderResult {
|
|
765
|
+
displayed: string;
|
|
766
|
+
currentPrompt: string;
|
|
767
|
+
index: number;
|
|
768
|
+
next: () => void;
|
|
769
|
+
prev: () => void;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
export declare function useAnimatedPlaceholder(options: UseAnimatedPlaceholderOptions): UseAnimatedPlaceholderResult;
|