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