import{a as e,n as t}from"./chunk-BneVvdWh.js";import{t as n}from"./react-C7IZe2D1.js";import{ht as r,t as i}from"./dist-DtfJeYQK.js";import{t as a}from"./jsx-runtime-C2wGStra.js";import{g as o,m as s}from"./iframe-D-oZzXNK.js";import{n as c,t as l}from"./dist-Cc1j9Pjk.js";import{n as u,t as d}from"./TokyoUIClose-BsMsQk2w.js";import{o as f,r as p}from"./lib-8ue2PVWI.js";import{n as m,t as h}from"./shared-strings-BFfhcoGp.js";import{a as ee,c as g,i as te,l as ne,o as re,r as _,s as v,t as y}from"./esm-C7OAFD7m.js";import{n as b,t as x}from"./IconButton-DZfzVk_P.js";var S,C,w,T,E,D,O,k,A,j,M,N,P,F,I,L,R,z,B=t((()=>{S=`dialog__bSS9Q`,C=`slideInUp__rqAX4`,w=`slideOutDown__gIYOK`,T=`footer__9qu1N`,E=`opacityIn__ilHLV`,D=`opacityOut__YzYTK`,O=`slideOutUp__h8Uo-`,k=`overlay__NM-kk`,A=`close__e4axJ`,j=`title__1qnWX`,M=`description__0f9xh`,N=`header__2EPvy`,P=`scrollEndDetector__gqxi-`,F=`buttonStack__i3gSV`,I=`stepControls__XBkFS`,L=`previous__0eong`,R=`next__r4NuY`,z={dialog:S,slideInUp:C,slideOutDown:w,footer:T,opacityIn:E,opacityOut:D,slideOutUp:O,overlay:k,close:A,title:j,description:M,header:N,scrollEndDetector:P,buttonStack:F,stepControls:I,previous:L,next:R}}));function ie(e){let[t,n]=(0,V.useState)(null),r=(0,V.useCallback)(e=>n(e),[]);return(0,V.useEffect)(()=>{if(!e||!t)return;let n=async()=>{let e=t.getAnimations().map(e=>e.finished);await Promise.allSettled(e);let{y:n}=t.getBoundingClientRect();t.toggleAttribute(`data-no-border-radius`,n===0)};n(),window.addEventListener(`resize`,n);let r=new ResizeObserver(n);return r.observe(t),()=>{window.removeEventListener(`resize`,n),r.disconnect()}},[e,t]),r}function ae(e){if(typeof e==`string`)return{"data-size":e};let t={};return typeof e._==`string`&&(t[`data-size`]=e._),typeof e[`narrow-l`]==`string`&&(t[`data-size-narrow-l`]=e[`narrow-l`]),typeof e[`medium-s`]==`string`&&(t[`data-size-medium-s`]=e[`medium-s`]),typeof e[`medium-l`]==`string`&&(t[`data-size-medium-l`]=e[`medium-l`]),typeof e[`wide-s`]==`string`&&(t[`data-size-wide-s`]=e[`wide-s`]),typeof e[`wide-l`]==`string`&&(t[`data-size-wide-l`]=e[`wide-l`]),t}var V,H,U,oe=t((()=>{V=e(n(),1),y(),i(),s(),l(),B(),H=a(),U=({children:e,open:t,onOpen:n,onClose:i,overlay:a=!0,size:s=`md`,mobileFullHeight:l=!1,className:u,dataset:d,...f})=>{let p=o(),m=ie(t),h=(0,V.useCallback)(e=>{e?n?.():i?.()},[i,n]),g=[z.dialog,u].filter(Boolean).join(` `),_=r(d,{preplyDsComponent:c.DialogRoot});return(0,H.jsx)(te,{open:t,onOpenChange:h,children:(0,H.jsxs)(ee,{container:p,children:[a&&(0,H.jsx)(ne,{className:z.overlay,forceRender:!0,"data-testid":`dialog-overlay`,"data-preply-ds-component":c.DialogOverlay}),(0,H.jsx)(re,{ref:m,className:g,...ae(s),"data-mobile-full-height":l?``:void 0,..._,...f,children:e})]})})};try{U.displayName=`DialogRoot`,U.__docgenInfo={description:``,displayName:`DialogRoot`,props:{open:{defaultValue:null,description:``,name:`open`,required:!0,type:{name:`enum`,value:[{value:`false`},{value:`true`}]}},onOpen:{defaultValue:null,description:``,name:`onOpen`,required:!1,type:{name:`enum`,value:[{value:`() => void`}]}},onClose:{defaultValue:null,description:``,name:`onClose`,required:!1,type:{name:`enum`,value:[{value:`() => void`}]}},size:{defaultValue:{value:`md`},description:``,name:`size`,required:!1,type:{name:`enum`,value:[{value:`"xs"`},{value:`"sm"`},{value:`"md"`},{value:`"lg"`},{value:`ResponsiveProp<DialogSize>`}]}},mobileFullHeight:{defaultValue:{value:`false`},description:``,name:`mobileFullHeight`,required:!1,type:{name:`enum`,value:[{value:`false`},{value:`true`}]}},overlay:{defaultValue:{value:`true`},description:``,name:`overlay`,required:!1,type:{name:`enum`,value:[{value:`false`},{value:`true`}]}},dataset:{defaultValue:null,description:`@deprecated Pass data attributes as regular props instead
@example <DialogRoot data-testid="dialog-root">...</DialogRoot>`,name:`dataset`,required:!1,type:{name:`enum`,value:[{value:`Dataset`}]}}}}}catch{}})),W,G,K,se=t((()=>{W=e(n(),1),y(),i(),B(),G=a(),K=(0,W.forwardRef)(function({children:e,className:t,dataset:n,...i},a){let o=[z.title,t].filter(Boolean).join(` `),s=r(n);return(0,G.jsx)(_,{ref:a,className:o,...s,...i,children:e})});try{K.displayName=`DialogTitle`,K.__docgenInfo={description:``,displayName:`DialogTitle`,props:{dataset:{defaultValue:null,description:`@deprecated Pass data attributes as regular props instead
@example <DialogTitle data-testid="dialog-title">Dialog Title</DialogTitle>`,name:`dataset`,required:!1,type:{name:`enum`,value:[{value:`Dataset`}]}}}}}catch{}})),q,J,Y,ce=t((()=>{q=e(n(),1),y(),i(),B(),J=a(),Y=(0,q.forwardRef)(function({children:e,className:t,dataset:n,...i},a){if(!e)return null;let o=[z.description,t].filter(Boolean).join(` `),s=r(n);return(0,J.jsx)(v,{ref:a,className:o,...s,...i,children:e})});try{Y.displayName=`DialogDescription`,Y.__docgenInfo={description:``,displayName:`DialogDescription`,props:{dataset:{defaultValue:null,description:`@deprecated Pass data attributes as regular props instead
@example <DialogDescription data-testid="dialog-description">...</DialogDescription>`,name:`dataset`,required:!1,type:{name:`enum`,value:[{value:`Dataset`}]}}}}}catch{}})),X,Z,Q,$,le=t((()=>{X=e(n(),1),y(),p(),u(),b(),m(),B(),Z=a(),Q=(0,X.forwardRef)(function({children:e,className:t},n){return(0,Z.jsx)(`div`,{className:[z.close,t].filter(Boolean).join(` `),children:(0,Z.jsx)(g,{ref:n,render:e??(0,Z.jsx)($,{})})})}),$=(0,X.forwardRef)(function(e,t){let{formatMessage:n}=f();return(0,Z.jsx)(x,{ref:t,size:`small`,variant:`ghost`,dataset:{testid:`dialog-close`},assistiveText:n(h.close),svg:d,...e})});try{Q.displayName=`DialogCloseButton`,Q.__docgenInfo={description:"The DialogCloseButton is a container which defaults to:\n1. Displaying an `IconButton` child with a `TokyoUIClose` icon, which can be\n   overridden with the `children` prop.\n2. Being absolutely positioned at the top right corner of the dialog, which\n   can be overridden with the `className` prop.",displayName:`DialogCloseButton`,props:{className:{defaultValue:null,description:``,name:`className`,required:!1,type:{name:`enum`,value:[{value:`string`}]}}}}}catch{}try{$.displayName=`DialogDefaultCloseButton`,$.__docgenInfo={description:``,displayName:`DialogDefaultCloseButton`,props:{size:{defaultValue:null,description:``,name:`size`,required:!1,type:{name:`enum`,value:[{value:`"small"`},{value:`"medium"`},{value:`"large"`},{value:`ResponsiveProp<ButtonSize>`}]}},variant:{defaultValue:null,description:``,name:`variant`,required:!1,type:{name:`enum`,value:[{value:`"ai"`},{value:`"critical"`},{value:`"inverted"`},{value:`"primary"`},{value:`"secondary"`},{value:`"tertiary"`},{value:`"quaternary"`},{value:`"ghost"`},{value:`"onColor"`},{value:`"classroom"`},{value:`"primaryB2b"`},{value:`"primaryTutor"`},{value:`"newFeature"`}]}},dataset:{defaultValue:null,description:``,name:`dataset`,required:!1,type:{name:`enum`,value:[{value:`Dataset`}]}},id:{defaultValue:null,description:``,name:`id`,required:!1,type:{name:`enum`,value:[{value:`string`}]}},onClick:{defaultValue:null,description:``,name:`onClick`,required:!1,type:{name:`enum`,value:[{value:`MouseEventHandler`}]}},disabled:{defaultValue:null,description:``,name:`disabled`,required:!1,type:{name:`enum`,value:[{value:`false`},{value:`true`}]}},onKeyDown:{defaultValue:null,description:``,name:`onKeyDown`,required:!1,type:{name:`enum`,value:[{value:`KeyboardEventHandler`}]}},onKeyUp:{defaultValue:null,description:``,name:`onKeyUp`,required:!1,type:{name:`enum`,value:[{value:`KeyboardEventHandler`}]}},url:{defaultValue:null,description:"@deprecated Use `href` instead",name:`url`,required:!1,type:{name:`enum`,value:[{value:`string`}]}},download:{defaultValue:null,description:``,name:`download`,required:!1,type:{name:`enum`,value:[{value:`false`},{value:`true`}]}},href:{defaultValue:null,description:``,name:`href`,required:!1,type:{name:`enum`,value:[{value:`string`}]}},onMouseDown:{defaultValue:null,description:``,name:`onMouseDown`,required:!1,type:{name:`enum`,value:[{value:`MouseEventHandler`}]}},onMouseEnter:{defaultValue:null,description:``,name:`onMouseEnter`,required:!1,type:{name:`enum`,value:[{value:`MouseEventHandler`}]}},onMouseMove:{defaultValue:null,description:``,name:`onMouseMove`,required:!1,type:{name:`enum`,value:[{value:`MouseEventHandler`}]}},onMouseUp:{defaultValue:null,description:``,name:`onMouseUp`,required:!1,type:{name:`enum`,value:[{value:`MouseEventHandler`}]}},onPointerDown:{defaultValue:null,description:``,name:`onPointerDown`,required:!1,type:{name:`enum`,value:[{value:`MouseEventHandler`}]}},onPointerEnter:{defaultValue:null,description:``,name:`onPointerEnter`,required:!1,type:{name:`enum`,value:[{value:`MouseEventHandler`}]}},opensInNewTab:{defaultValue:null,description:``,name:`opensInNewTab`,required:!1,type:{name:`enum`,value:[{value:`false`},{value:`true`}]}},nofollow:{defaultValue:null,description:``,name:`nofollow`,required:!1,type:{name:`enum`,value:[{value:`false`},{value:`true`}]}},assistiveText:{defaultValue:null,description:``,name:`assistiveText`,required:!1,type:{name:`enum`,value:[{value:`string`}]}},as:{defaultValue:null,description:`Custom element to render the button.

Allows rendering the button using a different React element or component.
This is particularly useful for integrating with router libraries like \`react-router\` or \`next/router\`.
@example // Render as a react router link component
import { Link } from 'react-router-dom';

<ButtonBase as={<Link to="/home" />} />`,name:`as`,required:!1,type:{name:`enum`,value:[{value:`ReactElement<any, string | JSXElementConstructor<any>>`}]}},submitsForm:{defaultValue:null,description:``,name:`submitsForm`,required:!1,type:{name:`enum`,value:[{value:`false`},{value:`true`}]}},busy:{defaultValue:null,description:`Replaces the content with a loading indicator.`,name:`busy`,required:!1,type:{name:`enum`,value:[{value:`false`},{value:`true`}]}},selected:{defaultValue:null,description:`Used only for classroom and ghost variants`,name:`selected`,required:!1,type:{name:`enum`,value:[{value:`false`},{value:`true`}]}},a11yLabel:{defaultValue:null,description:"@deprecated Use `assistiveText` instead",name:`a11yLabel`,required:!1,type:{name:`enum`,value:[{value:`string`}]}},dsInternalSimulation:{defaultValue:null,description:`@deprecated This is meant for internal DS usage only. Do not use it in your code.
@ignore`,name:`dsInternalSimulation`,required:!1,type:{name:`enum`,value:[{value:`"hover"`},{value:`"focus"`},{value:`"active"`}]}}}}}catch{}}));export{K as a,oe as c,ce as i,z as l,le as n,se as o,Y as r,U as s,Q as t,B as u};