@kafca/agentdock 0.1.55 → 0.1.56

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.
Files changed (57) hide show
  1. package/README.md +7 -0
  2. package/dist/renderer/assets/{Badge-Bg_nNvBL.js → Badge-DjcoXx2J.js} +1 -1
  3. package/dist/renderer/assets/{Chat-BJveQQKu.js → Chat-C5Bkm9-M.js} +1 -1
  4. package/dist/renderer/assets/{ChatMarkdown-Bqn2HJ6f.js → ChatMarkdown-uc36EzyD.js} +1 -1
  5. package/dist/renderer/assets/{Config-CMtZDRAE.js → Config-DHtQuuLy.js} +1 -1
  6. package/dist/renderer/assets/{CronList-C-ILB_Ae.js → CronList-BYUnhzSC.js} +1 -1
  7. package/dist/renderer/assets/{Dashboard-CsKBSQIe.js → Dashboard-BPnGMDg3.js} +2 -2
  8. package/dist/renderer/assets/{EmptyState-C60g3RMj.js → EmptyState-DIZLiccW.js} +1 -1
  9. package/dist/renderer/assets/{KnowledgeDetail-CC5C7JYe.js → KnowledgeDetail-CJ9IYOsa.js} +1 -1
  10. package/dist/renderer/assets/{KnowledgeHome-3rlvxgWf.js → KnowledgeHome-BLGPwnBO.js} +1 -1
  11. package/dist/renderer/assets/{Logs-CktemGN0.js → Logs-Dyd2Uwlt.js} +1 -1
  12. package/dist/renderer/assets/{Modal-BQUW9LSf.js → Modal-CQiUpfl4.js} +1 -1
  13. package/dist/renderer/assets/{MonitorList-B0hxjuOZ.js → MonitorList-Byg3E3Gt.js} +1 -1
  14. package/dist/renderer/assets/{Page-DL_Nv2i5.js → Page-7DxXvTMm.js} +1 -1
  15. package/dist/renderer/assets/{ProjectDetail-Djr9-MyT.js → ProjectDetail-Dfr5s0Ja.js} +1 -1
  16. package/dist/renderer/assets/{ProjectList-BKl4eW7q.js → ProjectList-CDDQjAQ_.js} +1 -1
  17. package/dist/renderer/assets/{Select-CfRkos3z.js → Select-D6z65IT3.js} +1 -1
  18. package/dist/renderer/assets/{SessionChat-Dxv8D5DW.js → SessionChat-s7CAaCPL.js} +1 -1
  19. package/dist/renderer/assets/{SessionList-BJ2GjXvR.js → SessionList-D-OycKKS.js} +1 -1
  20. package/dist/renderer/assets/{ThreadChat-CAsIl9qf.js → ThreadChat-CLdFynB5.js} +1 -1
  21. package/dist/renderer/assets/{Workspace-CaUhiGBX.js → Workspace-xfT5z4j_.js} +1 -1
  22. package/dist/renderer/assets/{arrow-left-D1DbXrLA.js → arrow-left-CV5cL3f4.js} +1 -1
  23. package/dist/renderer/assets/{book-open-BxC1z1C1.js → book-open-DThvB7pj.js} +1 -1
  24. package/dist/renderer/assets/{bot-Fw3IzhJA.js → bot-CWQ5-ovl.js} +1 -1
  25. package/dist/renderer/assets/{check-5zCTgp3A.js → check-DKM7zfWG.js} +1 -1
  26. package/dist/renderer/assets/{chevron-down-N3PxTNxH.js → chevron-down-Dfw2KU87.js} +1 -1
  27. package/dist/renderer/assets/{circle-C_chUflo.js → circle-CoP4RA4s.js} +1 -1
  28. package/dist/renderer/assets/{desktop-DkQTZNhe.js → desktop-CsDYrOOU.js} +1 -1
  29. package/dist/renderer/assets/{funnel-B8ZAv6I7.js → funnel-DpVLlG3g.js} +1 -1
  30. package/dist/renderer/assets/{heart-M9A3E4Ed.js → heart-BMD36ejP.js} +1 -1
  31. package/dist/renderer/assets/{index-DJ8w4e0l.js → index-COxSYBjE.js} +2 -2
  32. package/dist/renderer/assets/{index-Bwv855ID.js → index-CTGTI-cm.js} +1 -1
  33. package/dist/renderer/assets/{pencil-X44UaxwR.js → pencil-Dv5WxhdC.js} +1 -1
  34. package/dist/renderer/assets/{play-ujo-De38.js → play-DnCnft83.js} +1 -1
  35. package/dist/renderer/assets/{plus-BHgVdG_A.js → plus-DsxIagzS.js} +1 -1
  36. package/dist/renderer/assets/projects-DgjHcNgt.js +1 -0
  37. package/dist/renderer/assets/{save-Cz6giKrE.js → save-CST01lIc.js} +1 -1
  38. package/dist/renderer/assets/{search-DKWvTqi5.js → search-B_bqy6Wd.js} +1 -1
  39. package/dist/renderer/assets/{server-BsuHcYl4.js → server-ecH4GNwa.js} +1 -1
  40. package/dist/renderer/assets/{session-utils-DnAWL3eo.js → session-utils-Dd_WKMYW.js} +1 -1
  41. package/dist/renderer/assets/{sessions-DptxO_BE.js → sessions-BQ33Mv4k.js} +1 -1
  42. package/dist/renderer/assets/{shield-check-V82O8AC1.js → shield-check-D6lG5Aoc.js} +1 -1
  43. package/dist/renderer/assets/{trash-2-_Fgwk8mc.js → trash-2-Cefngb6Q.js} +1 -1
  44. package/dist/renderer/assets/{user-DQKTaUcR.js → user-D_8RSH-T.js} +1 -1
  45. package/dist/renderer/assets/{wifi-off-vjH-MD2w.js → wifi-off-DB9D-pOu.js} +1 -1
  46. package/dist/renderer/index.html +1 -1
  47. package/dist-electron/services/local-ai-core/src/acp/local-core-acp-backend.js +1 -1
  48. package/dist-electron/services/local-ai-core/src/channel/lark/local-core-lark-gateway.js +110 -80
  49. package/dist-electron/services/local-ai-core/src/channel/shared/inbound-attachment-store.js +93 -0
  50. package/dist-electron/services/local-ai-core/src/channel/weixin/local-core-weixin-gateway.js +58 -24
  51. package/dist-electron/services/local-ai-core/src/kernel/local-core-errors.js +33 -5
  52. package/dist-electron/tests/integration/channel-inbound-attachment-store.test.js +117 -0
  53. package/dist-electron/tests/integration/lark-gateway.test.js +54 -0
  54. package/dist-electron/tests/integration/local-core-errors.test.js +41 -0
  55. package/dist-electron/tests/integration/weixin-gateway.test.js +36 -0
  56. package/package.json +1 -1
  57. package/dist/renderer/assets/projects-DB1FLZ3A.js +0 -1
