"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/tslib/tslib.es6.js"),t=require("react");require("../../node_modules/react-redux/es/index.js");var i=require("../../node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js"),o=require("../../node_modules/@nethesis/nethesis-solid-svg-icons/index.mjs.js");require("../../node_modules/@babel/runtime/helpers/defineProperty.js"),require("../../node_modules/@babel/runtime/helpers/objectWithoutProperties.js"),require("../../node_modules/@babel/runtime/helpers/typeof.js"),require("../../node_modules/html-parse-stringify/dist/html-parse-stringify.js"),require("../../node_modules/react-i18next/dist/es/context.js");var r=require("../../node_modules/react-i18next/dist/es/useTranslation.js");require("../../node_modules/@babel/runtime/helpers/slicedToArray.js");var n=require("../../lib/phone/call.js"),l=require("../CustomThemedTooltip.js"),s=require("./hooks/useSideViewLogic.js"),a=require("./components/SideViewButton.js"),d=require("../../node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs.js"),u=require("../../node_modules/framer-motion/dist/es/render/components/motion/proxy.mjs.js"),c=require("../../node_modules/react-redux/es/hooks/useSelector.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=p(t),f={initial:{x:-76},animate:{x:4,transition:{duration:.1,ease:"easeOut"}},exit:{x:-76,transition:{duration:.1,ease:"easeIn"}}},h={borderTopRightRadius:"20px",borderBottomRightRadius:"20px",width:"80px",transformOrigin:"right"},T=t.memo((function(p){var T=p.isVisible,b=p.uaType,v=c.useSelector((function(e){return e.island})).isOpen,x=c.useSelector((function(e){return e.currentCall})).isRecording,C=r.useTranslation().t,g=s.useSideViewLogic(b),j=g.videoInputDevices,y=g.isVideoCallButtonVisible,k=g.canRecord,S=g.canShareScreen,_=g.canSwitchDevice,q=g.isUrlButtonEnabled,w=g.hasValidUrl,E=g.isTranscriptionEnabled,V=g.goToVideoCall,R=g.goToScreenSharing,I=g.closeSideViewAndLaunchEvent,D=g.openTranscriptionView,O=t.useCallback((function(){n.recordCurrentCall(x)}),[x]),A=t.useMemo((function(){return[k&&{key:"record",active:x,onClick:O,tooltipId:"tooltip-record",tooltipContent:x?C("Tooltip.Stop recording")||"":C("Tooltip.Record")||"",icon:x?i.faStop:o.faRecord},(null==j?void 0:j.length)>0&&{key:"video",onClick:V,tooltipId:"tooltip-video",tooltipContent:y?C("Tooltip.Enable camera")||"":C("Tooltip.Enable camera permission")||"",disabled:!y,icon:y?i.faVideo:i.faVideoSlash},S&&{key:"screen-share",onClick:R,tooltipId:"tooltip-screen-share",tooltipContent:C("Tooltip.Share screen")||"",icon:i.faDisplay},w&&q&&{key:"url",onClick:function(){return I("openUrl")},tooltipId:"tooltip-open-url",tooltipContent:C("Tooltip.Open url")||"",icon:i.faArrowUpRightFromSquare},E&&{key:"transcription",onClick:D,tooltipId:"tooltip-transcription",tooltipContent:C("Tooltip.Open transcription")||"Open transcription",icon:i.faCommentDots},_&&{key:"switch-device",onClick:function(){return I("switchDevice")},tooltipId:"tooltip-switch-device",tooltipContent:C("Tooltip.Switch device")||"",icon:o.faArrowsRepeat}].filter((function(e){return Boolean(e)}))}),[k,x,O,C,null==j?void 0:j.length,V,y,S,R,w,q,I,D,E,_]),B=t.useMemo((function(){return"pi-absolute pi-h-full pi-bg-surfaceSidebar dark:pi-bg-surfaceSidebarDark pi-flex pi-flex-col pi-items-center pi-text-iconWhite dark:pi-text-iconWhiteDark -pi-mr-10 pi-right-0 -pi-z-10 pi-pointer-events-auto ".concat(v?"pi-py-6":"pi-py-4")}),[v]);return m.default.createElement(m.default.Fragment,null,m.default.createElement(d.AnimatePresence,null,T&&m.default.createElement(u.motion.div,e.__assign({className:B,style:h},f),m.default.createElement("div",{className:"pi-flex pi-flex-col pi-items-center pi-gap-3.5 pi-flex-1 pi-ml-9"},A.map((function(t){var i=t.key,o=e.__rest(t,["key"]);return m.default.createElement(a.SideViewButton,e.__assign({key:i},o))}))))),m.default.createElement(l.CustomThemedTooltip,{id:"tooltip-record",place:"left"}),m.default.createElement(l.CustomThemedTooltip,{id:"tooltip-video",place:"left"}),m.default.createElement(l.CustomThemedTooltip,{id:"tooltip-screen-share",place:"left"}),m.default.createElement(l.CustomThemedTooltip,{id:"tooltip-transcription",place:"left"}),m.default.createElement(l.CustomThemedTooltip,{id:"tooltip-switch-device",place:"left"}),m.default.createElement(l.CustomThemedTooltip,{id:"tooltip-open-url",place:"left"}))}));T.displayName="SideView",exports.default=T;
//# sourceMappingURL=SideView.js.map
