@buoy-gg/assets 7.0.77 → 7.0.78
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.AssetDetail=AssetDetail;var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _AssetImage=require("./AssetImage");var _format=require("../format");var _assetStore=require("../store/assetStore");var _testIDs=require("../utils/testIDs");var _jsxRuntime=require("react/jsx-runtime");function Row({label:e,value:s}){const t=(0,_testIDs.assetDetailRowTestID)(e);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.kvRow,testID:t,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.kvLabel,children:e}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.kvValue,selectable:true,testID:`${t}-value`,children:s})]})}function Preview({record:e}){if(e.kind==="image"){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.previewBox,testID:_testIDs.ASSETS_TEST_IDS.detailPreview,children:(0,_jsxRuntime.jsx)(_AssetImage.AssetImage,{testID:"buoy-internal-assets-preview",record:e,style:styles.previewImage})})}if(e.kind==="font"){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.previewBox,testID:_testIDs.ASSETS_TEST_IDS.detailFontPreview,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.fontPreview,{fontFamily:e.name}],children:"The quick brown fox jumps over the lazy dog 0123456789"})})}return null}function AssetDetail({record:e,insights:s}){const t=[];if(s.neverLoaded.includes(e.id)){t.push("Not observed in the runtime registry this app run. This does not prove the asset is unused.")}if(s.scaleGaps.includes(e.id)){t.push("Scale gap \u2014 no variant covers this device's pixel ratio")}if(s.webpCandidates.includes(e.id)){t.push("WebP candidate \u2014 large png/jpeg, converting typically saves 20\u201340%")}const a=s.duplicates.find(l=>l.ids.includes(e.id));if(a){t.push(`Duplicate content \u2014 identical bytes shipped ${a.ids.length} times`)}if(s.overDecode.includes(e.id)){t.push("Decodes larger than 2\xD7 this entire screen \u2014 resize the source, no view can need this many pixels")}if(s.heavyGifs.includes(e.id)){t.push("Heavy GIF \u2014 every frame decodes into memory; a video or Lottie is typically ~90% smaller")}if(s.heavyFonts.includes(e.id)){t.push("Heavy font \u2014 likely an unsubset icon font; subsetting to used glyphs usually saves most of it")}if(s.scaleAnomalies.includes(e.id)){t.push("Scale anomaly \u2014 a higher-resolution variant is smaller in bytes than a lower one; check the exports")}const n=(0,_assetStore.estDecodedBytes)(e);return(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:styles.scroll,contentContainerStyle:styles.content,testID:_testIDs.ASSETS_TEST_IDS.detailScroll,children:[(0,_jsxRuntime.jsx)(Preview,{record:e}),t.length>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.findings,testID:_testIDs.ASSETS_TEST_IDS.detailFindings,children:t.map((l,i)=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.findingText,testID:(0,_testIDs.assetFindingTestID)(i),children:l},l))}):null,(0,_jsxRuntime.jsx)(Row,{label:"Name",value:`${e.name}.${e.type}`}),e.loadStatus&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(Row,{label:"Load",value:e.loadStatus==="error"?"Failed":"Loaded"}),(0,_jsxRuntime.jsx)(Row,{label:"Load time",value:e.durationMs==null?"Unknown":`${e.durationMs.toFixed(1)} ms`}),(0,_jsxRuntime.jsx)(Row,{label:"Load size",value:e.sizeBytes==null?"Unknown":(0,_format.formatBytes)(e.sizeBytes)}),(0,_jsxRuntime.jsx)(Row,{label:"Cache",value:e.cacheHit==null?"Unknown":e.cacheHit?"Cache hit":"Web load"})]}),(0,_jsxRuntime.jsx)(Row,{label:"Kind",value:e.kind}),(0,_jsxRuntime.jsx)(Row,{label:"Status",value:e.loaded?"Loaded (registered at runtime)":"Not observed in the runtime registry"}),e.kind==="image"?(0,_jsxRuntime.jsx)(Row,{label:"Dimensions",value:`${(0,_format.formatDimensions)(e)} (logical)`}):null,e.kind==="image"&&e.scales.length?(0,_jsxRuntime.jsx)(Row,{label:"Scales",value:(0,_format.formatScales)(e.scales)}):null,e.sizesByScale?Object.entries(e.sizesByScale).map(([l,i])=>(0,_jsxRuntime.jsx)(Row,{label:`Size @${l}x`,value:(0,_format.formatBytes)(i)},l)):null,e.sizeBytes!=null&&e.sizeSource==="measured"?(0,_jsxRuntime.jsx)(Row,{label:"Total size",value:(0,_format.formatBytes)(e.sizeBytes)}):null,n>0?(0,_jsxRuntime.jsx)(Row,{label:"Decoded memory",value:`~${(0,_format.formatBytes)(n)} (RGBA)`}):null,e.registryId!=null?(0,_jsxRuntime.jsx)(Row,{label:"Registry id",value:String(e.registryId)}):null,e.hash?(0,_jsxRuntime.jsx)(Row,{label:"Hash",value:e.hash}):null,e.httpServerLocation?(0,_jsxRuntime.jsx)(Row,{label:"Location",value:e.httpServerLocation}):null,e.fileSystemLocation?(0,_jsxRuntime.jsx)(Row,{label:"Source dir",value:e.fileSystemLocation}):null,e.resolvedUri?(0,_jsxRuntime.jsx)(Row,{label:"Resolved URI",value:e.resolvedUri}):null]})}const styles=_reactNative.StyleSheet.create({scroll:{flex:1},content:{padding:12,gap:8},previewBox:{borderRadius:8,backgroundColor:_sharedUi.night.color.bg,padding:12,alignItems:"center",justifyContent:"center",minHeight:96},previewImage:{width:"100%",height:140},fontPreview:{color:_sharedUi.night.color.text,fontSize:16,textAlign:"center"},findings:{borderRadius:8,borderWidth:1,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface,padding:10,gap:6},findingText:{color:_sharedUi.night.color.textSecondary,fontSize:11,lineHeight:15},kvRow:{gap:2},kvLabel:{color:_sharedUi.night.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,textTransform:"uppercase"},kvValue:{color:_sharedUi.night.color.text,fontSize:12}});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.AssetDetail=AssetDetail;var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _AssetImage=require("./AssetImage");var _format=require("../format");var _assetStore=require("../store/assetStore");var _testIDs=require("../utils/testIDs");var _jsxRuntime=require("react/jsx-runtime");function Row({label:e,value:s}){const t=(0,_testIDs.assetDetailRowTestID)(e);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.kvRow,testID:t,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.kvLabel,children:e}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.kvValue,selectable:true,testID:`${t}-value`,children:s})]})}function Preview({record:e}){if(e.kind==="image"){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.previewBox,testID:_testIDs.ASSETS_TEST_IDS.detailPreview,children:(0,_jsxRuntime.jsx)(_AssetImage.AssetImage,{testID:"buoy-internal-assets-preview",record:e,style:styles.previewImage})})}if(e.kind==="font"){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.previewBox,testID:_testIDs.ASSETS_TEST_IDS.detailFontPreview,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.fontPreview,{fontFamily:e.name}],children:"The quick brown fox jumps over the lazy dog 0123456789"})})}return null}function AssetDetail({record:e,insights:s}){const t=[];if(s.neverLoaded.includes(e.id)){t.push("Not observed in the runtime registry this app run. This does not prove the asset is unused.")}if(s.scaleGaps.includes(e.id)){t.push("Scale gap \u2014 no variant covers this device's pixel ratio")}if(s.webpCandidates.includes(e.id)){t.push("WebP candidate \u2014 large png/jpeg, converting typically saves 20\u201340%")}const a=s.duplicates.find(l=>l.ids.includes(e.id));if(a){t.push(`Duplicate content \u2014 identical bytes shipped ${a.ids.length} times`)}if(s.overDecode.includes(e.id)){t.push("Decodes larger than 2\xD7 this entire screen \u2014 resize the source, no view can need this many pixels")}if(s.heavyGifs.includes(e.id)){t.push("Heavy GIF \u2014 every frame decodes into memory; a video or Lottie is typically ~90% smaller")}if(s.heavyFonts.includes(e.id)){t.push("Heavy font \u2014 likely an unsubset icon font; subsetting to used glyphs usually saves most of it")}if(s.scaleAnomalies.includes(e.id)){t.push("Scale anomaly \u2014 a higher-resolution variant is smaller in bytes than a lower one; check the exports")}const n=(0,_assetStore.estDecodedBytes)(e);return(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{keyboardShouldPersistTaps:"handled",style:styles.scroll,contentContainerStyle:styles.content,testID:_testIDs.ASSETS_TEST_IDS.detailScroll,children:[(0,_jsxRuntime.jsx)(Preview,{record:e}),t.length>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.findings,testID:_testIDs.ASSETS_TEST_IDS.detailFindings,children:t.map((l,i)=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.findingText,testID:(0,_testIDs.assetFindingTestID)(i),children:l},l))}):null,(0,_jsxRuntime.jsx)(Row,{label:"Name",value:`${e.name}.${e.type}`}),e.loadStatus&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(Row,{label:"Load",value:e.loadStatus==="error"?"Failed":"Loaded"}),(0,_jsxRuntime.jsx)(Row,{label:"Load time",value:e.durationMs==null?"Unknown":`${e.durationMs.toFixed(1)} ms`}),(0,_jsxRuntime.jsx)(Row,{label:"Load size",value:e.sizeBytes==null?"Unknown":(0,_format.formatBytes)(e.sizeBytes)}),(0,_jsxRuntime.jsx)(Row,{label:"Cache",value:e.cacheHit==null?"Unknown":e.cacheHit?"Cache hit":"Web load"})]}),(0,_jsxRuntime.jsx)(Row,{label:"Kind",value:e.kind}),(0,_jsxRuntime.jsx)(Row,{label:"Status",value:e.loaded?"Loaded (registered at runtime)":"Not observed in the runtime registry"}),e.kind==="image"?(0,_jsxRuntime.jsx)(Row,{label:"Dimensions",value:`${(0,_format.formatDimensions)(e)} (logical)`}):null,e.kind==="image"&&e.scales.length?(0,_jsxRuntime.jsx)(Row,{label:"Scales",value:(0,_format.formatScales)(e.scales)}):null,e.sizesByScale?Object.entries(e.sizesByScale).map(([l,i])=>(0,_jsxRuntime.jsx)(Row,{label:`Size @${l}x`,value:(0,_format.formatBytes)(i)},l)):null,e.sizeBytes!=null&&e.sizeSource==="measured"?(0,_jsxRuntime.jsx)(Row,{label:"Total size",value:(0,_format.formatBytes)(e.sizeBytes)}):null,n>0?(0,_jsxRuntime.jsx)(Row,{label:"Decoded memory",value:`~${(0,_format.formatBytes)(n)} (RGBA)`}):null,e.registryId!=null?(0,_jsxRuntime.jsx)(Row,{label:"Registry id",value:String(e.registryId)}):null,e.hash?(0,_jsxRuntime.jsx)(Row,{label:"Hash",value:e.hash}):null,e.httpServerLocation?(0,_jsxRuntime.jsx)(Row,{label:"Location",value:e.httpServerLocation}):null,e.fileSystemLocation?(0,_jsxRuntime.jsx)(Row,{label:"Source dir",value:e.fileSystemLocation}):null,e.resolvedUri?(0,_jsxRuntime.jsx)(Row,{label:"Resolved URI",value:e.resolvedUri}):null]})}const styles=_reactNative.StyleSheet.create({scroll:{flex:1},content:{padding:12,gap:8},previewBox:{borderRadius:8,backgroundColor:_sharedUi.night.color.bg,padding:12,alignItems:"center",justifyContent:"center",minHeight:96},previewImage:{width:"100%",height:140},fontPreview:{color:_sharedUi.night.color.text,fontSize:16,textAlign:"center"},findings:{borderRadius:8,borderWidth:1,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface,padding:10,gap:6},findingText:{color:_sharedUi.night.color.textSecondary,fontSize:11,lineHeight:15},kvRow:{gap:2},kvLabel:{color:_sharedUi.night.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,textTransform:"uppercase"},kvValue:{color:_sharedUi.night.color.text,fontSize:12}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.AssetsModal=AssetsModal;exports.AssetsToolView=AssetsToolView;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _install=require("../capture/install");var _export=require("../export");var _useAssetRecords=require("../hooks/useAssetRecords");var _useAssetScanStatus=require("../hooks/useAssetScanStatus");var _remote=require("../remote");var _assetStore=require("../store/assetStore");var _baseline=require("../store/baseline");var _AssetDetail=require("./AssetDetail");var _AssetRow=require("./AssetRow");var _AssetsFilterBar=require("./AssetsFilterBar");var _AssetsHeader=require("./AssetsHeader");var _AssetsListControls=require("./AssetsListControls");var _ScanNotice=require("./ScanNotice");var _testIDs=require("../utils/testIDs");var _jsxRuntime=require("react/jsx-runtime");function FontFamilies({names:t}){const s=[...new Set(t)];if(!s.length)return null;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.fontsBox,testID:_testIDs.ASSETS_TEST_IDS.fonts,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.fontsTitle,testID:_testIDs.ASSETS_TEST_IDS.fontsTitle,children:["LOADED FONT FAMILIES (",s.length,")"]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.fontsWrap,children:s.map(d=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.fontChip,testID:(0,_testIDs.assetFontChipTestID)(d),children:d},d))})]})}function EmptyState({duplicates:t=false}){return(0,_jsxRuntime.jsx)(_sharedUi.ToolEmptyState,{testID:_testIDs.ASSETS_TEST_IDS.empty,otto:"scanning",title:t?"No duplicates found":"No assets found yet",message:t?"No assets in this view share a content hash.":"Every bundled asset \u2014 images, fonts, video, audio \u2014 appears here with sizes, scale coverage, and runtime registration status. Try Rescan after navigating around the app."})}function bySizeDesc(t,s){return(s.sizeBytes??(0,_assetStore.estDecodedBytes)(s))-(t.sizeBytes??(0,_assetStore.estDecodedBytes)(t))}const COMPARATORS={size:bySizeDesc,name:(t,s)=>t.name.localeCompare(s.name)||t.type.localeCompare(s.type),type:(t,s)=>t.type.localeCompare(s.type)||bySizeDesc(t,s)};function AssetsModal({visible:t,onClose:s,onBack:d,onMinimize:j,persistenceKey:I,inline:_=false}){(0,_install.installAssetCapture)();const{records:R,stats:p,insights:o}=(0,_useAssetRecords.useAssetRecords)();const n=(0,_useAssetScanStatus.useAssetScanStatus)();const[z,u]=(0,_react.useState)(false);(0,_react.useEffect)(()=>{u(false)},[n.graphFetchInFlight,n.lastScanAt]);const S=()=>{u(false);const e=(0,_remote.remoteAssetsDispatch)();if(e)void e("rescan").catch(()=>u(true));else void(0,_install.rescan)()};const[x,f]=(0,_react.useState)(null);const[r,F]=(0,_react.useState)("all");const[m,v]=(0,_react.useState)("");const[A,q]=(0,_react.useState)("size");const i=x!=null?(0,_assetStore.getRecord)(x):void 0;(0,_react.useEffect)(()=>{if(!t)return;void(0,_baseline.loadBaseline)();u(false);const e=(0,_remote.remoteAssetsDispatch)();if(e){e("rescan").catch(()=>u(true))}else{void(0,_install.rescan)()}},[t]);const y=new Set(o.duplicates.flatMap(e=>e.ids));const C=[...R].sort(COMPARATORS[A]);const T=m.trim().toLowerCase();const l=C.filter(e=>{if(r==="unused"&&e.loaded)return false;if(r==="duplicates"&&!y.has(e.id))return false;if(r!=="all"&&r!=="unused"&&r!=="duplicates"&&e.kind!==r)return false;if(T&&!`${e.name}.${e.type}`.toLowerCase().includes(T)){return false}return true});const h=i?l.findIndex(e=>e.id===i.id):-1;const w=e=>{const a=l[e];if(a)f(a.id)};const c={scaleGaps:new Set(o.scaleGaps),scaleAnomalies:new Set(o.scaleAnomalies),duplicates:y,webpCandidates:new Set(o.webpCandidates),overDecode:new Set(o.overDecode),heavy:new Set([...o.heavyGifs,...o.heavyFonts])};let g=0;for(const e of l){const a=e.sizeBytes??(0,_assetStore.estDecodedBytes)(e);if(a>g)g=a}const B=()=>i?(0,_export.formatAssetMarkdown)(i):(0,_export.formatInventoryMarkdown)(C,p,o,(0,_install.getScanStatus)(),(0,_baseline.getDiff)());const b=(0,_jsxRuntime.jsx)(_AssetsHeader.AssetsHeader,{stats:p,measuring:n.measuring,discovering:n.graphFetchInFlight,detailOpen:i!=null,detailIndex:h,detailTotal:l.length,onCloseDetail:()=>f(null),onClear:_assetStore.clearRecords,getReport:B,onBack:d});const D=i?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.detailContainer,children:[(0,_jsxRuntime.jsx)(_AssetDetail.AssetDetail,{record:i,insights:o}),h>=0?(0,_jsxRuntime.jsx)(_sharedUi.EventStepperFooter,{currentIndex:h,totalItems:l.length,itemLabel:"Asset",onPrevious:()=>w(h-1),onNext:()=>w(h+1)}):null]}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.listContainer,children:[(0,_jsxRuntime.jsx)(_AssetsFilterBar.AssetsFilterBar,{stats:p,duplicateCount:y.size,filter:r,onChange:e=>{F(e);if(e==="duplicates")v("")}}),(0,_jsxRuntime.jsx)(_AssetsListControls.AssetsListControls,{query:m,onQueryChange:v,sort:A,onSortChange:q}),(0,_jsxRuntime.jsx)(_ScanNotice.ScanNotice,{status:n,total:p.total,onRetry:S}),z&&!n.graphFetchInFlight?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.notice,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.noticeText,children:"Couldn't request an asset scan from the device."}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{accessibilityRole:"button",onPress:S,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.retryText,children:"Retry"})})]}):null,r==="unused"?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.notice,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.noticeText,children:"Not seen in React Native's asset registry this app run. Assets loaded through other paths may appear here; this does not prove they are unused."})}):null,r==="font"?(0,_jsxRuntime.jsx)(FontFamilies,{names:n.fontFamilies}):null,(0,_jsxRuntime.jsx)(_reactNative.FlatList,{testID:_testIDs.ASSETS_TEST_IDS.list,data:l,keyExtractor:e=>String(e.id),contentContainerStyle:styles.listContent,renderItem:({item:e})=>(0,_jsxRuntime.jsx)(_AssetRow.AssetRow,{record:e,flags:{scaleGap:c.scaleGaps.has(e.id),scaleAnomaly:c.scaleAnomalies.has(e.id),duplicate:c.duplicates.has(e.id),webp:c.webpCandidates.has(e.id),oversize:c.overDecode.has(e.id),heavy:c.heavy.has(e.id)},sizeFraction:g>0?(e.sizeBytes??(0,_assetStore.estDecodedBytes)(e))/g:0,onPress:a=>f(typeof a==="number"?a:null)}),ListEmptyComponent:n.graphFetchInFlight?null:(0,_jsxRuntime.jsx)(EmptyState,{duplicates:r==="duplicates"})})]});if(_){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.inlineRoot,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.inlineHeader,..._sharedUi.windowDragProps,children:b}),D]})}return(0,_jsxRuntime.jsx)(_sharedUi.JsModal,{visible:t,onClose:s,onMinimize:j,persistenceKey:I,header:{showToggleButton:true,customContent:b},enablePersistence:true,initialMode:"bottomSheet",disableScrollWrapper:true,children:D})}function AssetsToolView(t={}){return(0,_jsxRuntime.jsx)(AssetsModal,{...t,inline:true,visible:true,onClose:()=>{}})}const styles=_reactNative.StyleSheet.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:_sharedUi.macOSColors.border.default,backgroundColor:"transparent"},listContainer:{flex:1},listContent:{paddingBottom:16},detailContainer:{flex:1},notice:{marginHorizontal:10,marginBottom:8,padding:10,borderRadius:8,borderWidth:1,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface,gap:4},noticeText:{color:_sharedUi.night.color.textSecondary,fontSize:11},retryText:{color:_sharedUi.night.color.text,fontSize:12,paddingVertical:6},fontsBox:{marginHorizontal:10,marginTop:8,padding:10,borderRadius:8,backgroundColor:_sharedUi.night.color.surface,gap:6},fontsTitle:{color:_sharedUi.night.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5},fontsWrap:{flexDirection:"row",flexWrap:"wrap",gap:6},fontChip:{color:_sharedUi.night.color.textSecondary,fontSize:10,backgroundColor:_sharedUi.night.color.bg,borderRadius:999,paddingHorizontal:8,paddingVertical:3,overflow:"hidden"},empty:{alignItems:"center",padding:32,gap:8},emptyTitle:{color:_sharedUi.night.color.text,fontSize:13,fontWeight:"600"},emptyText:{color:_sharedUi.night.color.textSecondary,fontSize:11,textAlign:"center",lineHeight:16}});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.AssetsModal=AssetsModal;exports.AssetsToolView=AssetsToolView;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _install=require("../capture/install");var _export=require("../export");var _useAssetRecords=require("../hooks/useAssetRecords");var _useAssetScanStatus=require("../hooks/useAssetScanStatus");var _remote=require("../remote");var _assetStore=require("../store/assetStore");var _baseline=require("../store/baseline");var _AssetDetail=require("./AssetDetail");var _AssetRow=require("./AssetRow");var _AssetsFilterBar=require("./AssetsFilterBar");var _AssetsHeader=require("./AssetsHeader");var _AssetsListControls=require("./AssetsListControls");var _ScanNotice=require("./ScanNotice");var _testIDs=require("../utils/testIDs");var _jsxRuntime=require("react/jsx-runtime");function FontFamilies({names:t}){const s=[...new Set(t)];if(!s.length)return null;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.fontsBox,testID:_testIDs.ASSETS_TEST_IDS.fonts,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.fontsTitle,testID:_testIDs.ASSETS_TEST_IDS.fontsTitle,children:["LOADED FONT FAMILIES (",s.length,")"]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.fontsWrap,children:s.map(d=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.fontChip,testID:(0,_testIDs.assetFontChipTestID)(d),children:d},d))})]})}function EmptyState({duplicates:t=false}){return(0,_jsxRuntime.jsx)(_sharedUi.ToolEmptyState,{testID:_testIDs.ASSETS_TEST_IDS.empty,otto:"scanning",title:t?"No duplicates found":"No assets found yet",message:t?"No assets in this view share a content hash.":"Every bundled asset \u2014 images, fonts, video, audio \u2014 appears here with sizes, scale coverage, and runtime registration status. Try Rescan after navigating around the app."})}function bySizeDesc(t,s){return(s.sizeBytes??(0,_assetStore.estDecodedBytes)(s))-(t.sizeBytes??(0,_assetStore.estDecodedBytes)(t))}const COMPARATORS={size:bySizeDesc,name:(t,s)=>t.name.localeCompare(s.name)||t.type.localeCompare(s.type),type:(t,s)=>t.type.localeCompare(s.type)||bySizeDesc(t,s)};function AssetsModal({visible:t,onClose:s,onBack:d,onMinimize:j,persistenceKey:I,inline:_=false}){(0,_install.installAssetCapture)();const{records:R,stats:p,insights:o}=(0,_useAssetRecords.useAssetRecords)();const n=(0,_useAssetScanStatus.useAssetScanStatus)();const[z,u]=(0,_react.useState)(false);(0,_react.useEffect)(()=>{u(false)},[n.graphFetchInFlight,n.lastScanAt]);const S=()=>{u(false);const e=(0,_remote.remoteAssetsDispatch)();if(e)void e("rescan").catch(()=>u(true));else void(0,_install.rescan)()};const[x,f]=(0,_react.useState)(null);const[r,F]=(0,_react.useState)("all");const[m,v]=(0,_react.useState)("");const[A,q]=(0,_react.useState)("size");const i=x!=null?(0,_assetStore.getRecord)(x):void 0;(0,_react.useEffect)(()=>{if(!t)return;void(0,_baseline.loadBaseline)();u(false);const e=(0,_remote.remoteAssetsDispatch)();if(e){e("rescan").catch(()=>u(true))}else{void(0,_install.rescan)()}},[t]);const y=new Set(o.duplicates.flatMap(e=>e.ids));const C=[...R].sort(COMPARATORS[A]);const T=m.trim().toLowerCase();const l=C.filter(e=>{if(r==="unused"&&e.loaded)return false;if(r==="duplicates"&&!y.has(e.id))return false;if(r!=="all"&&r!=="unused"&&r!=="duplicates"&&e.kind!==r)return false;if(T&&!`${e.name}.${e.type}`.toLowerCase().includes(T)){return false}return true});const h=i?l.findIndex(e=>e.id===i.id):-1;const w=e=>{const a=l[e];if(a)f(a.id)};const c={scaleGaps:new Set(o.scaleGaps),scaleAnomalies:new Set(o.scaleAnomalies),duplicates:y,webpCandidates:new Set(o.webpCandidates),overDecode:new Set(o.overDecode),heavy:new Set([...o.heavyGifs,...o.heavyFonts])};let g=0;for(const e of l){const a=e.sizeBytes??(0,_assetStore.estDecodedBytes)(e);if(a>g)g=a}const B=()=>i?(0,_export.formatAssetMarkdown)(i):(0,_export.formatInventoryMarkdown)(C,p,o,(0,_install.getScanStatus)(),(0,_baseline.getDiff)());const b=(0,_jsxRuntime.jsx)(_AssetsHeader.AssetsHeader,{stats:p,measuring:n.measuring,discovering:n.graphFetchInFlight,detailOpen:i!=null,detailIndex:h,detailTotal:l.length,onCloseDetail:()=>f(null),onClear:_assetStore.clearRecords,getReport:B,onBack:d});const D=i?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.detailContainer,children:[(0,_jsxRuntime.jsx)(_AssetDetail.AssetDetail,{record:i,insights:o}),h>=0?(0,_jsxRuntime.jsx)(_sharedUi.EventStepperFooter,{currentIndex:h,totalItems:l.length,itemLabel:"Asset",onPrevious:()=>w(h-1),onNext:()=>w(h+1)}):null]}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.listContainer,children:[(0,_jsxRuntime.jsx)(_AssetsFilterBar.AssetsFilterBar,{stats:p,duplicateCount:y.size,filter:r,onChange:e=>{F(e);if(e==="duplicates")v("")}}),(0,_jsxRuntime.jsx)(_AssetsListControls.AssetsListControls,{query:m,onQueryChange:v,sort:A,onSortChange:q}),(0,_jsxRuntime.jsx)(_ScanNotice.ScanNotice,{status:n,total:p.total,onRetry:S}),z&&!n.graphFetchInFlight?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.notice,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.noticeText,children:"Couldn't request an asset scan from the device."}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{accessibilityRole:"button",onPress:S,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.retryText,children:"Retry"})})]}):null,r==="unused"?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.notice,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.noticeText,children:"Not seen in React Native's asset registry this app run. Assets loaded through other paths may appear here; this does not prove they are unused."})}):null,r==="font"?(0,_jsxRuntime.jsx)(FontFamilies,{names:n.fontFamilies}):null,(0,_jsxRuntime.jsx)(_reactNative.FlatList,{keyboardShouldPersistTaps:"handled",testID:_testIDs.ASSETS_TEST_IDS.list,data:l,keyExtractor:e=>String(e.id),contentContainerStyle:styles.listContent,renderItem:({item:e})=>(0,_jsxRuntime.jsx)(_AssetRow.AssetRow,{record:e,flags:{scaleGap:c.scaleGaps.has(e.id),scaleAnomaly:c.scaleAnomalies.has(e.id),duplicate:c.duplicates.has(e.id),webp:c.webpCandidates.has(e.id),oversize:c.overDecode.has(e.id),heavy:c.heavy.has(e.id)},sizeFraction:g>0?(e.sizeBytes??(0,_assetStore.estDecodedBytes)(e))/g:0,onPress:a=>f(typeof a==="number"?a:null)}),ListEmptyComponent:n.graphFetchInFlight?null:(0,_jsxRuntime.jsx)(EmptyState,{duplicates:r==="duplicates"})})]});if(_){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.inlineRoot,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.inlineHeader,..._sharedUi.windowDragProps,children:b}),D]})}return(0,_jsxRuntime.jsx)(_sharedUi.JsModal,{visible:t,onClose:s,onMinimize:j,persistenceKey:I,header:{showToggleButton:true,customContent:b},enablePersistence:true,initialMode:"bottomSheet",disableScrollWrapper:true,children:D})}function AssetsToolView(t={}){return(0,_jsxRuntime.jsx)(AssetsModal,{...t,inline:true,visible:true,onClose:()=>{}})}const styles=_reactNative.StyleSheet.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:_sharedUi.macOSColors.border.default,backgroundColor:"transparent"},listContainer:{flex:1},listContent:{paddingBottom:16},detailContainer:{flex:1},notice:{marginHorizontal:10,marginBottom:8,padding:10,borderRadius:8,borderWidth:1,borderColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface,gap:4},noticeText:{color:_sharedUi.night.color.textSecondary,fontSize:11},retryText:{color:_sharedUi.night.color.text,fontSize:12,paddingVertical:6},fontsBox:{marginHorizontal:10,marginTop:8,padding:10,borderRadius:8,backgroundColor:_sharedUi.night.color.surface,gap:6},fontsTitle:{color:_sharedUi.night.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5},fontsWrap:{flexDirection:"row",flexWrap:"wrap",gap:6},fontChip:{color:_sharedUi.night.color.textSecondary,fontSize:10,backgroundColor:_sharedUi.night.color.bg,borderRadius:999,paddingHorizontal:8,paddingVertical:3,overflow:"hidden"},empty:{alignItems:"center",padding:32,gap:8},emptyTitle:{color:_sharedUi.night.color.text,fontSize:13,fontWeight:"600"},emptyText:{color:_sharedUi.night.color.textSecondary,fontSize:11,textAlign:"center",lineHeight:16}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{ScrollView as y,StyleSheet as f,Text as u,View as r}from"react-native";import{night as o}from"@buoy-gg/shared-ui";import{AssetImage as g}from"./AssetImage";import{formatBytes as d,formatDimensions as b,formatScales as S}from"../format";import{estDecodedBytes as w}from"../store/assetStore";import{ASSETS_TEST_IDS as c,assetDetailRowTestID as x,assetFindingTestID as D}from"../utils/testIDs";import{jsx as t,jsxs as
|
|
1
|
+
"use strict";import{ScrollView as y,StyleSheet as f,Text as u,View as r}from"react-native";import{night as o}from"@buoy-gg/shared-ui";import{AssetImage as g}from"./AssetImage";import{formatBytes as d,formatDimensions as b,formatScales as S}from"../format";import{estDecodedBytes as w}from"../store/assetStore";import{ASSETS_TEST_IDS as c,assetDetailRowTestID as x,assetFindingTestID as D}from"../utils/testIDs";import{jsx as t,jsxs as h,Fragment as k}from"react/jsx-runtime";function l({label:e,value:n}){const i=x(e);return h(r,{style:a.kvRow,testID:i,children:[t(u,{style:a.kvLabel,children:e}),t(u,{style:a.kvValue,selectable:true,testID:`${i}-value`,children:n})]})}function I({record:e}){if(e.kind==="image"){return t(r,{style:a.previewBox,testID:c.detailPreview,children:t(g,{testID:"buoy-internal-assets-preview",record:e,style:a.previewImage})})}if(e.kind==="font"){return t(r,{style:a.previewBox,testID:c.detailFontPreview,children:t(u,{style:[a.fontPreview,{fontFamily:e.name}],children:"The quick brown fox jumps over the lazy dog 0123456789"})})}return null}export function AssetDetail({record:e,insights:n}){const i=[];if(n.neverLoaded.includes(e.id)){i.push("Not observed in the runtime registry this app run. This does not prove the asset is unused.")}if(n.scaleGaps.includes(e.id)){i.push("Scale gap \u2014 no variant covers this device's pixel ratio")}if(n.webpCandidates.includes(e.id)){i.push("WebP candidate \u2014 large png/jpeg, converting typically saves 20\u201340%")}const m=n.duplicates.find(s=>s.ids.includes(e.id));if(m){i.push(`Duplicate content \u2014 identical bytes shipped ${m.ids.length} times`)}if(n.overDecode.includes(e.id)){i.push("Decodes larger than 2\xD7 this entire screen \u2014 resize the source, no view can need this many pixels")}if(n.heavyGifs.includes(e.id)){i.push("Heavy GIF \u2014 every frame decodes into memory; a video or Lottie is typically ~90% smaller")}if(n.heavyFonts.includes(e.id)){i.push("Heavy font \u2014 likely an unsubset icon font; subsetting to used glyphs usually saves most of it")}if(n.scaleAnomalies.includes(e.id)){i.push("Scale anomaly \u2014 a higher-resolution variant is smaller in bytes than a lower one; check the exports")}const p=w(e);return h(y,{keyboardShouldPersistTaps:"handled",style:a.scroll,contentContainerStyle:a.content,testID:c.detailScroll,children:[t(I,{record:e}),i.length>0?t(r,{style:a.findings,testID:c.detailFindings,children:i.map((s,v)=>t(u,{style:a.findingText,testID:D(v),children:s},s))}):null,t(l,{label:"Name",value:`${e.name}.${e.type}`}),e.loadStatus&&h(k,{children:[t(l,{label:"Load",value:e.loadStatus==="error"?"Failed":"Loaded"}),t(l,{label:"Load time",value:e.durationMs==null?"Unknown":`${e.durationMs.toFixed(1)} ms`}),t(l,{label:"Load size",value:e.sizeBytes==null?"Unknown":d(e.sizeBytes)}),t(l,{label:"Cache",value:e.cacheHit==null?"Unknown":e.cacheHit?"Cache hit":"Web load"})]}),t(l,{label:"Kind",value:e.kind}),t(l,{label:"Status",value:e.loaded?"Loaded (registered at runtime)":"Not observed in the runtime registry"}),e.kind==="image"?t(l,{label:"Dimensions",value:`${b(e)} (logical)`}):null,e.kind==="image"&&e.scales.length?t(l,{label:"Scales",value:S(e.scales)}):null,e.sizesByScale?Object.entries(e.sizesByScale).map(([s,v])=>t(l,{label:`Size @${s}x`,value:d(v)},s)):null,e.sizeBytes!=null&&e.sizeSource==="measured"?t(l,{label:"Total size",value:d(e.sizeBytes)}):null,p>0?t(l,{label:"Decoded memory",value:`~${d(p)} (RGBA)`}):null,e.registryId!=null?t(l,{label:"Registry id",value:String(e.registryId)}):null,e.hash?t(l,{label:"Hash",value:e.hash}):null,e.httpServerLocation?t(l,{label:"Location",value:e.httpServerLocation}):null,e.fileSystemLocation?t(l,{label:"Source dir",value:e.fileSystemLocation}):null,e.resolvedUri?t(l,{label:"Resolved URI",value:e.resolvedUri}):null]})}const a=f.create({scroll:{flex:1},content:{padding:12,gap:8},previewBox:{borderRadius:8,backgroundColor:o.color.bg,padding:12,alignItems:"center",justifyContent:"center",minHeight:96},previewImage:{width:"100%",height:140},fontPreview:{color:o.color.text,fontSize:16,textAlign:"center"},findings:{borderRadius:8,borderWidth:1,borderColor:o.color.border,backgroundColor:o.color.surface,padding:10,gap:6},findingText:{color:o.color.textSecondary,fontSize:11,lineHeight:15},kvRow:{gap:2},kvLabel:{color:o.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,textTransform:"uppercase"},kvValue:{color:o.color.text,fontSize:12}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useEffect as L,useState as S}from"react";import{FlatList as J,StyleSheet as K,Text as C,TouchableOpacity as U,View as d}from"react-native";import{EventStepperFooter as X,JsModal as Y,macOSColors as Z,night as i,windowDragProps as ee,ToolEmptyState as te}from"@buoy-gg/shared-ui";import{getScanStatus as oe,installAssetCapture as se,rescan as N}from"../capture/install";import{formatAssetMarkdown as re,formatInventoryMarkdown as ne}from"../export";import{useAssetRecords as ie}from"../hooks/useAssetRecords";import{useAssetScanStatus as ae}from"../hooks/useAssetScanStatus";import{remoteAssetsDispatch as W}from"../remote";import{clearRecords as le,estDecodedBytes as
|
|
1
|
+
"use strict";import{useEffect as L,useState as S}from"react";import{FlatList as J,StyleSheet as K,Text as C,TouchableOpacity as U,View as d}from"react-native";import{EventStepperFooter as X,JsModal as Y,macOSColors as Z,night as i,windowDragProps as ee,ToolEmptyState as te}from"@buoy-gg/shared-ui";import{getScanStatus as oe,installAssetCapture as se,rescan as N}from"../capture/install";import{formatAssetMarkdown as re,formatInventoryMarkdown as ne}from"../export";import{useAssetRecords as ie}from"../hooks/useAssetRecords";import{useAssetScanStatus as ae}from"../hooks/useAssetScanStatus";import{remoteAssetsDispatch as W}from"../remote";import{clearRecords as le,estDecodedBytes as T,getRecord as ce}from"../store/assetStore";import{getDiff as de,loadBaseline as pe}from"../store/baseline";import{AssetDetail as ue}from"./AssetDetail";import{AssetRow as fe}from"./AssetRow";import{AssetsFilterBar as he}from"./AssetsFilterBar";import{AssetsHeader as me}from"./AssetsHeader";import{AssetsListControls as ge}from"./AssetsListControls";import{ScanNotice as ye}from"./ScanNotice";import{ASSETS_TEST_IDS as v,assetFontChipTestID as Se}from"../utils/testIDs";import{jsxs as h,jsx as t}from"react/jsx-runtime";function Ce({names:o}){const s=[...new Set(o)];if(!s.length)return null;return h(d,{style:r.fontsBox,testID:v.fonts,children:[h(C,{style:r.fontsTitle,testID:v.fontsTitle,children:["LOADED FONT FAMILIES (",s.length,")"]}),t(d,{style:r.fontsWrap,children:s.map(m=>t(C,{style:r.fontChip,testID:Se(m),children:m},m))})]})}function xe({duplicates:o=false}){return t(te,{testID:v.empty,otto:"scanning",title:o?"No duplicates found":"No assets found yet",message:o?"No assets in this view share a content hash.":"Every bundled asset \u2014 images, fonts, video, audio \u2014 appears here with sizes, scale coverage, and runtime registration status. Try Rescan after navigating around the app."})}function O(o,s){return(s.sizeBytes??T(s))-(o.sizeBytes??T(o))}const be={size:O,name:(o,s)=>o.name.localeCompare(s.name)||o.type.localeCompare(s.type),type:(o,s)=>o.type.localeCompare(s.type)||O(o,s)};export function AssetsModal({visible:o,onClose:s,onBack:m,onMinimize:P,persistenceKey:G,inline:V=false}){se();const{records:j,stats:x,insights:a}=ie();const l=ae();const[_,g]=S(false);L(()=>{g(false)},[l.graphFetchInFlight,l.lastScanAt]);const I=()=>{g(false);const e=W();if(e)void e("rescan").catch(()=>g(true));else void N()};const[z,w]=S(null);const[n,q]=S("all");const[D,F]=S("");const[R,Q]=S("size");const p=z!=null?ce(z):void 0;L(()=>{if(!o)return;void pe();g(false);const e=W();if(e){e("rescan").catch(()=>g(true))}else{void N()}},[o]);const A=new Set(a.duplicates.flatMap(e=>e.ids));const B=[...j].sort(be[R]);const E=D.trim().toLowerCase();const u=B.filter(e=>{if(n==="unused"&&e.loaded)return false;if(n==="duplicates"&&!A.has(e.id))return false;if(n!=="all"&&n!=="unused"&&n!=="duplicates"&&e.kind!==n)return false;if(E&&!`${e.name}.${e.type}`.toLowerCase().includes(E)){return false}return true});const y=p?u.findIndex(e=>e.id===p.id):-1;const k=e=>{const c=u[e];if(c)w(c.id)};const f={scaleGaps:new Set(a.scaleGaps),scaleAnomalies:new Set(a.scaleAnomalies),duplicates:A,webpCandidates:new Set(a.webpCandidates),overDecode:new Set(a.overDecode),heavy:new Set([...a.heavyGifs,...a.heavyFonts])};let b=0;for(const e of u){const c=e.sizeBytes??T(e);if(c>b)b=c}const $=()=>p?re(p):ne(B,x,a,oe(),de());const H=t(me,{stats:x,measuring:l.measuring,discovering:l.graphFetchInFlight,detailOpen:p!=null,detailIndex:y,detailTotal:u.length,onCloseDetail:()=>w(null),onClear:le,getReport:$,onBack:m});const M=p?h(d,{style:r.detailContainer,children:[t(ue,{record:p,insights:a}),y>=0?t(X,{currentIndex:y,totalItems:u.length,itemLabel:"Asset",onPrevious:()=>k(y-1),onNext:()=>k(y+1)}):null]}):h(d,{style:r.listContainer,children:[t(he,{stats:x,duplicateCount:A.size,filter:n,onChange:e=>{q(e);if(e==="duplicates")F("")}}),t(ge,{query:D,onQueryChange:F,sort:R,onSortChange:Q}),t(ye,{status:l,total:x.total,onRetry:I}),_&&!l.graphFetchInFlight?h(d,{style:r.notice,children:[t(C,{style:r.noticeText,children:"Couldn't request an asset scan from the device."}),t(U,{accessibilityRole:"button",onPress:I,children:t(C,{style:r.retryText,children:"Retry"})})]}):null,n==="unused"?t(d,{style:r.notice,children:t(C,{style:r.noticeText,children:"Not seen in React Native's asset registry this app run. Assets loaded through other paths may appear here; this does not prove they are unused."})}):null,n==="font"?t(Ce,{names:l.fontFamilies}):null,t(J,{keyboardShouldPersistTaps:"handled",testID:v.list,data:u,keyExtractor:e=>String(e.id),contentContainerStyle:r.listContent,renderItem:({item:e})=>t(fe,{record:e,flags:{scaleGap:f.scaleGaps.has(e.id),scaleAnomaly:f.scaleAnomalies.has(e.id),duplicate:f.duplicates.has(e.id),webp:f.webpCandidates.has(e.id),oversize:f.overDecode.has(e.id),heavy:f.heavy.has(e.id)},sizeFraction:b>0?(e.sizeBytes??T(e))/b:0,onPress:c=>w(typeof c==="number"?c:null)}),ListEmptyComponent:l.graphFetchInFlight?null:t(xe,{duplicates:n==="duplicates"})})]});if(V){return h(d,{style:r.inlineRoot,children:[t(d,{style:r.inlineHeader,...ee,children:H}),M]})}return t(Y,{visible:o,onClose:s,onMinimize:P,persistenceKey:G,header:{showToggleButton:true,customContent:H},enablePersistence:true,initialMode:"bottomSheet",disableScrollWrapper:true,children:M})}export function AssetsToolView(o={}){return t(AssetsModal,{...o,inline:true,visible:true,onClose:()=>{}})}const r=K.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:Z.border.default,backgroundColor:"transparent"},listContainer:{flex:1},listContent:{paddingBottom:16},detailContainer:{flex:1},notice:{marginHorizontal:10,marginBottom:8,padding:10,borderRadius:8,borderWidth:1,borderColor:i.color.border,backgroundColor:i.color.surface,gap:4},noticeText:{color:i.color.textSecondary,fontSize:11},retryText:{color:i.color.text,fontSize:12,paddingVertical:6},fontsBox:{marginHorizontal:10,marginTop:8,padding:10,borderRadius:8,backgroundColor:i.color.surface,gap:6},fontsTitle:{color:i.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5},fontsWrap:{flexDirection:"row",flexWrap:"wrap",gap:6},fontChip:{color:i.color.textSecondary,fontSize:10,backgroundColor:i.color.bg,borderRadius:999,paddingHorizontal:8,paddingVertical:3,overflow:"hidden"},empty:{alignItems:"center",padding:32,gap:8},emptyTitle:{color:i.color.text,fontSize:13,fontWeight:"600"},emptyText:{color:i.color.textSecondary,fontSize:11,textAlign:"center",lineHeight:16}});
|
package/lib/web/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use client";var $e=Object.defineProperty;var ba=Object.getOwnPropertyDescriptor;var va=Object.getOwnPropertyNames;var Sa=Object.prototype.hasOwnProperty;var ce=(e,t)=>()=>(e&&(t=e(e=0)),t);var wa=(e,t)=>{for(var a in t)$e(e,a,{get:t[a],enumerable:true})},Ie=(e,t,a,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of va(t))!Sa.call(e,n)&&n!==a&&$e(e,n,{get:()=>t[n],enumerable:!(s=ba(t,n))||s.enumerable});return e},xa=(e,t,a)=>(Ie(e,t,"default"),a&&Ie(a,t,"default"));var lt=e=>Ie($e({},"__esModule",{value:true}),e);var Ca,p=ce(()=>{"use strict";Ca=(()=>{try{let e=globalThis.Capacitor;if(e&&typeof e.isNativePlatform=="function"&&e.isNativePlatform())return e.DEBUG===true}catch{}return process.env.NODE_ENV!=="production"})();typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis)});var dt,ka=ce(()=>{"use strict";p();dt='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'});import{useEffect as za,useState as Ba}from"react";import{createPortal as $a}from"react-dom";import{jsx as Ia}from"react/jsx-runtime";function ct(){let e=document;if(e[Q])return e[Q].host;let t=document.createElement("div");t.dataset.buoyPortalHost="",Object.assign(t.style,{position:"fixed",inset:"0",zIndex:"2147483647",pointerEvents:"none",fontFamily:dt});let a=()=>{let r=document.fullscreenElement,u=r&&r.tagName!=="CANVAS"?r:document.body;t.parentElement!==u&&u.appendChild(t)},s=new Map,n=r=>{(!t.contains(r.target)||!Ae(r.target))&&s.set(r.code||r.key,{key:r.key,code:r.code,location:r.location,keyCode:r.keyCode,which:r.which,altKey:r.altKey,ctrlKey:r.ctrlKey,metaKey:r.metaKey,shiftKey:r.shiftKey})},o=r=>{s.delete(r.code||r.key)},i=()=>s.clear(),d=()=>{let r=[...s.values()];s.clear();for(let u of r)document.dispatchEvent(new KeyboardEvent("keyup",{...u,bubbles:true}))},l=r=>{Ae(r.target)&&r.stopPropagation()},c=r=>r.stopPropagation();return a(),document.addEventListener("fullscreenchange",a),document.addEventListener("keydown",n,true),document.addEventListener("keyup",o,true),window.addEventListener("blur",i),t.addEventListener("focusin",d),t.addEventListener("keydown",l),t.addEventListener("keyup",l),t.addEventListener("keypress",l),t.addEventListener("wheel",c,{passive:true}),e[Q]={host:t,users:0,dispose:()=>{document.removeEventListener("fullscreenchange",a),document.removeEventListener("keydown",n,true),document.removeEventListener("keyup",o,true),window.removeEventListener("blur",i),t.remove(),delete e[Q]}},t}function Aa({children:e}){let[t,a]=Ba(null);return za(()=>{let s=ct(),n=document[Q];return n.users++,a(s),()=>{--n.users===0&&n.dispose()}},[]),t?$a(Ia("div",{"data-buoy-root":"",style:{display:"contents",pointerEvents:"auto"},children:e}),t):null}var Q,Ae,Da=ce(()=>{"use strict";p();ka();Q=Symbol.for("@buoy-gg/portal-host"),Ae=e=>{if(!(e instanceof Element))return false;if(e.closest("input, textarea, select"))return true;let t=e.closest("[contenteditable]")?.getAttribute("contenteditable")?.toLowerCase();return t===""||t==="true"||t==="plaintext-only"}});var ue={};wa(ue,{AccessibilityInfo:()=>Ta,ActivityIndicator:()=>Re,Alert:()=>zt,Animated:()=>gt,AppRegistry:()=>Ma,AppState:()=>Oa,Appearance:()=>Ra,BackHandler:()=>Pa,Button:()=>Ct,CheckBox:()=>Xa,Clipboard:()=>ja,DeviceEventEmitter:()=>ps,Dimensions:()=>Ha,Easing:()=>Na,FlatList:()=>ut,I18nManager:()=>Va,Image:()=>ht,ImageBackground:()=>es,InteractionManager:()=>Ua,Keyboard:()=>Wa,KeyboardAvoidingView:()=>ts,LayoutAnimation:()=>Ka,Linking:()=>Ga,LogBox:()=>hs,Modal:()=>wt,NativeEventEmitter:()=>_a,NativeModules:()=>La,PanResponder:()=>qa,Picker:()=>as,PixelRatio:()=>Ja,Platform:()=>he,Pressable:()=>St,ProgressBar:()=>ss,RefreshControl:()=>ns,SafeAreaView:()=>os,ScrollView:()=>Le,SectionList:()=>rs,Share:()=>Ya,StatusBar:()=>is,StyleSheet:()=>M,Switch:()=>xt,Text:()=>b,TextInput:()=>Ee,Touchable:()=>ls,TouchableHighlight:()=>bt,TouchableNativeFeedback:()=>ds,TouchableOpacity:()=>W,TouchableWithoutFeedback:()=>vt,UIManager:()=>Qa,Vibration:()=>Za,View:()=>m,VirtualizedList:()=>cs,YellowBox:()=>us,findNodeHandle:()=>kt,unstable_createElement:()=>Ea,useColorScheme:()=>fs,useLocaleContext:()=>ys,useWindowDimensions:()=>ms});import*as Fa from"react-native-web";import{unstable_createElement as Ea,NativeModules as La,AccessibilityInfo as Ta,Appearance as Ra,AppRegistry as Ma,AppState as Oa,BackHandler as Pa,Clipboard as ja,Dimensions as Ha,Easing as Na,I18nManager as Va,Keyboard as Wa,InteractionManager as Ua,LayoutAnimation as Ka,Linking as Ga,NativeEventEmitter as _a,PanResponder as qa,PixelRatio as Ja,Platform as he,Share as Ya,UIManager as Qa,Vibration as Za,CheckBox as Xa,FlatList as ut,Image as ht,ImageBackground as es,KeyboardAvoidingView as ts,Picker as as,ProgressBar as ss,RefreshControl as ns,SafeAreaView as os,SectionList as rs,StatusBar as is,Touchable as ls,TouchableNativeFeedback as ds,VirtualizedList as cs,YellowBox as us,LogBox as hs,DeviceEventEmitter as ps,useColorScheme as fs,useLocaleContext as ys,useWindowDimensions as ms}from"react-native-web";import*as B from"react-native-web";import{createElement as De,forwardRef as pt,useCallback as gs,useRef as bs}from"react";function Fe(e){if(Array.isArray(e)){let u=e.map(Fe);return u.some((h,w)=>h!==e[w])?u:e}if(!e||typeof e!="object"||!yt.some(u=>e[u]!=null))return e;let{shadowColor:t,shadowOffset:a,shadowOpacity:s,shadowRadius:n,textShadowColor:o,textShadowOffset:i,textShadowRadius:d,...l}=e;if(t!=null||a!=null||s!=null||n!=null){let u=t??"black",h=s==null?u:`color-mix(in srgb, ${u} ${Math.min(s,1)*100}%, transparent)`,w=`${V(a?.width??0)} ${V(a?.height??0)} ${V(n??0)} ${h}`;l.boxShadow=typeof l.boxShadow=="string"?`${l.boxShadow}, ${w}`:l.boxShadow??w}let{width:c=0,height:r=0}=i??{};if(o&&(c||r||d)){let u=`${V(c)} ${V(r)} ${V(d??0)} ${o}`;l.textShadow=l.textShadow?`${l.textShadow}, ${u}`:u}return l}function ft(e,t){if(typeof e=="function")return s=>ft(e(s),t);let a=Fe(e);return t?[a,mt[t]]:a}function A(e){let t=pt((s,n)=>{let{accessibilityState:o,accessibilityValue:i,pointerEvents:d,...l}=s;for(let r of["busy","checked","disabled","expanded","selected"])o?.[r]!==void 0&&l[`aria-${r}`]===void 0&&(l[`aria-${r}`]=o[r]);for(let[r,u]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))i?.[r]!==void 0&&l[`aria-${u}`]===void 0&&(l[`aria-${u}`]=i[r]);let c=ft(l.style,d);return c!==l.style&&(l.style=c),De(e,{...l,ref:n})}),a=e.State;return a&&Object.assign(t,{State:a}),t.displayName=e.displayName??e.name??"NativeWebView",t}var N,yt,V,mt,M,m,b,gt,Ee,W,bt,vt,St,Le,Te,wt,xt,Re,Ct,kt,zt,T=ce(()=>{p();xa(ue,Fa);Da();N=B,yt=["shadowColor","shadowOffset","shadowOpacity","shadowRadius","textShadowColor","textShadowOffset","textShadowRadius"],V=e=>typeof e=="number"?`${e}px`:e;mt=N.StyleSheet.create({auto:{pointerEvents:"auto"},none:{pointerEvents:"none"},"box-none":{pointerEvents:"box-none"},"box-only":{pointerEvents:"box-only"}});M={...N.StyleSheet,create:e=>N.StyleSheet.create(Object.fromEntries(Object.entries(e).map(([t,a])=>[t,Fe(a)])))};m=A(B.View),b=A(B.Text),gt={...N.Animated,View:N.Animated.createAnimatedComponent(m),Text:N.Animated.createAnimatedComponent(b)},Ee=A(B.TextInput),W=A(B.TouchableOpacity),bt=A(B.TouchableHighlight),vt=A(B.TouchableWithoutFeedback),St=A(B.Pressable),Le=A(B.ScrollView),Te=pt((e,t)=>{let a=bs(null),s=gs(n=>{if(n){let o=n;for(;o.parentElement&&o.parentElement!==document.body;)o=o.parentElement;o.parentElement===document.body&&(a.current=o,Object.assign(o.style,{position:"relative",zIndex:"2147483647",pointerEvents:"auto"}),ct().appendChild(o))}else a.current&&(document.body.appendChild(a.current),a.current=null);typeof t=="function"?t(n):t&&(t.current=n)},[t]);return De(Aa,null,De(B.Modal,{...e,ref:s}))});Te.displayName="Modal";wt=A(Te),xt=A(B.Switch),Re=A(B.ActivityIndicator),Ct=A(B.Button),kt=B.findNodeHandle,zt={alert(e,t,a,s){if(typeof document>"u")return;let n=document.createElement("dialog");n.dataset.buoyRoot="",n.setAttribute("aria-label",e),n.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";let o=document.createElement("h2");if(o.textContent=e,o.style.cssText="font-size:18px;margin:0 0 12px",n.appendChild(o),t){let c=document.createElement("p");c.textContent=t,c.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",n.appendChild(c)}let i=document.createElement("div");i.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let d=a?.length?a:[{text:"OK"}],l=()=>{n.close?.(),n.remove()};for(let c of d){let r=document.createElement("button");r.type="button",r.textContent=c.text??"OK",r.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${c.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,r.onclick=()=>{l(),c.onPress?.()},i.appendChild(r)}n.addEventListener("cancel",c=>{c.preventDefault(),s?.cancelable!==false&&(l(),s?.onDismiss?.())}),n.appendChild(i),document.body.appendChild(n),n.showModal?n.showModal():n.setAttribute("open","")}}});p();p();p();import{AssetsIcon as Bt,ASSETS_ICON_COLOR as $t}from"@buoy-gg/shared-ui/web";p();T();import{useEffect as It,useState as oe}from"react";import{EventStepperFooter as vs,JsModal as Ss,macOSColors as ws,night as R,windowDragProps as xs,ToolEmptyState as Cs}from"@buoy-gg/shared-ui/web";p();p();var Me=Symbol.for("buoy.assets.globalState.v1");function y(){let e=globalThis;return e[Me]||(e[Me]={records:[],byKey:new Map,byId:new Map,nextId:1,listeners:new Set,snapshot:[],emitScheduled:false,installed:false,patched:false,registryAvailable:false,graphSupported:false,graphCount:null,graphError:null,graphFetchInFlight:false,lastScanAt:null,measuring:false,measuredCount:0,fontFamilies:[],localAssetCount:null,baseline:null,baselineLoaded:false,captureDisabled:false,remoteDispatch:null,mirrorScanStatus:null,mirrorPixelRatio:null,mirrorDiff:null}),e[Me]}p();p();import{isBuoyAssetPath as At}from"@buoy-gg/shared-ui/web";function Dt(e){return[e.key,e.resolvedUri,e.httpServerLocation,e.fileSystemLocation,...e.files??[]].some(At)}p();function Ft(){let e=y().mirrorPixelRatio;if(e!=null)return e;try{return(T(),lt(ue)).PixelRatio.get()}catch{return 2}}function ks(e,t){if(!e.length)return 1;let a=[...e].sort((s,n)=>s-n);for(let s of a)if(s>=t)return s;return a[a.length-1]}function zs(){let e=y();e.emitScheduled||(e.emitScheduled=true,requestAnimationFrame(()=>{e.emitScheduled=false;for(let t of e.listeners)t()}))}function D(){let e=y();e.snapshot=[...e.records],zs()}var Bs={png:"image",jpg:"image",jpeg:"image",gif:"image",webp:"image",bmp:"image",psd:"image",svg:"image",tiff:"image",ktx:"image",heic:"image",heif:"image",avif:"image",ttf:"font",otf:"font",woff:"font",woff2:"font",ttc:"font",mp4:"video",m4v:"video",mov:"video",mpeg:"video",mpg:"video",webm:"video",avi:"video",mp3:"audio",wav:"audio",aac:"audio",aiff:"audio",caf:"audio",m4a:"audio",ogg:"audio",json:"data",db:"data",yaml:"data",yml:"data",xml:"data",html:"data",pdf:"data",zip:"data"};function $s(e){return Bs[e.toLowerCase()]??"other"}function Is(e){if(Dt(e))return;let t=y(),a=t.byKey.get(e.key);return a||(a={id:t.nextId++,key:e.key,name:e.name,type:e.type,kind:$s(e.type),scales:e.scales??[],loaded:e.loaded??false,origin:e.origin,firstSeenAt:Date.now()},t.records.push(a),t.byKey.set(a.key,a),t.byId.set(a.id,a)),e.registryId!=null&&(a.registryId=e.registryId),e.hash!=null&&(a.hash=e.hash),e.httpServerLocation!=null&&(a.httpServerLocation=e.httpServerLocation),e.width!=null&&(a.width=e.width),e.height!=null&&(a.height=e.height),e.scales&&e.scales.length&&(a.scales=[...new Set(e.scales)].sort((s,n)=>s-n)),e.resolvedUri!=null&&(a.resolvedUri=e.resolvedUri),e.resolvedScale!=null&&(a.resolvedScale=e.resolvedScale),e.loaded&&(a.loaded=true),e.fileSystemLocation!=null&&(a.fileSystemLocation=e.fileSystemLocation),e.files&&(a.files=e.files),e.fileHashes&&(a.fileHashes=e.fileHashes),D(),a}function re(e,t){let a=y().byId.get(e);if(a)return Object.assign(a,t),D(),a}function Oe(e){return y().byId.get(e)}function F(){return y().snapshot}function pe(e){return y().listeners.add(e),()=>y().listeners.delete(e)}function Pe(){let e=y();e.records=[],e.byKey=new Map,e.byId=new Map,e.measuredCount=0,e.graphCount=null,D()}function k(e){if(e.kind!=="image"||!e.width||!e.height)return 0;let t=e.resolvedScale??ks(e.scales,Ft());return Math.round(e.width*t*e.height*t*4)}function je(e){let t=y(),a={image:{count:0,bytes:0},font:{count:0,bytes:0},video:{count:0,bytes:0},audio:{count:0,bytes:0},data:{count:0,bytes:0},other:{count:0,bytes:0}},s={total:e.length,loaded:0,neverLoaded:0,byKind:a,totalBytes:0,measuredCount:0,fontFamilies:t.fontFamilies.length};for(let n of e)n.loaded?s.loaded++:s.neverLoaded++,a[n.kind].count++,n.sizeBytes!=null&&n.sizeSource==="measured"&&(a[n.kind].bytes+=n.sizeBytes,s.totalBytes+=n.sizeBytes,s.measuredCount++);return s}p();import{buoyFetch as As,isBuoyElement as Et,isBuoyAssetPath as Ds}from"@buoy-gg/shared-ui/web";var Z=[],X=new Set;function Fs(e){if(!(typeof document>"u"))try{X.add(new URL(e,document.baseURI).href)}catch{}}function He(e=document){let t=Array.from(e.querySelectorAll("img"));for(let a of Array.from(e.querySelectorAll("*")))a.shadowRoot&&t.push(...He(a.shadowRoot));return t}function Lt(e){Z=e.filter(t=>!Ds(t.url)),typeof document<"u"&&ye()}function Tt(){return Z}async function Es(e){let t=await As(e);if(!t.ok)throw new Error(`Asset manifest returned HTTP ${t.status}.`);let a=await t.json();if(!Array.isArray(a)||a.some(s=>!s||typeof s.url!="string"))throw new Error("An asset manifest must contain an array of assets with URL strings.");Lt(a)}function fe(e,t){let a;try{a=new URL(e.url,document.baseURI)}catch{return}let s=a.pathname.split("/").pop()??"",n=s.includes(".")?s.split(".").pop().toLowerCase():"other",o=Is({key:a.href,name:s.slice(0,-(n.length+1))||s,type:n,origin:t?"browser":"graph",resolvedUri:a.href,resolvedScale:1,scales:[1],hash:e.hash,loaded:t,width:e.width,height:e.height});return o&&e.bytes!==void 0&&e.bytes>=0&&re(o.id,{sizeBytes:e.bytes,sizesByScale:{1:e.bytes},sizeSource:"measured"}),o}function Rt(e){if(!(e.initiatorType==="fetch"||e.initiatorType==="xmlhttprequest")){if(e.initiatorType==="img"){let t=He().filter(a=>(a.currentSrc||a.src)===e.name);t.length&&(t.every(Et)?X.add(e.name):X.delete(e.name))}X.has(e.name)||fe({url:e.name,bytes:e.encodedBodySize>0?e.encodedBodySize:void 0},true)}}function Mt(e){if(y().captureDisabled)return;let t=e.currentSrc||e.src;if(Et(e)){t&&X.add(t);return}X.delete(t),!(!t||!e.complete||e.naturalWidth<=0)&&fe({url:t,width:e.naturalWidth,height:e.naturalHeight},true)}function ye(){if(typeof document>"u"||y().captureDisabled)return;Z.forEach(t=>fe(t,false)),performance.getEntriesByType("resource").forEach(t=>Rt(t)),He().forEach(Mt);let e=y();e.graphSupported=Z.length>0,e.graphCount=Z.length>0?Z.length:null,e.measuredCount=e.records.filter(t=>t.sizeBytes!==void 0).length,e.lastScanAt=Date.now()}function Ls(e){if(typeof document>"u"||y().captureDisabled)return;let t=fe({url:e.url,bytes:e.bytes??void 0},e.status==="success");t&&re(t.id,{loadStatus:e.status,durationMs:e.durationMs,cacheHit:e.cacheHit})}p();function Ne(){if(typeof document>"u"||!document.fonts)return[];let e=new Set;return document.fonts.forEach(t=>{t.status==="loaded"&&e.add(t.family.replace(/^['"]|['"]$/g,""))}),[...e].sort()}function Ts(){return null}var ee,Ot=e=>{let t=e.target;t?.tagName==="IMG"&&Mt(t)};function me(){let e=y();if(!(typeof document>"u"||e.captureDisabled||e.installed)){if(e.installed=true,e.registryAvailable=true,document.addEventListener("load",Ot,true),typeof PerformanceObserver<"u"){ee=new PerformanceObserver(t=>{if(y().captureDisabled){Pt();return}t.getEntries().forEach(a=>Rt(a))});try{ee.observe({type:"resource",buffered:true}),e.patched=true}catch{ee.disconnect(),ee=void 0}}ye(),e.fontFamilies=Ne(),D()}}function Pt(){ee?.disconnect(),ee=void 0,typeof document<"u"&&document.removeEventListener("load",Ot,true),y().installed=false,y().patched=false}async function ge(){return me(),ye(),y().fontFamilies=Ne(),D(),te()}function te(){let e=y();return e.mirrorScanStatus??{registryAvailable:e.registryAvailable,patched:e.patched,registryCount:e.records.filter(t=>t.loaded).length,graphSupported:e.graphSupported,graphCount:e.graphCount,graphError:null,graphFetchInFlight:false,graphFetchStartedAt:null,lastScanAt:e.lastScanAt,measuring:false,measuredCount:e.measuredCount,fontFamilies:e.fontFamilies,localAssetCount:null,browser:true}}p();p();function I(e){return e==null||e<=0?"\u2014":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`}function be(e){let t=[...new Set(e)].sort((a,s)=>a-s);return t.length?t.length===1?`@${t[0]}x`:t.length<=3?t.map(a=>`@${a}x`).join(" "):`@${t[0]}x\u2013@${t[t.length-1]}x`:"\u2014"}function ve(e){return e.width==null||e.height==null?"\u2014":`${Math.round(e.width)}\xD7${Math.round(e.height)}`}function Rs(e,t){return e.sizeBytes!=null&&e.sizeSource==="measured"?I(e.sizeBytes):t>0?`~${I(t)}`:"\u2014"}var jt={image:"IMG",font:"FONT",video:"VID",audio:"AUD",data:"DATA",other:"MISC"},Ht={image:"#2DD4BF",font:"#C084FC",video:"#FF9F1C",audio:"#FF3366",data:"#00D4FF",other:"#8E8E93"};function Nt(e){let t=[`# Asset: ${e.name}.${e.type}`,"",`- Kind: ${e.kind}`,`- Status: ${e.loaded?"loaded at runtime":"not observed in the runtime registry"}`];e.kind==="image"&&t.push(`- Dimensions: ${ve(e)} (logical)`),e.scales.length&&t.push(`- Scales: ${be(e.scales)}`),e.sizeBytes!=null&&e.sizeSource==="measured"&&t.push(`- Size (all variants): ${I(e.sizeBytes)}`);let a=k(e);return a>0&&t.push(`- Decoded memory: ~${I(a)}`),e.hash&&t.push(`- Hash: ${e.hash}`),e.httpServerLocation&&t.push(`- Location: ${e.httpServerLocation}`),e.fileSystemLocation&&t.push(`- Source dir: ${e.fileSystemLocation}`),e.resolvedUri&&t.push(`- Resolved URI: ${e.resolvedUri}`),t.join(`
|
|
1
|
+
"use client";var $e=Object.defineProperty;var ba=Object.getOwnPropertyDescriptor;var va=Object.getOwnPropertyNames;var Sa=Object.prototype.hasOwnProperty;var ue=(e,t)=>()=>(e&&(t=e(e=0)),t);var wa=(e,t)=>{for(var a in t)$e(e,a,{get:t[a],enumerable:true})},Ie=(e,t,a,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of va(t))!Sa.call(e,n)&&n!==a&&$e(e,n,{get:()=>t[n],enumerable:!(s=ba(t,n))||s.enumerable});return e},xa=(e,t,a)=>(Ie(e,t,"default"),a&&Ie(a,t,"default"));var lt=e=>Ie($e({},"__esModule",{value:true}),e);var Ca,p=ue(()=>{"use strict";Ca=(()=>{try{let e=globalThis.Capacitor;if(e&&typeof e.isNativePlatform=="function"&&e.isNativePlatform())return e.DEBUG===true}catch{}return process.env.NODE_ENV!=="production"})();typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis)});var dt,ka=ue(()=>{"use strict";p();dt='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'});import{useEffect as za,useState as Ba}from"react";import{createPortal as $a}from"react-dom";import{jsx as Ia}from"react/jsx-runtime";function ut(){let e=document;if(e[Q])return e[Q].host;let t=document.createElement("div");t.dataset.buoyPortalHost="",Object.assign(t.style,{position:"fixed",inset:"0",zIndex:"2147483647",pointerEvents:"none",fontFamily:dt});let a=()=>{let r=document.fullscreenElement,c=r&&r.tagName!=="CANVAS"?r:document.body;t.parentElement!==c&&c.appendChild(t)},s=new Map,n=r=>{(!t.contains(r.target)||!Ae(r.target))&&s.set(r.code||r.key,{key:r.key,code:r.code,location:r.location,keyCode:r.keyCode,which:r.which,altKey:r.altKey,ctrlKey:r.ctrlKey,metaKey:r.metaKey,shiftKey:r.shiftKey})},o=r=>{s.delete(r.code||r.key)},i=()=>s.clear(),d=()=>{let r=[...s.values()];s.clear();for(let c of r)document.dispatchEvent(new KeyboardEvent("keyup",{...c,bubbles:true}))},l=r=>{Ae(r.target)&&r.stopPropagation()},u=r=>r.stopPropagation();return a(),document.addEventListener("fullscreenchange",a),document.addEventListener("keydown",n,true),document.addEventListener("keyup",o,true),window.addEventListener("blur",i),t.addEventListener("focusin",d),t.addEventListener("keydown",l),t.addEventListener("keyup",l),t.addEventListener("keypress",l),t.addEventListener("wheel",u,{passive:true}),e[Q]={host:t,users:0,dispose:()=>{document.removeEventListener("fullscreenchange",a),document.removeEventListener("keydown",n,true),document.removeEventListener("keyup",o,true),window.removeEventListener("blur",i),t.remove(),delete e[Q]}},t}function Aa({children:e}){let[t,a]=Ba(null);return za(()=>{let s=ut(),n=document[Q];return n.users++,a(s),()=>{--n.users===0&&n.dispose()}},[]),t?$a(Ia("div",{"data-buoy-root":"",style:{display:"contents",pointerEvents:"auto"},children:e}),t):null}var Q,Ae,Da=ue(()=>{"use strict";p();ka();Q=Symbol.for("@buoy-gg/portal-host"),Ae=e=>{if(!(e instanceof Element))return false;if(e.closest("input, textarea, select"))return true;let t=e.closest("[contenteditable]")?.getAttribute("contenteditable")?.toLowerCase();return t===""||t==="true"||t==="plaintext-only"}});var ce={};wa(ce,{AccessibilityInfo:()=>Ta,ActivityIndicator:()=>Re,Alert:()=>zt,Animated:()=>gt,AppRegistry:()=>Ma,AppState:()=>Oa,Appearance:()=>Ra,BackHandler:()=>Pa,Button:()=>Ct,CheckBox:()=>Xa,Clipboard:()=>ja,DeviceEventEmitter:()=>ps,Dimensions:()=>Ha,Easing:()=>Na,FlatList:()=>ct,I18nManager:()=>Va,Image:()=>ht,ImageBackground:()=>es,InteractionManager:()=>Ua,Keyboard:()=>Wa,KeyboardAvoidingView:()=>ts,LayoutAnimation:()=>Ka,Linking:()=>Ga,LogBox:()=>hs,Modal:()=>wt,NativeEventEmitter:()=>_a,NativeModules:()=>La,PanResponder:()=>qa,Picker:()=>as,PixelRatio:()=>Ja,Platform:()=>he,Pressable:()=>St,ProgressBar:()=>ss,RefreshControl:()=>ns,SafeAreaView:()=>os,ScrollView:()=>Le,SectionList:()=>rs,Share:()=>Ya,StatusBar:()=>is,StyleSheet:()=>M,Switch:()=>xt,Text:()=>b,TextInput:()=>Ee,Touchable:()=>ls,TouchableHighlight:()=>bt,TouchableNativeFeedback:()=>ds,TouchableOpacity:()=>W,TouchableWithoutFeedback:()=>vt,UIManager:()=>Qa,Vibration:()=>Za,View:()=>m,VirtualizedList:()=>us,YellowBox:()=>cs,findNodeHandle:()=>kt,unstable_createElement:()=>Ea,useColorScheme:()=>fs,useLocaleContext:()=>ys,useWindowDimensions:()=>ms});import*as Fa from"react-native-web";import{unstable_createElement as Ea,NativeModules as La,AccessibilityInfo as Ta,Appearance as Ra,AppRegistry as Ma,AppState as Oa,BackHandler as Pa,Clipboard as ja,Dimensions as Ha,Easing as Na,I18nManager as Va,Keyboard as Wa,InteractionManager as Ua,LayoutAnimation as Ka,Linking as Ga,NativeEventEmitter as _a,PanResponder as qa,PixelRatio as Ja,Platform as he,Share as Ya,UIManager as Qa,Vibration as Za,CheckBox as Xa,FlatList as ct,Image as ht,ImageBackground as es,KeyboardAvoidingView as ts,Picker as as,ProgressBar as ss,RefreshControl as ns,SafeAreaView as os,SectionList as rs,StatusBar as is,Touchable as ls,TouchableNativeFeedback as ds,VirtualizedList as us,YellowBox as cs,LogBox as hs,DeviceEventEmitter as ps,useColorScheme as fs,useLocaleContext as ys,useWindowDimensions as ms}from"react-native-web";import*as B from"react-native-web";import{createElement as De,forwardRef as pt,useCallback as gs,useRef as bs}from"react";function Fe(e){if(Array.isArray(e)){let c=e.map(Fe);return c.some((h,w)=>h!==e[w])?c:e}if(!e||typeof e!="object"||!yt.some(c=>e[c]!=null))return e;let{shadowColor:t,shadowOffset:a,shadowOpacity:s,shadowRadius:n,textShadowColor:o,textShadowOffset:i,textShadowRadius:d,...l}=e;if(t!=null||a!=null||s!=null||n!=null){let c=t??"black",h=s==null?c:`color-mix(in srgb, ${c} ${Math.min(s,1)*100}%, transparent)`,w=`${V(a?.width??0)} ${V(a?.height??0)} ${V(n??0)} ${h}`;l.boxShadow=typeof l.boxShadow=="string"?`${l.boxShadow}, ${w}`:l.boxShadow??w}let{width:u=0,height:r=0}=i??{};if(o&&(u||r||d)){let c=`${V(u)} ${V(r)} ${V(d??0)} ${o}`;l.textShadow=l.textShadow?`${l.textShadow}, ${c}`:c}return l}function ft(e,t){if(typeof e=="function")return s=>ft(e(s),t);let a=Fe(e);return t?[a,mt[t]]:a}function A(e){let t=pt((s,n)=>{let{accessibilityState:o,accessibilityValue:i,pointerEvents:d,...l}=s;for(let r of["busy","checked","disabled","expanded","selected"])o?.[r]!==void 0&&l[`aria-${r}`]===void 0&&(l[`aria-${r}`]=o[r]);for(let[r,c]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))i?.[r]!==void 0&&l[`aria-${c}`]===void 0&&(l[`aria-${c}`]=i[r]);let u=ft(l.style,d);return u!==l.style&&(l.style=u),De(e,{...l,ref:n})}),a=e.State;return a&&Object.assign(t,{State:a}),t.displayName=e.displayName??e.name??"NativeWebView",t}var N,yt,V,mt,M,m,b,gt,Ee,W,bt,vt,St,Le,Te,wt,xt,Re,Ct,kt,zt,T=ue(()=>{p();xa(ce,Fa);Da();N=B,yt=["shadowColor","shadowOffset","shadowOpacity","shadowRadius","textShadowColor","textShadowOffset","textShadowRadius"],V=e=>typeof e=="number"?`${e}px`:e;mt=N.StyleSheet.create({auto:{pointerEvents:"auto"},none:{pointerEvents:"none"},"box-none":{pointerEvents:"box-none"},"box-only":{pointerEvents:"box-only"}});M={...N.StyleSheet,create:e=>N.StyleSheet.create(Object.fromEntries(Object.entries(e).map(([t,a])=>[t,Fe(a)])))};m=A(B.View),b=A(B.Text),gt={...N.Animated,View:N.Animated.createAnimatedComponent(m),Text:N.Animated.createAnimatedComponent(b)},Ee=A(B.TextInput),W=A(B.TouchableOpacity),bt=A(B.TouchableHighlight),vt=A(B.TouchableWithoutFeedback),St=A(B.Pressable),Le=A(B.ScrollView),Te=pt((e,t)=>{let a=bs(null),s=gs(n=>{if(n){let o=n;for(;o.parentElement&&o.parentElement!==document.body;)o=o.parentElement;o.parentElement===document.body&&(a.current=o,Object.assign(o.style,{position:"relative",zIndex:"2147483647",pointerEvents:"auto"}),ut().appendChild(o))}else a.current&&(document.body.appendChild(a.current),a.current=null);typeof t=="function"?t(n):t&&(t.current=n)},[t]);return De(Aa,null,De(B.Modal,{...e,ref:s}))});Te.displayName="Modal";wt=A(Te),xt=A(B.Switch),Re=A(B.ActivityIndicator),Ct=A(B.Button),kt=B.findNodeHandle,zt={alert(e,t,a,s){if(typeof document>"u")return;let n=document.createElement("dialog");n.dataset.buoyRoot="",n.setAttribute("aria-label",e),n.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";let o=document.createElement("h2");if(o.textContent=e,o.style.cssText="font-size:18px;margin:0 0 12px",n.appendChild(o),t){let u=document.createElement("p");u.textContent=t,u.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",n.appendChild(u)}let i=document.createElement("div");i.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let d=a?.length?a:[{text:"OK"}],l=()=>{n.close?.(),n.remove()};for(let u of d){let r=document.createElement("button");r.type="button",r.textContent=u.text??"OK",r.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${u.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,r.onclick=()=>{l(),u.onPress?.()},i.appendChild(r)}n.addEventListener("cancel",u=>{u.preventDefault(),s?.cancelable!==false&&(l(),s?.onDismiss?.())}),n.appendChild(i),document.body.appendChild(n),n.showModal?n.showModal():n.setAttribute("open","")}}});p();p();p();import{AssetsIcon as Bt,ASSETS_ICON_COLOR as $t}from"@buoy-gg/shared-ui/web";p();T();import{useEffect as It,useState as oe}from"react";import{EventStepperFooter as vs,JsModal as Ss,macOSColors as ws,night as R,windowDragProps as xs,ToolEmptyState as Cs}from"@buoy-gg/shared-ui/web";p();p();var Me=Symbol.for("buoy.assets.globalState.v1");function y(){let e=globalThis;return e[Me]||(e[Me]={records:[],byKey:new Map,byId:new Map,nextId:1,listeners:new Set,snapshot:[],emitScheduled:false,installed:false,patched:false,registryAvailable:false,graphSupported:false,graphCount:null,graphError:null,graphFetchInFlight:false,lastScanAt:null,measuring:false,measuredCount:0,fontFamilies:[],localAssetCount:null,baseline:null,baselineLoaded:false,captureDisabled:false,remoteDispatch:null,mirrorScanStatus:null,mirrorPixelRatio:null,mirrorDiff:null}),e[Me]}p();p();import{isBuoyAssetPath as At}from"@buoy-gg/shared-ui/web";function Dt(e){return[e.key,e.resolvedUri,e.httpServerLocation,e.fileSystemLocation,...e.files??[]].some(At)}p();function Ft(){let e=y().mirrorPixelRatio;if(e!=null)return e;try{return(T(),lt(ce)).PixelRatio.get()}catch{return 2}}function ks(e,t){if(!e.length)return 1;let a=[...e].sort((s,n)=>s-n);for(let s of a)if(s>=t)return s;return a[a.length-1]}function zs(){let e=y();e.emitScheduled||(e.emitScheduled=true,requestAnimationFrame(()=>{e.emitScheduled=false;for(let t of e.listeners)t()}))}function D(){let e=y();e.snapshot=[...e.records],zs()}var Bs={png:"image",jpg:"image",jpeg:"image",gif:"image",webp:"image",bmp:"image",psd:"image",svg:"image",tiff:"image",ktx:"image",heic:"image",heif:"image",avif:"image",ttf:"font",otf:"font",woff:"font",woff2:"font",ttc:"font",mp4:"video",m4v:"video",mov:"video",mpeg:"video",mpg:"video",webm:"video",avi:"video",mp3:"audio",wav:"audio",aac:"audio",aiff:"audio",caf:"audio",m4a:"audio",ogg:"audio",json:"data",db:"data",yaml:"data",yml:"data",xml:"data",html:"data",pdf:"data",zip:"data"};function $s(e){return Bs[e.toLowerCase()]??"other"}function Is(e){if(Dt(e))return;let t=y(),a=t.byKey.get(e.key);return a||(a={id:t.nextId++,key:e.key,name:e.name,type:e.type,kind:$s(e.type),scales:e.scales??[],loaded:e.loaded??false,origin:e.origin,firstSeenAt:Date.now()},t.records.push(a),t.byKey.set(a.key,a),t.byId.set(a.id,a)),e.registryId!=null&&(a.registryId=e.registryId),e.hash!=null&&(a.hash=e.hash),e.httpServerLocation!=null&&(a.httpServerLocation=e.httpServerLocation),e.width!=null&&(a.width=e.width),e.height!=null&&(a.height=e.height),e.scales&&e.scales.length&&(a.scales=[...new Set(e.scales)].sort((s,n)=>s-n)),e.resolvedUri!=null&&(a.resolvedUri=e.resolvedUri),e.resolvedScale!=null&&(a.resolvedScale=e.resolvedScale),e.loaded&&(a.loaded=true),e.fileSystemLocation!=null&&(a.fileSystemLocation=e.fileSystemLocation),e.files&&(a.files=e.files),e.fileHashes&&(a.fileHashes=e.fileHashes),D(),a}function re(e,t){let a=y().byId.get(e);if(a)return Object.assign(a,t),D(),a}function Oe(e){return y().byId.get(e)}function F(){return y().snapshot}function pe(e){return y().listeners.add(e),()=>y().listeners.delete(e)}function Pe(){let e=y();e.records=[],e.byKey=new Map,e.byId=new Map,e.measuredCount=0,e.graphCount=null,D()}function k(e){if(e.kind!=="image"||!e.width||!e.height)return 0;let t=e.resolvedScale??ks(e.scales,Ft());return Math.round(e.width*t*e.height*t*4)}function je(e){let t=y(),a={image:{count:0,bytes:0},font:{count:0,bytes:0},video:{count:0,bytes:0},audio:{count:0,bytes:0},data:{count:0,bytes:0},other:{count:0,bytes:0}},s={total:e.length,loaded:0,neverLoaded:0,byKind:a,totalBytes:0,measuredCount:0,fontFamilies:t.fontFamilies.length};for(let n of e)n.loaded?s.loaded++:s.neverLoaded++,a[n.kind].count++,n.sizeBytes!=null&&n.sizeSource==="measured"&&(a[n.kind].bytes+=n.sizeBytes,s.totalBytes+=n.sizeBytes,s.measuredCount++);return s}p();import{buoyFetch as As,isBuoyElement as Et,isBuoyAssetPath as Ds}from"@buoy-gg/shared-ui/web";var Z=[],X=new Set;function Fs(e){if(!(typeof document>"u"))try{X.add(new URL(e,document.baseURI).href)}catch{}}function He(e=document){let t=Array.from(e.querySelectorAll("img"));for(let a of Array.from(e.querySelectorAll("*")))a.shadowRoot&&t.push(...He(a.shadowRoot));return t}function Lt(e){Z=e.filter(t=>!Ds(t.url)),typeof document<"u"&&ye()}function Tt(){return Z}async function Es(e){let t=await As(e);if(!t.ok)throw new Error(`Asset manifest returned HTTP ${t.status}.`);let a=await t.json();if(!Array.isArray(a)||a.some(s=>!s||typeof s.url!="string"))throw new Error("An asset manifest must contain an array of assets with URL strings.");Lt(a)}function fe(e,t){let a;try{a=new URL(e.url,document.baseURI)}catch{return}let s=a.pathname.split("/").pop()??"",n=s.includes(".")?s.split(".").pop().toLowerCase():"other",o=Is({key:a.href,name:s.slice(0,-(n.length+1))||s,type:n,origin:t?"browser":"graph",resolvedUri:a.href,resolvedScale:1,scales:[1],hash:e.hash,loaded:t,width:e.width,height:e.height});return o&&e.bytes!==void 0&&e.bytes>=0&&re(o.id,{sizeBytes:e.bytes,sizesByScale:{1:e.bytes},sizeSource:"measured"}),o}function Rt(e){if(!(e.initiatorType==="fetch"||e.initiatorType==="xmlhttprequest")){if(e.initiatorType==="img"){let t=He().filter(a=>(a.currentSrc||a.src)===e.name);t.length&&(t.every(Et)?X.add(e.name):X.delete(e.name))}X.has(e.name)||fe({url:e.name,bytes:e.encodedBodySize>0?e.encodedBodySize:void 0},true)}}function Mt(e){if(y().captureDisabled)return;let t=e.currentSrc||e.src;if(Et(e)){t&&X.add(t);return}X.delete(t),!(!t||!e.complete||e.naturalWidth<=0)&&fe({url:t,width:e.naturalWidth,height:e.naturalHeight},true)}function ye(){if(typeof document>"u"||y().captureDisabled)return;Z.forEach(t=>fe(t,false)),performance.getEntriesByType("resource").forEach(t=>Rt(t)),He().forEach(Mt);let e=y();e.graphSupported=Z.length>0,e.graphCount=Z.length>0?Z.length:null,e.measuredCount=e.records.filter(t=>t.sizeBytes!==void 0).length,e.lastScanAt=Date.now()}function Ls(e){if(typeof document>"u"||y().captureDisabled)return;let t=fe({url:e.url,bytes:e.bytes??void 0},e.status==="success");t&&re(t.id,{loadStatus:e.status,durationMs:e.durationMs,cacheHit:e.cacheHit})}p();function Ne(){if(typeof document>"u"||!document.fonts)return[];let e=new Set;return document.fonts.forEach(t=>{t.status==="loaded"&&e.add(t.family.replace(/^['"]|['"]$/g,""))}),[...e].sort()}function Ts(){return null}var ee,Ot=e=>{let t=e.target;t?.tagName==="IMG"&&Mt(t)};function me(){let e=y();if(!(typeof document>"u"||e.captureDisabled||e.installed)){if(e.installed=true,e.registryAvailable=true,document.addEventListener("load",Ot,true),typeof PerformanceObserver<"u"){ee=new PerformanceObserver(t=>{if(y().captureDisabled){Pt();return}t.getEntries().forEach(a=>Rt(a))});try{ee.observe({type:"resource",buffered:true}),e.patched=true}catch{ee.disconnect(),ee=void 0}}ye(),e.fontFamilies=Ne(),D()}}function Pt(){ee?.disconnect(),ee=void 0,typeof document<"u"&&document.removeEventListener("load",Ot,true),y().installed=false,y().patched=false}async function ge(){return me(),ye(),y().fontFamilies=Ne(),D(),te()}function te(){let e=y();return e.mirrorScanStatus??{registryAvailable:e.registryAvailable,patched:e.patched,registryCount:e.records.filter(t=>t.loaded).length,graphSupported:e.graphSupported,graphCount:e.graphCount,graphError:null,graphFetchInFlight:false,graphFetchStartedAt:null,lastScanAt:e.lastScanAt,measuring:false,measuredCount:e.measuredCount,fontFamilies:e.fontFamilies,localAssetCount:null,browser:true}}p();p();function I(e){return e==null||e<=0?"\u2014":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`}function be(e){let t=[...new Set(e)].sort((a,s)=>a-s);return t.length?t.length===1?`@${t[0]}x`:t.length<=3?t.map(a=>`@${a}x`).join(" "):`@${t[0]}x\u2013@${t[t.length-1]}x`:"\u2014"}function ve(e){return e.width==null||e.height==null?"\u2014":`${Math.round(e.width)}\xD7${Math.round(e.height)}`}function Rs(e,t){return e.sizeBytes!=null&&e.sizeSource==="measured"?I(e.sizeBytes):t>0?`~${I(t)}`:"\u2014"}var jt={image:"IMG",font:"FONT",video:"VID",audio:"AUD",data:"DATA",other:"MISC"},Ht={image:"#2DD4BF",font:"#C084FC",video:"#FF9F1C",audio:"#FF3366",data:"#00D4FF",other:"#8E8E93"};function Nt(e){let t=[`# Asset: ${e.name}.${e.type}`,"",`- Kind: ${e.kind}`,`- Status: ${e.loaded?"loaded at runtime":"not observed in the runtime registry"}`];e.kind==="image"&&t.push(`- Dimensions: ${ve(e)} (logical)`),e.scales.length&&t.push(`- Scales: ${be(e.scales)}`),e.sizeBytes!=null&&e.sizeSource==="measured"&&t.push(`- Size (all variants): ${I(e.sizeBytes)}`);let a=k(e);return a>0&&t.push(`- Decoded memory: ~${I(a)}`),e.hash&&t.push(`- Hash: ${e.hash}`),e.httpServerLocation&&t.push(`- Location: ${e.httpServerLocation}`),e.fileSystemLocation&&t.push(`- Source dir: ${e.fileSystemLocation}`),e.resolvedUri&&t.push(`- Resolved URI: ${e.resolvedUri}`),t.join(`
|
|
2
2
|
`)}function Vt(e,t,a,s,n){let o=["# Asset inventory","",`${t.total} assets \xB7 ${t.loaded} loaded \xB7 ${t.neverLoaded} not observed`+(t.totalBytes>0?` \xB7 ${I(t.totalBytes)} measured (${t.measuredCount}/${t.total})`:"")];if(s.fontFamilies.length&&o.push(`Fonts loaded: ${s.fontFamilies.join(", ")}`),s.graphSupported||o.push(s.graphError?`_Metro bundle graph unavailable (${s.graphError}) \u2014 runtime-registered assets only._`:"_No Metro bundle graph \u2014 runtime-registered assets only (release build)._"),n){let d=n.netBytes!=null?`${n.netBytes>=0?"+":"\u2212"}${I(Math.abs(n.netBytes))} net`:"net size unknown";o.push("",`## Since baseline (${new Date(n.baselineSavedAt).toISOString()})`,`- ${n.added.length} added \xB7 ${n.removed.length} removed \xB7 ${n.grown.length} grew \xB7 ${d}`);for(let l of n.removed.slice(0,20))o.push(`- removed: ${l.name}.${l.type}`)}let i=[];a.neverLoaded.length&&i.push(`- ${a.neverLoaded.length} shipped but not observed`),a.duplicates.length&&i.push(`- ${a.duplicates.length} duplicate content groups`),a.webpCandidates.length&&i.push(`- ${a.webpCandidates.length} WebP conversion candidates`),a.scaleGaps.length&&i.push(`- ${a.scaleGaps.length} scale-coverage gaps`),a.overDecode.length&&i.push(`- ${a.overDecode.length} images decoding larger than 2\xD7 the screen`),a.heavyGifs.length&&i.push(`- ${a.heavyGifs.length} heavy GIFs (convert to video/Lottie)`),a.heavyFonts.length&&i.push(`- ${a.heavyFonts.length} heavy fonts (subset candidates)`),a.scaleAnomalies.length&&i.push(`- ${a.scaleAnomalies.length} scale-variant anomalies (check exports)`),i.length&&o.push("","## Findings",...i),o.push("","## Assets (largest first)","","| Asset | Kind | Dimensions | Scales | Size | Loaded |","| --- | --- | --- | --- | --- | --- |");for(let d of e){let l=d.sizeBytes!=null&&d.sizeSource==="measured"?I(d.sizeBytes):k(d)>0?`~${I(k(d))}`:"\u2014";o.push(`| ${d.name}.${d.type} | ${d.kind} | ${d.kind==="image"?ve(d):"\u2014"} | ${be(d.scales)} | ${l} | ${d.loaded?"yes":"NO"} |`)}return o.join(`
|
|
3
|
-
`)}p();import{useMemo as Ms,useSyncExternalStore as Os}from"react";p();var Ps=50*1024,js=100*1024,Hs=150*1024,Ns=2,Vs=.9,Ws=4*1024;function Us(){try{let{Dimensions:e,PixelRatio:t}=(T(),lt(ue)),a=e.get("screen"),s=t.get();return a.width*s*a.height*s}catch{return 1170*2532}}function Ks(e){let t=e.sizesByScale;if(!t)return false;let a=Object.entries(t).map(([s,n])=>({scale:Number(s),bytes:n})).filter(s=>Number.isFinite(s.scale)&&s.bytes>0).sort((s,n)=>s.scale-n.scale);for(let s=1;s<a.length;s++)if(a[s-1].bytes>=Ws&&a[s].bytes<a[s-1].bytes*Vs)return true;return false}function Ve(e){let t=Ft(),a=new Map;for(let h of e){if(!h.hash)continue;let w=a.get(h.hash);w?w.push(h):a.set(h.hash,[h])}let s=[];for(let[h,w]of a){if(w.length<2)continue;let q=w.find(z=>z.sizeBytes!=null);s.push({hash:h,ids:w.map(z=>z.id),wastedBytes:q?.sizeBytes!=null?q.sizeBytes*(w.length-1):null})}let n=Us(),o=[],i=[],d=[],l=[],c=[],r=[],u=[];for(let h of e)h.loaded||d.push(h.id),h.kind==="image"&&h.scales.length>1&&!h.scales.some(w=>w>=t)&&o.push(h.id),(h.type==="png"||h.type==="jpg"||h.type==="jpeg")&&h.sizeBytes!=null&&h.sizeBytes>=Ps&&i.push(h.id),h.kind==="image"&&k(h)/4>n*Ns&&l.push(h.id),h.type==="gif"&&(h.sizeBytes??0)>=js&&c.push(h.id),h.kind==="font"&&(h.sizeBytes??0)>=Hs&&r.push(h.id),Ks(h)&&u.push(h.id);return{duplicates:s,scaleGaps:o,webpCandidates:i,neverLoaded:d,overDecode:l,heavyGifs:c,heavyFonts:r,scaleAnomalies:u}}function Wt(){let e=Os(pe,F,F);return Ms(()=>({records:e,stats:je(e),insights:Ve(e)}),[e])}p();import{useSyncExternalStore as Gs}from"react";var Ut,Kt;function Gt(){let e=F();return e!==Ut&&(Ut=e,Kt=te()),Kt}function _s(){return Gs(pe,Gt,Gt)}p();function qs(e){y().remoteDispatch=e}function Se(){return y().remoteDispatch}function Js(){y().captureDisabled=true}function Ys(e){let t=y(),a=e.records??[];t.records=a.map(s=>({id:s.id,key:s.key,loadStatus:s.loadStatus,durationMs:s.durationMs,cacheHit:s.cacheHit,registryId:s.registryId??void 0,name:s.name,type:s.type,kind:s.kind,hash:s.hash??void 0,httpServerLocation:s.location??void 0,width:s.width??void 0,height:s.height??void 0,scales:s.scales,resolvedUri:s.uri??void 0,loaded:s.loaded,origin:s.registryId!=null?"registry":"graph",sizeBytes:s.sizeBytes??void 0,sizeSource:s.sizeSource??void 0,firstSeenAt:Date.now()})).filter(s=>!Dt(s)),t.byKey=new Map(t.records.map(s=>[s.key,s])),t.byId=new Map(t.records.map(s=>[s.id,s])),e.scanStatus&&(t.fontFamilies=[...new Set(e.scanStatus.fontFamilies??[])],t.mirrorScanStatus={...e.scanStatus,fontFamilies:t.fontFamilies}),t.mirrorDiff=e.diff??null,D()}p();import{persistentStorage as We}from"@buoy-gg/shared-ui/web";var Ue="@react_buoy/assets/baseline",Qs=1024;async function _t(){let e=y();if(e.baselineLoaded)return e.baseline;e.baselineLoaded=true;try{let t=await We.getItem(Ue);if(t){let a=JSON.parse(t);a&&typeof a.savedAt=="number"&&a.entries&&(e.baseline=a,D())}}catch{}return e.baseline}async function qt(){let e=Se();if(e)return await e("saveBaseline"),y().baseline??{savedAt:Date.now(),entries:{}};let t=y(),a={};for(let n of F())a[n.key]={hash:n.hash??null,sizeBytes:n.sizeSource==="measured"?n.sizeBytes??null:null,name:n.name,type:n.type};let s={savedAt:Date.now(),entries:a};t.baseline=s,t.baselineLoaded=true,D();try{await We.setItem(Ue,JSON.stringify(s))}catch{}return s}async function Jt(){let e=Se();if(e){await e("clearBaseline");return}let t=y();t.baseline=null,t.baselineLoaded=true,D();try{await We.removeItem(Ue)}catch{}}function Yt(e,t){let a=[],s=[],n=new Set,o=0,i=0,d=false;for(let c of e){n.add(c.key);let r=t.entries[c.key];if(!r){a.push(c.id);continue}let u=c.sizeSource==="measured"?c.sizeBytes??null:null;u!=null&&r.sizeBytes!=null&&(d=true,o+=u,i+=r.sizeBytes,u-r.sizeBytes>=Qs&&s.push({id:c.id,deltaBytes:u-r.sizeBytes}))}let l=[];for(let[c,r]of Object.entries(t.entries))At(c)||n.has(c)||(l.push({key:c,name:r.name,type:r.type}),r.sizeBytes!=null&&(d=true,i+=r.sizeBytes));for(let c of a){let r=e.find(u=>u.id===c);r?.sizeSource==="measured"&&r.sizeBytes!=null&&(d=true,o+=r.sizeBytes)}return{baselineSavedAt:t.savedAt,added:a,removed:l,grown:s.sort((c,r)=>r.deltaBytes-c.deltaBytes),netBytes:d?o-i:null}}function we(){let e=y();return e.mirrorDiff?e.mirrorDiff:e.baseline?Yt(F(),e.baseline):null}p();T();import{night as U}from"@buoy-gg/shared-ui/web";p();T();import{useState as Zs}from"react";import{night as Xs}from"@buoy-gg/shared-ui/web";p();T();import{buoyFetch as Qt}from"@buoy-gg/shared-ui/web";p();function Zt(){return null}async function en(){ye();let e=Tt().length;return e?{ok:true,count:e}:{ok:false,message:"Register a browser asset manifest to inspect files that have not loaded yet."}}var tn=4;function an(e){if(e.resolvedUri)return e.resolvedUri;let t=Xt(e);return t.length?t[0].url:null}function sn(e){let t=y().captureDisabled;if(!t&&e.registryId!=null)return e.registryId;let a=an(e);return!a||t&&!/^https?:\/\//.test(a)?null:{uri:a}}function Xt(e){let t=e.scales.length?e.scales:[1],a=e.resolvedUri;if(a&&/^https?:\/\//.test(a)&&e.resolvedScale!=null){let n=e.resolvedScale===1?"":`@${e.resolvedScale}x`,o=`${n}.${e.type}`;if(a.includes(o)||n==="")return t.map(i=>{let d=i===1?"":`@${i}x`,l=(n===""?a.replace(`.${e.type}`,`${d}.${e.type}`):a.replace(o,`${d}.${e.type}`)).replace(/ /g,"%20");return{scale:i,url:l}})}let s=Zt();return!s||!e.httpServerLocation?[]:t.map(n=>{let o=n===1?"":`@${n}x`,i=`${e.httpServerLocation}/${e.name}${o}.${e.type}`,d=i.includes("?")?"&":"?",l=`${s}${i}${d}platform=${nn()}${e.hash?`&hash=${e.hash}`:""}`.replace(/ /g,"%20");return{scale:n,url:l}})}function nn(){try{return he.OS}catch{return"ios"}}async function on(e){try{let t=await Qt(e,{method:"HEAD"});if(t.ok){let a=Number(t.headers.get("content-length"));if(Number.isFinite(a)&&a>0)return a}}catch{}try{let t=await Qt(e);if(!t.ok)return null;let a=await t.blob();return a.size>0?a.size:null}catch{return null}}async function rn(e){let t=Xt(e);if(!t.length){re(e.id,{sizeSource:"estimate"});return}let a={},s=0;for(let{scale:n,url:o}of t){let i=await on(o);i!=null&&(a[String(n)]=i,s+=i)}s>0?re(e.id,{sizesByScale:a,sizeBytes:s,sizeSource:"measured"}):re(e.id,{sizeSource:"estimate"})}async function ea(){let e=y();if(e.measuring)return{measured:e.measuredCount,total:F().length};let t=F().filter(a=>a.sizeSource!=="measured");e.measuring=true,D();try{let a=0,s=async()=>{for(;;){let n=t[a++];if(!n)return;await rn(n),e.measuredCount=F().filter(o=>o.sizeSource==="measured").length}};await Promise.all(Array.from({length:Math.min(tn,t.length)},s))}finally{e.measuring=false,D()}return{measured:e.measuredCount,total:F().length}}p();function ln(e){e&&typeof e=="object"&&Fs(e.uri)}p();function dn(){return null}import{jsx as xe}from"react/jsx-runtime";function ta({record:e,style:t,testID:a,compact:s=false}){let n=sn(e);ln(n);let o=e.type.toLowerCase()==="svg",i=o&&he.OS!=="web"?dn():null,d=`${e.key}:${e.hash??""}:${typeof n=="number"?n:n?.uri??""}`,[l,c]=Zs(null);if(n==null||l===d||o&&he.OS!=="web"&&!i){let u=o?"SVG preview unavailable":"Image preview unavailable";return xe(m,{style:[t,aa.fallback],accessibilityLabel:u,testID:`${a}-unavailable`,children:xe(b,{style:aa.text,children:s?o?"SVG":"IMG":u})})}let r=()=>c(d);return i?xe(i,{source:n,style:t,contentFit:"contain",onError:r,testID:a}):xe(ht,{source:n,style:t,resizeMode:"contain",onError:r,testID:a})}var aa=M.create({fallback:{alignItems:"center",justifyContent:"center"},text:{color:Xs.color.textSecondary,fontSize:10,textAlign:"center"}});p();function ae(e){return String(e).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"unknown"}function ie(e,t){return`buoy-assets-row-${ae(`${e}.${t}`)}`}function sa(e,t,a){return`${ie(e,t)}-badge-${ae(a)}`}function Ke(e){return`buoy-assets-filter-${ae(e)}`}function na(e){return`buoy-assets-detail-row-${ae(e)}`}function oa(e){return`buoy-assets-font-${ae(e)}`}var v={title:"buoy-assets-title",copy:"buoy-assets-copy",clear:"buoy-assets-clear",list:"buoy-assets-list",search:"buoy-assets-search",sort:"buoy-assets-sort",filterBar:"buoy-assets-filter-bar",notice:"buoy-assets-notice",noticeText:"buoy-assets-notice-text",discoverySpinner:"buoy-assets-discovery-spinner",retry:"buoy-assets-retry",fonts:"buoy-assets-fonts",fontsTitle:"buoy-assets-fonts-title",empty:"buoy-assets-empty",emptyTitle:"buoy-assets-empty-title",emptyText:"buoy-assets-empty-text",detail:"buoy-assets-detail",detailScroll:"buoy-assets-detail-scroll",detailPreview:"buoy-assets-detail-preview",detailFontPreview:"buoy-assets-detail-font-preview",detailFindings:"buoy-assets-detail-findings"};function ra(e){return`buoy-assets-detail-finding-${e}`}import{Fragment as cn,jsx as g,jsxs as Ge}from"react/jsx-runtime";function x({label:e,value:t}){let a=na(e);return Ge(m,{style:E.kvRow,testID:a,children:[g(b,{style:E.kvLabel,children:e}),g(b,{style:E.kvValue,selectable:true,testID:`${a}-value`,children:t})]})}function un({record:e}){return e.kind==="image"?g(m,{style:E.previewBox,testID:v.detailPreview,children:g(ta,{testID:"buoy-internal-assets-preview",record:e,style:E.previewImage})}):e.kind==="font"?g(m,{style:E.previewBox,testID:v.detailFontPreview,children:g(b,{style:[E.fontPreview,{fontFamily:e.name}],children:"The quick brown fox jumps over the lazy dog 0123456789"})}):null}function hn({record:e,insights:t}){let a=[];t.neverLoaded.includes(e.id)&&a.push("Not observed in the runtime registry this app run. This does not prove the asset is unused."),t.scaleGaps.includes(e.id)&&a.push("Scale gap \u2014 no variant covers this device's pixel ratio"),t.webpCandidates.includes(e.id)&&a.push("WebP candidate \u2014 large png/jpeg, converting typically saves 20\u201340%");let s=t.duplicates.find(o=>o.ids.includes(e.id));s&&a.push(`Duplicate content \u2014 identical bytes shipped ${s.ids.length} times`),t.overDecode.includes(e.id)&&a.push("Decodes larger than 2\xD7 this entire screen \u2014 resize the source, no view can need this many pixels"),t.heavyGifs.includes(e.id)&&a.push("Heavy GIF \u2014 every frame decodes into memory; a video or Lottie is typically ~90% smaller"),t.heavyFonts.includes(e.id)&&a.push("Heavy font \u2014 likely an unsubset icon font; subsetting to used glyphs usually saves most of it"),t.scaleAnomalies.includes(e.id)&&a.push("Scale anomaly \u2014 a higher-resolution variant is smaller in bytes than a lower one; check the exports");let n=k(e);return Ge(Le,{style:E.scroll,contentContainerStyle:E.content,testID:v.detailScroll,children:[g(un,{record:e}),a.length>0?g(m,{style:E.findings,testID:v.detailFindings,children:a.map((o,i)=>g(b,{style:E.findingText,testID:ra(i),children:o},o))}):null,g(x,{label:"Name",value:`${e.name}.${e.type}`}),e.loadStatus&&Ge(cn,{children:[g(x,{label:"Load",value:e.loadStatus==="error"?"Failed":"Loaded"}),g(x,{label:"Load time",value:e.durationMs==null?"Unknown":`${e.durationMs.toFixed(1)} ms`}),g(x,{label:"Load size",value:e.sizeBytes==null?"Unknown":I(e.sizeBytes)}),g(x,{label:"Cache",value:e.cacheHit==null?"Unknown":e.cacheHit?"Cache hit":"Web load"})]}),g(x,{label:"Kind",value:e.kind}),g(x,{label:"Status",value:e.loaded?"Loaded (registered at runtime)":"Not observed in the runtime registry"}),e.kind==="image"?g(x,{label:"Dimensions",value:`${ve(e)} (logical)`}):null,e.kind==="image"&&e.scales.length?g(x,{label:"Scales",value:be(e.scales)}):null,e.sizesByScale?Object.entries(e.sizesByScale).map(([o,i])=>g(x,{label:`Size @${o}x`,value:I(i)},o)):null,e.sizeBytes!=null&&e.sizeSource==="measured"?g(x,{label:"Total size",value:I(e.sizeBytes)}):null,n>0?g(x,{label:"Decoded memory",value:`~${I(n)} (RGBA)`}):null,e.registryId!=null?g(x,{label:"Registry id",value:String(e.registryId)}):null,e.hash?g(x,{label:"Hash",value:e.hash}):null,e.httpServerLocation?g(x,{label:"Location",value:e.httpServerLocation}):null,e.fileSystemLocation?g(x,{label:"Source dir",value:e.fileSystemLocation}):null,e.resolvedUri?g(x,{label:"Resolved URI",value:e.resolvedUri}):null]})}var E=M.create({scroll:{flex:1},content:{padding:12,gap:8},previewBox:{borderRadius:8,backgroundColor:U.color.bg,padding:12,alignItems:"center",justifyContent:"center",minHeight:96},previewImage:{width:"100%",height:140},fontPreview:{color:U.color.text,fontSize:16,textAlign:"center"},findings:{borderRadius:8,borderWidth:1,borderColor:U.color.border,backgroundColor:U.color.surface,padding:10,gap:6},findingText:{color:U.color.textSecondary,fontSize:11,lineHeight:15},kvRow:{gap:2},kvLabel:{color:U.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,textTransform:"uppercase"},kvValue:{color:U.color.text,fontSize:12}});p();T();import{macOSColors as _e,night as K,Pill as pn}from"@buoy-gg/shared-ui/web";import{jsx as L,jsxs as G}from"react/jsx-runtime";function fn({label:e,color:t,testID:a}){return L(pn,{label:e,color:t,variant:"quiet",dot:!!t,style:{paddingVertical:2.5},testID:a})}function yn({record:e,flags:t,sizeFraction:a,onPress:s}){let n=Ht[e.kind],o=[];return e.loaded||o.push({label:"NOT OBSERVED"}),t.oversize&&o.push({label:"OVERSIZE",color:_e.semantic.error}),t.duplicate&&o.push({label:"DUP"}),t.heavy&&o.push({label:"HEAVY"}),t.scaleAnomaly?o.push({label:"BAD SCALE",color:_e.semantic.error}):t.scaleGap&&o.push({label:"LOW-RES"}),t.webp&&o.push({label:"WEBP",color:_e.semantic.info}),G(W,{style:C.card,testID:ie(e.name,e.type),onPress:()=>s(e.id),activeOpacity:.7,children:[G(m,{style:C.body,children:[L(m,{style:C.thumbBox,children:e.kind==="image"?L(ta,{testID:"buoy-internal-assets-thumb",record:e,style:C.thumb,compact:true}):L(b,{style:[C.thumbFallback,{color:n}],children:jt[e.kind]})}),G(m,{style:C.main,children:[G(b,{style:C.name,numberOfLines:1,testID:`${ie(e.name,e.type)}-name`,children:[e.name,G(b,{style:C.ext,children:[".",e.type]})]}),G(m,{style:C.metaRow,children:[e.kind==="image"&&e.width!=null?L(b,{style:C.meta,children:ve(e)}):null,e.kind==="image"&&e.scales.length?L(b,{style:C.meta,children:be(e.scales)}):null]})]}),G(m,{style:C.right,children:[L(b,{style:C.size,testID:`${ie(e.name,e.type)}-size`,children:Rs(e,k(e))}),o.length?L(m,{style:C.badgeRow,children:o.slice(0,3).map(i=>L(fn,{label:i.label,color:i.color,testID:sa(e.name,e.type,i.label)},i.label))}):null]})]}),a>0?L(m,{style:C.sizeTrack,children:L(m,{style:[C.sizeFill,{backgroundColor:n,width:`${Math.max(2,Math.round(a*100))}%`}]})}):null]})}var C=M.create({card:{marginHorizontal:10,marginTop:6,borderRadius:10,backgroundColor:K.color.surface,borderWidth:1,borderColor:K.color.border,overflow:"hidden"},body:{flexDirection:"row",alignItems:"center",paddingVertical:8,paddingHorizontal:12,gap:10},thumbBox:{width:40,height:40,borderRadius:8,backgroundColor:"rgba(255,255,255,0.10)",borderWidth:1,borderColor:K.color.border,alignItems:"center",justifyContent:"center",overflow:"hidden"},thumb:{width:34,height:34},thumbFallback:{fontSize:9,fontWeight:"700",letterSpacing:.5},main:{flex:1,gap:3},name:{color:K.color.text,fontSize:12,fontWeight:"600"},ext:{color:K.color.textTertiary,fontWeight:"400"},metaRow:{flexDirection:"row",alignItems:"center",gap:8},meta:{color:K.color.textSecondary,fontSize:10,fontVariant:["tabular-nums"]},right:{alignItems:"flex-end",gap:4},size:{color:K.color.text,fontSize:12,fontWeight:"700",fontVariant:["tabular-nums"]},badgeRow:{flexDirection:"row",gap:4},sizeTrack:{height:2,backgroundColor:"transparent"},sizeFill:{height:2,opacity:.45,borderTopRightRadius:2}});p();T();import{night as Ce}from"@buoy-gg/shared-ui/web";import{jsx as qe}from"react/jsx-runtime";function mn({stats:e,duplicateCount:t,filter:a,onChange:s}){let n=[{key:"all",label:`ALL ${e.total}`,accent:Ce.color.textSecondary},{key:"duplicates",label:`DUPLICATES ${t}`,accent:"#FF9F1C"}];for(let o of Object.keys(e.byKind)){let i=e.byKind[o];i.count>0&&n.push({key:o,label:`${jt[o]} ${i.count}`,accent:Ht[o]})}return e.neverLoaded>0&&n.push({key:"unused",label:`NOT OBSERVED ${e.neverLoaded}`,accent:"#FF9F1C"}),n.length<=1?null:qe(m,{style:Je.bar,testID:v.filterBar,children:n.map(o=>{let i=o.key===a;return qe(W,{accessibilityRole:"button",accessibilityState:{selected:i},testID:Ke(o.key),style:[Je.chip,i&&{borderColor:o.accent,backgroundColor:`${o.accent}1A`}],onPress:()=>s(i?"all":o.key),children:qe(b,{testID:`${Ke(o.key)}-label`,style:[Je.chipText,{color:i?o.accent:Ce.color.textSecondary}],children:o.label})},o.key)})})}var Je=M.create({bar:{flexDirection:"row",flexWrap:"wrap",gap:6,paddingHorizontal:10,paddingVertical:8},chip:{borderWidth:1,borderColor:Ce.color.border,backgroundColor:Ce.color.surface,borderRadius:999,paddingHorizontal:10,paddingVertical:5},chipText:{fontSize:10,fontWeight:"700",letterSpacing:.4,lineHeight:13}});p();import{ModalHeader as P,ToolbarClearButton as gn,ToolbarCopyButton as ia}from"@buoy-gg/shared-ui/web";import{jsx as j,jsxs as Ye}from"react/jsx-runtime";function bn({stats:e,measuring:t,discovering:a=false,detailOpen:s,detailIndex:n=-1,detailTotal:o=0,onCloseDetail:i,onClear:d,getReport:l,onBack:c}){if(s){let u=n>=0&&o>0?`${n+1} of ${o}`:void 0;return Ye(P,{children:[j(P.Navigation,{onBack:i}),j(P.Content,{title:"Asset detail",subtitle:u,testID:v.title}),j(P.Actions,{children:j(ia,{value:l,testID:v.copy})})]})}let r=[`${e.total} assets${a?" so far":""}`];if(e.totalBytes>0&&!t&&!a){let u=e.measuredCount<e.total?"+":"";r.push(`${I(e.totalBytes)}${u}`)}return e.neverLoaded>0&&r.push(`${e.neverLoaded} not observed`),e.fontFamilies>0&&r.push(`${e.fontFamilies} fonts`),Ye(P,{children:[c?j(P.Navigation,{onBack:c}):null,j(P.Content,{title:"Assets",subtitle:r.join(" \xB7 "),testID:v.title}),Ye(P.Actions,{children:[j(ia,{value:l,testID:v.copy}),j(gn,{onPress:d,testID:v.clear})]})]})}p();T();import{night as _}from"@buoy-gg/shared-ui/web";import{jsx as la,jsxs as da}from"react/jsx-runtime";var vn={size:"name",name:"type",type:"size"};function Sn({query:e,onQueryChange:t,sort:a,onSortChange:s}){return da(m,{style:ke.row,children:[la(Ee,{style:ke.input,value:e,onChangeText:t,placeholder:"Search assets\u2026",placeholderTextColor:_.color.placeholder,autoCapitalize:"none",autoCorrect:false,testID:v.search}),la(W,{style:ke.button,onPress:()=>s(vn[a]),testID:v.sort,children:da(b,{style:ke.buttonText,testID:`${v.sort}-label`,children:["\u2193 ",a.toUpperCase()]})})]})}var ke=M.create({row:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:10,paddingBottom:8},input:{flex:1,backgroundColor:_.color.surfaceElevated,borderWidth:1,borderColor:_.color.border,borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:_.color.text,fontSize:12},button:{backgroundColor:_.color.surface,borderWidth:1,borderColor:_.color.border,borderRadius:8,paddingHorizontal:10,paddingVertical:7},buttonText:{color:_.color.textSecondary,fontSize:10,fontWeight:"700",letterSpacing:.5}});p();T();import{useEffect as wn,useState as xn}from"react";import{night as le}from"@buoy-gg/shared-ui/web";import{jsx as ze,jsxs as Cn}from"react/jsx-runtime";function kn({status:e,total:t,onRetry:a}){let[s,n]=xn(false);wn(()=>{if(n(false),!e.graphFetchInFlight)return;let d=e.graphFetchStartedAt==null?0:Math.max(0,Date.now()-e.graphFetchStartedAt),l=setTimeout(()=>n(true),Math.max(0,8e3-d));return()=>clearTimeout(l)},[e.graphFetchInFlight,e.graphFetchStartedAt]);let o=[];e.browser&&!e.graphSupported&&o.push("Showing resources this page has loaded. Add an asset manifest to include files the page has not requested."),e.graphFetchInFlight&&(o.push(`Finding assets\u2026 ${t} found so far.`),s&&o.push("Still finding assets. This is taking longer than usual.")),e.registryAvailable||o.push("The asset registry is unavailable in this environment."),!e.graphFetchInFlight&&!e.graphSupported&&e.graphError&&o.push("Showing runtime-registered assets only. A development server is needed to find more assets and measure their sizes.");let i=!e.graphFetchInFlight&&e.graphSupported&&!!e.graphError;return i&&o.push(`Couldn't finish finding assets. Showing ${t} assets found so far.`),e.measuring&&!e.graphFetchInFlight&&o.push("Checking asset sizes\u2026"),o.length===0?null:Cn(m,{style:Qe.notice,testID:v.notice,children:[e.graphFetchInFlight?ze(Re,{size:"small",color:le.color.textSecondary,accessibilityLabel:"Finding assets",testID:v.discoverySpinner}):null,o.map(d=>ze(b,{style:Qe.noticeText,testID:v.noticeText,children:d},d)),i?ze(W,{accessibilityRole:"button",onPress:a,testID:v.retry,children:ze(b,{style:Qe.retryText,children:"Retry"})}):null]})}var Qe=M.create({notice:{marginHorizontal:10,marginBottom:8,padding:10,borderRadius:8,borderWidth:1,borderColor:le.color.border,backgroundColor:le.color.surface,gap:4},noticeText:{color:le.color.textSecondary,fontSize:11},retryText:{color:le.color.text,fontSize:12,paddingVertical:6}});import{jsx as S,jsxs as se}from"react/jsx-runtime";function zn({names:e}){let t=[...new Set(e)];return t.length?se(m,{style:$.fontsBox,testID:v.fonts,children:[se(b,{style:$.fontsTitle,testID:v.fontsTitle,children:["LOADED FONT FAMILIES (",t.length,")"]}),S(m,{style:$.fontsWrap,children:t.map(a=>S(b,{style:$.fontChip,testID:oa(a),children:a},a))})]}):null}function Bn({duplicates:e=false}){return S(Cs,{testID:v.empty,otto:"scanning",title:e?"No duplicates found":"No assets found yet",message:e?"No assets in this view share a content hash.":"Every bundled asset \u2014 images, fonts, video, audio \u2014 appears here with sizes, scale coverage, and runtime registration status. Try Rescan after navigating around the app."})}function ca(e,t){return(t.sizeBytes??k(t))-(e.sizeBytes??k(e))}var $n={size:ca,name:(e,t)=>e.name.localeCompare(t.name)||e.type.localeCompare(t.type),type:(e,t)=>e.type.localeCompare(t.type)||ca(e,t)};function Ze({visible:e,onClose:t,onBack:a,onMinimize:s,persistenceKey:n,inline:o=false}){me();let{records:i,stats:d,insights:l}=Wt(),c=_s(),[r,u]=oe(false);It(()=>{u(false)},[c.graphFetchInFlight,c.lastScanAt]);let h=()=>{u(false);let f=Se();f?f("rescan").catch(()=>u(true)):ge()},[w,q]=oe(null),[z,ya]=oe("all"),[et,tt]=oe(""),[at,ma]=oe("size"),H=w!=null?Oe(w):void 0;It(()=>{if(!e)return;_t(),u(false);let f=Se();f?f("rescan").catch(()=>u(true)):ge()},[e]);let Be=new Set(l.duplicates.flatMap(f=>f.ids)),st=[...i].sort($n[at]),nt=et.trim().toLowerCase(),J=st.filter(f=>!(z==="unused"&&f.loaded||z==="duplicates"&&!Be.has(f.id)||z!=="all"&&z!=="unused"&&z!=="duplicates"&&f.kind!==z||nt&&!`${f.name}.${f.type}`.toLowerCase().includes(nt))),ne=H?J.findIndex(f=>f.id===H.id):-1,ot=f=>{let O=J[f];O&&q(O.id)},Y={scaleGaps:new Set(l.scaleGaps),scaleAnomalies:new Set(l.scaleAnomalies),duplicates:Be,webpCandidates:new Set(l.webpCandidates),overDecode:new Set(l.overDecode),heavy:new Set([...l.heavyGifs,...l.heavyFonts])},de=0;for(let f of J){let O=f.sizeBytes??k(f);O>de&&(de=O)}let ga=()=>H?Nt(H):Vt(st,d,l,te(),we()),rt=S(bn,{stats:d,measuring:c.measuring,discovering:c.graphFetchInFlight,detailOpen:H!=null,detailIndex:ne,detailTotal:J.length,onCloseDetail:()=>q(null),onClear:Pe,getReport:ga,onBack:a}),it=H?se(m,{style:$.detailContainer,children:[S(hn,{record:H,insights:l}),ne>=0?S(vs,{currentIndex:ne,totalItems:J.length,itemLabel:"Asset",onPrevious:()=>ot(ne-1),onNext:()=>ot(ne+1)}):null]}):se(m,{style:$.listContainer,children:[S(mn,{stats:d,duplicateCount:Be.size,filter:z,onChange:f=>{ya(f),f==="duplicates"&&tt("")}}),S(Sn,{query:et,onQueryChange:tt,sort:at,onSortChange:ma}),S(kn,{status:c,total:d.total,onRetry:h}),r&&!c.graphFetchInFlight?se(m,{style:$.notice,children:[S(b,{style:$.noticeText,children:"Couldn't request an asset scan from the device."}),S(W,{accessibilityRole:"button",onPress:h,children:S(b,{style:$.retryText,children:"Retry"})})]}):null,z==="unused"?S(m,{style:$.notice,children:S(b,{style:$.noticeText,children:"Not seen in React Native's asset registry this app run. Assets loaded through other paths may appear here; this does not prove they are unused."})}):null,z==="font"?S(zn,{names:c.fontFamilies}):null,S(ut,{testID:v.list,data:J,keyExtractor:f=>String(f.id),contentContainerStyle:$.listContent,renderItem:({item:f})=>S(yn,{record:f,flags:{scaleGap:Y.scaleGaps.has(f.id),scaleAnomaly:Y.scaleAnomalies.has(f.id),duplicate:Y.duplicates.has(f.id),webp:Y.webpCandidates.has(f.id),oversize:Y.overDecode.has(f.id),heavy:Y.heavy.has(f.id)},sizeFraction:de>0?(f.sizeBytes??k(f))/de:0,onPress:O=>q(typeof O=="number"?O:null)}),ListEmptyComponent:c.graphFetchInFlight?null:S(Bn,{duplicates:z==="duplicates"})})]});return o?se(m,{style:$.inlineRoot,children:[S(m,{style:$.inlineHeader,...xs,children:rt}),it]}):S(Ss,{visible:e,onClose:t,onMinimize:s,persistenceKey:n,header:{showToggleButton:true,customContent:rt},enablePersistence:true,initialMode:"bottomSheet",disableScrollWrapper:true,children:it})}function In(e={}){return S(Ze,{...e,inline:true,visible:true,onClose:()=>{}})}var $=M.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:ws.border.default,backgroundColor:"transparent"},listContainer:{flex:1},listContent:{paddingBottom:16},detailContainer:{flex:1},notice:{marginHorizontal:10,marginBottom:8,padding:10,borderRadius:8,borderWidth:1,borderColor:R.color.border,backgroundColor:R.color.surface,gap:4},noticeText:{color:R.color.textSecondary,fontSize:11},retryText:{color:R.color.text,fontSize:12,paddingVertical:6},fontsBox:{marginHorizontal:10,marginTop:8,padding:10,borderRadius:8,backgroundColor:R.color.surface,gap:6},fontsTitle:{color:R.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5},fontsWrap:{flexDirection:"row",flexWrap:"wrap",gap:6},fontChip:{color:R.color.textSecondary,fontSize:10,backgroundColor:R.color.bg,borderRadius:999,paddingHorizontal:8,paddingVertical:3,overflow:"hidden"},empty:{alignItems:"center",padding:32,gap:8},emptyTitle:{color:R.color.text,fontSize:13,fontWeight:"600"},emptyText:{color:R.color.textSecondary,fontSize:11,textAlign:"center",lineHeight:16}});import{createToolFactory as An,defineToolPreset as Dn}from"@buoy-gg/shared-ui/web";import{jsx as Fn}from"react/jsx-runtime";var ua=Dn({id:"assets",name:"ASSETS",description:"Every bundled asset \u2014 sizes, scale coverage, unused detection",slot:"both",icon:({size:e,color:t})=>Fn(Bt,{size:e,color:t||$t}),component:Ze}),En=An(ua);p();var ha=["image","font","video","audio","data","other"];function Xe(e){return{loadStatus:e.loadStatus,durationMs:e.durationMs,cacheHit:e.cacheHit,id:e.id,key:e.key,registryId:e.registryId??null,name:e.name,type:e.type,kind:e.kind,hash:e.hash??null,location:e.httpServerLocation??null,width:e.width??null,height:e.height??null,scales:e.scales,uri:e.resolvedUri??null,loaded:e.loaded,sizeBytes:e.sizeSource==="measured"?e.sizeBytes??null:k(e)||null,sizeSource:e.sizeSource??null}}function Ln(e){let t=e?.id;if(typeof t!="number")throw new Error("Missing numeric `id` param");let a=Oe(t);if(!a)throw new Error(`Asset record ${t} not found \u2014 re-run the list action for current ids.`);return a}function Tn(e,t){return(t.sizeBytes??k(t))-(e.sizeBytes??k(e))}function pa(){let e=F();return{stats:je(e),scanStatus:te(),insights:Ve(e),diff:we(),records:[...e].sort(Tn)}}var Rn={version:1,getSnapshot:()=>{let{records:e,...t}=pa();return{...t,records:e.slice(0,200).map(Xe)}},subscribe:e=>pe(e),actions:{list:e=>{let t=e??{},a=Math.min(Math.max(t.limit??50,1),500),{records:s,...n}=pa(),o=s;if(t.kind){if(!ha.includes(t.kind))throw new Error(`kind must be one of: ${ha.join(", ")}`);o=o.filter(i=>i.kind===t.kind)}return t.loadedOnly&&(o=o.filter(i=>i.loaded)),{...n,total:o.length,records:o.slice(0,a).map(Xe)}},getDetail:e=>{let t=Ln(e);return{...Xe(t),origin:t.origin,fileSystemLocation:t.fileSystemLocation??null,files:t.files??null,sizesByScale:t.sizesByScale??null,estDecodedBytes:k(t)||null}},rescan:async()=>({ok:true,scanStatus:await ge()}),measureSizes:async()=>{let e=await ea();return{ok:e.measured>0,...e}},saveBaseline:async()=>{let e=await qt();return{ok:true,savedAt:e.savedAt,assets:Object.keys(e.entries).length}},clearBaseline:async()=>(await Jt(),{ok:true,message:"Baseline cleared"}),getDiff:()=>we(),clearRecords:()=>(Pe(),{ok:true,message:"Inventory cleared \u2014 rescan to rebuild"}),getScanStatus:()=>te()}};p();p();var fa=0;function Mn(){if(typeof document>"u")return()=>{};++fa===1&&me();let e=true;return()=>{e&&(e=false,--fa===0&&Pt())}}export{$t as ASSETS_ICON_COLOR,v as ASSETS_TEST_IDS,Bt as AssetsIcon,Ze as AssetsModal,In as AssetsToolView,sa as assetBadgeTestID,na as assetDetailRowTestID,Ke as assetFilterTestID,ra as assetFindingTestID,oa as assetFontChipTestID,ie as assetRowTestID,ae as assetSlug,Rn as assetsSyncAdapter,ua as assetsToolPreset,Jt as clearBaseline,Pe as clearRecords,Yt as computeDiff,Ve as computeInsights,je as computeStats,En as createAssetsTool,Js as disableAssetsCapture,k as estDecodedBytes,en as fetchAssetGraph,Nt as formatAssetMarkdown,Vt as formatInventoryMarkdown,Tt as getBrowserAssetManifest,Zt as getDevServerOrigin,we as getDiff,Ne as getLoadedFontFamilies,Ts as getLocalAssets,Oe as getRecord,te as getScanStatus,F as getSnapshot,me as installAssetCapture,_t as loadBaseline,Es as loadBrowserAssetManifest,ea as measureSizes,Ls as recordBrowserAssetLoad,Lt as registerBrowserAssetManifest,Ys as replaceAssetsFromSnapshot,ge as rescan,qt as saveBaseline,qs as setRemoteAssetsHandler,Mn as startBrowserAssetCapture,pe as subscribe,Wt as useAssetRecords};
|
|
3
|
+
`)}p();import{useMemo as Ms,useSyncExternalStore as Os}from"react";p();var Ps=50*1024,js=100*1024,Hs=150*1024,Ns=2,Vs=.9,Ws=4*1024;function Us(){try{let{Dimensions:e,PixelRatio:t}=(T(),lt(ce)),a=e.get("screen"),s=t.get();return a.width*s*a.height*s}catch{return 1170*2532}}function Ks(e){let t=e.sizesByScale;if(!t)return false;let a=Object.entries(t).map(([s,n])=>({scale:Number(s),bytes:n})).filter(s=>Number.isFinite(s.scale)&&s.bytes>0).sort((s,n)=>s.scale-n.scale);for(let s=1;s<a.length;s++)if(a[s-1].bytes>=Ws&&a[s].bytes<a[s-1].bytes*Vs)return true;return false}function Ve(e){let t=Ft(),a=new Map;for(let h of e){if(!h.hash)continue;let w=a.get(h.hash);w?w.push(h):a.set(h.hash,[h])}let s=[];for(let[h,w]of a){if(w.length<2)continue;let q=w.find(z=>z.sizeBytes!=null);s.push({hash:h,ids:w.map(z=>z.id),wastedBytes:q?.sizeBytes!=null?q.sizeBytes*(w.length-1):null})}let n=Us(),o=[],i=[],d=[],l=[],u=[],r=[],c=[];for(let h of e)h.loaded||d.push(h.id),h.kind==="image"&&h.scales.length>1&&!h.scales.some(w=>w>=t)&&o.push(h.id),(h.type==="png"||h.type==="jpg"||h.type==="jpeg")&&h.sizeBytes!=null&&h.sizeBytes>=Ps&&i.push(h.id),h.kind==="image"&&k(h)/4>n*Ns&&l.push(h.id),h.type==="gif"&&(h.sizeBytes??0)>=js&&u.push(h.id),h.kind==="font"&&(h.sizeBytes??0)>=Hs&&r.push(h.id),Ks(h)&&c.push(h.id);return{duplicates:s,scaleGaps:o,webpCandidates:i,neverLoaded:d,overDecode:l,heavyGifs:u,heavyFonts:r,scaleAnomalies:c}}function Wt(){let e=Os(pe,F,F);return Ms(()=>({records:e,stats:je(e),insights:Ve(e)}),[e])}p();import{useSyncExternalStore as Gs}from"react";var Ut,Kt;function Gt(){let e=F();return e!==Ut&&(Ut=e,Kt=te()),Kt}function _s(){return Gs(pe,Gt,Gt)}p();function qs(e){y().remoteDispatch=e}function Se(){return y().remoteDispatch}function Js(){y().captureDisabled=true}function Ys(e){let t=y(),a=e.records??[];t.records=a.map(s=>({id:s.id,key:s.key,loadStatus:s.loadStatus,durationMs:s.durationMs,cacheHit:s.cacheHit,registryId:s.registryId??void 0,name:s.name,type:s.type,kind:s.kind,hash:s.hash??void 0,httpServerLocation:s.location??void 0,width:s.width??void 0,height:s.height??void 0,scales:s.scales,resolvedUri:s.uri??void 0,loaded:s.loaded,origin:s.registryId!=null?"registry":"graph",sizeBytes:s.sizeBytes??void 0,sizeSource:s.sizeSource??void 0,firstSeenAt:Date.now()})).filter(s=>!Dt(s)),t.byKey=new Map(t.records.map(s=>[s.key,s])),t.byId=new Map(t.records.map(s=>[s.id,s])),e.scanStatus&&(t.fontFamilies=[...new Set(e.scanStatus.fontFamilies??[])],t.mirrorScanStatus={...e.scanStatus,fontFamilies:t.fontFamilies}),t.mirrorDiff=e.diff??null,D()}p();import{persistentStorage as We}from"@buoy-gg/shared-ui/web";var Ue="@react_buoy/assets/baseline",Qs=1024;async function _t(){let e=y();if(e.baselineLoaded)return e.baseline;e.baselineLoaded=true;try{let t=await We.getItem(Ue);if(t){let a=JSON.parse(t);a&&typeof a.savedAt=="number"&&a.entries&&(e.baseline=a,D())}}catch{}return e.baseline}async function qt(){let e=Se();if(e)return await e("saveBaseline"),y().baseline??{savedAt:Date.now(),entries:{}};let t=y(),a={};for(let n of F())a[n.key]={hash:n.hash??null,sizeBytes:n.sizeSource==="measured"?n.sizeBytes??null:null,name:n.name,type:n.type};let s={savedAt:Date.now(),entries:a};t.baseline=s,t.baselineLoaded=true,D();try{await We.setItem(Ue,JSON.stringify(s))}catch{}return s}async function Jt(){let e=Se();if(e){await e("clearBaseline");return}let t=y();t.baseline=null,t.baselineLoaded=true,D();try{await We.removeItem(Ue)}catch{}}function Yt(e,t){let a=[],s=[],n=new Set,o=0,i=0,d=false;for(let u of e){n.add(u.key);let r=t.entries[u.key];if(!r){a.push(u.id);continue}let c=u.sizeSource==="measured"?u.sizeBytes??null:null;c!=null&&r.sizeBytes!=null&&(d=true,o+=c,i+=r.sizeBytes,c-r.sizeBytes>=Qs&&s.push({id:u.id,deltaBytes:c-r.sizeBytes}))}let l=[];for(let[u,r]of Object.entries(t.entries))At(u)||n.has(u)||(l.push({key:u,name:r.name,type:r.type}),r.sizeBytes!=null&&(d=true,i+=r.sizeBytes));for(let u of a){let r=e.find(c=>c.id===u);r?.sizeSource==="measured"&&r.sizeBytes!=null&&(d=true,o+=r.sizeBytes)}return{baselineSavedAt:t.savedAt,added:a,removed:l,grown:s.sort((u,r)=>r.deltaBytes-u.deltaBytes),netBytes:d?o-i:null}}function we(){let e=y();return e.mirrorDiff?e.mirrorDiff:e.baseline?Yt(F(),e.baseline):null}p();T();import{night as U}from"@buoy-gg/shared-ui/web";p();T();import{useState as Zs}from"react";import{night as Xs}from"@buoy-gg/shared-ui/web";p();T();import{buoyFetch as Qt}from"@buoy-gg/shared-ui/web";p();function Zt(){return null}async function en(){ye();let e=Tt().length;return e?{ok:true,count:e}:{ok:false,message:"Register a browser asset manifest to inspect files that have not loaded yet."}}var tn=4;function an(e){if(e.resolvedUri)return e.resolvedUri;let t=Xt(e);return t.length?t[0].url:null}function sn(e){let t=y().captureDisabled;if(!t&&e.registryId!=null)return e.registryId;let a=an(e);return!a||t&&!/^https?:\/\//.test(a)?null:{uri:a}}function Xt(e){let t=e.scales.length?e.scales:[1],a=e.resolvedUri;if(a&&/^https?:\/\//.test(a)&&e.resolvedScale!=null){let n=e.resolvedScale===1?"":`@${e.resolvedScale}x`,o=`${n}.${e.type}`;if(a.includes(o)||n==="")return t.map(i=>{let d=i===1?"":`@${i}x`,l=(n===""?a.replace(`.${e.type}`,`${d}.${e.type}`):a.replace(o,`${d}.${e.type}`)).replace(/ /g,"%20");return{scale:i,url:l}})}let s=Zt();return!s||!e.httpServerLocation?[]:t.map(n=>{let o=n===1?"":`@${n}x`,i=`${e.httpServerLocation}/${e.name}${o}.${e.type}`,d=i.includes("?")?"&":"?",l=`${s}${i}${d}platform=${nn()}${e.hash?`&hash=${e.hash}`:""}`.replace(/ /g,"%20");return{scale:n,url:l}})}function nn(){try{return he.OS}catch{return"ios"}}async function on(e){try{let t=await Qt(e,{method:"HEAD"});if(t.ok){let a=Number(t.headers.get("content-length"));if(Number.isFinite(a)&&a>0)return a}}catch{}try{let t=await Qt(e);if(!t.ok)return null;let a=await t.blob();return a.size>0?a.size:null}catch{return null}}async function rn(e){let t=Xt(e);if(!t.length){re(e.id,{sizeSource:"estimate"});return}let a={},s=0;for(let{scale:n,url:o}of t){let i=await on(o);i!=null&&(a[String(n)]=i,s+=i)}s>0?re(e.id,{sizesByScale:a,sizeBytes:s,sizeSource:"measured"}):re(e.id,{sizeSource:"estimate"})}async function ea(){let e=y();if(e.measuring)return{measured:e.measuredCount,total:F().length};let t=F().filter(a=>a.sizeSource!=="measured");e.measuring=true,D();try{let a=0,s=async()=>{for(;;){let n=t[a++];if(!n)return;await rn(n),e.measuredCount=F().filter(o=>o.sizeSource==="measured").length}};await Promise.all(Array.from({length:Math.min(tn,t.length)},s))}finally{e.measuring=false,D()}return{measured:e.measuredCount,total:F().length}}p();function ln(e){e&&typeof e=="object"&&Fs(e.uri)}p();function dn(){return null}import{jsx as xe}from"react/jsx-runtime";function ta({record:e,style:t,testID:a,compact:s=false}){let n=sn(e);ln(n);let o=e.type.toLowerCase()==="svg",i=o&&he.OS!=="web"?dn():null,d=`${e.key}:${e.hash??""}:${typeof n=="number"?n:n?.uri??""}`,[l,u]=Zs(null);if(n==null||l===d||o&&he.OS!=="web"&&!i){let c=o?"SVG preview unavailable":"Image preview unavailable";return xe(m,{style:[t,aa.fallback],accessibilityLabel:c,testID:`${a}-unavailable`,children:xe(b,{style:aa.text,children:s?o?"SVG":"IMG":c})})}let r=()=>u(d);return i?xe(i,{source:n,style:t,contentFit:"contain",onError:r,testID:a}):xe(ht,{source:n,style:t,resizeMode:"contain",onError:r,testID:a})}var aa=M.create({fallback:{alignItems:"center",justifyContent:"center"},text:{color:Xs.color.textSecondary,fontSize:10,textAlign:"center"}});p();function ae(e){return String(e).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"unknown"}function ie(e,t){return`buoy-assets-row-${ae(`${e}.${t}`)}`}function sa(e,t,a){return`${ie(e,t)}-badge-${ae(a)}`}function Ke(e){return`buoy-assets-filter-${ae(e)}`}function na(e){return`buoy-assets-detail-row-${ae(e)}`}function oa(e){return`buoy-assets-font-${ae(e)}`}var v={title:"buoy-assets-title",copy:"buoy-assets-copy",clear:"buoy-assets-clear",list:"buoy-assets-list",search:"buoy-assets-search",sort:"buoy-assets-sort",filterBar:"buoy-assets-filter-bar",notice:"buoy-assets-notice",noticeText:"buoy-assets-notice-text",discoverySpinner:"buoy-assets-discovery-spinner",retry:"buoy-assets-retry",fonts:"buoy-assets-fonts",fontsTitle:"buoy-assets-fonts-title",empty:"buoy-assets-empty",emptyTitle:"buoy-assets-empty-title",emptyText:"buoy-assets-empty-text",detail:"buoy-assets-detail",detailScroll:"buoy-assets-detail-scroll",detailPreview:"buoy-assets-detail-preview",detailFontPreview:"buoy-assets-detail-font-preview",detailFindings:"buoy-assets-detail-findings"};function ra(e){return`buoy-assets-detail-finding-${e}`}import{Fragment as un,jsx as g,jsxs as Ge}from"react/jsx-runtime";function x({label:e,value:t}){let a=na(e);return Ge(m,{style:E.kvRow,testID:a,children:[g(b,{style:E.kvLabel,children:e}),g(b,{style:E.kvValue,selectable:true,testID:`${a}-value`,children:t})]})}function cn({record:e}){return e.kind==="image"?g(m,{style:E.previewBox,testID:v.detailPreview,children:g(ta,{testID:"buoy-internal-assets-preview",record:e,style:E.previewImage})}):e.kind==="font"?g(m,{style:E.previewBox,testID:v.detailFontPreview,children:g(b,{style:[E.fontPreview,{fontFamily:e.name}],children:"The quick brown fox jumps over the lazy dog 0123456789"})}):null}function hn({record:e,insights:t}){let a=[];t.neverLoaded.includes(e.id)&&a.push("Not observed in the runtime registry this app run. This does not prove the asset is unused."),t.scaleGaps.includes(e.id)&&a.push("Scale gap \u2014 no variant covers this device's pixel ratio"),t.webpCandidates.includes(e.id)&&a.push("WebP candidate \u2014 large png/jpeg, converting typically saves 20\u201340%");let s=t.duplicates.find(o=>o.ids.includes(e.id));s&&a.push(`Duplicate content \u2014 identical bytes shipped ${s.ids.length} times`),t.overDecode.includes(e.id)&&a.push("Decodes larger than 2\xD7 this entire screen \u2014 resize the source, no view can need this many pixels"),t.heavyGifs.includes(e.id)&&a.push("Heavy GIF \u2014 every frame decodes into memory; a video or Lottie is typically ~90% smaller"),t.heavyFonts.includes(e.id)&&a.push("Heavy font \u2014 likely an unsubset icon font; subsetting to used glyphs usually saves most of it"),t.scaleAnomalies.includes(e.id)&&a.push("Scale anomaly \u2014 a higher-resolution variant is smaller in bytes than a lower one; check the exports");let n=k(e);return Ge(Le,{keyboardShouldPersistTaps:"handled",style:E.scroll,contentContainerStyle:E.content,testID:v.detailScroll,children:[g(cn,{record:e}),a.length>0?g(m,{style:E.findings,testID:v.detailFindings,children:a.map((o,i)=>g(b,{style:E.findingText,testID:ra(i),children:o},o))}):null,g(x,{label:"Name",value:`${e.name}.${e.type}`}),e.loadStatus&&Ge(un,{children:[g(x,{label:"Load",value:e.loadStatus==="error"?"Failed":"Loaded"}),g(x,{label:"Load time",value:e.durationMs==null?"Unknown":`${e.durationMs.toFixed(1)} ms`}),g(x,{label:"Load size",value:e.sizeBytes==null?"Unknown":I(e.sizeBytes)}),g(x,{label:"Cache",value:e.cacheHit==null?"Unknown":e.cacheHit?"Cache hit":"Web load"})]}),g(x,{label:"Kind",value:e.kind}),g(x,{label:"Status",value:e.loaded?"Loaded (registered at runtime)":"Not observed in the runtime registry"}),e.kind==="image"?g(x,{label:"Dimensions",value:`${ve(e)} (logical)`}):null,e.kind==="image"&&e.scales.length?g(x,{label:"Scales",value:be(e.scales)}):null,e.sizesByScale?Object.entries(e.sizesByScale).map(([o,i])=>g(x,{label:`Size @${o}x`,value:I(i)},o)):null,e.sizeBytes!=null&&e.sizeSource==="measured"?g(x,{label:"Total size",value:I(e.sizeBytes)}):null,n>0?g(x,{label:"Decoded memory",value:`~${I(n)} (RGBA)`}):null,e.registryId!=null?g(x,{label:"Registry id",value:String(e.registryId)}):null,e.hash?g(x,{label:"Hash",value:e.hash}):null,e.httpServerLocation?g(x,{label:"Location",value:e.httpServerLocation}):null,e.fileSystemLocation?g(x,{label:"Source dir",value:e.fileSystemLocation}):null,e.resolvedUri?g(x,{label:"Resolved URI",value:e.resolvedUri}):null]})}var E=M.create({scroll:{flex:1},content:{padding:12,gap:8},previewBox:{borderRadius:8,backgroundColor:U.color.bg,padding:12,alignItems:"center",justifyContent:"center",minHeight:96},previewImage:{width:"100%",height:140},fontPreview:{color:U.color.text,fontSize:16,textAlign:"center"},findings:{borderRadius:8,borderWidth:1,borderColor:U.color.border,backgroundColor:U.color.surface,padding:10,gap:6},findingText:{color:U.color.textSecondary,fontSize:11,lineHeight:15},kvRow:{gap:2},kvLabel:{color:U.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,textTransform:"uppercase"},kvValue:{color:U.color.text,fontSize:12}});p();T();import{macOSColors as _e,night as K,Pill as pn}from"@buoy-gg/shared-ui/web";import{jsx as L,jsxs as G}from"react/jsx-runtime";function fn({label:e,color:t,testID:a}){return L(pn,{label:e,color:t,variant:"quiet",dot:!!t,style:{paddingVertical:2.5},testID:a})}function yn({record:e,flags:t,sizeFraction:a,onPress:s}){let n=Ht[e.kind],o=[];return e.loaded||o.push({label:"NOT OBSERVED"}),t.oversize&&o.push({label:"OVERSIZE",color:_e.semantic.error}),t.duplicate&&o.push({label:"DUP"}),t.heavy&&o.push({label:"HEAVY"}),t.scaleAnomaly?o.push({label:"BAD SCALE",color:_e.semantic.error}):t.scaleGap&&o.push({label:"LOW-RES"}),t.webp&&o.push({label:"WEBP",color:_e.semantic.info}),G(W,{style:C.card,testID:ie(e.name,e.type),onPress:()=>s(e.id),activeOpacity:.7,children:[G(m,{style:C.body,children:[L(m,{style:C.thumbBox,children:e.kind==="image"?L(ta,{testID:"buoy-internal-assets-thumb",record:e,style:C.thumb,compact:true}):L(b,{style:[C.thumbFallback,{color:n}],children:jt[e.kind]})}),G(m,{style:C.main,children:[G(b,{style:C.name,numberOfLines:1,testID:`${ie(e.name,e.type)}-name`,children:[e.name,G(b,{style:C.ext,children:[".",e.type]})]}),G(m,{style:C.metaRow,children:[e.kind==="image"&&e.width!=null?L(b,{style:C.meta,children:ve(e)}):null,e.kind==="image"&&e.scales.length?L(b,{style:C.meta,children:be(e.scales)}):null]})]}),G(m,{style:C.right,children:[L(b,{style:C.size,testID:`${ie(e.name,e.type)}-size`,children:Rs(e,k(e))}),o.length?L(m,{style:C.badgeRow,children:o.slice(0,3).map(i=>L(fn,{label:i.label,color:i.color,testID:sa(e.name,e.type,i.label)},i.label))}):null]})]}),a>0?L(m,{style:C.sizeTrack,children:L(m,{style:[C.sizeFill,{backgroundColor:n,width:`${Math.max(2,Math.round(a*100))}%`}]})}):null]})}var C=M.create({card:{marginHorizontal:10,marginTop:6,borderRadius:10,backgroundColor:K.color.surface,borderWidth:1,borderColor:K.color.border,overflow:"hidden"},body:{flexDirection:"row",alignItems:"center",paddingVertical:8,paddingHorizontal:12,gap:10},thumbBox:{width:40,height:40,borderRadius:8,backgroundColor:"rgba(255,255,255,0.10)",borderWidth:1,borderColor:K.color.border,alignItems:"center",justifyContent:"center",overflow:"hidden"},thumb:{width:34,height:34},thumbFallback:{fontSize:9,fontWeight:"700",letterSpacing:.5},main:{flex:1,gap:3},name:{color:K.color.text,fontSize:12,fontWeight:"600"},ext:{color:K.color.textTertiary,fontWeight:"400"},metaRow:{flexDirection:"row",alignItems:"center",gap:8},meta:{color:K.color.textSecondary,fontSize:10,fontVariant:["tabular-nums"]},right:{alignItems:"flex-end",gap:4},size:{color:K.color.text,fontSize:12,fontWeight:"700",fontVariant:["tabular-nums"]},badgeRow:{flexDirection:"row",gap:4},sizeTrack:{height:2,backgroundColor:"transparent"},sizeFill:{height:2,opacity:.45,borderTopRightRadius:2}});p();T();import{night as Ce}from"@buoy-gg/shared-ui/web";import{jsx as qe}from"react/jsx-runtime";function mn({stats:e,duplicateCount:t,filter:a,onChange:s}){let n=[{key:"all",label:`ALL ${e.total}`,accent:Ce.color.textSecondary},{key:"duplicates",label:`DUPLICATES ${t}`,accent:"#FF9F1C"}];for(let o of Object.keys(e.byKind)){let i=e.byKind[o];i.count>0&&n.push({key:o,label:`${jt[o]} ${i.count}`,accent:Ht[o]})}return e.neverLoaded>0&&n.push({key:"unused",label:`NOT OBSERVED ${e.neverLoaded}`,accent:"#FF9F1C"}),n.length<=1?null:qe(m,{style:Je.bar,testID:v.filterBar,children:n.map(o=>{let i=o.key===a;return qe(W,{accessibilityRole:"button",accessibilityState:{selected:i},testID:Ke(o.key),style:[Je.chip,i&&{borderColor:o.accent,backgroundColor:`${o.accent}1A`}],onPress:()=>s(i?"all":o.key),children:qe(b,{testID:`${Ke(o.key)}-label`,style:[Je.chipText,{color:i?o.accent:Ce.color.textSecondary}],children:o.label})},o.key)})})}var Je=M.create({bar:{flexDirection:"row",flexWrap:"wrap",gap:6,paddingHorizontal:10,paddingVertical:8},chip:{borderWidth:1,borderColor:Ce.color.border,backgroundColor:Ce.color.surface,borderRadius:999,paddingHorizontal:10,paddingVertical:5},chipText:{fontSize:10,fontWeight:"700",letterSpacing:.4,lineHeight:13}});p();import{ModalHeader as P,ToolbarClearButton as gn,ToolbarCopyButton as ia}from"@buoy-gg/shared-ui/web";import{jsx as j,jsxs as Ye}from"react/jsx-runtime";function bn({stats:e,measuring:t,discovering:a=false,detailOpen:s,detailIndex:n=-1,detailTotal:o=0,onCloseDetail:i,onClear:d,getReport:l,onBack:u}){if(s){let c=n>=0&&o>0?`${n+1} of ${o}`:void 0;return Ye(P,{children:[j(P.Navigation,{onBack:i}),j(P.Content,{title:"Asset detail",subtitle:c,testID:v.title}),j(P.Actions,{children:j(ia,{value:l,testID:v.copy})})]})}let r=[`${e.total} assets${a?" so far":""}`];if(e.totalBytes>0&&!t&&!a){let c=e.measuredCount<e.total?"+":"";r.push(`${I(e.totalBytes)}${c}`)}return e.neverLoaded>0&&r.push(`${e.neverLoaded} not observed`),e.fontFamilies>0&&r.push(`${e.fontFamilies} fonts`),Ye(P,{children:[u?j(P.Navigation,{onBack:u}):null,j(P.Content,{title:"Assets",subtitle:r.join(" \xB7 "),testID:v.title}),Ye(P.Actions,{children:[j(ia,{value:l,testID:v.copy}),j(gn,{onPress:d,testID:v.clear})]})]})}p();T();import{night as _}from"@buoy-gg/shared-ui/web";import{jsx as la,jsxs as da}from"react/jsx-runtime";var vn={size:"name",name:"type",type:"size"};function Sn({query:e,onQueryChange:t,sort:a,onSortChange:s}){return da(m,{style:ke.row,children:[la(Ee,{style:ke.input,value:e,onChangeText:t,placeholder:"Search assets\u2026",placeholderTextColor:_.color.placeholder,autoCapitalize:"none",autoCorrect:false,testID:v.search}),la(W,{style:ke.button,onPress:()=>s(vn[a]),testID:v.sort,children:da(b,{style:ke.buttonText,testID:`${v.sort}-label`,children:["\u2193 ",a.toUpperCase()]})})]})}var ke=M.create({row:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:10,paddingBottom:8},input:{flex:1,backgroundColor:_.color.surfaceElevated,borderWidth:1,borderColor:_.color.border,borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:_.color.text,fontSize:12},button:{backgroundColor:_.color.surface,borderWidth:1,borderColor:_.color.border,borderRadius:8,paddingHorizontal:10,paddingVertical:7},buttonText:{color:_.color.textSecondary,fontSize:10,fontWeight:"700",letterSpacing:.5}});p();T();import{useEffect as wn,useState as xn}from"react";import{night as le}from"@buoy-gg/shared-ui/web";import{jsx as ze,jsxs as Cn}from"react/jsx-runtime";function kn({status:e,total:t,onRetry:a}){let[s,n]=xn(false);wn(()=>{if(n(false),!e.graphFetchInFlight)return;let d=e.graphFetchStartedAt==null?0:Math.max(0,Date.now()-e.graphFetchStartedAt),l=setTimeout(()=>n(true),Math.max(0,8e3-d));return()=>clearTimeout(l)},[e.graphFetchInFlight,e.graphFetchStartedAt]);let o=[];e.browser&&!e.graphSupported&&o.push("Showing resources this page has loaded. Add an asset manifest to include files the page has not requested."),e.graphFetchInFlight&&(o.push(`Finding assets\u2026 ${t} found so far.`),s&&o.push("Still finding assets. This is taking longer than usual.")),e.registryAvailable||o.push("The asset registry is unavailable in this environment."),!e.graphFetchInFlight&&!e.graphSupported&&e.graphError&&o.push("Showing runtime-registered assets only. A development server is needed to find more assets and measure their sizes.");let i=!e.graphFetchInFlight&&e.graphSupported&&!!e.graphError;return i&&o.push(`Couldn't finish finding assets. Showing ${t} assets found so far.`),e.measuring&&!e.graphFetchInFlight&&o.push("Checking asset sizes\u2026"),o.length===0?null:Cn(m,{style:Qe.notice,testID:v.notice,children:[e.graphFetchInFlight?ze(Re,{size:"small",color:le.color.textSecondary,accessibilityLabel:"Finding assets",testID:v.discoverySpinner}):null,o.map(d=>ze(b,{style:Qe.noticeText,testID:v.noticeText,children:d},d)),i?ze(W,{accessibilityRole:"button",onPress:a,testID:v.retry,children:ze(b,{style:Qe.retryText,children:"Retry"})}):null]})}var Qe=M.create({notice:{marginHorizontal:10,marginBottom:8,padding:10,borderRadius:8,borderWidth:1,borderColor:le.color.border,backgroundColor:le.color.surface,gap:4},noticeText:{color:le.color.textSecondary,fontSize:11},retryText:{color:le.color.text,fontSize:12,paddingVertical:6}});import{jsx as S,jsxs as se}from"react/jsx-runtime";function zn({names:e}){let t=[...new Set(e)];return t.length?se(m,{style:$.fontsBox,testID:v.fonts,children:[se(b,{style:$.fontsTitle,testID:v.fontsTitle,children:["LOADED FONT FAMILIES (",t.length,")"]}),S(m,{style:$.fontsWrap,children:t.map(a=>S(b,{style:$.fontChip,testID:oa(a),children:a},a))})]}):null}function Bn({duplicates:e=false}){return S(Cs,{testID:v.empty,otto:"scanning",title:e?"No duplicates found":"No assets found yet",message:e?"No assets in this view share a content hash.":"Every bundled asset \u2014 images, fonts, video, audio \u2014 appears here with sizes, scale coverage, and runtime registration status. Try Rescan after navigating around the app."})}function ua(e,t){return(t.sizeBytes??k(t))-(e.sizeBytes??k(e))}var $n={size:ua,name:(e,t)=>e.name.localeCompare(t.name)||e.type.localeCompare(t.type),type:(e,t)=>e.type.localeCompare(t.type)||ua(e,t)};function Ze({visible:e,onClose:t,onBack:a,onMinimize:s,persistenceKey:n,inline:o=false}){me();let{records:i,stats:d,insights:l}=Wt(),u=_s(),[r,c]=oe(false);It(()=>{c(false)},[u.graphFetchInFlight,u.lastScanAt]);let h=()=>{c(false);let f=Se();f?f("rescan").catch(()=>c(true)):ge()},[w,q]=oe(null),[z,ya]=oe("all"),[et,tt]=oe(""),[at,ma]=oe("size"),H=w!=null?Oe(w):void 0;It(()=>{if(!e)return;_t(),c(false);let f=Se();f?f("rescan").catch(()=>c(true)):ge()},[e]);let Be=new Set(l.duplicates.flatMap(f=>f.ids)),st=[...i].sort($n[at]),nt=et.trim().toLowerCase(),J=st.filter(f=>!(z==="unused"&&f.loaded||z==="duplicates"&&!Be.has(f.id)||z!=="all"&&z!=="unused"&&z!=="duplicates"&&f.kind!==z||nt&&!`${f.name}.${f.type}`.toLowerCase().includes(nt))),ne=H?J.findIndex(f=>f.id===H.id):-1,ot=f=>{let O=J[f];O&&q(O.id)},Y={scaleGaps:new Set(l.scaleGaps),scaleAnomalies:new Set(l.scaleAnomalies),duplicates:Be,webpCandidates:new Set(l.webpCandidates),overDecode:new Set(l.overDecode),heavy:new Set([...l.heavyGifs,...l.heavyFonts])},de=0;for(let f of J){let O=f.sizeBytes??k(f);O>de&&(de=O)}let ga=()=>H?Nt(H):Vt(st,d,l,te(),we()),rt=S(bn,{stats:d,measuring:u.measuring,discovering:u.graphFetchInFlight,detailOpen:H!=null,detailIndex:ne,detailTotal:J.length,onCloseDetail:()=>q(null),onClear:Pe,getReport:ga,onBack:a}),it=H?se(m,{style:$.detailContainer,children:[S(hn,{record:H,insights:l}),ne>=0?S(vs,{currentIndex:ne,totalItems:J.length,itemLabel:"Asset",onPrevious:()=>ot(ne-1),onNext:()=>ot(ne+1)}):null]}):se(m,{style:$.listContainer,children:[S(mn,{stats:d,duplicateCount:Be.size,filter:z,onChange:f=>{ya(f),f==="duplicates"&&tt("")}}),S(Sn,{query:et,onQueryChange:tt,sort:at,onSortChange:ma}),S(kn,{status:u,total:d.total,onRetry:h}),r&&!u.graphFetchInFlight?se(m,{style:$.notice,children:[S(b,{style:$.noticeText,children:"Couldn't request an asset scan from the device."}),S(W,{accessibilityRole:"button",onPress:h,children:S(b,{style:$.retryText,children:"Retry"})})]}):null,z==="unused"?S(m,{style:$.notice,children:S(b,{style:$.noticeText,children:"Not seen in React Native's asset registry this app run. Assets loaded through other paths may appear here; this does not prove they are unused."})}):null,z==="font"?S(zn,{names:u.fontFamilies}):null,S(ct,{keyboardShouldPersistTaps:"handled",testID:v.list,data:J,keyExtractor:f=>String(f.id),contentContainerStyle:$.listContent,renderItem:({item:f})=>S(yn,{record:f,flags:{scaleGap:Y.scaleGaps.has(f.id),scaleAnomaly:Y.scaleAnomalies.has(f.id),duplicate:Y.duplicates.has(f.id),webp:Y.webpCandidates.has(f.id),oversize:Y.overDecode.has(f.id),heavy:Y.heavy.has(f.id)},sizeFraction:de>0?(f.sizeBytes??k(f))/de:0,onPress:O=>q(typeof O=="number"?O:null)}),ListEmptyComponent:u.graphFetchInFlight?null:S(Bn,{duplicates:z==="duplicates"})})]});return o?se(m,{style:$.inlineRoot,children:[S(m,{style:$.inlineHeader,...xs,children:rt}),it]}):S(Ss,{visible:e,onClose:t,onMinimize:s,persistenceKey:n,header:{showToggleButton:true,customContent:rt},enablePersistence:true,initialMode:"bottomSheet",disableScrollWrapper:true,children:it})}function In(e={}){return S(Ze,{...e,inline:true,visible:true,onClose:()=>{}})}var $=M.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:ws.border.default,backgroundColor:"transparent"},listContainer:{flex:1},listContent:{paddingBottom:16},detailContainer:{flex:1},notice:{marginHorizontal:10,marginBottom:8,padding:10,borderRadius:8,borderWidth:1,borderColor:R.color.border,backgroundColor:R.color.surface,gap:4},noticeText:{color:R.color.textSecondary,fontSize:11},retryText:{color:R.color.text,fontSize:12,paddingVertical:6},fontsBox:{marginHorizontal:10,marginTop:8,padding:10,borderRadius:8,backgroundColor:R.color.surface,gap:6},fontsTitle:{color:R.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5},fontsWrap:{flexDirection:"row",flexWrap:"wrap",gap:6},fontChip:{color:R.color.textSecondary,fontSize:10,backgroundColor:R.color.bg,borderRadius:999,paddingHorizontal:8,paddingVertical:3,overflow:"hidden"},empty:{alignItems:"center",padding:32,gap:8},emptyTitle:{color:R.color.text,fontSize:13,fontWeight:"600"},emptyText:{color:R.color.textSecondary,fontSize:11,textAlign:"center",lineHeight:16}});import{createToolFactory as An,defineToolPreset as Dn}from"@buoy-gg/shared-ui/web";import{jsx as Fn}from"react/jsx-runtime";var ca=Dn({id:"assets",name:"ASSETS",description:"Every bundled asset \u2014 sizes, scale coverage, unused detection",slot:"both",icon:({size:e,color:t})=>Fn(Bt,{size:e,color:t||$t}),component:Ze}),En=An(ca);p();var ha=["image","font","video","audio","data","other"];function Xe(e){return{loadStatus:e.loadStatus,durationMs:e.durationMs,cacheHit:e.cacheHit,id:e.id,key:e.key,registryId:e.registryId??null,name:e.name,type:e.type,kind:e.kind,hash:e.hash??null,location:e.httpServerLocation??null,width:e.width??null,height:e.height??null,scales:e.scales,uri:e.resolvedUri??null,loaded:e.loaded,sizeBytes:e.sizeSource==="measured"?e.sizeBytes??null:k(e)||null,sizeSource:e.sizeSource??null}}function Ln(e){let t=e?.id;if(typeof t!="number")throw new Error("Missing numeric `id` param");let a=Oe(t);if(!a)throw new Error(`Asset record ${t} not found \u2014 re-run the list action for current ids.`);return a}function Tn(e,t){return(t.sizeBytes??k(t))-(e.sizeBytes??k(e))}function pa(){let e=F();return{stats:je(e),scanStatus:te(),insights:Ve(e),diff:we(),records:[...e].sort(Tn)}}var Rn={version:1,getSnapshot:()=>{let{records:e,...t}=pa();return{...t,records:e.slice(0,200).map(Xe)}},subscribe:e=>pe(e),actions:{list:e=>{let t=e??{},a=Math.min(Math.max(t.limit??50,1),500),{records:s,...n}=pa(),o=s;if(t.kind){if(!ha.includes(t.kind))throw new Error(`kind must be one of: ${ha.join(", ")}`);o=o.filter(i=>i.kind===t.kind)}return t.loadedOnly&&(o=o.filter(i=>i.loaded)),{...n,total:o.length,records:o.slice(0,a).map(Xe)}},getDetail:e=>{let t=Ln(e);return{...Xe(t),origin:t.origin,fileSystemLocation:t.fileSystemLocation??null,files:t.files??null,sizesByScale:t.sizesByScale??null,estDecodedBytes:k(t)||null}},rescan:async()=>({ok:true,scanStatus:await ge()}),measureSizes:async()=>{let e=await ea();return{ok:e.measured>0,...e}},saveBaseline:async()=>{let e=await qt();return{ok:true,savedAt:e.savedAt,assets:Object.keys(e.entries).length}},clearBaseline:async()=>(await Jt(),{ok:true,message:"Baseline cleared"}),getDiff:()=>we(),clearRecords:()=>(Pe(),{ok:true,message:"Inventory cleared \u2014 rescan to rebuild"}),getScanStatus:()=>te()}};p();p();var fa=0;function Mn(){if(typeof document>"u")return()=>{};++fa===1&&me();let e=true;return()=>{e&&(e=false,--fa===0&&Pt())}}export{$t as ASSETS_ICON_COLOR,v as ASSETS_TEST_IDS,Bt as AssetsIcon,Ze as AssetsModal,In as AssetsToolView,sa as assetBadgeTestID,na as assetDetailRowTestID,Ke as assetFilterTestID,ra as assetFindingTestID,oa as assetFontChipTestID,ie as assetRowTestID,ae as assetSlug,Rn as assetsSyncAdapter,ca as assetsToolPreset,Jt as clearBaseline,Pe as clearRecords,Yt as computeDiff,Ve as computeInsights,je as computeStats,En as createAssetsTool,Js as disableAssetsCapture,k as estDecodedBytes,en as fetchAssetGraph,Nt as formatAssetMarkdown,Vt as formatInventoryMarkdown,Tt as getBrowserAssetManifest,Zt as getDevServerOrigin,we as getDiff,Ne as getLoadedFontFamilies,Ts as getLocalAssets,Oe as getRecord,te as getScanStatus,F as getSnapshot,me as installAssetCapture,_t as loadBaseline,Es as loadBrowserAssetManifest,ea as measureSizes,Ls as recordBrowserAssetLoad,Lt as registerBrowserAssetManifest,Ys as replaceAssetsFromSnapshot,ge as rescan,qt as saveBaseline,qs as setRemoteAssetsHandler,Mn as startBrowserAssetCapture,pe as subscribe,Wt as useAssetRecords};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/assets",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.78",
|
|
4
4
|
"description": "Inspect assets reported by a manifest and runtime hooks, including available sizes, scale variants, duplicates and baseline changes.",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"**/autoCapture.*"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@buoy-gg/shared-ui": "^7.0.
|
|
20
|
+
"@buoy-gg/shared-ui": "^7.0.78"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"react": "*"
|