mcard-studio 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/astro.config.mjs +46 -2
- package/bin/mcard-studio.mjs +1 -1
- package/cli/lib/runtimeContext.mjs +6 -3
- package/dist/client/_astro/{ChartAnalyticsViewlet.Cevj0EOs.js → ChartAnalyticsViewlet.CBW-JyA3.js} +1 -1
- package/dist/client/_astro/ClmPcardViewlet.cvKsR2ng.js +3 -0
- package/dist/client/_astro/D3GraphViewlet.8YEIrCGL.js +2 -0
- package/dist/client/_astro/DockviewSpatialWorkbench.BTd66LPl.js +12 -0
- package/dist/client/_astro/DocumentViewlets.KY1HcNka.js +2 -0
- package/dist/client/_astro/DxfViewlet.B3N5zpZR.js +1 -0
- package/dist/client/_astro/ExcalidrawWhiteboardViewlet.CMJGCQN4.js +1 -0
- package/dist/client/_astro/{FaroVCardSpanInstrumenter.BIk2NhJY.js → FaroVCardSpanInstrumenter.ClIqZujq.js} +1 -1
- package/dist/client/_astro/{FontSpecimenViewlet.CpONhJh0.js → FontSpecimenViewlet.ChIyr0B8.js} +1 -1
- package/dist/client/_astro/HeadMeta.astro_astro_type_script_index_0_lang.D3FSc061.js +1 -0
- package/dist/client/_astro/{ImageViewlet.CHeNvX6L.js → ImageViewlet.Cs-u7-wt.js} +1 -1
- package/dist/client/_astro/{KatexFormulaViewlet.Cy_InWOK.js → KatexFormulaViewlet.0nOzV_qD.js} +1 -1
- package/dist/client/_astro/KoishiChatViewlet.DLsMmwdb.js +16 -0
- package/dist/client/_astro/MCardLibraryHarness.WBT9W10S.js +2 -0
- package/dist/client/_astro/{MarkdownViewlet.qoPlM-TZ.js → MarkdownViewlet.BIolkNXf.js} +25 -25
- package/dist/client/_astro/{MermaidDiagramViewlet.RnwDfQl6.js → MermaidDiagramViewlet.CkRk7QsS.js} +1 -1
- package/dist/client/_astro/PCardRendererBridge.DhaRSprd.js +1 -0
- package/dist/client/_astro/RendererPCardRegistry.brM2KiQs.js +1 -0
- package/dist/client/_astro/{SchemaYamlViewlet.D6HVdmrq.js → SchemaYamlViewlet.Bc7nkK4M.js} +1 -1
- package/dist/client/_astro/{ShellContainer.astro_astro_type_script_index_0_lang.2oi8fhQo.js → ShellContainer.astro_astro_type_script_index_0_lang.5q1gCLvf.js} +1 -1
- package/dist/client/_astro/{Spatial3dViewlet.CCYBSSib.js → Spatial3dViewlet.C-jjhr0A.js} +1 -1
- package/dist/client/_astro/{StudioLayout.CBgiVbeb.css → StudioLayout.CX8XGtZV.css} +1 -1
- package/dist/client/_astro/StudioWorkbench.B1QwGHWM.js +7 -0
- package/dist/client/_astro/{SvgViewlet.BxlWQ-JX.js → SvgViewlet.uGxvb06H.js} +1 -1
- package/dist/client/_astro/{TerminalView.DWZR-hUa.js → TerminalView.DP7G7E1m.js} +4 -4
- package/dist/client/_astro/{ThemeSettingsViewlet.Cb1r8fWw.js → ThemeSettingsViewlet.UaTHcGnF.js} +1 -1
- package/dist/client/_astro/{TikzDiagramViewlet.CqY7VTeP.js → TikzDiagramViewlet.O8MJyXfT.js} +1 -1
- package/dist/client/_astro/VideoPlayerViewlet.-ycmo3kY.js +1 -0
- package/dist/client/_astro/WebappZenViewlet.PNce4u2T.js +1 -0
- package/dist/client/_astro/{WelcomeViewport.LwKTA6h7.js → WelcomeViewport.CZ6RxGSw.js} +1 -1
- package/dist/client/_astro/{agentIdentityCredentialService.BtKVsl2C.js → agentIdentityCredentialService.BEtZzBlO.js} +5 -5
- package/dist/client/_astro/cardTypeDetector.C2HH5RnU.js +1 -0
- package/dist/client/_astro/disposable.BmlxZrDf.js +1 -0
- package/dist/client/_astro/{markdownService.D-tM2RYx.js → markdownService.CpuKl0vp.js} +1 -1
- package/dist/client/_astro/{mcardStore.BiAvqM-D.js → mcardStore.nSWnzeLg.js} +2 -2
- package/dist/client/_astro/mcardVfs.BSdys1Y7.js +3 -0
- package/dist/client/_astro/pathsConfig.CSBBSzwH.js +2 -0
- package/dist/client/_astro/polyfills.Bi7kO8cu.js +1 -0
- package/dist/client/_astro/rendererEventBus.DirFDmGw.js +1 -0
- package/dist/client/_astro/themeStore.BajxvCga.js +1 -0
- package/dist/client/_astro/{tikzCompiler.DFojjdxR.js → tikzCompiler.-fXMNQpz.js} +1 -1
- package/dist/client/_astro/{useMCardHydration.Co47OH3D.js → useMCardHydration.Bjj_N5Gv.js} +1 -1
- package/dist/client/_astro/vendor-ai.D6NcJ6lu.js +69 -0
- package/dist/client/_astro/vendor-clm-kernel.B0kxq3g4.js +108 -0
- package/dist/client/_astro/vfsHandles.D4Pq18pW.js +1 -0
- package/dist/client/_astro/vfsPersistence.DVrd1BZj.js +1 -0
- package/dist/client/_astro/vfsTransactions.DBNtFuRz.js +1 -0
- package/dist/client/_astro/{workspaceStore.CXakha4Y.js → workspaceStore.DUHW2YBc.js} +1 -1
- package/dist/client/js/buffer-polyfill.js +14 -0
- package/dist/server/chunks/{StudioLayout_D163irJ0.mjs → StudioLayout_taayQJ5b.mjs} +2 -2
- package/dist/server/chunks/{_.._ZXsz792-.mjs → _.._CoQKwo62.mjs} +137 -91
- package/dist/server/chunks/{_handle__D_cIJYrU.mjs → _handle__D8dKQPUS.mjs} +3 -3
- package/dist/server/chunks/{cardTypeDetector_CyW1Xnmy.mjs → cardTypeDetector_C55M_HWS.mjs} +9 -0
- package/dist/server/chunks/{cards_B89BvF6W.mjs → cards_rVOc8K6H.mjs} +2 -2
- package/dist/server/chunks/cas_DTxlZ4Le.mjs +68 -0
- package/dist/server/chunks/{dispatch_DOwSKukU.mjs → dispatch_BTW4E_BJ.mjs} +8 -7
- package/dist/server/chunks/{dispatch_CxWKiHpn.mjs → dispatch_MbkljUxD.mjs} +8 -8
- package/dist/server/chunks/{export_DRouradA.mjs → export_DkEwDE2T.mjs} +3 -3
- package/dist/server/chunks/{health_Dfa5I0-X.mjs → health_cRt0M0yu.mjs} +1 -1
- package/dist/server/chunks/{mcard-library_DvPPUs9_.mjs → mcard-library_CLHvyslV.mjs} +1 -1
- package/dist/server/chunks/{mcardVfs_CeezzRvt.mjs → mcardVfs_DvNburKb.mjs} +5 -30
- package/dist/server/chunks/{move__RFvIDkq.mjs → move_DYcaXBLV.mjs} +6 -6
- package/dist/server/chunks/{pathsConfig_CgNYYLVm.mjs → pathsConfig_Dack-p2f.mjs} +13 -3
- package/dist/server/chunks/{proxy_CrWJQIBe.mjs → proxy_CMbbdBPW.mjs} +2 -2
- package/dist/server/chunks/{raw_DzNDaDVP.mjs → raw_C97sJWhg.mjs} +59 -26
- package/dist/server/chunks/{serverBootstrap_XKo2s6Ha.mjs → serverBootstrap_BDdSRIu5.mjs} +2 -2
- package/dist/server/chunks/tree_BwmO-pTe.mjs +186 -0
- package/dist/server/chunks/vfsCore_DIKpk-pk.mjs +98 -0
- package/dist/server/chunks/{vfsTreeScan_CKp7kMt9.mjs → vfsTreeScan_CRoCluPB.mjs} +18 -10
- package/dist/server/chunks/workspaceRoot_CRx3taID.mjs +157 -0
- package/dist/server/chunks/{write_popiFsO7.mjs → write_BLsmsTIx.mjs} +6 -5
- package/dist/server/chunks/{ws-server-init_CkcgcI5V.mjs → ws-server-init_Cfft7U5u.mjs} +343 -298
- package/dist/server/entry.mjs +8 -4
- package/dist/server/entry2.mjs +67 -28
- package/dist/server/virtual_astro_middleware.mjs +2 -2
- package/package.json +2 -2
- package/public/js/buffer-polyfill.js +14 -0
- package/src/components/studio/views/cardViewlets/ClmRegistryComponentViewlet.tsx +133 -0
- package/src/components/studio/views/cardViewlets/DxfViewlet.tsx +230 -0
- package/src/components/studio/views/cardViewlets/VideoPlayerViewlet.tsx +4 -4
- package/src/components/studio/views/cardViewlets/coreViewletDefs.ts +2 -2
- package/src/components/studio/views/cardViewlets/documents/AudioPlayerViewlet.tsx +15 -3
- package/src/components/studio/views/cardViewlets/documents/PdfViewlet.tsx +25 -7
- package/src/components/studio/views/cardViewlets/markdown/stages/wikilinkStage.ts +2 -1
- package/src/components/studio/views/cardViewlets/mediaViewletDefs.ts +21 -1
- package/src/components/studio/views/cardViewlets/webapp/WebappCanvas.tsx +40 -15
- package/src/components/studio/views/cardViewlets/webapp/WebappDevicePresetBar.tsx +108 -0
- package/src/components/studio/views/cardViewlets/webapp/WebappZenViewlet.tsx +23 -30
- package/src/components/studio/views/fileTree/MCardFileTree.tsx +71 -54
- package/src/components/studio/views/fileTree/hooks/useFileTreeSync.ts +0 -1
- package/src/components/studio/views/fileTree/hooks/usePartitionedTrees.ts +68 -23
- package/src/components/studio/views/fileTree/hooks/useSectionAccordion.ts +21 -11
- package/src/components/studio/views/functions/UnifiedFunctionExplorerViewlet.tsx +168 -0
- package/src/components/studio/views/history/HistoryPanel.tsx +110 -0
- package/src/components/studio/views/lineage/LineagePanel.tsx +152 -0
- package/src/components/studio/views/navigation/HandleLineageDrawer.tsx +89 -0
- package/src/components/studio/views/navigation/MultiCardCollectionBrowser.tsx +154 -0
- package/src/components/studio/views/pills/HashPill.tsx +101 -0
- package/src/components/studio/views/residency/ResidencyIndicator.tsx +82 -0
- package/src/config/app_config.json +3 -3
- package/src/core/projection/catalog.ts +105 -0
- package/src/core/projection/collection.ts +148 -0
- package/src/core/projection/handleSubscription.ts +132 -0
- package/src/core/projection/index.ts +4 -0
- package/src/core/projection/selectors.ts +29 -0
- package/src/core/projection/views.ts +242 -0
- package/src/core/refinement/designMetrics.ts +104 -0
- package/src/core/refinement/fibrationProjector.ts +142 -0
- package/src/core/refinement/lagrangianEngine.ts +137 -0
- package/src/core/refinement/refinementCommands.ts +82 -0
- package/src/core/viewport/deviceArchetypeRegistry.ts +177 -0
- package/src/core/viewport/viewportAudit.ts +150 -0
- package/src/edge/storeFilter.d.ts +4 -0
- package/src/edge/storeFilter.js +54 -0
- package/src/edge/storeFilter.ts +52 -0
- package/src/layouts/StudioLayout.astro +1 -0
- package/src/lib/cryptoPolyfill.js +77 -1
- package/src/lib/fsPolyfill.js +65 -0
- package/src/lib/urlPolyfill.js +21 -0
- package/src/lib/zlibPolyfill.js +35 -0
- package/src/packages/mcard-studio/package.json +2 -2
- package/src/packages/mcard-studio/type/legacyMapping.ts +5 -0
- package/src/packages/mcard-studio/viewlets/manifests.ts +2 -0
- package/src/packages/mcard-studio/viewlets/moduleMap.ts +12 -0
- package/src/packages/mcard-studio/viewlets/refinementManifests.ts +114 -0
- package/src/pages/api/dispatch.ts +3 -2
- package/src/pages/api/vfs/cas.ts +114 -0
- package/src/pages/api/vfs/move.ts +5 -5
- package/src/pages/api/vfs/raw.ts +72 -27
- package/src/pages/api/vfs/tree.ts +130 -11
- package/src/pages/api/vfs/write.ts +5 -4
- package/src/pages/index.astro +75 -0
- package/src/server/api/kernelDispatch.ts +8 -8
- package/src/server/artifactCollectionService.ts +4 -7
- package/src/server/artifactRepository.ts +4 -3
- package/src/server/clmRunner.mjs +1 -1
- package/src/server/collectionOwner.mjs +5 -5
- package/src/server/effects/executionPersistenceService.mjs +11 -11
- package/src/server/effects/resultSealingService.mjs +2 -2
- package/src/server/fileIngestService.mjs +21 -9
- package/src/server/fileWatcherService.mjs +4 -1
- package/src/server/handlers/fileChangeHandler.mjs +18 -10
- package/src/server/handlers/saveExecutionLogHandler.mjs +6 -6
- package/src/server/notificationService.mjs +14 -1
- package/src/server/scripts/buildSeedingMemory.mjs +3 -3
- package/src/server/serverMemoryRepository.ts +41 -59
- package/src/server/vfsTreeScan.ts +16 -10
- package/src/server/workspaceRoot.ts +143 -5
- package/src/services/cardTypeDetector.ts +4 -0
- package/src/services/databaseSyncService.ts +30 -46
- package/src/services/inBrowserLlm/engines/litertEngine.ts +1 -1
- package/src/services/namespaceProtocolClient.ts +221 -0
- package/src/services/renderers/pcard/RendererPCardRegistry.ts +4 -66
- package/src/services/renderers/pcard/modalitySpecs.ts +125 -0
- package/src/services/renderers/pcard/types.ts +7 -1
- package/src/services/renderers/rendererEventBus.ts +5 -3
- package/src/services/unifiedFunctionExecutionService.ts +145 -0
- package/src/services/vfs/vfsCore.ts +12 -1
- package/src/services/vfs/vfsMigration.ts +95 -0
- package/src/services/vfs/vfsMutations.ts +17 -35
- package/src/services/vfs/vfsPersistence.ts +19 -24
- package/src/services/vfs/vfsSync.ts +55 -17
- package/src/services/vfs/vfsVersions.ts +23 -34
- package/src/services/workbenchExecutionPolicy.ts +183 -0
- package/src/stores/mcardCollectionStore.ts +2 -0
- package/src/styles/dockview.css +34 -0
- package/src/ui/viewlets/FibrationRefinementViewlet.tsx +155 -0
- package/src/ui/viewlets/PetriConformanceViewlet.tsx +166 -0
- package/src/ui/viewlets/ResponsiveViewportLabViewlet.tsx +175 -0
- package/src/ui/viewlets/SprintGovernanceViewlet.tsx +176 -0
- package/src/ui/viewlets/viewletFocus.ts +35 -0
- package/src/ui/viewlets/viewportLabParts.tsx +190 -0
- package/dist/client/_astro/ClmPcardViewlet.DW5Yft0E.js +0 -3
- package/dist/client/_astro/D3GraphViewlet.DAjPz1DP.js +0 -2
- package/dist/client/_astro/DockviewSpatialWorkbench.DyQjSoHd.js +0 -12
- package/dist/client/_astro/DocumentViewlets.Dm_GL3AL.js +0 -2
- package/dist/client/_astro/ExcalidrawWhiteboardViewlet.DrlW7B6G.js +0 -1
- package/dist/client/_astro/HeadMeta.astro_astro_type_script_index_0_lang.DGXU-3Lu.js +0 -1
- package/dist/client/_astro/KoishiChatViewlet.B0eDEMnT.js +0 -16
- package/dist/client/_astro/MCardLibraryHarness.CUJLJFBt.js +0 -2
- package/dist/client/_astro/PCardRendererBridge.BnyaE05I.js +0 -1
- package/dist/client/_astro/RendererPCardRegistry.CLr4j1Ub.js +0 -1
- package/dist/client/_astro/StudioWorkbench.CF0SOYwy.js +0 -7
- package/dist/client/_astro/VideoPlayerViewlet.DoSYmmoQ.js +0 -1
- package/dist/client/_astro/WebappZenViewlet.CQW50OhX.js +0 -1
- package/dist/client/_astro/cardTypeDetector.C9kGObMh.js +0 -1
- package/dist/client/_astro/disposable.66apX1Q2.js +0 -1
- package/dist/client/_astro/empty.DOwCrGXH.js +0 -1
- package/dist/client/_astro/mcardVfs.Bj-RA0p7.js +0 -2
- package/dist/client/_astro/path.CR60mj9W.js +0 -1
- package/dist/client/_astro/pathsConfig.D0hV34p7.js +0 -2
- package/dist/client/_astro/polyfills.DcBkS56X.js +0 -1
- package/dist/client/_astro/rendererEventBus.CyFnSRLk.js +0 -1
- package/dist/client/_astro/themeStore.zUMFLo3Q.js +0 -1
- package/dist/client/_astro/vendor-ai.CZe7UVVK.js +0 -69
- package/dist/client/_astro/vfsHandles.B-nczBRy.js +0 -1
- package/dist/client/_astro/vfsPersistence.D6zRzVML.js +0 -1
- package/dist/client/_astro/vfsTransactions.04mkEHxD.js +0 -1
- package/dist/server/chunks/cryptoPolyfill_99rxUwYC.mjs +0 -180
- package/dist/server/chunks/kernelHash_DRaj51hY.mjs +0 -5
- package/dist/server/chunks/tree_CE2BhvyJ.mjs +0 -76
- package/dist/server/chunks/vfsCore_B6nCiBl5.mjs +0 -21
- package/dist/server/chunks/workspaceRoot_DVSUbYkd.mjs +0 -71
- package/src/server/kernelHash.ts +0 -22
- package/src/server/storage/cardCollection.ts +0 -94
- package/src/server/storage/index.ts +0 -3
- package/src/server/storage/mcard.ts +0 -99
- package/src/server/storage/sqliteNodeEngine.ts +0 -121
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
(()=>{var yr=Object.create;var H=Object.defineProperty;var wr=Object.getOwnPropertyDescriptor;var xr=Object.getOwnPropertyNames;var Br=Object.getPrototypeOf,Er=Object.prototype.hasOwnProperty;var N=(i,r)=>()=>(r||i((r={exports:{}}).exports,r),r.exports);var dr=(i,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of xr(r))!Er.call(i,e)&&e!==t&&H(i,e,{get:()=>r[e],enumerable:!(n=wr(r,e))||n.enumerable});return i};var gr=(i,r,t)=>(t=i!=null?yr(Br(i)):{},dr(r||!i||!i.__esModule?H(t,"default",{value:i,enumerable:!0}):t,i));var z=N(S=>{"use strict";S.byteLength=Ir;S.toByteArray=Ar;S.fromByteArray=Rr;var B=[],w=[],mr=typeof Uint8Array<"u"?Uint8Array:Array,M="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(m=0,V=M.length;m<V;++m)B[m]=M[m],w[M.charCodeAt(m)]=m;var m,V;w[45]=62;w[95]=63;function X(i){var r=i.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=i.indexOf("=");t===-1&&(t=r);var n=t===r?0:4-t%4;return[t,n]}function Ir(i){var r=X(i),t=r[0],n=r[1];return(t+n)*3/4-n}function Fr(i,r,t){return(r+t)*3/4-t}function Ar(i){var r,t=X(i),n=t[0],e=t[1],o=new mr(Fr(i,n,e)),u=0,f=e>0?n-4:n,c;for(c=0;c<f;c+=4)r=w[i.charCodeAt(c)]<<18|w[i.charCodeAt(c+1)]<<12|w[i.charCodeAt(c+2)]<<6|w[i.charCodeAt(c+3)],o[u++]=r>>16&255,o[u++]=r>>8&255,o[u++]=r&255;return e===2&&(r=w[i.charCodeAt(c)]<<2|w[i.charCodeAt(c+1)]>>4,o[u++]=r&255),e===1&&(r=w[i.charCodeAt(c)]<<10|w[i.charCodeAt(c+1)]<<4|w[i.charCodeAt(c+2)]>>2,o[u++]=r>>8&255,o[u++]=r&255),o}function Ur(i){return B[i>>18&63]+B[i>>12&63]+B[i>>6&63]+B[i&63]}function Tr(i,r,t){for(var n,e=[],o=r;o<t;o+=3)n=(i[o]<<16&16711680)+(i[o+1]<<8&65280)+(i[o+2]&255),e.push(Ur(n));return e.join("")}function Rr(i){for(var r,t=i.length,n=t%3,e=[],o=16383,u=0,f=t-n;u<f;u+=o)e.push(Tr(i,u,u+o>f?f:u+o));return n===1?(r=i[t-1],e.push(B[r>>2]+B[r<<4&63]+"==")):n===2&&(r=(i[t-2]<<8)+i[t-1],e.push(B[r>>10]+B[r>>4&63]+B[r<<2&63]+"=")),e.join("")}});var J=N(k=>{k.read=function(i,r,t,n,e){var o,u,f=e*8-n-1,c=(1<<f)-1,l=c>>1,s=-7,p=t?e-1:0,F=t?-1:1,x=i[r+p];for(p+=F,o=x&(1<<-s)-1,x>>=-s,s+=f;s>0;o=o*256+i[r+p],p+=F,s-=8);for(u=o&(1<<-s)-1,o>>=-s,s+=n;s>0;u=u*256+i[r+p],p+=F,s-=8);if(o===0)o=1-l;else{if(o===c)return u?NaN:(x?-1:1)*(1/0);u=u+Math.pow(2,n),o=o-l}return(x?-1:1)*u*Math.pow(2,o-n)};k.write=function(i,r,t,n,e,o){var u,f,c,l=o*8-e-1,s=(1<<l)-1,p=s>>1,F=e===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=n?0:o-1,L=n?1:-1,ar=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(f=isNaN(r)?1:0,u=s):(u=Math.floor(Math.log(r)/Math.LN2),r*(c=Math.pow(2,-u))<1&&(u--,c*=2),u+p>=1?r+=F/c:r+=F*Math.pow(2,1-p),r*c>=2&&(u++,c/=2),u+p>=s?(f=0,u=s):u+p>=1?(f=(r*c-1)*Math.pow(2,e),u=u+p):(f=r*Math.pow(2,p-1)*Math.pow(2,e),u=0));e>=8;i[t+x]=f&255,x+=L,f/=256,e-=8);for(u=u<<e|f,l+=e;l>0;i[t+x]=u&255,x+=L,u/=256,l-=8);i[t+x-L]|=ar*128}});var lr=N(R=>{"use strict";var D=z(),U=J(),K=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;R.Buffer=h;R.SlowBuffer=Nr;R.INSPECT_MAX_BYTES=50;var _=2147483647;R.kMaxLength=_;h.TYPED_ARRAY_SUPPORT=Cr();!h.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Cr(){try{let i=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(i,r),i.foo()===42}catch{return!1}}Object.defineProperty(h.prototype,"parent",{enumerable:!0,get:function(){if(h.isBuffer(this))return this.buffer}});Object.defineProperty(h.prototype,"offset",{enumerable:!0,get:function(){if(h.isBuffer(this))return this.byteOffset}});function d(i){if(i>_)throw new RangeError('The value "'+i+'" is invalid for option "size"');let r=new Uint8Array(i);return Object.setPrototypeOf(r,h.prototype),r}function h(i,r,t){if(typeof i=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return G(i)}return rr(i,r,t)}h.poolSize=8192;function rr(i,r,t){if(typeof i=="string")return _r(i,r);if(ArrayBuffer.isView(i))return br(i);if(i==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i);if(E(i,ArrayBuffer)||i&&E(i.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(E(i,SharedArrayBuffer)||i&&E(i.buffer,SharedArrayBuffer)))return P(i,r,t);if(typeof i=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=i.valueOf&&i.valueOf();if(n!=null&&n!==i)return h.from(n,r,t);let e=Lr(i);if(e)return e;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof i[Symbol.toPrimitive]=="function")return h.from(i[Symbol.toPrimitive]("string"),r,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i)}h.from=function(i,r,t){return rr(i,r,t)};Object.setPrototypeOf(h.prototype,Uint8Array.prototype);Object.setPrototypeOf(h,Uint8Array);function tr(i){if(typeof i!="number")throw new TypeError('"size" argument must be of type number');if(i<0)throw new RangeError('The value "'+i+'" is invalid for option "size"')}function Sr(i,r,t){return tr(i),i<=0?d(i):r!==void 0?typeof t=="string"?d(i).fill(r,t):d(i).fill(r):d(i)}h.alloc=function(i,r,t){return Sr(i,r,t)};function G(i){return tr(i),d(i<0?0:Y(i)|0)}h.allocUnsafe=function(i){return G(i)};h.allocUnsafeSlow=function(i){return G(i)};function _r(i,r){if((typeof r!="string"||r==="")&&(r="utf8"),!h.isEncoding(r))throw new TypeError("Unknown encoding: "+r);let t=ir(i,r)|0,n=d(t),e=n.write(i,r);return e!==t&&(n=n.slice(0,e)),n}function $(i){let r=i.length<0?0:Y(i.length)|0,t=d(r);for(let n=0;n<r;n+=1)t[n]=i[n]&255;return t}function br(i){if(E(i,Uint8Array)){let r=new Uint8Array(i);return P(r.buffer,r.byteOffset,r.byteLength)}return $(i)}function P(i,r,t){if(r<0||i.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(i.byteLength<r+(t||0))throw new RangeError('"length" is outside of buffer bounds');let n;return r===void 0&&t===void 0?n=new Uint8Array(i):t===void 0?n=new Uint8Array(i,r):n=new Uint8Array(i,r,t),Object.setPrototypeOf(n,h.prototype),n}function Lr(i){if(h.isBuffer(i)){let r=Y(i.length)|0,t=d(r);return t.length===0||i.copy(t,0,0,r),t}if(i.length!==void 0)return typeof i.length!="number"||W(i.length)?d(0):$(i);if(i.type==="Buffer"&&Array.isArray(i.data))return $(i.data)}function Y(i){if(i>=_)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+_.toString(16)+" bytes");return i|0}function Nr(i){return+i!=i&&(i=0),h.alloc(+i)}h.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==h.prototype};h.compare=function(r,t){if(E(r,Uint8Array)&&(r=h.from(r,r.offset,r.byteLength)),E(t,Uint8Array)&&(t=h.from(t,t.offset,t.byteLength)),!h.isBuffer(r)||!h.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===t)return 0;let n=r.length,e=t.length;for(let o=0,u=Math.min(n,e);o<u;++o)if(r[o]!==t[o]){n=r[o],e=t[o];break}return n<e?-1:e<n?1:0};h.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};h.concat=function(r,t){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return h.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<r.length;++n)t+=r[n].length;let e=h.allocUnsafe(t),o=0;for(n=0;n<r.length;++n){let u=r[n];if(E(u,Uint8Array))o+u.length>e.length?(h.isBuffer(u)||(u=h.from(u)),u.copy(e,o)):Uint8Array.prototype.set.call(e,u,o);else if(h.isBuffer(u))u.copy(e,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=u.length}return e};function ir(i,r){if(h.isBuffer(i))return i.length;if(ArrayBuffer.isView(i)||E(i,ArrayBuffer))return i.byteLength;if(typeof i!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof i);let t=i.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&t===0)return 0;let e=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return O(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return sr(i).length;default:if(e)return n?-1:O(i).length;r=(""+r).toLowerCase(),e=!0}}h.byteLength=ir;function Mr(i,r,t){let n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,r>>>=0,t<=r))return"";for(i||(i="utf8");;)switch(i){case"hex":return jr(this,r,t);case"utf8":case"utf-8":return er(this,r,t);case"ascii":return qr(this,r,t);case"latin1":case"binary":return Wr(this,r,t);case"base64":return Gr(this,r,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Hr(this,r,t);default:if(n)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),n=!0}}h.prototype._isBuffer=!0;function I(i,r,t){let n=i[r];i[r]=i[t],i[t]=n}h.prototype.swap16=function(){let r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<r;t+=2)I(this,t,t+1);return this};h.prototype.swap32=function(){let r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<r;t+=4)I(this,t,t+3),I(this,t+1,t+2);return this};h.prototype.swap64=function(){let r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<r;t+=8)I(this,t,t+7),I(this,t+1,t+6),I(this,t+2,t+5),I(this,t+3,t+4);return this};h.prototype.toString=function(){let r=this.length;return r===0?"":arguments.length===0?er(this,0,r):Mr.apply(this,arguments)};h.prototype.toLocaleString=h.prototype.toString;h.prototype.equals=function(r){if(!h.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:h.compare(this,r)===0};h.prototype.inspect=function(){let r="",t=R.INSPECT_MAX_BYTES;return r=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(r+=" ... "),"<Buffer "+r+">"};K&&(h.prototype[K]=h.prototype.inspect);h.prototype.compare=function(r,t,n,e,o){if(E(r,Uint8Array)&&(r=h.from(r,r.offset,r.byteLength)),!h.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(t===void 0&&(t=0),n===void 0&&(n=r?r.length:0),e===void 0&&(e=0),o===void 0&&(o=this.length),t<0||n>r.length||e<0||o>this.length)throw new RangeError("out of range index");if(e>=o&&t>=n)return 0;if(e>=o)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,e>>>=0,o>>>=0,this===r)return 0;let u=o-e,f=n-t,c=Math.min(u,f),l=this.slice(e,o),s=r.slice(t,n);for(let p=0;p<c;++p)if(l[p]!==s[p]){u=l[p],f=s[p];break}return u<f?-1:f<u?1:0};function nr(i,r,t,n,e){if(i.length===0)return-1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,W(t)&&(t=e?0:i.length-1),t<0&&(t=i.length+t),t>=i.length){if(e)return-1;t=i.length-1}else if(t<0)if(e)t=0;else return-1;if(typeof r=="string"&&(r=h.from(r,n)),h.isBuffer(r))return r.length===0?-1:Z(i,r,t,n,e);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?e?Uint8Array.prototype.indexOf.call(i,r,t):Uint8Array.prototype.lastIndexOf.call(i,r,t):Z(i,[r],t,n,e);throw new TypeError("val must be string, number or Buffer")}function Z(i,r,t,n,e){let o=1,u=i.length,f=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(i.length<2||r.length<2)return-1;o=2,u/=2,f/=2,t/=2}function c(s,p){return o===1?s[p]:s.readUInt16BE(p*o)}let l;if(e){let s=-1;for(l=t;l<u;l++)if(c(i,l)===c(r,s===-1?0:l-s)){if(s===-1&&(s=l),l-s+1===f)return s*o}else s!==-1&&(l-=l-s),s=-1}else for(t+f>u&&(t=u-f),l=t;l>=0;l--){let s=!0;for(let p=0;p<f;p++)if(c(i,l+p)!==c(r,p)){s=!1;break}if(s)return l}return-1}h.prototype.includes=function(r,t,n){return this.indexOf(r,t,n)!==-1};h.prototype.indexOf=function(r,t,n){return nr(this,r,t,n,!0)};h.prototype.lastIndexOf=function(r,t,n){return nr(this,r,t,n,!1)};function kr(i,r,t,n){t=Number(t)||0;let e=i.length-t;n?(n=Number(n),n>e&&(n=e)):n=e;let o=r.length;n>o/2&&(n=o/2);let u;for(u=0;u<n;++u){let f=parseInt(r.substr(u*2,2),16);if(W(f))return u;i[t+u]=f}return u}function Dr(i,r,t,n){return b(O(r,i.length-t),i,t,n)}function $r(i,r,t,n){return b(Jr(r),i,t,n)}function Pr(i,r,t,n){return b(sr(r),i,t,n)}function Or(i,r,t,n){return b(Kr(r,i.length-t),i,t,n)}h.prototype.write=function(r,t,n,e){if(t===void 0)e="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")e=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,e===void 0&&(e="utf8")):(e=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-t;if((n===void 0||n>o)&&(n=o),r.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");e||(e="utf8");let u=!1;for(;;)switch(e){case"hex":return kr(this,r,t,n);case"utf8":case"utf-8":return Dr(this,r,t,n);case"ascii":case"latin1":case"binary":return $r(this,r,t,n);case"base64":return Pr(this,r,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Or(this,r,t,n);default:if(u)throw new TypeError("Unknown encoding: "+e);e=(""+e).toLowerCase(),u=!0}};h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Gr(i,r,t){return r===0&&t===i.length?D.fromByteArray(i):D.fromByteArray(i.slice(r,t))}function er(i,r,t){t=Math.min(i.length,t);let n=[],e=r;for(;e<t;){let o=i[e],u=null,f=o>239?4:o>223?3:o>191?2:1;if(e+f<=t){let c,l,s,p;switch(f){case 1:o<128&&(u=o);break;case 2:c=i[e+1],(c&192)===128&&(p=(o&31)<<6|c&63,p>127&&(u=p));break;case 3:c=i[e+1],l=i[e+2],(c&192)===128&&(l&192)===128&&(p=(o&15)<<12|(c&63)<<6|l&63,p>2047&&(p<55296||p>57343)&&(u=p));break;case 4:c=i[e+1],l=i[e+2],s=i[e+3],(c&192)===128&&(l&192)===128&&(s&192)===128&&(p=(o&15)<<18|(c&63)<<12|(l&63)<<6|s&63,p>65535&&p<1114112&&(u=p))}}u===null?(u=65533,f=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|u&1023),n.push(u),e+=f}return Yr(n)}var Q=4096;function Yr(i){let r=i.length;if(r<=Q)return String.fromCharCode.apply(String,i);let t="",n=0;for(;n<r;)t+=String.fromCharCode.apply(String,i.slice(n,n+=Q));return t}function qr(i,r,t){let n="";t=Math.min(i.length,t);for(let e=r;e<t;++e)n+=String.fromCharCode(i[e]&127);return n}function Wr(i,r,t){let n="";t=Math.min(i.length,t);for(let e=r;e<t;++e)n+=String.fromCharCode(i[e]);return n}function jr(i,r,t){let n=i.length;(!r||r<0)&&(r=0),(!t||t<0||t>n)&&(t=n);let e="";for(let o=r;o<t;++o)e+=Zr[i[o]];return e}function Hr(i,r,t){let n=i.slice(r,t),e="";for(let o=0;o<n.length-1;o+=2)e+=String.fromCharCode(n[o]+n[o+1]*256);return e}h.prototype.slice=function(r,t){let n=this.length;r=~~r,t=t===void 0?n:~~t,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<r&&(t=r);let e=this.subarray(r,t);return Object.setPrototypeOf(e,h.prototype),e};function a(i,r,t){if(i%1!==0||i<0)throw new RangeError("offset is not uint");if(i+r>t)throw new RangeError("Trying to access beyond buffer length")}h.prototype.readUintLE=h.prototype.readUIntLE=function(r,t,n){r=r>>>0,t=t>>>0,n||a(r,t,this.length);let e=this[r],o=1,u=0;for(;++u<t&&(o*=256);)e+=this[r+u]*o;return e};h.prototype.readUintBE=h.prototype.readUIntBE=function(r,t,n){r=r>>>0,t=t>>>0,n||a(r,t,this.length);let e=this[r+--t],o=1;for(;t>0&&(o*=256);)e+=this[r+--t]*o;return e};h.prototype.readUint8=h.prototype.readUInt8=function(r,t){return r=r>>>0,t||a(r,1,this.length),this[r]};h.prototype.readUint16LE=h.prototype.readUInt16LE=function(r,t){return r=r>>>0,t||a(r,2,this.length),this[r]|this[r+1]<<8};h.prototype.readUint16BE=h.prototype.readUInt16BE=function(r,t){return r=r>>>0,t||a(r,2,this.length),this[r]<<8|this[r+1]};h.prototype.readUint32LE=h.prototype.readUInt32LE=function(r,t){return r=r>>>0,t||a(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};h.prototype.readUint32BE=h.prototype.readUInt32BE=function(r,t){return r=r>>>0,t||a(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};h.prototype.readBigUInt64LE=g(function(r){r=r>>>0,T(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&C(r,this.length-8);let e=t+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24,o=this[++r]+this[++r]*2**8+this[++r]*2**16+n*2**24;return BigInt(e)+(BigInt(o)<<BigInt(32))});h.prototype.readBigUInt64BE=g(function(r){r=r>>>0,T(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&C(r,this.length-8);let e=t*2**24+this[++r]*2**16+this[++r]*2**8+this[++r],o=this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+n;return(BigInt(e)<<BigInt(32))+BigInt(o)});h.prototype.readIntLE=function(r,t,n){r=r>>>0,t=t>>>0,n||a(r,t,this.length);let e=this[r],o=1,u=0;for(;++u<t&&(o*=256);)e+=this[r+u]*o;return o*=128,e>=o&&(e-=Math.pow(2,8*t)),e};h.prototype.readIntBE=function(r,t,n){r=r>>>0,t=t>>>0,n||a(r,t,this.length);let e=t,o=1,u=this[r+--e];for(;e>0&&(o*=256);)u+=this[r+--e]*o;return o*=128,u>=o&&(u-=Math.pow(2,8*t)),u};h.prototype.readInt8=function(r,t){return r=r>>>0,t||a(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};h.prototype.readInt16LE=function(r,t){r=r>>>0,t||a(r,2,this.length);let n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};h.prototype.readInt16BE=function(r,t){r=r>>>0,t||a(r,2,this.length);let n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};h.prototype.readInt32LE=function(r,t){return r=r>>>0,t||a(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};h.prototype.readInt32BE=function(r,t){return r=r>>>0,t||a(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};h.prototype.readBigInt64LE=g(function(r){r=r>>>0,T(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&C(r,this.length-8);let e=this[r+4]+this[r+5]*2**8+this[r+6]*2**16+(n<<24);return(BigInt(e)<<BigInt(32))+BigInt(t+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24)});h.prototype.readBigInt64BE=g(function(r){r=r>>>0,T(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&C(r,this.length-8);let e=(t<<24)+this[++r]*2**16+this[++r]*2**8+this[++r];return(BigInt(e)<<BigInt(32))+BigInt(this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+n)});h.prototype.readFloatLE=function(r,t){return r=r>>>0,t||a(r,4,this.length),U.read(this,r,!0,23,4)};h.prototype.readFloatBE=function(r,t){return r=r>>>0,t||a(r,4,this.length),U.read(this,r,!1,23,4)};h.prototype.readDoubleLE=function(r,t){return r=r>>>0,t||a(r,8,this.length),U.read(this,r,!0,52,8)};h.prototype.readDoubleBE=function(r,t){return r=r>>>0,t||a(r,8,this.length),U.read(this,r,!1,52,8)};function y(i,r,t,n,e,o){if(!h.isBuffer(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>e||r<o)throw new RangeError('"value" argument is out of bounds');if(t+n>i.length)throw new RangeError("Index out of range")}h.prototype.writeUintLE=h.prototype.writeUIntLE=function(r,t,n,e){if(r=+r,t=t>>>0,n=n>>>0,!e){let f=Math.pow(2,8*n)-1;y(this,r,t,n,f,0)}let o=1,u=0;for(this[t]=r&255;++u<n&&(o*=256);)this[t+u]=r/o&255;return t+n};h.prototype.writeUintBE=h.prototype.writeUIntBE=function(r,t,n,e){if(r=+r,t=t>>>0,n=n>>>0,!e){let f=Math.pow(2,8*n)-1;y(this,r,t,n,f,0)}let o=n-1,u=1;for(this[t+o]=r&255;--o>=0&&(u*=256);)this[t+o]=r/u&255;return t+n};h.prototype.writeUint8=h.prototype.writeUInt8=function(r,t,n){return r=+r,t=t>>>0,n||y(this,r,t,1,255,0),this[t]=r&255,t+1};h.prototype.writeUint16LE=h.prototype.writeUInt16LE=function(r,t,n){return r=+r,t=t>>>0,n||y(this,r,t,2,65535,0),this[t]=r&255,this[t+1]=r>>>8,t+2};h.prototype.writeUint16BE=h.prototype.writeUInt16BE=function(r,t,n){return r=+r,t=t>>>0,n||y(this,r,t,2,65535,0),this[t]=r>>>8,this[t+1]=r&255,t+2};h.prototype.writeUint32LE=h.prototype.writeUInt32LE=function(r,t,n){return r=+r,t=t>>>0,n||y(this,r,t,4,4294967295,0),this[t+3]=r>>>24,this[t+2]=r>>>16,this[t+1]=r>>>8,this[t]=r&255,t+4};h.prototype.writeUint32BE=h.prototype.writeUInt32BE=function(r,t,n){return r=+r,t=t>>>0,n||y(this,r,t,4,4294967295,0),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};function or(i,r,t,n,e){pr(r,n,e,i,t,7);let o=Number(r&BigInt(4294967295));i[t++]=o,o=o>>8,i[t++]=o,o=o>>8,i[t++]=o,o=o>>8,i[t++]=o;let u=Number(r>>BigInt(32)&BigInt(4294967295));return i[t++]=u,u=u>>8,i[t++]=u,u=u>>8,i[t++]=u,u=u>>8,i[t++]=u,t}function ur(i,r,t,n,e){pr(r,n,e,i,t,7);let o=Number(r&BigInt(4294967295));i[t+7]=o,o=o>>8,i[t+6]=o,o=o>>8,i[t+5]=o,o=o>>8,i[t+4]=o;let u=Number(r>>BigInt(32)&BigInt(4294967295));return i[t+3]=u,u=u>>8,i[t+2]=u,u=u>>8,i[t+1]=u,u=u>>8,i[t]=u,t+8}h.prototype.writeBigUInt64LE=g(function(r,t=0){return or(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))});h.prototype.writeBigUInt64BE=g(function(r,t=0){return ur(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))});h.prototype.writeIntLE=function(r,t,n,e){if(r=+r,t=t>>>0,!e){let c=Math.pow(2,8*n-1);y(this,r,t,n,c-1,-c)}let o=0,u=1,f=0;for(this[t]=r&255;++o<n&&(u*=256);)r<0&&f===0&&this[t+o-1]!==0&&(f=1),this[t+o]=(r/u>>0)-f&255;return t+n};h.prototype.writeIntBE=function(r,t,n,e){if(r=+r,t=t>>>0,!e){let c=Math.pow(2,8*n-1);y(this,r,t,n,c-1,-c)}let o=n-1,u=1,f=0;for(this[t+o]=r&255;--o>=0&&(u*=256);)r<0&&f===0&&this[t+o+1]!==0&&(f=1),this[t+o]=(r/u>>0)-f&255;return t+n};h.prototype.writeInt8=function(r,t,n){return r=+r,t=t>>>0,n||y(this,r,t,1,127,-128),r<0&&(r=255+r+1),this[t]=r&255,t+1};h.prototype.writeInt16LE=function(r,t,n){return r=+r,t=t>>>0,n||y(this,r,t,2,32767,-32768),this[t]=r&255,this[t+1]=r>>>8,t+2};h.prototype.writeInt16BE=function(r,t,n){return r=+r,t=t>>>0,n||y(this,r,t,2,32767,-32768),this[t]=r>>>8,this[t+1]=r&255,t+2};h.prototype.writeInt32LE=function(r,t,n){return r=+r,t=t>>>0,n||y(this,r,t,4,2147483647,-2147483648),this[t]=r&255,this[t+1]=r>>>8,this[t+2]=r>>>16,this[t+3]=r>>>24,t+4};h.prototype.writeInt32BE=function(r,t,n){return r=+r,t=t>>>0,n||y(this,r,t,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};h.prototype.writeBigInt64LE=g(function(r,t=0){return or(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});h.prototype.writeBigInt64BE=g(function(r,t=0){return ur(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function hr(i,r,t,n,e,o){if(t+n>i.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function fr(i,r,t,n,e){return r=+r,t=t>>>0,e||hr(i,r,t,4,34028234663852886e22,-34028234663852886e22),U.write(i,r,t,n,23,4),t+4}h.prototype.writeFloatLE=function(r,t,n){return fr(this,r,t,!0,n)};h.prototype.writeFloatBE=function(r,t,n){return fr(this,r,t,!1,n)};function cr(i,r,t,n,e){return r=+r,t=t>>>0,e||hr(i,r,t,8,17976931348623157e292,-17976931348623157e292),U.write(i,r,t,n,52,8),t+8}h.prototype.writeDoubleLE=function(r,t,n){return cr(this,r,t,!0,n)};h.prototype.writeDoubleBE=function(r,t,n){return cr(this,r,t,!1,n)};h.prototype.copy=function(r,t,n,e){if(!h.isBuffer(r))throw new TypeError("argument should be a Buffer");if(n||(n=0),!e&&e!==0&&(e=this.length),t>=r.length&&(t=r.length),t||(t=0),e>0&&e<n&&(e=n),e===n||r.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("sourceEnd out of bounds");e>this.length&&(e=this.length),r.length-t<e-n&&(e=r.length-t+n);let o=e-n;return this===r&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,e):Uint8Array.prototype.set.call(r,this.subarray(n,e),t),o};h.prototype.fill=function(r,t,n,e){if(typeof r=="string"){if(typeof t=="string"?(e=t,t=0,n=this.length):typeof n=="string"&&(e=n,n=this.length),e!==void 0&&typeof e!="string")throw new TypeError("encoding must be a string");if(typeof e=="string"&&!h.isEncoding(e))throw new TypeError("Unknown encoding: "+e);if(r.length===1){let u=r.charCodeAt(0);(e==="utf8"&&u<128||e==="latin1")&&(r=u)}}else typeof r=="number"?r=r&255:typeof r=="boolean"&&(r=Number(r));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);let o;if(typeof r=="number")for(o=t;o<n;++o)this[o]=r;else{let u=h.isBuffer(r)?r:h.from(r,e),f=u.length;if(f===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(o=0;o<n-t;++o)this[o+t]=u[o%f]}return this};var A={};function q(i,r,t){A[i]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:r.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${i}]`,this.stack,delete this.name}get code(){return i}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${i}]: ${this.message}`}}}q("ERR_BUFFER_OUT_OF_BOUNDS",function(i){return i?`${i} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);q("ERR_INVALID_ARG_TYPE",function(i,r){return`The "${i}" argument must be of type number. Received type ${typeof r}`},TypeError);q("ERR_OUT_OF_RANGE",function(i,r,t){let n=`The value of "${i}" is out of range.`,e=t;return Number.isInteger(t)&&Math.abs(t)>2**32?e=v(String(t)):typeof t=="bigint"&&(e=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(e=v(e)),e+="n"),n+=` It must be ${r}. Received ${e}`,n},RangeError);function v(i){let r="",t=i.length,n=i[0]==="-"?1:0;for(;t>=n+4;t-=3)r=`_${i.slice(t-3,t)}${r}`;return`${i.slice(0,t)}${r}`}function Vr(i,r,t){T(r,"offset"),(i[r]===void 0||i[r+t]===void 0)&&C(r,i.length-(t+1))}function pr(i,r,t,n,e,o){if(i>t||i<r){let u=typeof r=="bigint"?"n":"",f;throw o>3?r===0||r===BigInt(0)?f=`>= 0${u} and < 2${u} ** ${(o+1)*8}${u}`:f=`>= -(2${u} ** ${(o+1)*8-1}${u}) and < 2 ** ${(o+1)*8-1}${u}`:f=`>= ${r}${u} and <= ${t}${u}`,new A.ERR_OUT_OF_RANGE("value",f,i)}Vr(n,e,o)}function T(i,r){if(typeof i!="number")throw new A.ERR_INVALID_ARG_TYPE(r,"number",i)}function C(i,r,t){throw Math.floor(i)!==i?(T(i,t),new A.ERR_OUT_OF_RANGE(t||"offset","an integer",i)):r<0?new A.ERR_BUFFER_OUT_OF_BOUNDS:new A.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${r}`,i)}var Xr=/[^+/0-9A-Za-z-_]/g;function zr(i){if(i=i.split("=")[0],i=i.trim().replace(Xr,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function O(i,r){r=r||1/0;let t,n=i.length,e=null,o=[];for(let u=0;u<n;++u){if(t=i.charCodeAt(u),t>55295&&t<57344){if(!e){if(t>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(u+1===n){(r-=3)>-1&&o.push(239,191,189);continue}e=t;continue}if(t<56320){(r-=3)>-1&&o.push(239,191,189),e=t;continue}t=(e-55296<<10|t-56320)+65536}else e&&(r-=3)>-1&&o.push(239,191,189);if(e=null,t<128){if((r-=1)<0)break;o.push(t)}else if(t<2048){if((r-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((r-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((r-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}function Jr(i){let r=[];for(let t=0;t<i.length;++t)r.push(i.charCodeAt(t)&255);return r}function Kr(i,r){let t,n,e,o=[];for(let u=0;u<i.length&&!((r-=2)<0);++u)t=i.charCodeAt(u),n=t>>8,e=t%256,o.push(e),o.push(n);return o}function sr(i){return D.toByteArray(zr(i))}function b(i,r,t,n){let e;for(e=0;e<n&&!(e+t>=r.length||e>=i.length);++e)r[e+t]=i[e];return e}function E(i,r){return i instanceof r||i!=null&&i.constructor!=null&&i.constructor.name!=null&&i.constructor.name===r.name}function W(i){return i!==i}var Zr=(function(){let i="0123456789abcdef",r=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let e=0;e<16;++e)r[n+e]=i[t]+i[e]}return r})();function g(i){return typeof BigInt>"u"?Qr:i}function Qr(){throw new Error("BigInt not supported")}});var j=gr(lr());typeof window<"u"&&(window.Buffer=j.Buffer,window.global=window.global||window,window.process=window.process||{env:{},browser:!0,version:""});typeof globalThis<"u"&&(globalThis.Buffer=j.Buffer,globalThis.global=globalThis.global||globalThis,globalThis.process=globalThis.process||{env:{},browser:!0,version:""});})();
|
|
2
|
+
/*! Bundled license information:
|
|
3
|
+
|
|
4
|
+
ieee754/index.js:
|
|
5
|
+
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
6
|
+
|
|
7
|
+
buffer/index.js:
|
|
8
|
+
(*!
|
|
9
|
+
* The buffer module from node.js, for the browser.
|
|
10
|
+
*
|
|
11
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
12
|
+
* @license MIT
|
|
13
|
+
*)
|
|
14
|
+
*/
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ClmRegistryComponentViewlet — renders sharded CLM-registry components and app
|
|
3
|
+
* cartridges inside Dockview tabs (SMR-10 · DoD-SMR-10-03).
|
|
4
|
+
*
|
|
5
|
+
* The monolithic `LandingPage/clm-registry.yaml` is sharded into content-addressed
|
|
6
|
+
* MCards (`urn:mcard:registry:component:<id>`, `urn:mcard:registry:fiber:<id>`), so
|
|
7
|
+
* each tab renders one descriptor: its abstract / concrete / balanced faces for a
|
|
8
|
+
* component, or its hydration and budget contract for a portal island cartridge.
|
|
9
|
+
*
|
|
10
|
+
* Registered as `pcard:render/clm-registry-component` in the renderer PCard registry
|
|
11
|
+
* and as module `ClmRegistryComponentViewlet` in the viewlet module map.
|
|
12
|
+
*
|
|
13
|
+
* Contract D budget: <= 220 LOC.
|
|
14
|
+
*/
|
|
15
|
+
import React from 'react';
|
|
16
|
+
|
|
17
|
+
import type { CardViewletProps } from './types';
|
|
18
|
+
|
|
19
|
+
interface ComponentDescriptor {
|
|
20
|
+
readonly hash?: string;
|
|
21
|
+
readonly name?: string;
|
|
22
|
+
readonly abstract?: Record<string, unknown>;
|
|
23
|
+
readonly concrete?: Record<string, unknown>;
|
|
24
|
+
readonly balanced?: Record<string, unknown>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface IslandCartridge {
|
|
28
|
+
readonly url?: string;
|
|
29
|
+
readonly kind?: string;
|
|
30
|
+
readonly hydration?: string;
|
|
31
|
+
readonly isolation?: string;
|
|
32
|
+
readonly budget?: { readonly max_bytes?: number; readonly observed_bytes?: number };
|
|
33
|
+
readonly metrics_endpoint?: string;
|
|
34
|
+
readonly island_mcard?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface RegistryDescriptor extends ComponentDescriptor, IslandCartridge {
|
|
38
|
+
readonly kind?: string;
|
|
39
|
+
readonly renderer?: string;
|
|
40
|
+
readonly payload_shape?: string;
|
|
41
|
+
readonly content_class?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Parses the descriptor body; returns null when the content is not a registry record. */
|
|
45
|
+
export function parseRegistryDescriptor(raw?: string): RegistryDescriptor | null {
|
|
46
|
+
if (!raw) return null;
|
|
47
|
+
try {
|
|
48
|
+
const parsed = JSON.parse(raw);
|
|
49
|
+
return parsed && typeof parsed === 'object' ? (parsed as RegistryDescriptor) : null;
|
|
50
|
+
} catch {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** True when the descriptor is a portal island cartridge rather than a component. */
|
|
56
|
+
export function isIslandCartridge(descriptor: RegistryDescriptor | null): boolean {
|
|
57
|
+
return Boolean(descriptor && (descriptor.island_mcard || descriptor.hydration || descriptor.url));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Renders the three CLM faces of a sharded component. */
|
|
61
|
+
export const FaceGrid: React.FC<{ descriptor: ComponentDescriptor }> = ({ descriptor }) => (
|
|
62
|
+
<div className="clm-registry-faces">
|
|
63
|
+
{(['abstract', 'concrete', 'balanced'] as const).map((face) => (
|
|
64
|
+
<section key={face} className={`clm-registry-face clm-registry-face--${face}`}>
|
|
65
|
+
<h4>{face}</h4>
|
|
66
|
+
<pre>{JSON.stringify(descriptor[face] ?? {}, null, 2)}</pre>
|
|
67
|
+
</section>
|
|
68
|
+
))}
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
/** Renders a portal island's cartridge contract. */
|
|
73
|
+
export const CartridgeContract: React.FC<{ cartridge: IslandCartridge }> = ({ cartridge }) => (
|
|
74
|
+
<dl className="clm-registry-cartridge">
|
|
75
|
+
<dt>URL</dt>
|
|
76
|
+
<dd>
|
|
77
|
+
<code>{cartridge.url ?? '(none)'}</code>
|
|
78
|
+
</dd>
|
|
79
|
+
<dt>Kind</dt>
|
|
80
|
+
<dd>{cartridge.kind ?? 'unknown'}</dd>
|
|
81
|
+
<dt>Hydration</dt>
|
|
82
|
+
<dd>{cartridge.hydration ?? 'none'}</dd>
|
|
83
|
+
<dt>Isolation</dt>
|
|
84
|
+
<dd>{cartridge.isolation ?? 'none'}</dd>
|
|
85
|
+
<dt>Budget</dt>
|
|
86
|
+
<dd>
|
|
87
|
+
{cartridge.budget?.observed_bytes ?? '?'} / {cartridge.budget?.max_bytes ?? '?'} bytes
|
|
88
|
+
</dd>
|
|
89
|
+
<dt>Metrics</dt>
|
|
90
|
+
<dd>
|
|
91
|
+
<code>{cartridge.metrics_endpoint ?? '(none)'}</code>
|
|
92
|
+
</dd>
|
|
93
|
+
</dl>
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
export const ClmRegistryComponentViewlet: React.FC<CardViewletProps> = ({ mcard, rawContent }) => {
|
|
97
|
+
const body =
|
|
98
|
+
rawContent ?? (typeof mcard?.content === 'string' ? (mcard.content as string) : undefined);
|
|
99
|
+
const descriptor = parseRegistryDescriptor(body);
|
|
100
|
+
|
|
101
|
+
if (!descriptor) {
|
|
102
|
+
return (
|
|
103
|
+
<div className="clm-registry-viewlet clm-registry-viewlet--unparsed">
|
|
104
|
+
<p>Not a sharded registry descriptor.</p>
|
|
105
|
+
<pre>{body?.slice(0, 400) ?? '(empty)'}</pre>
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const handle = mcard?.handle ?? descriptor.hash ?? '(unbound)';
|
|
111
|
+
return (
|
|
112
|
+
<div className="clm-registry-viewlet" data-handle={handle}>
|
|
113
|
+
<header className="clm-registry-header">
|
|
114
|
+
<h3>{descriptor.name ?? handle}</h3>
|
|
115
|
+
<code className="clm-registry-handle">{handle}</code>
|
|
116
|
+
</header>
|
|
117
|
+
|
|
118
|
+
{isIslandCartridge(descriptor) ? (
|
|
119
|
+
<CartridgeContract cartridge={descriptor} />
|
|
120
|
+
) : (
|
|
121
|
+
<>
|
|
122
|
+
<p className="clm-registry-kind">
|
|
123
|
+
{descriptor.kind ?? 'component'}
|
|
124
|
+
{descriptor.renderer ? ` · renderer ${descriptor.renderer}` : ''}
|
|
125
|
+
</p>
|
|
126
|
+
<FaceGrid descriptor={descriptor} />
|
|
127
|
+
</>
|
|
128
|
+
)}
|
|
129
|
+
</div>
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export default ClmRegistryComponentViewlet;
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 2D CAD Vector Blueprint Viewport (DXF)
|
|
3
|
+
* Canonical Path: src/components/studio/views/cardViewlets/DxfViewlet.tsx
|
|
4
|
+
* Contract D: <= 250 LOC.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React, { useState, useEffect, useRef, useMemo } from 'react';
|
|
8
|
+
import type { CardViewletProps } from './types';
|
|
9
|
+
import { getMediaRawUrl } from '../../../../services/mcardVfs';
|
|
10
|
+
import { FullscreenIframeModal } from './FullscreenIframeModal';
|
|
11
|
+
|
|
12
|
+
interface DxfLine { type: 'LINE'; x1: number; y1: number; x2: number; y2: number; layer: string }
|
|
13
|
+
interface DxfCircle { type: 'CIRCLE'; cx: number; cy: number; r: number; layer: string }
|
|
14
|
+
interface DxfArc { type: 'ARC'; cx: number; cy: number; r: number; startAngle: number; endAngle: number; layer: string }
|
|
15
|
+
interface DxfPolyline { type: 'LWPOLYLINE'; points: Array<{ x: number; y: number }>; closed: boolean; layer: string }
|
|
16
|
+
type DxfEntity = DxfLine | DxfCircle | DxfArc | DxfPolyline;
|
|
17
|
+
|
|
18
|
+
function parseDxfEntities(text: string): { entities: DxfEntity[]; bbox: { minX: number; minY: number; maxX: number; maxY: number } } {
|
|
19
|
+
const lines = text.split(/\r?\n/).map((l) => l.trim());
|
|
20
|
+
const entities: DxfEntity[] = [];
|
|
21
|
+
let inEntities = false;
|
|
22
|
+
let cur: any = null;
|
|
23
|
+
|
|
24
|
+
for (let i = 0; i < lines.length - 1; i += 2) {
|
|
25
|
+
const code = parseInt(lines[i], 10);
|
|
26
|
+
const val = lines[i + 1];
|
|
27
|
+
if (code === 0) {
|
|
28
|
+
if (cur) entities.push(cur);
|
|
29
|
+
cur = null;
|
|
30
|
+
if (val === 'SECTION') continue;
|
|
31
|
+
if (val === 'ENDSEC') { inEntities = false; continue; }
|
|
32
|
+
if (inEntities) {
|
|
33
|
+
if (val === 'LINE') cur = { type: 'LINE', x1: 0, y1: 0, x2: 0, y2: 0, layer: '0' };
|
|
34
|
+
else if (val === 'CIRCLE') cur = { type: 'CIRCLE', cx: 0, cy: 0, r: 0, layer: '0' };
|
|
35
|
+
else if (val === 'ARC') cur = { type: 'ARC', cx: 0, cy: 0, r: 0, startAngle: 0, endAngle: 360, layer: '0' };
|
|
36
|
+
else if (val === 'LWPOLYLINE') cur = { type: 'LWPOLYLINE', points: [], closed: false, layer: '0' };
|
|
37
|
+
}
|
|
38
|
+
} else if (code === 2 && val === 'ENTITIES') {
|
|
39
|
+
inEntities = true;
|
|
40
|
+
} else if (cur) {
|
|
41
|
+
if (code === 8) cur.layer = val;
|
|
42
|
+
else if (cur.type === 'LINE') {
|
|
43
|
+
if (code === 10) cur.x1 = parseFloat(val);
|
|
44
|
+
else if (code === 20) cur.y1 = parseFloat(val);
|
|
45
|
+
else if (code === 11) cur.x2 = parseFloat(val);
|
|
46
|
+
else if (code === 21) cur.y2 = parseFloat(val);
|
|
47
|
+
} else if (cur.type === 'CIRCLE' || cur.type === 'ARC') {
|
|
48
|
+
if (code === 10) cur.cx = parseFloat(val);
|
|
49
|
+
else if (code === 20) cur.cy = parseFloat(val);
|
|
50
|
+
else if (code === 40) cur.r = parseFloat(val);
|
|
51
|
+
else if (code === 50 && cur.type === 'ARC') cur.startAngle = parseFloat(val);
|
|
52
|
+
else if (code === 51 && cur.type === 'ARC') cur.endAngle = parseFloat(val);
|
|
53
|
+
} else if (cur.type === 'LWPOLYLINE') {
|
|
54
|
+
if (code === 70) cur.closed = (parseInt(val, 10) & 1) === 1;
|
|
55
|
+
else if (code === 10) cur.points.push({ x: parseFloat(val), y: 0 });
|
|
56
|
+
else if (code === 20 && cur.points.length > 0) cur.points[cur.points.length - 1].y = parseFloat(val);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (cur) entities.push(cur);
|
|
61
|
+
|
|
62
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
63
|
+
const updateBbox = (x: number, y: number) => {
|
|
64
|
+
if (!isNaN(x) && !isNaN(y)) {
|
|
65
|
+
minX = Math.min(minX, x); maxX = Math.max(maxX, x);
|
|
66
|
+
minY = Math.min(minY, y); maxY = Math.max(maxY, y);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
for (const e of entities) {
|
|
70
|
+
if (e.type === 'LINE') { updateBbox(e.x1, e.y1); updateBbox(e.x2, e.y2); }
|
|
71
|
+
else if (e.type === 'CIRCLE' || e.type === 'ARC') {
|
|
72
|
+
updateBbox(e.cx - e.r, e.cy - e.r); updateBbox(e.cx + e.r, e.cy + e.r);
|
|
73
|
+
} else if (e.type === 'LWPOLYLINE') {
|
|
74
|
+
for (const p of e.points) updateBbox(p.x, p.y);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (!isFinite(minX)) { minX = 0; minY = 0; maxX = 100; maxY = 100; }
|
|
78
|
+
return { entities, bbox: { minX, minY, maxX, maxY } };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export const DxfViewlet: React.FC<CardViewletProps> = ({ mcard }) => {
|
|
82
|
+
const filePath = mcard.path || mcard.handle || mcard.name || '';
|
|
83
|
+
const rawUrl = getMediaRawUrl(filePath, mcard.hash);
|
|
84
|
+
const [content, setContent] = useState<string>(typeof mcard.content === 'string' ? mcard.content : '');
|
|
85
|
+
const [zoom, setZoom] = useState(1);
|
|
86
|
+
const [pan, setPan] = useState({ x: 0, y: 0 });
|
|
87
|
+
const [isZenOpen, setIsZenOpen] = useState(false);
|
|
88
|
+
const [showRaw, setShowRaw] = useState(false);
|
|
89
|
+
const isDragging = useRef(false);
|
|
90
|
+
const lastMouse = useRef({ x: 0, y: 0 });
|
|
91
|
+
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
setZoom(1);
|
|
94
|
+
setPan({ x: 0, y: 0 });
|
|
95
|
+
}, [filePath]);
|
|
96
|
+
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
let active = true;
|
|
99
|
+
if (typeof mcard.content === 'string' && mcard.content.length > 0 && !mcard.content.startsWith('Content-addressed MCard:')) {
|
|
100
|
+
setContent(mcard.content);
|
|
101
|
+
} else if (rawUrl) {
|
|
102
|
+
fetch(rawUrl)
|
|
103
|
+
.then((r) => r.text())
|
|
104
|
+
.then((t) => {
|
|
105
|
+
if (active) setContent(t);
|
|
106
|
+
})
|
|
107
|
+
.catch(() => {});
|
|
108
|
+
}
|
|
109
|
+
return () => {
|
|
110
|
+
active = false;
|
|
111
|
+
};
|
|
112
|
+
}, [rawUrl, mcard.content]);
|
|
113
|
+
|
|
114
|
+
const { entities, bbox } = useMemo(() => parseDxfEntities(content), [content]);
|
|
115
|
+
const width = Math.max(1, bbox.maxX - bbox.minX);
|
|
116
|
+
const height = Math.max(1, bbox.maxY - bbox.minY);
|
|
117
|
+
const pad = Math.max(width, height) * 0.15;
|
|
118
|
+
const viewBox = `${bbox.minX - pad} ${bbox.minY - pad} ${width + pad * 2} ${height + pad * 2}`;
|
|
119
|
+
const gridStep = Math.max(1, Math.round(Math.max(width, height) / 10));
|
|
120
|
+
|
|
121
|
+
const handleMouseDown = (e: React.MouseEvent) => {
|
|
122
|
+
isDragging.current = true;
|
|
123
|
+
lastMouse.current = { x: e.clientX, y: e.clientY };
|
|
124
|
+
};
|
|
125
|
+
const handleMouseMove = (e: React.MouseEvent) => {
|
|
126
|
+
if (!isDragging.current) return;
|
|
127
|
+
const dx = (e.clientX - lastMouse.current.x) * ((width + pad * 2) / 600);
|
|
128
|
+
const dy = (e.clientY - lastMouse.current.y) * ((height + pad * 2) / 600);
|
|
129
|
+
lastMouse.current = { x: e.clientX, y: e.clientY };
|
|
130
|
+
setPan((p) => ({ x: p.x + dx, y: p.y - dy }));
|
|
131
|
+
};
|
|
132
|
+
const handleMouseUp = () => { isDragging.current = false; };
|
|
133
|
+
const handleWheel = (e: React.WheelEvent) => {
|
|
134
|
+
e.preventDefault();
|
|
135
|
+
setZoom((z) => Math.max(0.1, Math.min(25, z * (e.deltaY < 0 ? 1.15 : 0.85))));
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const strokeWidth = Math.max(0.5, pad * 0.015);
|
|
139
|
+
const strokeColor = '#00e5ff';
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<div className="card-panel-dxf-viewer" style={{ display: 'flex', flexDirection: 'column', width: '100%', height: '100%', backgroundColor: '#0d1117', color: '#c9d1d9', overflow: 'hidden' }}>
|
|
143
|
+
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '6px 12px', backgroundColor: '#161b22', borderBottom: '1px solid #30363d', fontSize: '11px' }}>
|
|
144
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
|
|
145
|
+
<span style={{ color: '#00e5ff', fontWeight: 600 }}>📐 2D CAD (DXF)</span>
|
|
146
|
+
<span style={{ color: '#8b949e' }}>{mcard.name}</span>
|
|
147
|
+
<span style={{ backgroundColor: 'rgba(0, 229, 255, 0.1)', color: '#00e5ff', padding: '1px 6px', borderRadius: '3px' }}>
|
|
148
|
+
{entities.length} entities • {width.toFixed(1)} × {height.toFixed(1)}
|
|
149
|
+
</span>
|
|
150
|
+
</div>
|
|
151
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '6px' }}>
|
|
152
|
+
<button onClick={() => setZoom((z) => Math.min(25, z * 1.2))} style={btnStyle} title="Zoom In">+</button>
|
|
153
|
+
<button onClick={() => setZoom((z) => Math.max(0.1, z * 0.8))} style={btnStyle} title="Zoom Out">-</button>
|
|
154
|
+
<button onClick={() => { setZoom(1); setPan({ x: 0, y: 0 }); }} style={btnStyle} title="Fit View">Fit</button>
|
|
155
|
+
<button onClick={() => setShowRaw(!showRaw)} style={{ ...btnStyle, color: showRaw ? '#00e5ff' : '#c9d1d9' }}>
|
|
156
|
+
{showRaw ? 'CAD View' : 'Raw Text'}
|
|
157
|
+
</button>
|
|
158
|
+
<button onClick={() => setIsZenOpen(true)} style={{ ...btnStyle, backgroundColor: '#1f6feb', color: '#fff', border: 'none' }}>Zen Mode</button>
|
|
159
|
+
{rawUrl && <a href={rawUrl} download={mcard.name} style={{ color: '#58a6ff', textDecoration: 'none', marginLeft: '4px' }}>Download ↓</a>}
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
<div style={{ flex: 1, position: 'relative', overflow: 'hidden', cursor: isDragging.current ? 'grabbing' : 'grab' }}
|
|
164
|
+
onMouseDown={handleMouseDown} onMouseMove={handleMouseMove} onMouseUp={handleMouseUp} onMouseLeave={handleMouseUp} onWheel={handleWheel}>
|
|
165
|
+
{showRaw ? (
|
|
166
|
+
<pre style={{ margin: 0, padding: '16px', width: '100%', height: '100%', overflow: 'auto', fontSize: '11px', fontFamily: 'monospace', color: '#7ee787', backgroundColor: '#0d1117' }}>
|
|
167
|
+
{content || 'Loading DXF payload...'}
|
|
168
|
+
</pre>
|
|
169
|
+
) : (
|
|
170
|
+
<svg
|
|
171
|
+
viewBox={viewBox}
|
|
172
|
+
preserveAspectRatio="xMidYMid meet"
|
|
173
|
+
style={{ width: '100%', height: '100%', display: 'block', overflow: 'hidden' }}
|
|
174
|
+
>
|
|
175
|
+
<defs>
|
|
176
|
+
<pattern id="dxf-grid-small" width={gridStep} height={gridStep} patternUnits="userSpaceOnUse">
|
|
177
|
+
<path d={`M ${gridStep} 0 L 0 0 0 ${gridStep}`} fill="none" stroke="rgba(255,255,255,0.04)" strokeWidth={strokeWidth * 0.5} />
|
|
178
|
+
</pattern>
|
|
179
|
+
</defs>
|
|
180
|
+
<rect x={bbox.minX - pad * 2} y={bbox.minY - pad * 2} width={width + pad * 4} height={height + pad * 4} fill="#0d1117" />
|
|
181
|
+
<rect x={bbox.minX - pad * 2} y={bbox.minY - pad * 2} width={width + pad * 4} height={height + pad * 4} fill="url(#dxf-grid-small)" />
|
|
182
|
+
|
|
183
|
+
<g transform={`translate(${pan.x}, ${pan.y}) scale(${zoom})`} style={{ transformOrigin: `${(bbox.minX + bbox.maxX) / 2}px ${(bbox.minY + bbox.maxY) / 2}px` }}>
|
|
184
|
+
{/* Transform to flip Y axis for authentic CAD coordinate representation (+Y is up) */}
|
|
185
|
+
<g transform={`translate(0, ${bbox.minY + bbox.maxY}) scale(1, -1)`}>
|
|
186
|
+
{entities.map((e, idx) => {
|
|
187
|
+
if (e.type === 'LINE') {
|
|
188
|
+
return <line key={idx} x1={e.x1} y1={e.y1} x2={e.x2} y2={e.y2} stroke={strokeColor} strokeWidth={strokeWidth} strokeLinecap="round" vectorEffect="non-scaling-stroke" />;
|
|
189
|
+
}
|
|
190
|
+
if (e.type === 'CIRCLE') {
|
|
191
|
+
return <circle key={idx} cx={e.cx} cy={e.cy} r={e.r} fill="none" stroke={strokeColor} strokeWidth={strokeWidth} vectorEffect="non-scaling-stroke" />;
|
|
192
|
+
}
|
|
193
|
+
if (e.type === 'ARC') {
|
|
194
|
+
const sRad = (e.startAngle * Math.PI) / 180;
|
|
195
|
+
const eRad = (e.endAngle * Math.PI) / 180;
|
|
196
|
+
const x1 = e.cx + e.r * Math.cos(sRad);
|
|
197
|
+
const y1 = e.cy + e.r * Math.sin(sRad);
|
|
198
|
+
const x2 = e.cx + e.r * Math.cos(eRad);
|
|
199
|
+
const y2 = e.cy + e.r * Math.sin(eRad);
|
|
200
|
+
const largeArc = (e.endAngle - e.startAngle + 360) % 360 > 180 ? 1 : 0;
|
|
201
|
+
return <path key={idx} d={`M ${x1} ${y1} A ${e.r} ${e.r} 0 ${largeArc} 1 ${x2} ${y2}`} fill="none" stroke={strokeColor} strokeWidth={strokeWidth} vectorEffect="non-scaling-stroke" />;
|
|
202
|
+
}
|
|
203
|
+
if (e.type === 'LWPOLYLINE' && e.points.length > 0) {
|
|
204
|
+
const d = e.points.map((p, i) => `${i === 0 ? 'M' : 'L'} ${p.x} ${p.y}`).join(' ') + (e.closed ? ' Z' : '');
|
|
205
|
+
return <path key={idx} d={d} fill="none" stroke={strokeColor} strokeWidth={strokeWidth} strokeLinecap="round" strokeLinejoin="round" vectorEffect="non-scaling-stroke" />;
|
|
206
|
+
}
|
|
207
|
+
return null;
|
|
208
|
+
})}
|
|
209
|
+
</g>
|
|
210
|
+
</g>
|
|
211
|
+
</svg>
|
|
212
|
+
)}
|
|
213
|
+
</div>
|
|
214
|
+
|
|
215
|
+
{isZenOpen && (
|
|
216
|
+
<FullscreenIframeModal title={mcard.name} src={rawUrl} onClose={() => setIsZenOpen(false)} />
|
|
217
|
+
)}
|
|
218
|
+
</div>
|
|
219
|
+
);
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
const btnStyle: React.CSSProperties = {
|
|
223
|
+
fontSize: '11px',
|
|
224
|
+
padding: '2px 8px',
|
|
225
|
+
backgroundColor: '#21262d',
|
|
226
|
+
color: '#c9d1d9',
|
|
227
|
+
border: '1px solid #30363d',
|
|
228
|
+
borderRadius: '3px',
|
|
229
|
+
cursor: 'pointer',
|
|
230
|
+
};
|
|
@@ -31,9 +31,9 @@ export const VideoPlayerViewlet: React.FC<CardViewletProps> = ({ mcard }) => {
|
|
|
31
31
|
const [playbackRate, setPlaybackRate] = useState<number>(1);
|
|
32
32
|
const [isZenModeOpen, setIsZenModeOpen] = useState(false);
|
|
33
33
|
|
|
34
|
-
const
|
|
34
|
+
const pathStr = mcard.path || mcard.handle || mcard.name || '';
|
|
35
|
+
const rawUrl = getMediaRawUrl(pathStr, mcard.hash);
|
|
35
36
|
const contentStr = typeof mcard.content === 'string' ? mcard.content : '';
|
|
36
|
-
const pathStr = mcard.path || mcard.handle || '';
|
|
37
37
|
|
|
38
38
|
const [asyncContent, setAsyncContent] = useState<string>('');
|
|
39
39
|
|
|
@@ -241,9 +241,9 @@ export const VideoPlayerViewlet: React.FC<CardViewletProps> = ({ mcard }) => {
|
|
|
241
241
|
}}
|
|
242
242
|
>
|
|
243
243
|
<video
|
|
244
|
-
ref={videoRef}
|
|
244
|
+
key={rawUrl} ref={videoRef}
|
|
245
245
|
src={rawUrl}
|
|
246
|
-
controls
|
|
246
|
+
controls preload="metadata"
|
|
247
247
|
style={{
|
|
248
248
|
maxWidth: '100%',
|
|
249
249
|
maxHeight: '100%',
|
|
@@ -116,8 +116,8 @@ export function registerCoreViewlets(register: (v: CardViewletDefinition) => voi
|
|
|
116
116
|
predicate: (file) => {
|
|
117
117
|
const path = (file.path || file.name || file.handle || '').toLowerCase();
|
|
118
118
|
const mime = (file.mimeType || '').toLowerCase();
|
|
119
|
-
if ((mime.startsWith('image/') && mime !== 'image/svg+xml') || mime.startsWith('audio/') || mime.startsWith('video/') || mime.startsWith('font/') || mime === 'application/pdf' || path.endsWith('.glb') || path.endsWith('.bin')) return false;
|
|
120
|
-
return mime.startsWith('text/') || mime === 'application/json' || mime === 'application/xml' || mime === 'application/x-yaml' || mime === 'image/svg+xml' || path.endsWith('.yaml') || path.endsWith('.yml') || path.endsWith('.json') || path.endsWith('.txt') || path.endsWith('.md') || path.endsWith('.ts') || path.endsWith('.tsx') || path.endsWith('.js') || (typeof file.content === 'string' && !file.content.startsWith('\x00'));
|
|
119
|
+
if ((mime.startsWith('image/') && mime !== 'image/svg+xml' && mime !== 'image/vnd.dxf') || mime.startsWith('audio/') || mime.startsWith('video/') || mime.startsWith('font/') || mime === 'application/pdf' || path.endsWith('.glb') || path.endsWith('.bin')) return false;
|
|
120
|
+
return mime.startsWith('text/') || mime === 'application/json' || mime === 'application/xml' || mime === 'application/x-yaml' || mime === 'image/svg+xml' || mime === 'image/vnd.dxf' || path.endsWith('.yaml') || path.endsWith('.yml') || path.endsWith('.json') || path.endsWith('.txt') || path.endsWith('.md') || path.endsWith('.ts') || path.endsWith('.tsx') || path.endsWith('.js') || path.endsWith('.dxf') || (typeof file.content === 'string' && !file.content.startsWith('\x00'));
|
|
121
121
|
},
|
|
122
122
|
supportedTabs: ['text'],
|
|
123
123
|
priority: 10,
|
|
@@ -4,9 +4,9 @@ import { getMediaRawUrl } from '../../../../../services/mcardVfs';
|
|
|
4
4
|
import { extractSpotifyInfo } from '../mediaEmbeds';
|
|
5
5
|
|
|
6
6
|
export const AudioPlayerViewlet: React.FC<CardViewletProps> = ({ mcard }) => {
|
|
7
|
-
const
|
|
7
|
+
const pathStr = mcard.path || mcard.handle || mcard.name || '';
|
|
8
|
+
const rawUrl = getMediaRawUrl(pathStr, mcard.hash);
|
|
8
9
|
const contentStr = typeof mcard.content === 'string' ? mcard.content : '';
|
|
9
|
-
const pathStr = mcard.path || mcard.handle || '';
|
|
10
10
|
|
|
11
11
|
const [asyncContent, setAsyncContent] = useState<string>('');
|
|
12
12
|
|
|
@@ -106,7 +106,19 @@ export const AudioPlayerViewlet: React.FC<CardViewletProps> = ({ mcard }) => {
|
|
|
106
106
|
<div style={{ fontSize: '15px', fontWeight: 600, marginBottom: '16px', color: '#cccccc' }}>
|
|
107
107
|
{mcard.name}
|
|
108
108
|
</div>
|
|
109
|
-
<audio controls src={rawUrl} style={{ width: '380px' }}
|
|
109
|
+
<audio key={rawUrl} controls src={rawUrl} preload="metadata" style={{ width: '380px' }}>
|
|
110
|
+
<source src={rawUrl} type={mcard.mimeType || 'audio/mpeg'} />
|
|
111
|
+
Your browser does not support the audio element.
|
|
112
|
+
</audio>
|
|
113
|
+
{rawUrl && (
|
|
114
|
+
<a
|
|
115
|
+
href={rawUrl}
|
|
116
|
+
download={mcard.name}
|
|
117
|
+
style={{ marginTop: '14px', color: '#75beff', textDecoration: 'none', fontSize: '11px' }}
|
|
118
|
+
>
|
|
119
|
+
Download Audio ↓
|
|
120
|
+
</a>
|
|
121
|
+
)}
|
|
110
122
|
</div>
|
|
111
123
|
);
|
|
112
124
|
};
|
|
@@ -5,7 +5,8 @@ import { FullscreenIframeModal } from '../FullscreenIframeModal';
|
|
|
5
5
|
|
|
6
6
|
export const PdfViewlet: React.FC<CardViewletProps> = ({ mcard }) => {
|
|
7
7
|
const [isZenOpen, setIsZenOpen] = useState(false);
|
|
8
|
-
const
|
|
8
|
+
const filePath = mcard.path || mcard.handle || mcard.name || '';
|
|
9
|
+
const rawUrl = getMediaRawUrl(filePath, mcard.hash);
|
|
9
10
|
|
|
10
11
|
return (
|
|
11
12
|
<div
|
|
@@ -54,7 +55,7 @@ export const PdfViewlet: React.FC<CardViewletProps> = ({ mcard }) => {
|
|
|
54
55
|
{rawUrl && (
|
|
55
56
|
<a
|
|
56
57
|
href={rawUrl}
|
|
57
|
-
download
|
|
58
|
+
download={mcard.name}
|
|
58
59
|
style={{ color: '#75beff', textDecoration: 'none', fontSize: '10px' }}
|
|
59
60
|
>
|
|
60
61
|
Download PDF ↓
|
|
@@ -64,11 +65,28 @@ export const PdfViewlet: React.FC<CardViewletProps> = ({ mcard }) => {
|
|
|
64
65
|
</div>
|
|
65
66
|
|
|
66
67
|
<div style={{ flex: 1, width: '100%', height: '100%', position: 'relative' }}>
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
<object
|
|
69
|
+
key={rawUrl}
|
|
70
|
+
data={rawUrl}
|
|
71
|
+
type="application/pdf"
|
|
72
|
+
style={{ width: '100%', height: '100%', border: 'none', display: 'block' }}
|
|
73
|
+
>
|
|
74
|
+
<iframe
|
|
75
|
+
key={rawUrl}
|
|
76
|
+
src={rawUrl}
|
|
77
|
+
title={mcard.name}
|
|
78
|
+
style={{ width: '100%', height: '100%', border: 'none' }}
|
|
79
|
+
>
|
|
80
|
+
<div style={{ padding: '24px', textAlign: 'center', color: '#cccccc', backgroundColor: '#1e1e1e', height: '100%' }}>
|
|
81
|
+
<p>Unable to display PDF inline.</p>
|
|
82
|
+
{rawUrl && (
|
|
83
|
+
<a href={rawUrl} download={mcard.name} style={{ color: '#75beff', textDecoration: 'underline' }}>
|
|
84
|
+
Download {mcard.name}
|
|
85
|
+
</a>
|
|
86
|
+
)}
|
|
87
|
+
</div>
|
|
88
|
+
</iframe>
|
|
89
|
+
</object>
|
|
72
90
|
</div>
|
|
73
91
|
|
|
74
92
|
{isZenOpen && (
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { findMCardByTarget } from '../../../../../../services/mcardVfs';
|
|
7
7
|
import { slugifyHeading, type CompilerContext } from './markdownSlugger';
|
|
8
|
+
import { formatMcardUri } from 'clm-kernel';
|
|
8
9
|
|
|
9
10
|
export function processObsidianWikilinks(content: string, ctx: CompilerContext): string {
|
|
10
11
|
return content.replace(/\[\[([^\]\|#]+)?(?:#([^\]\|]+))?(?:\|([^\]]+))?\]\]/g, (_match, rawTarget, rawHeading, rawAlias) => {
|
|
@@ -23,7 +24,7 @@ export function processObsidianWikilinks(content: string, ctx: CompilerContext):
|
|
|
23
24
|
const resolved = findMCardByTarget(target, ctx.currentCard, ctx.treeSnapshot);
|
|
24
25
|
if (resolved) {
|
|
25
26
|
const label = alias || (heading ? `${resolved.name.replace(/\.md$/, '')} › ${heading}` : resolved.name.replace(/\.md$/, ''));
|
|
26
|
-
const uri =
|
|
27
|
+
const uri = formatMcardUri({ type: 'handle', target: resolved.handle, fragment: heading || undefined });
|
|
27
28
|
return ctx.registerPlaceholder(`<a href="${uri}" class="obsidian-wikilink mcard-hyperlink" data-mcard-handle="${resolved.handle}" ${heading ? `data-mcard-heading="${heading}"` : ''} title="${resolved.path} (${resolved.handle})" style="color: #75beff; text-decoration: none; border-bottom: 1px dashed rgba(117, 190, 255, 0.6); padding: 1px 4px; border-radius: 3px; transition: background 0.15s ease; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;">
|
|
28
29
|
<span style="opacity: 0.7; font-size: 11px;">📄</span>
|
|
29
30
|
<span>${label}</span>
|
|
@@ -38,6 +38,7 @@ const LazyKatexFormulaViewlet = lazyNamed(() => import('./KatexFormulaViewlet'),
|
|
|
38
38
|
const LazyD3GraphViewlet = lazyNamed(() => import('./D3GraphViewlet'), 'D3GraphViewlet');
|
|
39
39
|
const LazyChartAnalyticsViewlet = lazyNamed(() => import('./ChartAnalyticsViewlet'), 'ChartAnalyticsViewlet');
|
|
40
40
|
const LazyExcalidrawWhiteboardViewlet = lazyNamed(() => import('./ExcalidrawWhiteboardViewlet'), 'ExcalidrawWhiteboardViewlet');
|
|
41
|
+
const LazyDxfViewlet = lazyNamed(() => import('./DxfViewlet'), 'DxfViewlet');
|
|
41
42
|
|
|
42
43
|
export function registerMediaViewlets(register: (v: CardViewletDefinition) => void): void {
|
|
43
44
|
// 1. 3D Spatial Models (Priority: 100)
|
|
@@ -49,6 +50,20 @@ export function registerMediaViewlets(register: (v: CardViewletDefinition) => vo
|
|
|
49
50
|
supportedTabs: ['visual'], priority: 100, isFullBleed: true, isLazy: true, component: LazySpatial3dViewlet,
|
|
50
51
|
});
|
|
51
52
|
|
|
53
|
+
// 1.5 2D CAD Vector Blueprint Viewport (Priority: 96)
|
|
54
|
+
register({
|
|
55
|
+
id: 'viewlet:cad:dxf', name: '2D CAD Blueprint Viewport',
|
|
56
|
+
description: 'Interactive AutoCAD DXF vector drawing renderer with pan, zoom, grid, and CAD entity metrics',
|
|
57
|
+
supportedExtensions: ['.dxf'],
|
|
58
|
+
supportedMimes: ['image/vnd.dxf', 'application/dxf', 'application/x-dxf'],
|
|
59
|
+
predicate: (mcard) => {
|
|
60
|
+
const path = (mcard.path || mcard.name || mcard.handle || '').toLowerCase();
|
|
61
|
+
const mime = (mcard.mimeType || '').toLowerCase();
|
|
62
|
+
return path.endsWith('.dxf') || mime === 'image/vnd.dxf' || mime === 'application/dxf';
|
|
63
|
+
},
|
|
64
|
+
supportedTabs: ['visual'], priority: 96, isFullBleed: true, isLazy: true, component: LazyDxfViewlet,
|
|
65
|
+
});
|
|
66
|
+
|
|
52
67
|
// 2. Video Player & YouTube Embed (Priority: 95)
|
|
53
68
|
register({
|
|
54
69
|
id: 'viewlet:media:video', name: 'Video Player & YouTube Stream',
|
|
@@ -171,7 +186,12 @@ export function registerMediaViewlets(register: (v: CardViewletDefinition) => vo
|
|
|
171
186
|
description: 'Responsive raster image viewer for PNG, JPEG, WebP, GIF, BMP, ICO, AVIF',
|
|
172
187
|
supportedExtensions: ['.png', '.jpg', '.jpeg', '.webp', '.gif', '.bmp', '.ico', '.avif'],
|
|
173
188
|
supportedMimes: ['image/png', 'image/jpeg', 'image/webp', 'image/gif', 'image/bmp', 'image/x-icon', 'image/vnd.microsoft.icon', 'image/avif'],
|
|
174
|
-
predicate: (m) =>
|
|
189
|
+
predicate: (m) => {
|
|
190
|
+
const path = (m?.path || m?.name || m?.handle || '').toLowerCase();
|
|
191
|
+
const mime = (m?.mimeType || '').toLowerCase();
|
|
192
|
+
if (path.endsWith('.dxf') || mime === 'image/vnd.dxf') return false;
|
|
193
|
+
return m?.detectedType === 'image' || (typeof m?.mimeType === 'string' && m.mimeType.startsWith('image/') && m.mimeType !== 'image/svg+xml');
|
|
194
|
+
},
|
|
175
195
|
supportedTabs: ['visual'], priority: 75, isFullBleed: true, isLazy: true, component: LazyImageViewlet,
|
|
176
196
|
});
|
|
177
197
|
|