@@ -1,4 +1,4 @@
1
- import{J as Le,aY as Ne,r as c,j as x,aZ as pe,a_ as Ae,aO as te}from"./index-DJ8w4e0l.js";var ye=Ne();const De=Le(ye);function Y(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Jt(e,t){const n=c.createContext(t),r=i=>{const{children:s,...a}=i,h=c.useMemo(()=>a,Object.values(a));return x.jsx(n.Provider,{value:h,children:s})};r.displayName=e+"Provider";function o(i){const s=c.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,o]}function en(e,t=[]){let n=[];function r(i,s){const a=c.createContext(s),h=n.length;n=[...n,s];const l=d=>{var p;const{scope:v,children:y,...w}=d,u=((p=v==null?void 0:v[e])==null?void 0:p[h])||a,m=c.useMemo(()=>w,Object.values(w));return x.jsx(u.Provider,{value:m,children:y})};l.displayName=i+"Provider";function f(d,v){var u;const y=((u=v==null?void 0:v[e])==null?void 0:u[h])||a,w=c.useContext(y);if(w)return w;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,f]}const o=()=>{const i=n.map(s=>c.createContext(s));return function(a){const h=(a==null?void 0:a[e])||i;return c.useMemo(()=>({[`__scope${e}`]:{...a,[e]:h}}),[a,h])}};return o.scopeName=e,[r,ke(o,...t)]}function ke(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:h,scopeName:l})=>{const d=h(i)[`__scope${l}`];return{...a,...d}},{});return c.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var ne=globalThis!=null&&globalThis.document?c.useLayoutEffect:()=>{},Fe=pe[" useId ".trim().toString()]||(()=>{}),Me=0;function tn(e){const[t,n]=c.useState(Fe());return ne(()=>{n(r=>r??String(Me++))},[e]),e||(t?`radix-${t}`:"")}var Ie=pe[" useInsertionEffect ".trim().toString()]||ne;function nn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=We({defaultProp:t,onChange:n}),a=e!==void 0,h=a?e:o;{const f=c.useRef(e!==void 0);c.useEffect(()=>{const d=f.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=a},[a,r])}const l=c.useCallback(f=>{var d;if(a){const v=Be(f)?f(e):f;v!==e&&((d=s.current)==null||d.call(s,v))}else i(f)},[a,e,i,s]);return[h,l]}function We({defaultProp:e,onChange:t}){const[n,r]=c.useState(e),o=c.useRef(n),i=c.useRef(t);return Ie(()=>{i.current=t},[t]),c.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}function Be(e){return typeof e=="function"}function _e(e){const t=je(e),n=c.forwardRef((r,o)=>{const{children:i,...s}=r,a=c.Children.toArray(i),h=a.find($e);if(h){const l=h.props.children,f=a.map(d=>d===h?c.Children.count(l)>1?c.Children.only(null):c.isValidElement(l)?l.props.children:null:d);return x.jsx(t,{...s,ref:o,children:c.isValidElement(l)?c.cloneElement(l,void 0,f):null})}return x.jsx(t,{...s,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function je(e){const t=c.forwardRef((n,r)=>{const{children:o,...i}=n;if(c.isValidElement(o)){const s=Ke(o),a=Ve(i,o.props);return o.type!==c.Fragment&&(a.ref=r?Ae(r,s):s),c.cloneElement(o,a)}return c.Children.count(o)>1?c.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ue=Symbol("radix.slottable");function $e(e){return c.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ue}function Ve(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{const h=i(...a);return o(...a),h}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function Ke(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ye=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],V=Ye.reduce((e,t)=>{const n=_e(`Primitive.${t}`),r=c.forwardRef((o,i)=>{const{asChild:s,...a}=o,h=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),x.jsx(h,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Xe(e,t){e&&ye.flushSync(()=>e.dispatchEvent(t))}function M(e){const t=c.useRef(e);return c.useEffect(()=>{t.current=e}),c.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function He(e,t=globalThis==null?void 0:globalThis.document){const n=M(e);c.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var ze="DismissableLayer",J="dismissableLayer.update",Ze="dismissableLayer.pointerDownOutside",Ge="dismissableLayer.focusOutside",oe,Ee=c.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),qe=c.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...h}=e,l=c.useContext(Ee),[f,d]=c.useState(null),v=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=c.useState({}),w=te(t,E=>d(E)),u=Array.from(l.layers),[m]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),p=u.indexOf(m),g=f?u.indexOf(f):-1,b=l.layersWithOutsidePointerEventsDisabled.size>0,S=g>=p,C=et(E=>{const T=E.target,L=[...l.branches].some(F=>F.contains(T));!S||L||(o==null||o(E),s==null||s(E),E.defaultPrevented||a==null||a())},v),P=tt(E=>{const T=E.target;[...l.branches].some(F=>F.contains(T))||(i==null||i(E),s==null||s(E),E.defaultPrevented||a==null||a())},v);return He(E=>{g===l.layers.size-1&&(r==null||r(E),!E.defaultPrevented&&a&&(E.preventDefault(),a()))},v),c.useEffect(()=>{if(f)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(oe=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(f)),l.layers.add(f),ae(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=oe)}},[f,v,n,l]),c.useEffect(()=>()=>{f&&(l.layers.delete(f),l.layersWithOutsidePointerEventsDisabled.delete(f),ae())},[f,l]),c.useEffect(()=>{const E=()=>y({});return document.addEventListener(J,E),()=>document.removeEventListener(J,E)},[]),x.jsx(V.div,{...h,ref:w,style:{pointerEvents:b?S?"auto":"none":void 0,...e.style},onFocusCapture:Y(e.onFocusCapture,P.onFocusCapture),onBlurCapture:Y(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:Y(e.onPointerDownCapture,C.onPointerDownCapture)})});qe.displayName=ze;var Qe="DismissableLayerBranch",Je=c.forwardRef((e,t)=>{const n=c.useContext(Ee),r=c.useRef(null),o=te(t,r);return c.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),x.jsx(V.div,{...e,ref:o})});Je.displayName=Qe;function et(e,t=globalThis==null?void 0:globalThis.document){const n=M(e),r=c.useRef(!1),o=c.useRef(()=>{});return c.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let h=function(){ge(Ze,n,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=h,t.addEventListener("click",o.current,{once:!0})):h()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function tt(e,t=globalThis==null?void 0:globalThis.document){const n=M(e),r=c.useRef(!1);return c.useEffect(()=>{const o=i=>{i.target&&!r.current&&ge(Ge,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ae(){const e=new CustomEvent(J);document.dispatchEvent(e)}function ge(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Xe(o,i):o.dispatchEvent(i)}var X="focusScope.autoFocusOnMount",H="focusScope.autoFocusOnUnmount",ce={bubbles:!1,cancelable:!0},nt="FocusScope",rt=c.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=e,[a,h]=c.useState(null),l=M(o),f=M(i),d=c.useRef(null),v=te(t,u=>h(u)),y=c.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;c.useEffect(()=>{if(r){let u=function(b){if(y.paused||!a)return;const S=b.target;a.contains(S)?d.current=S:O(d.current,{select:!0})},m=function(b){if(y.paused||!a)return;const S=b.relatedTarget;S!==null&&(a.contains(S)||O(d.current,{select:!0}))},p=function(b){if(document.activeElement===document.body)for(const C of b)C.removedNodes.length>0&&O(a)};document.addEventListener("focusin",u),document.addEventListener("focusout",m);const g=new MutationObserver(p);return a&&g.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",u),document.removeEventListener("focusout",m),g.disconnect()}}},[r,a,y.paused]),c.useEffect(()=>{if(a){se.add(y);const u=document.activeElement;if(!a.contains(u)){const p=new CustomEvent(X,ce);a.addEventListener(X,l),a.dispatchEvent(p),p.defaultPrevented||(ot(ut(be(a)),{select:!0}),document.activeElement===u&&O(a))}return()=>{a.removeEventListener(X,l),setTimeout(()=>{const p=new CustomEvent(H,ce);a.addEventListener(H,f),a.dispatchEvent(p),p.defaultPrevented||O(u??document.body,{select:!0}),a.removeEventListener(H,f),se.remove(y)},0)}}},[a,l,f,y]);const w=c.useCallback(u=>{if(!n&&!r||y.paused)return;const m=u.key==="Tab"&&!u.altKey&&!u.ctrlKey&&!u.metaKey,p=document.activeElement;if(m&&p){const g=u.currentTarget,[b,S]=at(g);b&&S?!u.shiftKey&&p===S?(u.preventDefault(),n&&O(b,{select:!0})):u.shiftKey&&p===b&&(u.preventDefault(),n&&O(S,{select:!0})):p===g&&u.preventDefault()}},[n,r,y.paused]);return x.jsx(V.div,{tabIndex:-1,...s,ref:v,onKeyDown:w})});rt.displayName=nt;function ot(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(O(r,{select:t}),document.activeElement!==n)return}function at(e){const t=be(e),n=ie(t,e),r=ie(t.reverse(),e);return[n,r]}function be(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ie(e,t){for(const n of e)if(!ct(n,{upTo:t}))return n}function ct(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function it(e){return e instanceof HTMLInputElement&&"select"in e}function O(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&it(e)&&t&&e.select()}}var se=st();function st(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=ue(e,t),e.unshift(t)},remove(t){var n;e=ue(e,t),(n=e[0])==null||n.resume()}}}function ue(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function ut(e){return e.filter(t=>t.tagName!=="A")}var lt="Portal",ft=c.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,i]=c.useState(!1);ne(()=>i(!0),[]);const s=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?De.createPortal(x.jsx(V.div,{...r,ref:t}),s):null});ft.displayName=lt;var z=0;function rn(){c.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??le()),document.body.insertAdjacentElement("beforeend",e[1]??le()),z++,()=>{z===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),z--}},[])}function le(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var R=function(){return R=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},R.apply(this,arguments)};function Se(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function dt(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var U="right-scroll-bar-position",$="width-before-scroll-bar",vt="with-scroll-bars-hidden",ht="--removed-body-scroll-bar-size";function Z(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function mt(e,t){var n=c.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var pt=typeof window<"u"?c.useLayoutEffect:c.useEffect,fe=new WeakMap;function yt(e,t){var n=mt(null,function(r){return e.forEach(function(o){return Z(o,r)})});return pt(function(){var r=fe.get(n);if(r){var o=new Set(r),i=new Set(e),s=n.current;o.forEach(function(a){i.has(a)||Z(a,null)}),i.forEach(function(a){o.has(a)||Z(a,s)})}fe.set(n,e)},[e]),n}function Et(e){return e}function gt(e,t){t===void 0&&(t=Et);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var s=t(i,r);return n.push(s),function(){n=n.filter(function(a){return a!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var a=n;n=[],a.forEach(i),s=n}var h=function(){var f=s;s=[],f.forEach(i)},l=function(){return Promise.resolve().then(h)};l(),n={push:function(f){s.push(f),l()},filter:function(f){return s=s.filter(f),n}}}};return o}function bt(e){e===void 0&&(e={});var t=gt(null);return t.options=R({async:!0,ssr:!1},e),t}var we=function(e){var t=e.sideCar,n=Se(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return c.createElement(r,R({},n))};we.isSideCarExport=!0;function St(e,t){return e.useMedium(t),we}var Ce=bt(),G=function(){},K=c.forwardRef(function(e,t){var n=c.useRef(null),r=c.useState({onScrollCapture:G,onWheelCapture:G,onTouchMoveCapture:G}),o=r[0],i=r[1],s=e.forwardProps,a=e.children,h=e.className,l=e.removeScrollBar,f=e.enabled,d=e.shards,v=e.sideCar,y=e.noRelative,w=e.noIsolation,u=e.inert,m=e.allowPinchZoom,p=e.as,g=p===void 0?"div":p,b=e.gapMode,S=Se(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=v,P=yt([n,t]),E=R(R({},S),o);return c.createElement(c.Fragment,null,f&&c.createElement(C,{sideCar:Ce,removeScrollBar:l,shards:d,noRelative:y,noIsolation:w,inert:u,setCallbacks:i,allowPinchZoom:!!m,lockRef:n,gapMode:b}),s?c.cloneElement(c.Children.only(a),R(R({},E),{ref:P})):c.createElement(g,R({},E,{className:h,ref:P}),a))});K.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};K.classNames={fullWidth:$,zeroRight:U};var wt=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Ct(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=wt();return t&&e.setAttribute("nonce",t),e}function Pt(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Rt(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var xt=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ct())&&(Pt(t,n),Rt(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Ot=function(){var e=xt();return function(t,n){c.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Pe=function(){var e=Ot(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Tt={left:0,top:0,right:0,gap:0},q=function(e){return parseInt(e||"",10)||0},Lt=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[q(n),q(r),q(o)]},Nt=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Tt;var t=Lt(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},At=Pe(),k="data-scroll-locked",Dt=function(e,t,n,r){var o=e.left,i=e.top,s=e.right,a=e.gap;return n===void 0&&(n="margin"),`
1
+ import{J as Le,aY as Ne,r as c,j as x,aZ as pe,a_ as Ae,aO as te}from"./index-COxSYBjE.js";var ye=Ne();const De=Le(ye);function Y(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Jt(e,t){const n=c.createContext(t),r=i=>{const{children:s,...a}=i,h=c.useMemo(()=>a,Object.values(a));return x.jsx(n.Provider,{value:h,children:s})};r.displayName=e+"Provider";function o(i){const s=c.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,o]}function en(e,t=[]){let n=[];function r(i,s){const a=c.createContext(s),h=n.length;n=[...n,s];const l=d=>{var p;const{scope:v,children:y,...w}=d,u=((p=v==null?void 0:v[e])==null?void 0:p[h])||a,m=c.useMemo(()=>w,Object.values(w));return x.jsx(u.Provider,{value:m,children:y})};l.displayName=i+"Provider";function f(d,v){var u;const y=((u=v==null?void 0:v[e])==null?void 0:u[h])||a,w=c.useContext(y);if(w)return w;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,f]}const o=()=>{const i=n.map(s=>c.createContext(s));return function(a){const h=(a==null?void 0:a[e])||i;return c.useMemo(()=>({[`__scope${e}`]:{...a,[e]:h}}),[a,h])}};return o.scopeName=e,[r,ke(o,...t)]}function ke(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:h,scopeName:l})=>{const d=h(i)[`__scope${l}`];return{...a,...d}},{});return c.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var ne=globalThis!=null&&globalThis.document?c.useLayoutEffect:()=>{},Fe=pe[" useId ".trim().toString()]||(()=>{}),Me=0;function tn(e){const[t,n]=c.useState(Fe());return ne(()=>{n(r=>r??String(Me++))},[e]),e||(t?`radix-${t}`:"")}var Ie=pe[" useInsertionEffect ".trim().toString()]||ne;function nn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=We({defaultProp:t,onChange:n}),a=e!==void 0,h=a?e:o;{const f=c.useRef(e!==void 0);c.useEffect(()=>{const d=f.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=a},[a,r])}const l=c.useCallback(f=>{var d;if(a){const v=Be(f)?f(e):f;v!==e&&((d=s.current)==null||d.call(s,v))}else i(f)},[a,e,i,s]);return[h,l]}function We({defaultProp:e,onChange:t}){const[n,r]=c.useState(e),o=c.useRef(n),i=c.useRef(t);return Ie(()=>{i.current=t},[t]),c.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}function Be(e){return typeof e=="function"}function _e(e){const t=je(e),n=c.forwardRef((r,o)=>{const{children:i,...s}=r,a=c.Children.toArray(i),h=a.find($e);if(h){const l=h.props.children,f=a.map(d=>d===h?c.Children.count(l)>1?c.Children.only(null):c.isValidElement(l)?l.props.children:null:d);return x.jsx(t,{...s,ref:o,children:c.isValidElement(l)?c.cloneElement(l,void 0,f):null})}return x.jsx(t,{...s,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function je(e){const t=c.forwardRef((n,r)=>{const{children:o,...i}=n;if(c.isValidElement(o)){const s=Ke(o),a=Ve(i,o.props);return o.type!==c.Fragment&&(a.ref=r?Ae(r,s):s),c.cloneElement(o,a)}return c.Children.count(o)>1?c.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ue=Symbol("radix.slottable");function $e(e){return c.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ue}function Ve(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{const h=i(...a);return o(...a),h}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function Ke(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ye=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],V=Ye.reduce((e,t)=>{const n=_e(`Primitive.${t}`),r=c.forwardRef((o,i)=>{const{asChild:s,...a}=o,h=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),x.jsx(h,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Xe(e,t){e&&ye.flushSync(()=>e.dispatchEvent(t))}function M(e){const t=c.useRef(e);return c.useEffect(()=>{t.current=e}),c.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function He(e,t=globalThis==null?void 0:globalThis.document){const n=M(e);c.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var ze="DismissableLayer",J="dismissableLayer.update",Ze="dismissableLayer.pointerDownOutside",Ge="dismissableLayer.focusOutside",oe,Ee=c.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),qe=c.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...h}=e,l=c.useContext(Ee),[f,d]=c.useState(null),v=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=c.useState({}),w=te(t,E=>d(E)),u=Array.from(l.layers),[m]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),p=u.indexOf(m),g=f?u.indexOf(f):-1,b=l.layersWithOutsidePointerEventsDisabled.size>0,S=g>=p,C=et(E=>{const T=E.target,L=[...l.branches].some(F=>F.contains(T));!S||L||(o==null||o(E),s==null||s(E),E.defaultPrevented||a==null||a())},v),P=tt(E=>{const T=E.target;[...l.branches].some(F=>F.contains(T))||(i==null||i(E),s==null||s(E),E.defaultPrevented||a==null||a())},v);return He(E=>{g===l.layers.size-1&&(r==null||r(E),!E.defaultPrevented&&a&&(E.preventDefault(),a()))},v),c.useEffect(()=>{if(f)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(oe=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(f)),l.layers.add(f),ae(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=oe)}},[f,v,n,l]),c.useEffect(()=>()=>{f&&(l.layers.delete(f),l.layersWithOutsidePointerEventsDisabled.delete(f),ae())},[f,l]),c.useEffect(()=>{const E=()=>y({});return document.addEventListener(J,E),()=>document.removeEventListener(J,E)},[]),x.jsx(V.div,{...h,ref:w,style:{pointerEvents:b?S?"auto":"none":void 0,...e.style},onFocusCapture:Y(e.onFocusCapture,P.onFocusCapture),onBlurCapture:Y(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:Y(e.onPointerDownCapture,C.onPointerDownCapture)})});qe.displayName=ze;var Qe="DismissableLayerBranch",Je=c.forwardRef((e,t)=>{const n=c.useContext(Ee),r=c.useRef(null),o=te(t,r);return c.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),x.jsx(V.div,{...e,ref:o})});Je.displayName=Qe;function et(e,t=globalThis==null?void 0:globalThis.document){const n=M(e),r=c.useRef(!1),o=c.useRef(()=>{});return c.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let h=function(){ge(Ze,n,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=h,t.addEventListener("click",o.current,{once:!0})):h()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function tt(e,t=globalThis==null?void 0:globalThis.document){const n=M(e),r=c.useRef(!1);return c.useEffect(()=>{const o=i=>{i.target&&!r.current&&ge(Ge,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ae(){const e=new CustomEvent(J);document.dispatchEvent(e)}function ge(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Xe(o,i):o.dispatchEvent(i)}var X="focusScope.autoFocusOnMount",H="focusScope.autoFocusOnUnmount",ce={bubbles:!1,cancelable:!0},nt="FocusScope",rt=c.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=e,[a,h]=c.useState(null),l=M(o),f=M(i),d=c.useRef(null),v=te(t,u=>h(u)),y=c.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;c.useEffect(()=>{if(r){let u=function(b){if(y.paused||!a)return;const S=b.target;a.contains(S)?d.current=S:O(d.current,{select:!0})},m=function(b){if(y.paused||!a)return;const S=b.relatedTarget;S!==null&&(a.contains(S)||O(d.current,{select:!0}))},p=function(b){if(document.activeElement===document.body)for(const C of b)C.removedNodes.length>0&&O(a)};document.addEventListener("focusin",u),document.addEventListener("focusout",m);const g=new MutationObserver(p);return a&&g.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",u),document.removeEventListener("focusout",m),g.disconnect()}}},[r,a,y.paused]),c.useEffect(()=>{if(a){se.add(y);const u=document.activeElement;if(!a.contains(u)){const p=new CustomEvent(X,ce);a.addEventListener(X,l),a.dispatchEvent(p),p.defaultPrevented||(ot(ut(be(a)),{select:!0}),document.activeElement===u&&O(a))}return()=>{a.removeEventListener(X,l),setTimeout(()=>{const p=new CustomEvent(H,ce);a.addEventListener(H,f),a.dispatchEvent(p),p.defaultPrevented||O(u??document.body,{select:!0}),a.removeEventListener(H,f),se.remove(y)},0)}}},[a,l,f,y]);const w=c.useCallback(u=>{if(!n&&!r||y.paused)return;const m=u.key==="Tab"&&!u.altKey&&!u.ctrlKey&&!u.metaKey,p=document.activeElement;if(m&&p){const g=u.currentTarget,[b,S]=at(g);b&&S?!u.shiftKey&&p===S?(u.preventDefault(),n&&O(b,{select:!0})):u.shiftKey&&p===b&&(u.preventDefault(),n&&O(S,{select:!0})):p===g&&u.preventDefault()}},[n,r,y.paused]);return x.jsx(V.div,{tabIndex:-1,...s,ref:v,onKeyDown:w})});rt.displayName=nt;function ot(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(O(r,{select:t}),document.activeElement!==n)return}function at(e){const t=be(e),n=ie(t,e),r=ie(t.reverse(),e);return[n,r]}function be(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ie(e,t){for(const n of e)if(!ct(n,{upTo:t}))return n}function ct(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function it(e){return e instanceof HTMLInputElement&&"select"in e}function O(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&it(e)&&t&&e.select()}}var se=st();function st(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=ue(e,t),e.unshift(t)},remove(t){var n;e=ue(e,t),(n=e[0])==null||n.resume()}}}function ue(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function ut(e){return e.filter(t=>t.tagName!=="A")}var lt="Portal",ft=c.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,i]=c.useState(!1);ne(()=>i(!0),[]);const s=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?De.createPortal(x.jsx(V.div,{...r,ref:t}),s):null});ft.displayName=lt;var z=0;function rn(){c.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??le()),document.body.insertAdjacentElement("beforeend",e[1]??le()),z++,()=>{z===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),z--}},[])}function le(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var R=function(){return R=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},R.apply(this,arguments)};function Se(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function dt(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var U="right-scroll-bar-position",$="width-before-scroll-bar",vt="with-scroll-bars-hidden",ht="--removed-body-scroll-bar-size";function Z(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function mt(e,t){var n=c.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var pt=typeof window<"u"?c.useLayoutEffect:c.useEffect,fe=new WeakMap;function yt(e,t){var n=mt(null,function(r){return e.forEach(function(o){return Z(o,r)})});return pt(function(){var r=fe.get(n);if(r){var o=new Set(r),i=new Set(e),s=n.current;o.forEach(function(a){i.has(a)||Z(a,null)}),i.forEach(function(a){o.has(a)||Z(a,s)})}fe.set(n,e)},[e]),n}function Et(e){return e}function gt(e,t){t===void 0&&(t=Et);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var s=t(i,r);return n.push(s),function(){n=n.filter(function(a){return a!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var a=n;n=[],a.forEach(i),s=n}var h=function(){var f=s;s=[],f.forEach(i)},l=function(){return Promise.resolve().then(h)};l(),n={push:function(f){s.push(f),l()},filter:function(f){return s=s.filter(f),n}}}};return o}function bt(e){e===void 0&&(e={});var t=gt(null);return t.options=R({async:!0,ssr:!1},e),t}var we=function(e){var t=e.sideCar,n=Se(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return c.createElement(r,R({},n))};we.isSideCarExport=!0;function St(e,t){return e.useMedium(t),we}var Ce=bt(),G=function(){},K=c.forwardRef(function(e,t){var n=c.useRef(null),r=c.useState({onScrollCapture:G,onWheelCapture:G,onTouchMoveCapture:G}),o=r[0],i=r[1],s=e.forwardProps,a=e.children,h=e.className,l=e.removeScrollBar,f=e.enabled,d=e.shards,v=e.sideCar,y=e.noRelative,w=e.noIsolation,u=e.inert,m=e.allowPinchZoom,p=e.as,g=p===void 0?"div":p,b=e.gapMode,S=Se(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=v,P=yt([n,t]),E=R(R({},S),o);return c.createElement(c.Fragment,null,f&&c.createElement(C,{sideCar:Ce,removeScrollBar:l,shards:d,noRelative:y,noIsolation:w,inert:u,setCallbacks:i,allowPinchZoom:!!m,lockRef:n,gapMode:b}),s?c.cloneElement(c.Children.only(a),R(R({},E),{ref:P})):c.createElement(g,R({},E,{className:h,ref:P}),a))});K.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};K.classNames={fullWidth:$,zeroRight:U};var wt=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Ct(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=wt();return t&&e.setAttribute("nonce",t),e}function Pt(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Rt(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var xt=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ct())&&(Pt(t,n),Rt(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Ot=function(){var e=xt();return function(t,n){c.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Pe=function(){var e=Ot(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Tt={left:0,top:0,right:0,gap:0},q=function(e){return parseInt(e||"",10)||0},Lt=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[q(n),q(r),q(o)]},Nt=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Tt;var t=Lt(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},At=Pe(),k="data-scroll-locked",Dt=function(e,t,n,r){var o=e.left,i=e.top,s=e.right,a=e.gap;return n===void 0&&(n="margin"),`
2
2
  .`.concat(vt,` {
3
3
  overflow: hidden `).concat(r,`;
4
4
  padding-right: `).concat(a,"px ").concat(r,`;
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-DJ8w4e0l.js";/**
1
+ import{c as a}from"./index-COxSYBjE.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-DJ8w4e0l.js";/**
1
+ import{c as o}from"./index-COxSYBjE.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-DJ8w4e0l.js";/**
1
+ import{c as e}from"./index-COxSYBjE.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1 @@
1
+ import{D as t}from"./index-COxSYBjE.js";const e=()=>t.get("/projects"),r=o=>t.get(`/projects/${o}`);export{r as g,e as l};
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-DJ8w4e0l.js";/**
1
+ import{c as a}from"./index-COxSYBjE.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-DJ8w4e0l.js";/**
1
+ import{c}from"./index-COxSYBjE.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-DJ8w4e0l.js";/**
1
+ import{c as e}from"./index-COxSYBjE.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-DJ8w4e0l.js";/**
1
+ import{c as o}from"./index-COxSYBjE.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{D as o}from"./index-DJ8w4e0l.js";const i=s=>o.get(`/projects/${s}/sessions`),c=(s,e,t)=>o.get(`/projects/${s}/sessions/${e}`,{history_limit:String(t)}),r=(s,e,t)=>o.patch(`/projects/${s}/sessions/${e}`,t),a=(s,e)=>o.delete(`/projects/${s}/sessions/${e}`),p=(s,e)=>o.post(`/projects/${s}/sessions/switch`,e),$=(s,e)=>o.post(`/projects/${s}/send`,e);export{$ as a,a as d,c as g,i as l,r,p as s};
1
+ import{D as o}from"./index-COxSYBjE.js";const i=s=>o.get(`/projects/${s}/sessions`),c=(s,e,t)=>o.get(`/projects/${s}/sessions/${e}`,{history_limit:String(t)}),r=(s,e,t)=>o.patch(`/projects/${s}/sessions/${e}`,t),a=(s,e)=>o.delete(`/projects/${s}/sessions/${e}`),p=(s,e)=>o.post(`/projects/${s}/sessions/switch`,e),$=(s,e)=>o.post(`/projects/${s}/send`,e);export{$ as a,a as d,c as g,i as l,r,p as s};
@@ -1,4 +1,4 @@
1
- import{c}from"./index-DJ8w4e0l.js";/**
1
+ import{c}from"./index-COxSYBjE.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-DJ8w4e0l.js";/**
1
+ import{c as e}from"./index-COxSYBjE.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-DJ8w4e0l.js";/**
1
+ import{c}from"./index-COxSYBjE.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-DJ8w4e0l.js";/**
1
+ import{c as a}from"./index-COxSYBjE.js";/**
2
2
  * @license lucide-react v0.487.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="./favicon.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>AgentDock</title>
8
- <script type="module" crossorigin src="./assets/index-DJ8w4e0l.js"></script>
8
+ <script type="module" crossorigin src="./assets/index-COxSYBjE.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="./assets/index-CjCuR6DI.css">
10
10
  </head>
11
11
  <body class="bg-[#f5f5f7] dark:bg-[#151516]">
@@ -15,7 +15,7 @@ const index_js_1 = require("../agents/index.js");
15
15
  const scheduled_job_route_js_1 = require("../scheduler/scheduled-job-route.js");
16
16
  const thread_slash_command_dispatcher_js_1 = require("../thread/thread-slash-command-dispatcher.js");
17
17
  const local_core_errors_js_1 = require("../kernel/local-core-errors.js");
18
- const ACP_PROMPT_TIMEOUT_MS = 15 * 60 * 1000;
18
+ const ACP_PROMPT_TIMEOUT_MS = 180 * 60 * 1000;
19
19
  class LocalCoreAcpBackend {
20
20
  options;
21
21
  transport;
@@ -36,13 +36,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.LocalCoreLarkGateway = void 0;
37
37
  const node_crypto_1 = require("node:crypto");
38
38
  const node_fs_1 = require("node:fs");
39
- const promises_1 = require("node:fs/promises");
40
39
  const node_path_1 = require("node:path");
41
- const promises_2 = require("node:stream/promises");
42
40
  const local_core_errors_js_1 = require("../../kernel/local-core-errors.js");
43
41
  const desktop_js_1 = require("../../../../../shared/desktop.js");
44
42
  const content_js_1 = require("../shared/content.js");
45
43
  const file_utils_js_1 = require("../shared/file-utils.js");
44
+ const inbound_attachment_store_js_1 = require("../shared/inbound-attachment-store.js");
46
45
  const thread_routing_js_1 = require("../shared/thread-routing.js");
47
46
  const base_channel_gateway_js_1 = require("../shared/base-channel-gateway.js");
48
47
  const cards_js_1 = require("./cards.js");
@@ -65,6 +64,7 @@ class LocalCoreLarkGateway extends base_channel_gateway_js_1.BaseChannelGateway
65
64
  mirrorPermissionStateInMainCard = false;
66
65
  larkModulePromise = null;
67
66
  emptyRenderLogWindows = new Map();
67
+ inboundAttachmentStore = new inbound_attachment_store_js_1.FileSystemInboundAttachmentStore();
68
68
  platform = 'lark';
69
69
  constructor(options) {
70
70
  super(options);
@@ -671,6 +671,8 @@ class LocalCoreLarkGateway extends base_channel_gateway_js_1.BaseChannelGateway
671
671
  return;
672
672
  }
673
673
  const { message, parsedContent, messageType, chatType, mentions, text, platformUserId, chatId, displayName, messageId, } = normalized.message;
674
+ const mayMaterializeAttachments = Boolean(runtimeState?.autoApprove
675
+ || this.options.store.getAuthorizedUser(workspaceId, platformUserId, platformKey));
674
676
  const contentParts = [];
675
677
  if (text) {
676
678
  contentParts.push({ type: 'text', text });
@@ -678,26 +680,37 @@ class LocalCoreLarkGateway extends base_channel_gateway_js_1.BaseChannelGateway
678
680
  if (messageType === 'image') {
679
681
  const imageKey = String(parsedContent.image_key || parsedContent.file_key || '').trim();
680
682
  if (imageKey) {
681
- try {
682
- contentParts.push(await this.downloadMessageImage(workspaceId, String(message.message_id || ''), imageKey, instanceId));
683
+ if (!mayMaterializeAttachments) {
684
+ contentParts.push({ type: 'text', text: '[Image]' });
683
685
  }
684
- catch (error) {
685
- const errorText = `[Image download failed: ${error instanceof Error ? error.message : String(error)}]`;
686
- contentParts.push({ type: 'text', text: errorText });
687
- this.options.log?.(`localcore-lark image download failed for ${workspaceId}: message=${String(message.message_id || '')} imageKey=${imageKey} error=${error instanceof Error ? error.message : String(error)}`);
686
+ else {
687
+ try {
688
+ contentParts.push(await this.downloadMessageImage(workspaceId, String(message.message_id || ''), imageKey, instanceId));
689
+ }
690
+ catch (error) {
691
+ const errorText = `[Image download failed: ${error instanceof Error ? error.message : String(error)}]`;
692
+ contentParts.push({ type: 'text', text: errorText });
693
+ this.options.log?.(`localcore-lark image download failed for ${workspaceId}: message=${String(message.message_id || '')} imageKey=${imageKey} error=${error instanceof Error ? error.message : String(error)}`);
694
+ }
688
695
  }
689
696
  }
690
697
  }
691
698
  if (messageType === 'file') {
692
699
  const fileKey = String(parsedContent.file_key || '').trim();
693
700
  if (fileKey) {
694
- try {
695
- contentParts.push(await this.downloadMessageFile(workspaceId, String(message.message_id || ''), fileKey, String(parsedContent.file_name || parsedContent.name || '').trim(), instanceId));
701
+ if (!mayMaterializeAttachments) {
702
+ const inboundFileName = String(parsedContent.file_name || parsedContent.name || '').trim();
703
+ contentParts.push({ type: 'text', text: inboundFileName ? `[File: ${inboundFileName}]` : '[File]' });
696
704
  }
697
- catch (error) {
698
- const errorText = `[File download failed: ${error instanceof Error ? error.message : String(error)}]`;
699
- contentParts.push({ type: 'text', text: errorText });
700
- this.options.log?.(`localcore-lark file download failed for ${workspaceId}: message=${String(message.message_id || '')} fileKey=${fileKey} error=${error instanceof Error ? error.message : String(error)}`);
705
+ else {
706
+ try {
707
+ contentParts.push(await this.downloadMessageFile(workspaceId, String(message.message_id || ''), fileKey, String(parsedContent.file_name || parsedContent.name || '').trim(), instanceId));
708
+ }
709
+ catch (error) {
710
+ const errorText = `[File download failed: ${error instanceof Error ? error.message : String(error)}]`;
711
+ contentParts.push({ type: 'text', text: errorText });
712
+ this.options.log?.(`localcore-lark file download failed for ${workspaceId}: message=${String(message.message_id || '')} fileKey=${fileKey} error=${error instanceof Error ? error.message : String(error)}`);
713
+ }
701
714
  }
702
715
  }
703
716
  }
@@ -727,25 +740,44 @@ class LocalCoreLarkGateway extends base_channel_gateway_js_1.BaseChannelGateway
727
740
  if (!messageId) {
728
741
  throw new Error('Lark image message is missing message_id');
729
742
  }
730
- const resource = await state.client.im.messageResource.get({
731
- path: {
732
- message_id: messageId,
733
- file_key: imageKey,
734
- },
735
- params: {
736
- type: 'image',
743
+ const downloadsDir = await this.resolveInboundDownloadsDir(workspaceId, instanceId, state.downloadsDir);
744
+ const stored = await this.inboundAttachmentStore.save({
745
+ directory: downloadsDir,
746
+ storedFileName: `${messageId}-${imageKey}`,
747
+ displayFileName: imageKey,
748
+ maxBytes: LARK_MAX_UPLOAD_FILE_SIZE,
749
+ includeBase64: true,
750
+ finalizeStoredFileName: ({ storedFileName, prefix }) => `${storedFileName}.${this.sniffImageExtension(prefix)}`,
751
+ source: {
752
+ open: async () => {
753
+ const resource = await state.client.im.messageResource.get({
754
+ path: {
755
+ message_id: messageId,
756
+ file_key: imageKey,
757
+ },
758
+ params: {
759
+ type: 'image',
760
+ },
761
+ });
762
+ const stream = resource?.getReadableStream?.();
763
+ if (!stream || typeof stream.pipe !== 'function') {
764
+ throw new Error('Lark image resource did not provide a readable stream');
765
+ }
766
+ return {
767
+ stream,
768
+ mimeType: this.extractHeaderMimeType(resource?.headers),
769
+ };
770
+ },
737
771
  },
738
772
  });
739
- const buffer = await this.readLarkResourceBuffer(resource);
740
- if (buffer.length === 0) {
741
- throw new Error('Lark image resource is empty');
742
- }
743
- const headerMime = this.extractHeaderMimeType(resource?.headers);
773
+ const extension = (0, node_path_1.extname)(stored.path).slice(1) || 'bin';
774
+ const uri = await this.resolveInboundAttachmentUri(workspaceId, stored.path, instanceId);
744
775
  return {
745
776
  type: 'image',
746
- data: buffer.toString('base64'),
747
- mimeType: headerMime || this.sniffImageMimeType(buffer),
748
- fileName: `${imageKey}.${this.sniffImageExtension(buffer)}`,
777
+ data: stored.data || '',
778
+ ...(uri ? { uri } : {}),
779
+ mimeType: stored.mimeType || this.sniffImageMimeType(stored.prefix),
780
+ fileName: `${imageKey}.${extension}`,
749
781
  };
750
782
  }
751
783
  async downloadMessageFile(workspaceId, messageId, fileKey, fileName, instanceId) {
@@ -757,42 +789,40 @@ class LocalCoreLarkGateway extends base_channel_gateway_js_1.BaseChannelGateway
757
789
  throw new Error('Lark file message is missing message_id');
758
790
  }
759
791
  const downloadsDir = await this.resolveInboundDownloadsDir(workspaceId, instanceId, state.downloadsDir);
760
- const storedFileName = `${this.safeInboundFilePart(messageId, 'message')}-${this.safeInboundFilePart(fileName || fileKey, 'file')}`;
761
- const filePath = (0, node_path_1.join)(downloadsDir, storedFileName);
762
- const temporaryPath = `${filePath}.${(0, node_crypto_1.randomUUID)()}.part`;
763
- const resource = await state.client.im.messageResource.get({
764
- path: {
765
- message_id: messageId,
766
- file_key: fileKey,
767
- },
768
- params: {
769
- type: 'file',
792
+ const displayFileName = fileName || fileKey;
793
+ const stored = await this.inboundAttachmentStore.save({
794
+ directory: downloadsDir,
795
+ storedFileName: `${messageId}-${displayFileName}`,
796
+ displayFileName,
797
+ maxBytes: LARK_MAX_UPLOAD_FILE_SIZE,
798
+ source: {
799
+ open: async () => {
800
+ const resource = await state.client.im.messageResource.get({
801
+ path: {
802
+ message_id: messageId,
803
+ file_key: fileKey,
804
+ },
805
+ params: {
806
+ type: 'file',
807
+ },
808
+ });
809
+ const stream = resource?.getReadableStream?.();
810
+ if (!stream || typeof stream.pipe !== 'function') {
811
+ throw new Error('Lark file resource did not provide a readable stream');
812
+ }
813
+ return {
814
+ stream,
815
+ mimeType: this.extractHeaderMimeType(resource?.headers) || 'application/octet-stream',
816
+ };
817
+ },
770
818
  },
771
819
  });
772
- const readable = resource?.getReadableStream?.();
773
- if (!readable || typeof readable.pipe !== 'function') {
774
- throw new Error('Lark file resource did not provide a readable stream');
775
- }
776
- await (0, promises_1.mkdir)(downloadsDir, { recursive: true });
777
- try {
778
- await (0, promises_2.pipeline)(readable, (0, node_fs_1.createWriteStream)(temporaryPath, { flags: 'wx' }));
779
- const temporaryStat = await (0, promises_1.stat)(temporaryPath);
780
- if (temporaryStat.size === 0) {
781
- throw new Error('Lark file resource is empty');
782
- }
783
- await (0, promises_1.rename)(temporaryPath, filePath);
784
- }
785
- catch (error) {
786
- await (0, promises_1.rm)(temporaryPath, { force: true }).catch(() => undefined);
787
- throw error;
788
- }
789
- const fileStat = await (0, promises_1.stat)(filePath);
790
820
  return {
791
821
  type: 'file',
792
- path: filePath,
793
- mimeType: this.extractHeaderMimeType(resource?.headers) || 'application/octet-stream',
794
- fileName: fileName || fileKey,
795
- size: fileStat.size,
822
+ path: stored.path,
823
+ fileName: stored.fileName,
824
+ mimeType: stored.mimeType,
825
+ size: stored.size,
796
826
  };
797
827
  }
798
828
  async resolveInboundDownloadsDir(workspaceId, instanceId = 'default', runtimeDownloadsDir) {
@@ -808,10 +838,25 @@ class LocalCoreLarkGateway extends base_channel_gateway_js_1.BaseChannelGateway
808
838
  ? (0, node_path_1.resolve)(workspace.path, configuredDir)
809
839
  : (0, node_path_1.join)(workspace.path, '.agentdock', 'channel-uploads', 'lark', instanceId);
810
840
  }
811
- safeInboundFilePart(value, fallback) {
812
- return String(value || fallback)
813
- .replace(/[^a-zA-Z0-9._-]/g, '_')
814
- .slice(0, 120) || fallback;
841
+ async resolveInboundAttachmentUri(workspaceId, filePath, instanceId = 'default') {
842
+ const binding = await this.getBinding(workspaceId, instanceId).catch(() => undefined);
843
+ if (!binding) {
844
+ return undefined;
845
+ }
846
+ const sandbox = binding.project.agent?.options?.sandbox;
847
+ if (!sandbox?.enabled) {
848
+ return (0, inbound_attachment_store_js_1.resolveInboundAttachmentUri)({ filePath });
849
+ }
850
+ const workspace = await this.options.getWorkspaceRouter().getWorkspaceRegistryEntry(workspaceId).catch(() => undefined);
851
+ if (!workspace) {
852
+ return undefined;
853
+ }
854
+ return (0, inbound_attachment_store_js_1.resolveInboundAttachmentUri)({
855
+ filePath,
856
+ workspacePath: workspace.path,
857
+ sandboxEnabled: true,
858
+ sandboxWorkspacePath: sandbox.workspace_mount_path,
859
+ });
815
860
  }
816
861
  summarizeInboundContentParts(parts) {
817
862
  const text = parts
@@ -836,21 +881,6 @@ class LocalCoreLarkGateway extends base_channel_gateway_js_1.BaseChannelGateway
836
881
  .join('\n');
837
882
  return attachmentSummary;
838
883
  }
839
- async readLarkResourceBuffer(resource) {
840
- const readable = resource?.getReadableStream?.();
841
- if (!readable || typeof readable.on !== 'function') {
842
- throw new Error('Lark resource did not provide a readable stream');
843
- }
844
- const chunks = [];
845
- await new Promise((resolve, reject) => {
846
- readable.on('data', (chunk) => {
847
- chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
848
- });
849
- readable.on('error', reject);
850
- readable.on('end', resolve);
851
- });
852
- return Buffer.concat(chunks);
853
- }
854
884
  extractHeaderMimeType(headers) {
855
885
  const value = headers && typeof headers === 'object'
856
886
  ? headers['content-type'] || headers['Content-Type']
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FileSystemInboundAttachmentStore = void 0;
4
+ exports.sanitizeInboundFilePart = sanitizeInboundFilePart;
5
+ exports.resolveInboundAttachmentUri = resolveInboundAttachmentUri;
6
+ const node_crypto_1 = require("node:crypto");
7
+ const node_fs_1 = require("node:fs");
8
+ const promises_1 = require("node:fs/promises");
9
+ const node_path_1 = require("node:path");
10
+ const node_stream_1 = require("node:stream");
11
+ const promises_2 = require("node:stream/promises");
12
+ const node_url_1 = require("node:url");
13
+ class FileSystemInboundAttachmentStore {
14
+ async save(input) {
15
+ const storedFileName = sanitizeInboundFilePart(input.storedFileName, 'file');
16
+ const temporaryPath = (0, node_path_1.join)(input.directory, `.${storedFileName}.${(0, node_crypto_1.randomUUID)()}.part`);
17
+ await (0, promises_1.mkdir)(input.directory, { recursive: true });
18
+ const opened = await input.source.open();
19
+ let size = 0;
20
+ let prefix = Buffer.alloc(0);
21
+ const sizeLimiter = new node_stream_1.Transform({
22
+ transform(chunk, _encoding, callback) {
23
+ const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
24
+ if (prefix.length < 16) {
25
+ prefix = Buffer.concat([prefix, buffer.subarray(0, 16 - prefix.length)]);
26
+ }
27
+ size += buffer.length;
28
+ if (input.maxBytes && size > input.maxBytes) {
29
+ callback(new Error(`Inbound attachment exceeds ${input.maxBytes} bytes`));
30
+ return;
31
+ }
32
+ callback(null, buffer);
33
+ },
34
+ });
35
+ let filePath = '';
36
+ try {
37
+ await (0, promises_2.pipeline)(opened.stream, sizeLimiter, (0, node_fs_1.createWriteStream)(temporaryPath, { flags: 'wx' }));
38
+ if (size === 0) {
39
+ throw new Error('Inbound attachment is empty');
40
+ }
41
+ const finalizedName = input.finalizeStoredFileName
42
+ ? input.finalizeStoredFileName({ storedFileName, prefix })
43
+ : storedFileName;
44
+ filePath = (0, node_path_1.join)(input.directory, sanitizeInboundFilePart(finalizedName, storedFileName));
45
+ await (0, promises_1.rename)(temporaryPath, filePath);
46
+ const includeBase64 = typeof input.includeBase64 === 'function'
47
+ ? input.includeBase64({ prefix })
48
+ : input.includeBase64;
49
+ const data = includeBase64
50
+ ? (await (0, promises_1.readFile)(filePath)).toString('base64')
51
+ : undefined;
52
+ const fileStat = await (0, promises_1.stat)(filePath);
53
+ return {
54
+ path: filePath,
55
+ fileName: input.displayFileName,
56
+ mimeType: opened.mimeType,
57
+ size: fileStat.size,
58
+ data,
59
+ prefix,
60
+ };
61
+ }
62
+ catch (error) {
63
+ await (0, promises_1.rm)(temporaryPath, { force: true }).catch(() => undefined);
64
+ if (filePath) {
65
+ await (0, promises_1.rm)(filePath, { force: true }).catch(() => undefined);
66
+ }
67
+ throw error;
68
+ }
69
+ }
70
+ }
71
+ exports.FileSystemInboundAttachmentStore = FileSystemInboundAttachmentStore;
72
+ function sanitizeInboundFilePart(value, fallback) {
73
+ return String(value || fallback)
74
+ .replace(/[^a-zA-Z0-9._-]/g, '_')
75
+ .slice(0, 240) || fallback;
76
+ }
77
+ function resolveInboundAttachmentUri(input) {
78
+ if (!input.sandboxEnabled) {
79
+ return (0, node_url_1.pathToFileURL)(input.filePath).href;
80
+ }
81
+ const workspacePath = String(input.workspacePath || '').trim();
82
+ if (!workspacePath) {
83
+ return undefined;
84
+ }
85
+ const relativePath = (0, node_path_1.relative)((0, node_path_1.resolve)(workspacePath), (0, node_path_1.resolve)(input.filePath));
86
+ if (!relativePath || relativePath.startsWith('..') || (0, node_path_1.isAbsolute)(relativePath)) {
87
+ return relativePath === ''
88
+ ? new URL(node_path_1.posix.resolve(input.sandboxWorkspacePath || '/workspace'), 'file:///').href
89
+ : undefined;
90
+ }
91
+ const sandboxRelativePath = relativePath.split(node_path_1.sep).join('/');
92
+ return new URL(node_path_1.posix.resolve(input.sandboxWorkspacePath || '/workspace', sandboxRelativePath), 'file:///').href;
93
+ }