@buoy-gg/shared-ui 7.0.63 → 7.0.64

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 (121) hide show
  1. package/README.md +3 -0
  2. package/lib/commonjs/JsModal.web.js +1 -1
  3. package/lib/commonjs/clipboard/copyToClipboard.js +1 -1
  4. package/lib/commonjs/dataViewer/VirtualizedDataExplorer.js +1 -1
  5. package/lib/commonjs/hooks/useDeviceInfo.js +1 -1
  6. package/lib/commonjs/license/AccountSetup.web.js +2 -2
  7. package/lib/commonjs/settings/components/BubbleSettingsSection.js +1 -1
  8. package/lib/commonjs/storage/buoyOwnership.js +1 -0
  9. package/lib/commonjs/storage/buoyOwnership.test.js +1 -0
  10. package/lib/commonjs/storage/devToolsStorageKeys.js +1 -1
  11. package/lib/commonjs/storage/index.js +1 -1
  12. package/lib/commonjs/ui/components/ChangeRow.js +1 -1
  13. package/lib/commonjs/ui/components/CompactRow.js +1 -1
  14. package/lib/commonjs/ui/components/DataInspector.js +1 -1
  15. package/lib/commonjs/ui/components/DraggableHeader.js +1 -1
  16. package/lib/commonjs/ui/floating/FloatingTool.web.js +1 -1
  17. package/lib/commonjs/ui/floating/index.web.js +1 -1
  18. package/lib/commonjs/ui/floating/portalHost.test.js +1 -0
  19. package/lib/commonjs/ui/floating/portalHost.web.js +1 -0
  20. package/lib/commonjs/ui/fonts.js +1 -1
  21. package/lib/commonjs/ui/index.js +1 -1
  22. package/lib/commonjs/ui/systemFont.js +1 -0
  23. package/lib/commonjs/utils/loadOptionalModule.js +1 -1
  24. package/lib/commonjs/utils/minimalSuperJSON.js +1 -1
  25. package/lib/commonjs/utils/nativeWeb.js +1 -1
  26. package/lib/commonjs/utils/persistentStorage.js +1 -1
  27. package/lib/module/JsModal.web.js +1 -1
  28. package/lib/module/clipboard/copyToClipboard.js +1 -1
  29. package/lib/module/dataViewer/VirtualizedDataExplorer.js +1 -1
  30. package/lib/module/hooks/useDeviceInfo.js +1 -1
  31. package/lib/module/license/AccountSetup.web.js +2 -2
  32. package/lib/module/settings/components/BubbleSettingsSection.js +1 -1
  33. package/lib/module/storage/buoyOwnership.js +1 -0
  34. package/lib/module/storage/buoyOwnership.test.js +1 -0
  35. package/lib/module/storage/devToolsStorageKeys.js +1 -1
  36. package/lib/module/storage/index.js +1 -1
  37. package/lib/module/ui/components/ChangeRow.js +1 -1
  38. package/lib/module/ui/components/CompactRow.js +1 -1
  39. package/lib/module/ui/components/DataInspector.js +1 -1
  40. package/lib/module/ui/components/DraggableHeader.js +1 -1
  41. package/lib/module/ui/floating/FloatingTool.web.js +1 -1
  42. package/lib/module/ui/floating/index.web.js +1 -1
  43. package/lib/module/ui/floating/portalHost.test.js +1 -0
  44. package/lib/module/ui/floating/portalHost.web.js +1 -0
  45. package/lib/module/ui/fonts.js +1 -1
  46. package/lib/module/ui/index.js +1 -1
  47. package/lib/module/ui/systemFont.js +1 -0
  48. package/lib/module/utils/loadOptionalModule.js +1 -1
  49. package/lib/module/utils/minimalSuperJSON.js +1 -1
  50. package/lib/module/utils/nativeWeb.js +1 -1
  51. package/lib/module/utils/persistentStorage.js +1 -1
  52. package/lib/typescript/commonjs/hooks/safe-area-impl.d.ts +1 -1
  53. package/lib/typescript/commonjs/license/AccountSetup.web.d.ts +1 -1
  54. package/lib/typescript/commonjs/storage/buoyOwnership.d.ts +15 -0
  55. package/lib/typescript/commonjs/storage/buoyOwnership.test.d.ts +2 -0
  56. package/lib/typescript/commonjs/storage/index.d.ts +1 -0
  57. package/lib/typescript/commonjs/ui/floating/FloatingTool.web.d.ts +2 -2
  58. package/lib/typescript/commonjs/ui/floating/index.web.d.ts +1 -0
  59. package/lib/typescript/commonjs/ui/floating/portalHost.test.d.ts +2 -0
  60. package/lib/typescript/commonjs/ui/floating/portalHost.web.d.ts +8 -0
  61. package/lib/typescript/commonjs/ui/fonts.d.ts +1 -0
  62. package/lib/typescript/commonjs/ui/index.d.ts +1 -1
  63. package/lib/typescript/commonjs/ui/systemFont.d.ts +2 -0
  64. package/lib/typescript/module/hooks/safe-area-impl.d.ts +1 -1
  65. package/lib/typescript/module/license/AccountSetup.web.d.ts +1 -1
  66. package/lib/typescript/module/storage/buoyOwnership.d.ts +15 -0
  67. package/lib/typescript/module/storage/buoyOwnership.test.d.ts +2 -0
  68. package/lib/typescript/module/storage/index.d.ts +1 -0
  69. package/lib/typescript/module/ui/floating/FloatingTool.web.d.ts +2 -2
  70. package/lib/typescript/module/ui/floating/index.web.d.ts +1 -0
  71. package/lib/typescript/module/ui/floating/portalHost.test.d.ts +2 -0
  72. package/lib/typescript/module/ui/floating/portalHost.web.d.ts +8 -0
  73. package/lib/typescript/module/ui/fonts.d.ts +1 -0
  74. package/lib/typescript/module/ui/index.d.ts +1 -1
  75. package/lib/typescript/module/ui/systemFont.d.ts +2 -0
  76. package/lib/web/asyncStorage.mjs +1 -1
  77. package/lib/web/chunks/chunk-3HELV44Y.mjs +1 -0
  78. package/lib/web/chunks/chunk-4HIK66DZ.mjs +1 -0
  79. package/lib/web/chunks/chunk-4YLP5MMN.mjs +1 -0
  80. package/lib/web/chunks/chunk-5G6RSRP4.mjs +1 -0
  81. package/lib/web/chunks/chunk-7JJHWSTD.mjs +1 -0
  82. package/lib/web/chunks/chunk-AHVO74UQ.mjs +1 -0
  83. package/lib/web/chunks/chunk-CJTGUGMQ.mjs +1 -0
  84. package/lib/web/chunks/chunk-FA6WAQUA.mjs +6 -0
  85. package/lib/web/chunks/chunk-GMM6TGFO.mjs +1 -0
  86. package/lib/web/chunks/chunk-HIAN3HBD.mjs +1 -0
  87. package/lib/web/chunks/chunk-HPZXETRA.mjs +1 -0
  88. package/lib/web/chunks/chunk-NOSWH3E2.mjs +1 -0
  89. package/lib/web/chunks/chunk-OGAHL36T.mjs +15 -0
  90. package/lib/web/chunks/chunk-P32XO2YS.mjs +1 -0
  91. package/lib/web/chunks/chunk-SBYYOE2T.mjs +1 -0
  92. package/lib/web/chunks/chunk-T6T3FEMU.mjs +1 -0
  93. package/lib/web/chunks/chunk-VAR5UK6J.mjs +1 -0
  94. package/lib/web/chunks/persistentStorage.web-NOUYFUMM.mjs +1 -0
  95. package/lib/web/colors.mjs +1 -1
  96. package/lib/web/dataViewer.mjs +2 -2
  97. package/lib/web/floating.mjs +1 -1
  98. package/lib/web/history.mjs +1 -1
  99. package/lib/web/hooks.mjs +1 -1
  100. package/lib/web/index.mjs +3 -3
  101. package/lib/web/native.mjs +1 -1
  102. package/lib/web/ui.mjs +1 -1
  103. package/lib/web/utils.mjs +1 -1
  104. package/package.json +5 -5
  105. package/lib/web/chunks/chunk-3UTMGIUG.mjs +0 -1
  106. package/lib/web/chunks/chunk-4IM4VIMP.mjs +0 -1
  107. package/lib/web/chunks/chunk-53J2FMUD.mjs +0 -1
  108. package/lib/web/chunks/chunk-ASHW3TI7.mjs +0 -1
  109. package/lib/web/chunks/chunk-BZTGYXMT.mjs +0 -1
  110. package/lib/web/chunks/chunk-CE5U3CSQ.mjs +0 -1
  111. package/lib/web/chunks/chunk-E2MI3FII.mjs +0 -15
  112. package/lib/web/chunks/chunk-FP44YK4E.mjs +0 -1
  113. package/lib/web/chunks/chunk-GF364FIK.mjs +0 -1
  114. package/lib/web/chunks/chunk-L63X3LPR.mjs +0 -1
  115. package/lib/web/chunks/chunk-L7OYS724.mjs +0 -1
  116. package/lib/web/chunks/chunk-LZ7FZZ7R.mjs +0 -1
  117. package/lib/web/chunks/chunk-NVD5LLXD.mjs +0 -1
  118. package/lib/web/chunks/chunk-QNLAFQET.mjs +0 -1
  119. package/lib/web/chunks/chunk-SYU4BFQR.mjs +0 -6
  120. package/lib/web/chunks/chunk-UYWHGSA7.mjs +0 -1
  121. package/lib/web/chunks/persistentStorage.web-3QA77BIL.mjs +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Divider=Divider;exports.FloatingTool=FloatingTool;exports.UserStatus=UserStatus;exports.getBubbleAnchorPosition=getBubbleAnchorPosition;var _reactDom=require("react-dom");var _nightTheme=require("../night/nightTheme.js");var _react=require("react");var _onboardingConstantsWeb=require("./onboardingConstants.web.js");var _floating=require("@buoy-gg/floating-tools-react/floating");var _jsxRuntime=require("react/jsx-runtime");const EDGE_PADDING=10;const NATIVE_TOP_PADDING=20;function readSafeAreaInsets(){if(typeof document==="undefined"||!document.body)return{top:0,left:0,bottom:0};const t=document.createElement("div");t.style.cssText="position:fixed;top:0;left:0;visibility:hidden;pointer-events:none;padding-top:env(safe-area-inset-top);padding-left:env(safe-area-inset-left);padding-bottom:env(safe-area-inset-bottom)";document.body.appendChild(t);const s=getComputedStyle(t);const r={top:parseFloat(s.paddingTop)||0,left:parseFloat(s.paddingLeft)||0,bottom:parseFloat(s.paddingBottom)||0};document.body.removeChild(t);return r}const webStorageAdapter={getItem:t=>localStorage.getItem(t),setItem:(t,s)=>localStorage.setItem(t,s)};const NATIVE_TEXT_SECONDARY="#A0A0A0";function GripVerticalIcon({size:t=24,color:s=(0,_floating.withAlpha)(NATIVE_TEXT_SECONDARY,"CC")}){const r=(0,_floating.getGripIconLayout)(t);return(0,_jsxRuntime.jsx)("div",{style:{width:t,height:t,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center"},children:[0,1].map(c=>(0,_jsxRuntime.jsx)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",marginLeft:r.columnGap/2,marginRight:r.columnGap/2},children:[0,1,2].map(p=>(0,_jsxRuntime.jsx)("div",{style:{width:r.dotSize,height:r.dotSize,borderRadius:r.dotSize/2,backgroundColor:s,marginTop:r.rowGap/2,marginBottom:r.rowGap/2}},p))},c))})}function Divider(){return(0,_jsxRuntime.jsx)("div",{style:{width:1,height:12,backgroundColor:(0,_floating.withAlpha)(_floating.floatingToolsColors.muted,"66"),flexShrink:0}})}const userStatusColors={success:_floating.floatingToolsColors.success,optional:_floating.floatingToolsColors.optional,muted:_floating.floatingToolsColors.muted,secondary:NATIVE_TEXT_SECONDARY};function UserStatus({userRole:t,onPress:s}){const{isDragging:r}=(0,_floating.useFloatingToolsContext)();const c=(0,_floating.getUserStatusConfig)(t,userStatusColors);const p=f=>{if(!r&&s){f.stopPropagation();f.currentTarget.focus();s()}};return(0,_jsxRuntime.jsxs)("button",{role:"button","aria-label":s?"Open Dev Tools Menu":`User status: ${c.label}`,"data-testid":s?"open-dev-tools-button":void 0,onClick:p,style:{display:"flex",flexDirection:"row",alignItems:"center",paddingTop:6,paddingBottom:6,paddingLeft:8,paddingRight:8,flexShrink:0,cursor:s&&!r?"pointer":"default",background:"none",border:"none",margin:0},children:[(0,_jsxRuntime.jsx)("div",{style:{width:6,height:6,borderRadius:3,backgroundColor:c.dotColor,marginRight:4}}),(0,_jsxRuntime.jsx)("span",{style:{fontSize:10,fontWeight:500,color:c.textColor,letterSpacing:.3,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',lineHeight:"normal"},children:c.label})]})}function useWebAnimation(){const t=(0,_react.useRef)(null);const[s,r]=(0,_react.useState)({x:0,y:0});const c=(0,_react.useCallback)((p,f,T)=>{if(t.current){cancelAnimationFrame(t.current)}const P=performance.now();const b=m=>{const C=m-P;const w=Math.min(C/_floating.ANIMATION_DURATION,1);const D=(0,_floating.interpolatePosition)(p,f,w,_floating.easing.easeOutCubic);r(D);if(w<1){t.current=requestAnimationFrame(b)}else{r(f);T?.()}};t.current=requestAnimationFrame(b)},[]);(0,_react.useEffect)(()=>{return()=>{if(t.current){cancelAnimationFrame(t.current)}}},[]);return{position:s,setPosition:r,animateTo:c}}let lastBubbleAnchor=null;function getBubbleAnchorPosition(){return lastBubbleAnchor}function FloatingTool({id:t,revealToken:s,variant:r="bubble",dragFromSurface:c=false,accessibilityLabel:p="Drag handle",accessory:f,handleAdornment:T,enablePositionPersistence:P=true,children:b,pushToSide:m=false,suspendPointerEvents:C=false,centerOnboarding:w=false,minimizedStack:D,hasMinimizedStack:L=false}){const h=(0,_react.useRef)(null);const M=(0,_react.useMemo)(()=>t?{getItem:e=>webStorageAdapter.getItem(`@buoy/floating-tool/${t}/${e}`),setItem:(e,i)=>webStorageAdapter.setItem(`@buoy/floating-tool/${t}/${e}`,i)}:webStorageAdapter,[t]);const{state:o,actions:n,isInitialized:d}=(0,_floating.useFloatingTools)({screenSize:{width:window.innerWidth,height:window.innerHeight},enablePositionPersistence:P,storage:M});const{position:u,setPosition:S,animateTo:g}=useWebAnimation();(0,_react.useEffect)(()=>{if(d){S(o.position)}},[d,o.position,S]);(0,_react.useEffect)(()=>{if(!t)lastBubbleAnchor={x:u.x,y:u.y}},[u,t]);(0,_react.useEffect)(()=>{if(!d)return;const e=()=>{const l=h.current?.getBoundingClientRect();if(l&&l.width>0&&l.height>0)n.setBubbleSize({width:l.width,height:l.height})};const i=()=>{const l=readSafeAreaInsets().bottom;n.setScreenSize(window.innerWidth,window.innerHeight-(l>0?l-EDGE_PADDING:0));e()};e();const a=typeof ResizeObserver!=="undefined"?new ResizeObserver(e):null;if(h.current)a?.observe(h.current);window.addEventListener("resize",i);return()=>{a?.disconnect();window.removeEventListener("resize",i)}},[n,d]);const[W,F]=(0,_react.useState)(0);(0,_react.useEffect)(()=>{let e=false;const i=()=>{const a=readSafeAreaInsets();F(a.top);if(a.top>0||a.left>0||a.bottom>0){e=true;n.setMinPosition({x:a.left,y:a.top+NATIVE_TOP_PADDING});n.setScreenSize(window.innerWidth,window.innerHeight-(a.bottom>0?a.bottom-EDGE_PADDING:0))}else if(e){e=false;n.setMinPosition({x:EDGE_PADDING,y:EDGE_PADDING});n.setScreenSize(window.innerWidth,window.innerHeight)}};i();window.addEventListener("resize",i);return()=>window.removeEventListener("resize",i)},[n]);const[z,B]=(0,_react.useState)(false);const k=(0,_react.useCallback)(e=>{e.stopPropagation();e.preventDefault();B(true);n.handleDragStart({clientX:e.clientX,clientY:e.clientY})},[n]);const E=(0,_react.useRef)(false);const G=e=>{if(e.button!==0||!(e.target instanceof Element))return;if(e.target.closest('button, a, input, select, textarea, [role="button"], [role="switch"], [role="slider"], [role="checkbox"], [role="radio"], [contenteditable="true"], [data-floating-accessory]'))return;E.current=true;k(e)};const H=(0,_react.useCallback)(e=>{const i=n.handleDragMove({clientX:e.clientX,clientY:e.clientY});if(i.isDragging){S(i.position)}},[n,S]);const x=(0,_react.useCallback)(e=>{B(false);const i=n.handleDragEnd({clientX:e.clientX,clientY:e.clientY});const a=E.current;E.current=false;if(i.wasTap&&!a){const l=n.toggleHideShow();g(o.position,l.targetPosition,()=>{n.commitPosition(l.targetPosition)})}else if(i.shouldHide){g(o.position,i.position,()=>{n.commitPosition(i.position)})}},[n,g,o.position]);(0,_react.useEffect)(()=>{if(z){window.addEventListener("pointermove",H);window.addEventListener("pointerup",x);window.addEventListener("pointercancel",x);return()=>{window.removeEventListener("pointermove",H);window.removeEventListener("pointerup",x);window.removeEventListener("pointercancel",x)}}},[z,H,x]);const A=(0,_react.useRef)(o.position);A.current=o.position;const j=(0,_react.useRef)(o.isHidden);j.current=o.isHidden;const R=(0,_react.useRef)(false);(0,_react.useEffect)(()=>{if(!d)return;if(m&&!R.current){if(j.current)return;R.current=true;const{targetPosition:e}=n.forceHide();g(A.current,e,()=>{})}else if(!m&&R.current){R.current=false;if(!j.current)return;const{targetPosition:e}=n.forceShow();const i=h.current?.getBoundingClientRect().width??100;const a={x:Math.max(10,Math.min(e.x,window.innerWidth-i-10)),y:e.y};g(A.current,a,()=>{n.commitPosition(a)})}},[m,d]);(0,_react.useEffect)(()=>{if(!w||!d)return;const e=h.current?.getBoundingClientRect().width??100;const i=h.current?.getBoundingClientRect().height??32;const a=(0,_onboardingConstantsWeb.calculateTargetPosition)();const l={x:(window.innerWidth-e)/2,y:window.innerHeight-a-i};g(A.current,l,()=>{})},[w,d]);const _=(0,_react.useRef)(void 0);(0,_react.useEffect)(()=>{if(!d||_.current===s)return;_.current=s;if(s!==void 0&&s>0&&o.isHidden){const{targetPosition:e}=n.forceShow();g(o.position,e,()=>n.commitPosition(e))}},[s,d,o.isHidden,o.position,n,g]);const N=(0,_react.useMemo)(()=>r==="strip"?_react.Children.toArray(b):(0,_floating.interleaveWithDividers)(_react.Children.toArray(b),e=>(0,_jsxRuntime.jsx)(Divider,{},e)),[b,r]);if(!d){return null}const y=Math.max(0,u.y-W-8);const I=Math.max(0,window.innerHeight-u.y-o.bubbleSize.height-8);const Y=y>I;const v=y>=48||y>=I;return(0,_jsxRuntime.jsxs)("div",{ref:h,"data-testid":t??"buoy-floating-tool",role:"toolbar","aria-label":"Floating Tools",onPointerDown:c?G:void 0,style:{position:"fixed",left:u.x,top:u.y,zIndex:m?8999:9999,display:"flex",flexDirection:"row",alignItems:"center",backgroundColor:_floating.floatingToolsColors.panel,borderTopLeftRadius:L?0:6,borderTopRightRadius:6,borderBottomLeftRadius:6,borderBottomRightRadius:6,borderWidth:o.isDragging?2:1,borderTopWidth:o.isDragging?2:L?0:1,borderStyle:"solid",borderColor:o.isDragging?_floating.floatingToolsColors.dragActive:(0,_floating.withAlpha)(_floating.floatingToolsColors.muted,"66"),boxShadow:o.isDragging?`0 6px 12px ${(0,_floating.withAlpha)(_floating.floatingToolsColors.dragActive,.36)}`:"0 4px 8px rgba(0, 0, 0, 0.3)",cursor:c?o.isDragging?"grabbing":"grab":void 0,userSelect:"none",touchAction:"none",pointerEvents:C?"none":"auto",...r==="strip"?{borderRadius:_nightTheme.night.radius.card,minHeight:48,backgroundColor:_nightTheme.night.color.surface,borderColor:o.isDragging?_nightTheme.night.color.accentBorderStrong:_nightTheme.night.color.separator,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.24)"}:{}},children:[D&&(0,_reactDom.createPortal)((0,_jsxRuntime.jsx)("div",{style:{position:"fixed",top:v?u.y:u.y+o.bubbleSize.height,transform:v?"translateY(-100%)":void 0,"--buoy-stack-bottom":v?"0px":"auto","--buoy-stack-top":v?"auto":"0px","--buoy-stack-space":`${v?y:I}px`,left:u.x-1,width:_floating.VISIBLE_HANDLE_WIDTH,overflow:"visible",zIndex:1e4,pointerEvents:C?"none":"auto"},children:D}),document.body),(0,_jsxRuntime.jsxs)("div",{role:"button","aria-label":p,"data-testid":t?`${t}-grip`:"buoy-floating-grip",tabIndex:0,onPointerDown:k,onKeyDown:e=>{if(e.key!=="Enter"&&e.key!==" ")return;e.preventDefault();const i=n.toggleHideShow();g(o.position,i.targetPosition,()=>n.commitPosition(i.targetPosition))},style:{touchAction:"none",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,backgroundColor:(0,_floating.withAlpha)(_floating.floatingToolsColors.muted,"1A"),display:"flex",alignItems:"center",justifyContent:"center",width:_floating.VISIBLE_HANDLE_WIDTH,boxSizing:"border-box",borderRight:`1px solid ${(0,_floating.withAlpha)(_floating.floatingToolsColors.muted,"66")}`,cursor:o.isDragging?"grabbing":"grab",...r==="strip"?{minHeight:48,backgroundColor:"transparent",borderRight:"none",flexDirection:"column"}:{}},children:[(0,_jsxRuntime.jsx)(GripVerticalIcon,{size:r==="strip"?20:12}),T]}),(0,_jsxRuntime.jsx)(_floating.FloatingToolsProvider,{value:{isDragging:o.isDragging,isHidden:o.isHidden},children:(0,_jsxRuntime.jsx)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:6,paddingRight:8},children:N})}),!o.isHidden&&f&&(0,_jsxRuntime.jsx)("div",{"data-floating-accessory":true,style:{position:"absolute",...Y?{bottom:"100%"}:{top:"100%"},left:0,width:"100%",maxHeight:Math.max(y,I),overflowY:"auto",zIndex:1002},children:f})]})}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Divider=Divider;exports.FloatingTool=FloatingTool;exports.UserStatus=UserStatus;exports.getBubbleAnchorPosition=getBubbleAnchorPosition;var _portalHostWeb=require("./portalHost.web.js");var _nightTheme=require("../night/nightTheme.js");var _react=require("react");var _onboardingConstantsWeb=require("./onboardingConstants.web.js");var _floating=require("@buoy-gg/floating-tools-react/floating");var _jsxRuntime=require("react/jsx-runtime");const EDGE_PADDING=10;const NATIVE_TOP_PADDING=20;function readSafeAreaInsets(){if(typeof document==="undefined"||!document.body)return{top:0,left:0,bottom:0};const e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;visibility:hidden;pointer-events:none;padding-top:env(safe-area-inset-top);padding-left:env(safe-area-inset-left);padding-bottom:env(safe-area-inset-bottom)";document.body.appendChild(e);const s=getComputedStyle(e);const r={top:parseFloat(s.paddingTop)||0,left:parseFloat(s.paddingLeft)||0,bottom:parseFloat(s.paddingBottom)||0};document.body.removeChild(e);return r}const webStorageAdapter={getItem:e=>localStorage.getItem(e),setItem:(e,s)=>localStorage.setItem(e,s)};const NATIVE_TEXT_SECONDARY="#A0A0A0";function GripVerticalIcon({size:e=24,color:s=(0,_floating.withAlpha)(NATIVE_TEXT_SECONDARY,"CC")}){const r=(0,_floating.getGripIconLayout)(e);return(0,_jsxRuntime.jsx)("div",{style:{width:e,height:e,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center"},children:[0,1].map(c=>(0,_jsxRuntime.jsx)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",marginLeft:r.columnGap/2,marginRight:r.columnGap/2},children:[0,1,2].map(f=>(0,_jsxRuntime.jsx)("div",{style:{width:r.dotSize,height:r.dotSize,borderRadius:r.dotSize/2,backgroundColor:s,marginTop:r.rowGap/2,marginBottom:r.rowGap/2}},f))},c))})}function Divider(){return(0,_jsxRuntime.jsx)("div",{style:{width:1,height:12,backgroundColor:(0,_floating.withAlpha)(_floating.floatingToolsColors.muted,"66"),flexShrink:0}})}const userStatusColors={success:_floating.floatingToolsColors.success,optional:_floating.floatingToolsColors.optional,muted:_floating.floatingToolsColors.muted,secondary:NATIVE_TEXT_SECONDARY};function UserStatus({userRole:e,onPress:s}){const{isDragging:r}=(0,_floating.useFloatingToolsContext)();const c=(0,_floating.getUserStatusConfig)(e,userStatusColors);const f=p=>{if(!r&&s){p.stopPropagation();p.currentTarget.focus();s()}};return(0,_jsxRuntime.jsxs)("button",{role:"button","aria-label":s?"Open Dev Tools Menu":`User status: ${c.label}`,"data-testid":s?"open-dev-tools-button":void 0,onClick:f,style:{display:"flex",flexDirection:"row",alignItems:"center",paddingTop:6,paddingBottom:6,paddingLeft:8,paddingRight:8,flexShrink:0,cursor:s&&!r?"pointer":"default",background:"none",border:"none",margin:0},children:[(0,_jsxRuntime.jsx)("div",{style:{width:6,height:6,borderRadius:3,backgroundColor:c.dotColor,marginRight:4}}),(0,_jsxRuntime.jsx)("span",{style:{fontSize:10,fontWeight:500,color:c.textColor,letterSpacing:.3,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',lineHeight:"normal"},children:c.label})]})}function useWebAnimation(){const e=(0,_react.useRef)(null);const[s,r]=(0,_react.useState)({x:0,y:0});const c=(0,_react.useCallback)((f,p,C)=>{if(e.current){cancelAnimationFrame(e.current)}const P=performance.now();const D=m=>{const b=m-P;const w=Math.min(b/_floating.ANIMATION_DURATION,1);const S=(0,_floating.interpolatePosition)(f,p,w,_floating.easing.easeOutCubic);r(S);if(w<1){e.current=requestAnimationFrame(D)}else{r(p);C?.()}};e.current=requestAnimationFrame(D)},[]);(0,_react.useEffect)(()=>{return()=>{if(e.current){cancelAnimationFrame(e.current)}}},[]);return{position:s,setPosition:r,animateTo:c}}let lastBubbleAnchor=null;function getBubbleAnchorPosition(){return lastBubbleAnchor}function FloatingTool({id:e,revealToken:s,variant:r="bubble",dragFromSurface:c=false,defaultPlacement:f="top",accessibilityLabel:p="Drag handle",accessory:C,handleAdornment:P,enablePositionPersistence:D=true,children:m,pushToSide:b=false,suspendPointerEvents:w=false,centerOnboarding:S=false,minimizedStack:B,hasMinimizedStack:z=false}){const h=(0,_react.useRef)(null);const M=(0,_react.useMemo)(()=>e?{getItem:t=>webStorageAdapter.getItem(`@buoy/floating-tool/${e}/${t}`),setItem:(t,i)=>webStorageAdapter.setItem(`@buoy/floating-tool/${e}/${t}`,i)}:webStorageAdapter,[e]);const{state:o,actions:n,isInitialized:d}=(0,_floating.useFloatingTools)({screenSize:{width:window.innerWidth,height:window.innerHeight},enablePositionPersistence:D,storage:M,...f==="bottom"?{initialBubbleSize:{width:100,height:48},initialPosition:{x:window.innerWidth-100-EDGE_PADDING,y:Math.max(readSafeAreaInsets().top+NATIVE_TOP_PADDING,window.innerHeight-48-readSafeAreaInsets().bottom-EDGE_PADDING)}}:{}});const{position:u,setPosition:A,animateTo:g}=useWebAnimation();(0,_react.useEffect)(()=>{if(d){A(o.position)}},[d,o.position,A]);(0,_react.useEffect)(()=>{if(!e)lastBubbleAnchor={x:u.x,y:u.y}},[u,e]);(0,_react.useEffect)(()=>{if(!d)return;const t=()=>{const l=h.current?.getBoundingClientRect();if(l&&l.width>0&&l.height>0)n.setBubbleSize({width:l.width,height:l.height})};const i=()=>{const l=readSafeAreaInsets().bottom;n.setScreenSize(window.innerWidth,window.innerHeight-(l>0?l-EDGE_PADDING:0));t()};t();const a=typeof ResizeObserver!=="undefined"?new ResizeObserver(t):null;if(h.current)a?.observe(h.current);window.addEventListener("resize",i);return()=>{a?.disconnect();window.removeEventListener("resize",i)}},[n,d]);const[F,G]=(0,_react.useState)(0);(0,_react.useEffect)(()=>{let t=false;const i=()=>{const a=readSafeAreaInsets();G(a.top);if(a.top>0||a.left>0||a.bottom>0){t=true;n.setMinPosition({x:a.left,y:a.top+NATIVE_TOP_PADDING});n.setScreenSize(window.innerWidth,window.innerHeight-(a.bottom>0?a.bottom-EDGE_PADDING:0))}else if(t){t=false;n.setMinPosition({x:EDGE_PADDING,y:EDGE_PADDING});n.setScreenSize(window.innerWidth,window.innerHeight)}};i();window.addEventListener("resize",i);return()=>window.removeEventListener("resize",i)},[n]);const[L,k]=(0,_react.useState)(false);const _=(0,_react.useCallback)(t=>{t.stopPropagation();t.preventDefault();k(true);n.handleDragStart({clientX:t.clientX,clientY:t.clientY})},[n]);const E=(0,_react.useRef)(false);const N=t=>{if(t.button!==0||!(t.target instanceof Element))return;if(t.target.closest('button, a, input, select, textarea, [role="button"], [role="switch"], [role="slider"], [role="checkbox"], [role="radio"], [contenteditable="true"], [data-floating-accessory]'))return;E.current=true;_(t)};const H=(0,_react.useCallback)(t=>{const i=n.handleDragMove({clientX:t.clientX,clientY:t.clientY});if(i.isDragging){A(i.position)}},[n,A]);const x=(0,_react.useCallback)(t=>{k(false);const i=n.handleDragEnd({clientX:t.clientX,clientY:t.clientY});const a=E.current;E.current=false;if(i.wasTap&&!a){const l=n.toggleHideShow();g(o.position,l.targetPosition,()=>{n.commitPosition(l.targetPosition)})}else if(i.shouldHide){g(o.position,i.position,()=>{n.commitPosition(i.position)})}},[n,g,o.position]);(0,_react.useEffect)(()=>{if(L){window.addEventListener("pointermove",H);window.addEventListener("pointerup",x);window.addEventListener("pointercancel",x);return()=>{window.removeEventListener("pointermove",H);window.removeEventListener("pointerup",x);window.removeEventListener("pointercancel",x)}}},[L,H,x]);const R=(0,_react.useRef)(o.position);R.current=o.position;const j=(0,_react.useRef)(o.isHidden);j.current=o.isHidden;const I=(0,_react.useRef)(false);(0,_react.useEffect)(()=>{if(!d)return;if(b&&!I.current){if(j.current)return;I.current=true;const{targetPosition:t}=n.forceHide();g(R.current,t,()=>{})}else if(!b&&I.current){I.current=false;if(!j.current)return;const{targetPosition:t}=n.forceShow();const i=h.current?.getBoundingClientRect().width??100;const a={x:Math.max(10,Math.min(t.x,window.innerWidth-i-10)),y:t.y};g(R.current,a,()=>{n.commitPosition(a)})}},[b,d]);(0,_react.useEffect)(()=>{if(!S||!d)return;const t=h.current?.getBoundingClientRect().width??100;const i=h.current?.getBoundingClientRect().height??32;const a=(0,_onboardingConstantsWeb.calculateTargetPosition)();const l={x:(window.innerWidth-t)/2,y:window.innerHeight-a-i};g(R.current,l,()=>{})},[S,d]);const W=(0,_react.useRef)(void 0);(0,_react.useEffect)(()=>{if(!d||W.current===s)return;W.current=s;if(s!==void 0&&s>0&&o.isHidden){const{targetPosition:t}=n.forceShow();g(o.position,t,()=>n.commitPosition(t))}},[s,d,o.isHidden,o.position,n,g]);const Y=(0,_react.useMemo)(()=>r==="strip"?_react.Children.toArray(m):(0,_floating.interleaveWithDividers)(_react.Children.toArray(m),t=>(0,_jsxRuntime.jsx)(Divider,{},t)),[m,r]);if(!d){return null}const y=Math.max(0,u.y-F-8);const T=Math.max(0,window.innerHeight-u.y-o.bubbleSize.height-8);const $=y>T;const v=y>=48||y>=T;return(0,_jsxRuntime.jsxs)("div",{ref:h,"data-testid":e??"buoy-floating-tool",role:"toolbar","aria-label":"Floating Tools",onPointerDown:c?N:void 0,style:{position:"fixed",left:u.x,top:u.y,zIndex:b?8999:9999,display:"flex",flexDirection:"row",alignItems:"center",backgroundColor:_floating.floatingToolsColors.panel,borderTopLeftRadius:z?0:6,borderTopRightRadius:6,borderBottomLeftRadius:6,borderBottomRightRadius:6,borderWidth:o.isDragging?2:1,borderTopWidth:o.isDragging?2:z?0:1,borderStyle:"solid",borderColor:o.isDragging?_floating.floatingToolsColors.dragActive:(0,_floating.withAlpha)(_floating.floatingToolsColors.muted,"66"),boxShadow:o.isDragging?`0 6px 12px ${(0,_floating.withAlpha)(_floating.floatingToolsColors.dragActive,.36)}`:"0 4px 8px rgba(0, 0, 0, 0.3)",cursor:c?o.isDragging?"grabbing":"grab":void 0,userSelect:"none",touchAction:"none",pointerEvents:w?"none":"auto",...r==="strip"?{borderRadius:_nightTheme.night.radius.card,minHeight:48,backgroundColor:_nightTheme.night.color.surface,borderColor:o.isDragging?_nightTheme.night.color.accentBorderStrong:_nightTheme.night.color.separator,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.24)"}:{}},children:[B&&(0,_jsxRuntime.jsx)(_portalHostWeb.BuoyPortal,{children:(0,_jsxRuntime.jsx)("div",{style:{position:"fixed",top:v?u.y:u.y+o.bubbleSize.height,transform:v?"translateY(-100%)":void 0,"--buoy-stack-bottom":v?"0px":"auto","--buoy-stack-top":v?"auto":"0px","--buoy-stack-space":`${v?y:T}px`,left:u.x-1,width:_floating.VISIBLE_HANDLE_WIDTH,overflow:"visible",zIndex:1e4,pointerEvents:w?"none":"auto"},children:B})}),(0,_jsxRuntime.jsxs)("div",{role:"button","aria-label":p,"data-testid":e?`${e}-grip`:"buoy-floating-grip",tabIndex:0,onPointerDown:_,onKeyDown:t=>{if(t.key!=="Enter"&&t.key!==" ")return;t.preventDefault();const i=n.toggleHideShow();g(o.position,i.targetPosition,()=>n.commitPosition(i.targetPosition))},style:{touchAction:"none",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,backgroundColor:(0,_floating.withAlpha)(_floating.floatingToolsColors.muted,"1A"),display:"flex",alignItems:"center",justifyContent:"center",width:_floating.VISIBLE_HANDLE_WIDTH,boxSizing:"border-box",borderRight:`1px solid ${(0,_floating.withAlpha)(_floating.floatingToolsColors.muted,"66")}`,cursor:o.isDragging?"grabbing":"grab",...r==="strip"?{minHeight:48,backgroundColor:"transparent",borderRight:"none",flexDirection:"column"}:{}},children:[(0,_jsxRuntime.jsx)(GripVerticalIcon,{size:r==="strip"?20:12}),P]}),(0,_jsxRuntime.jsx)(_floating.FloatingToolsProvider,{value:{isDragging:o.isDragging,isHidden:o.isHidden},children:(0,_jsxRuntime.jsx)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:6,paddingRight:8},children:Y})}),!o.isHidden&&C&&(0,_jsxRuntime.jsx)("div",{"data-floating-accessory":true,style:{position:"absolute",...$?{bottom:"100%"}:{top:"100%"},left:0,width:"100%",maxHeight:Math.max(y,T),overflowY:"auto",zIndex:1002},children:C})]})}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"ARROW_BOTTOM_OFFSET",{enumerable:true,get:function(){return _onboardingConstantsWeb.ARROW_BOTTOM_OFFSET}});Object.defineProperty(exports,"ARROW_HEIGHT",{enumerable:true,get:function(){return _onboardingConstantsWeb.ARROW_HEIGHT}});Object.defineProperty(exports,"FloatingTool",{enumerable:true,get:function(){return _FloatingToolWeb.FloatingTool}});Object.defineProperty(exports,"FloatingToolDivider",{enumerable:true,get:function(){return _FloatingToolWeb.Divider}});Object.defineProperty(exports,"FloatingToolHost",{enumerable:true,get:function(){return _FloatingToolHostWeb.FloatingToolHost}});Object.defineProperty(exports,"FloatingToolUserStatus",{enumerable:true,get:function(){return _FloatingToolWeb.UserStatus}});Object.defineProperty(exports,"SPACING_GAP",{enumerable:true,get:function(){return _onboardingConstantsWeb.SPACING_GAP}});Object.defineProperty(exports,"calculateTargetPosition",{enumerable:true,get:function(){return _onboardingConstantsWeb.calculateTargetPosition}});Object.defineProperty(exports,"calculateTooltipPosition",{enumerable:true,get:function(){return _onboardingConstantsWeb.calculateTooltipPosition}});Object.defineProperty(exports,"dismissFloatingTool",{enumerable:true,get:function(){return _floatingToolStore.dismissFloatingTool}});Object.defineProperty(exports,"getBubbleAnchorPosition",{enumerable:true,get:function(){return _FloatingToolWeb.getBubbleAnchorPosition}});Object.defineProperty(exports,"getFloatingTools",{enumerable:true,get:function(){return _floatingToolStore.getFloatingTools}});Object.defineProperty(exports,"getScreenCenterY",{enumerable:true,get:function(){return _onboardingConstantsWeb.getScreenCenterY}});Object.defineProperty(exports,"openFloatingTool",{enumerable:true,get:function(){return _floatingToolStore.openFloatingTool}});Object.defineProperty(exports,"registerPersistentFloatingTool",{enumerable:true,get:function(){return _floatingToolStore.registerPersistentFloatingTool}});Object.defineProperty(exports,"subscribeFloatingTools",{enumerable:true,get:function(){return _floatingToolStore.subscribeFloatingTools}});var _FloatingToolWeb=require("./FloatingTool.web.js");var _FloatingToolHostWeb=require("./FloatingToolHost.web.js");var _floatingToolStore=require("../../stores/floatingToolStore.js");var _onboardingConstantsWeb=require("./onboardingConstants.web.js");
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"ARROW_BOTTOM_OFFSET",{enumerable:true,get:function(){return _onboardingConstantsWeb.ARROW_BOTTOM_OFFSET}});Object.defineProperty(exports,"ARROW_HEIGHT",{enumerable:true,get:function(){return _onboardingConstantsWeb.ARROW_HEIGHT}});Object.defineProperty(exports,"BuoyPortal",{enumerable:true,get:function(){return _portalHostWeb.BuoyPortal}});Object.defineProperty(exports,"FloatingTool",{enumerable:true,get:function(){return _FloatingToolWeb.FloatingTool}});Object.defineProperty(exports,"FloatingToolDivider",{enumerable:true,get:function(){return _FloatingToolWeb.Divider}});Object.defineProperty(exports,"FloatingToolHost",{enumerable:true,get:function(){return _FloatingToolHostWeb.FloatingToolHost}});Object.defineProperty(exports,"FloatingToolUserStatus",{enumerable:true,get:function(){return _FloatingToolWeb.UserStatus}});Object.defineProperty(exports,"SPACING_GAP",{enumerable:true,get:function(){return _onboardingConstantsWeb.SPACING_GAP}});Object.defineProperty(exports,"calculateTargetPosition",{enumerable:true,get:function(){return _onboardingConstantsWeb.calculateTargetPosition}});Object.defineProperty(exports,"calculateTooltipPosition",{enumerable:true,get:function(){return _onboardingConstantsWeb.calculateTooltipPosition}});Object.defineProperty(exports,"dismissFloatingTool",{enumerable:true,get:function(){return _floatingToolStore.dismissFloatingTool}});Object.defineProperty(exports,"getBubbleAnchorPosition",{enumerable:true,get:function(){return _FloatingToolWeb.getBubbleAnchorPosition}});Object.defineProperty(exports,"getBuoyPortalHost",{enumerable:true,get:function(){return _portalHostWeb.getBuoyPortalHost}});Object.defineProperty(exports,"getFloatingTools",{enumerable:true,get:function(){return _floatingToolStore.getFloatingTools}});Object.defineProperty(exports,"getScreenCenterY",{enumerable:true,get:function(){return _onboardingConstantsWeb.getScreenCenterY}});Object.defineProperty(exports,"listenBuoyKeydown",{enumerable:true,get:function(){return _portalHostWeb.listenBuoyKeydown}});Object.defineProperty(exports,"openFloatingTool",{enumerable:true,get:function(){return _floatingToolStore.openFloatingTool}});Object.defineProperty(exports,"registerPersistentFloatingTool",{enumerable:true,get:function(){return _floatingToolStore.registerPersistentFloatingTool}});Object.defineProperty(exports,"subscribeFloatingTools",{enumerable:true,get:function(){return _floatingToolStore.subscribeFloatingTools}});var _FloatingToolWeb=require("./FloatingTool.web.js");var _FloatingToolHostWeb=require("./FloatingToolHost.web.js");var _floatingToolStore=require("../../stores/floatingToolStore.js");var _onboardingConstantsWeb=require("./onboardingConstants.web.js");var _portalHostWeb=require("./portalHost.web.js");
@@ -0,0 +1 @@
1
+ "use strict";var _react=require("react");var _client=require("react-dom/client");var _vitest=require("vitest");var _portalHostWeb=require("./portalHost.web.js");var _jsxRuntime=require("react/jsx-runtime");_vitest.vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT",true);let cleanup;(0,_vitest.afterEach)(async()=>{await(0,_react.act)(async()=>cleanup?.());document.body.innerHTML=""});async function mount(){const t=document.createElement("div");document.body.append(t);const e=(0,_client.createRoot)(t);cleanup=()=>e.unmount();await(0,_react.act)(async()=>e.render((0,_jsxRuntime.jsxs)(_portalHostWeb.BuoyPortal,{children:[(0,_jsxRuntime.jsx)("input",{}),(0,_jsxRuntime.jsx)("section",{})]})));return(0,_portalHostWeb.getBuoyPortalHost)()}(0,_vitest.it)("shares one host and removes it with its last user",async()=>{const t=await mount();(0,_vitest.expect)((0,_portalHostWeb.getBuoyPortalHost)()).toBe(t);(0,_vitest.expect)(t.style.zIndex).toBe("2147483647");await(0,_react.act)(async()=>cleanup?.());cleanup=void 0;(0,_vitest.expect)(t.isConnected).toBe(false)});(0,_vitest.it)("moves into a full screen wrapper, skips canvas, then moves back",async()=>{const t=await mount();const e=document.createElement("div");const n=document.createElement("canvas");document.body.append(e,n);for(const[o,a]of[[e,e],[n,document.body],[null,document.body]]){Object.defineProperty(document,"fullscreenElement",{configurable:true,value:o});document.dispatchEvent(new Event("fullscreenchange"));(0,_vitest.expect)(t.parentElement).toBe(a)}});(0,_vitest.it)("stops field keys and wheel while keeping Esc and drag handlers",async()=>{const t=await mount();const e=t.querySelector("input");const n=_vitest.vi.fn();const o=_vitest.vi.fn();const a=_vitest.vi.fn();window.addEventListener("keydown",n);window.addEventListener("wheel",n);window.addEventListener("pointermove",a);const s=(0,_portalHostWeb.listenBuoyKeydown)(o);e.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:true}));t.querySelector("section").dispatchEvent(new WheelEvent("wheel",{bubbles:true}));e.dispatchEvent(new Event("pointermove",{bubbles:true}));(0,_vitest.expect)(n).not.toHaveBeenCalled();(0,_vitest.expect)(o).toHaveBeenCalledOnce();(0,_vitest.expect)(a).toHaveBeenCalledOnce();window.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape"}));(0,_vitest.expect)(o).toHaveBeenCalledTimes(2);s();window.removeEventListener("keydown",n);window.removeEventListener("wheel",n);window.removeEventListener("pointermove",a)});(0,_vitest.it)("releases held game keys when focus enters Buoy",async()=>{const t=await mount();const e=_vitest.vi.fn();window.addEventListener("keyup",e);document.dispatchEvent(new KeyboardEvent("keydown",{key:"w",code:"KeyW",bubbles:true}));t.querySelector("input").focus();(0,_vitest.expect)(e).toHaveBeenCalledOnce();(0,_vitest.expect)(e.mock.calls[0][0].code).toBe("KeyW");window.removeEventListener("keyup",e)});(0,_vitest.it)("keeps the shared host until all portals unmount",async()=>{const t=document.createElement("div");document.body.append(t);const e=(0,_client.createRoot)(t);cleanup=()=>e.unmount();await(0,_react.act)(async()=>e.render((0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_portalHostWeb.BuoyPortal,{children:(0,_jsxRuntime.jsx)("input",{})}),(0,_jsxRuntime.jsx)(_portalHostWeb.BuoyPortal,{children:(0,_jsxRuntime.jsx)("button",{})})]})));const n=(0,_portalHostWeb.getBuoyPortalHost)();(0,_vitest.expect)(document.querySelectorAll("[data-buoy-portal-host]")).toHaveLength(1);await(0,_react.act)(async()=>e.render((0,_jsxRuntime.jsx)(_portalHostWeb.BuoyPortal,{children:(0,_jsxRuntime.jsx)("input",{})})));(0,_vitest.expect)(n.isConnected).toBe(true);(0,_vitest.expect)(n.querySelector("button")).toBeNull();await(0,_react.act)(async()=>e.unmount());cleanup=void 0;(0,_vitest.expect)(n.isConnected).toBe(false)});(0,_vitest.it)("releases a game key pressed on a Buoy button before entering a field",async()=>{const t=await mount();const e=document.createElement("button");t.append(e);e.focus();const n=_vitest.vi.fn();window.addEventListener("keyup",n);try{e.dispatchEvent(new KeyboardEvent("keydown",{key:"w",code:"KeyW",bubbles:true}));t.querySelector("input").focus();(0,_vitest.expect)(n).toHaveBeenCalledOnce();(0,_vitest.expect)(n.mock.calls[0][0].code).toBe("KeyW")}finally{window.removeEventListener("keyup",n)}});(0,_vitest.it)("keeps legacy key codes when releasing a held game key",async()=>{const t=await mount();const e=_vitest.vi.fn();window.addEventListener("keyup",e);try{document.dispatchEvent(new KeyboardEvent("keydown",{key:"w",code:"KeyW",keyCode:87,which:87,bubbles:true}));t.querySelector("input").focus();(0,_vitest.expect)(e.mock.calls[0][0].keyCode).toBe(87);(0,_vitest.expect)(e.mock.calls[0][0].which).toBe(87)}finally{window.removeEventListener("keyup",e)}});(0,_vitest.it)("stops keys from a plain text editor",async()=>{const t=await mount();const e=document.createElement("div");e.contentEditable="plaintext-only";e.setAttribute("contenteditable","plaintext-only");t.append(e);const n=_vitest.vi.fn();window.addEventListener("keydown",n);try{e.dispatchEvent(new KeyboardEvent("keydown",{key:"w",bubbles:true}));(0,_vitest.expect)(n).not.toHaveBeenCalled()}finally{window.removeEventListener("keydown",n)}});(0,_vitest.it)("sets a system font even when the page uses serif text",async()=>{document.body.style.fontFamily="serif";const t=await mount();(0,_vitest.expect)(t.style.fontFamily).toContain("Segoe UI");(0,_vitest.expect)(t.style.fontFamily).toContain("sans-serif");document.body.style.fontFamily=""});
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.BuoyPortal=BuoyPortal;exports.getBuoyPortalHost=getBuoyPortalHost;exports.listenBuoyKeydown=listenBuoyKeydown;var _react=require("react");var _reactDom=require("react-dom");var _systemFont=require("../systemFont.js");var _jsxRuntime=require("react/jsx-runtime");const HOST=Symbol.for("@buoy-gg/portal-host");const isTextField=o=>{if(!(o instanceof Element))return false;if(o.closest("input, textarea, select"))return true;const t=o.closest("[contenteditable]")?.getAttribute("contenteditable")?.toLowerCase();return t===""||t==="true"||t==="plaintext-only"};function getBuoyPortalHost(){const o=document;if(o[HOST])return o[HOST].host;const t=document.createElement("div");t.dataset.buoyPortalHost="";Object.assign(t.style,{position:"fixed",inset:"0",zIndex:"2147483647",pointerEvents:"none",fontFamily:_systemFont.systemFont});const s=()=>{const e=document.fullscreenElement;const d=e&&e.tagName!=="CANVAS"?e:document.body;if(t.parentElement!==d)d.appendChild(t)};const n=new Map;const r=e=>{if(!t.contains(e.target)||!isTextField(e.target)){n.set(e.code||e.key,{key:e.key,code:e.code,location:e.location,keyCode:e.keyCode,which:e.which,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey})}};const c=e=>{n.delete(e.code||e.key)};const i=()=>n.clear();const u=()=>{const e=[...n.values()];n.clear();for(const d of e)document.dispatchEvent(new KeyboardEvent("keyup",{...d,bubbles:true}))};const a=e=>{if(isTextField(e.target))e.stopPropagation()};const l=e=>e.stopPropagation();s();document.addEventListener("fullscreenchange",s);document.addEventListener("keydown",r,true);document.addEventListener("keyup",c,true);window.addEventListener("blur",i);t.addEventListener("focusin",u);t.addEventListener("keydown",a);t.addEventListener("keyup",a);t.addEventListener("keypress",a);t.addEventListener("wheel",l,{passive:true});o[HOST]={host:t,users:0,dispose:()=>{document.removeEventListener("fullscreenchange",s);document.removeEventListener("keydown",r,true);document.removeEventListener("keyup",c,true);window.removeEventListener("blur",i);t.remove();delete o[HOST]}};return t}function BuoyPortal({children:o}){const[t,s]=(0,_react.useState)(null);(0,_react.useEffect)(()=>{const n=getBuoyPortalHost();const r=document[HOST];r.users++;s(n);return()=>{if(--r.users===0)r.dispose()}},[]);return t?(0,_reactDom.createPortal)((0,_jsxRuntime.jsx)("div",{"data-buoy-root":"",style:{display:"contents",pointerEvents:"auto"},children:o}),t):null}function listenBuoyKeydown(o){const t=getBuoyPortalHost();const s=n=>{if(!(n.target instanceof Node)||!t.contains(n.target))o(n)};t.addEventListener("keydown",o);window.addEventListener("keydown",s);return()=>{t.removeEventListener("keydown",o);window.removeEventListener("keydown",s)}}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"monoFont",{enumerable:true,get:function(){return _floatingToolsCore.monoFont}});var _floatingToolsCore=require("@buoy-gg/floating-tools-core");
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"monoFont",{enumerable:true,get:function(){return _floatingToolsCore.monoFont}});Object.defineProperty(exports,"systemFont",{enumerable:true,get:function(){return _systemFont.systemFont}});var _floatingToolsCore=require("@buoy-gg/floating-tools-core");var _systemFont=require("./systemFont.js");
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});var _exportNames={toolTheme:true,monoFont:true,CyberpunkSectionButton:true,EVENT_LIST_PRESET:true,LOG_LIST_PRESET:true,CLIP_OFFSCREEN_CELLS:true,FloatingTool:true,getBubbleAnchorPosition:true,FloatingToolDivider:true,FloatingToolUserStatus:true,ARROW_BOTTOM_OFFSET:true,ARROW_HEIGHT:true,SPACING_GAP:true,getScreenCenterY:true,calculateTooltipPosition:true,calculateTargetPosition:true,FloatingToolHost:true,openFloatingTool:true,dismissFloatingTool:true,registerPersistentFloatingTool:true,getFloatingTools:true,subscribeFloatingTools:true};Object.defineProperty(exports,"ARROW_BOTTOM_OFFSET",{enumerable:true,get:function(){return _onboardingConstants.ARROW_BOTTOM_OFFSET}});Object.defineProperty(exports,"ARROW_HEIGHT",{enumerable:true,get:function(){return _onboardingConstants.ARROW_HEIGHT}});Object.defineProperty(exports,"CLIP_OFFSCREEN_CELLS",{enumerable:true,get:function(){return _listPresets.CLIP_OFFSCREEN_CELLS}});Object.defineProperty(exports,"CyberpunkSectionButton",{enumerable:true,get:function(){return _CyberpunkSectionButton.CyberpunkSectionButton}});Object.defineProperty(exports,"EVENT_LIST_PRESET",{enumerable:true,get:function(){return _listPresets.EVENT_LIST_PRESET}});Object.defineProperty(exports,"FloatingTool",{enumerable:true,get:function(){return _FloatingTool.FloatingTool}});Object.defineProperty(exports,"FloatingToolDivider",{enumerable:true,get:function(){return _FloatingTool.Divider}});Object.defineProperty(exports,"FloatingToolHost",{enumerable:true,get:function(){return _FloatingToolHost.FloatingToolHost}});Object.defineProperty(exports,"FloatingToolUserStatus",{enumerable:true,get:function(){return _FloatingTool.UserStatus}});Object.defineProperty(exports,"LOG_LIST_PRESET",{enumerable:true,get:function(){return _listPresets.LOG_LIST_PRESET}});Object.defineProperty(exports,"SPACING_GAP",{enumerable:true,get:function(){return _onboardingConstants.SPACING_GAP}});Object.defineProperty(exports,"calculateTargetPosition",{enumerable:true,get:function(){return _onboardingConstants.calculateTargetPosition}});Object.defineProperty(exports,"calculateTooltipPosition",{enumerable:true,get:function(){return _onboardingConstants.calculateTooltipPosition}});Object.defineProperty(exports,"dismissFloatingTool",{enumerable:true,get:function(){return _floatingToolStore.dismissFloatingTool}});Object.defineProperty(exports,"getBubbleAnchorPosition",{enumerable:true,get:function(){return _FloatingTool.getBubbleAnchorPosition}});Object.defineProperty(exports,"getFloatingTools",{enumerable:true,get:function(){return _floatingToolStore.getFloatingTools}});Object.defineProperty(exports,"getScreenCenterY",{enumerable:true,get:function(){return _onboardingConstants.getScreenCenterY}});Object.defineProperty(exports,"monoFont",{enumerable:true,get:function(){return _fonts.monoFont}});Object.defineProperty(exports,"openFloatingTool",{enumerable:true,get:function(){return _floatingToolStore.openFloatingTool}});Object.defineProperty(exports,"registerPersistentFloatingTool",{enumerable:true,get:function(){return _floatingToolStore.registerPersistentFloatingTool}});Object.defineProperty(exports,"subscribeFloatingTools",{enumerable:true,get:function(){return _floatingToolStore.subscribeFloatingTools}});Object.defineProperty(exports,"toolTheme",{enumerable:true,get:function(){return _toolTheme.toolTheme}});var _index=require("./components/index.js");Object.keys(_index).forEach(function(e){if(e==="default"||e==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,e))return;if(e in exports&&exports[e]===_index[e])return;Object.defineProperty(exports,e,{enumerable:true,get:function(){return _index[e]}})});var _index2=require("./backgrounds/index.js");Object.keys(_index2).forEach(function(e){if(e==="default"||e==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,e))return;if(e in exports&&exports[e]===_index2[e])return;Object.defineProperty(exports,e,{enumerable:true,get:function(){return _index2[e]}})});var _toolTheme=require("./toolTheme.js");var _fonts=require("./fonts.js");var _CyberpunkSectionButton=require("./console/CyberpunkSectionButton.js");var _index3=require("./gameUI/index.js");Object.keys(_index3).forEach(function(e){if(e==="default"||e==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,e))return;if(e in exports&&exports[e]===_index3[e])return;Object.defineProperty(exports,e,{enumerable:true,get:function(){return _index3[e]}})});var _index4=require("./otto/index.js");Object.keys(_index4).forEach(function(e){if(e==="default"||e==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,e))return;if(e in exports&&exports[e]===_index4[e])return;Object.defineProperty(exports,e,{enumerable:true,get:function(){return _index4[e]}})});var _listPresets=require("./listPresets.js");var _FloatingTool=require("./floating/FloatingTool");var _onboardingConstants=require("./floating/onboardingConstants");var _FloatingToolHost=require("./floating/FloatingToolHost");var _floatingToolStore=require("../stores/floatingToolStore.js");
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});var _exportNames={toolTheme:true,monoFont:true,systemFont:true,CyberpunkSectionButton:true,EVENT_LIST_PRESET:true,LOG_LIST_PRESET:true,CLIP_OFFSCREEN_CELLS:true,FloatingTool:true,getBubbleAnchorPosition:true,FloatingToolDivider:true,FloatingToolUserStatus:true,ARROW_BOTTOM_OFFSET:true,ARROW_HEIGHT:true,SPACING_GAP:true,getScreenCenterY:true,calculateTooltipPosition:true,calculateTargetPosition:true,FloatingToolHost:true,openFloatingTool:true,dismissFloatingTool:true,registerPersistentFloatingTool:true,getFloatingTools:true,subscribeFloatingTools:true};Object.defineProperty(exports,"ARROW_BOTTOM_OFFSET",{enumerable:true,get:function(){return _onboardingConstants.ARROW_BOTTOM_OFFSET}});Object.defineProperty(exports,"ARROW_HEIGHT",{enumerable:true,get:function(){return _onboardingConstants.ARROW_HEIGHT}});Object.defineProperty(exports,"CLIP_OFFSCREEN_CELLS",{enumerable:true,get:function(){return _listPresets.CLIP_OFFSCREEN_CELLS}});Object.defineProperty(exports,"CyberpunkSectionButton",{enumerable:true,get:function(){return _CyberpunkSectionButton.CyberpunkSectionButton}});Object.defineProperty(exports,"EVENT_LIST_PRESET",{enumerable:true,get:function(){return _listPresets.EVENT_LIST_PRESET}});Object.defineProperty(exports,"FloatingTool",{enumerable:true,get:function(){return _FloatingTool.FloatingTool}});Object.defineProperty(exports,"FloatingToolDivider",{enumerable:true,get:function(){return _FloatingTool.Divider}});Object.defineProperty(exports,"FloatingToolHost",{enumerable:true,get:function(){return _FloatingToolHost.FloatingToolHost}});Object.defineProperty(exports,"FloatingToolUserStatus",{enumerable:true,get:function(){return _FloatingTool.UserStatus}});Object.defineProperty(exports,"LOG_LIST_PRESET",{enumerable:true,get:function(){return _listPresets.LOG_LIST_PRESET}});Object.defineProperty(exports,"SPACING_GAP",{enumerable:true,get:function(){return _onboardingConstants.SPACING_GAP}});Object.defineProperty(exports,"calculateTargetPosition",{enumerable:true,get:function(){return _onboardingConstants.calculateTargetPosition}});Object.defineProperty(exports,"calculateTooltipPosition",{enumerable:true,get:function(){return _onboardingConstants.calculateTooltipPosition}});Object.defineProperty(exports,"dismissFloatingTool",{enumerable:true,get:function(){return _floatingToolStore.dismissFloatingTool}});Object.defineProperty(exports,"getBubbleAnchorPosition",{enumerable:true,get:function(){return _FloatingTool.getBubbleAnchorPosition}});Object.defineProperty(exports,"getFloatingTools",{enumerable:true,get:function(){return _floatingToolStore.getFloatingTools}});Object.defineProperty(exports,"getScreenCenterY",{enumerable:true,get:function(){return _onboardingConstants.getScreenCenterY}});Object.defineProperty(exports,"monoFont",{enumerable:true,get:function(){return _fonts.monoFont}});Object.defineProperty(exports,"openFloatingTool",{enumerable:true,get:function(){return _floatingToolStore.openFloatingTool}});Object.defineProperty(exports,"registerPersistentFloatingTool",{enumerable:true,get:function(){return _floatingToolStore.registerPersistentFloatingTool}});Object.defineProperty(exports,"subscribeFloatingTools",{enumerable:true,get:function(){return _floatingToolStore.subscribeFloatingTools}});Object.defineProperty(exports,"systemFont",{enumerable:true,get:function(){return _fonts.systemFont}});Object.defineProperty(exports,"toolTheme",{enumerable:true,get:function(){return _toolTheme.toolTheme}});var _index=require("./components/index.js");Object.keys(_index).forEach(function(e){if(e==="default"||e==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,e))return;if(e in exports&&exports[e]===_index[e])return;Object.defineProperty(exports,e,{enumerable:true,get:function(){return _index[e]}})});var _index2=require("./backgrounds/index.js");Object.keys(_index2).forEach(function(e){if(e==="default"||e==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,e))return;if(e in exports&&exports[e]===_index2[e])return;Object.defineProperty(exports,e,{enumerable:true,get:function(){return _index2[e]}})});var _toolTheme=require("./toolTheme.js");var _fonts=require("./fonts.js");var _CyberpunkSectionButton=require("./console/CyberpunkSectionButton.js");var _index3=require("./gameUI/index.js");Object.keys(_index3).forEach(function(e){if(e==="default"||e==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,e))return;if(e in exports&&exports[e]===_index3[e])return;Object.defineProperty(exports,e,{enumerable:true,get:function(){return _index3[e]}})});var _index4=require("./otto/index.js");Object.keys(_index4).forEach(function(e){if(e==="default"||e==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,e))return;if(e in exports&&exports[e]===_index4[e])return;Object.defineProperty(exports,e,{enumerable:true,get:function(){return _index4[e]}})});var _listPresets=require("./listPresets.js");var _FloatingTool=require("./floating/FloatingTool");var _onboardingConstants=require("./floating/onboardingConstants");var _FloatingToolHost=require("./floating/FloatingToolHost");var _floatingToolStore=require("../stores/floatingToolStore.js");
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.systemFont=void 0;const systemFont=exports.systemFont='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getCachedOptionalModule=getCachedOptionalModule;exports.loadOptionalModule=loadOptionalModule;const defaultLogger={log:()=>{},warn:()=>{},error:(...e)=>{console.error("[optional-module]",...e)}};const resolvedModules=new Map;const pendingLoads=new Map;const warnedKeys=new Set;async function loadOptionalModule(e,r={}){if(resolvedModules.has(e)){return resolvedModules.get(e)}const t={...defaultLogger,...r.logger??{}};if(!pendingLoads.has(e)){pendingLoads.set(e,(async()=>{try{const n=await loadModuleWithFallback(e,r);const a=n?.default??n;resolvedModules.set(e,a);t.log("Loaded optional module",e);return a}catch(n){t.log("Optional module unavailable",e,n);resolvedModules.set(e,null);return null}})())}const o=await pendingLoads.get(e);pendingLoads.delete(e);if(!o&&r.warnOnceKey&&!warnedKeys.has(r.warnOnceKey)){warnedKeys.add(r.warnOnceKey);t.warn(r.warningMessage??`Module '${e}' not found.`)}return o}const dynamicImportLoader=(()=>{try{return new Function("moduleName","return import(moduleName);")}catch{return null}})();const dynamicRequire=(()=>{try{return new Function("return typeof require === 'function' ? require : undefined;")()}catch{return void 0}})();async function loadModuleWithFallback(e,r){if(r.loader){return await Promise.resolve(r.loader())}if(dynamicImportLoader){return dynamicImportLoader(e)}if(dynamicRequire){return dynamicRequire(e)}throw new Error(`No dynamic loader available for optional module '${e}'.`)}function getCachedOptionalModule(e){if(!resolvedModules.has(e)){return null}return resolvedModules.get(e)}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getCachedOptionalModule=getCachedOptionalModule;exports.loadOptionalModule=loadOptionalModule;const defaultLogger={log:()=>{},warn:()=>{},error:(...e)=>{console.error("[Buoy]","[optional-module]",...e)}};const resolvedModules=new Map;const pendingLoads=new Map;const warnedKeys=new Set;async function loadOptionalModule(e,r={}){if(resolvedModules.has(e)){return resolvedModules.get(e)}const t={...defaultLogger,...r.logger??{}};if(!pendingLoads.has(e)){pendingLoads.set(e,(async()=>{try{const n=await loadModuleWithFallback(e,r);const a=n?.default??n;resolvedModules.set(e,a);t.log("Loaded optional module",e);return a}catch(n){t.log("Optional module unavailable",e,n);resolvedModules.set(e,null);return null}})())}const o=await pendingLoads.get(e);pendingLoads.delete(e);if(!o&&r.warnOnceKey&&!warnedKeys.has(r.warnOnceKey)){warnedKeys.add(r.warnOnceKey);t.warn(r.warningMessage??`Module '${e}' not found.`)}return o}const dynamicImportLoader=(()=>{try{return new Function("moduleName","return import(moduleName);")}catch{return null}})();const dynamicRequire=(()=>{try{return new Function("return typeof require === 'function' ? require : undefined;")()}catch{return void 0}})();async function loadModuleWithFallback(e,r){if(r.loader){return await Promise.resolve(r.loader())}if(dynamicImportLoader){return dynamicImportLoader(e)}if(dynamicRequire){return dynamicRequire(e)}throw new Error(`No dynamic loader available for optional module '${e}'.`)}function getCachedOptionalModule(e){if(!resolvedModules.has(e)){return null}return resolvedModules.get(e)}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.deserialize=deserialize;exports.serialize=serialize;const isUndefined=n=>typeof n==="undefined";const isPlainObject=n=>{if(typeof n!=="object"||n===null)return false;if(n===Object.prototype)return false;if(Object.getPrototypeOf(n)===null)return true;return Object.getPrototypeOf(n)===Object.prototype};const isArray=n=>Array.isArray(n);const isPrimitive=n=>typeof n==="boolean"||n===null||typeof n==="undefined"||typeof n==="number"||typeof n==="string"||typeof n==="symbol";const isDate=n=>n instanceof Date&&!isNaN(n.valueOf());const isError=n=>n instanceof Error;const isRegExp=n=>n instanceof RegExp;const isSet=n=>n instanceof Set;const isMap=n=>n instanceof Map;const isBigint=n=>typeof n==="bigint";const isNaNValue=n=>typeof n==="number"&&isNaN(n);const isInfinite=n=>n===Infinity||n===-Infinity;const isMinusZero=n=>n===0&&1/n===-Infinity;const isURL=n=>n instanceof URL;const isTypedArray=n=>ArrayBuffer.isView(n)&&!(n instanceof DataView);const TYPED_ARRAY_CONSTRUCTORS={Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray};const transformRules=[{isApplicable:isUndefined,annotation:"undefined",transform:()=>null,untransform:()=>void 0},{isApplicable:isBigint,annotation:"bigint",transform:n=>n.toString(),untransform:n=>{if(typeof BigInt!=="undefined"){return BigInt(n)}console.error("BigInt is not supported in this environment");return n}},{isApplicable:isDate,annotation:"Date",transform:n=>n.toISOString(),untransform:n=>new Date(n)},{isApplicable:isError,annotation:"Error",transform:n=>({name:n.name,message:n.message,stack:n.stack,cause:"cause"in n?n.cause:void 0}),untransform:n=>{const t=new Error(n.message);t.name=n.name;t.stack=n.stack;if(n.cause!==void 0){t.cause=n.cause}return t}},{isApplicable:isRegExp,annotation:"regexp",transform:n=>""+n,untransform:n=>{const t=n.slice(1,n.lastIndexOf("/"));const r=n.slice(n.lastIndexOf("/")+1);return new RegExp(t,r)}},{isApplicable:isSet,annotation:"set",transform:n=>[...n.values()],untransform:n=>new Set(n)},{isApplicable:isMap,annotation:"map",transform:n=>[...n.entries()],untransform:n=>new Map(n)},{isApplicable:n=>isNaNValue(n)||isInfinite(n),annotation:"number",transform:n=>{if(isNaNValue(n))return"NaN";return n>0?"Infinity":"-Infinity"},untransform:n=>Number(n)},{isApplicable:isMinusZero,annotation:"number",transform:()=>"-0",untransform:()=>-0},{isApplicable:isURL,annotation:"URL",transform:n=>n.toString(),untransform:n=>new URL(n)},{isApplicable:isTypedArray,annotation:n=>["typed-array",n.constructor.name],transform:n=>[...n],untransform:(n,t)=>{const r=Array.isArray(t)?t[1]:"Uint8Array";const e=TYPED_ARRAY_CONSTRUCTORS[r];if(!e){throw new Error(`Unknown typed array: ${r}`)}return new e(n)}}];function transformValue(n){for(const t of transformRules){if(t.isApplicable(n)){const r=typeof t.annotation==="function"?t.annotation(n):t.annotation;return{value:t.transform(n),type:r}}}return void 0}function untransformValue(n,t){for(const r of transformRules){const e=typeof r.annotation==="function"?Array.isArray(t)?t[0]:t:r.annotation;const s=Array.isArray(t)&&Array.isArray(e)?t[0]===e[0]:e===t;if(s){return r.untransform(n,t)}}throw new Error(`Unknown transformation: ${t}`)}const isDeep=n=>isPlainObject(n)||isArray(n)||isMap(n)||isSet(n)||isError(n);function escapeKey(n){return n.replace(/\\/g,"\\\\").replace(/\./g,"\\.")}function walker(n,t=[],r=[]){const e=isPrimitive(n);if(!e&&!isDeep(n)){const o=transformValue(n);return o?{transformedValue:o.value,annotations:{[t.map(String).map(escapeKey).join(".")]:o.type}}:{transformedValue:n}}if(!e&&r.indexOf(n)!==-1){return{transformedValue:null}}if(!isDeep(n)){const o=transformValue(n);return o?{transformedValue:o.value,annotations:t.length>0?{[t.map(String).map(escapeKey).join(".")]:o.type}:{"":o.type}}:{transformedValue:n}}const s=transformValue(n);const i=s?.value??n;const a=isArray(i)?[]:{};const f={};if(s){const o=t.length>0?t.map(String).map(escapeKey).join("."):"";f[o]=s.type}const c=isArray(i)?i.map((o,l)=>[l,o]):Object.entries(i);for(const[o,l]of c){const u=String(o);if(u==="__proto__"||u==="constructor"||u==="prototype"){throw new Error(`Detected property ${u}. This is a prototype pollution risk, please remove it from your object.`)}const m=walker(l,[...t,o],[...r,n]);a[o]=m.transformedValue;if(m.annotations){Object.assign(f,m.annotations)}}return{transformedValue:a,annotations:Object.keys(f).length>0?f:void 0}}function parsePath(n){if(n==="")return[];const t=[];let r="";for(let e=0;e<n.length;e++){const s=n.charAt(e);if(s==="\\"){const i=n.charAt(e+1);if(i==="\\"){r+="\\";e++;continue}else if(i==="."){r+=".";e++;continue}}if(s==="."){t.push(r);r="";continue}r+=s}if(r){t.push(r)}return t}function setDeep(n,t,r){if(t.length===0){return}let e=n;for(let s=0;s<t.length-1;s++){e=e[t[s]]}e[t[t.length-1]]=r}function getDeep(n,t){let r=n;for(const e of t){r=r[e]}return r}function serialize(n){const t=walker(n);const r={json:t.transformedValue};if(t.annotations){r.meta={values:t.annotations}}return r}function deserialize(n){const{json:t,meta:r}=n;if(!r?.values){return t}let e=isArray(t)?[...t]:{...t};const s=Object.entries(r.values).map(([i,a])=>({pathString:i,type:a,path:parsePath(i)})).sort((i,a)=>a.path.length-i.path.length);for(const{type:i,path:a}of s){if(a.length===0){e=untransformValue(e,i)}else{const f=getDeep(e,a);const c=untransformValue(f,i);setDeep(e,a,c)}}return e}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.deserialize=deserialize;exports.serialize=serialize;const isUndefined=n=>typeof n==="undefined";const isPlainObject=n=>{if(typeof n!=="object"||n===null)return false;if(n===Object.prototype)return false;if(Object.getPrototypeOf(n)===null)return true;return Object.getPrototypeOf(n)===Object.prototype};const isArray=n=>Array.isArray(n);const isPrimitive=n=>typeof n==="boolean"||n===null||typeof n==="undefined"||typeof n==="number"||typeof n==="string"||typeof n==="symbol";const isDate=n=>n instanceof Date&&!isNaN(n.valueOf());const isError=n=>n instanceof Error;const isRegExp=n=>n instanceof RegExp;const isSet=n=>n instanceof Set;const isMap=n=>n instanceof Map;const isBigint=n=>typeof n==="bigint";const isNaNValue=n=>typeof n==="number"&&isNaN(n);const isInfinite=n=>n===Infinity||n===-Infinity;const isMinusZero=n=>n===0&&1/n===-Infinity;const isURL=n=>n instanceof URL;const isTypedArray=n=>ArrayBuffer.isView(n)&&!(n instanceof DataView);const TYPED_ARRAY_CONSTRUCTORS={Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray};const transformRules=[{isApplicable:isUndefined,annotation:"undefined",transform:()=>null,untransform:()=>void 0},{isApplicable:isBigint,annotation:"bigint",transform:n=>n.toString(),untransform:n=>{if(typeof BigInt!=="undefined"){return BigInt(n)}console.error("[Buoy]","BigInt is not supported in this environment");return n}},{isApplicable:isDate,annotation:"Date",transform:n=>n.toISOString(),untransform:n=>new Date(n)},{isApplicable:isError,annotation:"Error",transform:n=>({name:n.name,message:n.message,stack:n.stack,cause:"cause"in n?n.cause:void 0}),untransform:n=>{const t=new Error(n.message);t.name=n.name;t.stack=n.stack;if(n.cause!==void 0){t.cause=n.cause}return t}},{isApplicable:isRegExp,annotation:"regexp",transform:n=>""+n,untransform:n=>{const t=n.slice(1,n.lastIndexOf("/"));const r=n.slice(n.lastIndexOf("/")+1);return new RegExp(t,r)}},{isApplicable:isSet,annotation:"set",transform:n=>[...n.values()],untransform:n=>new Set(n)},{isApplicable:isMap,annotation:"map",transform:n=>[...n.entries()],untransform:n=>new Map(n)},{isApplicable:n=>isNaNValue(n)||isInfinite(n),annotation:"number",transform:n=>{if(isNaNValue(n))return"NaN";return n>0?"Infinity":"-Infinity"},untransform:n=>Number(n)},{isApplicable:isMinusZero,annotation:"number",transform:()=>"-0",untransform:()=>-0},{isApplicable:isURL,annotation:"URL",transform:n=>n.toString(),untransform:n=>new URL(n)},{isApplicable:isTypedArray,annotation:n=>["typed-array",n.constructor.name],transform:n=>[...n],untransform:(n,t)=>{const r=Array.isArray(t)?t[1]:"Uint8Array";const e=TYPED_ARRAY_CONSTRUCTORS[r];if(!e){throw new Error(`Unknown typed array: ${r}`)}return new e(n)}}];function transformValue(n){for(const t of transformRules){if(t.isApplicable(n)){const r=typeof t.annotation==="function"?t.annotation(n):t.annotation;return{value:t.transform(n),type:r}}}return void 0}function untransformValue(n,t){for(const r of transformRules){const e=typeof r.annotation==="function"?Array.isArray(t)?t[0]:t:r.annotation;const s=Array.isArray(t)&&Array.isArray(e)?t[0]===e[0]:e===t;if(s){return r.untransform(n,t)}}throw new Error(`Unknown transformation: ${t}`)}const isDeep=n=>isPlainObject(n)||isArray(n)||isMap(n)||isSet(n)||isError(n);function escapeKey(n){return n.replace(/\\/g,"\\\\").replace(/\./g,"\\.")}function walker(n,t=[],r=[]){const e=isPrimitive(n);if(!e&&!isDeep(n)){const o=transformValue(n);return o?{transformedValue:o.value,annotations:{[t.map(String).map(escapeKey).join(".")]:o.type}}:{transformedValue:n}}if(!e&&r.indexOf(n)!==-1){return{transformedValue:null}}if(!isDeep(n)){const o=transformValue(n);return o?{transformedValue:o.value,annotations:t.length>0?{[t.map(String).map(escapeKey).join(".")]:o.type}:{"":o.type}}:{transformedValue:n}}const s=transformValue(n);const i=s?.value??n;const a=isArray(i)?[]:{};const f={};if(s){const o=t.length>0?t.map(String).map(escapeKey).join("."):"";f[o]=s.type}const c=isArray(i)?i.map((o,l)=>[l,o]):Object.entries(i);for(const[o,l]of c){const u=String(o);if(u==="__proto__"||u==="constructor"||u==="prototype"){throw new Error(`Detected property ${u}. This is a prototype pollution risk, please remove it from your object.`)}const m=walker(l,[...t,o],[...r,n]);a[o]=m.transformedValue;if(m.annotations){Object.assign(f,m.annotations)}}return{transformedValue:a,annotations:Object.keys(f).length>0?f:void 0}}function parsePath(n){if(n==="")return[];const t=[];let r="";for(let e=0;e<n.length;e++){const s=n.charAt(e);if(s==="\\"){const i=n.charAt(e+1);if(i==="\\"){r+="\\";e++;continue}else if(i==="."){r+=".";e++;continue}}if(s==="."){t.push(r);r="";continue}r+=s}if(r){t.push(r)}return t}function setDeep(n,t,r){if(t.length===0){return}let e=n;for(let s=0;s<t.length-1;s++){e=e[t[s]]}e[t[t.length-1]]=r}function getDeep(n,t){let r=n;for(const e of t){r=r[e]}return r}function serialize(n){const t=walker(n);const r={json:t.transformedValue};if(t.annotations){r.meta={values:t.annotations}}return r}function deserialize(n){const{json:t,meta:r}=n;if(!r?.values){return t}let e=isArray(t)?[...t]:{...t};const s=Object.entries(r.values).map(([i,a])=>({pathString:i,type:a,path:parsePath(i)})).sort((i,a)=>a.path.length-i.path.length);for(const{type:i,path:a}of s){if(a.length===0){e=untransformValue(e,i)}else{const f=getDeep(e,a);const c=untransformValue(f,i);setDeep(e,a,c)}}return e}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});var _exportNames={View:true,Text:true,TextInput:true,TouchableOpacity:true,TouchableHighlight:true,TouchableWithoutFeedback:true,Pressable:true,ScrollView:true,Modal:true,Switch:true,ActivityIndicator:true,Button:true,findNodeHandle:true,Alert:true,unstable_createElement:true,NativeModules:true,AccessibilityInfo:true,Animated:true,Appearance:true,AppRegistry:true,AppState:true,BackHandler:true,Clipboard:true,Dimensions:true,Easing:true,I18nManager:true,Keyboard:true,InteractionManager:true,LayoutAnimation:true,Linking:true,NativeEventEmitter:true,PanResponder:true,PixelRatio:true,Platform:true,Share:true,StyleSheet:true,UIManager:true,Vibration:true,CheckBox:true,FlatList:true,Image:true,ImageBackground:true,KeyboardAvoidingView:true,Picker:true,ProgressBar:true,RefreshControl:true,SafeAreaView:true,SectionList:true,StatusBar:true,Touchable:true,TouchableNativeFeedback:true,VirtualizedList:true,YellowBox:true,LogBox:true,DeviceEventEmitter:true,useColorScheme:true,useLocaleContext:true,useWindowDimensions:true};Object.defineProperty(exports,"AccessibilityInfo",{enumerable:true,get:function(){return nativeWeb.AccessibilityInfo}});exports.Alert=exports.ActivityIndicator=void 0;Object.defineProperty(exports,"Animated",{enumerable:true,get:function(){return nativeWeb.Animated}});Object.defineProperty(exports,"AppRegistry",{enumerable:true,get:function(){return nativeWeb.AppRegistry}});Object.defineProperty(exports,"AppState",{enumerable:true,get:function(){return nativeWeb.AppState}});Object.defineProperty(exports,"Appearance",{enumerable:true,get:function(){return nativeWeb.Appearance}});Object.defineProperty(exports,"BackHandler",{enumerable:true,get:function(){return nativeWeb.BackHandler}});exports.Button=void 0;Object.defineProperty(exports,"CheckBox",{enumerable:true,get:function(){return nativeWeb.CheckBox}});Object.defineProperty(exports,"Clipboard",{enumerable:true,get:function(){return nativeWeb.Clipboard}});Object.defineProperty(exports,"DeviceEventEmitter",{enumerable:true,get:function(){return nativeWeb.DeviceEventEmitter}});Object.defineProperty(exports,"Dimensions",{enumerable:true,get:function(){return nativeWeb.Dimensions}});Object.defineProperty(exports,"Easing",{enumerable:true,get:function(){return nativeWeb.Easing}});Object.defineProperty(exports,"FlatList",{enumerable:true,get:function(){return nativeWeb.FlatList}});Object.defineProperty(exports,"I18nManager",{enumerable:true,get:function(){return nativeWeb.I18nManager}});Object.defineProperty(exports,"Image",{enumerable:true,get:function(){return nativeWeb.Image}});Object.defineProperty(exports,"ImageBackground",{enumerable:true,get:function(){return nativeWeb.ImageBackground}});Object.defineProperty(exports,"InteractionManager",{enumerable:true,get:function(){return nativeWeb.InteractionManager}});Object.defineProperty(exports,"Keyboard",{enumerable:true,get:function(){return nativeWeb.Keyboard}});Object.defineProperty(exports,"KeyboardAvoidingView",{enumerable:true,get:function(){return nativeWeb.KeyboardAvoidingView}});Object.defineProperty(exports,"LayoutAnimation",{enumerable:true,get:function(){return nativeWeb.LayoutAnimation}});Object.defineProperty(exports,"Linking",{enumerable:true,get:function(){return nativeWeb.Linking}});Object.defineProperty(exports,"LogBox",{enumerable:true,get:function(){return nativeWeb.LogBox}});exports.Modal=void 0;Object.defineProperty(exports,"NativeEventEmitter",{enumerable:true,get:function(){return nativeWeb.NativeEventEmitter}});Object.defineProperty(exports,"NativeModules",{enumerable:true,get:function(){return nativeWeb.NativeModules}});Object.defineProperty(exports,"PanResponder",{enumerable:true,get:function(){return nativeWeb.PanResponder}});Object.defineProperty(exports,"Picker",{enumerable:true,get:function(){return nativeWeb.Picker}});Object.defineProperty(exports,"PixelRatio",{enumerable:true,get:function(){return nativeWeb.PixelRatio}});Object.defineProperty(exports,"Platform",{enumerable:true,get:function(){return nativeWeb.Platform}});exports.Pressable=void 0;Object.defineProperty(exports,"ProgressBar",{enumerable:true,get:function(){return nativeWeb.ProgressBar}});Object.defineProperty(exports,"RefreshControl",{enumerable:true,get:function(){return nativeWeb.RefreshControl}});Object.defineProperty(exports,"SafeAreaView",{enumerable:true,get:function(){return nativeWeb.SafeAreaView}});exports.ScrollView=void 0;Object.defineProperty(exports,"SectionList",{enumerable:true,get:function(){return nativeWeb.SectionList}});Object.defineProperty(exports,"Share",{enumerable:true,get:function(){return nativeWeb.Share}});Object.defineProperty(exports,"StatusBar",{enumerable:true,get:function(){return nativeWeb.StatusBar}});Object.defineProperty(exports,"StyleSheet",{enumerable:true,get:function(){return nativeWeb.StyleSheet}});exports.TextInput=exports.Text=exports.Switch=void 0;Object.defineProperty(exports,"Touchable",{enumerable:true,get:function(){return nativeWeb.Touchable}});exports.TouchableHighlight=void 0;Object.defineProperty(exports,"TouchableNativeFeedback",{enumerable:true,get:function(){return nativeWeb.TouchableNativeFeedback}});exports.TouchableWithoutFeedback=exports.TouchableOpacity=void 0;Object.defineProperty(exports,"UIManager",{enumerable:true,get:function(){return nativeWeb.UIManager}});Object.defineProperty(exports,"Vibration",{enumerable:true,get:function(){return nativeWeb.Vibration}});exports.View=void 0;Object.defineProperty(exports,"VirtualizedList",{enumerable:true,get:function(){return nativeWeb.VirtualizedList}});Object.defineProperty(exports,"YellowBox",{enumerable:true,get:function(){return nativeWeb.YellowBox}});exports.findNodeHandle=void 0;Object.defineProperty(exports,"unstable_createElement",{enumerable:true,get:function(){return nativeWeb.unstable_createElement}});Object.defineProperty(exports,"useColorScheme",{enumerable:true,get:function(){return nativeWeb.useColorScheme}});Object.defineProperty(exports,"useLocaleContext",{enumerable:true,get:function(){return nativeWeb.useLocaleContext}});Object.defineProperty(exports,"useWindowDimensions",{enumerable:true,get:function(){return nativeWeb.useWindowDimensions}});var nativeWeb=_interopRequireWildcard(require("react-native-web"));Object.keys(nativeWeb).forEach(function(r){if(r==="default"||r==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,r))return;if(r in exports&&exports[r]===nativeWeb[r])return;Object.defineProperty(exports,r,{enumerable:true,get:function(){return nativeWeb[r]}})});var _react=require("react");function _interopRequireWildcard(r,a){if("function"==typeof WeakMap)var c=new WeakMap,s=new WeakMap;return(_interopRequireWildcard=function(e,u){if(!u&&e&&e.__esModule)return e;var o,i,n={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return n;if(o=u?s:c){if(o.has(e))return o.get(e);o.set(e,n)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((i=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(i.get||i.set)?o(n,t,i):n[t]=e[t]);return n})(r,a)}function withAccessibility(r){const a=(0,_react.forwardRef)((s,e)=>{const{accessibilityState:u,accessibilityValue:o,...i}=s;for(const n of["busy","checked","disabled","expanded","selected"]){if(u?.[n]!==void 0&&i[`aria-${n}`]===void 0){i[`aria-${n}`]=u[n]}}for(const[n,t]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"})){if(o?.[n]!==void 0&&i[`aria-${t}`]===void 0){i[`aria-${t}`]=o[n]}}return(0,_react.createElement)(r,{...i,ref:e})});const c=r.State;if(c)Object.assign(a,{State:c});a.displayName=r.displayName??r.name??"NativeWebView";return a}const View=exports.View=withAccessibility(nativeWeb.View);const Text=exports.Text=withAccessibility(nativeWeb.Text);const TextInput=exports.TextInput=withAccessibility(nativeWeb.TextInput);const TouchableOpacity=exports.TouchableOpacity=withAccessibility(nativeWeb.TouchableOpacity);const TouchableHighlight=exports.TouchableHighlight=withAccessibility(nativeWeb.TouchableHighlight);const TouchableWithoutFeedback=exports.TouchableWithoutFeedback=withAccessibility(nativeWeb.TouchableWithoutFeedback);const Pressable=exports.Pressable=withAccessibility(nativeWeb.Pressable);const ScrollView=exports.ScrollView=withAccessibility(nativeWeb.ScrollView);const Modal=exports.Modal=withAccessibility(nativeWeb.Modal);const Switch=exports.Switch=withAccessibility(nativeWeb.Switch);const ActivityIndicator=exports.ActivityIndicator=withAccessibility(nativeWeb.ActivityIndicator);const Button=exports.Button=withAccessibility(nativeWeb.Button);const findNodeHandle=exports.findNodeHandle=nativeWeb.findNodeHandle;const Alert=exports.Alert={alert(r,a,c,s){if(typeof document==="undefined")return;const e=document.createElement("dialog");e.dataset.buoyRoot="";e.setAttribute("aria-label",r);e.style.cssText="position:fixed;inset:0;margin:auto;width:min(440px,90vw);padding:24px;border:1px solid #475569;border-radius:14px;background:#17212e;color:#f1f5f9;font:14px system-ui;box-shadow:0 20px 80px #0008;z-index:2147483647";const u=document.createElement("h2");u.textContent=r;u.style.cssText="font-size:18px;margin:0 0 12px";e.appendChild(u);if(a){const t=document.createElement("p");t.textContent=a;t.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px";e.appendChild(t)}const o=document.createElement("div");o.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";const i=c?.length?c:[{text:"OK"}];const n=()=>{e.close?.();e.remove()};for(const t of i){const l=document.createElement("button");l.type="button";l.textContent=t.text??"OK";l.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${t.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`;l.onclick=()=>{n();t.onPress?.()};o.appendChild(l)}e.addEventListener("cancel",t=>{t.preventDefault();if(s?.cancelable===false)return;n();s?.onDismiss?.()});e.appendChild(o);document.body.appendChild(e);if(e.showModal)e.showModal();else e.setAttribute("open","")}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});var _exportNames={View:true,Text:true,TextInput:true,TouchableOpacity:true,TouchableHighlight:true,TouchableWithoutFeedback:true,Pressable:true,ScrollView:true,Modal:true,Switch:true,ActivityIndicator:true,Button:true,findNodeHandle:true,Alert:true,unstable_createElement:true,NativeModules:true,AccessibilityInfo:true,Animated:true,Appearance:true,AppRegistry:true,AppState:true,BackHandler:true,Clipboard:true,Dimensions:true,Easing:true,I18nManager:true,Keyboard:true,InteractionManager:true,LayoutAnimation:true,Linking:true,NativeEventEmitter:true,PanResponder:true,PixelRatio:true,Platform:true,Share:true,StyleSheet:true,UIManager:true,Vibration:true,CheckBox:true,FlatList:true,Image:true,ImageBackground:true,KeyboardAvoidingView:true,Picker:true,ProgressBar:true,RefreshControl:true,SafeAreaView:true,SectionList:true,StatusBar:true,Touchable:true,TouchableNativeFeedback:true,VirtualizedList:true,YellowBox:true,LogBox:true,DeviceEventEmitter:true,useColorScheme:true,useLocaleContext:true,useWindowDimensions:true};Object.defineProperty(exports,"AccessibilityInfo",{enumerable:true,get:function(){return nativeWeb.AccessibilityInfo}});exports.Alert=exports.ActivityIndicator=void 0;Object.defineProperty(exports,"Animated",{enumerable:true,get:function(){return nativeWeb.Animated}});Object.defineProperty(exports,"AppRegistry",{enumerable:true,get:function(){return nativeWeb.AppRegistry}});Object.defineProperty(exports,"AppState",{enumerable:true,get:function(){return nativeWeb.AppState}});Object.defineProperty(exports,"Appearance",{enumerable:true,get:function(){return nativeWeb.Appearance}});Object.defineProperty(exports,"BackHandler",{enumerable:true,get:function(){return nativeWeb.BackHandler}});exports.Button=void 0;Object.defineProperty(exports,"CheckBox",{enumerable:true,get:function(){return nativeWeb.CheckBox}});Object.defineProperty(exports,"Clipboard",{enumerable:true,get:function(){return nativeWeb.Clipboard}});Object.defineProperty(exports,"DeviceEventEmitter",{enumerable:true,get:function(){return nativeWeb.DeviceEventEmitter}});Object.defineProperty(exports,"Dimensions",{enumerable:true,get:function(){return nativeWeb.Dimensions}});Object.defineProperty(exports,"Easing",{enumerable:true,get:function(){return nativeWeb.Easing}});Object.defineProperty(exports,"FlatList",{enumerable:true,get:function(){return nativeWeb.FlatList}});Object.defineProperty(exports,"I18nManager",{enumerable:true,get:function(){return nativeWeb.I18nManager}});Object.defineProperty(exports,"Image",{enumerable:true,get:function(){return nativeWeb.Image}});Object.defineProperty(exports,"ImageBackground",{enumerable:true,get:function(){return nativeWeb.ImageBackground}});Object.defineProperty(exports,"InteractionManager",{enumerable:true,get:function(){return nativeWeb.InteractionManager}});Object.defineProperty(exports,"Keyboard",{enumerable:true,get:function(){return nativeWeb.Keyboard}});Object.defineProperty(exports,"KeyboardAvoidingView",{enumerable:true,get:function(){return nativeWeb.KeyboardAvoidingView}});Object.defineProperty(exports,"LayoutAnimation",{enumerable:true,get:function(){return nativeWeb.LayoutAnimation}});Object.defineProperty(exports,"Linking",{enumerable:true,get:function(){return nativeWeb.Linking}});Object.defineProperty(exports,"LogBox",{enumerable:true,get:function(){return nativeWeb.LogBox}});exports.Modal=void 0;Object.defineProperty(exports,"NativeEventEmitter",{enumerable:true,get:function(){return nativeWeb.NativeEventEmitter}});Object.defineProperty(exports,"NativeModules",{enumerable:true,get:function(){return nativeWeb.NativeModules}});Object.defineProperty(exports,"PanResponder",{enumerable:true,get:function(){return nativeWeb.PanResponder}});Object.defineProperty(exports,"Picker",{enumerable:true,get:function(){return nativeWeb.Picker}});Object.defineProperty(exports,"PixelRatio",{enumerable:true,get:function(){return nativeWeb.PixelRatio}});Object.defineProperty(exports,"Platform",{enumerable:true,get:function(){return nativeWeb.Platform}});exports.Pressable=void 0;Object.defineProperty(exports,"ProgressBar",{enumerable:true,get:function(){return nativeWeb.ProgressBar}});Object.defineProperty(exports,"RefreshControl",{enumerable:true,get:function(){return nativeWeb.RefreshControl}});Object.defineProperty(exports,"SafeAreaView",{enumerable:true,get:function(){return nativeWeb.SafeAreaView}});exports.ScrollView=void 0;Object.defineProperty(exports,"SectionList",{enumerable:true,get:function(){return nativeWeb.SectionList}});Object.defineProperty(exports,"Share",{enumerable:true,get:function(){return nativeWeb.Share}});Object.defineProperty(exports,"StatusBar",{enumerable:true,get:function(){return nativeWeb.StatusBar}});Object.defineProperty(exports,"StyleSheet",{enumerable:true,get:function(){return nativeWeb.StyleSheet}});exports.TextInput=exports.Text=exports.Switch=void 0;Object.defineProperty(exports,"Touchable",{enumerable:true,get:function(){return nativeWeb.Touchable}});exports.TouchableHighlight=void 0;Object.defineProperty(exports,"TouchableNativeFeedback",{enumerable:true,get:function(){return nativeWeb.TouchableNativeFeedback}});exports.TouchableWithoutFeedback=exports.TouchableOpacity=void 0;Object.defineProperty(exports,"UIManager",{enumerable:true,get:function(){return nativeWeb.UIManager}});Object.defineProperty(exports,"Vibration",{enumerable:true,get:function(){return nativeWeb.Vibration}});exports.View=void 0;Object.defineProperty(exports,"VirtualizedList",{enumerable:true,get:function(){return nativeWeb.VirtualizedList}});Object.defineProperty(exports,"YellowBox",{enumerable:true,get:function(){return nativeWeb.YellowBox}});exports.findNodeHandle=void 0;Object.defineProperty(exports,"unstable_createElement",{enumerable:true,get:function(){return nativeWeb.unstable_createElement}});Object.defineProperty(exports,"useColorScheme",{enumerable:true,get:function(){return nativeWeb.useColorScheme}});Object.defineProperty(exports,"useLocaleContext",{enumerable:true,get:function(){return nativeWeb.useLocaleContext}});Object.defineProperty(exports,"useWindowDimensions",{enumerable:true,get:function(){return nativeWeb.useWindowDimensions}});var nativeWeb=_interopRequireWildcard(require("react-native-web"));Object.keys(nativeWeb).forEach(function(t){if(t==="default"||t==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,t))return;if(t in exports&&exports[t]===nativeWeb[t])return;Object.defineProperty(exports,t,{enumerable:true,get:function(){return nativeWeb[t]}})});var _react=require("react");var _portalHostWeb=require("../ui/floating/portalHost.web.js");function _interopRequireWildcard(t,i){if("function"==typeof WeakMap)var a=new WeakMap,s=new WeakMap;return(_interopRequireWildcard=function(e,n){if(!n&&e&&e.__esModule)return e;var u,c,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(u=n?s:a){if(u.has(e))return u.get(e);u.set(e,o)}for(const r in e)"default"!==r&&{}.hasOwnProperty.call(e,r)&&((c=(u=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,r))&&(c.get||c.set)?u(o,r,c):o[r]=e[r]);return o})(t,i)}function withAccessibility(t){const i=(0,_react.forwardRef)((s,e)=>{const{accessibilityState:n,accessibilityValue:u,...c}=s;for(const o of["busy","checked","disabled","expanded","selected"]){if(n?.[o]!==void 0&&c[`aria-${o}`]===void 0){c[`aria-${o}`]=n[o]}}for(const[o,r]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"})){if(u?.[o]!==void 0&&c[`aria-${r}`]===void 0){c[`aria-${r}`]=u[o]}}return(0,_react.createElement)(t,{...c,ref:e})});const a=t.State;if(a)Object.assign(i,{State:a});i.displayName=t.displayName??t.name??"NativeWebView";return i}const View=exports.View=withAccessibility(nativeWeb.View);const Text=exports.Text=withAccessibility(nativeWeb.Text);const TextInput=exports.TextInput=withAccessibility(nativeWeb.TextInput);const TouchableOpacity=exports.TouchableOpacity=withAccessibility(nativeWeb.TouchableOpacity);const TouchableHighlight=exports.TouchableHighlight=withAccessibility(nativeWeb.TouchableHighlight);const TouchableWithoutFeedback=exports.TouchableWithoutFeedback=withAccessibility(nativeWeb.TouchableWithoutFeedback);const Pressable=exports.Pressable=withAccessibility(nativeWeb.Pressable);const ScrollView=exports.ScrollView=withAccessibility(nativeWeb.ScrollView);const PortalModal=(0,_react.forwardRef)((t,i)=>{const a=(0,_react.useRef)(null);const s=(0,_react.useCallback)(e=>{if(e){let n=e;while(n.parentElement&&n.parentElement!==document.body)n=n.parentElement;if(n.parentElement===document.body){a.current=n;Object.assign(n.style,{position:"relative",zIndex:"2147483647",pointerEvents:"auto"});(0,_portalHostWeb.getBuoyPortalHost)().appendChild(n)}}else if(a.current){document.body.appendChild(a.current);a.current=null}if(typeof i==="function")i(e);else if(i)i.current=e},[i]);return(0,_react.createElement)(_portalHostWeb.BuoyPortal,null,(0,_react.createElement)(nativeWeb.Modal,{...t,ref:s}))});PortalModal.displayName="Modal";const Modal=exports.Modal=withAccessibility(PortalModal);const Switch=exports.Switch=withAccessibility(nativeWeb.Switch);const ActivityIndicator=exports.ActivityIndicator=withAccessibility(nativeWeb.ActivityIndicator);const Button=exports.Button=withAccessibility(nativeWeb.Button);const findNodeHandle=exports.findNodeHandle=nativeWeb.findNodeHandle;const Alert=exports.Alert={alert(t,i,a,s){if(typeof document==="undefined")return;const e=document.createElement("dialog");e.dataset.buoyRoot="";e.setAttribute("aria-label",t);e.style.cssText="position:fixed;inset:0;margin:auto;width:min(440px,90vw);padding:24px;border:1px solid #475569;border-radius:14px;background:#17212e;color:#f1f5f9;font:14px system-ui;box-shadow:0 20px 80px #0008;z-index:2147483647";const n=document.createElement("h2");n.textContent=t;n.style.cssText="font-size:18px;margin:0 0 12px";e.appendChild(n);if(i){const r=document.createElement("p");r.textContent=i;r.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px";e.appendChild(r)}const u=document.createElement("div");u.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";const c=a?.length?a:[{text:"OK"}];const o=()=>{e.close?.();e.remove()};for(const r of c){const l=document.createElement("button");l.type="button";l.textContent=r.text??"OK";l.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${r.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`;l.onclick=()=>{o();r.onPress?.()};u.appendChild(l)}e.addEventListener("cancel",r=>{r.preventDefault();if(s?.cancelable===false)return;o();s?.onDismiss?.()});e.appendChild(u);document.body.appendChild(e);if(e.showModal)e.showModal();else e.setAttribute("open","")}};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getStorageBackendType=getStorageBackendType;exports.isUsingPersistentStorage=isUsingPersistentStorage;exports.persistentStorage=void 0;exports.resetStorageInit=resetStorageInit;var _devToolsStorageKeys=require("../storage/devToolsStorageKeys.js");var _storageWrites=require("./storageWrites.js");var _asyncStorageNative=require("./asyncStorageNative.js");let storageBackend=null;let initPromise=null;let initWarningShown=false;let FileSystem=null;let AsyncStorage=null;const memoryStore=new Map;function isWebEnvironment(){return typeof window!=="undefined"&&window?.localStorage!==void 0}const STORAGE_DIR_NAME="react-buoy";const HEALTH_CHECK_FILE_NAME=".health-check";function getStorageDir(){if(!FileSystem?.documentDirectory)return null;return`${FileSystem.documentDirectory}${STORAGE_DIR_NAME}/`}function encodeKeyForFs(t){return encodeURIComponent(t.replace(/~/g,"~0").replace(/\//g,"~1"))}function decodeKeyFromFs(t){return decodeURIComponent(t).replace(/~1/g,"/").replace(/~0/g,"~")}function getFilePath(t){const e=getStorageDir();if(!e)return null;return`${e}${encodeKeyForFs(t)}.json`}function loadFileSystem(){if(FileSystem)return FileSystem;try{const t=require("expo-file-system/legacy");FileSystem=t?.default||t;if(FileSystem&&FileSystem.documentDirectory){return FileSystem}FileSystem=null}catch{}try{const t=require("expo-file-system");FileSystem=t?.default||t;if(FileSystem&&FileSystem.documentDirectory){return FileSystem}FileSystem=null}catch{}return null}function loadAsyncStorage(){if(AsyncStorage)return AsyncStorage;if(!(0,_asyncStorageNative.hasAsyncStorageNative)())return null;try{const t=require("@react-native-async-storage/async-storage");AsyncStorage=t?.default||t;if(AsyncStorage&&typeof AsyncStorage.getItem==="function"){return AsyncStorage}AsyncStorage=null}catch{}return null}async function testFileSystem(){const t=loadFileSystem();if(!t||!t.documentDirectory){return false}const e=getStorageDir();if(!e)return false;const r=`${e}${HEALTH_CHECK_FILE_NAME}`;try{const n=await t.getInfoAsync(e);if(!n.exists){await t.makeDirectoryAsync(e,{intermediates:true})}const s=`health-check-${Date.now()}`;await t.writeAsStringAsync(r,s);const a=await t.readAsStringAsync(r);if(a!==s){return false}await t.deleteAsync(r,{idempotent:true});return true}catch(n){console.warn("[React Buoy] FileSystem health check failed:",n);return false}}async function migrateFromAsyncStorage(){const t=loadAsyncStorage();if(!t)return;try{const e=await t.getAllKeys();const r=e.filter(a=>a.startsWith(_devToolsStorageKeys.devToolsStorageKeys.base));if(r.length===0){return}const n=await t.multiGet(r);let s=0;for(const[a,o]of n){if(o!==null){await fileSystemStorage.setItem(a,o);s++}}void s}catch(e){console.warn("[React Buoy] Migration failed:",e)}}const fileSystemStorage={async getItem(t){const e=loadFileSystem();if(!e)return null;const r=getFilePath(t);if(!r)return null;try{const n=await e.getInfoAsync(r);if(!n.exists){return null}const s=await e.readAsStringAsync(r);return s}catch{return null}},async setItem(t,e){const r=loadFileSystem();if(!r)return;const n=getStorageDir();const s=getFilePath(t);if(!n||!s)return;try{const a=await r.getInfoAsync(n);if(!a.exists){await r.makeDirectoryAsync(n,{intermediates:true})}await r.writeAsStringAsync(s,e)}catch(a){console.warn("[React Buoy] FileSystem write failed:",a)}},async removeItem(t){const e=loadFileSystem();if(!e)return;const r=getFilePath(t);if(!r)return;try{await e.deleteAsync(r,{idempotent:true})}catch{}},async getAllKeys(){const t=loadFileSystem();if(!t)return[];const e=getStorageDir();if(!e)return[];try{const r=await t.getInfoAsync(e);if(!r.exists)return[];const n=await t.readDirectoryAsync(e);return n.filter(s=>s.endsWith(".json")).map(s=>decodeKeyFromFs(s.replace(".json","")))}catch{return[]}},async multiGet(t){const e=[];for(const r of t){const n=await this.getItem(r);e.push([r,n])}return e},async multiRemove(t){for(const e of t){await this.removeItem(e)}},async clear(){const t=loadFileSystem();if(!t)return;const e=getStorageDir();if(!e)return;try{await t.deleteAsync(e,{idempotent:true})}catch{}}};const asyncStorageAdapter={async getItem(t){const e=loadAsyncStorage();if(!e)return memoryStore.get(t)??null;try{return await e.getItem(t)}catch{return memoryStore.get(t)??null}},async setItem(t,e){const r=loadAsyncStorage();if(!r){memoryStore.set(t,e);return}try{await r.setItem(t,e)}catch{memoryStore.set(t,e)}},async removeItem(t){const e=loadAsyncStorage();memoryStore.delete(t);if(!e)return;try{await e.removeItem(t)}catch{}},async getAllKeys(){const t=loadAsyncStorage();if(!t)return Array.from(memoryStore.keys());try{const e=await t.getAllKeys();return e.filter(r=>r.startsWith(_devToolsStorageKeys.devToolsStorageKeys.base))}catch{return Array.from(memoryStore.keys())}},async multiGet(t){const e=loadAsyncStorage();if(!e){return t.map(r=>[r,memoryStore.get(r)??null])}try{const r=await e.multiGet(t);return r}catch{return t.map(r=>[r,memoryStore.get(r)??null])}},async multiRemove(t){t.forEach(r=>memoryStore.delete(r));const e=loadAsyncStorage();if(!e)return;try{await e.multiRemove(t)}catch{}},async clear(){memoryStore.clear();const t=loadAsyncStorage();if(!t)return;try{const e=await t.getAllKeys();const r=e.filter(n=>n.startsWith(_devToolsStorageKeys.devToolsStorageKeys.base));if(r.length>0){await t.multiRemove(r)}}catch{}}};const localStorageAdapter={async getItem(t){if(!isWebEnvironment())return memoryStore.get(t)??null;try{return window.localStorage.getItem(t)}catch{return memoryStore.get(t)??null}},async setItem(t,e){if(!isWebEnvironment()){memoryStore.set(t,e);return}try{window.localStorage.setItem(t,e)}catch{memoryStore.set(t,e)}},async removeItem(t){memoryStore.delete(t);if(!isWebEnvironment())return;try{window.localStorage.removeItem(t)}catch{}},async getAllKeys(){if(!isWebEnvironment())return Array.from(memoryStore.keys());try{const t=[];const e=window.localStorage;for(let r=0;r<e.length;r++){const n=e.key(r);if(n&&n.startsWith(_devToolsStorageKeys.devToolsStorageKeys.base)){t.push(n)}}return t}catch{return Array.from(memoryStore.keys())}},async multiGet(t){const e=[];for(const r of t){const n=await this.getItem(r);e.push([r,n])}return e},async multiRemove(t){for(const e of t){await this.removeItem(e)}},async clear(){memoryStore.clear();if(!isWebEnvironment())return;try{const t=await this.getAllKeys();const e=window.localStorage;for(const r of t){e.removeItem(r)}}catch{}}};const memoryStorage={async getItem(t){return memoryStore.get(t)??null},async setItem(t,e){memoryStore.set(t,e)},async removeItem(t){memoryStore.delete(t)},async getAllKeys(){return Array.from(memoryStore.keys())},async multiGet(t){return t.map(e=>[e,memoryStore.get(e)??null])},async multiRemove(t){t.forEach(e=>memoryStore.delete(e))},async clear(){memoryStore.clear()}};async function initStorage(){if(storageBackend!==null)return;const t=await testFileSystem();if(t){const e=await fileSystemStorage.getAllKeys();if(e.length===0){await migrateFromAsyncStorage()}storageBackend="filesystem"}else if(isWebEnvironment()){storageBackend="localstorage"}else{const e=loadAsyncStorage();if(e){storageBackend="asyncstorage";if(!initWarningShown){initWarningShown=true;console.warn("[React Buoy] Using AsyncStorage fallback. Settings may be lost if AsyncStorage is cleared. Install expo-file-system for persistent storage.")}}else{storageBackend="memory";if(!initWarningShown){initWarningShown=true;console.warn("[React Buoy] Using in-memory storage. Settings will be lost on app restart.")}}}}function ensureInit(){if(!initPromise){initPromise=initStorage()}return initPromise}function getStorage(){switch(storageBackend){case"filesystem":return fileSystemStorage;case"asyncstorage":return asyncStorageAdapter;case"localstorage":return localStorageAdapter;case"memory":default:return memoryStorage}}const persistentStorage=exports.persistentStorage={async getItem(t){await ensureInit();return getStorage().getItem(t)},async setItem(t,e){await ensureInit();await getStorage().setItem(t,e);(0,_storageWrites.notifyStorageWrite)(t,e)},async removeItem(t){await ensureInit();await getStorage().removeItem(t);(0,_storageWrites.notifyStorageWrite)(t,null)},async getAllKeys(){await ensureInit();return getStorage().getAllKeys()},async multiGet(t){await ensureInit();return getStorage().multiGet(t)},async multiRemove(t){await ensureInit();return getStorage().multiRemove(t)},async clear(){await ensureInit();return getStorage().clear()}};async function isUsingPersistentStorage(){await ensureInit();return storageBackend==="filesystem"}async function getStorageBackendType(){await ensureInit();return storageBackend??"memory"}function resetStorageInit(){storageBackend=null;initPromise=null;initWarningShown=false}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getStorageBackendType=getStorageBackendType;exports.isUsingPersistentStorage=isUsingPersistentStorage;exports.persistentStorage=void 0;exports.resetStorageInit=resetStorageInit;var _devToolsStorageKeys=require("../storage/devToolsStorageKeys.js");var _storageWrites=require("./storageWrites.js");var _asyncStorageNative=require("./asyncStorageNative.js");let storageBackend=null;let initPromise=null;let initWarningShown=false;let FileSystem=null;let AsyncStorage=null;const memoryStore=new Map;function isWebEnvironment(){return typeof window!=="undefined"&&window?.localStorage!==void 0}const STORAGE_DIR_NAME="react-buoy";const HEALTH_CHECK_FILE_NAME=".health-check";function getStorageDir(){if(!FileSystem?.documentDirectory)return null;return`${FileSystem.documentDirectory}${STORAGE_DIR_NAME}/`}function encodeKeyForFs(t){return encodeURIComponent(t.replace(/~/g,"~0").replace(/\//g,"~1"))}function decodeKeyFromFs(t){return decodeURIComponent(t).replace(/~1/g,"/").replace(/~0/g,"~")}function getFilePath(t){const e=getStorageDir();if(!e)return null;return`${e}${encodeKeyForFs(t)}.json`}function loadFileSystem(){if(FileSystem)return FileSystem;try{const t=require("expo-file-system/legacy");FileSystem=t?.default||t;if(FileSystem&&FileSystem.documentDirectory){return FileSystem}FileSystem=null}catch{}try{const t=require("expo-file-system");FileSystem=t?.default||t;if(FileSystem&&FileSystem.documentDirectory){return FileSystem}FileSystem=null}catch{}return null}function loadAsyncStorage(){if(AsyncStorage)return AsyncStorage;if(!(0,_asyncStorageNative.hasAsyncStorageNative)())return null;try{const t=require("@react-native-async-storage/async-storage");AsyncStorage=t?.default||t;if(AsyncStorage&&typeof AsyncStorage.getItem==="function"){return AsyncStorage}AsyncStorage=null}catch{}return null}async function testFileSystem(){const t=loadFileSystem();if(!t||!t.documentDirectory){return false}const e=getStorageDir();if(!e)return false;const r=`${e}${HEALTH_CHECK_FILE_NAME}`;try{const n=await t.getInfoAsync(e);if(!n.exists){await t.makeDirectoryAsync(e,{intermediates:true})}const s=`health-check-${Date.now()}`;await t.writeAsStringAsync(r,s);const a=await t.readAsStringAsync(r);if(a!==s){return false}await t.deleteAsync(r,{idempotent:true});return true}catch(n){console.warn("[Buoy]","[React Buoy] FileSystem health check failed:",n);return false}}async function migrateFromAsyncStorage(){const t=loadAsyncStorage();if(!t)return;try{const e=await t.getAllKeys();const r=e.filter(a=>a.startsWith(_devToolsStorageKeys.devToolsStorageKeys.base));if(r.length===0){return}const n=await t.multiGet(r);let s=0;for(const[a,o]of n){if(o!==null){await fileSystemStorage.setItem(a,o);s++}}void s}catch(e){console.warn("[Buoy]","[React Buoy] Migration failed:",e)}}const fileSystemStorage={async getItem(t){const e=loadFileSystem();if(!e)return null;const r=getFilePath(t);if(!r)return null;try{const n=await e.getInfoAsync(r);if(!n.exists){return null}const s=await e.readAsStringAsync(r);return s}catch{return null}},async setItem(t,e){const r=loadFileSystem();if(!r)return;const n=getStorageDir();const s=getFilePath(t);if(!n||!s)return;try{const a=await r.getInfoAsync(n);if(!a.exists){await r.makeDirectoryAsync(n,{intermediates:true})}await r.writeAsStringAsync(s,e)}catch(a){console.warn("[Buoy]","[React Buoy] FileSystem write failed:",a)}},async removeItem(t){const e=loadFileSystem();if(!e)return;const r=getFilePath(t);if(!r)return;try{await e.deleteAsync(r,{idempotent:true})}catch{}},async getAllKeys(){const t=loadFileSystem();if(!t)return[];const e=getStorageDir();if(!e)return[];try{const r=await t.getInfoAsync(e);if(!r.exists)return[];const n=await t.readDirectoryAsync(e);return n.filter(s=>s.endsWith(".json")).map(s=>decodeKeyFromFs(s.replace(".json","")))}catch{return[]}},async multiGet(t){const e=[];for(const r of t){const n=await this.getItem(r);e.push([r,n])}return e},async multiRemove(t){for(const e of t){await this.removeItem(e)}},async clear(){const t=loadFileSystem();if(!t)return;const e=getStorageDir();if(!e)return;try{await t.deleteAsync(e,{idempotent:true})}catch{}}};const asyncStorageAdapter={async getItem(t){const e=loadAsyncStorage();if(!e)return memoryStore.get(t)??null;try{return await e.getItem(t)}catch{return memoryStore.get(t)??null}},async setItem(t,e){const r=loadAsyncStorage();if(!r){memoryStore.set(t,e);return}try{await r.setItem(t,e)}catch{memoryStore.set(t,e)}},async removeItem(t){const e=loadAsyncStorage();memoryStore.delete(t);if(!e)return;try{await e.removeItem(t)}catch{}},async getAllKeys(){const t=loadAsyncStorage();if(!t)return Array.from(memoryStore.keys());try{const e=await t.getAllKeys();return e.filter(r=>r.startsWith(_devToolsStorageKeys.devToolsStorageKeys.base))}catch{return Array.from(memoryStore.keys())}},async multiGet(t){const e=loadAsyncStorage();if(!e){return t.map(r=>[r,memoryStore.get(r)??null])}try{const r=await e.multiGet(t);return r}catch{return t.map(r=>[r,memoryStore.get(r)??null])}},async multiRemove(t){t.forEach(r=>memoryStore.delete(r));const e=loadAsyncStorage();if(!e)return;try{await e.multiRemove(t)}catch{}},async clear(){memoryStore.clear();const t=loadAsyncStorage();if(!t)return;try{const e=await t.getAllKeys();const r=e.filter(n=>n.startsWith(_devToolsStorageKeys.devToolsStorageKeys.base));if(r.length>0){await t.multiRemove(r)}}catch{}}};const localStorageAdapter={async getItem(t){if(!isWebEnvironment())return memoryStore.get(t)??null;try{return window.localStorage.getItem(t)}catch{return memoryStore.get(t)??null}},async setItem(t,e){if(!isWebEnvironment()){memoryStore.set(t,e);return}try{window.localStorage.setItem(t,e)}catch{memoryStore.set(t,e)}},async removeItem(t){memoryStore.delete(t);if(!isWebEnvironment())return;try{window.localStorage.removeItem(t)}catch{}},async getAllKeys(){if(!isWebEnvironment())return Array.from(memoryStore.keys());try{const t=[];const e=window.localStorage;for(let r=0;r<e.length;r++){const n=e.key(r);if(n&&n.startsWith(_devToolsStorageKeys.devToolsStorageKeys.base)){t.push(n)}}return t}catch{return Array.from(memoryStore.keys())}},async multiGet(t){const e=[];for(const r of t){const n=await this.getItem(r);e.push([r,n])}return e},async multiRemove(t){for(const e of t){await this.removeItem(e)}},async clear(){memoryStore.clear();if(!isWebEnvironment())return;try{const t=await this.getAllKeys();const e=window.localStorage;for(const r of t){e.removeItem(r)}}catch{}}};const memoryStorage={async getItem(t){return memoryStore.get(t)??null},async setItem(t,e){memoryStore.set(t,e)},async removeItem(t){memoryStore.delete(t)},async getAllKeys(){return Array.from(memoryStore.keys())},async multiGet(t){return t.map(e=>[e,memoryStore.get(e)??null])},async multiRemove(t){t.forEach(e=>memoryStore.delete(e))},async clear(){memoryStore.clear()}};async function initStorage(){if(storageBackend!==null)return;const t=await testFileSystem();if(t){const e=await fileSystemStorage.getAllKeys();if(e.length===0){await migrateFromAsyncStorage()}storageBackend="filesystem"}else if(isWebEnvironment()){storageBackend="localstorage"}else{const e=loadAsyncStorage();if(e){storageBackend="asyncstorage";if(!initWarningShown){initWarningShown=true;console.warn("[Buoy]","[React Buoy] Using AsyncStorage fallback. Settings may be lost if AsyncStorage is cleared. Install expo-file-system for persistent storage.")}}else{storageBackend="memory";if(!initWarningShown){initWarningShown=true;console.warn("[Buoy]","[React Buoy] Using in-memory storage. Settings will be lost on app restart.")}}}}function ensureInit(){if(!initPromise){initPromise=initStorage()}return initPromise}function getStorage(){switch(storageBackend){case"filesystem":return fileSystemStorage;case"asyncstorage":return asyncStorageAdapter;case"localstorage":return localStorageAdapter;case"memory":default:return memoryStorage}}const persistentStorage=exports.persistentStorage={async getItem(t){await ensureInit();return getStorage().getItem(t)},async setItem(t,e){await ensureInit();await getStorage().setItem(t,e);(0,_storageWrites.notifyStorageWrite)(t,e)},async removeItem(t){await ensureInit();await getStorage().removeItem(t);(0,_storageWrites.notifyStorageWrite)(t,null)},async getAllKeys(){await ensureInit();return getStorage().getAllKeys()},async multiGet(t){await ensureInit();return getStorage().multiGet(t)},async multiRemove(t){await ensureInit();return getStorage().multiRemove(t)},async clear(){await ensureInit();return getStorage().clear()}};async function isUsingPersistentStorage(){await ensureInit();return storageBackend==="filesystem"}async function getStorageBackendType(){await ensureInit();return storageBackend??"memory"}function resetStorageInit(){storageBackend=null;initPromise=null;initWarningShown=false}
@@ -1 +1 @@
1
- "use strict";import{getUseAccountAccess as We}from"./license/licenseModule.js";import{AccountSetup as He}from"./license/AccountSetup";import{useState as T,useRef as b,useEffect as W,useLayoutEffect as Pe,useCallback as m,memo as $t,isValidElement as Ee,cloneElement as _e}from"react";import{persistentStorage as ie}from"./utils/persistentStorage";import{ModalStorage as Wt}from"./utils/modalStorage.js";import{devToolsStorageKeys as se}from"./storage/devToolsStorageKeys.js";import{useHintsDisabled as ze}from"./context/index.js";import{ToolBackground as ae}from"./ui/backgrounds/ToolBackground.js";import{night as d}from"./ui/night/nightTheme.js";import{expandableWindowControlsSupported as Be,isExpandableWindowControlsEnabled as Ye}from"./ui/components/windowControlsSetting.js";import{jsx as n,jsxs as y,Fragment as Le}from"react/jsx-runtime";const g={base:"#121212",card:"#1A1A1A",border:"#333333",textMuted:"#888888",primary:"#20C997"};const w={primary:"#F5F5F7",primaryLight:"#F5F5F7",secondary:"#A1A1A6",muted:"#8E8E93",success:"#34C759",info:"#00B8E6"};const Fe=100;const Ne=400;const le=500;const J=80;const wt=()=>typeof window!=="undefined"?window.innerWidth:0;const B=()=>typeof window!=="undefined"?window.innerHeight:0;const ce=o=>1-Math.pow(1-o,3);const at=o=>o<.5?2*o*o:1-Math.pow(-2*o+2,2)/2;function G(o,r,s,u){let x=0;let l=false;const C=performance.now();const M=Q=>{if(l)return;const U=Math.min((Q-C)/o,1);s(r(U));if(U<1){x=requestAnimationFrame(M)}else{u?.()}};x=requestAnimationFrame(M);return()=>{l=true;cancelAnimationFrame(x)}}function Oe(){if(typeof document==="undefined"){return{top:0,left:0,right:0,bottom:0}}const o=document.createElement("div");o.style.cssText="position:fixed;top:env(safe-area-inset-top);left:env(safe-area-inset-left);right:env(safe-area-inset-right);bottom:env(safe-area-inset-bottom);visibility:hidden;pointer-events:none";document.body.appendChild(o);const r=o.getBoundingClientRect();document.body.removeChild(o);return{top:Math.max(0,r.top),left:Math.max(0,r.left),right:Math.max(0,window.innerWidth-r.right),bottom:Math.max(0,window.innerHeight-r.bottom)}}function Ht(o,r,s=false){const u=Math.max(J,window.innerWidth-r.left-r.right);const x=Math.max(J,window.innerHeight-r.top-r.bottom);const l=Math.min(o.width,u);const C=Math.min(o.height,x);return{width:l,height:C,left:Math.max(r.left,Math.min(o.left,window.innerWidth-r.right-l)),top:Math.max(r.top,Math.min(o.top,window.innerHeight-r.bottom-(s?J:C)))}}const Pt=({size:o=24,color:r="currentColor",strokeWidth:s=2})=>y("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",children:[n("line",{x1:18,y1:6,x2:6,y2:18,stroke:r,strokeWidth:s,strokeLinecap:"round"}),n("line",{x1:6,y1:6,x2:18,y2:18,stroke:r,strokeWidth:s,strokeLinecap:"round"})]});const Et=({size:o=24,color:r="currentColor",strokeWidth:s=2})=>n("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",children:n("line",{x1:5,y1:12,x2:19,y2:12,stroke:r,strokeWidth:s,strokeLinecap:"round"})});const de=({size:o=24,color:r="currentColor",strokeWidth:s=2})=>y("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",children:[n("rect",{x:3,y:3,width:18,height:18,rx:2,stroke:r,strokeWidth:s}),n("rect",{x:3,y:14,width:18,height:7,fill:r})]});const ue=({size:o=24,color:r="currentColor",strokeWidth:s=2})=>y("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",children:[n("rect",{x:3,y:3,width:14,height:14,rx:2,stroke:r,strokeWidth:s}),n("line",{x1:7,y1:17,x2:7,y2:21,stroke:r,strokeWidth:s}),n("line",{x1:7,y1:21,x2:21,y2:21,stroke:r,strokeWidth:s}),n("line",{x1:21,y1:21,x2:21,y2:7,stroke:r,strokeWidth:s}),n("line",{x1:17,y1:7,x2:21,y2:7,stroke:r,strokeWidth:s})]});const z={close:"#FF5F57",minimize:"#FEBC2E",toggleMode:"#28C840"};const _t=24;const Xe=2;const V=8;const zt=o=>({width:_t,height:_t,borderRadius:_t/2,display:"flex",alignItems:"center",justifyContent:"center",background:`radial-gradient(circle, ${o} 6px, transparent 6px)`,border:"none",padding:0,cursor:"pointer",flexShrink:0});function je(o){if(Ye()&&Be(true)){return n(Je,{...o})}return n(Ge,{...o})}function Ge({onClose:o,onMinimize:r,onToggleMode:s,mode:u}){const x=u==="floating"?de:ue;const l=u==="floating"?"Dock to bottom sheet":"Make floating window";return y("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:Xe},children:[r&&n("button",{type:"button",onClick:r,style:zt(z.minimize),"aria-label":"Minimize modal",children:n(Et,{size:V,color:"#7A5A00",strokeWidth:1.5})}),s&&n("button",{type:"button",onClick:s,style:zt(z.toggleMode),"aria-label":l,children:n(x,{size:V,color:"#004A1A",strokeWidth:1.5})}),n("button",{type:"button",onClick:o,style:zt(z.close),"aria-label":"Close modal",children:n(Pt,{size:V,color:"#4A0000",strokeWidth:1.5})})]})}const Bt=12;const Ue=8;const vt=36;const Ze=12;const Yt=16;const Ct=8;const qe=3e3;const Lt=150;const Ft=o=>({width:Bt,height:Bt,borderRadius:Bt/2,backgroundColor:o,display:"flex",alignItems:"center",justifyContent:"center"});const Nt=(o,r,s,u)=>({width:vt,height:vt,borderRadius:vt/2,display:"flex",alignItems:"center",justifyContent:"center",padding:0,cursor:"pointer",flexShrink:0,backgroundColor:o?s:r,border:o?`1px solid ${u}`:"none"});function Je({onClose:o,onMinimize:r,onToggleMode:s,mode:u,variant:x="night"}){const l=x==="night";const[C,M]=T(false);const[Q,U]=T(false);const Z=b(null);const Y=b(null);const A=u==="floating"?de:ue;const H=u==="floating"?"Dock to bottom sheet":"Make floating window";const P=m(()=>{if(Z.current)clearTimeout(Z.current);if(Y.current)clearTimeout(Y.current);Z.current=null;Y.current=null},[]);const q=m(()=>{P();U(false);Y.current=setTimeout(()=>M(false),Lt)},[P]);const lt=m(()=>{P();M(true);requestAnimationFrame(()=>requestAnimationFrame(()=>U(true)));Z.current=setTimeout(q,qe)},[P,q]);W(()=>P,[P]);const ct=D=>{q();D()};return y(Le,{children:[y("button",{type:"button",onClick:lt,"aria-label":"Open window controls","data-testid":"tool-window-controls",style:{padding:10,margin:-8,border:"none",background:"transparent",cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",gap:Ue},children:[r&&n("span",{style:Ft(z.minimize),children:n(Et,{size:V,color:"#7A5A00",strokeWidth:1.5})}),s&&n("span",{style:Ft(z.toggleMode),children:n(A,{size:V,color:"#004A1A",strokeWidth:1.5})}),n("span",{style:Ft(z.close),children:n(Pt,{size:V,color:"#4A0000",strokeWidth:1.5})})]}),C&&n("div",{style:{position:"absolute",top:-Ct,right:-Ct,zIndex:9999,transform:`scale(${Q?1:.3})`,opacity:Q?1:0,transition:`transform ${Lt}ms ease-out, opacity ${Lt}ms ease-out`},children:y("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:Ze,padding:Ct,borderRadius:(vt+Ct*2)/2,backgroundColor:l?d.color.surface:g.card,border:`1px solid ${l?d.color.border:g.border}`,boxShadow:"0 4px 12px rgba(0,0,0,0.4)"},children:[r&&n("button",{type:"button",onClick:()=>ct(r),"aria-label":"Minimize modal","data-testid":"tool-window-minimize",style:Nt(l,z.minimize,d.color.warningSoft,d.color.warning+"59"),children:n(Et,{size:Yt,color:l?d.color.warning:"#7A5A00",strokeWidth:2})}),s&&n("button",{type:"button",onClick:()=>ct(s),"aria-label":H,"data-testid":"tool-window-mode",style:Nt(l,z.toggleMode,d.color.accentSoft,d.color.accentBorderStrong),children:n(A,{size:Yt,color:l?d.color.accent:"#004A1A",strokeWidth:2})}),n("button",{type:"button",onClick:()=>ct(o),"aria-label":"Close modal","data-testid":"tool-window-close",style:Nt(l,z.close,d.color.dangerSoft,d.color.danger+"59"),children:n(Pt,{size:Yt,color:l?d.color.danger:"#4A0000",strokeWidth:2})})]})})]})}const fe=$t(function o({isResizing:r,mode:s,hasCustomContent:u=false,variant:x="default"}){const l=s==="floating";const C=x==="night";return y("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",position:"relative",justifyContent:u?"center":void 0,minHeight:u?32:void 0,paddingTop:u?0:8,paddingBottom:u?0:8,backgroundColor:"transparent"},children:[n("div",{style:{width:C?36:r?40:l?50:40,height:C?5:l?5:3,backgroundColor:C?d.color.placeholder:r?g.primary:l?g.textMuted:g.primary,borderRadius:C?2.5:2,boxShadow:C?"none":`0 0 4px ${g.primary}99`}}),r&&s==="bottomSheet"&&n("div",{style:{position:"absolute",display:"flex",flexDirection:"row",gap:2,marginTop:12},children:[0,1,2].map(M=>n("div",{style:{width:12,height:1,backgroundColor:w.success,opacity:.6}},M))})]})});const Ve=$t(function o({onAcknowledge:r}){return n("div",{style:{backgroundColor:`${w.info}15`,borderLeft:`3px solid ${w.info}`,borderRadius:8,margin:"8px 12px 4px",overflow:"hidden",boxShadow:`0 0 8px ${w.info}4D`,flexShrink:0},children:y("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:12,gap:12},children:[y("div",{style:{width:32,height:32,position:"relative",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:[n("div",{style:{position:"absolute",width:20,height:20,borderRadius:10,border:`2px solid ${w.info}`,opacity:.6,transform:"scale(0.8)",boxSizing:"border-box"}}),n("div",{style:{position:"absolute",width:20,height:20,borderRadius:10,border:`2px solid ${w.info}`,boxSizing:"border-box"}})]}),y("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:2},children:[n("span",{style:{fontSize:13,fontWeight:600,color:w.info,letterSpacing:.3},children:"\u{1F4A1} Pro Tip"}),n("span",{style:{fontSize:12,color:w.primaryLight,lineHeight:"16px"},children:"Double-tap the header to transform this into a floating modal"})]}),n("button",{type:"button",onClick:r,style:{backgroundColor:`${w.info}30`,padding:"6px 12px",borderRadius:6,border:`1px solid ${w.info}50`,fontSize:12,fontWeight:600,color:w.info,cursor:"pointer",fontFamily:"inherit",flexShrink:0},children:"Got it!"})]})})});function he({header:o,isResizing:r,mode:s,onMinimize:u,variant:x="default"}){if(o?.customContent){let l=o.customContent;if(Ee(o.customContent)&&u){l=_e(o.customContent,{onMinimize:u})}return y("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minWidth:0},children:[n(fe,{isResizing:r,mode:s,hasCustomContent:true,variant:x}),l]})}return y("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",position:"relative",minWidth:0},children:[n(fe,{isResizing:r,mode:s,variant:x}),y("div",{style:{padding:"0 16px",display:"flex",flexDirection:"column",alignItems:"center"},children:[o?.title&&n("span",{style:{fontSize:16,fontWeight:600,color:w.primary},children:o.title}),o?.subtitle&&n("span",{style:{fontSize:12,color:w.secondary,paddingTop:4},children:o.subtitle})]}),n("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:n("span",{style:{fontSize:10,color:w.muted,fontStyle:"italic"},children:"Double tap: Toggle \u2022 Triple tap: Close"})})]})}const Qe=({visible:o,onClose:r,children:s,header:u,styles:x={},minHeight:l=Fe,maxHeight:C,initialHeight:M=Ne,animatedHeight:Q,benchMotion:U,initialMode:Z="bottomSheet",onModeChange:Y,persistenceKey:A,enablePersistence:H=true,initialFloatingPosition:P,footer:q,footerHeight:lt=0,onBack:ct,onMinimize:D,minimizeRequest:dt=0,minimizeTargetPosition:kt,initialModalState:v,zIndex:Ot,disableScrollWrapper:pe=false,background:Xt=true,variant:ut="night"})=>{const[I]=T(Oe);const[jt,Gt]=T(!H);const[p,St]=T(Z);const ft=b(Y);ft.current=Y;const[K,L]=T(false);const[Dt,tt]=T(false);const[ge,At]=T(M);const[E,et]=T(()=>Ht({width:wt(),height:le,top:P?.y??(B()-le)/2,left:P?.x??0},I));const[me,ht]=T(false);const[xe,Ut]=T(false);const be=ze();const F=b(M);const R=b(E);const k=b({x:E.left,y:E.top});const pt=b(null);const It=b(null);const _=b(null);const N=b([]);const $=m(()=>{N.current.forEach(t=>t());N.current=[]},[]);W(()=>{R.current=E},[E]);W(()=>$,[$]);const Zt=C||B()-I.top;W(()=>{if(!H||!A){Gt(true);return}let t=true;const e=async()=>{const i=await Wt.load(A);if(t&&i){if(i.mode){St(i.mode);ft.current?.(i.mode)}if(i.panelHeight){At(i.panelHeight);F.current=i.panelHeight}if(i.dimensions){const a=Ht(i.dimensions,I,true);et(a);k.current={x:a.left,y:a.top}}}if(t)Gt(true)};e();return()=>{t=false}},[A,H]);W(()=>{if(!H||!A||!jt)return;const t=setTimeout(()=>{Wt.save(A,{mode:p,panelHeight:F.current,dimensions:E,isVisible:o})},500);return()=>clearTimeout(t)},[p,ge,E,o,A,H,jt]);W(()=>{let t=true;const e=async()=>{try{const i=se.modal.hintAcknowledged();const a=await ie.getItem(i);if(t){ht(a!=="true");Ut(true)}}catch{if(t){ht(true);Ut(true)}}};e();return()=>{t=false}},[]);const ye=m(async()=>{try{const t=se.modal.hintAcknowledged();await ie.setItem(t,"true");ht(false)}catch{ht(false)}},[]);const Rt=m(()=>{tt(false);L(false);const t=p==="bottomSheet"?"floating":"bottomSheet";St(t);ft.current?.(t)},[p]);W(()=>{tt(false);L(false)},[p]);const O=m(()=>{if(!D)return;const t={mode:p,panelHeight:F.current,floatingPosition:{x:R.current.left,y:R.current.top},floatingDimensions:{width:R.current.width,height:R.current.height}};if(H&&A)void Wt.saveMinimized(A,t);const e=kt?.x??wt()-50;const i=kt?.y??B()-150;$();if(p==="bottomSheet"){const a=pt.current;if(!a){D(t);return}const c=B();N.current.push(G(300,at,h=>{a.style.opacity=String(1-h);a.style.transform=`translateY(${h*c}px)`},()=>D(t)))}else{const a=_.current;if(!a){D(t);return}const c={...k.current};N.current.push(G(300,at,h=>{a.style.opacity=String(1-h);const rt=c.x+(e-c.x)*h;const X=c.y+(i-c.y)*h;a.style.transform=`translate(${rt}px, ${X}px)`},()=>D(t)))}},[p,D,kt,$,H,A]);const qt=b(dt);W(()=>{if(qt.current===dt)return;qt.current=dt;O()},[dt,O]);W(()=>{if(!v)return;if(v.mode){St(v.mode);ft.current?.(v.mode)}if(v.panelHeight){At(v.panelHeight);F.current=v.panelHeight}if(v.floatingDimensions&&v.floatingPosition){const t={width:v.floatingDimensions.width,height:v.floatingDimensions.height,top:v.floatingPosition.y,left:v.floatingPosition.x};et(t);k.current={x:v.floatingPosition.x,y:v.floatingPosition.y}}},[v]);Pe(()=>{if(!o)return;$();if(p==="bottomSheet"){const t=pt.current;if(!t)return;const e=B();t.style.transform=`translateY(${e}px)`;t.style.opacity="0";N.current.push(G(300,ce,i=>{t.style.transform=`translateY(${(1-i)*e}px)`}),G(200,at,i=>{t.style.opacity=String(i)}))}else{const t=_.current;if(!t)return;k.current={x:R.current.left,y:R.current.top};t.style.transform=`translate(${k.current.x}px, ${k.current.y}px)`;t.style.opacity="0";N.current.push(G(200,at,e=>{t.style.opacity=String(e)}))}},[o,p,$]);const Jt=b(0);const nt=b(0);const ot=b(null);const gt=m(()=>{const t=Date.now();if(t-Jt.current>500){nt.current=0}nt.current++;Jt.current=t;if(ot.current)clearTimeout(ot.current);ot.current=setTimeout(()=>{if(nt.current===2){Rt()}else if(nt.current>=3){if(D)O()}nt.current=0},300)},[Rt,D,O]);W(()=>{return()=>{if(ot.current)clearTimeout(ot.current)}},[]);const mt=b({active:false,resizing:false,startY:0,headerOffsetY:0,samples:[]});const we=m(t=>{if(p!=="bottomSheet")return;if(t.button!==0||t.target.closest('button, a, input, textarea, select, [role="button"], [role="tab"], [role="switch"], [contenteditable="true"], [tabindex]'))return;const e=mt.current;e.active=true;e.resizing=false;e.startY=t.clientY;const i=t.currentTarget.getBoundingClientRect();e.headerOffsetY=t.clientY-i.top;e.samples=[{t:performance.now(),y:t.clientY}];t.currentTarget.setPointerCapture(t.pointerId)},[p]);const ve=m(t=>{const e=mt.current;if(!e.active)return;const i=t.clientY-e.startY;if(!e.resizing&&Math.abs(i)>3){e.resizing=true;$();L(true)}if(!e.resizing)return;const a=t.clientY-e.headerOffsetY;let c=B()-a;c=Math.max(l,Math.min(c,Zt));F.current=c;if(It.current)It.current.style.height=`${c}px`;const h=performance.now();e.samples.push({t:h,y:t.clientY});while(e.samples.length>2&&h-e.samples[0].t>100)e.samples.shift()},[l,Zt,$]);const Ce=m(t=>{const e=mt.current;if(!e.active)return;e.active=false;if(!e.resizing){gt();return}L(false);const i=F.current;const a=t.clientY-e.startY;const c=e.samples[0];const h=e.samples[e.samples.length-1];const rt=h&&c&&h.t>c.t?(h.y-c.y)/(h.t-c.t):0;const X=rt>.8&&a>50||a>150&&i<=l;if(X){const S=pt.current;$();if(S){const it=B();N.current.push(G(200,at,j=>{S.style.opacity=String(1-j)}),G(300,ce,j=>{S.style.transform=`translateY(${j*it}px)`},()=>r()))}else{r()}return}At(i)},[l,r,gt,$]);const ke=m(()=>{const t=mt.current;if(!t.active)return;t.active=false;t.resizing=false;L(false)},[]);const xt=b({active:false,dragging:false,startX:0,startY:0,startPos:{x:0,y:0}});const Se=m(t=>{if(p!=="floating"||K)return;if(t.button!==0||t.target.closest('button, a, input, textarea, select, [role="button"], [role="tab"], [role="switch"], [contenteditable="true"], [tabindex]'))return;const e=xt.current;e.active=true;e.dragging=false;e.startX=t.clientX;e.startY=t.clientY;e.startPos={...k.current};t.currentTarget.setPointerCapture(t.pointerId)},[p,K]);const De=m(t=>{const e=xt.current;if(!e.active)return;const i=t.clientX-e.startX;const a=t.clientY-e.startY;if(!e.dragging&&Math.abs(i)+Math.abs(a)>5){e.dragging=true;tt(true)}if(!e.dragging)return;const c=e.startPos.x+i;const h=e.startPos.y+a;k.current={x:c,y:h};if(_.current){_.current.style.transform=`translate(${c}px, ${h}px)`}},[]);const Ae=m(()=>{const t=xt.current;if(!t.active)return;t.active=false;if(!t.dragging){gt();return}tt(false);const e=R.current;const i=Ht({...e,left:k.current.x,top:k.current.y},I);const a=i.left;const c=i.top;k.current={x:a,y:c};if(_.current){_.current.style.transform=`translate(${a}px, ${c}px)`}et(h=>({...h,left:a,top:c}))},[I,gt]);const Ie=m(()=>{const t=xt.current;if(!t.active)return;t.active=false;t.dragging=false;tt(false)},[]);const Tt=b({active:false,corner:"bottomRight",startX:0,startY:0,start:{width:0,height:0,top:0,left:0}});const Re=m(t=>e=>{if(p!=="floating")return;e.stopPropagation();const i=Tt.current;i.active=true;i.corner=t;i.startX=e.clientX;i.startY=e.clientY;i.start={...R.current};L(true);e.currentTarget.setPointerCapture(e.pointerId)},[p]);const Te=m(t=>{const e=Tt.current;if(!e.active)return;const i=t.clientX-e.startX;const a=t.clientY-e.startY;if(Math.abs(i)<.5&&Math.abs(a)<.5)return;const c=Math.max(0,I.left);const h=B()-Math.max(0,I.bottom);const rt=wt()-Math.max(0,I.right);const X=wt()*.25;const S=e.start;const it=S.left+S.width;const j=S.top+S.height;let st=S.left;const yt=S.top;let oe=it;let Mt=j;if(e.corner==="bottomLeft"){st=Math.max(c,Math.min(S.left+i,it-X));Mt=Math.min(h,Math.max(j+a,S.top+J))}else{oe=Math.min(rt,Math.max(it+i,S.left+X));Mt=Math.min(h,Math.max(j+a,S.top+J))}const Me=Math.max(X,oe-st);const $e=Math.max(J,Mt-yt);const re={width:Me,height:$e,left:st,top:yt};R.current=re;k.current={x:st,y:yt};et(re);if(_.current){_.current.style.transform=`translate(${st}px, ${yt}px)`}},[I.left,I.right,I.bottom]);const Vt=m(()=>{const t=Tt.current;if(!t.active)return;t.active=false;L(false);et(R.current)},[]);const bt=!o;const Qt=bt?{left:-9999,top:-9999,opacity:0,visibility:"hidden",pointerEvents:"none"}:{};const Kt=u?.title||"Dev tool panel";const f=ut==="night";const te=Xt&&f?n("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},"aria-hidden":true,children:n(ae,{})}):null;const ee=y("div",{style:{flex:1,minHeight:0,position:"relative",display:"flex",flexDirection:"column",backgroundColor:f?"transparent":g.base,borderBottomLeftRadius:16,borderBottomRightRadius:16,overflow:"hidden",...x.content},children:[Xt&&!f?n(ae,{}):null,pe?n("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",paddingBottom:lt},children:s}):n("div",{style:{flex:1,minHeight:0,overflowY:"auto",paddingBottom:lt},children:s}),q?n("div",{style:{position:"absolute",left:0,right:0,bottom:0,backgroundColor:g.base,borderBottomLeftRadius:16,borderBottomRightRadius:16},children:q}):null]});const ne=n("div",{style:{position:"absolute",top:4,right:4,zIndex:10},children:n(je,{onClose:r,onMinimize:D?O:void 0,onToggleMode:Rt,mode:p,variant:ut})});if(p==="floating"){const t=Dt||K;return y("div",{ref:_,role:"dialog","aria-label":Kt,"aria-hidden":bt||void 0,style:{position:"fixed",pointerEvents:"auto",left:0,top:0,width:E.width,height:E.height,transform:`translate(${k.current.x}px, ${k.current.y}px)`,display:"flex",flexDirection:"column",backgroundColor:f?d.color.bg:g.card,borderRadius:f?d.radius.sheet:6,border:f?`1px solid ${d.color.accent}55`:t?`2px solid ${g.primary}`:`1px solid ${g.border}`,boxShadow:f?`0 0 14px ${d.color.accent}38`:t?`0 0 12px ${g.primary}7A`:`0 0 20px ${g.primary}4D`,...f?{overflow:"hidden"}:null,boxSizing:"border-box",zIndex:Ot??1e3,...x.container,...Qt},children:[te,n("div",{onPointerDown:Se,onPointerMove:De,onPointerUp:Ae,onPointerCancel:Ie,style:{borderTopLeftRadius:f?d.radius.sheet:6,borderTopRightRadius:f?d.radius.sheet:6,backgroundColor:f?"transparent":g.card,minHeight:56,border:f?"none":`1px solid ${g.border}`,boxSizing:"border-box",display:"flex",flexDirection:"column",justifyContent:"center",flexShrink:0,touchAction:"none",userSelect:"none",cursor:Dt?"grabbing":"grab",position:"relative"},children:n(he,{header:u,isResizing:Dt||K,mode:p,onMinimize:D?O:void 0,variant:ut})}),ne,ee,["bottomLeft","bottomRight"].map(e=>n("div",{onPointerDown:Re(e),onPointerMove:Te,onPointerUp:Vt,onPointerCancel:Vt,style:{position:"absolute",width:30,height:30,bottom:4,...e==="bottomLeft"?{left:4}:{right:4},zIndex:1e3,touchAction:"none",cursor:e==="bottomLeft"?"nesw-resize":"nwse-resize"},children:n("div",{style:{width:20,height:20,borderRadius:10,boxSizing:"border-box",backgroundColor:t?`${w.success}1A`:"transparent",border:t?`2px solid ${w.success}`:"none",boxShadow:t?`0 0 8px ${w.success}99`:"none"}})},e))]},"floating")}return n("div",{"aria-hidden":bt||void 0,style:{position:"fixed",inset:0,zIndex:Ot??1e3,pointerEvents:"none",...bt?{...Qt,inset:"auto",width:"100vw",height:"100vh"}:null},children:n("div",{ref:pt,style:{position:"absolute",bottom:0,left:0,right:0,pointerEvents:"auto"},children:y("div",{ref:It,role:"dialog","aria-label":Kt,style:{height:F.current,display:"flex",flexDirection:"column",backgroundColor:f?d.color.bg:g.card,borderTopLeftRadius:f?d.radius.sheet:6,borderTopRightRadius:f?d.radius.sheet:6,border:f?`1px solid ${d.color.accent}55`:`1px solid ${g.border}`,boxShadow:f?`0 -4px 10px ${d.color.accent}38`:`0 -4px 12px ${g.primary}33`,...f?{overflow:"hidden"}:null,boxSizing:"border-box",position:"relative",...x.container},children:[te,n("div",{onPointerDown:we,onPointerMove:ve,onPointerUp:Ce,onPointerCancel:ke,style:{borderTopLeftRadius:f?d.radius.sheet:6,borderTopRightRadius:f?d.radius.sheet:6,backgroundColor:f?"transparent":g.card,minHeight:56,border:f?"none":`1px solid ${g.border}`,boxSizing:"border-box",display:"flex",flexDirection:"column",justifyContent:"center",flexShrink:0,touchAction:"none",userSelect:"none",cursor:"ns-resize",position:"relative"},children:n(he,{header:u,isResizing:K,mode:p,onMinimize:D?O:void 0,variant:ut})}),ne,xe&&me&&!be&&n(Ve,{onAcknowledge:ye}),ee]})})},"bottomSheet")};export const JsModal=$t(o=>{const r=We()();if(r.status!=="admitted")return o.visible?n(He,{}):null;return n(Qe,{...o})});
1
+ "use strict";import{systemFont as ie}from"./ui/fonts.js";import{getUseAccountAccess as He}from"./license/licenseModule.js";import{AccountSetup as Pe}from"./license/AccountSetup";import{useState as T,useRef as y,useEffect as W,useLayoutEffect as Ee,useCallback as m,memo as $t,isValidElement as _e,cloneElement as ze}from"react";import{persistentStorage as se}from"./utils/persistentStorage";import{ModalStorage as Wt}from"./utils/modalStorage.js";import{devToolsStorageKeys as ae}from"./storage/devToolsStorageKeys.js";import{useHintsDisabled as Be}from"./context/index.js";import{ToolBackground as le}from"./ui/backgrounds/ToolBackground.js";import{night as d}from"./ui/night/nightTheme.js";import{expandableWindowControlsSupported as Ye,isExpandableWindowControlsEnabled as Fe}from"./ui/components/windowControlsSetting.js";import{jsx as n,jsxs as b,Fragment as Le}from"react/jsx-runtime";const g={base:"#121212",card:"#1A1A1A",border:"#333333",textMuted:"#888888",primary:"#20C997"};const w={primary:"#F5F5F7",primaryLight:"#F5F5F7",secondary:"#A1A1A6",muted:"#8E8E93",success:"#34C759",info:"#00B8E6"};const Ne=100;const Oe=400;const ce=500;const J=80;const wt=()=>typeof window!=="undefined"?window.innerWidth:0;const B=()=>typeof window!=="undefined"?window.innerHeight:0;const de=o=>1-Math.pow(1-o,3);const at=o=>o<.5?2*o*o:1-Math.pow(-2*o+2,2)/2;function G(o,r,s,u){let x=0;let l=false;const C=performance.now();const M=Q=>{if(l)return;const U=Math.min((Q-C)/o,1);s(r(U));if(U<1){x=requestAnimationFrame(M)}else{u?.()}};x=requestAnimationFrame(M);return()=>{l=true;cancelAnimationFrame(x)}}function Xe(){if(typeof document==="undefined"){return{top:0,left:0,right:0,bottom:0}}const o=document.createElement("div");o.style.cssText="position:fixed;top:env(safe-area-inset-top);left:env(safe-area-inset-left);right:env(safe-area-inset-right);bottom:env(safe-area-inset-bottom);visibility:hidden;pointer-events:none";document.body.appendChild(o);const r=o.getBoundingClientRect();document.body.removeChild(o);return{top:Math.max(0,r.top),left:Math.max(0,r.left),right:Math.max(0,window.innerWidth-r.right),bottom:Math.max(0,window.innerHeight-r.bottom)}}function Ht(o,r,s=false){const u=Math.max(J,window.innerWidth-r.left-r.right);const x=Math.max(J,window.innerHeight-r.top-r.bottom);const l=Math.min(o.width,u);const C=Math.min(o.height,x);return{width:l,height:C,left:Math.max(r.left,Math.min(o.left,window.innerWidth-r.right-l)),top:Math.max(r.top,Math.min(o.top,window.innerHeight-r.bottom-(s?J:C)))}}const Pt=({size:o=24,color:r="currentColor",strokeWidth:s=2})=>b("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",children:[n("line",{x1:18,y1:6,x2:6,y2:18,stroke:r,strokeWidth:s,strokeLinecap:"round"}),n("line",{x1:6,y1:6,x2:18,y2:18,stroke:r,strokeWidth:s,strokeLinecap:"round"})]});const Et=({size:o=24,color:r="currentColor",strokeWidth:s=2})=>n("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",children:n("line",{x1:5,y1:12,x2:19,y2:12,stroke:r,strokeWidth:s,strokeLinecap:"round"})});const ue=({size:o=24,color:r="currentColor",strokeWidth:s=2})=>b("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",children:[n("rect",{x:3,y:3,width:18,height:18,rx:2,stroke:r,strokeWidth:s}),n("rect",{x:3,y:14,width:18,height:7,fill:r})]});const fe=({size:o=24,color:r="currentColor",strokeWidth:s=2})=>b("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",children:[n("rect",{x:3,y:3,width:14,height:14,rx:2,stroke:r,strokeWidth:s}),n("line",{x1:7,y1:17,x2:7,y2:21,stroke:r,strokeWidth:s}),n("line",{x1:7,y1:21,x2:21,y2:21,stroke:r,strokeWidth:s}),n("line",{x1:21,y1:21,x2:21,y2:7,stroke:r,strokeWidth:s}),n("line",{x1:17,y1:7,x2:21,y2:7,stroke:r,strokeWidth:s})]});const z={close:"#FF5F57",minimize:"#FEBC2E",toggleMode:"#28C840"};const _t=24;const je=2;const V=8;const zt=o=>({width:_t,height:_t,borderRadius:_t/2,display:"flex",alignItems:"center",justifyContent:"center",background:`radial-gradient(circle, ${o} 6px, transparent 6px)`,border:"none",padding:0,cursor:"pointer",flexShrink:0});function Ge(o){if(Fe()&&Ye(true)){return n(Ve,{...o})}return n(Ue,{...o})}function Ue({onClose:o,onMinimize:r,onToggleMode:s,mode:u}){const x=u==="floating"?ue:fe;const l=u==="floating"?"Dock to bottom sheet":"Make floating window";return b("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:je},children:[r&&n("button",{type:"button",onClick:r,style:zt(z.minimize),"aria-label":"Minimize modal",children:n(Et,{size:V,color:"#7A5A00",strokeWidth:1.5})}),s&&n("button",{type:"button",onClick:s,style:zt(z.toggleMode),"aria-label":l,children:n(x,{size:V,color:"#004A1A",strokeWidth:1.5})}),n("button",{type:"button",onClick:o,style:zt(z.close),"aria-label":"Close modal",children:n(Pt,{size:V,color:"#4A0000",strokeWidth:1.5})})]})}const Bt=12;const Ze=8;const vt=36;const qe=12;const Yt=16;const Ct=8;const Je=3e3;const Ft=150;const Lt=o=>({width:Bt,height:Bt,borderRadius:Bt/2,backgroundColor:o,display:"flex",alignItems:"center",justifyContent:"center"});const Nt=(o,r,s,u)=>({width:vt,height:vt,borderRadius:vt/2,display:"flex",alignItems:"center",justifyContent:"center",padding:0,cursor:"pointer",flexShrink:0,backgroundColor:o?s:r,border:o?`1px solid ${u}`:"none"});function Ve({onClose:o,onMinimize:r,onToggleMode:s,mode:u,variant:x="night"}){const l=x==="night";const[C,M]=T(false);const[Q,U]=T(false);const Z=y(null);const Y=y(null);const A=u==="floating"?ue:fe;const H=u==="floating"?"Dock to bottom sheet":"Make floating window";const P=m(()=>{if(Z.current)clearTimeout(Z.current);if(Y.current)clearTimeout(Y.current);Z.current=null;Y.current=null},[]);const q=m(()=>{P();U(false);Y.current=setTimeout(()=>M(false),Ft)},[P]);const lt=m(()=>{P();M(true);requestAnimationFrame(()=>requestAnimationFrame(()=>U(true)));Z.current=setTimeout(q,Je)},[P,q]);W(()=>P,[P]);const ct=D=>{q();D()};return b(Le,{children:[b("button",{type:"button",onClick:lt,"aria-label":"Open window controls","data-testid":"tool-window-controls",style:{padding:10,margin:-8,border:"none",background:"transparent",cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",gap:Ze},children:[r&&n("span",{style:Lt(z.minimize),children:n(Et,{size:V,color:"#7A5A00",strokeWidth:1.5})}),s&&n("span",{style:Lt(z.toggleMode),children:n(A,{size:V,color:"#004A1A",strokeWidth:1.5})}),n("span",{style:Lt(z.close),children:n(Pt,{size:V,color:"#4A0000",strokeWidth:1.5})})]}),C&&n("div",{style:{position:"absolute",top:-Ct,right:-Ct,zIndex:9999,transform:`scale(${Q?1:.3})`,opacity:Q?1:0,transition:`transform ${Ft}ms ease-out, opacity ${Ft}ms ease-out`},children:b("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:qe,padding:Ct,borderRadius:(vt+Ct*2)/2,backgroundColor:l?d.color.surface:g.card,border:`1px solid ${l?d.color.border:g.border}`,boxShadow:"0 4px 12px rgba(0,0,0,0.4)"},children:[r&&n("button",{type:"button",onClick:()=>ct(r),"aria-label":"Minimize modal","data-testid":"tool-window-minimize",style:Nt(l,z.minimize,d.color.warningSoft,d.color.warning+"59"),children:n(Et,{size:Yt,color:l?d.color.warning:"#7A5A00",strokeWidth:2})}),s&&n("button",{type:"button",onClick:()=>ct(s),"aria-label":H,"data-testid":"tool-window-mode",style:Nt(l,z.toggleMode,d.color.accentSoft,d.color.accentBorderStrong),children:n(A,{size:Yt,color:l?d.color.accent:"#004A1A",strokeWidth:2})}),n("button",{type:"button",onClick:()=>ct(o),"aria-label":"Close modal","data-testid":"tool-window-close",style:Nt(l,z.close,d.color.dangerSoft,d.color.danger+"59"),children:n(Pt,{size:Yt,color:l?d.color.danger:"#4A0000",strokeWidth:2})})]})})]})}const he=$t(function o({isResizing:r,mode:s,hasCustomContent:u=false,variant:x="default"}){const l=s==="floating";const C=x==="night";return b("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",position:"relative",justifyContent:u?"center":void 0,minHeight:u?32:void 0,paddingTop:u?0:8,paddingBottom:u?0:8,backgroundColor:"transparent"},children:[n("div",{style:{width:C?36:r?40:l?50:40,height:C?5:l?5:3,backgroundColor:C?d.color.placeholder:r?g.primary:l?g.textMuted:g.primary,borderRadius:C?2.5:2,boxShadow:C?"none":`0 0 4px ${g.primary}99`}}),r&&s==="bottomSheet"&&n("div",{style:{position:"absolute",display:"flex",flexDirection:"row",gap:2,marginTop:12},children:[0,1,2].map(M=>n("div",{style:{width:12,height:1,backgroundColor:w.success,opacity:.6}},M))})]})});const Qe=$t(function o({onAcknowledge:r}){return n("div",{style:{backgroundColor:`${w.info}15`,borderLeft:`3px solid ${w.info}`,borderRadius:8,margin:"8px 12px 4px",overflow:"hidden",boxShadow:`0 0 8px ${w.info}4D`,flexShrink:0},children:b("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:12,gap:12},children:[b("div",{style:{width:32,height:32,position:"relative",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:[n("div",{style:{position:"absolute",width:20,height:20,borderRadius:10,border:`2px solid ${w.info}`,opacity:.6,transform:"scale(0.8)",boxSizing:"border-box"}}),n("div",{style:{position:"absolute",width:20,height:20,borderRadius:10,border:`2px solid ${w.info}`,boxSizing:"border-box"}})]}),b("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:2},children:[n("span",{style:{fontSize:13,fontWeight:600,color:w.info,letterSpacing:.3},children:"\u{1F4A1} Pro Tip"}),n("span",{style:{fontSize:12,color:w.primaryLight,lineHeight:"16px"},children:"Double-tap the header to transform this into a floating modal"})]}),n("button",{type:"button",onClick:r,style:{backgroundColor:`${w.info}30`,padding:"6px 12px",borderRadius:6,border:`1px solid ${w.info}50`,fontSize:12,fontWeight:600,color:w.info,cursor:"pointer",fontFamily:"inherit",flexShrink:0},children:"Got it!"})]})})});function pe({header:o,isResizing:r,mode:s,onMinimize:u,variant:x="default"}){if(o?.customContent){let l=o.customContent;if(_e(o.customContent)&&u){l=ze(o.customContent,{onMinimize:u})}return b("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minWidth:0},children:[n(he,{isResizing:r,mode:s,hasCustomContent:true,variant:x}),l]})}return b("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",position:"relative",minWidth:0},children:[n(he,{isResizing:r,mode:s,variant:x}),b("div",{style:{padding:"0 16px",display:"flex",flexDirection:"column",alignItems:"center"},children:[o?.title&&n("span",{style:{fontSize:16,fontWeight:600,color:w.primary},children:o.title}),o?.subtitle&&n("span",{style:{fontSize:12,color:w.secondary,paddingTop:4},children:o.subtitle})]}),n("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:n("span",{style:{fontSize:10,color:w.muted,fontStyle:"italic"},children:"Double tap: Toggle \u2022 Triple tap: Close"})})]})}const Ke=({visible:o,onClose:r,children:s,header:u,styles:x={},minHeight:l=Ne,maxHeight:C,initialHeight:M=Oe,animatedHeight:Q,benchMotion:U,initialMode:Z="bottomSheet",onModeChange:Y,persistenceKey:A,enablePersistence:H=true,initialFloatingPosition:P,footer:q,footerHeight:lt=0,onBack:ct,onMinimize:D,minimizeRequest:dt=0,minimizeTargetPosition:kt,initialModalState:v,zIndex:Ot,disableScrollWrapper:ge=false,background:Xt=true,variant:ut="night"})=>{const[I]=T(Xe);const[jt,Gt]=T(!H);const[p,St]=T(Z);const ft=y(Y);ft.current=Y;const[K,F]=T(false);const[Dt,tt]=T(false);const[me,At]=T(M);const[E,et]=T(()=>Ht({width:wt(),height:ce,top:P?.y??(B()-ce)/2,left:P?.x??0},I));const[xe,ht]=T(false);const[ye,Ut]=T(false);const be=Be();const L=y(M);const R=y(E);const k=y({x:E.left,y:E.top});const pt=y(null);const It=y(null);const _=y(null);const N=y([]);const $=m(()=>{N.current.forEach(t=>t());N.current=[]},[]);W(()=>{R.current=E},[E]);W(()=>$,[$]);const Zt=C||B()-I.top;W(()=>{if(!H||!A){Gt(true);return}let t=true;const e=async()=>{const i=await Wt.load(A);if(t&&i){if(i.mode){St(i.mode);ft.current?.(i.mode)}if(i.panelHeight){At(i.panelHeight);L.current=i.panelHeight}if(i.dimensions){const a=Ht(i.dimensions,I,true);et(a);k.current={x:a.left,y:a.top}}}if(t)Gt(true)};e();return()=>{t=false}},[A,H]);W(()=>{if(!H||!A||!jt)return;const t=setTimeout(()=>{Wt.save(A,{mode:p,panelHeight:L.current,dimensions:E,isVisible:o})},500);return()=>clearTimeout(t)},[p,me,E,o,A,H,jt]);W(()=>{let t=true;const e=async()=>{try{const i=ae.modal.hintAcknowledged();const a=await se.getItem(i);if(t){ht(a!=="true");Ut(true)}}catch{if(t){ht(true);Ut(true)}}};e();return()=>{t=false}},[]);const we=m(async()=>{try{const t=ae.modal.hintAcknowledged();await se.setItem(t,"true");ht(false)}catch{ht(false)}},[]);const Rt=m(()=>{tt(false);F(false);const t=p==="bottomSheet"?"floating":"bottomSheet";St(t);ft.current?.(t)},[p]);W(()=>{tt(false);F(false)},[p]);const O=m(()=>{if(!D)return;const t={mode:p,panelHeight:L.current,floatingPosition:{x:R.current.left,y:R.current.top},floatingDimensions:{width:R.current.width,height:R.current.height}};if(H&&A)void Wt.saveMinimized(A,t);const e=kt?.x??wt()-50;const i=kt?.y??B()-150;$();if(p==="bottomSheet"){const a=pt.current;if(!a){D(t);return}const c=B();N.current.push(G(300,at,h=>{a.style.opacity=String(1-h);a.style.transform=`translateY(${h*c}px)`},()=>D(t)))}else{const a=_.current;if(!a){D(t);return}const c={...k.current};N.current.push(G(300,at,h=>{a.style.opacity=String(1-h);const rt=c.x+(e-c.x)*h;const X=c.y+(i-c.y)*h;a.style.transform=`translate(${rt}px, ${X}px)`},()=>D(t)))}},[p,D,kt,$,H,A]);const qt=y(dt);W(()=>{if(qt.current===dt)return;qt.current=dt;O()},[dt,O]);W(()=>{if(!v)return;if(v.mode){St(v.mode);ft.current?.(v.mode)}if(v.panelHeight){At(v.panelHeight);L.current=v.panelHeight}if(v.floatingDimensions&&v.floatingPosition){const t={width:v.floatingDimensions.width,height:v.floatingDimensions.height,top:v.floatingPosition.y,left:v.floatingPosition.x};et(t);k.current={x:v.floatingPosition.x,y:v.floatingPosition.y}}},[v]);Ee(()=>{if(!o)return;$();if(p==="bottomSheet"){const t=pt.current;if(!t)return;const e=B();t.style.transform=`translateY(${e}px)`;t.style.opacity="0";N.current.push(G(300,de,i=>{t.style.transform=`translateY(${(1-i)*e}px)`}),G(200,at,i=>{t.style.opacity=String(i)}))}else{const t=_.current;if(!t)return;k.current={x:R.current.left,y:R.current.top};t.style.transform=`translate(${k.current.x}px, ${k.current.y}px)`;t.style.opacity="0";N.current.push(G(200,at,e=>{t.style.opacity=String(e)}))}},[o,p,$]);const Jt=y(0);const nt=y(0);const ot=y(null);const gt=m(()=>{const t=Date.now();if(t-Jt.current>500){nt.current=0}nt.current++;Jt.current=t;if(ot.current)clearTimeout(ot.current);ot.current=setTimeout(()=>{if(nt.current===2){Rt()}else if(nt.current>=3){if(D)O()}nt.current=0},300)},[Rt,D,O]);W(()=>{return()=>{if(ot.current)clearTimeout(ot.current)}},[]);const mt=y({active:false,resizing:false,startY:0,headerOffsetY:0,samples:[]});const ve=m(t=>{if(p!=="bottomSheet")return;if(t.button!==0||t.target.closest('button, a, input, textarea, select, [role="button"], [role="tab"], [role="switch"], [contenteditable="true"], [tabindex]'))return;const e=mt.current;e.active=true;e.resizing=false;e.startY=t.clientY;const i=t.currentTarget.getBoundingClientRect();e.headerOffsetY=t.clientY-i.top;e.samples=[{t:performance.now(),y:t.clientY}];t.currentTarget.setPointerCapture(t.pointerId)},[p]);const Ce=m(t=>{const e=mt.current;if(!e.active)return;const i=t.clientY-e.startY;if(!e.resizing&&Math.abs(i)>3){e.resizing=true;$();F(true)}if(!e.resizing)return;const a=t.clientY-e.headerOffsetY;let c=B()-a;c=Math.max(l,Math.min(c,Zt));L.current=c;if(It.current)It.current.style.height=`${c}px`;const h=performance.now();e.samples.push({t:h,y:t.clientY});while(e.samples.length>2&&h-e.samples[0].t>100)e.samples.shift()},[l,Zt,$]);const ke=m(t=>{const e=mt.current;if(!e.active)return;e.active=false;if(!e.resizing){gt();return}F(false);const i=L.current;const a=t.clientY-e.startY;const c=e.samples[0];const h=e.samples[e.samples.length-1];const rt=h&&c&&h.t>c.t?(h.y-c.y)/(h.t-c.t):0;const X=rt>.8&&a>50||a>150&&i<=l;if(X){const S=pt.current;$();if(S){const it=B();N.current.push(G(200,at,j=>{S.style.opacity=String(1-j)}),G(300,de,j=>{S.style.transform=`translateY(${j*it}px)`},()=>r()))}else{r()}return}At(i)},[l,r,gt,$]);const Se=m(()=>{const t=mt.current;if(!t.active)return;t.active=false;t.resizing=false;F(false)},[]);const xt=y({active:false,dragging:false,startX:0,startY:0,startPos:{x:0,y:0}});const De=m(t=>{if(p!=="floating"||K)return;if(t.button!==0||t.target.closest('button, a, input, textarea, select, [role="button"], [role="tab"], [role="switch"], [contenteditable="true"], [tabindex]'))return;const e=xt.current;e.active=true;e.dragging=false;e.startX=t.clientX;e.startY=t.clientY;e.startPos={...k.current};t.currentTarget.setPointerCapture(t.pointerId)},[p,K]);const Ae=m(t=>{const e=xt.current;if(!e.active)return;const i=t.clientX-e.startX;const a=t.clientY-e.startY;if(!e.dragging&&Math.abs(i)+Math.abs(a)>5){e.dragging=true;tt(true)}if(!e.dragging)return;const c=e.startPos.x+i;const h=e.startPos.y+a;k.current={x:c,y:h};if(_.current){_.current.style.transform=`translate(${c}px, ${h}px)`}},[]);const Ie=m(()=>{const t=xt.current;if(!t.active)return;t.active=false;if(!t.dragging){gt();return}tt(false);const e=R.current;const i=Ht({...e,left:k.current.x,top:k.current.y},I);const a=i.left;const c=i.top;k.current={x:a,y:c};if(_.current){_.current.style.transform=`translate(${a}px, ${c}px)`}et(h=>({...h,left:a,top:c}))},[I,gt]);const Re=m(()=>{const t=xt.current;if(!t.active)return;t.active=false;t.dragging=false;tt(false)},[]);const Tt=y({active:false,corner:"bottomRight",startX:0,startY:0,start:{width:0,height:0,top:0,left:0}});const Te=m(t=>e=>{if(p!=="floating")return;e.stopPropagation();const i=Tt.current;i.active=true;i.corner=t;i.startX=e.clientX;i.startY=e.clientY;i.start={...R.current};F(true);e.currentTarget.setPointerCapture(e.pointerId)},[p]);const Me=m(t=>{const e=Tt.current;if(!e.active)return;const i=t.clientX-e.startX;const a=t.clientY-e.startY;if(Math.abs(i)<.5&&Math.abs(a)<.5)return;const c=Math.max(0,I.left);const h=B()-Math.max(0,I.bottom);const rt=wt()-Math.max(0,I.right);const X=wt()*.25;const S=e.start;const it=S.left+S.width;const j=S.top+S.height;let st=S.left;const bt=S.top;let oe=it;let Mt=j;if(e.corner==="bottomLeft"){st=Math.max(c,Math.min(S.left+i,it-X));Mt=Math.min(h,Math.max(j+a,S.top+J))}else{oe=Math.min(rt,Math.max(it+i,S.left+X));Mt=Math.min(h,Math.max(j+a,S.top+J))}const $e=Math.max(X,oe-st);const We=Math.max(J,Mt-bt);const re={width:$e,height:We,left:st,top:bt};R.current=re;k.current={x:st,y:bt};et(re);if(_.current){_.current.style.transform=`translate(${st}px, ${bt}px)`}},[I.left,I.right,I.bottom]);const Vt=m(()=>{const t=Tt.current;if(!t.active)return;t.active=false;F(false);et(R.current)},[]);const yt=!o;const Qt=yt?{left:-9999,top:-9999,opacity:0,visibility:"hidden",pointerEvents:"none"}:{};const Kt=u?.title||"Dev tool panel";const f=ut==="night";const te=Xt&&f?n("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},"aria-hidden":true,children:n(le,{})}):null;const ee=b("div",{style:{flex:1,minHeight:0,position:"relative",display:"flex",flexDirection:"column",backgroundColor:f?"transparent":g.base,borderBottomLeftRadius:16,borderBottomRightRadius:16,overflow:"hidden",...x.content},children:[Xt&&!f?n(le,{}):null,ge?n("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",paddingBottom:lt},children:s}):n("div",{style:{flex:1,minHeight:0,overflowY:"auto",paddingBottom:lt},children:s}),q?n("div",{style:{position:"absolute",left:0,right:0,bottom:0,backgroundColor:g.base,borderBottomLeftRadius:16,borderBottomRightRadius:16},children:q}):null]});const ne=n("div",{style:{position:"absolute",top:4,right:4,zIndex:10},children:n(Ge,{onClose:r,onMinimize:D?O:void 0,onToggleMode:Rt,mode:p,variant:ut})});if(p==="floating"){const t=Dt||K;return b("div",{ref:_,role:"dialog","aria-label":Kt,"aria-hidden":yt||void 0,style:{fontFamily:ie,position:"fixed",pointerEvents:"auto",left:0,top:0,width:E.width,height:E.height,transform:`translate(${k.current.x}px, ${k.current.y}px)`,display:"flex",flexDirection:"column",backgroundColor:f?d.color.bg:g.card,borderRadius:f?d.radius.sheet:6,border:f?`1px solid ${d.color.accent}55`:t?`2px solid ${g.primary}`:`1px solid ${g.border}`,boxShadow:f?`0 0 14px ${d.color.accent}38`:t?`0 0 12px ${g.primary}7A`:`0 0 20px ${g.primary}4D`,...f?{overflow:"hidden"}:null,boxSizing:"border-box",zIndex:Ot??1e3,...x.container,...Qt},children:[te,n("div",{onPointerDown:De,onPointerMove:Ae,onPointerUp:Ie,onPointerCancel:Re,style:{borderTopLeftRadius:f?d.radius.sheet:6,borderTopRightRadius:f?d.radius.sheet:6,backgroundColor:f?"transparent":g.card,minHeight:56,border:f?"none":`1px solid ${g.border}`,boxSizing:"border-box",display:"flex",flexDirection:"column",justifyContent:"center",flexShrink:0,touchAction:"none",userSelect:"none",cursor:Dt?"grabbing":"grab",position:"relative"},children:n(pe,{header:u,isResizing:Dt||K,mode:p,onMinimize:D?O:void 0,variant:ut})}),ne,ee,["bottomLeft","bottomRight"].map(e=>n("div",{onPointerDown:Te(e),onPointerMove:Me,onPointerUp:Vt,onPointerCancel:Vt,style:{position:"absolute",width:30,height:30,bottom:4,...e==="bottomLeft"?{left:4}:{right:4},zIndex:1e3,touchAction:"none",cursor:e==="bottomLeft"?"nesw-resize":"nwse-resize"},children:n("div",{style:{width:20,height:20,borderRadius:10,boxSizing:"border-box",backgroundColor:t?`${w.success}1A`:"transparent",border:t?`2px solid ${w.success}`:"none",boxShadow:t?`0 0 8px ${w.success}99`:"none"}})},e))]},"floating")}return n("div",{"aria-hidden":yt||void 0,style:{fontFamily:ie,position:"fixed",inset:0,zIndex:Ot??1e3,pointerEvents:"none",...yt?{...Qt,inset:"auto",width:"100vw",height:"100vh"}:null},children:n("div",{ref:pt,style:{position:"absolute",bottom:0,left:0,right:0,pointerEvents:"auto"},children:b("div",{ref:It,role:"dialog","aria-label":Kt,style:{height:L.current,display:"flex",flexDirection:"column",backgroundColor:f?d.color.bg:g.card,borderTopLeftRadius:f?d.radius.sheet:6,borderTopRightRadius:f?d.radius.sheet:6,border:f?`1px solid ${d.color.accent}55`:`1px solid ${g.border}`,boxShadow:f?`0 -4px 10px ${d.color.accent}38`:`0 -4px 12px ${g.primary}33`,...f?{overflow:"hidden"}:null,boxSizing:"border-box",position:"relative",...x.container},children:[te,n("div",{onPointerDown:ve,onPointerMove:Ce,onPointerUp:ke,onPointerCancel:Se,style:{borderTopLeftRadius:f?d.radius.sheet:6,borderTopRightRadius:f?d.radius.sheet:6,backgroundColor:f?"transparent":g.card,minHeight:56,border:f?"none":`1px solid ${g.border}`,boxSizing:"border-box",display:"flex",flexDirection:"column",justifyContent:"center",flexShrink:0,touchAction:"none",userSelect:"none",cursor:"ns-resize",position:"relative"},children:n(pe,{header:u,isResizing:K,mode:p,onMinimize:D?O:void 0,variant:ut})}),ne,ye&&xe&&!be&&n(Qe,{onAcknowledge:we}),ee]})})},"bottomSheet")};export const JsModal=$t(o=>{const r=He()();if(r.status!=="admitted")return o.visible?n(Pe,{}):null;return n(Ke,{...o})});
@@ -1 +1 @@
1
- "use strict";import{getAutoDetectedClipboard as n}from"./autoDetectClipboard.js";import{safeStringify as r}from"../utils/safeStringify.js";import{displayValue as i}from"../utils/displayValue.js";const c=n();export async function copyToClipboard(t){try{const o=typeof t==="string"?t:typeof t==="object"&&t!==null?(()=>{try{if(typeof structuredClone==="function"){const e=structuredClone(t);return r(e,2,{depthLimit:100,edgesLimit:1e3})}}catch{}return r(t,2,{depthLimit:100,edgesLimit:1e3})})():i(t);return await c(o)}catch(o){console.error("[RnBetterDevTools] Copy failed:",o);console.error("Value type:",typeof t);console.error("Value constructor:",t?.constructor?.name);return false}}export function isClipboardAvailable(){return true}
1
+ "use strict";import{getAutoDetectedClipboard as n}from"./autoDetectClipboard.js";import{safeStringify as r}from"../utils/safeStringify.js";import{displayValue as i}from"../utils/displayValue.js";const c=n();export async function copyToClipboard(t){try{const o=typeof t==="string"?t:typeof t==="object"&&t!==null?(()=>{try{if(typeof structuredClone==="function"){const e=structuredClone(t);return r(e,2,{depthLimit:100,edgesLimit:1e3})}}catch{}return r(t,2,{depthLimit:100,edgesLimit:1e3})})():i(t);return await c(o)}catch(o){console.error("[RnBetterDevTools] Copy failed:",o);console.error("[Buoy]","Value type:",typeof t);console.error("[Buoy]","Value constructor:",t?.constructor?.name);return false}}export function isClipboardAvailable(){return true}
@@ -1 +1 @@
1
- "use strict";import{useState as $,useMemo as re,useCallback as U,useRef as _,useEffect as te,memo as oe}from"react";import{Text as P,TouchableOpacity as ie,View as u,StyleSheet as ue,FlatList as pe}from"react-native";import{displayValue as Me}from"../utils/displayValue.js";import{gameUIColors as a}from"../ui/gameUI/index.js";import{night as ye}from"../ui/night/nightTheme.js";import{CopyButton as De}from"../ui/components/CopyButton.js";import{ChevronRight as Re}from"../icons/index.js";import{IndentGuidesOverlay as he}from"./IndentGuidesOverlay.js";import{monoFont as se}from"../ui/fonts.js";import{jsx as i,jsxs as T,Fragment as je}from"react/jsx-runtime";const ge={top:10,bottom:10,left:10,right:10};const z=24;const ke=24;const ee=50;const ne=15;const Pe=500;const Ze=30;const Le=300;const ae=16;const me=Array.from({length:ne+1},(e,l)=>ue.create({container:{marginLeft:l*ae}}).container);const Ae=new Map([["string",a.dataTypes.string],["number",a.dataTypes.number],["bigint",a.optional],["boolean",a.dataTypes.boolean],["null",a.dataTypes.null],["undefined",a.dataTypes.undefined],["function",a.dataTypes.function],["symbol",a.critical],["date",a.critical],["error",a.error],["array",a.dataTypes.array],["object",a.dataTypes.object],["map",a.info],["set",a.success],["circular",a.warning]]);const o=ue.create({container:{backgroundColor:ye.color.bg,borderRadius:8,borderWidth:1,borderColor:ye.color.border},header:{flexDirection:"column",paddingHorizontal:16,paddingVertical:12},headerRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:6},title:{color:a.primary,fontSize:14,fontWeight:"500"},description:{color:a.secondary,fontSize:12,marginTop:2},typeLegend:{flexDirection:"row",flexWrap:"wrap",gap:6,marginTop:8,paddingTop:8,borderTopWidth:1,borderTopColor:a.primary+"14"},typeBadge:{flexDirection:"row",alignItems:"center",paddingHorizontal:6,paddingVertical:2,borderRadius:4,borderWidth:1},typeColor:{width:8,height:8,borderRadius:4,marginRight:4},typeName:{fontSize:10,fontWeight:"500",color:a.secondary},itemContainer:{minHeight:z,backgroundColor:"transparent",position:"relative",flexDirection:"row",alignItems:"flex-start"},itemTouchable:{flex:1,flexDirection:"row",alignItems:"flex-start",paddingLeft:0,paddingRight:16,paddingVertical:2,minHeight:24},itemTouchablePressed:{backgroundColor:a.primary+"0A"},itemSelected:{backgroundColor:a.primary+"14"},expanderContainer:{width:16,alignItems:"center",justifyContent:"center",marginTop:4},expanderIcon:{width:12,height:12},labelContainer:{flex:1,flexDirection:"row",alignItems:"flex-start",paddingLeft:2},labelContainerVertical:{flex:1,flexDirection:"column",paddingLeft:2,paddingVertical:2},labelContainerVerticalRow:{flexDirection:"row",alignItems:"center",marginBottom:2},labelText:{color:a.primary,fontSize:12,fontWeight:"500",fontFamily:se,marginRight:8,flexShrink:1},labelTextTruncated:{color:a.primary,fontSize:12,fontWeight:"500",fontFamily:se,flexShrink:1},valueText:{fontSize:12,fontFamily:se,flex:1,color:a.primaryLight},loadingContainer:{padding:16,alignItems:"center"},loadingText:{color:a.secondary,fontSize:12},noDataContainer:{padding:16,alignItems:"center"},noDataText:{color:a.secondary,fontSize:12},listContent:{paddingBottom:8},headerTouchable:{flex:1,flexDirection:"row",alignItems:"center"},expanderMargin:{marginLeft:8}});function le(e){return{path:e.path.slice(1),value:e.value,label:e.key}}function ce(e,l,d=0){if(d>=l)return d;let h=d+1;if(Array.isArray(e)){for(const w of e){if(h>=l)return h;h=ce(w,l,h)}}else if(e!==null&&typeof e==="object"){for(const w of Object.values(e)){if(h>=l)return h;h=ce(w,l,h)}}return h}const _e=e=>{if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";if(e instanceof Date)return"date";if(e instanceof Error)return"error";if(e instanceof Map)return"map";if(e instanceof Set)return"set";if(e instanceof RegExp)return"regexp";if(typeof e==="function")return"function";if(typeof e==="symbol")return"symbol";if(typeof e==="bigint")return"bigint";if(typeof e==="object")return"object";return typeof e};const Ve=(e,l)=>{if(e===null)return 0;switch(l){case"array":return Array.isArray(e)?e.length:0;case"object":return typeof e==="object"&&!(e instanceof Date)&&!(e instanceof Error)&&!(e instanceof RegExp)&&!(e instanceof Map)&&!(e instanceof Set)?Object.keys(e).length:0;case"map":return e instanceof Map?e.size:0;case"set":return e instanceof Set?e.size:0;default:return 0}};const He=(e,l)=>{if(e===null)return"null";if(e===void 0)return"undefined";switch(l){case"string":return`"${String(e)}"`;case"boolean":return e===true?"true":"false";case"function":return typeof e==="function"?e.toString().slice(0,50)+"...":"undefined";case"symbol":return typeof e==="symbol"?String(e):"undefined";case"date":return e instanceof Date?e.toISOString():"undefined";case"regexp":return e instanceof RegExp?e.toString():"undefined";case"bigint":return typeof e==="bigint"?e.toString()+"n":"undefined";case"error":return e instanceof Error?`${e.name}: ${e.message}`:"undefined";default:return Me(e)}};const be=e=>{return Ae.get(e)||a.dataTypes.array};const xe=({expanded:e,onPress:l})=>{return i(ie,{"sentry-label":"ignore devtools data explorer expander",style:o.expanderContainer,onPress:l,hitSlop:ge,children:i(u,{style:o.expanderIcon,children:i(Re,{size:12,color:a.secondary,strokeWidth:2,style:{transform:[{rotate:e?"90deg":"0deg"}]}})})})};xe.displayName="Expander";const Te=oe(xe);const Se=({visibleTypes:e})=>{const l=Array.from(new Set(e)).slice(0,8);return i(u,{style:o.typeLegend,children:l.map(d=>{const h=be(d);return T(u,{style:[o.typeBadge,{backgroundColor:`${h}10`,borderColor:`${h}30`}],children:[i(u,{style:[o.typeColor,{backgroundColor:h}]}),i(P,{style:o.typeName,children:d})]},d)})})};Se.displayName="TypeLegend";const ze=oe(Se);const Oe=(e,l=10,d=false)=>{const[h,w]=$([]);const V=_(new Map);const Q=U(()=>{const t=new Set(["root"]);if(d&&e&&typeof e==="object"){if(Array.isArray(e)){e.forEach((m,s)=>{t.add(`root.${s}`)})}else{Object.keys(e).forEach(m=>{t.add(`root.${m}`)})}}return t},[d,e]);const[L,O]=$(()=>Q());const[B,A]=$(false);const I=_(new WeakSet);const j=_(false);const N=_(0);const W=_(0);const c=_(void 0);const C=U((t,m,s,g="root",n=0,M,x=[],S=0,k=1,E=[])=>{if(n>Math.min(l,ne))return[];const p=[...x,g];const f=p.join(".");const b=_e(t);const F=["object","array","map","set"].includes(b)&&t!==null;const J=F?Ve(t,b):0;const H=Math.min(J,Pe);if(t&&typeof t==="object"){if(s.has(t)){return[{id:f,key:g,value:"[Circular Reference]",valueType:"circular",depth:n,isExpandable:false,isExpanded:false,parentId:M,hasChildren:false,childCount:0,path:p,type:"circular",isLastChild:S===k-1,parentHasMoreSiblings:[...E],siblingIndex:S,totalSiblings:k}]}s.add(t)}const r={id:f,key:g,value:t,valueType:b,depth:n,isExpandable:F,isExpanded:m.has(f),parentId:M,hasChildren:H>0,childCount:H,path:p,type:F?"expandable":b,isLastChild:S===k-1,parentHasMoreSiblings:[...E],siblingIndex:S,totalSiblings:k};const y=[r];if(F&&m.has(f)&&n<Math.min(l,ne)){try{let D=[];switch(b){case"array":D=Array.isArray(t)?t.map((R,G)=>[G.toString(),R]):[];break;case"object":D=typeof t==="object"&&t!==null&&!(t instanceof Date)&&!(t instanceof Error)&&!(t instanceof RegExp)&&!(t instanceof Map)&&!(t instanceof Set)?Object.entries(t):[];break;case"map":D=t instanceof Map?Array.from(t.entries()).map(([R,G])=>[String(R),G]):[];break;case"set":D=t instanceof Set?Array.from(t.values()).map((R,G)=>[G.toString(),R]):[];break}const v=D.slice(0,H);const Ce=v.length;const de=[...E];if(n>0){de[n-1]=!r.isLastChild}for(let R=0;R<v.length;R+=ee){const G=v.slice(R,R+ee);let fe=R;for(const[we,Ie]of G){y.push(...C(Ie,m,s,we,n+1,f,p,fe,Ce,de));fe++}if(R>0&&R%(ee*2)===0){break}}}catch(D){console.error(D)}}return y},[l]);te(()=>{if(c.current&&(c.current.type==="expand"||c.current.type==="collapse")){if(B){A(false);j.current=false}c.current=void 0;return}if(j.current){return}let t;const m=++N.current;const s=()=>N.current===m;j.current=true;A(true);const g=async()=>{t=setTimeout(()=>{if(j.current&&s()){A(false);j.current=false}},5e3);await new Promise(n=>setTimeout(()=>n(),10));if(!s()){return}try{I.current=new WeakSet;W.current=Date.now();const n=C(e,L,I.current,"root",0,void 0,[],0,1,[]);const M=new Map;n.forEach((x,S)=>{M.set(x.id,{item:x,index:S})});V.current=M;if(t)clearTimeout(t);if(s()){w(n);A(false);j.current=false}}catch(n){console.error(n);if(t)clearTimeout(t);if(s()){w([]);V.current=new Map;A(false);j.current=false}}};g();return()=>{j.current=false;if(t)clearTimeout(t)}},[e,L,C,l]);const Y=U((t,m)=>{A(false);j.current=false;w(s=>{const g=V.current.get(t);if(!g){return s}const{item:n,index:M}=g;if(m&&n.isExpandable&&n.hasChildren){const x=[...s];const S=new WeakSet;if(n.value&&typeof n.value==="object"){S.add(n.value)}const k=[];try{let f=[];const b=n.valueType;switch(b){case"array":f=Array.isArray(n.value)?n.value.map((r,y)=>[y.toString(),r]):[];break;case"object":f=typeof n.value==="object"&&n.value!==null&&!(n.value instanceof Date)&&!(n.value instanceof Error)&&!(n.value instanceof RegExp)&&!(n.value instanceof Map)&&!(n.value instanceof Set)?Object.entries(n.value):[];break;case"map":f=n.value instanceof Map?Array.from(n.value.entries()).map(([r,y])=>[String(r),y]):[];break;case"set":f=n.value instanceof Set?Array.from(n.value.values()).map((r,y)=>[y.toString(),r]):[];break}const F=f.length;const J=n.parentHasMoreSiblings||[];const H=[...J];if(n.depth>0){H[n.depth-1]=!n.isLastChild}f.forEach(([r,y],D)=>{const v=C(y,new Set,S,r,n.depth+1,t,n.path,D,F,H);k.push(...v)})}catch(f){console.error(f)}const E=k;if(E.length>0){}x[M]={...n,isExpanded:true};x.splice(M+1,0,...E);const p=new Map;x.forEach((f,b)=>{p.set(f.id,{item:f,index:b})});V.current=p;return x}else if(!m){const x=new Set;const S=(p,f)=>{s.forEach(b=>{if(b.parentId===p||b.id.startsWith(p+".")&&b.depth>f){x.add(b.id);if(b.hasChildren){S(b.id,b.depth)}}})};S(t,n.depth);const k=s.map(p=>{if(p.id===t){return{...p,isExpanded:false}}return p}).filter(p=>!x.has(p.id));const E=new Map;k.forEach((p,f)=>{E.set(p.id,{item:p,index:f})});V.current=E;return k}return s})},[C]);const X=U(t=>{O(m=>{const s=new Set(m);const g=!s.has(t);if(g){s.add(t)}else{s.delete(t)}c.current={type:g?"expand":"collapse",itemId:t};Y(t,g);return s})},[Y]);const K=ce(e,ee,0)<ee;const q=re(()=>{if(!K)return null;return C(e,L,new WeakSet,"root",0,void 0,[],0,1,[])},[K,e,L,C]);const Z=U(t=>{if(t.length===0)return;O(m=>{if(t.every(g=>m.has(g)))return m;const s=new Set(m);for(const g of t)s.add(g);return s})},[]);return{flatData:q??h,isProcessing:q?false:B,toggleExpanded:X,revealPath:Z}};const Ee=({item:e,onToggleExpanded:l,index:d,onSelect:h,isSelected:w,selectable:V,onRequestInlineEdit:Q,isInlineEditing:L,inlineEditor:O,testIDPrefix:B})=>{const[A,I]=$(false);const[j,N]=$(false);const W=V===true;const c=_(0);const C=e.path.slice(1);const Y=me[Math.min(e.depth,ne)]||me[0];const X=be(e.valueType);const K=false;const q=()=>{if(W){const s=Date.now();const g=s-c.current<Le;c.current=s;if(g&&!e.isExpandable&&Q){Q(e);return}h(e);return}if(e.isExpandable){l(e.id)}h(e)};const Z=()=>{if(e.isExpandable){l(e.id)}h(e)};const t=()=>{};const m=e.key;return T(u,{style:[o.itemContainer,Y],children:[T(ie,{"sentry-label":"ignore devtools data explorer item",testID:`${B}-${e.id}`,accessibilityLabel:`${e.key}: ${e.valueType}`,style:[o.itemTouchable,A&&o.itemTouchablePressed,W&&w&&o.itemSelected,K&&{minHeight:ke,paddingVertical:2}],onPress:q,onPressIn:()=>I(true),onPressOut:()=>I(false),activeOpacity:e.isExpandable||W?.7:1,disabled:!e.isExpandable&&!W,children:[e.isExpandable?i(Te,{expanded:e.isExpanded,onPress:Z}):i(u,{style:o.expanderContainer}),T(u,{style:o.labelContainer,children:[T(P,{style:o.labelText,numberOfLines:1,children:[e.key,":"]}),L&&O?O:e.isExpandable?T(P,{style:[o.valueText,{color:a.secondary}],numberOfLines:1,children:[e.valueType," (",e.childCount," ",e.childCount===1?"item":"items",")"]}):i(P,{style:[o.valueText,{color:X}],numberOfLines:1,children:He(e.value,e.valueType)})]})]}),e.value!==void 0?i(De,{value:e.value,size:14,buttonStyle:{marginLeft:8,marginRight:8}}):null]})};Ee.displayName="VirtualizedItem";const Ne=oe(Ee);export const VirtualizedDataExplorer=({title:e,description:l,data:d,maxDepth:h=10,rawMode:w=false,initialExpanded:V=false,disableCopy:Q=false,onSelectionChange:L,onRequestInlineEdit:O,inlineEditPath:B,renderInlineEditor:A,selectPath:I,testIDPrefix:j="buoy-tree-row"})=>{const[N,W]=$(w);const{flatData:c,isProcessing:C,toggleExpanded:Y,revealPath:X}=Oe(d,h,V);const K=_(null);const[q,Z]=$({start:0,end:Math.min(c.length-1,Math.max(0,Math.ceil(400/z)-1))});const t=_({itemVisiblePercentThreshold:1});const m=_(({viewableItems:r})=>{const y=r.map(D=>D.index).filter(D=>typeof D==="number");if(y.length){Z({start:Math.min(...y),end:Math.max(...y)})}}).current;te(()=>{Z({start:0,end:Math.min(c.length-1,Math.max(0,Math.ceil(400/z)-1))})},[c.length]);const s=re(()=>{const r=new Set;for(const y of c){r.add(y.valueType);if(r.size>=8)break}return Array.from(r)},[c]);const g=()=>{W(!N)};const[n,M]=$(null);const x=re(()=>n==null?void 0:c.find(r=>r.id===n),[c,n]);const S=x?.depth;te(()=>{if(!L)return;L(x?le(x):null)},[x,L]);const k=U(r=>{M(y=>y===r.id?null:r.id)},[]);const E=I===void 0?void 0:I===null?"\0null":I.join(".");const p=_(E);te(()=>{if(E===p.current)return;p.current=E;if(E===void 0)return;if(I==null){M(null);return}const r=["root"];for(const y of I.slice(0,-1)){r.push(`${r[r.length-1]}.${y}`)}X(r);M(["root",...I].join("."))},[E,I,X]);const f=U(r=>{M(r.id);O?.(le(r))},[O]);const b=({item:r,index:y})=>i(Ne,{item:r,index:y,onToggleExpanded:Y,onSelect:k,isSelected:x?.id===r.id,selectable:L!=null,onRequestInlineEdit:f,isInlineEditing:B!=null&&B.join(".")===r.path.slice(1).join("."),inlineEditor:A?A(le(r)):null,testIDPrefix:j});const F=z;const J=r=>r.id;const H=d!==null&&d!==void 0&&(typeof d==="string"?d.length>0:typeof d==="number"||typeof d==="boolean"?true:Array.isArray(d)?d.length>0:typeof d==="object"?Object.keys(d).length>0:false);if(w){if(!H){return i(u,{style:{flex:1,justifyContent:"center",alignItems:"center",padding:20},children:i(P,{style:o.noDataText,children:"No data available"})})}return i(u,{style:{minHeight:C?40:c.length*z},children:C?i(u,{style:{flex:1,justifyContent:"center",alignItems:"center"},children:T(P,{style:o.loadingText,children:["Processing data... (raw mode, isProcessing=",String(C),")"]})}):T(u,{style:{position:"relative",height:c.length*z},children:[i(he,{items:c,visibleRange:{start:0,end:Math.max(0,c.length-1)},itemHeight:z,indentWidth:ae,activeDepth:S}),i(pe,{ref:K,"sentry-label":"ignore devtools data explorer list",data:c,renderItem:b,keyExtractor:J,showsVerticalScrollIndicator:true,contentContainerStyle:o.listContent,initialNumToRender:15,maxToRenderPerBatch:10,windowSize:10,scrollEnabled:false})]})})}if(!H){return T(u,{style:o.container,children:[i(u,{style:o.header,children:i(u,{style:o.headerRow,children:T(u,{style:{flex:1},children:[i(P,{style:o.title,children:e}),l&&i(P,{style:o.description,children:l})]})})}),i(u,{style:o.noDataContainer,children:i(P,{style:o.noDataText,children:"No data available"})})]})}return T(u,{style:o.container,children:[T(u,{style:o.header,children:[i(u,{style:o.headerRow,children:T(ie,{"sentry-label":"ignore devtools data explorer header toggle",onPress:g,hitSlop:ge,style:o.headerTouchable,children:[T(u,{style:{flex:1},children:[i(P,{style:o.title,children:e}),l&&i(P,{style:o.description,children:l})]}),i(u,{style:o.expanderMargin,children:i(Te,{expanded:N,onPress:g})})]})}),N&&s.length>0&&!w&&i(ze,{visibleTypes:s})]}),N&&i(je,{children:C?i(u,{style:o.loadingContainer,children:T(P,{style:o.loadingText,children:["Processing data... (isProcessing=",String(C),")"]})}):T(u,{style:{height:c.length*z,position:"relative"},children:[i(he,{items:c,visibleRange:q,itemHeight:z,indentWidth:ae,activeDepth:S}),i(pe,{ref:K,"sentry-label":"ignore devtools data explorer collapsed list",data:c,renderItem:b,keyExtractor:J,showsVerticalScrollIndicator:true,contentContainerStyle:o.listContent,initialNumToRender:15,maxToRenderPerBatch:10,windowSize:10,scrollEnabled:false,onViewableItemsChanged:m,viewabilityConfig:t.current})]})})]})};
1
+ "use strict";import{useState as B,useMemo as re,useCallback as U,useRef as _,useEffect as te,memo as oe}from"react";import{Text as P,TouchableOpacity as ie,View as u,StyleSheet as ue,FlatList as pe}from"react-native";import{displayValue as Me}from"../utils/displayValue.js";import{gameUIColors as a}from"../ui/gameUI/index.js";import{night as ye}from"../ui/night/nightTheme.js";import{CopyButton as De}from"../ui/components/CopyButton.js";import{ChevronRight as Re}from"../icons/index.js";import{IndentGuidesOverlay as he}from"./IndentGuidesOverlay.js";import{monoFont as se}from"../ui/fonts.js";import{jsx as i,jsxs as T,Fragment as je}from"react/jsx-runtime";const ge={top:10,bottom:10,left:10,right:10};const z=24;const ke=24;const ee=50;const ne=15;const Pe=500;const Ze=30;const Le=300;const ae=16;const me=Array.from({length:ne+1},(e,l)=>ue.create({container:{marginLeft:l*ae}}).container);const Ae=new Map([["string",a.dataTypes.string],["number",a.dataTypes.number],["bigint",a.optional],["boolean",a.dataTypes.boolean],["null",a.dataTypes.null],["undefined",a.dataTypes.undefined],["function",a.dataTypes.function],["symbol",a.critical],["date",a.critical],["error",a.error],["array",a.dataTypes.array],["object",a.dataTypes.object],["map",a.info],["set",a.success],["circular",a.warning]]);const o=ue.create({container:{backgroundColor:ye.color.bg,borderRadius:8,borderWidth:1,borderColor:ye.color.border},header:{flexDirection:"column",paddingHorizontal:16,paddingVertical:12},headerRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:6},title:{color:a.primary,fontSize:14,fontWeight:"500"},description:{color:a.secondary,fontSize:12,marginTop:2},typeLegend:{flexDirection:"row",flexWrap:"wrap",gap:6,marginTop:8,paddingTop:8,borderTopWidth:1,borderTopColor:a.primary+"14"},typeBadge:{flexDirection:"row",alignItems:"center",paddingHorizontal:6,paddingVertical:2,borderRadius:4,borderWidth:1},typeColor:{width:8,height:8,borderRadius:4,marginRight:4},typeName:{fontSize:10,fontWeight:"500",color:a.secondary},itemContainer:{minHeight:z,backgroundColor:"transparent",position:"relative",flexDirection:"row",alignItems:"flex-start"},itemTouchable:{flex:1,flexDirection:"row",alignItems:"flex-start",paddingLeft:0,paddingRight:16,paddingVertical:2,minHeight:24},itemTouchablePressed:{backgroundColor:a.primary+"0A"},itemSelected:{backgroundColor:a.primary+"14"},expanderContainer:{width:16,alignItems:"center",justifyContent:"center",marginTop:4},expanderIcon:{width:12,height:12},labelContainer:{flex:1,flexDirection:"row",alignItems:"flex-start",paddingLeft:2},labelContainerVertical:{flex:1,flexDirection:"column",paddingLeft:2,paddingVertical:2},labelContainerVerticalRow:{flexDirection:"row",alignItems:"center",marginBottom:2},labelText:{color:a.primary,fontSize:12,fontWeight:"500",fontFamily:se,marginRight:8,flexShrink:1},labelTextTruncated:{color:a.primary,fontSize:12,fontWeight:"500",fontFamily:se,flexShrink:1},valueText:{fontSize:12,fontFamily:se,flex:1,color:a.primaryLight},loadingContainer:{padding:16,alignItems:"center"},loadingText:{color:a.secondary,fontSize:12},noDataContainer:{padding:16,alignItems:"center"},noDataText:{color:a.secondary,fontSize:12},listContent:{paddingBottom:8},headerTouchable:{flex:1,flexDirection:"row",alignItems:"center"},expanderMargin:{marginLeft:8}});function le(e){return{path:e.path.slice(1),value:e.value,label:e.key}}function ce(e,l,d=0){if(d>=l)return d;let h=d+1;if(Array.isArray(e)){for(const w of e){if(h>=l)return h;h=ce(w,l,h)}}else if(e!==null&&typeof e==="object"){for(const w of Object.values(e)){if(h>=l)return h;h=ce(w,l,h)}}return h}const _e=e=>{if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";if(e instanceof Date)return"date";if(e instanceof Error)return"error";if(e instanceof Map)return"map";if(e instanceof Set)return"set";if(e instanceof RegExp)return"regexp";if(typeof e==="function")return"function";if(typeof e==="symbol")return"symbol";if(typeof e==="bigint")return"bigint";if(typeof e==="object")return"object";return typeof e};const Ve=(e,l)=>{if(e===null)return 0;switch(l){case"array":return Array.isArray(e)?e.length:0;case"object":return typeof e==="object"&&!(e instanceof Date)&&!(e instanceof Error)&&!(e instanceof RegExp)&&!(e instanceof Map)&&!(e instanceof Set)?Object.keys(e).length:0;case"map":return e instanceof Map?e.size:0;case"set":return e instanceof Set?e.size:0;default:return 0}};const He=(e,l)=>{if(e===null)return"null";if(e===void 0)return"undefined";switch(l){case"string":return`"${String(e)}"`;case"boolean":return e===true?"true":"false";case"function":return typeof e==="function"?e.toString().slice(0,50)+"...":"undefined";case"symbol":return typeof e==="symbol"?String(e):"undefined";case"date":return e instanceof Date?e.toISOString():"undefined";case"regexp":return e instanceof RegExp?e.toString():"undefined";case"bigint":return typeof e==="bigint"?e.toString()+"n":"undefined";case"error":return e instanceof Error?`${e.name}: ${e.message}`:"undefined";default:return Me(e)}};const be=e=>{return Ae.get(e)||a.dataTypes.array};const xe=({expanded:e,onPress:l})=>{return i(ie,{"sentry-label":"ignore devtools data explorer expander",style:o.expanderContainer,onPress:l,hitSlop:ge,children:i(u,{style:o.expanderIcon,children:i(Re,{size:12,color:a.secondary,strokeWidth:2,style:{transform:[{rotate:e?"90deg":"0deg"}]}})})})};xe.displayName="Expander";const Te=oe(xe);const Se=({visibleTypes:e})=>{const l=Array.from(new Set(e)).slice(0,8);return i(u,{style:o.typeLegend,children:l.map(d=>{const h=be(d);return T(u,{style:[o.typeBadge,{backgroundColor:`${h}10`,borderColor:`${h}30`}],children:[i(u,{style:[o.typeColor,{backgroundColor:h}]}),i(P,{style:o.typeName,children:d})]},d)})})};Se.displayName="TypeLegend";const ze=oe(Se);const Oe=(e,l=10,d=false)=>{const[h,w]=B([]);const V=_(new Map);const Q=U(()=>{const t=new Set(["root"]);if(d&&e&&typeof e==="object"){if(Array.isArray(e)){e.forEach((m,s)=>{t.add(`root.${s}`)})}else{Object.keys(e).forEach(m=>{t.add(`root.${m}`)})}}return t},[d,e]);const[L,O]=B(()=>Q());const[$,A]=B(false);const I=_(new WeakSet);const j=_(false);const N=_(0);const W=_(0);const c=_(void 0);const C=U((t,m,s,g="root",n=0,M,x=[],S=0,k=1,E=[])=>{if(n>Math.min(l,ne))return[];const p=[...x,g];const f=p.join(".");const b=_e(t);const F=["object","array","map","set"].includes(b)&&t!==null;const J=F?Ve(t,b):0;const H=Math.min(J,Pe);if(t&&typeof t==="object"){if(s.has(t)){return[{id:f,key:g,value:"[Circular Reference]",valueType:"circular",depth:n,isExpandable:false,isExpanded:false,parentId:M,hasChildren:false,childCount:0,path:p,type:"circular",isLastChild:S===k-1,parentHasMoreSiblings:[...E],siblingIndex:S,totalSiblings:k}]}s.add(t)}const r={id:f,key:g,value:t,valueType:b,depth:n,isExpandable:F,isExpanded:m.has(f),parentId:M,hasChildren:H>0,childCount:H,path:p,type:F?"expandable":b,isLastChild:S===k-1,parentHasMoreSiblings:[...E],siblingIndex:S,totalSiblings:k};const y=[r];if(F&&m.has(f)&&n<Math.min(l,ne)){try{let D=[];switch(b){case"array":D=Array.isArray(t)?t.map((R,G)=>[G.toString(),R]):[];break;case"object":D=typeof t==="object"&&t!==null&&!(t instanceof Date)&&!(t instanceof Error)&&!(t instanceof RegExp)&&!(t instanceof Map)&&!(t instanceof Set)?Object.entries(t):[];break;case"map":D=t instanceof Map?Array.from(t.entries()).map(([R,G])=>[String(R),G]):[];break;case"set":D=t instanceof Set?Array.from(t.values()).map((R,G)=>[G.toString(),R]):[];break}const v=D.slice(0,H);const Ce=v.length;const de=[...E];if(n>0){de[n-1]=!r.isLastChild}for(let R=0;R<v.length;R+=ee){const G=v.slice(R,R+ee);let fe=R;for(const[we,Ie]of G){y.push(...C(Ie,m,s,we,n+1,f,p,fe,Ce,de));fe++}if(R>0&&R%(ee*2)===0){break}}}catch(D){console.error("[Buoy]",D)}}return y},[l]);te(()=>{if(c.current&&(c.current.type==="expand"||c.current.type==="collapse")){if($){A(false);j.current=false}c.current=void 0;return}if(j.current){return}let t;const m=++N.current;const s=()=>N.current===m;j.current=true;A(true);const g=async()=>{t=setTimeout(()=>{if(j.current&&s()){A(false);j.current=false}},5e3);await new Promise(n=>setTimeout(()=>n(),10));if(!s()){return}try{I.current=new WeakSet;W.current=Date.now();const n=C(e,L,I.current,"root",0,void 0,[],0,1,[]);const M=new Map;n.forEach((x,S)=>{M.set(x.id,{item:x,index:S})});V.current=M;if(t)clearTimeout(t);if(s()){w(n);A(false);j.current=false}}catch(n){console.error("[Buoy]",n);if(t)clearTimeout(t);if(s()){w([]);V.current=new Map;A(false);j.current=false}}};g();return()=>{j.current=false;if(t)clearTimeout(t)}},[e,L,C,l]);const Y=U((t,m)=>{A(false);j.current=false;w(s=>{const g=V.current.get(t);if(!g){return s}const{item:n,index:M}=g;if(m&&n.isExpandable&&n.hasChildren){const x=[...s];const S=new WeakSet;if(n.value&&typeof n.value==="object"){S.add(n.value)}const k=[];try{let f=[];const b=n.valueType;switch(b){case"array":f=Array.isArray(n.value)?n.value.map((r,y)=>[y.toString(),r]):[];break;case"object":f=typeof n.value==="object"&&n.value!==null&&!(n.value instanceof Date)&&!(n.value instanceof Error)&&!(n.value instanceof RegExp)&&!(n.value instanceof Map)&&!(n.value instanceof Set)?Object.entries(n.value):[];break;case"map":f=n.value instanceof Map?Array.from(n.value.entries()).map(([r,y])=>[String(r),y]):[];break;case"set":f=n.value instanceof Set?Array.from(n.value.values()).map((r,y)=>[y.toString(),r]):[];break}const F=f.length;const J=n.parentHasMoreSiblings||[];const H=[...J];if(n.depth>0){H[n.depth-1]=!n.isLastChild}f.forEach(([r,y],D)=>{const v=C(y,new Set,S,r,n.depth+1,t,n.path,D,F,H);k.push(...v)})}catch(f){console.error("[Buoy]",f)}const E=k;if(E.length>0){}x[M]={...n,isExpanded:true};x.splice(M+1,0,...E);const p=new Map;x.forEach((f,b)=>{p.set(f.id,{item:f,index:b})});V.current=p;return x}else if(!m){const x=new Set;const S=(p,f)=>{s.forEach(b=>{if(b.parentId===p||b.id.startsWith(p+".")&&b.depth>f){x.add(b.id);if(b.hasChildren){S(b.id,b.depth)}}})};S(t,n.depth);const k=s.map(p=>{if(p.id===t){return{...p,isExpanded:false}}return p}).filter(p=>!x.has(p.id));const E=new Map;k.forEach((p,f)=>{E.set(p.id,{item:p,index:f})});V.current=E;return k}return s})},[C]);const X=U(t=>{O(m=>{const s=new Set(m);const g=!s.has(t);if(g){s.add(t)}else{s.delete(t)}c.current={type:g?"expand":"collapse",itemId:t};Y(t,g);return s})},[Y]);const K=ce(e,ee,0)<ee;const q=re(()=>{if(!K)return null;return C(e,L,new WeakSet,"root",0,void 0,[],0,1,[])},[K,e,L,C]);const Z=U(t=>{if(t.length===0)return;O(m=>{if(t.every(g=>m.has(g)))return m;const s=new Set(m);for(const g of t)s.add(g);return s})},[]);return{flatData:q??h,isProcessing:q?false:$,toggleExpanded:X,revealPath:Z}};const Ee=({item:e,onToggleExpanded:l,index:d,onSelect:h,isSelected:w,selectable:V,onRequestInlineEdit:Q,isInlineEditing:L,inlineEditor:O,testIDPrefix:$})=>{const[A,I]=B(false);const[j,N]=B(false);const W=V===true;const c=_(0);const C=e.path.slice(1);const Y=me[Math.min(e.depth,ne)]||me[0];const X=be(e.valueType);const K=false;const q=()=>{if(W){const s=Date.now();const g=s-c.current<Le;c.current=s;if(g&&!e.isExpandable&&Q){Q(e);return}h(e);return}if(e.isExpandable){l(e.id)}h(e)};const Z=()=>{if(e.isExpandable){l(e.id)}h(e)};const t=()=>{};const m=e.key;return T(u,{style:[o.itemContainer,Y],children:[T(ie,{"sentry-label":"ignore devtools data explorer item",testID:`${$}-${e.id}`,accessibilityLabel:`${e.key}: ${e.valueType}`,style:[o.itemTouchable,A&&o.itemTouchablePressed,W&&w&&o.itemSelected,K&&{minHeight:ke,paddingVertical:2}],onPress:q,onPressIn:()=>I(true),onPressOut:()=>I(false),activeOpacity:e.isExpandable||W?.7:1,disabled:!e.isExpandable&&!W,children:[e.isExpandable?i(Te,{expanded:e.isExpanded,onPress:Z}):i(u,{style:o.expanderContainer}),T(u,{style:o.labelContainer,children:[T(P,{style:o.labelText,numberOfLines:1,children:[e.key,":"]}),L&&O?O:e.isExpandable?T(P,{style:[o.valueText,{color:a.secondary}],numberOfLines:1,children:[e.valueType," (",e.childCount," ",e.childCount===1?"item":"items",")"]}):i(P,{style:[o.valueText,{color:X}],numberOfLines:1,children:He(e.value,e.valueType)})]})]}),e.value!==void 0?i(De,{value:e.value,size:14,buttonStyle:{marginLeft:8,marginRight:8}}):null]})};Ee.displayName="VirtualizedItem";const Ne=oe(Ee);export const VirtualizedDataExplorer=({title:e,description:l,data:d,maxDepth:h=10,rawMode:w=false,initialExpanded:V=false,disableCopy:Q=false,onSelectionChange:L,onRequestInlineEdit:O,inlineEditPath:$,renderInlineEditor:A,selectPath:I,testIDPrefix:j="buoy-tree-row"})=>{const[N,W]=B(w);const{flatData:c,isProcessing:C,toggleExpanded:Y,revealPath:X}=Oe(d,h,V);const K=_(null);const[q,Z]=B({start:0,end:Math.min(c.length-1,Math.max(0,Math.ceil(400/z)-1))});const t=_({itemVisiblePercentThreshold:1});const m=_(({viewableItems:r})=>{const y=r.map(D=>D.index).filter(D=>typeof D==="number");if(y.length){Z({start:Math.min(...y),end:Math.max(...y)})}}).current;te(()=>{Z({start:0,end:Math.min(c.length-1,Math.max(0,Math.ceil(400/z)-1))})},[c.length]);const s=re(()=>{const r=new Set;for(const y of c){r.add(y.valueType);if(r.size>=8)break}return Array.from(r)},[c]);const g=()=>{W(!N)};const[n,M]=B(null);const x=re(()=>n==null?void 0:c.find(r=>r.id===n),[c,n]);const S=x?.depth;te(()=>{if(!L)return;L(x?le(x):null)},[x,L]);const k=U(r=>{M(y=>y===r.id?null:r.id)},[]);const E=I===void 0?void 0:I===null?"\0null":I.join(".");const p=_(E);te(()=>{if(E===p.current)return;p.current=E;if(E===void 0)return;if(I==null){M(null);return}const r=["root"];for(const y of I.slice(0,-1)){r.push(`${r[r.length-1]}.${y}`)}X(r);M(["root",...I].join("."))},[E,I,X]);const f=U(r=>{M(r.id);O?.(le(r))},[O]);const b=({item:r,index:y})=>i(Ne,{item:r,index:y,onToggleExpanded:Y,onSelect:k,isSelected:x?.id===r.id,selectable:L!=null,onRequestInlineEdit:f,isInlineEditing:$!=null&&$.join(".")===r.path.slice(1).join("."),inlineEditor:A?A(le(r)):null,testIDPrefix:j});const F=z;const J=r=>r.id;const H=d!==null&&d!==void 0&&(typeof d==="string"?d.length>0:typeof d==="number"||typeof d==="boolean"?true:Array.isArray(d)?d.length>0:typeof d==="object"?Object.keys(d).length>0:false);if(w){if(!H){return i(u,{style:{flex:1,justifyContent:"center",alignItems:"center",padding:20},children:i(P,{style:o.noDataText,children:"No data available"})})}return i(u,{style:{minHeight:C?40:c.length*z},children:C?i(u,{style:{flex:1,justifyContent:"center",alignItems:"center"},children:T(P,{style:o.loadingText,children:["Processing data... (raw mode, isProcessing=",String(C),")"]})}):T(u,{style:{position:"relative",height:c.length*z},children:[i(he,{items:c,visibleRange:{start:0,end:Math.max(0,c.length-1)},itemHeight:z,indentWidth:ae,activeDepth:S}),i(pe,{ref:K,"sentry-label":"ignore devtools data explorer list",data:c,renderItem:b,keyExtractor:J,showsVerticalScrollIndicator:true,contentContainerStyle:o.listContent,initialNumToRender:15,maxToRenderPerBatch:10,windowSize:10,scrollEnabled:false})]})})}if(!H){return T(u,{style:o.container,children:[i(u,{style:o.header,children:i(u,{style:o.headerRow,children:T(u,{style:{flex:1},children:[i(P,{style:o.title,children:e}),l&&i(P,{style:o.description,children:l})]})})}),i(u,{style:o.noDataContainer,children:i(P,{style:o.noDataText,children:"No data available"})})]})}return T(u,{style:o.container,children:[T(u,{style:o.header,children:[i(u,{style:o.headerRow,children:T(ie,{"sentry-label":"ignore devtools data explorer header toggle",onPress:g,hitSlop:ge,style:o.headerTouchable,children:[T(u,{style:{flex:1},children:[i(P,{style:o.title,children:e}),l&&i(P,{style:o.description,children:l})]}),i(u,{style:o.expanderMargin,children:i(Te,{expanded:N,onPress:g})})]})}),N&&s.length>0&&!w&&i(ze,{visibleTypes:s})]}),N&&i(je,{children:C?i(u,{style:o.loadingContainer,children:T(P,{style:o.loadingText,children:["Processing data... (isProcessing=",String(C),")"]})}):T(u,{style:{height:c.length*z,position:"relative"},children:[i(he,{items:c,visibleRange:q,itemHeight:z,indentWidth:ae,activeDepth:S}),i(pe,{ref:K,"sentry-label":"ignore devtools data explorer collapsed list",data:c,renderItem:b,keyExtractor:J,showsVerticalScrollIndicator:true,contentContainerStyle:o.listContent,initialNumToRender:15,maxToRenderPerBatch:10,windowSize:10,scrollEnabled:false,onViewableItemsChanged:m,viewabilityConfig:t.current})]})})]})};
@@ -1 +1 @@
1
- "use strict";import{useState as c,useEffect as h,useCallback as q}from"react";import{Platform as i,Dimensions as I,PixelRatio as x,AccessibilityInfo as l,Appearance as b,I18nManager as T,NativeModules as S,Keyboard as F,AppState as y,StatusBar as X}from"react-native";import{subscribeRealAppState as _}from"../utils/realAppState.js";async function H(){const[e,t,a]=await Promise.all([l.isScreenReaderEnabled(),l.isReduceMotionEnabled(),l.isReduceTransparencyEnabled()]);const o={isScreenReaderEnabled:e,isReduceMotionEnabled:t,isReduceTransparencyEnabled:a};if(i.OS==="ios"){const[g,f,p,u,m]=await Promise.all([l.isBoldTextEnabled?.()??Promise.resolve(false),l.isGrayscaleEnabled?.()??Promise.resolve(false),l.isInvertColorsEnabled?.()??Promise.resolve(false),l.isDarkerSystemColorsEnabled?.()??Promise.resolve(false),l.prefersCrossFadeTransitions?.()??Promise.resolve(false)]);o.isBoldTextEnabled=g;o.isGrayscaleEnabled=f;o.isInvertColorsEnabled=p;o.isDarkerSystemColorsEnabled=u;o.prefersCrossFadeTransitions=m}if(i.OS==="android"){const g=await l.isHighTextContrastEnabled?.()??false;o.isHighTextContrastEnabled=g}return o}function v(){const e=i.constants;const t={os:i.OS,version:i.Version,reactNativeVersion:e.reactNativeVersion,isTesting:i.isTesting??false,isDisableAnimations:e.isDisableAnimations??false};if(i.OS==="ios"){return{...t,osVersion:e.osVersion,systemName:e.systemName,interfaceIdiom:e.interfaceIdiom,isPad:i.isPad,isTV:i.isTV,isVision:i.isVision??false,isMacCatalyst:i.isMacCatalyst??false,forceTouchAvailable:e.forceTouchAvailable}}if(i.OS==="android"){return{...t,apiLevel:e.Version,release:e.Release,brand:e.Brand,manufacturer:e.Manufacturer,model:e.Model,fingerprint:e.Fingerprint,serial:e.Serial,uiMode:e.uiMode}}return t}function C(){const e=I.get("window");const t=I.get("screen");const a={window:{width:e.width,height:e.height,scale:e.scale,fontScale:e.fontScale},screen:{width:t.width,height:t.height,scale:t.scale,fontScale:t.fontScale},pixelRatio:x.get(),fontScale:x.getFontScale(),isLandscape:e.width>e.height,isPortrait:e.height>e.width};if(i.OS==="ios"){try{const o=S.DeviceInfo?.getConstants?.();a.isIPhoneNotched=o?.isIPhoneX_deprecated??false}catch{a.isIPhoneNotched=false}}if(i.OS==="android"){try{const o=S.DeviceInfo?.getConstants?.();a.isEdgeToEdge=o?.isEdgeToEdge??false;a.densityDpi=Math.round(e.scale*160)}catch{}}return a}async function J(){return new Promise(e=>{let t=false;if(i.OS==="ios"){S.StatusBarManager?.getHeight?.(a=>{if(!t){t=true;e(a?.height??null)}})??e(null)}else if(i.OS==="android"){t=true;e(X.currentHeight??null)}else{t=true;e(null)}setTimeout(()=>{if(!t){t=true;e(null)}},100)})}function D(){const e={isRTL:T.isRTL,doLeftAndRightSwapInRTL:T.doLeftAndRightSwapInRTL};if(i.OS==="android"){e.localeIdentifier=T.localeIdentifier}return e}function A(){if(i.OS==="ios"){try{const e=S.SettingsManager?.getConstants?.();return{userDefaults:e?.settings??{}}}catch{return{}}}return{}}function L(){const e={};if(i.OS==="android"){const t=i.constants;e.serial=t.Serial;e.fingerprint=t.Fingerprint;try{const a=S.PlatformConstants;if(a?.getAndroidID){e.androidId=a.getAndroidID()}}catch{}}return e}function z(e){const t=[e.platform.os,e.platform.version,e.display.window.width,e.display.window.height,e.display.pixelRatio,e.platform.interfaceIdiom??"",e.platform.forceTouchAvailable??false,e.display.isIPhoneNotched??false,e.platform.model??"",e.platform.brand??"",e.platform.manufacturer??"",e.platform.uiMode??""];const a=t.join("|");let o=0;for(let g=0;g<a.length;g++){const f=a.charCodeAt(g);o=(o<<5)-o+f;o=o&o}return Math.abs(o).toString(16).padStart(8,"0")}export function useDeviceInfo(){const[e,t]=c(true);const[a,o]=c(v());const[g,f]=c(C());const[p,u]=c({isScreenReaderEnabled:false,isReduceMotionEnabled:false,isReduceTransparencyEnabled:false});const[m,O]=c(()=>{const r=b.getColorScheme()??null;return{colorScheme:r,prefersDarkMode:r==="dark"}});const[P,G]=c(D());const[R,K]=c({height:null,isVisible:true});const[w,M]=c({isVisible:false,height:0,animationDuration:0});const[N,Y]=c({currentState:y.currentState,isActive:y.currentState==="active"});const[k,$]=c(L());const[B,j]=c(A());const[V,U]=c(Date.now());const E=q(async()=>{t(true);const[r,s]=await Promise.all([H(),J()]);o(v());f(C());u(r);const n=b.getColorScheme()??null;O({colorScheme:n,prefersDarkMode:n==="dark"});G(D());K(d=>({...d,height:s}));$(L());j(A());U(Date.now());t(false)},[]);h(()=>{E()},[E]);h(()=>{const r=I.addEventListener("change",({window:s,screen:n})=>{f(d=>({...d,window:{width:s.width,height:s.height,scale:s.scale,fontScale:s.fontScale},screen:{width:n.width,height:n.height,scale:n.scale,fontScale:n.fontScale},isLandscape:s.width>s.height,isPortrait:s.height>s.width}))});return()=>r.remove()},[]);h(()=>{const r=b.addChangeListener(({colorScheme:s})=>{const n=s??null;O({colorScheme:n,prefersDarkMode:n==="dark"})});return()=>r.remove()},[]);h(()=>{const r=F.addListener(i.OS==="ios"?"keyboardWillShow":"keyboardDidShow",n=>{M({isVisible:true,height:n.endCoordinates.height,animationDuration:n.duration??0})});const s=F.addListener(i.OS==="ios"?"keyboardWillHide":"keyboardDidHide",n=>{M({isVisible:false,height:0,animationDuration:n.duration??0})});return()=>{r.remove();s.remove()}},[]);h(()=>{const r=_(s=>{Y({currentState:s,isActive:s==="active"})});return()=>r.remove()},[]);h(()=>{const r=[l.addEventListener("screenReaderChanged",s=>{u(n=>({...n,isScreenReaderEnabled:s}))}),l.addEventListener("reduceMotionChanged",s=>{u(n=>({...n,isReduceMotionEnabled:s}))}),l.addEventListener("reduceTransparencyChanged",s=>{u(n=>({...n,isReduceTransparencyEnabled:s}))})];if(i.OS==="ios"){const s=(n,d)=>{return l.addEventListener(n,d)};r.push(s("boldTextChanged",n=>{u(d=>({...d,isBoldTextEnabled:n}))}),s("grayscaleChanged",n=>{u(d=>({...d,isGrayscaleEnabled:n}))}),s("invertColorsChanged",n=>{u(d=>({...d,isInvertColorsEnabled:n}))}))}return()=>{r.forEach(s=>s.remove())}},[]);const W={platform:a,display:g,accessibility:p,appearance:m,locale:P,statusBar:R,keyboard:w,appState:N,identifiers:k,settings:B,timestamp:V,isLoading:e,refresh:E,generateFingerprint:()=>z({platform:a,display:g,accessibility:p,appearance:m,locale:P,statusBar:R,keyboard:w,appState:N,identifiers:k,settings:B,timestamp:V,isLoading:e})};return W}export async function getDeviceInfo(){const[e,t]=await Promise.all([H(),J()]);const a=b.getColorScheme()??null;return{platform:v(),display:C(),accessibility:e,appearance:{colorScheme:a,prefersDarkMode:a==="dark"},locale:D(),statusBar:{height:t,isVisible:true},keyboard:{isVisible:false,height:0,animationDuration:0},appState:{currentState:y.currentState,isActive:y.currentState==="active"},identifiers:L(),settings:A(),timestamp:Date.now(),isLoading:false}}export function logDeviceInfo(e){console.log("\n========================================");console.log(" DEVICE INFO REPORT");console.log("========================================\n");console.log("--- PLATFORM ---");console.log(JSON.stringify(e.platform,null,2));console.log("\n--- DISPLAY ---");console.log(JSON.stringify(e.display,null,2));console.log("\n--- ACCESSIBILITY ---");console.log(JSON.stringify(e.accessibility,null,2));console.log("\n--- APPEARANCE ---");console.log(JSON.stringify(e.appearance,null,2));console.log("\n--- LOCALE ---");console.log(JSON.stringify(e.locale,null,2));console.log("\n--- STATUS BAR ---");console.log(JSON.stringify(e.statusBar,null,2));console.log("\n--- KEYBOARD ---");console.log(JSON.stringify(e.keyboard,null,2));console.log("\n--- APP STATE ---");console.log(JSON.stringify(e.appState,null,2));console.log("\n--- IDENTIFIERS ---");console.log(JSON.stringify(e.identifiers,null,2));console.log("\n--- SETTINGS ---");const t=Object.keys(e.settings.userDefaults??{});console.log(`userDefaults: ${t.length} keys`);if(t.length>0&&t.length<=20){console.log(JSON.stringify(e.settings,null,2))}console.log("\n--- METADATA ---");console.log(`timestamp: ${e.timestamp}`);console.log(`isLoading: ${e.isLoading}`);console.log("\n========================================\n")}
1
+ "use strict";import{useState as c,useEffect as h,useCallback as q}from"react";import{Platform as o,Dimensions as I,PixelRatio as x,AccessibilityInfo as l,Appearance as m,I18nManager as B,NativeModules as y,Keyboard as F,AppState as b,StatusBar as X}from"react-native";import{subscribeRealAppState as _}from"../utils/realAppState.js";async function H(){const[e,t,i]=await Promise.all([l.isScreenReaderEnabled(),l.isReduceMotionEnabled(),l.isReduceTransparencyEnabled()]);const a={isScreenReaderEnabled:e,isReduceMotionEnabled:t,isReduceTransparencyEnabled:i};if(o.OS==="ios"){const[u,f,S,g,p]=await Promise.all([l.isBoldTextEnabled?.()??Promise.resolve(false),l.isGrayscaleEnabled?.()??Promise.resolve(false),l.isInvertColorsEnabled?.()??Promise.resolve(false),l.isDarkerSystemColorsEnabled?.()??Promise.resolve(false),l.prefersCrossFadeTransitions?.()??Promise.resolve(false)]);a.isBoldTextEnabled=u;a.isGrayscaleEnabled=f;a.isInvertColorsEnabled=S;a.isDarkerSystemColorsEnabled=g;a.prefersCrossFadeTransitions=p}if(o.OS==="android"){const u=await l.isHighTextContrastEnabled?.()??false;a.isHighTextContrastEnabled=u}return a}function T(){const e=o.constants;const t={os:o.OS,version:o.Version,reactNativeVersion:e.reactNativeVersion,isTesting:o.isTesting??false,isDisableAnimations:e.isDisableAnimations??false};if(o.OS==="ios"){return{...t,osVersion:e.osVersion,systemName:e.systemName,interfaceIdiom:e.interfaceIdiom,isPad:o.isPad,isTV:o.isTV,isVision:o.isVision??false,isMacCatalyst:o.isMacCatalyst??false,forceTouchAvailable:e.forceTouchAvailable}}if(o.OS==="android"){return{...t,apiLevel:e.Version,release:e.Release,brand:e.Brand,manufacturer:e.Manufacturer,model:e.Model,fingerprint:e.Fingerprint,serial:e.Serial,uiMode:e.uiMode}}return t}function v(){const e=I.get("window");const t=I.get("screen");const i={window:{width:e.width,height:e.height,scale:e.scale,fontScale:e.fontScale},screen:{width:t.width,height:t.height,scale:t.scale,fontScale:t.fontScale},pixelRatio:x.get(),fontScale:x.getFontScale(),isLandscape:e.width>e.height,isPortrait:e.height>e.width};if(o.OS==="ios"){try{const a=y.DeviceInfo?.getConstants?.();i.isIPhoneNotched=a?.isIPhoneX_deprecated??false}catch{i.isIPhoneNotched=false}}if(o.OS==="android"){try{const a=y.DeviceInfo?.getConstants?.();i.isEdgeToEdge=a?.isEdgeToEdge??false;i.densityDpi=Math.round(e.scale*160)}catch{}}return i}async function J(){return new Promise(e=>{let t=false;if(o.OS==="ios"){y.StatusBarManager?.getHeight?.(i=>{if(!t){t=true;e(i?.height??null)}})??e(null)}else if(o.OS==="android"){t=true;e(X.currentHeight??null)}else{t=true;e(null)}setTimeout(()=>{if(!t){t=true;e(null)}},100)})}function C(){const e={isRTL:B.isRTL,doLeftAndRightSwapInRTL:B.doLeftAndRightSwapInRTL};if(o.OS==="android"){e.localeIdentifier=B.localeIdentifier}return e}function D(){if(o.OS==="ios"){try{const e=y.SettingsManager?.getConstants?.();return{userDefaults:e?.settings??{}}}catch{return{}}}return{}}function A(){const e={};if(o.OS==="android"){const t=o.constants;e.serial=t.Serial;e.fingerprint=t.Fingerprint;try{const i=y.PlatformConstants;if(i?.getAndroidID){e.androidId=i.getAndroidID()}}catch{}}return e}function z(e){const t=[e.platform.os,e.platform.version,e.display.window.width,e.display.window.height,e.display.pixelRatio,e.platform.interfaceIdiom??"",e.platform.forceTouchAvailable??false,e.display.isIPhoneNotched??false,e.platform.model??"",e.platform.brand??"",e.platform.manufacturer??"",e.platform.uiMode??""];const i=t.join("|");let a=0;for(let u=0;u<i.length;u++){const f=i.charCodeAt(u);a=(a<<5)-a+f;a=a&a}return Math.abs(a).toString(16).padStart(8,"0")}export function useDeviceInfo(){const[e,t]=c(true);const[i,a]=c(T());const[u,f]=c(v());const[S,g]=c({isScreenReaderEnabled:false,isReduceMotionEnabled:false,isReduceTransparencyEnabled:false});const[p,L]=c(()=>{const r=m.getColorScheme()??null;return{colorScheme:r,prefersDarkMode:r==="dark"}});const[O,G]=c(C());const[P,K]=c({height:null,isVisible:true});const[R,w]=c({isVisible:false,height:0,animationDuration:0});const[M,Y]=c({currentState:b.currentState,isActive:b.currentState==="active"});const[N,$]=c(A());const[k,j]=c(D());const[V,U]=c(Date.now());const E=q(async()=>{t(true);const[r,s]=await Promise.all([H(),J()]);a(T());f(v());g(r);const n=m.getColorScheme()??null;L({colorScheme:n,prefersDarkMode:n==="dark"});G(C());K(d=>({...d,height:s}));$(A());j(D());U(Date.now());t(false)},[]);h(()=>{E()},[E]);h(()=>{const r=I.addEventListener("change",({window:s,screen:n})=>{f(d=>({...d,window:{width:s.width,height:s.height,scale:s.scale,fontScale:s.fontScale},screen:{width:n.width,height:n.height,scale:n.scale,fontScale:n.fontScale},isLandscape:s.width>s.height,isPortrait:s.height>s.width}))});return()=>r.remove()},[]);h(()=>{const r=m.addChangeListener(({colorScheme:s})=>{const n=s??null;L({colorScheme:n,prefersDarkMode:n==="dark"})});return()=>r.remove()},[]);h(()=>{const r=F.addListener(o.OS==="ios"?"keyboardWillShow":"keyboardDidShow",n=>{w({isVisible:true,height:n.endCoordinates.height,animationDuration:n.duration??0})});const s=F.addListener(o.OS==="ios"?"keyboardWillHide":"keyboardDidHide",n=>{w({isVisible:false,height:0,animationDuration:n.duration??0})});return()=>{r.remove();s.remove()}},[]);h(()=>{const r=_(s=>{Y({currentState:s,isActive:s==="active"})});return()=>r.remove()},[]);h(()=>{const r=[l.addEventListener("screenReaderChanged",s=>{g(n=>({...n,isScreenReaderEnabled:s}))}),l.addEventListener("reduceMotionChanged",s=>{g(n=>({...n,isReduceMotionEnabled:s}))}),l.addEventListener("reduceTransparencyChanged",s=>{g(n=>({...n,isReduceTransparencyEnabled:s}))})];if(o.OS==="ios"){const s=(n,d)=>{return l.addEventListener(n,d)};r.push(s("boldTextChanged",n=>{g(d=>({...d,isBoldTextEnabled:n}))}),s("grayscaleChanged",n=>{g(d=>({...d,isGrayscaleEnabled:n}))}),s("invertColorsChanged",n=>{g(d=>({...d,isInvertColorsEnabled:n}))}))}return()=>{r.forEach(s=>s.remove())}},[]);const W={platform:i,display:u,accessibility:S,appearance:p,locale:O,statusBar:P,keyboard:R,appState:M,identifiers:N,settings:k,timestamp:V,isLoading:e,refresh:E,generateFingerprint:()=>z({platform:i,display:u,accessibility:S,appearance:p,locale:O,statusBar:P,keyboard:R,appState:M,identifiers:N,settings:k,timestamp:V,isLoading:e})};return W}export async function getDeviceInfo(){const[e,t]=await Promise.all([H(),J()]);const i=m.getColorScheme()??null;return{platform:T(),display:v(),accessibility:e,appearance:{colorScheme:i,prefersDarkMode:i==="dark"},locale:C(),statusBar:{height:t,isVisible:true},keyboard:{isVisible:false,height:0,animationDuration:0},appState:{currentState:b.currentState,isActive:b.currentState==="active"},identifiers:A(),settings:D(),timestamp:Date.now(),isLoading:false}}export function logDeviceInfo(e){console.log("[Buoy]","\n========================================");console.log("[Buoy]"," DEVICE INFO REPORT");console.log("[Buoy]","========================================\n");console.log("[Buoy]","--- PLATFORM ---");console.log("[Buoy]",JSON.stringify(e.platform,null,2));console.log("[Buoy]","\n--- DISPLAY ---");console.log("[Buoy]",JSON.stringify(e.display,null,2));console.log("[Buoy]","\n--- ACCESSIBILITY ---");console.log("[Buoy]",JSON.stringify(e.accessibility,null,2));console.log("[Buoy]","\n--- APPEARANCE ---");console.log("[Buoy]",JSON.stringify(e.appearance,null,2));console.log("[Buoy]","\n--- LOCALE ---");console.log("[Buoy]",JSON.stringify(e.locale,null,2));console.log("[Buoy]","\n--- STATUS BAR ---");console.log("[Buoy]",JSON.stringify(e.statusBar,null,2));console.log("[Buoy]","\n--- KEYBOARD ---");console.log("[Buoy]",JSON.stringify(e.keyboard,null,2));console.log("[Buoy]","\n--- APP STATE ---");console.log("[Buoy]",JSON.stringify(e.appState,null,2));console.log("[Buoy]","\n--- IDENTIFIERS ---");console.log("[Buoy]",JSON.stringify(e.identifiers,null,2));console.log("[Buoy]","\n--- SETTINGS ---");const t=Object.keys(e.settings.userDefaults??{});console.log("[Buoy]",`userDefaults: ${t.length} keys`);if(t.length>0&&t.length<=20){console.log("[Buoy]",JSON.stringify(e.settings,null,2))}console.log("[Buoy]","\n--- METADATA ---");console.log("[Buoy]",`timestamp: ${e.timestamp}`);console.log("[Buoy]",`isLoading: ${e.isLoading}`);console.log("[Buoy]","\n========================================\n")}