@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{t as r}from"./react-dom-OL4w_gzs.js";import{A as i,D as a,E as o,H as s,J as c,K as l,M as u,O as d,T as f,W as p,X as m,Y as h,Z as g,j as _,k as v,q as y,w as b}from"./primitives-CWrGZpPI.js";import{a as x,i as ee,n as S,o as C,s as te,t as w}from"./DropdownMenu-S4d9-3j3.js";import{n as T}from"./relative-time-B2kBaekd.js";import{t as E}from"./FileTypeIcon-Cwzl1GkZ.js";var D=e(t(),1),O=Object.defineProperty,k=(e,t)=>O(e,`name`,{value:t,configurable:!0}),A=!!(typeof window<`u`&&window.document&&window.document.createElement);function j(e,t,{checkForDefaultPrevented:n=!0}={}){return k(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}k(j,`composeEventHandlers`);function M(e){if(!A)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}k(M,`getOwnerWindow`);function N(e){if(!A)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}k(N,`getOwnerDocument`);function ne(e,t=!1){let{activeElement:n}=N(e);if(!n?.nodeName)return null;if(P(n)&&n.contentDocument)return ne(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=N(n).getElementById(e);if(t)return t}}return n}k(ne,`getActiveElement`);function P(e){return e.tagName===`IFRAME`}k(P,`isFrame`);var F=n(),re=Object.defineProperty,I=(e,t)=>re(e,`name`,{value:t,configurable:!0});function ie(e,t){let n=D.createContext(t);n.displayName=e+`Context`;let r=I(e=>{let{children:t,...r}=e,i=D.useMemo(()=>r,Object.values(r));return(0,F.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=D.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return I(i,`useContext`),[r,i]}I(ie,`createContext`);function L(e,t=[]){let n=[];function r(t,r){let i=D.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=I(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=D.useMemo(()=>o,Object.values(o));return(0,F.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=D.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return I(s,`useContext`),[o,s]}I(r,`createContext`);let i=I(()=>{let t=n.map(e=>D.createContext(e));return I(function(n){let r=n?.[e]||t;return D.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,ae(i,...t)]}I(L,`createContextScope`);function ae(...e){let t=e[0];if(e.length===1)return t;let n=I(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return I(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return D.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}I(ae,`composeContextScopes`);var oe=e(r(),1),R=Object.defineProperty,se=(e,t)=>R(e,`name`,{value:t,configurable:!0});function ce(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}se(ce,`setRef`);function le(...e){return t=>{let n=!1,r=e.map(e=>{let r=ce(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():ce(e[t],null)}}}}se(le,`composeRefs`);function z(...e){return D.useCallback(le(...e),e)}se(z,`useComposedRefs`);var ue=Object.defineProperty,B=(e,t)=>ue(e,`name`,{value:t,configurable:!0});function V(e){let t=D.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];ve(r)&&typeof Se==`function`&&(r=Se(r._payload)),D.Children.forEach(r,e=>{if(ge(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;ve(n)&&typeof Se==`function`&&(n=Se(n._payload)),a=pe(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=D.cloneElement(a,void 0,s):!o&&D.Children.count(r)===1&&D.isValidElement(r)&&(a=r);let c=a?he(a):void 0,l=z(n,c);if(!a){if(r||r===0)throw Error(o?xe(e):be(e));return r}let u=me(i,a.props??{});return a.type!==D.Fragment&&(u.ref=n?l:c),D.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}B(V,`createSlot`);var de=Symbol.for(`radix.slottable`);function fe(e){let t=B(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=de,t}B(fe,`createSlottable`);var pe=B((e,t)=>{if(`child`in e.props){let t=e.props.child;return D.isValidElement(t)?D.cloneElement(t,void 0,e.props.children(t.props.children)):null}return D.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function me(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}B(me,`mergeProps`);function he(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}B(he,`getElementRef`);function ge(e){return D.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===de}B(ge,`isSlottable`);var _e=Symbol.for(`react.lazy`);function ve(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===_e&&`_payload`in e&&ye(e._payload)}B(ve,`isLazyComponent`);function ye(e){return typeof e==`object`&&!!e&&`then`in e}B(ye,`isPromiseLike`);var be=B(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),xe=B(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),Se=D.use,Ce=Object.defineProperty,we=(e,t)=>Ce(e,`name`,{value:t,configurable:!0}),H=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=V(`Primitive.${t}`),r=D.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,F.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Te(e,t){e&&oe.flushSync(()=>e.dispatchEvent(t))}we(Te,`dispatchDiscreteCustomEvent`);var Ee=Object.defineProperty,U=(e,t)=>Ee(e,`name`,{value:t,configurable:!0});function De(e){let t=e+`CollectionProvider`,[n,r]=L(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=U(e=>{let{scope:t,children:n}=e,r=D.useRef(null),a=D.useRef(new Map).current;return(0,F.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})},`CollectionProvider`);o.displayName=t;let s=e+`CollectionSlot`,c=V(s),l=D.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=z(t,a(s,n).collectionRef);return(0,F.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=V(u),p=D.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=D.useRef(null),s=z(t,o),c=a(u,n);return D.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,F.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return D.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return U(m,`useCollection`),[{Provider:o,Slot:l,ItemSlot:p},m,r]}U(De,`createCollection`);var Oe=new WeakMap,ke=class e extends Map{static{U(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],Oe.set(this,!0)}set(e,t){return Oe.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=this.#e.length,a=Me(e),o=a>=0?a:i+a,s=o<0||o>=i?-1:o;if(s===this.size||r&&s===this.size-1||s===-1)return this.set(t,n),this;let c=this.size+ +!r;a<0&&o++;let l=[...this.#e],u,d=!1;for(let e=o;e<c;e++)if(o===e){let i=l[e];l[e]===t&&(i=l[e+1]),r&&this.delete(t),u=this.get(i),this.set(t,n)}else{!d&&l[e-1]===t&&(d=!0);let n=l[d?e:e-1],r=u;u=this.get(n),this.delete(n),this.set(n,r)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=Ae(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=Ae(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return Ae(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=r===0&&e.length===1?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&e.length===1?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(t===void 0)return r;t<0&&(t+=this.size),n!==void 0&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function Ae(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=je(e,t);return n===-1?void 0:e[n]}U(Ae,`at`);function je(e,t){let n=e.length,r=Me(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}U(je,`toSafeIndex`);function Me(e){return e!==e||e===0?0:Math.trunc(e)}U(Me,`toSafeInteger`);function Ne(e){let t=e+`CollectionProvider`,[n,r]=L(t),[i,a]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new ke,setItemMap:U(()=>void 0,`setItemMap`)}),o=U(({state:e,...t})=>e?(0,F.jsx)(c,{...t,state:e}):(0,F.jsx)(s,{...t}),`CollectionProvider`);o.displayName=t;let s=U(e=>{let t=h();return(0,F.jsx)(c,{...e,state:t})},`CollectionInit`);s.displayName=t+`Init`;let c=U(e=>{let{scope:t,children:n,state:r}=e,a=D.useRef(null),[o,s]=D.useState(null),c=z(a,s),[l,u]=r;return D.useEffect(()=>{if(!o)return;let e=Le(()=>{});return e.observe(o,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[o]),(0,F.jsx)(i,{scope:t,itemMap:l,setItemMap:u,collectionRef:c,collectionRefObject:a,collectionElement:o,children:n})},`CollectionProviderImpl`);c.displayName=t+`Impl`;let l=e+`CollectionSlot`,u=V(l),d=D.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=z(t,a(l,n).collectionRef);return(0,F.jsx)(u,{ref:i,children:r})});d.displayName=l;let f=e+`CollectionItemSlot`,p=V(f),m=D.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=D.useRef(null),[s,c]=D.useState(null),l=z(t,o,c),{setItemMap:u}=a(f,n),d=D.useRef(i);Pe(d.current,i)||(d.current=i);let m=d.current;return D.useEffect(()=>{let e=m;return u(t=>s?t.has(s)?t.set(s,{...e,element:s}).toSorted(Ie):(t.set(s,{...e,element:s}),t.toSorted(Ie)):t),()=>{u(e=>!s||!e.has(s)?e:(e.delete(s),new ke(e)))}},[s,m,u]),(0,F.jsx)(p,{"data-radix-collection-item":``,ref:l,children:r})});m.displayName=f;function h(){return D.useState(new ke)}U(h,`useInitCollection`);function g(t){let{itemMap:n}=a(e+`CollectionConsumer`,t);return n}return U(g,`useCollection`),[{Provider:o,Slot:d,ItemSlot:m},{createCollectionScope:r,useCollection:g,useInitCollection:h}]}U(Ne,`createCollection`);function Pe(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}U(Pe,`shallowEqual`);function Fe(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}U(Fe,`isElementPreceding`);function Ie(e,t){return!e[1].element||!t[1].element?0:Fe(e[1].element,t[1].element)?-1:1}U(Ie,`sortByDocumentPosition`);function Le(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}U(Le,`getChildListObserver`);var Re=Object.defineProperty,ze=(e,t)=>Re(e,`name`,{value:t,configurable:!0}),Be=D.createContext(void 0);function Ve(e){let t=D.useContext(Be);return e||t||`ltr`}ze(Ve,`useDirection`);var He=Object.defineProperty,Ue=(e,t)=>He(e,`name`,{value:t,configurable:!0});function W(e){let t=D.useRef(e);return D.useEffect(()=>{t.current=e}),D.useMemo(()=>((...e)=>t.current?.(...e)),[])}Ue(W,`useCallbackRef`);var We=Object.defineProperty,G=(e,t)=>We(e,`name`,{value:t,configurable:!0}),Ge=`dismissableLayer.update`,Ke=`dismissableLayer.pointerDownOutside`,qe=`dismissableLayer.focusOutside`,Je,Ye=D.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Xe=D.forwardRef(G(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=D.useContext(Ye),[d,f]=D.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=D.useState({}),h=z(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,ee=D.useRef(!1),S=$e(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:ee,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:D.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),C=et(e=>{if(r&&ee.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),te=d?y===g.length-1:!1,w=W(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return D.useEffect(()=>{if(te)return p.addEventListener(`keydown`,w,{capture:!0}),()=>p.removeEventListener(`keydown`,w,{capture:!0})},[p,te,w]),D.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Je=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),tt(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Je))}},[d,p,n,u]),D.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),tt())},[d,u]),D.useEffect(()=>{let e=G(()=>m({}),`handleUpdate`);return document.addEventListener(Ge,e),()=>document.removeEventListener(Ge,e)},[]),(0,F.jsx)(H.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:j(e.onFocusCapture,C.onFocusCapture),onBlurCapture:j(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:j(e.onPointerDownCapture,S.onPointerDownCapture)})},`DismissableLayer`));function Ze(){let e=D.useContext(Ye),[t,n]=D.useState(null);return D.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}G(Ze,`useDismissableLayerSurface`);var Qe=G(()=>!0,`IS_TRUE`);function $e(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Qe}=t,s=W(e),c=D.useRef(!1),l=D.useRef(!1),u=D.useRef(new Map),d=D.useRef(()=>{});return D.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}G(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}G(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}G(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}G(p,`handleInteractionBubble`);let m=G(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||nt(Ke,s,p,{discrete:!0})};if(G(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:G(()=>c.current=!0,`onPointerDownCapture`)}}G($e,`usePointerDownOutside`);function et(e,t=globalThis?.document){let n=W(e),r=D.useRef(!1);return D.useEffect(()=>{let e=G(e=>{e.target&&!r.current&&nt(qe,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:G(()=>r.current=!0,`onFocusCapture`),onBlurCapture:G(()=>r.current=!1,`onBlurCapture`)}}G(et,`useFocusOutside`);function tt(){let e=new CustomEvent(Ge);document.dispatchEvent(e)}G(tt,`dispatchUpdate`);function nt(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Te(i,a):i.dispatchEvent(a)}G(nt,`handleAndDispatchCustomEvent`);var rt=Object.defineProperty,it=(e,t)=>rt(e,`name`,{value:t,configurable:!0}),at=0,ot=null;function st(e){return ct(),e.children}it(st,`FocusGuards`);function ct(){D.useEffect(()=>{ot||={start:lt(),end:lt()};let{start:e,end:t}=ot;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),at++,()=>{at===1&&(ot?.start.remove(),ot?.end.remove(),ot=null),at=Math.max(0,at-1)}},[])}it(ct,`useFocusGuards`);function lt(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}it(lt,`createFocusGuard`);var ut=Object.defineProperty,K=(e,t)=>ut(e,`name`,{value:t,configurable:!0}),dt=`focusScope.autoFocusOnMount`,ft=`focusScope.autoFocusOnUnmount`,pt={bubbles:!1,cancelable:!0},mt=D.forwardRef(K(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=D.useState(null),l=W(i),u=W(a),d=D.useRef(null),f=z(t,c),p=D.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;D.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:q(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||q(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&q(s)};K(e,`handleFocusIn`),K(t,`handleFocusOut`),K(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),D.useEffect(()=>{if(s){xt.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(dt,pt);s.addEventListener(dt,l),s.dispatchEvent(t),t.defaultPrevented||(ht(wt(_t(s)),{select:!0}),document.activeElement===e&&q(s))}return()=>{s.removeEventListener(dt,l),setTimeout(()=>{let t=new CustomEvent(ft,pt);s.addEventListener(ft,u),s.dispatchEvent(t),t.defaultPrevented||q(e??document.body,{select:!0}),s.removeEventListener(ft,u),xt.remove(p)},0)}}},[s,l,u,p]);let m=D.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=gt(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&q(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&q(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,F.jsx)(H.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})},`FocusScope`));function ht(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(q(r,{select:t}),document.activeElement!==n)return}K(ht,`focusFirst`);function gt(e){let t=_t(e);return[vt(t,e),vt(t.reverse(),e)]}K(gt,`getTabbableEdges`);function _t(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:K(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}K(_t,`getTabbableCandidates`);function vt(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):yt(r,{upTo:t})))return r}K(vt,`findVisible`);function yt(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}K(yt,`isHidden`);function bt(e){return e instanceof HTMLInputElement&&`select`in e}K(bt,`isSelectableInput`);function q(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&bt(e)&&t&&e.select()}}K(q,`focus`);var xt=St();function St(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Ct(e,t),e.unshift(t)},remove(t){e=Ct(e,t),e[0]?.resume()}}}K(St,`createFocusScopesStack`);function Ct(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}K(Ct,`arrayRemove`);function wt(e){return e.filter(e=>e.tagName!==`A`)}K(wt,`removeLinks`);var J=globalThis?.document?D.useLayoutEffect:()=>{},Tt=Object.defineProperty,Et=(e,t)=>Tt(e,`name`,{value:t,configurable:!0}),Dt=D.useId||(()=>void 0),Ot=0;function kt(e){let[t,n]=D.useState(Dt());return J(()=>{e||n(e=>e??String(Ot++))},[e]),e||(t?`radix-${t}`:``)}Et(kt,`useId`);var At=Object.defineProperty,jt=(e,t)=>At(e,`name`,{value:t,configurable:!0});function Mt(e){let[t,n]=D.useState(void 0);return J(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}jt(Mt,`useSize`);var Nt=Object.defineProperty,Y=(e,t)=>Nt(e,`name`,{value:t,configurable:!0}),Pt=`Popper`,[Ft,It]=L(Pt),[Lt,Rt]=Ft(Pt),zt=Y(e=>{let{__scopePopper:t,children:n}=e,[r,i]=D.useState(null),[a,o]=D.useState(void 0);return(0,F.jsx)(Lt,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),Bt=`PopperAnchor`,Vt=D.forwardRef(Y(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=Rt(Bt,n),o=D.useRef(null),s=a.onAnchorChange,c=z(t,D.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=D.useRef(null);D.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&Jt(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,F.jsx)(H.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),Ht=`PopperContent`,[Ut,Wt]=Ft(Ht),Gt=D.forwardRef(Y(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:s=0,align:c=`center`,alignOffset:l=0,arrowPadding:p=0,avoidCollisions:m=!0,collisionBoundary:h=[],collisionPadding:g=0,sticky:y=`partial`,hideWhenDetached:x=!1,updatePositionStrategy:ee=`optimized`,onPlaced:S,...C}=e,te=Rt(Ht,n),[w,T]=D.useState(null),E=z(t,T),[O,k]=D.useState(null),A=Mt(O),j=A?.width??0,M=A?.height??0,N=r+(c===`center`?``:`-`+c),ne=typeof g==`number`?g:{top:0,right:0,bottom:0,left:0,...g},P=Array.isArray(h)?h:[h],re=P.length>0,I={padding:ne,boundary:P.filter(Kt),altBoundary:re},{refs:ie,floatingStyles:L,placement:ae,isPositioned:oe,middlewareData:R}=_({strategy:`fixed`,placement:N,whileElementsMounted:Y((...e)=>u(...e,{animationFrame:ee===`always`}),`whileElementsMounted`),elements:{reference:te.anchor},middleware:[d({mainAxis:s+M,alignmentAxis:l}),m&&v({mainAxis:!0,crossAxis:!1,limiter:y===`partial`?a():void 0,...I}),m&&f({...I}),i({...I,apply:Y(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),O&&b({element:O,padding:p}),qt({arrowWidth:j,arrowHeight:M}),x&&o({strategy:`referenceHidden`,...I,boundary:re?I.boundary:void 0})]}),se=te.setPlacementState;J(()=>(se(ae),()=>{se(void 0)}),[ae,se]);let[ce,le]=Jt(ae),ue=W(S);J(()=>{oe&&ue?.()},[oe,ue]);let B=R.arrow?.x,V=R.arrow?.y,de=R.arrow?.centerOffset!==0,[fe,pe]=D.useState();return J(()=>{w&&pe(window.getComputedStyle(w).zIndex)},[w]),(0,F.jsx)(`div`,{ref:ie.setFloating,"data-radix-popper-content-wrapper":``,style:{...L,transform:oe?L.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:fe,"--radix-popper-transform-origin":[R.transformOrigin?.x,R.transformOrigin?.y].join(` `),...R.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,F.jsx)(Ut,{scope:n,placedSide:ce,placedAlign:le,onArrowChange:k,arrowX:B,arrowY:V,shouldHideArrow:de,children:(0,F.jsx)(H.div,{"data-side":ce,"data-align":le,...C,ref:E,style:{...C.style,animation:oe?C.style?.animation:`none`}})})})},`PopperContent`));function Kt(e){return e!==null}Y(Kt,`isNotNull`);var qt=Y(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Jt(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function Jt(e){let[t,n=`center`]=e.split(`-`);return[t,n]}Y(Jt,`getSideAndAlignFromPlacement`);var Yt=zt,Xt=Vt,Zt=Gt,Qt=Object.defineProperty,$t=D.forwardRef(((e,t)=>Qt(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=D.useState(!1);J(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?oe.createPortal((0,F.jsx)(H.div,{...r,ref:t}),o):null},`Portal`)),en=Object.defineProperty,X=(e,t)=>en(e,`name`,{value:t,configurable:!0});function tn(e,t){return D.useReducer((e,n)=>t[e][n]??e,e)}X(tn,`useStateMachine`);var nn=X(e=>{let{present:t,children:n}=e,r=rn(t),i=typeof n==`function`?n({present:r.isPresent}):D.Children.only(n),a=on(r.ref,cn(i));return typeof n==`function`||r.isPresent?D.cloneElement(i,{ref:a}):null},`Presence`);function rn(e){let[t,n]=D.useState(),r=D.useRef(null),i=D.useRef(e),a=D.useRef(`none`),o=D.useRef(void 0),[s,c]=tn(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return D.useEffect(()=>{s===`mounted`?(a.current=o.current??sn(r.current),o.current=void 0):a.current=`none`},[s]),J(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=sn(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),J(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=X(a=>{let o=sn(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=X(e=>{e.target===t&&(a.current=sn(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:D.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=sn(t)}else r.current=null;n(e)},[])}}X(rn,`usePresence`);function an(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}X(an,`setRef`);function on(...e){let t=D.useRef(e);return t.current=e,D.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=an(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():an(n[e],null)}}},[])}X(on,`useStableComposedRefs`);function sn(e){return e?.animationName||`none`}X(sn,`getAnimationName`);function cn(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}X(cn,`getElementRef`);var ln=Object.defineProperty,un=(e,t)=>ln(e,`name`,{value:t,configurable:!0}),dn=D.useEffectEvent,fn=D.useInsertionEffect;function pn(e){if(typeof dn==`function`)return dn(e);let t=D.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof fn==`function`?fn(()=>{t.current=e}):J(()=>{t.current=e}),D.useMemo(()=>((...e)=>t.current?.(...e)),[])}un(pn,`useEffectEvent`);var mn=Object.defineProperty,hn=(e,t)=>mn(e,`name`,{value:t,configurable:!0}),gn=D.useInsertionEffect||J;function _n({prop:e,defaultProp:t,onChange:n=hn(()=>{},`onChange`),caller:r}){let[i,a,o]=vn({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,D.useCallback(t=>{if(s){let n=yn(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}hn(_n,`useControllableState`);function vn({defaultProp:e,onChange:t}){let[n,r]=D.useState(e),i=D.useRef(n),a=D.useRef(t);return gn(()=>{a.current=t},[t]),D.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}hn(vn,`useUncontrolledState`);function yn(e){return typeof e==`function`}hn(yn,`isFunction`);var bn=Symbol(`RADIX:SYNC_STATE`);function xn(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=pn(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=D.useReducer((t,n)=>{if(n.type===bn)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=D.useRef(p);D.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=D.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return D.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:bn,state:i})},[i,d.state,c]),[h,f]}hn(xn,`useControllableStateReducer`);var Sn=Object.defineProperty,Cn=(e,t)=>Sn(e,`name`,{value:t,configurable:!0}),wn=!1;function Tn(){let[e,t]=D.useState(wn);return D.useEffect(()=>{wn||(wn=!0,t(!0))},[]),e}Cn(Tn,`useIsHydrated`);var En=D.useSyncExternalStore;function Dn(){return()=>{}}Cn(Dn,`subscribe`);function On(){return En(Dn,()=>!0,()=>!1)}Cn(On,`useIsHydratedModern`);var kn=typeof En==`function`?On:Tn,An=Object.defineProperty,jn=(e,t)=>An(e,`name`,{value:t,configurable:!0}),Mn=`rovingFocusGroup.onEntryFocus`,Nn={bubbles:!1,cancelable:!0},Pn=`RovingFocusGroup`,[Fn,In,Ln]=De(Pn),[Rn,zn]=L(Pn,[Ln]),[Bn,Vn]=Rn(Pn),Hn=D.forwardRef(jn(function(e,t){return(0,F.jsx)(Fn.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,F.jsx)(Fn.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,F.jsx)(Un,{...e,ref:t})})})},`RovingFocusGroup`)),Un=D.forwardRef(jn(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=D.useRef(null),p=z(t,f),m=Ve(a),[h,g]=_n({prop:o,defaultProp:s??null,onChange:c,caller:Pn}),[_,v]=D.useState(!1),y=W(l),b=In(n),x=D.useRef(!1),[ee,S]=D.useState(0);return D.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Mn,y),()=>e.removeEventListener(Mn,y)},[y]),(0,F.jsx)(Bn,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:D.useCallback(e=>g(e),[g]),onItemShiftTab:D.useCallback(()=>v(!0),[]),onFocusableItemAdd:D.useCallback(()=>S(e=>e+1),[]),onFocusableItemRemove:D.useCallback(()=>S(e=>e-1),[]),children:(0,F.jsx)(H.div,{tabIndex:_||ee===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:j(e.onMouseDown,()=>{x.current=!0}),onFocus:j(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(Mn,Nn);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);Yn([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:j(e.onBlur,()=>v(!1))})})},`RovingFocusGroupImpl`)),Wn=`RovingFocusGroupItem`,Gn=D.forwardRef(jn(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=kt(),l=a||c,u=Vn(Wn,n),d=u.currentTabStopId===l,f=In(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=kn();return J(()=>{if(!(!g||!r))return p(),()=>m()},[g,r,p,m]),D.useEffect(()=>{if(!(g||!r))return p(),()=>m()},[g,r,p,m]),(0,F.jsx)(Fn.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,F.jsx)(H.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:j(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:j(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:j(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Jn(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Xn(n,r+1):n.slice(r+1)}setTimeout(()=>Yn(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})},`RovingFocusGroupItem`)),Kn={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function qn(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}jn(qn,`getDirectionAwareKey`);function Jn(e,t,n){let r=qn(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Kn[r]}jn(Jn,`getFocusIntent`);function Yn(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}jn(Yn,`focusFirst`);function Xn(e,t){return e.map((n,r)=>e[(t+r)%e.length])}jn(Xn,`wrapArray`);var Zn=Hn,Qn=Gn,$n=Object.defineProperty,Z=(e,t)=>$n(e,`name`,{value:t,configurable:!0}),er=[`Enter`,` `],tr=[`ArrowDown`,`PageUp`,`Home`],nr=[`ArrowUp`,`PageDown`,`End`],rr=[...tr,...nr];[...er],[...er];var ir=`Menu`,[ar,or,sr]=De(ir),[cr,lr]=L(ir,[sr,It,zn]),ur=It(),dr=zn(),[fr,pr]=cr(ir),[mr,hr]=cr(ir),gr=Z(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=ur(t),[c,l]=D.useState(null),u=D.useRef(!1),d=W(a),f=Ve(i);return D.useEffect(()=>{let e=Z(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=Z(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),D.useEffect(()=>{if(!n)return;let e=Z(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,F.jsx)(Yt,{...s,children:(0,F.jsx)(fr,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,F.jsx)(mr,{scope:t,onClose:D.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),_r=D.forwardRef(Z(function(e,t){let{__scopeMenu:n,...r}=e,i=ur(n);return(0,F.jsx)(Xt,{...i,...r,ref:t})},`MenuAnchor`)),vr=`MenuPortal`,[yr,br]=cr(vr,{forceMount:void 0}),xr=Z(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=pr(vr,t);return(0,F.jsx)(yr,{scope:t,forceMount:n,children:(0,F.jsx)(nn,{present:n||a.open,children:(0,F.jsx)($t,{asChild:!0,container:i,children:r})})})},`MenuPortal`),Q=`MenuContent`,[Sr,Cr]=cr(Q),wr=D.forwardRef(Z(function(e,t){let n=br(Q,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=pr(Q,e.__scopeMenu),o=hr(Q,e.__scopeMenu);return(0,F.jsx)(ar.Provider,{scope:e.__scopeMenu,children:(0,F.jsx)(nn,{present:r||a.open,children:(0,F.jsx)(ar.Slot,{scope:e.__scopeMenu,children:o.modal?(0,F.jsx)(Tr,{...i,ref:t}):(0,F.jsx)(Er,{...i,ref:t})})})})},`MenuContent`)),Tr=D.forwardRef(Z(function(e,t){let n=pr(Q,e.__scopeMenu),r=D.useRef(null),i=z(t,r);return D.useEffect(()=>{let e=r.current;if(e)return m(e)},[]),(0,F.jsx)(Or,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:j(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),Er=D.forwardRef(Z(function(e,t){let n=pr(Q,e.__scopeMenu);return(0,F.jsx)(Or,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),Dr=V(`MenuContent.ScrollLock`),Or=D.forwardRef(Z(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,_=pr(Q,n),v=hr(Q,n),y=ur(n),b=dr(n),x=or(n),[ee,S]=D.useState(null),C=D.useRef(null),te=z(t,C,_.onContentChange),w=D.useRef(0),T=D.useRef(``),E=D.useRef(0),O=D.useRef(null),k=D.useRef(`right`),A=D.useRef(0),M=m?g:D.Fragment,N=m?{as:Dr,allowPinchZoom:!0}:void 0,ne=Z(e=>{let t=T.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Gr(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;Z((function e(t){T.current=t,window.clearTimeout(w.current),t!==``&&(w.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);D.useEffect(()=>()=>window.clearTimeout(w.current),[]),ct();let P=D.useCallback(e=>k.current===O.current?.side&&qr(e,O.current?.area),[]);return(0,F.jsx)(Sr,{scope:n,searchRef:T,onItemEnter:D.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:D.useCallback(e=>{P(e)||(C.current?.focus(),S(null))},[P]),onTriggerLeave:D.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:E,onPointerGraceIntentChange:D.useCallback(e=>{O.current=e},[]),children:(0,F.jsx)(M,{...N,children:(0,F.jsx)(mt,{asChild:!0,trapped:i,onMountAutoFocus:j(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,F.jsx)(Xe,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,F.jsx)(Zn,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:ee,onCurrentTabStopIdChange:S,onEntryFocus:j(c,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,F.jsx)(Zt,{role:`menu`,"aria-orientation":`vertical`,"data-state":Br(_.open),"data-radix-menu-content":``,dir:v.dir,...y,...h,ref:te,style:{outline:`none`,...h.style},onKeyDown:j(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ne(e.key));let i=C.current;if(e.target!==i||!rr.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);nr.includes(e.key)&&a.reverse(),Ur(a)}),onBlur:j(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(w.current),T.current=``)}),onPointerMove:j(e.onPointerMove,Jr(e=>{let t=e.target,n=A.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>A.current?`right`:`left`;k.current=t,A.current=e.clientX}}))})})})})})})},`MenuContentImpl`)),kr=`MenuItem`,Ar=`menu.itemSelect`,jr=D.forwardRef(Z(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=D.useRef(null),o=hr(kr,e.__scopeMenu),s=Cr(kr,e.__scopeMenu),c=z(t,a),l=D.useRef(!1),u=Z(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Ar,{bubbles:!0,cancelable:!0});e.addEventListener(Ar,e=>r?.(e),{once:!0}),Te(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,F.jsx)(Mr,{...i,ref:c,disabled:n,onClick:j(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:j(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:j(e.onKeyDown,e=>{n||e.target!==e.currentTarget||s.searchRef.current!==``&&e.key===` `||er.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),Mr=D.forwardRef(Z(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Cr(kr,n),s=dr(n),c=D.useRef(null),l=z(t,c),[u,d]=D.useState(!1),[f,p]=D.useState(``);return D.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,F.jsx)(ar.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,F.jsx)(Qn,{asChild:!0,...s,focusable:!r,children:(0,F.jsx)(H.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:j(e.onPointerMove,Jr(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:j(e.onPointerLeave,Jr(e=>o.onItemLeave(e))),onFocus:j(e.onFocus,()=>d(!0)),onBlur:j(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),[Nr,Pr]=cr(`MenuRadioGroup`,{value:void 0,onValueChange:Z(()=>{},`onValueChange`)}),[Fr,Ir]=cr(`MenuItemIndicator`,{checked:!1}),Lr=D.forwardRef(Z(function(e,t){let{__scopeMenu:n,...r}=e;return(0,F.jsx)(H.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[Rr,zr]=cr(`MenuSub`);function Br(e){return e?`open`:`closed`}Z(Br,`getOpenState`);function Vr(e){return e===`indeterminate`}Z(Vr,`isIndeterminate`);function Hr(e){return Vr(e)?`indeterminate`:e?`checked`:`unchecked`}Z(Hr,`getCheckedState`);function Ur(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}Z(Ur,`focusFirst`);function Wr(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Z(Wr,`wrapArray`);function Gr(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Wr(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}Z(Gr,`getNextMatch`);function Kr(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}Z(Kr,`isPointInPolygon`);function qr(e,t){return t?Kr({x:e.clientX,y:e.clientY},t):!1}Z(qr,`isPointerInGraceArea`);function Jr(e){return t=>t.pointerType===`mouse`?e(t):void 0}Z(Jr,`whenMouse`);var Yr=gr,Xr=_r,Zr=xr,Qr=wr,$r=jr,ei=Lr,ti=Object.defineProperty,$=(e,t)=>ti(e,`name`,{value:t,configurable:!0}),ni=`ContextMenu`,[ri,ii]=L(ni,[lr]),ai=lr(),[oi,si]=ri(ni),ci=$(e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,dir:a,modal:o=!0}=e,s=D.useRef(!1),[c,l]=_n({prop:i,defaultProp:!1,onChange:r,caller:ni}),u=ai(t);return(0,F.jsx)(oi,{scope:t,open:c,onOpenChange:l,modal:o,hasInteractedRef:s,children:(0,F.jsx)(Yr,{...u,dir:a,open:c,onOpenChange:l,modal:o,children:n})})},`ContextMenu`),li=`ContextMenuTrigger`,ui=D.forwardRef($(function(e,t){let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=si(li,n),o=ai(n),[s,c]=D.useState({x:0,y:0}),l=D.useMemo(()=>({current:{getBoundingClientRect:$(()=>DOMRect.fromRect({width:0,height:0,...s}),`getBoundingClientRect`)}}),[s]),u=D.useRef(0),d=D.useCallback(()=>window.clearTimeout(u.current),[]),f=$(e=>{a.hasInteractedRef.current=!0,c({x:e.clientX,y:e.clientY}),a.onOpenChange(!0)},`handleOpen`);return D.useEffect(()=>d,[d]),D.useEffect(()=>void(r&&d()),[r,d]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Xr,{...o,virtualRef:l}),(0,F.jsx)(H.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:j(e.onContextMenu,e=>{d(),f(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:j(e.onPointerDown,gi(e=>{d(),a.open&&a.onOpenChange(!1),u.current=window.setTimeout(()=>f(e),700)})),onPointerMove:r?e.onPointerMove:j(e.onPointerMove,gi(d)),onPointerCancel:r?e.onPointerCancel:j(e.onPointerCancel,gi(d)),onPointerUp:r?e.onPointerUp:j(e.onPointerUp,gi(d))})]})},`ContextMenuTrigger`)),di=$(e=>{let{__scopeContextMenu:t,...n}=e,r=ai(t);return(0,F.jsx)(Zr,{...r,...n})},`ContextMenuPortal`),fi=`ContextMenuContent`,pi=D.forwardRef($(function(e,t){let{__scopeContextMenu:n,...r}=e,i=si(fi,n),a=ai(n),o=D.useRef(!1);return(0,F.jsx)(Qr,{...a,...r,ref:t,side:`right`,sideOffset:2,align:`start`,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`ContextMenuContent`)),mi=D.forwardRef($(function(e,t){let{__scopeContextMenu:n,...r}=e,i=ai(n);return(0,F.jsx)($r,{...i,...r,ref:t})},`ContextMenuItem`)),hi=D.forwardRef($(function(e,t){let{__scopeContextMenu:n,...r}=e,i=ai(n);return(0,F.jsx)(ei,{...i,...r,ref:t})},`ContextMenuSeparator`));function gi(e){return t=>t.pointerType===`mouse`?void 0:e(t)}$(gi,`whenTouchOrPen`);var _i=ci,vi=ui,yi=di,bi=pi,xi=mi,Si=hi,Ci=_i,wi=vi,Ti=yi,Ei=bi,Di=xi,Oi=Si,ki=[`tree-alpha`,`tree-modified`,`flat-modified`,`flat-issues`,`flat-criticality`],Ai=[`tree-alpha`,`tree-modified`,`flat-modified`],ji=Ai;function Mi(e){return T(e,{seconds:!0,fallback:e})}function Ni(e){if(!Number.isFinite(e)||e<0)return``;if(e<1024)return`${e} ${e===1?`byte`:`bytes`}`;let t=[`KB`,`MB`,`GB`,`TB`],n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${n.toFixed(1)} ${t[r]}`}function Pi(e,t){return e.localeCompare(t)}function Fi(e,t){let n=e.mtimeMs,r=t.mtimeMs;return n!==void 0&&r!==void 0&&n!==r?r-n:n!==void 0&&r===void 0?-1:n===void 0&&r!==void 0?1:Pi(e.name,t.name)}function Ii(e,t){let n=e.map(e=>e.children.length>0?{...e,children:Ii(e.children,t)}:e);return n.sort((e,n)=>e.isDirectory===n.isDirectory?e.isDirectory||t===`alpha`?Pi(e.name,n.name):Fi(e,n):e.isDirectory?-1:1),n}var Li={major:10,minor:3,info:1};function Ri(e){let t=new Map;for(let n of e){let e=t.get(n.path);e||(e={path:n.path,total:0,bySeverity:{major:0,minor:0,info:0},score:0},t.set(n.path,e)),e.total+=1,e.bySeverity[n.severity]+=1,e.score+=Li[n.severity]}return[...t.values()]}function zi(e,t){return[...e].sort((e,n)=>{let r=t===`count`?n.total-e.total:n.score-e.score;return r===0?e.path.localeCompare(n.path):r})}function Bi(e){let t=[];for(let n of[`major`,`minor`,`info`]){let r=e[n];r>0&&t.push(`${r} ${n}`)}return t.join(` · `)}function Vi(e,t){return`gezel.projectFilesView:${e}:${t}`}function Hi(e,t){return`gezel.projectFilesHidden:${e}:${t}`}function Ui(e,t){return(t===`workspace`?ki:Ai).includes(e)?e:`tree-alpha`}var Wi=`gezel.documentsFilesView`,Gi=`gezel.documentsFilesHidden`;function Ki(e,t){let n=e.lastIndexOf(`/`);return{name:n>=0?e.slice(n+1):e,path:e,isDirectory:!1,...t===void 0?{}:{mtimeMs:t}}}function qi(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}function Ji(e){let t=[],n=new Map;for(let t of e)n.set(t.path,{name:t.name,path:t.path,isDirectory:t.isDirectory,...t.mtimeMs===void 0?{}:{mtimeMs:t.mtimeMs},children:[]});for(let r of e){let e=n.get(r.path);if(!e)continue;let i=r.path.includes(`/`)?r.path.slice(0,r.path.lastIndexOf(`/`)):``,a=i?n.get(i):void 0;a?a.children.push(e):t.push(e)}return t}function Yi(e){return e.isDirectory?(0,F.jsx)(`i`,{className:`tree-icon tree-icon-folder fa-regular fa-folder fa-fw`,"aria-hidden":`true`}):(0,F.jsx)(E,{name:e.name,className:`tree-icon`})}function Xi(e){return e.name}function Zi({entries:e,selectedPath:t,onSelect:n,onIntent:r,onRename:i,onDelete:a,onMove:o,actionsForEntry:s,trailingForEntry:c,defaultExpandedDepth:l=2,iconFor:u=Yi,labelFor:d=Xi,selectableFolders:f=!1,sortMode:p=`none`}){let[m,h]=(0,D.useState)(null),[g,_]=(0,D.useState)(null);return(0,F.jsx)(F.Fragment,{children:(0,D.useMemo)(()=>p===`none`?Ji(e):Ii(Ji(e),p),[e,p]).map(e=>(0,F.jsx)($i,{node:e,depth:0,selectedPath:t,onSelect:n,onIntent:r,onRename:i,onDelete:a,onMove:o,actionsForEntry:s,trailingForEntry:c,defaultExpandedDepth:l,iconFor:u,labelFor:d,selectableFolders:f,draggedEntry:m,dropTargetPath:g,onDragStart:(e,t)=>{h(e),_(null),t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`application/x-gezel-file-path`,e.path),t.dataTransfer.setData(`text/plain`,e.path)},onDragEnd:()=>{h(null),_(null)},onDropTargetChange:_},e.path))})}function Qi(e){let t=e.lastIndexOf(`/`);return t<0?``:e.slice(0,t)}function $i({node:e,depth:t,selectedPath:n,onSelect:r,onIntent:i,onRename:a,onDelete:o,onMove:s,actionsForEntry:c,trailingForEntry:l,defaultExpandedDepth:u,iconFor:d,labelFor:f,selectableFolders:p,draggedEntry:m,dropTargetPath:h,onDragStart:g,onDragEnd:_,onDropTargetChange:v}){let[y,b]=(0,D.useState)(t<u),T={name:e.name,path:e.path,isDirectory:e.isDirectory,...e.mtimeMs===void 0?{}:{mtimeMs:e.mtimeMs}},E=f(T),O=c?.(T)??[],k=l?.(T),A=!!(a||o||O.length>0),j=e.isDirectory&&e.children.length>0,M=!!(s&&!T.isDirectory),N=!!(s&&T.isDirectory&&m&&m.path!==T.path&&Qi(m.path)!==T.path),ne=m?.path===T.path,P=N&&h===T.path,re=(0,F.jsxs)(`div`,{className:`tree-row${n===e.path?` tree-row-selected`:``}${M?` tree-row-draggable`:``}${ne?` tree-row-dragging`:``}${P?` tree-row-drop-target`:``}`,style:{paddingLeft:`${t*12+2}px`},draggable:M,onPointerEnter:()=>i?.(T),onFocus:()=>i?.(T),onPointerDown:()=>i?.(T),onDragStart:e=>{M&&g(T,e)},onDragEnd:_,onDragEnter:e=>{N&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`,v(T.path))},onDragOver:e=>{N&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`,h!==T.path&&v(T.path))},onDragLeave:e=>{if(!P)return;let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||v(null)},onDrop:e=>{if(!N||!m||!s)return;e.preventDefault(),e.stopPropagation();let t=m;v(null),b(!0),_(),s(t,T)},children:[j?(0,F.jsx)(`button`,{type:`button`,className:`tree-toggle`,onClick:()=>b(!y),"aria-expanded":y,"aria-label":y?`Collapse ${E}`:`Expand ${E}`,children:(0,F.jsx)(`span`,{className:`tree-toggle-caret${y?` expanded`:``}`,"aria-hidden":`true`,children:(0,F.jsx)(`svg`,{width:14,height:14,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2.2,strokeLinecap:`round`,strokeLinejoin:`round`,focusable:`false`,"aria-hidden":`true`,children:(0,F.jsx)(`polyline`,{points:`9 6 15 12 9 18`})})})}):(0,F.jsx)(`span`,{className:`tree-toggle-spacer`}),(0,F.jsxs)(`button`,{type:`button`,className:`tree-label`,onClick:()=>{!e.isDirectory||p?r(T):b(!y)},children:[d(T),E]}),k&&(0,F.jsx)(`span`,{className:`tree-row-trailing`,children:k}),A&&(0,F.jsxs)(x,{children:[(0,F.jsx)(te,{asChild:!0,children:(0,F.jsx)(`button`,{type:`button`,className:`tree-actions-trigger`,"aria-label":`Actions for ${E}`,title:`Actions for ${E}`,children:(0,F.jsx)(`span`,{"aria-hidden":`true`,children:`⋯`})})}),(0,F.jsx)(ee,{children:(0,F.jsxs)(w,{className:`app-nav-menu tree-actions-menu`,sideOffset:4,align:`end`,children:[a&&(0,F.jsx)(S,{className:`app-nav-menu-item`,onSelect:()=>a(T),children:`Rename…`}),o&&(0,F.jsx)(S,{className:`app-nav-menu-item danger`,onSelect:()=>o(T),children:`Delete…`}),O.length>0&&(a||o)&&(0,F.jsx)(C,{className:`app-nav-menu-separator`}),O.map(e=>(0,F.jsx)(S,{className:`app-nav-menu-item`,disabled:e.disabled,onSelect:()=>void e.onSelect(T),children:e.label},e.label))]})})]})]});return(0,F.jsxs)(`div`,{children:[A?(0,F.jsxs)(Ci,{children:[(0,F.jsx)(wi,{asChild:!0,children:re}),(0,F.jsx)(Ti,{children:(0,F.jsxs)(Ei,{className:`app-nav-menu tree-actions-menu`,children:[a&&(0,F.jsx)(Di,{className:`app-nav-menu-item`,onSelect:()=>a(T),children:`Rename…`}),o&&(0,F.jsx)(Di,{className:`app-nav-menu-item danger`,onSelect:()=>o(T),children:`Delete…`}),O.length>0&&(a||o)&&(0,F.jsx)(Oi,{className:`app-nav-menu-separator`}),O.map(e=>(0,F.jsx)(Di,{className:`app-nav-menu-item`,disabled:e.disabled,onSelect:()=>void e.onSelect(T),children:e.label},e.label))]})})]}):re,j&&y&&(0,F.jsx)(`div`,{children:e.children.map(e=>(0,F.jsx)($i,{node:e,depth:t+1,selectedPath:n,onSelect:r,onIntent:i,onRename:a,onDelete:o,onMove:s,actionsForEntry:c,trailingForEntry:l,defaultExpandedDepth:u,iconFor:d,labelFor:f,selectableFolders:p,draggedEntry:m,dropTargetPath:h,onDragStart:g,onDragEnd:_,onDropTargetChange:v},e.path))})]})}function ea(e,t){return!t||!e.toLowerCase().endsWith(t.toLowerCase())?e:e.slice(0,-t.length)}function ta(e,t){let n=e?.replace(/[\\/]+$/,``);return n?`${n}/${t}`:t}function na({open:e,title:t,placeholder:n,submitLabel:r,onSubmit:i,onCancel:a,initialValue:o=``,suffix:u,parentPath:d,fieldLabel:f=`Path`,error:m}){let[g,_]=(0,D.useState)(()=>ea(o,u));(0,D.useEffect)(()=>{e&&_(ea(o,u))},[e,o,u]);let v=d!==void 0&&/[\\/]/.test(g)?`Enter a file name without folders.`:null,b=m??v;return(0,F.jsx)(c,{open:e,onOpenChange:e=>{e||a()},children:(0,F.jsxs)(y,{children:[(0,F.jsx)(l,{}),(0,F.jsx)(p,{children:(0,F.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),!(!g.trim()||v)&&i(ta(d,`${ea(g.trim(),u)}${u??``}`))},style:{display:`contents`},children:[(0,F.jsx)(h,{asChild:!0,children:(0,F.jsx)(`h3`,{children:t})}),(0,F.jsxs)(`label`,{children:[f,(0,F.jsxs)(`span`,{className:u?`new-path-input-row`:void 0,children:[(0,F.jsx)(`input`,{value:g,onChange:e=>_(ea(e.target.value,u)),placeholder:n}),u&&(0,F.jsx)(`span`,{className:`new-path-input-suffix`,"aria-hidden":`true`,children:u})]})]}),b&&(0,F.jsx)(`p`,{className:`gz-dialog-error`,role:`alert`,children:b}),(0,F.jsxs)(s,{children:[(0,F.jsx)(`button`,{type:`button`,onClick:a,children:`Cancel`}),(0,F.jsx)(`button`,{type:`submit`,className:`primary`,disabled:!g.trim()||v!==null,children:r})]})]})})]})})}function ra(e){let t=e.replace(/\\/g,`/`).replace(/^\/+/,``),n=t.lastIndexOf(`/`);return n===-1?t:t.slice(n+1)}function ia(e,t){return e?`${e.replace(/\/+$/,``)}/${t.replace(/^\/+/,``)}`:t}function aa(e){let t=ra(e);return!t.includes(`.`)||/\.(?:md|markdown|mdx)$/i.test(t)}function oa(e){let t=ra(e),n=t.lastIndexOf(`.`);return n>0?t.slice(0,n):t}function sa(e){let t=e.replace(/\\/g,`/`).replace(/^\/+/,``),n=t.lastIndexOf(`/`),r=n===-1?``:t.slice(0,n),i=ra(t),a=`${oa(i)}_files`;return{root:ia(r,a),parentDirectory:r,companionName:a,primaryDocumentFilename:i}}function ca(e){return aa(e)?sa(e).root:null}async function la(e,t,n,r){let i=r&&r.from!==r.to?r:null;i&&await e(i.from,i.to);try{await e(t,n)}catch(t){if(!i)throw t;try{await e(i.to,i.from)}catch(e){throw AggregateError([t,e],`Rename failed and the document companion could not be restored.`)}throw t}}export{qi as C,Ti as D,Di as E,Ci as O,Mi as S,Ei as T,Bi as _,la as a,Vi as b,Yi as c,Wi as d,ji as f,Fi as g,Ui as h,ca as i,wi as k,Ai as l,Ri as m,oa as n,na as o,ki as p,aa as r,Zi as s,sa as t,Gi as u,Ki as v,zi as w,Ni as x,Hi as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{s as t}from"./outside-in-D73N1g_b.js";var n=e({DROPPABLE_DOCUMENT_EXTENSIONS:()=>i,canDropDocumentFile:()=>f,importDroppedFiles:()=>m}),r=new Set([`md`,`markdown`,`mdx`,`txt`,`csv`,`json`,`yaml`,`yml`]),i=[...r,`html`,`htm`,`docx`,`pdf`,`pptx`,`xlsx`],a=new Set(i);function o(e){let t=e.lastIndexOf(`.`);return t>0?e.slice(t+1).toLocaleLowerCase(`en-US`):``}function s(e){return[...e].map(e=>{let t=e.charCodeAt(0);return e===`/`||e===`\\`||t<32?`-`:e}).join(``).trim()}function c(e,t){let n=e.replace(/^\/+|\/+$/g,``);return n?`${n}/${t}`:t}function l(e){let t=e.lastIndexOf(`.`);return t<=0?{stem:e,extension:``}:{stem:e.slice(0,t),extension:e.slice(t)}}function u(e,n,r){let{stem:i,extension:a}=l(n),o=c(e,n),s=2,u=e=>{if(r.has(e.toLocaleLowerCase(`en-US`)))return!0;let n=t(e);if(!n)return!1;let i=n.companionDirectory.toLocaleLowerCase(`en-US`);return[...r].some(e=>e===i||e.startsWith(`${i}/`))};for(;u(o);)o=c(e,`${i} ${s}${a}`),s+=1;r.add(o.toLocaleLowerCase(`en-US`));let d=t(o);return d&&r.add(d.companionDirectory.toLocaleLowerCase(`en-US`)),o}function d(e,t){if(t)return t;switch(o(e)){case`md`:case`markdown`:case`mdx`:return`text/markdown`;case`html`:case`htm`:return`text/html`;case`docx`:return`application/vnd.openxmlformats-officedocument.wordprocessingml.document`;case`pdf`:return`application/pdf`;case`pptx`:return`application/vnd.openxmlformats-officedocument.presentationml.presentation`;case`xlsx`:return`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`;default:return`application/octet-stream`}}function f(e){return a.has(o(e.name))}async function p(e,n,r){let i=t(r);if(!i)throw Error(`${n.name} is not a supported rendered document.`);return await e.writeBinary(i.targetPath,n,d(r,n.type)),[]}async function m(e){let n=e.destination?.replace(/^\/+|\/+$/g,``)??``,i=new Set(e.existingPaths.map(e=>e.toLocaleLowerCase(`en-US`))),a={importedPaths:[],warnings:[],rejected:[]};for(let c of e.files){let l=s(c.name);if(!l||!f({name:l})){a.rejected.push({name:c.name||`Unnamed file`,reason:`Unsupported document type`});continue}let d=u(n,l,i);try{if(t(d))a.warnings.push(...await p(e.target,c,d));else if(r.has(o(l)))await e.target.writeText(d,await c.text());else throw Error(`Unsupported document type`);a.importedPaths.push(d)}catch(e){a.rejected.push({name:c.name,reason:e instanceof Error?e.message:String(e)})}}return a}export{m as n,n as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{I as e}from"./doc-Dr5K49bx.js";import{l as t}from"./chunk-O7JILDEF-CqcO1qaI.js";import{O as n}from"./chunk-GAZKTT4R-BkP6-w3z.js";import{l as r}from"./markdown-ryKA_OmY.js";import"./schemas-JY4jmLbC.js";import"./chunk-7AWFHP5U-MiVVPFTx.js";import{B as i,E as a,F as o,H as s,I as c,J as l,L as u,M as d,Q as f,R as p,U as m,V as h,W as g,a as ee,at as _,c as te,et as ne,i as re,it as v,k as y,l as ie,n as ae,nt as b,o as oe,r as se,rt as x,s as ce,tt as S,u as le,z as ue}from"./chunk-S5PCVMKU-Df5XzhSE.js";import{a as de,n as C,t as w}from"./chunk-JU2RHXUB-ClblWDJZ.js";import{a as fe,i as T,n as pe,r as me,t as he}from"./chunk-A6N6IN3I-ofeM4l8g.js";import{t as ge}from"./chunk-B7GEAZBI-Divd2h1k.js";import{t as _e}from"./chunk-ILCJ3WFD-CLZxw4Ge.js";import{r as ve}from"./chunk-BXWNU4T5-CFA9w1DZ.js";import{t as ye}from"./chunk-IIQYS2YH-DKZhWMpn.js";import{a as be,i as xe,n as Se,r as Ce}from"./chunk-USU6HTKB-B_p-YcDp.js";var we={Heading1:1,Heading2:2,Heading3:3,Heading4:4,Heading5:5,Heading6:6,heading1:1,heading2:2,heading3:3,heading4:4,heading5:5,heading6:6,Title:1,Subtitle:2},Te={1:`Heading1`,2:`Heading2`,3:`Heading3`,4:`Heading4`,5:`Heading5`,6:`Heading6`},Ee=new Set([`Quote`,`IntenseQuote`,`quote`,`BlockQuote`]),De=new Set([`Code`,`CodeBlock`,`HTMLCode`,`PlainText`]),Oe=new Set([`CodeChar`,`HTMLCodeChar`,`VerbatimChar`]),ke=new Set([`bullet`,`none`]),Ae=`Calibri`,je=`Calibri Light`,E=22,D=`Consolas`,O=20,Me={1:32,2:26,3:24,4:22,5:22,6:22},Ne=`0563C1`;function Pe(e){return Math.round(e*20)}async function Fe(e,n={}){n.signal?.throwIfAborted();let r=n.themeId===void 0?{...n,themeId:t(e.frontmatter)}:n,i=new Le(r,e),a=Ie(e.children);i.setRelationshipSource(`document`);let o=A(a.body,i);i.setRelationshipSource(`header`);let s=A(a.header,i);i.setRelationshipSource(`footer`);let c=A(a.footer,i);return i.setRelationshipSource(`document`),st(o,s,c,i,r)}function Ie(e){let t={body:[],header:[],footer:[]};for(let n of e)n.type===`containerDirective`&&n.name===`docx-header`?t.header.push(...n.children):n.type===`containerDirective`&&n.name===`docx-footer`?t.footer.push(...n.children):t.body.push(n);return t}var Le=class{constructor(t,r){this.relIds=new he,this.nextNumId=1,this.nextFootnoteId=1,this.relationships=[],this.relationshipSource=`document`,this.numberingDefs=[],this.footnotes=new Map,this.footnoteIdMap=new Map,this.images=[],this.hasLists=!1,this.hasFootnotes=!1,this.iconFamilies=new Set,this.nextDocPrId=1;let i,a,o,s,c,l;if(t.themeId){let u=e(r,t.themeId,t.themeRegistry);i=Re(n(u.typography?.bodyFont,``)),a=Re(n(u.typography?.titleFont,``)),o=T(u.colors?.primary),s=T(u.colors?.text),c=T(u.colors?.textMuted),l=T(u.colors?.background)}this.font=t.defaultFont??i??Ae,this.headingFont=a??this.font,this.fontSize=t.defaultFontSize?t.defaultFontSize*2:E,this.headingColor=o,this.bodyColor=s,this.mutedColor=c,this.backgroundColor=l,this.resolvedImages=t.images??new Map,this.allowRelativeHyperlinks=t.allowRelativeHyperlinks??!1,this.signal=t.signal}allocRelId(){return this.allocRelIdFor(this.relationshipSource)}allocRelIdFor(e){return this.relIds.alloc(k(e))}setRelationshipSource(e){this.relationshipSource=e}addHyperlink(e){let t=fe(e,{allowRelative:this.allowRelativeHyperlinks});if(!t)return null;let n=this.allocRelId();return this.relationships.push({id:n,type:i,target:t,targetMode:`External`,source:this.relationshipSource}),n}addImage(e,t,n){let r=this.allocRelId(),i=this.nextDocPrId++,a=`word/media/${n}`;return this.images.push({relId:r,path:a,data:e,contentType:t}),this.relationships.push({id:r,type:h,target:`media/${n}`,source:this.relationshipSource}),{relId:r,docPrId:i}}allocNumbering(e){let t=this.nextNumId++;return this.numberingDefs.push({numId:t,ordered:e}),this.hasLists=!0,t}getFootnoteId(e){let t=this.footnoteIdMap.get(e);return t===void 0&&(t=this.nextFootnoteId++,this.footnoteIdMap.set(e,t),this.hasFootnotes=!0),t}};function k(e){return e===`header`?`word/header1.xml`:e===`footer`?`word/footer1.xml`:`word/document.xml`}function Re(e){if(!e)return``;let t=new Set([`sans-serif`,`serif`,`monospace`,`system-ui`,`cursive`,`fantasy`,`ui-serif`,`ui-sans-serif`,`ui-monospace`,`ui-rounded`,`inherit`,`initial`]);for(let n of e.split(`,`)){let e=n.trim().replace(/^["']|["']$/g,``);if(e&&!t.has(e.toLowerCase()))return e}return``}function A(e,t){let n=[];for(let r=0;r<e.length;r++){r&255||t.signal?.throwIfAborted();let i=e[r];n.push(j(i,t,0))}return n.join(``)}function j(e,t,n){switch(e.type){case`heading`:return ze(e,t);case`paragraph`:return Be(e,t);case`blockquote`:return Ve(e,t);case`list`:return He(e,t,n);case`code`:return We(e);case`table`:return Ge(e,t);case`thematicBreak`:return Je();case`htmlBlock`:return Ye(e);case`math`:return Xe(e);case`footnoteDefinition`:return Ze(e,t);case`containerDirective`:return A(e.children,t);default:return``}}function ze(e,t){let n=Te[e.depth]??`Heading1`,r=N(e.children,t);return`<w:p><w:pPr><w:pStyle w:val="${n}"/></w:pPr>`+r+`</w:p>`}function Be(e,t){return`<w:p>${N(e.children,t,M(t))}</w:p>`}function M(e){return e.bodyColor?{color:e.bodyColor}:{}}function Ve(e,t){let n=[];for(let r of e.children)if(r.type===`paragraph`){let e=t.mutedColor?{color:t.mutedColor}:M(t),i=N(r.children,t,e);n.push(`<w:p><w:pPr><w:pStyle w:val="Quote"/><w:ind w:left="${Pe(36)}"/><w:pBdr><w:left w:val="single" w:sz="12" w:space="4" w:color="CCCCCC"/></w:pBdr></w:pPr>`+i+`</w:p>`)}else n.push(j(r,t,0));return n.join(``)}function He(e,t,n){let r=t.allocNumbering(e.ordered??!1),i=[];for(let a of e.children)i.push(Ue(a,t,r,n));return i.join(``)}function Ue(e,t,n,r){let i=[];for(let a of e.children)if(a.type===`paragraph`){let e=N(a.children,t,M(t));i.push(`<w:p><w:pPr><w:pStyle w:val="ListParagraph"/><w:numPr><w:ilvl w:val="${r}"/><w:numId w:val="${n}"/></w:numPr></w:pPr>`+e+`</w:p>`)}else a.type===`list`?i.push(He(a,t,r+1)):i.push(j(a,t,r));return i.join(``)}function We(e){let t=e.value.split(`
|
|
2
|
+
`),n=[];for(let e of t)n.push(`<w:p><w:pPr><w:pStyle w:val="Code"/><w:pBdr><w:top w:val="single" w:sz="4" w:space="1" w:color="CCCCCC"/><w:left w:val="single" w:sz="4" w:space="4" w:color="CCCCCC"/><w:bottom w:val="single" w:sz="4" w:space="1" w:color="CCCCCC"/><w:right w:val="single" w:sz="4" w:space="4" w:color="CCCCCC"/></w:pBdr><w:shd w:val="clear" w:color="auto" w:fill="F5F5F5"/></w:pPr><w:r><w:rPr><w:rFonts w:ascii="${D}" w:hAnsi="${D}"/><w:sz w:val="${O}"/></w:rPr><w:t xml:space="preserve">${w(e)}</w:t></w:r></w:p>`);return n.join(``)}function Ge(e,t){let n=[];for(let r=0;r<e.children.length;r++){let i=e.children[r];n.push(Ke(i,t,r===0,e.align))}return`<w:tbl><w:tblPr><w:tblStyle w:val="TableGrid"/><w:tblW w:w="0" w:type="auto"/><w:tblBorders><w:top w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:left w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:bottom w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:right w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:insideH w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:insideV w:val="single" w:sz="4" w:space="0" w:color="auto"/></w:tblBorders></w:tblPr><w:tblGrid/>`+n.join(``)+`</w:tbl>`}function Ke(e,t,n,r){let i=[];for(let a=0;a<e.children.length;a++){let o=e.children[a],s=r?.[a]??null;i.push(qe(o,t,n,s))}return`<w:tr>${n?`<w:trPr><w:tblHeader/></w:trPr>`:``}${i.join(``)}</w:tr>`}function qe(e,t,n,r){let i=N(e.children,t,M(t)),a=n?`<w:rPr><w:b/></w:rPr>`:``,o=r?`<w:jc w:val="${{left:`left`,center:`center`,right:`right`}[r]}"/>`:``;return`<w:tc><w:p>${a||o?`<w:pPr>${o}</w:pPr>`:``}${i}</w:p></w:tc>`}function Je(){return`<w:p><w:pPr><w:pBdr><w:bottom w:val="single" w:sz="6" w:space="1" w:color="auto"/></w:pBdr></w:pPr></w:p>`}function Ye(e){let t=de(e.rawHtml);return t.trim()?`<w:p><w:r><w:t xml:space="preserve">${w(t)}</w:t></w:r></w:p>`:``}function Xe(e){return`<w:p><w:pPr><w:jc w:val="center"/></w:pPr><w:r><w:rPr><w:rFonts w:ascii="Cambria Math" w:hAnsi="Cambria Math"/><w:i/></w:rPr><w:t xml:space="preserve">${w(e.value)}</w:t></w:r></w:p>`}function Ze(e,t){let n=t.getFootnoteId(e.identifier),r=[];for(let n of e.children)if(n.type===`paragraph`){let e=N(n.children,t,M(t));r.push(`<w:p>${e}</w:p>`)}let i=`<w:footnote w:id="${n}">`+(r.length>0?r.join(``):`<w:p/>`)+`</w:footnote>`;return t.footnotes.set(n,i),``}function Qe(e){return{run:(e,t)=>P(e,t),link:(t,n)=>tt(t,e,n),image:t=>it(t,e),icon:(t,n)=>et(t,n,e),lineBreak:()=>`<w:r><w:br/></w:r>`,footnoteRef:t=>ot(t,e)}}function N(e,t,n={}){return me(e,Qe(t),n)}function $e(e,t,n){return pe(e,Qe(t),n)}function P(e,t){if(!e)return``;let n=[];return t.code&&n.push(`<w:rFonts w:ascii="${D}" w:hAnsi="${D}"/>`),t.bold&&n.push(`<w:b/>`),t.italic&&n.push(`<w:i/>`),t.strike&&n.push(`<w:strike/>`),t.color&&n.push(`<w:color w:val="${t.color}"/>`),t.code&&n.push(`<w:sz w:val="${O}"/>`),t.vertAlign&&n.push(`<w:vertAlign w:val="${t.vertAlign}"/>`),`<w:r>${n.length>0?`<w:rPr>${n.join(``)}</w:rPr>`:``}<w:t xml:space="preserve">${w(e)}</w:t></w:r>`}function et(e,t,n){let r=xe(e.family,e.name);if(!r)return P(`{[${e.token}]}`,t);let i=Se(e.family);n.iconFamilies.add(e.family);let a=w(i.typeface),o=[`<w:rFonts w:ascii="${a}" w:hAnsi="${a}" w:eastAsia="${a}" w:cs="${a}"/>`];return t.strike&&o.push(`<w:strike/>`),t.color&&o.push(`<w:color w:val="${t.color}"/>`),`<w:r><w:rPr>${o.join(``)}</w:rPr><w:t xml:space="preserve">${w(r)}</w:t></w:r>`}function tt(e,t,n){let r=t.addHyperlink(e.url);return r?`<w:hyperlink r:id="${r}">${nt(e.children,t,n)}</w:hyperlink>`:N(e.children,t,n)}function nt(e,t,n){let r=[];for(let i of e)i.type===`text`?r.push(rt(i.value,n)):r.push($e(i,t,n));return r.join(``)}function rt(e,t){if(!e)return``;let n=[`<w:rStyle w:val="Hyperlink"/>`];return t.bold&&n.push(`<w:b/>`),t.italic&&n.push(`<w:i/>`),n.push(`<w:color w:val="${Ne}"/>`,`<w:u w:val="single"/>`),`<w:r><w:rPr>${n.join(``)}</w:rPr><w:t xml:space="preserve">${w(e)}</w:t></w:r>`}function it(e,t){let n=t.resolvedImages.get(e.url);if(!n)return P(`[Image: ${e.alt||e.url}]`,{italic:!0});let{data:r,contentType:i}=n,a=i.split(`/`)[1]?.replace(`jpeg`,`jpg`)||`png`,o=`image${t.images.length+1}.${a}`,{relId:s,docPrId:c}=t.addImage(r,i,o),l=at(r),u=914400,d=6*u,f,p;if(l){let e=l.width/96*u,t=l.height/96*u;if(e>d){let n=d/e;f=d,p=Math.round(t*n)}else f=Math.round(e),p=Math.round(t)}else f=5*u,p=3*u;let m=w(e.alt||o),h=`http://schemas.openxmlformats.org/drawingml/2006/main`,g=`http://schemas.openxmlformats.org/drawingml/2006/picture`;return`<w:r><w:drawing><wp:inline distT="0" distB="0" distL="0" distR="0"><wp:extent cx="${f}" cy="${p}"/><wp:docPr id="${c}" name="${m}"/><wp:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a="${h}" noChangeAspect="1"/></wp:cNvGraphicFramePr><a:graphic xmlns:a="${h}"><a:graphicData uri="${g}"><pic:pic xmlns:pic="${g}"><pic:nvPicPr><pic:cNvPr id="0" name="${m}"/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip r:embed="${s}"/><a:stretch><a:fillRect/></a:stretch></pic:blipFill><pic:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${f}" cy="${p}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></pic:spPr></pic:pic></a:graphicData></a:graphic></wp:inline></w:drawing></w:r>`}function at(e){let t=e instanceof Uint8Array?e:new Uint8Array(e);if(t.length<24)return null;if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71)return{width:t[16]<<24|t[17]<<16|t[18]<<8|t[19],height:t[20]<<24|t[21]<<16|t[22]<<8|t[23]};if(t[0]===255&&t[1]===216){let e=2;for(;e<t.length-9&&t[e]===255;){let n=t[e+1];if(n===192||n===194){let n=t[e+5]<<8|t[e+6];return{width:t[e+7]<<8|t[e+8],height:n}}let r=t[e+2]<<8|t[e+3];e+=2+r}}return t[0]===71&&t[1]===73&&t[2]===70?{width:t[6]|t[7]<<8,height:t[8]|t[9]<<8}:null}function ot(e,t){return`<w:r><w:rPr><w:rStyle w:val="FootnoteReference"/><w:vertAlign w:val="superscript"/></w:rPr><w:footnoteReference w:id="${t.getFootnoteId(e.identifier)}"/></w:r>`}async function st(e,t,n,r,i){let a=_e(),d=Ce(r.iconFamilies),f=t.trim().length>0,h=n.trim().length>0,_=r.allocRelIdFor(`document`),ne=r.allocRelIdFor(`document`),v=r.allocRelIdFor(`document`),y=r.hasLists?r.allocRelIdFor(`document`):void 0,b=r.hasFootnotes?r.allocRelIdFor(`document`):void 0,x=f?r.allocRelIdFor(`document`):void 0,S=h?r.allocRelIdFor(`document`):void 0,de=ct(e,r.backgroundColor,x,S);a.addPart(`word/document.xml`,de,ae),f&&a.addPart(`word/header1.xml`,F(`header`,t),oe),h&&a.addPart(`word/footer1.xml`,F(`footer`,n),re);let C=lt(i,r);a.addPart(`word/styles.xml`,C,le);let w=dt(r.backgroundColor!==void 0);a.addPart(`word/settings.xml`,w,ie);let fe=ft(i,d);a.addPart(`word/fontTable.xml`,fe,se);for(let e=0;e<d.length;e++){let t=d[e],n=`${t.fileStem}.odttf`;a.addBinaryPart(`word/fonts/${n}`,be(t),te),a.addRelationship(`word/fontTable.xml`,{id:`rId${e+1}`,type:o,target:`fonts/${n}`})}if(r.hasLists){let e=pt(r);a.addPart(`word/numbering.xml`,e,ce)}if(r.hasFootnotes){let e=mt(r);a.addPart(`word/footnotes.xml`,e,ee)}a.addRelationship(``,{id:`rId1`,type:m,target:`word/document.xml`}),a.addRelationship(`word/document.xml`,{id:_,type:l,target:`styles.xml`}),a.addRelationship(`word/document.xml`,{id:ne,type:g,target:`settings.xml`}),a.addRelationship(`word/document.xml`,{id:v,type:c,target:`fontTable.xml`}),y&&a.addRelationship(`word/document.xml`,{id:y,type:s,target:`numbering.xml`}),b&&a.addRelationship(`word/document.xml`,{id:b,type:p,target:`footnotes.xml`}),x&&a.addRelationship(`word/document.xml`,{id:x,type:ue,target:`header1.xml`}),S&&a.addRelationship(`word/document.xml`,{id:S,type:u,target:`footer1.xml`});for(let e of r.relationships)a.addRelationship(k(e.source),{id:e.id,type:e.type,target:e.target,...e.targetMode?{targetMode:e.targetMode}:{}});for(let e of r.images)a.addBinaryPart(e.path,e.data,e.contentType);return(i.title||i.author||i.description)&&a.setCoreProperties({title:i.title,creator:i.author,description:i.description,created:new Date().toISOString(),modified:new Date().toISOString()}),a.toArrayBuffer()}function ct(e,t,n,r){let i=t?`<w:background w:color="${t}"/>`:``,o=(n?`<w:headerReference w:type="default" r:id="${n}"/>`:``)+(r?`<w:footerReference w:type="default" r:id="${r}"/>`:``);return C()+`<w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mc="${a}" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="${y}" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="${d}" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml">`+i+`<w:body>`+e+`<w:sectPr>`+o+`<w:pgSz w:w="12240" w:h="15840"/><w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0"/><w:cols w:space="720"/></w:sectPr></w:body></w:document>`}function F(e,t){let n=e===`header`?`hdr`:`ftr`;return C()+`<w:${n} xmlns:w="${d}" xmlns:r="${y}" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing">`+t+`</w:${n}>`}function lt(e,t){let n=t.font,r=t.headingFont,i=t.bodyColor?`<w:color w:val="${t.bodyColor}"/>`:``,a=t.mutedColor??`404040`;return C()+`<w:styles xmlns:w="${d}"><w:docDefaults><w:rPrDefault><w:rPr><w:rFonts w:ascii="${w(n)}" w:hAnsi="${w(n)}" w:eastAsia="${w(n)}" w:cs="${w(n)}"/>`+i+`<w:sz w:val="${E}"/><w:szCs w:val="${E}"/></w:rPr></w:rPrDefault><w:pPrDefault/></w:docDefaults><w:style w:type="paragraph" w:default="1" w:styleId="Normal"><w:name w:val="Normal"/><w:qFormat/>`+(i?`<w:rPr>${i}</w:rPr>`:``)+`</w:style>`+ut(r,t.headingColor)+`<w:style w:type="paragraph" w:styleId="Quote"><w:name w:val="Quote"/><w:basedOn w:val="Normal"/><w:pPr><w:ind w:left="720"/></w:pPr><w:rPr><w:i/><w:color w:val="${a}"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Code"><w:name w:val="Code"/><w:basedOn w:val="Normal"/><w:rPr><w:rFonts w:ascii="${D}" w:hAnsi="${D}"/><w:sz w:val="${O}"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="ListParagraph"><w:name w:val="List Paragraph"/><w:basedOn w:val="Normal"/><w:pPr><w:ind w:left="720"/></w:pPr></w:style><w:style w:type="character" w:styleId="Hyperlink"><w:name w:val="Hyperlink"/><w:rPr><w:color w:val="${Ne}"/><w:u w:val="single"/></w:rPr></w:style><w:style w:type="character" w:styleId="FootnoteReference"><w:name w:val="footnote reference"/><w:rPr><w:vertAlign w:val="superscript"/></w:rPr></w:style><w:style w:type="table" w:styleId="TableGrid"><w:name w:val="Table Grid"/><w:tblPr><w:tblBorders><w:top w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:left w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:bottom w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:right w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:insideH w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:insideV w:val="single" w:sz="4" w:space="0" w:color="auto"/></w:tblBorders></w:tblPr></w:style></w:styles>`}function ut(e,t){let n=``;for(let r=1;r<=6;r++){let i=Te[r],a=Me[r]??22,o=t?`<w:color w:val="${t}"/>`:``;n+=`<w:style w:type="paragraph" w:styleId="${i}"><w:name w:val="heading ${r}"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:qFormat/><w:pPr><w:outlineLvl w:val="${r-1}"/><w:spacing w:before="240" w:after="60"/></w:pPr><w:rPr><w:rFonts w:ascii="${w(e)}" w:hAnsi="${w(e)}"/><w:b/>`+o+`<w:sz w:val="${a}"/><w:szCs w:val="${a}"/></w:rPr></w:style>`}return n}function dt(e){return C()+`<w:settings xmlns:w="${d}">`+(e?`<w:displayBackgroundShape/>`:``)+`<w:defaultTabStop w:val="720"/><w:characterSpacingControl w:val="doNotCompress"/><w:compat><w:compatSetting w:name="compatibilityMode" w:uri="http://schemas.microsoft.com/office/word" w:val="15"/><w:compatSetting w:name="overrideTableStyleFontSizeAndJustification" w:uri="http://schemas.microsoft.com/office/word" w:val="1"/><w:compatSetting w:name="enableOpenTypeFeatures" w:uri="http://schemas.microsoft.com/office/word" w:val="1"/><w:compatSetting w:name="doNotFlipMirrorIndents" w:uri="http://schemas.microsoft.com/office/word" w:val="1"/><w:compatSetting w:name="differentiateMultirowTableHeaders" w:uri="http://schemas.microsoft.com/office/word" w:val="1"/></w:compat></w:settings>`}function ft(e,t){let n=e.defaultFont??Ae,r=t.map((e,t)=>`<w:font w:name="${w(e.typeface)}"><w:charset w:val="00"/><w:family w:val="decorative"/><w:pitch w:val="variable"/><w:embedRegular r:id="rId${t+1}" w:fontKey="{${e.docxFontKey}}"/></w:font>`).join(``);return C()+`<w:fonts xmlns:w="${d}" xmlns:r="${y}"><w:font w:name="${w(n)}"><w:panose1 w:val="020F0502020204030204"/><w:charset w:val="00"/><w:family w:val="swiss"/><w:pitch w:val="variable"/></w:font><w:font w:name="${je}"><w:panose1 w:val="020F0302020204030204"/><w:charset w:val="00"/><w:family w:val="swiss"/><w:pitch w:val="variable"/></w:font><w:font w:name="${D}"><w:charset w:val="00"/><w:family w:val="modern"/><w:pitch w:val="fixed"/></w:font>`+r+`</w:fonts>`}function pt(e){let t=[],n=[];for(let r of e.numberingDefs){let e=r.numId,i=[];for(let e=0;e<9;e++)if(r.ordered)i.push(`<w:lvl w:ilvl="${e}"><w:start w:val="1"/><w:numFmt w:val="decimal"/><w:lvlText w:val="%${e+1}."/><w:lvlJc w:val="left"/><w:pPr><w:ind w:left="${720*(e+1)}" w:hanging="360"/></w:pPr></w:lvl>`);else{let t=[`•`,`◦`,`▪`],n=t[e%t.length];i.push(`<w:lvl w:ilvl="${e}"><w:start w:val="1"/><w:numFmt w:val="bullet"/><w:lvlText w:val="${n}"/><w:lvlJc w:val="left"/><w:pPr><w:ind w:left="${720*(e+1)}" w:hanging="360"/></w:pPr></w:lvl>`)}t.push(`<w:abstractNum w:abstractNumId="${e}">`+i.join(``)+`</w:abstractNum>`),n.push(`<w:num w:numId="${r.numId}"><w:abstractNumId w:val="${e}"/></w:num>`)}return C()+`<w:numbering xmlns:w="${d}">`+t.join(``)+n.join(``)+`</w:numbering>`}function mt(e){let t=[];t.push(`<w:footnote w:type="separator" w:id="-1"><w:p><w:r><w:separator/></w:r></w:p></w:footnote>`),t.push(`<w:footnote w:type="continuationSeparator" w:id="0"><w:p><w:r><w:continuationSeparator/></w:r></w:p></w:footnote>`);for(let[n,r]of e.footnotes)t.push(r);return C()+`<w:footnotes xmlns:w="${d}" xmlns:r="${y}">`+t.join(``)+`</w:footnotes>`}var I=`word/document.xml`;async function ht(e,t={}){let n=await x(e,t),r=v(n,I,`DOCX`),i=await _t(n,t,r),a=await b(n,r);if(!a)throw Error(`Invalid DOCX package: main document part "${r}" could not be parsed.`);let o=Lt(a,`body`);if(!o)return{type:`document`,children:[]};let s={type:`document`,children:await L(o,i)};return ve(s),s}async function gt(e,t={}){let n=await x(e,t),i=v(n,I,`DOCX`),a=await _t(n,{...t,extractImages:!0},i),o=await b(n,i);if(!o)throw Error(`Invalid DOCX package: main document part "${i}" could not be parsed.`);let s=Lt(o,`body`);return s?ye(r({type:`document`,children:await L(s,a)}),a.extractedImages):ye(``,[])}async function _t(e,t,n=I){let r={headingStyles:new Map,quoteStyles:new Set,codeStyles:new Set,inlineCodeStyles:new Set,documentRels:new Map,numbering:new Map,footnotes:new Map,endnotes:new Map,currentPartPath:n,mainPartPath:n,pkg:e,options:t,extractedImages:new Map,imageCounter:0};for(let[e,t]of Object.entries(we))r.headingStyles.set(e,t);for(let e of Ee)r.quoteStyles.add(e);for(let e of De)r.codeStyles.add(e);for(let e of Oe)r.inlineCodeStyles.add(e);await vt(e,r);let i=await S(e,n);for(let e of i)r.documentRels.set(e.id,e);return await yt(e,r),await bt(e,r),await xt(e,r),r}async function vt(e,t){let n=await b(e,`word/styles.xml`);if(!n)return;let r=n.getElementsByTagNameNS(d,`style`),i=r.length>0?r:n.getElementsByTagName(`style`);for(let e=0;e<i.length;e++){let n=i[e],r=n.getAttributeNS(`http://schemas.openxmlformats.org/wordprocessingml/2006/main`,`styleId`)??n.getAttribute(`w:styleId`);if(!r)continue;let a=J(n,`name`),o=(a?.getAttributeNS(`http://schemas.openxmlformats.org/wordprocessingml/2006/main`,`val`)??a?.getAttribute(`w:val`)??``).match(/^heading\s+(\d+)$/i);if(o){let e=parseInt(o[1],10);e>=1&&e<=6&&t.headingStyles.set(r,e)}let s=J(n,`pPr`);if(s){let e=J(s,`outlineLvl`);if(e){let n=e.getAttributeNS(`http://schemas.openxmlformats.org/wordprocessingml/2006/main`,`val`)??e.getAttribute(`w:val`);if(n!==null){let e=parseInt(n,10)+1;e>=1&&e<=6&&t.headingStyles.set(r,e)}}}}}async function yt(e,t){let n=await b(e,`word/numbering.xml`);if(!n)return;let r=new Map,i=X(n,`abstractNum`);for(let e of i){let t=Z(e,`abstractNumId`);if(!t)continue;let n=new Map,i=Y(e,`lvl`);for(let e of i){let t=Z(e,`ilvl`);if(t===null)continue;let r=parseInt(t,10),i=J(e,`numFmt`),a=i?Z(i,`val`):null,o=a!==null&&!ke.has(a);n.set(r,o)}r.set(t,n)}let a=X(n,`num`);for(let e of a){let n=Z(e,`numId`);if(!n)continue;let i=J(e,`abstractNumId`),a=i?Z(i,`val`):null;if(!a)continue;let o=r.get(a);o&&t.numbering.set(n,{levels:o})}}async function bt(e,t){let n=await b(e,`word/footnotes.xml`);if(!n)return;let r=X(n,`footnote`);for(let e of r){let n=Z(e,`id`),r=Z(e,`type`);!n||r===`separator`||r===`continuationSeparator`||t.footnotes.set(n,e)}}async function xt(e,t){let n=await b(e,`word/endnotes.xml`);if(!n)return;let r=X(n,`endnote`);for(let e of r){let n=Z(e,`id`),r=Z(e,`type`);!n||r===`separator`||r===`continuationSeparator`||t.endnotes.set(n,e)}}async function L(e,t){let n=await z(e,t),r=await R(e,t,`header`),i=await R(e,t,`footer`),a=await Ft(t);return[...n,...r,...i,...a]}async function R(e,t,n){let r=`/${n}`,i=`${n}Reference`,a=new Map;for(let t of X(e,i)){let e=t.getAttributeNS(`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,`id`)??t.getAttribute(`r:id`);e&&a.set(e,Z(t,`type`)??`default`)}let o=t.documentRels,s=t.currentPartPath,c=[];for(let e of o.values()){if(!e.type.endsWith(r))continue;let i=_(f(t.mainPartPath),e.target),l=await b(t.pkg,i);if(!l?.documentElement)continue;let u=await S(t.pkg,i);t.documentRels=new Map(u.map(e=>[e.id,e])),t.currentPartPath=i;try{let r=await z(l.documentElement,t);if(r.length===0)continue;c.push({type:`containerDirective`,name:`docx-${n}`,attributes:{type:a.get(e.id)??`default`,source:i},children:r})}finally{t.documentRels=o,t.currentPartPath=s}}return c}async function z(e,t){return B(Array.from(e.children),t)}async function B(e,t){let n=[],r=0;for(;r<e.length;){let i=e[r],a=i.localName;if(a===`p`){if(q(i)){let{node:i,consumed:a}=await At(e,r,t);n.push(i),r+=a;continue}let a=await St(i,t);a&&n.push(a),r++}else if(a===`tbl`){let e=await Mt(i,t);e&&n.push(e),r++}else if(a===`sdt`){let e=J(i,`sdtContent`);e&&n.push(...await B(Array.from(e.children),t)),r++}else if(a===`ins`||a===`moveTo`||a===`customXml`||a===`smartTag`||a===`fldSimple`)n.push(...await B(Array.from(i.children),t)),r++;else if(a===`AlternateContent`){let e=J(i,`Choice`)??J(i,`Fallback`);e&&n.push(...await B(Array.from(e.children),t)),r++}else r++}return n}async function St(e,t){let n=Rt(J(e,`pPr`));if(n&&t.headingStyles.has(n)){let r=t.headingStyles.get(n),i=await V(e,t);return i.length===0?null:{type:`heading`,depth:Math.min(Math.max(r,1),6),children:i}}if(n&&t.quoteStyles.has(n)){let n=await V(e,t);return n.length===0?null:{type:`blockquote`,children:[{type:`paragraph`,children:n}]}}if(n&&t.codeStyles.has(n))return{type:`code`,value:zt(e)};let r=await V(e,t);return r.length===0?null:{type:`paragraph`,children:r}}async function V(e,t){return Vt(await H(Array.from(e.children),t))}async function H(e,t){let n=[];for(let r of e){let e=r.localName;if(e===`r`){let e=await Ct(r,t);n.push(...e)}else if(e===`hyperlink`){let e=await Dt(r,t);e&&n.push(e)}else if(e===`sdt`){let e=J(r,`sdtContent`);e&&n.push(...await H(Array.from(e.children),t))}else if(e===`ins`||e===`moveTo`||e===`customXml`||e===`smartTag`||e===`fldSimple`)n.push(...await H(Array.from(r.children),t));else if(e===`AlternateContent`){let e=J(r,`Choice`)??J(r,`Fallback`);e&&n.push(...await H(Array.from(e.children),t))}else(e===`drawing`||e===`pict`)&&n.push(...await wt(r,t))}return n}async function Ct(e,t){let n=[],r=Et(J(e,`rPr`),t);for(let i of Array.from(e.children)){let e=i.localName;if(e===`t`){let e=i.textContent??``;if(!e)continue;if(r.code)n.push({type:`inlineCode`,value:e});else{let t={type:`text`,value:e};r.vertAlign&&(t=r.vertAlign===`superscript`?{type:`superscript`,children:[t]}:{type:`subscript`,children:[t]}),r.strike&&(t={type:`delete`,children:[t]}),r.italic&&(t={type:`emphasis`,children:[t]}),r.bold&&(t={type:`strong`,children:[t]}),n.push(t)}}else if(e===`br`||e===`cr`)n.push({type:`break`});else if(e===`tab`)n.push({type:`text`,value:` `});else if(e===`footnoteReference`){let e=Z(i,`id`);e&&e!==`0`&&e!==`-1`&&n.push({type:`footnoteReference`,identifier:`fn${e}`})}else if(e===`endnoteReference`){let e=Z(i,`id`);e&&e!==`0`&&e!==`-1`&&n.push({type:`footnoteReference`,identifier:`endnote${e}`})}else if(e===`drawing`||e===`pict`||e===`object`)n.push(...await wt(i,t));else if(e===`AlternateContent`){let e=J(i,`Choice`)??J(i,`Fallback`);e&&n.push(...await H(Array.from(e.children),t))}}return n}async function wt(e,t){let n=[],r=kt(e,`txbxContent`);for(let e of r)W(n,await U(e,t));let i=await Ot(e,t);return i&&n.push(i),r.length>0&&n.length>0&&(n[0]?.type!==`break`&&n.unshift({type:`break`}),n[n.length-1]?.type!==`break`&&n.push({type:`break`})),n}async function U(e,t){let n=[];for(let r of Array.from(e.children))if(r.localName===`p`)W(n,await V(r,t));else if(r.localName===`tbl`)W(n,await Tt(r,t));else if(r.localName===`sdt`){let e=J(r,`sdtContent`);e&&W(n,await U(e,t))}else if(r.localName===`ins`||r.localName===`moveTo`||r.localName===`customXml`||r.localName===`smartTag`||r.localName===`fldSimple`)W(n,await U(r,t));else if(r.localName===`AlternateContent`){let e=J(r,`Choice`)??J(r,`Fallback`);e&&W(n,await U(e,t))}else(r.localName===`r`||r.localName===`hyperlink`)&&W(n,await H([r],t));return $(n)}async function Tt(e,t){let n=[];for(let r of Y(e,`tr`))for(let e of Y(r,`tc`))W(n,await U(e,t));return $(n)}function W(e,t){t.length!==0&&(e.length>0&&e[e.length-1]?.type!==`break`&&e.push({type:`break`}),e.push(...t))}function Et(e,t){if(!e)return{bold:!1,italic:!1,strike:!1,code:!1,vertAlign:null};let n=Q(e,`b`)&&!G(J(e,`b`)),r=Q(e,`i`)&&!G(J(e,`i`)),i=Q(e,`strike`)&&!G(J(e,`strike`)),a=J(e,`rStyle`),o=a?Z(a,`val`):null,s=o?t.inlineCodeStyles.has(o):!1,c=J(e,`rFonts`),l=c?Z(c,`ascii`)??Z(c,`hAnsi`)??``:``,u=/consolas|courier|mono/i.test(l),d=J(e,`vertAlign`),f=d?Z(d,`val`):null;return{bold:n,italic:r,strike:i,code:s||u,vertAlign:f===`superscript`||f===`subscript`?f:null}}function G(e){let t=Z(e,`val`);return t===`0`||t===`false`}async function Dt(e,t){let n=e.getAttributeNS(`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,`id`)??e.getAttribute(`r:id`),r=``;if(n){let e=t.documentRels.get(n);e&&(r=e.target)}if(!r){let t=e.getAttributeNS(`http://schemas.openxmlformats.org/wordprocessingml/2006/main`,`anchor`)??e.getAttribute(`w:anchor`);t&&(r=`#${t}`)}let i=await H(Array.from(e.children),t);return i.length===0?null:{type:`link`,url:r,children:$(i)}}async function Ot(e,t){let n=K(e,`blip`),r=K(e,`imagedata`),i=n?n.getAttributeNS(`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,`embed`)??n.getAttribute(`r:embed`):r?.getAttributeNS(`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,`id`)??r?.getAttribute(`r:id`)??r?.getAttribute(`o:relid`);if(!i)return null;let a=t.documentRels.get(i);if(!a||a.targetMode===`External`)return null;let o=_(f(t.currentPartPath),a.target),s=await ne(t.pkg,o);if(!s)return null;let c=o.lastIndexOf(`.`),l=c===-1?`.png`:o.slice(c).toLowerCase(),u=ge(l);t.imageCounter++;let d=`images/image${t.imageCounter}${l}`;t.extractedImages.set(d,{data:s,mimeType:u});let p=K(e,`docPr`),m=K(e,`shape`);return{type:`image`,url:d,alt:p?.getAttribute(`descr`)||p?.getAttribute(`title`)||m?.getAttribute(`alt`)||m?.getAttribute(`title`)||`Image`}}function K(e,t){for(let n of Array.from(e.children)){if(n.localName===t)return n;let e=K(n,t);if(e)return e}return null}function kt(e,t){let n=[];for(let r of Array.from(e.children))r.localName===t&&n.push(r),n.push(...kt(r,t));return n}async function At(e,t,n){let r=q(e[t]),{numId:i}=r,a=n.numbering.get(i),o=a?.levels.get(0)??!1,s=[],c=0,l=t;for(;l<e.length;){let t=e[l];if(t.localName!==`p`)break;let o=q(t);if(!o||o.numId!==i)break;let u=await V(t,n);if(u.length>0){let t={type:`paragraph`,children:u};if(o.ilvl>r.ilvl){let t=await jt(e,l,n,r.ilvl);if(s.length>0){let e=s[s.length-1],n={type:`list`,ordered:a?.levels.get(o.ilvl)??!1,children:t.items};e.children.push(n)}else s.push(...t.items);l+=t.consumed,c+=t.consumed;continue}s.push({type:`listItem`,children:[t]})}l++,c++}return{node:{type:`list`,ordered:o,children:s},consumed:c}}async function jt(e,t,n,r){let i=[],a=0,o=t;for(;o<e.length;){let t=e[o];if(t.localName!==`p`)break;let s=q(t);if(!s||s.ilvl<=r)break;let c=await V(t,n);if(c.length>0){let e={type:`paragraph`,children:c};i.push({type:`listItem`,children:[e]})}o++,a++}return{items:i,consumed:a}}function q(e){let t=J(e,`pPr`);if(!t)return null;let n=J(t,`numPr`);if(!n)return null;let r=J(n,`ilvl`),i=J(n,`numId`),a=r?Z(r,`val`):null,o=i?Z(i,`val`):null;return!o||o===`0`?null:{numId:o,ilvl:a?parseInt(a,10):0}}async function Mt(e,t){let n=[],r=Y(e,`tr`);for(let e=0;e<r.length;e++){let i=await Nt(r[e],t,e===0);n.push(i)}return n.length===0?null:{type:`table`,children:n}}async function Nt(e,t,n){let r=[],i=Y(e,`tc`);for(let e of i){let i=await Pt(e,t,n);r.push(i)}return{type:`tableRow`,children:r}}async function Pt(e,t,n){return{type:`tableCell`,isHeader:n,children:$(await U(e,t))}}async function Ft(e){return[...await It(e,e.footnotes,`fn`,`word/footnotes.xml`),...await It(e,e.endnotes,`endnote`,`word/endnotes.xml`)]}async function It(e,t,n,r){let i=[],a=e.documentRels,o=e.currentPartPath,s=await S(e.pkg,r);e.documentRels=new Map(s.map(e=>[e.id,e])),e.currentPartPath=r;try{for(let[r,a]of t){let t=await z(a,e);t.length>0&&i.push({type:`footnoteDefinition`,identifier:`${n}${r}`,children:t})}}finally{e.documentRels=a,e.currentPartPath=o}return i}function J(e,t){for(let n of Array.from(e.children??[]))if(n.localName===t)return n;return null}function Y(e,t){let n=[];for(let r of Array.from(e.children))r.localName===t&&n.push(r);return n}function X(e,t){let n=`getElementsByTagNameNS`in e?e.getElementsByTagNameNS(d,t):null;if(n&&n.length>0)return Array.from(n);let r=e.getElementsByTagName(`w:${t}`);return r.length>0?Array.from(r):Array.from(e.getElementsByTagName(t))}function Lt(e,t){let n=X(e,t);return n.length>0?n[0]:null}function Z(e,t){return e.getAttributeNS(`http://schemas.openxmlformats.org/wordprocessingml/2006/main`,t)||e.getAttribute(`w:${t}`)||null}function Q(e,t){return J(e,t)!==null}function Rt(e){if(!e)return null;let t=J(e,`pStyle`);return t?Z(t,`val`):null}function zt(e){let t=[];function n(e){e.localName===`t`&&t.push(e.textContent??``);for(let t of Array.from(e.children))n(t)}return n(e),t.join(``)}function $(e){if(e.length<=1)return e;let t=[];for(let n of e){let e=t[t.length-1];n.type===`text`&&e?.type===`text`?e.value+=n.value:t.push(n)}return t}function Bt(e){return e.type===`emphasis`||e.type===`strong`||e.type===`delete`||e.type===`superscript`||e.type===`subscript`||e.type===`link`}function Vt(e){let t=[],n=[],r=()=>{let e=Ht(n);Ut(e),Wt(e),t.push(...$(e)),n=[]};for(let i of e)i.type===`break`?(r(),t.push(i)):n.push(i);return r(),t}function Ht(e){let t=[];for(let n of e){if(!Bt(n)){t.push(n);continue}let e=Ht(n.children),r=Ut(e),i=Wt(e);r&&t.push({type:`text`,value:r}),e.length>0&&t.push({...n,children:e}),i&&t.push({type:`text`,value:i})}return $(t)}function Ut(e){let t=e[0];if(t?.type!==`text`)return``;let n=/^[\t ]+/.exec(t.value);return n?(t.value=t.value.slice(n[0].length),t.value||e.shift(),n[0]):``}function Wt(e){let t=e[e.length-1];if(t?.type!==`text`)return``;let n=/[\t ]+$/.exec(t.value);return n?(t.value=t.value.slice(0,-n[0].length),t.value||e.pop(),n[0]):``}export{gt as docxToContainer,ht as docxToMarkdownDoc,Fe as markdownDocToDocx};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{I as t}from"./doc-Dr5K49bx.js";import{l as n}from"./chunk-O7JILDEF-CqcO1qaI.js";import{O as r}from"./chunk-GAZKTT4R-BkP6-w3z.js";import{I as i}from"./chunk-UBFT2CDQ-FexGDigd.js";import"./markdown-ryKA_OmY.js";import"./schemas-JY4jmLbC.js";import{t as a}from"./jszip.min-DhiFe-R7.js";import{r as o,t as s}from"./chunk-JU2RHXUB-ClblWDJZ.js";import{n as c,t as l}from"./chunk-BXWNU4T5-CFA9w1DZ.js";import{i as u,r as d,t as f}from"./chunk-USU6HTKB-B_p-YcDp.js";import{n as p,r as m}from"./chunk-VPWPEMZJ-DRKoa_j0.js";var h=e(a(),1);async function g(e,t={}){t.signal?.throwIfAborted();let r=e.frontmatter?.title,i=e.frontmatter?.author,a=t.title??(typeof r==`string`?r:`Untitled`),o=t.author??(typeof i==`string`?i:``),c=t.language??`en`,u=t.description??``,p=t.publisher??``,g=O(),v=d(f(e)),x=_(e.children),C=new l(e),w=new Set;b(e.children,w);let T=C.ordered().filter(e=>e.definition&&!w.has(e.identifier)).map(e=>e.identifier),E=y(e.children),D=new Map,A=new Set;if(t.images){let e=0;for(let n of E){e++&63||t.signal?.throwIfAborted();let r=t.images.get(n);if(r){let e=j(k(n,`image`),A);A.add(e),D.set(n,{data:r,mime:m(e),filename:e})}}}let N=L(t.themeId??n(e.frontmatter),e,t.themeRegistry,v),R=new h.default;R.file(`mimetype`,`application/epub+zip`,{compression:`STORE`}),R.file(`META-INF/container.xml`,P),R.file(`OEBPS/styles.css`,N);for(let e of v)R.file(`OEBPS/fonts/${e.fileStem}.otf`,e.data);for(let[,e]of D)t.signal?.throwIfAborted(),R.file(`OEBPS/images/${e.filename}`,e.data);let z;if(t.coverImage){let e=new Uint8Array(t.coverImage);z=j(e.length>=4&&e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71?`cover.png`:`cover.jpg`,A),A.add(z),R.file(`OEBPS/images/${z}`,t.coverImage);let n=`<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<!DOCTYPE html>
|
|
3
3
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
|
|
4
4
|
<head>
|
|
@@ -12,10 +12,10 @@ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{N as t}from"./doc-s6H7
|
|
|
12
12
|
<body>
|
|
13
13
|
<img src="../images/${s(z)}" alt="Cover"/>
|
|
14
14
|
</body>
|
|
15
|
-
</html>`;R.file(`OEBPS/chapters/cover.xhtml`,n)}let B=t.audio,V=t.audioSegments,H=B&&V&&V.length>0,U=[],W=[],G=new Map,K=new Set;if(H)for(let e of V){let t=B.get(e.src)??B.get(e.name);if(t){let n=e.src||e.name,r=G.get(n),i=!1;if(!r){let e=k(n||`narration`,`narration`);r=j(e.includes(`.`)?e:`${e}.mp3`,K),G.set(n,r),K.add(r),R.file(`OEBPS/audio/${r}`,t),i=!0}let a={filename:r,mime:m(r)};U.push(a),i&&W.push(a)}else U.push(null)}let q=[];if(H&&W.length>0){x.length!==V.length&&console.warn(`EPUB: ${x.length} chapters but ${V.length} audio segments \u2014 extra chapters will reuse the last segment's audio`);for(let e=0;e<x.length;e++){let t=Math.min(e,V.length-1),n=V[t],r=U[t];r?q.push({audioFilename:r.filename,clipStart:0,clipEnd:n.duration,duration:n.duration}):q.push(null)}}let J=[];for(let e=0;e<x.length;e++){let t=x[e],n=`chapter-${String(e+1).padStart(3,`0`)}`,r=`${n}.xhtml`,i=q[e]??null,o=e===x.length-1,{xhtml:s,ids:c}=S(t.nodes,a,D,i!==null,C,o?T:[]);R.file(`OEBPS/chapters/${r}`,s);let l;if(i){l=`${n}.smil`;let e=M(r,i,c);R.file(`OEBPS/chapters/${l}`,e)}J.push({id:n,filename:r,title:t.title,smilFilename:l,duration:i?.duration})}return R.file(`OEBPS/toc.xhtml`,I(J,a)),R.file(`OEBPS/content.opf`,F({uuid:g,title:a,author:o,language:c,description:
|
|
15
|
+
</html>`;R.file(`OEBPS/chapters/cover.xhtml`,n)}let B=t.audio,V=t.audioSegments,H=B&&V&&V.length>0,U=[],W=[],G=new Map,K=new Set;if(H)for(let e of V){let t=B.get(e.src)??B.get(e.name);if(t){let n=e.src||e.name,r=G.get(n),i=!1;if(!r){let e=k(n||`narration`,`narration`);r=j(e.includes(`.`)?e:`${e}.mp3`,K),G.set(n,r),K.add(r),R.file(`OEBPS/audio/${r}`,t),i=!0}let a={filename:r,mime:m(r)};U.push(a),i&&W.push(a)}else U.push(null)}let q=[];if(H&&W.length>0){x.length!==V.length&&console.warn(`EPUB: ${x.length} chapters but ${V.length} audio segments \u2014 extra chapters will reuse the last segment's audio`);for(let e=0;e<x.length;e++){let t=Math.min(e,V.length-1),n=V[t],r=U[t];r?q.push({audioFilename:r.filename,clipStart:0,clipEnd:n.duration,duration:n.duration}):q.push(null)}}let J=[];for(let e=0;e<x.length;e++){let t=x[e],n=`chapter-${String(e+1).padStart(3,`0`)}`,r=`${n}.xhtml`,i=q[e]??null,o=e===x.length-1,{xhtml:s,ids:c}=S(t.nodes,a,D,i!==null,C,o?T:[]);R.file(`OEBPS/chapters/${r}`,s);let l;if(i){l=`${n}.smil`;let e=M(r,i,c);R.file(`OEBPS/chapters/${l}`,e)}J.push({id:n,filename:r,title:t.title,smilFilename:l,duration:i?.duration})}return R.file(`OEBPS/toc.xhtml`,I(J,a)),R.file(`OEBPS/content.opf`,F({uuid:g,title:a,author:o,language:c,description:u,publisher:p,chapters:J,images:D,coverFilename:z,audioFiles:W,totalDuration:t.totalDuration,iconFonts:v})),await R.generateAsync({type:`arraybuffer`,compression:`DEFLATE`,compressionOptions:{level:6}})}function _(e){let t=[],n=[],r=`Untitled`;for(let i of e)i.type===`heading`&&i.depth<=2?(n.length>0&&t.push({title:r,nodes:n}),r=v(i),n=[i]):n.push(i);return n.length>0&&t.push({title:r,nodes:n}),t.length===0&&t.push({title:`Untitled`,nodes:[]}),t}function v(e){return o(e.children)}function y(e){let t=new Set;function n(e){switch(e.type){case`paragraph`:case`heading`:e.children.forEach(r);break;case`blockquote`:e.children.forEach(n);break;case`list`:e.children.forEach(e=>e.children.forEach(n));break;case`table`:e.children.forEach(e=>e.children.forEach(e=>e.children.forEach(r)));break;default:break}}function r(e){e.type===`image`&&e.url&&!e.url.startsWith(`data:`)&&t.add(e.url),`children`in e&&Array.isArray(e.children)&&e.children.forEach(r)}return e.forEach(n),t}function b(e,t){for(let n of e){let e=n;e?.type===`footnoteReference`&&e.identifier&&t.add(e.identifier),Array.isArray(e?.children)&&b(e.children,t)}}function x(e,t){let n=t.footnotes;if(!n||e.length===0)return``;let r=new Set,i=n.ordered().filter(t=>e.includes(t.identifier)&&!r.has(t.identifier)&&r.add(t.identifier));return i.length===0?``:`
|
|
16
16
|
<aside class="squisq-footnotes" epub:type="footnotes"><hr/>
|
|
17
17
|
<ol>
|
|
18
|
-
`+i.map(e=>{let{def:n}=
|
|
18
|
+
`+i.map(e=>{let{def:n}=c(e.identifier),r=e.definition?e.definition.children.map(e=>C(e,t)).join(``):``;return`<li id="${s(n)}" epub:type="footnote"><span class="squisq-footnote-num">${e.number}.</span> ${r}</li>`}).join(`
|
|
19
19
|
`)+`
|
|
20
20
|
</ol>
|
|
21
21
|
</aside>`}function S(e,t,n,r=!1,i,a=[]){let o=[],c=()=>{let e=`p${o.length+1}`;return o.push(e),e},l={images:n,footnotes:i,cited:new Set},u=e.map(e=>C(e,l,r?c:void 0)).join(`
|
|
@@ -37,7 +37,7 @@ ${e.children.map(e=>C(e,t,n)).join(`
|
|
|
37
37
|
`);return`<${n}${i()}${r}>
|
|
38
38
|
${a}
|
|
39
39
|
</${n}>`}case`code`:{let t=e.lang?` class="language-${s(e.lang)}"`:``;return`<pre${i()}><code${t}>${s(e.value)}</code></pre>`}case`thematicBreak`:return`<hr${i()}/>`;case`table`:return T(e,t,i());case`htmlBlock`:return`<p${i()}>${s(e.rawHtml.replace(/<[^>]+>/g,``))}</p>`;case`math`:return`<p${i()} class="math">${s(e.value)}</p>`;default:return``}}function w(e,t){let n=e.children.map(e=>C(e,t)).join(`
|
|
40
|
-
`);return`<li>${e.children.length===1&&e.children[0].type===`paragraph`?E(e.children[0].children,t):n}</li>`}function T(e,t,n=``){let r=e.children;if(r.length===0)return`<table${n}></table>`;let i=r[0],a=r.slice(1),o=e.align??[];function s(e,n,r){let i=o[r];return`<${n}${i?` style="text-align: ${i}"`:``}>${E(e.children,t)}</${n}>`}return`<table${n}>${`<thead><tr>${i.children.map((e,t)=>s(e,`th`,t)).join(``)}</tr></thead>`}${a.length>0?`<tbody>${a.map(e=>`<tr>${e.children.map((e,t)=>s(e,`td`,t)).join(``)}</tr>`).join(``)}</tbody>`:``}</table>`}function E(e,t){return e.map(e=>D(e,t)).join(``)}function D(e,t){switch(e.type){case`text`:return s(e.value);case`strong`:return`<strong>${E(e.children,t)}</strong>`;case`emphasis`:return`<em>${E(e.children,t)}</em>`;case`delete`:return`<del>${E(e.children,t)}</del>`;case`superscript`:return`<sup>${E(e.children,t)}</sup>`;case`footnoteReference`:{if(!t.footnotes)return``;let{number:n,occurrence:r}=t.footnotes.cite(e.identifier),{ref:i,def:a}=
|
|
40
|
+
`);return`<li>${e.children.length===1&&e.children[0].type===`paragraph`?E(e.children[0].children,t):n}</li>`}function T(e,t,n=``){let r=e.children;if(r.length===0)return`<table${n}></table>`;let i=r[0],a=r.slice(1),o=e.align??[];function s(e,n,r){let i=o[r];return`<${n}${i?` style="text-align: ${i}"`:``}>${E(e.children,t)}</${n}>`}return`<table${n}>${`<thead><tr>${i.children.map((e,t)=>s(e,`th`,t)).join(``)}</tr></thead>`}${a.length>0?`<tbody>${a.map(e=>`<tr>${e.children.map((e,t)=>s(e,`td`,t)).join(``)}</tr>`).join(``)}</tbody>`:``}</table>`}function E(e,t){return e.map(e=>D(e,t)).join(``)}function D(e,t){switch(e.type){case`text`:return s(e.value);case`strong`:return`<strong>${E(e.children,t)}</strong>`;case`emphasis`:return`<em>${E(e.children,t)}</em>`;case`delete`:return`<del>${E(e.children,t)}</del>`;case`superscript`:return`<sup>${E(e.children,t)}</sup>`;case`footnoteReference`:{if(!t.footnotes)return``;let{number:n,occurrence:r}=t.footnotes.cite(e.identifier),{ref:i,def:a}=c(e.identifier,r);return t.cited?.add(e.identifier),`<sup class="squisq-footnote-ref" epub:type="noteref"><a href="#${s(a)}" id="${s(i)}">${n}</a></sup>`}case`subscript`:return`<sub>${E(e.children,t)}</sub>`;case`inlineCode`:return`<code>${s(e.value)}</code>`;case`link`:{let n=i(e.url,`link`);if(!n)return E(e.children,t);let r=e.title?` title="${s(e.title)}"`:``;return`<a href="${s(n)}"${r}>${E(e.children,t)}</a>`}case`image`:{let n=s(e.alt??``),r=t.images.get(e.url),a=r?`../images/${r.filename}`:i(e.url,`media`);return a?`<img src="${s(a)}" alt="${n}"/>`:n}case`break`:return`<br/>`;case`inlineMath`:return`<span class="math">${s(e.value)}</span>`;case`htmlInline`:return s(e.rawHtml.replace(/<[^>]+>/g,``));case`inlineIcon`:{let t=e,n=u(t.family,t.name);return n?`<span class="squisq-fa-${t.family}">${s(n)}</span>`:s(`{[${t.token}]}`)}default:return``}}function O(){let e=globalThis.crypto;if(typeof e?.randomUUID==`function`)return e.randomUUID();let t=new Uint8Array(16);if(typeof e?.getRandomValues==`function`)e.getRandomValues(t);else{let e=Date.now()^Math.floor(Math.random()*2147483647);for(let n=0;n<t.length;n++)e=Math.imul(e^e>>>15,1|e),t[n]=e&255}t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=Array.from(t,e=>e.toString(16).padStart(2,`0`)).join(``);return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function k(e,t){let n=p(e.replace(/\\/g,`/`)),r=Array.from(n,e=>{let t=e.codePointAt(0)??0;return e===`\\`||e===`/`||t<32||t===127?`_`:e}).join(``).trim();return!r||r===`.`||r===`..`?t:r}function A(e,t,n){let r=`${e}-${t.replace(/[^a-zA-Z0-9]/g,`-`)}`,i=r,a=2;for(;n.has(i);)i=`${r}-${a++}`;return n.add(i),i}function j(e,t){if(!t.has(e))return e;let n=e.lastIndexOf(`.`),r=n>0?e.slice(0,n):e,i=n>0?e.slice(n):``,a=2;for(;t.has(`${r}-${a}${i}`);)a++;return`${r}-${a}${i}`}function M(e,t,n){if(n.length===0)return`<?xml version="1.0" encoding="UTF-8"?>
|
|
41
41
|
<smil xmlns="http://www.w3.org/ns/SMIL" xmlns:epub="http://www.idpf.org/2007/ops" version="3.0">
|
|
42
42
|
<body>
|
|
43
43
|
<seq id="seq-1" epub:textref="${e}">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./api-
|
|
1
|
+
import{t as e}from"./api-BPraLwsh.js";function t(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),URL.revokeObjectURL(n)}var n={docx:`Word Document (.docx)`,pdf:`PDF (.pdf)`,pptx:`PowerPoint (.pptx)`,md:`Markdown (.md)`,html:`HTML (.html)`},r={docx:`.docx`,pdf:`.pdf`,pptx:`.pptx`,md:`.md`,html:`.html`},i=`gezel-export-options`,a={format:`pdf`,themeId:`standard`,transformStyle:`documentary`,pageSize:`letter`,htmlStyle:`plain`,htmlBundle:`single`},o=new Set([`docx`,`pdf`,`pptx`,`md`,`html`]),s=new Set([`letter`,`a4`]),c=new Set([`rendered`,`plain`]),l=new Set([`single`,`zip`]);function u(e){if(!e||typeof e!=`object`)return null;let t=e;if(!t.format||!o.has(t.format))return null;let n={...a,...t};return typeof n.themeId!=`string`||!n.themeId||typeof n.transformStyle!=`string`||!n.transformStyle||!s.has(n.pageSize)||!c.has(n.htmlStyle)||!l.has(n.htmlBundle)?null:n}function d(e){try{localStorage.setItem(i,JSON.stringify(e))}catch{}}function f(){try{let e=localStorage.getItem(i);return e?u(JSON.parse(e)):null}catch{return null}}async function p(t){d(t),await e.updateConfig({documentExportOptions:t}).catch(()=>{})}async function m(){let t=f();try{let n=u((await e.getConfig()).documentExportOptions);return n?(d(n),n):t}catch{return t}}export{p as a,f as i,r as n,m as o,n as r,t as s,a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-7AWFHP5U-MiVVPFTx.js";import"./chunk-S5PCVMKU-Df5XzhSE.js";import{n as e}from"./chunk-WATAOG4Y-C1EXVPmG.js";export{e as extractPptxTheme};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ironcalc-BAi5gOlE.js","assets/preload-helper-Czpn1I53.js","assets/run-export-ChaMXrKS.js","assets/chunk-UBFT2CDQ-FexGDigd.js","assets/rolldown-runtime-aKtaBQYM.js","assets/chunk-O7JILDEF-CqcO1qaI.js","assets/chunk-4VOD55SX-BFSSw0c8.js","assets/markdown-ryKA_OmY.js","assets/export-options-f7PKjEBb.js","assets/api-BPraLwsh.js","assets/dist-BaHut5iX.js","assets/dist-BqGwkOe5.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{t as r}from"./react-dom-OL4w_gzs.js";import{t as i}from"./api-BPraLwsh.js";import{H as a,J as o,K as s,U as c,W as l,Y as u,q as d}from"./primitives-CWrGZpPI.js";import{C as f,D as p,E as m,O as h,S as g,T as _,a as v,c as y,g as b,i as x,k as S,o as C,r as w,s as T,x as E}from"./document-companion-BQk2kS0F.js";import{a as D,i as O,n as k,s as A,t as j}from"./DropdownMenu-S4d9-3j3.js";import{t as M}from"./relative-time-B2kBaekd.js";import{t as N}from"./ConfirmDialog-Dt1ed4Fh.js";import{t as P}from"./chunk-O7JILDEF-CqcO1qaI.js";import{v as F}from"./chunk-GAZKTT4R-BkP6-w3z.js";import{n as I}from"./chunk-UBFT2CDQ-FexGDigd.js";import"./markdown-ryKA_OmY.js";import"./schemas-JY4jmLbC.js";import{t as L}from"./preload-helper-Czpn1I53.js";import{a as R,i as ee}from"./styles-CKVKwqoQ.js";import{s as z}from"./chunk-AE3IUKMM-mZjzzO8Z.js";import{b as te}from"./index-C0DYtvfg.js";import"./transform-CmAXy0Ck.js";import{a as B,i as V,n as H,o as U,r as W,s as ne,t as re}from"./export-options-f7PKjEBb.js";import"./SquisqIntegration-6v3yNOIP.js";import{d as G,s as K,t as ie}from"./outside-in-D73N1g_b.js";import{n as ae}from"./document-import-QoM9UxJr.js";function oe(e){return e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}function q(e){try{return e.split(`/`).map(e=>decodeURIComponent(e)).join(`/`)}catch{return e}}function se(e){let t={mutationLock:e.mutationLock??e,readFile:t=>e.readFile(q(t)),writeFile:(t,n,r)=>e.writeFile(q(t),n,r),removeFile:t=>e.removeFile(q(t)),async listFiles(t){return(await e.listFiles(t?q(t):void 0)).map(e=>({...e,path:oe(e.path)}))},exists:t=>e.exists(q(t)),async getDocumentPath(){let t=await e.getDocumentPath();return t===null?null:oe(t)},async readDocument(){let e=await t.getDocumentPath();if(e===null)return null;let n=await t.readFile(e);return n===null?null:new TextDecoder().decode(n)},writeDocument:(t,n)=>e.writeDocument(t,n?q(n):void 0)};return e.writeFileExclusive&&(t.writeFileExclusive=(t,n,r)=>e.writeFileExclusive(q(t),n,r)),t}function ce(e,t){let n=e.replace(/\/[^/]*$/,``);return n&&t.startsWith(`${n}/`)?t.slice(n.length+1):t}function le(e){let{client:t,currentDocumentPath:n,limit:r=20,source:i=`documents`,projectId:a}=e;return async e=>{let o=e.trim().toLowerCase();try{return(i===`project-artifacts`&&a?await t.listProjectArtifacts(a,void 0,!0):await t.listDocuments(void 0,!0)).files.filter(e=>!e.isDirectory).filter(e=>e.path!==n).filter(e=>/\.(md|markdown|mdx|txt)$/i.test(e.name)).filter(e=>!o||e.name.toLowerCase().includes(o)||e.path.toLowerCase().includes(o)).slice(0,r).map(e=>({path:ce(n,e.path),label:e.name.replace(/\.(md|markdown|mdx|txt)$/i,``),description:e.path}))}catch{return[]}}}var ue=`/assets/wasm_bg-DW9Xt_vt.wasm`,de=async e=>{let{createIronCalcEngine:t}=await L(async()=>{let{createIronCalcEngine:e}=await import(`./ironcalc-BAi5gOlE.js`);return{createIronCalcEngine:e}},__vite__mapDeps([0,1]));return t({...e,wasmSource:ue})},J=e(t(),1),Y=n(),fe=[`pdf`,`docx`,`pptx`,`html`,`md`],pe={pdf:`PDF`,docx:`Word`,pptx:`PowerPoint`,html:`HTML`,md:`Markdown`},me=[{key:`plain`,label:`Plain`,hint:`A lightweight static HTML document.`},{key:`rendered`,label:`Rendered`,hint:`Renders via SquisqPlayer with themes and playback support.`}],he=[{key:`single`,label:`Single file`,hint:`One .html file with images embedded as base64 data URIs.`},{key:`zip`,label:`ZIP archive`,hint:`A .zip with index.html plus separate image (and JS) files.`}];function ge({name:e,value:t,options:n,onChange:r}){return(0,Y.jsx)(`fieldset`,{className:`gezel-export-choice-tray gz-tray`,"aria-label":e,children:n.map(n=>{let i=n.key===t;return(0,Y.jsxs)(`label`,{className:`gz-key${i?` gz-key-active`:``}`,title:n.title,children:[(0,Y.jsx)(`input`,{type:`radio`,className:`gezel-export-choice-radio`,name:e,value:n.key,checked:i,onChange:()=>r(n.key)}),n.label]},n.key)})})}function _e({initial:e,exporting:t,error:n=null,onExport:r,onClose:i}){let[f,p]=(0,J.useState)(e.format),[m,h]=(0,J.useState)(e.themeId),[g,_]=(0,J.useState)(e.transformStyle),[v,y]=(0,J.useState)(e.pageSize),[b,x]=(0,J.useState)(e.htmlStyle),[S,C]=(0,J.useState)(e.htmlBundle),w=F(),T=z(),E=f===`docx`||f===`pdf`||f===`pptx`||f===`html`&&b===`rendered`,D=f===`pptx`,O=f===`pdf`,k=f===`html`,A=(0,J.useCallback)(e=>{e.preventDefault(),r({format:f,themeId:m,transformStyle:g,pageSize:v,htmlStyle:b,htmlBundle:S})},[f,m,g,v,b,S,r]);return(0,Y.jsx)(o,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Y.jsxs)(d,{children:[(0,Y.jsx)(s,{}),(0,Y.jsx)(l,{className:`gezel-export-dialog`,children:(0,Y.jsxs)(`form`,{onSubmit:A,children:[(0,Y.jsxs)(`div`,{className:`gezel-export-dialog-header`,children:[(0,Y.jsx)(u,{children:`Export document`}),(0,Y.jsx)(c,{asChild:!0,children:(0,Y.jsx)(`button`,{type:`button`,className:`gezel-export-dialog-close`,"aria-label":`Close`,children:`×`})})]}),(0,Y.jsxs)(`div`,{className:`gezel-export-dialog-body`,children:[(0,Y.jsxs)(`div`,{className:`gezel-export-field`,children:[(0,Y.jsx)(`span`,{className:`gezel-export-label`,children:`Format`}),(0,Y.jsx)(ge,{name:`Format`,value:f,options:fe.map(e=>({key:e,label:pe[e],title:W[e]})),onChange:p})]}),k&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`gezel-export-field`,children:[(0,Y.jsx)(`span`,{className:`gezel-export-label`,children:`Style`}),(0,Y.jsx)(ge,{name:`Style`,value:b,options:me,onChange:x}),(0,Y.jsx)(`span`,{className:`gezel-export-hint`,children:me.find(e=>e.key===b)?.hint})]}),(0,Y.jsxs)(`div`,{className:`gezel-export-field`,children:[(0,Y.jsx)(`span`,{className:`gezel-export-label`,children:`Bundle`}),(0,Y.jsx)(ge,{name:`Bundle`,value:S,options:he,onChange:C}),(0,Y.jsx)(`span`,{className:`gezel-export-hint`,children:he.find(e=>e.key===S)?.hint})]})]}),E&&(0,Y.jsxs)(`div`,{className:`gezel-export-field`,children:[(0,Y.jsx)(`label`,{className:`gezel-export-label`,htmlFor:`gezel-export-theme`,children:`Theme`}),(0,Y.jsx)(`select`,{id:`gezel-export-theme`,className:`gezel-export-select`,value:m,onChange:e=>h(e.target.value),children:w.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.name},e.id))}),(0,Y.jsx)(`span`,{className:`gezel-export-hint`,children:w.find(e=>e.id===m)?.description})]}),D&&(0,Y.jsxs)(`div`,{className:`gezel-export-field`,children:[(0,Y.jsx)(`label`,{className:`gezel-export-label`,htmlFor:`gezel-export-transform`,children:`Transform`}),(0,Y.jsx)(`select`,{id:`gezel-export-transform`,className:`gezel-export-select`,value:g,onChange:e=>_(e.target.value),children:T.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.name},e.id))}),(0,Y.jsx)(`span`,{className:`gezel-export-hint`,children:T.find(e=>e.id===g)?.description})]}),O&&(0,Y.jsxs)(`div`,{className:`gezel-export-field`,children:[(0,Y.jsx)(`label`,{className:`gezel-export-label`,htmlFor:`gezel-export-pagesize`,children:`Page size`}),(0,Y.jsxs)(`select`,{id:`gezel-export-pagesize`,className:`gezel-export-select`,value:v,onChange:e=>y(e.target.value),children:[(0,Y.jsx)(`option`,{value:`letter`,children:`US Letter`}),(0,Y.jsx)(`option`,{value:`a4`,children:`A4`})]})]}),n&&(0,Y.jsx)(`p`,{className:`error small`,role:`alert`,children:n})]}),(0,Y.jsxs)(a,{children:[(0,Y.jsx)(c,{asChild:!0,children:(0,Y.jsx)(`button`,{type:`button`,disabled:t,children:`Cancel`})}),(0,Y.jsx)(`button`,{type:`submit`,className:`primary`,disabled:t,children:t?`Exporting…`:`Export`})]})]})})]})})}function ve(e){let t=e instanceof Error?e.message.trim():``;return t?`Export failed: ${t}`:`Export failed. The document was not exported.`}function ye(e){let t=H[e.format].toUpperCase().replace(`.`,``),n=e.format===`html`&&e.htmlBundle===`zip`?`ZIP`:t,r=[];if(e.format===`html`&&e.htmlStyle===`rendered`&&r.push(`rendered`),e.themeId!==`standard`&&(e.format!==`html`||e.htmlStyle===`rendered`)){let t=F().find(t=>t.id===e.themeId);t&&r.push(t.name)}if(e.format===`pptx`&&e.transformStyle){let t=z().find(t=>t.id===e.transformStyle);t&&r.push(t.name)}return r.length>0?`Export ${n} with ${r.join(` + `)}`:`Export ${n}`}function be({selectedFile:e,mediaContainer:t,mediaSource:n}){let{markdownSource:r}=ee(),[c,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(!1),[h,g]=(0,J.useState)(null),[_,v]=(0,J.useState)(null),[y,b]=(0,J.useState)(!1),[x,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(()=>V()),T=(0,J.useRef)(null);(0,J.useEffect)(()=>()=>T.current?.abort(),[]),(0,J.useEffect)(()=>{let e=!1;return U().then(t=>{e||w(t)}),()=>{e=!0}},[]);let E=(0,J.useCallback)(()=>{f(!1),S(null),m(!0)},[]),M=(0,J.useCallback)(()=>{y||(m(!1),S(null))},[y]),N=(0,J.useCallback)(async t=>{if(!e||!n)return;let a=new AbortController;T.current?.abort(),T.current=a,f(!1),g(t),v(null);try{let o=await i.exportDocumentMedia({markdown:r,selectedFile:e,format:t,source:n},a.signal);if(a.signal.aborted)return;ne(o,`${(e.split(`/`).pop()??e).replace(/\.[^.]+$/,``)||`document`}.${t}`),g(null)}catch(e){if(a.signal.aborted)return;v(ve(e))}finally{T.current===a&&(T.current=null)}},[r,n,e]),P=(0,J.useCallback)(()=>{T.current?.abort(),T.current=null,g(null),v(null)},[]),F=(0,J.useCallback)(async n=>{b(!0),S(null),w(n);try{await B(n);let{runExport:i}=await L(async()=>{let{runExport:e}=await import(`./run-export-ChaMXrKS.js`);return{runExport:e}},__vite__mapDeps([2,3,4,5,6,7,1,8,9,10,11]));await i(r,e,n,t),m(!1)}catch(e){S(ve(e))}finally{b(!1)}},[r,e,t]),I=(0,J.useCallback)(async()=>{if(C){f(!1),b(!0),S(null);try{let{runExport:n}=await L(async()=>{let{runExport:e}=await import(`./run-export-ChaMXrKS.js`);return{runExport:e}},__vite__mapDeps([2,3,4,5,6,7,1,8,9,10,11]));await n(r,e,C,t)}catch(e){S(ve(e)),m(!0)}finally{b(!1)}}},[C,r,e,t]);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(D,{open:c,onOpenChange:f,children:[(0,Y.jsx)(A,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:`squisq-toolbar-button gezel-export-trigger`,"aria-label":`Export document`,title:`Export document`,disabled:y,children:[(0,Y.jsx)(xe,{}),(0,Y.jsx)(`span`,{children:`Export`})]})}),(0,Y.jsx)(O,{children:(0,Y.jsxs)(j,{className:`app-nav-menu gezel-export-menu`,sideOffset:4,align:`end`,children:[C&&(0,Y.jsx)(k,{className:`app-nav-menu-item`,onSelect:()=>void I(),disabled:y,children:ye(C)}),(0,Y.jsx)(k,{className:`app-nav-menu-item`,onSelect:E,children:`Export…`}),e&&n&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`gezel-export-menu-divider`,role:`separator`,tabIndex:-1}),(0,Y.jsx)(k,{className:`app-nav-menu-item`,onSelect:()=>void N(`mp4`),children:`Export video…`}),(0,Y.jsx)(k,{className:`app-nav-menu-item`,onSelect:()=>void N(`gif`),children:`Export animated GIF…`})]})]})})]}),p&&(0,Y.jsx)(_e,{initial:C??re,exporting:y,error:x,onExport:e=>void F(e),onClose:M}),(h||_)&&(0,Y.jsx)(o,{open:!0,onOpenChange:e=>!e&&P(),children:(0,Y.jsxs)(d,{children:[(0,Y.jsx)(s,{}),(0,Y.jsxs)(l,{className:`gezel-export-loading-dialog`,children:[(0,Y.jsx)(u,{children:h===`gif`?`Exporting animated GIF`:`Exporting video`}),(0,Y.jsx)(`p`,{className:_?`error`:`muted`,role:_?`alert`:`status`,children:_??`Rendering with the ffmpeg installed on this computer. This can take a while…`}),(0,Y.jsx)(a,{children:(0,Y.jsx)(`button`,{type:`button`,onClick:P,children:_?`Close`:`Cancel`})})]})]})})]})}function xe(){return(0,Y.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M8 10.5V1.75`}),(0,Y.jsx)(`path`,{d:`M5.25 4.5 8 1.75l2.75 2.75`}),(0,Y.jsx)(`path`,{d:`M4.25 6.75h-1a1.5 1.5 0 0 0-1.5 1.5v4.5a1.5 1.5 0 0 0 1.5 1.5h9.5a1.5 1.5 0 0 0 1.5-1.5v-4.5a1.5 1.5 0 0 0-1.5-1.5h-1`})]})}var Se=e(r(),1),Ce=class e{context;onChange;static create(t){let n=globalThis,r=n.AudioContext??n.webkitAudioContext;if(!r)return null;try{return new e(new r,t)}catch{return null}}chunks=[];pending=new Map;sources=new Set;bufferedDuration=0;playbackOffset=0;playbackStartedAt=0;playing=!1;complete=!1;disposed=!1;endTimer=null;constructor(e,t){this.context=e,this.onChange=t}prime(){this.context.resume().catch(()=>void 0)}async appendWav(e,t){if(this.disposed||e<this.chunks.length||this.pending.has(e))return this.snapshot();let n=await this.context.decodeAudioData(t.slice(0));if(this.disposed)return this.snapshot();for(this.pending.set(e,n);this.pending.has(this.chunks.length);){let e=this.chunks.length,t=this.pending.get(e);this.pending.delete(e);let n={index:e,start:this.bufferedDuration,buffer:t};this.chunks.push(n),this.bufferedDuration+=t.duration,this.playing&&this.scheduleChunk(n)}return this.refreshEndTimer(),this.emit(),this.snapshot()}async play(){if(this.disposed||this.bufferedDuration<=0)return!1;if(this.playing)return!0;if(this.playbackOffset>=this.bufferedDuration-.02){if(!this.complete)return this.emit(),!1;this.playbackOffset=0}await this.context.resume(),this.stopSources(),this.playing=!0,this.playbackStartedAt=this.context.currentTime+.025;for(let e of this.chunks)this.scheduleChunk(e);return this.refreshEndTimer(),this.emit(),!0}pause(){this.playing&&(this.playbackOffset=this.currentTime(),this.playing=!1,this.stopSources(),this.clearEndTimer(),this.emit())}seek(e){let t=this.playing;this.playbackOffset=Math.max(0,Math.min(this.bufferedDuration,e)),this.playing=!1,this.stopSources(),this.clearEndTimer(),t?this.play():this.emit()}finish(){this.complete=!0,this.refreshEndTimer(),this.emit()}snapshot(){let e=this.currentTime();return{currentTime:e,bufferedDuration:this.bufferedDuration,isPlaying:this.playing,waitingForAudio:!this.complete&&!this.playing&&this.bufferedDuration>0&&e>=this.bufferedDuration-.05,complete:this.complete}}dispose(){this.disposed||(this.disposed=!0,this.playing=!1,this.stopSources(),this.clearEndTimer(),this.context.close().catch(()=>void 0))}currentTime(){return this.playing?Math.min(this.bufferedDuration,this.playbackOffset+Math.max(0,this.context.currentTime-this.playbackStartedAt)):this.playbackOffset}scheduleChunk(e){let t=e.start+e.buffer.duration;if(!this.playing||t<=this.playbackOffset+.005)return;let n=Math.max(0,this.playbackOffset-e.start),r=this.playbackStartedAt+Math.max(0,e.start-this.playbackOffset);if(r<this.context.currentTime&&(n+=this.context.currentTime-r,r=this.context.currentTime),n>=e.buffer.duration-.005)return;let i=this.context.createBufferSource();i.buffer=e.buffer,i.connect(this.context.destination),i.addEventListener(`ended`,()=>this.sources.delete(i),{once:!0}),this.sources.add(i),i.start(r,n)}refreshEndTimer(){if(this.clearEndTimer(),!this.playing)return;let e=Math.max(20,(this.bufferedDuration-this.currentTime())*1e3+40);this.endTimer=setTimeout(()=>{if(this.playing){if(this.currentTime()<this.bufferedDuration-.05){this.refreshEndTimer();return}this.playbackOffset=this.bufferedDuration,this.playing=!1,this.stopSources(),this.clearEndTimer(),this.emit()}},e)}stopSources(){for(let e of this.sources)try{e.stop()}catch{}this.sources.clear()}clearEndTimer(){this.endTimer&&clearTimeout(this.endTimer),this.endTimer=null}emit(){this.disposed||this.onChange(this.snapshot())}};function we(e){return e.replace(/\u00a0/g,` `).replace(/[ \t]+\n/g,`
|
|
3
|
+
`).replace(/\n{3,}/g,`
|
|
4
|
+
|
|
5
|
+
`).trim()}function Te(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return n}function Ee(e){let t=new Uint8Array(e.byteLength);return t.set(e),t.buffer}function X(e){let t=Number.isFinite(e)&&e>0?Math.floor(e):0;return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`}function De(e,t){return`${(e?.split(/[\\/]/).pop()?.replace(/\.[^.]+$/,``)||`document`).replace(/[^a-z0-9._-]+/gi,`-`).replace(/^-+|-+$/g,``)||`document`}-${t}-narration.wav`}function Oe(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.style.display=`none`,document.body.append(r),r.click(),r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),0)}function ke({fileName:e,projectId:t}){let{markdownDoc:n,markdownSource:r}=ee(),a=(0,J.useRef)(null),o=(0,J.useRef)(null),s=(0,J.useRef)(null),c=(0,J.useRef)(null),l=(0,J.useRef)(null),u=(0,J.useRef)(null),d=(0,J.useRef)(null),f=(0,J.useRef)(0),p=(0,J.useRef)(0),m=(0,J.useRef)(0),h=(0,J.useRef)(0),g=(0,J.useRef)(!1),[_,v]=(0,J.useState)(`idle`),[y,b]=(0,J.useState)(`document`),[x,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(!1),[T,E]=(0,J.useState)(0),[D,O]=(0,J.useState)(0),[k,A]=(0,J.useState)(null),[j,M]=(0,J.useState)(0),[N,F]=(0,J.useState)(0),[L,z]=(0,J.useState)(!1),te=(0,J.useMemo)(()=>{try{return we(P(n??I(r)))}catch{return we(r)}},[n,r]),B=(0,J.useCallback)(()=>{u.current?.dispose(),u.current=null,o.current?.(),o.current=null;let e=a.current;e&&(e.pause(),e.removeAttribute(`src`)),a.current=null,s.current&&URL.revokeObjectURL(s.current),s.current=null,c.current=null},[]),V=(0,J.useCallback)(()=>{l.current?.abort(),l.current=null,B(),v(`idle`),S(null),w(!1),E(0),O(0),F(0),z(!1),A(null),d.current=null,g.current=!1},[B]);(0,J.useEffect)(()=>()=>{l.current?.abort(),B()},[B]),(0,J.useEffect)(()=>{if(_!==`creating`)return;let e=f.current||performance.now();M(0);let t=window.setInterval(()=>{M(Math.floor((performance.now()-e)/1e3))},1e3);return()=>window.clearInterval(t)},[_]),(0,J.useEffect)(()=>{if(_===`idle`||!u.current)return;let e=window.setInterval(()=>{let e=u.current?.snapshot();e&&(E(e.currentTime),F(e.bufferedDuration),w(e.isPlaying),z(e.waitingForAudio))},200);return()=>window.clearInterval(e)},[_]);let H=(0,J.useCallback)(async(e,n)=>{let r=we(e);if(!r)return;l.current?.abort(),B();let _=Ce.create(e=>{E(e.currentTime),F(e.bufferedDuration),w(e.isPlaying),z(e.waitingForAudio)});u.current=_,_?.prime();let y=new AbortController;l.current=y,f.current=performance.now(),p.current=0,m.current=0,h.current=0,d.current=null,g.current=!1,b(n),v(`creating`),S(null),w(!1),E(0),O(0),F(0),z(!1),A(null);try{let e=await i.synthesizeSpeechWithProgress({text:r,...t?{projectId:t}:{},inline:!0},{onProgress:e=>{d.current=e,A(e)},onChunk:async e=>{if(y.signal.aborted||u.current!==_||!_)return;let t=await _.appendWav(e.index,Ee(Te(e.b64Wav))),n=performance.now(),r=d.current;if(p.current===0&&(p.current=n,m.current=t.bufferedDuration,h.current=r?.completedCharacters??0),t.isPlaying||g.current)return;let i=(n-p.current)/1e3,a=t.bufferedDuration-m.current,o=i>.25?a/i:0,s=(r?.completedCharacters??0)-h.current,c=i>.25?s/i:0,l=r&&c>0?(r.totalCharacters-r.completedCharacters)/c:1/0,f=t.bufferedDuration-t.currentTime;f>=4&&(o>=1.15||f>=l+3)&&await _.play()}},y.signal);if(y.signal.aborted)return;if(!e.b64Wav)throw Error(`The speech engine did not return playable audio.`);let n=new Blob([Ee(Te(e.b64Wav))],{type:`audio/wav`});if(c.current=n,_&&_.snapshot().bufferedDuration>0){_.finish(),F(_.snapshot().bufferedDuration),O(e.meta?.durationSeconds??_.snapshot().bufferedDuration),v(`ready`),l.current=null,!_.snapshot().isPlaying&&!g.current&&await _.play();return}_?.dispose(),u.current===_&&(u.current=null);let f=URL.createObjectURL(n),b=new Audio(f),x=()=>{E(b.currentTime||0),Number.isFinite(b.duration)&&O(b.duration)},C=()=>w(!0),T=()=>w(!1),D=()=>w(!1),k=()=>{S(`The narration was created, but this device could not play it.`),v(`error`)};b.addEventListener(`loadedmetadata`,x),b.addEventListener(`durationchange`,x),b.addEventListener(`timeupdate`,x),b.addEventListener(`play`,C),b.addEventListener(`pause`,T),b.addEventListener(`ended`,D),b.addEventListener(`error`,k),o.current=()=>{b.removeEventListener(`loadedmetadata`,x),b.removeEventListener(`durationchange`,x),b.removeEventListener(`timeupdate`,x),b.removeEventListener(`play`,C),b.removeEventListener(`pause`,T),b.removeEventListener(`ended`,D),b.removeEventListener(`error`,k)},s.current=f,a.current=b,O(e.meta?.durationSeconds??0),v(`ready`),l.current=null,await b.play().catch(()=>void 0)}catch(e){if(y.signal.aborted){l.current===y&&v(`idle`);return}_?.dispose(),u.current===_&&(u.current=null),S(e instanceof Error?e.message:`Could not create the narration.`),v(`error`),l.current=null}},[t,B]);R((0,J.useMemo)(()=>[{id:`gezel.narrate-selection`,label:`Narrate selection`,group:`narration`,when:`selection`,disabled:_===`creating`,icon:(0,Y.jsx)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,Y.jsx)(`path`,{d:`M4 9v6h4l5 4V5L8 9H4Zm12.5 3a4.5 4.5 0 0 0-2-3.74v7.48a4.5 4.5 0 0 0 2-3.74Z`})}),onSelect:({selectedText:e})=>H(e,`selection`)}],[H,_]));let U=(0,J.useCallback)(()=>{let e=u.current;if(e){e.snapshot().isPlaying?(g.current=!0,e.pause()):(g.current=!1,e.play().catch(e=>{S(e instanceof Error?e.message:`Could not play the narration.`),v(`error`)}));return}let t=a.current;t&&(t.paused?(Number.isFinite(t.duration)&&t.currentTime>=t.duration&&(t.currentTime=0),t.play().catch(e=>{S(e instanceof Error?e.message:`Could not play the narration.`),v(`error`)})):t.pause())},[]),W=(0,J.useCallback)(e=>{let t=u.current;if(t){let n=t.snapshot();t.seek(n.currentTime+e);return}let n=a.current;if(!n)return;let r=Number.isFinite(n.duration)?n.duration:1/0;n.currentTime=Math.max(0,Math.min(r,n.currentTime+e)),E(n.currentTime)},[]),ne=(0,J.useCallback)(e=>{let t=u.current;if(t){t.seek(e);return}let n=a.current;n&&(n.currentTime=e,E(e))},[]),re=(0,J.useCallback)(()=>{let t=c.current;t&&Oe(t,De(e,y))},[e,y]),G=k?.phase===`encoding`?100:Math.min(100,Math.round((k?.completedCharacters??0)/(k?.totalCharacters||1)*100)),K=N>0?Math.min(G,T/N*G):0,ie=_===`idle`?null:(0,Se.createPortal)((0,Y.jsxs)(`aside`,{className:`document-narration-transport`,"aria-label":`Narration controls`,children:[_===`creating`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`document-narration-summary`,"aria-live":`polite`,children:[(0,Y.jsx)(`strong`,{children:C?`Playing while creating…`:L&&!g.current?`Buffering narration…`:`Creating narration…`}),(0,Y.jsx)(`span`,{children:N>0?`${X(T)} played · ${X(N)} buffered`:`${y===`document`?`Full document`:`Selected text`} · ${k?.phase===`loading`?`Preparing voice`:`Starting speech`} · ${X(j)} elapsed`})]}),N>0&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{type:`button`,className:`document-narration-control`,"aria-label":`Back 30 seconds`,title:`Back 30 seconds`,onClick:()=>W(-30),children:[`↶`,(0,Y.jsx)(`small`,{children:`30`})]}),(0,Y.jsx)(`button`,{type:`button`,className:`document-narration-control document-narration-play`,"aria-label":C?`Pause narration`:`Play buffered narration`,title:C?`Pause`:`Play buffered audio`,onClick:U,children:C?`Ⅱ`:`▶`}),(0,Y.jsxs)(`button`,{type:`button`,className:`document-narration-control`,"aria-label":`Forward 30 seconds`,title:`Forward within buffered audio`,onClick:()=>W(30),children:[`↷`,(0,Y.jsx)(`small`,{children:`30`})]})]}),(0,Y.jsxs)(`div`,{className:`document-narration-progress`,role:`progressbar`,"aria-label":`Creating narration`,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0,"aria-valuenow":G,title:`${X(N)} generated · ${G}% complete`,children:[(0,Y.jsx)(`span`,{className:`document-narration-progress-buffered`,style:{width:`${G}%`}}),(0,Y.jsx)(`span`,{className:`document-narration-progress-played`,style:{width:`${K}%`}})]}),(0,Y.jsxs)(`span`,{className:`document-narration-progress-value`,children:[G,`% · `,X(N)]}),(0,Y.jsx)(`button`,{type:`button`,className:`document-narration-cancel`,onClick:V,children:`Cancel`})]}),_===`ready`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`document-narration-summary`,"aria-live":`polite`,children:[(0,Y.jsx)(`strong`,{children:y===`document`?`Document narration`:`Selection narration`}),(0,Y.jsx)(`span`,{children:C?`Playing`:`Paused`})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`document-narration-control`,"aria-label":`Back 30 seconds`,title:`Back 30 seconds`,onClick:()=>W(-30),children:[`↶`,(0,Y.jsx)(`small`,{children:`30`})]}),(0,Y.jsx)(`button`,{type:`button`,className:`document-narration-control document-narration-play`,"aria-label":C?`Pause narration`:`Play narration`,title:C?`Pause`:`Play`,onClick:U,children:C?`Ⅱ`:`▶`}),(0,Y.jsxs)(`button`,{type:`button`,className:`document-narration-control`,"aria-label":`Forward 30 seconds`,title:`Forward 30 seconds`,onClick:()=>W(30),children:[`↷`,(0,Y.jsx)(`small`,{children:`30`})]}),(0,Y.jsxs)(`label`,{className:`document-narration-timeline`,children:[(0,Y.jsx)(`span`,{className:`sr-only`,children:`Narration position`}),(0,Y.jsx)(`input`,{type:`range`,min:0,max:Math.max(D,.1),step:.1,value:Math.min(T,Math.max(D,.1)),onChange:e=>ne(Number(e.currentTarget.value))}),(0,Y.jsxs)(`span`,{"aria-hidden":`true`,children:[X(T),` / `,X(D)]})]}),(0,Y.jsx)(`button`,{type:`button`,className:`document-narration-download`,"aria-label":`Download WAV`,title:`Download WAV`,onClick:re,children:(0,Y.jsx)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,Y.jsx)(`path`,{d:`M12 3v11m0 0 4-4m-4 4-4-4M5 17v3h14v-3`})})}),(0,Y.jsx)(`button`,{type:`button`,className:`document-narration-close`,"aria-label":`Close narration`,title:`Close`,onClick:V,children:`×`})]}),_===`error`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`document-narration-summary`,role:`alert`,children:[(0,Y.jsx)(`strong`,{children:`Narration unavailable`}),(0,Y.jsx)(`span`,{children:x})]}),(0,Y.jsx)(`button`,{type:`button`,className:`document-narration-cancel`,onClick:V,children:`Close`})]})]}),document.body);return(0,Y.jsxs)(`span`,{className:`document-narration-root`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`squisq-toolbar-button document-narration-trigger`,"aria-label":`Narrate document`,title:`Narrate document`,disabled:!te||_===`creating`,onClick:()=>void H(te,`document`),children:(0,Y.jsx)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,Y.jsx)(`path`,{d:`M4 9v6h4l5 4V5L8 9H4Zm12.5 3a4.5 4.5 0 0 0-2-3.74v7.48a4.5 4.5 0 0 0 2-3.74Zm-2-8.65v2.12a7.5 7.5 0 0 1 0 13.06v2.12a9.5 9.5 0 0 0 0-17.3Z`})})}),ie]})}function Ae({entries:e,selectedPath:t,onSelect:n,iconFor:r=y,trailingForEntry:i,detailForEntry:a,actionsForEntry:o,emptyMessage:s}){return e.length===0?s?(0,Y.jsx)(`div`,{className:`file-flat-empty muted`,children:s}):null:(0,Y.jsx)(`div`,{className:`file-flat-list`,children:e.map(e=>{let s=f(e.path),c=i?.(e),l=a?.(e),u=o?.(e)??[],d=(0,Y.jsxs)(`div`,{className:`tree-row${t===e.path?` tree-row-selected`:``}${l?` file-flat-row-card`:``}`,children:[(0,Y.jsx)(`span`,{className:`tree-toggle-spacer`}),(0,Y.jsxs)(`button`,{type:`button`,className:`tree-label${l?` file-flat-card`:``}`,onClick:()=>n(e),children:[(0,Y.jsxs)(`span`,{className:`file-flat-card-name`,children:[r(e),e.name,s&&(0,Y.jsx)(`span`,{className:`file-flat-parent`,children:s})]}),l&&(0,Y.jsx)(`span`,{className:`file-flat-card-detail`,children:l})]}),c&&(0,Y.jsx)(`button`,{type:`button`,className:`tree-row-trailing tree-row-trailing-select`,tabIndex:-1,onClick:()=>n(e),children:c}),u.length>0&&(0,Y.jsxs)(D,{children:[(0,Y.jsx)(A,{asChild:!0,children:(0,Y.jsx)(`button`,{type:`button`,className:`tree-actions-trigger`,"aria-label":`Actions for ${e.name}`,title:`Actions for ${e.name}`,children:(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:`⋯`})})}),(0,Y.jsx)(O,{children:(0,Y.jsx)(j,{className:`app-nav-menu tree-actions-menu`,sideOffset:4,align:`end`,children:u.map(t=>(0,Y.jsx)(k,{className:`app-nav-menu-item`,disabled:t.disabled,onSelect:()=>void t.onSelect(e),children:t.label},t.label))})})]})]},e.path);return u.length>0?(0,Y.jsxs)(h,{children:[(0,Y.jsx)(S,{asChild:!0,children:d}),(0,Y.jsx)(p,{children:(0,Y.jsx)(_,{className:`app-nav-menu tree-actions-menu`,children:u.map(t=>(0,Y.jsx)(m,{className:`app-nav-menu-item`,disabled:t.disabled,onSelect:()=>void t.onSelect(e),children:t.label},t.label))})})]},e.path):d})})}var Z={width:14,height:14,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:1.6,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,focusable:!1},je=()=>(0,Y.jsxs)(`svg`,{...Z,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M1.8 4.6h3.6l1.4 1.5h7.4v6.9H1.8Z`}),(0,Y.jsx)(`path`,{d:`M6.3 11.2 7.9 7.4l1.6 3.8`,strokeWidth:`1.3`}),(0,Y.jsx)(`path`,{d:`M6.9 10h2`,strokeWidth:`1.3`})]}),Me=()=>(0,Y.jsxs)(`svg`,{...Z,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M1.8 4.6h3.6l1.4 1.5h7.4v6.9H1.8Z`}),(0,Y.jsx)(`circle`,{cx:`8`,cy:`9.5`,r:`2.2`,strokeWidth:`1.3`}),(0,Y.jsx)(`path`,{d:`M8 8.5v1l0.9 0.6`,strokeWidth:`1.3`})]}),Ne=()=>(0,Y.jsxs)(`svg`,{...Z,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M2.4 3.6h11.2`}),(0,Y.jsx)(`path`,{d:`M2.4 7.4h5`}),(0,Y.jsx)(`path`,{d:`M2.4 11.2h5`}),(0,Y.jsx)(`circle`,{cx:`11.4`,cy:`10.4`,r:`3`,strokeWidth:`1.3`}),(0,Y.jsx)(`path`,{d:`M11.4 9v1.4l1.1 0.7`,strokeWidth:`1.3`})]}),Pe=()=>(0,Y.jsxs)(`svg`,{...Z,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M2.4 3.9h7`}),(0,Y.jsx)(`path`,{d:`M2.4 7.7h7`}),(0,Y.jsx)(`path`,{d:`M2.4 11.5h7`}),(0,Y.jsx)(`path`,{d:`M12.6 3.4v5.2`}),(0,Y.jsx)(`path`,{d:`M12.6 11.6v0.01`,strokeWidth:`2.4`})]}),Fe=()=>(0,Y.jsxs)(`svg`,{...Z,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M2.8 11.8a5.2 5.2 0 0 1 10.4 0`}),(0,Y.jsx)(`path`,{d:`M8 11.8 10.7 8`}),(0,Y.jsx)(`path`,{d:`M8 11.8v0.01`,strokeWidth:`2.4`})]}),Ie=()=>(0,Y.jsxs)(`svg`,{...Z,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M1.4 8S3.8 3.8 8 3.8 14.6 8 14.6 8 12.2 12.2 8 12.2 1.4 8 1.4 8Z`}),(0,Y.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.9`,strokeWidth:`1.3`})]}),Le=()=>(0,Y.jsxs)(`svg`,{...Z,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M1.4 8S3.8 3.8 8 3.8 14.6 8 14.6 8 12.2 12.2 8 12.2 1.4 8 1.4 8Z`}),(0,Y.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.9`,strokeWidth:`1.3`}),(0,Y.jsx)(`path`,{d:`M2.6 13.4 13.4 2.6`})]}),Re=()=>(0,Y.jsxs)(`svg`,{...Z,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M8.6 2.9H3.1v10h10V7.4`}),(0,Y.jsx)(`path`,{d:`M9.4 6.6 13.4 2.6`}),(0,Y.jsx)(`path`,{d:`M10.3 2.6h3.1v3.1`})]}),ze={"tree-alpha":{label:`Folders, A to Z`,hint:`Folder view — folders and files sorted by name.`,icon:je},"tree-modified":{label:`Folders, newest first`,hint:`Folder view — folders by name, files with the newest changes on top.`,icon:Me},"flat-modified":{label:`All files by last modified`,hint:`Every file across all folders, newest changes on top.`,icon:Ne},"flat-issues":{label:`Files by issues`,hint:`Files with open review issues, most issues on top.`,icon:Pe},"flat-criticality":{label:`Files by criticality`,hint:`Files with open review issues, weighted so major issues rank first.`,icon:Fe}};function Be({value:e,modes:t,onChange:n}){return(0,Y.jsx)(`div`,{className:`gz-tray file-view-tray`,role:`radiogroup`,"aria-label":`File list view`,children:t.map(t=>{let r=ze[t],i=r.icon,a=t===e;return(0,Y.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":a,className:`gz-key gz-key--icon${a?` gz-key-active`:``}`,title:r.hint,"aria-label":r.label,onClick:()=>{a||n(t)},children:(0,Y.jsx)(i,{})},t)})})}function Ve({kind:e,value:t,onChange:n}){return(0,Y.jsx)(`div`,{className:`gz-tray file-hidden-tray`,children:(0,Y.jsx)(`button`,{type:`button`,"aria-pressed":t,className:`gz-key gz-key--icon${t?` gz-key-active`:``}`,title:t?`Hide hidden files again.`:e===`workspace`?`Show hidden files — Office lock files, dot-files, and folders like node_modules.`:e===`artifacts`?`Show hidden files — Office lock files, dot-files, and the generated shadow folder.`:`Show hidden files — Office lock files, dot-files, and companion folders.`,"aria-label":`Show hidden files`,onClick:()=>n(!t),children:(0,Y.jsx)(t?Ie:Le,{})})})}function He({onReveal:e}){return(0,Y.jsx)(`div`,{className:`gz-tray file-reveal-tray`,children:(0,Y.jsx)(`button`,{type:`button`,className:`gz-key gz-key--icon`,title:`Open in file manager`,"aria-label":`Open in file manager`,onClick:e,children:(0,Y.jsx)(Re,{})})})}var Ue=`gezel:project-file-tree-width:v1`,We=`gezel:project-file-tree-collapsed:v1`,Ge=150,Ke=560,Q=240,qe=100,Je=34;function Ye(e){return Number.isFinite(e)?Math.max(Ge,Math.min(Ke,Math.round(e))):Q}function Xe(){if(typeof window>`u`)return Q;try{let e=window.localStorage.getItem(Ue);return e?Ye(Number.parseFloat(e)):Q}catch{return Q}}function Ze(){if(typeof window>`u`)return!1;try{return window.localStorage.getItem(We)===`1`}catch{return!1}}function Qe({source:e,entries:t,truncated:n,viewMode:r,modes:i,onViewModeChange:a,showHidden:o,onShowHiddenChange:s,selectedPath:c,onSelect:l,selectableFolders:u,labelFor:d,emptyMessage:f,mutations:p,viewer:m,extraPane:h,headerExtra:_,titleReplacement:v,notices:y,trailingForEntry:x,actionsForEntry:S,customList:C,layoutClassName:w}){let[E,D]=(0,J.useState)(()=>Xe()),[O,k]=(0,J.useState)(()=>Ze()),A=(0,J.useRef)(null),j=(0,J.useCallback)(e=>{let t=Ye(e);D(t);try{window.localStorage.setItem(Ue,String(t))}catch{}},[]),N=(0,J.useCallback)(e=>{k(e);try{window.localStorage.setItem(We,e?`1`:`0`)}catch{}},[]),P=(0,J.useCallback)(e=>{e.preventDefault(),A.current={startX:e.clientX,startWidth:O?Je:E},document.body.classList.add(`chat-rail-resizing`),document.body.style.cursor=`col-resize`;let t=e=>{let t=A.current;if(!t)return;let n=t.startWidth+(e.clientX-t.startX);if(n<qe){N(!0);return}N(!1),j(n)},n=()=>{A.current=null,document.body.style.cursor=``,document.body.classList.remove(`chat-rail-resizing`),window.removeEventListener(`mousemove`,t),window.removeEventListener(`mouseup`,n)};window.addEventListener(`mousemove`,t),window.addEventListener(`mouseup`,n)},[O,N,j,E]),F=(0,J.useCallback)(e=>{let t=e.shiftKey?24:8;if(e.key===`ArrowLeft`||e.key===`ArrowRight`){e.preventDefault();let n=e.key===`ArrowLeft`?-t:t;if(O){if(n<0)return;N(!1);return}let r=E+n;if(r<qe){N(!0);return}j(r)}else e.key===`Home`?(e.preventDefault(),N(!1),j(Ke)):e.key===`End`&&(e.preventDefault(),N(!0))},[O,N,j,E]),I=r===`tree-alpha`||r===`tree-modified`,L=r===`flat-modified`&&!C?t.filter(e=>!e.isDirectory).slice().sort(b):[],R=e.title.toLowerCase();return(0,Y.jsxs)(`div`,{className:`project-files-layout has-tree-grip${O?` tree-collapsed`:``}${h?` has-index-pane`:``}${w?` ${w}`:``}`,style:{"--file-tree-user-width":`${E}px`},children:[p.dialogs,O&&(0,Y.jsx)(`div`,{className:`file-tree-panel file-tree-panel-collapsed`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`file-tree-expand-btn`,onClick:()=>N(!1),"aria-expanded":!1,"aria-label":`Show ${e.title} files`,title:`Show ${e.title} files`,children:[(0,Y.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`12`,height:`12`,"aria-hidden":`true`,children:(0,Y.jsx)(`path`,{d:`M6 3.5 10.5 8 6 12.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,Y.jsx)(`span`,{className:`file-tree-collapsed-label`,children:e.title})]})}),!O&&(0,Y.jsxs)(`div`,{className:`file-tree-panel document-drop-zone${p.activeDropZone===`tree`?` document-drop-zone-active`:``}`,...p.dropZoneProps(`tree`,``),children:[(0,Y.jsxs)(`div`,{className:`file-tree-header`,children:[v??(0,Y.jsx)(`span`,{className:`file-tree-title`,children:e.title}),(0,Y.jsx)(`div`,{className:`file-tree-header-actions`,children:(p.newFolder||p.newFile)&&(0,Y.jsxs)(`div`,{className:`gz-tray file-create-tray`,children:[p.newFolder&&(0,Y.jsx)(`button`,{type:`button`,className:`gz-key gz-key--icon`,"aria-label":`New folder`,title:`New folder`,onClick:()=>p.newFolder?.(),children:(0,Y.jsx)(`i`,{className:`fa-solid fa-folder-plus`,"aria-hidden":`true`})}),p.newFile&&(0,Y.jsx)(`button`,{type:`button`,className:`gz-key gz-key--icon`,"aria-label":e.kind===`documents`?`New document`:`New file`,title:e.kind===`documents`?`New document`:`New file`,onClick:()=>p.newFile?.(),children:(0,Y.jsx)(`i`,{className:`fa-solid fa-file-circle-plus`,"aria-hidden":`true`})})]})}),_,(0,Y.jsxs)(`div`,{className:`file-tree-toolbar`,children:[(0,Y.jsx)(Be,{value:r,modes:i,onChange:a}),(0,Y.jsx)(Ve,{kind:e.kind,value:o,onChange:s}),e.reveal&&(0,Y.jsx)(He,{onReveal:()=>void e.reveal?.()})]})]}),p.status&&(0,Y.jsx)(`output`,{className:`file-tree-status`,children:p.status}),y,(0,Y.jsxs)(`div`,{className:`file-tree`,children:[C?(0,Y.jsx)(Ae,{entries:C.entries,selectedPath:c,onSelect:C.onSelect??l,trailingForEntry:C.trailingForEntry,detailForEntry:C.detailForEntry,actionsForEntry:C.actionsForEntry??S,emptyMessage:C.emptyMessage}):I?t.length===0?(0,Y.jsx)(`p`,{className:`muted`,style:{padding:`0.5rem`,fontSize:`0.85rem`},children:f}):(0,Y.jsx)(T,{entries:t,selectedPath:c,sortMode:r===`tree-modified`?`modified`:`alpha`,labelFor:d,selectableFolders:u,onSelect:l,onRename:p.rename,onDelete:p.remove,onMove:e.kind===`documents`?p.move:void 0,trailingForEntry:x,actionsForEntry:S}):(0,Y.jsx)(Ae,{entries:L,selectedPath:c,onSelect:l,trailingForEntry:e=>{let t=x?.(e),n=e.mtimeMs===void 0?null:(0,Y.jsx)(`span`,{className:`file-flat-time`,title:M(new Date(e.mtimeMs)),children:g(new Date(e.mtimeMs).toISOString())});return t||n?(0,Y.jsxs)(Y.Fragment,{children:[t,n]}):null},actionsForEntry:S,emptyMessage:`No ${R} files yet.`}),!C&&n&&(0,Y.jsxs)(`p`,{className:`muted`,style:{padding:`0.5rem`,fontSize:`0.8rem`},children:[`This folder has more files than can be shown — the listing is incomplete.`,e.reveal?` Use "Open in file manager" above to browse everything.`:``]})]}),p.activeDropZone===`tree`&&(0,Y.jsxs)(`div`,{className:`document-drop-overlay`,"aria-hidden":`true`,children:[(0,Y.jsx)(`i`,{className:`fa-solid fa-file-arrow-down`}),(0,Y.jsxs)(`span`,{children:[`Drop to add to `,e.title]})]})]}),(0,Y.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize ${R} files`,tabIndex:0,className:`chat-rail-grip file-tree-grip`,onMouseDown:P,onKeyDown:F,onDoubleClick:()=>N(!O)}),(0,Y.jsxs)(`div`,{className:`file-viewer-panel document-drop-zone${p.activeDropZone===`detail`?` document-drop-zone-active`:``}`,...p.dropZoneProps(`detail`,et(c,t)),children:[m,p.activeDropZone===`detail`&&(0,Y.jsxs)(`div`,{className:`document-drop-overlay`,"aria-hidden":`true`,children:[(0,Y.jsx)(`i`,{className:`fa-solid fa-file-arrow-down`}),(0,Y.jsxs)(`span`,{children:[`Drop to add to `,tt(c,t,e.title)]})]})]}),h]})}function $e(e){let t=e.lastIndexOf(`/`);return t<0?``:e.slice(0,t)}function et(e,t){return e?t.find(t=>t.path===e)?.isDirectory?e:$e(e):``}function tt(e,t,n){let r=et(e,t);return r?r.slice(r.lastIndexOf(`/`)+1):n}var nt=`__IMAGE__`,rt=`__VIDEO__`,it=`__AUDIO__`,at=`__BINARY__`,ot=new Set([nt,rt,it,at]);function st(e){return/\.(png|jpe?g|gif|svg|webp|bmp)$/i.test(e)}function ct(e){return/\.(mp4|webm|mov|m4v|avi|mkv|ogv)$/i.test(e)}function lt(e){return/\.(mp3|wav|ogg|oga|m4a|aac|flac|opus)$/i.test(e)}function ut(e){return st(e)?nt:ct(e)?rt:lt(e)?it:null}function dt(e){let t=e.slice(0,4096);if(!t)return!1;let n=0;for(let e=0;e<t.length;e++){let r=t.charCodeAt(e);(r===65533||r<9||r>13&&r<32)&&n++}return n/t.length>.1}function ft({kind:e,path:t,fetchBlob:n}){let[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(null);return(0,J.useEffect)(()=>{let e=!1,r=null;return(async()=>{try{let a=await n(t);if(e)return;r=URL.createObjectURL(a),i(r)}catch(t){e||o(t.message)}})(),()=>{e=!0,r&&URL.revokeObjectURL(r)}},[n,t]),a?(0,Y.jsxs)(`p`,{className:`muted small`,children:[`Preview failed: `,a]}):r?e===`image`?(0,Y.jsx)(`img`,{src:r,alt:t}):e===`audio`?(0,Y.jsx)(`audio`,{src:r,controls:!0,style:{width:`100%`}}):(0,Y.jsx)(`video`,{src:r,controls:!0,style:{maxWidth:`100%`,maxHeight:`100%`}}):(0,Y.jsx)(`p`,{className:`muted small`,children:`Loading…`})}function pt({content:e,path:t,fetchBlob:n,sizeBytes:r}){let i=e===`__IMAGE__`?`image`:e===`__VIDEO__`?`video`:e===`__AUDIO__`?`audio`:null;return(0,Y.jsxs)(`div`,{className:`image-preview`,children:[i?(0,Y.jsx)(ft,{kind:i,path:t,fetchBlob:n}):(0,Y.jsx)(`p`,{className:`muted`,style:{textAlign:`center`},children:`Binary file — no text preview available.`}),(0,Y.jsx)(`p`,{className:`muted`,style:{textAlign:`center`},children:r===void 0?t:`${t} · ${E(r)}`})]})}function mt(){return{kind:`documents`,title:`Documents`,canWrite:!0,list:({hidden:e})=>i.listDocuments(``,!0,{stats:!0,hidden:e}),read:e=>i.readDocument(e),fetchBlob:e=>i.fetchDocumentBlob(e),write:async(e,t)=>{await i.writeDocument(e,t)},writeBinary:async(e,t,n)=>{await i.writeDocumentBinary(e,t,n)},remove:async e=>{await i.deleteDocument(e)},mkdir:async e=>{await i.createDocumentFolder(e)},rename:async(e,t)=>{await i.renameDocument(e,t)},reveal:async()=>{await i.revealDocuments()},changeEventPrefix:`gezel:document`}}function ht(e,t,n){let r=t===`workspace`;return{kind:t,title:r?`Workspace`:`Artifacts`,canWrite:n.canWrite,list:({hidden:t})=>r?i.listProjectWorkspace(e,``,!0,{stats:!0,hidden:t}):i.listProjectArtifacts(e,``,!0,{stats:!0,hidden:t}),read:t=>r?i.readProjectWorkspaceFile(e,t):i.readProjectArtifact(e,t),fetchBlob:t=>r?i.fetchProjectWorkspaceBlob(e,t):i.fetchProjectArtifactBlob(e,t),write:async(t,n)=>{r?await i.writeProjectWorkspaceFile(e,{path:t,content:n}):await i.writeProjectArtifact(e,t,n)},writeBinary:async(t,n,a)=>{r?await i.writeProjectWorkspaceBinary(e,t,n,a):await i.writeProjectArtifactBinary(e,t,n,a)},remove:async t=>{r?await i.rmProjectWorkspacePath(e,t,{recursive:!0}):await i.deleteProjectArtifact(e,t)},mkdir:async t=>{r?await i.mkdirProjectWorkspace(e,{path:t}):await i.createProjectArtifactFolder(e,t)},rename:async(t,n)=>{r?await i.renameProjectWorkspacePath(e,{fromPath:t,toPath:n}):await i.renameProjectArtifactPath(e,t,n)},reveal:async()=>{await i.revealProject(e,t)}}}function $(e){return Array.from(e.dataTransfer.types).includes(`Files`)}function gt(e){if(!e||e.isDirectory)return;if(!e.name.includes(`.`))return`.md`;let t=e.name.match(/\.(md|markdown|mdx)$/i);return t?`.${t[1].toLowerCase()}`:void 0}function _t(e,t){return e.some(e=>e.path===t||e.path.startsWith(`${t}/`))}function vt(e,t){let n=e.kind===`documents`?[`document:${t}`]:[`file:${e.kind}:${t}`,`document:${t}`],r=K(t);return r&&n.push(e.kind===`documents`?`outside-in:documents:${r.markdownPath}`:`outside-in:${e.kind}:${r.markdownPath}`),n}function yt(e){let{source:t,entries:n,selectedPath:r,onSelectPath:i,refresh:a}=e,o=e.newFileSuffix??(t.kind===`documents`?`.md`:void 0),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(``),[h,g]=(0,J.useState)(null),[_,y]=(0,J.useState)(null),[b,S]=(0,J.useState)(null),[T,E]=(0,J.useState)(null),D=t.canWrite,O=(0,J.useCallback)((e,n)=>{t.changeEventPrefix&&window.dispatchEvent(new CustomEvent(`${t.changeEventPrefix}-${e}`,{detail:{path:n}}))},[t.changeEventPrefix]),k=(0,J.useCallback)(async e=>{if(r&&!(r!==e.path&&!r.startsWith(`${e.path}/`)))for(let e of vt(t,r))await te(e)},[r,t]),A=(0,J.useCallback)(async()=>{let e=h;if(e)try{await k(e);let o=(e.isDirectory?null:K(e.path))?.companionDirectory??(e.isDirectory?null:x(e.path)),s=o?_t(n,o):!1;await t.remove(e.path),o&&s&&await t.remove(o),O(`deleted`,e.path),r&&(r===e.path||r.startsWith(`${e.path}/`))&&i(null),await a()}catch(e){c(`delete failed: ${e.message}`)}finally{g(null)}},[O,h,n,k,i,a,r,t]),j=(0,J.useCallback)(async(e,o)=>{let s=t.rename;if(!s)throw Error(`Moving files is not available here.`);let c=e.isDirectory?null:K(e.path),l=e.isDirectory?null:K(o);if(c&&l?.format!==c.format)throw Error(`Keep the .${c.format} extension when renaming this document.`);let u=c?.companionDirectory??(e.isDirectory?null:x(e.path)),d=l?.companionDirectory??(e.isDirectory?null:x(o));if(!e.isDirectory&&w(e.path)&&!w(o))throw Error(`Keep the Markdown extension when renaming this document.`);if(d&&n.some(e=>e.path===o||(e.path===d||e.path.startsWith(`${d}/`))&&!(u&&(e.path===u||e.path.startsWith(`${u}/`)))))throw Error(`A document or companion folder with that name already exists.`);await k(e);let f=u?_t(n,u):!1;if(await v(s,e.path,o,f&&u&&d?{from:u,to:d}:null),c&&l){let e=ie(c,n.filter(e=>!e.isDirectory).map(e=>e.path));if(f&&e){let n=`${l.companionDirectory}${e.slice(c.companionDirectory.length)}`;e===c.markdownPath&&n!==l.markdownPath&&(await s(n,l.markdownPath),n=l.markdownPath);let r=await t.read(n),i=G(r.content,l);i!==r.content&&await t.write(n,i)}}await a(),r&&(r===e.path||r.startsWith(`${e.path}/`))&&i(`${o}${r.slice(e.path.length)}`),t.changeEventPrefix&&window.dispatchEvent(new CustomEvent(`${t.changeEventPrefix}-renamed`,{detail:{fromPath:e.path,toPath:o,isDirectory:e.isDirectory}}))},[n,k,i,a,r,t]),M=(0,J.useCallback)(async e=>{let n=_;if(!n||!t.rename)return;let r=e.trim();if(!r||/[\\/]/.test(r)){S(`Enter a name without slashes.`);return}let i=n.path.lastIndexOf(`/`),a=`${i>=0?n.path.slice(0,i+1):``}${r}`;if(a===n.path){y(null),S(null);return}try{await j(n,a),y(null),S(null)}catch(e){S(e.message||`Rename failed.`)}},[j,_,t.rename]),P=(0,J.useCallback)(async(e,n)=>{if(!t.rename||!n.isDirectory||e.isDirectory)return;let r=e.path.lastIndexOf(`/`);if((r<0?``:e.path.slice(0,r))===n.path)return;let i=`${n.path}/${e.name}`;c(`Moving ${e.name} to ${n.path}…`);try{await j(e,i),c(`Moved ${e.name} to ${n.path}.`)}catch(e){c(`move failed: ${e.message||`Unknown error.`}`)}},[j,t.rename]),F=(0,J.useCallback)(async e=>{let n=e.trim();if(n)try{await t.write(n,``),u(!1),await a(),i(n),O(`created`,n)}catch(e){c(`create failed: ${e.message}`)}},[O,i,a,t]),I=(0,J.useCallback)(async e=>{let n=e.trim(),r=t.mkdir;if(!(!n||!r))try{await r(n),f(!1),await a(),O(`created`,n)}catch(e){c(`create folder failed: ${e.message}`)}},[O,a,t]),L=(0,J.useCallback)(async(e,r)=>{if(!$(e))return;e.preventDefault(),e.stopPropagation(),E(null);let o=Array.from(e.dataTransfer.files);if(o.length===0)return;c(`Adding ${o.length===1?o[0]?.name:`${o.length} files`}…`);let s=await ae({target:{writeText:(e,n)=>t.write(e,n),writeBinary:(e,n,r)=>t.writeBinary(e,n,r)},files:o,destination:r,existingPaths:n.map(e=>e.path)});if(s.importedPaths.length>0){await a();let e=s.importedPaths.at(-1);i(e),t.changeEventPrefix&&window.dispatchEvent(new CustomEvent(`${t.changeEventPrefix}-created`,{detail:{path:e,paths:s.importedPaths}}))}let l=s.importedPaths.length,u=s.rejected.length;if(u>0){let e=s.rejected[0];c(`${l>0?`Added ${l}; `:``}couldn't add ${e.name}: ${e.reason}${u>1?` (+${u-1} more)`:``}`)}else c(`Added ${l} ${l===1?`file`:`files`}.`)},[n,i,a,t]),R=(0,J.useCallback)((e,t)=>D?{onDragEnterCapture:t=>{$(t)&&(t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect=`copy`,E(e))},onDragOverCapture:t=>{$(t)&&(t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect=`copy`,E(t=>t===e?t:e))},onDragLeaveCapture:e=>{if(!$(e))return;let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||E(null)},onDropCapture:e=>void L(e,t)}:{},[L,D]);return{dialogs:(0,J.useMemo)(()=>(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(C,{open:l,title:`New ${t.kind===`documents`?`document`:`file`}`,placeholder:t.kind===`documents`?p?`e.g. coding`:`e.g. guidelines/coding`:`e.g. notes/report.md`,submitLabel:`Create`,parentPath:p||void 0,fieldLabel:p?`Name`:`Path`,suffix:o,onSubmit:F,onCancel:()=>u(!1)}),(0,Y.jsx)(C,{open:d,title:`New folder`,placeholder:`e.g. guidelines`,submitLabel:`Create`,initialValue:p,onSubmit:I,onCancel:()=>f(!1)}),(0,Y.jsx)(C,{open:_!==null,title:_?.isDirectory?`Rename folder`:`Rename file`,fieldLabel:`Name`,placeholder:`New name`,submitLabel:`Rename`,initialValue:_?.name??``,suffix:gt(_),error:b,onSubmit:M,onCancel:()=>{y(null),S(null)}}),(0,Y.jsx)(N,{open:h!==null,title:h?.isDirectory?`Delete folder?`:`Delete file?`,message:h?.isDirectory?`This will remove "${h.path}" and everything inside it. This cannot be undone.`:h?`"${h.path}" will be permanently removed.`:``,confirmLabel:`Delete`,danger:!0,onCancel:()=>g(null),onConfirm:A})]}),[A,M,h,F,I,o,p,b,_,l,d,t.kind]),status:s,setStatus:c,newFile:D?(e=``)=>{m(e),u(!0)}:void 0,newFolder:D&&t.mkdir?(e=``)=>{m(e),f(!0)}:void 0,rename:D&&t.rename?e=>{S(null),y(e)}:void 0,remove:D?e=>g(e):void 0,move:D&&t.rename?P:void 0,activeDropZone:T,dropZoneProps:R}}export{nt as a,dt as c,ke as d,be as f,se as h,at as i,ut as l,le as m,mt as n,ot as o,de as p,ht as r,pt as s,yt as t,Qe as u};
|