From 98bb4aa9499b71f6f7a41eb18e0f69a110331fbc Mon Sep 17 00:00:00 2001 From: nzambello Date: Wed, 6 Dec 2023 09:53:42 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20=20@=20e56fb?= =?UTF-8?q?d33e8614f9f74d2d8f2462af454213e40f4=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3562.2616aecc.iframe.bundle.js | 1 - 3562.6924ef58.iframe.bundle.js | 1 + ...ts-AvatarView-AvatarView-stories.f958dc03.iframe.bundle.js | 4 ++-- ...w-AvatarView-stories.f958dc03.iframe.bundle.js.LICENSE.txt | 0 iframe.html | 2 +- project.json | 2 +- ...iframe.bundle.js => runtime~main.f9e23bec.iframe.bundle.js | 2 +- 7 files changed, 6 insertions(+), 6 deletions(-) delete mode 100644 3562.2616aecc.iframe.bundle.js create mode 100644 3562.6924ef58.iframe.bundle.js rename components-AvatarView-AvatarView-stories.bc0ba0cc.iframe.bundle.js => components-AvatarView-AvatarView-stories.f958dc03.iframe.bundle.js (55%) rename components-AvatarView-AvatarView-stories.bc0ba0cc.iframe.bundle.js.LICENSE.txt => components-AvatarView-AvatarView-stories.f958dc03.iframe.bundle.js.LICENSE.txt (100%) rename runtime~main.7f408fcd.iframe.bundle.js => runtime~main.f9e23bec.iframe.bundle.js (99%) diff --git a/3562.2616aecc.iframe.bundle.js b/3562.2616aecc.iframe.bundle.js deleted file mode 100644 index 24388522..00000000 --- a/3562.2616aecc.iframe.bundle.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[3562],{"./src/components/Avatar/Avatar.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>Avatar_Avatar});var react=__webpack_require__("./node_modules/react/index.js"),Button=__webpack_require__("./src/components/ui/Button.tsx"),withTranslation=__webpack_require__("./node_modules/react-i18next/dist/es/withTranslation.js"),jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");class ErrorBoundary extends react.Component{state={hasError:!1};static getDerivedStateFromError(_){return{hasError:!0}}componentDidCatch(error,errorInfo){console.error("Uncaught error:",error,errorInfo)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,jsx_runtime.jsxs)("div",{style:{background:"rgba(255, 255, 255, 0.4)",color:"#000",padding:"2rem",borderRadius:"10px"},children:[(0,jsx_runtime.jsx)("h2",{children:this.props.t("error.generic")}),(0,jsx_runtime.jsx)(Button.Z,{primary:!0,onClick:()=>this.setState({hasError:!1}),children:this.props.t("error.tryAgain")||"Try again"})]}):this.props.children}}ErrorBoundary.displayName="ErrorBoundary";const ErrorBoundary_ErrorBoundary=(0,withTranslation.Z)(["common"])(ErrorBoundary);var Tooltip=__webpack_require__("./src/components/ui/Tooltip.tsx"),AvatarView=__webpack_require__("./src/components/AvatarView/index.tsx"),media=__webpack_require__("./src/helpers/media.ts"),Blob=__webpack_require__("./src/components/Blob/Blob.tsx"),ModelViewer=__webpack_require__("./src/components/CustomGLBModelViewer/ModelViewer.tsx"),useTranslation=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),Eye=__webpack_require__("./src/components/icons/Eye.tsx"),EyeInvisible=__webpack_require__("./src/components/icons/EyeInvisible.tsx"),Edit=__webpack_require__("./src/components/icons/Edit.tsx"),classnames=__webpack_require__("./node_modules/classnames/index.js"),classnames_default=__webpack_require__.n(classnames);const Avatar=({memori,integration,integrationConfig,tenant,instruct=!1,avatar3dVisible=!1,setAvatar3dVisible,hasUserActivatedSpeak=!1,isPlayingAudio=!1,loading=!1,baseUrl,apiUrl})=>{const{t}=(0,useTranslation.$)(),[isClient,setIsClient]=(0,react.useState)(!1);(0,react.useEffect)((()=>{setIsClient(!0)}),[]);const animation=(0,react.useMemo)((()=>isPlayingAudio?["Talk 1","Talk 2","Talk 3"][Math.round(2*Math.random())]:loading?"Loading":["Idle","Idle 1","Idle 2","Idle 3"][Math.round(3*Math.random())]),[isPlayingAudio,loading]);return(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:["readyplayerme"!==integrationConfig?.avatar&&"readyplayerme-full"!==integrationConfig?.avatar&&"customglb"!==integrationConfig?.avatar||!integrationConfig?.avatarURL?(0,jsx_runtime.jsx)("div",{className:"memori--blob-container",children:isClient&&(0,jsx_runtime.jsx)(Blob.Z,{avatar:"userAvatar"===integrationConfig?.avatar&&memori.avatarURL&&memori.avatarURL.length>0?(0,media.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl,apiURL:apiUrl}):void 0})}):(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(0,jsx_runtime.jsxs)("div",{className:classnames_default()("memori--avatar-wrapper",`memori--avatar-${integrationConfig?.avatar||"default"}`,{hidden:!avatar3dVisible}),children:[isClient&&("readyplayerme"===integrationConfig.avatar||"readyplayerme-full"===integrationConfig.avatar)&&(0,jsx_runtime.jsx)(ErrorBoundary_ErrorBoundary,{fallback:(0,jsx_runtime.jsx)("div",{className:"memori--blob-container",children:isClient&&(0,jsx_runtime.jsx)(Blob.Z,{speaking:isPlayingAudio,avatar:"userAvatar"===integrationConfig?.avatar&&memori.avatarURL&&memori.avatarURL.length>0?(0,media.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl,apiURL:apiUrl}):void 0})}),children:(0,jsx_runtime.jsx)(AvatarView.Z,{url:integrationConfig.avatarURL,sex:"FEMALE"===memori.voiceType?"FEMALE":"MALE",fallbackImg:(0,media.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl,apiURL:apiUrl}),headMovement:!0,eyeBlink:!0,halfBody:"readyplayerme"===integrationConfig.avatar,animation,speaking:isPlayingAudio,style:"readyplayerme"===integrationConfig.avatar?{width:"300px",height:"300px",backgroundColor:"none",borderRadius:"100%",boxShadow:"none"}:{width:"600px",height:"600px",backgroundColor:"none"}})}),isClient&&"customglb"===integrationConfig.avatar&&(0,jsx_runtime.jsx)(ModelViewer.Z,{poster:(0,media.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl,apiURL:apiUrl}),src:integrationConfig.avatarURL,alt:""})]}),(0,jsx_runtime.jsx)("div",{className:"memori--avatar-toggle",children:(0,jsx_runtime.jsx)(Button.Z,{ghost:!0,onClick:()=>setAvatar3dVisible(!avatar3dVisible),icon:avatar3dVisible?(0,jsx_runtime.jsx)(EyeInvisible.default,{}):(0,jsx_runtime.jsx)(Eye.default,{}),children:(0,jsx_runtime.jsx)("span",{className:"memori--avatar-toggle-text",children:t(avatar3dVisible?"hide":"show")})})})]}),instruct&&!hasUserActivatedSpeak&&memori.isGiver&&tenant?.id&&(0,jsx_runtime.jsx)("div",{className:"memori--avatar-link-to-integrations",children:(0,jsx_runtime.jsx)("a",{className:"memori-button memori-button--circle memori-button--outlined",href:`https://${tenant.id}/${"it-IT"===memori.culture?"it":"en"}/${memori.ownerUserName}/${memori.name}/integrations${integration?.integrationID?`?integration=${integration.integrationID}&openAvatarModal=true`:""}`,children:(0,jsx_runtime.jsx)(Tooltip.Z,{content:t("widgetgoToIntegrationsToCustomizeAvatar"),children:(0,jsx_runtime.jsx)("span",{className:"memori-button--icon",children:(0,jsx_runtime.jsx)(Edit.default,{})})})})})]})},Avatar_Avatar=(0,react.memo)(Avatar,((prevProps,nextProps)=>JSON.stringify(prevProps)===JSON.stringify(nextProps)));try{Avatar.displayName="Avatar",Avatar.__docgenInfo={description:"",displayName:"Avatar",props:{memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},integration:{defaultValue:null,description:"",name:"integration",required:!1,type:{name:"Integration"}},integrationConfig:{defaultValue:null,description:"",name:"integrationConfig",required:!1,type:{name:"{ [key: string]: any; }"}},tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},instruct:{defaultValue:{value:"false"},description:"",name:"instruct",required:!1,type:{name:"boolean"}},hasUserActivatedSpeak:{defaultValue:{value:"false"},description:"",name:"hasUserActivatedSpeak",required:!1,type:{name:"boolean"}},avatar3dVisible:{defaultValue:{value:"false"},description:"",name:"avatar3dVisible",required:!1,type:{name:"boolean"}},setAvatar3dVisible:{defaultValue:null,description:"",name:"setAvatar3dVisible",required:!0,type:{name:"(visible: boolean) => void"}},isPlayingAudio:{defaultValue:{value:"false"},description:"",name:"isPlayingAudio",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},baseUrl:{defaultValue:null,description:"",name:"baseUrl",required:!1,type:{name:"string"}},apiUrl:{defaultValue:null,description:"",name:"apiUrl",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/Avatar/Avatar.tsx#Avatar"]={docgenInfo:Avatar.__docgenInfo,name:"Avatar",path:"src/components/Avatar/Avatar.tsx#Avatar"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/AvatarView/index.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>AvatarView});var react=__webpack_require__("./node_modules/react/index.js"),three_module=__webpack_require__("./node_modules/three/build/three.module.js"),useGLTF=__webpack_require__("./node_modules/@react-three/drei/core/useGLTF.js"),react_three_fiber_esm=__webpack_require__("./node_modules/@react-three/fiber/dist/react-three-fiber.esm.js");let timeout,headMesh,blinkTime=999,morphIndex=0;const setNextBlink=()=>{blinkTime=0,timeout=setTimeout(setNextBlink,5e3*Math.random()+2e3)};function useEyeBlink(enabled,nodes){(0,react.useEffect)((()=>{if(enabled)return headMesh=nodes.Wolf3D_Head||nodes.Wolf3D_Avatar,headMesh?.morphTargetDictionary&&headMesh?.morphTargetInfluences&&(morphIndex=headMesh.morphTargetDictionary.eyesClosed),timeout=setTimeout(setNextBlink,3e3),()=>{clearTimeout(timeout)}}),[nodes,enabled]),(0,react_three_fiber_esm.xQ)(((_,delta)=>{if(enabled)if(blinkTime<2&&headMesh?.morphTargetInfluences){let value=Math.abs(Math.sin(blinkTime*Math.PI/2));blinkTime+=10*delta,headMesh.morphTargetInfluences[morphIndex]=value}else headMesh?.morphTargetInfluences&&(headMesh.morphTargetInfluences[morphIndex]=0)}))}const lerp=(start,end,time=.05)=>start*(1-time)+end*time,mapRange=(value,inMin,inMax,outMin,outMax)=>((value=((value,min,max)=>Math.min(Math.max(value,min),max))(value,inMin,inMax))-inMin)*(outMax-outMin)/(inMax-inMin)+outMin,hideHands=nodes=>{nodes.Wolf3D_Hands&&(nodes.Wolf3D_Hands.visible=!1),nodes.RightHand&&nodes.LeftHand&&(nodes.RightHand.position.set(0,-2,0),nodes.LeftHand.position.set(0,-2,0))},correctMaterials=materials=>{Object.values(materials).forEach((material=>{material.map&&(material.map.minFilter=three_module.LinearFilter),material&&(material.depthWrite=!0)}))},isSkinnedMesh=node=>"SkinnedMesh"===node.type,rad=Math.PI/180;let useHeadMovement_timeout,useHeadMovement_reset=!1;const targetPos=new three_module.Vector2(0,0),currentPos=new three_module.Vector2(0,0),setResetTrue=()=>{useHeadMovement_timeout=setTimeout((()=>{useHeadMovement_reset=!0}),1e3)},setResetFalse=()=>{clearTimeout(useHeadMovement_timeout),useHeadMovement_reset=!1};let useMouthSpeaking_timeout,mouthMesh,mouthMoveTime=999,mouthOpenMorphIndex=0,mouthSmileMorphIndex=0,mouthFunnerMorphIndex=0,mouthPuckerMorphIndex=0;const setNextMouthOpen=()=>{mouthMoveTime=0,useMouthSpeaking_timeout=setTimeout(setNextMouthOpen,500*Math.random())};function useMouthSpeaking(speaking,nodes){(0,react.useEffect)((()=>{if(speaking)return mouthMesh=nodes.Wolf3D_Head||nodes.Wolf3D_Avatar||nodes.Wolf3D_Avatar001,mouthMesh?.morphTargetDictionary&&mouthMesh?.morphTargetInfluences&&(mouthOpenMorphIndex=mouthMesh.morphTargetDictionary.mouthOpen,mouthSmileMorphIndex=mouthMesh.morphTargetDictionary.mouthSmile,mouthFunnerMorphIndex=mouthMesh.morphTargetDictionary.mouthFunner,mouthPuckerMorphIndex=mouthMesh.morphTargetDictionary.mouthPucker),useMouthSpeaking_timeout=setTimeout(setNextMouthOpen,200),()=>{clearTimeout(useMouthSpeaking_timeout)}}),[nodes,speaking]),(0,react_three_fiber_esm.xQ)(((_,delta)=>{if(speaking)if(mouthMoveTime<2&&mouthMesh?.morphTargetInfluences){let value=Math.abs(Math.sin(mouthMoveTime*Math.PI/2));mouthMoveTime+=10*delta,mouthMesh.morphTargetInfluences[mouthOpenMorphIndex]=value/3,mouthMesh.morphTargetInfluences[mouthSmileMorphIndex]=value/10,mouthMesh.morphTargetInfluences[mouthFunnerMorphIndex]=value/7,mouthMesh.morphTargetInfluences[mouthPuckerMorphIndex]=value/5}else mouthMesh?.morphTargetInfluences&&(mouthMesh.morphTargetInfluences[mouthOpenMorphIndex]=0,mouthMesh.morphTargetInfluences[mouthSmileMorphIndex]=0,mouthMesh.morphTargetInfluences[mouthFunnerMorphIndex]=0,mouthMesh.morphTargetInfluences[mouthPuckerMorphIndex]=0);else mouthMesh?.morphTargetInfluences&&(mouthMesh.morphTargetInfluences[mouthOpenMorphIndex]=0,mouthMesh.morphTargetInfluences[mouthSmileMorphIndex]=0,mouthMesh.morphTargetInfluences[mouthFunnerMorphIndex]=0,mouthMesh.morphTargetInfluences[mouthPuckerMorphIndex]=0)}))}var jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const position=new three_module.Vector3(0,-.6,0);function Avatar({url,eyeBlink,headMovement,speaking,onLoaded}){const{scene}=(0,useGLTF.L)(url),{nodes,materials}=(0,react_three_fiber_esm.n4)(scene);return useEyeBlink(eyeBlink,nodes),function useHeadMovement(enabled,nodes){const{gl}=(0,react_three_fiber_esm.Ky)();(0,react.useEffect)((()=>{if(enabled)return gl.domElement.addEventListener("mouseleave",setResetTrue),gl.domElement.addEventListener("mouseenter",setResetFalse),()=>{gl.domElement.removeEventListener("mouseleave",setResetTrue),gl.domElement.removeEventListener("mouseenter",setResetFalse)}}),[gl.domElement,enabled]),(0,react_three_fiber_esm.xQ)((state=>{if(!enabled||!nodes?.Neck||!nodes?.Head)return;const cameraRotation=Math.abs(state.camera.rotation.z);!useHeadMovement_reset&&cameraRotation<.2?(targetPos.x=mapRange(state.mouse.y,-1,1,5*rad,-5*rad),targetPos.y=mapRange(state.mouse.x,-1,1,-10*rad,10*rad)):targetPos.set(0,0),currentPos.x=lerp(currentPos.x,targetPos.x),currentPos.y=lerp(currentPos.y,targetPos.y),nodes.Neck.rotation.x=currentPos.x+.1,nodes.Neck.rotation.y=currentPos.y,nodes.Head.rotation.x=2*currentPos.x,nodes.Head.rotation.y=2*currentPos.y}))}(headMovement,nodes),useMouthSpeaking(!!speaking,nodes),(0,react.useEffect)((()=>(hideHands(nodes),correctMaterials(materials),onLoaded&&onLoaded(),()=>{Object.values(materials).forEach(react_three_fiber_esm.B9),Object.values(nodes).filter(isSkinnedMesh).forEach(react_three_fiber_esm.B9)})),[materials,nodes,url,onLoaded]),(0,jsx_runtime.jsxs)("group",{position,children:[(0,jsx_runtime.jsx)("primitive",{object:nodes.Hips},"armature"),Object.values(nodes).filter(isSkinnedMesh).map((node=>(0,jsx_runtime.jsx)("primitive",{object:node,receiveShadow:!0,castShadow:!0},node.name)))]})}Avatar.displayName="Avatar";try{avatar.displayName="avatar",avatar.__docgenInfo={description:"",displayName:"avatar",props:{url:{defaultValue:null,description:"",name:"url",required:!0,type:{name:"string"}},eyeBlink:{defaultValue:null,description:"",name:"eyeBlink",required:!1,type:{name:"boolean"}},headMovement:{defaultValue:null,description:"",name:"headMovement",required:!1,type:{name:"boolean"}},speaking:{defaultValue:null,description:"",name:"speaking",required:!1,type:{name:"boolean"}},onLoaded:{defaultValue:null,description:"",name:"onLoaded",required:!1,type:{name:"(() => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/AvatarView/components/avatar.tsx#avatar"]={docgenInfo:avatar.__docgenInfo,name:"avatar",path:"src/components/AvatarView/components/avatar.tsx#avatar"})}catch(__react_docgen_typescript_loader_error){}var useAnimations=__webpack_require__("./node_modules/@react-three/drei/core/useAnimations.js");let useLoadingMorphAnim_headMesh,useSmile_headMesh,eyesClosedMorphIndex=0,viseme_UMorphIndex=0;let useSmile_mouthSmileMorphIndex=0;const fullbodyAvatar_position=new three_module.Vector3(0,-1,0),rotation=new three_module.Euler(.175,0,0);function fullbodyAvatar_Avatar({url,sex,eyeBlink,speaking,onLoaded,animation}){const{scene}=(0,useGLTF.L)(url),{animations}=(0,useGLTF.L)("MALE"===sex?"https://assets.memori.ai/api/v2/asset/5de7456f-0cd8-4e29-95a7-0cd0045a5325.glb":"https://assets.memori.ai/api/v2/asset/84487a2b-377c-4565-800a-51459d580ec8.glb"),{animations:loadingAnimations}=(0,useGLTF.L)("https://assets.memori.ai/api/v2/asset/ebb61fe1-6b0d-4b11-a032-292b7ef307a4.glb"),{nodes,materials}=(0,react_three_fiber_esm.n4)(scene),anim=(0,useAnimations.v)(animations,scene);(0,useAnimations.v)(loadingAnimations.filter((a=>"Loading"===a.name)),scene);useEyeBlink(eyeBlink,nodes),useMouthSpeaking(!!speaking,nodes),function useLoadingMorphAnim(loading,nodes){(0,react.useEffect)((()=>{loading&&(useLoadingMorphAnim_headMesh=nodes.Wolf3D_Head||nodes.Wolf3D_Avatar||nodes.Wolf3D_Avatar001,useLoadingMorphAnim_headMesh?.morphTargetDictionary&&useLoadingMorphAnim_headMesh?.morphTargetInfluences&&(eyesClosedMorphIndex=useLoadingMorphAnim_headMesh.morphTargetDictionary.mouthOpen,viseme_UMorphIndex=useLoadingMorphAnim_headMesh.morphTargetDictionary.viseme_U))}),[nodes,loading]),(0,react_three_fiber_esm.xQ)((()=>{loading?useLoadingMorphAnim_headMesh?.morphTargetInfluences&&(useLoadingMorphAnim_headMesh.morphTargetInfluences[eyesClosedMorphIndex]=.56,useLoadingMorphAnim_headMesh.morphTargetInfluences[viseme_UMorphIndex]=.67):useLoadingMorphAnim_headMesh?.morphTargetInfluences&&(useLoadingMorphAnim_headMesh.morphTargetInfluences[eyesClosedMorphIndex]=0,useLoadingMorphAnim_headMesh.morphTargetInfluences[viseme_UMorphIndex]=0)}))}("Loading"===animation,nodes),function useSmile(smiling,nodes){(0,react.useEffect)((()=>{smiling&&(useSmile_headMesh=nodes.Wolf3D_Head||nodes.Wolf3D_Avatar||nodes.Wolf3D_Avatar001,useSmile_headMesh?.morphTargetDictionary&&useSmile_headMesh?.morphTargetInfluences&&(useSmile_mouthSmileMorphIndex=useSmile_headMesh.morphTargetDictionary.mouthSmile))}),[nodes,smiling]),(0,react_three_fiber_esm.xQ)((()=>{smiling?useSmile_headMesh?.morphTargetInfluences&&(useSmile_headMesh.morphTargetInfluences[useSmile_mouthSmileMorphIndex]=1/3):useSmile_headMesh?.morphTargetInfluences&&(useSmile_headMesh.morphTargetInfluences[useSmile_mouthSmileMorphIndex]=0)}))}(animation?.startsWith("Idle"),nodes),(0,react.useEffect)((()=>(correctMaterials(materials),onLoaded&&onLoaded(),()=>{Object.values(materials).forEach(react_three_fiber_esm.B9),Object.values(nodes).filter(isSkinnedMesh).forEach(react_three_fiber_esm.B9)})),[materials,nodes,url,onLoaded]);try{animation&&animation in anim.actions?Object.keys(anim.actions).forEach((name=>{let action=anim.actions[name];action&&(name===animation&&"Loading"!==animation?action.fadeIn(.3).play():action.fadeOut(.3).stop())})):Object.values(anim.actions).forEach((action=>{action&&action?.fadeOut(.2).reset().stop()}))}catch(e){console.log(e)}return(0,jsx_runtime.jsx)("group",{position:fullbodyAvatar_position,rotation,children:(0,jsx_runtime.jsx)("primitive",{object:scene})})}fullbodyAvatar_Avatar.displayName="Avatar";try{fullbodyAvatar.displayName="fullbodyAvatar",fullbodyAvatar.__docgenInfo={description:"",displayName:"fullbodyAvatar",props:{url:{defaultValue:null,description:"",name:"url",required:!0,type:{name:"string"}},sex:{defaultValue:null,description:"",name:"sex",required:!0,type:{name:"enum",value:[{value:'"MALE"'},{value:'"FEMALE"'}]}},eyeBlink:{defaultValue:null,description:"",name:"eyeBlink",required:!1,type:{name:"boolean"}},headMovement:{defaultValue:null,description:"",name:"headMovement",required:!1,type:{name:"boolean"}},speaking:{defaultValue:null,description:"",name:"speaking",required:!1,type:{name:"boolean"}},onLoaded:{defaultValue:null,description:"",name:"onLoaded",required:!1,type:{name:"(() => void)"}},animation:{defaultValue:null,description:"",name:"animation",required:!1,type:{name:"enum",value:[{value:'"Idle"'},{value:'"Idle 1"'},{value:'"Idle 2"'},{value:'"Idle 3"'},{value:'"Loading"'},{value:'"Sad"'},{value:'"Talk 1"'},{value:'"Talk 2"'},{value:'"Talk 3"'}]}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/AvatarView/components/fullbodyAvatar.tsx#fullbodyAvatar"]={docgenInfo:fullbodyAvatar.__docgenInfo,name:"fullbodyAvatar",path:"src/components/AvatarView/components/fullbodyAvatar.tsx#fullbodyAvatar"})}catch(__react_docgen_typescript_loader_error){}var useProgress=__webpack_require__("./node_modules/@react-three/drei/core/useProgress.js"),Html=__webpack_require__("./node_modules/@react-three/drei/web/Html.js"),Spin=__webpack_require__("./src/components/ui/Spin.tsx");const Loader=({fallbackImg})=>{const{progress}=(0,useProgress.S)();return(0,jsx_runtime.jsx)(Html.V,{center:!0,className:"avatar-loader",children:(0,jsx_runtime.jsx)(Spin.Z,{spinning:!0,children:fallbackImg?(0,jsx_runtime.jsxs)("figure",{children:[(0,jsx_runtime.jsx)("img",{src:fallbackImg,alt:`${Math.round(progress)}% loaded`,title:`${Math.round(progress)}% loaded`}),(0,jsx_runtime.jsx)("figcaption",{children:`${Math.round(progress)}%`})]}):(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[Math.round(progress)," % loaded"]})})})};Loader.displayName="Loader";const components_loader=Loader;try{loader.displayName="loader",loader.__docgenInfo={description:"",displayName:"loader",props:{fallbackImg:{defaultValue:null,description:"",name:"fallbackImg",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/AvatarView/components/loader.tsx#loader"]={docgenInfo:loader.__docgenInfo,name:"loader",path:"src/components/AvatarView/components/loader.tsx#loader"})}catch(__react_docgen_typescript_loader_error){}var SpotLight=__webpack_require__("./node_modules/@react-three/drei/core/SpotLight.js"),Environment=__webpack_require__("./node_modules/@react-three/drei/core/Environment.js"),OrbitControls=__webpack_require__("./node_modules/@react-three/drei/core/OrbitControls.js"),utils=__webpack_require__("./src/helpers/utils.ts");const defaultStylesHalfBody={width:"250px",height:"250px",backgroundColor:"white",borderRadius:"100%"},defaultStylesFullBody={width:"500px",height:"500px",backgroundColor:"white"};function AvatarView({url,sex,fallbackImg,style,rotateAvatar,eyeBlink,headMovement,speaking,fallback,halfBody=!0,animation}){const defaultStyles=halfBody?defaultStylesHalfBody:defaultStylesFullBody;return(0,jsx_runtime.jsx)(react_three_fiber_esm.Xz,{style:style||defaultStyles,camera:halfBody?{fov:40,position:[0,0,.6]}:{fov:40,position:[0,175e-7,3]},children:(0,jsx_runtime.jsxs)(react.Suspense,{fallback:fallback||(0,jsx_runtime.jsx)(components_loader,{fallbackImg}),children:[(0,utils.Dt)()||(0,utils.Tt)()?(0,jsx_runtime.jsx)(SpotLight.P,{distance:100,position:[-.3,.2,1.25],angle:Math.PI/2,attenuation:5,anglePower:5}):(0,jsx_runtime.jsx)(Environment.qA,{files:"https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/venice_sunset_1k.hdr"}),rotateAvatar&&halfBody&&(0,jsx_runtime.jsx)(OrbitControls.z,{enablePan:!1,enableZoom:!1}),halfBody?(0,jsx_runtime.jsx)(Avatar,{url,eyeBlink,headMovement,speaking}):(0,jsx_runtime.jsx)(fullbodyAvatar_Avatar,{url,sex,eyeBlink,headMovement,speaking,animation})]})})}AvatarView.displayName="AvatarView";try{AvatarView.displayName="AvatarView",AvatarView.__docgenInfo={description:"",displayName:"AvatarView",props:{url:{defaultValue:null,description:"",name:"url",required:!0,type:{name:"string"}},sex:{defaultValue:null,description:"",name:"sex",required:!0,type:{name:"enum",value:[{value:'"MALE"'},{value:'"FEMALE"'}]}},fallbackImg:{defaultValue:null,description:"",name:"fallbackImg",required:!1,type:{name:"string"}},eyeBlink:{defaultValue:null,description:"",name:"eyeBlink",required:!1,type:{name:"boolean"}},headMovement:{defaultValue:null,description:"",name:"headMovement",required:!1,type:{name:"boolean"}},rotateAvatar:{defaultValue:null,description:"",name:"rotateAvatar",required:!1,type:{name:"boolean"}},speaking:{defaultValue:null,description:"",name:"speaking",required:!1,type:{name:"boolean"}},style:{defaultValue:null,description:"",name:"style",required:!1,type:{name:"CSSProperties"}},fallback:{defaultValue:null,description:"",name:"fallback",required:!1,type:{name:"ReactNode"}},halfBody:{defaultValue:{value:"true"},description:"",name:"halfBody",required:!1,type:{name:"boolean"}},animation:{defaultValue:null,description:"",name:"animation",required:!1,type:{name:"enum",value:[{value:'"Idle"'},{value:'"Idle 1"'},{value:'"Idle 2"'},{value:'"Idle 3"'},{value:'"Loading"'},{value:'"Sad"'},{value:'"Talk 1"'},{value:'"Talk 2"'},{value:'"Talk 3"'}]}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/AvatarView/index.tsx#AvatarView"]={docgenInfo:AvatarView.__docgenInfo,name:"AvatarView",path:"src/components/AvatarView/index.tsx#AvatarView"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/Blob/Blob.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ExperienceBlob=({avatar,speaking=!1})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-blob",{"memori-blob--speaking":speaking}),children:[avatar&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("figure",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("img",{src:avatar,alt:"",role:"presentation"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"mainDiv"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"mainDiv"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"mainDiv"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"mainDiv"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"mainDiv"})]});ExperienceBlob.displayName="ExperienceBlob";const __WEBPACK_DEFAULT_EXPORT__=ExperienceBlob;try{Blob.displayName="Blob",Blob.__docgenInfo={description:"",displayName:"Blob",props:{avatar:{defaultValue:null,description:"",name:"avatar",required:!1,type:{name:"string"}},speaking:{defaultValue:{value:"false"},description:"",name:"speaking",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/Blob/Blob.tsx#Blob"]={docgenInfo:Blob.__docgenInfo,name:"Blob",path:"src/components/Blob/Blob.tsx#Blob"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Edit.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Edit=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"})});Edit.displayName="Edit";const __WEBPACK_DEFAULT_EXPORT__=Edit;try{Edit.displayName="Edit",Edit.__docgenInfo={description:"",displayName:"Edit",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Edit.tsx#Edit"]={docgenInfo:Edit.__docgenInfo,name:"Edit",path:"src/components/icons/Edit.tsx#Edit"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Eye.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Eye=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"})});Eye.displayName="Eye";const __WEBPACK_DEFAULT_EXPORT__=Eye;try{Eye.displayName="Eye",Eye.__docgenInfo={description:"",displayName:"Eye",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Eye.tsx#Eye"]={docgenInfo:Eye.__docgenInfo,name:"Eye",path:"src/components/icons/Eye.tsx#Eye"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/EyeInvisible.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const EyeInvisible=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z"})]});EyeInvisible.displayName="EyeInvisible";const __WEBPACK_DEFAULT_EXPORT__=EyeInvisible;try{EyeInvisible.displayName="EyeInvisible",EyeInvisible.__docgenInfo={description:"",displayName:"EyeInvisible",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/EyeInvisible.tsx#EyeInvisible"]={docgenInfo:EyeInvisible.__docgenInfo,name:"EyeInvisible",path:"src/components/icons/EyeInvisible.tsx#EyeInvisible"})}catch(__react_docgen_typescript_loader_error){}}}]); \ No newline at end of file diff --git a/3562.6924ef58.iframe.bundle.js b/3562.6924ef58.iframe.bundle.js new file mode 100644 index 00000000..67dd8a1b --- /dev/null +++ b/3562.6924ef58.iframe.bundle.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[3562],{"./src/components/Avatar/Avatar.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>Avatar_Avatar});var react=__webpack_require__("./node_modules/react/index.js"),Button=__webpack_require__("./src/components/ui/Button.tsx"),withTranslation=__webpack_require__("./node_modules/react-i18next/dist/es/withTranslation.js"),jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");class ErrorBoundary extends react.Component{state={hasError:!1};static getDerivedStateFromError(_){return{hasError:!0}}componentDidCatch(error,errorInfo){console.error("Uncaught error:",error,errorInfo)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,jsx_runtime.jsxs)("div",{style:{background:"rgba(255, 255, 255, 0.4)",color:"#000",padding:"2rem",borderRadius:"10px"},children:[(0,jsx_runtime.jsx)("h2",{children:this.props.t("error.generic")}),(0,jsx_runtime.jsx)(Button.Z,{primary:!0,onClick:()=>this.setState({hasError:!1}),children:this.props.t("error.tryAgain")||"Try again"})]}):this.props.children}}ErrorBoundary.displayName="ErrorBoundary";const ErrorBoundary_ErrorBoundary=(0,withTranslation.Z)(["common"])(ErrorBoundary);var Tooltip=__webpack_require__("./src/components/ui/Tooltip.tsx"),AvatarView=__webpack_require__("./src/components/AvatarView/index.tsx"),media=__webpack_require__("./src/helpers/media.ts"),Blob=__webpack_require__("./src/components/Blob/Blob.tsx"),ModelViewer=__webpack_require__("./src/components/CustomGLBModelViewer/ModelViewer.tsx"),useTranslation=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),Eye=__webpack_require__("./src/components/icons/Eye.tsx"),EyeInvisible=__webpack_require__("./src/components/icons/EyeInvisible.tsx"),Edit=__webpack_require__("./src/components/icons/Edit.tsx"),classnames=__webpack_require__("./node_modules/classnames/index.js"),classnames_default=__webpack_require__.n(classnames);const Avatar=({memori,integration,integrationConfig,tenant,instruct=!1,avatar3dVisible=!1,setAvatar3dVisible,hasUserActivatedSpeak=!1,isPlayingAudio=!1,loading=!1,baseUrl,apiUrl})=>{const{t}=(0,useTranslation.$)(),[isClient,setIsClient]=(0,react.useState)(!1);(0,react.useEffect)((()=>{setIsClient(!0)}),[]);const animation=(0,react.useMemo)((()=>isPlayingAudio?["Talk 1","Talk 2","Talk 3"][Math.round(2*Math.random())]:loading?"Loading":["Idle","Idle 1","Idle 2","Idle 3"][Math.round(3*Math.random())]),[isPlayingAudio,loading]);return(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:["readyplayerme"!==integrationConfig?.avatar&&"readyplayerme-full"!==integrationConfig?.avatar&&"customglb"!==integrationConfig?.avatar||!integrationConfig?.avatarURL?(0,jsx_runtime.jsx)("div",{className:"memori--blob-container",children:isClient&&(0,jsx_runtime.jsx)(Blob.Z,{avatar:"userAvatar"===integrationConfig?.avatar&&memori.avatarURL&&memori.avatarURL.length>0?(0,media.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl,apiURL:apiUrl}):void 0})}):(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(0,jsx_runtime.jsxs)("div",{className:classnames_default()("memori--avatar-wrapper",`memori--avatar-${integrationConfig?.avatar||"default"}`,{hidden:!avatar3dVisible}),children:[isClient&&("readyplayerme"===integrationConfig.avatar||"readyplayerme-full"===integrationConfig.avatar)&&(0,jsx_runtime.jsx)(ErrorBoundary_ErrorBoundary,{fallback:(0,jsx_runtime.jsx)("div",{className:"memori--blob-container",children:isClient&&(0,jsx_runtime.jsx)(Blob.Z,{speaking:isPlayingAudio,avatar:"userAvatar"===integrationConfig?.avatar&&memori.avatarURL&&memori.avatarURL.length>0?(0,media.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl,apiURL:apiUrl}):void 0})}),children:(0,jsx_runtime.jsx)(AvatarView.Z,{url:integrationConfig.avatarURL,sex:"FEMALE"===memori.voiceType?"FEMALE":"MALE",fallbackImg:(0,media.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl,apiURL:apiUrl}),headMovement:!0,eyeBlink:!0,halfBody:"readyplayerme"===integrationConfig.avatar,animation,speaking:isPlayingAudio,style:"readyplayerme"===integrationConfig.avatar?{width:"300px",height:"300px",backgroundColor:"none",borderRadius:"100%",boxShadow:"none"}:{width:"600px",height:"600px",backgroundColor:"none"}})}),isClient&&"customglb"===integrationConfig.avatar&&(0,jsx_runtime.jsx)(ModelViewer.Z,{poster:(0,media.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl,apiURL:apiUrl}),src:integrationConfig.avatarURL,alt:""})]}),(0,jsx_runtime.jsx)("div",{className:"memori--avatar-toggle",children:(0,jsx_runtime.jsx)(Button.Z,{ghost:!0,onClick:()=>setAvatar3dVisible(!avatar3dVisible),icon:avatar3dVisible?(0,jsx_runtime.jsx)(EyeInvisible.default,{}):(0,jsx_runtime.jsx)(Eye.default,{}),children:(0,jsx_runtime.jsx)("span",{className:"memori--avatar-toggle-text",children:t(avatar3dVisible?"hide":"show")})})})]}),instruct&&!hasUserActivatedSpeak&&memori.isGiver&&tenant?.id&&(0,jsx_runtime.jsx)("div",{className:"memori--avatar-link-to-integrations",children:(0,jsx_runtime.jsx)("a",{className:"memori-button memori-button--circle memori-button--outlined",href:`https://${tenant.id}/${"it-IT"===memori.culture?"it":"en"}/${memori.ownerUserName}/${memori.name}/integrations${integration?.integrationID?`?integration=${integration.integrationID}&openAvatarModal=true`:""}`,children:(0,jsx_runtime.jsx)(Tooltip.Z,{content:t("widgetgoToIntegrationsToCustomizeAvatar"),children:(0,jsx_runtime.jsx)("span",{className:"memori-button--icon",children:(0,jsx_runtime.jsx)(Edit.default,{})})})})})]})},Avatar_Avatar=(0,react.memo)(Avatar,((prevProps,nextProps)=>JSON.stringify(prevProps)===JSON.stringify(nextProps)));try{Avatar.displayName="Avatar",Avatar.__docgenInfo={description:"",displayName:"Avatar",props:{memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},integration:{defaultValue:null,description:"",name:"integration",required:!1,type:{name:"Integration"}},integrationConfig:{defaultValue:null,description:"",name:"integrationConfig",required:!1,type:{name:"{ [key: string]: any; }"}},tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},instruct:{defaultValue:{value:"false"},description:"",name:"instruct",required:!1,type:{name:"boolean"}},hasUserActivatedSpeak:{defaultValue:{value:"false"},description:"",name:"hasUserActivatedSpeak",required:!1,type:{name:"boolean"}},avatar3dVisible:{defaultValue:{value:"false"},description:"",name:"avatar3dVisible",required:!1,type:{name:"boolean"}},setAvatar3dVisible:{defaultValue:null,description:"",name:"setAvatar3dVisible",required:!0,type:{name:"(visible: boolean) => void"}},isPlayingAudio:{defaultValue:{value:"false"},description:"",name:"isPlayingAudio",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},baseUrl:{defaultValue:null,description:"",name:"baseUrl",required:!1,type:{name:"string"}},apiUrl:{defaultValue:null,description:"",name:"apiUrl",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/Avatar/Avatar.tsx#Avatar"]={docgenInfo:Avatar.__docgenInfo,name:"Avatar",path:"src/components/Avatar/Avatar.tsx#Avatar"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/AvatarView/index.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>AvatarView});var react=__webpack_require__("./node_modules/react/index.js"),three_module=__webpack_require__("./node_modules/three/build/three.module.js"),useGLTF=__webpack_require__("./node_modules/@react-three/drei/core/useGLTF.js"),react_three_fiber_esm=__webpack_require__("./node_modules/@react-three/fiber/dist/react-three-fiber.esm.js");let timeout,headMesh,blinkTime=999,morphIndex=0;const setNextBlink=()=>{blinkTime=0,timeout=setTimeout(setNextBlink,5e3*Math.random()+2e3)};function useEyeBlink(enabled,nodes){(0,react.useEffect)((()=>{if(enabled)return headMesh=nodes.Wolf3D_Head||nodes.Wolf3D_Avatar,headMesh?.morphTargetDictionary&&headMesh?.morphTargetInfluences&&(morphIndex=headMesh.morphTargetDictionary.eyesClosed),timeout=setTimeout(setNextBlink,3e3),()=>{clearTimeout(timeout)}}),[nodes,enabled]),(0,react_three_fiber_esm.xQ)(((_,delta)=>{if(enabled)if(blinkTime<2&&headMesh?.morphTargetInfluences){let value=Math.abs(Math.sin(blinkTime*Math.PI/2));blinkTime+=10*delta,headMesh.morphTargetInfluences[morphIndex]=value}else headMesh?.morphTargetInfluences&&(headMesh.morphTargetInfluences[morphIndex]=0)}))}const lerp=(start,end,time=.05)=>start*(1-time)+end*time,mapRange=(value,inMin,inMax,outMin,outMax)=>((value=((value,min,max)=>Math.min(Math.max(value,min),max))(value,inMin,inMax))-inMin)*(outMax-outMin)/(inMax-inMin)+outMin,hideHands=nodes=>{nodes.Wolf3D_Hands&&(nodes.Wolf3D_Hands.visible=!1),nodes.RightHand&&nodes.LeftHand&&(nodes.RightHand.position.set(0,-2,0),nodes.LeftHand.position.set(0,-2,0))},correctMaterials=materials=>{Object.values(materials).forEach((material=>{material.map&&(material.map.minFilter=three_module.LinearFilter),material&&(material.depthWrite=!0)}))},isSkinnedMesh=node=>"SkinnedMesh"===node.type,rad=Math.PI/180;let useHeadMovement_timeout,useHeadMovement_reset=!1;const targetPos=new three_module.Vector2(0,0),currentPos=new three_module.Vector2(0,0),setResetTrue=()=>{useHeadMovement_timeout=setTimeout((()=>{useHeadMovement_reset=!0}),1e3)},setResetFalse=()=>{clearTimeout(useHeadMovement_timeout),useHeadMovement_reset=!1};let useMouthSpeaking_timeout,mouthMesh,mouthMoveTime=999,mouthOpenMorphIndex=0,mouthSmileMorphIndex=0,mouthFunnerMorphIndex=0,mouthPuckerMorphIndex=0;const setNextMouthOpen=()=>{mouthMoveTime=0,useMouthSpeaking_timeout=setTimeout(setNextMouthOpen,500*Math.random())};function useMouthSpeaking(speaking,nodes){(0,react.useEffect)((()=>{if(speaking)return mouthMesh=nodes.Wolf3D_Head||nodes.Wolf3D_Avatar||nodes.Wolf3D_Avatar001,mouthMesh?.morphTargetDictionary&&mouthMesh?.morphTargetInfluences&&(mouthOpenMorphIndex=mouthMesh.morphTargetDictionary.mouthOpen,mouthSmileMorphIndex=mouthMesh.morphTargetDictionary.mouthSmile,mouthFunnerMorphIndex=mouthMesh.morphTargetDictionary.mouthFunner,mouthPuckerMorphIndex=mouthMesh.morphTargetDictionary.mouthPucker),useMouthSpeaking_timeout=setTimeout(setNextMouthOpen,200),()=>{clearTimeout(useMouthSpeaking_timeout)}}),[nodes,speaking]),(0,react_three_fiber_esm.xQ)(((_,delta)=>{if(speaking)if(mouthMoveTime<2&&mouthMesh?.morphTargetInfluences){let value=Math.abs(Math.sin(mouthMoveTime*Math.PI/2));mouthMoveTime+=10*delta,mouthMesh.morphTargetInfluences[mouthOpenMorphIndex]=value/3,mouthMesh.morphTargetInfluences[mouthSmileMorphIndex]=value/10,mouthMesh.morphTargetInfluences[mouthFunnerMorphIndex]=value/7,mouthMesh.morphTargetInfluences[mouthPuckerMorphIndex]=value/5}else mouthMesh?.morphTargetInfluences&&(mouthMesh.morphTargetInfluences[mouthOpenMorphIndex]=0,mouthMesh.morphTargetInfluences[mouthSmileMorphIndex]=0,mouthMesh.morphTargetInfluences[mouthFunnerMorphIndex]=0,mouthMesh.morphTargetInfluences[mouthPuckerMorphIndex]=0);else mouthMesh?.morphTargetInfluences&&(mouthMesh.morphTargetInfluences[mouthOpenMorphIndex]=0,mouthMesh.morphTargetInfluences[mouthSmileMorphIndex]=0,mouthMesh.morphTargetInfluences[mouthFunnerMorphIndex]=0,mouthMesh.morphTargetInfluences[mouthPuckerMorphIndex]=0)}))}var jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const position=new three_module.Vector3(0,-.6,0);function Avatar({url,eyeBlink,headMovement,speaking,onLoaded}){const{scene}=(0,useGLTF.L)(url),{nodes,materials}=(0,react_three_fiber_esm.n4)(scene);return useEyeBlink(eyeBlink,nodes),function useHeadMovement(enabled,nodes){const{gl}=(0,react_three_fiber_esm.Ky)();(0,react.useEffect)((()=>{if(enabled)return gl.domElement.addEventListener("mouseleave",setResetTrue),gl.domElement.addEventListener("mouseenter",setResetFalse),()=>{gl.domElement.removeEventListener("mouseleave",setResetTrue),gl.domElement.removeEventListener("mouseenter",setResetFalse)}}),[gl.domElement,enabled]),(0,react_three_fiber_esm.xQ)((state=>{if(!enabled||!nodes?.Neck||!nodes?.Head)return;const cameraRotation=Math.abs(state.camera.rotation.z);!useHeadMovement_reset&&cameraRotation<.2?(targetPos.x=mapRange(state.mouse.y,-1,1,5*rad,-5*rad),targetPos.y=mapRange(state.mouse.x,-1,1,-10*rad,10*rad)):targetPos.set(0,0),currentPos.x=lerp(currentPos.x,targetPos.x),currentPos.y=lerp(currentPos.y,targetPos.y),nodes.Neck.rotation.x=currentPos.x+.1,nodes.Neck.rotation.y=currentPos.y,nodes.Head.rotation.x=2*currentPos.x,nodes.Head.rotation.y=2*currentPos.y}))}(headMovement,nodes),useMouthSpeaking(!!speaking,nodes),(0,react.useEffect)((()=>(hideHands(nodes),correctMaterials(materials),onLoaded&&onLoaded(),()=>{Object.values(materials).forEach(react_three_fiber_esm.B9),Object.values(nodes).filter(isSkinnedMesh).forEach(react_three_fiber_esm.B9)})),[materials,nodes,url,onLoaded]),(0,jsx_runtime.jsxs)("group",{position,children:[(0,jsx_runtime.jsx)("primitive",{object:nodes.Hips},"armature"),Object.values(nodes).filter(isSkinnedMesh).map((node=>(0,jsx_runtime.jsx)("primitive",{object:node,receiveShadow:!0,castShadow:!0},node.name)))]})}Avatar.displayName="Avatar";try{avatar.displayName="avatar",avatar.__docgenInfo={description:"",displayName:"avatar",props:{url:{defaultValue:null,description:"",name:"url",required:!0,type:{name:"string"}},eyeBlink:{defaultValue:null,description:"",name:"eyeBlink",required:!1,type:{name:"boolean"}},headMovement:{defaultValue:null,description:"",name:"headMovement",required:!1,type:{name:"boolean"}},speaking:{defaultValue:null,description:"",name:"speaking",required:!1,type:{name:"boolean"}},onLoaded:{defaultValue:null,description:"",name:"onLoaded",required:!1,type:{name:"(() => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/AvatarView/components/avatar.tsx#avatar"]={docgenInfo:avatar.__docgenInfo,name:"avatar",path:"src/components/AvatarView/components/avatar.tsx#avatar"})}catch(__react_docgen_typescript_loader_error){}var useAnimations=__webpack_require__("./node_modules/@react-three/drei/core/useAnimations.js");let useLoadingMorphAnim_headMesh,useSmile_headMesh,eyesClosedMorphIndex=0,viseme_UMorphIndex=0;let useSmile_mouthSmileMorphIndex=0;const fullbodyAvatar_position=new three_module.Vector3(0,-1,0),rotation=new three_module.Euler(.175,0,0);function fullbodyAvatar_Avatar({url,sex,eyeBlink,speaking,onLoaded,animation}){const{scene}=(0,useGLTF.L)(url),{animations}=(0,useGLTF.L)("MALE"===sex?"https://assets.memori.ai/api/v2/asset/5de7456f-0cd8-4e29-95a7-0cd0045a5325.glb":"https://assets.memori.ai/api/v2/asset/84487a2b-377c-4565-800a-51459d580ec8.glb"),{nodes,materials}=(0,react_three_fiber_esm.n4)(scene),anim=(0,useAnimations.v)(animations,scene);useEyeBlink(eyeBlink,nodes),useMouthSpeaking(!!speaking,nodes),function useLoadingMorphAnim(loading,nodes){(0,react.useEffect)((()=>{loading&&(useLoadingMorphAnim_headMesh=nodes.Wolf3D_Head||nodes.Wolf3D_Avatar||nodes.Wolf3D_Avatar001,useLoadingMorphAnim_headMesh?.morphTargetDictionary&&useLoadingMorphAnim_headMesh?.morphTargetInfluences&&(eyesClosedMorphIndex=useLoadingMorphAnim_headMesh.morphTargetDictionary.mouthOpen,viseme_UMorphIndex=useLoadingMorphAnim_headMesh.morphTargetDictionary.viseme_U))}),[nodes,loading]),(0,react_three_fiber_esm.xQ)((()=>{loading?useLoadingMorphAnim_headMesh?.morphTargetInfluences&&(useLoadingMorphAnim_headMesh.morphTargetInfluences[eyesClosedMorphIndex]=.56,useLoadingMorphAnim_headMesh.morphTargetInfluences[viseme_UMorphIndex]=.67):useLoadingMorphAnim_headMesh?.morphTargetInfluences&&(useLoadingMorphAnim_headMesh.morphTargetInfluences[eyesClosedMorphIndex]=0,useLoadingMorphAnim_headMesh.morphTargetInfluences[viseme_UMorphIndex]=0)}))}("Loading"===animation,nodes),function useSmile(smiling,nodes){(0,react.useEffect)((()=>{smiling&&(useSmile_headMesh=nodes.Wolf3D_Head||nodes.Wolf3D_Avatar||nodes.Wolf3D_Avatar001,useSmile_headMesh?.morphTargetDictionary&&useSmile_headMesh?.morphTargetInfluences&&(useSmile_mouthSmileMorphIndex=useSmile_headMesh.morphTargetDictionary.mouthSmile))}),[nodes,smiling]),(0,react_three_fiber_esm.xQ)((()=>{smiling?useSmile_headMesh?.morphTargetInfluences&&(useSmile_headMesh.morphTargetInfluences[useSmile_mouthSmileMorphIndex]=1/3):useSmile_headMesh?.morphTargetInfluences&&(useSmile_headMesh.morphTargetInfluences[useSmile_mouthSmileMorphIndex]=0)}))}(animation?.startsWith("Idle"),nodes),(0,react.useEffect)((()=>(correctMaterials(materials),onLoaded&&onLoaded(),()=>{Object.values(materials).forEach(react_three_fiber_esm.B9),Object.values(nodes).filter(isSkinnedMesh).forEach(react_three_fiber_esm.B9)})),[materials,nodes,url,onLoaded]);try{animation&&animation in anim.actions?Object.keys(anim.actions).forEach((name=>{let action=anim.actions[name];action&&(name===animation?action.fadeIn(.3).play():action.fadeOut(.3).stop())})):Object.values(anim.actions).forEach((action=>{action&&action?.fadeOut(.2).reset().stop()}))}catch(e){console.log(e)}return(0,jsx_runtime.jsx)("group",{position:fullbodyAvatar_position,rotation,children:(0,jsx_runtime.jsx)("primitive",{object:scene})})}fullbodyAvatar_Avatar.displayName="Avatar";try{fullbodyAvatar.displayName="fullbodyAvatar",fullbodyAvatar.__docgenInfo={description:"",displayName:"fullbodyAvatar",props:{url:{defaultValue:null,description:"",name:"url",required:!0,type:{name:"string"}},sex:{defaultValue:null,description:"",name:"sex",required:!0,type:{name:"enum",value:[{value:'"MALE"'},{value:'"FEMALE"'}]}},eyeBlink:{defaultValue:null,description:"",name:"eyeBlink",required:!1,type:{name:"boolean"}},headMovement:{defaultValue:null,description:"",name:"headMovement",required:!1,type:{name:"boolean"}},speaking:{defaultValue:null,description:"",name:"speaking",required:!1,type:{name:"boolean"}},onLoaded:{defaultValue:null,description:"",name:"onLoaded",required:!1,type:{name:"(() => void)"}},animation:{defaultValue:null,description:"",name:"animation",required:!1,type:{name:"enum",value:[{value:'"Idle"'},{value:'"Idle 1"'},{value:'"Idle 2"'},{value:'"Idle 3"'},{value:'"Loading"'},{value:'"Sad"'},{value:'"Talk 1"'},{value:'"Talk 2"'},{value:'"Talk 3"'}]}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/AvatarView/components/fullbodyAvatar.tsx#fullbodyAvatar"]={docgenInfo:fullbodyAvatar.__docgenInfo,name:"fullbodyAvatar",path:"src/components/AvatarView/components/fullbodyAvatar.tsx#fullbodyAvatar"})}catch(__react_docgen_typescript_loader_error){}var useProgress=__webpack_require__("./node_modules/@react-three/drei/core/useProgress.js"),Html=__webpack_require__("./node_modules/@react-three/drei/web/Html.js"),Spin=__webpack_require__("./src/components/ui/Spin.tsx");const Loader=({fallbackImg})=>{const{progress}=(0,useProgress.S)();return(0,jsx_runtime.jsx)(Html.V,{center:!0,className:"avatar-loader",children:(0,jsx_runtime.jsx)(Spin.Z,{spinning:!0,children:fallbackImg?(0,jsx_runtime.jsxs)("figure",{children:[(0,jsx_runtime.jsx)("img",{src:fallbackImg,alt:`${Math.round(progress)}% loaded`,title:`${Math.round(progress)}% loaded`}),(0,jsx_runtime.jsx)("figcaption",{children:`${Math.round(progress)}%`})]}):(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[Math.round(progress)," % loaded"]})})})};Loader.displayName="Loader";const components_loader=Loader;try{loader.displayName="loader",loader.__docgenInfo={description:"",displayName:"loader",props:{fallbackImg:{defaultValue:null,description:"",name:"fallbackImg",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/AvatarView/components/loader.tsx#loader"]={docgenInfo:loader.__docgenInfo,name:"loader",path:"src/components/AvatarView/components/loader.tsx#loader"})}catch(__react_docgen_typescript_loader_error){}var SpotLight=__webpack_require__("./node_modules/@react-three/drei/core/SpotLight.js"),Environment=__webpack_require__("./node_modules/@react-three/drei/core/Environment.js"),OrbitControls=__webpack_require__("./node_modules/@react-three/drei/core/OrbitControls.js"),utils=__webpack_require__("./src/helpers/utils.ts");const defaultStylesHalfBody={width:"250px",height:"250px",backgroundColor:"white",borderRadius:"100%"},defaultStylesFullBody={width:"500px",height:"500px",backgroundColor:"white"};function AvatarView({url,sex,fallbackImg,style,rotateAvatar,eyeBlink,headMovement,speaking,fallback,halfBody=!0,animation}){const defaultStyles=halfBody?defaultStylesHalfBody:defaultStylesFullBody;return(0,jsx_runtime.jsx)(react_three_fiber_esm.Xz,{style:style||defaultStyles,camera:halfBody?{fov:40,position:[0,0,.6]}:{fov:40,position:[0,175e-7,3]},children:(0,jsx_runtime.jsxs)(react.Suspense,{fallback:fallback||(0,jsx_runtime.jsx)(components_loader,{fallbackImg}),children:[(0,utils.Dt)()||(0,utils.Tt)()?(0,jsx_runtime.jsx)(SpotLight.P,{distance:100,position:[-.3,.2,1.25],angle:Math.PI/2,attenuation:5,anglePower:5}):(0,jsx_runtime.jsx)(Environment.qA,{files:"https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/venice_sunset_1k.hdr"}),rotateAvatar&&halfBody&&(0,jsx_runtime.jsx)(OrbitControls.z,{enablePan:!1,enableZoom:!1}),halfBody?(0,jsx_runtime.jsx)(Avatar,{url,eyeBlink,headMovement,speaking}):(0,jsx_runtime.jsx)(fullbodyAvatar_Avatar,{url,sex,eyeBlink,headMovement,speaking,animation})]})})}AvatarView.displayName="AvatarView";try{AvatarView.displayName="AvatarView",AvatarView.__docgenInfo={description:"",displayName:"AvatarView",props:{url:{defaultValue:null,description:"",name:"url",required:!0,type:{name:"string"}},sex:{defaultValue:null,description:"",name:"sex",required:!0,type:{name:"enum",value:[{value:'"MALE"'},{value:'"FEMALE"'}]}},fallbackImg:{defaultValue:null,description:"",name:"fallbackImg",required:!1,type:{name:"string"}},eyeBlink:{defaultValue:null,description:"",name:"eyeBlink",required:!1,type:{name:"boolean"}},headMovement:{defaultValue:null,description:"",name:"headMovement",required:!1,type:{name:"boolean"}},rotateAvatar:{defaultValue:null,description:"",name:"rotateAvatar",required:!1,type:{name:"boolean"}},speaking:{defaultValue:null,description:"",name:"speaking",required:!1,type:{name:"boolean"}},style:{defaultValue:null,description:"",name:"style",required:!1,type:{name:"CSSProperties"}},fallback:{defaultValue:null,description:"",name:"fallback",required:!1,type:{name:"ReactNode"}},halfBody:{defaultValue:{value:"true"},description:"",name:"halfBody",required:!1,type:{name:"boolean"}},animation:{defaultValue:null,description:"",name:"animation",required:!1,type:{name:"enum",value:[{value:'"Idle"'},{value:'"Idle 1"'},{value:'"Idle 2"'},{value:'"Idle 3"'},{value:'"Loading"'},{value:'"Sad"'},{value:'"Talk 1"'},{value:'"Talk 2"'},{value:'"Talk 3"'}]}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/AvatarView/index.tsx#AvatarView"]={docgenInfo:AvatarView.__docgenInfo,name:"AvatarView",path:"src/components/AvatarView/index.tsx#AvatarView"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/Blob/Blob.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ExperienceBlob=({avatar,speaking=!1})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-blob",{"memori-blob--speaking":speaking}),children:[avatar&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("figure",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("img",{src:avatar,alt:"",role:"presentation"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"mainDiv"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"mainDiv"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"mainDiv"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"mainDiv"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"mainDiv"})]});ExperienceBlob.displayName="ExperienceBlob";const __WEBPACK_DEFAULT_EXPORT__=ExperienceBlob;try{Blob.displayName="Blob",Blob.__docgenInfo={description:"",displayName:"Blob",props:{avatar:{defaultValue:null,description:"",name:"avatar",required:!1,type:{name:"string"}},speaking:{defaultValue:{value:"false"},description:"",name:"speaking",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/Blob/Blob.tsx#Blob"]={docgenInfo:Blob.__docgenInfo,name:"Blob",path:"src/components/Blob/Blob.tsx#Blob"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Edit.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Edit=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"})});Edit.displayName="Edit";const __WEBPACK_DEFAULT_EXPORT__=Edit;try{Edit.displayName="Edit",Edit.__docgenInfo={description:"",displayName:"Edit",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Edit.tsx#Edit"]={docgenInfo:Edit.__docgenInfo,name:"Edit",path:"src/components/icons/Edit.tsx#Edit"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Eye.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Eye=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"})});Eye.displayName="Eye";const __WEBPACK_DEFAULT_EXPORT__=Eye;try{Eye.displayName="Eye",Eye.__docgenInfo={description:"",displayName:"Eye",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Eye.tsx#Eye"]={docgenInfo:Eye.__docgenInfo,name:"Eye",path:"src/components/icons/Eye.tsx#Eye"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/EyeInvisible.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const EyeInvisible=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z"})]});EyeInvisible.displayName="EyeInvisible";const __WEBPACK_DEFAULT_EXPORT__=EyeInvisible;try{EyeInvisible.displayName="EyeInvisible",EyeInvisible.__docgenInfo={description:"",displayName:"EyeInvisible",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/EyeInvisible.tsx#EyeInvisible"]={docgenInfo:EyeInvisible.__docgenInfo,name:"EyeInvisible",path:"src/components/icons/EyeInvisible.tsx#EyeInvisible"})}catch(__react_docgen_typescript_loader_error){}}}]); \ No newline at end of file diff --git a/components-AvatarView-AvatarView-stories.bc0ba0cc.iframe.bundle.js b/components-AvatarView-AvatarView-stories.f958dc03.iframe.bundle.js similarity index 55% rename from components-AvatarView-AvatarView-stories.bc0ba0cc.iframe.bundle.js rename to components-AvatarView-AvatarView-stories.f958dc03.iframe.bundle.js index 803f69e6..c20f7f24 100644 --- a/components-AvatarView-AvatarView-stories.bc0ba0cc.iframe.bundle.js +++ b/components-AvatarView-AvatarView-stories.f958dc03.iframe.bundle.js @@ -1,2 +1,2 @@ -/*! For license information please see components-AvatarView-AvatarView-stories.bc0ba0cc.iframe.bundle.js.LICENSE.txt */ -(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[4019],{"./node_modules/@babel/runtime/helpers/esm/defineProperty.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>_defineProperty});var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js");function _defineProperty(obj,key,value){return(key=(0,_toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__.Z)(key))in obj?Object.defineProperty(obj,key,{value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}},"./node_modules/@babel/runtime/helpers/esm/extends.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";function _extends(){return _extends=Object.assign?Object.assign.bind():function(target){for(var i=1;i_extends})},"./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>_toPropertyKey});var esm_typeof=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/typeof.js");function _toPropertyKey(arg){var key=function _toPrimitive(input,hint){if("object"!==(0,esm_typeof.Z)(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!==(0,esm_typeof.Z)(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"===(0,esm_typeof.Z)(key)?key:String(key)}},"./node_modules/@babel/runtime/helpers/esm/typeof.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";function _typeof(obj){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}__webpack_require__.d(__webpack_exports__,{Z:()=>_typeof})},"./src/components/AvatarView/AvatarView.stories.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Default:()=>Default,EyeBlink:()=>EyeBlink,Fullbody:()=>Fullbody,FullbodyAnimatedFemale:()=>FullbodyAnimatedFemale,FullbodyAnimatedIdle:()=>FullbodyAnimatedIdle,FullbodyAnimatedLoading:()=>FullbodyAnimatedLoading,FullbodyAnimatedSpeaking:()=>FullbodyAnimatedSpeaking,FullbodyFemale:()=>FullbodyFemale,HeadMovement:()=>HeadMovement,RotateAvatar:()=>RotateAvatar,Speaking:()=>Speaking,__namedExportsOrder:()=>__namedExportsOrder,default:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_index__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/AvatarView/index.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const __WEBPACK_DEFAULT_EXPORT__={title:"RPM 3D Avatar",component:_index__WEBPACK_IMPORTED_MODULE_1__.Z,argTypes:{url:{control:{type:"text"}},rotateAvatar:{control:{type:"boolean"}},eyeBlink:{control:{type:"boolean"}},headMovement:{control:{type:"boolean"}},speaking:{control:{type:"boolean"}},halfBody:{control:{type:"boolean"}},animation:{control:{type:"select",options:["Idle","Idle 1","Idle 2","Idle 3","Loading","Sad","Talk 1","Talk 2","Talk 3"]}}},parameters:{controls:{expanded:!0}}},Template=args=>{const[hydrated,setHydrated]=react__WEBPACK_IMPORTED_MODULE_0__.useState(!1);return react__WEBPACK_IMPORTED_MODULE_0__.useEffect((()=>{setHydrated(!0)}),[]),hydrated?(0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_index__WEBPACK_IMPORTED_MODULE_1__.Z,{...args,url:args.url+`#${new Date(Date.now()).toISOString()}`,key:Date.now()}):(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.Fragment,{})},Default=Template.bind({});Default.args={eyeBlink:!1,headMovement:!1,rotateAvatar:!1,speaking:!1,url:"https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb",fallbackImg:"https://assets.memori.ai/api/v2/asset/d8035229-08cf-42a7-a532-ab051df2603d.png"};const EyeBlink=Template.bind({});EyeBlink.args={eyeBlink:!0,headMovement:!1,rotateAvatar:!1,speaking:!1,url:"https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb",fallbackImg:"https://assets.memori.ai/api/v2/asset/d8035229-08cf-42a7-a532-ab051df2603d.png"};const HeadMovement=Template.bind({});HeadMovement.args={eyeBlink:!1,headMovement:!0,rotateAvatar:!1,speaking:!1,url:"https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb",fallbackImg:"https://assets.memori.ai/api/v2/asset/d8035229-08cf-42a7-a532-ab051df2603d.png"};const RotateAvatar=Template.bind({});RotateAvatar.args={eyeBlink:!1,headMovement:!1,rotateAvatar:!0,speaking:!1,url:"https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb",fallbackImg:"https://assets.memori.ai/api/v2/asset/d8035229-08cf-42a7-a532-ab051df2603d.png"};const Speaking=Template.bind({});Speaking.args={eyeBlink:!1,headMovement:!1,rotateAvatar:!1,speaking:!0,url:"https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb",fallbackImg:"https://assets.memori.ai/api/v2/asset/d8035229-08cf-42a7-a532-ab051df2603d.png"};const Fullbody=Template.bind({});Fullbody.args={sex:"MALE",eyeBlink:!0,headMovement:!0,rotateAvatar:!0,speaking:!1,url:"https://models.readyplayer.me/63b55751f17e295642bf07a2.glb",fallbackImg:"https://assets.memori.ai/api/v2/asset/3049582f-db5f-452c-913d-e4340d4afd0a.png",halfBody:!1};const FullbodyAnimatedIdle=Template.bind({});FullbodyAnimatedIdle.args={sex:"MALE",eyeBlink:!0,headMovement:!0,rotateAvatar:!0,speaking:!1,url:"https://models.readyplayer.me/63b55751f17e295642bf07a2.glb",fallbackImg:"https://assets.memori.ai/api/v2/asset/3049582f-db5f-452c-913d-e4340d4afd0a.png",animation:"Idle",halfBody:!1};const FullbodyAnimatedLoading=Template.bind({});FullbodyAnimatedLoading.args={sex:"MALE",eyeBlink:!0,headMovement:!0,rotateAvatar:!0,speaking:!1,url:"https://models.readyplayer.me/63b55751f17e295642bf07a2.glb",fallbackImg:"https://assets.memori.ai/api/v2/asset/3049582f-db5f-452c-913d-e4340d4afd0a.png",animation:"Loading",halfBody:!1};const FullbodyAnimatedSpeaking=Template.bind({});FullbodyAnimatedSpeaking.args={sex:"MALE",eyeBlink:!0,headMovement:!0,rotateAvatar:!0,speaking:!0,url:"https://models.readyplayer.me/63b55751f17e295642bf07a2.glb",fallbackImg:"https://assets.memori.ai/api/v2/asset/3049582f-db5f-452c-913d-e4340d4afd0a.png",animation:"Talk 1",halfBody:!1};const FullbodyFemale=Template.bind({});FullbodyFemale.args={sex:"FEMALE",eyeBlink:!0,headMovement:!0,rotateAvatar:!0,speaking:!1,url:"https://models.readyplayer.me/650d50c2663b19e0d2831b2b.glb",fallbackImg:"https://assets.memori.ai/api/v2/asset/3049582f-db5f-452c-913d-e4340d4afd0a.png",halfBody:!1};const FullbodyAnimatedFemale=Template.bind({});FullbodyAnimatedFemale.args={sex:"FEMALE",eyeBlink:!0,headMovement:!0,rotateAvatar:!0,speaking:!0,url:"https://models.readyplayer.me/650d50c2663b19e0d2831b2b.glb",fallbackImg:"https://assets.memori.ai/api/v2/asset/3049582f-db5f-452c-913d-e4340d4afd0a.png",animation:"Idle",halfBody:!1},Default.parameters={...Default.parameters,docs:{...Default.parameters?.docs,source:{originalSource:"args => {\n const [hydrated, setHydrated] = React.useState(false);\n React.useEffect(() => {\n setHydrated(true);\n }, []);\n return hydrated ? : <>;\n}",...Default.parameters?.docs?.source}}},EyeBlink.parameters={...EyeBlink.parameters,docs:{...EyeBlink.parameters?.docs,source:{originalSource:"args => {\n const [hydrated, setHydrated] = React.useState(false);\n React.useEffect(() => {\n setHydrated(true);\n }, []);\n return hydrated ? : <>;\n}",...EyeBlink.parameters?.docs?.source}}},HeadMovement.parameters={...HeadMovement.parameters,docs:{...HeadMovement.parameters?.docs,source:{originalSource:"args => {\n const [hydrated, setHydrated] = React.useState(false);\n React.useEffect(() => {\n setHydrated(true);\n }, []);\n return hydrated ? : <>;\n}",...HeadMovement.parameters?.docs?.source}}},RotateAvatar.parameters={...RotateAvatar.parameters,docs:{...RotateAvatar.parameters?.docs,source:{originalSource:"args => {\n const [hydrated, setHydrated] = React.useState(false);\n React.useEffect(() => {\n setHydrated(true);\n }, []);\n return hydrated ? : <>;\n}",...RotateAvatar.parameters?.docs?.source}}},Speaking.parameters={...Speaking.parameters,docs:{...Speaking.parameters?.docs,source:{originalSource:"args => {\n const [hydrated, setHydrated] = React.useState(false);\n React.useEffect(() => {\n setHydrated(true);\n }, []);\n return hydrated ? : <>;\n}",...Speaking.parameters?.docs?.source}}},Fullbody.parameters={...Fullbody.parameters,docs:{...Fullbody.parameters?.docs,source:{originalSource:"args => {\n const [hydrated, setHydrated] = React.useState(false);\n React.useEffect(() => {\n setHydrated(true);\n }, []);\n return hydrated ? : <>;\n}",...Fullbody.parameters?.docs?.source}}},FullbodyAnimatedIdle.parameters={...FullbodyAnimatedIdle.parameters,docs:{...FullbodyAnimatedIdle.parameters?.docs,source:{originalSource:"args => {\n const [hydrated, setHydrated] = React.useState(false);\n React.useEffect(() => {\n setHydrated(true);\n }, []);\n return hydrated ? : <>;\n}",...FullbodyAnimatedIdle.parameters?.docs?.source}}},FullbodyAnimatedLoading.parameters={...FullbodyAnimatedLoading.parameters,docs:{...FullbodyAnimatedLoading.parameters?.docs,source:{originalSource:"args => {\n const [hydrated, setHydrated] = React.useState(false);\n React.useEffect(() => {\n setHydrated(true);\n }, []);\n return hydrated ? : <>;\n}",...FullbodyAnimatedLoading.parameters?.docs?.source}}},FullbodyAnimatedSpeaking.parameters={...FullbodyAnimatedSpeaking.parameters,docs:{...FullbodyAnimatedSpeaking.parameters?.docs,source:{originalSource:"args => {\n const [hydrated, setHydrated] = React.useState(false);\n React.useEffect(() => {\n setHydrated(true);\n }, []);\n return hydrated ? : <>;\n}",...FullbodyAnimatedSpeaking.parameters?.docs?.source}}},FullbodyFemale.parameters={...FullbodyFemale.parameters,docs:{...FullbodyFemale.parameters?.docs,source:{originalSource:"args => {\n const [hydrated, setHydrated] = React.useState(false);\n React.useEffect(() => {\n setHydrated(true);\n }, []);\n return hydrated ? : <>;\n}",...FullbodyFemale.parameters?.docs?.source}}},FullbodyAnimatedFemale.parameters={...FullbodyAnimatedFemale.parameters,docs:{...FullbodyAnimatedFemale.parameters?.docs,source:{originalSource:"args => {\n const [hydrated, setHydrated] = React.useState(false);\n React.useEffect(() => {\n setHydrated(true);\n }, []);\n return hydrated ? : <>;\n}",...FullbodyAnimatedFemale.parameters?.docs?.source}}};const __namedExportsOrder=["Default","EyeBlink","HeadMovement","RotateAvatar","Speaking","Fullbody","FullbodyAnimatedIdle","FullbodyAnimatedLoading","FullbodyAnimatedSpeaking","FullbodyFemale","FullbodyAnimatedFemale"]},"./src/components/AvatarView/index.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>AvatarView});var react=__webpack_require__("./node_modules/react/index.js"),three_module=__webpack_require__("./node_modules/three/build/three.module.js"),useGLTF=__webpack_require__("./node_modules/@react-three/drei/core/useGLTF.js"),react_three_fiber_esm=__webpack_require__("./node_modules/@react-three/fiber/dist/react-three-fiber.esm.js");let timeout,headMesh,blinkTime=999,morphIndex=0;const setNextBlink=()=>{blinkTime=0,timeout=setTimeout(setNextBlink,5e3*Math.random()+2e3)};function useEyeBlink(enabled,nodes){(0,react.useEffect)((()=>{if(enabled)return headMesh=nodes.Wolf3D_Head||nodes.Wolf3D_Avatar,headMesh?.morphTargetDictionary&&headMesh?.morphTargetInfluences&&(morphIndex=headMesh.morphTargetDictionary.eyesClosed),timeout=setTimeout(setNextBlink,3e3),()=>{clearTimeout(timeout)}}),[nodes,enabled]),(0,react_three_fiber_esm.xQ)(((_,delta)=>{if(enabled)if(blinkTime<2&&headMesh?.morphTargetInfluences){let value=Math.abs(Math.sin(blinkTime*Math.PI/2));blinkTime+=10*delta,headMesh.morphTargetInfluences[morphIndex]=value}else headMesh?.morphTargetInfluences&&(headMesh.morphTargetInfluences[morphIndex]=0)}))}const lerp=(start,end,time=.05)=>start*(1-time)+end*time,mapRange=(value,inMin,inMax,outMin,outMax)=>((value=((value,min,max)=>Math.min(Math.max(value,min),max))(value,inMin,inMax))-inMin)*(outMax-outMin)/(inMax-inMin)+outMin,hideHands=nodes=>{nodes.Wolf3D_Hands&&(nodes.Wolf3D_Hands.visible=!1),nodes.RightHand&&nodes.LeftHand&&(nodes.RightHand.position.set(0,-2,0),nodes.LeftHand.position.set(0,-2,0))},correctMaterials=materials=>{Object.values(materials).forEach((material=>{material.map&&(material.map.minFilter=three_module.LinearFilter),material&&(material.depthWrite=!0)}))},isSkinnedMesh=node=>"SkinnedMesh"===node.type,rad=Math.PI/180;let useHeadMovement_timeout,useHeadMovement_reset=!1;const targetPos=new three_module.Vector2(0,0),currentPos=new three_module.Vector2(0,0),setResetTrue=()=>{useHeadMovement_timeout=setTimeout((()=>{useHeadMovement_reset=!0}),1e3)},setResetFalse=()=>{clearTimeout(useHeadMovement_timeout),useHeadMovement_reset=!1};let useMouthSpeaking_timeout,mouthMesh,mouthMoveTime=999,mouthOpenMorphIndex=0,mouthSmileMorphIndex=0,mouthFunnerMorphIndex=0,mouthPuckerMorphIndex=0;const setNextMouthOpen=()=>{mouthMoveTime=0,useMouthSpeaking_timeout=setTimeout(setNextMouthOpen,500*Math.random())};function useMouthSpeaking(speaking,nodes){(0,react.useEffect)((()=>{if(speaking)return mouthMesh=nodes.Wolf3D_Head||nodes.Wolf3D_Avatar||nodes.Wolf3D_Avatar001,mouthMesh?.morphTargetDictionary&&mouthMesh?.morphTargetInfluences&&(mouthOpenMorphIndex=mouthMesh.morphTargetDictionary.mouthOpen,mouthSmileMorphIndex=mouthMesh.morphTargetDictionary.mouthSmile,mouthFunnerMorphIndex=mouthMesh.morphTargetDictionary.mouthFunner,mouthPuckerMorphIndex=mouthMesh.morphTargetDictionary.mouthPucker),useMouthSpeaking_timeout=setTimeout(setNextMouthOpen,200),()=>{clearTimeout(useMouthSpeaking_timeout)}}),[nodes,speaking]),(0,react_three_fiber_esm.xQ)(((_,delta)=>{if(speaking)if(mouthMoveTime<2&&mouthMesh?.morphTargetInfluences){let value=Math.abs(Math.sin(mouthMoveTime*Math.PI/2));mouthMoveTime+=10*delta,mouthMesh.morphTargetInfluences[mouthOpenMorphIndex]=value/3,mouthMesh.morphTargetInfluences[mouthSmileMorphIndex]=value/10,mouthMesh.morphTargetInfluences[mouthFunnerMorphIndex]=value/7,mouthMesh.morphTargetInfluences[mouthPuckerMorphIndex]=value/5}else mouthMesh?.morphTargetInfluences&&(mouthMesh.morphTargetInfluences[mouthOpenMorphIndex]=0,mouthMesh.morphTargetInfluences[mouthSmileMorphIndex]=0,mouthMesh.morphTargetInfluences[mouthFunnerMorphIndex]=0,mouthMesh.morphTargetInfluences[mouthPuckerMorphIndex]=0);else mouthMesh?.morphTargetInfluences&&(mouthMesh.morphTargetInfluences[mouthOpenMorphIndex]=0,mouthMesh.morphTargetInfluences[mouthSmileMorphIndex]=0,mouthMesh.morphTargetInfluences[mouthFunnerMorphIndex]=0,mouthMesh.morphTargetInfluences[mouthPuckerMorphIndex]=0)}))}var jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const position=new three_module.Vector3(0,-.6,0);function Avatar({url,eyeBlink,headMovement,speaking,onLoaded}){const{scene}=(0,useGLTF.L)(url),{nodes,materials}=(0,react_three_fiber_esm.n4)(scene);return useEyeBlink(eyeBlink,nodes),function useHeadMovement(enabled,nodes){const{gl}=(0,react_three_fiber_esm.Ky)();(0,react.useEffect)((()=>{if(enabled)return gl.domElement.addEventListener("mouseleave",setResetTrue),gl.domElement.addEventListener("mouseenter",setResetFalse),()=>{gl.domElement.removeEventListener("mouseleave",setResetTrue),gl.domElement.removeEventListener("mouseenter",setResetFalse)}}),[gl.domElement,enabled]),(0,react_three_fiber_esm.xQ)((state=>{if(!enabled||!nodes?.Neck||!nodes?.Head)return;const cameraRotation=Math.abs(state.camera.rotation.z);!useHeadMovement_reset&&cameraRotation<.2?(targetPos.x=mapRange(state.mouse.y,-1,1,5*rad,-5*rad),targetPos.y=mapRange(state.mouse.x,-1,1,-10*rad,10*rad)):targetPos.set(0,0),currentPos.x=lerp(currentPos.x,targetPos.x),currentPos.y=lerp(currentPos.y,targetPos.y),nodes.Neck.rotation.x=currentPos.x+.1,nodes.Neck.rotation.y=currentPos.y,nodes.Head.rotation.x=2*currentPos.x,nodes.Head.rotation.y=2*currentPos.y}))}(headMovement,nodes),useMouthSpeaking(!!speaking,nodes),(0,react.useEffect)((()=>(hideHands(nodes),correctMaterials(materials),onLoaded&&onLoaded(),()=>{Object.values(materials).forEach(react_three_fiber_esm.B9),Object.values(nodes).filter(isSkinnedMesh).forEach(react_three_fiber_esm.B9)})),[materials,nodes,url,onLoaded]),(0,jsx_runtime.jsxs)("group",{position,children:[(0,jsx_runtime.jsx)("primitive",{object:nodes.Hips},"armature"),Object.values(nodes).filter(isSkinnedMesh).map((node=>(0,jsx_runtime.jsx)("primitive",{object:node,receiveShadow:!0,castShadow:!0},node.name)))]})}Avatar.displayName="Avatar";try{avatar.displayName="avatar",avatar.__docgenInfo={description:"",displayName:"avatar",props:{url:{defaultValue:null,description:"",name:"url",required:!0,type:{name:"string"}},eyeBlink:{defaultValue:null,description:"",name:"eyeBlink",required:!1,type:{name:"boolean"}},headMovement:{defaultValue:null,description:"",name:"headMovement",required:!1,type:{name:"boolean"}},speaking:{defaultValue:null,description:"",name:"speaking",required:!1,type:{name:"boolean"}},onLoaded:{defaultValue:null,description:"",name:"onLoaded",required:!1,type:{name:"(() => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/AvatarView/components/avatar.tsx#avatar"]={docgenInfo:avatar.__docgenInfo,name:"avatar",path:"src/components/AvatarView/components/avatar.tsx#avatar"})}catch(__react_docgen_typescript_loader_error){}var useAnimations=__webpack_require__("./node_modules/@react-three/drei/core/useAnimations.js");let useLoadingMorphAnim_headMesh,useSmile_headMesh,eyesClosedMorphIndex=0,viseme_UMorphIndex=0;let useSmile_mouthSmileMorphIndex=0;const fullbodyAvatar_position=new three_module.Vector3(0,-1,0),rotation=new three_module.Euler(.175,0,0);function fullbodyAvatar_Avatar({url,sex,eyeBlink,speaking,onLoaded,animation}){const{scene}=(0,useGLTF.L)(url),{animations}=(0,useGLTF.L)("MALE"===sex?"https://assets.memori.ai/api/v2/asset/5de7456f-0cd8-4e29-95a7-0cd0045a5325.glb":"https://assets.memori.ai/api/v2/asset/84487a2b-377c-4565-800a-51459d580ec8.glb"),{animations:loadingAnimations}=(0,useGLTF.L)("https://assets.memori.ai/api/v2/asset/ebb61fe1-6b0d-4b11-a032-292b7ef307a4.glb"),{nodes,materials}=(0,react_three_fiber_esm.n4)(scene),anim=(0,useAnimations.v)(animations,scene);(0,useAnimations.v)(loadingAnimations.filter((a=>"Loading"===a.name)),scene);useEyeBlink(eyeBlink,nodes),useMouthSpeaking(!!speaking,nodes),function useLoadingMorphAnim(loading,nodes){(0,react.useEffect)((()=>{loading&&(useLoadingMorphAnim_headMesh=nodes.Wolf3D_Head||nodes.Wolf3D_Avatar||nodes.Wolf3D_Avatar001,useLoadingMorphAnim_headMesh?.morphTargetDictionary&&useLoadingMorphAnim_headMesh?.morphTargetInfluences&&(eyesClosedMorphIndex=useLoadingMorphAnim_headMesh.morphTargetDictionary.mouthOpen,viseme_UMorphIndex=useLoadingMorphAnim_headMesh.morphTargetDictionary.viseme_U))}),[nodes,loading]),(0,react_three_fiber_esm.xQ)((()=>{loading?useLoadingMorphAnim_headMesh?.morphTargetInfluences&&(useLoadingMorphAnim_headMesh.morphTargetInfluences[eyesClosedMorphIndex]=.56,useLoadingMorphAnim_headMesh.morphTargetInfluences[viseme_UMorphIndex]=.67):useLoadingMorphAnim_headMesh?.morphTargetInfluences&&(useLoadingMorphAnim_headMesh.morphTargetInfluences[eyesClosedMorphIndex]=0,useLoadingMorphAnim_headMesh.morphTargetInfluences[viseme_UMorphIndex]=0)}))}("Loading"===animation,nodes),function useSmile(smiling,nodes){(0,react.useEffect)((()=>{smiling&&(useSmile_headMesh=nodes.Wolf3D_Head||nodes.Wolf3D_Avatar||nodes.Wolf3D_Avatar001,useSmile_headMesh?.morphTargetDictionary&&useSmile_headMesh?.morphTargetInfluences&&(useSmile_mouthSmileMorphIndex=useSmile_headMesh.morphTargetDictionary.mouthSmile))}),[nodes,smiling]),(0,react_three_fiber_esm.xQ)((()=>{smiling?useSmile_headMesh?.morphTargetInfluences&&(useSmile_headMesh.morphTargetInfluences[useSmile_mouthSmileMorphIndex]=1/3):useSmile_headMesh?.morphTargetInfluences&&(useSmile_headMesh.morphTargetInfluences[useSmile_mouthSmileMorphIndex]=0)}))}(animation?.startsWith("Idle"),nodes),(0,react.useEffect)((()=>(correctMaterials(materials),onLoaded&&onLoaded(),()=>{Object.values(materials).forEach(react_three_fiber_esm.B9),Object.values(nodes).filter(isSkinnedMesh).forEach(react_three_fiber_esm.B9)})),[materials,nodes,url,onLoaded]);try{animation&&animation in anim.actions?Object.keys(anim.actions).forEach((name=>{let action=anim.actions[name];action&&(name===animation&&"Loading"!==animation?action.fadeIn(.3).play():action.fadeOut(.3).stop())})):Object.values(anim.actions).forEach((action=>{action&&action?.fadeOut(.2).reset().stop()}))}catch(e){console.log(e)}return(0,jsx_runtime.jsx)("group",{position:fullbodyAvatar_position,rotation,children:(0,jsx_runtime.jsx)("primitive",{object:scene})})}fullbodyAvatar_Avatar.displayName="Avatar";try{fullbodyAvatar.displayName="fullbodyAvatar",fullbodyAvatar.__docgenInfo={description:"",displayName:"fullbodyAvatar",props:{url:{defaultValue:null,description:"",name:"url",required:!0,type:{name:"string"}},sex:{defaultValue:null,description:"",name:"sex",required:!0,type:{name:"enum",value:[{value:'"MALE"'},{value:'"FEMALE"'}]}},eyeBlink:{defaultValue:null,description:"",name:"eyeBlink",required:!1,type:{name:"boolean"}},headMovement:{defaultValue:null,description:"",name:"headMovement",required:!1,type:{name:"boolean"}},speaking:{defaultValue:null,description:"",name:"speaking",required:!1,type:{name:"boolean"}},onLoaded:{defaultValue:null,description:"",name:"onLoaded",required:!1,type:{name:"(() => void)"}},animation:{defaultValue:null,description:"",name:"animation",required:!1,type:{name:"enum",value:[{value:'"Idle"'},{value:'"Idle 1"'},{value:'"Idle 2"'},{value:'"Idle 3"'},{value:'"Loading"'},{value:'"Sad"'},{value:'"Talk 1"'},{value:'"Talk 2"'},{value:'"Talk 3"'}]}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/AvatarView/components/fullbodyAvatar.tsx#fullbodyAvatar"]={docgenInfo:fullbodyAvatar.__docgenInfo,name:"fullbodyAvatar",path:"src/components/AvatarView/components/fullbodyAvatar.tsx#fullbodyAvatar"})}catch(__react_docgen_typescript_loader_error){}var useProgress=__webpack_require__("./node_modules/@react-three/drei/core/useProgress.js"),Html=__webpack_require__("./node_modules/@react-three/drei/web/Html.js"),Spin=__webpack_require__("./src/components/ui/Spin.tsx");const Loader=({fallbackImg})=>{const{progress}=(0,useProgress.S)();return(0,jsx_runtime.jsx)(Html.V,{center:!0,className:"avatar-loader",children:(0,jsx_runtime.jsx)(Spin.Z,{spinning:!0,children:fallbackImg?(0,jsx_runtime.jsxs)("figure",{children:[(0,jsx_runtime.jsx)("img",{src:fallbackImg,alt:`${Math.round(progress)}% loaded`,title:`${Math.round(progress)}% loaded`}),(0,jsx_runtime.jsx)("figcaption",{children:`${Math.round(progress)}%`})]}):(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[Math.round(progress)," % loaded"]})})})};Loader.displayName="Loader";const components_loader=Loader;try{loader.displayName="loader",loader.__docgenInfo={description:"",displayName:"loader",props:{fallbackImg:{defaultValue:null,description:"",name:"fallbackImg",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/AvatarView/components/loader.tsx#loader"]={docgenInfo:loader.__docgenInfo,name:"loader",path:"src/components/AvatarView/components/loader.tsx#loader"})}catch(__react_docgen_typescript_loader_error){}var SpotLight=__webpack_require__("./node_modules/@react-three/drei/core/SpotLight.js"),Environment=__webpack_require__("./node_modules/@react-three/drei/core/Environment.js"),OrbitControls=__webpack_require__("./node_modules/@react-three/drei/core/OrbitControls.js"),utils=__webpack_require__("./src/helpers/utils.ts");const defaultStylesHalfBody={width:"250px",height:"250px",backgroundColor:"white",borderRadius:"100%"},defaultStylesFullBody={width:"500px",height:"500px",backgroundColor:"white"};function AvatarView({url,sex,fallbackImg,style,rotateAvatar,eyeBlink,headMovement,speaking,fallback,halfBody=!0,animation}){const defaultStyles=halfBody?defaultStylesHalfBody:defaultStylesFullBody;return(0,jsx_runtime.jsx)(react_three_fiber_esm.Xz,{style:style||defaultStyles,camera:halfBody?{fov:40,position:[0,0,.6]}:{fov:40,position:[0,175e-7,3]},children:(0,jsx_runtime.jsxs)(react.Suspense,{fallback:fallback||(0,jsx_runtime.jsx)(components_loader,{fallbackImg}),children:[(0,utils.Dt)()||(0,utils.Tt)()?(0,jsx_runtime.jsx)(SpotLight.P,{distance:100,position:[-.3,.2,1.25],angle:Math.PI/2,attenuation:5,anglePower:5}):(0,jsx_runtime.jsx)(Environment.qA,{files:"https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/venice_sunset_1k.hdr"}),rotateAvatar&&halfBody&&(0,jsx_runtime.jsx)(OrbitControls.z,{enablePan:!1,enableZoom:!1}),halfBody?(0,jsx_runtime.jsx)(Avatar,{url,eyeBlink,headMovement,speaking}):(0,jsx_runtime.jsx)(fullbodyAvatar_Avatar,{url,sex,eyeBlink,headMovement,speaking,animation})]})})}AvatarView.displayName="AvatarView";try{AvatarView.displayName="AvatarView",AvatarView.__docgenInfo={description:"",displayName:"AvatarView",props:{url:{defaultValue:null,description:"",name:"url",required:!0,type:{name:"string"}},sex:{defaultValue:null,description:"",name:"sex",required:!0,type:{name:"enum",value:[{value:'"MALE"'},{value:'"FEMALE"'}]}},fallbackImg:{defaultValue:null,description:"",name:"fallbackImg",required:!1,type:{name:"string"}},eyeBlink:{defaultValue:null,description:"",name:"eyeBlink",required:!1,type:{name:"boolean"}},headMovement:{defaultValue:null,description:"",name:"headMovement",required:!1,type:{name:"boolean"}},rotateAvatar:{defaultValue:null,description:"",name:"rotateAvatar",required:!1,type:{name:"boolean"}},speaking:{defaultValue:null,description:"",name:"speaking",required:!1,type:{name:"boolean"}},style:{defaultValue:null,description:"",name:"style",required:!1,type:{name:"CSSProperties"}},fallback:{defaultValue:null,description:"",name:"fallback",required:!1,type:{name:"ReactNode"}},halfBody:{defaultValue:{value:"true"},description:"",name:"halfBody",required:!1,type:{name:"boolean"}},animation:{defaultValue:null,description:"",name:"animation",required:!1,type:{name:"enum",value:[{value:'"Idle"'},{value:'"Idle 1"'},{value:'"Idle 2"'},{value:'"Idle 3"'},{value:'"Loading"'},{value:'"Sad"'},{value:'"Talk 1"'},{value:'"Talk 2"'},{value:'"Talk 3"'}]}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/AvatarView/index.tsx#AvatarView"]={docgenInfo:AvatarView.__docgenInfo,name:"AvatarView",path:"src/components/AvatarView/index.tsx#AvatarView"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Loading.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Loading=({className,title,loading=!0})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:classnames__WEBPACK_IMPORTED_MODULE_1___default()(className,{"memori-loading-icon":loading}),"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path",{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"})});Loading.displayName="Loading";const __WEBPACK_DEFAULT_EXPORT__=Loading;try{Loading.displayName="Loading",Loading.__docgenInfo={description:"",displayName:"Loading",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},loading:{defaultValue:{value:"true"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Loading.tsx#Loading"]={docgenInfo:Loading.__docgenInfo,name:"Loading",path:"src/components/icons/Loading.tsx#Loading"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Spin.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Spin=({spinning=!1,primary=!1,className,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-spin",className,{"memori-spin--spinning":spinning,"memori-spin--primary":primary}),children:[children,(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori-spin--spinner",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})})]});Spin.displayName="Spin";const __WEBPACK_DEFAULT_EXPORT__=Spin;try{Spin.displayName="Spin",Spin.__docgenInfo={description:"",displayName:"Spin",props:{spinning:{defaultValue:{value:"false"},description:"",name:"spinning",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Spin.tsx#Spin"]={docgenInfo:Spin.__docgenInfo,name:"Spin",path:"src/components/ui/Spin.tsx#Spin"})}catch(__react_docgen_typescript_loader_error){}},"./src/helpers/utils.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Dt:()=>isAndroid,Tt:()=>isiOS,h:()=>stripEmojis,vw:()=>stripDuplicates,xZ:()=>hasTouchscreen});__webpack_require__("./node_modules/react/index.js");const hasTouchscreen=()=>{let hasTouchScreen=!1;if("maxTouchPoints"in navigator)hasTouchScreen=navigator.maxTouchPoints>0;else if("msMaxTouchPoints"in navigator)hasTouchScreen=navigator.msMaxTouchPoints>0;else{const mQ=window&&"matchMedia"in window&&matchMedia("(pointer:coarse)");if(mQ&&"(pointer:coarse)"===mQ.media)hasTouchScreen=!!mQ.matches;else if("orientation"in window)hasTouchScreen=!0;else{var UA=navigator?.userAgent;hasTouchScreen=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA)}}return hasTouchScreen},isiOS=()=>{let platform=navigator?.userAgentData?.platform||navigator?.platform||"unknown",userAgent=navigator?.userAgent||"unknown";return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(platform)||userAgent.includes("Mac")&&"ontouchend"in document},isAndroid=()=>"android"===(navigator?.userAgentData?.platform||navigator?.platform||"unknown").toLowerCase()||navigator.userAgent.includes("Android");const stripDuplicates=text=>text.slice(0,text.length/2).trim().toLowerCase()===text.slice(text.length/2+1).trim().toLowerCase()?text.slice(0,text.length/2):text,stripEmojis=text=>text.replaceAll(/[^\p{L}\p{N}\p{P}\p{Z}^$\n]/gu,"").trim()},"./node_modules/classnames/index.js":(module,exports)=>{var __WEBPACK_AMD_DEFINE_RESULT__;!function(){"use strict";var hasOwn={}.hasOwnProperty;function classNames(){for(var classes=[],i=0;i{"use strict";var f=__webpack_require__("./node_modules/react/index.js"),k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};function q(c,a,g){var b,d={},e=null,h=null;for(b in void 0!==g&&(e=""+g),void 0!==a.key&&(e=""+a.key),void 0!==a.ref&&(h=a.ref),a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l,exports.jsx=q,exports.jsxs=q},"./node_modules/react/jsx-runtime.js":(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";module.exports=__webpack_require__("./node_modules/react/cjs/react-jsx-runtime.production.min.js")}}]); \ No newline at end of file +/*! For license information please see components-AvatarView-AvatarView-stories.f958dc03.iframe.bundle.js.LICENSE.txt */ +(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[4019],{"./node_modules/@babel/runtime/helpers/esm/defineProperty.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>_defineProperty});var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js");function _defineProperty(obj,key,value){return(key=(0,_toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__.Z)(key))in obj?Object.defineProperty(obj,key,{value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}},"./node_modules/@babel/runtime/helpers/esm/extends.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";function _extends(){return _extends=Object.assign?Object.assign.bind():function(target){for(var i=1;i_extends})},"./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>_toPropertyKey});var esm_typeof=__webpack_require__("./node_modules/@babel/runtime/helpers/esm/typeof.js");function _toPropertyKey(arg){var key=function _toPrimitive(input,hint){if("object"!==(0,esm_typeof.Z)(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!==(0,esm_typeof.Z)(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"===(0,esm_typeof.Z)(key)?key:String(key)}},"./node_modules/@babel/runtime/helpers/esm/typeof.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";function _typeof(obj){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}__webpack_require__.d(__webpack_exports__,{Z:()=>_typeof})},"./src/components/AvatarView/AvatarView.stories.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Default:()=>Default,EyeBlink:()=>EyeBlink,Fullbody:()=>Fullbody,FullbodyAnimatedFemale:()=>FullbodyAnimatedFemale,FullbodyAnimatedIdle:()=>FullbodyAnimatedIdle,FullbodyAnimatedLoading:()=>FullbodyAnimatedLoading,FullbodyAnimatedSpeaking:()=>FullbodyAnimatedSpeaking,FullbodyFemale:()=>FullbodyFemale,HeadMovement:()=>HeadMovement,RotateAvatar:()=>RotateAvatar,Speaking:()=>Speaking,__namedExportsOrder:()=>__namedExportsOrder,default:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_index__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/AvatarView/index.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const __WEBPACK_DEFAULT_EXPORT__={title:"RPM 3D Avatar",component:_index__WEBPACK_IMPORTED_MODULE_1__.Z,argTypes:{url:{control:{type:"text"}},rotateAvatar:{control:{type:"boolean"}},eyeBlink:{control:{type:"boolean"}},headMovement:{control:{type:"boolean"}},speaking:{control:{type:"boolean"}},halfBody:{control:{type:"boolean"}},animation:{control:{type:"select",options:["Idle","Idle 1","Idle 2","Idle 3","Loading","Sad","Talk 1","Talk 2","Talk 3"]}}},parameters:{controls:{expanded:!0}}},Template=args=>{const[hydrated,setHydrated]=react__WEBPACK_IMPORTED_MODULE_0__.useState(!1);return react__WEBPACK_IMPORTED_MODULE_0__.useEffect((()=>{setHydrated(!0)}),[]),hydrated?(0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_index__WEBPACK_IMPORTED_MODULE_1__.Z,{...args,url:args.url+`#${new Date(Date.now()).toISOString()}`,key:Date.now()}):(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.Fragment,{})},Default=Template.bind({});Default.args={eyeBlink:!1,headMovement:!1,rotateAvatar:!1,speaking:!1,url:"https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb",fallbackImg:"https://assets.memori.ai/api/v2/asset/d8035229-08cf-42a7-a532-ab051df2603d.png"};const EyeBlink=Template.bind({});EyeBlink.args={eyeBlink:!0,headMovement:!1,rotateAvatar:!1,speaking:!1,url:"https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb",fallbackImg:"https://assets.memori.ai/api/v2/asset/d8035229-08cf-42a7-a532-ab051df2603d.png"};const HeadMovement=Template.bind({});HeadMovement.args={eyeBlink:!1,headMovement:!0,rotateAvatar:!1,speaking:!1,url:"https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb",fallbackImg:"https://assets.memori.ai/api/v2/asset/d8035229-08cf-42a7-a532-ab051df2603d.png"};const RotateAvatar=Template.bind({});RotateAvatar.args={eyeBlink:!1,headMovement:!1,rotateAvatar:!0,speaking:!1,url:"https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb",fallbackImg:"https://assets.memori.ai/api/v2/asset/d8035229-08cf-42a7-a532-ab051df2603d.png"};const Speaking=Template.bind({});Speaking.args={eyeBlink:!1,headMovement:!1,rotateAvatar:!1,speaking:!0,url:"https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb",fallbackImg:"https://assets.memori.ai/api/v2/asset/d8035229-08cf-42a7-a532-ab051df2603d.png"};const Fullbody=Template.bind({});Fullbody.args={sex:"MALE",eyeBlink:!0,headMovement:!0,rotateAvatar:!0,speaking:!1,url:"https://models.readyplayer.me/63b55751f17e295642bf07a2.glb",fallbackImg:"https://assets.memori.ai/api/v2/asset/3049582f-db5f-452c-913d-e4340d4afd0a.png",halfBody:!1};const FullbodyAnimatedIdle=Template.bind({});FullbodyAnimatedIdle.args={sex:"MALE",eyeBlink:!0,headMovement:!0,rotateAvatar:!0,speaking:!1,url:"https://models.readyplayer.me/63b55751f17e295642bf07a2.glb",fallbackImg:"https://assets.memori.ai/api/v2/asset/3049582f-db5f-452c-913d-e4340d4afd0a.png",animation:"Idle",halfBody:!1};const FullbodyAnimatedLoading=Template.bind({});FullbodyAnimatedLoading.args={sex:"MALE",eyeBlink:!0,headMovement:!0,rotateAvatar:!0,speaking:!1,url:"https://models.readyplayer.me/63b55751f17e295642bf07a2.glb",fallbackImg:"https://assets.memori.ai/api/v2/asset/3049582f-db5f-452c-913d-e4340d4afd0a.png",animation:"Loading",halfBody:!1};const FullbodyAnimatedSpeaking=Template.bind({});FullbodyAnimatedSpeaking.args={sex:"MALE",eyeBlink:!0,headMovement:!0,rotateAvatar:!0,speaking:!0,url:"https://models.readyplayer.me/63b55751f17e295642bf07a2.glb",fallbackImg:"https://assets.memori.ai/api/v2/asset/3049582f-db5f-452c-913d-e4340d4afd0a.png",animation:"Talk 1",halfBody:!1};const FullbodyFemale=Template.bind({});FullbodyFemale.args={sex:"FEMALE",eyeBlink:!0,headMovement:!0,rotateAvatar:!0,speaking:!1,url:"https://models.readyplayer.me/650d50c2663b19e0d2831b2b.glb",fallbackImg:"https://assets.memori.ai/api/v2/asset/3049582f-db5f-452c-913d-e4340d4afd0a.png",halfBody:!1};const FullbodyAnimatedFemale=Template.bind({});FullbodyAnimatedFemale.args={sex:"FEMALE",eyeBlink:!0,headMovement:!0,rotateAvatar:!0,speaking:!0,url:"https://models.readyplayer.me/650d50c2663b19e0d2831b2b.glb",fallbackImg:"https://assets.memori.ai/api/v2/asset/3049582f-db5f-452c-913d-e4340d4afd0a.png",animation:"Idle",halfBody:!1},Default.parameters={...Default.parameters,docs:{...Default.parameters?.docs,source:{originalSource:"args => {\n const [hydrated, setHydrated] = React.useState(false);\n React.useEffect(() => {\n setHydrated(true);\n }, []);\n return hydrated ? : <>;\n}",...Default.parameters?.docs?.source}}},EyeBlink.parameters={...EyeBlink.parameters,docs:{...EyeBlink.parameters?.docs,source:{originalSource:"args => {\n const [hydrated, setHydrated] = React.useState(false);\n React.useEffect(() => {\n setHydrated(true);\n }, []);\n return hydrated ? : <>;\n}",...EyeBlink.parameters?.docs?.source}}},HeadMovement.parameters={...HeadMovement.parameters,docs:{...HeadMovement.parameters?.docs,source:{originalSource:"args => {\n const [hydrated, setHydrated] = React.useState(false);\n React.useEffect(() => {\n setHydrated(true);\n }, []);\n return hydrated ? : <>;\n}",...HeadMovement.parameters?.docs?.source}}},RotateAvatar.parameters={...RotateAvatar.parameters,docs:{...RotateAvatar.parameters?.docs,source:{originalSource:"args => {\n const [hydrated, setHydrated] = React.useState(false);\n React.useEffect(() => {\n setHydrated(true);\n }, []);\n return hydrated ? : <>;\n}",...RotateAvatar.parameters?.docs?.source}}},Speaking.parameters={...Speaking.parameters,docs:{...Speaking.parameters?.docs,source:{originalSource:"args => {\n const [hydrated, setHydrated] = React.useState(false);\n React.useEffect(() => {\n setHydrated(true);\n }, []);\n return hydrated ? : <>;\n}",...Speaking.parameters?.docs?.source}}},Fullbody.parameters={...Fullbody.parameters,docs:{...Fullbody.parameters?.docs,source:{originalSource:"args => {\n const [hydrated, setHydrated] = React.useState(false);\n React.useEffect(() => {\n setHydrated(true);\n }, []);\n return hydrated ? : <>;\n}",...Fullbody.parameters?.docs?.source}}},FullbodyAnimatedIdle.parameters={...FullbodyAnimatedIdle.parameters,docs:{...FullbodyAnimatedIdle.parameters?.docs,source:{originalSource:"args => {\n const [hydrated, setHydrated] = React.useState(false);\n React.useEffect(() => {\n setHydrated(true);\n }, []);\n return hydrated ? : <>;\n}",...FullbodyAnimatedIdle.parameters?.docs?.source}}},FullbodyAnimatedLoading.parameters={...FullbodyAnimatedLoading.parameters,docs:{...FullbodyAnimatedLoading.parameters?.docs,source:{originalSource:"args => {\n const [hydrated, setHydrated] = React.useState(false);\n React.useEffect(() => {\n setHydrated(true);\n }, []);\n return hydrated ? : <>;\n}",...FullbodyAnimatedLoading.parameters?.docs?.source}}},FullbodyAnimatedSpeaking.parameters={...FullbodyAnimatedSpeaking.parameters,docs:{...FullbodyAnimatedSpeaking.parameters?.docs,source:{originalSource:"args => {\n const [hydrated, setHydrated] = React.useState(false);\n React.useEffect(() => {\n setHydrated(true);\n }, []);\n return hydrated ? : <>;\n}",...FullbodyAnimatedSpeaking.parameters?.docs?.source}}},FullbodyFemale.parameters={...FullbodyFemale.parameters,docs:{...FullbodyFemale.parameters?.docs,source:{originalSource:"args => {\n const [hydrated, setHydrated] = React.useState(false);\n React.useEffect(() => {\n setHydrated(true);\n }, []);\n return hydrated ? : <>;\n}",...FullbodyFemale.parameters?.docs?.source}}},FullbodyAnimatedFemale.parameters={...FullbodyAnimatedFemale.parameters,docs:{...FullbodyAnimatedFemale.parameters?.docs,source:{originalSource:"args => {\n const [hydrated, setHydrated] = React.useState(false);\n React.useEffect(() => {\n setHydrated(true);\n }, []);\n return hydrated ? : <>;\n}",...FullbodyAnimatedFemale.parameters?.docs?.source}}};const __namedExportsOrder=["Default","EyeBlink","HeadMovement","RotateAvatar","Speaking","Fullbody","FullbodyAnimatedIdle","FullbodyAnimatedLoading","FullbodyAnimatedSpeaking","FullbodyFemale","FullbodyAnimatedFemale"]},"./src/components/AvatarView/index.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>AvatarView});var react=__webpack_require__("./node_modules/react/index.js"),three_module=__webpack_require__("./node_modules/three/build/three.module.js"),useGLTF=__webpack_require__("./node_modules/@react-three/drei/core/useGLTF.js"),react_three_fiber_esm=__webpack_require__("./node_modules/@react-three/fiber/dist/react-three-fiber.esm.js");let timeout,headMesh,blinkTime=999,morphIndex=0;const setNextBlink=()=>{blinkTime=0,timeout=setTimeout(setNextBlink,5e3*Math.random()+2e3)};function useEyeBlink(enabled,nodes){(0,react.useEffect)((()=>{if(enabled)return headMesh=nodes.Wolf3D_Head||nodes.Wolf3D_Avatar,headMesh?.morphTargetDictionary&&headMesh?.morphTargetInfluences&&(morphIndex=headMesh.morphTargetDictionary.eyesClosed),timeout=setTimeout(setNextBlink,3e3),()=>{clearTimeout(timeout)}}),[nodes,enabled]),(0,react_three_fiber_esm.xQ)(((_,delta)=>{if(enabled)if(blinkTime<2&&headMesh?.morphTargetInfluences){let value=Math.abs(Math.sin(blinkTime*Math.PI/2));blinkTime+=10*delta,headMesh.morphTargetInfluences[morphIndex]=value}else headMesh?.morphTargetInfluences&&(headMesh.morphTargetInfluences[morphIndex]=0)}))}const lerp=(start,end,time=.05)=>start*(1-time)+end*time,mapRange=(value,inMin,inMax,outMin,outMax)=>((value=((value,min,max)=>Math.min(Math.max(value,min),max))(value,inMin,inMax))-inMin)*(outMax-outMin)/(inMax-inMin)+outMin,hideHands=nodes=>{nodes.Wolf3D_Hands&&(nodes.Wolf3D_Hands.visible=!1),nodes.RightHand&&nodes.LeftHand&&(nodes.RightHand.position.set(0,-2,0),nodes.LeftHand.position.set(0,-2,0))},correctMaterials=materials=>{Object.values(materials).forEach((material=>{material.map&&(material.map.minFilter=three_module.LinearFilter),material&&(material.depthWrite=!0)}))},isSkinnedMesh=node=>"SkinnedMesh"===node.type,rad=Math.PI/180;let useHeadMovement_timeout,useHeadMovement_reset=!1;const targetPos=new three_module.Vector2(0,0),currentPos=new three_module.Vector2(0,0),setResetTrue=()=>{useHeadMovement_timeout=setTimeout((()=>{useHeadMovement_reset=!0}),1e3)},setResetFalse=()=>{clearTimeout(useHeadMovement_timeout),useHeadMovement_reset=!1};let useMouthSpeaking_timeout,mouthMesh,mouthMoveTime=999,mouthOpenMorphIndex=0,mouthSmileMorphIndex=0,mouthFunnerMorphIndex=0,mouthPuckerMorphIndex=0;const setNextMouthOpen=()=>{mouthMoveTime=0,useMouthSpeaking_timeout=setTimeout(setNextMouthOpen,500*Math.random())};function useMouthSpeaking(speaking,nodes){(0,react.useEffect)((()=>{if(speaking)return mouthMesh=nodes.Wolf3D_Head||nodes.Wolf3D_Avatar||nodes.Wolf3D_Avatar001,mouthMesh?.morphTargetDictionary&&mouthMesh?.morphTargetInfluences&&(mouthOpenMorphIndex=mouthMesh.morphTargetDictionary.mouthOpen,mouthSmileMorphIndex=mouthMesh.morphTargetDictionary.mouthSmile,mouthFunnerMorphIndex=mouthMesh.morphTargetDictionary.mouthFunner,mouthPuckerMorphIndex=mouthMesh.morphTargetDictionary.mouthPucker),useMouthSpeaking_timeout=setTimeout(setNextMouthOpen,200),()=>{clearTimeout(useMouthSpeaking_timeout)}}),[nodes,speaking]),(0,react_three_fiber_esm.xQ)(((_,delta)=>{if(speaking)if(mouthMoveTime<2&&mouthMesh?.morphTargetInfluences){let value=Math.abs(Math.sin(mouthMoveTime*Math.PI/2));mouthMoveTime+=10*delta,mouthMesh.morphTargetInfluences[mouthOpenMorphIndex]=value/3,mouthMesh.morphTargetInfluences[mouthSmileMorphIndex]=value/10,mouthMesh.morphTargetInfluences[mouthFunnerMorphIndex]=value/7,mouthMesh.morphTargetInfluences[mouthPuckerMorphIndex]=value/5}else mouthMesh?.morphTargetInfluences&&(mouthMesh.morphTargetInfluences[mouthOpenMorphIndex]=0,mouthMesh.morphTargetInfluences[mouthSmileMorphIndex]=0,mouthMesh.morphTargetInfluences[mouthFunnerMorphIndex]=0,mouthMesh.morphTargetInfluences[mouthPuckerMorphIndex]=0);else mouthMesh?.morphTargetInfluences&&(mouthMesh.morphTargetInfluences[mouthOpenMorphIndex]=0,mouthMesh.morphTargetInfluences[mouthSmileMorphIndex]=0,mouthMesh.morphTargetInfluences[mouthFunnerMorphIndex]=0,mouthMesh.morphTargetInfluences[mouthPuckerMorphIndex]=0)}))}var jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const position=new three_module.Vector3(0,-.6,0);function Avatar({url,eyeBlink,headMovement,speaking,onLoaded}){const{scene}=(0,useGLTF.L)(url),{nodes,materials}=(0,react_three_fiber_esm.n4)(scene);return useEyeBlink(eyeBlink,nodes),function useHeadMovement(enabled,nodes){const{gl}=(0,react_three_fiber_esm.Ky)();(0,react.useEffect)((()=>{if(enabled)return gl.domElement.addEventListener("mouseleave",setResetTrue),gl.domElement.addEventListener("mouseenter",setResetFalse),()=>{gl.domElement.removeEventListener("mouseleave",setResetTrue),gl.domElement.removeEventListener("mouseenter",setResetFalse)}}),[gl.domElement,enabled]),(0,react_three_fiber_esm.xQ)((state=>{if(!enabled||!nodes?.Neck||!nodes?.Head)return;const cameraRotation=Math.abs(state.camera.rotation.z);!useHeadMovement_reset&&cameraRotation<.2?(targetPos.x=mapRange(state.mouse.y,-1,1,5*rad,-5*rad),targetPos.y=mapRange(state.mouse.x,-1,1,-10*rad,10*rad)):targetPos.set(0,0),currentPos.x=lerp(currentPos.x,targetPos.x),currentPos.y=lerp(currentPos.y,targetPos.y),nodes.Neck.rotation.x=currentPos.x+.1,nodes.Neck.rotation.y=currentPos.y,nodes.Head.rotation.x=2*currentPos.x,nodes.Head.rotation.y=2*currentPos.y}))}(headMovement,nodes),useMouthSpeaking(!!speaking,nodes),(0,react.useEffect)((()=>(hideHands(nodes),correctMaterials(materials),onLoaded&&onLoaded(),()=>{Object.values(materials).forEach(react_three_fiber_esm.B9),Object.values(nodes).filter(isSkinnedMesh).forEach(react_three_fiber_esm.B9)})),[materials,nodes,url,onLoaded]),(0,jsx_runtime.jsxs)("group",{position,children:[(0,jsx_runtime.jsx)("primitive",{object:nodes.Hips},"armature"),Object.values(nodes).filter(isSkinnedMesh).map((node=>(0,jsx_runtime.jsx)("primitive",{object:node,receiveShadow:!0,castShadow:!0},node.name)))]})}Avatar.displayName="Avatar";try{avatar.displayName="avatar",avatar.__docgenInfo={description:"",displayName:"avatar",props:{url:{defaultValue:null,description:"",name:"url",required:!0,type:{name:"string"}},eyeBlink:{defaultValue:null,description:"",name:"eyeBlink",required:!1,type:{name:"boolean"}},headMovement:{defaultValue:null,description:"",name:"headMovement",required:!1,type:{name:"boolean"}},speaking:{defaultValue:null,description:"",name:"speaking",required:!1,type:{name:"boolean"}},onLoaded:{defaultValue:null,description:"",name:"onLoaded",required:!1,type:{name:"(() => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/AvatarView/components/avatar.tsx#avatar"]={docgenInfo:avatar.__docgenInfo,name:"avatar",path:"src/components/AvatarView/components/avatar.tsx#avatar"})}catch(__react_docgen_typescript_loader_error){}var useAnimations=__webpack_require__("./node_modules/@react-three/drei/core/useAnimations.js");let useLoadingMorphAnim_headMesh,useSmile_headMesh,eyesClosedMorphIndex=0,viseme_UMorphIndex=0;let useSmile_mouthSmileMorphIndex=0;const fullbodyAvatar_position=new three_module.Vector3(0,-1,0),rotation=new three_module.Euler(.175,0,0);function fullbodyAvatar_Avatar({url,sex,eyeBlink,speaking,onLoaded,animation}){const{scene}=(0,useGLTF.L)(url),{animations}=(0,useGLTF.L)("MALE"===sex?"https://assets.memori.ai/api/v2/asset/5de7456f-0cd8-4e29-95a7-0cd0045a5325.glb":"https://assets.memori.ai/api/v2/asset/84487a2b-377c-4565-800a-51459d580ec8.glb"),{nodes,materials}=(0,react_three_fiber_esm.n4)(scene),anim=(0,useAnimations.v)(animations,scene);useEyeBlink(eyeBlink,nodes),useMouthSpeaking(!!speaking,nodes),function useLoadingMorphAnim(loading,nodes){(0,react.useEffect)((()=>{loading&&(useLoadingMorphAnim_headMesh=nodes.Wolf3D_Head||nodes.Wolf3D_Avatar||nodes.Wolf3D_Avatar001,useLoadingMorphAnim_headMesh?.morphTargetDictionary&&useLoadingMorphAnim_headMesh?.morphTargetInfluences&&(eyesClosedMorphIndex=useLoadingMorphAnim_headMesh.morphTargetDictionary.mouthOpen,viseme_UMorphIndex=useLoadingMorphAnim_headMesh.morphTargetDictionary.viseme_U))}),[nodes,loading]),(0,react_three_fiber_esm.xQ)((()=>{loading?useLoadingMorphAnim_headMesh?.morphTargetInfluences&&(useLoadingMorphAnim_headMesh.morphTargetInfluences[eyesClosedMorphIndex]=.56,useLoadingMorphAnim_headMesh.morphTargetInfluences[viseme_UMorphIndex]=.67):useLoadingMorphAnim_headMesh?.morphTargetInfluences&&(useLoadingMorphAnim_headMesh.morphTargetInfluences[eyesClosedMorphIndex]=0,useLoadingMorphAnim_headMesh.morphTargetInfluences[viseme_UMorphIndex]=0)}))}("Loading"===animation,nodes),function useSmile(smiling,nodes){(0,react.useEffect)((()=>{smiling&&(useSmile_headMesh=nodes.Wolf3D_Head||nodes.Wolf3D_Avatar||nodes.Wolf3D_Avatar001,useSmile_headMesh?.morphTargetDictionary&&useSmile_headMesh?.morphTargetInfluences&&(useSmile_mouthSmileMorphIndex=useSmile_headMesh.morphTargetDictionary.mouthSmile))}),[nodes,smiling]),(0,react_three_fiber_esm.xQ)((()=>{smiling?useSmile_headMesh?.morphTargetInfluences&&(useSmile_headMesh.morphTargetInfluences[useSmile_mouthSmileMorphIndex]=1/3):useSmile_headMesh?.morphTargetInfluences&&(useSmile_headMesh.morphTargetInfluences[useSmile_mouthSmileMorphIndex]=0)}))}(animation?.startsWith("Idle"),nodes),(0,react.useEffect)((()=>(correctMaterials(materials),onLoaded&&onLoaded(),()=>{Object.values(materials).forEach(react_three_fiber_esm.B9),Object.values(nodes).filter(isSkinnedMesh).forEach(react_three_fiber_esm.B9)})),[materials,nodes,url,onLoaded]);try{animation&&animation in anim.actions?Object.keys(anim.actions).forEach((name=>{let action=anim.actions[name];action&&(name===animation?action.fadeIn(.3).play():action.fadeOut(.3).stop())})):Object.values(anim.actions).forEach((action=>{action&&action?.fadeOut(.2).reset().stop()}))}catch(e){console.log(e)}return(0,jsx_runtime.jsx)("group",{position:fullbodyAvatar_position,rotation,children:(0,jsx_runtime.jsx)("primitive",{object:scene})})}fullbodyAvatar_Avatar.displayName="Avatar";try{fullbodyAvatar.displayName="fullbodyAvatar",fullbodyAvatar.__docgenInfo={description:"",displayName:"fullbodyAvatar",props:{url:{defaultValue:null,description:"",name:"url",required:!0,type:{name:"string"}},sex:{defaultValue:null,description:"",name:"sex",required:!0,type:{name:"enum",value:[{value:'"MALE"'},{value:'"FEMALE"'}]}},eyeBlink:{defaultValue:null,description:"",name:"eyeBlink",required:!1,type:{name:"boolean"}},headMovement:{defaultValue:null,description:"",name:"headMovement",required:!1,type:{name:"boolean"}},speaking:{defaultValue:null,description:"",name:"speaking",required:!1,type:{name:"boolean"}},onLoaded:{defaultValue:null,description:"",name:"onLoaded",required:!1,type:{name:"(() => void)"}},animation:{defaultValue:null,description:"",name:"animation",required:!1,type:{name:"enum",value:[{value:'"Idle"'},{value:'"Idle 1"'},{value:'"Idle 2"'},{value:'"Idle 3"'},{value:'"Loading"'},{value:'"Sad"'},{value:'"Talk 1"'},{value:'"Talk 2"'},{value:'"Talk 3"'}]}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/AvatarView/components/fullbodyAvatar.tsx#fullbodyAvatar"]={docgenInfo:fullbodyAvatar.__docgenInfo,name:"fullbodyAvatar",path:"src/components/AvatarView/components/fullbodyAvatar.tsx#fullbodyAvatar"})}catch(__react_docgen_typescript_loader_error){}var useProgress=__webpack_require__("./node_modules/@react-three/drei/core/useProgress.js"),Html=__webpack_require__("./node_modules/@react-three/drei/web/Html.js"),Spin=__webpack_require__("./src/components/ui/Spin.tsx");const Loader=({fallbackImg})=>{const{progress}=(0,useProgress.S)();return(0,jsx_runtime.jsx)(Html.V,{center:!0,className:"avatar-loader",children:(0,jsx_runtime.jsx)(Spin.Z,{spinning:!0,children:fallbackImg?(0,jsx_runtime.jsxs)("figure",{children:[(0,jsx_runtime.jsx)("img",{src:fallbackImg,alt:`${Math.round(progress)}% loaded`,title:`${Math.round(progress)}% loaded`}),(0,jsx_runtime.jsx)("figcaption",{children:`${Math.round(progress)}%`})]}):(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[Math.round(progress)," % loaded"]})})})};Loader.displayName="Loader";const components_loader=Loader;try{loader.displayName="loader",loader.__docgenInfo={description:"",displayName:"loader",props:{fallbackImg:{defaultValue:null,description:"",name:"fallbackImg",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/AvatarView/components/loader.tsx#loader"]={docgenInfo:loader.__docgenInfo,name:"loader",path:"src/components/AvatarView/components/loader.tsx#loader"})}catch(__react_docgen_typescript_loader_error){}var SpotLight=__webpack_require__("./node_modules/@react-three/drei/core/SpotLight.js"),Environment=__webpack_require__("./node_modules/@react-three/drei/core/Environment.js"),OrbitControls=__webpack_require__("./node_modules/@react-three/drei/core/OrbitControls.js"),utils=__webpack_require__("./src/helpers/utils.ts");const defaultStylesHalfBody={width:"250px",height:"250px",backgroundColor:"white",borderRadius:"100%"},defaultStylesFullBody={width:"500px",height:"500px",backgroundColor:"white"};function AvatarView({url,sex,fallbackImg,style,rotateAvatar,eyeBlink,headMovement,speaking,fallback,halfBody=!0,animation}){const defaultStyles=halfBody?defaultStylesHalfBody:defaultStylesFullBody;return(0,jsx_runtime.jsx)(react_three_fiber_esm.Xz,{style:style||defaultStyles,camera:halfBody?{fov:40,position:[0,0,.6]}:{fov:40,position:[0,175e-7,3]},children:(0,jsx_runtime.jsxs)(react.Suspense,{fallback:fallback||(0,jsx_runtime.jsx)(components_loader,{fallbackImg}),children:[(0,utils.Dt)()||(0,utils.Tt)()?(0,jsx_runtime.jsx)(SpotLight.P,{distance:100,position:[-.3,.2,1.25],angle:Math.PI/2,attenuation:5,anglePower:5}):(0,jsx_runtime.jsx)(Environment.qA,{files:"https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/venice_sunset_1k.hdr"}),rotateAvatar&&halfBody&&(0,jsx_runtime.jsx)(OrbitControls.z,{enablePan:!1,enableZoom:!1}),halfBody?(0,jsx_runtime.jsx)(Avatar,{url,eyeBlink,headMovement,speaking}):(0,jsx_runtime.jsx)(fullbodyAvatar_Avatar,{url,sex,eyeBlink,headMovement,speaking,animation})]})})}AvatarView.displayName="AvatarView";try{AvatarView.displayName="AvatarView",AvatarView.__docgenInfo={description:"",displayName:"AvatarView",props:{url:{defaultValue:null,description:"",name:"url",required:!0,type:{name:"string"}},sex:{defaultValue:null,description:"",name:"sex",required:!0,type:{name:"enum",value:[{value:'"MALE"'},{value:'"FEMALE"'}]}},fallbackImg:{defaultValue:null,description:"",name:"fallbackImg",required:!1,type:{name:"string"}},eyeBlink:{defaultValue:null,description:"",name:"eyeBlink",required:!1,type:{name:"boolean"}},headMovement:{defaultValue:null,description:"",name:"headMovement",required:!1,type:{name:"boolean"}},rotateAvatar:{defaultValue:null,description:"",name:"rotateAvatar",required:!1,type:{name:"boolean"}},speaking:{defaultValue:null,description:"",name:"speaking",required:!1,type:{name:"boolean"}},style:{defaultValue:null,description:"",name:"style",required:!1,type:{name:"CSSProperties"}},fallback:{defaultValue:null,description:"",name:"fallback",required:!1,type:{name:"ReactNode"}},halfBody:{defaultValue:{value:"true"},description:"",name:"halfBody",required:!1,type:{name:"boolean"}},animation:{defaultValue:null,description:"",name:"animation",required:!1,type:{name:"enum",value:[{value:'"Idle"'},{value:'"Idle 1"'},{value:'"Idle 2"'},{value:'"Idle 3"'},{value:'"Loading"'},{value:'"Sad"'},{value:'"Talk 1"'},{value:'"Talk 2"'},{value:'"Talk 3"'}]}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/AvatarView/index.tsx#AvatarView"]={docgenInfo:AvatarView.__docgenInfo,name:"AvatarView",path:"src/components/AvatarView/index.tsx#AvatarView"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Loading.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Loading=({className,title,loading=!0})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:classnames__WEBPACK_IMPORTED_MODULE_1___default()(className,{"memori-loading-icon":loading}),"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path",{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"})});Loading.displayName="Loading";const __WEBPACK_DEFAULT_EXPORT__=Loading;try{Loading.displayName="Loading",Loading.__docgenInfo={description:"",displayName:"Loading",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},loading:{defaultValue:{value:"true"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Loading.tsx#Loading"]={docgenInfo:Loading.__docgenInfo,name:"Loading",path:"src/components/icons/Loading.tsx#Loading"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Spin.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Spin=({spinning=!1,primary=!1,className,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-spin",className,{"memori-spin--spinning":spinning,"memori-spin--primary":primary}),children:[children,(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori-spin--spinner",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})})]});Spin.displayName="Spin";const __WEBPACK_DEFAULT_EXPORT__=Spin;try{Spin.displayName="Spin",Spin.__docgenInfo={description:"",displayName:"Spin",props:{spinning:{defaultValue:{value:"false"},description:"",name:"spinning",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Spin.tsx#Spin"]={docgenInfo:Spin.__docgenInfo,name:"Spin",path:"src/components/ui/Spin.tsx#Spin"})}catch(__react_docgen_typescript_loader_error){}},"./src/helpers/utils.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Dt:()=>isAndroid,Tt:()=>isiOS,h:()=>stripEmojis,vw:()=>stripDuplicates,xZ:()=>hasTouchscreen});__webpack_require__("./node_modules/react/index.js");const hasTouchscreen=()=>{let hasTouchScreen=!1;if("maxTouchPoints"in navigator)hasTouchScreen=navigator.maxTouchPoints>0;else if("msMaxTouchPoints"in navigator)hasTouchScreen=navigator.msMaxTouchPoints>0;else{const mQ=window&&"matchMedia"in window&&matchMedia("(pointer:coarse)");if(mQ&&"(pointer:coarse)"===mQ.media)hasTouchScreen=!!mQ.matches;else if("orientation"in window)hasTouchScreen=!0;else{var UA=navigator?.userAgent;hasTouchScreen=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA)}}return hasTouchScreen},isiOS=()=>{let platform=navigator?.userAgentData?.platform||navigator?.platform||"unknown",userAgent=navigator?.userAgent||"unknown";return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(platform)||userAgent.includes("Mac")&&"ontouchend"in document},isAndroid=()=>"android"===(navigator?.userAgentData?.platform||navigator?.platform||"unknown").toLowerCase()||navigator.userAgent.includes("Android");const stripDuplicates=text=>text.slice(0,text.length/2).trim().toLowerCase()===text.slice(text.length/2+1).trim().toLowerCase()?text.slice(0,text.length/2):text,stripEmojis=text=>text.replaceAll(/[^\p{L}\p{N}\p{P}\p{Z}^$\n]/gu,"").trim()},"./node_modules/classnames/index.js":(module,exports)=>{var __WEBPACK_AMD_DEFINE_RESULT__;!function(){"use strict";var hasOwn={}.hasOwnProperty;function classNames(){for(var classes=[],i=0;i{"use strict";var f=__webpack_require__("./node_modules/react/index.js"),k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};function q(c,a,g){var b,d={},e=null,h=null;for(b in void 0!==g&&(e=""+g),void 0!==a.key&&(e=""+a.key),void 0!==a.ref&&(h=a.ref),a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l,exports.jsx=q,exports.jsxs=q},"./node_modules/react/jsx-runtime.js":(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";module.exports=__webpack_require__("./node_modules/react/cjs/react-jsx-runtime.production.min.js")}}]); \ No newline at end of file diff --git a/components-AvatarView-AvatarView-stories.bc0ba0cc.iframe.bundle.js.LICENSE.txt b/components-AvatarView-AvatarView-stories.f958dc03.iframe.bundle.js.LICENSE.txt similarity index 100% rename from components-AvatarView-AvatarView-stories.bc0ba0cc.iframe.bundle.js.LICENSE.txt rename to components-AvatarView-AvatarView-stories.f958dc03.iframe.bundle.js.LICENSE.txt diff --git a/iframe.html b/iframe.html index 6782fc91..5250f0ae 100644 --- a/iframe.html +++ b/iframe.html @@ -348,7 +348,7 @@ window['DOCS_OPTIONS'] = {"defaultName":"Docs","autodocs":true};