import{slicedToArray as e,defineProperty as t}from"../../../_virtual/_rollupPluginBabelHelpers.js";import o,{forwardRef as i,useRef as r,useState as s,useEffect as n,useMemo as a,Fragment as l}from"react";import m from"classnames";import{DialogAnimationTypeEnum as d,DialogTriggerEventEnum as p}from"@vibe/dialog/mockedClassNames";import c from"../../hooks/useMergeRef.js";import u from"../Tooltip/Tooltip.js";import v from"../IconButton/IconButton.js";import{CloseSmall as f}from"@vibe/icons";import h from"./TipseenTitle.js";import{TipseenCloseButtonTheme as T,TipseenColor as y,TIPSEEN_CLOSE_BUTTON_ARIA_LABEL as g}from"./TipseenConstants.js";import{withStaticProps as C}from"../../types/withStaticProps.js";import"../../utils/colors-vars-map.js";import{ComponentDefaultTestId as j}from"../../tests/constants.js";import{getTestId as N}from"../../tests/testIds.js";import w from"../Text/Text.js";import E from"./Tipseen.module.scss.js";import{TooltipPositions as x}from"../Tooltip/TooltipConstants.js";var W=o.createContext("primary"),b=C(i((function(i,d){var p=i.className,T=i.id,y=i.position,C=void 0===y?"bottom":y,x=i.animationType,b=void 0===x?"expand":x,k=i.hideDelay,B=void 0===k?0:k,A=i.showDelay,S=void 0===A?100:A,D=i.title,P=i.titleClassName,I=i.hideCloseButton,H=i.closeButtonTheme,R=void 0===H?"light":H,O=i.onClose,L=i.closeAriaLabel,M=i.children,_=void 0===M?null:M,z=i.content,q=i.containerSelector,F=i.hideTrigger,G=void 0===F?[]:F,J=i.showTrigger,K=void 0===J?[]:J,Q=i.width,U=i.moveBy,V=i.hideWhenReferenceHidden,X=void 0!==V&&V,Y=i.referenceWrapperClassName,Z=i.tip,$=void 0===Z||Z,ee=i.tooltipArrowClassName,te=i.modifiers,oe=void 0===te?[]:te,ie=i.floating,re=void 0!==ie&&ie,se=i.color,ne=i["data-testid"],ae=null!=se?se:"inverted",le=Array.isArray(K)&&Array.isArray(G)&&0===K.length&&S>0,me=r(null),de=c(d,me),pe=s(!le),ce=e(pe,2),ue=ce[0],ve=ce[1],fe=L||g;n((function(){var e;return S&&(e=setTimeout((function(){ve(!0)}),S)),function(){clearTimeout(e)}}),[S,ve]);var he=a((function(){return"inverted"===ae?"onInverted":"onPrimary"}),[ae]),Te=a((function(){return"light"===R?"inverted"===ae?"on-inverted-background":"on-primary-color":R}),[ae,R]),ye=d||T?"div":l,ge="div"===ye?{ref:de,id:T,"data-testid":ne||N(j.TIPSEEN,T)}:{},Ce=o.createElement("div",null,o.createElement("div",{className:m(E.tipseenHeader)},I?null:o.createElement(v,{hideTooltip:!0,className:m(E.tipseenCloseButton,t({},E.dark,"dark"===R||"fixed-dark"===R)),onClick:O,size:"xs",kind:"tertiary",color:Te,ariaLabel:fe,icon:f}),o.createElement(h,{text:D,className:m(E.tipseenTitle,P)})),o.createElement(w,{color:he,type:"text2",element:"div",ellipsis:!1,className:m(E.tipseenContent)},o.createElement(W.Provider,{value:ae},z)));return o.createElement(ye,Object.assign({},ge),o.createElement(u,{className:m(E.tipseenWrapper,p,t(t({},E.tipseenWrapperWithoutCustomWidth,!Q),E.floating,re)),maxWidth:Q,arrowClassName:ee,style:Q?{width:Q}:void 0,shouldShowOnMount:!le,position:C,animationType:b,hideDelay:B,showDelay:0,hideTrigger:G,showTrigger:K,showOnDialogEnter:!1,content:Ce,theme:"inverted"===ae?"dark":"primary",containerSelector:q,disableDialogSlide:!1,moveBy:U,hideWhenReferenceHidden:X,referenceWrapperClassName:Y,tip:$&&!re,modifiers:oe,open:le?ue:void 0,forceRenderWithoutChildren:re},_))})),{closeButtonThemes:T,animationTypes:d,hideShowTriggers:p,colors:y,positions:x});export{W as TipseenContext,b as default};
//# sourceMappingURL=Tipseen.js.map
