@donkit-ai/design-system 1.4.62 → 1.4.63

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