@bendyline/gezel-service 1.0.7 → 1.1.0
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/dist/bin/gezeld.js +6253 -3616
- package/dist/handboek-content/whats-new/1.26224.md +1 -0
- package/dist/handboek-content/whats-new/1.26226.md +1 -0
- package/dist/handboek-content/whats-new/1.26231.md +1 -0
- package/dist/handboek-content/whats-new/1.26234.md +1 -0
- package/dist/handboek-content/whats-new/1.26237.md +1 -0
- package/dist/handboek-content/whats-new/1.26244.md +2 -1
- package/dist/handboek-content/whats-new/1.26247.md +88 -0
- package/dist/handboek-content/whats-new/whats-new-index.md +1 -0
- package/dist/index-store/static-index-worker.js +17 -1
- package/dist/index.d.ts +473 -209
- package/dist/index.js +6251 -3614
- package/dist/memory/embed-worker.js +58 -2
- package/dist/memory/image-embed-worker.js +8 -0
- package/dist/providers/llama-cpp/gguf-metadata-worker.js +2 -0
- package/dist/providers/mlx/python/gezel_mlx_server.py +18 -18
- package/dist/ui/assets/AmbientDashboardCard-Cf5fi_fY.js +1 -0
- package/dist/ui/assets/{AudioEngineSettings-BDrNIGGm.js → AudioEngineSettings-D3L7HOHe.js} +1 -1
- package/dist/ui/assets/{BenchmarksView-CHyujjs8.js → BenchmarksView-B68hrLCl.js} +1 -1
- package/dist/ui/assets/CatalogBrowser-DEM9t7Es.js +1 -0
- package/dist/ui/assets/{ChannelsSettings-Be_W1mr8.js → ChannelsSettings-DtK_k0Ul.js} +1 -1
- package/dist/ui/assets/ChatTimelineView-CQ4Sf4Ip.js +7 -0
- package/dist/ui/assets/ConfirmDialog-Dt1ed4Fh.js +1 -0
- package/dist/ui/assets/ConnectedAppsPanel-Cl8LEkrt.js +1 -0
- package/dist/ui/assets/CraftbookEditor-DEQRlQ2p.js +1 -0
- package/dist/ui/assets/{CraftbookScriptEditorView-DXIZYZT3.js → CraftbookScriptEditorView-DhXkkIdK.js} +1 -1
- package/dist/ui/assets/{CraftbookTabContent-Bm7t_b37.js → CraftbookTabContent-_oIdpQTG.js} +1 -1
- package/dist/ui/assets/{CraftbookToolsetSetup-DTEA-3K3.js → CraftbookToolsetSetup-BKg136L1.js} +1 -1
- package/dist/ui/assets/{CraftbooksView-C4X99TTe.js → CraftbooksView-Dm2zH-nW.js} +2 -2
- package/dist/ui/assets/{DiffpackReviewView-ClcNxtmF.js → DiffpackReviewView-EFLGJnwr.js} +1 -1
- package/dist/ui/assets/DocumentDetail-ClDRj2N-.js +1 -0
- package/dist/ui/assets/DocumentsView-ny9oieg2.js +1 -0
- package/dist/ui/assets/DropdownMenu-S4d9-3j3.js +1 -0
- package/dist/ui/assets/Ds4Settings-CeWlm5Vf.js +1 -0
- package/dist/ui/assets/EmbeddedChat-Hjrrgpao.js +1 -0
- package/dist/ui/assets/{FaceRecognitionCard-D3hdc7uU.js → FaceRecognitionCard-D7ufKqjI.js} +1 -1
- package/dist/ui/assets/FileMapView-DRjf59RH.js +1 -0
- package/dist/ui/assets/{FoldersSettings-BcNzl4vT.js → FoldersSettings-DDUhaFio.js} +1 -1
- package/dist/ui/assets/GezelDetail-Cph6pVGb.js +1 -0
- package/dist/ui/assets/{GezelJsonEditor-fOvYclu9.js → GezelJsonEditor-7vDGyBib.js} +1 -1
- package/dist/ui/assets/{GezellenView-BTzhHrxi.js → GezellenView-DQhcO1CP.js} +1 -1
- package/dist/ui/assets/{GildeUpdatesCard-Bq6XEpLP.js → GildeUpdatesCard-UKKNm_U8.js} +1 -1
- package/dist/ui/assets/{GithubSignInChip-CnlTCG8G.js → GithubSignInChip-DjM3qZsL.js} +1 -1
- package/dist/ui/assets/{HandboekMediaProvider-BfQW8_Nr.js → HandboekMediaProvider-DixaXTAH.js} +1 -1
- package/dist/ui/assets/HandboekView-BeNQqho9.js +1 -0
- package/dist/ui/assets/HistoryView-E2szGNGS.js +1 -0
- package/dist/ui/assets/{HomeView-CB_5TJIp.css → HomeView-CNeqCFPc.css} +1 -1
- package/dist/ui/assets/HomeView-CkiS3DXy.js +1 -0
- package/dist/ui/assets/{ImageEngineSettings-BpMfQy4f.js → ImageEngineSettings-BCKT7Gvi.js} +1 -1
- package/dist/ui/assets/{ImageRecognitionSettings-Ct-7-Oas.js → ImageRecognitionSettings-DD6syFez.js} +1 -1
- package/dist/ui/assets/IncompleteDownloads-BiPaaahS.js +1 -0
- package/dist/ui/assets/InstallProgressRow-DyKOI4MU.js +1 -0
- package/dist/ui/assets/KnowledgeCatalogsCard-B132vzRa.js +1 -0
- package/dist/ui/assets/KnowledgeView-CtPuIlN4.js +1 -0
- package/dist/ui/assets/LlamaCppSettings-D6zHcu4W.js +1 -0
- package/dist/ui/assets/{MarkdownField-D-0Zw7gM.js → MarkdownField-CK8K3fzj.js} +1 -1
- package/dist/ui/assets/MemoriesTree-DzjXzIrM.js +1 -0
- package/dist/ui/assets/{MicrophoneSettings-BIaFxyY_.js → MicrophoneSettings-1FH83SCq.js} +1 -1
- package/dist/ui/assets/MlxSettings-BYxUqFnJ.js +1 -0
- package/dist/ui/assets/ModelPicker-DoXPfQkQ.js +1 -0
- package/dist/ui/assets/{NewScriptDialog-D-gkY8TS.js → NewScriptDialog-C5X-7PMt.js} +1 -1
- package/dist/ui/assets/NewTaskDialog-Cyqtmigv.js +2 -0
- package/dist/ui/assets/{OllamaSettings-oIE2Mech.js → OllamaSettings-DkjmA-sB.js} +1 -1
- package/dist/ui/assets/ProjectChat-YEqUME6k.js +5 -0
- package/dist/ui/assets/{ProjectConnectionsTab-BZqp-oKI.js → ProjectConnectionsTab-dFCJpW93.js} +1 -1
- package/dist/ui/assets/ProjectGitStatusBar-CjZxG54t.js +1 -0
- package/dist/ui/assets/{ProjectGithubView-w8suLCsA.js → ProjectGithubView-CQ4-tmPx.js} +1 -1
- package/dist/ui/assets/{ProjectMailTab-DGo7eyB8.js → ProjectMailTab-NaScsZJf.js} +1 -1
- package/dist/ui/assets/ProjectOverviewView-ChjxbQas.js +1 -0
- package/dist/ui/assets/{ProjectTimeline-DRe3D9qY.js → ProjectTimeline-BZpdCisR.js} +1 -1
- package/dist/ui/assets/ProjectsView-J77ECk6V.js +7 -0
- package/dist/ui/assets/{RecommendedBadge-BKiDixnB.js → RecommendedBadge-D0m68PAu.js} +1 -1
- package/dist/ui/assets/{RemoteServersPanel-DGyl6-Rg.js → RemoteServersPanel-BdLOoORu.js} +1 -1
- package/dist/ui/assets/ScriptEditorTabs-BFvIiDFZ.js +2 -0
- package/dist/ui/assets/ScriptEditorView-B09rm1vz.js +5 -0
- package/dist/ui/assets/{ScriptsView-WQc28TmQ.js → ScriptsView-BvNAJXpo.js} +1 -1
- package/dist/ui/assets/{SecurityComplianceSettings-DsMEA4J3.js → SecurityComplianceSettings-DzGOnptO.js} +1 -1
- package/dist/ui/assets/SessionSwitcher-6okzcxT7.js +1 -0
- package/dist/ui/assets/SettingsView-Dur4dLhW.js +3 -0
- package/dist/ui/assets/SquisqIntegration-6v3yNOIP.js +2 -0
- package/dist/ui/assets/{StorageCleanupDialog-DHqwyMZZ.js → StorageCleanupDialog-OQlomMJD.js} +1 -1
- package/dist/ui/assets/{StorageUsageCard-CdT6SU51.js → StorageUsageCard-f6c6qTbM.js} +1 -1
- package/dist/ui/assets/Tabs-jE0Z5Tzd.js +1 -0
- package/dist/ui/assets/TaskTabContent-0w3kAUWR.js +1 -0
- package/dist/ui/assets/TasksView-BVMT4BAY.js +1 -0
- package/dist/ui/assets/{TerminalCodeEditor-77pBm6f3.js → TerminalCodeEditor-DO7zLKy-.js} +2 -2
- package/dist/ui/assets/ToolsetsEditor-Bb1wD5mV.js +8 -0
- package/dist/ui/assets/TransformToolbarButton-BWYkEB0d.js +5 -0
- package/dist/ui/assets/UnrecognizedModels-HtdMZUqK.js +1 -0
- package/dist/ui/assets/{VideoEngineSettings-DzMeINuv.js → VideoEngineSettings-Dq8Nw_tK.js} +1 -1
- package/dist/ui/assets/{WorkspaceIndexPane-DU4yd4Ai.js → WorkspaceIndexPane-fpDz4MwZ.js} +1 -1
- package/dist/ui/assets/{api-BX5xXiFs.js → api-BPraLwsh.js} +1 -1
- package/dist/ui/assets/chat-thread-memory-Be48zsyG.js +1 -0
- package/dist/ui/assets/chunk-6ECMNUIP-DDVjPyfK.js +15 -0
- package/dist/ui/assets/{chunk-6N2J7C2B-B5QIrD9m.js → chunk-6N2J7C2B-CsppiLVr.js} +1 -1
- package/dist/ui/assets/{chunk-A6N6IN3I-DXok09eC.js → chunk-A6N6IN3I-ofeM4l8g.js} +1 -1
- package/dist/ui/assets/chunk-B7GEAZBI-Divd2h1k.js +1 -0
- package/dist/ui/assets/chunk-DXYWKZ52-BXcAlClu.js +1 -0
- package/dist/ui/assets/chunk-FLR2ARKC-D7wrvQgT.js +2 -0
- package/dist/ui/assets/chunk-IIQYS2YH-DKZhWMpn.js +1 -0
- package/dist/ui/assets/{chunk-ILCJ3WFD-WRukZ7R1.js → chunk-ILCJ3WFD-CLZxw4Ge.js} +3 -3
- package/dist/ui/assets/chunk-OBADJV7C-CDVOcmYt.js +1 -0
- package/dist/ui/assets/chunk-Q77KNJIN-BIDRf0aP.js +6 -0
- package/dist/ui/assets/chunk-S5PCVMKU-Df5XzhSE.js +6 -0
- package/dist/ui/assets/chunk-UBFT2CDQ-FexGDigd.js +31 -0
- package/dist/ui/assets/{chunk-USU6HTKB-D5FmDzJU.js → chunk-USU6HTKB-B_p-YcDp.js} +1 -1
- package/dist/ui/assets/chunk-VKXOZTYP-BoVvWSBR.js +5 -0
- package/dist/ui/assets/{chunk-6RQOV3B3-CwvKotJw.js → chunk-VPWPEMZJ-DRKoa_j0.js} +1 -1
- package/dist/ui/assets/{chunk-WATAOG4Y-DXg2lov5.js → chunk-WATAOG4Y-C1EXVPmG.js} +1 -1
- package/dist/ui/assets/{container-B7jJtK5V.js → container-Ce94efbg.js} +1 -1
- package/dist/ui/assets/csv-62UGQMzZ.js +1 -0
- package/dist/ui/assets/data-B2kHjlc5.js +1 -0
- package/dist/ui/assets/dist-B9-VrAP8.js +2 -0
- package/dist/ui/assets/dist-BaHut5iX.js +2 -0
- package/dist/ui/assets/dist-BqGwkOe5.js +225 -0
- package/dist/ui/assets/dist-ZnIgkoEi.js +4 -0
- package/dist/ui/assets/{dist-BHl1ZAVG.js → dist-l6uUFZMV.js} +2 -2
- package/dist/ui/assets/dist-pLLFUPO-.js +1 -0
- package/dist/ui/assets/{doc-s6H7T0IO.js → doc-Dr5K49bx.js} +28 -28
- package/dist/ui/assets/document-companion-BQk2kS0F.js +1 -0
- package/dist/ui/assets/document-import-QoM9UxJr.js +1 -0
- package/dist/ui/assets/docx-sXa1Rf41.js +2 -0
- package/dist/ui/assets/{epub-B98SgHBz.js → epub-RopMP0ec.js} +4 -4
- package/dist/ui/assets/{export-options-Bu-tI6og.js → export-options-f7PKjEBb.js} +1 -1
- package/dist/ui/assets/extract-UTAOG7LV-4WDRw1o4.js +1 -0
- package/dist/ui/assets/file-browser-c2tf4MIb.js +5 -0
- package/dist/ui/assets/html-BGVOMhkv.js +253 -0
- package/dist/ui/assets/icons-DWaUNQbT.js +1 -0
- package/dist/ui/assets/images-JLBFCDD4-6JitW0hD.js +1 -0
- package/dist/ui/assets/index-B8NcxqcR.css +1 -0
- package/dist/ui/assets/index-C0DYtvfg.js +34 -0
- package/dist/ui/assets/index-J8TOMdvV.js +2 -0
- package/dist/ui/assets/{infer-kCLH1C8z.js → infer-LEGOsu64.js} +2 -2
- package/dist/ui/assets/ironcalc-BAi5gOlE.js +3 -0
- package/dist/ui/assets/layouts-2A7QNF6Y-CVwP7noP.js +1 -0
- package/dist/ui/assets/{mail-link-CI6YD6k2.js → mail-link-DXkmCd5b.js} +1 -1
- package/dist/ui/assets/markdown-baseline-9B52XlX2.js +1 -0
- package/dist/ui/assets/{markdown-Bi9b5f5Y.js → markdown-ryKA_OmY.js} +1 -1
- package/dist/ui/assets/materialize-A34OZGEU-xNNKzytx.js +1 -0
- package/dist/ui/assets/model-inventory-ykSm_IT5.js +1 -0
- package/dist/ui/assets/{model-quantization-BDzrELN_.js → model-quantization-CLO7XLoF.js} +1 -1
- package/dist/ui/assets/{monaco-base-BiVSa1J-.js → monaco-base-B1H1U1Sw.js} +1 -1
- package/dist/ui/assets/{monaco-setup-UeltVkg_.js → monaco-setup-DjhrGQui.js} +1 -1
- package/dist/ui/assets/{new-project-meta-0xhggGA_.js → new-project-meta-_f9sfcRX.js} +1 -1
- package/dist/ui/assets/outside-in-D73N1g_b.js +3 -0
- package/dist/ui/assets/{pdf-DgTjy3rN.js → pdf-BOjVDlCK.js} +3 -3
- package/dist/ui/assets/{pending-drafts-YVW6X55O.js → pending-drafts-B11MKQ9R.js} +1 -1
- package/dist/ui/assets/{poppetje-Ce-02Aqi.js → poppetje-DLB8uevw.js} +2 -2
- package/dist/ui/assets/pptx-BuxyNxQh.js +6 -0
- package/dist/ui/assets/primitives-CWrGZpPI.js +41 -0
- package/dist/ui/assets/run-export-ChaMXrKS.js +23 -0
- package/dist/ui/assets/squisq-formats-aAdypXoy.js +1 -0
- package/dist/ui/assets/standalone-source-q_Zzd1bd.js +11 -0
- package/dist/ui/assets/storage-D8pE2zg0.js +1 -0
- package/dist/ui/assets/styles-BhnF3s2q.css +1 -0
- package/dist/ui/assets/styles-CKVKwqoQ.js +550 -0
- package/dist/ui/assets/table-fcouR4db.js +1 -0
- package/dist/ui/assets/{terminal-monaco-setup-DNoK2tN4.js → terminal-monaco-setup-BAzrVzeR.js} +1 -1
- package/dist/ui/assets/{useCompactLayout-BarJPYcv.js → useCompactLayout-Dtolvzye.js} +0 -0
- package/dist/ui/assets/{useCopilotAvailability-BH1nLXQI.js → useCopilotAvailability-3xZvKgTF.js} +1 -1
- package/dist/ui/assets/{useDiffpacks-CK8W_OD_.js → useDiffpacks-Dsnr0wtX.js} +1 -1
- package/dist/ui/assets/{useGitSync-DWxX5-7K.js → useGitSync-BCTptQsp.js} +1 -1
- package/dist/ui/assets/{useShowWorkInProgressFeatures-DwwviLRO.js → useShowWorkInProgressFeatures-BhDNuQiU.js} +1 -1
- package/dist/ui/assets/{useTotalRamBytes-WoN_mi-V.js → useTotalRamBytes-DIx-_pf8.js} +1 -1
- package/dist/ui/assets/wasm-DdxEDD2H.js +1 -0
- package/dist/ui/assets/wasm_bg-DW9Xt_vt.wasm +0 -0
- package/dist/ui/assets/xlsx-DyBGuAO1.js +4 -0
- package/dist/ui/index.html +19 -18
- package/package.json +11 -11
- package/dist/ui/assets/AmbientDashboardCard-C1Ee-FKZ.js +0 -1
- package/dist/ui/assets/CatalogBrowser-Bz8ZtxPn.js +0 -1
- package/dist/ui/assets/ChatTimelineView-Do9EryEH.js +0 -7
- package/dist/ui/assets/ConfirmDialog-BHFs6vmJ.js +0 -1
- package/dist/ui/assets/ConnectedAppsPanel-BtMayq0R.js +0 -1
- package/dist/ui/assets/CraftbookEditor-D5jTzWwF.js +0 -1
- package/dist/ui/assets/DocumentDetail-CPU51d04.js +0 -1
- package/dist/ui/assets/DocumentsView-B6OyjvJ0.js +0 -1
- package/dist/ui/assets/DropdownMenu-D5fCzIrh.js +0 -1
- package/dist/ui/assets/Ds4Settings-CrUM_KGP.js +0 -1
- package/dist/ui/assets/EmbeddedChat-ue9ia-WY.js +0 -1
- package/dist/ui/assets/FileMapView-CxvfDLGA.js +0 -1
- package/dist/ui/assets/GezelDetail-DHuqBK55.js +0 -1
- package/dist/ui/assets/HandboekView-CPnnyj29.js +0 -1
- package/dist/ui/assets/HistoryView-B4VAfEMe.js +0 -1
- package/dist/ui/assets/HomeView-ccH60J6f.js +0 -1
- package/dist/ui/assets/KnowledgeCatalogsCard-Bi5Rx9Iz.js +0 -1
- package/dist/ui/assets/KnowledgeView-DAwjwLZo.js +0 -1
- package/dist/ui/assets/LlamaCppSettings-Ceyk9pDP.js +0 -1
- package/dist/ui/assets/MemoriesTree-BKZEPJpm.js +0 -1
- package/dist/ui/assets/MlxSettings-CG3wfuc3.js +0 -1
- package/dist/ui/assets/ModelPicker-CCBVjLMS.js +0 -1
- package/dist/ui/assets/NewPathDialog-D4jnNBfP.js +0 -1
- package/dist/ui/assets/NewTaskDialog-Ox9D612Z.js +0 -2
- package/dist/ui/assets/ProjectChat-DMwKnkW-.js +0 -5
- package/dist/ui/assets/ProjectGitStatusBar-C6bkCSby.js +0 -1
- package/dist/ui/assets/ProjectOverviewView-NNwXd_QQ.js +0 -1
- package/dist/ui/assets/ProjectsView-SBPgYOq8.js +0 -7
- package/dist/ui/assets/ScriptEditorTabs-paocQ6dj.js +0 -2
- package/dist/ui/assets/ScriptEditorView-N9zSLqqi.js +0 -5
- package/dist/ui/assets/SessionSwitcher-C8te7YSe.js +0 -1
- package/dist/ui/assets/SettingsView-Brl4JQkW.js +0 -3
- package/dist/ui/assets/Tabs-BAY1Q79B.js +0 -1
- package/dist/ui/assets/TaskTabContent-CNPJ4DQj.js +0 -1
- package/dist/ui/assets/TasksView-DuMjFS8S.js +0 -1
- package/dist/ui/assets/ToolsetsEditor-BdxHnIBj.js +0 -8
- package/dist/ui/assets/TransformToolbarButton-CVg5nz36.js +0 -5
- package/dist/ui/assets/UnrecognizedModels-Cw9Ku_bW.js +0 -1
- package/dist/ui/assets/chat-thread-memory-CZGcwgGo.js +0 -1
- package/dist/ui/assets/chunk-6ECMNUIP-C1kohb1U.js +0 -15
- package/dist/ui/assets/chunk-AONELFLA-Cv2nS9ga.js +0 -1
- package/dist/ui/assets/chunk-IIQYS2YH-Dxg6MAfT.js +0 -1
- package/dist/ui/assets/chunk-MIKKUKOD-XIkmalSN.js +0 -31
- package/dist/ui/assets/chunk-NNJLSQPW-DJA6camf.js +0 -5
- package/dist/ui/assets/chunk-S5PCVMKU-DbCZ5AUH.js +0 -6
- package/dist/ui/assets/csv-xmd1_Aqd.js +0 -4
- package/dist/ui/assets/dist-BPx-FyRH.js +0 -222
- package/dist/ui/assets/dist-Bvo52IGx.js +0 -1
- package/dist/ui/assets/dist-D5aoNQwk.js +0 -2
- package/dist/ui/assets/docx-Cj4A9MhC.js +0 -2
- package/dist/ui/assets/extract-UTAOG7LV-C4b7ycaL.js +0 -1
- package/dist/ui/assets/file-browser-80qWoVju.js +0 -5
- package/dist/ui/assets/html-C9TlzI57.js +0 -253
- package/dist/ui/assets/icons-C9dD-bDi.js +0 -1
- package/dist/ui/assets/images-ESPQKVTW-D7SgdVJ_.js +0 -1
- package/dist/ui/assets/index-D1m4Wx8V.css +0 -1
- package/dist/ui/assets/index-DXWR4qW1.js +0 -34
- package/dist/ui/assets/layouts-2A7QNF6Y-De2t-YXl.js +0 -1
- package/dist/ui/assets/markdown-baseline-HMqF2ChK.js +0 -1
- package/dist/ui/assets/outside-in-BFVUUcLa.js +0 -3
- package/dist/ui/assets/pptx-6ChgUEf4.js +0 -6
- package/dist/ui/assets/primitives-DEsn1shf.js +0 -41
- package/dist/ui/assets/run-export-BrYhHj1O.js +0 -23
- package/dist/ui/assets/standalone-source-D6mbpa3h.js +0 -11
- package/dist/ui/assets/storage-fn4FCEVK.js +0 -1
- package/dist/ui/assets/styles-C0EoNJbk.css +0 -1
- package/dist/ui/assets/styles-CKr_yrbn.js +0 -541
- package/dist/ui/assets/xlsx-DH7sTb3W.js +0 -4
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{i as r,n as i,r as a,t as o}from"./Tabs-BAY1Q79B.js";import{_ as s,g as c,h as l,y as u}from"./primitives-DEsn1shf.js";import{Ht as d,hn as f,it as p}from"./dist-BPx-FyRH.js";import{t as m}from"./dist-D5aoNQwk.js";import{t as h}from"./api-BX5xXiFs.js";import{i as g,n as _,o as v,r as y,t as b}from"./DropdownMenu-D5fCzIrh.js";import{lt as x}from"./doc-s6H7T0IO.js";import{n as S}from"./chunk-MIKKUKOD-XIkmalSN.js";import"./markdown-Bi9b5f5Y.js";import{P as C}from"./chunk-6ECMNUIP-C1kohb1U.js";import{n as w}from"./styles-CKr_yrbn.js";import{t as T}from"./GezelJsonEditor-fOvYclu9.js";import{t as E}from"./FileTypeIcon-Cwzl1GkZ.js";import{Lt as D,M as O,Y as k,ct as A,ft as j,ot as M,st as N}from"./index-DXWR4qW1.js";import{t as ee}from"./CraftbookToolsetSetup-DTEA-3K3.js";import{t as te}from"./useShowWorkInProgressFeatures-DwwviLRO.js";import{r as ne}from"./SessionSwitcher-C8te7YSe.js";import{n as re,r as P,t as ie}from"./useCompactLayout-BarJPYcv.js";var F=e(t(),1),I=n();function ae({manifest:e,onSubmit:t,onCancel:n}){let r=e.paramSchema,[i,a]=(0,F.useState)(()=>L(r)),[o,s]=(0,F.useState)(null),c=(0,F.useMemo)(()=>se(i),[i]),l=(0,F.useMemo)(()=>N(e,c),[e,c]),u=()=>{let e=oe(r,i);if(e){s(`"${e}" is required.`);return}t(c)};return(0,I.jsxs)(`form`,{className:`craftbook-param-form`,onSubmit:e=>{e.preventDefault(),u()},children:[(0,I.jsx)(`div`,{className:`craftbook-param-form-title`,children:e.name}),r&&(0,I.jsx)(T,{schema:r,value:i,onChange:e=>{a(e??{}),s(null)},density:`compact`}),(0,I.jsx)(`div`,{className:`craftbook-param-form-preview`,children:(0,I.jsx)(`code`,{children:l})}),o&&(0,I.jsx)(`p`,{className:`craftbook-param-form-error small`,children:o}),(0,I.jsxs)(`div`,{className:`craftbook-param-form-actions`,children:[(0,I.jsx)(`button`,{type:`button`,className:`subtle`,onClick:n,children:`Cancel`}),(0,I.jsx)(`button`,{type:`submit`,className:`primary`,children:`Stage command`})]})]})}function L(e){let t=e?.properties??{},n={};for(let[e,r]of Object.entries(t)){let t=A(r);t!==void 0&&(n[e]=t)}return n}function oe(e,t){let n=Array.isArray(e?.required)?e.required:[];for(let e of n){let n=t[e];if(n==null||n===``)return e}return null}function se(e){let t={};for(let[n,r]of Object.entries(e))r!=null&&(typeof r==`boolean`?t[n]=r?`true`:`false`:typeof r==`number`?t[n]=String(r):typeof r==`string`&&(t[n]=r));return t}function R(e){return e===`win32`?{run:`explorer .`,description:`Open this folder in File Explorer.`}:e===`darwin`?{run:`open .`,description:`Open this folder in Finder.`}:{run:`xdg-open .`,description:`Open this folder in your file manager.`}}function z(e){return[{title:`Getting around`,items:[{run:`pwd`,description:`Show which folder you are in right now.`},{run:`ls`,description:`List the files and folders here.`},{run:`ls -la`,description:`List everything, hidden files included, with sizes and dates.`},{run:`cd "folder-name"`,description:`Move into a folder.`},{run:`cd ..`,description:`Go back up one folder.`},R(e)]},{title:`Reading files`,items:[{run:`cat "file.txt"`,description:`Print a whole file to the screen.`},{run:`head -n 20 "file.txt"`,description:`Show only the first 20 lines of a file.`},{run:`tail -n 20 "file.txt"`,description:`Show only the last 20 lines — handy for logs.`}]},{title:`Making changes`,items:[{run:`mkdir "new-folder"`,description:`Create a new folder.`},{run:`touch "notes.txt"`,description:`Create an empty file.`},{run:`cp "file.txt" "copy.txt"`,description:`Copy a file.`},{run:`mv "old-name.txt" "new-name.txt"`,description:`Rename a file, or move it elsewhere.`},{run:`rm "file.txt"`,description:`Delete a file. There is no undo — be sure first.`}]},{title:`Finding things`,items:[{run:`grep -r "search text" .`,description:`Search every file here for a piece of text.`},{run:`find . -name "*.md"`,description:`Find files by name, anywhere below this folder.`}]},{title:`Tracking your changes`,items:[{run:`git status`,description:`See what you have changed since the last saved version.`},{run:`git diff`,description:`See the exact lines you changed.`},{run:`git log --oneline -10`,description:`See the last ten saved versions, one per line.`},{run:`git branch`,description:`List the branches and show which one you are on.`},{run:`git pull`,description:`Bring in the latest changes from the shared copy.`}]},{title:`When you are stuck`,items:[{run:`clear`,description:`Wipe the screen clean and start fresh.`},{run:`which node`,description:`Show where a tool is installed — or whether it is at all.`},{run:`man ls`,description:`Read the manual for a command. Press q to leave it.`}]}]}function B(e){return[{title:`Getting around`,items:[{run:`pwd`,description:`Show which folder you are in right now.`},{run:`ls`,description:`List the files and folders here.`},{run:`ls -Force`,description:`List everything, hidden files included.`},{run:`cd "folder-name"`,description:`Move into a folder.`},{run:`cd ..`,description:`Go back up one folder.`},R(e)]},{title:`Reading files`,items:[{run:`cat "file.txt"`,description:`Print a whole file to the screen.`},{run:`Get-Content "file.txt" -TotalCount 20`,description:`Show only the first 20 lines of a file.`},{run:`Get-Content "file.txt" -Tail 20`,description:`Show only the last 20 lines — handy for logs.`}]},{title:`Making changes`,items:[{run:`mkdir "new-folder"`,description:`Create a new folder.`},{run:`New-Item -ItemType File "notes.txt"`,description:`Create an empty file.`},{run:`Copy-Item "file.txt" "copy.txt"`,description:`Copy a file.`},{run:`Move-Item "old-name.txt" "new-name.txt"`,description:`Rename a file, or move it elsewhere.`},{run:`Remove-Item "file.txt"`,description:`Delete a file. There is no undo — be sure first.`}]},{title:`Finding things`,items:[{run:`Get-ChildItem -Recurse -File | Select-String -Pattern "search text"`,description:`Search every file here for a piece of text.`},{run:`Get-ChildItem -Recurse -Filter "*.md"`,description:`Find files by name, anywhere below this folder.`}]},{title:`Tracking your changes`,items:[{run:`git status`,description:`See what you have changed since the last saved version.`},{run:`git diff`,description:`See the exact lines you changed.`},{run:`git log --oneline -10`,description:`See the last ten saved versions, one per line.`},{run:`git branch`,description:`List the branches and show which one you are on.`},{run:`git pull`,description:`Bring in the latest changes from the shared copy.`}]},{title:`When you are stuck`,items:[{run:`clear`,description:`Wipe the screen clean and start fresh.`},{run:`Get-Command node`,description:`Show where a tool is installed — or whether it is at all.`},{run:`Get-Help Get-ChildItem`,description:`Read the built-in help for a command.`}]}]}function V(e){return e===`win32`?B(e):z(e)}var H=null;function U(){let e=window.__GEZEL__?.platform;return e?Promise.resolve(e):(H??=h.health().then(e=>e.platform).catch(()=>void 0),H)}function W(e){let t=e.paramSchema?.properties;return!!t&&Object.keys(t).length>0}var ce=[{kind:`npm-script`,title:`npm scripts`,section:`scripts`},{kind:`workspace-script`,title:`Scripts folder`,section:`scripts`},{kind:`vscode-launch`,title:`VSCode launch`,section:`scripts`},{kind:`bin`,title:`Tools on this machine`,section:`commands`}];function le({projectId:e,section:t=`all`,onAvailabilityChange:n,onStageCommand:r}){let i=te(),a=t===`all`||t===`commands`,o=t===`all`||t===`scripts`,u=t===`all`||t===`tasks`,d=u||t===`skills`,p=a||o,[m,g]=(0,F.useState)(null),[_,v]=(0,F.useState)([]),y=(0,F.useRef)(0),[b,x]=(0,F.useState)({}),[S,C]=(0,F.useState)(null),[w,T]=(0,F.useState)(new Set),[E,D]=(0,F.useState)(!1),[O,k]=(0,F.useState)([]),[A,j]=(0,F.useState)(!1),[ne,re]=(0,F.useState)(!1),[P,ie]=(0,F.useState)(!1),[L,oe]=(0,F.useState)([]),[se,R]=(0,F.useState)(!1),[z,B]=(0,F.useState)(!1),[H,le]=(0,F.useState)(``),[ue,G]=(0,F.useState)(null),[de,K]=(0,F.useState)(null),[fe,pe]=(0,F.useState)(),[q,me]=(0,F.useState)(`never`),[he,ge]=(0,F.useState)(null),[_e,J]=(0,F.useState)(null),[Y,ve]=(0,F.useState)(()=>window.__GEZEL__?.platform??void 0);(0,F.useEffect)(()=>{if(!a||Y)return;let e=!1;return U().then(t=>{e||ve(t)}),()=>{e=!0}},[a,Y]);let ye=(0,F.useCallback)(async()=>{try{let t=await h.getProjectIndex(e);g(t),ge(null)}catch(e){let t=e instanceof Error?e.message:String(e);/404|not yet indexed/i.test(t)||ge(t)}},[e]),X=(0,F.useCallback)(async()=>{try{let t=await h.getProjectSkills(e);k(t.skills),ie(!0)}catch{}finally{re(!0)}},[e]),be=(0,F.useCallback)(async()=>{let t=++y.current;try{let n=await h.listProjectCraftbooks(e);if(t!==y.current)return;let r=f(n.items,i),a=new Set(r.map(e=>e.manifest.id));v(r),x(n.missingToolsets??{}),C(n.projectType??null),T(new Set((n.suggestedIds??[]).filter(e=>a.has(e))))}catch{if(t!==y.current)return}finally{t===y.current&&j(!0)}},[e,i]),xe=(0,F.useCallback)(e=>{r?.(e),J(`Staged: ${e} — review and press Enter`),window.setTimeout(()=>J(null),2400)},[r]),Se=(0,F.useCallback)((e,t)=>{if(!r){J(`Open this from a project chat to run craftbooks.`),window.setTimeout(()=>J(null),2400);return}xe(N(e,t))},[r,xe]),Ce=(0,F.useCallback)(e=>{if((b[e.id]?.length??0)>0){K(e);return}W(e)?G(e):Se(e,{})},[Se,b]),we=(0,F.useCallback)(async()=>{try{let t=await h.getProjectImportsPending(e);oe(t.items),B(!0)}catch{}finally{R(!0)}},[e]);(0,F.useEffect)(()=>{t!==`skills`||!ne||!se||!P||!z||n?.(O.length>0||L.length>0)},[t,ne,se,P,z,O.length,L.length,n]);let Te=(0,F.useCallback)(async(t,n)=>{try{n===`approve`?await h.approveProjectImport(e,t):await h.rejectProjectImport(e,t),oe(e=>e.filter(e=>e.skillSource!==t)),J(n===`approve`?`Imported craftbook + script`:`Kept as prose-only`)}catch(e){J(`Review failed: ${e instanceof Error?e.message:String(e)}`)}window.setTimeout(()=>J(null),2400)},[e]),Ee=(0,F.useCallback)(async t=>{try{let n=await h.invokeProjectSkill(e,t.source);J(n.started?`${n.assigneeName??`The voorman`} is looking at ${t.name} — task ${n.task.ref}`:`Queued ${t.name} as task ${n.task.ref} — nobody has picked it up yet`)}catch(e){J(`Couldn’t invoke ${t.name}: ${e instanceof Error?e.message:String(e)}`)}window.setTimeout(()=>J(null),2400)},[e]);(0,F.useEffect)(()=>{let t=!1,n=async()=>{if(u&&!t&&be(),d&&!t&&(X(),we()),p)try{let n=await h.getProjectIndexStatus(e);if(t)return;me(n.state);let r=n.meta?.scannedAt;r&&r!==fe?(pe(r),await ye()):n.state===`never`&&await h.refreshProjectIndex(e).catch(()=>{})}catch{}};n();let r=window.setInterval(n,3e4);return()=>{t=!0,window.clearInterval(r)}},[e,fe,p,u,d,ye,be,X,we]);let De=(0,F.useMemo)(()=>{if(!m)return[];let e=H.trim().toLowerCase(),t=[];for(let{kind:n,title:r,section:i}of ce){if(i===`commands`?!a:!o)continue;let s=m.commands.filter(e=>e.kind===n).filter(t=>!e||t.name.toLowerCase().includes(e)||t.run.toLowerCase().includes(e)||(t.description?t.description.toLowerCase().includes(e):!1)).sort((e,t)=>n===`npm-script`||n===`workspace-script`?e.name.localeCompare(t.name,void 0,{sensitivity:`base`}):0);s.length>0&&t.push({kind:n,title:r,items:s})}return t},[m,H,a,o]),Oe=(0,F.useMemo)(()=>{if(!a)return[];let e=H.trim().toLowerCase();return V(Y).map(t=>({title:t.title,items:e?t.items.filter(t=>t.run.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)):t.items})).filter(e=>e.items.length>0)},[a,Y,H]),ke=(0,F.useCallback)(async e=>{try{await navigator.clipboard.writeText(e),J(`Copied: ${e}`),window.setTimeout(()=>J(null),1800)}catch{J(`Couldn’t copy — clipboard blocked.`),window.setTimeout(()=>J(null),2400)}},[]),Ae=m?.commands.length??0,Z=(0,F.useMemo)(()=>{let e=H.trim().toLowerCase();return e?_.filter(t=>{let n=t.manifest;return n.id.toLowerCase().includes(e)||n.name.toLowerCase().includes(e)||n.description.toLowerCase().includes(e)}):_},[_,H]),je=(0,F.useMemo)(()=>{let e=H.trim().toLowerCase();return e?O.filter(t=>t.name.toLowerCase().includes(e)||t.source.toLowerCase().includes(e)||(t.description?.toLowerCase().includes(e)??!1)):O},[O,H]),Me=e=>{let t=e.manifest,n=b[t.id]??[],r=(0,I.jsxs)(`button`,{type:`button`,className:`commands-panel-item`,onClick:()=>Ce(t),title:n.length>0?`${M(t)} — needs setup (${n.length} toolset${n.length===1?``:`s`})`:`Run ${M(t)}`,children:[(0,I.jsxs)(`span`,{className:`commands-panel-item-name`,children:[t.name,n.length>0&&(0,I.jsx)(`span`,{className:`commands-panel-badge small`,children:`setup`})]}),t.description&&(0,I.jsx)(`span`,{className:`commands-panel-item-desc muted small`,children:t.description})]});return n.length>0?(0,I.jsx)(`li`,{children:(0,I.jsxs)(s,{open:de?.id===t.id,onOpenChange:e=>{e||K(null)},children:[(0,I.jsx)(l,{asChild:!0,children:r}),(0,I.jsx)(c,{side:`left`,align:`start`,children:(0,I.jsx)(ee,{missing:n,onAllInstalled:()=>{K(null),be(),W(t)?G(t):Se(t,{})},onCancel:()=>K(null)})})]})},`craftbook:${t.id}`):W(t)?(0,I.jsx)(`li`,{children:(0,I.jsxs)(s,{open:ue?.id===t.id,onOpenChange:e=>{e||G(null)},children:[(0,I.jsx)(l,{asChild:!0,children:r}),(0,I.jsx)(c,{side:`left`,align:`start`,children:(0,I.jsx)(ae,{manifest:t,onSubmit:e=>{Se(t,e),G(null)},onCancel:()=>G(null)})})]})},`craftbook:${t.id}`):(0,I.jsx)(`li`,{children:r},`craftbook:${t.id}`)},Ne=Oe.map(e=>(0,I.jsxs)(`section`,{className:`commands-panel-group`,children:[(0,I.jsx)(`h4`,{className:`commands-panel-group-title muted small`,children:e.title}),(0,I.jsx)(`ul`,{className:`commands-panel-list`,children:e.items.map(e=>(0,I.jsx)(`li`,{children:(0,I.jsxs)(`button`,{type:`button`,className:`commands-panel-item`,onClick:()=>r?xe(e.run):void ke(e.run),title:r?`Stage: ${e.run}`:`Copy: ${e.run}`,children:[(0,I.jsx)(`span`,{className:`commands-panel-item-name commands-panel-item-code`,children:e.run}),(0,I.jsx)(`span`,{className:`commands-panel-item-desc muted small`,children:e.description})]})},`primer:${e.run}`))})]},`primer:${e.title}`)),Pe=H.trim().length>0,Fe=Z.filter(e=>w.has(e.manifest.id)),Ie=Z.filter(e=>!w.has(e.manifest.id)),Le=u&&!Pe&&S!==null&&Fe.length>0,Re=m?.commands.filter(e=>e.kind===`bin`).length??0,ze=Ae-Re,Q=V(Y).reduce((e,t)=>e+t.items.length,0),Be=_.length+O.length,[$,Ve]=t===`commands`?[Q+Re,`command`]:t===`scripts`?[ze,`script`]:t===`tasks`?[Be,`task`]:t===`skills`?[O.length,`skill`]:[Ae,`command`],He=p&&(q===`indexing`||q===`never`&&m===null),Ue=t===`tasks`?!A:t===`skills`?!ne:He,We=De.length>0||Oe.length>0||Z.length>0||je.length>0||L.length>0,Ge=!Ue&&!We;return(0,I.jsxs)(`div`,{className:`commands-panel`,children:[(0,I.jsxs)(`div`,{className:`commands-panel-toolbar`,children:[(0,I.jsx)(`input`,{className:`commands-panel-filter`,value:H,onChange:e=>le(e.target.value),placeholder:`Filter…`,"aria-label":t===`skills`?`Filter skills`:`Filter commands`}),(0,I.jsx)(`span`,{className:`commands-panel-state muted small`,title:fe??``,children:p&&q===`disabled`?`indexing off`:He?`looking…`:p&&q===`stale`?`refreshing…`:$>0?`${$} ${Ve}${$===1?``:`s`}`:``})]}),he&&(0,I.jsx)(`p`,{className:`commands-panel-error small`,children:he}),Ue&&(0,I.jsx)(`p`,{className:`commands-panel-empty muted small`,children:`Looking through your workspace…`}),Ge&&(Pe?(0,I.jsxs)(`p`,{className:`commands-panel-empty muted small`,children:[`Nothing matches “`,H.trim(),`”.`]}):p&&q===`disabled`?(0,I.jsx)(`p`,{className:`commands-panel-empty muted small`,children:`Workspace indexing is off for this project.`}):t===`skills`?(0,I.jsxs)(`p`,{className:`commands-panel-empty muted small`,children:[`No workspace skills here yet — drop one under `,(0,I.jsx)(`code`,{children:`.claude/skills/`}),`,`,` `,(0,I.jsx)(`code`,{children:`.gstack/skills/`}),`, or `,(0,I.jsx)(`code`,{children:`agents/skills/`}),`.`]}):t===`tasks`?(0,I.jsx)(`p`,{className:`commands-panel-empty muted small`,children:`No tasks are available for this project yet. Craftbooks show up here once one applies to this workspace.`}):(0,I.jsxs)(`p`,{className:`commands-panel-empty muted small`,children:[`No `,t===`scripts`?`scripts`:`commands`,` found yet. Add a script to`,` `,(0,I.jsx)(`code`,{children:`package.json`}),` or drop a file in`,(0,I.jsx)(`code`,{children:` scripts/`}),`.`]})),We&&(0,I.jsxs)(`div`,{className:`commands-panel-groups`,children:[d&&L.length>0&&(0,I.jsxs)(`section`,{className:`commands-panel-group`,children:[(0,I.jsxs)(`h4`,{className:`commands-panel-group-title muted small`,children:[`Imports to review (`,L.length,`)`]}),(0,I.jsx)(`ul`,{className:`commands-panel-list`,children:L.map(e=>(0,I.jsx)(`li`,{children:(0,I.jsxs)(`div`,{className:`commands-panel-item`,title:e.skillSource,children:[(0,I.jsx)(`span`,{className:`commands-panel-item-name`,children:e.craftbook.name}),(0,I.jsxs)(`span`,{className:`commands-panel-item-desc muted small`,children:[e.scripts.length,` translated script`,e.scripts.length===1?``:`s`,` from `,e.skillSource]}),(0,I.jsxs)(`span`,{className:`commands-panel-item-actions`,children:[(0,I.jsx)(`button`,{type:`button`,className:`commands-panel-mini`,onClick:()=>void Te(e.skillSource,`approve`),children:`Approve`}),(0,I.jsx)(`button`,{type:`button`,className:`commands-panel-mini`,onClick:()=>void Te(e.skillSource,`reject`),children:`Keep prose`})]})]})},`pending:${e.skillSource}`))})]}),t===`commands`&&Ne,De.map(e=>(0,I.jsxs)(`section`,{className:`commands-panel-group`,children:[(0,I.jsx)(`h4`,{className:`commands-panel-group-title muted small`,children:e.title}),(0,I.jsx)(`ul`,{className:`commands-panel-list`,children:e.items.map(e=>(0,I.jsx)(`li`,{children:(0,I.jsxs)(`button`,{type:`button`,className:`commands-panel-item`,onClick:()=>r?xe(e.run):void ke(e.run),title:r?`Stage: ${e.run}`:`Copy: ${e.run}`,children:[(0,I.jsx)(`span`,{className:`commands-panel-item-name`,children:e.name}),e.description&&(0,I.jsx)(`span`,{className:`commands-panel-item-desc muted small`,children:e.description})]})},`${e.kind}:${e.name}:${e.source}`))})]},e.kind)),Le?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`section`,{className:`commands-panel-group`,children:[(0,I.jsxs)(`h4`,{className:`commands-panel-group-title muted small`,children:[`Suggested for `,S?.label]}),(0,I.jsx)(`ul`,{className:`commands-panel-list`,children:Fe.map(Me)})]}),Ie.length>0&&(0,I.jsxs)(`section`,{className:`commands-panel-group`,children:[(0,I.jsx)(`button`,{type:`button`,className:`commands-panel-show-all muted small`,"aria-expanded":E,onClick:()=>D(e=>!e),children:E?`Show fewer craftbooks`:`Show all ${Z.length} craftbooks`}),E&&(0,I.jsx)(`ul`,{className:`commands-panel-list`,children:Ie.map(Me)})]})]}):u&&Z.length>0&&(0,I.jsxs)(`section`,{className:`commands-panel-group`,children:[(0,I.jsx)(`h4`,{className:`commands-panel-group-title muted small`,children:`Craftbooks`}),(0,I.jsx)(`ul`,{className:`commands-panel-list`,children:Z.map(Me)})]}),d&&je.length>0&&(0,I.jsxs)(`section`,{className:`commands-panel-group`,children:[(0,I.jsx)(`h4`,{className:`commands-panel-group-title muted small`,children:`Skills (workspace)`}),(0,I.jsx)(`ul`,{className:`commands-panel-list`,children:je.map(e=>(0,I.jsx)(`li`,{children:(0,I.jsxs)(`button`,{type:`button`,className:`commands-panel-item`,onClick:()=>void Ee(e),title:e.source,children:[(0,I.jsx)(`span`,{className:`commands-panel-item-name`,children:e.name}),e.description&&(0,I.jsx)(`span`,{className:`commands-panel-item-desc muted small`,children:e.description}),e.hasShellScripts&&(0,I.jsx)(`span`,{className:`commands-panel-item-desc muted small`,children:`(shell scripts present — prose-only invocation)`})]})},`skill:${e.source}`))})]}),t!==`commands`&&Ne]}),_e&&(0,I.jsx)(`output`,{className:`commands-panel-toast`,children:_e})]})}var ue=`gezel:chat-rail-side-fraction`,G=.18,de=.65,K=.34,fe=192,pe=14;function q(e){return Number.isFinite(e)?Math.max(G,Math.min(de,e)):K}function me(){if(typeof window>`u`)return K;try{let e=window.localStorage.getItem(ue);return e?q(Number.parseFloat(e)):K}catch{return K}}function he(e,t,n){return`${e}:${t??``}:${n}`}function ge(e,t){if(e!==`artifact`)return t;let n=t.trim().replace(/^\.?\/+/,``);for(;/^artifacts\/+/i.test(n);)n=n.replace(/^artifacts\/+/i,``);return n}function _e(e){switch(e){case`read_artifact`:case`write_artifact`:return`artifact`;case`read_document`:case`write_document`:return`document`;case`read_file`:case`read_files`:case`write_file`:return`workspace`;default:return null}}function J(e){return/\.(md|markdown|mdx)$/i.test(e)}function Y(e){return/\.html?$/i.test(e)}function ve({projectId:e,chatKey:t,skillsProjectId:n,compact:s=!1,onTaskChanged:c,banner:l,children:u}){let d=e??`default`,[f,p]=(0,F.useState)([]),m=(0,F.useRef)(0),[g,_]=(0,F.useState)(null),[v,y]=(0,F.useState)([]),[b,x]=(0,F.useState)(null),[S,C]=(0,F.useState)(`references`),[w,T]=(0,F.useState)(`chat`),[E,D]=(0,F.useState)(null),O=(0,F.useRef)(t);(0,F.useEffect)(()=>{O.current!==t&&(O.current=t,p([]),m.current=0,_(null),y([]),x(null),T(`chat`))},[t]);let k=(0,F.useCallback)((e,t,n)=>{let r=ge(e,t),i=he(e,n,r),a=Date.now(),o=++m.current,s={key:i,kind:e,path:r,firstSeenAt:a,lastSeenOrder:o,...n?{projectId:n}:{}};return p(e=>{let t=e.find(e=>e.key===i);return t?(s={...t,lastSeenOrder:o},e.map(e=>e.key===i?s:e)):[...e,s]}),s},[]);(0,F.useEffect)(()=>{if(!n){D(null);return}let e=!1,t=async()=>{let[t,r]=await Promise.allSettled([h.getProjectSkills(n),h.getProjectImportsPending(n)]);if(e||t.status!==`fulfilled`||r.status!==`fulfilled`)return;let i=t.value.skills.length>0||r.value.items.length>0;D(i?n:null)};t();let r=window.setInterval(t,3e4);return()=>{e=!0,window.clearInterval(r)}},[n]);let A=(0,F.useCallback)((e,t)=>{let n=t?.scoped??!1;y(t=>{let r=t.find(t=>t.ref===e);return r?n&&!r.scoped?t.map(t=>t.ref===e?{...t,scoped:!0}:t):t:[...t,{ref:e,scoped:n,firstSeenAt:Date.now()}]}),t?.focus&&(x(e),C(`tasks`),T(`tasks`))},[]),j=(0,F.useCallback)(e=>{if(!e.success)return;let t=[...e.videos?.map(e=>({path:e.path,promote:!0}))??[],...e.images?.map(e=>({path:e.path,promote:!1}))??[]];if(t.length>0)for(let n of t){let t=k(`artifact`,n.path,e.projectId);n.promote&&_(t)}let n=_e(e.name);if(!n)return;let r=e.paths&&e.paths.length>0?e.paths:e.path?[e.path]:[];if(r.length!==0)for(let t of r)n===`workspace`&&Y(t)||k(n,t,e.projectId)},[k]),M=(0,F.useCallback)((e,t)=>{let n=k(`artifact`,e,t);_(n),T(`references`)},[k]),N=(0,F.useCallback)((e,t)=>{k(`artifact`,e,t)},[k]),ee=(0,F.useCallback)((e,t)=>{let n=k(`workspace`,e,t);_(n),T(`references`)},[k]),te=(0,F.useCallback)((e,t)=>{k(`workspace`,e,t)},[k]),ne=(0,F.useMemo)(()=>[...f].sort((e,t)=>t.lastSeenOrder-e.lastSeenOrder).slice(0,12).map(({key:e,kind:t,path:n,projectId:r})=>({key:e,kind:t,path:n,...r?{projectId:r}:{}})),[f]),re=(0,F.useCallback)(e=>{let t=k(e.kind,e.path,e.projectId);_(t),C(`references`),T(`references`)},[k]),P=(0,F.useMemo)(()=>({onToolActivity:j,onArtifactReference:M,onArtifactSeen:N,onWorkspaceReference:ee,onWorkspaceSeen:te,recentReferences:ne,onOpenReference:re,onTaskReference:A}),[j,M,N,ee,te,ne,re,A]),ae=(0,F.useCallback)((e,t)=>{p(n=>n.map(n=>n.key===e?{...n,kind:t}:n)),_(n=>n&&n.key===e?{...n,kind:t}:n)},[]),L=(0,F.useRef)(null),oe=ie(L,840,60),se=s||oe,R=g??f[0]??null,z=R!==null,B=!!(n&&E===n),V=(0,F.useMemo)(()=>[...v].sort((e,t)=>e.scoped===t.scoped?e.firstSeenAt-t.firstSeenAt:e.scoped?-1:1),[v]),H=V.length>0,U=b&&V.find(e=>e.ref===b)?.ref||V[0]?.ref||null,W=!se&&(H||z||B);(0,F.useEffect)(()=>{z&&C(`references`)},[z]),(0,F.useEffect)(()=>{H&&!z&&C(`tasks`)},[H,z]),(0,F.useEffect)(()=>{B&&!H&&!z&&C(`skills`)},[B,H,z]),(0,F.useEffect)(()=>{B||(S===`skills`&&C(z?`references`:H?`tasks`:`references`),w===`skills`&&T(z?`references`:H?`tasks`:`chat`))},[B,z,H,S,w]);let ce=(0,F.useCallback)(e=>{n&&D(e?n:null)},[n]),[K,J]=(0,F.useState)(()=>me()),ve=(0,F.useRef)(null),X=(0,F.useCallback)(e=>{let t=q(e);J(t);try{window.localStorage.setItem(ue,t.toFixed(4))}catch{}},[]),be=(0,F.useCallback)(e=>{e.preventDefault();let t=L.current?.clientWidth??1;ve.current={startX:e.clientX,startFraction:K,containerWidth:t},document.body.classList.add(`chat-rail-resizing`),document.body.style.cursor=`col-resize`;let n=e=>{if(!ve.current)return;let{startX:t,startFraction:n,containerWidth:r}=ve.current;if(r<=0)return;let i=t-e.clientX;X(n+i/r)},r=()=>{ve.current=null,document.body.style.cursor=``,document.body.classList.remove(`chat-rail-resizing`),window.removeEventListener(`mousemove`,n),window.removeEventListener(`mouseup`,r)};window.addEventListener(`mousemove`,n),window.addEventListener(`mouseup`,r)},[K,X]),Ce=(0,F.useCallback)(e=>{let t=e.shiftKey?.08:.02;e.key===`ArrowLeft`?(e.preventDefault(),X(K+t)):e.key===`ArrowRight`?(e.preventDefault(),X(K-t)):e.key===`Home`?(e.preventDefault(),X(de)):e.key===`End`&&(e.preventDefault(),X(G))},[K,X]);return se?(0,I.jsxs)(`div`,{ref:L,className:`chat-rail-body chat-rail-body-compact`,children:[l&&(0,I.jsx)(`div`,{className:`chat-rail-banner`,children:l(P)}),(0,I.jsxs)(a,{className:`chat-rail-compact-root`,value:w,onValueChange:e=>T(e),children:[(0,I.jsxs)(i,{className:`chat-rail-compact-tabs`,"aria-label":`Conversation panels`,children:[(0,I.jsx)(r,{className:`chat-rail-compact-tab`,value:`chat`,children:`Chat`}),H&&(0,I.jsx)(r,{className:`chat-rail-compact-tab`,value:`tasks`,children:`Task`}),B&&(0,I.jsx)(r,{className:`chat-rail-compact-tab`,value:`skills`,children:`Skills`}),z&&(0,I.jsx)(r,{className:`chat-rail-compact-tab`,value:`references`,children:`References`})]}),(0,I.jsx)(o,{forceMount:!0,className:`chat-rail-compact-panel chat-rail-compact-chat`,value:`chat`,children:(0,I.jsx)(`div`,{className:`chat-rail-main`,children:u(P)})}),H&&U&&(0,I.jsxs)(o,{className:`chat-rail-compact-panel`,value:`tasks`,children:[V.length>1&&(0,I.jsxs)(`div`,{className:`chat-rail-compact-picker-row`,children:[(0,I.jsx)(`span`,{className:`muted small`,children:`Showing`}),(0,I.jsx)(xe,{variant:`picker`,tasks:V,activeRef:U,selected:!0,onSelect:x})]}),(0,I.jsx)(ye,{taskRef:U,onTaskChanged:c,onOpenTask:e=>window.dispatchEvent(new CustomEvent(`gezel:open-tab`,{detail:{kind:`task`,ref:e}}))},U)]}),B&&n&&(0,I.jsx)(o,{className:`chat-rail-compact-panel`,value:`skills`,children:(0,I.jsx)(le,{projectId:n,section:`skills`,onAvailabilityChange:ce},n)}),z&&R&&(0,I.jsxs)(o,{className:`chat-rail-compact-panel`,value:`references`,children:[f.length>1&&(0,I.jsxs)(`div`,{className:`chat-rail-compact-picker-row`,children:[(0,I.jsx)(`span`,{className:`muted small`,children:`Showing`}),(0,I.jsx)(Se,{variant:`picker`,refs:f,activeKey:R.key,selected:!0,onSelect:_})]}),(0,I.jsx)(`div`,{className:`chat-rail-viewer-wrap`,children:(0,I.jsx)(Te,{projectId:R.projectId??d,reference:R,onResolved:ae},R.key)})]})]})]}):(0,I.jsxs)(`div`,{ref:L,className:`chat-rail-body${W?` chat-rail-body-split`:``}`,style:{"--chat-rail-side-fraction":K.toFixed(4),"--chat-rail-min-main-width":`480px`,"--chat-rail-min-side-width":`${fe}px`,"--chat-rail-grip-track-width":`${pe}px`},children:[l&&(0,I.jsx)(`div`,{className:`chat-rail-banner`,children:l(P)}),(0,I.jsx)(`div`,{className:`chat-rail-main`,children:u(P)}),W&&(0,I.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize reference panel`,tabIndex:0,className:`chat-rail-grip`,onMouseDown:be,onKeyDown:Ce}),W&&(0,I.jsx)(`aside`,{className:`chat-rail-side`,children:(0,I.jsxs)(`div`,{className:`chat-rail-side-inner`,children:[([H,z,B].filter(Boolean).length>1||V.length>1||f.length>1)&&(0,I.jsxs)(`div`,{className:`chat-rail-section-tabs`,role:`tablist`,children:[H&&(V.length>1?(0,I.jsx)(xe,{tasks:V,activeRef:U,selected:S===`tasks`,onOpen:()=>C(`tasks`),onSelect:e=>{x(e),C(`tasks`)}}):(0,I.jsx)(`button`,{type:`button`,role:`tab`,className:`chat-rail-section-tab${S===`tasks`?` is-active`:``}`,"aria-selected":S===`tasks`,onClick:()=>C(`tasks`),children:`Task`})),B&&(0,I.jsx)(`button`,{type:`button`,role:`tab`,className:`chat-rail-section-tab${S===`skills`?` is-active`:``}`,"aria-selected":S===`skills`,onClick:()=>C(`skills`),children:`Skills`}),z&&(f.length>1?(0,I.jsx)(Se,{refs:f,activeKey:R.key,selected:S===`references`,onOpen:()=>C(`references`),onSelect:e=>{_(e),C(`references`)}}):(0,I.jsx)(`button`,{type:`button`,role:`tab`,className:`chat-rail-section-tab${S===`references`?` is-active`:``}`,"aria-selected":S===`references`,onClick:()=>C(`references`),children:`References`}))]}),S===`tasks`&&H&&U&&(0,I.jsx)(`div`,{className:`chat-rail-section-body`,children:(0,I.jsx)(`div`,{className:`chat-rail-viewer-wrap`,children:(0,I.jsx)(ye,{taskRef:U,onTaskChanged:c,onOpenTask:e=>window.dispatchEvent(new CustomEvent(`gezel:open-tab`,{detail:{kind:`task`,ref:e}}))},U)})}),S===`references`&&R&&(0,I.jsx)(`div`,{className:`chat-rail-section-body`,children:(0,I.jsx)(`div`,{className:`chat-rail-viewer-wrap`,children:(0,I.jsx)(Te,{projectId:R.projectId??d,reference:R,onResolved:ae},R.key)})}),S===`skills`&&n&&(0,I.jsx)(`div`,{className:`chat-rail-section-body`,children:(0,I.jsx)(le,{projectId:n,section:`skills`,onAvailabilityChange:ce},n)})]})})]})}function ye({taskRef:e,onOpenTask:t,onTaskChanged:n}){let[r,i]=(0,F.useState)(null),[a,o]=(0,F.useState)(!1),[s,c]=(0,F.useState)([]),[l,d]=(0,F.useState)(`idle`),[f,p]=(0,F.useState)([]),[m,x]=(0,F.useState)(!1),[S,C]=(0,F.useState)(null);if((0,F.useEffect)(()=>{let e=!1;return h.listGezels().then(t=>{e||p(t.gezels)}).catch(()=>{e||p([])}),()=>{e=!0}},[]),(0,F.useEffect)(()=>{let t=!1;return o(!1),i(null),C(null),h.getTaskByRef(e).then(e=>{t||(i(e),o(!0))}).catch(()=>{t||o(!0)}),()=>{t=!0}},[e]),(0,F.useEffect)(()=>{if(!r){c([]),d(`idle`);return}let e=!1;return d(`loading`),h.listTaskNotes(r.projectId,r.num).then(t=>{e||(c([...t.notes].sort((e,t)=>t.at.localeCompare(e.at))),d(`ready`))}).catch(()=>{e||(c([]),d(`error`))}),()=>{e=!0}},[r]),!a)return(0,I.jsx)(`p`,{className:`muted small chat-rail-task-empty`,children:`Loading task…`});if(!r)return(0,I.jsxs)(`p`,{className:`muted small chat-rail-task-empty`,children:[`Task `,(0,I.jsx)(`code`,{children:e}),` not found.`]});let w=r.craftbook,T=/^(.*) — \d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/.exec(r.title),E=w&&T?.[1]===w.id?w.name:r.title,O=r.origin?.kind===`system-job`?[`active`,`paused`]:[`active`,`paused`,`complete`,`canceled`],A=async e=>{if(!(e===r.status||m)){x(!0),C(null);try{let t=await h.setTaskStatus(r.projectId,r.num,e);i(t),n?.(t)}catch(e){C(e.message)}finally{x(!1)}}},j=r.status===`complete`||r.status===`canceled`,M=w?.steps??[],N=(j?void 0:r.activeStepId)??[...M].reverse().find(e=>e.completedAt)?.id??M[M.length-1]?.id??null;return(0,I.jsxs)(`div`,{className:`chat-rail-task`,children:[M.length>0&&(0,I.jsx)(`div`,{className:`chat-rail-task-track`,children:(0,I.jsx)(k,{steps:M,statusOf:e=>ne(e,r.activeStepId,j),selectedStepId:N,centerStepId:N,scroll:!0,stepRole:`button`,onSelect:()=>t?.(r.ref),ariaLabel:`Task progress`})}),(0,I.jsxs)(`div`,{className:`chat-rail-task-topbar`,children:[(0,I.jsxs)(`header`,{className:`chat-rail-task-header`,children:[(0,I.jsx)(`code`,{className:`chat-rail-task-ref`,children:r.ref}),r.status===`draft`?(0,I.jsx)(`span`,{className:`chat-rail-task-status chat-rail-task-status-draft`,children:`draft`}):(0,I.jsxs)(g,{children:[(0,I.jsx)(v,{asChild:!0,children:(0,I.jsxs)(`button`,{type:`button`,className:`chat-rail-task-status chat-rail-task-status-trigger chat-rail-task-status-${r.status}`,disabled:m,"aria-label":`Task status: ${X(r.status)}. Change status`,"aria-busy":m,children:[(0,I.jsx)(`span`,{children:X(r.status)}),(0,I.jsx)(u,{})]})}),(0,I.jsx)(y,{children:(0,I.jsx)(b,{className:`app-nav-menu chat-rail-task-status-menu`,align:`start`,sideOffset:4,children:O.map(e=>{let t=e===r.status;return(0,I.jsxs)(_,{className:`app-nav-menu-item chat-rail-task-status-option${t?` is-current`:``}`,disabled:t||m,"aria-current":t?`true`:void 0,onSelect:()=>void A(e),children:[(0,I.jsx)(`span`,{className:`task-status-dot task-status-${e}`,"aria-hidden":`true`}),(0,I.jsx)(`span`,{children:X(e)}),t&&(0,I.jsx)(`span`,{className:`sr-only`,children:` (current)`})]},e)})})})]})]}),(0,I.jsx)(`button`,{type:`button`,className:`chat-rail-task-open`,onClick:()=>t?.(r.ref),children:`Open full task`})]}),S&&(0,I.jsxs)(`p`,{className:`error small chat-rail-task-status-error`,role:`alert`,children:[`Couldn't change task status: `,S]}),(0,I.jsx)(`h4`,{className:`chat-rail-task-title`,children:E}),r.description&&(0,I.jsx)(`p`,{className:`chat-rail-task-desc`,children:r.description}),w&&(0,I.jsxs)(`div`,{className:`chat-rail-task-craftbook`,children:[(0,I.jsx)(`span`,{className:`muted small`,children:`From craftbook`}),` `,w.name]}),(0,I.jsxs)(`section`,{className:`chat-rail-task-history`,"aria-label":`History and notes`,children:[(0,I.jsx)(`h5`,{children:`History & notes`}),l===`loading`&&(0,I.jsx)(`p`,{className:`muted small`,children:`Loading notes…`}),l===`error`&&(0,I.jsx)(`p`,{className:`muted small`,children:`Notes unavailable.`}),l===`ready`&&s.length===0&&(0,I.jsx)(`p`,{className:`muted small`,children:`No notes yet.`}),s.length>0&&(0,I.jsx)(`ol`,{className:`chat-rail-task-notes`,children:s.map(e=>{let t=e.stepId?r.craftbook.steps.find(t=>t.id===e.stepId):void 0,n=e.author.kind===`gezel`?e.author.gezelId:void 0,i=n?f.find(e=>e.id===n):void 0;return(0,I.jsxs)(`li`,{className:`chat-rail-task-note`,children:[(0,I.jsxs)(`header`,{className:`chat-rail-task-note-header`,children:[(0,I.jsxs)(`span`,{className:`task-note-author-identity`,children:[i&&(0,I.jsx)(D,{svg:i.icon??null,poppetje:i.poppetje,iconOverride:i.iconOverride,name:i.name,size:22}),(0,I.jsx)(`span`,{children:e.author.kind===`user`?`You`:e.author.name})]}),(0,I.jsx)(`time`,{dateTime:e.at,title:e.at,children:be(e.at)}),t&&(0,I.jsx)(`span`,{className:`chat-rail-task-note-step`,children:t.name})]}),(0,I.jsx)(Me,{markdown:e.text,projectId:r.projectId,articleId:`task-note-${e.id}`})]},e.id)})})]})]})}function X(e){return e.charAt(0).toUpperCase()+e.slice(1)}function be(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function xe({tasks:e,activeRef:t,selected:n,onOpen:r,onSelect:i,variant:a=`tab`}){return(0,I.jsxs)(g,{onOpenChange:e=>{e&&r?.()},children:[(0,I.jsx)(v,{asChild:!0,children:(0,I.jsxs)(`button`,{type:`button`,role:a===`tab`?`tab`:void 0,className:a===`tab`?`chat-rail-section-tab chat-rail-section-tab-menu${n?` is-active`:``}`:`chat-rail-compact-picker chat-rail-section-tab-menu`,"aria-selected":a===`tab`?n:void 0,children:[(0,I.jsx)(`span`,{children:a===`tab`?`Tasks`:t??`Choose task`}),(0,I.jsx)(u,{className:`chat-rail-section-tab-chevron`})]})}),(0,I.jsx)(y,{children:(0,I.jsx)(b,{className:`app-nav-menu chat-rail-task-menu`,sideOffset:4,align:`start`,"aria-label":`Choose task`,children:e.map(e=>{let n=e.ref===t;return(0,I.jsxs)(_,{className:`app-nav-menu-item chat-rail-task-menu-item${n?` active`:``}`,"aria-current":n?`true`:void 0,onSelect:()=>i(e.ref),title:e.scoped?`${e.ref} (this thread's task)`:e.ref,children:[(0,I.jsx)(`span`,{className:`chat-rail-menu-check`,"aria-hidden":`true`,children:n&&(0,I.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,"aria-hidden":`true`,children:(0,I.jsx)(`path`,{d:`m2.25 6.25 2.25 2.25 5.25-5.25`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`})})}),(0,I.jsx)(`code`,{className:`chat-rail-task-menu-ref`,children:e.ref}),e.scoped&&(0,I.jsx)(`span`,{className:`chat-rail-task-menu-scope`,children:`This thread`})]},e.ref)})})})]})}function Se({refs:e,activeKey:t,selected:n,onOpen:r,onSelect:i,variant:a=`tab`}){let o=e.find(e=>e.key===t)?.path.split(`/`).pop();return(0,I.jsxs)(g,{onOpenChange:e=>{e&&r?.()},children:[(0,I.jsx)(v,{asChild:!0,children:(0,I.jsxs)(`button`,{type:`button`,role:a===`tab`?`tab`:void 0,className:a===`tab`?`chat-rail-section-tab chat-rail-section-tab-menu${n?` is-active`:``}`:`chat-rail-compact-picker chat-rail-section-tab-menu`,"aria-selected":a===`tab`?n:void 0,children:[(0,I.jsx)(`span`,{children:a===`tab`?`References`:o??`Choose reference`}),(0,I.jsx)(u,{className:`chat-rail-section-tab-chevron`})]})}),(0,I.jsx)(y,{children:(0,I.jsx)(b,{className:`app-nav-menu chat-rail-reference-menu`,sideOffset:4,align:`start`,"aria-label":`Choose reference`,children:e.map(e=>{let n=e.key===t,r=e.path.split(`/`).pop()||e.path;return(0,I.jsxs)(_,{className:`app-nav-menu-item chat-rail-reference-menu-item${n?` active`:``}`,"aria-current":n?`true`:void 0,onSelect:()=>i(e),title:e.path,children:[(0,I.jsx)(`span`,{className:`chat-rail-menu-check`,"aria-hidden":`true`,children:n&&(0,I.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,"aria-hidden":`true`,children:(0,I.jsx)(`path`,{d:`m2.25 6.25 2.25 2.25 5.25-5.25`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`})})}),(0,I.jsx)(E,{name:r,className:`chat-rail-reference-menu-icon`}),(0,I.jsx)(`span`,{className:`chat-rail-reference-menu-name`,children:r})]},e.key)})})})]})}async function Ce(e,t){let n=[t.kind,...[`artifact`,`workspace`,`document`].filter(e=>e!==t.kind)],r=null;for(let i of n)try{let n=await h.previewReference(e,{kind:i,path:t.path});if(n.mode===`media`){let r=await we(e,i,t.path);return{kind:i,mode:`media`,mediaKind:n.mediaKind,blob:r}}return{kind:i,...n}}catch(e){if(r=e,e instanceof m&&e.status===404)continue;throw e}throw r??Error(`not found: ${t.path}`)}async function we(e,t,n){return t===`artifact`?h.fetchProjectArtifactBlob(e,n):t===`workspace`?h.fetchProjectWorkspaceBlob(e,n):h.fetchDocumentBlob(n)}function Te({projectId:e,reference:t,onClose:n,onResolved:r}){let[i,a]=(0,F.useState)(null),[o,s]=(0,F.useState)(null),[c,l]=(0,F.useState)(null),[u,d]=(0,F.useState)(null),[f,p]=(0,F.useState)(!1),[h,x]=(0,F.useState)(t.kind),[S,C]=(0,F.useState)(null),[w,T]=(0,F.useState)(null),[E,D]=(0,F.useState)(!1),O=t.key,k=t.kind,A=t.path;(0,F.useEffect)(()=>{let t=!1,n=null;return D(!0),a(null),s(null),l(null),d(null),p(!1),C(null),T(null),x(k),(async()=>{try{let i=await Ce(e,{kind:k,path:A});if(t)return;i.mode===`media`?(n=URL.createObjectURL(i.blob),l(n),d(i.mediaKind)):i.mode===`binary`?p(!0):(a(i.content),s(i.mode)),x(i.kind),i.kind!==k&&r?.(O,i.kind)}catch(e){t||C(e instanceof m&&e.status===404?`Not found in artifacts, workspace, or documents: ${A}`:e.message)}finally{t||D(!1)}})(),()=>{t=!0,n&&URL.revokeObjectURL(n)}},[e,O,k,A,r]);let j=h!==t.kind,M={projectId:e,kind:h,path:t.path},N=async()=>{T(null);let e=window.__GEZEL__?.saveReferenceCopy;if(!e){T(`Saving a copy is available in the desktop app.`);return}try{let t=await e(M);t.ok||T(t.error)}catch(e){T(e instanceof Error?e.message:String(e))}},ee=async()=>{T(null);let e=window.__GEZEL__?.showReferenceInFolder;if(!e){T(`Showing the containing folder is available in the desktop app.`);return}try{let t=await e(M);t.ok||T(t.error)}catch(e){T(e instanceof Error?e.message:String(e))}};return(0,I.jsxs)(`div`,{className:`chat-rail-viewer`,children:[(0,I.jsxs)(`header`,{className:`chat-rail-viewer-header`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{className:`chat-rail-ref-kind chat-rail-ref-kind-${h}`,children:h}),j&&(0,I.jsxs)(`span`,{className:`muted small`,style:{marginLeft:`0.35rem`},children:[`(resolved from `,t.kind,`)`]}),(0,I.jsx)(`code`,{className:`chat-rail-viewer-path`,children:t.path})]}),(0,I.jsxs)(`div`,{className:`chat-rail-viewer-actions`,children:[(0,I.jsxs)(g,{children:[(0,I.jsx)(v,{asChild:!0,children:(0,I.jsx)(`button`,{type:`button`,className:`tree-actions-trigger chat-rail-viewer-actions-trigger`,"aria-label":`Actions for ${t.path.split(`/`).pop()||t.path}`,title:`File actions`,children:(0,I.jsx)(`span`,{"aria-hidden":`true`,children:`⋯`})})}),(0,I.jsx)(y,{children:(0,I.jsxs)(b,{className:`app-nav-menu tree-actions-menu chat-rail-viewer-actions-menu`,sideOffset:4,align:`end`,children:[(0,I.jsx)(_,{className:`app-nav-menu-item`,onSelect:()=>void N(),children:`Save copy as…`}),(0,I.jsx)(_,{className:`app-nav-menu-item`,onSelect:()=>void ee(),children:`Open containing folder`})]})})]}),n&&(0,I.jsx)(`button`,{type:`button`,className:`chat-rail-viewer-close`,onClick:n,children:`×`})]})]}),w&&(0,I.jsx)(`p`,{className:`error small chat-rail-viewer-action-error`,children:w}),(0,I.jsxs)(`div`,{className:`chat-rail-viewer-body`,children:[E&&(0,I.jsx)(`p`,{className:`muted small`,children:`Loading…`}),S&&(0,I.jsx)(`p`,{className:`error`,children:S}),c!==null&&!E&&!S&&u===`video`&&(0,I.jsx)(Oe,{path:t.path,src:c}),c!==null&&!E&&!S&&u===`audio`&&(0,I.jsx)(ke,{path:t.path,src:c}),c!==null&&!E&&!S&&u===`image`&&(0,I.jsx)(De,{path:t.path,src:c}),f&&!E&&!S&&(0,I.jsx)(Ae,{path:t.path,onSaveCopy:()=>void N(),onOpenContainingFolder:()=>void ee()}),i!==null&&!E&&!S&&(o===`markdown`||J(t.path)?(0,I.jsx)(Me,{markdown:i,projectId:e,reportPath:h===`artifact`?t.path:void 0}):Y(t.path)&&(h===`artifact`||h===`workspace`)?(0,I.jsx)(P,{projectId:e,path:t.path,source:h===`workspace`?`workspace`:`artifacts`,title:t.path,className:`chat-rail-viewer-iframe`}):(0,I.jsx)(Ee,{path:t.path,content:i}))]})]})}function Ee({path:e,content:t}){return(0,I.jsx)(`div`,{className:`chat-rail-viewer-code`,children:(0,I.jsx)(w,{initialMarkdown:t,fileName:e,height:`100%`,colorScheme:j(),showPlayTab:!1,fullWidth:!0,readOnly:!0},e)})}function De({path:e,src:t}){return(0,I.jsx)(`div`,{className:`chat-rail-viewer-code`,children:(0,I.jsx)(`img`,{src:t,alt:e,style:{maxWidth:`100%`,maxHeight:`100%`,objectFit:`contain`,display:`block`,margin:`0 auto`}},e)})}function Oe({path:e,src:t}){return(0,I.jsx)(`div`,{className:`chat-rail-viewer-code`,children:(0,I.jsx)(`video`,{src:t,controls:!0,preload:`metadata`,playsInline:!0,style:{maxWidth:`100%`,maxHeight:`100%`,display:`block`,margin:`0 auto`,background:`#000`}},e)})}function ke({path:e,src:t}){return(0,I.jsx)(`div`,{className:`chat-rail-viewer-code chat-rail-audio-preview`,children:(0,I.jsx)(`audio`,{src:t,controls:!0,preload:`metadata`},e)})}function Ae({path:e,onSaveCopy:t,onOpenContainingFolder:n}){return(0,I.jsxs)(`div`,{className:`chat-rail-machine-file`,children:[(0,I.jsxs)(`svg`,{className:`chat-rail-machine-file-icon`,width:`40`,height:`40`,viewBox:`0 0 40 40`,fill:`none`,"aria-hidden":`true`,children:[(0,I.jsx)(`path`,{d:`M10 4h13l7 7v25H10z`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,I.jsx)(`path`,{d:`M23 4v8h7M15 21h10M15 26h10`,stroke:`currentColor`,strokeWidth:`1.5`})]}),(0,I.jsx)(`p`,{className:`chat-rail-machine-file-label`,children:`<Machine File>`}),(0,I.jsx)(`code`,{className:`chat-rail-machine-file-path`,children:e}),(0,I.jsxs)(`div`,{className:`chat-rail-machine-file-actions`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:t,children:`Save copy as…`}),(0,I.jsx)(`button`,{type:`button`,onClick:n,children:`Open containing folder`})]})]})}var Z={id:`gezel-dark`,background:`#1c1f1c`,backgroundLight:`#252925`,text:`#f0ede4`,textMuted:`#9da195`},je={id:`gezel-light`,background:`#f3eddf`,backgroundLight:`#eae5d6`,text:`#1c1c1c`,textMuted:`#666666`};function Me({markdown:e,projectId:t,reportPath:n,articleId:r=`ref-preview`}){let i=(0,F.useMemo)(()=>{try{return x(S(e),{articleId:r})}catch{return null}},[r,e]),a=j(),o=(0,F.useMemo)(()=>n&&p(e)?re({projectId:t,reportPath:n}):void 0,[e,t,n]),s=a===`dark`?Z:je;return i?(0,I.jsx)(`div`,{className:`chat-rail-viewer-markdown`,children:(0,I.jsx)(C,{doc:i,theme:O,surface:s,fenceRenderers:o})}):(0,I.jsx)(`pre`,{className:`chat-rail-viewer-raw`,children:e})}var Ne=[e=>`Talk with ${e} about project ideas, to catch up on existing projects, or to spin up a new gezel.`,e=>`Ask ${e} what you should work on next — or just say what's on your mind.`,e=>`${e} knows the whole team. Ask what everyone's doing, delegate something new, or just vent about a stuck project.`,e=>`Got a half-baked idea? ${e} will help shape it into something your gezels can actually start on.`,(e,t)=>`Ask ${e} who's working on what, or hand ${t.object} something new to route.`],Pe=[(e,t)=>`Talk with ${e} about ${t}.`,(e,t)=>`Ask ${e} how ${t} is going, nudge a stuck task, or rework the plan.`,(e,t,n)=>`${e} runs ${t}. Check in on progress, change direction, or approve ${n.possessiveAdjective} latest move.`,(e,t,n)=>`What's blocking ${t}? Ask ${e} — ${n.subject} will either know or can go find out.`,(e,t)=>`Give ${e} a new brief for ${t}, or ask where the last thing landed.`],Fe=[e=>`Talk with ${e}.`,(e,t)=>`Ask ${e} a question, hand ${t.object} something to work on, or just see what ${t.subject} ${t.presentBe} up to.`,(e,t)=>`${e} is here when you need ${t.object}. Fire away.`,(e,t)=>`Catch ${e} up on what you want next, or ask what ${t.subject} ${t.presentHave} shipped.`],Ie={generate_image:[e=>`${e} only generates images. Describe the image you want exactly — e.g. "log cabin under a rainbow." No need for full sentences.`,e=>`${e} turns a description into an image. Just list what you want to see — "neon city street at night, rain" — keywords are fine.`],generate_video:[e=>`${e} only generates video. Describe the shot you want exactly — e.g. "drone flyover of a snowy forest." No need for full sentences.`,e=>`${e} turns a description into a clip. Just list what you want to see — "waves crashing on rocks at sunset" — keywords are fine.`]},Le=[e=>`${e} forwards whatever you type straight to one tool — there's no chat in the middle. Describe exactly what you want; keywords are fine.`],Re=[e=>`Go ahead, ${e} is listening.`,(e,t)=>`${e} has been waiting patiently. Ask ${t.object} anything.`,e=>`No wrong questions. ${e} has probably heard weirder.`,e=>`Don't be shy — ${e} has seen it all.`];function ze(e){let{role:t,gezelName:n}=e,r=d(e.gezelGender);if(e.fixedFunctionTool){let t=Ie[e.fixedFunctionTool]??Le,r=t[Math.floor(Math.random()*t.length)];return Q(r?r(n):Le[0](n))}if(Math.random()<.15){let e=Re[Math.floor(Math.random()*Re.length)];if(e)return Q(e(n,r))}if(t===`meester`){let e=Ne[Math.floor(Math.random()*Ne.length)];return Q(e?e(n,r):`Talk with ${n}.`)}if(t===`voorman`){let t=e.projectName??`this project`,i=Pe[Math.floor(Math.random()*Pe.length)];return Q(i?i(n,t,r):`Talk with ${n} about ${t}.`)}let i=Fe[Math.floor(Math.random()*Fe.length)];return Q(i?i(n,r):`Talk with ${n}.`)}function Q(e){let t=/\b(?:e\.g|i\.e|etc|vs|approx|no|fig|Mr|Mrs|Ms|Dr|St)\.$/iu;return e.replace(/(^|[.?!]["')\]]?\s+)(["'(\[]*)(\p{Ll})/gu,(n,r,i,a,o)=>r.startsWith(`.`)&&t.test(e.slice(0,o+1))?n:`${r}${i}${a.toUpperCase()}`)}var Be=128,$=new Map,Ve=`meester`;function He(e,t){return`gezel|${e}|${t}`}function Ue(e){return`gezel-all|${e}`}function We(e){return`project|${e}`}function Ge(e,t){return`project|${e}|${t}`}function Ke(e){return $.get(e)}function qe(e,t){let n={...$.get(e),...t};for($.delete(e),$.set(e,n);$.size>Be;){let e=$.keys().next();if(e.done)break;$.delete(e.value)}}export{Ge as a,ze as c,We as i,ve as l,Ue as n,Ke as o,He as r,qe as s,Ve as t,le as u};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-CJfks21t.js","assets/preload-helper-Czpn1I53.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-UMNXGZaF.js","assets/rolldown-runtime-aKtaBQYM.js","assets/chunk-I66GZJ75-LdZkBIbB.js","assets/chunk-NSK5VX7P-52z7Dk2L.js","assets/dist-qx0Iv9vM.js","assets/chunk-3NCLNEKW-lEIanHax.js","assets/chunk-4I5QYGJK-CM-bp6pS.js","assets/chunk-WRU74C26-DepDkkds.js","assets/chunk-7BUUIJ7U-Bb538aSH.js","assets/chunk-UBXNYLIW-BndvwrJT.js","assets/chunk-W5SLKNZC-DYPZQgVw.js","assets/chunk-QR6OTTB3-BCXb4Qaf.js","assets/rough.esm-CSKSodPl.js","assets/chunk-7Z6QIM7H-BQaDNVzL.js","assets/line-CFHPqps4.js","assets/path-BWPyau1x.js","assets/array-BifhSqXX.js","assets/chunk-J7OUQ5F2-CYJFmXpz.js","assets/chunk-ZIRB5QZD-C6fEPe3t.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{C as r,It as i,M as a,Pt as o,Rt as s,S as c,V as l,X as u,_ as d,d as f,g as p,ht as m,it as h,lt as g,p as _,u as v,ut as y}from"./doc-s6H7T0IO.js";import{f as b,s as x}from"./chunk-O7JILDEF-CqcO1qaI.js";import{n as S}from"./chunk-BAOV476U-CEOFYt8X.js";import{s as C}from"./chunk-4VOD55SX-BFSSw0c8.js";import{O as w,d as T,o as E}from"./chunk-GAZKTT4R-BkP6-w3z.js";import{F as D,P as O,n as ee}from"./chunk-MIKKUKOD-XIkmalSN.js";import{a as k,i as te,n as A,t as ne}from"./chunk-7ZAAICW4-BsCpYJH6.js";import{c as j,i as M,n as N}from"./markdown-Bi9b5f5Y.js";import{n as re}from"./schemas-JY4jmLbC.js";import{t as P}from"./preload-helper-Czpn1I53.js";import"./inlineIconMarker-BQI2HLeD.js";import{t as ie}from"./chunk-TT6ENR6T-CaYjVwjm.js";var F=e(t(),1),I=n(),L=null,ae={startOnLoad:!1,securityLevel:`strict`,suppressErrorRendering:!0,deterministicIds:!1,logLevel:`error`};async function oe(){return L||=P(async()=>{let{default:e}=await import(`./mermaid.core-CJfks21t.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])).then(({default:e})=>e).catch(e=>{throw L=null,e}),L}function se(e){let t=globalThis,n=(t.__squisqMermaidWorkQueue??Promise.resolve()).then(e,e);return t.__squisqMermaidWorkQueue=n.then(()=>void 0,()=>void 0),n}function ce(e,t,n,r=E){return se(async()=>{let i=await oe();i.initialize({...ae,theme:`base`,themeVariables:re(r)});let{svg:a,diagramType:o}=await i.render(e,t,n);return{svg:a,diagramType:o}})}function le(e){return(e instanceof Error?e.message:String(e)).split(/\r?\n/).map(e=>e.trimEnd()).filter(Boolean).slice(0,6).join(`
|
|
3
|
-
`)||`Unknown Mermaid rendering error.`}var ue=0;function de({source:e,className:t,ariaLabel:n=`Mermaid diagram`,theme:r=E}){let[i,a]=(0,F.useState)(``),[o,s]=(0,F.useState)(``),[c,l]=(0,F.useState)(!0);return(0,F.useEffect)(()=>{let t=!0,n=`squisq-rich-mermaid-${++ue}`;return l(!0),s(``),ce(n,e,void 0,r).then(e=>{t&&a(e.svg)}).catch(e=>{t&&(a(``),s(le(e)))}).finally(()=>{t&&l(!1)}),()=>{t=!1}},[e,r]),(0,I.jsxs)(`div`,{className:[`squisq-mermaid-rendered`,t].filter(Boolean).join(` `),role:`img`,"aria-label":n,style:{background:r.colors.backgroundLight,color:r.colors.text},children:[c&&(0,I.jsx)(`div`,{className:`squisq-mermaid-render-status`,children:`Rendering diagram…`}),!c&&o&&(0,I.jsxs)(`div`,{className:`squisq-mermaid-render-error`,role:`alert`,children:[(0,I.jsx)(`strong`,{children:`Mermaid could not render this diagram.`}),(0,I.jsx)(`pre`,{children:o})]}),!c&&!o&&i&&(0,I.jsx)(`div`,{className:`squisq-mermaid-render-svg`,dangerouslySetInnerHTML:{__html:i}})]})}var fe=(0,F.createContext)(null),pe=(0,F.createContext)(N);function me(){return(0,F.useContext)(pe)}function he(){return(0,F.useContext)(fe)}function R(e,t){let n=he(),r=me(),i=typeof e==`string`?e:``,a=!i||/^(?:[a-z][a-z0-9+.-]*:|\/\/|\/)/i.test(i),o=(0,F.useMemo)(()=>{let e=a?i:`${t.replace(/\/$/,``)}/${i}`;return j(e,r)?e:``},[a,i,t,r]),s=!a&&!!n,[c,l]=(0,F.useState)(o);return(0,F.useEffect)(()=>{if(!s){l(o);return}let e=!1;return l(o),n.resolveUrl(i).then(t=>{e||l(j(t,r)?t:``)},()=>{e||l(o)}),()=>{e=!0}},[s,n,i,o,r]),s?c:o}function z(e,t){return typeof e==`number`?e:e.endsWith(`%`)?parseFloat(e)/100*t:parseFloat(e)}function B(e,t,n){switch(e){case`center`:return{x:-t/2,y:-n/2};case`top-right`:return{x:-t,y:0};case`bottom-left`:return{x:0,y:-n};case`bottom-right`:return{x:-t,y:-n};default:return{x:0,y:0}}}function ge({layer:e,basePath:t,viewport:n,blockTime:r,animationsEnabled:i=!0}){let{content:a,position:o,animation:s}=e,c=z(o.x,n.width),l=z(o.y,n.height),u=o.width?z(o.width,n.width):n.width,d=o.height?z(o.height,n.height):n.height,f=B(o.anchor,u,d),m=c+f.x,h=l+f.y,g=R(a.src,t),v=p(s,r),y=_(a.treatment,a.blur),b=_e(a.fit),x=a.fit===`cover`,S=s&&ve.has(s.type);if(x&&be(n,u,d,i,s)){let t=xe(s),n=Se(S?s:void 0),r=S?{className:``,style:{}}:v;return(0,I.jsx)(`g`,{className:`block-layer block-layer--image ${r.className}`,style:r.style,"data-layer-id":e.id,"data-image-framing":`portrait-pan`,children:(0,I.jsx)(`foreignObject`,{x:m,y:h,width:u,height:d,children:(0,I.jsx)(`div`,{style:{width:`${u}px`,height:`${d}px`,overflow:`hidden`},children:(0,I.jsx)(`img`,{src:g,alt:a.alt||``,className:t,style:{width:`${u}px`,height:`${d}px`,objectFit:`cover`,objectPosition:`center`,display:`block`,pointerEvents:`none`,...y?{filter:y}:{},...a.blur&&a.blur>0?{transform:`scale(1.06)`}:{},...n}})})})})}if(x&&S&&s){let t=p(Ce(s),r);return(0,I.jsx)(`g`,{className:`block-layer block-layer--image`,"data-layer-id":e.id,children:(0,I.jsx)(`foreignObject`,{x:m,y:h,width:u,height:d,children:(0,I.jsx)(`div`,{style:{width:`${u}px`,height:`${d}px`,overflow:`hidden`},children:(0,I.jsx)(`img`,{src:g,alt:a.alt||``,className:t.className,style:{width:`${u}px`,height:`${d}px`,objectFit:`cover`,objectPosition:`center`,display:`block`,pointerEvents:`none`,transformOrigin:`center center`,...y?{filter:y}:{},...t.style}})})})})}return x?(0,I.jsx)(`g`,{className:`block-layer block-layer--image ${v.className}`,style:v.style,"data-layer-id":e.id,children:(0,I.jsx)(`foreignObject`,{x:m,y:h,width:u,height:d,children:(0,I.jsx)(`img`,{src:g,alt:a.alt||``,style:{width:`${u}px`,height:`${d}px`,objectFit:`cover`,objectPosition:`center`,display:`block`,pointerEvents:`none`,...y?{filter:y}:{},...a.blur&&a.blur>0?{transform:`scale(1.06)`}:{}}})})}):(0,I.jsx)(`g`,{className:`block-layer block-layer--image ${v.className}`,style:v.style,"data-layer-id":e.id,children:(0,I.jsx)(`image`,{href:g,x:m,y:h,width:u,height:d,preserveAspectRatio:b,style:{pointerEvents:`none`,...y?{filter:y}:{}}})})}function _e(e){switch(e){case`cover`:return`xMidYMid slice`;case`fill`:return`none`;default:return`xMidYMid meet`}}var ve=new Set([`panLeft`,`panRight`,`slowZoom`,`zoomIn`,`zoomOut`]),ye=.83;function be(e,t,n,r,i){return!r||i?.type===`none`||e.width/e.height>=ye?!1:t>=e.width*.7&&n>=e.height*.7}function xe(e){return e?.type===`panRight`||e?.type===`slowZoom`&&e.panDirection===`right`?`squisq-image--portrait-pan-left`:`squisq-image--portrait-pan-right`}function Se(e){return{"--portrait-pan-duration":`${e?.duration??12}s`,"--portrait-pan-delay":`${e?.delay??0}s`,"--portrait-pan-easing":e?.easing??`ease-in-out`}}function Ce(e){switch(e.type){case`panLeft`:return{...e,type:`slowZoom`,panDirection:`left`};case`panRight`:return{...e,type:`slowZoom`,panDirection:`right`};case`zoomIn`:return{...e,type:`slowZoom`,direction:`in`};case`zoomOut`:return{...e,type:`slowZoom`,direction:`out`};default:return e}}function we(e,t){if(!e||e===`solid`)return;let n=Math.max(1,t??1);return e===`dotted`?`${n} ${n*2}`:`${n*3} ${n*2}`}function Te(e=0){let t=e*Math.PI/180,n=Math.sin(t),r=Math.cos(t);return{x1:.5-n/2,y1:.5-r/2,x2:.5+n/2,y2:.5+r/2}}function Ee(e){return`squisq-grad-${e}`}function De(e,t,n,r){if(r){let t=`squisq-pattern-${e}`;return{fill:`url(#${t})`,def:Oe(t,r)}}if(n){let t=Ee(e),r=Te(n.angle);return{fill:`url(#${t})`,def:(0,I.jsxs)(`linearGradient`,{id:t,x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,children:[(0,I.jsx)(`stop`,{offset:`0%`,stopColor:n.from}),(0,I.jsx)(`stop`,{offset:`100%`,stopColor:n.to})]})}}return{fill:t,def:null}}function Oe(e,t){let n=t.size??24,r=t.opacity??1,i=t.color;return(0,I.jsxs)(`pattern`,{id:e,width:n,height:n,patternUnits:`userSpaceOnUse`,patternTransform:t.kind===`diagonal`?`rotate(45)`:void 0,children:[t.kind===`dots`&&(0,I.jsx)(`circle`,{cx:n/2,cy:n/2,r:Math.max(1,n/12),fill:i,opacity:r}),t.kind===`grid`&&(0,I.jsx)(`path`,{d:`M ${n} 0 L 0 0 0 ${n}`,fill:`none`,stroke:i,strokeWidth:1,opacity:r}),t.kind===`diagonal`&&(0,I.jsx)(`line`,{x1:0,y1:0,x2:0,y2:n,stroke:i,strokeWidth:1,opacity:r})]})}function ke(e,t){if(!t||t.type!==`noise`)return{filterAttr:void 0,def:null};let n=`squisq-noise-${e}`,r=t.opacity??.05;return{filterAttr:`url(#${n})`,def:(0,I.jsxs)(`filter`,{id:n,x:`0%`,y:`0%`,width:`100%`,height:`100%`,children:[(0,I.jsx)(`feTurbulence`,{type:`fractalNoise`,baseFrequency:t.baseFrequency??.8,numOctaves:2,stitchTiles:`stitch`,result:`noise`}),(0,I.jsx)(`feColorMatrix`,{in:`noise`,type:`saturate`,values:`0`,result:`mono`}),(0,I.jsx)(`feComponentTransfer`,{in:`mono`,result:`faded`,children:(0,I.jsx)(`feFuncA`,{type:`linear`,slope:r,intercept:0})}),(0,I.jsx)(`feComposite`,{in:`faded`,in2:`SourceGraphic`,operator:`in`})]})}}function Ae(e){return e.layer.content.html?.trim()?(0,I.jsx)(Fe,{...e}):ne(e.layer.content.text??``)?(0,I.jsx)(Ne,{...e}):(0,I.jsx)(Pe,{...e})}function je(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function Me(e){return te(e).map(e=>e.type===`icon`?`<i class="${A(e.family,e.name)}" aria-hidden="true"></i>`:je(e.text).replace(/\n/g,`<br>`)).join(``)}function Ne({layer:e,viewport:t,blockTime:n}){let{content:r,position:i,animation:a}=e,{text:o,style:s}=r,c=z(i.x,t.width),l=z(i.y,t.height),u=i.width==null?t.width:z(i.width,t.width),d=i.anchor??`top-left`,f=s.lineHeight||1.4,m=s.fontSize*f,h=s.padding??0,g=k(o??``),_=g.split(`
|
|
4
|
-
`).flatMap(e=>Ue(e,s.fontSize,u)),v=i.height==null?Math.max(m,_.length*m)+h*2:z(i.height,t.height),y=c-V(d,u,`x`),b=l-V(d,v,`y`),x=p(a,n),S=(0,F.useMemo)(()=>Me(o??``),[o]),C={boxSizing:`border-box`,width:`100%`,height:`100%`,display:`flex`,flexDirection:`column`,justifyContent:s.verticalAlign===`top`?`flex-start`:s.verticalAlign===`bottom`?`flex-end`:`center`,padding:h,color:s.color,fontSize:`${s.fontSize}px`,fontFamily:s.fontFamily||`system-ui, -apple-system, "Segoe UI", Roboto, sans-serif`,fontWeight:s.fontWeight||`normal`,fontStyle:s.fontStyle||`normal`,lineHeight:f,textAlign:s.textAlign??`left`,...s.shadow?{textShadow:`0 2px 3px rgba(0,0,0,0.7)`}:{},...x.style};return(0,I.jsx)(`g`,{className:`block-layer block-layer--text ${x.className}`,"data-layer-id":e.id,children:(0,I.jsx)(`foreignObject`,{x:y,y:b,width:u,height:v,style:{overflow:`visible`},children:(0,I.jsx)(`div`,{xmlns:`http://www.w3.org/1999/xhtml`,style:C,children:(0,I.jsx)(`div`,{style:{width:`100%`,whiteSpace:`pre-wrap`,wordBreak:`break-word`},"aria-label":g,dangerouslySetInnerHTML:{__html:S}})})})})}function Pe({layer:e,viewport:t,blockTime:n}){let r=`${(0,F.useId)().replace(/:/g,``)}-${e.id}`,{content:i,position:a,animation:o}=e,{text:s,style:c}=i,l=z(a.x,t.width),u=z(a.y,t.height),d=a.width==null?void 0:z(a.width,t.width),f=a.height==null?void 0:z(a.height,t.height),m=d,h=Re(c.textAlign,a.anchor),g=ze(c.verticalAlign,a.anchor),_=a.anchor??`top-left`,v=Be(l,d,_,h),y=Ve(u,f,_,g),b=p(o,n),x=(s??``).split(`
|
|
5
|
-
`),S=m?x.reduce((e,t)=>e.concat(Ue(t,c.fontSize,m)),[]):x;if(c.maxLines&&S.length>c.maxLines){S=S.slice(0,c.maxLines);let e=S[S.length-1];S[S.length-1]=e.replace(/\s*$/,``)+`...`}let C=c.lineHeight||1.4,w=c.fontSize*C,T=c.shrinkToFit===!0,E=T&&g===`middle`?-((S.length-1)/2)*w:0,D=(0,F.useRef)(null),[O,ee]=(0,F.useState)(null);(0,F.useLayoutEffect)(()=>{if(!T){ee(null);return}let e=D.current;if(!e||typeof e.getBBox!=`function`)return;let n=()=>{try{let n=e.getBBox();if(n.width<=0||n.height<=0)return;let r=d??t.width,i=f??t.height,a=Math.min(1,r/n.width,i/n.height);ee(a<.995?{scale:a,cx:n.x+n.width/2,cy:n.y+n.height/2}:null)}catch{}};n();let r=e.ownerDocument?.fonts;if(r&&r.status!==`loaded`){let e=!1;return r.ready.then(()=>{e||n()}),()=>{e=!0}}},[T,S.join(`
|
|
6
|
-
`),d,f,t.width,t.height,c.fontSize,c.fontFamily,c.fontWeight]);let k=O?`translate(${O.cx} ${O.cy}) scale(${O.scale}) translate(${-O.cx} ${-O.cy})`:void 0,te={fontSize:`${c.fontSize}px`,fontFamily:c.fontFamily||`system-ui, -apple-system, "Segoe UI", Roboto, sans-serif`,fontWeight:c.fontWeight||`normal`,fontStyle:c.fontStyle||`normal`,fill:c.color,...b.style},A=c.shadow?`shadow-${r}`:void 0;return(0,I.jsxs)(`g`,{className:`block-layer block-layer--text ${b.className}`,"data-layer-id":e.id,children:[c.shadow&&(0,I.jsx)(`defs`,{children:(0,I.jsx)(`filter`,{id:A,x:`-20%`,y:`-20%`,width:`140%`,height:`140%`,children:(0,I.jsx)(`feDropShadow`,{dx:`0`,dy:`2`,stdDeviation:`3`,floodColor:`rgba(0,0,0,0.7)`})})}),(0,I.jsx)(Le,{layerId:r,style:c,box:d!=null&&f!=null?{x:l-V(_,d,`x`),y:u-V(_,f,`y`),width:d,height:f}:{x:v-(c.padding||16),y:y-c.fontSize-(c.padding||16),width:He(S,c)+(c.padding||16)*2,height:S.length*w+(c.padding||16)*2}}),(0,I.jsx)(`text`,{ref:D,x:v,y,textAnchor:h,dominantBaseline:g,style:te,filter:A?`url(#${A})`:void 0,transform:k,children:S.map((e,t)=>(0,I.jsxs)(`tspan`,{x:v,dy:t===0?E:w,children:[e||`\xA0`,` `]},t))})]})}function Fe({layer:e,viewport:t,blockTime:n}){let{content:r,position:i,animation:a}=e,{html:o,style:s}=r,c=z(i.x,t.width),l=z(i.y,t.height),u=i.width==null?t.width:z(i.width,t.width),d=i.height==null?s.fontSize*(s.lineHeight||1.4)*2:z(i.height,t.height),f=i.anchor??`top-left`,m=c-V(f,u,`x`),h=l-V(f,d,`y`),g=(0,F.useMemo)(()=>b(O(x(o??``))),[o]),_=p(a,n),v=s.verticalAlign===`middle`?`center`:s.verticalAlign===`bottom`?`flex-end`:`flex-start`,y=!!(s.borderColor&&(s.borderWidth??0)>0),S={boxSizing:`border-box`,width:`100%`,height:`100%`,display:`flex`,flexDirection:`column`,justifyContent:v,padding:s.padding??0,color:s.color,fontSize:`${s.fontSize}px`,fontFamily:s.fontFamily||`system-ui, -apple-system, "Segoe UI", Roboto, sans-serif`,fontWeight:s.fontWeight||`normal`,fontStyle:s.fontStyle||`normal`,lineHeight:s.lineHeight||1.4,textAlign:s.textAlign??`left`,overflow:`hidden`,...s.background?{background:s.background}:{},...y?{border:`${s.borderWidth}px ${s.borderStyle??`solid`} ${s.borderColor}`,borderRadius:4}:{},...s.shadow?{textShadow:`0 2px 3px rgba(0,0,0,0.7)`}:{},..._.style},C=`squisq-rich-text-${Ie(e.id)}`,w=`.${C}{margin:0}.${C} p{margin:0 0 .4em}.${C} h1,.${C} h2,.${C} h3,.${C} h4,.${C} h5,.${C} h6{margin:0 0 .3em;line-height:1.2}.${C} ul,.${C} ol{margin:0 0 .7em;padding-left:1.2em;list-style-position:${s.textAlign===`center`||s.textAlign===`right`?`inside`:`outside`}}.${C} li{margin:0}.${C} li>p{display:inline;margin:0}.${C} *:first-child{margin-top:0}.${C} *:last-child{margin-bottom:0}.${C} a{color:inherit;text-decoration:underline}`;return(0,I.jsx)(`g`,{className:`block-layer block-layer--text ${_.className}`,"data-layer-id":e.id,children:(0,I.jsx)(`foreignObject`,{x:m,y:h,width:u,height:d,color:s.color,style:{color:s.color},children:(0,I.jsxs)(`div`,{xmlns:`http://www.w3.org/1999/xhtml`,style:S,children:[(0,I.jsx)(`style`,{children:w}),(0,I.jsx)(`div`,{className:C,"aria-label":r.text,style:{width:`100%`,color:s.color,whiteSpace:`pre-wrap`,wordBreak:`break-word`},dangerouslySetInnerHTML:{__html:g}})]})})})}function Ie(e){return e.replace(/[^a-zA-Z0-9_-]/g,`-`)}function Le({layerId:e,style:t,box:n}){let r=!!(t.background||t.backgroundGradient),i=!!(t.borderColor&&(t.borderWidth??0)>0);if(!r&&!i)return null;let{fill:a,def:o}=De(e,t.background,t.backgroundGradient),s=we(t.borderStyle,t.borderWidth);return(0,I.jsxs)(I.Fragment,{children:[o&&(0,I.jsx)(`defs`,{children:o}),(0,I.jsx)(`rect`,{x:n.x,y:n.y,width:n.width,height:n.height,fill:r?a:`none`,fillOpacity:r?t.backgroundOpacity:void 0,stroke:i?t.borderColor:void 0,strokeWidth:i?t.borderWidth:void 0,strokeDasharray:i?s:void 0,rx:4,ry:4})]})}function Re(e,t){return e===`center`?`middle`:e===`right`?`end`:e===`left`?`start`:t?.includes(`right`)?`end`:t===`center`?`middle`:`start`}function ze(e,t){return e===`top`?`text-before-edge`:e===`middle`?`middle`:e===`bottom`||t?.includes(`bottom`)?`text-after-edge`:t===`center`?`middle`:`text-before-edge`}function Be(e,t,n,r){if(t==null)return e;let i=e-V(n,t,`x`);return r===`middle`?i+t/2:r===`end`?i+t:i}function Ve(e,t,n,r){if(t==null)return e;let i=e-V(n,t,`y`);return r===`middle`?i+t/2:r===`text-after-edge`?i+t:i}function V(e,t,n){return e===`center`?t/2:n===`x`?e.includes(`right`)?t:0:e.includes(`bottom`)?t:0}function He(e,t){return Math.max(...e.map(e=>e.length))*t.fontSize*.55}function Ue(e,t,n){if(!e.trim())return[``];let r=t*.5,i=Math.floor(n/r);if(i<=0)return[e];let a=e.split(/\s+/),o=[],s=``;for(let e of a){let t=s?`${s} ${e}`:e;if(t.length<=i)s=t;else if(s&&o.push(s),e.length>i){let t=e;for(;t.length>i;)o.push(t.slice(0,i)),t=t.slice(i);s=t}else s=e}return s&&o.push(s),o.length>0?o:[``]}var We=1;function Ge({layer:e,viewport:t,blockTime:n}){let{content:r,position:i,animation:a}=e,o=`${(0,F.useId)().replace(/:/g,``)}-${e.id}`,s=z(i.x,t.width),c=z(i.y,t.height),l=i.width?z(i.width,t.width):100,u=i.height?z(i.height,t.height):100,d=B(i.anchor,l,u),f=s+d.x,m=c+d.y,h=r.shape===`rect`&&f===0&&m===0&&l===t.width&&u===t.height&&!r.stroke&&!r.borderRadius?We:0,g=f-h,_=m-h,v=l+h*2,y=u+h*2,b=p(a,n),x=r.fill||`none`,S=typeof x==`string`&&x.includes(`gradient(`);if(r.shape===`rect`&&S&&!r.gradient)return(0,I.jsx)(`g`,{className:`block-layer block-layer--shape ${b.className}`,style:b.style,"data-layer-id":e.id,children:(0,I.jsx)(`foreignObject`,{x:g,y:_,width:v,height:y,children:(0,I.jsx)(`div`,{style:{width:`${v}px`,height:`${y}px`,background:x,borderRadius:r.borderRadius?`${r.borderRadius}px`:void 0,pointerEvents:`none`}})})});let{fill:C,def:w}=De(o,x,r.gradient,r.pattern),{filterAttr:T,def:E}=ke(o,r.filter),D=we(r.borderStyle,r.strokeWidth),O={fill:C,fillOpacity:r.fillOpacity,stroke:r.stroke,strokeWidth:r.strokeWidth,strokeDasharray:D,...T?{filter:T}:{}};return(0,I.jsxs)(`g`,{className:`block-layer block-layer--shape ${b.className}`,style:b.style,"data-layer-id":e.id,children:[(w||E)&&(0,I.jsxs)(`defs`,{children:[w,E]}),r.shape===`rect`&&(0,I.jsx)(`rect`,{x:g,y:_,width:v,height:y,rx:r.borderRadius,ry:r.borderRadius,...O}),r.shape===`circle`&&(0,I.jsx)(`circle`,{cx:f+l/2,cy:m+u/2,r:Math.min(l,u)/2,...O}),r.shape===`line`&&(0,I.jsx)(`line`,{x1:f,y1:m,x2:f+l,y2:m+u,stroke:r.stroke||`#ffffff`,strokeWidth:r.strokeWidth||2,strokeDasharray:D})]})}function Ke(e,t){let{content:n,position:r}=e;if(!n.shapeKind)return n.d;let i=r.width?z(r.width,t.width):0,a=r.height?z(r.height,t.height):0,o=z(r.x,t.width),c=z(r.y,t.height),l=B(r.anchor,i,a);return s(n.shapeKind,o+l.x,c+l.y,i,a)??n.d}function qe(e){return e.arrow}function Je(e,t,n){return e||(t===`both`||t===n?`arrow`:`none`)}function Ye({layer:e,viewport:t,blockTime:n}){let{content:r,animation:a,id:o}=e,s=`${(0,F.useId)().replace(/:/g,``)}-${o}`,c=Ke(e,t),l=r.stroke??`#1e293b`,u=r.strokeWidth??2,{fill:d,def:f}=De(s,r.fill??`none`,r.gradient),m=r.borderStyle?we(r.borderStyle,u):r.dasharray,h=p(a,n),g=`marker-start-${s}`,_=`marker-end-${s}`,v=qe(r),y=i(Je(r.startMarker,v,`start`),`start`),b=i(Je(r.endMarker,v,`end`),`end`);return(0,I.jsxs)(`g`,{className:`block-layer block-layer--path ${h.className}`,style:h.style,"data-layer-id":o,children:[(0,I.jsxs)(`defs`,{children:[f,b&&(0,I.jsx)(Xe,{id:_,dir:`end`,d:b.d,filled:b.filled,stroke:l}),y&&(0,I.jsx)(Xe,{id:g,dir:`start`,d:y.d,filled:y.filled,stroke:l})]}),(0,I.jsx)(`path`,{d:c,stroke:l,strokeWidth:u,fill:d,fillOpacity:r.fillOpacity,strokeDasharray:m,markerStart:y?`url(#${g})`:void 0,markerEnd:b?`url(#${_})`:void 0})]})}function Xe({id:e,dir:t,d:n,filled:r,stroke:i}){return(0,I.jsx)(`marker`,{id:e,viewBox:`0 0 10 10`,refX:t===`end`?9:1,refY:5,markerWidth:4,markerHeight:4,orient:`auto-start-reverse`,markerUnits:`strokeWidth`,children:(0,I.jsx)(`path`,{d:n,fill:r?i:`none`,stroke:r?`none`:i,strokeWidth:r?void 0:1.5})})}var Ze={terrain:{url:`https://tile.opentopomap.org/{z}/{x}/{y}.png`,attribution:`Map: OpenTopoMap (CC-BY-SA)`,maxZoom:17},road:{url:`https://tile.openstreetmap.org/{z}/{x}/{y}.png`,attribution:`© OpenStreetMap contributors`,maxZoom:19},satellite:{url:`https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}`,attribution:`Imagery: Esri, Maxar, Earthstar`,maxZoom:18},toner:{url:`https://tiles.stadiamaps.com/tiles/stamen_toner/{z}/{x}/{y}.png`,attribution:`Map: Stadia Maps, Stamen Design`,maxZoom:20},watercolor:{url:`https://tiles.stadiamaps.com/tiles/stamen_watercolor/{z}/{x}/{y}.jpg`,attribution:`Map: Stadia Maps, Stamen Design`,maxZoom:16}};function Qe(e,t,n){let r=2**n,i=Math.floor((t+180)/360*r),a=e*Math.PI/180;return{x:i,y:Math.floor((1-Math.log(Math.tan(a)+1/Math.cos(a))/Math.PI)/2*r)}}function $e(e,t,n,r=256){let i=2**n,a=(t+180)/360*i,o=e*Math.PI/180,s=(1-Math.log(Math.tan(o)+1/Math.cos(o))/Math.PI)/2*i;return{x:(a-Math.floor(a))*r,y:(s-Math.floor(s))*r}}function et(e,t,n,r,i,a=256){let o=Qe(e,t,n),s=$e(e,t,n,a),c=Math.ceil(r/a)+1,l=Math.ceil(i/a)+1,u=o.x-Math.floor(c/2),d=o.y-Math.floor(l/2),f=r/2-s.x,p=i/2-s.y,m=[];for(let e=0;e<l;e++)for(let t=0;t<c;t++){let n=u+t,r=d+e,i=f+(n-o.x)*a,s=p+(r-o.y)*a;m.push({x:n,y:r,screenX:i,screenY:s})}return m}function tt(e,t,n,r){return e.url.replace(`{z}`,String(r)).replace(`{x}`,String(t)).replace(`{y}`,String(n))}async function nt(e){return new Promise((t,n)=>{let r=new Image;r.crossOrigin=`anonymous`,r.onload=()=>t(r),r.onerror=()=>n(Error(`Failed to load tile: ${e}`)),r.src=e})}async function rt(e){let{center:t,zoom:n,style:r,width:i,height:a,markers:o=[],showAttribution:s=!0}=e,c=Ze[r],l=c.tileSize||256,u=Math.min(n,c.maxZoom);if(!j(tt(c,0,0,u),e.policy))throw new M(`RESOURCE_BLOCKED`,`Map tiles for style "${r}" are blocked by the resource policy (${c.url}). Composing a map contacts the tile host; supply the map as \`staticSrc\` to render it without any remote request.`);let d=document.createElement(`canvas`);d.width=i,d.height=a;let f=d.getContext(`2d`);if(!f)throw Error(`Failed to get canvas context`);f.fillStyle=r===`toner`?`#ffffff`:`#e5e7eb`,f.fillRect(0,0,i,a);let p=et(t.lat,t.lng,u,i,a,l).map(async e=>{let t=tt(c,e.x,e.y,u);try{let n=await nt(t);f.drawImage(n,e.screenX,e.screenY,l,l)}catch(e){console.warn(`Tile load failed: ${t}`,e)}});await Promise.all(p);for(let e of o)it(f,e,t,u,i,a,l);return s&&ot(f,c.attribution,i,a),d.toDataURL(`image/png`)}function it(e,t,n,r,i,a,o){let s=Qe(n.lat,n.lng,r),c=Qe(t.lat,t.lng,r),l=$e(n.lat,n.lng,r,o),u=$e(t.lat,t.lng,r,o),d=(c.x-s.x)*o+(u.x-l.x),f=(c.y-s.y)*o+(u.y-l.y),p=i/2+d,m=a/2+f,h=t.color||`#ef4444`,g=t.icon||`pin`;e.save(),g===`pin`?(e.fillStyle=h,e.beginPath(),e.arc(p,m-12,8,Math.PI,0,!1),e.lineTo(p,m),e.closePath(),e.fill(),e.fillStyle=`#ffffff`,e.beginPath(),e.arc(p,m-12,3,0,Math.PI*2),e.fill()):g===`circle`?(e.fillStyle=h,e.beginPath(),e.arc(p,m,8,0,Math.PI*2),e.fill(),e.strokeStyle=`#ffffff`,e.lineWidth=2,e.stroke()):g===`star`&&(e.fillStyle=h,at(e,p,m,5,10,5),e.fill()),t.label&&(e.fillStyle=`#1f2937`,e.font=`bold 12px system-ui, sans-serif`,e.textAlign=`center`,e.fillText(t.label,p,m+20)),e.restore()}function at(e,t,n,r,i,a){let o=Math.PI/2*3,s=Math.PI/r;e.beginPath(),e.moveTo(t,n-i);for(let c=0;c<r;c++)e.lineTo(t+Math.cos(o)*i,n+Math.sin(o)*i),o+=s,e.lineTo(t+Math.cos(o)*a,n+Math.sin(o)*a),o+=s;e.lineTo(t,n-i),e.closePath()}function ot(e,t,n,r){e.save(),e.fillStyle=`rgba(255, 255, 255, 0.8)`,e.font=`10px system-ui, sans-serif`;let i=e.measureText(t).width;e.fillRect(n-i-8-4,r-16,i+8,14),e.fillStyle=`#374151`,e.textAlign=`right`,e.fillText(t,n-4-4,r-5),e.restore()}function st({layer:e,basePath:t,viewport:n,blockTime:r}){let{content:i,position:a,animation:o}=e,s=`map-clip-${(0,F.useId)().replace(/:/g,``)}-${e.id}`,[c,l]=(0,F.useState)(null),[u,d]=(0,F.useState)(!0),[f,m]=(0,F.useState)(null),[h,g]=(0,F.useState)(!1),_=z(a.x,n.width),v=z(a.y,n.height),y=a.width?z(a.width,n.width):n.width,b=a.height?z(a.height,n.height):n.height,x=B(a.anchor,y,b),S=_+x.x,C=v+x.y,w=R(i.staticSrc??``,t),T=me();(0,F.useEffect)(()=>{let e=!1;if(i.staticSrc){l(w||null),d(!1);return}return d(!0),m(null),g(!1),rt({center:i.center,zoom:i.zoom,style:i.style,width:y,height:b,markers:i.markers,showAttribution:i.showAttribution!==!1,policy:T}).then(t=>{e||(l(t),d(!1))}).catch(t=>{if(!e){let e=t instanceof M;e||console.error(`Failed to compose map:`,t),m(t instanceof Error?t.message:String(t)),g(e),d(!1)}}),()=>{e=!0}},[i.center,i.zoom,i.style,i.staticSrc,w,i.markers,i.showAttribution,y,b,t,T]);let E=p(o,r);return u?(0,I.jsxs)(`g`,{className:`block-layer block-layer--map ${E.className}`,style:E.style,"data-layer-id":e.id,children:[(0,I.jsx)(`rect`,{x:S,y:C,width:y,height:b,fill:`#e5e7eb`}),(0,I.jsx)(`text`,{x:S+y/2,y:C+b/2,textAnchor:`middle`,dominantBaseline:`middle`,fill:`#9ca3af`,fontSize:`24`,fontFamily:`system-ui, sans-serif`,children:`Loading map...`})]}):f||!c?(0,I.jsxs)(`g`,{className:`block-layer block-layer--map ${E.className}`,style:E.style,"data-layer-id":e.id,children:[(0,I.jsx)(`rect`,{x:S,y:C,width:y,height:b,fill:h?`#f3f4f6`:`#fef2f2`}),(0,I.jsx)(`text`,{x:S+y/2,y:C+b/2,textAnchor:`middle`,dominantBaseline:`middle`,fill:h?`#6b7280`:`#dc2626`,fontSize:`18`,fontFamily:`system-ui, sans-serif`,children:h?`Map unavailable offline`:`Map failed to load`})]}):(0,I.jsxs)(`g`,{className:`block-layer block-layer--map ${E.className}`,style:E.style,"data-layer-id":e.id,children:[(0,I.jsx)(`defs`,{children:(0,I.jsx)(`clipPath`,{id:s,children:(0,I.jsx)(`rect`,{x:S,y:C,width:y,height:b})})}),(0,I.jsx)(`g`,{clipPath:`url(#${s})`,children:(0,I.jsx)(`image`,{href:c,x:S,y:C,width:y,height:b,preserveAspectRatio:`xMidYMid slice`,style:{pointerEvents:`none`}})})]})}var ct=.2;function lt({layer:e,basePath:t,viewport:n,blockTime:r,isPlaying:i,muted:a=!1}){let{content:o,position:s}=e,c=(0,F.useRef)(null),l=(0,F.useRef)(!1),u=o.startAt??0,d=r<u,f=z(s.x,n.width),p=z(s.y,n.height),m=s.width?z(s.width,n.width):n.width,h=s.height?z(s.height,n.height):n.height,g=B(s.anchor,m,h),_=f+g.x,v=p+g.y,y=R(o.src,t),b=R(o.posterSrc||``,t),x=o.posterSrc?b:void 0;return(0,F.useEffect)(()=>{let e=c.current;if(!e)return;if(e.currentTime=o.clipStart,l.current=!0,i){let t=e.play();t&&t.catch(()=>{})}let t=()=>{e.currentTime>=o.clipEnd&&(e.pause(),e.currentTime=o.clipEnd)};return e.addEventListener(`timeupdate`,t),()=>{e.removeEventListener(`timeupdate`,t),e.pause()}},[y,o.clipStart,o.clipEnd]),(0,F.useEffect)(()=>{let e=c.current;if(!e||!l.current)return;let t=d?o.clipStart:Math.min(o.clipEnd,o.clipStart+Math.max(0,r-u));if(e.dataset.captureSequential!==`true`&&Math.abs(e.currentTime-t)>ct&&(e.currentTime=t),d){e.pause();return}if(t>=o.clipEnd){e.pause();return}if(i){let t=e.play();t&&t.catch(()=>{})}else e.dataset.captureSequential!==`true`&&e.pause()},[i,d,r,u,y,o.clipStart,o.clipEnd]),(0,I.jsx)(`g`,{className:`block-layer block-layer--video`,"data-layer-id":e.id,children:(0,I.jsx)(`foreignObject`,{x:_,y:v,width:m,height:h,children:(0,I.jsx)(`video`,{ref:c,src:y,poster:x,muted:a,playsInline:!0,preload:`auto`,"data-clip-start":o.clipStart,"data-clip-end":o.clipEnd,"data-start-at":u,style:{width:`${m}px`,height:`${h}px`,objectFit:o.fit||`cover`,objectPosition:`center`,display:`block`,pointerEvents:`none`}})})})}function ut({layer:e,viewport:t,blockTime:n}){let{content:r,position:i,animation:a}=e,{headers:o,rows:s,align:c,style:l}=r,u=z(i.x,t.width),d=z(i.y,t.height),f=i.width?z(i.width,t.width):t.width,m=i.height?z(i.height,t.height):t.height,h=B(i.anchor,f,m),g=u+h.x,_=d+h.y,v=p(a,n),y=e=>{let t=c?.[e];return t?{textAlign:t}:void 0},b=l.borderRadius??8;return(0,I.jsx)(`g`,{className:`block-layer block-layer--table ${v.className}`,style:v.style,"data-layer-id":e.id,children:(0,I.jsx)(`foreignObject`,{x:g,y:_,width:f,height:m,children:(0,I.jsx)(`div`,{xmlns:`http://www.w3.org/1999/xhtml`,style:{width:`${f}px`,height:`${m}px`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`16px`,boxSizing:`border-box`},children:(0,I.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`separate`,borderSpacing:0,fontSize:`${l.fontSize}px`,fontFamily:l.fontFamily??`system-ui, sans-serif`,overflow:`hidden`,borderRadius:`${b}px`,border:`1px solid ${l.borderColor}`},children:[o.length>0&&(0,I.jsx)(`thead`,{children:(0,I.jsx)(`tr`,{children:o.map((e,t)=>(0,I.jsx)(`th`,{style:{background:l.headerBackground,color:l.headerColor,fontFamily:l.headerFontFamily??l.fontFamily??`system-ui, sans-serif`,fontWeight:600,padding:`12px 16px`,borderBottom:`2px solid ${l.borderColor}`,borderRight:t<o.length-1?`1px solid ${l.borderColor}`:void 0,...y(t)},children:e},t))})}),s.length>0&&(0,I.jsx)(`tbody`,{children:s.map((e,t)=>(0,I.jsx)(`tr`,{children:e.map((n,r)=>(0,I.jsx)(`td`,{style:{background:l.cellBackground,color:l.cellColor,padding:`10px 16px`,borderBottom:t<s.length-1?`1px solid ${l.borderColor}`:void 0,borderRight:r<e.length-1?`1px solid ${l.borderColor}`:void 0,...y(r)},children:n},r))},t))})]})})})})}function dt(e,t){let n=e&&e.trim()?e.trim():t,r=n.indexOf(`:`);return r>0?`fa-${n.slice(0,r).replace(/^fa-/,``)} fa-${n.slice(r+1)}`:`fa-solid fa-${n}`}function ft({layer:e,viewport:t,blockTime:n}){let{content:r,position:i,animation:a}=e,{items:o,style:s}=r,c=z(i.x,t.width),l=z(i.y,t.height),u=i.width?z(i.width,t.width):t.width,d=i.height?z(i.height,t.height):t.height,f=B(i.anchor,u,d),m=p(a,n);return(0,I.jsx)(`g`,{className:`block-layer block-layer--tree ${m.className}`,style:m.style,"data-layer-id":e.id,children:(0,I.jsx)(`foreignObject`,{x:c+f.x,y:l+f.y,width:u,height:d,children:(0,I.jsx)(`div`,{xmlns:`http://www.w3.org/1999/xhtml`,className:`squisq-treelayer`,style:{width:`${u}px`,height:`${d}px`,display:`flex`,flexDirection:`column`,justifyContent:`center`,padding:`24px 32px`,boxSizing:`border-box`,fontFamily:s.fontFamily??`system-ui, sans-serif`,fontSize:`${s.fontSize}px`,lineHeight:1.7,overflow:`hidden`},children:(0,I.jsx)(pt,{items:o,depth:0,style:s})})})})}function pt({items:e,depth:t,style:n}){return(0,I.jsx)(`ul`,{style:{listStyle:`none`,margin:0,padding:0,paddingLeft:t===0?0:`${n.indentPx}px`,borderLeft:t===0?`none`:`1px solid ${n.connectorColor}`},children:e.map(e=>(0,I.jsx)(mt,{item:e,style:n},e.id))})}function mt({item:e,style:t}){let n=e.children.length>0,[r,i]=(0,F.useState)(!1),a=e.isDir||n,o=a?dt(t.folderIcon,r?`folder`:`folder-open`):dt(t.fileIcon,`file`);return(0,I.jsxs)(`li`,{style:{position:`relative`},children:[(0,I.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:`8px`,padding:`1px 0`},children:[n?(0,I.jsx)(`button`,{type:`button`,"aria-label":r?`Expand`:`Collapse`,onClick:()=>i(e=>!e),style:{flex:`0 0 auto`,width:`1em`,border:`none`,background:`transparent`,cursor:`pointer`,color:t.connectorColor,padding:0,fontSize:`0.8em`},children:(0,I.jsx)(`i`,{className:`fa-solid ${r?`fa-chevron-right`:`fa-chevron-down`}`,"aria-hidden":`true`})}):(0,I.jsx)(`span`,{style:{flex:`0 0 auto`,width:`1em`}}),(0,I.jsx)(`i`,{className:o,"aria-hidden":`true`,style:{flex:`0 0 auto`,color:t.iconColor,width:`1.2em`,textAlign:`center`}}),(0,I.jsx)(`span`,{style:{color:a?t.dirColor:t.rowColor,fontWeight:a?600:400},children:e.label}),e.comment?(0,I.jsx)(`span`,{style:{color:t.commentColor,fontSize:`0.85em`,fontStyle:`italic`},children:e.comment}):null]}),n&&!r?(0,I.jsx)(pt,{items:e.children,depth:1,style:t}):null]})}function ht({layer:e,viewport:t,blockTime:n,theme:r}){let{position:i,content:a,animation:o}=e,s=z(i.width??t.width,t.width),c=z(i.height??t.height,t.height),l=z(i.x,t.width),u=z(i.y,t.height),d=i.anchor??`top-left`;d===`center`?(l-=s/2,u-=c/2):(d.endsWith(`right`)&&(l-=s),d.startsWith(`bottom`)&&(u-=c));let f=p(o,n),m={boxSizing:`border-box`,width:`100%`,height:`100%`,padding:a.padding??16,borderRadius:16,background:a.background,color:a.foreground,overflow:`hidden`};return(0,I.jsx)(`g`,{className:`block-layer block-layer--mermaid ${f.className}`,"data-layer-id":e.id,style:f.style,children:(0,I.jsx)(`foreignObject`,{x:l,y:u,width:s,height:c,children:(0,I.jsx)(`div`,{xmlns:`http://www.w3.org/1999/xhtml`,className:`squisq-mermaid-layer-frame`,style:m,children:(0,I.jsx)(de,{source:a.source,ariaLabel:`Mermaid diagram on slide`,theme:r})})})})}var gt=(0,F.createContext)(null);function _t(){return(0,F.useContext)(gt)}function vt({src:e,basePath:t=``,width:n,height:r,poster:i,controls:a=!0,preload:o=`metadata`,className:s}){let c=R(e,t),l=R(i??``,t),u=i?l:void 0;return c?(0,I.jsx)(`span`,{className:`squisq-inline-video-player ${s??``}`.trim(),children:(0,I.jsx)(`video`,{src:c,poster:u,controls:a,preload:o,width:n,height:r,playsInline:!0})}):null}function yt({src:e,basePath:t=``,controls:n=!0,preload:r=`metadata`,className:i}){let a=R(e,t);return a?(0,I.jsx)(`span`,{className:`squisq-inline-audio-player ${i??``}`.trim(),children:(0,I.jsx)(`audio`,{src:a,controls:n,preload:r})}):null}var H={htmlPolicy:`sanitize`},bt={idle:`Copy`,copying:`Copying…`,copied:`Copied`,failed:`Copy failed`};async function xt(e,t,n){if(n){await n(e,t===void 0?{}:{language:t});return}if(typeof navigator>`u`||!navigator.clipboard?.writeText)throw Error(`Clipboard access is unavailable in this host`);await navigator.clipboard.writeText(e)}function St({value:e,language:t,ctx:n}){let[r,i]=(0,F.useState)(`idle`),a=(0,F.useRef)();(0,F.useEffect)(()=>()=>{a.current!==void 0&&clearTimeout(a.current)},[]);let o=(0,I.jsx)(`pre`,{className:`squisq-md-code-block`,children:(0,I.jsx)(`code`,{className:t?`language-${t}`:void 0,children:e})});if(!n.showCodeCopyButton)return o;let s=async()=>{if(r!==`copying`){i(`copying`);try{await xt(e,t??void 0,n.onCopyCode),i(`copied`)}catch{i(`failed`)}a.current!==void 0&&clearTimeout(a.current),a.current=setTimeout(()=>i(`idle`),1600)}};return(0,I.jsxs)(`div`,{className:`squisq-md-code-frame`,children:[o,(0,I.jsx)(`button`,{type:`button`,className:`squisq-md-code-copy`,"data-copy-state":r,disabled:r===`copying`,onClick:()=>void s(),"aria-label":`Copy code to clipboard`,children:bt[r]})]})}var Ct=class extends F.Component{constructor(){super(...arguments),this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?this.props.fallback:this.props.children}};function wt({node:e,lang:t,ctx:n}){let r=n.fenceRenderers?.[t];return r?(0,I.jsx)(`div`,{className:`squisq-md-fence-widget squisq-md-fence-widget-${t}`,"data-fence-lang":t,children:r({lang:t,...e.meta==null?{}:{meta:e.meta},value:e.value,...n.theme?{theme:n.theme}:{},mode:`read`})}):null}function U(e,t=``,n=H){return e.map((e,r)=>{let i=`${t}i${r}`;switch(e.type){case`text`:return e.value.includes(`
|
|
7
|
-
`)?(0,I.jsx)(F.Fragment,{children:e.value.split(`
|
|
8
|
-
`).map((e,t)=>(0,I.jsxs)(F.Fragment,{children:[t>0&&(0,I.jsx)(`br`,{}),e]},t))},i):(0,I.jsx)(F.Fragment,{children:e.value},i);case`emphasis`:return(0,I.jsx)(`em`,{className:`squisq-md-em`,children:U(e.children,i,n)},i);case`strong`:return(0,I.jsx)(`strong`,{className:`squisq-md-strong`,children:U(e.children,i,n)},i);case`delete`:return(0,I.jsx)(`del`,{className:`squisq-md-del`,children:U(e.children,i,n)},i);case`superscript`:return(0,I.jsx)(`sup`,{className:`squisq-md-sup`,children:U(e.children,i,n)},i);case`subscript`:return(0,I.jsx)(`sub`,{className:`squisq-md-sub`,children:U(e.children,i,n)},i);case`inlineCode`:return(0,I.jsx)(`code`,{className:`squisq-md-inline-code`,children:e.value},i);case`link`:{if(n.accessoryPaths?.has(e.url))return(0,I.jsxs)(`span`,{className:`squisq-md-attachment`,"data-attachment-path":e.url,title:e.title??`Attachment: ${e.url}`,children:[(0,I.jsx)(`i`,{className:`fa-solid fa-paperclip`,"aria-hidden":`true`}),(0,I.jsx)(`span`,{className:`squisq-md-attachment-label`,children:U(e.children,i,n)})]},i);let t=D(e.url,`link`,{extraLinkSchemes:n.linkSchemes});return t?(0,I.jsx)(`a`,{className:`squisq-md-link`,href:t,title:e.title??void 0,target:`_blank`,rel:`noopener noreferrer`,children:U(e.children,i,n)},i):(0,I.jsx)(`span`,{className:`squisq-md-link squisq-md-link--blocked`,children:U(e.children,i,n)},i)}case`image`:return(0,I.jsx)(Ot,{src:e.url,alt:e.alt??``,title:e.title??void 0},i);case`break`:return(0,I.jsx)(`br`,{},i);case`inlineMath`:return(0,I.jsx)(`code`,{className:`squisq-md-inline-math`,children:e.value},i);case`inlineIcon`:return(0,I.jsx)(`i`,{className:`fa-${e.family} fa-${e.name}`,"data-icon":e.token,"aria-hidden":`true`},i);case`htmlInline`:return n.htmlPolicy===`strip`?null:(0,I.jsx)(`span`,{className:`squisq-md-html-inline`,children:Ft(kt(e.htmlChildren,n.htmlPolicy),`${i}h`,n)},i);case`footnoteReference`:return(0,I.jsx)(`sup`,{className:`squisq-md-footnote-ref`,children:(0,I.jsxs)(`a`,{href:`#fn-${e.identifier}`,children:[`[`,e.label??e.identifier,`]`]})},i);case`linkReference`:return(0,I.jsx)(`span`,{className:`squisq-md-link-ref`,children:U(e.children,i,n)},i);case`imageReference`:return(0,I.jsxs)(`span`,{className:`squisq-md-image-ref`,children:[`[`,e.alt??e.identifier,`]`]},i);case`textDirective`:return(0,I.jsx)(`span`,{className:`squisq-md-text-directive`,"data-directive":e.name,children:U(e.children,i,n)},i);case`mention`:return(0,I.jsxs)(`span`,{className:`squisq-md-mention mention`,"data-mention":`true`,"data-kind":e.targetKind,"data-id":e.targetId,"data-label":e.displayName,children:[`@`,e.displayName]},i);default:return null}})}function Tt(e,t,n=H){switch(e.type){case`paragraph`:return(0,I.jsx)(`p`,{className:`squisq-md-p`,children:U(e.children,t,n)},t);case`heading`:return(0,I.jsx)(`h${e.depth}`,{className:`squisq-md-heading squisq-md-h${e.depth}`,children:U(e.children,t,n)},t);case`blockquote`:return(0,I.jsx)(`blockquote`,{className:`squisq-md-blockquote`,children:W(e.children,t,n)},t);case`list`:return e.ordered?(0,I.jsx)(`ol`,{className:`squisq-md-list squisq-md-ol`,start:e.start??void 0,children:e.children.map((e,r)=>Et(e,`${t}li${r}`,n))},t):(0,I.jsx)(`ul`,{className:`squisq-md-list squisq-md-ul`,children:e.children.map((e,r)=>Et(e,`${t}li${r}`,n))},t);case`code`:{let r=e.lang?.trim().toLowerCase();return r&&n.fenceRenderers?.[r]?(0,I.jsx)(Ct,{fallback:(0,I.jsx)(St,{value:e.value,language:e.lang,ctx:n}),children:(0,I.jsx)(wt,{node:e,lang:r,ctx:n})},t):r===`mermaid`?(0,I.jsx)(de,{source:e.value,className:`squisq-md-mermaid`,ariaLabel:`Mermaid diagram`,theme:n.theme},t):(0,I.jsx)(St,{value:e.value,language:e.lang,ctx:n},t)}case`thematicBreak`:return(0,I.jsx)(`hr`,{className:`squisq-md-hr`},t);case`table`:return Dt(e.children,e.align,t,n);case`htmlBlock`:return n.htmlPolicy===`strip`?null:(0,I.jsx)(`div`,{className:`squisq-md-html-block`,children:Ft(kt(e.htmlChildren,n.htmlPolicy),`${t}h`,n)},t);case`math`:return(0,I.jsx)(`pre`,{className:`squisq-md-math-block`,children:(0,I.jsx)(`code`,{children:e.value})},t);case`definition`:return null;case`footnoteDefinition`:return(0,I.jsxs)(`div`,{className:`squisq-md-footnote-def`,id:`fn-${e.identifier}`,children:[(0,I.jsx)(`sup`,{children:e.label??e.identifier}),W(e.children,t,n)]},t);case`containerDirective`:return(0,I.jsxs)(`div`,{className:`squisq-md-directive squisq-md-directive-${e.name}`,"data-directive":e.name,children:[e.label&&(0,I.jsx)(`div`,{className:`squisq-md-directive-label`,children:e.label}),W(e.children,t,n)]},t);case`leafDirective`:return(0,I.jsx)(`div`,{className:`squisq-md-directive squisq-md-directive-${e.name}`,"data-directive":e.name,children:U(e.children,t,n)},t);case`definitionList`:return(0,I.jsx)(`dl`,{className:`squisq-md-dl`,children:e.children.map((e,r)=>e.type===`definitionTerm`?(0,I.jsx)(`dt`,{className:`squisq-md-dt`,children:U(e.children,`${t}dt${r}`,n)},`${t}dt${r}`):(0,I.jsx)(`dd`,{className:`squisq-md-dd`,children:W(e.children,`${t}dd${r}`,n)},`${t}dd${r}`))},t);default:return null}}function Et(e,t,n=H){let r=e.checked!==null&&e.checked!==void 0;return(0,I.jsxs)(`li`,{className:`squisq-md-li${r?` squisq-md-task`:``}`,children:[r&&(0,I.jsx)(`input`,{type:`checkbox`,checked:!!e.checked,readOnly:!0,className:`squisq-md-checkbox`}),W(e.children,t,n)]},t)}function Dt(e,t,n,r=H){let[i,...a]=e;return(0,I.jsxs)(`table`,{className:`squisq-md-table`,children:[i&&(0,I.jsx)(`thead`,{children:(0,I.jsx)(`tr`,{children:i.children.map((e,i)=>(0,I.jsx)(`th`,{className:`squisq-md-th`,style:t?.[i]?{textAlign:t[i]}:void 0,children:U(e.children,`${n}th${i}`,r)},`${n}th${i}`))})}),a.length>0&&(0,I.jsx)(`tbody`,{children:a.map((e,i)=>(0,I.jsx)(`tr`,{children:e.children.map((e,a)=>(0,I.jsx)(`td`,{className:`squisq-md-td`,style:t?.[a]?{textAlign:t[a]}:void 0,children:U(e.children,`${n}td${i}-${a}`,r)},`${n}td${i}-${a}`))},`${n}tr${i}`))})]},n)}function W(e,t=``,n=H){return e.map((e,r)=>Tt(e,`${t}b${r}`,n))}function Ot({src:e,alt:t,title:n}){let r=D(e,`media`),i=R(r??``,`.`);return r?(0,I.jsx)(`img`,{className:`squisq-md-image`,src:i,alt:t,title:n}):null}function kt(e,t){return t===`strip`?[]:t===`trusted`?e:O(e)}var At=new Set([`base`,`embed`,`iframe`,`link`,`meta`,`object`,`script`,`style`,`title`]),jt={class:`className`,id:`id`,title:`title`,style:`style`,width:`width`,height:`height`,src:`src`,alt:`alt`,loading:`loading`,decoding:`decoding`,href:`href`,target:`target`,rel:`rel`},Mt=new Set([``,`_self`,`_parent`,`_top`]);function Nt(e,t){let n={};for(let[r,i]of Object.entries(e)){let e=jt[r];if(e){if(e===`style`){n[`data-style`]=i;continue}if(e===`href`){let e=D(i,`link`,{extraLinkSchemes:t.linkSchemes});e&&(n.href=e);continue}if(e===`src`){let e=D(i,`media`);e&&(n.src=e);continue}n[e]=i}}if(typeof n.target==`string`&&!Mt.has(n.target.toLowerCase())){let e=(typeof n.rel==`string`?n.rel:``).split(/\s+/).filter(e=>e&&e.toLowerCase()!==`opener`);e.some(e=>e.toLowerCase()===`noopener`)||e.push(`noopener`),n.rel=e.join(` `)}return n}function Pt(e,t,n){let r=e.tagName.toLowerCase();if(At.has(r))return null;if(r===`video`){let n=D(e.attributes.src??``,`media`)??``,r=D(e.attributes.poster??``,`media`)??void 0;return(0,I.jsx)(vt,{src:n,width:e.attributes.width,height:e.attributes.height,poster:r,controls:`controls`in e.attributes,preload:e.attributes.preload===`none`||e.attributes.preload===`metadata`||e.attributes.preload===`auto`?e.attributes.preload:void 0},t)}if(r===`audio`)return(0,I.jsx)(yt,{src:D(e.attributes.src??``,`media`)??``,controls:`controls`in e.attributes,preload:e.attributes.preload===`none`||e.attributes.preload===`metadata`||e.attributes.preload===`auto`?e.attributes.preload:void 0},t);let i=r,a=Nt(e.attributes,n);return e.selfClosing?(0,I.jsx)(i,{...a},t):(0,I.jsx)(i,{...a,children:Ft(e.children,`${t}c`,n)},t)}function Ft(e,t,n=H){return e.map((e,r)=>{let i=`${t}${r}`;switch(e.type){case`htmlElement`:return Pt(e,i,n);case`htmlText`:return(0,I.jsx)(F.Fragment,{children:e.value},i);case`htmlComment`:return null;default:return null}})}var It=new Set,Lt=e=>e.size===0?e:It;function G({nodes:e,className:t,htmlPolicy:n=`sanitize`,linkSchemes:r,theme:i,showCodeCopyButton:a=!1,onCopyCode:o,fenceRenderers:s}){let c=_t(),l=he(),[u,d]=(0,F.useState)(It);return(0,F.useEffect)(()=>{if(!l){d(Lt);return}let e=!1;return l.listMedia().then(t=>{e||d(new Set(t.map(e=>e.name)))},()=>{e||d(Lt)}),()=>{e=!0}},[l]),!e||e.length===0?null:(0,I.jsx)(`div`,{className:`squisq-md ${t||``}`,children:W(e,``,{htmlPolicy:n,linkSchemes:r,theme:i,showCodeCopyButton:a,onCopyCode:o,accessoryPaths:u,fenceRenderers:s??c??void 0})})}function Rt(e){return e?Object.keys(e).map(e=>e.trim().toLowerCase()):[]}var zt={width:1920,height:1080};function Bt({block:e,blockTime:t,basePath:n,isEntering:r=!1,isExiting:i=!1,transition:a,viewport:o=zt,isPlaying:s,muted:c=!1,animationsEnabled:l=!0,theme:u}){let f=``,p={},m=l?a??e.transition:void 0;m&&r?(f=d(m.type,!0,m.direction),p[`--transition-duration`]=`${C(m)}s`):m&&i&&(f=d(m.type,!1,m.direction),p[`--transition-duration`]=`${C(m)}s`);let h=`vb-clip-${(0,F.useId)().replace(/:/g,``)}-${e.id}`;return(0,I.jsxs)(`svg`,{className:`block-svg ${f}`,style:p,viewBox:`0 0 ${o.width} ${o.height}`,preserveAspectRatio:`xMidYMid meet`,overflow:`hidden`,"data-block-id":e.id,children:[(0,I.jsx)(`defs`,{children:(0,I.jsx)(`clipPath`,{id:h,children:(0,I.jsx)(`rect`,{x:`0`,y:`0`,width:o.width,height:o.height})})}),(0,I.jsx)(`g`,{clipPath:`url(#${h})`,children:(e.layers??[]).map(e=>(0,I.jsx)(Vt,{layer:e,basePath:n,viewport:o,blockTime:t,isPlaying:s,muted:c,animationsEnabled:l,theme:u},e.id))})]})}function Vt({layer:e,basePath:t,viewport:n,blockTime:r,isPlaying:i,muted:a,animationsEnabled:o,theme:s}){let c=o||!e.animation?e:{...e,animation:void 0};switch(c.type){case`image`:return(0,I.jsx)(ge,{layer:c,basePath:t,viewport:n,blockTime:r,animationsEnabled:o});case`text`:return(0,I.jsx)(Ae,{layer:c,viewport:n,blockTime:r});case`shape`:return(0,I.jsx)(Ge,{layer:c,viewport:n,blockTime:r});case`path`:return(0,I.jsx)(Ye,{layer:c,viewport:n,blockTime:r});case`map`:return(0,I.jsx)(st,{layer:c,basePath:t,viewport:n,blockTime:r});case`video`:return(0,I.jsx)(lt,{layer:c,basePath:t,viewport:n,blockTime:r,isPlaying:i,muted:a});case`table`:return(0,I.jsx)(ut,{layer:c,viewport:n,blockTime:r});case`tree`:return(0,I.jsx)(ft,{layer:c,viewport:n,blockTime:r});case`mermaid`:return(0,I.jsx)(ht,{layer:c,viewport:n,blockTime:r,theme:s});default:return console.warn(`Unknown layer type: ${c.type}`),null}}var Ht=(0,F.createContext)({theme:E,pageStyle:a(E),basePath:`/`,viewport:S.landscape,renderContext:{theme:E},animationsEnabled:!0,imageDisplayMode:`inline`,showCodeCopyButton:!1});function K(){return(0,F.useContext)(Ht)}function Ut({section:e}){let{renderContext:t,basePath:n,animationsEnabled:r,theme:i}=K(),a=e.slots.media,o=a?.type===`canvas`?a:void 0,s=(0,F.useMemo)(()=>{if(!o)return null;let{layers:n}=y(o.block,{...t,blockIndex:e.index});return{...o.block,layers:n}},[o,t,e.index]);if(!o||!s)return null;let c=o.aspect;return(0,I.jsx)(`div`,{className:`squisq-page-canvas${e.hints?.frame===`terminal`?` squisq-page-canvas--terminal squisq-page-canvas--framed`:` squisq-page-canvas--framed`}`,style:{aspectRatio:`${c.width} / ${c.height}`,maxHeight:`min(70vh, 720px)`,maxWidth:`calc(min(70vh, 720px) * ${(c.width/Math.max(1,c.height)).toFixed(4)})`},children:(0,I.jsx)(Bt,{block:s,blockTime:0,basePath:n,viewport:{width:c.width,height:c.height},animationsEnabled:r,theme:i})})}function q({media:e,eager:t,className:n}){let{basePath:r}=K(),i=D(e.src,`media`),a=R(i??``,r);return i?(0,I.jsx)(`img`,{className:n,src:a,alt:e.alt,loading:t?`eager`:`lazy`,decoding:`async`,width:e.width,height:e.height}):null}function Wt({media:e}){let{basePath:t}=K(),n=D(e.src,`media`),r=R(n??``,t),i=e.posterSrc?D(e.posterSrc,`media`):void 0,a=R(i??``,t);return n?(0,I.jsx)(`video`,{src:r,poster:i?a:void 0,muted:!0,loop:!0,autoPlay:!0,playsInline:!0,preload:`metadata`}):null}function J({section:e}){return e.slots.eyebrow?(0,I.jsx)(`span`,{className:`squisq-page-eyebrow`,children:e.slots.eyebrow}):null}function Gt({media:e}){return!e||e.type===`canvas`||!e.credit?null:(0,I.jsxs)(`span`,{className:`squisq-page-media-credit`,children:[e.credit,e.license?` \xB7 ${e.license}`:``]})}function Kt({section:e}){let{pageStyle:t}=K(),n=e.slots.media,r=n?.type===`image`?n:void 0,i=t.tokens.heroStyle,a=(0,I.jsxs)(`div`,{className:`squisq-page-hero-body`,children:[(0,I.jsx)(J,{section:e}),(0,I.jsx)(`h1`,{className:`squisq-page-hero-title`,children:e.slots.title}),e.slots.subtitle&&(0,I.jsx)(`p`,{className:`squisq-page-hero-subtitle`,children:e.slots.subtitle})]});return r&&i===`split`?(0,I.jsxs)(`div`,{className:`squisq-page-hero-grid`,children:[a,(0,I.jsxs)(`div`,{className:`squisq-page-hero-media squisq-page-media-frame`,children:[(0,I.jsx)(q,{media:r,eager:!0}),(0,I.jsx)(Gt,{media:r})]})]}):(0,I.jsxs)(I.Fragment,{children:[r&&e.background===`media`&&(0,I.jsx)(`div`,{className:`squisq-page-hero-backdrop`,children:(0,I.jsx)(q,{media:r,eager:!0})}),a]})}function qt({section:e}){let t=e.slots.media,n=t?.type===`image`?t:void 0;return(0,I.jsxs)(I.Fragment,{children:[n&&e.background===`media`&&(0,I.jsx)(`div`,{className:`squisq-page-hero-backdrop`,children:(0,I.jsx)(q,{media:n})}),(0,I.jsxs)(`div`,{className:`squisq-page-banner-body`,children:[(0,I.jsx)(J,{section:e}),(0,I.jsx)(`h2`,{className:`squisq-page-section-title squisq-page-banner-title`,children:e.slots.title})]})]})}function Jt({section:e}){let t=e.slots.items??[],n=e.variant===`comparison`,r=t.map(e=>typeof e.value==`number`?e.value:Number.parseFloat(String(e.value??``))),i=Math.max(1,...r.filter(e=>Number.isFinite(e)));return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`squisq-page-stats`,children:t.map((e,t)=>(0,I.jsxs)(`div`,{className:`squisq-page-stat${n?` squisq-page-stat--bars`:``}`,children:[(0,I.jsx)(`span`,{className:`squisq-page-stat-value`,children:e.value}),n&&Number.isFinite(r[t])&&(0,I.jsx)(`div`,{className:`squisq-page-stat-bar`,style:{width:`${Math.max(4,r[t]/i*100)}%`}}),e.title&&(0,I.jsx)(`span`,{className:`squisq-page-stat-title`,children:e.title}),e.body&&(0,I.jsx)(`span`,{className:`squisq-page-stat-body`,children:e.body})]},t))}),e.slots.meta&&(0,I.jsx)(`div`,{className:`squisq-page-stat-meta`,children:e.slots.meta})]})}function Yt({section:e}){let t=e.slots.media;return(0,I.jsxs)(I.Fragment,{children:[e.background===`media`&&t&&t.type!==`canvas`&&(0,I.jsx)(`div`,{className:`squisq-page-quote-backdrop`,children:t.type===`image`?(0,I.jsx)(q,{media:t}):(0,I.jsx)(Wt,{media:t})}),e.slots.title&&(0,I.jsx)(`h2`,{className:`squisq-page-section-title`,children:e.slots.title}),(0,I.jsxs)(`figure`,{className:`squisq-page-quote-figure`,style:{margin:0},children:[(0,I.jsx)(`blockquote`,{className:`squisq-page-quote`,children:e.slots.body?.text}),e.slots.attribution&&(0,I.jsx)(`figcaption`,{className:`squisq-page-quote-attribution`,children:e.slots.attribution})]})]})}function Xt({section:e,flip:t}){let n=e.slots.media,r=n?.type===`image`?n:void 0;return(0,I.jsxs)(`div`,{className:`squisq-page-feature${(t?e.variant!==`media-right`:e.variant===`media-right`)?` squisq-page-feature--media-right`:``}`,children:[(0,I.jsxs)(`div`,{className:`squisq-page-feature-media squisq-page-media-frame`,children:[r&&(0,I.jsx)(q,{media:r}),(0,I.jsx)(Gt,{media:r})]}),(0,I.jsxs)(`div`,{className:`squisq-page-feature-text`,children:[(0,I.jsx)(J,{section:e}),e.slots.title&&(0,I.jsx)(`h3`,{className:`squisq-page-section-title squisq-page-feature-title`,children:e.slots.title}),e.slots.body?.text&&(0,I.jsx)(`p`,{className:`squisq-page-feature-body`,children:e.slots.body.text})]})]})}function Zt({section:e}){let{basePath:t}=K(),n=e.slots.media;return!n||n.type===`canvas`?null:(0,I.jsxs)(`figure`,{className:`squisq-page-figure`,children:[(0,I.jsx)(`div`,{className:`squisq-page-media-frame`,children:n.type===`image`?(0,I.jsx)(q,{media:n}):(0,I.jsx)(vt,{src:n.src,poster:n.posterSrc,basePath:t})}),(e.slots.caption||n.credit)&&(0,I.jsxs)(`figcaption`,{children:[e.slots.caption,n.credit&&(0,I.jsxs)(I.Fragment,{children:[e.slots.caption?` `:``,(0,I.jsx)(Gt,{media:n})]})]})]})}function Qt({section:e}){let t=e.slots.items??[];return t.length===0?(0,I.jsxs)(`div`,{className:`squisq-page-gallery-empty`,children:[e.slots.title&&(0,I.jsx)(`h2`,{className:`squisq-page-section-title`,children:e.slots.title}),e.slots.body?.text&&(0,I.jsx)(`p`,{children:e.slots.body.text}),e.slots.caption&&(0,I.jsx)(`div`,{className:`squisq-page-gallery-caption`,children:e.slots.caption})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`squisq-page-gallery`,children:t.map((e,t)=>e.media?.type===`image`?(0,I.jsx)(`div`,{className:`squisq-page-media-frame`,children:(0,I.jsx)(q,{media:e.media})},t):null)}),e.slots.caption&&(0,I.jsx)(`div`,{className:`squisq-page-gallery-caption`,children:e.slots.caption})]})}function $t({section:e}){let t=e.slots.media,n=t?.type===`image`?t:void 0,r=e.hints?.framing;return(0,I.jsxs)(`div`,{className:`squisq-page-callout`,"data-hint-framing":typeof r==`string`?r:void 0,children:[n&&(0,I.jsx)(`div`,{className:`squisq-page-media-frame`,children:(0,I.jsx)(q,{media:n})}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(J,{section:e}),e.slots.title&&(0,I.jsx)(`h3`,{className:`squisq-page-callout-title`,children:e.slots.title}),e.slots.body?.text&&(0,I.jsx)(`p`,{className:`squisq-page-callout-body`,children:e.slots.body.text}),e.slots.meta&&(0,I.jsx)(`div`,{className:`squisq-page-callout-meta`,children:e.slots.meta})]})]})}function en({section:e}){let{theme:t}=K(),n=e.slots.items??[];return(0,I.jsxs)(I.Fragment,{children:[e.slots.title&&(0,I.jsx)(`h2`,{className:`squisq-page-section-title squisq-page-cards-title`,children:e.slots.title}),(0,I.jsx)(`div`,{className:`squisq-page-cards`,children:n.map((e,n)=>{let r=e.accentScheme?t.colorSchemes?.[e.accentScheme]:void 0;return(0,I.jsxs)(`div`,{className:`squisq-page-card`,style:r?{"--squisq-page-card-accent":r.accent}:void 0,children:[e.title&&(0,I.jsx)(`h3`,{className:`squisq-page-card-title`,children:e.title}),e.body&&(0,I.jsx)(`p`,{className:`squisq-page-card-body`,children:e.body})]},n)})})]})}function tn({section:e}){let{theme:t,showCodeCopyButton:n,onCopyCode:r,fenceRenderers:i,htmlPolicy:a,linkSchemes:o}=K(),s=e.slots.items??[];return(0,I.jsxs)(I.Fragment,{children:[e.slots.title&&(0,I.jsx)(`h2`,{className:`squisq-page-section-title squisq-page-items-title`,children:e.slots.title}),(0,I.jsx)(`ol`,{className:`squisq-page-items`,children:s.map((e,s)=>(0,I.jsx)(`li`,{children:(0,I.jsx)(`div`,{className:`squisq-page-item-body`,children:e.markdown?(0,I.jsx)(G,{nodes:e.markdown,theme:t,showCodeCopyButton:n,onCopyCode:r,fenceRenderers:i,htmlPolicy:a,linkSchemes:o}):e.body})},s))})]})}function nn({section:e}){let t=e.slots.milestone;return t?(0,I.jsxs)(`div`,{className:`squisq-page-milestone`,"data-mood":t.mood,children:[(0,I.jsx)(`div`,{className:`squisq-page-milestone-date`,children:t.date}),(0,I.jsx)(`div`,{className:`squisq-page-milestone-rail`,"aria-hidden":`true`}),(0,I.jsxs)(`div`,{className:`squisq-page-milestone-body`,children:[t.description,t.footer&&(0,I.jsx)(`div`,{className:`squisq-page-milestone-footer`,children:t.footer})]})]}):null}function rn({section:e}){let t=e.slots.table;if(!t)return null;let n=e=>t.align?.[e]??void 0;return(0,I.jsxs)(I.Fragment,{children:[e.slots.title&&(0,I.jsx)(`h2`,{className:`squisq-page-section-title squisq-page-table-title`,children:e.slots.title}),(0,I.jsx)(`div`,{className:`squisq-page-table-scroll`,children:(0,I.jsxs)(`table`,{className:`squisq-page-table`,children:[(0,I.jsx)(`thead`,{children:(0,I.jsx)(`tr`,{children:t.headers.map((e,t)=>(0,I.jsx)(`th`,{style:{textAlign:n(t)},children:e},t))})}),(0,I.jsx)(`tbody`,{children:t.rows.map((e,t)=>(0,I.jsx)(`tr`,{children:e.map((e,t)=>(0,I.jsx)(`td`,{style:{textAlign:n(t)},children:e},t))},t))})]})})]})}function an({section:e,block:t}){let{theme:n,showCodeCopyButton:r,onCopyCode:i,fenceRenderers:a,htmlPolicy:o,linkSchemes:s}=K(),c=e.slots.title!==void 0&&t?.sourceHeading?(0,I.jsx)(G,{nodes:[t.sourceHeading],theme:n,showCodeCopyButton:r,onCopyCode:i,htmlPolicy:o,linkSchemes:s}):null,l=e.slots.body?.markdown??t?.contents;return(0,I.jsxs)(`div`,{className:`squisq-page-prose`,children:[c,l&&l.length>0&&(0,I.jsx)(G,{nodes:l,theme:n,showCodeCopyButton:r,onCopyCode:i,fenceRenderers:a,htmlPolicy:o,linkSchemes:s})]})}function on({section:e}){return(0,I.jsxs)(`div`,{children:[(0,I.jsx)(J,{section:e}),e.slots.title&&(0,I.jsx)(`h2`,{className:`squisq-page-section-title`,children:e.slots.title}),e.slots.body?.text&&(0,I.jsx)(`p`,{children:e.slots.body.text})]})}function sn(e,t){return e.kind===`hero`&&e.background===`media`&&e.slots.media?.type===`image`&&t!==`split`}function cn(e){let t=e.accent.scheme;if(t)return{"--squisq-page-accent":t.accent,"--squisq-page-accent-bg":t.bg,"--squisq-page-accent-text":t.text}}function ln(e,t){let{section:n,block:r}=e;switch(n.kind){case`hero`:return(0,I.jsx)(Kt,{section:n,block:r});case`banner`:return(0,I.jsx)(qt,{section:n,block:r});case`stat-band`:return(0,I.jsx)(Jt,{section:n,block:r});case`quote-band`:return(0,I.jsx)(Yt,{section:n,block:r});case`feature-split`:return(0,I.jsx)(Xt,{section:n,block:r,flip:t});case`media-figure`:return(0,I.jsx)(Zt,{section:n,block:r});case`gallery`:return(0,I.jsx)(Qt,{section:n,block:r});case`callout`:return(0,I.jsx)($t,{section:n,block:r});case`card-grid`:return(0,I.jsx)(en,{section:n,block:r});case`item-list`:return(0,I.jsx)(tn,{section:n,block:r});case`timeline-rail`:return(0,I.jsx)(nn,{section:n,block:r});case`table-section`:return(0,I.jsx)(rn,{section:n,block:r});case`canvas-embed`:return(0,I.jsx)(Ut,{section:n});case`footer`:return(0,I.jsx)(on,{section:n,block:r});default:return(0,I.jsx)(an,{section:n,block:r})}}function un({entry:e,featureFlip:t,isLeadProse:n}){let{pageStyle:r,theme:i,showCodeCopyButton:a,onCopyCode:o,fenceRenderers:s,htmlPolicy:c,linkSchemes:l}=K(),{section:u}=e,d=u.slots.richContent?.markdown,f=[`squisq-linear-section`,`squisq-page-section`,`squisq-page-section--${u.kind}`,`squisq-page-section--bg-${u.background}`,`squisq-page-section--em-${u.emphasis}`];u.variant&&f.push(`squisq-page-section--v-${u.variant}`),sn(u,r.tokens.heroStyle)&&f.push(`squisq-page-section--hero-media`);let p={};return u.hints?.vignette&&(p[`data-hint-vignette`]=``),u.hints?.dropCap&&n&&(p[`data-hint-drop-cap`]=``),(0,I.jsx)(`section`,{className:f.join(` `),"data-section-kind":u.kind,"data-block-id":u.blockId,"data-block-index":u.index,"data-template":u.template,style:cn(u),...p,children:(0,I.jsxs)(`div`,{className:`squisq-page-section-inner`,children:[ln(e,t),d&&d.length>0&&(0,I.jsx)(`div`,{className:`squisq-page-rich-content`,children:(0,I.jsx)(G,{nodes:d,theme:i,showCodeCopyButton:a,onCopyCode:o,fenceRenderers:s,htmlPolicy:c,linkSchemes:l})})]})})}function dn({doc:e,markdown:t,basePath:n=`/`,viewport:i,className:o,theme:s,surface:l,animationsEnabled:u=!0,thinMargins:d=!1,imageDisplayMode:p=`inline`,globalKeyboardShortcuts:m=!1,showCover:h=!0,transformPage:_,showCodeCopyButton:y=!1,onCopyCode:b,fenceRenderers:x,htmlPolicy:C,linkSchemes:D}){let O=(0,F.useRef)(null),k=i??S.landscape,te=(0,F.useMemo)(()=>!e&&t!==void 0?g(ee(t)):void 0,[e,t]),A=e??te,ne=ie(l===`auto`),j=l===`auto`?ne:l,M=(0,F.useMemo)(()=>{let e=s??E;return j?T(e,j):e},[s,j]),N=(0,F.useMemo)(()=>a(M,_),[M,_]),re=(0,F.useMemo)(()=>Rt(x),[x]),P=(0,F.useMemo)(()=>A?c(A,{theme:M,viewport:k,customTemplates:A.customTemplates,cover:h!==!1&&A.startBlock,transformPage:_,...re.length>0?{widgetFenceLangs:re}:{}}):[],[A,M,k,h,_,re]),L=(0,F.useMemo)(()=>({theme:M,viewport:k,totalBlocks:P.length,persistentLayers:M.persistentLayers,customTemplates:A?.customTemplates}),[M,k,P.length,A?.customTemplates]),ae=(0,F.useMemo)(()=>({theme:M,pageStyle:N,basePath:n,viewport:k,renderContext:L,animationsEnabled:u,imageDisplayMode:p,showCodeCopyButton:y,onCopyCode:b,fenceRenderers:x,htmlPolicy:C,linkSchemes:D}),[M,N,n,k,L,u,p,y,b,x,C,D]),{featureOrdinals:oe,leadProseIndex:se}=(0,F.useMemo)(()=>{let e=new Map,t=0,n=-1;for(let r of P)r.section.kind===`feature-split`&&e.set(r.section.index,t++),n<0&&r.section.kind===`prose`&&(n=r.section.index);return{featureOrdinals:e,leadProseIndex:n}},[P]);if((0,F.useEffect)(()=>{if(!m)return;let e=e=>{if(e.defaultPrevented||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||e.key!==`ArrowDown`&&e.key!==`ArrowUp`||(e.target instanceof Element?e.target:null)?.closest(`input, textarea, select, [contenteditable]:not([contenteditable="false"]), [role="textbox"], [role="combobox"], [role="listbox"], [role="menu"], [role="dialog"], [aria-modal="true"], .monaco-editor`))return;let t=O.current;if(!t)return;e.preventDefault();let n=Math.max(64,Math.round(t.clientHeight*.12));t.scrollBy({top:e.key===`ArrowDown`?n:-n,behavior:`smooth`})};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[m]),!A)return(0,I.jsx)(`div`,{ref:O,className:`squisq-linear squisq-linear--empty ${o||``}`});let ce=M.colors.background,le=M.colors.text,ue=M.colors.textMuted,de=M.colors.primary,fe=w(M.typography.bodyFont,`system-ui, sans-serif`),pe=w(M.typography.titleFont,`Georgia, serif`),me=M.typography.lineHeight??1.65,he=[`squisq-linear-content`,`squisq-md`,`squisq-page`,d?`squisq-linear-content--thin squisq-page--thin`:``,p===`thumbnail`?`squisq-linear-content--thumbnail-images squisq-page--thumbnail-images`:``].filter(Boolean).join(` `);return(0,I.jsx)(`div`,{ref:O,className:`squisq-linear ${o||``}`,role:`region`,"aria-label":`Document page`,tabIndex:d?void 0:0,style:{width:`100%`,height:d?`auto`:`100%`,overflowY:d?`visible`:`auto`,overflowX:`hidden`,background:ce,containerType:`inline-size`,containerName:`squisq-page`},children:(0,I.jsxs)(`div`,{className:he,...r(N),style:{lineHeight:me,fontSize:`16px`,fontFamily:fe,color:le,...f(M,N),"--squisq-linear-title-font":pe,"--squisq-linear-body-font":fe,"--squisq-linear-text":le,"--squisq-linear-muted":ue,"--squisq-linear-primary":de,"--squisq-linear-bg":ce},children:[(0,I.jsx)(`style`,{"data-squisq-page":``,children:v}),(0,I.jsx)(Ht.Provider,{value:ae,children:P.map(e=>{let t=oe.get(e.section.index)??0;return(0,I.jsx)(un,{entry:e,featureFlip:!!e.section.hints?.alternate&&t%2==1,isLeadProse:e.section.index===se},`${e.section.blockId}-${e.section.index}`)})})]})})}var fn=Object.freeze({frameSize:1024,hopSec:.02,bandLowHz:250,bandHighHz:3e3}),pn=Object.freeze({warmupMs:200,alphaDown:.3,alphaUp:.005,enterRatio:3,exitRatio:2.5,enterFrames:2,hangoverMs:300,noiseRebaselineSec:1.5,floorMin:1e-9}),mn=Object.freeze({envelopeHz:16,minInterOnsetMs:110,prominenceRatio:1.3,minRelPeak:.1,peakRefTauSec:3}),hn=Object.freeze({baseWpm:150,voiceBlend:.6,minRateMult:.5,maxRateMult:3,rateEmaTauSec:.7,velSlewTauSec:.15,haltTauSec:.085,kP:.14,kI:.02,intClamp:4,maxCorrection:.6,sylWindowWords:8,resyncSyllables:8}),gn=Object.freeze({maxDurationSec:7200,maxPcmSamples:2e8,maxScriptTokens:25e4,hopSec:.01,gapMinSec:.35,bandRadiusSec:1.5,bandRadiusNoTraceSec:3,matchTimeWeight:1,pauseToSylCost:2,sylToGapCost:1.5,deleteCost:.8,insertCost:.8,blockSnapWindowSec:.8,tailPadSec:.4});function _n(e,t){let n=2*Math.PI*t/e,r=Math.cos(n),i=Math.sin(n)/(2*Math.SQRT1_2),a=1+i;return{b0:(1+r)/2/a,b1:-(1+r)/a,b2:(1+r)/2/a,a1:-2*r/a,a2:(1-i)/a}}function vn(e,t){let n=2*Math.PI*t/e,r=Math.cos(n),i=Math.sin(n)/(2*Math.SQRT1_2),a=1+i;return{b0:(1-r)/2/a,b1:(1-r)/a,b2:(1-r)/2/a,a1:-2*r/a,a2:(1-i)/a}}function yn(e,t=fn.bandLowHz,n=fn.bandHighHz){return{coeffs:{hp:_n(e,t),lp:vn(e,n)},hp:{x1:0,x2:0,y1:0,y2:0},lp:{x1:0,x2:0,y1:0,y2:0}}}function bn(e,t,n,r){let{x1:i,x2:a,y1:o,y2:s}=t,{b0:c,b1:l,b2:u,a1:d,a2:f}=e;for(let e=0;e<n.length;e++){let t=n[e],p=c*t+l*i+u*a-d*o-f*s;r[e]=p,a=i,i=t,s=o,o=p}return{x1:i,x2:a,y1:o,y2:s}}function xn(e,t,n){let r=bn(e.coeffs.hp,e.hp,t,n),i=bn(e.coeffs.lp,e.lp,n,n);return{coeffs:e.coeffs,hp:r,lp:i}}function Sn(e,t){let n={...fn,...t};return{sampleRate:e,config:n,hopSamples:Math.max(1,Math.round(n.hopSec*e)),bandpass:yn(e,n.bandLowHz,n.bandHighHz),rawCarry:new Float32Array,bandCarry:new Float32Array,carryStartSample:0}}function Cn(e,t){if(e.length===0)return t;let n=new Float32Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n}function wn(e,t,n,r,i,a){let o=0,s=0,c=0,l=e[n];for(let i=0;i<r;i++){let r=e[n+i],a=t[n+i];o+=r*r,s+=a*a,i>0&&(r>=0&&l<0||r<0&&l>=0)&&c++,l=r}return{tSec:(i+r/2)/a,rms:Math.sqrt(o/r),bandEnergy:s/r,zcr:r>1?c/(r-1):0}}function Tn(e,t){let n=new Float32Array(t.length),r=xn(e.bandpass,t,n),i=Cn(e.rawCarry,t),a=Cn(e.bandCarry,n),{frameSize:o}=e.config,s=[],c=0;for(;i.length-c>=o;)s.push(wn(i,a,c,o,e.carryStartSample+c,e.sampleRate)),c+=e.hopSamples;return{state:{...e,bandpass:r,rawCarry:i.slice(c),bandCarry:a.slice(c),carryStartSample:e.carryStartSample+c},frames:s}}function En(e,t,n){return Tn(Sn(t,n),e).frames}function Dn(e){let t={...pn,...e};return{noiseFloor:t.floorMin,speaking:!1,enterStreak:0,subExitSince:null,noDipSince:null,warmupUntilSec:t.warmupMs/1e3,seeded:!1,lastTSec:0}}function On(e,t,n){let r={...pn,...n},i=Math.max(0,t.bandEnergy),a=e.seeded?e.noiseFloor:Math.max(i,r.floorMin);if(e.seeded)if(e.speaking)i<a&&(a+=(i-a)*r.alphaDown);else{let e=i<a?r.alphaDown:r.alphaUp;a+=(i-a)*e}a<r.floorMin&&(a=r.floorMin);let o=e.speaking,s=e.enterStreak,c=e.subExitSince,l=e.noDipSince;return t.tSec<e.warmupUntilSec?(o=!1,s=0,c=null,l=null):o?(i>=a*r.exitRatio?c=null:(c===null&&(c=t.tSec),t.tSec-c>=r.hangoverMs/1e3&&(o=!1,c=null,l=null,s=0)),o&&(i<=a*r.enterRatio?l=t.tSec:l!==null&&t.tSec-l>=r.noiseRebaselineSec&&(a=Math.max(i,r.floorMin),o=!1,c=null,l=null,s=0))):(l=null,i>a*r.enterRatio?(s+=1,s>=r.enterFrames&&(o=!0,c=null,l=t.tSec)):s=0),{noiseFloor:a,speaking:o,enterStreak:s,subExitSince:c,noDipSince:l,warmupUntilSec:e.warmupUntilSec,seeded:!0,lastTSec:t.tSec}}function kn(e){return{env:0,prevEnv:0,prevPrevEnv:0,prevTSec:0,valley:1/0,lastOnsetTSec:-1/0,peakRef:0,lastTSec:0,framesSeen:0}}function An(e,t,n,r){let i={...mn,...r},a=Math.sqrt(Math.max(0,t.bandEnergy)),o=e.framesSeen>0?Math.max(0,t.tSec-e.lastTSec):0,s=e.framesSeen>0?e.env+(a-e.env)*(1-Math.exp(-2*Math.PI*i.envelopeHz*o)):a,c=Math.max(s,e.peakRef*Math.exp(-(o||0)/i.peakRefTauSec)),l=null,u=e.framesSeen>0?e.valley:s,d=e.lastOnsetTSec;return e.framesSeen>=2&&e.prevEnv>=e.prevPrevEnv&&e.prevEnv>s&&n&&e.prevTSec-d>=i.minInterOnsetMs/1e3&&e.prevEnv>=u*i.prominenceRatio&&e.prevEnv>=c*i.minRelPeak&&(l=e.prevTSec,d=e.prevTSec,u=e.prevEnv),u=Math.min(u,s),{state:{env:s,prevEnv:s,prevPrevEnv:e.framesSeen>0?e.prevEnv:s,prevTSec:t.tSec,valley:u,lastOnsetTSec:d,peakRef:c,lastTSec:t.tSec,framesSeen:e.framesSeen+1},onset:l}}function jn(e,t,n){let r=kn(n),i=[];for(let a=0;a<e.length;a++){let o=An(r,e[a],t[a]??!1,n);r=o.state,o.onset!==null&&i.push(o.onset)}return i}function Mn(e=0){return{wordPos:e,velocityWps:0,emaSylPerSec:0,lastOnsetTSec:null,cumDetectedSyl:0,anchorExpectedSyl:0,errIntegral:0,silenceSec:0,lastTSec:null,halted:!0}}function Y(e,t,n){return e<t?t:e>n?n:e}function Nn(e,t,n){let r=e.tokens.length;if(r===0)return 1.4;let i=Y(Math.floor(t),0,r-1),a=0,o=0;for(let t=i;t<r&&o<n;t++)e.tokens[t].spoken&&(a+=e.tokens[t].syllables,o+=1);return o>0?Math.max(1,a/o):1.4}function Pn(e,t,n,r){let i={...hn,...r},a=i.baseWpm/60,o=Y(t.tSec-(e.lastTSec??t.tSec),0,.25),s=e.emaSylPerSec,c=e.lastOnsetTSec,l=e.cumDetectedSyl;for(let e=0;e<t.onsets;e++){if(c!==null){let e=t.tSec-c;if(e>0){let t=Y(1/e,.5,12),n=1-Math.exp(-e/i.rateEmaTauSec);s=s===0?t:s+(t-s)*n}}c=t.tSec,l+=1}let d=Nn(n,e.wordPos,i.sylWindowWords),f=s>0?s/d:a,p=Y(i.voiceBlend*f+(1-i.voiceBlend)*a,a*i.minRateMult,a*i.maxRateMult),h=u(n,e.wordPos)-(e.anchorExpectedSyl+l),g=Y(Math.min(0,e.errIntegral+h*o),-i.intClamp,0),_=h<0?Y(i.kP*-h+i.kI*-g,0,i.maxCorrection):0,v=e.velocityWps,y=e.silenceSec;if(t.speaking){y=0;let e=Math.max(0,p*(1+_));v+=(e-v)*(1-Math.exp(-o/i.velSlewTauSec))}else y+=o,v*=Math.exp(-o/i.haltTauSec),v<.02&&(v=0);let b=e.wordPos;return h<-i.resyncSyllables&&(b=Math.max(b,m(n,e.anchorExpectedSyl+l)),g=0),b=Y(b+v*o,0,n.tokens.length),{wordPos:b,velocityWps:v,emaSylPerSec:s,lastOnsetTSec:c,cumDetectedSyl:l,anchorExpectedSyl:e.anchorExpectedSyl,errIntegral:g,silenceSec:y,lastTSec:t.tSec,halted:!t.speaking&&v===0}}function Fn(e,t,n){let r=Y(t,0,n.tokens.length);return{...e,wordPos:r,anchorExpectedSyl:u(n,r),cumDetectedSyl:0,errIntegral:0}}function In(e,t,n){let r=n??{};return{script:t,config:r,features:Sn(e,r.feature),vad:Dn(r.vad),nuclei:kn(r.nuclei),pacing:Mn(0),lastFrame:null,tSec:0}}function Ln(e,t){let{state:n,frames:r}=Tn(e.features,t),i=e.vad,a=e.nuclei,o=e.pacing,s=e.lastFrame;for(let t of r){i=On(i,t,e.config.vad);let n=An(a,t,i.speaking,e.config.nuclei);a=n.state,o=Pn(o,{tSec:t.tSec,speaking:i.speaking,onsets:n.onset===null?0:1},e.script,e.config.pacing),s=t}return{...e,features:n,vad:i,nuclei:a,pacing:o,lastFrame:s,tSec:e.tSec+t.length/e.features.sampleRate}}function Rn(e,t){return{...e,pacing:Fn(e.pacing,t,e.script)}}var zn=60;function Bn(e,t){let n={...gn,...t},{pcm:r,sampleRate:i,script:a}=e;if(e.signal?.throwIfAborted(),!Number.isFinite(i)||i<=0)throw RangeError(`sampleRate must be a positive finite number`);if(r.length>n.maxPcmSamples)throw RangeError(`Narration take exceeds the ${n.maxPcmSamples}-sample safety limit`);if(a.tokens.length>n.maxScriptTokens)throw RangeError(`Narration script exceeds the ${n.maxScriptTokens}-token safety limit`);let o=r.length/Math.max(1,i);if(o>n.maxDurationSec)throw RangeError(`Narration take exceeds the ${n.maxDurationSec}-second safety limit`);if(a.tokens.length===0||o<=0)return{words:[],blocks:[],detectedSyllables:0,cost:0};let s=En(r,i,{hopSec:n.hopSec});e.signal?.throwIfAborted();let c=Vn(s),l=jn(s,c),u=Hn(s,c,n.gapMinSec),d=Un(s,c);if(l.length===0)return Qn(a,d>0?d:o,o,n,0);let f=[...l.map(e=>({kind:`syl`,tSec:e,startSec:e,endSec:e})),...u].sort((e,t)=>e.tSec-t.tSec),p=Math.min(zn,e.trace&&e.trace.samples.length>=2?n.bandRadiusSec:Math.max(n.bandRadiusNoTraceSec,.1*o)),m=Wn(a,o,e.trace),{matchedEventBySlot:h,cost:g}=qn(m,f,p,n),_=Xn(a,m,f,h);return{words:_,blocks:Zn(a,_,u,o,d,n),detectedSyllables:l.length,cost:g}}function Vn(e){let t=Dn(),n=Array(e.length);for(let r=0;r<e.length;r++)t=On(t,e[r]),n[r]=t.speaking;return n}function Hn(e,t,n){let r=[],i=-1;for(let a=0;a<=e.length;a++){let o=a<e.length&&!t[a];if(o&&i===-1)i=a;else if(!o&&i!==-1){let t=e[i].tSec,o=e[a-1].tSec;o-t>=n&&r.push({kind:`gap`,tSec:(t+o)/2,startSec:t,endSec:o}),i=-1}}return r}function Un(e,t){for(let n=e.length-1;n>=0;n--)if(t[n])return e[n].tSec;return 0}function Wn(e,t,n){let r=[];for(let t=0;t<e.tokens.length;t++){let n=e.tokens[t];for(let e=0;e<n.syllables;e++)r.push({kind:`syl`,tokenIndex:t,slotIndex:e,priorSec:0});n.pauseAfter>=2&&r.push({kind:`pause`,tokenIndex:t,slotIndex:-1,priorSec:0})}if(n!==void 0&&n.samples.length>=2)Gn(r,e,n,t);else{let n=Math.max(1,e.totalSyllables);for(let i of r)i.priorSec=(i.kind===`pause`?e.cumulativeSyllables[i.tokenIndex+1]:e.cumulativeSyllables[i.tokenIndex]+i.slotIndex)/n*t}let i=0;for(let e of r)e.priorSec<i&&(e.priorSec=i),e.priorSec>t&&(e.priorSec=t),i=e.priorSec;return r}function Gn(e,t,n,r){let i=[],a=[],o=0;for(let e of n.samples)o=Math.max(o,e.wordPos),i.push(e.tMs/1e3),a.push(o);let s=0;for(let n of e){let e=t.tokens[n.tokenIndex],o=n.kind===`pause`?n.tokenIndex+1:n.tokenIndex+n.slotIndex/Math.max(1,e.syllables);for(;s<a.length-1&&a[s+1]<o;)s++;let c;if(a[s]>=o)c=i[s];else if(s>=a.length-1)c=i[i.length-1];else{let e=a[s+1]-a[s],t=e>0?(o-a[s])/e:0;c=i[s]+t*(i[s+1]-i[s])}n.priorSec=Math.min(Math.max(0,c),r)}}function Kn(e,t,n,r){return e.kind===`syl`?t.kind===`syl`?r.matchTimeWeight*Math.abs(t.tSec-e.priorSec)/Math.max(1e-6,n):r.sylToGapCost:t.kind===`gap`?0:r.pauseToSylCost}function qn(e,t,n,r){let i=e.length,a=t.length,o=1/0,s=t.map(e=>e.tSec),c=new Int32Array(i+1),l=new Int32Array(i+1);for(let t=1;t<=i;t++){let r=e[t-1].priorSec;c[t]=Jn(s,r-n),l[t]=Yn(s,r+n)}c[0]=0,l[0]=i>=1?l[1]:a;for(let e=1;e<=i;e++)c[e]<c[e-1]&&(c[e]=c[e-1]),c[e]>l[e-1]+1&&(c[e]=l[e-1]+1),c[e]>a&&(c[e]=a),l[e]<l[e-1]&&(l[e]=l[e-1]),l[e]<c[e]&&(l[e]=c[e]),l[e]>a&&(l[e]=a);l[i]=a,c[i]>a&&(c[i]=a);let u=Array(i+1),d=new Float64Array(l[0]-c[0]+1);{let e=new Uint8Array(l[0]-c[0]+1);for(let t=c[0];t<=l[0];t++)d[t-c[0]]=t*r.insertCost,e[t-c[0]]=2;u[0]=e}for(let a=1;a<=i;a++){let i=l[a]-c[a]+1,s=new Float64Array(i).fill(o),f=new Uint8Array(i),p=e[a-1];for(let e=c[a];e<=l[a];e++){let i=e-c[a],u=o,m=1;if(e>=1&&e-1>=c[a-1]&&e-1<=l[a-1]){let i=d[e-1-c[a-1]]+Kn(p,t[e-1],n,r);i<u&&(u=i,m=0)}if(e>=c[a-1]&&e<=l[a-1]){let t=d[e-c[a-1]]+r.deleteCost;t<u&&(u=t,m=1)}if(e-1>=c[a]){let e=s[i-1]+r.insertCost;e<u&&(u=e,m=2)}s[i]=u,f[i]=m}u[a]=f,d=s}let f=new Int32Array(i).fill(-1),p=i,m=a,h=d[a-c[i]]??0;for(;p>0||m>0;){let e=u[p],t=m-c[p],n=t>=0&&t<e.length?e[t]:p>0?1:2;if(n===0&&p>0&&m>0)f[p-1]=m-1,p--,m--;else if(n===1&&p>0)p--;else if(m>0)m--;else if(p>0)p--;else break}return{matchedEventBySlot:f,cost:Number.isFinite(h)?h:0}}function Jn(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1;e[i]<t?n=i+1:r=i}return n}function Yn(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1;e[i]<=t?n=i+1:r=i}return n}function Xn(e,t,n,r){let i=e.tokens.length,a=Array(i);for(let e=0;e<t.length;e++){let i=r[e];if(i<0)continue;let o=t[e];if(o.kind!==`syl`||a[o.tokenIndex]!==void 0)continue;let s=n[i];a[o.tokenIndex]=s.kind===`gap`?s.endSec:s.tSec}let o=Array(i),s=-1,c=0;for(let e=0;e<i;e++){if(a[e]===void 0)continue;let t=a[e];for(let n=s+1;n<e;n++){let r=(n-s)/(e-s),i=s>=0?c:t;o[n]={tokenIndex:n,tSec:i+(t-i)*(s>=0?r:0),interpolated:!0}}o[e]={tokenIndex:e,tSec:t,interpolated:!1},s=e,c=t}for(let e=s+1;e<i;e++)o[e]={tokenIndex:e,tSec:c,interpolated:!0};if(s===-1)for(let e=0;e<i;e++)o[e]={tokenIndex:e,tSec:0,interpolated:!0};let l=0;for(let e of o)l=Math.max(l,e.tSec),e.tSec=l;return o}function Zn(e,t,n,r,i,a){let o=[],s=n.map(e=>e.endSec),c=0;for(let n=0;n<e.blocks.length;n++){let r=e.blocks[n],i=t[r.tokenStart],l=n===0?0:i?.tSec??c;if(n>0){let e=Yn(s,l)-1;e>=0&&l-s[e]<=a.blockSnapWindowSec&&s[e]>c&&(l=s[e]),l<c&&(l=c)}o.push({blockId:r.blockId,...r.heading===void 0?{}:{heading:r.heading},blockIndex:n,charStart:r.charStart,charEnd:r.charEnd,startSec:l,endSec:l}),c=l}for(let e=0;e<o.length-1;e++)o[e].endSec=o[e+1].startSec;if(o.length>0){let e=o[o.length-1],t=Math.min(r,(i>0?i:r)+a.tailPadSec);r-t<=1&&(t=r),e.endSec=Math.max(e.startSec,t)}return o}function Qn(e,t,n,r,i){let a=Math.max(1,e.totalSyllables),o=e.tokens.map((n,r)=>({tokenIndex:r,tSec:e.cumulativeSyllables[r]/a*t,interpolated:!0}));return{words:o,blocks:Zn(e,o,[],n,t,r),detectedSyllables:i,cost:0}}var $n=Object.freeze([]);function er(e,t,n){if(!t||!Number.isFinite(n))return e;for(let n of e)if(n.blockId===t)return e;let r=e.length>0?e[e.length-1].atMs:0;return[...e,{blockId:t,atMs:Math.max(n,r,0)}]}function tr(e){return Number.isFinite(e)&&e>=0?e:0}function nr(e,t,n){let r=new Map,i=0;for(let a of e){if(!t.has(a.blockId)||r.has(a.blockId))continue;let e=Number.isFinite(a.atMs)?a.atMs/1e3:i,o=Math.min(n,Math.max(i,e));r.set(a.blockId,o),i=o}let a=r.keys().next();return a.done||r.set(a.value,0),r}function rr(e,t,n,r){let i=tr(n),a=h(e.blocks),o=l(e,r?.script),s=new Map(o.blocks.map(e=>[e.blockId,e])),c=nr(t,new Set(a.map(e=>e.id)),i),u=Array(a.length),d=i;for(let e=a.length-1;e>=0;e--){let t=c.get(a[e].id);t===void 0?u[e]=d:(u[e]=t,d=t)}let f=[],p=0;for(let e=0;e<a.length;e++){let t=a[e],n=s.get(t.id),r=n?n.charStart:p,o=n?n.charEnd:p;p=o;let c=u[e],l=e+1<a.length?u[e+1]:i;f.push({blockId:t.id,...t.title?{heading:t.title}:{},blockIndex:e,charStart:r,charEnd:o,startSec:c,endSec:Math.max(c,Math.min(l,i))})}return{version:3,sourceText:o.sourceText,duration:i,bookmarks:[],blocks:f,generator:{name:r?.generatorName??`squisq-recorder`,method:`presenter-advance`}}}function ir(e,t){let n=h(e.blocks),r=new Set(t.map(e=>e.blockId)),i=[],a=0;for(let e of n)r.has(e.id)?a++:i.push(e.title||e.id);return{total:n.length,shown:a,unshown:n.length-a,unshownHeadings:i}}var ar=Object.freeze([`American`,`British`,`Australian`,`Canadian`,`Indian`]),or=Object.freeze({Spelling:`spelling`,Typo:`spelling`,Agreement:`grammar`,BoundaryError:`grammar`,Capitalization:`grammar`,Eggcorn:`grammar`,Grammar:`grammar`,Malapropism:`grammar`,Miscellaneous:`grammar`,Nonstandard:`grammar`,Punctuation:`grammar`,Repetition:`grammar`,Usage:`grammar`,WordChoice:`grammar`,WordOrder:`grammar`,Enhancement:`style`,Formatting:`style`,Readability:`style`,Redundancy:`style`,Regionalism:`style`,Style:`style`});function sr(e){return or[e]??`style`}var cr=/\{\[[^\n]*?\]\}/g;function lr(e){let t=[];return{text:e.replace(cr,(e,n)=>(t.push({start:n,end:n+e.length}),` `.repeat(e.length))),blanked:t}}function ur(e){let t=[],n=[],r=``;for(let i of e)r.length>0&&(r+=`
|
|
9
|
-
|
|
10
|
-
`),t.push(r.length),n.push(i.length),r+=i;return{text:r,starts:t,lengths:n}}function dr(e,t,n){if(n<=t)return null;let{starts:r,lengths:i}=e,a=0,o=r.length-1,s=-1;for(;a<=o;){let e=a+o>>1;r[e]<=t?(s=e,a=e+1):o=e-1}if(s<0)return null;let c=r[s],l=c+i[s];return t>=l||n>l?null:{segmentIndex:s,start:t-c,end:n-c}}var fr=Object.freeze({enabled:{canonical:`squisq-proofing`,legacy:`proofing`},dialect:{canonical:`squisq-proof-dialect`,legacy:`proof-dialect`},dictionary:{canonical:`squisq-proof-dictionary`,legacy:`proof-dictionary`}}),pr=Object.freeze({enabled:!0,dialect:`American`});function mr(e,t){if(e)return Object.prototype.hasOwnProperty.call(e,t.canonical)?e[t.canonical]:e[t.legacy]}function hr(e){if(typeof e==`boolean`)return e;if(typeof e!=`string`)return;let t=e.trim().toLowerCase();if([`true`,`yes`,`on`].includes(t))return!0;if([`false`,`no`,`off`].includes(t))return!1}function gr(e){if(typeof e!=`string`)return;let t=e.trim().toLowerCase();return ar.find(e=>e.toLowerCase()===t)}function _r(e){let t=[];if(typeof e==`string`)t.push(...e.split(/[,\s]+/));else if(Array.isArray(e))for(let n of e)typeof n==`string`&&t.push(...n.split(/[,\s]+/));let n=new Set,r=[];for(let e of t){let t=e.trim();t.length===0||n.has(t)||(n.add(t),r.push(t))}return r}function vr(e){let t=_r([...e]);return t.length>0?t.join(`, `):null}function yr(e){return{enabled:hr(mr(e,fr.enabled)),dialect:gr(mr(e,fr.dialect)),dictionary:_r(mr(e,fr.dictionary))}}var br=/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z$/;function X(e){return e<10?`0${e}`:String(e)}function xr(e){return String(e.getUTCFullYear()).padStart(4,`0`)+X(e.getUTCMonth()+1)+X(e.getUTCDate())+`T`+X(e.getUTCHours())+X(e.getUTCMinutes())+X(e.getUTCSeconds())+`Z`}function Sr(e){let t=br.exec(e);if(!t)return null;let[,n,r,i,a,o,s]=t,c=Date.UTC(Number(n),Number(r)-1,Number(i),Number(a),Number(o),Number(s));return Number.isNaN(c)?null:new Date(c)}var Cr=new TextDecoder,wr=new TextEncoder,Tr=`.gitignore`,Er=`.versions/`,Dr=/^(!?)\/?\.versions\/?$/;async function Or(e){let t=await e.readFile(Tr),n=t?Cr.decode(t):``;for(let e of n.split(/\r?\n/))if(Dr.test(e.trim()))return;let r=n.includes(`\r
|
|
11
|
-
`)?`\r
|
|
12
|
-
`:`
|
|
13
|
-
`,i=`${n}${n.length>0&&!n.endsWith(`
|
|
14
|
-
`)?r:``}${Er}${r}`;await e.writeFile(Tr,wr.encode(i),`text/plain`)}var kr=new TextDecoder,Ar=new TextEncoder,jr=/[<>:"/\\|?*]/,Mr=/^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i,Nr=new WeakMap;function Pr(e){if(e.length===0||e.length>200||e===`.`||e===`..`||e.endsWith(`.`)||e.endsWith(` `)||jr.test(e)||[...e].some(e=>{let t=e.codePointAt(0);return t<32||t===127})||Mr.test(e))throw TypeError(`Invalid snapshot basename: ${JSON.stringify(e)}`)}function Fr(e,t,n,r=0){if(Pr(t),!Number.isFinite(n.getTime()))throw TypeError(`Snapshot date must be valid`);if(!Number.isInteger(r)||r<0)throw RangeError(`Snapshot collision must be a non-negative integer`);let i=xr(n),a=r>0?`-${r+1}`:``;return`${e.prefix}${t}.${i}${a}.${e.extension}`}function Ir(e,t){if(!t.startsWith(e.prefix))return null;let n=`.${e.extension}`,r=t.slice(e.prefix.length);if(!r.endsWith(n))return null;let i=r.slice(0,-n.length),a=i.lastIndexOf(`.`);if(a<=0)return null;let o=i.slice(0,a),s=i.slice(a+1),c=s.indexOf(`-`),l=s,u=0;if(c>=0){l=s.slice(0,c);let e=Number(s.slice(c+1));if(!Number.isInteger(e)||e<2)return null;u=e-1}let d=Sr(l);return d?{basename:o,timestamp:d,collision:u}:null}async function Z(e,t,n){let r=await e.listFiles(t.prefix),i=[];for(let e of r){let r=Ir(t,e.path);!r||n!==void 0&&r.basename!==n||i.push({path:e.path,basename:r.basename,timestamp:r.timestamp,size:e.size,collision:r.collision})}return i.sort((e,t)=>t.timestamp.getTime()-e.timestamp.getTime()||t.collision-e.collision),i}async function Lr(e,t){let n=typeof t==`string`?t:t.path,r=await e.readFile(n);return r?kr.decode(r):null}async function Rr(e,t,n){return zr(e,async()=>{let r=await Z(e,t,n.basename);if(!n.force&&r.length>0&&await Lr(e,r[0])===n.content)return await Or(e),{saved:!1,version:null,reason:`unchanged`};let i=n.now??new Date,a=Ar.encode(n.content);await Or(e);let o=0,s=Fr(t,n.basename,i,o);if(e.writeFileExclusive)for(;!await e.writeFileExclusive(s,a,n.mimeType);)o+=1,s=Fr(t,n.basename,i,o);else{for(;await e.exists(s);)o+=1,s=Fr(t,n.basename,i,o);await e.writeFile(s,a,n.mimeType)}return{saved:!0,version:{path:s,basename:n.basename,timestamp:i,size:a.byteLength,collision:o},reason:`saved`}})}async function zr(e,t){let n=e.mutationLock??e,r=Nr.get(n)??Promise.resolve(),i,a=new Promise(e=>{i=e}),o=r.catch(()=>void 0).then(()=>a);Nr.set(n,o),await r.catch(()=>void 0);try{return await t()}finally{i(),Nr.get(n)===o&&Nr.delete(n)}}function Br(e){let t=new Map;for(let n of e){let e=t.get(n.basename);e?e.push(n):t.set(n.basename,[n])}return t}function Vr(e,t){return e.filter(e=>t.has(e))}async function Hr(e,t,n,r){if(n.type===`keep-last-n`&&(!Number.isSafeInteger(n.n)||n.n<0))throw RangeError(`keep-last-n requires a non-negative safe integer`);if(n.type===`older-than`&&!Number.isFinite(n.date.getTime()))throw TypeError(`older-than requires a valid date`);let i=await Z(e,t,r),a=new Set;for(let e of Br(i).values())if(n.type===`keep-last-n`)for(let t of e.slice(n.n))a.add(t);else if(n.type===`older-than`){let t=n.date.getTime();for(let n of e)n.timestamp.getTime()<t&&a.add(n)}else for(let t of e)n.keep(t,e)||a.add(t);let o=Vr(i,a);return await Wr(e,o),o}async function Ur(e,t,n={},r){let i=n.windowMs??6e4;if(!Number.isFinite(i)||i<0)throw RangeError(`windowMs must be a non-negative finite number`);let a=await Z(e,t,r),o=new Set;for(let e of Br(a).values()){let t=e[0];for(let n=1;n<e.length;n++){let r=e[n];t.timestamp.getTime()-r.timestamp.getTime()<=i?o.add(r):t=r}}let s=Vr(a,o);return await Wr(e,s),s}async function Wr(e,t){for(let n of t)await e.removeFile(n.path)}var Gr=Object.freeze({prefix:`.versions/`,extension:`md`});function Kr(e){let t=e.lastIndexOf(`/`),n=t>=0?e.slice(t+1):e,r=n.lastIndexOf(`.`);return r>0?n.slice(0,r):n}async function qr(e,t){if(t)return t;let n=await e.getDocumentPath();return n?Kr(n):null}async function Jr(e){return await e.getDocumentPath()??`index.md`}async function Yr(e,t){return Z(e,Gr,t)}async function Xr(e,t){return Lr(e,t)}async function Zr(e,t={}){let n=t.content??await e.readDocument();if(n==null)return{saved:!1,version:null,reason:`no-document`};let r=await qr(e,t.basename);return r?Rr(e,Gr,{content:n,basename:r,mimeType:`text/markdown`,now:t.now,force:t.force}):{saved:!1,version:null,reason:`no-document`}}async function Qr(e,t,n={}){let r=await Xr(e,t);if(r===null)return{reverted:!1,snapshotted:null,reason:`missing-snapshot`};let i=null;if(n.snapshotCurrent!==!1){let t={};n.content!==void 0&&(t.content=n.content),n.basename!==void 0&&(t.basename=n.basename);let r=await Zr(e,t);if(!r.saved&&r.reason!==`unchanged`)return{reverted:!1,snapshotted:null,reason:`snapshot-failed`};i=r.version}let a=await Jr(e);return await e.writeDocument(r,a),{reverted:!0,snapshotted:i}}async function $r(e,t,n){return Hr(e,Gr,t,n)}async function ei(e,t={},n){return Ur(e,Gr,t,n)}var ti=class{constructor(e,t={}){this.container=e,this.basename=t.basename}saveVersion(e={}){return Zr(this.container,{basename:this.basename,...e})}listVersions(){return Yr(this.container,this.basename)}readVersion(e){return Xr(this.container,e)}revertToVersion(e,t){return Qr(this.container,e,{basename:this.basename,...t})}pruneVersions(e){return $r(this.container,e,this.basename)}coalesceVersions(e){return ei(this.container,e,this.basename)}},ni=`state.json`,ri=`assets/`;function ii(){return`layer-${Math.random().toString(36).slice(2,10)}`}function ai(e,t,n={}){let r=(n.now??new Date).toISOString();return{version:1,canvas:{width:e,height:t,background:n.background??`transparent`},layers:[],meta:{sourcePath:n.sourcePath,createdAt:r,updatedAt:r}}}function oi(e,t){let n=t.id?t:{...t,id:ii()};return Q({...e,layers:[...e.layers,n]})}function si(e,t){let n=e.layers.filter(e=>e.id!==t);return n.length===e.layers.length?e:Q({...e,layers:n})}function ci(e,t,n){let r=e.layers.findIndex(e=>e.id===t);if(r<0)return e;let i=Math.max(0,Math.min(e.layers.length-1,Math.floor(n)));if(i===r)return e;let a=e.layers.slice(),[o]=a.splice(r,1);return a.splice(i,0,o),Q({...e,layers:a})}function li(e,t,n){let r=!1,i=e.layers.map(e=>e.id===t?(r=!0,{...e,...n}):e);return r?Q({...e,layers:i}):e}function ui(e,t){return Q({...e,canvas:t})}function Q(e,t=new Date){return{...e,meta:{...e.meta,createdAt:e.meta?.createdAt??t.toISOString(),updatedAt:t.toISOString()}}}var di=new TextDecoder,fi=new TextEncoder;async function pi(e,t=ni){let n=await e.readFile(t);if(!n)return null;let r=di.decode(n),i;try{i=JSON.parse(r)}catch(e){let n=e instanceof Error?e.message:String(e);throw Error(`readImageEditDoc: ${t} is not valid JSON: ${n}`)}return hi(i,t),i}async function mi(e,t,n=ni){let r=JSON.stringify(t,null,2);await e.writeFile(n,fi.encode(r),`application/json`)}function hi(e,t,n=`readImageEditDoc`){if(!e||typeof e!=`object`)throw Error(`${n}: ${t} root must be an object`);let r=e;if(r.version!==1)throw Error(`${n}: ${t} has unsupported schema version ${String(r.version)} (expected 1)`);if(!r.canvas||typeof r.canvas.width!=`number`||typeof r.canvas.height!=`number`)throw Error(`${n}: ${t} canvas.width/height must be numbers`);if(!Array.isArray(r.layers))throw Error(`${n}: ${t} layers must be an array`);r.layers.forEach((e,n)=>_i(e,n,t))}var gi=new Set([`image`,`text`,`shape`,`path`]);function _i(e,t,n){let r=`${n} layers[${t}]`;if(!e||typeof e!=`object`)throw Error(`readImageEditDoc: ${r} must be an object`);let i=e;if(typeof i.id!=`string`)throw Error(`readImageEditDoc: ${r} must have a string id`);if(typeof i.type!=`string`||!gi.has(i.type))throw Error(`readImageEditDoc: ${r} type must be one of image|text|shape, got ${String(i.type)}`);let a=i.position;if(!a||typeof a!=`object`||typeof a.x!=`number`&&typeof a.x!=`string`||typeof a.y!=`number`&&typeof a.y!=`string`)throw Error(`readImageEditDoc: ${r} position must have numeric or string x and y`);let o=i.content;if(!o||typeof o!=`object`)throw Error(`readImageEditDoc: ${r} content must be an object`);let s=o;if(i.type===`image`&&typeof s.src!=`string`)throw Error(`readImageEditDoc: ${r} (image) content.src must be a string`);if(i.type===`text`&&typeof s.text!=`string`)throw Error(`readImageEditDoc: ${r} (text) content.text must be a string`);if(i.type===`shape`&&typeof s.shape!=`string`)throw Error(`readImageEditDoc: ${r} (shape) content.shape must be a string`);if(i.type===`path`&&typeof s.d!=`string`)throw Error(`readImageEditDoc: ${r} (path) content.d must be a string`)}var vi=Object.freeze({prefix:`.versions/`,extension:`json`});async function yi(e,t){return Z(e,vi,t)}async function bi(e,t){return Lr(e,t)}async function xi(e,t){let n=await bi(e,t);if(n===null)return null;let r=typeof t==`string`?t:t.path,i;try{i=JSON.parse(n)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`readImageEditVersion: ${r} is not valid JSON: ${t}`)}return hi(i,r,`readImageEditVersion`),i}async function Si(e,t={}){let n=t.stateFilename??`state.json`,r=t.doc??await pi(e,n);if(!r)return{saved:!1,version:null,reason:`no-state`};let i=t.basename??`state`;return Rr(e,vi,{content:JSON.stringify(r,null,2),basename:i,mimeType:`application/json`,now:t.now,force:t.force})}async function Ci(e,t,n={}){let r=await xi(e,t);if(!r)return{reverted:!1,snapshotted:null,reason:`missing-snapshot`};let i=null;if(n.snapshotCurrent!==!1){let t={stateFilename:n.stateFilename};n.doc!==void 0&&(t.doc=n.doc);let r=await Si(e,t);if(!r.saved&&r.reason!==`unchanged`)return{reverted:!1,snapshotted:null,reason:`snapshot-failed`};i=r.version}return await mi(e,r,n.stateFilename),{reverted:!0,snapshotted:i}}async function wi(e,t,n){return Hr(e,vi,t,n)}async function Ti(e,t={},n){return Ur(e,vi,t,n)}var Ei=class{constructor(e,t={}){this.container=e,this.basename=t.basename,this.stateFilename=t.stateFilename}saveVersion(e={}){return Si(this.container,{basename:this.basename,stateFilename:this.stateFilename,...e})}listVersions(){return yi(this.container,this.basename)}readVersion(e){return xi(this.container,e)}revertToVersion(e,t={}){return Ci(this.container,e,{stateFilename:this.stateFilename,...t})}pruneVersions(e){return wi(this.container,e,this.basename)}coalesceVersions(e={}){return Ti(this.container,e,this.basename)}},Di={png:`image/png`,jpeg:`image/jpeg`,webp:`image/webp`};async function Oi(e,t,n={}){let r=n.format??`png`,i=n.quality??.92,a=n.scale??1,o=Di[r],s=await ki(e,t),c=Math.max(1,Math.round(e.canvas.width*a)),l=Math.max(1,Math.round(e.canvas.height*a)),u=await Hi(s),d=Ui(c,l),f=d.getContext(`2d`);if(!f)throw Error(`exportImageEditDoc: 2D canvas context unavailable`);return r===`jpeg`&&(f.fillStyle=e.canvas.background&&e.canvas.background!==`transparent`?e.canvas.background:`#ffffff`,f.fillRect(0,0,c,l)),f.drawImage(u,0,0,c,l),Wi(d,o,i)}async function ki(e,t){let{width:n,height:r,background:i}=e.canvas,a=i&&i!==`transparent`?`<rect width="${n}" height="${r}" fill="${$(i)}"/>`:``,o=[];for(let n of e.layers)n.visible!==!1&&o.push(await Ai(n,e.canvas,t));return`<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="${n}" height="${r}" viewBox="0 0 ${n} ${r}">`+a+o.join(``)+`</svg>`}async function Ai(e,t,n){let r=e.opacity??1,i=r<1?` opacity="${r}"`:``,a=await ji(e,t,n);return`<g data-layer-id="${$(e.id)}"${i}>${a}</g>`}async function ji(e,t,n){let{x:r,y:i,w:a,h:o}=Ii(e.position,t);if(e.type===`image`){let t=await zi(n,e.content.src);return`<image x="${r}" y="${i}" width="${a}" height="${o}" preserveAspectRatio="${Fi(e.content.fit)}" xlink:href="${$(t)}"/>`}if(e.type===`shape`){let t=e.content,n=t.fill??`none`,s=t.stroke?` stroke="${$(t.stroke)}"`:``,c=t.strokeWidth?` stroke-width="${t.strokeWidth}"`:``;if(t.shape===`rect`){let e=t.borderRadius?` rx="${t.borderRadius}" ry="${t.borderRadius}"`:``;return`<rect x="${r}" y="${i}" width="${a}" height="${o}" fill="${$(n)}"${s}${c}${e}/>`}if(t.shape===`circle`){let e=Math.min(a,o)/2;return`<circle cx="${r+a/2}" cy="${i+o/2}" r="${e}" fill="${$(n)}"${s}${c}/>`}return`<line x1="${r}" y1="${i}" x2="${r+a}" y2="${i+o}"${s}${c}/>`}if(e.type===`path`)return Mi(e,r,i,a,o);let s=e.content,c=s.style,l=c.lineHeight??1.4,u=c.fontSize*l,d=(s.text??``).split(`
|
|
15
|
-
`).map((e,t)=>`<tspan x="${r}" dy="${t===0?0:u}">${Gi(e)}</tspan>`).join(``),f=c.fontFamily??`sans-serif`,p=c.fontWeight??`normal`,m=c.textAlign===`center`?`middle`:c.textAlign===`right`?`end`:`start`;return`<text x="${r}" y="${i+c.fontSize}" font-family="${$(f)}" font-size="${c.fontSize}" font-weight="${p}" fill="${$(c.color)}" text-anchor="${m}">`+d+`</text>`}function Mi(e,t,n,r,a){let o=e.content,c=o.shapeKind?s(o.shapeKind,t,n,r,a)??o.d:o.d,l=o.stroke??`#1e293b`,u=o.strokeWidth??2,d=o.fill??`none`,f=o.dasharray?` stroke-dasharray="${$(o.dasharray)}"`:``,p=o.arrow,m=Ni(o.startMarker,p,`start`),h=Ni(o.endMarker,p,`end`),g=i(m,`start`),_=i(h,`end`),v=`marker-start-${e.id}`,y=`marker-end-${e.id}`,b=g||_?`<defs>${g?Pi(v,`start`,g,l):``}${_?Pi(y,`end`,_,l):``}</defs>`:``,x=g?` marker-start="url(#${v})"`:``,S=_?` marker-end="url(#${y})"`:``;return b+`<path d="${$(c)}" fill="${$(d)}" stroke="${$(l)}" stroke-width="${u}"${f}${x}${S}/>`}function Ni(e,t,n){return e||(t===`both`||t===n?`arrow`:`none`)}function Pi(e,t,n,r){let i=t===`end`?9:1,a=n.filled?`fill="${$(r)}"`:`fill="none" stroke="${$(r)}" stroke-width="1.5"`;return`<marker id="${$(e)}" viewBox="0 0 10 10" refX="${i}" refY="5" markerWidth="4" markerHeight="4" orient="auto-start-reverse" markerUnits="strokeWidth"><path d="${$(n.d)}" ${a}/></marker>`}function Fi(e){return e===`cover`?`xMidYMid slice`:e===`fill`?`none`:`xMidYMid meet`}function Ii(e,t){let n=Li(e.x,t.width),r=Li(e.y,t.height),i=e.width===void 0?t.width:Li(e.width,t.width),a=e.height===void 0?t.height:Li(e.height,t.height),o=Ri(e.anchor,i,a);return{x:n+o.x,y:r+o.y,w:i,h:a}}function Li(e,t){return typeof e==`number`?e:e.endsWith(`%`)?parseFloat(e)/100*t:parseFloat(e)||0}function Ri(e,t,n){switch(e){case`center`:return{x:-t/2,y:-n/2};case`top-right`:return{x:-t,y:0};case`bottom-left`:return{x:0,y:-n};case`bottom-right`:return{x:-t,y:-n};default:return{x:0,y:0}}}async function zi(e,t){if(/^(data:|https?:|blob:)/.test(t))return t;let n=await e.readFile(t);if(!n)throw Error(`exportImageEditDoc: missing asset "${t}"`);return Bi(n,(await e.listFiles(t)).find(e=>e.path===t)?.mimeType??Vi(t))}function Bi(e,t){return`data:${t};base64,${o(new Uint8Array(e))}`}function Vi(e){let t=e.lastIndexOf(`.`);switch(t>=0?e.slice(t).toLowerCase():``){case`.png`:return`image/png`;case`.jpg`:case`.jpeg`:return`image/jpeg`;case`.webp`:return`image/webp`;case`.gif`:return`image/gif`;case`.svg`:return`image/svg+xml`;default:return`application/octet-stream`}}async function Hi(e){let t=new Blob([e],{type:`image/svg+xml;charset=utf-8`}),n=URL.createObjectURL(t);try{return await new Promise((e,t)=>{let r=new Image;r.onload=()=>e(r),r.onerror=()=>t(Error(`exportImageEditDoc: SVG image failed to load`)),r.src=n})}finally{URL.revokeObjectURL(n)}}function Ui(e,t){if(typeof OffscreenCanvas<`u`)return new OffscreenCanvas(e,t);let n=document.createElement(`canvas`);return n.width=e,n.height=t,n}async function Wi(e,t,n){return`convertToBlob`in e?e.convertToBlob({type:t,quality:n}):new Promise((r,i)=>{e.toBlob(e=>{e?r(e):i(Error(`exportImageEditDoc: canvas.toBlob returned null`))},t,n)})}function $(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function Gi(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}export{Ln as A,Ge as B,yr as C,Bn as D,ir as E,Rt as F,he as G,Ae as H,G as I,R as K,ge as L,er as M,Bt as N,rr as O,dn as P,st as R,dr as S,$n as T,lt as U,ut as V,fe as W,fr as _,ai as a,sr as b,si as c,Q as d,li as f,ar as g,pr as h,oi as i,Rn as j,In as k,ci as l,ti as m,ni as n,Oi as o,mi as p,me as q,Ei as r,pi as s,ri as t,ui as u,lr as v,pn as w,vr as x,ur as y,Ye as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,bmp:`image/bmp`,svg:`image/svg+xml`,tiff:`image/tiff`,tif:`image/tiff`,ico:`image/x-icon`,avif:`image/avif`,emf:`image/emf`,wmf:`image/wmf`,mp3:`audio/mpeg`,wav:`audio/wav`,ogg:`audio/ogg`,mp4:`video/mp4`,webm:`video/webm`};function t(t){return e[t.replace(/^\./,``).toLowerCase()]??`application/octet-stream`}export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{F as e}from"./index-DXWR4qW1.js";import"./storage-fn4FCEVK.js";async function t(t,n){let r=new e;await r.writeDocument(t);for(let[e,{data:t,mimeType:i}]of n)await r.writeFile(e,new Uint8Array(t),i);return r}export{t};
|