harper 5.2.0-alpha.4 → 5.2.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/npm-shrinkwrap.json +388 -558
- package/package.json +3 -3
- package/studio/web/assets/{Chat-D4FIaBu7.js → Chat-Cv_2paZE.js} +2 -2
- package/studio/web/assets/{Chat-D4FIaBu7.js.map → Chat-Cv_2paZE.js.map} +1 -1
- package/studio/web/assets/{FloatingChat-DGUC3L4r.js → FloatingChat-CPyPIcVR.js} +4 -4
- package/studio/web/assets/{FloatingChat-DGUC3L4r.js.map → FloatingChat-CPyPIcVR.js.map} +1 -1
- package/studio/web/assets/{applications-D8Am9ikM.js → applications-C0jT2vdZ.js} +2 -2
- package/studio/web/assets/{applications-D8Am9ikM.js.map → applications-C0jT2vdZ.js.map} +1 -1
- package/studio/web/assets/{index-HGL4WHdb.js → index-D_GKOkhn.js} +6 -6
- package/studio/web/assets/{index-HGL4WHdb.js.map → index-D_GKOkhn.js.map} +1 -1
- package/studio/web/assets/{index.lazy-Dk5j1AoQ.js → index.lazy-CAmCIA65.js} +4 -4
- package/studio/web/assets/{index.lazy-Dk5j1AoQ.js.map → index.lazy-CAmCIA65.js.map} +1 -1
- package/studio/web/assets/{profile-7bu_CF1f.js → profile-CaF-4aZe.js} +2 -2
- package/studio/web/assets/{profile-7bu_CF1f.js.map → profile-CaF-4aZe.js.map} +1 -1
- package/studio/web/assets/{setComponentFile-MfYm9F94.js → setComponentFile-DLW1DHCt.js} +2 -2
- package/studio/web/assets/{setComponentFile-MfYm9F94.js.map → setComponentFile-DLW1DHCt.js.map} +1 -1
- package/studio/web/assets/{setup-SKA4UhdE.js → setup-TGCErIhq.js} +2 -2
- package/studio/web/assets/{setup-SKA4UhdE.js.map → setup-TGCErIhq.js.map} +1 -1
- package/studio/web/assets/{status-DetVLUxR.js → status-DG0Maoao.js} +2 -2
- package/studio/web/assets/{status-DetVLUxR.js.map → status-DG0Maoao.js.map} +1 -1
- package/studio/web/assets/{swagger-ui-react-DLeYARY2.js → swagger-ui-react-8T4SgQ1m.js} +2 -2
- package/studio/web/assets/{swagger-ui-react-DLeYARY2.js.map → swagger-ui-react-8T4SgQ1m.js.map} +1 -1
- package/studio/web/assets/{tsMode-DGO-jIF7.js → tsMode-DJ6Sl24Q.js} +2 -2
- package/studio/web/assets/{tsMode-DGO-jIF7.js.map → tsMode-DJ6Sl24Q.js.map} +1 -1
- package/studio/web/assets/{useEntityRestURL-4M2i6bo4.js → useEntityRestURL-JO2mfWTQ.js} +2 -2
- package/studio/web/assets/{useEntityRestURL-4M2i6bo4.js.map → useEntityRestURL-JO2mfWTQ.js.map} +1 -1
- package/studio/web/index.html +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Chat-
|
|
2
|
-
import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{a as t,i as n}from"./vendor-datadog-DBn-aOxh.js";import{r}from"./vendor-react-B36dp27u.js";import{a as i,c as a,i as o,l as s,n as c,o as l,r as u,s as d,t as f}from"./react-SMksfEpE.js";import{n as p,t as m}from"./localStorageKeys-D_mgWLDC.js";import{Dt as h,Xt as g}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Chat-Cv_2paZE.js","assets/rolldown-runtime-CNC7AqOf.js","assets/button-i10JPNcp.js","assets/vendor-core-vIXn_E4D.js","assets/vendor-tanstack-Dl75hT33.js","assets/vendor-datadog-DBn-aOxh.js","assets/vendor-react-B36dp27u.js","assets/vendor-ui-Bm4W8wqw.js","assets/createLucideIcon-B49W6uF4.js","assets/react-SMksfEpE.js","assets/x-Bru-nCti.js","assets/setComponentFile-DLW1DHCt.js","assets/index-D_GKOkhn.js","assets/useAuth-BOaK3koG.js","assets/card-hTrVZWnN.js","assets/errorText-NpBmvk9I.js","assets/queryClient-DK1L0t7F.js","assets/localStorageKeys-D_mgWLDC.js","assets/editor.api2-4ndOupAA.js","assets/editor-Br_kD0ds.css","assets/index-CgWz0RjY.css","assets/useEntityRestURL-JO2mfWTQ.js","assets/getAnalytics-CmXDoq4g.js","assets/Chat-B-7kW9XZ.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{a as t,i as n}from"./vendor-datadog-DBn-aOxh.js";import{r}from"./vendor-react-B36dp27u.js";import{a as i,c as a,i as o,l as s,n as c,o as l,r as u,s as d,t as f}from"./react-SMksfEpE.js";import{n as p,t as m}from"./localStorageKeys-D_mgWLDC.js";import{Dt as h,Xt as g}from"./index-D_GKOkhn.js";var _=e(t(),1);function v(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function y(...e){return t=>{let n=!1,r=e.map(e=>{let r=v(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():v(e[t],null)}}}}function b(...e){return _.useCallback(y(...e),e)}var x=r(),S=class extends _.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(o(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=o(e)&&e.offsetWidth||0,r=o(e)&&e.offsetHeight||0,i=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=n-a.width-a.left,a.bottom=r-a.height-a.top,a.direction=i.direction}return null}componentDidUpdate(){}render(){return this.props.children}};function C({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:a}){let o=(0,_.useId)(),s=(0,_.useRef)(null),c=(0,_.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:`ltr`}),{nonce:l}=(0,_.useContext)(u),d=b(s,e.props?.ref??e?.ref);return(0,_.useInsertionEffect)(()=>{let{width:e,height:u,top:d,left:f,right:p,bottom:m,direction:h}=c.current;if(t||a===!1||!s.current||!e||!u)return;let g=h===`rtl`,_=n===`left`?g?`right: ${p}`:`left: ${f}`:g?`left: ${f}`:`right: ${p}`,v=r===`bottom`?`bottom: ${m}`:`top: ${d}`;s.current.dataset.motionPopId=o;let y=document.createElement(`style`);l&&(y.nonce=l);let b=i??document.head;return b.appendChild(y),y.sheet&&y.sheet.insertRule(`
|
|
3
3
|
[data-motion-pop-id="${o}"] {
|
|
4
4
|
position: absolute !important;
|
|
5
5
|
width: ${e}px !important;
|
|
@@ -7,7 +7,7 @@ import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{a as t,i as n}from"./v
|
|
|
7
7
|
${_}px !important;
|
|
8
8
|
${v}px !important;
|
|
9
9
|
}
|
|
10
|
-
`),()=>{s.current?.removeAttribute(`data-motion-pop-id`),b.contains(y)&&b.removeChild(y)}},[t]),(0,x.jsx)(S,{isPresent:t,childRef:s,sizeRef:c,pop:a,children:a===!1?e:_.cloneElement(e,{ref:d})})}var w=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:a,presenceAffectsLayout:o,mode:s,anchorX:c,anchorY:u,root:f})=>{let p=d(T),m=(0,_.useId)(),h=(0,_.useRef)(n),g=(0,_.useRef)(r);l(()=>{h.current=n,g.current=r});let v=!0,y=(0,_.useMemo)(()=>(v=!1,{id:m,initial:t,isPresent:n,custom:a,onExitComplete:e=>{p.set(e,!0);for(let e of p.values())if(!e)return;r&&r()},register:e=>(p.set(e,!1),()=>{p.delete(e),!h.current&&!p.size&&g.current?.()})}),[n,p,r]);return o&&v&&(y={...y}),(0,_.useMemo)(()=>{p.forEach((e,t)=>p.set(t,!1))},[n]),_.useEffect(()=>{!n&&!p.size&&r&&r()},[n]),e=(0,x.jsx)(C,{pop:s===`popLayout`,isPresent:n,anchorX:c,anchorY:u,root:f,children:e}),(0,x.jsx)(i.Provider,{value:y,children:e})};function T(){return new Map}var E=e=>e.key||``;function D(e){let t=[];return _.Children.forEach(e,e=>{(0,_.isValidElement)(e)&&t.push(e)}),t}var O=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:o=`sync`,propagate:s=!1,anchorX:u=`left`,anchorY:f=`top`,root:p})=>{let[m,h]=c(s),g=(0,_.useMemo)(()=>D(e),[e]),v=s&&!m?[]:g.map(E),y=(0,_.useRef)(!0),b=(0,_.useRef)(g),S=d(()=>new Map),C=(0,_.useRef)(new Set),[T,O]=(0,_.useState)(g),[k,A]=(0,_.useState)(g);l(()=>{y.current=!1,b.current=g;for(let e=0;e<k.length;e++){let t=E(k[e]);v.includes(t)?(S.delete(t),C.current.delete(t)):S.get(t)!==!0&&S.set(t,!1)}},[k,v.length,v.join(`-`)]);let j=[];if(g!==T){let e=[...g];for(let t=0;t<k.length;t++){let n=k[t],r=E(n);v.includes(r)||(e.splice(t,0,n),j.push(n))}return o===`wait`&&j.length&&(e=j),A(D(e)),O(g),null}let{forceRender:M}=(0,_.useContext)(a);return(0,x.jsx)(x.Fragment,{children:k.map(e=>{let a=E(e),c=s&&!m?!1:g===k||v.includes(a);return(0,x.jsx)(w,{isPresent:c,initial:!y.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:o,root:p,onExitComplete:c?void 0:()=>{if(C.current.has(a))return;if(S.has(a))C.current.add(a),S.set(a,!0);else return;let e=!0;S.forEach(t=>{t||(e=!1)}),e&&(M?.(),A(b.current),s&&h?.(),r&&r())},anchorX:u,anchorY:f,children:e},a)})})},k=(0,_.lazy)(()=>n(()=>import(`./Chat-
|
|
10
|
+
`),()=>{s.current?.removeAttribute(`data-motion-pop-id`),b.contains(y)&&b.removeChild(y)}},[t]),(0,x.jsx)(S,{isPresent:t,childRef:s,sizeRef:c,pop:a,children:a===!1?e:_.cloneElement(e,{ref:d})})}var w=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:a,presenceAffectsLayout:o,mode:s,anchorX:c,anchorY:u,root:f})=>{let p=d(T),m=(0,_.useId)(),h=(0,_.useRef)(n),g=(0,_.useRef)(r);l(()=>{h.current=n,g.current=r});let v=!0,y=(0,_.useMemo)(()=>(v=!1,{id:m,initial:t,isPresent:n,custom:a,onExitComplete:e=>{p.set(e,!0);for(let e of p.values())if(!e)return;r&&r()},register:e=>(p.set(e,!1),()=>{p.delete(e),!h.current&&!p.size&&g.current?.()})}),[n,p,r]);return o&&v&&(y={...y}),(0,_.useMemo)(()=>{p.forEach((e,t)=>p.set(t,!1))},[n]),_.useEffect(()=>{!n&&!p.size&&r&&r()},[n]),e=(0,x.jsx)(C,{pop:s===`popLayout`,isPresent:n,anchorX:c,anchorY:u,root:f,children:e}),(0,x.jsx)(i.Provider,{value:y,children:e})};function T(){return new Map}var E=e=>e.key||``;function D(e){let t=[];return _.Children.forEach(e,e=>{(0,_.isValidElement)(e)&&t.push(e)}),t}var O=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:o=`sync`,propagate:s=!1,anchorX:u=`left`,anchorY:f=`top`,root:p})=>{let[m,h]=c(s),g=(0,_.useMemo)(()=>D(e),[e]),v=s&&!m?[]:g.map(E),y=(0,_.useRef)(!0),b=(0,_.useRef)(g),S=d(()=>new Map),C=(0,_.useRef)(new Set),[T,O]=(0,_.useState)(g),[k,A]=(0,_.useState)(g);l(()=>{y.current=!1,b.current=g;for(let e=0;e<k.length;e++){let t=E(k[e]);v.includes(t)?(S.delete(t),C.current.delete(t)):S.get(t)!==!0&&S.set(t,!1)}},[k,v.length,v.join(`-`)]);let j=[];if(g!==T){let e=[...g];for(let t=0;t<k.length;t++){let n=k[t],r=E(n);v.includes(r)||(e.splice(t,0,n),j.push(n))}return o===`wait`&&j.length&&(e=j),A(D(e)),O(g),null}let{forceRender:M}=(0,_.useContext)(a);return(0,x.jsx)(x.Fragment,{children:k.map(e=>{let a=E(e),c=s&&!m?!1:g===k||v.includes(a);return(0,x.jsx)(w,{isPresent:c,initial:!y.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:o,root:p,onExitComplete:c?void 0:()=>{if(C.current.has(a))return;if(S.has(a))C.current.add(a),S.set(a,!0);else return;let e=!0;S.forEach(t=>{t||(e=!1)}),e&&(M?.(),A(b.current),s&&h?.(),r&&r())},anchorX:u,anchorY:f,children:e},a)})})},k=(0,_.lazy)(()=>n(()=>import(`./Chat-Cv_2paZE.js`).then(e=>({default:e.Chat})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]))),A=56,j=24;function M(){let[e,t]=(0,_.useState)(!1),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(!1),[o,c]=h(`ApplicationChatOpen`,!1),[l,u]=p(m.ApplicationChatPosition,{x:-40,y:-40}),[d,v]=p(m.ApplicationChatWidth,600),y=(0,_.useRef)(null);(0,_.useEffect)(()=>{let e=()=>{let e=window.innerWidth<768;t(e),!e&&d>window.innerWidth&&v(window.innerWidth)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[d,v]);let b=(0,_.useCallback)(e=>{e.preventDefault(),a(!0)},[]);(0,_.useEffect)(()=>{if(!i)return;let e=e=>{let t=window.innerWidth-e.clientX,n=Math.min(Math.max(t,300),window.innerWidth);v(n)},t=()=>{a(!1)};return window.addEventListener(`mousemove`,e),window.addEventListener(`mouseup`,t),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}},[i,v]);let S=(0,_.useCallback)(()=>{n||c(e=>!e)},[n]),C=(0,_.useCallback)(()=>{c(!1)},[]);return(0,_.useEffect)(()=>{if(o){let e=e=>{e.key===`Escape`&&C()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}},[o,C]),(0,x.jsxs)(`div`,{className:`fixed inset-0 pointer-events-none z-50`,ref:y,children:[(0,x.jsx)(O,{children:o&&(0,x.jsxs)(f.div,{initial:e?{opacity:0,y:`100%`}:{opacity:0,x:`100%`},animate:e?{opacity:1,y:0}:{opacity:1,x:0},exit:e?{opacity:0,y:`100%`}:{opacity:0,x:`100%`},transition:{type:`spring`,damping:25,stiffness:200},style:e?{}:{top:0,bottom:0,right:0,width:d,maxWidth:`100vw`},className:`
|
|
11
11
|
pointer-events-auto
|
|
12
12
|
fixed bg-background shadow-2xl border-l border-border overflow-visible
|
|
13
13
|
${e?`inset-0 w-full h-full rounded-none`:`h-full`}
|
|
@@ -21,4 +21,4 @@ import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{a as t,i as n}from"./v
|
|
|
21
21
|
text-primary-foreground shadow-lg flex items-center justify-center cursor-pointer
|
|
22
22
|
hover:bg-primary/90 transition-colors
|
|
23
23
|
`,children:(0,x.jsx)(s,{size:28})})]})}export{M as FloatingChat};
|
|
24
|
-
//# sourceMappingURL=FloatingChat-
|
|
24
|
+
//# sourceMappingURL=FloatingChat-CPyPIcVR.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":";+WASA,SAAS,EAAO,EAAK,EAAO,CACxB,GAAI,OAAO,GAAQ,WACf,OAAO,EAAI,CAAK,EAEX,GAAQ,OACb,EAAI,QAAU,EAEtB,CAKA,SAAS,EAAY,GAAG,EAAM,CAC1B,MAAQ,IAAS,CACb,IAAI,EAAa,GACX,EAAW,EAAK,IAAK,GAAQ,CAC/B,IAAM,EAAU,EAAO,EAAK,CAAI,EAIhC,MAHI,CAAC,GAAc,OAAO,GAAY,aAClC,EAAa,IAEV,CACX,CAAC,EAKD,GAAI,EACA,UAAa,CACT,IAAK,IAAI,EAAI,EAAG,EAAI,EAAS,OAAQ,IAAK,CACtC,IAAM,EAAU,EAAS,GACrB,OAAO,GAAY,WACnB,EAAQ,EAGR,EAAO,EAAK,GAAI,IAAI,CAE5B,CACJ,CAER,CACJ,CAKA,SAAS,EAAgB,GAAG,EAAM,CAE9B,SAAa,YAAY,EAAY,GAAG,CAAI,EAAG,CAAI,CACvD,WC7CM,EAAN,gBAAoC,SAAU,CAC1C,wBAAwB,EAAW,CAC/B,IAAM,EAAU,KAAK,MAAM,SAAS,QACpC,G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AAI,IAC5D,EAAc,EAAI,CAEpB,EAmGI,WAjGmB,EAAa,IAAc,CAOjD,GAJA,eAAiB,CAChB,EAAc,EAAK,CACpB,EAAG,GAAG,EAEF,EAAY,OAEhB,GAAM,CAAE,aAAY,eAAgB,OAI9B,EAAO,EAAS,EAAI,EAAK,OAAO,EAChC,EAAO,EAAS,EAAI,EAAK,OAAO,EAIhC,EAAW,EAAK,MAAM,EACtB,EAAY,EAAa,EAAK,MAAM,EACpC,EAAU,EAAK,MAAM,EACrB,EAAa,EAAc,EAAK,MAAM,EAExC,EAAQ,EACR,EAAQ,EAGR,EAAW,IAEd,EAAQ,EAAE,EAAa,EAAc,EAAU,GACrC,EAAY,MAEtB,EAAQ,GAGL,EAAU,IAEb,EAAQ,EAAE,EAAc,EAAc,EAAU,GACtC,EAAa,MAEvB,EAAQ,GAGT,EAAY,CACX,EAAG,EACH,EAAG,CACJ,CAAC,CACF,EAmDI,QAAS,CAAE,EAAG,EAAS,EAAG,EAAG,EAAS,CAAE,EACxC,WAAY,CAAE,MAAO,GAAI,EACzB,SAAU,CAAE,MAAO,EAAI,EACvB,QAAS,EACT,MAAO,CACN,OAAQ,EACR,MAAO,CACR,EACA,UAAU;;;;;iBAOV,SAAC,EAAD,CAAK,KAAM,EAAK,EACF,EAEZ,GAEP","names":["Fragment"],"ignoreList":[0,1,2,3,4],"sources":["../../node_modules/.pnpm/framer-motion@12.42.2_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/framer-motion/dist/es/utils/use-composed-ref.mjs","../../node_modules/.pnpm/framer-motion@12.42.2_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs","../../node_modules/.pnpm/framer-motion@12.42.2_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs","../../node_modules/.pnpm/framer-motion@12.42.2_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/framer-motion/dist/es/components/AnimatePresence/utils.mjs","../../node_modules/.pnpm/framer-motion@12.42.2_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs","../../src/features/instance/applications/components/Chat/FloatingChat.tsx"],"sourcesContent":["import * as React from 'react';\n\n/**\n * Taken from https://github.com/radix-ui/primitives/blob/main/packages/react/compose-refs/src/compose-refs.tsx\n */\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef(ref, value) {\n if (typeof ref === \"function\") {\n return ref(value);\n }\n else if (ref !== null && ref !== undefined) {\n ref.current = value;\n }\n}\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs(...refs) {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup === \"function\") {\n hasCleanup = true;\n }\n return cleanup;\n });\n // React <19 will log an error to the console if a callback ref returns a\n // value. We don't use ref cleanups internally so this will only happen if a\n // user's ref callback returns a value, which we only expect if they are\n // using the cleanup functionality added in React 19.\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup === \"function\") {\n cleanup();\n }\n else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs(...refs) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { useComposedRefs };\n//# sourceMappingURL=use-composed-ref.mjs.map\n","\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport { isHTMLElement } from 'motion-dom';\nimport * as React from 'react';\nimport { useId, useRef, useContext, useInsertionEffect } from 'react';\nimport { MotionConfigContext } from '../../context/MotionConfigContext.mjs';\nimport { useComposedRefs } from '../../utils/use-composed-ref.mjs';\n\n/**\n * Measurement functionality has to be within a separate component\n * to leverage snapshot lifecycle.\n */\nclass PopChildMeasure extends React.Component {\n getSnapshotBeforeUpdate(prevProps) {\n const element = this.props.childRef.current;\n if (isHTMLElement(element) && prevProps.isPresent && !this.props.isPresent && this.props.pop !== false) {\n const parent = element.offsetParent;\n const parentWidth = isHTMLElement(parent)\n ? parent.offsetWidth || 0\n : 0;\n const parentHeight = isHTMLElement(parent)\n ? parent.offsetHeight || 0\n : 0;\n const computedStyle = getComputedStyle(element);\n const size = this.props.sizeRef.current;\n size.height = parseFloat(computedStyle.height);\n size.width = parseFloat(computedStyle.width);\n size.top = element.offsetTop;\n size.left = element.offsetLeft;\n size.right = parentWidth - size.width - size.left;\n size.bottom = parentHeight - size.height - size.top;\n size.direction = computedStyle.direction;\n }\n return null;\n }\n /**\n * Required with getSnapshotBeforeUpdate to stop React complaining.\n */\n componentDidUpdate() { }\n render() {\n return this.props.children;\n }\n}\nfunction PopChild({ children, isPresent, anchorX, anchorY, root, pop }) {\n const id = useId();\n const ref = useRef(null);\n const size = useRef({\n width: 0,\n height: 0,\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n direction: \"ltr\",\n });\n const { nonce } = useContext(MotionConfigContext);\n /**\n * In React 19, refs are passed via props.ref instead of element.ref.\n * We check props.ref first (React 19) and fall back to element.ref (React 18).\n */\n const childRef = children.props?.ref ??\n children?.ref;\n const composedRef = useComposedRefs(ref, childRef);\n /**\n * We create and inject a style block so we can apply this explicit\n * sizing in a non-destructive manner by just deleting the style block.\n *\n * We can't apply size via render as the measurement happens\n * in getSnapshotBeforeUpdate (post-render), likewise if we apply the\n * styles directly on the DOM node, we might be overwriting\n * styles set via the style prop.\n */\n useInsertionEffect(() => {\n const { width, height, top, left, right, bottom, direction } = size.current;\n if (isPresent || pop === false || !ref.current || !width || !height)\n return;\n const isRTL = direction === \"rtl\";\n const x = anchorX === \"left\"\n ? (isRTL ? `right: ${right}` : `left: ${left}`)\n : (isRTL ? `left: ${left}` : `right: ${right}`);\n const y = anchorY === \"bottom\" ? `bottom: ${bottom}` : `top: ${top}`;\n ref.current.dataset.motionPopId = id;\n const style = document.createElement(\"style\");\n if (nonce)\n style.nonce = nonce;\n const parent = root ?? document.head;\n parent.appendChild(style);\n if (style.sheet) {\n style.sheet.insertRule(`\n [data-motion-pop-id=\"${id}\"] {\n position: absolute !important;\n width: ${width}px !important;\n height: ${height}px !important;\n ${x}px !important;\n ${y}px !important;\n }\n `);\n }\n return () => {\n ref.current?.removeAttribute(\"data-motion-pop-id\");\n if (parent.contains(style)) {\n parent.removeChild(style);\n }\n };\n }, [isPresent]);\n return (jsx(PopChildMeasure, { isPresent: isPresent, childRef: ref, sizeRef: size, pop: pop, children: pop === false\n ? children\n : React.cloneElement(children, { ref: composedRef }) }));\n}\n\nexport { PopChild };\n//# sourceMappingURL=PopChild.mjs.map\n","\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport * as React from 'react';\nimport { useId, useRef, useMemo } from 'react';\nimport { PresenceContext } from '../../context/PresenceContext.mjs';\nimport { useConstant } from '../../utils/use-constant.mjs';\nimport { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';\nimport { PopChild } from './PopChild.mjs';\n\nconst PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, presenceAffectsLayout, mode, anchorX, anchorY, root }) => {\n const presenceChildren = useConstant(newChildrenMap);\n const id = useId();\n // Written in a layout effect (not render) so discarded concurrent\n // renders can't leave the refs pointing at uncommitted state.\n const isPresentRef = useRef(isPresent);\n const onExitCompleteRef = useRef(onExitComplete);\n useIsomorphicLayoutEffect(() => {\n isPresentRef.current = isPresent;\n onExitCompleteRef.current = onExitComplete;\n });\n let isReusedContext = true;\n let context = useMemo(() => {\n isReusedContext = false;\n return {\n id,\n initial,\n isPresent,\n custom,\n onExitComplete: (childId) => {\n presenceChildren.set(childId, true);\n for (const isComplete of presenceChildren.values()) {\n if (!isComplete)\n return; // can stop searching when any is incomplete\n }\n onExitComplete && onExitComplete();\n },\n register: (childId) => {\n presenceChildren.set(childId, false);\n return () => {\n presenceChildren.delete(childId);\n !isPresentRef.current &&\n !presenceChildren.size &&\n onExitCompleteRef.current?.();\n };\n },\n };\n }, [isPresent, presenceChildren, onExitComplete]);\n /**\n * If the presence of a child affects the layout of the components around it,\n * we want to make a new context value to ensure they get re-rendered\n * so they can detect that layout change.\n */\n if (presenceAffectsLayout && isReusedContext) {\n context = { ...context };\n }\n useMemo(() => {\n presenceChildren.forEach((_, key) => presenceChildren.set(key, false));\n }, [isPresent]);\n /**\n * If there's no `motion` components to fire exit animations, we want to remove this\n * component immediately.\n */\n React.useEffect(() => {\n !isPresent &&\n !presenceChildren.size &&\n onExitComplete &&\n onExitComplete();\n }, [isPresent]);\n children = (jsx(PopChild, { pop: mode === \"popLayout\", isPresent: isPresent, anchorX: anchorX, anchorY: anchorY, root: root, children: children }));\n return (jsx(PresenceContext.Provider, { value: context, children: children }));\n};\nfunction newChildrenMap() {\n return new Map();\n}\n\nexport { PresenceChild };\n//# sourceMappingURL=PresenceChild.mjs.map\n","import { Children, isValidElement } from 'react';\n\nconst getChildKey = (child) => child.key || \"\";\nfunction onlyElements(children) {\n const filtered = [];\n // We use forEach here instead of map as map mutates the component key by preprending `.$`\n Children.forEach(children, (child) => {\n if (isValidElement(child))\n filtered.push(child);\n });\n return filtered;\n}\n\nexport { getChildKey, onlyElements };\n//# sourceMappingURL=utils.mjs.map\n","\"use client\";\nimport { jsx, Fragment } from 'react/jsx-runtime';\nimport { useMemo, useRef, useState, useContext } from 'react';\nimport { LayoutGroupContext } from '../../context/LayoutGroupContext.mjs';\nimport { useConstant } from '../../utils/use-constant.mjs';\nimport { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';\nimport { PresenceChild } from './PresenceChild.mjs';\nimport { usePresence } from './use-presence.mjs';\nimport { onlyElements, getChildKey } from './utils.mjs';\n\n/**\n * `AnimatePresence` enables the animation of components that have been removed from the tree.\n *\n * When adding/removing more than a single child, every child **must** be given a unique `key` prop.\n *\n * Any `motion` components that have an `exit` property defined will animate out when removed from\n * the tree.\n *\n * ```jsx\n * import { motion, AnimatePresence } from 'framer-motion'\n *\n * export const Items = ({ items }) => (\n * <AnimatePresence>\n * {items.map(item => (\n * <motion.div\n * key={item.id}\n * initial={{ opacity: 0 }}\n * animate={{ opacity: 1 }}\n * exit={{ opacity: 0 }}\n * />\n * ))}\n * </AnimatePresence>\n * )\n * ```\n *\n * You can sequence exit animations throughout a tree using variants.\n *\n * If a child contains multiple `motion` components with `exit` props, it will only unmount the child\n * once all `motion` components have finished animating out. Likewise, any components using\n * `usePresence` all need to call `safeToRemove`.\n *\n * @public\n */\nconst AnimatePresence = ({ children, custom, initial = true, onExitComplete, presenceAffectsLayout = true, mode = \"sync\", propagate = false, anchorX = \"left\", anchorY = \"top\", root }) => {\n const [isParentPresent, safeToRemove] = usePresence(propagate);\n /**\n * Filter any children that aren't ReactElements. We can only track components\n * between renders with a props.key.\n */\n const presentChildren = useMemo(() => onlyElements(children), [children]);\n /**\n * Track the keys of the currently rendered children. This is used to\n * determine which children are exiting.\n */\n const presentKeys = propagate && !isParentPresent ? [] : presentChildren.map(getChildKey);\n /**\n * If `initial={false}` we only want to pass this to components in the first render.\n */\n const isInitialRender = useRef(true);\n /**\n * A ref containing the currently present children. When all exit animations\n * are complete, we use this to re-render the component with the latest children\n * *committed* rather than the latest children *rendered*.\n */\n const pendingPresentChildren = useRef(presentChildren);\n /**\n * Track which exiting children have finished animating out.\n */\n const exitComplete = useConstant(() => new Map());\n /**\n * Track which components are currently processing exit to prevent duplicate processing.\n */\n const exitingComponents = useRef(new Set());\n /**\n * Save children to render as React state. To ensure this component is concurrent-safe,\n * we check for exiting children via an effect.\n */\n const [diffedChildren, setDiffedChildren] = useState(presentChildren);\n const [renderedChildren, setRenderedChildren] = useState(presentChildren);\n useIsomorphicLayoutEffect(() => {\n isInitialRender.current = false;\n pendingPresentChildren.current = presentChildren;\n /**\n * Update complete status of exiting children.\n */\n for (let i = 0; i < renderedChildren.length; i++) {\n const key = getChildKey(renderedChildren[i]);\n if (!presentKeys.includes(key)) {\n if (exitComplete.get(key) !== true) {\n exitComplete.set(key, false);\n }\n }\n else {\n exitComplete.delete(key);\n exitingComponents.current.delete(key);\n }\n }\n }, [renderedChildren, presentKeys.length, presentKeys.join(\"-\")]);\n const exitingChildren = [];\n if (presentChildren !== diffedChildren) {\n let nextChildren = [...presentChildren];\n /**\n * Loop through all the currently rendered components and decide which\n * are exiting.\n */\n for (let i = 0; i < renderedChildren.length; i++) {\n const child = renderedChildren[i];\n const key = getChildKey(child);\n if (!presentKeys.includes(key)) {\n nextChildren.splice(i, 0, child);\n exitingChildren.push(child);\n }\n }\n /**\n * If we're in \"wait\" mode, and we have exiting children, we want to\n * only render these until they've all exited.\n */\n if (mode === \"wait\" && exitingChildren.length) {\n nextChildren = exitingChildren;\n }\n setRenderedChildren(onlyElements(nextChildren));\n setDiffedChildren(presentChildren);\n /**\n * Early return to ensure once we've set state with the latest diffed\n * children, we can immediately re-render.\n */\n return null;\n }\n if (process.env.NODE_ENV !== \"production\" &&\n mode === \"wait\" &&\n renderedChildren.length > 1) {\n console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to \"wait\". This will lead to odd visual behaviour.`);\n }\n /**\n * If we've been provided a forceRender function by the LayoutGroupContext,\n * we can use it to force a re-render amongst all surrounding components once\n * all components have finished animating out.\n */\n const { forceRender } = useContext(LayoutGroupContext);\n return (jsx(Fragment, { children: renderedChildren.map((child) => {\n const key = getChildKey(child);\n const isPresent = propagate && !isParentPresent\n ? false\n : presentChildren === renderedChildren ||\n presentKeys.includes(key);\n const onExit = () => {\n if (exitingComponents.current.has(key)) {\n return;\n }\n if (exitComplete.has(key)) {\n exitingComponents.current.add(key);\n exitComplete.set(key, true);\n }\n else {\n return;\n }\n let isEveryExitComplete = true;\n exitComplete.forEach((isExitComplete) => {\n if (!isExitComplete)\n isEveryExitComplete = false;\n });\n if (isEveryExitComplete) {\n forceRender?.();\n setRenderedChildren(pendingPresentChildren.current);\n propagate && safeToRemove?.();\n onExitComplete && onExitComplete();\n }\n };\n return (jsx(PresenceChild, { isPresent: isPresent, initial: !isInitialRender.current || initial\n ? undefined\n : false, custom: custom, presenceAffectsLayout: presenceAffectsLayout, mode: mode, root: root, onExitComplete: isPresent ? undefined : onExit, anchorX: anchorX, anchorY: anchorY, children: child }, key));\n }) }));\n};\n\nexport { AnimatePresence };\n//# sourceMappingURL=index.mjs.map\n","import { Loading } from '@/components/Loading';\nimport { useLocalStorage } from '@/hooks/useLocalStorage';\nimport { useSessionStorage } from '@/hooks/useSessionStorage';\nimport { LocalStorageKeys } from '@/lib/storage/localStorageKeys';\nimport { Bot } from 'lucide-react';\nimport { AnimatePresence, motion } from 'motion/react';\nimport { lazy, Suspense, useCallback, useEffect, useRef, useState } from 'react';\n\n// Second-tier lazy load: this file (the floating bubble) loads when you land on\n// an instance, but the chat pane — and its heavy dependencies (the AI SDK, the\n// chat tools, the markdown message renderer) — only loads the first time the\n// bubble is opened.\nconst Chat = lazy(() => import('./index').then((m) => ({ default: m.Chat })));\n\nconst BUBBLE_SIZE = 56;\nconst PADDING = 24;\n\nexport function FloatingChat() {\n\tconst [isMobile, setIsMobile] = useState(false);\n\tconst [isDragging, setIsDragging] = useState(false);\n\tconst [isResizing, setIsResizing] = useState(false);\n\tconst [isOpen, setIsOpen] = useSessionStorage('ApplicationChatOpen', false);\n\tconst [position, setPosition] = useLocalStorage(LocalStorageKeys.ApplicationChatPosition, { x: -40, y: -40 });\n\tconst [width, setWidth] = useLocalStorage(LocalStorageKeys.ApplicationChatWidth, 600);\n\tconst containerRef = useRef<HTMLDivElement>(null);\n\n\tuseEffect(() => {\n\t\tconst checkMobile = () => {\n\t\t\tconst mobile = window.innerWidth < 768;\n\t\t\tsetIsMobile(mobile);\n\t\t\tif (!mobile && width > window.innerWidth) {\n\t\t\t\tsetWidth(window.innerWidth);\n\t\t\t}\n\t\t};\n\t\tcheckMobile();\n\t\twindow.addEventListener('resize', checkMobile);\n\t\treturn () => window.removeEventListener('resize', checkMobile);\n\t}, [width, setWidth]);\n\n\tconst handleResizeStart = useCallback((e: React.MouseEvent) => {\n\t\te.preventDefault();\n\t\tsetIsResizing(true);\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (!isResizing) { return; }\n\n\t\tconst handleMouseMove = (e: MouseEvent) => {\n\t\t\tconst newWidth = window.innerWidth - e.clientX;\n\t\t\tconst clampedWidth = Math.min(Math.max(newWidth, 300), window.innerWidth);\n\t\t\tsetWidth(clampedWidth);\n\t\t};\n\n\t\tconst handleMouseUp = () => {\n\t\t\tsetIsResizing(false);\n\t\t};\n\n\t\twindow.addEventListener('mousemove', handleMouseMove);\n\t\twindow.addEventListener('mouseup', handleMouseUp);\n\t\treturn () => {\n\t\t\twindow.removeEventListener('mousemove', handleMouseMove);\n\t\t\twindow.removeEventListener('mouseup', handleMouseUp);\n\t\t};\n\t}, [isResizing, setWidth]);\n\n\tconst toggleChat = useCallback(() => {\n\t\tif (isDragging) { return; }\n\t\tsetIsOpen(prev => !prev);\n\t}, [isDragging]);\n\n\tconst closeChat = useCallback(() => {\n\t\tsetIsOpen(false);\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (isOpen) {\n\t\t\tconst handleEscape = (e: KeyboardEvent) => {\n\t\t\t\tif (e.key === 'Escape') {\n\t\t\t\t\tcloseChat();\n\t\t\t\t}\n\t\t\t};\n\t\t\twindow.addEventListener('keydown', handleEscape);\n\t\t\treturn () => window.removeEventListener('keydown', handleEscape);\n\t\t}\n\t}, [isOpen, closeChat]);\n\n\tconst handleDragStart = () => {\n\t\tsetIsDragging(false);\n\t};\n\n\tconst handleDrag = (_event: any, info: any) => {\n\t\t// If the user has moved the pointer more than 5px, consider it a drag\n\t\tif (Math.abs(info.offset.x) > 5 || Math.abs(info.offset.y) > 5) {\n\t\t\tsetIsDragging(true);\n\t\t}\n\t};\n\n\tconst handleDragEnd = (_event: any, info: any) => {\n\t\t// Small delay to ensure the click handler (which fires after dragEnd)\n\t\t// can still see the isDragging = true state.\n\t\tsetTimeout(() => {\n\t\t\tsetIsDragging(false);\n\t\t}, 100);\n\n\t\tif (isMobile) { return; }\n\n\t\tconst { innerWidth, innerHeight } = window;\n\n\t\t// Calculate new offsets based on where we started and how far we dragged.\n\t\t// x and y in position are offsets from the initial bottom-right (PADDING, PADDING)\n\t\tconst newX = position.x + info.offset.x;\n\t\tconst newY = position.y + info.offset.y;\n\n\t\t// We still want snapping if it's close to the screen edge.\n\t\t// info.point is absolute screen coordinates of the pointer.\n\t\tconst distLeft = info.point.x;\n\t\tconst distRight = innerWidth - info.point.x;\n\t\tconst distTop = info.point.y;\n\t\tconst distBottom = innerHeight - info.point.y;\n\n\t\tlet snapX = newX;\n\t\tlet snapY = newY;\n\n\t\tconst threshold = 100;\n\t\tif (distLeft < threshold) {\n\t\t\t// Snap to left: x offset should be -(innerWidth - BUBBLE_SIZE - PADDING * 2)\n\t\t\tsnapX = -(innerWidth - BUBBLE_SIZE - PADDING * 2);\n\t\t} else if (distRight < threshold) {\n\t\t\t// Snap to right: x offset should be 0\n\t\t\tsnapX = 0;\n\t\t}\n\n\t\tif (distTop < threshold) {\n\t\t\t// Snap to top: y offset should be -(innerHeight - BUBBLE_SIZE - PADDING * 2)\n\t\t\tsnapY = -(innerHeight - BUBBLE_SIZE - PADDING * 2);\n\t\t} else if (distBottom < threshold) {\n\t\t\t// Snap to bottom: y offset should be 0\n\t\t\tsnapY = 0;\n\t\t}\n\n\t\tsetPosition({\n\t\t\tx: snapX,\n\t\t\ty: snapY,\n\t\t});\n\t};\n\n\treturn (\n\t\t<div className=\"fixed inset-0 pointer-events-none z-50\" ref={containerRef}>\n\t\t\t<AnimatePresence>\n\t\t\t\t{isOpen && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tinitial={isMobile ? { opacity: 0, y: '100%' } : { opacity: 0, x: '100%' }}\n\t\t\t\t\t\tanimate={isMobile ? { opacity: 1, y: 0 } : { opacity: 1, x: 0 }}\n\t\t\t\t\t\texit={isMobile ? { opacity: 0, y: '100%' } : { opacity: 0, x: '100%' }}\n\t\t\t\t\t\ttransition={{ type: 'spring', damping: 25, stiffness: 200 }}\n\t\t\t\t\t\tstyle={!isMobile\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\t\t\tbottom: 0,\n\t\t\t\t\t\t\t\tright: 0,\n\t\t\t\t\t\t\t\twidth,\n\t\t\t\t\t\t\t\tmaxWidth: '100vw',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {}}\n\t\t\t\t\t\tclassName={`\n\t\t\t\t\t\t\tpointer-events-auto\n\t\t\t\t\t\t\tfixed bg-background shadow-2xl border-l border-border overflow-visible\n\t\t\t\t\t\t\t${isMobile ? 'inset-0 w-full h-full rounded-none' : 'h-full'}\n\t\t\t\t\t\t`}\n\t\t\t\t\t>\n\t\t\t\t\t\t{!isMobile && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tonMouseDown={handleResizeStart}\n\t\t\t\t\t\t\t\tclassName={`\n\t\t\t\t\t\t\t\t\tabsolute left-0 top-0 bottom-0 w-1 cursor-ew-resize\n\t\t\t\t\t\t\t\t\thover:bg-primary transition-colors z-50\n\t\t\t\t\t\t\t\t\t${isResizing ? 'bg-primary' : ''}\n\t\t\t\t\t\t\t\t`}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<Suspense fallback={<Loading centered text=\"Loading chat…\" />}>\n\t\t\t\t\t\t\t<Chat autoFocus closeChat={closeChat} />\n\t\t\t\t\t\t</Suspense>\n\t\t\t\t\t</motion.div>\n\t\t\t\t)}\n\t\t\t</AnimatePresence>\n\n\t\t\t{!isOpen && (\n\t\t\t\t<motion.button\n\t\t\t\t\tdrag\n\t\t\t\t\tdragMomentum={false}\n\t\t\t\t\tdragConstraints={containerRef}\n\t\t\t\t\tonDragStart={handleDragStart}\n\t\t\t\t\tonDrag={handleDrag}\n\t\t\t\t\tonDragEnd={handleDragEnd}\n\t\t\t\t\tinitial={{ x: position.x, y: position.y }}\n\t\t\t\t\twhileHover={{ scale: 1.1 }}\n\t\t\t\t\twhileTap={{ scale: 0.9 }}\n\t\t\t\t\tonClick={toggleChat}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tbottom: PADDING,\n\t\t\t\t\t\tright: PADDING,\n\t\t\t\t\t}}\n\t\t\t\t\tclassName=\"\n\t\t\t\t\t\tpointer-events-auto\n\t\t\t\t\t\tfixed w-14 h-14 rounded-full bg-primary\n\t\t\t\t\t\ttext-primary-foreground shadow-lg flex items-center justify-center cursor-pointer\n\t\t\t\t\t\thover:bg-primary/90 transition-colors\n\t\t\t\t\t\"\n\t\t\t\t>\n\t\t\t\t\t<Bot size={28} />\n\t\t\t\t</motion.button>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n"],"file":"FloatingChat-DGUC3L4r.js"}
|
|
1
|
+
{"version":3,"mappings":";+WASA,SAAS,EAAO,EAAK,EAAO,CACxB,GAAI,OAAO,GAAQ,WACf,OAAO,EAAI,CAAK,EAEX,GAAQ,OACb,EAAI,QAAU,EAEtB,CAKA,SAAS,EAAY,GAAG,EAAM,CAC1B,MAAQ,IAAS,CACb,IAAI,EAAa,GACX,EAAW,EAAK,IAAK,GAAQ,CAC/B,IAAM,EAAU,EAAO,EAAK,CAAI,EAIhC,MAHI,CAAC,GAAc,OAAO,GAAY,aAClC,EAAa,IAEV,CACX,CAAC,EAKD,GAAI,EACA,UAAa,CACT,IAAK,IAAI,EAAI,EAAG,EAAI,EAAS,OAAQ,IAAK,CACtC,IAAM,EAAU,EAAS,GACrB,OAAO,GAAY,WACnB,EAAQ,EAGR,EAAO,EAAK,GAAI,IAAI,CAE5B,CACJ,CAER,CACJ,CAKA,SAAS,EAAgB,GAAG,EAAM,CAE9B,SAAa,YAAY,EAAY,GAAG,CAAI,EAAG,CAAI,CACvD,WC7CM,EA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Ac,EAE1C,KAAK,IAAI,EAAK,OAAO,CAAC,EAAI,GAAK,KAAK,IAAI,EAAK,OAAO,CAAC,EAAI,IAC5D,EAAc,EAAI,CAEpB,EAmGI,WAjGmB,EAAa,IAAc,CAOjD,GAJA,eAAiB,CAChB,EAAc,EAAK,CACpB,EAAG,GAAG,EAEF,EAAY,OAEhB,GAAM,CAAE,aAAY,eAAgB,OAI9B,EAAO,EAAS,EAAI,EAAK,OAAO,EAChC,EAAO,EAAS,EAAI,EAAK,OAAO,EAIhC,EAAW,EAAK,MAAM,EACtB,EAAY,EAAa,EAAK,MAAM,EACpC,EAAU,EAAK,MAAM,EACrB,EAAa,EAAc,EAAK,MAAM,EAExC,EAAQ,EACR,EAAQ,EAGR,EAAW,IAEd,EAAQ,EAAE,EAAa,EAAc,EAAU,GACrC,EAAY,MAEtB,EAAQ,GAGL,EAAU,IAEb,EAAQ,EAAE,EAAc,EAAc,EAAU,GACtC,EAAa,MAEvB,EAAQ,GAGT,EAAY,CACX,EAAG,EACH,EAAG,CACJ,CAAC,CACF,EAmDI,QAAS,CAAE,EAAG,EAAS,EAAG,EAAG,EAAS,CAAE,EACxC,WAAY,CAAE,MAAO,GAAI,EACzB,SAAU,CAAE,MAAO,EAAI,EACvB,QAAS,EACT,MAAO,CACN,OAAQ,EACR,MAAO,CACR,EACA,UAAU;;;;;iBAOV,SAAC,EAAD,CAAK,KAAM,EAAK,EACF,EAEZ,GAEP","names":["Fragment"],"ignoreList":[0,1,2,3,4],"sources":["../../node_modules/.pnpm/framer-motion@12.42.2_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/framer-motion/dist/es/utils/use-composed-ref.mjs","../../node_modules/.pnpm/framer-motion@12.42.2_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs","../../node_modules/.pnpm/framer-motion@12.42.2_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs","../../node_modules/.pnpm/framer-motion@12.42.2_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/framer-motion/dist/es/components/AnimatePresence/utils.mjs","../../node_modules/.pnpm/framer-motion@12.42.2_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs","../../src/features/instance/applications/components/Chat/FloatingChat.tsx"],"sourcesContent":["import * as React from 'react';\n\n/**\n * Taken from https://github.com/radix-ui/primitives/blob/main/packages/react/compose-refs/src/compose-refs.tsx\n */\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef(ref, value) {\n if (typeof ref === \"function\") {\n return ref(value);\n }\n else if (ref !== null && ref !== undefined) {\n ref.current = value;\n }\n}\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs(...refs) {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup === \"function\") {\n hasCleanup = true;\n }\n return cleanup;\n });\n // React <19 will log an error to the console if a callback ref returns a\n // value. We don't use ref cleanups internally so this will only happen if a\n // user's ref callback returns a value, which we only expect if they are\n // using the cleanup functionality added in React 19.\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup === \"function\") {\n cleanup();\n }\n else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs(...refs) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { useComposedRefs };\n//# sourceMappingURL=use-composed-ref.mjs.map\n","\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport { isHTMLElement } from 'motion-dom';\nimport * as React from 'react';\nimport { useId, useRef, useContext, useInsertionEffect } from 'react';\nimport { MotionConfigContext } from '../../context/MotionConfigContext.mjs';\nimport { useComposedRefs } from '../../utils/use-composed-ref.mjs';\n\n/**\n * Measurement functionality has to be within a separate component\n * to leverage snapshot lifecycle.\n */\nclass PopChildMeasure extends React.Component {\n getSnapshotBeforeUpdate(prevProps) {\n const element = this.props.childRef.current;\n if (isHTMLElement(element) && prevProps.isPresent && !this.props.isPresent && this.props.pop !== false) {\n const parent = element.offsetParent;\n const parentWidth = isHTMLElement(parent)\n ? parent.offsetWidth || 0\n : 0;\n const parentHeight = isHTMLElement(parent)\n ? parent.offsetHeight || 0\n : 0;\n const computedStyle = getComputedStyle(element);\n const size = this.props.sizeRef.current;\n size.height = parseFloat(computedStyle.height);\n size.width = parseFloat(computedStyle.width);\n size.top = element.offsetTop;\n size.left = element.offsetLeft;\n size.right = parentWidth - size.width - size.left;\n size.bottom = parentHeight - size.height - size.top;\n size.direction = computedStyle.direction;\n }\n return null;\n }\n /**\n * Required with getSnapshotBeforeUpdate to stop React complaining.\n */\n componentDidUpdate() { }\n render() {\n return this.props.children;\n }\n}\nfunction PopChild({ children, isPresent, anchorX, anchorY, root, pop }) {\n const id = useId();\n const ref = useRef(null);\n const size = useRef({\n width: 0,\n height: 0,\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n direction: \"ltr\",\n });\n const { nonce } = useContext(MotionConfigContext);\n /**\n * In React 19, refs are passed via props.ref instead of element.ref.\n * We check props.ref first (React 19) and fall back to element.ref (React 18).\n */\n const childRef = children.props?.ref ??\n children?.ref;\n const composedRef = useComposedRefs(ref, childRef);\n /**\n * We create and inject a style block so we can apply this explicit\n * sizing in a non-destructive manner by just deleting the style block.\n *\n * We can't apply size via render as the measurement happens\n * in getSnapshotBeforeUpdate (post-render), likewise if we apply the\n * styles directly on the DOM node, we might be overwriting\n * styles set via the style prop.\n */\n useInsertionEffect(() => {\n const { width, height, top, left, right, bottom, direction } = size.current;\n if (isPresent || pop === false || !ref.current || !width || !height)\n return;\n const isRTL = direction === \"rtl\";\n const x = anchorX === \"left\"\n ? (isRTL ? `right: ${right}` : `left: ${left}`)\n : (isRTL ? `left: ${left}` : `right: ${right}`);\n const y = anchorY === \"bottom\" ? `bottom: ${bottom}` : `top: ${top}`;\n ref.current.dataset.motionPopId = id;\n const style = document.createElement(\"style\");\n if (nonce)\n style.nonce = nonce;\n const parent = root ?? document.head;\n parent.appendChild(style);\n if (style.sheet) {\n style.sheet.insertRule(`\n [data-motion-pop-id=\"${id}\"] {\n position: absolute !important;\n width: ${width}px !important;\n height: ${height}px !important;\n ${x}px !important;\n ${y}px !important;\n }\n `);\n }\n return () => {\n ref.current?.removeAttribute(\"data-motion-pop-id\");\n if (parent.contains(style)) {\n parent.removeChild(style);\n }\n };\n }, [isPresent]);\n return (jsx(PopChildMeasure, { isPresent: isPresent, childRef: ref, sizeRef: size, pop: pop, children: pop === false\n ? children\n : React.cloneElement(children, { ref: composedRef }) }));\n}\n\nexport { PopChild };\n//# sourceMappingURL=PopChild.mjs.map\n","\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport * as React from 'react';\nimport { useId, useRef, useMemo } from 'react';\nimport { PresenceContext } from '../../context/PresenceContext.mjs';\nimport { useConstant } from '../../utils/use-constant.mjs';\nimport { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';\nimport { PopChild } from './PopChild.mjs';\n\nconst PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, presenceAffectsLayout, mode, anchorX, anchorY, root }) => {\n const presenceChildren = useConstant(newChildrenMap);\n const id = useId();\n // Written in a layout effect (not render) so discarded concurrent\n // renders can't leave the refs pointing at uncommitted state.\n const isPresentRef = useRef(isPresent);\n const onExitCompleteRef = useRef(onExitComplete);\n useIsomorphicLayoutEffect(() => {\n isPresentRef.current = isPresent;\n onExitCompleteRef.current = onExitComplete;\n });\n let isReusedContext = true;\n let context = useMemo(() => {\n isReusedContext = false;\n return {\n id,\n initial,\n isPresent,\n custom,\n onExitComplete: (childId) => {\n presenceChildren.set(childId, true);\n for (const isComplete of presenceChildren.values()) {\n if (!isComplete)\n return; // can stop searching when any is incomplete\n }\n onExitComplete && onExitComplete();\n },\n register: (childId) => {\n presenceChildren.set(childId, false);\n return () => {\n presenceChildren.delete(childId);\n !isPresentRef.current &&\n !presenceChildren.size &&\n onExitCompleteRef.current?.();\n };\n },\n };\n }, [isPresent, presenceChildren, onExitComplete]);\n /**\n * If the presence of a child affects the layout of the components around it,\n * we want to make a new context value to ensure they get re-rendered\n * so they can detect that layout change.\n */\n if (presenceAffectsLayout && isReusedContext) {\n context = { ...context };\n }\n useMemo(() => {\n presenceChildren.forEach((_, key) => presenceChildren.set(key, false));\n }, [isPresent]);\n /**\n * If there's no `motion` components to fire exit animations, we want to remove this\n * component immediately.\n */\n React.useEffect(() => {\n !isPresent &&\n !presenceChildren.size &&\n onExitComplete &&\n onExitComplete();\n }, [isPresent]);\n children = (jsx(PopChild, { pop: mode === \"popLayout\", isPresent: isPresent, anchorX: anchorX, anchorY: anchorY, root: root, children: children }));\n return (jsx(PresenceContext.Provider, { value: context, children: children }));\n};\nfunction newChildrenMap() {\n return new Map();\n}\n\nexport { PresenceChild };\n//# sourceMappingURL=PresenceChild.mjs.map\n","import { Children, isValidElement } from 'react';\n\nconst getChildKey = (child) => child.key || \"\";\nfunction onlyElements(children) {\n const filtered = [];\n // We use forEach here instead of map as map mutates the component key by preprending `.$`\n Children.forEach(children, (child) => {\n if (isValidElement(child))\n filtered.push(child);\n });\n return filtered;\n}\n\nexport { getChildKey, onlyElements };\n//# sourceMappingURL=utils.mjs.map\n","\"use client\";\nimport { jsx, Fragment } from 'react/jsx-runtime';\nimport { useMemo, useRef, useState, useContext } from 'react';\nimport { LayoutGroupContext } from '../../context/LayoutGroupContext.mjs';\nimport { useConstant } from '../../utils/use-constant.mjs';\nimport { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';\nimport { PresenceChild } from './PresenceChild.mjs';\nimport { usePresence } from './use-presence.mjs';\nimport { onlyElements, getChildKey } from './utils.mjs';\n\n/**\n * `AnimatePresence` enables the animation of components that have been removed from the tree.\n *\n * When adding/removing more than a single child, every child **must** be given a unique `key` prop.\n *\n * Any `motion` components that have an `exit` property defined will animate out when removed from\n * the tree.\n *\n * ```jsx\n * import { motion, AnimatePresence } from 'framer-motion'\n *\n * export const Items = ({ items }) => (\n * <AnimatePresence>\n * {items.map(item => (\n * <motion.div\n * key={item.id}\n * initial={{ opacity: 0 }}\n * animate={{ opacity: 1 }}\n * exit={{ opacity: 0 }}\n * />\n * ))}\n * </AnimatePresence>\n * )\n * ```\n *\n * You can sequence exit animations throughout a tree using variants.\n *\n * If a child contains multiple `motion` components with `exit` props, it will only unmount the child\n * once all `motion` components have finished animating out. Likewise, any components using\n * `usePresence` all need to call `safeToRemove`.\n *\n * @public\n */\nconst AnimatePresence = ({ children, custom, initial = true, onExitComplete, presenceAffectsLayout = true, mode = \"sync\", propagate = false, anchorX = \"left\", anchorY = \"top\", root }) => {\n const [isParentPresent, safeToRemove] = usePresence(propagate);\n /**\n * Filter any children that aren't ReactElements. We can only track components\n * between renders with a props.key.\n */\n const presentChildren = useMemo(() => onlyElements(children), [children]);\n /**\n * Track the keys of the currently rendered children. This is used to\n * determine which children are exiting.\n */\n const presentKeys = propagate && !isParentPresent ? [] : presentChildren.map(getChildKey);\n /**\n * If `initial={false}` we only want to pass this to components in the first render.\n */\n const isInitialRender = useRef(true);\n /**\n * A ref containing the currently present children. When all exit animations\n * are complete, we use this to re-render the component with the latest children\n * *committed* rather than the latest children *rendered*.\n */\n const pendingPresentChildren = useRef(presentChildren);\n /**\n * Track which exiting children have finished animating out.\n */\n const exitComplete = useConstant(() => new Map());\n /**\n * Track which components are currently processing exit to prevent duplicate processing.\n */\n const exitingComponents = useRef(new Set());\n /**\n * Save children to render as React state. To ensure this component is concurrent-safe,\n * we check for exiting children via an effect.\n */\n const [diffedChildren, setDiffedChildren] = useState(presentChildren);\n const [renderedChildren, setRenderedChildren] = useState(presentChildren);\n useIsomorphicLayoutEffect(() => {\n isInitialRender.current = false;\n pendingPresentChildren.current = presentChildren;\n /**\n * Update complete status of exiting children.\n */\n for (let i = 0; i < renderedChildren.length; i++) {\n const key = getChildKey(renderedChildren[i]);\n if (!presentKeys.includes(key)) {\n if (exitComplete.get(key) !== true) {\n exitComplete.set(key, false);\n }\n }\n else {\n exitComplete.delete(key);\n exitingComponents.current.delete(key);\n }\n }\n }, [renderedChildren, presentKeys.length, presentKeys.join(\"-\")]);\n const exitingChildren = [];\n if (presentChildren !== diffedChildren) {\n let nextChildren = [...presentChildren];\n /**\n * Loop through all the currently rendered components and decide which\n * are exiting.\n */\n for (let i = 0; i < renderedChildren.length; i++) {\n const child = renderedChildren[i];\n const key = getChildKey(child);\n if (!presentKeys.includes(key)) {\n nextChildren.splice(i, 0, child);\n exitingChildren.push(child);\n }\n }\n /**\n * If we're in \"wait\" mode, and we have exiting children, we want to\n * only render these until they've all exited.\n */\n if (mode === \"wait\" && exitingChildren.length) {\n nextChildren = exitingChildren;\n }\n setRenderedChildren(onlyElements(nextChildren));\n setDiffedChildren(presentChildren);\n /**\n * Early return to ensure once we've set state with the latest diffed\n * children, we can immediately re-render.\n */\n return null;\n }\n if (process.env.NODE_ENV !== \"production\" &&\n mode === \"wait\" &&\n renderedChildren.length > 1) {\n console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to \"wait\". This will lead to odd visual behaviour.`);\n }\n /**\n * If we've been provided a forceRender function by the LayoutGroupContext,\n * we can use it to force a re-render amongst all surrounding components once\n * all components have finished animating out.\n */\n const { forceRender } = useContext(LayoutGroupContext);\n return (jsx(Fragment, { children: renderedChildren.map((child) => {\n const key = getChildKey(child);\n const isPresent = propagate && !isParentPresent\n ? false\n : presentChildren === renderedChildren ||\n presentKeys.includes(key);\n const onExit = () => {\n if (exitingComponents.current.has(key)) {\n return;\n }\n if (exitComplete.has(key)) {\n exitingComponents.current.add(key);\n exitComplete.set(key, true);\n }\n else {\n return;\n }\n let isEveryExitComplete = true;\n exitComplete.forEach((isExitComplete) => {\n if (!isExitComplete)\n isEveryExitComplete = false;\n });\n if (isEveryExitComplete) {\n forceRender?.();\n setRenderedChildren(pendingPresentChildren.current);\n propagate && safeToRemove?.();\n onExitComplete && onExitComplete();\n }\n };\n return (jsx(PresenceChild, { isPresent: isPresent, initial: !isInitialRender.current || initial\n ? undefined\n : false, custom: custom, presenceAffectsLayout: presenceAffectsLayout, mode: mode, root: root, onExitComplete: isPresent ? undefined : onExit, anchorX: anchorX, anchorY: anchorY, children: child }, key));\n }) }));\n};\n\nexport { AnimatePresence };\n//# sourceMappingURL=index.mjs.map\n","import { Loading } from '@/components/Loading';\nimport { useLocalStorage } from '@/hooks/useLocalStorage';\nimport { useSessionStorage } from '@/hooks/useSessionStorage';\nimport { LocalStorageKeys } from '@/lib/storage/localStorageKeys';\nimport { Bot } from 'lucide-react';\nimport { AnimatePresence, motion } from 'motion/react';\nimport { lazy, Suspense, useCallback, useEffect, useRef, useState } from 'react';\n\n// Second-tier lazy load: this file (the floating bubble) loads when you land on\n// an instance, but the chat pane — and its heavy dependencies (the AI SDK, the\n// chat tools, the markdown message renderer) — only loads the first time the\n// bubble is opened.\nconst Chat = lazy(() => import('./index').then((m) => ({ default: m.Chat })));\n\nconst BUBBLE_SIZE = 56;\nconst PADDING = 24;\n\nexport function FloatingChat() {\n\tconst [isMobile, setIsMobile] = useState(false);\n\tconst [isDragging, setIsDragging] = useState(false);\n\tconst [isResizing, setIsResizing] = useState(false);\n\tconst [isOpen, setIsOpen] = useSessionStorage('ApplicationChatOpen', false);\n\tconst [position, setPosition] = useLocalStorage(LocalStorageKeys.ApplicationChatPosition, { x: -40, y: -40 });\n\tconst [width, setWidth] = useLocalStorage(LocalStorageKeys.ApplicationChatWidth, 600);\n\tconst containerRef = useRef<HTMLDivElement>(null);\n\n\tuseEffect(() => {\n\t\tconst checkMobile = () => {\n\t\t\tconst mobile = window.innerWidth < 768;\n\t\t\tsetIsMobile(mobile);\n\t\t\tif (!mobile && width > window.innerWidth) {\n\t\t\t\tsetWidth(window.innerWidth);\n\t\t\t}\n\t\t};\n\t\tcheckMobile();\n\t\twindow.addEventListener('resize', checkMobile);\n\t\treturn () => window.removeEventListener('resize', checkMobile);\n\t}, [width, setWidth]);\n\n\tconst handleResizeStart = useCallback((e: React.MouseEvent) => {\n\t\te.preventDefault();\n\t\tsetIsResizing(true);\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (!isResizing) { return; }\n\n\t\tconst handleMouseMove = (e: MouseEvent) => {\n\t\t\tconst newWidth = window.innerWidth - e.clientX;\n\t\t\tconst clampedWidth = Math.min(Math.max(newWidth, 300), window.innerWidth);\n\t\t\tsetWidth(clampedWidth);\n\t\t};\n\n\t\tconst handleMouseUp = () => {\n\t\t\tsetIsResizing(false);\n\t\t};\n\n\t\twindow.addEventListener('mousemove', handleMouseMove);\n\t\twindow.addEventListener('mouseup', handleMouseUp);\n\t\treturn () => {\n\t\t\twindow.removeEventListener('mousemove', handleMouseMove);\n\t\t\twindow.removeEventListener('mouseup', handleMouseUp);\n\t\t};\n\t}, [isResizing, setWidth]);\n\n\tconst toggleChat = useCallback(() => {\n\t\tif (isDragging) { return; }\n\t\tsetIsOpen(prev => !prev);\n\t}, [isDragging]);\n\n\tconst closeChat = useCallback(() => {\n\t\tsetIsOpen(false);\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (isOpen) {\n\t\t\tconst handleEscape = (e: KeyboardEvent) => {\n\t\t\t\tif (e.key === 'Escape') {\n\t\t\t\t\tcloseChat();\n\t\t\t\t}\n\t\t\t};\n\t\t\twindow.addEventListener('keydown', handleEscape);\n\t\t\treturn () => window.removeEventListener('keydown', handleEscape);\n\t\t}\n\t}, [isOpen, closeChat]);\n\n\tconst handleDragStart = () => {\n\t\tsetIsDragging(false);\n\t};\n\n\tconst handleDrag = (_event: any, info: any) => {\n\t\t// If the user has moved the pointer more than 5px, consider it a drag\n\t\tif (Math.abs(info.offset.x) > 5 || Math.abs(info.offset.y) > 5) {\n\t\t\tsetIsDragging(true);\n\t\t}\n\t};\n\n\tconst handleDragEnd = (_event: any, info: any) => {\n\t\t// Small delay to ensure the click handler (which fires after dragEnd)\n\t\t// can still see the isDragging = true state.\n\t\tsetTimeout(() => {\n\t\t\tsetIsDragging(false);\n\t\t}, 100);\n\n\t\tif (isMobile) { return; }\n\n\t\tconst { innerWidth, innerHeight } = window;\n\n\t\t// Calculate new offsets based on where we started and how far we dragged.\n\t\t// x and y in position are offsets from the initial bottom-right (PADDING, PADDING)\n\t\tconst newX = position.x + info.offset.x;\n\t\tconst newY = position.y + info.offset.y;\n\n\t\t// We still want snapping if it's close to the screen edge.\n\t\t// info.point is absolute screen coordinates of the pointer.\n\t\tconst distLeft = info.point.x;\n\t\tconst distRight = innerWidth - info.point.x;\n\t\tconst distTop = info.point.y;\n\t\tconst distBottom = innerHeight - info.point.y;\n\n\t\tlet snapX = newX;\n\t\tlet snapY = newY;\n\n\t\tconst threshold = 100;\n\t\tif (distLeft < threshold) {\n\t\t\t// Snap to left: x offset should be -(innerWidth - BUBBLE_SIZE - PADDING * 2)\n\t\t\tsnapX = -(innerWidth - BUBBLE_SIZE - PADDING * 2);\n\t\t} else if (distRight < threshold) {\n\t\t\t// Snap to right: x offset should be 0\n\t\t\tsnapX = 0;\n\t\t}\n\n\t\tif (distTop < threshold) {\n\t\t\t// Snap to top: y offset should be -(innerHeight - BUBBLE_SIZE - PADDING * 2)\n\t\t\tsnapY = -(innerHeight - BUBBLE_SIZE - PADDING * 2);\n\t\t} else if (distBottom < threshold) {\n\t\t\t// Snap to bottom: y offset should be 0\n\t\t\tsnapY = 0;\n\t\t}\n\n\t\tsetPosition({\n\t\t\tx: snapX,\n\t\t\ty: snapY,\n\t\t});\n\t};\n\n\treturn (\n\t\t<div className=\"fixed inset-0 pointer-events-none z-50\" ref={containerRef}>\n\t\t\t<AnimatePresence>\n\t\t\t\t{isOpen && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tinitial={isMobile ? { opacity: 0, y: '100%' } : { opacity: 0, x: '100%' }}\n\t\t\t\t\t\tanimate={isMobile ? { opacity: 1, y: 0 } : { opacity: 1, x: 0 }}\n\t\t\t\t\t\texit={isMobile ? { opacity: 0, y: '100%' } : { opacity: 0, x: '100%' }}\n\t\t\t\t\t\ttransition={{ type: 'spring', damping: 25, stiffness: 200 }}\n\t\t\t\t\t\tstyle={!isMobile\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\t\t\tbottom: 0,\n\t\t\t\t\t\t\t\tright: 0,\n\t\t\t\t\t\t\t\twidth,\n\t\t\t\t\t\t\t\tmaxWidth: '100vw',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {}}\n\t\t\t\t\t\tclassName={`\n\t\t\t\t\t\t\tpointer-events-auto\n\t\t\t\t\t\t\tfixed bg-background shadow-2xl border-l border-border overflow-visible\n\t\t\t\t\t\t\t${isMobile ? 'inset-0 w-full h-full rounded-none' : 'h-full'}\n\t\t\t\t\t\t`}\n\t\t\t\t\t>\n\t\t\t\t\t\t{!isMobile && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tonMouseDown={handleResizeStart}\n\t\t\t\t\t\t\t\tclassName={`\n\t\t\t\t\t\t\t\t\tabsolute left-0 top-0 bottom-0 w-1 cursor-ew-resize\n\t\t\t\t\t\t\t\t\thover:bg-primary transition-colors z-50\n\t\t\t\t\t\t\t\t\t${isResizing ? 'bg-primary' : ''}\n\t\t\t\t\t\t\t\t`}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<Suspense fallback={<Loading centered text=\"Loading chat…\" />}>\n\t\t\t\t\t\t\t<Chat autoFocus closeChat={closeChat} />\n\t\t\t\t\t\t</Suspense>\n\t\t\t\t\t</motion.div>\n\t\t\t\t)}\n\t\t\t</AnimatePresence>\n\n\t\t\t{!isOpen && (\n\t\t\t\t<motion.button\n\t\t\t\t\tdrag\n\t\t\t\t\tdragMomentum={false}\n\t\t\t\t\tdragConstraints={containerRef}\n\t\t\t\t\tonDragStart={handleDragStart}\n\t\t\t\t\tonDrag={handleDrag}\n\t\t\t\t\tonDragEnd={handleDragEnd}\n\t\t\t\t\tinitial={{ x: position.x, y: position.y }}\n\t\t\t\t\twhileHover={{ scale: 1.1 }}\n\t\t\t\t\twhileTap={{ scale: 0.9 }}\n\t\t\t\t\tonClick={toggleChat}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tbottom: PADDING,\n\t\t\t\t\t\tright: PADDING,\n\t\t\t\t\t}}\n\t\t\t\t\tclassName=\"\n\t\t\t\t\t\tpointer-events-auto\n\t\t\t\t\t\tfixed w-14 h-14 rounded-full bg-primary\n\t\t\t\t\t\ttext-primary-foreground shadow-lg flex items-center justify-center cursor-pointer\n\t\t\t\t\t\thover:bg-primary/90 transition-colors\n\t\t\t\t\t\"\n\t\t\t\t>\n\t\t\t\t\t<Bot size={28} />\n\t\t\t\t</motion.button>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n"],"file":"FloatingChat-CPyPIcVR.js"}
|